Advertisement
Guest User

RPGMaker CE

a guest
Jan 18th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. Start CE
  3. Open any process
  4. Rightclick the "value type" combobox
  5. Click "define new custom type (autoassemble)"
  6. Replace the existing script with the script posted here
  7. And click OK
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9.  
  10. alloc(TypeName,256)
  11. alloc(ByteSize,4)
  12. alloc(PreferedAlignment, 4)
  13. alloc(ConvertRoutine,1024)
  14. alloc(ConvertBackRoutine,1024)
  15.  
  16. TypeName:
  17. db 'RPG VX type',0
  18.  
  19. ByteSize:
  20. dd 4
  21.  
  22. PreferedAlignment:
  23. dd 1
  24.  
  25.  
  26. //The convert routine should hold a routine that converts the data to an nteger (in eax)
  27. //function declared as: stdcall int ConvertRoutine(unsigned char *input);
  28.  
  29. //Note: Keep in mind that this routine can be called by multiple threads at the same time.
  30.  
  31. ConvertRoutine:
  32. [32-bit]
  33. push ebp
  34. mov ebp,esp
  35. push ecx
  36. mov ecx,[ebp+8]
  37. [/32-bit]
  38.  
  39. //at this point ecx contains the address where the bytes are stored
  40.  
  41. //put the bytes into the eax register
  42. mov eax,[ecx] //second fun fact, addressing with 32-bit registers doesn't work in 64-bit, it becomes a 64-bit automatically (most of the time)
  43. shr eax,1 //shift right by 1 bit (divide by 2)
  44.  
  45. //and now exit the routine
  46. [64-bit]
  47. ret
  48. [/64-bit]
  49. [32-bit]
  50. pop ecx
  51. pop ebp
  52. ret 4
  53. [/32-bit]
  54.  
  55. //The convert back routine should hold a routine that converts the given integer back to a row of bytes (e.g when the user wats to write a new value)
  56. //function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output);
  57. ConvertBackRoutine:
  58. [32-bit]
  59. push ebp
  60. mov ebp,esp
  61. push edx //save the registers
  62. push ecx
  63. mov edx,[ebp+0c]
  64. mov ecx,[ebp+08]
  65. [/32-bit]
  66.  
  67. //at this point edx contains the address to write the value to
  68. //and ecx contains the value
  69.  
  70. push eax
  71. push edx
  72.  
  73.  
  74. mov edx,[edx] //edx now contains the original value
  75. and edx,1 //only save the first bit
  76.  
  77. mov eax,ecx //eax gets the user input value
  78. shl eax,1 //shift left by 1 bit (multiply by 2)
  79. or eax,edx //add the bits of the original value
  80.  
  81. pop edx
  82. mov [edx],eax //write the new value into the old value
  83. pop eax
  84.  
  85. [64-bit]
  86. //everything is back to what it was, so exit
  87. ret
  88. [/64-bit]
  89.  
  90. [32-bit]
  91. //cleanup first
  92. pop ecx
  93. pop edx
  94. pop ebp
  95. ret 8
  96. [/32-bit]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement