Implemented Priority handling
This commit is contained in:
parent
fd91c9e281
commit
9047d33e0b
13 changed files with 439 additions and 39 deletions
|
@ -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
|
||||
|
|
1
Makefile
1
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
|
||||
|
|
|
@ -281,6 +281,7 @@
|
|||
<ClCompile Include="..\..\src\osdep\gui\PanelInput.cpp" />
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelMisc.cpp" />
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelPaths.cpp" />
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelPrio.cpp" />
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelQuickstart.cpp" />
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelRAM.cpp" />
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelROM.cpp" />
|
||||
|
|
|
@ -640,6 +640,9 @@
|
|||
<ClCompile Include="..\..\src\tabletlibrary.cpp">
|
||||
<Filter>Source files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\osdep\gui\PanelPrio.cpp">
|
||||
<Filter>Source files\osdep\gui</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\threaddep\thread.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];
|
||||
|
|
|
@ -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();
|
||||
if (currprefs.active_nocapture_pause)
|
||||
{
|
||||
setpaused(2);
|
||||
sound_closed = 1;
|
||||
}
|
||||
else if (currprefs.active_nocapture_nosound)
|
||||
{
|
||||
setsoundpaused();
|
||||
sound_closed = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
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();
|
||||
setpaused(2);
|
||||
sound_closed = -1;
|
||||
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,14 +1622,22 @@ static void setmouseactive2(int active, bool allowpause)
|
|||
|
||||
if (active) {
|
||||
inputdevice_acquire(TRUE);
|
||||
setpriority(currprefs.active_capture_priority);
|
||||
if (currprefs.active_nocapture_pause)
|
||||
resumepaused(2);
|
||||
if (sound_closed < 0)
|
||||
else if (currprefs.active_nocapture_nosound && sound_closed < 0)
|
||||
resumesoundpaused();
|
||||
}
|
||||
else {
|
||||
inputdevice_acquire(FALSE);
|
||||
inputdevice_releasebuttons();
|
||||
}
|
||||
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();
|
||||
|
|
|
@ -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 ||
|
||||
|
@ -985,29 +997,43 @@ 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 (changed)
|
||||
init_custom();
|
||||
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;
|
||||
}
|
||||
|
||||
return changed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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" },
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
std::string getElementAt(int i) override
|
||||
{
|
||||
if (i < 0 || i >= values.size())
|
||||
if (i < 0 || i >= static_cast<int>(values.size()))
|
||||
return "---";
|
||||
return values[i];
|
||||
}
|
||||
|
|
241
src/osdep/gui/PanelPrio.cpp
Normal file
241
src/osdep/gui/PanelPrio.cpp
Normal file
|
@ -0,0 +1,241 @@
|
|||
#include <cstring>
|
||||
|
||||
#include <guisan.hpp>
|
||||
#include <guisan/sdl.hpp>
|
||||
#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<std::string> 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<int>(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<std::string>& helptext)
|
||||
{
|
||||
helptext.clear();
|
||||
//todo
|
||||
return true;
|
||||
}
|
|
@ -130,6 +130,11 @@ void ExitPanelMisc(void);
|
|||
void RefreshPanelMisc(void);
|
||||
bool HelpPanelMisc(std::vector<std::string>& helptext);
|
||||
|
||||
void InitPanelPrio(const struct _ConfigCategory& category);
|
||||
void ExitPanelPrio(void);
|
||||
void RefreshPanelPrio(void);
|
||||
bool HelpPanelPrio(std::vector<std::string>& helptext);
|
||||
|
||||
void InitPanelSavestate(const struct _ConfigCategory& category);
|
||||
void ExitPanelSavestate(void);
|
||||
void RefreshPanelSavestate(void);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <vector>
|
||||
#include <string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue