diff --git a/2dlib/font.cpp b/2dlib/font.cpp index 58d27986..e63d9cec 100644 --- a/2dlib/font.cpp +++ b/2dlib/font.cpp @@ -120,7 +120,7 @@ #include "renderer.h" #include "gr.h" #include "mono.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "bitmap.h" #include "mem.h" diff --git a/CMakeLists.txt b/CMakeLists.txt index 34a1224f..8a86dc83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,7 +104,7 @@ if(LOGGER) add_definitions(-DLOGGER) endif() -include_directories("lib" "Descent3" ${PLATFORM_INCLUDES}) +include_directories("${CMAKE_SOURCE_DIR}" "lib" "Descent3" ${PLATFORM_INCLUDES}) # file(GLOB_RECURSE INCS "*.h") diff --git a/Descent3/BriefingParse.cpp b/Descent3/BriefingParse.cpp index 91284eda..51334b37 100644 --- a/Descent3/BriefingParse.cpp +++ b/Descent3/BriefingParse.cpp @@ -65,7 +65,7 @@ #include #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "game.h" #include "mem.h" @@ -242,7 +242,7 @@ int ReadFullLine(char **data, CFILE *ifile) { // read in a byte c = cfgetc(ifile); - if ((c == EOF) || (!(ifile->flags & CF_TEXT) && (c == 0)) || ((ifile->flags & CF_TEXT) && (c == '\n'))) { + if ((c == EOF) || (!(ifile->flags & CFF_TEXT) && (c == 0)) || ((ifile->flags & CFF_TEXT) && (c == '\n'))) { // we've hit the end of the line done = true; } else { diff --git a/Descent3/ConfigItem.cpp b/Descent3/ConfigItem.cpp index 525caa44..cf571737 100644 --- a/Descent3/ConfigItem.cpp +++ b/Descent3/ConfigItem.cpp @@ -95,7 +95,7 @@ #include "ddio.h" #include "gamefont.h" #include "multi_ui.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "mem.h" #include "game.h" #include "stringtable.h" diff --git a/Descent3/DllWrappers.cpp b/Descent3/DllWrappers.cpp index 0329b5e0..e7260087 100644 --- a/Descent3/DllWrappers.cpp +++ b/Descent3/DllWrappers.cpp @@ -19,7 +19,7 @@ #include "DllWrappers.h" #include "pserror.h" #include "pstring.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "gamefont.h" #include "grdefs.h" #include "descent.h" diff --git a/Descent3/DllWrappers.h b/Descent3/DllWrappers.h index 15a881c0..5eaebd8a 100644 --- a/Descent3/DllWrappers.h +++ b/Descent3/DllWrappers.h @@ -20,7 +20,7 @@ #define DLLWRAPPERS_H_ #include "pserror.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "gamefont.h" #include "grdefs.h" #include "descent.h" diff --git a/Descent3/Inventory.h b/Descent3/Inventory.h index 531c39ca..5a7fb5e0 100644 --- a/Descent3/Inventory.h +++ b/Descent3/Inventory.h @@ -182,7 +182,7 @@ #define __INVENTORY_H__ #include "pstypes.h" -#include "CFILE.H" +#include "cfile/cfile.h" struct object; diff --git a/Descent3/LoadLevel.cpp b/Descent3/LoadLevel.cpp index 6434fbd9..f2be1753 100644 --- a/Descent3/LoadLevel.cpp +++ b/Descent3/LoadLevel.cpp @@ -1248,7 +1248,7 @@ #include "LoadLevel.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "descent.h" #include "object.h" diff --git a/Descent3/LoadLevel.h b/Descent3/LoadLevel.h index 8dcf7657..dc99575c 100644 --- a/Descent3/LoadLevel.h +++ b/Descent3/LoadLevel.h @@ -443,7 +443,7 @@ * $NoKeywords: $ */ -#include "CFILE.H" +#include "cfile/cfile.h" #include "room.h" // Chunk types diff --git a/Descent3/Mission.cpp b/Descent3/Mission.cpp index 6f70e3e8..7325e4f3 100644 --- a/Descent3/Mission.cpp +++ b/Descent3/Mission.cpp @@ -640,7 +640,7 @@ #include "3d.h" #include "LoadLevel.h" #include "pserror.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "gamefont.h" #include "grdefs.h" #include "descent.h" diff --git a/Descent3/OsirisLoadandBind.cpp b/Descent3/OsirisLoadandBind.cpp index 20f52d85..3a9f6fb1 100644 --- a/Descent3/OsirisLoadandBind.cpp +++ b/Descent3/OsirisLoadandBind.cpp @@ -402,7 +402,7 @@ #include "osiris_dll.h" #include "pserror.h" #include "mono.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "ddio.h" #include "manage.h" #include @@ -917,11 +917,11 @@ int _get_full_path_to_module(char *module_name, char *fullpath, char *basename) int exist = cfexist(modfilename); switch (exist) { - case CF_ON_DISK: + case CFES_ON_DISK: ddio_MakePath(fullpath, LocalScriptDir, modfilename, NULL); return -1; break; - case CF_IN_LIBRARY: { + case CFES_IN_LIBRARY: { ASSERT(OSIRIS_Extracted_script_dir); if (!OSIRIS_Extracted_script_dir) return -2; diff --git a/Descent3/PilotPicsAPI.cpp b/Descent3/PilotPicsAPI.cpp index 5e54ccf0..8cbc26ca 100644 --- a/Descent3/PilotPicsAPI.cpp +++ b/Descent3/PilotPicsAPI.cpp @@ -63,7 +63,7 @@ #include "bitmap.h" #include "player.h" #include "pilot.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "mono.h" #include "ddio.h" #include "manage.h" diff --git a/Descent3/TelCom.cpp b/Descent3/TelCom.cpp index dae27f58..83924c88 100644 --- a/Descent3/TelCom.cpp +++ b/Descent3/TelCom.cpp @@ -501,7 +501,7 @@ #include "ddio.h" #include "descent.h" #include "game.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "application.h" #include "TelCom.h" #include "TelComEffects.h" diff --git a/Descent3/TelComAutoMap.cpp b/Descent3/TelComAutoMap.cpp index d9adc3a9..fcd88f24 100644 --- a/Descent3/TelComAutoMap.cpp +++ b/Descent3/TelComAutoMap.cpp @@ -151,7 +151,7 @@ #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "ddio.h" #include "bitmap.h" diff --git a/Descent3/TelComCargo.cpp b/Descent3/TelComCargo.cpp index 42dde837..e88d34a7 100644 --- a/Descent3/TelComCargo.cpp +++ b/Descent3/TelComCargo.cpp @@ -82,7 +82,7 @@ #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "ddio.h" #include "bitmap.h" diff --git a/Descent3/TelComGoals.cpp b/Descent3/TelComGoals.cpp index 904403e3..98ed49af 100644 --- a/Descent3/TelComGoals.cpp +++ b/Descent3/TelComGoals.cpp @@ -85,7 +85,7 @@ #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "ddio.h" #include "bitmap.h" diff --git a/Descent3/aiambient.cpp b/Descent3/aiambient.cpp index 195732fb..19dea324 100644 --- a/Descent3/aiambient.cpp +++ b/Descent3/aiambient.cpp @@ -1,5 +1,5 @@ /* -* Descent 3 +* Descent 3 * Copyright (C) 2024 Parallax Software * * This program is free software: you can redistribute it and/or modify @@ -16,10 +16,10 @@ * along with this program. If not, see . */ +#include #include "aiambient.h" #include "string.h" #include "objinfo.h" -#include #include "game.h" #include "psrand.h" diff --git a/Descent3/aiambient.h b/Descent3/aiambient.h index 72897cf3..b8b0f5fe 100644 --- a/Descent3/aiambient.h +++ b/Descent3/aiambient.h @@ -19,7 +19,7 @@ #ifndef _AIAMBIENT_H_ #define _AIAMBIENT_H_ -#include "CFILE.H" +#include "cfile/cfile.h" #define MAX_AL_TYPES 6 #define MAX_ALS_PER_TYPE 130 diff --git a/Descent3/ambient.cpp b/Descent3/ambient.cpp index c8e1cf78..1dad6abc 100644 --- a/Descent3/ambient.cpp +++ b/Descent3/ambient.cpp @@ -156,7 +156,6 @@ void InitAmbientSounds() { } #include "ddio.h" -#include "CFILE.H" #include "soundload.h" #include "descent.h" #include "mem.h" diff --git a/Descent3/audiotaunts.cpp b/Descent3/audiotaunts.cpp index de2ffc2f..0b22418a 100644 --- a/Descent3/audiotaunts.cpp +++ b/Descent3/audiotaunts.cpp @@ -24,7 +24,7 @@ #include "pserror.h" #include "pstypes.h" #include "audiotaunts.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "audio_encode.h" #include "byteswap.h" #include "mem.h" diff --git a/Descent3/bsp.h b/Descent3/bsp.h index a9e1842b..87d3073d 100644 --- a/Descent3/bsp.h +++ b/Descent3/bsp.h @@ -43,7 +43,7 @@ #include "list.h" #include "vecmat.h" -#include "CFILE.H" +#include "cfile/cfile.h" #define BSP_IN_FRONT 1 #define BSP_BEHIND 2 diff --git a/Descent3/buddymenu.cpp b/Descent3/buddymenu.cpp index 7d85c661..174569ae 100644 --- a/Descent3/buddymenu.cpp +++ b/Descent3/buddymenu.cpp @@ -59,7 +59,7 @@ #include "ddio.h" #include "descent.h" #include "game.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "application.h" #include #include diff --git a/Descent3/config.cpp b/Descent3/config.cpp index 41002f92..197249cd 100644 --- a/Descent3/config.cpp +++ b/Descent3/config.cpp @@ -296,7 +296,7 @@ #include "cinematics.h" #include "hlsoundlib.h" #include "terrain.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "mem.h" #include "lighting.h" #include "PHYSICS.H" diff --git a/Descent3/d3serial.cpp b/Descent3/d3serial.cpp index b21d40b3..971ad72c 100644 --- a/Descent3/d3serial.cpp +++ b/Descent3/d3serial.cpp @@ -83,7 +83,7 @@ #include "descent.h" #include #include "mono.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "program.h" #include diff --git a/Descent3/dedicated_server.cpp b/Descent3/dedicated_server.cpp index ccc49329..e6d7918d 100644 --- a/Descent3/dedicated_server.cpp +++ b/Descent3/dedicated_server.cpp @@ -112,8 +112,8 @@ typedef int socklen_t; #include "pstypes.h" #include "pserror.h" #include "pstring.h" -#include "CFILE.H" -#include "InfFile.h" +#include "cfile/cfile.h" +#include "cfile/inffile.h" #include "dedicated_server.h" #include "multi.h" #include "args.h" diff --git a/Descent3/demofile.cpp b/Descent3/demofile.cpp index 59d79b9a..65efa13a 100644 --- a/Descent3/demofile.cpp +++ b/Descent3/demofile.cpp @@ -266,7 +266,7 @@ */ #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "objinfo.h" #include "ship.h" #include "ui.h" diff --git a/Descent3/descent.cpp b/Descent3/descent.cpp index bf4d6f4f..a29b9021 100644 --- a/Descent3/descent.cpp +++ b/Descent3/descent.cpp @@ -385,7 +385,7 @@ #include "pserror.h" #include "grdefs.h" #include "mono.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "init.h" #include "game.h" diff --git a/Descent3/game.cpp b/Descent3/game.cpp index ebcb4f8a..c1ab0440 100644 --- a/Descent3/game.cpp +++ b/Descent3/game.cpp @@ -676,7 +676,7 @@ #include "cinematics.h" #include "SmallViews.h" #include "Mission.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "gameloop.h" #include "cockpit.h" #include "game2dll.h" diff --git a/Descent3/gamesave.cpp b/Descent3/gamesave.cpp index 465ddc0f..3d380980 100644 --- a/Descent3/gamesave.cpp +++ b/Descent3/gamesave.cpp @@ -266,7 +266,7 @@ #include "gamesave.h" #include "descent.h" #include "newui.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "Mission.h" #include "gamesequence.h" #include "gameevent.h" diff --git a/Descent3/gamesave.h b/Descent3/gamesave.h index 96b8a679..986ec88a 100644 --- a/Descent3/gamesave.h +++ b/Descent3/gamesave.h @@ -85,7 +85,7 @@ #define GAMESAVE_H #include "pstypes.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "object.h" #include "objinfo.h" diff --git a/Descent3/help.cpp b/Descent3/help.cpp index d83f959f..d42cf88e 100644 --- a/Descent3/help.cpp +++ b/Descent3/help.cpp @@ -132,7 +132,7 @@ #include "ddio.h" #include "descent.h" #include "game.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "application.h" #include #include diff --git a/Descent3/hotspotmap.cpp b/Descent3/hotspotmap.cpp index b2211e42..1ecd1adb 100644 --- a/Descent3/hotspotmap.cpp +++ b/Descent3/hotspotmap.cpp @@ -105,7 +105,7 @@ #include "ddio.h" #include "descent.h" #include "game.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "application.h" #include #include diff --git a/Descent3/levelgoal.h b/Descent3/levelgoal.h index 0298a77e..b4743f5e 100644 --- a/Descent3/levelgoal.h +++ b/Descent3/levelgoal.h @@ -20,7 +20,7 @@ #define _LEVELGOAL_H_ #include "object.h" -#include "CFILE.H" +#include "cfile/cfile.h" #if defined(MACOSX) #include #else diff --git a/Descent3/lnxmain.cpp b/Descent3/lnxmain.cpp index 591027d7..8ff1cf0a 100644 --- a/Descent3/lnxmain.cpp +++ b/Descent3/lnxmain.cpp @@ -35,6 +35,7 @@ #include #define _GNU_SOURCE #include +#include "cfile/hogfile.h" #endif #include "SDL.h" @@ -330,8 +331,6 @@ void StartDedicatedServer(); static void hogfileRefresh(const char *x) { printf(" - %s\n", x); } // hogfileRefresh -int CreateNewHogFile(const char *hogname, int nfiles, const char **filenames, void (*UpdateFunction)(char *)); - // hack of the century. static void buildNewHogFromFileList(char *fileName) { setbuf(stdout, NULL); @@ -422,7 +421,7 @@ static void buildNewHogFromFileList(char *fileName) { } // for } while (swapped); - CreateNewHogFile("new.hog", i, (const char **)files, (void (*)(char *))hogfileRefresh); + NewHogFile("new.hog", i, (const char **)files, (void (*)(char *))hogfileRefresh); } // buildNewHogFileFromList #endif diff --git a/Descent3/loadstate.cpp b/Descent3/loadstate.cpp index 300ca09e..ab71c136 100644 --- a/Descent3/loadstate.cpp +++ b/Descent3/loadstate.cpp @@ -181,7 +181,7 @@ #include "gamesave.h" #include "descent.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "Mission.h" #include "gamesequence.h" #include "gameevent.h" diff --git a/Descent3/localization.cpp b/Descent3/localization.cpp index 7d2eb06f..bf825569 100644 --- a/Descent3/localization.cpp +++ b/Descent3/localization.cpp @@ -91,7 +91,7 @@ #include "game.h" #include "descent.h" #include "mono.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "localization.h" #include "mem.h" #include "ddio.h" diff --git a/Descent3/matcen.h b/Descent3/matcen.h index b64181bb..12f68b3c 100644 --- a/Descent3/matcen.h +++ b/Descent3/matcen.h @@ -19,7 +19,7 @@ #ifndef _MATCEN_H_ #define _MATCEN_H_ -#include "CFILE.H" +#include "cfile/cfile.h" #include "vecmat.h" #include "matcen_external.h" diff --git a/Descent3/multi.cpp b/Descent3/multi.cpp index 31feb295..e2e6fcb9 100644 --- a/Descent3/multi.cpp +++ b/Descent3/multi.cpp @@ -7631,7 +7631,7 @@ void MultiAskForFile(ushort file_id, ushort file_who, ushort who) { // Check to see if this file exists already char *p = GetFileNameFromPlayerAndID(file_who, file_id); if (*p) { - if (CF_ON_DISK == cfexist(p)) { + if (CFES_ON_DISK == cfexist(p)) { char szcrc[_MAX_PATH]; char path[_MAX_PATH]; char ext[_MAX_PATH]; diff --git a/Descent3/multi_external.h b/Descent3/multi_external.h index 6fd12386..b181c4dc 100644 --- a/Descent3/multi_external.h +++ b/Descent3/multi_external.h @@ -113,7 +113,7 @@ #include "pstypes.h" #include "manage_external.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "networking.h" #include "descent.h" //for MSN_NAMELEN #include "byteswap.h" diff --git a/Descent3/multi_save_setting.cpp b/Descent3/multi_save_setting.cpp index 69d7d997..2223fd0a 100644 --- a/Descent3/multi_save_setting.cpp +++ b/Descent3/multi_save_setting.cpp @@ -68,7 +68,7 @@ */ #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "multi.h" #include "objinfo.h" #include "ship.h" diff --git a/Descent3/newui_filedlg.cpp b/Descent3/newui_filedlg.cpp index 6de8a217..7c5c73b3 100644 --- a/Descent3/newui_filedlg.cpp +++ b/Descent3/newui_filedlg.cpp @@ -106,7 +106,7 @@ #include "ddio.h" #include "descent.h" #include "game.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "application.h" #include #include diff --git a/Descent3/osiris_dll.h b/Descent3/osiris_dll.h index c4b244b2..3687b2fb 100644 --- a/Descent3/osiris_dll.h +++ b/Descent3/osiris_dll.h @@ -116,7 +116,7 @@ #include "object_external_struct.h" #include "osiris_share.h" #include "module.h" -#include "CFILE.H" +#include "cfile/cfile.h" extern uint Osiris_game_checksum; diff --git a/Descent3/osiris_predefs.h b/Descent3/osiris_predefs.h index 66c9ed7e..7be1e544 100644 --- a/Descent3/osiris_predefs.h +++ b/Descent3/osiris_predefs.h @@ -174,7 +174,7 @@ #define __OSIRIS_PREDEF_H_ #include "osiris_dll.h" -#include "CFILE.H" +#include "cfile/cfile.h" // osipf_CallObjectEvent // Sends an event to an object. Returns true if the default action should diff --git a/Descent3/pilot.cpp b/Descent3/pilot.cpp index e296129f..1452862b 100644 --- a/Descent3/pilot.cpp +++ b/Descent3/pilot.cpp @@ -581,7 +581,7 @@ #include "ddio.h" #include "descent.h" #include "game.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "application.h" #include "manage.h" #include "newui.h" @@ -951,7 +951,7 @@ void PilotSelect(void) { int res = -1; bool done = false; - if (cfexist(Default_pilot) != CF_NOT_FOUND) { + if (cfexist(Default_pilot) != CFES_NOT_FOUND) { // ok so the default pilot file is around, mark this as the current pilot Current_pilot.set_filename(Default_pilot); PltReadFile(&Current_pilot); @@ -1002,7 +1002,7 @@ void PilotSelect(void) { // use this in case they cancel out Current_pilot.get_filename(pfilename); - if (cfexist(pfilename) != CF_NOT_FOUND) { + if (cfexist(pfilename) != CFES_NOT_FOUND) { strcpy(old_file, pfilename); } else { old_file[0] = '\0'; @@ -1058,7 +1058,7 @@ void PilotSelect(void) { case UID_CANCEL: { // Cancel out - bool found_old = (cfexist(old_file) != CF_NOT_FOUND); + bool found_old = (cfexist(old_file) != CFES_NOT_FOUND); bool display_error; if (filecount && found_old) @@ -1512,7 +1512,7 @@ void NewPltUpdate(newuiListBox *list, char **flist, int filecount, int selected, list->SetCurrentIndex(selected); - if (filename && (cfexist(filename) != CF_NOT_FOUND)) { + if (filename && (cfexist(filename) != CFES_NOT_FOUND)) { // get the selected pilot from the filename mprintf((0, "Looking for Pilot: %s\n", filename)); for (int d = 0; d < filecount; d++) { @@ -2230,7 +2230,7 @@ bool CreateCRCFileName(const char *src, char *dest) { ASSERT(src); ASSERT(dest); - if (cfexist(src) != CF_ON_DISK) + if (cfexist(src) != CFES_ON_DISK) return false; unsigned int crc_value = cf_GetfileCRC((char *)src); @@ -2261,7 +2261,7 @@ bool CreateCRCFileName(const char *src, char *base, char *newfilename) { ASSERT(base); ASSERT(newfilename); - if (cfexist(src) != CF_ON_DISK) + if (cfexist(src) != CFES_ON_DISK) return false; unsigned int crc_value = cf_GetfileCRC((char *)src); @@ -2363,7 +2363,7 @@ float getdist(angle ang, float height) { // newfile = on return true is the filename of the new bitmap bool ImportGraphic(char *pathname, char *newfile) { ASSERT(pathname); - if (cfexist(pathname) != CF_ON_DISK) { + if (cfexist(pathname) != CFES_ON_DISK) { mprintf((0, "'%s' not found\n", pathname)); return false; } diff --git a/Descent3/pilot_class.h b/Descent3/pilot_class.h index d3ea0298..d7058f1b 100644 --- a/Descent3/pilot_class.h +++ b/Descent3/pilot_class.h @@ -90,7 +90,7 @@ #include "pstypes.h" #include "controls.h" #include "Controller.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "weapon.h" #include "config.h" diff --git a/Descent3/vclip.cpp b/Descent3/vclip.cpp index 964ede7b..4b5fc41a 100644 --- a/Descent3/vclip.cpp +++ b/Descent3/vclip.cpp @@ -160,7 +160,7 @@ #include "pserror.h" #include "bitmap.h" #include "vclip.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "mono.h" #include "ddio.h" #include "gametexture.h" diff --git a/Descent3/weapon.cpp b/Descent3/weapon.cpp index 72064bfb..d95d53d5 100644 --- a/Descent3/weapon.cpp +++ b/Descent3/weapon.cpp @@ -356,7 +356,7 @@ #include "sounds.h" #include "stringtable.h" #include "Macros.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "AIMain.h" #include diff --git a/bitmap/bitmain.cpp b/bitmap/bitmain.cpp index fdfb7cb7..82e997f0 100644 --- a/bitmap/bitmain.cpp +++ b/bitmap/bitmain.cpp @@ -300,7 +300,7 @@ #include #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "texture.h" #include "bitmap.h" #include "pstypes.h" diff --git a/bitmap/iff.cpp b/bitmap/iff.cpp index 666de390..672f27d0 100644 --- a/bitmap/iff.cpp +++ b/bitmap/iff.cpp @@ -74,7 +74,7 @@ #include "mem.h" #include "iff.h" #include "byteswap.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "pstypes.h" #include "bitmap.h" diff --git a/bitmap/iff.h b/bitmap/iff.h index 1eecb548..36c2a001 100644 --- a/bitmap/iff.h +++ b/bitmap/iff.h @@ -19,7 +19,7 @@ #ifndef _IFF_H #define _IFF_H -#include "CFILE.H" +#include "cfile/cfile.h" // Error codes for read & write routines diff --git a/bitmap/tga.cpp b/bitmap/tga.cpp index a1a16df2..84ff6dd5 100644 --- a/bitmap/tga.cpp +++ b/bitmap/tga.cpp @@ -132,7 +132,7 @@ * $NoKeywords: $ */ -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "pstypes.h" #include "bitmap.h" diff --git a/cfile/CMakeLists.txt b/cfile/CMakeLists.txt index 704e3f08..3f8f63b4 100644 --- a/cfile/CMakeLists.txt +++ b/cfile/CMakeLists.txt @@ -1,7 +1,6 @@ -set(HEADERS) set(CPPS - CFILE.cpp - hog.cpp - InfFile.cpp) + cfile.cpp + hogfile.cpp + inffile.cpp) -add_library(cfile STATIC ${HEADERS} ${CPPS}) +add_library(cfile STATIC ${CPPS}) diff --git a/cfile/CFILE.cpp b/cfile/cfile.cpp similarity index 93% rename from cfile/CFILE.cpp rename to cfile/cfile.cpp index e9c46d3a..f151a551 100644 --- a/cfile/CFILE.cpp +++ b/cfile/cfile.cpp @@ -33,13 +33,15 @@ // Linux Build Includes #include "linux/linux_fix.h" #endif + #include "byteswap.h" #include "pserror.h" #include "ddio.h" #include "psglob.h" -#include "CFILE.H" -#include "hogfile.h" //info about library file +#include "cfile/cfile.h" +#include "cfile/hogfile.h" //info about library file #include "mem.h" + // Library structures typedef struct { char name[PSFILENAME_LEN + 1]; // just the filename part @@ -48,25 +50,30 @@ typedef struct { ulong timestamp; // time and date of file int flags; // misc flags } library_entry; + typedef struct library { char name[_MAX_PATH]; // includes path + filename int nfiles; library_entry *entries; struct library *next; - int handle; // indentifier for this lib + int handle; // identifier for this lib FILE *file; // pointer to file for this lib, if no one using it } library; + // entry in extension->path table typedef struct { char ext[_MAX_EXT]; ubyte pathnum; } ext_entry; + // entry in list of paths typedef struct { char path[_MAX_PATH]; ubyte specific; // if non-zero, only for specific extensions } path_entry; + #define MAX_PATHS 100 + path_entry paths[MAX_PATHS]; int N_paths = 0; #define MAX_EXTENSIONS 100 @@ -74,11 +81,12 @@ ext_entry extensions[MAX_EXTENSIONS]; int N_extensions; library *Libraries = NULL; int lib_handle = 0; -void cf_Close(); + // Structure thrown on disk error cfile_error cfe; // The message for unexpected end of file char *eof_error = "Unexpected end of file"; + // Generates a cfile error void ThrowCFileError(int type, CFILE *file, char *msg) { cfe.read_write = type; @@ -86,6 +94,9 @@ void ThrowCFileError(int type, CFILE *file, char *msg) { cfe.file = file; throw &cfe; } + +void cf_Close(); + // Opens a HOG file. Future calls to cfopen(), etc. will look in this HOG. // Parameters: libname - the path & filename of the HOG file // NOTE: libname must be valid for the entire execution of the program. Therefore, it should either @@ -101,7 +112,7 @@ int cf_OpenLibrary(const char *libname) { tHogFileEntry entry; fp = fopen(libname, "rb"); - if (fp == NULL) + if (fp == nullptr) return 0; // CF_NO_FILE; fread(id, strlen(HOG_TAG_STR), 1, fp); if (strncmp(id, HOG_TAG_STR, strlen(HOG_TAG_STR))) { @@ -166,10 +177,13 @@ int cf_OpenLibrary(const char *libname) { // Sucess. Return the handle return lib->handle; } -// Closes a library file. -// Parameters: handle: the handle returned by cf_OpenLibrary() + +/** + * Closes a library file. + * @param handle the handle returned by cf_OpenLibrary() + */ void cf_CloseLibrary(int handle) { - library *lib, *prev = NULL; + library *lib, *prev = nullptr; for (lib = Libraries; lib; prev = lib, lib = lib->next) { if (lib->handle == handle) { if (prev) @@ -180,10 +194,11 @@ void cf_CloseLibrary(int handle) { fclose(lib->file); mem_free(lib->entries); mem_free(lib); - return; // sucessful close + return; // successful close } } } + // Closes down the CFILE system, freeing up all data, etc. void cf_Close() { library *next; @@ -232,16 +247,23 @@ int cf_SetSearchPath(const char *path, ...) { return 1; } -// Removes all search paths that have been added by cf_SetSearchPath -void cf_ClearAllSearchPaths(void) { +/** + * Removes all search paths that have been added by cf_SetSearchPath + */ +void cf_ClearAllSearchPaths() { N_paths = 0; N_extensions = 0; } -// Opens a file for reading in a library, given the library id +/** + * Opens a file for reading in a library, given the library id + * @param filename + * @param libhandle + * @return + */ CFILE *cf_OpenFileInLibrary(const char *filename, int libhandle) { if (libhandle <= 0) - return NULL; + return nullptr; library *lib; CFILE *cfile; @@ -254,9 +276,9 @@ CFILE *cf_OpenFileInLibrary(const char *filename, int libhandle) { lib = lib->next; } - if (NULL == lib) { + if (nullptr == lib) { // couldn't find the library handle - return NULL; + return nullptr; } // now do a binary search for the file entry @@ -276,10 +298,10 @@ CFILE *cf_OpenFileInLibrary(const char *filename, int libhandle) { first = i + 1; else // search key before check key last = i - 1; - } while (1); + } while (true); if (!found) - return NULL; // file not in library + return nullptr; // file not in library // open the file for reading FILE *fp; @@ -287,13 +309,13 @@ CFILE *cf_OpenFileInLibrary(const char *filename, int libhandle) { // See if there's an available FILE if (lib->file) { fp = lib->file; - lib->file = NULL; + lib->file = nullptr; } else { fp = fopen(lib->name, "rb"); if (!fp) { mprintf((1, "Error opening library <%s> when opening file <%s>; errno=%d.", lib->name, filename, errno)); Int3(); - return NULL; + return nullptr; } } cfile = (CFILE *)mem_malloc(sizeof(*cfile)); @@ -333,20 +355,20 @@ CFILE *open_file_in_lib(const char *filename) { first = i + 1; else // search key before check key last = i - 1; - } while (1); + } while (true); if (found) { FILE *fp; int r; // See if there's an available FILE if (lib->file) { fp = lib->file; - lib->file = NULL; + lib->file = nullptr; } else { fp = fopen(lib->name, "rb"); if (!fp) { mprintf((1, "Error opening library <%s> when opening file <%s>; errno=%d.", lib->name, filename, errno)); Int3(); - return NULL; + return nullptr; } } cfile = (CFILE *)mem_malloc(sizeof(*cfile)); @@ -365,7 +387,7 @@ CFILE *open_file_in_lib(const char *filename) { } lib = lib->next; } - return NULL; + return nullptr; } #ifdef __LINUX__ @@ -382,7 +404,7 @@ public: bool Start(const char *wildcard, char *namebuf); bool Next(char *namebuf); - void Close(void); + void Close(); private: int globindex; @@ -411,7 +433,7 @@ bool CFindFiles::Start(const char *wildcard, char *namebuf) { globindex = 0; char ext[256]; - ddio_SplitPath(ffres.gl_pathv[0], NULL, namebuf, ext); + ddio_SplitPath(ffres.gl_pathv[0], nullptr, namebuf, ext); strcat(namebuf, ext); return true; } @@ -425,12 +447,12 @@ bool CFindFiles::Next(char *namebuf) { return false; char ext[256]; - ddio_SplitPath(ffres.gl_pathv[globindex], NULL, namebuf, ext); + ddio_SplitPath(ffres.gl_pathv[globindex], nullptr, namebuf, ext); strcat(namebuf, ext); return true; } -void CFindFiles::Close(void) { +void CFindFiles::Close() { if (globindex == -1) return; globindex = -1; @@ -467,7 +489,7 @@ bool cf_FindRealFileNameCaseInsenstive(const char *directory, const char *fname, mprintf((1, "CFILE: Found directory \"%s\" in filename, new filename is \"%s\"\n", real_dir, real_file)); } else { use_dir = false; - real_dir = NULL; + real_dir = nullptr; real_file = (char *)fname; } } @@ -574,7 +596,7 @@ FILE *open_file_in_directory_case_sensitive(const char *directory, const char *f if (cf_FindRealFileNameCaseInsenstive(directory, filename, new_filename)) { // we have a file, open it open and use it char full_path[_MAX_PATH * 2]; - if (directory != NULL) { + if (directory != nullptr) { ddio_MakePath(full_path, directory, new_filename, NULL); } else { strcpy(full_path, new_filename); @@ -583,7 +605,7 @@ FILE *open_file_in_directory_case_sensitive(const char *directory, const char *f return fopen(full_path, mode); } - return NULL; + return nullptr; } #endif @@ -593,7 +615,7 @@ CFILE *open_file_in_directory(const char *filename, const char *mode, const char CFILE *cfile; char path[_MAX_PATH * 2]; char tmode[3] = "rb"; - if (directory != NULL) { + if (directory != nullptr) { // Make a full path ddio_MakePath(path, directory, filename, NULL); } else // no directory specified, so just use filename passed @@ -634,7 +656,7 @@ CFILE *open_file_in_directory(const char *filename, const char *mode, const char fp = open_file_in_directory_case_sensitive(directory, filename, tmode, using_filename); if (!fp) { // no dice - return NULL; + return nullptr; } else { // found a version of the file! mprintf((0, "CFILE: Unable to find %s, but using %s instead\n", filename, using_filename)); @@ -692,9 +714,9 @@ CFILE *cfopen(const char *filename, const char *mode) { ddio_SplitPath(filename, path, fname, ext); // if there is a path specified, use it instead of the libraries, search dirs, etc. // if the file is writable, just open it, instead of looking in libs, etc. - if (strlen(path) || (mode[0] == 'w')) { // found a path - cfile = open_file_in_directory(filename, mode, NULL); // use path specified with file - goto got_file; // don't look in libs, etc. + if (strlen(path) || (mode[0] == 'w')) { // found a path + cfile = open_file_in_directory(filename, mode, nullptr); // use path specified with file + goto got_file; // don't look in libs, etc. } //@@ Don't look in current dir. mt, 3-12-97 //@@ //first look in current directory @@ -722,15 +744,17 @@ CFILE *cfopen(const char *filename, const char *mode) { got_file:; if (cfile) { if (mode[0] == 'w') - cfile->flags |= CF_WRITING; + cfile->flags |= CFF_WRITING; if (mode[1] == 't') - cfile->flags |= CF_TEXT; + cfile->flags |= CFF_TEXT; } return cfile; } + // Returns the length of the specified file // Parameters: cfp - the file pointer returned by cfopen() int cfilelength(CFILE *cfp) { return cfp->size; } + // Closes an open CFILE. // Parameters: cfile - the file pointer returned by cfopen() void cfclose(CFILE *cfp) { @@ -740,9 +764,9 @@ void cfclose(CFILE *cfp) { for (lib = Libraries; lib; lib = lib->next) { if (lib->handle == cfp->lib_handle) { // found the library // if library doesn't already have a file, give it this one - if (lib->file == NULL) { + if (lib->file == nullptr) { lib->file = cfp->file; - cfp->file = NULL; + cfp->file = nullptr; } break; } @@ -757,6 +781,7 @@ void cfclose(CFILE *cfp) { // free the cfile struct mem_free(cfp); } + // Just like stdio fgetc(), except works on a CFILE // Returns a char or EOF int cfgetc(CFILE *cfp) { @@ -775,7 +800,7 @@ int cfgetc(CFILE *cfp) { // do special newline handling for text files: // if CR or LF by itself, return as newline // if CR/LF pair, return as newline - if (cfp->flags & CF_TEXT) { + if (cfp->flags & CFF_TEXT) { if (c == 10) // return LF as newline c = '\n'; else if (c == 13) { // check for CR/LF pair @@ -816,10 +841,13 @@ int cfseek(CFILE *cfp, long int offset, int where) { cfp->position = ftell(cfp->file) - cfp->lib_offset; return c; } + // Just like stdio ftell(), except works on a CFILE int cftell(CFILE *cfp) { return cfp->position; } + // Returns true if at EOF int cfeof(CFILE *cfp) { return (cfp->position >= cfp->size); } + // Tells if the file exists // Returns non-zero if file exists. Also tells if the file is on disk // or in a hog - See return values in cfile.h @@ -830,12 +858,12 @@ int cfexist(const char *filename) { cfp = cfopen(filename, "rb"); if (!cfp) { // Didn't get file. Why? if (errno == EACCES) // File exists, but couldn't open it - return CF_ON_DISK; //..so say it exists on the disk + return CFES_ON_DISK; // so say it exists on the disk // DAJ if (errno != ENOENT) //Check if error is "file not found" // DAJ Int3(); //..warn if not - return CF_NOT_FOUND; // Say we didn't find the file + return CFES_NOT_FOUND; // Say we didn't find the file } - ret = cfp->lib_offset ? CF_IN_LIBRARY : CF_ON_DISK; + ret = cfp->lib_offset ? CFES_IN_LIBRARY : CFES_ON_DISK; cfclose(cfp); return ret; } @@ -847,7 +875,7 @@ int cfexist(const char *filename) { int cf_ReadBytes(ubyte *buf, int count, CFILE *cfp) { int i; char *error_msg = eof_error; // default error - ASSERT(!(cfp->flags & CF_TEXT)); + ASSERT(!(cfp->flags & CFF_TEXT)); if (cfp->position + count <= cfp->size) { i = fread(buf, 1, count, cfp->file); if (i == count) { @@ -871,22 +899,22 @@ int cf_ReadBytes(ubyte *buf, int count, CFILE *cfp) { // to be present. // Read and return an integer (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -int cf_ReadInt(CFILE *cfp) { - int i; +int32_t cf_ReadInt(CFILE *cfp) { + int32_t i; cf_ReadBytes((ubyte *)&i, sizeof(i), cfp); return INTEL_INT(i); } // Read and return a short (16 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -short cf_ReadShort(CFILE *cfp) { - short i; +int16_t cf_ReadShort(CFILE *cfp) { + int16_t i; cf_ReadBytes((ubyte *)&i, sizeof(i), cfp); return INTEL_SHORT(i); } // Read and return a byte (8 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -sbyte cf_ReadByte(CFILE *cfp) { - int i; +int8_t cf_ReadByte(CFILE *cfp) { + int8_t i; i = cfgetc(cfp); if (i == EOF) ThrowCFileError(CFE_READING, cfp, cfeof(cfp) ? eof_error : strerror(errno)); @@ -894,8 +922,8 @@ sbyte cf_ReadByte(CFILE *cfp) { } // Read and return a float (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -float cf_ReadFloat(CFILE *cfp) { - float f; +float_t cf_ReadFloat(CFILE *cfp) { + float_t f; cf_ReadBytes((ubyte *)&f, sizeof(f), cfp); #ifdef MACINTOSH float e = INTEL_FLOAT(f); // DAJ bash to zero if reads a NaN @@ -908,8 +936,8 @@ float cf_ReadFloat(CFILE *cfp) { } // Read and return a double (64 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -double cf_ReadDouble(CFILE *cfp) { - double f; +double_t cf_ReadDouble(CFILE *cfp) { + double_t f; cf_ReadBytes((ubyte *)&f, sizeof(f), cfp); #ifdef OUTRAGE_BIG_ENDIAN { @@ -947,7 +975,7 @@ int cf_ReadString(char *buf, size_t n, CFILE *cfp) { break; } - if ((!(cfp->flags & CF_TEXT) && (c == 0)) || ((cfp->flags & CF_TEXT) && (c == '\n'))) + if ((!(cfp->flags & CFF_TEXT) && (c == 0)) || ((cfp->flags & CFF_TEXT) && (c == '\n'))) break; // end-of-string if (count < n - 1) // store char if room in buffer *bp++ = c; @@ -962,7 +990,7 @@ int cf_ReadString(char *buf, size_t n, CFILE *cfp) { // Throws an exception of type (cfile_error *) if the OS returns an error on write int cf_WriteBytes(const ubyte *buf, int count, CFILE *cfp) { int i; - if (!(cfp->flags & CF_WRITING)) + if (!(cfp->flags & CFF_WRITING)) return 0; ASSERT(count > 0); i = fwrite(buf, 1, count, cfp->file); @@ -984,9 +1012,10 @@ int cf_WriteString(CFILE *cfp, const char *buf) { if (len != 0) // write string cf_WriteBytes((ubyte *)buf, len, cfp); // Terminate with newline (text file) or NULL (binary file) - cf_WriteByte(cfp, (cfp->flags & CF_TEXT) ? '\n' : 0); + cf_WriteByte(cfp, (cfp->flags & CFF_TEXT) ? '\n' : 0); return len + 1; } + // Just like stdio fprintf(), except works on a CFILE int cfprintf(CFILE *cfp, const char *format, ...) { #ifndef MACINTOSH @@ -999,40 +1028,45 @@ int cfprintf(CFILE *cfp, const char *format, ...) { return count; #endif } + // The following functions write numeric vales to a CFILE. All values are // stored to the file in Intel (little-endian) format. // All these throw an exception if there's an error on write. // Write an integer (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteInt(CFILE *cfp, int i) { +void cf_WriteInt(CFILE *cfp, int32_t i) { int t = INTEL_INT(i); cf_WriteBytes((ubyte *)&t, sizeof(t), cfp); } + // Write a short (16 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteShort(CFILE *cfp, short s) { +void cf_WriteShort(CFILE *cfp, int16_t s) { short t = INTEL_SHORT(s); cf_WriteBytes((ubyte *)&t, sizeof(t), cfp); } + // Write a byte (8 bits). // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteByte(CFILE *cfp, sbyte b) { +void cf_WriteByte(CFILE *cfp, int8_t b) { if (fputc(b, cfp->file) == EOF) ThrowCFileError(CFE_WRITING, cfp, strerror(errno)); cfp->position++; // If text file & writing newline, increment again for LF - if ((cfp->flags & CF_TEXT) && (b == '\n')) // check for text mode newline + if ((cfp->flags & CFF_TEXT) && (b == '\n')) // check for text mode newline cfp->position++; } + // Write a float (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteFloat(CFILE *cfp, float f) { +void cf_WriteFloat(CFILE *cfp, float_t f) { float t = INTEL_FLOAT(f); cf_WriteBytes((ubyte *)&t, sizeof(t), cfp); } + // Write a double (64 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteDouble(CFILE *cfp, double d) { +void cf_WriteDouble(CFILE *cfp, double_t d) { #ifdef OUTRAGE_BIG_ENDIAN { double t; @@ -1045,19 +1079,20 @@ void cf_WriteDouble(CFILE *cfp, double d) { #endif cf_WriteBytes((ubyte *)&d, sizeof(d), cfp); } + // Copies a file. Returns TRUE if copied ok. Returns FALSE if error opening either file. // Throws an exception of type (cfile_error *) if the OS returns an error on read or write bool cf_CopyFile(char *dest, const char *src, int copytime) { CFILE *infile, *outfile; if (!stricmp(dest, src)) - return 1; // don't copy files if they are the same + return true; // don't copy files if they are the same infile = (CFILE *)cfopen(src, "rb"); if (!infile) - return 0; + return false; outfile = (CFILE *)cfopen(dest, "wb"); if (!outfile) { cfclose(infile); - return 0; + return false; } int progress = 0; int readcount = 0; @@ -1083,13 +1118,16 @@ bool cf_CopyFile(char *dest, const char *src, int copytime) { if (!infile_lib_offset && copytime) { cf_CopyFileTime(dest, src); } - return 1; + return true; } + // Checks to see if two files are different. // Returns TRUE if the files are different, or FALSE if they are the same. bool cf_Diff(const char *a, const char *b) { return (ddio_FileDiff(a, b)); } + // Copies the file time from one file to another void cf_CopyFileTime(char *dest, const char *src) { ddio_CopyFileTime(dest, src); } + // Changes a files attributes (ie read/write only) void cf_ChangeFileAttributes(const char *name, int attr) { #ifdef MACINTOSH @@ -1099,6 +1137,7 @@ void cf_ChangeFileAttributes(const char *name, int attr) { Int3(); // Get Jason or Matt, file not found! #endif } + // rewinds cfile position void cf_Rewind(CFILE *fp) { if (fp->lib_offset) { @@ -1109,7 +1148,8 @@ void cf_Rewind(CFILE *fp) { } fp->position = 0; } -// Calculates a 32 bit CRC for the specified file. a return code of -1 means file note found + +// Calculates a 32-bit CRC for the specified file. a return code of -1 means file note found #define CRC32_POLYNOMIAL 0xEDB88320L #define CRC_BUFFER_SIZE 5000 @@ -1174,7 +1214,7 @@ unsigned int cf_GetfileCRC(char *src) { } char cfile_search_wildcard[256]; -library *cfile_search_library = NULL; +library *cfile_search_library = nullptr; int cfile_search_curr_index = 0; bool cfile_search_ispattern = false; // the following cf_LibraryFind function are similar to the ddio_Find functions as they look @@ -1220,6 +1260,7 @@ bool cf_LibraryFindFirst(int handle, const char *wildcard, char *buffer) { // we didn't find a match return false; } + bool cf_LibraryFindNext(char *buffer) { while (cfile_search_curr_index < cfile_search_library->nfiles) { if (cfile_search_ispattern) { @@ -1240,8 +1281,9 @@ bool cf_LibraryFindNext(char *buffer) { } return false; } -void cf_LibraryFindClose(void) { - cfile_search_library = NULL; + +void cf_LibraryFindClose() { + cfile_search_library = nullptr; cfile_search_curr_index = 0; cfile_search_ispattern = false; } @@ -1277,7 +1319,7 @@ bool cf_ReadHogFileEntry(int libr, const char *filename, tHogFileEntry *entry, i else // search key before check key last = i - 1; - } while (1); + } while (true); if (found) { strcpy(entry->name, lib->entries[i].name); diff --git a/lib/CFILE.H b/cfile/cfile.h similarity index 91% rename from lib/CFILE.H rename to cfile/cfile.h index 6dd11765..3f4c577b 100644 --- a/lib/CFILE.H +++ b/cfile/cfile.h @@ -76,7 +76,9 @@ #ifndef CFILE_H #define CFILE_H -#include +#include +#include +#include #include "pstypes.h" @@ -94,8 +96,10 @@ typedef struct CFILE { } CFILE; // Defines for cfile_error -#define CFE_READING 1 -#define CFE_WRITING 2 +enum CFileError { + CFE_READING = 1, + CFE_WRITING, +}; // The structure thrown by a cfile error typedef struct { @@ -105,8 +109,17 @@ typedef struct { } cfile_error; // Flags for CFILE struct -#define CF_TEXT 1 // if this bit set, file is text -#define CF_WRITING 2 // if bit set, file opened for writing +enum CFileFlags { + CFF_TEXT = 1, // if this bit set, file is text + CFF_WRITING, // if bit set, file opened for writing +}; + +// return values for cfexist() +enum CFileExitStatus { + CFES_NOT_FOUND = 0, + CFES_ON_DISK, + CFES_IN_LIBRARY, +}; // See if a file is in a hog bool cf_IsFileInHog(char *filename, char *hogname); @@ -130,7 +143,7 @@ void cf_CloseLibrary(int handle); int cf_SetSearchPath(const char *path, ...); // Removes all search paths that have been added by cf_SetSearchPath -void cf_ClearAllSearchPaths(void); +void cf_ClearAllSearchPaths(); // Opens a file for reading or writing // If a path is specified, will try to open the file only in that path. @@ -167,11 +180,6 @@ int cftell(CFILE *cfp); // Returns true if at EOF int cfeof(CFILE *cfp); -// return values for cfexist() -#define CF_NOT_FOUND 0 -#define CF_ON_DISK 1 -#define CF_IN_LIBRARY 2 - // Tells if the file exists // Returns non-zero if file exists. Also tells if the file is on disk // or in a hog - See return values in cfile.h @@ -192,23 +200,23 @@ int cf_ReadBytes(ubyte *buf, int count, CFILE *cfp); // Read and return an integer (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -int cf_ReadInt(CFILE *cfp); +int32_t cf_ReadInt(CFILE *cfp); // Read and return a short (16 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -short cf_ReadShort(CFILE *cfp); +int16_t cf_ReadShort(CFILE *cfp); // Read and return a byte (8 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -sbyte cf_ReadByte(CFILE *cfp); +int8_t cf_ReadByte(CFILE *cfp); // Read and return a float (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -float cf_ReadFloat(CFILE *cfp); +float_t cf_ReadFloat(CFILE *cfp); // Read and return a double (64 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on read -double cf_ReadDouble(CFILE *cfp); +double_t cf_ReadDouble(CFILE *cfp); // Reads a string from a CFILE. If the file is type binary, this // function reads until a NULL or EOF is found. If the file is text, @@ -246,23 +254,23 @@ int cfprintf(CFILE *cfp, const char *format, ...); // Write an integer (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteInt(CFILE *cfp, int i); +void cf_WriteInt(CFILE *cfp, int32_t i); // Write a short (16 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteShort(CFILE *cfp, short s); +void cf_WriteShort(CFILE *cfp, int16_t s); // Write a byte (8 bits). If the byte is a newline & the file is a text file, writes a CR/LF pair. // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteByte(CFILE *cfp, sbyte b); +void cf_WriteByte(CFILE *cfp, int8_t b); // Write a float (32 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteFloat(CFILE *cfp, float f); +void cf_WriteFloat(CFILE *cfp, float_t f); // Write a double (64 bits) // Throws an exception of type (cfile_error *) if the OS returns an error on write -void cf_WriteDouble(CFILE *cfp, double d); +void cf_WriteDouble(CFILE *cfp, double_t d); // Copies a file. Returns TRUE if copied ok. Returns FALSE if error opening either file. // Throws an exception of type (cfile_error *) if the OS returns an error on read or write @@ -279,17 +287,17 @@ void cf_CopyFileTime(char *dest, const char *src); // Changes a files attributes (ie read/write only) void cf_ChangeFileAttributes(const char *name, int attr); -// rewinds cfile position +// rewinds cfile position void cf_Rewind(CFILE *fp); // Calculates a 32 bit CRC unsigned int cf_GetfileCRC(char *src); unsigned int cf_CalculateFileCRC(CFILE *fp); // same as cf_GetfileCRC, except works with CFILE pointers -// the following cf_LibraryFind function are similar to the ddio_Find functions as they look -// for files that match the wildcard passed in, however, this is to be used for hog files. +// the following cf_LibraryFind function are similar to the ddio_Find functions as they look +// for files that match the wildcard passed in, however, this is to be used for hog files. bool cf_LibraryFindFirst(int handle, const char *wildcard, char *buffer); bool cf_LibraryFindNext(char *buffer); -void cf_LibraryFindClose(void); +void cf_LibraryFindClose(); #endif diff --git a/cfile/hog.cpp b/cfile/hogfile.cpp similarity index 67% rename from cfile/hog.cpp rename to cfile/hogfile.cpp index 1128ff59..474f1a93 100644 --- a/cfile/hog.cpp +++ b/cfile/hogfile.cpp @@ -102,7 +102,7 @@ #include "linux/linux_fix.h" #endif #include "byteswap.h" -#include "hogfile.h" +#include "cfile/hogfile.h" #include "pstypes.h" #include "Macros.h" #include "mem.h" @@ -152,7 +152,7 @@ bool FileCopy(FILE *ofp, FILE *ifp, int length) { return true; } bool ReadHogHeader(FILE *fp, tHogHeader *header) { - int res = 0; + int res; res = fread(&header->nfiles, sizeof(header->nfiles), 1, fp); header->nfiles = INTEL_INT(header->nfiles); res = fread(&header->file_data_offset, sizeof(header->file_data_offset), 1, fp); @@ -164,7 +164,7 @@ bool ReadHogHeader(FILE *fp, tHogHeader *header) { return false; } bool ReadHogEntry(FILE *fp, tHogFileEntry *entry) { - int res = 0; + int res; res = fread(entry->name, sizeof(char), HOG_FILENAME_LEN, fp); res = fread(&entry->flags, sizeof(entry->flags), 1, fp); entry->flags = INTEL_INT(entry->flags); @@ -179,8 +179,8 @@ bool ReadHogEntry(FILE *fp, tHogFileEntry *entry) { return false; } -bool WRITE_FILE_ENTRY(FILE *fp, tHogFileEntry *entry) { - int res = 0; +bool WriteHogEntry(FILE *fp, tHogFileEntry *entry) { + int res; res = fwrite(entry->name, sizeof(char), HOG_FILENAME_LEN, fp); res = fwrite(&entry->flags, sizeof(entry->flags), 1, fp); res = fwrite(&entry->len, sizeof(entry->len), 1, fp); @@ -191,127 +191,11 @@ bool WRITE_FILE_ENTRY(FILE *fp, tHogFileEntry *entry) { else return false; } -//////////////////////////////////////////////////////////////////////// -// create new hog file -int NewHogFile(const char *hogname, int nfiles, const char **filenames) { - unsigned i; - int table_pos; - FILE *hog_fp; - tHogHeader header; - tHogFileEntry *table; - char ext[_MAX_EXT]; - hogerr_filename[0] = '\0'; - // allocate file table - if (nfiles <= 0) - return HOGMAKER_ERROR; - table = new tHogFileEntry[nfiles]; - if (!table) - return HOGMAKER_MEMORY; - // create new file - hog_fp = fopen(hogname, "wb"); - if (hog_fp == NULL) { - delete[] table; - strcpy(hogerr_filename, hogname); - return HOGMAKER_OPENOUTFILE; - } - // write the tag - if (!fwrite(HOG_TAG_STR, strlen(HOG_TAG_STR), 1, hog_fp)) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, hogname); - return HOGMAKER_OUTFILE; - } - // write number of files - ubyte filler = 0xff; - header.nfiles = (unsigned)nfiles; - header.file_data_offset = strlen(HOG_TAG_STR) + HOG_HDR_SIZE + (sizeof(tHogFileEntry) * header.nfiles); - if (!fwrite(&header.nfiles, sizeof(header.nfiles), 1, hog_fp)) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, hogname); - return HOGMAKER_OUTFILE; - } - if (!fwrite(&header.file_data_offset, sizeof(header.file_data_offset), 1, hog_fp)) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, hogname); - return HOGMAKER_OUTFILE; - } - // write out filler - for (i = 0; i < HOG_HDR_SIZE - sizeof(tHogHeader); i++) - if (!fwrite(&filler, sizeof(ubyte), 1, hog_fp)) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, hogname); - return HOGMAKER_OUTFILE; - } - // save file position of index table and write out dummy table - table_pos = strlen(HOG_TAG_STR) + HOG_HDR_SIZE; - memset(&table[0], 0, sizeof(table[0])); - for (i = 0; i < header.nfiles; i++) { - if (!WRITE_FILE_ENTRY(hog_fp, &table[0])) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, hogname); - return HOGMAKER_OUTFILE; - } - } - // write files (& build index) - for (i = 0; i < header.nfiles; i++) { - FILE *ifp; -#if defined(__LINUX__) || defined(MACINTOSH) - struct stat mystat; -#else - struct _stat32 mystat; -#endif - ifp = fopen(filenames[i], "rb"); - if (ifp == NULL) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, filenames[i]); - return HOGMAKER_INFILE; - } - // JEFF: make call to ddio lib, linux doesn't have _splitpath - //_splitpath(filenames[i],NULL,NULL,table[i].name,ext); - ddio_SplitPath(filenames[i], NULL, table[i].name, ext); - _fstat32(fileno(ifp), &mystat); - - strcat(table[i].name, ext); - table[i].flags = 0; -#ifdef MACINTOSH - table[i].len = mystat.st_size; -#else - table[i].len = _filelength(fileno(ifp)); -#endif - table[i].timestamp = mystat.st_mtime; - if (!FileCopy(hog_fp, ifp, table[i].len)) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, filenames[i]); - return HOGMAKER_COPY; - } - fclose(ifp); - } - // now write the real index - fseek(hog_fp, table_pos, SEEK_SET); - for (i = 0; i < header.nfiles; i++) { - if (!WRITE_FILE_ENTRY(hog_fp, &table[i])) { - delete[] table; - fclose(hog_fp); - strcpy(hogerr_filename, hogname); - return HOGMAKER_OUTFILE; - } - } - // cleanup - fclose(hog_fp); - delete[] table; - return HOGMAKER_OK; -} -// A modifed version of NewHogFile() +// A modified version of NewHogFile() // This one also takes a pointer to a function that will perform // progress updates (for the user) -int CreateNewHogFile(const char *hogname, int nfiles, const char **filenames, void (*UpdateFunction)(char *)) { +int NewHogFile(const char *hogname, int nfiles, const char **filenames, void (*UpdateFunction)(char *)) { unsigned i; int table_pos; FILE *hog_fp; @@ -319,7 +203,7 @@ int CreateNewHogFile(const char *hogname, int nfiles, const char **filenames, vo tHogFileEntry *table; char ext[_MAX_EXT]; hogerr_filename[0] = '\0'; - // allocate file table + // allocate file table if (nfiles <= 0) return HOGMAKER_ERROR; table = new tHogFileEntry[nfiles]; @@ -367,7 +251,7 @@ int CreateNewHogFile(const char *hogname, int nfiles, const char **filenames, vo table_pos = strlen(HOG_TAG_STR) + HOG_HDR_SIZE; memset(&table[0], 0, sizeof(table[0])); for (i = 0; i < header.nfiles; i++) { - if (!WRITE_FILE_ENTRY(hog_fp, &table[0])) { + if (!WriteHogEntry(hog_fp, &table[0])) { delete[] table; fclose(hog_fp); strcpy(hogerr_filename, hogname); @@ -408,30 +292,32 @@ int CreateNewHogFile(const char *hogname, int nfiles, const char **filenames, vo return HOGMAKER_COPY; } fclose(ifp); - // Setup the update message and send it - char msg[256]; - int ipct = int(100.0 * (double(i) / double(header.nfiles))); - snprintf(msg, sizeof(msg), "Creating Hog File... (%d%% done)", ipct); - if (UpdateFunction != NULL) + if (UpdateFunction != nullptr) { + // Setup the update message and send it + char msg[256]; + int ipct = int(100.0 * (double(i) / double(header.nfiles))); + snprintf(msg, sizeof(msg), "Creating Hog File... (%d%% done)", ipct); UpdateFunction(msg); + } } // now write the real index fseek(hog_fp, table_pos, SEEK_SET); for (i = 0; i < header.nfiles; i++) { - if (!WRITE_FILE_ENTRY(hog_fp, &table[i])) { + if (!WriteHogEntry(hog_fp, &table[i])) { delete[] table; fclose(hog_fp); strcpy(hogerr_filename, hogname); return HOGMAKER_OUTFILE; } } - // cleanup + // cleanup fclose(hog_fp); delete[] table; - // Setup the update message and send it - char msg[256]; - snprintf(msg, sizeof(msg), "Done Creating Hog File."); - if (UpdateFunction != NULL) + if (UpdateFunction != nullptr) { + // Setup the update message and send it + char msg[256]; + snprintf(msg, sizeof(msg), "Done Creating Hog File."); UpdateFunction(msg); + } return HOGMAKER_OK; } diff --git a/lib/hogfile.h b/cfile/hogfile.h similarity index 70% rename from lib/hogfile.h rename to cfile/hogfile.h index d141d55c..6c709e80 100644 --- a/lib/hogfile.h +++ b/cfile/hogfile.h @@ -60,6 +60,7 @@ #ifndef HOGFILE_H #define HOGFILE_H +#include #include "pstypes.h" #define HOG_HDR_SIZE (64) @@ -67,37 +68,37 @@ #define HOG_FILENAME_LEN (36) typedef struct tHogHeader { - unsigned nfiles; // number of files in header - unsigned file_data_offset; // offset in file to filedata. + uint32_t nfiles; // number of files in header + uint32_t file_data_offset; // offset in file to filedata. } tHogHeader; typedef struct tHogFileEntry { char name[HOG_FILENAME_LEN]; // file name - unsigned flags; // extra info - unsigned len; // length of file - unsigned timestamp; // time of file. + uint32_t flags; // extra info + uint32_t len; // length of file + uint32_t timestamp; // time of file. } tHogFileEntry; -#define HOGMAKER_ERROR 0 // Incorrect number of files passed in -#define HOGMAKER_OK 1 // Hog file was created successfully -#define HOGMAKER_MEMORY 2 // Could not allocated hog entry table -#define HOGMAKER_OUTFILE 3 // Error occurred writing to output hog file -#define HOGMAKER_INFILE 4 // An input file could not be found (filename is stored in hogerr_filename) -#define HOGMAKER_COPY 5 // An error occurred copying an input file into the hog file -#define HOGMAKER_OPENOUTFILE 6 // The specified hog file could not be opened for output +enum HogErrors { + HOGMAKER_ERROR = 0, // Incorrect number of files passed in + HOGMAKER_OK, // Hog file was created successfully + HOGMAKER_MEMORY, // Could not allocate hog entry table + HOGMAKER_OUTFILE, // Error occurred writing to output hog file + HOGMAKER_INFILE, // An input file could not be found (filename is stored in hogerr_filename) + HOGMAKER_COPY, // An error occurred copying an input file into the hog file + HOGMAKER_OPENOUTFILE, // The specified hog file could not be opened for output +}; // Used to return filenames involved in a NewHogFile() error extern char hogerr_filename[PSPATHNAME_LEN]; -int NewHogFile(const char *hogname, int nfiles, const char **filenames); +int NewHogFile(const char *hogname, int nfiles, const char **filenames, void (*UpdateFunction)(char *) = nullptr); bool ReadHogHeader(FILE *fp, tHogHeader *header); bool ReadHogEntry(FILE *fp, tHogFileEntry *entry); -bool WRITE_FILE_ENTRY(FILE *fp, tHogFileEntry *entry); +bool WriteHogEntry(FILE *fp, tHogFileEntry *entry); bool FileCopy(FILE *ofp, FILE *ifp, int length); -int CreateNewHogFile(const char *hogname, int nfiles, const char **filenames, void (*UpdateFunction)(char *)); - // returns hog cfile info, using a library handle opened via cf_OpenLibrary. bool cf_ReadHogFileEntry(int library, const char *filename, tHogFileEntry *entry, int *fileoffset); -#endif \ No newline at end of file +#endif diff --git a/cfile/InfFile.cpp b/cfile/inffile.cpp similarity index 97% rename from cfile/InfFile.cpp rename to cfile/inffile.cpp index 5be72c22..c78d2b59 100644 --- a/cfile/InfFile.cpp +++ b/cfile/inffile.cpp @@ -20,21 +20,21 @@ // ////////////////////////////////////////////////////////////////////// -#include "InfFile.h" +#include "cfile/inffile.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstring.h" #include "pserror.h" #include -#define INFFILE_NULL -1024 +#define INFFILE_NULL (-1024) ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -InfFile::InfFile() { m_fp = NULL; } +InfFile::InfFile() { m_fp = nullptr; } InfFile::~InfFile() { // close file and free symbol lists @@ -74,7 +74,7 @@ const char *InfFile::GetSymbolText(const char *name) { return (const char *)sym->t.text; } - return NULL; + return nullptr; } // opens an inf file, pass in a lexical analyzer that will return a command index. diff --git a/lib/InfFile.h b/cfile/inffile.h similarity index 85% rename from lib/InfFile.h rename to cfile/inffile.h index d7d55723..22ae31da 100644 --- a/lib/InfFile.h +++ b/cfile/inffile.h @@ -20,8 +20,8 @@ // ////////////////////////////////////////////////////////////////////// -#if !defined(AFX_INFFILE_H__D8F94664_216E_11D2_AF2D_0060089A8025__INCLUDED_) -#define AFX_INFFILE_H__D8F94664_216E_11D2_AF2D_0060089A8025__INCLUDED_ +#ifndef INFFILE_H +#define INFFILE_H #if _MSC_VER >= 1000 #pragma once @@ -32,12 +32,14 @@ struct CFILE; -#define INFFILE_LINELEN 256 -#define INFFILE_CUSTOM -128 -#define INFFILE_ERROR -1 -#define INFFILE_COMMENT -2 -#define INFFILE_EOL -3 -#define INFFILE_SYMBOL 1024 +enum InfFileError { + INFFILE_LINELEN = 256, + INFFILE_CUSTOM = -128, + INFFILE_ERROR = -1, + INFFILE_COMMENT = -2, + INFFILE_EOL = -3, + INFFILE_SYMBOL = 1024, +}; class InfFile { public: @@ -86,4 +88,4 @@ public: int line() const { return m_line; }; }; -#endif // !defined(AFX_INFFILE_H__D8F94664_216E_11D2_AF2D_0060089A8025__INCLUDED_) +#endif diff --git a/dd_lnxsound/lnxsound.cpp b/dd_lnxsound/lnxsound.cpp index 86c25b0d..2052c62d 100644 --- a/dd_lnxsound/lnxsound.cpp +++ b/dd_lnxsound/lnxsound.cpp @@ -108,7 +108,7 @@ #include #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "mono.h" #include "soundload.h" diff --git a/dd_lnxsound/sdlsound.cpp b/dd_lnxsound/sdlsound.cpp index e8591491..89850a64 100644 --- a/dd_lnxsound/sdlsound.cpp +++ b/dd_lnxsound/sdlsound.cpp @@ -30,7 +30,7 @@ #include #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "mono.h" #include "soundload.h" diff --git a/dd_sndlib/Ds3dlib.cpp b/dd_sndlib/Ds3dlib.cpp index 8e0e22b6..6299e072 100644 --- a/dd_sndlib/Ds3dlib.cpp +++ b/dd_sndlib/Ds3dlib.cpp @@ -211,7 +211,7 @@ #include #include #include -#include "cfile.h" +#include "cfile/cfile.h" #include "pserror.h" #include "mono.h" #include "soundload.h" diff --git a/dd_sndlib/aureal3d.cpp b/dd_sndlib/aureal3d.cpp index 60312ad7..b00c4901 100644 --- a/dd_sndlib/aureal3d.cpp +++ b/dd_sndlib/aureal3d.cpp @@ -98,7 +98,7 @@ #include "pserror.h" #include "logfile.h" #include "Macros.h" -#include "inffile.h" +#include "cfile/inffile.h" typedef struct tA3D { diff --git a/dd_sndlib/ddsoundload.cpp b/dd_sndlib/ddsoundload.cpp index 9246daba..3c83b842 100644 --- a/dd_sndlib/ddsoundload.cpp +++ b/dd_sndlib/ddsoundload.cpp @@ -101,7 +101,7 @@ #else #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "mem.h" #include "pserror.h" #include diff --git a/ddio_mac/macfile.cpp b/ddio_mac/macfile.cpp index 5f5e1e9f..2ea467ae 100644 --- a/ddio_mac/macfile.cpp +++ b/ddio_mac/macfile.cpp @@ -82,7 +82,7 @@ #include "ddio_mac.h" #include "psglob.h" #include "mem.h" -#include "cfile.h" +#include "cfile/cfile.h" // --------------------------------------------------------------------------- // File Level Globals // --------------------------------------------------------------------------- diff --git a/grtext/grfont.cpp b/grtext/grfont.cpp index 520cb342..3a809312 100644 --- a/grtext/grfont.cpp +++ b/grtext/grfont.cpp @@ -108,7 +108,7 @@ */ #include "grtextlib.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "bitmap.h" #include "pserror.h" #include "renderer.h" diff --git a/lib/bitmap.h b/lib/bitmap.h index 92999409..039b75de 100644 --- a/lib/bitmap.h +++ b/lib/bitmap.h @@ -19,7 +19,7 @@ #ifndef PSBITMAP_H #define PSBITMAP_H #include "pstypes.h" -#include "CFILE.H" +#include "cfile/cfile.h" #ifdef __LINUX__ #include "linux/linux_fix.h" //needed for stricmp's throughout bitmap lib #endif diff --git a/lib/manage.h b/lib/manage.h index da008693..012a62e9 100644 --- a/lib/manage.h +++ b/lib/manage.h @@ -21,7 +21,7 @@ #define MANAGE_H #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "bitmap.h" #include "manage_external.h" diff --git a/lnxcontroller/lnxcontroller.cpp b/lnxcontroller/lnxcontroller.cpp index e1e4486f..0bf20c6c 100644 --- a/lnxcontroller/lnxcontroller.cpp +++ b/lnxcontroller/lnxcontroller.cpp @@ -47,7 +47,7 @@ #include "ddio.h" #include "pserror.h" #include "joystick.h" -#include "InfFile.h" +#include "cfile/inffile.h" // Sorry! This is needed for the semi-hacky mouselook support #include "descent.h" diff --git a/mac/MACDATA.CPP b/mac/MACDATA.CPP index d5602b0c..1026b6fb 100644 --- a/mac/MACDATA.CPP +++ b/mac/MACDATA.CPP @@ -8,7 +8,7 @@ #include "appdatabase.h" #include #include "mem.h" -#include "cfile.h" +#include "cfile/cfile.h" #include "ddio.h" #include "ddio_mac.h" #include "descent.h" diff --git a/mac/MACGAMESPY.CPP b/mac/MACGAMESPY.CPP index ccab9dfd..afa4c960 100644 --- a/mac/MACGAMESPY.CPP +++ b/mac/MACGAMESPY.CPP @@ -32,7 +32,7 @@ #include "descent.h" #include "ddio.h" #include "args.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "program.h" #include #include diff --git a/mac/MACSOUND.CPP b/mac/MACSOUND.CPP index 57de93c8..148cfd2d 100644 --- a/mac/MACSOUND.CPP +++ b/mac/MACSOUND.CPP @@ -25,7 +25,7 @@ #include #include // #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include "mono.h" #include "soundload.h" diff --git a/mac/MACSTREAMAUDIO.CPP b/mac/MACSTREAMAUDIO.CPP index b4759c17..025b0a66 100644 --- a/mac/MACSTREAMAUDIO.CPP +++ b/mac/MACSTREAMAUDIO.CPP @@ -149,7 +149,7 @@ #include #include "streamaudio.h" #include "pserror.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "mem.h" #include "Macros.h" #include "ddio.h" diff --git a/manage/doorpage.cpp b/manage/doorpage.cpp index c7477eb3..f30005d2 100644 --- a/manage/doorpage.cpp +++ b/manage/doorpage.cpp @@ -147,7 +147,7 @@ #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "door.h" #include "doorpage.h" diff --git a/manage/doorpage.h b/manage/doorpage.h index e07eddef..c6a5c0b1 100644 --- a/manage/doorpage.h +++ b/manage/doorpage.h @@ -21,7 +21,7 @@ #include "manage.h" #include "door.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" typedef struct { diff --git a/manage/gamefilepage.cpp b/manage/gamefilepage.cpp index 0a799756..4c1783cb 100644 --- a/manage/gamefilepage.cpp +++ b/manage/gamefilepage.cpp @@ -20,7 +20,7 @@ #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "mono.h" #include "pserror.h" diff --git a/manage/gamefilepage.h b/manage/gamefilepage.h index da05515b..93926105 100644 --- a/manage/gamefilepage.h +++ b/manage/gamefilepage.h @@ -20,7 +20,7 @@ #define GAMEFILEPAGE_H #include "manage.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" #include "gamefile.h" diff --git a/manage/generic.cpp b/manage/generic.cpp index 03bc06ce..6f0814d7 100644 --- a/manage/generic.cpp +++ b/manage/generic.cpp @@ -355,7 +355,7 @@ #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "genericpage.h" #include "soundpage.h" diff --git a/manage/genericpage.h b/manage/genericpage.h index 02b00a43..28fb4b44 100644 --- a/manage/genericpage.h +++ b/manage/genericpage.h @@ -20,7 +20,7 @@ #define GENERICPAGE_H #include "manage.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" #include "objinfo.h" #include "robotfirestruct.h" diff --git a/manage/manage.cpp b/manage/manage.cpp index 57c9b0d2..6422326c 100644 --- a/manage/manage.cpp +++ b/manage/manage.cpp @@ -456,7 +456,7 @@ #include "mono.h" #include "object.h" #include "ddio.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "appdatabase.h" #include "genericpage.h" #include "mem.h" diff --git a/manage/megapage.cpp b/manage/megapage.cpp index b5ef0157..8e525c78 100644 --- a/manage/megapage.cpp +++ b/manage/megapage.cpp @@ -64,7 +64,7 @@ #if defined(WIN32) #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "megacell.h" #include "megapage.h" diff --git a/manage/megapage.h b/manage/megapage.h index 8ed3a335..333c391f 100644 --- a/manage/megapage.h +++ b/manage/megapage.h @@ -21,7 +21,7 @@ #include "manage.h" #include "megacell.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" typedef struct { diff --git a/manage/pagelock.cpp b/manage/pagelock.cpp index f25ecfd2..3de8bdb2 100644 --- a/manage/pagelock.cpp +++ b/manage/pagelock.cpp @@ -178,7 +178,7 @@ #include #include #include -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "pstypes.h" #include "pserror.h" diff --git a/manage/powerpage.h b/manage/powerpage.h index e284e6ab..3854203c 100644 --- a/manage/powerpage.h +++ b/manage/powerpage.h @@ -20,7 +20,7 @@ #define POWERPAGE_H #include "manage.h" -#include "cfile.h" +#include "cfile/cfile.h" #include "pstypes.h" #include "powerup.h" diff --git a/manage/robotpage.h b/manage/robotpage.h index b84be762..c30c7334 100644 --- a/manage/robotpage.h +++ b/manage/robotpage.h @@ -21,7 +21,7 @@ #include "manage.h" #include "robot.h" -#include "cfile.h" +#include "cfile/cfile.h" #include "pstypes.h" #include "objinfo.h" diff --git a/manage/shippage.cpp b/manage/shippage.cpp index 2239f217..e04b9323 100644 --- a/manage/shippage.cpp +++ b/manage/shippage.cpp @@ -201,7 +201,7 @@ #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "ship.h" #include "shippage.h" diff --git a/manage/shippage.h b/manage/shippage.h index defe097e..d5f4167c 100644 --- a/manage/shippage.h +++ b/manage/shippage.h @@ -21,7 +21,7 @@ #include "manage.h" #include "ship.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" typedef struct { diff --git a/manage/soundpage.cpp b/manage/soundpage.cpp index 2fa4d981..785f8281 100644 --- a/manage/soundpage.cpp +++ b/manage/soundpage.cpp @@ -120,7 +120,7 @@ #if defined(WIN32) #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "soundpage.h" #include "mono.h" diff --git a/manage/soundpage.h b/manage/soundpage.h index f7b20d4f..83fb3434 100644 --- a/manage/soundpage.h +++ b/manage/soundpage.h @@ -21,7 +21,7 @@ #include "manage.h" #include "soundload.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" typedef struct { diff --git a/manage/texpage.cpp b/manage/texpage.cpp index 5970c0c9..0eea3b06 100644 --- a/manage/texpage.cpp +++ b/manage/texpage.cpp @@ -261,7 +261,7 @@ #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "gametexture.h" #include "bitmap.h" diff --git a/manage/texpage.h b/manage/texpage.h index 033e69af..3bc97945 100644 --- a/manage/texpage.h +++ b/manage/texpage.h @@ -20,7 +20,7 @@ #define TEXPAGE_H #include "manage.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" #include "procedurals.h" diff --git a/manage/weaponpage.cpp b/manage/weaponpage.cpp index de4791c4..7aae051b 100644 --- a/manage/weaponpage.cpp +++ b/manage/weaponpage.cpp @@ -290,7 +290,7 @@ #include #endif -#include "CFILE.H" +#include "cfile/cfile.h" #include "manage.h" #include "weapon.h" #include "weaponpage.h" diff --git a/manage/weaponpage.h b/manage/weaponpage.h index c9699bcc..8c5a1c2a 100644 --- a/manage/weaponpage.h +++ b/manage/weaponpage.h @@ -22,7 +22,7 @@ #include "manage.h" #include "weapon.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pstypes.h" typedef struct { diff --git a/music/omflex.cpp b/music/omflex.cpp index 180509d4..dfe9e6ef 100644 --- a/music/omflex.cpp +++ b/music/omflex.cpp @@ -73,7 +73,7 @@ #include "music.h" #include "musiclib.h" -#include "InfFile.h" +#include "cfile/inffile.h" #include "mem.h" #include diff --git a/music/sequencer.cpp b/music/sequencer.cpp index 79c9c935..a175b040 100644 --- a/music/sequencer.cpp +++ b/music/sequencer.cpp @@ -150,7 +150,7 @@ #include "pserror.h" #include "ddio.h" #include "Macros.h" -#include "InfFile.h" +#include "cfile/inffile.h" #include "streamaudio.h" #include "mem.h" #include diff --git a/rtperformance/rtperformance.cpp b/rtperformance/rtperformance.cpp index f97c0fc8..e7455ad8 100644 --- a/rtperformance/rtperformance.cpp +++ b/rtperformance/rtperformance.cpp @@ -64,7 +64,7 @@ #include "descent.h" #include "manage.h" #include "ddio.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include #include diff --git a/sndlib/soundload.cpp b/sndlib/soundload.cpp index 89fb30c1..36b536c1 100644 --- a/sndlib/soundload.cpp +++ b/sndlib/soundload.cpp @@ -234,7 +234,7 @@ #include #include "ssl_lib.h" #include "object.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "ddio.h" #include "soundload.h" #include "weapon.h" diff --git a/stream_audio/osfarchive.cpp b/stream_audio/osfarchive.cpp index 72154c6d..133b4364 100644 --- a/stream_audio/osfarchive.cpp +++ b/stream_audio/osfarchive.cpp @@ -51,7 +51,7 @@ */ #include "streamaudio.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "pserror.h" #include diff --git a/stream_audio/streamaudio.cpp b/stream_audio/streamaudio.cpp index 5a2b7520..539ef052 100644 --- a/stream_audio/streamaudio.cpp +++ b/stream_audio/streamaudio.cpp @@ -166,7 +166,7 @@ */ #include "streamaudio.h" #include "pserror.h" -#include "CFILE.H" +#include "cfile/cfile.h" #include "mem.h" #include "Macros.h" #include "ddio.h" diff --git a/win32/WinController.cpp b/win32/WinController.cpp index 698dd9b3..3b1ace15 100644 --- a/win32/WinController.cpp +++ b/win32/WinController.cpp @@ -320,7 +320,7 @@ #include "ddio.h" #include "joystick.h" #include "Macros.h" -#include "inffile.h" +#include "cfile/inffile.h" // Sorry! This is needed for the semi-hacky mouselook support #include "descent.h"