Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
SquidCoderIndustries
/
scripts
Public
forked from
DFHack/scripts
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
master
Breadcrumbs
scripts
/
binpatch.lua
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
51 lines (44 loc) · 1.17 KB
master
Breadcrumbs
scripts
/
binpatch.lua
Copy path
Top
File metadata and controls
Code
Blame
51 lines (44 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
--
Apply or remove binary patches at runtime.
--[====[
binpatch
========
Implements functions for in-memory binpatches. See `binpatches`.
]====]
local
bp
=
require
(
'
binpatch
'
)
function
run_command
(
cmd
,
name
)
local
pfix
=
name
..
'
:
'
local
patch
,
err
=
bp
.
load_dif_file
(
name
)
if
not
patch
then
dfhack
.
printerr
(
pfix
..
err
)
return
end
if
cmd
==
'
check
'
then
local
status
,
addr
=
patch
:
status
()
if
status
==
'
conflict
'
then
dfhack
.
printerr
(
string.format
(
'
%sconflict at address %x
'
,
pfix
,
addr
))
else
print
(
pfix
..
'
patch is
'
..
status
)
end
elseif
cmd
==
'
apply
'
then
local
ok
,
msg
=
patch
:
apply
()
if
ok
then
print
(
pfix
..
msg
)
else
dfhack
.
printerr
(
pfix
..
msg
)
end
elseif
cmd
==
'
remove
'
then
local
ok
,
msg
=
patch
:
remove
()
if
ok
then
print
(
pfix
..
msg
)
else
dfhack
.
printerr
(
pfix
..
msg
)
end
else
qerror
(
'
Invalid command:
'
..
cmd
)
end
end
local
cmd
,
name
=
...
if
not
cmd
or
not
name
then
qerror
(
'
Usage: binpatch check/apply/remove <patchname>
'
)
end
run_command
(
cmd
,
name
)
You can’t perform that action at this time.