2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

Massive fmtlib refactor

This commit is contained in:
Jack Andersen
2019-07-19 18:27:21 -10:00
parent e38a3ece89
commit 7a3da1f7a6
228 changed files with 2071 additions and 2116 deletions

View File

@@ -104,7 +104,7 @@ void Buckets::Sort() {
if (bucket.size() < bucket.capacity())
bucket.push_back(&drawable);
// else
// Log.report(logvisor::Fatal, "Full bucket!!!");
// Log.report(logvisor::Fatal, fmt("Full bucket!!!"));
}
u16 bucketIdx = u16(sBuckets->size());
@@ -145,7 +145,7 @@ void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDraw
if (sMinMaxDistance[1] < dist)
sMinMaxDistance[1] = dist;
} else {
Log.report(logvisor::Fatal, "Rendering buckets filled to capacity");
Log.report(logvisor::Fatal, fmt("Rendering buckets filled to capacity"));
}
}

View File

@@ -21,7 +21,7 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx, EPrimitive
const boo::ObjToken<boo::ITexture>& texture, bool additive, bool zTest, bool zGEqual)
: m_mode(mode), m_maxVerts(maxVerts) {
if (maxVerts < 2) {
LineRendererLog.report(logvisor::Fatal, _SYS_STR("maxVerts < 2, maxVerts = %i"), maxVerts);
LineRendererLog.report(logvisor::Fatal, fmt(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
return;
}
m_textured = texture;
@@ -51,7 +51,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const boo::ObjTo
bool additive, bool zTest, bool zGEqual)
: m_mode(mode), m_maxVerts(maxVerts) {
if (maxVerts < 2) {
LineRendererLog.report(logvisor::Fatal, _SYS_STR("maxVerts < 2, maxVerts = %i"), maxVerts);
LineRendererLog.report(logvisor::Fatal, fmt(_SYS_STR("maxVerts < 2, maxVerts = {}")), maxVerts);
return;
}
m_textured = texture;

View File

@@ -247,7 +247,7 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance(int sharedLayoutBuf) {
return nullptr;
if (m_instances.size() >= 512)
Log.report(logvisor::Fatal, "Model buffer overflow");
Log.report(logvisor::Fatal, fmt("Model buffer overflow"));
m_instances.emplace_back();
ModelInstance& newInst = m_instances.back();
@@ -610,7 +610,7 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data,
void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) const {
// if (m_uniUpdateCount == 0)
// Log.report(logvisor::Fatal, "UpdateUniformData() not called");
// Log.report(logvisor::Fatal, fmt("UpdateUniformData() not called"));
if (m_uniUpdateCount == 0 || m_uniUpdateCount > m_instances.size())
return;
const ModelInstance& inst = m_instances[m_uniUpdateCount - 1];
@@ -1154,7 +1154,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
u32 version = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x4));
m_flags = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x8));
if (version != 0x10002)
Log.report(logvisor::Fatal, "invalid CMDL for loading with boo");
Log.report(logvisor::Fatal, fmt("invalid CMDL for loading with boo"));
u32 secCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x24));
u32 matSetCount = hecl::SBig(*reinterpret_cast<u32*>(data.get() + 0x28));

View File

@@ -9,11 +9,11 @@ CSkinnedModel::CSkinnedModel(TLockedToken<CModel> model, TLockedToken<CSkinRules
TLockedToken<CCharLayoutInfo> layoutInfo, int shaderIdx, int drawInsts)
: x4_model(model), x10_skinRules(skinRules), x1c_layoutInfo(layoutInfo) {
if (!model)
Log.report(logvisor::Fatal, "bad model token provided to CSkinnedModel");
Log.report(logvisor::Fatal, fmt("bad model token provided to CSkinnedModel"));
if (!skinRules)
Log.report(logvisor::Fatal, "bad skin token provided to CSkinnedModel");
Log.report(logvisor::Fatal, fmt("bad skin token provided to CSkinnedModel"));
if (!layoutInfo)
Log.report(logvisor::Fatal, "bad character layout token provided to CSkinnedModel");
Log.report(logvisor::Fatal, fmt("bad character layout token provided to CSkinnedModel"));
m_modelInst = model->MakeNewInstance(shaderIdx, drawInsts);
}

View File

@@ -7,22 +7,22 @@ namespace urde {
static logvisor::Module Log("urde::CTextureBoo");
/* GX uses this upsampling technique to extract full 8-bit range */
static inline uint8_t Convert3To8(uint8_t v) {
constexpr uint8_t Convert3To8(uint8_t v) {
/* Swizzle bits: 00000123 -> 12312312 */
return (v << 5) | (v << 2) | (v >> 1);
}
static inline uint8_t Convert4To8(uint8_t v) {
constexpr uint8_t Convert4To8(uint8_t v) {
/* Swizzle bits: 00001234 -> 12341234 */
return (v << 4) | v;
}
static inline uint8_t Convert5To8(uint8_t v) {
constexpr uint8_t Convert5To8(uint8_t v) {
/* Swizzle bits: 00012345 -> 12345123 */
return (v << 3) | (v >> 2);
}
static inline uint8_t Convert6To8(uint8_t v) {
constexpr uint8_t Convert6To8(uint8_t v) {
/* Swizzle bits: 00123456 -> 12345612 */
return (v << 2) | (v >> 4);
}
@@ -549,7 +549,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length) {
size_t texelCount = ComputeMippedTexelCount();
size_t expectedSize = texelCount * 4;
if (expectedSize > length)
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")", length, expectedSize);
Log.report(logvisor::Fatal, fmt("insufficient TXTR length ({}/{})"), length, expectedSize);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
m_booTex = ctx.newStaticTexture(x4_w, x6_h, x8_mips, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat, data,
@@ -562,7 +562,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length) {
void CTexture::BuildC8(const void* data, size_t length) {
size_t texelCount = ComputeMippedTexelCount();
if (texelCount > length)
Log.report(logvisor::Fatal, "insufficient TXTR length (%" PRISize "/%" PRISize ")", length, texelCount);
Log.report(logvisor::Fatal, fmt("insufficient TXTR length ({}/{})"), length, texelCount);
CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
uint32_t nentries = hecl::SBig(*reinterpret_cast<const uint32_t*>(data));
@@ -759,7 +759,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex) {
BuildDXT3(owned.get() + 12, length - 12);
break;
default:
Log.report(logvisor::Fatal, "invalid texture type %d for boo", int(x0_fmt));
Log.report(logvisor::Fatal, fmt("invalid texture type {} for boo"), int(x0_fmt));
}
if (otex)
@@ -771,7 +771,7 @@ void CTexture::Load(int slot, EClampMode clamp) const {}
std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
std::unique_ptr<u8[]>& paletteOut) const {
if (!m_otex)
Log.report(logvisor::Fatal, "MemoryCard TXTR not loaded with 'otex'");
Log.report(logvisor::Fatal, fmt("MemoryCard TXTR not loaded with 'otex'"));
size_t texelCount = x4_w * x6_h;
std::unique_ptr<u8[]> ret;
@@ -847,7 +847,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
}
}
} else
Log.report(logvisor::Fatal, "MemoryCard texture may only use RGBA8PC or C8PC format");
Log.report(logvisor::Fatal, fmt("MemoryCard texture may only use RGBA8PC or C8PC format"));
return ret;
}