2016-05-01 00:08:53 +00:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "ControlManager.h"
|
|
|
|
#include "CPU.h"
|
2016-06-22 02:13:26 +00:00
|
|
|
#include "Console.h"
|
2016-06-22 23:23:08 +00:00
|
|
|
#include "VsZapper.h"
|
2016-05-01 00:08:53 +00:00
|
|
|
#include <assert.h>
|
2016-07-10 13:05:41 +00:00
|
|
|
#include "StandardController.h"
|
2017-04-22 17:19:21 +00:00
|
|
|
#include "MovieManager.h"
|
2016-07-10 13:05:41 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
class BaseControlDevice;
|
|
|
|
|
2016-07-10 13:05:41 +00:00
|
|
|
enum class VsInputType
|
|
|
|
{
|
|
|
|
Default = 0,
|
|
|
|
TypeA = 1,
|
|
|
|
TypeB = 2,
|
|
|
|
TypeC = 3,
|
|
|
|
TypeD = 4,
|
|
|
|
TypeE = 5
|
|
|
|
};
|
2016-05-01 00:08:53 +00:00
|
|
|
|
|
|
|
class VsControlManager : public ControlManager
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static VsControlManager *_instance;
|
|
|
|
uint8_t _prgChrSelectBit;
|
2016-07-10 13:05:41 +00:00
|
|
|
VsInputType _inputType = VsInputType::Default;
|
2017-11-20 04:08:23 +00:00
|
|
|
bool _refreshState = false;
|
|
|
|
|
2016-06-22 02:13:26 +00:00
|
|
|
uint32_t _protectionCounter = 0;
|
2017-11-20 04:08:23 +00:00
|
|
|
const uint32_t _protectionData[3][32] = {
|
2016-06-22 02:13:26 +00:00
|
|
|
{
|
|
|
|
0xFF, 0xBF, 0xB7, 0x97, 0x97, 0x17, 0x57, 0x4F,
|
|
|
|
0x6F, 0x6B, 0xEB, 0xA9, 0xB1, 0x90, 0x94, 0x14,
|
|
|
|
0x56, 0x4E, 0x6F, 0x6B, 0xEB, 0xA9, 0xB1, 0x90,
|
|
|
|
0xD4, 0x5C, 0x3E, 0x26, 0x87, 0x83, 0x13, 0x00
|
|
|
|
},
|
|
|
|
{
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x94, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
},
|
|
|
|
{
|
|
|
|
0x05, 0x01, 0x89, 0x37, 0x05, 0x00, 0xD1, 0x3E,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
}
|
|
|
|
};
|
2016-05-01 00:08:53 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
ControllerType GetControllerType(uint8_t port) override;
|
2016-05-01 00:08:53 +00:00
|
|
|
|
|
|
|
public:
|
2017-11-20 04:08:23 +00:00
|
|
|
VsControlManager(shared_ptr<BaseControlDevice> systemActionManager, shared_ptr<BaseControlDevice> mapperControlDevice);
|
|
|
|
virtual ~VsControlManager();
|
2016-05-01 00:08:53 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
void StreamState(bool saving) override;
|
|
|
|
void Reset(bool softReset) override;
|
2016-07-10 13:05:41 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
static VsControlManager* GetInstance();
|
|
|
|
|
|
|
|
void SetInputType(VsInputType inputType);
|
|
|
|
|
|
|
|
void GetMemoryRanges(MemoryRanges &ranges) override;
|
2016-06-22 02:13:26 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
uint8_t GetPrgChrSelectBit();
|
2016-05-01 00:08:53 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
void RemapControllerButtons();
|
2016-05-01 00:08:53 +00:00
|
|
|
|
2017-11-20 04:08:23 +00:00
|
|
|
uint8_t ReadRAM(uint16_t addr) override;
|
|
|
|
void WriteRAM(uint16_t addr, uint8_t value) override;
|
2016-05-01 00:08:53 +00:00
|
|
|
};
|