diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index cc38cb6d6..4be8f505b 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.26.0 FATAL_ERROR) +include(FetchContent) set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) @@ -339,6 +340,20 @@ if (BUILD_REMOTE_CONTROL) message(STATUS "OpenSSL not found (it's possible the version installed is too old). Disabling BUILD_REMOTE_CONTROL.") set(BUILD_REMOTE_CONTROL 0) endif() + + FetchContent_Declare( + sslCertStore + URL https://curl.se/ca/cacert.pem + DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/networking + DOWNLOAD_NO_EXTRACT TRUE + ) + + FetchContent_MakeAvailable( + sslCertStore + ) + + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/networking/cacert.pem DESTINATION ./networking COMPONENT ship) + endif() if (ESPEAK) diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 445b75088..8651e74a4 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -257,9 +257,10 @@ void RandomizerOnFlagSetHandler(int16_t flagType, int16_t flag) { Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_TOKENS).Is(RO_TOKENSANITY_OFF)) return; auto loc = Rando::Context::GetInstance()->GetItemLocation(rc); - if (loc == nullptr || loc->HasObtained() || loc->GetPlacedRandomizerGet() == RG_NONE) - return; - + if(rc != RC_HF_OCARINA_OF_TIME_ITEM) { + if (loc == nullptr || loc->HasObtained() || loc->GetPlacedRandomizerGet() == RG_NONE) + return; + } SPDLOG_INFO("Queuing RC: {}", static_cast(rc)); randomizerQueuedChecks.push(rc); } @@ -301,6 +302,12 @@ void RandomizerOnExternalCheckHandler(uint32_t randomizerCheck) { inSameArea = scene == gPlayState->sceneNum; } + // setting the ocarinina obtained event flag + if(rc == RC_HF_OCARINA_OF_TIME_ITEM) { + randomizerQueuedChecks.push(rc); + return; + } + std::string logMessage = ""; switch (loc->GetCollectionCheck().type) { @@ -375,6 +382,10 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() { getItemEntry = Rando::Context::GetInstance()->GetFinalGIEntry(rc, true, (GetItemID)vanillaRandomizerGet); } + if(rc == RC_HF_OCARINA_OF_TIME_ITEM && loc->HasObtained()) { + RandomizerOnExternalCheckHandler(RC_SONG_FROM_OCARINA_OF_TIME); + } + if (loc->HasObtained()) { SPDLOG_INFO("RC {} already obtained, skipping", static_cast(rc)); } else { diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 4c87c7d0c..73a715a45 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -53,15 +53,16 @@ bool ArchipelagoClient::StartClient() { uri = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), "localhost:38281"); password = CVarGetString(CVAR_REMOTE_ARCHIPELAGO("Password"), ""); - apClient = std::unique_ptr(new APClient(uuid, AP_Client_consts::AP_GAME_NAME, uri, "cacert.pem")); + const std::string cert = Ship::Context::LocateFileAcrossAppDirs("networking/cacert.pem"); + SPDLOG_DEBUG("Location of cert: " + cert); + apClient = std::unique_ptr(new APClient(uuid, AP_Client_consts::AP_GAME_NAME, uri, cert)); CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 1); // Connecting apClient->set_socket_error_handler([&](const std::string& msg) { retries++; if (retries >= AP_Client_consts::MAX_RETRIES) { - ArchipelagoConsole_SendMessage("[ERROR] Could not connect to server after several tries.\nAre the entered " - "server address and slot name correct?"); + ArchipelagoConsole_SendMessage("[ERROR] Could not connect to server after several tries.\nAre the entered server address and port correct?"); CVarSetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 2); // Connection error disconnecting = true; @@ -70,7 +71,7 @@ bool ArchipelagoClient::StartClient() { } return; } - ArchipelagoConsole_SendMessage("[ERROR] Could not connect to server, retrying..."); + ArchipelagoConsole_SendMessage(std::string("[ERROR] " + msg).c_str()); }); apClient->set_room_info_handler([&]() { @@ -78,7 +79,7 @@ bool ArchipelagoClient::StartClient() { if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("DeathLink"), 0)) { tags.push_back("DeathLink"); } - apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""), password, 0b001, tags); + apClient->ConnectSlot(CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), ""), password, 0b0101, tags); }); apClient->set_slot_connected_handler([&](const nlohmann::json data) { @@ -111,6 +112,13 @@ bool ArchipelagoClient::StartClient() { } }); + apClient->set_slot_refused_handler([&](const std::list& msgs) { + disconnecting = true; + for(const std::string& msg : msgs) { + ArchipelagoConsole_SendMessage(std::string("[ERROR] "+ msg).c_str()); + } + }); + apClient->set_items_received_handler([&](const std::list& items) { if (disconnecting) { return;