Welcome! Log In Create A New Profile

Advanced

Channel creation

Posted by whodares 
Channel creation
October 29, 2008 10:49PM
Let's start with the situation. My Wii is physically unmodified, I'm still on system menu 3.2E and have the homebrew channel and a USBGecko. My plan is to create a channel for WiiBASIC and/or WiiTree (Wii version of XTree/ZTree) if and when I sort them.

My test plan was too try and write an installer application which will create a channel using a copied banner (probably the photo channel) and my Freecell DOL file.

A few questions:

1. If the install goes wrong, and the files aren't registered properly or something, could it brick my Wii? (I'm working off the assumption that using an existing banner means I won't get a banner brick at least)

2. Do I need to provide my own DOL loader for the channel, or would the system menu load it okay?

3. How do channel permissions work? Say if I want WiiTree to be able to access the NAND, DVD (Game discs) and SD card.

4. How do I create tik and tmd files? or can the Wii generate them on my install?

5. Are there any other things I have missed that I would need for my test?

Wow, I only thought I had two questions at the start :-)

Cheers
WhoDares
Re: Channel creation
October 29, 2008 11:29PM
Not sure if "Homebrew General" is the place where this topic goes, but I'll answer these anyway.

1) If you're copying the banner from a working title, it's unlikely you could ever brick your Wii--save for your channel containing "brickmii.dol" as the boot content.

2) You'll need a loader, but as long as you're just copying stuff from another channel, you should be able to use that one IIRC. (Someone else jump in here?)

3) When a title is installed or "Identified" on the system, it creates a title directory with content and data directories, adds the TMD and ticket to their respective homes, and adds an entry for that title ID in /sys/uid.sys. Your identification is almost entirely based off of your Title ID--so you'll want to make that unique. By default, all titles have access to whatever they can touch from the powerpc (Anything you can do in normal Wii homebrew), and the data directory for their title. (/title/HIGH32BITS/LOW32BITS/data/).

4) Manually is probably how you're going to have to do it. You basically just need to set the title ID, IOS version ("system version"), title version, and content records, then fakesign both the ticket and the TMD. The format of tickets and TMDs are listed on wiibrew.org, and fairly well defined in libogc. I'd recommend looking at a bunch of them while looking at libogc's es.h to figure out what stuff is relevant.

5) That's pretty much it. You can try to trudge through patchmii for info on TMD/Ticket modification and title installtion, WAD-Manager for just title installation, and I think my Region Changer has some code for making a "bare" ticket/TMD.

And of course, remember, distribution is a no-no. Fair use is usually only a good defense when it's personal use :)



Edited 1 time(s). Last edit at 10/29/2008 11:30PM by tona.
Re: Channel creation
October 29, 2008 11:41PM
Thanks for the reply.

Yeah, I wasn't sure if this was the place to put it, but I didn't know anywhere better. Feel free to move it if you think of somewhere better suited.

Distribution will only happen once the original banner has been replaced with my own, I was just thinking of an existing one to make sure I had visible content without bricking the Wii.

I'm guessing the App loader will need to be PPC Assembler, as I won't be able to use libogc. Shouldn't be a problem, I understand Intel Assembler.

Thanks for the help.


Edit: Few more questions :-)

1. Is it only the tmd and tik which store the channel's ID? The new's channel content banner content has HAGA in the header at the top, but the photo channel's banner doesn't.

2. In your AnyRegion, can you confirm procedure Make_SUID in id.c is what creates your bare tik and tmd?

Sorry, I'm afraid you're going to see loads of questions as I play with this :-)



Edited 1 time(s). Last edit at 10/30/2008 12:40AM by whodares.
Re: Channel creation
October 30, 2008 02:44PM
Finally some post that is not "hai, i can haz wad packer with banner toolz plzkthx!!" :-)

"1. If the install goes wrong, and the files aren't registered properly or something, could it brick my Wii? (I'm working off the assumption that using an existing banner means I won't get a banner brick at least)"
If you are just using existing banners nothing should happen.

