Merge pull request #4343 from Archez/merge-develop-rando-sep14

Merge develop -> develop-rando
This commit is contained in:
Archez 2024-09-15 00:16:08 -04:00 committed by GitHub
commit e75400a646
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
35 changed files with 840 additions and 846 deletions

View File

@ -11,6 +11,37 @@ include(CMake/lus-cvars.cmake)
set(PROJECT_BUILD_NAME "MacReady Golf" CACHE STRING "" FORCE) set(PROJECT_BUILD_NAME "MacReady Golf" CACHE STRING "" FORCE)
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE) set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)
execute_process(
COMMAND git branch --show-current
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CMAKE_PROJECT_GIT_BRANCH "${GIT_BRANCH}" CACHE STRING "Git branch" FORCE)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CMAKE_PROJECT_GIT_COMMIT_HASH "${GIT_COMMIT_HASH}" CACHE STRING "Git commit hash" FORCE)
execute_process(
COMMAND git describe --tags --abbrev=0 --exact-match HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_COMMIT_TAG)
set(GIT_COMMIT_TAG "" CACHE STRING "Git commit tag" FORCE)
endif()
set(CMAKE_PROJECT_GIT_COMMIT_TAG "${GIT_COMMIT_TAG}" CACHE STRING "Git commit tag" FORCE)
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh) set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>) add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>) add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)

View File

@ -6,7 +6,7 @@ Requires:
* At least 8GB of RAM (machines with 4GB have seen complier failures) * At least 8GB of RAM (machines with 4GB have seen complier failures)
* Visual Studio 2022 Community Edition with the C++ feature set * Visual Studio 2022 Community Edition with the C++ feature set
* One of the Windows SDKs that comes with Visual Studio, for example the current Windows 10 version 10.0.19041.0 * One of the Windows SDKs that comes with Visual Studio, for example the current Windows 10 version 10.0.19041.0
* The `MSVC v142 - VS 2019 C++ build tools` component of Visual Studio * The `MSVC v143 - VS 2022 C++ build tools` component of Visual Studio
* Python 3 (can be installed manually or as part of Visual Studio) * Python 3 (can be installed manually or as part of Visual Studio)
* Git (can be installed manually or as part of Visual Studio) * Git (can be installed manually or as part of Visual Studio)
* Cmake (can be installed via chocolatey or manually) * Cmake (can be installed via chocolatey or manually)
@ -14,12 +14,9 @@ Requires:
During installation, check the "Desktop development with C++" feature set: During installation, check the "Desktop development with C++" feature set:
![image](https://user-images.githubusercontent.com/30329717/183511274-d11aceea-7900-46ec-acb6-3f2cc110021a.png) ![image](https://user-images.githubusercontent.com/30329717/183511274-d11aceea-7900-46ec-acb6-3f2cc110021a.png)
Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v142 toolset. Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v143 toolset. This is often done by default.
You can also find the v142 toolset by searching through the individual components tab: It is recommended that you install Python and Git standalone, the install process in VS Installer has given some issues in the past.
![image](https://user-images.githubusercontent.com/30329717/183521169-ead6a73b-a1bf-4e99-aab8-441746d8f08e.png)
While you're there, you can also install Python 3 and Git if needed.
1. Clone the Ship of Harkinian repository 1. Clone the Ship of Harkinian repository
@ -33,9 +30,7 @@ _Note: Instructions assume using powershell_
cd Shipwright cd Shipwright
# Setup cmake project # Setup cmake project
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging) & 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# or for VS2019
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
# Extract assets & generate OTR (run this anytime you need to regenerate OTR) # Extract assets & generate OTR (run this anytime you need to regenerate OTR)
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging) & 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging)
# Compile project # Compile project
@ -60,9 +55,7 @@ With the cmake build system you have two options for working on the project:
To develop using Visual Studio you only need to use cmake to generate the solution file: To develop using Visual Studio you only need to use cmake to generate the solution file:
```powershell ```powershell
# Generates Ship.sln at `build/x64` for Visual Studio 2022 # Generates Ship.sln at `build/x64` for Visual Studio 2022
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 & 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
# or for Visual Studio 2019
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
``` ```
#### Visual Studio Code or another editor #### Visual Studio Code or another editor

@ -1 +1 @@
Subproject commit 31e9b009f94e7074a847c7954926cba354cd7c72 Subproject commit 0302eab051a7e0e5a8dc208aca5b00899a91808c

View File

@ -49,6 +49,9 @@ extern "C"
extern u16 gBuildVersionMajor; extern u16 gBuildVersionMajor;
extern u16 gBuildVersionMinor; extern u16 gBuildVersionMinor;
extern u16 gBuildVersionPatch; extern u16 gBuildVersionPatch;
extern u8 gGitBranch[];
extern u8 gGitCommitHash[];
extern u8 gGitCommitTag[];
extern u8 gBuildTeam[]; extern u8 gBuildTeam[];
extern u8 gBuildDate[]; extern u8 gBuildDate[];
extern u8 gBuildMakeOption[]; extern u8 gBuildMakeOption[];

