Closed valknight closed 2 weeks ago
Just to add to the compatibility here - I dropped 1.01c's Balatro.love from my Mac onto a Windows PC, and just renamed it to Balatro.exe for the tool to pick up - and it runs identically to an IPA generated from the Windows build of the game. Makes sense considering the nature of the game - but this is moreso that the tool is already fairly close to supporting macOS / Linux.
I'm certainly open to moving to .NET Core. I never anticipated so many folks to use the tool that cross-platform compatibility would be necessary. You're welcome to take this on, but I work quick-- so I just might beat you to it haha.
Edit: That said, I don't have a Mac to test anything with, so I can't do it alone. I'm open to merging a PR if you can get this working.
I've made a .NET Core project in a private branch. Once I get the multi-platform build process worked out, I'll seek some help sorting out all the platform-specific code.
Ah, oops, I've been doing a big refactor! I was about to open a PR now, because I've made changes to move a lot of stuff out into a Constants section - such that we can perform conditional compilation. Give me two secs to get the PR live.
Just got a PR live :) It's a lot of refactoring, C# modernisation, and prep for modernisation.
As for multi-plat build process, you could likely do this via GitHub actions. For a lot of my work right now, we make use of a lot of dotnet tooling via Actions - I can take a look at getting actions setup to run automated builds across multiple platforms.
Thx for the improvement, I did a Steam Guide to run the Game on Linux natively and this tool will be great once I can use it on my Linux PC to play on mobile !
will there be github actions to build linux and mac versions of the executable and bundled them on the release ?
I tried building in linux, it still needs a lot of work to make it work on linux, particularly this used cmd and installed a lot of stuff in the windows way
@antipatico @CUexter @Enderteck No hard feelings, but I'm removing these comments since they aren't really relevant to this particular issue on this particular project.
I've begun implementing a platform layer to break out all the platform-specific code. That way, we can do something like this:
public static void useADB(string args)
{
if(isWindows)
CommandLine("platform-tools\\platform-tools\\adb.exe " + args);
if (isOSX) { /*...*/ }
if (isLinux) { /*...*/ }
}
I'm also breaking out all the commands into discrete "tools." So instead of calling CommandLine("...")
from the main view, we can instead do something like this:
useTool(ProcessTools.ADB, "install balatro.apk");
useTool(ProcessTools.ADB, "kill-server");
Things are going to get a little uglier before they get prettier, because I'm more interested in function over form-- at least at the moment. But this should put us in a good spot to implement Linux and MacOS compatibility with relative ease.
Edit: I'm working in this branch https://github.com/blake502/balatro-mobile-maker/tree/multiplatform-refactor
We're in a really good position with this now. I've switched from using Oracle's Java to using Microsoft's build of OpenJDK instead. The benefits of OpenJDK are better multi-platform support, and no need to actually install it. The only negative is a larger file size (oh well).
With the switch to OpenJDK, all external tools natively support OSX, Linux, and Windows-- All three on either system architecture (x64 and Arm64).
I've broken out almost all platform-specific functionality into the platform layer, although a few tweaks still need to be made.
I've implemented speculative code for OSX and Linux for most things. Only minor teaks necessary now to make full use of the platform layer.
At this point, I could use some help from Linux and MacOS developers to iron out the details.
Check out this branch: https://github.com/blake502/balatro-mobile-maker/tree/multi-platform
i am a dedicated linux user, what can i help ?
On linux the game is located in: ~/.local/share/Steam/steamapps/common/Balatro/Balatro.exe
the save file location is in: ~/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro
Another thing, Personally i would not want to download the programs that i have already installed, maybe just try calling the command first and see if they are in PATH or not. Only download them when they arent there ?
Thanks for that info!
Another thing, Personally i would not want to download the programs that i have already installed, maybe just try calling the command first and see if they are in PATH or not. Only download them when they arent there ?
That's the plan. For the moment, the "speculative" code assumes that Python is already installed. The only reason we can't easily do that on Windows is because calling python
without Python installed launches the Microsoft Store and prompts the user to download it from there. For that reason, I switched to using the embedded Python for Windows, which does not need to be installed. As for Java, I switched to OpenJDK, which also does not require an install. At the moment, the Windows build doesn't require any tools to be installed-- just downloaded and executed.
Linux x64 is up and running!! I've included the OSX build as well, although I'm not convinced it's working.
There are some caveats-- For example, ABD is not implemented on any system besides Windows x64.
Linux and OSX will require Python to be installed manually if you plan to build for iOS. (not applicable to Android build)
https://github.com/blake502/balatro-mobile-maker/releases/tag/beta-0.8-pre
Just tried the Linux x64, and it worked !
How can I transfer my save to the app now ?
I don't plan on rroting my tablet.
pull-save.sh
#!/bin/bash
#
set -e
exit_with_error() {
echo "Error: $1"
exit 1
}
adb shell rm -r /data/local/tmp/balatro
adb shell mkdir /data/local/tmp/balatro/
adb shell mkdir /data/local/tmp/balatro/files/
adb shell mkdir /data/local/tmp/balatro/files/1/
adb shell touch /data/local/tmp/balatro/files/settings.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/settings.jkr > /data/local/tmp/balatro/files/settings.jkr"
adb shell touch /data/local/tmp/balatro/files/1/profile.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/1/profile.jkr > /data/local/tmp/balatro/files/1/profile.jkr"
adb shell touch /data/local/tmp/balatro/files/1/meta.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/1/meta.jkr > /data/local/tmp/balatro/files/1/meta.jkr"
adb shell touch /data/local/tmp/balatro/files/1/save.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/1/save.jkr > /data/local/tmp/balatro/files/1/save.jkr"
adb pull /data/local/tmp/balatro/files/. ~/balatro/save/
# Define the directory where your saves are stored on your PC
PC_SAVE_DIR="$HOME/.steam/steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro"
# Define the directory to store backups
BACKUP_DIR="$HOME/balatro/backup"
# Create a backup of the current saves with a timestamp
DATE=$(date +"%Y%m%d-%H%M%S")
mkdir -p "${BACKUP_DIR}" || exit_with_error "Failed to create backup directory"
tar -czf "${BACKUP_DIR}/save-backup-${DATE}.tar.gz" -C "${PC_SAVE_DIR}" . || exit_with_error "Failed to create backup archive"
cd "${PC_SAVE_DIR}" || exit_with_error "Failed to change directory to PC save directory"
[[ -d "1" ]] && rm -r "1"
[[ -d "2" ]] && rm -r "2"
[[ -d "3" ]] && rm -r "3"
[[ -f "settings.jkr" ]] && rm "settings.jkr"
# Now pull the latest save files from the Android device
mv ~/balatro/save/* ${PC_SAVE_DIR}
# Confirm completion
echo "Save files updated and backup created with timestamp: ${DATE}"
push-save.sh
#!/bin/bash
#
adb shell rm -r /data/local/tmp/balatro
adb shell mkdir /data/local/tmp/balatro/
adb shell mkdir /data/local/tmp/balatro/files/
adb shell mkdir /data/local/tmp/balatro/files/1/
# adb shell mkdir /data/local/tmp/balatro/files/2/
# adb shell mkdir /data/local/tmp/balatro/files/3/
adb shell touch /data/local/tmp/balatro/files/settings.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/settings.jkr > /data/local/tmp/balatro/files/settings.jkr"
adb shell touch /data/local/tmp/balatro/files/1/profile.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/1/profile.jkr > /data/local/tmp/balatro/files/1/profile.jkr"
adb shell touch /data/local/tmp/balatro/files/1/meta.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/1/meta.jkr > /data/local/tmp/balatro/files/1/meta.jkr"
adb shell touch /data/local/tmp/balatro/files/1/save.jkr
adb shell "run-as com.unofficial.balatro cat files/save/game/1/save.jkr > /data/local/tmp/balatro/files/1/save.jkr"
# adb shell touch /data/local/tmp/balatro/files/2/profile.jkr
# adb shell "run-as com.unofficial.balatro cat files/save/game/2/profile.jkr > /data/local/tmp/balatro/files/2/profile.jkr"
# adb shell touch /data/local/tmp/balatro/files/2/meta.jkr
# adb shell "run-as com.unofficial.balatro cat files/save/game/2/meta.jkr > /data/local/tmp/balatro/files/2/meta.jkr"
# adb shell touch /data/local/tmp/balatro/files/2/save.jkr
# adb shell "run-as com.unofficial.balatro cat files/save/game/2/save.jkr > /data/local/tmp/balatro/files/2/save.jkr"
# adb shell touch /data/local/tmp/balatro/files/3/profile.jkr
# adb shell "run-as com.unofficial.balatro cat files/save/game/3/profile.jkr > /data/local/tmp/balatro/files/3/profile.jkr"
# adb shell touch /data/local/tmp/balatro/files/3/meta.jkr
# adb shell "run-as com.unofficial.balatro cat files/save/game/3/meta.jkr > /data/local/tmp/balatro/files/3/meta.jkr"
# adb shell touch /data/local/tmp/balatro/files/3/save.jkr
# adb shell "run-as com.unofficial.balatro cat files/save/game/3/save.jkr > /data/local/tmp/balatro/files/3/save.jkr"
adb pull /data/local/tmp/balatro/files/. ~/balatro/save/
# Define the directory where your saves are stored on your PC
PC_SAVE_DIR="$HOME/.steam/steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro"
# Define the directory to store backups
BACKUP_DIR="$HOME/balatro/backup/android"
# Create a backup of the current saves with a timestamp
DATE=$(date +"%Y%m%d-%H%M%S")
mkdir -p "${BACKUP_DIR}" || exit_with_error "Failed to create backup directory"
tar -czf "${BACKUP_DIR}/save-backup-${DATE}.tar.gz" -C ~/balatro/save . || exit_with_error "Failed to create backup archive"
TMP="$HOME/balatro/tmp/save/"
mkdir -p $TMP
cp -r $PC_SAVE_DIR/* $TMP
cd $TMP
rm -r Mods/*
cp -r $HOME/balatro/mobile-mods/* $TMP/Mods
adb shell rm -r /data/local/tmp/balatro
adb shell mkdir /data/local/tmp/balatro
adb shell mkdir /data/local/tmp/balatro/files
adb shell mkdir /data/local/tmp/balatro/files/save
adb shell mkdir /data/local/tmp/balatro/files/save/game
adb push $TMP* /data/local/tmp/balatro/files/save/game && adb shell am force-stop com.unofficial.balatro && adb shell run-as com.unofficial.balatro cp -r /data/local/tmp/balatro/files . && adb shell rm -r /data/local/tmp/balatro && adb kill-server
rm -r $TMP
echo "Saves have been pushed to android"
this is what i am using for now
Thank you so much, worked great !
With MacOS and Linux being supported now, I'm going to close this ticket.
ADB implementation for OSX and Linus is on the to-do list!
I noticed this tool is restricted to Windows, requiring a VM for Mac / Linux folks to use the project.
The
Balatro.love
file is found inside our installation folders on macOS, so the process is actually very similar - we would just need alternative commands to execute. I tested, and the project does build with a migration to C# Core - although, nothing works due to many assumptions of being Windows only.If you are open to it, I'm happy to work on a PR with some sweeping refactors to get this working on macOS and Linux, as well as modularize the patch process. I can imagine this tool will likely be useful even with the official release, as the game can likely be patched to install PC modloaders, and be able to run beta versions of the game; so I imagine the work won't be for naught.