From f1d4eac70016ced41cb5e383e65763187a84b191 Mon Sep 17 00:00:00 2001 From: Warmist Date: Sun, 11 Nov 2012 11:58:43 +0200 Subject: [PATCH] Pre-class remove --- .../luafiles/friendship/friendship.asm | 10 +- .../Dfusion/luafiles/friendship/friendship.o | Bin 722 -> 854 bytes plugins/lua/dfusion/embark.lua | 2 + plugins/lua/dfusion/friendship.lua | 111 ++++++++++++++++++ plugins/lua/dfusion/friendship.o | Bin 0 -> 854 bytes plugins/lua/dfusion/srcs/compile.bat | 1 + plugins/lua/dfusion/srcs/embark.asm | 7 ++ plugins/lua/dfusion/srcs/friendship.asm | 106 +++++++++++++++++ 8 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 plugins/lua/dfusion/friendship.lua create mode 100644 plugins/lua/dfusion/friendship.o create mode 100644 plugins/lua/dfusion/srcs/compile.bat create mode 100644 plugins/lua/dfusion/srcs/embark.asm create mode 100644 plugins/lua/dfusion/srcs/friendship.asm diff --git a/plugins/Dfusion/luafiles/friendship/friendship.asm b/plugins/Dfusion/luafiles/friendship/friendship.asm index e56fe7f49..b649e38de 100644 --- a/plugins/Dfusion/luafiles/friendship/friendship.asm +++ b/plugins/Dfusion/luafiles/friendship/friendship.asm @@ -66,8 +66,10 @@ mov eax, [edi+0x8c] #jmp compare compare: push ecx +mark_racepointer: mov ebx,0xDEADBEEF #write a pointer to the list of allowed races -mov ecx,2000 #write a number of allowed races +mark_racecount: +mov ecx,0xDEADBEEF #write a number of allowed races loop1: cmp word[ebx+ecx*2],ax jz endok @@ -92,11 +94,13 @@ endfinal: pop ebx pop eax -mov [0xFEEDBEEF],eax #write a pointer to safe location (usually after this) +mark_safeloc1: +mov [0xDEADBEEF],eax #write a pointer to safe location (usually after this) pop eax pushfd inc eax #skip one instruction popfd push eax -mov eax,[0xFEEDBEEF] #write a pointer to safe location (same as above) +mark_safeloc2: +mov eax,[0xDEADBEEF] #write a pointer to safe location (same as above) ret diff --git a/plugins/Dfusion/luafiles/friendship/friendship.o b/plugins/Dfusion/luafiles/friendship/friendship.o index f956de3e0a6fce74f63feb2c41a1d07b7a441ec4..c801562dbc1bc9ab11c74929ef422aff7629dcb5 100644 GIT binary patch delta 177 zcmcb_dX0_Ohmn~91VR`Y7$i6H3Ny02-?#SOWEDnbp0)QP<~Ym^SO^vfX1pm4QpWMtiq_w^Y&lF9EZ693*Ya1`)_hEMAX_RACES then + error("race count must be less then "..MAX_RACES) + end + local rarr=self:allocate("race_array",'uint16_t',MAX_RACES) + local _,rarr_offset=df.sizeof(rarr) + self:set_marker_dword("racepointer",rarr_offset) + self:set_races(rarr) + self:set_marker_dword("racecount",#self.race_data) + local safe_loc=self:allocate("safe_loc",'uint32_t',1) + local _1,safe_loc_offset=df.sizeof(safe_loc) + self:set_marker_dword("safeloc1",safe_loc_offset) + self:set_marker_dword("safeloc2",safe_loc_offset) + local addr=self:move_to_df() + self:patchCalls(addr) + self.installed=true + end +return _ENV \ No newline at end of file diff --git a/plugins/lua/dfusion/friendship.o b/plugins/lua/dfusion/friendship.o new file mode 100644 index 0000000000000000000000000000000000000000..c801562dbc1bc9ab11c74929ef422aff7629dcb5 GIT binary patch literal 854 zcmeZaWM%+?5JmI3a0tG+rTticRPp<-2Hyv+Iu@eM4F|GH&Y3hXYaMV#5$~(mYI_Z_29q%3=HXvX^Gh|0jPLZZb3;>4g&)x zkPi%c1~!JG)O2T%WIVEn3rHj%S;Pq>l8z!00OXY;i?{}RGBDJmh`0bn+L1*ZfgFZl zxJX)JCeSqu4C~<{$@#ejiAAXly>JnbJPQ!_p@@hAd6VHHIr;eohCtp7xJYVVN`5ww zw-Q+-Ei*4MXB%7u$Y4+b;vFa=MnK*nxCnBp1cewgBPd;>0^}6Q1e9V1DMSOvsS%X+ uv8izYisvR4WycpKCZ`tUXXcfp79j+Z^GoweAl%}_wA7sZWJ4655d#3LE~Ebd literal 0 HcmV?d00001 diff --git a/plugins/lua/dfusion/srcs/compile.bat b/plugins/lua/dfusion/srcs/compile.bat new file mode 100644 index 000000000..e084949f4 --- /dev/null +++ b/plugins/lua/dfusion/srcs/compile.bat @@ -0,0 +1 @@ +as -anl --32 -o friendship.o friendship.asm \ No newline at end of file diff --git a/plugins/lua/dfusion/srcs/embark.asm b/plugins/lua/dfusion/srcs/embark.asm new file mode 100644 index 000000000..d2fa91081 --- /dev/null +++ b/plugins/lua/dfusion/srcs/embark.asm @@ -0,0 +1,7 @@ +.intel_syntax +mov eax , [esp+0x1C] # loop counter +mark_caste: +movsx ecx, word ptr[eax*2+0xdeadbeef] +mark_race: +movzx eax,word ptr [eax*2+0xDEADBEEF] +ret diff --git a/plugins/lua/dfusion/srcs/friendship.asm b/plugins/lua/dfusion/srcs/friendship.asm new file mode 100644 index 000000000..b649e38de --- /dev/null +++ b/plugins/lua/dfusion/srcs/friendship.asm @@ -0,0 +1,106 @@ +.intel_syntax +push eax +mov eax,[esp+0x04] +push ebx +pushfd +mov eax,[eax] # get a byte after the call this procedure to analyze what register holds cr ptr +jmptbl: +cmp al,0x81 +jz regC +cmp al,0x82 +jz regD +cmp al,0x83 +jz regB +cmp al,0x85 +jz regBP +cmp al,0x86 +jz regESI +cmp al,0x87 +jz regEDI +cmp al,0x88 +jz regA +cmp al,0x8A +jz regD +cmp al,0x8B +jz regB +cmp al,0x8D +jz regBP +cmp al,0x8E +jz regESI +cmp al,0x8F +jz regEDI +cmp al,0x90 +jz regA +cmp al,0x91 +jz regC +cmp al,0x93 +jz regB +cmp al,0x95 +jz regBP +cmp al,0x96 +jz regESI +cmp al,0x97 +jz regEDI +jmp fail +regA: +mov eax, [esp+0x8] +mov eax, [eax+0x8c] +jmp compare +regC: +mov eax, [ecx+0x8c] +jmp compare +regB: +mov eax, [ebx+0x8c] +jmp compare +regD: +mov eax, [edx+0x8c] +jmp compare +regBP: +mov eax, [ebp+0x8c] +jmp compare +regESI: +mov eax, [esi+0x8c] +jmp compare +regEDI: +mov eax, [edi+0x8c] +#jmp compare +compare: +push ecx +mark_racepointer: +mov ebx,0xDEADBEEF #write a pointer to the list of allowed races +mark_racecount: +mov ecx,0xDEADBEEF #write a number of allowed races +loop1: +cmp word[ebx+ecx*2],ax +jz endok +dec ecx +cmp ecx ,-1 +jnz loop1 +pop ecx +popfd +jmp fail +endok: +pop ecx +popfd +cmp eax,eax +jmp endfinal +fail: + +xor ebx,ebx +xor eax,eax +inc eax +cmp eax,ebx +endfinal: + +pop ebx +pop eax +mark_safeloc1: +mov [0xDEADBEEF],eax #write a pointer to safe location (usually after this) +pop eax +pushfd +inc eax #skip one instruction +popfd +push eax +mark_safeloc2: +mov eax,[0xDEADBEEF] #write a pointer to safe location (same as above) +ret