Skip to content
SirNapkin1334 edited this page Apr 16, 2018 · 23 revisions

GodMode9 is a large and complicated program, which since release v1.2.7 has had support for Scripting. Scripts are formatted in plaintext with a .gm9 file extension, and allow the automation of many complex things.

Running a Script

To run a GodMode9 script, all one must do is place the script file in the /gm9/scripts folder on the SD card. Then, in GodMode9, press the HOME button, press on Scripts... and select the script that you would like to run. One can also place the script anywhere on the SD (or any other drive, for that matter), and press A on the script file. There will be the option to Execute GM9 Script. You will get another prompt (are you sure you would like to execute this script?), press A there, and then the script will be run.

Basics

GodMode9 script resembles shell script. Comments are denoted by # and work anywhere. Variable are in the format $[VAR] where VAR is the name of the variable. (i.e. $[HAX]). Surround an argument with " if it must contain whitespaces. Any redundant whitespaces outside of " will be treated as a single whitespace. An unknown command will lead to script abort.

Commands

A short description of every command. Click on the command to go to a more detailed page about it. <> Denotes a required parameter. [] denotes an optional parameter.

echo command - Outputs data to the screen. Syntax: echo "<text to be outputted>" Example: echo "Hello There!"

chk command - Checks two values against each other. Syntax: chk <value1> <value2> Example: chk $[HAX] a9lh

[more to come ofc]

Environmental Variables

Environmental Variables are variables that are always available, no matter what. They are determined when GodMode9 boots, and cannot be changed via scripting commands. Remember, when including a variable in a command, use $[VAR] where VAR is the name of the variable (i.e. $[HAX]).

GM9VER - the version of the currently running GodMode9 firm. (i.e. v5.0.0) REGION - the region of the console's SysNAND. (can be USA, EUR, JPN, KOR, CHN, TWN, or UNK for unknown) SERIAL - the serial of the console's SysNAND, not including Check Digit. (i.e. CW13701547) GM9OUT - the standard output path (i.e. 0:/gm9/out) CURRDIR - the directory the script is running from (i.e. 0:/gm9/scripts) HAX - the exploit the system is running from (can be ntrboot, sighax, a9lh, or (empty, would be "")) ONTYPE (stands for Old/NewTYPE) - the console type. (O3DS or N3DS) RDTYPE (stands for Retail/DevTYPE) - the unit type. (retail or devkit) SYSID0 - ID0 of SysNAND. EMUID0 - ID0 of EmuNAND (if available). TIMESTAMP - the current time in hhmmss format (based on RTC). DATESTAMP - the current date in YYMMDD format (based on RTC).

Clone this wiki locally