mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 00:17:14 +00:00
Linux build fixes
This commit is contained in:
@@ -182,7 +182,7 @@ void CAssetNameMap::PostLoadValidate()
|
||||
|
||||
for (auto Iter = Dupes.begin(); Iter != Dupes.end(); Iter++)
|
||||
{
|
||||
warnf("\t%s", Iter->FullPath());
|
||||
warnf("\t%s", *Iter->FullPath());
|
||||
}
|
||||
|
||||
mMap.clear();
|
||||
@@ -195,7 +195,7 @@ TString CAssetNameMap::DefaultNameMapPath(EIDLength IDLength)
|
||||
{
|
||||
ASSERT(IDLength != kInvalidIDLength);
|
||||
TString Suffix = (IDLength == k32Bit ? "32" : "64");
|
||||
return gkAssetMapPath + Suffix + "." + gkAssetMapExt;
|
||||
return gDataDir + gkAssetMapPath + Suffix + "." + gkAssetMapExt;
|
||||
}
|
||||
|
||||
TString CAssetNameMap::DefaultNameMapPath(EGame Game)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
const TString gkAssetMapPath = "../resources/gameinfo/AssetNameMap";
|
||||
const TString gkAssetMapPath = "resources/gameinfo/AssetNameMap";
|
||||
const TString gkAssetMapExt = "xml";
|
||||
|
||||
class CAssetNameMap
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
#define USE_ASSET_NAME_MAP 1
|
||||
#define EXPORT_COOKED 1
|
||||
|
||||
#if NOD_UCS2
|
||||
static nod::SystemStringView TStringToNodString(const TString& string) { return ToWChar(string); }
|
||||
#else
|
||||
static nod::SystemStringView TStringToNodString(const TString& string) { return *string; }
|
||||
#endif
|
||||
|
||||
CGameExporter::CGameExporter(EDiscType DiscType, EGame Game, bool FrontEnd, ERegion Region, const TString& rkGameName, const TString& rkGameID, float BuildVersion)
|
||||
: mGame(Game)
|
||||
, mRegion(Region)
|
||||
@@ -198,16 +204,16 @@ bool CGameExporter::ExtractDiscData()
|
||||
if (IsWii)
|
||||
{
|
||||
// Extract crypto files
|
||||
if (!pDataPartition->extractCryptoFiles(ToWChar(AbsDiscDir), Context))
|
||||
if (!pDataPartition->extractCryptoFiles(TStringToNodString(AbsDiscDir), Context))
|
||||
return false;
|
||||
|
||||
// Extract disc header files
|
||||
if (!mpDisc->extractDiscHeaderFiles(ToWChar(AbsDiscDir), Context))
|
||||
if (!mpDisc->extractDiscHeaderFiles(TStringToNodString(AbsDiscDir), Context))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Extract system files
|
||||
if (!pDataPartition->extractSysFiles(ToWChar(AbsDiscDir), Context))
|
||||
if (!pDataPartition->extractSysFiles(TStringToNodString(AbsDiscDir), Context))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -226,7 +232,7 @@ bool CGameExporter::ExtractDiscNodeRecursive(const nod::Node *pkNode, const TStr
|
||||
if (Iter->getKind() == nod::Node::Kind::File)
|
||||
{
|
||||
TString FilePath = rkDir + Iter->getName().data();
|
||||
bool Success = Iter->extractToDirectory(ToWChar(rkDir), rkContext);
|
||||
bool Success = Iter->extractToDirectory(TStringToNodString(rkDir), rkContext);
|
||||
if (!Success) return false;
|
||||
|
||||
if (FilePath.GetFileExtension().CaseInsensitiveCompare("pak"))
|
||||
|
||||
@@ -63,6 +63,7 @@ class CGameExporter
|
||||
// Progress
|
||||
IProgressNotifier *mpProgress;
|
||||
|
||||
public:
|
||||
enum EExportStep
|
||||
{
|
||||
eES_ExtractDisc,
|
||||
@@ -72,7 +73,6 @@ class CGameExporter
|
||||
eES_NumSteps
|
||||
};
|
||||
|
||||
public:
|
||||
CGameExporter(EDiscType DiscType, EGame Game, bool FrontEnd, ERegion Region, const TString& rkGameName, const TString& rkGameID, float BuildVersion);
|
||||
bool Export(nod::DiscBase *pDisc, const TString& rkOutputDir, CAssetNameMap *pNameMap, CGameInfo *pGameInfo, IProgressNotifier *pProgress);
|
||||
void LoadResource(const CAssetID& rkID, std::vector<uint8>& rBuffer);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "CGameInfo.h"
|
||||
#include "CResourceStore.h"
|
||||
#include <Common/FileUtil.h>
|
||||
|
||||
bool CGameInfo::LoadGameInfo(EGame Game)
|
||||
@@ -83,5 +84,5 @@ TString CGameInfo::GetDefaultGameInfoPath(EGame Game)
|
||||
return "";
|
||||
|
||||
TString GameName = GetGameShortName(Game);
|
||||
return TString::Format("%s/GameInfo%s.%s", *gkGameInfoDir, *GameName, *gkGameInfoExt);
|
||||
return TString::Format("%s/%s/GameInfo%s.%s", *gDataDir, *gkGameInfoDir, *GameName, *gkGameInfoExt);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <Common/Serialization/XML.h>
|
||||
#include <map>
|
||||
|
||||
const TString gkGameInfoDir = "../resources/gameinfo";
|
||||
const TString gkGameInfoDir = "resources/gameinfo";
|
||||
const TString gkGameInfoExt = "xml";
|
||||
|
||||
//@todo merge this class into CGameTemplate
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
#include <Common/Serialization/XML.h>
|
||||
#include <nod/nod.hpp>
|
||||
|
||||
#if NOD_UCS2
|
||||
static nod::SystemStringView TStringToNodString(const TString& string) { return ToWChar(string); }
|
||||
#else
|
||||
static nod::SystemStringView TStringToNodString(const TString& string) { return *string; }
|
||||
#endif
|
||||
|
||||
CGameProject::~CGameProject()
|
||||
{
|
||||
if (mpResourceStore)
|
||||
@@ -88,13 +94,13 @@ bool CGameProject::BuildISO(const TString& rkIsoPath, IProgressNotifier *pProgre
|
||||
|
||||
if (!IsWiiBuild())
|
||||
{
|
||||
nod::DiscBuilderGCN Builder(ToWChar(rkIsoPath), ProgressCallback);
|
||||
return Builder.buildFromDirectory(ToWChar(DiscRoot)) == nod::EBuildResult::Success;
|
||||
nod::DiscBuilderGCN Builder(TStringToNodString(rkIsoPath), ProgressCallback);
|
||||
return Builder.buildFromDirectory(TStringToNodString(DiscRoot)) == nod::EBuildResult::Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
nod::DiscBuilderWii Builder(ToWChar(rkIsoPath), IsTrilogy(), ProgressCallback);
|
||||
return Builder.buildFromDirectory(ToWChar(DiscRoot)) == nod::EBuildResult::Success;
|
||||
nod::DiscBuilderWii Builder(TStringToNodString(rkIsoPath), IsTrilogy(), ProgressCallback);
|
||||
return Builder.buildFromDirectory(TStringToNodString(DiscRoot)) == nod::EBuildResult::Success;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,8 +119,8 @@ bool CGameProject::MergeISO(const TString& rkIsoPath, nod::DiscWii *pOriginalIso
|
||||
|
||||
TString DiscRoot = DiscFilesystemRoot(false);
|
||||
|
||||
nod::DiscMergerWii Merger(ToWChar(rkIsoPath), *pOriginalIso, IsTrilogy(), ProgressCallback);
|
||||
return Merger.mergeFromDirectory(ToWChar(DiscRoot)) == nod::EBuildResult::Success;
|
||||
nod::DiscMergerWii Merger(TStringToNodString(rkIsoPath), *pOriginalIso, IsTrilogy(), ProgressCallback);
|
||||
return Merger.mergeFromDirectory(TStringToNodString(DiscRoot)) == nod::EBuildResult::Success;
|
||||
}
|
||||
|
||||
void CGameProject::GetWorldList(std::list<CAssetID>& rOut) const
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <tinyxml2.h>
|
||||
|
||||
using namespace tinyxml2;
|
||||
TString gDataDir;
|
||||
CResourceStore *gpResourceStore = nullptr;
|
||||
CResourceStore *gpEditorStore = nullptr;
|
||||
|
||||
@@ -607,6 +608,19 @@ bool CResourceStore::DeleteResourceEntry(CResourceEntry *pEntry)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static int wrap_fopen(FILE** pFile, const char *filename, const char *mode)
|
||||
{
|
||||
return fopen_s(pFile, filename, mode);
|
||||
}
|
||||
#else
|
||||
static int wrap_fopen(FILE** pFile, const char *filename, const char *mode)
|
||||
{
|
||||
*pFile = fopen(filename, mode);
|
||||
return *pFile == nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CResourceStore::ImportNamesFromPakContentsTxt(const TString& rkTxtPath, bool UnnamedOnly)
|
||||
{
|
||||
// Read file contents -first- then move assets -after-; this
|
||||
@@ -615,7 +629,7 @@ void CResourceStore::ImportNamesFromPakContentsTxt(const TString& rkTxtPath, boo
|
||||
// todo: move to CAssetNameMap?
|
||||
std::map<CResourceEntry*, TString> PathMap;
|
||||
FILE *pContentsFile;
|
||||
fopen_s(&pContentsFile, *rkTxtPath, "r");
|
||||
wrap_fopen(&pContentsFile, *rkTxtPath, "r");
|
||||
|
||||
if (!pContentsFile)
|
||||
{
|
||||
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
inline bool IsEditorStore() const { return mpProj == nullptr; }
|
||||
};
|
||||
|
||||
extern TString gDataDir;
|
||||
extern CResourceStore *gpResourceStore;
|
||||
extern CResourceStore *gpEditorStore;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ TString CVirtualDirectory::FullPath() const
|
||||
if (IsRoot())
|
||||
return "";
|
||||
else
|
||||
return (mpParent ? mpParent->FullPath() + mName : mName) + '/';
|
||||
return (mpParent ? mpParent->FullPath() + mName : static_cast<TString::BaseClass>(mName)) + '/';
|
||||
}
|
||||
|
||||
TString CVirtualDirectory::AbsolutePath() const
|
||||
@@ -89,7 +89,7 @@ CVirtualDirectory* CVirtualDirectory::GetRoot()
|
||||
CVirtualDirectory* CVirtualDirectory::FindChildDirectory(const TString& rkName, bool AllowCreate)
|
||||
{
|
||||
uint32 SlashIdx = rkName.IndexOf("\\/");
|
||||
TString DirName = (SlashIdx == -1 ? rkName : rkName.SubString(0, SlashIdx));
|
||||
TString DirName = (SlashIdx == -1 ? static_cast<TString::BaseClass>(rkName) : rkName.SubString(0, SlashIdx));
|
||||
|
||||
for (uint32 iSub = 0; iSub < mSubdirectories.size(); iSub++)
|
||||
{
|
||||
@@ -173,7 +173,7 @@ bool CVirtualDirectory::AddChild(const TString &rkPath, CResourceEntry *pEntry)
|
||||
else if (IsValidDirectoryPath(rkPath))
|
||||
{
|
||||
uint32 SlashIdx = rkPath.IndexOf("\\/");
|
||||
TString DirName = (SlashIdx == -1 ? rkPath : rkPath.SubString(0, SlashIdx));
|
||||
TString DirName = (SlashIdx == -1 ? static_cast<TString::BaseClass>(rkPath) : rkPath.SubString(0, SlashIdx));
|
||||
TString Remaining = (SlashIdx == -1 ? "" : rkPath.SubString(SlashIdx + 1, rkPath.Size() - SlashIdx));
|
||||
|
||||
// Check if this subdirectory already exists
|
||||
@@ -286,7 +286,7 @@ void CVirtualDirectory::SortSubdirectories()
|
||||
|
||||
bool CVirtualDirectory::Rename(const TString& rkNewName)
|
||||
{
|
||||
debugf("MOVING DIRECTORY: %s --> %s", *FullPath(), *mpParent->FullPath() + rkNewName + '/');
|
||||
debugf("MOVING DIRECTORY: %s --> %s", *FullPath(), *(mpParent->FullPath() + rkNewName + '/'));
|
||||
|
||||
if (!IsRoot())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user