Last active
August 6, 2021 05:44
-
-
Save DNA64/5382263912f991023385b1f57bc2f63a to your computer and use it in GitHub Desktop.
Modify your game-and-watch-flashloader and game-and-watch-retro-go installations to allow flashing of flash memory chips 128Mb (16MB) or smaller
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 | |
# Attention! - This script is now obsolete with the latest build of game-and-watch-retro-go. | |
# This script will modify your game-and-watch-flashloader and game-and-watch-retro-go installation | |
# to only allow flashing of flash memory chips 128Mb (16MB) or smaller. You only need to run this IF | |
# you have run the 32bit_patch.sh file, even then, it's not required to flash smaller chips. | |
# This patch MUST be applied BEFORE you build flashloader! | |
# The patch must be run from the same directory containing the game-and-watch-retro-go folder and game-and-watch-flashloader folder. | |
# Get the latest updated patch here: https://gist.github.com/DNA64/5382263912f991023385b1f57bc2f63a | |
# Are we in the right place? | |
if ! test -d game-and-watch-flashloader; then | |
echo "Error! - Cannot locate the game-and-watch-flashloader folder..." | |
echo "Are you sure you're running this script in the right directory?" | |
exit 1 | |
fi | |
if ! test -d game-and-watch-retro-go; then | |
echo "Error! - Cannot locate the game-and-watch-retro-go folder..." | |
echo "Are you sure you're running this script in the right directory?" | |
exit 1 | |
fi | |
sed -i 's/HAL_OSPI_ADDRESS_32_BITS;/HAL_OSPI_ADDRESS_24_BITS;/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0xDC/0xD8/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0x5C/0x52/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0x21/0x20/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0x12/0x02/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0x3E/0x38/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0x0C/0x0B/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/0xEC/0xEB/' game-and-watch-flashloader/Core/Src/flash.c | |
sed -i 's/uint32_t program_device_size = 26;/uint32_t program_device_size = 24;/' game-and-watch-flashloader/Core/Src/main.c | |
sed -i 's/EXTFLASH_SIZE ?= 67108864/EXTFLASH_SIZE ?= 16777216/' game-and-watch-retro-go/Makefile.common | |
sed -i 's/HAL_OSPI_ADDRESS_32_BITS;/HAL_OSPI_ADDRESS_24_BITS;/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0xDC/0xD8/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0x5C/0x52/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0x21/0x20/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0x12/0x02/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0x3E/0x38/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0x0C/0x0B/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/0xEC/0xEB/' game-and-watch-retro-go/Core/Src/gw_flash.c | |
sed -i 's/hospi1.Init.DeviceSize = 26/hospi1.Init.DeviceSize = 24/' game-and-watch-retro-go/Core/Src/main.c | |
echo "Abracadabra! All done!" | |
sleep 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment