WIP moving hostprefs options to amiberry_options

This commit is contained in:
Dimitris Panokostas 2020-06-09 16:06:44 +02:00
parent fd08eaee22
commit 4155877546
3 changed files with 35 additions and 59 deletions

View file

@ -1113,8 +1113,11 @@ struct amiberry_options
bool default_horizontal_centering = false;
bool default_vertical_centering = false;
int default_scaling_method = -1;
bool default_frameskip = false;
bool default_correct_aspect_ratio = true;
bool default_auto_height = false;
};
extern struct amiberry_options amiberry_options;
#endif

View file

@ -363,9 +363,17 @@ void target_default_options(struct uae_prefs* p, int type)
p->kbd_led_num = -1; // No status on numlock
p->kbd_led_scr = -1; // No status on scrollock
p->gfx_auto_height = false;
p->gfx_correct_aspect = 1; // Default is Enabled
p->gfx_auto_height = amiberry_options.default_auto_height;
p->gfx_correct_aspect = amiberry_options.default_correct_aspect_ratio;
p->scaling_method = -1; //Default is Auto
if (amiberry_options.default_scaling_method != -1)
{
// only valid values are -1 (Auto), 0 (Nearest) and 1 (Linear)
if (amiberry_options.default_scaling_method == 0 || amiberry_options.default_scaling_method == 1)
p->scaling_method = amiberry_options.default_scaling_method;
}
if (amiberry_options.default_line_mode == 1)
{
// Double line mode
@ -391,13 +399,9 @@ void target_default_options(struct uae_prefs* p, int type)
if (amiberry_options.default_vertical_centering)
p->gfx_ycenter = 2;
if (amiberry_options.default_scaling_method != -1)
{
// only valid values are -1 (Auto), 0 (Nearest) and 1 (Linear)
if (amiberry_options.default_scaling_method == 0 || amiberry_options.default_scaling_method == 1)
p->scaling_method = amiberry_options.default_scaling_method;
}
if (amiberry_options.default_frameskip)
p->gfx_framerate = 2;
#ifdef USE_RENDER_THREAD
amiberry_options.use_sdl2_render_thread = true;
#else
@ -923,7 +927,19 @@ void save_amiberry_settings(void)
// Valid options are: -1 Auto, 0 Nearest Neighbor, 1 Linear
snprintf(buffer, MAX_DPATH, "default_scaling_method=%d\n", amiberry_options.default_scaling_method);
fputs(buffer, f);
// Enable frameskip by default?
snprintf(buffer, MAX_DPATH, "default_frameskip=%s\n", amiberry_options.default_frameskip ? "yes" : "no");
fputs(buffer, f);
// Correct Aspect Ratio by default?
snprintf(buffer, MAX_DPATH, "default_correct_aspect_ratio=%s\n", amiberry_options.default_correct_aspect_ratio ? "yes" : "no");
fputs(buffer, f);
// Enable Auto-Height by default?
snprintf(buffer, MAX_DPATH, "default_auto_height=%s\n", amiberry_options.default_auto_height ? "yes" : "no");
fputs(buffer, f);
// Paths
snprintf(buffer, MAX_DPATH, "path=%s\n", currentDir);
fputs(buffer, f);
@ -1122,6 +1138,9 @@ void load_amiberry_settings(void)
cfgfile_yesno(option, value, "default_horizontal_centering", &amiberry_options.default_horizontal_centering);
cfgfile_yesno(option, value, "default_vertical_centering", &amiberry_options.default_vertical_centering);
cfgfile_intval(option, value, "default_scaling_method", &amiberry_options.default_scaling_method, 1);
cfgfile_yesno(option, value, "default_frameskip", &amiberry_options.default_frameskip);
cfgfile_yesno(option, value, "default_correct_aspect_ratio", &amiberry_options.default_correct_aspect_ratio);
cfgfile_yesno(option, value, "default_auto_height", &amiberry_options.default_auto_height);
}
}
}

View file

