Homebrew [Release] GodMode9 Scripts Megathread

8BitWonder

Small Homebrew Dev
OP
Member
Joined
Jan 23, 2016
Messages
2,489
Trophies
1
Location
47 4F 54 20 45 45 4D
XP
5,339
Country
United States
Let's say 'Nintendo 3DS9' gets swapped with 'Nintendo 3DS'. Is old 'Nintendo 3DS' renamed as 'Nintendo 3DS9'?
Yes that is the case. Your current Nintendo 3DS folder is renamed to whichever Nintendo 3DS folder you are swapping with. Primarily because I imagine that no one would ever have more than two or three total Nintendo 3DS folders, so it shouldn't be too hard remembering which is which.
 
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
Yes that is the case. Your current Nintendo 3DS folder is renamed to whichever Nintendo 3DS folder you are swapping with. Primarily because I imagine that no one would ever have more than two or three total Nintendo 3DS folders, so it shouldn't be too hard remembering which is which.

I'm trying to think of the odd case of where someone who would use all 9 folders. I can only think of someone who has libraries of VC injections. I can see how they would want the feature where each folder is always designated with its assigned number when not in use.

Coding to keep track of those would be a major hassle. The only idea I'm coming up in how you could implement that is each of those folder containing a text file placed within for the script to read off of, so that it knows to only name them with their specific number.

Edit - At this time, don't worry about. At least this folder swap/switch idea is viable! All in a day's coding work. :grog:
 
Last edited by TurdPooCharger,
  • Like
Reactions: 8BitWonder

8BitWonder

Small Homebrew Dev
OP
Member
Joined
Jan 23, 2016
Messages
2,489
Trophies
1
Location
47 4F 54 20 45 45 4D
XP
5,339
Country
United States
I'm trying to think of the odd case of where someone who would use all 9 folders. I can only think of someone who has libraries of VC injections. I can see how they would want the feature where each folder is always designated with its assigned number when not in use.

Coding to keep track of those would be a major hassle. The only idea I'm coming up in how you could implement that is each of those folder containing a text file placed within for the script to read off of, so that it knows to only name them with their specific number.
It can do more than just 0-9. It can do letters (probably words even) just fine. As long as the character(s) directly follow Nintendo 3DS, and are typed in exactly when swapping, you should be able to swap properly.

I haven't tested letters/words, but I guarantee they work.
 
  • Like
Reactions: TurdPooCharger
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
It can do more than just 0-9. It can do letters (probably words even) just fine. As long as the character(s) directly follow Nintendo 3DS, and are typed in exactly when swapping, you should be able to swap properly.

I haven't tested letters/words, but I guarantee they work.

Hey, before we go any further in this chat, I had this deja vu where this conversation went really south. I think where I was trying to get at, we have different approach in implementing the same idea, so I'm going to back off because not everyone codes with the same philosophy.

I'll take a chill pill step back and go "eh, let the plebs make their own swap/switch scripts if they're not happy with mine." Lmao.

* I'm not knocking your script! I'm just trying to put myself in the shoe's of a really picky user who may find your or my scripts inadequate to their needs. It's not worth a coder's frustration trying to make perfect. Feature creep sucks.
 
Last edited by TurdPooCharger,
  • Like
Reactions: 8BitWonder

OrGoN3

Well-Known Member
Member
Joined
Apr 23, 2007
Messages
3,239
Trophies
1
XP
3,246
Country
United States
Do you guys know if a GM9 script can call another GM9 script? (if so, how?)

I want to set a global for, let's say, the hash for sector0x96, 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3. If I do, let's say, "set MYVARNAME 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3". I'm assuming this will work because the hash is a literal? Or would the hash value need to be in quotes/treated as a string? Which brings me to the next question, when doing something like "sha s:/sector0x96.bin $[MYVARNAME]" would be valid then, correct? Or if it needs to be a string, can I give sha a string as a second argument? If not, can I convert it to a literal? Am I overthinking this entirely?
 
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
Do you guys know if a GM9 script can call another GM9 script? (if so, how?)

