From 003cfc63c69b3e900de768317354dfb80bbf6a55 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 3 Jan 2015 02:22:14 +0200 Subject: mingw build fixes --- frontend/libretro.c | 4 ++-- frontend/main.c | 31 +++++++++++++++++++++++++------ frontend/plugin.c | 47 +++++++++++++++++++++++++++-------------------- 3 files changed, 54 insertions(+), 28 deletions(-) (limited to 'frontend') diff --git a/frontend/libretro.c b/frontend/libretro.c index b636f49..5bc5443 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1,5 +1,5 @@ /* - * (C) notaz, 2012 + * (C) notaz, 2012,2014,2015 * * This work is licensed under the terms of the GNU GPLv2 or later. * See the COPYING file in the top-level directory. @@ -602,7 +602,7 @@ static void extract_directory(char *buf, const char *path, size_t size) } } -#ifdef __QNX__ +#if defined(__QNX__) || defined(_WIN32) /* Blackberry QNX doesn't have strcasestr */ /* diff --git a/frontend/main.c b/frontend/main.c index 426ef13..bdea1b5 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -8,12 +8,12 @@ #include #include #include -#include -#include -#include #include #include #include +#ifndef _WIN32 +#include +#endif #include "main.h" #include "plugin.h" @@ -141,7 +141,7 @@ void emu_set_default_config(void) spu_config.iXAPitch = 0; spu_config.iVolume = 768; spu_config.iTempo = 0; -#if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX */ +#if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX GPH hack */ spu_config.iUseReverb = 0; spu_config.iUseInterpolation = 0; spu_config.iTempo = 1; @@ -452,6 +452,10 @@ void emu_core_ask_exit(void) } #ifndef NO_FRONTEND + +#include +#include + static void create_profile_dir(const char *directory) { char path[MAXPATHLEN]; @@ -766,7 +770,7 @@ int emu_save_state(int slot) return ret; ret = SaveState(fname); -#ifndef __ARM_ARCH_7A__ /* XXX */ +#if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX GPH hack */ sync(); #endif SysPrintf("* %s \"%s\" [%d]\n", @@ -968,7 +972,7 @@ static const int builtin_plugin_ids[] = { void *SysLoadLibrary(const char *lib) { const char *tmp = strrchr(lib, '/'); - void *ret; + void *ret = NULL; int i; SysPrintf("plugin: %s\n", lib); @@ -980,9 +984,14 @@ void *SysLoadLibrary(const char *lib) { return (void *)(long)(PLUGIN_DL_BASE + builtin_plugin_ids[i]); } +#ifndef _WIN32 ret = dlopen(lib, RTLD_NOW); if (ret == NULL) SysMessage("dlopen: %s", dlerror()); +#else + /* no external plugin support, abi is no longer + * compatible with psemu/pcsx anyway */ +#endif return ret; } @@ -992,11 +1001,19 @@ void *SysLoadSym(void *lib, const char *sym) { if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins)) return plugin_link(plugid - PLUGIN_DL_BASE, sym); +#ifndef _WIN32 return dlsym(lib, sym); +#else + return NULL; +#endif } const char *SysLibError() { +#ifndef _WIN32 return dlerror(); +#else + return "not supported"; +#endif } void SysCloseLibrary(void *lib) { @@ -1005,6 +1022,8 @@ void SysCloseLibrary(void *lib) { if (PLUGIN_DL_BASE <= plugid && plugid < PLUGIN_DL_BASE + ARRAY_SIZE(builtin_plugins)) return; +#ifndef _WIN32 dlclose(lib); +#endif } diff --git a/frontend/plugin.c b/frontend/plugin.c index cf3d575..d9eb04a 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -15,31 +15,38 @@ #include "../libpcsxcore/system.h" #include "../plugins/cdrcimg/cdrcimg.h" +#ifndef _WIN32 +#define CALLBACK +#else +#define WIN32_LEAN_AND_MEAN +#include +#endif + static int dummy_func() { return 0; } /* SPU */ -extern long SPUopen(void); -extern long SPUinit(void); -extern long SPUshutdown(void); -extern long SPUclose(void); -extern void SPUplaySample(unsigned char); -extern void SPUwriteRegister(unsigned long, unsigned short, unsigned int); -extern unsigned short SPUreadRegister(unsigned long); -extern void SPUwriteDMA(unsigned short); -extern unsigned short SPUreadDMA(void); -extern void SPUwriteDMAMem(unsigned short *, int, unsigned int); -extern void SPUreadDMAMem(unsigned short *, int, unsigned int); -extern void SPUplayADPCMchannel(void *); -extern void SPUregisterCallback(void (*cb)(void)); -extern void SPUregisterScheduleCb(void (*cb)(unsigned int)); -extern long SPUconfigure(void); -extern long SPUtest(void); -extern void SPUabout(void); -extern long SPUfreeze(unsigned int, void *, unsigned int); -extern void SPUasync(unsigned int, unsigned int); -extern int SPUplayCDDAchannel(short *, int); +extern long CALLBACK SPUopen(void); +extern long CALLBACK SPUinit(void); +extern long CALLBACK SPUshutdown(void); +extern long CALLBACK SPUclose(void); +extern void CALLBACK SPUplaySample(unsigned char); +extern void CALLBACK SPUwriteRegister(unsigned long, unsigned short, unsigned int); +extern unsigned short CALLBACK SPUreadRegister(unsigned long); +extern void CALLBACK SPUwriteDMA(unsigned short); +extern unsigned short CALLBACK SPUreadDMA(void); +extern void CALLBACK SPUwriteDMAMem(unsigned short *, int, unsigned int); +extern void CALLBACK SPUreadDMAMem(unsigned short *, int, unsigned int); +extern void CALLBACK SPUplayADPCMchannel(void *); +extern void CALLBACK SPUregisterCallback(void (*cb)(void)); +extern void CALLBACK SPUregisterScheduleCb(void (*cb)(unsigned int)); +extern long CALLBACK SPUconfigure(void); +extern long CALLBACK SPUtest(void); +extern void CALLBACK SPUabout(void); +extern long CALLBACK SPUfreeze(unsigned int, void *, unsigned int); +extern void CALLBACK SPUasync(unsigned int, unsigned int); +extern int CALLBACK SPUplayCDDAchannel(short *, int); /* PAD */ static long PADreadPort1(PadDataS *pad) -- cgit v1.2.3 From 63a4f6b6a3b0315590cd3009df2c92480ed2d98b Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 2 Jan 2015 04:13:50 +0200 Subject: spu: threaded implementation unlike original P.E.Op.S. implementation, the goal here is to carefully avoid any side effects caused by having the thread enabled --- frontend/main.c | 1 + frontend/menu.c | 3 +++ 2 files changed, 4 insertions(+) (limited to 'frontend') diff --git a/frontend/main.c b/frontend/main.c index bdea1b5..4c84803 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -141,6 +141,7 @@ void emu_set_default_config(void) spu_config.iXAPitch = 0; spu_config.iVolume = 768; spu_config.iTempo = 0; + spu_config.iUseThread = 1; // no effect if only 1 core is detected #if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX GPH hack */ spu_config.iUseReverb = 0; spu_config.iUseInterpolation = 0; diff --git a/frontend/menu.c b/frontend/menu.c index a7012e6..a1edac2 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -75,6 +75,7 @@ typedef enum MA_OPT_SAVECFG, MA_OPT_SAVECFG_GAME, MA_OPT_CPU_CLOCKS, + MA_OPT_SPU_THREAD, MA_OPT_DISP_OPTS, MA_OPT_VARSCALER, MA_OPT_VARSCALER_C, @@ -444,6 +445,7 @@ static const struct { CE_INTVAL(spu_config.iXAPitch), CE_INTVAL(spu_config.iUseInterpolation), CE_INTVAL(spu_config.iTempo), + CE_INTVAL(spu_config.iUseThread), CE_INTVAL(config_save_counter), CE_INTVAL(in_evdev_allow_abs_only), CE_INTVAL(volume_boost), @@ -1604,6 +1606,7 @@ static menu_entry e_menu_options[] = mee_onoff ("Show FPS", 0, g_opts, OPT_SHOWFPS), mee_enum ("Region", 0, region, men_region), mee_range ("CPU clock", MA_OPT_CPU_CLOCKS, cpu_clock, 20, 5000), + mee_onoff ("Threaded SPU", MA_OPT_SPU_THREAD, spu_config.iUseThread, 1), mee_handler_id("[Display]", MA_OPT_DISP_OPTS, menu_loop_gfx_options), mee_handler ("[BIOS/Plugins]", menu_loop_plugin_options), mee_handler ("[Advanced]", menu_loop_adv_options), -- cgit v1.2.3 From 8886a80857ea5329717a54f4deb37d8e974ffc9c Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 11 Jan 2015 23:35:35 +0200 Subject: frontend: show C64x option --- frontend/menu.c | 9 ++++++--- frontend/pandora/pcsx.sh | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'frontend') diff --git a/frontend/menu.c b/frontend/menu.c index a1edac2..675ec26 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1606,7 +1606,11 @@ static menu_entry e_menu_options[] = mee_onoff ("Show FPS", 0, g_opts, OPT_SHOWFPS), mee_enum ("Region", 0, region, men_region), mee_range ("CPU clock", MA_OPT_CPU_CLOCKS, cpu_clock, 20, 5000), +#ifdef C64X_DSP + mee_onoff ("Use C64x DSP for sound", MA_OPT_SPU_THREAD, spu_config.iUseThread, 1), +#else mee_onoff ("Threaded SPU", MA_OPT_SPU_THREAD, spu_config.iUseThread, 1), +#endif mee_handler_id("[Display]", MA_OPT_DISP_OPTS, menu_loop_gfx_options), mee_handler ("[BIOS/Plugins]", menu_loop_plugin_options), mee_handler ("[Advanced]", menu_loop_adv_options), @@ -1619,10 +1623,9 @@ static menu_entry e_menu_options[] = static int menu_loop_options(int id, int keys) { static int sel = 0; - int i; - i = me_id2offset(e_menu_options, MA_OPT_CPU_CLOCKS); - e_menu_options[i].enabled = cpu_clock_st > 0 ? 1 : 0; + me_enable(e_menu_options, MA_OPT_CPU_CLOCKS, cpu_clock_st > 0); + me_enable(e_menu_options, MA_OPT_SPU_THREAD, spu_config.iThreadAvail); me_enable(e_menu_options, MA_OPT_SAVECFG_GAME, ready_to_go && CdromId[0]); me_loop(e_menu_options, &sel); diff --git a/frontend/pandora/pcsx.sh b/frontend/pandora/pcsx.sh index a69ca31..710f641 100755 --- a/frontend/pandora/pcsx.sh +++ b/frontend/pandora/pcsx.sh @@ -10,6 +10,9 @@ nub1mode=`cat /proc/pandora/nub1/mode` # no big deal if this fails, only performance loss sudo -n /usr/pandora/scripts/op_hugetlb.sh 24 +# C64x DSP for SPU +sudo -n /usr/pandora/scripts/op_dsp_c64.sh + ./pcsx "$@" # restore stuff if pcsx crashes -- cgit v1.2.3 From 7cfc0c6699ace15d825367e8c40871b413638cf6 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 12 Jan 2015 00:10:02 +0200 Subject: frontend: tune scanline implementation a bit --- frontend/plugin_lib.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'frontend') diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 163d4f1..56da763 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -44,7 +44,7 @@ void *tsdev; void *pl_vout_buf; int g_layer_x, g_layer_y, g_layer_w, g_layer_h; static int pl_vout_w, pl_vout_h, pl_vout_bpp; /* output display/layer */ -static int pl_vout_scale, pl_vout_yoffset; +static int pl_vout_scale_w, pl_vout_scale_h, pl_vout_yoffset; static int psx_w, psx_h, psx_bpp; static int vsync_cnt; static int is_pal, frame_interval, frame_interval1024; @@ -230,7 +230,7 @@ static void update_layer_size(int w, int h) } // XXX: this is platform specific really -static int resolution_ok(int w, int h) +static inline int resolution_ok(int w, int h) { return w <= 1024 && h <= 512; } @@ -261,20 +261,25 @@ static void pl_vout_set_mode(int w, int h, int raw_w, int raw_h, int bpp) vout_h = 192; } - pl_vout_scale = 1; + pl_vout_scale_w = pl_vout_scale_h = 1; #ifdef __ARM_NEON__ if (soft_filter) { if (resolution_ok(w * 2, h * 2) && bpp == 16) { - vout_w *= 2; - vout_h *= 2; - pl_vout_scale = 2; + pl_vout_scale_w = 2; + pl_vout_scale_h = 2; } else { // filter unavailable hud_msg[0] = 0; } } + else if (scanlines != 0 && scanline_level != 100 && bpp == 16) { + if (h <= 256) + pl_vout_scale_h = 2; + } #endif + vout_w *= pl_vout_scale_w; + vout_h *= pl_vout_scale_h; update_layer_size(vout_w, vout_h); @@ -316,7 +321,7 @@ static void pl_vout_flip(const void *vram, int stride, int bgr24, int w, int h) } // borders - doffs = (dstride - w * pl_vout_scale) / 2 & ~1; + doffs = (dstride - w * pl_vout_scale_w) / 2 & ~1; if (doffs > doffs_old) clear_counter = 2; @@ -361,12 +366,12 @@ static void pl_vout_flip(const void *vram, int stride, int bgr24, int w, int h) } } #ifdef __ARM_NEON__ - else if (soft_filter == SOFT_FILTER_SCALE2X && pl_vout_scale == 2) + else if (soft_filter == SOFT_FILTER_SCALE2X && pl_vout_scale_w == 2) { neon_scale2x_16_16(src, (void *)dest, w, stride * 2, dstride * 2, h); } - else if (soft_filter == SOFT_FILTER_EAGLE2X && pl_vout_scale == 2) + else if (soft_filter == SOFT_FILTER_EAGLE2X && pl_vout_scale_w == 2) { neon_eagle2x_16_16(src, (void *)dest, w, stride * 2, dstride * 2, h); @@ -374,11 +379,13 @@ static void pl_vout_flip(const void *vram, int stride, int bgr24, int w, int h) else if (scanlines != 0 && scanline_level != 100) { int l = scanline_level * 2048 / 100; + int stride_0 = pl_vout_scale_h >= 2 ? 0 : stride; + h1 *= pl_vout_scale_h; for (; h1 >= 2; h1 -= 2) { bgr555_to_rgb565(dest, src, w * 2); - dest += dstride * 2, src += stride; + dest += dstride * 2, src += stride_0; bgr555_to_rgb565_b(dest, src, w * 2, l); dest += dstride * 2, src += stride; @@ -394,7 +401,7 @@ static void pl_vout_flip(const void *vram, int stride, int bgr24, int w, int h) } out_hud: - print_hud(w * pl_vout_scale, h * pl_vout_scale, 0); + print_hud(w * pl_vout_scale_w, h * pl_vout_scale_h, 0); out: pcnt_end(PCNT_BLIT); @@ -457,7 +464,8 @@ static int dispmode_default(void) return 1; } -int dispmode_doubleres(void) +#ifdef __ARM_NEON__ +static int dispmode_doubleres(void) { if (!(pl_rearmed_cbs.gpu_caps & GPU_CAP_SUPPORTS_2X) || !resolution_ok(psx_w * 2, psx_h * 2) || psx_bpp != 16) @@ -469,7 +477,7 @@ int dispmode_doubleres(void) return 1; } -int dispmode_scale2x(void) +static int dispmode_scale2x(void) { if (!resolution_ok(psx_w * 2, psx_h * 2) || psx_bpp != 16) return 0; @@ -480,7 +488,7 @@ int dispmode_scale2x(void) return 1; } -int dispmode_eagle2x(void) +static int dispmode_eagle2x(void) { if (!resolution_ok(psx_w * 2, psx_h * 2) || psx_bpp != 16) return 0; @@ -490,6 +498,7 @@ int dispmode_eagle2x(void) snprintf(hud_msg, sizeof(hud_msg), "eagle2x"); return 1; } +#endif static int (*dispmode_switchers[])(void) = { dispmode_default, -- cgit v1.2.3 From 52d279a54510d3c73c53462f3f236d62fec2d6fa Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 12 Jan 2015 00:25:49 +0200 Subject: release r21 --- frontend/libretro.c | 2 +- frontend/menu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'frontend') diff --git a/frontend/libretro.c b/frontend/libretro.c index 5bc5443..38514b5 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -283,7 +283,7 @@ void retro_get_system_info(struct retro_system_info *info) { memset(info, 0, sizeof(*info)); info->library_name = "PCSX-ReARMed"; - info->library_version = "r20"; + info->library_version = "r21"; info->valid_extensions = "bin|cue|img|mdf|pbp|toc|cbn|m3u"; info->need_fullpath = true; } diff --git a/frontend/menu.c b/frontend/menu.c index 675ec26..0088a63 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1,5 +1,5 @@ /* - * (C) Gražvydas "notaz" Ignotas, 2010-2014 + * (C) Gražvydas "notaz" Ignotas, 2010-2015 * * This work is licensed under the terms of any of these licenses * (at your option): @@ -1934,7 +1934,7 @@ static const char credits_text[] = "PCSX4ALL plugin by PCSX4ALL team\n" " Chui, Franxis, Unai\n\n" "integration, optimization and\n" - " frontend (C) 2010-2014 notaz\n"; + " frontend (C) 2010-2015 notaz\n"; static int reset_game(void) { -- cgit v1.2.3 From ba10822d813767632c528102055e3eeb54730b2c Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 14 Jan 2015 00:47:44 +0200 Subject: frontend: pandora: work around r20a vs r21 versioning otherwise PNDManager doesn't want to update.. --- frontend/pandora/pcsx.pxml.templ | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'frontend') diff --git a/frontend/pandora/pcsx.pxml.templ b/frontend/pandora/pcsx.pxml.templ index 7ae3c6c..f748065 100644 --- a/frontend/pandora/pcsx.pxml.templ +++ b/frontend/pandora/pcsx.pxml.templ @@ -4,7 +4,7 @@ PCSX ReARMed - + @@ -25,7 +25,7 @@ The emulator features MIPS->ARM recompiler by Ari64 and ARM NEON GPU by Exophase - + -- cgit v1.2.3