X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=platform%2Fgp2x%2F940ctl.c;h=66a5d2b9afaafef6f6c0d9817cf5f865a54cc212;hb=a12e01162349cd970e9b6fe5674497760631279b;hp=6c52cca25a561ceae9a423d3022025462b67a445;hpb=d5d119243c9e1086e1e6cb34ea05bfd6ab18c200;p=picodrive.git diff --git a/platform/gp2x/940ctl.c b/platform/gp2x/940ctl.c index 6c52cca..66a5d2b 100644 --- a/platform/gp2x/940ctl.c +++ b/platform/gp2x/940ctl.c @@ -29,7 +29,8 @@ static _940_data_t *shared_data = 0; _940_ctl_t *shared_ctl = 0; unsigned char *mp3_mem = 0; -#define MP3_SIZE_MAX (0x1000000 - 4*640*480) +#define MP3_SIZE_MAX (0x400000 + 0x800000) // 12M +#define CODE940_FILE "pico940.bin" int crashed_940 = 0; @@ -360,7 +361,7 @@ void sharedmem_init(void) shared_data = (_940_data_t *) (shared_mem+0x100000); /* this area must not get buffered on either side */ shared_ctl = (_940_ctl_t *) (shared_mem+0x200000); - mp3_mem = (unsigned char *) mmap(0, MP3_SIZE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x3000000); + mp3_mem = (unsigned char *) mmap(0, MP3_SIZE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0x2400000); if (mp3_mem == MAP_FAILED) { printf("mmap(mp3_mem) failed with %i\n", errno); @@ -409,15 +410,15 @@ void YM2612Init_940(int baseclock, int rate) binpath[1023] = 0; for (i = strlen(binpath); i > 0; i--) if (binpath[i] == '/') { binpath[i] = 0; break; } - strcat(binpath, "/code940.bin"); + strcat(binpath, "/" CODE940_FILE); fp = fopen(binpath, "rb"); if(!fp) { - memset(gp2x_screen, 0, 320*240); - gp2x_text_out8(10, 100, "failed to open required file:"); - gp2x_text_out8(10, 110, "code940.bin"); - gp2x_video_flip(); + memset(gp2x_screen, 0, 320*240*2); + text_out16(10, 100, "failed to open required file:"); + text_out16(10, 110, CODE940_FILE); + gp2x_video_flip2(); printf("failed to open %s\n", binpath); exit(1); } @@ -599,7 +600,6 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 if (loaded_mp3 != f) { - // printf("loading mp3... "); fflush(stdout); if (PicoMessage != NULL) { fseek(f, 0, SEEK_END); @@ -608,8 +608,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 } fseek(f, 0, SEEK_SET); fread(mp3_mem, 1, MP3_SIZE_MAX, f); - // if (feof(f)) printf("done.\n"); - // else printf("done. mp3 too large, not all data loaded.\n"); + if (!feof(f)) printf("Warning: mp3 was too large, not all data loaded.\n"); shared_ctl->mp3_len = ftell(f); loaded_mp3 = f;