Homebrew Making a Genesis Plus GX 1.4.0 (r535) forwarder.

niishou

Member
OP
Newcomer
Joined
Aug 24, 2010
Messages
8
Trophies
0
XP
13
Country
Well, I made a forwarder .dol using WiiMC Forwarder Source, and using Static Base WAD, with AHBPROT set. It worked flawlessly with r502 of GenPlus GX, but, with this new update (r535) it stopped working (I just get a black screen). I searched a little and I found that GenPlus had changed something in it's way of loading (If I understood right).

QUOTE said:
From: Issue 125
EkeEke: Actually I was wrong, there WAS a difference in rev 502: the emulator would automatically try to reload into IOS58 if AHBPROT was not detected (i.e was not set by the loader channel) AND if IOS58 was not already loaded (i.e was not reloaded or used by the loader channel already).

However, that still means your forwarder is not loading the application properly, probably because it is not shutting and/or reloading down IOS stuff, I guess this is not so trivial to do and only "serious" loaders to this properly, hence why unofficial forwarders are not supported.

Let's hope that can help fixing the code in your forwarder
So, I would ask you: What I can do to make it work, keeping all features? I don't know nothing about programming, by the way.

Do I need to change something in WiiMC Forwarder Source or there is no way to keep AHBPROT feature?

OR... Am I forced to use Homebrew Channel now?

Thanks in advantage.
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
29
Location
???
XP
11,238
Country
Germany
niishou said:
turbotronic said:
try the cfg usbloader wad from fix94 (supports meta.xml settings) und add to your genplus meta.xml

I tried it, but I'm still getting a black screen.
Hey niishou, I tried it now and it works fine! I don't tested the argument, but it works fine without! I would make you a new forwarder, but my PC is broken... You can test my compiled genplus-gx version, use the mediafire link in my signature and please make sure you are using my latest cfg-loader forwarder:
http://forwarder.fo.funpic.de/USBLoaderCFG...0IOS58%20v5.wad
 

niishou

Member
OP
Newcomer
Joined
Aug 24, 2010
Messages
8
Trophies
0
XP
13
Country
Thank you, FIX94.

Looks like it's the .dol uploaded in Google Code, with your compiled version works everything, your channel and mine. Now, for curiosity, why it works with your .dol and doesn't work with the other one?

Your version is heavier (2.341 KB) than the other one (1.547 KB) that's the only difference I can see xD.
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
29
Location
???
XP
11,238
Country
Germany
My version is compiled with the libogc and libfat svn and the other libs are also bigger, that's it. Everything else is the same, I don't know why the official one doesn't work with a forwarder.
 

Skater4599

Well-Known Member
Member
Joined
May 29, 2008
Messages
965
Trophies
1
Location
United States
XP
1,554
Country
United States
FIX94 said:
My version is compiled with the libogc and libfat svn and the other libs are also bigger, that's it. Everything else is the same, I don't know why the official one doesn't work with a forwarder.


Does yours load the app from USB drive? I've only gotten it working from SD card, but have not tried recently
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
29
Location
???
XP
11,238
Country
Germany
Skater4599 said:
Does yours load the app from USB drive? I've only gotten it working from SD card, but have not tried recently
It works, yes. I tested my compiled version only now.
 

Jacobeian

Well-Known Member
Member
Joined
May 15, 2008
Messages
1,893
Trophies
0
XP
387
Country
Cuba
QUOTE said:
Your version is heavier (2.341 KB) than the other one (1.547 KB) that's the only difference I can see xD.

I think I got it.

I compile my own version as well and they also are bigger than the one in googlecode,I always wondered why but...
After some researches, it seems the official versions of genplus are compressed with dollz, this is an utility to compress compiled dol.

Anyway, it seems compressed dols are not compatible with forwarders, most likely, decompression use memory that is also used by the loader
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
29
Location
???
XP
11,238
Country
Germany
Jacobeian said:
I think I got it.

I compile my own version as well and they also are bigger than the one in googlecode,I always wondered why but...
After some researches, it seems the official versions of genplus are compressed with dollz, this is an utility to compress compiled dol.

Anyway, it seems compressed dols are not compatible with forwarders, most likely, decompression use memory that is also used by the loader
yaywii.gif
Amazing find! That's a very helpful information, I never heard from dollz before.
 

Jacobeian

Well-Known Member
Member
Joined
May 15, 2008
Messages
1,893
Trophies
0
XP
387
Country
Cuba
More on that, I runned doltool -i on the boot.dol that is on the download page.

There are actually two .text sections (code portions):

one at $80499BE0 which is 2016 bytes long
another one at $8049A3C0 which is 1581152 bytes long

entrypoint of the DOL is $80499BE0 so the first section is much likely the dollz decompression routine which runs first and the second section is the original DOL compressed, which is decompressed, relocated and finally booted.

I think the entrypoint is calculated by Dollz so it runs just after the memory area reserved to the original DOL, and does not overwrite itself while decompressing/relocating it.

Now, in the WiiMC forwarder source code I see this:

Code:
ÂÂÂÂ// load entry point
ÂÂÂÂstruct __argv args;
ÂÂÂÂbzero(&args, sizeof(args));
ÂÂÂÂargs.argvMagic = ARGV_MAGIC;
ÂÂÂÂargs.length = strlen(filepath) + 2;
ÂÂÂÂargs.commandLine = (char*)malloc(args.length);
ÂÂÂÂstrcpy(args.commandLine, filepath);
ÂÂÂÂargs.commandLine[args.length - 1] = '';
ÂÂÂÂargs.argc = 1;
ÂÂÂÂargs.argv = &args.commandLine;
ÂÂÂÂargs.endARGV = args.argv + 1;

ÂÂÂÂentrypoint exeEntryPoint = (entrypoint)load_dol_image(buffer, &args);


and in the function load_dol_image:

Code:
ÂÂÂÂif (argv && argv->argvMagic == ARGV_MAGIC)
ÂÂÂÂ{
ÂÂÂÂÂÂÂÂvoid *new_argv = (void *) (dolfile->entry_point + 8);
ÂÂÂÂÂÂÂÂmemmove(new_argv, argv, sizeof(*argv));
ÂÂÂÂÂÂÂÂDCFlushRange(new_argv, sizeof(*argv));
ÂÂÂÂ}

This is most likely used to pass parameters to the loaded DOL and it probably works with applications that were compiled with a recent devkitppc. Dollz entrypoint however, points to an embedded routine that has been compiled long time ago and probably got corrupted when you try to copy that argv structure over it.

I bet that recompiling the forwarder with a call to
Code:
entrypoint exeEntryPoint = (entrypoint)load_dol_image(buffer, NULL);
instead, will fix all your issues
 

niishou

Member
OP
Newcomer
Joined
Aug 24, 2010
Messages
8
Trophies
0
XP
13
Country
Jacobeian said:
I bet that recompiling the forwarder with a call to
Code:
entrypoint exeEntryPoint = (entrypoint)load_dol_image(buffer, NULL);
instead, will fix all your issues
You're right, re-compiling the forwarder with that change fixed the compressed .dol problem.
yay.gif
 

Skater4599

Well-Known Member
Member
Joined
May 29, 2008
Messages
965
Trophies
1
Location
United States
XP
1,554
Country
United States
@ Jacobien and FIX94

THANKS GUYS! Great info/find, helps me a lot. I have not compiled the args change yet but it seems logical and should work great. Thanks again
grog.gif
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    NinStar @ NinStar: It will actually make it worse