Skip to content

Instantly share code, notes, and snippets.

@bkacjios
Created February 25, 2025 18:02
Show Gist options
  • Save bkacjios/f4231f5c2b44976597b030887332c73a to your computer and use it in GitHub Desktop.
Save bkacjios/f4231f5c2b44976597b030887332c73a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Define color codes
RED="\e[31m"
YELLOW="\e[33m"
GREEN="\e[32m"
CYAN="\e[36m"
RESET="\e[0m"
# Define the filename of the EXE
exe_file="KILLlaKILL_IF.exe"
# Check if the executable exists in the current directory
if [ ! -f "$exe_file" ]; then
echo -e "${RED}Error: $exe_file not found in the current directory!${RESET}"
exit 1
fi
# Define the hex patterns
original_hex="cc08c89088010000"
patched_hex="cc08c89000000000"
# Check for the patterns in the executable
if xxd -p "$exe_file" | grep -q "$original_hex"; then
echo -e "${GREEN}The executable contains the original launcher style.${RESET}"
read -p "Would you like to patch it to work on the steam deck? (y/n): " choice
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
cp "$exe_file" "${exe_file}.bak" # Backup before modifying
echo -e "${CYAN}Backup created: ${exe_file}.bak${RESET}"
xxd -p "$exe_file" | sed "s/$original_hex/$patched_hex/g" | xxd -r -p > "${exe_file}.patched"
mv "${exe_file}.patched" "$exe_file"
echo -e "${GREEN}The executable has been patched.${RESET}"
else
echo "No changes made."
fi
elif xxd -p "$exe_file" | grep -q "$patched_hex"; then
echo -e "${YELLOW}Warning: The executable is already patched so the launcher works on the steam deck.${RESET}"
read -p "Would you like to unpatch it? (y/n): " choice
if [[ "$choice" == "y" || "$choice" == "Y" ]]; then
cp "$exe_file" "${exe_file}.bak" # Backup before modifying
echo -e "${CYAN}Backup created: ${exe_file}.bak${RESET}"
xxd -p "$exe_file" | sed "s/$patched_hex/$original_hex/g" | xxd -r -p > "${exe_file}.unpatched"
mv "${exe_file}.unpatched" "$exe_file"
echo -e "${GREEN}The executable has been unpatched.${RESET}"
else
echo "No changes made."
fi
else
echo -e "${RED}Error: Neither the original nor patched value was found in the executable.${RESET}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment