Hacking Help compiling a boot.dol

zantzue

Well-Known Member
OP
Member
Joined
Mar 14, 2009
Messages
150
Trophies
1
Location
Basque Country
XP
881
Country
Hi! Here's a code I found on the Internet (credits go to giantpune):
CODE//super complicated channel loader- giantpune
#include
#include
//#include
#include

#define TITLE_ID(x,y) (((u64)(x) viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

//if you want to put a splash screen, put it here, but it will just be a waste of time. the splash in the forwarder
//is only showed while loading dols into memory, this would be shown before the channel even started to load
//so i wouldn't do it.

WII_Initialize();
//just change the 4A4F4449 to the hex value for the ID4 of the title to boot.
//all channels that show up on the system menu should be 00010001
WII_LaunchTitle(TITLE_ID(0x00010001,0x4A4F4449));

//should not reach this point if the title is installed on the wii, but if it does, it will fall back on a stub to direct it
//if using a newer version of libogc, exit(0) returns the system menu if no stub is found.
exit (0);

//really, really should never make it this far. if it does, the wii will just blackscreen and need a hard reset
return 0;
}
I compiled it and it worked properly; it launches new HBC from NAND. The thing is that I want to change that code so that it looks for new HBC but if it doesn't find it, looks for JODI and HAXX. Here's what I changed:
CODE#include
#include
//#include
#include


#define TITLE_ID(x,y) (((u64)(x) viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

WII_Initialize();
printf("Launching Homebrew Channel 1.0.7/1.0.8");
WII_LaunchTitle(TITLE_ID(0x00010001,0xAF1BF516));
If (WII_LaunchTitle(TITLE_ID(0x00010001,0xAF1BF516))
 

chonka

Active Member
Newcomer
Joined
Oct 17, 2010
Messages
26
Trophies
0
XP
21
Country
i cant code but just looking at this seems to me it would be talking about this line

if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

its saying IF this - but nothing there after it
 

tj_cool

Site dev
Supervisor
Joined
Jan 7, 2009
Messages
10,064
Trophies
2
Location
This planet
XP
3,108
Country
Belgium
chonka said:
i cant code but just looking at this seems to me it would be talking about this line

if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

its saying IF this - but nothing there after it
That should work
It's the same as
CODEif(rmode->viTVMode&VI_NON_INTERLACE) {
ÂÂÂÂVIDEO_WaitVSync();
}

Something I noticed myself is that there's a Capitalized if. I believe C is Capital sensitive, so try changing that.
 

zantzue

Well-Known Member
OP
Member
Joined
Mar 14, 2009
Messages
150
Trophies
1
Location
Basque Country
XP
881
Country
chonka said:
i cant code but just looking at this seems to me it would be talking about this line

if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

its saying IF this - but nothing there after it
The problem was that I wrote "IF" instead of "if"
shy.gif
. Now it compiles but It doesn't do what I want. I think the probem is "if WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858))[/b]0)" instead of "if WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858))
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
30
Location
???
XP
11,248
Country
Germany
zantzue said:
chonka said:
i cant code but just looking at this seems to me it would be talking about this line

if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

its saying IF this - but nothing there after it
The problem was that I wrote "IF" instead of "if"
shy.gif
. Now it compiles but It doesn't do what I want. I think the probem is "if WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858))[/b]0)" instead of "if WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858))
 

conanac

Be an Angel
Member
Joined
Sep 13, 2009
Messages
267
Trophies
1
XP
329
Country
United States
I am not sure why you call WII_LaunchTitle two times for each of HBC version. Another bug perhaps is that you use
0x48415858 as JODI but this is actually HAXX.

There is almost a similar goal in the sys.cpp code (taken from usbloadergx) that perhaps could help you trying, but
without those printf statements (you could re-add them if you want):

#define HBC_HAXX 0x0001000148415858LL
#define HBC_JODI 0x000100014A4F4449LL
#define HBC_1_0_7 0x00010001AF1BF516LL

WII_Initialize();

int ret = WII_LaunchTitle(HBC_1_0_7);
if(ret < 0)
WII_LaunchTitle(HBC_JODI);
if(ret < 0)
WII_LaunchTitle(HBC_HAXX);
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
30
Location
???
XP
11,248
Country
Germany
FIX94 said:
I'm sure you can simply do it like that:
Code:
ÂÂÂÂWII_LaunchTitle(TITLE_ID(0x00010001,0XAF1BF516));
ÂÂÂÂWII_LaunchTitle(TITLE_ID(0x00010001,0x48415858));
ÂÂÂÂWII_LaunchTitle(TITLE_ID(0x00010001,0x4A4F4449));

If you also want to display text you will need to do it like this:

CODE//super complicated channel loader- giantpune
#include
#include
#include

#define TITLE_ID(x,y) (((u64)(x) viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();

//this is needed to display text correctly
int x = 24, y = 32, w, h;
w = rmode->fbWidth - (32);
h = rmode->xfbHeight - (48);
CON_InitEx(rmode, x, y, w, h);
VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
ÂÂÂÂ
//if you want to put a splash screen, put it here, but it will just be a waste of time. the splash in the forwarder
//is only showed while loading dols into memory, this would be shown before the channel even started to load
//so i wouldn't do it.

WII_Initialize();

//just change the 4A4F4449 to the hex value for the ID4 of the title to boot.
//all channels that show up on the system menu should be 00010001

//HBC 1.0.7+
printf("Launching Homebrew Channel 1.0.7+");
WII_LaunchTitle(TITLE_ID(0x00010001,0XAF1BF516));
printf("Homebrew Channel 1.0.7+ not found");

//HBC JODI
printf("Launching Homebrew Channel JODI");
WII_LaunchTitle(TITLE_ID(0x00010001,0x4A4F4449));
printf("Homebrew Channel JODI not found");
ÂÂÂÂ
//HBC HAXX
printf("Launching Homebrew Channel HAXX");
WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858));

