Merge branch 'svn/trunk'
This commit is contained in:
commit
79fe83ede6
6 changed files with 35 additions and 22 deletions
|
@ -243,7 +243,7 @@ void DOS_Drive_Cache::AddEntryDirOverlay(const char* path, bool checkExists) {
|
|||
#if defined (WIN32)
|
||||
//OS2 ?
|
||||
if (post > dironly && *(post - 1) == ':' && (post - dironly) == 2)
|
||||
post++; //move away from X: as need to end up with x:\
|
||||
post++; //move away from X: as need to end up with x:\ .
|
||||
#else
|
||||
//Lets hope this is not really used.. (root folder specified as overlay)
|
||||
if (post == dironly)
|
||||
|
|
|
@ -144,6 +144,10 @@ bool Overlay_Drive::MakeDir(char * dir) {
|
|||
#endif
|
||||
/* Overlay: Create in Overlay only and add it to drive_cache + some entries else the drive_cache will try to access it. Needs an AddEntry for directories. */
|
||||
|
||||
//Check if leading dir is marked as deleted.
|
||||
if (check_if_leading_is_deleted(dir)) return false;
|
||||
|
||||
//Check if directory itself is marked as deleted
|
||||
if (is_deleted_path(dir) && localDrive::TestDir(dir)) {
|
||||
//Was deleted before and exists (last one is safety check)
|
||||
remove_deleted_path(dir,true);
|
||||
|
@ -453,10 +457,12 @@ bool Overlay_Drive::FileOpen(DOS_File * * file,char * name,Bit32u flags) {
|
|||
|
||||
|
||||
bool Overlay_Drive::FileCreate(DOS_File * * file,char * name,Bit16u /*attributes*/) {
|
||||
|
||||
//TODO Check if it exists in the dirCache ? // fix addentry ? or just double check (ld and overlay)
|
||||
//AddEntry looks sound to me..
|
||||
|
||||
//check if leading part of filename is a deleted directory
|
||||
if (check_if_leading_is_deleted(name)) return false;
|
||||
|
||||
FILE* f = create_file_in_overlay(name,"wb+");
|
||||
if(!f) {
|
||||
if (logoverlay) LOG_MSG("File creation in overlay system failed %s",name);
|
||||
|
@ -752,9 +758,8 @@ again:
|
|||
char relativename[CROSS_LEN];
|
||||
strcpy(relativename,srchInfo[id].srch_dir);
|
||||
//strip off basedir: //TODO cleanup
|
||||
char* prel = relativename+strlen(basedir);
|
||||
strcpy(ovname,overlaydir);
|
||||
prel =full_name+strlen(basedir);
|
||||
char* prel = full_name + strlen(basedir);
|
||||
|
||||
|
||||
|
||||
|
@ -767,7 +772,7 @@ again:
|
|||
}
|
||||
#endif
|
||||
|
||||
strcat(ovname,full_name+strlen(basedir));
|
||||
strcat(ovname,prel);
|
||||
bool statok = ( stat(ovname,&stat_block)==0);
|
||||
|
||||
if (logoverlay) LOG_MSG("listing %s",dir_entcopy);
|
||||
|
@ -940,8 +945,8 @@ void Overlay_Drive::add_special_file_to_disk(const char* dosname, const char* op
|
|||
char buf[5] = {'e','m','p','t','y'};
|
||||
fwrite(buf,5,1,f);
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
|
||||
void Overlay_Drive::remove_special_file_from_disk(const char* dosname, const char* operation) {
|
||||
std::string name = create_filename_of_special_operation(dosname,operation);
|
||||
char overlayname[CROSS_LEN];
|
||||
|
@ -952,15 +957,12 @@ void Overlay_Drive::remove_special_file_from_disk(const char* dosname, const cha
|
|||
}
|
||||
|
||||
std::string Overlay_Drive::create_filename_of_special_operation(const char* dosname, const char* operation) {
|
||||
|
||||
std::string res(dosname);
|
||||
std::string::size_type s = res.rfind("\\"); //CHECK DOS or host endings.... on update_cache
|
||||
if (s == std::string::npos) s = 0; else s++;
|
||||
std::string oper = special_prefix +"_" +operation +"_";
|
||||
res.insert(s,oper);
|
||||
return res;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1029,7 +1031,7 @@ bool Overlay_Drive::is_deleted_path(const char* name) {
|
|||
if (namelen < blockedlen) continue;
|
||||
//See if input starts with name.
|
||||
std::string::size_type n = sname.find(*it);
|
||||
if (n == 0 && (namelen == blockedlen) || *(name+blockedlen) =='\\' ) return true;
|
||||
if (n == 0 && ((namelen == blockedlen) || *(name+blockedlen) =='\\' )) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1044,6 +1046,16 @@ void Overlay_Drive::remove_deleted_path(const char* name, bool create_on_disk) {
|
|||
}
|
||||
}
|
||||
}
|
||||
bool Overlay_Drive::check_if_leading_is_deleted(const char* name){
|
||||
const char* dname = strrchr(name,'\\');
|
||||
if (dname != NULL) {
|
||||
char dirname[CROSS_LEN];
|
||||
strncpy(dirname,name,dname - name);
|
||||
dirname[dname - name] = 0;
|
||||
if (is_deleted_path(dirname)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Overlay_Drive::FileExists(const char* name) {
|
||||
char overlayname[CROSS_LEN];
|
||||
|
|
|
@ -426,7 +426,6 @@ public:
|
|||
virtual bool FileStat(const char* name, FileStat_Block * const stat_block);
|
||||
virtual void EmptyCache(void);
|
||||
|
||||
bool Sync_leading_dirs(const char* dos_filename);
|
||||
FILE* create_file_in_overlay(char* dos_filename, char const* mode);
|
||||
virtual Bits UnMount(void);
|
||||
virtual bool TestDir(char * dir);
|
||||
|
@ -435,6 +434,7 @@ public:
|
|||
private:
|
||||
char overlaydir[CROSS_LEN];
|
||||
bool optimize_cache_v1;
|
||||
bool Sync_leading_dirs(const char* dos_filename);
|
||||
void add_DOSname_to_cache(const char* name);
|
||||
void remove_DOSname_from_cache(const char* name);
|
||||
void add_DOSdir_to_cache(const char* name);
|
||||
|
@ -450,6 +450,7 @@ private:
|
|||
void add_deleted_path(const char* name, bool create_on_disk);
|
||||
void remove_deleted_path(const char* name, bool create_on_disk);
|
||||
bool is_deleted_path(const char* name);
|
||||
bool check_if_leading_is_deleted(const char* name);
|
||||
|
||||
bool is_dir_only_in_overlay(const char* name); //cached
|
||||
|
||||
|
|
|
@ -752,16 +752,16 @@ dosurface:
|
|||
sdl.opengl.displaylist = glGenLists(1);
|
||||
glNewList(sdl.opengl.displaylist, GL_COMPILE);
|
||||
glBindTexture(GL_TEXTURE_2D, sdl.opengl.texture);
|
||||
glBegin(GL_QUADS);
|
||||
// lower left
|
||||
glTexCoord2f(0,tex_height); glVertex2f(-1.0f,-1.0f);
|
||||
// lower right
|
||||
glTexCoord2f(tex_width,tex_height); glVertex2f(1.0f, -1.0f);
|
||||
// upper right
|
||||
glTexCoord2f(tex_width,0); glVertex2f(1.0f, 1.0f);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
// upper left
|
||||
glTexCoord2f(0,0); glVertex2f(-1.0f, 1.0f);
|
||||
// lower left
|
||||
glTexCoord2f(0,tex_height*2); glVertex2f(-1.0f,-3.0f);
|
||||
// upper right
|
||||
glTexCoord2f(tex_width*2,0); glVertex2f(3.0f, 1.0f);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
sdl.desktop.type=SCREEN_OPENGL;
|
||||
retFlags = GFX_CAN_32 | GFX_SCALING;
|
||||
|
|
|
@ -67,7 +67,7 @@ struct JoyStick {
|
|||
}
|
||||
|
||||
void transform_circular(){
|
||||
float r = sqrt(xpos * xpos + ypos * ypos);
|
||||
float r = sqrtf(xpos * xpos + ypos * ypos);
|
||||
if (r == 0.0) {xfinal = xpos; yfinal = ypos; return;}
|
||||
float deadzone_f = deadzone / 100.0f;
|
||||
float s = 1.0f - deadzone_f;
|
||||
|
@ -77,8 +77,8 @@ struct JoyStick {
|
|||
}
|
||||
|
||||
float deadzonescale = (r - deadzone_f) / s; //r if deadzone=0;
|
||||
float xa = fabs(xpos);
|
||||
float ya = fabs(ypos);
|
||||
float xa = fabsf(xpos);
|
||||
float ya = fabsf(ypos);
|
||||
float maxpos = (ya>xa?ya:xa);
|
||||
xfinal = xpos * deadzonescale/maxpos;
|
||||
yfinal = ypos * deadzonescale/maxpos;
|
||||
|
|
|
@ -278,7 +278,7 @@ static void PCSPEAKER_CallBack(Bitu len) {
|
|||
index+=vol_len;
|
||||
} else {
|
||||
/* Check how long it will take to goto new level */
|
||||
float vol_time=fabs(vol_diff)/SPKR_SPEED;
|
||||
float vol_time=fabsf(vol_diff)/SPKR_SPEED;
|
||||
if (vol_time<=vol_len) {
|
||||
/* Volume reaches endpoint in this block, calc until that point */
|
||||
value+=vol_time*spkr.volcur;
|
||||
|
|
Loading…
Add table
Reference in a new issue