Widescreen Gaming Forum http://www.wsgf.org/phpBB3/ |
|
Squ1zZy - Some Knowledge http://www.wsgf.org/phpBB3/viewtopic.php?f=64&t=15369 |
Page 1 of 3 |
Author: | squ1zzy [ 10 Dec 2007, 23:36 ] |
Post subject: | Squ1zZy - Some Knowledge |
I don't know much and i'm not sure this will help anyone. But if i'm not posting anything i'm sure i'm not helping anyone. So here's some I know or found out. I'll update it when I have the time to do so. |
Author: | squ1zzy [ 10 Dec 2007, 23:37 ] |
Post subject: | Squ1zZy - Some Knowledge |
First of all some offsets to set the resolution using an executable. Most executables I got from http://www.gamecopyworld.com since when the executable is packed you can't find the resolution using an hex-editor. Pirates Of The Caribbean: Position01 := $35E4E; Position02 := $35E4F; Position03 := $35E54; Position04 := $35E55; Need For Speed Pro Street v1.0: Position01 := $561a90; Position02 := $561a91; Position03 := $561a94; Position04 := $561a95; Rainbow Six Vegas: Position01 := $54; Position02 := $55; Position03 := $58; Position04 := $59; Silent Hill 2: Position01 := $4A2474; Position02 := $4A2475; Position03 := $4A2478; Position04 := $4A2479; Spiderman 3: Position01 := $973950; Position02 := $973951; Position03 := $973955; Position04 := $973956; |
Author: | squ1zzy [ 10 Dec 2007, 23:38 ] |
Post subject: | Squ1zZy - Some Knowledge |
Here's my source code to patch a file made in Delphi 7. I've just started learning Delphi two months ago so it woudn't be the best writen code you've seen: Code: unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, jpeg, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Button1: TButton; ComboBox1: TComboBox; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var FileName : File Of Byte; WByte01, WByte02, WByte03, WByte04 : Byte; WByte05, WByte06, WByte07, WByte08 : Byte; WByte09, WByte10, WByte11, WByte12 : Byte; WByte13, WByte14, WByte15, WByte16 : Byte; WByte17, WByte18, WByte19, WByte20 : Byte; WByte21, WByte22, WByte23, WByte24 : Byte; WByte25, WByte26, WByte27, WByte28 : Byte; WByte29, WByte30, WByte31, WByte32 : Byte; WByte33, WByte34, WByte35, WByte36 : Byte; WByte37, WByte38, WByte39, WByte40 : Byte; WByte41, WByte42, WByte43, WByte44 : Byte; WByte45, WByte46, WByte47, WByte48 : Byte; WByte49, WByte50, WByte51, WByte52 : Byte; WByte53, WByte54, WByte55, WByte56 : Byte; WByte57, WByte58, WByte59, WByte60 : Byte; Position01, Position02, Position03, Position04 : Longint ; Position05, Position06, Position07, Position08 : Longint ; Position09, Position10, Position11, Position12 : Longint ; FileSource, FileDest: string; begin WByte01 := $C0; { 960x600 } WByte02 := $03; WByte03 := $58; WByte04 := $02; WByte05 := $00; { 1280x720 } WByte06 := $05; WByte07 := $D0; WByte08 := $02; WByte09 := $00; { 1280x768 } WByte10 := $05; WByte11 := $00; WByte12 := $03; WByte13 := $00; { 1280x800 } WByte14 := $05; WByte15 := $20; WByte16 := $03; WByte17 := $00; { 1280x1024 } WByte18 := $05; WByte19 := $00; WByte20 := $04; WByte21 := $50; { 1360x768 } WByte22 := $05; WByte23 := $00; WByte24 := $03; WByte25 := $A0; { 1440x900 } WByte26 := $05; WByte27 := $84; WByte28 := $03; WByte29 := $90; { 1680x1050 } WByte30 := $06; WByte31 := $1A; WByte32 := $04; WByte33 := $80; { 1920x480 } WByte34 := $07; WByte35 := $E0; WByte36 := $01; WByte37 := $80; { 1920x1080 } WByte38 := $07; WByte39 := $38; WByte40 := $04; WByte41 := $80; { 1920x1200 } WByte42 := $07; WByte43 := $B0; WByte44 := $04; WByte45 := $60; { 2400x600 } WByte46 := $09; WByte47 := $58; WByte48 := $02; WByte49 := $00; { 2560x1600 } WByte50 := $0A; WByte51 := $40; WByte52 := $06; WByte53 := $00; { 3072x768 } WByte54 := $0C; WByte55 := $00; WByte56 := $03; WByte57 := $00; { 3840x1024 } WByte58 := $0F; WByte59 := $00; WByte60 := $04; Position01 := $35E4E; Position02 := $35E4F; Position03 := $35E54; Position04 := $35E55; AssignFile(FileName, 'At Worlds End.exe'); If Not FileExists ('At Worlds End.exe') Then Begin ShowMessage('File Not Found ! '); Exit; End; Reset(FileName); If ComboBox1.Text='' then ShowMessage('Please Select A Resolution..'); If ComboBox1.Text='960x600' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte01); Seek(FileName, Position02); Write(FileName, WByte02); Seek(FileName, Position03); Write(FileName, WByte03); Seek(FileName, Position04); Write(FileName, WByte04); CloseFile(FileName); ShowMessage('Resolution Set To: 960x600'); End; Reset(FileName); If ComboBox1.Text='1280x720' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte05); Seek(FileName, Position02); Write(FileName, WByte06); Seek(FileName, Position03); Write(FileName, WByte07); Seek(FileName, Position04); Write(FileName, WByte08); CloseFile(FileName); ShowMessage('Resolution Set To: 1280x720'); End; Reset(FileName); If ComboBox1.Text='1280x768' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte09); Seek(FileName, Position02); Write(FileName, WByte10); Seek(FileName, Position03); Write(FileName, WByte11); Seek(FileName, Position04); Write(FileName, WByte12); CloseFile(FileName); ShowMessage('Resolution Set To: 1280x768'); End; Reset(FileName); If ComboBox1.Text='1280x800' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte13); Seek(FileName, Position02); Write(FileName, WByte14); Seek(FileName, Position03); Write(FileName, WByte15); Seek(FileName, Position04); Write(FileName, WByte16); CloseFile(FileName); ShowMessage('Resolution Set To: 1280x800'); End; Reset(FileName); If ComboBox1.Text='1280x1024' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte17); Seek(FileName, Position02); Write(FileName, WByte18); Seek(FileName, Position03); Write(FileName, WByte19); Seek(FileName, Position04); Write(FileName, WByte20); CloseFile(FileName); ShowMessage('Resolution Set To: 1280x1024'); End; Reset(FileName); If ComboBox1.Text='1360x768' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte21); Seek(FileName, Position02); Write(FileName, WByte22); Seek(FileName, Position03); Write(FileName, WByte23); Seek(FileName, Position04); Write(FileName, WByte24); CloseFile(FileName); ShowMessage('Resolution Set To: 1360x768'); End; Reset(FileName); If ComboBox1.Text='1440x900' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte25); Seek(FileName, Position02); Write(FileName, WByte26); Seek(FileName, Position03); Write(FileName, WByte27); Seek(FileName, Position04); Write(FileName, WByte28); CloseFile(FileName); ShowMessage('Resolution Set To: 1440x900'); End; Reset(FileName); If ComboBox1.Text='1680x1050' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte29); Seek(FileName, Position02); Write(FileName, WByte30); Seek(FileName, Position03); Write(FileName, WByte31); Seek(FileName, Position04); Write(FileName, WByte32); CloseFile(FileName); ShowMessage('Resolution Set To: 1680x1050'); End; Reset(FileName); If ComboBox1.Text='1920x480' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte33); Seek(FileName, Position02); Write(FileName, WByte34); Seek(FileName, Position03); Write(FileName, WByte35); Seek(FileName, Position04); Write(FileName, WByte36); CloseFile(FileName); ShowMessage('Resolution Set To: 1920x480'); End; Reset(FileName); If ComboBox1.Text='1920x1080' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte37); Seek(FileName, Position02); Write(FileName, WByte38); Seek(FileName, Position03); Write(FileName, WByte39); Seek(FileName, Position04); Write(FileName, WByte40); CloseFile(FileName); ShowMessage('Resolution Set To: 1920x1080'); End; Reset(FileName); If ComboBox1.Text='1920x1200' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte41); Seek(FileName, Position02); Write(FileName, WByte42); Seek(FileName, Position03); Write(FileName, WByte43); Seek(FileName, Position04); Write(FileName, WByte44); CloseFile(FileName); ShowMessage('Resolution Set To: 1920x1200'); End; Reset(FileName); If ComboBox1.Text='2400x600' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte45); Seek(FileName, Position02); Write(FileName, WByte46); Seek(FileName, Position03); Write(FileName, WByte47); Seek(FileName, Position04); Write(FileName, WByte48); CloseFile(FileName); ShowMessage('Resolution Set To: 2400x600'); End; Reset(FileName); If ComboBox1.Text='2560x1600' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte49); Seek(FileName, Position02); Write(FileName, WByte50); Seek(FileName, Position03); Write(FileName, WByte51); Seek(FileName, Position04); Write(FileName, WByte52); CloseFile(FileName); ShowMessage('Resolution Set To: 2560x1600'); End; Reset(FileName); If ComboBox1.Text='3072x768' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte53); Seek(FileName, Position02); Write(FileName, WByte54); Seek(FileName, Position03); Write(FileName, WByte55); Seek(FileName, Position04); Write(FileName, WByte56); CloseFile(FileName); ShowMessage('Resolution Set To: 3072x768'); End; Reset(FileName); If ComboBox1.Text='3840x1024' then Begin FileSource := 'At Worlds End.exe'; FileDest := 'At Worlds End.bak'; CopyFile(PChar(FileSource), PChar(FileDest), False); Seek(FileName, Position01); Write(FileName, WByte57); Seek(FileName, Position02); Write(FileName, WByte58); Seek(FileName, Position03); Write(FileName, WByte59); Seek(FileName, Position04); Write(FileName, WByte60); CloseFile(FileName); ShowMessage('Resolution Set To: 3840x1024'); End; End; end. |
Author: | squ1zzy [ 10 Dec 2007, 23:40 ] |
Post subject: | Squ1zZy - Some Knowledge |
Here's my source code to write to the registry made in Delphi 7. I've just started learning Delphi two months ago so it woudn't be the best writen code you've seen: Code: unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, jpeg, ExtCtrls, StdCtrls, Registry; type TForm1 = class(TForm) Button1: TButton; ComboBox1: TComboBox; Image1: TImage; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var RegWrite: TRegistry; Begin RegWrite := TRegistry.Create; RegWrite.RootKey := HKEY_CURRENT_USER; RegWrite.OpenKey('SoftwareActivisionSpider-Man FoFSettings', True); If ComboBox1.Text='' then ShowMessage('Please Select A Resolution..'); If ComboBox1.Text='960x600' then Begin RegWrite.WriteInteger('ResolutionX',960); RegWrite.WriteInteger('ResolutionY',600); RegWrite.CloseKey; ShowMessage('Resolution Set To: 960x600'); End; If ComboBox1.Text='1280x720' then begin RegWrite.WriteInteger('ResolutionX',1280); RegWrite.WriteInteger('ResolutionY',720); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1280x720'); End; If ComboBox1.Text='1280x800' then Begin RegWrite.WriteInteger('ResolutionX',1280); RegWrite.WriteInteger('ResolutionY',800); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1280x800'); End; If ComboBox1.Text='1360x768' then Begin RegWrite.WriteInteger('ResolutionX',1360); RegWrite.WriteInteger('ResolutionY',768); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1360x768'); End; If ComboBox1.Text='1440x900' then Begin RegWrite.WriteInteger('ResolutionX',1440); RegWrite.WriteInteger('ResolutionY',900); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1440x900'); End; If ComboBox1.Text='1680x1050' then Begin RegWrite.WriteInteger('ResolutionX',1680); RegWrite.WriteInteger('ResolutionY',1050); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1680x1050'); End; If ComboBox1.Text='1920x480' then Begin RegWrite.WriteInteger('ResolutionX',1920); RegWrite.WriteInteger('ResolutionY',480); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1920x480'); End; If ComboBox1.Text='1920x1080' then Begin RegWrite.WriteInteger('ResolutionX',1920); RegWrite.WriteInteger('ResolutionY',1080); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1920x1080'); End; If ComboBox1.Text='1920x1200' then Begin RegWrite.WriteInteger('ResolutionX',1920); RegWrite.WriteInteger('ResolutionY',1200); RegWrite.CloseKey; ShowMessage('Resolution Set To: 1920x1200'); End; If ComboBox1.Text='2400x600' then Begin RegWrite.WriteInteger('ResolutionX',2400); RegWrite.WriteInteger('ResolutionY',600); RegWrite.CloseKey; ShowMessage('Resolution Set To: 2400x600'); End; If ComboBox1.Text='2560x1600' then Begin RegWrite.WriteInteger('ResolutionX',2560); RegWrite.WriteInteger('ResolutionY',1600); RegWrite.CloseKey; ShowMessage('Resolution Set To: 2560x1600'); End; If ComboBox1.Text='3072x768' then Begin RegWrite.WriteInteger('ResolutionX',3072); RegWrite.WriteInteger('ResolutionY',768); RegWrite.CloseKey; ShowMessage('Resolution Set To: 3072x768'); End; If ComboBox1.Text='3840x1024' then Begin RegWrite.WriteInteger('ResolutionX',3840); RegWrite.WriteInteger('ResolutionY',1024); RegWrite.CloseKey; ShowMessage('Resolution Set To: 3840x1024'); End; RegWrite.Free; end; end. |
Author: | squ1zzy [ 10 Dec 2007, 23:42 ] |
Post subject: | Squ1zZy - Some Knowledge |
Here's my source code to write to the memory made in Delphi 7. I've just started learning Delphi two months ago so it woudn't be the best writen code you've seen: Code: unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, tlhelp32, StdCtrls, ExtCtrls, jpeg; type TForm1 = class(TForm) Timer1: TTimer; Image1: TImage; ComboBox1: TComboBox; procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; PidHandle: integer; PidID : integer; ByteArr01 : Array of byte; ByteArr02 : Array of byte; ByteArr03 : Array of byte; ByteArr04 : Array of byte; ByteArr05 : Array of byte; ByteArr06 : Array of byte; ByteArr07 : Array of byte; ByteArr08 : Array of byte; ByteArr09 : Array of byte; ByteArr10 : Array of byte; ByteArr11 : Array of byte; ByteArr12 : Array of byte; ByteArr13 : Array of byte; ByteArr14 : Array of byte; ByteArr15 : Array of byte; ByteArr16 : Array of byte; Const ProgramName = 'Bioshock.exe'; implementation {$R *.dfm} function GetProcessID(Const ExeFileName: string; var ProcessId: integer): boolean; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32; begin Result := False; FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := Sizeof(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); While Integer(ContinueLoop) <> 0 do begin if (StrIComp(PChar(ExtractFileName(FProcessEntry32.szExeFile)), PChar(ExeFileName)) = 0) or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0) then begin ProcessId:= FProcessEntry32.th32ProcessID; Result := True; Break; end; ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle); end; procedure PokeArray(Address: Cardinal; Data: Array of Byte); var Written: Cardinal; begin WriteProcessMemory(PidHandle, Pointer(Address), @Data, SizeOf(Data), Written); end; procedure TForm1.Timer1Timer(Sender: TObject); begin if (GetAsyncKeyState(VK_F1) <> 0) then if GetProcessID(ProgramName, PidId) then begin PidHandle := OpenProcess(PROCESS_ALL_ACCESS,False,PidId); if combobox1.ItemIndex=0 then begin SetLength(byteArr01, 4); ByteArr01[0] := $89; ByteArr01[1] := $88; ByteArr01[2] := $88; ByteArr01[3] := $3F; PokeArray($52E1C2C, byteArr01); SetLength(byteArr02, 4); ByteArr02[0] := $89; ByteArr02[1] := $88; ByteArr02[2] := $88; ByteArr02[3] := $3F; PokeArray($52E1C30, byteArr02); Closehandle(PidHandle); end; if combobox1.ItemIndex=1 then begin SetLength(byteArr03, 4); ByteArr03[0] := $89; ByteArr03[1] := $88; ByteArr03[2] := $88; ByteArr03[3] := $3E; PokeArray($52E1C2C, byteArr03); SetLength(byteArr04, 4); ByteArr04[0] := $89; ByteArr04[1] := $88; ByteArr04[2] := $88; ByteArr04[3] := $3E; PokeArray($52E1C30, byteArr04); Closehandle(PidHandle); end; if combobox1.ItemIndex=2 then begin SetLength(byteArr05, 4); ByteArr05[0] := $61; ByteArr05[1] := $0B; ByteArr05[2] := $B6; ByteArr05[3] := $3E; PokeArray($52E1C2C, byteArr05); SetLength(byteArr06, 4); ByteArr06[0] := $61; ByteArr06[1] := $0B; ByteArr06[2] := $B6; ByteArr06[3] := $3E; PokeArray($52E1C30, byteArr06); Closehandle(PidHandle); end; if combobox1.ItemIndex=3 then begin SetLength(byteArr07, 4); ByteArr07[0] := $CD; ByteArr07[1] := $CC; ByteArr07[2] := $4C; ByteArr07[3] := $3F; PokeArray($52E1C2C, byteArr07); SetLength(byteArr08, 4); ByteArr08[0] := $CD; ByteArr08[1] := $CC; ByteArr08[2] := $4C; ByteArr08[3] := $3F; PokeArray($52E1C30, byteArr08); Closehandle(PidHandle); end; if combobox1.ItemIndex=4 then begin SetLength(byteArr09, 4); ByteArr09[0] := $00; ByteArr09[1] := $00; ByteArr09[2] := $80; ByteArr09[3] := $3E; PokeArray($52E1C2C, byteArr09); SetLength(byteArr10, 4); ByteArr10[0] := $00; ByteArr10[1] := $00; ByteArr10[2] := $80; ByteArr10[3] := $3E; PokeArray($52E1C30, byteArr10); Closehandle(PidHandle); end; if combobox1.ItemIndex=5 then begin SetLength(byteArr11, 4); ByteArr11[0] := $AB; ByteArr11[1] := $AA; ByteArr11[2] := $AA; ByteArr11[3] := $3E; PokeArray($52E1C2C, byteArr11); SetLength(byteArr12, 4); ByteArr12[0] := $AB; ByteArr12[1] := $AA; ByteArr12[2] := $AA; ByteArr12[3] := $3E; PokeArray($52E1C30, byteArr12); Closehandle(PidHandle); end; if combobox1.ItemIndex=6 then begin SetLength(byteArr13, 4); ByteArr13[0] := $00; ByteArr13[1] := $00; ByteArr13[2] := $40; ByteArr13[3] := $3F; PokeArray($52E1C2C, byteArr13); SetLength(byteArr14, 4); ByteArr14[0] := $00; ByteArr14[1] := $00; ByteArr14[2] := $40; ByteArr14[3] := $3F; PokeArray($52E1C30, byteArr14); Closehandle(PidHandle); end; if combobox1.ItemIndex=7 then begin SetLength(byteArr15, 4); ByteArr15[0] := $55; ByteArr15[1] := $55; ByteArr15[2] := $55; ByteArr15[3] := $3F; PokeArray($52E1C2C, byteArr15); SetLength(byteArr16, 4); ByteArr16[0] := $55; ByteArr16[1] := $55; ByteArr16[2] := $55; ByteArr16[3] := $3F; PokeArray($52E1C30, byteArr16); Closehandle(PidHandle); end; end; end; end. |
Author: | squ1zzy [ 10 Dec 2007, 23:44 ] |
Post subject: | Squ1zZy - Some Knowledge |
Here's the source code I made for Half life 2 for a codecave. It uses DMA and I had to make a codecave to make it work. Again, i'm a newbie, so it wouldn't be the best code you've seen: Code: unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, tlhelp32, StdCtrls, ExtCtrls, jpeg; type TForm1 = class(TForm) Timer1: TTimer; Image1: TImage; GroupBox1: TGroupBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label8: TLabel; Label9: TLabel; procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; PidHandle: integer; PidID : integer; ByteArr01 : Array of byte; ByteArr02 : Array of byte; ByteArr03 : Array of byte; ByteArr04 : Array of byte; ByteArr05 : Array of byte; ByteArr06 : Array of byte; ByteArr07 : Array of byte; ByteArr08 : Array of byte; Const ProgramName = 'hl2.exe'; implementation {$R *.dfm} function GetProcessID(Const ExeFileName: string; var ProcessId: integer): boolean; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32; begin Result := False; FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := Sizeof(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); While Integer(ContinueLoop) <> 0 do begin if (StrIComp(PChar(ExtractFileName(FProcessEntry32.szExeFile)), PChar(ExeFileName)) = 0) or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0) then begin ProcessId:= FProcessEntry32.th32ProcessID; Result := True; Break; end; ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle); end; procedure PokeArray(Address: Cardinal; Data: Array of Byte); var Written: Cardinal; begin WriteProcessMemory(PidHandle, Pointer(Address), @Data, SizeOf(Data), Written); end; procedure TForm1.Timer1Timer(Sender: TObject); begin if (GetAsyncKeyState(VK_F1) <> 0) then if GetProcessID(ProgramName, PidId) then begin PidHandle := OpenProcess(PROCESS_ALL_ACCESS,False,PidId); SetLength(byteArr01, 11); ByteArr01[0] := $C7; ByteArr01[1] := $86; ByteArr01[2] := $9C; ByteArr01[3] := $00; ByteArr01[4] := $00; ByteArr01[5] := $00; ByteArr01[6] := $64; ByteArr01[7] := $00; ByteArr01[8] := $00; ByteArr01[9] := $00; ByteArr01[10] := $8B; PokeArray($40CF21, byteArr01); SetLength(byteArr02, 10); ByteArr02[0] := $86; ByteArr02[1] := $9C; ByteArr02[2] := $00; ByteArr02[3] := $00; ByteArr02[4] := $00; ByteArr02[5] := $E9; ByteArr02[6] := $C7; ByteArr02[7] := $E3; ByteArr02[8] := $F2; ByteArr02[9] := $21; PokeArray($40CF2C, byteArr02); SetLength(byteArr03, 6); ByteArr03[0] := $E9; ByteArr03[1] := $25; ByteArr03[2] := $1C; ByteArr03[3] := $0D; ByteArr03[4] := $DE; ByteArr03[5] := $90; PokeArray($2233B2F7, byteArr03); closehandle(PidHandle); end; if (GetAsyncKeyState(VK_F2) <> 0) then if GetProcessID(ProgramName, PidId) then begin PidHandle := OpenProcess(PROCESS_ALL_ACCESS,False,PidId); SetLength(byteArr04, 6); ByteArr04[0] := $8B; ByteArr04[1] := $86; ByteArr04[2] := $9C; ByteArr04[3] := $00; ByteArr04[4] := $00; ByteArr04[5] := $00; PokeArray($2233B2F7, byteArr04); closehandle(PidHandle); end; if (GetAsyncKeyState(VK_F3) <> 0) then if GetProcessID(ProgramName, PidId) then begin PidHandle := OpenProcess(PROCESS_ALL_ACCESS,False,PidId); SetLength(byteArr05, 11); ByteArr05[0] := $C7; ByteArr05[1] := $86; ByteArr05[2] := $C4; ByteArr05[3] := $04; ByteArr05[4] := $00; ByteArr05[5] := $00; ByteArr05[6] := $12; ByteArr05[7] := $00; ByteArr05[8] := $00; ByteArr05[9] := $00; ByteArr05[10] := $8B; PokeArray($40D7FB, byteArr05); SetLength(byteArr06, 10); ByteArr06[0] := $86; ByteArr06[1] := $C4; ByteArr06[2] := $04; ByteArr06[3] := $00; ByteArr06[4] := $00; ByteArr06[5] := $E9; ByteArr06[6] := $55; ByteArr06[7] := $F2; ByteArr06[8] := $E0; ByteArr06[9] := $21; PokeArray($40D806, byteArr06); SetLength(byteArr07, 6); ByteArr07[0] := $E9; ByteArr07[1] := $97; ByteArr07[2] := $0D; ByteArr07[3] := $1F; ByteArr07[4] := $DE; ByteArr07[5] := $90; PokeArray($2221CA5F, byteArr07); closehandle(PidHandle); end; if (GetAsyncKeyState(VK_F4) <> 0) then if GetProcessID(ProgramName, PidId) then begin PidHandle := OpenProcess(PROCESS_ALL_ACCESS,False,PidId); SetLength(byteArr08, 6); ByteArr08[0] := $8B; ByteArr08[1] := $86; ByteArr08[2] := $C4; ByteArr08[3] := $04; ByteArr08[4] := $00; ByteArr08[5] := $00; PokeArray($2221CA5F, byteArr08); closehandle(PidHandle); end; end; end. |
Author: | squ1zzy [ 10 Dec 2007, 23:58 ] |
Post subject: | Squ1zZy - Some Knowledge |
Here's some "tips" to patch a executable to make it work in widescreen resolution. First of all take a look for the following: Installation Folder ( .ini, .cfg, etc ): C:Program FilesPublisherGame User Profile ( .ini, .cfg, etc ): XP: C:Documents And Settings%Username%Userdata XP: C:Documents And Settings%Username%Local SettingsUserdata Vista: C:Users%Username%NameOfPublisher Registry: HKEY_CURRENT_USERSoftwareNameOfGame HKEY_LOCAL_MACHINESoftwareNameOfGame If there's no way to set the resolution using a file you could try to patch it editing the executable. Use an unpacked ( NO-CD for example ) executable to try finding the resolution. Open it using your favorite hex editor and search for the lowest resolution you can set in game. I usually search for 640x480 that would be 8002 and E001 in hex. Search for 8002 and look for E001 in the same place. It would be very near the first resolution. If it's not within the first 20 bytes then it wouldn't be it. Search again and look for the hex values. Once found, change it and see if the resolution changes. |
Author: | squ1zzy [ 11 Dec 2007, 00:00 ] |
Post subject: | Squ1zZy - Some Knowledge |
I've decided to make a tutorial using a freeware hex editor called XVI32. You can download it here: http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm Thanks to Mesh! ( There's a comma at the end of Mesh his link. To make that link to work remove the comma ;) ) Here we go: Open XVI32: Open the executable you want to edit. I've used NFS:Pro Street v1.0 that i've downloaded from http://m0003.gamecopyworld.com/games/pc_nfs_prostreet.shtml : Hit control+F to find a HEX string. Were need to look for a resolution you can set in-game. I normally look for the lowest resolution possible to set in-game. For NFS:Pro Street it was 640x480. So we need to look for 640x480 in HEX. Use the windows calculator to check what 640 would be in HEX. Simply enter the value in decimal and hit the HEX button. You can see that 640 would turn up in 280. We need to flipflop the first 2 bytes with the third and forth byte. Since a calculator doesn't show a 0 we need to fill that before 280. So it would be 0280 ( we need 4 bytes ). So if it ever show up with 3 bytes, just add a 0 to the beginning. So we got 0280 and we need to flipflop the bytes. 02 80 would be 80 02. Do a search for 8002: The first hit would be this: Ok we see the value 80 02 or 640 in decimal here. But nothing else. I don't see the 480 ( E0 01 ) value anywhere in the next 20 bytes. So we hit control+F again and hit enter. The next hit would show up: Nothing usefull either. So we do it again ( control+F and Enter ). Sometimes you must do this multiple times to find the correct value. Sometimes it takes for about a half an hour to find it. At the next screenshot you can see the value 8002 ( 640 ) and E001 ( 480 ) pretty close to each other. Sometimes between the values it shows 00 00 so it would be 8002 00 00 E001 but that only 10% of the games i've done. So I just did a new search. You could do the first search for 80020000E001: Now it's time to change it to whatever resolution you like and see if it changed the resolution. Let's say you want the resolution of 2560x1600 ( like I do ). Open the windows calculator and enter 2560 in decimal and hit the HEX radio button. It will turn up with A00. there's only 3 bytes so we add 0 in front of it so it would be 0A00. Now flipflop the first 2 bytes with the third and fourth and we got 00 0A. Edit E001 to with you liking. For me it was a vertical resolution of 1600 so it would turn up with 640, add a 0 to it that it would be 0640 and flipflop the values 40 06. Edit it like this: Start the game, set the resolution to 640x480 and see if it runs at 2560x1600. |
Author: | squ1zzy [ 11 Dec 2007, 00:00 ] |
Post subject: | Squ1zZy - Some Knowledge |
Here's the source to edit a file written in Delphi 7. It's the source for NFS:Pro Street: http://www.squ1zzy.nl/Temporarily/Squ1zZy_Source_ProStreet_EditFile.rar |
Author: | squ1zzy [ 11 Dec 2007, 00:34 ] |
Post subject: | Squ1zZy - Some Knowledge |
Reserved.. I'm tired and I need some sleep. There would be alot of typo's and wrong spellings in it that would be fixed later :roll: |
Page 1 of 3 | All times are UTC [ DST ] |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |