magical / pokemon-gba-sprites

GBA Pokémon sprite ripper
GNU General Public License v3.0
10 stars 2 forks source link

Fails to build #1

Open AoifeHughes opened 8 years ago

AoifeHughes commented 8 years ago

Been trying to use this tool to extract the sprites of pokemon fire red and none of the tools seem to want to build on either of the systems I've been working on?

Is there any possibility you could update the scripts?

magical commented 8 years ago

I just pushed a change that should fix the build errors. Please let me know if you have any further problems.

AoifeHughes commented 8 years ago

Just trying again, and I still get this? Have tried everything I can think of and installed a bunch of dependencies, even ones that I would have thought aren't needed.

nathan@xps-15-9550:~/Git/pokemon-gba-sprites$ redo redo all running build_ext building 'lzss3' extension creating build creating build/temp.linux-x86_64-3.5 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c lzss3.c -o build/temp.linux-x86_64-3.5/lzss3.o x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/lzss3.o -o /home/nathan/Git/pokemon-gba-sprites/lzss3.cpython-35m-x86_64-linux-gnu.so building 'sprites' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c sprites.c -o build/temp.linux-x86_64-3.5/sprites.o x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/sprites.o -o /home/nathan/Git/pokemon-gba-sprites/sprites.cpython-35m-x86_64-linux-gnu.so building 'png' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c png.c -o build/temp.linux-x86_64-3.5/png.o In file included from /usr/include/png.h:321:0, from png.c:241: /usr/include/pngconf.h:383:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token __pngconf.h__ in libpng already includes setjmp.h; ^ /usr/include/pngconf.h:384:12: error: unknown type name ‘__dont__’ __dont__ include it again.; ^ /usr/include/pngconf.h:384:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘it’ __dont__ include it again.; ^ /usr/include/pngconf.h:384:29: error: unknown type name ‘it’ png.c: In function ‘__pyx_f_3png_write_png’: png.c:1050:31: warning: pointer targets in assignment differ in signedness [-Wpointer-sign] (__pyx_v_rows[__pyx_t_8]) = (&(__pyx_v_cpixels[__pyx_t_7])); ^ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 redo all: exit code 1 nathan@xps-15-9550:~/Git/pokemon-gba-sprites$

magical commented 8 years ago

Hrrrg. I'm busy with school right now but i'll try to remember to take a look at this once finals are over.

magical commented 8 years ago

Hi! I finally got a chance to look at this. Based on the error message you posted, it looks like the problem stems from using an outdated libpng. Older versions of libpng complain if setjmp.h is included before png.h; unfortunately, Python.h includes setjmp.h, and Cython automatically includes Python.h first in all the C files it generates. From what I can tell, libpng 1.5.0 lifted this restriction, so try using a newer version. If that isn't an option and you have libpng 1.4, you could try setting the PNG_SKIP_SETJMP_CHECK macro.

AoifeHughes commented 8 years ago

Tried that and builds fine however this happens now:

./rip.py Pokemon\ -\ Fire\ Red\ Version\ \(U\)\ \(V1.1\).gba  sprites
Traceback (most recent call last):
  File "./rip.py", line 108, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./rip.py", line 86, in main
    pixels = read_sprite(f, front_pointers[i])
  File "./rip.py", line 48, in __call__
    x = self.func(file, pointer)
  File "sprites.pyx", line 19, in sprites.read_sprite (sprites.c:852)
    f.seek(offset)
OSError: [Errno 22] Invalid argument
magical commented 8 years ago

Woo, progress!

So it looks like the offsets in pokeroms.yml are specific to FireRed version 1.0, and you're trying to dump version 1.1. Try using these values:

diff --git a/pokeroms.yml b/pokeroms.yml
index 569cfbf..1ff7bc0 100644
--- a/pokeroms.yml
+++ b/pokeroms.yml
@@ -190,10 +190,10 @@
   TrainerPics: 0x23957C
   TrainerPals: 0x239A1C
   TrainerPicCount: 147
-  MonsterPics: 0x2350AC
-  MonsterPals: 0x23730C
-  MonsterShinyPals: 0x2380CC
-  MonsterBackPics: 0x23654C
+  MonsterPics: 0x23511C
+  MonsterPals: 0x23737C
+  MonsterShinyPals: 0x23813C
+  MonsterBackPics: 0x2365BC
   MonsterPicCount: 440
   MapHeaders: 0x5524C
   Maps: 0x55194