From 6984be11c5029903143e486e61125d0b44ff0336 Mon Sep 17 00:00:00 2001 From: louist103 Date: Wed, 11 May 2022 20:10:22 -0400 Subject: [PATCH] Final (added in text on screen) --- soh/soh/Enhancements/debugconsole.cpp | 5 +++++ soh/soh/Enhancements/savestates.cpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 6ee2e4740..1b892be74 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -493,6 +493,11 @@ void DebugConsole_Init(void) { DebugConsole_LoadCVars(); } +template bool is_number(const std::string& s) { + Numeric n; + return ((std::istringstream(s) >> n >> std::ws).eof()); +} + void DebugConsole_LoadCVars() { if (File::Exists("cvars.cfg")) { diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index 80005e571..764e38dc5 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -9,6 +9,8 @@ #include #include +#include + #include "z64.h" #include "z64save.h" #include @@ -877,6 +879,7 @@ extern "C" void ProcessSaveStateRequests(void) { } void SaveStateMgr::SetCurrentSlot(unsigned int slot) { + SohImGui::overlay->TextDrawNotification(1.0f, true, "slot %u set", slot); this->currentSlot = slot; } @@ -894,10 +897,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { this->states[request.slot] = std::make_shared(OTRGlobals::Instance->gSaveStateMgr, request.slot); } this->states[request.slot]->Save(); + SohImGui::overlay->TextDrawNotification(1.0f, true, "saved state %u", request.slot); break; case RequestType::LOAD: if (this->states.contains(request.slot)) { this->states[request.slot]->Load(); + SohImGui::overlay->TextDrawNotification(1.0f, true, "loaded state %u", request.slot); } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); } @@ -913,6 +918,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { if (gGlobalCtx == nullptr) { SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\""); + SohImGui::overlay->TextDrawNotification(1.0f, true, "states not available here", request.slot); return SaveStateReturn::FAIL_WRONG_GAMESTATE; } @@ -925,6 +931,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { requests.push(request); } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); + SohImGui::overlay->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); return SaveStateReturn::FAIL_INVALID_SLOT; } break;