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 write support in emulators

#144124 - nornagon - Mon Oct 29, 2007 11:08 am

Hi all,

I've been working on a game engine for a roguelike, and I'm now almost ready to start developing a game with it. The only piece of the puzzle I'm missing is serialisation, for purposes of storing visited levels (as they will be too big and too numerous to fit in RAM). All's well and good, I'll just serialise to a save file on the cart with libfat. But wait - how do I then test my code in an emulator?

I hear DeSmuME supports the 'mounting' of a FAT image via --cflash, which is fine. The only problem: DeSmuME is kinda slow. Is there any way to mount a FAT image under no$gba? Or have it directly access the filesystem?

Write support is imperative.

Thanks.

#144126 - tepples - Mon Oct 29, 2007 12:44 pm

Separate the graphics engine into its own library. Develop a version of your program for the Allegro library in parallel, and compile it with MinGW. Then you can test the parts of the game logic that depend on file system access on a PC.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#144131 - M3d10n - Mon Oct 29, 2007 1:05 pm

Tepples is right. Serialization and filesystem access will behave the same both on a NDS and on a PC, so the extra debugging features are worth the trouble.

You don't need to accurately simulate the DS features for your PC build. Just put your main rendering code behind some high-level functions and re-implement those on the PC with the minimum necessary functionality required to test and debug the game logic.

#144195 - nornagon - Tue Oct 30, 2007 2:38 am

I've been planning to do that anyway, but I hadn't planned on doing it yet. Do you have any example projects with a build system set up to handle this?

#144200 - M3d10n - Tue Oct 30, 2007 3:22 am

I'm just beginning to use such scheme myself. I'm using VC++ 2005 Express with two projects.

The DS binary is compiled using a makefile project (which forwards all the compiling work to make).

I have a VC project for the PC build (a WIN32 app) which uses many source files from the same folder as the DS build. I'm using #ifdef's to switch include headers based on build type (ARM9 for DS and WIN32 for PC).

#144204 - nornagon - Tue Oct 30, 2007 3:37 am

I guess I could write a second makefile or something. Things get trickier when I start doing things like running game code on the arm7 as well as the arm9. I think DeSmuME is the nicer option.

Just so you know, I run linux.

#144207 - tepples - Tue Oct 30, 2007 4:23 am

I wrote custom makefiles for the PC, GBA, and DS versions of Lockjaw so that I wouldn't get the behavior of always compiling and linking every source code file in the folder, including ones that don't apply at all to the platform that I'm compiling for at a given moment.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.