mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Changelog: - nall: added -static-libgcc -static-libstdc++ to Windows/GCC link flags - bsnes, higan: added program icons to main window when game isn't loaded - bsnes: improved recent games menu sorting - bsnes: fixed multi-game recent game loading on Windows - bsnes: completed path override support - bsnes, higan: added screensaver suppression on Windows - icarus: add 32K volatile RAM to SuperFX boards that report no RAM (fixes Starfox) - bsnes, higan: added automatic dependency generation [Talarubi] - hiro/GTK: appending actions to menus restores enabled() state - higan: use board node inside manifest.bml if it exists - bsnes: added blur emulation and color emulation options to view menu - ruby: upgraded input.sdl to SDL 2.0 (though it makes no functional difference sadly) - ruby: removed video.sdl (due to deprecating SDL 1.2) - nall, ruby: improvements to HID class (generic vendor and product IDs) Errata: - bsnes, higan: on Windows, Application::Windows::onScreenSaver needs `[&]` lambda capture, not `[]` - find it in presentation/presentation.cpp
116 lines
2.8 KiB
C++
116 lines
2.8 KiB
C++
auto InputManager::appendHotkeys() -> void {
|
|
static int quickStateSlot = 1;
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Toggle Fullscreen";
|
|
hotkey->press = [] {
|
|
presentation->toggleFullScreen();
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Toggle Mouse Capture";
|
|
hotkey->press = [] {
|
|
input->acquired() ? input->release() : input->acquire();
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Save Quick State";
|
|
hotkey->press = [] {
|
|
program->saveState(quickStateSlot);
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Load Quick State";
|
|
hotkey->press = [&] {
|
|
program->loadState(quickStateSlot);
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Decrement Quick State";
|
|
hotkey->press = [&] {
|
|
if(--quickStateSlot < 1) quickStateSlot = 5;
|
|
program->showMessage({"Selected quick state slot ", quickStateSlot});
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Increment Quick State";
|
|
hotkey->press = [&] {
|
|
if(++quickStateSlot > 5) quickStateSlot = 1;
|
|
program->showMessage({"Selected quick state slot ", quickStateSlot});
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Pause Emulation";
|
|
hotkey->press = [] {
|
|
program->togglePause();
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Fast Forward";
|
|
hotkey->press = [] {
|
|
video->setBlocking(false);
|
|
audio->setBlocking(false);
|
|
};
|
|
hotkey->release = [] {
|
|
video->setBlocking(settings["Video/Synchronize"].boolean());
|
|
audio->setBlocking(settings["Audio/Synchronize"].boolean());
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Soft Reset";
|
|
hotkey->press = [] {
|
|
program->softReset();
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Power Cycle";
|
|
hotkey->press = [] {
|
|
program->powerCycle();
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
hotkey->name = "Rotate Display";
|
|
hotkey->press = [] {
|
|
program->rotateDisplay();
|
|
};
|
|
hotkeys.append(hotkey);
|
|
}
|
|
|
|
for(auto& hotkey : hotkeys) {
|
|
hotkey->path = string{"Hotkey/", hotkey->name}.replace(" ", "");
|
|
hotkey->assignment = settings(hotkey->path).text();
|
|
hotkey->bind();
|
|
}
|
|
}
|
|
|
|
auto InputManager::pollHotkeys() -> void {
|
|
if(!program->focused()) return;
|
|
|
|
for(auto& hotkey : hotkeys) {
|
|
int16 state = hotkey->poll();
|
|
if(hotkey->state == 0 && state == 1 && hotkey->press) hotkey->press();
|
|
if(hotkey->state == 1 && state == 0 && hotkey->release) hotkey->release();
|
|
hotkey->state = state;
|
|
}
|
|
}
|