i ordered a mig switch but it hasnt arrived yet. hopefully it will arrive soon. i had chatgpt write a python script to modify the xci file, to allow you to use pretty much any initial data bin file with any xci. maybe someone can test it for me. if not i will be trying once i get my mig switch, i just got my shipping notification so heres to that.
chatgpt wrote 2 other scripts that tried to generate an intial data file, but that was futile because i think the initial data bin is signed. so instead my thought is to update the xci only.
if this works it could open up modding on original switches using only the mig switch.
but this script is based off the following information i found in a youtube comment:
the initial data contains 2 parts the first 8 bytes are the header, which is found in the xci. and the second part is the challenge response which allows the cart to enter secure mode in the cartslot. the sha256 hash of the whole initial data file can found in the xci as well. my thought was to reuse the challenge response, since dev carts can use a common response. the script is supposed to update the xci with the new sha256 hash and the 8 byte header from the initial data bin.
the modified xci still plays in an emulator just fine. but i cant test it on mig switch till mine arrives.
Python:
import hashlib
import zlib
import argparse
def update_game_xci_with_initial_data(game_bin_path, initial_data_path):
with open(initial_data_path, 'rb') as initial_data_bin:
initial_data_content = initial_data_bin.read()
# Extract the relevant data from initial_data.bin that needs to be matched in game.xci
data_to_match = initial_data_content[0x0:0x8] # For example, the first 8 bytes
# Update game.xci with the extracted data
with open(game_bin_path, 'r+b') as game_bin:
game_bin.seek(0x110) # Assuming the data needs to be updated at offset 0x110
game_bin.write(data_to_match)
with open(initial_data_path, 'rb') as initial_data_bin:
initial_data_bin_content = initial_data_bin.read()
new_sha256 = hashlib.sha256(initial_data_bin_content).digest()
with open(game_bin_path, 'r+b') as game_bin:
# Update game.xci with new SHA256
game_bin.seek(0x160)
game_bin.write(new_sha256)
def main():
parser = argparse.ArgumentParser(description="Update game.xci to match data from initial_data.bin")
parser.add_argument("game_bin_path", help="Path to the game.xci file")
parser.add_argument("initial_data_path", help="Path to the initial_data.bin file")
args = parser.parse_args()
update_game_xci_with_initial_data(args.game_bin_path, args.initial_data_path)
print('game.xci has been updated.')
if __name__ == "__main__":
main()