-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxr_strings.pas
More file actions
88 lines (64 loc) · 1.37 KB
/
xr_strings.pas
File metadata and controls
88 lines (64 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
unit xr_strings;
interface
type
str_value = packed record
dwReference:cardinal;
length:cardinal;
dwCRC:cardinal;
next:pointer;
value:char; //really array here
end;
pstr_value = ^str_value;
shared_str = packed record
p_:pstr_value;
end;
pshared_str = ^shared_str;
str_container=packed record
//TODO:Fill
end;
pstr_container=^str_container;
string_path=array [0..519] of Char;
procedure assign_string(str:pshared_str; text:PChar); stdcall;
function Init():boolean; stdcall;
function str_container_dock(str:PChar):pstr_value; stdcall
implementation
uses basegamedata;
procedure assign_string(str:pshared_str; text:PChar); stdcall;
var
docked:pstr_value;
begin
docked:= str_container_dock(text);
if docked<>nil then begin
docked.dwReference:=docked.dwReference+1;
end;
if (str^.p_<>nil) then begin
str^.p_.dwReference:=str^.p_.dwReference-1;
if str^.p_.dwReference=0 then str.p_:=nil
end;
str^.p_:=docked;
end;
function GetStrContainer():pstr_container;stdcall;
asm
mov eax, xrCore_addr
mov eax, [eax+$BE784]
mov @result, eax
end;
function str_container_dock(str:PChar):pstr_value; stdcall
asm
pushad
pushfd
push str
call GetStrContainer
mov eax, ecx
mov eax, xrcore_addr
add eax, $1DDA0
call eax
mov @Result, eax
popfd
popad
end;
function Init():boolean; stdcall;
begin
result:=true;
end;
end.