Author Topic: Help needed with unpacking and repacking .pak files to translate Touhou MAIDEN  (Read 7104 times)

0 Members and 1 Guest are viewing this topic.

Hello!  I've made substantial progress on translating the Hachikuma RPG known as Touhou MAIDEN (also known by many as Defiant of Shrine Maiden), but the only thing stopping me from completing my translation is the fact that I don't know how to repack the .pak files so I can reinsert the modified files back into the game.  I have several leads on how this might be accomplished, though, so if someone can help me with this task, this game will finally have an English translation.  Note that although I am inexperienced with programming and game modification (I've never done a fan translation before), I'm very determined and I'm good at figuring things out, so although I might need a little bit of guidance, I should be able to complete this translation project.  (For reference, I managed to make a complex bug-free ASM hack of "The Legend of Zelda: Oracle of Seasons/Ages" within a few days despite knowing literally nothing about ASM hacking when I started the project, so my determination should hopefully compensate for my lack of experience. XD)

I happened to notice an older topic in which HakanaiBlue was working on translating the game, and has successfully repacked the files using the unpacking and repacking tools designed for Devil of Decline's translation.  If anyone can share these tools with me, this would probably instantly solve the problem.  Alternatively, I have some other ideas and clues.

One factor I noticed is that Hachikuma tends to use the same file structure and encryption system for many of the games they've developed, including the games they've developed under the name Strawberry Bose.  I know for a fact that Genius of Sappheiros uses the same file structure, and I strongly suspect that Devil of Decline and Touhou Soccer do as well.  As a result, if anyone has unpacking and repacking tools that were used for the fan translations of any of those games, those will probably work perfectly.

If none of those are an option, I've found some clues that might expedite the process of making an unpacking/repacking utility from scratch.  Earlier, I found that a program called "crass" was able to extract the game's files, but has no functionality for repacking (although its "readme" file made it sound like the files might be extracted in a way that makes it impossible to repack them anyway; the wording is a bit ambiguous).  This program's coding is listed on Github, and I think I managed to pinpoint the coding that handles how it extracts this game's .pak files.  The .pak files in question are written in an unusual form called "SRSPlayer" (Sagiri Resource Set Gameplayer), and they appear to be encrypted using a form of the Mersenne Twister pseudorandom number generator.  In case it's helpful, below is a link to the page containing the coding on how crass extracts the .pak files.
https://github.com/rinrin-/crass/blob/master/cui/SRSPlayer/SRSPlayer.cpp

I also found that a program called "quickbms" is able to extract (and theoretically repackage) the game files by using a .bms file that appears to have been written for extracting files from Genius of Sappheiros.  However, this program is not designed for repacking, and it mentions that repackaged files must be equal or smaller in size to the originals, which probably won't work for a translation project (hence why I can't just use this program).  The .bms file might serve as another clue on how to extract these files, though.  Below is a link to its page on Github.
https://github.com/bartlomiejduda/Tools/blob/master/NEW%20Tools/The%20Genius%20of%20Sappheiros%20Weekend/The_Genius_of_Sappheiros_Weekend_PAK_script.bms

There is one other detail I noticed that might make more sense to me if I knew more about programming.  When I extract the files using "crass", the files are freely viewable and easy to modify, but when I extract them using "quickbms", I only get a large number of .bin files.  I'm not sure if this means that "quickbms" isn't decrypting them, or if the .bin files need to be extracted, too.  I suppose my main point is that if someone offers me a tool that results in .bin files after unpacking, I might need some guidance on how to unpack and repack those .bin files as well. ^^;

Anyway, thank you for any help you can provide!  It's been my dream to translate this game for over 10 years now, so if someone can help me with this one task, I'll see this translation project to its completion as long as I still draw breath.

Very late response but wouldn't your best bet be to ask HakanaiBlue about it? Even at the forums peak the amount of people who could answer your question would be few in number