VOGONS

Common searches


PhysFS patch

Topic actions

Reply 20 of 100, by `Moe`

User metadata
Rank Oldbie
Rank
Oldbie

A new version is available: It fixes one bug that affected Eye of the Beholder and Might and Magic 3. Status: No known bugs, working great, all of my games supported. Still no zipped image mounting, however, since prompt's patch is far too heavy to be just included.

Reply 21 of 100, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

I couldn't compile because of this in your new patch.
Would you fix it, Moe?

In /src/dos/drive_cache.cpp

	};
// Get Volume Label
#if defined (WIN32) || defined (OS2)
char labellocal[256]={ 0 };
<<<<<<< drive_cache.cpp
char windrive[4] = "C:\\";
windrive[0] = basePath[0];
if (GetVolumeInformation(windrive,labellocal,256,NULL,NULL,NULL,NULL,0)) {
=======
char drive[4] = "C:\\";
drive[0] = basePath[0];
#if defined (WIN32)
if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) {
#else // OS2
FSINFO fsinfo;
ULONG drivenumber = drive[0];
if (drivenumber > 26) { // drive letter was lowercase
drivenumber = drive[0] - 'a' + 1;
}
APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
if (rc == NO_ERROR) {
#endif
>>>>>>> 1.45
/* Set label and allow being updated */
SetLabel(labellocal,true);
}
Last edited by ykhwong on 2005-12-05, 11:52. Edited 2 times in total.

Reply 23 of 100, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Ooops.
I meant compiler doesn't accept some lines like '<<<<<<< drive_cache.cpp'

This is what I got when compiling in mingw32/msys with your patch that I downloaded from sourceforge. I used the latest clean cvs source (with no other patches applied).

if g++ -DHAVE_CONFIG_H -I. -I. -I../..  -I../../include -I/usr/local/include/SDL -Dmain=SDL_main  -s -O2 -pipe -fprofile-use -fomit-frame-pointer -mtune=i686 -march=i586 -MT drive_cache.o -MD -MP -MF ".deps/drive_cache.Tpo" -c -o drive_cache.o drive_cache.cpp; \
then mv -f ".deps/drive_cache.Tpo" ".deps/drive_cache.Po"; else rm -f ".deps/drive_cache.Tpo"; exit 1; fi
drive_cache.cpp: In member function `void DOS_Drive_Cache::SetBaseDir(const char*, DOS_Drive*)':
drive_cache.cpp:167: error: expected primary-expression before '<<' token
drive_cache.cpp:167: error: expected primary-expression before '<<' token
drive_cache.cpp:167: error: expected primary-expression before '<<' token
drive_cache.cpp:167: error: expected primary-expression before '<' token
drive_cache.cpp:167: error: `drive_cache' undeclared (first use this function)
drive_cache.cpp:167: error: (Each undeclared identifier is reported only once for each function it appears in.)
drive_cache.cpp:168: error: expected `;' before "char"
drive_cache.cpp:169: error: `windrive' undeclared (first use this function)
drive_cache.cpp:171: error: expected primary-expression before '==' token
drive_cache.cpp:171: error: expected primary-expression before '==' token
drive_cache.cpp:171: error: expected primary-expression before '==' token
drive_cache.cpp:171: error: expected primary-expression before '=' token
drive_cache.cpp:172: error: expected primary-expression before "char"
drive_cache.cpp:172: error: expected `;' before "char"
drive_cache.cpp:173: error: no match for 'operator=' in '*drive = ((DOS_Drive_Cache*)this)->DOS_Drive_Cache::basePath[0]'
../../include/dos_system.h:232: note: candidates are: DOS_Drive& DOS_Drive::operator=(const DOS_Drive&)
drive_cache.cpp:175: error: cannot convert `DOS_Drive*' to `const CHAR*' for argument `1' to `BOOL GetVolumeInformationA(const CHAR*, CHAR*, DWORD, DWORD*, DWORD*, DWORD*, CHAR*, DWORD)'
drive_cache.cpp:185: error: expected primary-expression before '>>' token
drive_cache.cpp:185: error: expected primary-expression before '>>' token
drive_cache.cpp:185: error: expected primary-expression before '>>' token
drive_cache.cpp:185: error: expected primary-expression before '>' token
drive_cache.cpp:187: error: expected `;' before "SetLabel"
drive_cache.cpp:193: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:193: error: expected `,' or `;' before '{' token
drive_cache.cpp:198: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:198: error: expected `,' or `;' before '{' token
drive_cache.cpp:231: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:231: error: expected `,' or `;' before '{' token
drive_cache.cpp:263: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:263: error: expected `,' or `;' before '{' token
drive_cache.cpp:280: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:280: error: expected `,' or `;' before '{' token
drive_cache.cpp:310: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:310: error: expected `,' or `;' before '{' token
drive_cache.cpp:316: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:316: error: expected `,' or `;' before '{' token
drive_cache.cpp:339: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:339: error: expected `,' or `;' before '{' token
drive_cache.cpp:371: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:371: error: expected `,' or `;' before '{' token
drive_cache.cpp:397: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:397: error: expected `,' or `;' before '{' token
drive_cache.cpp:409: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:409: error: expected `,' or `;' before '{' token
drive_cache.cpp:432: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:432: error: expected `,' or `;' before '{' token
drive_cache.cpp:443: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:443: error: expected `,' or `;' before '{' token
drive_cache.cpp:513: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:513: error: expected `,' or `;' before '{' token
drive_cache.cpp:593: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:593: error: expected `,' or `;' before '{' token
drive_cache.cpp:604: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:604: error: expected `,' or `;' before '{' token
drive_cache.cpp:628: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:628: error: expected `,' or `;' before '{' token
drive_cache.cpp:645: error: a function-definition is not allowed here before '{' token
Show last 25 lines
drive_cache.cpp:645: error: expected `,' or `;' before '{' token
drive_cache.cpp:682: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:682: error: expected `,' or `;' before '{' token
drive_cache.cpp:697: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:697: error: expected `,' or `;' before '{' token
drive_cache.cpp:741: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:741: error: expected `,' or `;' before '{' token
drive_cache.cpp:761: error: expected primary-expression before '(' token
drive_cache.cpp:761: error: expected primary-expression before "const"
drive_cache.cpp:761: error: expected primary-expression before '*' token
drive_cache.cpp:762: error: expected `;' before '{' token
drive_cache.cpp:767: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:767: error: expected `,' or `;' before '{' token
drive_cache.cpp:773: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:773: error: expected `,' or `;' before '{' token
drive_cache.cpp:781: error: a function-definition is not allowed here before '{' token
drive_cache.cpp:781: error: expected `,' or `;' before '{' token
drive_cache.cpp:794: error: expected `}' at end of input
make[3]: *** [drive_cache.o] Error 1
make[3]: Leaving directory `/c/dosbox/src/dos'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/c/dosbox/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/dosbox'
make: *** [all] Error 2

Reply 24 of 100, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

hmm remove the lines with <<<<<>>>>>> in it.
they are just pointers to show you where the confilicts appeared.
else use an older version of drive_cacche.cpp. the changes I commited were OS/2 only and shouldn't affect the results under windows.

Water flows down the stream
How to ask questions the smart way!

Reply 26 of 100, by `Moe`

User metadata
Rank Oldbie
Rank
Oldbie

It's not against an older version, I just missed that one conflict, as I didn't use the patch on windows. AsI said, all lines starting with "+" in your original diff can be safely deleted. Anyhow, I have uploaded a new patch with that glitch fixed.

QBix, how's your opinion regarding this patch? And what's your opinion on allowing images to be loaded from DOS drives (like prompt's patch above, which is unfortunately quite intrusive)?

EDIT: I'd love to upload the new patch, but sf.net is having problems. soon.. 😉

Reply 28 of 100, by `Moe`

User metadata
Rank Oldbie
Rank
Oldbie

It's just the fact that it changes a big amount of existing code. I've thought about integrating it with my patch, but maintaining physfs would become more difficult and your approach can be treated like a different issue.

Reply 29 of 100, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

There's still an error during compilation under windows.
You changed
'void DOS_Drive_Cache::SetBaseDir(const char* baseDir)' to
'void DOS_Drive_Cache::SetBaseDir(const char* baseDir, DOS_Drive *drive)'
But it seems that 'DOS_Drive *drive' crashed with 'char drive[4] = "C:\\";'.

This patch (below) will fix the bug.

--- ./src/dos/drive_cache.cpp	Tue Dec  6 16:38:20 2005
+++ ./src/dos/drive_cache.cpp Tue Dec 6 16:38:56 2005
@@ -164,15 +164,15 @@
// Get Volume Label
#if defined (WIN32) || defined (OS2)
char labellocal[256]={ 0 };
- char drive[4] = "C:\\";
- drive[0] = basePath[0];
+ char drives[4] = "C:\\";
+ drives[0] = basePath[0];
#if defined (WIN32)
- if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) {
+ if (GetVolumeInformation(drives,labellocal,256,NULL,NULL,NULL,NULL,0)) {
#else // OS2
FSINFO fsinfo;
- ULONG drivenumber = drive[0];
+ ULONG drivenumber = drives[0];
if (drivenumber > 26) { // drive letter was lowercase
- drivenumber = drive[0] - 'a' + 1;
+ drivenumber = drives[0] - 'a' + 1;
}
APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
if (rc == NO_ERROR) {
Last edited by ykhwong on 2005-12-07, 01:57. Edited 1 time in total.

Reply 30 of 100, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Why is that crashing, and how does renaming drive[] to drives[] fix it? Also, it looks like that change might break the OS2 part at the bottom, which checks drive[0].

Does changing this:
char drive[4] = "C:\\";
to
char drive[] = "C:\\";

fix it?

Reply 31 of 100, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

I tested my little changes only under Windows. And it's a temporary fix to complete compilation without errors.

I changed that also as you said, but result is the same.

drive_cache.cpp: In member function `void DOS_Drive_Cache::SetBaseDir(const char*, DOS_Drive*)':
drive_cache.cpp:167: error: declaration of 'char drive[]' shadows a parameter

Reply 32 of 100, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Oh I see. Can you post the first few lines of the definition of SetBaseDir() in drive_cache.cpp? I'm guessing that it has a parameter named drive in the parameter list, in which case whoever wrote that code needs to take a look at it to figure out why he/she is defining a variable whose name is already in scope.

Reply 33 of 100, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

This is the code after applying the patch.

void DOS_Drive_Cache::SetBaseDir(const char* baseDir, DOS_Drive *drive)
{
Bit16u id;
strcpy(basePath,baseDir);
this->drive = drive;
if (OpenDir(baseDir,id)) {
char* result = 0;
ReadDir(id,result);
};
// Get Volume Label
#if defined (WIN32) || defined (OS2)

Reply 34 of 100, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Yeah, it's definitely broken and whoever wrote it needs to resolve the conflict between DOS_Drive *drive in the parameter list for DOS_Drive_Cache() and char drive[4] farther down.

Reply 35 of 100, by rcblanke

User metadata
Rank Oldbie
Rank
Oldbie

Hi all,

Should the patch still work with the current Dosbox CVS? If so, how should I apply the patch? What I do:

patch -l -p1 <dosbox-physfs-20051205.diff

What I get:

patching file `configure.in'
Hunk #1 succeeded at 284 (offset 24 lines).
patching file `include/dos_system.h'
Hunk #1 FAILED at 104.
Hunk #2 succeeded at 203 (offset 15 lines).
Hunk #3 FAILED at 212.
Hunk #4 FAILED at 241.
3 out of 4 hunks FAILED -- saving rejects to include/dos_system.h.rej
patching file `src/dos/dos_programs.cpp'
Hunk #1 succeeded at 145 (offset -2 lines).
Hunk #3 succeeded at 178 (offset -2 lines).
Hunk #5 succeeded at 208 (offset -2 lines).
Hunk #7 FAILED at 238.
Hunk #8 succeeded at 263 (offset 4 lines).
1 out of 8 hunks FAILED -- saving rejects to src/dos/dos_programs.cpp.rej
patching file `src/dos/drive_cache.cpp'
Hunk #9 FAILED at 750.
1 out of 9 hunks FAILED -- saving rejects to src/dos/drive_cache.cpp.rej
patching file `src/dos/drive_fat.cpp'
Hunk #4 succeeded at 414 (offset 7 lines).
Hunk #5 succeeded at 699 (offset 3 lines).
Hunk #6 succeeded at 748 (offset 9 lines).
Hunk #7 succeeded at 761 (offset 5 lines).
Hunk #8 succeeded at 779 (offset 9 lines).
Hunk #9 succeeded at 889 (offset 9 lines).
Hunk #10 succeeded at 1054 (offset 9 lines).
Hunk #11 succeeded at 1106 (offset 9 lines).
Hunk #12 succeeded at 1158 (offset 9 lines).
patching file `src/dos/drive_iso.cpp'
Hunk #1 succeeded at 184 (offset 2 lines).
Hunk #3 succeeded at 309 (offset -13 lines).
patching file `src/dos/drive_local.cpp'
Hunk #1 succeeded at 48 (offset 1 line).
Hunk #2 FAILED at 71.
Hunk #3 FAILED at 121.
Hunk #4 FAILED at 132.
Hunk #5 FAILED at 141.
Hunk #6 succeeded at 181 with fuzz 2 (offset 28 lines).
Hunk #7 succeeded at 257 (offset 1 line).
Hunk #8 succeeded at 301 (offset 28 lines).
Hunk #9 succeeded at 289 (offset 1 line).
Hunk #10 succeeded at 326 (offset 28 lines).
Hunk #11 succeeded at 317 (offset 1 line).
Hunk #12 succeeded at 416 (offset 28 lines).
Hunk #13 succeeded at 419 (offset 1 line).
Hunk #14 succeeded at 577 (offset 37 lines).
Hunk #15 succeeded at 554 with fuzz 1 (offset 3 lines).
4 out of 15 hunks FAILED -- saving rejects to src/dos/drive_local.cpp.rej
patching file `src/dos/drive_physfs.cpp'
patching file `src/dos/drives.cpp'
patching file `src/dos/drives.h'
Hunk #1 FAILED at 32.
Hunk #4 succeeded at 195 (offset 1 line).
Hunk #6 succeeded at 343 (offset 3 lines).
Hunk #7 succeeded at 396 (offset 18 lines).
1 out of 7 hunks FAILED -- saving rejects to src/dos/drives.h.rej
patching file `src/dos/drive_virtual.cpp'
Hunk #1 succeeded at 139 (offset 1 line).
Hunk #3 succeeded at 199 (offset 1 line).
Hunk #4 succeeded at 229 (offset 5 lines).
Hunk #5 succeeded at 237 (offset 1 line).
patching file `src/dos/Makefile.am'
patching file `src/shell/shell.cpp'
Hunk #1 succeeded at 366 (offset 44 lines).

What am I doing wrong? Ykhwong and Gulikoza can get it working, it seems..

Regards,
Ronald

Reply 36 of 100, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Here is a patch that I modified a little bit against current cvs.
The patch also includes Krounz's bug-fix.
I assume that gulikoza updated it himself, too.

Attachments

Reply 39 of 100, by rcblanke

User metadata
Rank Oldbie
Rank
Oldbie

Thanks for your kind help, fellows. Using the current CVS and ykhwong's updated diff attachment, I still get:

$ patch -sup1 -l -p1 --dry-run <dosbox-physfs-20051205.diff
1 out of 4 hunks FAILED -- saving rejects to include/dos_system.h.rej
2 out of 7 hunks FAILED -- saving rejects to src/dos/drives.h.rej

and/or:

$ patch -l -p1 --dry-run <dosbox-physfs-20051205.diff
patching file `configure.in'
Hunk #1 succeeded at 284 (offset 24 lines).
patching file `include/dos_system.h'
Hunk #1 succeeded at 118 (offset 7 lines).
Hunk #3 succeeded at 204 (offset 7 lines).
Hunk #4 FAILED at 214.
1 out of 4 hunks FAILED -- saving rejects to include/dos_system.h.rej
patching file `src/dos/dos_programs.cpp'
Hunk #1 succeeded at 148 (offset 1 line).
Hunk #3 succeeded at 181 (offset 1 line).
Hunk #5 succeeded at 211 (offset 1 line).
Hunk #7 succeeded at 249 (offset 11 lines).
patching file `src/dos/drive_cache.cpp'
patching file `src/dos/drive_fat.cpp'
Hunk #4 succeeded at 414 (offset 7 lines).
Hunk #5 succeeded at 704 (offset 8 lines).
Hunk #6 succeeded at 748 (offset 9 lines).
Hunk #7 succeeded at 766 (offset 10 lines).
Hunk #8 succeeded at 779 (offset 9 lines).
Hunk #9 succeeded at 894 (offset 14 lines).
Hunk #10 succeeded at 1054 (offset 9 lines).
Hunk #11 succeeded at 1111 (offset 14 lines).
Hunk #12 succeeded at 1158 (offset 9 lines).
patching file `src/dos/drive_iso.cpp'
Hunk #1 succeeded at 187 (offset 5 lines).
Hunk #3 succeeded at 312 (offset -10 lines).
patching file `src/dos/drive_local.cpp'
Hunk #1 succeeded at 48 (offset 1 line).
Hunk #3 succeeded at 141 (offset 1 line).
Hunk #4 succeeded at 181 with fuzz 2 (offset 28 lines).
Hunk #5 succeeded at 257 (offset 1 line).
Hunk #6 succeeded at 301 (offset 28 lines).
Hunk #7 succeeded at 289 (offset 1 line).
Hunk #8 succeeded at 326 (offset 28 lines).
Hunk #9 succeeded at 317 (offset 1 line).
Hunk #10 succeeded at 421 with fuzz 1 (offset 33 lines).
Hunk #11 succeeded at 419 (offset 1 line).
Hunk #12 succeeded at 585 (offset 45 lines).
Hunk #13 succeeded at 554 with fuzz 1 (offset 3 lines).
patching file `src/dos/drive_physfs.cpp'
patching file `src/dos/drives.cpp'
patching file `src/dos/drives.h'
Hunk #1 FAILED at 32.
Hunk #2 succeeded at 77 (offset 1 line).
Hunk #4 succeeded at 197 (offset 3 lines).
Hunk #5 FAILED at 231.
Hunk #6 succeeded at 344 (offset 4 lines).
Hunk #7 succeeded at 401 (offset 23 lines).
2 out of 7 hunks FAILED -- saving rejects to src/dos/drives.h.rej
patching file `src/dos/drive_virtual.cpp'
Hunk #1 succeeded at 139 (offset 1 line).
Hunk #3 succeeded at 199 (offset 1 line).
Hunk #4 succeeded at 229 (offset 5 lines).
Hunk #5 succeeded at 237 (offset 1 line).
patching file `src/dos/Makefile.am'
patching file `src/shell/shell.cpp'
Hunk #1 succeeded at 366 (offset 44 lines).
patching file `src/dos/drive_cache.cpp'
Hunk #1 succeeded at 163 (offset -1 lines).

Can somebody help me out here?

Ronald