Advertisement
entrpntr

IGT0 cycle fuckery

Sep 16th, 2016
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. [5:28 PM] Dabomstew: i think IGT has to overflow on the frame that the game starts loading a map
  2. [5:28 PM] Dabomstew: which in this case is the first map off load
  3. [5:32 PM] entrpntr: that would explain why it starts failing on random floors
  4. [5:33 PM] gifvex: and always fails on same random floors with same save
  5. [5:33 PM] Dabomstew: the game disables the lcd every time it loads a map, which throws off the interrupt timing cycle
  6. [5:38 PM] Dabomstew: here's my theory
  7. 1) delayframes x20 are called before LoadMap is started (this number might be different for loading maps after the first, but it's also irrelevant)
  8. 2) after the 20th vblank interrupt is done, it returns to the function and starts with LoadMap
  9. 3) LoadMap calls DisableLCD soon enough that it's still on the same vblank, so cycles are still offset by the IGT overflow code
  10. 4) Because of the cycle offset, we exit DisableLCD's wait loop 4 cycles later [or earlier or w/e it is]
  11. 5) One last vblank interrupt is triggered IMMEDIATELY when the game re-enables vblank interrupt at the end of DIsableLCD, despite lcd being off. This is also offset by 4 cycles
  12. 6) GG
  13.  
  14. [5:41 PM] Dabomstew: state 2 enters DisableLCD at 2388CF2, exits waitloop at 023906CE and triggers vblank at 023906F4
  15. state 1 enters DisableLCD at 02388D16 (+24h), exits waitloop at 023906D2 (+04h) and triggers vblank at 023906F8 (+04h)
  16. [5:42 PM] Dabomstew: i havent investigated whether we get fucked if the phantom vblank is the one to overflow the IGT
  17. [5:42 PM] Dabomstew: going to check that now
  18. [5:44 PM] Dabomstew: state2 enablelcd 023CA7E2 nextvblank 023D2840
  19. state2 modified to overflow in the phantom vblank: enablelcd 023CA806 (+24h) vblank 023D2864 (+24h)
  20. [5:44 PM] Dabomstew: so yeah 1/30 to get fucked
  21. [6:00 PM] Dabomstew: there are 2 "frames" where the overflow fucks you
  22.  
  23. 1st frame overflow (IGT0 = 37f):
  24. > overflow frames only - 4 cycle offset
  25. > overflow frames and seconds - 8 cycle offset
  26.  
  27. 2nd frame overflow (IGT0 = 36f):
  28. > overflow frames only - 24 cycle offset
  29. > overflow frames and seconds - 48? cycle offset
  30.  
  31. [6:00 PM] Dabomstew: not actual ingame frames necessarily, but calls to vblank and subsequently the IGT incrementer
  32. [6:01 PM] Dabomstew: the second is far more drastic than the first, one would think
  33. [6:01 PM] Dabomstew: but either has the potential to be devastating
  34. [6:03 PM] Dabomstew: none of that is guaranteed at all, but I would imagine the first one is more likely to have a more similar outcome to the "non-fucked" situation, yes
  35. [6:03 PM] Dabomstew: the only part I know for certain is the number of cycles things are offset by
  36. [6:03 PM] Dabomstew: and why it happens
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement