- If you're on Mac and prefer double clicking rather than full terminal, rename it to txt2gct.command so you can double click to execute it.
- make sure the .txt is next to the .sh/.command (or you know how to modify paths)
- chmod 777 txt2gct.sh (or txt2gct.command if you named it that)
- if you DID NOT use a premade .txt from a different build / if you made the txt from scratch, comment or remove line 23 and rename hax.txt to $file on line 26. so if your .txt was from a custom build (which likely used codemgr) then you don't need to do anything.
- haven't tested on files with spaces in name, so if possible rename the .txt without spaces.
Last active
August 22, 2022 16:56
-
-
Save iGlitch/1382fbc128a3eb4396247bac3a46929e to your computer and use it in GitHub Desktop.
Convert txt codesets to gct for Wii on Mac OS or Linux
This file contains hidden or 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
#!/bin/bash | |
echo | |
echo [txt2gct] script by Glitch | |
echo | |
echo "Please enter the 4/6 character GameID." | |
echo "Can also be the name of your .txt without the .txt" | |
echo "For example: RSBJ01 or my_codes" | |
echo | |
read -p 'Codeset: ' gameid | |
file="$gameid.txt" | |
#Checks if the GameID.txt exists next to the script | |
if [ ! -f $file ]; then | |
echo "File not found. Exiting..." | |
exit | |
fi; | |
echo | |
echo Making $gameid.gct | |
echo | |
#converts from codemgr created txts to readable text and not binary | |
iconv -f UTF-16LE -t UTF-8 $file > hax.txt #comment this if your source txt is already utf-8 | |
#Searches for codes that are on and copy to tmp | |
grep -s -e '^*' hax.txt > gct.temp | |
echo '00D0C0DE 00D0C0DE' | cat - gct.temp > temp && mv temp gct.temp | |
clear | |
echo 'F0000000 00000000' >> gct.temp | |
clear | |
sed -i -e 's/*//g' gct.temp #remove asterisk | |
sed -i -e 's/ //g' gct.temp #remove spaces | |
#sed '/^$/d' gct.temp | |
:> $gameid.gct | |
#Extracts all codes into the GCT | |
xxd -r -a -c 2 -plain gct.temp >> $gameid.gct | |
#Deletes temporary files | |
rm -f gct.temp | |
rm -f hax.txt | |
rm -f gct.temp-e | |
echo $file created. | |
read -p "Press anything to exit." | |
echo | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment