+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Cramped UI? Cramped Strings?
Pages: [1]
Author Topic: Cramped UI? Cramped Strings?  (Read 1 times)
Strill
Guest
« on: May 30, 2011, 10:18:33 am »

I came across a Japanese indie game I liked so I figured I'd try my hand at translating it.  I've finally managed to get an insertion script written and working, unfortunately much of my translations are too big to fit in the game's UI elements, and end up overflowing off the side.  Even worse, some strings have little to no padding giving me a hard limit of around 15 characters to write what should be 26.

Are there any special tricks to dealing with limited UI space other than just abbreviating things?  And for the limited length strings, is there some decompiler that can add padding to an executable without misaligning everything and invalidating pointers?

I'm probably asking for impossible things, but I figured if they existed, people here would probably know.
« Last Edit: May 30, 2011, 10:55:55 am by Strill »
Ryusui
Guest
« Reply #1 on: May 30, 2011, 12:28:42 pm »

Welcome to the wonderful world of translation hacking, my friend.

Hacking a Windows executable (I'm assuming it's a Windows executable) isn't much different from hacking a ROM - it requires its own set of specialized knowledge, but the things you ask for are well within the realm of possibility.

Mind, I'm just here to let you know that. ^_^; I know a fair bit about romhacking, but hacking a PC game is outside my realm of expertise and experience. But if you've already gotten started on a translation, you're sure to find some help.
Jorpho
Guest
« Reply #2 on: May 30, 2011, 01:13:23 pm »

Quote from: Strill on May 30, 2011, 10:18:33 am
Are there any special tricks to dealing with limited UI space other than just abbreviating things?  And for the limited length strings, is there some decompiler that can add padding to an executable without misaligning everything and invalidating pointers?
I reckon the possibilities include rearranging the UI or finding some way to hack whatever routine adds the text to the UI.  (In particular, are you still using fixed-width Shift-JIS?)

If you want to avoid misaligning everything, it stands to reason that the best way would be to find the pointer to the text you want to change, and instead direct that pointer to a space at the end of the file.
Strill
Guest
« Reply #3 on: May 30, 2011, 01:32:46 pm »

The primary font is the game designer's own custom SHIFT-JIS encoded font created with a table of 8x8 pixel characters in bitmap format.  The second font for 8-bit ASCII is also 8x8 pixels, so  there's no advantage there. 

I tried finding the routine that prints text by decompiling the program with a demo version of IDA and setting breakpoints at every DirectX call that looked relevant.  It passes three breakpoints before the window pops up, but I never seem to hit any breakpoints after that.  I don't know if it uses something else or if the decompiler's just unreliable.

Thanks a lot for the idea of redirecting the pointers.  It might not work if the code tries to access that memory via an address and an offset rather than just one hardcoded address, but it's worth a try.
Jorpho
Guest
« Reply #4 on: May 30, 2011, 02:13:22 pm »

Quote from: Strill on May 30, 2011, 01:32:46 pm
The primary font is the game designer's own custom SHIFT-JIS encoded font created with a table of 8x8 pixel characters in bitmap format.  The second font for 8-bit ASCII is also 8x8 pixels, so  there's no advantage there.
Well, if you can find the font and identify its pixel-format, then instead of inserting new text, the brute-force way of doing it would be replacing the characters with parts of the word you want to insert.  (That is, if you wanted to insert the word "TEXT", you could replace one Japanese character with "TE" and another one with "XT".)

Of course, if there's a gigantic script that's supposed to go into this UI, then this would involve identifying all suitable character pairs in the text and sticking them into the font, possibly expanding the font in the process – but in the case of a Windows executable, you don't have to deal with the same restrictions as a console ROM, at least.
Strill
Guest
« Reply #5 on: May 30, 2011, 02:37:56 pm »

Interesting idea.  The bitmap containing the SHIFT-JIS isn't big enough to hold the entire character set, just around 500 or so characters.  There's about 80 lines I need to insert, a good portion of which are just one or two words.  I can't figure offhand whether 500 characters is sufficient, but in case it isn't I'll see if I can lengthen the file and have the game will recognize the new additions or if it's programmed to only load a specific chunk.

« Last Edit: May 30, 2011, 02:48:34 pm by Strill »
Klarth
Guest
« Reply #6 on: May 30, 2011, 03:05:42 pm »

You have a ton of options when it comes to PC game hacking.  It just depends on your skill level.  You can do anything from repointering the text to hacking in a DLL reference and rewriting the string-grabbing routine to grab from an external text file instead.

I'd set a breakpoint on the text string to be printed first and the printing routine should be nearby.  I'd read up some on how you can print text using DirectX.  At a minimum, it involves creating a new texture (dimensions based on string size) and copying characters from a preloaded font texture.  Then rendering to screen (may be relevant if you need to reposition).  There are some simplified functions in the D3DX library that may be used too.  Such as using ID3DXFont but I think that's unlikely because it's just a bitmap file.  It's probably the first scenario.
henke37
Guest
« Reply #7 on: May 31, 2011, 05:29:00 am »

Or it could be using GDI in combination with directX.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC