Talk:Segher's Wii.git
This may be a noob question, but what is the file extension for a Wii flash image? --AutoFire 21:04, 7 September 2008 (UTC)
I'm pretty sure they're .img files, and you can generate one with YaWnD. Mcpancakes 07:38, 22 November 2008 (UTC)
Compilation?
Im having some trouble compiling these tools, using cygwin on WinXP 64 and make on Ubuntu 8.04 64
This is the error I get
USER@COMPUTER /cygdrive/c/Documents and Settings/USER/Desktop/Seghers Wii Tools/wii
$ make
gcc -Wall -W -Os -DLARGE_FILES -D_FILE_OFFSET_BITS=64 -c twintig.c -o twintig.o
twintig.c: In function `find_files_recursive':
twintig.c:183: error: structure has no member named `d_type'
twintig.c:183: error: `DT_REG' undeclared (first use in this function)
twintig.c:183: error: (Each undeclared identifier is reported only once
twintig.c:183: error: for each function it appears in.)
twintig.c:183: error: structure has no member named `d_type'
twintig.c:183: error: `DT_DIR' undeclared (first use in this function)
twintig.c:186: error: structure has no member named `d_type'
twintig.c:207: error: structure has no member named `d_type'
make: *** [twintig.o] Error 1
Patch
Here's a patch to fix the compilation errors. I have successfully repacked and then unpacked and compared a save game file using this patch under Cygwin.
diff --git a/twintig.c b/twintig.c index 1cf39a6..84d9d38 100644 --- a/twintig.c +++ b/twintig.c @@ -222,16 +222,17 @@ static void find_files_recursive(const char *path) if (len >= sizeof name) ERROR("path too long"); - if (de->d_type != DT_REG && de->d_type != DT_DIR) + if (stat(name, &sb)) + fatal("stat %s", name); + + if ((!(S_ISREG(sb.st_mode))) && (!(S_ISDIR(sb.st_mode)))) ERROR("not a regular file or a directory"); - is_dir = (de->d_type == DT_DIR); + is_dir = (S_ISDIR(sb.st_mode)); if (is_dir) size = 0; else { - if (stat(name, &sb)) - fatal("stat %s", name); size = sb.st_size; } @@ -248,7 +249,7 @@ static void find_files_recursive(const char *path) size = round_up(size, 0x40); files_size += 0x80 + size; - if (de->d_type == DT_DIR) + if (is_dir) find_files_recursive(name); }
Acertain 04:51, 12 June 2009 (UTC)
About compilation errors
You should change the source where it checks if the current directory entry is a directory entry... d_type property is not supported on some systems so you should change that with an appropriate code. For example on visual c :
is_dir = (de->d_type == DT_DIR);
becomes
is_dir = ((*de).data).dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY;
Errors
I managed to compile fine (running under Debian), however I'm getting errors when I try to run zestig...
(gdb) run ~/keys/nand-dump.img
Starting program: /home/kronicd/test123/lah/wii/zestig ~/keys/nand-dump.img
Failed to read a valid object file image from memory.
Program received signal SIGBUS, Bus error.
0x08048ffb in be32 ()
Can anyone assist?