diff --git a/Editor/Editor All.h b/Editor/Editor All.h deleted file mode 100644 index da876d15c..000000000 --- a/Editor/Editor All.h +++ /dev/null @@ -1,127 +0,0 @@ -#include "BuildDefines.h" - -#ifndef __EDITOR_ALL_H -#define __EDITOR_ALL_H - -#ifdef JA2EDITOR - -#pragma message("GENERATED PCH FOR EDITOR PROJECT.") - -//external -#include "types.h" -#include -#include -#include "Action Items.h" -#include "Button System.h" -#include "debug.h" -#include "english.h" -#include "environment.h" -#include "Exit Grids.h" -#include "font.h" -#include "Font Control.h" -#include "Keys.h" -#include "input.h" -#include "interface.h" -#include "Interface Items.h" -#include "Isometric Utils.h" -#include "interface panels.h" -#include "lighting.h" -#include "Map Information.h" -#include "mousesystem.h" -#include "Overhead.h" -#include "Overhead map.h" -#include "overhead types.h" -#include "pits.h" -#include "random.h" -#include "Render Fun.h" -#include "Render Dirty.h" -#include "renderworld.h" -#include "Simple Render Utils.h" -#include "Soldier Create.h" -#include "Soldier Find.h" -#include "sysutil.h" -#include "Text.h" -#include "Text Input.h" -#include "tiledef.h" -#include "utilities.h" -#include "video.h" -#include "vobject.h" -#include "vobject_blitters.h" -#include "vsurface.h" -#include "wcheck.h" -#include "weapons.h" -#include "wordwrap.h" -#include "WorldDat.h" -#include "worlddef.h" -#include "World Items.h" -#include "worldman.h" -#include "line.h" -#include "Animation Data.h" -#include "Animation Control.h" -#include "Soldier Init List.h" -#include "StrategicMap.h" -#include "Soldier Add.h" -#include "Soldier Control.h" -#include "soldier profile type.h" -#include "Soldier Profile.h" -#include "Inventory Choosing.h" -#include "Scheduling.h" -#include "Timer Control.h" -#include "sgp.h" -#include "screenids.h" -#include "Sys Globals.h" -#include "Interactive Tiles.h" -#include "Handle UI.h" -#include "Event Pump.h" -#include "message.h" -#include "Game Clock.h" -#include "Game Init.h" -#include "Map Edgepoints.h" -#include "Music Control.h" -#include -#include "Item Types.h" -#include "Items.h" -#include "Handle Items.h" -#include "Animated ProgressBar.h" -#include "gameloop.h" -#include -#include "Structure Internals.h" -#include "Cursors.h" -#include "FileMan.h" -#include "Summary Info.h" -#include "time.h" -#include "structure wrap.h" -#include "MessageBoxScreen.h" -#include "GameSettings.h" - - -//internal -#include "Cursor Modes.h" -#include "edit_sys.h" -#include "Editor Callback Prototypes.h" -#include "Editor Modes.h" -#include "Editor Taskbar Creation.h" -#include "Editor Taskbar Utils.h" -#include "Editor Undo.h" -#include "EditorBuildings.h" -#include "EditorDefines.h" -#include "EditorItems.h" -#include "EditorMapInfo.h" -#include "EditorMercs.h" -#include "EditorTerrain.h" -#include "editscreen.h" -#include "Item Statistics.h" -#include "LoadScreen.h" -#include "messagebox.h" -#include "newsmooth.h" -#include "popupmenu.h" -#include "Road Smoothing.h" -#include "Sector Summary.h" -#include "selectwin.h" -#include "SmartMethod.h" -#include "smooth.h" -#include "Smoothing Utils.h" - -#endif - -#endif diff --git a/Editor/XML_ActionItems.cpp b/Editor/XML_ActionItems.cpp index 75ad25368..cc807bbcf 100644 --- a/Editor/XML_ActionItems.cpp +++ b/Editor/XML_ActionItems.cpp @@ -3,7 +3,6 @@ #include "Editor All.h" #include "LuaInitNPCs.h" #else - #include "Editor All.h" #include "sgp.h" #include "Debug Control.h" #include "expat.h" diff --git a/JA2 All.h b/JA2 All.h deleted file mode 100644 index 8b94935ea..000000000 --- a/JA2 All.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef __JA2_ALL_H -#define __JA2_ALL_H - -#pragma message("GENERATED PCH FOR JA2 PROJECT.") - -#include "builddefines.h" - -#include -#include -#include -#include "sgp.h" -#include "gameloop.h" -#include "himage.h" -#include "vobject.h" -#include "vobject_private.h" -#include "vobject_blitters.h" -#include "Types.h" -#include "wcheck.h" -#include "renderworld.h" -#include "input.h" -#include "screenids.h" -#include "overhead.h" -#include "Isometric Utils.h" -#include "sysutil.h" -#include "Radar Screen.h" -#include "Soldier Control.h" -#include "Animation Control.h" -#include "Animation Data.h" -#include "Event Pump.h" -#include "Timer Control.h" -#include "Render Dirty.h" -#include "Sys Globals.h" -#include "interface.h" -#include "soldier ani.h" -#include -#include -#include "english.h" -#include "Fileman.h" -#include "messageboxscreen.h" -#include "sgp.h" -#include "fade screen.h" -#include "cursor control.h" -#include "music control.h" -#include "GameInitOptionsScreen.h" -#include "GameSettings.h" -#include "Utilities.h" -#include "Font Control.h" -#include "WordWrap.h" -#include "Options Screen.h" -#include "cursors.h" -#include "Screens.h" -#include "init.h" -#include "laptop.h" -#include "mapscreen.h" -#include "Game Clock.h" -#include "LibraryDataBase.h" -#include "Map Screen Interface.h" -#include "Tactical Save.h" -#include "Interface Control.h" -#include "text.h" -#include "Handle UI.h" -#include "Button System.h" -#include "lighting.h" -#include "environment.h" -#include "bullets.h" -#include "message.h" -#include -#include "overhead map.h" -#include "Strategic Exit GUI.h" -#include "strategic movement.h" -#include "Tactical Placement GUI.h" -#include "Air raid.h" -#include "game init.h" -//DEF: Test Code -#ifdef NETWORKED -#include "Networking.h" -#endif -#include "physics.h" -#include "dialogue control.h" -#include "soldier macros.h" -#include "faces.h" -#include "strategicmap.h" -#include "gamescreen.h" -#include "strategic turns.h" -#include "merc entering.h" -#include "soldier create.h" -#include "Soldier Init List.h" -#include "interface panels.h" -#include "Map Information.h" -#include "Squads.h" -#include "interface dialogue.h" -#include "auto bandage.h" -#include "meanwhile.h" -#include "strategic ai.h" -#include "Sound Control.h" -#include "SaveLoadScreen.h" -#include "GameVersion.h" -#include "Debug.h" -#include "Language Defines.h" -#include "mousesystem.h" -#include "worlddef.h" -#include "video.h" -#include "interface items.h" -#include "Maputility.h" -#include "strategic.h" -#include "NPC.h" -#include "MercTextBox.h" -#include "tile cache.h" -#include "Shade Table Util.h" -#include "Exit Grids.h" -#include "Summary Info.h" -#include -#include "font.h" -#include "timer.h" -#include "tiledef.h" -#include "editscreen.h" -#include "jascreens.h" -#include "animation cache.h" -#include "mainmenuscreen.h" -#include "Random.h" -#include "Multi Language Graphic Utils.h" -#include "SaveLoadGame.h" -#include "Text Input.h" -#include "Slider.h" -#include "soundman.h" -#include "Ambient Control.h" -#include "Worlddat.h" -#include "Gap.h" -#include "Soldier Profile.h" -#include "Keys.h" -#include "finances.h" -#include "History.h" -#include "files.h" -#include "Email.h" -#include "Game Events.h" -#include "LaptopSave.h" -#include "Queen Command.h" -#include "Quests.h" -#include "opplist.h" -#include "Merc Hiring.h" -#include "Ai.h" -#include "SmokeEffects.h" -#include "Map Screen Interface Border.h" -#include "Map Screen Interface Bottom.h" -#include "Map Screen Helicopter.h" -#include "Arms Dealer Init.h" -#include "Strategic Mines.h" -#include "Strategic Town Loyalty.h" -#include "Vehicles.h" -#include "Merc Contract.h" -#include "Strategic Pathing.h" -#include "TeamTurns.h" -#include "explosion control.h" -#include "Creature Spreading.h" -#include "Strategic Status.h" -#include "Boxing.h" -#include "Map Screen Interface Map.h" -#include "lighteffects.h" -#include "JA2 Splash.h" -#include "Scheduling.h" -#include "_JA25EnglishText.h" -#include "XML.h" -#include "LogicalBodyTypes/BodyTypeDB.h" -#include "LogicalBodyTypes/Layers.h" -#include "LogicalBodyTypes/AbstractXMLLoader.h" -#include "LogicalBodyTypes/PaletteDB.h" -#include "LogicalBodyTypes/SurfaceDB.h" -#include "LogicalBodyTypes/FilterDB.h" -#include "LogicalBodyTypes/EnumeratorDB.h" -#include "LogicalBodyTypes/BodyTypeDB.h" - -#endif diff --git a/Laptop/BriefingRoom.cpp b/Laptop/BriefingRoom.cpp index 43fd32629..e10bf3c1c 100644 --- a/Laptop/BriefingRoom.cpp +++ b/Laptop/BriefingRoom.cpp @@ -1,7 +1,6 @@ #ifdef PRECOMPILEDHEADERS #include "Laptop All.h" #else - #include "Laptop All.h" #include "Utilities.h" #include "WCheck.h" #include "timer control.h" @@ -16,6 +15,12 @@ #include "BriefingRoom_Data.h" #include "BriefingRoom.h" +#include "english.h" +#include "laptop.h" +#include "IMP HomePage.h" +#include "line.h" +#include "input.h" +#include "Text Input.h" // Link Images #define BRIEFINGROOM_BUTTON_SIZE_X 205 diff --git a/Laptop/BriefingRoomM.cpp b/Laptop/BriefingRoomM.cpp index 5ee58eef9..704769f6f 100644 --- a/Laptop/BriefingRoomM.cpp +++ b/Laptop/BriefingRoomM.cpp @@ -1,7 +1,6 @@ #ifdef PRECOMPILEDHEADERS #include "Laptop All.h" #else - #include "Laptop All.h" #include "Utilities.h" #include "WCheck.h" #include "timer control.h" @@ -16,6 +15,13 @@ #include "BriefingRoom_Data.h" #include "BriefingRoomM.h" +#include "aim.h" +#include "laptop.h" +#include "IMP HomePage.h" +#include "line.h" +#include "input.h" +#include "Text Input.h" +#include "english.h" // Link Images #define BRIEFINGROOM_MISSION_BUTTON_SIZE_X 121 diff --git a/Laptop/Laptop All.h b/Laptop/Laptop All.h deleted file mode 100644 index c2efeeb91..000000000 --- a/Laptop/Laptop All.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef __LAPTOP_ALL_H -#define __LAPTOP_ALL_H - -#pragma message("GENERATED PCH FOR LAPTOP PROJECT.") - -#include "Types.h" -#include "laptop.h" -#include "aim.h" -#include "Utilities.h" -#include "WCheck.h" -#include "Debug.h" -#include "WordWrap.h" -#include "Encrypted File.h" -#include "email.h" -#include "Text.h" -#include "LaptopSave.h" -#include "Multi Language Graphic Utils.h" -#include "AimArchives.h" -#include "AimFacialIndex.h" -#include "stdio.h" -#include "Aim.h" -#include "AimHistory.h" -#include "AimLinks.h" -#include "AimMembers.h" -#include "sysutil.h" -#include "Soldier Control.h" -#include "Interface Items.h" -#include "overhead.h" -#include "finances.h" -#include "vsurface.h" -#include "VObject.h" -#include "Faces.h" -#include "dialogue control.h" -#include "History.h" -#include "Game Event Hook.h" -#include "MercTextBox.h" -#include "Render Dirty.h" -#include "Soldier Add.h" -#include "Merc Hiring.h" -#include "strategic.h" -#include "english.h" -#include "GameSettings.h" -#include "Random.h" -#include "Strategic Status.h" -#include "Merc Contract.h" -#include "Strategic Merc Handler.h" -#include "AimPolicies.h" -#include "AimSort.h" -#include -#include "BobbyR.h" -#include "Arms Dealer Init.h" -#include "ArmsDealerInvInit.h" -#include "BobbyRGuns.h" -#include "Cursors.h" -#include "Weapons.h" -#include "Store Inventory.h" -#include "BobbyRAmmo.h" -#include "BobbyRArmour.h" -#include "BobbyRMailOrder.h" -#include "input.h" -#include "line.h" -#include "Campaign Types.h" -#include "BobbyRMisc.h" -#include "BobbyRUsed.h" -#include "CharProfile.h" -#include "IMP AboutUs.h" -#include "IMP Attribute Entrance.h" -#include "IMP Attribute Finish.h" -#include "IMP MainPage.h" -#include "IMP HomePage.h" -#include "IMPVideoObjects.h" -#include "IMP Text System.h" -#include "IMP Finish.h" -#include "IMP Portraits.h" -#include "IMP Voices.h" -#include "IMP Personality Entrance.h" -#include "IMP Attribute Selection.h" -#include "IMP Personality Quiz.h" -#include "IMP Begin Screen.h" -#include "IMP Personality Finish.h" -#include "IMP Confirm.h" -#include "messageboxscreen.h" -#include "soldier profile.h" -#include "IMP Compile Character.h" -#include "environment.h" -#include -#include "files.h" -#include "Game clock.h" -#include "Strategic Mines.h" -#include "florist.h" -#include "florist Cards.h" -#include "Florist Gallery.h" -#include "florist Order Form.h" -#include "Text Input.h" -#include "funeral.h" -#include "strategicmap.h" -#include "QuestText.h" -#include "Isometric Utils.h" -#include "Timer Control.h" -#include "Soldier Profile Type.h" -#include "Animation Data.h" -#include "soundman.h" -#include "mousesystem.h" -#include "sgp.h" -#include "Sound Control.h" -#include "Insurance Text.h" -#include "insurance.h" -#include "Assignments.h" -#include "insurance Info.h" -#include "insurance Contract.h" -#include "screens.h" -#include "Event Pump.h" -#include "mercs Files.h" -#include "mercs Account.h" -#include "mercs No Account.h" -#include "insurance Comments.h" -#include "sirtech.h" -#include "personnel.h" -#include "Interface Control.h" -#include "Game init.h" -#include "vobject_blitters.h" -#include "LibraryDataBase.h" -#include "music control.h" -#include "SaveLoadGame.h" -#include "RenderWorld.h" -#include "gameloop.h" -#include "Map Screen Interface.h" -#include "ambient control.h" -#include "Message.h" -#include "Map Screen Interface Bottom.h" -#include "Cursor Control.h" -#include "Quests.h" -#include "mercs.h" -#include "Speck Quotes.h" -#include "Font.h" -#include "mapscreen.h" -#include "Map Screen Interface Map.h" -#include "ShopKeeper Interface.h" -#include "Cheats.h" -#include "GameVersion.h" -#include "BriefingRoom_Data.h" -#include "Encyclopedia_new.h" -#include "Encyclopedia_Data_new.h" -#include "Rebel Command.h" -#endif \ No newline at end of file diff --git a/Standard Gaming Platform/Bitmap.h b/Standard Gaming Platform/Bitmap.h deleted file mode 100644 index 81bc4b350..000000000 --- a/Standard Gaming Platform/Bitmap.h +++ /dev/null @@ -1,63 +0,0 @@ -//************************************************************************** -// -// Filename : bitmap.h -// -// Purpose : bitmap format -// -// Modification history : -// -// 20nov96:HJH - Creation -// -//************************************************************************** - -#ifndef _bitmap_h -#define _bitmap_h - -//************************************************************************** -// -// Includes -// -//************************************************************************** - -#include "types.h" - -//************************************************************************** -// -// Defines -// -//************************************************************************** - -//************************************************************************** -// -// Typedefs -// -//************************************************************************** - -typedef struct sgpBmHeadertag -{ - UINT32 uiNumBytes; // number of bytes of the bitmap, including the - // memory for all variables in this structure plus - // all the memory in bitmap - UINT32 uiWidth; // width of bitmap in pixels - UINT32 uiHeight; // height of bitmap in pixels - UINT8 uiBitDepth; // 8, 16, 24, or 32 - UINT8 uiNumPalEntries; // if uiBitDepth is 8, non-zero, else 0 -} SGPBmHeader; - -typedef struct sgpBitmaptag -{ - SGPBmHeader header; - UINT8 uiData[1]; // if uiNumPalEntries != 0 - // uiNumPalEntries*3 (rgb) bytes for palette - // if uiBitDepth == 8 - // uiWidth * uiHeight bytes - // else if uiBitDepth == 16 - // uiWidth * uiHeight * 2 bytes - // else if uiBitDepth == 24 - // uiWidth * uiHeight * 3 bytes - // else if uiBitDepth == 32 - // uiWidth * uiHeight * 4 bytes -} SGPBitmap; - -#endif - diff --git a/Standard Gaming Platform/DEBUG.cpp b/Standard Gaming Platform/DEBUG.cpp index 9b1bb528c..c5fd69f43 100644 --- a/Standard Gaming Platform/DEBUG.cpp +++ b/Standard Gaming Platform/DEBUG.cpp @@ -29,7 +29,6 @@ #include #include #include "debug.h" - #include "WizShare.h" //Kris addition #ifdef JA2 diff --git a/Standard Gaming Platform/DbMan.cpp b/Standard Gaming Platform/DbMan.cpp deleted file mode 100644 index d4cd1b8ac..000000000 --- a/Standard Gaming Platform/DbMan.cpp +++ /dev/null @@ -1,1038 +0,0 @@ -//************************************************************************** -// -// Filename : DbMan.c -// -// Purpose : function definitions for the database manager -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -//************************************************************************** -// -// Includes -// -//************************************************************************** - -#ifdef JA2_PRECOMPILED_HEADERS - #include "JA2 SGP ALL.H" -#elif defined( WIZ8_PRECOMPILED_HEADERS ) - #include "WIZ8 SGP ALL.H" -#else - #include "types.h" - #include - #include - #include - #include "windows.h" - #include "FileMan.h" - #include "MemMan.h" - #include "DbMan.h" - #include "Debug.h" -#endif - -//************************************************************************** -// -// Defines -// -//************************************************************************** - -#define FILENAME_LENGTH 600 -#define IM_FILENAME_LENGTH 100 -#define BUCKET_FILENAME_LENGTH 100 -#define INITIAL_NUM_HANDLES 20 -#define NUM_FILES_TO_ADD_AT_A_TIME 20 - -#define CHECKF(exp) if (!(exp)) { return(FALSE); } -#define CHECKV(exp) if (!(exp)) { return; } -#define CHECKN(exp) if (!(exp)) { return(NULL); } -#define CHECKBI(exp) if (!(exp)) { return(-1); } -#define CHECK0(exp) if (!(exp)) { return(0); } - -#define PRINT_DEBUG_INFO FileDebugPrint(); - -#define ExtractFileIndex( exp ) ( (HFILEINDEX)((exp)>>16) ) -#define ExtractDbIndex( exp ) ( (HDBINDEX)((exp)&0x0000FFFF) ) - -//************************************************************************** -// -// Typedefs -// -//************************************************************************** - - -// NOTE: the file format of the index file will be as follows: -// -// UINT32 # - number of entries to follow for filenames starting with '0' -// entry 1 filename -// entry 1 databasename -// entry 2 filename -// entry 2 databasename -// ... -// entry # filename -// entry # databasename -// -// UINT32 # - number of entries to follow for filenames starting with '1' -// entry 1 filename -// entry 1 databasename -// entry 2 filename -// entry 2 databasename -// ... -// entry # filename -// entry # databasename -// -// ... -// -// UINT32 # - number of entries to follow for filenames starting with 'z' -// entry 1 filename -// entry 1 databasename -// entry 2 filename -// entry 2 databasename -// ... -// entry # filename -// entry # databasename -// -// UINT32 #### - offset in file to entries for the letter '0' -// ... -// UINT32 #### - offset in file to entries for the letter '9' -// UINT32 #### - offset in file to entries for the letter 'a' -// ... -// UINT32 #### - offset in file to entries for the letter 'z' -// -// - each set of entries for a letter will comprise a bucket - -typedef struct DbBucketTag -{ - CHAR cFirstLetter; - - CHAR *pstrFilenames; - CHAR *pstrDatabasenames; - UINT32 uiNumNames; -} DbBucket; - -typedef struct DbFileTag -{ - CHAR strFilename[FILENAME_LENGTH]; - INT32 iFileSize; // if 0, this structure is not in use - INT32 iOffsetIntoFile; - INT32 iCurrentPosition; -} DbFile; - -typedef struct DbInfoTag -{ - CHAR strFilename[FILENAME_LENGTH]; - HWFILE hFile; // if 0, this structure is not in use - - DbFile *pOpenFiles; - UINT32 uiNumFiles; -} DbInfo; - -typedef struct DbSystemTag -{ - DbBucket bucket; - CHAR strIndexFilename[FILENAME_LENGTH]; - - DbInfo *pDBFiles; - UINT32 uiNumDBFiles; - - BOOLEAN fDebug; -} DbSystem; - -// this is for reading the database file -typedef struct DbHeaderTag -{ - CHAR strSignature[20]; - INT32 iNumFiles; - INT32 iOffsetToIndex; -} DbHeader; - -// this is for reading the database file -typedef struct IndexMemberTag -{ - CHAR strFilename[IM_FILENAME_LENGTH]; - INT32 iFileSize; - INT32 iOffsetIntoFile; - INT32 time; -} IndexMember; - -//************************************************************************** -// -// Variables -// -//************************************************************************** - -DbSystem gdb; - -//************************************************************************** -// -// Function Prototypes -// -//************************************************************************** - -void DbDebugPrint( void ); -HDBFILE CreateDBFileHandle( HFILEINDEX, HDBINDEX ); -BOOLEAN InitDB( DbInfo *pDBInfo, STR strFilename ); -HDBINDEX OpenDatabaseContainingFile( STR strFilename ); -BOOLEAN InitFile( HWFILE hDBFile, DbFile *pFileInfo, STR strFilename ); -BOOLEAN LoadBucket( CHAR cFirstLetter ); -BOOLEAN GetShortFilename( STR strFilename, STR strPathname ); - -//************************************************************************** -// -// Functions -// -//************************************************************************** - -//************************************************************************** -// -// CreateDBFileHandle -// -// Creates a file handle from two indices. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -HDBFILE CreateDBFileHandle( HFILEINDEX high, HDBINDEX low ) -{ - return( (((LONG)high)<<16)|low ); -} - -//************************************************************************** -// -// DbSystemInit -// -// Starts up the database system. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -BOOLEAN InitializeDatabaseManager( STR strIndexFilename ) -{ - INT32 i; - UINT32 uiSize; - - if ( !FileExistsNoDB( strIndexFilename ) ) - { - return(FALSE); - } - - uiSize = INITIAL_NUM_HANDLES * sizeof(DbInfo); - gdb.fDebug = FALSE; - gdb.pDBFiles = (DbInfo *) MemAlloc( uiSize ); - CHECKF( gdb.pDBFiles ); - - gdb.uiNumDBFiles = INITIAL_NUM_HANDLES; - - for ( i=0 ; icreation -// -//************************************************************************** - -void ShutdownDatabaseManager( void ) -{ - UINT32 i; - - MemFree( gdb.bucket.pstrFilenames ); - MemFree( gdb.bucket.pstrDatabasenames ); - - // close any unclosed files - for ( i=1 ; icreation -// -//************************************************************************** - -void DbDebug( BOOLEAN fFlag ) -{ - gdb.fDebug = fFlag; -} - -//************************************************************************** -// -// DbExists -// -// Checks if a database file exists. -// -// Parameter List : -// -// STR ->name of file to check existence of -// -// Return Value : -// -// BOOLEAN ->TRUE if it exists -// ->FALSE if not -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -BOOLEAN DbExists( STR strFilename ) -{ - return( FileExists( strFilename ) ); -} - -//************************************************************************** -// -// DbOpen -// -// Opens a database. -// -// Parameter List : -// -// STR ->filename -// -// Return Value : -// -// HDBINDEX ->handle of opened file -// ->0 if unsuccessful -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -HDBINDEX DbOpen( STR strFilename ) -{ - HDBINDEX hDBIndex; - UINT16 i; - CHAR cShortFilename[FILENAME_LENGTH]; - CHAR cShortDBName[FILENAME_LENGTH]; - BOOLEAN fFound; - - fFound = FALSE; - hDBIndex = 0; - - // first, find any already open databases, and make sure that if we're trying to - // open one that's already open, then we just return an index to it - for ( i=1 ; ihandle to database file to close -// -// Return Value : -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -void DbClose( HDBINDEX hFile ) -{ - if ( hFile && gdb.pDBFiles[hFile].hFile ) - { - MemFree( gdb.pDBFiles[hFile].pOpenFiles ); - FileClose( gdb.pDBFiles[hFile].hFile ); - gdb.pDBFiles[hFile].hFile = 0; - - DbgMessage( TOPIC_DATABASE_MANAGER, DBG_LEVEL_2, "Closing Database File" ); - } -} - -//************************************************************************** -// -// DbFileOpen -// -// Opens a file in a database. -// -// Parameter List : -// -// STR ->filename -// UIN32 ->access - read or write, or both -// BOOLEAN ->delete on close -// -// Return Value : -// -// HWFILE ->handle of opened file -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -HDBFILE DbFileOpen( STR strFilename ) -{ - HDBFILE hFile; - HFILEINDEX hFileIndex = 0xffff; - HDBINDEX hDBIndex; - UINT16 i; - - hDBIndex = OpenDatabaseContainingFile( strFilename ); - if ( !hDBIndex ) - return(0); - - for ( i=1 ; ihandle to database file to close -// -// Return Value : -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -void DbFileClose( HDBFILE hDBFile ) -{ - HFILEINDEX hFileIndex; - HDBINDEX hDBIndex; - - hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); - - if ( hDBIndex >= gdb.uiNumDBFiles ) - return; - - if ( gdb.pDBFiles[hDBIndex].pOpenFiles ) - { - if ( hFileIndex >= gdb.pDBFiles[hDBIndex].uiNumFiles ) - return; - - if ( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ) - { - gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize = 0; - } - } -} - -//************************************************************************** -// -// DbFileRead -// -// To read a file in a database. -// -// Parameter List : -// -// HWFILE ->handle to file to read from -// void * ->source buffer -// UINT32 ->num bytes to read -// UINT32 ->num bytes read -// -// Return Value : -// -// BOOLEAN ->TRUE if successful -// ->FALSE if not -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -BOOLEAN DbFileRead(HDBFILE hDBFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead) -{ - HFILEINDEX hFileIndex; - HDBINDEX hDBIndex; - HWFILE hFile; - UINT32 uiStartPos, uiCurPos, uiBytesRead; - - hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); - - CHECKF( hDBIndex < gdb.uiNumDBFiles ); - CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles ) - CHECKF( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); - CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); - - hFile = gdb.pDBFiles[hDBIndex].hFile; - uiStartPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iOffsetIntoFile; - uiCurPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition; - - CHECKF( hFile ); - - FileSeek( hFile, uiStartPos + uiCurPos, FILE_SEEK_FROM_START ); - FileRead( hFile, pDest, uiBytesToRead, &uiBytesRead ); - - if ( puiBytesRead ) - *puiBytesRead = uiBytesRead; - - gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition += uiBytesToRead; - - return(TRUE); -} - -//************************************************************************** -// -// DbFileLoad -// -// To open, read, and close a file. -// -// Parameter List : -// -// -// Return Value : -// -// BOOLEAN ->TRUE if successful -// ->FALSE if not -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -BOOLEAN DbFileLoad(STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead) -{ - HDBFILE hDBFile; - UINT32 uiBytesRead; - - hDBFile = DbFileOpen( filename ); - CHECKF( hDBFile ); - - DbFileRead( hDBFile, pDest, uiBytesToRead, &uiBytesRead ); - DbFileClose( hDBFile ); - - if ( puiBytesRead ) - *puiBytesRead = uiBytesRead; - - return(TRUE); -} - -//************************************************************************** -// -// DbFileSeek -// -// To seek to a position in a file in a database. -// -// Parameter List : -// -// HWFILE ->handle to file to seek in -// UINT32 ->distance to seek -// UINT8 ->how to seek -// -// Return Value : -// -// BOOLEAN ->TRUE if successful -// ->FALSE if not -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -BOOLEAN DbFileSeek( HDBFILE hDBFile, UINT32 uiDistance, UINT8 uiHow ) -{ - HFILEINDEX hFileIndex; - HDBINDEX hDBIndex; - UINT32 uiStartPos, uiCurPos, uiSize; - - hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); - - CHECKF( hDBIndex < gdb.uiNumDBFiles ); - CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles ) - CHECKF( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); - CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); - - uiStartPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iOffsetIntoFile; - uiCurPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition; - uiSize = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize; - - if ( uiHow == FILE_SEEK_FROM_START ) - uiCurPos = uiDistance; - else if ( uiHow == FILE_SEEK_FROM_END ) - uiCurPos = uiSize - uiDistance; - else if ( uiHow == FILE_SEEK_FROM_CURRENT ) - uiCurPos += uiDistance; - else - return(FALSE); - - return(TRUE); -} - -//************************************************************************** -// -// DbFileGetSize -// -// To get the current position in a file. -// -// Parameter List : -// -// HWFILE ->handle to file -// -// Return Value : -// -// INT32 ->current offset in file if successful -// ->-1 if not -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -UINT32 DbFileGetPos( HDBFILE hDBFile ) -{ - HFILEINDEX hFileIndex; - HDBINDEX hDBIndex; - - hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); - - CHECK0( hDBIndex < gdb.uiNumDBFiles ); - CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles ) - CHECK0( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); - CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); - - return(gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition); -} - -//************************************************************************** -// -// DbFileGetSize -// -// To get the current file size. -// -// Parameter List : -// -// HWFILE ->handle to file -// -// Return Value : -// -// INT32 ->file size in file if successful -// ->0 if not -// -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -UINT32 DbFileGetSize( HDBFILE hDBFile ) -{ - HFILEINDEX hFileIndex; - HDBINDEX hDBIndex; - - hFileIndex = ExtractFileIndex( hDBFile ); - hDBIndex = ExtractDbIndex( hDBFile ); - - CHECK0( hDBIndex < gdb.uiNumDBFiles ); - CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles ) - CHECK0( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); - CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); - - return(gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize); -} - -//************************************************************************** -// -// DbDebugPrint -// -// To print the debug state to output. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 24sep96:HJH ->creation -// -//************************************************************************** - -void DbDebugPrint( void ) -{ -} - -//************************************************************************** -// -// InitDB -// -// To initialize a database info structure. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 15oct96:HJH ->creation -// -//************************************************************************** - -BOOLEAN InitDB( DbInfo *pDBInfo, STR strFilename ) -{ - HWFILE hFile; - INT32 i; - - CHECKF(pDBInfo); - - hFile = FileOpen( strFilename, FILE_ACCESS_READ, FALSE ); - CHECKF( hFile ); - - strcpy( pDBInfo->strFilename, strFilename ); - pDBInfo->hFile = hFile; - pDBInfo->pOpenFiles = (DbFile *) MemAlloc(INITIAL_NUM_HANDLES * sizeof(DbFile)); - - if ( !pDBInfo->pOpenFiles ) - { - FileClose( hFile ); - return(FALSE); - } - - for ( i=0 ; ipOpenFiles[i].iFileSize = 0; - } - pDBInfo->uiNumFiles = INITIAL_NUM_HANDLES; - - return(TRUE); -} - -//************************************************************************** -// -// OpenDatabaseContainingFile -// -// To open, or find the already opened database, containing the given file. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 15oct96:HJH ->creation -// -//************************************************************************** - -HDBINDEX OpenDatabaseContainingFile( STR strFilename ) -{ - CHAR cFirst, cFilename[FILENAME_LENGTH], cCheckname[FILENAME_LENGTH]; - UINT32 i; - HDBINDEX hIndex; - - hIndex = 0; - GetShortFilename( cFilename, strFilename ); - - cFirst = cFilename[0]; - - if ( cFirst != gdb.bucket.cFirstLetter ) - LoadBucket( cFirst ); - - for ( i=0 ; icreation -// -//************************************************************************** - -BOOLEAN InitFile( HWFILE hDBFile, DbFile *pFileInfo, STR strFilename ) -{ - DbHeader header; - IndexMember im; - UINT32 uiBytesRead; - INT32 i; - CHAR cFilename[FILENAME_LENGTH], cShortFilename[FILENAME_LENGTH]; - - CHECKF( pFileInfo ); - CHECKF( strFilename ); - CHECKF( hDBFile ); - - FileSeek( hDBFile, 0, FILE_SEEK_FROM_START ); - FileRead( hDBFile, &header, sizeof(DbHeader), &uiBytesRead ); - CHECKF( uiBytesRead == sizeof(DbHeader) ); - FileSeek( hDBFile, header.iOffsetToIndex, FILE_SEEK_FROM_START ); - - GetShortFilename( cShortFilename, strFilename ); - for ( i=0 ; istrFilename, strFilename ); - pFileInfo->iFileSize = im.iFileSize; - pFileInfo->iOffsetIntoFile = im.iOffsetIntoFile; - pFileInfo->iCurrentPosition = 0; - return(TRUE); - } - } - - return(FALSE); -} - -//************************************************************************** -// -// LoadBucket -// -// To load a bucketfull of file-database name pairs. -// -// Parameter List : -// Return Value : -// Modification history : -// -// 15oct96:HJH ->creation -// -//************************************************************************** - -BOOLEAN LoadBucket( CHAR cFirstLetter ) -{ - HWFILE hFile; - UINT32 i, uiPosition, uiBytesRead, uiNumEntries, uiSize; - CHAR cFilename[FILENAME_LENGTH], cDatabasename[FILENAME_LENGTH]; - - uiNumEntries = 0; - - MemFree( gdb.bucket.pstrFilenames ); - MemFree( gdb.bucket.pstrDatabasenames ); - - hFile = FileOpen( gdb.strIndexFilename, FILE_ACCESS_READ, FALSE ); - CHECKF(hFile); - uiSize = FileGetSize( hFile ); - - if ( cFirstLetter >= 'a' && cFirstLetter <= 'z' ) - uiPosition = 'z' - cFirstLetter + 1; - else - uiPosition = 26 + ('9' - cFirstLetter + 1); - - FileSeek( hFile, sizeof(UINT32)*uiPosition, FILE_SEEK_FROM_END ); - FileRead( hFile, &uiPosition, sizeof(UINT32), &uiBytesRead ); - if ( uiPosition > uiSize ) - { - // error - return(FALSE); - } - - FileSeek( hFile, uiPosition, FILE_SEEK_FROM_START ); - FileRead( hFile, &uiNumEntries, sizeof(UINT32), &uiBytesRead ); - - CHECKF(uiNumEntries); - - gdb.bucket.pstrFilenames = (STR8)MemAlloc( uiNumEntries * FILENAME_LENGTH); - CHECKF(gdb.bucket.pstrFilenames); - - gdb.bucket.pstrDatabasenames = (STR8)MemAlloc( uiNumEntries * FILENAME_LENGTH); - if ( !gdb.bucket.pstrDatabasenames ) - { - MemFree(gdb.bucket.pstrFilenames); - return(FALSE); - } - - - for ( i=0 ; icreation -// -//************************************************************************** - -BOOLEAN GetShortFilename( STR strFilename, STR strPathname ) -{ - CHAR *pcLast; - - pcLast = strrchr( strPathname, '\\' ); - - if ( pcLast ) - { - pcLast = pcLast + 1; - strcpy( strFilename, pcLast ); - } - else - strcpy( strFilename, strPathname ); - - return(TRUE); -} - diff --git a/Standard Gaming Platform/DbMan.h b/Standard Gaming Platform/DbMan.h deleted file mode 100644 index 13af5e63e..000000000 --- a/Standard Gaming Platform/DbMan.h +++ /dev/null @@ -1,87 +0,0 @@ -//************************************************************************** -// -// Filename : DbMan.h -// -// Purpose : prototypes for the database manager -// -// Modification history : -// -// 08oct96:HJH - Creation -// -//************************************************************************** - -#ifndef _DBMAN_H -#define _DBMAN_H - -//************************************************************************** -// -// Includes -// -//************************************************************************** - -#include "types.h" - -//************************************************************************** -// -// Defines -// -//************************************************************************** - -#ifndef FILE_ACCESS_READ -#define FILE_ACCESS_READ 0x01 -#endif - -#ifndef FILE_ACCESS_WRITE -#define FILE_ACCESS_WRITE 0x02 -#endif - -#define FILE_SEEK_FROM_START 0x01 // keep in sync with fileman.h -#define FILE_SEEK_FROM_END 0x02 // keep in sync with fileman.h -#define FILE_SEEK_FROM_CURRENT 0x04 // keep in sync with fileman.h - -//************************************************************************** -// -// Typedefs -// -//************************************************************************** - -typedef UINT8 BYTE; -typedef UINT32 HDBFILE; -typedef UINT16 HFILEINDEX; -typedef UINT16 HDBINDEX; - -//************************************************************************** -// -// Function Prototypes -// -//************************************************************************** - -#ifdef __cplusplus -extern "C" { -#endif - -extern BOOLEAN InitializeDatabaseManager( STR strIndexFilename ); -extern void ShutdownDatabaseManager( void ); -extern void DbDebug( BOOLEAN f ); - -extern BOOLEAN DbExists( STR filename ); - -extern HDBINDEX DbOpen( STR filename ); -extern void DbClose( HDBINDEX ); - -extern HDBFILE DbFileOpen( STR filename ); -extern void DbFileClose( HDBFILE ); - -extern BOOLEAN DbFileRead( HDBFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); -extern BOOLEAN DbFileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); -extern BOOLEAN DbFileSeek( HDBFILE hFile, UINT32 uiDistance, UINT8 uiHow ); - -extern UINT32 DbFileGetPos( HDBFILE hFile ); -extern UINT32 DbFileGetSize( HDBFILE ); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/Standard Gaming Platform/ExceptionHandling.cpp b/Standard Gaming Platform/ExceptionHandling.cpp deleted file mode 100644 index 5e8ff9968..000000000 --- a/Standard Gaming Platform/ExceptionHandling.cpp +++ /dev/null @@ -1,1600 +0,0 @@ -#ifdef JA2_PRECOMPILED_HEADERS - #include "JA2 SGP ALL.H" -#elif defined( WIZ8_PRECOMPILED_HEADERS ) - #include "WIZ8 SGP ALL.H" -#else - #include "Types.h" - #include - #include - #include - #include "FileMan.h" -#endif - - - -#ifdef JA2 -#endif - -//If we are to use exception handling -#ifdef ENABLE_EXCEPTION_HANDLING - - -const int NumCodeBytes = 16; // Number of code bytes to record. -const int MaxStackDump = 2048; // Maximum number of DWORDS in stack dumps. -const int StackColumns = 8; // Number of columns in stack dump. - -#define ONEK 1024 -#define SIXTYFOURK (64*ONEK) -#define ONEM (ONEK*ONEK) -#define ONEG (ONEK*ONEK*ONEK) - -//ppp -void ErrorLog(HWFILE LogFile, STR8 Format, ...); -STR GetExceptionString( DWORD uiExceptionCode ); -void DisplayRegisters( HWFILE hFile, CONTEXT *pContext ); -BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext ); -BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext ); -void RecordModuleList(HWFILE hFile ); -void PrintTime(STR8 output, FILETIME TimeToPrint); -static void ShowModuleInfo(HWFILE hFile, HINSTANCE ModuleHandle); - -static LPTOP_LEVEL_EXCEPTION_FILTER g_pfnOrigFilt = NULL ; - -LONG __stdcall ERCrashDumpExceptionFilter(EXCEPTION_POINTERS* pExPtrs); -LONG __stdcall ERCrashDumpExceptionFilterEx(const char* pAppName, const char* pPath, EXCEPTION_POINTERS* pExPtrs); -static void ERLogModules(HWFILE fdump); - -#if defined(_IMAGEHLP_) && defined(_X86_) -#define MAX_SYMNAME_SIZE 1024 -static CHAR symBuffer[sizeof(IMAGEHLP_SYMBOL)+MAX_SYMNAME_SIZE]; -static PIMAGEHLP_SYMBOL g_sym = (PIMAGEHLP_SYMBOL) symBuffer; -static void ERLogStackWalk(HWFILE fdump, EXCEPTION_POINTERS* pExPtrs); -#endif //defined(_IMAGEHLP_) && defined(_X86_) - - - -INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ) -{ - EXCEPTION_RECORD Record; - CONTEXT Context; - CHAR8 zFileName[512]; - CHAR8 zDate[512]; - CHAR8 zTime[512]; - HWFILE hFile; - CHAR8 zString[2048]; - SYSTEMTIME SysTime; - CHAR8 zNewLine[] = "\r\n"; - - - //create local copies of the exception info - memcpy( &Record, pExceptInfo->ExceptionRecord , sizeof( EXCEPTION_RECORD ) ); - memcpy( &Context, pExceptInfo->ContextRecord, sizeof( CONTEXT ) ); - - - // - // Open a file to output the current state of the game - // - - // Get the current time - GetLocalTime( &SysTime ); - - //create a date string - sprintf( zDate, "%02d_%02d_%d", SysTime.wDay, SysTime.wMonth, SysTime.wYear ); - - //create a time string - sprintf( zTime, "%02d_%02d", SysTime.wHour, SysTime.wMinute ); - - //create the crash file - sprintf( zFileName, "Crash Report_%s___%s.txt", zDate, zTime ); - - // create the save game file - hFile = FileOpen( zFileName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); - if( !hFile ) - { - FileClose( hFile ); - return( 0 ); - } - - // - // Display the version number - // -#ifdef JA2 - - //Dispay Ja's version number - ErrorLog( hFile, "%S %S: %s. %S",zVersionLabel, zRevisionNumber, czVersionNumber, zTrackingNumber ); - - //Insert a new line - ErrorLog( hFile, zNewLine ); - - //Insert a new line - ErrorLog( hFile, zNewLine ); -#endif - - - - // - // Write out the current state of the system - // - - GetAndDisplayModuleAndSystemInfo( hFile, &Context ); - - - //Insert a new line - ErrorLog( hFile, zNewLine ); - - //Display the address of where the exception occurred - sprintf( zString, "Exception occurred at address: 0x%08x\r\n", Record.ExceptionAddress ); - ErrorLog( hFile, zString ); - - - //if the exception was an access violation, display the offending address - if( Record.ExceptionCode == EXCEPTION_ACCESS_VIOLATION && Record.NumberParameters != 0 ) - { - if( Record.ExceptionInformation[0] != 0 ) - { - //Display the address of where the access violation occurred - sprintf( zString, "\tWrite Access Violation at: 0x%08x\r\n", Record.ExceptionInformation[1] ); - } - else - { - //Display the address of where the access violation occurred - sprintf( zString, "\tWrite Access Violation at: 0x%08x\r\n", Record.ExceptionInformation[1] ); - } - - ErrorLog( hFile, zString ); - } - - - //Insert a new line - ErrorLog( hFile, zNewLine ); - - //Display the exception that caused this - sprintf( zString, "Exact Error Message \r\n \"%s\"\r\n", GetExceptionString( Record.ExceptionCode ) ); - ErrorLog( hFile, zString ); - - //Insert a new line - ErrorLog( hFile, zNewLine ); - - //Dispay if the code 'could' continue - if( Record.ExceptionFlags != 0 ) - sprintf( zString, "%s\r\n", "The game 'can NOT' continue" ); - else - sprintf( zString, "%s\r\n", "The game 'CAN' continue" ); - ErrorLog( hFile, zString ); - - - //Insert a new line - ErrorLog( hFile, zNewLine ); - ErrorLog( hFile, zNewLine ); - - // - // Display the current context information - // - DisplayRegisters( hFile, &Context ); - - ErrorLog( hFile, zNewLine ); - ErrorLog( hFile, zNewLine ); - - // Stack walk if symbles are available - ERLogStackWalk( hFile, pExceptInfo ); - ErrorLog( hFile, zNewLine ); - ErrorLog( hFile, zNewLine ); - - //display the stack ( call stack + local variables ) - DisplayStack( hFile, &Context); - - //Display some spaces - ErrorLog( hFile, zNewLine ); - ErrorLog( hFile, zNewLine ); - - //Display all modules currently loaded - //RecordModuleList(hFile ); - - ERLogModules(hFile); // records version - - //eee - - FileClose( hFile ); - - return( EXCEPTION_EXECUTE_HANDLER ); -} - - - -void ErrorLog( HWFILE hFile, STR8 Format, ...) -{ - char buffer[2000]; // wvsprintf never prints more than one K. - UINT32 uiNumBytesWritten=0; - UINT32 uiStringWidth; - va_list arglist; - va_start( arglist, Format); - wvsprintf(buffer, Format, arglist); - va_end( arglist); - - //WriteFile(LogFile, buffer, lstrlen(buffer), &NumBytes, 0); - - - uiStringWidth = lstrlen(buffer); - - //write out the string - FileWrite( hFile, buffer, uiStringWidth, &uiNumBytesWritten ); - if( uiNumBytesWritten != uiStringWidth ) - { - FileClose( hFile ); - return; - } - -} - -STR GetExceptionString( DWORD uiExceptionCode ) -{ - switch( uiExceptionCode ) - { - case EXCEPTION_ACCESS_VIOLATION: - return( "The thread tried to read from or write to a virtual address for which it does not have the appropriate access."); - break; - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - return( "The thread tried to access an array element that is out of bounds and the underlying hardware supports bounds checking."); - case EXCEPTION_BREAKPOINT: - return( "A breakpoint was encountered."); - case EXCEPTION_DATATYPE_MISALIGNMENT: - return( "The thread tried to read or write data that is misaligned on hardware that does not provide alignment. For example, 16-bit values must be aligned on 2-byte boundaries; 32-bit values on 4-byte boundaries, and so on."); - case EXCEPTION_FLT_DENORMAL_OPERAND: - return( "One of the operands in a floating-point operation is denormal. A denormal value is one that is too small to represent as a standard floating-point value."); - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - return( "The thread tried to divide a floating-point value by a floating-point divisor of zero."); - case EXCEPTION_FLT_INEXACT_RESULT: - return( "The result of a floating-point operation cannot be represented exactly as a decimal fraction."); - case EXCEPTION_FLT_INVALID_OPERATION: - return( "This exception represents any floating-point exception not included in this list."); - case EXCEPTION_FLT_OVERFLOW: - return( "The exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type."); - case EXCEPTION_FLT_STACK_CHECK: - return( "The stack overflowed or underflowed as the result of a floating-point operation."); - case EXCEPTION_FLT_UNDERFLOW: - return( "The exponent of a floating-point operation is less than the magnitude allowed by the corresponding type."); - case EXCEPTION_ILLEGAL_INSTRUCTION: - return( "The thread tried to execute an invalid instruction."); - case EXCEPTION_IN_PAGE_ERROR: - return( "The thread tried to access a page that was not present, and the system was unable to load the page. For example, this exception might occur if a network connection is lost while running a program over the network."); - case EXCEPTION_INT_DIVIDE_BY_ZERO: - return( "The thread tried to divide an integer value by an integer divisor of zero."); - case EXCEPTION_INT_OVERFLOW: - return( "The result of an integer operation caused a carry out of the most significant bit of the result."); - case EXCEPTION_INVALID_DISPOSITION: - return( "An exception handler returned an invalid disposition to the exception dispatcher. Programmers using a high-level language such as C should never encounter this exception."); - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - return( "The thread tried to continue execution after a noncontinuable exception occurred."); - case EXCEPTION_PRIV_INSTRUCTION: - return( "The thread tried to execute an instruction whose operation is not allowed in the current machine mode."); - case EXCEPTION_SINGLE_STEP: - return( "A trace trap or other single-instruction mechanism signaled that one instruction has been executed."); - case EXCEPTION_STACK_OVERFLOW: - return( "The thread used up its stack."); - - default: - return("Exception not in case "); - break; - } -} - - -void DisplayRegisters( HWFILE hFile, CONTEXT *pContext ) -{ - ErrorLog( hFile, "Registers:\r\n"); - ErrorLog( hFile, "\tEAX=%08x CS=%04x EIP=%08x EFLGS=%08x\r\n", - pContext->Eax, pContext->SegCs, pContext->Eip, pContext->EFlags); - ErrorLog( hFile, "\tEBX=%08x SS=%04x ESP=%08x EBP=%08x\r\n", - pContext->Ebx, pContext->SegSs, pContext->Esp, pContext->Ebp); - ErrorLog( hFile, "\tECX=%08x DS=%04x ESI=%08x FS=%04x\r\n", - pContext->Ecx, pContext->SegDs, pContext->Esi, pContext->SegFs); - ErrorLog( hFile, "\tEDX=%08x ES=%04x EDI=%08x GS=%04x\r\n", - pContext->Edx, pContext->SegEs, pContext->Edi, pContext->SegGs); -// ErrorLog( hFile, "Bytes at CS:EIP:\r\n"); -} - -BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext ) -{ - char zFileName[2048]; - char zString[2048]; - SYSTEM_INFO SystemInfo; - MEMORYSTATUS MemInfo; -// MEMORY_BASIC_INFORMATION MemBasicInfo; - size_t PageSize; - size_t pageNum = 0; - SGP_FILETIME LastWriteTime; - - if( GetModuleFileName(0, zFileName, sizeof(zFileName) ) == 0) - { - return( FALSE ); - } - - MemInfo.dwLength = sizeof(MemInfo); - GlobalMemoryStatus(&MemInfo); - - //Display the filename - ErrorLog( hFile, "File:\r\n\t%s\r\n", zFileName); - - - //Get the time the file was created - if (GetFileManFileTime(hFile, 0, 0, &LastWriteTime)) - { - PrintTime( zString, LastWriteTime); - - ErrorLog( hFile, "\tFile created on: %s\r\n", zString ); - } - - - //Get cpu type and number - GetSystemInfo(&SystemInfo); - ErrorLog( hFile, "\t%d type %d processor.\r\n", SystemInfo.dwNumberOfProcessors, SystemInfo.dwProcessorType ); - - //Get free ram - ErrorLog( hFile, "\tTotal Physical Memory: %d Megs.\r\n", MemInfo.dwTotalPhys/(1024*1024) ); - - - PageSize = SystemInfo.dwPageSize; - - pageNum = 0; - -/* - //Get current instruction pointer - if( VirtualQuery((void *)(pageNum * PageSize), &MemBasicInfo, sizeof(MemBasicInfo) ) ) - { - if (MemBasicInfo.RegionSize > 0) - { - ErrorLog( hFile, "\r\n\r\nJagged is loaded into memory at: 0x%08d.\r\n", MemBasicInfo.AllocationBase ); - } - } -*/ - - ErrorLog( hFile, "Segment( CS:EIP ):\t%04x:%08x.\r\n", pContext->SegCs, pContext->Eip ); - - return( TRUE ); -} - - - -// -// This code for this function is based ( stolen ) from Bruce Dawson's article in Game Developer Magazine Jan 99 -// -BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext ) -{ - int Count = 0; - char buffer[1000] = ""; - const int safetyzone = 50; - STR8 nearend = buffer + sizeof(buffer) - safetyzone; - STR8 output = buffer; - - // Time to print part or all of the stack to the error log. This allows - // us to figure out the call stack, parameters, local variables, etc. - ErrorLog( hFile, "Stack dump:\r\n" ); - - __try - { - // Esp contains the bottom of the stack, or at least the bottom of - // the currently used area. - DWORD* pStack = (DWORD *)pContext->Esp; - DWORD* pStackTop; - __asm - { - // Load the top (highest address) of the stack from the - // thread information block. It will be found there in - // Win9x and Windows NT. - mov eax, fs:[4] - mov pStackTop, eax - } - if (pStackTop > pStack + MaxStackDump) - pStackTop = pStack + MaxStackDump; - - - // Too many calls to WriteFile can take a long time, causing - // confusing delays when programs crash. Therefore I implemented - // simple buffering for the stack dumping code instead of calling - // hprintf directly. - - while (pStack + 1 <= pStackTop) - { - STR8 Suffix = " "; - - if ((Count % StackColumns) == 0) - output += wsprintf(output, "%08x: ", pStack); - - if ((++Count % StackColumns) == 0 || pStack + 2 > pStackTop) - Suffix = "\r\n"; - output += wsprintf(output, "%08x%s", *pStack, Suffix); - pStack++; - - // Check for when the buffer is almost full, and flush it to disk. - if (output > nearend) - { - ErrorLog( hFile, "%s", buffer); - buffer[0] = 0; - output = buffer; - } - } - // Print out any final characters from the cache. - ErrorLog( hFile, "%s", buffer); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - ErrorLog( hFile, "Exception encountered during stack dump.\r\n"); - } - - return( TRUE ); -} - - -// -// This code for this function is ( stolen :) from Bruce Dawson's article in Game Developer Magazine Jan 99 -// - -// Print the specified FILETIME to output in a human readable format, -// without using the C run time. - -void PrintTime(STR8 output, FILETIME TimeToPrint) -{ - WORD Date, Time; - if (FileTimeToLocalFileTime(&TimeToPrint, &TimeToPrint) && - FileTimeToDosDateTime(&TimeToPrint, &Date, &Time)) - { - // What a silly way to print out the file date/time. Oh well, - // it works, and I'm not aware of a cleaner way to do it. - wsprintf(output, "%02d/%02d/%d %02d:%02d:%02d", - (Date / 32) & 15, Date & 31, (Date / 512) + 1980, - (Time / 2048), (Time / 32) & 63, (Time & 31) * 2); - } - else - output[0] = 0; -} - - - - - - - -// -// This code for this function is ( stolen :) from Bruce Dawson's article in Game Developer Magazine Jan 99 -// - -// Scan memory looking for code modules (DLLs or EXEs). VirtualQuery is used -// to find all the blocks of address space that were reserved or committed, -// and ShowModuleInfo will display module information if they are code -// modules. - - -void RecordModuleList(HWFILE hFile ) -{ - ErrorLog( hFile, "\r\n" - "Module list: names, addresses, sizes, time stamps " - "and file times:\r\n"); - SYSTEM_INFO SystemInfo; - GetSystemInfo(&SystemInfo); - const size_t PageSize = SystemInfo.dwPageSize; - // Set NumPages to the number of pages in the 4GByte address space, - // while being careful to avoid overflowing ints. - const size_t NumPages = 4 * size_t(ONEG / PageSize); - size_t pageNum = 0; - void *LastAllocationBase = 0; - while (pageNum < NumPages) - { - MEMORY_BASIC_INFORMATION MemInfo; - if (VirtualQuery((void *)(pageNum * PageSize), &MemInfo, - sizeof(MemInfo))) - { - if (MemInfo.RegionSize > 0) - { - // Adjust the page number to skip over this block of memory. - pageNum += MemInfo.RegionSize / PageSize; - if (MemInfo.State == MEM_COMMIT && MemInfo.AllocationBase > - LastAllocationBase) - { - // Look for new blocks of committed memory, and try - // recording their module names - this will fail - // gracefully if they aren't code modules. - LastAllocationBase = MemInfo.AllocationBase; - ShowModuleInfo(hFile, (HINSTANCE)LastAllocationBase); - } - } - else - pageNum += SIXTYFOURK / PageSize; - } - else - pageNum += SIXTYFOURK / PageSize; - // If VirtualQuery fails we advance by 64K because that is the - // granularity of address space doled out by VirtualAlloc(). - } -} - - - -// -// This code for this function is ( stolen :) from Bruce Dawson's article in Game Developer Magazine Jan 99 -// -static void ShowModuleInfo(HWFILE hFile, HINSTANCE ModuleHandle) -{ - char ModName[MAX_PATH]; - __try - { - if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) - { - // If GetModuleFileName returns greater than zero then this must - // be a valid code module address. Therefore we can try to walk - // our way through its structures to find the link time stamp. - IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle; - if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic) - return; - IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((STR8 )DosHeader - + DosHeader->e_lfanew); - if (IMAGE_NT_SIGNATURE != NTHeader->Signature) - return; - // Open the code module file so that we can get its file date - // and size. - HANDLE ModuleFile = CreateFile(ModName, GENERIC_READ, - FILE_SHARE_READ, 0, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0); - char TimeBuffer[100] = ""; - DWORD FileSize = 0; - if (ModuleFile != INVALID_HANDLE_VALUE) - { - FileSize = GetFileSize(ModuleFile, 0); - FILETIME LastWriteTime; - if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime)) - { - wsprintf(TimeBuffer, " - file date is "); - PrintTime(TimeBuffer + lstrlen(TimeBuffer), LastWriteTime); - } - CloseHandle(ModuleFile); - } - ErrorLog( hFile, "%-35s, loaded at 0x%08x - %7d bytes - %08x%s\r\n", - ModName, ModuleHandle, FileSize, - NTHeader->FileHeader.TimeDateStamp, TimeBuffer); - } - } - // Handle any exceptions by continuing from this point. - __except(EXCEPTION_EXECUTE_HANDLER) - { - } -} - -////////////////////////////////////////////////////////////////////////// - -/*---------------------------------------------------------------------- -"Debugging Applications" (Microsoft Press) -Copyright (c) 1997-2000 John Robbins -- All rights reserved. -----------------------------------------------------------------------*/ - - -#define _USE_VERSIONING_ -#define _USE_PSAPI_ - -#ifdef _USE_VERSIONING_ -#include -#endif -#define _USE_PSAPI_ -#ifdef _USE_PSAPI_ -// Copied from psapi.h -typedef struct _MODULEINFO { - LPVOID lpBaseOfDll; - DWORD SizeOfImage; - LPVOID EntryPoint; -} MODULEINFO, *LPMODULEINFO; -#endif - -#ifndef _IMAGEHLP64 -// copied from imagehlp.h -typedef struct _ER_IMAGEHLP_LINE64 { - DWORD SizeOfStruct; // set to sizeof(IMAGEHLP_LINE64) - PVOID Key; // internal - DWORD LineNumber; // line number in file - PCHAR FileName; // full filename - DWORD64 Address; // first instruction of line -} ER_IMAGEHLP_LINE64, *PER_IMAGEHLP_LINE64; -#endif - -/*---------------------------------------------------------------------- - IsNT - Detect if this is an NT installation -----------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------- -"Debugging Applications" (Microsoft Press) -Copyright (c) 1997-2000 John Robbins -- All rights reserved. -----------------------------------------------------------------------*/ - -BOOL __stdcall IsNT ( void ) -{ - static BOOL s_bHasVersion = FALSE ; // Indicates that the version information is valid. - static BOOL s_bIsNT = TRUE ; // Indicates NT or 95/98. - BOOL bRet; - OSVERSIONINFO stOSVI ; - - if ( TRUE == s_bHasVersion ) - return ( TRUE == s_bIsNT ) ; - - memset ( &stOSVI , 0, sizeof ( OSVERSIONINFO ) ) ; - stOSVI.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO ) ; - - bRet = GetVersionEx ( &stOSVI ) ; - if ( FALSE == bRet ) - return ( FALSE ) ; - - // Check the version and call the appropriate thing. - if ( VER_PLATFORM_WIN32_NT == stOSVI.dwPlatformId ) - s_bIsNT = TRUE ; - else - s_bIsNT = FALSE ; - s_bHasVersion = TRUE ; - return ( TRUE == s_bIsNT ) ; -} - -/*---------------------------------------------------------------------- - Version.dll Wrappers -----------------------------------------------------------------------*/ -#ifdef _USE_VERSIONING_ - -typedef DWORD (__stdcall *FVN_GetFileVersionInfoSize)(LPCTSTR, LPDWORD ); -static FVN_GetFileVersionInfoSize g_GetFileVersionInfoSize = NULL; - -static DWORD __stdcall -ERGetFileVersionInfoSize(LPCTSTR lptstrFilename, LPDWORD lpdwHandle) -{ - if (g_GetFileVersionInfoSize) - { - return (*g_GetFileVersionInfoSize)(lptstrFilename, lpdwHandle); - } - return 0; -} - - -typedef BOOL (__stdcall *FVN_GetFileVersionInfo)(LPCTSTR, DWORD, DWORD, LPVOID); -static FVN_GetFileVersionInfo g_GetFileVersionInfo = NULL; - -static BOOL __stdcall -ERGetFileVersionInfo(LPCTSTR lptstrFilename, DWORD dwHandle, - DWORD dwLen, LPVOID lpData) -{ - if (g_GetFileVersionInfo) - { - return (*g_GetFileVersionInfo)(lptstrFilename, dwHandle, dwLen, lpData); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_VerQueryValue)(const LPVOID, LPTSTR, LPVOID *, PUINT); -static FVN_VerQueryValue g_VerQueryValue = NULL; - -static BOOL __stdcall -ERVerQueryValue(const LPVOID pBlock, LPTSTR lpSubBlock, - LPVOID *lplpBuffer, PUINT puLen) -{ - if (g_VerQueryValue) - { - return (*g_VerQueryValue)(pBlock, lpSubBlock, lplpBuffer, puLen); - } - return 0; -} - -static HMODULE g_VerMod = NULL; -static BOOL ERLoadVersionDLL() -{ - if (!g_VerMod) - { - g_VerMod = LoadLibrary("Version.dll"); - if (g_VerMod) - { - g_GetFileVersionInfoSize = (FVN_GetFileVersionInfoSize)GetProcAddress(g_VerMod, "GetFileVersionInfoSizeA"); - g_GetFileVersionInfo = (FVN_GetFileVersionInfo) GetProcAddress(g_VerMod, "GetFileVersionInfoA"); - g_VerQueryValue = (FVN_VerQueryValue) GetProcAddress(g_VerMod, "VerQueryValueA"); - } - } - if (g_VerMod && g_GetFileVersionInfoSize && g_GetFileVersionInfo && g_VerQueryValue) - return TRUE; - return FALSE; -} - -#endif //_USE_VERSIONING_ - -/*---------------------------------------------------------------------- - imagehlp.dll Wrappers -----------------------------------------------------------------------*/ -#if defined(_IMAGEHLP_) && defined(_X86_) - -typedef BOOL (__stdcall *FVN_SymInitialize)(HANDLE, PSTR, BOOL); -static FVN_SymInitialize g_SymInitialize = NULL; - -static BOOL __stdcall -ERSymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess) -{ - if (g_SymInitialize) - { - return (*g_SymInitialize)(hProcess, UserSearchPath, fInvadeProcess); - } - return 0; -} - - -typedef BOOL (__stdcall *FVN_SymCleanup)(HANDLE); -static FVN_SymCleanup g_SymCleanup = NULL; - -static BOOL __stdcall ERSymCleanup(HANDLE hProcess) -{ - if (g_SymCleanup) - { - return (*g_SymCleanup)(hProcess); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_StackWalk)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID, - PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE , - PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE); -static FVN_StackWalk g_StackWalk = NULL; - -static BOOL __stdcall ERStackWalk( - DWORD MachineType, - HANDLE hProcess, - HANDLE hThread, - LPSTACKFRAME StackFrame, - PVOID ContextRecord, - PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, - PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine, - PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, - PTRANSLATE_ADDRESS_ROUTINE TranslateAddress -) -{ - if (g_StackWalk) - { - return (*g_StackWalk)(MachineType, hProcess, hThread, StackFrame, - ContextRecord, ReadMemoryRoutine, FunctionTableAccessRoutine, - GetModuleBaseRoutine, TranslateAddress - ); - } - return 0; -} - -typedef LPVOID (__stdcall *FVN_SymFunctionTableAccess)(HANDLE, DWORD); -static FVN_SymFunctionTableAccess g_SymFunctionTableAccess = NULL; - -static LPVOID __stdcall -ERSymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase) -{ - if (g_SymFunctionTableAccess) - { - return (*g_SymFunctionTableAccess)(hProcess, AddrBase); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_SymGetModuleBase)(HANDLE, DWORD); -static FVN_SymGetModuleBase g_SymGetModuleBase = NULL; - -static DWORD __stdcall -ERSymGetModuleBase(HANDLE hProcess, DWORD dwAddr) -{ - if (g_SymGetModuleBase) - { - return (*g_SymGetModuleBase)(hProcess, dwAddr); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_SymGetModuleInfo)(HANDLE, DWORD, PIMAGEHLP_MODULE); -static FVN_SymGetModuleInfo g_SymGetModuleInfo = NULL; - -static BOOL __stdcall -ERSymGetModuleInfo(HANDLE hProcess, DWORD dwAddr, PIMAGEHLP_MODULE ModuleInfo) -{ - if (g_SymGetModuleInfo) - { - return (*g_SymGetModuleInfo)(hProcess, dwAddr, ModuleInfo); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_SymGetSymFromAddr)(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL); -static FVN_SymGetSymFromAddr g_SymGetSymFromAddr = NULL; - -static BOOL __stdcall -ERSymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol) -{ - if (g_SymGetSymFromAddr) - { - return (*g_SymGetSymFromAddr)(hProcess, Address, Displacement, Symbol); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_SymGetLineFromAddr)(HANDLE, DWORD64, PDWORD, PER_IMAGEHLP_LINE64); -static FVN_SymGetLineFromAddr g_SymGetLineFromAddr = NULL; -static BOOL __stdcall - ERSymGetLineFromAddr(HANDLE hProcess, DWORD64 Address, PDWORD Displacement, PER_IMAGEHLP_LINE64 Line) -{ - if (g_SymGetLineFromAddr) - { - return (*g_SymGetLineFromAddr)(hProcess, Address, Displacement, Line); - } - return 0; -} - -typedef BOOL (WINAPI *FVN_MiniDumpWriteDump)( HANDLE hProcess, - DWORD dwPid, - HANDLE hFile, - MINIDUMP_TYPE DumpType, - CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, - CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, - CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam); -static FVN_MiniDumpWriteDump g_MiniDumpWriteDump = NULL; - -static CRITICAL_SECTION g_miniCritSec; - -static BOOL __stdcall - ERMiniDumpWriteDump(HANDLE hProcess, - DWORD dwPid, - HANDLE hFile, - MINIDUMP_TYPE DumpType, - CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, - CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, - CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam) -{ - if (g_MiniDumpWriteDump) - { - // DBGHELP.DLL is not thread safe - BOOL result; - EnterCriticalSection(&g_miniCritSec); - result = (*g_MiniDumpWriteDump)(hProcess, dwPid, hFile, DumpType, ExceptionParam, UserStreamParam, CallbackParam); - LeaveCriticalSection(&g_miniCritSec); - return result; - } - return 0; -} - - -static HMODULE g_ImgHlpMod = NULL; -static BOOL ERLoadImageHlpDLL() -{ - if (!g_ImgHlpMod) - { - g_ImgHlpMod = LoadLibrary("dbghelp.dll"); - if (!g_ImgHlpMod) - g_ImgHlpMod = LoadLibrary("Imagehlp.dll"); - - if (g_ImgHlpMod) - { - g_SymInitialize = (FVN_SymInitialize)GetProcAddress(g_ImgHlpMod, "SymInitialize"); - g_SymCleanup = (FVN_SymCleanup)GetProcAddress(g_ImgHlpMod, "SymCleanup"); - g_StackWalk = (FVN_StackWalk)GetProcAddress(g_ImgHlpMod, "StackWalk"); - g_SymFunctionTableAccess = (FVN_SymFunctionTableAccess)GetProcAddress(g_ImgHlpMod, "SymFunctionTableAccess"); - g_SymGetModuleBase = (FVN_SymGetModuleBase)GetProcAddress(g_ImgHlpMod, "SymGetModuleBase"); - g_SymGetModuleInfo = (FVN_SymGetModuleInfo)GetProcAddress(g_ImgHlpMod, "SymGetModuleInfo"); - g_SymGetSymFromAddr = (FVN_SymGetSymFromAddr)GetProcAddress(g_ImgHlpMod, "SymGetSymFromAddr"); - g_SymGetLineFromAddr = (FVN_SymGetLineFromAddr)GetProcAddress(g_ImgHlpMod, "SymGetLineFromAddr64"); - - InitializeCriticalSection(&g_miniCritSec); - g_MiniDumpWriteDump = (FVN_MiniDumpWriteDump)GetProcAddress(g_ImgHlpMod, "MiniDumpWriteDump"); - } - } - if (g_ImgHlpMod && - g_SymInitialize && g_SymCleanup && - g_StackWalk && g_SymFunctionTableAccess && - g_SymGetModuleBase && g_SymGetModuleInfo && - g_SymGetSymFromAddr) - return TRUE; - return FALSE; -} -#endif // defined(_IMAGEHLP_) && defined(_X86_) - - -/*---------------------------------------------------------------------- - Version.dll Wrappers -----------------------------------------------------------------------*/ -#ifdef _USE_PSAPI_ - -typedef BOOL (__stdcall *FVN_EnumProcessModules)(HANDLE, HMODULE *, DWORD , LPDWORD ); -static FVN_EnumProcessModules g_EnumProcessModules = NULL; - -static BOOL __stdcall -EREnumProcessModules(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded) -{ - if (g_EnumProcessModules) - { - return (*g_EnumProcessModules)(hProcess, lphModule, cb, lpcbNeeded); - } - return 0; -} - -typedef BOOL (__stdcall *FVN_GetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD); -static FVN_GetModuleInformation g_GetModuleInformation = NULL; - -static BOOL __stdcall -ERGetModuleInformation(HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb) -{ - if (g_GetModuleInformation) - { - return (*g_GetModuleInformation)(hProcess, hModule, lpmodinfo, cb); - } - return 0; -} - -static HMODULE g_PSAPIMod = NULL; -static BOOL ERLoadPSAPIDLL() -{ - if (!g_PSAPIMod) - { - g_PSAPIMod = LoadLibrary("psapi.dll"); - if (g_PSAPIMod) - { - g_EnumProcessModules = (FVN_EnumProcessModules)GetProcAddress(g_PSAPIMod, "EnumProcessModules"); - g_GetModuleInformation = (FVN_GetModuleInformation)GetProcAddress(g_PSAPIMod, "GetModuleInformation"); - } - } - if (g_PSAPIMod && g_EnumProcessModules && g_GetModuleInformation) - return TRUE; - return FALSE; -} - - -#endif //_USE_PSAPI_ - - -#pragma region Crash MiniDump Handler - -static BOOL ERGetImpersonationToken(HANDLE* phToken) -{ - *phToken = NULL; - if(!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, TRUE, phToken)) - { - if(GetLastError() == ERROR_NO_TOKEN) - { - // No impersonation token for the current thread available - go for the process token - if(!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, phToken)) - { - return FALSE; - } - } - else - { - return FALSE; - } - } - return TRUE; -} - -static BOOL EREnablePriv(LPCTSTR pszPriv, HANDLE hToken, TOKEN_PRIVILEGES* ptpOld) -{ - BOOL bOk = FALSE; - - TOKEN_PRIVILEGES tp; - tp.PrivilegeCount = 1; - tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - bOk = LookupPrivilegeValue( 0, pszPriv, &tp.Privileges[0].Luid); - if(bOk) - { - DWORD cbOld = sizeof(*ptpOld); - bOk = AdjustTokenPrivileges(hToken, FALSE, &tp, cbOld, ptpOld, &cbOld); - } - - return (bOk && (ERROR_NOT_ALL_ASSIGNED != GetLastError())); -} - -static BOOL ERRestorePriv(HANDLE hToken, TOKEN_PRIVILEGES* ptpOld) -{ - BOOL bOk = AdjustTokenPrivileges(hToken, FALSE, ptpOld, 0, 0, 0); - return (bOk && (ERROR_NOT_ALL_ASSIGNED != GetLastError())); -} - -static BOOL ERGenerateMiniDump(CHAR *szFileName, PEXCEPTION_POINTERS pExceptionInfo) -{ - BOOL bRet = FALSE; - DWORD dwLastError = 0; - HANDLE hDumpFile = 0; - MINIDUMP_EXCEPTION_INFORMATION stInfo = {0}; - TOKEN_PRIVILEGES tp; - HANDLE hImpersonationToken = NULL; - BOOL bPrivilegeEnabled; - - if(!ERGetImpersonationToken(&hImpersonationToken)) - { - return FALSE; - } - - // Create the dump file - hDumpFile = CreateFileA(szFileName, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_WRITE | FILE_SHARE_READ, - 0, CREATE_ALWAYS, 0, 0); - if(hDumpFile == INVALID_HANDLE_VALUE) - { - CloseHandle(hImpersonationToken); - return FALSE; - } - - // Write the dump - stInfo.ThreadId = GetCurrentThreadId(); - stInfo.ExceptionPointers = pExceptionInfo; - stInfo.ClientPointers = TRUE; - - // We need the SeDebugPrivilege to be able to run MiniDumpWriteDump - bPrivilegeEnabled = EREnablePriv(SE_DEBUG_NAME, hImpersonationToken, &tp); - -// VS 2008 and VS 2010 -#if _MSC_VER >= 1500 - bRet = ERMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile - , (MINIDUMP_TYPE)(MiniDumpWithHandleData|MiniDumpWithThreadInfo|MiniDumpWithDataSegs), &stInfo, NULL, NULL); -// VS 2005 -#else - bRet = ERMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile - , (MINIDUMP_TYPE)(MiniDumpWithHandleData|MiniDumpWithDataSegs), &stInfo, NULL, NULL); -#endif - - if(bPrivilegeEnabled) - { - // Restore the privilege - ERRestorePriv(hImpersonationToken, &tp); - } - - CloseHandle(hDumpFile); - CloseHandle(hImpersonationToken); - - return bRet; -} - - -/*---------------------------------------------------------------------- - Handler -----------------------------------------------------------------------*/ - -LONG __stdcall ERCrashDumpExceptionFilterEx(const CHAR *pAppName, const CHAR* pPath, EXCEPTION_POINTERS* pExPtrs) -{ - LONG lRet = EXCEPTION_CONTINUE_SEARCH ; - FILE *fdump = NULL; - HANDLE hProc = GetCurrentProcess(); - SYSTEMTIME stTime; - CHAR pszFilename[MAX_PATH], szPathName[_MAX_PATH], szBuffer[_MAX_PATH]; - size_t cbFilename = sizeof(pszFilename) / sizeof(pszFilename[0]) - 1; - if (!ERLoadImageHlpDLL()) - return lRet; - - __try - { - szPathName[0] = 0; - if (pPath && *pPath) - GetFullPathNameA(pPath, MAX_PATH, szPathName, NULL); - if (szPathName[strlen(szPathName)-1] != '\\') - lstrcat(szPathName, "\\"); - - // Create filename - GetLocalTime(&stTime); - - if (pAppName == NULL) - { - GetModuleFileName(NULL, szBuffer, MAX_PATH); - CHAR *pszFilePart = strrchr(szBuffer, '\\'); - pszFilePart = (pszFilePart == NULL) ? szBuffer : pszFilePart+1; - if (CHAR *pExt = strrchr(pszFilePart, '.') ) - *pExt = 0; - pAppName = pszFilePart; - } - - // Filename is composed like this, to avoid collisions; - // \-Crash---YYYYMMDD-HHMMSS.dmp - _snprintf_s(pszFilename, cbFilename, cbFilename, "%s-Crash-%ld-%ld-%04d%02d%02d-%02d%02d%02d", pAppName, GetCurrentProcessId(), GetCurrentThreadId(), stTime.wYear,stTime.wMonth,stTime.wDay,stTime.wHour, stTime.wMinute, stTime.wSecond); - lstrcat(szPathName, pszFilename); - lstrcpy(szPathName, ".dmp"); - - // Generate proper mini dump - ERGenerateMiniDump(szPathName, pExPtrs); - } - __except ( EXCEPTION_EXECUTE_HANDLER ) - { - lRet = EXCEPTION_CONTINUE_SEARCH ; - } - if (hProc != (HANDLE)0xFFFFFFFF) CloseHandle(hProc); - if (fdump) fclose(fdump); - return ( lRet ) ; -} - -LONG __stdcall ERCrashDumpExceptionFilter (EXCEPTION_POINTERS* pExPtrs) -{ - return ERCrashDumpExceptionFilterEx(NULL, NULL, pExPtrs); -} - - -LONG __stdcall ERGetVersionStringA(LPCSTR szModName, LPSTR szVersion, int maxlen) -{ -#ifdef _USE_VERSIONING_ - if (ERLoadVersionDLL()) - { - UINT dwBytes = 0; - LPVOID lpBuffer = 0; - LPVOID lpData; - DWORD dwSize; - - szVersion[0] = 0; - dwSize = ERGetFileVersionInfoSize(szModName, 0); - lpData = alloca(dwSize); - ERGetFileVersionInfo(szModName, 0, dwSize, lpData); - if (ERVerQueryValue(lpData, TEXT("\\"), &lpBuffer, &dwBytes)) - { - VS_FIXEDFILEINFO *lpvs = (VS_FIXEDFILEINFO *)lpBuffer; - if (lpvs->dwFileVersionLS) - { - sprintf_s(szVersion, maxlen, "%d.%d.%d.%d", - HIWORD(lpvs->dwFileVersionMS), LOWORD(lpvs->dwFileVersionMS), - HIWORD(lpvs->dwFileVersionLS), LOWORD(lpvs->dwFileVersionLS) - ); - } - else if (lpvs->dwFileVersionMS) - { - sprintf_s(szVersion, maxlen, "%d.%d", - HIWORD(lpvs->dwFileVersionMS), LOWORD(lpvs->dwFileVersionMS) - ); - } - return strlen(szVersion); - } - } -#endif - return 0; -} - - - -#if defined(_IMAGEHLP_) && defined(_X86_) - -BOOL __stdcall ERReadProcessMemory ( HANDLE hProc, - LPCVOID lpBaseAddress, - LPVOID lpBuffer, - DWORD nSize, - LPDWORD lpNumberOfBytesRead ) -{ - return ( ReadProcessMemory ( GetCurrentProcess ( ) , - lpBaseAddress , - lpBuffer , - nSize , - lpNumberOfBytesRead ) ) ; -} - -static void ERLogStackWalk(HWFILE fdump, EXCEPTION_POINTERS* pExPtrs) -{ - #define SAVE_EBP(f) f.Reserved[0] - #define TRAP_TSS(f) f.Reserved[1] - #define TRAP_EDITED(f) f.Reserved[1] - #define SAVE_TRAP(f) f.Reserved[2] - - CONTEXT Context; - DWORD dwDisplacement = 0; - char *szSymName; - IMAGEHLP_MODULE mi; - STACKFRAME stFrame; - DWORD i; - HANDLE hProc = (HANDLE)GetCurrentProcess(); - - memcpy( &Context, pExPtrs->ContextRecord, sizeof( CONTEXT ) ); - - if (!ERLoadImageHlpDLL()) - return; - - ErrorLog(fdump, "Stack Walk:\r\n"); - - ERSymInitialize(hProc, NULL, TRUE); - - memset(g_sym, 0, MAX_SYMNAME_SIZE + sizeof(IMAGEHLP_SYMBOL) ) ; - g_sym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL); - g_sym->MaxNameLength = MAX_SYMNAME_SIZE; - - - ZeroMemory( &stFrame, sizeof(stFrame) ); - - stFrame.AddrPC.Offset = Context.Eip ; - stFrame.AddrPC.Mode = AddrModeFlat ; - stFrame.AddrStack.Offset = Context.Esp ; - stFrame.AddrStack.Mode = AddrModeFlat ; - stFrame.AddrFrame.Offset = Context.Ebp ; - stFrame.AddrFrame.Mode = AddrModeFlat ; - - ErrorLog(fdump, "FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name\r\n"); - - for (i=0; i<15; i++) - { - if (!ERStackWalk( IMAGE_FILE_MACHINE_I386, - hProc, - GetCurrentThread(), - &stFrame, - &Context, - NULL, - ERSymFunctionTableAccess, - ERSymGetModuleBase, - NULL)) - { - break; - } - - if (ERSymGetSymFromAddr(hProc, stFrame.AddrPC.Offset, &dwDisplacement, g_sym)) { - szSymName = g_sym->Name; - } - else { - szSymName = ""; - } - ErrorLog(fdump, "%08x %08x %08x %08x %08x %08x ", - stFrame.AddrFrame.Offset, - stFrame.AddrReturn.Offset, - stFrame.Params[0], - stFrame.Params[1], - stFrame.Params[2], - stFrame.Params[3] - ); - - memset(&mi, 0, sizeof(mi)); - mi.SizeOfStruct = sizeof(mi); - if (ERSymGetModuleInfo(hProc, stFrame.AddrPC.Offset, &mi )) { - ErrorLog(fdump, "%s!", mi.ModuleName ); - } - - ErrorLog(fdump, "%s ", szSymName ); - - if (g_sym && (g_sym->Flags & SYMF_OMAP_GENERATED || g_sym->Flags & SYMF_OMAP_MODIFIED)) { - ErrorLog(fdump, "[omap] " ); - } - - if (stFrame.FuncTableEntry) - { - PFPO_DATA pFpoData = (PFPO_DATA)stFrame.FuncTableEntry; - switch (pFpoData->cbFrame) - { - case FRAME_FPO: - if (pFpoData->fHasSEH) - { - ErrorLog(fdump, "(FPO: [SEH])" ); - } else - { - ErrorLog(fdump, " (FPO:" ); - if (pFpoData->fUseBP) - { - ErrorLog(fdump, " [EBP 0x%08x]", SAVE_EBP(stFrame) ); - } - ErrorLog(fdump, " [%d,%d,%d])", pFpoData->cdwParams, - pFpoData->cdwLocals, - pFpoData->cbRegs); - } - break; - case FRAME_NONFPO: - ErrorLog(fdump, "(FPO: Non-FPO [%d,%d,%d])", - pFpoData->cdwParams, - pFpoData->cdwLocals, - pFpoData->cbRegs); - break; - - case FRAME_TRAP: - case FRAME_TSS: - default: - ErrorLog(fdump, "(UNKNOWN FPO TYPE)" ); - break; - } - } - ER_IMAGEHLP_LINE64 lineInfo; - ZeroMemory( &lineInfo, sizeof(lineInfo) ); - lineInfo.SizeOfStruct = sizeof(lineInfo); - dwDisplacement = 0; - if ( ERSymGetLineFromAddr(hProc, stFrame.AddrPC.Offset, &dwDisplacement, &lineInfo) ) - ErrorLog(fdump, " \t%s:%d ", lineInfo.FileName, lineInfo.LineNumber); - - ErrorLog(fdump, "\r\n" ); - } - ErrorLog(fdump, "\r\n" ); - - ERSymCleanup(hProc); - - return; -} -#endif //_IMAGEHLP_ - -//************************************ -// Method: ERLogStackWalk -// FullName: ERLogStackWalk -// Access: public static -// Returns: LPCSTR (Free with LocalFree) -// Qualifier: -// Parameter: EXCEPTION_POINTERS * pExPtrs -//************************************ -LPCSTR ERStackWalk(EXCEPTION_POINTERS* pExPtrs) -{ -#if defined(_IMAGEHLP_) && defined(_X86_) - CONTEXT Context; - DWORD dwDisplacement = 0; - char *szSymName; - IMAGEHLP_MODULE mi; - STACKFRAME stFrame; - DWORD i; - HANDLE hProc = (HANDLE)GetCurrentProcess(); - - if (!ERLoadImageHlpDLL()) - return NULL; - - std::stringstream ss; - - HMODULE hModule = GetModuleHandle(NULL); - - memcpy( &Context, pExPtrs->ContextRecord, sizeof( CONTEXT ) ); - - ERSymInitialize(hProc, NULL, TRUE); - - memset(g_sym, 0, MAX_SYMNAME_SIZE + sizeof(IMAGEHLP_SYMBOL) ) ; - g_sym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL); - g_sym->MaxNameLength = MAX_SYMNAME_SIZE; - - ZeroMemory( &stFrame, sizeof(stFrame) ); - - stFrame.AddrPC.Offset = Context.Eip ; - stFrame.AddrPC.Mode = AddrModeFlat ; - stFrame.AddrStack.Offset = Context.Esp ; - stFrame.AddrStack.Mode = AddrModeFlat ; - stFrame.AddrFrame.Offset = Context.Ebp ; - stFrame.AddrFrame.Mode = AddrModeFlat ; - - for (i=0; i<100; i++) - { - if (!ERStackWalk( IMAGE_FILE_MACHINE_I386, - hProc, - GetCurrentThread(), - &stFrame, - &Context, - NULL, - ERSymFunctionTableAccess, - ERSymGetModuleBase, - NULL)) - { - break; - } - - if (ERSymGetSymFromAddr(hProc, stFrame.AddrPC.Offset, &dwDisplacement, g_sym)) { - szSymName = g_sym->Name; - } - else { - szSymName = ""; - } - memset(&mi, 0, sizeof(mi)); - mi.SizeOfStruct = sizeof(mi); - if (ERSymGetModuleInfo(hProc, stFrame.AddrPC.Offset, &mi )) { - if (mi.BaseOfImage != (DWORD)hModule) - { - ss << mi.ModuleName << "!"; - } - } - ss << szSymName << " "; - - ER_IMAGEHLP_LINE64 lineInfo; - ZeroMemory( &lineInfo, sizeof(lineInfo) ); - lineInfo.SizeOfStruct = sizeof(lineInfo); - dwDisplacement = 0; - if ( ERSymGetLineFromAddr(hProc, stFrame.AddrPC.Offset, &dwDisplacement, &lineInfo) ) - { - LPSTR pFileName = strrchr(lineInfo.FileName, '\\'); - if (pFileName) ++pFileName; - if (!pFileName) pFileName = lineInfo.FileName; - - ss << " \t" << pFileName << ":" << lineInfo.LineNumber << " "; - } - ss << std::endl; - } - ss << std::endl; - - ERSymCleanup(hProc); - - std::string str = ss.str(); - LPSTR lpResult = (LPSTR)LocalAlloc(LPTR, str.length()+1); - strcpy(lpResult, str.c_str()); - return lpResult; -#else - return NULL; -#endif //_IMAGEHLP_ -} - - -//************************************ -// Method: ERGetFirstModuleException -// FullName: ERGetFirstModuleException -// Access: public -// Returns: BOOL -// Qualifier: -// Parameter: EXCEPTION_POINTERS * pExPtrs -// Parameter: HMODULE hModule -// Parameter: LPSTR funcName -// Parameter: INT funcNameLen -// Parameter: LPSTR sourceName -// Parameter: INT sourceNameLen -// Parameter: INT * lpLineNum -//************************************ -BOOL ERGetFirstModuleException( - EXCEPTION_POINTERS* pExPtrs - , HMODULE hModule - , LPSTR funcName, INT funcNameLen - , LPSTR sourceName, INT sourceNameLen - , INT *lpLineNum - ) -{ -#if defined(_IMAGEHLP_) && defined(_X86_) - CONTEXT Context; - DWORD dwDisplacement = 0; - char *szSymName; - IMAGEHLP_MODULE mi; - STACKFRAME stFrame; - DWORD i; - HANDLE hProc = (HANDLE)GetCurrentProcess(); - BOOL bFound = FALSE; - - if (!ERLoadImageHlpDLL()) - return FALSE; - - memcpy( &Context, pExPtrs->ContextRecord, sizeof( CONTEXT ) ); - - if (hModule == NULL) - hModule = GetModuleHandle(NULL); - - ERSymInitialize(hProc, NULL, TRUE); - - memset(g_sym, 0, MAX_SYMNAME_SIZE + sizeof(IMAGEHLP_SYMBOL) ) ; - g_sym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL); - g_sym->MaxNameLength = MAX_SYMNAME_SIZE; - - ZeroMemory( &stFrame, sizeof(stFrame) ); - - stFrame.AddrPC.Offset = Context.Eip ; - stFrame.AddrPC.Mode = AddrModeFlat ; - stFrame.AddrStack.Offset = Context.Esp ; - stFrame.AddrStack.Mode = AddrModeFlat ; - stFrame.AddrFrame.Offset = Context.Ebp ; - stFrame.AddrFrame.Mode = AddrModeFlat ; - - for (i=0; i<15; i++) - { - if (!ERStackWalk( IMAGE_FILE_MACHINE_I386, - hProc, - GetCurrentThread(), - &stFrame, - &Context, - NULL, - ERSymFunctionTableAccess, - ERSymGetModuleBase, - NULL)) - { - break; - } - - if (ERSymGetSymFromAddr(hProc, stFrame.AddrPC.Offset, &dwDisplacement, g_sym)) { - szSymName = g_sym->Name; - } - else { - szSymName = ""; - } - memset(&mi, 0, sizeof(mi)); - mi.SizeOfStruct = sizeof(mi); - if (!ERSymGetModuleInfo(hProc, stFrame.AddrPC.Offset, &mi )) - continue; - - if (mi.BaseOfImage != (DWORD)hModule) - continue; - - ER_IMAGEHLP_LINE64 lineInfo; - ZeroMemory( &lineInfo, sizeof(lineInfo) ); - lineInfo.SizeOfStruct = sizeof(lineInfo); - dwDisplacement = 0; - if ( ERSymGetLineFromAddr(hProc, stFrame.AddrPC.Offset, &dwDisplacement, &lineInfo) ) - { - LPSTR pFileName = strrchr(lineInfo.FileName, '\\'); - if (pFileName) ++pFileName; - if (!pFileName) pFileName = lineInfo.FileName; - - if (funcName) lstrcpyn(funcName,szSymName, funcNameLen); - if (sourceName) lstrcpyn(sourceName,pFileName, sourceNameLen); - if (lpLineNum) *lpLineNum = lineInfo.LineNumber; - bFound = TRUE; - break; - } - } - - ERSymCleanup(hProc); - return bFound; -#else - return FALSE; -#endif //_IMAGEHLP_ -} - - -void ERLogModules(HWFILE fdump) -{ -#ifdef _USE_PSAPI_ - if (!ERLoadImageHlpDLL()) - return; - - HANDLE hProc = (HANDLE)GetCurrentProcess(); - ERSymInitialize(hProc, NULL, TRUE); - - if (IsNT()) - { - if (ERLoadPSAPIDLL()) - { - HMODULE hMods[1024]; - DWORD cbNeeded; - unsigned int i; - -#ifdef _USE_VERSIONING_ - BOOL bVerOK = ERLoadVersionDLL(); -#endif - if( EREnumProcessModules(hProc, hMods, sizeof(hMods), &cbNeeded)) - { - for ( i = 0; i < (cbNeeded / sizeof(HMODULE)); i++ ) - { - char szModName[MAX_PATH]; - MODULEINFO mi; - memset(&mi, 0, sizeof(MODULEINFO)); - - ERGetModuleInformation(hProc, hMods[i], &mi, sizeof(MODULEINFO)); - - // Get the full path to the module's file. - if ( GetModuleFileName( hMods[i], szModName, sizeof(szModName))) - { - BOOL bPrintSimple = TRUE; - - // Open the code module file so that we can get its file date - // and size. - HANDLE ModuleFile = CreateFile(szModName, GENERIC_READ, - FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - char TimeBuffer[100] = ""; - DWORD FileSize = 0; - if (ModuleFile != INVALID_HANDLE_VALUE) - { - FileSize = GetFileSize(ModuleFile, 0); - FILETIME LastWriteTime; - if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime)) - { - wsprintf(TimeBuffer, " - file date is "); - PrintTime(TimeBuffer + lstrlen(TimeBuffer), LastWriteTime); - } - CloseHandle(ModuleFile); - } - -#ifdef _USE_VERSIONING_ - if (bVerOK) - { - UINT dwBytes = 0; - LPVOID lpBuffer = 0; - LPVOID lpData; - DWORD dwSize; - - dwSize = ERGetFileVersionInfoSize(szModName, 0); - lpData = alloca(dwSize); - ERGetFileVersionInfo(szModName, 0, dwSize, lpData); - if (ERVerQueryValue(lpData, TEXT("\\"), &lpBuffer, &dwBytes)) - { - VS_FIXEDFILEINFO *lpvs = (VS_FIXEDFILEINFO *)lpBuffer; - - ErrorLog(fdump, "(%.8X - %.8X) %s \t %d.%d.%d.%d \t %d.%d.%d.%d \t %s\r\n", - mi.lpBaseOfDll, ((LPBYTE)(mi.lpBaseOfDll)) + mi.SizeOfImage, - szModName, - HIWORD(lpvs->dwFileVersionMS), LOWORD(lpvs->dwFileVersionMS), - HIWORD(lpvs->dwFileVersionLS), LOWORD(lpvs->dwFileVersionLS), - HIWORD(lpvs->dwProductVersionMS), LOWORD(lpvs->dwProductVersionMS), - HIWORD(lpvs->dwProductVersionLS), LOWORD(lpvs->dwProductVersionLS), - TimeBuffer - ); - bPrintSimple = FALSE; - } - } -#endif - if (bPrintSimple) - { - ErrorLog(fdump, "(%.8X - %.8X) %s \t %s\r\n", - mi.lpBaseOfDll, ((LPBYTE)(mi.lpBaseOfDll)) + mi.SizeOfImage, - szModName, TimeBuffer - ); - } - } - } - } - } - } - ERSymCleanup(hProc); -#endif -} - -#endif diff --git a/Standard Gaming Platform/ExceptionHandling.h b/Standard Gaming Platform/ExceptionHandling.h deleted file mode 100644 index b5ae4a985..000000000 --- a/Standard Gaming Platform/ExceptionHandling.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _EXCEPTION_HANDLING__H_ -#define _EXCEPTION_HANDLING__H_ - -#include - -//uncomment this line if you want Exceptions to be handled -#ifdef JA2 - -#ifndef _DEBUG - #define ENABLE_EXCEPTION_HANDLING -#endif - -#else - //Wizardry -//#define ENABLE_EXCEPTION_HANDLING -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - - -INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ); - - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp index c1630801d..68f4d44d7 100644 --- a/Standard Gaming Platform/FileMan.cpp +++ b/Standard Gaming Platform/FileMan.cpp @@ -39,7 +39,6 @@ #include "windows.h" #include "FileMan.h" #include "MemMan.h" - #include "DbMan.h" #include "Debug.h" #include "RegInst.h" #include "Container.h" @@ -101,7 +100,6 @@ typedef struct FMFileInfoTag UINT8 uiFileAccess; UINT32 uiFilePosition; HANDLE hFileHandle; - HDBFILE hDBFile; } FMFileInfo; // for 'File Manager File Information' diff --git a/Standard Gaming Platform/JA2 SGP ALL.H b/Standard Gaming Platform/JA2 SGP ALL.H deleted file mode 100644 index 0d9e6e38f..000000000 --- a/Standard Gaming Platform/JA2 SGP ALL.H +++ /dev/null @@ -1,104 +0,0 @@ -/* - * ChangeLog: - * 10.12.2005 Lesh ripped out everything that refers to MSS - * 10.12.2005 Lesh added fmod.h - */ -#ifndef __JA2_SGP_ALL_H -#define __JA2_SGP_ALL_H - -#pragma message("GENERATED PCH FOR JA2 SGP PROJECT.") - -//#ifndef INITGUID -// #define INITGUID -//#endif - - -#include "WordWrap.h" -#include "video.h" -#include "Button Sound Control.h" -#include "Sound Control.h" -#ifdef _JA2_RENDER_DIRTY - #include "Font Control.h" - #include "Render Dirty.h" - #include "utilities.h" -#endif -#include "input.h" -#include "memman.h" -#include "english.h" -#include "vobject.h" -#include "vobject_blitters.h" -#include "soundman.h" -#include "Button System.h" -#include "line.h" -#include -#include "debug.h" -#ifndef NO_ZLIB_COMPRESSION - #include "zlib.h" - #include "Compression.h" -#endif -#include "types.h" -#include -#include -#include -#include "Container.h" -#if _MSC_VER < 1300 //(iostream.h was removed from VC.NET2003) -#include -#endif -#include "Cursor Control.h" -#include "wcheck.h" -#include "FileMan.h" -#include "DbMan.h" -#include -#include -#include "TopicIDs.h" -#include "TopicOps.h" -#include "WizShare.h" -#include "screenids.h" -#include "Sys Globals.h" -#include "jascreens.h" -#include "gameloop.h" -#include "DirectX Common.h" -#include "DirectDraw Calls.h" -#include "video_private.h" -#include -#include "RegInst.h" -#include "LibraryDataBase.h" -#include "io.h" -#include -#include "sgp.h" -#include "pcx.h" -#include "Font.h" -#include "himage.h" -#include -#include -#include "impTGA.h" -#include "STCI.h" -#include -#include "local.h" -#include -#include -#include "Install.h" -#include "GameSettings.h" -#ifdef _DEBUG - #include -#endif -#include "mousesystem.h" -#include "Random.h" -#include -#include "vobject_private.h" -#include "shading.h" -#include "imgfmt.h" -#include "timer.h" -#include "renderworld.h" -#include "Isometric utils.h" -#include "fade screen.h" -#include "timer control.h" -#include "vsurface.h" -#include "vsurface_private.h" -#include "Timer Control.h" - -// Lesh modifications -#include "fmod.h" -#include "fmod_errors.h" - -#endif diff --git a/Standard Gaming Platform/SGP_VS2005.vcproj b/Standard Gaming Platform/SGP_VS2005.vcproj index 3c294cb12..a07db5047 100644 --- a/Standard Gaming Platform/SGP_VS2005.vcproj +++ b/Standard Gaming Platform/SGP_VS2005.vcproj @@ -394,10 +394,6 @@ RelativePath=".\english.h" > - - @@ -664,10 +660,6 @@ RelativePath=".\English.cpp" > - - diff --git a/Standard Gaming Platform/SGP_VS2008.vcproj b/Standard Gaming Platform/SGP_VS2008.vcproj index 3b77d82ea..33641d919 100644 --- a/Standard Gaming Platform/SGP_VS2008.vcproj +++ b/Standard Gaming Platform/SGP_VS2008.vcproj @@ -394,10 +394,6 @@ RelativePath="english.h" > - - @@ -662,10 +658,6 @@ RelativePath="English.cpp" > - - diff --git a/Standard Gaming Platform/SGP_VS2010.vcxproj b/Standard Gaming Platform/SGP_VS2010.vcxproj index be699a528..cbb4b1bc5 100644 --- a/Standard Gaming Platform/SGP_VS2010.vcxproj +++ b/Standard Gaming Platform/SGP_VS2010.vcxproj @@ -37,7 +37,6 @@ - @@ -105,7 +104,6 @@ - diff --git a/Standard Gaming Platform/SGP_VS2010.vcxproj.filters b/Standard Gaming Platform/SGP_VS2010.vcxproj.filters index b8ed09426..56ac87f45 100644 --- a/Standard Gaming Platform/SGP_VS2010.vcxproj.filters +++ b/Standard Gaming Platform/SGP_VS2010.vcxproj.filters @@ -54,9 +54,6 @@ Header Files - - Header Files - Header Files @@ -251,9 +248,6 @@ Source Files - - Source Files - Source Files diff --git a/Standard Gaming Platform/SGP_VS2013.vcxproj b/Standard Gaming Platform/SGP_VS2013.vcxproj index 807239723..f7ac72b8c 100644 --- a/Standard Gaming Platform/SGP_VS2013.vcxproj +++ b/Standard Gaming Platform/SGP_VS2013.vcxproj @@ -37,7 +37,6 @@ - @@ -105,7 +104,6 @@ - diff --git a/Standard Gaming Platform/SGP_VS2013.vcxproj.filters b/Standard Gaming Platform/SGP_VS2013.vcxproj.filters index b8ed09426..56ac87f45 100644 --- a/Standard Gaming Platform/SGP_VS2013.vcxproj.filters +++ b/Standard Gaming Platform/SGP_VS2013.vcxproj.filters @@ -54,9 +54,6 @@ Header Files - - Header Files - Header Files @@ -251,9 +248,6 @@ Source Files - - Source Files - Source Files diff --git a/Standard Gaming Platform/SGP_VS2017.vcxproj b/Standard Gaming Platform/SGP_VS2017.vcxproj index 41584cb9d..20b391f01 100644 --- a/Standard Gaming Platform/SGP_VS2017.vcxproj +++ b/Standard Gaming Platform/SGP_VS2017.vcxproj @@ -37,7 +37,6 @@ - @@ -105,7 +104,6 @@ - diff --git a/Standard Gaming Platform/SGP_VS2019.vcxproj b/Standard Gaming Platform/SGP_VS2019.vcxproj index 6f1613994..fb28df1d2 100644 --- a/Standard Gaming Platform/SGP_VS2019.vcxproj +++ b/Standard Gaming Platform/SGP_VS2019.vcxproj @@ -49,7 +49,6 @@ - @@ -57,7 +56,6 @@ - @@ -118,14 +116,12 @@ - - diff --git a/Standard Gaming Platform/SGP_VS2019.vcxproj.filters b/Standard Gaming Platform/SGP_VS2019.vcxproj.filters index b12f8ded7..60166baaa 100644 --- a/Standard Gaming Platform/SGP_VS2019.vcxproj.filters +++ b/Standard Gaming Platform/SGP_VS2019.vcxproj.filters @@ -6,14 +6,12 @@ - - @@ -52,7 +50,6 @@ - @@ -60,7 +57,6 @@ - diff --git a/Standard Gaming Platform/WizShare.h b/Standard Gaming Platform/WizShare.h deleted file mode 100644 index 73216e572..000000000 --- a/Standard Gaming Platform/WizShare.h +++ /dev/null @@ -1,54 +0,0 @@ -//************************************************************************** -// -// Filename : WizShare.h -// -// Purpose : -// -// Modification history : -// -// 25nov96:HJH - creation -// -//************************************************************************** - -#ifndef _WizShare_h -#define _WizShare_h - -//************************************************************************** -// -// Includes -// -//************************************************************************** - -#include "types.h" - -//************************************************************************** -// -// Defines -// -//************************************************************************** - -#define MAX_MSG_LENGTH 128 -#define NUM_MESSAGES 100 - -//************************************************************************** -// -// Typedefs -// -//************************************************************************** - -#pragma pack(push, 1) - -typedef struct WizSharedtag -{ - BOOLEAN fMessage; - - INT32 iMessageIndex; // index to 1st message - INT32 iNumMessages; // # messages - INT32 iLastIndex; - - CHAR cMessages[NUM_MESSAGES][MAX_MSG_LENGTH]; -} WizShared; - -#pragma pack(pop) - -#endif diff --git a/Standard Gaming Platform/sgp.h b/Standard Gaming Platform/sgp.h index 6caba4adc..5a247f01f 100644 --- a/Standard Gaming Platform/sgp.h +++ b/Standard Gaming Platform/sgp.h @@ -16,7 +16,6 @@ #include "input.h" #include "memman.h" #include "fileman.h" -#include "dbman.h" #include "soundman.h" #include "pcx.h" #include "line.h" diff --git a/Standard Gaming Platform/trle.h b/Standard Gaming Platform/trle.h deleted file mode 100644 index aebb607c6..000000000 --- a/Standard Gaming Platform/trle.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __TRLE_H -#define __TRLE_H - - -typedef struct -{ - UINT32 uiOffset; - UINT32 uiWidth; - UINT32 uiOffLen; - INT16 sOffsetX; - INT16 sOffsetY; - -} TRLEObject; - - -typedef struct -{ - UINT32 uiHeightEach; - UINT32 uiTotalElements; - TRLEObject *pTRLEObject; - PTR pPixData; - UINT32 uiSizePixDataElem; - -} TRLEData; - - -BOOLEAN GetTRLEObjectData( UINT32 uiTotalElements, TRLEObject *pTRLEObject, INT16 ssIndex, UINT32 *pWidth, UINT32 *pOffset, UINT32 *pOffLen, UINT16 *pOffsetX, UINT16 *pOffsetY ); - -BOOLEAN SetTRLEObjectOffset( UINT32 uiTotalElements, TRLEObject *pTRLEObject, INT16 ssIndex, INT16 sOffsetX, INT16 sOffsetY ); - -#endif \ No newline at end of file diff --git a/Standard Gaming Platform/video_private.h b/Standard Gaming Platform/video_private.h deleted file mode 100644 index c2db612e5..000000000 --- a/Standard Gaming Platform/video_private.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __VIDEO_PRIVATE_ -#define __VIDEO_PRIVATE_ - -// *********************************************************************** -// -// PRIVATE, INTERNAL Header used by other SGP Internal modules -// -// Allows direct access to underlying Direct Draw Implementation -// -// *********************************************************************** - - -LPDIRECTDRAW2 GetDirectDraw2Object( ); -LPDIRECTDRAWSURFACE2 GetPrimarySurfaceInterface( ); -LPDIRECTDRAWSURFACE2 GetBackbufferInterface( ); - -BOOLEAN SetDirectDraw2Object( LPDIRECTDRAW2 pDirectDraw ); -BOOLEAN SetPrimarySurfaceInterface( LPDIRECTDRAWSURFACE2 pSurface ); -BOOLEAN SetBackbufferInterface( LPDIRECTDRAWSURFACE2 pSurface ); - -#endif diff --git a/Standard Gaming Platform/vobject_private.h b/Standard Gaming Platform/vobject_private.h deleted file mode 100644 index e02cb3eb3..000000000 --- a/Standard Gaming Platform/vobject_private.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __VOBJECT_PRIVATE_ -#define __VOBJECT_PRIVATE_ - -#endif \ No newline at end of file diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index ce739e3ff..c379eab2b 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -11,7 +11,6 @@ #include "Game Init.h" #include "interface Dialogue.h" #include "opplist.h" -#include "Strategic All.h" #include "pits.h" #include "Game Event Hook.h" #include "Creature Spreading.h" @@ -40,6 +39,12 @@ #include "soldier profile type.h" #include "history.h" #include "Merc Hiring.h" +#include "Game Events.h" +#include "email.h" +#include "worldman.h" +#include "text.h" +#include "Dialogue Control.h" +#include "Boxing.h" #include "LOS.h" #include "Music Control.h" @@ -75,6 +80,22 @@ extern "C" { #include "BriefingRoom_Data.h" #include "MiniGame.h" // added by Flugente +#include "Campaign.h" +#include "strategic.h" +#include "PreBattle Interface.h" +#include "Strategic Event Handler.h" +#include "files.h" +#include "finances.h" +#include "Sound Control.h" +#include "SaveLoadMap.h" +#include "renderworld.h" +#include "Keys.h" +#include "Render Fun.h" +#include "Soldier Add.h" +#include "gameloop.h" +#include "Merc Contract.h" +#include "message.h" +#include "Town Militia.h" extern UINT8 gubWaitingForAllMercsToExitCode; diff --git a/Strategic/Luaglobal.cpp b/Strategic/Luaglobal.cpp index 82f9401bc..3abb4a73b 100644 --- a/Strategic/Luaglobal.cpp +++ b/Strategic/Luaglobal.cpp @@ -6,7 +6,6 @@ #include "FileMan.h" #include "GameSettings.h" #include "interface Dialogue.h" -#include "Strategic All.h" #include "Luaglobal.h" #include "Boxing.h" #include "LuaInitNPCs.h" @@ -36,6 +35,8 @@ extern "C" { #include "lualib.h" } +#include "strategicmap.h" +#include "Map Screen Interface.h" using namespace std; diff --git a/Strategic/Strategic All.h b/Strategic/Strategic All.h deleted file mode 100644 index f0234cc75..000000000 --- a/Strategic/Strategic All.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef __STRATEGIC_ALL_H -#define __STRATEGIC_ALL_H - -#pragma message("GENERATED PCH FOR STRATEGIC PROJECT.") - -#include "builddefines.h" -#include -#include "types.h" -#include "english.h" -#include "Timer Control.h" -#include "vsurface.h" -#include "Button System.h" -#include "Font Control.h" -#include "Simple Render Utils.h" -#include "Editor Taskbar Utils.h" -#include "line.h" -#include "input.h" -#include "vobject_blitters.h" -#include "Text Input.h" -#include "mousesystem.h" -#include "strategicmap.h" -#include "Fileman.h" -#include "Map Information.h" -#include "render dirty.h" -#include "Game Clock.h" -#include "Campaign Types.h" -#include "Campaign Init.h" -#include "cheats.h" -#include "Queen Command.h" -#include "overhead.h" -#include "Strategic Movement.h" -#include "GameSettings.h" -#include "Game Event Hook.h" -#include "Creature Spreading.h" -#include "message.h" -#include "Game Init.h" -#include "Assignments.h" -#include "Soldier Control.h" -#include "Item Types.h" -#include "Strategic.h" -#include "Items.h" -#include -#include "Map Screen Interface.h" -#include "Soldier Profile Type.h" -#include "Soldier Profile.h" -#include "Campaign.h" -#include "Text.h" -#include "dialogue control.h" -#include "NPC.h" -#include "Strategic Town Loyalty.h" -#include "animation control.h" -#include "mapscreen.h" -#include "Squads.h" -#include "Map Screen Helicopter.h" -#include "PopUpBox.h" -#include "Vehicles.h" -#include "Strategic Merc Handler.h" -#include "Merc Contract.h" -#include "Map Screen Interface Map.h" -#include "laptop.h" -#include "Finances.h" -#include "LaptopSave.h" -#include "renderworld.h" -#include "Interface Control.h" -#include "Interface.h" -#include "Soldier Find.h" -#include "ai.h" -#include "utilities.h" -#include "random.h" -#include "Soldier Add.h" -#include "Isometric Utils.h" -#include "Soldier Macros.h" -#include "Explosion Control.h" -#include "SkillCheck.h" -#include "Quests.h" -#include "Town Militia.h" -#include "Map Screen Interface Border.h" -#include "math.h" -#include "Strategic Pathing.h" -#include "Auto Resolve.h" -#include "Music Control.h" -#include "PreBattle Interface.h" -#include "Player Command.h" -#include "gameloop.h" -#include "screenids.h" -#include "vObject.h" -#include "video.h" -#include "gamescreen.h" -#include "sysutil.h" -#include "Soldier Create.h" -#include "Weapons.h" -#include "Sound Control.h" -#include "Tactical Save.h" -#include "Strategic Status.h" -#include "WordWrap.h" -#include "Animation Data.h" -#include "Strategic AI.h" -#include "rt time defines.h" -#include "morale.h" -#include "himage.h" -#include "Soldier Init List.h" -#include "lighting.h" -#include "Strategic Mines.h" -#include "jascreens.h" -#include "Map Edgepoints.h" -#include "opplist.h" -#include "sgp.h" -#include "environment.h" -#include "Game Events.h" -#include "MercTextBox.h" -#include "Event Pump.h" -#include "soundman.h" -#include "Ambient Control.h" -#include "AimMembers.h" -#include "Strategic Event Handler.h" -#include "BobbyR.h" -#include "mercs.h" -#include "email.h" -#include "Merc Hiring.h" -#include "Insurance Contract.h" -#include "Scheduling.h" -#include "BobbyRGuns.h" -#include "Arms Dealer Init.h" -#include "Strategic town reputation.h" -#include "air raid.h" -#include "meanwhile.h" -#include "MemMan.h" -#include "Debug.h" -#include "worlddef.h" -#include "fade screen.h" -#include "history.h" -#include "merc entering.h" -#include -#include "worldman.h" -#include "tiledat.h" -#include "WCheck.h" -#include "Map Screen Interface Map Inventory.h" -#include "Map Screen Interface Bottom.h" -#include "Radar Screen.h" -#include "cursors.h" -#include "Options Screen.h" -#include "Cursor Control.h" -#include "Interface Items.h" -#include "Interface Utils.h" -#include "World Items.h" -#include "Multi Language Graphic Utils.h" -#include "Font.h" -#include "Militia Control.h" -#include "Map Screen Interface TownMine Info.h" -#include "Handle UI.h" -#include "Handle Items.h" -#include -#include -#include "screens.h" -#include -#include -#include "Interface Cursors.h" -#include "Interface Panels.h" -#include "sys globals.h" -#include "faces.h" -#include "strategic turns.h" -#include "Personnel.h" -#include "Animated ProgressBar.h" -#include "GameVersion.h" -#include "SaveLoadScreen.h" -#include "messageboxscreen.h" -#include "rotting corpses.h" -#include "Tactical Placement GUI.h" -#include "Overhead Types.h" -#include "Soldier Ani.h" -#include "Types.h" -#include "Quest Debug System.h" -#include "WCheck.h" -#include "Font Control.h" -#include "Video.h" -#include "Game Clock.h" -#include "Render Dirty.h" -#include "WordWrap.h" -#include "Interface.h" -#include "Cursors.h" -#include "Quests.h" -#include "stdio.h" -#include "QuestText.h" -#include "Soldier Profile.h" -#include "Utilities.h" -#include "Text.h" -#include "Text Input.h" -#include "Soldier Create.h" -#include "strategicmap.h" -#include "soldier add.h" -#include "Opplist.h" -#include "Handle Items.h" -#include "Game Clock.h" -#include "environment.h" -#include "dialogue control.h" -#include "Soldier Control.h" -#include "overhead.h" -#include "AimMembers.h" -#include "MessageBoxScreen.h" -#include "Stdio.h" -#include "english.h" -#include "line.h" -#include "Keys.h" -#include "Interface Dialogue.h" -#include "SysUtil.h" -#include "Message.h" -#include "Interface Dialogue.h" -#include "Render Fun.h" -#include "Boxing.h" -#include -#include "Keys.h" -#include "Structure Wrap.h" -#include "SaveLoadMap.h" -#include "aim.h" -#include -#include "Inventory Choosing.h" -#include "LOS.h" -#include "Tactical Turns.h" -#include -#include "worlddat.h" -#include "Exit Grids.h" -#include "pathai.h" -#include "Shade Table Util.h" -#include "points.h" -#include "Bullets.h" -#include "physics.h" -#include "_JA25EnglishText.h" -#include "Debug Control.h" -#include "expat.h" -#include "MiniEvents.h" -#include "Rebel Command.h" -#endif \ No newline at end of file diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index a7e4326da..0b6c82ebd 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -2,6 +2,7 @@ #define __OVERHEAD_TYPES_H // GLOBAL HEADER FOR DATA, TYPES FOR TACTICAL ENGINE +#include "Types.h" #define REFINE_AIM_1 0 #define REFINE_AIM_MID1 1 diff --git a/Tactical/Tactical All.h b/Tactical/Tactical All.h deleted file mode 100644 index 0f53a3106..000000000 --- a/Tactical/Tactical All.h +++ /dev/null @@ -1,232 +0,0 @@ -#ifndef __TACTICAL_ALL_H -#define __TACTICAL_ALL_H - -#pragma message("GENERATED PCH FOR TACTICAL PROJECT.") - -#include "sgp.h" -#include "air raid.h" -#include "game event hook.h" -#include "game clock.h" -#include "auto bandage.h" -#include "strategicmap.h" -#include "screenids.h" -#include "jascreens.h" -#include "random.h" -#include "overhead types.h" -#include "sound control.h" -#include "timer control.h" -#include "dialogue control.h" -#include "overhead.h" -#include "message.h" -#include "isometric utils.h" -#include "soldier macros.h" -#include "worldman.h" -#include "los.h" -#include "math.h" -#include "explosion control.h" -#include "interface.h" -#include "music control.h" -#include "Campaign Types.h" -#include "GameSettings.h" -#include "text.h" -#include "Morale.h" -#include "Map screen helicopter.h" -#include -#include -#include "types.h" -#include "wcheck.h" -#include -#include "Animation Cache.h" -#include "Animation Data.h" -#include "Animation Control.h" -#include "sys globals.h" -#include "Debug Control.h" -#include "FileMan.h" -#include "weapons.h" -#include "structure.h" -#include "worlddef.h" -#include "rotting corpses.h" -#include "points.h" -#include "Soldier Control.h" -#include "tiledef.h" -#include "utilities.h" -#include "Arms Dealer Init.h" -#include "ArmsDealerInvInit.h" -#include "soldier profile.h" -#include "Handle Items.h" -#include "Item Types.h" -#include "messageboxscreen.h" -#include "Handle UI.h" -#include "items.h" -#include "MercTextBox.h" -#include "renderworld.h" -#include "strategic turns.h" -#include "Event Pump.h" -#include "ai.h" -#include "interface control.h" -#include "Map Screen Interface.h" -#include "Map Screen Interface Bottom.h" -#include "Assignments.h" -#include "WordWrap.h" -#include "cursors.h" -#include "English.h" -#include "Boxing.h" -#include "Render Fun.h" -#include "NPC.h" -#include "Opplist.h" -#include -#include "vsurface.h" -#include "Render Dirty.h" -#include "sysutil.h" -#include "container.h" -#include "video.h" -#include "vobject_blitters.h" -#include "faces.h" -#include "gap.h" -#include "Bullets.h" -#include -#include "MemMan.h" -#include "campaign.h" -#include "Strategic Mines.h" -#include "Strategic Status.h" -#include "Encrypted File.h" -#include "mercs.h" -#include "interface dialogue.h" -#include "squads.h" -#include "interface utils.h" -#include "Quests.h" -#include "gamescreen.h" -#include "ShopKeeper Interface.h" -#include "Merc Contract.h" -#include "history.h" -#include "Town Militia.h" -#include "meanwhile.h" -#include "SkillCheck.h" -#include "finances.h" -#include "drugs and alcohol.h" -#include "teamturns.h" -#include "font control.h" -#include "line.h" -#include "structure wrap.h" -#include "pathai.h" -#include "smell.h" -#include "fov.h" -#include "keys.h" -#include "input.h" -#include "exit grids.h" -#include "environment.h" -#include "Fog Of War.h" -#include "soundman.h" -#include -#include -#include "tile animation.h" -#include "Interactive Tiles.h" -#include "handle doors.h" -#include "Action Items.h" -#include "World items.h" -#include "interface items.h" -#include "physics.h" -#include "interface panels.h" -#include "Strategic Town Loyalty.h" -#include "soldier functions.h" -#include "SaveLoadMap.h" -#include "soldier add.h" -#include "soldier ani.h" -#include "qarray.h" -#include "Handle UI Plan.h" -#include "soldier create.h" -#include "mousesystem.h" -#include "cursor control.h" -#include "interface cursors.h" -#include "UI cursors.h" -#include "Strategic Pathing.h" -#include "strategic movement.h" -#include "strategic.h" -#include "vehicles.h" -#include "gameloop.h" -#include "himage.h" -#include "vobject.h" -#include "Button System.h" -#include "radar screen.h" -#include "lighting.h" -#include "Strategic Exit GUI.h" -#include "PopUpBox.h" -#include "spread burst.h" -#include "Tactical Save.h" -#include "fade screen.h" -#include "Strategic AI.h" -#include "mapscreen.h" -#include "LaptopSave.h" -#include "Map Screen Interface Map.h" -#include "Map Screen Interface Map Inventory.h" -#include "overhead map.h" -#include "Options Screen.h" -#include -#include "Inventory Choosing.h" -#include "Smoothing Utils.h" -#include "tiledat.h" -#include -#include "phys math.h" -#include "Map Information.h" -#include "Soldier Init List.h" -#include "EditorMercs.h" -#include "ja2.h" -#include "Road Smoothing.h" -#include "tile cache.h" -#include "merc entering.h" -#include "Merc Hiring.h" -#include "Strategic Merc Handler.h" -#include "Militia Control.h" -#include "Queen Command.h" -#include "editscreen.h" -#include "soldier tile.h" -#ifdef NETWORKED - #include "Networking.h" - #include "NetworkEvent.h" -#endif -#include "Player Command.h" -#include "Game Init.h" -#include "Buildings.h" -#include "rt time defines.h" -#include "GameSettings.h" -#include "Text Input.h" -#include "ShopKeeper Quotes.h" -#include "Personnel.h" -#include "pits.h" -#include "Win util.h" -#include "smokeeffects.h" -#include "SaveLoadGame.h" -#include "Scheduling.h" -#include "Auto Resolve.h" -#include "soldier find.h" -#include "aim.h" -#include "strategic town reputation.h" -#include "Tactical Turns.h" -#include "lighteffects.h" -#include "timer.h" -#include "Soldier Profile Type.h" -#include "AIList.h" -#include "QuestDebug.h" -#include "Game Events.h" -#include "BobbyR.h" - -#include "EnemyItemDrops.h" - -#ifdef JA2BETAVERSION - #include "Quest Debug System.h" -#endif - -#include "GameVersion.h" -#include "SaveLoadScreen.h" -#include "Cheats.h" -#include "Animated ProgressBar.h" -#include "civ quotes.h" -#include "AimMembers.h" -#include "BobbyRMailOrder.h" -#include "end game.h" -#include "DisplayCover.h" -#include "expat.h" -#include "spread burst.h" -#include "XML.h" - -#endif \ No newline at end of file diff --git a/TacticalAI/AI All.h b/TacticalAI/AI All.h deleted file mode 100644 index ce939c803..000000000 --- a/TacticalAI/AI All.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef __AI_ALL_H -#define __AI_ALL_H - -#pragma message("GENERATED PCH FOR TACTICAL AI PROJECT.") - -#include "AIList.h" -#include "Overhead.h" -#include "debug.h" -#include "AIInternals.h" -#include "wcheck.h" -#include "sgp.h" -#include "ai.h" -#include "Isometric Utils.h" -#include "math.h" -#include "Event Pump.h" -#include "Overhead Types.h" -#include "sys globals.h" -#include "opplist.h" -#include "animation control.h" -#include "font control.h" -#include "interface.h" -#include "screenids.h" -#include "worldman.h" -#include "pathai.h" -#include "points.h" -#include "weapons.h" -#include "items.h" -#include "Handle Items.h" -#include "animation data.h" -#include "los.h" -#include "message.h" -#include "TeamTurns.h" -#include "NPC.h" -#include "Dialogue Control.h" -#include "Soldier Profile.h" -#include "strategicmap.h" -#include "Tactical Save.h" -#include "Soldier Create.h" -#include "Explosion Control.h" -#include "Interactive Tiles.h" -#include "interface dialogue.h" -#include "Vehicles.h" -#include "renderworld.h" -#include "assignments.h" -#include "Soldier Functions.h" -#include "GameSettings.h" -#include "Buildings.h" -#include "Physics.h" -#include "Bullets.h" -#include "Spread Burst.h" -#include "SkillCheck.h" -#include "types.h" -#include "soldier control.h" -#include "Rotting Corpses.h" -#include "soldier add.h" -#include "Scheduling.h" -#include "Structure Wrap.h" -#include "Keys.h" -#include "Render Fun.h" -#include "Boxing.h" -#include -#include "World Items.h" -#include "Map Edgepoints.h" -#include "Text.h" -#include "video.h" -#include "Smell.h" -#include "mapscreen.h" -#include "strategic.h" -#include "Strategic Pathing.h" -#include "Quests.h" -#include "Game Clock.h" -#include "FileMan.h" -#include "Random.h" -#include "QuestDebug.h" -#include "soldier macros.h" -#include "Strategic Town Loyalty.h" -#include "Timer Control.h" -#include "Soldier Tile.h" -#include "meanwhile.h" -#include "Campaign Types.h" -#ifdef JA2TESTVERSION - #include "Quest Debug System.h" - #include "QuestText.h" -#endif - -#include "stdarg.h" -#include -#include "Soldier Profile Type.h" -#include "finances.h" -#include "Civ Quotes.h" -#include "Arms Dealer Init.h" -#include "Interface Panels.h" -#include "Soldier Ani.h" -#include "Queen Command.h" -#include "Lighting.h" -#include "environment.h" -#include "Sound Control.h" - -#endif \ No newline at end of file diff --git a/TileEngine/TileEngine All.h b/TileEngine/TileEngine All.h deleted file mode 100644 index 86b3557cc..000000000 --- a/TileEngine/TileEngine All.h +++ /dev/null @@ -1,158 +0,0 @@ -#ifndef __TILEENGINE_ALL_H -#define __TILEENGINE_ALL_H - -#pragma message("GENERATED PCH FOR TILEENGINE PROJECT.") - -#include -#include "sgp.h" -#include "Ambient types.h" -#include "fileman.h" -#include "environment.h" -#include "Sound Control.h" -#include "Game Events.h" -#include "Types.h" -#include "Buildings.h" -#include "Isometric Utils.h" -#include "Pathai.h" -#include "Structure Wrap.h" -#include "Random.h" -#include "Overhead.h" -#include "Render Fun.h" -#include "Strategicmap.h" -#include "Sys Globals.h" -#include "lighting.h" -#include "renderworld.h" -#include "Game Clock.h" -#include "quests.h" -#include "Ambient Control.h" -#include "AimMembers.h" -#include "Strategic Event Handler.h" -#include "BobbyR.h" -#include "mercs.h" -#include "email.h" -#include "Merc Hiring.h" -#include "insurance Contract.h" -#include "Strategic Merc Handler.h" -#include "message.h" -#include "opplist.h" -#include "debug.h" -#include "worlddef.h" -#include "worldman.h" -#include "smooth.h" -#include "Exit Grids.h" -#include "Editor Undo.h" -#include "Strategic Movement.h" -#include "Font Control.h" -#include "SaveLoadMap.h" -#include -#include "wcheck.h" -#include "soldier control.h" -#include "weapons.h" -#include "handle items.h" -#include "rotting corpses.h" -#include "tile cache.h" -#include "animation control.h" -#include "utilities.h" -#include "soldier create.h" -#include "soldier add.h" -#include "explosion control.h" -#include "tile animation.h" -#include "world items.h" -#include "tiledef.h" -#include "tiledat.h" -#include "interactive tiles.h" -#include "Handle Doors.h" -#include "smokeeffects.h" -#include "handle ui.h" -#include "pits.h" -#include "campaign Types.h" -#include "strategic.h" -#include "Action Items.h" -#include "Soldier Profile.h" -#include "Interface Dialogue.h" -#include "LightEffects.h" -#include "AI.h" -#include "Soldier tile.h" -#include "smell.h" -#include "GameSettings.h" -#include "Fog Of War.h" -#include "Simple Render Utils.h" -#include -#include -#include "himage.h" -#include "vsurface.h" -#include "vsurface_private.h" -#include "sysutil.h" -#include "interface.h" -#include "interface cursors.h" -#include "structure.h" -#include "points.h" -#include "Dialogue Control.h" -#include "english.h" -#include "mousesystem.h" -#include "jascreens.h" -#include "math.h" -#include -#include -#include "input.h" -#include "video.h" -#include "vobject_blitters.h" -#include "edit_sys.h" -#include "line.h" -#include "Animation Data.h" -#include "Timer Control.h" -#include "Radar Screen.h" -#include "Render Dirty.h" -#include "Structure Internals.h" -#include "Shade Table Util.h" -#include -#include "Map Edgepoints.h" -#include "Map Information.h" -#include "vobject.h" -#include "worlddat.h" -#include "overhead map.h" -#include "interface control.h" -#include "cursors.h" -#include "soldier find.h" -#include "interface panels.h" -#include "Tactical Placement GUI.h" -#include "phys math.h" -#include "physics.h" -#include "los.h" -#include "event pump.h" -#include "interface items.h" -#include "Debug Control.h" -#include "text.h" -#include "Squads.h" -#include "Map Screen Interface Map Inventory.h" -//#include "container.h" -#include "fov.h" -#include "Overhead types.h" -#include "Tactical Save.h" -#include "MemMan.h" -#include "font.h" -#include "Button System.h" -#include "gameloop.h" -#include "Cursor Control.h" -#include "MessageBoxScreen.h" -#include "assignments.h" -#include "WordWrap.h" -#include "time.h" -#include "Keys.h" -#include "bullets.h" -#include "Animation Cache.h" -#include "tile surface.h" -#include -#include "screenids.h" -#include "shading.h" -#include "Soldier Init List.h" -#include "Summary Info.h" -#include "Animated ProgressBar.h" -#include "EditorBuildings.h" -#include "music control.h" -#include "Scheduling.h" -#include "EditorMapInfo.h" -#include "Smoothing Utils.h" -#include "Meanwhile.h" - -#endif \ No newline at end of file