Added Disconnecting from the server when selecting new game and backing out of name select

This commit is contained in:
Jerom Venneker
2025-06-30 19:34:45 +02:00
parent 1fe3871f6c
commit 786b7481c4
5 changed files with 23 additions and 2 deletions

View File

@@ -206,6 +206,11 @@ bool ArchipelagoClient::StartClient() {
return true;
}
bool ArchipelagoClient::StopClient() {
disconnecting = true;
return true;
}
void ArchipelagoClient::GameLoaded() {
if(apClient == nullptr) {
return;
@@ -387,6 +392,7 @@ void ArchipelagoClient::Poll() {
apClient->reset();
apClient = nullptr;
disconnecting = false;
CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0); // disconnected
return;
}

View File

@@ -2169,6 +2169,10 @@ extern "C" void Archipelago_Connect() {
ArchipelagoClient::GetInstance().StartClient();
}
extern "C" void Archipelago_Disconnect() {
ArchipelagoClient::GetInstance().StopClient();
}
extern "C" void Archipelago_ShowArchipelagoMenu() {
SohGui::ShowArchipelagoSettingsMenu();
}

View File

@@ -157,6 +157,7 @@ void Randomizer_SetSpoilerLoaded(bool spoilerLoaded);
uint8_t Randomizer_GenerateRandomizer();
void Randomizer_ShowRandomizerMenu();
void Archipelago_Connect();
void Archipelago_Disconnect();
void Archipelago_ShowArchipelagoMenu();
int CustomMessage_RetrieveIfExists(PlayState* play);
void Overlay_DisplayText(float duration, const char* text);

View File

@@ -1699,6 +1699,8 @@ void FileChoose_RotateToMain(GameState* thisx) {
void FileChoose_RotateToQuest(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
Archipelago_Disconnect();
if (this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST ||
this->configMode == CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST ||
this->configMode == CM_ARCHIPELAGO_SETTINGS_TO_QUEST) {
@@ -1859,6 +1861,8 @@ void FileChoose_UpdateArchipelagoMenu(GameState* thisx) {
void FileChoose_StartArchipelagoMenu(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
Archipelago_Disconnect();
fileSelectArchipelagoLoaded = false;
this->logoAlpha -= 25;
this->archipelagoUIAlpha = 0;
@@ -3163,7 +3167,9 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
if (this->configMode != CM_NAME_ENTRY && this->configMode != CM_START_NAME_ENTRY &&
this->configMode != CM_QUEST_MENU && this->configMode != CM_NAME_ENTRY_TO_QUEST_MENU &&
this->configMode != CM_RANDOMIZER_SETTINGS_MENU &&
this->configMode != CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
this->configMode != CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU &&
this->configMode != CM_ARCHIPELAGO_SETTINGS_MENU &&
this->configMode != CM_NAME_ENTRY_TO_ARCHIPELAGO_SETTINGS_MENU) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
@@ -3273,7 +3279,9 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_ROTATE_TO_BOSS_RUSH_MENU ||
this->configMode == CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU ||
this->configMode == CM_ROTATE_TO_ARCHIPELAGO_MENU ||
this->configMode == CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
this->configMode == CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU ||
this->configMode == CM_ARCHIPELAGO_SETTINGS_MENU ||
this->configMode == CM_NAME_ENTRY_TO_ARCHIPELAGO_SETTINGS_MENU) {
// window
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);

View File

@@ -379,6 +379,8 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
this->configMode = CM_NAME_ENTRY_TO_QUEST_MENU;
} else if (this->prevConfigMode == CM_RANDOMIZER_SETTINGS_MENU) {
this->configMode = CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU;
} else if (this->prevConfigMode = CM_ARCHIPELAGO_SETTINGS_MENU) {
this->configMode = CM_NAME_ENTRY_TO_ARCHIPELAGO_SETTINGS_MENU;
} else {
this->configMode = CM_NAME_ENTRY_TO_MAIN;
}