Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Assemble with nasm <http://www.nasm.us/>
- bits 32
- push ebp
- mov ebp,0xDEADBEEF
- ; ---------------------------------------------------------
- ; Changing anything above here will require modification
- ; of the Lua script.
- push eax
- push ecx
- push esi
- push edi
- mov byte bl,[ebp]
- cmp bl,0x01
- je SpawnObject
- done:
- mov bl,0x00
- mov byte [ebp],bl
- pop edi
- pop esi
- pop ecx
- pop eax
- pop ebp
- ; The following instructions are from SA2's main code, and
- ; need to be here since the jump to this code replaces them
- ; in their original location.
- push ecx
- push ebx
- push ebp
- push esi
- push edi
- ; ---------------------------------------------------------
- mov ebx,0x77E785
- jmp ebx
- SpawnObject:
- mov edi,[ebp+0x01]
- mov eax,[ebp+0x05]
- mov ecx,[ebp+0x0A]
- push dword [ebp+0x09]
- mov ebx,0x46F610 ;LoadObject2
- call ebx
- add esp,0x4
- mov [ebp+0x01],eax
- mov esi,eax
- ; At this point, esi points to the ObjectMaster structure
- ; Now we'll allocate memory for and fill the SETEntry structure
- mov eax,0x20
- call AllocMem
- mov dword [eax],0
- mov dword [eax+0x04],0
- mov ebx,[ebp+0x0E]
- mov [eax+0x08],ebx
- mov ebx,[ebp+0x12]
- mov [eax+0x0C],ebx
- mov ebx,[ebp+0x16]
- mov [eax+0x10],ebx
- mov dword [eax+0x12],0
- mov dword [eax+0x16],0
- mov dword [eax+0x1A],0
- mov ecx,eax
- ; And then allocate the structure to go at OM+0x30
- mov eax,0x10
- call AllocMem
- mov byte [eax],1
- mov byte [eax+0x01],0
- mov word [eax+0x02],0x8001
- mov [eax+0x04],esi
- mov [eax+0x08],ecx
- mov dword [eax+0x0C],0
- mov [esi+0x30],eax
- ; Fill structure pointed to by 0x34 if present
- mov edi,[esi+0x34]
- cmp edi,0
- je done
- mov esi,[ebp+0x0e]
- mov [edi+0x14],esi
- mov esi,[ebp+0x12]
- mov [edi+0x18],esi
- mov esi,[ebp+0x16]
- mov [edi+0x1c],esi
- jmp done
- AllocMem:
- push ecx
- mov ebx,0x1D19CAC
- mov ecx,[ebx]
- push eax
- call ecx
- add esp,0x04
- pop ecx
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement