check in all the xbox compile fixes after tweaking some things. looks benign. need to test compilation in nix still

This commit is contained in:
zeromus 2010-03-26 18:22:46 +00:00
parent 68bc1d1901
commit 9e776c48ca
18 changed files with 122 additions and 41 deletions

View File

@ -333,7 +333,7 @@ void GameInfo::populate()
} }
} }
#ifdef WIN32 #ifdef _WINDOWS
static std::vector<char> buffer; static std::vector<char> buffer;
static std::vector<char> v; static std::vector<char> v;

View File

@ -33,7 +33,7 @@
#include <string> #include <string>
#if defined(WIN32) && !defined(WXPORT) #if defined(_WINDOWS) && !defined(WXPORT)
#include "pathsettings.h" #include "pathsettings.h"
#endif #endif

View File

@ -36,9 +36,10 @@
#define CHANSTAT_STOPPED 0 #define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1 #define CHANSTAT_PLAY 1
static FORCEINLINE u32 sputrunc(float f) { return u32floor(f); } //who made these static? theyre used in multiple places.
static FORCEINLINE u32 sputrunc(double d) { return u32floor(d); } FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
static FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) { FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127); assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7); return (multiplier == 127) ? val : ((val * multiplier) >> 7);
} }

View File

@ -30,7 +30,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef _XBOX && WIN32 #ifdef _MSC_VER
#include <io.h> #include <io.h>
#define OPEN_MODE _O_RDWR | _O_BINARY #define OPEN_MODE _O_RDWR | _O_BINARY

View File

