diff --git a/Source/Common/DateTimeClass.cpp b/Source/Common/DateTimeClass.cpp index 141e5e89d..a93305217 100644 --- a/Source/Common/DateTimeClass.cpp +++ b/Source/Common/DateTimeClass.cpp @@ -13,3 +13,9 @@ std::string CDateTime::Format(const char * format) strftime(buffer, sizeof(buffer), format, localtime(&m_time)); return std::string(buffer); } + +CDateTime & CDateTime::SetToNow(void) +{ + m_time = time(NULL); + return *this; +} diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index f2cdc99af..93d0414a9 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -312,12 +312,8 @@ public: COMMAND_HANDLER_EX(IDC_CMB_WINDOW_RES, CBN_SELCHANGE, ItemChanged) COMMAND_HANDLER_EX(IDC_CMB_FS_RESOLUTION, CBN_SELCHANGE, ItemChanged) COMMAND_HANDLER_EX(IDC_CHK_VERTICAL_SYNC, BN_CLICKED, ItemChanged) - COMMAND_HANDLER_EX(IDC_CHK_FPS_COUNTER, BN_CLICKED, ItemChanged) - COMMAND_HANDLER_EX(IDC_CHK_VIS_COUNTER, BN_CLICKED, ItemChanged) - COMMAND_HANDLER_EX(IDC_CHK_PERCENT_COUNTER, BN_CLICKED, ItemChanged) COMMAND_HANDLER_EX(IDC_CHK_CLOCK_ENABLED, BN_CLICKED, ItemChanged) COMMAND_HANDLER_EX(IDC_CHK_CLOCK_24, BN_CLICKED, ItemChanged) - COMMAND_HANDLER_EX(IDC_CHK_TRANSPARENT, BN_CLICKED, ItemChanged) COMMAND_HANDLER_EX(IDC_CBXANISOTROPIC, BN_CLICKED, ItemChanged) COMMAND_HANDLER_EX(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT, BN_CLICKED, ItemChanged) COMMAND_HANDLER_EX(IDC_CHK_AUTODETECT_VRAM, BN_CLICKED, ItemChanged) @@ -373,22 +369,6 @@ public: m_cbxTextureSettings.Attach(GetDlgItem(IDC_CHK_SHOW_TEXTURE_ENHANCEMENT)); m_cbxTextureSettings.SetCheck(g_settings->texenh_options ? BST_CHECKED : BST_UNCHECKED); - m_cbxFPS.Attach(GetDlgItem(IDC_CHK_FPS_COUNTER)); - m_cbxFPS.SetCheck((g_settings->show_fps & 1) > 0 ? BST_CHECKED : BST_UNCHECKED); - TTSetTxt(IDC_CHK_FPS_COUNTER, "FPS counter:\n\nWhen this option is checked, a FPS (frames per second) counter will be shown in the lower left corner of the screen.\n\n[Recommended: your preference]"); - - m_cbxVIS.Attach(GetDlgItem(IDC_CHK_VIS_COUNTER)); - m_cbxVIS.SetCheck((g_settings->show_fps & 2) > 0 ? BST_CHECKED : BST_UNCHECKED); - TTSetTxt(IDC_CHK_VIS_COUNTER, "VI/s counter:\n\nWhen this option is checked, a VI/s (vertical interrupts per second) counter will be shown in the lower left corner of the screen.\nThis is like the FPS counter but will be consistent at 60 VI/s for full speed on NTSC (U) games and 50 VI/s for full speed on PAL (E) ones.\n\n[Recommended: your preference]"); - - m_cbxPercent.Attach(GetDlgItem(IDC_CHK_PERCENT_COUNTER)); - m_cbxPercent.SetCheck((g_settings->show_fps & 4) > 0 ? BST_CHECKED : BST_UNCHECKED); - TTSetTxt(IDC_CHK_PERCENT_COUNTER, "% speed:\n\nThis displays a percentage of the actual N64 speed in the lower left corner of the screen.\n\n[Recommended: your preference]"); - - m_cbxTextTransparent.Attach(GetDlgItem(IDC_CHK_TRANSPARENT)); - m_cbxTextTransparent.SetCheck((g_settings->show_fps & 8) > 0 ? BST_CHECKED : BST_UNCHECKED); - TTSetTxt(IDC_CHK_TRANSPARENT, "Transparent text background:\n\nIf this is checked, all on-screen messages will have a transparent background.\nOtherwise, it will have a solid black background.\n\n[Recommended: your preference]"); - m_cbxClockEnabled.Attach(GetDlgItem(IDC_CHK_CLOCK_ENABLED)); m_cbxClockEnabled.SetCheck(g_settings->clock > 0 ? BST_CHECKED : BST_UNCHECKED); TTSetTxt(IDC_CHK_CLOCK_ENABLED, "Clock enabled:\n\nThis option will put a clock in the lower right corner of the screen, showing the current time.\n\n[Recommended: your preference]"); @@ -440,11 +420,6 @@ public: g_settings->scr_res_y = g_settings->res_y = resolutions[g_settings->res_data][1]; g_settings->vsync = m_cbxVSync.GetCheck() == BST_CHECKED; g_settings->ssformat = m_cmbScreenShotFormat.GetCurSel(); - g_settings->show_fps = - (m_cbxFPS.GetCheck() == BST_CHECKED ? 1 : 0) | - (m_cbxVIS.GetCheck() == BST_CHECKED ? 2 : 0) | - (m_cbxPercent.GetCheck() == BST_CHECKED ? 4 : 0) | - (m_cbxTextTransparent.GetCheck() == BST_CHECKED ? 8 : 0); g_settings->texenh_options = m_cbxTextureSettings.GetCheck() == BST_CHECKED; g_settings->clock = m_cbxClockEnabled.GetCheck() == BST_CHECKED; g_settings->clock_24_hr = m_cbxClock24.GetCheck() == BST_CHECKED; @@ -483,7 +458,6 @@ private: CComboBox m_cmbScreenShotFormat; CButton m_cbxVSync; CButton m_cbxTextureSettings; - CButton m_cbxFPS, m_cbxVIS, m_cbxPercent, m_cbxTextTransparent; CButton m_cbxClockEnabled, m_cbxClock24; CButton m_cbxAnisotropic; CButton m_cbxFBO; diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 1b17148c0..c48d16a23 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -51,7 +51,7 @@ void ConfigCleanup(void); enum { // General Settings - Set_CardId, Set_vsync, Set_ssformat, Set_ShowFps, Set_clock, + Set_CardId, Set_vsync, Set_ssformat, Set_clock, Set_clock_24_hr, Set_Rotate, Set_texenh_options, Set_hotkeys, Set_wrpVRAM, Set_wrpFBO, Set_wrpAnisotropic, Set_autodetect_ucode, Set_ucode, Set_wireframe, Set_wfmode, Set_logging, Set_log_clear, Set_elogging, Set_run_in_window, diff --git a/Source/Glide64/Gfx_1.3.h b/Source/Glide64/Gfx_1.3.h index 2e5dd608d..ce061aa16 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 #include "GlideExtensions.h" #include "rdp.h" @@ -107,8 +106,6 @@ extern "C" { // ******************************** -#define FPS // fps counter able? (not enabled necessarily) - #define LOGNOTKEY // Log if not pressing: #define LOGKEY 0x11 // this key (CONTROL) @@ -124,8 +121,6 @@ extern "C" { #endif -#define FPS_FRAMES 10 // Number of frames in which to make an FPS count - //#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer, // usually used to debug clamping issues. @@ -149,13 +144,6 @@ extern "C" { #define COLORED_DEBUGGER // ;) pretty colors -#ifdef FPS - extern HighResTimeStamp fps_last; - extern HighResTimeStamp fps_next; - extern float fps; - extern uint32_t fps_count; -#endif - // rdram mask at 0x400000 bytes (bah, not right for majora's mask) //#define BMASK 0x7FFFFF extern unsigned int BMASK; diff --git a/Source/Glide64/Glide64.rc b/Source/Glide64/Glide64.rc index 854bb2a03..73da448c3 100644 --- a/Source/Glide64/Glide64.rc +++ b/Source/Glide64/Glide64.rc @@ -100,14 +100,9 @@ BEGIN CONTROL "Use frame buffer objects",IDC_CHK_USE_FRAME_BUFFER_OBJECT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,113,133,10 GROUPBOX "On screen display",IDC_STATIC,174,2,135,128 - CONTROL "FPS counter",IDC_CHK_FPS_COUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,25,54,10 - CONTROL "VI/s counter",IDC_CHK_VIS_COUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,36,55,10 - CONTROL "% speed",IDC_CHK_PERCENT_COUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,48,44,10 - GROUPBOX "Speed",IDC_STATIC,179,13,124,49 - GROUPBOX "Time",IDC_STATIC,180,64,124,36 - CONTROL "Clock enabled",IDC_CHK_CLOCK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,75,59,10 - CONTROL "Clock is 24-hour",IDC_CHK_CLOCK_24,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,88,52,8 - CONTROL "Transparent text background",IDC_CHK_TRANSPARENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,184,103,117,14 + GROUPBOX "Time",IDC_STATIC,179,13,124,36 + CONTROL "Clock enabled",IDC_CHK_CLOCK_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,24,59,10 + CONTROL "Clock is 24-hour",IDC_CHK_CLOCK_24,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,186,37,52,8 GROUPBOX "Other",IDC_STATIC,7,132,303,36 CONTROL "Show texture enhancement options",IDC_CHK_SHOW_TEXTURE_ENHANCEMENT, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,140,123,11 diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 11e1e06dc..08f948ddc 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -92,22 +92,8 @@ int64 perf_cur; int64 perf_next; #endif -#ifdef FPS -HighResTimeStamp fps_last; -HighResTimeStamp fps_next; -float fps = 0.0f; -uint32_t fps_count = 0; - -uint32_t vi_count = 0; -float vi = 0.0f; - uint32_t region = 0; -float ntsc_percent = 0.0f; -float pal_percent = 0.0f; - -#endif - // Resolutions, MUST be in the correct order (SST1VID.H) uint32_t resolutions[0x18][2] = { { 320, 200 }, @@ -282,7 +268,7 @@ void ConfigWrapper() #else g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic #endif - ); + ); } void UseUnregisteredSetting(int /*SettingID*/) @@ -310,7 +296,6 @@ void ReadSettings() #endif g_settings->vsync = GetSetting(Set_vsync); g_settings->ssformat = (uint8_t)GetSetting(Set_ssformat); - g_settings->show_fps = (uint8_t)GetSetting(Set_ShowFps); g_settings->clock = GetSetting(Set_clock); g_settings->clock_24_hr = GetSetting(Set_clock_24_hr); #ifdef ANDROID @@ -542,7 +527,6 @@ void WriteSettings(void) #endif SetSetting(Set_ssformat, g_settings->ssformat); SetSetting(Set_vsync, g_settings->vsync); - SetSetting(Set_ShowFps, g_settings->show_fps); SetSetting(Set_clock, g_settings->clock); SetSetting(Set_clock_24_hr, g_settings->clock_24_hr); #ifdef ANDROID @@ -1398,10 +1382,6 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) g_settings->res_data_org = g_settings->res_data; #endif -#ifdef FPS - fps_last.SetToNow(); -#endif - debug_init(); // Initialize debugger gfx = Gfx_Info; @@ -1419,7 +1399,7 @@ int CALL InitiateGFX(GFX_INFO Gfx_Info) #else g_settings->wrpResolution, g_settings->wrpVRAM * 1024 * 1024, g_settings->wrpFBO, g_settings->wrpAnisotropic #endif - ); + ); grGlideInit(); grSstSelect(0); @@ -1480,7 +1460,6 @@ void CALL PluginLoaded(void) #endif general_setting(Set_vsync, "vsync", 1); general_setting(Set_ssformat, "ssformat", 1); - general_setting(Set_ShowFps, "show_fps", 0); general_setting(Set_clock, "clock", 0); general_setting(Set_clock_24_hr, "clock_24_hr", 0); general_setting(Set_texenh_options, "texenh_options", 0); @@ -1793,25 +1772,6 @@ void CALL UpdateScreen(void) { update_screen_count++; } -#ifdef FPS - // vertical interrupt has occurred, increment counter - vi_count++; - - // Check frames per second - fps_next.SetToNow(); - double diff_secs = (double)(fps_next.GetMicroSeconds() - fps_last.GetMicroSeconds()) / 1000000; - if (diff_secs > 0.5f) - { - fps = (float)(fps_count / diff_secs); - vi = (float)(vi_count / diff_secs); - ntsc_percent = vi / 0.6f; - pal_percent = vi / 0.5f; - fps_last = fps_next; - fps_count = 0; - vi_count = 0; - } -#endif - //* uint32_t limit = (g_settings->hacks&hack_Lego) ? 15 : 30; if ((g_settings->frame_buffer&fb_cpu_write_hack) && (update_screen_count > limit) && (rdp.last_bg == 0)) { @@ -1822,8 +1782,6 @@ void CALL UpdateScreen(void) UpdateScreen(); return; } - //*/ - //* if (no_dlist) { if (*gfx.VI_ORIGIN_REG > width) @@ -1837,7 +1795,6 @@ void CALL UpdateScreen(void) } return; } - //*/ if (g_settings->swapmode == 0) newSwapBuffers(); } @@ -1993,50 +1950,19 @@ void newSwapBuffers() grDepthMask(FXFALSE); grCullMode(GR_CULL_DISABLE); - if ((g_settings->show_fps & 0xF) || g_settings->clock) - set_message_combiner(); -#ifdef FPS - float y = 0;//(float)g_settings->res_y; - if (g_settings->show_fps & 0x0F) - { - if (g_settings->show_fps & 4) - { - if (region) // PAL - output(0, y, 1, "%d%% ", (int)pal_percent); - else - output(0, y, 1, "%d%% ", (int)ntsc_percent); - y += 16; - } - if (g_settings->show_fps & 2) - { - output(0, y, 1, "VI/s: %.02f ", vi); - y += 16; - } - if (g_settings->show_fps & 1) - output(0, y, 1, "FPS: %.02f ", fps); - } -#endif - if (g_settings->clock) { + set_message_combiner(); if (g_settings->clock_24_hr) { - output(956.0f, 0, 1, CDateTime().Format("%H:%M:%S").c_str(), 0); + output(956.0f, 0, 1, CDateTime().SetToNow().Format("%H:%M:%S").c_str(), 0); } else { - output(930.0f, 0, 1, CDateTime().Format("%I:%M:%S %p").c_str(), 0); + output(930.0f, 0, 1, CDateTime().SetToNow().Format("%I:%M:%S %p").c_str(), 0); } } //hotkeys - //if (CheckKeyPressed(G64_VK_BACK, 0x0001)) - //{ - //hotkey_info.hk_filtering = 100; - //if (g_settings->filtering < 2) - //g_settings->filtering++; - //else - //g_settings->filtering = 0; - //} if ((abs((int)(frame_count - curframe)) > 3) && CheckKeyPressed(G64_VK_ALT, 0x8000)) //alt + { if (CheckKeyPressed(G64_VK_B, 0x8000)) //b @@ -2241,7 +2167,6 @@ void newSwapBuffers() grAuxBufferExt(GR_BUFFER_AUXBUFFER); WriteTrace(TraceGlide64, TraceDebug, "BUFFER SWAPPED"); grBufferSwap(g_settings->vsync); - fps_count++; 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 298fc6430..dbd375835 100644 --- a/Source/Glide64/Settings.cpp +++ b/Source/Glide64/Settings.cpp @@ -15,7 +15,6 @@ texenh_options(0), ssformat(0), vsync(0), -show_fps(0), clock(0), clock_24_hr(0), #ifdef ANDROID diff --git a/Source/Glide64/Settings.h b/Source/Glide64/Settings.h index 34c742a6c..17b72b3fa 100644 --- a/Source/Glide64/Settings.h +++ b/Source/Glide64/Settings.h @@ -18,7 +18,6 @@ public: int ssformat; int vsync; - int show_fps; int clock; int clock_24_hr; #ifdef ANDROID diff --git a/Source/Glide64/Util.cpp b/Source/Glide64/Util.cpp index 905b0e136..5b817950e 100644 --- a/Source/Glide64/Util.cpp +++ b/Source/Glide64/Util.cpp @@ -2087,13 +2087,7 @@ void set_message_combiner() GR_COMBINE_LOCAL_NONE, GR_COMBINE_OTHER_TEXTURE, FXFALSE); - if (g_settings->show_fps & 0x08) - grAlphaBlendFunction(GR_BLEND_SRC_ALPHA, - GR_BLEND_ONE_MINUS_SRC_ALPHA, - GR_BLEND_ZERO, - GR_BLEND_ZERO); - else - grAlphaBlendFunction(GR_BLEND_ONE, + grAlphaBlendFunction(GR_BLEND_ONE, GR_BLEND_ZERO, GR_BLEND_ZERO, GR_BLEND_ZERO); diff --git a/Source/Glide64/rdp.cpp b/Source/Glide64/rdp.cpp index f0339604a..ea70a343c 100644 --- a/Source/Glide64/rdp.cpp +++ b/Source/Glide64/rdp.cpp @@ -2633,7 +2633,7 @@ static void rdp_setcolorimage() { if (rdp.ci_count == 0) { - if (rdp.ci_status == ci_aux) //for PPL + if ((rdp.ci_status == ci_aux)) //for PPL { float sx = rdp.scale_x; float sy = rdp.scale_y; diff --git a/Source/Glide64/resource.h b/Source/Glide64/resource.h index d50c89f2e..f44379181 100644 --- a/Source/Glide64/resource.h +++ b/Source/Glide64/resource.h @@ -17,12 +17,8 @@ #define IDC_SPIN_TEXTURE_CACHE 1006 #define IDC_EDIT1 1007 #define IDC_CHK_USE_FRAME_BUFFER_OBJECT 1008 -#define IDC_CHK_FPS_COUNTER 1009 -#define IDC_CHK_VIS_COUNTER 1010 -#define IDC_CHK_PERCENT_COUNTER 1011 #define IDC_CHK_CLOCK_ENABLED 1012 #define IDC_CHK_CLOCK_24 1013 -#define IDC_CHK_TRANSPARENT 1014 #define IDC_CMB_SCREEN_SHOT_FORMAT 1015 #define IDC_CHK_SHOW_TEXTURE_ENHANCEMENT 1016 #define IDC_INFO 1017 diff --git a/Source/Glide64/ucodeFB.h b/Source/Glide64/ucodeFB.h index 202b2ede4..bfb2571e2 100644 --- a/Source/Glide64/ucodeFB.h +++ b/Source/Glide64/ucodeFB.h @@ -62,7 +62,7 @@ static void fb_bg_copy() if (rdp.main_ci == 0) return; CI_STATUS status = rdp.frame_buffers[rdp.ci_count - 1].status; - if (status == ci_copy) + if ((status == ci_copy)) return; uint32_t addr = segoffset(rdp.cmd1) >> 1;