View File

@ -69,6 +69,8 @@ extern "C" void CrashHandler_PrintSohData(char* buffer, size_t* pos) {
char intCharBuffer[16]; char intCharBuffer[16];
append_line(buffer, pos, "Build Information:"); append_line(buffer, pos, "Build Information:");
WRITE_VAR_LINE(buffer, pos, "Game Version: ", (const char*)gBuildVersion); WRITE_VAR_LINE(buffer, pos, "Game Version: ", (const char*)gBuildVersion);
WRITE_VAR_LINE(buffer, pos, "Git Branch: ", (const char*)gGitBranch);
WRITE_VAR_LINE(buffer, pos, "Git Commit: ", (const char*)gGitCommitHash);
WRITE_VAR_LINE(buffer, pos, "Build Date: ", (const char*)gBuildDate); WRITE_VAR_LINE(buffer, pos, "Build Date: ", (const char*)gBuildDate);
if (gPlayState != nullptr) { if (gPlayState != nullptr) {

View File

@ -424,12 +424,6 @@ void AudioEditor::InitElement() {
void AudioEditor::DrawElement() { void AudioEditor::DrawElement() {
AudioCollection::Instance->InitializeShufflePool(); AudioCollection::Instance->InitializeShufflePool();
ImGui::SetNextWindowSize(ImVec2(820, 630), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Audio Editor", &mIsVisible)) {
ImGui::End();
return;
}
float buttonSegments = ImGui::GetContentRegionAvail().x / 4; float buttonSegments = ImGui::GetContentRegionAvail().x / 4;
if (ImGui::Button("Randomize All Groups", ImVec2(buttonSegments, 30.0f))) { if (ImGui::Button("Randomize All Groups", ImVec2(buttonSegments, 30.0f))) {
AudioEditor_RandomizeAll(); AudioEditor_RandomizeAll();
@ -700,7 +694,6 @@ void AudioEditor::DrawElement() {
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::End();
} }
std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX, SEQ_VOICE }; std::vector<SeqType> allTypes = { SEQ_BGM_WORLD, SEQ_BGM_EVENT, SEQ_BGM_BATTLE, SEQ_OCARINA, SEQ_FANFARE, SEQ_INSTRUMENT, SEQ_SFX, SEQ_VOICE };

View File

@ -61,6 +61,15 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex
} }
} }
void InputViewer::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void InputViewer::DrawElement() { void InputViewer::DrawElement() {
if (CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)) { if (CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)) {
static bool sButtonTexturesLoaded = false; static bool sButtonTexturesLoaded = false;
@ -393,12 +402,14 @@ void InputViewer::DrawElement() {
ImGui::PushStyleColor( ImGui::PushStyleColor(
ImGuiCol_Text, ImGuiCol_Text,
color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color)))); color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color))));
} else if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0) && }
else if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0) &&
(rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) { (rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) {
ImGui::PushStyleColor( ImGui::PushStyleColor(
ImGuiCol_Text, ImGuiCol_Text,
color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color)))); color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color))));
} else { }
else {
ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"), ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"),
vec2Color(textColor)))); vec2Color(textColor))));
} }
@ -425,10 +436,6 @@ InputViewerSettingsWindow::~InputViewerSettingsWindow() {
} }
void InputViewerSettingsWindow::DrawElement() { void InputViewerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(500, 525), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Input Viewer Settings", &mIsVisible, ImGuiWindowFlags_HorizontalScrollbar)) {
// gInputViewer.Scale // gInputViewer.Scale
UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", CVAR_INPUT_VIEWER("Scale"), 0.1f, 5.0f, "", UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", CVAR_INPUT_VIEWER("Scale"), 0.1f, 5.0f, "",
1.0f, false, true); 1.0f, false, true);
@ -675,7 +682,4 @@ void InputViewerSettingsWindow::DrawElement() {
} }
} }
} }
ImGui::End();
}
} }

View File

@ -21,6 +21,7 @@ class InputViewer : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void Draw() override;
void InitElement() override {}; void InitElement() override {};
void DrawElement() override; void DrawElement() override;
void UpdateElement() override {}; void UpdateElement() override {};
@ -28,8 +29,6 @@ public:
InputViewer(); InputViewer();
~InputViewer(); ~InputViewer();
void Draw();
private: private:
void RenderButton(std::string btn, std::string btnOutline, int state, ImVec2 size, int outlineMode); void RenderButton(std::string btn, std::string btnOutline, int state, ImVec2 size, int outlineMode);
}; };
@ -44,6 +43,4 @@ public:
InputViewerSettingsWindow(); InputViewerSettingsWindow();
~InputViewerSettingsWindow(); ~InputViewerSettingsWindow();
void Draw();
}; };

View File

