Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Finally return to the Home Menu code properly, without state initiali…
Browse files Browse the repository at this point in the history
…zation being skipped. This fixes issue #3. This also fixes using the THEMEDATA_PATH build option: gfx is now displayed correctly with that. Added the ROP_STR_R0TOR1 gadget and updated README.
  • Loading branch information
yellows8 committed Oct 7, 2015
1 parent 717938f commit 288d30b
Show file tree
Hide file tree
Showing 35 changed files with 76 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
@@ -1,9 +1,9 @@
# Summary
When the Home Menu is starting up, it can load theme-data from the home-menu theme SD extdata. The flaw can be triggered from here. The ROP starts running at roughly the same time the LCD backlight gets turned on.

Although this triggers during Home Menu boot, this can't cause any true bricks: just remove the *SD card if any booting issues ever occur(or delete/rename the theme-cache extdata directory). Note that this also applies when the ROP causes a crash, like when the ROP is for a different version of Home Menu(this can also happen if you boot into a nandimage which has a different Home Menu version, but still uses the exact same SD data). However, it seems that normally(?) Home Menu crashes with this just result in Home Menu displaying the usual error dialog for system-applet crashes.
Although this triggers during Home Menu boot, this can't cause any true bricks: just remove the *SD card if any booting issues ever occur(or delete/rename the theme-cache extdata directory). Note that this also applies when the ROP causes a crash, like when the ROP is for a different version of Home Menu(this can also happen if you boot into a nandimage which has a different Home Menu version, but still uses the exact same SD data). In some(?) cases Home Menu crashes with this just result in Home Menu displaying the usual error dialog for system-applet crashes.

Since this is a theme exploit, a normal theme can't be used unless you build with the THEMEDATA_PATH option below(the ROP runs a good while after the theme is loaded). Due to how this hax works, the theme is really only usable for BGM(as described below).
Since this is a theme exploit, a normal theme can't be used unless you build with the THEMEDATA_PATH option below(the ROP runs a while after the theme is loaded).

# Vuln
This was discovered on December 22, 2014.
Expand Down Expand Up @@ -37,7 +37,7 @@ The initial release archive only supported USA, EUR, and JPN. The latest git als
# Building
Just run "make", or even "make clean && make". For building ROP binaries which can be used for general homemenu ROP, this can be used: "{make clean &&} make ropbins". "make bins" is the same as "make", except building the .lz is skipped.

Before building, the menurop directories+files must be generated. "./generate_menurop_addrs.sh {path}". See the source of that script for details(this requires the Home Menu code-binaries). Note that the USA/EUR/JPN homemenu exefs:/.code binaries starting with system-version v9.2 are all identical(prior to v9.9), while USA/EUR binaries for v9.0 differs from the JPN versions. If you don't have the required Home Menu code-binaries, you can use the MENUROP_PATH option listed below.
Before building, the menurop directories+files must be generated. "./generate_menurop_addrs.sh {path}". See the source of that script for details(this requires the Home Menu code-binaries). Note that the USA/EUR/JPN homemenu exefs:/.code binaries starting with system-version v9.2 are all identical(prior to v9.9), while USA/EUR binaries for v9.0 differs from the JPN versions. If you don't have the required Home Menu code-binaries, you can use the MENUROP_PATH option listed below(this is the recommended way to build this).

The built files for BodyCache.bin/Body_LZ.bin are located under "themepayload/".

Expand All @@ -55,14 +55,14 @@ Build options:
* "ENABLE_LOADROPBIN=1" Load a homemenu ropbin then stack-pivot to it, see the Makefile HEAPBUF_ROPBIN_* values for the load-address. When LOADSDPAYLOAD isn't used, the binary is the one specified by CODEBINPAYLOAD, otherwise it's loaded from "sd:/menuhax_ropbinpayload.bin". The binary size should be <=0x10000-bytes.
* "ENABLE_HBLAUNCHER=1" When used with ENABLE_LOADROPBIN, setup the additional data needed by the hblauncher payload.
* "MENUROP_PATH={path}" Use the specified path for the "menurop" directory, instead of the default one which requires running generate_menurop_addrs.sh. To use the prebuilt menurop headers included with this repo, the following can be used: "MENUROP_PATH=menurop_prebuilt".
* "THEMEDATA_PATH={*decompressed* regular theme body_LZ filepath}" Build hax with the specified theme, instead of using the "default theme" one. When Home Menu starts the actual rendering however, the gfx for the theme doesn't display properly due to the hax. BGM works fine, therefore this should only used for BGM-only themes(where the themedata header is all-zero except for the version and BGM fields). Also note that compression during building takes a *lot* longer with this.
* "THEMEDATA_PATH={*decompressed* regular theme body_LZ filepath}" Build hax with the specified theme, instead of using the "default theme" one. Also note that compression during building takes a *lot* longer with this.

