Advertisement
Guest User

Lunar_Legend.txt

a guest
Feb 14th, 2015
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. Hmm mmm hmm... Black Screen of Despair... Kill it...
  2.  
  3. It seems to get stuck in a loop. It's still executing opcodes, but it's just stuck. The relevant PCs are:
  4.  
  5. ===============================
  6. 0x8017054
  7. 0x8017056
  8. 0x8017058
  9. 0x801705a
  10. 0x801705c
  11. 0x801705e
  12. 0x8017060
  13. 0x8017062
  14. ===============================
  15.  
  16. *Do working emulators even touch this code?
  17. *If so, what values does the code expect, and what do the emulators give that I don't?
  18. *If not, where do things break down? Where does it jump to invalid code?
  19.  
  20. -Can confirm, this is invalid code!
  21.  
  22. -0x08010e00 is a known good point. From there, it only goes south.
  23.  
  24. -Okay, the issue is that GBE+ jumps @ 0x8010E06 0xE1AD, Branch 0x8011164. It should never hit this code during boot.
  25. -The game runs LSL R0, R0, 0x10, then CMP R0, 0x0 and expect them to be equal.
  26. -It works alright in GBE+ until some stupid, crazy value is set for R0
  27.  
  28. *What is the crazy, stupid value?
  29. -It appears to be 0x80ff0000 after the shift, so the value is originally 0x80FF
  30.  
  31. *When does GBE+ set R0 to 0x80FF?
  32. - @ 0x8056804 0x4801, LDR R0 0x80FF. GBE+ misses the BCC right above it
  33. -Prior to this, it read the value at [0x3005C00], which should be 0x87F811C, then it reads [0x87F811C + 4] which should give a result of 0x400.
  34. -GBE+ read from [0x087f8110 + 4] and gives a value of 0x40. R3 counts up
  35.  
  36. *When is [0x3005C00] set to 0x87F811C?
  37. - @ 0x8056628 0x6008 STR R0, R1. GBE runs this code, however, it seems it later sets [0x3005C00] to 0x087F8110 (because R0 not equal to 0x40, BNE @ 0x8056622)
  38.  
  39.  
  40. 1st iteration of 0x8056628, GBE+ sets R3 to 0x7FFF.
  41. This should be rest by VBlank interrupt.
  42. MAJOR problem, after VBlankIntrWait SWI @ 0x8056600, GBE+ seemingly passes up the BX R14 opcode!!
  43. The LR register should be 1 instruction size shorter!
  44. This prevented the game from booting, wow
  45.  
  46.  
  47. ==================================================
  48.  
  49. I killed the black screen of despair, but enemies abound... the game won't get past the New Game state (not often anyway).
  50. Before that, let's checkout an out-of-bounds write near the intro
  51.  
  52.  
  53. ==================
  54. Out of bounds write : 0x430055d7
  55. Out of bounds write : 0x430055d6
  56. Out of bounds write : 0x430055d5
  57. Out of bounds write : 0x430055d4
  58. ==================
  59.  
  60. *Why does this happen in GBE+?
  61. *Does it happen in other emulators?
  62. *If not, how to fix it?
  63.  
  64. -Set at 0x300184C, ADDS, R5, R5, 0x40000000
  65.  
  66.  
  67. =========================================================
  68. -So, I somewhat fixed the out-of-bounds write, at least I changed it. It now writes
  69.  
  70. ==================
  71. Out of bounds write : 0x830055af
  72. Out of bounds write : 0x830055ae
  73. Out of bounds write : 0x830055ad
  74. Out of bounds write : 0x830055ac
  75. ==================
  76.  
  77. -Here's the theory. These are all supposed to be writes to Fast WRAM. If you drop the first 4 MSBs, you get an address that pretty much lines up with that address space.
  78. -Some instruction is probably messing with the top 4 MSBs, causing shit to happen.
  79. -No other emulators report out-of-bounds writes here at this time, so the fault is on GBE+
  80. -It seems I may be onto something. Observe that at 0x3001850 it executes the following:
  81. -ARM_9 : 0xe4856004
  82. -R5 seems to be the dest. addr. and it equals 0x830055b0 after a certain time. However, it correctly write to WRAM before a certain point.
  83. -After some event, it looks like it adds 0x40000000 to R5 twice.
  84.  
  85. -@ 0x3001848, the game executes ARM 5 -> 0xe2955101. Perhaps this is a decoding error? What do other emus do at this point?
  86.  
  87. -That's right before shit hits the fan. Crap. Closer analysis shows my thoughts yesterday were spot on! LR is incorrectly set, so it skips one instruction (in this case, an ADDS R5, R5, 0x40000000 instruction), and goes straight to the BCC! Here's the thing. The way GBE+ is set up, only ARM code seems to suffer from this error! Yikes...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement