Made Allow Host-Run an option

This commit is contained in:
Dimitris Panokostas 2020-07-06 01:59:49 +02:00
parent 79e1f22791
commit b6af6a986a
5 changed files with 28 additions and 5 deletions

View file

@ -922,6 +922,7 @@ struct uae_prefs
int input_device_match_mask;
#ifdef AMIBERRY
bool allow_host_run;
bool input_analog_remap;
bool use_retroarch_quit;
bool use_retroarch_menu;

View file

@ -457,6 +457,8 @@ void target_default_options(struct uae_prefs* p, int type)
_tcscpy(p->action_replay, amiberry_options.default_ar_key);
_tcscpy(p->fullscreen_toggle, amiberry_options.default_fullscreen_toggle_key);
p->allow_host_run = false;
p->input_analog_remap = false;
p->use_retroarch_quit = amiberry_options.default_retroarch_quit;
@ -527,6 +529,7 @@ void target_save_options(struct zfile* f, struct uae_prefs* p)
cfgfile_dwrite_str(f, _T("amiberry.quit_amiberry"), p->quit_amiberry);
cfgfile_dwrite_str(f, _T("amiberry.action_replay"), p->action_replay);
cfgfile_dwrite_str(f, _T("amiberry.fullscreen_toggle"), p->fullscreen_toggle);
cfgfile_write_bool(f, _T("amiberry.allow_host_run"), p->allow_host_run);
cfgfile_write_bool(f, _T("amiberry.use_analogue_remap"), p->input_analog_remap);
cfgfile_write_bool(f, _T("amiberry.use_retroarch_quit"), p->use_retroarch_quit);
@ -616,7 +619,8 @@ int target_parse_option(struct uae_prefs* p, const char* option, const char* val
if (result)
return 1;
#endif
if (cfgfile_yesno(option, value, _T("allow_host_run"), &p->allow_host_run))
return 1;
if (cfgfile_yesno(option, value, _T("use_retroarch_quit"), &p->use_retroarch_quit))
return 1;
if (cfgfile_yesno(option, value, _T("use_retroarch_menu"), &p->use_retroarch_menu))

View file

@ -288,8 +288,10 @@ static NavigationMap navMap[] =
{"RetroArchReset", "chkMouseUntrap", "Miscellaneous", "RetroArchMenu", "BSDSocket"},
{"BSDSocket", "Miscellaneous", "Miscellaneous", "chkMouseUntrap", "MasterWP"},
{"MasterWP", "Miscellaneous", "Miscellaneous", "BSDSocket", "cboNumlock"},
{"cboNumlock", "Miscellaneous", "cboScrolllock", "MasterWP", "OpenGUI"},
{"MasterWP", "Miscellaneous", "Miscellaneous", "BSDSocket", "chkClipboardSharing"},
{"chkClipboardSharing", "Miscellaneous", "Miscellaneous", "MasterWP", "chkAllowHostRun"},
{"chkAllowHostRun", "Miscellaneous", "Miscellaneous", "chkClipboardSharing", "cboNumlock"},
{"cboNumlock", "Miscellaneous", "cboScrolllock", "chkAllowHostRun", "OpenGUI"},
{"cboScrolllock", "cboNumlock", "Miscellaneous", "MasterWP", "KeyForQuit"},
{"OpenGUI", "Miscellaneous", "KeyForQuit", "cboNumlock", "KeyActionReplay"},
{"KeyForQuit", "OpenGUI", "Miscellaneous", "cboScrolllock", "KeyFullScreen"},

View file

@ -20,6 +20,7 @@ static gcn::CheckBox* chkMouseUntrap;
static gcn::CheckBox* chkBSDSocket;
static gcn::CheckBox* chkMasterWP;
static gcn::CheckBox* chkClipboardSharing;
static gcn::CheckBox* chkAllowHostRun;
static gcn::Label* lblNumLock;
static gcn::DropDown* cboKBDLed_num;
@ -115,6 +116,9 @@ public:
else if (actionEvent.getSource() == chkClipboardSharing)
changed_prefs.clipboard_sharing = chkClipboardSharing->isSelected();
else if (actionEvent.getSource() == chkAllowHostRun)
changed_prefs.clipboard_sharing = chkAllowHostRun->isSelected();
else if (actionEvent.getSource() == cboKBDLed_num)
changed_prefs.kbd_led_num = cboKBDLed_num->getSelected() - 1;
@ -210,6 +214,10 @@ void InitPanelMisc(const struct _ConfigCategory& category)
chkClipboardSharing = new gcn::CheckBox("Clipboard sharing");
chkClipboardSharing->setId("chkClipboardSharing");
chkClipboardSharing->addActionListener(miscActionListener);
chkAllowHostRun = new gcn::CheckBox("Allow host-run");
chkAllowHostRun->setId("chkAllowHostRun");
chkAllowHostRun->addActionListener(miscActionListener);
lblNumLock = new gcn::Label("NumLock:");
lblNumLock->setAlignment(gcn::Graphics::RIGHT);
@ -297,7 +305,9 @@ void InitPanelMisc(const struct _ConfigCategory& category)
category.panel->add(chkMasterWP, DISTANCE_BORDER, posY);
posY += chkMasterWP->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkClipboardSharing, DISTANCE_BORDER, posY);
posY += chkClipboardSharing->getHeight() + DISTANCE_NEXT_Y * 2;
posY += chkClipboardSharing->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkAllowHostRun, DISTANCE_BORDER, posY);
posY += chkAllowHostRun->getHeight() + DISTANCE_NEXT_Y * 2;
const auto column2_x = DISTANCE_BORDER + 290;
@ -344,6 +354,7 @@ void ExitPanelMisc()
delete chkBSDSocket;
delete chkMasterWP;
delete chkClipboardSharing;
delete chkAllowHostRun;
delete lblScrLock;
delete lblNumLock;
@ -384,6 +395,7 @@ void RefreshPanelMisc()
chkBSDSocket->setSelected(changed_prefs.socket_emu);
chkMasterWP->setSelected(changed_prefs.floppy_read_only);
chkClipboardSharing->setSelected(changed_prefs.clipboard_sharing);
chkAllowHostRun->setSelected(changed_prefs.allow_host_run);
cboKBDLed_num->setSelected(changed_prefs.kbd_led_num + 1);
cboKBDLed_scr->setSelected(changed_prefs.kbd_led_scr + 1);

View file

@ -424,7 +424,11 @@ static uae_u32 uaelib_demux_common(TrapContext* ctx, uae_u32 ARG0, uae_u32 ARG1,
trap_set_dreg(ctx, 1, d1);
return d0;
}
case 88: return emulib_run_on_host(ctx, ARG1);
case 88:
if (currprefs.allow_host_run)
return emulib_run_on_host(ctx, ARG1);
return 0;
case 89: return emulib_host_session(ctx, ARG1, ARG2, ARG3);
}
return 0;