From 99ab59402332100089b6c1cb6205f7c19a356900 Mon Sep 17 00:00:00 2001 From: Nekokabu Date: Wed, 25 Jan 2017 22:29:38 +0900 Subject: [PATCH 01/66] Update Japanese.pj.Lang --- Lang/Japanese.pj.Lang | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Lang/Japanese.pj.Lang b/Lang/Japanese.pj.Lang index 208b46056..9c67c64ef 100644 --- a/Lang/Japanese.pj.Lang +++ b/Lang/Japanese.pj.Lang @@ -588,3 +588,44 @@ LLE GFXを使用しますか?" 使用しない場合はサウンドが出力されません。 ハイレベルオーディオを使用しますか?" + +/********************************************************************************* +* Android * +*********************************************************************************/ +#3000# "設定" +#3001# "ヘルプ/掲示板" +#3002# "不具合の報告" +#3003# "About" +#3004# "Recently played" +#3005# "ゲーム" +#3006# "フォルダ" +#3007# "スキャンするフォルダを選択" +#3008# "サブディレクトリを含む" +#3009# "親フォルダ" +#3010# "ディレクトリ" +#3011# "内部メモリ" +#3012# "スキャン中..." +#3013# "OK" +#3014# "キャンセル" +#3015# "情報" +#3016# "Project64 for Android" +#3017# "ライセンス" +#3018# "リビジョン" +#3019# "Project64 for Android\u2122はWindows版Project64のAndroid移植版です。Android\u2122バージョンは、ほとんどのN64ゲームをプレイできます。" +#3020# "Project64 Authors." + +//In game menu +#3100# "設定" +#3101# "状態の保存" +#3102# "状態の復元" +#3103# "エミュレーション終了" +#3104# "ポーズ" +#3105# "再開" +#3106# "ゲームスピード" +#3107# "現在のクイックセーブ..." +#3108# "自動" +#3109# "スロット" +#3110# "リセット" +#3111# "デバッグオプション" +#3112# "Reset Function Times" +#3113# "Dump Function Times" From 209bd7d6c72a360d4395da4b0ff4a63a7df1271c Mon Sep 17 00:00:00 2001 From: Nekokabu Date: Thu, 9 Feb 2017 22:35:08 +0900 Subject: [PATCH 02/66] Update Japanese.pj.Lang --- Lang/Japanese.pj.Lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lang/Japanese.pj.Lang b/Lang/Japanese.pj.Lang index 9c67c64ef..d27386d65 100644 --- a/Lang/Japanese.pj.Lang +++ b/Lang/Japanese.pj.Lang @@ -4,8 +4,8 @@ //About DLL #1 # "Japanese" // LANGUAGE ID #2 # "Nekokabu" // Author -#3 # "2.3.1" // Version -#4 # "2016/10/11" // Date +#3 # "2.3.2" // Version +#4 # "2017/2/9" // Date //About DLL Dialog #5 # "現在の言語" From dc5fa206f29155d5e6d3007c6aea836e269eed13 Mon Sep 17 00:00:00 2001 From: RanAwaySuccessfully Date: Sat, 11 Feb 2017 07:54:34 -0200 Subject: [PATCH 03/66] minor fix 64 for Densha de GO! 64 --- Config/Project64.rdb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 6e5943081..19461bd43 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1304,7 +1304,9 @@ Status=Compatible [17C54A61-4A83F2E7-C:4A] Good Name=Densha de GO! 64 (J) Internal Name=ÃÞݼ¬ÃÞGO!64 +Save Type=16kbit Eeprom Status=Compatible +Counter Factor=1 [A5F667E1-DA1FBD1F-C:4A] Good Name=Derby Stallion 64 (J) From 1f6fb6b48351beadf14d57ada85f099839f5e2f3 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 9 Mar 2017 17:46:07 +1100 Subject: [PATCH 04/66] [Glide64] Remove unused ghq_enht_tile --- Source/Glide64/Settings.cpp | 4 ---- Source/Glide64/Settings.h | 1 - Source/Glide64/SettingsID.h | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 125c9e40f..c52431c5d 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -42,7 +42,6 @@ ghq_cmpr(0), ghq_hirs(0), ghq_use(0), ghq_enht_cmpr(0), -ghq_enht_tile(0), ghq_enht_f16bpp(0), ghq_enht_gz(0), ghq_enht_nobg(0), @@ -142,7 +141,6 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); general_setting(Set_ghq_hirs, "ghq_hirs", 0); general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0); - general_setting(Set_ghq_enht_tile, "ghq_enht_tile", 0); general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0); @@ -417,7 +415,6 @@ void CSettings::ReadSettings() m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs); this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr); - this->ghq_enht_tile = GetSetting(Set_ghq_enht_tile); this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp); this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz); this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg); @@ -687,7 +684,6 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht, m_ghq_enht); SetSetting(Set_ghq_hirs, g_settings->ghq_hirs); SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr); - SetSetting(Set_ghq_enht_tile, g_settings->ghq_enht_tile); SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 82c3c27c5..56f202845 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -202,7 +202,6 @@ public: int ghq_hirs; int ghq_use; int ghq_enht_cmpr; - int ghq_enht_tile; int ghq_enht_f16bpp; int ghq_enht_gz; int ghq_enht_nobg; diff --git a/Source/Glide64/SettingsID.h b/Source/Glide64/SettingsID.h index ff9ee97cb..4b76d3acf 100644 --- a/Source/Glide64/SettingsID.h +++ b/Source/Glide64/SettingsID.h @@ -16,7 +16,7 @@ enum Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM, Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, Set_wfmode, Set_unk_as_red, Set_unk_clear, Set_ghq_fltr, - Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_tile, + Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr, Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc, Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly, From 752ade92f079ebb133d52c4cf93643b66b1d555b Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 9 Mar 2017 17:52:54 +1100 Subject: [PATCH 05/66] [Glide64] Make advanced setting private --- Source/Glide64/Config.cpp | 2 +- Source/Glide64/Settings.cpp | 4 ++-- Source/Glide64/Settings.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index f4a06f8ac..aee8a3f35 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -757,7 +757,7 @@ COptionsSheet::COptionsSheet(_U_STRINGorID /*title*/, UINT /*uStartPage*/, HWND m_hTextureEnhancement(0) { AddPage(&m_pgBasicPage->m_psp); - if (g_settings->advanced_options) + if (g_settings->advanced_options()) { AddPage(&m_pgEmuSettings->m_psp); } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index c52431c5d..6178d2cbf 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -21,7 +21,7 @@ CSettings::CSettings() : m_res_y(GetScreenResHeight(GetDefaultScreenRes())), m_scr_res_y(GetScreenResHeight(GetDefaultScreenRes())), m_ScreenRes(GetDefaultScreenRes()), -advanced_options(0), + m_advanced_options(false), texenh_options(0), vsync(0), m_rotate(Rotate_None), @@ -384,7 +384,7 @@ void CSettings::ReadSettings() #endif this->vsync = GetSetting(Set_vsync); m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate); - this->advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0; + m_advanced_options = Set_basic_mode ? GetSystemSetting(Set_basic_mode) == 0 : false; this->texenh_options = GetSetting(Set_texenh_options); this->wrpVRAM = GetSetting(Set_wrpVRAM); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 56f202845..773451118 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -146,7 +146,6 @@ public: }; - int advanced_options; int texenh_options; int vsync; @@ -184,6 +183,7 @@ public: inline uint32_t scr_res_x(void) const { return m_scr_res_x; } inline uint32_t scr_res_y(void) const { return m_scr_res_y; } inline uint32_t ScreenRes(void) const { return m_ScreenRes; } + inline bool advanced_options(void) const { return m_advanced_options; } inline bool FlushLogs(void) const { return m_FlushLogs; } inline ScreenRotate_t rotate(void) const { return m_rotate; } inline Filtering_t filtering(void) const { return m_filtering; } @@ -295,6 +295,7 @@ private: Filtering_t m_filtering; SwapMode_t m_swapmode; PixelLevelOfDetail_t m_lodmode; + bool m_advanced_options; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; ucode_t m_ucode; From 880d7c61ff39aaba907b9d5b2e2a9c050af46426 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 9 Mar 2017 18:01:06 +1100 Subject: [PATCH 06/66] [Glide64] Make texenh_options private --- Source/Glide64/Config.cpp | 6 +++--- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index aee8a3f35..44c8e60b0 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -310,7 +310,7 @@ public: TTSetTxt(IDC_CHK_VERTICAL_SYNC, "Vertical sync:\n\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\"."); m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT)); - m_cbxTextureSettings.SetCheck(g_settings->texenh_options ? BST_CHECKED : BST_UNCHECKED); + m_cbxTextureSettings.SetCheck(g_settings->texenh_options() ? BST_CHECKED : BST_UNCHECKED); m_cmbFSResolution.Attach(GetDlgItem(IDC_CMB_FS_RESOLUTION)); int32_t size = 0; @@ -351,7 +351,7 @@ public: CSettings oldsettings = *g_settings; g_settings->SetScreenRes(m_WindowRes.GetCurSel()); g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED; - g_settings->texenh_options = m_cbxTextureSettings.GetCheck() == BST_CHECKED; + g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED); g_settings->wrpResolution = m_cmbFSResolution.GetCurSel(); g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; g_settings->wrpVRAM = m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM); @@ -773,7 +773,7 @@ COptionsSheet::~COptionsSheet() void COptionsSheet::UpdateTextureSettings(void) { - if (g_settings->texenh_options) + if (g_settings->texenh_options()) { if (m_hTextureEnhancement == NULL) { diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 6178d2cbf..7732e76c5 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -22,7 +22,7 @@ CSettings::CSettings() : m_scr_res_y(GetScreenResHeight(GetDefaultScreenRes())), m_ScreenRes(GetDefaultScreenRes()), m_advanced_options(false), -texenh_options(0), + m_texenh_options(false), vsync(0), m_rotate(Rotate_None), m_filtering(Filter_Automatic), @@ -121,7 +121,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); #endif general_setting(Set_vsync, "vsync", 1); - general_setting(Set_texenh_options, "texenh_options", 0); + general_setting(Set_texenh_options, "texenh_options", false); general_setting(Set_wrpVRAM, "wrpVRAM", 0); #ifndef ANDROID general_setting(Set_wrpFBO, "wrpFBO", 0); @@ -215,6 +215,15 @@ void CSettings::RegisterSettings(void) } +void CSettings::SetTexenhOptions(bool value) +{ + if (value != m_texenh_options) + { + m_texenh_options = value; + m_dirty = true; + } +} + void CSettings::SetScreenRes(uint32_t value) { if (value >= GetScreenResolutionCount()) @@ -385,7 +394,7 @@ void CSettings::ReadSettings() this->vsync = GetSetting(Set_vsync); m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate); m_advanced_options = Set_basic_mode ? GetSystemSetting(Set_basic_mode) == 0 : false; - this->texenh_options = GetSetting(Set_texenh_options); + m_texenh_options = GetSetting(Set_texenh_options) != 0; this->wrpVRAM = GetSetting(Set_wrpVRAM); this->wrpFBO = GetSetting(Set_wrpFBO); @@ -664,7 +673,7 @@ void CSettings::WriteSettings(void) #endif SetSetting(Set_vsync, g_settings->vsync); SetSetting(Set_Rotate, m_rotate); - SetSetting(Set_texenh_options, g_settings->texenh_options); + SetSetting(Set_texenh_options, m_texenh_options); SetSetting(Set_wrpVRAM, g_settings->wrpVRAM); SetSetting(Set_wrpFBO, g_settings->wrpFBO); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 773451118..fc1c79d85 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -146,7 +146,6 @@ public: }; - int texenh_options; int vsync; @@ -184,6 +183,7 @@ public: inline uint32_t scr_res_y(void) const { return m_scr_res_y; } inline uint32_t ScreenRes(void) const { return m_ScreenRes; } inline bool advanced_options(void) const { return m_advanced_options; } + inline bool texenh_options(void) const { return m_texenh_options; } inline bool FlushLogs(void) const { return m_FlushLogs; } inline ScreenRotate_t rotate(void) const { return m_rotate; } inline Filtering_t filtering(void) const { return m_filtering; } @@ -256,6 +256,7 @@ public: int wrpVRAM; int wrpFBO; int wrpAnisotropic; + void SetTexenhOptions(bool value); void SetScreenRes(uint32_t value); void SetAspectmode(AspectMode_t value); void SetLODmode(PixelLevelOfDetail_t value); @@ -296,6 +297,7 @@ private: SwapMode_t m_swapmode; PixelLevelOfDetail_t m_lodmode; bool m_advanced_options; + bool m_texenh_options; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; ucode_t m_ucode; From 8fdb9122914e80a29e5eadfa18c83a977b119553 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 9 Mar 2017 18:13:25 +1100 Subject: [PATCH 07/66] [Glide64] Make vsync private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 8 ++++---- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 44c8e60b0..0a8865830 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -306,7 +306,7 @@ public: TTSetTxt(IDC_CMB_WINDOW_RES, "Resolution:\n\nThis option selects the windowed resolution.\n\n[Recommended: 640x480, 800x600, 1024x768]"); m_cbxVSync.Attach(GetDlgItem(IDC_CHK_VERTICAL_SYNC)); - m_cbxVSync.SetCheck(g_settings->vsync ? BST_CHECKED : BST_UNCHECKED); + m_cbxVSync.SetCheck(g_settings->vsync() ? BST_CHECKED : BST_UNCHECKED); TTSetTxt(IDC_CHK_VERTICAL_SYNC, "Vertical sync:\n\nThis option will enable the vertical sync, which will prevent tearing.\nNote: this option will ONLY have effect if vsync is set to \"Software Controlled\"."); m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT)); @@ -350,7 +350,7 @@ public: m_spinVRAM.GetWindowText(spinVRAM, sizeof(spinVRAM)); CSettings oldsettings = *g_settings; g_settings->SetScreenRes(m_WindowRes.GetCurSel()); - g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED; + g_settings->SetVsync(m_cbxVSync.GetCheck() == BST_CHECKED); g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED); g_settings->wrpResolution = m_cmbFSResolution.GetCurSel(); g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 22f052e49..4ba5a688e 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1539,7 +1539,7 @@ void newSwapBuffers() grAuxBufferExt(GR_BUFFER_AUXBUFFER); } WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED"); - grBufferSwap(g_settings->vsync); + grBufferSwap(g_settings->vsync()); if (*gfx.VI_STATUS_REG & 0x08) //gamma correction is used { if (!voodoo.gamma_correction) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 7732e76c5..a8a383544 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -23,7 +23,7 @@ CSettings::CSettings() : m_ScreenRes(GetDefaultScreenRes()), m_advanced_options(false), m_texenh_options(false), -vsync(0), + m_vsync(false), m_rotate(Rotate_None), m_filtering(Filter_Automatic), @@ -120,7 +120,7 @@ void CSettings::RegisterSettings(void) #ifdef _WIN32 general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); #endif - general_setting(Set_vsync, "vsync", 1); + general_setting(Set_vsync, "vsync", true); general_setting(Set_texenh_options, "texenh_options", false); general_setting(Set_wrpVRAM, "wrpVRAM", 0); #ifndef ANDROID @@ -281,6 +281,15 @@ void CSettings::SetLODmode(PixelLevelOfDetail_t value) } } +void CSettings::SetVsync(bool value) +{ + if (value != m_vsync) + { + m_vsync = value; + m_dirty = true; + } +} + void CSettings::SetFiltering(Filtering_t value) { if (value != m_filtering) @@ -391,7 +400,7 @@ void CSettings::ReadSettings() #ifndef ANDROID this->wrpResolution = GetSetting(Set_FullScreenRes); #endif - this->vsync = GetSetting(Set_vsync); + m_vsync = GetSetting(Set_vsync) != 0; m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate); m_advanced_options = Set_basic_mode ? GetSystemSetting(Set_basic_mode) == 0 : false; m_texenh_options = GetSetting(Set_texenh_options) != 0; @@ -671,7 +680,7 @@ void CSettings::WriteSettings(void) #ifdef _WIN32 SetSetting(Set_FullScreenRes, g_settings->wrpResolution); #endif - SetSetting(Set_vsync, g_settings->vsync); + SetSetting(Set_vsync, m_vsync ? 1 : 0); SetSetting(Set_Rotate, m_rotate); SetSetting(Set_texenh_options, m_texenh_options); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index fc1c79d85..2fdf30ba4 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -146,9 +146,6 @@ public: }; - int vsync; - - int fog; int buff_clear; @@ -184,7 +181,7 @@ public: inline uint32_t ScreenRes(void) const { return m_ScreenRes; } inline bool advanced_options(void) const { return m_advanced_options; } inline bool texenh_options(void) const { return m_texenh_options; } - inline bool FlushLogs(void) const { return m_FlushLogs; } + inline bool vsync(void) const { return m_vsync; } inline ScreenRotate_t rotate(void) const { return m_rotate; } inline Filtering_t filtering(void) const { return m_filtering; } @@ -255,11 +252,13 @@ public: #endif int wrpVRAM; int wrpFBO; + inline bool FlushLogs(void) const { return m_FlushLogs; } int wrpAnisotropic; void SetTexenhOptions(bool value); void SetScreenRes(uint32_t value); void SetAspectmode(AspectMode_t value); void SetLODmode(PixelLevelOfDetail_t value); + void SetVsync(bool value); void SetFiltering(Filtering_t value); void SetSwapMode(SwapMode_t value); void SetGhqFltr(TextureFilter_t value); @@ -298,6 +297,7 @@ private: PixelLevelOfDetail_t m_lodmode; bool m_advanced_options; bool m_texenh_options; + bool m_vsync; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; ucode_t m_ucode; From da8926d48219180a27c924b88366021c7691b34d Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 07:54:56 +1100 Subject: [PATCH 08/66] [Glide64] Make fog private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 6 ++++-- Source/Glide64/Settings.cpp | 18 +++++++++++++----- Source/Glide64/Settings.h | 5 +++-- Source/Glide64/TexBuffer.cpp | 8 ++++---- Source/Glide64/Util.cpp | 2 +- Source/Glide64/rdp.cpp | 13 ++++++++----- Source/Glide64/ucode06.h | 4 ++-- 8 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 0a8865830..ab9345e22 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -476,7 +476,7 @@ public: tooltip = "Fog enabled:\n\nSets fog emulation on//off.\n\n[Recommended: on]"; TTSetTxt(IDC_CHK_FOG, tooltip.c_str()); m_cbxFog.Attach(GetDlgItem(IDC_CHK_FOG)); - m_cbxFog.SetCheck(g_settings->fog > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxFog.SetCheck(g_settings->fog() > 0 ? BST_CHECKED : BST_UNCHECKED); tooltip = "Buffer clear on every frame:\n\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated, and some garbage may be left on the screen.\nIn such cases, this option must be set on.\n\n[Recommended: on]"; TTSetTxt(IDC_CHK_BUFFER_CLEAR, tooltip.c_str()); @@ -520,7 +520,7 @@ public: g_settings->SetFiltering((CSettings::Filtering_t)m_cmbFiltering.GetItemData(m_cmbFiltering.GetCurSel())); g_settings->SetAspectmode((CSettings::AspectMode_t)m_cmbAspect.GetItemData(m_cmbAspect.GetCurSel())); g_settings->SetSwapMode((CSettings::SwapMode_t)m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel())); - g_settings->fog = m_cbxFog.GetCheck() == BST_CHECKED; + g_settings->SetFog(m_cbxFog.GetCheck() == BST_CHECKED); g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED; g_settings->SetLODmode((CSettings::PixelLevelOfDetail_t)m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel())); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 4ba5a688e..74dc6c2ac 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -599,7 +599,7 @@ int InitGfx() grCullMode(GR_CULL_NEGATIVE); - if (g_settings->fog) //"FOGCOORD" extension + if (g_settings->fog()) //"FOGCOORD" extension { if (strstr(extensions, "FOGCOORD")) { @@ -622,7 +622,9 @@ int InitGfx() grVertexLayout(GR_PARAM_FOG_EXT, offsetof(VERTEX, f), GR_PARAM_ENABLE); } else //not supported - g_settings->fog = FALSE; + { + g_settings->SetFog(FALSE); + } } grDepthBufferMode(GR_DEPTHBUFFER_ZBUFFER); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index a8a383544..91e5efa23 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -26,8 +26,7 @@ CSettings::CSettings() : m_vsync(false), m_rotate(Rotate_None), m_filtering(Filter_Automatic), - -fog(0), + m_fog(false), buff_clear(0), m_swapmode(SwapMode_Old), m_lodmode(LOD_Off), @@ -157,7 +156,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_optimize_texrect_default, "optimize_texrect", true); general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic); general_setting(Set_lodmode_default, "lodmode", CSettings::LOD_Off); - general_setting(Set_fog_default, "fog", 1); + general_setting(Set_fog_default, "fog", true); general_setting(Set_buff_clear_default, "buff_clear", 1); general_setting(Set_swapmode_default, "swapmode", SwapMode_New); general_setting(Set_aspect_default, "aspect", Aspect_4x3); @@ -308,6 +307,15 @@ void CSettings::SetSwapMode(SwapMode_t value) } } +void CSettings::SetFog(bool value) +{ + if (value != m_fog) + { + m_fog = value; + m_dirty = true; + } +} + void CSettings::SetGhqFltr(TextureFilter_t value) { if (value != m_ghq_fltr) @@ -609,7 +617,6 @@ void CSettings::ReadGameSettings(const char * name) g_settings->old_style_adither = GetSetting(Set_old_style_adither); g_settings->n64_z_scale = GetSetting(Set_n64_z_scale); - g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default); g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default); m_ScreenRes = GetSetting(Set_Resolution); if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); } @@ -668,6 +675,7 @@ void CSettings::ReadGameSettings(const char * name) m_fb_crc_mode = (FBCRCMODE_t)GetSetting(Set_fb_crc_mode); SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default)); + SetFog(GetSetting(g_romopen ? Set_fog : Set_fog_default) != 0); SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default)); SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default)); SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default)); @@ -716,7 +724,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump); SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering()); - SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog); + SetSetting(g_romopen ? Set_fog : Set_fog_default, m_fog); SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear); SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode()); SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, lodmode()); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 2fdf30ba4..435290f42 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -145,8 +145,6 @@ public: ucode_Turbo3d = 21, }; - - int fog; int buff_clear; @@ -185,6 +183,7 @@ public: inline ScreenRotate_t rotate(void) const { return m_rotate; } inline Filtering_t filtering(void) const { return m_filtering; } + inline bool fog (void) const { return m_fog; } inline SwapMode_t swapmode(void) const { return m_swapmode; } inline PixelLevelOfDetail_t lodmode(void) const { return m_lodmode; } inline AspectMode_t aspectmode(void) const { return m_aspectmode; } @@ -261,6 +260,7 @@ public: void SetVsync(bool value); void SetFiltering(Filtering_t value); void SetSwapMode(SwapMode_t value); + void SetFog(bool value); void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); @@ -293,6 +293,7 @@ private: FBCRCMODE_t m_fb_crc_mode; ScreenRotate_t m_rotate; Filtering_t m_filtering; + bool m_fog; SwapMode_t m_swapmode; PixelLevelOfDetail_t m_lodmode; bool m_advanced_options; diff --git a/Source/Glide64/TexBuffer.cpp b/Source/Glide64/TexBuffer.cpp index 26c1003d4..af44e9bb3 100644 --- a/Source/Glide64/TexBuffer.cpp +++ b/Source/Glide64/TexBuffer.cpp @@ -461,7 +461,7 @@ int CloseTextureBuffer(int draw) grDrawTriangle(&v[0], &v[2], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]); rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; - if (g_settings->fog && (rdp.flags & FOG_ENABLED)) + if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) { grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT); } @@ -526,7 +526,7 @@ int CopyTextureBuffer(COLOR_IMAGE & fb_from, COLOR_IMAGE & fb_to) rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR; - if (g_settings->fog && (rdp.flags & FOG_ENABLED)) + if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT); WriteTrace(TraceRDP, TraceDebug, "CopyTextureBuffer draw, OK"); rdp.tbuff_tex = 0; @@ -580,7 +580,7 @@ int CopyDepthBuffer() grAuxBufferExt(GR_BUFFER_TEXTUREAUXBUFFER_EXT); rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; - if (g_settings->fog && (rdp.flags & FOG_ENABLED)) + if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT); WriteTrace(TraceRDP, TraceDebug, "CopyDepthBuffer draw, OK"); rdp.tbuff_tex = 0; @@ -654,7 +654,7 @@ int SwapTextureBuffer() rdp.update |= UPDATE_VIEWPORT | UPDATE_SCISSOR; } rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_COMBINE | UPDATE_TEXTURE | UPDATE_ALPHA_COMPARE; - if (g_settings->fog && (rdp.flags & FOG_ENABLED)) + if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) { grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT); } diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 37b682317..9cca4cf63 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1919,7 +1919,7 @@ void update() } //Added by Gonetz. - if (g_settings->fog && (rdp.update & UPDATE_FOG_ENABLED)) + if (g_settings->fog() && (rdp.update & UPDATE_FOG_ENABLED)) { rdp.update ^= UPDATE_FOG_ENABLED; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 44cc4e152..91206b854 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -965,11 +965,14 @@ static void rdp_texrect() if ((rdp.othermode_l >> 16) == 0x3c18 && rdp.cycle1 == 0x03ffffff && rdp.cycle2 == 0x01ff1fff) //depth image based fog { - if (!depth_buffer_fog) - return; - if (g_settings->fog) - DrawDepthBufferFog(); - depth_buffer_fog = FALSE; + if (depth_buffer_fog) + { + if (g_settings->fog()) + { + DrawDepthBufferFog(); + } + depth_buffer_fog = false; + } return; } diff --git a/Source/Glide64/ucode06.h b/Source/Glide64/ucode06.h index f446cd543..050b7e999 100644 --- a/Source/Glide64/ucode06.h +++ b/Source/Glide64/ucode06.h @@ -950,7 +950,7 @@ static void uc6_draw_polygons(VERTEX v[4]) } rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT; - if (g_settings->fog && (rdp.flags & FOG_ENABLED)) + if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) { grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT); } @@ -1659,7 +1659,7 @@ void uc6_sprite2d() } rdp.update |= UPDATE_ZBUF_ENABLED | UPDATE_VIEWPORT; - if (g_settings->fog && (rdp.flags & FOG_ENABLED)) + if (g_settings->fog() && (rdp.flags & FOG_ENABLED)) { grFogMode(GR_FOG_WITH_TABLE_ON_FOGCOORD_EXT); } From 8d7cbae52b4e2b7c41529cd7769729960b9f1ed6 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 08:06:58 +1100 Subject: [PATCH 09/66] [Glide64] Make buff_clear private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 5 +++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index ab9345e22..56732e330 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -481,7 +481,7 @@ public: tooltip = "Buffer clear on every frame:\n\nForces the frame buffer to be cleared every frame drawn.\nUsually frame buffer clear is controlled by the game.\nHowever, in some cases it is not well emulated, and some garbage may be left on the screen.\nIn such cases, this option must be set on.\n\n[Recommended: on]"; TTSetTxt(IDC_CHK_BUFFER_CLEAR, tooltip.c_str()); m_cbxBuffer.Attach(GetDlgItem(IDC_CHK_BUFFER_CLEAR)); - m_cbxBuffer.SetCheck(g_settings->buff_clear > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxBuffer.SetCheck(g_settings->buff_clear() ? BST_CHECKED : BST_UNCHECKED); m_cbxFBEnable.Attach(GetDlgItem(IDC_CHK_FRAME_BUFFER_EMULATION)); TTSetTxt(IDC_CHK_FRAME_BUFFER_EMULATION, "Enable frame buffer emulation:\n\nIf on, plugin will try to detect frame buffer usage and apply appropriate frame buffer emulation.\n\n[Recommended: on for games which use frame buffer effects]"); @@ -521,7 +521,7 @@ public: g_settings->SetAspectmode((CSettings::AspectMode_t)m_cmbAspect.GetItemData(m_cmbAspect.GetCurSel())); g_settings->SetSwapMode((CSettings::SwapMode_t)m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel())); g_settings->SetFog(m_cbxFog.GetCheck() == BST_CHECKED); - g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED; + g_settings->SetBuffClear(m_cbxBuffer.GetCheck() == BST_CHECKED); g_settings->SetLODmode((CSettings::PixelLevelOfDetail_t)m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel())); CButton * fb_buttons[] = diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 74dc6c2ac..756934c46 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1564,7 +1564,7 @@ void newSwapBuffers() } } - if (g_settings->wireframe || g_settings->buff_clear || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX)) + if (g_settings->wireframe || g_settings->buff_clear() || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX)) { grDepthMask((g_settings->hacks(CSettings::hack_RE2) && g_settings->fb_depth_render_enabled()) ? FXFALSE : FXTRUE); grBufferClear(0, 0, 0xFFFF); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 91e5efa23..5091a1e8c 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -27,7 +27,7 @@ CSettings::CSettings() : m_rotate(Rotate_None), m_filtering(Filter_Automatic), m_fog(false), -buff_clear(0), + m_buff_clear(false), m_swapmode(SwapMode_Old), m_lodmode(LOD_Off), m_aspectmode(Aspect_4x3), @@ -157,7 +157,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic); general_setting(Set_lodmode_default, "lodmode", CSettings::LOD_Off); general_setting(Set_fog_default, "fog", true); - general_setting(Set_buff_clear_default, "buff_clear", 1); + general_setting(Set_buff_clear_default, "buff_clear", true); general_setting(Set_swapmode_default, "swapmode", SwapMode_New); general_setting(Set_aspect_default, "aspect", Aspect_4x3); @@ -316,6 +316,15 @@ void CSettings::SetFog(bool value) } } +void CSettings::SetBuffClear(bool value) +{ + if (value != m_buff_clear) + { + m_buff_clear = value; + m_dirty = true; + } +} + void CSettings::SetGhqFltr(TextureFilter_t value) { if (value != m_ghq_fltr) @@ -617,7 +626,6 @@ void CSettings::ReadGameSettings(const char * name) g_settings->old_style_adither = GetSetting(Set_old_style_adither); g_settings->n64_z_scale = GetSetting(Set_n64_z_scale); - g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default); m_ScreenRes = GetSetting(Set_Resolution); if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); } @@ -676,6 +684,7 @@ void CSettings::ReadGameSettings(const char * name) SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default)); SetFog(GetSetting(g_romopen ? Set_fog : Set_fog_default) != 0); + SetBuffClear(GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default) != 0); SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default)); SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default)); SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default)); @@ -725,7 +734,7 @@ void CSettings::WriteSettings(void) SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering()); SetSetting(g_romopen ? Set_fog : Set_fog_default, m_fog); - SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear); + SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, m_buff_clear); SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode()); SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, lodmode()); SetSetting(g_romopen ? Set_aspect : Set_aspect_default, m_aspectmode); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 435290f42..57c3d4bdc 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -145,8 +145,6 @@ public: ucode_Turbo3d = 21, }; - int buff_clear; - enum FBCRCMODE_t { @@ -184,6 +182,7 @@ public: inline Filtering_t filtering(void) const { return m_filtering; } inline bool fog (void) const { return m_fog; } + inline bool buff_clear(void) const { return m_buff_clear; } inline SwapMode_t swapmode(void) const { return m_swapmode; } inline PixelLevelOfDetail_t lodmode(void) const { return m_lodmode; } inline AspectMode_t aspectmode(void) const { return m_aspectmode; } @@ -261,6 +260,7 @@ public: void SetFiltering(Filtering_t value); void SetSwapMode(SwapMode_t value); void SetFog(bool value); + void SetBuffClear(bool value); void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); @@ -294,6 +294,7 @@ private: ScreenRotate_t m_rotate; Filtering_t m_filtering; bool m_fog; + bool m_buff_clear; SwapMode_t m_swapmode; PixelLevelOfDetail_t m_lodmode; bool m_advanced_options; From 154099d42f07f3ce9b82127340b354a8ff9240e0 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 08:12:37 +1100 Subject: [PATCH 10/66] [Glide64] Make texture dir private --- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 11 ++++++----- Source/Glide64/Settings.h | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 756934c46..2a3099e4e 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -706,7 +706,7 @@ int InitGfx() voodoo.sup_32bit_tex ? 32 : 16, // max texture bpp supported by hardware options, g_settings->ghq_cache_size * 1024 * 1024, // cache texture to system memory - g_settings->texture_dir.c_str(), + g_settings->texture_dir(), rdp.RomName, // name of ROM. must be no longer than 256 characters DisplayLoadProgress); } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 5091a1e8c..f0e70ecbb 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -11,10 +11,11 @@ int GetCurrentResIndex(void); extern uint32_t g_NativeWidth, g_NativeHeight; #endif -short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0; +short Set_basic_mode = 0, Set_log_dir = 0, Set_log_flush = 0; extern int g_width, g_height; CSettings::CSettings() : + m_Set_texture_dir(0), m_dirty(false), m_res_x(GetScreenResWidth(GetDefaultScreenRes())), m_scr_res_x(GetScreenResWidth(GetDefaultScreenRes())), @@ -34,7 +35,7 @@ CSettings::CSettings() : m_frame_buffer(0), m_fb_crc_mode(fbcrcFast), //Texture filtering options -texture_dir(""), + m_texture_dir(""), m_ghq_fltr(TextureFilter_None), m_ghq_enht(TextureEnht_None), ghq_cmpr(0), @@ -110,7 +111,7 @@ void CSettings::RegisterSettings(void) { SetModuleName("default"); Set_basic_mode = FindSystemSettingId("Basic Mode"); - Set_texture_dir = FindSystemSettingId("Dir:Texture"); + m_Set_texture_dir = FindSystemSettingId("Dir:Texture"); Set_log_flush = FindSystemSettingId("Log Auto Flush"); Set_log_dir = FindSystemSettingId("Dir:Log"); @@ -443,8 +444,8 @@ void CSettings::ReadSettings() char texture_dir[260]; memset(texture_dir, 0, sizeof(texture_dir)); - GetSystemSettingSz(Set_texture_dir, texture_dir, sizeof(texture_dir)); - this->texture_dir = texture_dir; + GetSystemSettingSz(m_Set_texture_dir, texture_dir, sizeof(texture_dir)); + m_texture_dir = texture_dir; m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr); this->ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr); m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 57c3d4bdc..511e8da78 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -190,7 +190,7 @@ public: inline FBCRCMODE_t fb_crc_mode(void) const { return m_fb_crc_mode; } //Texture filtering options - std::string texture_dir; + inline const char * texture_dir(void) const { return m_texture_dir.c_str(); } inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; } inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; } int ghq_cmpr; @@ -282,6 +282,8 @@ private: ((CSettings *)_this)->SettingsChanged(); } + short m_Set_texture_dir; + bool m_dirty; bool m_FlushLogs; char m_log_dir[260]; @@ -300,6 +302,7 @@ private: bool m_advanced_options; bool m_texenh_options; bool m_vsync; + std::string m_texture_dir; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; ucode_t m_ucode; From 1412f2a7053ed3258f1a9f3c6a0a061fadb82861 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 08:21:52 +1100 Subject: [PATCH 11/66] [Glide64] Make ghq_cmpr private --- Source/Glide64/Config.cpp | 12 ++---------- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 10 +++++++++- Source/Glide64/rdp.h | 3 +-- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 56732e330..dddfb627c 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -106,14 +106,6 @@ void ConfigCleanup(void) void CloseConfig(); -uint32_t texcmpr[] = -{ - //NO_COMPRESSION, //"None" - // NCC_COMPRESSION, //"NCC" - S3TC_COMPRESSION, //"S3TC" - FXT1_COMPRESSION, //"FXT1" -}; - uint32_t texhirs[] = { NO_HIRESTEXTURES, //"Do not use" @@ -635,7 +627,7 @@ public: m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD)); m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0); m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), 1); - SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr); + SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr()); tooltip = "Texture cache size:\n\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures, so setting 256+ megs can boost performance.\nAdjust accordingly if you are encountering speed issues.\n'0' disables cache.\n\n[Recommended: PC and game dependant]"; TTSetTxt(IDC_TXT_TEXTURE_CACHE, tooltip.c_str()); @@ -717,7 +709,7 @@ public: g_settings->ghq_hirs_cmpr = (int)m_cbxHrsTexCompression.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_gz = (int)m_cbxHrsCompressCache.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; - g_settings->ghq_cmpr = (int)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel()); + g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel())); g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED; if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed { diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 2a3099e4e..8336687ca 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -659,7 +659,7 @@ int InitGfx() if (g_settings->ghq_use) { /* Plugin path */ - int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | texcmpr[g_settings->ghq_cmpr] | texhirs[g_settings->ghq_hirs]; + int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | texhirs[g_settings->ghq_hirs]; if (g_settings->ghq_enht_cmpr) { options |= COMPRESS_TEX; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index f0e70ecbb..05cc32844 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -38,7 +38,7 @@ CSettings::CSettings() : m_texture_dir(""), m_ghq_fltr(TextureFilter_None), m_ghq_enht(TextureEnht_None), -ghq_cmpr(0), + m_ghq_cmpr(TextureCompression_S3TC), ghq_hirs(0), ghq_use(0), ghq_enht_cmpr(0), @@ -137,7 +137,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_unk_as_red, "unk_as_red", 0); general_setting(Set_unk_clear, "unk_clear", 0); general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); - general_setting(Set_ghq_cmpr, "ghq_cmpr", 0); + general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); general_setting(Set_ghq_hirs, "ghq_hirs", 0); general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0); @@ -344,6 +344,15 @@ void CSettings::SetGhqEnht(TextureEnhancement_t value) } } +void CSettings::SetGhqCmpr(TextureCompression_t value) +{ + if (value != m_ghq_cmpr) + { + m_ghq_cmpr = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -447,7 +456,7 @@ void CSettings::ReadSettings() GetSystemSettingSz(m_Set_texture_dir, texture_dir, sizeof(texture_dir)); m_texture_dir = texture_dir; m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr); - this->ghq_cmpr = (uint8_t)GetSetting(Set_ghq_cmpr); + m_ghq_cmpr = (TextureCompression_t)GetSetting(Set_ghq_cmpr); m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs); this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr); @@ -716,7 +725,7 @@ void CSettings::WriteSettings(void) #endif //_ENDUSER_RELEASE_ SetSetting(Set_ghq_fltr, m_ghq_fltr); - SetSetting(Set_ghq_cmpr, g_settings->ghq_cmpr); + SetSetting(Set_ghq_cmpr, m_ghq_cmpr); SetSetting(Set_ghq_enht, m_ghq_enht); SetSetting(Set_ghq_hirs, g_settings->ghq_hirs); SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 511e8da78..27ace39dc 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -107,6 +107,12 @@ public: TextureEnht_HQ4X = 0x500, }; + enum TextureCompression_t + { + TextureCompression_S3TC = 0x3000, + TextureCompression_FXT1 = 0x1000, + }; + enum SwapMode_t { SwapMode_Old = 0, @@ -193,7 +199,7 @@ public: inline const char * texture_dir(void) const { return m_texture_dir.c_str(); } inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; } inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; } - int ghq_cmpr; + inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; } int ghq_hirs; int ghq_use; int ghq_enht_cmpr; @@ -263,6 +269,7 @@ public: void SetBuffClear(bool value); void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); + void SetGhqCmpr(TextureCompression_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -305,6 +312,7 @@ private: std::string m_texture_dir; TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; + TextureCompression_t m_ghq_cmpr; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index c61a2e014..0d42917d0 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -163,8 +163,7 @@ typedef struct { uint32_t lr_x; uint32_t lr_y; } SCISSOR; - -extern uint32_t texcmpr[]; + extern uint32_t texhirs[]; typedef struct { From 6148544a93a78c3a78d967f3f60ac06a5227c995 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 08:37:26 +1100 Subject: [PATCH 12/66] [Glide64] Make ghq_hirs private --- Source/Glide64/Config.cpp | 16 ++++------------ Source/Glide64/Main.cpp | 4 ++-- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 10 +++++++++- Source/Glide64/rdp.cpp | 2 +- Source/Glide64/rdp.h | 1 - 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index dddfb627c..4558e14ca 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -106,14 +106,6 @@ void ConfigCleanup(void) void CloseConfig(); -uint32_t texhirs[] = -{ - NO_HIRESTEXTURES, //"Do not use" - RICE_HIRESTEXTURES, //"Rice format" - // GHQ_HIRESTEXTURES, //"GlideHQ format" - // JABO_HIRESTEXTURES, //"Jabo format" -}; - #ifdef _WIN32 template < class T, class TT = CToolTipCtrl > @@ -620,9 +612,9 @@ public: TTSetTxt(IDC_TXT_FORMAT_CHOICES, tooltip.c_str()); TTSetTxt(IDC_CMB_FORMAT_CHOICES, tooltip.c_str()); m_cmbHrsFormat.Attach(GetDlgItem(IDC_CMB_FORMAT_CHOICES)); - m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), 0); - m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), 1); - SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs); + m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("None"), CSettings::HiResPackFormat_None); + m_cmbHrsFormat.SetItemData(m_cmbHrsFormat.AddString("Rice format"), CSettings::HiResPackFormat_Riceformat); + SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs()); m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD)); m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0); @@ -701,7 +693,7 @@ public: g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED; g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED; - g_settings->ghq_hirs = m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel()); + g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 8336687ca..6bac928f1 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -655,11 +655,11 @@ int InitGfx() if (!g_settings->ghq_use) { - g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs; + g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs() != CSettings::HiResPackFormat_None; if (g_settings->ghq_use) { /* Plugin path */ - int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | texhirs[g_settings->ghq_hirs]; + int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | g_settings->ghq_hirs(); if (g_settings->ghq_enht_cmpr) { options |= COMPRESS_TEX; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 05cc32844..a19d05a9a 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -39,7 +39,7 @@ CSettings::CSettings() : m_ghq_fltr(TextureFilter_None), m_ghq_enht(TextureEnht_None), m_ghq_cmpr(TextureCompression_S3TC), -ghq_hirs(0), + m_ghq_hirs(HiResPackFormat_None), ghq_use(0), ghq_enht_cmpr(0), ghq_enht_f16bpp(0), @@ -139,7 +139,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); - general_setting(Set_ghq_hirs, "ghq_hirs", 0); + general_setting(Set_ghq_hirs, "ghq_hirs", HiResPackFormat_None); general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0); general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1); @@ -353,6 +353,15 @@ void CSettings::SetGhqCmpr(TextureCompression_t value) } } +void CSettings::SetGhqHirs(HiResPackFormat_t value) +{ + if (value != m_ghq_hirs) + { + m_ghq_hirs = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -458,7 +467,7 @@ void CSettings::ReadSettings() m_ghq_fltr = (TextureFilter_t)GetSetting(Set_ghq_fltr); m_ghq_cmpr = (TextureCompression_t)GetSetting(Set_ghq_cmpr); m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); - this->ghq_hirs = (uint8_t)GetSetting(Set_ghq_hirs); + m_ghq_hirs = (HiResPackFormat_t)GetSetting(Set_ghq_hirs); this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr); this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp); this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz); @@ -727,7 +736,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_fltr, m_ghq_fltr); SetSetting(Set_ghq_cmpr, m_ghq_cmpr); SetSetting(Set_ghq_enht, m_ghq_enht); - SetSetting(Set_ghq_hirs, g_settings->ghq_hirs); + SetSetting(Set_ghq_hirs, m_ghq_hirs); SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr); SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 27ace39dc..956cc0ae1 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -113,6 +113,12 @@ public: TextureCompression_FXT1 = 0x1000, }; + enum HiResPackFormat_t + { + HiResPackFormat_None = 0, + HiResPackFormat_Riceformat = 0x00020000, + }; + enum SwapMode_t { SwapMode_Old = 0, @@ -200,7 +206,7 @@ public: inline TextureFilter_t ghq_fltr(void) const { return m_ghq_fltr; } inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; } inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; } - int ghq_hirs; + inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; } int ghq_use; int ghq_enht_cmpr; int ghq_enht_f16bpp; @@ -270,6 +276,7 @@ public: void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void SetGhqCmpr(TextureCompression_t value); + void SetGhqHirs(HiResPackFormat_t value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -313,6 +320,7 @@ private: TextureFilter_t m_ghq_fltr; TextureEnhancement_t m_ghq_enht; TextureCompression_t m_ghq_cmpr; + HiResPackFormat_t m_ghq_hirs; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 91206b854..bd88a19d0 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -1569,7 +1569,7 @@ void load_palette(uint32_t addr, uint16_t start, uint16_t count) WriteTrace(TraceTLUT, TraceDebug, "%d: %08lx", i, *(uint16_t *)(gfx.RDRAM + (addr ^ 2))); } - if (g_settings->ghq_hirs) + if (g_settings->ghq_hirs() != CSettings::HiResPackFormat_None) { memcpy((uint8_t*)(rdp.pal_8_rice + start), spal, count << 1); } diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index 0d42917d0..f7ee84a3b 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -164,7 +164,6 @@ typedef struct { uint32_t lr_y; } SCISSOR; -extern uint32_t texhirs[]; typedef struct { uint16_t tile_ul_s; From 273980e51083df87e0899d6f290634f6b913edcc Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 16:25:04 +1100 Subject: [PATCH 13/66] [Glide64] Make ghq_use as a global --- Source/Glide64/Config.cpp | 5 +++-- Source/Glide64/Main.cpp | 19 ++++++++++--------- Source/Glide64/Settings.cpp | 1 - Source/Glide64/Settings.h | 1 - Source/Glide64/TexCache.cpp | 6 ++++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 4558e14ca..a4a387431 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -68,6 +68,7 @@ #include extern HINSTANCE hinstDLL; +extern bool g_ghq_use; extern CriticalSection * g_ProcessDListCS; @@ -796,10 +797,10 @@ void CALL DllConfig(HWND hParent) ReleaseGfx(); rdp_reset(); } - if (g_settings->ghq_use) + if (g_ghq_use) { ext_ghq_shutdown(); - g_settings->ghq_use = 0; + g_ghq_use = false; } } else diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 6bac928f1..71e8edda3 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -115,6 +115,7 @@ uint32_t offset_cursor = 0; uint32_t offset_textures = 0; uint32_t offset_texbuf1 = 0; +bool g_ghq_use = false; int capture_screen = 0; std::string capture_path; @@ -653,10 +654,10 @@ int InitGfx() grClipWindow(0, 0, g_settings->scr_res_x(), g_settings->scr_res_y()); rdp.update |= UPDATE_SCISSOR | UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE; - if (!g_settings->ghq_use) + if (!g_ghq_use) { - g_settings->ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs() != CSettings::HiResPackFormat_None; - if (g_settings->ghq_use) + g_ghq_use = g_settings->ghq_fltr() != CSettings::TextureFilter_None || g_settings->ghq_enht() != CSettings::TextureEnht_None || g_settings->ghq_hirs() != CSettings::HiResPackFormat_None; + if (g_ghq_use) { /* Plugin path */ int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | g_settings->ghq_hirs(); @@ -701,7 +702,7 @@ int InitGfx() options |= DUMP_TEX; } - g_settings->ghq_use = (int)ext_ghq_init(voodoo.max_tex_size, // max texture width supported by hardware + g_ghq_use = (int)ext_ghq_init(voodoo.max_tex_size, // max texture width supported by hardware voodoo.max_tex_size, // max texture height supported by hardware voodoo.sup_32bit_tex ? 32 : 16, // max texture bpp supported by hardware options, @@ -711,7 +712,7 @@ int InitGfx() DisplayLoadProgress); } } - if (g_settings->ghq_use && strstr(extensions, "TEXMIRROR")) + if (g_ghq_use && strstr(extensions, "TEXMIRROR")) { voodoo.sup_mirroring = 1; } @@ -899,10 +900,10 @@ void CALL CloseDLL(void) { WriteTrace(TraceGlide64, TraceDebug, "-"); - if (g_settings->ghq_use) + if (g_ghq_use) { ext_ghq_shutdown(); - g_settings->ghq_use = 0; + g_ghq_use = false; } if (g_settings) @@ -1152,10 +1153,10 @@ void CALL RomOpen(void) name[strlen(name) - 1] = 0; } - if (g_settings->ghq_use && strcmp(rdp.RomName, name) != 0) + if (g_ghq_use && strcmp(rdp.RomName, name) != 0) { ext_ghq_shutdown(); - g_settings->ghq_use = 0; + g_ghq_use = false; } strcpy(rdp.RomName, name); g_settings->ReadGameSettings(name); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index a19d05a9a..7a55eb070 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -40,7 +40,6 @@ CSettings::CSettings() : m_ghq_enht(TextureEnht_None), m_ghq_cmpr(TextureCompression_S3TC), m_ghq_hirs(HiResPackFormat_None), -ghq_use(0), ghq_enht_cmpr(0), ghq_enht_f16bpp(0), ghq_enht_gz(0), diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 956cc0ae1..7f47a97eb 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -207,7 +207,6 @@ public: inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; } inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; } inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; } - int ghq_use; int ghq_enht_cmpr; int ghq_enht_f16bpp; int ghq_enht_gz; diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index 17080f517..92878f2bf 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -60,6 +60,8 @@ uint8_t *texture_buffer = tex1; #include "TexModCI.h" #include "CRC.h" +extern bool g_ghq_use; + typedef struct TEXINFO_t { int real_image_width, real_image_height; // FOR ALIGNMENT PURPOSES ONLY!!! @@ -1255,7 +1257,7 @@ void LoadTex(int id, int tmu) GHQTexInfo ghqTexInfo; memset(&ghqTexInfo, 0, sizeof(GHQTexInfo)); uint32_t g64_crc = cache->crc; - if (g_settings->ghq_use) + if (g_ghq_use) { int bpl; uint8_t* addr = (uint8_t*)(gfx.RDRAM + rdp.addr[rdp.tiles[td].t_mem]); @@ -1579,7 +1581,7 @@ void LoadTex(int id, int tmu) if (GfxInitDone) { - if (g_settings->ghq_use) + if (g_ghq_use) { if (!ghqTexInfo.data) if (!g_settings->ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256)) From efd98d4d237ab39d9bb9873f3fe4e35c705a8f71 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 16:31:59 +1100 Subject: [PATCH 14/66] [Glide64] Make ghq_enht_cmpr private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index a4a387431..7cc030418 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -640,7 +640,7 @@ public: TTSetTxt(IDC_CHK_HIRES_TEX_COMPRESSION, tooltip.c_str()); m_cbxEnhTexCompression.Attach(GetDlgItem(IDC_CHK_TEX_COMPRESSION)); - m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsTexCompression.Attach(GetDlgItem(IDC_CHK_HIRES_TEX_COMPRESSION)); m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED); @@ -692,7 +692,7 @@ public: g_settings->SetGhqEnht((CSettings::TextureEnhancement_t)m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel())); g_settings->ghq_cache_size = atoi(texcache); g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; - g_settings->ghq_enht_cmpr = (int)m_cbxEnhTexCompression.GetCheck() == BST_CHECKED; + g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED); g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED; g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 71e8edda3..6dca48f14 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -661,7 +661,7 @@ int InitGfx() { /* Plugin path */ int options = g_settings->ghq_fltr() | g_settings->ghq_enht() | g_settings->ghq_cmpr() | g_settings->ghq_hirs(); - if (g_settings->ghq_enht_cmpr) + if (g_settings->ghq_enht_cmpr()) { options |= COMPRESS_TEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 7a55eb070..3d0576dbd 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -40,7 +40,7 @@ CSettings::CSettings() : m_ghq_enht(TextureEnht_None), m_ghq_cmpr(TextureCompression_S3TC), m_ghq_hirs(HiResPackFormat_None), -ghq_enht_cmpr(0), + m_ghq_enht_cmpr(false), ghq_enht_f16bpp(0), ghq_enht_gz(0), ghq_enht_nobg(0), @@ -139,7 +139,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); general_setting(Set_ghq_hirs, "ghq_hirs", HiResPackFormat_None); - general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", 0); + general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", false); general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0); @@ -361,6 +361,15 @@ void CSettings::SetGhqHirs(HiResPackFormat_t value) } } +void CSettings::SetGhqEnhtCmpr(bool value) +{ + if (value != m_ghq_enht_cmpr) + { + m_ghq_enht_cmpr = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -467,7 +476,7 @@ void CSettings::ReadSettings() m_ghq_cmpr = (TextureCompression_t)GetSetting(Set_ghq_cmpr); m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); m_ghq_hirs = (HiResPackFormat_t)GetSetting(Set_ghq_hirs); - this->ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr); + m_ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr) != 0; this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp); this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz); this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg); @@ -736,7 +745,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_cmpr, m_ghq_cmpr); SetSetting(Set_ghq_enht, m_ghq_enht); SetSetting(Set_ghq_hirs, m_ghq_hirs); - SetSetting(Set_ghq_enht_cmpr, g_settings->ghq_enht_cmpr); + SetSetting(Set_ghq_enht_cmpr, m_ghq_enht_cmpr); SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 7f47a97eb..bd9d95470 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -207,7 +207,7 @@ public: inline TextureEnhancement_t ghq_enht(void) const { return m_ghq_enht; } inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; } inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; } - int ghq_enht_cmpr; + inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; } int ghq_enht_f16bpp; int ghq_enht_gz; int ghq_enht_nobg; @@ -276,6 +276,7 @@ public: void SetGhqEnht(TextureEnhancement_t value); void SetGhqCmpr(TextureCompression_t value); void SetGhqHirs(HiResPackFormat_t value); + void SetGhqEnhtCmpr(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -320,6 +321,7 @@ private: TextureEnhancement_t m_ghq_enht; TextureCompression_t m_ghq_cmpr; HiResPackFormat_t m_ghq_hirs; + bool m_ghq_enht_cmpr; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From ee26e7930b7fc53e77667a1f7d5b65cdd00a7490 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 16:36:38 +1100 Subject: [PATCH 15/66] [Glide64] Make ghq_enht_f16bpp private --- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 8 ++++---- Source/Glide64/Settings.h | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 6dca48f14..a7e88f459 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -673,7 +673,7 @@ int InitGfx() { options |= TILE_HIRESTEX; } - if (g_settings->ghq_enht_f16bpp) + if (g_settings->ghq_enht_f16bpp()) { options |= FORCE16BPP_TEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 3d0576dbd..1578a9f58 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -41,7 +41,7 @@ CSettings::CSettings() : m_ghq_cmpr(TextureCompression_S3TC), m_ghq_hirs(HiResPackFormat_None), m_ghq_enht_cmpr(false), -ghq_enht_f16bpp(0), + m_ghq_enht_f16bpp(false), ghq_enht_gz(0), ghq_enht_nobg(0), ghq_hirs_cmpr(0), @@ -140,7 +140,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); general_setting(Set_ghq_hirs, "ghq_hirs", HiResPackFormat_None); general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", false); - general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", 0); + general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", false); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0); general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0); @@ -477,7 +477,7 @@ void CSettings::ReadSettings() m_ghq_enht = (TextureEnhancement_t)GetSetting(Set_ghq_enht); m_ghq_hirs = (HiResPackFormat_t)GetSetting(Set_ghq_hirs); m_ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr) != 0; - this->ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp); + m_ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp) !=0; this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz); this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg); this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr); @@ -746,7 +746,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht, m_ghq_enht); SetSetting(Set_ghq_hirs, m_ghq_hirs); SetSetting(Set_ghq_enht_cmpr, m_ghq_enht_cmpr); - SetSetting(Set_ghq_enht_f16bpp, g_settings->ghq_enht_f16bpp); + SetSetting(Set_ghq_enht_f16bpp, m_ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg); SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index bd9d95470..302376822 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -208,7 +208,7 @@ public: inline TextureCompression_t ghq_cmpr(void) const { return m_ghq_cmpr; } inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; } inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; } - int ghq_enht_f16bpp; + inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; } int ghq_enht_gz; int ghq_enht_nobg; int ghq_hirs_cmpr; @@ -322,6 +322,7 @@ private: TextureCompression_t m_ghq_cmpr; HiResPackFormat_t m_ghq_hirs; bool m_ghq_enht_cmpr; + bool m_ghq_enht_f16bpp; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 494fbaf7f5f45594a083623386880ea60a09d946 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 16:42:29 +1100 Subject: [PATCH 16/66] [Glide64] Make ghq_enht_gz private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 7cc030418..013908022 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -646,7 +646,7 @@ public: TTSetTxt(IDC_CHK_COMPRESS_CACHE, "Compress texture cache:\n\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]"); m_cbxEnhCompressCache.Attach(GetDlgItem(IDC_CHK_COMPRESS_CACHE)); - m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxEnhCompressCache.SetCheck(g_settings->ghq_enht_gz() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsTile.Attach(GetDlgItem(IDC_CHK_TILE_TEX)); TTSetTxt(IDC_CHK_TILE_TEX, "Tile textures:\n\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet - various issues are possible, including black lines and polygons distortions.\n\n[Recommended: off]"); @@ -693,7 +693,7 @@ public: g_settings->ghq_cache_size = atoi(texcache); g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED); - g_settings->ghq_enht_gz = (int)m_cbxEnhCompressCache.GetCheck() == BST_CHECKED; + g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED); g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index a7e88f459..12d76cce8 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -681,7 +681,7 @@ int InitGfx() { options |= FORCE16BPP_HIRESTEX; } - if (g_settings->ghq_enht_gz) + if (g_settings->ghq_enht_gz()) { options |= GZ_TEXCACHE; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 1578a9f58..fa79136ef 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -42,7 +42,7 @@ CSettings::CSettings() : m_ghq_hirs(HiResPackFormat_None), m_ghq_enht_cmpr(false), m_ghq_enht_f16bpp(false), -ghq_enht_gz(0), + m_ghq_enht_gz(false), ghq_enht_nobg(0), ghq_hirs_cmpr(0), ghq_hirs_tile(0), @@ -141,7 +141,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_hirs, "ghq_hirs", HiResPackFormat_None); general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", false); general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", false); - general_setting(Set_ghq_enht_gz, "ghq_enht_gz", 1); + general_setting(Set_ghq_enht_gz, "ghq_enht_gz", true); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0); general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0); general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0); @@ -361,6 +361,15 @@ void CSettings::SetGhqHirs(HiResPackFormat_t value) } } +void CSettings::SetGhqEnhtGz(bool value) +{ + if (value != m_ghq_enht_gz) + { + m_ghq_enht_gz = value; + m_dirty = true; + } +} + void CSettings::SetGhqEnhtCmpr(bool value) { if (value != m_ghq_enht_cmpr) @@ -478,7 +487,7 @@ void CSettings::ReadSettings() m_ghq_hirs = (HiResPackFormat_t)GetSetting(Set_ghq_hirs); m_ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr) != 0; m_ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp) !=0; - this->ghq_enht_gz = GetSetting(Set_ghq_enht_gz); + m_ghq_enht_gz = GetSetting(Set_ghq_enht_gz) != 0; this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg); this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr); this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile); @@ -747,7 +756,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs, m_ghq_hirs); SetSetting(Set_ghq_enht_cmpr, m_ghq_enht_cmpr); SetSetting(Set_ghq_enht_f16bpp, m_ghq_enht_f16bpp); - SetSetting(Set_ghq_enht_gz, g_settings->ghq_enht_gz); + SetSetting(Set_ghq_enht_gz, m_ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg); SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr); SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 302376822..4720924cb 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -209,7 +209,7 @@ public: inline HiResPackFormat_t ghq_hirs(void) const { return m_ghq_hirs; } inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; } inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; } - int ghq_enht_gz; + inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; } int ghq_enht_nobg; int ghq_hirs_cmpr; int ghq_hirs_tile; @@ -276,6 +276,7 @@ public: void SetGhqEnht(TextureEnhancement_t value); void SetGhqCmpr(TextureCompression_t value); void SetGhqHirs(HiResPackFormat_t value); + void SetGhqEnhtGz(bool value); void SetGhqEnhtCmpr(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); @@ -323,6 +324,7 @@ private: HiResPackFormat_t m_ghq_hirs; bool m_ghq_enht_cmpr; bool m_ghq_enht_f16bpp; + bool m_ghq_enht_gz; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From d51c35338bafa6a7dca3fe5177d892fd710db201 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 16:55:00 +1100 Subject: [PATCH 17/66] [Glide64] Make ghq_enht_nobg private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- Source/Glide64/TexCache.cpp | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 013908022..7f7f2db09 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -633,7 +633,7 @@ public: TTSetTxt(IDC_CHK_IGNORE_BACKGROUND, "Ignore Backgrounds:\n\nIt is used to skip enhancement for long narrow textures, usually used for backgrounds.\nThis may save texture memory greatly and increase performance.\n\n[Recommended: on (off for 'Store' mode)]"); m_cbxEnhIgnoreBG.Attach(GetDlgItem(IDC_CHK_IGNORE_BACKGROUND)); - m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxEnhIgnoreBG.SetCheck(g_settings->ghq_enht_nobg() > 0 ? BST_CHECKED : BST_UNCHECKED); tooltip = "Texture compression:\n\nTextures will be compressed using selected texture compression method.\nThe overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC.\nIn addition to saving space on the texture cache, the space occupied on the GFX hardware's texture RAM, by the enhanced textures, will be greatly reduced.\nThis minimizes texture RAM usage, decreasing the number of texture swaps to the GFX hardware leading to performance gains.\nHowever, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradation of small size textures and color banding of gradient colored textures.\n\n[Recommended: off]"; TTSetTxt(IDC_CHK_TEX_COMPRESSION, tooltip.c_str()); @@ -691,7 +691,7 @@ public: g_settings->SetGhqFltr((CSettings::TextureFilter_t)m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel())); g_settings->SetGhqEnht((CSettings::TextureEnhancement_t)m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel())); g_settings->ghq_cache_size = atoi(texcache); - g_settings->ghq_enht_nobg = (int)m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED; + g_settings->SetGhqEnhtNobg(m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED); g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED); g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED); g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index fa79136ef..8d21e3493 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -43,7 +43,7 @@ CSettings::CSettings() : m_ghq_enht_cmpr(false), m_ghq_enht_f16bpp(false), m_ghq_enht_gz(false), -ghq_enht_nobg(0), + m_ghq_enht_nobg(false), ghq_hirs_cmpr(0), ghq_hirs_tile(0), ghq_hirs_f16bpp(0), @@ -142,7 +142,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht_cmpr, "ghq_enht_cmpr", false); general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", false); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", true); - general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", 0); + general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", false); general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0); general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0); general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0); @@ -370,6 +370,15 @@ void CSettings::SetGhqEnhtGz(bool value) } } +void CSettings::SetGhqEnhtNobg(bool value) +{ + if (value != m_ghq_enht_nobg) + { + m_ghq_enht_nobg = value; + m_dirty = true; + } +} + void CSettings::SetGhqEnhtCmpr(bool value) { if (value != m_ghq_enht_cmpr) @@ -488,7 +497,7 @@ void CSettings::ReadSettings() m_ghq_enht_cmpr = GetSetting(Set_ghq_enht_cmpr) != 0; m_ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp) !=0; m_ghq_enht_gz = GetSetting(Set_ghq_enht_gz) != 0; - this->ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg); + m_ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg) != 0; this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr); this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile); this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp); @@ -757,7 +766,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht_cmpr, m_ghq_enht_cmpr); SetSetting(Set_ghq_enht_f16bpp, m_ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, m_ghq_enht_gz); - SetSetting(Set_ghq_enht_nobg, g_settings->ghq_enht_nobg); + SetSetting(Set_ghq_enht_nobg, m_ghq_enht_nobg); SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr); SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile); SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 4720924cb..3cb8647aa 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -210,7 +210,7 @@ public: inline bool ghq_enht_cmpr(void) const { return m_ghq_enht_cmpr; } inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; } inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; } - int ghq_enht_nobg; + inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; } int ghq_hirs_cmpr; int ghq_hirs_tile; int ghq_hirs_f16bpp; @@ -277,6 +277,7 @@ public: void SetGhqCmpr(TextureCompression_t value); void SetGhqHirs(HiResPackFormat_t value); void SetGhqEnhtGz(bool value); + void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); @@ -325,6 +326,7 @@ private: bool m_ghq_enht_cmpr; bool m_ghq_enht_f16bpp; bool m_ghq_enht_gz; + bool m_ghq_enht_nobg; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index 92878f2bf..b4288e094 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -1584,7 +1584,7 @@ void LoadTex(int id, int tmu) if (g_ghq_use) { if (!ghqTexInfo.data) - if (!g_settings->ghq_enht_nobg || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256)) + if (!g_settings->ghq_enht_nobg() || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256)) ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo); if (ghqTexInfo.data) From 73f17694665298191d0f5cfc5b9cc876bdf4fd72 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 17:01:41 +1100 Subject: [PATCH 18/66] [Glide64] make ghq_hirs_cmpr privte --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 7f7f2db09..83d8d9a6c 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -642,7 +642,7 @@ public: m_cbxEnhTexCompression.Attach(GetDlgItem(IDC_CHK_TEX_COMPRESSION)); m_cbxEnhTexCompression.SetCheck(g_settings->ghq_enht_cmpr() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsTexCompression.Attach(GetDlgItem(IDC_CHK_HIRES_TEX_COMPRESSION)); - m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsTexCompression.SetCheck(g_settings->ghq_hirs_cmpr() ? BST_CHECKED : BST_UNCHECKED); TTSetTxt(IDC_CHK_COMPRESS_CACHE, "Compress texture cache:\n\nMemory will be compressed so that more textures can be held in the texture cache.\nThe compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation.\nThey will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]"); m_cbxEnhCompressCache.Attach(GetDlgItem(IDC_CHK_COMPRESS_CACHE)); @@ -699,7 +699,7 @@ public: g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; - g_settings->ghq_hirs_cmpr = (int)m_cbxHrsTexCompression.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_gz = (int)m_cbxHrsCompressCache.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel())); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 12d76cce8..aaf73ed0f 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -665,7 +665,7 @@ int InitGfx() { options |= COMPRESS_TEX; } - if (g_settings->ghq_hirs_cmpr) + if (g_settings->ghq_hirs_cmpr()) { options |= COMPRESS_HIRESTEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 8d21e3493..99fee71dd 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -44,7 +44,7 @@ CSettings::CSettings() : m_ghq_enht_f16bpp(false), m_ghq_enht_gz(false), m_ghq_enht_nobg(false), -ghq_hirs_cmpr(0), + m_ghq_hirs_cmpr(false), ghq_hirs_tile(0), ghq_hirs_f16bpp(0), ghq_hirs_gz(0), @@ -143,7 +143,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht_f16bpp, "ghq_enht_f16bpp", false); general_setting(Set_ghq_enht_gz, "ghq_enht_gz", true); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", false); - general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", 0); + general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", false); general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0); general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1); @@ -388,6 +388,15 @@ void CSettings::SetGhqEnhtCmpr(bool value) } } +void CSettings::SetGhqHirsCmpr(bool value) +{ + if (value != m_ghq_hirs_cmpr) + { + m_ghq_hirs_cmpr = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -498,7 +507,7 @@ void CSettings::ReadSettings() m_ghq_enht_f16bpp = GetSetting(Set_ghq_enht_f16bpp) !=0; m_ghq_enht_gz = GetSetting(Set_ghq_enht_gz) != 0; m_ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg) != 0; - this->ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr); + m_ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr) != 0; this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile); this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp); this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz); @@ -767,7 +776,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht_f16bpp, m_ghq_enht_f16bpp); SetSetting(Set_ghq_enht_gz, m_ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, m_ghq_enht_nobg); - SetSetting(Set_ghq_hirs_cmpr, g_settings->ghq_hirs_cmpr); + SetSetting(Set_ghq_hirs_cmpr, m_ghq_hirs_cmpr); SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile); SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 3cb8647aa..c9bfb45f1 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -211,7 +211,7 @@ public: inline bool ghq_enht_f16bpp(void) const { return m_ghq_enht_f16bpp; } inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; } inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; } - int ghq_hirs_cmpr; + inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; } int ghq_hirs_tile; int ghq_hirs_f16bpp; int ghq_hirs_gz; @@ -279,6 +279,7 @@ public: void SetGhqEnhtGz(bool value); void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); + void SetGhqHirsCmpr(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -327,6 +328,7 @@ private: bool m_ghq_enht_f16bpp; bool m_ghq_enht_gz; bool m_ghq_enht_nobg; + bool m_ghq_hirs_cmpr; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 3d7f5da1dea40c77b44bcb59630589c2dd1ff434 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 17:10:09 +1100 Subject: [PATCH 19/66] [Glide64] Make ghq_hirs_tile private --- Source/Glide64/Config.cpp | 6 +++--- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 83d8d9a6c..ad279397c 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -650,11 +650,11 @@ public: m_cbxHrsTile.Attach(GetDlgItem(IDC_CHK_TILE_TEX)); TTSetTxt(IDC_CHK_TILE_TEX, "Tile textures:\n\nWhen on, wide texture will be split on several tiles to fit in one 256-width texture.\nThis tiled texture takes much less video memory space and thus overall performance will increase.\nHowever, corresponding polygons must be split too, and this is not polished yet - various issues are possible, including black lines and polygons distortions.\n\n[Recommended: off]"); - m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsTile.SetCheck(g_settings->ghq_hirs_tile() ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsForce16.Attach(GetDlgItem(IDC_CHK_FORCE_16BPP_TEXT)); TTSetTxt(IDC_CHK_FORCE_16BPP_TEXT, "Force 16bpp textures:\n\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n\n[Recommended: off]"); - m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_tile > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_f16bpp > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsTexEdit.Attach(GetDlgItem(IDC_CHK_TEX_DUMP_EDIT)); TTSetTxt(IDC_CHK_TEX_DUMP_EDIT, "Texture dumping mode:\n\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys:\n\"R\" reloads hires textures from the texture pack\n\"D\" toggles texture dumps on/off."); @@ -695,7 +695,7 @@ public: g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED); g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED); g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); - g_settings->ghq_hirs_tile = (int)m_cbxHrsTile.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsTile(m_cbxHrsTile.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index aaf73ed0f..15414ba7f 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -669,7 +669,7 @@ int InitGfx() { options |= COMPRESS_HIRESTEX; } - if (g_settings->ghq_hirs_tile) + if (g_settings->ghq_hirs_tile()) { options |= TILE_HIRESTEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 99fee71dd..cb7721d3a 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -45,7 +45,7 @@ CSettings::CSettings() : m_ghq_enht_gz(false), m_ghq_enht_nobg(false), m_ghq_hirs_cmpr(false), -ghq_hirs_tile(0), + m_ghq_hirs_tile(false), ghq_hirs_f16bpp(0), ghq_hirs_gz(0), ghq_hirs_altcrc(0), @@ -144,7 +144,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht_gz, "ghq_enht_gz", true); general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", false); general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", false); - general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", 0); + general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", false); general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1); general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", 1); @@ -370,6 +370,15 @@ void CSettings::SetGhqEnhtGz(bool value) } } +void CSettings::SetGhqHirsTile(bool value) +{ + if (value != m_ghq_hirs_tile) + { + m_ghq_hirs_tile = value; + m_dirty = true; + } +} + void CSettings::SetGhqEnhtNobg(bool value) { if (value != m_ghq_enht_nobg) @@ -508,7 +517,7 @@ void CSettings::ReadSettings() m_ghq_enht_gz = GetSetting(Set_ghq_enht_gz) != 0; m_ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg) != 0; m_ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr) != 0; - this->ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile); + m_ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile) != 0; this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp); this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz); this->ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc); @@ -777,7 +786,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht_gz, m_ghq_enht_gz); SetSetting(Set_ghq_enht_nobg, m_ghq_enht_nobg); SetSetting(Set_ghq_hirs_cmpr, m_ghq_hirs_cmpr); - SetSetting(Set_ghq_hirs_tile, g_settings->ghq_hirs_tile); + SetSetting(Set_ghq_hirs_tile, m_ghq_hirs_tile); SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz); SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index c9bfb45f1..629669514 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -212,7 +212,7 @@ public: inline bool ghq_enht_gz(void) const { return m_ghq_enht_gz; } inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; } inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; } - int ghq_hirs_tile; + inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; } int ghq_hirs_f16bpp; int ghq_hirs_gz; int ghq_hirs_altcrc; @@ -277,6 +277,7 @@ public: void SetGhqCmpr(TextureCompression_t value); void SetGhqHirs(HiResPackFormat_t value); void SetGhqEnhtGz(bool value); + void SetGhqHirsTile(bool value); void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); void SetGhqHirsCmpr(bool value); @@ -329,6 +330,7 @@ private: bool m_ghq_enht_gz; bool m_ghq_enht_nobg; bool m_ghq_hirs_cmpr; + bool m_ghq_hirs_tile; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 4e9214f6c6de5c9543e3fe1ac3fa23b66984da43 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 23:03:10 +1100 Subject: [PATCH 20/66] [Glide64]Make ghq_hirs_f16bpp private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index ad279397c..f4784df66 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -654,7 +654,7 @@ public: m_cbxHrsForce16.Attach(GetDlgItem(IDC_CHK_FORCE_16BPP_TEXT)); TTSetTxt(IDC_CHK_FORCE_16BPP_TEXT, "Force 16bpp textures:\n\nThe color of the textures will be reduced to 16bpp.\nThis is another space saver and performance enhancer.\nThis halves the space used on the texture cache and the GFX hardware's texture RAM.\nColor reduction is done so that the original quality is preserved as much as possible.\nDepending on the texture, this usually is hardly noticeable.\nSometimes though, it can be: skies are a good example.\n\n[Recommended: off]"); - m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_f16bpp > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsForce16.SetCheck(g_settings->ghq_hirs_f16bpp() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsTexEdit.Attach(GetDlgItem(IDC_CHK_TEX_DUMP_EDIT)); TTSetTxt(IDC_CHK_TEX_DUMP_EDIT, "Texture dumping mode:\n\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys:\n\"R\" reloads hires textures from the texture pack\n\"D\" toggles texture dumps on/off."); @@ -696,7 +696,7 @@ public: g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED); g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); g_settings->SetGhqHirsTile(m_cbxHrsTile.GetCheck() == BST_CHECKED); - g_settings->ghq_hirs_f16bpp = (int)m_cbxHrsForce16.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsF16bpp(m_cbxHrsForce16.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 15414ba7f..a8101dfcb 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -677,7 +677,7 @@ int InitGfx() { options |= FORCE16BPP_TEX; } - if (g_settings->ghq_hirs_f16bpp) + if (g_settings->ghq_hirs_f16bpp()) { options |= FORCE16BPP_HIRESTEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index cb7721d3a..5958a468c 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -46,7 +46,7 @@ CSettings::CSettings() : m_ghq_enht_nobg(false), m_ghq_hirs_cmpr(false), m_ghq_hirs_tile(false), -ghq_hirs_f16bpp(0), + m_ghq_hirs_f16bpp(false), ghq_hirs_gz(0), ghq_hirs_altcrc(0), ghq_cache_save(0), @@ -145,7 +145,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_enht_nobg, "ghq_enht_nobg", false); general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", false); general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", false); - general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", 0); + general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", false); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1); general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", 1); general_setting(Set_ghq_cache_save, "ghq_cache_save", 1); @@ -379,6 +379,15 @@ void CSettings::SetGhqHirsTile(bool value) } } +void CSettings::SetGhqHirsF16bpp(bool value) +{ + if (value != m_ghq_hirs_f16bpp) + { + m_ghq_hirs_f16bpp = value; + m_dirty = true; + } +} + void CSettings::SetGhqEnhtNobg(bool value) { if (value != m_ghq_enht_nobg) @@ -518,7 +527,7 @@ void CSettings::ReadSettings() m_ghq_enht_nobg = GetSetting(Set_ghq_enht_nobg) != 0; m_ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr) != 0; m_ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile) != 0; - this->ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp); + m_ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp) != 0; this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz); this->ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc); this->ghq_cache_save = GetSetting(Set_ghq_cache_save); @@ -787,7 +796,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_enht_nobg, m_ghq_enht_nobg); SetSetting(Set_ghq_hirs_cmpr, m_ghq_hirs_cmpr); SetSetting(Set_ghq_hirs_tile, m_ghq_hirs_tile); - SetSetting(Set_ghq_hirs_f16bpp, g_settings->ghq_hirs_f16bpp); + SetSetting(Set_ghq_hirs_f16bpp, m_ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz); SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc); SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 629669514..331f7be13 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -213,7 +213,7 @@ public: inline bool ghq_enht_nobg(void) const { return m_ghq_enht_nobg; } inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; } inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; } - int ghq_hirs_f16bpp; + inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; } int ghq_hirs_gz; int ghq_hirs_altcrc; int ghq_cache_save; @@ -278,6 +278,7 @@ public: void SetGhqHirs(HiResPackFormat_t value); void SetGhqEnhtGz(bool value); void SetGhqHirsTile(bool value); + void SetGhqHirsF16bpp(bool value); void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); void SetGhqHirsCmpr(bool value); @@ -331,6 +332,7 @@ private: bool m_ghq_enht_nobg; bool m_ghq_hirs_cmpr; bool m_ghq_hirs_tile; + bool m_ghq_hirs_f16bpp; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 08e5df4dc63a4160a581558d630e3c48fa2de842 Mon Sep 17 00:00:00 2001 From: zilmar Date: Fri, 10 Mar 2017 23:17:57 +1100 Subject: [PATCH 21/66] [Glide64] Make ghq_hirs_gz private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index f4784df66..88a3dc235 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -670,7 +670,7 @@ public: m_cbxHrsCompressCache.Attach(GetDlgItem(IDC_CHK_HRS_COMPRESS_CACHE)); TTSetTxt(IDC_CHK_HRS_COMPRESS_CACHE, "Compress texture cache:\n\nWhen game started, plugin loads all its hi-resolution textures into PC memory.\nSince hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory.\nCache compression allows save memory space greatly.\nTextures will be decompressed on-the-fly, before being downloaded to the gfx hardware.\nThis option will still help save memory space even when using texture compression.\n\n[Recommended: on]"); - m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsCompressCache.SetCheck(g_settings->ghq_hirs_gz() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsLetFly.Attach(GetDlgItem(IDC_CHK_USE_ALPHA_FULLY)); TTSetTxt(IDC_CHK_USE_ALPHA_FULLY, "Use Alpha channel fully:\n\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style, with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture, and select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need, regardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n\n[Recommended: texture pack dependant]"); @@ -700,7 +700,7 @@ public: g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); - g_settings->ghq_hirs_gz = (int)m_cbxHrsCompressCache.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel())); g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index a8101dfcb..382e9e2e1 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -685,7 +685,7 @@ int InitGfx() { options |= GZ_TEXCACHE; } - if (g_settings->ghq_hirs_gz) + if (g_settings->ghq_hirs_gz()) { options |= GZ_HIRESTEXCACHE; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 5958a468c..c3b53225a 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -47,7 +47,7 @@ CSettings::CSettings() : m_ghq_hirs_cmpr(false), m_ghq_hirs_tile(false), m_ghq_hirs_f16bpp(false), -ghq_hirs_gz(0), + m_ghq_hirs_gz(false), ghq_hirs_altcrc(0), ghq_cache_save(0), ghq_cache_size(0), @@ -146,7 +146,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_hirs_cmpr, "ghq_hirs_cmpr", false); general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", false); general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", false); - general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", 1); + general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", true); general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", 1); general_setting(Set_ghq_cache_save, "ghq_cache_save", 1); general_setting(Set_ghq_cache_size, "ghq_cache_size", 0); @@ -415,6 +415,15 @@ void CSettings::SetGhqHirsCmpr(bool value) } } +void CSettings::SetGhqHirsGz(bool value) +{ + if (value != m_ghq_hirs_gz) + { + m_ghq_hirs_gz = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -528,7 +537,7 @@ void CSettings::ReadSettings() m_ghq_hirs_cmpr = GetSetting(Set_ghq_hirs_cmpr) != 0; m_ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile) != 0; m_ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp) != 0; - this->ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz); + m_ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz) != 0; this->ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc); this->ghq_cache_save = GetSetting(Set_ghq_cache_save); this->ghq_cache_size = GetSetting(Set_ghq_cache_size); @@ -797,7 +806,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_cmpr, m_ghq_hirs_cmpr); SetSetting(Set_ghq_hirs_tile, m_ghq_hirs_tile); SetSetting(Set_ghq_hirs_f16bpp, m_ghq_hirs_f16bpp); - SetSetting(Set_ghq_hirs_gz, g_settings->ghq_hirs_gz); + SetSetting(Set_ghq_hirs_gz, m_ghq_hirs_gz); SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc); SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save); SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 331f7be13..5dfa060f2 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -214,7 +214,7 @@ public: inline bool ghq_hirs_cmpr(void) const { return m_ghq_hirs_cmpr; } inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; } inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; } - int ghq_hirs_gz; + inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; } int ghq_hirs_altcrc; int ghq_cache_save; int ghq_cache_size; @@ -282,6 +282,7 @@ public: void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); void SetGhqHirsCmpr(bool value); + void SetGhqHirsGz(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -333,6 +334,7 @@ private: bool m_ghq_hirs_cmpr; bool m_ghq_hirs_tile; bool m_ghq_hirs_f16bpp; + bool m_ghq_hirs_gz; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 94b17378d593c127f86683f77ef013e0f5e2f882 Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 11 Mar 2017 07:43:12 +1100 Subject: [PATCH 22/66] [Glide64] Make ghq_hirs_altcrc private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- Source/Glide64/TexCache.cpp | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 88a3dc235..5bfddc7e5 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -662,7 +662,7 @@ public: m_cbxHrsAltCRC.Attach(GetDlgItem(IDC_CHK_ALT_CRC)); TTSetTxt(IDC_CHK_ALT_CRC, "Alternative CRC calculation:\n\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n\n[Recommended: texture pack dependant, mostly on]"); - m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc() > 0 ? BST_CHECKED : BST_UNCHECKED); if (g_settings->ghq_hirs_dump) { m_cbxHrsAltCRC.EnableWindow(false); @@ -698,7 +698,7 @@ public: g_settings->SetGhqHirsTile(m_cbxHrsTile.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsF16bpp(m_cbxHrsForce16.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; - g_settings->ghq_hirs_altcrc = (int)m_cbxHrsAltCRC.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsAltcrc(m_cbxHrsAltCRC.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index c3b53225a..067e408e1 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -48,7 +48,7 @@ CSettings::CSettings() : m_ghq_hirs_tile(false), m_ghq_hirs_f16bpp(false), m_ghq_hirs_gz(false), -ghq_hirs_altcrc(0), + m_ghq_hirs_altcrc(false), ghq_cache_save(0), ghq_cache_size(0), ghq_hirs_let_texartists_fly(0), @@ -147,7 +147,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_hirs_tile, "ghq_hirs_tile", false); general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", false); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", true); - general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", 1); + general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", true); general_setting(Set_ghq_cache_save, "ghq_cache_save", 1); general_setting(Set_ghq_cache_size, "ghq_cache_size", 0); general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0); @@ -406,6 +406,15 @@ void CSettings::SetGhqEnhtCmpr(bool value) } } +void CSettings::SetGhqHirsAltcrc(bool value) +{ + if (value != m_ghq_hirs_altcrc) + { + m_ghq_hirs_altcrc = value; + m_dirty = true; + } +} + void CSettings::SetGhqHirsCmpr(bool value) { if (value != m_ghq_hirs_cmpr) @@ -538,7 +547,7 @@ void CSettings::ReadSettings() m_ghq_hirs_tile = GetSetting(Set_ghq_hirs_tile) != 0; m_ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp) != 0; m_ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz) != 0; - this->ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc); + m_ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc) != 0; this->ghq_cache_save = GetSetting(Set_ghq_cache_save); this->ghq_cache_size = GetSetting(Set_ghq_cache_size); this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly); @@ -807,7 +816,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_tile, m_ghq_hirs_tile); SetSetting(Set_ghq_hirs_f16bpp, m_ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, m_ghq_hirs_gz); - SetSetting(Set_ghq_hirs_altcrc, g_settings->ghq_hirs_altcrc); + SetSetting(Set_ghq_hirs_altcrc, m_ghq_hirs_altcrc); SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save); SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size); SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 5dfa060f2..1ea62ef9d 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -215,7 +215,7 @@ public: inline bool ghq_hirs_tile(void) const { return m_ghq_hirs_tile; } inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; } inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; } - int ghq_hirs_altcrc; + inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; } int ghq_cache_save; int ghq_cache_size; int ghq_hirs_let_texartists_fly; @@ -281,6 +281,7 @@ public: void SetGhqHirsF16bpp(bool value); void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); + void SetGhqHirsAltcrc(bool value); void SetGhqHirsCmpr(bool value); void SetGhqHirsGz(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); @@ -335,6 +336,7 @@ private: bool m_ghq_hirs_tile; bool m_ghq_hirs_f16bpp; bool m_ghq_hirs_gz; + bool m_ghq_hirs_altcrc; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index b4288e094..e152a7f67 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -1299,7 +1299,7 @@ void LoadTex(int id, int tmu) { if (rdp.tiles[td].size == 1) paladdr = (uint8_t*)(rdp.pal_8_rice); - else if (g_settings->ghq_hirs_altcrc) + else if (g_settings->ghq_hirs_altcrc()) paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 5)); else paladdr = (uint8_t*)(rdp.pal_8_rice + (rdp.tiles[td].palette << 4)); From 6f0127fd3ac0f2f2a1c112482ce300d0354ce65b Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 11 Mar 2017 07:47:57 +1100 Subject: [PATCH 23/66] [Glide64] Make ghq_cache_save private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 5bfddc7e5..b5be2ef8e 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -678,7 +678,7 @@ public: m_cbxSaveTexCache.Attach(GetDlgItem(IDC_CHK_TEX_CACHE_HD)); TTSetTxt(IDC_CHK_TEX_CACHE_HD, "Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 to 60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Textures folder.\n\n[Highly Recommended: on]"); - m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxSaveTexCache.SetCheck(g_settings->ghq_cache_save() > 0 ? BST_CHECKED : BST_UNCHECKED); return TRUE; } @@ -703,7 +703,7 @@ public: g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED); g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel())); - g_settings->ghq_cache_save = (int)m_cbxSaveTexCache.GetCheck() == BST_CHECKED; + g_settings->SetGhqCacheSave(m_cbxSaveTexCache.GetCheck() == BST_CHECKED); if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed { g_settings->WriteSettings(); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 382e9e2e1..2b3fb3a65 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -689,7 +689,7 @@ int InitGfx() { options |= GZ_HIRESTEXCACHE; } - if (g_settings->ghq_cache_save) + if (g_settings->ghq_cache_save()) { options |= (DUMP_TEXCACHE | DUMP_HIRESTEXCACHE); } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 067e408e1..f2019d8ba 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -49,7 +49,7 @@ CSettings::CSettings() : m_ghq_hirs_f16bpp(false), m_ghq_hirs_gz(false), m_ghq_hirs_altcrc(false), -ghq_cache_save(0), + m_ghq_cache_save(false), ghq_cache_size(0), ghq_hirs_let_texartists_fly(0), ghq_hirs_dump(0), @@ -148,7 +148,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_hirs_f16bpp, "ghq_hirs_f16bpp", false); general_setting(Set_ghq_hirs_gz, "ghq_hirs_gz", true); general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", true); - general_setting(Set_ghq_cache_save, "ghq_cache_save", 1); + general_setting(Set_ghq_cache_save, "ghq_cache_save", true); general_setting(Set_ghq_cache_size, "ghq_cache_size", 0); general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0); general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0); @@ -433,6 +433,15 @@ void CSettings::SetGhqHirsGz(bool value) } } +void CSettings::SetGhqCacheSave(bool value) +{ + if (value != m_ghq_cache_save) + { + m_ghq_cache_save = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -548,7 +557,7 @@ void CSettings::ReadSettings() m_ghq_hirs_f16bpp = GetSetting(Set_ghq_hirs_f16bpp) != 0; m_ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz) != 0; m_ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc) != 0; - this->ghq_cache_save = GetSetting(Set_ghq_cache_save); + m_ghq_cache_save = GetSetting(Set_ghq_cache_save) != 0; this->ghq_cache_size = GetSetting(Set_ghq_cache_size); this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly); this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump); @@ -817,7 +826,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_f16bpp, m_ghq_hirs_f16bpp); SetSetting(Set_ghq_hirs_gz, m_ghq_hirs_gz); SetSetting(Set_ghq_hirs_altcrc, m_ghq_hirs_altcrc); - SetSetting(Set_ghq_cache_save, g_settings->ghq_cache_save); + SetSetting(Set_ghq_cache_save, m_ghq_cache_save); SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size); SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly); SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 1ea62ef9d..8dac0aadb 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -216,7 +216,7 @@ public: inline bool ghq_hirs_f16bpp(void) const { return m_ghq_hirs_f16bpp; } inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; } inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; } - int ghq_cache_save; + inline bool ghq_cache_save(void) const { return m_ghq_cache_save; } int ghq_cache_size; int ghq_hirs_let_texartists_fly; int ghq_hirs_dump; @@ -284,6 +284,7 @@ public: void SetGhqHirsAltcrc(bool value); void SetGhqHirsCmpr(bool value); void SetGhqHirsGz(bool value); + void SetGhqCacheSave(bool value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); @@ -337,6 +338,7 @@ private: bool m_ghq_hirs_f16bpp; bool m_ghq_hirs_gz; bool m_ghq_hirs_altcrc; + bool m_ghq_cache_save; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 4d2694cf8e999c50bf5edfed09c96cd4d5a9c624 Mon Sep 17 00:00:00 2001 From: Frank-74 Date: Fri, 10 Mar 2017 21:29:32 +0000 Subject: [PATCH 24/66] Update Project64.rdb --- Config/Project64.rdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 19461bd43..5099d8d6d 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1458,7 +1458,6 @@ Save Type=16kbit Eeprom Good Name=Donkey Kong 64 (U) Internal Name=DONKEY KONG 64 Status=Compatible -Core Note=Polygon tearing Plugin Note=[Glide64] fairy bug; transitions 32bit=No Counter Factor=1 @@ -1467,6 +1466,7 @@ Emulate Clear=1 Primary Frame Buffer=1 RDRAM Size=8 Save Type=16kbit Eeprom +Cheat0=80619632 0000 // Polygon Tearing Fix [0DD4ABAB-B5A2A91E-C:45] Good Name=Donkey Kong 64 (U) (Kiosk Demo) From 970be7c96ca784c580246c063e350044aabdc4ab Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 04:49:23 +1100 Subject: [PATCH 25/66] [Glide64] Make ghq_cache_size private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 15 ++++++++++++--- Source/Glide64/Settings.h | 11 +++++++---- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index b5be2ef8e..95e8b7b9b 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -627,7 +627,7 @@ public: TTSetTxt(IDC_SPIN_TEXTURE_CACHE, tooltip.c_str()); TTSetTxt(IDC_TEXT_MB, tooltip.c_str()); m_textTexCache.Attach(GetDlgItem(IDC_TXT_TEXTURE_CACHE)); - m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size).c_str()); + m_textTexCache.SetWindowTextA(stdstr_f("%d", g_settings->ghq_cache_size()).c_str()); m_spinEnhCacheSize.Attach(GetDlgItem(IDC_SPIN_TEXTURE_CACHE)); m_spinEnhCacheSize.SetBuddy(m_textTexCache); @@ -690,7 +690,7 @@ public: CSettings oldsettings = *g_settings; g_settings->SetGhqFltr((CSettings::TextureFilter_t)m_cmbEnhFilter.GetItemData(m_cmbEnhFilter.GetCurSel())); g_settings->SetGhqEnht((CSettings::TextureEnhancement_t)m_cmbEnhEnhancement.GetItemData(m_cmbEnhEnhancement.GetCurSel())); - g_settings->ghq_cache_size = atoi(texcache); + g_settings->SetGhqCacheSize(atoi(texcache)); g_settings->SetGhqEnhtNobg(m_cbxEnhIgnoreBG.GetCheck() == BST_CHECKED); g_settings->SetGhqEnhtCmpr(m_cbxEnhTexCompression.GetCheck() == BST_CHECKED); g_settings->SetGhqEnhtGz(m_cbxEnhCompressCache.GetCheck() == BST_CHECKED); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 2b3fb3a65..27462c20c 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -706,7 +706,7 @@ int InitGfx() voodoo.max_tex_size, // max texture height supported by hardware voodoo.sup_32bit_tex ? 32 : 16, // max texture bpp supported by hardware options, - g_settings->ghq_cache_size * 1024 * 1024, // cache texture to system memory + g_settings->ghq_cache_size() * 1024 * 1024, // cache texture to system memory g_settings->texture_dir(), rdp.RomName, // name of ROM. must be no longer than 256 characters DisplayLoadProgress); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index f2019d8ba..c9fd67a65 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -50,7 +50,7 @@ CSettings::CSettings() : m_ghq_hirs_gz(false), m_ghq_hirs_altcrc(false), m_ghq_cache_save(false), -ghq_cache_size(0), + m_ghq_cache_size(0), ghq_hirs_let_texartists_fly(0), ghq_hirs_dump(0), autodetect_ucode(0), @@ -442,6 +442,15 @@ void CSettings::SetGhqCacheSave(bool value) } } +void CSettings::SetGhqCacheSize(int value) +{ + if (value != m_ghq_cache_size) + { + m_ghq_cache_size = value; + m_dirty = true; + } +} + void CSettings::UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove) { uint32_t frame_buffer_original = m_frame_buffer; @@ -558,7 +567,7 @@ void CSettings::ReadSettings() m_ghq_hirs_gz = GetSetting(Set_ghq_hirs_gz) != 0; m_ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc) != 0; m_ghq_cache_save = GetSetting(Set_ghq_cache_save) != 0; - this->ghq_cache_size = GetSetting(Set_ghq_cache_size); + m_ghq_cache_size = GetSetting(Set_ghq_cache_size); this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly); this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump); @@ -827,7 +836,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_gz, m_ghq_hirs_gz); SetSetting(Set_ghq_hirs_altcrc, m_ghq_hirs_altcrc); SetSetting(Set_ghq_cache_save, m_ghq_cache_save); - SetSetting(Set_ghq_cache_size, g_settings->ghq_cache_size); + SetSetting(Set_ghq_cache_size, m_ghq_cache_size); SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly); SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 8dac0aadb..8a29fb52a 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -217,7 +217,7 @@ public: inline bool ghq_hirs_gz(void) const { return m_ghq_hirs_gz; } inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; } inline bool ghq_cache_save(void) const { return m_ghq_cache_save; } - int ghq_cache_size; + inline int ghq_cache_size(void) const { return m_ghq_cache_size; } int ghq_hirs_let_texartists_fly; int ghq_hirs_dump; @@ -261,8 +261,9 @@ public: #endif int wrpVRAM; int wrpFBO; - inline bool FlushLogs(void) const { return m_FlushLogs; } int wrpAnisotropic; + inline bool FlushLogs(void) const { return m_FlushLogs; } + void SetTexenhOptions(bool value); void SetScreenRes(uint32_t value); void SetAspectmode(AspectMode_t value); @@ -285,18 +286,19 @@ public: void SetGhqHirsCmpr(bool value); void SetGhqHirsGz(bool value); void SetGhqCacheSave(bool value); + void SetGhqCacheSize(int value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); + void ReadSettings(); void ReadGameSettings(const char * name); void WriteSettings(void); - void UpdateAspectRatio(void); void UpdateScreenSize(bool fullscreen); private: - void ReadSettings(); void RegisterSettings(void); + void UpdateAspectRatio(void); void SettingsChanged(void); static void stSettingsChanged(void * _this) @@ -339,6 +341,7 @@ private: bool m_ghq_hirs_gz; bool m_ghq_hirs_altcrc; bool m_ghq_cache_save; + int m_ghq_cache_size; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 758de8f10a3287ea5d446a1a02044329b7a10069 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 04:54:23 +1100 Subject: [PATCH 26/66] [Glide64] Make ghq_hirs_let_texartists_fly private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 95e8b7b9b..2cf849a24 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -674,7 +674,7 @@ public: m_cbxHrsLetFly.Attach(GetDlgItem(IDC_CHK_USE_ALPHA_FULLY)); TTSetTxt(IDC_CHK_USE_ALPHA_FULLY, "Use Alpha channel fully:\n\nWhen this option is off, 16bit rgba textures will be loaded using RiceVideo style, with 1bit for alpha channel.\nWhen it is on, GlideHQ will check, how alpha channel is used by the hires texture, and select most appropriate format for it.\nThis gives texture designers freedom to play with alpha, as they need, regardless of format of original N64 texture.\nFor older and badly designed texture packs it can cause unwanted black borders.\n\n[Recommended: texture pack dependant]"); - m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsLetFly.SetCheck(g_settings->ghq_hirs_let_texartists_fly() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxSaveTexCache.Attach(GetDlgItem(IDC_CHK_TEX_CACHE_HD)); TTSetTxt(IDC_CHK_TEX_CACHE_HD, "Save texture cache to HD:\n\nFor enhanced textures cache:\nThis will save all previously loaded and enhanced textures to HD.\nSo upon next game launch, all the textures will be instantly loaded, resulting in smoother performance.\n\nFor high-resolution textures cache:\nAfter creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 to 60 seconds a pack can take to load without this cache file.\nThe only downside here is upon any changes to the pack, the cache file will need to be manually deleted.\n\nSaved cache files go into a folder called \"Cache\" within the Textures folder.\n\n[Highly Recommended: on]"); @@ -701,7 +701,7 @@ public: g_settings->SetGhqHirsAltcrc(m_cbxHrsAltCRC.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED); - g_settings->ghq_hirs_let_texartists_fly = (int)m_cbxHrsLetFly.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsLetTexartistsFly(m_cbxHrsLetFly.GetCheck() == BST_CHECKED); g_settings->SetGhqCmpr((CSettings::TextureCompression_t)m_cmbTextureCompression.GetItemData(m_cmbTextureCompression.GetCurSel())); g_settings->SetGhqCacheSave(m_cbxSaveTexCache.GetCheck() == BST_CHECKED); if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 27462c20c..f89d4bf31 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -693,7 +693,7 @@ int InitGfx() { options |= (DUMP_TEXCACHE | DUMP_HIRESTEXCACHE); } - if (g_settings->ghq_hirs_let_texartists_fly) + if (g_settings->ghq_hirs_let_texartists_fly()) { options |= LET_TEXARTISTS_FLY; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index c9fd67a65..1ac9dbed9 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -51,7 +51,7 @@ CSettings::CSettings() : m_ghq_hirs_altcrc(false), m_ghq_cache_save(false), m_ghq_cache_size(0), -ghq_hirs_let_texartists_fly(0), + m_ghq_hirs_let_texartists_fly(false), ghq_hirs_dump(0), autodetect_ucode(0), m_ucode(ucode_Fast3D), @@ -150,7 +150,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_hirs_altcrc, "ghq_hirs_altcrc", true); general_setting(Set_ghq_cache_save, "ghq_cache_save", true); general_setting(Set_ghq_cache_size, "ghq_cache_size", 0); - general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", 0); + general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", false); general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0); general_setting(Set_optimize_texrect_default, "optimize_texrect", true); @@ -433,6 +433,15 @@ void CSettings::SetGhqHirsGz(bool value) } } +void CSettings::SetGhqHirsLetTexartistsFly(bool value) +{ + if (value != m_ghq_hirs_let_texartists_fly) + { + m_ghq_hirs_let_texartists_fly = value; + m_dirty = true; + } +} + void CSettings::SetGhqCacheSave(bool value) { if (value != m_ghq_cache_save) @@ -568,7 +577,7 @@ void CSettings::ReadSettings() m_ghq_hirs_altcrc = GetSetting(Set_ghq_hirs_altcrc) != 0; m_ghq_cache_save = GetSetting(Set_ghq_cache_save) != 0; m_ghq_cache_size = GetSetting(Set_ghq_cache_size); - this->ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly); + m_ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly) != 0; this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump); if (Set_log_dir != 0) @@ -837,7 +846,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_altcrc, m_ghq_hirs_altcrc); SetSetting(Set_ghq_cache_save, m_ghq_cache_save); SetSetting(Set_ghq_cache_size, m_ghq_cache_size); - SetSetting(Set_ghq_hirs_let_texartists_fly, g_settings->ghq_hirs_let_texartists_fly); + SetSetting(Set_ghq_hirs_let_texartists_fly, m_ghq_hirs_let_texartists_fly); SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump); SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering()); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 8a29fb52a..4bb60ee02 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -218,7 +218,7 @@ public: inline bool ghq_hirs_altcrc(void) const { return m_ghq_hirs_altcrc; } inline bool ghq_cache_save(void) const { return m_ghq_cache_save; } inline int ghq_cache_size(void) const { return m_ghq_cache_size; } - int ghq_hirs_let_texartists_fly; + inline bool ghq_hirs_let_texartists_fly(void) const { return m_ghq_hirs_let_texartists_fly; } int ghq_hirs_dump; //Debug @@ -286,6 +286,7 @@ public: void SetGhqHirsCmpr(bool value); void SetGhqHirsGz(bool value); void SetGhqCacheSave(bool value); + void SetGhqHirsLetTexartistsFly(bool value); void SetGhqCacheSize(int value); void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); @@ -342,6 +343,7 @@ private: bool m_ghq_hirs_altcrc; bool m_ghq_cache_save; int m_ghq_cache_size; + bool m_ghq_hirs_let_texartists_fly; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 26841063aeba385ed9a24b088aec675b83418d97 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 04:57:37 +1100 Subject: [PATCH 27/66] [Glide64] Make ghq_hirs_dump private --- Source/Glide64/Config.cpp | 6 +++--- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 2cf849a24..49c4efbd0 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -658,12 +658,12 @@ public: m_cbxHrsTexEdit.Attach(GetDlgItem(IDC_CHK_TEX_DUMP_EDIT)); TTSetTxt(IDC_CHK_TEX_DUMP_EDIT, "Texture dumping mode:\n\nIn this mode, you have that ability to dump textures on screen to the appropriate folder.\nYou can also reload textures while the game is running to see how they look instantly - big time saver!\n\nHotkeys:\n\"R\" reloads hires textures from the texture pack\n\"D\" toggles texture dumps on/off."); - m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxHrsTexEdit.SetCheck(g_settings->ghq_hirs_dump() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxHrsAltCRC.Attach(GetDlgItem(IDC_CHK_ALT_CRC)); TTSetTxt(IDC_CHK_ALT_CRC, "Alternative CRC calculation:\n\nThis option enables emulation of a palette CRC calculation bug in RiceVideo.\nIf some textures are not loaded, try to set this option on/off.\n\n[Recommended: texture pack dependant, mostly on]"); m_cbxHrsAltCRC.SetCheck(g_settings->ghq_hirs_altcrc() > 0 ? BST_CHECKED : BST_UNCHECKED); - if (g_settings->ghq_hirs_dump) + if (g_settings->ghq_hirs_dump()) { m_cbxHrsAltCRC.EnableWindow(false); } @@ -697,7 +697,7 @@ public: g_settings->SetGhqHirs((CSettings::HiResPackFormat_t)m_cmbHrsFormat.GetItemData(m_cmbHrsFormat.GetCurSel())); g_settings->SetGhqHirsTile(m_cbxHrsTile.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsF16bpp(m_cbxHrsForce16.GetCheck() == BST_CHECKED); - g_settings->ghq_hirs_dump = (int)m_cbxHrsTexEdit.GetCheck() == BST_CHECKED; + g_settings->SetGhqHirsDump(m_cbxHrsTexEdit.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsAltcrc(m_cbxHrsAltCRC.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsCmpr(m_cbxHrsTexCompression.GetCheck() == BST_CHECKED); g_settings->SetGhqHirsGz(m_cbxHrsCompressCache.GetCheck() == BST_CHECKED); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index f89d4bf31..c7ad892f4 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -697,7 +697,7 @@ int InitGfx() { options |= LET_TEXARTISTS_FLY; } - if (g_settings->ghq_hirs_dump) + if (g_settings->ghq_hirs_dump()) { options |= DUMP_TEX; } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 1ac9dbed9..b941177a4 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -52,7 +52,7 @@ CSettings::CSettings() : m_ghq_cache_save(false), m_ghq_cache_size(0), m_ghq_hirs_let_texartists_fly(false), -ghq_hirs_dump(0), + m_ghq_hirs_dump(false), autodetect_ucode(0), m_ucode(ucode_Fast3D), unk_as_red(0), @@ -151,7 +151,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ghq_cache_save, "ghq_cache_save", true); general_setting(Set_ghq_cache_size, "ghq_cache_size", 0); general_setting(Set_ghq_hirs_let_texartists_fly, "ghq_hirs_let_texartists_fly", false); - general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", 0); + general_setting(Set_ghq_hirs_dump, "ghq_hirs_dump", false); general_setting(Set_optimize_texrect_default, "optimize_texrect", true); general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic); @@ -388,6 +388,15 @@ void CSettings::SetGhqHirsF16bpp(bool value) } } +void CSettings::SetGhqHirsDump(bool value) +{ + if (value != m_ghq_hirs_dump) + { + m_ghq_hirs_dump = value; + m_dirty = true; + } +} + void CSettings::SetGhqEnhtNobg(bool value) { if (value != m_ghq_enht_nobg) @@ -578,7 +587,7 @@ void CSettings::ReadSettings() m_ghq_cache_save = GetSetting(Set_ghq_cache_save) != 0; m_ghq_cache_size = GetSetting(Set_ghq_cache_size); m_ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly) != 0; - this->ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump); + m_ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump) != 0; if (Set_log_dir != 0) { @@ -847,7 +856,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_cache_save, m_ghq_cache_save); SetSetting(Set_ghq_cache_size, m_ghq_cache_size); SetSetting(Set_ghq_hirs_let_texartists_fly, m_ghq_hirs_let_texartists_fly); - SetSetting(Set_ghq_hirs_dump, g_settings->ghq_hirs_dump); + SetSetting(Set_ghq_hirs_dump, m_ghq_hirs_dump); SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering()); SetSetting(g_romopen ? Set_fog : Set_fog_default, m_fog); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 4bb60ee02..7b9da6742 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -219,7 +219,7 @@ public: inline bool ghq_cache_save(void) const { return m_ghq_cache_save; } inline int ghq_cache_size(void) const { return m_ghq_cache_size; } inline bool ghq_hirs_let_texartists_fly(void) const { return m_ghq_hirs_let_texartists_fly; } - int ghq_hirs_dump; + inline bool ghq_hirs_dump(void) const { return m_ghq_hirs_dump; } //Debug int autodetect_ucode; @@ -280,6 +280,7 @@ public: void SetGhqEnhtGz(bool value); void SetGhqHirsTile(bool value); void SetGhqHirsF16bpp(bool value); + void SetGhqHirsDump(bool value); void SetGhqEnhtNobg(bool value); void SetGhqEnhtCmpr(bool value); void SetGhqHirsAltcrc(bool value); @@ -344,6 +345,7 @@ private: bool m_ghq_cache_save; int m_ghq_cache_size; bool m_ghq_hirs_let_texartists_fly; + bool m_ghq_hirs_dump; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From d915f5757334cff9cc40cfad19ba18bce3b9dea5 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:00:37 +1100 Subject: [PATCH 28/66] [Glide64] Make autodetect_ucode private --- Source/Glide64/Settings.cpp | 9 ++++----- Source/Glide64/Settings.h | 3 ++- Source/Glide64/rdp.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index b941177a4..4c3ba1a1d 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -53,7 +53,7 @@ CSettings::CSettings() : m_ghq_cache_size(0), m_ghq_hirs_let_texartists_fly(false), m_ghq_hirs_dump(false), -autodetect_ucode(0), + m_autodetect_ucode(true), m_ucode(ucode_Fast3D), unk_as_red(0), unk_clear(0), @@ -129,7 +129,7 @@ void CSettings::RegisterSettings(void) #endif general_setting(Set_Rotate, "rotate", Rotate_None); general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0); - general_setting(Set_autodetect_ucode, "autodetect_ucode", 1); + general_setting(Set_autodetect_ucode, "autodetect_ucode", true); general_setting(Set_ucode, "ucode", ucode_F3DEX2); general_setting(Set_wireframe, "wireframe", 0); general_setting(Set_wfmode, "wfmode", 1); @@ -552,14 +552,13 @@ void CSettings::ReadSettings() this->wrpFBO = GetSetting(Set_wrpFBO); this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic); + m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; #ifndef _ENDUSER_RELEASE_ - this->autodetect_ucode = GetSetting(Set_autodetect_ucode); this->wireframe = GetSetting(Set_wireframe); this->wfmode = GetSetting(Set_wfmode); this->unk_as_red = GetSetting(Set_unk_as_red); this->unk_clear = GetSetting(Set_unk_clear); #else - this->autodetect_ucode = TRUE; this->wireframe = FALSE; this->wfmode = 0; this->unk_as_red = FALSE; @@ -830,9 +829,9 @@ void CSettings::WriteSettings(void) SetSetting(Set_wrpVRAM, g_settings->wrpVRAM); SetSetting(Set_wrpFBO, g_settings->wrpFBO); SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); + SetSetting(Set_autodetect_ucode, m_autodetect_ucode); #ifndef _ENDUSER_RELEASE_ - SetSetting(Set_autodetect_ucode, g_settings->autodetect_ucode); SetSetting(Set_ucode, (int)g_settings->ucode); SetSetting(Set_wireframe, g_settings->wireframe); SetSetting(Set_wfmode, g_settings->wfmode); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 7b9da6742..2d132811a 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -222,7 +222,7 @@ public: inline bool ghq_hirs_dump(void) const { return m_ghq_hirs_dump; } //Debug - int autodetect_ucode; + inline bool autodetect_ucode(void) const { return m_autodetect_ucode; } inline ucode_t ucode(void) const { return m_ucode; } int unk_as_red; int unk_clear; @@ -346,6 +346,7 @@ private: int m_ghq_cache_size; bool m_ghq_hirs_let_texartists_fly; bool m_ghq_hirs_dump; + bool m_autodetect_ucode; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index bd88a19d0..2b6968b1c 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -576,7 +576,7 @@ EXPORT void CALL ProcessDList(void) if (reset) { reset = 0; - if (g_settings->autodetect_ucode) + if (g_settings->autodetect_ucode()) { // Thanks to ZeZu for ucode autodetection!!! uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0); From fdd753f31d2136c6bd123f9f451b314973c3b337 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:04:53 +1100 Subject: [PATCH 29/66] [Glide64] Make unk_as_red private --- Source/Glide64/Combine.cpp | 3 +-- Source/Glide64/Settings.cpp | 9 ++++----- Source/Glide64/Settings.h | 3 ++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index 0cfc874e3..7f8134672 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -15659,7 +15659,7 @@ void Combine() Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7], Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]); } - if (g_settings->unk_as_red) + if (g_settings->unk_as_red()) { BrightRed(); } @@ -15668,7 +15668,6 @@ void Combine() // use full alpha as default ac_t0(); } - //tex |= 3; } else { diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 4c3ba1a1d..84bc0d99a 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -55,7 +55,7 @@ CSettings::CSettings() : m_ghq_hirs_dump(false), m_autodetect_ucode(true), m_ucode(ucode_Fast3D), -unk_as_red(0), + m_unk_as_red(false), unk_clear(0), wireframe(0), wfmode(0), @@ -133,7 +133,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_ucode, "ucode", ucode_F3DEX2); general_setting(Set_wireframe, "wireframe", 0); general_setting(Set_wfmode, "wfmode", 1); - general_setting(Set_unk_as_red, "unk_as_red", 0); + general_setting(Set_unk_as_red, "unk_as_red", false); general_setting(Set_unk_clear, "unk_clear", 0); general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); @@ -553,15 +553,14 @@ void CSettings::ReadSettings() this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic); m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; + m_unk_as_red = GetSetting(Set_unk_as_red) != 0; #ifndef _ENDUSER_RELEASE_ this->wireframe = GetSetting(Set_wireframe); this->wfmode = GetSetting(Set_wfmode); - this->unk_as_red = GetSetting(Set_unk_as_red); this->unk_clear = GetSetting(Set_unk_clear); #else this->wireframe = FALSE; this->wfmode = 0; - this->unk_as_red = FALSE; this->unk_clear = FALSE; #endif m_ucode = ucode_F3DEX2; @@ -831,11 +830,11 @@ void CSettings::WriteSettings(void) SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); SetSetting(Set_autodetect_ucode, m_autodetect_ucode); + SetSetting(Set_unk_as_red, m_unk_as_red); #ifndef _ENDUSER_RELEASE_ SetSetting(Set_ucode, (int)g_settings->ucode); SetSetting(Set_wireframe, g_settings->wireframe); SetSetting(Set_wfmode, g_settings->wfmode); - SetSetting(Set_unk_as_red,g_settings->unk_as_red); SetSetting(Set_unk_clear, g_settings->unk_clear); #endif //_ENDUSER_RELEASE_ diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 2d132811a..b67e10d73 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -224,7 +224,7 @@ public: //Debug inline bool autodetect_ucode(void) const { return m_autodetect_ucode; } inline ucode_t ucode(void) const { return m_ucode; } - int unk_as_red; + inline bool unk_as_red(void) const { return m_unk_as_red; } int unk_clear; int wireframe; int wfmode; @@ -347,6 +347,7 @@ private: bool m_ghq_hirs_let_texartists_fly; bool m_ghq_hirs_dump; bool m_autodetect_ucode; + bool m_unk_as_red; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; From 28cdaaff48880e2b5c001dc4e16db1066035cd6f Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:12:09 +1100 Subject: [PATCH 30/66] [Glide64] Remove unused unk_clear --- Source/Glide64/Settings.cpp | 5 ----- Source/Glide64/Settings.h | 1 - Source/Glide64/SettingsID.h | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 84bc0d99a..357c1a1da 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -56,7 +56,6 @@ CSettings::CSettings() : m_autodetect_ucode(true), m_ucode(ucode_Fast3D), m_unk_as_red(false), -unk_clear(0), wireframe(0), wfmode(0), @@ -134,7 +133,6 @@ void CSettings::RegisterSettings(void) general_setting(Set_wireframe, "wireframe", 0); general_setting(Set_wfmode, "wfmode", 1); general_setting(Set_unk_as_red, "unk_as_red", false); - general_setting(Set_unk_clear, "unk_clear", 0); general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); @@ -557,11 +555,9 @@ void CSettings::ReadSettings() #ifndef _ENDUSER_RELEASE_ this->wireframe = GetSetting(Set_wireframe); this->wfmode = GetSetting(Set_wfmode); - this->unk_clear = GetSetting(Set_unk_clear); #else this->wireframe = FALSE; this->wfmode = 0; - this->unk_clear = FALSE; #endif m_ucode = ucode_F3DEX2; @@ -835,7 +831,6 @@ void CSettings::WriteSettings(void) SetSetting(Set_ucode, (int)g_settings->ucode); SetSetting(Set_wireframe, g_settings->wireframe); SetSetting(Set_wfmode, g_settings->wfmode); - SetSetting(Set_unk_clear, g_settings->unk_clear); #endif //_ENDUSER_RELEASE_ SetSetting(Set_ghq_fltr, m_ghq_fltr); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index b67e10d73..7cc151352 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -225,7 +225,6 @@ public: inline bool autodetect_ucode(void) const { return m_autodetect_ucode; } inline ucode_t ucode(void) const { return m_ucode; } inline bool unk_as_red(void) const { return m_unk_as_red; } - int unk_clear; int wireframe; int wfmode; diff --git a/Source/Glide64/SettingsID.h b/Source/Glide64/SettingsID.h index 4b76d3acf..926bb7abe 100644 --- a/Source/Glide64/SettingsID.h +++ b/Source/Glide64/SettingsID.h @@ -15,7 +15,7 @@ enum // General Settings Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM, Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, - Set_wfmode, Set_unk_as_red, Set_unk_clear, Set_ghq_fltr, + Set_wfmode, Set_unk_as_red, Set_ghq_fltr, Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr, Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc, From 0c24c4e12b3b8baff806f059515c91f264fc7d9f Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:18:58 +1100 Subject: [PATCH 31/66] [Glide64] Make wireframe private --- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 9 ++++----- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 2 +- Source/Glide64/rdp.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index c7ad892f4..90846715c 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1565,7 +1565,7 @@ void newSwapBuffers() } } - if (g_settings->wireframe || g_settings->buff_clear() || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX)) + if (g_settings->wireframe() || g_settings->buff_clear() || (g_settings->hacks(CSettings::hack_PPL) && g_settings->ucode() == CSettings::ucode_S2DEX)) { grDepthMask((g_settings->hacks(CSettings::hack_RE2) && g_settings->fb_depth_render_enabled()) ? FXFALSE : FXTRUE); grBufferClear(0, 0, 0xFFFF); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 357c1a1da..abdc2d6b9 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -56,7 +56,7 @@ CSettings::CSettings() : m_autodetect_ucode(true), m_ucode(ucode_Fast3D), m_unk_as_red(false), -wireframe(0), + m_wireframe(false), wfmode(0), // Special fixes @@ -130,7 +130,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0); general_setting(Set_autodetect_ucode, "autodetect_ucode", true); general_setting(Set_ucode, "ucode", ucode_F3DEX2); - general_setting(Set_wireframe, "wireframe", 0); + general_setting(Set_wireframe, "wireframe", false); general_setting(Set_wfmode, "wfmode", 1); general_setting(Set_unk_as_red, "unk_as_red", false); general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); @@ -552,11 +552,10 @@ void CSettings::ReadSettings() m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; m_unk_as_red = GetSetting(Set_unk_as_red) != 0; + m_wireframe = GetSetting(Set_wireframe) != 0; #ifndef _ENDUSER_RELEASE_ - this->wireframe = GetSetting(Set_wireframe); this->wfmode = GetSetting(Set_wfmode); #else - this->wireframe = FALSE; this->wfmode = 0; #endif m_ucode = ucode_F3DEX2; @@ -826,10 +825,10 @@ void CSettings::WriteSettings(void) SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); SetSetting(Set_autodetect_ucode, m_autodetect_ucode); + SetSetting(Set_wireframe, m_wireframe); SetSetting(Set_unk_as_red, m_unk_as_red); #ifndef _ENDUSER_RELEASE_ SetSetting(Set_ucode, (int)g_settings->ucode); - SetSetting(Set_wireframe, g_settings->wireframe); SetSetting(Set_wfmode, g_settings->wfmode); #endif //_ENDUSER_RELEASE_ diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 7cc151352..445698995 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -225,7 +225,7 @@ public: inline bool autodetect_ucode(void) const { return m_autodetect_ucode; } inline ucode_t ucode(void) const { return m_ucode; } inline bool unk_as_red(void) const { return m_unk_as_red; } - int wireframe; + inline bool wireframe(void) const { return m_wireframe; } int wfmode; // Special fixes @@ -347,6 +347,7 @@ private: bool m_ghq_hirs_dump; bool m_autodetect_ucode; bool m_unk_as_red; + bool m_wireframe; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 9cca4cf63..641daf2f7 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1576,7 +1576,7 @@ static void render_tri(uint16_t linew, int old_interpolate) cmb.cmb_ext_use = cmb.tex_cmb_ext_use = 0; - if (g_settings->wireframe) + if (g_settings->wireframe()) { SetWireframeCol(); for (i = 0; i < n; i++) diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 2b6968b1c..aaf58ccf3 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -1411,7 +1411,7 @@ static void rdp_texrect() ConvertCoordsConvert(vptr, n_vertices); - if (g_settings->wireframe) + if (g_settings->wireframe()) { SetWireframeCol(); grDrawLine(&vstd[0], &vstd[2]); @@ -2389,7 +2389,7 @@ static void rdp_fillrect() } } - if (g_settings->wireframe) + if (g_settings->wireframe()) { SetWireframeCol(); grDrawLine(&v[0], &v[2]); From 444735966c6cf8a0716726ed8b25a6da3dcaa71a Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:24:23 +1100 Subject: [PATCH 32/66] [Glide64] Make wfmode private --- Source/Glide64/Settings.cpp | 12 ++++-------- Source/Glide64/Settings.h | 9 ++++++++- Source/Glide64/rdp.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index abdc2d6b9..cdf2aab33 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -57,7 +57,7 @@ CSettings::CSettings() : m_ucode(ucode_Fast3D), m_unk_as_red(false), m_wireframe(false), -wfmode(0), + m_wfmode(wfmode_VertexColors), // Special fixes offset_x(0), @@ -131,7 +131,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_autodetect_ucode, "autodetect_ucode", true); general_setting(Set_ucode, "ucode", ucode_F3DEX2); general_setting(Set_wireframe, "wireframe", false); - general_setting(Set_wfmode, "wfmode", 1); + general_setting(Set_wfmode, "wfmode", wfmode_VertexColors); general_setting(Set_unk_as_red, "unk_as_red", false); general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); @@ -553,11 +553,7 @@ void CSettings::ReadSettings() m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; m_unk_as_red = GetSetting(Set_unk_as_red) != 0; m_wireframe = GetSetting(Set_wireframe) != 0; -#ifndef _ENDUSER_RELEASE_ - this->wfmode = GetSetting(Set_wfmode); -#else - this->wfmode = 0; -#endif + m_wfmode = (wfmode_t)GetSetting(Set_wfmode); m_ucode = ucode_F3DEX2; char texture_dir[260]; @@ -826,10 +822,10 @@ void CSettings::WriteSettings(void) SetSetting(Set_autodetect_ucode, m_autodetect_ucode); SetSetting(Set_wireframe, m_wireframe); + SetSetting(Set_wfmode, m_wfmode); SetSetting(Set_unk_as_red, m_unk_as_red); #ifndef _ENDUSER_RELEASE_ SetSetting(Set_ucode, (int)g_settings->ucode); - SetSetting(Set_wfmode, g_settings->wfmode); #endif //_ENDUSER_RELEASE_ SetSetting(Set_ghq_fltr, m_ghq_fltr); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 445698995..44b85599f 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -157,6 +157,12 @@ public: ucode_Turbo3d = 21, }; + enum wfmode_t + { + wfmode_NormalColors = 0, + wfmode_VertexColors = 1, + wfmode_RedOnly = 2, + }; enum FBCRCMODE_t { @@ -226,7 +232,7 @@ public: inline ucode_t ucode(void) const { return m_ucode; } inline bool unk_as_red(void) const { return m_unk_as_red; } inline bool wireframe(void) const { return m_wireframe; } - int wfmode; + inline wfmode_t wfmode(void) const { return m_wfmode; } // Special fixes int offset_x, offset_y; @@ -348,6 +354,7 @@ private: bool m_autodetect_ucode; bool m_unk_as_red; bool m_wireframe; + wfmode_t m_wfmode; ucode_t m_ucode; StippleMode_t m_stipple_mode; hacks_t m_hacks; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index aaf58ccf3..708ed1649 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -2970,10 +2970,10 @@ static void rsp_reserved3() void SetWireframeCol() { - switch (g_settings->wfmode) + switch (g_settings->wfmode()) { - //case 0: // normal colors, don't do anything - case 1: // vertex colors + //case CSettings::wfmode_NormalColors: // normal colors, don't do anything + case CSettings::wfmode_VertexColors: grColorCombine(GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_ITERATED, @@ -3001,7 +3001,7 @@ void SetWireframeCol() GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE); break; - case 2: // red only + case CSettings::wfmode_RedOnly: grColorCombine(GR_COMBINE_FUNCTION_LOCAL, GR_COMBINE_FACTOR_NONE, GR_COMBINE_LOCAL_CONSTANT, From 711017acf4d487cd68c470917c4cb19a12145d16 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:26:36 +1100 Subject: [PATCH 33/66] [Glide64] Remove unused offset_x, offset_y, scale_x, scale_y --- Source/Glide64/Settings.cpp | 4 ---- Source/Glide64/Settings.h | 2 -- 2 files changed, 6 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index cdf2aab33..856a7514e 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -60,10 +60,6 @@ CSettings::CSettings() : m_wfmode(wfmode_VertexColors), // Special fixes -offset_x(0), -offset_y(0), -scale_x(0), -scale_y(0), fast_crc(0), alt_tex_size(0), use_sts1_only(0), diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 44b85599f..c46bb3f69 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -235,8 +235,6 @@ public: inline wfmode_t wfmode(void) const { return m_wfmode; } // Special fixes - int offset_x, offset_y; - int scale_x, scale_y; int fast_crc; int alt_tex_size; int use_sts1_only; From 9c25c2bd41185ee45dc717d06d488fa117882bd7 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 05:28:39 +1100 Subject: [PATCH 34/66] [Glide64] Make fast_crc private --- Source/Glide64/Settings.cpp | 8 ++++---- Source/Glide64/Settings.h | 3 ++- Source/Glide64/TexCache.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 856a7514e..a50cb53a0 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -59,8 +59,8 @@ CSettings::CSettings() : m_wireframe(false), m_wfmode(wfmode_VertexColors), -// Special fixes -fast_crc(0), + // Special fixes + m_fast_crc(false), alt_tex_size(0), use_sts1_only(0), flame_corona(0), //hack for zeldas flame's corona @@ -178,7 +178,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_force_quad3d, "force_quad3d", 0); game_setting(Set_clip_zmin, "clip_zmin", 0); game_setting(Set_clip_zmax, "clip_zmax", 1); - game_setting(Set_fast_crc, "fast_crc", 1); + game_setting(Set_fast_crc, "fast_crc", true); game_setting(Set_adjust_aspect, "adjust_aspect", 1); game_setting(Set_zmode_compare_less, "zmode_compare_less", 0); game_setting(Set_old_style_adither, "old_style_adither", 0); @@ -731,7 +731,7 @@ void CSettings::ReadGameSettings(const char * name) g_settings->force_quad3d = GetSetting(Set_force_quad3d); g_settings->clip_zmin = GetSetting(Set_clip_zmin); g_settings->clip_zmax = GetSetting(Set_clip_zmax); - g_settings->fast_crc = GetSetting(Set_fast_crc); + m_fast_crc = GetSetting(Set_fast_crc) != 0; g_settings->adjust_aspect = GetSetting(Set_adjust_aspect); g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less); g_settings->old_style_adither = GetSetting(Set_old_style_adither); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index c46bb3f69..a7857a771 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -235,7 +235,7 @@ public: inline wfmode_t wfmode(void) const { return m_wfmode; } // Special fixes - int fast_crc; + inline bool fast_crc(void) const { return m_fast_crc; } int alt_tex_size; int use_sts1_only; int flame_corona; //hack for zeldas flame's corona @@ -354,6 +354,7 @@ private: bool m_wireframe; wfmode_t m_wfmode; ucode_t m_ucode; + bool m_fast_crc; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index e152a7f67..3bad7dc4d 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -353,7 +353,7 @@ void GetTexInfo(int id, int tile) if (rdp.tiles[tile].size == 3) line <<= 1; uint32_t crc = 0; - if (g_settings->fast_crc) + if (g_settings->fast_crc()) { line = (line - wid_64) << 3; if (wid_64 < 1) wid_64 = 1; From 6efb455afc0d5687ad9fb349e1ce950576235e07 Mon Sep 17 00:00:00 2001 From: Frank-74 Date: Sun, 12 Mar 2017 18:36:09 +0000 Subject: [PATCH 35/66] Update Project64.rdb --- Config/Project64.rdb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 5099d8d6d..521d8f9eb 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1442,6 +1442,7 @@ Counter Factor=1 Culling=1 RDRAM Size=8 Save Type=16kbit Eeprom +Cheat0=806128E2 0000 // Polygon Tearing Fix [053C89A7-A5064302-C:4A] Good Name=Donkey Kong 64 (J) @@ -1453,6 +1454,7 @@ Plugin Note=[Glide64] fairy bug; transitions Counter Factor=1 RDRAM Size=8 Save Type=16kbit Eeprom +Cheat0=806170A2 0000 // Polygon Tearing Fix [EC58EABF-AD7C7169-C:45] Good Name=Donkey Kong 64 (U) From 19cb88a7fa67f0891c9f2d3ab3a07b9a5f1e3578 Mon Sep 17 00:00:00 2001 From: Frank-74 Date: Sun, 12 Mar 2017 18:42:00 +0000 Subject: [PATCH 36/66] Update Project64.rdb --- Config/Project64.rdb | 2 -- 1 file changed, 2 deletions(-) diff --git a/Config/Project64.rdb b/Config/Project64.rdb index 521d8f9eb..63c961956 100644 --- a/Config/Project64.rdb +++ b/Config/Project64.rdb @@ -1435,7 +1435,6 @@ Save Type=4kbit Eeprom Good Name=Donkey Kong 64 (E) Internal Name=DONKEY KONG 64 Status=Compatible -Core Note=Polygon tearing Plugin Note=[Glide64] fairy bug; transitions 32bit=No Counter Factor=1 @@ -1448,7 +1447,6 @@ Cheat0=806128E2 0000 // Polygon Tearing Fix Good Name=Donkey Kong 64 (J) Internal Name=DONKEY KONG 64 Status=Compatible -Core Note=Polygon tearing Plugin Note=[Glide64] fairy bug; transitions 32bit=No Counter Factor=1 From ecb32bd4a057a3f3985230d5cbd6c84cc8bf3388 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:12:17 +1100 Subject: [PATCH 37/66] [Glide64] Make alt_tex_size private --- Source/Glide64/Settings.cpp | 10 +++------- Source/Glide64/Settings.h | 4 ++-- Source/Glide64/TexCache.cpp | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index a50cb53a0..c4ccceee1 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -61,7 +61,7 @@ CSettings::CSettings() : // Special fixes m_fast_crc(false), -alt_tex_size(0), + m_alt_tex_size(false), use_sts1_only(0), flame_corona(0), //hack for zeldas flame's corona increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect @@ -97,10 +97,6 @@ m_FlushLogs(false) ReadSettings(); } -CSettings::~CSettings() -{ -} - void CSettings::RegisterSettings(void) { SetModuleName("default"); @@ -163,7 +159,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_fb_get_info_default, "fb_get_info", false); general_setting(Set_fb_render_default, "fb_render", false); - game_setting(Set_alt_tex_size, "alt_tex_size", 0); + game_setting(Set_alt_tex_size, "alt_tex_size", false); game_setting(Set_use_sts1_only, "use_sts1_only", 0); game_setting(Set_force_calc_sphere, "force_calc_sphere", 0); game_setting(Set_correct_viewport, "correct_viewport", 0); @@ -716,7 +712,7 @@ void CSettings::ReadGameSettings(const char * name) m_hacks = (hacks_t)(m_hacks | CSettings::hack_Winback); } - g_settings->alt_tex_size = GetSetting(Set_alt_tex_size); + m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0; g_settings->use_sts1_only = GetSetting(Set_use_sts1_only); g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere); g_settings->correct_viewport = GetSetting(Set_correct_viewport); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index a7857a771..d529fc6b9 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -5,7 +5,6 @@ class CSettings { public: CSettings(); - ~CSettings(); //Frame buffer emulation options enum fb_bits_t @@ -236,7 +235,7 @@ public: // Special fixes inline bool fast_crc(void) const { return m_fast_crc; } - int alt_tex_size; + inline bool alt_tex_size(void) const { return m_alt_tex_size; } int use_sts1_only; int flame_corona; //hack for zeldas flame's corona int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect @@ -355,6 +354,7 @@ private: wfmode_t m_wfmode; ucode_t m_ucode; bool m_fast_crc; + bool m_alt_tex_size; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/TexCache.cpp b/Source/Glide64/TexCache.cpp index 3bad7dc4d..a6c0dcee8 100644 --- a/Source/Glide64/TexCache.cpp +++ b/Source/Glide64/TexCache.cpp @@ -200,7 +200,7 @@ void GetTexInfo(int id, int tile) mask_width = (rdp.tiles[tile].mask_s == 0) ? (tile_width) : (1 << rdp.tiles[tile].mask_s); mask_height = (rdp.tiles[tile].mask_t == 0) ? (tile_height) : (1 << rdp.tiles[tile].mask_t); - if (g_settings->alt_tex_size) + if (g_settings->alt_tex_size()) { // ** ALTERNATE TEXTURE SIZE METHOD ** // Helps speed in some games that loaded weird-sized textures, but could break other From 0daa369800ba974f2fa421ecad97819ac87591a7 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:16:27 +1100 Subject: [PATCH 38/66] [Glide64] Make use_sts1_only private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/rdp.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index c4ccceee1..0bca1df31 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -62,7 +62,7 @@ CSettings::CSettings() : // Special fixes m_fast_crc(false), m_alt_tex_size(false), -use_sts1_only(0), + m_use_sts1_only(false), flame_corona(0), //hack for zeldas flame's corona increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect @@ -160,7 +160,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_fb_render_default, "fb_render", false); game_setting(Set_alt_tex_size, "alt_tex_size", false); - game_setting(Set_use_sts1_only, "use_sts1_only", 0); + game_setting(Set_use_sts1_only, "use_sts1_only", false); game_setting(Set_force_calc_sphere, "force_calc_sphere", 0); game_setting(Set_correct_viewport, "correct_viewport", 0); game_setting(Set_increase_texrect_edge, "increase_texrect_edge", 0); @@ -713,7 +713,7 @@ void CSettings::ReadGameSettings(const char * name) } m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0; - g_settings->use_sts1_only = GetSetting(Set_use_sts1_only); + m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0; g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere); g_settings->correct_viewport = GetSetting(Set_correct_viewport); g_settings->increase_texrect_edge = GetSetting(Set_increase_texrect_edge); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index d529fc6b9..6ffb7f382 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -236,7 +236,7 @@ public: // Special fixes inline bool fast_crc(void) const { return m_fast_crc; } inline bool alt_tex_size(void) const { return m_alt_tex_size; } - int use_sts1_only; + inline bool use_sts1_only(void) const { return m_use_sts1_only; } int flame_corona; //hack for zeldas flame's corona int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect @@ -355,6 +355,7 @@ private: ucode_t m_ucode; bool m_fast_crc; bool m_alt_tex_size; + bool m_use_sts1_only; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 708ed1649..8cf698da5 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -1643,7 +1643,7 @@ static void rdp_settilesize() else if (wrong_tile == (int)tile) wrong_tile = -1; - if (g_settings->use_sts1_only) + if (g_settings->use_sts1_only()) { // ** USE FIRST SETTILESIZE ONLY ** // This option helps certain textures while using the 'Alternate texture size method', From 160fa97aa9100e67bfb468f3fe02ba761830abd0 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:19:09 +1100 Subject: [PATCH 39/66] [Glide64] Make flame_corona private --- Source/Glide64/Settings.cpp | 4 ++-- Source/Glide64/Settings.h | 3 ++- Source/Glide64/ucode00.h | 2 +- Source/Glide64/ucode02.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 0bca1df31..5de9c83db 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -63,7 +63,7 @@ CSettings::CSettings() : m_fast_crc(false), m_alt_tex_size(false), m_use_sts1_only(false), -flame_corona(0), //hack for zeldas flame's corona + m_flame_corona(false), //hack for zeldas flame's corona increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect texture_correction(0), // enable perspective texture correction emulation. is on by default @@ -795,7 +795,7 @@ void CSettings::ReadGameSettings(const char * name) SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default)); SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default)); SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default)); - g_settings->flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled(); + m_flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled(); } void CSettings::WriteSettings(void) diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 6ffb7f382..927ebdbfa 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -237,7 +237,7 @@ public: inline bool fast_crc(void) const { return m_fast_crc; } inline bool alt_tex_size(void) const { return m_alt_tex_size; } inline bool use_sts1_only(void) const { return m_use_sts1_only; } - int flame_corona; //hack for zeldas flame's corona + inline bool flame_corona(void) const { return m_flame_corona; } //hack for zeldas flame's corona int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect int texture_correction; // enable perspective texture correction emulation. is on by default @@ -356,6 +356,7 @@ private: bool m_fast_crc; bool m_alt_tex_size; bool m_use_sts1_only; + bool m_flame_corona; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/ucode00.h b/Source/Glide64/ucode00.h index 684f4948e..18ad2d47d 100644 --- a/Source/Glide64/ucode00.h +++ b/Source/Glide64/ucode00.h @@ -922,7 +922,7 @@ static void uc0_setothermode_l() rdp.update |= UPDATE_FOG_ENABLED; //if blender has no fog bits, fog must be set off rdp.render_mode_changed |= rdp.rm ^ rdp.othermode_l; rdp.rm = rdp.othermode_l; - if (g_settings->flame_corona && (rdp.rm == 0x00504341)) //hack for flame's corona + if (g_settings->flame_corona() && (rdp.rm == 0x00504341)) //hack for flame's corona { rdp.othermode_l |= 0x00000010; } diff --git a/Source/Glide64/ucode02.h b/Source/Glide64/ucode02.h index c17b6f076..3f4ba0328 100644 --- a/Source/Glide64/ucode02.h +++ b/Source/Glide64/ucode02.h @@ -413,7 +413,7 @@ static void uc2_geom_mode() { if ((rdp.flags & ZBUF_ENABLED)) { - if (!g_settings->flame_corona || (rdp.rm != 0x00504341)) //hack for flame's corona + if (!g_settings->flame_corona() || (rdp.rm != 0x00504341)) //hack for flame's corona { rdp.flags ^= ZBUF_ENABLED; } From ca12d5a740b08acf2e25a7e52aec17d452db93aa Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:22:57 +1100 Subject: [PATCH 40/66] [Glide64] Increase increase_texrect_edge --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/rdp.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 5de9c83db..5bc0c9623 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -64,7 +64,7 @@ CSettings::CSettings() : m_alt_tex_size(false), m_use_sts1_only(false), m_flame_corona(false), //hack for zeldas flame's corona -increase_texrect_edge(0), // add 1 to lower right corner coordinates of texrect + m_increase_texrect_edge(false), // add 1 to lower right corner coordinates of texrect decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect texture_correction(0), // enable perspective texture correction emulation. is on by default m_stipple_mode(STIPPLE_Disable), //used for dithered alpha emulation @@ -163,7 +163,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_use_sts1_only, "use_sts1_only", false); game_setting(Set_force_calc_sphere, "force_calc_sphere", 0); game_setting(Set_correct_viewport, "correct_viewport", 0); - game_setting(Set_increase_texrect_edge, "increase_texrect_edge", 0); + game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false); game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", 0); game_setting(Set_texture_correction, "texture_correction", 1); game_setting(Set_pal230, "pal230", 0); @@ -716,7 +716,7 @@ void CSettings::ReadGameSettings(const char * name) m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0; g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere); g_settings->correct_viewport = GetSetting(Set_correct_viewport); - g_settings->increase_texrect_edge = GetSetting(Set_increase_texrect_edge); + m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; g_settings->decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge); g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1; g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0; diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 927ebdbfa..944c4b7a9 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -238,7 +238,7 @@ public: inline bool alt_tex_size(void) const { return m_alt_tex_size; } inline bool use_sts1_only(void) const { return m_use_sts1_only; } inline bool flame_corona(void) const { return m_flame_corona; } //hack for zeldas flame's corona - int increase_texrect_edge; // add 1 to lower right corner coordinates of texrect + inline bool increase_texrect_edge(void) const { return m_increase_texrect_edge; } // add 1 to lower right corner coordinates of texrect int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect int 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 @@ -357,6 +357,7 @@ private: bool m_alt_tex_size; bool m_use_sts1_only; bool m_flame_corona; + bool m_increase_texrect_edge; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 8cf698da5..86bc3c122 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -1008,7 +1008,7 @@ static void rdp_texrect() else if (lr_y - ul_y < 1.0f) lr_y = ceil(lr_y); - if (g_settings->increase_texrect_edge) + if (g_settings->increase_texrect_edge()) { if (floor(lr_x) != lr_x) lr_x = ceil(lr_x); From cd34f9a25de52769073c176dc70632ef0b8c000f Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:31:03 +1100 Subject: [PATCH 41/66] [Glide64] Make decrease_fillrect_edge private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/rdp.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 5bc0c9623..81491fa5b 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -65,7 +65,7 @@ CSettings::CSettings() : m_use_sts1_only(false), m_flame_corona(false), //hack for zeldas flame's corona m_increase_texrect_edge(false), // add 1 to lower right corner coordinates of texrect -decrease_fillrect_edge(0), // sub 1 from lower right corner coordinates of fillrect + m_decrease_fillrect_edge(false), // sub 1 from lower right corner coordinates of fillrect texture_correction(0), // 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 @@ -164,7 +164,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_force_calc_sphere, "force_calc_sphere", 0); game_setting(Set_correct_viewport, "correct_viewport", 0); game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false); - game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", 0); + game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", false); game_setting(Set_texture_correction, "texture_correction", 1); game_setting(Set_pal230, "pal230", 0); game_setting(Set_stipple_mode, "stipple_mode", STIPPLE_Rotate); @@ -717,7 +717,7 @@ void CSettings::ReadGameSettings(const char * name) g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere); g_settings->correct_viewport = GetSetting(Set_correct_viewport); m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; - g_settings->decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge); + m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1; g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0; m_stipple_mode = (StippleMode_t)GetSetting(Set_stipple_mode); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 944c4b7a9..43fb521c6 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -239,7 +239,7 @@ public: inline bool use_sts1_only(void) const { return m_use_sts1_only; } inline bool flame_corona(void) const { return m_flame_corona; } //hack for zeldas flame's corona inline bool increase_texrect_edge(void) const { return m_increase_texrect_edge; } // add 1 to lower right corner coordinates of texrect - int decrease_fillrect_edge; // sub 1 from lower right corner coordinates of fillrect + inline bool decrease_fillrect_edge(void) const { return m_decrease_fillrect_edge; }; // sub 1 from lower right corner coordinates of fillrect int 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 @@ -358,6 +358,7 @@ private: bool m_use_sts1_only; bool m_flame_corona; bool m_increase_texrect_edge; + bool m_decrease_fillrect_edge; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 86bc3c122..13c12fb4b 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -2284,7 +2284,7 @@ static void rdp_fillrect() // Update scissor update_scissor(); - if (g_settings->decrease_fillrect_edge && rdp.cycle_mode == 0) + if (g_settings->decrease_fillrect_edge() && rdp.cycle_mode == 0) { lr_x--; lr_y--; } From 09504e2244e1e018e5d27172076d0d6b6768dd38 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:36:14 +1100 Subject: [PATCH 42/66] [Glide64] Make texture_correction private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/rdp.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 81491fa5b..b825e4dd2 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -66,7 +66,7 @@ CSettings::CSettings() : m_flame_corona(false), //hack for zeldas flame's corona m_increase_texrect_edge(false), // add 1 to lower right corner coordinates of texrect m_decrease_fillrect_edge(false), // sub 1 from lower right corner coordinates of fillrect -texture_correction(0), // enable perspective texture correction emulation. is on by default + 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 force_microcheck(0), //check microcode each frame, for mixed F3DEX-S2DEX games @@ -165,7 +165,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_correct_viewport, "correct_viewport", 0); game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false); game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", false); - game_setting(Set_texture_correction, "texture_correction", 1); + game_setting(Set_texture_correction, "texture_correction", true); game_setting(Set_pal230, "pal230", 0); game_setting(Set_stipple_mode, "stipple_mode", STIPPLE_Rotate); @@ -718,7 +718,7 @@ void CSettings::ReadGameSettings(const char * name) g_settings->correct_viewport = GetSetting(Set_correct_viewport); m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; - g_settings->texture_correction = GetSetting(Set_texture_correction) == 0 ? 0 : 1; + m_texture_correction = GetSetting(Set_texture_correction) != 0; 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); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 43fb521c6..8d30dbf66 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -240,7 +240,7 @@ public: inline bool flame_corona(void) const { return m_flame_corona; } //hack for zeldas flame's corona inline bool increase_texrect_edge(void) const { return m_increase_texrect_edge; } // add 1 to lower right corner coordinates of texrect inline bool decrease_fillrect_edge(void) const { return m_decrease_fillrect_edge; }; // sub 1 from lower right corner coordinates of fillrect - int texture_correction; // enable perspective texture correction emulation. is on by default + 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 int force_microcheck; //check microcode each frame, for mixed F3DEX-S2DEX games @@ -359,6 +359,7 @@ private: bool m_flame_corona; bool m_increase_texrect_edge; bool m_decrease_fillrect_edge; + bool m_texture_correction; StippleMode_t m_stipple_mode; hacks_t m_hacks; }; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 13c12fb4b..b43e3ee0f 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -350,7 +350,7 @@ void microcheck() rdp.Persp_en = 1; rdp.persp_supported = FALSE; } - else if (g_settings->texture_correction) + else if (g_settings->texture_correction()) { rdp.persp_supported = TRUE; } From c2bb2c5dac272a91efaaf83cdfe09b12035509ca Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:48:22 +1100 Subject: [PATCH 43/66] [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) { From 9dc2a8bc8c5532b802e7266501f938f2fe5beef5 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:52:37 +1100 Subject: [PATCH 44/66] [Glide64] Make force_microcheck private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/rdp.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 107b1d399..ea9021be3 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -69,7 +69,7 @@ CSettings::CSettings() : m_texture_correction(false), // enable perspective texture correction emulation. is on by default m_stipple_mode(STIPPLE_Disable), //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 + m_force_microcheck(false), //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 clip_zmax(0), //enable far plane clipping; @@ -170,7 +170,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_stipple_mode, "stipple_mode", STIPPLE_Rotate); game_setting(Set_stipple_pattern, "stipple_pattern", 0x3E0F83E0); - game_setting(Set_force_microcheck, "force_microcheck", 0); + game_setting(Set_force_microcheck, "force_microcheck", false); game_setting(Set_force_quad3d, "force_quad3d", 0); game_setting(Set_clip_zmin, "clip_zmin", 0); game_setting(Set_clip_zmax, "clip_zmax", 1); @@ -723,7 +723,7 @@ void CSettings::ReadGameSettings(const char * name) m_stipple_mode = (StippleMode_t)GetSetting(Set_stipple_mode); int stipple_pattern = GetSetting(Set_stipple_pattern); m_stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0; - g_settings->force_microcheck = GetSetting(Set_force_microcheck); + m_force_microcheck = GetSetting(Set_force_microcheck) != 0; g_settings->force_quad3d = GetSetting(Set_force_quad3d); g_settings->clip_zmin = GetSetting(Set_clip_zmin); g_settings->clip_zmax = GetSetting(Set_clip_zmax); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 1e504669f..6ac547107 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -243,7 +243,7 @@ public: 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 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 + inline bool force_microcheck(void) const { return m_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 int clip_zmax; //enable far plane clipping; @@ -362,6 +362,7 @@ private: bool m_texture_correction; StippleMode_t m_stipple_mode; uint32_t m_stipple_pattern; + bool m_force_microcheck; hacks_t m_hacks; }; diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index 5ea461bfc..fb241369d 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -586,7 +586,7 @@ EXPORT void CALL ProcessDList(void) else memset(microcode, 0, 4096); } - else if ((g_old_ucode == CSettings::ucode_S2DEX && g_settings->ucode() == CSettings::ucode_F3DEX) || g_settings->force_microcheck) + else if ((g_old_ucode == CSettings::ucode_S2DEX && g_settings->ucode() == CSettings::ucode_F3DEX) || g_settings->force_microcheck()) { uint32_t startUcode = *(uint32_t*)(gfx.DMEM + 0xFD0); memcpy(microcode, gfx.RDRAM + startUcode, 4096); From d21cf7e88e0e74ad9da93b55703eb00c1326dfc6 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:55:58 +1100 Subject: [PATCH 45/66] [Glide64] Make force_quad3d private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/ucode01.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index ea9021be3..aad2667fc 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -70,7 +70,7 @@ CSettings::CSettings() : m_stipple_mode(STIPPLE_Disable), //used for dithered alpha emulation m_stipple_pattern(0), //used for dithered alpha emulation m_force_microcheck(false), //check microcode each frame, for mixed F3DEX-S2DEX games -force_quad3d(0), //force 0xb5 command to be quad, not line 3d + m_force_quad3d(false), //force 0xb5 command to be quad, not line 3d clip_zmin(0), //enable near z clipping clip_zmax(0), //enable far plane clipping; adjust_aspect(0), //adjust screen aspect for wide screen mode @@ -171,7 +171,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_stipple_pattern, "stipple_pattern", 0x3E0F83E0); game_setting(Set_force_microcheck, "force_microcheck", false); - game_setting(Set_force_quad3d, "force_quad3d", 0); + game_setting(Set_force_quad3d, "force_quad3d", false); game_setting(Set_clip_zmin, "clip_zmin", 0); game_setting(Set_clip_zmax, "clip_zmax", 1); game_setting(Set_fast_crc, "fast_crc", true); @@ -724,7 +724,7 @@ void CSettings::ReadGameSettings(const char * name) int stipple_pattern = GetSetting(Set_stipple_pattern); m_stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0; m_force_microcheck = GetSetting(Set_force_microcheck) != 0; - g_settings->force_quad3d = GetSetting(Set_force_quad3d); + m_force_quad3d = GetSetting(Set_force_quad3d) != 0; g_settings->clip_zmin = GetSetting(Set_clip_zmin); g_settings->clip_zmax = GetSetting(Set_clip_zmax); m_fast_crc = GetSetting(Set_fast_crc) != 0; diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 6ac547107..7fee0d0d8 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -244,7 +244,7 @@ public: inline StippleMode_t stipple_mode(void) const { return m_stipple_mode; } //used for dithered alpha emulation inline uint32_t stipple_pattern(void) const { return m_stipple_pattern; } //used for dithered alpha emulation inline bool force_microcheck(void) const { return m_force_microcheck; } //check microcode each frame, for mixed F3DEX-S2DEX games - int force_quad3d; //force 0xb5 command to be quad, not line 3d + inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d int clip_zmin; //enable near z clipping int clip_zmax; //enable far plane clipping; int adjust_aspect; //adjust screen aspect for wide screen mode @@ -363,6 +363,7 @@ private: StippleMode_t m_stipple_mode; uint32_t m_stipple_pattern; bool m_force_microcheck; + bool m_force_quad3d; hacks_t m_hacks; }; diff --git a/Source/Glide64/ucode01.h b/Source/Glide64/ucode01.h index 80d72eeeb..875756431 100644 --- a/Source/Glide64/ucode01.h +++ b/Source/Glide64/ucode01.h @@ -104,7 +104,7 @@ static void uc1_tri2() static void uc1_line3d() { - if (!g_settings->force_quad3d && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0)) + if (!g_settings->force_quad3d() && ((rdp.cmd1 & 0xFF000000) == 0) && ((rdp.cmd0 & 0x00FFFFFF) == 0)) { uint16_t width = (uint16_t)(rdp.cmd1 & 0xFF) + 3; From f5eb97bbb56fbe903743fb22deadfbe0182b15d9 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 07:59:00 +1100 Subject: [PATCH 46/66] [Glide64] make clip_zmin private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index aad2667fc..31adcd70a 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -71,7 +71,7 @@ CSettings::CSettings() : m_stipple_pattern(0), //used for dithered alpha emulation m_force_microcheck(false), //check microcode each frame, for mixed F3DEX-S2DEX games m_force_quad3d(false), //force 0xb5 command to be quad, not line 3d -clip_zmin(0), //enable near z clipping + m_clip_zmin(false), //enable near z clipping clip_zmax(0), //enable far plane clipping; adjust_aspect(0), //adjust screen aspect for wide screen mode force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64 @@ -172,7 +172,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_stipple_pattern, "stipple_pattern", 0x3E0F83E0); game_setting(Set_force_microcheck, "force_microcheck", false); game_setting(Set_force_quad3d, "force_quad3d", false); - game_setting(Set_clip_zmin, "clip_zmin", 0); + game_setting(Set_clip_zmin, "clip_zmin", false); game_setting(Set_clip_zmax, "clip_zmax", 1); game_setting(Set_fast_crc, "fast_crc", true); game_setting(Set_adjust_aspect, "adjust_aspect", 1); @@ -725,7 +725,7 @@ void CSettings::ReadGameSettings(const char * name) m_stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0; m_force_microcheck = GetSetting(Set_force_microcheck) != 0; m_force_quad3d = GetSetting(Set_force_quad3d) != 0; - g_settings->clip_zmin = GetSetting(Set_clip_zmin); + m_clip_zmin = GetSetting(Set_clip_zmin) != 0; g_settings->clip_zmax = GetSetting(Set_clip_zmax); m_fast_crc = GetSetting(Set_fast_crc) != 0; g_settings->adjust_aspect = GetSetting(Set_adjust_aspect); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 7fee0d0d8..1755297dd 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -245,7 +245,7 @@ public: inline uint32_t stipple_pattern(void) const { return m_stipple_pattern; } //used for dithered alpha emulation inline bool force_microcheck(void) const { return m_force_microcheck; } //check microcode each frame, for mixed F3DEX-S2DEX games inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d - int clip_zmin; //enable near z clipping + inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping int clip_zmax; //enable far plane clipping; int adjust_aspect; //adjust screen aspect for wide screen mode int force_calc_sphere; //use spheric mapping only, Ridge Racer 64 @@ -364,6 +364,7 @@ private: uint32_t m_stipple_pattern; bool m_force_microcheck; bool m_force_quad3d; + bool m_clip_zmin; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 6de55ef60..af7d4908b 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -802,7 +802,7 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th rdp.clip = 0; else { - if (!g_settings->clip_zmin) + if (!g_settings->clip_zmin()) { rdp.clip &= ~CLIP_ZMIN; } From 4dbcd47569409b9f9271a621a5d93ea335363baa Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 08:04:09 +1100 Subject: [PATCH 47/66] [Glide64] Make clip_zmax private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 31adcd70a..0fa3ad074 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -72,7 +72,7 @@ CSettings::CSettings() : m_force_microcheck(false), //check microcode each frame, for mixed F3DEX-S2DEX games m_force_quad3d(false), //force 0xb5 command to be quad, not line 3d m_clip_zmin(false), //enable near z clipping -clip_zmax(0), //enable far plane clipping; + m_clip_zmax(false), //enable far plane clipping; adjust_aspect(0), //adjust screen aspect for wide screen mode force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64 pal230(0), //set special scale for PAL games @@ -173,7 +173,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_force_microcheck, "force_microcheck", false); game_setting(Set_force_quad3d, "force_quad3d", false); game_setting(Set_clip_zmin, "clip_zmin", false); - game_setting(Set_clip_zmax, "clip_zmax", 1); + game_setting(Set_clip_zmax, "clip_zmax", true); game_setting(Set_fast_crc, "fast_crc", true); game_setting(Set_adjust_aspect, "adjust_aspect", 1); game_setting(Set_zmode_compare_less, "zmode_compare_less", 0); @@ -726,7 +726,7 @@ void CSettings::ReadGameSettings(const char * name) m_force_microcheck = GetSetting(Set_force_microcheck) != 0; m_force_quad3d = GetSetting(Set_force_quad3d) != 0; m_clip_zmin = GetSetting(Set_clip_zmin) != 0; - g_settings->clip_zmax = GetSetting(Set_clip_zmax); + m_clip_zmax = GetSetting(Set_clip_zmax) != 0; m_fast_crc = GetSetting(Set_fast_crc) != 0; g_settings->adjust_aspect = GetSetting(Set_adjust_aspect); g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 1755297dd..d4d759927 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -246,7 +246,7 @@ public: inline bool force_microcheck(void) const { return m_force_microcheck; } //check microcode each frame, for mixed F3DEX-S2DEX games inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping - int clip_zmax; //enable far plane clipping; + inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping int adjust_aspect; //adjust screen aspect for wide screen mode int force_calc_sphere; //use spheric mapping only, Ridge Racer 64 int pal230; //set special scale for PAL games @@ -365,6 +365,7 @@ private: bool m_force_microcheck; bool m_force_quad3d; bool m_clip_zmin; + bool m_clip_zmax; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index af7d4908b..7e14b64c5 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -806,7 +806,7 @@ void do_triangle_stuff(uint16_t linew, int old_interpolate) // what else?? do th { rdp.clip &= ~CLIP_ZMIN; } - if (!g_settings->clip_zmax) + if (!g_settings->clip_zmax()) { rdp.clip &= ~CLIP_ZMAX; } From 19cfdc174a9a1cc16d75925b23415a343f77e0d1 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 08:06:41 +1100 Subject: [PATCH 48/66] [Glide64] Make adjust_aspect private --- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 3fd0b3c03..3903cdee6 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -157,7 +157,7 @@ void _ChangeSize() rdp.vi_width = (hend - hstart) * fscale_x; rdp.vi_height = (vend - vstart) * fscale_y * 1.0126582f; - float aspect = (g_settings->adjust_aspect && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f; + float aspect = (g_settings->adjust_aspect() && (fscale_y > fscale_x) && (rdp.vi_width > rdp.vi_height)) ? fscale_x / fscale_y : 1.0f; WriteTrace(TraceResolution, TraceDebug, "hstart: %d, hend: %d, vstart: %d, vend: %d", hstart, hend, vstart, vend); WriteTrace(TraceResolution, TraceDebug, "size: %d x %d", (int)rdp.vi_width, (int)rdp.vi_height); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 0fa3ad074..5d0927714 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -73,7 +73,7 @@ CSettings::CSettings() : m_force_quad3d(false), //force 0xb5 command to be quad, not line 3d m_clip_zmin(false), //enable near z clipping m_clip_zmax(false), //enable far plane clipping; -adjust_aspect(0), //adjust screen aspect for wide screen mode + m_adjust_aspect(false), //adjust screen aspect for wide screen mode force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64 pal230(0), //set special scale for PAL games correct_viewport(0), //correct viewport values @@ -175,7 +175,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_clip_zmin, "clip_zmin", false); game_setting(Set_clip_zmax, "clip_zmax", true); game_setting(Set_fast_crc, "fast_crc", true); - game_setting(Set_adjust_aspect, "adjust_aspect", 1); + game_setting(Set_adjust_aspect, "adjust_aspect", true); game_setting(Set_zmode_compare_less, "zmode_compare_less", 0); game_setting(Set_old_style_adither, "old_style_adither", 0); game_setting(Set_n64_z_scale, "n64_z_scale", 0); @@ -728,7 +728,7 @@ void CSettings::ReadGameSettings(const char * name) m_clip_zmin = GetSetting(Set_clip_zmin) != 0; m_clip_zmax = GetSetting(Set_clip_zmax) != 0; m_fast_crc = GetSetting(Set_fast_crc) != 0; - g_settings->adjust_aspect = GetSetting(Set_adjust_aspect); + m_adjust_aspect = GetSetting(Set_adjust_aspect); g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less); g_settings->old_style_adither = GetSetting(Set_old_style_adither); g_settings->n64_z_scale = GetSetting(Set_n64_z_scale); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index d4d759927..bcae2b587 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -247,7 +247,7 @@ public: inline bool force_quad3d(void) const { return m_force_quad3d; } //force 0xb5 command to be quad, not line 3d inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping - int adjust_aspect; //adjust screen aspect for wide screen mode + inline bool adjust_aspect(void) const { return m_adjust_aspect; } //adjust screen aspect for wide screen mode int force_calc_sphere; //use spheric mapping only, Ridge Racer 64 int pal230; //set special scale for PAL games int correct_viewport; //correct viewport values @@ -366,6 +366,7 @@ private: bool m_force_quad3d; bool m_clip_zmin; bool m_clip_zmax; + bool m_adjust_aspect; hacks_t m_hacks; }; From 59eeb448f632938c8612a0ef217c9f4bbe132be3 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:11:14 +1100 Subject: [PATCH 49/66] [Glide64] Get force_calc_sphere to be private --- Source/Glide64/3dmath.cpp | 2 +- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/3dmath.cpp b/Source/Glide64/3dmath.cpp index ec0fc13c8..9d0b1f329 100644 --- a/Source/Glide64/3dmath.cpp +++ b/Source/Glide64/3dmath.cpp @@ -76,7 +76,7 @@ void calc_light(VERTEX *v) //* void calc_linear(VERTEX *v) { - if (g_settings->force_calc_sphere) + if (g_settings->force_calc_sphere()) { calc_sphere(v); return; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 5d0927714..42a1942cf 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -74,7 +74,7 @@ CSettings::CSettings() : m_clip_zmin(false), //enable near z clipping m_clip_zmax(false), //enable far plane clipping; m_adjust_aspect(false), //adjust screen aspect for wide screen mode -force_calc_sphere(0), //use spheric mapping only, Ridge Racer 64 + m_force_calc_sphere(false), //use spheric mapping only, Ridge Racer 64 pal230(0), //set special scale for PAL games correct_viewport(0), //correct viewport values zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) @@ -161,7 +161,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_alt_tex_size, "alt_tex_size", false); game_setting(Set_use_sts1_only, "use_sts1_only", false); - game_setting(Set_force_calc_sphere, "force_calc_sphere", 0); + game_setting(Set_force_calc_sphere, "force_calc_sphere", false); game_setting(Set_correct_viewport, "correct_viewport", 0); game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false); game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", false); @@ -714,7 +714,7 @@ void CSettings::ReadGameSettings(const char * name) m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0; m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0; - g_settings->force_calc_sphere = GetSetting(Set_force_calc_sphere); + m_force_calc_sphere = GetSetting(Set_force_calc_sphere) != 0; g_settings->correct_viewport = GetSetting(Set_correct_viewport); m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index bcae2b587..bda9b4cdf 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -248,7 +248,7 @@ public: inline bool clip_zmin(void) const { return m_clip_zmin; } //enable near z clipping inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping inline bool adjust_aspect(void) const { return m_adjust_aspect; } //adjust screen aspect for wide screen mode - int force_calc_sphere; //use spheric mapping only, Ridge Racer 64 + inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64 int pal230; //set special scale for PAL games int correct_viewport; //correct viewport values int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) @@ -367,6 +367,7 @@ private: bool m_clip_zmin; bool m_clip_zmax; bool m_adjust_aspect; + bool m_force_calc_sphere; hacks_t m_hacks; }; From ff805e9b3fb5493d5f9f745ed2df571d31294743 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:14:36 +1100 Subject: [PATCH 50/66] [Glide64] Get pal230 to be private --- Source/Glide64/Main.cpp | 2 +- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 3903cdee6..16618bd54 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -163,7 +163,7 @@ void _ChangeSize() WriteTrace(TraceResolution, TraceDebug, "size: %d x %d", (int)rdp.vi_width, (int)rdp.vi_height); rdp.scale_x = (float)g_settings->res_x() / rdp.vi_width; - if (region > 0 && g_settings->pal230) + if (region > 0 && g_settings->pal230()) { // odd... but pal games seem to want 230 as height... rdp.scale_y = res_scl_y * (230.0f / rdp.vi_height) * aspect; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 42a1942cf..cba3a1106 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -75,7 +75,7 @@ CSettings::CSettings() : m_clip_zmax(false), //enable far plane clipping; m_adjust_aspect(false), //adjust screen aspect for wide screen mode m_force_calc_sphere(false), //use spheric mapping only, Ridge Racer 64 -pal230(0), //set special scale for PAL games + m_pal230(false), //set special scale for PAL games correct_viewport(0), //correct viewport values zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode @@ -166,7 +166,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false); game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", false); game_setting(Set_texture_correction, "texture_correction", true); - game_setting(Set_pal230, "pal230", 0); + game_setting(Set_pal230, "pal230", false); game_setting(Set_stipple_mode, "stipple_mode", STIPPLE_Rotate); game_setting(Set_stipple_pattern, "stipple_pattern", 0x3E0F83E0); @@ -719,7 +719,7 @@ void CSettings::ReadGameSettings(const char * name) m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; m_texture_correction = GetSetting(Set_texture_correction) != 0; - g_settings->pal230 = GetSetting(Set_pal230) == 1 ? 1 : 0; + m_pal230 = GetSetting(Set_pal230) != 0; m_stipple_mode = (StippleMode_t)GetSetting(Set_stipple_mode); int stipple_pattern = GetSetting(Set_stipple_pattern); m_stipple_pattern = stipple_pattern > 0 ? (uint32_t)stipple_pattern : 0x3E0F83E0; diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index bda9b4cdf..c427c7d40 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -249,7 +249,7 @@ public: inline bool clip_zmax(void) const { return m_clip_zmax; } //enable far plane clipping inline bool adjust_aspect(void) const { return m_adjust_aspect; } //adjust screen aspect for wide screen mode inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64 - int pal230; //set special scale for PAL games + inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64 int correct_viewport; //correct viewport values int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) int old_style_adither; //apply alpha dither regardless of alpha_dither_mode @@ -368,6 +368,7 @@ private: bool m_clip_zmax; bool m_adjust_aspect; bool m_force_calc_sphere; + bool m_pal230; hacks_t m_hacks; }; From 391bf2ffa1fdcaadeb25ddfb6334760302ad2251 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:17:52 +1100 Subject: [PATCH 51/66] [Glide64] Make correct_viewport private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/ucode00.h | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index cba3a1106..f491b5ee8 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -76,7 +76,7 @@ CSettings::CSettings() : m_adjust_aspect(false), //adjust screen aspect for wide screen mode m_force_calc_sphere(false), //use spheric mapping only, Ridge Racer 64 m_pal230(false), //set special scale for PAL games -correct_viewport(0), //correct viewport values + m_correct_viewport(false), //correct viewport values zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does. @@ -162,7 +162,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_alt_tex_size, "alt_tex_size", false); game_setting(Set_use_sts1_only, "use_sts1_only", false); game_setting(Set_force_calc_sphere, "force_calc_sphere", false); - game_setting(Set_correct_viewport, "correct_viewport", 0); + game_setting(Set_correct_viewport, "correct_viewport", false); game_setting(Set_increase_texrect_edge, "increase_texrect_edge", false); game_setting(Set_decrease_fillrect_edge, "decrease_fillrect_edge", false); game_setting(Set_texture_correction, "texture_correction", true); @@ -715,7 +715,7 @@ void CSettings::ReadGameSettings(const char * name) m_alt_tex_size = GetSetting(Set_alt_tex_size) != 0; m_use_sts1_only = GetSetting(Set_use_sts1_only) != 0; m_force_calc_sphere = GetSetting(Set_force_calc_sphere) != 0; - g_settings->correct_viewport = GetSetting(Set_correct_viewport); + m_correct_viewport = GetSetting(Set_correct_viewport); m_increase_texrect_edge = GetSetting(Set_increase_texrect_edge) != 0; m_decrease_fillrect_edge = GetSetting(Set_decrease_fillrect_edge) != 0; m_texture_correction = GetSetting(Set_texture_correction) != 0; diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index c427c7d40..6bd74e897 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -250,7 +250,7 @@ public: inline bool adjust_aspect(void) const { return m_adjust_aspect; } //adjust screen aspect for wide screen mode inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64 inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64 - int correct_viewport; //correct viewport values + inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) int old_style_adither; //apply alpha dither regardless of alpha_dither_mode int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does. @@ -369,6 +369,7 @@ private: bool m_adjust_aspect; bool m_force_calc_sphere; bool m_pal230; + bool m_correct_viewport; hacks_t m_hacks; }; diff --git a/Source/Glide64/ucode00.h b/Source/Glide64/ucode00.h index 18ad2d47d..47d3d6e80 100644 --- a/Source/Glide64/ucode00.h +++ b/Source/Glide64/ucode00.h @@ -357,10 +357,10 @@ static void uc0_movemem() short trans_x = ((short*)gfx.RDRAM)[(a + 4) ^ 1] / 4; short trans_y = ((short*)gfx.RDRAM)[(a + 5) ^ 1] / 4; short trans_z = ((short*)gfx.RDRAM)[(a + 6) ^ 1]; - if (g_settings->correct_viewport) + if (g_settings->correct_viewport()) { - scale_x = abs(scale_x); - scale_y = abs(scale_y); + scale_x = (short)abs(scale_x); + scale_y = (short)abs(scale_y); } rdp.view_scale[0] = scale_x * rdp.scale_x; rdp.view_scale[1] = -scale_y * rdp.scale_y; From d6fc37fdda3fd9bcb17e7b0ce6ca044bfae115a4 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:21:20 +1100 Subject: [PATCH 52/66] [Glide64] Make zmode_compare_less private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index f491b5ee8..e966c1ad9 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -77,7 +77,7 @@ CSettings::CSettings() : m_force_calc_sphere(false), //use spheric mapping only, Ridge Racer 64 m_pal230(false), //set special scale for PAL games m_correct_viewport(false), //correct viewport values -zmode_compare_less(0), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) + m_zmode_compare_less(false), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does. @@ -176,7 +176,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_clip_zmax, "clip_zmax", true); game_setting(Set_fast_crc, "fast_crc", true); game_setting(Set_adjust_aspect, "adjust_aspect", true); - game_setting(Set_zmode_compare_less, "zmode_compare_less", 0); + game_setting(Set_zmode_compare_less, "zmode_compare_less", false); game_setting(Set_old_style_adither, "old_style_adither", 0); game_setting(Set_n64_z_scale, "n64_z_scale", 0); game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default); @@ -729,7 +729,7 @@ void CSettings::ReadGameSettings(const char * name) m_clip_zmax = GetSetting(Set_clip_zmax) != 0; m_fast_crc = GetSetting(Set_fast_crc) != 0; m_adjust_aspect = GetSetting(Set_adjust_aspect); - g_settings->zmode_compare_less = GetSetting(Set_zmode_compare_less); + m_zmode_compare_less = GetSetting(Set_zmode_compare_less); g_settings->old_style_adither = GetSetting(Set_old_style_adither); g_settings->n64_z_scale = GetSetting(Set_n64_z_scale); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 6bd74e897..84242a51a 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -251,7 +251,7 @@ public: inline bool force_calc_sphere(void) const { return m_force_calc_sphere; } //use spheric mapping only, Ridge Racer 64 inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64 inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values - int zmode_compare_less; //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) + inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) int old_style_adither; //apply alpha dither regardless of alpha_dither_mode int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does. @@ -370,6 +370,7 @@ private: bool m_force_calc_sphere; bool m_pal230; bool m_correct_viewport; + bool m_zmode_compare_less; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 7e14b64c5..f57fa44e3 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1792,11 +1792,11 @@ void update() switch ((rdp.rm & 0xC00) >> 10) { case 0: grDepthBiasLevel(0); - grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL); + grDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL); break; case 1: grDepthBiasLevel(-4); - grDepthBufferFunction(g_settings->zmode_compare_less ? GR_CMP_LESS : GR_CMP_LEQUAL); + grDepthBufferFunction(g_settings->zmode_compare_less() ? GR_CMP_LESS : GR_CMP_LEQUAL); break; case 2: grDepthBiasLevel(g_settings->ucode() == CSettings::ucode_PerfectDark ? -4 : 0); From 799fa6700d3ff804f6558531e02b02c850f2a6f5 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:23:56 +1100 Subject: [PATCH 53/66] [Glide64] Make old_style_adither private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index e966c1ad9..94d458a3e 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -78,7 +78,7 @@ CSettings::CSettings() : m_pal230(false), //set special scale for PAL games m_correct_viewport(false), //correct viewport values m_zmode_compare_less(false), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) -old_style_adither(0), //apply alpha dither regardless of alpha_dither_mode + m_old_style_adither(false), //apply alpha dither regardless of alpha_dither_mode n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does. m_hacks((hacks_t)0), @@ -177,7 +177,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_fast_crc, "fast_crc", true); game_setting(Set_adjust_aspect, "adjust_aspect", true); game_setting(Set_zmode_compare_less, "zmode_compare_less", false); - game_setting(Set_old_style_adither, "old_style_adither", 0); + game_setting(Set_old_style_adither, "old_style_adither", false); game_setting(Set_n64_z_scale, "n64_z_scale", 0); game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default); game_setting(Set_ignore_aux_copy, "ignore_aux_copy", false); @@ -730,7 +730,7 @@ void CSettings::ReadGameSettings(const char * name) m_fast_crc = GetSetting(Set_fast_crc) != 0; m_adjust_aspect = GetSetting(Set_adjust_aspect); m_zmode_compare_less = GetSetting(Set_zmode_compare_less); - g_settings->old_style_adither = GetSetting(Set_old_style_adither); + m_old_style_adither = GetSetting(Set_old_style_adither); g_settings->n64_z_scale = GetSetting(Set_n64_z_scale); m_ScreenRes = GetSetting(Set_Resolution); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 84242a51a..5ae83a1be 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -252,7 +252,7 @@ public: inline bool pal230(void) const { return m_pal230; } //use spheric mapping only, Ridge Racer 64 inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) - int old_style_adither; //apply alpha dither regardless of alpha_dither_mode + inline bool old_style_adither(void) const { return m_old_style_adither; } //apply alpha dither regardless of alpha_dither_mode int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does. inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks @@ -371,6 +371,7 @@ private: bool m_pal230; bool m_correct_viewport; bool m_zmode_compare_less; + bool m_old_style_adither; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index f57fa44e3..43d05c41a 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1876,12 +1876,15 @@ void update() } if (rdp.acmp == 3 && rdp.cycle_mode < 2) { - if (g_settings->old_style_adither || rdp.alpha_dither_mode != 3) { + 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 { From 30fc06152f8a37dbbcc9df24e4d40fb1a69f6455 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:26:20 +1100 Subject: [PATCH 54/66] [Glide64] Make n64_z_scale private --- Source/Glide64/Settings.cpp | 6 +++--- Source/Glide64/Settings.h | 3 ++- Source/Glide64/Util.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 94d458a3e..7846581f7 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -79,7 +79,7 @@ CSettings::CSettings() : m_correct_viewport(false), //correct viewport values m_zmode_compare_less(false), //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) m_old_style_adither(false), //apply alpha dither regardless of alpha_dither_mode -n64_z_scale(0), //scale vertex z value before writing to depth buffer, as N64 does. + m_n64_z_scale(false), //scale vertex z value before writing to depth buffer, as N64 does. m_hacks((hacks_t)0), @@ -178,7 +178,7 @@ void CSettings::RegisterSettings(void) game_setting(Set_adjust_aspect, "adjust_aspect", true); game_setting(Set_zmode_compare_less, "zmode_compare_less", false); game_setting(Set_old_style_adither, "old_style_adither", false); - game_setting(Set_n64_z_scale, "n64_z_scale", 0); + game_setting(Set_n64_z_scale, "n64_z_scale", false); game_setting_default(Set_optimize_texrect, "optimize_texrect", Set_optimize_texrect_default); game_setting(Set_ignore_aux_copy, "ignore_aux_copy", false); game_setting(Set_hires_buf_clear, "hires_buf_clear", true); @@ -731,7 +731,7 @@ void CSettings::ReadGameSettings(const char * name) m_adjust_aspect = GetSetting(Set_adjust_aspect); m_zmode_compare_less = GetSetting(Set_zmode_compare_less); m_old_style_adither = GetSetting(Set_old_style_adither); - g_settings->n64_z_scale = GetSetting(Set_n64_z_scale); + m_n64_z_scale = GetSetting(Set_n64_z_scale) != 0; m_ScreenRes = GetSetting(Set_Resolution); if (m_ScreenRes >= GetScreenResolutionCount()) { m_ScreenRes = GetDefaultScreenRes(); } diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 5ae83a1be..6f0d41a41 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -253,7 +253,7 @@ public: inline bool correct_viewport(void) const { return m_correct_viewport; } //correct viewport values inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating) inline bool old_style_adither(void) const { return m_old_style_adither; } //apply alpha dither regardless of alpha_dither_mode - int n64_z_scale; //scale vertex z value before writing to depth buffer, as N64 does. + inline bool n64_z_scale(void) const { return m_n64_z_scale; } //scale vertex z value before writing to depth buffer, as N64 does. inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks @@ -372,6 +372,7 @@ private: bool m_correct_viewport; bool m_zmode_compare_less; bool m_old_style_adither; + bool m_n64_z_scale; hacks_t m_hacks; }; diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 43d05c41a..de4a0f979 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -1025,7 +1025,7 @@ static void CalculateLOD(VERTEX *v, int n) float ScaleZ(float z) { - if (g_settings->n64_z_scale) + if (g_settings->n64_z_scale()) { int iz = (int)(z*8.0f + 0.5f); if (iz < 0) iz = 0; From 7a43073eef03d4cb521de737562754ac219358b9 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:33:08 +1100 Subject: [PATCH 55/66] [Glide64]rename wrpResolution to m_FullScreenRes --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 2 +- Source/Glide64/ScreenResolution.cpp | 4 ++-- Source/Glide64/Settings.cpp | 23 +++++++++++++++++------ Source/Glide64/Settings.h | 9 +++++++-- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 49c4efbd0..59f10ccc8 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -306,7 +306,7 @@ public: { m_cmbFSResolution.AddString(aRes[r]); } - m_cmbFSResolution.SetCurSel(g_settings->wrpResolution < size ? g_settings->wrpResolution : 0); + m_cmbFSResolution.SetCurSel(g_settings->FullScreenRes() < size ? g_settings->FullScreenRes() : 0); } TTSetTxt(IDC_CMB_FS_RESOLUTION, "Full screen resolution:\n\nThis sets the full screen resolution.\nAll the resolutions that your video card / monitor support should be displayed.\n\n[Recommended:native(max) resolution of your monitor - unless performance becomes an issue]"); @@ -337,7 +337,7 @@ public: g_settings->SetScreenRes(m_WindowRes.GetCurSel()); g_settings->SetVsync(m_cbxVSync.GetCheck() == BST_CHECKED); g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED); - g_settings->wrpResolution = m_cmbFSResolution.GetCurSel(); + g_settings->SetFullScreenRes(m_cmbFSResolution.GetCurSel()); g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; g_settings->wrpVRAM = m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM); g_settings->wrpFBO = m_cbxFBO.GetCheck() == BST_CHECKED; diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 16618bd54..0d1d54e06 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -393,7 +393,7 @@ void SetWindowDisplaySize(HWND hWnd) g_windowedStyle = GetWindowLong(hWnd, GWL_STYLE); // primary monitor only - if (!EnterFullScreen(g_settings->wrpResolution)) + if (!EnterFullScreen(g_settings->FullScreenRes())) { WriteTrace(TraceGlitch, TraceWarning, "can't change to fullscreen mode"); } diff --git a/Source/Glide64/ScreenResolution.cpp b/Source/Glide64/ScreenResolution.cpp index 7326ce3f0..962819ec5 100644 --- a/Source/Glide64/ScreenResolution.cpp +++ b/Source/Glide64/ScreenResolution.cpp @@ -331,7 +331,7 @@ char ** grQueryResolutionsExt(int32_t * Size) uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height) { WriteTrace(TraceGlitch, TraceDebug, "-"); - g_FullScreenResolutions.getResolution(g_settings->wrpResolution, width, height); - return g_settings->wrpResolution; + g_FullScreenResolutions.getResolution(g_settings->FullScreenRes(), width, height); + return g_settings->FullScreenRes(); } #endif \ No newline at end of file diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 7846581f7..6bcf1e302 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -85,7 +85,7 @@ CSettings::CSettings() : //wrapper settings #ifndef ANDROID -wrpResolution(0), + m_FullScreenRes(0), #endif wrpVRAM(0), wrpFBO(0), @@ -232,8 +232,8 @@ void CSettings::UpdateScreenSize(bool fullscreen) #ifndef ANDROID if (fullscreen) { - g_width = GetFullScreenResWidth(wrpResolution); - g_height = GetFullScreenResHeight(wrpResolution); + g_width = GetFullScreenResWidth(m_FullScreenRes); + g_height = GetFullScreenResHeight(m_FullScreenRes); } else { @@ -490,6 +490,17 @@ void CSettings::SetUcode(ucode_t value) m_ucode = value; } +#ifndef ANDROID +void CSettings::SetFullScreenRes(uint32_t value) +{ + if (value != m_FullScreenRes) + { + m_FullScreenRes = value; + m_dirty = true; + } +} +#endif + void CSettings::UpdateAspectRatio(void) { switch (m_aspectmode) @@ -531,7 +542,7 @@ void CSettings::ReadSettings() { SetScreenRes(GetSetting(Set_Resolution)); #ifndef ANDROID - this->wrpResolution = GetSetting(Set_FullScreenRes); + SetFullScreenRes(GetSetting(Set_FullScreenRes)); #endif m_vsync = GetSetting(Set_vsync) != 0; m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate); @@ -801,8 +812,8 @@ void CSettings::ReadGameSettings(const char * name) void CSettings::WriteSettings(void) { SetSetting(Set_Resolution, g_settings->m_ScreenRes); -#ifdef _WIN32 - SetSetting(Set_FullScreenRes, g_settings->wrpResolution); +#ifndef ANDROID + SetSetting(Set_FullScreenRes, m_FullScreenRes); #endif SetSetting(Set_vsync, m_vsync ? 1 : 0); SetSetting(Set_Rotate, m_rotate); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 6f0d41a41..179400bcf 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -259,7 +259,7 @@ public: //wrapper settings #ifndef ANDROID - int wrpResolution; + inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; } #endif int wrpVRAM; int wrpFBO; @@ -294,7 +294,9 @@ public: void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove); ucode_t DetectUCode(uint32_t uc_crc); void SetUcode(ucode_t value); - +#ifndef ANDROID + void SetFullScreenRes(uint32_t value); +#endif void ReadSettings(); void ReadGameSettings(const char * name); void WriteSettings(void); @@ -313,6 +315,9 @@ private: short m_Set_texture_dir; bool m_dirty; +#ifndef ANDROID + uint32_t m_FullScreenRes; +#endif bool m_FlushLogs; char m_log_dir[260]; uint32_t m_ScreenRes; From db3701bde0d697c05f2a745d8c9033d0331f7bc3 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:39:28 +1100 Subject: [PATCH 56/66] [Glide64] Make wrpVRAM private --- Source/Glide64/Config.cpp | 6 +++--- Source/Glide64/Main.cpp | 4 ++-- Source/Glide64/Settings.cpp | 15 ++++++++++++--- Source/Glide64/Settings.h | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 59f10ccc8..e15f6627a 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -323,7 +323,7 @@ public: m_VramSize.Attach(GetDlgItem(IDC_SPIN_VRAM_SIZE)); m_VramSize.SetBuddy(GetDlgItem(IDC_TXT_VRAM_SIZE)); m_spinVRAM.Attach(GetDlgItem(IDC_TXT_VRAM_SIZE)); - m_cbxVRAM.SetCheck(g_settings->wrpVRAM == 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxVRAM.SetCheck(g_settings->wrpVRAM() == 0 ? BST_CHECKED : BST_UNCHECKED); m_lblMb.Attach(GetDlgItem(IDC_LBL_MB)); AutoDetectChanged(); return TRUE; @@ -339,7 +339,7 @@ public: g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED); g_settings->SetFullScreenRes(m_cmbFSResolution.GetCurSel()); g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; - g_settings->wrpVRAM = m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM); + g_settings->SetWrpVRAM(m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM)); g_settings->wrpFBO = m_cbxFBO.GetCheck() == BST_CHECKED; if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed @@ -361,7 +361,7 @@ private: void AutoDetectChanged(void) { - m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM ? g_settings->wrpVRAM : 32).c_str()); + m_spinVRAM.SetWindowText(m_cbxVRAM.GetCheck() == BST_CHECKED ? " auto" : stdstr_f("%d",g_settings->wrpVRAM() != 0 ? g_settings->wrpVRAM() : 32).c_str()); m_spinVRAM.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED); m_VramSize.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED); m_lblMb.EnableWindow(m_cbxVRAM.GetCheck() != BST_CHECKED); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 0d1d54e06..df66c47ca 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -205,7 +205,7 @@ void ChangeSize() void ConfigWrapper() { - grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic); + grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic); } void UseUnregisteredSetting(int /*SettingID*/) @@ -1008,7 +1008,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) CountCombine(); ZLUT_init(); - grConfigWrapperExt(g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic); + grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic); grGlideInit(); const char *extensions = grGetString(GR_EXTENSION); grGlideShutdown(); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 6bcf1e302..027aa639f 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -87,7 +87,7 @@ CSettings::CSettings() : #ifndef ANDROID m_FullScreenRes(0), #endif -wrpVRAM(0), + m_wrpVRAM(0), wrpFBO(0), wrpAnisotropic(0), m_FlushLogs(false) @@ -315,6 +315,15 @@ void CSettings::SetBuffClear(bool value) } } +void CSettings::SetWrpVRAM(int value) +{ + if (value != m_wrpVRAM) + { + m_wrpVRAM = value; + m_dirty = true; + } +} + void CSettings::SetGhqFltr(TextureFilter_t value) { if (value != m_ghq_fltr) @@ -549,7 +558,7 @@ void CSettings::ReadSettings() m_advanced_options = Set_basic_mode ? GetSystemSetting(Set_basic_mode) == 0 : false; m_texenh_options = GetSetting(Set_texenh_options) != 0; - this->wrpVRAM = GetSetting(Set_wrpVRAM); + m_wrpVRAM = GetSetting(Set_wrpVRAM); this->wrpFBO = GetSetting(Set_wrpFBO); this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic); @@ -819,7 +828,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_Rotate, m_rotate); SetSetting(Set_texenh_options, m_texenh_options); - SetSetting(Set_wrpVRAM, g_settings->wrpVRAM); + SetSetting(Set_wrpVRAM, m_wrpVRAM); SetSetting(Set_wrpFBO, g_settings->wrpFBO); SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); SetSetting(Set_autodetect_ucode, m_autodetect_ucode); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 179400bcf..aa7158ac0 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -261,7 +261,7 @@ public: #ifndef ANDROID inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; } #endif - int wrpVRAM; + inline int wrpVRAM(void) const { return m_wrpVRAM; } int wrpFBO; int wrpAnisotropic; inline bool FlushLogs(void) const { return m_FlushLogs; } @@ -275,6 +275,7 @@ public: void SetSwapMode(SwapMode_t value); void SetFog(bool value); void SetBuffClear(bool value); + void SetWrpVRAM(int value); void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void SetGhqCmpr(TextureCompression_t value); @@ -318,6 +319,7 @@ private: #ifndef ANDROID uint32_t m_FullScreenRes; #endif + int m_wrpVRAM; bool m_FlushLogs; char m_log_dir[260]; uint32_t m_ScreenRes; From 28a78a9c95cc2c81c486dcd826e9e351b6f1c253 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:42:49 +1100 Subject: [PATCH 57/66] [Glide64] Make wrpFBO private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 4 ++-- Source/Glide64/Settings.cpp | 19 ++++++++++++++----- Source/Glide64/Settings.h | 4 +++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index e15f6627a..429b4da7e 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -316,7 +316,7 @@ public: m_cbxFBO.Attach(GetDlgItem(IDC_CHK_USE_FRAME_BUFFER_OBJECT)); TTSetTxt(IDC_CHK_USE_FRAME_BUFFER_OBJECT, "Use frame buffer objects:\n\nChanges the way FB effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension.\nThe choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on.\nAlso, some FB effects works only with one of the methods, no matter, which card you have.\nOn the whole, with FBO off, compatibility/ accuracy is a bit better (which is the case for Resident Evil 2).\nHowever, with FBO on with some systems, it can actually be a bit faster in cases.\n\n[Recommended: video card and game dependant]"); - m_cbxFBO.SetCheck(g_settings->wrpFBO > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxFBO.SetCheck(g_settings->wrpFBO() > 0 ? BST_CHECKED : BST_UNCHECKED); m_cbxVRAM.Attach(GetDlgItem(IDC_CHK_AUTODETECT_VRAM)); TTSetTxt(IDC_CHK_AUTODETECT_VRAM, "Autodetect VRAM Size:\n\nSince OpenGL cannot do this reliably at the moment, the option to set this manually is available.\nIf checked, plugin will try to autodetect VRAM size.\nBut if this appears wrong, please uncheck and set it to correct value.\n\n[Recommended: on]"); @@ -340,7 +340,7 @@ public: g_settings->SetFullScreenRes(m_cmbFSResolution.GetCurSel()); g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; g_settings->SetWrpVRAM(m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM)); - g_settings->wrpFBO = m_cbxFBO.GetCheck() == BST_CHECKED; + g_settings->SetWrpFBO(m_cbxFBO.GetCheck() == BST_CHECKED); if (memcmp(&oldsettings, g_settings, sizeof(oldsettings))) //check that settings were changed { diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index df66c47ca..e3bce2cdd 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -205,7 +205,7 @@ void ChangeSize() void ConfigWrapper() { - grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic); + grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic); } void UseUnregisteredSetting(int /*SettingID*/) @@ -1008,7 +1008,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) CountCombine(); ZLUT_init(); - grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic); + grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic); grGlideInit(); const char *extensions = grGetString(GR_EXTENSION); grGlideShutdown(); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 027aa639f..3a9ca0638 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -88,7 +88,7 @@ CSettings::CSettings() : m_FullScreenRes(0), #endif m_wrpVRAM(0), -wrpFBO(0), + m_wrpFBO(false), wrpAnisotropic(0), m_FlushLogs(false) { @@ -114,9 +114,9 @@ void CSettings::RegisterSettings(void) general_setting(Set_texenh_options, "texenh_options", false); general_setting(Set_wrpVRAM, "wrpVRAM", 0); #ifndef ANDROID - general_setting(Set_wrpFBO, "wrpFBO", 0); + general_setting(Set_wrpFBO, "wrpFBO", false); #else - general_setting(Set_wrpFBO, "wrpFBO", 1); + general_setting(Set_wrpFBO, "wrpFBO", true); #endif general_setting(Set_Rotate, "rotate", Rotate_None); general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0); @@ -324,6 +324,15 @@ void CSettings::SetWrpVRAM(int value) } } +void CSettings::SetWrpFBO(bool value) +{ + if (value != m_wrpFBO) + { + m_wrpFBO = value; + m_dirty = true; + } +} + void CSettings::SetGhqFltr(TextureFilter_t value) { if (value != m_ghq_fltr) @@ -559,7 +568,7 @@ void CSettings::ReadSettings() m_texenh_options = GetSetting(Set_texenh_options) != 0; m_wrpVRAM = GetSetting(Set_wrpVRAM); - this->wrpFBO = GetSetting(Set_wrpFBO); + m_wrpFBO = GetSetting(Set_wrpFBO) != 0; this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic); m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; @@ -829,7 +838,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_texenh_options, m_texenh_options); SetSetting(Set_wrpVRAM, m_wrpVRAM); - SetSetting(Set_wrpFBO, g_settings->wrpFBO); + SetSetting(Set_wrpFBO, m_wrpFBO); SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); SetSetting(Set_autodetect_ucode, m_autodetect_ucode); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index aa7158ac0..72bbfbb78 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -262,7 +262,7 @@ public: inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; } #endif inline int wrpVRAM(void) const { return m_wrpVRAM; } - int wrpFBO; + inline bool wrpFBO(void) const { return m_wrpFBO; } int wrpAnisotropic; inline bool FlushLogs(void) const { return m_FlushLogs; } @@ -276,6 +276,7 @@ public: void SetFog(bool value); void SetBuffClear(bool value); void SetWrpVRAM(int value); + void SetWrpFBO(bool value); void SetGhqFltr(TextureFilter_t value); void SetGhqEnht(TextureEnhancement_t value); void SetGhqCmpr(TextureCompression_t value); @@ -320,6 +321,7 @@ private: uint32_t m_FullScreenRes; #endif int m_wrpVRAM; + bool m_wrpFBO; bool m_FlushLogs; char m_log_dir[260]; uint32_t m_ScreenRes; From 564d840a6254ee78827a69544c8cc984f8733b59 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:46:14 +1100 Subject: [PATCH 58/66] [Glide64] Make wrpAnisotropic private --- Source/Glide64/Config.cpp | 4 ++-- Source/Glide64/Main.cpp | 4 ++-- Source/Glide64/Settings.cpp | 17 +++++++++++++---- Source/Glide64/Settings.h | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 429b4da7e..787b6c147 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -311,7 +311,7 @@ public: TTSetTxt(IDC_CMB_FS_RESOLUTION, "Full screen resolution:\n\nThis sets the full screen resolution.\nAll the resolutions that your video card / monitor support should be displayed.\n\n[Recommended:native(max) resolution of your monitor - unless performance becomes an issue]"); m_cbxAnisotropic.Attach(GetDlgItem(IDC_CBXANISOTROPIC)); - m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic > 0 ? BST_CHECKED : BST_UNCHECKED); + m_cbxAnisotropic.SetCheck(g_settings->wrpAnisotropic() ? BST_CHECKED : BST_UNCHECKED); TTSetTxt(IDC_CBXANISOTROPIC, "Anisotropic filtering:\n\nThis filter sharpens and brings out the details of textures that recede into the distance.\nWhen activated, it will use the max anisotropy your video card supports.\nHowever, this will override native way of texture filtering and may cause visual artifacts in some games.\n\n[Recommended: your preference, game dependant]"); m_cbxFBO.Attach(GetDlgItem(IDC_CHK_USE_FRAME_BUFFER_OBJECT)); @@ -338,7 +338,7 @@ public: g_settings->SetVsync(m_cbxVSync.GetCheck() == BST_CHECKED); g_settings->SetTexenhOptions(m_cbxTextureSettings.GetCheck() == BST_CHECKED); g_settings->SetFullScreenRes(m_cmbFSResolution.GetCurSel()); - g_settings->wrpAnisotropic = m_cbxAnisotropic.GetCheck() == BST_CHECKED; + g_settings->SetWrpAnisotropic(m_cbxAnisotropic.GetCheck() == BST_CHECKED); g_settings->SetWrpVRAM(m_cbxVRAM.GetCheck() == BST_CHECKED ? 0 : atoi(spinVRAM)); g_settings->SetWrpFBO(m_cbxFBO.GetCheck() == BST_CHECKED); diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index e3bce2cdd..51f4101ef 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -205,7 +205,7 @@ void ChangeSize() void ConfigWrapper() { - grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic); + grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic()); } void UseUnregisteredSetting(int /*SettingID*/) @@ -1008,7 +1008,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) CountCombine(); ZLUT_init(); - grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic); + grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic()); grGlideInit(); const char *extensions = grGetString(GR_EXTENSION); grGlideShutdown(); diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 3a9ca0638..5e611cb1e 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -89,7 +89,7 @@ CSettings::CSettings() : #endif m_wrpVRAM(0), m_wrpFBO(false), -wrpAnisotropic(0), + m_wrpAnisotropic(false), m_FlushLogs(false) { memset(m_log_dir, 0, sizeof(m_log_dir)); @@ -119,7 +119,7 @@ void CSettings::RegisterSettings(void) general_setting(Set_wrpFBO, "wrpFBO", true); #endif general_setting(Set_Rotate, "rotate", Rotate_None); - general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0); + general_setting(Set_wrpAnisotropic, "wrpAnisotropic", false); general_setting(Set_autodetect_ucode, "autodetect_ucode", true); general_setting(Set_ucode, "ucode", ucode_F3DEX2); general_setting(Set_wireframe, "wireframe", false); @@ -315,6 +315,15 @@ void CSettings::SetBuffClear(bool value) } } +void CSettings::SetWrpAnisotropic(bool value) +{ + if (value != m_wrpAnisotropic) + { + m_wrpAnisotropic = value; + m_dirty = true; + } +} + void CSettings::SetWrpVRAM(int value) { if (value != m_wrpVRAM) @@ -569,7 +578,7 @@ void CSettings::ReadSettings() m_wrpVRAM = GetSetting(Set_wrpVRAM); m_wrpFBO = GetSetting(Set_wrpFBO) != 0; - this->wrpAnisotropic = GetSetting(Set_wrpAnisotropic); + m_wrpAnisotropic = GetSetting(Set_wrpAnisotropic) != 0; m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; m_unk_as_red = GetSetting(Set_unk_as_red) != 0; @@ -839,7 +848,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_wrpVRAM, m_wrpVRAM); SetSetting(Set_wrpFBO, m_wrpFBO); - SetSetting(Set_wrpAnisotropic, g_settings->wrpAnisotropic); + SetSetting(Set_wrpAnisotropic, m_wrpAnisotropic); SetSetting(Set_autodetect_ucode, m_autodetect_ucode); SetSetting(Set_wireframe, m_wireframe); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 72bbfbb78..323eb2fd5 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -263,7 +263,7 @@ public: #endif inline int wrpVRAM(void) const { return m_wrpVRAM; } inline bool wrpFBO(void) const { return m_wrpFBO; } - int wrpAnisotropic; + inline bool wrpAnisotropic(void) const { return m_wrpAnisotropic; } inline bool FlushLogs(void) const { return m_FlushLogs; } void SetTexenhOptions(bool value); @@ -275,6 +275,7 @@ public: void SetSwapMode(SwapMode_t value); void SetFog(bool value); void SetBuffClear(bool value); + void SetWrpAnisotropic(bool value); void SetWrpVRAM(int value); void SetWrpFBO(bool value); void SetGhqFltr(TextureFilter_t value); @@ -322,6 +323,7 @@ private: #endif int m_wrpVRAM; bool m_wrpFBO; + bool m_wrpAnisotropic; bool m_FlushLogs; char m_log_dir[260]; uint32_t m_ScreenRes; From be7c0b3870b8722078e2e9f05587e84422f59b37 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:50:43 +1100 Subject: [PATCH 59/66] [Glide64] Make pj64 settings private --- Source/Glide64/Settings.cpp | 18 ++++++++++-------- Source/Glide64/Settings.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 5e611cb1e..560026df4 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -11,11 +11,13 @@ int GetCurrentResIndex(void); extern uint32_t g_NativeWidth, g_NativeHeight; #endif -short Set_basic_mode = 0, Set_log_dir = 0, Set_log_flush = 0; extern int g_width, g_height; CSettings::CSettings() : + m_Set_basic_mode(0), m_Set_texture_dir(0), + m_Set_log_dir(0), + m_Set_log_flush(0), m_dirty(false), m_res_x(GetScreenResWidth(GetDefaultScreenRes())), m_scr_res_x(GetScreenResWidth(GetDefaultScreenRes())), @@ -100,10 +102,10 @@ m_FlushLogs(false) void CSettings::RegisterSettings(void) { SetModuleName("default"); - Set_basic_mode = FindSystemSettingId("Basic Mode"); + m_Set_basic_mode = FindSystemSettingId("Basic Mode"); m_Set_texture_dir = FindSystemSettingId("Dir:Texture"); - Set_log_flush = FindSystemSettingId("Log Auto Flush"); - Set_log_dir = FindSystemSettingId("Dir:Log"); + m_Set_log_flush = FindSystemSettingId("Log Auto Flush"); + m_Set_log_dir = FindSystemSettingId("Dir:Log"); SetModuleName("Glide64"); general_setting(Set_Resolution, "resolution", GetDefaultScreenRes()); @@ -573,7 +575,7 @@ void CSettings::ReadSettings() #endif m_vsync = GetSetting(Set_vsync) != 0; m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate); - m_advanced_options = Set_basic_mode ? GetSystemSetting(Set_basic_mode) == 0 : false; + m_advanced_options = m_Set_basic_mode ? GetSystemSetting(m_Set_basic_mode) == 0 : false; m_texenh_options = GetSetting(Set_texenh_options) != 0; m_wrpVRAM = GetSetting(Set_wrpVRAM); @@ -608,11 +610,11 @@ void CSettings::ReadSettings() m_ghq_hirs_let_texartists_fly = GetSetting(Set_ghq_hirs_let_texartists_fly) != 0; m_ghq_hirs_dump = GetSetting(Set_ghq_hirs_dump) != 0; - if (Set_log_dir != 0) + if (m_Set_log_dir != 0) { - GetSystemSettingSz(Set_log_dir, m_log_dir, sizeof(m_log_dir)); + GetSystemSettingSz(m_Set_log_dir, m_log_dir, sizeof(m_log_dir)); } - m_FlushLogs = Set_log_flush != 0 ? GetSystemSetting(Set_log_flush) != 0 : false; + m_FlushLogs = m_Set_log_flush != 0 ? GetSystemSetting(m_Set_log_flush) != 0 : false; m_dirty = false; } diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 323eb2fd5..98fba8ade 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -315,7 +315,10 @@ private: ((CSettings *)_this)->SettingsChanged(); } + short m_Set_basic_mode; short m_Set_texture_dir; + short m_Set_log_dir; + short m_Set_log_flush; bool m_dirty; #ifndef ANDROID From e1b254772bc80a222867cf8c268c12c85aa16164 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:53:41 +1100 Subject: [PATCH 60/66] [Glide64] Move general_setting to settings class --- Source/Glide64/Config.cpp | 15 --------------- Source/Glide64/Settings.cpp | 15 +++++++++++++++ Source/Glide64/Settings.h | 4 ++++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 787b6c147..175e04bcb 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -872,18 +872,3 @@ void CALL DllAbout(HWND /*hParent*/) dlg.DoModal(); #endif } - -void general_setting(short setting_ID, const char * name, unsigned int value) -{ - RegisterSetting(setting_ID, Data_DWORD_General, name, NULL, value, NULL); -} - -void game_setting(short setting_ID, const char * name, unsigned int value) -{ - RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL); -} - -void game_setting_default(short setting_ID, const char * name, short default_setting) -{ - RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting); -} diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 560026df4..a8cf9ea74 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -907,6 +907,21 @@ void CSettings::WriteSettings(void) FlushSettings(); } +void CSettings::general_setting(short setting_ID, const char * name, unsigned int value) +{ + RegisterSetting(setting_ID, Data_DWORD_General, name, NULL, value, NULL); +} + +void CSettings::game_setting(short setting_ID, const char * name, unsigned int value) +{ + RegisterSetting(setting_ID, Data_DWORD_Game, name, NULL, value, NULL); +} + +void CSettings::game_setting_default(short setting_ID, const char * name, short default_setting) +{ + RegisterSetting2(setting_ID, Data_DWORD_Game, name, NULL, default_setting); +} + void CSettings::SettingsChanged(void) { m_ScreenRes = GetSetting(Set_Resolution); diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 98fba8ade..857dbd293 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -306,6 +306,10 @@ public: void UpdateScreenSize(bool fullscreen); private: + static void general_setting(short setting_ID, const char * name, unsigned int value); + static void game_setting(short setting_ID, const char * name, unsigned int value); + static void game_setting_default(short setting_ID, const char * name, short default_setting); + void RegisterSettings(void); void UpdateAspectRatio(void); void SettingsChanged(void); From 0115f87e6238c7ed8098e3dce0d0a8ad95e75cfc Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 17:55:09 +1100 Subject: [PATCH 61/66] [Glide64] Some code cleanup --- Source/Glide64/Config.cpp | 6 +++--- Source/Glide64/Config.h | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index 175e04bcb..991fcdc2c 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -618,8 +618,8 @@ public: SetComboBoxIndex(m_cmbHrsFormat, g_settings->ghq_hirs()); m_cmbTextureCompression.Attach(GetDlgItem(IDC_CMB_TEX_COMPRESS_MEHTOD)); - m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), 0); - m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), 1); + m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("S3TC"), CSettings::TextureCompression_S3TC); + m_cmbTextureCompression.SetItemData(m_cmbTextureCompression.AddString("FXT1"), CSettings::TextureCompression_FXT1); SetComboBoxIndex(m_cmbTextureCompression, g_settings->ghq_cmpr()); tooltip = "Texture cache size:\n\nEnhanced and filtered textures can be cached to aid performance.\nThis setting will adjust how much PC memory will be dedicated for texture cache.\nThis helps boost performance if there are subsequent requests for the same texture (usually the case).\nNormally, 128MB should be more than enough but there is a sweet spot for each game.\nSuper Mario may not need more than 32megs, but Conker streams a lot of textures, so setting 256+ megs can boost performance.\nAdjust accordingly if you are encountering speed issues.\n'0' disables cache.\n\n[Recommended: PC and game dependant]"; @@ -792,7 +792,7 @@ void CALL DllConfig(HWND hParent) if (g_romopen) { - if (evoodoo)// && g_fullscreen && !ev_fullscreen) + if (evoodoo)// && fullscreen && !ev_fullscreen) { ReleaseGfx(); rdp_reset(); diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 7f5831e89..5a32f87a4 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -47,9 +47,3 @@ void ConfigInit(HINSTANCE hinst); void ConfigCleanup(void); #endif - - - -extern void general_setting(short setting_ID, const char * name, unsigned int value); -extern void game_setting(short setting_ID, const char * name, unsigned int value); -extern void game_setting_default(short setting_ID, const char * name, short default_setting); From 9557e255226006525f10df104028807911cfe746 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 19:31:38 +1100 Subject: [PATCH 62/66] [Glide64] Have Settings.h in Settings.cpp --- Source/Glide64/Gfx_1.3.h | 1 - Source/Glide64/Settings.cpp | 14 ++------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Source/Glide64/Gfx_1.3.h b/Source/Glide64/Gfx_1.3.h index f897a6182..b7f3a80a6 100644 --- a/Source/Glide64/Gfx_1.3.h +++ b/Source/Glide64/Gfx_1.3.h @@ -70,7 +70,6 @@ the plugin #include // offsetof #include #include -#include #include "GlideExtensions.h" #include "rdp.h" #include "Config.h" diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index a8cf9ea74..70241c577 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -1,16 +1,9 @@ #include +#include #include "Gfx_1.3.h" #include "ScreenResolution.h" #include "SettingsID.h" -#ifdef _WIN32 -int GetCurrentResIndex(void); -#endif - -#ifdef ANDROID -extern uint32_t g_NativeWidth, g_NativeHeight; -#endif - extern int g_width, g_height; CSettings::CSettings() : @@ -36,7 +29,7 @@ CSettings::CSettings() : m_aspectmode(Aspect_4x3), m_frame_buffer(0), m_fb_crc_mode(fbcrcFast), -//Texture filtering options + //Texture filtering options m_texture_dir(""), m_ghq_fltr(TextureFilter_None), m_ghq_enht(TextureEnht_None), @@ -109,9 +102,6 @@ void CSettings::RegisterSettings(void) SetModuleName("Glide64"); general_setting(Set_Resolution, "resolution", GetDefaultScreenRes()); -#ifdef _WIN32 - general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); -#endif general_setting(Set_vsync, "vsync", true); general_setting(Set_texenh_options, "texenh_options", false); general_setting(Set_wrpVRAM, "wrpVRAM", 0); From f579011d9bc4238af55f40dfe73e409bef48ea0b Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 19:54:36 +1100 Subject: [PATCH 63/66] [Glide64] More clean up of Settings.cpp --- Source/Glide64/Settings.cpp | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 70241c577..c1c62cf32 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -85,7 +85,7 @@ CSettings::CSettings() : m_wrpVRAM(0), m_wrpFBO(false), m_wrpAnisotropic(false), -m_FlushLogs(false) + m_FlushLogs(false) { memset(m_log_dir, 0, sizeof(m_log_dir)); RegisterSettings(); @@ -151,6 +151,10 @@ void CSettings::RegisterSettings(void) general_setting(Set_fb_get_info_default, "fb_get_info", false); general_setting(Set_fb_render_default, "fb_render", false); +#ifndef ANDROID + general_setting(Set_FullScreenRes, "FullScreenRes", GetCurrentResIndex()); +#endif + game_setting(Set_alt_tex_size, "alt_tex_size", false); game_setting(Set_use_sts1_only, "use_sts1_only", false); game_setting(Set_force_calc_sphere, "force_calc_sphere", false); @@ -816,7 +820,7 @@ void CSettings::ReadGameSettings(const char * name) else if (read_back_to_screen == 2) { fb_add_bits |= fb_read_back_to_screen2; } else if (read_back_to_screen == 0) { fb_remove_bits |= fb_read_back_to_screen | fb_read_back_to_screen2; } - g_settings->UpdateFrameBufferBits(fb_add_bits, fb_remove_bits); + UpdateFrameBufferBits(fb_add_bits, fb_remove_bits); m_fb_crc_mode = (FBCRCMODE_t)GetSetting(Set_fb_crc_mode); SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default)); @@ -825,12 +829,12 @@ void CSettings::ReadGameSettings(const char * name) SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default)); SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default)); SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default)); - m_flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled(); + m_flame_corona = hacks(hack_Zelda) && !fb_depth_render_enabled(); } void CSettings::WriteSettings(void) { - SetSetting(Set_Resolution, g_settings->m_ScreenRes); + SetSetting(Set_Resolution, m_ScreenRes); #ifndef ANDROID SetSetting(Set_FullScreenRes, m_FullScreenRes); #endif @@ -846,9 +850,7 @@ void CSettings::WriteSettings(void) SetSetting(Set_wireframe, m_wireframe); SetSetting(Set_wfmode, m_wfmode); SetSetting(Set_unk_as_red, m_unk_as_red); -#ifndef _ENDUSER_RELEASE_ - SetSetting(Set_ucode, (int)g_settings->ucode); -#endif //_ENDUSER_RELEASE_ + SetSetting(Set_ucode, (int)m_ucode); SetSetting(Set_ghq_fltr, m_ghq_fltr); SetSetting(Set_ghq_cmpr, m_ghq_cmpr); @@ -868,24 +870,24 @@ void CSettings::WriteSettings(void) SetSetting(Set_ghq_hirs_let_texartists_fly, m_ghq_hirs_let_texartists_fly); SetSetting(Set_ghq_hirs_dump, m_ghq_hirs_dump); - SetSetting(g_romopen ? Set_filtering : Set_filtering_default, filtering()); + SetSetting(g_romopen ? Set_filtering : Set_filtering_default, m_filtering); SetSetting(g_romopen ? Set_fog : Set_fog_default, m_fog); SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, m_buff_clear); - SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode()); - SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, lodmode()); + SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, m_swapmode); + SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, m_lodmode); SetSetting(g_romopen ? Set_aspect : Set_aspect_default, m_aspectmode); - SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->fb_ref_enabled() ? true : false); - SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, g_settings->fb_emulation_enabled() ? true : false); - SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, g_settings->fb_hwfbe_set() ? true : false); - SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, g_settings->fb_get_info_enabled() ? true : false); - SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, g_settings->fb_depth_render_enabled() ? true : false); - SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, g_settings->fb_cpu_write_hack_enabled() ? true : false); - if (g_settings->fb_read_back_to_screen_enabled()) + SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, fb_ref_enabled() ? true : false); + SetSetting(g_romopen ? Set_fb_smart : Set_fb_smart_default, fb_emulation_enabled() ? true : false); + SetSetting(g_romopen ? Set_fb_hires : Set_fb_hires_default, fb_hwfbe_set() ? true : false); + SetSetting(g_romopen ? Set_fb_get_info : Set_fb_get_info_default, fb_get_info_enabled() ? true : false); + SetSetting(g_romopen ? Set_fb_render : Set_fb_render_default, fb_depth_render_enabled() ? true : false); + SetSetting(g_romopen ? Set_detect_cpu_write : Set_detect_cpu_write_default, fb_cpu_write_hack_enabled() ? true : false); + if (fb_read_back_to_screen_enabled()) { SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 1); } - else if (g_settings->fb_read_back_to_screen2_enabled()) + else if (fb_read_back_to_screen2_enabled()) { SetSetting(g_romopen ? Set_read_back_to_screen : Set_read_back_to_screen_default, 2); } From e2fcb24529db4b85a3a18435876c5de66a92182b Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 20:14:03 +1100 Subject: [PATCH 64/66] [Glide64] Remove some unneeded code --- Source/Glide64/Combine.cpp | 31 +++---------------------------- Source/Glide64/Gfx_1.3.h | 18 ------------------ Source/Glide64/Settings.cpp | 12 ++++-------- Source/Glide64/SettingsID.h | 3 +-- Source/Glide64/rdp.h | 1 - Source/GlideHQ/TxHiResCache.cpp | 4 ---- 6 files changed, 8 insertions(+), 61 deletions(-) diff --git a/Source/Glide64/Combine.cpp b/Source/Glide64/Combine.cpp index 7f8134672..4746edc2f 100644 --- a/Source/Glide64/Combine.cpp +++ b/Source/Glide64/Combine.cpp @@ -619,25 +619,7 @@ COMBINE cmb; cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \ percent = (float)(rdp.env_color&0xFF) / 255.0f, \ cmb.dc0_detailmax = cmb.dc1_detailmax = percent - -// Bright red, sets up a bright red combine -#ifdef BRIGHT_RED -// Bright red, sets up a bright red combine during the alpha stage -#define BrightRed() { \ - CCMB (GR_COMBINE_FUNCTION_LOCAL, \ - GR_COMBINE_FACTOR_NONE, \ - GR_COMBINE_LOCAL_CONSTANT, \ - GR_COMBINE_OTHER_NONE); \ - ACMB (GR_COMBINE_FUNCTION_LOCAL, \ - GR_COMBINE_FACTOR_NONE, \ - GR_COMBINE_LOCAL_CONSTANT, \ - GR_COMBINE_OTHER_NONE); \ - cmb.ccolor = 0xFF0000FF; \ -} -#else -#define BrightRed() -#endif - + #define CC(color) cmb.ccolor=(color)&0xFFFFFF00 #define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); } #define CC_C1MULC2(color1, color2) { \ @@ -15659,15 +15641,8 @@ void Combine() Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7], Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]); } - if (g_settings->unk_as_red()) - { - BrightRed(); - } - else - { - // use full alpha as default - ac_t0(); - } + // use full alpha as default + ac_t0(); } else { diff --git a/Source/Glide64/Gfx_1.3.h b/Source/Glide64/Gfx_1.3.h index b7f3a80a6..7688020a2 100644 --- a/Source/Glide64/Gfx_1.3.h +++ b/Source/Glide64/Gfx_1.3.h @@ -102,17 +102,9 @@ extern "C" { // ******************************** -#define LOGNOTKEY // Log if not pressing: -#define LOGKEY 0x11 // this key (CONTROL) - -#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........) - //#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report // "The gfx plugin has caused an exception" instead. -#define FLUSH // flush the file buffer. slower logging, but makes sure - // the command is logged before continuing (in case of - // crash or exception, the log will not be cut short) #ifndef _ENDUSER_RELEASE_ #endif @@ -128,22 +120,12 @@ extern "C" { //#define SIMULATE_BANSHEE //******** -#ifndef _ENDUSER_RELEASE_ -#define BRIGHT_RED // Keep enabled, option in dialog -#endif - -#define COLORED_DEBUGGER // ;) pretty colors - - // rdram mask at 0x400000 bytes (bah, not right for majora's mask) - //#define BMASK 0x7FFFFF extern unsigned int BMASK; #define WMASK 0x3FFFFF #define DMASK 0x1FFFFF extern uint32_t update_screen_count; - int CheckKeyPressed(int key, int mask); - //#define PERFORMANCE #ifdef PERFORMANCE extern int64 perf_cur; diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index c1c62cf32..10e9c0dd3 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -116,7 +116,6 @@ void CSettings::RegisterSettings(void) general_setting(Set_ucode, "ucode", ucode_F3DEX2); general_setting(Set_wireframe, "wireframe", false); general_setting(Set_wfmode, "wfmode", wfmode_VertexColors); - general_setting(Set_unk_as_red, "unk_as_red", false); general_setting(Set_ghq_fltr, "ghq_fltr", TextureFilter_None); general_setting(Set_ghq_cmpr, "ghq_cmpr", TextureCompression_S3TC); general_setting(Set_ghq_enht, "ghq_enht", TextureEnht_None); @@ -233,17 +232,14 @@ void CSettings::UpdateScreenSize(bool fullscreen) } else { +#endif g_width = GetScreenResWidth(m_ScreenRes); g_height = GetScreenResHeight(m_ScreenRes); +#ifndef ANDROID } - m_scr_res_x = m_res_x = g_width; - m_scr_res_y = m_res_y = g_height; -#else - g_width = GetScreenResWidth(m_ScreenRes); - g_height = GetScreenResHeight(m_ScreenRes); - m_scr_res_x = m_res_x = g_width; - m_scr_res_y = m_res_y = g_height; #endif + m_scr_res_x = m_res_x = g_width; + m_scr_res_y = m_res_y = g_height; UpdateAspectRatio(); } diff --git a/Source/Glide64/SettingsID.h b/Source/Glide64/SettingsID.h index 926bb7abe..bf601eafa 100644 --- a/Source/Glide64/SettingsID.h +++ b/Source/Glide64/SettingsID.h @@ -15,8 +15,7 @@ enum // General Settings Set_vsync, Set_Rotate, Set_texenh_options, Set_wrpVRAM, Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, - Set_wfmode, Set_unk_as_red, Set_ghq_fltr, - Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, + Set_wfmode, Set_ghq_fltr, Set_ghq_cmpr, Set_ghq_enht, Set_ghq_hirs, Set_ghq_enht_cmpr, Set_ghq_enht_f16bpp, Set_ghq_enht_gz, Set_ghq_enht_nobg, Set_ghq_hirs_cmpr, Set_ghq_hirs_tile, Set_ghq_hirs_f16bpp, Set_ghq_hirs_gz, Set_ghq_hirs_altcrc, Set_ghq_cache_save, Set_ghq_cache_size, Set_ghq_hirs_let_texartists_fly, diff --git a/Source/Glide64/rdp.h b/Source/Glide64/rdp.h index f7ee84a3b..e7f46f766 100644 --- a/Source/Glide64/rdp.h +++ b/Source/Glide64/rdp.h @@ -164,7 +164,6 @@ typedef struct { uint32_t lr_y; } SCISSOR; - typedef struct { uint16_t tile_ul_s; uint16_t tile_ul_t; diff --git a/Source/GlideHQ/TxHiResCache.cpp b/Source/GlideHQ/TxHiResCache.cpp index 30cbaf72d..4b390b18b 100644 --- a/Source/GlideHQ/TxHiResCache.cpp +++ b/Source/GlideHQ/TxHiResCache.cpp @@ -146,8 +146,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */ switch (_options & HIRESTEXTURES_MASK) { - case GHQ_HIRESTEXTURES: - break; case RICE_HIRESTEXTURES: INFO(80, "-----\n"); INFO(80, "using Rice hires texture format...\n"); @@ -163,8 +161,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */ dir_path.AppendDirectory(_ident.c_str()); loadHiResTextures(dir_path, replace); break; - case JABO_HIRESTEXTURES: - ; } return 1; From 80e8944d2f47afaf1fe8d3d397f8fce2d261018a Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 20:28:34 +1100 Subject: [PATCH 65/66] [Glide64] Change capture_screen to g_capture_screen --- Source/Glide64/Main.cpp | 29 +++++++++-------------------- Source/Glide64/Settings.cpp | 9 +++++++-- Source/Glide64/rdp.cpp | 4 ++-- Source/Glide64/ucode06.h | 5 +++-- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 51f4101ef..68d241dc2 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -41,7 +41,6 @@ #include #include "Gfx_1.3.h" #include "Version.h" -#include #include #include #include @@ -116,8 +115,8 @@ uint32_t offset_textures = 0; uint32_t offset_texbuf1 = 0; bool g_ghq_use = false; -int capture_screen = 0; -std::string capture_path; +bool g_capture_screen = false; +std::string g_capture_path; #ifdef _WIN32 HWND g_hwnd_win = NULL; @@ -841,8 +840,8 @@ output: none *******************************************************************/ EXPORT void CALL CaptureScreen(char * Directory) { - capture_screen = 1; - capture_path = Directory; + g_capture_screen = true; + g_capture_path = Directory; } /****************************************************************** @@ -1176,15 +1175,6 @@ void CALL RomOpen(void) if (evoodoo) InitGfx(); - - if (strstr(extensions, "ROMNAME")) - { - char strSetRomName[] = "grSetRomName"; - void (FX_CALL *grSetRomName)(char*); - grSetRomName = (void (FX_CALL *)(char*))grGetProcAddress(strSetRomName); - grSetRomName(name); - } - // ** } /****************************************************************** @@ -1205,9 +1195,8 @@ void CALL ShowCFB(void) void drawViRegBG() { WriteTrace(TraceGlide64, TraceDebug, "start"); - const uint32_t VIwidth = *gfx.VI_WIDTH_REG; FB_TO_SCREEN_INFO fb_info; - fb_info.width = VIwidth; + fb_info.width = *gfx.VI_WIDTH_REG; fb_info.height = (uint32_t)rdp.vi_height; if (fb_info.height == 0) { @@ -1216,7 +1205,7 @@ void drawViRegBG() } fb_info.ul_x = 0; - fb_info.lr_x = VIwidth - 1; + fb_info.lr_x = fb_info.width - 1; // fb_info.lr_x = (uint32_t)rdp.vi_width - 1; fb_info.ul_y = 0; fb_info.lr_y = fb_info.height - 1; @@ -1452,9 +1441,9 @@ void newSwapBuffers() grDepthMask(FXFALSE); grCullMode(GR_CULL_DISABLE); - if (capture_screen) + if (g_capture_screen) { - CPath path(capture_path); + CPath path(g_capture_path); if (!path.DirectoryExists()) { path.DirectoryCreate(); @@ -1525,7 +1514,7 @@ void newSwapBuffers() // Unlock the backbuffer grLfbUnlock(GR_LFB_READ_ONLY, GR_BUFFER_BACKBUFFER); write_png_file(path, image_width, image_height, ssimg); - capture_screen = 0; + g_capture_screen = false; } } diff --git a/Source/Glide64/Settings.cpp b/Source/Glide64/Settings.cpp index 10e9c0dd3..8e216bc4f 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -573,7 +573,6 @@ void CSettings::ReadSettings() m_wrpAnisotropic = GetSetting(Set_wrpAnisotropic) != 0; m_autodetect_ucode = GetSetting(Set_autodetect_ucode) != 0; - m_unk_as_red = GetSetting(Set_unk_as_red) != 0; m_wireframe = GetSetting(Set_wireframe) != 0; m_wfmode = (wfmode_t)GetSetting(Set_wfmode); m_ucode = ucode_F3DEX2; @@ -845,7 +844,6 @@ void CSettings::WriteSettings(void) SetSetting(Set_wireframe, m_wireframe); SetSetting(Set_wfmode, m_wfmode); - SetSetting(Set_unk_as_red, m_unk_as_red); SetSetting(Set_ucode, (int)m_ucode); SetSetting(Set_ghq_fltr, m_ghq_fltr); @@ -914,3 +912,10 @@ void CSettings::SettingsChanged(void) { m_ScreenRes = GetSetting(Set_Resolution); } + +void UseUnregisteredSetting(int /*SettingID*/) +{ +#ifdef _WIN32 + DebugBreak(); +#endif +} diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index fb241369d..b4457d2d3 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -737,10 +737,10 @@ EXPORT void CALL ProcessDList(void) { ReleaseGfx (); rdp_reset(); - if (g_settings->ghq_use) + if (g_ghq_use) { ext_ghq_shutdown(); - g_settings->ghq_use = 0; + g_ghq_use = false; } } if (MessageBox(gfx.hWnd, "The GFX plugin caused an exception and has been disabled.\nWould you like to turn it back on and attempt to continue?","Glide64 Exception", MB_YESNO|MB_ICONEXCLAMATION) == MB_NO) diff --git a/Source/Glide64/ucode06.h b/Source/Glide64/ucode06.h index 050b7e999..a421f9c57 100644 --- a/Source/Glide64/ucode06.h +++ b/Source/Glide64/ucode06.h @@ -231,7 +231,6 @@ void DrawHiresDepthImage(const DRAWIMAGE & d) GR_ASPECT_LOG2_1x1, GR_TEXFMT_RGB_565, GR_MIPMAPLEVELMASK_BOTH); grRenderBuffer(GR_BUFFER_TEXTUREBUFFER_EXT); grAuxBufferExt(GR_BUFFER_AUXBUFFER); - grSstOrigin(GR_ORIGIN_UPPER_LEFT); grBufferClear(0, 0, 0xFFFF); grDrawTriangle(&v[0], &v[2], &v[1]); grDrawTriangle(&v[2], &v[3], &v[1]); @@ -287,7 +286,9 @@ void DrawImage(DRAWIMAGE & d) { if (d.imageW == 0 || d.imageH == 0 || d.frameH == 0) return; - int x_size, y_size, x_shift, y_shift, line; + int x_shift, y_shift; + uint16_t x_size, y_size, line; + // choose optimum size for the format/size switch (d.imageSiz) { From c781296ba772f97924aa04ff5cd4f3f7230e3d82 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 13 Mar 2017 20:34:51 +1100 Subject: [PATCH 66/66] [Glide64] Rename viewport_offset to g_viewport_offset; --- Source/Glide64/Main.cpp | 19 ++++----- Source/Glitch64/OGLESgeometry.cpp | 12 +++--- Source/Glitch64/OGLESglitchmain.cpp | 64 ++++++++++++++--------------- Source/Glitch64/OGLgeometry.cpp | 12 +++--- Source/Glitch64/OGLglitchmain.cpp | 56 ++++++++++++------------- Source/Glitch64/glitchmain.h | 2 +- 6 files changed, 81 insertions(+), 84 deletions(-) diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 68d241dc2..18332c0d5 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -81,7 +81,7 @@ int exception = FALSE; int evoodoo = 0; int ev_fullscreen = 0; -extern int viewport_offset; +extern int g_viewport_offset; extern int g_width, g_height; @@ -207,12 +207,6 @@ void ConfigWrapper() grConfigWrapperExt(g_settings->wrpVRAM() * 1024 * 1024, g_settings->wrpFBO(), g_settings->wrpAnisotropic()); } -void UseUnregisteredSetting(int /*SettingID*/) -{ -#ifdef _WIN32 - DebugBreak(); -#endif -} extern int g_width, g_height; int GetTexAddrUMA(int /*tmu*/, int texsize) @@ -380,9 +374,12 @@ void DisplayLoadProgress(const wchar_t *format, ...) #ifdef _WIN32 void SetWindowDisplaySize(HWND hWnd) { - if ((HWND)hWnd == NULL) hWnd = GetActiveWindow(); + if (hWnd == NULL) + { + hWnd = GetActiveWindow(); + } g_hwnd_win = (HWND)hWnd; - + if (ev_fullscreen) { ZeroMemory(&g_windowedRect, sizeof(RECT)); @@ -407,7 +404,7 @@ void SetWindowDisplaySize(HWND hWnd) SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW | WS_EX_TOPMOST); SetWindowPos(hWnd, NULL, 0, 0, g_width, g_height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW); - viewport_offset = 0; + g_viewport_offset = 0; g_fullscreen = true; } else @@ -427,7 +424,7 @@ void SetWindowDisplaySize(HWND hWnd) { GetWindowRect(hStatusBar, &statusbarRect); } - viewport_offset = statusbarRect.bottom - statusbarRect.top; + g_viewport_offset = statusbarRect.bottom - statusbarRect.top; GetWindowRect(hWnd, &g_windowedRect); GetClientRect(hWnd, &clientRect); g_windowedRect.right += (g_width - (clientRect.right - clientRect.left)); diff --git a/Source/Glitch64/OGLESgeometry.cpp b/Source/Glitch64/OGLESgeometry.cpp index 6133ee593..ad6eb3220 100644 --- a/Source/Glitch64/OGLESgeometry.cpp +++ b/Source/Glitch64/OGLESgeometry.cpp @@ -350,7 +350,7 @@ void FindBestDepthBias() glVertex3f(float(x + 4 - widtho) / (width / 2), float(4 - heighto) / (height / 2), 0.5); glVertex3f(float(x - widtho) / (width / 2), float(4 - heighto) / (height / 2), 0.5); glEnd(); - glReadPixels(x + 2, 2 + viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); + glReadPixels(x + 2, 2 + g_viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); z -= 0.75f + 8e-6f; if (z < 0.0f) z = -z; if (z > 0.01f) continue; @@ -397,7 +397,7 @@ grDrawTriangle(const void *a, const void *b, const void *c) vbo_enable(); if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -436,7 +436,7 @@ grDrawPoint(const void *pt) if(nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -506,7 +506,7 @@ grDrawLine(const void *a, const void *b) if(nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -579,7 +579,7 @@ grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers2) if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -603,7 +603,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 strid if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } diff --git a/Source/Glitch64/OGLESglitchmain.cpp b/Source/Glitch64/OGLESglitchmain.cpp index d35e2b97f..15c1e7a3f 100644 --- a/Source/Glitch64/OGLESglitchmain.cpp +++ b/Source/Glitch64/OGLESglitchmain.cpp @@ -71,8 +71,8 @@ if (x+width >= screen_width) { width = screen_width - x; //printf("resizing w --> %d\n", width); } -if (y+height >= screen_height+viewport_offset) { -height = screen_height+viewport_offset - y; +if (y+height >= screen_height+g_viewport_offset) { +height = screen_height+g_viewport_offset - y; //printf("resizing h --> %d\n", height); } glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height); @@ -161,7 +161,7 @@ int default_texture; // the infamous "32*1024*1024" is now configurable int current_texture; int depth_texture, color_texture; int glsl_support = 1; -int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0; +int viewport_width, viewport_height, g_viewport_offset = 0, nvidia_viewport_hack = 0; int save_w, save_h; int lfb_color_fmt; float invtex[2]; @@ -280,11 +280,11 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) if (int(miny) < 0) miny = 0; if (maxx < minx) maxx = minx; if (maxy < miny) maxy = miny; - glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny); + glScissor(minx, miny + g_viewport_offset, maxx - minx, maxy - miny); //printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy); } else { - glScissor(minx, (viewport_offset)+g_height - maxy, maxx - minx, maxy - miny); + glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny); } glEnable(GL_SCISSOR_TEST); } @@ -395,13 +395,13 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrColorFormat_t color_format, GrOrigi WriteTrace(TraceGlitch, TraceDebug, "color_format: %d, origin_location: %d, nColBuffers: %d, nAuxBuffers: %d", color_format, origin_location, nColBuffers, nAuxBuffers); WriteTrace(TraceGlitch, TraceDebug, "g_width: %d, g_height: %d fullscreen: %d", g_width, g_height, fullscreen); - //viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20; - // ZIGGY viewport_offset is WIN32 specific, with SDL just set it to zero - viewport_offset = 0; //-10 //-20; + //g_viewport_offset = ((screen_resolution>>2) > 20) ? screen_resolution >> 2 : 20; + // ZIGGY g_viewport_offset is WIN32 specific, with SDL just set it to zero + g_viewport_offset = 0; //-10 //-20; printf("(II) Setting video mode %dx%d...\n", g_width, g_height); - glViewport(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, g_height); lfb_color_fmt = color_format; if (origin_location != GR_ORIGIN_UPPER_LEFT) WriteTrace(TraceGlitch, TraceWarning, "origin must be in upper left corner"); if (nColBuffers != 2) WriteTrace(TraceGlitch, TraceWarning, "number of color buffer is not 2"); @@ -529,12 +529,12 @@ FX_ENTRY GrContext_t FX_CALL grSstWinOpen( GrColorFormat_t color_format, GrOrigi #endif #ifdef _WIN32 - glViewport(0, viewport_offset, width, height); + glViewport(0, g_viewport_offset, width, height); viewport_width = width; viewport_height = height; nvidia_viewport_hack = 1; #else - glViewport(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, g_height); viewport_width = g_width; viewport_height = g_height; #endif // _WIN32 @@ -725,26 +725,26 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu, if (save_w) { if (tw > save_w && th > save_h) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h, - 0, viewport_offset + save_h, tw, th - save_h); + 0, g_viewport_offset + save_h, tw, th - save_h); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0, - save_w, viewport_offset, tw - save_w, save_h); + save_w, g_viewport_offset, tw - save_w, save_h); save_w = tw; save_h = th; } else if (tw > save_w) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0, - save_w, viewport_offset, tw - save_w, save_h); + save_w, g_viewport_offset, tw - save_w, save_h); save_w = tw; } else if (th > save_h) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h, - 0, viewport_offset + save_h, save_w, th - save_h); + 0, g_viewport_offset + save_h, save_w, th - save_h); save_h = th; } } else { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, - 0, viewport_offset, tw, th); + 0, g_viewport_offset, tw, th); save_w = tw; save_h = th; } @@ -793,12 +793,12 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu, //printf("viewport %dx%d\n", width, height); if (g_height > screen_height) { - glViewport(0, viewport_offset + screen_height - g_height, g_width, g_height); + glViewport(0, g_viewport_offset + screen_height - g_height, g_width, g_height); } else - glViewport(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, g_height); - glScissor(0, viewport_offset, g_width, g_height); + glScissor(0, g_viewport_offset, g_width, g_height); } else { if (!render_to_texture) //initialization @@ -1333,7 +1333,7 @@ void updateTexture() //glDeleteTextures( 1, &pBufferAddress ); glBindTexture(GL_TEXTURE_2D, pBufferAddress); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - 0, viewport_offset, g_width, g_height, 0); + 0, g_viewport_offset, g_width, g_height, 0); glBindTexture(GL_TEXTURE_2D, default_texture); //glPopAttrib(); @@ -1359,7 +1359,7 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int x, int y, int w, int h, //glReadBuffer(current_buffer); glBindTexture(GL_TEXTURE_2D, depth_texture); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, - 0, viewport_offset, tw, th, 0); + 0, g_viewport_offset, tw, th, 0); glBindTexture(GL_TEXTURE_2D, default_texture); return; } @@ -1422,8 +1422,8 @@ grRenderBuffer(GrBuffer_t buffer) } curBufferAddr = 0; - glViewport(0, viewport_offset, g_width, viewport_height); - glScissor(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, viewport_height); + glScissor(0, g_viewport_offset, g_width, g_height); #ifdef SAVE_CBUFFER if (!use_fbo && render_to_texture == 2) { @@ -1662,7 +1662,7 @@ GrLfbInfo_t *info) info->strideInBytes = g_width * 4; info->writeMode = GR_LFBWRITEMODE_888; info->origin = origin; - glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer); + glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, frameBuffer); } else { buf = (unsigned char*)malloc(g_width*g_height * 4); @@ -1671,7 +1671,7 @@ GrLfbInfo_t *info) info->strideInBytes = g_width * 2; info->writeMode = GR_LFBWRITEMODE_565; info->origin = origin; - glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); + glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); for (j = 0; j < g_height; j++) { @@ -1692,7 +1692,7 @@ GrLfbInfo_t *info) info->strideInBytes = g_width * 2; info->writeMode = GR_LFBWRITEMODE_ZA16; info->origin = origin; - glReadPixels(0, viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); + glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); } } @@ -1741,7 +1741,7 @@ FxU32 dst_stride, void *dst_data) { buf = (unsigned char*)malloc(src_width*src_height * 4); - glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); + glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); for (j = 0; j < src_height; j++) { @@ -1759,7 +1759,7 @@ FxU32 dst_stride, void *dst_data) { buf = (unsigned char*)malloc(src_width*src_height * 2); - glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); + glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); for (j = 0; j < src_height; j++) { @@ -1886,7 +1886,7 @@ FxI32 src_stride, void *src_data) } else { - float *buf = (float*)malloc(src_width*(src_height + (viewport_offset))*sizeof(float)); + float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset))*sizeof(float)); if (src_format != GR_LFBWRITEMODE_ZA16) WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format); @@ -1898,14 +1898,14 @@ FxI32 src_stride, void *src_data) { for (i = 0; i < src_width; i++) { - buf[(j + (viewport_offset))*src_width + i] = + buf[(j + (g_viewport_offset))*src_width + i] = (frameBuffer[(src_height - j - 1)*(src_stride / 2) + i] / (65536.0f*(2.0f / zscale))) + 1 - zscale / 2.0f; } } #ifdef VPDEBUG if (dumping) { - unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (viewport_offset))); + unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (g_viewport_offset))); for (i = 0; i < src_width*src_height; i++) buf2[i] = buf[i] * 255.0f; ilTexImage(src_width, src_height, 1, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, buf2); @@ -1924,7 +1924,7 @@ FxI32 src_stride, void *src_data) //glDrawBuffer(GL_BACK); glClear(GL_DEPTH_BUFFER_BIT); glDepthMask(1); - //glDrawPixels(src_width, src_height+(viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf); + //glDrawPixels(src_width, src_height+(g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf); free(buf); } diff --git a/Source/Glitch64/OGLgeometry.cpp b/Source/Glitch64/OGLgeometry.cpp index 75bfc35e3..dc7b8c8a8 100644 --- a/Source/Glitch64/OGLgeometry.cpp +++ b/Source/Glitch64/OGLgeometry.cpp @@ -276,7 +276,7 @@ void FindBestDepthBias() glVertex3fv(vertices[3]); glEnd(); - glReadPixels(x + 2, 2 + viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); + glReadPixels(x + 2, 2 + g_viewport_offset, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); z -= 0.75f + 8e-6f; if (z < 0.0f) z = -z; if (z > 0.01f) continue; @@ -354,7 +354,7 @@ grDrawTriangle(const void *a, const void *b, const void *c) if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -467,7 +467,7 @@ grDrawPoint(const void *pt) if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -536,7 +536,7 @@ grDrawLine(const void *a, const void *b) if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -612,7 +612,7 @@ grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers2) if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } @@ -684,7 +684,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 strid if (nvidia_viewport_hack && !render_to_texture) { - glViewport(0, viewport_offset, viewport_width, viewport_height); + glViewport(0, g_viewport_offset, viewport_width, viewport_height); nvidia_viewport_hack = 0; } diff --git a/Source/Glitch64/OGLglitchmain.cpp b/Source/Glitch64/OGLglitchmain.cpp index 85af0b374..283de0c84 100644 --- a/Source/Glitch64/OGLglitchmain.cpp +++ b/Source/Glitch64/OGLglitchmain.cpp @@ -51,8 +51,8 @@ static inline void opt_glCopyTexImage2D(GLenum target, width = screen_width - x; //printf("resizing w --> %d\n", width); } - if (y + height >= screen_height + viewport_offset) { - height = screen_height + viewport_offset - y; + if (y + height >= screen_height + g_viewport_offset) { + height = screen_height + g_viewport_offset - y; //printf("resizing h --> %d\n", height); } glCopyTexSubImage2D(target, level, 0, 0, x, y, width, height); @@ -292,7 +292,7 @@ int default_texture; // the infamous "32*1024*1024" is now configurable int current_texture; int depth_texture, color_texture; int glsl_support = 1; -int viewport_width, viewport_height, viewport_offset = 0, nvidia_viewport_hack = 0; +int viewport_width, viewport_height, g_viewport_offset = 0, nvidia_viewport_hack = 0; int save_w, save_h; int lfb_color_fmt; float invtex[2]; @@ -382,11 +382,11 @@ grClipWindow(FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy) if (int(miny) < 0) miny = 0; if (maxx < minx) maxx = minx; if (maxy < miny) maxy = miny; - glScissor(minx, miny + viewport_offset, maxx - minx, maxy - miny); + glScissor(minx, miny + g_viewport_offset, maxx - minx, maxy - miny); //printf("gl scissor %d %d %d %d\n", minx, miny, maxx, maxy); } else { - glScissor(minx, (viewport_offset)+g_height - maxy, maxx - minx, maxy - miny); + glScissor(minx, (g_viewport_offset)+g_height - maxy, maxx - minx, maxy - miny); } glEnable(GL_SCISSOR_TEST); grDisplayGLError("grClipWindow"); @@ -766,12 +766,12 @@ int nAuxBuffers) #endif #ifndef ANDROID - glViewport(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, g_height); viewport_width = g_width; viewport_height = g_height; nvidia_viewport_hack = 1; #else - glViewport(0, viewport_offset, width, height); + glViewport(0, g_viewport_offset, width, height); viewport_width = width; viewport_height = height; #endif // _WIN32 @@ -969,26 +969,26 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu, if (save_w) { if (tw > save_w && th > save_h) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h, - 0, viewport_offset + save_h, tw, th - save_h); + 0, g_viewport_offset + save_h, tw, th - save_h); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0, - save_w, viewport_offset, tw - save_w, save_h); + save_w, g_viewport_offset, tw - save_w, save_h); save_w = tw; save_h = th; } else if (tw > save_w) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, save_w, 0, - save_w, viewport_offset, tw - save_w, save_h); + save_w, g_viewport_offset, tw - save_w, save_h); save_w = tw; } else if (th > save_h) { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, save_h, - 0, viewport_offset + save_h, save_w, th - save_h); + 0, g_viewport_offset + save_h, save_w, th - save_h); save_h = th; } } else { glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, - 0, viewport_offset, tw, th); + 0, g_viewport_offset, tw, th); save_w = tw; save_h = th; } @@ -1037,12 +1037,12 @@ FX_ENTRY void FX_CALL grTextureBufferExt(GrChipID_t tmu, //printf("viewport %dx%d\n", width, height); if (g_height > screen_height) { - glViewport(0, viewport_offset + screen_height - g_height, g_width, g_height); + glViewport(0, g_viewport_offset + screen_height - g_height, g_width, g_height); } else - glViewport(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, g_height); - glScissor(0, viewport_offset, g_width, g_height); + glScissor(0, g_viewport_offset, g_width, g_height); grDisplayGLError("grTextureBufferExt :: A"); } @@ -1556,7 +1556,7 @@ void updateTexture() //glDeleteTextures( 1, &pBufferAddress ); glBindTexture(GL_TEXTURE_2D, pBufferAddress); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - 0, viewport_offset, g_width, g_height, 0); + 0, g_viewport_offset, g_width, g_height, 0); glBindTexture(GL_TEXTURE_2D, default_texture); glPopAttrib(); @@ -1583,7 +1583,7 @@ FX_ENTRY void FX_CALL grFramebufferCopyExt(int /*x*/, int /*y*/, int /*w*/, int glReadBuffer(current_buffer); glBindTexture(GL_TEXTURE_2D, depth_texture); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, - 0, viewport_offset, tw, th, 0); + 0, g_viewport_offset, tw, th, 0); glBindTexture(GL_TEXTURE_2D, default_texture); grDisplayGLError("grFramebufferCopyExt :: A"); return; @@ -1648,8 +1648,8 @@ grRenderBuffer(GrBuffer_t buffer) } curBufferAddr = 0; - glViewport(0, viewport_offset, g_width, viewport_height); - glScissor(0, viewport_offset, g_width, g_height); + glViewport(0, g_viewport_offset, g_width, viewport_height); + glScissor(0, g_viewport_offset, g_width, g_height); #ifdef SAVE_CBUFFER if (!use_fbo && render_to_texture == 2) { @@ -1856,7 +1856,7 @@ GrLfbInfo_t *info) info->strideInBytes = g_width * 4; info->writeMode = GR_LFBWRITEMODE_888; info->origin = origin; - glReadPixels(0, viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer); + glReadPixels(0, g_viewport_offset, g_width, g_height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer); } else { buf = (unsigned char*)malloc(g_width*g_height * 4); @@ -1865,7 +1865,7 @@ GrLfbInfo_t *info) info->strideInBytes = g_width * 2; info->writeMode = GR_LFBWRITEMODE_565; info->origin = origin; - glReadPixels(0, viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); + glReadPixels(0, g_viewport_offset, g_width, g_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); for (j = 0; j < g_height; j++) { @@ -1886,7 +1886,7 @@ GrLfbInfo_t *info) info->strideInBytes = g_width * 2; info->writeMode = GR_LFBWRITEMODE_ZA16; info->origin = origin; - glReadPixels(0, viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); + glReadPixels(0, g_viewport_offset, g_width, g_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); } } @@ -1936,7 +1936,7 @@ FxU32 dst_stride, void *dst_data) { buf = (unsigned char*)malloc(src_width*src_height * 4); - glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); + glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf); for (j = 0; j < src_height; j++) { @@ -1954,7 +1954,7 @@ FxU32 dst_stride, void *dst_data) { buf = (unsigned char*)malloc(src_width*src_height * 2); - glReadPixels(src_x, (viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); + glReadPixels(src_x, (g_viewport_offset)+g_height - src_y - src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer); for (j = 0; j < src_height; j++) { @@ -2082,7 +2082,7 @@ FxI32 src_stride, void *src_data) } else { - float *buf = (float*)malloc(src_width*(src_height + (viewport_offset))*sizeof(float)); + float *buf = (float*)malloc(src_width*(src_height + (g_viewport_offset))*sizeof(float)); if (src_format != GR_LFBWRITEMODE_ZA16) WriteTrace(TraceGlitch, TraceWarning, "unknown depth buffer write format:%x", src_format); @@ -2094,14 +2094,14 @@ FxI32 src_stride, void *src_data) { for (i = 0; i < src_width; i++) { - buf[(j + (viewport_offset))*src_width + i] = + buf[(j + (g_viewport_offset))*src_width + i] = (frameBuffer[(src_height - j - 1)*(src_stride / 2) + i] / (65536.0f*(2.0f / zscale))) + 1 - zscale / 2.0f; } } #ifdef VPDEBUG if (dumping) { - unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (viewport_offset))); + unsigned char * buf2 = (unsigned char *)malloc(src_width*(src_height + (g_viewport_offset))); for (i = 0; i < src_width*src_height; i++) buf2[i] = buf[i] * 255.0f; ilTexImage(src_width, src_height, 1, 1, IL_LUMINANCE, IL_UNSIGNED_BYTE, buf2); @@ -2120,7 +2120,7 @@ FxI32 src_stride, void *src_data) glDrawBuffer(GL_BACK); glClear(GL_DEPTH_BUFFER_BIT); glDepthMask(1); - glDrawPixels(src_width, src_height + (viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf); + glDrawPixels(src_width, src_height + (g_viewport_offset), GL_DEPTH_COMPONENT, GL_FLOAT, buf); free(buf); } diff --git a/Source/Glitch64/glitchmain.h b/Source/Glitch64/glitchmain.h index 6d173577c..b95d993ed 100644 --- a/Source/Glitch64/glitchmain.h +++ b/Source/Glitch64/glitchmain.h @@ -155,7 +155,7 @@ extern int fog_coord_support; //extern int pbuffer_support; extern int glsl_support; extern unsigned int pBufferAddress; -extern int viewport_width, viewport_height, viewport_offset, nvidia_viewport_hack; +extern int viewport_width, viewport_height, g_viewport_offset, nvidia_viewport_hack; extern int UMAmode; void grChromaRangeExt(GrColor_t color0, GrColor_t color1, FxU32 mode);