Skip to content

Commit

Permalink
#730: Added new WHDLoad option: CONFIGDELAY
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Feb 4, 2021
1 parent 1d08cf7 commit 7b6520e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/cfgfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
cfgfile_write_str(f, _T("whdload_slave"), p->whdbootprefs.slave);
cfgfile_write_bool(f, _T("whdload_showsplash"), p->whdbootprefs.showsplash);
cfgfile_write_bool(f, _T("whdload_buttonwait"), p->whdbootprefs.buttonwait);
cfgfile_dwrite(f, _T("whdload_configdelay"), _T("%d"), p->whdbootprefs.configdelay);
cfgfile_write(f, _T("whdload_custom1"), _T("%d"), p->whdbootprefs.custom1);
cfgfile_write(f, _T("whdload_custom2"), _T("%d"), p->whdbootprefs.custom2);
cfgfile_write(f, _T("whdload_custom3"), _T("%d"), p->whdbootprefs.custom3);
Expand Down Expand Up @@ -3249,6 +3250,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
|| cfgfile_intval(option, value, _T("whdload_custom5"), &p->whdbootprefs.custom5, 1)
|| cfgfile_yesno(option, value, _T("whdload_buttonwait"), &p->whdbootprefs.buttonwait)
|| cfgfile_yesno(option, value, _T("whdload_showsplash"), &p->whdbootprefs.showsplash)
|| cfgfile_intval(option, value, _T("whdload_configdelay"), &p->whdbootprefs.configdelay, 1)
)
{
return 1;
Expand Down
10 changes: 6 additions & 4 deletions src/include/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,11 @@ struct whdbooter
int custom3 = 0;
int custom4 = 0;
int custom5 = 0;
TCHAR custom[256];
bool buttonwait;
TCHAR slave[4096];
bool showsplash;
TCHAR custom[256]{};
bool buttonwait{};
TCHAR slave[4096]{};
bool showsplash{};
int configdelay = 0;
};
#endif

Expand Down Expand Up @@ -1133,6 +1134,7 @@ struct amiberry_options
char default_mouse2[128] = "joy0";
bool default_whd_buttonwait = false;
bool default_whd_showsplash = true;
int default_whd_configdelay = 0;
};

extern struct amiberry_options amiberry_options;
Expand Down
6 changes: 6 additions & 0 deletions src/osdep/amiberry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,6 +1924,7 @@ void target_default_options(struct uae_prefs* p, int type)

p->whdbootprefs.buttonwait = amiberry_options.default_whd_buttonwait;
p->whdbootprefs.showsplash = amiberry_options.default_whd_showsplash;
p->whdbootprefs.configdelay = amiberry_options.default_whd_configdelay;
}

static const TCHAR* scsimode[] = { _T("SCSIEMU"), _T("SPTI"), _T("SPTI+SCSISCAN"), NULL };
Expand Down Expand Up @@ -2557,6 +2558,10 @@ void save_amiberry_settings(void)
// WHDLoad Show Splash screen
snprintf(buffer, MAX_DPATH, "default_whd_showsplash=%s\n", amiberry_options.default_whd_showsplash ? "yes" : "no");
fputs(buffer, f);

// WHDLoad Config Delay
snprintf(buffer, MAX_DPATH, "default_whd_configdelay=%d\n", amiberry_options.default_whd_configdelay);
fputs(buffer, f);

// Paths
snprintf(buffer, MAX_DPATH, "path=%s\n", current_dir);
Expand Down Expand Up @@ -2778,6 +2783,7 @@ void load_amiberry_settings(void)
cfgfile_string(option, value, "default_mouse2", amiberry_options.default_mouse2, sizeof amiberry_options.default_mouse2);
cfgfile_yesno(option, value, "default_whd_buttonwait", &amiberry_options.default_whd_buttonwait);
cfgfile_yesno(option, value, "default_whd_showsplash", &amiberry_options.default_whd_showsplash);
cfgfile_intval(option, value, "default_whd_configdelay", &amiberry_options.default_whd_configdelay, 1);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/osdep/amiberry_whdbooter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,12 @@ void whdload_auto_prefs(struct uae_prefs* prefs, char* filepath)
whd_bootscript << " SPLASHDELAY=0";
}

// CONFIGDELAY
if (currprefs.whdbootprefs.configdelay != 0)
{
whd_bootscript << " CONFIGDELAY=" << currprefs.whdbootprefs.configdelay;
}

// SPECIAL SAVE PATH
whd_bootscript << " SAVEPATH=Saves:Savegames/ SAVEDIR=\"" << subpath << "\"";
whd_bootscript << '\n';
Expand Down

0 comments on commit 7b6520e

Please sign in to comment.