program GEngine;
{$define Win32App}
uses
windows,messages,MiniFMOD,sysutils,
win2k
in '
Win2k.pas';
const
LOGO = 113;
ABOUT_DIALOG = 103;
ABOUT_CLOSE_BUTTON = 105;
INFO_EDIT = 14;
info =
..............
hier kommt die NFO rein also nicht wundern :)
......
var
Msg : TMSG;
Win : HWND;
Inst : Integer;
MusicPlayer : HMUSICMODULE;
const
WS_EX_LAYERED = $80000;
LWA_COLORKEY = 1;
LWA_ALPHA = 2;
const
WindowName = '
biohazard 4';
GAddress1 = $A0A274;
GAddress2 = $A0A27F;
GAddress3 = $63CDB2;
Gbuf1 :
array[1..11]
of byte = ($B9,$38,$1F,$00,$00,$09,$C1,$66,$89,$4F,$08);
Gbuf2 :
array[1..5]
of byte = ($E9,$34,$2B,$C3,$FF);
Gbuf3 :
array[1..6]
of byte = ($E9,$BD,$D4,$3C,$00,$90);
{$R res\trainer.res}
procedure trans(Handle_:hWnd;Trans:byte);
begin
SetWindowLong(Handle_, GWL_EXSTYLE, GetWindowLong(Handle_, GWL_EXSTYLE)
or WS_EX_LAYERED);
Win2k.SetLayeredWindowAttributes(Handle_, 0, Trans, LWA_ALPHA);
end;
procedure RunGame;
var sti:tstartupinfo;
lpPi:tprocessinformation;
begin
ZeroMemory(@sti, SizeOf(sti));
ZeroMemory(@lpPi, SizeOf(lpPi));
If not CreateProcess(
nil,'
game.exe',
nil,
nil,false,CREATE_NEW_CONSOLE
or NORMAL_PRIORITY_CLASS,
nil,
nil,sti,lppi)
then begin
MessageBox(Win,'
Game EXE not found','
Error',mb_ok+mb_iconinformation);
end else
if CreateProcess(
nil,'
game.exe',
nil,
nil,false,CREATE_NEW_CONSOLE
or NORMAL_PRIORITY_CLASS,
nil,
nil,sti,lppi)
then begin
FSOUND_Close;
end;
end;
function PatchMem(WindowName:pchar;BaseAddress:dword;buffer:pointer;LengthOfBuffer:dword):boolean;
var
hwnd,id,ph:dword;
written:cardinal;
successful:longbool;
begin
asm
xchg eax,written
mov eax,0
end;
hwnd:=findwindowexa(0,0,
nil,WindowName);
asm
xchg edx,hwnd
end;
asm
cmp hwnd,0
end;
getwindowthreadprocessid(hwnd,@id);
ph:=openprocess(generic_read
or generic_write,false,id);
asm
cmp ph,0
end;
begin
patchmem:=false;
exit;
end;
asm
push written
push LengthOfBuffer
push buffer
push BaseAddress
push ph
call WriteProcessMemory
mov successful, eax
end;
patchmem:=successful;
closehandle(0);
end;
procedure Quit;
begin
EndDialog(win,0);
FMUSIC_FreeSong(MusicPlayer);
FSOUND_Close;
halt;
end;
function AboutDlgProc(hWin, uMsg, wParam, lParam : Integer) : Integer;
stdcall;
var
OldInfo :
array[0..65534]
of Char;
hIcon, hFont, Color, I : Integer;
begin
if uMsg = WM_INITDIALOG
then
begin
trans(hWin,245);
GetDlgItemText(hWin, INFO_EDIT, PChar(@OldInfo), 65535);
SetDlgItemText(hWin, INFO_EDIT, PChar(
String(OldInfo) + info));
hFont := CreateFont(10, 0, 0, 0, 400, 0, 0, 0,
DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH, '
Terminal');
if hFont <> 0
then SendDlgItemMessage(hWin, INFO_EDIT, WM_SETFONT, hFont, 0);
SendDlgItemMessage(hWin, 14, 1096, 0, $0);
end;
if uMsg = WM_LBUTTONDOWN
then
begin
ReleaseCapture;
SendMessage(hWin,WM_NCLBUTTONDOWN,HTCAPTION,0);
end;
Result := 0;
if (uMsg = WM_DESTROY)
or (uMsg = WM_CLOSE)
or
((uMsg = WM_COMMAND)
and (wParam = ABOUT_CLOSE_BUTTON))
then EndDialog(hWin,0);
end;
function SettingsDlgProc(Window : hWnd; Msg,WParam,LParam : Integer): Integer;
StdCall;
var
OldInfo :
array[0..65534]
of Char;
begin
case Msg
of
wm_InitDialog :
begin
trans(window,205);
FSOUND_File_SetCallbacks(@XMFile_OpenCallback, @XMFile_CloseCallback,
@XMFile_ReadCallback, @XMFile_SeekCallback, @XMFile_TellCallback);
FSOUND_Init(44100, 0);
MusicPlayer := FMUSIC_LoadSong('
XMMUSIC',
nil);
FMUSIC_PlaySong(MusicPlayer);
end;
WM_LBUTTONDOWN :
begin
ReleaseCapture;
SendMessage(Window,WM_NCLBUTTONDOWN,HTCAPTION,0);
end;
wm_Close : DestroyWindow(Win);
wm_Destroy : PostQuitMessage(0);
end;
Result := 0;
case Msg
of
WM_COMMAND :
begin
end;
end;
end;
Procedure RunSettings;
begin
Win := CreateDialog(hInstance,PCHar(100),0,@SettingsDlgProc);
Showwindow(Win,SW_SHOW);
Updatewindow(Win);
end;
begin
RunSettings;
while GetMessage(Msg,0,0,0)
do
begin
TranslateMessage(Msg);
DispatchMessage(Msg);
//end;
if (GetAsyncKeyState(VK_END) <> 0)
then quit;
if (GetAsyncKeyState($52) <> 0)
then RunGame;
if (GetAsyncKeyState($49) <> 0)
then DialogBoxParam(hInstance, PChar(ABOUT_DIALOG), Win,@AboutDlgProc, 0);
if (GetAsyncKeyState(VK_F1) <> 0)
then patchmem(WindowName,GAddress1,@Gbuf1,sizeof(Gbuf1));
patchmem(WindowName,GAddress2,@Gbuf2,sizeof(Gbuf2));
patchmem(WindowName,GAddress3,@Gbuf3,sizeof(Gbuf3));
end;
end.