From 326c5f50e4b713caa425676ee12df47793644ae2 Mon Sep 17 00:00:00 2001 From: Parthiv Vora <6434386+TheRealPSV@users.noreply.github.com> Date: Wed, 22 Apr 2020 02:03:43 -0400 Subject: [PATCH] Add Python script for generating normal AR codes --- GameCube-Action-Replay-Code-Types.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/GameCube-Action-Replay-Code-Types.md b/GameCube-Action-Replay-Code-Types.md index 7e4b1e1..456bea9 100644 --- a/GameCube-Action-Replay-Code-Types.md +++ b/GameCube-Action-Replay-Code-Types.md @@ -186,6 +186,20 @@ Size = (ADDRESS >> 25) AND 0x03 usually, size 0 = 8-bit, size 1 = 16-bit, size 2 = 32-bit. For some codes, Size 3 = Floating point single precision. +#### Code Generation Python Script + +You can use the below Python code (requires Python 3.6 or higher) to quickly generate an address for a normal Action Replay code. + +``` +typeVal = int(input("Enter Type Number: ")) +subtypeVal = int(input("Enter Subtype Number: ")) +sizeVal = int(input("Enter Size Number: ")) +address = int(input("Enter memory address without base 0x8000000 value in format `0x1234567`: "), 16) + +result = ((subtypeVal) << 30) + ((typeVal) << 27) + ((sizeVal) << 25) + address +print('{0:0{1}X}'.format(result, 8)) +``` + ### Type 0 #### Subtype 0 – RAM write and fill (can be called "00", "01" and "02")