mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-16 22:38:52 +08:00
Fix physfs etc
This commit is contained in:
@@ -59,9 +59,11 @@ Although based on the DOSBox project, DOSBox-X is now a separate project because
|
|||||||
|
|
||||||
* Support for long filenames and FAT32 disk images (DOS 7+ features)
|
* Support for long filenames and FAT32 disk images (DOS 7+ features)
|
||||||
|
|
||||||
* Support for printer output, either a real or virtual printer
|
* Support for TrueType font (TTF) output for text-mode DOS programs
|
||||||
|
|
||||||
* Support for 3dfx Voodoo chip and Glide emulation
|
* Support for printing features, either to a real or to a virtual printer
|
||||||
|
|
||||||
|
* Support for 3dfx Voodoo chip and Glide emulation (including Glide wrapper)
|
||||||
|
|
||||||
* Support for cue sheets with FLAC, MP3, WAV, OGG Vorbis and Opus CD-DA tracks
|
* Support for cue sheets with FLAC, MP3, WAV, OGG Vorbis and Opus CD-DA tracks
|
||||||
|
|
||||||
|
@@ -2272,7 +2272,7 @@ void POD_Load_DOS_Files( std::istream& stream )
|
|||||||
std::size_t found=str.find(", ");
|
std::size_t found=str.find(", ");
|
||||||
if (found!=std::string::npos)
|
if (found!=std::string::npos)
|
||||||
str=str.substr(0,found);
|
str=str.substr(0,found);
|
||||||
Drives[lcv]=new physfsDrive((":"+str+"\\").c_str(),lalloc.bytes_sector,lalloc.sectors_cluster,lalloc.total_clusters,lalloc.free_clusters,lalloc.mediaid,options);
|
Drives[lcv]=new physfsDrive('A'+lcv,(":"+str+"\\").c_str(),lalloc.bytes_sector,lalloc.sectors_cluster,lalloc.total_clusters,lalloc.free_clusters,lalloc.mediaid,options);
|
||||||
if (Drives[lcv]) {
|
if (Drives[lcv]) {
|
||||||
DOS_EnableDriveMenu('A'+lcv);
|
DOS_EnableDriveMenu('A'+lcv);
|
||||||
mem_writeb(Real2Phys(dos.tables.mediaid)+lcv*dos.tables.dpb_size,lalloc.mediaid);
|
mem_writeb(Real2Phys(dos.tables.mediaid)+lcv*dos.tables.dpb_size,lalloc.mediaid);
|
||||||
|
@@ -1177,7 +1177,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (is_physfs) {
|
if (is_physfs) {
|
||||||
newdrive=new physfsDrive(temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid,options);
|
newdrive=new physfsDrive(drive,temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid,options);
|
||||||
} else if(type == "overlay") {
|
} else if(type == "overlay") {
|
||||||
//Ensure that the base drive exists:
|
//Ensure that the base drive exists:
|
||||||
if (!Drives[drive-'A']) {
|
if (!Drives[drive-'A']) {
|
||||||
|
@@ -2076,9 +2076,12 @@ bool physfsDrive::read_directory_next(void* dirp, char* entry_name, char* entry_
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t physfs_used = 0;
|
static uint8_t physfs_used = 0;
|
||||||
physfsDrive::physfsDrive(const char * startdir,uint16_t _bytes_sector,uint8_t _sectors_cluster,uint16_t _total_clusters,uint16_t _free_clusters,uint8_t _mediaid, std::vector<std::string> &options)
|
physfsDrive::physfsDrive(const char driveLetter, const char * startdir,uint16_t _bytes_sector,uint8_t _sectors_cluster,uint16_t _total_clusters,uint16_t _free_clusters,uint8_t _mediaid, std::vector<std::string> &options)
|
||||||
:localDrive(startdir,_bytes_sector,_sectors_cluster,_total_clusters,_free_clusters,_mediaid,options)
|
:localDrive(startdir,_bytes_sector,_sectors_cluster,_total_clusters,_free_clusters,_mediaid,options)
|
||||||
{
|
{
|
||||||
|
this->driveLetter = driveLetter;
|
||||||
|
this->mountarc = "";
|
||||||
|
char mp[3] = {'_', driveLetter, 0};
|
||||||
char newname[CROSS_LEN+1];
|
char newname[CROSS_LEN+1];
|
||||||
strcpy(newname,startdir);
|
strcpy(newname,startdir);
|
||||||
CROSS_FILENAME(newname);
|
CROSS_FILENAME(newname);
|
||||||
@@ -2100,13 +2103,19 @@ physfsDrive::physfsDrive(const char * startdir,uint16_t _bytes_sector,uint8_t _s
|
|||||||
dir[tmp++] = CROSS_FILESPLIT;
|
dir[tmp++] = CROSS_FILESPLIT;
|
||||||
dir[tmp] = '\0';
|
dir[tmp] = '\0';
|
||||||
}
|
}
|
||||||
if (*lastdir && PHYSFS_addToSearchPath(lastdir,true) == 0) {
|
if (*lastdir) {
|
||||||
LOG_MSG("PHYSFS couldn't add '%s': %s",lastdir,PHYSFS_getLastError());
|
if (PHYSFS_mount(lastdir,mp,true) == 0)
|
||||||
|
LOG_MSG("PHYSFS couldn't mount '%s': %s",lastdir,PHYSFS_getLastError());
|
||||||
|
else {
|
||||||
|
if (mountarc.size()) mountarc+=", ";
|
||||||
|
mountarc+= lastdir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastdir = dir;
|
lastdir = dir;
|
||||||
dir = strchr(lastdir+(((lastdir[0]|0x20) >= 'a' && (lastdir[0]|0x20) <= 'z')?2:0),':');
|
dir = strchr(lastdir+(((lastdir[0]|0x20) >= 'a' && (lastdir[0]|0x20) <= 'z')?2:0),':');
|
||||||
}
|
}
|
||||||
strcpy(basedir,lastdir);
|
strcpy(basedir,"\\");
|
||||||
|
strcat(basedir,mp);
|
||||||
|
|
||||||
allocation.bytes_sector=_bytes_sector;
|
allocation.bytes_sector=_bytes_sector;
|
||||||
allocation.sectors_cluster=_sectors_cluster;
|
allocation.sectors_cluster=_sectors_cluster;
|
||||||
@@ -2130,14 +2139,7 @@ physfsDrive::~physfsDrive(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *physfsDrive::GetInfo() {
|
const char *physfsDrive::GetInfo() {
|
||||||
char **files = PHYSFS_getSearchPath(), **list = files;
|
sprintf(info,"PhysFS directory %s", mountarc.c_str());
|
||||||
sprintf(info,"PhysFS directory ");
|
|
||||||
while (*files != NULL) {
|
|
||||||
strcat(info,*files++);
|
|
||||||
strcat(info,", ");
|
|
||||||
}
|
|
||||||
if (info[strlen(info)-1]==' '&&info[strlen(info)-2]==',') info[strlen(info)-2]=0;
|
|
||||||
PHYSFS_freeList(list);
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2324,6 +2326,8 @@ bool physfsDrive::isRemovable(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bits physfsDrive::UnMount(void) {
|
Bits physfsDrive::UnMount(void) {
|
||||||
|
char mp[3] = {'_', driveLetter, 0};
|
||||||
|
PHYSFS_unmount(mp);
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2420,24 +2424,18 @@ bool physfsFile::UpdateDateTimeFromHost(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
physfscdromDrive::physfscdromDrive(const char driveLetter, const char * startdir,uint16_t _bytes_sector,uint8_t _sectors_cluster,uint16_t _total_clusters,uint16_t _free_clusters,uint8_t _mediaid, int& error, std::vector<std::string> &options)
|
physfscdromDrive::physfscdromDrive(const char driveLetter, const char * startdir,uint16_t _bytes_sector,uint8_t _sectors_cluster,uint16_t _total_clusters,uint16_t _free_clusters,uint8_t _mediaid, int& error, std::vector<std::string> &options)
|
||||||
:physfsDrive(startdir,_bytes_sector,_sectors_cluster,_total_clusters,_free_clusters,_mediaid,options)
|
:physfsDrive(driveLetter,startdir,_bytes_sector,_sectors_cluster,_total_clusters,_free_clusters,_mediaid,options)
|
||||||
{
|
{
|
||||||
// Init mscdex
|
// Init mscdex
|
||||||
error = MSCDEX_AddDrive(driveLetter,startdir,subUnit);
|
error = MSCDEX_AddDrive(driveLetter,startdir,subUnit);
|
||||||
|
this->driveLetter = driveLetter;
|
||||||
// Get Volume Label
|
// Get Volume Label
|
||||||
char name[32];
|
char name[32];
|
||||||
if (MSCDEX_GetVolumeName(subUnit,name)) dirCache.SetLabel(name,true,true);
|
if (MSCDEX_GetVolumeName(subUnit,name)) dirCache.SetLabel(name,true,true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *physfscdromDrive::GetInfo() {
|
const char *physfscdromDrive::GetInfo() {
|
||||||
char **files = PHYSFS_getSearchPath(), **list = files;
|
sprintf(info,"PhysFS CDRom %s", mountarc.c_str());
|
||||||
sprintf(info,"PhysFS CDRom ");
|
|
||||||
while (*files != NULL) {
|
|
||||||
strcat(info,*files++);
|
|
||||||
strcat(info,", ");
|
|
||||||
}
|
|
||||||
if (info[strlen(info)-1]==' '&&info[strlen(info)-2]==',') info[strlen(info)-1]=info[strlen(info)-2]=0;
|
|
||||||
PHYSFS_freeList(list);
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,9 +119,10 @@ protected:
|
|||||||
class physfsDrive : public localDrive {
|
class physfsDrive : public localDrive {
|
||||||
private:
|
private:
|
||||||
bool isdir(const char *dir);
|
bool isdir(const char *dir);
|
||||||
|
char driveLetter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
physfsDrive(const char * startdir,uint16_t _bytes_sector,uint8_t _sectors_cluster,uint16_t _total_clusters,uint16_t _free_clusters,uint8_t _mediaid, std::vector<std::string> &options);
|
physfsDrive(const char driveLetter, const char * startdir,uint16_t _bytes_sector,uint8_t _sectors_cluster,uint16_t _total_clusters,uint16_t _free_clusters,uint8_t _mediaid, std::vector<std::string> &options);
|
||||||
virtual bool FileOpen(DOS_File * * file,const char * name,uint32_t flags);
|
virtual bool FileOpen(DOS_File * * file,const char * name,uint32_t flags);
|
||||||
virtual bool FileCreate(DOS_File * * file,const char * name,uint16_t attributes);
|
virtual bool FileCreate(DOS_File * * file,const char * name,uint16_t attributes);
|
||||||
virtual bool FileUnlink(const char * name);
|
virtual bool FileUnlink(const char * name);
|
||||||
@@ -151,6 +152,9 @@ public:
|
|||||||
virtual const char *GetInfo(void);
|
virtual const char *GetInfo(void);
|
||||||
Bits UnMount();
|
Bits UnMount();
|
||||||
virtual ~physfsDrive(void);
|
virtual ~physfsDrive(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string mountarc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@@ -3256,6 +3256,12 @@ void setVGADAC() {
|
|||||||
|
|
||||||
bool setColors(const char *colorArray, int n) {
|
bool setColors(const char *colorArray, int n) {
|
||||||
if (IS_PC98_ARCH) return false;
|
if (IS_PC98_ARCH) return false;
|
||||||
|
if (!colorChanged)
|
||||||
|
for (uint8_t i = 0; i < 0x10; i++) {
|
||||||
|
altBGR1[i].red=rgbColors[i].red;
|
||||||
|
altBGR1[i].green=rgbColors[i].green;
|
||||||
|
altBGR1[i].blue=rgbColors[i].blue;
|
||||||
|
}
|
||||||
const char * nextRGB = colorArray;
|
const char * nextRGB = colorArray;
|
||||||
uint8_t * altPtr = (uint8_t *)altBGR1;
|
uint8_t * altPtr = (uint8_t *)altBGR1;
|
||||||
int rgbVal[3] = {-1,-1,-1};
|
int rgbVal[3] = {-1,-1,-1};
|
||||||
|
@@ -1253,7 +1253,15 @@ static void MY_FAST_CALL CrcGenerateTable()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (p[0] != 1 || p[1] != 2)
|
else if (p[0] != 1 || p[1] != 2)
|
||||||
|
#if CRC_NUM_TABLES < 4
|
||||||
g_CrcUpdate = CrcUpdateT1;
|
g_CrcUpdate = CrcUpdateT1;
|
||||||
|
#else
|
||||||
|
g_CrcUpdate = CrcUpdateT4;
|
||||||
|
#ifdef MY_CPU_X86_OR_AMD64
|
||||||
|
if (!CPU_Is_InOrder())
|
||||||
|
g_CrcUpdate = CrcUpdateT8;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user