Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions CONFIG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# config.json
In order to set up advanced configuration, you need to create a file named `config.json` and place it in a folder named `finalize` on the root of the SD card.

The default config can be seen [here](data/config.json). Here's an example for how you would make one of these config files (this one disables checking for a MSET9 ID1):
```json
{
"checkExploit": {
"mset9": false
}
}
```
Here's a list of all the keys, their valid values and what they do.

## checkExploit
This object contains config for checking for remnants of exploits that should have been removed earlier on in the installation of custom firmware.

### mset9
Valid values: `true` (default), `false`

This checks whether a MSET9 ID1 exists, and if it does, it displays an error explaining that the user forgot to remove it and attempts to remove it after requesting permission. After it is removed, the script has the user remove and reinsert the SD card to continue to remount the `A:` drive.

### menuhax67
Valid values: `true` (default), `false`

This checks whether the menuhax67 exploit is installed, and if it is, asks the user for permission to remove it. This uses the [`configSavegame.lua`](data/luapackages/configSavegame.lua) library.

## apps
Contains booleans `Anemone3DS`, `Checkpoint`, `FBI`, `ftpd`, `Homebrew_Launcher`, and `Universal-Updater`.

These options can be modified within the script's menu.

## gm9
Valid values: `true` (default), `false`

Copies `GodMode9.firm` to `0:/luma/payloads` and `GM9Megascript.gm9` to `0:/gm9/scripts`

This *does not* change whether GodMode9 is copied to the NAND via payloadCopy.

## payloadCopy
Valid values: `"all"`, `"GodMode9"` (default), `false`

* If `"all"`: Copies all payloads from `0:/luma/payloads` to `1:/sys/rw/luma/payloads` after GodMode9 is copied to the SD card (if enabled).
* If `"GodMode9"`: Only copies GodMode9.firm from the romfs directly to `1:/sys/rw/luma/payloads`
* If `false`: Does not make any copies of payloads on the NAND.

This option *cannot* be modfied within the script's menu because GodMode9 provides brick protection.

## dspDump
Valid values: `true` (default), `false`

Dumps the DSP firmware to `0:/3ds/dspfirm.cdc`. This does essentially the same thing as navigating to `Miscellaneous options...` > `Dump DSP firmware` in the Rosalina menu.

## nullifyUserTimeOffset
Valid values: `true` (default), `false`

This does essentially the same thing as navigating to `Miscellaneous options...` > `Nullify user time offset` in the Rosalina menu.

This option can be modified within the script's menu because there is some debate about whether it should be done or not, and ultimately, it doesn't really make much difference.

## nandBackup
Valid values: `true` (default), `"essential"`, `false`

* If `true`: Creates backups of `nand_minsize.bin` (alongside a `.sha` SHA256 hash file) and `essential.exefs` in `0:/gm9/backups`
* If `"essential"`: Only creates a backup of `essential.exefs` in `0:/gm9/backups`
* If `false`: NAND backup is skipped. `complete_backupflag.png` is shown at the end of the script.

## copyBootFirmToNAND
Valid values: `true`, `false` (default)

Copies `0:/boot.firm` to `1:/boot.firm` so that the console can boot without a SD card inserted. Largely unnecessary since Luma3DS v11.0+ copies itself to the NAND whenever Luma3DS is updated or launched for the first time, but there are some situations where it might not be copied.
2 changes: 1 addition & 1 deletion GodMode9
Submodule GodMode9 updated 215 files
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ builds/finalize.romfs: builds
@3dstool -c -t romfs --romfs-dir romfs --file $@

builds/x_finalize_helper.firm: builds/finalize.romfs
@cp finalize_helper.gm9 GodMode9/data/autorun.gm9
@sed -i s/FINALIZE_SHA256SUM/$(shell sha256sum $< | awk '{print $$1}')/g GodMode9/data/autorun.gm9
@$(MAKE) -C GodMode9 SCRIPT_RUNNER=1
@cp finalize.lua GodMode9/data/autorun.lua
@cp data/language_select.png GodMode9/data/
@cp data/error34.png GodMode9/data/
@cp -r data/lang GodMode9/data/
@cp -r data/luapackages GodMode9/data/
@sha256sum $< | awk '{print $$1}' > GodMode9/data/finalize-romfs-hash
@$(MAKE) -C GodMode9 SCRIPT_RUNNER=1 AUTO_UNLOCK=1
@cp GodMode9/output/GodMode9.firm $@
@printf '\001' | dd conv=notrunc bs=1 seek=16 of=$@
clean:
@rm -rf builds
@$(MAKE) -C GodMode9 clean
@rm GodMode9/data/autorun.gm9
@rm -f GodMode9/data/autorun.lua
@rm -f GodMode9/data/finalize-romfs-hash
@rm -f GodMode9/data/language_select.png
@rm -f GodMode9/data/error34.png
@rm -rf GodMode9/data/lang
@rm -f GodMode9/data/luapackages/finalizeUtil.lua
@rm -f GodMode9/data/luapackages/configSavegame.lua
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
Scripts relating to Finalizing Setup on https://3ds.hacks.guide/finalizing-setup.

