Need help for extracting NPK files
-
- Posts: 58
- Joined: Mon Jul 27, 2020 5:53 pm
Need help for extracting NPK files
Thanks to the effort of Ekey that i have got resources of Kishin Hishou now, currently me and my friend only have one game left that is Kishin Houkou Demonbane. The game used NPK engine and came out from last year, we used Garbro but it didn't work even if used engine from 3 games which are Minikui Mojika no Ko, Sonicomi and Tokyo Necro. We will extremely grateful if you guys can help.
Editted: Solved, creditted to Ekey again for his effort.
Editted: Solved, creditted to Ekey again for his effort.
Last edited by Lucas Hood on Wed Aug 19, 2020 1:38 pm, edited 4 times in total.
-
- Posts: 1383
- Joined: Sat Aug 09, 2014 2:34 pm
Re: Need help for extracting NPK files
Code: Select all
# Demonbane (機神咆吼デモンベイン) NPK (NPK2) format
# script for QuickBMS http://quickbms.aluigi.org
comtype deflate_noerror
set KEY binary "\xBE\x28\x02\xAD\x5E\x91\xDD\x8E\x26\xEA\xD6\xB1\x61\xFE\xDB\x8A\x17\xE2\x36\x2F\x53\x33\x6D\x1B\x17\xD8\x0A\xE9\x55\xC0\x5A\xED"
idstring "NPK2"
get VERSION long #2
getdstring IV 16
get FILES long
get TABLE_SIZE long
savepos TABLE_OFFSET
encryption aes_256_cbc KEY IV
log MEMORY_FILE TABLE_OFFSET TABLE_SIZE
encryption "" ""
for i = 0 < FILES
get ZERO byte MEMORY_FILE
get NSIZE short MEMORY_FILE
getdstring NAME NSIZE MEMORY_FILE
get SIZE long MEMORY_FILE
getdstring SHA2 32 MEMORY_FILE
get CHUNKS long MEMORY_FILE
log NAME 0 0
append
for j = 0 < CHUNKS
get CHUNK_OFFSET longlong MEMORY_FILE
get CHUNK_ESIZE long MEMORY_FILE
get CHUNK_ZSIZE long MEMORY_FILE
get CHUNK_SIZE long MEMORY_FILE
encryption "cipherfinal aes_256_cbc" KEY IV
clog NAME CHUNK_OFFSET CHUNK_ESIZE CHUNK_SIZE 0 CHUNK_ESIZE
encryption "" ""
next j
append
next i
Last edited by Ekey on Tue Aug 18, 2020 1:14 pm, edited 1 time in total.
-
- Posts: 58
- Joined: Mon Jul 27, 2020 5:53 pm
Re: Need help for extracting NPK files
YOU ARE TRULY OUR LORD AND SAVIOR, THANK YOU VERY MUCH!
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Need help for extracting NPK files
@Ekey
Does it solve the problem I noticed with the first 16bytes?
http://zenhax.com/viewtopic.php?f=9&t=2720
You used comtype deflate_noerror so I guess you just ignored the invalid bytes, correct?
Does it solve the problem I noticed with the first 16bytes?
http://zenhax.com/viewtopic.php?f=9&t=2720
You used comtype deflate_noerror so I guess you just ignored the invalid bytes, correct?
-
- Posts: 58
- Joined: Mon Jul 27, 2020 5:53 pm
Re: Need help for extracting NPK files
Currently me and my friend are also having trouble with the movie files though - except for the CGs and Scripts, Sounds since all are fine, most of the movie files are either distorted or unreadable, like it played for a bit then it froze. Let's wait for Ekey to help then.
https://imgur.com/a/g1nFWWm
https://imgur.com/a/g1nFWWm
-
- Posts: 1383
- Joined: Sat Aug 09, 2014 2:34 pm
Re: Need help for extracting NPK files
aluigi wrote:@Ekey
Does it solve the problem I noticed with the first 16bytes?
I have not found any files with the invalid first 16 bytes.
aluigi wrote:You used comtype deflate_noerror so I guess you just ignored the invalid bytes, correct?
No, some chunks are simply not compressed in the case of small files, since there are no flags, to check this I set "noerror".Anyway it works correctly.
Lucas Hood wrote:Currently me and my friend are also having trouble with the movie files though - except for the CGs and Scripts, Sounds since all are fine, most of the movie files are either distorted or unreadable, like it played for a bit then it froze. Let's wait for Ekey to help then.
https://imgur.com/a/g1nFWWm
There is such a problem, but I don't know what caused it.
Edited*: I modified a arc_unpacker by replacing the key from Sonicomi and it extracts exactly the same videos, some play and some break off. I don't know what could be the matter, sorry.
Edited2*: So I found the reason why they break off. Extra 16 bytes are appended to the beginning of some decompressed chunks -> 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
-
- Posts: 58
- Joined: Mon Jul 27, 2020 5:53 pm
Re: Need help for extracting NPK files
Ekey wrote:aluigi wrote:@Ekey
Does it solve the problem I noticed with the first 16bytes?
I have not found any files with the invalid first 16 bytes.aluigi wrote:You used comtype deflate_noerror so I guess you just ignored the invalid bytes, correct?
No, some chunks are simply not compressed in the case of small files, since there are no flags, to check this I set "noerror".Anyway it works correctly.Lucas Hood wrote:Currently me and my friend are also having trouble with the movie files though - except for the CGs and Scripts, Sounds since all are fine, most of the movie files are either distorted or unreadable, like it played for a bit then it froze. Let's wait for Ekey to help then.
https://imgur.com/a/g1nFWWm
There is such a problem, but I don't know what caused it.
Edited*: I modified a arc_unpacker by replacing the key from Sonicomi and it extracts exactly the same videos, some play and some break off. I don't know what could be the matter, sorry.
Edited2*: So I found the reason why they break off. Extra 16 bytes are appended to the beginning of some decompressed chunks -> 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
So is there anyway to fix them?
-
- Posts: 1383
- Joined: Sat Aug 09, 2014 2:34 pm
Re: Need help for extracting NPK files
Download latest GARbro here
Download fixed Format.dat from attach
Copy it to GARbro\GameData folder
Run GARbro and use Sonicomi scheme
result
Download fixed Format.dat from attach
Copy it to GARbro\GameData folder
Run GARbro and use Sonicomi scheme
result
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Need help for extracting NPK files
Ekey wrote:Edited2*: So I found the reason why they break off. Extra 16 bytes are appended to the beginning of some decompressed chunks -> 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
I know how to fix it.
It's the calling of DecryptFinal done by OpenSSL and it can be done in quickbms by simply using the DecryptFinal prefix (or cipherfinal) in front of the algorithm, for example:
Code: Select all
encryption "cipherfinal aes_256_cbc" KEY IV
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Need help for extracting NPK files
This is the edited script with automatic scanning of the keys:
http://aluigi.org/bms/sonicomi.bms
I didn't test it but I hope it works
http://aluigi.org/bms/sonicomi.bms
I didn't test it but I hope it works
-
- Posts: 1383
- Joined: Sat Aug 09, 2014 2:34 pm
Re: Need help for extracting NPK files
aluigi wrote:I know how to fix it.
It's the calling of DecryptFinal done by OpenSSL and it can be done in quickbms by simply using the DecryptFinal prefix (or cipherfinal) in front of the algorithm, for example:Code: Select all
encryption "cipherfinal aes_256_cbc" KEY IV
Works fine, thanks
@Lucas Hood - Use whatever method you like, GARbro or fixed script in my post or script from aluigi
aluigi wrote:This is the edited script with automatic scanning of the keys:
http://aluigi.org/bms/sonicomi.bms
I didn't test it but I hope it works
Also works fine
Last edited by Ekey on Tue Aug 18, 2020 1:20 pm, edited 1 time in total.
-
- Posts: 58
- Joined: Mon Jul 27, 2020 5:53 pm
Re: Need help for extracting NPK files
Thank you you guys so much for helping us, we couldn't have done it without you guys. Everything went smoothly now.