diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/3ds/3ds_utils.h | 8 | ||||
-rw-r--r-- | frontend/3ds/pthread.h | 20 | ||||
-rw-r--r-- | frontend/libretro.c | 93 | ||||
-rw-r--r-- | frontend/libretro_core_options.h | 70 | ||||
-rw-r--r-- | frontend/main.c | 9 | ||||
-rw-r--r-- | frontend/menu.c | 32 | ||||
-rw-r--r-- | frontend/plugin_lib.h | 7 |
7 files changed, 210 insertions, 29 deletions
diff --git a/frontend/3ds/3ds_utils.h b/frontend/3ds/3ds_utils.h index 3d50a66..1f12b84 100644 --- a/frontend/3ds/3ds_utils.h +++ b/frontend/3ds/3ds_utils.h @@ -2,6 +2,7 @@ #define _3DS_UTILS_H #include <stdio.h> +#include <stdbool.h> #define MEMOP_PROT 6 #define MEMOP_MAP 4 @@ -15,9 +16,10 @@ int32_t svcCloseHandle(uint32_t handle); int32_t svcControlMemory(void* addr_out, void* addr0, void* addr1, uint32_t size, uint32_t op, uint32_t perm); int32_t svcControlProcessMemory(uint32_t process, void* addr0, void* addr1, uint32_t size, uint32_t op, uint32_t perm); -int32_t svcCreateThread(int32_t* thread, void *(*entrypoint)(void*), void* arg, void* stack_top, int32_t thread_priority, int32_t processor_id); -int32_t svcWaitSynchronization(int32_t handle, int64_t nanoseconds); -void svcExitThread(void) __attribute__((noreturn)); +int32_t threadCreate(void *(*entrypoint)(void*), void* arg, size_t stack_size, int32_t prio, int32_t affinity, bool detached); +int32_t threadJoin(int32_t thread, int64_t timeout_ns); +void threadFree(int32_t thread); +void threadExit(int32_t rc) __attribute__((noreturn)); int32_t svcBackdoor(int32_t (*callback)(void)); diff --git a/frontend/3ds/pthread.h b/frontend/3ds/pthread.h index 2c2bf6b..9f43707 100644 --- a/frontend/3ds/pthread.h +++ b/frontend/3ds/pthread.h @@ -10,23 +10,13 @@ #define CTR_PTHREAD_STACK_SIZE 0x10000 -typedef struct -{ - int32_t handle; - uint32_t* stack; -}pthread_t; +typedef int32_t pthread_t; typedef int pthread_attr_t; static inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) { - - thread->stack = linearMemAlign(CTR_PTHREAD_STACK_SIZE, 8); - - svcCreateThread(&thread->handle, start_routine, arg, - (uint32_t*)((uint32_t)thread->stack + CTR_PTHREAD_STACK_SIZE), - 0x25, 1); - + thread = threadCreate(start_routine, arg, CTR_PTHREAD_STACK_SIZE, 0x25, -2, FALSE); return 1; } @@ -35,10 +25,10 @@ static inline int pthread_join(pthread_t thread, void **retval) { (void)retval; - if(svcWaitSynchronization(thread.handle, INT64_MAX)) + if(threadJoin(thread, INT64_MAX)) return -1; - linearFree(thread.stack); + threadFree(thread); return 0; } @@ -48,7 +38,7 @@ static inline void pthread_exit(void *retval) { (void)retval; - svcExitThread(); + threadExit(0); } diff --git a/frontend/libretro.c b/frontend/libretro.c index 929477f..987f90d 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; @@ -1435,6 +1436,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 @@ -1442,6 +1444,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 @@ -1769,6 +1772,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 81a3ac2..0c0634f 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -808,6 +808,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 81a68e3..fcf3846 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; @@ -144,7 +151,7 @@ void emu_set_default_config(void) spu_config.iVolume = 768; spu_config.iTempo = 0; spu_config.iUseThread = 1; // no effect if only 1 core is detected -#ifdef HAVE_PRE_ARMV7 /* XXX GPH hack */ +#if defined(HAVE_PRE_ARMV7) && !defined(_3DS) /* XXX GPH hack */ spu_config.iUseReverb = 0; spu_config.iUseInterpolation = 0; spu_config.iTempo = 1; 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; |