gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > libfat 1.0.3 and desmume woes

#165484 - Quirky - Mon Dec 22, 2008 10:18 pm

Has anyone had any luck with the new version of libfat together with the recent versions of desmume? fatInitDefault() returns false for me. I use the --cflash=desmume_disk.image approach for testing stuff.

I've tried with and without DLDI patching, with the fcsr.dldi, no luck either. On the last libfat release and the same version of the code and same versions of desmume (I've tried r1060, r1157-ish and r1212 from desmume's svn) non-complex use of libfat was ok, i.e. opening files, reading and writing, etc. no directory stuff.

Is it likely that changes to libfat and/or dkp r24 have broken fat support in desmume?

#165485 - elhobbs - Mon Dec 22, 2008 10:33 pm

desmume emulates a GBAMP. The new libfat no longer has the default drivers builtin so it does require manual dldi patching.

#165486 - Quirky - Mon Dec 22, 2008 10:38 pm

FFS, I've done it again. Seems the solution to all my DS problems is to post here, then I will immediately discover what I've screwed up!!

After debugging desmume, turned out the address passed to the cflash_read fn was 9000100. "Hmm, odd" I thought, "that's not in the list of setup addresses for GBAMP. GBAMP.... maybe I should use that instead of the flash cart sram dldi". Lo and behold, that fixed the problem.

So, for the record that's:

1. Compile the file.nds
2. Patch with GBA Movie Player (Compact Flash) from here: dlditool mpcf.dldi file.nds
3. Make a fat image:dd if=/dev/zero of=image bs=1048576 count=128 && mkdosfs -F16 image && mount -o loop image mount_point && cp $files mount_point
4. Run emu: desmume --cflash=image file.nds
5. ???
6. Profit

edit: thx elhobbs, was writing post v slowly when you replied :-)

#165566 - Quirky - Sun Dec 28, 2008 12:35 am

I've not gone completely senile yet, there's a bug in desmume too. r1196 broke libfat support (I :heart: git bisect). In particular, the MMU.cpp file has vital calls to cflash_read and cflash_write commented out.

Luckily the fix is easy! Just remove those #if 0 and recompile.

#165575 - shash - Sun Dec 28, 2008 3:31 pm

I just applied a patch that fixed the issue, which was just submitted to our bug database, so it should be ok from SVN as of now :)
_________________
http://shashemudev.blogspot.com

#165576 - Quirky - Sun Dec 28, 2008 5:34 pm

Yep, just tried it and works great again.