mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-27 02:50:28 +00:00
FDS: Fixed crash on power cycle
This commit is contained in:
parent
7137740cd2
commit
7f71773dd0
@ -53,27 +53,29 @@ public:
|
||||
SetBit(FdsSystemActionManager::FdsButtons::InsertDisk1 + _insertDiskNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessSystemActions() override
|
||||
{
|
||||
SystemActionManager::ProcessSystemActions();
|
||||
bool needEject = IsPressed(FdsSystemActionManager::FdsButtons::EjectDiskButton);
|
||||
int diskToInsert = -1;
|
||||
for(int i = 0; i < 16; i++) {
|
||||
if(IsPressed(FdsSystemActionManager::FdsButtons::InsertDisk1 + i)) {
|
||||
diskToInsert = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<FDS> mapper = _mapper.lock();
|
||||
if(mapper) {
|
||||
if(IsPressed(FdsSystemActionManager::FdsButtons::EjectDiskButton)) {
|
||||
if(needEject || diskToInsert >= 0) {
|
||||
shared_ptr<FDS> mapper = _mapper.lock();
|
||||
if(needEject) {
|
||||
mapper->EjectDisk();
|
||||
}
|
||||
|
||||
for(int i = 0; i < 16; i++) {
|
||||
if(IsPressed(FdsSystemActionManager::FdsButtons::InsertDisk1 + i)) {
|
||||
mapper->InsertDisk(i);
|
||||
break;
|
||||
}
|
||||
if(diskToInsert >= 0) {
|
||||
mapper->InsertDisk(diskToInsert);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EjectDisk()
|
||||
{
|
||||
_needEjectDisk = true;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
_needPowerCycle = true;
|
||||
}
|
||||
|
||||
virtual void ProcessSystemActions()
|
||||
void ProcessSystemActions()
|
||||
{
|
||||
shared_ptr<Console> console = _console.lock();
|
||||
if(console) {
|
||||
@ -70,6 +70,7 @@ public:
|
||||
}
|
||||
if(IsPressed(SystemActionManager::Buttons::PowerButton)) {
|
||||
console->PowerCycle();
|
||||
//Calling PowerCycle() causes this object to be deleted - no code must be written below this line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,8 @@ namespace Mesen.GUI.Config
|
||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.TakeScreenshot, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("F12") }));
|
||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.LoadRandomGame, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("Insert") }));
|
||||
|
||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.SwitchDiskSide, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("B") }));
|
||||
|
||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Reset, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("R") }));
|
||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.PowerCycle, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("T") }));
|
||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Pause, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Esc") }));
|
||||
|
Loading…
Reference in New Issue
Block a user