| 1 | UNIT Unit14; | 
 
 
 
 
 | 2 | INTERFACE | 
 
 
 
 
 | 3 | USES | 
 
 
 
 
 | 4 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 | 5 | Dialogs, StdCtrls, ExtCtrls, ComCtrls, StrUtils; | 
 
 
 
 
 | 6 | TYPE | 
 
 
 
 
 | 7 | TForm14 = Class(TForm) | 
 
 
 
 
 | 8 | Label1: TLabel; | 
 
 
 
 
 | 9 | Label2: TLabel; | 
 
 
 
 
 | 10 | edit_char: TEdit; | 
 
 
 
 
 | 11 | list: TListBox; | 
 
 
 
 
 | 12 | updown: TUpDown; | 
 
 
 
 
 | 13 | tim_lvlcheck: TTimer; | 
 
 
 
 
 | 14 | PROCEDURE updownClick(Sender: TObject; Button: TUDBtnType); | 
 
 
 
 
 | 15 | PROCEDURE FormCloseQuery(Sender: TObject; var CanClose: Boolean); | 
 
 
 
 
 | 16 | PROCEDURE tim_lvlcheckTimer(Sender: TObject); | 
 
 
 
 
 | 17 | PROCEDURE listClick(Sender: TObject); | 
 
 
 
 
 | 18 | PRIVATE | 
 
 
 
 
 | 19 | { Private declarations } | 
 
 
 
 
 | 20 | PUBLIC | 
 
 
 
 
 | 21 | { Public declarations } | 
 
 
 
 
 | 22 | END; | 
 
 
 
 
 | 23 |  | 
 
 
 
 
 | 24 | VAR | 
 
 
 
 
 | 25 | Form14: TForm14; | 
 
 
 
 
 | 26 |  | 
 
 
 
 
 | 27 | IMPLEMENTATION | 
 
 
 
 
 | 28 | USES Unit1, Unit2, Unit8; | 
 
 
 
 
 | 29 | {$R *.dfm} | 
 
 
 
 
 | 30 | VAR lvl_shown:Byte; | 
 
 
 
 
 | 31 | modelcount:Byte; | 
 
 
 
 
 | 32 |  | 
 
 
 
 
 | 33 | FUNCTION patch_loader_loaded:Boolean; | 
 
 
 
 
 | 34 | CONST check_for:LongWord=$0010656EE9; | 
 
 
 
 
 | 35 | address_at:LongWord=$4228ED; | 
 
 
 
 
 | 36 | BEGIN | 
 
 
 
 
 | 37 | IF Decode_Int(ReadMem(address_at,4))=check_for THEN result:=True | 
 
 
 
 
 | 38 | ELSE result:=False; | 
 
 
 
 
 | 39 | END; | 
 
 
 
 
 | 40 |  | 
 
 
 
 
 | 41 | PROCEDURE TForm14.listClick(Sender: TObject); | 
 
 
 
 
 | 42 | VAR model:LongWord; | 
 
 
 
 
 | 43 | struct1:LongWord; | 
 
 
 
 
 | 44 | BEGIN | 
 
 
 
 
 | 45 | IF _connected AND (lvlnumber>0) AND patch_loader_loaded THEN BEGIN | 
 
 
 
 
 | 46 | model:=Decode_Int(ReadMem($10F20+Form14.list.ItemIndex*4,4)); | 
 
 
 
 
 | 47 | struct1:=Decode_Int(ReadMem(PointerStruct1PointerArray1,4)); | 
 
 
 
 
 | 48 | struct1:=Decode_Int(ReadMem(struct1+4*StrToInt(Form14.edit_char.Text),4)); | 
 
 
 
 
 | 49 | WriteMem(struct1+$00C,4,Encode_Int(model)); | 
 
 
 
 
 | 50 | END ELSE BEGIN | 
 
 
 
 
 | 51 | IF _connected AND (lvlnumber>0) THEN BEGIN | 
 
 
 
 
 | 52 | MessageBox(Form14.Handle,PChar('Oni.exe is not patched.'),PChar('Error'),MB_OK); | 
 
 
 
 
 | 53 | END; | 
 
 
 
 
 | 54 | END; | 
 
 
 
 
 | 55 | END; | 
 
 
 
 
 | 56 |  | 
 
 
 
 
 | 57 | PROCEDURE TForm14.tim_lvlcheckTimer(Sender: TObject); | 
 
 
 
 
 | 58 | VAR i:Byte; | 
 
 
 
 
 | 59 | BEGIN | 
 
 
 
 
 | 60 | IF _connected AND (lvlnumber>0) AND patch_loader_loaded THEN BEGIN | 
 
 
 
 
 | 61 | IF lvl_shown<>lvlnumber THEN BEGIN | 
 
 
 
 
 | 62 | list.Items.Clear; | 
 
 
 
 
 | 63 | modelcount:=Decode_Int(ReadMem($10F05,1)); | 
 
 
 
 
 | 64 | FOR i:=0 TO modelcount-1 DO BEGIN | 
 
 
 
 
 | 65 | list.Items.Add('Model'+IntToStr(i+1)+' ('+IntToHex(Decode_Int(ReadMem($10F20+i*4,4)),8)+')'); | 
 
 
 
 
 | 66 | END; | 
 
 
 
 
 | 67 | lvl_shown:=lvlnumber; | 
 
 
 
 
 | 68 | END; | 
 
 
 
 
 | 69 | END ELSE BEGIN | 
 
 
 
 
 | 70 | list.Items.Clear; | 
 
 
 
 
 | 71 | lvl_shown:=0; | 
 
 
 
 
 | 72 | END; | 
 
 
 
 
 | 73 | END; | 
 
 
 
 
 | 74 |  | 
 
 
 
 
 | 75 | PROCEDURE TForm14.FormCloseQuery(Sender: TObject; var CanClose: Boolean); | 
 
 
 
 
 | 76 | BEGIN | 
 
 
 
 
 | 77 | Self.Visible:=False; | 
 
 
 
 
 | 78 | CanClose:=False; | 
 
 
 
 
 | 79 | Form1.menu_Models.Checked:=False; | 
 
 
 
 
 | 80 | END; | 
 
 
 
 
 | 81 |  | 
 
 
 
 
 | 82 | PROCEDURE TForm14.updownClick(Sender: TObject; Button: TUDBtnType); | 
 
 
 
 
 | 83 | BEGIN | 
 
 
 
 
 | 84 | Form14.edit_char.Text:=IntToStr(updown.Position); | 
 
 
 
 
 | 85 | END; | 
 
 
 
 
 | 86 |  | 
 
 
 
 
 | 87 | END. |