From 74e1b42b9256870c7e9f70f5b4ca71ed0e8a63d5 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 2 Jun 2010 09:52:27 +0000 Subject: [PATCH] some pandora tweaks git-svn-id: file:///home/notaz/opt/svn/PicoDrive@878 be3aeb3a-fb24-0410-a615-afba39da0efa --- platform/common/menu.c | 47 +++++++++++++++++++++++++-------------- platform/common/plat.h | 2 +- platform/gizmondo/emu.c | 2 +- platform/gp2x/emu.c | 2 +- platform/linux/emu.c | 2 +- platform/linux/oshide.c | 1 + platform/pandora/Makefile | 13 +++++++++-- platform/pandora/emu.c | 31 +++++++++++++++----------- platform/psp/emu.c | 2 +- platform/win32/plat.c | 2 +- 10 files changed, 66 insertions(+), 38 deletions(-) diff --git a/platform/common/menu.c b/platform/common/menu.c index fdc8e896..39a71b15 100644 --- a/platform/common/menu.c +++ b/platform/common/menu.c @@ -164,7 +164,7 @@ static void smalltext_out16_(int x, int y, const char *texto, int color) static void smalltext_out16(int x, int y, const char *texto, int color) { char buffer[128]; - int maxw = (g_screen_width - x) / 6; + int maxw = (g_screen_width - x) / me_sfont_w; if (maxw < 0) return; @@ -274,7 +274,7 @@ void menu_init(void) memcpy(menu_font_data, menu_font_data + ((int)'>') * me_mfont_w * me_mfont_h / 2, me_mfont_w * me_mfont_h / 2); emu_make_path(buff, "skin/selector.png", sizeof(buff)); - readpng(menu_font_data, buff, READPNG_SELECTOR, MENU_X2 ? 16 : 8, MENU_X2 ? 20 : 10); + readpng(menu_font_data, buff, READPNG_SELECTOR, me_mfont_w, me_mfont_h); // load custom colors emu_make_path(buff, "skin/skin.txt", sizeof(buff)); @@ -413,9 +413,12 @@ static void me_draw(const menu_entry *entries, int sel, void (*draw_more)(void)) wt = col2_offs; switch (ent->beh) { - case MB_NONE: break; + case MB_NONE: + break; case MB_OPT_ONOFF: - case MB_OPT_RANGE: wt += me_mfont_w * 3; break; + case MB_OPT_RANGE: + wt += me_mfont_w * 3; + break; case MB_OPT_CUSTOM: case MB_OPT_CUSTONOFF: case MB_OPT_CUSTRANGE: @@ -694,11 +697,11 @@ static int cdload_called = 0; static void load_progress_cb(int percent) { int ln, len = percent * g_screen_width / 100; - unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2; + unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * me_sfont_h * 2; if (len > g_screen_width) len = g_screen_width; - for (ln = 10 - 2; ln > 0; ln--, dst += g_screen_width) + for (ln = me_sfont_h - 2; ln > 0; ln--, dst += g_screen_width) memset(dst, 0xff, len * 2); plat_video_menu_end(); } @@ -706,7 +709,7 @@ static void load_progress_cb(int percent) static void cdload_progress_cb(const char *fname, int percent) { int ln, len = percent * g_screen_width / 100; - unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * 10 * 2; + unsigned short *dst = (unsigned short *)g_screen_ptr + g_screen_width * me_sfont_h * 2; memset(dst, 0xff, g_screen_width * (me_sfont_h - 2) * 2); @@ -767,8 +770,8 @@ static void do_delete(const char *fpath, const char *fname) menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0); len = strlen(fname); - if (len > g_screen_width/6) - len = g_screen_width/6; + if (len > g_screen_width / me_sfont_w) + len = g_screen_width / me_sfont_w; mid = g_screen_width / 2; text_out16(mid - me_mfont_w * 15 / 2, 8 * me_mfont_h, "About to delete"); @@ -1021,7 +1024,7 @@ static void draw_patchlist(int sel) { int max_cnt, start, i, pos, active; - max_cnt = g_screen_height / 10; + max_cnt = g_screen_height / me_sfont_h; start = max_cnt / 2 - sel; plat_video_menu_begin(); @@ -1031,8 +1034,8 @@ static void draw_patchlist(int sel) if (pos < 0) continue; if (pos >= max_cnt) break; active = PicoPatches[i].active; - smalltext_out16(14, pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff); - smalltext_out16(14+6*4, pos * me_sfont_h, PicoPatches[i].name, active ? 0xfff6 : 0xffff); + smalltext_out16(14, pos * me_sfont_h, active ? "ON " : "OFF", active ? 0xfff6 : 0xffff); + smalltext_out16(14 + me_sfont_w*4, pos * me_sfont_h, PicoPatches[i].name, active ? 0xfff6 : 0xffff); } pos = start + i; if (pos < max_cnt) @@ -1095,7 +1098,7 @@ static void draw_savestate_bg(int slot) PicoStateLoadGfx(fname); /* do a frame and fetch menu bg */ - pemu_forced_frame(POPT_EN_SOFTSCALE); + pemu_forced_frame(POPT_EN_SOFTSCALE, 0); menu_enter(1); PicoTmpStateRestore(tmp_state); @@ -1539,6 +1542,8 @@ static int menu_loop_cd_options(menu_id id, int keys) // ------------ 32X options menu ------------ +#ifndef NO_32X + // convert from multiplier of VClk static int mh_opt_sh2cycles(menu_id id, int keys) { @@ -1591,6 +1596,8 @@ static int menu_loop_32x_options(menu_id id, int keys) return 0; } +#endif + // ------------ adv options menu ------------ static menu_entry e_menu_adv_options[] = @@ -1814,7 +1821,9 @@ static menu_entry e_menu_options[] = mee_range (cpu_clk_name, MA_OPT_CPU_CLOCKS, currentConfig.CPUclock, 20, 900), mee_handler ("[Display options]", menu_loop_gfx_options), mee_handler ("[Sega/Mega CD options]", menu_loop_cd_options), +#ifndef NO_32X mee_handler ("[32X options]", menu_loop_32x_options), +#endif mee_handler ("[Advanced options]", menu_loop_adv_options), mee_cust_nosave("Save global config", MA_OPT_SAVECFG, mh_saveloadcfg, mgn_saveloadcfg), mee_cust_nosave("Save cfg for loaded game",MA_OPT_SAVECFG_GAME, mh_saveloadcfg, mgn_saveloadcfg), @@ -1899,7 +1908,7 @@ static void draw_frame_debug(void) if (PicoDrawMask & PDRAW_32X_ON) memcpy(layer_str + 26, "32x", 4); memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2); - pemu_forced_frame(0); + pemu_forced_frame(0, 0); smalltext_out16(4, 1, "build: r" REVISION " "__DATE__ " " __TIME__ " " COMPILER, 0xffff); smalltext_out16(4, g_screen_height - me_sfont_h, layer_str, 0xffff); } @@ -1924,12 +1933,14 @@ static void debug_menu_loop(void) dumped = 0; } break; - case 1: draw_frame_debug(); break; + case 1: draw_frame_debug(); + break; case 2: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2); - pemu_forced_frame(0); + pemu_forced_frame(0, 1); menu_darken_bg(g_screen_ptr, g_screen_ptr, g_screen_width * g_screen_height, 0); PDebugShowSpriteStats((unsigned short *)g_screen_ptr + (g_screen_height/2 - 240/2)*g_screen_width + - g_screen_width/2 - 320/2, g_screen_width); break; + g_screen_width/2 - 320/2, g_screen_width); + break; case 3: memset(g_screen_ptr, 0, g_screen_width * g_screen_height * 2); PDebugShowPalette(g_screen_ptr, g_screen_width); PDebugShowSprite((unsigned short *)g_screen_ptr + g_screen_width*120 + g_screen_width/2 + 16, @@ -2199,7 +2210,9 @@ static menu_entry *e_menu_table[] = e_menu_gfx_options, e_menu_adv_options, e_menu_cd_options, +#ifndef NO_32X e_menu_32x_options, +#endif e_menu_keyconfig, e_menu_hidden, }; diff --git a/platform/common/plat.h b/platform/common/plat.h index 99557da3..bc48e83a 100644 --- a/platform/common/plat.h +++ b/platform/common/plat.h @@ -11,7 +11,7 @@ void pemu_prep_defconfig(void); void pemu_validate_config(void); void pemu_loop_prep(void); void pemu_loop_end(void); -void pemu_forced_frame(int opts); +void pemu_forced_frame(int opts, int no_scale); void pemu_finalize_frame(const char *fps, const char *notice_msg); void pemu_sound_start(void); diff --git a/platform/gizmondo/emu.c b/platform/gizmondo/emu.c index 2dfcf964..86a5d8c6 100644 --- a/platform/gizmondo/emu.c +++ b/platform/gizmondo/emu.c @@ -294,7 +294,7 @@ static void SkipFrame(void) } /* forced frame to front buffer */ -void pemu_forced_frame(int opts) +void pemu_forced_frame(int opts, int no_scale) { int po_old = PicoOpt; int eo_old = currentConfig.EmuOpt; diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 1f60e161..ad6b59b6 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -730,7 +730,7 @@ void pemu_sound_wait(void) } -void pemu_forced_frame(int opts) +void pemu_forced_frame(int opts, int no_scale) { int po_old = PicoOpt; diff --git a/platform/linux/emu.c b/platform/linux/emu.c index 08421fae..1d9c2bb3 100644 --- a/platform/linux/emu.c +++ b/platform/linux/emu.c @@ -212,7 +212,7 @@ void plat_update_volume(int has_changed, int is_up) { } -void pemu_forced_frame(int opts) +void pemu_forced_frame(int opts, int no_scale) { int po_old = PicoOpt; int eo_old = currentConfig.EmuOpt; diff --git a/platform/linux/oshide.c b/platform/linux/oshide.c index 881fcb77..548315f4 100644 --- a/platform/linux/oshide.c +++ b/platform/linux/oshide.c @@ -186,6 +186,7 @@ static void hidecon_start(void) goto fail; } + g_kbd_termios_saved = kbd_termios; kbd_termios.c_lflag &= ~(ICANON | ECHO); // | ISIG); kbd_termios.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON); kbd_termios.c_cc[VMIN] = 0; diff --git a/platform/pandora/Makefile b/platform/pandora/Makefile index 72cc9f29..0f737777 100644 --- a/platform/pandora/Makefile +++ b/platform/pandora/Makefile @@ -1,6 +1,7 @@ #export CROSS = arm-none-linux-gnueabi- CROSS ?= $(CROSS_COMPILE) LIBROOT = /home/notaz/dev/pnd/libroot +PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh # settings use_cyclone = 1 @@ -18,6 +19,9 @@ asm_cdmemory = 1 #profile = 1 #drc_debug = 3 +no_32x = 1 +no_sms = 1 + -include Makefile.local ifeq "$(use_musashi)" "1" @@ -87,13 +91,18 @@ tidy: $(RM) $(OBJS) readme.txt: ../../tools/textfilter ../base_readme.txt - ../../tools/textfilter ../base_readme.txt $@ GP2X + ../../tools/textfilter ../base_readme.txt $@ PANDORA # ----------- release ----------- ifneq ($(findstring rel,$(MAKECMDGOALS)),) -$(error TODO) ifeq ($(VER),) $(error need VER) endif endif +rel: PicoDrive PicoDrive.run picorestore ../../pico/carthw.cfg readme.txt \ + skin PicoDrive.png PicoDrive_p.png PicoDrive.pxml + rm -rf out + mkdir out + cp -r $^ out/ + $(PND_MAKE) -p PicoDrive_$(VER).pnd -d out -x PicoDrive.pxml -i PicoDrive.png -c diff --git a/platform/pandora/emu.c b/platform/pandora/emu.c index a9556b17..7996a794 100644 --- a/platform/pandora/emu.c +++ b/platform/pandora/emu.c @@ -49,6 +49,7 @@ void pemu_prep_defconfig(void) g_menubg_ptr = temp_frame; defaultConfig.EmuOpt |= EOPT_VSYNC; + defaultConfig.s_PicoOpt |= POPT_EN_MCD_GFX|POPT_EN_MCD_PSYNC; defaultConfig.scaling = SCALE_2x2_3x2; } @@ -113,9 +114,9 @@ static void draw_cd_leds(void) static int emuscan_1x1(unsigned int num) { - DrawLineDest = (unsigned short *)g_screen_ptr + num*800 + 800/2 - 320/2; - //int w = (Pico.video.reg[12]&1) ? 320 : 256; - //DrawLineDest = (unsigned short *)g_screen_ptr + num*w; + DrawLineDest = (unsigned short *)g_screen_ptr + + g_screen_width * g_screen_height / 2 - g_screen_width * 240 / 2 + + num*g_screen_width + g_screen_width/2 - 320/2; return 0; } @@ -250,17 +251,24 @@ void plat_update_volume(int has_changed, int is_up) } } -void pemu_forced_frame(int opts) +void pemu_forced_frame(int opts, int no_scale) { + int oldscale = currentConfig.scaling; int po_old = PicoOpt; - PicoOpt &= ~0x10; + if (no_scale) { + currentConfig.scaling = SCALE_1x1; + emu_video_mode_change(0, 0, 0); + } + + PicoOpt &= ~POPT_ALT_RENDERER; PicoOpt |= opts|POPT_ACC_SPRITES; // acc_sprites Pico.m.dirtyPal = 1; PicoFrameDrawOnly(); PicoOpt = po_old; + currentConfig.scaling = oldscale; } static void updateSound(int len) @@ -368,14 +376,11 @@ void emu_video_mode_change(int start_line, int line_count, int is_32cols) void pemu_loop_prep(void) { - emu_video_mode_change(0, 0, 0); - if (currentConfig.CPUclock != get_cpu_clock()) { - FILE *f = fopen("/proc/pandora/cpu_mhz_max", "w"); - if (f != NULL) { - fprintf(f, "%d\n", currentConfig.CPUclock); - fclose(f); - } + char buf[64]; + snprintf(buf, sizeof(buf), "sudo /usr/pandora/scripts/op_cpuspeed.sh %d", + currentConfig.CPUclock); + system(buf); } pemu_sound_start(); @@ -434,7 +439,7 @@ const char *plat_get_credits(void) "Reesy & FluBBa: DrZ80 core\n" "MAME devs: YM2612 and SN76496 cores\n" "Pandora team: Pandora\n" - "Inder: menu bg\n" + "Inder, ketchupgun: graphics\n" "\n" "special thanks (for docs, ideas):\n" " Charles MacDonald, Haze,\n" diff --git a/platform/psp/emu.c b/platform/psp/emu.c index 61699408..77b20d19 100644 --- a/platform/psp/emu.c +++ b/platform/psp/emu.c @@ -668,7 +668,7 @@ static void SkipFrame(void) PicoSkipFrame=0; } -void pemu_forced_frame(int opts) +void pemu_forced_frame(int opts, int no_scale) { int po_old = PicoOpt; int eo_old = currentConfig.EmuOpt; diff --git a/platform/win32/plat.c b/platform/win32/plat.c index ecf47198..91ef0e09 100644 --- a/platform/win32/plat.c +++ b/platform/win32/plat.c @@ -82,7 +82,7 @@ void pemu_loop_end(void) pemu_sound_stop(); } -void pemu_forced_frame(int opts) +void pemu_forced_frame(int opts, int no_scale) { } -- 2.39.5