Moderator
Staff member
Moderator
I'm creating a new DLL to manage fonts as the one created by formav to add new maps.
The thing is:
But the thing, I have another one for create font.
004B86A0 > 56 PUSH ESI
The calls are made correctly, the first offset calls IntializeFont and the 2nd calls InitializeFonts.
But,even if I'm not calling the 2nd sub, my game crashes. If I comment InitializeFonts the game opens.
Why is that?
With olly, I can see a lot of INT3 instructions that weren't there after I included the second function. This also happens for after the 2nd functions (of dll) starts.
I know this isn't the right place to ask this, but this is related to PT and there are many C++ lovers here.
The thing is:
That offset is where I need to set the call to my dll. Ok, that way it works fine.// QF 1873!
void * ret = (void*)0x70D7E0;
void * Font1 = (void*)0x3103170;
void * Font2 = (void*)0x3103174;
void * Font3 = (void*)0x3103178;
LPCSTR fontName = "Comic Sans MS";
_declspec(dllexport) signed int _cdecl InitializeFont()
{
// 00416774 |. E8 C7D3FFFF CALL 1873a_qu.00413B40
HFONT fonte = ::CreateFont(16,0,0,0,FW_THIN,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,4,FIXED_PITCH+FF_MODERN,fontName);
*(HFONT*) ret = fonte;
return 1;
}
But the thing, I have another one for create font.
004B86A0 > 56 PUSH ESI
But the thing is:_declspec(dllexport) signed int _cdecl InitializeFonts()
{
HFONT fonte = ::CreateFont(16,0,0,0,FW_THIN,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,4,FIXED_PITCH+FF_MODERN,fontName);
*(HFONT*) Font1 = fonte;
HFONT fonte2 = ::CreateFont(16,0,0,0,FW_THIN,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,4,FIXED_PITCH+FF_MODERN,fontName);
*(HFONT*) Font2 = fonte2;
HFONT fonte3 = ::CreateFont(16,0,0,0,FW_THIN,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,4,FIXED_PITCH+FF_MODERN,fontName);
*(HFONT*) Font3 = fonte3;
return 1;
}
The calls are made correctly, the first offset calls IntializeFont and the 2nd calls InitializeFonts.
But,even if I'm not calling the 2nd sub, my game crashes. If I comment InitializeFonts the game opens.
Why is that?
With olly, I can see a lot of INT3 instructions that weren't there after I included the second function. This also happens for after the 2nd functions (of dll) starts.
I know this isn't the right place to ask this, but this is related to PT and there are many C++ lovers here.
Last edited: