Advertisement
Gamestabled

wip

Aug 8th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. #include "z3d.h"
  2. #include "advance.h"
  3.  
  4. vec3 pos;
  5. uint16_t angle;
  6.  
  7. advance_ctx_t advance_ctx = {};
  8. advance_input_t inputs = {};
  9. uint8_t advance_init;
  10.  
  11. void scan_inputs() {
  12. inputs.cur.val = real_hid.pad.pads[real_hid.pad.index].curr.val;
  13. inputs.pressed.val = (inputs.cur.val) & (~inputs.old.val);
  14. inputs.up.val = (~inputs.cur.val) & (inputs.old.val);
  15. inputs.old.val = inputs.cur.val;
  16. }
  17.  
  18. void advance_main() {
  19.  
  20. scan_inputs();
  21. if(inputs.pressed.d_left){
  22. pos = link.pos_1;
  23. //angle = ANGLE //todo
  24. }
  25.  
  26. scan_inputs();
  27. if(inputs.pressed.d_right){
  28. link.pos_1 = pos;
  29. link.pos_2 = pos;
  30. //ANGLE = angle //todo
  31. }
  32.  
  33. }
  34.  
  35.  
  36. ------------------------------------------------------------------------
  37.  
  38.  
  39. #ifndef Z3D_H
  40. #define Z3D_H
  41.  
  42. #include "hid.h"
  43.  
  44. typedef void* (*memcpy_proc) (void* dst, void* src, uint32_t size);
  45.  
  46. #if Z3D == MM3D
  47.  
  48. #define real_hid_addr 0x10002000
  49. #define hid_ctx_addr 0x007b2d30
  50. #define z3d_rupee_addr 0x00775318
  51. #define memcpy_addr 0x001f28e8
  52.  
  53. #elif Z3D == OOT3D
  54.  
  55. #define real_hid_addr 0x10002000
  56. #define hid_ctx_addr 0x005AEC58
  57. #define z3d_rupee_addr 0x005879A0
  58. #define memcpy_addr 0x00371738
  59.  
  60. #endif
  61.  
  62. #define real_hid (*(hid_mem_t *) real_hid_addr)
  63. #define hid_ctx (*(hid_ctx_t *) hid_ctx_addr)
  64. #define memcpy ((memcpy_proc) memcpy_addr)
  65. #define z3d_rupee (*(uint16_t *)z3d_rupee_addr)
  66.  
  67. typedef struct
  68. {
  69. uint16_t magic;
  70. uint16_t free;
  71. uint32_t size;
  72. struct heap_node_t* next;
  73. struct heap_node_t* prev;
  74. } heap_node_t;
  75.  
  76. typedef struct
  77. {
  78. float x;
  79. float y;
  80. float z;
  81. } vec3;
  82.  
  83.  
  84. typedef struct
  85. {
  86. uint32_t ukn1; //0x0
  87. uint32_t ukn2; //0x4
  88. vec3 pos_1; //0x8, 0xc, 0x10
  89. uint32_t ukn3; //0x14
  90. uint32_t ukn4; //0x18
  91. uint32_t ukn5; //0x1c
  92. uint32_t ukn6; //0x20
  93. uint32_t ukn7; //0x24
  94. vec3 pos_2; //0x28, 0x2c, 0x30
  95.  
  96. } actor_t;
  97.  
  98. #define actor_heap_begin_addr_maybe 0x005a2E3C
  99. //#define link_addr ((*((void**)actor_heap_begin_addr_maybe)) + sizeof(heap_node_t)) //should always be 0x908f5010 but that is more slightly more proper
  100. #define link_addr 0x098f5010
  101.  
  102. #define link (*((actor_t *)link_addr))
  103.  
  104. #endif //Z3D_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement