From d079c8388ad2352e57a308adb54d2133ae51a5d0 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Mon, 29 Sep 2003 21:05:59 +0000 Subject: [PATCH] Added title support Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1274 --- src/cpu/cpu.cpp | 6 +++++- src/gui/render.cpp | 6 ++++++ src/gui/sdlmain.cpp | 15 ++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index a5fc0412..630b3d31 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: cpu.cpp,v 1.33 2003-09-29 21:05:59 qbix79 Exp $ */ #include #include "dosbox.h" @@ -828,12 +829,14 @@ void CPU_HLT(void) { } +extern void GFX_SetTitle(Bits cycles ,Bits frameskip); static void CPU_CycleIncrease(void) { Bits old_cycles=CPU_CycleMax; CPU_CycleMax=(Bits)(CPU_CycleMax*1.2); CPU_CycleLeft=0;CPU_Cycles=0; if (CPU_CycleMax==old_cycles) CPU_CycleMax++; LOG_MSG("CPU:%d cycles",CPU_CycleMax); + GFX_SetTitle(CPU_CycleMax,-1); } static void CPU_CycleDecrease(void) { @@ -841,6 +844,7 @@ static void CPU_CycleDecrease(void) { CPU_CycleLeft=0;CPU_Cycles=0; if (!CPU_CycleMax) CPU_CycleMax=1; LOG_MSG("CPU:%d cycles",CPU_CycleMax); + GFX_SetTitle(CPU_CycleMax,-1); } @@ -881,7 +885,7 @@ void CPU_Init(Section* sec) { CPU_CycleMax=section->Get_int("cycles");; if (!CPU_CycleMax) CPU_CycleMax=1500; CPU_CycleLeft=0; - + GFX_SetTitle(CPU_CycleMax,-1); MSG_Add("CPU_CONFIGFILE_HELP","The amount of cycles to execute each loop. Lowering this setting will slowdown dosbox\n"); } diff --git a/src/gui/render.cpp b/src/gui/render.cpp index bf65ece0..568c7118 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: render.cpp,v 1.16 2003-09-29 21:05:05 qbix79 Exp $ */ + #include #include @@ -357,14 +359,17 @@ normalop: GFX_Start(); } +extern void GFX_SetTitle(Bits cycles, Bits frameskip); static void IncreaseFrameSkip(void) { if (render.frameskip.max<10) render.frameskip.max++; LOG_MSG("Frame Skip at %d",render.frameskip.max); + GFX_SetTitle(-1,render.frameskip.max); } static void DecreaseFrameSkip(void) { if (render.frameskip.max>0) render.frameskip.max--; LOG_MSG("Frame Skip at %d",render.frameskip.max); + GFX_SetTitle(-1,render.frameskip.max); } void RENDER_Init(Section * sec) { @@ -394,5 +399,6 @@ void RENDER_Init(Section * sec) { } KEYBOARD_AddEvent(KBD_f7,KBD_MOD_CTRL,DecreaseFrameSkip); KEYBOARD_AddEvent(KBD_f8,KBD_MOD_CTRL,IncreaseFrameSkip); + GFX_SetTitle(-1,render.frameskip.max); } diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 117b8def..2399dd5a 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -15,6 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* $Id: sdlmain.cpp,v 1.43 2003-09-29 21:04:31 qbix79 Exp $ */ + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif @@ -78,6 +81,16 @@ struct SDL_Block { static SDL_Block sdl; static void CaptureMouse(void); +void GFX_SetTitle(Bits cycles,Bits frameskip){ + char title[200]={0}; + static internal_cycles=0; + static internal_frameskip=0; + if(cycles != -1) internal_cycles = cycles; + if(frameskip != -1) internal_frameskip = frameskip; + sprintf(title,"Cpu Cycles: %8d, Frameskip %2d",internal_cycles,internal_frameskip); + SDL_WM_SetCaption(title,VERSION); +} + /* Reset the screen with current values in the sdl structure */ static void ResetScreen(void) { GFX_Stop(); @@ -102,7 +115,7 @@ static void ResetScreen(void) { ); - SDL_WM_SetCaption(VERSION,VERSION); + GFX_SetTitle(-1,-1); Bitu flags=MODE_SET; if (sdl.full_screen) flags|=MODE_FULLSCREEN;