From 030d1121f27550429364745419fc5e6161a2a431 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Sat, 17 Aug 2019 09:31:06 +0800 Subject: Backport GPU Unai plugin from PCSX4ALL - backports gpu unai plugin from PCSX4ALL - sync necessary files with notaz/master to allow building standalone app --- frontend/320240/caanoo.gpe | 23 +++ frontend/320240/haptic_s.cfg | 3 + frontend/320240/haptic_w.cfg | 3 + frontend/320240/pcsx26.png | Bin 0 -> 4763 bytes frontend/320240/pcsx_rearmed.ini | 6 + frontend/320240/pcsxb.png | Bin 0 -> 24784 bytes frontend/320240/pollux_set.c | 389 ++++++++++++++++++++++++++++++++++++ frontend/320240/skin/background.png | Bin 0 -> 36069 bytes frontend/320240/skin/font.png | Bin 0 -> 3185 bytes frontend/320240/skin/readme.txt | 8 + frontend/320240/skin/selector.png | Bin 0 -> 261 bytes frontend/320240/skin/skin.txt | 4 + frontend/320240/ui_gp2x.h | 15 ++ frontend/libretro.c | 93 +++++++++ frontend/libretro_core_options.h | 70 +++++++ frontend/main.c | 7 + frontend/menu.c | 32 ++- frontend/plugin_lib.h | 7 + 18 files changed, 650 insertions(+), 10 deletions(-) create mode 100755 frontend/320240/caanoo.gpe create mode 100644 frontend/320240/haptic_s.cfg create mode 100644 frontend/320240/haptic_w.cfg create mode 100644 frontend/320240/pcsx26.png create mode 100644 frontend/320240/pcsx_rearmed.ini create mode 100644 frontend/320240/pcsxb.png create mode 100644 frontend/320240/pollux_set.c create mode 100644 frontend/320240/skin/background.png create mode 100644 frontend/320240/skin/font.png create mode 100644 frontend/320240/skin/readme.txt create mode 100644 frontend/320240/skin/selector.png create mode 100644 frontend/320240/skin/skin.txt create mode 100644 frontend/320240/ui_gp2x.h (limited to 'frontend') diff --git a/frontend/320240/caanoo.gpe b/frontend/320240/caanoo.gpe new file mode 100755 index 0000000..9d6154a --- /dev/null +++ b/frontend/320240/caanoo.gpe @@ -0,0 +1,23 @@ +#!/bin/sh + +# Wiz's timings are already good, apply this for Caanoo +if [ -e /dev/accel ]; then + ./pollux_set "ram_timings=3,9,4,1,1,1,1" +fi + +# the sync mount causes problems when writing saves, +# probably due to many write calls, so have to get rid of it +if grep mmcblk /proc/mounts | grep -q '\'; then + oldmount=`grep mmcblk /proc/mounts | grep '\' | awk '{print $4}'` + mount /dev/mmcblk0p1 /mnt/sd/ -o remount,dirsync,noatime +fi + +./pcsx "$@" +sync + +if [ -n "$oldmount" ]; then + mount /dev/mmcblk0p1 /mnt/sd/ -o remount,$oldmount +fi + +cd /usr/gp2x +exec ./gp2xmenu diff --git a/frontend/320240/haptic_s.cfg b/frontend/320240/haptic_s.cfg new file mode 100644 index 0000000..624056d --- /dev/null +++ b/frontend/320240/haptic_s.cfg @@ -0,0 +1,3 @@ +0 126 +100 -126 +115 0 diff --git a/frontend/320240/haptic_w.cfg b/frontend/320240/haptic_w.cfg new file mode 100644 index 0000000..3585a71 --- /dev/null +++ b/frontend/320240/haptic_w.cfg @@ -0,0 +1,3 @@ +0 54 +100 -126 +105 0 diff --git a/frontend/320240/pcsx26.png b/frontend/320240/pcsx26.png new file mode 100644 index 0000000..ed220a0 Binary files /dev/null and b/frontend/320240/pcsx26.png differ diff --git a/frontend/320240/pcsx_rearmed.ini b/frontend/320240/pcsx_rearmed.ini new file mode 100644 index 0000000..b15497f --- /dev/null +++ b/frontend/320240/pcsx_rearmed.ini @@ -0,0 +1,6 @@ +[info] +name="PCSX ReARMed" +icon="/pcsx_rearmed/pcsx26.png" +path="/pcsx_rearmed/pcsx.gpe" +title="/pcsx_rearmed/pcsxb.png" +group="GAMES" diff --git a/frontend/320240/pcsxb.png b/frontend/320240/pcsxb.png new file mode 100644 index 0000000..ff5a48a Binary files /dev/null and b/frontend/320240/pcsxb.png differ diff --git a/frontend/320240/pollux_set.c b/frontend/320240/pollux_set.c new file mode 100644 index 0000000..f49e777 --- /dev/null +++ b/frontend/320240/pollux_set.c @@ -0,0 +1,389 @@ +/* + * quick tool to set various timings for Wiz + * + * Copyright (c) GraÅžvydas "notaz" Ignotas, 2009 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * HTOTAL: X VTOTAL: 341 + * HSWIDTH: 1 VSWIDTH: 0 + * HASTART: 37 VASTART: 17 + * HAEND: 277 VAEND: 337 + * + * 120Hz + * pcd 8, 447: + 594us + * pcd 9, 397: + 36us + * pcd 10, 357: - 523us + * pcd 11, 325: +1153us + * + * 'lcd_timings=397,1,37,277,341,0,17,337;dpc_clkdiv0=9' + * 'ram_timings=2,9,4,1,1,1,1' + */ + +#include +#include +#include +//#include "pollux_set.h" +#define BINARY + +/* parse stuff */ +static int parse_lcd_timings(const char *str, void *data) +{ + int *lcd_timings = data; + const char *p = str; + int ret, c; + ret = sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%d", + &lcd_timings[0], &lcd_timings[1], &lcd_timings[2], &lcd_timings[3], + &lcd_timings[4], &lcd_timings[5], &lcd_timings[6], &lcd_timings[7]); + if (ret != 8) + return -1; + /* skip seven commas */ + for (c = 0; c < 7 && *p != 0; p++) + if (*p == ',') + c++; + if (c != 7) + return -1; + /* skip last number */ + while ('0' <= *p && *p <= '9') + p++; + + return p - str; +} + +static int parse_ram_timings(const char *str, void *data) +{ + int *ram_timings = data; + const char *p = str; + int ret, c; + float cas; + + ret = sscanf(p, "%f,%d,%d,%d,%d,%d,%d", + &cas, &ram_timings[1], &ram_timings[2], &ram_timings[3], + &ram_timings[4], &ram_timings[5], &ram_timings[6]); + if (ret != 7) + return -1; + if (cas == 2) + ram_timings[0] = 1; + else if (cas == 2.5) + ram_timings[0] = 2; + else if (cas == 3) + ram_timings[0] = 3; + else + return -1; + for (c = 0; c < 6 && *p != 0; p++) + if (*p == ',') + c++; + if (c != 6) + return -1; + while ('0' <= *p && *p <= '9') + p++; + + return p - str; +} + +static int parse_decimal(const char *str, void *data) +{ + char *ep; + + *(int *)data = strtoul(str, &ep, 10); + if (ep == str) + return -1; + + return ep - str; +} + +/* validate and apply stuff */ +static int apply_lcd_timings(volatile unsigned short *memregs, void *data) +{ + int *lcd_timings = data; + int i; + + for (i = 0; i < 8; i++) { + if (lcd_timings[i] & ~0xffff) { + fprintf(stderr, "pollux_set: invalid lcd timing %d: %d\n", i, lcd_timings[i]); + return -1; + } + } + + for (i = 0; i < 8; i++) + memregs[(0x307c>>1) + i] = lcd_timings[i]; + + return 0; +} + +static const struct { + signed char adj; /* how to adjust value passed by user */ + signed short min; /* range of */ + signed short max; /* allowed values (inclusive) */ +} +ram_ranges[] = { + { 0, 1, 3 }, /* cas (cl) */ + { -2, 0, 15 }, /* trc */ + { -2, 0, 15 }, /* tras */ + { 0, 0, 15 }, /* twr */ + { 0, 0, 15 }, /* tmrd */ + { 0, 0, 15 }, /* trp */ + { 0, 0, 15 }, /* trcd */ +}; + +static int apply_ram_timings(volatile unsigned short *memregs, void *data) +{ + int *ram_timings = data; + int i, val; + + for (i = 0; i < 7; i++) + { + ram_timings[i] += ram_ranges[i].adj; + if (ram_timings[i] < ram_ranges[i].min || ram_timings[i] > ram_ranges[i].max) { + fprintf(stderr, "pollux_set: invalid RAM timing %d\n", i); + return -1; + } + } + + val = memregs[0x14802>>1] & 0x0f00; + val |= (ram_timings[4] << 12) | (ram_timings[5] << 4) | ram_timings[6]; + memregs[0x14802>>1] = val; + + val = memregs[0x14804>>1] & 0x4000; + val |= (ram_timings[0] << 12) | (ram_timings[1] << 8) | + (ram_timings[2] << 4) | ram_timings[3]; + val |= 0x8000; + memregs[0x14804>>1] = val; + + for (i = 0; i < 0x100000 && (memregs[0x14804>>1] & 0x8000); i++) + ; + + return 0; +} + +static int apply_dpc_clkdiv0(volatile unsigned short *memregs, void *data) +{ + int pcd = *(int *)data; + int tmp; + + if ((pcd - 1) & ~0x3f) { + fprintf(stderr, "pollux_set: invalid lcd clkdiv0: %d\n", pcd); + return -1; + } + + pcd = (pcd - 1) & 0x3f; + tmp = memregs[0x31c4>>1]; + memregs[0x31c4>>1] = (tmp & ~0x3f0) | (pcd << 4); + + return 0; +} + +static int apply_cpuclk(volatile unsigned short *memregs, void *data) +{ + volatile unsigned int *memregl = (volatile void *)memregs; + int mhz = *(int *)data; + int adiv, mdiv, pdiv, sdiv = 0; + int i, vf000, vf004; + + // m = MDIV, p = PDIV, s = SDIV + #define SYS_CLK_FREQ 27 + pdiv = 9; + mdiv = (mhz * pdiv) / SYS_CLK_FREQ; + if (mdiv & ~0x3ff) + return -1; + vf004 = (pdiv<<18) | (mdiv<<8) | sdiv; + + // attempt to keep AHB the divider close to 250, but not higher + for (adiv = 1; mhz / adiv > 250; adiv++) + ; + + vf000 = memregl[0xf000>>2]; + vf000 = (vf000 & ~0x3c0) | ((adiv - 1) << 6); + memregl[0xf000>>2] = vf000; + memregl[0xf004>>2] = vf004; + memregl[0xf07c>>2] |= 0x8000; + for (i = 0; (memregl[0xf07c>>2] & 0x8000) && i < 0x100000; i++) + ; + + printf("clock set to %dMHz, AHB set to %dMHz\n", mhz, mhz / adiv); + return 0; +} + +static int lcd_timings[8]; +static int ram_timings[7]; +static int dpc_clkdiv0; +static int cpuclk; + +static const char lcd_t_help[] = "htotal,hswidth,hastart,haend,vtotal,vswidth,vastart,vaend"; +static const char ram_t_help[] = "CAS,tRC,tRAS,tWR,tMRD,tRP,tRCD"; + +static const struct { + const char *name; + const char *help; + int (*parse)(const char *str, void *data); + int (*apply)(volatile unsigned short *memregs, void *data); + void *data; +} +all_params[] = { + { "lcd_timings", lcd_t_help, parse_lcd_timings, apply_lcd_timings, lcd_timings }, + { "ram_timings", ram_t_help, parse_ram_timings, apply_ram_timings, ram_timings }, + { "dpc_clkdiv0", "divider", parse_decimal, apply_dpc_clkdiv0, &dpc_clkdiv0 }, + { "clkdiv0", "divider", parse_decimal, apply_dpc_clkdiv0, &dpc_clkdiv0 }, /* alias */ + { "cpuclk", "MHZ", parse_decimal, apply_cpuclk, &cpuclk }, +}; +#define ALL_PARAM_COUNT (sizeof(all_params) / sizeof(all_params[0])) + +/* + * set timings based on preformated string + * returns 0 on success. + */ +int pollux_set(volatile unsigned short *memregs, const char *str) +{ + int parsed_params[ALL_PARAM_COUNT]; + int applied_params[ALL_PARAM_COUNT]; + int applied_something = 0; + const char *p, *po; + int i, ret; + + if (str == NULL) + return -1; + + memset(parsed_params, 0, sizeof(parsed_params)); + memset(applied_params, 0, sizeof(applied_params)); + + p = str; + while (1) + { +again: + while (*p == ';' || *p == ' ') + p++; + if (*p == 0) + break; + + for (i = 0; i < ALL_PARAM_COUNT; i++) + { + int param_len = strlen(all_params[i].name); + if (strncmp(p, all_params[i].name, param_len) == 0 && p[param_len] == '=') + { + p += param_len + 1; + ret = all_params[i].parse(p, all_params[i].data); + if (ret < 0) { + fprintf(stderr, "pollux_set parser: error at %-10s\n", p); + fprintf(stderr, " valid format is: <%s>\n", all_params[i].help); + return -1; + } + parsed_params[i] = 1; + p += ret; + goto again; + } + } + + /* Unknown param. Attempt to be forward compatible and ignore it. */ + for (po = p; *p != 0 && *p != ';'; p++) + ; + + fprintf(stderr, "unhandled param: "); + fwrite(po, 1, p - po, stderr); + fprintf(stderr, "\n"); + } + + /* validate and apply */ + for (i = 0; i < ALL_PARAM_COUNT; i++) + { + if (!parsed_params[i]) + continue; + + ret = all_params[i].apply(memregs, all_params[i].data); + if (ret < 0) { + fprintf(stderr, "pollux_set: failed to apply %s (bad value?)\n", + all_params[i].name); + continue; + } + + applied_something = 1; + applied_params[i] = 1; + } + + if (applied_something) + { + int c; + printf("applied: "); + for (i = c = 0; i < ALL_PARAM_COUNT; i++) + { + if (!applied_params[i]) + continue; + if (c != 0) + printf(", "); + printf("%s", all_params[i].name); + c++; + } + printf("\n"); + } + + return 0; +} + +#ifdef BINARY +#include +#include +#include +#include +#include + +static void usage(const char *binary) +{ + int i; + printf("usage:\n%s \n" + "set_str:\n", binary); + for (i = 0; i < ALL_PARAM_COUNT; i++) + printf(" %s=<%s>\n", all_params[i].name, all_params[i].help); +} + +int main(int argc, char *argv[]) +{ + volatile unsigned short *memregs; + int ret, memdev; + + if (argc != 2) { + usage(argv[0]); + return 1; + } + + memdev = open("/dev/mem", O_RDWR); + if (memdev == -1) + { + perror("open(/dev/mem) failed"); + return 1; + } + + memregs = mmap(0, 0x20000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0xc0000000); + if (memregs == MAP_FAILED) + { + perror("mmap(memregs) failed"); + close(memdev); + return 1; + } + + ret = pollux_set(memregs, argv[1]); + + munmap((void *)memregs, 0x20000); + close(memdev); + + return ret; +} +#endif diff --git a/frontend/320240/skin/background.png b/frontend/320240/skin/background.png new file mode 100644 index 0000000..0efdd18 Binary files /dev/null and b/frontend/320240/skin/background.png differ diff --git a/frontend/320240/skin/font.png b/frontend/320240/skin/font.png new file mode 100644 index 0000000..c526a08 Binary files /dev/null and b/frontend/320240/skin/font.png differ diff --git a/frontend/320240/skin/readme.txt b/frontend/320240/skin/readme.txt new file mode 100644 index 0000000..dd83963 --- /dev/null +++ b/frontend/320240/skin/readme.txt @@ -0,0 +1,8 @@ +The skin images can be customized, but there are several limitations: + +background.png - must be 320x240 image with 24bit RGB colors. +font.png - must be 128x160 8bit grayscale image. +selector.png - must be 8x10 8bit grayscale image. + +Font and selector colors can be changed by editing skin.txt. + diff --git a/frontend/320240/skin/selector.png b/frontend/320240/skin/selector.png new file mode 100644 index 0000000..5062cc2 Binary files /dev/null and b/frontend/320240/skin/selector.png differ diff --git a/frontend/320240/skin/skin.txt b/frontend/320240/skin/skin.txt new file mode 100644 index 0000000..1d6979f --- /dev/null +++ b/frontend/320240/skin/skin.txt @@ -0,0 +1,4 @@ +// html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc. +text_color=ffffc0 +selection_color=808010 + diff --git a/frontend/320240/ui_gp2x.h b/frontend/320240/ui_gp2x.h new file mode 100644 index 0000000..a9c4413 --- /dev/null +++ b/frontend/320240/ui_gp2x.h @@ -0,0 +1,15 @@ +#ifndef UI_FEATURES_H +#define UI_FEATURES_H + +#define MENU_BIOS_PATH "pcsx_rearmed/bios/" +#define MENU_SHOW_VARSCALER 0 +#define MENU_SHOW_VOUTMODE 0 +#define MENU_SHOW_SCALER2 1 +#define MENU_SHOW_NUBS_BTNS 0 +#define MENU_SHOW_VIBRATION 1 +#define MENU_SHOW_DEADZONE 1 +#define MENU_SHOW_MINIMIZE 0 +#define MENU_SHOW_FULLSCREEN 0 +#define MENU_SHOW_VOLUME 1 + +#endif // UI_FEATURES_H diff --git a/frontend/libretro.c b/frontend/libretro.c index b8d17ab..919fabb 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -78,6 +78,7 @@ static bool display_internal_fps = false; static unsigned frame_count = 0; static bool libretro_supports_bitmasks = false; static int show_advanced_gpu_peops_settings = -1; +static int show_advanced_gpu_unai_settings = -1; static unsigned previous_width = 0; static unsigned previous_height = 0; @@ -1423,6 +1424,7 @@ static void update_variables(bool in_flight) if (strcmp(var.value, "disabled") == 0) { pl_rearmed_cbs.gpu_peops.iUseDither = 0; pl_rearmed_cbs.gpu_peopsgl.bDrawDither = 0; + pl_rearmed_cbs.gpu_unai.dithering = 0; #ifdef __ARM_NEON__ pl_rearmed_cbs.gpu_neon.allow_dithering = 0; #endif @@ -1430,6 +1432,7 @@ static void update_variables(bool in_flight) else if (strcmp(var.value, "enabled") == 0) { pl_rearmed_cbs.gpu_peops.iUseDither = 1; pl_rearmed_cbs.gpu_peopsgl.bDrawDither = 1; + pl_rearmed_cbs.gpu_unai.dithering = 1; #ifdef __ARM_NEON__ pl_rearmed_cbs.gpu_neon.allow_dithering = 1; #endif @@ -1757,6 +1760,96 @@ static void update_variables(bool in_flight) } #endif +#ifdef GPU_UNAI + var.key = "pcsx_rearmed_gpu_unai_ilace_force"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + pl_rearmed_cbs.gpu_unai.ilace_force = 0; + else if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_unai.ilace_force = 1; + } + + var.key = "pcsx_rearmed_gpu_unai_pixel_skip"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + pl_rearmed_cbs.gpu_unai.pixel_skip = 0; + else if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_unai.pixel_skip = 1; + } + + var.key = "pcsx_rearmed_gpu_unai_lighting"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + pl_rearmed_cbs.gpu_unai.lighting = 0; + else if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_unai.lighting = 1; + } + + var.key = "pcsx_rearmed_gpu_unai_fast_lighting"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + pl_rearmed_cbs.gpu_unai.fast_lighting = 0; + else if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_unai.fast_lighting = 1; + } + + var.key = "pcsx_rearmed_gpu_unai_blending"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value) + { + if (strcmp(var.value, "disabled") == 0) + pl_rearmed_cbs.gpu_unai.blending = 0; + else if (strcmp(var.value, "enabled") == 0) + pl_rearmed_cbs.gpu_unai.blending = 1; + } + + var.key = "pcsx_rearmed_show_gpu_unai_settings"; + var.value = NULL; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + int show_advanced_gpu_unai_settings_prev = show_advanced_gpu_unai_settings; + + show_advanced_gpu_unai_settings = 1; + if (strcmp(var.value, "disabled") == 0) + show_advanced_gpu_unai_settings = 0; + + if (show_advanced_gpu_unai_settings != show_advanced_gpu_unai_settings_prev) + { + unsigned i; + struct retro_core_option_display option_display; + char gpu_unai_option[5][40] = { + "pcsx_rearmed_gpu_unai_blending", + "pcsx_rearmed_gpu_unai_lighting", + "pcsx_rearmed_gpu_unai_fast_lighting", + "pcsx_rearmed_gpu_unai_ilace_force", + "pcsx_rearmed_gpu_unai_pixel_skip", + }; + + option_display.visible = show_advanced_gpu_unai_settings; + + for (i = 0; i < 5; i++) + { + option_display.key = gpu_unai_option[i]; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + } + } + } +#endif // GPU_UNAI + if (in_flight) { // inform core things about possible config changes plugin_call_rearmed_cbs(); diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 6513e1c..bfb21a5 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -534,6 +534,76 @@ struct retro_core_option_definition option_defs_us[] = { }, #endif + /* GPU UNAI Advanced Options */ +#ifdef GPU_UNAI + { + "pcsx_rearmed_show_gpu_unai_settings", + "Advance GPU UNAI/PCSX4All Settings", + "Shows or hides advanced gpu settings. A core restart might be needed for settings to take effect. NOTE: Quick Menu must be toggled for this setting to take effect.", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "disabled", + }, + { + "pcsx_rearmed_gpu_unai_blending", + "(GPU) Enable Blending", + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "enabled", + }, + { + "pcsx_rearmed_gpu_unai_lighting", + "(GPU) Enable Lighting", + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "enabled", + }, + { + "pcsx_rearmed_gpu_unai_fast_lighting", + "(GPU) Enable Fast Lighting", + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "enabled", + }, + { + "pcsx_rearmed_gpu_unai_ilace_force", + "(GPU) Enable Forced Interlace", + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "disabled", + }, + { + "pcsx_rearmed_gpu_unai_pixel_skip", + "(GPU) Enable Pixel Skip", + NULL, + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL}, + }, + "disabled", + }, +#endif /* GPU UNAI Advanced Settings */ + { "pcsx_rearmed_show_bios_bootlogo", "Show Bios Bootlogo", diff --git a/frontend/main.c b/frontend/main.c index c0bfd0f..b6b5411 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -130,6 +130,13 @@ void emu_set_default_config(void) pl_rearmed_cbs.gpu_neon.enhancement_no_main = 0; pl_rearmed_cbs.gpu_peops.iUseDither = 0; pl_rearmed_cbs.gpu_peops.dwActFixes = 1<<7; + pl_rearmed_cbs.gpu_unai.ilace_force = 0; + pl_rearmed_cbs.gpu_unai.pixel_skip = 1; + pl_rearmed_cbs.gpu_unai.lighting = 1; + pl_rearmed_cbs.gpu_unai.fast_lighting = 1; + pl_rearmed_cbs.gpu_unai.blending = 1; + pl_rearmed_cbs.gpu_unai.dithering = 0; + // old gpu_unai config pl_rearmed_cbs.gpu_unai.abe_hack = pl_rearmed_cbs.gpu_unai.no_light = pl_rearmed_cbs.gpu_unai.no_blend = 0; diff --git a/frontend/menu.c b/frontend/menu.c index babe109..47523b2 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -305,14 +305,14 @@ static void menu_sync_config(void) cycle_multiplier = 10000 / psx_clock; switch (in_type_sel1) { - case 1: in_type1 = PSE_PAD_TYPE_ANALOGPAD; break; - case 2: in_type1 = PSE_PAD_TYPE_NEGCON; break; - default: in_type1 = PSE_PAD_TYPE_STANDARD; + case 1: in_type[0] = PSE_PAD_TYPE_ANALOGPAD; break; + case 2: in_type[0] = PSE_PAD_TYPE_NEGCON; break; + default: in_type[0] = PSE_PAD_TYPE_STANDARD; } switch (in_type_sel2) { - case 1: in_type2 = PSE_PAD_TYPE_ANALOGPAD; break; - case 2: in_type2 = PSE_PAD_TYPE_NEGCON; break; - default: in_type2 = PSE_PAD_TYPE_STANDARD; + case 1: in_type[1] = PSE_PAD_TYPE_ANALOGPAD; break; + case 2: in_type[1] = PSE_PAD_TYPE_NEGCON; break; + default: in_type[1] = PSE_PAD_TYPE_STANDARD; } if (in_evdev_allow_abs_only != allow_abs_only_old) { in_probe(); @@ -422,6 +422,12 @@ static const struct { CE_INTVAL_V(frameskip, 3), CE_INTVAL_P(gpu_peops.iUseDither), CE_INTVAL_P(gpu_peops.dwActFixes), + CE_INTVAL_P(gpu_unai.ilace_force), + CE_INTVAL_P(gpu_unai.pixel_skip), + CE_INTVAL_P(gpu_unai.lighting), + CE_INTVAL_P(gpu_unai.fast_lighting), + CE_INTVAL_P(gpu_unai.blending), + CE_INTVAL_P(gpu_unai.dithering), CE_INTVAL_P(gpu_unai.lineskip), CE_INTVAL_P(gpu_unai.abe_hack), CE_INTVAL_P(gpu_unai.no_light), @@ -1358,10 +1364,16 @@ static int menu_loop_plugin_gpu_neon(int id, int keys) static menu_entry e_menu_plugin_gpu_unai[] = { - mee_onoff ("Skip every 2nd line", 0, pl_rearmed_cbs.gpu_unai.lineskip, 1), - mee_onoff ("Abe's Odyssey hack", 0, pl_rearmed_cbs.gpu_unai.abe_hack, 1), - mee_onoff ("Disable lighting", 0, pl_rearmed_cbs.gpu_unai.no_light, 1), - mee_onoff ("Disable blending", 0, pl_rearmed_cbs.gpu_unai.no_blend, 1), + //mee_onoff ("Skip every 2nd line", 0, pl_rearmed_cbs.gpu_unai.lineskip, 1), + //mee_onoff ("Abe's Odyssey hack", 0, pl_rearmed_cbs.gpu_unai.abe_hack, 1), + //mee_onoff ("Disable lighting", 0, pl_rearmed_cbs.gpu_unai.no_light, 1), + //mee_onoff ("Disable blending", 0, pl_rearmed_cbs.gpu_unai.no_blend, 1), + mee_onoff ("Interlace", 0, pl_rearmed_cbs.gpu_unai.ilace_force, 1), + mee_onoff ("Dithering", 0, pl_rearmed_cbs.gpu_unai.dithering, 1), + mee_onoff ("Lighting", 0, pl_rearmed_cbs.gpu_unai.lighting, 1), + mee_onoff ("Fast lighting", 0, pl_rearmed_cbs.gpu_unai.fast_lighting, 1), + mee_onoff ("Blending", 0, pl_rearmed_cbs.gpu_unai.blending, 1), + mee_onoff ("Pixel skip", 0, pl_rearmed_cbs.gpu_unai.pixel_skip, 1), mee_end, }; diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index 92e62e9..d51c5e7 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -80,6 +80,13 @@ struct rearmed_cbs { int dwFrameRateTicks; } gpu_peops; struct { + int ilace_force; + int pixel_skip; + int lighting; + int fast_lighting; + int blending; + int dithering; + // old gpu_unai config for compatibility int abe_hack; int no_light, no_blend; int lineskip; -- cgit v1.2.3