mirror of
https://github.com/retro100/dosbox-wii.git
synced 2024-12-25 18:11:50 +01:00
sync with dosbox svn
This commit is contained in:
parent
5b8f46ee24
commit
f23c2ea048
@ -344,8 +344,10 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
|
||||
|
||||
AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
|
||||
#define GCC_UNLIKELY(x) __builtin_expect((x),0)
|
||||
#define GCC_LIKELY(x) __builtin_expect((x),1)
|
||||
#else
|
||||
#define GCC_UNLIKELY(x) (x)
|
||||
#define GCC_LIKELY(x) (x)
|
||||
#endif])
|
||||
|
||||
AH_BOTTOM([
|
||||
|
@ -44,7 +44,7 @@ class DOS_Shell;
|
||||
|
||||
class BatchFile {
|
||||
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 bool ReadLine(char * line);
|
||||
bool Goto(char * where);
|
||||
|
@ -53,7 +53,7 @@ CPUBlock cpu;
|
||||
Segments Segs;
|
||||
|
||||
Bit32s CPU_Cycles = 0;
|
||||
Bit32s CPU_CycleLeft = 0;
|
||||
Bit32s CPU_CycleLeft = 3000;
|
||||
Bit32s CPU_CycleMax = 3000;
|
||||
Bit32s CPU_OldCycleMax = 3000;
|
||||
Bit32s CPU_CyclePercUsed = 100;
|
||||
@ -2226,7 +2226,7 @@ public:
|
||||
bool Change_Config(Section* newconfig){
|
||||
Section_prop * section=static_cast<Section_prop *>(newconfig);
|
||||
CPU_AutoDetermineMode=CPU_AUTODETERMINE_NONE;
|
||||
CPU_CycleLeft=0;//needed ?
|
||||
//CPU_CycleLeft=0;//needed ?
|
||||
CPU_Cycles=0;
|
||||
CPU_SkipCycleAutoAdjust=false;
|
||||
|
||||
|
@ -816,7 +816,11 @@ static Bitu DOS_21Handler(void) {
|
||||
break;
|
||||
case 0x59: /* Get Extended error information */
|
||||
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_ch=0; //Unkown error locus
|
||||
break;
|
||||
|
@ -68,7 +68,8 @@ static void cmos_checktimer(void) {
|
||||
LOG(LOG_PIT,LOG_NORMAL)("RTC Timer at %.2f hz",1000.0/cmos.timer.delay);
|
||||
// PIC_AddEvent(cmos_timerevent,cmos.timer.delay);
|
||||
/* 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)
|
||||
}
|
||||
|
||||
|
@ -401,9 +401,9 @@ Bits Operator::TemplateVolume( ) {
|
||||
break;
|
||||
case DECAY:
|
||||
vol += RateForward( decayAdd );
|
||||
if ( vol >= sustainLevel ) {
|
||||
if ( GCC_UNLIKELY(vol >= sustainLevel) ) {
|
||||
//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;
|
||||
SetState( OFF );
|
||||
return ENV_MAX;
|
||||
@ -420,7 +420,7 @@ Bits Operator::TemplateVolume( ) {
|
||||
//In sustain phase, but not sustaining, do regular release
|
||||
case RELEASE:
|
||||
vol += RateForward( releaseAdd );;
|
||||
if ( vol >= ENV_MAX ) {
|
||||
if ( GCC_UNLIKELY(vol >= ENV_MAX) ) {
|
||||
volume = ENV_MAX;
|
||||
SetState( OFF );
|
||||
return ENV_MAX;
|
||||
@ -1260,7 +1260,7 @@ void Chip::Setup( Bit32u rate ) {
|
||||
count += guessAdd;
|
||||
Bit32s change = count >> RATE_SH;
|
||||
count &= RATE_MASK;
|
||||
if ( change ) {
|
||||
if ( GCC_UNLIKELY(change) ) { // less than 1 %
|
||||
volume += ( ~volume * change ) >> 3;
|
||||
}
|
||||
samples++;
|
||||
@ -1496,7 +1496,7 @@ void Handler::WriteReg( Bit32u addr, Bit8u val ) {
|
||||
|
||||
void Handler::Generate( MixerChannel* chan, Bitu samples ) {
|
||||
Bit32s buffer[ 512 * 2 ];
|
||||
if ( samples > 512 )
|
||||
if ( GCC_UNLIKELY(samples > 512) )
|
||||
samples = 512;
|
||||
if ( !chip.opl3Active ) {
|
||||
chip.GenerateBlock2( samples, buffer );
|
||||
|
@ -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
|
||||
};
|
||||
// calculated frequency multiplication values (depend on sampling rate)
|
||||
static float frqmul[16];
|
||||
static fltype frqmul[16];
|
||||
|
||||
// key scale levels
|
||||
static Bit8u kslev[8][16];
|
||||
|
@ -357,9 +357,10 @@ void FinishSetMode_ET4K(Bitu crtc_base, VGA_ModeExtraData* modeData) {
|
||||
Bitu best = 1;
|
||||
Bits dist = 100000000;
|
||||
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;
|
||||
dist = abs(target-et4k.clockFreq[i]);
|
||||
dist = cdiff;
|
||||
}
|
||||
}
|
||||
set_clock_index_et4k(best);
|
||||
@ -718,9 +719,10 @@ void FinishSetMode_ET3K(Bitu crtc_base, VGA_ModeExtraData* modeData) {
|
||||
Bitu best = 1;
|
||||
Bits dist = 100000000;
|
||||
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;
|
||||
dist = abs(target-et3k.clockFreq[i]);
|
||||
dist = cdiff;
|
||||
}
|
||||
}
|
||||
set_clock_index_et3k(best);
|
||||
|
@ -286,6 +286,8 @@ void DOS_Shell::Run(void) {
|
||||
std::string line;
|
||||
if (cmd->FindStringRemain("/C",line)) {
|
||||
strcpy(input_line,line.c_str());
|
||||
char* sep = strpbrk(input_line,"\r\n"); //GTA installer
|
||||
if (sep) *sep = 0;
|
||||
DOS_Shell temp;
|
||||
temp.echo = echo;
|
||||
temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal;
|
||||
|
@ -24,14 +24,14 @@
|
||||
#include "shell.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;
|
||||
prev=host->bf;
|
||||
echo=host->echo;
|
||||
shell=host;
|
||||
char totalname[DOS_PATHLENGTH+4];
|
||||
DOS_Canonicalize(name,totalname); // Get fullname including drive specificiation
|
||||
cmd = new CommandLine(totalname,cmd_line);
|
||||
DOS_Canonicalize(resolved_name,totalname); // Get fullname including drive specificiation
|
||||
cmd = new CommandLine(entered_name,cmd_line);
|
||||
filename = totalname;
|
||||
|
||||
//Test if file is openable
|
||||
|
@ -474,26 +474,25 @@ void DOS_Shell::CMD_DIR(char * args) {
|
||||
/* Skip non-directories if option AD is present */
|
||||
if(optAD && !(attr&DOS_ATTR_DIRECTORY) ) continue;
|
||||
|
||||
char * ext = empty_string;
|
||||
if (!optW && (name[0] != '.')) {
|
||||
ext = strrchr(name, '.');
|
||||
if (!ext) ext = empty_string;
|
||||
else *ext++ = 0;
|
||||
}
|
||||
Bit8u day = (Bit8u)(date & 0x001f);
|
||||
Bit8u month = (Bit8u)((date >> 5) & 0x000f);
|
||||
Bit16u year = (Bit16u)((date >> 9) + 1980);
|
||||
Bit8u hour = (Bit8u)((time >> 5 ) >> 6);
|
||||
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);
|
||||
WriteOut("%s\n",name);
|
||||
}
|
||||
} else {
|
||||
char * ext = empty_string;
|
||||
if (!optW && (name[0] != '.')) {
|
||||
ext = strrchr(name, '.');
|
||||
if (!ext) ext = empty_string;
|
||||
else *ext++ = 0;
|
||||
}
|
||||
Bit8u day = (Bit8u)(date & 0x001f);
|
||||
Bit8u month = (Bit8u)((date >> 5) & 0x000f);
|
||||
Bit16u year = (Bit16u)((date >> 9) + 1980);
|
||||
Bit8u hour = (Bit8u)((time >> 5 ) >> 6);
|
||||
Bit8u minute = (Bit8u)((time >> 5) & 0x003f);
|
||||
|
||||
if (attr & DOS_ATTR_DIRECTORY) {
|
||||
if (optW) {
|
||||
WriteOut("[%s]",name);
|
||||
@ -518,11 +517,9 @@ void DOS_Shell::CMD_DIR(char * args) {
|
||||
if (optW) {
|
||||
w_count++;
|
||||
}
|
||||
if (optP) {
|
||||
if (!(++p_count%(22*w_size))) {
|
||||
CMD_PAUSE(empty_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (optP && !(++p_count%(22*w_size))) {
|
||||
CMD_PAUSE(empty_string);
|
||||
}
|
||||
} while ( (ret=DOS_FindNext()) );
|
||||
if (optW) {
|
||||
|
@ -431,7 +431,7 @@ bool DOS_Shell::Execute(char * name,char * args) {
|
||||
/* delete old batch file if call is not active*/
|
||||
bool temp_echo=echo; /*keep the current echostate (as delete bf might change it )*/
|
||||
if(bf && !call) delete bf;
|
||||
bf=new BatchFile(this,fullname,line);
|
||||
bf=new BatchFile(this,fullname,name,line);
|
||||
echo=temp_echo; //restore it.
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user