Hacking Hacking the Disc Channel

  • Thread starter Thread starter AbdallahTerro
  • Start date Start date
  • Views Views 30,580
  • Replies Replies 132
  • Likes Likes 1

Are you still using the "Disc Channel"?


  • Total voters
    60
Coming Soon...
96da75a9aafeef2d4b16f20ac82353a3.jpg
 
Am I the only one here who likes this?


Most likely :P
Well I'm impressed with damysteryman's project. It's the way AbdallahTerro has been going on about this (talking like he contributed, trying to pressure XFlak into promoting it, and acting like there aren't far better and safer ways of running backup discs)
 
you can make the strings up to 0x100 bytes i think. but you have to recreate the bmg file and move all the other string offsets back in the INF1 section.
About renaming the channel to >12 characters
I'm trying to do it and yes if the offsets are not redefined in the inf1 section a mess is produced.
Here's a shot of "A 20 CHARACTER LONG" disc channel title
eac26acb8ca881090adf81b80d51895d.jpg

However all the other messages are affected so when you click on a channel "Wii Menu" button became " u Count " or someting since these letters replaced the old ones.
0f2c8ce8cc62975b8c4d941456e4521d.png
@sifjar maybe you know a nice way to redefine the inf1 section shown here:
ff0f573e94e01ae6dbfb74320ca9b059.png
 
the sections are pretty straight forward. this is the code im using to pull messages from the bmg, based on the disassembled system menu.
Code:
struct BmgHeader
{
u64 magic;		// "MESGbmg1"
u32 size;		// total file size
u32 sectionCnt;	// number of sections

u32 pad1;		// 0x10 bytes of padding
u32 pad2;
u32 pad3;
u32 pad4;
}__attribute__((packed));

// 0x10 bytes
struct Inf1Header
{
u32 magic;			// INF1 - 0x494e4631
u32 size;			// section size
u16 numMessages;	// number of messages
u16 four;			// i guess this is the size of each entry in the INF1 section?
u32 pad;
}__attribute__((packed));

// 0x8 bytes
struct Dat1Header
{
u32 magic;		// DAT1 - 0x44415431
u32 size;		// section size
}__attribute__((packed));



bool Bmg::SetResource( const u8* stuff, u32 len )
{
Reset();
if( !stuff || len < 0x40 )
{
gprintf( "data is too small\n" );
return false;
}

// i didnt see the system menu checking the header, but it cant be a bad idea to take a peek at it
bmgHeader = (BmgHeader*)stuff;
if( bmgHeader->magic != 0x4d455347626d6731ull || bmgHeader->size < len || bmgHeader->sectionCnt != 2 )
{
gprintf( "bad file\n" );
Reset();
return false;
}

u32 r8 = 0x20;
for( u32 i = 0; i < bmgHeader->sectionCnt; i++ )
{
u32 magic = *(u32*)( stuff + r8 );
u32 sectionSize = *(u32*)( stuff + r8 + 4 );

if( sectionSize + r8 > len )
{
gprintf( "bad file 2  %08x %08x %08x\n", sectionSize, r8, len );
hexdump( stuff, 0x40 );
Reset();
return false;
}

if( magic == 0x494E4631 )// INF1
{
inf1Header = (Inf1Header*)( stuff + r8 );
}
else if( magic == 0x44415431 )// DAT1
{
dat1Header = (Dat1Header*)( stuff + r8 );
}
r8 += sectionSize;
}
if( !inf1Header || !dat1Header )
{
gprintf( "failed to find the sections\n" );
Reset();
return false;
}
if( inf1Header->size < inf1Header->numMessages * 4 )
{
gprintf( "bad INF1 header\n" );
Reset();
return false;
}

return true;
}

const char16* Bmg::GetMessage( u16 index ) const
{
if( !bmgHeader || index >= inf1Header->numMessages )
{
return NULL;
}
u32 offset = *(u32*)(((u8*)inf1Header) + sizeof( Inf1Header ) + ( index * 4 ));
if( offset >= dat1Header->size )
{
gprintf( "index out of range\n" );
return NULL;
}
return (char16*)( ((u8*)dat1Header) + sizeof( Dat1Header ) + offset );
}

basically you are changing one of the first couple of strings. there are > 450 of them in the whole file. you have 2 options:
1 - write your new string over the old one and shift back all the indexes in the INF1 section after the string you change by the number of characters you added.
2 - put your new string at the end of the file and just change that 1 index to point to it.

i would say the first option is cleaner, but obviously more work. i dont see any reason why the second one wouldn't work though.
 
But what is needed is just to increase the length of the disc channel title in dat1 section without touching the other entries.
I can't find the title offset in inf1!!!

maybe it'll be more convenient if the title offset is at the end of the file (option-2)
do you have a ready made bmg file with just this needed change?
 

Site & Scene News

Popular threads in this forum