diff --git a/CMakeLists.txt b/CMakeLists.txt index cae89519..caa088f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,7 @@ set(SRC_FILES src/osdep/gui/PanelDisplay.cpp src/osdep/gui/PanelSound.cpp src/osdep/gui/PanelMisc.cpp + src/osdep/gui/PanelPrio.cpp src/osdep/gui/PanelSavestate.cpp src/osdep/gui/main_window.cpp src/osdep/gui/Navigation.cpp diff --git a/Makefile b/Makefile index cd7f9c79..260e7c55 100644 --- a/Makefile +++ b/Makefile @@ -422,6 +422,7 @@ OBJS = \ src/osdep/gui/PanelDisplay.o \ src/osdep/gui/PanelSound.o \ src/osdep/gui/PanelMisc.o \ + src/osdep/gui/PanelPrio.o \ src/osdep/gui/PanelSavestate.o \ src/osdep/gui/main_window.o \ src/osdep/gui/Navigation.o diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj b/VisualGDB/Amiberry/Amiberry.vcxproj index c2423d4a..cde5a4d3 100644 --- a/VisualGDB/Amiberry/Amiberry.vcxproj +++ b/VisualGDB/Amiberry/Amiberry.vcxproj @@ -281,6 +281,7 @@ + diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj.filters b/VisualGDB/Amiberry/Amiberry.vcxproj.filters index db0bf5ea..7e65ee96 100644 --- a/VisualGDB/Amiberry/Amiberry.vcxproj.filters +++ b/VisualGDB/Amiberry/Amiberry.vcxproj.filters @@ -640,6 +640,9 @@ Source files + + Source files\osdep\gui + diff --git a/src/include/options.h b/src/include/options.h index 8f765dc0..59f46247 100644 --- a/src/include/options.h +++ b/src/include/options.h @@ -888,6 +888,14 @@ struct uae_prefs int gfx_correct_aspect; int scaling_method; + int active_capture_priority; + bool active_nocapture_pause; + bool active_nocapture_nosound; + int inactive_priority; + bool inactive_pause; + bool inactive_nosound; + int inactive_input; + TCHAR open_gui[256]; TCHAR quit_amiberry[256]; TCHAR action_replay[256]; diff --git a/src/osdep/amiberry.cpp b/src/osdep/amiberry.cpp index 7c5e9d9c..cbd864fb 100644 --- a/src/osdep/amiberry.cpp +++ b/src/osdep/amiberry.cpp @@ -444,6 +444,13 @@ void target_default_options(struct uae_prefs* p, int type) _tcscpy(p->fullscreen_toggle, amiberry_options.default_fullscreen_toggle_key); p->allow_host_run = false; + p->active_capture_priority = 1; + p->active_nocapture_pause = false; + p->active_nocapture_nosound = false; + p->inactive_priority = 0; + p->inactive_nosound = true; + p->inactive_pause = true; + p->inactive_input = 0; p->input_analog_remap = false; @@ -523,6 +530,14 @@ void target_save_options(struct zfile* f, struct uae_prefs* p) cfgfile_write_bool(f, _T("amiberry.use_retroarch_reset"), p->use_retroarch_reset); cfgfile_target_dwrite(f, _T("cpu_idle"), _T("%d"), p->cpu_idle); + cfgfile_write(f, _T("active_priority"), _T("%d"), p->active_capture_priority); + cfgfile_target_dwrite_bool(f, _T("active_not_captured_nosound"), p->active_nocapture_nosound); + cfgfile_target_dwrite_bool(f, _T("active_not_captured_pause"), p->active_nocapture_pause); + cfgfile_write(f, _T("inactive_priority"), _T("%d"), p->inactive_priority); + cfgfile_target_dwrite_bool(f, _T("inactive_nosound"), p->inactive_nosound); + cfgfile_target_dwrite_bool(f, _T("inactive_pause"), p->inactive_pause); + cfgfile_target_dwrite(f, _T("inactive_input"), _T("%d"), p->inactive_input); + #ifdef ANDROID cfgfile_write(f, "amiberry.onscreen", "%d", p->onScreen); cfgfile_write(f, "amiberry.onscreen_textinput", "%d", p->onScreen_textinput); @@ -635,6 +650,20 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val return 1; if (cfgfile_intval(option, value, _T("cpu_idle"), &p->cpu_idle, 1)) return 1; + if (cfgfile_intval(option, value, _T("active_priority"), &p->active_capture_priority, 1)) + return 1; + if (cfgfile_yesno(option, value, _T("active_nocapture_pause"), &p->active_nocapture_pause)) + return 1; + if (cfgfile_yesno(option, value, _T("active_nocapture_nosound"), &p->active_nocapture_nosound)) + return 1; + if (cfgfile_intval(option, value, _T("inactive_priority"), &p->inactive_priority, 1)) + return 1; + if (cfgfile_yesno(option, value, _T("inactive_pause"), &p->inactive_pause)) + return 1; + if (cfgfile_yesno(option, value, _T("inactive_nosound"), &p->inactive_nosound)) + return 1; + if (cfgfile_intval(option, value, _T("inactive_input"), &p->inactive_input, 1)) + return 1; return 0; } @@ -1424,6 +1453,27 @@ int main(int argc, char* argv[]) return 0; } +void setpriority(int prio) +{ + if (prio >= 0 && prio <= 2) + { + switch (prio) + { + case 0: + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW); + break; + case 1: + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_NORMAL); + break; + case 2: + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); + break; + default: + break; + } + } +} + void toggle_mousegrab() { // Release mouse @@ -1486,28 +1536,60 @@ static void amiberry_inactive(int minimized) } else if (mouseactive) { inputdevice_unacquire(); - setpaused(2); - sound_closed = -1; + if (currprefs.active_nocapture_pause) + { + setpaused(2); + sound_closed = 1; + } + else if (currprefs.active_nocapture_nosound) + { + setsoundpaused(); + sound_closed = -1; + } } else { - inputdevice_unacquire(); - setpaused(2); - sound_closed = -1; + if (currprefs.inactive_pause) + { + inputdevice_unacquire(); + setpaused(2); + sound_closed = 1; + } + else if (currprefs.inactive_nosound) + { + inputdevice_unacquire(true, currprefs.inactive_input); + setsoundpaused(); + sound_closed = -1; + } + else { + inputdevice_unacquire(true, currprefs.inactive_input); + } } } else { inputdevice_unacquire(); } + setpriority(currprefs.inactive_priority); } static void amiberry_active(int minimized) { + setpriority(currprefs.active_capture_priority); + if (sound_closed != 0) { if (sound_closed < 0) { resumesoundpaused(); } + else + { + if (currprefs.active_nocapture_pause) + { + if (mouseactive) + resumepaused(2); + } + else if (currprefs.inactive_pause) + resumepaused(2); + } sound_closed = 0; } - resumepaused(2); //getcapslock(); inputdevice_acquire(TRUE); if (isfullscreen() > 0) @@ -1540,15 +1622,23 @@ static void setmouseactive2(int active, bool allowpause) if (active) { inputdevice_acquire(TRUE); - resumepaused(2); - if (sound_closed < 0) + setpriority(currprefs.active_capture_priority); + if (currprefs.active_nocapture_pause) + resumepaused(2); + else if (currprefs.active_nocapture_nosound && sound_closed < 0) resumesoundpaused(); } else { inputdevice_acquire(FALSE); inputdevice_releasebuttons(); - setpaused(2); - sound_closed = -1; + } + if (!active && allowpause) + { + if (currprefs.active_nocapture_pause) + setpaused(2); + else if (currprefs.active_nocapture_nosound) + setsoundpaused(); + sound_closed = -1; } } @@ -1568,12 +1658,22 @@ void enablecapture() resumesoundpaused(); sound_closed = 0; } + if (currprefs.inactive_pause || currprefs.active_nocapture_pause) + resumepaused(2); } void disablecapture() { setmouseactive(0); focus = 0; + if (currprefs.active_nocapture_pause && sound_closed == 0) { + setpaused(2); + sound_closed = 1; + } + else if (currprefs.active_nocapture_nosound && sound_closed == 0) { + setsoundpaused(); + sound_closed = -1; + } } void process_event(SDL_Event event) @@ -1598,6 +1698,7 @@ void process_event(SDL_Event event) case SDL_WINDOWEVENT_FOCUS_GAINED: mouseinside = true; set_mouse_grab(true); + amiberry_active(minimized); break; case SDL_WINDOWEVENT_LEAVE: mouseinside = false; @@ -1605,6 +1706,7 @@ void process_event(SDL_Event event) case SDL_WINDOWEVENT_FOCUS_LOST: mouseinside = false; set_mouse_grab(false); + amiberry_inactive(minimized); break; case SDL_WINDOWEVENT_CLOSE: uae_quit(); diff --git a/src/osdep/amiberry_gfx.cpp b/src/osdep/amiberry_gfx.cpp index b4d4c1ae..c5a89bd4 100644 --- a/src/osdep/amiberry_gfx.cpp +++ b/src/osdep/amiberry_gfx.cpp @@ -29,6 +29,7 @@ #include "gfxboard.h" #include "statusline.h" +#include "sounddep/sound.h" #include "threaddep/thread.h" static uae_thread_id display_tid = nullptr; static smp_comm_pipe *volatile display_pipe = nullptr; @@ -845,6 +846,7 @@ static void open_screen(struct uae_prefs* p) #endif + setpriority(currprefs.active_capture_priority); if (screen != nullptr) { allocsoftbuffer(&avidinfo->drawbuffer, display_width, display_height, display_depth); @@ -924,6 +926,13 @@ int check_prefs_changed_gfx() auto changed = 0; + if (currprefs.chipset_refreshrate != changed_prefs.chipset_refreshrate) + { + currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate; + init_hz_normal(); + return 1; + } + if (currprefs.color_mode != changed_prefs.color_mode || currprefs.gfx_monitor.gfx_size_fs.width != changed_prefs.gfx_monitor.gfx_size_fs.width || currprefs.gfx_monitor.gfx_size_fs.height != changed_prefs.gfx_monitor.gfx_size_fs.height || @@ -963,6 +972,9 @@ int check_prefs_changed_gfx() changed = 1; } + if (changed) + init_custom(); + if (currprefs.gf[0].gfx_filter_autoscale != changed_prefs.gf[0].gfx_filter_autoscale || currprefs.gfx_xcenter_pos != changed_prefs.gfx_xcenter_pos || currprefs.gfx_ycenter_pos != changed_prefs.gfx_ycenter_pos || @@ -984,30 +996,44 @@ int check_prefs_changed_gfx() return 1; } - - if (currprefs.leds_on_screen != changed_prefs.leds_on_screen) - { - currprefs.leds_on_screen = changed_prefs.leds_on_screen; - changed = 1; - } - if (currprefs.chipset_refreshrate != changed_prefs.chipset_refreshrate) - { - currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate; - changed = 1; - } - if (currprefs.input_mouse_untrap != changed_prefs.input_mouse_untrap) - { - currprefs.input_mouse_untrap = changed_prefs.input_mouse_untrap; - changed = 1; - } currprefs.filesys_limit = changed_prefs.filesys_limit; currprefs.harddrive_read_only = changed_prefs.harddrive_read_only; + + if (currprefs.leds_on_screen != changed_prefs.leds_on_screen || + currprefs.keyboard_leds[0] != changed_prefs.keyboard_leds[0] || + currprefs.keyboard_leds[1] != changed_prefs.keyboard_leds[1] || + currprefs.keyboard_leds[2] != changed_prefs.keyboard_leds[2] || + currprefs.input_mouse_untrap != changed_prefs.input_mouse_untrap || + currprefs.active_capture_priority != changed_prefs.active_capture_priority || + currprefs.inactive_priority != changed_prefs.inactive_priority || + currprefs.active_nocapture_nosound != changed_prefs.active_nocapture_nosound || + currprefs.active_nocapture_pause != changed_prefs.active_nocapture_pause || + currprefs.inactive_nosound != changed_prefs.inactive_nosound || + currprefs.inactive_pause != changed_prefs.inactive_pause || + currprefs.inactive_input != changed_prefs.inactive_input) + { + currprefs.leds_on_screen = changed_prefs.leds_on_screen; + currprefs.keyboard_leds[0] = changed_prefs.keyboard_leds[0]; + currprefs.keyboard_leds[1] = changed_prefs.keyboard_leds[1]; + currprefs.keyboard_leds[2] = changed_prefs.keyboard_leds[2]; + currprefs.input_mouse_untrap = changed_prefs.input_mouse_untrap; + currprefs.active_capture_priority = changed_prefs.active_capture_priority; + currprefs.inactive_priority = changed_prefs.inactive_priority; + currprefs.active_nocapture_nosound = changed_prefs.active_nocapture_nosound; + currprefs.active_nocapture_pause = changed_prefs.active_nocapture_pause; + currprefs.inactive_nosound = changed_prefs.inactive_nosound; + currprefs.inactive_pause = changed_prefs.inactive_pause; + currprefs.inactive_input = changed_prefs.inactive_input; + inputdevice_unacquire(); + pause_sound(); + resume_sound(); + inputdevice_acquire(TRUE); + setpriority(currprefs.active_capture_priority); + return 1; + } - if (changed) - init_custom(); - - return changed; + return 0; } diff --git a/src/osdep/gui/Navigation.cpp b/src/osdep/gui/Navigation.cpp index 37abbacd..062d0d28 100644 --- a/src/osdep/gui/Navigation.cpp +++ b/src/osdep/gui/Navigation.cpp @@ -37,13 +37,14 @@ static NavigationMap navMap[] = {"Custom controls", "Right Trigger", "0: Mouse", "Input", "Miscellaneous"}, {"Miscellaneous", "chkStatusLineNative", "chkStatusLineNative", "Custom controls", "Savestates"}, #ifdef ANDROID -{ "Savestates", "State0", "State0", "Miscellaneous", "OnScreen" }, -{ "OnScreen", "OnScrButton3", "OnScrCtrl", "Savestates", "Shutdown" }, -{ "Quit", "Start", "Help", "OnScreen", "Paths" }, -{ "Help", "Quit", "Start", "OnScreen", "Paths" }, -{ "Start", "Help", "Quit", "OnScreen", "Paths" }, + { "Savestates", "State0", "State0", "Miscellaneous", "OnScreen" }, + { "OnScreen", "OnScrButton3", "OnScrCtrl", "Savestates", "Shutdown" }, + { "Quit", "Start", "Help", "OnScreen", "Paths" }, + { "Help", "Quit", "Start", "OnScreen", "Paths" }, + { "Start", "Help", "Quit", "OnScreen", "Paths" }, #else - {"Savestates", "State0", "State0", "Miscellaneous", "Shutdown"}, + {"Priority", "cboInactiveRunAtPrio", "cboActiveRunAtPrio", "Miscellaneous", "Savestates" }, + {"Savestates", "State0", "State0", "Priority", "Shutdown"}, {"Shutdown", "Start", "Quit", "Savestates", "Paths"}, {"Quit", "Shutdown", "Restart", "Savestates", "Paths"}, {"Restart", "Quit", "Help", "Savestates", "Paths"}, @@ -314,6 +315,15 @@ static NavigationMap navMap[] = {"KeyActionReplay", "Miscellaneous", "KeyFullScreen", "OpenGUI", "StatusLine"}, {"KeyFullScreen", "KeyActionReplay", "KeyActionReplay", "KeyForQuit", "RetroArchQuit"}, + // PanelPrio + { "cboActiveRunAtPrio", "Priority", "cboInactiveRunAtPrio", "chkActiveDisableSound", "chkActivePauseEmulation" }, + { "chkActivePauseEmulation", "Priority", "chkInactivePauseEmulation", "cboActiveRunAtPrio", "chkActiveDisableSound" }, + { "chkActiveDisableSound", "Priority", "chkInactiveDisableSound", "chkActivePauseEmulation", "cboActiveRunAtPrio" }, + { "cboInactiveRunAtPrio", "cboActiveRunAtPrio", "Priority", "chkInactiveDisableControllers", "chkInactivePauseEmulation" }, + { "chkInactivePauseEmulation", "chkActivePauseEmulation", "Priority", "cboInactiveRunAtPrio", "chkInactiveDisableSound" }, + { "chkInactiveDisableSound", "chkActiveDisableSound", "Priority", "chkInactivePauseEmulation", "chkInactiveDisableControllers" }, + { "chkInactiveDisableControllers", "chkActiveDisableSound", "Priority", "chkInactiveDisableSound", "cboInactiveRunAtPrio" }, + // PanelSavestate { "State0", "Savestates", "Savestates", "LoadState", "State1" }, { "State1", "Savestates", "Savestates", "State0", "State2" }, diff --git a/src/osdep/gui/PanelMisc.cpp b/src/osdep/gui/PanelMisc.cpp index 47f2c12a..c8e52c0f 100644 --- a/src/osdep/gui/PanelMisc.cpp +++ b/src/osdep/gui/PanelMisc.cpp @@ -62,7 +62,7 @@ public: std::string getElementAt(int i) override { - if (i < 0 || i >= values.size()) + if (i < 0 || i >= static_cast(values.size())) return "---"; return values[i]; } diff --git a/src/osdep/gui/PanelPrio.cpp b/src/osdep/gui/PanelPrio.cpp new file mode 100644 index 00000000..417b7bc2 --- /dev/null +++ b/src/osdep/gui/PanelPrio.cpp @@ -0,0 +1,241 @@ +#include + +#include +#include +#include "SelectorEntry.hpp" + +#include "sysdeps.h" +#include "options.h" +#include "gui_handling.h" + +static gcn::Window* grpWhenActive; +static gcn::Label* lblActiveRunAtPrio; +static gcn::DropDown* cboActiveRunAtPrio; +static gcn::Label* lblActiveMouseUncaptured; +static gcn::CheckBox* chkActivePauseEmulation; +static gcn::CheckBox* chkActiveDisableSound; + +static gcn::Window* grpWhenInactive; +static gcn::Label* lblInactiveRunAtPrio; +static gcn::DropDown* cboInactiveRunAtPrio; +static gcn::CheckBox* chkInactivePauseEmulation; +static gcn::CheckBox* chkInactiveDisableSound; +static gcn::CheckBox* chkInactiveDisableControllers; + +class StringListModel : public gcn::ListModel +{ + std::vector values; +public: + StringListModel(const char* entries[], const int count) + { + for (auto i = 0; i < count; ++i) + values.emplace_back(entries[i]); + } + + int getNumberOfElements() override + { + return values.size(); + } + + std::string getElementAt(int i) override + { + if (i < 0 || i >= static_cast(values.size())) + return "---"; + return values[i]; + } +}; + +static const char* prio_values[] = { "Low", "Normal", "High" }; +static StringListModel prio_values_list(prio_values, 3); + +class PrioActionListener : public gcn::ActionListener +{ +public: + void action(const gcn::ActionEvent& action_event) override + { + if (action_event.getSource() == cboActiveRunAtPrio) + { + if (cboActiveRunAtPrio->getSelected() == 0) + { + // Low prio + changed_prefs.active_capture_priority = 0; + } + else if (cboActiveRunAtPrio->getSelected() == 1) + { + // Normal prio + changed_prefs.active_capture_priority = 1; + } + else if (cboActiveRunAtPrio->getSelected() == 2) + { + //High prio + changed_prefs.active_capture_priority = 2; + } + } + + else if (action_event.getSource() == chkActivePauseEmulation) + { + // set pause emulation + changed_prefs.active_nocapture_pause = chkActivePauseEmulation->isSelected(); + } + else if (action_event.getSource() == chkActiveDisableSound) + { + // set disable sound + changed_prefs.active_nocapture_nosound = chkActiveDisableSound->isSelected(); + } + + else if (action_event.getSource() == cboInactiveRunAtPrio) + { + if (cboInactiveRunAtPrio->getSelected() == 0) + { + // Low Prio + changed_prefs.inactive_priority = 0; + } + else if (cboInactiveRunAtPrio->getSelected() == 1) + { + // Normal prio + changed_prefs.inactive_priority = 1; + } + else if (cboInactiveRunAtPrio->getSelected() == 2) + { + // High prio + changed_prefs.inactive_priority = 2; + } + } + else if (action_event.getSource() == chkInactivePauseEmulation) + { + // set inactive pause emulation + changed_prefs.inactive_pause = chkInactivePauseEmulation->isSelected(); + } + else if (action_event.getSource() == chkInactiveDisableSound) + { + // set inactive disable sound + changed_prefs.inactive_nosound = chkInactiveDisableSound->isSelected(); + } + else if (action_event.getSource() == chkInactiveDisableControllers) + { + // set inactive disable controllers + changed_prefs.inactive_input = chkInactiveDisableControllers->isSelected() ? 0 : 4; + } + + RefreshPanelPrio(); + } +}; + +PrioActionListener* prioActionListener; + +void InitPanelPrio(const struct _ConfigCategory& category) +{ + prioActionListener = new PrioActionListener(); + + auto posY = DISTANCE_BORDER; + + lblActiveRunAtPrio = new gcn::Label("Run at priority:"); + lblActiveRunAtPrio->setAlignment(gcn::Graphics::CENTER); + cboActiveRunAtPrio = new gcn::DropDown(&prio_values_list); + cboActiveRunAtPrio->setSize(150, cboActiveRunAtPrio->getHeight()); + cboActiveRunAtPrio->setBaseColor(gui_baseCol); + cboActiveRunAtPrio->setBackgroundColor(colTextboxBackground); + cboActiveRunAtPrio->setId("cboActiveRunAtPrio"); + cboActiveRunAtPrio->addActionListener(prioActionListener); + + lblActiveMouseUncaptured = new gcn::Label("Mouse uncaptured:"); + lblActiveMouseUncaptured->setAlignment(gcn::Graphics::CENTER); + + chkActivePauseEmulation = new gcn::CheckBox("Pause emulation"); + chkActivePauseEmulation->setId("chkActivePauseEmulation"); + chkActivePauseEmulation->addActionListener(prioActionListener); + + chkActiveDisableSound = new gcn::CheckBox("Disable sound"); + chkActiveDisableSound->setId("chkActiveDisableSound"); + chkActiveDisableSound->addActionListener(prioActionListener); + + grpWhenActive = new gcn::Window("When Active"); + grpWhenActive->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); + grpWhenActive->add(lblActiveRunAtPrio, DISTANCE_BORDER, posY); + posY += lblActiveRunAtPrio->getHeight() + DISTANCE_NEXT_Y; + grpWhenActive->add(cboActiveRunAtPrio, DISTANCE_BORDER, posY); + posY += cboActiveRunAtPrio->getHeight() + DISTANCE_NEXT_Y; + grpWhenActive->add(lblActiveMouseUncaptured, DISTANCE_BORDER, posY); + posY += lblActiveMouseUncaptured->getHeight() + DISTANCE_NEXT_Y; + grpWhenActive->add(chkActivePauseEmulation, DISTANCE_BORDER, posY); + posY += chkActivePauseEmulation->getHeight() + DISTANCE_NEXT_Y; + grpWhenActive->add(chkActiveDisableSound, DISTANCE_BORDER, posY); + grpWhenActive->setMovable(false); + grpWhenActive->setSize(cboActiveRunAtPrio->getWidth() + DISTANCE_BORDER * 2, TITLEBAR_HEIGHT + chkActiveDisableSound->getY() + chkActiveDisableSound->getHeight() + DISTANCE_NEXT_Y * 3); + grpWhenActive->setBaseColor(gui_baseCol); + category.panel->add(grpWhenActive); + + lblInactiveRunAtPrio = new gcn::Label("Run at priority:"); + lblInactiveRunAtPrio->setAlignment(gcn::Graphics::CENTER); + cboInactiveRunAtPrio = new gcn::DropDown(&prio_values_list); + cboInactiveRunAtPrio->setSize(150, cboInactiveRunAtPrio->getHeight()); + cboInactiveRunAtPrio->setBaseColor(gui_baseCol); + cboInactiveRunAtPrio->setBackgroundColor(colTextboxBackground); + cboInactiveRunAtPrio->setId("cboInactiveRunAtPrio"); + cboInactiveRunAtPrio->addActionListener(prioActionListener); + + chkInactivePauseEmulation = new gcn::CheckBox("Pause emulation"); + chkInactivePauseEmulation->setId("chkInactivePauseEmulation"); + chkInactivePauseEmulation->addActionListener(prioActionListener); + + chkInactiveDisableSound = new gcn::CheckBox("Disable sound"); + chkInactiveDisableSound->setId("chkInactiveDisableSound"); + chkInactiveDisableSound->addActionListener(prioActionListener); + + chkInactiveDisableControllers = new gcn::CheckBox("Disable game controllers"); + chkInactiveDisableControllers->setId("chkInactiveDisableControllers"); + chkInactiveDisableControllers->addActionListener(prioActionListener); + + grpWhenInactive = new gcn::Window("When Inactive"); + grpWhenInactive->setPosition(grpWhenActive->getX() + grpWhenActive->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER); + grpWhenInactive->add(lblInactiveRunAtPrio, DISTANCE_BORDER, DISTANCE_BORDER); + grpWhenInactive->add(cboInactiveRunAtPrio, DISTANCE_BORDER, cboActiveRunAtPrio->getY()); + grpWhenInactive->add(chkInactivePauseEmulation, DISTANCE_BORDER, chkActivePauseEmulation->getY()); + grpWhenInactive->add(chkInactiveDisableSound, DISTANCE_BORDER, chkActiveDisableSound->getY()); + posY += chkInactiveDisableSound->getHeight() + DISTANCE_NEXT_Y; + grpWhenInactive->add(chkInactiveDisableControllers, DISTANCE_BORDER, posY); + grpWhenInactive->setMovable(false); + grpWhenInactive->setSize(chkInactiveDisableControllers->getWidth() + DISTANCE_BORDER * 2, grpWhenActive->getHeight()); + grpWhenInactive->setBaseColor(gui_baseCol); + category.panel->add(grpWhenInactive); + + RefreshPanelPrio(); +} + +void ExitPanelPrio() +{ + delete lblActiveRunAtPrio; + delete cboActiveRunAtPrio; + delete lblActiveMouseUncaptured; + delete chkActivePauseEmulation; + delete chkActiveDisableSound; + delete grpWhenActive; + + delete lblInactiveRunAtPrio; + delete cboInactiveRunAtPrio; + delete chkInactivePauseEmulation; + delete chkInactiveDisableSound; + delete chkInactiveDisableControllers; + delete grpWhenInactive; + + delete prioActionListener; +} + +void RefreshPanelPrio() +{ + cboActiveRunAtPrio->setSelected(changed_prefs.active_capture_priority); + chkActivePauseEmulation->setSelected(changed_prefs.active_nocapture_pause); + chkActiveDisableSound->setSelected(changed_prefs.active_nocapture_nosound); + + cboInactiveRunAtPrio->setSelected(changed_prefs.inactive_priority); + chkInactivePauseEmulation->setSelected(changed_prefs.inactive_pause); + chkInactiveDisableSound->setSelected(changed_prefs.inactive_nosound); + chkInactiveDisableControllers->setSelected(changed_prefs.inactive_input == 0); +} + +bool HelpPanelPrio(std::vector& helptext) +{ + helptext.clear(); + //todo + return true; +} \ No newline at end of file diff --git a/src/osdep/gui/gui_handling.h b/src/osdep/gui/gui_handling.h index fa33a719..1e6b3a07 100644 --- a/src/osdep/gui/gui_handling.h +++ b/src/osdep/gui/gui_handling.h @@ -130,6 +130,11 @@ void ExitPanelMisc(void); void RefreshPanelMisc(void); bool HelpPanelMisc(std::vector& helptext); +void InitPanelPrio(const struct _ConfigCategory& category); +void ExitPanelPrio(void); +void RefreshPanelPrio(void); +bool HelpPanelPrio(std::vector& helptext); + void InitPanelSavestate(const struct _ConfigCategory& category); void ExitPanelSavestate(void); void RefreshPanelSavestate(void); diff --git a/src/osdep/gui/main_window.cpp b/src/osdep/gui/main_window.cpp index d1510694..2618245e 100644 --- a/src/osdep/gui/main_window.cpp +++ b/src/osdep/gui/main_window.cpp @@ -81,6 +81,7 @@ ConfigCategory categories[] = { RefreshPanelCustom, HelpPanelCustom }, {"Miscellaneous", "data/misc.ico", nullptr, nullptr, InitPanelMisc, ExitPanelMisc, RefreshPanelMisc, HelpPanelMisc}, + { "Priority", "data/misc.ico", nullptr, nullptr, InitPanelPrio, ExitPanelPrio, RefreshPanelPrio, HelpPanelPrio}, { "Savestates", "data/savestate.png", nullptr, nullptr, InitPanelSavestate, ExitPanelSavestate, RefreshPanelSavestate, HelpPanelSavestate diff --git a/src/osdep/target.h b/src/osdep/target.h index 1f15ff9f..449f85b1 100644 --- a/src/osdep/target.h +++ b/src/osdep/target.h @@ -22,8 +22,8 @@ #define GETBDM(x) (((x) - (((x) / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define AMIBERRYVERSION _T("Amiberry v3.2 beta (2020-07-30)") -#define AMIBERRYDATE MAKEBD(2020, 7, 30) +#define AMIBERRYVERSION _T("Amiberry v3.2 beta (2020-08-01)") +#define AMIBERRYDATE MAKEBD(2020, 8, 1) #define IHF_WINDOWHIDDEN 6 @@ -92,6 +92,7 @@ extern void ReadConfigFileList(void); extern void RescanROMs(void); extern void SymlinkROMs(void); extern void ClearAvailableROMList(void); +extern void setpriority(int prio); #include #include