From 5e8fa718c6e00fd760886227ce1c614e8a0e01fe Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 17 Jul 2010 10:56:58 +0000 Subject: [PATCH] win32: fix matrixview (which was broken during fixedpoint conversions) --- desmume/src/gfx3d.cpp | 6 +++ desmume/src/path.h | 62 +++++++++++++++--------------- desmume/src/windows/matrixView.cpp | 8 ++-- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index 465fe4547..de591b6fa 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -2266,6 +2266,12 @@ void gfx3d_glGetMatrix(unsigned int m_mode, int index, float* dest) //} //MatrixCopy(dest, MatrixStackGetPos(&mtxStack[m_mode], index)); + s32* src; + if(index==-1) + src = mtxCurrent[m_mode]; + else src=MatrixStackGetPos(&mtxStack[m_mode],index); + for(int i=0;i<16;i++) + dest[i] = src[i]/4096.0f; } void gfx3d_glGetLightDirection(unsigned int index, unsigned int* dest) diff --git a/desmume/src/path.h b/desmume/src/path.h index 4ae029c78..775672156 100644 --- a/desmume/src/path.h +++ b/desmume/src/path.h @@ -4,58 +4,58 @@ #define mkdir _mkdir #endif -#if defined(_WINDOWS) +#if defined(_WINDOWS) #include #if !defined(WXPORT) #include "resource.h" #else #include #endif /* !WXPORT */ -#else -#include +#else +#include #endif /* _WINDOWS */ - + #include "time.h" #include "utils/xstring.h" //----------------------------------- //This is taken from mono Path.cs -static const char InvalidPathChars[] = { - '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', - '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12', - '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D', - '\x1E', '\x1F' +static const char InvalidPathChars[] = { + '\x22', '\x3C', '\x3E', '\x7C', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', + '\x08', '\x09', '\x0A', '\x0B', '\x0C', '\x0D', '\x0E', '\x0F', '\x10', '\x11', '\x12', + '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1A', '\x1B', '\x1C', '\x1D', + '\x1E', '\x1F' }; //but it is sort of windows-specific. Does it work in linux? Maybe we'll have to make it smarter -static const char VolumeSeparatorChar = ':'; -static const char DirectorySeparatorChar = '\\'; -static const char AltDirectorySeparatorChar = '/'; +static const char VolumeSeparatorChar = ':'; +static const char DirectorySeparatorChar = '\\'; +static const char AltDirectorySeparatorChar = '/'; static bool dirEqualsVolume = (DirectorySeparatorChar == VolumeSeparatorChar); class Path { -public: - static bool IsPathRooted (const std::string& path) - { - if (path.size() == 0) - return false; - - - if (path.find_first_of(InvalidPathChars) != -1) - { - //yuck. - //throw new ArgumentException ("Illegal characters in path."); - } - - char c = path [0]; - return (c == DirectorySeparatorChar || - c == AltDirectorySeparatorChar || - (!dirEqualsVolume && path.size() > 1 && path [1] == VolumeSeparatorChar)); +public: + static bool IsPathRooted (const std::string& path) + { + if (path.size() == 0) + return false; + + + if (path.find_first_of(InvalidPathChars) != -1) + { + //yuck. + //throw new ArgumentException ("Illegal characters in path."); + } + + char c = path [0]; + return (c == DirectorySeparatorChar || + c == AltDirectorySeparatorChar || + (!dirEqualsVolume && path.size() > 1 && path [1] == VolumeSeparatorChar)); } }; //----------------------------------- -#if defined(_WINDOWS) +#if defined(_WINDOWS) static void FCEUD_MakePathDirs(const char *fname) { char path[MAX_PATH]; @@ -89,7 +89,7 @@ static void FCEUD_MakePathDirs(const char *fname) } while(1); } -#endif +#endif //------------------------------ class PathInfo diff --git a/desmume/src/windows/matrixView.cpp b/desmume/src/windows/matrixView.cpp index 6bfcccd3e..b8c442d80 100644 --- a/desmume/src/windows/matrixView.cpp +++ b/desmume/src/windows/matrixView.cpp @@ -62,7 +62,7 @@ void MatrixView_OnPaintPositionMatrix(HWND hwnd) stackIndex = SendMessage(hStackCombo, CB_GETCURSEL, 0, 0) - 1; - //gfx3d_glGetMatrix(1, stackIndex, matrix); + gfx3d_glGetMatrix(1, stackIndex, matrix); MatrixView_SetMatrix(hwnd, idcGroup, matrix); } @@ -85,7 +85,7 @@ void MatrixView_OnPaintDirectionMatrix(HWND hwnd) stackIndex = SendMessage(hStackCombo, CB_GETCURSEL, 0, 0) - 1; - //gfx3d_glGetMatrix(2, stackIndex, matrix); + gfx3d_glGetMatrix(2, stackIndex, matrix); MatrixView_SetMatrix(hwnd, idcGroup, matrix); } @@ -104,7 +104,7 @@ void MatrixView_OnPaintProjectionMatrix(HWND hwnd) float mat[16]; - //gfx3d_glGetMatrix(0, -1, mat); + gfx3d_glGetMatrix(0, -1, mat); MatrixView_SetMatrix(hwnd, idcGroup, mat); } @@ -123,7 +123,7 @@ void MatrixView_OnPaintTextureMatrix(HWND hwnd) float mat[16]; - //gfx3d_glGetMatrix(3, -1, mat); + gfx3d_glGetMatrix(3, -1, mat); MatrixView_SetMatrix(hwnd, idcGroup, mat); }