diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 9500928d03..9f60ff70ac 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -173,17 +173,18 @@ void MainEmuFrame::ConnectMenus() #define ConnectMenu( id, handler ) \ Connect( id, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) + + #define ConnectMenuRange( id_start, inc, handler ) \ + Connect( id_start, id_start + inc, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainEmuFrame::handler) ) + ConnectMenu( MenuId_Config_Settings, Menu_ConfigSettings_Click ); ConnectMenu( MenuId_Config_BIOS, Menu_SelectBios_Click ); - Connect( wxID_FILE1, wxID_FILE1+20, wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(MainEmuFrame::Menu_IsoRecent_Click) ); + ConnectMenuRange(wxID_FILE1, 20, Menu_IsoRecent_Click); - Connect( MenuId_Config_GS, MenuId_Config_GS+PluginId_Count, wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(MainEmuFrame::Menu_ConfigPlugin_Click) ); + ConnectMenuRange(MenuId_Config_GS, PluginId_Count, Menu_IsoRecent_Click); - Connect( MenuId_Src_Iso, MenuId_Src_Iso+3, wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(MainEmuFrame::Menu_CdvdSource_Click) ); + ConnectMenuRange(MenuId_Src_Iso, 3, Menu_CdvdSource_Click); ConnectMenu( MenuId_Boot_CDVD, Menu_BootCdvd_Click ); ConnectMenu( MenuId_Boot_ELF, Menu_OpenELF_Click ); @@ -196,15 +197,11 @@ void MainEmuFrame::ConnectMenus() ConnectMenu( MenuId_State_LoadOther, Menu_LoadStateOther_Click ); - for (int i = MenuId_State_Load01 + 1; i <= (MenuId_State_Load01 + 10); i++) - ConnectMenu(i, Menu_LoadStates_Click); + ConnectMenuRange(MenuId_State_Load01+1, 10, Menu_LoadStates_Click); ConnectMenu( MenuId_State_SaveOther, Menu_SaveStateOther_Click ); - for (int i = MenuId_State_Save01 + 1; i <= (MenuId_State_Save01 + 10); i++) - ConnectMenu(i, Menu_SaveStates_Click); - - ConnectMenu( MenuId_State_SaveOther, Menu_SaveStateOther_Click ); + ConnectMenuRange(MenuId_State_Save01+1, 10, Menu_SaveStates_Click); ConnectMenu( MenuId_Debug_Open, Menu_Debug_Open_Click ); ConnectMenu( MenuId_Debug_MemoryDump, Menu_Debug_MemoryDump_Click ); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 8ff1ca2820..3da7253255 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -191,22 +191,12 @@ void MainEmuFrame::Menu_OpenELF_Click(wxCommandEvent &event) void MainEmuFrame::Menu_LoadStates_Click(wxCommandEvent &event) { int id = event.GetId() - MenuId_State_Load01 - 1; - if (id == -1) // Bad, I know. If I figure out why Load Other... gets connected here, I'll remove it. - { - Menu_LoadStateOther_Click(event); - return; - } Console::WriteLn("If this were hooked up, it would load slot %d.", params id); } void MainEmuFrame::Menu_SaveStates_Click(wxCommandEvent &event) { int id = event.GetId() - MenuId_State_Save01 - 1; - if (id == -1) - { - Menu_SaveStateOther_Click(event); - return; - } Console::WriteLn("If this were hooked up, it would save slot %d.", params id); } diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index f2ebba936b..60453eaa6d 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -63,27 +63,14 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) : } -// There's a better way to do this. This was quicker to hack in, though, and can always be replaced later. -static void set_game_fix(int num, bool status) -{ - switch (num) - { - case 0: EmuConfig.Gamefixes.VuAddSubHack = status; break; - case 1: EmuConfig.Gamefixes.VuClipFlagHack = status; break; - case 2: EmuConfig.Gamefixes.FpuCompareHack = status; break; - case 3: EmuConfig.Gamefixes.FpuMulHack = status; break; - case 4: EmuConfig.Gamefixes.DMAExeHack = status; break; - case 5: EmuConfig.Gamefixes.XgKickHack = status; break; - case 6: EmuConfig.Gamefixes.MpegHack = status; break; - default: break; - } - return; -} - +// I could still probably get rid of the for loop, but I think this is clearer. void Panels::GameFixesPanel::Apply( AppConfig& conf ) { for (int i = 0; i < NUM_OF_GAME_FIXES; i++) { - set_game_fix(i, game_fix_checkbox[i]->GetValue()); + if (game_fix_checkbox[i]->GetValue()) + EmuConfig.Gamefixes.bitset |= ( 1 << i); + else + EmuConfig.Gamefixes.bitset &= ~( 1 << i); } }