From c2bb2c5dac272a91efaaf83cdfe09b12035509ca Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:48:22 +1100 Subject: [PATCH] [Glide64] Make stipple_pattern private --- Source/Glide64/Gfx_1.3.h | 2 -- Source/Glide64/Main.cpp | 13 +++++-------- Source/Glide64/Settings.cpp | 4 ++-- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 25 ++++++++----------------- Source/Glide64/rdp.cpp | 5 +---- Source/Glitch64/OGLEScombiner.cpp | 11 +---------- Source/Glitch64/OGLcombiner.cpp | 11 +---------- 8 files changed, 20 insertions(+), 54 deletions(-) diff --git a/Source/Glide64/Gfx_1.3.h b/Source/Glide64/Gfx_1.3.h index be5142efc..f897a6182 100644 --- a/Source/Glide64/Gfx_1.3.h +++ b/Source/Glide64/Gfx_1.3.h @@ -277,8 +277,6 @@ extern "C" { typedef int(*GETTEXADDR)(int tmu, int texsize); - extern GRSTIPPLE grStippleModeExt; - extern GRSTIPPLE grStipplePatternExt; extern GETTEXADDR GetTexAddr; #ifndef GR_STIPPLE_DISABLE diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 90846715c..3fd0b3c03 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -216,9 +216,6 @@ void UseUnregisteredSetting(int /*SettingID*/) } extern int g_width, g_height; -GRSTIPPLE grStippleModeExt = NULL; -GRSTIPPLE grStipplePatternExt = NULL; - int GetTexAddrUMA(int /*tmu*/, int texsize) { int addr = voodoo.tex_min_addr[0] + voodoo.tmem_ptr[0]; @@ -456,6 +453,9 @@ void ExitFullScreen(void) } #endif + +void setPattern(); + int InitGfx() { if (GfxInitDone) @@ -572,11 +572,8 @@ int InitGfx() if (strstr(extensions, "GETGAMMA")) grGet(GR_GAMMA_TABLE_ENTRIES, sizeof(voodoo.gamma_table_size), &voodoo.gamma_table_size); - grStippleModeExt = (GRSTIPPLE)grStippleMode; - grStipplePatternExt = (GRSTIPPLE)grStipplePattern; - - if (grStipplePatternExt) - grStipplePatternExt(g_settings->stipple_pattern); + srand(g_settings->stipple_pattern()); + setPattern(); InitCombine(); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index b825e4dd2..107b1d399 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -68,7 +68,7 @@ CSettings::CSettings() : m_decrease_fillrect_edge(false), // sub 1 from lower right corner coordinates of fillrect m_texture_correction(false), // enable perspective texture correction emulation. is on by default m_stipple_mode(STIPPLE_Disable), //used for dithered alpha emulation -stipple_pattern(0), //used for dithered alpha emulation + m_stipple_pattern(0), //used for dithered alpha emulation force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games force_quad3d(0), //force 0xb5 command to be quad, not line 3d clip_zmin(0), //enable near z clipping @@ -722,7 +722,7 @@ void CSettings::ReadGameSettings(const char * name) g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0; m_stipple_mode = (StippleMode_t)GetSetting(Set_stipple_mode); int stipple_pattern = GetSetting(Set_stipple_pattern); - g_settings->stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0; + m_stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0; g_settings->force_microcheck = GetSetting(Set_force_microcheck); g_settings->force_quad3d = GetSetting(Set_force_quad3d); g_settings->clip_zmin = GetSetting(Set_clip_zmin); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 8d30dbf66..1e504669f 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -242,7 +242,7 @@ public: inline bool decrease_fillrect_edge(void) const { return m_decrease_fillrect_edge; }; // sub 1 from lower right corner coordinates of fillrect inline bool texture_correction(void) const { return m_texture_correction; } // enable perspective texture correction emulation. is on by default inline StippleMode_t stipple_mode(void) const { return m_stipple_mode; } //used for dithered alpha emulation - uint32_t stipple_pattern; //used for dithered alpha emulation + inline uint32_t stipple_pattern(void) const { return m_stipple_pattern; } //used for dithered alpha emulation int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games int force_quad3d; //force 0xb5 command to be quad, not line 3d int clip_zmin; //enable near z clipping @@ -361,6 +361,7 @@ private: bool m_decrease_fillrect_edge; bool m_texture_correction; StippleMode_t m_stipple_mode; + uint32_t m_stipple_pattern; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 641daf2f7..6de55ef60 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1876,23 +1876,17 @@ void update() } if (rdp.acmp == 3 && rdp.cycle_mode < 2) { - if (grStippleModeExt != 0) - { - if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) { - WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither"); - grStippleModeExt(g_settings->stipple_mode()); - } - else - grStippleModeExt(GR_STIPPLE_DISABLE); + if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) { + WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither"); + grStippleMode(g_settings->stipple_mode()); } + else + grStippleMode(GR_STIPPLE_DISABLE); } else { - if (grStippleModeExt) - { - //WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled"); - grStippleModeExt(GR_STIPPLE_DISABLE); - } + //WriteTrace(TraceRDP, TraceDebug, " |- alpha compare: dither disabled"); + grStippleMode(GR_STIPPLE_DISABLE); } } // Cull mode (leave this in for z-clipped triangles) @@ -2010,10 +2004,7 @@ void set_message_combiner() GR_BLEND_ZERO, GR_BLEND_ZERO); grAlphaTestFunction(GR_CMP_ALWAYS); - if (grStippleModeExt) - { - grStippleModeExt(GR_STIPPLE_DISABLE); - } + grStippleMode(GR_STIPPLE_DISABLE); grTexFilterMode(0, GR_TEXTUREFILTER_BILINEAR, GR_TEXTUREFILTER_BILINEAR); grTexCombine(GR_TMU1, GR_COMBINE_FUNCTION_NONE, diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index b43e3ee0f..5ea461bfc 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -2353,10 +2353,7 @@ static void rdp_fillrect() grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ONE, GR_BLEND_ZERO); grAlphaTestFunction(GR_CMP_ALWAYS); - if (grStippleModeExt) - { - grStippleModeExt(GR_STIPPLE_DISABLE); - } + grStippleMode(GR_STIPPLE_DISABLE); grCullMode(GR_CULL_DISABLE); grFogMode(GR_FOG_DISABLE); diff --git a/Source/Glitch64/OGLEScombiner.cpp b/Source/Glitch64/OGLEScombiner.cpp index 134d89697..821063033 100644 --- a/Source/Glitch64/OGLEScombiner.cpp +++ b/Source/Glitch64/OGLEScombiner.cpp @@ -1689,7 +1689,7 @@ grChromakeyValue(GrColor_t value) g_chroma_color[2], g_chroma_color[3]); } -static void setPattern() +void setPattern() { int i; GLubyte stip[32 * 4]; @@ -1724,15 +1724,6 @@ static void setPattern() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } -FX_ENTRY void FX_CALL -grStipplePattern( -GrStipplePattern_t stipple) -{ - WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple); - srand(stipple); - setPattern(); -} - FX_ENTRY void FX_CALL grStippleMode(GrStippleMode_t mode) { diff --git a/Source/Glitch64/OGLcombiner.cpp b/Source/Glitch64/OGLcombiner.cpp index 59e8cb175..d8e0b49fb 100644 --- a/Source/Glitch64/OGLcombiner.cpp +++ b/Source/Glitch64/OGLcombiner.cpp @@ -1651,7 +1651,7 @@ grChromakeyValue(GrColor_t value) grDisplayGLError("grChromakeyValue"); } -static void setPattern() +void setPattern() { int i; GLubyte stip[32 * 4]; @@ -1690,15 +1690,6 @@ static void setPattern() grDisplayGLError("setPattern"); } -FX_ENTRY void FX_CALL -grStipplePattern( -GrStipplePattern_t stipple) -{ - WriteTrace(TraceResolution, TraceDebug, "value: %x", stipple); - srand(stipple); - setPattern(); -} - FX_ENTRY void FX_CALL grStippleMode(GrStippleMode_t mode) {