@ -495,11 +495,9 @@ void gfx3d_init()
void gfx3d_reset() void gfx3d_reset()
{ {
#ifndef _XBOX //if this doesn't work on the xbox, we need to find out why.
gfx3d = GFX3D(); reconstruct(&gfx3d);
#else
GFX3D();
#endif
gxf_hardware.reset(); gxf_hardware.reset();
control = 0; control = 0;

View File

@ -232,10 +232,11 @@ FIRFilter * FIRFilter::newInstance()
{ {
uint uExtensions = 0; uint uExtensions = 0;
#ifndef _XBOX
#if !defined(_MSC_VER) || !defined(__x86_64__) #if !defined(_MSC_VER) || !defined(__x86_64__)
uExtensions = detectCPUextensions(); uExtensions = detectCPUextensions();
#endif #endif
#endif
// Check if MMX/SSE/3DNow! instruction set extensions supported by CPU // Check if MMX/SSE/3DNow! instruction set extensions supported by CPU
#ifdef ALLOW_MMX #ifdef ALLOW_MMX

View File

@ -190,10 +190,11 @@ namespace soundtouch
#if _WIN32 #if _WIN32
// #define ALLOW_3DNOW 1 // #define ALLOW_3DNOW 1
#endif #endif
#ifndef _XBOX
#if (_WIN32 || __i386__ || __x86_64__) #if (_WIN32 || __i386__ || __x86_64__)
#define ALLOW_SSE 1 #define ALLOW_SSE 1
#endif #endif
#endif
#endif #endif
#endif // INTEGER_SAMPLES #endif // INTEGER_SAMPLES

View File

@ -670,11 +670,11 @@ void * TDStretch::operator new(size_t s)
TDStretch * TDStretch::newInstance() TDStretch * TDStretch::newInstance()
{ {
uint uExtensions = 0; uint uExtensions = 0;
#ifndef _XBOX
#if !defined(_MSC_VER) || !defined(__x86_64__) #if !defined(_MSC_VER) || !defined(__x86_64__)
uExtensions = detectCPUextensions(); uExtensions = detectCPUextensions();
#endif #endif
#endif
// Check if MMX/SSE/3DNow! instruction set extensions supported by CPU // Check if MMX/SSE/3DNow! instruction set extensions supported by CPU
#ifdef ALLOW_MMX #ifdef ALLOW_MMX

View File

@ -16,8 +16,9 @@
*/ */
#pragma once #pragma once
#ifdef _XBOX
#ifdef _WIN32 #include <xtl.h>
#elif _WIN32
#include <windows.h> #include <windows.h>
#endif #endif

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define WIN32_LEAN_AND_MEAN
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>
#include "utils/guid.h" #include "utils/guid.h"

View File

@ -1,6 +1,6 @@
#include <string> #include <string>
#if defined(WIN32) && !defined(WXPORT) #if defined(_WINDOWS) && !defined(WXPORT)
#include "resource.h" #include "resource.h"
#else #else
#include <glib.h> #include <glib.h>
@ -76,9 +76,12 @@ public:
void LoadModulePath() void LoadModulePath()
{ {
#ifdef WIN32 #ifndef _XBOX
#if defined(_WINDOWS)
char *p; char *p;
ZeroMemory(pathToModule, sizeof(pathToModule)); ZeroMemory(pathToModule, sizeof(pathToModule));
GetModuleFileName(NULL, pathToModule, sizeof(pathToModule)); GetModuleFileName(NULL, pathToModule, sizeof(pathToModule));
p = pathToModule + lstrlen(pathToModule); p = pathToModule + lstrlen(pathToModule);
while (p >= pathToModule && *p != '\\') p--; while (p >= pathToModule && *p != '\\') p--;
@ -88,6 +91,7 @@ public:
g_mkdir_with_parents(cwd, 0755); g_mkdir_with_parents(cwd, 0755);
strncpy(pathToModule, cwd, MAX_PATH); strncpy(pathToModule, cwd, MAX_PATH);
g_free(cwd); g_free(cwd);
#endif
#endif #endif
} }
@ -104,7 +108,7 @@ public:
void ReadKey(char *pathToRead, const char *key) void ReadKey(char *pathToRead, const char *key)
{ {
#ifdef WIN32 #ifdef _WINDOWS
GetPrivateProfileString(SECTION, key, key, pathToRead, MAX_PATH, IniName); GetPrivateProfileString(SECTION, key, key, pathToRead, MAX_PATH, IniName);
if(strcmp(pathToRead, key) == 0) { if(strcmp(pathToRead, key) == 0) {
//since the variables are all intialized in this file they all use MAX_PATH //since the variables are all intialized in this file they all use MAX_PATH
@ -130,7 +134,7 @@ public:
ReadKey(pathToSounds, SOUNDKEY); ReadKey(pathToSounds, SOUNDKEY);
ReadKey(pathToFirmware, FIRMWAREKEY); ReadKey(pathToFirmware, FIRMWAREKEY);
ReadKey(pathToLua, LUAKEY); ReadKey(pathToLua, LUAKEY);
#ifdef WIN32 #ifdef _WINDOWS
GetPrivateProfileString(SECTION, FORMATKEY, "%f_%s_%r", screenshotFormat, MAX_FORMAT, IniName); GetPrivateProfileString(SECTION, FORMATKEY, "%f_%s_%r", screenshotFormat, MAX_FORMAT, IniName);
savelastromvisit = GetPrivateProfileBool(SECTION, LASTVISITKEY, true, IniName); savelastromvisit = GetPrivateProfileBool(SECTION, LASTVISITKEY, true, IniName);
currentimageformat = (ImageFormat)GetPrivateProfileInt(SECTION, DEFAULTFORMATKEY, PNG, IniName); currentimageformat = (ImageFormat)GetPrivateProfileInt(SECTION, DEFAULTFORMATKEY, PNG, IniName);
@ -312,7 +316,7 @@ public:
enum ImageFormat enum ImageFormat
{ {
#if defined(WIN32) && !defined(WXPORT) #if defined(_WINDOWS) && !defined(WXPORT)
PNG = IDC_PNG, PNG = IDC_PNG,
BMP = IDC_BMP BMP = IDC_BMP
#else #else

View File

@ -25,12 +25,14 @@
extern GPU3DInterface gpu3DRasterize; extern GPU3DInterface gpu3DRasterize;
union FragmentColor union FragmentColor {
{
u32 color; u32 color;
struct struct {
{ #ifdef WORDS_BIGENDIAN
u8 a,b,g,r;
#else
u8 r,g,b,a; u8 r,g,b,a;
#endif
}; };
}; };

View File

@ -46,7 +46,7 @@
#include "path.h" #include "path.h"
#ifdef _MSC_VER #ifdef _WINDOWS
#include "windows/main.h" #include "windows/main.h"
#endif #endif
@ -1177,7 +1177,7 @@ bool savestate_load(EMUFILE* is)
if(!x && !SAV_silent_fail_flag) if(!x && !SAV_silent_fail_flag)
{ {
printf("Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked"); printf("Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked");
#ifdef _MSC_VER #ifdef _WINDOWS
//HACK! we really need a better way to handle this kind of feedback //HACK! we really need a better way to handle this kind of feedback
MessageBox(0,"Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked",0,0); MessageBox(0,"Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked",0,0);
#endif #endif

View File

@ -26,6 +26,12 @@
#include "sndsdl.h" #include "sndsdl.h"
#include "debug.h" #include "debug.h"
#ifdef _XBOX
#include <xtl.h>
#include <VectorIntrinsics.h>
#include <process.h>
#endif
int SNDSDLInit(int buffersize); int SNDSDLInit(int buffersize);
void SNDSDLDeInit(); void SNDSDLDeInit();
void SNDSDLUpdateAudio(s16 *buffer, u32 num_samples); void SNDSDLUpdateAudio(s16 *buffer, u32 num_samples);
@ -54,6 +60,24 @@ static u32 soundbufsize;
static SDL_AudioSpec audiofmt; static SDL_AudioSpec audiofmt;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#ifdef _XBOX
static volatile bool doterminate;
static volatile bool terminated;
DWORD WINAPI SNDXBOXThread( LPVOID )
{
for(;;) {
if(doterminate) break;
{
SPU_Emulate_user();
}
Sleep(10);
}
terminated = true;
return 0;
}
#endif
static void MixAudio(void *userdata, Uint8 *stream, int len) { static void MixAudio(void *userdata, Uint8 *stream, int len) {
int i; int i;
@ -108,6 +132,12 @@ int SNDSDLInit(int buffersize)
SDL_PauseAudio(0); SDL_PauseAudio(0);
#ifdef _XBOX
doterminate = false;
terminated = false;
CreateThread(0,0,SNDXBOXThread,0,0,0);
#endif
return 0; return 0;
} }
@ -115,6 +145,12 @@ int SNDSDLInit(int buffersize)
void SNDSDLDeInit() void SNDSDLDeInit()
{ {
#ifdef _XBOX
doterminate = true;
while(!terminated) {
Sleep(1);
}
#endif
SDL_CloseAudio(); SDL_CloseAudio();
if (stereodata16) if (stereodata16)

View File

@ -21,18 +21,38 @@
#ifndef TYPES_HPP #ifndef TYPES_HPP
#define TYPES_HPP #define TYPES_HPP
//todo - everyone will want to support this eventually, i suppose //analyze microsoft compilers
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef _XBOX
//#define _XBOX //already defined
#else
#define _WINDOWS
#ifdef _M_X64
#define _WIN64
#else
//#define _WIN32 //already defined
#endif
#endif
#endif
//todo - everyone will want to support this eventually, i suppose
#ifdef _WINDOWS
#include "config.h" #include "config.h"
#endif #endif
//xbox needs to include this to resemble windows
#ifdef _XBOX
#include <xtl.h>
#include <io.h>
#endif
#ifdef DEVELOPER #ifdef DEVELOPER
#define IF_DEVELOPER(X) X #define IF_DEVELOPER(X) X
#else #else
#define IF_DEVELOPER(X) #define IF_DEVELOPER(X)
#endif #endif
#ifdef _MSC_VER #ifdef _WINDOWS
#define HAVE_WX #define HAVE_WX
#define HAVE_LIBAGG #define HAVE_LIBAGG
#define ENABLE_SSE #define ENABLE_SSE
@ -59,7 +79,7 @@
#undef ENABLE_SSE2 #undef ENABLE_SSE2
#endif #endif
#ifdef _WIN32 #ifdef _MSC_VER
#define strcasecmp(x,y) _stricmp(x,y) #define strcasecmp(x,y) _stricmp(x,y)
#define snprintf _snprintf #define snprintf _snprintf
#else #else
@ -75,6 +95,13 @@
#endif #endif
#endif #endif
#ifdef _XBOX
#define MAX_PATH 1024
#define PATH_MAX 1024
#endif
#if defined(_MSC_VER) || defined(__INTEL_COMPILER) #if defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define ALIGN(X) __declspec(align(X)) #define ALIGN(X) __declspec(align(X))
#elif __GNUC__ #elif __GNUC__
@ -418,4 +445,11 @@ char (*BLAHBLAHBLAH( UNALIGNED T (&)[N] ))[N];
static const char hexValid[23] = {"0123456789ABCDEFabcdef"}; static const char hexValid[23] = {"0123456789ABCDEFabcdef"};
template<typename T> inline void reconstruct(T* t) {
t->~T();
new(t) T();
}
#endif #endif

View File

@ -17,13 +17,17 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "types.h"
#include "task.h" #include "task.h"
#ifdef _WIN32
#include <windows.h>
#include <stdio.h> #include <stdio.h>
#ifdef _MSC_VER
#ifdef _WINDOWS
#include <windows.h>
#endif
class Task::Impl { class Task::Impl {
public: public:
Impl(); Impl();

View File

@ -21,7 +21,7 @@
#include "version.h" #include "version.h"
//todo - everyone will want to support this eventually, i suppose //todo - everyone will want to support this eventually, i suppose
#if defined(_MSC_VER) && !defined(WXPORT) #if defined(_WINDOWS) && !defined(WXPORT)
#include "svnrev.h" #include "svnrev.h"
#else #else
#ifdef SVN_REV #ifdef SVN_REV

View File

@ -26,8 +26,7 @@
#include "bits.h" #include "bits.h"
#ifdef _WINDOWS
#ifdef WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#define socket_t SOCKET #define socket_t SOCKET
@ -52,12 +51,11 @@
#define BASEPORT 7000 #define BASEPORT 7000
socket_t wifi_socket = INVALID_SOCKET;
sockaddr_t sendAddr;
const u8 BroadcastMAC[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; const u8 BroadcastMAC[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
#ifdef EXPERIMENTAL_WIFI_COMM #ifdef EXPERIMENTAL_WIFI_COMM
socket_t wifi_socket = INVALID_SOCKET;
sockaddr_t sendAddr;
#ifndef WIN32 #ifndef WIN32
#include "pcap/pcap.h" #include "pcap/pcap.h"
#endif #endif