X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2F940ctl.c;h=38a9f9dd321c0f6c89bf597937f54ca40da50864;hb=b24e0f6ce6e8a59ba43597520709ca79fa36ff8e;hp=7d7a400d174484b7e6d6c6f9cb01aa25d7de7f21;hpb=991473ad43444428649229a62e7a9cb9f3c7eae2;p=picodrive.git diff --git a/platform/gp2x/940ctl.c b/platform/gp2x/940ctl.c index 7d7a400..38a9f9d 100644 --- a/platform/gp2x/940ctl.c +++ b/platform/gp2x/940ctl.c @@ -11,21 +11,17 @@ #include #include "code940/940shared.h" -#include "gp2x.h" -#include "emu.h" +#include "soc_mmsp2.h" +#include "soc.h" #include "../common/mp3.h" #include "../common/arm_utils.h" #include "../common/menu.h" #include "../common/emu.h" +#include "../common/input.h" #include "../../pico/pico_int.h" #include "../../pico/sound/ym2612.h" #include "../../pico/sound/mix.h" -/* we will need some gp2x internals here */ -extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */ -extern volatile unsigned long *gp2x_memregl; - -extern int reset_timing; static unsigned char *shared_mem = 0; static _940_data_t *shared_data = 0; _940_ctl_t *shared_ctl = 0; @@ -246,7 +242,7 @@ static void internal_reset(void) /* this must be called after mmu hack, the allocated regions must not get cached */ -void sharedmem_init(void) +void sharedmem940_init(void) { if (shared_mem != NULL) return; @@ -269,7 +265,7 @@ void sharedmem_init(void) } -void sharedmem_deinit(void) +void sharedmem940_finish(void) { munmap(shared_mem, 0x210000); munmap(mp3_mem, MP3_SIZE_MAX); @@ -286,8 +282,8 @@ void YM2612Init_940(int baseclock, int rate) printf("YM2612Init_940()\n"); printf("Mem usage: shared_data: %i, shared_ctl: %i\n", sizeof(*shared_data), sizeof(*shared_ctl)); - Reset940(1, 2); - Pause940(1); + reset940(1, 2); + pause940(1); gp2x_memregs[0x3B40>>1] = 0; // disable DUALCPU interrupts for 920 gp2x_memregs[0x3B42>>1] = 1; // enable DUALCPU interrupts for 940 @@ -299,16 +295,11 @@ void YM2612Init_940(int baseclock, int rate) if (crashed_940) { unsigned char ucData[1024]; - int nRead, i, nLen = 0; - char binpath[1024]; + int nRead, nLen = 0; + char binpath[512]; FILE *fp; - strncpy(binpath, g_argv[0], 1023); - binpath[1023] = 0; - for (i = strlen(binpath); i > 0; i--) - if (binpath[i] == '/') { binpath[i] = 0; break; } - strcat(binpath, "/" CODE940_FILE); - + emu_make_path(binpath, CODE940_FILE, sizeof(binpath)); fp = fopen(binpath, "rb"); if(!fp) { @@ -316,6 +307,7 @@ void YM2612Init_940(int baseclock, int rate) text_out16(10, 100, "failed to open required file:"); text_out16(10, 110, CODE940_FILE); gp2x_video_flip2(); + in_menu_wait(PBTN_MOK|PBTN_MBACK, 100); printf("failed to open %s\n", binpath); exit(1); } @@ -347,8 +339,8 @@ void YM2612Init_940(int baseclock, int rate) gp2x_memregl[0x4510>>2] = 0xffffffff; // clear pending IRQs in INTPND /* start the 940 */ - Reset940(0, 2); - Pause940(0); + reset940(0, 2); + pause940(0); // YM2612ResetChip_940(); // will be done on JOB940_YM2612INIT