//should not reach this point if the title is installed on the wii, but if it does, it will fall back on a stub to direct it
//if using a newer version of libogc, exit(0) returns the system menu if no stub is found.
exit (0);

//really, really should never make it this far. if it does, the wii will just blackscreen and need a hard reset
return 0;
}

I have not tested it yet but I'm sure it will work fine!
 

zantzue

Well-Known Member
OP
Member
Joined
Mar 14, 2009
Messages
150
Trophies
1
Location
Basque Country
XP
881
Country
@FIX94 It seems to work. I launched the boot.dol from HAXX HBC. It should have launched JODI HBC but it didn't (I have both installed on my Wii). But that's normal as I switched channels' IDs by mistake. I used 0x48415858 as JODI but that's actually HAXX and viceversa. Thank you for compiling it and pointing me in the right direction: there's no need for "if" sentences. I compiled the code of your last post and it seems to work properly. Displays text and it launches the HBC is installed on the Wii. Thank you very much indeed!

@conanac hopefully you realized of the ID istake. I didn't finally try the changes you suggest as the code FIX94 gave me works perfectly but I do much appreciate your help.

Now I'm trying to figure out how to use delay function...
EDIT: I´m using
CODEtime_t start_time, cur_time;

ÂÂÂÂÂÂÂÂ time(&start_time);
ÂÂÂÂÂÂÂÂ do
ÂÂÂÂÂÂÂÂ {
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ time(&cur_time);
ÂÂÂÂÂÂÂÂ }
ÂÂÂÂÂÂÂÂ while((cur_time - start_time) < 10);
It works. Now I'm trying to make the boot.dol to write the text in different lines...
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
30
Location
???
XP
11,248
Country
Germany
zantzue said:
Now I'm trying to figure out how to use delay function...
You could use usleep, I think that's the easiest way:
Code:
//HBC 1.0.7+
printf("Launching Homebrew Channel 1.0.7+");
usleep(1000000);
WII_LaunchTitle(TITLE_ID(0x00010001,0XAF1BF516));
printf("Homebrew Channel 1.0.7+ not found");

//HBC JODI
printf("Launching Homebrew Channel JODI");
sleep(1000000);
WII_LaunchTitle(TITLE_ID(0x00010001,0x4A4F4449));
printf("Homebrew Channel JODI not found");

//HBC HAXX
printf("Launching Homebrew Channel HAXX");
sleep(1000000);
WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858));

edit:
Oh and you need to include another file:
CODE#include

edit2:
Here is a compiled version:
http://www.mediafire.com/?77kzp77o9xupjak
Please say me if it works!
 

zantzue

Well-Known Member
OP
Member
Joined
Mar 14, 2009
Messages
150
Trophies
1
Location
Basque Country
XP
881
Country
FIX94 said:
zantzue said:
Now I'm trying to figure out how to use delay function...
You could use usleep, I think that's the easiest way:
Code:
//HBC 1.0.7+
printf("Launching Homebrew Channel 1.0.7+");
usleep(1000000);
WII_LaunchTitle(TITLE_ID(0x00010001,0XAF1BF516));
printf("Homebrew Channel 1.0.7+ not found");

//HBC JODI
printf("Launching Homebrew Channel JODI");
sleep(1000000);
WII_LaunchTitle(TITLE_ID(0x00010001,0x4A4F4449));
printf("Homebrew Channel JODI not found");

//HBC HAXX
printf("Launching Homebrew Channel HAXX");
sleep(1000000);
WII_LaunchTitle(TITLE_ID(0x00010001,0x48415858));

edit:
Oh and you need to include another file:
CODE#include
I agree with you. "usleep" is easier to use. Thank you! Ah, and I discovered how to create a new line by using "\n".
 

DEFIANT

a daft old man who stole a magic box and ran away
Member
Joined
Dec 9, 2008
Messages
364
Trophies
1
Location
Gallifrey
Website
www.youtube.com
XP
1,398
Country
United States
CODE#include
#include
#include
#include
#include
#include
#include
#include

static void *xfb = NULL;
static GXRModeObj *vmode = NULL;
char * url = "";

void setupVideo() {

ÂÂVIDEO_Init();
ÂÂvmode = VIDEO_GetPreferredMode(NULL);
ÂÂVIDEO_Configure(vmode);
ÂÂxfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode));
ÂÂconsole_init (xfb, 20, 20, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth*VI_DISPLAY_PIX_SZ);
ÂÂVIDEO_Configure(vmode);
ÂÂVIDEO_ClearFrameBuffer(vmode, xfb, COLOR_BLACK);
ÂÂVIDEO_SetNextFramebuffer(xfb);
ÂÂVIDEO_SetBlack(0);
ÂÂVIDEO_Flush();
ÂÂVIDEO_WaitVSync();
ÂÂif (vmode->viTVMode & VI_NON_INTERLACE)
ÂÂÂÂVIDEO_WaitVSync();

}

s32 launchTitle(u64 TitleID, char * url) {
ÂÂÂÂWII_Initialize();
ÂÂÂÂif (url[0] != 0) {
ÂÂÂÂÂÂÂÂ//Load title with specified URL as an argument
ÂÂÂÂÂÂÂÂreturn WII_LaunchTitleWithArgs(TitleID, 0, url, NULL);
ÂÂÂÂ} else {
ÂÂÂÂÂÂÂÂÂÂÂÂreturn WII_LaunchTitle(TitleID);
ÂÂÂÂ}
}

s32 readCfg(char * path) {
ÂÂÂÂint c = 0;
ÂÂÂÂint i = 0;
ÂÂÂÂFILE *f = fopen(path, "r");
ÂÂÂÂif (f == NULL)
ÂÂÂÂÂÂÂÂreturn 0;
ÂÂÂÂfseek(f , 0 , SEEK_END);
ÂÂÂÂu32 size = ftell(f);
ÂÂÂÂrewind(f);
ÂÂÂÂurl = (char*) malloc(sizeof(char)*size);
ÂÂÂÂwhile (c != EOF) {
ÂÂÂÂÂÂÂÂc = fgetc(f);
ÂÂÂÂÂÂÂÂif (31 < c && c < 127)
ÂÂÂÂÂÂÂÂÂÂÂÂurl[i++] = c;
ÂÂÂÂ}
ÂÂÂÂurl = '';
ÂÂÂÂfclose(f);
ÂÂÂÂreturn 1;
}

