Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions balatro-mobile-maker/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ public static string getGameSaveLocation()
return ".";
}

public static string getModLocation()
{
if (isWindows)
return Environment.GetEnvironmentVariable("AppData") + "\\BalatroBACKUP\\Mods";

//TODO: Test Linux location
if (isLinux)
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/BalatroBACKUP/Mods";

//TODO: Implement
if (isOSX)
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "/Library/Application Support/Balatro"; // unchanged, I don't know anything about OSX filestructure and I'd probably break smth

return ".";
}

//Checks whether the game already exists in the directory
//If it does not exist, it attempts to grab it from the default location
//If it does already exist, this returns true
Expand Down
15 changes: 13 additions & 2 deletions balatro-mobile-maker/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public void Begin()
_cleaup = AskQuestion("Would you like to automatically clean up once complete?");
_verboseMode = AskQuestion("Would you like to enable extra logging information?");

//Checks if the game executable was already present in the directory
gameProvided = Platform.gameExists();

//If balatro.apk or balatro.ipa already exists, ask before beginning build process again
if (!(fileExists("balatro.apk") || fileExists("balatro.ipa")) || AskQuestion("A previous build was found... Would you like to build again?"))
{
Expand Down Expand Up @@ -87,8 +90,6 @@ public void Begin()
#region Prepare workspace
#region Find and extract Balatro.exe

gameProvided = Platform.gameExists();

if (gameProvided)
Log("Game found!");
else
Expand Down Expand Up @@ -304,12 +305,16 @@ public void Begin()
PrepareAndroidPlatformTools();

Log("Backing up your files...");

if (!directoryExists(Platform.getGameSaveLocation() + "BACKUP"))
System.IO.Directory.CreateDirectory(Platform.getGameSaveLocation() + "BACKUP/");
//TODO: No xcopy
RunCommand("xcopy", "\"" + Platform.getGameSaveLocation() + "\" \"" + Platform.getGameSaveLocation() + "BACKUP\\\" /E /H /Y /V");

tryDelete(Platform.getGameSaveLocation());
System.IO.Directory.CreateDirectory(Platform.getGameSaveLocation());



Log("Attempting to pull save files from Android device.");

Expand Down Expand Up @@ -343,6 +348,12 @@ public void Begin()
useTool(ProcessTools.ADB, "shell find /data/local/tmp/balatro/files/ -maxdepth 2 -size 0c -exec rm '{}' \\;");
useTool(ProcessTools.ADB, "pull /data/local/tmp/balatro/files/. \"" + Platform.getGameSaveLocation() + "\"");

if (directoryExists(Platform.getModLocation())) { // only want this to run if the mods folder exists in the first place
Log("Restoring mods folder...");
System.IO.Directory.CreateDirectory(Platform.getGameSaveLocation() + "\\Mods");
RunCommand("xcopy", Platform.getModLocation() + " " + Platform.getGameSaveLocation() + "\\Mods" + " /E /H /Y /V"); // iinob: I know it says no xcopy up there, but I don't use dotnet very often and idk any other way to do it
}

useTool(ProcessTools.ADB, "kill-server");
}
}
Expand Down