X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fmain.c;h=bdea1b5113eb4faf24033be5bfb2705563473c50;hp=df2af8f22bc849688b668eb6654b43a65305902c;hb=215ff9e69c0b845f24e7a3aa9faeef06d9276145;hpb=69e482e3def6669a4fa921d07f9ba04883d7de34 diff --git a/frontend/main.c b/frontend/main.c index df2af8f2..bdea1b51 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" @@ -25,6 +25,7 @@ #include "../libpcsxcore/cheat.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" #include "../plugins/cdrcimg/cdrcimg.h" +#include "../plugins/dfsound/spu_config.h" #include "revision.h" #ifndef NO_FRONTEND @@ -44,12 +45,6 @@ static void check_memcards(void); void StartDebugger(); void StopDebugger(); -// sound plugin -extern int iUseReverb; -extern int iUseInterpolation; -extern int iXAPitch; -extern int iVolume; - int ready_to_go, g_emu_want_quit, g_emu_resetting; unsigned long gpuDisp; char cfgfile_basename[MAXPATHLEN]; @@ -141,13 +136,15 @@ void emu_set_default_config(void) pl_rearmed_cbs.gpu_peopsgl.iVRamSize = 64; pl_rearmed_cbs.gpu_peopsgl.iTexGarbageCollection = 1; - iUseReverb = 2; - iUseInterpolation = 1; - iXAPitch = 0; - iVolume = 768; -#ifndef __ARM_ARCH_7A__ /* XXX */ - iUseReverb = 0; - iUseInterpolation = 0; + spu_config.iUseReverb = 1; + spu_config.iUseInterpolation = 1; + spu_config.iXAPitch = 0; + spu_config.iVolume = 768; + spu_config.iTempo = 0; +#if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX GPH hack */ + spu_config.iUseReverb = 0; + spu_config.iUseInterpolation = 0; + spu_config.iTempo = 1; #endif new_dynarec_hacks = 0; cycle_multiplier = 200; @@ -251,7 +248,11 @@ do_state_slot: } case SACTION_VOLUME_UP: case SACTION_VOLUME_DOWN: - plat_target_step_volume(emu_action == SACTION_VOLUME_UP); + { + static int volume; + plat_target_step_volume(&volume, + emu_action == SACTION_VOLUME_UP ? 1 : -1); + } return; case SACTION_MINIMIZE: if (GPU_close != NULL) @@ -402,7 +403,14 @@ int emu_core_preinit(void) // it may be redefined by -cfg on the command line strcpy(cfgfile_basename, "pcsx.cfg"); +#ifdef IOS + emuLog = fopen("/User/Documents/pcsxr.log", "w"); + if (emuLog == NULL) + emuLog = fopen("pcsxr.log", "w"); + if (emuLog == NULL) +#endif emuLog = stdout; + SetIsoFile(NULL); memset(&Config, 0, sizeof(Config)); @@ -444,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]; @@ -680,6 +692,12 @@ static void toggle_fast_forward(int force_off) snprintf(hud_msg, sizeof(hud_msg), "FAST FORWARD %s", fast_forward ? "ON" : "OFF"); } + +static void SignalExit(int sig) { + // only to restore framebuffer/resolution on some devices + plat_finish(); + exit(1); +} #endif void SysRunGui() { @@ -752,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", @@ -782,6 +800,7 @@ void SysPrintf(const char *fmt, ...) { va_start(list, fmt); vfprintf(emuLog, fmt, list); va_end(list); + fflush(emuLog); } #else @@ -813,10 +832,6 @@ void SysMessage(const char *fmt, ...) { SysPrintf("%s\n", msg); } -static void SignalExit(int sig) { - emu_core_ask_exit(); -} - #define PARSEPATH(dst, src) \ ptr = src + strlen(src); \ while (*ptr != '\\' && ptr != src) ptr--; \ @@ -827,8 +842,10 @@ static void SignalExit(int sig) { static int _OpenPlugins(void) { int ret; +#ifndef NO_FRONTEND signal(SIGINT, SignalExit); signal(SIGPIPE, SignalExit); +#endif GPU_clearDynarec(clearDynarec); @@ -837,6 +854,7 @@ static int _OpenPlugins(void) { ret = SPU_open(); if (ret < 0) { SysMessage(_("Error opening SPU plugin!")); return -1; } SPU_registerCallback(SPUirq); + SPU_registerScheduleCb(SPUschedule); // pcsx-rearmed: we handle gpu elsewhere //ret = GPU_open(&gpuDisp, "PCSX", NULL); //if (ret < 0) { SysMessage(_("Error opening GPU plugin!")); return -1; } @@ -919,8 +937,11 @@ int OpenPlugins() { void ClosePlugins() { int ret; +#ifndef NO_FRONTEND signal(SIGINT, SIG_DFL); signal(SIGPIPE, SIG_DFL); +#endif + ret = CDR_close(); if (ret < 0) { SysMessage(_("Error closing CD-ROM plugin!")); return; } ret = SPU_close(); @@ -951,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); @@ -963,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; } @@ -975,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) { @@ -988,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 }