Consoles: Fix after exiting splitscreen mode, then starting singleplayer/multiplayer mode, the game still acted as if it was in splitscreen mode

This commit is contained in:
UnknownShadow200 2024-08-17 16:02:09 +10:00
parent 7fc0906751
commit 7881d05646
3 changed files with 11 additions and 9 deletions

View file

@ -508,7 +508,7 @@ static void DirectConnectScreen_StartClient(void* w) {
Options_ResumeSaving(); Options_ResumeSaving();
LLabel_SetConst(status, ""); LLabel_SetConst(status, "");
Launcher_StartGame(user, mppass, &ip, &port, &String_Empty); Launcher_StartGame(user, mppass, &ip, &port, &String_Empty, 1);
} }
static void DirectConnectScreen_Activated(struct LScreen* s_) { static void DirectConnectScreen_Activated(struct LScreen* s_) {
@ -650,9 +650,7 @@ LAYOUTS sps_btnBack[] = { { ANCHOR_CENTRE, 0 }, { ANCHOR_CENTRE, 170 } };
static void SplitScreen_Start(int players) { static void SplitScreen_Start(int players) {
static const cc_string user = String_FromConst(DEFAULT_USERNAME); static const cc_string user = String_FromConst(DEFAULT_USERNAME);
Game_NumStates = players; Launcher_StartGame(&user, &String_Empty, &String_Empty, &String_Empty, &String_Empty, players);
Launcher_StartGame(&user, &String_Empty, &String_Empty, &String_Empty, &String_Empty);
} }
static void SplitScreen_Players2(void* w) { SplitScreen_Start(2); } static void SplitScreen_Players2(void* w) { SplitScreen_Start(2); }
@ -794,7 +792,7 @@ static void MainScreen_Resume(void* w) {
MainScreen_GetResume(&info, true); MainScreen_GetResume(&info, true);
if (!info.valid) return; if (!info.valid) return;
Launcher_StartGame(&info.user, &info.mppass, &info.ip, &info.port, &info.server); Launcher_StartGame(&info.user, &info.mppass, &info.ip, &info.port, &info.server, 1);
} }
static void MainScreen_Singleplayer(void* w) { static void MainScreen_Singleplayer(void* w) {
@ -802,7 +800,7 @@ static void MainScreen_Singleplayer(void* w) {
const cc_string* user = &MainScreen.iptUsername.text; const cc_string* user = &MainScreen.iptUsername.text;
if (!user->length) user = &defUser; if (!user->length) user = &defUser;
Launcher_StartGame(user, &String_Empty, &String_Empty, &String_Empty, &String_Empty); Launcher_StartGame(user, &String_Empty, &String_Empty, &String_Empty, &String_Empty, 1);
} }
static void MainScreen_ResumeHover(void* w) { static void MainScreen_ResumeHover(void* w) {

View file

@ -78,7 +78,7 @@ void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_s
*--------------------------------------------------------Starter/Updater--------------------------------------------------* *--------------------------------------------------------Starter/Updater--------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static cc_uint64 lastJoin; static cc_uint64 lastJoin;
cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server) { cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server, int numStates) {
cc_string args[4]; int numArgs; cc_string args[4]; int numArgs;
cc_uint64 now; cc_uint64 now;
cc_result res; cc_result res;
@ -110,6 +110,10 @@ cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const
numArgs = 4; numArgs = 4;
} }
#ifdef CC_BUILD_SPLITSCREEN
Game_NumStates = numStates;
#endif
res = Process_StartGame2(args, numArgs); res = Process_StartGame2(args, numArgs);
if (res) { Logger_SysWarn(res, "starting game"); return false; } if (res) { Logger_SysWarn(res, "starting game"); return false; }
@ -123,7 +127,7 @@ CC_NOINLINE static void StartFromInfo(struct ServerInfo* info) {
String_InitArray(port, portBuffer); String_InitArray(port, portBuffer);
String_AppendInt(&port, info->port); String_AppendInt(&port, info->port);
Launcher_StartGame(&Launcher_Username, &info->mppass, &info->ip, &port, &info->name); Launcher_StartGame(&Launcher_Username, &info->mppass, &info->ip, &port, &info->name, 1);
} }
static void ConnectToServerError(struct HttpRequest* req) { static void ConnectToServerError(struct HttpRequest* req) {

View file

@ -76,7 +76,7 @@ cc_bool Launcher_ConnectToServer(const cc_string* hash);
/* Launcher main loop. */ /* Launcher main loop. */
void Launcher_Run(void); void Launcher_Run(void);
/* Starts the game from the given arguments. */ /* Starts the game from the given arguments. */
cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server); cc_bool Launcher_StartGame(const cc_string* user, const cc_string* mppass, const cc_string* ip, const cc_string* port, const cc_string* server, int numStates);
/* Prints information about a http error to dst. (for status widget) */ /* Prints information about a http error to dst. (for status widget) */
/* If req->result is non-zero, also displays a dialog box on-screen. */ /* If req->result is non-zero, also displays a dialog box on-screen. */
void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_string* dst); void Launcher_DisplayHttpError(struct HttpRequest* req, const char* action, cc_string* dst);