2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 22:27:43 +00:00

Refactor ResId into CAssetId

This commit is contained in:
2017-08-12 22:26:14 -07:00
parent e0efcc0e5c
commit 870e8c80ee
176 changed files with 800 additions and 715 deletions

39
Runtime/RetroTypes.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include "RetroTypes.hpp"
#include "GameGlobalObjects.hpp"
#include "IMain.hpp"
namespace urde
{
logvisor::Module Log("urde::RetroTypes::CAssetId");
CAssetId::CAssetId(CInputStream& in)
{
if (g_Main)
{
if (g_Main->GetExpectedIdSize() == sizeof(u32))
Assign(in.readUint32Big());
else if (g_Main->GetExpectedIdSize() == sizeof(u64))
Assign(in.readUint64Big());
else
Log.report(logvisor::Fatal, "Unsupported id length %i", g_Main->GetExpectedIdSize());
}
else
Log.report(logvisor::Fatal, "Input constructor called before runtime Main entered!");
}
void CAssetId::PutTo(COutputStream& out)
{
if (g_Main)
{
if (g_Main->GetExpectedIdSize() == sizeof(u32))
out.writeUint32Big(u32(id));
else if (g_Main->GetExpectedIdSize() == sizeof(u64))
out.writeUint64Big(id);
else
Log.report(logvisor::Fatal, "Unsupported id length %i", g_Main->GetExpectedIdSize());
}
else
Log.report(logvisor::Fatal, "PutTo called before runtime Main entered!");
}
}