Mesen/Core/FourScore.h
Souryo 850102bbdc Input: Added support for ~20 new peripherals (Incomplete, more fixes/changes to come)
Movies: Rewrote format to support all IO devices and console types
Netplay: Now supports all IO devices and console types
2017-11-19 23:08:23 -05:00

49 lines
993 B
C++

#pragma once
#include "BaseControlDevice.h"
class FourScore : public BaseControlDevice
{
private:
uint32_t _signature4016 = 0;
uint32_t _signature4017 = 0;
protected:
void StreamState(bool saving) override
{
BaseControlDevice::StreamState(saving);
Stream(_signature4016, _signature4017);
}
void RefreshStateBuffer() override
{
//Signature for port 0 = 0x10, reversed bit order => 0x08
//Signature for port 1 = 0x20, reversed bit order => 0x04
_signature4016 = (0x08 << 16);
_signature4017 = (0x04 << 16);
}
public:
FourScore() : BaseControlDevice(BaseControlDevice::ExpDevicePort)
{
}
uint8_t ReadRAM(uint16_t addr) override
{
uint8_t output = 0;
if(addr == 0x4016) {
output = _signature4016 & 0x01;
_signature4016 >>= 1;
} else if(addr == 0x4017) {
output = _signature4017 & 0x01;
_signature4017 >>= 1;
}
StrobeProcessRead();
return output;
}
void WriteRAM(uint16_t addr, uint8_t value) override
{
StrobeProcessWrite(value);
}
};