Advertisement
fig02

Modifying Chest Contents with SRM

Oct 28th, 2019
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. hypothetical scenario. this is not a valid actor heap address.
  2.  
  3. chest is at 80100000
  4. spawn variable is at actor+0x1C
  5. so spawn variable is at 8010001C
  6.  
  7. the spawn variable is a 2 byte value that is passed into the Spawn_Actor function at spawn time.
  8. this variable can contain verious information about an actor. it uses all 16 bits of this 2 byte number to store that information.
  9. we are interested in the chest contents, which is stored in the bits shown below:
  10.  
  11. spawn var = 0000cccc ccc00000
  12. where c is the contents
  13.  
  14. for more info on spawn variables, see the writeup here: https://wiki.cloudmodding.com/oot/Actor_List_(Variables)#Overview
  15.  
  16. to modify 8010001C directly with the x coordinate (where SRM starts modifying), you would need to be holding spawn variable -0x24
  17. 8010001C - 0x24 = 800FFFF8
  18.  
  19. but since actors on the heap are 10 byte aligned this doesn't work.
  20. so 800FFFF0 will have to do
  21.  
  22. address of held actor is 800FFFF0
  23. with SRM, you would start modifying at 800FFFF0+0x24 = 80100014
  24.  
  25. 4 byte float for x @ 80100014
  26. 4 byte float for y @ 80100018
  27. 4 byte float for z @ 8010001C
  28.  
  29. 32 bit z coordinate lines up with 16 bit spawn variable like so:
  30. zzzz zzzz zzzz zzzz
  31. ssss ssss uuuu uuuu
  32. where z is z coordinate, s is spawn variable, and u is something irrelevant for the chest contents.
  33. note that bad values for u, or the x/y/actor rotation can cause unwanted effects/crashes.
  34.  
  35. this means that the upper 2 bytes of the 4 byte z coordinate float are what is modifying the contents.
  36. specifically these bits shown earlier:
  37. 0000cccc ccc00000 00000000 00000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement