[mupen64plus-video-rice] 52/191: Imported Upstream version 1.99.4+20110510

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:17:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch armhf_test
in repository mupen64plus-video-rice.

commit dfd5cb1bd109be8a0d96d906c8f55e2a60160488
Author: Sven Eckelmann <sven at narfation.org>
Date:   Wed May 11 21:27:42 2011 +0200

    Imported Upstream version 1.99.4+20110510
---
 .hgtags                    |  4 ++++
 src/Config.cpp             |  2 ++
 src/OGLGraphicsContext.cpp | 30 +++++++++++++++++++++++++-----
 src/TextureFilters.cpp     | 31 ++++++++++++++++++++++++++-----
 src/Video.cpp              |  4 +++-
 src/Video.h                |  2 ++
 6 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/.hgtags b/.hgtags
new file mode 100644
index 0000000..ce6780f
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1,4 @@
+47d4f62aae9e43fbc609a0decf872bbd96fcc661 1.99.1
+8305c540efb49bbc703b78204b216ce913aafb10 1.99.2
+d678704ba2d7b9e3d34b098767bf9063596271e8 1.99.3
+985e7027bd8df7003d31f4af808f21c172afb207 1.99.4
diff --git a/src/Config.cpp b/src/Config.cpp
index 248b955..40006a5 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -312,6 +312,7 @@ BOOL InitConfiguration(void)
     ConfigSetDefaultBool(l_ConfigVideoGeneral, "Fullscreen", 0, "Use fullscreen mode if True, or windowed mode if False ");
     ConfigSetDefaultInt(l_ConfigVideoGeneral, "ScreenWidth", 640, "Width of output window or fullscreen width");
     ConfigSetDefaultInt(l_ConfigVideoGeneral, "ScreenHeight", 480, "Height of output window or fullscreen height");
+    ConfigSetDefaultBool(l_ConfigVideoGeneral, "VerticalSync", 0, "If true, activate the SDL_GL_SWAP_CONTROL attribute");
 
     ConfigSetDefaultInt(l_ConfigVideoRice, "FrameBufferSetting", FRM_BUF_NONE, "Frame Buffer Emulation (0=ROM default, 1=disable)");
     ConfigSetDefaultInt(l_ConfigVideoRice, "FrameBufferWriteBackControl", FRM_BUF_WRITEBACK_NORMAL, "Frequency to write back the frame buffer (0=every frame, 1=every other frame, etc)");
@@ -427,6 +428,7 @@ static void ReadConfiguration(void)
     windowSetting.bDisplayFullscreen = ConfigGetParamBool(l_ConfigVideoGeneral, "Fullscreen");
     windowSetting.uDisplayWidth = ConfigGetParamInt(l_ConfigVideoGeneral, "ScreenWidth");
     windowSetting.uDisplayHeight = ConfigGetParamInt(l_ConfigVideoGeneral, "ScreenHeight");
+    windowSetting.bVerticalSync = ConfigGetParamBool(l_ConfigVideoGeneral, "VerticalSync");
 
     defaultRomOptions.N64FrameBufferEmuType = ConfigGetParamInt(l_ConfigVideoRice, "FrameBufferSetting");
     defaultRomOptions.N64FrameBufferWriteBackControl = ConfigGetParamInt(l_ConfigVideoRice, "FrameBufferWriteBackControl");
diff --git a/src/OGLGraphicsContext.cpp b/src/OGLGraphicsContext.cpp
index 3dd92d0..facc1b1 100644
--- a/src/OGLGraphicsContext.cpp
+++ b/src/OGLGraphicsContext.cpp
@@ -78,6 +78,7 @@ bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWind
 
     int  depthBufferDepth = options.OpenglDepthBufferSetting;
     int  colorBufferDepth = 32;
+    int bVerticalSync = windowSetting.bVerticalSync;
     if( options.colorQuality == TEXTURE_FMT_A4R4G4B4 ) colorBufferDepth = 16;
 
     // init sdl & gl
