X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Femu.c;h=c8c4f8a2c2fa0589c2c76983e74fd00255926f8d;hb=b67ef287e73ed2c8e92a1d8fa53aac7d58998d37;hp=cdb69b75461a36d7c2f231e4dea47971234c508e;hpb=860c6322c346c8e2ec2a4626e79f26d8b0d23777;p=picodrive.git diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index cdb69b7..c8c4f8a 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -21,8 +21,9 @@ #include "asmutils.h" #include "cpuctrl.h" -#include "Pico/PicoInt.h" -#include "zlib/zlib.h" +#include +#include +#include #ifdef BENCHMARK @@ -229,6 +230,8 @@ int emu_ReloadRom(void) return 0; } + PicoPatchUnload(); + // check for movie file if(movie_data) { free(movie_data); @@ -269,6 +272,16 @@ int emu_ReloadRom(void) } get_ext(romFileName, ext); } + else if (!strcmp(ext, ".pat")) { + int dummy; + PicoPatchLoad(romFileName); + dummy = try_rfn_cut() || try_rfn_cut(); + if (!dummy) { + sprintf(menuErrorMsg, "Could't find a ROM to patch."); + return 0; + } + get_ext(romFileName, ext); + } // check for MegaCD image cd_state = cd_check(ext, &used_rom_name); @@ -351,6 +364,11 @@ int emu_ReloadRom(void) strncpy(currentConfig.lastRomFile, romFileName, sizeof(currentConfig.lastRomFile)-1); currentConfig.lastRomFile[sizeof(currentConfig.lastRomFile)-1] = 0; + if (PicoPatches) { + PicoPatchPrepare(); + PicoPatchApply(); + } + // additional movie stuff if(movie_data) { if(movie_data[0x14] == '6') @@ -424,8 +442,6 @@ static void romfname_ext(char *dst, const char *prefix, const char *ext) dst[511-8] = 0; if (dst[strlen(dst)-4] == '.') dst[strlen(dst)-4] = 0; if (ext) strcat(dst, ext); - - printf("romfname_ext: %s\n", dst); } @@ -973,9 +989,9 @@ void emu_forced_frame(void) PicoOpt = po_old; if (!(Pico.video.reg[12]&1)) { - vidCpyM2 = vidCpyM2_40col; + vidCpyM2 = vidCpyM2_32col; clearArea(1); - } else vidCpyM2 = vidCpyM2_32col; + } else vidCpyM2 = vidCpyM2_40col; vidCpyM2((unsigned char *)gp2x_screen+320*8, framebuff+328*8); vidConvCpyRGB32(localPal, Pico.cram, 0x40); @@ -1369,8 +1385,10 @@ int emu_SaveLoadGame(int load, int sram) // make save filename saveFname = emu_GetSaveFName(load, sram, state_slot); if (saveFname == NULL) { - strcpy(noticeMsg, load ? "LOAD FAILED (missing file)" : "SAVE FAILED "); - gettimeofday(¬iceMsgTime, 0); + if (!sram) { + strcpy(noticeMsg, load ? "LOAD FAILED (missing file)" : "SAVE FAILED "); + gettimeofday(¬iceMsgTime, 0); + } return -1; }