#27577 - gbawiz - Fri Oct 15, 2004 11:26 pm
Hello all,
I am trying to write a MOD player for my GBA projects and have some problems on incorporating the MOD file data into the ROM image.
The method which I have used thus far is to convert the binary MOD file into an object then include this object in compilation.
Then I have created a structure which is supposed to mirror the structure of the file. NOTE that i have set the sample name to 30. I have done this because there are 30 bytes per sample and the name is at the beginning of every sample.
Here is the code:
The problem is that when i scan through the samples, there seems to be data missing, where as the sample number progresses, more of the sample name seems to vanish.
Im not sure what is the best way to load MOD files.
Can anyone help?
Thanks
I am trying to write a MOD player for my GBA projects and have some problems on incorporating the MOD file data into the ROM image.
The method which I have used thus far is to convert the binary MOD file into an object then include this object in compilation.
Then I have created a structure which is supposed to mirror the structure of the file. NOTE that i have set the sample name to 30. I have done this because there are 30 bytes per sample and the name is at the beginning of every sample.
Here is the code:
Code: |
include"gba.h" extern const unsigned char _binary_tunefile_mod_start[]; unsigned char *wram= (u8*)0x2000000; typedef struct sample{ unsigned char name[30]; // i set this to 30 because there are 30 bytes per sample //i just want to try reading sample name first }sampletype; typedef struct mod{ unsigned char song_name[20]; sampletype sam[31]; }modtype; int main() { int n=0; modtype *music=(modtype*)_binary_tunefile_mod_start; for(n=0;n<20;n++)wram[n]=music->song_name[n]; unsigned char *samname=music->sam[1].name; // change this number to move through the samples for(n=0;n<22;n++)wram[n+21]=samname[n]; // displays the information found in the wram memory for viewing } |
The problem is that when i scan through the samples, there seems to be data missing, where as the sample number progresses, more of the sample name seems to vanish.
Im not sure what is the best way to load MOD files.
Can anyone help?
Thanks