mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-21 12:59:12 +00:00
Replace logvisor with spdlog; remove athena, discord-rpc, rapidjson
This commit is contained in:
@@ -147,7 +147,7 @@ void Buckets::Sort() {
|
||||
if (bucket.size() < bucket.capacity())
|
||||
bucket.push_back(&drawable);
|
||||
// else
|
||||
// Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!"));
|
||||
// spdlog::fatal("Full bucket!!!");
|
||||
}
|
||||
|
||||
u16 bucketIdx = u16(sBuckets->size());
|
||||
@@ -182,7 +182,7 @@ void Buckets::InsertPlaneObject(float closeDist, float farDist, const zeus::CAAB
|
||||
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
||||
const zeus::CPlane& plane, u16 extraSort) {
|
||||
if (sData->size() == sData->capacity()) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity"));
|
||||
spdlog::fatal("Rendering buckets filled to capacity");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
#include "Runtime/Particle/CDecal.hpp"
|
||||
#include "Runtime/Particle/CElementGen.hpp"
|
||||
#include "Runtime/CDvdFile.hpp"
|
||||
#include "Runtime/Logging.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace metaforce {
|
||||
static logvisor::Module Log("CCubeRenderer");
|
||||
|
||||
/* TODO: This is to fix some areas exceeding the max drawable count, the proper number is 128 drawables per bucket */
|
||||
// using BucketHolderType = rstl::reserved_vector<CDrawable*, 128>;
|
||||
using BucketHolderType = rstl::reserved_vector<CDrawable*, 132>;
|
||||
@@ -127,7 +126,7 @@ void Buckets::Sort() {
|
||||
bucket.push_back(&drawable);
|
||||
}
|
||||
// else
|
||||
// Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!"));
|
||||
// spdlog::fatal("Full bucket!!!");
|
||||
}
|
||||
|
||||
u16 bucketIdx = u16(sBuckets->size());
|
||||
@@ -162,7 +161,7 @@ void Buckets::InsertPlaneObject(float closeDist, float farDist, const zeus::CAAB
|
||||
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
||||
const zeus::CPlane& plane, u16 extraSort) {
|
||||
if (sData->size() == sData->capacity()) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity"));
|
||||
spdlog::fatal("Rendering buckets filled to capacity");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -330,7 +329,7 @@ void CCubeRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance
|
||||
|
||||
void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||
fmt::format(FMT_STRING("CCubeRenderer::DrawUnsortedGeometry areaIdx={} mask={} targetMask={}"), areaIdx, mask,
|
||||
fmt::format("CCubeRenderer::DrawUnsortedGeometry areaIdx={} mask={} targetMask={}", areaIdx, mask,
|
||||
targetMask)
|
||||
.c_str(),
|
||||
zeus::skBlue);
|
||||
@@ -408,7 +407,7 @@ void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask)
|
||||
|
||||
void CCubeRenderer::DrawSortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||
fmt::format(FMT_STRING("CCubeRenderer::DrawSortedGeometry areaIdx={} mask={} targetMask={}"), areaIdx, mask,
|
||||
fmt::format("CCubeRenderer::DrawSortedGeometry areaIdx={} mask={} targetMask={}", areaIdx, mask,
|
||||
targetMask)
|
||||
.c_str(),
|
||||
zeus::skBlue);
|
||||
@@ -442,7 +441,7 @@ void CCubeRenderer::DrawStaticGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||
|
||||
void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||
fmt::format(FMT_STRING("CCubeRenderer::DrawAreaGeometry areaIdx={} mask={} targetMask={}"), areaIdx, mask,
|
||||
fmt::format("CCubeRenderer::DrawAreaGeometry areaIdx={} mask={} targetMask={}", areaIdx, mask,
|
||||
targetMask)
|
||||
.c_str(),
|
||||
zeus::skBlue);
|
||||
@@ -490,7 +489,7 @@ void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||
|
||||
void CCubeRenderer::RenderBucketItems(const CAreaListItem* item) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||
fmt::format(FMT_STRING("CCubeRenderer::RenderBucketItems areaIdx={}"), item->x18_areaIdx).c_str(), zeus::skBlue);
|
||||
fmt::format("CCubeRenderer::RenderBucketItems areaIdx={}", item->x18_areaIdx).c_str(), zeus::skBlue);
|
||||
|
||||
CCubeModel* lastModel = nullptr;
|
||||
EDrawableType lastDrawableType = EDrawableType::Invalid;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#include "Runtime/Graphics/CLineRenderer.hpp"
|
||||
|
||||
#include "Runtime/Graphics/Shaders/CLineRendererShaders.hpp"
|
||||
|
||||
#include <logvisor/logvisor.hpp>
|
||||
#include "Runtime/Logging.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
logvisor::Module LineRendererLog("metaforce::CLineRenderer");
|
||||
|
||||
void CLineRenderer::Initialize() { CLineRendererShaders::Initialize(); }
|
||||
|
||||
void CLineRenderer::Shutdown() {
|
||||
@@ -25,7 +22,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, u32 texture,
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
OPTICK_EVENT();
|
||||
if (maxVerts < 2) {
|
||||
LineRendererLog.report(logvisor::Fatal, FMT_STRING("maxVerts < 2, maxVerts = {}"), maxVerts);
|
||||
spdlog::fatal("maxVerts < 2, maxVerts = {}", maxVerts);
|
||||
return;
|
||||
}
|
||||
m_textured = bool(texture);
|
||||
|
||||
@@ -253,7 +253,7 @@ CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurf
|
||||
// }
|
||||
//
|
||||
// if (m_instances.size() >= 512) {
|
||||
// Log.report(logvisor::Fatal, FMT_STRING("Model buffer overflow"));
|
||||
// spdlog::fatal("Model buffer overflow");
|
||||
// }
|
||||
//
|
||||
// ModelInstance& newInst = m_instances.emplace_back();
|
||||
@@ -1163,7 +1163,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
||||
u32 version = CBasics::SwapBytes(*reinterpret_cast<u32*>(data.get() + 0x4));
|
||||
m_flags = CBasics::SwapBytes(*reinterpret_cast<u32*>(data.get() + 0x8));
|
||||
if (version != 0x10002) {
|
||||
Log.report(logvisor::Error, FMT_STRING("invalid CMDL for loading with boo"));
|
||||
spdlog::error("invalid CMDL for loading with boo");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,24 +306,24 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
||||
// if (deinterlace) {
|
||||
// /* metaforce addition: this way interlaced THPs don't look horrible */
|
||||
// set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} Y[0]"), path,
|
||||
// fmt::format("Movie {} Texture Set {} Y[0]", path,
|
||||
// i));
|
||||
// set.Y[1] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} Y[1]"), path,
|
||||
// fmt::format("Movie {} Texture Set {} Y[1]", path,
|
||||
// i));
|
||||
// set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i));
|
||||
// fmt::format("Movie {} Texture Set {} U", path, i));
|
||||
// set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i));
|
||||
// fmt::format("Movie {} Texture Set {} V", path, i));
|
||||
// } else {
|
||||
// /* normal progressive presentation */
|
||||
// set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} Y"), path,
|
||||
// fmt::format("Movie {} Texture Set {} Y", path,
|
||||
// i));
|
||||
// set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i));
|
||||
// fmt::format("Movie {} Texture Set {} U", path, i));
|
||||
// set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i));
|
||||
// fmt::format("Movie {} Texture Set {} V", path, i));
|
||||
// }
|
||||
if (xf4_25_hasAudio)
|
||||
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
#include "Runtime/Character/CSkinRules.hpp"
|
||||
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
||||
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
|
||||
#include "Runtime/Logging.hpp"
|
||||
|
||||
#include <logvisor/logvisor.hpp>
|
||||
#include <list>
|
||||
|
||||
namespace metaforce {
|
||||
static logvisor::Module Log("metaforce::CSkinnedModel");
|
||||
|
||||
CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules,
|
||||
const TLockedToken<CCharLayoutInfo>& layoutInfo)
|
||||
: x4_model(std::move(model))
|
||||
@@ -17,13 +15,13 @@ CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model, const TLockedTok
|
||||
, x1c_layoutInfo(std::move(layoutInfo))
|
||||
, m_workspace(*x10_skinRules) {
|
||||
if (!x4_model) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("bad model token provided to CSkinnedModel"));
|
||||
spdlog::fatal("bad model token provided to CSkinnedModel");
|
||||
}
|
||||
if (!x10_skinRules) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("bad skin token provided to CSkinnedModel"));
|
||||
spdlog::fatal("bad skin token provided to CSkinnedModel");
|
||||
}
|
||||
if (!x1c_layoutInfo) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("bad character layout token provided to CSkinnedModel"));
|
||||
spdlog::fatal("bad character layout token provided to CSkinnedModel");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "Graphics/GX.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace metaforce {
|
||||
enum class ERglTevStage : std::underlying_type_t<GXTevStageID> {
|
||||
Stage0 = GX_TEVSTAGE0,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Graphics/CTexture.hpp"
|
||||
|
||||
#include "CToken.hpp"
|
||||
#include "Runtime/CToken.hpp"
|
||||
#include "Runtime/Formatting.hpp"
|
||||
|
||||
#include <zeus/Math.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
@@ -15,7 +16,7 @@ CTexture::CTexture(ETexelFormat fmt, u16 w, u16 h, s32 mips, std::string_view la
|
||||
, x8_mips(mips)
|
||||
, x9_bitsPerPixel(TexelFormatBitsPerPixel(fmt))
|
||||
, x64_frameAllocated(sCurrentFrameCount)
|
||||
, m_label(fmt::format(FMT_STRING("{} ({})"), label, magic_enum::enum_name(fmt))) {
|
||||
, m_label(fmt::format("{} ({})", label, magic_enum::enum_name(fmt))) {
|
||||
InitBitmapBuffers(fmt, w, h, mips);
|
||||
InitTextureObjs();
|
||||
}
|
||||
@@ -26,7 +27,7 @@ CTexture::CTexture(CInputStream& in, std::string_view label, EAutoMipmap automip
|
||||
, x6_h(in.ReadShort())
|
||||
, x8_mips(in.ReadLong())
|
||||
, x64_frameAllocated(sCurrentFrameCount)
|
||||
, m_label(fmt::format(FMT_STRING("{} ({})"), label, magic_enum::enum_name(x0_fmt))) {
|
||||
, m_label(fmt::format("{} ({})", label, magic_enum::enum_name(x0_fmt))) {
|
||||
bool hasPalette = (x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2);
|
||||
if (hasPalette) {
|
||||
x10_graphicsPalette = std::make_unique<CGraphicsPalette>(in);
|
||||
@@ -284,7 +285,7 @@ void CTexture::InvalidateTexMap(GXTexMapID id) { sLoadedTextures[id] = nullptr;
|
||||
|
||||
CFactoryFnReturn FTextureFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||
CObjectReference* selfRef) {
|
||||
const auto label = fmt::format(FMT_STRING("{} {}"), tag.type, tag.id);
|
||||
const auto label = fmt::format("{} {}", tag.type, tag.id);
|
||||
return TToken<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(in, label));
|
||||
}
|
||||
} // namespace metaforce
|
||||
|
||||
@@ -358,7 +358,7 @@ void CTexture::BuildC8FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
}
|
||||
|
||||
void CTexture::BuildC14X2FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("C14X2 not implemented"));
|
||||
spdlog::fatal("C14X2 not implemented");
|
||||
}
|
||||
|
||||
void CTexture::BuildRGB565FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
@@ -543,7 +543,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length, aurora::zstring_view
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
size_t expectedSize = texelCount * 4;
|
||||
if (expectedSize > length)
|
||||
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, expectedSize);
|
||||
spdlog::fatal("insufficient TXTR length ({}/{})", length, expectedSize);
|
||||
|
||||
m_tex = aurora::gfx::new_static_texture_2d(x4_w, x6_h, x8_mips, aurora::gfx::TextureFormat::RGBA8,
|
||||
{reinterpret_cast<const uint8_t*>(data), expectedSize}, label);
|
||||
@@ -552,7 +552,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length, aurora::zstring_view
|
||||
void CTexture::BuildC8(const void* data, size_t length, aurora::zstring_view label) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
if (texelCount > length)
|
||||
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, texelCount);
|
||||
spdlog::fatal("insufficient TXTR length ({}/{})", length, texelCount);
|
||||
|
||||
uint32_t nentries = CBasics::SwapBytes(*reinterpret_cast<const uint32_t*>(data));
|
||||
const u8* paletteTexels = reinterpret_cast<const u8*>(data) + 4;
|
||||
@@ -758,7 +758,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTex
|
||||
x9_bitsPerPixel = TexelFormatBitsPerPixel(x0_fmt);
|
||||
m_textureInfo = inf;
|
||||
|
||||
auto label = fmt::format(FMT_STRING("TXTR {:08X} ({})"), id.Value(), TextureFormatString(x0_fmt));
|
||||
auto label = fmt::format("TXTR {:08X} ({})", id.Value(), TextureFormatString(x0_fmt));
|
||||
switch (x0_fmt) {
|
||||
case ETexelFormat::I4:
|
||||
BuildI4FromGCN(r, label);
|
||||
@@ -794,8 +794,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTex
|
||||
if (aurora::gfx::get_dxt_compression_supported()) {
|
||||
BuildDXT1FromGCN(r, label);
|
||||
} else {
|
||||
Log.report(logvisor::Error, FMT_STRING("BC/DXT1 compression is not supported on your GPU, unable to load {}"),
|
||||
label);
|
||||
spdlog::error("BC/DXT1 compression is not supported on your GPU, unable to load {}", label);
|
||||
x0_fmt = ETexelFormat::RGBA8PC;
|
||||
x8_mips = 1;
|
||||
std::unique_ptr<u8[]> data = std::make_unique<u8[]>(x4_w * x6_h * 4);
|
||||
@@ -825,7 +824,7 @@ CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTex
|
||||
BuildDXT3(owned.get() + 12, length - 12, label);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, FMT_STRING("invalid texture type {} for boo"), int(x0_fmt));
|
||||
spdlog::fatal("invalid texture type {} for boo", int(x0_fmt));
|
||||
}
|
||||
|
||||
if (otex)
|
||||
@@ -837,7 +836,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, FMT_STRING("MemoryCard TXTR not loaded with 'otex'"));
|
||||
spdlog::fatal("MemoryCard TXTR not loaded with 'otex'");
|
||||
|
||||
size_t texelCount = x4_w * x6_h;
|
||||
std::unique_ptr<u8[]> ret;
|
||||
@@ -914,7 +913,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
||||
}
|
||||
}
|
||||
} else
|
||||
Log.report(logvisor::Fatal, FMT_STRING("MemoryCard texture may only use RGBA8PC or C8PC format"));
|
||||
spdlog::fatal("MemoryCard texture may only use RGBA8PC or C8PC format");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user