Page 1 of 1

getcwd() in loader.c

Posted: Tue Mar 08, 2011 3:02 am
by afrothunder
How would one go about using getcwd() in loader.c or otherwise getting the working directory?

Including unistd.h doesn't seem to do anything at all, always resulting in an undefined reference.

Re: getcwd() in loader.c

Posted: Tue Mar 08, 2011 6:39 am
by JJS
HBL is not linked with libc, so you cannot use getcwd(). Also libc (newlib) gets the working directory from argv[0] at startup and that is naturally also not available for HBL (since it is not started by the kernel).

HBL uses hardcoded paths for all internally used files and the argv[0] that is passed to homebrew is being taken from the HBL menu.


This version of HBL passes the working dir from the launcher to HBL though iirc: viewtopic.php?f=4&t=2416&p=29528#p29474

May I ask what you are trying to do?

Re: getcwd() in loader.c

Posted: Tue Mar 08, 2011 6:45 am
by afrothunder
JJS wrote:May I ask what you are trying to do?
HBL uses hardcoded paths for all internally used files
Make that not so :)
This version of HBL passes the working dir from the launcher to HBL though iirc: viewtopic.php?f=4&t=2416&p=29528#p29474
I've seen that, for some reason that launcher refuses to start for me on both 6.35 and 6.20.

Re: getcwd() in loader.c

Posted: Tue Mar 08, 2011 6:52 am
by JJS
You have to use MinPSPW 0.11.1 (for Windows) to build the launcher, otherwise HBL cannot find the import stubs of the launcher. If you modify the launcher or use a different build environment you have to create a new exploit SDK that fits the modified launcher binary.

At least I used MinPSPW 0.11.1 for HBL R115, I haven't compiled the Libre version myself so I am not sure with what it is built.

Re: getcwd() in loader.c

Posted: Tue Mar 08, 2011 6:57 am
by afrothunder
JJS wrote:You have to use MinPSPW 0.11.1 (for Windows) to build the launcher, otherwise HBL cannot find the import stubs of the launcher. If you modify the launcher or use a different build environment you have to create a new exploit SDK that fits the modified launcher binary.

At least I used MinPSPW 0.11.1 for HBL R115, I haven't compiled the Libre version myself so I am not sure with what it is built.
I have my build environment set up fine, but even Libre's pre-compiled version fails to start. =/