Fix linux build and a crash. hrm, how did it work before...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@146 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-08-07 19:20:51 +00:00
parent f46c64c02f
commit ac366022f4
8 changed files with 16 additions and 9 deletions

View File

@ -22,7 +22,7 @@
namespace namespace
{ {
PanicAlertHandler panic_handler = 0; static PanicAlertHandler panic_handler = 0;
} }
void RegisterPanicAlertHandler(PanicAlertHandler handler) void RegisterPanicAlertHandler(PanicAlertHandler handler)

View File

@ -46,7 +46,7 @@ extern "C" {
#define MAX_PATH 260 #define MAX_PATH 260
#define WEAK_SYMBOL __attribute__((weak)) #define WEAK_SYMBOL __attribute__((weak))
#define stricmp strcasecmp #define stricmp strcasecmp
#define Crash() {__builtin_trap();} #define Crash() {asm ("int $3");}
// #ifdef 64bit // #ifdef 64bit
// #define _M_IX86 // #define _M_IX86
// #else // #else

View File

@ -162,7 +162,7 @@ void StringFromFormatV(std::string* out, const char* format, va_list args)
while (writtenCount < 0) while (writtenCount < 0)
{ {
delete[] buf; delete [] buf;
buf = new char[newSize + 1]; buf = new char[newSize + 1];
writtenCount = vsnprintf(buf, newSize, format, args); writtenCount = vsnprintf(buf, newSize, format, args);
newSize *= 2; newSize *= 2;

View File

@ -23,6 +23,8 @@ namespace Gen
{ {
static u8 *code; static u8 *code;
static bool mode32 = false; static bool mode32 = false;
static bool enableBranchHints = false;
void SetCodePtr(u8 *ptr) void SetCodePtr(u8 *ptr)
{ {
@ -350,8 +352,6 @@ namespace Gen
return branch; return branch;
} }
static bool enableBranchHints = false;
// These are to be used with Jcc only. // These are to be used with Jcc only.
// Found in intel manual 2A // Found in intel manual 2A
// These do not really make a difference for any current X86 CPU, // These do not really make a difference for any current X86 CPU,
@ -1221,10 +1221,12 @@ namespace Gen
#ifdef _M_IX86 #ifdef _M_IX86
// Don't really need to do anything // Don't really need to do anything
#elif defined(_M_X64) #elif defined(_M_X64)
#if _WIN32
int stacksize = ((maxCallParams+1)&~1)*8 + 8; int stacksize = ((maxCallParams+1)&~1)*8 + 8;
// Set up a stack frame so that we can call functions // Set up a stack frame so that we can call functions
// TODO: use maxCallParams // TODO: use maxCallParams
SUB(64, R(RSP), Imm8(stacksize)); SUB(64, R(RSP), Imm8(stacksize));
#endif
#else #else
#error Arch not supported #error Arch not supported
#endif #endif
@ -1234,15 +1236,17 @@ namespace Gen
#ifdef _M_IX86 #ifdef _M_IX86
RET(); RET();
#elif defined(_M_X64) #elif defined(_M_X64)
#ifdef _WIN32
int stacksize = ((maxCallParams+1)&~1)*8 + 8; int stacksize = ((maxCallParams+1)&~1)*8 + 8;
ADD(64, R(RSP), Imm8(stacksize)); ADD(64, R(RSP), Imm8(stacksize));
#endif
RET(); RET();
#else #else
#error Arch not supported #error Arch not supported
#endif #endif
} }
} } // namespace
// helper routines for setting pointers // helper routines for setting pointers

View File

@ -198,4 +198,5 @@ struct Viewport
extern XFRegisters xfregs; extern XFRegisters xfregs;
extern u32 xfmem[XFMEM_SIZE]; extern u32 xfmem[XFMEM_SIZE];
#endif #endif

View File

@ -99,13 +99,14 @@ struct RECT
#endif #endif
// several macros // several macros
// PLEASE DO NOT USE THE FOLLOWING SAFE*
// They only encourage sloppy coding, and hides bugs.
#ifndef SAFE_DELETE_ARRAY #ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(x) if( (x) != NULL ) { delete[] (x); (x) = NULL; } #define SAFE_DELETE_ARRAY(x) if( (x) != NULL ) { delete[] (x); (x) = NULL; }
#endif #endif
#ifndef SAFE_RELEASE #ifndef SAFE_RELEASE
#define SAFE_RELEASE(x) if( (x) != NULL ) { (x)->Release(); (x) = NULL; } #define SAFE_RELEASE(x) if( (x) != NULL ) { (x)->Release(); (x) = NULL; }
#endif #endif
#define SAFE_RELEASE_CGPROG(x) { if( (x) != NULL ) { cgDestroyProgram(x); x = NULL; } } #define SAFE_RELEASE_CGPROG(x) { if( (x) != NULL ) { cgDestroyProgram(x); x = NULL; } }
#define SAFE_RELEASE_PROG(x) { if( (x) != 0 ) { glDeleteProgramsARB(1, &(x)); x = 0; } } #define SAFE_RELEASE_PROG(x) { if( (x) != 0 ) { glDeleteProgramsARB(1, &(x)); x = 0; } }
#define SAFE_RELEASE_TEX(x) { if( (x) != 0 ) { glDeleteTextures(1, &(x)); x = 0; } } #define SAFE_RELEASE_TEX(x) { if( (x) != 0 ) { glDeleteTextures(1, &(x)); x = 0; } }

View File

@ -80,7 +80,7 @@ void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0& newmode)
void TextureMngr::TCacheEntry::Destroy() void TextureMngr::TCacheEntry::Destroy()
{ {
SAFE_RELEASE_TEX((GLuint)texture); SAFE_RELEASE_TEX(texture);
} }
void TextureMngr::Init() void TextureMngr::Init()

View File

@ -85,3 +85,4 @@ public:
}; };
#endif #endif