Advertisement
flarn2006

Untitled

Dec 13th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Assemble with nasm <http://www.nasm.us/>
  2. bits 32
  3. push ebp
  4. mov ebp,0xDEADBEEF
  5. ; ---------------------------------------------------------
  6. ; Changing anything above here will require modification
  7. ; of the Lua script.
  8. push eax
  9. push ecx
  10. push esi
  11. push edi
  12. mov byte bl,[ebp]
  13. cmp bl,0x01
  14. je SpawnObject
  15. done:
  16. mov bl,0x00
  17. mov byte [ebp],bl
  18. pop edi
  19. pop esi
  20. pop ecx
  21. pop eax
  22. pop ebp
  23. ; The following instructions are from SA2's main code, and
  24. ; need to be here since the jump to this code replaces them
  25. ; in their original location.
  26. push ecx
  27. push ebx
  28. push ebp
  29. push esi
  30. push edi
  31. ; ---------------------------------------------------------
  32. mov ebx,0x77E785
  33. jmp ebx
  34.  
  35. SpawnObject:
  36. mov edi,[ebp+0x01]
  37. mov eax,[ebp+0x05]
  38. mov ecx,[ebp+0x0A]
  39. push dword [ebp+0x09]
  40. mov ebx,0x46F610 ;LoadObject2
  41. call ebx
  42. add esp,0x4
  43. mov [ebp+0x01],eax
  44. mov esi,eax
  45.  
  46. ; At this point, esi points to the ObjectMaster structure
  47. ; Now we'll allocate memory for and fill the SETEntry structure
  48. mov eax,0x20
  49. call AllocMem
  50. mov dword [eax],0
  51. mov dword [eax+0x04],0
  52. mov ebx,[ebp+0x0E]
  53. mov [eax+0x08],ebx
  54. mov ebx,[ebp+0x12]
  55. mov [eax+0x0C],ebx
  56. mov ebx,[ebp+0x16]
  57. mov [eax+0x10],ebx
  58. mov dword [eax+0x12],0
  59. mov dword [eax+0x16],0
  60. mov dword [eax+0x1A],0
  61. mov ecx,eax
  62.  
  63. ; And then allocate the structure to go at OM+0x30
  64. mov eax,0x10
  65. call AllocMem
  66. mov byte [eax],1
  67. mov byte [eax+0x01],0
  68. mov word [eax+0x02],0x8001
  69. mov [eax+0x04],esi
  70. mov [eax+0x08],ecx
  71. mov dword [eax+0x0C],0
  72. mov [esi+0x30],eax
  73.  
  74. ; Fill structure pointed to by 0x34 if present
  75. mov edi,[esi+0x34]
  76. cmp edi,0
  77. je done
  78. mov esi,[ebp+0x0e]
  79. mov [edi+0x14],esi
  80. mov esi,[ebp+0x12]
  81. mov [edi+0x18],esi
  82. mov esi,[ebp+0x16]
  83. mov [edi+0x1c],esi
  84. jmp done
  85.  
  86. AllocMem:
  87. push ecx
  88. mov ebx,0x1D19CAC
  89. mov ecx,[ebx]
  90. push eax
  91. call ecx
  92. add esp,0x04
  93. pop ecx
  94. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement