mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
Final (added in text on screen)
This commit is contained in:
parent
ff3379ff13
commit
6984be11c5
2 changed files with 12 additions and 0 deletions
|
@ -493,6 +493,11 @@ void DebugConsole_Init(void) {
|
||||||
DebugConsole_LoadCVars();
|
DebugConsole_LoadCVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Numeric> bool is_number(const std::string& s) {
|
||||||
|
Numeric n;
|
||||||
|
return ((std::istringstream(s) >> n >> std::ws).eof());
|
||||||
|
}
|
||||||
|
|
||||||
void DebugConsole_LoadCVars()
|
void DebugConsole_LoadCVars()
|
||||||
{
|
{
|
||||||
if (File::Exists("cvars.cfg")) {
|
if (File::Exists("cvars.cfg")) {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <soh/OTRGlobals.h>
|
#include <soh/OTRGlobals.h>
|
||||||
#include <soh/OTRAudio.h>
|
#include <soh/OTRAudio.h>
|
||||||
|
|
||||||
|
#include <SohImGuiImpl.h>
|
||||||
|
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "z64save.h"
|
#include "z64save.h"
|
||||||
#include <variables.h>
|
#include <variables.h>
|
||||||
|
@ -877,6 +879,7 @@ extern "C" void ProcessSaveStateRequests(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
|
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
|
||||||
|
SohImGui::overlay->TextDrawNotification(1.0f, true, "slot %u set", slot);
|
||||||
this->currentSlot = slot;
|
this->currentSlot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -894,10 +897,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
|
||||||
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
|
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
|
||||||
}
|
}
|
||||||
this->states[request.slot]->Save();
|
this->states[request.slot]->Save();
|
||||||
|
SohImGui::overlay->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
|
||||||
break;
|
break;
|
||||||
case RequestType::LOAD:
|
case RequestType::LOAD:
|
||||||
if (this->states.contains(request.slot)) {
|
if (this->states.contains(request.slot)) {
|
||||||
this->states[request.slot]->Load();
|
this->states[request.slot]->Load();
|
||||||
|
SohImGui::overlay->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
|
||||||
} else {
|
} else {
|
||||||
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
||||||
}
|
}
|
||||||
|
@ -913,6 +918,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) {
|
||||||
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
|
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
|
||||||
if (gGlobalCtx == nullptr) {
|
if (gGlobalCtx == nullptr) {
|
||||||
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
|
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;
|
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,6 +931,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
|
||||||
requests.push(request);
|
requests.push(request);
|
||||||
} else {
|
} else {
|
||||||
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
|
||||||
|
SohImGui::overlay->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
|
||||||
return SaveStateReturn::FAIL_INVALID_SLOT;
|
return SaveStateReturn::FAIL_INVALID_SLOT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue