From 62334ef6c00db6e3e72b9ad9eb6595ff9abb8d20 Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 16 Apr 2009 08:43:57 +0000 Subject: [PATCH] win32: add a configuration system. remove excess build configurations, which were getting hard to manage. to configure your build (such as to enable SSE2), check out the example in the defaultconfig directory. this is a bit strange. please evaluate it. --- desmume/src/matrix.h | 27 +- desmume/src/matrix_sse2-x86.asm | 20 +- desmume/src/types.h | 24 +- desmume/src/windows/DeSmuME_2005.vcproj | 377 ++---------------- desmume/src/windows/DeSmuME_2008.vcproj | 339 +--------------- desmume/src/windows/config.h | 6 + .../src/windows/defaultconfig/userconfig.h | 12 + 7 files changed, 106 insertions(+), 699 deletions(-) create mode 100644 desmume/src/windows/config.h create mode 100644 desmume/src/windows/defaultconfig/userconfig.h diff --git a/desmume/src/matrix.h b/desmume/src/matrix.h index 13afc4da9..54b7143d9 100644 --- a/desmume/src/matrix.h +++ b/desmume/src/matrix.h @@ -41,11 +41,28 @@ void MatrixInit (float *matrix); #define MATRIXFASTCALL #endif -void MATRIXFASTCALL MatrixMultVec3x3 (const float * matrix, float * vecPtr); -void MATRIXFASTCALL MatrixMultVec4x4 (const float * matrix, float * vecPtr); -void MATRIXFASTCALL MatrixMultiply (float * matrix, const float * rightMatrix); -void MATRIXFASTCALL MatrixTranslate (float *matrix, const float *ptr); -void MATRIXFASTCALL MatrixScale (float * matrix, const float * ptr); +//In order to conditionally use these asm optimized functions in visual studio +//without having to make new build types to exclude the assembly files. +//a bit sloppy, but there aint much to it +#ifdef SSE2 +#define SSE2_FUNC(X) _sse2_##X +#define MatrixMultVec4x4 _sse2_MatrixMultVec4x4 +#define MatrixMultVec3x3 _sse2_MatrixMultVec3x3 +#define MatrixMultiply _sse2_MatrixMultiply +#define MatrixTranslate _sse2_MatrixTranslate +#define MatrixScale _sse2_MatrixScale +#else +#define SSE2_FUNC(X) X +#endif + +void MATRIXFASTCALL SSE2_FUNC(MatrixMultVec3x3) (const float * matrix, float * vecPtr); +void MATRIXFASTCALL SSE2_FUNC(MatrixMultVec4x4) (const float * matrix, float * vecPtr); +void MATRIXFASTCALL SSE2_FUNC(MatrixMultiply) (float * matrix, const float * rightMatrix); +void MATRIXFASTCALL SSE2_FUNC(MatrixTranslate) (float *matrix, const float *ptr); +void MATRIXFASTCALL SSE2_FUNC(MatrixScale) (float * matrix, const float * ptr); + + + float MATRIXFASTCALL MatrixGetMultipliedIndex (int index, float *matrix, float *rightMatrix); void MATRIXFASTCALL MatrixSet (float *matrix, int x, int y, float value); void MATRIXFASTCALL MatrixCopy (float * matrixDST, const float * matrixSRC); diff --git a/desmume/src/matrix_sse2-x86.asm b/desmume/src/matrix_sse2-x86.asm index 067881592..668e488c1 100644 --- a/desmume/src/matrix_sse2-x86.asm +++ b/desmume/src/matrix_sse2-x86.asm @@ -24,7 +24,7 @@ .model flat .code -@MatrixMultVec4x4@8 PROC PUBLIC +@_sse2_MatrixMultVec4x4@8 PROC PUBLIC movaps xmm0, XMMWORD PTR [ecx] movaps xmm1, XMMWORD PTR [ecx+16] movaps xmm2, XMMWORD PTR [ecx+32] @@ -46,9 +46,9 @@ addps xmm4, xmm7 movaps XMMWORD PTR [edx], xmm4 ret 0 -@MatrixMultVec4x4@8 ENDP +@_sse2_MatrixMultVec4x4@8 ENDP -@MatrixMultVec3x3@8 PROC PUBLIC +@_sse2_MatrixMultVec3x3@8 PROC PUBLIC movaps xmm0, XMMWORD PTR [ecx] movaps xmm1, XMMWORD PTR [ecx+16] movaps xmm2, XMMWORD PTR [ecx+32] @@ -66,9 +66,9 @@ addps xmm4, xmm6 movaps XMMWORD PTR [edx], xmm4 ret 0 -@MatrixMultVec3x3@8 ENDP +@_sse2_MatrixMultVec3x3@8 ENDP -@MatrixMultiply@8 PROC PUBLIC +@_sse2_MatrixMultiply@8 PROC PUBLIC movaps xmm0, XMMWORD PTR [ecx] movaps xmm1, XMMWORD PTR [ecx+16] movaps xmm2, XMMWORD PTR [ecx+32] @@ -138,9 +138,9 @@ addps xmm4,xmm7 movaps XMMWORD PTR [ecx+48],xmm4 ret 0 -@MatrixMultiply@8 ENDP +@_sse2_MatrixMultiply@8 ENDP -@MatrixTranslate@8 PROC PUBLIC +@_sse2_MatrixTranslate@8 PROC PUBLIC movaps xmm0, XMMWORD PTR [ecx] movaps xmm1, XMMWORD PTR [ecx+16] movaps xmm2, XMMWORD PTR [ecx+32] @@ -160,9 +160,9 @@ addps xmm4, xmm3 movaps XMMWORD PTR [ecx+48], xmm4 ret 0 -@MatrixTranslate@8 ENDP +@_sse2_MatrixTranslate@8 ENDP -@MatrixScale@8 PROC PUBLIC +@_sse2_MatrixScale@8 PROC PUBLIC movaps xmm0, XMMWORD PTR [ecx] movaps xmm1, XMMWORD PTR [ecx+16] movaps xmm2, XMMWORD PTR [ecx+32] @@ -179,7 +179,7 @@ movaps XMMWORD PTR [ecx+16],xmm5 movaps XMMWORD PTR [ecx+32],xmm6 ret 0 -@MatrixScale@8 ENDP +@_sse2_MatrixScale@8 ENDP end diff --git a/desmume/src/types.h b/desmume/src/types.h index ea9c82eeb..3f193ab30 100644 --- a/desmume/src/types.h +++ b/desmume/src/types.h @@ -20,10 +20,10 @@ #ifndef TYPES_HPP #define TYPES_HPP -//-------------- -//configuration -#define DEVELOPER -//-------------- +//todo - everyone will want to support this eventually, i suppose +#ifdef _MSC_VER +#include "config.h" +#endif #define DESMUME_NAME "DeSmuME" @@ -43,20 +43,18 @@ #define DESMUME_CPUEXT_STRING "" #endif -//#ifdef DEVELOPER -//#define DESMUME_FEATURE_STRING " dev+" -//#else +#ifdef DEVELOPER +#define DESMUME_FEATURE_STRING " dev+" +#else #define DESMUME_FEATURE_STRING "" -//#endif +#endif #ifdef DEBUG #define DESMUME_SUBVERSION_STRING " debug" -#else -#ifdef RELEASE +#elif defined(PUBLIC_RELEASE) #define DESMUME_SUBVERSION_STRING "" #else -#define DESMUME_SUBVERSION_STRING " prerelease" -#endif +#define DESMUME_SUBVERSION_STRING " svn" #endif #ifdef __INTEL_COMPILER @@ -76,7 +74,7 @@ #endif #define DESMUME_VERSION_NUMERIC 90300 -#define DESMUME_VERSION_STRING " " "0.9.3 svn" DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_SUBVERSION_STRING DESMUME_COMPILER +#define DESMUME_VERSION_STRING " " "0.9.3" DESMUME_SUBVERSION_STRING DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_COMPILER #define DESMUME_NAME_AND_VERSION " " DESMUME_NAME DESMUME_VERSION_STRING #ifdef _WIN32 diff --git a/desmume/src/windows/DeSmuME_2005.vcproj b/desmume/src/windows/DeSmuME_2005.vcproj index 822cf0241..5491fa8c3 100644 --- a/desmume/src/windows/DeSmuME_2005.vcproj +++ b/desmume/src/windows/DeSmuME_2005.vcproj @@ -50,8 +50,8 @@ FavorSizeOrSpeed="0" EnableFiberSafeOptimizations="false" WholeProgramOptimization="false" - AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap" - PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;HAVE_LIBZ;HAVE_LIBZZIP;NOMINMAX;DEBUG;WANTPROGINFO;EXPERIMENTAL_WIFI" + AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig" + PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;SPU_INTERPOLATE;HAVE_LIBZ;HAVE_LIBZZIP;NOMINMAX;DEBUG;EXPERIMENTAL_WIFI" ExceptionHandling="1" BufferSecurityCheck="false" EnableEnhancedInstructionSet="0" @@ -107,96 +107,7 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -491,6 +241,10 @@ RelativePath=".\colorctrl.h" > + + @@ -586,14 +340,6 @@ - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +