JimB16 / PokePlat

Disassembly of Pokemon Platinum
104 stars 16 forks source link

How edit the assembly #5

Open Halfshadow opened 5 years ago

Halfshadow commented 5 years ago

Hi, I can ask you if you know how edit the ASM? I tried to open the uncompressed HG/SS files but I can't use tools like Crystal tile to see correctly the asm codes like with GBasmEditor for G/S/C.

Do you know the settings with Crystal tile or with another tool to see asms please? I found the (J) slot machines overlay file and I want to try to fix it for localized roms, but tools like notepad ++ just opens the asm files like a hex editor, not else.

JimB16 commented 5 years ago

You can't use tools that were made for the GB games when you want to edit GBA or NDS games. The GB uses Z80 assembler and the later handhelds use ARM assembler in different versions. If you don't want to disassemble whole files then I would try to find the code you want to change in the disassembler of an emulator. You would then have to find that code in the ROM again to change it. I don't know if there's an easier way.

Halfshadow commented 5 years ago

And there isn't a tool to see the ARM assembly correctly for HG/SS? Unfortunately I don't know otherwise how fix the slots overlay to work with localized roms. The overlay file is 77, in the localized roms is only a 20 bytes dummy placeholder... In both (J) and localized roms the graphic is in A/1/2/7 drive, but the file number don't matches, maybe is the reason why don't work if I replace VF with slots overlay, I found only the text group pointer in the 77 overlay (in localized roms the text group is moved by something like 10 positions) and tested the moving only in (J) roms where the overlay works.

Instead the Voltorb flip overlay is 122, in the (J) roms 122 is the localized overlay 123 and the Voltorb flip is missing. The Voltorb flip graphic is in a/2/6/4 and seems compressed.

Otherwise can you please tell me how use the disassembler with the emulator? I would finally fix these slots...

JimB16 commented 5 years ago

You can use No$gba debug version to look at the assembly when it's loaded. It's not as convenient as GBasmEditor since the code of a NDS game is only temporarily at the place in memory where it's executed, unlike on the GB. So you always have to edit the rom with other tools. If you have luck you just have to reinsert the part that they took out of the code to get it working, else it can be a problem since there isn't much memory on the NDS available to add much stuff without moving over things. And imo that's only possible with disassembling and reassembling parts of the game. If you have to add or replace an overlay my already disassembled code here can help, because I found some of the functions that load and run overlays.

Halfshadow commented 5 years ago

And do you know how set a break point to force the debugger to stop and go to the right code area? When I try to set it ask me a code to set the break point, a code that I don't know. I'm not a real programmer, I'm only a hacker, however I finished some hack roms (like G/S/C 2.0) I don't know really assembling, but I'm curious and when I search I find something interesting, I want to try also this time, like I found the text pointer maybe I could also find the other parts to fix...

JimB16 commented 5 years ago

Sorry for the late reply. I can't remember that it wants to know a code. Did you download the free debug version from https://problemkaputt.de/gba.htm? I remember that I had some problems with the emulator actually pausing at the opcode I wanted. That was a breakpoint that was set in Thumb/Arm-mode but executed an opcode of the corresponding other mode.

Halfshadow commented 5 years ago

Here is the situation when I try to set a breakpoint:

[img]https://i.imgur.com/nkGmfXu.jpg[/img]

Or otherwise I'm making something wrong myself. Can you please tell me how use it correctly then? I want to try to discovery something useful.