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> v;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@
#include "path.h"
#ifdef _MSC_VER
#ifdef _WINDOWS
#include "windows/main.h"
#endif
@ -1177,7 +1177,7 @@ bool savestate_load(EMUFILE* is)
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");
#ifdef _MSC_VER
#ifdef _WINDOWS
//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);
#endif

View File

@ -26,6 +26,12 @@
#include "sndsdl.h"
#include "debug.h"
#ifdef _XBOX
#include <xtl.h>
#include <VectorIntrinsics.h>
#include <process.h>
#endif
int SNDSDLInit(int buffersize);
void SNDSDLDeInit();
void SNDSDLUpdateAudio(s16 *buffer, u32 num_samples);
@ -54,6 +60,24 @@ static u32 soundbufsize;
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) {
int i;
@ -108,6 +132,12 @@ int SNDSDLInit(int buffersize)
SDL_PauseAudio(0);
#ifdef _XBOX
doterminate = false;
terminated = false;
CreateThread(0,0,SNDXBOXThread,0,0,0);
#endif
return 0;
}
@ -115,6 +145,12 @@ int SNDSDLInit(int buffersize)
void SNDSDLDeInit()
{
#ifdef _XBOX
doterminate = true;
while(!terminated) {
Sleep(1);
}
#endif
SDL_CloseAudio();
if (stereodata16)

View File

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

View File

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

View File

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

View File

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