mirror of
https://github.com/libretro/Mesen.git
synced 2025-01-19 15:22:50 +00:00
Libretro: Fixed issues with system actions (FDS/VS and reset button)
This commit is contained in:
parent
86eabc4055
commit
efe60a082e
@ -189,7 +189,6 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
|
||||
ResetComponents(false);
|
||||
|
||||
_rewindManager.reset(new RewindManager());
|
||||
_controlManager->UpdateInputState();
|
||||
|
||||
VideoDecoder::GetInstance()->StartThread();
|
||||
|
||||
@ -378,6 +377,8 @@ void Console::ResetComponents(bool softReset)
|
||||
debugger->Resume();
|
||||
}
|
||||
}
|
||||
|
||||
_controlManager->UpdateInputState();
|
||||
}
|
||||
|
||||
void Console::Stop()
|
||||
|
@ -100,17 +100,21 @@ public:
|
||||
|
||||
void SwitchDiskSide()
|
||||
{
|
||||
shared_ptr<FDS> mapper = _mapper.lock();
|
||||
if(mapper) {
|
||||
InsertDisk(mapper->GetCurrentDisk() ^ 0x01);
|
||||
if(!IsAutoInsertDiskEnabled()) {
|
||||
shared_ptr<FDS> mapper = _mapper.lock();
|
||||
if(mapper && mapper->IsDiskInserted()) {
|
||||
InsertDisk(mapper->GetCurrentDisk() ^ 0x01);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InsertNextDisk()
|
||||
{
|
||||
shared_ptr<FDS> mapper = _mapper.lock();
|
||||
if(mapper) {
|
||||
InsertDisk(((mapper->GetCurrentDisk() & 0xFE) + 2) % mapper->GetSideCount());
|
||||
if(!IsAutoInsertDiskEnabled()) {
|
||||
shared_ptr<FDS> mapper = _mapper.lock();
|
||||
if(mapper) {
|
||||
InsertDisk(((mapper->GetCurrentDisk() & 0xFE) + 2) % mapper->GetSideCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,21 @@ private:
|
||||
retro_input_state_t _getInputState = nullptr;
|
||||
retro_input_poll_t _pollInput = nullptr;
|
||||
bool _mouseButtons[3] = { false, false, false };
|
||||
bool _wasPushed[16] = { };
|
||||
|
||||
bool ProcessAction(uint32_t button)
|
||||
{
|
||||
if(_getInputState(0, RETRO_DEVICE_JOYPAD, 0, button)) {
|
||||
if(!_wasPushed[button]) {
|
||||
//Newly pressed, process action
|
||||
_wasPushed[button] = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
_wasPushed[button] = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
LibretroKeyManager()
|
||||
@ -59,18 +74,21 @@ public:
|
||||
|
||||
shared_ptr<FdsSystemActionManager> fdsSam = Console::GetInstance()->GetSystemActionManager<FdsSystemActionManager>();
|
||||
if(fdsSam) {
|
||||
if(_getInputState(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L)) {
|
||||
if(ProcessAction(RETRO_DEVICE_ID_JOYPAD_L)) {
|
||||
fdsSam->InsertNextDisk();
|
||||
} else if(_getInputState(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R)) {
|
||||
}
|
||||
|
||||
if(ProcessAction(RETRO_DEVICE_ID_JOYPAD_R)) {
|
||||
fdsSam->SwitchDiskSide();
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<VsSystemActionManager> vsSam = Console::GetInstance()->GetSystemActionManager<VsSystemActionManager>();
|
||||
if(vsSam) {
|
||||
if(_getInputState(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2)) {
|
||||
if(ProcessAction(RETRO_DEVICE_ID_JOYPAD_L2)) {
|
||||
vsSam->InsertCoin(0);
|
||||
} else if(_getInputState(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2)) {
|
||||
}
|
||||
if(ProcessAction(RETRO_DEVICE_ID_JOYPAD_R2)) {
|
||||
vsSam->InsertCoin(1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user