Date: Thu, 17 Dec 2020 22:27:42 +0100
Subject: [PATCH 08/27] added new hotkey mappings
---
docs/index.html | 139 +++++++-------
src/common/PKeyboardHandler.cxx | 326 +++++++++++++++++---------------
2 files changed, 246 insertions(+), 219 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index 0945f4c89..c8fe61d83 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1572,68 +1572,68 @@
Decrease joystick deadzone |
- - |
- - |
+ Shift-Control + F1 |
+ Shift-Control + F1 |
Increase joystick deadzone |
- - |
- - |
+ Control + F1 |
+ Control + F1 |
Decrease analog paddle sensitivity |
- - |
- - |
+ Shift-Control + F2 |
+ Shift-Control + F2 |
Increase analog paddle sensitivity |
- - |
- - |
+ Control + F2 |
+ Control + F2 |
Decrease analog paddle dejitter averaging |
- - |
- - |
+ Shift-Control + F3 |
+ Shift-Control + F3 |
Increase analog paddle dejitter averaging |
- - |
- - |
+ Control + F3 |
+ Control + F3 |
Decrease analog paddle dejitter reaction |
- - |
- - |
+ Shift-Control + F4 |
+ Shift-Control + F4 |
Increase analog paddle dejitter reaction |
- - |
- - |
+ Control + F4 |
+ Control + F4 |
Decrease digital paddle sensitivity |
- - |
- - |
+ Shift-Control + F5 |
+ Shift-Control + F5 |
Increase digital paddle sensitivity |
- - |
- - |
+ Control + F5 |
+ Control + F5 |
Decrease digital and mouse driving controller sensitivity |
- - |
- - |
+ Shift-Control + F6 |
+ Shift-Control + F6 |
Increase digital and mouse driving controller sensitivity |
- - |
- - |
+ Control + F6 |
+ Control + F6 |
@@ -1650,14 +1650,14 @@
Toggle allowing all four directions on joystick
to be pressed simultaneously |
- - |
- - |
+ Control + F7 |
+ Control + F7 |
Toggle use of modifier key combos |
- - |
- - |
+ Control + F8 |
+ Control + F8 |
@@ -1669,49 +1669,49 @@
Select previous controllers emulated by the mouse
(all, analog, none) |
- - |
- - |
+ Shift-Control + F9 |
+ Shift-Control + F9 |
Select next controllers emulated by the mouse
(all, analog, none) |
- - |
- - |
+ Control + F9 |
+ Control + F9 |
Decrease mouse paddle sensitivity |
- - |
- - |
+ Shift-Control + F10 |
+ Shift-Control + F10 |
Increase mouse paddle sensitivity |
- - |
- - |
+ Control + F10 |
+ Control + F10 |
Decrease mouse trackball sensitivity |
- - |
- - |
+ Shift-Control + F11 |
+ Shift-Control + F11 |
Increase mouse trackball sensitivity |
- - |
- - |
+ Control + F11 |
+ Control + F11 |
Select previous mouse cursor visiblity option
(-UI, -Emulation/-UI, +Emulation/+UI, -Emulation/+UI, +Emulation) |
- - |
- - |
+ Shift-Control + F12 |
+ Shift-Control + F12 |
Select next mouse cursor visiblity option
(-UI, -Emulation/-UI, +Emulation/+UI, -Emulation/+UI, +Emulation) |
- - |
- - |
+ Control + F12 |
+ Control + F12 |
@@ -1722,60 +1722,58 @@
Select previous left port controller type |
- Shift-Control-Alt + L |
- Shift-Control-Cmd + L |
+ Shift-Control + 2 |
+ Shift-Control + 2 |
Select next left port controller type |
- Control-Alt + L |
- Control-Cmd + L |
+ Control + 2 |
+ Control + 2 |
Select previous right port controller type |
- Shift-Control-Alt + r |
- Shift-Control-Cmd + r |
+ Shift-Control + 3 |
+ Shift-Control + 3 |
Select next right port controller type |
- Control-Alt + r |
- Control-Cmd + r |
+ Control + 3 |
+ Control + 3 |
Toggle swap left and right controller ports |
- - |
- - |
+ Control + 4 |
+ Control + 4 |
Toggle swap paddles |
- - |
- - |
+ Control + 5 |
+ Control + 5 |
Decrease horizontal center of paddles |
- - |
- - |
+ Shift-Control + 6 |
+ Shift-Control + 6 |
-
Increase horizontal center of paddles |
- - |
- - |
+ Control + 6 |
+ Control + 6 |
Decrease vertical center of paddles |
- - |
- - |
+ Shift-Control + 7 |
+ Shift-Control + 7 |
-
Increase vertical center of paddles |
- - |
- - |
+ Control + 7 |
+ Control + 7 |
@@ -1791,14 +1789,13 @@
Decrease mouse paddle axes range |
- - |
- - |
+ Shift-Control + 8 |
+ Shift-Control + 8 |
-
Increase mouse paddle axes range |
- - |
- - |
+ Control + 8 |
+ Control + 8 |
diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx
index 7d06e455a..5c87fa3c1 100644
--- a/src/common/PKeyboardHandler.cxx
+++ b/src/common/PKeyboardHandler.cxx
@@ -502,164 +502,194 @@ void PhysicalKeyboardHandler::toggleModKeys(bool toggle)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalKeyboardHandler::EventMappingArray
PhysicalKeyboardHandler::DefaultCommonMapping = {
- {Event::ConsoleSelect, KBDK_F1},
- {Event::ConsoleReset, KBDK_F2},
- {Event::ConsoleColor, KBDK_F3},
- {Event::Console7800Pause, KBDK_F3, MOD3},
- {Event::ConsoleLeftDiffA, KBDK_F5},
- {Event::ConsoleRightDiffA, KBDK_F7},
- {Event::SaveState, KBDK_F9},
- {Event::SaveAllStates, KBDK_F9, MOD3},
- {Event::PreviousState, KBDK_F10, KBDM_SHIFT},
- {Event::NextState, KBDK_F10},
- {Event::ToggleAutoSlot, KBDK_F10, MOD3},
- {Event::LoadState, KBDK_F11},
- {Event::LoadAllStates, KBDK_F11, MOD3},
- {Event::TakeSnapshot, KBDK_F12},
-#ifdef BSPF_MACOS
- {Event::TogglePauseMode, KBDK_P, KBDM_SHIFT | MOD3},
-#else
- {Event::TogglePauseMode, KBDK_PAUSE},
-#endif
- {Event::OptionsMenuMode, KBDK_TAB},
- {Event::CmdMenuMode, KBDK_BACKSLASH},
- {Event::TimeMachineMode, KBDK_T, KBDM_SHIFT},
- {Event::DebuggerMode, KBDK_GRAVE},
- {Event::ExitMode, KBDK_ESCAPE},
-#ifdef BSPF_MACOS
- {Event::Quit, KBDK_Q, MOD3},
-#else
- {Event::Quit, KBDK_Q, KBDM_CTRL},
-#endif
- {Event::ReloadConsole, KBDK_R, KBDM_CTRL},
- {Event::PreviousMultiCartRom, KBDK_R, KBDM_SHIFT | KBDM_CTRL},
+ { Event::ConsoleSelect, KBDK_F1 },
+ { Event::ConsoleReset, KBDK_F2 },
+ { Event::ConsoleColor, KBDK_F3 },
+ { Event::Console7800Pause, KBDK_F3, MOD3 },
+ { Event::ConsoleLeftDiffA, KBDK_F5 },
+ { Event::ConsoleRightDiffA, KBDK_F7 },
+ { Event::SaveState, KBDK_F9 },
+ { Event::SaveAllStates, KBDK_F9, MOD3 },
+ { Event::PreviousState, KBDK_F10, KBDM_SHIFT },
+ { Event::NextState, KBDK_F10 },
+ { Event::ToggleAutoSlot, KBDK_F10, MOD3 },
+ { Event::LoadState, KBDK_F11 },
+ { Event::LoadAllStates, KBDK_F11, MOD3 },
+ { Event::TakeSnapshot, KBDK_F12 },
+ #ifdef BSPF_MACOS
+ { Event::TogglePauseMode, KBDK_P, KBDM_SHIFT | MOD3 },
+ #else
+ { Event::TogglePauseMode, KBDK_PAUSE },
+ #endif
+ { Event::OptionsMenuMode, KBDK_TAB },
+ { Event::CmdMenuMode, KBDK_BACKSLASH },
+ { Event::TimeMachineMode, KBDK_T, KBDM_SHIFT },
+ { Event::DebuggerMode, KBDK_GRAVE },
+ { Event::ExitMode, KBDK_ESCAPE },
+ #ifdef BSPF_MACOS
+ { Event::Quit, KBDK_Q, MOD3 },
+ #else
+ { Event::Quit, KBDK_Q, KBDM_CTRL },
+ #endif
+ { Event::ReloadConsole, KBDK_R, KBDM_CTRL },
+ { Event::PreviousMultiCartRom, KBDK_R, KBDM_SHIFT | KBDM_CTRL },
- {Event::VidmodeDecrease, KBDK_MINUS, MOD3},
- {Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
- {Event::VCenterDecrease, KBDK_PAGEUP, MOD3},
- {Event::VCenterIncrease, KBDK_PAGEDOWN, MOD3},
- {Event::VSizeAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3},
- {Event::VSizeAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3},
- {Event::ToggleCorrectAspectRatio, KBDK_C, KBDM_CTRL},
- {Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3},
- {Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3},
- {Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL},
+ { Event::VidmodeDecrease, KBDK_MINUS, MOD3 },
+ { Event::VidmodeIncrease, KBDK_EQUALS, MOD3 },
+ { Event::VCenterDecrease, KBDK_PAGEUP, MOD3 },
+ { Event::VCenterIncrease, KBDK_PAGEDOWN, MOD3 },
+ { Event::VSizeAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3 },
+ { Event::VSizeAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3 },
+ { Event::ToggleCorrectAspectRatio, KBDK_C, KBDM_CTRL },
+ { Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3 },
+ { Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3 },
+ { Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL },
- {Event::ToggleFullScreen, KBDK_RETURN, MOD3},
- {Event::ToggleAdaptRefresh, KBDK_R, MOD3},
- {Event::OverscanDecrease, KBDK_PAGEDOWN, KBDM_SHIFT},
- {Event::OverscanIncrease, KBDK_PAGEUP, KBDM_SHIFT},
- //{Event::VidmodeStd, KBDK_1, MOD3},
- //{Event::VidmodeRGB, KBDK_2, MOD3},
- //{Event::VidmodeSVideo, KBDK_3, MOD3},
- //{Event::VidModeComposite, KBDK_4, MOD3},
- //{Event::VidModeBad, KBDK_5, MOD3},
- //{Event::VidModeCustom, KBDK_6, MOD3},
- {Event::PreviousVideoMode, KBDK_1, KBDM_SHIFT | MOD3},
- {Event::NextVideoMode, KBDK_1, MOD3},
- {Event::PreviousAttribute, KBDK_2, KBDM_SHIFT | MOD3},
- {Event::NextAttribute, KBDK_2, MOD3},
- {Event::DecreaseAttribute, KBDK_3, KBDM_SHIFT | MOD3},
- {Event::IncreaseAttribute, KBDK_3, MOD3},
- {Event::PhosphorDecrease, KBDK_4, KBDM_SHIFT | MOD3},
- {Event::PhosphorIncrease, KBDK_4, MOD3},
- {Event::TogglePhosphor, KBDK_P, MOD3},
- {Event::ScanlinesDecrease, KBDK_5, KBDM_SHIFT | MOD3},
- {Event::ScanlinesIncrease, KBDK_5, MOD3},
- {Event::PreviousPaletteAttribute, KBDK_9, KBDM_SHIFT | MOD3},
- {Event::NextPaletteAttribute, KBDK_9, MOD3},
- {Event::PaletteAttributeDecrease, KBDK_0, KBDM_SHIFT | MOD3},
- {Event::PaletteAttributeIncrease, KBDK_0, MOD3},
- {Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
- {Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL},
- {Event::PaletteIncrease, KBDK_P, KBDM_CTRL},
-#ifndef BSPF_MACOS
- {Event::PreviousSetting, KBDK_END},
- {Event::NextSetting, KBDK_HOME},
- {Event::PreviousSettingGroup, KBDK_END, KBDM_CTRL},
- {Event::NextSettingGroup, KBDK_HOME, KBDM_CTRL},
-#else
- // HOME & END keys are swapped on Mac keyboards
- {Event::PreviousSetting, KBDK_HOME},
- {Event::NextSetting, KBDK_END},
- {Event::PreviousSettingGroup, KBDK_HOME, KBDM_CTRL},
- {Event::NextSettingGroup, KBDK_END, KBDM_CTRL},
-#endif
- {Event::PreviousSetting, KBDK_KP_1},
- {Event::NextSetting, KBDK_KP_7},
- {Event::PreviousSettingGroup, KBDK_KP_1, KBDM_CTRL},
- {Event::NextSettingGroup, KBDK_KP_7, KBDM_CTRL},
- {Event::SettingDecrease, KBDK_PAGEDOWN},
- {Event::SettingDecrease, KBDK_KP_3, KBDM_CTRL},
- {Event::SettingIncrease, KBDK_PAGEUP},
- {Event::SettingIncrease, KBDK_KP_9, KBDM_CTRL},
+ { Event::ToggleFullScreen, KBDK_RETURN, MOD3 },
+ { Event::ToggleAdaptRefresh, KBDK_R, MOD3 },
+ { Event::OverscanDecrease, KBDK_PAGEDOWN, KBDM_SHIFT },
+ { Event::OverscanIncrease, KBDK_PAGEUP, KBDM_SHIFT },
+ //{Event::VidmodeStd, KBDK_1, MOD3},
+ //{Event::VidmodeRGB, KBDK_2, MOD3},
+ //{Event::VidmodeSVideo, KBDK_3, MOD3},
+ //{Event::VidModeComposite, KBDK_4, MOD3},
+ //{Event::VidModeBad, KBDK_5, MOD3},
+ //{Event::VidModeCustom, KBDK_6, MOD3},
+ { Event::PreviousVideoMode, KBDK_1, KBDM_SHIFT | MOD3 },
+ { Event::NextVideoMode, KBDK_1, MOD3 },
+ { Event::PreviousAttribute, KBDK_2, KBDM_SHIFT | MOD3 },
+ { Event::NextAttribute, KBDK_2, MOD3 },
+ { Event::DecreaseAttribute, KBDK_3, KBDM_SHIFT | MOD3 },
+ { Event::IncreaseAttribute, KBDK_3, MOD3 },
+ { Event::PhosphorDecrease, KBDK_4, KBDM_SHIFT | MOD3 },
+ { Event::PhosphorIncrease, KBDK_4, MOD3 },
+ { Event::TogglePhosphor, KBDK_P, MOD3 },
+ { Event::ScanlinesDecrease, KBDK_5, KBDM_SHIFT | MOD3 },
+ { Event::ScanlinesIncrease, KBDK_5, MOD3 },
+ { Event::PreviousPaletteAttribute, KBDK_9, KBDM_SHIFT | MOD3 },
+ { Event::NextPaletteAttribute, KBDK_9, MOD3 },
+ { Event::PaletteAttributeDecrease, KBDK_0, KBDM_SHIFT | MOD3 },
+ { Event::PaletteAttributeIncrease, KBDK_0, MOD3 },
+ { Event::ToggleColorLoss, KBDK_L, KBDM_CTRL },
+ { Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL },
+ { Event::PaletteIncrease, KBDK_P, KBDM_CTRL },
+ { Event::FormatDecrease, KBDK_F, KBDM_SHIFT | KBDM_CTRL },
+ { Event::FormatIncrease, KBDK_F, KBDM_CTRL },
+ #ifndef BSPF_MACOS
+ { Event::PreviousSetting, KBDK_END },
+ { Event::NextSetting, KBDK_HOME },
+ { Event::PreviousSettingGroup, KBDK_END, KBDM_CTRL },
+ { Event::NextSettingGroup, KBDK_HOME, KBDM_CTRL },
+ #else
+ // HOME & END keys are swapped on Mac keyboards
+ { Event::PreviousSetting, KBDK_HOME },
+ { Event::NextSetting, KBDK_END },
+ { Event::PreviousSettingGroup, KBDK_HOME, KBDM_CTRL },
+ { Event::NextSettingGroup, KBDK_END, KBDM_CTRL },
+ #endif
+ { Event::PreviousSetting, KBDK_KP_1 },
+ { Event::NextSetting, KBDK_KP_7 },
+ { Event::PreviousSettingGroup, KBDK_KP_1, KBDM_CTRL },
+ { Event::NextSettingGroup, KBDK_KP_7, KBDM_CTRL },
+ { Event::SettingDecrease, KBDK_PAGEDOWN },
+ { Event::SettingDecrease, KBDK_KP_3, KBDM_CTRL },
+ { Event::SettingIncrease, KBDK_PAGEUP },
+ { Event::SettingIncrease, KBDK_KP_9, KBDM_CTRL },
- {Event::ToggleInter, KBDK_I, KBDM_CTRL},
- {Event::DecreaseSpeed, KBDK_S, KBDM_SHIFT | KBDM_CTRL},
- {Event::IncreaseSpeed, KBDK_S, KBDM_CTRL },
- {Event::ToggleTurbo, KBDK_T, KBDM_CTRL},
- {Event::ToggleJitter, KBDK_J, MOD3},
- {Event::ToggleFrameStats, KBDK_L, MOD3},
- {Event::ToggleTimeMachine, KBDK_T, MOD3},
+ { Event::ToggleInter, KBDK_I, KBDM_CTRL },
+ { Event::DecreaseSpeed, KBDK_S, KBDM_SHIFT | KBDM_CTRL },
+ { Event::IncreaseSpeed, KBDK_S, KBDM_CTRL },
+ { Event::ToggleTurbo, KBDK_T, KBDM_CTRL },
+ { Event::ToggleJitter, KBDK_J, MOD3 },
+ { Event::ToggleFrameStats, KBDK_L, MOD3 },
+ { Event::ToggleTimeMachine, KBDK_T, MOD3 },
-#ifdef PNG_SUPPORT
- {Event::ToggleContSnapshots, KBDK_S, MOD3 | KBDM_CTRL},
- {Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL},
-#endif
+ #ifdef PNG_SUPPORT
+ { Event::ToggleContSnapshots, KBDK_S, MOD3 | KBDM_CTRL },
+ { Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL },
+ #endif
- {Event::DecreaseAutoFire, KBDK_A, KBDM_CTRL | KBDM_SHIFT},
- {Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL},
- {Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL},
- {Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL},
+ { Event::DecreaseDeadzone, KBDK_F1, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseDeadzone, KBDK_F1, KBDM_CTRL },
+ { Event::DecAnalogSense, KBDK_F2, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncAnalogSense, KBDK_F2, KBDM_CTRL },
+ { Event::DecDejtterAveraging, KBDK_F3, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncDejtterAveraging, KBDK_F3, KBDM_CTRL },
+ { Event::DecDejtterReaction, KBDK_F4, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncDejtterReaction, KBDK_F4, KBDM_CTRL },
+ { Event::DecDigitalSense, KBDK_F5, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncDigitalSense, KBDK_F5, KBDM_CTRL },
+ { Event::DecreaseDrivingSense, KBDK_F6, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseDrivingSense, KBDK_F6, KBDM_CTRL },
+ { Event::DecreaseAutoFire, KBDK_A, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL },
+ { Event::ToggleFourDirections, KBDK_F7, KBDM_CTRL },
+ { Event::ToggleKeyCombos, KBDK_F8, KBDM_CTRL },
+ { Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL },
- {Event::PreviousLeftPort, KBDK_L, KBDM_CTRL | MOD3 | KBDM_SHIFT},
- {Event::NextLeftPort, KBDK_L, KBDM_CTRL | MOD3},
- {Event::PreviousRightPort, KBDK_R, KBDM_CTRL | MOD3 | KBDM_SHIFT},
- {Event::NextRightPort, KBDK_R, KBDM_CTRL | MOD3},
- {Event::PreviousMouseControl, KBDK_0, KBDM_CTRL | KBDM_SHIFT},
- {Event::NextMouseControl, KBDK_0, KBDM_CTRL},
+ { Event::PrevMouseAsController, KBDK_F9, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextMouseAsController, KBDK_F9, KBDM_CTRL },
+ { Event::DecMousePaddleSense, KBDK_F10, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncMousePaddleSense, KBDK_F10, KBDM_CTRL },
+ { Event::DecMouseTrackballSense, KBDK_F11, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncMouseTrackballSense, KBDK_F11, KBDM_CTRL },
+ { Event::PreviousCursorVisbility, KBDK_F12, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextCursorVisbility, KBDK_F12, KBDM_CTRL },
+ { Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL },
- {Event::FormatDecrease, KBDK_F, KBDM_SHIFT | KBDM_CTRL},
- {Event::FormatIncrease, KBDK_F, KBDM_CTRL},
+ { Event::PreviousLeftPort, KBDK_2, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextLeftPort, KBDK_2, KBDM_CTRL },
+ { Event::PreviousRightPort, KBDK_3, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextRightPort, KBDK_3, KBDM_CTRL },
+ { Event::ToggleSwapPorts, KBDK_4, KBDM_CTRL },
+ { Event::ToggleSwapPaddles, KBDK_5, KBDM_CTRL },
+ { Event::DecreasePaddleCenterX, KBDK_6, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreasePaddleCenterX, KBDK_6, KBDM_CTRL },
+ { Event::DecreasePaddleCenterY, KBDK_7, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreasePaddleCenterY, KBDK_7, KBDM_CTRL },
+ { Event::PreviousMouseControl, KBDK_0, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextMouseControl, KBDK_0, KBDM_CTRL },
+ { Event::DecreaseMouseAxesRange, KBDK_8, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseMouseAxesRange, KBDK_8, KBDM_CTRL },
- {Event::ToggleP0Collision, KBDK_Z, KBDM_SHIFT | MOD3},
- {Event::ToggleP0Bit, KBDK_Z, MOD3},
- {Event::ToggleP1Collision, KBDK_X, KBDM_SHIFT | MOD3},
- {Event::ToggleP1Bit, KBDK_X, MOD3},
- {Event::ToggleM0Collision, KBDK_C, KBDM_SHIFT | MOD3},
- {Event::ToggleM0Bit, KBDK_C, MOD3},
- {Event::ToggleM1Collision, KBDK_V, KBDM_SHIFT | MOD3},
- {Event::ToggleM1Bit, KBDK_V, MOD3},
- {Event::ToggleBLCollision, KBDK_B, KBDM_SHIFT | MOD3},
- {Event::ToggleBLBit, KBDK_B, MOD3},
- {Event::TogglePFCollision, KBDK_N, KBDM_SHIFT | MOD3},
- {Event::TogglePFBit, KBDK_N, MOD3},
- {Event::ToggleCollisions, KBDK_COMMA, KBDM_SHIFT | MOD3},
- {Event::ToggleBits, KBDK_COMMA, MOD3},
- {Event::ToggleFixedColors, KBDK_PERIOD, MOD3},
+ { Event::ToggleP0Collision, KBDK_Z, KBDM_SHIFT | MOD3 },
+ { Event::ToggleP0Bit, KBDK_Z, MOD3 },
+ { Event::ToggleP1Collision, KBDK_X, KBDM_SHIFT | MOD3 },
+ { Event::ToggleP1Bit, KBDK_X, MOD3 },
+ { Event::ToggleM0Collision, KBDK_C, KBDM_SHIFT | MOD3 },
+ { Event::ToggleM0Bit, KBDK_C, MOD3 },
+ { Event::ToggleM1Collision, KBDK_V, KBDM_SHIFT | MOD3 },
+ { Event::ToggleM1Bit, KBDK_V, MOD3 },
+ { Event::ToggleBLCollision, KBDK_B, KBDM_SHIFT | MOD3 },
+ { Event::ToggleBLBit, KBDK_B, MOD3 },
+ { Event::TogglePFCollision, KBDK_N, KBDM_SHIFT | MOD3 },
+ { Event::TogglePFBit, KBDK_N, MOD3 },
+ { Event::ToggleCollisions, KBDK_COMMA, KBDM_SHIFT | MOD3 },
+ { Event::ToggleBits, KBDK_COMMA, MOD3 },
+ { Event::ToggleFixedColors, KBDK_PERIOD, MOD3 },
- {Event::RewindPause, KBDK_LEFT, KBDM_SHIFT},
- {Event::Rewind1Menu, KBDK_LEFT, MOD3},
- {Event::Rewind10Menu, KBDK_LEFT, KBDM_SHIFT | MOD3},
- {Event::RewindAllMenu, KBDK_DOWN, MOD3},
- {Event::UnwindPause, KBDK_LEFT, KBDM_SHIFT},
- {Event::Unwind1Menu, KBDK_RIGHT, MOD3},
- {Event::Unwind10Menu, KBDK_RIGHT, KBDM_SHIFT | MOD3},
- {Event::UnwindAllMenu, KBDK_UP, MOD3},
- {Event::HighScoresMenuMode, KBDK_INSERT},
- {Event::TogglePlayBackMode, KBDK_SPACE, KBDM_SHIFT},
+ { Event::RewindPause, KBDK_LEFT, KBDM_SHIFT },
+ { Event::Rewind1Menu, KBDK_LEFT, MOD3 },
+ { Event::Rewind10Menu, KBDK_LEFT, KBDM_SHIFT | MOD3 },
+ { Event::RewindAllMenu, KBDK_DOWN, MOD3 },
+ { Event::UnwindPause, KBDK_LEFT, KBDM_SHIFT },
+ { Event::Unwind1Menu, KBDK_RIGHT, MOD3 },
+ { Event::Unwind10Menu, KBDK_RIGHT, KBDM_SHIFT | MOD3 },
+ { Event::UnwindAllMenu, KBDK_UP, MOD3 },
+ { Event::HighScoresMenuMode, KBDK_INSERT },
+ { Event::TogglePlayBackMode, KBDK_SPACE, KBDM_SHIFT },
-#if defined(RETRON77)
- {Event::ConsoleColorToggle, KBDK_F4}, // back ("COLOR","B/W")
- {Event::ConsoleLeftDiffToggle, KBDK_F6}, // front ("SKILL P1")
- {Event::ConsoleRightDiffToggle, KBDK_F8}, // front ("SKILL P2")
- {Event::CmdMenuMode, KBDK_F13}, // back ("4:3","16:9")
- {Event::ExitMode, KBDK_BACKSPACE}, // back ("FRY")
-#else // defining duplicate keys must be avoided!
- {Event::ConsoleBlackWhite, KBDK_F4},
- {Event::ConsoleLeftDiffB, KBDK_F6},
- {Event::ConsoleRightDiffB, KBDK_F8},
- {Event::Fry, KBDK_BACKSPACE},
+ #if defined(RETRON77)
+ { Event::ConsoleColorToggle, KBDK_F4 }, // back ("COLOR","B/W")
+ { Event::ConsoleLeftDiffToggle, KBDK_F6 }, // front ("SKILL P1")
+ { Event::ConsoleRightDiffToggle, KBDK_F8 }, // front ("SKILL P2")
+ { Event::CmdMenuMode, KBDK_F13 }, // back ("4:3","16:9")
+ { Event::ExitMode, KBDK_BACKSPACE }, // back ("FRY")
+ #else // defining duplicate keys must be avoided!
+ { Event::ConsoleBlackWhite, KBDK_F4 },
+ { Event::ConsoleLeftDiffB, KBDK_F6 },
+ { Event::ConsoleRightDiffB, KBDK_F8 },
+ { Event::Fry, KBDK_BACKSPACE },
#endif
};
From 026f64d69d4707847ce25728f48b66159549db6f Mon Sep 17 00:00:00 2001
From: thrust26
Date: Thu, 17 Dec 2020 22:47:07 +0100
Subject: [PATCH 09/27] changed sorting of saved mappings for easier debugging
---
src/common/JoyMap.cxx | 6 +++---
src/common/KeyMap.cxx | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/common/JoyMap.cxx b/src/common/JoyMap.cxx
index c2f20362e..8c8522e2f 100644
--- a/src/common/JoyMap.cxx
+++ b/src/common/JoyMap.cxx
@@ -196,9 +196,6 @@ json JoyMap::saveMapping(const EventMode mode) const
[](const MapType& a, const MapType& b)
{
// Event::Type first
- if(a.second != b.second)
- return a.second < b.second;
-
if(a.first.button != b.first.button)
return a.first.button < b.first.button;
@@ -211,7 +208,10 @@ json JoyMap::saveMapping(const EventMode mode) const
if(a.first.hat != b.first.hat)
return a.first.hat < b.first.hat;
+ if(a.first.hdir != b.first.hdir)
return a.first.hdir < b.first.hdir;
+
+ return a.second < b.second;
}
);
diff --git a/src/common/KeyMap.cxx b/src/common/KeyMap.cxx
index 7fa9b0ab9..ff0ef92fb 100644
--- a/src/common/KeyMap.cxx
+++ b/src/common/KeyMap.cxx
@@ -228,13 +228,13 @@ json KeyMap::saveMapping(const EventMode mode) const
[](const MapType& a, const MapType& b)
{
// Event::Type first
- if(a.second != b.second)
- return a.second < b.second;
-
if(a.first.key != b.first.key)
return a.first.key < b.first.key;
- return a.first.mod < b.first.mod;
+ if(a.first.mod != b.first.mod)
+ return a.first.mod < b.first.mod;
+
+ return a.second < b.second;
}
);
From 37c61fe93e386ac7f4877293bafd422442394370 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 17 Dec 2020 23:27:22 -0330
Subject: [PATCH 10/27] Added beginning infrastructure for PlusROM support. For
now, none of the network functionality is present; PlusROM's are correctly
detected, though.
---
src/emucore/CartEnhanced.cxx | 26 +++++++-
src/emucore/CartEnhanced.hxx | 6 +-
src/emucore/PlusROM.cxx | 122 ++++++++++++++++++++++++++++++++++
src/emucore/PlusROM.hxx | 125 +++++++++++++++++++++++++++++++++++
src/emucore/module.mk | 1 +
5 files changed, 277 insertions(+), 3 deletions(-)
create mode 100644 src/emucore/PlusROM.cxx
create mode 100644 src/emucore/PlusROM.hxx
diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx
index 487a22741..08cf5bab1 100644
--- a/src/emucore/CartEnhanced.cxx
+++ b/src/emucore/CartEnhanced.cxx
@@ -17,6 +17,7 @@
#include "Logger.hxx"
#include "System.hxx"
+#include "PlusROM.hxx"
#include "CartEnhanced.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -54,6 +55,11 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
// Only copy up to the amount of data the ROM provides; extra unused
// space will be filled with 0's from above
std::copy_n(image.get(), std::min(mySize, size), myImage.get());
+
+ // Determine whether we have a PlusROM cart
+ // PlusROM needs to call peek() method, so disable direct peeks
+ if(myPlusROM.initialize(myImage, mySize))
+ myDirectPeek = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -91,7 +97,7 @@ void CartridgeEnhanced::install(System& system)
System::PageAccess access(this, System::PageAccessType::READ);
// Set the page accessing method for the RAM writing pages
- // Note: Writes are mapped to poke() (NOT using direcPokeBase) to check for read from write port (RWP)
+ // Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP)
access.type = System::PageAccessType::WRITE;
for(uInt16 addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
{
@@ -141,6 +147,14 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
{
const uInt16 peekAddress = address;
+ // Is this a PlusROM?
+ if(myPlusROM.isValid())
+ {
+ uInt8 value = 0;
+ if(myPlusROM.peekHotspot(address, value))
+ return value;
+ }
+
// hotspots in TIA range are reacting to pokes only
if (hotspot() >= 0x80)
checkSwitchBank(address & ADDR_MASK);
@@ -170,6 +184,10 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
{
+ // Is this a PlusROM?
+ if(myPlusROM.isValid() && myPlusROM.pokeHotspot(address, value))
+ return true;
+
// Switch banks if necessary
if (checkSwitchBank(address & ADDR_MASK, value))
return false;
@@ -260,7 +278,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
myCurrentSegOffset[segment] = uInt32(mySize) + (ramBank << myBankShift);
// Set the page accessing method for the RAM writing pages
- // Note: Writes are mapped to poke() (NOT using direcPokeBase) to check for read from write port (RWP)
+ // Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP)
uInt16 fromAddr = (ROM_OFFSET + segmentOffset + myWriteOffset) & ~System::PAGE_MASK;
uInt16 toAddr = (ROM_OFFSET + segmentOffset + myWriteOffset + (myBankSize >> 1)) & ~System::PAGE_MASK;
System::PageAccess access(this, System::PageAccessType::WRITE);
@@ -362,6 +380,8 @@ bool CartridgeEnhanced::save(Serializer& out) const
out.putIntArray(myCurrentSegOffset.get(), myBankSegs);
if(myRamSize > 0)
out.putByteArray(myRAM.get(), myRamSize);
+ if(myPlusROM.isValid())
+ if(!myPlusROM.save(out)) return false;
}
catch(...)
{
@@ -380,6 +400,8 @@ bool CartridgeEnhanced::load(Serializer& in)
in.getIntArray(myCurrentSegOffset.get(), myBankSegs);
if(myRamSize > 0)
in.getByteArray(myRAM.get(), myRamSize);
+ if(myPlusROM.isValid())
+ if(!myPlusROM.load(in)) return false;
}
catch(...)
{
diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx
index fb5b35509..6800938a8 100644
--- a/src/emucore/CartEnhanced.hxx
+++ b/src/emucore/CartEnhanced.hxx
@@ -22,6 +22,7 @@ class System;
#include "bspf.hxx"
#include "Cart.hxx"
+#include "PlusROM.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartEnhancedWidget.hxx"
#endif
@@ -159,7 +160,7 @@ class CartridgeEnhanced : public Cartridge
/**
Get the hotspot in ROM address space.
- @return The first hotspot address (ususally in ROM) space or 0
+ @return The first hotspot address (usually in ROM) space or 0
*/
virtual uInt16 hotspot() const { return 0; }
// TODO: handle cases where there the hotspots cover multiple pages
@@ -224,6 +225,9 @@ class CartridgeEnhanced : public Cartridge
// The size of the ROM image
size_t mySize{0};
+ // Handle PlusROM functionality, if available
+ PlusROM myPlusROM;
+
protected:
// The mask for 6507 address space
static constexpr uInt16 ADDR_MASK = 0x1FFF;
diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx
new file mode 100644
index 000000000..f779b09a0
--- /dev/null
+++ b/src/emucore/PlusROM.cxx
@@ -0,0 +1,122 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#include "PlusROM.hxx"
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::initialize(const ByteBuffer& image, size_t size)
+{
+ // Host and path are stored at the NMI vector
+ size_t i = ((image[size - 5] - 16) << 8) | image[size - 6]; // NMI @ $FFFA
+ if(i >= size)
+ return myIsPlusROM = false; // Invalid NMI
+
+ // Convenience functions to detect valid path and host characters
+ auto isValidPathChar = [](uInt8 c) {
+ return ((c > 44 && c < 58) || (c > 64 && c < 91) || (c > 96 && c < 122));
+ };
+ auto isValidHostChar = [](uInt8 c) {
+ return (c == 45 || c == 46 || (c > 47 && c < 58) ||
+ (c > 64 && c < 91) || (c > 96 && c < 122));
+ };
+
+ // Path stored first, 0-terminated
+ while(i < size && isValidPathChar(image[i]))
+ myPath += static_cast(image[i++]);
+
+ // Did we get a 0-terminated path?
+ if(i >= size || image[i] != 0)
+ return myIsPlusROM = false; // Wrong delimiter
+
+ i++; // advance past 0 terminator
+
+ // Host stored next, 0-terminated
+ while(i < size && isValidHostChar(image[i]))
+ myHost += static_cast(image[i++]);
+
+ // Did we get a valid, 0-terminated host?
+ if(i >= size || image[i] != 0 || myHost.size() < 3 || myHost.find(".") == string::npos)
+ return myIsPlusROM = false; // Wrong delimiter or dotless IP
+
+ cerr << "Path: " << myPath << endl;
+ cerr << "Host: " << myHost << endl;
+
+ return myIsPlusROM = true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::peekHotspot(uInt16 address, uInt8& value)
+{
+ switch(address & 0x0FFF)
+ {
+ case 0x0FF2: // Read next byte from Rx buffer
+ return false;
+
+ case 0x0FF3: // Get number of unread bytes in Rx buffer
+ return false;
+ }
+ return false;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::pokeHotspot(uInt16 address, uInt8 value)
+{
+ switch(address & 0x0FFF)
+ {
+ case 0x0FF0: // Write byte to Tx buffer
+ return false;
+
+ case 0x0FF1: // Write byte to Tx buffer and send to backend
+ // (and receive into Rx buffer)
+ return false;
+ }
+ return false;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::save(Serializer& out) const
+{
+ try
+ {
+ out.putByteArray(myRxBuffer.data(), myRxBuffer.size());
+ out.putByteArray(myTxBuffer.data(), myTxBuffer.size());
+ }
+ catch(...)
+ {
+ cerr << "ERROR: PlusROM::save" << endl;
+ return false;
+ }
+
+ return true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::load(Serializer& in)
+{
+ try
+ {
+ in.getByteArray(myRxBuffer.data(), myRxBuffer.size());
+ in.getByteArray(myTxBuffer.data(), myTxBuffer.size());
+ }
+ catch(...)
+ {
+ cerr << "ERROR: PlusROM::load" << endl;
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/emucore/PlusROM.hxx b/src/emucore/PlusROM.hxx
new file mode 100644
index 000000000..d38979488
--- /dev/null
+++ b/src/emucore/PlusROM.hxx
@@ -0,0 +1,125 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#ifndef PLUSROM_HXX
+#define PLUSROM_HXX
+
+#include "bspf.hxx"
+#include "Serializable.hxx"
+
+/**
+ Class used to emulate the 'PlusROM' meta-scheme, documented at
+ http://pluscart.firmaplus.de/pico/?PlusROM
+
+ This scheme basically wraps a normal bankswitching scheme, but includes
+ network functionality.
+
+ Host and path names are stored as 0-terminated strings, located at the
+ NMI vector, stored path first and then host next.
+
+ PlusROMs functions use 4 hotspot addresses (before the bankswitching area):
+ $1FF0 is for writing a byte to the send buffer (max 256 bytes)
+ $1FF1 is for writing a byte to the send buffer and submit the buffer
+ to the back end API
+ $1FF2 contains the next byte of the response from the host, every read will
+ increment the receive buffer pointer (receive buffer is max 256 bytes also!)
+ $1FF3 contains the number of (unread) bytes left in the receive buffer
+ (these bytes can be from multiple responses)
+
+ @author Stephen Anthony
+*/
+class PlusROM : public Serializable
+{
+ public:
+ PlusROM() = default;
+ ~PlusROM() override = default;
+
+ public:
+ /**
+ Determine whether this is actually a PlusROM cart, and if so create
+ and initialize all state variables it will use. This includes
+ whether there is a valid hostname and path embedded in the ROM.
+
+ @param image Pointer to the ROM image
+ @param size The size of the ROM image
+
+ @return Whether this is actually a valid PlusROM cart
+ */
+ bool initialize(const ByteBuffer& image, size_t size);
+
+ /**
+ Answer whether this is a PlusROM cart. Note that until the
+ initialize method has been called, this will always return false.
+
+ @return Whether this is actually a PlusROM cart
+ */
+ bool isValid() const { return myIsPlusROM; }
+
+ /**
+ Read from hotspot addresses ($1FF2 and $1FF3).
+
+ @param address The hotspot where the value should be read
+ @param value The value read from the hotspot
+
+ @return Indicates whether the peek succeeded or failed
+ (ie, whether it hit a hotspot)
+ On failure, 'value' is not considered valid
+ */
+ bool peekHotspot(uInt16 address, uInt8& value);
+
+ /**
+ Write to hotspot addresses ($1FF0 and $1FF1).
+
+ @param address The hotspot where the value should be written
+ @param value The value to be stored at the hotspot
+
+ @return Indicates whether the poke succeeded or failed
+ (ie, whether it hit a hotspot)
+ */
+ bool pokeHotspot(uInt16 address, uInt8 value);
+
+ /**
+ Save the current state of this device to the given Serializer.
+
+ @param out The Serializer object to use
+ @return False on any errors, else true
+ */
+ bool save(Serializer& out) const override;
+
+ /**
+ Load the current state of this device from the given Serializer.
+
+ @param in The Serializer object to use
+ @return False on any errors, else true
+ */
+ bool load(Serializer& in) override;
+
+ private:
+ bool myIsPlusROM{false};
+ string myPath, myHost;
+
+ std::array myRxBuffer, myTxBuffer;
+
+ private:
+ // Following constructors and assignment operators not supported
+ PlusROM(const PlusROM&) = delete;
+ PlusROM(PlusROM&&) = delete;
+ PlusROM& operator=(const PlusROM&) = delete;
+ PlusROM& operator=(PlusROM&&) = delete;
+};
+
+#endif
diff --git a/src/emucore/module.mk b/src/emucore/module.mk
index b7d88d331..93a577be9 100644
--- a/src/emucore/module.mk
+++ b/src/emucore/module.mk
@@ -76,6 +76,7 @@ MODULE_OBJS := \
src/emucore/MD5.o \
src/emucore/OSystem.o \
src/emucore/Paddles.o \
+ src/emucore/PlusROM.o \
src/emucore/PointingDevice.o \
src/emucore/ProfilingRunner.o \
src/emucore/Props.o \
From ba4547a1e44c003fefdad670ac515659e4964caa Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 17 Dec 2020 23:45:02 -0330
Subject: [PATCH 11/27] Add PlusROM to Visual Studio project.
---
src/windows/Stella.vcxproj | 2 ++
src/windows/Stella.vcxproj.filters | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj
index 368add3b5..43d752159 100644
--- a/src/windows/Stella.vcxproj
+++ b/src/windows/Stella.vcxproj
@@ -752,6 +752,7 @@
+
@@ -1796,6 +1797,7 @@
+
diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters
index 30a01a3ac..79ae1a019 100644
--- a/src/windows/Stella.vcxproj.filters
+++ b/src/windows/Stella.vcxproj.filters
@@ -1050,6 +1050,9 @@
Source Files\debugger
+
+ Source Files\emucore
+
@@ -2165,6 +2168,9 @@
Header Files
+
+ Header Files\emucore
+
From 1a79ea09c584e9c655ff9cf0ce449cd4146ba2b1 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 17 Dec 2020 23:51:25 -0330
Subject: [PATCH 12/27] Add PlusROM to Xcode project.
---
.gitignore | 1 +
src/macos/stella.xcodeproj/project.pbxproj | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/.gitignore b/.gitignore
index f1104b2ff..5483b69cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ stella
*.diff
project.xcworkspace/
xcuserdata/
+.DS_Store
build/
src/macosx/M6502.ins
*.dSYM
diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj
index fb2ad9f74..2ec255aa2 100644
--- a/src/macos/stella.xcodeproj/project.pbxproj
+++ b/src/macos/stella.xcodeproj/project.pbxproj
@@ -304,6 +304,8 @@
DC47455D09C34BFA00EDDA3A /* CheetahCheat.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC47455209C34BFA00EDDA3A /* CheetahCheat.hxx */; };
DC47455E09C34BFA00EDDA3A /* RamCheat.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC47455309C34BFA00EDDA3A /* RamCheat.cxx */; };
DC47455F09C34BFA00EDDA3A /* RamCheat.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC47455409C34BFA00EDDA3A /* RamCheat.hxx */; };
+ DC479403258C56B800F52462 /* PlusROM.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC479401258C56B800F52462 /* PlusROM.cxx */; };
+ DC479404258C56B800F52462 /* PlusROM.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC479402258C56B800F52462 /* PlusROM.hxx */; };
DC487FB60DA5350900E12499 /* AtariVox.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC487FB40DA5350900E12499 /* AtariVox.cxx */; };
DC487FB70DA5350900E12499 /* AtariVox.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC487FB50DA5350900E12499 /* AtariVox.hxx */; };
DC4AC6EF0DC8DACB00CD3AD2 /* RiotWidget.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC4AC6ED0DC8DACB00CD3AD2 /* RiotWidget.cxx */; };
@@ -1080,6 +1082,8 @@
DC47455209C34BFA00EDDA3A /* CheetahCheat.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = CheetahCheat.hxx; sourceTree = ""; };
DC47455309C34BFA00EDDA3A /* RamCheat.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RamCheat.cxx; sourceTree = ""; };
DC47455409C34BFA00EDDA3A /* RamCheat.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = RamCheat.hxx; sourceTree = ""; };
+ DC479401258C56B800F52462 /* PlusROM.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlusROM.cxx; sourceTree = ""; };
+ DC479402258C56B800F52462 /* PlusROM.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PlusROM.hxx; sourceTree = ""; };
DC487FB40DA5350900E12499 /* AtariVox.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AtariVox.cxx; sourceTree = ""; };
DC487FB50DA5350900E12499 /* AtariVox.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = AtariVox.hxx; sourceTree = ""; };
DC4AC6ED0DC8DACB00CD3AD2 /* RiotWidget.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RiotWidget.cxx; sourceTree = ""; };
@@ -2050,6 +2054,8 @@
2DDBEB7508457B7D00812C11 /* OSystem.hxx */,
2DE2DF820627AE34006BEC99 /* Paddles.cxx */,
2DE2DF830627AE34006BEC99 /* Paddles.hxx */,
+ DC479401258C56B800F52462 /* PlusROM.cxx */,
+ DC479402258C56B800F52462 /* PlusROM.hxx */,
DC53B6AD1F3622DA00AA6BFB /* PointingDevice.cxx */,
DC3DAFAB1F2E233B00A64410 /* PointingDevice.hxx */,
DCF7F124223D795F00701A47 /* ProfilingRunner.cxx */,
@@ -2679,6 +2685,7 @@
DC932D440F278A5200FEFEFC /* DefProps.hxx in Headers */,
DC932D450F278A5200FEFEFC /* Serializable.hxx in Headers */,
DC932D460F278A5200FEFEFC /* SerialPort.hxx in Headers */,
+ DC479404258C56B800F52462 /* PlusROM.hxx in Headers */,
DC9EA8880F729A36000452B5 /* KidVid.hxx in Headers */,
DCF7F128223D796000701A47 /* ConsoleIO.hxx in Headers */,
DCF467B80F93993B00B25D7A /* SoundNull.hxx in Headers */,
@@ -3222,6 +3229,7 @@
DCAAE5EE1715887B0080BB82 /* CartF8Widget.cxx in Sources */,
DCAAE5F01715887B0080BB82 /* CartFAWidget.cxx in Sources */,
DCAAE5F21715887B0080BB82 /* CartUAWidget.cxx in Sources */,
+ DC479403258C56B800F52462 /* PlusROM.cxx in Sources */,
DC676A411729A0B000E4E73D /* Cart3EWidget.cxx in Sources */,
DCBA539A25557E2800087DD7 /* UndoHandler.cxx in Sources */,
DC676A431729A0B000E4E73D /* Cart4A50Widget.cxx in Sources */,
From 14bd2100055038ee9701ff28e0d95accda5234a8 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Thu, 17 Dec 2020 23:58:35 -0330
Subject: [PATCH 13/27] libretro: Fix compile errors (PlusROM and some minor
joystick stuff).
---
src/emucore/EventHandler.hxx | 4 ----
src/libretro/Makefile.common | 1 +
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx
index cc7d48b6e..ab3771e9a 100644
--- a/src/emucore/EventHandler.hxx
+++ b/src/emucore/EventHandler.hxx
@@ -471,19 +471,15 @@ class EventHandler
SCANLINES,
INTERPOLATION,
// *** Input group ***
- #ifdef JOYSTICK_SUPPORT
DEADZONE,
ANALOG_SENSITIVITY,
DEJITTER_AVERAGING,
DEJITTER_REACTION,
- #endif
DIGITAL_SENSITIVITY,
AUTO_FIRE,
FOUR_DIRECTIONS,
MOD_KEY_COMBOS,
- #ifdef JOYSTICK_SUPPORT
SA_PORT_ORDER,
- #endif
USE_MOUSE,
PADDLE_SENSITIVITY,
TRACKBALL_SENSITIVITY,
diff --git a/src/libretro/Makefile.common b/src/libretro/Makefile.common
index 55e92c650..3dbadd6b6 100644
--- a/src/libretro/Makefile.common
+++ b/src/libretro/Makefile.common
@@ -111,6 +111,7 @@ SOURCES_CXX := \
$(CORE_DIR)/emucore/MT24LC256.cxx \
$(CORE_DIR)/emucore/OSystem.cxx \
$(CORE_DIR)/emucore/Paddles.cxx \
+ $(CORE_DIR)/emucore/PlusROM.cxx \
$(CORE_DIR)/emucore/PointingDevice.cxx \
$(CORE_DIR)/emucore/Props.cxx \
$(CORE_DIR)/emucore/PropsSet.cxx \
From b8117caefda940a3dd2da26ff04ccd03d669b89d Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 18 Dec 2020 08:13:55 +0100
Subject: [PATCH 14/27] removed JOYSTICK_SUPPORT checks to align with header
file
---
src/emucore/EventHandler.cxx | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 8bc0c0489..0d8be1a63 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -574,19 +574,15 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
std::bind(&Console::toggleInter, &myOSystem.console(), _1),
// *** Input settings ***
- #ifdef JOYSTICK_SUPPORT
std::bind(&PhysicalJoystickHandler::changeDeadzone, &joyHandler(), _1),
std::bind(&PhysicalJoystickHandler::changeAnalogPaddleSensitivity, &joyHandler(), _1),
std::bind(&PhysicalJoystickHandler::changePaddleDejitterAveraging, &joyHandler(), _1),
std::bind(&PhysicalJoystickHandler::changePaddleDejitterReaction, &joyHandler(), _1),
- #endif
std::bind(&PhysicalJoystickHandler::changeDigitalPaddleSensitivity, &joyHandler(), _1),
std::bind(&Console::changeAutoFireRate, &myOSystem.console(), _1),
std::bind(&EventHandler::toggleAllow4JoyDirections, this, _1),
std::bind(&PhysicalKeyboardHandler::toggleModKeys, &keyHandler(), _1),
- #ifdef JOYSTICK_SUPPORT
std::bind(&EventHandler::toggleSAPortOrder, this, _1),
- #endif
std::bind(&EventHandler::changeMouseControllerMode, this, _1),
std::bind(&PhysicalJoystickHandler::changeMousePaddleSensitivity, &joyHandler(), _1),
std::bind(&PhysicalJoystickHandler::changeMouseTrackballSensitivity, &joyHandler(), _1),
From 7a67f2e6d48ab4e7702e29c4519a9dc75b45f12e Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 18 Dec 2020 09:09:45 +0100
Subject: [PATCH 15/27] reordered hotkeys and fixed UI for driving controller
sensitivity (value used for digital input too)
---
docs/index.html | 62 ++++++++++++++++-----------------
src/common/PKeyboardHandler.cxx | 20 +++++------
src/gui/InputDialog.cxx | 3 +-
3 files changed, 42 insertions(+), 43 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index c8fe61d83..3b32b5b46 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1625,17 +1625,6 @@
Control + F5 |
-
- Decrease digital and mouse driving controller sensitivity |
- Shift-Control + F6 |
- Shift-Control + F6 |
-
-
- Increase digital and mouse driving controller sensitivity |
- Control + F6 |
- Control + F6 |
-
-
Decrease autofire rate |
Shift-Control + a |
@@ -1650,14 +1639,14 @@
Toggle allowing all four directions on joystick
to be pressed simultaneously |
- Control + F7 |
- Control + F7 |
+ Control + F6 |
+ Control + F6 |
Toggle use of modifier key combos |
- Control + F8 |
- Control + F8 |
+ Control + F7 |
+ Control + F7 |
@@ -1669,34 +1658,45 @@
Select previous controllers emulated by the mouse
(all, analog, none) |
- Shift-Control + F9 |
- Shift-Control + F9 |
+ Shift-Control + F8 |
+ Shift-Control + F8 |
Select next controllers emulated by the mouse
(all, analog, none) |
- Control + F9 |
- Control + F9 |
+ Control + F8 |
+ Control + F8 |
Decrease mouse paddle sensitivity |
+ Shift-Control + F9 |
+ Shift-Control + F9 |
+
+
+ Increase mouse paddle sensitivity |
+ Control + F9 |
+ Control + F9 |
+
+
+
+ Decrease mouse trackball sensitivity |
Shift-Control + F10 |
Shift-Control + F10 |
- Increase mouse paddle sensitivity |
+ Increase mouse trackball sensitivity |
Control + F10 |
Control + F10 |
- Decrease mouse trackball sensitivity |
+ Decrease digital and mouse driving controller sensitivity |
Shift-Control + F11 |
Shift-Control + F11 |
- Increase mouse trackball sensitivity |
+ Increase digital and mouse driving controller sensitivity |
Control + F11 |
Control + F11 |
@@ -2909,7 +2909,7 @@
-psense <number> |
Sensitivity for emulation of paddles when using analog paddles.
- Valid range of values is from 1 to 30, with larger numbers causing
+ Valid range of values is from 0 to 30, with larger numbers causing
faster movement. |
@@ -2924,8 +2924,9 @@
- -dcsense <number> |
- Sensitivity for emulation of driving controllers when using a mouse.
+ | -dsense <number> |
+ Sensitivity for emulation of paddles when using a digital device
+ (ie, joystick digital axis or button, keyboard key, etc.).
Valid range of values is from 1 to 20, with larger numbers causing
faster movement. |
@@ -2985,11 +2986,10 @@
- -dsense <number> |
- Sensitivity for emulation of paddles when using a digital device
- (ie, joystick digital axis or button, keyboard key, etc.).
- Valid range of values is from 1 to 20, with larger numbers causing
- faster movement. |
+ -dcsense <number> |
+ Sensitivity for emulation of driving controllers when using a mouse
+ or a digital device. Valid range of values is from 1 to 20, with larger
+ numbers causing faster movement. |
@@ -3930,7 +3930,7 @@
Use mouse as ... | Allow the mouse to emulate various controllers | -usemouse |
(Sensitivity) Paddle | Sensitivity used when emulating a paddle using a mouse | -msense |
(Sensitivity) Trackball | Sensitivity used when emulating a trackball device using a mouse | -tsense |
- (Sensitivity) Driving controller | Sensitivity used when emulating a driving controller device using a mouse | -dcsense |
+ (Sensitivity) Driving controller | Sensitivity used when emulating a driving controller device using a mouse or a digital device | -dcsense |
Mouse cursor visibility | Show/hide cursor depending on current state | -cursor |
Grab mouse ... | Keep mouse in window in emulation mode (only when used as controller)
Note: The sensitivity may greatly vary when the mouse is not grabbed. | -grabmouse |
diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx
index 5c87fa3c1..9e09755f1 100644
--- a/src/common/PKeyboardHandler.cxx
+++ b/src/common/PKeyboardHandler.cxx
@@ -619,20 +619,20 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
{ Event::IncDejtterReaction, KBDK_F4, KBDM_CTRL },
{ Event::DecDigitalSense, KBDK_F5, KBDM_CTRL | KBDM_SHIFT },
{ Event::IncDigitalSense, KBDK_F5, KBDM_CTRL },
- { Event::DecreaseDrivingSense, KBDK_F6, KBDM_CTRL | KBDM_SHIFT },
- { Event::IncreaseDrivingSense, KBDK_F6, KBDM_CTRL },
{ Event::DecreaseAutoFire, KBDK_A, KBDM_CTRL | KBDM_SHIFT },
{ Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL },
- { Event::ToggleFourDirections, KBDK_F7, KBDM_CTRL },
- { Event::ToggleKeyCombos, KBDK_F8, KBDM_CTRL },
+ { Event::ToggleFourDirections, KBDK_F6, KBDM_CTRL },
+ { Event::ToggleKeyCombos, KBDK_F7, KBDM_CTRL },
{ Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL },
- { Event::PrevMouseAsController, KBDK_F9, KBDM_CTRL | KBDM_SHIFT },
- { Event::NextMouseAsController, KBDK_F9, KBDM_CTRL },
- { Event::DecMousePaddleSense, KBDK_F10, KBDM_CTRL | KBDM_SHIFT },
- { Event::IncMousePaddleSense, KBDK_F10, KBDM_CTRL },
- { Event::DecMouseTrackballSense, KBDK_F11, KBDM_CTRL | KBDM_SHIFT },
- { Event::IncMouseTrackballSense, KBDK_F11, KBDM_CTRL },
+ { Event::PrevMouseAsController, KBDK_F8, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextMouseAsController, KBDK_F8, KBDM_CTRL },
+ { Event::DecMousePaddleSense, KBDK_F9, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncMousePaddleSense, KBDK_F9, KBDM_CTRL },
+ { Event::DecMouseTrackballSense, KBDK_F10, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncMouseTrackballSense, KBDK_F10, KBDM_CTRL },
+ { Event::DecreaseDrivingSense, KBDK_F11, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseDrivingSense, KBDK_F11, KBDM_CTRL },
{ Event::PreviousCursorVisbility, KBDK_F12, KBDM_CTRL | KBDM_SHIFT },
{ Event::NextCursorVisbility, KBDK_F12, KBDM_CTRL },
{ Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL },
diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx
index cae427a67..e9bb315c3 100644
--- a/src/gui/InputDialog.cxx
+++ b/src/gui/InputDialog.cxx
@@ -295,6 +295,7 @@ void InputDialog::addMouseTab()
lwidth, kDCSpeedChanged, 4 * fontWidth, "%");
myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20);
myDrivingSpeed->setTickmarkIntervals(4);
+ myDrivingSpeed->setToolTip("Adjust driving controller sensitivity for digital and mouse input.");
wid.push_back(myDrivingSpeed);
// Mouse cursor state
@@ -788,10 +789,8 @@ void InputDialog::handleMouseControlState()
{
bool enable = myMouseControl->getSelected() != 2;
- myMouseSensitivity->setEnabled(enable);
myMPaddleSpeed->setEnabled(enable);
myTrackBallSpeed->setEnabled(enable);
- myDrivingSpeed->setEnabled(enable);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From 351b27c6b57a312c242c7161be1e3234c75228a7 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Fri, 18 Dec 2020 11:03:24 -0330
Subject: [PATCH 16/27] Some of the checkers don't like stray Unicode in ASCII
files.
---
src/common/PaletteHandler.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/PaletteHandler.cxx b/src/common/PaletteHandler.cxx
index aa66f5985..22740c1f6 100644
--- a/src/common/PaletteHandler.cxx
+++ b/src/common/PaletteHandler.cxx
@@ -442,7 +442,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
if(timing == ConsoleTiming::ntsc)
{
vector2d IQ[NUM_CHROMA];
- // YIQ is YUV shifted by 33°
+ // YIQ is YUV shifted by 33 degrees
constexpr float offset = 33 * BSPF::PI_f / 180;
const float shift = myPhaseNTSC * BSPF::PI_f / 180;
@@ -542,7 +542,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
void PaletteHandler::adjustHueSaturation(int& R, int& G, int& B, float H, float S)
{
// Adapted from http://beesbuzz.biz/code/16-hsv-color-transforms
- // (C) J. “Fluffy” Shagam
+ // (C) J. Fluffy Shagam
// License: CC BY-SA 4.0
const float su = S * cosf(-H * BSPF::PI_f);
const float sw = S * sinf(-H * BSPF::PI_f);
From dbdc984e778e012f6764cd41a385c54cdd6250dc Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 18 Dec 2020 16:17:03 +0100
Subject: [PATCH 17/27] fixed specific mouse axes for paddles (fixes #746)
added specific mouse axes properties for SWOOPS
---
src/emucore/DefProps.hxx | 6 +++---
src/emucore/Paddles.cxx | 14 +++++++++-----
src/emucore/stella.pro | 3 +++
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/emucore/DefProps.hxx b/src/emucore/DefProps.hxx
index 7718347ef..618f63c87 100644
--- a/src/emucore/DefProps.hxx
+++ b/src/emucore/DefProps.hxx
@@ -565,7 +565,7 @@ static const BSPF::array2D DefProps = {{
{ "278155fc9956e9b6ef2359eb238f7c7f", "", "", "Donkey Kong Junior (Unknown) (Hack)", "Hack of Donkey Kong Junior", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2783006ee6519f15cbc96adae031c9a9", "Telegames", "", "Night Stalker (1989) (Telegames) (PAL) [a]", "AKA Dark Cavern", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "278531cc31915747018d22145823d2c9", "", "", "Defender MegaDrive (PAL) (Genesis)", "Genesis controller (C is smartbomb)", "Hack of Defender", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
- { "278f14887d601b5e5b620f1870bc09f6", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
+ { "278f14887d601b5e5b620f1870bc09f6", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "28", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
{ "27a5d2d0c74c8e4b2c05b94c9f098eea", "Atari, Omegamatrix", "", "Video Olympics Menu (2020) (PAL60) (Hack)", "Hack of Video Olympics", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "", "AUTO 60", "", "", "", "", "" },
{ "27baecd618e7e53dc11f2a9c559f529d", "Omegamatrix", "", "Star Wars Arcade (Atari Trak-Ball) v4 (Omegamatrix)", "Uses Atari Trak-Ball Controller", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "27c4c2af4b46394bb98638af8e0f6e9d", "Atari, Jerome Domurat, Peter C. Niday, Robert Vieira", "CX26109", "Sorcerer's Apprentice (1983) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@@ -1136,7 +1136,7 @@ static const BSPF::array2D DefProps = {{
{ "50200f697aeef38a3ce31c4f49739551", "Mystique - American Multiple Industries, Joel H. Martin", "", "Custer's Revenge (1982) (Mystique) (PAL60)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "502044b1ac111b394e6fbb0d821fca41", "", "", "Hangman Invader 4letter (Hack)", "Hack of Hangman", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "502168660bfd9c1d2649d415dc89c69d", "Activision, Bob Whitehead - Ariola", "EAG-019, EAG-019-04I - 711 019-715", "Sky Jinks (1982) (Activision) (PAL) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0x9e\",\"0xa6\",\"0xa2\"],\"score_digits\":6,\"score_inverted\":true,\"variations_address\":\"0x99\",\"variations_count\":4,\"variations_zero_based\":true}" },
- { "504688d49a41bf03d8a955512609f3f2", "Thomas Jentzsch", "", "SWOOPS! (v0.94) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
+ { "504688d49a41bf03d8a955512609f3f2", "Thomas Jentzsch", "", "SWOOPS! (v0.94) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "28", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
{ "50568c80ac61cab789d9923c9b05b68e", "Ebivision", "", "Merlin's Walls - Standard Edition (1999) (Ebivision)", "Image rotated 90 degrees CW", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5069fecbe4706371f17737b0357cfa68", "Apollo - Games by Apollo, Steve Stringfellow", "AP-2005", "Shark Attack (1982) (Apollo) (PAL)", "AKA Lochjaw", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5079bfbc7b8f5770f84215ed2e3bdd1b", "Omegamatrix (2012)", "", "Genesis Button Tester", "", "Homebrew", "", "", "", "", "", "", "", "GENESIS", "", "", "GENESIS", "", "", "", "", "", "", "", "", "", "", "" },
@@ -1307,7 +1307,7 @@ static const BSPF::array2D DefProps = {{
{ "5d2cc33ca798783dee435eb29debf6d6", "Activision - Imagineering, Mike Reidel", "AK-043-04", "Commando (1988) (Activision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5d7293f1892b66c014e8d222e06f6165", "Atari - Axlon, Tod Frye - Heuristica, Agustin Ortiz", "CX26169", "Shooting Arcade (03-07-1989) (Atari) (Prototype) [a1]", "Uses the Light Gun Controller (left only)", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5d799bfa9e1e7b6224877162accada0d", "Spectravision - Spectravideo - Sirius Software, David Lubar", "SA-206", "Challenge of.... Nexar, The (1982) (Spectravision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
- { "5d8f1ab95362acdf3426d572a6301bf2", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ) (PAL)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
+ { "5d8f1ab95362acdf3426d572a6301bf2", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ) (PAL)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "28", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
{ "5d8fb14860c2f198472b233874f6b0c9", "", "", "Boing! (PD) [a2]", "", "New Release", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5d9592756425192ec621d2613d0e683d", "CCE", "C-839", "Misterious Thief, A (1983) (CCE) [a]", "AKA A Mysterious Thief", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5da8fd0b5ed33a360bff37f8b5d0cd58", "Tron", "", "Pole Position (Tron)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
diff --git a/src/emucore/Paddles.cxx b/src/emucore/Paddles.cxx
index 57fcf3b31..6e79109fa 100644
--- a/src/emucore/Paddles.cxx
+++ b/src/emucore/Paddles.cxx
@@ -384,14 +384,18 @@ bool Paddles::setMouseControl(
// The following is somewhat complex, but we need to pre-process as much
// as possible, so that ::update() can run quickly
myMPaddleID = -1;
- if(myJack == Jack::Left && xtype == Controller::Type::Paddles)
+ if(myJack == Jack::Left)
{
- myMPaddleIDX = (xid == 0 || xid == 1) ? xid & 0x01 : -1;
- myMPaddleIDY = (yid == 0 || yid == 1) ? yid & 0x01 : -1;
+ if(xtype == Controller::Type::Paddles)
+ myMPaddleIDX = (xid == 0 || xid == 1) ? xid & 0x01 : -1;
+ if(ytype == Controller::Type::Paddles)
+ myMPaddleIDY = (yid == 0 || yid == 1) ? yid & 0x01 : -1;
}
- else if(myJack == Jack::Right && ytype == Controller::Type::Paddles)
+ else if(myJack == Jack::Right)
{
- myMPaddleIDX = (xid == 2 || xid == 3) ? xid & 0x01 : -1;
+ if(xtype == Controller::Type::Paddles)
+ myMPaddleIDX = (xid == 2 || xid == 3) ? xid & 0x01 : -1;
+ if(ytype == Controller::Type::Paddles)
myMPaddleIDY = (yid == 2 || yid == 3) ? yid & 0x01 : -1;
}
}
diff --git a/src/emucore/stella.pro b/src/emucore/stella.pro
index 7926cafff..b3c27afae 100644
--- a/src/emucore/stella.pro
+++ b/src/emucore/stella.pro
@@ -3371,6 +3371,7 @@
"Cart.Name" "SWOOPS! (v0.96) (TJ)"
"Cart.Note" "Uses the Joystick (L) and Paddle (R) Controllers"
"Cart.Rarity" "Homebrew"
+"Controller.MouseAxis" "28"
"Cart.Highscore" "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}"
""
@@ -6922,6 +6923,7 @@
"Cart.Name" "SWOOPS! (v0.94) (TJ)"
"Cart.Note" "Uses the Joystick (L) and Paddle (R) Controllers"
"Cart.Rarity" "Homebrew"
+"Controller.MouseAxis" "28"
"Cart.Highscore" "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}"
""
@@ -8011,6 +8013,7 @@
"Cart.Name" "SWOOPS! (v0.96) (TJ) (PAL)"
"Cart.Note" "Uses the Joystick (L) and Paddle (R) Controllers"
"Cart.Rarity" "Homebrew"
+"Controller.MouseAxis" "28"
"Cart.Highscore" "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}"
""
From e76fed006bb4973dd2ca96fb2f16f56e07dc5cfb Mon Sep 17 00:00:00 2001
From: thrust26
Date: Fri, 18 Dec 2020 22:34:36 +0100
Subject: [PATCH 18/27] minor enhancement of input global keys
---
docs/index.html | 2 +-
src/common/PJoystickHandler.cxx | 20 ++++-
src/common/PJoystickHandler.hxx | 1 +
src/emucore/EventHandler.cxx | 141 +++++++++++++++++++-------------
src/emucore/EventHandler.hxx | 7 +-
5 files changed, 109 insertions(+), 62 deletions(-)
diff --git a/docs/index.html b/docs/index.html
index 3b32b5b46..071244afc 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -2926,7 +2926,7 @@
-dsense <number> |
Sensitivity for emulation of paddles when using a digital device
- (ie, joystick digital axis or button, keyboard key, etc.).
+ (i.e. joystick digital axis or button, keyboard key, etc.).
Valid range of values is from 1 to 20, with larger numbers causing
faster movement. |
diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx
index 92ba5ae15..d93ae293c 100644
--- a/src/common/PJoystickHandler.cxx
+++ b/src/common/PJoystickHandler.cxx
@@ -267,6 +267,24 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport)
myOSystem.settings().setValue("saport", saport);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PhysicalJoystickHandler::hasStelladaptors() const
+{
+ for(auto& [_id, _joyptr] : mySticks)
+ {
+ // remove previously added emulated ports
+ size_t pos = _joyptr->name.find(" (emulates ");
+
+ if(pos != std::string::npos)
+ _joyptr->name.erase(pos);
+
+ if(BSPF::startsWithIgnoreCase(_joyptr->name, "Stelladaptor")
+ || BSPF::startsWithIgnoreCase(_joyptr->name, "2600-daptor"))
+ return true;
+ }
+ return false;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Depending on parameters, this method does the following:
// 1. update all events with default (event == Event::NoType, updateDefault == true)
@@ -989,7 +1007,7 @@ void PhysicalJoystickHandler::changeDrivingSensitivity(int direction)
ostringstream ss;
ss << sense * 10 << "%";
- myOSystem.frameBuffer().showGaugeMessage("Mouse driving controller sensitivity",
+ myOSystem.frameBuffer().showGaugeMessage("Driving controller sensitivity",
ss.str(), sense,
Driving::MIN_SENSE, Driving::MAX_SENSE);
}
diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx
index f03217410..e02250da4 100644
--- a/src/common/PJoystickHandler.hxx
+++ b/src/common/PJoystickHandler.hxx
@@ -71,6 +71,7 @@ class PhysicalJoystickHandler
bool remove(int id);
bool remove(const string& name);
void mapStelladaptors(const string& saport);
+ bool hasStelladaptors() const;
void setDefaultMapping(Event::Type type, EventMode mode);
/** define mappings for current controllers */
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 0d8be1a63..e965ceaf3 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -246,7 +246,7 @@ void EventHandler::changeMouseControl(int direction)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool EventHandler::hasMouseControl()
+bool EventHandler::hasMouseControl() const
{
return myMouseControl && myMouseControl->hasMouseControl();
}
@@ -416,97 +416,120 @@ bool EventHandler::isTrackball(const Controller& controller) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-AdjustFunction EventHandler::cycleAdjustSetting(int direction)
+bool EventHandler::skipAVSetting() const
+{
+ const bool isFullScreen = myOSystem.frameBuffer().fullScreen();
+ const bool isCustomPalette =
+ myOSystem.settings().getString("palette") == PaletteHandler::SETTING_CUSTOM;
+ const bool isCustomFilter =
+ myOSystem.settings().getInt("tv.filter") == int(NTSCFilter::Preset::CUSTOM);
+
+ return (myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
+ #ifdef ADAPTABLE_REFRESH_SUPPORT
+ || (myAdjustSetting == AdjustSetting::ADAPT_REFRESH && !isFullScreen)
+ #endif
+ || (myAdjustSetting >= AdjustSetting::PALETTE_PHASE
+ && myAdjustSetting <= AdjustSetting::PALETTE_BLUE_SHIFT
+ && !isCustomPalette)
+ || (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
+ && myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
+ && !isCustomFilter);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::skipInputSetting() const
+{
+ const bool grabMouseAllowed = myOSystem.frameBuffer().grabMouseAllowed();
+ const bool analog = myOSystem.console().leftController().isAnalog()
+ || myOSystem.console().rightController().isAnalog();
+ const bool joystick = isJoystick(myOSystem.console().leftController())
+ || isJoystick(myOSystem.console().rightController());
+ const bool paddle = isPaddle(myOSystem.console().leftController())
+ || isPaddle(myOSystem.console().rightController());
+ const bool trackball = isTrackball(myOSystem.console().leftController())
+ || isTrackball(myOSystem.console().rightController());
+ const bool driving =
+ myOSystem.console().leftController().type() == Controller::Type::Driving
+ || myOSystem.console().rightController().type() == Controller::Type::Driving;
+ const bool useMouse =
+ BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"))
+ || (BSPF::equalsIgnoreCase("analog", myOSystem.settings().getString("usemouse"))
+ && analog);
+ const bool stelladapter = myPJoyHandler->hasStelladaptors();
+
+ return (!grabMouseAllowed && myAdjustSetting == AdjustSetting::GRAB_MOUSE)
+ || (!joystick
+ && (myAdjustSetting == AdjustSetting::DEADZONE
+ || myAdjustSetting == AdjustSetting::FOUR_DIRECTIONS))
+ || (!paddle
+ && (myAdjustSetting == AdjustSetting::ANALOG_SENSITIVITY
+ || myAdjustSetting == AdjustSetting::DEJITTER_AVERAGING
+ || myAdjustSetting == AdjustSetting::DEJITTER_REACTION
+ || myAdjustSetting == AdjustSetting::DIGITAL_SENSITIVITY
+ || myAdjustSetting == AdjustSetting::SWAP_PADDLES
+ || myAdjustSetting == AdjustSetting::PADDLE_CENTER_X
+ || myAdjustSetting == AdjustSetting::PADDLE_CENTER_Y))
+ || ((!paddle || !useMouse)
+ && myAdjustSetting == AdjustSetting::PADDLE_SENSITIVITY)
+ || ((!trackball || !useMouse)
+ && myAdjustSetting == AdjustSetting::TRACKBALL_SENSITIVITY)
+ || (!driving
+ && myAdjustSetting == AdjustSetting::DRIVING_SENSITIVITY) // also affects digital device input sensitivity
+ || ((!hasMouseControl() || !useMouse)
+ && myAdjustSetting == AdjustSetting::MOUSE_CONTROL)
+ || ((!paddle || !useMouse)
+ && myAdjustSetting == AdjustSetting::MOUSE_RANGE)
+ || (!stelladapter
+ && myAdjustSetting == AdjustSetting::SA_PORT_ORDER);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::skipDebugSetting() const
{
const bool isPAL = myOSystem.console().timing() == ConsoleTiming::pal;
- bool repeat = false;
+ return (myAdjustSetting == AdjustSetting::COLOR_LOSS && !isPAL);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+AdjustFunction EventHandler::cycleAdjustSetting(int direction)
+{
+ bool skip = false;
do
{
switch (getAdjustGroup())
{
case AdjustGroup::AV:
- {
- const bool isFullScreen = myOSystem.frameBuffer().fullScreen();
- const bool isCustomPalette =
- myOSystem.settings().getString("palette") == PaletteHandler::SETTING_CUSTOM;
- const bool isCustomFilter =
- myOSystem.settings().getInt("tv.filter") == int(NTSCFilter::Preset::CUSTOM);
-
myAdjustSetting =
AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
int(AdjustSetting::START_AV_ADJ), int(AdjustSetting::END_AV_ADJ)));
// skip currently non-relevant adjustments
- repeat = (myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
- #ifdef ADAPTABLE_REFRESH_SUPPORT
- || (myAdjustSetting == AdjustSetting::ADAPT_REFRESH && !isFullScreen)
- #endif
- || (myAdjustSetting >= AdjustSetting::PALETTE_PHASE
- && myAdjustSetting <= AdjustSetting::PALETTE_BLUE_SHIFT
- && !isCustomPalette)
- || (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
- && myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
- && !isCustomFilter);
+ skip = skipAVSetting();
break;
- }
case AdjustGroup::INPUT:
- {
- const bool grabMouseAllowed = myOSystem.frameBuffer().grabMouseAllowed();
- const bool joystick = isJoystick(myOSystem.console().leftController())
- || isJoystick(myOSystem.console().rightController());
- const bool paddle = isPaddle(myOSystem.console().leftController())
- || isPaddle(myOSystem.console().rightController());
- const bool trackball = isTrackball(myOSystem.console().leftController())
- || isTrackball(myOSystem.console().rightController());
- const bool driving = myOSystem.console().leftController().type() == Controller::Type::Driving
- || myOSystem.console().rightController().type() == Controller::Type::Driving;
- const bool useMouse = myOSystem.settings().getString("usemouse") != "never";
-
myAdjustSetting =
AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
int(AdjustSetting::START_INPUT_ADJ), int(AdjustSetting::END_INPUT_ADJ)));
// skip currently non-relevant adjustments
- repeat = (!grabMouseAllowed && myAdjustSetting == AdjustSetting::GRAB_MOUSE)
- || (!joystick
- && (myAdjustSetting == AdjustSetting::DEADZONE
- || myAdjustSetting == AdjustSetting::FOUR_DIRECTIONS))
- || (!paddle
- && (myAdjustSetting == AdjustSetting::ANALOG_SENSITIVITY
- || myAdjustSetting == AdjustSetting::DEJITTER_AVERAGING
- || myAdjustSetting == AdjustSetting::DEJITTER_REACTION
- || myAdjustSetting == AdjustSetting::DIGITAL_SENSITIVITY
- || myAdjustSetting == AdjustSetting::SWAP_PADDLES
- || myAdjustSetting == AdjustSetting::PADDLE_CENTER_X
- || myAdjustSetting == AdjustSetting::PADDLE_CENTER_Y))
- || ((!paddle || !useMouse)
- && myAdjustSetting == AdjustSetting::PADDLE_SENSITIVITY)
- || ((!trackball || !useMouse)
- && myAdjustSetting == AdjustSetting::TRACKBALL_SENSITIVITY)
- || (!driving
- && myAdjustSetting == AdjustSetting::DRIVING_SENSITIVITY) // also affects keyboard input sensitivity
- || ((!hasMouseControl() || !useMouse)
- && myAdjustSetting == AdjustSetting::MOUSE_CONTROL)
- || ((!paddle || !useMouse)
- && myAdjustSetting == AdjustSetting::MOUSE_RANGE);
+ skip = skipInputSetting();
break;
- }
case AdjustGroup::DEBUG:
myAdjustSetting =
AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
int(AdjustSetting::START_DEBUG_ADJ), int(AdjustSetting::END_DEBUG_ADJ)));
// skip currently non-relevant adjustments
- repeat = (myAdjustSetting == AdjustSetting::COLOR_LOSS && !isPAL);
+ skip = skipDebugSetting();
break;
default:
break;
}
// avoid endless loop
- if(repeat && !direction)
+ if(skip && !direction)
direction = 1;
- } while(repeat);
+ } while(skip);
return getAdjustSetting(myAdjustSetting);
}
diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx
index ab3771e9a..a6c477923 100644
--- a/src/emucore/EventHandler.hxx
+++ b/src/emucore/EventHandler.hxx
@@ -361,7 +361,7 @@ class EventHandler
Handle changing mouse modes.
*/
void changeMouseControl(int direction = +1);
- bool hasMouseControl();
+ bool hasMouseControl() const;
void saveKeyMapping();
void saveJoyMapping();
@@ -576,6 +576,11 @@ class EventHandler
bool isPaddle(const Controller& controller) const;
bool isTrackball(const Controller& controller) const;
+ // Check if a currently non-relevant adjustment can be skipped
+ bool skipAVSetting() const;
+ bool skipInputSetting() const;
+ bool skipDebugSetting() const;
+
private:
// Structure used for action menu items
struct ActionList {
From 2f5166e81ed8b3535d97aff549d8024fd131d8c8 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Fri, 18 Dec 2020 19:25:27 -0330
Subject: [PATCH 19/27] Various fixes for suggestions from cppcheck.
---
src/common/HighScoresManager.hxx | 2 +-
src/common/PaletteHandler.hxx | 2 +-
src/common/SoundSDL2.cxx | 2 +-
src/common/VideoModeHandler.cxx | 6 ++----
src/common/tv_filters/NTSCFilter.cxx | 2 +-
src/common/tv_filters/NTSCFilter.hxx | 2 +-
src/debugger/CartDebug.cxx | 2 +-
src/debugger/CartDebug.hxx | 2 +-
src/debugger/Debugger.cxx | 6 ++----
src/debugger/gui/CartBUSWidget.cxx | 1 -
src/debugger/gui/CartDPCWidget.cxx | 3 +--
src/debugger/gui/TiaInfoWidget.cxx | 3 +--
src/emucore/AtariVox.cxx | 4 ++--
src/emucore/FrameBuffer.hxx | 2 +-
src/emucore/OSystem.cxx | 16 +++++++++-------
src/emucore/Serializer.cxx | 5 +----
src/emucore/Serializer.hxx | 2 +-
src/emucore/Settings.cxx | 3 +--
src/emucore/tia/Missile.cxx | 1 -
src/gui/Dialog.cxx | 4 ++--
src/gui/Dialog.hxx | 6 +++---
src/gui/EditableWidget.cxx | 14 +++++---------
src/gui/Font.cxx | 11 ++++-------
src/gui/GuiObject.hxx | 2 +-
src/gui/HighScoresDialog.cxx | 9 +++------
src/gui/HighScoresDialog.hxx | 16 +++++++++-------
src/gui/Launcher.cxx | 4 ++--
src/gui/LauncherDialog.cxx | 2 +-
src/gui/R77HelpDialog.cxx | 3 +--
src/gui/RadioButtonWidget.cxx | 4 ++--
src/gui/TabWidget.hxx | 2 +-
src/gui/VideoAudioDialog.hxx | 2 +-
src/gui/Widget.cxx | 13 ++++---------
src/gui/Widget.hxx | 4 ++--
src/libretro/EventHandlerLIBRETRO.cxx | 1 -
src/libretro/FBSurfaceLIBRETRO.cxx | 10 ++++------
src/libretro/FBSurfaceLIBRETRO.hxx | 2 +-
src/libretro/FSNodeLIBRETRO.cxx | 8 ++++----
src/libretro/SoundLIBRETRO.cxx | 2 +-
src/libretro/StellaLIBRETRO.cxx | 4 ++--
src/unix/FSNodePOSIX.cxx | 4 +---
src/unix/FSNodePOSIX.hxx | 2 +-
src/windows/FSNodeWINDOWS.cxx | 4 +---
43 files changed, 84 insertions(+), 115 deletions(-)
diff --git a/src/common/HighScoresManager.hxx b/src/common/HighScoresManager.hxx
index 6768840c4..3b293c172 100644
--- a/src/common/HighScoresManager.hxx
+++ b/src/common/HighScoresManager.hxx
@@ -92,7 +92,7 @@ namespace HSM {
class HighScoresManager
{
public:
- HighScoresManager(OSystem& osystem);
+ explicit HighScoresManager(OSystem& osystem);
virtual ~HighScoresManager() = default;
diff --git a/src/common/PaletteHandler.hxx b/src/common/PaletteHandler.hxx
index 42ba37cfc..d5cda3a4b 100644
--- a/src/common/PaletteHandler.hxx
+++ b/src/common/PaletteHandler.hxx
@@ -65,7 +65,7 @@ class PaletteHandler
};
public:
- PaletteHandler(OSystem& system);
+ explicit PaletteHandler(OSystem& system);
/**
Cycle through available palettes.
diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx
index 40b95b0f0..fb1fb6632 100644
--- a/src/common/SoundSDL2.cxx
+++ b/src/common/SoundSDL2.cxx
@@ -273,7 +273,7 @@ void SoundSDL2::adjustVolume(int direction)
if(percent > 0 && !enabled)
{
- setEnabled(!enabled);
+ setEnabled(true);
myOSystem.console().initializeAudio();
}
diff --git a/src/common/VideoModeHandler.cxx b/src/common/VideoModeHandler.cxx
index e15b12b1c..185ce0d61 100644
--- a/src/common/VideoModeHandler.cxx
+++ b/src/common/VideoModeHandler.cxx
@@ -105,14 +105,12 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, Stretch smode,
VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
Stretch smode, Int32 fsindex, const string& desc,
float zoomLevel, float overscan)
- : stretch(smode),
+ : screenS(sw, sh),
+ stretch(smode),
description(desc),
zoom(zoomLevel),
fsIndex(fsindex)
{
- // First set default size and positioning
- screenS = Common::Size(sw, sh);
-
// Now resize based on windowed/fullscreen mode and stretch factor
if(fsIndex != -1) // fullscreen mode
{
diff --git a/src/common/tv_filters/NTSCFilter.cxx b/src/common/tv_filters/NTSCFilter.cxx
index 5a61dd140..14c38697e 100644
--- a/src/common/tv_filters/NTSCFilter.cxx
+++ b/src/common/tv_filters/NTSCFilter.cxx
@@ -192,7 +192,7 @@ void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void NTSCFilter::setCustomAdjustables(Adjustable& adjustable)
+void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
{
#ifdef BLARGG_PALETTE
//myCustomSetup.hue = scaleFrom100(adjustable.hue);
diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx
index b4b3aa713..fd5335806 100644
--- a/src/common/tv_filters/NTSCFilter.hxx
+++ b/src/common/tv_filters/NTSCFilter.hxx
@@ -90,7 +90,7 @@ class NTSCFilter
// Set custom adjustables to given values
// Values will be scaled to 0 - 100 range, independent of how
// they're actually stored internally
- void setCustomAdjustables(Adjustable& adjustable);
+ void setCustomAdjustables(const Adjustable& adjustable);
// The following methods cycle through each custom adjustable
// They are used in conjunction with the increase/decrease
diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx
index ab988e000..ad2e623d7 100644
--- a/src/debugger/CartDebug.cxx
+++ b/src/debugger/CartDebug.cxx
@@ -1516,7 +1516,7 @@ CartDebug::AddrType CartDebug::addressType(uInt16 addr) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
+void CartDebug::getBankDirectives(ostream& buf, const BankInfo& info) const
{
// Start with the offset for this bank
buf << "ORG " << Base::HEX4 << info.offset << endl;
diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx
index 25dd59e63..21b01d0e2 100644
--- a/src/debugger/CartDebug.hxx
+++ b/src/debugger/CartDebug.hxx
@@ -324,7 +324,7 @@ class CartDebug : public DebuggerSystem
// Analyze of bank of ROM, generating a list of Distella directives
// based on its disassembly
- void getBankDirectives(ostream& buf, BankInfo& info) const;
+ void getBankDirectives(ostream& buf, const BankInfo& info) const;
// Get access enum type from 'flags', taking precendence into account
Device::AccessType accessTypeAbsolute(Device::AccessFlags flags) const;
diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx
index abfc63ac1..c7c65f2ec 100644
--- a/src/debugger/Debugger.cxx
+++ b/src/debugger/Debugger.cxx
@@ -716,10 +716,8 @@ bool Debugger::addFunction(const string& name, const string& definition,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::isBuiltinFunction(const string& name)
{
- for(const auto& func: ourBuiltinFunctions)
- if(name == func.name)
- return true;
- return false;
+ return std::any_of(ourBuiltinFunctions.cbegin(), ourBuiltinFunctions.cend(),
+ [&](const auto& func) { return name == func.name; });
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx
index 8f6a9b22b..dbfe8c172 100644
--- a/src/debugger/gui/CartBUSWidget.cxx
+++ b/src/debugger/gui/CartBUSWidget.cxx
@@ -75,7 +75,6 @@ CartridgeBUSWidget::CartridgeBUSWidget(
ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
myFontHeight, "Datastream Pointers", TextAlign::Left);
- xpos += lwidth;
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 4, 6, 32, Common::Base::Fmt::_16_3_2);
myDatastreamPointers->setTarget(this);
diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx
index 681b3692d..c626b52fa 100644
--- a/src/debugger/gui/CartDPCWidget.cxx
+++ b/src/debugger/gui/CartDPCWidget.cxx
@@ -68,11 +68,10 @@ CartridgeDPCWidget::CartridgeDPCWidget(
ypos += myLineHeight + V_GAP * 3;
// Data fetchers
- int lwidth = _font.getStringWidth("Data fetchers ");
new StaticTextWidget(boss, _font, xpos, ypos, "Data fetchers ");
// Top registers
- lwidth = _font.getStringWidth("Counter registers ");
+ int lwidth = _font.getStringWidth("Counter registers ");
xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, "Top registers ");
xpos += lwidth;
diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx
index fe2ce6d9b..9886da9b6 100644
--- a/src/debugger/gui/TiaInfoWidget.cxx
+++ b/src/debugger/gui/TiaInfoWidget.cxx
@@ -42,7 +42,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
+ COLUMN_GAP + lfont.getStringWidth("Scanline262262")
+ EditTextWidget::calcWidth(lfont) * 3 <= max_w;
const int lineHeight = lfont.getLineHeight();
- int xpos = x, ypos = y + VBORDER;
int lwidth = lfont.getStringWidth(longstr ? "Frame Cycls" : "F. Cycls");
int lwidth8 = lwidth - lfont.getMaxCharWidth() * 3;
int lwidthR = lfont.getStringWidth(longstr ? "Frame Cnt." : "Frame ");
@@ -57,7 +56,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
// Left column
// Left: Frame Cycle
- xpos = x;
+ int xpos = x, ypos = y + VBORDER;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Frame Cycls" : "F. Cycls");
myFrameCycles = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
myFrameCycles->setToolTip("CPU cycles executed this frame.");
diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx
index 6040b3f6d..95065cbec 100644
--- a/src/emucore/AtariVox.cxx
+++ b/src/emucore/AtariVox.cxx
@@ -24,9 +24,9 @@
AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const FilesystemNode& eepromfile,
const onMessageCallback& callback)
- : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox)
+ : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox),
+ mySerialPort(MediaFactory::createSerialPort())
{
- mySerialPort = MediaFactory::createSerialPort();
if(mySerialPort->openPort(portname))
{
myCTSFlip = !mySerialPort->isCTS();
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 75dccc990..992b7b790 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -62,7 +62,7 @@ class FrameBuffer
};
public:
- FrameBuffer(OSystem& osystem);
+ explicit FrameBuffer(OSystem& osystem);
~FrameBuffer();
/**
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index 40271748c..a07a319a3 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -746,7 +746,7 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
if (!myConsole) return 0.;
TIA& tia(myConsole->tia());
- EmulationTiming& timing(myConsole->emulationTiming());
+ const EmulationTiming& timing = myConsole->emulationTiming();
DispatchResult dispatchResult;
// Check whether we have a frame pending for rendering...
@@ -758,8 +758,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
tia.renderToFrameBuffer();
}
- // Start emulation on a dedicated thread. It will do its own scheduling to sync 6507 and real time
- // and will run until we stop the worker.
+ // Start emulation on a dedicated thread. It will do its own scheduling to
+ // sync 6507 and real time and will run until we stop the worker.
emulationWorker.start(
timing.cyclesPerSecond(),
timing.maxCyclesPerTimeslice(),
@@ -768,8 +768,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
&tia
);
- // Render the frame. This may block, but emulation will continue to run on the worker, so the
- // audio pipeline is kept fed :)
+ // Render the frame. This may block, but emulation will continue to run on
+ // the worker, so the audio pipeline is kept fed :)
if (framePending) myFrameBuffer->updateInEmulationMode(myFpsMeter.fps());
// Stop the worker and wait until it has finished
@@ -805,11 +805,13 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
}
// Handle frying
- if (dispatchResult.getStatus() == DispatchResult::Status::ok && myEventHandler->frying())
+ if (dispatchResult.getStatus() == DispatchResult::Status::ok &&
+ myEventHandler->frying())
myConsole->fry();
// Return the 6507 time used in seconds
- return static_cast(totalCycles) / static_cast(timing.cyclesPerSecond());
+ return static_cast(totalCycles) /
+ static_cast(timing.cyclesPerSecond());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx
index 7f94dced2..5b5640677 100644
--- a/src/emucore/Serializer.cxx
+++ b/src/emucore/Serializer.cxx
@@ -23,7 +23,6 @@ using std::ios_base;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer(const string& filename, Mode m)
- : myStream(nullptr)
{
if(m == Mode::ReadOnly)
{
@@ -66,10 +65,8 @@ Serializer::Serializer(const string& filename, Mode m)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer()
- : myStream(nullptr)
+ : myStream{make_unique(ios::in | ios::out | ios::binary)}
{
- myStream = make_unique(ios::in | ios::out | ios::binary);
-
// For some reason, Windows and possibly macOS needs to store something in
// the stream before it is used for the first time
if(myStream)
diff --git a/src/emucore/Serializer.hxx b/src/emucore/Serializer.hxx
index 10164f2a1..9a967a8e0 100644
--- a/src/emucore/Serializer.hxx
+++ b/src/emucore/Serializer.hxx
@@ -49,7 +49,7 @@ class Serializer
The valid() method must immediately be called to verify the stream
was correctly initialized.
*/
- Serializer(const string& filename, Mode m = Mode::ReadWrite);
+ explicit Serializer(const string& filename, Mode m = Mode::ReadWrite);
Serializer();
public:
diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx
index b11ed727b..4063687d9 100644
--- a/src/emucore/Settings.cxx
+++ b/src/emucore/Settings.cxx
@@ -33,9 +33,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings::Settings()
+ : myRespository(make_shared())
{
- myRespository = make_shared();
-
// If no version is recorded with the persisted settings, we set it to zero
setPermanent(SETTINGS_VERSION_KEY, 0);
setPermanent("stella.version", "6.2.1");
diff --git a/src/emucore/tia/Missile.cxx b/src/emucore/tia/Missile.cxx
index 59c1fb493..2e2e12c31 100644
--- a/src/emucore/tia/Missile.cxx
+++ b/src/emucore/tia/Missile.cxx
@@ -43,7 +43,6 @@ void Missile::reset()
myColor = myObjectColor = myDebugColor = 0;
myDebugEnabled = false;
collision = myCollisionMaskDisabled;
- myIsEnabled = false;
myInvertedPhaseClock = false;
myUseInvertedPhaseClock = false;
}
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 50fcbd295..8b052b032 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -300,7 +300,7 @@ void Dialog::addFocusWidget(Widget* w)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::addToFocusList(WidgetArray& list)
+void Dialog::addToFocusList(const WidgetArray& list)
{
// All focusable widgets should retain focus
for(const auto& w: list)
@@ -314,7 +314,7 @@ void Dialog::addToFocusList(WidgetArray& list)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::addToFocusList(WidgetArray& list, TabWidget* w, int tabId)
+void Dialog::addToFocusList(const WidgetArray& list, TabWidget* w, int tabId)
{
// Only add the list if the tab actually exists
if(!w || w->getID() >= _myTabList.size())
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index a159a8107..0cc145d55 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -71,9 +71,9 @@ class Dialog : public GuiObject
void tick() override;
void addFocusWidget(Widget* w) override;
- void addToFocusList(WidgetArray& list) override;
- void addToFocusList(WidgetArray& list, TabWidget* w, int tabId);
- void addBGroupToFocusList(WidgetArray& list) { _buttonGroup = list; }
+ void addToFocusList(const WidgetArray& list) override;
+ void addToFocusList(const WidgetArray& list, TabWidget* w, int tabId);
+ void addBGroupToFocusList(const WidgetArray& list) { _buttonGroup = list; }
void addTabWidget(TabWidget* w);
void addDefaultWidget(Widget* w) { _defaultWidget = w; }
void addOKWidget(Widget* w) { _okWidget = w; }
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 4addb4b10..837aac3bb 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -30,16 +30,15 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& str)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
- _editString(str),
- _filter([](char c) { return isprint(c) && c != '\"'; })
+ _editString{str},
+ myUndoHandler{make_unique()},
+ _filter{[](char c) { return isprint(c) && c != '\"'; }}
{
_bgcolor = kWidColor;
_bgcolorhi = kWidColor;
_bgcolorlo = kDlgColor;
_textcolor = kTextColor;
_textcolorhi = kTextColor;
-
- myUndoHandler = make_unique();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -359,13 +358,10 @@ void EditableWidget::drawCaretSelection()
{
FBSurface& s = _boss->dialog().surface();
const Common::Rect& editRect = getEditRect();
- int x = editRect.x();
- int y = editRect.y();
-
string text = selectString();
- x = editRect.x();
- y = editRect.y();
+ int x = editRect.x();
+ int y = editRect.y();
int w = editRect.w();
int h = editRect.h();
int wt = int(text.length()) * _font.getMaxCharWidth() + 1;
diff --git a/src/gui/Font.cxx b/src/gui/Font.cxx
index 7c2b374e8..e327fa8af 100644
--- a/src/gui/Font.cxx
+++ b/src/gui/Font.cxx
@@ -18,6 +18,8 @@
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
+#include
+
#include "Font.hxx"
namespace GUI {
@@ -53,13 +55,8 @@ int Font::getStringWidth(const string& str) const
if(!myFontDesc.width)
return myFontDesc.maxwidth * int(str.size());
else
- {
- int space = 0;
- for(auto c: str)
- space += getCharWidth(c);
-
- return space;
- }
+ return std::accumulate(str.cbegin(), str.cend(), 0,
+ [&](int x, char c) { return x + getCharWidth(c); });
}
} // namespace GUI
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 85424a670..dd95d62cc 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -130,7 +130,7 @@ class GuiObject : public CommandReceiver
/** Add given widget(s) to the focus list */
virtual void addFocusWidget(Widget* w) = 0;
- virtual void addToFocusList(WidgetArray& list) = 0;
+ virtual void addToFocusList(const WidgetArray& list) = 0;
/** Return focus list for this object */
WidgetArray& getFocusList() { return _focusList; }
diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx
index f689ecd4e..af39c125a 100644
--- a/src/gui/HighScoresDialog.cxx
+++ b/src/gui/HighScoresDialog.cxx
@@ -100,12 +100,9 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h,
Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "High Scores"),
- myDirty(false),
- myHighScoreSaved(false),
- _max_w(max_w),
- _max_h(max_h),
- myInitials(""),
- myMode(mode)
+ _max_w{max_w},
+ _max_h{max_h},
+ myMode{mode}
{
myScores.variation = HSM::DEFAULT_VARIATION;
diff --git a/src/gui/HighScoresDialog.hxx b/src/gui/HighScoresDialog.hxx
index a62351990..c15105f6f 100644
--- a/src/gui/HighScoresDialog.hxx
+++ b/src/gui/HighScoresDialog.hxx
@@ -76,16 +76,17 @@ class HighScoresDialog : public Dialog
};
private:
- bool myUserDefVar; // allow the user to define the variation
- bool myDirty;
- bool myHighScoreSaved; // remember if current high score was already saved (avoids double HS)
+ bool myUserDefVar{false}; // allow the user to define the variation
+ bool myDirty{false};
+ bool myHighScoreSaved{false}; // remember if current high score was already saved
+ // (avoids double HS)
unique_ptr myConfirmMsg;
- int _max_w;
- int _max_h;
+ int _max_w{0};
+ int _max_h{0};
string myInitials;
- Int32 myEditRank;
- Int32 myHighScoreRank;
+ Int32 myEditRank{-1};
+ Int32 myHighScoreRank{-1};
string myNow;
HSM::ScoresData myScores;
@@ -120,4 +121,5 @@ class HighScoresDialog : public Dialog
HighScoresDialog& operator=(const HighScoresDialog&) = delete;
HighScoresDialog& operator=(HighScoresDialog&&) = delete;
};
+
#endif
diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx
index 694395cfa..91868282c 100644
--- a/src/gui/Launcher.cxx
+++ b/src/gui/Launcher.cxx
@@ -27,9 +27,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem& osystem)
- : DialogContainer(osystem)
+ : DialogContainer(osystem),
+ mySize(myOSystem.settings().getSize("launcherres"))
{
- mySize = myOSystem.settings().getSize("launcherres");
const Common::Size& d = myOSystem.frameBuffer().desktopSize();
double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 0643bd599..13f89e624 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -139,7 +139,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
lblSelect = "";
int lwSelectShort = font.getStringWidth(lblSelect);
- wTotal -= lwSelect - lwSelectShort;
+ // wTotal -= lwSelect - lwSelectShort; // dead code
lwSelect = lwSelectShort;
noSelect = true;
}
diff --git a/src/gui/R77HelpDialog.cxx b/src/gui/R77HelpDialog.cxx
index 1e4601ced..5d14d3719 100644
--- a/src/gui/R77HelpDialog.cxx
+++ b/src/gui/R77HelpDialog.cxx
@@ -65,8 +65,7 @@ R77HelpDialog::R77HelpDialog(OSystem& osystem, DialogContainer& parent,
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - HBORDER * 2, fontHeight,
"", TextAlign::Center);
- int jwidth = 11 * fontWidth;
- int bwidth = 11 * fontWidth;
+ const int jwidth = 11 * fontWidth, bwidth = jwidth;
xpos = HBORDER; ypos += lineHeight + 4;
for (uInt8 i = 0; i < LINES_PER_PAGE; ++i)
{
diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx
index e2b5e34df..658859b97 100644
--- a/src/gui/RadioButtonWidget.cxx
+++ b/src/gui/RadioButtonWidget.cxx
@@ -221,13 +221,13 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label,
RadioButtonGroup* group, int cmd)
: CheckboxWidget(boss, font, x, y, label, cmd),
- myGroup(group)
+ myGroup(group),
+ _buttonSize(buttonSize(font)) // 14 | 22
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = _bgcolorhi = kWidColor;
_editable = true;
- _buttonSize = buttonSize(font); // 14 | 22
if(_buttonSize == 14)
{
diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx
index 9d6f0837d..d2ca4305c 100644
--- a/src/gui/TabWidget.hxx
+++ b/src/gui/TabWidget.hxx
@@ -81,7 +81,7 @@ class TabWidget : public Widget, public CommandSender
bool enabled{true};
int tabWidth{0};
- Tab(const string& t, int tw = NO_WIDTH,
+ explicit Tab(const string& t, int tw = NO_WIDTH,
Widget* first = nullptr, Widget* parent = nullptr, bool e = true)
: title(t), firstWidget(first), parentWidget(parent), enabled(e), tabWidth(tw) { }
};
diff --git a/src/gui/VideoAudioDialog.hxx b/src/gui/VideoAudioDialog.hxx
index 550617d2d..f0d376140 100644
--- a/src/gui/VideoAudioDialog.hxx
+++ b/src/gui/VideoAudioDialog.hxx
@@ -59,7 +59,7 @@ class VideoAudioDialog : public Dialog
void handleOverscanChange();
void handlePhosphorChange();
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
- void addPalette(int x, int y, int h, int w);
+ void addPalette(int x, int y, int w, int h);
void colorPalette();
void updatePreset();
void updateEnabledState();
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 38c46bdbe..7f605a6ea 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -138,11 +138,9 @@ void Widget::draw()
// Now perform the actual widget draw
drawWidget((_flags & Widget::FLAG_HILITED) ? true : false);
- // Restore x/y
+ // Restore w/hy
if(hasBorder())
{
- _x -= 4;
- _y -= 4;
_w += 8;
_h += 8;
}
@@ -284,13 +282,10 @@ bool Widget::isWidgetInChain(Widget* w, Widget* find)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Widget::isWidgetInChain(WidgetArray& list, Widget* find)
+bool Widget::isWidgetInChain(const WidgetArray& list, Widget* find)
{
- for(const auto& w: list)
- if(w == find)
- return true;
-
- return false;
+ return std::any_of(list.cbegin(), list.cend(),
+ [&](Widget* w) { return w == find; });
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index cf4637ea1..f31c2fce0 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -83,7 +83,7 @@ class Widget : public GuiObject
void receivedFocus();
void lostFocus();
void addFocusWidget(Widget* w) override { _focusList.push_back(w); }
- void addToFocusList(WidgetArray& list) override {
+ void addToFocusList(const WidgetArray& list) override {
Vec::append(_focusList, list);
}
@@ -157,7 +157,7 @@ class Widget : public GuiObject
static bool isWidgetInChain(Widget* start, Widget* find);
/** Determine if 'find' is in the widget array */
- static bool isWidgetInChain(WidgetArray& list, Widget* find);
+ static bool isWidgetInChain(const WidgetArray& list, Widget* find);
/** Select either previous, current, or next widget in chain to have
focus, and deselects all others */
diff --git a/src/libretro/EventHandlerLIBRETRO.cxx b/src/libretro/EventHandlerLIBRETRO.cxx
index 046839032..d74ee3679 100644
--- a/src/libretro/EventHandlerLIBRETRO.cxx
+++ b/src/libretro/EventHandlerLIBRETRO.cxx
@@ -15,7 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
-#include "OSystem.hxx"
#include "EventHandlerLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/libretro/FBSurfaceLIBRETRO.cxx b/src/libretro/FBSurfaceLIBRETRO.cxx
index 1f3d7e549..9041cc127 100644
--- a/src/libretro/FBSurfaceLIBRETRO.cxx
+++ b/src/libretro/FBSurfaceLIBRETRO.cxx
@@ -19,15 +19,13 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceLIBRETRO::FBSurfaceLIBRETRO(uInt32 width, uInt32 height)
+ : myWidth{width},
+ myHeight{height},
+ myPixelData{make_unique(myWidth * myHeight)}
{
- myWidth = width;
- myHeight = height;
-
- myPixelData = make_unique(width * height);
-
////////////////////////////////////////////////////
// These *must* be set for the parent class
myPixels = myPixelData.get();
- myPitch = width;
+ myPitch = myWidth;
////////////////////////////////////////////////////
}
diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx
index f6bf3320b..7578ca658 100644
--- a/src/libretro/FBSurfaceLIBRETRO.hxx
+++ b/src/libretro/FBSurfaceLIBRETRO.hxx
@@ -64,8 +64,8 @@ class FBSurfaceLIBRETRO : public FBSurface
void applyAttributes() override { }
private:
- unique_ptr myPixelData;
uInt32 myWidth, myHeight;
+ unique_ptr myPixelData;
Common::Rect mySrcGUIR, myDstGUIR;
private:
diff --git a/src/libretro/FSNodeLIBRETRO.cxx b/src/libretro/FSNodeLIBRETRO.cxx
index f3670f0a2..43fee3d9b 100644
--- a/src/libretro/FSNodeLIBRETRO.cxx
+++ b/src/libretro/FSNodeLIBRETRO.cxx
@@ -27,15 +27,15 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
- : _name("rom"),
- _path("." + slash)
+ : _name{"rom"},
+ _path{"." + slash}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
- : _name(p),
- _path(p)
+ : _name{p},
+ _path{p}
{
// TODO: use retro_vfs_mkdir_t (file) or RETRO_MEMORY_SAVE_RAM (stream) or libretro save path
if(p == "." + slash + "nvram")
diff --git a/src/libretro/SoundLIBRETRO.cxx b/src/libretro/SoundLIBRETRO.cxx
index 2c15ce04d..6cee38c1f 100644
--- a/src/libretro/SoundLIBRETRO.cxx
+++ b/src/libretro/SoundLIBRETRO.cxx
@@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundLIBRETRO::SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings)
: Sound(osystem),
- myAudioSettings(audioSettings)
+ myAudioSettings{audioSettings}
{
Logger::debug("SoundLIBRETRO::SoundLIBRETRO started ...");
Logger::debug("SoundLIBRETRO::SoundLIBRETRO initialized");
diff --git a/src/libretro/StellaLIBRETRO.cxx b/src/libretro/StellaLIBRETRO.cxx
index b80d517d9..8b3541332 100644
--- a/src/libretro/StellaLIBRETRO.cxx
+++ b/src/libretro/StellaLIBRETRO.cxx
@@ -31,9 +31,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaLIBRETRO::StellaLIBRETRO()
+ : rom_image{make_unique(getROMMax())},
+ audio_buffer{make_unique(audio_buffer_max)}
{
- audio_buffer = make_unique(audio_buffer_max);
- rom_image = make_unique(getROMMax());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx
index f483dc899..c49d7d1ce 100644
--- a/src/unix/FSNodePOSIX.cxx
+++ b/src/unix/FSNodePOSIX.cxx
@@ -32,10 +32,8 @@ FilesystemNodePOSIX::FilesystemNodePOSIX()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify)
+ : _path{path.length() > 0 ? path : "~"} // Default to home directory
{
- // Default to home directory
- _path = path.length() > 0 ? path : "~";
-
// Expand '~' to the HOME environment variable
if(_path[0] == '~')
{
diff --git a/src/unix/FSNodePOSIX.hxx b/src/unix/FSNodePOSIX.hxx
index 5bf9e0277..5aba86afa 100644
--- a/src/unix/FSNodePOSIX.hxx
+++ b/src/unix/FSNodePOSIX.hxx
@@ -58,7 +58,7 @@ class FilesystemNodePOSIX : public AbstractFSNode
* @param verify true if the isValid and isDirectory/isFile flags should
* be verified during the construction.
*/
- FilesystemNodePOSIX(const string& path, bool verify = true);
+ explicit FilesystemNodePOSIX(const string& path, bool verify = true);
bool exists() const override { return access(_path.c_str(), F_OK) == 0; }
const string& getName() const override { return _displayName; }
diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx
index c8676e542..82182fe83 100644
--- a/src/windows/FSNodeWINDOWS.cxx
+++ b/src/windows/FSNodeWINDOWS.cxx
@@ -175,10 +175,8 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
+ : _path(p.length() > 0 ? p : "~") // Default to home directory
{
- // Default to home directory
- _path = p.length() > 0 ? p : "~";
-
// Expand '~' to the users 'home' directory
if(_path[0] == '~')
_path.replace(0, 1, myHomeFinder.getHomePath());
From a891f5cb33586577476f32a308365948769ddf39 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Fri, 18 Dec 2020 23:29:25 -0330
Subject: [PATCH 20/27] libretro: Fix warnings with memset; use default
initialization instead.
---
src/libretro/libretro.cxx | 10 +++++----
src/libretro/libretro.h | 44 +++++++++++++++++++--------------------
2 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/src/libretro/libretro.cxx b/src/libretro/libretro.cxx
index 42408bd97..34383b73e 100644
--- a/src/libretro/libretro.cxx
+++ b/src/libretro/libretro.cxx
@@ -423,7 +423,7 @@ void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_get_system_info(struct retro_system_info *info)
{
- memset(info,0,sizeof(retro_system_info));
+ *info = retro_system_info{}; // reset to defaults
info->library_name = stella.getCoreName();
#ifndef GIT_VERSION
@@ -438,18 +438,20 @@ void retro_get_system_info(struct retro_system_info *info)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_get_system_av_info(struct retro_system_av_info *info)
{
- memset(info,0,sizeof(retro_system_av_info));
+ *info = retro_system_av_info{}; // reset to defaults
info->timing.fps = stella.getVideoRate();
info->timing.sample_rate = stella.getAudioRate();
- info->geometry.base_width = stella.getRenderWidth() - crop_left * (stella.getVideoZoom() == 1 ? 2 : 1);
+ info->geometry.base_width = stella.getRenderWidth() - crop_left *
+ (stella.getVideoZoom() == 1 ? 2 : 1);
info->geometry.base_height = stella.getRenderHeight();
info->geometry.max_width = stella.getVideoWidthMax();
info->geometry.max_height = stella.getVideoHeightMax();
- info->geometry.aspect_ratio = stella.getVideoAspectPar() * (float) info->geometry.base_width / (float) info->geometry.base_height;
+ info->geometry.aspect_ratio = stella.getVideoAspectPar() *
+ (float) info->geometry.base_width / (float) info->geometry.base_height;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/libretro/libretro.h b/src/libretro/libretro.h
index 534d57ca6..1901465ae 100644
--- a/src/libretro/libretro.h
+++ b/src/libretro/libretro.h
@@ -2100,16 +2100,16 @@ struct retro_system_info
/* All pointers are owned by libretro implementation, and pointers must
* remain valid until retro_deinit() is called. */
- const char *library_name; /* Descriptive name of library. Should not
- * contain any version numbers, etc. */
- const char *library_version; /* Descriptive version of core. */
+ const char *library_name{nullptr}; /* Descriptive name of library. Should not
+ * contain any version numbers, etc. */
+ const char *library_version{nullptr}; /* Descriptive version of core. */
- const char *valid_extensions; /* A string listing probably content
- * extensions the core will be able to
- * load, separated with pipe.
- * I.e. "bin|rom|iso".
- * Typically used for a GUI to filter
- * out extensions. */
+ const char *valid_extensions{nullptr}; /* A string listing probably content
+ * extensions the core will be able to
+ * load, separated with pipe.
+ * I.e. "bin|rom|iso".
+ * Typically used for a GUI to filter
+ * out extensions. */
/* If true, retro_load_game() is guaranteed to provide a valid pathname
* in retro_game_info::path.
@@ -2122,33 +2122,33 @@ struct retro_system_info
* load from file.
* Implementations should strive for setting this to false, as it allows
* the frontend to perform patching, etc. */
- bool need_fullpath;
+ bool need_fullpath{false};
/* If true, the frontend is not allowed to extract any archives before
* loading the real content.
* Necessary for certain libretro implementations that load games
* from zipped archives. */
- bool block_extract;
+ bool block_extract{false};
};
struct retro_game_geometry
{
- unsigned base_width; /* Nominal video width of game. */
- unsigned base_height; /* Nominal video height of game. */
- unsigned max_width; /* Maximum possible width of game. */
- unsigned max_height; /* Maximum possible height of game. */
+ unsigned base_width{0}; /* Nominal video width of game. */
+ unsigned base_height{0}; /* Nominal video height of game. */
+ unsigned max_width{0}; /* Maximum possible width of game. */
+ unsigned max_height{0}; /* Maximum possible height of game. */
- float aspect_ratio; /* Nominal aspect ratio of game. If
- * aspect_ratio is <= 0.0, an aspect ratio
- * of base_width / base_height is assumed.
- * A frontend could override this setting,
- * if desired. */
+ float aspect_ratio{0.F}; /* Nominal aspect ratio of game. If
+ * aspect_ratio is <= 0.0, an aspect ratio
+ * of base_width / base_height is assumed.
+ * A frontend could override this setting,
+ * if desired. */
};
struct retro_system_timing
{
- double fps; /* FPS of video content. */
- double sample_rate; /* Sampling rate of audio. */
+ double fps{0.F}; /* FPS of video content. */
+ double sample_rate{0.F}; /* Sampling rate of audio. */
};
struct retro_system_av_info
From e837e1f94ceea1d9fa0ac79fc64097c0e00c8266 Mon Sep 17 00:00:00 2001
From: Stephen Anthony
Date: Sat, 19 Dec 2020 18:35:16 -0330
Subject: [PATCH 21/27] Disabled PlusROM for now, until we find more time to
work on it.
---
src/emucore/CartEnhanced.cxx | 18 ++++++++---
src/emucore/PlusROM.cxx | 62 ++++++++++++++++++++++++------------
src/emucore/PlusROM.hxx | 9 +++++-
3 files changed, 63 insertions(+), 26 deletions(-)
diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx
index 08cf5bab1..2f21a589e 100644
--- a/src/emucore/CartEnhanced.cxx
+++ b/src/emucore/CartEnhanced.cxx
@@ -56,10 +56,12 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
// space will be filled with 0's from above
std::copy_n(image.get(), std::min(mySize, size), myImage.get());
+#if 0
// Determine whether we have a PlusROM cart
// PlusROM needs to call peek() method, so disable direct peeks
if(myPlusROM.initialize(myImage, mySize))
myDirectPeek = false;
+#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -147,6 +149,7 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
{
const uInt16 peekAddress = address;
+#if 0
// Is this a PlusROM?
if(myPlusROM.isValid())
{
@@ -154,6 +157,7 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
if(myPlusROM.peekHotspot(address, value))
return value;
}
+#endif
// hotspots in TIA range are reacting to pokes only
if (hotspot() >= 0x80)
@@ -184,9 +188,11 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
{
+#if 0
// Is this a PlusROM?
if(myPlusROM.isValid() && myPlusROM.pokeHotspot(address, value))
return true;
+#endif
// Switch banks if necessary
if (checkSwitchBank(address & ADDR_MASK, value))
@@ -380,8 +386,10 @@ bool CartridgeEnhanced::save(Serializer& out) const
out.putIntArray(myCurrentSegOffset.get(), myBankSegs);
if(myRamSize > 0)
out.putByteArray(myRAM.get(), myRamSize);
- if(myPlusROM.isValid())
- if(!myPlusROM.save(out)) return false;
+#if 0
+ if(myPlusROM.isValid() && !myPlusROM.save(out))
+ return false;
+#endif
}
catch(...)
{
@@ -400,8 +408,10 @@ bool CartridgeEnhanced::load(Serializer& in)
in.getIntArray(myCurrentSegOffset.get(), myBankSegs);
if(myRamSize > 0)
in.getByteArray(myRAM.get(), myRamSize);
- if(myPlusROM.isValid())
- if(!myPlusROM.load(in)) return false;
+#if 0
+ if(myPlusROM.isValid() && !myPlusROM.load(in))
+ return false;
+#endif
}
catch(...)
{
diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx
index f779b09a0..20832734a 100644
--- a/src/emucore/PlusROM.cxx
+++ b/src/emucore/PlusROM.cxx
@@ -15,6 +15,9 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
+#include
+
+#include "bspf.hxx"
#include "PlusROM.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -25,36 +28,28 @@ bool PlusROM::initialize(const ByteBuffer& image, size_t size)
if(i >= size)
return myIsPlusROM = false; // Invalid NMI
- // Convenience functions to detect valid path and host characters
- auto isValidPathChar = [](uInt8 c) {
- return ((c > 44 && c < 58) || (c > 64 && c < 91) || (c > 96 && c < 122));
- };
- auto isValidHostChar = [](uInt8 c) {
- return (c == 45 || c == 46 || (c > 47 && c < 58) ||
- (c > 64 && c < 91) || (c > 96 && c < 122));
- };
-
// Path stored first, 0-terminated
- while(i < size && isValidPathChar(image[i]))
- myPath += static_cast(image[i++]);
+ string path;
+ while(i < size && image[i] != 0)
+ path += static_cast(image[i++]);
- // Did we get a 0-terminated path?
- if(i >= size || image[i] != 0)
- return myIsPlusROM = false; // Wrong delimiter
+ // Did we get a valid, 0-terminated path?
+ if(i >= size || image[i] != 0 || !isValidPath(path))
+ return myIsPlusROM = false; // Invalid path
i++; // advance past 0 terminator
// Host stored next, 0-terminated
- while(i < size && isValidHostChar(image[i]))
- myHost += static_cast(image[i++]);
+ string host;
+ while(i < size && image[i] != 0)
+ host += static_cast(image[i++]);
// Did we get a valid, 0-terminated host?
- if(i >= size || image[i] != 0 || myHost.size() < 3 || myHost.find(".") == string::npos)
- return myIsPlusROM = false; // Wrong delimiter or dotless IP
-
- cerr << "Path: " << myPath << endl;
- cerr << "Host: " << myHost << endl;
+ if(i >= size || image[i] != 0 || !isValidHost(host))
+ return myIsPlusROM = false; // Invalid host
+ myURL = "http://" + host + "/" + path;
+ cerr << "URL: " << myURL << endl;
return myIsPlusROM = true;
}
@@ -120,3 +115,28 @@ bool PlusROM::load(Serializer& in)
return true;
}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::isValidHost(const string& host) const
+{
+ // TODO: This isn't 100% either, as we're supposed to check for the length
+ // of each part between '.' in the range 1 .. 63
+ // Perhaps a better function will be included with whatever network
+ // library we decide to use
+ static std::regex rgx(R"(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$)", std::regex_constants::icase);
+
+ return std::regex_match(host, rgx);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::isValidPath(const string& path) const
+{
+ // TODO: This isn't 100%
+ // Perhaps a better function will be included with whatever network
+ // library we decide to use
+ for(auto c: path)
+ if(!((c > 44 && c < 58) || (c > 64 && c < 91) || (c > 96 && c < 122)))
+ return false;
+
+ return true;
+}
diff --git a/src/emucore/PlusROM.hxx b/src/emucore/PlusROM.hxx
index d38979488..b3e116380 100644
--- a/src/emucore/PlusROM.hxx
+++ b/src/emucore/PlusROM.hxx
@@ -108,9 +108,16 @@ class PlusROM : public Serializable
*/
bool load(Serializer& in) override;
+ private:
+ //////////////////////////////////////////////////////
+ // These probably belong in the networking library
+ bool isValidHost(const string& host) const;
+ bool isValidPath(const string& path) const;
+ //////////////////////////////////////////////////////
+
private:
bool myIsPlusROM{false};
- string myPath, myHost;
+ string myURL;
std::array myRxBuffer, myTxBuffer;
From c08148182570dcdee28f6d5de23095f2e4e1dde1 Mon Sep 17 00:00:00 2001
From: thrust26
Date: Sun, 20 Dec 2020 15:13:03 +0100
Subject: [PATCH 22/27] added mouse support to editable widgets added missing
hotkeys to launcher context menu updated docs
---
Changes.txt | 6 +-
docs/index.html | 64 ++++++-------
src/debugger/gui/RomListSettings.hxx | 2 +
src/gui/ContextMenu.cxx | 6 +-
src/gui/EditTextWidget.cxx | 27 ++----
src/gui/EditableWidget.cxx | 135 +++++++++++++++++++++++++++
src/gui/EditableWidget.hxx | 14 ++-
src/gui/LauncherDialog.cxx | 36 +++++--
src/gui/PopUpWidget.cxx | 43 ++++-----
src/gui/PopUpWidget.hxx | 1 +
src/gui/WhatsNewDialog.cxx | 1 +
11 files changed, 245 insertions(+), 90 deletions(-)
diff --git a/Changes.txt b/Changes.txt
index af5b01a62..013c1a57c 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -16,9 +16,11 @@
* Added high scores saving.
- * Enhanced cut/copy/paste for text editing. (TODO: PromptWidget)
+ * Enhanced cut/copy/paste for text editing (except PromptWidget).
- * Added undo and redo to text editing. (TODO: PromptWidget)
+ * Added undo and redo to text editing (except PromptWidget).
+
+ * Added mouse support for text editing (except PromptWidget).
* Added wildcard support to launcher dialog filter.
diff --git a/docs/index.html b/docs/index.html
index 071244afc..23ed6905a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1987,23 +1987,18 @@
Key (macOS) |
- Load previous game in ROM (multicart ROM, TIA mode) |
+ Load previous game in ROM (multicart ROM) |
Shift-Control + r |
Shift-Control + r |
- Reload current ROM (singlecart ROM, TIA mode)
- Load next game in ROM (multicart ROM, TIA mode) |
+ Reload current ROM (singlecart ROM)
+ Load next game in ROM (multicart ROM) |
Control + r |
Control + r |
- Reload ROM listing (ROM launcher mode) |
- Control + r |
- Control + r |
-
-
- Emulate 'frying' effect (TIA mode) |
+ Emulate 'frying' effect |
Backspace |
Backspace |
@@ -4007,7 +4002,7 @@
The ROM launcher also contains a context menu, selected by clicking the
- right mouse button anywhere in the current window. This context menu
+ right mouse button in the ROM list. This context menu
contains the following items:
@@ -4018,31 +4013,32 @@
its functionality, and use ROM properties as defined by the ROM itself. The dialog is as
follows (see Advanced Configuration - Game Properties
for more information concerning ROM properties):
-
-
- |
- |
-
-
- Item | For more information, see Commandline |
- Bankswitch type | -bs |
- TV type | -tv |
- Left difficulty | -ld |
- Right difficulty | -rd |
- Startup mode | -debug |
- Left joy items | -holdjoy0 |
- Right joy items | -holdjoy1 |
- Console: Select | -holdselect |
- Console: Reset | -holdreset |
-
-
- |
-
-
+
+
+ |
+ |
+
+
+ Item | For more information, see Commandline |
+ Bankswitch type | -bs |
+ TV type | -tv |
+ Left difficulty | -ld |
+ Right difficulty | -rd |
+ Startup mode | -debug |
+ Left joy items | -holdjoy0 |
+ Right joy items | -holdjoy1 |
+ Console: Select | -holdselect |
+ Console: Reset | -holdreset |
+
+
+ |
+
+
+ This dialog can also be opened by pressing 'Control + p'.