Friday, July 04, 2008

I see Debug Sessions coming, darker than night itself ...

Well, patching the ARM9 stub when executing another .nds, that works. Fine. But now, i also need to ensure that the stub patches the binary. This is supposed to take place in LoadNDSArm9(), and the DLDIEnabled flag and DLDIStub themselves are found in some "magic" addresses in VRAM that need to match those used by exec.cpp in the calling program.

As far as i can tell, everything should work fine in that regards. I tweaked the stub a bit (yeah, now i manage to compile it properly ;) to make it halt before and after patching ... it all seems right, but for some reason, the freshly downloaded "runme" do not detect the presence of DLDI, nor does it manage to access FAT (of course :P)

// Copy the DLDI patch into the application
- memcpy (pAH, pDH, dldiFileSize);
+ memcpy (pAH, pDH, ddmemSize);
+ printf("%i bytes of driver copied\n",ddmemSize);

Hmm. Fortunately enough, i'm now fluent with diff and other revision control tools, so just checking what changed in my own copy of chishm's DLDI patcher (integrated to runme when it patches the stub) revealed a wrong memcpy that was using 0 bytes (dldiFileSize) instead of the just-computed driver size (ddmemSize). This affects v1.23 as far as i can tell, though i cannot guarantee this isn't just something odd in DSchannels' copy of the DLDI tool, as this is where my stuff comes from.

(this is usually where Beyond Infinity waved his towels in a "GG. Stay Safe.")

*fix*
*compile*
*snip -- getting the SD card out of the R4*
*copying files*
*snap -- pushing the SD card back in the R4*
*can't help to press "start" again and again while the device is booting*
*launching runme*
*updating runme*
*seems to work*
*yeah. indeed, it works ^_^*
*updating again, then launching LEDS, just for fun*

Okay, everything seems fine. So it was "just" my exec_stub.arm9 that was buggy. it's now in the CVS too ...

credits : chishm for the libfat and DLDI patchers -- EyeballKid for DSlurper/happyhttp -- sgstair for the libwifi (of course) -- whoever wrote DSChannels and did not stick his name there -- chishm again for the exec_stub i'm using (as far as i can tell) -- padrinator for non-jumpy stylus input -- wintermute, darkfader and many others working on libnds and devkitpro ;)

*ahem* test ? un deux ? un deux? *broum* Chers amis francophones, bienvenue sur le Blog de Bilou. J'ai l'insigne honneur et l'immense plaisir de vous annoncer qu'au terme d'une longue et fastidieuse semaine de débugging, runme et mes éditeurs de sprite/niveau tournent enfin au maximum de leur possibilités sur le linker R4. J'ai de bonnes raisons de croire que du coup, la compatibilité sur l'ensemble des linkers devrait être améliorée. Merci pour votre attention. A vous les studios. *wiiiit*


edit: oh well, now it seems that SEDS is touch-screen-blind and only recognize "gba" buttons (e.g. it ignores X and Y aswell) when started directly. Launching it through runme still works fine.

edit again: fixed. When you have some interrupt handler checking a "commands" buffer shared between ARM7 and ARM9, better make sure that you initialized the command buffer properly, even if you don't intend to send any commands in your program ^^"

No comments: