[SML] Carnival

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
dareka
Posts: 5
Joined: Tue Dec 11, 2018 5:26 am

[SML] Carnival

Post by dareka »

I'd like to have a bms script for Carnival by S.M.L.
There actually is a dumper already, but I can't get the repacker to work, so if I had a bms script I wouldn't have any problem.

Here you have some example archives: https://ufile.io/ihh47
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [SML] Carnival

Post by aluigi »

The script is valid for reimporting:
http://aluigi.org/bms/sml_carnival.bms

More info about reimporting are available in section 3 of http://aluigi.org/papers/quickbms.txt
dareka
Posts: 5
Joined: Tue Dec 11, 2018 5:26 am

Re: [SML] Carnival

Post by dareka »

Uhm, there must be something wrong in the code.
On the left the file extracted with quickbms and on the right the file extracted with the tool I add
[spoiler]Image[/spoiler]

And the script can't extract images.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [SML] Carnival

Post by aluigi »

I updated the script 5 minutes after my post so I guess you downloaded the first version :)
Redownload it to get the correct script.
dareka
Posts: 5
Joined: Tue Dec 11, 2018 5:26 am

Re: [SML] Carnival

Post by dareka »

aluigi wrote:I updated the script 5 minutes after my post so I guess you downloaded the first version :)
Redownload it to get the correct script.

The new script works great for the images, but the script files are still extracted with gibberish in them.
I'm not a programmer, so I don't know what's the issue, but in the file that seems to be the source code of the other tool I have there's this interesting part about the header

Code: Select all

typedef struct _HEADER
{
   char signature[0x2B];
   unsigned char xormask;
   unsigned int filecount;
   unsigned int indexoffset;
} HEADER;

I don't know what this "0x2B" is, but it's not present in your script.

I put the file on Pastebin, if you want to see it.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [SML] Carnival

Post by aluigi »

Here all the files from script.pd are perfect and perfectly readable.

Example:

Code: Select all

IF $KAISOU == 0 JMP NOT_KAISOU_CVA501
JMP SN_CVA501_00
:NOT_KAISOU_CVA501


TS 0
TWS 0
TS 3





 今更理紗にこだわったってしょうがない。ここは、渡会さんと一緒に逃げよう。
...
dareka
Posts: 5
Joined: Tue Dec 11, 2018 5:26 am

Re: [SML] Carnival

Post by dareka »

I swear, yesterday it didn't work. I had my language settings for non-unicode set to Japanese, I switched them back to the original settings and the tool worked. Now I set it to Japanese again and it still works. I have no idea why :lol:

Anyway, if I use the normal reimport method it works, but if I use the reimport2 (even with unedited files) the game crashes. What's really strange is the fact that if I use reimport2 with unedited files I get a new archive with the same byte count as the original (~1MB), but if later I use this new archive as a base for reimport1 I get a 690MB archive starting from a 1MB archive. lol
I got that there should be some problem with the TOC or whatever. What baffles me is the fact that starting from a 1MB archive I get a 690MB archive using the 1:1 reimport method. :shock:
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: [SML] Carnival

Post by aluigi »

What you have found is a bug in reimport2 or, to be more exact, an incompatibility in the "filexor" instruction in reimport2 mode (not exactly a bug).

Basically only the files are obfuscated while the information are in clear-text.
In script.pd the files are obfuscated so we:
- read the information
- activate the filexor obfuscation
- dump the file
- change the original offset/size/zsize fields
- disable the filexor obfuscation

The problem is that when we edit the fields we have the obfuscation activated and our new fields will be corrupted.

I have rewritten the script for supporting the reimport mode, version 0.1.2.
I opted for checking if "PackPlus" is specified because I'm quite sure that the encryption is not based on the extension of the files.

Regarding filexor and reimport2... I will think about it, if it's something that must be fixed or doesn't matter :)
dareka
Posts: 5
Joined: Tue Dec 11, 2018 5:26 am

Re: [SML] Carnival

Post by dareka »

Wow, now it works. Thank you.
It works for edited images too.
However the extracted sound files won't open. But maybe they have some special codec or something. But I don't really care, so nevermind.