FDS: Fixed crash on power cycle
This commit is contained in:
parent
7137740cd2
commit
7f71773dd0
3 changed files with 19 additions and 14 deletions
|
@ -53,23 +53,25 @@ public:
|
||||||
SetBit(FdsSystemActionManager::FdsButtons::InsertDisk1 + _insertDiskNumber);
|
SetBit(FdsSystemActionManager::FdsButtons::InsertDisk1 + _insertDiskNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessSystemActions() override
|
if(needEject || diskToInsert >= 0) {
|
||||||
{
|
|
||||||
SystemActionManager::ProcessSystemActions();
|
|
||||||
|
|
||||||
shared_ptr<FDS> mapper = _mapper.lock();
|
shared_ptr<FDS> mapper = _mapper.lock();
|
||||||
if(mapper) {
|
if(needEject) {
|
||||||
if(IsPressed(FdsSystemActionManager::FdsButtons::EjectDiskButton)) {
|
|
||||||
mapper->EjectDisk();
|
mapper->EjectDisk();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 16; i++) {
|
if(diskToInsert >= 0) {
|
||||||
if(IsPressed(FdsSystemActionManager::FdsButtons::InsertDisk1 + i)) {
|
mapper->InsertDisk(diskToInsert);
|
||||||
mapper->InsertDisk(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
_needPowerCycle = true;
|
_needPowerCycle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ProcessSystemActions()
|
void ProcessSystemActions()
|
||||||
{
|
{
|
||||||
shared_ptr<Console> console = _console.lock();
|
shared_ptr<Console> console = _console.lock();
|
||||||
if(console) {
|
if(console) {
|
||||||
|
@ -70,6 +70,7 @@ public:
|
||||||
}
|
}
|
||||||
if(IsPressed(SystemActionManager::Buttons::PowerButton)) {
|
if(IsPressed(SystemActionManager::Buttons::PowerButton)) {
|
||||||
console->PowerCycle();
|
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.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.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.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.PowerCycle, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Ctrl"), Key2 = InteropEmu.GetKeyCode("T") }));
|
||||||
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Pause, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Esc") }));
|
ShortcutKeys1.Add(new ShortcutKeyInfo(EmulatorShortcut.Pause, new KeyCombination() { Key1 = InteropEmu.GetKeyCode("Esc") }));
|
||||||
|
|
Loading…
Add table
Reference in a new issue