Advertisement
Guest User

King's Field: The Ancient City - Analog Control Patch Unstructured Notes

a guest
Jan 5th, 2022
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.58 KB | None | 0 0
  1. Functions:
  2.  
  3. 001b5460 - ???? Some sort of input state management, changes behavior when paused, entering menus, loading new areas, etc - more importantly, copies controller state to 413DA8
  4. 001b5590 - Convert analog inputs to digital, handle exclusion and priority - many places in the game make decisions based on the digital status of movement, so it's important analog inputs be converted to their digital equivalents here
  5. 001b5a48 - rats nest of a function that processes all digital controls (after analog to digital conversion in the above) - this is where digital movement logic should be replaced with analog logic
  6.  
  7. There seem to be 3 locations that store button state:
  8.  
  9. 01E0DB00 - These two seem to contain inverted button masks but identical axis info?
  10. 01E0DB80
  11. 01E0DC00 - This seems to contain active state?
  12. + 0x20 - Mask for new buttons pressed
  13.  
  14. 01E0DC7E - Some sort of processing disabled? Could also possibly mean the controller is digital only (not DS2)
  15.  
  16. $02 $03
  17.  
  18. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  19. Sq. X Cir. Tri. R1 L1 R2 L2 Left Down Right Up Start R3 L3 Select
  20.  
  21. (20)413DB8 - Effective button state after analog processing
  22. +2 - Effective new buttons pressed after analog processing
  23. +4 - Boolean indicating if input was processed this frame
  24. +6 - ^- ya that's stored as a word ...
  25. +8 - Working space for calculating effective state from right joypad
  26. +a - Working space for calculating effective new buttons pressed from right joypad
  27. +c - Working space for calculating effective state from left joypad
  28. +e - Working space for calculating effective new buttons pressed from left joypad
  29.  
  30. There appears to be a button map at 00446924(ish), half words are stored and used as masks around 1b5cd4
  31.  
  32. Initialized from 0036A161
  33.  
  34. 0044692C = move forward
  35. 0044692E = move backward
  36. 00446930 = turn right
  37. 00446932 = turn left
  38. 00446934 = strafe right
  39. 00446936 = strafe left
  40. 00446938 = look up
  41. 0044693A = look down
  42. 0044693C = square, swing sword
  43. 0044693E = triangle, magic slot
  44. 00446940 = X, run, action
  45. 00446942 = circle, open menu
  46. 00446944 = select, use accessory item
  47. 00446946 = start, pause game
  48.  
  49.  
  50. There is a bug in the game code where looking down immediately cancels right turn deceleration. To fix change the following:
  51.  
  52. Byte 1b856c to "nop" (00000000) from "lwc1 $f0, $01b8(v0)" (c44001b8)
  53. Byte 1b8574 to "c.lt.s $f1, $f2" (46020834) from "c.lt.s $f0, $f2" (46020034)
  54. patch=1,EE,001b8574,word,46020834
  55.  
  56. Magic numbers:
  57.  
  58. 0x1c0 - Possibly the size of a game state struct, often multiplied by integer values to construct a pointer offset
  59.  
  60. These are used in two functions.
  61.  
  62. 002179F8: I believe this is returning a flag to indicate if the game should be processing input at this time
  63.  
  64. byte func(int shift, int offset)
  65. {
  66. // When both inputs are 0 goes to 0x01e0dc7e
  67. return *(0x01e0db00 + (((shift << 2) + offset) * 0x1c0) + 0x17e);
  68. }
  69.  
  70. 00217760:
  71.  
  72. void *func(int shift, int offset)
  73. {
  74.  
  75. return 0x01e0dc00 + (((shift << 2) + offset) * 0x1c0);
  76. }
  77.  
  78. { 0x20413DE0 , "Movement Settings" , 'movement'},
  79.  
  80. movement ={
  81. { 0x00 , "Move Speed Max: %s" , vtSingle, array = 6, name = 'movement' },
  82. { 0x18 , "movement Accel: %s" , vtSingle, array = 6, name = 'movement' }, // 413df8
  83. { 0x30 , "movement Deccel: %s" , vtSingle, array = 6, name = 'movement' }, // 413e10
  84. { 0x48 , "left right turn cap: %s" , vtSingle, array = 6, name = 'movement' }, // 413e28
  85. { 0x60 , "Turn Accel: %s" , vtSingle, array = 6, name = 'movement' }, // 413e40
  86. { 0x78 , "Unknown 0x78?: %s" , vtSingle, array = 6, name = 'movement' }, // 413e58
  87. { 0x90 , "up down look cap: %s" , vtSingle, array = 6, name = 'movement' }, // 413e70
  88. { 0xA8 , "up down accel: %s" , vtSingle, array = 6, name = 'movement' }, // 413e88
  89. { 0xC0 , "Turn Deccel: %s" , vtSingle, array = 6, name = 'movement' }, // 413ea0
  90. { 0xD8 , "Recenter Speed: %s" , vtSingle, array = 6, name = 'movement' }, // 413eb8
  91. { 0xF0 , "Gravity: %s" , vtSingle, array = 6, name = 'movement' }, // 413ed0
  92. },
  93.  
  94. movement={
  95. 'Normal',
  96. 'Ice',
  97. 'Water Surface',
  98. 'Underwater',
  99. 'Lava',
  100. 'unknown(5)',
  101. },
  102.  
  103. { 0x20413F80 , "Player Stats" , 'playerStats'},
  104.  
  105. playerStats ={
  106. { 0x000, "Position%s" , vtSingle, array = 4, name = 'coords' },
  107. { 0x010, "Look Direction Vertical" , vtSingle},
  108. { 0x014, "Look Direction Horizontal" , vtSingle},
  109. { 0x020, "Max HP (Base)" , vtDword },
  110. { 0x024, "Max MP (Base)" , vtDword },
  111. { 0x028, "Max Physical" , vtDword },
  112. { 0x02C, "Max Magical" , vtDword },
  113. { 0x030, "Status Time" , 'statuses' },
  114. { 0x03C, "Equip Weapon" , vtByte, dropdown = 'weapon' },
  115. { 0x03D, "Equip Magic" , vtByte, dropdown = 'spell' },
  116. { 0x03E, "Equip %s" , vtByte, dropdown = 'armor', array=8, name='equipArmorSlot' },
  117. { 0x046, "Equip Shortcut" , vtWord },
  118. { 0x048, "Equip Shortcut Category", vtByte },
  119. { 0x04C, "Gold", vtDword },
  120. { 0x050, "Exp", vtDword },
  121. { 0x054, "Level", vtDword },
  122. { 0x058, "Max HP (Scaled)", vtDword },
  123. { 0x05C, "Max MP (Scaled)", vtDword },
  124. { 0x060, "Weapon Damage" , 'elements' },
  125. { 0x072, "Weapon Status Chance%" , 'statuses' },
  126. { 0x07E, "Defense (Base)" , 'elements' },
  127. { 0x090, "Defense (Scaled)" , 'elements' },
  128.  
  129. { 0x0A4, "Weight Current" , vtDword },
  130. { 0x0A8, "Weight Maximum" , vtDword },
  131. { 0x0AC, "Current Physical" , vtDword },
  132. { 0x0B0, "Current Magical" , vtDword },
  133. { 0x0B4, "Current HP" , vtDword },
  134. { 0x0B8, "Current MP" , vtDword },
  135. { 0x0BC, "Physical Meter" , vtDword },
  136. { 0x0C0, "Magic Meter" , vtDword },
  137. { 0x0C4, "Physical Meter Charge Delay" , vtDword },
  138. { 0x0C8, "Magical Meter Charge Delay" , vtDword },
  139. { 0x0CC, "Breath Time" , vtDword },
  140. { 0x0D0, "Breath Time Max" , vtDword },
  141. { 0x0D4, "Physical XP (100/lvl)" , vtDword },
  142. { 0x0D8, "Magical XP (100/lvl)", vtDword },
  143. { 0x0DC, "Resist Status%", 'statuses' },
  144.  
  145. { 0x1A8, "Player Death Frame" , vtDword },
  146. { 0x1AC, "Velocity Falling Down" , vtSingle },
  147. { 0x1B0, "Velocity Strafe" , vtSingle },
  148. { 0x1B4, "Velocity" , vtSingle },
  149. { 0x1B8, "Velocity Rotate Y" , vtSingle },
  150. { 0x1BC, "Velocity Rotate X" , vtSingle },
  151.  
  152. { 0x1C8, "Condition Flags" , vtQword, hex=true },
  153.  
  154. { 0x200, "Status Time Fall Damage Stumble" , vtDword },
  155.  
  156. { 0x230, "Knockback Magnitude?" , vtSingle },
  157. { 0x234, "Status Time Hit Disorientation" , vtDword },
  158. { 0x238, "Disorientation Look Down" , vtSingle },
  159. { 0x23C, "Disorientation?" , vtSingle },
  160.  
  161. { 0x240, "Push Velocity? %s" , vtSingle, array = 3, name = 'coords' },
  162.  
  163. { 0x25E, "Sword Magic Related?" , vtByte },
  164.  
  165. size = 0x300},
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement