rufaswan / Web2D_Games

2D Games playable on the web!
https://rufaswan.github.io/Web2D_Games/
GNU General Public License v3.0
27 stars 6 forks source link

Cannot extract Rusty data #1

Closed MichalSkysky closed 2 years ago

MichalSkysky commented 2 years ago

Hey, i tried running your tools for extracting rusty assets, but I only get a bunch of errors.

php psxtools/pc98_rusty_map-tbl-dat.php psxtools/rusty/BOSS1.DAT

PHP Notice:  Uninitialized string offset: 167164340 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 48
PHP Notice:  Uninitialized string offset: 222882100 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 49
PHP Notice:  Uninitialized string offset: 55728821 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 46
PHP Notice:  Uninitialized string offset: 111446581 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 47
PHP Notice:  Uninitialized string offset: 167164341 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 48
PHP Notice:  Uninitialized string offset: 222882101 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 49
PHP Notice:  Uninitialized string offset: 55728822 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 46
PHP Notice:  Uninitialized string offset: 111446582 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 47
PHP Notice:  Uninitialized string offset: 167164342 in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 48

and this one

php psxtools/pc98_rusty_map-tbl-dat.php psxtools/rusty/BG1.dat
== mapdat( psxtools/rusty/BG1 )
map : 739712 x 33600
== sectmap( 739712 , 33600 )

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 2097152) (tried to allocate 49708646432 bytes) in /mnt/c/users/JodMinster/Downloads/Web2D_Games/tools/psxtools/pc98_rusty_map-tbl-dat.php on line 101

I tried it on windows and on an ubuntu WSL sub-system with the same errors. I am quite familiar with PHP, but not with the whole asset extraction stuff, so any help would be highly appreciated.

Thanks :)

rufaswan commented 2 years ago

Hi Michal! Sorry for the late reply. Github didn't send me any notification at all. Luckily I check around and noticed this open issue!

All Rusty assets are all compressed. So the first step you'll need to do is to decompress them:

php   psxtools/pc98_rusty_pc98_rusty_LZ_decode.php   *

All compressed files starts with magic letter LZ, so it won't mistakenly decompress any uncompressed files.

After that you'll need to load the files in certain order to rip them. For example:

php  psxtools/pc98_rusty_map-tbl-dat.php  bg1.rgb  bg1.map  page3_1r.tbl  page3_1l.tbl  page3_1m.tbl  boss1.tbl  kime.tbl  clear1.tbl
php  psxtools/pc98_rusty_map-tbl-dat.php  bg2.rgb  bg2.map  boss2_r.tbl  boss2_l.tbl  boss2_m.tbl  kime.tbl  clear2.tbl
...

The order list is commented at the end of PHP file. You just need to copy them line by line. https://github.com/rufaswan/Web2D_Games/blob/master/tools/psxtools/pc98_rusty_map-tbl-dat.php

Same for *.MGX files:

php  psxtools/pc98_rusty_mgx.php  r_a11.mgx  r_a11_1.mgx  r_a11_2.mgx  r_a11_3.mgx  r_a11_4.mgx  r_a11_5.mgx  r_a11_6.mgx  r_a11_7.mgx
...

https://github.com/rufaswan/Web2D_Games/blob/master/tools/psxtools/pc98_rusty_mgx.php

For .MAG and .ANI pair. The 0-23 behind marks the extract .ANI with correct palette (they are from .MAG file)

php  psxtools/pc98_rusty_mag-ani.php  vs1_01.mag  vs1.ani
php  psxtools/pc98_rusty_mag-ani.php  vs1_02.mag  vs1.ani
...

https://github.com/rufaswan/Web2D_Games/blob/master/tools/psxtools/pc98_rusty_mag-ani.php

After that, all the .RGBA and .CLUT files can be converted to PNG with

php  psxtools/img_clut2png.php  */*.clut  */*.rgba

Hope that helps! Rufas

MichalSkysky commented 2 years ago

Awesome! It worked. Thanks so much. The reason why I was asking in the first place is because I started speedrunning the game and became the mod on speedrun.com for the game and wanted to use some assets to make the page look prettier. I saw you also published some assets on spriters-resource.com, but some important ones were missing.

Anyhow, thanks for the support and great work with the whole thing in general. :)