/*
- * (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.
#include <stdlib.h>
#include <string.h>
#include <strings.h>
+#ifdef __MACH__
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
#include "../libpcsxcore/misc.h"
#include "../libpcsxcore/psxcounters.h"
#include "main.h"
#include "plugin.h"
#include "plugin_lib.h"
+#include "arm_features.h"
#include "revision.h"
#include "libretro.h"
static retro_input_state_t input_state_cb;
static retro_environment_t environ_cb;
static retro_audio_sample_batch_t audio_batch_cb;
+static struct retro_rumble_interface rumble;
static void *vout_buf;
static int vout_width, vout_height;
int in_type1, in_type2;
int in_a1[2] = { 127, 127 }, in_a2[2] = { 127, 127 };
int in_keystate;
-int in_enable_vibration;
+int in_enable_vibration = 1;
/* PSX max resolution is 640x512, but with enhancement it's 1024x512 */
#define VOUT_MAX_WIDTH 1024
is_pal_mode = is_pal;
}
-void plat_trigger_vibrate(int is_strong)
+void plat_trigger_vibrate(int pad, int low, int high)
{
+ rumble.set_rumble_state(pad, RETRO_RUMBLE_STRONG, high << 8);
+ rumble.set_rumble_state(pad, RETRO_RUMBLE_WEAK, low ? 0xffff : 0x0);
}
void pl_update_gun(int *xn, int *yn, int *xres, int *yres, int *in)
void retro_set_environment(retro_environment_t cb)
{
static const struct retro_variable vars[] = {
- { "frameskip", "Frameskip; 0|1|2|3" },
- { "region", "Region; Auto|NTSC|PAL" },
- { "pad1type", "Pad 1 Type; standard|analog" },
+ { "pcsx_rearmed_frameskip", "Frameskip; 0|1|2|3" },
+ { "pcsx_rearmed_region", "Region; Auto|NTSC|PAL" },
+ { "pcsx_rearmed_pad1type", "Pad 1 Type; standard|analog" },
+ { "pcsx_rearmed_pad2type", "Pad 2 Type; standard|analog" },
#ifndef DRC_DISABLE
- { "rearmed_drc", "Dynamic recompiler; enabled|disabled" },
+ { "pcsx_rearmed_drc", "Dynamic recompiler; enabled|disabled" },
#endif
#ifdef __ARM_NEON__
{ "pcsx_rearmed_neon_interlace_enable", "Enable interlacing mode(s); disabled|enabled" },
{
memset(info, 0, sizeof(*info));
info->library_name = "PCSX-ReARMed";
- info->library_version = "r19";
+ info->library_version = "r22";
info->valid_extensions = "bin|cue|img|mdf|pbp|toc|cbn|m3u";
info->need_fullpath = true;
}
/* savestates */
size_t retro_serialize_size(void)
{
- // it's currently 4380651 bytes, but have some reserved for future
- return 0x430000;
+ // it's currently 4380651-4397047 bytes,
+ // but have some reserved for future
+ return 0x440000;
}
struct save_fp {
}
}
-#ifdef __QNX__
+#if defined(__QNX__) || defined(_WIN32)
/* Blackberry QNX doesn't have strcasestr */
/*
struct retro_variable var;
var.value = NULL;
- var.key = "frameskip";
+ var.key = "pcsx_rearmed_frameskip";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
pl_rearmed_cbs.frameskip = atoi(var.value);
var.value = NULL;
- var.key = "region";
+ var.key = "pcsx_rearmed_region";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
{
}
var.value = NULL;
- var.key = "pad1type";
+ var.key = "pcsx_rearmed_pad1type";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
{
in_type1 = PSE_PAD_TYPE_ANALOGPAD;
}
+ var.value = NULL;
+ var.key = "pcsx_rearmed_pad2type";
+
+ if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
+ {
+ in_type2 = PSE_PAD_TYPE_STANDARD;
+ if (strcmp(var.value, "analog") == 0)
+ in_type2 = PSE_PAD_TYPE_ANALOGPAD;
+ }
+
#ifdef __ARM_NEON__
var.value = "NULL";
var.key = "pcsx_rearmed_neon_interlace_enable";
#ifndef DRC_DISABLE
var.value = NULL;
- var.key = "rearmed_drc";
+ var.key = "pcsx_rearmed_drc";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) || var.value)
{
}
}
#endif
+ psxCpu->ApplyConfig();
var.value = "NULL";
var.key = "pcsx_rearmed_spu_reverb";
int i, ret;
bool found_bios = false;
+#ifdef __MACH__
+ // magic sauce to make the dynarec work on iOS
+ syscall(SYS_ptrace, 0 /*PTRACE_TRACEME*/, 0, 0, 0);
+#endif
+
ret = emu_core_preinit();
ret |= emu_core_init();
if (ret != 0) {
environ_cb(RETRO_ENVIRONMENT_GET_CAN_DUPE, &vout_can_dupe);
environ_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &disk_control);
+ environ_cb(RETRO_ENVIRONMENT_GET_RUMBLE_INTERFACE, &rumble);
/* Set how much slower PSX CPU runs * 100 (so that 200 is 2 times)
* we have to do this because cache misses and some IO penalties
* are not emulated. Warning: changing this may break compatibility. */
-#if !defined(__arm__) || defined(__ARM_ARCH_7A__)
cycle_multiplier = 175;
-#else
+#ifdef HAVE_PRE_ARMV7
cycle_multiplier = 200;
#endif
+ pl_rearmed_cbs.gpu_peops.iUseDither = 1;
+ spu_config.iUseFixedUpdates = 1;
McdDisable[0] = 0;
McdDisable[1] = 1;