aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.libretro4
-rw-r--r--frontend/libretro.c4
-rw-r--r--frontend/main.c31
-rw-r--r--frontend/plugin.c47
-rw-r--r--libpcsxcore/cdriso.c2
-rw-r--r--libpcsxcore/cdrom.c4
-rw-r--r--libpcsxcore/memmap_win32.c2
-rw-r--r--libpcsxcore/new_dynarec/emu_if.c4
-rw-r--r--libpcsxcore/new_dynarec/pcsxmem.c2
-rw-r--r--libpcsxcore/new_dynarec/pcsxmem.h2
-rw-r--r--libpcsxcore/plugins.h19
-rw-r--r--plugins/cdrcimg/cdrcimg.c10
-rw-r--r--plugins/dfinput/main.c15
-rw-r--r--plugins/dfsound/spu.c13
-rw-r--r--plugins/dfsound/stdafx.h20
-rw-r--r--plugins/dfsound/xa.c4
16 files changed, 107 insertions, 76 deletions
diff --git a/Makefile.libretro b/Makefile.libretro
index ae95639..d566e23 100644
--- a/Makefile.libretro
+++ b/Makefile.libretro
@@ -172,7 +172,9 @@ else
endif
CFLAGS += -fPIC
-ifneq ($(platform),qnx)
+ifeq ($(platform),win)
+ MAIN_LDLIBS += -lws2_32
+else ifneq ($(platform),qnx)
LDLIBS += -lpthread
MAIN_LDLIBS += -ldl
endif
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 <stdio.h>
#include <string.h>
#include <stdarg.h>
-#include <dlfcn.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
+#ifndef _WIN32
+#include <dlfcn.h>
+#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 <sys/stat.h>
+#include <sys/types.h>
+
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 <windows.h>
+#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)
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index b733f5b..09aed17 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -26,9 +26,11 @@
#include "ppf.h"
#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
#include <process.h>
#include <windows.h>
#define strcasecmp _stricmp
+#define usleep(x) Sleep((x) / 1000)
#else
#include <pthread.h>
#include <sys/time.h>
diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c
index b686855..3a2eb1f 100644
--- a/libpcsxcore/cdrom.c
+++ b/libpcsxcore/cdrom.c
@@ -126,7 +126,7 @@ unsigned char Test23[] = { 0x43, 0x58, 0x44, 0x32, 0x39 ,0x34, 0x30, 0x51 };
#define STATUS_ERROR (1<<0) // 0x01
/* Errors */
-#define ERROR_NOT_READY (1<<7) // 0x80
+#define ERROR_NOTREADY (1<<7) // 0x80
#define ERROR_INVALIDCMD (1<<6) // 0x40
#define ERROR_INVALIDARG (1<<5) // 0x20
@@ -984,7 +984,7 @@ void cdrInterrupt() {
case DRIVESTATE_PREPARE_CD:
SetResultSize(2);
cdr.Result[0] = cdr.StatP | STATUS_ERROR;
- cdr.Result[1] = ERROR_NOT_READY;
+ cdr.Result[1] = ERROR_NOTREADY;
cdr.Stat = DiskError;
break;
}
diff --git a/libpcsxcore/memmap_win32.c b/libpcsxcore/memmap_win32.c
index f4dbdd6..294f058 100644
--- a/libpcsxcore/memmap_win32.c
+++ b/libpcsxcore/memmap_win32.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <io.h>
-#include "mman.h"
+#include "memmap.h"
#ifndef FILE_MAP_EXECUTE
#define FILE_MAP_EXECUTE 0x0020
diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c
index b7a2489..092c8ae 100644
--- a/libpcsxcore/new_dynarec/emu_if.c
+++ b/libpcsxcore/new_dynarec/emu_if.c
@@ -305,7 +305,7 @@ static int ari64_init()
{
extern void (*psxCP2[64])();
extern void psxNULL();
- extern u_char *out;
+ extern unsigned char *out;
size_t i;
new_dynarec_init();
@@ -438,7 +438,7 @@ int new_dynarec_hacks;
void *psxH_ptr;
void *zeromem_ptr;
u8 zero_mem[0x1000];
-u_char *out;
+unsigned char *out;
void *mem_rtab;
void *scratch_buf_ptr;
void new_dynarec_init() { (void)ari64_execute; }
diff --git a/libpcsxcore/new_dynarec/pcsxmem.c b/libpcsxcore/new_dynarec/pcsxmem.c
index d5c32be..9376ff4 100644
--- a/libpcsxcore/new_dynarec/pcsxmem.c
+++ b/libpcsxcore/new_dynarec/pcsxmem.c
@@ -292,7 +292,7 @@ void new_dyna_pcsx_mem_load_state(void)
map_rcnt_rcount2(rcnts[2].mode);
}
-int pcsxmem_is_handler_dynamic(u_int addr)
+int pcsxmem_is_handler_dynamic(unsigned int addr)
{
if ((addr & 0xfffff000) != 0x1f801000)
return 0;
diff --git a/libpcsxcore/new_dynarec/pcsxmem.h b/libpcsxcore/new_dynarec/pcsxmem.h
index 99bb5d4..72892a8 100644
--- a/libpcsxcore/new_dynarec/pcsxmem.h
+++ b/libpcsxcore/new_dynarec/pcsxmem.h
@@ -6,4 +6,4 @@ void new_dyna_pcsx_mem_reset(void);
void new_dyna_pcsx_mem_load_state(void);
void new_dyna_pcsx_mem_shutdown(void);
-int pcsxmem_is_handler_dynamic(u_int addr);
+int pcsxmem_is_handler_dynamic(unsigned int addr);
diff --git a/libpcsxcore/plugins.h b/libpcsxcore/plugins.h
index e6ac694..132df90 100644
--- a/libpcsxcore/plugins.h
+++ b/libpcsxcore/plugins.h
@@ -33,24 +33,19 @@ extern "C" {
typedef void* HWND;
#define CALLBACK
-typedef long (*GPUopen)(unsigned long *, char *, char *);
-typedef long (*SPUopen)(void);
-typedef long (*PADopen)(unsigned long *);
-typedef long (*NETopen)(unsigned long *);
-typedef long (*SIO1open)(unsigned long *);
-
#else
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-typedef long (CALLBACK* GPUopen)(HWND);
-typedef long (CALLBACK* SPUopen)(HWND);
-typedef long (CALLBACK* PADopen)(HWND);
-typedef long (CALLBACK* NETopen)(HWND);
-typedef long (CALLBACK* SIO1open)(HWND);
-
#endif
+typedef long (CALLBACK *GPUopen)(unsigned long *, char *, char *);
+typedef long (CALLBACK *SPUopen)(void);
+typedef long (CALLBACK *PADopen)(unsigned long *);
+typedef long (CALLBACK *NETopen)(unsigned long *);
+typedef long (CALLBACK *SIO1open)(unsigned long *);
+
#include "spu.h"
#include "psemu_plugin_defs.h"
diff --git a/plugins/cdrcimg/cdrcimg.c b/plugins/cdrcimg/cdrcimg.c
index 0ec14db..76cdfba 100644
--- a/plugins/cdrcimg/cdrcimg.c
+++ b/plugins/cdrcimg/cdrcimg.c
@@ -12,7 +12,13 @@
#include <string.h>
#include <stdlib.h>
#include <zlib.h>
+#ifndef _WIN32
+#define CALLBACK
#include <dlfcn.h>
+#else
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
#include "cdrcimg.h"
@@ -44,7 +50,7 @@ static struct {
static int current_block, current_sect_in_blk;
struct CdrStat;
-extern long CDR__getStatus(struct CdrStat *stat);
+extern long CALLBACK CDR__getStatus(struct CdrStat *stat);
struct CdrStat
{
@@ -279,6 +285,7 @@ static long CDRinit(void)
return -1;
}
}
+#ifndef _WIN32
if (pBZ2_bzBuffToBuffDecompress == NULL) {
void *h = dlopen("/usr/lib/libbz2.so.1", RTLD_LAZY);
if (h == NULL)
@@ -291,6 +298,7 @@ static long CDRinit(void)
}
}
}
+#endif
return 0;
}
diff --git a/plugins/dfinput/main.c b/plugins/dfinput/main.c
index 73b2bda..475ea07 100644
--- a/plugins/dfinput/main.c
+++ b/plugins/dfinput/main.c
@@ -8,6 +8,13 @@
* See the COPYING file in the top-level directory.
*/
+#ifndef _WIN32
+#define CALLBACK
+#else
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
#include "main.h"
unsigned char CurPad, CurByte, CurCmd, CmdLen;
@@ -15,10 +22,10 @@ unsigned char CurPad, CurByte, CurCmd, CmdLen;
/* since this is not a proper plugin, so we'll hook emu internals in a hackish way like this */
extern void *PAD1_startPoll, *PAD1_poll;
extern void *PAD2_startPoll, *PAD2_poll;
-extern unsigned char PAD1__startPoll(int pad);
-extern unsigned char PAD2__startPoll(int pad);
-extern unsigned char PAD1__poll(unsigned char value);
-extern unsigned char PAD2__poll(unsigned char value);
+extern unsigned char CALLBACK PAD1__startPoll(int pad);
+extern unsigned char CALLBACK PAD2__startPoll(int pad);
+extern unsigned char CALLBACK PAD1__poll(unsigned char value);
+extern unsigned char CALLBACK PAD2__poll(unsigned char value);
static int old_controller_type1 = -1, old_controller_type2 = -1;
diff --git a/plugins/dfsound/spu.c b/plugins/dfsound/spu.c
index 835555d..d39bbc1 100644
--- a/plugins/dfsound/spu.c
+++ b/plugins/dfsound/spu.c
@@ -18,6 +18,9 @@
* *
***************************************************************************/
+#ifndef _WIN32
+#include <sys/time.h> // gettimeofday in xa.c
+#endif
#include "stdafx.h"
#define _IN_SPU
@@ -28,16 +31,6 @@
#include "arm_features.h"
#include "spu_config.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#include <locale.h>
-#define _(x) gettext(x)
-#define N_(x) (x)
-#else
-#define _(x) (x)
-#define N_(x) (x)
-#endif
-
#ifdef __ARM_ARCH_7A__
#define ssat32_to_16(v) \
asm("ssat %0,#16,%1" : "=r" (v) : "r" (v))
diff --git a/plugins/dfsound/stdafx.h b/plugins/dfsound/stdafx.h
index 8993bb3..7e22029 100644
--- a/plugins/dfsound/stdafx.h
+++ b/plugins/dfsound/stdafx.h
@@ -15,26 +15,20 @@
* *
***************************************************************************/
-#ifndef _MACOSX
-#include "config.h"
-#endif
#include <stdio.h>
#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pthread.h>
-#define RRand(range) (random()%range)
#include <string.h>
-#include <sys/time.h>
-#include <math.h>
+#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#else
#undef CALLBACK
#define CALLBACK
#define DWORD unsigned int
-#define LOWORD(l) ((unsigned short)(l))
-#define HIWORD(l) ((unsigned short)(((unsigned int)(l) >> 16) & 0xFFFF))
+#define LOWORD(l) ((unsigned short)(l))
+#define HIWORD(l) ((unsigned short)(((unsigned int)(l) >> 16) & 0xFFFF))
+#endif
#ifndef INLINE
#define INLINE static inline
diff --git a/plugins/dfsound/xa.c b/plugins/dfsound/xa.c
index 704847b..9b7ed5a 100644
--- a/plugins/dfsound/xa.c
+++ b/plugins/dfsound/xa.c
@@ -90,9 +90,13 @@ INLINE void MixXA(int ns_to)
static unsigned long timeGetTime_spu()
{
+#ifdef _WIN32
+ return GetTickCount();
+#else
struct timeval tv;
gettimeofday(&tv, 0); // well, maybe there are better ways
return tv.tv_sec * 1000 + tv.tv_usec/1000; // to do that, but at least it works
+#endif
}
////////////////////////////////////////////////////////////////////////