"2. Do I need to provide my own DOL loader for the channel, or would the system menu load it okay?"
The system menu has nothing to do with this. It's the IOS that loads the boot content.
The boot content can either be a DOL or a ELF - i'd use a dol since ELFs were never tested afaik.
IOS loads the binary to memory and forces the powerpc to jump to 0x3400 then in real addressing mode - this means that you have no data/instruction cache enabled and all addressed are physical. To be able to use a normal libogc application you need a small stub sitting at that address (0x3400/0x80003400) that sets the BATs for cached memory up and vectors to your dol's entry point then. You do this by setting the bats up first and then writing the entrypoint and the new MSR to srr0/1. When you do a rfi then the powerpc will restore the MSR and vector to your entrypoint.

tona already answered the rest fine :)



Edited 2 time(s). Last edit at 10/30/2008 02:45PM by svpe.
Re: Channel creation
October 30, 2008 08:54PM
Thanks!

Wow, this really is like when I was trying to write an operating system for my desktop :-) Bootsector always loaded into the same place in RAM, A20 gate to enter Protected mode, set up memory pages maps. I never got as far as to code the real mode stuff, but I understand the concepts.

I'm sure I'll have more questions for you all soon :-) Thanks again
Re: Channel creation
October 31, 2008 05:48AM
Quote
whodares
I'm guessing the App loader will need to be PPC Assembler, as I won't be able to use libogc. Shouldn't be a problem, I understand Intel Assembler.

That's not quite true. "Official" (licensed?) channels use a two-step loading process, with a ~200k "NANDloader" program (itself a DOL file) which performs some initialization and then loads the main DOL from NAND. I think this is done to be compatible with disc-based DOLs (which have their own apploader).

If you're copying an existing channel for development purposes, you can just reuse the Nintendo NANDloader. When you want to distribute it, marcan rewrote a GPL'd version of it, which is lying around here somewhere.

Quote

Thanks for the help.

Sorry, I'm afraid you're going to see loads of questions as I play with this :-)

This is good! This is the kind of discussion I look forward to seeing.
Re: Channel creation
October 31, 2008 11:57AM
Couple more quick questions:

1. I downloaded a PDF on the PowerPC 403. Is this the right instruction set/architecture for the Hollywood? I don't know how much PowerPC's differ between chips, but I wanted to check.

2.svpe mentions real mode addressing. Will IOS load my/Nintendo's/marcan's NAND loader in real mode, and the loader have to set up virtual/protected mode? I suppose I don't need to worry about this while I use somebody elses loader, but it would seem interesting that IOS runs in real mode as opposed to virtual mode.

3. Have any of you just installed a banner with no other content? eg. if I wrote an installer which just installed the photo channel's banner, but with a new title, tik and tmd, without a NAND loader or any other content. Would this appear in the system menu? Would it cause problems? I would speculate that it would show, but would crash if you tried to start it up.

4. Will Nintendo's NANDLoader load up a libogc DOL file? I'm guessing it will, but with the whole ELF thing with Betas 8 and 9 of the HBC, I thought it would be worth asking.

Not quite related, and I apologise for asking, but any clues on when BootMii core is coming out? I'm a bit hesitant of just trying some of this stuff straight off without some plan of rescuing my Wii if all goes wrong. As my Wii doesn't have a modchip, SaveMii won't work (if I'm wrong here, please correct me)

Cheers guys
Re: Channel creation
October 31, 2008 03:01PM
Quote
whodares
2.svpe mentions real mode addressing. Will IOS load my/Nintendo's/marcan's NAND loader in real mode, and the loader have to set up virtual/protected mode? I suppose I don't need to worry about this while I use somebody elses loader, but it would seem interesting that IOS runs in real mode as opposed to virtual mode.
IOS runs on Starlet while your code will run on the powerpc. After IOS resets the powerpc then you are in real mode.

Quote

4. Will Nintendo's NANDLoader load up a libogc DOL file? I'm guessing it will, but with the whole ELF thing with Betas 8 and 9 of the HBC, I thought it would be worth asking.
Yes, it should load any DOL file just fine.
Re: Channel creation
November 01, 2008 10:59AM
Thanks for the info
Re: Channel creation
November 03, 2008 02:58AM
I don't think I ever GPLed the nandloader (I did GPL the apploader - it's based on a GPL one). It was only ever used for the original April Fool's 10-minute demo pseudo-homebrew-channel thing. Then we scrapped it, but apparently now it's in every "homebrew" channel out there - in particular all of the ones that steal the banners. Kinda sad that they even had to "steal" our nandloader.

If you want to distribute the channel, once you've figured out the banner stuff (remember: those "banner-making" tools out there all steal nintendo's layouts as far as I know), your simplest option is probably to just embed the boot stub in your main DOL. The new devkitpro linker script is set up to do that automatically, so all you'll need then is the actual stub assembler code in whatever project you want to compile as a "nand dol". Once you get there I'll be happy to post it for you :)
Re: Channel creation
November 03, 2008 08:55AM
Thanks marcan

It's interesting you should mention the boot stub. When I was looking at all the channels on my Wii, I noticed that the first item was always the banner, the 2nd was the main channel DOL, then any data respositories, and always at the end was the NANDLoader. Except in the HBC case, which just seemed to have 2 parts.

I need to convert your LZ77 code to .NET so I can decompress all the banner components, then I can start decyphering the data. Shouldn't take too long, but I have a bad habbit of procrastinating :-(
Re: Channel creation
November 03, 2008 10:55AM
Quote
whodares
Except in the HBC case, which just seemed to have 2 parts.
And the system menu, which also has just two parts.
Re: Channel creation
November 03, 2008 11:15AM
I remember looking at that, I assumed it didn't need one, because I was (incorrectly) thinking the System Menu is what launched content (despite the fact I had written homebrew which loads VC games, doh!).

Quick question: How does the IOS know which content file is the booting DOL? Does it just look for the first DOL with an entry/load point of 0x3400?
Re: Channel creation
November 03, 2008 03:20PM
Quote
whodares
I remember looking at that, I assumed it didn't need one, because I was (incorrectly) thinking the System Menu is what launched content (despite the fact I had written homebrew which loads VC games, doh!).

Quick question: How does the IOS know which content file is the booting DOL? Does it just look for the first DOL with an entry/load point of 0x3400?

it looks at the boot_index field in the tmd.
Re: Channel creation
November 04, 2008 12:01AM
Ahh, gotcha. Thanks.

I've managed to code a .NET app that will strip apart U8 and LZ77 files, just working on converting TPL to bitmaps. Then will be on to brylt and brlan imports. At this point, I should have a channel renderer, and then I'll start on the editors, and finally, the repackaging code :-)



Edited 1 time(s). Last edit at 11/04/2008 12:02AM by whodares.
Re: Channel creation
November 04, 2008 12:22AM
So does this mean you can create a channel for lets say, Wii64 now?
Re: Channel creation
November 04, 2008 03:39AM
Quote
KruperTrooper
So does this mean you can create a channel for lets say, Wii64 now?

yes... but Wii64 isn't finished yet!
Re: Channel creation
November 04, 2008 08:26AM
Neither are my tools. After I've finished the banner tools, I'll be creating creating an installer and some sort of packaging system so you can bundle up any homebrew with a banner and install it as a channel. But that's quite a distance off yet...

Edit: Cool, I've just finished my RGB565 decoder. Next on to the I4... These are the only 2 formats I've seen so far, but I'll also code in I8 and RGBA8, and maybe add other formats as and when I find them being used.

Edit 2: Added I4, I8, and RGB5A3 decoding. Although there's a problem with the decoding of RGB5A3 at the minute - [wiibrew.org]

Edit 3: S3TC added, not fixed problems with RGB5A3 yet though



Edited 3 time(s). Last edit at 11/04/2008 02:56PM by whodares.
Re: Channel creation
November 04, 2008 03:50PM
well i know that it is not finished but i was just giving an example
Re: Channel creation
November 04, 2008 05:26PM
Quote
whodares
Neither are my tools. After I've finished the banner tools, I'll be creating creating an installer and some sort of packaging system so you can bundle up any homebrew with a banner and install it as a channel. But that's quite a distance off yet...

we are happily waiting! That would be a sweet release! Maybe a Wiibrew Christmas present?!?!

I've noticed that most channels with hacked banners have just a still picture that HAS to be a certain pixel size. But the HBC has those moving waves... are your tools going to have the moving banners? Or am I confused...
Sorry, only registered users may post in this forum.

Click here to login