Moonlight Blade

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Moonlight Blade

Post by LokiReborn »

Not to necro old topics but a few people asked me if an English translation would be possible for Moonlight blade so I've been playing with the files and have made some corrections to successfully get most of the files out with the proper paths & names. I attached the program I'm using for testing if anyone would like to try it.

Things I found were:
What is called ALIGN at the start of the script is the block size to be used, in each data segment the first long value DUMMY is the number of blocks in the segment so the total length should equal block size * block count
Best I can tell OTHER_OFF is a list of unused / trash / old blocks from replacing files where they didn't want to regenerate the whole file and fix all of the existing entries and offsets
If the data segment has REF_OFF set that extends the current block, mostly used with the next note & with chaining the trash entries from what I've seen.
While the basic extract function is correct there is another use case. There is another entry in the Info tables after FLAGS it is a long value and if it is not equal to 0 (the value I've encountered is 0x400000) after you read block count & REF_OFF you need to read an array of longs until you hit a 0x78 0x9C, this list/array are the lengths of the back to back zlib entries that need to be decompressed and combined to create the original file.

Additional Notes: The script adjustment needed for Ring of Elysium appears to be from a damaged file and also needs to be accounted for when extracting files as it screws up the block alignment from there forward when using the offsets in the info table.

I also didn't include lzma support as I never encountered it in the current Moonlight blade or in the Ring of Elysium data 4 files I tested for compatibility.

Edit: Removed exe as it was update in other post.
Last edited by LokiReborn on Mon Jun 24, 2019 5:57 pm, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Moonlight Blade

Post by aluigi »

Interesting, probably one day I have to return on the script again.
If anyone wants to provide a patch for the script, that's welcome :)
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Moonlight Blade

Post by LokiReborn »

I'd offer to do it but I've never used QuickBMS so I wouldn't know how to implement some of the stuff, I've attached an updated exe to support cancellation and also cleaned up the source some and added notes and attached that as well if anyone wants to do the port.

The Program is written in C# for anyone that wants to play with it.
peterzhenhh
Posts: 45
Joined: Wed Jan 17, 2018 5:15 pm

Re: Moonlight Blade

Post by peterzhenhh »

LokiReborn wrote:I'd offer to do it but I've never used QuickBMS so I wouldn't know how to implement some of the stuff, I've attached an updated exe to support cancellation and also cleaned up the source some and added notes and attached that as well if anyone wants to do the port.

The Program is written in C# for anyone that wants to play with it.

Is there any way to extract .sfc with filenames?
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Moonlight Blade

Post by LokiReborn »

peterzhenhh wrote:
LokiReborn wrote:I'd offer to do it but I've never used QuickBMS so I wouldn't know how to implement some of the stuff, I've attached an updated exe to support cancellation and also cleaned up the source some and added notes and attached that as well if anyone wants to do the port.

The Program is written in C# for anyone that wants to play with it.

Is there any way to extract .sfc with filenames?


Based on eKey's comment I think you need to use Tablebin / Otherbin as the structure / index files and use that for mapping the other sfc files, did you attempt that? I believe he provided code on how hashes are generated and for the original Unpack script it would just be replacing the piece where it discards the hash to use it as a lookup for the file name.
peterzhenhh
Posts: 45
Joined: Wed Jan 17, 2018 5:15 pm

Re: Moonlight Blade

Post by peterzhenhh »

LokiReborn wrote:
peterzhenhh wrote:
LokiReborn wrote:I'd offer to do it but I've never used QuickBMS so I wouldn't know how to implement some of the stuff, I've attached an updated exe to support cancellation and also cleaned up the source some and added notes and attached that as well if anyone wants to do the port.

The Program is written in C# for anyone that wants to play with it.

Is there any way to extract .sfc with filenames?


Based on eKey's comment I think you need to use Tablebin / Otherbin as the structure / index files and use that for mapping the other sfc files, did you attempt that? I believe he provided code on how hashes are generated and for the original Unpack script it would just be replacing the piece where it discards the hash to use it as a lookup for the file name.


Okay,I know that.But I am not good at playing c#.So could you please write a extractor for .sfc as well?
Many thanks. :D
CosmicDreams
Posts: 100
Joined: Thu Sep 13, 2018 6:38 pm

Re: Moonlight Blade

Post by CosmicDreams »

Do the tools here work for Ring Of Elysium too?
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Moonlight Blade

Post by LokiReborn »

CosmicDreams wrote:Do the tools here work for Ring Of Elysium too?


Yes the VFS extractor I did works with it as well including the error correction for one of it's files if i recall (I tested it with both games, RoE was from files posted up to the forum)
CosmicDreams
Posts: 100
Joined: Thu Sep 13, 2018 6:38 pm

Re: Moonlight Blade

Post by CosmicDreams »

Are there any tools for models?
LokiReborn
Posts: 190
Joined: Fri Aug 26, 2016 3:11 pm

Re: Moonlight Blade

Post by LokiReborn »

CosmicDreams wrote:Are there any tools for models?

Mmm if it's in the sfc file I think there is a basic one http://aluigi.altervista.org/bms/qq_sfc.bms
But it doesn't do the file names as the file only references hashes. I believe EKey said they're from the table sfc files however I never looked into the format etc. as I was only focused on translation support.
peterzhenhh
Posts: 45
Joined: Wed Jan 17, 2018 5:15 pm

Re: Moonlight Blade

Post by peterzhenhh »

Thanks zaramot for this edited script
Now more assets can be extracted from .sfc files.Unfortunately,there's no vaild filename.So it would be a mess if you want to find specific assets.
unominhtuan
Posts: 34
Joined: Tue Apr 24, 2018 9:56 am

Re: Moonlight Blade

Post by unominhtuan »

LokiReborn wrote:I'd offer to do it but I've never used QuickBMS so I wouldn't know how to implement some of the stuff, I've attached an updated exe to support cancellation and also cleaned up the source some and added notes and attached that as well if anyone wants to do the port.

The Program is written in C# for anyone that wants to play with it.


can it be compressed into a vfs file after translation?