@ -64,15 +64,10 @@ struct host_options
TCHAR ra_quit[256] = "nul\0";
TCHAR ra_menu[256] = "nul\0";
TCHAR ra_reset[256] = "nul\0";
TCHAR key_quit[256] = "nul\0";
TCHAR key_gui[256] = "nul\0";
TCHAR deadzone[256] = "nul\0";
TCHAR stereo_split[256] = "nul\0";
TCHAR sound_on[256] = "nul\0";
TCHAR sound_mode[256] = "nul\0";
TCHAR frameskip[256] = "nul\0";
TCHAR aspect_ratio[256] = "nul\0";
TCHAR line_double[256] = "nul\0";
TCHAR fixed_height[256] = "nul\0";
TCHAR fixed_width[256] = "nul\0";
TCHAR fixed_cd32_height[256] = "nul\0";
@ -253,15 +248,10 @@ struct host_options get_host_settings(char* HW)
strcpy(output_detail.ra_quit, find_whdload_game_option("RETROARCH_QUIT", HW).c_str());
strcpy(output_detail.ra_menu, find_whdload_game_option("RETROARCH_MENU", HW).c_str());
strcpy(output_detail.ra_reset, find_whdload_game_option("RETROARCH_RESET", HW).c_str());
strcpy(output_detail.key_quit, find_whdload_game_option("KEY_FOR_QUIT", HW).c_str());
strcpy(output_detail.key_gui, find_whdload_game_option("KEY_FOR_MENU", HW).c_str());
strcpy(output_detail.deadzone, find_whdload_game_option("DEADZONE", HW).c_str());
strcpy(output_detail.stereo_split, find_whdload_game_option("STEREO_SPLIT", HW).c_str());
strcpy(output_detail.sound_on, find_whdload_game_option("SOUND_ON", HW).c_str());
strcpy(output_detail.sound_mode, find_whdload_game_option("SOUND_MODE", HW).c_str());
strcpy(output_detail.aspect_ratio, find_whdload_game_option("ASPECT_RATIO_FIX", HW).c_str());
strcpy(output_detail.frameskip, find_whdload_game_option("FRAMESKIP", HW).c_str());
strcpy(output_detail.line_double, find_whdload_game_option("LINE_DOUBLING", HW).c_str());
strcpy(output_detail.fixed_height, find_whdload_game_option("FIXED_HEIGHT", HW).c_str());
strcpy(output_detail.fixed_width, find_whdload_game_option("FIXED_WIDTH", HW).c_str());
strcpy(output_detail.fixed_cd32_height, find_whdload_game_option("FIXED_CD32_HEIGHT", HW).c_str());
@ -997,7 +987,7 @@ void whdload_auto_prefs(struct uae_prefs* prefs, char* filepath)
write_log("WHDBooter Option (Mouse Control): %s\n", txt2);
}
// PORT 0 - JOYSTICK GAMES
// PORT 0 - JOYSTICK GAMES
else if (!(strcmpi(host_detail.controller2, "nul") == 0))
{
_stprintf(txt2, "%s=%s", _T("joyport0"), _T(host_detail.controller2));
@ -1018,7 +1008,7 @@ void whdload_auto_prefs(struct uae_prefs* prefs, char* filepath)
cfgfile_parse_line(prefs, txt2, 0);
write_log("WHDBooter Option (Mouse Control): %s\n", txt2);
}
// PORT 1 - JOYSTICK GAMES
// PORT 1 - JOYSTICK GAMES
else if (!(strcmpi(host_detail.controller1, "nul") == 0))
{
_stprintf(txt2, "%s=%s", _T("joyport1"), _T(host_detail.controller1));
@ -1072,43 +1062,7 @@ void whdload_auto_prefs(struct uae_prefs* prefs, char* filepath)
_stprintf(txt2, "amiberry.use_retroarch_reset=%s", _T(host_detail.ra_reset));
cfgfile_parse_line(prefs, txt2, 0);
}
// KEYBOARD CONTROLS
if (!(strcmpi(host_detail.key_quit, "nul") == 0))
{
_stprintf(txt2, "amiberry.quit_amiberry=%s", _T(host_detail.key_quit));
cfgfile_parse_line(prefs, txt2, 0);
}
if (!(strcmpi(host_detail.key_gui, "nul") == 0))
{
_stprintf(txt2, "amiberry.open_gui=%s", _T(host_detail.key_gui));
cfgfile_parse_line(prefs, txt2, 0);
}
// GRAPHICS OPTIONS
if (!(strcmpi(host_detail.aspect_ratio, "nul") == 0))
{
_stprintf(txt2, "amiberry.gfx_correct_aspect=%s", _T(host_detail.aspect_ratio));
cfgfile_parse_line(prefs, txt2, 0);
}
if (strcmpi(host_detail.line_double, "yes") == 0 || strcmpi(host_detail.line_double, "true") == 0)
{
_stprintf(txt2, "gfx_linemode=double");
cfgfile_parse_line(prefs, txt2, 0);
}
else if (strcmpi(host_detail.line_double, "no") == 0 || strcmpi(host_detail.line_double, "false") == 0)
{
_stprintf(txt2, "gfx_linemode=none");
cfgfile_parse_line(prefs, txt2, 0);
}
if (!(strcmpi(host_detail.frameskip, "nul") == 0))
{
_stprintf(txt2, "gfx_framerate=%s", _T(host_detail.frameskip));
cfgfile_parse_line(prefs, txt2, 0);
}
// SOUND OPTIONS
if (strcmpi(host_detail.sound_on, "false") == 0 || strcmpi(host_detail.sound_on, "off") == 0 || strcmpi(
host_detail.sound_on, "none") == 0)