clang format

This commit is contained in:
aMannus
2025-07-31 10:44:47 +02:00
parent e53d29e12d
commit 00a70eae87
7 changed files with 114 additions and 111 deletions

View File

@@ -53,9 +53,7 @@ bool ArchipelagoClient::StartClient() {
uri = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), "localhost:38281"); uri = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), "localhost:38281");
password = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("Password"), ""); password = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("Password"), "");
apClient = std::unique_ptr<APClient>( apClient = std::unique_ptr<APClient>(new APClient(uuid, AP_Client_consts::AP_GAME_NAME, uri, "cacert.pem"));
new APClient(uuid, AP_Client_consts::AP_GAME_NAME,
uri, "cacert.pem"));
CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 1); // Connecting CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 1); // Connecting
@@ -80,8 +78,7 @@ bool ArchipelagoClient::StartClient() {
if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("DeathLink"), 0)) { if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("DeathLink"), 0)) {
tags.push_back("DeathLink"); tags.push_back("DeathLink");
} }
apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""), apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""), password, 0b001, tags);
password, 0b001, tags);
}); });
apClient->set_slot_connected_handler([&](const nlohmann::json data) { apClient->set_slot_connected_handler([&](const nlohmann::json data) {
@@ -243,7 +240,8 @@ bool ArchipelagoClient::StartClient() {
gSaveContext.health = 0; gSaveContext.health = 0;
std::string prefixText = std::string(data["data"]["source"]) + " died."; std::string prefixText = std::string(data["data"]["source"]) + " died.";
Notification::Emit({ .prefix = prefixText, .message = "Cause:", .suffix = data["data"]["cause"] }); Notification::Emit({ .prefix = prefixText, .message = "Cause:", .suffix = data["data"]["cause"] });
std::string deathLinkMessage = "[LOG] Received death link from " + std::string(data["data"]["source"]) + std::string deathLinkMessage = "[LOG] Received death link from " +
std::string(data["data"]["source"]) +
". Cause: " + std::string(data["data"]["cause"]); ". Cause: " + std::string(data["data"]["cause"]);
ArchipelagoConsole_SendMessage(deathLinkMessage.c_str()); ArchipelagoConsole_SendMessage(deathLinkMessage.c_str());

View File

@@ -137,4 +137,3 @@ ImVec4 ArchipelagoConsoleWindow::getColorVal(const AP_Text::TextColor color) {
return ImVec4(0.93f, 0.93f, 0.93f, 1.00f); return ImVec4(0.93f, 0.93f, 0.93f, 1.00f);
}; };
} }

View File

@@ -25,6 +25,6 @@ namespace AP_Text {
std::string text; std::string text;
AP_Text::TextColor color; AP_Text::TextColor color;
}; };
} } // namespace AP_Text
#endif #endif

View File

@@ -517,7 +517,8 @@ void SaveManager::InitMeta(int fileNum) {
ARRAY_COUNT(fileMetaInfo[fileNum].archiUri)); ARRAY_COUNT(fileMetaInfo[fileNum].archiUri));
SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].slotName, gSaveContext.ship.quest.data.archipelago.slotName, SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].slotName, gSaveContext.ship.quest.data.archipelago.slotName,
ARRAY_COUNT(fileMetaInfo[fileNum].slotName)); ARRAY_COUNT(fileMetaInfo[fileNum].slotName));
SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].archiRoomSeed, gSaveContext.ship.quest.data.archipelago.roomHash, SohUtils::CopyStringToCharArray(fileMetaInfo[fileNum].archiRoomSeed,
gSaveContext.ship.quest.data.archipelago.roomHash,
ARRAY_COUNT(fileMetaInfo[fileNum].archiRoomSeed)); ARRAY_COUNT(fileMetaInfo[fileNum].archiRoomSeed));
} }

View File