@@ -85,8 +86,12 @@ bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWind
     if (CoreVideo_Init() != M64ERR_SUCCESS)   
         return false;
 
+    /* hard-coded attribute values */
+    const int iDOUBLEBUFFER = 1;
+
     /* set opengl attributes */
-    CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, 1);
+    CoreVideo_GL_SetAttribute(M64P_GL_DOUBLEBUFFER, iDOUBLEBUFFER);
+    CoreVideo_GL_SetAttribute(M64P_GL_SWAP_CONTROL, bVerticalSync);
     CoreVideo_GL_SetAttribute(M64P_GL_BUFFER_SIZE, colorBufferDepth);
     CoreVideo_GL_SetAttribute(M64P_GL_DEPTH_SIZE, depthBufferDepth);
 
@@ -113,6 +118,21 @@ bool COGLGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWind
         return false;
     }
 
+    /* check that our opengl attributes were properly set */
+    int iActual;
+    if (CoreVideo_GL_GetAttribute(M64P_GL_DOUBLEBUFFER, &iActual) == M64ERR_SUCCESS)
+        if (iActual != iDOUBLEBUFFER)
+            DebugMessage(M64MSG_WARNING, "Failed to set GL_DOUBLEBUFFER to %i. (it's %i)", iDOUBLEBUFFER, iActual);
+    if (CoreVideo_GL_GetAttribute(M64P_GL_SWAP_CONTROL, &iActual) == M64ERR_SUCCESS)
+        if (iActual != bVerticalSync)
+            DebugMessage(M64MSG_WARNING, "Failed to set GL_SWAP_CONTROL to %i. (it's %i)", bVerticalSync, iActual);
+    if (CoreVideo_GL_GetAttribute(M64P_GL_BUFFER_SIZE, &iActual) == M64ERR_SUCCESS)
+        if (iActual != colorBufferDepth)
+            DebugMessage(M64MSG_WARNING, "Failed to set GL_BUFFER_SIZE to %i. (it's %i)", colorBufferDepth, iActual);
+    if (CoreVideo_GL_GetAttribute(M64P_GL_DEPTH_SIZE, &iActual) == M64ERR_SUCCESS)
+        if (iActual != depthBufferDepth)
+            DebugMessage(M64MSG_WARNING, "Failed to set GL_DEPTH_SIZE to %i. (it's %i)", depthBufferDepth, iActual);
+
     /* Get function pointers to OpenGL extensions (blame Microsoft Windows for this) */
     OGLExtensions_Init();
 
@@ -230,9 +250,9 @@ void COGLGraphicsContext::InitOGLExtension(void)
         OPENGL_CHECK_ERRORS;
 
         // If user want more aniso than hardware can do
-        if(options.anisotropicFiltering > (uint32) m_maxAnisotropicFiltering)
-        {
-            DebugMessage(M64MSG_INFO, "A value of '%i' is set for AnisotropicFiltering option but the hardware has a maximum value of '%i' so this will be used", options.anisotropicFiltering, m_maxAnisotropicFiltering);
+        if(options.anisotropicFiltering > (uint32) m_maxAnisotropicFiltering)
+        {
+            DebugMessage(M64MSG_INFO, "A value of '%i' is set for AnisotropicFiltering option but the hardware has a maximum value of '%i' so this will be used", options.anisotropicFiltering, m_maxAnisotropicFiltering);
         }
 
         //check if user want less anisotropy than hardware can do
@@ -435,4 +455,4 @@ bool COGLGraphicsContext::IsSupportAnisotropicFiltering()
 int COGLGraphicsContext::getMaxAnisotropicFiltering()
 {
     return m_maxAnisotropicFiltering;
-}
\ No newline at end of file
+}
diff --git a/src/TextureFilters.cpp b/src/TextureFilters.cpp
index e6adc5e..a8ac0d4 100644
--- a/src/TextureFilters.cpp
+++ b/src/TextureFilters.cpp
@@ -1288,6 +1288,7 @@ void FindAllHiResTextures(void)
     gHiresTxtrInfos.clear();
     if (!osal_is_directory(foldername))
     {
+        DebugMessage(M64MSG_WARNING, "Couldn't open hi-res texture directory: %s", foldername);
         return;
     }
     else
