Jump to content

Hacker needed to investigate Etude's SCX engine


Decoy

Recommended Posts

Hello VN fans, I got a small problem with Etude's SCX VN engine. While the game can be hacked allowing the scripts and images to be extracted modified and reinserted using the Russian made AEVN tool, the engine itself does not allow single byte space or certain chars such as question marks, commas, etc. Below is a screenshot taken from Mikomai as you can see, all the words are seperated by double byte spaces making all the words seperated by two spaces instead of one. It's strange though since the name label allows single spaces and yet the message box doesn't.

 

screenshot.png

 

So can anything be done such as modifying the engine itself to accept single byte spaces as well as accepting question marks etc...? Here is a link to the trial version if anyone wants to have a look at the engine http://www.etude-soft.jp/product/mikomai/download/index.html While it is still possible to translate this game, I'm not really happy about seeing the game look like this and prefered the problem fixed. There's no rush, I'll wait as long as it takes for someone to fix it.

Link to comment
Share on other sites

Just taking a preliminary look here, the engine itself is hardcoded to do exactly what you don't want. The reason why, is because 640 by 480 is relative to a square, and for the text to be formatted properly, it would need those spacings (as well as the font they use).

 

The text window graphic is a static image, so everything inside the text box must conform so that it looks right without any morphing.

 

Anyway, you could fix this issue using assembly directly on the engine itself (though it'd take forever). Or fix the scripts to have no spaces (which would mangle the engine anyway).

 

Or use a different engine since you already have all the resources extracted *cough*cough*.

Link to comment
Share on other sites

Thanks for looking into it, I guess things don't look too good at the moment. I can't really expect anyone to spend a great deal of time modding the engine to fix the problems, so I guess I might just have to let this one go.

Link to comment
Share on other sites

Well, getting it to work is not impossible.... I think... :D

 

4v9oNZ1.png

How on earth did you do that? Care to share your secret with us, I don't feel like porting this game to a different engine when the existing one works fine. If possible can you upload the modded files?

Link to comment
Share on other sites

How on earth did you do that? Care to share your secret with us, I don't feel like porting this game to a different engine when the existing one works fine. If possible can you upload the modded files?

 

It was an engine patch, as someone above said.

 

Getting it changed so that it can show ASCII spaces, exclamations, and question marks was pretty simple. If you wanted to make it use ASCII commas, that will probably involve some messy hacks that I'll avoid for now. (Maybe someone can come up with a solution?)

 

.... now for some technical details....

 

When the engine loads a script, it will read the script to the ram then start replacing certain ASCII characters with null bytes. The behavior for specific bytes depend on some values in a lookup table in the game engine.

 

At offset 0x34D88 in the exe file, there's a 256 byte array that affects which how the bytes are handled. I have not completly figured out their meaning though. For now, I've only modified the entries corresponding to the ASCII space (0x20), exclamation mark (0x21), and question mark (0x3F). Those were the easy ones. Anything else would be extra troublesome if I wanted to keep it simple.

 

That's it, I guess.

Link to comment
Share on other sites

That looks like it will work.

 

To free the comma's role as a separator and make it displayable, I found an unused displayable ASCII symbol, the ` mark (0x60 / grave accent) to switch it with. That means I had to do a search and replace on all the commas in every script and swap them with the new symbol.

 

Trying to get apostrophes working

almost works, but it breaks a few things like name tags and voices.... but the method at least gets ASCII apostrophes (0x27) on screen too.W76hSD2.png

 

 

 

Here's the result.... Success!

 

J021zXA.png

Link to comment
Share on other sites

It's not real CSV. The scripts use commas mostly for image coordinates and other paired values. Quotes seem to be used for file paths and any normal text written "inside a set of quotes" will not show on screen.

 

Meanwhile, putting text inside a two-quote pair ""like this"" will crash the game when the line is about to be displayed.

Link to comment
Share on other sites

Thank you for investigating and solving the problems with the engine. Can I ask you to please find a solution to using apostrophes so that it fully works? You've almost completely solved all the problems I've been having with the engine. Also, there's no need to find a way to display quotes since I'll be using the Japanese equivalent of quotes. Thanks a million.

 

Additional: Sorry, but there's a slight problem with the modded exe. It seems that the game will crash if I try to access the CG mode and click on a character who CG's I want to view. I compared your modded exe to the original at the offset you mentioned. I saw the three changes that you made at...

 

offset 0x34da8 which lets me use 1byte space

offset 0x34da9 which lets me use an exclamation marks

offset 0x34dc7 which lets me use question marks

 

However, changing the value at offset 0x34da8 causes the CG menu to crash the game. Returning it to it's original value to seems to solve this but now I'm left unable to use 1 byte spaces anymore. As you continue playing the game (both trial and full version) it will throw up an error message when Natsuki takes you to the shrine where she works. The other two hex values are fine and won't cause the game to crash, it's just that first one which controls the 1 byte spacing.

 

screenshot2.png

Link to comment
Share on other sites

Okay... I think I got apostrophes to work safely now by replacing it with the % symbol. I hope that will be sufficient.

 

 

9SccB52.png

 

.... some technical notes ....

 

To get ASCII apostrophes (0x27) to display, I modified the engine to use the percent sign (0x25) instead. This involved some pretty simple changes to the engine code through assembly.

 

For convenience, here's a summary of all the changes to the engine:

 

The following ASCII characters which were previously undisplayable in the original engine can now be used for in-game text:

  • Spaces (0x20)
  • Exclamation marks (0x21)
  • Commas (0x2C)
  • Question marks (0x3F)
  • Apostrophes (0x27)

In exchange for making certain ASCII characters displayable, existing characters in the scripts must be switched out with substitute symbols:

  • Spaces used by script commands must be replaced with tabs (0x09)
  • Commas used by script commands must be replaced with grave marks ` (0x60)
  • Apostrophes used by script commands must be replaced by caret signs (0x5E) percent signs % (0x25)

If the neccessary substitutions are not made to the scripts, the game will not run correctly! And the patched engine exe must be used to run the modified scripts. The unpatched engine will not go too far with the changed scripts. I couldn't even make it past the title menu.

 

A list of edits to the exe:

  • Specific entries in the 256-byte array at 0x34D88 in the exe have been modified to allow our ASCII characters to be interpreted correctly by the parser as noted above
  • Changed the switch-case index at 0xC097 and 0xC099 to swap the purpose of an apostrophe and percent sign
  • Changed the assembly instruction at 0xC4FE so it takes the branch which originally belonged to the apostrophe

 

So far, so good. The hacks haven't reached crazy yet, which is nice.

Link to comment
Share on other sites

Wow that's great, if I come across any problems I'll let you know.

 

I'm pleased to say that everything is running smoothly with the new exe. As such, here is an updated demo patch that I made in 2011.

 

Special thanks to binaryfail for solving the text display problem and for providing the modded exe.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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