@ -1688,12 +1688,6 @@ static const char* colorSchemes[2] = {
}; };
void CosmeticsEditorWindow::DrawElement() { void CosmeticsEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(550, 520), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Cosmetics Editor", &mIsVisible)) {
ImGui::End();
return;
}
ImGui::Text("Color Scheme"); ImGui::Text("Color Scheme");
ImGui::SameLine(); ImGui::SameLine();
UIWidgets::EnhancementCombobox(CVAR_COSMETIC("DefaultColorScheme"), colorSchemes, COLORSCHEME_N64); UIWidgets::EnhancementCombobox(CVAR_COSMETIC("DefaultColorScheme"), colorSchemes, COLORSCHEME_N64);
@ -1812,7 +1806,6 @@ void CosmeticsEditorWindow::DrawElement() {
} }
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::End();
} }
void RegisterOnLoadGameHook() { void RegisterOnLoadGameHook() {

View File

@ -1590,6 +1590,5 @@ void DebugConsole_Init(void) {
{"group_name", Ship::ArgumentType::TEXT, true}, {"group_name", Ship::ArgumentType::TEXT, true},
}}); }});
CVarSave(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
CVarLoad();
} }

View File

@ -20,11 +20,6 @@ void MessageViewer::InitElement() {
} }
void MessageViewer::DrawElement() { void MessageViewer::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Custom Message Debugger", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::Text("Table ID"); ImGui::Text("Table ID");
ImGui::SameLine(); ImGui::SameLine();
ImGui::InputText("##TableID", mTableIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum); ImGui::InputText("##TableID", mTableIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum);
@ -74,7 +69,6 @@ void MessageViewer::DrawElement() {
if (ImGui::Button("Display Message##CustomMessage")) { if (ImGui::Button("Display Message##CustomMessage")) {
mDisplayCustomMessageClicked = true; mDisplayCustomMessageClicked = true;
} }
ImGui::End();
// ReSharper restore CppDFAUnreachableCode // ReSharper restore CppDFAUnreachableCode
} }

View File

@ -925,12 +925,6 @@ void ActorViewer_AddTagForAllActors() {
} }
void ActorViewerWindow::DrawElement() { void ActorViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Actor Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
static Actor* display; static Actor* display;
static Actor empty{}; static Actor empty{};
static Actor* fetch = NULL; static Actor* fetch = NULL;
@ -1235,8 +1229,6 @@ void ActorViewerWindow::DrawElement() {
actors.clear(); actors.clear();
} }
} }
ImGui::End();
} }
void ActorViewerWindow::InitElement() { void ActorViewerWindow::InitElement() {

View File

@ -53,11 +53,6 @@ static std::vector<Vtx> sphereVtx;
// Draws the ImGui window for the collision viewer // Draws the ImGui window for the collision viewer
void ColViewerWindow::DrawElement() { void ColViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Collision Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
UIWidgets::EnhancementCheckbox("Enabled", CVAR_DEVELOPER_TOOLS("ColViewer.Enabled")); UIWidgets::EnhancementCheckbox("Enabled", CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"));
UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), ColRenderSettingNames, COLVIEW_DISABLED); UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), ColRenderSettingNames, COLVIEW_DISABLED);
@ -95,8 +90,6 @@ void ColViewerWindow::DrawElement() {
} else { } else {
UIWidgets::InsertHelpHoverText(colorHelpText); UIWidgets::InsertHelpHoverText(colorHelpText);
} }
ImGui::End();
} }
// Calculates the normal for a triangle at the 3 specified points // Calculates the normal for a triangle at the 3 specified points

View File

@ -1777,12 +1777,6 @@ void DrawPlayerTab() {
} }
void SaveEditorWindow::DrawElement() { void SaveEditorWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Save Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Info")) { if (ImGui::BeginTabItem("Info")) {
DrawInfoTab(); DrawInfoTab();
@ -1816,8 +1810,6 @@ void SaveEditorWindow::DrawElement() {
ImGui::EndTabBar(); ImGui::EndTabBar();
} }
ImGui::End();
} }
void SaveEditorWindow::InitElement() { void SaveEditorWindow::InitElement() {

View File

@ -90,12 +90,6 @@ void PerformDisplayListSearch() {
} }
void DLViewerWindow::DrawElement() { void DLViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Display List Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
// Debounce the search field as listing otr files is expensive // Debounce the search field as listing otr files is expensive
if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) { if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) {
doSearch = true; doSearch = true;
@ -122,7 +116,6 @@ void DLViewerWindow::DrawElement() {
} }
if (activeDisplayList == "") { if (activeDisplayList == "") {
ImGui::End();
return; return;
} }
@ -131,7 +124,6 @@ void DLViewerWindow::DrawElement() {
if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) { if (res->GetInitData()->Type != static_cast<uint32_t>(LUS::ResourceType::DisplayList)) {
ImGui::Text("Resource type is not a Display List. Please choose another."); ImGui::Text("Resource type is not a Display List. Please choose another.");
ImGui::End();
return; return;
} }
@ -325,11 +317,8 @@ void DLViewerWindow::DrawElement() {
} }
} catch (const std::exception& e) { } catch (const std::exception& e) {
ImGui::Text("Error displaying DL instructions."); ImGui::Text("Error displaying DL instructions.");
ImGui::End();
return; return;
} }
ImGui::End();
} }
void DLViewerWindow::InitElement() { void DLViewerWindow::InitElement() {

View File

@ -104,12 +104,6 @@ extern "C" void ValueViewer_Draw(GfxPrint* printer) {
} }
void ValueViewerWindow::DrawElement() { void ValueViewerWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Value Viewer", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
UIWidgets::PaddedEnhancementCheckbox("Enable Printing", CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting")); UIWidgets::PaddedEnhancementCheckbox("Enable Printing", CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"));
ImGui::BeginGroup(); ImGui::BeginGroup();
@ -214,8 +208,6 @@ void ValueViewerWindow::DrawElement() {
} }
ImGui::EndGroup(); ImGui::EndGroup();
} }
ImGui::End();
} }
void ValueViewerWindow::InitElement() { void ValueViewerWindow::InitElement() {

View File

@ -437,7 +437,13 @@ void DrawGameplayStatsHeader() {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f }); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f });
ImGui::BeginTable("gameplayStatsHeader", 1, ImGuiTableFlags_BordersOuter); ImGui::BeginTable("gameplayStatsHeader", 1, ImGuiTableFlags_BordersOuter);
ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
GameplayStatsRow("Build Version:", (char*) gBuildVersion); //if tag is empty (not a release build)
if (gGitCommitTag[0] == 0) {
GameplayStatsRow("Git Branch:", (char*)gGitBranch);
GameplayStatsRow("Git Commit Hash:", (char*)gGitCommitHash);
} else {
GameplayStatsRow("Build Version:", (char*)gBuildVersion);
}
if (gSaveContext.sohStats.rtaTiming) { if (gSaveContext.sohStats.rtaTiming) {
GameplayStatsRow("Total Time (RTA):", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME), gSaveContext.sohStats.gameComplete ? COLOR_GREEN : COLOR_WHITE); GameplayStatsRow("Total Time (RTA):", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME), gSaveContext.sohStats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
} else { } else {
@ -619,12 +625,6 @@ void DrawGameplayStatsOptionsTab() {
} }
void GameplayStatsWindow::DrawElement() { void GameplayStatsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(480, 550), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Gameplay Stats", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
DrawGameplayStatsHeader(); DrawGameplayStatsHeader();
if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
@ -648,8 +648,6 @@ void GameplayStatsWindow::DrawElement() {
} }
ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving."); ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");
ImGui::End();
} }
void InitStats(bool isDebug) { void InitStats(bool isDebug) {
gSaveContext.sohStats.heartPieces = isDebug ? 8 : 0; gSaveContext.sohStats.heartPieces = isDebug ? 8 : 0;

View File

@ -18,7 +18,6 @@ void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::
Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString)); Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString));
CVarSave(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
CVarLoad();
Rando::Context::GetInstance()->SetPlandoLoaded(false); Rando::Context::GetInstance()->SetPlandoLoaded(false);
} }

View File

@ -608,6 +608,8 @@ const char* SpoilerLog_Write() {
jsonData.clear(); jsonData.clear();
jsonData["version"] = (char*) gBuildVersion; jsonData["version"] = (char*) gBuildVersion;
jsonData["git_branch"] = (char*) gGitBranch;
jsonData["git_commit"] = (char*) gGitCommitHash;
jsonData["seed"] = ctx->GetSettings()->GetSeedString(); jsonData["seed"] = ctx->GetSettings()->GetSeedString();
jsonData["finalSeed"] = ctx->GetSettings()->GetSeed(); jsonData["finalSeed"] = ctx->GetSettings()->GetSeed();

View File

@ -1789,8 +1789,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
RandoMain::GenerateRando(excludedLocations, enabledTricks, seed); RandoMain::GenerateRando(excludedLocations, enabledTricks, seed);
CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0); CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0);
CVarSave(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
CVarLoad();
generated = 1; generated = 1;
} }
@ -1813,13 +1812,6 @@ void RandomizerSettingsWindow::DrawElement() {
generated = 0; generated = 0;
randoThread.join(); randoThread.join();
} }
ImGui::SetNextWindowSize(ImVec2(920, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Randomizer Editor", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
if (disableEditingRandoSettings) { if (disableEditingRandoSettings) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
@ -2440,7 +2432,6 @@ void RandomizerSettingsWindow::DrawElement() {
if (disableEditingRandoSettings) { if (disableEditingRandoSettings) {
UIWidgets::ReEnableComponent(""); UIWidgets::ReEnableComponent("");
} }
ImGui::End();
} }
void RandomizerSettingsWindow::UpdateElement() { void RandomizerSettingsWindow::UpdateElement() {

View File

@ -905,9 +905,16 @@ void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
UpdateOrdering(area); UpdateOrdering(area);
} }
void CheckTrackerWindow::DrawElement() { void CheckTrackerWindow::Draw() {
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void CheckTrackerWindow::DrawElement() {
if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) { if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
return; return;
@ -926,6 +933,8 @@ void CheckTrackerWindow::DrawElement() {
} }
} }
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar); BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);
if (!GameInteractor::IsSaveLoaded() || !initialized) { if (!GameInteractor::IsSaveLoaded() || !initialized) {
@ -1700,14 +1709,8 @@ static const char* windowType[] = { "Floating", "Window" };
static const char* displayType[] = { "Always", "Combo Button Hold" }; static const char* displayType[] = { "Always", "Combo Button Hold" };
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button", static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }; "Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
void CheckTrackerSettingsWindow::DrawElement() { void CheckTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Check Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f }); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
ImGui::BeginTable("CheckTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV); ImGui::BeginTable("CheckTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
@ -1769,7 +1772,6 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
ImGui::EndTable(); ImGui::EndTable();
ImGui::End();
} }
void CheckTrackerWindow::InitElement() { void CheckTrackerWindow::InitElement() {

View File

@ -21,6 +21,7 @@ class CheckTrackerSettingsWindow : public Ship::GuiWindow {
class CheckTrackerWindow : public Ship::GuiWindow { class CheckTrackerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void Draw() override;
~CheckTrackerWindow() {}; ~CheckTrackerWindow() {};
protected: protected:

View File

@ -640,13 +640,6 @@ void InitEntranceTrackingData() {
} }
void EntranceTrackerSettingsWindow::DrawElement() { void EntranceTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Entrance Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
if (ImGui::BeginTable("entranceTrackerSettings", 1, ImGuiTableFlags_BordersInnerH)) { if (ImGui::BeginTable("entranceTrackerSettings", 1, ImGuiTableFlags_BordersInnerH)) {
ImGui::TableNextColumn(); ImGui::TableNextColumn();
@ -718,8 +711,15 @@ void EntranceTrackerSettingsWindow::DrawElement() {
ImGui::EndTable(); ImGui::EndTable();
} }
}
ImGui::End(); void EntranceTrackerWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
} }
void EntranceTrackerWindow::DrawElement() { void EntranceTrackerWindow::DrawElement() {

View File

@ -99,6 +99,7 @@ class EntranceTrackerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void Draw() override;
void InitElement() override; void InitElement() override;
void DrawElement() override; void DrawElement() override;
void UpdateElement() override {}; void UpdateElement() override {};

View File

@ -1206,6 +1206,15 @@ void ItemTrackerLoadFile() {
} }
} }
void ItemTrackerWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void ItemTrackerWindow::DrawElement() { void ItemTrackerWindow::DrawElement() {
UpdateVectors(); UpdateVectors();
@ -1350,13 +1359,6 @@ static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Wi
static const char* minimalDisplayTypes[2] = { "Hidden", "Separate" }; static const char* minimalDisplayTypes[2] = { "Hidden", "Separate" };
void ItemTrackerSettingsWindow::DrawElement() { void ItemTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(733, 472), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Item Tracker Settings", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) {
ImGui::End();
return;
}
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f }); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
ImGui::BeginTable("itemTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV); ImGui::BeginTable("itemTrackerSettingsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f); ImGui::TableSetupColumn("General settings", ImGuiTableColumnFlags_WidthStretch, 200.0f);
@ -1499,8 +1501,6 @@ void ItemTrackerSettingsWindow::DrawElement() {
ImGui::PopStyleVar(1); ImGui::PopStyleVar(1);
ImGui::EndTable(); ImGui::EndTable();
ImGui::End();
} }
void ItemTrackerWindow::InitElement() { void ItemTrackerWindow::InitElement() {

View File

@ -47,6 +47,7 @@ class ItemTrackerSettingsWindow : public Ship::GuiWindow {
class ItemTrackerWindow : public Ship::GuiWindow { class ItemTrackerWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void Draw() override;
protected: protected:
void InitElement() override; void InitElement() override;

View File

@ -59,8 +59,6 @@ void AdvancedResolutionSettingsWindow::InitElement() {
} }
void AdvancedResolutionSettingsWindow::DrawElement() { void AdvancedResolutionSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(497, 599), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Advanced Resolution Settings", &mIsVisible)) {
// Initialise update flags. // Initialise update flags.
bool update[3]; bool update[3];
for (uint8_t i = 0; i < sizeof(update); i++) for (uint8_t i = 0; i < sizeof(update); i++)
@ -475,8 +473,6 @@ void AdvancedResolutionSettingsWindow::DrawElement() {
CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount); CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount);
CVarSave(); CVarSave();
} }
}
ImGui::End();
} }
void AdvancedResolutionSettingsWindow::UpdateElement() { void AdvancedResolutionSettingsWindow::UpdateElement() {

View File

@ -344,9 +344,9 @@ OTRGlobals::OTRGlobals() {
overlay->LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f); overlay->LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f);
overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P")); overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P"));
context->InitAudio(); context->InitAudio({ .SampleRate = 44100, .SampleLength = 1024, .DesiredBuffered = 2480 });
SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion); SPDLOG_INFO("Starting Ship of Harkinian version {} (Branch: {} | Commit: {})", (char*)gBuildVersion, (char*)gGitBranch, (char*)gGitCommitHash);
auto loader = context->GetResourceManager()->GetResourceLoader(); auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0); loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryTextureV0>(), RESOURCE_FORMAT_BINARY, "Texture", static_cast<uint32_t>(LUS::ResourceType::Texture), 0);

View File

@ -23,6 +23,7 @@
#include <fstream> #include <fstream>
#include <filesystem> #include <filesystem>
#include <array> #include <array>
#include <mutex>
extern "C" SaveContext gSaveContext; extern "C" SaveContext gSaveContext;
using namespace std::string_literals; using namespace std::string_literals;
@ -1158,6 +1159,7 @@ int copy_file(const char* src, const char* dst) {
// Threaded SaveFile takes copy of gSaveContext for local unmodified storage // Threaded SaveFile takes copy of gSaveContext for local unmodified storage
void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int sectionID) { void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int sectionID) {
saveMtx.lock();
SPDLOG_INFO("Save File - fileNum: {}", fileNum); SPDLOG_INFO("Save File - fileNum: {}", fileNum);
// Needed for first time save, hasn't changed in forever anyway // Needed for first time save, hasn't changed in forever anyway
saveBlock["version"] = 1; saveBlock["version"] = 1;
@ -1232,6 +1234,7 @@ void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int se
InitMeta(fileNum); InitMeta(fileNum);
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSaveFile>(fileNum); GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSaveFile>(fileNum);
SPDLOG_INFO("Save File Finish - fileNum: {}", fileNum); SPDLOG_INFO("Save File Finish - fileNum: {}", fileNum);
saveMtx.unlock();
} }
// SaveSection creates a copy of gSaveContext to prevent mid-save data modification, and passes its reference to SaveFileThreaded // SaveSection creates a copy of gSaveContext to prevent mid-save data modification, and passes its reference to SaveFileThreaded
@ -1274,6 +1277,7 @@ void SaveManager::SaveGlobal() {
} }
void SaveManager::LoadFile(int fileNum) { void SaveManager::LoadFile(int fileNum) {
saveMtx.lock();
SPDLOG_INFO("Load File - fileNum: {}", fileNum); SPDLOG_INFO("Load File - fileNum: {}", fileNum);
std::filesystem::path fileName = GetFileName(fileNum); std::filesystem::path fileName = GetFileName(fileNum);
assert(std::filesystem::exists(fileName)); assert(std::filesystem::exists(fileName));
@ -1336,6 +1340,7 @@ void SaveManager::LoadFile(int fileNum) {
SohGui::RegisterPopup("Error loading save file", "A problem occurred loading the save in slot " + std::to_string(fileNum + 1) + ".\nSave file corruption is suspected.\n" + SohGui::RegisterPopup("Error loading save file", "A problem occurred loading the save in slot " + std::to_string(fileNum + 1) + ".\nSave file corruption is suspected.\n" +
"The file has been renamed to prevent further issues."); "The file has been renamed to prevent further issues.");
} }
saveMtx.unlock();
} }
void SaveManager::ThreadPoolWait() { void SaveManager::ThreadPoolWait() {

View File

@ -186,7 +186,7 @@ class SaveManager {
nlohmann::json* currentJsonContext = nullptr; nlohmann::json* currentJsonContext = nullptr;
nlohmann::json::iterator currentJsonArrayContext; nlohmann::json::iterator currentJsonArrayContext;
std::shared_ptr<BS::thread_pool> smThreadPool; std::shared_ptr<BS::thread_pool> smThreadPool;
std::mutex saveMtx;
}; };
#else #else

View File

@ -165,43 +165,43 @@ namespace SohGui {
SPDLOG_ERROR("Could not find input editor window"); SPDLOG_ERROR("Could not find input editor window");
} }
mAudioEditorWindow = std::make_shared<AudioEditor>(CVAR_WINDOW("AudioEditor"), "Audio Editor"); mAudioEditorWindow = std::make_shared<AudioEditor>(CVAR_WINDOW("AudioEditor"), "Audio Editor", ImVec2(820, 630));
gui->AddGuiWindow(mAudioEditorWindow); gui->AddGuiWindow(mAudioEditorWindow);
mInputViewer = std::make_shared<InputViewer>(CVAR_WINDOW("InputViewer"), "Input Viewer"); mInputViewer = std::make_shared<InputViewer>(CVAR_WINDOW("InputViewer"), "Input Viewer");
gui->AddGuiWindow(mInputViewer); gui->AddGuiWindow(mInputViewer);
mInputViewerSettings = std::make_shared<InputViewerSettingsWindow>(CVAR_WINDOW("InputViewerSettings"), "Input Viewer Settings"); mInputViewerSettings = std::make_shared<InputViewerSettingsWindow>(CVAR_WINDOW("InputViewerSettings"), "Input Viewer Settings", ImVec2(500, 525));
gui->AddGuiWindow(mInputViewerSettings); gui->AddGuiWindow(mInputViewerSettings);
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>(CVAR_WINDOW("CosmeticsEditor"), "Cosmetics Editor"); mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>(CVAR_WINDOW("CosmeticsEditor"), "Cosmetics Editor", ImVec2(550, 520));
gui->AddGuiWindow(mCosmeticsEditorWindow); gui->AddGuiWindow(mCosmeticsEditorWindow);
mActorViewerWindow = std::make_shared<ActorViewerWindow>(CVAR_WINDOW("ActorViewer"), "Actor Viewer"); mActorViewerWindow = std::make_shared<ActorViewerWindow>(CVAR_WINDOW("ActorViewer"), "Actor Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mActorViewerWindow); gui->AddGuiWindow(mActorViewerWindow);
mColViewerWindow = std::make_shared<ColViewerWindow>(CVAR_WINDOW("CollisionViewer"), "Collision Viewer"); mColViewerWindow = std::make_shared<ColViewerWindow>(CVAR_WINDOW("CollisionViewer"), "Collision Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mColViewerWindow); gui->AddGuiWindow(mColViewerWindow);
mSaveEditorWindow = std::make_shared<SaveEditorWindow>(CVAR_WINDOW("SaveEditor"), "Save Editor"); mSaveEditorWindow = std::make_shared<SaveEditorWindow>(CVAR_WINDOW("SaveEditor"), "Save Editor", ImVec2(520, 600));
gui->AddGuiWindow(mSaveEditorWindow); gui->AddGuiWindow(mSaveEditorWindow);
mDLViewerWindow = std::make_shared<DLViewerWindow>(CVAR_WINDOW("DLViewer"), "Display List Viewer"); mDLViewerWindow = std::make_shared<DLViewerWindow>(CVAR_WINDOW("DLViewer"), "Display List Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mDLViewerWindow); gui->AddGuiWindow(mDLViewerWindow);
mValueViewerWindow = std::make_shared<ValueViewerWindow>(CVAR_WINDOW("ValueViewer"), "Value Viewer"); mValueViewerWindow = std::make_shared<ValueViewerWindow>(CVAR_WINDOW("ValueViewer"), "Value Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mValueViewerWindow); gui->AddGuiWindow(mValueViewerWindow);
mMessageViewerWindow = std::make_shared<MessageViewer>(CVAR_WINDOW("MessageViewer"), "Message Viewer"); mMessageViewerWindow = std::make_shared<MessageViewer>(CVAR_WINDOW("MessageViewer"), "Message Viewer", ImVec2(520, 600));
gui->AddGuiWindow(mMessageViewerWindow); gui->AddGuiWindow(mMessageViewerWindow);
mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>(CVAR_WINDOW("GameplayStats"), "Gameplay Stats"); mGameplayStatsWindow = std::make_shared<GameplayStatsWindow>(CVAR_WINDOW("GameplayStats"), "Gameplay Stats", ImVec2(480, 550));
gui->AddGuiWindow(mGameplayStatsWindow); gui->AddGuiWindow(mGameplayStatsWindow);
mCheckTrackerWindow = std::make_shared<CheckTracker::CheckTrackerWindow>(CVAR_WINDOW("CheckTracker"), "Check Tracker"); mCheckTrackerWindow = std::make_shared<CheckTracker::CheckTrackerWindow>(CVAR_WINDOW("CheckTracker"), "Check Tracker");
gui->AddGuiWindow(mCheckTrackerWindow); gui->AddGuiWindow(mCheckTrackerWindow);
mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings"); mCheckTrackerSettingsWindow = std::make_shared<CheckTracker::CheckTrackerSettingsWindow>(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings", ImVec2(600, 375));
gui->AddGuiWindow(mCheckTrackerSettingsWindow); gui->AddGuiWindow(mCheckTrackerSettingsWindow);
mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>(CVAR_WINDOW("EntranceTracker"), "Entrance Tracker"); mEntranceTrackerWindow = std::make_shared<EntranceTrackerWindow>(CVAR_WINDOW("EntranceTracker"), "Entrance Tracker");
gui->AddGuiWindow(mEntranceTrackerWindow); gui->AddGuiWindow(mEntranceTrackerWindow);
mEntranceTrackerSettingsWindow = std::make_shared<EntranceTrackerSettingsWindow>(CVAR_WINDOW("EntranceTrackerSettings"), "Entrance Tracker Settings"); mEntranceTrackerSettingsWindow = std::make_shared<EntranceTrackerSettingsWindow>(CVAR_WINDOW("EntranceTrackerSettings"), "Entrance Tracker Settings", ImVec2(600, 375));
gui->AddGuiWindow(mEntranceTrackerSettingsWindow); gui->AddGuiWindow(mEntranceTrackerSettingsWindow);
mItemTrackerWindow = std::make_shared<ItemTrackerWindow>(CVAR_WINDOW("ItemTracker"), "Item Tracker"); mItemTrackerWindow = std::make_shared<ItemTrackerWindow>(CVAR_WINDOW("ItemTracker"), "Item Tracker");
gui->AddGuiWindow(mItemTrackerWindow); gui->AddGuiWindow(mItemTrackerWindow);
mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings"); mItemTrackerSettingsWindow = std::make_shared<ItemTrackerSettingsWindow>(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings", ImVec2(733, 472));
gui->AddGuiWindow(mItemTrackerSettingsWindow); gui->AddGuiWindow(mItemTrackerSettingsWindow);
mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>(CVAR_WINDOW("RandomizerSettings"), "Randomizer Settings"); mRandomizerSettingsWindow = std::make_shared<RandomizerSettingsWindow>(CVAR_WINDOW("RandomizerSettings"), "Randomizer Settings", ImVec2(920, 600));
gui->AddGuiWindow(mRandomizerSettingsWindow); gui->AddGuiWindow(mRandomizerSettingsWindow);
mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>(CVAR_WINDOW("AdvancedResolutionEditor"), "Advanced Resolution Settings"); mAdvancedResolutionSettingsWindow = std::make_shared<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow>(CVAR_WINDOW("AdvancedResolutionEditor"), "Advanced Resolution Settings", ImVec2(497, 599));
gui->AddGuiWindow(mAdvancedResolutionSettingsWindow); gui->AddGuiWindow(mAdvancedResolutionSettingsWindow);
mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window"); mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
gui->AddGuiWindow(mModalWindow); gui->AddGuiWindow(mModalWindow);

View File

@ -19,6 +19,15 @@ struct SohModal {
}; };
std::vector<SohModal> modals; std::vector<SohModal> modals;
void SohModalWindow::Draw() {
if (!IsVisible()) {
return;
}
DrawElement();
// Sync up the IsVisible flag if it was changed by ImGui
SyncVisibilityConsoleVariable();
}
void SohModalWindow::DrawElement() { void SohModalWindow::DrawElement() {
if (modals.size() > 0) { if (modals.size() > 0) {
SohModal curModal = modals.at(0); SohModal curModal = modals.at(0);

View File

@ -7,6 +7,7 @@
class SohModalWindow : public Ship::GuiWindow { class SohModalWindow : public Ship::GuiWindow {
public: public:
using GuiWindow::GuiWindow; using GuiWindow::GuiWindow;
void Draw() override;
void InitElement() override {}; void InitElement() override {};
void DrawElement() override; void DrawElement() override;

View File

@ -5,6 +5,10 @@ const u16 gBuildVersionMajor = @CMAKE_PROJECT_VERSION_MAJOR@;
const u16 gBuildVersionMinor = @CMAKE_PROJECT_VERSION_MINOR@; const u16 gBuildVersionMinor = @CMAKE_PROJECT_VERSION_MINOR@;
const u16 gBuildVersionPatch = @CMAKE_PROJECT_VERSION_PATCH@; const u16 gBuildVersionPatch = @CMAKE_PROJECT_VERSION_PATCH@;
const char gGitBranch[] = "@CMAKE_PROJECT_GIT_BRANCH@";
const char gGitCommitHash[] = "@CMAKE_PROJECT_GIT_COMMIT_HASH@";
const char gGitCommitTag[] = "@CMAKE_PROJECT_GIT_COMMIT_TAG@";
const char gBuildTeam[] = "@PROJECT_TEAM@"; const char gBuildTeam[] = "@PROJECT_TEAM@";
const char gBuildDate[] = __DATE__ " " __TIME__; const char gBuildDate[] = __DATE__ " " __TIME__;
const char gBuildMakeOption[] = ""; const char gBuildMakeOption[] = "";

View File

@ -13,6 +13,7 @@
#include <soh/Enhancements/bootcommands.h> #include <soh/Enhancements/bootcommands.h>
#include <GameVersions.h> #include <GameVersions.h>
#include <soh/SaveManager.h> #include <soh/SaveManager.h>
#include <string.h>
#include "time.h" #include "time.h"
@ -30,8 +31,24 @@ void Title_PrintBuildInfo(Gfx** gfxp) {
GfxPrint_Open(&printer, g); GfxPrint_Open(&printer, g);
GfxPrint_SetColor(&printer, 131, 154, 255, 255); GfxPrint_SetColor(&printer, 131, 154, 255, 255);
//if tag is empty (not a release build)
bool showGitInfo = gGitCommitTag[0] == 0;
if (showGitInfo) {
GfxPrint_SetPos(&printer, 1, 24);
GfxPrint_Printf(&printer, "Git Branch: %s", gGitBranch);
//truncate the commit to 7 characters
char gGitCommitHashTruncated[8];
strncpy(gGitCommitHashTruncated, gGitCommitHash, 7);
gGitCommitHashTruncated[7] = 0;
GfxPrint_SetPos(&printer, 1, 25);
GfxPrint_Printf(&printer, "Git Commit: %s", gGitCommitHashTruncated);
} else {
GfxPrint_SetPos(&printer, 1, 25); GfxPrint_SetPos(&printer, 1, 25);
GfxPrint_Printf(&printer, "%s", gBuildVersion); GfxPrint_Printf(&printer, "%s", gBuildVersion);
}
GfxPrint_SetPos(&printer, 1, 26); GfxPrint_SetPos(&printer, 1, 26);
GfxPrint_Printf(&printer, "%s", gBuildDate); GfxPrint_Printf(&printer, "%s", gBuildDate);