int main(int argc, char **argv) {
ÂÂÂÂsetupVideo();
ÂÂÂÂfatInitDefault();
ÂÂÂÂs32 ret;
ÂÂÂÂif (argc > 0) {
ÂÂÂÂÂÂÂÂchar path[MAXPATHLEN];
ÂÂÂÂÂÂÂÂint len = strlen(argv[0]);
ÂÂÂÂÂÂÂÂint i = 0;
ÂÂÂÂÂÂÂÂfor(i = len; argv[0] != '/'; i--);
ÂÂÂÂÂÂÂÂif(i < 1)
ÂÂÂÂÂÂÂÂÂÂÂÂreadCfg("sd:/url.cfg");
ÂÂÂÂÂÂÂÂelse {
ÂÂÂÂÂÂÂÂÂÂÂÂargv[0] = 0;
ÂÂÂÂÂÂÂÂÂÂÂÂsprintf(path, "%s/url.cfg", argv[0]);
ÂÂÂÂÂÂÂÂÂÂÂÂreadCfg(path);
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂ}
ÂÂÂÂret = launchTitle(0x0001000148D4E55, url);
ÂÂÂÂif (ret < 0) {
ÂÂÂÂÂÂÂÂret = launchTitle(0x0001000148D4E55, url);
ÂÂÂÂ}
ÂÂÂÂif (ret < 0) {
ÂÂÂÂÂÂÂÂret = launchTitle(0x0001000148D4E55, url);
ÂÂÂÂ}
ÂÂÂÂreturn ret;
}


How do I compile this code? What do I need? There's no makefile. I'm a newbie so type slow...ha. And if I want to point it to another channel and I have the ID number how would I do that also?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa
  • BakerMan
    I rather enjoy a life of taking it easy. I haven't reached that life yet though.
  • K3Nv2 @ K3Nv2:
    He put it down when the 3ds came out
  • SylverReZ @ SylverReZ:
    @K3Nv2, RIP Felix does great videos on the PS3 yellow-light-of-death.
  • Jayro @ Jayro:
    Eventhough the New 3DS XL is more powerful, I still feel like the DS Lite was a more polished system. It's a real shame that it never got an XL variant keeping the GBA slot. You'd have to go on AliExpress and buy an ML shell to give a DS phat the unofficial "DS Lite" treatment, and that's the best we'll ever get I'm afraid.
    +1
  • Jayro @ Jayro:
    The phat model had amazingly loud speakers tho.
    +1
  • SylverReZ @ SylverReZ:
    @Jayro, I don't see whats so special about the DS ML, its just a DS lite in a phat shell. At least the phat model had louder speakers, whereas the lite has a much better screen.
    +1
  • SylverReZ @ SylverReZ:
    They probably said "Hey, why not we combine the two together and make a 'new' DS to sell".
  • Veho @ Veho:
    It's a DS Lite in a slightly bigger DS Lite shell.
    +1
  • Veho @ Veho:
    It's not a Nintendo / iQue official product, it's a 3rd party custom.
    +1
  • Veho @ Veho:
    Nothing special about it other than it's more comfortable than the Lite
    for people with beefy hands.
    +1
  • Jayro @ Jayro:
    I have yaoi anime hands, very lorge but slender.
  • Jayro @ Jayro:
    I'm Slenderman.
  • Veho @ Veho:
    I have hands.
  • BakerMan @ BakerMan:
    imagine not having hands, cringe
    +1
  • AncientBoi @ AncientBoi:
    ESPECIALLY for things I do to myself :sad:.. :tpi::rofl2: Or others :shy::blush::evil:
    +1
  • The Real Jdbye @ The Real Jdbye:
    @SylverReZ if you could find a v5 DS ML you would have the best of both worlds since the v5 units had the same backlight brightness levels as the DS Lite unlockable with flashme
  • The Real Jdbye @ The Real Jdbye:
    but that's a long shot
  • The Real Jdbye @ The Real Jdbye:
    i think only the red mario kart edition phat was v5
  • BigOnYa @ BigOnYa:
    A woman with no arms and no legs was sitting on a beach. A man comes along and the woman says, "I've never been hugged before." So the man feels bad and hugs her. She says "Well i've also never been kissed before." So he gives her a kiss on the cheek. She says "Well I've also never been fucked before." So the man picks her up, and throws her in the ocean and says "Now you're fucked."
    +1
  • BakerMan @ BakerMan:
    lmao
  • BakerMan @ BakerMan:
    anyways, we need to re-normalize physical media

    if i didn't want my games to be permanent, then i'd rent them
    +1
  • BigOnYa @ BigOnYa:
    Agreed, that why I try to buy all my games on disc, Xbox anyways. Switch games (which I pirate tbh) don't matter much, I stay offline 24/7 anyways.
    BigOnYa @ BigOnYa: Agreed, that why I try to buy all my games on disc, Xbox anyways. Switch games (which I pirate...