Skip to content

Commit

Permalink
Added ability to log the exe's request for nif files
Browse files Browse the repository at this point in the history
The exe writes nif errors to resmgr.log without telling which file the error is in.
Enabling USE_NIF_LOGGING in globalDefineALT will now log the exe's nif file requests.
This way if there is an error, the previous line in the log should tell which entry contains the error.
  • Loading branch information
Nightinggale committed Apr 22, 2023
1 parent 07f8159 commit 9610a35
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
6 changes: 6 additions & 0 deletions Assets/XML/GlobalDefinesAlt.xml
Expand Up @@ -1671,8 +1671,14 @@
<DefineTextVal>UNITCLASS_MULATTO</DefineTextVal>
</Define>
<Define>
<!-- warning: can create a huge log -->
<DefineName>USE_OOS_LOGGING</DefineName>
<iDefineIntVal>0</iDefineIntVal>
<bAlwaysHardcoded>1</bAlwaysHardcoded>
</Define>
<Define>
<!-- warning: can create a huge log -->
<DefineName>USE_NIF_LOGGING</DefineName>
<iDefineIntVal>0</iDefineIntVal>
</Define>
</Civ4Defines>
4 changes: 4 additions & 0 deletions Project Files/DLLSources/CvGameCoreDLL.def
Expand Up @@ -9,6 +9,10 @@

EXPORTS

; CvArtInfoAsset
?getKFM@CvArtInfoAsset@@QBEPBDXZ=?getKFM@EXE_CvArtInfoAsset@@QBEPBDXZ
?getNIF@CvArtInfoAsset@@QBEPBDXZ=?getNIF@EXE_CvArtInfoAsset@@QBEPBDXZ

; CvGlobals
?getBuildingInfo@CvGlobals@@QAEAAVCvBuildingInfo@@W4BuildingTypes@@@Z=?getBuildingInfo@EXE_CvGlobals@@QAEAAVCvBuildingInfo@@W4BuildingTypes@@@Z
?getBuildingInfo@CvGlobals@@QAEAAV?$vector@PAVCvBuildingInfo@@V?$allocator@PAVCvBuildingInfo@@@std@@@std@@XZ=?getBuildingInfo@EXE_CvGlobals@@QAEAAV?$vector@PAVCvBuildingInfo@@V?$allocator@PAVCvBuildingInfo@@@std@@@std@@XZ
Expand Down
4 changes: 2 additions & 2 deletions Project Files/DLLSources/CvInfos.h
Expand Up @@ -3629,8 +3629,8 @@ class CvArtInfoAsset : public CvAssetInfoBase
public:
CvArtInfoAsset() {}
virtual ~CvArtInfoAsset() {}
DllExport const char* getNIF() const;
DllExport const char* getKFM() const;
const char* getNIF() const;
const char* getKFM() const;

void setNIF(const char* szDesc);
void setKFM(const char* szDesc);
Expand Down
20 changes: 14 additions & 6 deletions Project Files/DLLSources/EXE_interface.cpp
Expand Up @@ -162,14 +162,22 @@ BOOST_STATIC_ASSERT(sizeof(EXE_CvArtFileMgr) == sizeof(CvArtFileMgr));
class EXE_CvArtInfoAsset : public CvArtInfoAsset
{
public:
/*
getKFM
?getKFM@CvArtInfoAsset@@QBEPBDXZ=?getKFM@EXE_CvArtInfoAsset@@QBEPBDXZ
DllExport const char* getNIF() const
{
if (GLOBAL_DEFINE_USE_NIF_LOGGING)
{
CvString szError;
szError.Format("Opening nif for entry: %s", getTag());
gDLL->logMsg("resmgr.log", szError);
}

getNIF
?getNIF@CvArtInfoAsset@@QBEPBDXZ=?getNIF@EXE_CvArtInfoAsset@@QBEPBDXZ
return CvArtInfoAsset::getNIF();
}

*/
DllExport const char* getKFM() const
{
return CvArtInfoAsset::getKFM();
}
};
BOOST_STATIC_ASSERT(sizeof(EXE_CvArtInfoAsset) == sizeof(CvArtInfoAsset));

Expand Down

0 comments on commit 9610a35

Please sign in to comment.