Homebrew postLoader4

  • Thread starter Thread starter stfour
  • Start date Start date
  • Views Views 563,504
  • Replies Replies 4,203
  • Likes Likes 16
So, a problem that's been bothering me a long time was that some nand games have the wrong title (*cough*Mega Man 9*cough*). Seeing as how usbloader gx did it* makes it clear that's a structure to IMET and it's actually rather easy to pull out the english title. Further, it seems necessary to try pulling out of banner apps before banner bins as otherwise you'll just get the garbled result out of a .bin file. :/ Anyways, here's a patch I did which seems to work:

Code:
--- channels.c.old2013-07-02 21:41:18.942508207 -0400
+++ channels.c2013-07-02 21:38:00.178497837 -0400
@@ -293,87 +293,38 @@
 // to identify title we should look of 0x00 0x00 0x00 0x00 0x00 [Printable char]
 static char *find_title_name (u8 *buff, int buffsize)
 {
-char printable[] = "1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm ";
-char pattern[] = {'\0', '\0', '\0', '\0', '\0', '\0'};
-
-int printableLen = sizeof(printable);
-int patternLen = sizeof(pattern);
-int pid = patternLen-1;
-
-char *outbuff;
-char tempbuff[256];
-
-char *p, *eob;
-
-int start, j;
+char *p, *outbuff;
+u8 *endbuff = buff + buffsize;
+
+int i, pos = 0;
 
 p = (char*)ms_FindStringInBuffer (buff, buffsize, "IMET");
 if (!p) return NULL;
-
-start = (u8*)p - buff;
-
-p = (char*)buff+start;
-eob = (char *) ((buff+buffsize) - (patternLen+2));
-
-while (p < eob)
-{
-for (j = 0; j < printableLen; j++)
-{
-if (printable[j])
-pattern[pid] = printable[j];
-
-if (memcmp(p, pattern, patternLen) == 0)
-{
-int pos, err;
-
-// We have found something valid
-memset (tempbuff, 0, sizeof(tempbuff));
-
-p += patternLen-1;
-pos = 0;
-err = -10;
-
-while (p < eob)
-{
-if (*p == '\0' && *(p+1) == '\0')
-{
-err = 0;
-break;
-}
-if (*p < 32)
-{
-err = -1;
-break;
-}
-if (*(p+1) != '\0')
-{
-err = -2;
-break;
-}
-if (pos >= 255)
-{
-err = -3;
-break;
-}
-tempbuff[pos] = *p;
-p += 2;
-pos++;
-}
-if (pos > 3 && err == 0) 
-{
-outbuff = malloc (pos + 16);
-
-if (outbuff)
-strcpy (outbuff, tempbuff);
-
-return outbuff;
-}
-}
-}
-p++;
-}
-
-return NULL;
+
+  //Jump to english title (from IMET struct in usbloader-gui's nandtitle.h)
+p += 0x71;
+
+outbuff = malloc(0x2b);
+
+  // 0x2a is max IMET title size
+while (pos < 0x2a && (int) p < (int) endbuff)
+{
+if (*p == '\0')
+break;
+if (*p >= 32 && *p <= 127)
+outbuff[pos] = *p;
+    else
+outbuff[pos] = '_';
+
+pos++;
+p += 2;
+}
+
+// Null terminate title
+outbuff[pos] = '\0';
+
+return outbuff;
+
 }
 
 char *read_name_from_banner_app(u64 titleid, char *nandmountpoint)
@@ -504,10 +455,10 @@
 
 low = TITLE_LOWER(titleid);
 
-temp = read_name_from_banner_bin(titleid, nandmountpoint);
+temp = read_name_from_banner_app(titleid, nandmountpoint);
 if (temp == NULL)
 {
-temp = read_name_from_banner_app(titleid, nandmountpoint);
+temp = read_name_from_banner_bin(titleid, nandmountpoint);
 }
 
 if (temp != NULL)

*PS - I noticed that usbloader gui is GPL v3 and postloader is GPL v2. But, the whole Goggle/Oracle, Linux/SCO, BSD/AT&T thing would indicate the indicated information in the header files providing interoperating information on an ABI is probably not copyrighted. This is just a CYOA note.
 
  • Like
Reactions: stfour
So, a problem that's been bothering me a long time was that some nand games have the wrong title (*cough*Mega Man 9*cough*). Seeing as how usbloader gx did it* makes it clear that's a structure to IMET and it's actually rather easy to pull out the english title. Further, it seems necessary to try pulling out of banner apps before banner bins as otherwise you'll just get the garbled result out of a .bin file. :/ Anyways, here's a patch I did which seems to work:

Code:
--- channels.c.old2013-07-02 21:41:18.942508207 -0400
+++ channels.c2013-07-02 21:38:00.178497837 -0400
@@ -293,87 +293,38 @@
// to identify title we should look of 0x00 0x00 0x00 0x00 0x00 [Printable char]
static char *find_title_name (u8 *buff, int buffsize)
{
-char printable[] = "1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm ";
-char pattern[] = {'\0', '\0', '\0', '\0', '\0', '\0'};
-
-int printableLen = sizeof(printable);
-int patternLen = sizeof(pattern);
-int pid = patternLen-1;
-
-char *outbuff;
-char tempbuff[256];
-
-char *p, *eob;
-
-int start, j;
+char *p, *outbuff;
+u8 *endbuff = buff + buffsize;
+
+int i, pos = 0;
 
p = (char*)ms_FindStringInBuffer (buff, buffsize, "IMET");
if (!p) return NULL;
-
-start = (u8*)p - buff;
-
-p = (char*)buff+start;
-eob = (char *) ((buff+buffsize) - (patternLen+2));
-
-while (p < eob)
-{
-for (j = 0; j < printableLen; j++)
-{
-if (printable[j])
-pattern[pid] = printable[j];
-
-if (memcmp(p, pattern, patternLen) == 0)
-{
-int pos, err;
-
-// We have found something valid
-memset (tempbuff, 0, sizeof(tempbuff));
-
-p += patternLen-1;
-pos = 0;
-err = -10;
-
-while (p < eob)
-{
-if (*p == '\0' && *(p+1) == '\0')
-{
-err = 0;
-break;
-}
-if (*p < 32)
-{
-err = -1;
-break;
-}
-if (*(p+1) != '\0')
-{
-err = -2;
-break;
-}
-if (pos >= 255)
-{
-err = -3;
-break;
-}
-tempbuff[pos] = *p;
-p += 2;
-pos++;
-}
-if (pos > 3 && err == 0)
-{
-outbuff = malloc (pos + 16);
-
-if (outbuff)
-strcpy (outbuff, tempbuff);
-
-return outbuff;
-}
-}
-}
-p++;
-}
-
-return NULL;
+
+  //Jump to english title (from IMET struct in usbloader-gui's nandtitle.h)
+p += 0x71;
+
+outbuff = malloc(0x2b);
+
+  // 0x2a is max IMET title size
+while (pos < 0x2a && (int) p < (int) endbuff)
+{
+if (*p == '\0')
+break;
+if (*p >= 32 && *p <= 127)
+outbuff[pos] = *p;
+    else
+outbuff[pos] = '_';
+
+pos++;
+p += 2;
+}
+
+// Null terminate title
+outbuff[pos] = '\0';
+
+return outbuff;
+
}
 
char *read_name_from_banner_app(u64 titleid, char *nandmountpoint)
@@ -504,10 +455,10 @@
 
low = TITLE_LOWER(titleid);
 
-temp = read_name_from_banner_bin(titleid, nandmountpoint);
+temp = read_name_from_banner_app(titleid, nandmountpoint);
if (temp == NULL)
{
-temp = read_name_from_banner_app(titleid, nandmountpoint);
+temp = read_name_from_banner_bin(titleid, nandmountpoint);
}
 
if (temp != NULL)

*PS - I noticed that usbloader gui is GPL v3 and postloader is GPL v2. But, the whole Goggle/Oracle, Linux/SCO, BSD/AT&T thing would indicate the indicated information in the header files providing interoperating information on an ABI is probably not copyrighted. This is just a CYOA note.

I can't apply the patch... can you give me your full channels.c ?
 
JoostinOnline yea I know I was just bustin' his balls, I still use my NTFS partition for WBFS root folder though, it's the only thing there I use for Wii which is most of my 1TB anyway. I have 60GB set aside for HB, Roms, and GC games.

On another note yea I've just been to lazy to fix it, I love my DUTag and it sux I can't use it cuz of it's dimensions.. makes me want nothing at all :cry: and whatever happened to the wiimod lite icon buddy hmm..?? :angry: j/k ;)
 
whatever happened to the wiimod lite icon buddy hmm..?? :angry:
I found out you use NTFS and I deleted it. I don't help your kind. :P

Actually I'm just a failure these days. I've got so much stuff I need to do, and several updates I need to release. I got made a staff member at HacksDen a few months ago, so everything is kind of crammed together with the extra work load (posting news, abusing power, deleting spam, writing guides, abusing power even more, etc.)

Anyway, back to postLoader.
 
Hey i just saw you uploaded 4.4.14t1 on google code 6, count it 6 days ago! Woah, what's going on there? :)

Something about mounting Fat32 Partitions, does it mount NTFS partitions too :P lol

Yes, but NTFS was already working fine... the problem was with two or more fat32 partition :lol:
 
All is quiet on this front eh? See the way it works around here is stfour goes on a short hiatus then drops a bomb of coding genius and fan service on mofo's and then he once again drift's off into the mists from whence he came lol ^_^
 
:lol:

Yeah, these days I'm taking a break with postloader development. I'm a little busy with "real" life ;)
 
Abz any chance you can get around to making your PL4 Silver channel for vWii as well? I'm currently migrating as much of my setup as possible to be compatible with my vWii. I usually make channels with customizemii with no fear, but unfortunately since there is no brick protection even from banner bricks I feel less inclined to try my luck @ making vWii channels.
 
Abz any chance you can get around to making your PL4 Silver channel for vWii as well? I'm currently migrating as much of my setup as possible to be compatible with my vWii. I usually make channels with customizemii with no fear, but unfortunately since there is no brick protection even from banner bricks I feel less inclined to try my luck @ making vWii channels.
Here's one for ya: https://www.dropbox.com/s/3k35yk26ay12ynr/Postloader Channel Silver v5.15 for vWii - POST.wad
I tested on Dolphin and it worked fine (so no banner brick) no vWii here so can't tell if the forwarder will work correctly, though it should
 
I trust your methods bro.. and... no just got a blackscreen for now, also the channel had no sound, scratch that sound is fine and all the graphic goodness was there, now just functionality to follow.

I'm going to do a couple of things to see if I can get it to work, but tried a couple of times and nothing yet. My postloader app and configuration files are all on SD, I doubt it, but this isn't looking for postLoader on USB only is it?
 
I trust your methods bro.. and... no just got a blackscreen for now, also the channel had no sound, scratch that sound is fine and all the graphic goodness was there, now just functionality to follow.

I'm going to do a couple of things to see if I can get it to work, but tried a couple of times and nothing yet. My postloader app and configuration files are all on SD, I doubt it, but this isn't looking for postLoader on USB only is it?
Can you please try this fixed wad: https://www.dropbox.com/s/3k35yk26ay12ynr/Postloader Channel Silver v5.15 for vWii - POST.wad
 
  • Like
Reactions: stfour
Can we add a ntsc-j patch to postloader for Japan GameCube isos like in CFG loader. When playing Nintendo puzzle collection all the text is garbage. With the ntsc-j patch, it show the letters properly. check CFG loader to see what I mean.
 

Site & Scene News

Popular threads in this forum