PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

I appreciate anyone taking their time to help me with this,i'll give proper credits when english translation patch comes out

GAME NAME / SERIAL NUMBER / REGION / CRC
Second Novel ~Kanojo no Natsu, 15-fun no Kioku~
JPN: セカンドノベル ~彼女の夏、15分の記憶~
NPJH50279 Released exclusively in Japan
CRC:93FFC610

GAME DEVELOPERS / PUBLISHERS
Nippon Ichi Software and TEXT.

FIRST 8 BYTES OF THE ATTACHED FILE ARCHIVE
[.BIN] - 70 61 63 6B 00 00 00 00 1C - pack....

ALL PROGRAMS I'VE TRIED TO OPEN THE FILE WITH
WinRAR,7Zip,Dragon Unpacker,Noesis,Kuriimu,Kuriimu2

DIRECT LINK DOWNLOAD (EXCEEDS FORUM MAX LIMIT)
SOUND.BIN, 76.16MB Download provided by MediaFire

If download provider is prohibited i will have no issues uploading file somewhere else as suggested
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by rabatini »

IX285 wrote:I appreciate anyone taking their time to help me with this,i'll give proper credits when english translation patch comes out

GAME NAME / SERIAL NUMBER / REGION / CRC
Second Novel ~Kanojo no Natsu, 15-fun no Kioku~
JPN: セカンドノベル ~彼女の夏、15分の記憶~
NPJH50279 Released exclusively in Japan
CRC:93FFC610

GAME DEVELOPERS / PUBLISHERS
Nippon Ichi Software and TEXT.

FIRST 8 BYTES OF THE ATTACHED FILE ARCHIVE
[.BIN] - 70 61 63 6B 00 00 00 00 1C - pack....

ALL PROGRAMS I'VE TRIED TO OPEN THE FILE WITH
WinRAR,7Zip,Dragon Unpacker,Noesis,Kuriimu,Kuriimu2

DIRECT LINK DOWNLOAD (EXCEEDS FORUM MAX LIMIT)
SOUND.BIN, 76.16MB Download provided by MediaFire

If download provider is prohibited i will have no issues uploading file somewhere else as suggested


You provide a sound pack file.

generally pack files is all riff header, differently of other files.

Wav format seems to be compressed, maybe BloodRaynare can help, as per he/she is expert in sound stuff

If you want all pacs, i suggest you upload differently pacs, sounds usually is different from anothers.
Last edited by rabatini on Tue Aug 09, 2022 2:39 am, edited 1 time in total.
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by BloodRaynare »

Here's a script to correctly extract the files:

Code: Select all

IDstring "pack"
get ZERO long
get INFO_OFF long
get INFO_SZ long
get FILES long

goto INFO_OFF

for i = 0 < FILES
   getDstring NAME 52
   get OFFSET long
   get SIZE long
   log NAME OFFSET SIZE
next i


@rabatini no need to blindly extracts the Atrac3+ (at3) audio files by searching the RIFF magic, the BIN files already has an offset for the table of contents (TOC) for the files inside. The TOCs are stored at the end of the BIN file.
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by rabatini »

BloodRaynare wrote:Here's a script to correctly extract the files:

Code: Select all

IDstring "pack"
get ZERO long
get INFO_OFF long
get INFO_SZ long
get FILES long

goto INFO_OFF

for i = 0 < FILES
   getDstring NAME 52
   get OFFSET long
   get SIZE long
   log NAME OFFSET SIZE
next i


@rabatini no need to blindly extracts the Atrac3+ (at3) audio files by searching the RIFF magic, the BIN files already has an offset for the table of contents (TOC) for the files inside. The TOCs are stored at the end of the BIN file.


My bad, i completely forget to take a look in the end of the file for TOC.
good that you see it.
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

I can not thank enough for your help,sorry for providing only sound file but entire .DAT of scripts is massive,i'll include both of you in the credits,that's least i can do!Thanks for the help again you guys!

EDIT 1:It worked,successfully extracted 9340 files,this should be easy ride in terms of file compressions,but if i run into issue i'll make sure no one spoonfeeds again!

EDIT 2:I might've bit myself on easy compression thing,i found files being compressed (again) but i won't request help and spam irrelevant edits,i can figure this out myself i think,i know where to ask if i can't,sorry for inconvenience and have a great day!
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

Alright,all files seem to have lzss compression,so i tried writing QuickBMS script,which doesn't do the job since it gives me empty file with desired prefix,so if anyone can take a look i'd appreciate it.This is my first time writing QuickBMS so i'll understand all possible criticism

Code: Select all

endian big
comtype lzss "12 4 2 2 0"
idstring lzss
get SIZE long
get ZSIZE long
get DUMMY long
savepos OFFSET
math ZSIZE -= OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by BloodRaynare »

IX285 wrote:Alright,all files seem to have lzss compression,so i tried writing QuickBMS script,which doesn't do the job since it gives me empty file with desired prefix,so if anyone can take a look i'd appreciate it.This is my first time writing QuickBMS so i'll understand all possible criticism

Code: Select all

endian big
comtype lzss "12 4 2 2 0"
idstring lzss
get SIZE long
get ZSIZE long
get DUMMY long
savepos OFFSET
math ZSIZE -= OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE


Your script is fine, but without the sample file it's hard to see what's wrong. Upload the compressed files here. If you don't feel like uploading the whole file due to the sizes, provide the first part of the file (about 5 to 10MB is fine).
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

BloodRaynare wrote:
IX285 wrote:Alright,all files seem to have lzss compression,so i tried writing QuickBMS script,which doesn't do the job since it gives me empty file with desired prefix,so if anyone can take a look i'd appreciate it.This is my first time writing QuickBMS so i'll understand all possible criticism

Code: Select all

endian big
comtype lzss "12 4 2 2 0"
idstring lzss
get SIZE long
get ZSIZE long
get DUMMY long
savepos OFFSET
math ZSIZE -= OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE


Your script is fine, but without the sample file it's hard to see what's wrong. Upload the compressed files here. If you don't feel like uploading the whole file due to the sizes, provide the first part of the file (about 5 to 10MB is fine).


Oh,i have just attached one of the files,all seem to use same compression!
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by BloodRaynare »

Okay, few things:

- At offset 0x4 there's 4-byte zeroes that you still need to read/skip within the script. QuickBMS cannot skip bytes on it's own, you must declare a command, like "get ZERO long" or "padding 4".
- And some bad news, looks like this game using a custom implementation of LZSS compression (I've tried any of the LZ* algorithms and can't get a correct data out of it or the algorithm outright crashes QuickBMS). But probably because I haven't tried hard enough to keep trying.
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

Well,that definitely doesn't sound as good as i wanted it to sound,explains why all my exports were 0kb,should i just give up or wait for more responses?

Also,funny thing to add but i think file / files in the .gim itself are in direction right to left instead of left to right
ie. MIG.0.0.1PSP might be PSP1.0.0.gim,could that cause algorithm crash?
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by BloodRaynare »

IX285 wrote:Well,that definitely doesn't sound as good as i wanted it to sound,explains why all my exports were 0kb,should i just give up or wait for more responses?

Also,funny thing to add but i think file / files in the .gim itself are in direction right to left instead of left to right
ie. MIG.0.0.1PSP might be PSP1.0.0.gim,could that cause algorithm crash?


The "0-bytes" was a different problem. It's because you were trying to read the uncompressed SIZE variable at offset 0x4, which equals zero. The value you were looking for is at offset 0x08. So to skip the zeroes, declare a "get ZERO long" or "padding 4" command before "get SIZE long".
But, yeah, the real problem was the compression algorithm.
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

Alright,i'll edit the code when i come back home and i guess hope for the best,i'll do few edits on my progress and next steps as well!
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by rabatini »

And you have to take off the big endian in this case.
Should like this.

Code: Select all

comtype lzss "12 4 2 2 0"
idstring "lzss"
get ZERO long
get SIZE long
get ZSIZE long

get DUMMY long
savepos OFFSET
math SIZE -= OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE


it will decompress, but seems it not the correclty lzss comtype.
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

rabatini wrote:And you have to take off the big endian in this case.
Should like this.

Code: Select all

comtype lzss "12 4 2 2 0"
idstring "lzss"
get ZERO long
get SIZE long
get ZSIZE long

get DUMMY long
savepos OFFSET
math SIZE -= OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE


it will decompress, but seems it not the correclty lzss comtype.

Actually,i'm pretty much sure i screwed up with comtype since first time i wrote the script i was like having errors,and found other user in this forum had that in the script,what got me somewhere atleast.Is there way to "get" correct comtype of lzss so i can make it right?

Thanks for the script,i'll run it later today to make sure this works and report the progress
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by rabatini »

Well, dig a little bit, about lzss variant, i come to this variant.

Code: Select all

comtype nislzs

idstring "lzss"

get ZERO long
get SIZE long
get ZSIZE long
savepos OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE
 
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

rabatini wrote:Well, dig a little bit, about lzss variant, i come to this variant.

Code: Select all

comtype nislzs

idstring "lzss"

get ZERO long
get SIZE long
get ZSIZE long
savepos OFFSET

get NAME filename
string NAME += ".1PSP"
clog NAME OFFSET ZSIZE SIZE
 

I'm an idiot,how come i haven't asked Disgaea guys about it,the f i thought hahahaha :oops:

This will most probably work,thanks so much
IX285
Posts: 15
Joined: Mon Aug 08, 2022 7:48 pm

Re: PSP // Second Novel: Kanojo No Natsu, 15 Fun no Kioku - .BIN file help needed

Post by IX285 »

Alright,so here i'll post updates until i get files in viewable and readable state,which will i hope finally be groundwork for patch

EDIT 1:Script provided by rabatini works,i have extracted file from .gim files,from here i'll try to read them with few programs
I will also immediately use google for file signature to be sure what i'm dealing with here

EDIT 2:It is not boy,it is not girl either,it is .GIM file,which seems to be good thing,for me atleast

EDIT 3:It is completely viewable,readable and exportable,here i'll manage fine but will most probably have to deal with repacking
whole stuff,so expect other topic when this part is done.Thanks a lot,i'll make sure you get appropriate credits for your work!