@@ -3460,7 +3460,6 @@ void Interface_DrawArchipelagoStatusString(PlayState* play) {
break; break;
} }
Interface_DrawTextLineOverlay(play->state.gfxCtx, statusText, posX, posY, 255, 255, 255, 255, 0.8f, true); Interface_DrawTextLineOverlay(play->state.gfxCtx, statusText, posX, posY, 255, 255, 255, 255, 0.8f, true);
} }
@@ -6999,10 +6998,10 @@ void Interface_DrawTextCharacter_overlay(GraphicsContext* gfx, int16_t x, int16_
if (textShadow) { if (textShadow) {
// Draw drop shadow // Draw drop shadow
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, colorA); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, colorA);
gSPWideTextureRectangle(OVERLAY_DISP++, (x + R_TEXT_DROP_SHADOW_OFFSET) << 2, (y + R_TEXT_DROP_SHADOW_OFFSET) << 2, gSPWideTextureRectangle(
(x + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2, OVERLAY_DISP++, (x + R_TEXT_DROP_SHADOW_OFFSET) << 2, (y + R_TEXT_DROP_SHADOW_OFFSET) << 2,
(y + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, sCharTexScale, (x + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2, (y + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2,
sCharTexScale); G_TX_RENDERTILE, 0, 0, sCharTexScale, sCharTexScale);
} }
gDPPipeSync(OVERLAY_DISP++); gDPPipeSync(OVERLAY_DISP++);
@@ -7066,8 +7065,8 @@ uint16_t Interface_DrawTextLineOverlay(GraphicsContext* gfx, char text[], int16_
if (textureIndex != 0) { if (textureIndex != 0) {
texture = Ship_GetCharFontTexture(processedText[i]); texture = Ship_GetCharFontTexture(processedText[i]);
Interface_DrawTextCharacter_overlay(gfx, (int16_t)(x + kerningOffset), (int16_t)(y + lineOffset), texture, colorR, colorG, colorB, Interface_DrawTextCharacter_overlay(gfx, (int16_t)(x + kerningOffset), (int16_t)(y + lineOffset),
colorA, textScale, textShadow); texture, colorR, colorG, colorB, colorA, textScale, textShadow);
} }
kerningOffset += kerningOffset +=
(uint16_t)(Ship_GetCharFontWidth(processedText[i]) * (R_TEXT_CHAR_SCALE / 100.0f) * textScale); (uint16_t)(Ship_GetCharFontWidth(processedText[i]) * (R_TEXT_CHAR_SCALE / 100.0f) * textScale);

View File

@@ -2553,10 +2553,12 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language; uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language;
// Connection status text // Connection status text
int statusPos = 61 + Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_STATUS, language), int statusPos = 61 + Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_STATUS, language),
58, 133, 200, 200, 200, textAlpha, 0.8f, true); 58, 133, 200, 200, 200, textAlpha, 0.8f, true);
const bool connectedToThisSlot = checkArchipelagoSlotInfo(Save_GetSaveMetaInfo(this->selectedFileIndex)->slotName, const bool connectedToThisSlot =
checkArchipelagoSlotInfo(Save_GetSaveMetaInfo(this->selectedFileIndex)->slotName,
Save_GetSaveMetaInfo(this->selectedFileIndex)->archiRoomSeed); Save_GetSaveMetaInfo(this->selectedFileIndex)->archiRoomSeed);
switch (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0)) { switch (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0)) {
@@ -2569,8 +2571,8 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
case 2: // Connection error, retrying case 2: // Connection error, retrying
case 3: // Connected case 3: // Connected
Interface_DrawTextLine(this->state.gfxCtx, Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTING, language), SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTING, language), statusPos,
statusPos, 133, 185, 185, 185, textAlpha, 0.8f, true); 133, 185, 185, 185, textAlpha, 0.8f, true);
break; break;
case 4: // Connected + Locations Scouted case 4: // Connected + Locations Scouted
if (connectedToThisSlot) { if (connectedToThisSlot) {
@@ -2578,7 +2580,8 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTED, language), SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTED, language),
statusPos, 133, 120, 255, 120, textAlpha, 0.8f, true); statusPos, 133, 120, 255, 120, textAlpha, 0.8f, true);
} else { } else {
Interface_DrawTextLine(this->state.gfxCtx, Interface_DrawTextLine(
this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_CHAR_SELECT_CONNECTED_TO_OTHER_SLOT, language), SohFileSelect_GetArchipelagoSettingText(ASM_CHAR_SELECT_CONNECTED_TO_OTHER_SLOT, language),
statusPos, 133, 255, 255, 120, textAlpha, 0.8f, true); statusPos, 133, 255, 255, 120, textAlpha, 0.8f, true);
} }
@@ -2587,8 +2590,9 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
} }
if (!connectedToThisSlot) { if (!connectedToThisSlot) {
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_CHAR_START_TO_CONNECT, language), Interface_DrawTextLine(this->state.gfxCtx,
58, 144, 200, 200, 200, textAlpha, 0.8f, true); SohFileSelect_GetArchipelagoSettingText(ASM_CHAR_START_TO_CONNECT, language), 58,
144, 200, 200, 200, textAlpha, 0.8f, true);
} }
// Interface_DrawTextLine(this->state.gfxCtx, // Interface_DrawTextLine(this->state.gfxCtx,
@@ -2994,26 +2998,27 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
155, 185, 185, 185, textAlpha, 0.8f, true); 155, 185, 185, 185, textAlpha, 0.8f, true);
// Connection status text // Connection status text
int statusPos = 75 + Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_STATUS, language), 70, int statusPos = 75 + Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_STATUS, language), 70,
175, 255, 255, 255, textAlpha, 0.8f, true); 175, 255, 255, 255, textAlpha, 0.8f, true);
switch (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0)) { switch (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0)) {
case 0: // Not Connected case 0: // Not Connected
Interface_DrawTextLine(this->state.gfxCtx, Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_NOT_CONNECTED, language), statusPos, 175, SohFileSelect_GetArchipelagoSettingText(ASM_NOT_CONNECTED, language), statusPos,
255, 120, 120, textAlpha, 0.8f, true); 175, 255, 120, 120, textAlpha, 0.8f, true);
break; break;
case 1: // Connecting case 1: // Connecting
case 2: // Connection error, retrying case 2: // Connection error, retrying
case 3: // Connected case 3: // Connected
Interface_DrawTextLine(this->state.gfxCtx, Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTING, language), statusPos, 175, 185, SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTING, language), statusPos,
185, 185, textAlpha, 0.8f, true); 175, 185, 185, 185, textAlpha, 0.8f, true);
break; break;
case 4: // Connected + Locations Scouted case 4: // Connected + Locations Scouted
Interface_DrawTextLine(this->state.gfxCtx, Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTED, language), statusPos, 175, 120, SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTED, language), statusPos, 175,
255, 120, textAlpha, 0.8f, true); 120, 255, 120, textAlpha, 0.8f, true);
break; break;
} }
@@ -3055,7 +3060,8 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
// Draw the small file name box instead when more meta info is enabled // Draw the small file name box instead when more meta info is enabled
if (CVarGetInteger(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 0) != 0 && if (CVarGetInteger(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 0) != 0 &&
this->menuMode == FS_MENU_MODE_SELECT && Save_GetSaveMetaInfo(this->selectedFileIndex)->archiSave == 0) { this->menuMode == FS_MENU_MODE_SELECT &&
Save_GetSaveMetaInfo(this->selectedFileIndex)->archiSave == 0) {
// Location of file 1 small name box vertices // Location of file 1 small name box vertices
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[68], 4, 0); gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[68], 4, 0);