#167032 - miamicanes - Fri Feb 27, 2009 1:24 am
Suppose you're using Visual Studio 9, use the DrunkenCoders wizard to create a GBA template project, then download PimpMobile's source... what do you do next to get it into a state where your C program can actually USE it?
Is there any Visual Studio/C equivalent to the Netbeans workflow (create a freeform project with existing source, tell it where to find the src directory and build.xml, hunt down any missing thirdparty jarfiles, then just add THAT project to your own & let Netbeans automagically take care of the grunt work for you, from compiling to packaging for distribution)?
At the moment, I'm kind of drowning, because my C is rusty (I used to use CodeWarrior for Palm), the only thing I've ever used Visual Studio for (up to now) is C# for .net & Windows Mobile, and the bulk of my experience with gcc to this point can be summarized as:
(a few light edits)
./build.pl
make
make test
make install
Thanks :-)
#167037 - miamicanes - Fri Feb 27, 2009 7:15 am
Update. I somehow managed to get it to build... probably by doing it completely the wrong way, but here's how:
* created new GBA project using wizard
* created include/ in same directory as created-project's source/ directory
* copied include/pimpmobile.h from the directory where I unzipped PimpMobile to the include/ directory I just created
* copied everything from the unzipped directory's source/ directory to the project's source/ directory
* added them all using Solution Explorer
* commented out the following function in pimp_mixer_portable.c, because the compiler was complaining about a duplicate name:
void __pimp_mixer_clear(s32 *target, u32 samples)
Anyway, I got it to compile, then when I launched it in the emulator, I was greeted by no files in file-system
OK, back to the drawing board. I managed to find gbfs, but I can't figure out how to get the demo dxn-oopk.xm file to link. I got as far as packing dxn-oopk.xm into a .gbfs file, and got the .gbfs file turned into a .s file, but from that point I've hit a wall. All the examples I've found so far either don't compile, or seem to assume it's going to end up in flash rather than multiboot.
So... now I have a .gbfs file, a .s file, and a main class that's trying to find it using fs = find_first_gbfs_file((void*)0x08000000);
If you assume the files are foo.gbfs and foo.s, what changes do I need to make to the source and/or makefile and/or the VS project to get it to work via multiboot?
#167038 - kusma - Fri Feb 27, 2009 10:30 am
I'm sorry, I guess I should have included a binary of the library (libpimpmobile.a) in the distribution. Anyway, if you just build it from the msys prompt, you'll get a correctly built library in the lib-folder. I haven't been using the visual studio template-thingies, so I don't know exactly how to include the library there. Perhaps I could give it a try myself during the week-end.
#167097 - miamicanes - Sun Mar 01, 2009 3:23 am
Cool, I'd really appreciate that! :-)
#167107 - kusma - Sun Mar 01, 2009 1:36 pm
OK, so I managed to build the pimpmobile-example quite easily, with the exception of the GBFS-stuff. That is, I'm at the same point as you were, a ROM that prints "no files in file-system" since a GBFS hasn't been added to the ROM.
Here's what I did:
- Compiled pimpmobile R1 normally from msys. ("make")
- Created a new GBA project in VisualStudio called "test_project"
- Copied the lib- and include-folders into test_project/pimpmobile
- Added "../pimpmobile" to LIBDIRS and "-lpimpmobile -lgba" to LIBS in test_project/Makefile.
- Overwrote main.c with the source code of example.cpp, and ported the code to C (only minor changes needed).
- Compiled and ran the project.
Now, this seems to be how libraries are intended to be used by the build-system of the GBA AppWizard-thingie.
However, I'm not an expert on the appwizard, so I don't know exactly how to make GBFS work. GBFS is not a part of pimpmobile, but the example use it to hide away how to get a pointer to the module and sample bank. You can get away with just incbin'ing (or some kind of bin2c/bin2h/bin2o/bin2s or whatever) the data into your application as well. Just make sure to align the data to 32bit. I should probably make some more examples using different ways of reaching the data for future releases.
You also mentioned something about multiboot - I don't have much experience with multiboot, so I'm probably not the right person to answer those questions. There's not technical reason why pimpmobile shouldn't work with multiboot that I'm aware of.