mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
Added REGION variable for scripting (fix #243)
This commit is contained in:
parent
05ca9109de
commit
45d620bf72
@ -29,6 +29,7 @@ ask "Continue running this script?"
|
|||||||
ask -o -s "Really continue running this script?\n(I will completely ignore your answer)"
|
ask -o -s "Really continue running this script?\n(I will completely ignore your answer)"
|
||||||
|
|
||||||
# ENVIRONMENTAL VARS
|
# ENVIRONMENTAL VARS
|
||||||
|
# REGION is the region of your device's SysNAND (USA, EUR, JPN, KOR, CHN, TWN or UNK for unknown)
|
||||||
# SERIAL is the serial number of your device
|
# SERIAL is the serial number of your device
|
||||||
# GM9OUT is the standard output path
|
# GM9OUT is the standard output path
|
||||||
# CURRDIR is the directory the script is running from
|
# CURRDIR is the directory the script is running from
|
||||||
@ -40,8 +41,8 @@ ask -o -s "Really continue running this script?\n(I will completely ignore your
|
|||||||
# TIMESTAMP is the current time in hhmmss format
|
# TIMESTAMP is the current time in hhmmss format
|
||||||
# DATESTAMP is the current date in YYMMDD format
|
# DATESTAMP is the current date in YYMMDD format
|
||||||
# Use $[VAR] to get the *content* of a variable VAR
|
# Use $[VAR] to get the *content* of a variable VAR
|
||||||
echo "Your serial number is $[SERIAL]\nYour std output path is $[GM9OUT]\nCurrent dir is $[CURRDIR]\nCurrent hax is $[HAX]\nYour system is a $[RDTYPE] $[ONTYPE]\nCurrent datestamp is: $[DATESTAMP]\nCurrent timestamp is: $[TIMESTAMP]\n \nYour sys / emu ID0 is:\n$[SYSID0]\n$[EMUID0]"
|
echo "Your region is $[REGION]\nYour serial number is $[SERIAL]\nYour std output path is $[GM9OUT]\nCurrent dir is $[CURRDIR]\nCurrent hax is $[HAX]\nYour system is a $[RDTYPE] $[ONTYPE]\nCurrent datestamp is: $[DATESTAMP]\nCurrent timestamp is: $[TIMESTAMP]\n \nYour sys / emu ID0 is:\n$[SYSID0]\n$[EMUID0]"
|
||||||
qr "You can also have this as a QR code :)" "Your serial number is $[SERIAL]\nYour std output path is $[GM9OUT]\nCurrent dir is $[CURRDIR]\nCurrent hax is $[HAX]\nYour system is a $[RDTYPE] $[ONTYPE]\nCurrent datestamp is: $[DATESTAMP]\nCurrent timestamp is: $[TIMESTAMP]\n \nYour sys / emu ID0 is:\n$[SYSID0]\n$[EMUID0]"
|
qr "You can also have this as a QR code :)" "Your region is $[REGION]\nYour serial number is $[SERIAL]\nYour std output path is $[GM9OUT]\nCurrent dir is $[CURRDIR]\nCurrent hax is $[HAX]\nYour system is a $[RDTYPE] $[ONTYPE]\nCurrent datestamp is: $[DATESTAMP]\nCurrent timestamp is: $[TIMESTAMP]\n \nYour sys / emu ID0 is:\n$[SYSID0]\n$[EMUID0]"
|
||||||
|
|
||||||
# ERRORMSG and SUCCESSMSG / 'set' COMMAND
|
# ERRORMSG and SUCCESSMSG / 'set' COMMAND
|
||||||
# These two are special environment vars, allowing you to control the message on script failure or success
|
# These two are special environment vars, allowing you to control the message on script failure or success
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "sha.h"
|
#include "sha.h"
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
#include "region.h"
|
||||||
|
|
||||||
#define _MAX_ARGS 3
|
#define _MAX_ARGS 3
|
||||||
#define _ARG_MAX_LEN 512
|
#define _ARG_MAX_LEN 512
|
||||||
@ -267,13 +268,22 @@ char* set_var(const char* name, const char* content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void upd_var(const char* name) {
|
void upd_var(const char* name) {
|
||||||
// device serial
|
// device serial / region
|
||||||
if (!name || (strncmp(name, "SERIAL", _VAR_NAME_LEN) == 0)) {
|
if (!name || (strncmp(name, "SERIAL", _VAR_NAME_LEN) == 0) ||
|
||||||
char env_serial[16] = { 0 };
|
(strncmp(name, "REGION", _VAR_NAME_LEN) == 0)) {
|
||||||
if ((FileGetData("1:/rw/sys/SecureInfo_A", (u8*) env_serial, 0xF, 0x102) != 0xF) &&
|
u8 secinfo_data[1 + 1 + 16] = { 0 };
|
||||||
(FileGetData("1:/rw/sys/SecureInfo_B", (u8*) env_serial, 0xF, 0x102) != 0xF))
|
char* env_serial = (char*) secinfo_data + 2;
|
||||||
|
char env_region[3 + 1];
|
||||||
|
|
||||||
|
snprintf(env_region, 0x4, "UNK");
|
||||||
|
if ((FileGetData("1:/rw/sys/SecureInfo_A", secinfo_data, 0x11, 0x100) != 0x11) &&
|
||||||
|
(FileGetData("1:/rw/sys/SecureInfo_B", secinfo_data, 0x11, 0x100) != 0x11))
|
||||||
snprintf(env_serial, 0xF, "UNKNOWN");
|
snprintf(env_serial, 0xF, "UNKNOWN");
|
||||||
|
else if (*secinfo_data < SMDH_NUM_REGIONS)
|
||||||
|
strncpy(env_region, g_regionNamesShort[*secinfo_data], countof(env_region));
|
||||||
|
|
||||||
set_var("SERIAL", env_serial);
|
set_var("SERIAL", env_serial);
|
||||||
|
set_var("REGION", env_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
// device sysnand / emunand id0
|
// device sysnand / emunand id0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user