mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 03:12:18 -05:00
Fixes macOS randomizer functionality with App Directory (#761)
* Fixes macOS randomizer functionality with App Directory * Fix windows build * Update soh/soh/Enhancements/randomizer/3drando/rando_main.cpp * Update soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp * Revert band-aid fix Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com>
This commit is contained in:
parent
b2b7cf2374
commit
06338d864f
@ -941,6 +941,7 @@
|
||||
<ClCompile Include="src\overlays\misc\ovl_kaleido_scope\z_lmap_mark.c" />
|
||||
<ClCompile Include="src\overlays\misc\ovl_kaleido_scope\z_lmap_mark_data.c" />
|
||||
<ClCompile Include="src\overlays\misc\ovl_map_mark_data\z_map_mark_data.c" />
|
||||
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="soh\Enhancements\cosmetics\CosmeticsEditor.h" />
|
||||
|
@ -7,6 +7,9 @@
|
||||
// #include <soh/Enhancements/randomizer.h>
|
||||
#include <Cvar.h>
|
||||
#include <GameSettings.h>
|
||||
#define NOGDI
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <GlobalCtx2.h>
|
||||
|
||||
#define TICKS_PER_SEC 268123480.0
|
||||
|
||||
@ -18,7 +21,7 @@ void RandoMain::GenerateRando(std::unordered_map<RandomizerSettingKey, u8> cvarS
|
||||
// std::string settingsFileName = "./randomizer/latest_settings.json";
|
||||
// CVar_SetString("gLoadedPreset", settingsFileName.c_str());
|
||||
|
||||
std::string fileName = GenerateRandomizer(cvarSettings);
|
||||
std::string fileName = Ship::GlobalCtx2::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings).c_str());
|
||||
CVar_SetString("gSpoilerLog", fileName.c_str());
|
||||
|
||||
Game::SaveSettings();
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include <filesystem>
|
||||
#include <variables.h>
|
||||
|
||||
#define NOGDI
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include "GlobalCtx2.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
json jsonData;
|
||||
@ -721,12 +725,13 @@ const char* SpoilerLog_Write(int language) {
|
||||
//WriteShuffledEntrances(spoilerLog);
|
||||
WriteAllLocations(language);
|
||||
|
||||
if (!std::filesystem::exists("./Randomizer")) {
|
||||
std::filesystem::create_directory("./Randomizer");
|
||||
if (!std::filesystem::exists(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Randomizer"))) {
|
||||
std::filesystem::create_directory(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Randomizer"));
|
||||
}
|
||||
|
||||
std::string jsonString = jsonData.dump(4);
|
||||
std::ofstream jsonFile("./Randomizer/" + Settings::seed + ".json");
|
||||
std::ofstream jsonFile(Ship::GlobalCtx2::GetPathRelativeToAppDirectory(
|
||||
(std::string("Randomizer/") + std::string(Settings::seed) + std::string(".json")).c_str()));
|
||||
jsonFile << std::setw(4) << jsonString << std::endl;
|
||||
jsonFile.close();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user