I want to set a global for, let's say, the hash for sector0x96, 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3. If I do, let's say, "set MYVARNAME 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3". I'm assuming this will work because the hash is a literal? Or would the hash value need to be in quotes/treated as a string? Which brings me to the next question, when doing something like "sha s:/sector0x96.bin $[MYVARNAME]" would be valid then, correct? Or if it needs to be a string, can I give sha a string as a second argument? If not, can I convert it to a literal? Am I overthinking this entirely?

Try this with the quotation marks:
Code:
set MYVARNAME "82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3"
sha "s:/sector0x96.bin" $[MYVARNAME]

For a gm9 running another gm9, no?
 
Last edited by TurdPooCharger,
  • Like
Reactions: OrGoN3

OrGoN3

Well-Known Member
Member
Joined
Apr 23, 2007
Messages
3,239
Trophies
1
XP
3,246
Country
United States
Try this with the quotation marks:
Code:
set MYVARNAME "82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3"
sha "s:/sector0x96.bin" $[MYVARNAME]

For a gm9 running another gm9, no?
Ty. I misspoke though. I just want to make sure it knows the second argument is a valid hexadecimal. I'm assuming there are no types and that it would be the same with it without the quotes. I'll test later today and report back. Thanks again!

As one who hates code duplication, i was hoping scripts could run other scripts. I guess I'll stick with labels and duplication for now.
 
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
Ty. I misspoke though. I just want to make sure it knows the second argument is a valid hexadecimal. I'm assuming there are no types and that it would be the same with it without the quotes. I'll test later today and report back. Thanks again!

As one who hates code duplication, i was hoping scripts could run other scripts. I guess I'll stick with labels and duplication for now.

No misspoken, it's a good question. For your case, the quotation marks aren't needed. It's when you run into making variables or checking against folders and files with spaces will you need them. Still it's good practice and habit to always use them for explicitness.
 
  • Like
Reactions: OrGoN3

OrGoN3

Well-Known Member
Member
Joined
Apr 23, 2007
Messages
3,239
Trophies
1
XP
3,246
Country
United States
No misspoken, it's a good question. For your case, the quotation marks aren't needed. It's when you run into making variables or checking against folders and files with spaces will you need them. Still it's good practice and habit to always use them for explicitness.
Well, I said strings or literals, as my mind was stuck on string literals and my hands never fixed the error in my thought. So I'm good without quotes. Thank you very much for your responses. You have been very helpful and I appreciate that. Thanks again! ^_^
 
  • Like
Reactions: TurdPooCharger
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
Change_Nin3DS_#_Folders

Shout out and thanks goes to:
  • @d0k3 (and @Kazuma77) - for GodMode9 and the three "Hello" gm9 example scripts.
  • @8BitWonder - His Swap Nintendo 3DS Folder script found here. Our concurrent development and implementation of our scripts highlighted a HUGE deficient in mine: no ability to choose between more than two folders. I was humbled by this insight and determined in creating these script(s) that will (hopefully) fill an intermediate need gap for those who require more than two folders.
  • @annson24 - His AIO megascript found at this thread here. This wouldn't have been made possible without having known the structural options. His script is the first to clearly demonstrate the codes "@" and "MainMenu_*" with drop down listings.
  • @SirNapkin1334 - For helping me with gm9 syntax on my previous script. I derped with how to handle variables with spaces.
What are these?
Introducing the newest Nintendo 3DS folders selector scripts.
  1. Change_Nin3DS_3_Folders.gm9
  2. Change_Nin3DS_4_Folders.gm9
