X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2F940ctl.c;h=66a5d2b9afaafef6f6c0d9817cf5f865a54cc212;hb=a12e01162349cd970e9b6fe5674497760631279b;hp=808e91d9a32f03aa4f5bf53060c2ca6354aa07d4;hpb=6cadc2da0070781cf2d8fcff84265d3ca1f423b9;p=picodrive.git diff --git a/platform/gp2x/940ctl.c b/platform/gp2x/940ctl.c index 808e91d..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; @@ -313,6 +314,12 @@ void YM2612PicoStateLoad_940(void) { int i, old_A1 = addr_A1; + /* make sure JOB940_PICOSTATELOAD gets done before next JOB940_YM2612UPDATEONE */ + add_job_940(JOB940_PICOSTATELOAD); + if (CHECK_BUSY(JOB940_PICOSTATELOAD)) wait_busy_940(JOB940_PICOSTATELOAD); + + writebuff_ptr = 0; + // feed all the registers and update internal state for(i = 0; i < 0x100; i++) { YM2612Write_940(0, i); @@ -324,8 +331,6 @@ void YM2612PicoStateLoad_940(void) } addr_A1 = old_A1; - -// add_job_940(JOB940_PICOSTATELOAD); } @@ -356,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); @@ -405,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); } @@ -595,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); @@ -604,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;