- [`/romfs/finalize/`](romfs/finalize): Files that are packed into `finalize.romfs`
- [`/romfs/finalize/img`](romfs/finalize/img): Images used for visual troubleshooting
- [`/romfs/finalize/finalize.gm9`](romfs/finalize/finalize.gm9): Script run after `finalize_helper.gm9` that:
- Installs base homebrew applications to SYSNAND SD (see below for list)
- Copies GodMode9 to CTRNAND (`/rw/luma/payloads`)
- Backs up `essential.exefs` to `/gm9/backups`
- Deletes CFW installation files that are no longer necessary
- Backs up minsize NAND backup to `/gm9/backups`
- `/romfs/finalize/donor.db`: Empty title database used for consoles that do not have title database (i.e. no eShop software)
- [`finalize_helper.gm9`](finalize_helper.gm9): Script that is compiled as GM9 scriptrunner (`finalize_helper.firm`); extracts `finalize.romfs`
- [`/romfs/finalize/img`](romfs/finalize/img): Images used for visual troubleshooting
- [`/romfs/finalize/donor.db`](romfs/finalize/donor.db): Empty title database used for consoles that do not have title database (i.e. no eShop software)
- [`finalize_helper.lua`](finalize_helper.lua): Lua script that is compiled as GM9 scriptrunner (`x_finalize_helper.firm`) that:
- Installs base homebrew applications to SYSNAND SD (see below for list)
- Copies all payloads inside `/luma/payloads` on the SD card to CTRNAND (`/rw/luma/payloads`)
- Backs up `essential.exefs` to `/gm9/backups`
- Deletes CFW installation files that are no longer necessary
- Backs up minsize NAND backup to `/gm9/backups`
- [`docs.md`](docs.md): Full error information / script documentation

## Bundled software
Expand All @@ -32,7 +31,7 @@ Releases are tagged for reference (based on usage in the guide). **Releases in t

### Automatically built binaries

Binaries are automatically built by [GitHub Actions](https://github.com/hacks-guide/finalize/actions/). Place `finalize_helper.firm` in `/luma/payloads/` and `finalize.romfs` on root of SD.
Binaries are automatically built by [GitHub Actions](https://github.com/hacks-guide/finalize/actions/). Place `x_finalize_helper.firm` in `/luma/payloads/` and `finalize.romfs` on root of SD.

### Manual file placement

Expand Down
20 changes: 20 additions & 0 deletions data/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"checkExploit": {
"mset9": true,
"menuhax67": true
},
"apps": {
"Anemone3DS": true,
"Checkpoint": true,
"FBI": true,
"ftpd": true,
"Homebrew_Launcher": true,
"Universal-Updater": true
},
"gm9": true,
"payloadCopy": "GodMode9",
"dspDump": true,
"nullifyUserTimeOffset": true,
"nandBackup": true,
"copyBootFirmToNAND": false
}
Binary file added data/error34.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions data/lang/en_US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"INIT_MESSAGE": "The Finalizing Setup Script is now starting...",
"ASK_FOR_HELP": "If this error persists, ask for help\non Discord: https://discord.gg/MWxPgEp",

"ERROR_00": "Error #00: Build error\nYou have encountered an error\nthat should only occur if the script\nwas built incorrectly.",
"ERROR_04": "Error #04: No space\n \nInsufficient space on SD card.\nYou need %s, but you have %s.\nMake some space, then try again.\n \nTIP: You can temporarily remove the Nintendo 3DS\nand DCIM folders from your SD card\nto make enough space.",
"ERROR_21": "Error #21: finalize.romfs not found\n \nfinalize.romfs could not be found on the SD card.\nCopy it to root of SD and try again.",
"ERROR_22": "Error #22: finalize.romfs is invalid\n \nThe file finalize.romfs is corrupt or unreadable.\nRe-download it, copy it to root of SD, and try again.\n \nExpected: %s\n \nReceived: %s",
"INFO_23" : "Information #23: finalize.romfs in wrong location\n \nfinalize.romfs is in the wrong location.\nThis script will attempt to move it.\nPlease hit <A> on the next few prompts.",
"ERROR_26": "Error #26: SD card not mounted.\n \nThis should not be possible.",
"WARN_34" : "Warning #34: SD card is counterfeit.\n \nYou should replace it with one from a reputable brand\nas soon as possible, or you will experience\ndata corruption.\n \nIf you encounter errors during software installation,\nyou will need to buy one from a reputable brand to\ncomplete this script."
}
Binary file added data/language_select.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
17 changes: 17 additions & 0 deletions data/luapackages/finalizeUtil.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local finalizeUtil = {}

function finalizeUtil.error(text, image, powerOff)
if image then
ui.show_png("9:/finalize/img/" .. image .. ".png")
end
if text then
ui.echo(text)
else
ui.echo(" ")
end
if powerOff then
sys.power_off()
end
end

return finalizeUtil
4 changes: 4 additions & 0 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@
- **CAUSE**: Chances are the user created the Nintendo 3DS folder by themselves.
- **FIX**: Boot into HOME Menu with SD inserted so that HOME Menu management data can be created. Then, re-run the script.

- **ERROR**: "Warning #34: SD card is counterfeit"
- **CAUSE**: Using a no-brand SD card with a known bad CID.
- **FIX**: Get a good quality SD from a trusted brand.

---

## Scriptrunner-integrated error checking (finalize_helper.firm)
Expand Down
Loading