sync to latest dosbox svn

This commit is contained in:
dborth 2010-12-06 02:42:22 +00:00
parent 0264ef8901
commit 5de3ed53ac
8 changed files with 73 additions and 17 deletions

View File

@ -346,15 +346,21 @@ void CDROM_Interface_Image::CDAudioCallBack(Bitu len)
Bit16s sample0,sample1;
Bit16s * samples=(Bit16s *)&player.buffer;
for (Bitu pos=0;pos<len/4;pos++) {
#if defined(WORDS_BIGENDIAN)
sample0=(Bit16s)host_readw((HostPt)&samples[pos*2+player.ctrlData.out[0]]);
sample1=(Bit16s)host_readw((HostPt)&samples[pos*2+player.ctrlData.out[1]]);
#else
sample0=samples[pos*2+player.ctrlData.out[0]];
sample1=samples[pos*2+player.ctrlData.out[1]];
#endif
samples[pos*2+0]=(Bit16s)(sample0*player.ctrlData.vol[0]/255.0);
samples[pos*2+1]=(Bit16s)(sample1*player.ctrlData.vol[1]/255.0);
}
}
#if defined(WORDS_BIGENDIAN)
player.channel->AddSamples_s16_nonnative(len/4,(Bit16s *)player.buffer);
player.channel->AddSamples_s16(len/4,(Bit16s *)player.buffer);
} else player.channel->AddSamples_s16_nonnative(len/4,(Bit16s *)player.buffer);
#else
}
player.channel->AddSamples_s16(len/4,(Bit16s *)player.buffer);
#endif
memmove(player.buffer, &player.buffer[len], player.bufLen - len);

View File

@ -362,6 +362,7 @@ static Bitu DOS_21Handler(void) {
break;
case 0x26: /* Create new PSP */
DOS_NewPSP(reg_dx,DOS_PSP(dos.psp()).GetSize());
reg_al=0xf0; /* al destroyed */
break;
case 0x2a: /* Get System Date */
{
@ -523,6 +524,7 @@ static Bitu DOS_21Handler(void) {
case 0x39: /* MKDIR Create directory */
MEM_StrCopy(SegPhys(ds)+reg_dx,name1,DOSNAMEBUF);
if (DOS_MakeDir(name1)) {
reg_ax=0x05; /* ax destroyed */
CALLBACK_SCF(false);
} else {
reg_ax=dos.errorcode;
@ -532,6 +534,7 @@ static Bitu DOS_21Handler(void) {
case 0x3a: /* RMDIR Remove directory */
MEM_StrCopy(SegPhys(ds)+reg_dx,name1,DOSNAMEBUF);
if (DOS_RemoveDir(name1)) {
reg_ax=0x05; /* ax destroyed */
CALLBACK_SCF(false);
} else {
reg_ax=dos.errorcode;
@ -542,6 +545,7 @@ static Bitu DOS_21Handler(void) {
case 0x3b: /* CHDIR Set current directory */
MEM_StrCopy(SegPhys(ds)+reg_dx,name1,DOSNAMEBUF);
if (DOS_ChangeDir(name1)) {
reg_ax=0x00; /* ax destroyed */
CALLBACK_SCF(false);
} else {
reg_ax=dos.errorcode;
@ -568,6 +572,7 @@ static Bitu DOS_21Handler(void) {
break;
case 0x3e: /* CLOSE Close file */
if (DOS_CloseFile(reg_bx)) {
// reg_al=0x01; /* al destroyed. Refcount */
CALLBACK_SCF(false);
} else {
reg_ax=dos.errorcode;
@ -789,6 +794,7 @@ static Bitu DOS_21Handler(void) {
case 0x55: /* Create Child PSP*/
DOS_ChildPSP(reg_dx,reg_si);
dos.psp(reg_dx);
reg_al=0xf0; /* al destroyed */
break;
case 0x56: /* RENAME Rename file */
MEM_StrCopy(SegPhys(ds)+reg_dx,name1,DOSNAMEBUF);

View File

@ -206,11 +206,15 @@ bool DOS_ChangeDir(char const * const dir) {
const char * testdir=dir;
if (strlen(testdir) && testdir[1]==':') testdir+=2;
size_t len=strlen(testdir);
if (!len || (len>1 && testdir[len-1]=='\\')) {
if (!len) {
DOS_SetError(DOSERR_PATH_NOT_FOUND);
return false;
}
if (!DOS_MakeName(dir,fulldir,&drive)) return false;
if (strlen(fulldir) && testdir[len-1]=='\\') {
DOS_SetError(DOSERR_PATH_NOT_FOUND);
return false;
}
if (Drives[drive]->TestDir(fulldir)) {
strcpy(Drives[drive]->curdir,fulldir);
@ -1166,9 +1170,29 @@ bool DOS_FCBDeleteFile(Bit16u seg,Bit16u offset){
bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset){
DOS_FCB fcbold(seg,offset);
DOS_FCB fcbnew(seg,offset+16);
if(!fcbold.Valid()) return false;
char oldname[DOS_FCBNAME];
char newname[DOS_FCBNAME];
fcbold.GetName(oldname);fcbnew.GetName(newname);
/* Check, if sourcefile is still open. This was possible in DOS, but modern oses don't like this */
Bit8u drive; char fullname[DOS_PATHLENGTH];
if (!DOS_MakeName(oldname,fullname,&drive)) return false;
DOS_PSP psp(dos.psp());
for (Bit8u i=0;i<DOS_FILES;i++) {
if (Files[i] && Files[i]->IsOpen() && Files[i]->IsName(fullname)) {
Bit16u handle = psp.FindEntryByHandle(i);
if (handle == 0xFF) {
// This shouldnt happen
LOG(LOG_FILES,LOG_ERROR)("DOS: File %s is opened but has no psp entry.",oldname);
return false;
}
DOS_CloseFile(handle);
}
}
/* Rename the file */
return DOS_Rename(oldname,newname);
}

View File

@ -394,9 +394,9 @@ bool localDrive::FileExists(const char* name) {
strcat(newname,name);
CROSS_FILENAME(newname);
dirCache.ExpandName(newname);
FILE* Temp=fopen(newname,"rb");
if(Temp==NULL) return false;
fclose(Temp);
struct stat temp_stat;
if(stat(newname,&temp_stat)!=0) return false;
if(temp_stat.st_mode & S_IFDIR) return false;
return true;
}

View File

@ -1090,11 +1090,16 @@ static void CTMIXER_UpdateVolumes(void) {
chan=MIXER_FindChannel("FM");
if (chan) chan->SetVolume(float(sb.mixer.master[0])/31.0f*CALCVOL(sb.mixer.fm[0]),
float(sb.mixer.master[1])/31.0f*CALCVOL(sb.mixer.fm[1]));
chan=MIXER_FindChannel("CDAUDIO");
if (chan) chan->SetVolume(float(sb.mixer.master[0])/31.0f*CALCVOL(sb.mixer.cda[0]),
float(sb.mixer.master[1])/31.0f*CALCVOL(sb.mixer.cda[1]));
}
static void CTMIXER_Reset(void) {
sb.mixer.fm[0]=
sb.mixer.fm[1]=
sb.mixer.cda[0]=
sb.mixer.cda[1]=
sb.mixer.dac[0]=
sb.mixer.dac[1]=31;
sb.mixer.master[0]=
@ -1211,10 +1216,16 @@ static void CTMIXER_Write(Bit8u val) {
}
break;
case 0x36: /* CD Volume Left (SB16) */
if (sb.type==SBT_16) sb.mixer.cda[0]=val>>3;
if (sb.type==SBT_16) {
sb.mixer.cda[0]=val>>3;
CTMIXER_UpdateVolumes();
}
break;
case 0x37: /* CD Volume Right (SB16) */
if (sb.type==SBT_16) sb.mixer.cda[1]=val>>3;
if (sb.type==SBT_16) {
sb.mixer.cda[1]=val>>3;
CTMIXER_UpdateVolumes();
}
break;
case 0x38: /* Line-in Volume Left (SB16) */
if (sb.type==SBT_16) sb.mixer.lin[0]=val>>3;

View File

@ -302,10 +302,14 @@ void vga_write_p3d5(Bitu port,Bitu val,Bitu iolen) {
*/
break;
case 0x16: /* End Vertical Blank Register */
crtc(end_vertical_blanking)=val;
/*
if (val!=crtc(end_vertical_blanking)) {
crtc(end_vertical_blanking)=val;
VGA_StartResize();
}
/*
0-6 Vertical blanking stops when the lower 7 bits of the line counter
equals this field. Some SVGA chips uses all 8 bits!
IBM actually says bits 0-7.
*/
break;
case 0x17: /* Mode Control Register */

View File

@ -1092,7 +1092,6 @@ void VGA_SetupDrawing(Bitu /*val*/) {
vtotal += 2;
hdend += 1;
vdend += 1;
vbstart += 1;
hbend = hbstart + ((hbend - hbstart) & 0x3F);
hrend = vga.crtc.end_horizontal_retrace & 0x1f;
@ -1107,10 +1106,16 @@ void VGA_SetupDrawing(Bitu /*val*/) {
if ( !vrend) vrend = vrstart + 0xf + 1;
else vrend = vrstart + vrend;
vbend = (vbend - vbstart) & 0x7f;
if ( !vbend) vbend = vbstart + 0x7f + 1;
else vbend = vbstart + vbend;
// Special case vbstart==0:
// Most graphics cards agree that lines zero to vbend are
// blanked. ET4000 doesn't blank at all if vbstart==vbend.
// ET3000 blanks lines 1 to vbend (255/6 lines).
if (vbstart != 0) {
vbstart += 1;
vbend = (vbend - vbstart) & 0x7f;
if ( !vbend) vbend = vbstart + 0x7f + 1;
else vbend = vbstart + vbend;
}
vbend++;
if (svga.get_clock) {
@ -1219,7 +1224,7 @@ void VGA_SetupDrawing(Bitu /*val*/) {
vdend = vbstart;
}
LOG(LOG_VGA,LOG_WARN)("Blanking wrap to line %d", vblank_skip);
} else if (vbstart==1) {
} else if (vbstart<=1) {
// blanking is used to cut lines at the start of the screen
vblank_skip = vbend;
LOG(LOG_VGA,LOG_WARN)("Upper %d lines of the screen blanked", vblank_skip);

View File

@ -108,7 +108,7 @@ bool DOS_Shell::CheckConfig(char* cmd_in,char*line) {
if(val != NO_SUCH_PROPERTY) WriteOut("%s\n",val.c_str());
return true;
}
char newcom[1024]; newcom[0] = 0; strcpy(newcom,"z:\\config ");
char newcom[1024]; newcom[0] = 0; strcpy(newcom,"z:\\config -set ");
strcat(newcom,test->GetName()); strcat(newcom," ");
strcat(newcom,cmd_in);strcat(newcom,line);
DoCommand(newcom);