@@ -1377,7 +1378,8 @@ int FindScaleFactor(const ExtTxtrInfo &info, TxtrCacheEntry &entry)
 
 int CheckTextureInfos( CSortedList<uint64,ExtTxtrInfo> &infos, TxtrCacheEntry &entry, int &indexa, int &scaleShift, bool bForDump = false)
 {
-    if(entry.ti.WidthToCreate/entry.ti.WidthToLoad > 2 || entry.ti.HeightToCreate/entry.ti.HeightToLoad > 2 )
+    if ((entry.ti.WidthToLoad  != 0 && entry.ti.WidthToCreate  / entry.ti.WidthToLoad  > 2) ||
+        (entry.ti.HeightToLoad != 0 && entry.ti.HeightToCreate / entry.ti.HeightToLoad > 2 ))
     {
         //DebugMessage(M64MSG_WARNING, "Hires texture does not support extreme texture replication");
         return -1;
@@ -1564,9 +1566,28 @@ bool LoadRGBBufferFromPNGFile(char *filename, unsigned char **pbuf, int &width,
                 pSrc++;
             }
         }
+        else if (img.bits_per_pixel == 8 && (bits_per_pixel == 24 || bits_per_pixel == 32))
+        {
+            // do palette lookup and convert 8bpp to 24/32bpp
+            int destBytePP = bits_per_pixel / 8;
+            int paletteBytePP = img.bytes_per_palette_entry;
+            unsigned char *pSrc = img.bits;
+            unsigned char *pDst = *pbuf;
+            // clear the destination image data (just to clear alpha if bpp=32)
+            memset(*pbuf, 0, img.width*img.height*destBytePP);
+            for (int i = 0; i < (int)(img.width*img.height); i++)
+            {
+                unsigned char clridx = *pSrc++;
+                unsigned char *palcolor = img.palette + clridx * paletteBytePP;
+                pDst[0] = palcolor[2]; // red
+                pDst[1] = palcolor[1]; // green
+                pDst[2] = palcolor[0]; // blue
+                pDst += destBytePP;
+            }
+        }
         else
         {
-            DebugMessage(M64MSG_ERROR, "PNG file is %i bpp but texture is %i bpp.", img.bits_per_pixel, bits_per_pixel);
+            DebugMessage(M64MSG_ERROR, "PNG file '%s' is %i bpp but texture is %i bpp.", filename, img.bits_per_pixel, bits_per_pixel);
             delete [] *pbuf;
             *pbuf = NULL;
         }
@@ -1579,7 +1600,7 @@ bool LoadRGBBufferFromPNGFile(char *filename, unsigned char **pbuf, int &width,
     }
     else
     {
-        DebugMessage(M64MSG_ERROR, "ReadPNG() returned error in LoadRGBBufferFromPNGFile!");
+        DebugMessage(M64MSG_ERROR, "ReadPNG() returned error for '%s' in LoadRGBBufferFromPNGFile!", filename);
         *pbuf = NULL;
         return false;
     }
@@ -1849,8 +1870,8 @@ void LoadHiresTexture( TxtrCacheEntry &entry )
     }
 
     // calculate the texture size magnification by comparing the N64 texture size and the hi-res texture size
-    int scalex = width / (int)entry.ti.WidthToCreate;
-    int scaley = height / (int)entry.ti.HeightToCreate;
+    int scalex = width / (int)entry.ti.WidthToLoad;
+    int scaley = height / (int)entry.ti.HeightToLoad;
     int mirrorx = 1;
     int mirrory = 1;
     if (entry.ti.WidthToCreate/entry.ti.WidthToLoad == 2) mirrorx = 2;
diff --git a/src/Video.cpp b/src/Video.cpp
index 05e9e04..ada5f50 100644
--- a/src/Video.cpp
+++ b/src/Video.cpp
@@ -94,6 +94,7 @@ ptr_VidExt_SetCaption            CoreVideo_SetCaption = NULL;
 ptr_VidExt_ToggleFullScreen      CoreVideo_ToggleFullScreen = NULL;
 ptr_VidExt_GL_GetProcAddress     CoreVideo_GL_GetProcAddress = NULL;
 ptr_VidExt_GL_SetAttribute       CoreVideo_GL_SetAttribute = NULL;
+ptr_VidExt_GL_GetAttribute       CoreVideo_GL_GetAttribute = NULL;
 ptr_VidExt_GL_SwapBuffers        CoreVideo_GL_SwapBuffers = NULL;
 
 //---------------------------------------------------------------------------------------
@@ -572,11 +573,12 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
     CoreVideo_ToggleFullScreen = (ptr_VidExt_ToggleFullScreen) osal_dynlib_getproc(CoreLibHandle, "VidExt_ToggleFullScreen");
     CoreVideo_GL_GetProcAddress = (ptr_VidExt_GL_GetProcAddress) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_GetProcAddress");
     CoreVideo_GL_SetAttribute = (ptr_VidExt_GL_SetAttribute) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_SetAttribute");
+    CoreVideo_GL_GetAttribute = (ptr_VidExt_GL_GetAttribute) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_GetAttribute");
     CoreVideo_GL_SwapBuffers = (ptr_VidExt_GL_SwapBuffers) osal_dynlib_getproc(CoreLibHandle, "VidExt_GL_SwapBuffers");
 
     if (!CoreVideo_Init || !CoreVideo_Quit || !CoreVideo_ListFullscreenModes || !CoreVideo_SetVideoMode ||
         !CoreVideo_SetCaption || !CoreVideo_ToggleFullScreen || !CoreVideo_GL_GetProcAddress ||
-        !CoreVideo_GL_SetAttribute || !CoreVideo_GL_SwapBuffers)
+        !CoreVideo_GL_SetAttribute || !CoreVideo_GL_GetAttribute || !CoreVideo_GL_SwapBuffers)
     {
         DebugMessage(M64MSG_ERROR, "Couldn't connect to Core video extension functions");
         return M64ERR_INCOMPATIBLE;
diff --git a/src/Video.h b/src/Video.h
index 3dd3a02..baf83de 100644
--- a/src/Video.h
+++ b/src/Video.h
@@ -31,6 +31,7 @@ typedef struct {
     unsigned short        uDisplayWidth, uDisplayHeight;
     
     BOOL    bDisplayFullscreen;
+    BOOL    bVerticalSync;
 
     float   fMultX, fMultY;
     int     vpLeftW, vpTopW, vpRightW, vpBottomW, vpWidthW, vpHeightW;
@@ -189,6 +190,7 @@ extern ptr_VidExt_SetCaption            CoreVideo_SetCaption;
 extern ptr_VidExt_ToggleFullScreen      CoreVideo_ToggleFullScreen;
 extern ptr_VidExt_GL_GetProcAddress     CoreVideo_GL_GetProcAddress;
 extern ptr_VidExt_GL_SetAttribute       CoreVideo_GL_SetAttribute;
+extern ptr_VidExt_GL_GetAttribute       CoreVideo_GL_GetAttribute;
 extern ptr_VidExt_GL_SwapBuffers        CoreVideo_GL_SwapBuffers;
 
 /* global functions provided by Video.cpp */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-video-rice.git



More information about the Pkg-games-commits mailing list