diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/include/cpu.h dosbox/include/cpu.h --- dosbox_org/include/cpu.h 2008-05-21 23:29:15.000000000 +0200 +++ dosbox/include/cpu.h 2008-08-16 17:18:38.000000000 +0200 @@ -59,6 +59,9 @@ extern bool CPU_CycleAutoAdjust; extern bool CPU_SkipCycleAutoAdjust; extern Bitu CPU_AutoDetermineMode; +extern Bitu CPU_CyclesCur; +extern Bit32s CPU_CyclesSet; +extern char core_mode[16]; extern Bitu CPU_ArchitectureType; diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/include/mapper.h dosbox/include/mapper.h --- dosbox_org/include/mapper.h 2007-01-08 20:45:37.000000000 +0100 +++ dosbox/include/mapper.h 2008-08-16 17:18:38.000000000 +0200 @@ -21,7 +21,8 @@ enum MapKeys { MK_f1,MK_f2,MK_f3,MK_f4,MK_f5,MK_f6,MK_f7,MK_f8,MK_f9,MK_f10,MK_f11,MK_f12, - MK_return,MK_kpminus,MK_scrolllock,MK_printscreen,MK_pause + MK_return,MK_kpminus,MK_equals,MK_scrolllock,MK_printscreen,MK_pause, + MK_1, MK_2, MK_3, MK_4 }; diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/cpu/core_dynrec.cpp dosbox/src/cpu/core_dynrec.cpp --- dosbox_org/src/cpu/core_dynrec.cpp 2007-11-24 18:26:48.000000000 +0100 +++ dosbox/src/cpu/core_dynrec.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -221,9 +221,11 @@ run_block: cache.block.running=0; + Bitu CPU_CyclesOld = CPU_Cycles; // now we're ready to run the dynamic code block // BlockReturn ret=((BlockReturn (*)(void))(block->cache.start))(); BlockReturn ret=core_dynrec.runcode(block->cache.start); + cycle_count += CPU_CyclesOld - CPU_Cycles; switch (ret) { case BR_Iret: diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/cpu/core_dyn_x86.cpp dosbox/src/cpu/core_dyn_x86.cpp --- dosbox_org/src/cpu/core_dyn_x86.cpp 2007-11-24 18:26:48.000000000 +0100 +++ dosbox/src/cpu/core_dyn_x86.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -296,8 +296,10 @@ } } run_block: + Bitu CPU_CyclesOld = CPU_Cycles; cache.block.running=0; BlockReturn ret=gen_runcode(block->cache.start); + cycle_count += CPU_CyclesOld - CPU_Cycles; switch (ret) { case BR_Iret: #if C_HEAVY_DEBUG diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/cpu/core_full.cpp dosbox/src/cpu/core_full.cpp --- dosbox_org/src/cpu/core_full.cpp 2007-01-08 20:45:38.000000000 +0100 +++ dosbox/src/cpu/core_full.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -64,8 +64,8 @@ Bits CPU_Core_Full_Run(void) { FullData inst; while (CPU_Cycles-->0) { -#if C_DEBUG cycle_count++; +#if C_DEBUG #if C_HEAVY_DEBUG if (DEBUG_HeavyIsBreakpoint()) { FillFlags(); diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/cpu/core_normal.cpp dosbox/src/cpu/core_normal.cpp --- dosbox_org/src/cpu/core_normal.cpp 2007-01-09 18:18:52.000000000 +0100 +++ dosbox/src/cpu/core_normal.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -49,7 +49,7 @@ #define SaveMd(off,val) mem_writed_inline(off,val) #endif -extern Bitu cycle_count; +Bitu cycle_count; #if C_FPU #define CPU_FPU 1 //Enable FPU escape instructions @@ -152,8 +152,8 @@ return debugCallback; }; #endif - cycle_count++; #endif + cycle_count++; restart_opcode: switch (core.opcode_index+Fetchb()) { #include "core_normal/prefix_none.h" diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/cpu/core_simple.cpp dosbox/src/cpu/core_simple.cpp --- dosbox_org/src/cpu/core_simple.cpp 2007-01-09 18:18:52.000000000 +0100 +++ dosbox/src/cpu/core_simple.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -148,8 +148,8 @@ return debugCallback; }; #endif - cycle_count++; #endif + cycle_count++; restart_opcode: switch (core.opcode_index+Fetchb()) { diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/cpu/cpu.cpp dosbox/src/cpu/cpu.cpp --- dosbox_org/src/cpu/cpu.cpp 2008-08-06 20:31:26.000000000 +0200 +++ dosbox/src/cpu/cpu.cpp 2008-08-16 17:22:29.000000000 +0200 @@ -55,7 +55,10 @@ Bit32s CPU_CycleLimit = -1; Bit32s CPU_CycleUp = 0; Bit32s CPU_CycleDown = 0; +Bit32s CPU_CyclesSet = 3000; +Bitu CPU_CyclesCur = 0; Bit64s CPU_IODelayRemoved = 0; +char core_mode[16]; CPU_Decoder * cpudecoder; bool CPU_CycleAutoAdjust = false; bool CPU_SkipCycleAutoAdjust = false; @@ -1557,6 +1560,7 @@ if (CPU_AutoDetermineMode&CPU_AUTODETERMINE_CORE) { CPU_Core_Dyn_X86_Cache_Init(true); cpudecoder=&CPU_Core_Dyn_X86_Run; + strcpy(core_mode, "dynamic"); } #elif (C_DYNREC) if (CPU_AutoDetermineMode&CPU_AUTODETERMINE_CORE) { @@ -2095,7 +2099,12 @@ CPU_CycleLeft=0;CPU_Cycles=0; if (CPU_CycleMax==old_cycles) CPU_CycleMax++; - LOG_MSG("CPU:%d cycles",CPU_CycleMax); + if (CPU_AutoDetermineMode&CPU_AUTODETERMINE_CYCLES) { + LOG_MSG("CPU:%d cycles (auto)",CPU_CycleMax); + } else { + CPU_CyclesSet=CPU_CycleMax; + LOG_MSG("CPU:%d cycles",CPU_CycleMax); + } GFX_SetTitle(CPU_CycleMax,-1,false); } } @@ -2115,11 +2124,87 @@ } CPU_CycleLeft=0;CPU_Cycles=0; if (CPU_CycleMax <= 0) CPU_CycleMax=1; - LOG_MSG("CPU:%d cycles",CPU_CycleMax); + if (CPU_AutoDetermineMode&CPU_AUTODETERMINE_CYCLES) { + LOG_MSG("CPU:%d cycles (auto)",CPU_CycleMax); + } else { + CPU_CyclesSet=CPU_CycleMax; + LOG_MSG("CPU:%d cycles",CPU_CycleMax); + } GFX_SetTitle(CPU_CycleMax,-1,false); } } +static void CPU_ToggleAutoCycles(bool pressed) { + if (!pressed) + return; + Section* sec=control->GetSection("cpu"); + if(sec) { + std::string tmp("cycles="); + sec->ExecuteDestroy(false); + if(CPU_CycleAutoAdjust) { + std::ostringstream str; + str << "fixed " << CPU_CyclesSet; + tmp.append(str.str()); + } else if(CPU_AutoDetermineMode&CPU_AUTODETERMINE_CYCLES) { + tmp.append("max"); + } else { + tmp.append("auto"); + } + sec->HandleInputline(tmp); + sec->ExecuteInit(false); + } +} + +static void CPU_ToggleFullCore(bool pressed) { + if (!pressed) + return; + Section* sec=control->GetSection("cpu"); + if(sec) { + std::string tmp="core=full"; + sec->ExecuteDestroy(false); + sec->HandleInputline(tmp); + sec->ExecuteInit(false); + } +} + +static void CPU_ToggleNormalCore(bool pressed) { + if (!pressed) + return; + Section* sec=control->GetSection("cpu"); + if(sec) { + std::string tmp="core=normal"; + sec->ExecuteDestroy(false); + sec->HandleInputline(tmp); + sec->ExecuteInit(false); + } +} + +#if ((C_DYNAMIC_X86) || (C_DYNREC)) +static void CPU_ToggleDynamicCore(bool pressed) { + if (!pressed) + return; + Section* sec=control->GetSection("cpu"); + if(sec) { + std::string tmp="core=dynamic"; + sec->ExecuteDestroy(false); + sec->HandleInputline(tmp); + sec->ExecuteInit(false); + } +} +#endif + +static void CPU_ToggleSimpleCore(bool pressed) { + if (!pressed) + return; + Section* sec=control->GetSection("cpu"); + std::string tmp="core=simple"; + if(sec) { + sec->ExecuteDestroy(false); + sec->HandleInputline(tmp); + sec->ExecuteInit(false); + } +} + void CPU_Enable_SkipAutoAdjust(void) { if (CPU_CycleAutoAdjust) { CPU_CycleMax /= 2; @@ -2203,6 +2288,13 @@ #endif MAPPER_AddHandler(CPU_CycleDecrease,MK_f11,MMOD1,"cycledown","Dec Cycles"); MAPPER_AddHandler(CPU_CycleIncrease,MK_f12,MMOD1,"cycleup" ,"Inc Cycles"); + MAPPER_AddHandler(CPU_ToggleAutoCycles,MK_equals,MMOD1,"cycauto","Tog. Cycles Auto"); + MAPPER_AddHandler(CPU_ToggleNormalCore,MK_1,MMOD1,"normal" ,"Tog. Normal Core"); + MAPPER_AddHandler(CPU_ToggleFullCore,MK_2,MMOD1,"full","Tog. Full Core"); +#if ((C_DYNAMIC_X86) || (C_DYNREC)) + MAPPER_AddHandler(CPU_ToggleDynamicCore,MK_3,MMOD1,"dynamic","Tog. Dynamic Core"); +#endif + MAPPER_AddHandler(CPU_ToggleSimpleCore,MK_4,MMOD1,"simple","Tog. Simple Core"); Change_Config(configuration); CPU_JMP(false,0,0,0); //Setup the first cpu core } @@ -2280,6 +2372,7 @@ std::istringstream stream(str); stream >> rmdval; CPU_CycleMax=(Bit32s)rmdval; + CPU_CyclesSet=(Bit32s)rmdval; } CPU_CycleAutoAdjust=false; } @@ -2288,6 +2381,8 @@ CPU_CycleDown=section->Get_int("cycledown"); std::string core(section->Get_string("core")); cpudecoder=&CPU_Core_Normal_Run; + strncpy(core_mode,core.c_str(),15); + core_mode[15] = '\0'; if (core == "normal") { cpudecoder=&CPU_Core_Normal_Run; } else if (core =="simple") { @@ -2313,7 +2408,11 @@ #else #endif + } else { + strcpy(core_mode,"normal"); + LOG_MSG("CPU:Unknown core type %s, switching back to normal.",core.c_str()); } + #if (C_DYNAMIC_X86) CPU_Core_Dyn_X86_Cache_Init((core == "dynamic") || (core == "dynamic_nodhfpu")); diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/debug/debug.cpp dosbox/src/debug/debug.cpp --- dosbox_org/src/debug/debug.cpp 2008-06-02 19:26:59.000000000 +0200 +++ dosbox/src/debug/debug.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -123,7 +123,7 @@ static Bitu oldflags,oldcpucpl; DBGBlock dbg; static Bitu input_count; -Bitu cycle_count; +extern Bitu cycle_count; static bool debugging; diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/dosbox.cpp dosbox/src/dosbox.cpp --- dosbox_org/src/dosbox.cpp 2008-05-21 23:29:16.000000000 +0200 +++ dosbox/src/dosbox.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -388,7 +388,7 @@ #if (C_DYNAMIC_X86) || (C_DYNREC) "dynamic", #endif - "normal", "simple",0 }; + "normal", "full", "simple", 0 }; Pstring = secprop->Add_string("core",Property::Changeable::WhenIdle,"auto"); Pstring->Set_values(cores); Pstring->Set_help("CPU Core used in emulation. auto will switch to dynamic if available and appropriate."); diff -urN -x '*.rej' -x '*~' -x '*.orig' -x Makefile.in -x configure -x config.h.in dosbox_org/src/gui/sdl_mapper.cpp dosbox/src/gui/sdl_mapper.cpp --- dosbox_org/src/gui/sdl_mapper.cpp 2008-05-26 21:13:42.000000000 +0200 +++ dosbox/src/gui/sdl_mapper.cpp 2008-08-16 17:18:38.000000000 +0200 @@ -1572,6 +1572,9 @@ case MK_kpminus: key=SDLK_KP_MINUS; break; + case MK_equals: + key=SDLK_EQUALS; + break; case MK_scrolllock: key=SDLK_SCROLLOCK; break; @@ -1581,6 +1584,18 @@ case MK_printscreen: key=SDLK_PRINT; break; + case MK_1: + key=SDLK_1; + break; + case MK_2: + key=SDLK_2; + break; + case MK_3: + key=SDLK_3; + break; + case MK_4: + key=SDLK_4; + break; } sprintf(buf,"%s \"key %d%s%s%s\"", entry, @@ -2072,7 +2087,7 @@ for(CHandlerEventVector_it it=handlergroup.begin();it!=handlergroup.end();it++) if(strcmp((*it)->buttonname,buttonname) == 0) return; - char tempname[17]; + char tempname[27]; strcpy(tempname,"hand_"); strcat(tempname,eventname); new CHandlerEvent(tempname,handler,key,mods,buttonname);