Welcome! Log In Create A New Profile

Advanced

[FIXED] Making Wii Signer crossplatform

Posted by ssorgatem 
[FIXED] Making Wii Signer crossplatform
July 20, 2009 01:55PM
I'm developing a GUI for Wii Signer, and i've nearly finished it, but now i've found that Wii Signer isn't able to unpack WAD files on Windows/wine, but it works well on my Debian. I've tried to contact the author trough it's wiki user page, but i haven't got any answer.

Depending on the wads I try to open, i get two different errors:

If I try to open, for example IOS60.wad (extracted from a game) I get an error on line 11:

"unhandled error: unpack requires a string argument of size 676"

And here the code where it breaks:

class Ticket:
    def __init__(self, string):
        self.rsaexp, self.rsamod, self.misc1, self.rsaid, self.misc2, self.key, self.misc3, self.tikid, self.dev, self.titid, self.mask, self.reserved, self.cidxmask, self.padding, self.limits = struct.unpack('>I256s60s64s63s16sBQIQH60s64sH64s', string)

And that "string" comes from here:

class WAD:
    def __init__(self, filename):
        self._f = open(filename, 'r')
        self.headersize, self.wadtype, self.certsize, self.reserved, self.tiksize, self.tmdsize, self.datasize, self.footersize = struct.unpack('>I4s6I', self._f.read(32))
        self._f.seek(32, 1)
        self.rawcert = self._f.read(self.certsize)
        self.cert = self.rawcert
        if self.certsize % 64 != 0:
            self._f.seek(64 - (self.certsize % 64), 1)
        self.rawtik = self._f.read(self.tiksize)
        self.ticket = Ticket(self.rawtik)


But when trying to open other wads, like IOS36.wad (from a game too) the error I get is on line 91:

"unhandled error: unpack requires a string argument of size 32"

This is the code where it breaks:
class WAD:
    def __init__(self, filename):
        self._f = open(filename, 'r')
        self.headersize, self.wadtype, self.certsize, self.reserved, self.tiksize, self.tmdsize, self.datasize, self.footersize = struct.unpack('>I4s6I', self._f.read(32))
"filename" is the path to the .wad file.

So the second error, despite being later in the code, is an earlier break in the execution. I don't know what's wrong in the way it opens the wad for making it not work on windows.

I practically know nothing about cryptography and low-level file handling, i'm more a hobbyist GUI programmer ;), and perhaps I'm missing something obvious because of that...

Thanks in advance for any lights on this problem!

PD: I have correctly installed latest the latest version of PyCrypto for python 2.6 (and python 2.6)

PD2: Sorry for my english, please, feel free to correct any mistake on my message ;-)

EDIT:

The solution: specify "b" (binary) in the open mode every time a file was read from or written to, because you have to tell to windows you want binary access...



Edited 3 time(s). Last edit at 07/21/2009 10:40PM by ssorgatem.
Re: [Python] Making Wii Signer crossplatform
July 20, 2009 02:48PM
Quote
ssorgatem
PD3: OMG! Previewing if found out that the quotes eat up all indentations! Well, the actual code is well indented, but makes it uglier to read in this post
Use the:
Code Formatting
Re: [Python] Making Wii Signer crossplatform
July 20, 2009 03:21PM
Thank you ;)

How could I miss that? ...

The first post is now fixed
Sorry, only registered users may post in this forum.

Click here to login