mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 10:48:18 +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 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
|
||||
|
||||
|
@@ -2272,7 +2272,7 @@ void POD_Load_DOS_Files( std::istream& stream )
|
||||
std::size_t found=str.find(", ");
|
||||
if (found!=std::string::npos)
|
||||
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]) {
|
||||
DOS_EnableDriveMenu('A'+lcv);
|
||||
mem_writeb(Real2Phys(dos.tables.mediaid)+lcv*dos.tables.dpb_size,lalloc.mediaid);
|
||||
|
@@ -1177,7 +1177,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
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") {
|
||||
//Ensure that the base drive exists:
|
||||
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;
|
||||
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)
|
||||
{
|
||||
this->driveLetter = driveLetter;
|
||||
this->mountarc = "";
|
||||
char mp[3] = {'_', driveLetter, 0};
|
||||
char newname[CROSS_LEN+1];
|
||||
strcpy(newname,startdir);
|
||||
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] = '\0';
|
||||
}
|
||||
if (*lastdir && PHYSFS_addToSearchPath(lastdir,true) == 0) {
|
||||
LOG_MSG("PHYSFS couldn't add '%s': %s",lastdir,PHYSFS_getLastError());
|
||||
if (*lastdir) {
|
||||
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;
|
||||
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.sectors_cluster=_sectors_cluster;
|
||||
@@ -2130,14 +2139,7 @@ physfsDrive::~physfsDrive(void) {
|
||||
}
|
||||
|
||||
const char *physfsDrive::GetInfo() {
|
||||
char **files = PHYSFS_getSearchPath(), **list = files;
|
||||
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);
|
||||
sprintf(info,"PhysFS directory %s", mountarc.c_str());
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -2324,6 +2326,8 @@ bool physfsDrive::isRemovable(void) {
|
||||
}
|
||||
|
||||
Bits physfsDrive::UnMount(void) {
|
||||
char mp[3] = {'_', driveLetter, 0};
|
||||
PHYSFS_unmount(mp);
|
||||
delete this;
|
||||
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)
|
||||
: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
|
||||
error = MSCDEX_AddDrive(driveLetter,startdir,subUnit);
|
||||
this->driveLetter = driveLetter;
|
||||
// Get Volume Label
|
||||
char name[32];
|
||||
if (MSCDEX_GetVolumeName(subUnit,name)) dirCache.SetLabel(name,true,true);
|
||||
};
|
||||
|
||||
const char *physfscdromDrive::GetInfo() {
|
||||
char **files = PHYSFS_getSearchPath(), **list = files;
|
||||
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);
|
||||
sprintf(info,"PhysFS CDRom %s", mountarc.c_str());
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@@ -119,9 +119,10 @@ protected:
|
||||
class physfsDrive : public localDrive {
|
||||
private:
|
||||
bool isdir(const char *dir);
|
||||
char driveLetter;
|
||||
|
||||
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 FileCreate(DOS_File * * file,const char * name,uint16_t attributes);
|
||||
virtual bool FileUnlink(const char * name);
|
||||
@@ -151,6 +152,9 @@ public:
|
||||
virtual const char *GetInfo(void);
|
||||
Bits UnMount();
|
||||
virtual ~physfsDrive(void);
|
||||
|
||||
protected:
|
||||
std::string mountarc;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -3256,6 +3256,12 @@ void setVGADAC() {
|
||||
|
||||
bool setColors(const char *colorArray, int n) {
|
||||
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;
|
||||
uint8_t * altPtr = (uint8_t *)altBGR1;
|
||||
int rgbVal[3] = {-1,-1,-1};
|
||||
|
@@ -1253,7 +1253,15 @@ static void MY_FAST_CALL CrcGenerateTable()
|
||||
#endif
|
||||
}
|
||||
else if (p[0] != 1 || p[1] != 2)
|
||||
#if CRC_NUM_TABLES < 4
|
||||
g_CrcUpdate = CrcUpdateT1;
|
||||
#else
|
||||
g_CrcUpdate = CrcUpdateT4;
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
if (!CPU_Is_InOrder())
|
||||
g_CrcUpdate = CrcUpdateT8;
|
||||
#endif
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
{
|
||||
|
Reference in New Issue
Block a user