mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 14:57:46 -04:00
patch/gg support, 1.201 release
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@58 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
dccc2bd01c
commit
70d2ecc5eb
5 changed files with 87 additions and 7 deletions
|
@ -38,7 +38,8 @@ OBJS += main.o menu.o fonts.o gp2x.o usbjoy.o emu.o squidgehack.o asmutils.o cpu
|
|||
OBJS += 940ctl.o
|
||||
# Pico
|
||||
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory.o ../../Pico/Misc.o \
|
||||
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o
|
||||
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \
|
||||
../../Pico/Patch.o
|
||||
# Pico - CD
|
||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
||||
|
|
22
gp2x/emu.c
22
gp2x/emu.c
|
@ -21,8 +21,9 @@
|
|||
#include "asmutils.h"
|
||||
#include "cpuctrl.h"
|
||||
|
||||
#include "Pico/PicoInt.h"
|
||||
#include "zlib/zlib.h"
|
||||
#include <Pico/PicoInt.h>
|
||||
#include <Pico/Patch.h>
|
||||
#include <zlib/zlib.h>
|
||||
|
||||
|
||||
#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')
|
||||
|
|
64
gp2x/menu.c
64
gp2x/menu.c
|
@ -17,8 +17,9 @@
|
|||
#include "usbjoy.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "Pico/PicoInt.h"
|
||||
#include "zlib/zlib.h"
|
||||
#include <Pico/PicoInt.h>
|
||||
#include <Pico/Patch.h>
|
||||
#include <zlib/zlib.h>
|
||||
|
||||
#ifndef _DIRENT_HAVE_D_TYPE
|
||||
#error "need d_type for file browser
|
||||
|
@ -391,6 +392,54 @@ static char *romsel_loop(char *curr_path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
// ------------ patch/gg menu ------------
|
||||
|
||||
static void draw_patchlist(int sel)
|
||||
{
|
||||
int start, i, pos;
|
||||
|
||||
start = 12 - sel;
|
||||
|
||||
gp2x_pd_clone_buffer2();
|
||||
|
||||
for (i = 0; i < PicoPatchCount; i++) {
|
||||
pos = start + i;
|
||||
if (pos < 0) continue;
|
||||
if (pos > 23) break;
|
||||
gp2x_smalltext8_lim(14, pos*10, PicoPatches[i].active ? "ON " : "OFF", 3);
|
||||
gp2x_smalltext8_lim(14+6*4, pos*10, PicoPatches[i].name, 53-5);
|
||||
}
|
||||
pos = start + i;
|
||||
if (pos < 24) gp2x_smalltext8_lim(14, pos*10, "done", 4);
|
||||
|
||||
gp2x_text_out8(5, 120, ">");
|
||||
gp2x_video_flip2();
|
||||
}
|
||||
|
||||
|
||||
void patches_menu_loop(void)
|
||||
{
|
||||
int menu_sel = 0;
|
||||
unsigned long inp = 0;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
draw_patchlist(menu_sel);
|
||||
inp = wait_for_input(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_L|GP2X_R|GP2X_B|GP2X_X);
|
||||
if(inp & GP2X_UP ) { menu_sel--; if (menu_sel < 0) menu_sel = PicoPatchCount; }
|
||||
if(inp & GP2X_DOWN) { menu_sel++; if (menu_sel > PicoPatchCount) menu_sel = 0; }
|
||||
if(inp &(GP2X_LEFT|GP2X_L)) { menu_sel-=10; if (menu_sel < 0) menu_sel = 0; }
|
||||
if(inp &(GP2X_RIGHT|GP2X_R)) { menu_sel+=10; if (menu_sel > PicoPatchCount) menu_sel = PicoPatchCount; }
|
||||
if(inp & GP2X_B) { // action
|
||||
if (menu_sel < PicoPatchCount)
|
||||
PicoPatches[menu_sel].active = !PicoPatches[menu_sel].active;
|
||||
else return;
|
||||
}
|
||||
if(inp & GP2X_X) return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ------------ savestate loader ------------
|
||||
|
||||
static void menu_prepare_bg(void);
|
||||
|
@ -1106,6 +1155,8 @@ static void draw_menu_root(int menu_sel)
|
|||
gp2x_text_out8(tl_x, (y+=10), "Configure controls");
|
||||
gp2x_text_out8(tl_x, (y+=10), "Credits");
|
||||
gp2x_text_out8(tl_x, (y+=10), "Exit");
|
||||
if (PicoPatches)
|
||||
gp2x_text_out8(tl_x, (y+=10), "Patches / GameGenie");
|
||||
|
||||
// draw cursor
|
||||
gp2x_text_out8(tl_x - 16, tl_y + menu_sel*10, ">");
|
||||
|
@ -1133,6 +1184,7 @@ static void menu_loop_root(void)
|
|||
}
|
||||
|
||||
if (rom_data) menu_sel = menu_sel_min = 0;
|
||||
if (PicoPatches) menu_sel_max = 9;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
@ -1199,6 +1251,14 @@ static void menu_loop_root(void)
|
|||
case 8: // exit
|
||||
engineState = PGS_Quit;
|
||||
return;
|
||||
case 9: // patches/gg
|
||||
if (rom_data && PicoPatches) {
|
||||
patches_menu_loop();
|
||||
PicoPatchApply();
|
||||
strcpy(menuErrorMsg, "Patches applied");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
menuErrorMsg[0] = 0; // clear error msg
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#define VERSION "1.20"
|
||||
#define VERSION "1.201"
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ LDFLAGS += `pkg-config --libs gthread-2.0`
|
|||
OBJS += ../gp2x/main.o ../gp2x/menu.o ../gp2x/fonts.o ../gp2x/emu.o ../gp2x/usbjoy.o blit.o gp2x.o 940ctl_ym2612.o
|
||||
# Pico
|
||||
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory.o ../../Pico/Misc.o \
|
||||
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o
|
||||
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \
|
||||
../../Pico/Patch.o
|
||||
# Pico - CD
|
||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue