bsnes/higan/target-bsnes/input/hotkeys.cpp

90 lines
2.6 KiB
C++
Raw Normal View History

auto InputManager::bindHotkeys() -> void {
static int stateSlot = 1;
hotkeys.append(InputHotkey("Toggle Fullscreen Mode").onPress([] {
presentation->toggleFullscreenMode();
}));
hotkeys.append(InputHotkey("Toggle Mouse Capture").onPress([] {
input.acquired() ? input.release() : input.acquire();
}));
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
hotkeys.append(InputHotkey("Toggle Cheat Codes").onPress([] {
toolsWindow->cheatEditor.enableCheats.setChecked(
!toolsWindow->cheatEditor.enableCheats.checked()
);
toolsWindow->cheatEditor.enableCheats.doToggle();
}));
hotkeys.append(InputHotkey("Save State").onPress([&] {
program->saveState({"quick/slot ", stateSlot});
}));
hotkeys.append(InputHotkey("Load State").onPress([&] {
program->loadState({"quick/slot ", stateSlot});
}));
hotkeys.append(InputHotkey("Load Undo State").onPress([&] {
program->loadState("quick/undo");
}));
hotkeys.append(InputHotkey("Load Redo State").onPress([&] {
program->loadState("quick/redo");
}));
hotkeys.append(InputHotkey("Increment State Slot").onPress([&] {
if(--stateSlot < 1) stateSlot = 9;
program->showMessage({"Selected state slot ", stateSlot});
}));
hotkeys.append(InputHotkey("Decrement State Slot").onPress([&] {
if(++stateSlot > 9) stateSlot = 1;
program->showMessage({"Selected state slot ", stateSlot});
}));
hotkeys.append(InputHotkey("Capture Screenshot").onPress([] {
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
program->captureScreenshot();
}));
hotkeys.append(InputHotkey("Fast Forward").onPress([] {
video.setBlocking(false);
audio.setBlocking(false);
}).onRelease([] {
video.setBlocking(settings["Video/Blocking"].boolean());
audio.setBlocking(settings["Audio/Blocking"].boolean());
}));
hotkeys.append(InputHotkey("Pause Emulation").onPress([] {
presentation->pauseEmulation.setChecked(!presentation->pauseEmulation.checked());
}));
Update to v106r46 release. byuu says: Changelog: - bsnes, higan: simplified make output; reordered rules - hiro: added Window::set(Minimum,Maximum)Size() [only implemented in GTK+ so far] - bsnes: only allow the window to be shrunk to the 1x multiplier size - bsnes: refactored Integral Scaling checkbox to {Center, Scale, Stretch} radio selection - nall: call fflush() after nall::print() to stdout or stderr [needed for msys2/bash] - bsnes, higan: program/interface.cpp renamed to program/platform.cpp - bsnes: trim ".shader/" from names in Settings→Shader menu - bsnes: Settings→Shader menu updated on video driver changes - bsnes: remove missing games from recent files list each time it is updated - bsnes: video multiplier menu generated dynamically based on largest monitor size at program startup - bsnes: added shrink window and center window function to video multiplier menu - bsnes: de-minimize presentation window when exiting fullscreen mode or changing video multiplier - bsnes: center the load game dialog against the presentation window (important for multi-monitor setups) - bsnes: screenshots are not immediate instead of delayed one frame - bsnes: added frame advance menu option and hotkey - bsnes: added enable cheats checkbox and hotkey; can be used to quickly enable/disable all active cheats Errata: - hiro/Windows: `SW_MINIMIZED`, `SW_MAXIMIZED `=> `SW_MINIMIZE`, `SW_MAXIMIZE` - hiro/Windows: add pMonitor::workspace() - hiro/Windows: add setMaximized(), setMinimized() in pWindow::construct() - bsnes: call setCentered() after setMaximized(false)
2018-07-08 04:58:27 +00:00
hotkeys.append(InputHotkey("Frame Advance").onPress([] {
presentation->frameAdvance.doActivate();
}));
hotkeys.append(InputHotkey("Reset Emulation").onPress([] {
Update to v106r42 release. byuu says: Changelog: - emulator: added `Thread::setHandle(cothread_t)` - icarus: added special heuristics support for the Tengai Maykou Zero fan translation - board identifier is: EXSPC7110-RAM-EPSONRTC (match on SPC7110 + ROM size=56mbit) - board ROM contents are: 8mbit program, 40mbit data, 8mbit expansion (sizes are fixed) - bsnes: show messages on game load, unload, and reset - bsnes: added support for BS Memory and Sufami Turbo games - bsnes: added support for region selection (Auto [default], NTSC, PAL) - bsnes: correct presentation window size from 223/239 to 224/240 - bsnes: add SA-1 internal RAM on cartridges with BS Memory slot - bsnes: fixed recovery state to store inside .bsz archive - bsnes: added support for custom manifests in both game pak and game ROM modes - bsnes: added icarus game database support (manifest → database → heuristics) - bsnes: added flexible SuperFX overclocking - bsnes: added IPS and BPS soft-patching support to all ROM types (sfc,smc,gb,gbc,bs,st) - can load patches inside of ZIP archives (matches first “.ips” or “.bps” file) - bsnes/ppu: cache interlace/overscan/vdisp (277 → 291fps with fast PPU) - hiro/Windows: faster painting of Label widget on expose - hiro/Windows: immediately apply LineEdit::setBackgroundColor changes - hiro/Qt: inherit Window backgroundColor when one is not assigned to Label Errata: - sfc/ppu-fast: remove `renderMode7Hires()` function (the body isn't in the codebase) - bsnes: advanced note label should probably use a lighter text color and/or smaller font size instead of italics I didn't test the soft-patching at all, as I don't have any patches on my dev box. If anyone wants to test, that'd be great. The Tengai Makyou Zero fan translation would be a great test case.
2018-06-26 03:17:26 +00:00
program->reset();
}));
hotkeys.append(InputHotkey("Quit Emulator").onPress([] {
program->quit();
}));
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) {
auto 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;
}
}