X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fmenu.c;h=65f7b98af79cbf5c22df86ab275cb03910a0b96b;hp=2cfcc6e2f943600600a8fedee595fe8dba06b287;hb=2e6189bc568b4e95cf5b04cf84375b3e918675f1;hpb=a72ac8031937bb80f36e9392d07724a954995029 diff --git a/frontend/menu.c b/frontend/menu.c index 2cfcc6e2..65f7b98a 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -22,7 +22,6 @@ #include "config.h" #include "plugin.h" #include "plugin_lib.h" -#include "omap.h" #include "plat.h" #include "pcnt.h" #include "common/plat.h" @@ -295,6 +294,16 @@ static const struct { CE_INTVAL_P(gpu_unai.no_light), CE_INTVAL_P(gpu_unai.no_blend), CE_INTVAL_P(gpu_neon.allow_interlace), + CE_INTVAL_P(gpu_peopsgl.bDrawDither), + CE_INTVAL_P(gpu_peopsgl.iFilterType), + CE_INTVAL_P(gpu_peopsgl.iFrameTexType), + CE_INTVAL_P(gpu_peopsgl.iUseMask), + CE_INTVAL_P(gpu_peopsgl.bOpaquePass), + CE_INTVAL_P(gpu_peopsgl.bAdvancedBlend), + CE_INTVAL_P(gpu_peopsgl.bUseFastMdec), + CE_INTVAL_P(gpu_peopsgl.iVRamSize), + CE_INTVAL_P(gpu_peopsgl.iTexGarbageCollection), + CE_INTVAL_P(gpu_peopsgl.dwActFixes), CE_INTVAL_V(iUseReverb, 3), CE_INTVAL_V(iXAPitch, 3), CE_INTVAL_V(iUseInterpolation, 3), @@ -480,6 +489,10 @@ fail: menu_sync_config(); + // caanoo old config compat hack + if (strcmp(Config.Gpu, "gpuPCSX4ALL.so") == 0) + strcpy(Config.Gpu, "gpu_unai.so"); + // sync plugins for (i = bios_sel = 0; bioses[i] != NULL; i++) if (strcmp(Config.Bios, bioses[i]) == 0) @@ -598,10 +611,10 @@ static void draw_savestate_bg(int slot) bgr888_to_rgb565(d, s, w * 3); else bgr555_to_rgb565(d, s, w * 2); -#ifndef __ARM_ARCH_7A__ - // better darken this on small screens - menu_darken_bg(d, d, w * 2, 0); -#endif + + // darken this so that menu text is visible + if (g_menuscreen_w - w < 320) + menu_darken_bg(d, d, w * 2, 0); } out: @@ -1137,7 +1150,7 @@ static int menu_loop_cscaler(int id, int keys) scaling = SCALE_CUSTOM; - omap_enable_layer(1); + plat_gvideo_open(); for (;;) { @@ -1172,11 +1185,12 @@ static int menu_loop_cscaler(int id, int keys) g_layer_w = 800 - g_layer_x; if (g_layer_y + g_layer_h > 480) g_layer_h = 480 - g_layer_y; - omap_enable_layer(1); + // resize the layer + plat_gvideo_open(); } } - omap_enable_layer(0); + plat_gvideo_close(); return 0; } @@ -1494,7 +1508,7 @@ static int menu_loop_options(int id, int keys) int i; i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS); - e_menu_options[i].enabled = cpu_clock_st != 0 ? 1 : 0; + e_menu_options[i].enabled = cpu_clock_st > 0 ? 1 : 0; me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, ready_to_go && CdromId[0]); me_loop(e_menu_options, &sel); @@ -1684,11 +1698,14 @@ static void menu_bios_warn(void) "The file is usually named SCPH1001.BIN,\n" "but other not compressed files can be\n" "used too.\n\n" - "Press (B) or (X) to continue"; + "Press %s or %s to continue"; + char tmp_msg[sizeof(msg) + 64]; + snprintf(tmp_msg, sizeof(tmp_msg), msg, + in_get_key_name(-1, -PBTN_MOK), in_get_key_name(-1, -PBTN_MBACK)); while (1) { - draw_menu_message(msg, NULL); + draw_menu_message(tmp_msg, NULL); inp = in_menu_wait(PBTN_MOK|PBTN_MBACK, 70); if (inp & (PBTN_MBACK|PBTN_MOK)) @@ -1704,8 +1721,10 @@ static void draw_frame_main(void) { struct tm *tmp; time_t ltime; + int capacity; char ltime_s[16]; char buff[64]; + char *out; if (CdromId[0] != 0) { snprintf(buff, sizeof(buff), "%.32s/%.9s (running as %s, with %s)", @@ -1715,11 +1734,17 @@ static void draw_frame_main(void) } if (ready_to_go) { + capacity = plat_get_bat_capacity(); ltime = time(NULL); tmp = localtime(<ime); strftime(ltime_s, sizeof(ltime_s), "%H:%M", tmp); - snprintf(buff, sizeof(buff), "%s %3d%%", ltime_s, plat_get_bat_capacity()); - smalltext_out16(4, 1 + me_sfont_h, buff, 0x105f); + if (capacity >= 0) { + snprintf(buff, sizeof(buff), "%s %3d%%", ltime_s, capacity); + out = buff; + } + else + out = ltime_s; + smalltext_out16(4, 1 + me_sfont_h, out, 0x105f); } } @@ -2231,8 +2256,12 @@ void menu_init(void) last_psx_bpp = 16; g_menubg_src_ptr = calloc(g_menuscreen_w * g_menuscreen_h * 2, 1); - if (g_menubg_src_ptr == NULL) + g_menubg_ptr = calloc(g_menuscreen_w * g_menuscreen_h * 2, 1); + if (g_menubg_src_ptr == NULL || g_menubg_ptr == NULL) { + fprintf(stderr, "OOM\n"); exit(1); + } + emu_make_path(buff, "skin/background.png", sizeof(buff)); readpng(g_menubg_src_ptr, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h); @@ -2257,6 +2286,7 @@ void menu_notify_mode_change(int w, int h, int bpp) last_psx_h = h; last_psx_bpp = bpp; + // XXX: should really menu code cotrol the layer size? switch (scaling) { case SCALE_1_1: g_layer_w = w; g_layer_h = h; @@ -2314,16 +2344,24 @@ static void menu_leave_emu(void) plat_video_menu_enter(ready_to_go); memcpy(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2); - if (pl_vout_buf != NULL && ready_to_go && last_psx_bpp == 16) { + if (pl_vout_buf != NULL && ready_to_go) { int x = max(0, g_menuscreen_w - last_psx_w); int y = max(0, g_menuscreen_h / 2 - last_psx_h / 2); int w = min(g_menuscreen_w, last_psx_w); int h = min(g_menuscreen_h, last_psx_h); u16 *d = (u16 *)g_menubg_ptr + g_menuscreen_w * y + x; - u16 *s = pl_vout_buf; + char *s = pl_vout_buf; - for (; h > 0; h--, d += g_menuscreen_w, s += last_psx_w) - menu_darken_bg(d, s, w, 0); + if (last_psx_bpp == 16) { + for (; h > 0; h--, d += g_menuscreen_w, s += last_psx_w * 2) + menu_darken_bg(d, s, w, 0); + } + else { + for (; h > 0; h--, d += g_menuscreen_w, s += last_psx_w * 3) { + bgr888_to_rgb565(d, s, w * 3); + menu_darken_bg(d, d, w, 0); + } + } } if (ready_to_go) @@ -2351,7 +2389,8 @@ void menu_prepare_emu(void) menu_sync_config(); apply_lcdrate(Config.PsxType); apply_filter(filter); - plat_cpu_clock_apply(cpu_clock); + if (cpu_clock > 0) + plat_cpu_clock_apply(cpu_clock); // push config to GPU plugin plugin_call_rearmed_cbs();