Jump to content

Kelebek1

Members
  • Posts

    597
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. Like
    Kelebek1 got a reaction from Vorthod Wiler in Shin Koihime Musou Translation Project   
    Are you using Python 3? The script is only for Python 2.7. They overhauled the syntax massively for 3.0, so I'm pretty sure you're using 3 instead of 2.7.
     
    Your command was all fine.
  2. Like
    Kelebek1 got a reaction from Vorthod Wiler in Shin Koihime Musou Translation Project   
    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:
     
     
    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:
     

     
     
    To add new opcodes, you need to add them just without the starting number and { that you see on every line.
     
     
    Would become:
     
     
    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:
     
     
    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:
     

     
    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.
  3. Like
    Kelebek1 got a reaction from Pran in Shin Koihime Musou Translation Project   
    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:
     
     
    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:
     

     
     
    To add new opcodes, you need to add them just without the starting number and { that you see on every line.
     
     
    Would become:
     
     
    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:
     
     
    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:
     

     
    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.
×
×
  • Create New...