From c324e3b8fb1078b762ac913a66ba82b634d492c3 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 17 May 2017 18:13:04 +1000 Subject: [PATCH] [Video] move g_scr_res_x, g_scr_res_y, g_res_x, g_res_y in to Renderer.h --- Source/Project64-video/Debugger.cpp | 5 ++--- Source/Project64-video/FBtoScreen.cpp | 5 ++--- Source/Project64-video/Main.cpp | 2 -- Source/Project64-video/Renderer/OGLESglitchmain.cpp | 7 +++---- Source/Project64-video/Renderer/OGLgeometry.cpp | 1 + Source/Project64-video/Renderer/OGLglitchmain.cpp | 5 ++--- Source/Project64-video/Renderer/OGLtextures.cpp | 1 + Source/Project64-video/Renderer/Renderer.cpp | 3 ++- Source/Project64-video/Renderer/Renderer.h | 3 ++- Source/Project64-video/Renderer/glitchmain.h | 1 - Source/Project64-video/TexBuffer.cpp | 2 -- Source/Project64-video/Util.cpp | 2 -- Source/Project64-video/rdp.cpp | 8 +++----- Source/Project64-video/ucode06.cpp | 3 +-- 14 files changed, 19 insertions(+), 29 deletions(-) diff --git a/Source/Project64-video/Debugger.cpp b/Source/Project64-video/Debugger.cpp index b750c5242..1eb0f042c 100644 --- a/Source/Project64-video/Debugger.cpp +++ b/Source/Project64-video/Debugger.cpp @@ -11,6 +11,7 @@ * version 2 of the License, or (at your option) any later version. * * * ****************************************************************************/ +#include #include #include @@ -21,8 +22,6 @@ // // output - output debugger text // -extern int g_scr_res_x, g_scr_res_y; - void output(float x, float y, int scale, const char *fmt, ...) { float scale_1024 = g_scr_res_x / 1024.0f; @@ -62,4 +61,4 @@ void output(float x, float y, int scale, const char *fmt, ...) x += 8; } -} +} \ No newline at end of file diff --git a/Source/Project64-video/FBtoScreen.cpp b/Source/Project64-video/FBtoScreen.cpp index ec0393cc0..0221e5297 100644 --- a/Source/Project64-video/FBtoScreen.cpp +++ b/Source/Project64-video/FBtoScreen.cpp @@ -11,13 +11,12 @@ * version 2 of the License, or (at your option) any later version. * * * ****************************************************************************/ +#include #include "Gfx_1.3.h" #include "FBtoScreen.h" #include "TexCache.h" #include -extern int g_scr_res_x, g_scr_res_y; - static int SetupFBtoScreenCombiner(uint32_t texture_size, uint32_t opaque) { int tmu; @@ -280,7 +279,7 @@ bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info) uint32_t width = fb_info.lr_x - fb_info.ul_x + 1; uint32_t height = fb_info.lr_y - fb_info.ul_y + 1; uint32_t max_size = minval(voodoo.max_tex_size, 512); - if (width >(uint32_t)max_size || height > (uint32_t)max_size) + if (width > (uint32_t)max_size || height > (uint32_t)max_size) { DrawFrameBufferToScreen256(fb_info); return true; diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index 5458efd67..0ca136139 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -101,8 +101,6 @@ static unsigned long g_windowedExStyle, g_windowedStyle; bool g_fullscreen; #endif // _WIN32 -extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y; - void ChangeSize() { WriteTrace(TraceResolution, TraceDebug, "Start"); diff --git a/Source/Project64-video/Renderer/OGLESglitchmain.cpp b/Source/Project64-video/Renderer/OGLESglitchmain.cpp index 5dfc774da..44208c62a 100644 --- a/Source/Project64-video/Renderer/OGLESglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLESglitchmain.cpp @@ -139,8 +139,7 @@ typedef struct } fb; int nbAuxBuffers, current_buffer; -int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height; -int g_res_x, g_res_y; +int g_width, widtho, heighto, g_height; int saved_width, saved_height; int blend_func_separate_support; int npot_support; @@ -1590,7 +1589,7 @@ grLfbLock(GrLock_t type, GrBuffer_t buffer, GrLfbWriteMode_t writeMode, } return FXTRUE; - } +} FX_ENTRY FxBool FX_CALL grLfbUnlock(GrLock_t type, GrBuffer_t buffer) @@ -1824,7 +1823,7 @@ grLfbWriteRegion(GrBuffer_t dst_buffer, //glDrawBuffer(current_buffer); //glPopAttrib(); return FXTRUE; - } +} /* wrapper-specific glide extensions */ diff --git a/Source/Project64-video/Renderer/OGLgeometry.cpp b/Source/Project64-video/Renderer/OGLgeometry.cpp index bd7d0fe8c..289bd670b 100644 --- a/Source/Project64-video/Renderer/OGLgeometry.cpp +++ b/Source/Project64-video/Renderer/OGLgeometry.cpp @@ -11,6 +11,7 @@ * version 2 of the License, or (at your option) any later version. * * * ****************************************************************************/ +#include #include #ifdef _WIN32 #include diff --git a/Source/Project64-video/Renderer/OGLglitchmain.cpp b/Source/Project64-video/Renderer/OGLglitchmain.cpp index 761e46d21..4ec199696 100644 --- a/Source/Project64-video/Renderer/OGLglitchmain.cpp +++ b/Source/Project64-video/Renderer/OGLglitchmain.cpp @@ -282,8 +282,7 @@ typedef struct } fb; int nbAuxBuffers, current_buffer; -int g_scr_res_x, g_width, widtho, heighto, g_scr_res_y, g_height; -int g_res_x, g_res_y; +int g_width, widtho, heighto, g_height; int saved_width, saved_height; int blend_func_separate_support; int npot_support; @@ -595,7 +594,7 @@ grSstWinOpen( #endif // _WIN32 nbTextureUnits = 0; - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &nbTextureUnits); + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint *)&nbTextureUnits); if (nbTextureUnits == 1) WriteTrace(TraceGlitch, TraceWarning, "You need a video card that has at least 2 texture units"); nbAuxBuffers = 0; diff --git a/Source/Project64-video/Renderer/OGLtextures.cpp b/Source/Project64-video/Renderer/OGLtextures.cpp index bd7be6df1..56f1bbe93 100644 --- a/Source/Project64-video/Renderer/OGLtextures.cpp +++ b/Source/Project64-video/Renderer/OGLtextures.cpp @@ -11,6 +11,7 @@ * version 2 of the License, or (at your option) any later version. * * * ****************************************************************************/ +#include #ifdef _WIN32 #include #else // _WIN32 diff --git a/Source/Project64-video/Renderer/Renderer.cpp b/Source/Project64-video/Renderer/Renderer.cpp index c6d635540..b4063597f 100644 --- a/Source/Project64-video/Renderer/Renderer.cpp +++ b/Source/Project64-video/Renderer/Renderer.cpp @@ -13,4 +13,5 @@ ****************************************************************************/ #include -int32_t nbTextureUnits = 0; \ No newline at end of file +uint32_t nbTextureUnits = 0; +uint32_t g_scr_res_x, g_scr_res_y, g_res_x, g_res_y; \ No newline at end of file diff --git a/Source/Project64-video/Renderer/Renderer.h b/Source/Project64-video/Renderer/Renderer.h index 5e49515dd..91f77346c 100644 --- a/Source/Project64-video/Renderer/Renderer.h +++ b/Source/Project64-video/Renderer/Renderer.h @@ -14,4 +14,5 @@ #pragma once #include -extern int32_t nbTextureUnits; +extern uint32_t nbTextureUnits; +extern uint32_t g_scr_res_x, g_scr_res_y, g_res_x, g_res_y; diff --git a/Source/Project64-video/Renderer/glitchmain.h b/Source/Project64-video/Renderer/glitchmain.h index 8cbcc984b..fe607b14f 100644 --- a/Source/Project64-video/Renderer/glitchmain.h +++ b/Source/Project64-video/Renderer/glitchmain.h @@ -147,7 +147,6 @@ void vbo_disable(); #define FOG_ATTR 4 extern int w_buffer_mode; -extern int nbTextureUnits; extern int g_width, g_height, widtho, heighto; extern int tex0_width, tex0_height, tex1_width, tex1_height; extern float lambda; diff --git a/Source/Project64-video/TexBuffer.cpp b/Source/Project64-video/TexBuffer.cpp index b13d74e96..9e444620b 100644 --- a/Source/Project64-video/TexBuffer.cpp +++ b/Source/Project64-video/TexBuffer.cpp @@ -18,8 +18,6 @@ #include "CRC.h" #include -extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y; - static TBUFF_COLOR_IMAGE * AllocateTextureBuffer(COLOR_IMAGE & cimage) { TBUFF_COLOR_IMAGE texbuf; diff --git a/Source/Project64-video/Util.cpp b/Source/Project64-video/Util.cpp index 494c39e89..3435fce69 100644 --- a/Source/Project64-video/Util.cpp +++ b/Source/Project64-video/Util.cpp @@ -30,8 +30,6 @@ VERTEX *vtx_list1[32]; // vertex indexing VERTEX *vtx_list2[32]; -extern int g_scr_res_x, g_scr_res_y; - // // util_init - initialize data for the functions in this file // diff --git a/Source/Project64-video/rdp.cpp b/Source/Project64-video/rdp.cpp index 3522cdcfc..a598ec043 100644 --- a/Source/Project64-video/rdp.cpp +++ b/Source/Project64-video/rdp.cpp @@ -148,8 +148,6 @@ void microcheck(); static int reset = 0; static CSettings::ucode_t g_old_ucode = CSettings::uCode_Unsupported; -extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y; - void RDP::Reset() { memset(this, 0, sizeof(RDP_Base)); @@ -651,9 +649,9 @@ EXPORT void CALL ProcessDList(void) rdp_log << out_buf; #endif } while (!rdp.halt); - } + } #ifdef CATCH_EXCEPTIONS - } + } catch (...) { if (g_fullscreen) { @@ -668,7 +666,7 @@ EXPORT void CALL ProcessDList(void) DisplayError("The GFX plugin caused an exception and has been disabled"); to_fullscreen = TRUE; return; - } + } #endif if (g_settings->fb_emulation_enabled()) diff --git a/Source/Project64-video/ucode06.cpp b/Source/Project64-video/ucode06.cpp index e69c6d014..eecf45d1c 100644 --- a/Source/Project64-video/ucode06.cpp +++ b/Source/Project64-video/ucode06.cpp @@ -11,6 +11,7 @@ * version 2 of the License, or (at your option) any later version. * * * ****************************************************************************/ +#include #include #include #include @@ -21,8 +22,6 @@ #include "TexBuffer.h" #include "ucode06.h" -extern int g_scr_res_x, g_res_x, g_scr_res_y, g_res_y; - // STANDARD DRAWIMAGE - draws a 2d image based on the following structure float set_sprite_combine_mode()