The build command used for the release archive is the following: make clean && time make LOADSDPAYLOAD=1 USE_PADCHECK=0x200 ENABLE_LOADROPBIN=1 ENABLE_HBLAUNCHER=1 LOADSDCFG_PADCHECK=1 MENUROP_PATH=menurop_prebuilt

# Usage
Just boot the system, the haxx will automatically trigger when Home Menu loads the theme-data from the cache in SD extdata. The ROP right after the ROP for USE_PADCHECK, if that's even enabled, will overwrite the main-screen framebuffers with data from elsewhere, resulting in junk being displayed.

When the ROP returns from the haxx to running the actual Home Menu code, such as when USE_PADCHECK is used where the current PAD state doesn't match the specified state, Home Menu will use the "theme" data from this hax: the end result is that it appears to use the same theme as the default one.
When the ROP returns from the haxx to running the actual Home Menu code, such as when USE_PADCHECK is used where the current PAD state doesn't match the specified state, Home Menu will use the "theme" data from this hax: the end result is that it appears to use the same theme as the default one(when the THEMEDATA_PATH build option wasn't used).

When built with ENABLE_LOADROPBIN=1, this can boot into the homebrew-launcher if the ropbin listed above is one for the homebrew-launcher and was pre-patched.

Expand Down
1 change: 1 addition & 0 deletions homemenu_ropgadget_script
Expand Up @@ -10,6 +10,7 @@
--patterndata=06875506f101dd62c4b8877e77b51fd2d0e58c09c6f1b165865949fe4ac6128d --patternsha256size=0x4 "--plainout=#define POP_R4R5R6PC "

--patterndata=d6fdb6fb53b97ea0ffdf9e38f755ba28aa6bc13990292a8f10d4d3904cb10c33 --patternsha256size=0x8 "--plainout=#define ROP_STR_R1TOR0 "
--patterndata=17f19cd8b8896468edbad52b1a47862f432c6f7b119e7f5b2f4458d3a9009795 --patternsha256size=0x8 "--plainout=#define ROP_STR_R0TOR1 "
--patterndata=b77067177e2cd4f7aab57202cca9d6a8fff0ef2551d1d0367b58c2cafdf2d8d0 --patternsha256size=0x8 "--plainout=#define ROP_LDR_R0FROMR0 "
--patterndata=aa6a623d7c3291340160fd74738249e68b3b4ac2b59cd2c9b5846adcfefb702f --patternsha256size=0xc "--plainout=#define ROP_LDRR1R1_STRR1R0 "
--patterndata=783e1007d4808f89c1b1fde53a71dd6fff0d9cd7eb59cee7fb0993e1bb1aae38 --patternsha256size=0x8 "--plainout=#define ROP_MOVR1R3_BXIP "
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/11272
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f1ee4
#define ROP_MOVR1R3_BXIP 0x001b8848
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/12288
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f1e7c
#define ROP_MOVR1R3_BXIP 0x001b8708
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/13330
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003bc
#define ROP_MOVR1R3_BXIP 0x001c2e24
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/14336
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003bc
#define ROP_MOVR1R3_BXIP 0x001c2e24
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/15360
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003a0
#define ROP_MOVR1R3_BXIP 0x001c2e08
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/16404
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d38
#define ROP_LDRR1R1_STRR1R0 0x00213f9c
#define ROP_MOVR1R3_BXIP 0x001ce768
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/17415
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118cdc
#define ROP_LDRR1R1_STRR1R0 0x00213e64
#define ROP_MOVR1R3_BXIP 0x001cec08
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/19456
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213f6c
#define ROP_MOVR1R3_BXIP 0x001cece4
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/EUR/20480
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213f88
#define ROP_MOVR1R3_BXIP 0x001ced00
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/13313
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f0a2c
#define ROP_MOVR1R3_BXIP 0x001b7ac0
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/14336
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f1ee4
#define ROP_MOVR1R3_BXIP 0x001b8848
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/15360
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f1e7c
#define ROP_MOVR1R3_BXIP 0x001b8708
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/16402
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003bc
#define ROP_MOVR1R3_BXIP 0x001c2e24
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/17408
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003bc
#define ROP_MOVR1R3_BXIP 0x001c2e24
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/18432
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003a0
#define ROP_MOVR1R3_BXIP 0x001c2e08
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/19476
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d38
#define ROP_LDRR1R1_STRR1R0 0x00213f9c
#define ROP_MOVR1R3_BXIP 0x001ce768
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/20487
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118cdc
#define ROP_LDRR1R1_STRR1R0 0x00213e64
#define ROP_MOVR1R3_BXIP 0x001cec08
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/22528
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213f6c
#define ROP_MOVR1R3_BXIP 0x001cece4
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/JPN/23552
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213f88
#define ROP_MOVR1R3_BXIP 0x001ced00
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/KOR/6166
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d38
#define ROP_LDRR1R1_STRR1R0 0x00213f2c
#define ROP_MOVR1R3_BXIP 0x001ce758
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/KOR/7175
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118cdc
#define ROP_LDRR1R1_STRR1R0 0x00213cc8
#define ROP_MOVR1R3_BXIP 0x001cea94
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/KOR/8192
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213d40
#define ROP_MOVR1R3_BXIP 0x001ceae0
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/11272
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f1ee4
#define ROP_MOVR1R3_BXIP 0x001b8848
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/12288
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b90

#define ROP_STR_R1TOR0 0x00103f40
#define ROP_STR_R0TOR1 0x00102960
#define ROP_LDR_R0FROMR0 0x0010efe8
#define ROP_LDRR1R1_STRR1R0 0x001f1e7c
#define ROP_MOVR1R3_BXIP 0x001b8708
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/13330
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003bc
#define ROP_MOVR1R3_BXIP 0x001c2e24
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/14336
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003bc
#define ROP_MOVR1R3_BXIP 0x001c2e24
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/15360
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b94

#define ROP_STR_R1TOR0 0x00103f58
#define ROP_STR_R0TOR1 0x0010297c
#define ROP_LDR_R0FROMR0 0x0010f01c
#define ROP_LDRR1R1_STRR1R0 0x002003a0
#define ROP_MOVR1R3_BXIP 0x001c2e08
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/16404
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d38
#define ROP_LDRR1R1_STRR1R0 0x00213f9c
#define ROP_MOVR1R3_BXIP 0x001ce768
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/17415
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118cdc
#define ROP_LDRR1R1_STRR1R0 0x00213e64
#define ROP_MOVR1R3_BXIP 0x001cec08
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/19456
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213f6c
#define ROP_MOVR1R3_BXIP 0x001cece4
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/20480
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213e24
#define ROP_MOVR1R3_BXIP 0x001cead4
Expand Down
1 change: 1 addition & 0 deletions menurop_prebuilt/USA/21504
Expand Up @@ -10,6 +10,7 @@
#define POP_R4R5R6PC 0x00101b74

#define ROP_STR_R1TOR0 0x00104020
#define ROP_STR_R0TOR1 0x00102968
#define ROP_LDR_R0FROMR0 0x00118d08
#define ROP_LDRR1R1_STRR1R0 0x00213e40
#define ROP_MOVR1R3_BXIP 0x001ceaf0
Expand Down
38 changes: 38 additions & 0 deletions themedata_payload.s
Expand Up @@ -336,6 +336,44 @@ CALLFUNC_NOSP FS_MountSdmc, (HEAPBUF + (sd_archivename - _start)), 0, 0, 0
#ifdef USE_PADCHECK
PREPARE_RET2MENUCODE

@ The below adds the saved LR value on stack used during RET2MENU, with a certain value. This basically subtracts the saved LR so that a function which was previously only executed with the themehax state, gets executed again with the real state this time. Without this, this particular function never gets executed with normal state, which broke various things.
ROP_SETLR ROP_POPPC

.word POP_R0PC
.word (HEAPBUF + (rop_ret2menu_stack_lrval - _start)) @ r0

.word POP_R1PC
.word TARGETOVERWRITE_STACKADR+0xc @ r1

.word ROP_LDRR1R1_STRR1R0 @ Copy the saved LR value on the stack which gets used during RET2MENU, to rop_ret2menu_stack_lrval.

.word POP_R0PC
rop_ret2menu_stack_lrval:
.word 0

.word POP_R1PC
#if (REGIONVAL==0 && MENUVERSION>15360) || (REGIONVAL!=0 && REGIONVAL!=4 && MENUVERSION>12288) || (REGIONVAL==4)//Check for system-version >v9.2.
.word 0xfffffff4
#else
.word 0xfffffff8
#endif

.word ROP_ADDR0_TO_R1 @ r0 = rop_ret2menu_stack_lrval + <above r1 value>

.word POP_R1PC
.word (HEAPBUF + (rop_ret2menu_stack_newlrval - _start))

