* Initial TScript v2 commit

* Fix || issue

* another formatting issue

* small spelling fixes

* destenationexplorer intensifies

* write fwDump.te

* add timer to fwdump

* add old stuff back

Co-authored-by: suchmememanyskill <suchmememanyskill@users.noreply.github.com>
This commit is contained in:
suchmememanyskill 2021-01-05 16:55:48 +01:00 committed by GitHub
parent 7b7135bae3
commit b4c300f315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1185 additions and 729 deletions

324
README.md
View File

@ -1,163 +1,217 @@
# TegraScript
The scripting language of TegraExplorer
## Functions
Notice: TegraScript v2 is entirely different than v1. If you still have v1 scripts, you'll have to rewrite them.
Function | Args | Description | Output
|:-|:-|:-|:-|
`printf(...)` | ...: can be any count of args. Stuff like ("This ", "Is", $Pretty, @Neat) works | writes text to the screen | returns 0
`printInt(int arg1)` | arg1: Int variable to print | Displays an int variable to the screen in the format `@var: (number)` | returns 0
`setPrintPos(int arg1, int arg2)` | arg1: sets cursor position x, arg2: sets cursor position y | sets cursor to a position on the screen. Max X is 42, max Y is 78 | returns 0
`clearscreen()` | - | clears the screen | returns 0
`setColor(string arg1)` | arg1: color string. Valid args: `RED`, `ORANGE`, `YELLOW`, `GREEN`, `BLUE`, `VIOLET`, `WHITE` | Changes the color of the text printed | returns 0
`if(int arg1)` | arg1: checks if interger is true or false (not 0 or 0) | Part of flow control. Runs code inside {} | returns 0
`if(int arg1, string arg2, int arg3)` (overload) | See `check()` and the first `if()` | Part of flow control. Runs code inside {}. Accepts statements like `if (1, == , 1) {}` | returns 0
`goto(int location)` | location: interger aquired by `getLocation()` | jumps to the character offset specified. sets @RETURN based on current location | returns 0
`getPosition()` | - | Returns the current script location, for use with `goto()` | returns > 0
`math(int arg1, string arg2, int arg3)` | arg1 "operator arg2" arg3. Valid operators (arg2s): `"+"`, `"-"`, `"*"`, `"/"` | Does a math operation and returns the result | returns the result of the math operation
`check(int arg1, string arg2, int arg3)` | arg1 "operator arg2" arg3. Valid operators (arg2s): `"=="`, `"!="`, `">="`, `"<="`, `">"`, `"<"` | Does a check and returns the result. result is either 0 or 1 | returns 0 or 1
`invert(int arg1)` | - | makes non 0 integers a 0, and vise versa | returns 0 or 1
`setInt(int arg1)` | - | returns arg1, for setting of variables | returns arg1
`setString(string in, $svar out)` | $svar is a string variable, written as `$var` | copies in to out | returns 0
`setStringIndex(int in, $svar out)` | looks up earlier defined strings in order. User defined strings start at index 1. $svar is a string variable | Copies string table index to out | returns 0
`combineStrings(string s1, string s2, $svar out)` | $svar is a string variable | combines s1 and s2 (as s1s2) and copies it into out | returns 0
`compareStrings(string s1, string s2)` | - | compares s1 to s2. If they are the same, the function returns 1, else 0 | returns 0 or 1
`subString(string in, int startoffset, int size, $svar out)` | in: input string. startoffset: starting offset, 0 is the beginning of the string. size: length to copy, -1 copies the rest of the string. out: output var | Copies part of a string into another string | returns 0
`inputString(string startText, int maxlen, $svar out)` | startText: Starting input text. maxlen: Maximum allowed characters to enter. out: output var | Displays an input box for the user to input text. Note, only works with joycons attached! | returns 1 if user cancelled the input, 0 if success
`stringLength(string in)` | - | Gets the length of the input string | returns the length of the input string
`pause()` | - | pauses the script until it recieves user input. result will be copied into `@BTN_POWER`, `@BTN_VOL+`, `@BTN_VOL-`, `@BTN_A`, `@BTN_B`, `@BTN_X`, `@BTN_Y`, `@BTN_UP`, `@BTN_DOWN`, `@BTN_LEFT` and `@BTN_RIGHT` | returns >0
`wait(int arg1)` | arg1: amount that it waits | waits for the given amount of time, then continues running the script | returns 0
`exit()` | - | exits the script | -
`fs_exists(string path)` | path: full path to file | check if a file exists. 1 if it exists, 0 if it doesn't | returns 0 or 1
`fs_move(string src, string dst)` | src/dst: full path to file | move file from src to dst | returns >= 0
`fs_mkdir(string path)` | path: full path to file | creates a directory at the given path (note: returns 8 if the folder already exists | returns >= 0
`fs_del(string path)` | path: full path to file | deletes a file (or empty directory) | returns >= 0
`fs_delRecursive(string path)` | path: full path to folder | deletes a folder with all subitems | returns >= 0
`fs_copy(string src, string dst)` | src/dst: full path to file | copies a file from src to dst | returns >= 0
`fs_copyRecursive(string src, string dst)` | src/dst: full path to file | copies a folder with subitems from src to dst (note that dst is the parent folder, src will be copied to dst/src) | returns >= 0
`fs_openDir(string path)` | path: full path to folder | opens a directory for use with `fs_readDir()` and sets `@ISDIRVALID` to 1 | returns >= 0
`fs_closeDir()` | - | closes current open directory and sets `@ISDIRVALID` to 0 | returns 0
`fs_readDir()` | - | reads entry out of dir. Atomatically calls `fs_closeDir()` if the end of the dir is reached. Saves result to `$FILENAME` and `@ISDIR` | returns 0
`fs_combinePath(string left, string right, $var out)` | - | Will combine paths, like `sd:/` and `folder` to `sd:/folder`, also `sd:/folder` and `folder2` to `sd:/folder/folder2` | returns 0
`fs_extractBisFile(string path, string outfolder)` | - | take .bis and extract it into outfolder | returns >= 0
`mmc_connect(string mmctype)` | mmctype: either `SYSMMC` or `EMUMMC` | connects SYSMMC or EMUMMC to the system. Specify partition with `mmc_mount()` | returns 0
`mmc_mount(string partition)` | partition: either `SYSTEM` or `USER` | mounts partition in previously connected mmc | returns >= 0
`mmc_dumpPart(string type, string out)` | type: Either `BOOT` or a partition on the gpt. out: Out folder: for `BOOT` this needs to be a folder, otherwise a filepath | Dumps a part from the e(mu)mmc. Determined by earlier mmc_connect's | returns >= 0
`mmc_restorePart(string path)` | path: Needs to be `BOOT0`, `BOOT1` or a valid partition on the gpt. FS Partitions are not allowed | Restores a file to the e(mu)mmc. Determined by earlier mmc_connect's | returns >= 0
## General Syntax
### Variables
## Variables
Variables in TegraScript do not need explicit type definitions:
```
variable = function(arg1, arg2) # this calls function with 2 arguments: arg1 and arg2, and stores it in variable
```
TegraScript has 2 kinds of variables, @ints and $strings.
- You can define @ints by writing `@variable = setInt(0);` (or any function for that matter).
- You can define $strings with the use of `setString();`, `setStringIndex();` and `combineStrings();`.
Variables can be of the following types:
- Integer
- String
- Integer Array
- String Array
- Byte Array
You can use these variables in place of int or string inputs, so for example `@b = setInt(@a)` or `setString($a, $b)`
Creating and accessing Array variables goes as follows:
```
variable = [1,2,3,4,5] # This creates an integer array and stores it into variable
function(variable[2]) # This calls function with 1 argument, index 2 of variable, which is 3
```
Note though that the int variables can't be assigned negative values
In tegrascript, operations are evaluated from left to right. This is important for math type operations. See the operator section for what type definitions you can put operators against. As a quick primer:
```
variable = 2 + 2 * 2 # This puts 8 into variable, as the calculations get evaluated from left to right
variable = 2 + (2 * 2) # But! we can also use brackets to prioritise calculations
variable = "a" + "b" # Adding 2 strings together is also a supported operator
```
Note: Minus integer values are supported this time around
Another note: You can do !variable to flip the integer inside
Every variable in TegraScript v2 is global, thus you can access any variable in any self-defined function
### Built in variables
There are some built in variables:
- `@EMUMMC`: 1 if an emummc was found, 0 if no emummc was found
- `@RESULT`: result of the last ran function
- `@JOYCONN`: 1 if both joycons are connected, 0 if not
- `$CURRENTPATH`: Represents the current path
(if `fs_readdir()` got ran)
- `@ISDIRVALID`: Is the open directory valid
- `$FILENAME`: Represents the current filename
- `@ISDIR`: 1 if the last read file is a DIR, otherwise 0
TegraScript has 2 built in variables.
- `_CWD`, which is a string, and represents the current working directory, thus the directory the currently running script is in.
- `_EMU`, which is an int, and represents if an emummc is present. 1 for present, 0 for not present
(if `pause()` got ran)
- `@BTN_POWER`, `@BTN_VOL+`, `@BTN_VOL-`, `@BTN_A`, `@BTN_B`, `@BTN_X`, `@BTN_Y`, `@BTN_UP`, `@BTN_DOWN`, `@BTN_LEFT`: result of the `pause()` function, represents which button got pressed during the `pause()` function
When running `dirRead()` as a function, besides returning a list of filenames, also sets an integer array called `fileProperties` that holds if the representing index of the filenames is a folder or not. 1 for a folder, 0 for a file
(if `goto()` got ran)
- `@RETURN`: sets @RETURN based on current location. can be used to go back to (after) the previously ran goto()
### Functions
## Flow control
TegraScript has support for functions
You can use `if()`, `goto()` and `math()` functions to control the flow of your program. Example:
Defining and using a function goes as follows:
```
@i = setInt(0)
@LOOP = getLocation()
if (@i, <= , 10){
@i = math(@i, + , 1)
printInt(@i)
goto (@LOOP)
function = { # We are defining a function called function here, with the {}
# We put the code we want to run inside the function here
var = 1 + 2 + 3
}
pause()
function() # after running this, variable will be set to 6
```
This will print numbers 0 to 10 as `@i: x`
Another example:
But you may see an issue: there are no arguments! Fear not, as every variable in TegraScript is global. You can thus solve it with the following syntax:
```
printf("Press a button")
pause()
if (@BTN_VOL+){
printf("Vol+ has been pressed")
}
if (@BTN_VOL-){
printf("Vol- has been pressed")
}
if (@BTN_POWER){
printf("Power has been pressed")
function = {
b = a * 2 # We want to multiply a by 2 and put it into b, but how do we define a?
}
pause()
function(a = 10) # Ah! We can just define it in the function args
a = 20
function() # Or if you prefer, you can define it normally as well
```
### Flow control
TegraScript has the following functions for flow control: `if()`, `else()`, `while()`, `return()`, `exit()`
- `if()` checks it's first arg, if it's 1, it runs the next {}, otherwise it skips over it
- `else()` checks if the last statement was an if, and if that if skipped, we run the next {}
- `while()` checks it's first arg, if it's 1, it runs the next {}, and jumps back to the while
- `return()` exits the current running function, if there is one
- `exit()` exits the script entirely
Lets try to build a loop that iterates 30 times, and printing even numbers
```
i = 0
while (i < 30){ # check if i is below 30, if so, run the code between the brackets
if (i % 2 == 0){ # is i dividable by 2?
println(i)
}
i = i + 1 # don't forget the + 1 of i! otherwise an infinite loop will haunt you
}
```
## Operators
### Integer, Integer
Operator | Output
|:-|:-|
`+` | sum of both integers
`-` | integer minus integer
`*` | multiplication of both integers
`/` | integer divided by integer
`%` | integer division remainder (modulo) of integer
`<` | 1 if left is smaller, otherwise 0
`>` | 1 if left is bigger, otherwise 0
`<=`| 1 if left is smaller or equal, otherwise 0
`>=`| 1 if left is bigger or equal, otherwise 0
`==`| 1 if left and right are equal, otherwise 0
`!=`| 1 if left and right are not equal, otherwise 0
`&&`| 1 if left and right are non 0, otherwise 0. Also if output is 0, disregards rest of statement
`\|\|`| 1 if left or right are non 0, otherwise 0. Also if output is 1, disregards rest of statement
`&` | Binary operator. ANDs both integers together
`\|` | Binary operator. ORs both integers together
`<<`| Binary operator. Bitshifts the left integer to the left by right integer's amount
`>>`| Binary operator. Bitshifts the left integer to the right by right integer's amount
### String, String
Operator | Output
|:-|:-|
`+` | Adds both strings together
`==`| 1 if strings are equal, otherwise 0
`-` | Removes the end of the first string if the second string matches the end of the first. (Example: `"abcdef" - "def"` is `"abc"`)
`/` | Splits the left string based on the right string. Returns a string array
### (Integer Array, Byte Array), Integer
Operator | Output
|:-|:-|
`+` | Adds the right integer into the left array
`-` | Removes right integer amount of entries from the left array
`:` | Removes right integer amount of entries from the beginning of the left array
### String, Integer
Operator | Output
|:-|:-|
`-` | Removes right integer amount of characters from the left string
`:` | Removes right integer amount of character from the beginning of the left string
## Functions
### Flow control functions
Name | Description | OutType
|:-|:-|:-|
`if(int arg)` | Runs the next {} if arg is non zero | None
`else()` | Runs the next {} if the last statement was an if that skipped their {} | None
`while(int arg)` | Runs the next {} if arg is non zero. Jumps to the if after exiting the {} | None
`return()` | Breaks out of a function | None
`exit()` | Exits the current script | None
### Utilities
Name | Description | OutType
|:-|:-|:-|
`print(...)` | Prints all args provided to the screen. Can print Integer, String, IntegerArray. `\r` and `\n` is supported | None
`println(...)` | Same as `print(...)` but puts a newline at the end | None
`color(string color)`| Sets the print color. Supported inputs: `"RED"`, `"ORANGE"`, `"YELLOW"`, `"GREEN"`, `"BLUE"`, `"VIOLET"`, `"WHITE"` | None
`len(var arg1)` | Gets the length of a string or an array | Integer
`byte(IntegerArray arg1)`| Converts an integer array to a byte one | ByteArray
`bytesToStr(ByteArray arg1)`| Converts a byte array to a string | String
`printPos(int x, int y)` | Sets the printing position on screen. X/Y are in whole character sizes (16x16) | None
`clearscreen()` | Clears the screen full of your nonsense | None
`drawBox(int x1, int y1, int x2, int y2, int color)` | Draws a box from x1/y1 to x2/y2 with the color as color (raw: 0x00RRGGBB) | None
`wait(int ms)` | Waits for ms amount | None
`pause()` | Pauses until controller input is detected. Returns the controller input as raw u32 bitfield | Integer
`version()` | Returns an Integer array of the current TE version | IntegerArray
`menu(StringArray options, int startPos)` | Makes a menu with the cursor at startPos, with the provided options. Returns the current pos when a is pressed. B always returns 0 | Integer
`menu(StringArray options, int startPos, StringArray colors)` | Same as above, but the entries now get colors defined by the colors array. Uses the same colors as the `colors()` function | Integer
Note about `pause()`. You need to work with raw bitfields. Have an example
```
# The most common controls
JoyY = 0x1
JoyX = 0x2
JoyB = 0x4
JoyA = 0x8
LeftJoyDown = 0x10000
LeftJoyUp = 0x20000
LeftJoyRight = 0x40000
LeftJoyLeft = 0x80000
if (pause() & JoyX){
println("X has been pressed!")
}
```
### FileSystem functions
Name | Description | OutType
|:-|:-|:-|
`fileRead(string path)` | Reads the file at the given path and returns it's contents in a byte array | ByteArray
`fileWrite(string path, ByteArray data)` | Writes data to the given path. Returns non zero on error | Integer
`fileExists(string path)` | Checks if a file or folder exists at the given path. 1 if yes, otherwise 0 | Integer
`fileMove(string src, string dst)` | Moves a file from src to dst. Returns non zero on error | Integer
`fileCopy(string src, string dst)` | Copies a file from src to dst. Returns non zero on error | Integer
`fileDel(string path)` | Deletes the file located at path. Returns non zero on error | Integer
`pathCombine(...)` | Needs 2+ string args as input. Combines them into a path. First entry must be the source folder Example: `pathCombine("sd:/", "tegraexplorer")` -> `"sd:/tegraexplorer"` | String
`pathEscFolder(string path)`| Escapes a folder path. Example: `pathEscFolder("sd:/tegraexplorer")` -> `"sd:/"` | String
`dirRead(string path)` | Reads a folder and returns a StringArray of filenames. Also creates an IntegerArray called `fileProperties` that is the same length as the filenames, and is non zero if the index of the filename is a folder | StringArray
`dirCopy(string src, string dst)`| Copies a folder from src to dst. Dst needs to be the containing folder of where you want src to go (`"sd:/tegraexplorer", "sd:/backup` -> `"sd:/backup/tegraexplorer"`). Returns non zero on error | Integer
`dirDel(string path)` | Deletes the dir located at path. Returns non zero on error | Integer
`mkdir(string path)` | Makes a directory at path | Integer
### Storage functions !! Dangerous
Name | Description | OutType
|:-|:-|:-|
`mmcConnect(string loc)` | Loc can be `"SYSMMC"` or `"EMUMMC"`. Returns non zero on error | Integer
`mmcMount(string loc)` | Loc can be `"PRODINFOF"`, `"SAFE"`, `"SYSTEM"` and `"USER"`. Mounts the filesystem to the prefix `bis:/`. Returns non zero on error | Integer
`mmcDump(string path, string target)`| Dumps target to path. target can be anything in the EMMC menu in TE. Returns non zero on error | Integer
`mmcRestore(string path, string target, int force)`| Restores path to target. target can be anything in the EMMC menu in TE. Force forces smaller files to flash anyway. Returns non zero on error | Integer
`ncaGetType(string path)`| Returns the type of nca that is in path. Make sure you provide an nca and nothing else! Useful for differentiating between Meta and Non-Meta Nca's | Integer
`saveSign(string path)` | Signs the (system) save at the given location. Make sure you provide a save and nothing else! Returns non zero on error | Integer
# Changelog
5/1/2021 @ 1:32am // Sleep is still a lie
#### 29/05/2020
*It's midnight already? i just got started*
With the release of TegraExplorer v2.0.3, the arg parser has been changed. If you find any bugs, please make an issue in either the TegraExplorer repository, or here.
3 new commands have been added
- subString()
- inputString()
- stringLength()
2 new built in variables has been added
- @JOYCONN (1 when both joycons are connected, 0 when at least 1 joycon is disconnected)
- @RETURN (Read on for how this works)
Minus values are now considered valid by the scripting language, but, printing them will not work well (the print function can only print u32's)
Errors have been significantly improved. There are now 2 types of errors, ERR IN FUNC, which indicates a scripting function failed, and SCRIPT LOOKUP FAIL, which means the function you inserted doesn't exist (can also mean the wrong amount of args were supplied). The Loc value on the error screen now shows the line number it failed at, rather than the character offset
Goto functions now generate a variable called @RETURN, which, will return to after the goto. This aids in the making of pseudo-functions. Example:
```
@functionsActive = setInt(0)
@friiFunction = getPosition()
if (@functionsActive) {
printf("Hi this is a function, i think")
goto(@RETURN)
}
@functionsActive = setInt(1)
goto(@friiFunction)
pause()
```
#### 03/05/2020
*God fucking dammit it's 2am again*
With the release of TegraExplorer v2.0.0, the pause() function changed. It adds some buttons from controllers if they are connected. See the pause() section above to see what buttons are mapped. Note that if no joycons are connected, power = a, up = vol+, down = vol-. Also note that the screen dimentions have changed, so your text might not fit anymore.
#### 26/04/2020
With the release of TegraExplorer v1.5.2, there has been 1 new feature implemented.
printf() now can print multiple variables. `printf("This ", "Is", $Pretty, @Neat)` is valid syntax now
#### 12/04/2020
With the release of TegraExplorer v1.5.1, there has been some breaking changes. `?LOOP` and `goto(?LOOP)` is no longer valid syntax. Replace this with `@LOOP = getPosition()` and `goto(@LOOP)`.
Other than this, `@check = check(1, "==", 1) if (@check) {}` can be simplified to `if (1, == , 1) {}`. For `math()` functions, you don't have to enclose operators in "" anymore (just like check/if), like `@math = math(1, + , 1)`
Initial writeup on TScript v2

117
scripts/fwDump.te Normal file
View File

@ -0,0 +1,117 @@
versionNcas = ["56211c7a5ed20a5332f5cdda67121e37.nca","594c90bcdbcccad6b062eadba0cd0e7e.nca","4e43d8b63713039fd87b410e7e1422c2.nca","a7b99eb98d2113824d2b87bce12527ba.nca","c07c0ffb0a2c3155a7ecf2f5b3a28bb6.nca","34728c771299443420820d8ae490ea41.nca","5b1df84f88c3334335bbb45d8522cbb4.nca","e951bc9dedcd54f65ffd83d4d050f9e0.nca","36ab1acf0c10a2beb9f7d472685f9a89.nca","5625cdc21d5f1ca52f6c36ba261505b9.nca","09ef4d92bb47b33861e695ba524a2c17.nca","c5fbb49f2e3648c8cfca758020c53ecb.nca","fd1ffb82dc1da76346343de22edbc97c.nca","a6af05b33f8f903aab90c8b0fcbcc6a4.nca","7eedb7006ad855ec567114be601b2a9d.nca","6c5426d27c40288302ad616307867eba.nca","4fe7b4abcea4a0bcc50975c1a926efcb.nca","e6b22c40bb4fa66a151f1dc8db5a7b5c.nca","c613bd9660478de69bc8d0e2e7ea9949.nca","6dfaaf1a3cebda6307aa770d9303d9b6.nca","1d21680af5a034d626693674faf81b02.nca","663e74e45ffc86fbbaeb98045feea315.nca","258c1786b0f6844250f34d9c6f66095b.nca","286e30bafd7e4197df6551ad802dd815.nca","fce3b0ea366f9c95fe6498b69274b0e7.nca","c5758b0cb8c6512e8967e38842d35016.nca","7f5529b7a092b77bf093bdf2f9a3bf96.nca","faa857ad6e82f472863e97f810de036a.nca","77e1ae7661ad8a718b9b13b70304aeea.nca","d0e5d20e3260f3083bcc067483b71274.nca","f99ac61b17fdd5ae8e4dda7c0b55132a.nca","704129fc89e1fcb85c37b3112e51b0fc.nca","9a78e13d48ca44b1987412352a1183a1.nca","7bef244b45bf63efb4bf47a236975ec6.nca","d1c991c53a8a9038f8c3157a553d876d.nca","7f90353dff2d7ce69e19e07ebc0d5489.nca","e9b3e75fce00e52fe646156634d229b4.nca","7a1f79f8184d4b9bae1755090278f52c.nca","a1b287e07f8455e8192f13d0e45a2aaf.nca"]
exfatNcas = ["0fd89afc0d0f1ee7021084df503bcc19.nca","c70785465de83c7feed3ae28139b5063.nca","be8a259f84590c0ad9aa78312ed1e9fe.nca","3df13daa7f553c8fa85bbff79a189d6c.nca","3df13daa7f553c8fa85bbff79a189d6c.nca","d5bc167565842ee61f9670d23759844d.nca","d5bc167565842ee61f9670d23759844d.nca","d5bc167565842ee61f9670d23759844d.nca","d5bc167565842ee61f9670d23759844d.nca","d5bc167565842ee61f9670d23759844d.nca","2416b3794964b3482c7bc506d12c44df.nca","c9bd4eda34c91a676de09951bb8179ae.nca","3b444768f8a36d0ddd85635199f9676f.nca","3b444768f8a36d0ddd85635199f9676f.nca","96f4b8b729ade072cc661d9700955258.nca","b2708136b24bbe206e502578000b1998.nca","b2708136b24bbe206e502578000b1998.nca","02a2cbfd48b2f2f3a6cec378d20a5eff.nca","58c731cdacb330868057e71327bd343e.nca","97cb7dc89421decc0340aec7abf8e33b.nca","d5186022d6080577b13f7fd8bcba4dbb.nca","d5186022d6080577b13f7fd8bcba4dbb.nca","d5186022d6080577b13f7fd8bcba4dbb.nca","711b5fc83a1f07d443dfc36ba606033b.nca","c9e500edc7bb0fde52eab246028ef84c.nca","432f5cc48e6c1b88de2bc882204f03a1.nca","432f5cc48e6c1b88de2bc882204f03a1.nca","432f5cc48e6c1b88de2bc882204f03a1.nca","458a54253f9e49ddb044642286ca6485.nca","090b012b110973fbdc56a102456dc9c6.nca","090b012b110973fbdc56a102456dc9c6.nca","e7dd3c6cf68953e86cce54b69b333256.nca","17f9864ce7fe3a35cbe3e3b9f6185ffb.nca","9e5c73ec938f3e1e904a4031aa4240ed.nca","4a94289d2400b301cbe393e64831f84c.nca","4a94289d2400b301cbe393e64831f84c.nca","4a94289d2400b301cbe393e64831f84c.nca","f55a04978465ebf5666ca93e21b26dd2.nca","3b7cd379e18e2ee7e1c6d0449d540841.nca"]
versionNames = ["11.0.1","11.0.0","10.2.0","10.1.1","10.1.0","10.0.4","10.0.3","10.0.2","10.0.1","10.0.0","9.2.0","9.1.0","9.0.1","9.0.0","8.1.0","8.0.1","8.0.0","7.0.1","7.0.0","6.2.0","6.1.0","6.0.1","6.0.0","6.0.0(pre-release)","5.1.0","5.0.2","5.0.1","5.0.0","4.1.0","4.0.1","4.0.0","3.0.2","3.0.1","3.0.0","2.3.0","2.2.0","2.1.0","2.0.0","1.0.0"]
# check tid = 0100000000000809, type data
# exfat tid = 010000000000081B, type data
println("Tegrascript firmware checker/dumper\n")
if (_EMU) {
menuOptions = ["Exit", "Sysmmc", "Emummc"]
}
else() {
menuOptions = ["Exit", "Sysmmc"]
}
print("Check on: ")
res = menu(menuOptions, 0)
clearscreen()
if (res == 0){
exit()
}
if (res == 1){
println("Mounting Sysmmc")
mount = mmcConnect("SYSMMC")
}
if (res == 2){
println("Mounting Emummc")
mount = mmcConnect("EMUMMC")
}
if (mount){
println("Error connecting mmc!")
pause()
exit()
}
if (mmcMount("SYSTEM")) {
println("Failed to mount SYSTEM")
pause()
exit()
}
i = 0
found = 0
while (!found && (i < len(versionNcas))){
if (fileExists(pathCombine("bis:/Contents/registered", versionNcas[i]))){
found = 1
}
i = i + 1
}
i = i - 1
if (!found){
println("Firmware not found. Exiting!")
pause()
exit()
}
exfat = fileExists(pathCombine("bis:/Contents/registered", exfatNcas[i]))
fwName = versionNames[i]
if (exfat){
fwName = fwName + "_exFAT"
}
println("\nFirmware found!\nRunning ", fwName)
println("\nPress X to dump the current firmware, any other key to exit")
button = pause() & 0x2
if (!button){
exit()
}
start = timerMs()
println("Starting dump...\n")
color("GREEN")
baseSdPath = pathCombine("sd:/tegraexplorer/Firmware", fwName)
mkdir("sd:/tegraexplorer")
mkdir("sd:/tegraexplorer/Firmware")
mkdir(baseSdPath)
files = dirRead("bis:/Contents/registered")
i = 0
filesLen = len(files)
while (i < filesLen){
path = pathCombine("bis:/Contents/registered", files[i])
if (fileProperties[i]){
path = pathCombine(path, "00")
}
sdPath = pathCombine(baseSdPath, files[i])
if (ncaGetType(path) == 1){
sdPath = sdPath - ".nca" + ".cnmt.nca"
}
print("\r[", i + 1, " / ", filesLen, "] ", files[i])
if (fileCopy(path, sdPath)) {
color("RED")
println("\nError during copy. Exiting!")
pause()
exit()
}
i = i + 1
}
color("WHITE")
println("\n\nDone! took ", (timerMs() - start) / 1000, "s")
pause()

View File

@ -1,135 +1,122 @@
printf("TegraScript system wiper")
printf("")
printf("Press A to wipe from SYSMMC")
if (@EMUMMC){
printf("Press Y to wipe from EMUMMC")
}
printf("Press power to exit")
printf("")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
checkIfImportantSave = {
importantSaves = ["8000000000000120", "80000000000000d1", "8000000000000047"]
j = 0
important = 0
while (j < len(importantSaves)){
if (importantSaves[j] == save){
important = 1
}
j = j + 1
}
}
if (@checkInput, == , 0){
exit()
ver = version()
println("Tegrascript system wiper")
println("Running on TE ", ver)
println()
BTN_X = 0x2
if (_EMU) {
menuOptions = ["Exit", "Sysmmc", "Emummc"]
}
else() {
menuOptions = ["Exit", "Sysmmc"]
}
mmc_mount("SYSTEM")
print("Wipe from: ")
res = menu(menuOptions, 0)
if (@RESULT){
printf("System failed to mount!")
pause()
exit()
clearscreen()
if (res == 0){
exit()
}
setString("emmc:/save/", $basePath)
setColor("RED")
printf("Are you sure you want to wipe everything?")
printf("This includes:")
printf("- Saves")
printf("- Game Data")
printf("- All other data on the system")
printf("")
printf("Use this only as a last resort!")
printf("")
setColor("YELLOW")
wait(10)
printf("Press X to continue")
printf("Press any other button to exit")
pause()
if (@BTN_X, == , 0){
exit()
if (res == 1){
println("Mounting Sysmmc")
mount = mmcConnect("SYSMMC")
}
@count = setInt(1)
printf("Deleting SYSTEM saves")
if (res == 2){
println("Mounting Emummc")
mount = mmcConnect("EMUMMC")
}
fs_openDir("emmc:/save")
setColor("RED")
@LOOP = getPosition()
fs_readDir()
if (@ISDIRVALID){
combineStrings($basePath, $FILENAME, $path)
if (mount){
println("Error connecting mmc!")
pause()
exit()
}
setPrintPos(0, 20)
if (mmcMount("SYSTEM")) {
println("Failed to mount SYSTEM")
pause()
exit()
}
color("RED")
println("Are you sure you want to wipe everything?\nThis includes:\n- Saves\n- Game Data\n- All other data on the system\n\nUse this only as a last resort!")
color("YELLOW")
wait(10000)
println("Press X to continue\nPress any other button to exit")
start = pause() & BTN_X
if (!start){
color("WHITE")
exit()
}
color("WHITE")
println("Deleting SYSTEM saves")
files = dirRead("bis:/save")
i = 0
color("RED")
while (i < len(files)) {
if (!fileProperties[i]){ # checks if it's not a file
save = files[i]
checkIfImportantSave()
if (!important){
print("\rDeleting ", save)
res = fileDel(pathCombine("bis:/save", save))
if (res) {
println("\nFile deletion failed!")
pause()
exit()
}
}
}
@check = compareStrings($FILENAME, "8000000000000120")
if (@check){
goto(@LOOP)
}
@check = compareStrings($FILENAME, "80000000000000d1")
if (@check){
goto(@LOOP)
}
@check = compareStrings($FILENAME, "8000000000000047")
if (@check){
goto(@LOOP)
}
@count = math(@count, "+", 1)
printf(@count, ": ", $FILENAME)
fs_del($path)
goto(@LOOP)
i = i + 1
}
printf("")
printf("")
printf("Deleting USER")
color("WHITE")
println("\n\nDeleting USER\n")
color("RED")
mmc_mount("USER")
if (@RESULT){
printf("User failed to mount!")
pause()
exit()
if (mmcMount("USER")){
println("Failed to mount USER")
pause()
exit()
}
fs_delRecursive("emmc:/Album")
fs_mkdir("emmc:/Album")
toDel = ["Album", "Contents", "save", "saveMeta", "temp"]
fs_delRecursive("emmc:/Contents")
fs_mkdir("emmc:/Contents")
fs_mkdir("emmc:/Contents/placehld")
fs_mkdir("emmc:/Contents/registered")
i = 0
while (i < len(toDel)){
dirDel(pathCombine("bis:/", toDel[i]))
mkdir(pathCombine("bis:/", toDel[i]))
i = i + 1
}
fs_delRecursive("emmc:/save")
fs_mkdir("emmc:/save")
mkdir("bis:/Contents/placehld")
mkdir("bis:/Contents/registered")
fs_delRecursive("emmc:/saveMeta")
fs_mkdir("emmc:/saveMeta")
fs_delRecursive("emmc:/temp")
fs_mkdir("emmc:/temp")
setColor("GREEN")
printf("")
printf("")
printf("Done! press any key to exit")
pause()
exit()
color("GREEN")
println("\n\nDone!")
pause()

View File

@ -1,179 +1,179 @@
setString("a1b287e07f8455e8192f13d0e45a2aaf.nca", $100_chk)
setString("3b7cd379e18e2ee7e1c6d0449d540841.nca", $100_exfat)
setString("1.0.0", $100_version)
setString("7a1f79f8184d4b9bae1755090278f52c.nca", $200_chk)
setString("f55a04978465ebf5666ca93e21b26dd2.nca", $200_exfat)
setString("2.0.0", $200_version)
setString("e9b3e75fce00e52fe646156634d229b4.nca", $210_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $210_exfat)
setString("2.1.0", $210_version)
setString("7f90353dff2d7ce69e19e07ebc0d5489.nca", $220_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $220_exfat)
setString("2.2.0", $220_version)
setString("d1c991c53a8a9038f8c3157a553d876d.nca", $230_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $230_exfat)
setString("2.3.0", $230_version)
setString("7bef244b45bf63efb4bf47a236975ec6.nca", $300_chk)
setString("9e5c73ec938f3e1e904a4031aa4240ed.nca", $300_exfat)
setString("3.0.0", $300_version)
setString("9a78e13d48ca44b1987412352a1183a1.nca", $301_chk)
setString("17f9864ce7fe3a35cbe3e3b9f6185ffb.nca", $301_exfat)
setString("3.0.1", $301_version)
setString("704129fc89e1fcb85c37b3112e51b0fc.nca", $302_chk)
setString("e7dd3c6cf68953e86cce54b69b333256.nca", $302_exfat)
setString("3.0.2", $302_version)
setString("f99ac61b17fdd5ae8e4dda7c0b55132a.nca", $400_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $400_exfat)
setString("4.0.0", $400_version)
setString("d0e5d20e3260f3083bcc067483b71274.nca", $401_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $401_exfat)
setString("4.0.1", $401_version)
setString("77e1ae7661ad8a718b9b13b70304aeea.nca", $410_chk)
setString("458a54253f9e49ddb044642286ca6485.nca", $410_exfat)
setString("4.1.0", $410_version)
setString("faa857ad6e82f472863e97f810de036a.nca", $500_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $500_exfat)
setString("5.0.0", $500_version)
setString("7f5529b7a092b77bf093bdf2f9a3bf96.nca", $501_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $501_exfat)
setString("5.0.1", $501_version)
setString("c5758b0cb8c6512e8967e38842d35016.nca", $502_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $502_exfat)
setString("5.0.2", $502_version)
setString("fce3b0ea366f9c95fe6498b69274b0e7.nca", $510_chk)
setString("c9e500edc7bb0fde52eab246028ef84c.nca", $510_exfat)
setString("5.1.0", $510_version)
setString("286e30bafd7e4197df6551ad802dd815.nca", $600pre_chk)
setString("711b5fc83a1f07d443dfc36ba606033b.nca", $600pre_exfat)
setString("6.0.0(pre-release)", $600pre_version)
setString("258c1786b0f6844250f34d9c6f66095b.nca", $600_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $600_exfat)
setString("6.0.0", $600_version)
setString("663e74e45ffc86fbbaeb98045feea315.nca", $601_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $601_exfat)
setString("6.0.1", $601_version)
setString("1d21680af5a034d626693674faf81b02.nca", $610_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $610_exfat)
setString("6.1.0", $610_version)
setString("6dfaaf1a3cebda6307aa770d9303d9b6.nca", $620_chk)
setString("97cb7dc89421decc0340aec7abf8e33b.nca", $620_exfat)
setString("6.2.0", $620_version)
setString("c613bd9660478de69bc8d0e2e7ea9949.nca", $700_chk)
setString("58c731cdacb330868057e71327bd343e.nca", $700_exfat)
setString("7.0.0", $700_version)
setString("e6b22c40bb4fa66a151f1dc8db5a7b5c.nca", $701_chk)
setString("02a2cbfd48b2f2f3a6cec378d20a5eff.nca", $701_exfat)
setString("7.0.1", $701_version)
setString("4fe7b4abcea4a0bcc50975c1a926efcb.nca", $800_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $800_exfat)
setString("8.0.0", $800_version)
setString("6c5426d27c40288302ad616307867eba.nca", $801_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $801_exfat)
setString("8.0.1", $801_version)
setString("7eedb7006ad855ec567114be601b2a9d.nca", $810_chk)
setString("96f4b8b729ade072cc661d9700955258.nca", $810_exfat)
setString("8.1.0", $810_version)
setString("a6af05b33f8f903aab90c8b0fcbcc6a4.nca", $900_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $900_exfat)
setString("9.0.0", $900_version)
setString("fd1ffb82dc1da76346343de22edbc97c.nca", $901_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $901_exfat)
setString("9.0.1", $901_version)
setString("c5fbb49f2e3648c8cfca758020c53ecb.nca", $910_chk)
setString("c9bd4eda34c91a676de09951bb8179ae.nca", $910_exfat)
setString("9.1.0", $910_version)
setString("09ef4d92bb47b33861e695ba524a2c17.nca", $920_chk)
setString("2416b3794964b3482c7bc506d12c44df.nca", $920_exfat)
setString("9.2.0", $920_version)
setString("5625cdc21d5f1ca52f6c36ba261505b9.nca", $1000_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1000_exfat)
setString("10.0.0", $1000_version)
setString("36ab1acf0c10a2beb9f7d472685f9a89.nca", $1001_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1001_exfat)
setString("10.0.1", $1001_version)
setString("e951bc9dedcd54f65ffd83d4d050f9e0.nca", $1002_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1002_exfat)
setString("10.0.2", $1002_version)
setString("5b1df84f88c3334335bbb45d8522cbb4.nca", $1003_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1003_exfat)
setString("10.0.3", $1003_version)
setString("34728c771299443420820d8ae490ea41.nca", $1004_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1004_exfat)
setString("10.0.4", $1004_version)
printf("FVI script edition")
printf("")
printf("Press A to read from SYSMMC")
if (@EMUMMC){
printf("Press Y to read from EMUMMC")
}
printf("Press any other button to exit")
printf("")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
mmc_mount("SYSTEM")
printf("")
@i = setInt(1)
@loop = getPosition()
if (@i, ">=", 103){
printf("No firmware found")
printf("Press any button to exit")
pause()
exit()
}
setStringIndex(@i, $nca)
combineStrings("emmc:/Contents/registered/", $nca, $path)
@check = fs_exists($path)
if (@check, "==", 0){
@i = math(@i, "+", 3)
goto(@loop)
}
@i = math(@i, "+", 1)
setStringIndex(@i, $nca)
combineStrings("emmc:/Contents/registered/", $nca, $path)
@checkexfat = fs_exists($path)
@i = math(@i, "+", 1)
setStringIndex(@i, $version)
printf("Firmware found:")
printf($version)
if (@checkexfat){
printf("Exfat edition")
}
if (@checkexfat, "==", 0){
printf("Non-Exfat edition")
}
printf("")
printf("Press any key to exit")
pause()
setString("a1b287e07f8455e8192f13d0e45a2aaf.nca", $100_chk)
setString("3b7cd379e18e2ee7e1c6d0449d540841.nca", $100_exfat)
setString("1.0.0", $100_version)
setString("7a1f79f8184d4b9bae1755090278f52c.nca", $200_chk)
setString("f55a04978465ebf5666ca93e21b26dd2.nca", $200_exfat)
setString("2.0.0", $200_version)
setString("e9b3e75fce00e52fe646156634d229b4.nca", $210_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $210_exfat)
setString("2.1.0", $210_version)
setString("7f90353dff2d7ce69e19e07ebc0d5489.nca", $220_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $220_exfat)
setString("2.2.0", $220_version)
setString("d1c991c53a8a9038f8c3157a553d876d.nca", $230_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $230_exfat)
setString("2.3.0", $230_version)
setString("7bef244b45bf63efb4bf47a236975ec6.nca", $300_chk)
setString("9e5c73ec938f3e1e904a4031aa4240ed.nca", $300_exfat)
setString("3.0.0", $300_version)
setString("9a78e13d48ca44b1987412352a1183a1.nca", $301_chk)
setString("17f9864ce7fe3a35cbe3e3b9f6185ffb.nca", $301_exfat)
setString("3.0.1", $301_version)
setString("704129fc89e1fcb85c37b3112e51b0fc.nca", $302_chk)
setString("e7dd3c6cf68953e86cce54b69b333256.nca", $302_exfat)
setString("3.0.2", $302_version)
setString("f99ac61b17fdd5ae8e4dda7c0b55132a.nca", $400_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $400_exfat)
setString("4.0.0", $400_version)
setString("d0e5d20e3260f3083bcc067483b71274.nca", $401_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $401_exfat)
setString("4.0.1", $401_version)
setString("77e1ae7661ad8a718b9b13b70304aeea.nca", $410_chk)
setString("458a54253f9e49ddb044642286ca6485.nca", $410_exfat)
setString("4.1.0", $410_version)
setString("faa857ad6e82f472863e97f810de036a.nca", $500_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $500_exfat)
setString("5.0.0", $500_version)
setString("7f5529b7a092b77bf093bdf2f9a3bf96.nca", $501_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $501_exfat)
setString("5.0.1", $501_version)
setString("c5758b0cb8c6512e8967e38842d35016.nca", $502_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $502_exfat)
setString("5.0.2", $502_version)
setString("fce3b0ea366f9c95fe6498b69274b0e7.nca", $510_chk)
setString("c9e500edc7bb0fde52eab246028ef84c.nca", $510_exfat)
setString("5.1.0", $510_version)
setString("286e30bafd7e4197df6551ad802dd815.nca", $600pre_chk)
setString("711b5fc83a1f07d443dfc36ba606033b.nca", $600pre_exfat)
setString("6.0.0(pre-release)", $600pre_version)
setString("258c1786b0f6844250f34d9c6f66095b.nca", $600_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $600_exfat)
setString("6.0.0", $600_version)
setString("663e74e45ffc86fbbaeb98045feea315.nca", $601_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $601_exfat)
setString("6.0.1", $601_version)
setString("1d21680af5a034d626693674faf81b02.nca", $610_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $610_exfat)
setString("6.1.0", $610_version)
setString("6dfaaf1a3cebda6307aa770d9303d9b6.nca", $620_chk)
setString("97cb7dc89421decc0340aec7abf8e33b.nca", $620_exfat)
setString("6.2.0", $620_version)
setString("c613bd9660478de69bc8d0e2e7ea9949.nca", $700_chk)
setString("58c731cdacb330868057e71327bd343e.nca", $700_exfat)
setString("7.0.0", $700_version)
setString("e6b22c40bb4fa66a151f1dc8db5a7b5c.nca", $701_chk)
setString("02a2cbfd48b2f2f3a6cec378d20a5eff.nca", $701_exfat)
setString("7.0.1", $701_version)
setString("4fe7b4abcea4a0bcc50975c1a926efcb.nca", $800_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $800_exfat)
setString("8.0.0", $800_version)
setString("6c5426d27c40288302ad616307867eba.nca", $801_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $801_exfat)
setString("8.0.1", $801_version)
setString("7eedb7006ad855ec567114be601b2a9d.nca", $810_chk)
setString("96f4b8b729ade072cc661d9700955258.nca", $810_exfat)
setString("8.1.0", $810_version)
setString("a6af05b33f8f903aab90c8b0fcbcc6a4.nca", $900_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $900_exfat)
setString("9.0.0", $900_version)
setString("fd1ffb82dc1da76346343de22edbc97c.nca", $901_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $901_exfat)
setString("9.0.1", $901_version)
setString("c5fbb49f2e3648c8cfca758020c53ecb.nca", $910_chk)
setString("c9bd4eda34c91a676de09951bb8179ae.nca", $910_exfat)
setString("9.1.0", $910_version)
setString("09ef4d92bb47b33861e695ba524a2c17.nca", $920_chk)
setString("2416b3794964b3482c7bc506d12c44df.nca", $920_exfat)
setString("9.2.0", $920_version)
setString("5625cdc21d5f1ca52f6c36ba261505b9.nca", $1000_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1000_exfat)
setString("10.0.0", $1000_version)
setString("36ab1acf0c10a2beb9f7d472685f9a89.nca", $1001_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1001_exfat)
setString("10.0.1", $1001_version)
setString("e951bc9dedcd54f65ffd83d4d050f9e0.nca", $1002_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1002_exfat)
setString("10.0.2", $1002_version)
setString("5b1df84f88c3334335bbb45d8522cbb4.nca", $1003_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1003_exfat)
setString("10.0.3", $1003_version)
setString("34728c771299443420820d8ae490ea41.nca", $1004_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1004_exfat)
setString("10.0.4", $1004_version)
printf("FVI script edition")
printf("")
printf("Press A to read from SYSMMC")
if (@EMUMMC){
printf("Press Y to read from EMUMMC")
}
printf("Press any other button to exit")
printf("")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
mmc_mount("SYSTEM")
printf("")
@i = setInt(1)
@loop = getPosition()
if (@i, ">=", 103){
printf("No firmware found")
printf("Press any button to exit")
pause()
exit()
}
setStringIndex(@i, $nca)
combineStrings("emmc:/Contents/registered/", $nca, $path)
@check = fs_exists($path)
if (@check, "==", 0){
@i = math(@i, "+", 3)
goto(@loop)
}
@i = math(@i, "+", 1)
setStringIndex(@i, $nca)
combineStrings("emmc:/Contents/registered/", $nca, $path)
@checkexfat = fs_exists($path)
@i = math(@i, "+", 1)
setStringIndex(@i, $version)
printf("Firmware found:")
printf($version)
if (@checkexfat){
printf("Exfat edition")
}
if (@checkexfat, "==", 0){
printf("Non-Exfat edition")
}
printf("")
printf("Press any key to exit")
pause()
exit()

163
v1/README.md Normal file
View File

@ -0,0 +1,163 @@
# TegraScript
The scripting language of TegraExplorer
## Functions
Function | Args | Description | Output
|:-|:-|:-|:-|
`printf(...)` | ...: can be any count of args. Stuff like ("This ", "Is", $Pretty, @Neat) works | writes text to the screen | returns 0
`printInt(int arg1)` | arg1: Int variable to print | Displays an int variable to the screen in the format `@var: (number)` | returns 0
`setPrintPos(int arg1, int arg2)` | arg1: sets cursor position x, arg2: sets cursor position y | sets cursor to a position on the screen. Max X is 42, max Y is 78 | returns 0
`clearscreen()` | - | clears the screen | returns 0
`setColor(string arg1)` | arg1: color string. Valid args: `RED`, `ORANGE`, `YELLOW`, `GREEN`, `BLUE`, `VIOLET`, `WHITE` | Changes the color of the text printed | returns 0
`if(int arg1)` | arg1: checks if interger is true or false (not 0 or 0) | Part of flow control. Runs code inside {} | returns 0
`if(int arg1, string arg2, int arg3)` (overload) | See `check()` and the first `if()` | Part of flow control. Runs code inside {}. Accepts statements like `if (1, == , 1) {}` | returns 0
`goto(int location)` | location: interger aquired by `getLocation()` | jumps to the character offset specified. sets @RETURN based on current location | returns 0
`getPosition()` | - | Returns the current script location, for use with `goto()` | returns > 0
`math(int arg1, string arg2, int arg3)` | arg1 "operator arg2" arg3. Valid operators (arg2s): `"+"`, `"-"`, `"*"`, `"/"` | Does a math operation and returns the result | returns the result of the math operation
`check(int arg1, string arg2, int arg3)` | arg1 "operator arg2" arg3. Valid operators (arg2s): `"=="`, `"!="`, `">="`, `"<="`, `">"`, `"<"` | Does a check and returns the result. result is either 0 or 1 | returns 0 or 1
`invert(int arg1)` | - | makes non 0 integers a 0, and vise versa | returns 0 or 1
`setInt(int arg1)` | - | returns arg1, for setting of variables | returns arg1
`setString(string in, $svar out)` | $svar is a string variable, written as `$var` | copies in to out | returns 0
`setStringIndex(int in, $svar out)` | looks up earlier defined strings in order. User defined strings start at index 1. $svar is a string variable | Copies string table index to out | returns 0
`combineStrings(string s1, string s2, $svar out)` | $svar is a string variable | combines s1 and s2 (as s1s2) and copies it into out | returns 0
`compareStrings(string s1, string s2)` | - | compares s1 to s2. If they are the same, the function returns 1, else 0 | returns 0 or 1
`subString(string in, int startoffset, int size, $svar out)` | in: input string. startoffset: starting offset, 0 is the beginning of the string. size: length to copy, -1 copies the rest of the string. out: output var | Copies part of a string into another string | returns 0
`inputString(string startText, int maxlen, $svar out)` | startText: Starting input text. maxlen: Maximum allowed characters to enter. out: output var | Displays an input box for the user to input text. Note, only works with joycons attached! | returns 1 if user cancelled the input, 0 if success
`stringLength(string in)` | - | Gets the length of the input string | returns the length of the input string
`pause()` | - | pauses the script until it recieves user input. result will be copied into `@BTN_POWER`, `@BTN_VOL+`, `@BTN_VOL-`, `@BTN_A`, `@BTN_B`, `@BTN_X`, `@BTN_Y`, `@BTN_UP`, `@BTN_DOWN`, `@BTN_LEFT` and `@BTN_RIGHT` | returns >0
`wait(int arg1)` | arg1: amount that it waits | waits for the given amount of time, then continues running the script | returns 0
`exit()` | - | exits the script | -
`fs_exists(string path)` | path: full path to file | check if a file exists. 1 if it exists, 0 if it doesn't | returns 0 or 1
`fs_move(string src, string dst)` | src/dst: full path to file | move file from src to dst | returns >= 0
`fs_mkdir(string path)` | path: full path to file | creates a directory at the given path (note: returns 8 if the folder already exists | returns >= 0
`fs_del(string path)` | path: full path to file | deletes a file (or empty directory) | returns >= 0
`fs_delRecursive(string path)` | path: full path to folder | deletes a folder with all subitems | returns >= 0
`fs_copy(string src, string dst)` | src/dst: full path to file | copies a file from src to dst | returns >= 0
`fs_copyRecursive(string src, string dst)` | src/dst: full path to file | copies a folder with subitems from src to dst (note that dst is the parent folder, src will be copied to dst/src) | returns >= 0
`fs_openDir(string path)` | path: full path to folder | opens a directory for use with `fs_readDir()` and sets `@ISDIRVALID` to 1 | returns >= 0
`fs_closeDir()` | - | closes current open directory and sets `@ISDIRVALID` to 0 | returns 0
`fs_readDir()` | - | reads entry out of dir. Atomatically calls `fs_closeDir()` if the end of the dir is reached. Saves result to `$FILENAME` and `@ISDIR` | returns 0
`fs_combinePath(string left, string right, $var out)` | - | Will combine paths, like `sd:/` and `folder` to `sd:/folder`, also `sd:/folder` and `folder2` to `sd:/folder/folder2` | returns 0
`fs_extractBisFile(string path, string outfolder)` | - | take .bis and extract it into outfolder | returns >= 0
`mmc_connect(string mmctype)` | mmctype: either `SYSMMC` or `EMUMMC` | connects SYSMMC or EMUMMC to the system. Specify partition with `mmc_mount()` | returns 0
`mmc_mount(string partition)` | partition: either `SYSTEM` or `USER` | mounts partition in previously connected mmc | returns >= 0
`mmc_dumpPart(string type, string out)` | type: Either `BOOT` or a partition on the gpt. out: Out folder: for `BOOT` this needs to be a folder, otherwise a filepath | Dumps a part from the e(mu)mmc. Determined by earlier mmc_connect's | returns >= 0
`mmc_restorePart(string path)` | path: Needs to be `BOOT0`, `BOOT1` or a valid partition on the gpt. FS Partitions are not allowed | Restores a file to the e(mu)mmc. Determined by earlier mmc_connect's | returns >= 0
## Variables
TegraScript has 2 kinds of variables, @ints and $strings.
- You can define @ints by writing `@variable = setInt(0);` (or any function for that matter).
- You can define $strings with the use of `setString();`, `setStringIndex();` and `combineStrings();`.
You can use these variables in place of int or string inputs, so for example `@b = setInt(@a)` or `setString($a, $b)`
Note though that the int variables can't be assigned negative values
### Built in variables
There are some built in variables:
- `@EMUMMC`: 1 if an emummc was found, 0 if no emummc was found
- `@RESULT`: result of the last ran function
- `@JOYCONN`: 1 if both joycons are connected, 0 if not
- `$CURRENTPATH`: Represents the current path
(if `fs_readdir()` got ran)
- `@ISDIRVALID`: Is the open directory valid
- `$FILENAME`: Represents the current filename
- `@ISDIR`: 1 if the last read file is a DIR, otherwise 0
(if `pause()` got ran)
- `@BTN_POWER`, `@BTN_VOL+`, `@BTN_VOL-`, `@BTN_A`, `@BTN_B`, `@BTN_X`, `@BTN_Y`, `@BTN_UP`, `@BTN_DOWN`, `@BTN_LEFT`: result of the `pause()` function, represents which button got pressed during the `pause()` function
(if `goto()` got ran)
- `@RETURN`: sets @RETURN based on current location. can be used to go back to (after) the previously ran goto()
## Flow control
You can use `if()`, `goto()` and `math()` functions to control the flow of your program. Example:
```
@i = setInt(0)
@LOOP = getLocation()
if (@i, <= , 10){
@i = math(@i, + , 1)
printInt(@i)
goto (@LOOP)
}
pause()
```
This will print numbers 0 to 10 as `@i: x`
Another example:
```
printf("Press a button")
pause()
if (@BTN_VOL+){
printf("Vol+ has been pressed")
}
if (@BTN_VOL-){
printf("Vol- has been pressed")
}
if (@BTN_POWER){
printf("Power has been pressed")
}
pause()
```
# Changelog
#### 29/05/2020
*It's midnight already? i just got started*
With the release of TegraExplorer v2.0.3, the arg parser has been changed. If you find any bugs, please make an issue in either the TegraExplorer repository, or here.
3 new commands have been added
- subString()
- inputString()
- stringLength()
2 new built in variables has been added
- @JOYCONN (1 when both joycons are connected, 0 when at least 1 joycon is disconnected)
- @RETURN (Read on for how this works)
Minus values are now considered valid by the scripting language, but, printing them will not work well (the print function can only print u32's)
Errors have been significantly improved. There are now 2 types of errors, ERR IN FUNC, which indicates a scripting function failed, and SCRIPT LOOKUP FAIL, which means the function you inserted doesn't exist (can also mean the wrong amount of args were supplied). The Loc value on the error screen now shows the line number it failed at, rather than the character offset
Goto functions now generate a variable called @RETURN, which, will return to after the goto. This aids in the making of pseudo-functions. Example:
```
@functionsActive = setInt(0)
@friiFunction = getPosition()
if (@functionsActive) {
printf("Hi this is a function, i think")
goto(@RETURN)
}
@functionsActive = setInt(1)
goto(@friiFunction)
pause()
```
#### 03/05/2020
*God fucking dammit it's 2am again*
With the release of TegraExplorer v2.0.0, the pause() function changed. It adds some buttons from controllers if they are connected. See the pause() section above to see what buttons are mapped. Note that if no joycons are connected, power = a, up = vol+, down = vol-. Also note that the screen dimentions have changed, so your text might not fit anymore.
#### 26/04/2020
With the release of TegraExplorer v1.5.2, there has been 1 new feature implemented.
printf() now can print multiple variables. `printf("This ", "Is", $Pretty, @Neat)` is valid syntax now
#### 12/04/2020
With the release of TegraExplorer v1.5.1, there has been some breaking changes. `?LOOP` and `goto(?LOOP)` is no longer valid syntax. Replace this with `@LOOP = getPosition()` and `goto(@LOOP)`.
Other than this, `@check = check(1, "==", 1) if (@check) {}` can be simplified to `if (1, == , 1) {}`. For `math()` functions, you don't have to enclose operators in "" anymore (just like check/if), like `@math = math(1, + , 1)`

View File

@ -1,231 +1,231 @@
setString("a1b287e07f8455e8192f13d0e45a2aaf.nca", $100_chk)
setString("3b7cd379e18e2ee7e1c6d0449d540841.nca", $100_exfat)
setString("1.0.0", $100_version)
setString("7a1f79f8184d4b9bae1755090278f52c.nca", $200_chk)
setString("f55a04978465ebf5666ca93e21b26dd2.nca", $200_exfat)
setString("2.0.0", $200_version)
setString("e9b3e75fce00e52fe646156634d229b4.nca", $210_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $210_exfat)
setString("2.1.0", $210_version)
setString("7f90353dff2d7ce69e19e07ebc0d5489.nca", $220_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $220_exfat)
setString("2.2.0", $220_version)
setString("d1c991c53a8a9038f8c3157a553d876d.nca", $230_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $230_exfat)
setString("2.3.0", $230_version)
setString("7bef244b45bf63efb4bf47a236975ec6.nca", $300_chk)
setString("9e5c73ec938f3e1e904a4031aa4240ed.nca", $300_exfat)
setString("3.0.0", $300_version)
setString("9a78e13d48ca44b1987412352a1183a1.nca", $301_chk)
setString("17f9864ce7fe3a35cbe3e3b9f6185ffb.nca", $301_exfat)
setString("3.0.1", $301_version)
setString("704129fc89e1fcb85c37b3112e51b0fc.nca", $302_chk)
setString("e7dd3c6cf68953e86cce54b69b333256.nca", $302_exfat)
setString("3.0.2", $302_version)
setString("f99ac61b17fdd5ae8e4dda7c0b55132a.nca", $400_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $400_exfat)
setString("4.0.0", $400_version)
setString("d0e5d20e3260f3083bcc067483b71274.nca", $401_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $401_exfat)
setString("4.0.1", $401_version)
setString("77e1ae7661ad8a718b9b13b70304aeea.nca", $410_chk)
setString("458a54253f9e49ddb044642286ca6485.nca", $410_exfat)
setString("4.1.0", $410_version)
setString("faa857ad6e82f472863e97f810de036a.nca", $500_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $500_exfat)
setString("5.0.0", $500_version)
setString("7f5529b7a092b77bf093bdf2f9a3bf96.nca", $501_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $501_exfat)
setString("5.0.1", $501_version)
setString("c5758b0cb8c6512e8967e38842d35016.nca", $502_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $502_exfat)
setString("5.0.2", $502_version)
setString("fce3b0ea366f9c95fe6498b69274b0e7.nca", $510_chk)
setString("c9e500edc7bb0fde52eab246028ef84c.nca", $510_exfat)
setString("5.1.0", $510_version)
setString("286e30bafd7e4197df6551ad802dd815.nca", $600pre_chk)
setString("711b5fc83a1f07d443dfc36ba606033b.nca", $600pre_exfat)
setString("6.0.0(pre-release)", $600pre_version)
setString("258c1786b0f6844250f34d9c6f66095b.nca", $600_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $600_exfat)
setString("6.0.0", $600_version)
setString("663e74e45ffc86fbbaeb98045feea315.nca", $601_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $601_exfat)
setString("6.0.1", $601_version)
setString("1d21680af5a034d626693674faf81b02.nca", $610_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $610_exfat)
setString("6.1.0", $610_version)
setString("6dfaaf1a3cebda6307aa770d9303d9b6.nca", $620_chk)
setString("97cb7dc89421decc0340aec7abf8e33b.nca", $620_exfat)
setString("6.2.0", $620_version)
setString("c613bd9660478de69bc8d0e2e7ea9949.nca", $700_chk)
setString("58c731cdacb330868057e71327bd343e.nca", $700_exfat)
setString("7.0.0", $700_version)
setString("e6b22c40bb4fa66a151f1dc8db5a7b5c.nca", $701_chk)
setString("02a2cbfd48b2f2f3a6cec378d20a5eff.nca", $701_exfat)
setString("7.0.1", $701_version)
setString("4fe7b4abcea4a0bcc50975c1a926efcb.nca", $800_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $800_exfat)
setString("8.0.0", $800_version)
setString("6c5426d27c40288302ad616307867eba.nca", $801_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $801_exfat)
setString("8.0.1", $801_version)
setString("7eedb7006ad855ec567114be601b2a9d.nca", $810_chk)
setString("96f4b8b729ade072cc661d9700955258.nca", $810_exfat)
setString("8.1.0", $810_version)
setString("a6af05b33f8f903aab90c8b0fcbcc6a4.nca", $900_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $900_exfat)
setString("9.0.0", $900_version)
setString("fd1ffb82dc1da76346343de22edbc97c.nca", $901_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $901_exfat)
setString("9.0.1", $901_version)
setString("c5fbb49f2e3648c8cfca758020c53ecb.nca", $910_chk)
setString("c9bd4eda34c91a676de09951bb8179ae.nca", $910_exfat)
setString("9.1.0", $910_version)
setString("09ef4d92bb47b33861e695ba524a2c17.nca", $920_chk)
setString("2416b3794964b3482c7bc506d12c44df.nca", $920_exfat)
setString("9.2.0", $920_version)
setString("5625cdc21d5f1ca52f6c36ba261505b9.nca", $1000_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1000_exfat)
setString("10.0.0", $1000_version)
setString("36ab1acf0c10a2beb9f7d472685f9a89.nca", $1001_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1001_exfat)
setString("10.0.1", $1001_version)
setString("e951bc9dedcd54f65ffd83d4d050f9e0.nca", $1002_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1002_exfat)
setString("10.0.2", $1002_version)
setString("5b1df84f88c3334335bbb45d8522cbb4.nca", $1003_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1003_exfat)
setString("10.0.3", $1003_version)
setString("34728c771299443420820d8ae490ea41.nca", $1004_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1004_exfat)
setString("10.0.4", $1004_version)
# check tid = 0100000000000809, type data
# exfat tid = 010000000000081B, type data
printf("TegraScript firmware dumper")
printf("")
printf("Press A to dump from SYSMMC")
if (@EMUMMC){
printf("Press Y to dump from EMUMMC")
}
printf("Press any other button to exit")
printf("")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
mmc_mount("SYSTEM")
printf("")
@i = setInt(1)
setString("emmc:/Contents/registered/", $basePath)
@LOOP = getPosition()
if (@i, ">=", 103){
printf("No valid firmware version found")
printf("Press A to dump anyway")
printf("Press any other button to exit")
pause()
if (@BTN_A, == , 0){
exit()
}
setString("Unknown", $version)
}
if (@i, <, 103){
setStringIndex(@i, $nca)
combineStrings($basePath, $nca, $path)
@exists = fs_exists($path)
if (@exists, == , 0){
@i = math(@i, "+", 3)
goto(@LOOP)
}
@i = math(@i, "+", 1)
setStringIndex(@i, $nca)
combineStrings($basePath, $nca, $path)
@checkexfat = fs_exists($path)
@i = math(@i, "+", 1)
setStringIndex(@i, $version)
if (@checkexfat){
combineStrings($version, "_exFAT", $version)
}
}
printf("Firmware found:")
printf($version)
printf("")
printf("Starting dump...")
fs_mkdir("sd:/tegraexplorer")
fs_mkdir("sd:/tegraexplorer/Firmware")
combineStrings("sd:/tegraexplorer/Firmware/", $version, $sdBasePath)
fs_mkdir($sdBasePath)
combineStrings($sdBasePath, "/", $sdBasePath)
@count = setInt(0)
fs_openDir("emmc:/Contents/registered")
setColor("GREEN")
@LOOP = getPosition()
fs_readDir()
if (@ISDIRVALID){
if (@ISDIR){
combineStrings($basePath, $FILENAME, $path)
combineStrings($path, "/00", $path)
}
if (@ISDIR, == , 0){
combineStrings($basePath, $FILENAME, $path)
}
setPrintPos(0, 16)
@count = math(@count, "+", 1)
printf(@count, ": ", $FILENAME)
combineStrings($sdBasePath, $FILENAME, $sdPath)
fs_copy($path, $sdPath)
if (@RESULT){
printf("")
printf("Copy failed!")
printInt(@RESULT)
pause()
exit()
}
goto(@LOOP)
}
setColor("WHITE")
printf("")
printf("")
printf("Dump done! Press any key to exit")
pause()
setString("a1b287e07f8455e8192f13d0e45a2aaf.nca", $100_chk)
setString("3b7cd379e18e2ee7e1c6d0449d540841.nca", $100_exfat)
setString("1.0.0", $100_version)
setString("7a1f79f8184d4b9bae1755090278f52c.nca", $200_chk)
setString("f55a04978465ebf5666ca93e21b26dd2.nca", $200_exfat)
setString("2.0.0", $200_version)
setString("e9b3e75fce00e52fe646156634d229b4.nca", $210_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $210_exfat)
setString("2.1.0", $210_version)
setString("7f90353dff2d7ce69e19e07ebc0d5489.nca", $220_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $220_exfat)
setString("2.2.0", $220_version)
setString("d1c991c53a8a9038f8c3157a553d876d.nca", $230_chk)
setString("4a94289d2400b301cbe393e64831f84c.nca", $230_exfat)
setString("2.3.0", $230_version)
setString("7bef244b45bf63efb4bf47a236975ec6.nca", $300_chk)
setString("9e5c73ec938f3e1e904a4031aa4240ed.nca", $300_exfat)
setString("3.0.0", $300_version)
setString("9a78e13d48ca44b1987412352a1183a1.nca", $301_chk)
setString("17f9864ce7fe3a35cbe3e3b9f6185ffb.nca", $301_exfat)
setString("3.0.1", $301_version)
setString("704129fc89e1fcb85c37b3112e51b0fc.nca", $302_chk)
setString("e7dd3c6cf68953e86cce54b69b333256.nca", $302_exfat)
setString("3.0.2", $302_version)
setString("f99ac61b17fdd5ae8e4dda7c0b55132a.nca", $400_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $400_exfat)
setString("4.0.0", $400_version)
setString("d0e5d20e3260f3083bcc067483b71274.nca", $401_chk)
setString("090b012b110973fbdc56a102456dc9c6.nca", $401_exfat)
setString("4.0.1", $401_version)
setString("77e1ae7661ad8a718b9b13b70304aeea.nca", $410_chk)
setString("458a54253f9e49ddb044642286ca6485.nca", $410_exfat)
setString("4.1.0", $410_version)
setString("faa857ad6e82f472863e97f810de036a.nca", $500_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $500_exfat)
setString("5.0.0", $500_version)
setString("7f5529b7a092b77bf093bdf2f9a3bf96.nca", $501_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $501_exfat)
setString("5.0.1", $501_version)
setString("c5758b0cb8c6512e8967e38842d35016.nca", $502_chk)
setString("432f5cc48e6c1b88de2bc882204f03a1.nca", $502_exfat)
setString("5.0.2", $502_version)
setString("fce3b0ea366f9c95fe6498b69274b0e7.nca", $510_chk)
setString("c9e500edc7bb0fde52eab246028ef84c.nca", $510_exfat)
setString("5.1.0", $510_version)
setString("286e30bafd7e4197df6551ad802dd815.nca", $600pre_chk)
setString("711b5fc83a1f07d443dfc36ba606033b.nca", $600pre_exfat)
setString("6.0.0(pre-release)", $600pre_version)
setString("258c1786b0f6844250f34d9c6f66095b.nca", $600_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $600_exfat)
setString("6.0.0", $600_version)
setString("663e74e45ffc86fbbaeb98045feea315.nca", $601_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $601_exfat)
setString("6.0.1", $601_version)
setString("1d21680af5a034d626693674faf81b02.nca", $610_chk)
setString("d5186022d6080577b13f7fd8bcba4dbb.nca", $610_exfat)
setString("6.1.0", $610_version)
setString("6dfaaf1a3cebda6307aa770d9303d9b6.nca", $620_chk)
setString("97cb7dc89421decc0340aec7abf8e33b.nca", $620_exfat)
setString("6.2.0", $620_version)
setString("c613bd9660478de69bc8d0e2e7ea9949.nca", $700_chk)
setString("58c731cdacb330868057e71327bd343e.nca", $700_exfat)
setString("7.0.0", $700_version)
setString("e6b22c40bb4fa66a151f1dc8db5a7b5c.nca", $701_chk)
setString("02a2cbfd48b2f2f3a6cec378d20a5eff.nca", $701_exfat)
setString("7.0.1", $701_version)
setString("4fe7b4abcea4a0bcc50975c1a926efcb.nca", $800_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $800_exfat)
setString("8.0.0", $800_version)
setString("6c5426d27c40288302ad616307867eba.nca", $801_chk)
setString("b2708136b24bbe206e502578000b1998.nca", $801_exfat)
setString("8.0.1", $801_version)
setString("7eedb7006ad855ec567114be601b2a9d.nca", $810_chk)
setString("96f4b8b729ade072cc661d9700955258.nca", $810_exfat)
setString("8.1.0", $810_version)
setString("a6af05b33f8f903aab90c8b0fcbcc6a4.nca", $900_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $900_exfat)
setString("9.0.0", $900_version)
setString("fd1ffb82dc1da76346343de22edbc97c.nca", $901_chk)
setString("3b444768f8a36d0ddd85635199f9676f.nca", $901_exfat)
setString("9.0.1", $901_version)
setString("c5fbb49f2e3648c8cfca758020c53ecb.nca", $910_chk)
setString("c9bd4eda34c91a676de09951bb8179ae.nca", $910_exfat)
setString("9.1.0", $910_version)
setString("09ef4d92bb47b33861e695ba524a2c17.nca", $920_chk)
setString("2416b3794964b3482c7bc506d12c44df.nca", $920_exfat)
setString("9.2.0", $920_version)
setString("5625cdc21d5f1ca52f6c36ba261505b9.nca", $1000_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1000_exfat)
setString("10.0.0", $1000_version)
setString("36ab1acf0c10a2beb9f7d472685f9a89.nca", $1001_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1001_exfat)
setString("10.0.1", $1001_version)
setString("e951bc9dedcd54f65ffd83d4d050f9e0.nca", $1002_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1002_exfat)
setString("10.0.2", $1002_version)
setString("5b1df84f88c3334335bbb45d8522cbb4.nca", $1003_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1003_exfat)
setString("10.0.3", $1003_version)
setString("34728c771299443420820d8ae490ea41.nca", $1004_chk)
setString("d5bc167565842ee61f9670d23759844d.nca", $1004_exfat)
setString("10.0.4", $1004_version)
# check tid = 0100000000000809, type data
# exfat tid = 010000000000081B, type data
printf("TegraScript firmware dumper")
printf("")
printf("Press A to dump from SYSMMC")
if (@EMUMMC){
printf("Press Y to dump from EMUMMC")
}
printf("Press any other button to exit")
printf("")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
mmc_mount("SYSTEM")
printf("")
@i = setInt(1)
setString("emmc:/Contents/registered/", $basePath)
@LOOP = getPosition()
if (@i, ">=", 103){
printf("No valid firmware version found")
printf("Press A to dump anyway")
printf("Press any other button to exit")
pause()
if (@BTN_A, == , 0){
exit()
}
setString("Unknown", $version)
}
if (@i, <, 103){
setStringIndex(@i, $nca)
combineStrings($basePath, $nca, $path)
@exists = fs_exists($path)
if (@exists, == , 0){
@i = math(@i, "+", 3)
goto(@LOOP)
}
@i = math(@i, "+", 1)
setStringIndex(@i, $nca)
combineStrings($basePath, $nca, $path)
@checkexfat = fs_exists($path)
@i = math(@i, "+", 1)
setStringIndex(@i, $version)
if (@checkexfat){
combineStrings($version, "_exFAT", $version)
}
}
printf("Firmware found:")
printf($version)
printf("")
printf("Starting dump...")
fs_mkdir("sd:/tegraexplorer")
fs_mkdir("sd:/tegraexplorer/Firmware")
combineStrings("sd:/tegraexplorer/Firmware/", $version, $sdBasePath)
fs_mkdir($sdBasePath)
combineStrings($sdBasePath, "/", $sdBasePath)
@count = setInt(0)
fs_openDir("emmc:/Contents/registered")
setColor("GREEN")
@LOOP = getPosition()
fs_readDir()
if (@ISDIRVALID){
if (@ISDIR){
combineStrings($basePath, $FILENAME, $path)
combineStrings($path, "/00", $path)
}
if (@ISDIR, == , 0){
combineStrings($basePath, $FILENAME, $path)
}
setPrintPos(0, 16)
@count = math(@count, "+", 1)
printf(@count, ": ", $FILENAME)
combineStrings($sdBasePath, $FILENAME, $sdPath)
fs_copy($path, $sdPath)
if (@RESULT){
printf("")
printf("Copy failed!")
printInt(@RESULT)
pause()
exit()
}
goto(@LOOP)
}
setColor("WHITE")
printf("")
printf("")
printf("Dump done! Press any key to exit")
pause()
exit()

View File

@ -1,71 +1,71 @@
printf("TegraScript save dumper")
printf("")
printf("What mmc would you like to dump from")
printf("Press A for sysmmc")
if (@EMUMMC) {
printf("Or press Y for emummc")
}
printf("Press any other button to exit")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
printf("")
printf("Which partition do you want to dump from? X for SYSTEM, Y for USER")
pause()
@checkInput = setInt(0);
if (@BTN_X) {
printf("Mounting SYSTEM...")
mmc_mount("SYSTEM")
setString("systemSaves", $folder)
@checkInput = setInt(1);
}
if (@BTN_Y) {
printf("Mounting USER....")
mmc_mount("USER")
setString("userSaves", $folder)
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
combineStrings("sd:/tegraexplorer/", $folder, $path)
fs_mkdir("sd:/tegraexplorer")
fs_mkdir($path)
printf("")
printf("Copying saves to ", $path)
printf("")
@check = fs_copyRecursive("emmc:/save", $path)
printf("")
if (@check){
printf("Something went wrong! Errcode: ", @check)
}
if (@check, == , 0){
printf("Done, press any button to exit")
}
pause()
exit()
printf("TegraScript save dumper")
printf("")
printf("What mmc would you like to dump from")
printf("Press A for sysmmc")
if (@EMUMMC) {
printf("Or press Y for emummc")
}
printf("Press any other button to exit")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
printf("")
printf("Which partition do you want to dump from? X for SYSTEM, Y for USER")
pause()
@checkInput = setInt(0);
if (@BTN_X) {
printf("Mounting SYSTEM...")
mmc_mount("SYSTEM")
setString("systemSaves", $folder)
@checkInput = setInt(1);
}
if (@BTN_Y) {
printf("Mounting USER....")
mmc_mount("USER")
setString("userSaves", $folder)
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
combineStrings("sd:/tegraexplorer/", $folder, $path)
fs_mkdir("sd:/tegraexplorer")
fs_mkdir($path)
printf("")
printf("Copying saves to ", $path)
printf("")
@check = fs_copyRecursive("emmc:/save", $path)
printf("")
if (@check){
printf("Something went wrong! Errcode: ", @check)
}
if (@check, == , 0){
printf("Done, press any button to exit")
}
pause()
exit()

135
v1/systemwipe.te Normal file
View File

@ -0,0 +1,135 @@
printf("TegraScript system wiper")
printf("")
printf("Press A to wipe from SYSMMC")
if (@EMUMMC){
printf("Press Y to wipe from EMUMMC")
}
printf("Press power to exit")
printf("")
pause()
@checkInput = setInt(0);
if (@BTN_A){
printf("Mounting SYSMMC...")
mmc_connect("SYSMMC")
@checkInput = setInt(1);
}
if (@BTN_Y){
if (@EMUMMC, == , 0){
exit()
}
printf("Mounting EMUMMC...")
mmc_connect("EMUMMC")
@checkInput = setInt(1);
}
if (@checkInput, == , 0){
exit()
}
mmc_mount("SYSTEM")
if (@RESULT){
printf("System failed to mount!")
pause()
exit()
}
setString("emmc:/save/", $basePath)
setColor("RED")
printf("Are you sure you want to wipe everything?")
printf("This includes:")
printf("- Saves")
printf("- Game Data")
printf("- All other data on the system")
printf("")
printf("Use this only as a last resort!")
printf("")
setColor("YELLOW")
wait(10)
printf("Press X to continue")
printf("Press any other button to exit")
pause()
if (@BTN_X, == , 0){
exit()
}
@count = setInt(1)
printf("Deleting SYSTEM saves")
fs_openDir("emmc:/save")
setColor("RED")
@LOOP = getPosition()
fs_readDir()
if (@ISDIRVALID){
combineStrings($basePath, $FILENAME, $path)
setPrintPos(0, 20)
@check = compareStrings($FILENAME, "8000000000000120")
if (@check){
goto(@LOOP)
}
@check = compareStrings($FILENAME, "80000000000000d1")
if (@check){
goto(@LOOP)
}
@check = compareStrings($FILENAME, "8000000000000047")
if (@check){
goto(@LOOP)
}
@count = math(@count, "+", 1)
printf(@count, ": ", $FILENAME)
fs_del($path)
goto(@LOOP)
}
printf("")
printf("")
printf("Deleting USER")
mmc_mount("USER")
if (@RESULT){
printf("User failed to mount!")
pause()
exit()
}
fs_delRecursive("emmc:/Album")
fs_mkdir("emmc:/Album")
fs_delRecursive("emmc:/Contents")
fs_mkdir("emmc:/Contents")
fs_mkdir("emmc:/Contents/placehld")
fs_mkdir("emmc:/Contents/registered")
fs_delRecursive("emmc:/save")
fs_mkdir("emmc:/save")
fs_delRecursive("emmc:/saveMeta")
fs_mkdir("emmc:/saveMeta")
fs_delRecursive("emmc:/temp")
fs_mkdir("emmc:/temp")
setColor("GREEN")
printf("")
printf("")
printf("Done! press any key to exit")
pause()
exit()