Jump to content

Shin Koihime Musou Translation Project


MKDude

Recommended Posts

I'm trying to decompile the scripts, but I've gotten stuck. The opcode 0x2d for instance, when in the "main" script as it were, once you get down to where the text strings start, it has 1 operand, and loads a BGM file. But, further up in the script, it has 0 operands. In SN00101.bin for instance, I'm talking about the 0x2c at 0x153c. In the game, it reads that opcode, then reads 0x2d, 0x2f and 0x2e. That's based on 0x2c having 0 operands, which isn't the case further down at say, 0x42dc, where the variable after it is the pointer to the BGM filename.

 

So, if the script really is made of two parts (or more?), where opcodes are defined differently, even when the game runs the same code so I'm not sure about that, where's the definition that marks the start of the main script?

 

If anyone knows, plix let me know. :)

Link to comment
Share on other sites

Pretty good progress, and yea i'm sure none of us mind the checking and editing you'll have to do after you're done with translation. While the h-scene percent is low gotta remember that they will consist mostly of *ahem* ahhhs ooohs and oooos, so easier translation there.

 

Since I'm the only person who's actually contributed to that 9%, I suppose I'm the only one who can say anything here. While you aren't entirely incorrect about the moaning and...other noises noises being a majority of lines in H-scenes, I can't exactly say they are easier to translate for two reasons:

1) The female characters in this game have a bad habit of trying to speak while...vocally impaired. Their voices are often slurred, muffled, or broken up by gasps which increases the difficulty by a non-insignificant amount.

2) The H-scenes are LOOOOOOOOONG! Here's an example: I have run most of the Shunran/Shuuran events on auto mode and filmed them for the sake of putting subtitles on them. Nearly all of them clock in at just under 30 minutes except for events 9 and 11 (The two that contain H-scenes). These two scenes last more than 90 minutes each; 30 minutes for some preliminary event stuff and the remaining hour is H (nice endurance, Kazuto).

 

So yeah...hooray that the players get a really long time to enjoy the H-scenes in this game, but for the translators, they are something of a nightmare

Link to comment
Share on other sites

The unpacking isn't all that hard (in fact all the images on the facebook page were photoshopped using unpacked images from the game files already), but putting it all back into a bin.arc file is a nightmare.

I suppose the game isn't capable of reading in bin.arc as a folder named bin or bin.arc either?

Link to comment
Share on other sites

I suppose the game isn't capable of reading in bin.arc as a folder named bin or bin.arc either?

 

I have tried that and I don't believe it worked, but any sort of file replacement is a pain in the butt with this game in the first place. For example, I recently gave one of our new translators a 100% save game file to put into their game. They put the file in, overwrote the old one, and the game still was using the old data when we started the program again. This is not the first time this kind of thing has happened  either. My point with this is that it's insanely hard to tell if something like the "bin.arc as a folder" plan works because the game seems to be capable of storing a cache of all its old data or something. (I do remember that we eventually got it to work for someone else a while back, so it doesn't seem like we're using the wrong file or something...I just don't know how to force the game to update it's cache)

 

Well then, that doesn't sound too fun, does it ever feel awkward btw? Or are you too focused on translating.

 

Depends on who you ask. Our main YouTube guy avoids putting any of the H-scenes on YouTube not only because of the site's guidelines, but also because he feels like he's writing some crappy fanfiction or something whenever things get dirty. As for me, I find that taking the time and focus to analyze how every single line is put together and thinking of a way to transmit the same intentions in English is an impressively effective buzzkill. If I feel anything towards H-scenes in general, it's that romanizing all the weird noises that show up in those scenes can become a massive bore after you've gone through half of an hour-long H-scene. If I was going through the scenes much faster than I am currently able to, then it might become a bit awkward, but imagine you're watching a porno online and over 80% of the time you're sitting there is spent just watching the video buffer and getting random spikes of general lag. At that point, there's going to be more pressing matters on your mind than the actual contents of the video...That's how translating H-scenes pretty much goes.

Link to comment
Share on other sites

Alright so I've gotten it all decompiling and compiling, with the potential to add opcodes (although not remove, would you need that?). The main problems now are painful things like being able to find and identify every opcode that can jump, otherwise everything's going to break when adding opcodes. I'm assuming that you'll want to add new lines/boxes into the game, so doing that is sort of essential. I'm terrible at regex-type stuff so putting the strings into a more editable format (rather than all a single line split with \n) is difficult for me. Also, I don't know how to identify the start of the script, so adding opcodes to the pre-script section can't be done, although for translating I don't think you'd need to change anything there, but still.

 

EDIT:

 

Ok, think I can give it out now: http://pastebin.com/N3wVhj1p - for Python 2.7.

 

Here's a bit on how to use it. Firstly, usage is "script.py [options] [infile/infolder]"

Options are:

-e1 <filename>  - extract a single file. Use this if you're just working on 1 file from the same folder where the script is.

-e2 <foldername> - extract all the *.bin files in the given folder. They'll all be placed in a "Scripts" folder.

-c1 <filename> - compile a single file, again use this if working with a single file. Note that the output file will end up replacing the original bin file if you extracted and then compiled. Rename the original bin to something else after extracting it in order to keep it.

-c2 <foldername> compile a whole folder. All the output will go into a "Compiled" folder. You can then copy that into the game folder.

 

Put the script into a folder of its own, and then put all your extracted bins (from asmodean's tool or something else) into a sub-folder. Run "script.py -e2 <foldername>" to decompile them all into a Scripts folder. You can then work on the scripts all you like, and when you want to recompile, either copy the decompiled script into the same folder as the python script and run "script.py -c1 <script filename>" (for working on a single file) or you can compile a whole folder with "script.py -c2 <foldername>"

 

For editing the scripts themselves:

 

They're split into two main parts, a pre-script and a script section. You can edit values of the pre-script section, but just don't add any new opcodes to it, because then I can't determine where the script starts, and that's required. Do a search for == and you'll be able to find the ====== Script ====== line, that's where the main script starts, where all the text is.

 

The text you'll want to edit is laid out like this:

 

4410 { named-text
/////////////////////////////////////////////////////////
「ほらぁ~、二人とも早く早く~!」
/////////////////////////////////////////////////////////
???
/////////////// }

 

Different opcodes have different layouts. named-text has two parts, the first part is the text itself, and the second part is the speaker's name. narration and windless-text only have the one text section.

 

The forwards slashes are guides of how long your lines can be, you can bring your lines up the slashes and should be safe, the line won't be automatically split. But do note that they absolutely aren't "perfect," and in-game the text formatting will likely differ from your text editor, so I don't recommend going RIGHT up the edge, try to leave like 1 or 2 characters breathing room, but hopefully the guides help. The actual spoken text can be multi-line, but the character name should only be one line.

 

Here's an example of the edited script and what it looks like when compiled and put back into the game:

 

lGj3QZh.jpg

 

 

To add new opcodes, you need to add them just without the starting number and { that you see on every line.

 

441c { play-voice "ogg\ryubi0000.ogg" 2 2 }

 

Would become:

 

play-voice "ogg\ryubi0000.ogg" 2 2

 

You can leave the ending } on, but you just have to make sure that the opcode itself is first. You can add any opcodes you want in the script section (as long as they exist and you give the right amount of variables of course)

 

To add a new page of text, you need to add this code:

 

named-text
/////////////////////////////////////////////////////////
Any text here
/////////////////////////////////////////////////////////
Any name here
/////////////// }
play-voice "ogg\ryubi0000.ogg" 2 2 }
0x41 3 }
0x1 3 }
end-block }

0x8a 3cf }
0x41 3 }
0x1 1 }
end-block }

 

That would all amount to a new textbox. Replace the named-text code for whatever kind of text you're adding, that could be narration or windowless-text as well. All the rest stays the same.

 

Again, here's a picture example which adds a new page of text to the script:

 

JJRbl2v.jpg

 

Everything I added to the script is highlighted there. That's what it should look like if you want to add a new page. You should probably leave out the added "play-voice" opcode, as you don't want to re-play the voice file if you're extending an existing line. You don't need to add a string counter (I don't think), but it doesn't hurt to. The number for it is fixed by the compiler automatically, so don't worry about setting it to be correct or anything, just make sure *a* number is there. You don't have to add gaps in the script either.

 

Let me know if you have any problems and especially crashes. Feel free to mess with the values of opcodes as much as you want, try and figure out what the opcodes actually do, and often you can end up with some very helpful results.

Link to comment
Share on other sites

Alright, I am completely unfamiliar with python, so this is likely my fault. Am I not supposed to run this through cmd or something?

H54TrVH.png

 

It's saying your code has invalid lines in it, but since I don't know the specifics of the python print function I can't tell why it's complaining. Would you mind giving me a full example command just so i can see how I'm supposed to run this?

Link to comment
Share on other sites

Alright, I've gone in and decompiled a script, edited the first line to my translated version and recompiled it. The question now is, how do i get this new .bin file to actually show up in game? This was the main problem I was having back when I was trying to work this out myself. Having a folder named "bin" or "bin.arc" with all the binaries inside is not recognized by the game, so did you have a way to compile everything back into an actual archive file?

 

EDIT: I should also mention that when i ran -c2 on the scripts folder that was created in the -e2 step, the program skipped over most of the files (including the nov_sn files). the only things it brought were "Auto_SN00###_###" files and "SN######" files

Link to comment
Share on other sites

Put the compiled .bin into the same folder as the game exe.

 

Also, just as a note for easier testing, you can rename any script to be SN00101.bin, Shu's very first one, and then just start the game and go right into testing it. You don't have to go through huge portions of the game each time or keep loads of saves everywhere. I suppose you can get character conversations through the main menu directly anyway, but can help if you don't know which convo number it is. Also as far as I see you can't run through chapters of the stories from the menu can you? So it can massively help there, just load the chapter you want as SN00101. The intro slides you have to click through for new games are pretty annoying though.

 

EDIT: Ah, sorry, I left a piece of code in there from when I was testing, I updated the script in my post, try that one.

Link to comment
Share on other sites

You are able to get to any chapter and any character event from the main menu as long as you have seen them in the game itself (and have completed the game at least once).

 

Anyway, as for the file replacement....oh my god, was it really that easy the whole time!? Seriously, just dropping the bin file into the main folder was enough!?

3NS7xWg.png

Christ, that's embarrassing. Thanks a bunch for all your help.

Link to comment
Share on other sites

Now I should just mention for the sake of the people reading this: We are trying to do this in collaboration with MangaGamer and they don't seem to do partial patches, so I wouldn't get your hopes up too high for that; it's MG's call on that field. However this has already been very helpful to our image editor as he has already been able to identify and work on certain issues that showed up involving text size and whatnot. Not to mention It might be easier for editors to work on the text if they can see it alongside the dialogue as it's spoken, but that's not my field so I'm not sure how it will truly affect the editing side of things. Basically, this looks like it will be quite helpful in maintaining the quality of the release.

Link to comment
Share on other sites

Updated my post with a new version of the script. It now supports removing opcodes from the script section, and also can decompile/compile all the Message_ files from bin_b.arc for battle messages. Those files go into a Battle\ subfolder. Also identified and added some more opcode info.

 

If you've already done a bunch of stuff with the first script and cba to do it again, then don't bother extracting again. There isn't that much point, unless you're doing the Message files or want to remove opcodes from the scripts whatever reason. But it's there if you want.

Link to comment
Share on other sites

Much appreciated. I'll go ahead and update my stuff. Thanks again :D

 

EDIT: Messing around with your code, I also managed to make a variation of it that extracts the text into a readable Japanese script that looks identical to the manual agth extractions i had been using before. Since MangaGamer is going to want scripts that alternate between Japanese lines and their English translations, this just shaved a huge chunk of time off of my future scripts, so thanks once more for your hard work. :D 

Link to comment
Share on other sites

(oh the forums are finally back up)

Are you able to get that back into a .bin though? I suppose you'd just have to read though the normal extract and then read from the other file if you hit an opcode that does text.

 

Oh, no, nothing that fancy. I just meant that MangaGamer wants files that put the English line by the Japanese one so previously I've had to run through each event manually to extract the Japanese text. Now that you've made a program that can actually parse the files (including putting in missing character names in those files), I've been able to make a separate piece of code that modifies the extract functionality to give me the Japanese side of the scripts in seconds, but the new program can't compile anything, it's just for making scripts (which is why I'm keeping your original program around). I would have also experimented with being able to compile those Jap-Eng scripts into .bin files, but the text wrapping in this game would simply be too big of a hurdle for me to consider it.

Link to comment
Share on other sites

I'll check when I get home. By the way, couldn't text wrapping automatically be done by inserting a carriage return character at the end of the line n where n is the max number of characters that can fit on a single line within the dialog box? Single byte ASCII characters, of course.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...