sync with dosbox svn

This commit is contained in:
dborth 2009-12-14 07:10:18 +00:00
parent 5b8f46ee24
commit f23c2ea048
12 changed files with 443 additions and 435 deletions

View File

@ -344,8 +344,10 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
#define GCC_UNLIKELY(x) __builtin_expect((x),0) #define GCC_UNLIKELY(x) __builtin_expect((x),0)
#define GCC_LIKELY(x) __builtin_expect((x),1)
#else #else
#define GCC_UNLIKELY(x) (x) #define GCC_UNLIKELY(x) (x)
#define GCC_LIKELY(x) (x)
#endif]) #endif])
AH_BOTTOM([ AH_BOTTOM([

View File

@ -44,7 +44,7 @@ class DOS_Shell;
class BatchFile { class BatchFile {
public: public:
BatchFile(DOS_Shell * host,char const* const name, char const * const cmd_line); BatchFile(DOS_Shell * host,char const* const resolved_name,char const* const entered_name, char const * const cmd_line);
virtual ~BatchFile(); virtual ~BatchFile();
virtual bool ReadLine(char * line); virtual bool ReadLine(char * line);
bool Goto(char * where); bool Goto(char * where);

View File

@ -53,7 +53,7 @@ CPUBlock cpu;
Segments Segs; Segments Segs;
Bit32s CPU_Cycles = 0; Bit32s CPU_Cycles = 0;
Bit32s CPU_CycleLeft = 0; Bit32s CPU_CycleLeft = 3000;
Bit32s CPU_CycleMax = 3000; Bit32s CPU_CycleMax = 3000;
Bit32s CPU_OldCycleMax = 3000; Bit32s CPU_OldCycleMax = 3000;
Bit32s CPU_CyclePercUsed = 100; Bit32s CPU_CyclePercUsed = 100;
@ -2226,7 +2226,7 @@ public:
bool Change_Config(Section* newconfig){ bool Change_Config(Section* newconfig){
Section_prop * section=static_cast<Section_prop *>(newconfig); Section_prop * section=static_cast<Section_prop *>(newconfig);
CPU_AutoDetermineMode=CPU_AUTODETERMINE_NONE; CPU_AutoDetermineMode=CPU_AUTODETERMINE_NONE;
CPU_CycleLeft=0;//needed ? //CPU_CycleLeft=0;//needed ?
CPU_Cycles=0; CPU_Cycles=0;
CPU_SkipCycleAutoAdjust=false; CPU_SkipCycleAutoAdjust=false;

View File

@ -816,7 +816,11 @@ static Bitu DOS_21Handler(void) {
break; break;
case 0x59: /* Get Extended error information */ case 0x59: /* Get Extended error information */
reg_ax=dos.errorcode; reg_ax=dos.errorcode;
reg_bh=0; //Unkown error class if (dos.errorcode==DOSERR_FILE_NOT_FOUND || dos.errorcode==DOSERR_PATH_NOT_FOUND) {
reg_bh=8; //Not Found error class (Road Hog)
} else {
reg_bh=0; //Unspecified error class
}
reg_bl=1; //Retry retry retry reg_bl=1; //Retry retry retry
reg_ch=0; //Unkown error locus reg_ch=0; //Unkown error locus
break; break;

View File

@ -68,7 +68,8 @@ static void cmos_checktimer(void) {
LOG(LOG_PIT,LOG_NORMAL)("RTC Timer at %.2f hz",1000.0/cmos.timer.delay); LOG(LOG_PIT,LOG_NORMAL)("RTC Timer at %.2f hz",1000.0/cmos.timer.delay);
// PIC_AddEvent(cmos_timerevent,cmos.timer.delay); // PIC_AddEvent(cmos_timerevent,cmos.timer.delay);
/* A rtc is always running */ /* A rtc is always running */
PIC_AddEvent(cmos_timerevent,(double)cmos.timer.delay-fmod(PIC_FullIndex(),(double)cmos.timer.delay)); //Should be more like a real pc. Check double remd=fmod(PIC_FullIndex(),(double)cmos.timer.delay);
PIC_AddEvent(cmos_timerevent,(float)((double)cmos.timer.delay-remd)); //Should be more like a real pc. Check
// status reg A reading with this (and with other delays actually) // status reg A reading with this (and with other delays actually)
} }

View File

@ -401,9 +401,9 @@ Bits Operator::TemplateVolume( ) {
break; break;
case DECAY: case DECAY:
vol += RateForward( decayAdd ); vol += RateForward( decayAdd );
if ( vol >= sustainLevel ) { if ( GCC_UNLIKELY(vol >= sustainLevel) ) {
//Check if we didn't overshoot max attenuation, then just go off //Check if we didn't overshoot max attenuation, then just go off
if ( vol >= ENV_MAX ) { if ( GCC_UNLIKELY(vol >= ENV_MAX) ) {
volume = ENV_MAX; volume = ENV_MAX;
SetState( OFF ); SetState( OFF );
return ENV_MAX; return ENV_MAX;
@ -420,7 +420,7 @@ Bits Operator::TemplateVolume( ) {
//In sustain phase, but not sustaining, do regular release //In sustain phase, but not sustaining, do regular release
case RELEASE: case RELEASE:
vol += RateForward( releaseAdd );; vol += RateForward( releaseAdd );;
if ( vol >= ENV_MAX ) { if ( GCC_UNLIKELY(vol >= ENV_MAX) ) {
volume = ENV_MAX; volume = ENV_MAX;
SetState( OFF ); SetState( OFF );
return ENV_MAX; return ENV_MAX;
@ -1260,7 +1260,7 @@ void Chip::Setup( Bit32u rate ) {
count += guessAdd; count += guessAdd;
Bit32s change = count >> RATE_SH; Bit32s change = count >> RATE_SH;
count &= RATE_MASK; count &= RATE_MASK;
if ( change ) { if ( GCC_UNLIKELY(change) ) { // less than 1 %
volume += ( ~volume * change ) >> 3; volume += ( ~volume * change ) >> 3;
} }
samples++; samples++;
@ -1496,7 +1496,7 @@ void Handler::WriteReg( Bit32u addr, Bit8u val ) {
void Handler::Generate( MixerChannel* chan, Bitu samples ) { void Handler::Generate( MixerChannel* chan, Bitu samples ) {
Bit32s buffer[ 512 * 2 ]; Bit32s buffer[ 512 * 2 ];
if ( samples > 512 ) if ( GCC_UNLIKELY(samples > 512) )
samples = 512; samples = 512;
if ( !chip.opl3Active ) { if ( !chip.opl3Active ) {
chip.GenerateBlock2( samples, buffer ); chip.GenerateBlock2( samples, buffer );

View File

@ -65,7 +65,7 @@ static const fltype frqmul_tab[16] = {
0.5,1,2,3,4,5,6,7,8,9,10,10,12,12,15,15 0.5,1,2,3,4,5,6,7,8,9,10,10,12,12,15,15
}; };
// calculated frequency multiplication values (depend on sampling rate) // calculated frequency multiplication values (depend on sampling rate)
static float frqmul[16]; static fltype frqmul[16];
// key scale levels // key scale levels
static Bit8u kslev[8][16]; static Bit8u kslev[8][16];

View File

@ -357,9 +357,10 @@ void FinishSetMode_ET4K(Bitu crtc_base, VGA_ModeExtraData* modeData) {
Bitu best = 1; Bitu best = 1;
Bits dist = 100000000; Bits dist = 100000000;
for (Bitu i=0; i<16; i++) { for (Bitu i=0; i<16; i++) {
if (abs(target-et4k.clockFreq[i]) < dist) { Bits cdiff=abs((Bits)(target-et4k.clockFreq[i]));
if (cdiff < dist) {
best = i; best = i;
dist = abs(target-et4k.clockFreq[i]); dist = cdiff;
} }
} }
set_clock_index_et4k(best); set_clock_index_et4k(best);
@ -718,9 +719,10 @@ void FinishSetMode_ET3K(Bitu crtc_base, VGA_ModeExtraData* modeData) {
Bitu best = 1; Bitu best = 1;
Bits dist = 100000000; Bits dist = 100000000;
for (Bitu i=0; i<8; i++) { for (Bitu i=0; i<8; i++) {
if (abs(target-et3k.clockFreq[i]) < dist) { Bits cdiff = abs((Bits)(target-et3k.clockFreq[i]));
if (cdiff < dist) {
best = i; best = i;
dist = abs(target-et3k.clockFreq[i]); dist = cdiff;
} }
} }
set_clock_index_et3k(best); set_clock_index_et3k(best);

View File

@ -286,6 +286,8 @@ void DOS_Shell::Run(void) {
std::string line; std::string line;
if (cmd->FindStringRemain("/C",line)) { if (cmd->FindStringRemain("/C",line)) {
strcpy(input_line,line.c_str()); strcpy(input_line,line.c_str());
char* sep = strpbrk(input_line,"\r\n"); //GTA installer
if (sep) *sep = 0;
DOS_Shell temp; DOS_Shell temp;
temp.echo = echo; temp.echo = echo;
temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal; temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal;

View File

@ -24,14 +24,14 @@
#include "shell.h" #include "shell.h"
#include "support.h" #include "support.h"
BatchFile::BatchFile(DOS_Shell * host,char const * const name, char const * const cmd_line) { BatchFile::BatchFile(DOS_Shell * host,char const * const resolved_name,char const * const entered_name, char const * const cmd_line) {
location = 0; location = 0;
prev=host->bf; prev=host->bf;
echo=host->echo; echo=host->echo;
shell=host; shell=host;
char totalname[DOS_PATHLENGTH+4]; char totalname[DOS_PATHLENGTH+4];
DOS_Canonicalize(name,totalname); // Get fullname including drive specificiation DOS_Canonicalize(resolved_name,totalname); // Get fullname including drive specificiation
cmd = new CommandLine(totalname,cmd_line); cmd = new CommandLine(entered_name,cmd_line);
filename = totalname; filename = totalname;
//Test if file is openable //Test if file is openable

View File

@ -474,6 +474,13 @@ void DOS_Shell::CMD_DIR(char * args) {
/* Skip non-directories if option AD is present */ /* Skip non-directories if option AD is present */
if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue; if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue;
/* output the file */
if (optB) {
// this overrides pretty much everything
if (strcmp(".",name) && strcmp("..",name)) {
WriteOut("%s\n",name);
}
} else {
char * ext = empty_string; char * ext = empty_string;
if (!optW && (name[0] != '.')) { if (!optW && (name[0] != '.')) {
ext = strrchr(name, '.'); ext = strrchr(name, '.');
@ -486,14 +493,6 @@ void DOS_Shell::CMD_DIR(char * args) {
Bit8u hour = (Bit8u)((time >> 5 ) >> 6); Bit8u hour = (Bit8u)((time >> 5 ) >> 6);
Bit8u minute = (Bit8u)((time >> 5) & 0x003f); Bit8u minute = (Bit8u)((time >> 5) & 0x003f);
/* output the file */
if (optB) {
// this overrides pretty much everything
if (strcmp(".",name) && strcmp("..",name)) {
if ((attr & DOS_ATTR_DIRECTORY)||(strlen(ext)==0)) WriteOut("%s\n",name);
else WriteOut("%s.%s\n",name,ext);
}
} else {
if (attr & DOS_ATTR_DIRECTORY) { if (attr & DOS_ATTR_DIRECTORY) {
if (optW) { if (optW) {
WriteOut("[%s]",name); WriteOut("[%s]",name);
@ -518,12 +517,10 @@ void DOS_Shell::CMD_DIR(char * args) {
if (optW) { if (optW) {
w_count++; w_count++;
} }
if (optP) { }
if (!(++p_count%(22*w_size))) { if (optP && !(++p_count%(22*w_size))) {
CMD_PAUSE(empty_string); CMD_PAUSE(empty_string);
} }
}
}
} while ( (ret=DOS_FindNext()) ); } while ( (ret=DOS_FindNext()) );
if (optW) { if (optW) {
if (w_count%5) WriteOut("\n"); if (w_count%5) WriteOut("\n");

View File

@ -431,7 +431,7 @@ bool DOS_Shell::Execute(char * name,char * args) {
/* delete old batch file if call is not active*/ /* delete old batch file if call is not active*/
bool temp_echo=echo; /*keep the current echostate (as delete bf might change it )*/ bool temp_echo=echo; /*keep the current echostate (as delete bf might change it )*/
if(bf && !call) delete bf; if(bf && !call) delete bf;
bf=new BatchFile(this,fullname,line); bf=new BatchFile(this,fullname,name,line);
echo=temp_echo; //restore it. echo=temp_echo; //restore it.
} }
else else