These are two gm9 scripts that allow you to change between either three (3) or four (4) Nintendo 3DS folders: (A) , (B) , (C) , and/or (D). These scripts can create the missing (A)-(B)-(C)-(D) folders if its the first time running them, have safety checks if you have too many or missing some folders, can track which folder is which [ex: Folder (A) is always (A) unless it's currently loaded up as Nintendo 3DS], and allows you to select whichever folder you want with the (Up/Down) D-Pad and A button in a menu list.

Why would I want to use one of these scripts?
  • You are a heavy duty 3DS user who has more than 600 titles or games.
  • Your (micro) SDXC card is massive enough that 600 titles is chump change. You have serious hoarding issues.
  • You don't like the idea of using emuNAND to expand your library due to heavy I/O wear & tear on the SD card.
  • You don't want to carry around two, three, or more cards when changing between your game collections.
  • You like to organize your games into categories and separate sets. For example:
  1. (main) library
  2. (secondary) library
  3. GBA Virtual Console
  4. SNES Virtual Console
I have more than 300 but less than 600 titles, or I only need two (2) Nintendo 3DS folders. Should I use one of these?
Absolutely not. You are better off with my previous script Switch_Nin3DS_folders, which was explicitly coded for only two folders, (A) and (B), with name tracking. This script can be found attached at post #98 here.

Wait. This is confusing. Why did you make the Change scripts if the Swap script can already handle multiple folders? WHY SO MANY OF THESE?!
Edit - In lieu of the recent Florida school shooting (Feb-14, 2018), my analogy example may not have been the wisest in trying to explain the differences of the scripts. I did not mean to be insensitive during this precarious moment. I will put my explanation in spoilers if you still intend to read what I wrote. My apologies. I live in Florida and should know better.

Just know that the scripts are different.
Okay, I'm going to use an analogy here. We are presented with three different types of guns: pistol, assault rifle, and sniper rifle. Each gun does basically the same thing where you shoot bullets usually with the intention of hitting a target.

- A pistol is great at quick draws, close quarter firing with really tight spaces, and light carry-on.
- An assault rifle is bread and butter, or workhorse, that balances attack range, rate of fire, and carry size.
- A snipe rifle can hit some of the furthest targets the scope can see with meticulous pin point accuracy.

Each type of gun has their strengths and weaknesses. Any of these can very well cause massive collateral damage, but each may be better suited for specific target(s) at a certain distance, etc.

You wouldn't try to shoot a pistol at something that's 1000 yards away, and you sure as hell wouldn't want to find yourself in a fire fight with only a single shot sniper rifle. Of course, this poor example doesn't apply for professional FPS gamers in Battlefield, Call of Duty, or whatever shooting games played these days, but hopefully you get the idea.

Without having actually described how these three types of scripts work,
Switch_Nin3DS_folders = pistol
Change_Nin3DS_X_Folders = assault rifle
Swap Nintendo 3DS Folder = sniper rifle

Try and test them all out and see which one best suits your needs.

I would like my folders named something other than (A), (B), (C), and/or (D). How do I change them?
For example with the Change_Nin3DS_4_Folders script, instead of having:
  • Nintendo 3DS (A)
  • Nintendo 3DS (B)
  • Nintendo 3DS (C)
  • Nintendo 3DS (D)
Let's say you want to instead have the folders as:
  • Nintendo 3DS (main)
  • Nintendo 3DS (secondary)
  • Nintendo 3DS (GBA VC)
  • Nintendo 3DS (SNES VC)
Open up the script with Notepad. Press Ctrl + H to pull up the program's search and "Replace" feature. Use the "Replace All" to change these:
Code:
Find what:
(A)
(B)
(C)
(D)

With these:
Code:
Replace with:
(main)
(secondary)
(GBA VC)
(SNES VC)

If you have white spaces " " within your renamed folders in the parenthesis (...), you need to do additional search and replace steps in order for them to show up in the menu.

For (GBA VC) and (SNES VC), this requires replacing:
Code:
Find what:
@Choices_Nintendo_3DS_(GBA VC)
@Choices_Nintendo_3DS_(SNES VC)

With these (see the underscore "_" where the white spaces were):
Code:
Replace with:
@Choices_Nintendo_3DS_(GBA_VC)
@Choices_Nintendo_3DS_(SNES_VC)

None of your scripts meet my criteria. I need one that handles 5 or more folders. Can you make one with X amount of folders for me?
... You're on your own, buddy. Study the subtle differences between the (3) and (4) versions of the Change scripts. If you know a bit of coding and have a good eye for detail, you can easily expand the script to handle more than 4 folders. Just know that the script will quickly get massive and become increasingly slower to run as you accommodate for more folders.

Anything else I should know when using one of these scripts?

Do not use a combination of Switch_Nin3DS_folders, Change_Nin3DS_3_Folders, and Change_Nin3DS_4_Folders scripts. You only need to have one depending how many Nintendo 3DS folders you have, or else you run into naming collusion issues when using all three or two of them. You can, however, use one of those three in tandem with @8BitWonder 's Swap Nintendo 3DS Folder as his script will not conflict with any of mine.

Both (3) and (4) versions are attached within the same RAR archive below.
 

Attachments

  • Change_Nin3DS_X_Folders_v1.0.rar
    1.9 KB · Views: 172
Last edited by TurdPooCharger,
  • Like
Reactions: Deleted User

annson24

The Patient One
Member
Joined
May 5, 2016
Messages
1,191
Trophies
0
Age
32
XP
1,843
Country
Philippines
Hi, would like to point out that the dump usa homemenu results in error in the
find 0:/gm9/out/0004003000008F02* CIA1
line. Assuming the '*' wildcard is the culprit, other regions could also result in an error.
 
  • Like
Reactions: 8BitWonder
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
Speaking of the Dump_HomeMenu_XXX.gm9 scripts, I propose putting forth a universal version. Please review the code if it is satisfactory and a good idea to merge these into a single script encompassing all regions.

Regular users do not use this script. Currently troubleshooting.
Current script revision has been tested on USA N3DSXL and is working. It should be error free for any region. Please report errors if you find any.
You can find the final build posted here: Dump HomeMenu REGION-FREE
# homemenu cia dump GM9 script
# This will create a homemenu's cia file in /gm9/out
# This is useful for making customized homemenu's cia.
# Guide's Link is below.
# https://gbatemp.net/threads/complete-3ds-2ds-customization-guide.468268/
# author : windows_server_2003/8BitWonder
# Required write permission : none
# Region : Region-Free

set ERRORMSG "Cancelled by user"
ask "This script dumps the homemenu.cia.\ncontinue?"
set CIA2 "0:/gm9/out/homemenu.cia"
set ERRORMSG "Error:\#1 Not a 3DS or SysNAND is broken"

if chk $[REGION] "JPN"
find 1:/title/00040030/00008202/content/*.tmd TMD
elif chk $[REGION] "USA"
find 1:/title/00040030/00008F02/content/*.tmd TMD
elif chk $[REGION] "EUR"
find 1:/title/00040030/00009802/content/*.tmd TMD
elif chk $[REGION] "CHN"
find 1:/title/00040030/0000A102/content/*.tmd TMD
elif chk $[REGION] "KOR"
find 1:/title/00040030/0000A902/content/*.tmd TMD
elif chk $[REGION] "TWN"
find 1:/title/00040030/0000B102/content/*.tmd TMD
elif chk $[REGION] "UNK"
chk "Aa" "Bb"
end

set ERRORMSG "Error:\#2 SD card error or the tmd file is invalid"
buildcia $[TMD]
set ERRORMSG "Error:\#3 SD card error"

if chk $[REGION] "JPN"
find 0:/gm9/out/0004003000008202* CIA1
elif chk $[REGION] "USA"
find 0:/gm9/out/0004003000008F02* CIA1
elif chk $[REGION] "EUR"
find 0:/gm9/out/0004003000009802* CIA1
elif chk $[REGION] "CHN"
find 0:/gm9/out/000400300000A102* CIA1
elif chk $[REGION] "KOR"
find 0:/gm9/out/000400300000A902* CIA1
elif chk $[REGION] "TWN"
find 0:/gm9/out/000400300000B102* CIA1
end

mv -w -n $[CIA1] $[CIA2]
set ERRORMSG "Error:\#4 SD card error"
decrypt $[CIA2]
echo "homemenu.cia dumped succesfully:\n$[CIA2]"


** I have not tested this script for errors and bugs.

Edit - Opps, made some minor adjustments in case the script fails to find any region folders, so it can exit out.

Edit #2 - Moved the 1st error message outside the first REGION checking if statement. This is in case a region is found but something else is broken in the directory.

Edit #3 - Okay, I got off my lazy butt to test this prototype universal script. It doesn't work. Getting an "Error:\#2 SD card error or the tmd file is invalid". This could be from bad coding on my part. I'll look into the USA base version if the error appears there. This is probably the same problem annson24 is reporting.

Edit #4 - Yup, problem stems from my modifications. Dump_HomeMenu_USA.gm9 is verified good. I will be putting the prototype code into spoilers. Do not use at this moment.

Edit #5 - Alright, so I found my first issue that fixed the error #2.
INCORRECT
Code:
set JPN "1:/title/00040030/00008202/"
...
if find "1:/title/00040030/00008202/" JPN

CORRECT
Code:
set JPN "1:/title/00040030/00008202"
...
if find "1:/title/00040030/00008202" JPN

Currently getting an error #3.

Edit #6 - I found the root cause of error #3. The problem was that I tried to create the variable REGION, which is a sin in GodMode9 because that's a environmental variable you're not allowed to change. The nice thing is that the code has been significantly reduced in number of lines and variables from the original posted version.

Edit #7 - Reduced the lines of code some more. Multiple if & end were changed out with elif.
 
Last edited by TurdPooCharger,

Shoopz

New Member
Newbie
Joined
Mar 11, 2017
Messages
4
Trophies
0
Age
33
XP
53
Country
United States
Ok lol, I see everyone is making scripts that super complicated. I feel like I'll put down for such a simple and probably useless script. Either way, I made a script for when you want to put splashes into the CTRNAND. You have to put the splashes on the root of the SD card btw. Tell me if the file doesn't work.
 

Attachments

  • setup_ctrnand_splash.zip
    507 bytes · Views: 155
  • Like
Reactions: TurdPooCharger

8BitWonder

Small Homebrew Dev
OP
Member
Joined
Jan 23, 2016
Messages
2,489
Trophies
1
Location
47 4F 54 20 45 45 4D
XP
5,339
Country
United States
Hi, would like to point out that the dump usa homemenu results in error in the
find 0:/gm9/out/0004003000008F02* CIA1
line. Assuming the '*' wildcard is the culprit, other regions could also result in an error.
I just tested the USA script and did not get any error. Are you sure you used the USA script and are on a USA system?
 
Joined
Jan 1, 2018
Messages
7,292
Trophies
2
XP
5,945
Country
United States
I just tested the USA script and did not get any error. Are you sure you used the USA script and are on a USA system?
I can back up your claim as I just tried the USA version after cross checking, testing, and troubleshooting the prototype universal dump homemenu script. I will take a look at annson24 megascript after my coffee break.
 
  • Like
Reactions: annson24

8BitWonder

Small Homebrew Dev
OP
Member
Joined
Jan 23, 2016
Messages
2,489
Trophies
1
Location
47 4F 54 20 45 45 4D
XP
5,339
Country
United States
I can back up your claim as I just tried the USA version after cross checking, testing, and troubleshooting the prototype universal dump homemenu script. I will take a look at annson24 megascript after my coffee break.
Already finished checking.
@annson24 The dump scripts (USA one at least) here don't fail, but the dump script in your AIO script seems to. I'll see if I can't tweak it to work.
 
  • Like
Reactions: annson24

annson24

The Patient One
Member
Joined
May 5, 2016
Messages
1,191
Trophies
0
Age
32
XP
1,843
Country
Philippines
Already finished checking.
@annson24 The dump scripts (USA one at least) here don't fail, but the dump script in your AIO script seems to. I'll see if I can't tweak it to work.
Yeah. Crosschecked the scripts. Maybe I'm just really sleepy. Anyway, will be checking it out again tomorrow. Need to go to bed. Hit me up if you guys found something. Thanks and goodnight from the middle east.

Sent from my SM-G950F using Tapatalk
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sonic Angel Knight @ Sonic Angel Knight: :ninja: