Hacking Official Corbenik - Another CFW for advanced users (with bytecode patches!)

  • Thread starter Thread starter chaoskagami
  • Start date Start date
  • Views Views 286,873
  • Replies Replies 2,153
  • Likes Likes 60
Finally! Another EmuNAND on my SD card without the agony of backing up files for an ~hour!..
Or is it? Will it work from 'both sides'? For example, one standard EmuNAND for Gateway and the reverse one for Corbenik. Will both EmuNANDs be accessible from Corbenik?

I don't see why not. Flipping 'reverse layout' will read emunand from the back, while having it off reads the front. I don't see why you couldn't have both.

EDIT: The only real downside is that none of the common tools like Decrypt9 understand reversed emunand right now, so unless it gets better support, you'll likely need to manually inject them with dd or something.
 
Last edited by chaoskagami,
A quick fix would be to remove basename entirely, which should still work because of how it calls it (though make stops on error, so there could be more):

Code:
diff -urN bdfe/main.c bdfe-fix/main.c
--- bdfe/main.c   2016-06-16 18:19:00.496718800 +0000
+++ bdfe-fix/main.c   2016-06-16 18:18:06.770896500 +0000
@@ -86,13 +86,13 @@
   unsigned gmin = 32, gmax = 126;
   if (argc < 2) {
-     usage(basename(argv[0]));
+     usage(argv[0]);
     return -1;
   }
   for(int i = 1; i < argc; i++) {
     if (arg_is(argv[i], "-?", "help")) {
-       usage(basename(argv[0]));
+       usage(argv[0]);
       return 0;
     }
@@ -208,7 +208,6 @@
   char buf[16];
   sprintf(buf, "%dx%d", of.gw, of.gh);
-   file = basename(file);
   ossd_putlx(0, -1, file, OSSD_TEXT_REVERSE);
   ossd_putlx(8 - gh, -1, buf, OSSD_TEXT_UNDERLINE | OSSD_TEXT_OVERLINE);
   buf[1] = '\0';

In this case, mingw won't work then (it doesn't provide posix emulation.) You'll have to use cygwin (which does support basename)
Thanks for the time :)
But like you said, make stops on error and there are more.
It's not the corbenik source, cause if you only gitclone bdfe and build it, you get the same error, so the error generated comes from bdfe source

Build with main.c changes posted above
Code:
D:\ABuildCFWs\corbenik-O3DS>make full
make -C host/bdfe
make[1]: Entering directory `/d/ABuildCFWs/corbenik-O3DS/host/bdfe'
g++ -c -Wall -Werror -g -DOSSD_TARGET=OSSD_IF_LINUX ossd_i2c.c -o ossd_i2c.o
ossd_i2c.c:45:21: fatal error: alloca.h: No such file or directory
compilation terminated.
make[1]: *** [ossd_i2c.o] Error 1
make[1]: Leaving directory `/d/ABuildCFWs/corbenik-O3DS/host/bdfe'
make: *** [hosttools] Error 2

Same build with main.c changes above when building bdfe standalone
Code:
D:\Z_Testing\bdfe>make
g++ -c -Wall -Werror -g -DOSSD_TARGET=OSSD_IF_LINUX main.c -o main.o
g++ -c -Wall -Werror -g -DOSSD_TARGET=OSSD_IF_LINUX ossd_i2c.c -o ossd_i2c.o
ossd_i2c.c:45:21: fatal error: alloca.h: No such file or directory
compilation terminated.
make: *** [ossd_i2c.o] Error 1
 
Thanks for the time :)
But like you said, make stops on error and there are more.
It's not the corbenik source, cause if you only gitclone bdfe and build it, you get the same error, so the error generated comes from bdfe source

Build with main.c changes posted above
Code:
D:\ABuildCFWs\corbenik-O3DS>make full
make -C host/bdfe
make[1]: Entering directory `/d/ABuildCFWs/corbenik-O3DS/host/bdfe'
g++ -c -Wall -Werror -g -DOSSD_TARGET=OSSD_IF_LINUX ossd_i2c.c -o ossd_i2c.o
ossd_i2c.c:45:21: fatal error: alloca.h: No such file or directory
compilation terminated.
make[1]: *** [ossd_i2c.o] Error 1
make[1]: Leaving directory `/d/ABuildCFWs/corbenik-O3DS/host/bdfe'
make: *** [hosttools] Error 2

Same build with main.c changes above when building bdfe standalone
Code:
D:\Z_Testing\bdfe>make
g++ -c -Wall -Werror -g -DOSSD_TARGET=OSSD_IF_LINUX main.c -o main.o
g++ -c -Wall -Werror -g -DOSSD_TARGET=OSSD_IF_LINUX ossd_i2c.c -o ossd_i2c.o
ossd_i2c.c:45:21: fatal error: alloca.h: No such file or directory
compilation terminated.
make: *** [ossd_i2c.o] Error 1

Yeah, this is the stopping point for mingw. It can go no further - alloca.h is a POSIX header. Either use the cygwin gcc (it does work) or build on linux.
 
  • Like
Reactions: DjoeN
Just 1 last question about it :)
How to force it to use cygwin gcc instead of mingw g++?

Do you have cygwin installed? Open a cygwin shell and build from there. Make sure you actually installed the compiler while running setup, and that the mingw gcc isn't before the cygwin /usr/bin in the path.
 
A really trivial nitpick but isn't it start and end of the disk rather than front and back?

Nitpick duly noted, but it makes no difference here. The front/start is `sector 0`, the back/end is `sectors-1`. Do you want me to use sector notation instead? Perhaps head and tail? ;P

(To be clear, I'm just joking around b/c I'm overtired at this point. No offense. :P)
 
Last edited by chaoskagami,
Nitpick duly noted, but it makes no difference here. The front/start is `sector 0`, the back/end is `sectors-1`. Do you want me to use sector notation instead? ;P
Heh, it's just a style thing.

As for the sectors, it wouldn't bother me since I do know a fair bit about hardware (or did anyway, haven't really studied it for years), but I'd expect some other users to be annoyed. :D
 
  • Like
Reactions: chaoskagami
Heh, it's just a style thing.

As for the sectors, it wouldn't bother me since I do know a fair bit about hardware (or did anyway, haven't really studied it for years), but I'd expect some other users to be annoyed. :D

Now is the part where I need to be corrected because I realize it isn't `sectors-1` and `sector 0` because the 3DS doesn't use LBA, so it actually starts at sector 1 and ends at `sectors`. Wow me. Time to fix some code... And it turns out the sdmmc code uses zero-based sectors. God, I'm tired.

I'll try to make a concerted effort to use start and end in the future, but no guarantees. :D
 
Last edited by chaoskagami,
Now is the part where I need to be corrected because I realize it isn't `sectors-1` and `sector 0` because the 3DS doesn't use LBA, so it actually starts at sector 1 and ends at `sectors`. Wow me. Time to fix some code... And it turns out the sdmmc code uses zero-based sectors. God, I'm tired.
I was just about to ask about that. Hardware or low level code counting from one sounded really odd.
I'll try to make a concerted effort to use start and end in the future, but no guarantees. :D
I suppose I could find it in myself to forgive the occasional lapse ;):lol:
 
I was just about to ask about that. Hardware or low level code counting from one sounded really odd.

It's more a historical thing than anything, but usually sectors ARE counted from one on PCs unless LBA (logical block addressing) is used. Relevant:
http://wiki.osdev.org/Partition_Table

It had something to do with the MBR being part of the firmware. Or floppies. Not really sure.

I suppose I could find it in myself to forgive the occasional lapse ;):lol:

All humans lapse occasionally.
 
Last edited by chaoskagami,
It had something to do with the MBR being part of the firmware. Or floppies. Not really sure.
It could be reserved space for the track start marker? I remember floppies had holes punched in the medium as a rotation marker. That would take up a sector.

I'm glad CHS addressing is gone though.
 
  • Like
Reactions: chaoskagami
It could be reserved space for the track start marker? I remember floppies had holes punched in the medium as a rotation marker. That would take up a sector.

I'm glad CHS addressing is gone though.

I honestly don't know, really. I should go look that up sometime. See, I never really used floppies. By the time I had a computer, CDs were already a thing.
 
Heh, be glad you missed them. Be gladder you missed software on audio tapes :)

Music on audio tapes I did see, and VHS were a thing too. But software? That sounds awful. Why?

EDIT: Also, we seem to be getting off topic here, heh.
 
Music on audio tapes I did see, and VHS were a thing too. But software? That sounds awful. Why?
It was awful. And it was because it was the standard storage device on systems like the Sinclair ZX Spectrum. (I had one)
EDIT: Also, we seem to be getting off topic here, heh.
Oops, sorry about that.
...
I had a quick look at converting gateshark cheats to bytecode patches but realised I don't actually want to cheat at any of the games I have >_<
 
I had a quick look at converting gateshark cheats to bytecode patches but realised I don't actually want to cheat at any of the games I have >_<

You can't convert gateshark codes to bytecode patches because they patch values in RAM. Loader can only patch code, not RAM. Once the game is running, loader can't touch it. Obviously you can hook whatever puts said values in RAM, though.

If I can figure out a way to keep code running in the background, this will happen someday.
 
Last edited by chaoskagami,
You can't convert gateshark codes to bytecode patches because they patch values in RAM. Loader can only patch code, not RAM. Once the game is running, loader can't touch it. Obviously you can hook whatever puts said values in RAM, though.
Ok, I'll leave that for now. I suppose that hans stuff would be a better place to start looking, given the mystery machine patch.
 
Ok, I'll leave that for now. I suppose that hans stuff would be a better place to start looking, given the mystery machine patch.

There's multiple things I want to do, but most of the easy stuff is done. The harder stuff takes time. Keep in mind also that no software aside from NTR can do actual overlays generically - HANS isn't really an overlay per-se since it requires an entire romfs image.

In terms of difficulty to implement...I'd say that overlays are actually harder than RAM cheatcodes.
 
  • Like
Reactions: Arcanuskun
There's multiple things I want to do, but most of the easy stuff is done. The harder stuff takes time. Keep in mind also that no software aside from NTR can do actual overlays generically - HANS isn't really an overlay per-se since it requires an entire romfs image.
I mostly thought of HANS since the Mystery Machine Spoofer was said to be based on it. I'll look around for any other interesting ideas, no learning is ever wasted after all. :)

I do like how clear and compact the spoofer bytecode patch is.
 

Site & Scene News

Popular threads in this forum