Advertising (This ad goes away for registered users. You can Login or Register)

getcwd() in loader.c

This is the development forum of the half-byte loader project. For general Half Byte Loader questions, visit the Half Byte Loader forum.
Forum rules
This forum is for HBL Development discussions ONLY. For User support or HBL general discussions, go to viewforum.php?f=3 . Messages that are not development related will be deleted.
Post Reply
afrothunder
Posts: 270
Joined: Tue Jan 18, 2011 6:20 pm

getcwd() in loader.c

Post by afrothunder » Tue Mar 08, 2011 3:02 am

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.
Advertising

JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Re: getcwd() in loader.c

Post by JJS » Tue Mar 08, 2011 6:39 am

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?
Advertising

afrothunder
Posts: 270
Joined: Tue Jan 18, 2011 6:20 pm

Re: getcwd() in loader.c

Post by afrothunder » Tue Mar 08, 2011 6:45 am

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.

JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Re: getcwd() in loader.c

Post by JJS » Tue Mar 08, 2011 6:52 am

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.

afrothunder
Posts: 270
Joined: Tue Jan 18, 2011 6:20 pm

Re: getcwd() in loader.c

Post by afrothunder » Tue Mar 08, 2011 6:57 am

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. =/

Post Reply

Return to “Half Byte Loader Development”