Skip to content

Commit e89490b

Browse files
committed
Mac fixes
1 parent c510089 commit e89490b

3 files changed

Lines changed: 31 additions & 19 deletions

File tree

src/port/Rando/CheckTracker/CheckTracker.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ namespace GhostshipGui {
1212
extern std::shared_ptr<Rando::CheckTracker::CheckTrackerWindow> mRandoCheckTrackerWindow;
1313
}
1414

15-
#define DEFAULT_LOGIC_COLOR Color_RGBA8(200, 200, 200, 255)
16-
#define DEFAULT_COLLECTED_COLOR Color_RGBA8(100, 255, 100, 255)
17-
#define DEFAULT_SKIPPED_COLOR Color_RGBA8(255, 100, 255, 255)
18-
#define DEFAULT_ITEM_COLOR Color_RGBA8(79, 0, 221, 255)
15+
#define DEFAULT_LOGIC_COLOR \
16+
Color_RGBA8 { \
17+
200, 200, 200, 255 \
18+
}
19+
#define DEFAULT_COLLECTED_COLOR \
20+
Color_RGBA8 { \
21+
100, 255, 100, 255 \
22+
}
23+
#define DEFAULT_SKIPPED_COLOR \
24+
Color_RGBA8 { \
25+
255, 100, 255, 255 \
26+
}
27+
#define DEFAULT_ITEM_COLOR \
28+
Color_RGBA8 { \
29+
79, 0, 221, 255 \
30+
}
1931

2032
#define CVAR_NAME_SHOW_CHECK_TRACKER "gWindows.CheckTracker"
2133
#define CVAR_NAME_CHECK_TRACKER_OPACITY "gRando.CheckTracker.Opacity"

src/port/Rando/Rando.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
namespace fs = std::filesystem;
1313

1414
int16_t selectedFileNum = 0;
15+
const fs::path randomizerFolderPath(Ship::Context::GetPathRelativeToAppDirectory("randomizer", "sm64"));
1516

1617
// Entry point for the module, run once on game boot
1718
void Rando::Init() {
18-
fs::path dir("randomizer");
19-
if (!fs::exists(dir)) {
20-
fs::create_directory(dir);
19+
if (!fs::exists(randomizerFolderPath)) {
20+
fs::create_directory(randomizerFolderPath);
2121
}
2222

2323
Rando::Spoiler::RefreshSpoilerLogs();

src/port/data/Saves.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ namespace fs = std::filesystem;
1010

1111
extern "C" struct SaveBuffer gSaveBuffer;
1212

13+
const fs::path savesPath(Ship::Context::GetPathRelativeToAppDirectory("saves", "sm64"));
14+
1315
static void Init() {
1416
// Create saves directory if it doesn't exist
15-
fs::path dir("saves");
16-
if (!fs::exists(dir)) {
17-
fs::create_directory(dir);
17+
if (!fs::exists(savesPath)) {
18+
fs::create_directory(savesPath);
1819
}
1920
}
2021

@@ -33,7 +34,7 @@ void RestoreSaveFileData(int32_t fileIndex, int32_t srcSlot) {
3334
}
3435

3536
void SaveFileDoSave(int32_t fileIndex) {
36-
std::ofstream file(fs::path("saves/save_" + std::to_string(fileIndex) + ".json"), std::ios::out);
37+
std::ofstream file(savesPath / ("save_" + std::to_string(fileIndex) + ".json"), std::ios::out);
3738
if (!file.is_open()) {
3839
return;
3940
}
@@ -44,24 +45,23 @@ void SaveFileDoSave(int32_t fileIndex) {
4445
}
4546

4647
bool ShouldLoadOldSaveFile(void) {
47-
fs::path save("default.sav");
48-
return fs::exists(save);
48+
return fs::exists(Ship::Context::GetPathRelativeToAppDirectory("default.sav"));
4949
}
5050

5151
void SaveFileLoadAll(void) {
52-
fs::path save("default.sav");
53-
if (fs::exists(save)) {
52+
auto oldSave = Ship::Context::GetPathRelativeToAppDirectory("default.sav");
53+
if (fs::exists(oldSave)) {
5454
for (int32_t fileIndex = 0; fileIndex < NUM_SAVE_FILES; fileIndex++) {
5555
SaveFileDoSave(fileIndex);
5656
}
5757
// Move old save files to backup
58-
fs::rename(save, "default.sav.bak");
58+
fs::rename(oldSave, Ship::Context::GetPathRelativeToAppDirectory("default.sav.bak"));
5959
return;
6060
}
6161

6262
// Read save files
6363
for (int32_t fileIndex = 0; fileIndex < NUM_SAVE_FILES; fileIndex++) {
64-
fs::path filepath = fs::path("saves/save_" + std::to_string(fileIndex) + ".json");
64+
fs::path filepath = savesPath / ("save_" + std::to_string(fileIndex) + ".json");
6565
if (!fs::exists(filepath)) {
6666
continue;
6767
}
@@ -84,7 +84,7 @@ void SaveFileLoadAll(void) {
8484
}
8585

8686
// Read global save file
87-
fs::path globalpath = fs::path("saves/global.json");
87+
fs::path globalpath = savesPath / "global.json";
8888
if (fs::exists(globalpath)) {
8989
std::ifstream file(globalpath, std::ios::in);
9090
if (file.is_open()) {
@@ -97,7 +97,7 @@ void SaveFileLoadAll(void) {
9797
}
9898

9999
void SaveMainMenuData(void) {
100-
std::ofstream file(fs::path("saves/global.json"), std::ios::out);
100+
std::ofstream file(savesPath / "global.json", std::ios::out);
101101
if (!file.is_open()) {
102102
return;
103103
}

0 commit comments

Comments
 (0)