From faed278acdd4ea793c9058ec28b43bae6831640a Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 8 Sep 2008 08:06:35 +0000 Subject: [PATCH] cleaning linux up after cpp --- desmume/INSTALL | 5 +--- desmume/configure.ac | 3 +++ desmume/src/MMU.cpp | 40 ------------------------------ desmume/src/arm_instructions.cpp | 2 +- desmume/src/cli/main.cpp | 6 ++--- desmume/src/ctrlssdl.cpp | 2 +- desmume/src/ctrlssdl.h | 12 ++++----- desmume/src/fs-linux.cpp | 4 +-- desmume/src/gl_vertex.h | 2 +- desmume/src/matrix.cpp | 21 ++++++++-------- desmume/src/matrix.h | 18 +++++++------- desmume/src/sndsdl.cpp | 2 +- desmume/src/thumb_instructions.cpp | 2 +- desmume/src/types.h | 2 ++ 14 files changed, 42 insertions(+), 79 deletions(-) diff --git a/desmume/INSTALL b/desmume/INSTALL index d3c5b40a9..5458714e1 100644 --- a/desmume/INSTALL +++ b/desmume/INSTALL @@ -2,7 +2,7 @@ Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007 Free Software Foundation, Inc. +2006 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -67,9 +67,6 @@ The simplest way to compile this package is: all sorts of other programs in order to regenerate files that came with the distribution. - 6. Often, you can also type `make uninstall' to remove the installed - files again. - Compilers and Options ===================== diff --git a/desmume/configure.ac b/desmume/configure.ac index 12097616a..512ed0b32 100644 --- a/desmume/configure.ac +++ b/desmume/configure.ac @@ -18,6 +18,9 @@ AM_INIT_AUTOMAKE dnl -- make sure we have a C compiler AC_PROG_CC +dnl -- make sure we have a c++ compiler +AC_PROG_CXX + dnl -- use ranlib for libraries AC_PROG_RANLIB diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 95376ebe6..70b22da8b 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -3490,18 +3490,6 @@ arm7_write32(void *data, u32 adr, u32 val) { * the base memory interfaces */ struct armcpu_memory_iface arm9_base_memory_iface = { -#ifdef __GNUC__ - .prefetch32 = arm9_prefetch32, - .prefetch16 = arm9_prefetch16, - - .read8 = arm9_read8, - .read16 = arm9_read16, - .read32 = arm9_read32, - - .write8 = arm9_write8, - .write16 = arm9_write16, - .write32 = arm9_write32 -#else arm9_prefetch32, arm9_prefetch16, @@ -3512,22 +3500,9 @@ struct armcpu_memory_iface arm9_base_memory_iface = { arm9_write8, arm9_write16, arm9_write32 -#endif }; struct armcpu_memory_iface arm7_base_memory_iface = { -#ifdef __GNUC__ - .prefetch32 = arm7_prefetch32, - .prefetch16 = arm7_prefetch16, - - .read8 = arm7_read8, - .read16 = arm7_read16, - .read32 = arm7_read32, - - .write8 = arm7_write8, - .write16 = arm7_write16, - .write32 = arm7_write32 -#else arm7_prefetch32, arm7_prefetch16, @@ -3538,7 +3513,6 @@ struct armcpu_memory_iface arm7_base_memory_iface = { arm7_write8, arm7_write16, arm7_write32 -#endif }; /* @@ -3547,19 +3521,6 @@ struct armcpu_memory_iface arm7_base_memory_iface = { * memory. */ struct armcpu_memory_iface arm9_direct_memory_iface = { -#ifdef __GNUC__ - /* the prefetch is not used */ - .prefetch32 = NULL, - .prefetch16 = NULL, - - .read8 = arm9_read8, - .read16 = arm9_read16, - .read32 = arm9_read32, - - .write8 = arm9_write8, - .write16 = arm9_write16, - .write32 = arm9_write32 -#else NULL, NULL, @@ -3570,5 +3531,4 @@ struct armcpu_memory_iface arm9_direct_memory_iface = { arm9_write8, arm9_write16, arm9_write32 -#endif }; diff --git a/desmume/src/arm_instructions.cpp b/desmume/src/arm_instructions.cpp index 3d799130f..d593b91f5 100644 --- a/desmume/src/arm_instructions.cpp +++ b/desmume/src/arm_instructions.cpp @@ -31,7 +31,7 @@ #include "debug.h" #include "MMU.h" -BOOL execute; +extern volatile BOOL execute; // Use this macros for reading/writing, so the GDB stub isn't broken #ifdef GDB_STUB diff --git a/desmume/src/cli/main.cpp b/desmume/src/cli/main.cpp index 2a379c8a2..e93ef9add 100644 --- a/desmume/src/cli/main.cpp +++ b/desmume/src/cli/main.cpp @@ -18,8 +18,8 @@ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ -#include "SDL.h" -#include "SDL_thread.h" +#include +#include #include #include #include @@ -287,7 +287,7 @@ createThread_gdb( void (*thread_function)( void *data), void joinThread_gdb( void *thread_handle) { int ignore; - SDL_WaitThread( thread_handle, &ignore); + SDL_WaitThread( (SDL_Thread*)thread_handle, &ignore); } diff --git a/desmume/src/ctrlssdl.cpp b/desmume/src/ctrlssdl.cpp index 93f3833db..8851b4fa4 100644 --- a/desmume/src/ctrlssdl.cpp +++ b/desmume/src/ctrlssdl.cpp @@ -95,7 +95,7 @@ BOOL init_joy( void) { if ( nbr_joy > 0) { open_joysticks = - calloc( sizeof ( SDL_Joystick *), nbr_joy); + (SDL_Joystick**)calloc( sizeof ( SDL_Joystick *), nbr_joy); if ( open_joysticks != NULL) { for (i = 0; i < nbr_joy; i++) diff --git a/desmume/src/ctrlssdl.h b/desmume/src/ctrlssdl.h index 19257ea2a..b780b3543 100644 --- a/desmume/src/ctrlssdl.h +++ b/desmume/src/ctrlssdl.h @@ -27,7 +27,7 @@ #include #include //#include -#include +#include #include "MMU.h" #include "types.h" @@ -55,13 +55,13 @@ #define KEY_BOOST 14 /* Keypad key names */ -const char *key_names[NB_KEYS]; +extern const char *key_names[NB_KEYS]; /* Current keyboard configuration */ -u16 keyboard_cfg[NB_KEYS]; +extern u16 keyboard_cfg[NB_KEYS]; /* Current joypad configuration */ -u16 joypad_cfg[NB_KEYS]; +extern u16 joypad_cfg[NB_KEYS]; /* Number of detected joypads */ -u16 nbr_joy; +extern u16 nbr_joy; #ifndef GTK_UI struct mouse_status @@ -72,7 +72,7 @@ struct mouse_status BOOL down; }; -struct mouse_status mouse; +extern mouse_status mouse; void set_mouse_coord(signed long x,signed long y); #endif // !GTK_UI diff --git a/desmume/src/fs-linux.cpp b/desmume/src/fs-linux.cpp index d01b03c26..7556a6f3c 100644 --- a/desmume/src/fs-linux.cpp +++ b/desmume/src/fs-linux.cpp @@ -48,7 +48,7 @@ void * FsReadFirst(const char * path, FsEntry * entry) { if (!e) return NULL; - dir = malloc(sizeof(FsLinuxDir)); + dir = (FsLinuxDir*)malloc(sizeof(FsLinuxDir)); dir->dir = tmp; strcpy(entry->cFileName, e->d_name); @@ -72,7 +72,7 @@ void * FsReadFirst(const char * path, FsEntry * entry) { } int FsReadNext(void * search, FsEntry * entry) { - FsLinuxDir * dir = search; + FsLinuxDir * dir = (FsLinuxDir*)search; struct dirent * e; struct stat s; char buffer[1024]; diff --git a/desmume/src/gl_vertex.h b/desmume/src/gl_vertex.h index 8807ea9df..ae698b785 100755 --- a/desmume/src/gl_vertex.h +++ b/desmume/src/gl_vertex.h @@ -26,7 +26,7 @@ #include "registers.h" #define CHECK_3D_ATTEMPT attempted_3D_op=TRUE; -BOOL attempted_3D_op; +extern BOOL attempted_3D_op; #define MTX_MODE_PROJECTION 0 #define MTX_MODE_POSITION 1 diff --git a/desmume/src/matrix.cpp b/desmume/src/matrix.cpp index b5b240abb..66132357b 100644 --- a/desmume/src/matrix.cpp +++ b/desmume/src/matrix.cpp @@ -33,7 +33,7 @@ void MatrixInit (float *matrix) } #ifndef SSE2 -void __fastcall MatrixMultVec4x4 (const float *matrix, float *vecPtr) +void FASTCALL MatrixMultVec4x4 (const float *matrix, float *vecPtr) { float x = vecPtr[0]; float y = vecPtr[1]; @@ -46,7 +46,7 @@ void __fastcall MatrixMultVec4x4 (const float *matrix, float *vecPtr) vecPtr[3] = x * matrix[3] + y * matrix[7] + z * matrix[11] + w * matrix[15]; } -void __fastcall MatrixMultVec3x3 (const float *matrix, float *vecPtr) +void FASTCALL MatrixMultVec3x3 (const float *matrix, float *vecPtr) { float x = vecPtr[0]; float y = vecPtr[1]; @@ -57,7 +57,7 @@ void __fastcall MatrixMultVec3x3 (const float *matrix, float *vecPtr) vecPtr[2] = x * matrix[2] + y * matrix[6] + z * matrix[10]; } -void __fastcall MatrixMultiply (float *matrix, const float *rightMatrix) +void FASTCALL MatrixMultiply (float *matrix, const float *rightMatrix) { float tmpMatrix[16]; @@ -84,7 +84,7 @@ void __fastcall MatrixMultiply (float *matrix, const float *rightMatrix) memcpy (matrix, tmpMatrix, sizeof(float)*16); } -void __fastcall MatrixTranslate (float *matrix, const float *ptr) +void FASTCALL MatrixTranslate (float *matrix, const float *ptr) { matrix[12] += (matrix[0]*ptr[0])+(matrix[4]*ptr[1])+(matrix[ 8]*ptr[2]); matrix[13] += (matrix[1]*ptr[0])+(matrix[5]*ptr[1])+(matrix[ 9]*ptr[2]); @@ -92,7 +92,7 @@ void __fastcall MatrixTranslate (float *matrix, const float *ptr) matrix[15] += (matrix[3]*ptr[0])+(matrix[7]*ptr[1])+(matrix[11]*ptr[2]); } -void __fastcall MatrixScale (float *matrix, const float *ptr) +void FASTCALL MatrixScale (float *matrix, const float *ptr) { matrix[0] *= ptr[0]; matrix[1] *= ptr[0]; @@ -125,13 +125,13 @@ void MatrixTranspose(float *matrix) #undef swap } -void __fastcall MatrixIdentity (float *matrix) //============== TODO +void FASTCALL MatrixIdentity (float *matrix) //============== TODO { memset (matrix, 0, sizeof(float)*16); matrix[0] = matrix[5] = matrix[10] = matrix[15] = 1.f; } -float __fastcall MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix) +float FASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix) { int iMod = index%4, iDiv = (index>>2)<<2; @@ -139,12 +139,12 @@ float __fastcall MatrixGetMultipliedIndex (int index, float *matrix, float *righ (matrix[iMod+8]*rightMatrix[iDiv+2])+(matrix[iMod+12]*rightMatrix[iDiv+3]); } -void __fastcall MatrixSet (float *matrix, int x, int y, float value) // TODO +void FASTCALL MatrixSet (float *matrix, int x, int y, float value) // TODO { matrix [x+(y<<2)] = value; } -void __fastcall MatrixCopy (float* matrixDST, const float* matrixSRC) +void FASTCALL MatrixCopy (float* matrixDST, const float* matrixSRC) { memcpy ((void*)matrixDST, matrixSRC, sizeof(float)*16); } @@ -267,4 +267,5 @@ void Vector4Copy(float *dst, const float *src) dst[3] = src[3]; } -} //extern "C" \ No newline at end of file +} //extern "C" + diff --git a/desmume/src/matrix.h b/desmume/src/matrix.h index 04fdeb772..3cf795bc9 100644 --- a/desmume/src/matrix.h +++ b/desmume/src/matrix.h @@ -47,15 +47,15 @@ typedef struct MatrixStack void MatrixInit (float *matrix); -void __fastcall MatrixMultVec3x3 (const float * matrix, float * vecPtr); -void __fastcall MatrixMultVec4x4 (const float * matrix, float * vecPtr); -void __fastcall MatrixMultiply (float * matrix, const float * rightMatrix); -void __fastcall MatrixTranslate (float *matrix, const float *ptr); -void __fastcall MatrixScale (float * matrix, const float * ptr); -float __fastcall MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix); -void __fastcall MatrixSet (float *matrix, int x, int y, float value); -void __fastcall MatrixCopy (float * matrixDST, const float * matrixSRC); -void __fastcall MatrixIdentity (float *matrix); +void FASTCALL MatrixMultVec3x3 (const float * matrix, float * vecPtr); +void FASTCALL MatrixMultVec4x4 (const float * matrix, float * vecPtr); +void FASTCALL MatrixMultiply (float * matrix, const float * rightMatrix); +void FASTCALL MatrixTranslate (float *matrix, const float *ptr); +void FASTCALL MatrixScale (float * matrix, const float * ptr); +float FASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix); +void FASTCALL MatrixSet (float *matrix, int x, int y, float value); +void FASTCALL MatrixCopy (float * matrixDST, const float * matrixSRC); +void FASTCALL MatrixIdentity (float *matrix); void MatrixTranspose (float *matrix); void MatrixStackInit (MatrixStack *stack); diff --git a/desmume/src/sndsdl.cpp b/desmume/src/sndsdl.cpp index 342b77b49..74fbd9f8e 100644 --- a/desmume/src/sndsdl.cpp +++ b/desmume/src/sndsdl.cpp @@ -20,7 +20,7 @@ #include #include -#include "SDL.h" +#include #include "types.h" #include "SPU.h" #include "sndsdl.h" diff --git a/desmume/src/thumb_instructions.cpp b/desmume/src/thumb_instructions.cpp index f592a62bb..145a7f4f9 100644 --- a/desmume/src/thumb_instructions.cpp +++ b/desmume/src/thumb_instructions.cpp @@ -35,7 +35,7 @@ #define REG_NUM(i, n) (((i)>>n)&0x7) -extern BOOL execute; +extern volatile BOOL execute; // Use this macros for reading/writing, so the GDB stub isn't broken #ifdef GDB_STUB diff --git a/desmume/src/types.h b/desmume/src/types.h index d356b446a..7ce9a1dcb 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -27,6 +27,8 @@ #define FASTCALL __attribute__((fastcall)) #elif defined (__i386__) #define FASTCALL __attribute__((regparm(3))) +#elif defined _MSC_VER +#define FASTCALL __fastcall #else #define FASTCALL #endif