added wii script

This commit is contained in:
2026-04-19 09:36:15 +01:00
parent dd09c05df8
commit 043599eff9
2 changed files with 128 additions and 2 deletions
+5 -2
View File
@@ -60,6 +60,7 @@ function helpme() {
echo -e "star-update : Update terminal from gitea" echo -e "star-update : Update terminal from gitea"
echo -e "star-edit : Edit starship config" echo -e "star-edit : Edit starship config"
echo -e "rip : Rip a music CD" echo -e "rip : Rip a music CD"
echo -e "wii : Convert Wii games"
echo -e "" echo -e ""
echo -e "\e[32m--------- System Stats ----------\e[0m" echo -e "\e[32m--------- System Stats ----------\e[0m"
echo -e "kill [tab] : Show processes to Kill" echo -e "kill [tab] : Show processes to Kill"
@@ -74,8 +75,6 @@ alias ...="z ../.."
alias cd="z" alias cd="z"
alias ll="lsd -1" alias ll="lsd -1"
alias llt="lsd --tree" alias llt="lsd --tree"
alias myapps="sudo -v && ~/.bash/fedora-apps.sh"
alias phoneapps="~/.bash/phone-apps.sh"
alias reload="source ~/.bashrc" alias reload="source ~/.bashrc"
alias rip='abcde -c ~/.abcde.conf' alias rip='abcde -c ~/.abcde.conf'
alias size="du -shc" alias size="du -shc"
@@ -90,7 +89,11 @@ alias star-edit="nano ~/.config/starship.toml"
alias ssh="kitty +kitten ssh" alias ssh="kitty +kitten ssh"
alias pack="tar -cvJf" # pack compressed.tar.xz /folder/file1.txt /folder/folder2 alias pack="tar -cvJf" # pack compressed.tar.xz /folder/file1.txt /folder/folder2
alias unpack="tar -xvf" alias unpack="tar -xvf"
# Scripts
alias myapps="sudo -v && ~/.bash/fedora-apps.sh"
alias phoneapps="~/.bash/phone-apps.sh"
alias compress="~/.bash/compress.sh" alias compress="~/.bash/compress.sh"
alias wii="~/.bash/wii.sh"
export GSK_RENDERER=cairo export GSK_RENDERER=cairo
eval "$(starship init bash)" eval "$(starship init bash)"
Executable
+123
View File
@@ -0,0 +1,123 @@
#!/bin/bash
# Define Colors
ORANGE="#FFA500"
GREY="#808080"
# 1. Check for required tools
if ! command -v gum &> /dev/null; then
echo "Error: 'gum' is not installed."
exit 1
fi
if ! command -v wit &> /dev/null; then
gum style --foreground "$ORANGE" "Error: 'wit' (Wiimms ISO Tools) is not installed."
exit 1
fi
# 2. Aesthetic Header
clear
gum style \
--border double \
--border-foreground "$ORANGE" \
--foreground "$ORANGE" \
--margin "1 2" \
--padding "1 4" \
--align center \
--width 50 \
"NINTENDO USB LOADER"
# 3. Mode Selection
gum style --foreground "$GREY" " > Select the console format:"
MODE=$(gum choose --cursor.foreground "$ORANGE" "Wii (WBFS)" "GameCube (ISO)")
[ -z "$MODE" ] && exit 1
# 4. Source Selection
gum style --foreground "$GREY" " > Select the directory containing your $MODE files"
ISO_DIR=$(gum file --directory)
[ -z "$ISO_DIR" ] && exit 1
# 5. USB Selection
USER_MEDIA="/run/media/$USER"
if [ ! -d "$USER_MEDIA" ] || [ -z "$(ls -A "$USER_MEDIA" 2>/dev/null)" ]; then
gum style --foreground 196 " No USB drives detected in $USER_MEDIA"
exit 1
fi
gum style --foreground "$GREY" " > Select your destination USB drive"
pushd "$USER_MEDIA" > /dev/null
SELECTED_DRIVE=$(gum choose --cursor.foreground "$ORANGE" *)
popd > /dev/null
[ -z "$SELECTED_DRIVE" ] && exit 1
USB_DIR="$USER_MEDIA/$SELECTED_DRIVE"
# 6. Final Summary and Confirmation
clear
gum style --foreground "$ORANGE" "Ready to Process $MODE"
echo -e " \033[90mSource: \033[0m $ISO_DIR"
echo -e " \033[90mTarget: \033[0m $USB_DIR"
echo ""
gum confirm --selected.background "$ORANGE" "Begin transfer?" || exit 0
# 7. Processing Loop
clear
gum style --foreground "$ORANGE" "Processing $MODE titles..."
echo ""
shopt -s nullglob
isos=("$ISO_DIR"/*.iso)
for iso_path in "${isos[@]}"; do
filename=$(basename "$iso_path")
if [ "$MODE" == "Wii (WBFS)" ]; then
# --- WII LOGIC ---
gum spin --spinner dot --title.foreground "$GREY" --title "Converting: $filename..." -- \
wit copy "$iso_path" --wbfs --split --dest "$USB_DIR/wbfs/%T [%I]/%I.wbfs"
if [ $? -eq 0 ]; then
gum style --foreground "$ORANGE" "$filename"
else
gum style --foreground 196 " ✘ Failed: $filename"
fi
else
# --- GAMECUBE LOGIC ---
# 1. Get Game ID (Using tail -n 1 to avoid header/color codes)
game_id=$(wit id "$iso_path" 2>/dev/null | tail -n 1 | awk '{print $1}')
# 2. Get Title from filename and sanitize for FAT32
game_title="${filename%.*}"
clean_title=$(echo "$game_title" | tr -d ':/\\*?<>|')
# 3. Create destination path
DEST_FOLDER="$USB_DIR/games/$clean_title [$game_id]"
# Validate ID before attempting
if [[ ! "$game_id" =~ ^[A-Z0-9]{6}$ ]]; then
gum style --foreground 196 " ✘ Failed: $filename (Invalid Game ID)"
continue
fi
# 4. Perform Folder Creation and Copy with Spinner
gum spin --spinner dot --title.foreground "$GREY" --title "Moving: $clean_title..." -- \
bash -c 'mkdir -p "$1" && cp "$2" "$1/game.iso"' _ "$DEST_FOLDER" "$iso_path"
if [ $? -eq 0 ]; then
gum style --foreground "$ORANGE" "$clean_title"
else
gum style --foreground 196 " ✘ Failed: $clean_title"
fi
fi
done
# 8. Finished
echo ""
gum style \
--border rounded \
--border-foreground "$GREY" \
--foreground "$ORANGE" \
--padding "1 2" \
"COMPLETE: Games synced to $SELECTED_DRIVE"