Hacking DSTwo Reset code sample files

alidsl said:
Wait... so how is this different

It shows developers how to implement soft resetting on the DS2... I think
biggrin.gif
.
 
Has anybody managed to get this to work? I managed to compile it by fixing some of the bugs (powerON and powerOFF renaming, etc). But when trying to load the nds file through DS_GAME or Moonshell2 I just get two white screens rather than an actual reset. Any thoughts?
 
Aye, thats the idea. I can't get it to work though (trying it out on it's own first, then I was going to write a class for my other projects). The program is compiling fine, and as far as I can tell, it's working. It just doesn't actually reset :/
 
It's supposed to reset to "_dstwo/dstwo.nds" as far as I can tell. The actual loader code appears to be compiled into the "reset_patch.bin" file. That file is then loaded into the ARM7 memory and the program execution is reset to it. That reset_patch.bin then, I presume, reboots to "_dstwo/dstwo.nds". As follows:

memcpy( (char *)0x23fc000,reset_patch_bin,reset_patch_bin_size );
runreset=(void(*)(void))0x23fc000;
runreset();

Obviously, since it's precompiled, it's hard to know if the problem is with their code or my own. I'm using most of the sample file exactly as it was distributed, the only changes are changes I had to make to allow it to compile (I changed PowerON and PowerOFF to PowerOn and PowerOff, I removed the SOUND_CR=0 line, and changed the ARM9 Makefile slightly). I can't imagine any of those changes preventing it from working, but I might be wrong. Which is why I was wondering if anyone else had got it working.

-Edit-

Forgot, I also had to edit out the "clr_cache(&resetAndLoop,0x1000);" line. I'm not sure what the purpose of that is, but it was preventing me from compiling.
 
Hmm...well if it was their code that was wrong then reset2desktop.nds shouldn't work.

Maybe what you're using to compile the source is what's causing the problems, and thus you editing them causes the reset to not function properly.
 
Aye, I thought about that as a possibility. As far as I am aware this is supposed to compile with DevkitPro and libnds, however the incorrectly spelt PowerON etc presumably means a version different to the one I'm using (the latest version I think). The main functions I'm altering have replacements in one way or another, the only thing thats really getting me is this error:

c:/users/andy/documents/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.2/../../../../arm-eabi/lib/thumb/ds_arm9_crt0.o: In function `CIDLoop':
(.init+0x1b8): undefined reference to `__vectors_lma'
c:/users/andy/documents/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.2/../../../../arm-eabi/lib/thumb/ds_arm9_crt0.o: In function `CIDLoop':
(.init+0x1bc): undefined reference to `__vectors_start'
c:/users/andy/documents/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.2/../../../../arm-eabi/lib/thumb/ds_arm9_crt0.o: In function `CIDLoop':
(.init+0x1c0): undefined reference to `__vectors_end'

Which happens when the "spec" files are included. I've no idea what these are for though, so I removed the -spec reference in the Makefile to get it to compile. Perhaps thats the problem?
 
Stormwave said:
Aye, I thought about that as a possibility. As far as I am aware this is supposed to compile with DevkitPro and libnds, however the incorrectly spelt PowerON etc presumably means a version different to the one I'm using (the latest version I think). The main functions I'm altering have replacements in one way or another, the only thing thats really getting me is this error:

c:/users/andy/documents/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.2/../../../../arm-eabi/lib/thumb/ds_arm9_crt0.o: In function `CIDLoop':
(.init+0x1b8): undefined reference to `__vectors_lma'
c:/users/andy/documents/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.2/../../../../arm-eabi/lib/thumb/ds_arm9_crt0.o: In function `CIDLoop':
(.init+0x1bc): undefined reference to `__vectors_start'
c:/users/andy/documents/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.4.2/../../../../arm-eabi/lib/thumb/ds_arm9_crt0.o: In function `CIDLoop':
(.init+0x1c0): undefined reference to `__vectors_end'

Which happens when the "spec" files are included. I've no idea what these are for though, so I removed the -spec reference in the Makefile to get it to compile. Perhaps thats the problem?

Possibly. Was there any comment in the source code as to why they were needed? If there wasn't I would email/PM the supercard team and ask them about it.
 
I'd tried a few other methods beforehand, like bootlib etc. Not tried Chishm's though (wasn't aware of it), any idea where I can get hold of that? Is that what you use for DScovered etc?

That would certainly fix the problem
smile.gif
 
chishm's code was used in hbmenu I think... http://wiki.devkitpro.org/index.php/Homebrew_Menu
The one I used is way out of date now though, its from 2007ish, it works reasonably well, it just doesn't pass argv or soft-reset, but I don't feel the need for soft-reset if the cards firmware is a plain .nds file, just load it.
 
Ah right, I did try the hbmenu earlier. I downloaded the latest version from the svn and tried to compile it. I can't remember what went wrong now, I didn't really persist with it. I've still got it, so I'll have a look back into using that to boot it.
 

Site & Scene News

Popular threads in this forum