Skip to content

Commit

Permalink
Merge pull request #9 from HarbourMasters/develop
Browse files Browse the repository at this point in the history
Update SoH
  • Loading branch information
Arrenton authored Sep 24, 2024
2 parents adbb1c5 + 19dc4dc commit 9c9444e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion libultraship
Submodule libultraship updated 47 files
+1 −1 .github/workflows/tidy-format-validation.yml
+4 −3 cmake/dependencies/common.cmake
+1 −0 include/libultraship/libultra/gbi.h
+2 −2 include/libultraship/libultra/os.h
+7 −7 src/Context.cpp
+3 −3 src/Context.h
+3 −5 src/audio/Audio.cpp
+3 −1 src/audio/Audio.h
+0 −2 src/audio/AudioPlayer.cpp
+32 −4 src/audio/AudioPlayer.h
+1 −7 src/audio/SDLAudioPlayer.cpp
+2 −2 src/audio/SDLAudioPlayer.h
+0 −6 src/audio/WasapiAudioPlayer.cpp
+6 −6 src/audio/WasapiAudioPlayer.h
+1 −1 src/config/Config.cpp
+2 −3 src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToAxisDirectionMapping.cpp
+2 −2 src/controller/controldevice/controller/mapping/keyboard/KeyboardKeyToButtonMapping.cpp
+4 −3 src/controller/controldevice/controller/mapping/keyboard/KeyboardScancodes.h
+2 −0 src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAnyMapping.cpp
+8 −0 src/controller/controldevice/controller/mapping/sdl/SDLButtonToAnyMapping.cpp
+2 −2 src/controller/controldevice/controller/mapping/sdl/SDLButtonToButtonMapping.cpp
+1 −1 src/controller/controldevice/controller/mapping/sdl/SDLGyroMapping.cpp
+46 −16 src/graphic/Fast3D/gfx_pc.cpp
+2 −1 src/graphic/Fast3D/gfx_pc.h
+5 −0 src/graphic/Fast3D/gfx_sdl2.cpp
+1 −0 src/graphic/Fast3D/lus_gbi.h
+1 −0 src/resource/ResourceType.h
+1 −1 src/resource/archive/Archive.cpp
+1 −1 src/resource/factory/DisplayListFactory.cpp
+15 −0 src/resource/factory/LightFactory.cpp
+11 −0 src/resource/factory/LightFactory.h
+11 −0 src/resource/type/Light.cpp
+65 −0 src/resource/type/Light.h
+12 −0 src/utils/binarytools/BinaryReader.cpp
+1 −0 src/utils/binarytools/BinaryReader.h
+5 −4 src/window/gui/ConsoleWindow.cpp
+334 −56 src/window/gui/GfxDebuggerWindow.cpp
+1 −1 src/window/gui/GfxDebuggerWindow.h
+73 −65 src/window/gui/Gui.cpp
+4 −2 src/window/gui/Gui.h
+5 −5 src/window/gui/GuiElement.cpp
+1 −1 src/window/gui/GuiElement.h
+2 −2 src/window/gui/GuiMenuBar.cpp
+1 −1 src/window/gui/GuiMenuBar.h
+3 −3 src/window/gui/GuiWindow.cpp
+2 −2 src/window/gui/GuiWindow.h
+3 −3 src/window/gui/InputEditorWindow.cpp
3 changes: 1 addition & 2 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,5 @@ void DebugConsole_Init(void) {
{"group_name", Ship::ArgumentType::TEXT, true},
}});

CVarSave();
CVarLoad();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
3 changes: 1 addition & 2 deletions soh/soh/Enhancements/randomizer/3drando/rando_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
std::string fileName = Ship::Context::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations, enabledTricks, seedString).c_str());
CVarSetString(CVAR_GENERAL("SpoilerLog"), fileName.c_str());

CVarSave();
CVarLoad();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
CVarSetInteger(CVAR_GENERAL("NewSeedGenerated"), 1);
}

Expand Down
3 changes: 1 addition & 2 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3053,8 +3053,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
RandoMain::GenerateRando(cvarSettings, excludedLocations, enabledTricks, seed);

CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0);
CVarSave();
CVarLoad();
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();

generated = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ OTRGlobals::OTRGlobals() {
overlay->LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f);
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 {} (Branch: {} | Commit: {})", (char*)gBuildVersion, (char*)gGitBranch, (char*)gGitCommitHash);

Expand Down
5 changes: 5 additions & 0 deletions soh/soh/SaveManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <fstream>
#include <filesystem>
#include <array>
#include <mutex>

extern "C" SaveContext gSaveContext;
using namespace std::string_literals;
Expand Down Expand Up @@ -922,6 +923,7 @@ int copy_file(const char* src, const char* dst) {
// Threaded SaveFile takes copy of gSaveContext for local unmodified storage

void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int sectionID) {
saveMtx.lock();
SPDLOG_INFO("Save File - fileNum: {}", fileNum);
// Needed for first time save, hasn't changed in forever anyway
saveBlock["version"] = 1;
Expand Down Expand Up @@ -996,6 +998,7 @@ void SaveManager::SaveFileThreaded(int fileNum, SaveContext* saveContext, int se
InitMeta(fileNum);
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSaveFile>(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
Expand Down Expand Up @@ -1038,6 +1041,7 @@ void SaveManager::SaveGlobal() {
}

void SaveManager::LoadFile(int fileNum) {
saveMtx.lock();
SPDLOG_INFO("Load File - fileNum: {}", fileNum);
std::filesystem::path fileName = GetFileName(fileNum);
assert(std::filesystem::exists(fileName));
Expand Down Expand Up @@ -1100,6 +1104,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" +
"The file has been renamed to prevent further issues.");
}
saveMtx.unlock();
}

void SaveManager::ThreadPoolWait() {
Expand Down
1 change: 1 addition & 0 deletions soh/soh/SaveManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class SaveManager {
nlohmann::json* currentJsonContext = nullptr;
nlohmann::json::iterator currentJsonArrayContext;
std::shared_ptr<BS::thread_pool> smThreadPool;
std::mutex saveMtx;
};

#else
Expand Down

0 comments on commit 9c9444e

Please sign in to comment.