mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Export Options_SaveIfChanged per request
Also try to hardcode a few options less
This commit is contained in:
parent
2159704a30
commit
169bdf50b6
@ -694,19 +694,19 @@ struct ResumeInfo {
|
||||
};
|
||||
|
||||
CC_NOINLINE static void MainScreen_GetResume(struct ResumeInfo* info, cc_bool full) {
|
||||
String_InitArray(info->server, info->_serverBuffer);
|
||||
Options_Get("launcher-server", &info->server, "");
|
||||
String_InitArray(info->user, info->_userBuffer);
|
||||
Options_Get("launcher-username", &info->user, "");
|
||||
String_InitArray(info->server, info->_serverBuffer);
|
||||
Options_Get(ROPT_SERVER, &info->server, "");
|
||||
String_InitArray(info->user, info->_userBuffer);
|
||||
Options_Get(ROPT_USER, &info->user, "");
|
||||
|
||||
String_InitArray(info->ip, info->_ipBuffer);
|
||||
Options_Get("launcher-ip", &info->ip, "");
|
||||
Options_Get(ROPT_IP, &info->ip, "");
|
||||
String_InitArray(info->port, info->_portBuffer);
|
||||
Options_Get("launcher-port", &info->port, "");
|
||||
Options_Get(ROPT_PORT, &info->port, "");
|
||||
|
||||
if (!full) return;
|
||||
String_InitArray(info->mppass, info->_mppassBuffer);
|
||||
Options_GetSecure("launcher-mppass", &info->mppass, &info->user);
|
||||
Options_GetSecure(ROPT_MPPASS, &info->mppass, &info->user);
|
||||
|
||||
info->valid =
|
||||
info->user.length && info->mppass.length &&
|
||||
@ -739,8 +739,8 @@ static void MainScreen_DoLogin(void) {
|
||||
}
|
||||
|
||||
if (GetTokenTask.Base.working) return;
|
||||
Options_Set("launcher-cc-username", user);
|
||||
Options_SetSecure("launcher-cc-password", pass, user);
|
||||
Options_Set(LOPT_USERNAME, user);
|
||||
Options_SetSecure(LOPT_PASSWORD, pass, user);
|
||||
|
||||
GetTokenTask_Run();
|
||||
LLabel_SetConst(&s->lblStatus, "&eSigning in..");
|
||||
@ -805,8 +805,8 @@ static void MainScreen_Init(struct LScreen* s_) {
|
||||
s->iptPassword.TextFilter = MainScreen_PasswordFilter;
|
||||
|
||||
String_InitArray(pass, passBuffer);
|
||||
Options_UNSAFE_Get("launcher-cc-username", &user);
|
||||
Options_GetSecure("launcher-cc-password", &pass, &user);
|
||||
Options_UNSAFE_Get(LOPT_USERNAME, &user);
|
||||
Options_GetSecure(LOPT_PASSWORD, &pass, &user);
|
||||
|
||||
LInput_SetText(&s->iptUsername, &user);
|
||||
LInput_SetText(&s->iptPassword, &pass);
|
||||
|
@ -96,11 +96,11 @@ cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const
|
||||
|
||||
/* Save resume info */
|
||||
if (server->length) {
|
||||
Options_Set("launcher-server", server);
|
||||
Options_Set("launcher-username", user);
|
||||
Options_Set("launcher-ip", ip);
|
||||
Options_Set("launcher-port", port);
|
||||
Options_SetSecure("launcher-mppass", mppass, user);
|
||||
Options_Set(ROPT_SERVER, server);
|
||||
Options_Set(ROPT_USER, user);
|
||||
Options_Set(ROPT_IP, ip);
|
||||
Options_Set(ROPT_PORT, port);
|
||||
Options_SetSecure(ROPT_MPPASS, mppass, user);
|
||||
}
|
||||
/* Save options BEFORE starting new game process */
|
||||
/* Otherwise can get 'file already in use' errors on startup */
|
||||
@ -299,7 +299,7 @@ void Launcher_Run(void) {
|
||||
Drawer2D_BlackTextShadows = true;
|
||||
InitFramebuffer();
|
||||
|
||||
Options_Get("launcher-cc-username", &Game_Username, "");
|
||||
Options_Get(LOPT_USERNAME, &Game_Username, "");
|
||||
Session_Load();
|
||||
Launcher_LoadSkin();
|
||||
Launcher_Init();
|
||||
|
@ -73,7 +73,15 @@
|
||||
#define OPT_TOUCH_SCALE "gui-touchscale"
|
||||
#define OPT_HTTP_ONLY "http-no-https"
|
||||
|
||||
#define LOPT_SESSION "launcher-session"
|
||||
#define LOPT_SESSION "launcher-session"
|
||||
#define LOPT_USERNAME "launcher-cc-username"
|
||||
#define LOPT_PASSWORD "launcher-cc-password"
|
||||
|
||||
#define ROPT_SERVER "launcher-server"
|
||||
#define ROPT_USER "launcher-username"
|
||||
#define ROPT_IP "launcher-ip"
|
||||
#define ROPT_PORT "launcher-port"
|
||||
#define ROPT_MPPASS "launcher-mppass"
|
||||
|
||||
struct StringsBuffer;
|
||||
extern struct StringsBuffer Options;
|
||||
@ -85,7 +93,7 @@ void Options_Load(void);
|
||||
/* Reloads options from disc, leaving options changed in this session alone. */
|
||||
CC_API void Options_Reload(void);
|
||||
/* Saves options to disc, if any were changed via Options_SetXYZ since last save. */
|
||||
void Options_SaveIfChanged(void);
|
||||
CC_API void Options_SaveIfChanged(void);
|
||||
|
||||
/* Sets value to value of option directly in Options.Buffer if found, String_Empty if not. */
|
||||
/* Returns whether the option was actually found. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user