add item pickup patch
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
entry_ptr:
|
||||
reloc0:
|
||||
.offsetof start
|
||||
|
||||
start:
|
||||
mova r0, [address]
|
||||
mov.l r0, [r0]
|
||||
rets
|
||||
mov.l r0, [r0]
|
||||
|
||||
.align 4
|
||||
address:
|
||||
.data 0
|
||||
@@ -0,0 +1,13 @@
|
||||
entry_ptr:
|
||||
reloc0:
|
||||
.offsetof start
|
||||
|
||||
start:
|
||||
call resume
|
||||
address:
|
||||
.data 0
|
||||
resume:
|
||||
pop eax
|
||||
mov eax, [eax]
|
||||
mov eax, [eax]
|
||||
ret
|
||||
@@ -0,0 +1,33 @@
|
||||
.meta name="Write memory"
|
||||
.meta description="Writes data to any location in memory"
|
||||
|
||||
entry_ptr:
|
||||
reloc0:
|
||||
.offsetof start
|
||||
|
||||
start:
|
||||
mova r0, [dest_addr]
|
||||
mov r4, r0
|
||||
mov.l r0, [r4]
|
||||
mov.l r5, [r4 + 4]
|
||||
add r4, 8
|
||||
again:
|
||||
test r5, r5
|
||||
bt done
|
||||
mov.b r6, [r4]
|
||||
mov.b [r0], r6
|
||||
add r4, 1
|
||||
add r0, 1
|
||||
bs again
|
||||
add r5, -1
|
||||
done:
|
||||
rets
|
||||
nop
|
||||
|
||||
.align 4
|
||||
dest_addr:
|
||||
.data 0
|
||||
size:
|
||||
.data 0
|
||||
|
||||
data_to_write:
|
||||
+4
-4
@@ -3,7 +3,7 @@
|
||||
|
||||
# This is also the file I've chosen to document how to write code for newserv's
|
||||
# functions subsystem. There are three kinds of functions: includes, patches,
|
||||
# and general functions. This file, WriteMemory, is a general function. It
|
||||
# and general functions. This file, WriteMemoryGC, is a general function. It
|
||||
# writes a variable-length block of data to a specified address in the client's
|
||||
# memory.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
# For example, to use this function to write the bytes 38 00 00 05 to the
|
||||
# address 8010521C, send_function_call could be called like this:
|
||||
# auto fn = s->function_code_index->name_to_function.at("WriteMemory");
|
||||
# auto fn = s->function_code_index->name_to_function.at("WriteMemoryGC");
|
||||
# unordered_map<string, uint32_t> label_writes(
|
||||
# {{"dest_addr", 0x8010521C}, {"size", 4}});
|
||||
# string suffix("\x38\x00\x00\x05", 4);
|
||||
@@ -52,8 +52,8 @@
|
||||
# when sending the B2 command. This is needed if the server needs to do
|
||||
# something when the B3 response is received. If specified, the index must be in
|
||||
# the range 01-FF. The DOL loading functionality, which this function is a part
|
||||
# of, uses indexes E0, E1, and E2, but the WriteMemory function can also be used
|
||||
# for other purposes.
|
||||
# of, uses indexes E0, E1, and E2, but the WriteMemoryGC function can also be
|
||||
# used for other purposes.
|
||||
.meta index=E1
|
||||
|
||||
# To hide a patch from the Patches menu (so it can only be used with the $patch
|
||||
@@ -0,0 +1,37 @@
|
||||
.meta name="Write memory"
|
||||
.meta description="Writes data to any location in memory"
|
||||
|
||||
entry_ptr:
|
||||
reloc0:
|
||||
.offsetof start
|
||||
|
||||
start:
|
||||
jmp get_block_ptr
|
||||
get_block_ptr_ret:
|
||||
xchg ebx, [esp]
|
||||
mov eax, [ebx]
|
||||
mov ecx, [ebx + 4]
|
||||
add ebx, 8
|
||||
|
||||
again:
|
||||
test ecx, ecx
|
||||
jz done
|
||||
mov dl, [ebx]
|
||||
mov [eax], dl
|
||||
inc ebx
|
||||
inc eax
|
||||
dec ecx
|
||||
jmp again
|
||||
|
||||
done:
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
get_block_ptr:
|
||||
call get_block_ptr_ret
|
||||
dest_addr:
|
||||
.data 0
|
||||
size:
|
||||
.data 0
|
||||
|
||||
data_to_write:
|
||||
Reference in New Issue
Block a user