+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Change the font, PC game
Pages: [1]
Author Topic: Change the font, PC game  (Read 984 times)
samsam
Guest
« on: October 25, 2006, 09:36:41 pm »

I need to change the font of a PC game (Vampire Hurts), but I'm not sure of where to start, so I would appreciate if someone could point me to the right direction.
Aerdan
Guest
« Reply #1 on: October 26, 2006, 01:48:45 am »

The Newbie Package of REQUIRED Material
Hi.
ROMHacking.net FAQ: You ask, we answer!
ROMHacking.net Getting Started Section: Newbies Go HERE!
ROMHacking.net Documents Section!
How to ask questions the smart way.
On the Essence of ROM Hacking
samsam
Guest
« Reply #2 on: October 26, 2006, 02:45:24 am »

It's nice of you to reply, but I already checked there and didn't find anything that could help me. I'm looking for something specific about changing the font to a vwf.
Ryusui
Guest
« Reply #3 on: October 26, 2006, 03:11:17 am »

You're a level 1 newbie at the very start of the romhacking game. You haven't met the mysterious girl, lost your master or sworn eternal vengeance on the villain yet. VWF is the big boss marking the turning point in the story at the end of disc 2.

You're not exactly ready to be asking about VWF yet.
samsam
Guest
« Reply #4 on: October 26, 2006, 05:04:29 am »

I may be a newbie at hacking games, but that doesn't mean I don't have any skills. I know a lot about programming and i'm sure that with some help i'll manage to figure how to do this. Just have a little faith in me.
RedComet
Guest
« Reply #5 on: October 26, 2006, 05:12:05 am »

It might just be a matter of changing the calls to font functions in the API. I'm talking out of my ass here, since I don't know anything about PC games, but I think I remember a post (byuu or D made it?) about something similar to this.
Nightcrawler
Guest
« Reply #6 on: October 26, 2006, 07:30:56 am »

A PC game is going to go one of two general directions. It's going to call a font API call such as DrawText() or one of the other Win32 API functions for drawing text OR it's going to have it's own texture/bmp based font drawing routines much like a console.

If it's option number one, just changing the parameters of the API call will change the font. How to go about doing that I can't tell you since I only code PC games and don't hack them.

If it's option number two, you'll need to find the texture file the font is loaded from. This may be a compressed resource or packed file, it may be a standard graphics image file, etc. You'll need to find out where and how that font is stored and just draw over it with your favorite paint program.
RadicalR
Guest
« Reply #7 on: October 26, 2006, 08:12:05 am »

Nightcrawler is correct.
If it's option 1, then I can give a little more information.
First, open the exe in your favorite hex editor (I use Ultra-Edit)
You want to look for the .rdata section, since this is where the font is declared (most of the time), since the game is using a Japanese font, it will most likely be using Shift-JIS characters - That is 82 51, etc. Most Japanese game I have worked with uses MS ゴシック ; this may or may not be the case for Vampire Hurts. You can change this to another font. I like to use MS UI Gothic. It supports Japanese and English characters.

(BTW, just how far have you gotten on this? It looks like a promising game.)

Radical R
D
Guest
« Reply #8 on: October 26, 2006, 10:33:01 am »

http://www.romhacking.net/forum/index.php/topic,1008.0.html

Here is my explanation of CreateFont() and CreateFontA(). As you can see though, this will not solve all you problems if the game is manually sliding forward X pixels and rendering its letters one by one.

You can use the disassembly I posted to figure out the order things are stored in. If you need a Win32 disassembler and resource editor, I STRONGLY recommend PE Explorer. It costs a shitload and then some, but nothing beats it.
samsam
Guest
« Reply #9 on: October 26, 2006, 02:43:27 pm »

I managed to find another post where i asked the same question here a while ago (I forgot i did that) and here is what Haeleth that downloaded the demo said about it : "Analysing the executable in OllyDbg reveals that these particular programmers are using D's option 2: their text rendering routine first loads a hardwired TrueType font (MS Gothic), then renders each string one character at a time, using a fixed advance width." Back Then I had a lot of things to do and I wasn't even sure if I would be able to hack the speechs, but now that I do nothing and That I made a program to edit the speechs that works(I only need a translator and implement one or two more features into the program to make it complete, but I did tests and I can guarantee it will work 100%). I did some assembly a while back so I'm not really good at it, but if you could tell me a bit more in detail what instructions I should be looking at it would help a lot.
samsam
Guest
« Reply #10 on: January 06, 2007, 06:11:14 pm »

I'm back at trying to crack this so here my problem: the program use createfontindirectA so i need to find the adress of the logfont structure of it. I would like to know wich debugger you would recommend me.

here is the code before the call:

Code:
xor edx,edx
mov ecx,[L004904BC]
cmp esi,00000001h
setz dl
xor eax,eax
xor edi,edi
imul edx,000002BCh
cmp esi,edi
setz al
imul eax,00000190h
add edx,eax
mov [ecx+10h],edx
mov edx,[L004904BC]
movzx ecx,[ebp+18h]
mov [edx+08h],edi
mov eax,[L004904BC]
mov [eax+04h],edi
mov edx,[L004904BC]
mov [edx],ecx
mov eax,[L004904BC]
mov byte ptr [eax+14h],00h
mov ecx,[L004904BC]
mov byte ptr [ecx+15h],00h
mov edx,[L004904BC]
mov byte ptr [edx+17h],80h
mov eax,[L004904BC]
push eax
call [GDI32.dll!CreateFontIndirectA]

Edit1: forget about the debugger question, Ollydbg seems to be perfect.
« Last Edit: January 06, 2007, 06:46:02 pm by samsam »
Tauwasser
Guest
« Reply #11 on: January 07, 2007, 11:29:36 am »

Code:
mov   eax,[L004904BC]
push   eax
call   [GDI32.dll!CreateFontIndirectA]

CreateFontIndirect

The CreateFontIndirect function creates a logical font that has the specified characteristics. The font can subsequently be selected as the current font for any device context.

HFONT CreateFontIndirect(
  CONST LOGFONT* lplf   // characteristics
);

Parameters

lplf
    [in] Pointer to a LOGFONT structure that defines the characteristics of the logical font.


From my experience, all parameters are pushed in reverse order before calling the command.

cYa,

Tauwasser
samsam
Guest
« Reply #12 on: January 07, 2007, 03:29:26 pm »

I figured that this was the parameter, but it doesnt look like it contains a valid adress inside the exe. the exe adress for the code are from 401000 to 44AFFF and the vallue passed is 16D5B0. I simply dont get it.
Pages: [1]  


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