1
0
Fork 0

New format for mapper handlers to support keeping keys pressed.

Add unlocked speed hotkey
Add some sort of auto cycle guessing


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2490
This commit is contained in:
Sjoerd van der Berg 2006-02-12 23:28:21 +00:00
parent 03633e3a5c
commit 4a0acfb45a
4 changed files with 83 additions and 30 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: callback.cpp,v 1.30 2006-02-09 11:47:48 qbix79 Exp $ */
/* $Id: callback.cpp,v 1.31 2006-02-12 23:28:21 harekiet Exp $ */
#include <stdlib.h>
#include <string.h>
@ -31,7 +31,6 @@
far return or and IRET
*/
CallBack_Handler CallBack_Handlers[CB_MAX];
char* CallBack_Description[CB_MAX];
@ -58,6 +57,7 @@ void CALLBACK_DeAllocate(Bitu in) {
CallBack_Handlers[in]=&illegal_handler;
}
void CALLBACK_Idle(void) {
/* this makes the cpu execute instructions to handle irq's and then come back */
Bitu oldIF=GETFLAG(IF);
@ -70,7 +70,8 @@ void CALLBACK_Idle(void) {
reg_eip=oldeip;
SegSet16(cs,oldcs);
SETFLAGBIT(IF,oldIF);
if (CPU_Cycles>0) CPU_Cycles=0;
if (!CPU_CycleAuto && CPU_Cycles>0)
CPU_Cycles=0;
}
static Bitu default_handler(void) {

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cpu.cpp,v 1.76 2006-02-09 11:47:48 qbix79 Exp $ */
/* $Id: cpu.cpp,v 1.77 2006-02-12 23:28:21 harekiet Exp $ */
#include <assert.h>
#include "dosbox.h"
@ -45,6 +45,7 @@ Bits CPU_CycleMax = 2500;
Bits CPU_CycleUp = 0;
Bits CPU_CycleDown = 0;
CPU_Decoder * cpudecoder;
bool CPU_CycleAuto;
void CPU_Core_Full_Init(void);
void CPU_Core_Normal_Init(void);
@ -52,7 +53,6 @@ void CPU_Core_Simple_Init(void);
void CPU_Core_Dyn_X86_Init(void);
void CPU_Core_Dyn_X86_Cache_Init(bool enable_cache);
/* In debug mode exceptions are tested and dosbox exits when
* a unhandled exception state is detected.
* USE CHECK_EXCEPT to raise an exception in that case to see if that exception
@ -1876,7 +1876,9 @@ void CPU_ENTER(bool use32,Bitu bytes,Bitu level) {
}
extern void GFX_SetTitle(Bits cycles ,Bits frameskip,bool paused);
static void CPU_CycleIncrease(void) {
static void CPU_CycleIncrease(bool pressed) {
if (!pressed)
return;
Bits old_cycles=CPU_CycleMax;
if(CPU_CycleUp < 100){
CPU_CycleMax = (Bits)(CPU_CycleMax * (1 + (float)CPU_CycleUp / 100.0));
@ -1890,7 +1892,9 @@ static void CPU_CycleIncrease(void) {
GFX_SetTitle(CPU_CycleMax,-1,false);
}
static void CPU_CycleDecrease(void) {
static void CPU_CycleDecrease(bool pressed) {
if (!pressed)
return;
if(CPU_CycleDown < 100){
CPU_CycleMax = (Bits)(CPU_CycleMax / (1 + (float)CPU_CycleDown / 100.0));
} else {
@ -1958,7 +1962,14 @@ public:
Section_prop * section=static_cast<Section_prop *>(newconfig);
CPU_CycleLeft=0;//needed ?
CPU_Cycles=0;
CPU_CycleMax=section->Get_int("cycles");;
const char *cyclesLine = section->Get_string("cycles");
if (!strcasecmp(cyclesLine,"auto")) {
CPU_CycleMax=0;
CPU_CycleAuto=true;
} else {
CPU_CycleMax=atoi(cyclesLine);
CPU_CycleAuto=false;
}
CPU_CycleUp=section->Get_int("cycleup");
CPU_CycleDown=section->Get_int("cycledown");
const char * core=section->Get_string("core");