Last active
May 23, 2024 05:37
-
-
Save ohaiibuzzle/7bc8a8f93f82c6692120d732eef59810 to your computer and use it in GitHub Desktop.
Script to login to ToF on PlayCover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to login to ToF on PlayCover | |
# Select the ToF version | |
echo "Please select the region of ToF you want to login to:" | |
echo "[1] Global" | |
echo "[2] China" | |
read -p "Enter your choice: " choice | |
if [ $choice -eq 1 ]; then | |
TOF_BUNDLE_ID=com.levelinfinite.hotta.ios | |
elif [ $choice -eq 2 ]; then | |
TOF_BUNDLE_ID=com.pwrd.huanta | |
else | |
echo "Invalid choice. Exiting..." | |
exit 1 | |
fi | |
CONTAINER_PATH=$HOME/Library/Containers/$TOF_BUNDLE_ID/Data | |
# Prepare functions | |
function exit_trailer_success { | |
echo "Done. You can now launch the game." | |
echo "please star my script uwu: https://gist.github.com/ohaiibuzzle/7bc8a8f93f82c6692120d732eef59810" | |
echo "Enjoy using PlayCover! - Buzzle <3" | |
exit 0 | |
} | |
function exit_fail { | |
echo "Something went wrong. Please try again." | |
exit 1 | |
} | |
function make_tof_container_symlink { | |
# Ensure that the path exist | |
mkdir -p $CONTAINER_PATH/Documents/Users/$USER/Library/Containers/$TOF_BUNDLE_ID/Data/ | |
# Remove the old symlink if it exists | |
rm -rf $CONTAINER_PATH/Documents/Users/$USER/Library/Containers/$TOF_BUNDLE_ID/Data/Documents | |
# Symlink | |
ln -sfn ~/Library/Containers/$TOF_BUNDLE_ID/Data/Documents $CONTAINER_PATH/Documents/Users/$USER/Library/Containers/$TOF_BUNDLE_ID/Data/ | |
} | |
function backup_patchpaks { | |
# Backup the PatchPaks | |
echo "Backing up PatchPaks..." | |
mv $CONTAINER_PATH/Documents/Hotta/Content/PatchPaks/ $CONTAINER_PATH | |
} | |
function restore_patchpaks { | |
# Restore the PatchPaks | |
echo "Restoring PatchPaks..." | |
mv $CONTAINER_PATH/PatchPaks/ $CONTAINER_PATH/Documents/Hotta/Content/ | |
} | |
function main { | |
# Check if the container exists | |
if [ ! -d "$CONTAINER_PATH" ]; then | |
echo "Container not found. Please launch the game at least once to the Hotta screen" | |
exit_fail | |
fi | |
# Check if any PatchPaks exists | |
if [ ! -d "$CONTAINER_PATH/Documents/Hotta/Content/PatchPaks" ]; then | |
# We can (probably) create the softlink now | |
make_tof_container_symlink | |
exit_trailer_success | |
fi | |
# PatchPaks exists | |
# (Only for Global) Move PatchPaks outside because of Hotta's awesome decision | |
# to just blindly nuke the content of the Documents folder | |
if [ $choice -eq 1 ]; then | |
backup_patchpaks | |
fi | |
# Symlink | |
make_tof_container_symlink | |
# Prompt the user to login | |
echo "Please launch and login to ToF. After you sign in successfully, quit the game." | |
echo "DO NOT try to enter the game (it will crash if you do)" | |
echo "Press [Enter] key after you have logged in to continue..." | |
read | |
if [ $choice -eq 1 ]; then | |
restore_patchpaks | |
fi | |
exit_trailer_success | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@MainasuK Updated to also cover CN