.word ROP_STR_R0TOR1 @ Write the above r0 value to rop_ret2menu_stack_newlrval.

.word POP_R0PC
.word TARGETOVERWRITE_STACKADR+0xc @ r0

.word POP_R1PC
rop_ret2menu_stack_newlrval:
.word 0 @ r1

.word ROP_STR_R1TOR0 @ Write the new LR value to the stack.

#ifdef LOADSDCFG_PADCHECK
@ Load the cfg file. Errors are ignored with file-reading.
CALLFUNC_NOSP MEMSET32_OTHER, (HEAPBUF + (IFile_ctx - _start)), 0x20, 0, 0
Expand Down

119 comments on commit 288d30b

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yellows8
My default theme filesize 303,127 Bytes and I use LZ11 Decompresser to decompress it.
The decompressed input theme for THEMEDATA_PATH is 604,693 Bytes
If I use the .byte 0, 0, 0 (to align the theme data to 4 bytes, being 604,696 Bytes),
the *themehax .lz file is 1,376,255 Bytes
and the *themehax .bin file is 625,072 Bytes
This doesn't work for me (maybe because the *.lz is not 4-byte aligned now
Edit: nvm the original one is 1,376,254 Bytes which is not 5-byte aligned either.)

Without using the .byte 0, 0, 0
the *themehax .lz file is 1,376,254 Bytes
and the *themehax .bin file is 625,072 Bytes (Same as with the byte code)

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZodeHax Are you sure it's decompressed? You can decompress it by dragging the body_LZ.bin onto lzss3.py, which will overwrite the file. Try decompressing it again just in case.

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FayneAldan dragging body_LZ.bin onto lzss3.py does nothing. That's why I am using LZ11 decompresser.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZodeHax Then run python lzss3.py <Theme filename>

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FayneAldan I did that afterwards. But it doesn't seem to do anything.
Filesize stays at 303,127 Bytes and the last edited date stays the same. (The only thing that changes is "Last accessed")

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have HexEdit? What OS are you on?

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am able to hexedit. I am on Windows Server.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open the file in hex edit then move the cursor to the end of the file. Enter 00 until you have four 00's in the last block of text.

Still, themehax seems to be broken with the latest commit. For me, it crashes the kernel with the "An error has occurred. Hold down the POWER Button to turn off the power, then turn it on and try again." message when I try to enter HB.

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the size of your theme?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

524,828 bytes

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems more likely than 303,127 Bytes for a decompressed theme.
And what's the size of your built *.lz file?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1,376,253 bytes

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like that doesn't have to be 4byte aligned.
Now I built it with the file that wasn't changed from lzss3.py and installed it with the themehax installer v1.3.
It doesn't make me stuck in a black screen on startup anymore, but it doesn't show the theme either. I still ahve the default theme now. (HBL works though)

Edit: Rebuilt with a manually 4-byte aligned decompressed (by LZ11) theme.
Installed the theme with themehax Installer v1.3 with a bgm file.

Theme and BGM work and HBL is still runable via themehax.

Edit 2: Seems to crash a lot now. After either loading 3 different titles (having them selected once) or selecting a second title and trying to run it.
Seems to be caused by running out of RAM. This will probably run more stable on n3DS.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Seems to crash a lot now. After either loading 3 different titles (having them selected once) or selecting a second title and trying to run it."
With the public git there's various Home Menu state that's left corrupted, so odd issues shouldn't be completely unexpected(unlike with my local changes regarding Home Menu state).

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FayneAldan Do you see anything displayed before the fatal-error?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yellows8 All I see if the pixel mess that normally appears when an exploit is launched, but then it goes straight to the fatal error. No debug screen, even.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FayneAldan What's the entire build commands you're using?(Sounds like my ROP is triggering that)

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same command used for the release archive, as shown in the README. If it helps any, I'm using FW 10.1.0-27U on a New 3DS XL.
EDIT: So, as such, I only have it compiling menuhax_USA21504_new3ds.lz

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using the latest themehax_installer built from git too?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I even tried using this commit (the one we're commenting on), but it didn't work either.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My ROP only triggers fatal-error when loading data from SD fails(like when the file doesn't exist). So you must not have run the latest installer properly.

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yellows8 I expected it to not run perfectly stable. There may not be much reason to actually bother about this much more due to your local changes. They seem to make it better anyway.
Just thought I'd report that.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installer works perfectly fine with the payloads in the release archive..

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must use git builds for both the installer and theme-payloads. They are incompatible with v1.2.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, okay. Thanks. Also, you should make some icons for your Homebrew apps, even if it's just text on an image. I wanna be able to easily spot a certain Homebrew app, since I'm using a custom HB launcher that shows the icons in a grid.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, just wanna point out this other problem: https://gbatemp.net/threads/release-homebrew-launcher-with-grid-layout.397527/page-57#post-5731660
I'm not sure if it's fixed, but yeah.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone makes a dedicated themehax_installer icon.png it won't be me.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could probably make the icon. I have an idea, but I need an icon that has a "hack" kinda feel, if you know what I mean. I'll use that icon along with the theme shop icon. ;)

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Also, just wanna point out this other problem" <- #6

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


There's my idea for an icon, but others could definitely do better.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks more like a "Home Menu {settings/config}" icon than haxx installer.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A wrench is the best thing I could think of for "haxx"

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, did you get it setup correctly with the latest git builds for the installer and themehax?(But tbh most of this would have been better in an actual github issue...)

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah. I was gonna do that, wasn't I? -Is watching 40 minute long YouTube video. Only 15 minutes in...-
Uuuuugh..... -pauses video-

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still get a fatal error with the new installer.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it helps any, I can try to compile my thing for your FW version, in case it's just me or something.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What all "/ropbinpayload_" file(s) exist on your SD card?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh... 18 minutes into my video... -presses home button-

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only ropbinpayload_menuhax_USA21504_new3ds.bin

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the sha256 hash of your built themehax .lz?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DANG IT. -presses home again-

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't seem to have sha256 on here, but...

  File: ropbinpayload_menuhax_USA21504_new3ds.bin
CRC-32: cdda01a3
   MD4: 9a371b54d52277da4bc52b63cdb9e305
   MD5: 7d96736fa88730a8a742a175b0351db2
 SHA-1: 2ff1583e356ac58bcb366bb7c5992535ea7c1f88

I have just about everything else. XD

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the .lz which the installer used for installation.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  File: menuhax_USA21504_new3ds.lz
CRC-32: 339547f1
   MD4: 38c6eb91f99f1809a275df4301526336
   MD5: 9e492f2a46fe8a3f8640f84507dc819a
 SHA-1: df85076f09837a7e28ef50ea6420a673de55b76e

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't match, are you really on the latest git commit?

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"are you really on the latest git commit?"
"I even tried using this commit (the one we're commenting on), but it didn't work either."
Oops... GG. 😆

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still crashes, even with latest commit.

  File: menuhax_USA21504_new3ds.lz
CRC-32: c2e20055
   MD4: 2f754283326b7926f5d9595f54f6fd41
   MD5: 0609529481aea74f42b3920975815535
 SHA-1: f5e7c52257842c6b5394fdbb76aed076227ed2b4

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make clean && time make LOADSDPAYLOAD=1 USE_PADCHECK=0x200 ENABLE_LOADROPBIN=1 ENABLE_HBLAUNCHER=1 LOADSDCFG_PADCHECK=1 MENUROP_PATH=menurop_prebuilt
openssl sha -sha1 themepayload/menuhax_USA21504_new3ds.lz
SHA1(themepayload/menuhax_USA21504_new3ds.lz)= 7714244462eb48b50c94d4e2dfd520075bfb3d19

EDIT:

openssl sha -sha1 binpayload/menuhax_USA21504_new3ds.bin
SHA1(binpayload/menuhax_USA21504_new3ds.bin)= c318863c60948456b55ec0a5b896162198d93a15

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yellows8 The crashing may be associated with the "custom sound" some themes make when selecting specific things. I am not entirely certain about that yet. Need to look into that further.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still end up with a different checksum...

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZodeHax It crashes even when I don't compile it with a theme.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually just noticed that I messed up changing the payload code back to latest commit. I reupdated the code, but it still doesn't work.

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FayneAldan I mean the crashing problem I had/have.
I don't know about your problem though.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I'll try redownloading the source and compiling without deleting any of the robbins or any of that.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what? My ropbin has a different checksum then the one on the repo. XD

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I somehow ended up with old code mixed with new code. I redownloaded the source and I'm about to test it.

@RuiNtD
Copy link

@RuiNtD RuiNtD commented on 288d30b Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Still doesn't work... 😕

@ZodeHax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I get these crashes sometimes I was talking about. The weird thing is, if I start YouTube and press the home button to return to my home menu I can acess select everything without getting any crashes. Can just close the YouTube app and run whatever. Does the theme load differently or something?

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about no more comments/whatever regarding this THEMEDATA_PATH option before next release.

@yellows8
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZodeHax Same thing as #16 really, which is now closed.

Please sign in to comment.