[Scummvm-cvs-logs] CVS: scummvm/bs2 resman.cpp,1.33,1.34
Max Horn
fingolfin at users.sourceforge.net
Wed Sep 17 13:35:27 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/bs2/driver driver96.h,1.34,1.35 misc.cpp,1.10,1.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common engine.h,1.36,1.37 file.cpp,1.45,1.46 file.h,1.15,1.16
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv10187
Modified Files:
resman.cpp
Log Message:
cleanup
Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- resman.cpp 14 Sep 2003 15:07:39 -0000 1.33
+++ resman.cpp 17 Sep 2003 20:34:20 -0000 1.34
@@ -75,10 +75,18 @@
#define LOCAL_CACHE 0x4 // Cluster is cached on HDD
#define LOCAL_PERM 0x8 // Cluster is on HDD.
+#if !defined(__GNUC__)
+ #pragma START_PACK_STRUCTS
+#endif
+
typedef struct {
uint8 clusterName[20]; // Null terminated cluster name.
uint8 cd; // Cd cluster is on and whether it is on the local drive or not.
-} _cd_inf;
+} GCC_PACK _cd_inf;
+
+#if !defined(__GNUC__)
+ #pragma END_PACK_STRUCTS
+#endif
// ---------------------------------------------------------------------------
@@ -1155,12 +1163,12 @@
// Git rid of read-only status, if it is set.
SVM_SetFileAttributes(resource_files[newCluster], FILE_ATTRIBUTE_NORMAL);
- FILE *inFile, *outFile;
+ File inFile, outFile;
- inFile = fopen(buf, "rb");
- outFile = fopen(resource_files[newCluster], "wb");
+ inFile.open(buf, g_sword2->getGameDataPath());
+ outFile.open(resource_files[newCluster], g_sword2->getGameDataPath(), File::kFileWriteMode);
- if (inFile == NULL || outFile == NULL) {
+ if (!inFile.isOpen() || !outFile.isOpen()) {
Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
}
@@ -1231,9 +1239,7 @@
WaitForFade();
- fseek(inFile, 0, SEEK_END);
- uint32 size = ftell(inFile);
- fseek(inFile, 0, SEEK_SET);
+ uint32 size = inFile.size();
char buffer[BUFFERSIZE];
int stepSize = (size / BUFFERSIZE) / 100;
@@ -1243,9 +1249,9 @@
uint32 realRead = 0;
do {
- realRead = fread(buffer, 1, BUFFERSIZE, inFile);
+ realRead = inFile.read(buffer, BUFFERSIZE);
read += realRead;
- if (fwrite(buffer, 1, realRead, outFile) != realRead) {
+ if (outFile.write(buffer, realRead) != realRead) {
Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
}
@@ -1288,8 +1294,8 @@
Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
}
- fclose(inFile);
- fclose(outFile);
+ inFile.close();
+ outFile.close();
Free_mem(text_spr);
EraseBackBuffer(); // for hardware rendering
@@ -1328,26 +1334,6 @@
fseek(file, -1, SEEK_CUR);
fwrite(&cdTab[newCluster], 1, 1, file);
fclose(file);
-
- // Now update DelList.log to indicate that this cluster should be
- // removed at uninstall.
- file = fopen("DelList.log", "r+");
-
- if (file != NULL) {
- fseek(file, -3, SEEK_END);
-
- char path[_MAX_PATH];
- SVM_GetCurrentDirectory(_MAX_PATH, path);
-
- strcat(path, "\\");
- strcat(path, resource_files[newCluster]);
- fwrite(path, 1, strlen(path), file);
-
- sprintf(path, "\nend");
- fwrite(path, 1, 4, file);
-
- fclose(file);
- }
}
void resMan::GetCd(int cd) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/bs2/driver driver96.h,1.34,1.35 misc.cpp,1.10,1.11
- Next message: [Scummvm-cvs-logs] CVS: scummvm/common engine.h,1.36,1.37 file.cpp,1.45,1.46 file.h,1.15,1.16
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list