Compiling CustomizeMii's "Installer" DOL

Discussion in 'Wii - Hacking' started by techboy, Mar 1, 2010.

  1. techboy
    OP

    techboy GBAtemp Advanced Maniac

    Member
    1,720
    21
    Mar 15, 2009
    United States
    Pennsylvania
    First off, let me say I'm almost clueless when it comes to C.

    I'm having trouble getting the CustomizeMii "wad installer" to compile. Most apps I've compiled (a few simple things, like RunOpera) haven't given me issues, but this one is confusing me. I'm hoping to modify a few things and reuse it (and maybe learn something), but I can't even get unaltered code from the SVN to compile.

    It seems to start compiling normally, then fails during linking. The errors are all "undefined reference to 'install' ". The only place I see anything named 'install' get defined is in install.h.

    It's this code: http://code.google.com/p/customizemii/sour...nstaller_Source

    I had to create the install.c as explained in the README. He said to fill with exactly 4MB of zeros. Does he mean an ASCII zero or 0x00 (nulls, which is what I used).

    I hope someone who's a developer can help. Thanks in advance!
     


  2. WiiCrazy

    WiiCrazy Be water my friend!

    Member
    2,391
    1
    May 8, 2008
    Istanbul
    As readme says, create a stub wad file and put it in source folder...

    create exactly 4mb file with all zeroes, call it install.bin
    then using "raw2c install.bin " get install.c and copy it over to source folder... then it will compile...
     
  3. techboy
    OP

    techboy GBAtemp Advanced Maniac

    Member
    1,720
    21
    Mar 15, 2009
    United States
    Pennsylvania
    Thanks. I wasn't aware I needed to use raw2c. It compiles fine now. Previously, I was making files called install.c full of 4MB worth of 0x00...
     
  4. tueidj

    tueidj I R Expert

    Member
    2,569
    820
    Jan 8, 2009
    That's a rather crazy way of doing it. Is there something wrong with declaring a fixed size static array?
     
  5. techboy
    OP

    techboy GBAtemp Advanced Maniac

    Member
    1,720
    21
    Mar 15, 2009
    United States
    Pennsylvania
    That's the method the readme for the code wants. I'm doing this as a learning experience...this is only my second time working with C (first was a couple of forwarder DOLs which worked fine).

    A WAD and SHA1 are eventually injected into the DOL by CustomizeMii when used. The nulls appear to be just to leave space at the end of the DOL for the data.

    I'm still working it out how to properly inject a WAD manually. I can get a wad to install, but I had to comment out the SHA checks...it appears to be something to do with the file size. It's computing the SHA1 of the wad incorrectly (returns a value that is not even the right length to be an SHA hash).
     
  6. Leathl

    Leathl GBAtemp Regular

    Member
    239
    1
    Aug 15, 2009
    Gambia, The
    Berlin
  7. tueidj

    tueidj I R Expert

    Member
    2,569
    820
    Jan 8, 2009
    Leathl, what's wrong with using this:
    CODEunsigned char install[4
     
  8. techboy
    OP

    techboy GBAtemp Advanced Maniac

    Member
    1,720
    21
    Mar 15, 2009
    United States
    Pennsylvania
    @Leathl: Thanks for that. It certainly helps explain what the format is...I'm a bit confused about the length logic though. C (and it's variants like C# and C++) are still quite new to me:
    Code:
     uncompressedStubInstallerStream.WriteByte((byte)((wadLength >> 24) & 0xff));
    uncompressedStubInstallerStream.WriteByte((byte)((wadLength >> 16) & 0xff));
    uncompressedStubInstallerStream.WriteByte((byte)((wadLength >> 8) & 0xff));
    uncompressedStubInstallerStream.WriteByte((byte)(wadLengthÂÂ& 0xff));
    Exactly what values do I need to put there for the length?

    Other then that, I think I've got it. After the length, it seems to be an SHA1 of the wad, followed by the IOS to use for installation, 3 bytes padding, then a WAD.
     
  9. Leathl

    Leathl GBAtemp Regular

    Member
    239
    1
    Aug 15, 2009
    Gambia, The
    Berlin
     
  10. WiiCrazy

    WiiCrazy Be water my friend!

    Member
    2,391
    1
    May 8, 2008
    Istanbul
     
  11. giantpune

    giantpune GBAtemp Addict

    Member
    2,860
    122
    Apr 10, 2009
    United States
    why not just have it go like this...

    create a wad
    when you press "install" it creates a wad.bin and puts it with the source code to make the dol
    then it compiles the dol and sends it to the wii

    it will use wad_bin and wad_bin_size so it will allow you to send wads over the 4mb or whatever filesize. and if the wad is only 2 MB it will not have to send 2MB of 0s to the wii for no reason. also, if it doesnt do a clean/make it shouldnt add more than like 3 seconds to the time it takes for the whole process.
     
  12. WiiCrazy

    WiiCrazy Be water my friend!

    Member
    2,391
    1
    May 8, 2008
    Istanbul
    Then you need devkitpro on the user's machine, not so feasible. Though compression could be added to save time while sending the installer dol to HBC.
     
  13. Leathl

    Leathl GBAtemp Regular

    Member
    239
    1
    Aug 15, 2009
    Gambia, The
    Berlin
    CustomizeMii does compress the dol! [​IMG]
     
  14. WiiCrazy

    WiiCrazy Be water my friend!

    Member
    2,391
    1
    May 8, 2008
    Istanbul
    Hmm, Crap doesn't do that... I should possibly grab the support from customizemii for that [​IMG]
     
  15. Leathl

    Leathl GBAtemp Regular

    Member
    239
    1
    Aug 15, 2009
    Gambia, The
    Berlin
    Do it [​IMG]

    Btw, any attemps to update the installer for rev18 support (like Wad Manager 1.6)?
     
  16. techboy
    OP

    techboy GBAtemp Advanced Maniac

    Member
    1,720
    21
    Mar 15, 2009
    United States
    Pennsylvania
    Thanks for clarifying. I was writing it like 12 AD 40 00...when I get home later I'll go ahead and try it again.
     
  17. WiiCrazy

    WiiCrazy Be water my friend!

    Member
    2,391
    1
    May 8, 2008
    Istanbul
    Oh, I wasn't aware that it was broken with rev18... Of course I can add support for that... Hopefully I'll have some time during the weekend.
     
  18. diddy81

    diddy81 Wii Theme Team

    Member
    772
    171
    Mar 14, 2009
    any chance of having the wad installer to restart the wii after a install instead of going back to HBC??
     
  19. WiiCrazy

    WiiCrazy Be water my friend!

    Member
    2,391
    1
    May 8, 2008
    Istanbul
    Noted
     
  20. Leathl

    Leathl GBAtemp Regular

    Member
    239
    1
    Aug 15, 2009
    Gambia, The
    Berlin
    I don't really know what's the thing about rev18, I'm still on rev17 and it's working fine. I just read about WAD Managers not working with rev18 and saw WAD Manager 1.6 which said something about a fix for rev18.

    Anyways, if you ever find some time, I'm still waiting for the possibility to save the wad to (SD/USB):/wad/***.wad after installing [​IMG]
    Would of course require the name of the wad to be saved in the dol and a simple choosing if SD or USB (maybe via 1/2 or Left/Right).
    And probably a check if the file already exists [​IMG]