mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-05-13 11:11:22 +00:00
Replace logvisor with spdlog; remove athena, discord-rpc, rapidjson
This commit is contained in:
parent
99d5f30ed8
commit
b45f808e2c
16
.gitmodules
vendored
16
.gitmodules
vendored
@ -10,22 +10,10 @@
|
|||||||
path = extern/jbus
|
path = extern/jbus
|
||||||
url = ../jbus.git
|
url = ../jbus.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "extern/discord-rpc"]
|
|
||||||
path = extern/discord-rpc
|
|
||||||
url = https://github.com/discordapp/discord-rpc.git
|
|
||||||
branch = master
|
|
||||||
[submodule "extern/rapidjson"]
|
|
||||||
path = extern/rapidjson
|
|
||||||
url = https://github.com/Tencent/rapidjson.git
|
|
||||||
branch = master
|
|
||||||
[submodule "extern/fixNES"]
|
[submodule "extern/fixNES"]
|
||||||
path = extern/fixNES
|
path = extern/fixNES
|
||||||
url = https://github.com/FIX94/fixNES.git
|
url = https://github.com/FIX94/fixNES.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "extern/athena"]
|
|
||||||
path = extern/athena
|
|
||||||
url = ../../libAthena/athena.git
|
|
||||||
branch = master
|
|
||||||
[submodule "extern/libjpeg-turbo"]
|
[submodule "extern/libjpeg-turbo"]
|
||||||
path = extern/libjpeg-turbo
|
path = extern/libjpeg-turbo
|
||||||
url = ../libjpeg-turbo.git
|
url = ../libjpeg-turbo.git
|
||||||
@ -45,3 +33,7 @@
|
|||||||
path = extern/aurora
|
path = extern/aurora
|
||||||
url = https://github.com/encounter/aurora.git
|
url = https://github.com/encounter/aurora.git
|
||||||
branch = main
|
branch = main
|
||||||
|
[submodule "extern/spdlog"]
|
||||||
|
path = extern/spdlog
|
||||||
|
url = https://github.com/gabime/spdlog.git
|
||||||
|
branch = v1.x
|
||||||
|
@ -77,25 +77,6 @@ if (EMSCRIPTEN)
|
|||||||
set(CMAKE_EXECUTABLE_SUFFIX .html)
|
set(CMAKE_EXECUTABLE_SUFFIX .html)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH)
|
|
||||||
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH)
|
|
||||||
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" HOST_PLATFORM_NAME)
|
|
||||||
string(TOLOWER "${CMAKE_SYSTEM_NAME}" PLATFORM_NAME)
|
|
||||||
set(ATHENA_EXTENSION "tar.gz")
|
|
||||||
if (CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
|
|
||||||
set(HOST_PLATFORM_NAME macos)
|
|
||||||
set(ATHENA_ARCH universal)
|
|
||||||
set(ATHENA_HOST_ARCH universal)
|
|
||||||
elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(HOST_PLATFORM_NAME win32)
|
|
||||||
set(ATHENA_EXTENSION ".7z")
|
|
||||||
endif ()
|
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|
||||||
set(PLATFORM_NAME macos)
|
|
||||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(PLATFORM_NAME win32)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
|
||||||
|
|
||||||
if(APPLE AND NOT CMAKE_OSX_SYSROOT)
|
if(APPLE AND NOT CMAKE_OSX_SYSROOT)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "CNESEmulator.hpp"
|
#include "CNESEmulator.hpp"
|
||||||
#include "CGameState.hpp"
|
#include "CGameState.hpp"
|
||||||
#include "Input/CFinalInput.hpp"
|
#include "Input/CFinalInput.hpp"
|
||||||
#include "logvisor/logvisor.hpp"
|
#include "Runtime/Logging.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -168,7 +168,6 @@ int audioUpdate() {
|
|||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
|
|
||||||
bool CNESEmulator::EmulatorConstructed = false;
|
bool CNESEmulator::EmulatorConstructed = false;
|
||||||
static logvisor::Module Log("CNESEmulator");
|
|
||||||
|
|
||||||
#define NESEMUP_ROM_OFFSET 0xa3f8
|
#define NESEMUP_ROM_OFFSET 0xa3f8
|
||||||
|
|
||||||
@ -182,7 +181,7 @@ static logvisor::Module Log("CNESEmulator");
|
|||||||
|
|
||||||
CNESEmulator::CNESEmulator() {
|
CNESEmulator::CNESEmulator() {
|
||||||
if (EmulatorConstructed)
|
if (EmulatorConstructed)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Attempted constructing more than 1 CNESEmulator"));
|
spdlog::fatal("Attempted constructing more than 1 CNESEmulator");
|
||||||
EmulatorConstructed = true;
|
EmulatorConstructed = true;
|
||||||
|
|
||||||
CDvdFile NESEmuFile("NESemuP.rel");
|
CDvdFile NESEmuFile("NESemuP.rel");
|
||||||
@ -190,7 +189,7 @@ CNESEmulator::CNESEmulator() {
|
|||||||
m_nesEmuPBuf.reset(new u8[0x20000]);
|
m_nesEmuPBuf.reset(new u8[0x20000]);
|
||||||
m_dvdReq = NESEmuFile.AsyncSeekRead(m_nesEmuPBuf.get(), 0x20000, ESeekOrigin::Begin, NESEMUP_ROM_OFFSET);
|
m_dvdReq = NESEmuFile.AsyncSeekRead(m_nesEmuPBuf.get(), 0x20000, ESeekOrigin::Begin, NESEMUP_ROM_OFFSET);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unable to open NESemuP.rel"));
|
spdlog::fatal("Unable to open NESemuP.rel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1050,15 +1050,15 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
|||||||
} else {
|
} else {
|
||||||
x2fc_textpane_hint->TextSupport().SetText(u"");
|
x2fc_textpane_hint->TextSupport().SetText(u"");
|
||||||
std::u16string str =
|
std::u16string str =
|
||||||
fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
|
fmt::format(u"&image=SI,0.6,1.0,{};", g_tweakPlayerRes->x24_lStick[x2e4_lStickPos]);
|
||||||
str += g_MainStringTable->GetString(46 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Rotate
|
str += g_MainStringTable->GetString(46 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Rotate
|
||||||
x300_textpane_instructions->TextSupport().SetText(str);
|
x300_textpane_instructions->TextSupport().SetText(str);
|
||||||
str = fmt::format(FMT_STRING(u"&image=SI,0.6,1.0,{};"), g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
|
str = fmt::format(u"&image=SI,0.6,1.0,{};", g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos]);
|
||||||
str += g_MainStringTable->GetString(47 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Move
|
str += g_MainStringTable->GetString(47 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Move
|
||||||
x304_textpane_instructions1->TextSupport().SetText(str);
|
x304_textpane_instructions1->TextSupport().SetText(str);
|
||||||
str = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
|
str = fmt::format(u"&image={};", g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos]);
|
||||||
str += g_MainStringTable->GetString(48 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Zoom
|
str += g_MainStringTable->GetString(48 + (!g_Main->IsUSA() || g_Main->IsTrilogy())); // Zoom
|
||||||
str += fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
|
str += fmt::format(u"&image={};", g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos]);
|
||||||
x308_textpane_instructions2->TextSupport().SetText(str);
|
x308_textpane_instructions2->TextSupport().SetText(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1132,7 +1132,7 @@ void CAutoMapper::Update(float dt, CStateManager& mgr) {
|
|||||||
std::u16string string;
|
std::u16string string;
|
||||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
|
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
|
||||||
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
|
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
|
||||||
string = fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]);
|
string = fmt::format(u"&image={};", g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos]);
|
||||||
right1->TextSupport().SetText(string);
|
right1->TextSupport().SetText(string);
|
||||||
CGuiTextPane* right = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
|
CGuiTextPane* right = static_cast<CGuiTextPane*>(x28_frmeMapScreen->FindWidget("textpane_right"));
|
||||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
||||||
|
@ -30,10 +30,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
|
|
||||||
#include "Runtime/CStopwatch.hpp"
|
#include "Runtime/CStopwatch.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
static u64 MachToDolphinNum;
|
static u64 MachToDolphinNum;
|
||||||
@ -43,7 +41,6 @@ static LARGE_INTEGER PerfFrequency;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module LogModule("metaforce::CBasics");
|
|
||||||
void CBasics::Initialize() {
|
void CBasics::Initialize() {
|
||||||
CStopwatch::InitGlobalTimer();
|
CStopwatch::InitGlobalTimer();
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
@ -352,11 +349,11 @@ void CBasics::MakeDir(const char* dir) {
|
|||||||
const nowide::wstackstring wdir(dir);
|
const nowide::wstackstring wdir(dir);
|
||||||
if (!CreateDirectoryW(wdir.get(), NULL))
|
if (!CreateDirectoryW(wdir.get(), NULL))
|
||||||
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
||||||
LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({})"), dir);
|
LogModule.report(logvisor::Fatal, "MakeDir({})", dir);
|
||||||
#else
|
#else
|
||||||
if (mkdir(dir, 0755))
|
if (mkdir(dir, 0755))
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
LogModule.report(logvisor::Fatal, FMT_STRING("MakeDir({}): {}"), dir, strerror(errno));
|
spdlog::fatal("MakeDir({}): {}", dir, strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,6 @@ void CDvdFile::DoWork() {
|
|||||||
|
|
||||||
void CDvdFile::WorkerProc() {
|
void CDvdFile::WorkerProc() {
|
||||||
#ifdef HAS_DVD_THREAD
|
#ifdef HAS_DVD_THREAD
|
||||||
logvisor::RegisterThreadName("CDvdFile");
|
|
||||||
OPTICK_THREAD("CDvdFile");
|
OPTICK_THREAD("CDvdFile");
|
||||||
|
|
||||||
while (m_WorkerRun.load()) {
|
while (m_WorkerRun.load()) {
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
#include "Runtime/CGameAllocator.hpp"
|
#include "Runtime/CGameAllocator.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CGameAllocator");
|
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||||
|
|
||||||
std::vector<CGameAllocator::SAllocationDescription> CGameAllocator::m_allocations;
|
std::vector<CGameAllocator::SAllocationDescription> CGameAllocator::m_allocations;
|
||||||
@ -46,8 +43,7 @@ u8* CGameAllocator::Alloc(size_t len) {
|
|||||||
void CGameAllocator::Free(u8* ptr) {
|
void CGameAllocator::Free(u8* ptr) {
|
||||||
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(ptr - sizeof(SChunkDescription));
|
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(ptr - sizeof(SChunkDescription));
|
||||||
if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF) {
|
if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Invalid chunk description, memory corruption!"));
|
spdlog::fatal("Invalid chunk description, memory corruption!");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SAllocationDescription& alloc = *info->parent;
|
SAllocationDescription& alloc = *info->parent;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Runtime/RetroTypes.hpp"
|
#include "Runtime/RetroTypes.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ public:
|
|||||||
bool ReadFromMemoryCard(std::string_view name) { return true; }
|
bool ReadFromMemoryCard(std::string_view name) { return true; }
|
||||||
|
|
||||||
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, std::string_view midiObj) {
|
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, std::string_view midiObj) {
|
||||||
return fmt::format(FMT_STRING("World {} Area {} MidiObject: {}"), world, area, midiObj);
|
return fmt::format("World {} Area {} MidiObject: {}", world, area, midiObj);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
#include "Runtime/CInfiniteLoopDetector.hpp"
|
#include "Runtime/CInfiniteLoopDetector.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
namespace {
|
||||||
logvisor::Module Log("CInfiniteLoopDetector");
|
|
||||||
std::chrono::system_clock::time_point g_WatchDog = std::chrono::system_clock::now();
|
std::chrono::system_clock::time_point g_WatchDog = std::chrono::system_clock::now();
|
||||||
std::mutex g_mutex;
|
std::mutex g_mutex;
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -22,7 +21,7 @@ void CInfiniteLoopDetector::run() {
|
|||||||
std::lock_guard<std::mutex> guard(g_mutex);
|
std::lock_guard<std::mutex> guard(g_mutex);
|
||||||
if (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - g_WatchDog) >
|
if (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - g_WatchDog) >
|
||||||
std::chrono::milliseconds(m_duration)) {
|
std::chrono::milliseconds(m_duration)) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("INFINITE LOOP DETECTED!"));
|
spdlog::fatal("INFINITE LOOP DETECTED!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
||||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||||
#include "Runtime/CInfiniteLoopDetector.hpp"
|
#include "Runtime/CInfiniteLoopDetector.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
// #include "amuse/BooBackend.hpp"
|
// #include "amuse/BooBackend.hpp"
|
||||||
|
|
||||||
#include "logvisor/logvisor.hpp"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@ -113,8 +112,6 @@ private:
|
|||||||
extern std::string ExeDir;
|
extern std::string ExeDir;
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log{"Metaforce"};
|
|
||||||
|
|
||||||
std::optional<MP1::CMain> g_mainMP1;
|
std::optional<MP1::CMain> g_mainMP1;
|
||||||
|
|
||||||
static std::string CPUFeatureString(const zeus::CPUInfo& cpuInf) {
|
static std::string CPUFeatureString(const zeus::CPUInfo& cpuInf) {
|
||||||
@ -187,8 +184,7 @@ public:
|
|||||||
void onAppLaunched(const AuroraInfo& info) noexcept {
|
void onAppLaunched(const AuroraInfo& info) noexcept {
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
VISetWindowTitle(
|
VISetWindowTitle(fmt::format("Metaforce {} [{}]", METAFORCE_WC_DESCRIBE, backend_name(info.backend)).c_str());
|
||||||
fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend_name(info.backend)).c_str());
|
|
||||||
|
|
||||||
// m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
// m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
||||||
// m_voiceEngine->setVolume(0.7f);
|
// m_voiceEngine->setVolume(0.7f);
|
||||||
@ -215,9 +211,9 @@ public:
|
|||||||
zeus::detectCPU();
|
zeus::detectCPU();
|
||||||
|
|
||||||
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
||||||
Log.report(logvisor::Info, FMT_STRING("CPU Name: {}"), cpuInf.cpuBrand);
|
spdlog::info("CPU Name: {}", cpuInf.cpuBrand);
|
||||||
Log.report(logvisor::Info, FMT_STRING("CPU Vendor: {}"), cpuInf.cpuVendor);
|
spdlog::info("CPU Vendor: {}", cpuInf.cpuVendor);
|
||||||
Log.report(logvisor::Info, FMT_STRING("CPU Features: {}"), CPUFeatureString(cpuInf));
|
spdlog::info("CPU Features: {}", CPUFeatureString(cpuInf));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSdlEvent(const SDL_Event& event) noexcept {
|
void onSdlEvent(const SDL_Event& event) noexcept {
|
||||||
@ -244,13 +240,13 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!m_projectInitialized && !m_deferredProject.empty()) {
|
if (!m_projectInitialized && !m_deferredProject.empty()) {
|
||||||
Log.report(logvisor::Info, FMT_STRING("Loading game from '{}'"), m_deferredProject);
|
spdlog::info("Loading game from '{}'", m_deferredProject);
|
||||||
if (CDvdFile::Initialize(m_deferredProject)) {
|
if (CDvdFile::Initialize(m_deferredProject)) {
|
||||||
m_projectInitialized = true;
|
m_projectInitialized = true;
|
||||||
m_cvarCommons.m_lastDiscPath->fromLiteral(m_deferredProject);
|
m_cvarCommons.m_lastDiscPath->fromLiteral(m_deferredProject);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, FMT_STRING("Failed to open disc image '{}'"), m_deferredProject);
|
spdlog::error("Failed to open disc image '{}'", m_deferredProject);
|
||||||
m_imGuiConsole.m_errorString = fmt::format(FMT_STRING("Failed to open disc image '{}'"), m_deferredProject);
|
m_imGuiConsole.m_errorString = fmt::format("Failed to open disc image '{}'", m_deferredProject);
|
||||||
}
|
}
|
||||||
m_deferredProject.clear();
|
m_deferredProject.clear();
|
||||||
}
|
}
|
||||||
@ -292,10 +288,9 @@ public:
|
|||||||
|
|
||||||
if (!g_mainMP1 && m_projectInitialized) {
|
if (!g_mainMP1 && m_projectInitialized) {
|
||||||
g_mainMP1.emplace(nullptr, nullptr);
|
g_mainMP1.emplace(nullptr, nullptr);
|
||||||
auto result =
|
auto result = g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager);
|
||||||
g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager);
|
|
||||||
if (!result.empty()) {
|
if (!result.empty()) {
|
||||||
Log.report(logvisor::Error, FMT_STRING("{}"), result);
|
spdlog::error("{}", result);
|
||||||
m_imGuiConsole.m_errorString = result;
|
m_imGuiConsole.m_errorString = result;
|
||||||
g_mainMP1.reset();
|
g_mainMP1.reset();
|
||||||
CDvdFile::Shutdown();
|
CDvdFile::Shutdown();
|
||||||
@ -358,7 +353,6 @@ public:
|
|||||||
CDvdFile::DoWork();
|
CDvdFile::DoWork();
|
||||||
#endif
|
#endif
|
||||||
CGraphics::TickRenderTimings();
|
CGraphics::TickRenderTimings();
|
||||||
++logvisor::FrameIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAppWindowResized(const AuroraWindowSize& size) noexcept {
|
void onAppWindowResized(const AuroraWindowSize& size) noexcept {
|
||||||
@ -370,7 +364,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onAppWindowMoved(const AuroraWindowPos& pos) {
|
void onAppWindowMoved(const AuroraWindowPos& pos) {
|
||||||
if (pos.x > 0 && pos.y > 0 && (pos.x != m_cvarCommons.getWindowPos().x || pos.y != m_cvarCommons.getWindowPos().y)) {
|
if (pos.x > 0 && pos.y > 0 &&
|
||||||
|
(pos.x != m_cvarCommons.getWindowPos().x || pos.y != m_cvarCommons.getWindowPos().y)) {
|
||||||
m_cvarCommons.m_windowPos->fromVec2i(zeus::CVector2i(pos.x, pos.y));
|
m_cvarCommons.m_windowPos->fromVec2i(zeus::CVector2i(pos.x, pos.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,12 +410,11 @@ static void SetupBasics() {
|
|||||||
auto result = zeus::validateCPU();
|
auto result = zeus::validateCPU();
|
||||||
if (!result.first) {
|
if (!result.first) {
|
||||||
#if _WIN32 && !WINDOWS_STORE
|
#if _WIN32 && !WINDOWS_STORE
|
||||||
std::string msg =
|
std::string msg = fmt::format("ERROR: This build of Metaforce requires the following CPU features:\n{}\n",
|
||||||
fmt::format(FMT_STRING("ERROR: This build of Metaforce requires the following CPU features:\n{}\n"),
|
|
||||||
metaforce::CPUFeatureString(result.second));
|
metaforce::CPUFeatureString(result.second));
|
||||||
MessageBoxW(nullptr, nowide::widen(msg).c_str(), L"CPU error", MB_OK | MB_ICONERROR);
|
MessageBoxW(nullptr, nowide::widen(msg).c_str(), L"CPU error", MB_OK | MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
fmt::print(stderr, FMT_STRING("ERROR: This build of Metaforce requires the following CPU features:\n{}\n"),
|
fmt::print(stderr, "ERROR: This build of Metaforce requires the following CPU features:\n{}\n",
|
||||||
metaforce::CPUFeatureString(result.second));
|
metaforce::CPUFeatureString(result.second));
|
||||||
#endif
|
#endif
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -449,27 +443,30 @@ static std::unique_ptr<metaforce::Application> g_app;
|
|||||||
static SDL_Window* g_window;
|
static SDL_Window* g_window;
|
||||||
static bool g_paused;
|
static bool g_paused;
|
||||||
|
|
||||||
static void aurora_log_callback(AuroraLogLevel level, const char* message, unsigned int len) {
|
static void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, unsigned int len) {
|
||||||
logvisor::Level severity = logvisor::Fatal;
|
spdlog::level::level_enum severity = spdlog::level::critical;
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LOG_DEBUG:
|
case LOG_DEBUG:
|
||||||
|
severity = spdlog::level::debug;
|
||||||
|
break;
|
||||||
case LOG_INFO:
|
case LOG_INFO:
|
||||||
severity = logvisor::Info;
|
severity = spdlog::level::info;
|
||||||
break;
|
break;
|
||||||
case LOG_WARNING:
|
case LOG_WARNING:
|
||||||
severity = logvisor::Warning;
|
severity = spdlog::level::warn;
|
||||||
break;
|
break;
|
||||||
case LOG_ERROR:
|
case LOG_ERROR:
|
||||||
severity = logvisor::Error;
|
severity = spdlog::level::err;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
const std::string_view view(message, len);
|
||||||
if (level == LOG_FATAL) {
|
if (level == LOG_FATAL) {
|
||||||
auto msg = fmt::format(FMT_STRING("Metaforce encountered an internal error:\n\n{}"), message);
|
auto msg = fmt::format("Metaforce encountered an internal error:\n\n{}", view);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Metaforce", msg.c_str(), g_window);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Metaforce", msg.c_str(), g_window);
|
||||||
}
|
}
|
||||||
metaforce::Log.report(severity, FMT_STRING("{}"), message);
|
spdlog::log(severity, "[{}] {}", module, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aurora_imgui_init_callback(const AuroraWindowSize* size) { g_app->onImGuiInit(size->scale); }
|
static void aurora_imgui_init_callback(const AuroraWindowSize* size) { g_app->onImGuiInit(size->scale); }
|
||||||
@ -481,7 +478,7 @@ int main(int argc, char** argv) {
|
|||||||
// for now it's disabled
|
// for now it's disabled
|
||||||
// fesetround(FE_TOWARDZERO);
|
// fesetround(FE_TOWARDZERO);
|
||||||
if (argc > 1 && !strcmp(argv[1], "--dlpackage")) {
|
if (argc > 1 && !strcmp(argv[1], "--dlpackage")) {
|
||||||
fmt::print(FMT_STRING("{}\n"), METAFORCE_DLPACKAGE);
|
fmt::print("{}\n", METAFORCE_DLPACKAGE);
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,30 +504,29 @@ int main(int argc, char** argv) {
|
|||||||
if (!restart) {
|
if (!restart) {
|
||||||
// TODO add clear loggers func to logvisor so we can recreate loggers on restart
|
// TODO add clear loggers func to logvisor so we can recreate loggers on restart
|
||||||
bool logging = IsClientLoggingEnabled(argc, argv);
|
bool logging = IsClientLoggingEnabled(argc, argv);
|
||||||
#if _WIN32
|
// #if _WIN32
|
||||||
if (logging && GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN) {
|
// if (logging && GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == FILE_TYPE_UNKNOWN) {
|
||||||
logvisor::CreateWin32Console();
|
// logvisor::CreateWin32Console();
|
||||||
}
|
// }
|
||||||
#endif
|
// #endif
|
||||||
logvisor::RegisterStandardExceptions();
|
// logvisor::RegisterStandardExceptions();
|
||||||
if (logging) {
|
// if (logging) {
|
||||||
logvisor::RegisterConsoleLogger();
|
// logvisor::RegisterConsoleLogger();
|
||||||
}
|
// }
|
||||||
|
|
||||||
std::string logFile = cvarCmns.getLogFile();
|
std::string logFile = cvarCmns.getLogFile();
|
||||||
if (!logFile.empty()) {
|
if (!logFile.empty()) {
|
||||||
std::time_t time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
std::time_t time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
||||||
char buf[100];
|
char buf[100];
|
||||||
std::strftime(buf, 100, "%Y-%m-%d_%H-%M-%S", std::localtime(&time));
|
std::strftime(buf, 100, "%Y-%m-%d_%H-%M-%S", std::localtime(&time));
|
||||||
logFilePath = fmt::format(FMT_STRING("{}/{}-{}"), fileMgr.getStoreRoot(), buf, logFile);
|
logFilePath = fmt::format("{}/{}-{}", fileMgr.getStoreRoot(), buf, logFile);
|
||||||
logvisor::RegisterFileLogger(logFilePath.c_str());
|
// logvisor::RegisterFileLogger(logFilePath.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_app = std::make_unique<metaforce::Application>(argc, argv, fileMgr, cvarMgr, cvarCmns);
|
g_app = std::make_unique<metaforce::Application>(argc, argv, fileMgr, cvarMgr, cvarCmns);
|
||||||
std::string configPath{fileMgr.getStoreRoot()};
|
std::string configPath{fileMgr.getStoreRoot()};
|
||||||
|
|
||||||
|
|
||||||
const AuroraConfig config{
|
const AuroraConfig config{
|
||||||
.appName = "Metaforce",
|
.appName = "Metaforce",
|
||||||
.configPath = configPath.c_str(),
|
.configPath = configPath.c_str(),
|
||||||
@ -600,7 +596,9 @@ int main(int argc, char** argv) {
|
|||||||
if (g_paused) {
|
if (g_paused) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
aurora_begin_frame();
|
if (!aurora_begin_frame()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
g_app->onAppIdle(1.f / 60.f /* TODO */);
|
g_app->onAppIdle(1.f / 60.f /* TODO */);
|
||||||
g_app->onAppDraw();
|
g_app->onAppDraw();
|
||||||
aurora_end_frame();
|
aurora_end_frame();
|
||||||
|
@ -149,13 +149,8 @@ function(add_runtime_common_library name)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
set(RUNTIME_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
||||||
set(DISCORD_RPC_LIBRARY "")
|
set(RUNTIME_LIBRARIES zeus nod NESEmulator libjpeg-turbo jbus kabufuda OptickCore
|
||||||
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
|
imgui_support aurora::aurora spdlog::spdlog
|
||||||
set(DISCORD_RPC_LIBRARY "discord-rpc")
|
|
||||||
endif()
|
|
||||||
set(RUNTIME_LIBRARIES zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore
|
|
||||||
imgui_support aurora::aurora
|
|
||||||
${DISCORD_RPC_LIBRARY}
|
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#include "CMemoryCardSys.hpp"
|
#include "CMemoryCardSys.hpp"
|
||||||
|
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
#include "Runtime/IMain.hpp"
|
#include "Runtime/IMain.hpp"
|
||||||
#include <Runtime/CBasics.hpp>
|
#include "Runtime/CBasics.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include <SDL3/SDL_filesystem.h>
|
#include <SDL3/SDL_filesystem.h>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
@ -23,7 +27,7 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
auto path = *dolphinPath;
|
auto path = *dolphinPath;
|
||||||
path += fmt::format(FMT_STRING("GC/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format("GC/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
|
|
||||||
CBasics::Sstat theStat{};
|
CBasics::Sstat theStat{};
|
||||||
if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
|
if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
|
||||||
@ -35,10 +39,10 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
|||||||
|
|
||||||
path = home;
|
path = home;
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
path += fmt::format(FMT_STRING("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw"),
|
path += fmt::format("/.dolphin-emu/GC/MemoryCard{:c}.USA.raw",
|
||||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
#else
|
#else
|
||||||
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
path += fmt::format("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw",
|
||||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
#endif
|
#endif
|
||||||
if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
|
if (CBasics::Stat(path.c_str(), &theStat) != 0 || !S_ISREG(theStat.st_mode)) {
|
||||||
@ -64,7 +68,7 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format("/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
auto* file = fopen(path.c_str(), "wbe");
|
auto* file = fopen(path.c_str(), "wbe");
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -10,7 +10,7 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
|||||||
return {};
|
return {};
|
||||||
|
|
||||||
std::string path = home;
|
std::string path = home;
|
||||||
path += fmt::format(FMT_STRING("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw"),
|
path += fmt::format("/Library/Application Support/Dolphin/GC/MemoryCard{:c}.USA.raw",
|
||||||
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
|
|
||||||
hecl::Sstat theStat;
|
hecl::Sstat theStat;
|
||||||
@ -34,7 +34,7 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do
|
|||||||
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
path += fmt::format(FMT_STRING("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format("/MemoryCard{:c}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
return {};
|
return {};
|
||||||
|
@ -63,7 +63,7 @@ std::string CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlot slot) {
|
|||||||
std::string path(localFolder->Path->Data());
|
std::string path(localFolder->Path->Data());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
path += fmt::format(FMT_STRING("/GC/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format("/GC/MemoryCard{}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
|
|
||||||
struct _stat64 theStat{};
|
struct _stat64 theStat{};
|
||||||
if (_stat64(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
if (_stat64(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
|
||||||
@ -116,7 +116,7 @@ std::string CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot slot, bool do
|
|||||||
if (CBasics::RecursiveMakeDir(path.c_str()) < 0)
|
if (CBasics::RecursiveMakeDir(path.c_str()) < 0)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
path += fmt::format(FMT_STRING("/MemoryCard{}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
path += fmt::format("/MemoryCard{}.USA.raw", slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||||
const nowide::wstackstring wpath(path);
|
const nowide::wstackstring wpath(path);
|
||||||
FILE* fp = _wfopen(wpath.get(), L"wb");
|
FILE* fp = _wfopen(wpath.get(), L"wb");
|
||||||
if (fp == nullptr) {
|
if (fp == nullptr) {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#include "Runtime/CObjectList.hpp"
|
#include "Runtime/CObjectList.hpp"
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
|
||||||
logvisor::Module Log("metaforce::CObjectList");
|
|
||||||
}
|
|
||||||
|
|
||||||
CObjectList::CObjectList(EGameObjectList listEnum) : x2004_listEnum(listEnum) {}
|
CObjectList::CObjectList(EGameObjectList listEnum) : x2004_listEnum(listEnum) {}
|
||||||
|
|
||||||
@ -13,8 +12,7 @@ void CObjectList::AddObject(CEntity& entity) {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_list[entity.GetUniqueId().Value()].entity != nullptr &&
|
if (x0_list[entity.GetUniqueId().Value()].entity != nullptr &&
|
||||||
x0_list[entity.GetUniqueId().Value()].entity != &entity)
|
x0_list[entity.GetUniqueId().Value()].entity != &entity)
|
||||||
Log.report(logvisor::Level::Fatal,
|
spdlog::fatal("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!",
|
||||||
FMT_STRING("INVALID USAGE DETECTED: Attempting to assign entity '{} ({})' to existing node '{}'!!!"),
|
|
||||||
entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value());
|
entity.GetName(), entity.GetEditorId(), entity.GetUniqueId().Value());
|
||||||
#endif
|
#endif
|
||||||
s16 prevFirst = -1;
|
s16 prevFirst = -1;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "Runtime/CPakFile.hpp"
|
#include "Runtime/CPakFile.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
#include "Runtime/Logging.hpp"
|
||||||
static logvisor::Module Log("metaforce::CPakFile");
|
|
||||||
|
|
||||||
|
namespace metaforce {
|
||||||
CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override) : CDvdFile(filename) {
|
CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak, bool override) : CDvdFile(filename) {
|
||||||
if (!CDvdFile::operator bool())
|
if (!CDvdFile::operator bool())
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("{}: Unable to open"), GetPath());
|
spdlog::fatal("{}: Unable to open", GetPath());
|
||||||
x28_24_buildDepList = buildDepList;
|
x28_24_buildDepList = buildDepList;
|
||||||
// x28_24_buildDepList = true; // Always do this so metaforce can rapidly pre-warm shaders
|
// x28_24_buildDepList = true; // Always do this so metaforce can rapidly pre-warm shaders
|
||||||
x28_26_worldPak = worldPak;
|
x28_26_worldPak = worldPak;
|
||||||
@ -65,10 +65,8 @@ void CPakFile::InitialHeaderLoad() {
|
|||||||
x30_dvdReq.reset();
|
x30_dvdReq.reset();
|
||||||
u32 version = r.ReadLong();
|
u32 version = r.ReadLong();
|
||||||
if (version != 0x00030005) {
|
if (version != 0x00030005) {
|
||||||
Log.report(logvisor::Fatal,
|
spdlog::fatal("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}", GetPath(),
|
||||||
FMT_STRING("{}: Incompatible pak file version -- Current version is {:08X}, you're using {:08X}"),
|
0x00030005, version);
|
||||||
GetPath(), 0x00030005, version);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r.ReadLong();
|
r.ReadLong();
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/CStopwatch.hpp"
|
#include "Runtime/CStopwatch.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "optick.h"
|
#include "optick.h"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("CResFactory");
|
|
||||||
|
|
||||||
void CResFactory::AddToLoadList(SLoadingData&& data) {
|
void CResFactory::AddToLoadList(SLoadingData&& data) {
|
||||||
const SObjectTag tag = data.x0_tag;
|
const SObjectTag tag = data.x0_tag;
|
||||||
m_loadMap.insert_or_assign(tag, m_loadList.insert(m_loadList.end(), std::move(data)));
|
m_loadMap.insert_or_assign(tag, m_loadList.insert(m_loadList.end(), std::move(data)));
|
||||||
@ -29,7 +30,7 @@ CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTran
|
|||||||
else
|
else
|
||||||
ret = std::make_unique<TObjOwnerDerivedFromIObjUntyped>(nullptr);
|
ret = std::make_unique<TObjOwnerDerivedFromIObjUntyped>(nullptr);
|
||||||
}
|
}
|
||||||
Log.report(logvisor::Warning, FMT_STRING("sync-built {}"), tag);
|
spdlog::warn("sync-built {}", tag);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ bool CResFactory::PumpResource(SLoadingData& data) {
|
|||||||
*data.xc_targetPtr =
|
*data.xc_targetPtr =
|
||||||
x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize,
|
x5c_factoryMgr.MakeObjectFromMemory(data.x0_tag, std::move(data.x10_loadBuffer), data.x14_resSize,
|
||||||
data.m_compressed, data.x18_cvXfer, data.m_selfRef);
|
data.m_compressed, data.x18_cvXfer, data.m_selfRef);
|
||||||
Log.report(logvisor::Info, FMT_STRING("async-built {}"), data.x0_tag);
|
spdlog::info("async-built {}", data.x0_tag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "Runtime/CResLoader.hpp"
|
#include "Runtime/CResLoader.hpp"
|
||||||
|
|
||||||
#include "Runtime/CPakFile.hpp"
|
#include "Runtime/CPakFile.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("CResLoader");
|
|
||||||
|
|
||||||
CResLoader::CResLoader() { x48_curPak = x18_pakLoadedList.end(); }
|
CResLoader::CResLoader() { x48_curPak = x18_pakLoadedList.end(); }
|
||||||
|
|
||||||
const std::vector<CAssetId>* CResLoader::GetTagListForFile(std::string_view name) const {
|
const std::vector<CAssetId>* CResLoader::GetTagListForFile(std::string_view name) const {
|
||||||
@ -213,7 +213,7 @@ bool CResLoader::FindResource(CAssetId id) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Unable to find asset {}"), id);
|
spdlog::warn("Unable to find asset {}", id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ CPakFile* CResLoader::FindResourceForLoad(CAssetId id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.report(logvisor::Error, FMT_STRING("Unable to find asset {}"), id);
|
spdlog::error("Unable to find asset {}", id);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "Runtime/World/CWallCrawlerSwarm.hpp"
|
#include "Runtime/World/CWallCrawlerSwarm.hpp"
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
#include <zeus/CMRay.hpp>
|
#include <zeus/CMRay.hpp>
|
||||||
@ -61,7 +62,6 @@ CVar* debugToolDrawMazePath = nullptr;
|
|||||||
CVar* debugToolDrawPlatformCollision = nullptr;
|
CVar* debugToolDrawPlatformCollision = nullptr;
|
||||||
CVar* sm_logScripting = nullptr;
|
CVar* sm_logScripting = nullptr;
|
||||||
} // namespace
|
} // namespace
|
||||||
logvisor::Module LogModule("metaforce::CStateManager");
|
|
||||||
CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>& mailbox, const std::weak_ptr<CMapWorldInfo>& mwInfo,
|
CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>& mailbox, const std::weak_ptr<CMapWorldInfo>& mwInfo,
|
||||||
const std::weak_ptr<CPlayerState>& playerState,
|
const std::weak_ptr<CPlayerState>& playerState,
|
||||||
const std::weak_ptr<CWorldTransManager>& wtMgr,
|
const std::weak_ptr<CWorldTransManager>& wtMgr,
|
||||||
@ -1209,11 +1209,10 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
|
|||||||
if (m_logScripting) {
|
if (m_logScripting) {
|
||||||
auto srcObj = GetObjectById(src);
|
auto srcObj = GetObjectById(src);
|
||||||
if (srcObj != nullptr) {
|
if (srcObj != nullptr) {
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(),
|
spdlog::info("{} is sending '{}' to '{}' id= {} -> {}", srcObj->GetName(), ScriptObjectMessageToStr(msg),
|
||||||
ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId());
|
dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId());
|
||||||
} else {
|
} else {
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
spdlog::info("Sending '{}' to '{}' id= {}", ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId());
|
||||||
dest->GetName(), dest->GetUniqueId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1234,11 +1233,10 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
|
|||||||
if (m_logScripting) {
|
if (m_logScripting) {
|
||||||
auto srcObj = GetObjectById(src);
|
auto srcObj = GetObjectById(src);
|
||||||
if (srcObj != nullptr) {
|
if (srcObj != nullptr) {
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(),
|
spdlog::info("{} is sending '{}' to '{}' id= {} -> {}", srcObj->GetName(), ScriptObjectMessageToStr(msg),
|
||||||
ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId());
|
dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId());
|
||||||
} else {
|
} else {
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
|
spdlog::info("Sending '{}' to '{}' id= {}", ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId());
|
||||||
dst->GetName(), dst->GetUniqueId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1308,7 +1306,7 @@ void CStateManager::FreeScriptObject(TUniqueId id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_logScripting) {
|
if (m_logScripting) {
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("Removed '{}'"), ent->GetName());
|
spdlog::info("Removed '{}'", ent->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1424,8 +1422,7 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
|
|||||||
|
|
||||||
const u32 readAmt = in.GetReadPosition() - startPos;
|
const u32 readAmt = in.GetReadPosition() - startPos;
|
||||||
if (readAmt > length) {
|
if (readAmt > length) {
|
||||||
LogModule.report(logvisor::Fatal, FMT_STRING("Script object overread while reading {}"),
|
spdlog::fatal("Script object overread while reading {}", ScriptObjectTypeToStr(type));
|
||||||
ScriptObjectTypeToStr(type));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const u32 leftover = length - readAmt;
|
const u32 leftover = length - readAmt;
|
||||||
@ -1434,12 +1431,11 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error || ent == nullptr) {
|
if (error || ent == nullptr) {
|
||||||
LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {} (Editor ID: {}, Area: {})"),
|
spdlog::error("Script load error while loading {} (Editor ID: {}, Area: {})", ScriptObjectTypeToStr(type), id, aid);
|
||||||
ScriptObjectTypeToStr(type), id, aid);
|
|
||||||
return {kInvalidEditorId, kInvalidUniqueId};
|
return {kInvalidEditorId, kInvalidUniqueId};
|
||||||
} else {
|
} else {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("Loaded {} in area {}"), ent->GetName(), ent->GetAreaIdAlways());
|
LogModule.report(logvisor::Info, "Loaded {} in area {}", ent->GetName(), ent->GetAreaIdAlways());
|
||||||
#endif
|
#endif
|
||||||
return {id, ent->GetUniqueId()};
|
return {id, ent->GetUniqueId()};
|
||||||
}
|
}
|
||||||
@ -2669,7 +2665,7 @@ void CStateManager::AddObject(CEntity& ent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_logScripting) {
|
if (m_logScripting) {
|
||||||
LogModule.report(logvisor::Info, FMT_STRING("Added '{}'"), ent.GetName());
|
spdlog::info("Added '{}'", ent.GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2721,7 +2717,7 @@ TUniqueId CStateManager::AllocateUniqueId() {
|
|||||||
ourIndex = x0_nextFreeIndex;
|
ourIndex = x0_nextFreeIndex;
|
||||||
x0_nextFreeIndex = (ourIndex + 1) & 0x3ff;
|
x0_nextFreeIndex = (ourIndex + 1) & 0x3ff;
|
||||||
if (x0_nextFreeIndex == lastIndex) {
|
if (x0_nextFreeIndex == lastIndex) {
|
||||||
LogModule.report(logvisor::Fatal, FMT_STRING("Object list full!"));
|
spdlog::fatal("Object list full!");
|
||||||
}
|
}
|
||||||
} while (GetAllObjectList().GetObjectByIndex(ourIndex) != nullptr);
|
} while (GetAllObjectList().GetObjectByIndex(ourIndex) != nullptr);
|
||||||
|
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/Character/CAnimSourceReader.hpp"
|
#include "Runtime/Character/CAnimSourceReader.hpp"
|
||||||
#include "Runtime/Character/CFBStreamedAnimReader.hpp"
|
#include "Runtime/Character/CFBStreamedAnimReader.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CAllFormatsAnimSource");
|
|
||||||
|
|
||||||
void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream& in, IObjectStore& store) {
|
void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream& in, IObjectStore& store) {
|
||||||
switch (fmt) {
|
switch (fmt) {
|
||||||
case EAnimFormat::Uncompressed:
|
case EAnimFormat::Uncompressed:
|
||||||
@ -21,7 +18,7 @@ void CAnimFormatUnion::SubConstruct(u8* storage, EAnimFormat fmt, CInputStream&
|
|||||||
new (storage) CFBStreamedCompression(in, store, true);
|
new (storage) CFBStreamedCompression(in, store, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to read ANIM format {}"), int(fmt));
|
spdlog::fatal("unable to read ANIM format {}", static_cast<int>(fmt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,12 +24,9 @@
|
|||||||
#include "Runtime/Character/IAnimReader.hpp"
|
#include "Runtime/Character/IAnimReader.hpp"
|
||||||
#include "Runtime/Graphics/CSkinnedModel.hpp"
|
#include "Runtime/Graphics/CSkinnedModel.hpp"
|
||||||
#include "Runtime/Graphics/CGX.hpp"
|
#include "Runtime/Graphics/CGX.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("CAnimData");
|
|
||||||
|
|
||||||
rstl::reserved_vector<CBoolPOINode, 8> CAnimData::g_BoolPOINodes;
|
rstl::reserved_vector<CBoolPOINode, 8> CAnimData::g_BoolPOINodes;
|
||||||
rstl::reserved_vector<CInt32POINode, 16> CAnimData::g_Int32POINodes;
|
rstl::reserved_vector<CInt32POINode, 16> CAnimData::g_Int32POINodes;
|
||||||
rstl::reserved_vector<CParticlePOINode, 20> CAnimData::g_ParticlePOINodes;
|
rstl::reserved_vector<CParticlePOINode, 20> CAnimData::g_ParticlePOINodes;
|
||||||
@ -81,8 +78,7 @@ CAnimData::CAnimData(CAssetId id, const CCharacterInfo& character, int defaultAn
|
|||||||
|
|
||||||
if (defaultAnim == -1) {
|
if (defaultAnim == -1) {
|
||||||
defaultAnim = 0;
|
defaultAnim = 0;
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Character {} has invalid initial animation, so defaulting to first."),
|
spdlog::warn("Character {} has invalid initial animation, so defaulting to first.", character.GetCharacterName());
|
||||||
character.GetCharacterName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto treeNode = GetAnimationManager()->GetAnimationTree(character.GetAnimationIndex(defaultAnim),
|
auto treeNode = GetAnimationManager()->GetAnimationTree(character.GetAnimationIndex(defaultAnim),
|
||||||
|
@ -13,12 +13,10 @@
|
|||||||
#include "Runtime/Graphics/CSkinnedModel.hpp"
|
#include "Runtime/Graphics/CSkinnedModel.hpp"
|
||||||
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
|
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
|
||||||
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CModelData");
|
|
||||||
|
|
||||||
CModelData::~CModelData() = default;
|
CModelData::~CModelData() = default;
|
||||||
|
|
||||||
CModelData::CModelData() {}
|
CModelData::CModelData() {}
|
||||||
@ -27,7 +25,7 @@ CModelData CModelData::CModelDataNull() { return CModelData(); }
|
|||||||
CModelData::CModelData(const CStaticRes& res) : x0_scale(res.GetScale()) {
|
CModelData::CModelData(const CStaticRes& res) : x0_scale(res.GetScale()) {
|
||||||
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
|
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
|
||||||
if (!x1c_normalModel)
|
if (!x1c_normalModel)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), res.GetId());
|
spdlog::fatal("unable to find CMDL {}", res.GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelData::CModelData(const CAnimRes& res) : x0_scale(res.GetScale()) {
|
CModelData::CModelData(const CAnimRes& res) : x0_scale(res.GetScale()) {
|
||||||
@ -142,7 +140,7 @@ void CModelData::SetXRayModel(const std::pair<CAssetId, CAssetId>& modelSkin) {
|
|||||||
} else {
|
} else {
|
||||||
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||||
if (!x2c_xrayModel)
|
if (!x2c_xrayModel)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first);
|
spdlog::fatal("unable to find CMDL {}", modelSkin.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +156,7 @@ void CModelData::SetInfraModel(const std::pair<CAssetId, CAssetId>& modelSkin) {
|
|||||||
} else {
|
} else {
|
||||||
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||||
if (!x3c_infraModel)
|
if (!x3c_infraModel)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to find CMDL {}"), modelSkin.first);
|
spdlog::fatal("unable to find CMDL {}", modelSkin.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Runtime/RetroTypes.hpp"
|
#include "Runtime/RetroTypes.hpp"
|
||||||
#include "Runtime/Collision/CCollisionEdge.hpp"
|
#include "Runtime/Collision/CCollisionEdge.hpp"
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#include "Runtime/ConsoleVariables/CVar.hpp"
|
#include "Runtime/CStringExtras.hpp"
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/ConsoleVariables/CVar.hpp"
|
||||||
#include "Runtime/CStringExtras.hpp"
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||||
|
|
||||||
@ -269,7 +265,7 @@ bool CVar::fromVec2i(const zeus::CVector2i& val) {
|
|||||||
if (!safeToModify(EType::Vec2i))
|
if (!safeToModify(EType::Vec2i))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x, val.y));
|
m_value.assign(fmt::format("{} {}", val.x, val.y));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -278,7 +274,7 @@ bool CVar::fromVec2f(const zeus::CVector2f& val) {
|
|||||||
if (!safeToModify(EType::Vec2f))
|
if (!safeToModify(EType::Vec2f))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x(), val.y()));
|
m_value.assign(fmt::format("{} {}", val.x(), val.y()));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -287,7 +283,7 @@ bool CVar::fromVec2d(const zeus::CVector2d& val) {
|
|||||||
if (!safeToModify(EType::Vec2d))
|
if (!safeToModify(EType::Vec2d))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {}"), val.x(), val.y()));
|
m_value.assign(fmt::format("{} {}", val.x(), val.y()));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -296,7 +292,7 @@ bool CVar::fromVec3f(const zeus::CVector3f& val) {
|
|||||||
if (!safeToModify(EType::Vec3f))
|
if (!safeToModify(EType::Vec3f))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {} {}"), val.x(), val.y(), val.z()));
|
m_value.assign(fmt::format("{} {} {}", val.x(), val.y(), val.z()));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -305,7 +301,7 @@ bool CVar::fromVec3d(const zeus::CVector3d& val) {
|
|||||||
if (!safeToModify(EType::Vec3d))
|
if (!safeToModify(EType::Vec3d))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {} {}"), val.x(), val.y(), val.z()));
|
m_value.assign(fmt::format("{} {} {}", val.x(), val.y(), val.z()));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -314,7 +310,7 @@ bool CVar::fromVec4f(const zeus::CVector4f& val) {
|
|||||||
if (!safeToModify(EType::Vec4f))
|
if (!safeToModify(EType::Vec4f))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), val.x(), val.y(), val.z(), val.w()));
|
m_value.assign(fmt::format("{} {} {} {}", val.x(), val.y(), val.z(), val.w()));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -323,7 +319,7 @@ bool CVar::fromVec4d(const zeus::CVector4d& val) {
|
|||||||
if (!safeToModify(EType::Vec4d))
|
if (!safeToModify(EType::Vec4d))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{} {} {} {}"), val.x(), val.y(), val.z(), val.w()));
|
m_value.assign(fmt::format("{} {} {} {}", val.x(), val.y(), val.z(), val.w()));
|
||||||
m_flags |= EFlags::Modified;
|
m_flags |= EFlags::Modified;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -332,7 +328,7 @@ bool CVar::fromReal(double val) {
|
|||||||
if (!safeToModify(EType::Real))
|
if (!safeToModify(EType::Real))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_value.assign(fmt::format(FMT_STRING("{}"), val));
|
m_value.assign(fmt::format("{}", val));
|
||||||
setModified();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -363,7 +359,7 @@ bool CVar::fromInteger(int32_t val) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Properly format based on signedness
|
// Properly format based on signedness
|
||||||
m_value = fmt::format(FMT_STRING("{}"), (m_type == EType::Signed ? val : static_cast<uint32_t>(val)));
|
m_value = fmt::format("{}", (m_type == EType::Signed ? val : static_cast<uint32_t>(val)));
|
||||||
setModified();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -381,7 +377,7 @@ bool CVar::fromInteger(uint32_t val) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Properly format based on signedness
|
// Properly format based on signedness
|
||||||
m_value = fmt::format(FMT_STRING("{}"), (m_type == EType::Unsigned ? val : static_cast<int32_t>(val)));
|
m_value = fmt::format("{}", (m_type == EType::Unsigned ? val : static_cast<int32_t>(val)));
|
||||||
setModified();
|
setModified();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#include "Runtime/Streams/CMemoryInStream.hpp"
|
#include "Runtime/Streams/CMemoryInStream.hpp"
|
||||||
#include "Runtime/Streams/CMemoryStreamOut.hpp"
|
#include "Runtime/Streams/CMemoryStreamOut.hpp"
|
||||||
#include "Runtime/CStringExtras.hpp"
|
#include "Runtime/CStringExtras.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
@ -30,7 +31,6 @@ CVar* com_cubemaps = nullptr;
|
|||||||
static const std::regex cmdLineRegex(R"(\+([\w\.]+)([=])?([\/\\\s\w\.\-]+)?)");
|
static const std::regex cmdLineRegex(R"(\+([\w\.]+)([=])?([\/\\\s\w\.\-]+)?)");
|
||||||
CVarManager* CVarManager::m_instance = nullptr;
|
CVarManager* CVarManager::m_instance = nullptr;
|
||||||
|
|
||||||
static logvisor::Module CVarLog("CVarManager");
|
|
||||||
CVarManager::CVarManager(FileStoreManager& store, bool useBinary) : m_store(store), m_useBinary(useBinary) {
|
CVarManager::CVarManager(FileStoreManager& store, bool useBinary) : m_store(store), m_useBinary(useBinary) {
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
com_configfile =
|
com_configfile =
|
||||||
@ -175,7 +175,7 @@ void CVarManager::serialize() {
|
|||||||
CMemoryStreamOut memOut(workBuf.get(), requiredLen, CMemoryStreamOut::EOwnerShip::NotOwned, 32);
|
CMemoryStreamOut memOut(workBuf.get(), requiredLen, CMemoryStreamOut::EOwnerShip::NotOwned, 32);
|
||||||
CTextOutStream textOut(memOut);
|
CTextOutStream textOut(memOut);
|
||||||
for (const auto& cvar : container) {
|
for (const auto& cvar : container) {
|
||||||
auto str = fmt::format(FMT_STRING("{}: {}"), cvar.m_name, cvar.m_value);
|
auto str = fmt::format("{}: {}", cvar.m_name, cvar.m_value);
|
||||||
textOut.WriteString(str);
|
textOut.WriteString(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
||||||
|
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
#include <nowide/convert.hpp>
|
#include <nowide/convert.hpp>
|
||||||
#endif
|
#endif
|
||||||
@ -18,14 +18,12 @@ using namespace Windows::Storage;
|
|||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
namespace {
|
||||||
static logvisor::Module Log("FileStoreManager");
|
|
||||||
FileStoreManager* g_instance = nullptr;
|
FileStoreManager* g_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain) : m_org(org), m_domain(domain) {
|
FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain) : m_org(org), m_domain(domain) {
|
||||||
if (g_instance != nullptr) {
|
if (g_instance != nullptr) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Attempting to build another FileStoreManager!!"));
|
spdlog::fatal("Attempting to build another FileStoreManager!!");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto prefPath = SDL_GetPrefPath(org.data(), domain.data());
|
auto prefPath = SDL_GetPrefPath(org.data(), domain.data());
|
||||||
@ -34,7 +32,7 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain
|
|||||||
#if !WINDOWS_STORE
|
#if !WINDOWS_STORE
|
||||||
WCHAR home[MAX_PATH];
|
WCHAR home[MAX_PATH];
|
||||||
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
|
if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, home)))
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to locate profile for file store"));
|
spdlog::fatal("unable to locate profile for file store");
|
||||||
|
|
||||||
std::string path = nowide::narrow(home);
|
std::string path = nowide::narrow(home);
|
||||||
#else
|
#else
|
||||||
@ -54,18 +52,18 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain
|
|||||||
std::string path;
|
std::string path;
|
||||||
if (xdg_data_home) {
|
if (xdg_data_home) {
|
||||||
if (xdg_data_home[0] != '/')
|
if (xdg_data_home[0] != '/')
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("invalid $XDG_DATA_HOME for file store (must be absolute)"));
|
spdlog::fatal("invalid $XDG_DATA_HOME for file store (must be absolute)");
|
||||||
path = xdg_data_home;
|
path = xdg_data_home;
|
||||||
} else {
|
} else {
|
||||||
const char* home = getenv("HOME");
|
const char* home = getenv("HOME");
|
||||||
if (!home)
|
if (!home)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to locate $HOME for file store"));
|
spdlog::fatal("unable to locate $HOME for file store");
|
||||||
path = home;
|
path = home;
|
||||||
path += "/.local/share";
|
path += "/.local/share";
|
||||||
}
|
}
|
||||||
path += "/" + m_org + "/" + domain.data();
|
path += "/" + m_org + "/" + domain.data();
|
||||||
if (CBasics::RecursiveMakeDir(path.c_str()) != 0) {
|
if (CBasics::RecursiveMakeDir(path.c_str()) != 0) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("unable to mkdir at {}"), path);
|
spdlog::fatal("unable to mkdir at {}", path);
|
||||||
}
|
}
|
||||||
m_storeRoot = path;
|
m_storeRoot = path;
|
||||||
#endif
|
#endif
|
||||||
@ -78,9 +76,8 @@ FileStoreManager::FileStoreManager(std::string_view org, std::string_view domain
|
|||||||
|
|
||||||
FileStoreManager* FileStoreManager::instance() {
|
FileStoreManager* FileStoreManager::instance() {
|
||||||
if (g_instance == nullptr) {
|
if (g_instance == nullptr) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Requested FileStoreManager instance before it's built!"));
|
spdlog::fatal("Requested FileStoreManager instance before it's built!");
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
return g_instance;
|
return g_instance;
|
||||||
}
|
}
|
||||||
} // namespace hecl::Runtime
|
} // namespace metaforce
|
||||||
|
57
Runtime/Formatting.hpp
Normal file
57
Runtime/Formatting.hpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Runtime/RetroTypes.hpp"
|
||||||
|
|
||||||
|
#include <fmt/format.h> // IWYU pragma: export
|
||||||
|
#include <fmt/xchar.h>
|
||||||
|
|
||||||
|
#include <zeus/CMatrix3f.hpp>
|
||||||
|
#include <zeus/CMatrix4f.hpp>
|
||||||
|
#include <zeus/CTransform.hpp>
|
||||||
|
#include <zeus/CVector2f.hpp>
|
||||||
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
||||||
|
#define FMT_CUSTOM_FORMATTER(Type, str, ...) \
|
||||||
|
template <typename CharT> \
|
||||||
|
struct fmt::formatter<Type, CharT> : fmt::formatter<std::basic_string_view<CharT>, CharT> { \
|
||||||
|
template <typename FormatContext> \
|
||||||
|
auto format(const Type& obj, FormatContext& ctx) const -> decltype(ctx.out()) { \
|
||||||
|
if constexpr (std::is_same_v<CharT, char>) { \
|
||||||
|
return fmt::format_to(ctx.out(), str __VA_OPT__(, ) __VA_ARGS__); \
|
||||||
|
} else if constexpr (std::is_same_v<CharT, char16_t>) { \
|
||||||
|
return fmt::format_to(ctx.out(), u##str __VA_OPT__(, ) __VA_ARGS__); \
|
||||||
|
} else { \
|
||||||
|
static_assert(false, "Unsupported character type for formatter"); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
FMT_CUSTOM_FORMATTER(metaforce::CAssetId, "{:08X}", obj.Value());
|
||||||
|
FMT_CUSTOM_FORMATTER(metaforce::FourCC, "{:c}{:c}{:c}{:c}", obj.getChars()[0], obj.getChars()[1], obj.getChars()[2],
|
||||||
|
obj.getChars()[3]);
|
||||||
|
FMT_CUSTOM_FORMATTER(metaforce::SObjectTag, "{} {}", obj.type, obj.id);
|
||||||
|
FMT_CUSTOM_FORMATTER(metaforce::TEditorId, "{:08X}", obj.id);
|
||||||
|
static_assert(sizeof(metaforce::kUniqueIdType) == sizeof(u16),
|
||||||
|
"TUniqueId size does not match expected size! Update TUniqueId format string!");
|
||||||
|
FMT_CUSTOM_FORMATTER(metaforce::TUniqueId, "{:04X}", obj.id);
|
||||||
|
|
||||||
|
FMT_CUSTOM_FORMATTER(zeus::CVector3f, "({} {} {})", obj.x(), obj.y(), obj.z());
|
||||||
|
FMT_CUSTOM_FORMATTER(zeus::CVector2f, "({} {})", obj.x(), obj.y());
|
||||||
|
FMT_CUSTOM_FORMATTER(zeus::CMatrix3f,
|
||||||
|
"\n({} {} {})"
|
||||||
|
"\n({} {} {})"
|
||||||
|
"\n({} {} {})",
|
||||||
|
obj[0][0], obj[1][0], obj[2][0], obj[0][1], obj[1][1], obj[2][1], obj[0][2], obj[1][2], obj[2][2]);
|
||||||
|
FMT_CUSTOM_FORMATTER(zeus::CMatrix4f,
|
||||||
|
"\n({} {} {} {})"
|
||||||
|
"\n({} {} {} {})"
|
||||||
|
"\n({} {} {} {})"
|
||||||
|
"\n({} {} {} {})",
|
||||||
|
obj[0][0], obj[1][0], obj[2][0], obj[3][0], obj[0][1], obj[1][1], obj[2][1], obj[3][1], obj[0][2],
|
||||||
|
obj[1][2], obj[2][2], obj[3][2], obj[0][3], obj[1][3], obj[2][3], obj[3][3]);
|
||||||
|
FMT_CUSTOM_FORMATTER(zeus::CTransform,
|
||||||
|
"\n({} {} {} {})"
|
||||||
|
"\n({} {} {} {})"
|
||||||
|
"\n({} {} {} {})",
|
||||||
|
obj.basis[0][0], obj.basis[1][0], obj.basis[2][0], obj.origin[0], obj.basis[0][1], obj.basis[1][1],
|
||||||
|
obj.basis[2][1], obj.origin[1], obj.basis[0][2], obj.basis[1][2], obj.basis[2][2], obj.origin[2]);
|
@ -147,7 +147,7 @@ void Buckets::Sort() {
|
|||||||
if (bucket.size() < bucket.capacity())
|
if (bucket.size() < bucket.capacity())
|
||||||
bucket.push_back(&drawable);
|
bucket.push_back(&drawable);
|
||||||
// else
|
// else
|
||||||
// Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!"));
|
// spdlog::fatal("Full bucket!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 bucketIdx = u16(sBuckets->size());
|
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,
|
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
||||||
const zeus::CPlane& plane, u16 extraSort) {
|
const zeus::CPlane& plane, u16 extraSort) {
|
||||||
if (sData->size() == sData->capacity()) {
|
if (sData->size() == sData->capacity()) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity"));
|
spdlog::fatal("Rendering buckets filled to capacity");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
#include "Runtime/Particle/CDecal.hpp"
|
#include "Runtime/Particle/CDecal.hpp"
|
||||||
#include "Runtime/Particle/CElementGen.hpp"
|
#include "Runtime/Particle/CElementGen.hpp"
|
||||||
#include "Runtime/CDvdFile.hpp"
|
#include "Runtime/CDvdFile.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace metaforce {
|
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 */
|
/* 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*, 128>;
|
||||||
using BucketHolderType = rstl::reserved_vector<CDrawable*, 132>;
|
using BucketHolderType = rstl::reserved_vector<CDrawable*, 132>;
|
||||||
@ -127,7 +126,7 @@ void Buckets::Sort() {
|
|||||||
bucket.push_back(&drawable);
|
bucket.push_back(&drawable);
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// Log.report(logvisor::Fatal, FMT_STRING("Full bucket!!!"));
|
// spdlog::fatal("Full bucket!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 bucketIdx = u16(sBuckets->size());
|
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,
|
void Buckets::Insert(const zeus::CVector3f& pos, const zeus::CAABox& aabb, EDrawableType dtype, void* data,
|
||||||
const zeus::CPlane& plane, u16 extraSort) {
|
const zeus::CPlane& plane, u16 extraSort) {
|
||||||
if (sData->size() == sData->capacity()) {
|
if (sData->size() == sData->capacity()) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Rendering buckets filled to capacity"));
|
spdlog::fatal("Rendering buckets filled to capacity");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +329,7 @@ void CCubeRenderer::RemoveStaticGeometry(const std::vector<CMetroidModelInstance
|
|||||||
|
|
||||||
void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
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)
|
targetMask)
|
||||||
.c_str(),
|
.c_str(),
|
||||||
zeus::skBlue);
|
zeus::skBlue);
|
||||||
@ -408,7 +407,7 @@ void CCubeRenderer::DrawUnsortedGeometry(s32 areaIdx, s32 mask, s32 targetMask)
|
|||||||
|
|
||||||
void CCubeRenderer::DrawSortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
void CCubeRenderer::DrawSortedGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
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)
|
targetMask)
|
||||||
.c_str(),
|
.c_str(),
|
||||||
zeus::skBlue);
|
zeus::skBlue);
|
||||||
@ -442,7 +441,7 @@ void CCubeRenderer::DrawStaticGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
|||||||
|
|
||||||
void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
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)
|
targetMask)
|
||||||
.c_str(),
|
.c_str(),
|
||||||
zeus::skBlue);
|
zeus::skBlue);
|
||||||
@ -490,7 +489,7 @@ void CCubeRenderer::DrawAreaGeometry(s32 areaIdx, s32 mask, s32 targetMask) {
|
|||||||
|
|
||||||
void CCubeRenderer::RenderBucketItems(const CAreaListItem* item) {
|
void CCubeRenderer::RenderBucketItems(const CAreaListItem* item) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
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;
|
CCubeModel* lastModel = nullptr;
|
||||||
EDrawableType lastDrawableType = EDrawableType::Invalid;
|
EDrawableType lastDrawableType = EDrawableType::Invalid;
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
#include "Runtime/Graphics/CLineRenderer.hpp"
|
#include "Runtime/Graphics/CLineRenderer.hpp"
|
||||||
|
|
||||||
#include "Runtime/Graphics/Shaders/CLineRendererShaders.hpp"
|
#include "Runtime/Graphics/Shaders/CLineRendererShaders.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
logvisor::Module LineRendererLog("metaforce::CLineRenderer");
|
|
||||||
|
|
||||||
void CLineRenderer::Initialize() { CLineRendererShaders::Initialize(); }
|
void CLineRenderer::Initialize() { CLineRendererShaders::Initialize(); }
|
||||||
|
|
||||||
void CLineRenderer::Shutdown() {
|
void CLineRenderer::Shutdown() {
|
||||||
@ -25,7 +22,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, u32 texture,
|
|||||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||||
OPTICK_EVENT();
|
OPTICK_EVENT();
|
||||||
if (maxVerts < 2) {
|
if (maxVerts < 2) {
|
||||||
LineRendererLog.report(logvisor::Fatal, FMT_STRING("maxVerts < 2, maxVerts = {}"), maxVerts);
|
spdlog::fatal("maxVerts < 2, maxVerts = {}", maxVerts);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_textured = bool(texture);
|
m_textured = bool(texture);
|
||||||
|
@ -253,7 +253,7 @@ CBooModel::CBooModel(TToken<CModel>& token, CModel* parent, std::vector<CBooSurf
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (m_instances.size() >= 512) {
|
// 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();
|
// 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));
|
u32 version = CBasics::SwapBytes(*reinterpret_cast<u32*>(data.get() + 0x4));
|
||||||
m_flags = CBasics::SwapBytes(*reinterpret_cast<u32*>(data.get() + 0x8));
|
m_flags = CBasics::SwapBytes(*reinterpret_cast<u32*>(data.get() + 0x8));
|
||||||
if (version != 0x10002) {
|
if (version != 0x10002) {
|
||||||
Log.report(logvisor::Error, FMT_STRING("invalid CMDL for loading with boo"));
|
spdlog::error("invalid CMDL for loading with boo");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,24 +306,24 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||||||
// if (deinterlace) {
|
// if (deinterlace) {
|
||||||
// /* metaforce addition: this way interlaced THPs don't look horrible */
|
// /* 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,
|
// 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));
|
// i));
|
||||||
// set.Y[1] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
// 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));
|
// i));
|
||||||
// set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
// 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,
|
// 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 {
|
// } else {
|
||||||
// /* normal progressive presentation */
|
// /* normal progressive presentation */
|
||||||
// set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height, 1, GX_TF_I8,
|
// 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));
|
// i));
|
||||||
// set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
// 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,
|
// 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)
|
if (xf4_25_hasAudio)
|
||||||
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);
|
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);
|
||||||
|
@ -3,13 +3,11 @@
|
|||||||
#include "Runtime/Character/CSkinRules.hpp"
|
#include "Runtime/Character/CSkinRules.hpp"
|
||||||
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
||||||
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
|
#include "Runtime/Graphics/CVertexMorphEffect.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CSkinnedModel");
|
|
||||||
|
|
||||||
CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules,
|
CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules,
|
||||||
const TLockedToken<CCharLayoutInfo>& layoutInfo)
|
const TLockedToken<CCharLayoutInfo>& layoutInfo)
|
||||||
: x4_model(std::move(model))
|
: x4_model(std::move(model))
|
||||||
@ -17,13 +15,13 @@ CSkinnedModel::CSkinnedModel(const TLockedToken<CModel>& model, const TLockedTok
|
|||||||
, x1c_layoutInfo(std::move(layoutInfo))
|
, x1c_layoutInfo(std::move(layoutInfo))
|
||||||
, m_workspace(*x10_skinRules) {
|
, m_workspace(*x10_skinRules) {
|
||||||
if (!x4_model) {
|
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) {
|
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) {
|
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 "Graphics/GX.hpp"
|
||||||
#include "RetroTypes.hpp"
|
#include "RetroTypes.hpp"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
enum class ERglTevStage : std::underlying_type_t<GXTevStageID> {
|
enum class ERglTevStage : std::underlying_type_t<GXTevStageID> {
|
||||||
Stage0 = GX_TEVSTAGE0,
|
Stage0 = GX_TEVSTAGE0,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "Graphics/CTexture.hpp"
|
#include "Graphics/CTexture.hpp"
|
||||||
|
|
||||||
#include "CToken.hpp"
|
#include "Runtime/CToken.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include <zeus/Math.hpp>
|
#include <zeus/Math.hpp>
|
||||||
#include <magic_enum.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)
|
, x8_mips(mips)
|
||||||
, x9_bitsPerPixel(TexelFormatBitsPerPixel(fmt))
|
, x9_bitsPerPixel(TexelFormatBitsPerPixel(fmt))
|
||||||
, x64_frameAllocated(sCurrentFrameCount)
|
, 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);
|
InitBitmapBuffers(fmt, w, h, mips);
|
||||||
InitTextureObjs();
|
InitTextureObjs();
|
||||||
}
|
}
|
||||||
@ -26,7 +27,7 @@ CTexture::CTexture(CInputStream& in, std::string_view label, EAutoMipmap automip
|
|||||||
, x6_h(in.ReadShort())
|
, x6_h(in.ReadShort())
|
||||||
, x8_mips(in.ReadLong())
|
, x8_mips(in.ReadLong())
|
||||||
, x64_frameAllocated(sCurrentFrameCount)
|
, 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);
|
bool hasPalette = (x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2);
|
||||||
if (hasPalette) {
|
if (hasPalette) {
|
||||||
x10_graphicsPalette = std::make_unique<CGraphicsPalette>(in);
|
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,
|
CFactoryFnReturn FTextureFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms,
|
||||||
CObjectReference* selfRef) {
|
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));
|
return TToken<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(in, label));
|
||||||
}
|
}
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
@ -358,7 +358,7 @@ void CTexture::BuildC8FromGCN(CInputStream& in, aurora::zstring_view label) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CTexture::BuildC14X2FromGCN(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) {
|
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 texelCount = ComputeMippedTexelCount();
|
||||||
size_t expectedSize = texelCount * 4;
|
size_t expectedSize = texelCount * 4;
|
||||||
if (expectedSize > length)
|
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,
|
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);
|
{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) {
|
void CTexture::BuildC8(const void* data, size_t length, aurora::zstring_view label) {
|
||||||
size_t texelCount = ComputeMippedTexelCount();
|
size_t texelCount = ComputeMippedTexelCount();
|
||||||
if (texelCount > length)
|
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));
|
uint32_t nentries = CBasics::SwapBytes(*reinterpret_cast<const uint32_t*>(data));
|
||||||
const u8* paletteTexels = reinterpret_cast<const u8*>(data) + 4;
|
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);
|
x9_bitsPerPixel = TexelFormatBitsPerPixel(x0_fmt);
|
||||||
m_textureInfo = inf;
|
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) {
|
switch (x0_fmt) {
|
||||||
case ETexelFormat::I4:
|
case ETexelFormat::I4:
|
||||||
BuildI4FromGCN(r, label);
|
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()) {
|
if (aurora::gfx::get_dxt_compression_supported()) {
|
||||||
BuildDXT1FromGCN(r, label);
|
BuildDXT1FromGCN(r, label);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Error, FMT_STRING("BC/DXT1 compression is not supported on your GPU, unable to load {}"),
|
spdlog::error("BC/DXT1 compression is not supported on your GPU, unable to load {}", label);
|
||||||
label);
|
|
||||||
x0_fmt = ETexelFormat::RGBA8PC;
|
x0_fmt = ETexelFormat::RGBA8PC;
|
||||||
x8_mips = 1;
|
x8_mips = 1;
|
||||||
std::unique_ptr<u8[]> data = std::make_unique<u8[]>(x4_w * x6_h * 4);
|
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);
|
BuildDXT3(owned.get() + 12, length - 12, label);
|
||||||
break;
|
break;
|
||||||
default:
|
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)
|
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[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut,
|
||||||
std::unique_ptr<u8[]>& paletteOut) const {
|
std::unique_ptr<u8[]>& paletteOut) const {
|
||||||
if (!m_otex)
|
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;
|
size_t texelCount = x4_w * x6_h;
|
||||||
std::unique_ptr<u8[]> ret;
|
std::unique_ptr<u8[]> ret;
|
||||||
@ -914,7 +913,7 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} 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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) {
|
|||||||
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) {
|
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CAuiImagePane::Draw {}", m_name).c_str(), zeus::skCyan);
|
||||||
GetIsFinishedLoadingWidgetSpecific();
|
GetIsFinishedLoadingWidgetSpecific();
|
||||||
zeus::CColor color = xa8_color2;
|
zeus::CColor color = xa8_color2;
|
||||||
color.a() *= params.x0_alphaMod;
|
color.a() *= params.x0_alphaMod;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
#include "Runtime/World/CScriptGrapplePoint.hpp"
|
#include "Runtime/World/CScriptGrapplePoint.hpp"
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
|
|||||||
, x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) {
|
, x208_lockonTimer(g_tweakTargeting->GetLockonDuration()) {
|
||||||
xe0_outerBeamIconSquares.reserve(9);
|
xe0_outerBeamIconSquares.reserve(9);
|
||||||
for (size_t i = 0; i < xe0_outerBeamIconSquares.capacity(); ++i) {
|
for (size_t i = 0; i < xe0_outerBeamIconSquares.capacity(); ++i) {
|
||||||
xe0_outerBeamIconSquares.emplace_back(fmt::format(FMT_STRING("{}{}"), skOuterBeamIconSquareNameBase, i));
|
xe0_outerBeamIconSquares.emplace_back(fmt::format("{}{}", skOuterBeamIconSquareNameBase, i));
|
||||||
}
|
}
|
||||||
x34_crosshairs.Lock();
|
x34_crosshairs.Lock();
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ void CGuiFrame::Reset() { x10_rootWidget->Reset(ETraversalMode::Children); }
|
|||||||
void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
|
void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
|
||||||
|
|
||||||
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
|
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CGuiFrame::Draw FRME_{}", x0_id).c_str(), zeus::skMagenta);
|
||||||
CGraphics::SetCullMode(ERglCullMode::None);
|
CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
CGraphics::ResetGfxStates();
|
CGraphics::ResetGfxStates();
|
||||||
CGraphics::SetAmbientColor(zeus::skWhite);
|
CGraphics::SetAmbientColor(zeus::skWhite);
|
||||||
|
@ -47,7 +47,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GetIsVisible()) {
|
if (GetIsVisible()) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CGuiModel::Draw {}", m_name).c_str(), zeus::skCyan);
|
||||||
zeus::CColor moduCol = xa8_color2;
|
zeus::CColor moduCol = xa8_color2;
|
||||||
moduCol.a() *= parms.x0_alphaMod;
|
moduCol.a() *= parms.x0_alphaMod;
|
||||||
xb0_frame->EnableLights(xcc_lightMask);
|
xb0_frame->EnableLights(xcc_lightMask);
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <zeus/CTransform.hpp>
|
#include <zeus/CTransform.hpp>
|
||||||
#include <zeus/CVector3f.hpp>
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
struct CGuiWidgetDrawParms;
|
struct CGuiWidgetDrawParms;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) {
|
|||||||
if (!GetIsVisible()) {
|
if (!GetIsVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiTextPane::Draw {}"), m_name).c_str(), zeus::skCyan);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CGuiTextPane::Draw {}", m_name).c_str(), zeus::skCyan);
|
||||||
|
|
||||||
zeus::CVector2f dims = GetDimensions();
|
zeus::CVector2f dims = GetDimensions();
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
|
#include "Runtime/GuiSys/CGuiTextSupport.hpp"
|
||||||
|
|
||||||
#include <fmt/xchar.h>
|
|
||||||
|
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/Graphics/CGraphics.hpp"
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
#include "Runtime/Graphics/CGraphicsPalette.hpp"
|
#include "Runtime/Graphics/CGraphicsPalette.hpp"
|
||||||
@ -11,6 +9,7 @@
|
|||||||
#include "Runtime/GuiSys/CTextExecuteBuffer.hpp"
|
#include "Runtime/GuiSys/CTextExecuteBuffer.hpp"
|
||||||
#include "Runtime/GuiSys/CTextParser.hpp"
|
#include "Runtime/GuiSys/CTextParser.hpp"
|
||||||
#include "Runtime/CStringExtras.hpp"
|
#include "Runtime/CStringExtras.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -178,7 +177,7 @@ void CGuiTextSupport::CheckAndRebuildTextBuffer() {
|
|||||||
|
|
||||||
std::u16string initStr;
|
std::u16string initStr;
|
||||||
if (x5c_fontId.IsValid())
|
if (x5c_fontId.IsValid())
|
||||||
initStr = fmt::format(FMT_STRING(u"&font={};"), x5c_fontId);
|
initStr = fmt::format(u"&font={};", x5c_fontId);
|
||||||
initStr += x0_string;
|
initStr += x0_string;
|
||||||
|
|
||||||
g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size(), x14_props.xc_txtrMap);
|
g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size(), x14_props.xc_txtrMap);
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
#include "Runtime/Graphics/CGraphics.hpp"
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
#include "Runtime/GuiSys/CGuiWidget.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CGuiWidget");
|
|
||||||
|
|
||||||
CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
|
CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
|
||||||
: x70_selfId(parms.x6_selfId)
|
: x70_selfId(parms.x6_selfId)
|
||||||
, x72_parentId(parms.x8_parentId)
|
, x72_parentId(parms.x8_parentId)
|
||||||
@ -64,8 +61,7 @@ void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWid
|
|||||||
in.ReadShort();
|
in.ReadShort();
|
||||||
if (isWorker) {
|
if (isWorker) {
|
||||||
if (!parent->AddWorkerWidget(this)) {
|
if (!parent->AddWorkerWidget(this)) {
|
||||||
Log.report(logvisor::Warning,
|
spdlog::warn("Warning: Discarding useless worker id. Parent is not a compound widget.");
|
||||||
FMT_STRING("Warning: Discarding useless worker id. Parent is not a compound widget."));
|
|
||||||
xb4_workerId = -1;
|
xb4_workerId = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "Runtime/GuiSys/CGuiGroup.hpp"
|
#include "Runtime/GuiSys/CGuiGroup.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiModel.hpp"
|
#include "Runtime/GuiSys/CGuiModel.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ CHudBallInterface::CHudBallInterface(CGuiFrame& selHud, int pbAmount, int pbCapa
|
|||||||
xc_model_bombicon = static_cast<CGuiModel*>(selHud.FindWidget("model_bombicon"));
|
xc_model_bombicon = static_cast<CGuiModel*>(selHud.FindWidget("model_bombicon"));
|
||||||
x10_textpane_bombdigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_bombdigits"));
|
x10_textpane_bombdigits = static_cast<CGuiTextPane*>(selHud.FindWidget("textpane_bombdigits"));
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
CGuiGroup* grp = static_cast<CGuiGroup*>(selHud.FindWidget(fmt::format(FMT_STRING("group_bombcount{}"), i)));
|
CGuiGroup* grp = static_cast<CGuiGroup*>(selHud.FindWidget(fmt::format("group_bombcount{}", i)));
|
||||||
CGuiWidget* filled = grp->GetWorkerWidget(1);
|
CGuiWidget* filled = grp->GetWorkerWidget(1);
|
||||||
CGuiWidget* empty = grp->GetWorkerWidget(0);
|
CGuiWidget* empty = grp->GetWorkerWidget(0);
|
||||||
x14_group_bombfilled.push_back(filled);
|
x14_group_bombfilled.push_back(filled);
|
||||||
@ -65,7 +66,7 @@ void CHudBallInterface::UpdatePowerBombReadoutColors() {
|
|||||||
void CHudBallInterface::SetBombParams(int pbAmount, int pbCapacity, int availableBombs, bool hasBombs, bool hasPb,
|
void CHudBallInterface::SetBombParams(int pbAmount, int pbCapacity, int availableBombs, bool hasBombs, bool hasPb,
|
||||||
bool init) {
|
bool init) {
|
||||||
if (pbAmount != x40_pbAmount || init) {
|
if (pbAmount != x40_pbAmount || init) {
|
||||||
x10_textpane_bombdigits->TextSupport().SetText(fmt::format(FMT_STRING("{:02d}"), pbAmount));
|
x10_textpane_bombdigits->TextSupport().SetText(fmt::format("{:02d}", pbAmount));
|
||||||
x40_pbAmount = pbAmount;
|
x40_pbAmount = pbAmount;
|
||||||
UpdatePowerBombReadoutColors();
|
UpdatePowerBombReadoutColors();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
||||||
#include "Runtime/GuiSys/CStringTable.hpp"
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse) {
|
|||||||
x1c_26_barDirty = false;
|
x1c_26_barDirty = false;
|
||||||
x18_cachedBarEnergy = x2c_energybart01_energybar->GetFilledEnergy();
|
x18_cachedBarEnergy = x2c_energybart01_energybar->GetFilledEnergy();
|
||||||
std::string string =
|
std::string string =
|
||||||
fmt::format(FMT_STRING("{:02d}"), int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity())));
|
fmt::format("{:02d}", int(std::fmod(x18_cachedBarEnergy, CPlayerState::GetEnergyTankCapacity())));
|
||||||
x20_textpane_energydigits->TextSupport().SetText(string);
|
x20_textpane_energydigits->TextSupport().SetText(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Runtime/GuiSys/CGuiModel.hpp"
|
#include "Runtime/GuiSys/CGuiModel.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
||||||
#include "Runtime/GuiSys/CStringTable.hpp"
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -214,7 +215,7 @@ void CHudMissileInterface::SetChargeBeamFactor(float t) { x4c_chargeBeamFactor =
|
|||||||
void CHudMissileInterface::SetNumMissiles(int numMissiles, const CStateManager& mgr) {
|
void CHudMissileInterface::SetNumMissiles(int numMissiles, const CStateManager& mgr) {
|
||||||
numMissiles = zeus::clamp(0, numMissiles, 999);
|
numMissiles = zeus::clamp(0, numMissiles, 999);
|
||||||
|
|
||||||
x60_textpane_missiledigits->TextSupport().SetText(fmt::format(FMT_STRING("{:3d}"), numMissiles));
|
x60_textpane_missiledigits->TextSupport().SetText(fmt::format("{:3d}", numMissiles));
|
||||||
|
|
||||||
if (x8_numMissles < numMissiles) {
|
if (x8_numMissles < numMissiles) {
|
||||||
xc_arrowTimer = g_tweakGui->GetMissileArrowVisTime();
|
xc_arrowTimer = g_tweakGui->GetMissileArrowVisTime();
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
||||||
#include "Runtime/GuiSys/CStringTable.hpp"
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
||||||
#include "Runtime/Audio/CSfxManager.hpp"
|
#include "Runtime/Audio/CSfxManager.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ void CHudThreatInterface::Update(float dt) {
|
|||||||
if (x10_threatDist < maxThreatEnergy) {
|
if (x10_threatDist < maxThreatEnergy) {
|
||||||
x70_textpane_threatdigits->SetIsVisible(true);
|
x70_textpane_threatdigits->SetIsVisible(true);
|
||||||
x70_textpane_threatdigits->TextSupport().SetText(
|
x70_textpane_threatdigits->TextSupport().SetText(
|
||||||
fmt::format(FMT_STRING("{:01.1f}"), std::max(0.f, x10_threatDist)));
|
fmt::format("{:01.1f}", std::max(0.f, x10_threatDist)));
|
||||||
} else {
|
} else {
|
||||||
x70_textpane_threatdigits->SetIsVisible(false);
|
x70_textpane_threatdigits->SetIsVisible(false);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Runtime/GuiSys/CGuiModel.hpp"
|
#include "Runtime/GuiSys/CGuiModel.hpp"
|
||||||
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
||||||
#include "Runtime/GuiSys/CStringTable.hpp"
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type,
|
|||||||
x18_basewidget_menu = x0_baseHud.FindWidget(BaseMenuNames[size_t(swappedType)]);
|
x18_basewidget_menu = x0_baseHud.FindWidget(BaseMenuNames[size_t(swappedType)]);
|
||||||
|
|
||||||
x24_model_ghost =
|
x24_model_ghost =
|
||||||
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}ghost"), ModelNames[size_t(x4_type)])));
|
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format("{}ghost", ModelNames[size_t(x4_type)])));
|
||||||
|
|
||||||
x28_menuItems.resize(4);
|
x28_menuItems.resize(4);
|
||||||
for (size_t i = 0; i < x28_menuItems.size(); i++) {
|
for (size_t i = 0; i < x28_menuItems.size(); i++) {
|
||||||
@ -73,9 +74,9 @@ CHudVisorBeamMenu::CHudVisorBeamMenu(CGuiFrame& baseHud, EHudVisorBeamMenu type,
|
|||||||
|
|
||||||
SMenuItem& item = x28_menuItems[i];
|
SMenuItem& item = x28_menuItems[i];
|
||||||
item.x0_model_loz =
|
item.x0_model_loz =
|
||||||
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}loz{}"), modelName, menuItemOrder)));
|
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format("{}loz{}", modelName, menuItemOrder)));
|
||||||
item.x4_model_icon =
|
item.x4_model_icon =
|
||||||
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format(FMT_STRING("{}icon{}"), modelName, menuItemOrder)));
|
static_cast<CGuiModel*>(x0_baseHud.FindWidget(fmt::format("{}icon{}", modelName, menuItemOrder)));
|
||||||
item.xc_opacity = enables[i] ? 1.f : 0.f;
|
item.xc_opacity = enables[i] ? 1.f : 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
#include <nfd.hpp>
|
#include <nfd.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdarg>
|
#include "Runtime/Logging.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include <zeus/CEulerAngles.hpp>
|
#include <zeus/CEulerAngles.hpp>
|
||||||
|
|
||||||
@ -44,8 +45,6 @@ extern size_t g_lastStorageSize;
|
|||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log{"Console"};
|
|
||||||
|
|
||||||
std::array<ImGuiEntityEntry, kMaxEntities> ImGuiConsole::entities;
|
std::array<ImGuiEntityEntry, kMaxEntities> ImGuiConsole::entities;
|
||||||
std::set<TUniqueId> ImGuiConsole::inspectingEntities;
|
std::set<TUniqueId> ImGuiConsole::inspectingEntities;
|
||||||
ImGuiPlayerLoadouts ImGuiConsole::loadouts;
|
ImGuiPlayerLoadouts ImGuiConsole::loadouts;
|
||||||
@ -235,7 +234,7 @@ void ImGuiConsole::BeginEntityRow(const ImGuiEntityEntry& entry) {
|
|||||||
ImGui::PushStyleColor(ImGuiCol_Text, textColor);
|
ImGui::PushStyleColor(ImGuiCol_Text, textColor);
|
||||||
|
|
||||||
if (ImGui::TableNextColumn()) {
|
if (ImGui::TableNextColumn()) {
|
||||||
auto text = fmt::format(FMT_STRING("0x{:04X}"), entry.uid.Value());
|
auto text = fmt::format("0x{:04X}", entry.uid.Value());
|
||||||
ImGui::Selectable(text.c_str(), &entry.ent->m_debugSelected,
|
ImGui::Selectable(text.c_str(), &entry.ent->m_debugSelected,
|
||||||
ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap);
|
ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap);
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
@ -396,7 +395,7 @@ bool ImGuiConsole::ShowEntityInfoWindow(TUniqueId uid) {
|
|||||||
if (entry.ent == nullptr) {
|
if (entry.ent == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto name = fmt::format(FMT_STRING("{}##0x{:04X}"), !entry.name.empty() ? entry.name : entry.type, uid.Value());
|
auto name = fmt::format("{}##0x{:04X}", !entry.name.empty() ? entry.name : entry.type, uid.Value());
|
||||||
if (ImGui::Begin(name.c_str(), &open, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::Begin(name.c_str(), &open, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
ImGui::PushID(uid.Value());
|
ImGui::PushID(uid.Value());
|
||||||
entry.ent->ImGuiInspect();
|
entry.ent->ImGuiInspect();
|
||||||
@ -699,7 +698,7 @@ void ImGuiConsole::ShowAboutWindow(bool preLaunch) {
|
|||||||
if (nfdResult == NFD_OKAY) {
|
if (nfdResult == NFD_OKAY) {
|
||||||
m_gameDiscSelected = outPath.get();
|
m_gameDiscSelected = outPath.get();
|
||||||
} else if (nfdResult != NFD_CANCEL) {
|
} else if (nfdResult != NFD_CANCEL) {
|
||||||
Log.report(logvisor::Error, FMT_STRING("nativefiledialog error: {}"), NFD::GetError());
|
spdlog::error("nativefiledialog error: {}", NFD::GetError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -807,9 +806,9 @@ static std::string BytesToString(size_t bytes) {
|
|||||||
count /= 1024.0;
|
count /= 1024.0;
|
||||||
}
|
}
|
||||||
if (count - floor(count) == 0.0) {
|
if (count - floor(count) == 0.0) {
|
||||||
return fmt::format(FMT_STRING("{}{}"), static_cast<size_t>(count), suffixes[s]);
|
return fmt::format("{}{}", static_cast<size_t>(count), suffixes[s]);
|
||||||
}
|
}
|
||||||
return fmt::format(FMT_STRING("{:.1f}{}"), count, suffixes[s]);
|
return fmt::format("{:.1f}{}", count, suffixes[s]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiConsole::ShowDebugOverlay() {
|
void ImGuiConsole::ShowDebugOverlay() {
|
||||||
@ -831,7 +830,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
if (ImGui::Begin("Debug Overlay", nullptr, windowFlags)) {
|
if (ImGui::Begin("Debug Overlay", nullptr, windowFlags)) {
|
||||||
bool hasPrevious = false;
|
bool hasPrevious = false;
|
||||||
if (m_frameCounter && g_StateManager != nullptr) {
|
if (m_frameCounter && g_StateManager != nullptr) {
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Frame: {}\n"), g_StateManager->GetUpdateFrameIndex()));
|
ImGuiStringViewText(fmt::format("Frame: {}\n", g_StateManager->GetUpdateFrameIndex()));
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
}
|
}
|
||||||
if (m_frameRate) {
|
if (m_frameRate) {
|
||||||
@ -840,7 +839,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("FPS: {:.1f}\n"), io.Framerate));
|
ImGuiStringViewText(fmt::format("FPS: {:.1f}\n", io.Framerate));
|
||||||
}
|
}
|
||||||
if (m_inGameTime && g_GameState != nullptr) {
|
if (m_inGameTime && g_GameState != nullptr) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -852,7 +851,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
u32 ms = u64(igt * 1000) % 1000;
|
u32 ms = u64(igt * 1000) % 1000;
|
||||||
auto pt = std::div(int(igt), 3600);
|
auto pt = std::div(int(igt), 3600);
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(
|
||||||
fmt::format(FMT_STRING("Play Time: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms));
|
fmt::format("Play Time: {:02d}:{:02d}:{:02d}.{:03d}\n", pt.quot, pt.rem / 60, pt.rem % 60, ms));
|
||||||
}
|
}
|
||||||
if (m_roomTimer && g_StateManager != nullptr) {
|
if (m_roomTimer && g_StateManager != nullptr) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -864,8 +863,8 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
double currentRoomTime = igt - m_currentRoomStart;
|
double currentRoomTime = igt - m_currentRoomStart;
|
||||||
u32 curFrames = u32(std::round(u32(currentRoomTime * 60)));
|
u32 curFrames = u32(std::round(u32(currentRoomTime * 60)));
|
||||||
u32 lastFrames = u32(std::round(u32(m_lastRoomTime * 60)));
|
u32 lastFrames = u32(std::round(u32(m_lastRoomTime * 60)));
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Room Time: {:7.3f} / {:5d} | Last Room:{:7.3f} / {:5d}\n"),
|
ImGuiStringViewText(fmt::format("Room Time: {:7.3f} / {:5d} | Last Room:{:7.3f} / {:5d}\n", currentRoomTime,
|
||||||
currentRoomTime, curFrames, m_lastRoomTime, lastFrames));
|
curFrames, m_lastRoomTime, lastFrames));
|
||||||
}
|
}
|
||||||
if (m_playerInfo && g_StateManager != nullptr && g_StateManager->Player() != nullptr && m_developer) {
|
if (m_playerInfo && g_StateManager != nullptr && g_StateManager->Player() != nullptr && m_developer) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -878,12 +877,12 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
|
const zeus::CTransform camXf = g_StateManager->GetCameraManager()->GetCurrentCameraTransform(*g_StateManager);
|
||||||
const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
|
const zeus::CQuaternion camQ = zeus::CQuaternion(camXf.getRotation().buildMatrix3f());
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(
|
||||||
fmt::format(FMT_STRING("Player Position x: {: .2f}, y: {: .2f}, z: {: .2f}\n"
|
fmt::format("Player Position x: {: .2f}, y: {: .2f}, z: {: .2f}\n"
|
||||||
" Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n"
|
" Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n"
|
||||||
" Momentum x: {: .2f}, y: {: .2f}, z: {: .2f}\n"
|
" Momentum x: {: .2f}, y: {: .2f}, z: {: .2f}\n"
|
||||||
" Velocity x: {: .2f}, y: {: .2f}, z: {: .2f}\n"
|
" Velocity x: {: .2f}, y: {: .2f}, z: {: .2f}\n"
|
||||||
"Camera Position x: {: .2f}, y: {: .2f}, z {: .2f}\n"
|
"Camera Position x: {: .2f}, y: {: .2f}, z {: .2f}\n"
|
||||||
" Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n"),
|
" Roll: {: .2f}, Pitch: {: .2f}, Yaw: {: .2f}\n",
|
||||||
pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(),
|
pl.GetTranslation().x(), pl.GetTranslation().y(), pl.GetTranslation().z(),
|
||||||
zeus::radToDeg(plQ.roll()), zeus::radToDeg(plQ.pitch()), zeus::radToDeg(plQ.yaw()),
|
zeus::radToDeg(plQ.roll()), zeus::radToDeg(plQ.pitch()), zeus::radToDeg(plQ.yaw()),
|
||||||
pl.GetMomentum().x(), pl.GetMomentum().y(), pl.GetMomentum().z(), pl.GetVelocity().x(),
|
pl.GetMomentum().x(), pl.GetMomentum().y(), pl.GetMomentum().z(), pl.GetVelocity().x(),
|
||||||
@ -897,8 +896,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
const std::string name = ImGuiLoadStringTable(g_StateManager->GetWorld()->IGetStringTableAssetId(), 0);
|
const std::string name = ImGuiLoadStringTable(g_StateManager->GetWorld()->IGetStringTableAssetId(), 0);
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(fmt::format("World Asset ID: 0x{}, Name: {}\n", g_GameState->CurrentWorldAssetId(), name));
|
||||||
fmt::format(FMT_STRING("World Asset ID: 0x{}, Name: {}\n"), g_GameState->CurrentWorldAssetId(), name));
|
|
||||||
}
|
}
|
||||||
if (m_areaInfo && g_StateManager != nullptr && m_developer) {
|
if (m_areaInfo && g_StateManager != nullptr && m_developer) {
|
||||||
const metaforce::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId();
|
const metaforce::TAreaId aId = g_GameState->CurrentWorldState().GetCurrentAreaId();
|
||||||
@ -921,9 +919,9 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
CGameArea* pArea = g_StateManager->GetWorld()->GetArea(aId);
|
CGameArea* pArea = g_StateManager->GetWorld()->GetArea(aId);
|
||||||
CAssetId stringId = pArea->IGetStringTableAssetId();
|
CAssetId stringId = pArea->IGetStringTableAssetId();
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(fmt::format("Area Asset ID: 0x{}, Name: {}\nArea ID: {}, Active Layer bits: {}\n",
|
||||||
fmt::format(FMT_STRING("Area Asset ID: 0x{}, Name: {}\nArea ID: {}, Active Layer bits: {}\n"),
|
pArea->GetAreaAssetId(), ImGuiLoadStringTable(stringId, 0), pArea->GetAreaId(),
|
||||||
pArea->GetAreaAssetId(), ImGuiLoadStringTable(stringId, 0), pArea->GetAreaId(), layerBits));
|
layerBits));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_layerInfo && g_StateManager != nullptr && m_developer) {
|
if (m_layerInfo && g_StateManager != nullptr && m_developer) {
|
||||||
@ -962,9 +960,8 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(fmt::format("CRandom16::Next calls: {}\n", metaforce::CRandom16::GetNumNextCalls()));
|
||||||
fmt::format(FMT_STRING("CRandom16::Next calls: {}\n"), metaforce::CRandom16::GetNumNextCalls()));
|
ImGuiStringViewText(fmt::format("CRandom16::LastSeed: 0x{:08X}\n", CRandom16::GetLastSeed()));
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("CRandom16::LastSeed: 0x{:08X}\n"), CRandom16::GetLastSeed()));
|
|
||||||
}
|
}
|
||||||
if (m_resourceStats && g_SimplePool != nullptr) {
|
if (m_resourceStats && g_SimplePool != nullptr) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -972,7 +969,7 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Resource Objects: {}\n"), g_SimplePool->GetLiveObjects()));
|
ImGuiStringViewText(fmt::format("Resource Objects: {}\n", g_SimplePool->GetLiveObjects()));
|
||||||
}
|
}
|
||||||
if (m_pipelineInfo && m_developer) {
|
if (m_pipelineInfo && m_developer) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -980,8 +977,8 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Queued pipelines: {}\n"), aurora::gfx::queuedPipelines));
|
ImGuiStringViewText(fmt::format("Queued pipelines: {}\n", aurora::gfx::queuedPipelines.load()));
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Done pipelines: {}\n"), aurora::gfx::createdPipelines));
|
ImGuiStringViewText(fmt::format("Done pipelines: {}\n", aurora::gfx::createdPipelines.load()));
|
||||||
}
|
}
|
||||||
if (m_drawCallInfo && m_developer) {
|
if (m_drawCallInfo && m_developer) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -989,8 +986,8 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Draw call count: {}\n"), aurora::gfx::g_drawCallCount));
|
ImGuiStringViewText(fmt::format("Draw call count: {}\n", aurora::gfx::g_drawCallCount));
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"), aurora::gfx::g_mergedDrawCallCount));
|
ImGuiStringViewText(fmt::format("Merged draw calls: {}\n", aurora::gfx::g_mergedDrawCallCount));
|
||||||
}
|
}
|
||||||
if (m_bufferInfo && m_developer) {
|
if (m_bufferInfo && m_developer) {
|
||||||
if (hasPrevious) {
|
if (hasPrevious) {
|
||||||
@ -998,15 +995,11 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||||||
}
|
}
|
||||||
hasPrevious = true;
|
hasPrevious = true;
|
||||||
|
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(fmt::format("Vertex size: {}\n", BytesToString(aurora::gfx::g_lastVertSize)));
|
||||||
fmt::format(FMT_STRING("Vertex size: {}\n"), BytesToString(aurora::gfx::g_lastVertSize)));
|
ImGuiStringViewText(fmt::format("Uniform size: {}\n", BytesToString(aurora::gfx::g_lastUniformSize)));
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(fmt::format("Index size: {}\n", BytesToString(aurora::gfx::g_lastIndexSize)));
|
||||||
fmt::format(FMT_STRING("Uniform size: {}\n"), BytesToString(aurora::gfx::g_lastUniformSize)));
|
ImGuiStringViewText(fmt::format("Storage size: {}\n", BytesToString(aurora::gfx::g_lastStorageSize)));
|
||||||
ImGuiStringViewText(
|
ImGuiStringViewText(fmt::format("Total: {}\n",
|
||||||
fmt::format(FMT_STRING("Index size: {}\n"), BytesToString(aurora::gfx::g_lastIndexSize)));
|
|
||||||
ImGuiStringViewText(
|
|
||||||
fmt::format(FMT_STRING("Storage size: {}\n"), BytesToString(aurora::gfx::g_lastStorageSize)));
|
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Total: {}\n"),
|
|
||||||
BytesToString(aurora::gfx::g_lastVertSize + aurora::gfx::g_lastUniformSize +
|
BytesToString(aurora::gfx::g_lastVertSize + aurora::gfx::g_lastUniformSize +
|
||||||
aurora::gfx::g_lastIndexSize + aurora::gfx::g_lastStorageSize)));
|
aurora::gfx::g_lastIndexSize + aurora::gfx::g_lastStorageSize)));
|
||||||
}
|
}
|
||||||
@ -1858,7 +1851,7 @@ void ImGuiConsole::ShowPipelineProgress() {
|
|||||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
|
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
|
||||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing);
|
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing);
|
||||||
const auto percent = static_cast<float>(createdPipelines) / static_cast<float>(totalPipelines);
|
const auto percent = static_cast<float>(createdPipelines) / static_cast<float>(totalPipelines);
|
||||||
const auto progressStr = fmt::format(FMT_STRING("Processing pipelines: {} / {}"), createdPipelines, totalPipelines);
|
const auto progressStr = fmt::format("Processing pipelines: {} / {}", createdPipelines, totalPipelines);
|
||||||
const auto textSize = ImGui::CalcTextSize(progressStr.data(), progressStr.data() + progressStr.size());
|
const auto textSize = ImGui::CalcTextSize(progressStr.data(), progressStr.data() + progressStr.size());
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
ImGui::SameLine(ImGui::GetWindowWidth() / 2.f - textSize.x + textSize.x / 2.f);
|
ImGui::SameLine(ImGui::GetWindowWidth() / 2.f - textSize.x + textSize.x / 2.f);
|
||||||
@ -1870,14 +1863,14 @@ void ImGuiConsole::ShowPipelineProgress() {
|
|||||||
void ImGuiConsole::ControllerAdded(uint32_t idx) {
|
void ImGuiConsole::ControllerAdded(uint32_t idx) {
|
||||||
const char* name = PADGetName(idx);
|
const char* name = PADGetName(idx);
|
||||||
if (name != nullptr) {
|
if (name != nullptr) {
|
||||||
m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} ({}) connected"), idx, name), 5.f);
|
m_toasts.emplace_back(fmt::format("Controller {} ({}) connected", idx, name), 5.f);
|
||||||
} else {
|
} else {
|
||||||
m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} connected"), idx), 5.f);
|
m_toasts.emplace_back(fmt::format("Controller {} connected", idx), 5.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiConsole::ControllerRemoved(uint32_t idx) {
|
void ImGuiConsole::ControllerRemoved(uint32_t idx) {
|
||||||
m_toasts.emplace_back(fmt::format(FMT_STRING("Controller {} disconnected"), idx), 5.f);
|
m_toasts.emplace_back(fmt::format("Controller {} disconnected", idx), 5.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ImGuiCVarCheckbox(CVarManager& mgr, std::string_view cvarName, const char* label, bool* ptr = nullptr) {
|
static void ImGuiCVarCheckbox(CVarManager& mgr, std::string_view cvarName, const char* label, bool* ptr = nullptr) {
|
||||||
@ -1910,7 +1903,7 @@ void ImGuiConsole::ShowPreLaunchSettingsWindow() {
|
|||||||
if (ImGui::BeginTabItem("Graphics")) {
|
if (ImGui::BeginTabItem("Graphics")) {
|
||||||
size_t backendCount = 0;
|
size_t backendCount = 0;
|
||||||
const auto* backends = aurora_get_available_backends(&backendCount);
|
const auto* backends = aurora_get_available_backends(&backendCount);
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Current backend: {}"), backend_name(aurora_get_backend())));
|
ImGuiStringViewText(fmt::format("Current backend: {}", backend_name(aurora_get_backend())));
|
||||||
auto desiredBackend = static_cast<int>(BACKEND_AUTO);
|
auto desiredBackend = static_cast<int>(BACKEND_AUTO);
|
||||||
if (auto* cvar = m_cvarMgr.findCVar("graphicsApi")) {
|
if (auto* cvar = m_cvarMgr.findCVar("graphicsApi")) {
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "Runtime/Streams/CFileOutStream.hpp"
|
#include "Runtime/Streams/CFileOutStream.hpp"
|
||||||
#include "Runtime/Streams/ContainerReaders.hpp"
|
#include "Runtime/Streams/ContainerReaders.hpp"
|
||||||
#include "Runtime/Streams/ContainerWriters.hpp"
|
#include "Runtime/Streams/ContainerWriters.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
@ -77,23 +78,23 @@ void ImGuiControllerConfig::show(bool& visible) {
|
|||||||
std::vector<std::string> controllers;
|
std::vector<std::string> controllers;
|
||||||
controllers.push_back("None");
|
controllers.push_back("None");
|
||||||
for (u32 i = 0; i < PADCount(); ++i) {
|
for (u32 i = 0; i < PADCount(); ++i) {
|
||||||
controllers.push_back(fmt::format(FMT_STRING("{}-{}"), PADGetNameForControllerIndex(i), i));
|
controllers.push_back(fmt::format("{}-{}", PADGetNameForControllerIndex(i), i));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pendingValid = false;
|
m_pendingValid = false;
|
||||||
if (ImGui::Begin("Controller Config", &visible)) {
|
if (ImGui::Begin("Controller Config", &visible)) {
|
||||||
if (ImGui::CollapsingHeader("Ports")) {
|
if (ImGui::CollapsingHeader("Ports")) {
|
||||||
for (u32 i = 0; i < 4; ++i) {
|
for (u32 i = 0; i < 4; ++i) {
|
||||||
ImGui::PushID(fmt::format(FMT_STRING("PortConf-{}"), i).c_str());
|
ImGui::PushID(fmt::format("PortConf-{}", i).c_str());
|
||||||
s32 index = PADGetIndexForPort(i);
|
s32 index = PADGetIndexForPort(i);
|
||||||
int sel = 0;
|
int sel = 0;
|
||||||
std::string name = "None";
|
std::string name = "None";
|
||||||
const char* tmpName = PADGetName(i);
|
const char* tmpName = PADGetName(i);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (tmpName != nullptr) {
|
if (tmpName != nullptr) {
|
||||||
name = fmt::format(FMT_STRING("{}-{}"), tmpName, index);
|
name = fmt::format("{}-{}", tmpName, index);
|
||||||
}
|
}
|
||||||
if (ImGui::BeginCombo(fmt::format(FMT_STRING("Port {}"), i + 1).c_str(), name.c_str())) {
|
if (ImGui::BeginCombo(fmt::format("Port {}", i + 1).c_str(), name.c_str())) {
|
||||||
for (u32 j = 0; const auto& s : controllers) {
|
for (u32 j = 0; const auto& s : controllers) {
|
||||||
if (ImGui::Selectable(s.c_str(), name == s)) {
|
if (ImGui::Selectable(s.c_str(), name == s)) {
|
||||||
sel = j;
|
sel = j;
|
||||||
@ -116,8 +117,8 @@ void ImGuiControllerConfig::show(bool& visible) {
|
|||||||
}
|
}
|
||||||
if (ImGui::BeginTabBar("Controllers")) {
|
if (ImGui::BeginTabBar("Controllers")) {
|
||||||
for (u32 i = 0; i < 4; ++i) {
|
for (u32 i = 0; i < 4; ++i) {
|
||||||
if (ImGui::BeginTabItem(fmt::format(FMT_STRING("Port {}"), i + 1).c_str())) {
|
if (ImGui::BeginTabItem(fmt::format("Port {}", i + 1).c_str())) {
|
||||||
ImGui::PushID(fmt::format(FMT_STRING("Port_{}"), i + 1).c_str());
|
ImGui::PushID(fmt::format("Port_{}", i + 1).c_str());
|
||||||
/* If the tab is changed while pending for input, cancel the pending port */
|
/* If the tab is changed while pending for input, cancel the pending port */
|
||||||
if (m_pendingMapping != nullptr && m_pendingPort != i) {
|
if (m_pendingMapping != nullptr && m_pendingPort != i) {
|
||||||
m_pendingMapping = nullptr;
|
m_pendingMapping = nullptr;
|
||||||
|
@ -158,6 +158,7 @@
|
|||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
#include "Runtime/World/CGameArea.hpp"
|
#include "Runtime/World/CGameArea.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "ImGuiConsole.hpp"
|
#include "ImGuiConsole.hpp"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
@ -797,7 +798,7 @@ IMGUI_ENTITY_INSPECT(CScriptDock, CPhysicsActor, ScriptDock, {
|
|||||||
auto areaId = dock->GetConnectedAreaId(dock->GetReferenceCount());
|
auto areaId = dock->GetConnectedAreaId(dock->GetReferenceCount());
|
||||||
if (areaId != kInvalidAreaId) {
|
if (areaId != kInvalidAreaId) {
|
||||||
CAssetId stringId = g_StateManager->GetWorld()->GetArea(areaId)->IGetStringTableAssetId();
|
CAssetId stringId = g_StateManager->GetWorld()->GetArea(areaId)->IGetStringTableAssetId();
|
||||||
ImGuiStringViewText(fmt::format(FMT_STRING("Connected Area: {}"), ImGuiLoadStringTable(stringId, 0)));
|
ImGuiStringViewText(fmt::format("Connected Area: {}", ImGuiLoadStringTable(stringId, 0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include "Runtime/ImGuiPlayerLoadouts.hpp"
|
#include "Runtime/ImGuiPlayerLoadouts.hpp"
|
||||||
#include "Runtime/Streams/ContainerReaders.hpp"
|
#include "Runtime/Streams/ContainerReaders.hpp"
|
||||||
#include "Runtime/Streams/ContainerWriters.hpp"
|
#include "Runtime/Streams/ContainerWriters.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
#include "magic_enum.hpp"
|
#include "magic_enum.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
namespace {
|
||||||
logvisor::Module Log("metaforce::ImGuiPlayerLoadouts");
|
|
||||||
constexpr u32 CurrentVersion = 1;
|
constexpr u32 CurrentVersion = 1;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ImGuiPlayerLoadouts::Item::Item(CInputStream& in)
|
ImGuiPlayerLoadouts::Item::Item(CInputStream& in)
|
||||||
: type(magic_enum::enum_cast<CPlayerState::EItemType>(in.Get<std::string>()).value()), amount(in.ReadLong()) {}
|
: type(magic_enum::enum_cast<CPlayerState::EItemType>(in.Get<std::string>()).value()), amount(in.ReadLong()) {}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ ImGuiPlayerLoadouts::ImGuiPlayerLoadouts(CInputStream& in) {
|
|||||||
in.Get(reinterpret_cast<u8*>(&magic), 4);
|
in.Get(reinterpret_cast<u8*>(&magic), 4);
|
||||||
auto version = in.ReadLong();
|
auto version = in.ReadLong();
|
||||||
if (magic != FOURCC('LOAD') && version != CurrentVersion) {
|
if (magic != FOURCC('LOAD') && version != CurrentVersion) {
|
||||||
Log.report(logvisor::Error, FMT_STRING("Incorrect loadout version, expected {} got {}"), CurrentVersion, version);
|
spdlog::error("Incorrect loadout version, expected {} got {}", CurrentVersion, version);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
read_vector(loadouts, in);
|
read_vector(loadouts, in);
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include "Runtime/Input/CDolphinController.hpp"
|
#include "Runtime/Input/CDolphinController.hpp"
|
||||||
|
|
||||||
#include <dolphin/si.h>
|
#include <dolphin/si.h>
|
||||||
|
#include <zeus/Math.hpp>
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
CDolphinController::CDolphinController() {
|
CDolphinController::CDolphinController() {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstring>
|
||||||
|
#include <bitset>
|
||||||
|
|
||||||
#include "Runtime/Input/CKeyboardMouseController.hpp"
|
#include "Runtime/Input/CKeyboardMouseController.hpp"
|
||||||
#include "Runtime/Input/CControllerGamepadData.hpp"
|
#include "Runtime/Input/CControllerGamepadData.hpp"
|
||||||
|
@ -36,7 +36,7 @@ void CRumbleGenerator::Update(float dt) {
|
|||||||
if (xe0_commandArray[i] != EMotorState::Stop) {
|
if (xe0_commandArray[i] != EMotorState::Stop) {
|
||||||
#if PWM_MONITOR
|
#if PWM_MONITOR
|
||||||
s_tp = now;
|
s_tp = now;
|
||||||
fmt::print(FMT_STRING("{}ms ON\n"), ms);
|
spdlog::debug("{}ms ON\n", ms);
|
||||||
#endif
|
#endif
|
||||||
xe0_commandArray[i] = EMotorState::Stop;
|
xe0_commandArray[i] = EMotorState::Stop;
|
||||||
updated = true;
|
updated = true;
|
||||||
@ -48,7 +48,7 @@ void CRumbleGenerator::Update(float dt) {
|
|||||||
if (xe0_commandArray[i] != EMotorState::Rumble) {
|
if (xe0_commandArray[i] != EMotorState::Rumble) {
|
||||||
#if PWM_MONITOR
|
#if PWM_MONITOR
|
||||||
s_tp = now;
|
s_tp = now;
|
||||||
fmt::print(FMT_STRING("{}ms Off\n"), ms);
|
spdlog::debug("{}ms Off\n", ms);
|
||||||
#endif
|
#endif
|
||||||
xe0_commandArray[i] = EMotorState::Rumble;
|
xe0_commandArray[i] = EMotorState::Rumble;
|
||||||
updated = true;
|
updated = true;
|
||||||
@ -60,7 +60,7 @@ void CRumbleGenerator::Update(float dt) {
|
|||||||
if (xe0_commandArray[i] != EMotorState::Stop) {
|
if (xe0_commandArray[i] != EMotorState::Stop) {
|
||||||
#if PWM_MONITOR
|
#if PWM_MONITOR
|
||||||
s_tp = now;
|
s_tp = now;
|
||||||
fmt::print(FMT_STRING("{}ms ON\n"), ms);
|
spdlog::debug("{}ms ON\n", ms);
|
||||||
#endif
|
#endif
|
||||||
xe0_commandArray[i] = EMotorState::Stop;
|
xe0_commandArray[i] = EMotorState::Stop;
|
||||||
updated = true;
|
updated = true;
|
||||||
|
12
Runtime/Logging.hpp
Normal file
12
Runtime/Logging.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <spdlog/spdlog.h> // IWYU pragma: export
|
||||||
|
|
||||||
|
namespace spdlog {
|
||||||
|
template <typename... Args>
|
||||||
|
[[noreturn]] inline void fatal(format_string_t<Args...> fmt, Args&&... args) {
|
||||||
|
default_logger_raw()->critical(fmt, std::forward<Args>(args)...);
|
||||||
|
default_logger_raw()->flush();
|
||||||
|
std::terminate();
|
||||||
|
}
|
||||||
|
} // namespace spdlog
|
@ -13,8 +13,6 @@
|
|||||||
#include "Runtime/MP1/CPlayMovie.hpp"
|
#include "Runtime/MP1/CPlayMovie.hpp"
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
static logvisor::Module Log("CCredits");
|
|
||||||
|
|
||||||
CCredits::CCredits()
|
CCredits::CCredits()
|
||||||
: CIOWin("Credits")
|
: CIOWin("Credits")
|
||||||
, x18_creditsTable(g_SimplePool->GetObj(g_tweakGui->GetCreditsTable()))
|
, x18_creditsTable(g_SimplePool->GetObj(g_tweakGui->GetCreditsTable()))
|
||||||
|
@ -459,9 +459,9 @@ std::u16string GetTimeString(const CGameState::GameFileStateInfo* data) {
|
|||||||
if (data) {
|
if (data) {
|
||||||
auto pt = std::div(data->x0_playTime, 3600);
|
auto pt = std::div(data->x0_playTime, 3600);
|
||||||
#if FE_USE_SECONDS_IN_ELAPSED
|
#if FE_USE_SECONDS_IN_ELAPSED
|
||||||
return fmt::format(FMT_STRING(u"{:02d}:{:02d}:{:02d}"), pt.quot, pt.rem / 60, pt.rem % 60);
|
return fmt::format(u"{:02d}:{:02d}:{:02d}", pt.quot, pt.rem / 60, pt.rem % 60);
|
||||||
#else
|
#else
|
||||||
return fmt::format(FMT_STRING(u"{:02d}:{:02d}"), pt.quot, pt.rem / 60);
|
return fmt::format(u"{:02d}:{:02d}", pt.quot, pt.rem / 60);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!g_Main->IsUSA() || g_Main->IsTrilogy())
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy())
|
||||||
@ -500,7 +500,7 @@ void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents() {
|
|||||||
strIdx = (strIdx == 106 ? 100 : 40);
|
strIdx = (strIdx == 106 ? 100 : 40);
|
||||||
|
|
||||||
std::u16string fileStr = g_MainStringTable->GetString(strIdx + int(i));
|
std::u16string fileStr = g_MainStringTable->GetString(strIdx + int(i));
|
||||||
str = fileStr + fmt::format(FMT_STRING(u" {:02d}%"), data->x18_itemPercent);
|
str = fileStr + fmt::format(u" {:02d}%", data->x18_itemPercent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
str = g_MainStringTable->GetString(36);
|
str = g_MainStringTable->GetString(36);
|
||||||
@ -637,11 +637,11 @@ void CFrontEndUI::SNewFileSelectFrame::DoFileMenuAdvance(CGuiTableGroup* caller)
|
|||||||
|
|
||||||
CFrontEndUI::SFileMenuOption CFrontEndUI::SNewFileSelectFrame::FindFileSelectOption(CGuiFrame* frame, int idx) {
|
CFrontEndUI::SFileMenuOption CFrontEndUI::SNewFileSelectFrame::FindFileSelectOption(CGuiFrame* frame, int idx) {
|
||||||
SFileMenuOption ret;
|
SFileMenuOption ret;
|
||||||
ret.x0_base = frame->FindWidget(fmt::format(FMT_STRING("basewidget_file{}"), idx));
|
ret.x0_base = frame->FindWidget(fmt::format("basewidget_file{}", idx));
|
||||||
ret.x4_textpanes[0] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_filename{}"), idx));
|
ret.x4_textpanes[0] = FindTextPanePair(frame, fmt::format("textpane_filename{}", idx));
|
||||||
ret.x4_textpanes[1] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_world{}"), idx));
|
ret.x4_textpanes[1] = FindTextPanePair(frame, fmt::format("textpane_world{}", idx));
|
||||||
ret.x4_textpanes[2] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_playtime{}"), idx));
|
ret.x4_textpanes[2] = FindTextPanePair(frame, fmt::format("textpane_playtime{}", idx));
|
||||||
ret.x4_textpanes[3] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_date{}"), idx));
|
ret.x4_textpanes[3] = FindTextPanePair(frame, fmt::format("textpane_date{}", idx));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,14 +1066,14 @@ void CFrontEndUI::SGuiTextPair::SetPairText(std::u16string_view str) {
|
|||||||
CFrontEndUI::SGuiTextPair CFrontEndUI::FindTextPanePair(CGuiFrame* frame, std::string_view name) {
|
CFrontEndUI::SGuiTextPair CFrontEndUI::FindTextPanePair(CGuiFrame* frame, std::string_view name) {
|
||||||
SGuiTextPair ret;
|
SGuiTextPair ret;
|
||||||
ret.x0_panes[0] = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
ret.x0_panes[0] = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
||||||
ret.x0_panes[1] = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name)));
|
ret.x0_panes[1] = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format("{}b", name)));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrontEndUI::FindAndSetPairText(CGuiFrame* frame, std::string_view name, std::u16string_view str) {
|
void CFrontEndUI::FindAndSetPairText(CGuiFrame* frame, std::string_view name, std::u16string_view str) {
|
||||||
CGuiTextPane* w1 = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
CGuiTextPane* w1 = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
||||||
w1->TextSupport().SetText(str);
|
w1->TextSupport().SetText(str);
|
||||||
CGuiTextPane* w2 = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name)));
|
CGuiTextPane* w2 = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format("{}b", name)));
|
||||||
w2->TextSupport().SetText(str);
|
w2->TextSupport().SetText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1469,7 +1469,7 @@ void CFrontEndUI::SOptionsFrontEndFrame::SetRightUIText() {
|
|||||||
(g_Main->IsUSA() && !g_Main->IsTrilogy()) ? GameOptionsRegistry[userSel] : GameOptionsRegistryNew[userSel];
|
(g_Main->IsUSA() && !g_Main->IsTrilogy()) ? GameOptionsRegistry[userSel] : GameOptionsRegistryNew[userSel];
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
std::string name = fmt::format(FMT_STRING("textpane_right{}"), i);
|
std::string name = fmt::format("textpane_right{}", i);
|
||||||
if (i < static_cast<int>(options.first)) {
|
if (i < static_cast<int>(options.first)) {
|
||||||
FindTextPanePair(x1c_loadedFrame, name).SetPairText(x20_loadedPauseStrg->GetString(options.second[i].stringId));
|
FindTextPanePair(x1c_loadedFrame, name).SetPairText(x20_loadedPauseStrg->GetString(options.second[i].stringId));
|
||||||
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(true);
|
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(true);
|
||||||
@ -1537,7 +1537,7 @@ void CFrontEndUI::SOptionsFrontEndFrame::FinishedLoading() {
|
|||||||
|
|
||||||
// Visor, Display, Sound, Controller
|
// Visor, Display, Sound, Controller
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
const std::string name = fmt::format(FMT_STRING("textpane_filename{}"), i);
|
const std::string name = fmt::format("textpane_filename{}", i);
|
||||||
FindTextPanePair(x1c_loadedFrame, name)
|
FindTextPanePair(x1c_loadedFrame, name)
|
||||||
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy() ? 16 : 18) + i));
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy() ? 16 : 18) + i));
|
||||||
}
|
}
|
||||||
@ -1653,7 +1653,7 @@ void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CFrontEndUI::GetAttractMovieFileName(int idx) {
|
std::string CFrontEndUI::GetAttractMovieFileName(int idx) {
|
||||||
return fmt::format(FMT_STRING("Video/attract{}.thp"), idx);
|
return fmt::format("Video/attract{}.thp", idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CFrontEndUI::GetNextAttractMovieFileName() {
|
std::string CFrontEndUI::GetNextAttractMovieFileName() {
|
||||||
|
@ -671,7 +671,7 @@ void CMemoryCardDriver::InitializeFileInfo() {
|
|||||||
ExportPersistentOptions();
|
ExportPersistentOptions();
|
||||||
|
|
||||||
OSCalendarTime time = CBasics::ToCalendarTime(std::chrono::system_clock::now());
|
OSCalendarTime time = CBasics::ToCalendarTime(std::chrono::system_clock::now());
|
||||||
std::string timeString = fmt::format(FMT_STRING("{:02d}.{:02d}.{:02d} {:02d}:{:02d}"), time.x10_mon + 1,
|
std::string timeString = fmt::format("{:02d}.{:02d}.{:02d} {:02d}:{:02d}", time.x10_mon + 1,
|
||||||
time.xc_mday, time.x14_year % 100, time.x8_hour, time.x4_min);
|
time.xc_mday, time.x14_year % 100, time.x8_hour, time.x4_min);
|
||||||
std::string comment("Metroid Prime ");
|
std::string comment("Metroid Prime ");
|
||||||
comment += timeString;
|
comment += timeString;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Runtime/Input/ControlMapper.hpp"
|
#include "Runtime/Input/ControlMapper.hpp"
|
||||||
#include "Runtime/MP1/CLogBookScreen.hpp"
|
#include "Runtime/MP1/CLogBookScreen.hpp"
|
||||||
#include "Runtime/MP1/COptionsScreen.hpp"
|
#include "Runtime/MP1/COptionsScreen.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
|
|
||||||
@ -218,21 +219,21 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
|
|||||||
}
|
}
|
||||||
|
|
||||||
x38_textpane_l1->TextSupport().SetText(fmt::format(
|
x38_textpane_l1->TextSupport().SetText(fmt::format(
|
||||||
FMT_STRING("&image={};"),
|
"&image={};",
|
||||||
g_tweakPlayerRes
|
g_tweakPlayerRes
|
||||||
->x74_lTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::PreviousPauseScreen, useInput) ||
|
->x74_lTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::PreviousPauseScreen, useInput) ||
|
||||||
m_lDown]));
|
m_lDown]));
|
||||||
x3c_textpane_r->TextSupport().SetText(fmt::format(
|
x3c_textpane_r->TextSupport().SetText(fmt::format(
|
||||||
FMT_STRING("&image={};"),
|
"&image={};",
|
||||||
g_tweakPlayerRes
|
g_tweakPlayerRes
|
||||||
->x80_rTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::NextPauseScreen, useInput) ||
|
->x80_rTrigger[ControlMapper::GetDigitalInput(ControlMapper::ECommands::NextPauseScreen, useInput) ||
|
||||||
m_rDown]));
|
m_rDown]));
|
||||||
x48_textpane_return->TextSupport().SetText(
|
x48_textpane_return->TextSupport().SetText(
|
||||||
fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown]));
|
fmt::format("&image={};", g_tweakPlayerRes->x8c_startButton[useInput.DStart() || m_returnDown]));
|
||||||
x50_textpane_back->TextSupport().SetText(
|
x50_textpane_back->TextSupport().SetText(
|
||||||
fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown]));
|
fmt::format("&image={};", g_tweakPlayerRes->x98_aButton[useInput.DA() || m_backDown]));
|
||||||
x4c_textpane_next->TextSupport().SetText(
|
x4c_textpane_next->TextSupport().SetText(
|
||||||
fmt::format(FMT_STRING("&image={};"), g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown]));
|
fmt::format("&image={};", g_tweakPlayerRes->xa4_bButton[useInput.DB() || m_nextDown]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPauseScreen::TransitionComplete() {
|
void CPauseScreen::TransitionComplete() {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "Runtime/MP1/CPauseScreenBase.hpp"
|
#include "Runtime/MP1/CPauseScreenBase.hpp"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <fmt/xchar.h>
|
|
||||||
|
|
||||||
#include "Runtime/CGameState.hpp"
|
#include "Runtime/CGameState.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
@ -15,6 +14,7 @@
|
|||||||
#include "Runtime/GuiSys/CGuiWidgetDrawParms.hpp"
|
#include "Runtime/GuiSys/CGuiWidgetDrawParms.hpp"
|
||||||
#include "Runtime/GuiSys/CStringTable.hpp"
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
||||||
#include "Runtime/IMain.hpp"
|
#include "Runtime/IMain.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ void CPauseScreenBase::InitializeFrameGlue() {
|
|||||||
x17c_model_textalpha = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textalpha"));
|
x17c_model_textalpha = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textalpha"));
|
||||||
x184_textpane_yicon = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_yicon"));
|
x184_textpane_yicon = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_yicon"));
|
||||||
x188_textpane_ytext = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_ytext"));
|
x188_textpane_ytext = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_ytext"));
|
||||||
x184_textpane_yicon->TextSupport().SetText(fmt::format(FMT_STRING(u"&image={};"), g_tweakPlayerRes->xbc_yButton[0]));
|
x184_textpane_yicon->TextSupport().SetText(fmt::format(u"&image={};", g_tweakPlayerRes->xbc_yButton[0]));
|
||||||
x188_textpane_ytext->TextSupport().SetText(
|
x188_textpane_ytext->TextSupport().SetText(
|
||||||
xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 99 : 102));
|
xc_pauseStrg.GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 99 : 102));
|
||||||
x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
|
x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
|
||||||
@ -93,20 +93,18 @@ void CPauseScreenBase::InitializeFrameGlue() {
|
|||||||
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
for (int i = 0; i < 5; ++i) {
|
||||||
xd8_textpane_titles.push_back(
|
xd8_textpane_titles.push_back(
|
||||||
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_title{}"), i + 1))));
|
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format("textpane_title{}", i + 1))));
|
||||||
xd8_textpane_titles.back()->TextSupport().SetText(u"");
|
xd8_textpane_titles.back()->TextSupport().SetText(u"");
|
||||||
x144_model_titles.push_back(
|
x144_model_titles.push_back(static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_title{}", i + 1))));
|
||||||
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_title{}"), i + 1))));
|
|
||||||
m_model_lefttitledecos.push_back(
|
m_model_lefttitledecos.push_back(
|
||||||
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_lefttitledeco{}"), i))));
|
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_lefttitledeco{}", i))));
|
||||||
m_model_lefttitledecos.back()->SetMouseActive(true);
|
m_model_lefttitledecos.back()->SetMouseActive(true);
|
||||||
x15c_model_righttitledecos.push_back(
|
x15c_model_righttitledecos.push_back(
|
||||||
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_righttitledeco{}"), i + 1))));
|
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_righttitledeco{}", i + 1))));
|
||||||
x15c_model_righttitledecos.back()->SetMouseActive(true);
|
x15c_model_righttitledecos.back()->SetMouseActive(true);
|
||||||
xa8_textpane_categories.push_back(
|
xa8_textpane_categories.push_back(
|
||||||
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format(FMT_STRING("textpane_category{}"), i))));
|
static_cast<CGuiTextPane*>(x8_frame.FindWidget(fmt::format("textpane_category{}", i))));
|
||||||
xc0_model_categories.push_back(
|
xc0_model_categories.push_back(static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format("model_category{}", i))));
|
||||||
static_cast<CGuiModel*>(x8_frame.FindWidget(fmt::format(FMT_STRING("model_category{}"), i))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 20; ++i)
|
for (int i = 0; i < 20; ++i)
|
||||||
@ -535,7 +533,7 @@ std::string CPauseScreenBase::GetImagePaneName(size_t i) {
|
|||||||
"4", "5", "6", "7", "45", "56", "67", "456", "567", "4567",
|
"4", "5", "6", "7", "45", "56", "67", "456", "567", "4567",
|
||||||
};
|
};
|
||||||
|
|
||||||
return fmt::format(FMT_STRING("imagepane_pane{}"), PaneSuffixes[i]);
|
return fmt::format("imagepane_pane{}", PaneSuffixes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace metaforce::MP1
|
} // namespace metaforce::MP1
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
#include "Runtime/World/CScriptTrigger.hpp"
|
#include "Runtime/World/CScriptTrigger.hpp"
|
||||||
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ void CSamusHud::InitializeFrameGluePermanent(const CStateManager& mgr) {
|
|||||||
for (size_t i = 0; i < x5a4_videoBands.size(); ++i) {
|
for (size_t i = 0; i < x5a4_videoBands.size(); ++i) {
|
||||||
SVideoBand& band = x5a4_videoBands[i];
|
SVideoBand& band = x5a4_videoBands[i];
|
||||||
band.x0_videoband =
|
band.x0_videoband =
|
||||||
static_cast<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget(fmt::format(FMT_STRING("model_videoband{}"), i)));
|
static_cast<CGuiModel*>(x274_loadedFrmeBaseHud->FindWidget(fmt::format("model_videoband{}", i)));
|
||||||
band.x4_randA = 6 + (std::rand() % ((66 - 6) + 1));
|
band.x4_randA = 6 + (std::rand() % ((66 - 6) + 1));
|
||||||
band.x8_randB = 16 + (std::rand() % ((256 - 16) + 1));
|
band.x8_randB = 16 + (std::rand() % ((256 - 16) + 1));
|
||||||
}
|
}
|
||||||
@ -1297,7 +1298,7 @@ void CSamusHud::Update(float dt, const CStateManager& mgr, CInGameGuiManager::EH
|
|||||||
int minutes = mgr.GetEscapeSequenceTimer() / 60.f;
|
int minutes = mgr.GetEscapeSequenceTimer() / 60.f;
|
||||||
int seconds = std::fmod(mgr.GetEscapeSequenceTimer(), 60.f);
|
int seconds = std::fmod(mgr.GetEscapeSequenceTimer(), 60.f);
|
||||||
int hundredths = std::fmod(mgr.GetEscapeSequenceTimer() * 100.f, 100.f);
|
int hundredths = std::fmod(mgr.GetEscapeSequenceTimer() * 100.f, 100.f);
|
||||||
std::string timeStr = fmt::format(FMT_STRING("{:02d}:{:02d}:{:02d}"), int(minutes), int(seconds), int(hundredths));
|
std::string timeStr = fmt::format("{:02d}:{:02d}:{:02d}", int(minutes), int(seconds), int(hundredths));
|
||||||
x594_base_textpane_counter->TextSupport().SetText(timeStr);
|
x594_base_textpane_counter->TextSupport().SetText(timeStr);
|
||||||
x594_base_textpane_counter->SetIsVisible(true);
|
x594_base_textpane_counter->SetIsVisible(true);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "Runtime/CGameState.hpp"
|
#include "Runtime/CGameState.hpp"
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
namespace {
|
||||||
@ -88,7 +89,7 @@ CIOWin::EMessageReturn CSlideShow::OnMessage(const CArchitectureMessage& msg, CA
|
|||||||
if (x18_galleryTXTRDeps.empty()) {
|
if (x18_galleryTXTRDeps.empty()) {
|
||||||
x18_galleryTXTRDeps.reserve(5);
|
x18_galleryTXTRDeps.reserve(5);
|
||||||
for (int i = 1; true; ++i) {
|
for (int i = 1; true; ++i) {
|
||||||
std::string depResName = fmt::format(FMT_STRING("Gallery{:02d}_DGRP"), i);
|
std::string depResName = fmt::format("Gallery{:02d}_DGRP", i);
|
||||||
if (!LoadTXTRDep(depResName))
|
if (!LoadTXTRDep(depResName))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -18,13 +18,10 @@
|
|||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
#include "Runtime/AutoMapper/CMappableObject.hpp"
|
#include "Runtime/AutoMapper/CMappableObject.hpp"
|
||||||
#include "Runtime/World/CPlayerCameraBob.hpp"
|
#include "Runtime/World/CPlayerCameraBob.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
|
|
||||||
static logvisor::Module Log("MP1::CTweaks");
|
|
||||||
|
|
||||||
void CTweaks::RegisterTweaks(CVarManager* cvarMgr) {
|
void CTweaks::RegisterTweaks(CVarManager* cvarMgr) {
|
||||||
std::optional<CMemoryInStream> strm;
|
std::optional<CMemoryInStream> strm;
|
||||||
const SObjectTag* tag;
|
const SObjectTag* tag;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
#include "Runtime/World/CStateMachine.hpp"
|
#include "Runtime/World/CStateMachine.hpp"
|
||||||
#include "Runtime/World/CScriptMazeNode.hpp"
|
#include "Runtime/World/CScriptMazeNode.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include "Runtime/MP1/CCredits.hpp"
|
#include "Runtime/MP1/CCredits.hpp"
|
||||||
|
|
||||||
@ -73,8 +74,6 @@ inline void* memmem(const void* haystack, size_t hlen, const void* needle, size_
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
static logvisor::Module Log{"MP1"};
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct AudioGroupInfo {
|
struct AudioGroupInfo {
|
||||||
const char* name;
|
const char* name;
|
||||||
@ -329,7 +328,7 @@ void CMain::AddOverridePaks() {
|
|||||||
* the higher the number the higer the priority, e.g: Override0 has less priority than Override1 etc.
|
* the higher the number the higer the priority, e.g: Override0 has less priority than Override1 etc.
|
||||||
*/
|
*/
|
||||||
for (size_t i = 9; i > 0; --i) {
|
for (size_t i = 9; i > 0; --i) {
|
||||||
const std::string path = fmt::format(FMT_STRING("Override{}"), i);
|
const std::string path = fmt::format("Override{}", i);
|
||||||
if (CDvdFile::FileExists(path + ".pak")) {
|
if (CDvdFile::FileExists(path + ".pak")) {
|
||||||
loader->AddPakFileAsync(path, false, false, true);
|
loader->AddPakFileAsync(path, false, false, true);
|
||||||
}
|
}
|
||||||
@ -403,8 +402,7 @@ bool CMain::LoadAudio() {
|
|||||||
|
|
||||||
void CMain::EnsureWorldPaksReady() {}
|
void CMain::EnsureWorldPaksReady() {}
|
||||||
|
|
||||||
void CMain::EnsureWorldPakReady(CAssetId mlvl) { /* TODO: Schedule resource list load for World Pak containing mlvl */
|
void CMain::EnsureWorldPakReady(CAssetId mlvl) { /* TODO: Schedule resource list load for World Pak containing mlvl */ }
|
||||||
}
|
|
||||||
|
|
||||||
void CMain::StreamNewGameState(CInputStream& r, u32 idx) {
|
void CMain::StreamNewGameState(CInputStream& r, u32 idx) {
|
||||||
bool fusionBackup = g_GameState->SystemOptions().GetPlayerFusionSuitActive();
|
bool fusionBackup = g_GameState->SystemOptions().GetPlayerFusionSuitActive();
|
||||||
@ -429,8 +427,6 @@ void CMain::RefreshGameState() {
|
|||||||
g_GameState->GetPlayerState()->SetIsFusionEnabled(g_GameState->SystemOptions().GetPlayerFusionSuitActive());
|
g_GameState->GetPlayerState()->SetIsFusionEnabled(g_GameState->SystemOptions().GetPlayerFusionSuitActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
static logvisor::Module DiscordLog("Discord");
|
|
||||||
static logvisor::Module MainLog("MP1::CMain");
|
|
||||||
static const char* DISCORD_APPLICATION_ID = "402571593815031819";
|
static const char* DISCORD_APPLICATION_ID = "402571593815031819";
|
||||||
static int64_t DiscordStartTime;
|
static int64_t DiscordStartTime;
|
||||||
static CAssetId DiscordWorldSTRG;
|
static CAssetId DiscordWorldSTRG;
|
||||||
@ -476,7 +472,7 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG) {
|
|||||||
const u32 itemPercent = pState->CalculateItemCollectionRate() * 100 / pState->GetPickupTotal();
|
const u32 itemPercent = pState->CalculateItemCollectionRate() * 100 / pState->GetPickupTotal();
|
||||||
if (DiscordItemPercent != itemPercent) {
|
if (DiscordItemPercent != itemPercent) {
|
||||||
DiscordItemPercent = itemPercent;
|
DiscordItemPercent = itemPercent;
|
||||||
DiscordState = fmt::format(FMT_STRING("{}%"), itemPercent);
|
DiscordState = fmt::format("{}%", itemPercent);
|
||||||
updated = true;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -493,17 +489,13 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMain::HandleDiscordReady(const DiscordUser* request) {
|
void CMain::HandleDiscordReady(const DiscordUser* request) { spdlog::info("Discord Ready"); }
|
||||||
DiscordLog.report(logvisor::Info, FMT_STRING("Discord Ready"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMain::HandleDiscordDisconnected(int errorCode, const char* message) {
|
void CMain::HandleDiscordDisconnected(int errorCode, const char* message) {
|
||||||
DiscordLog.report(logvisor::Warning, FMT_STRING("Discord Disconnected: {}"), message);
|
spdlog::warn("Discord Disconnected: {}", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMain::HandleDiscordErrored(int errorCode, const char* message) {
|
void CMain::HandleDiscordErrored(int errorCode, const char* message) { spdlog::error("Discord Error: {}", message); }
|
||||||
DiscordLog.report(logvisor::Error, FMT_STRING("Discord Error: {}"), message);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr) {
|
std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr) {
|
||||||
m_cvarMgr = cvarMgr;
|
m_cvarMgr = cvarMgr;
|
||||||
@ -511,7 +503,7 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr,
|
|||||||
{
|
{
|
||||||
auto discInfo = CDvdFile::DiscInfo();
|
auto discInfo = CDvdFile::DiscInfo();
|
||||||
if (discInfo.gameId[4] != '0' || discInfo.gameId[5] != '1') {
|
if (discInfo.gameId[4] != '0' || discInfo.gameId[5] != '1') {
|
||||||
return fmt::format(FMT_STRING("Unknown game ID {}"), std::string_view{discInfo.gameId.data(), 6});
|
return fmt::format("Unknown game ID {}", std::string_view{discInfo.gameId.data(), 6});
|
||||||
}
|
}
|
||||||
if (strncmp(discInfo.gameId.data(), "GM8", 3) == 0) {
|
if (strncmp(discInfo.gameId.data(), "GM8", 3) == 0) {
|
||||||
m_version.game = EGame::MetroidPrime1;
|
m_version.game = EGame::MetroidPrime1;
|
||||||
@ -532,7 +524,7 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr,
|
|||||||
m_version.game = EGame::MetroidPrimeTrilogy;
|
m_version.game = EGame::MetroidPrimeTrilogy;
|
||||||
m_version.platform = EPlatform::Wii;
|
m_version.platform = EPlatform::Wii;
|
||||||
} else {
|
} else {
|
||||||
return fmt::format(FMT_STRING("Unknown game ID {}"), std::string_view{discInfo.gameId.data(), 6});
|
return fmt::format("Unknown game ID {}", std::string_view{discInfo.gameId.data(), 6});
|
||||||
}
|
}
|
||||||
switch (discInfo.gameId[3]) {
|
switch (discInfo.gameId[3]) {
|
||||||
case 'E':
|
case 'E':
|
||||||
@ -549,13 +541,13 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr,
|
|||||||
m_version.region = ERegion::PAL;
|
m_version.region = ERegion::PAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return fmt::format(FMT_STRING("Unknown region {}"), discInfo.gameId[3]);
|
return fmt::format("Unknown region {}", discInfo.gameId[3]);
|
||||||
}
|
}
|
||||||
m_version.gameTitle = std::move(discInfo.gameTitle);
|
m_version.gameTitle = std::move(discInfo.gameTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_version.game != EGame::MetroidPrime1 && m_version.game != EGame::MetroidPrimeTrilogy) {
|
if (m_version.game != EGame::MetroidPrime1 && m_version.game != EGame::MetroidPrimeTrilogy) {
|
||||||
return fmt::format(FMT_STRING("Unsupported game {}"), magic_enum::enum_name(m_version.game));
|
return fmt::format("Unsupported game {}", magic_enum::enum_name(m_version.game));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -567,18 +559,17 @@ std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr,
|
|||||||
}
|
}
|
||||||
CDvdFile file(dolFile);
|
CDvdFile file(dolFile);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return fmt::format(FMT_STRING("Failed to open {}"), dolFile);
|
return fmt::format("Failed to open {}", dolFile);
|
||||||
}
|
}
|
||||||
std::unique_ptr<u8[]> buf = std::make_unique<u8[]>(file.Length());
|
std::unique_ptr<u8[]> buf = std::make_unique<u8[]>(file.Length());
|
||||||
u32 readLen = file.SyncRead(buf.get(), file.Length());
|
u32 readLen = file.SyncRead(buf.get(), file.Length());
|
||||||
const char* buildInfo = static_cast<char*>(memmem(buf.get(), readLen, "MetroidBuildInfo", 16)) + 19;
|
const char* buildInfo = static_cast<char*>(memmem(buf.get(), readLen, "MetroidBuildInfo", 16)) + 19;
|
||||||
if (buildInfo == nullptr) {
|
if (buildInfo == nullptr) {
|
||||||
return fmt::format(FMT_STRING("Failed to locate MetroidBuildInfo"));
|
return fmt::format("Failed to locate MetroidBuildInfo");
|
||||||
}
|
}
|
||||||
m_version.version = buildInfo;
|
m_version.version = buildInfo;
|
||||||
}
|
}
|
||||||
MainLog.report(logvisor::Level::Info, FMT_STRING("Loading data from {} {} ({})"), GetGameTitle(),
|
spdlog::info("Loading data from {} {} ({})", GetGameTitle(), magic_enum::enum_name(GetRegion()), GetVersionString());
|
||||||
magic_enum::enum_name(GetRegion()), GetVersionString());
|
|
||||||
|
|
||||||
InitializeDiscord();
|
InitializeDiscord();
|
||||||
if (m_version.game == EGame::MetroidPrimeTrilogy) {
|
if (m_version.game == EGame::MetroidPrimeTrilogy) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "Runtime/World/CScriptWaypoint.hpp"
|
#include "Runtime/World/CScriptWaypoint.hpp"
|
||||||
#include "Runtime/World/CTeamAiMgr.hpp"
|
#include "Runtime/World/CTeamAiMgr.hpp"
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
@ -770,8 +771,7 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_lastKnownGoodXf.origin.isZero() && GetTranslation().isNaN()) {
|
if (!m_lastKnownGoodXf.origin.isZero() && GetTranslation().isNaN()) {
|
||||||
fmt::print(
|
spdlog::warn("BUG THIS!: Space Pirate attempted to visit it's people, resetting position to sane value\n");
|
||||||
FMT_STRING("BUG THIS!: Space Pirate attempted to visit it's people, resetting position to sane value\n"));
|
|
||||||
Stop();
|
Stop();
|
||||||
SetTransform(m_lastKnownGoodXf);
|
SetTransform(m_lastKnownGoodXf);
|
||||||
}
|
}
|
||||||
@ -891,7 +891,7 @@ void CSpacePirate::Think(float dt, CStateManager& mgr) {
|
|||||||
if (!GetTranslation().isNaN()) {
|
if (!GetTranslation().isNaN()) {
|
||||||
m_lastKnownGoodXf = GetTransform();
|
m_lastKnownGoodXf = GetTransform();
|
||||||
} else {
|
} else {
|
||||||
fmt::print(FMT_STRING("BUG THIS!: Space Pirate being yeeted to the unknown\n"));
|
spdlog::warn("BUG THIS!: Space Pirate being yeeted to the unknown\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,10 @@
|
|||||||
#include "Runtime/Collision/CCollisionActor.hpp"
|
#include "Runtime/Collision/CCollisionActor.hpp"
|
||||||
#include "Runtime/World/CPatternedInfo.hpp"
|
#include "Runtime/World/CPatternedInfo.hpp"
|
||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
logvisor::Module SpankLog("metaforce::MP1::SpankWeed");
|
|
||||||
|
|
||||||
constexpr std::array<SSphereJointInfo, 7> kArmCollision{{
|
constexpr std::array<SSphereJointInfo, 7> kArmCollision{{
|
||||||
{"Arm_4", 1.5f},
|
{"Arm_4", 1.5f},
|
||||||
{"Arm_6", 1.f},
|
{"Arm_6", 1.f},
|
||||||
@ -41,9 +39,9 @@ CSpankWeed::CSpankWeed(TUniqueId uid, std::string_view name, const CEntityInfo&
|
|||||||
float scale = modelScale.magnitude() / std::sqrt(3.f);
|
float scale = modelScale.magnitude() / std::sqrt(3.f);
|
||||||
|
|
||||||
GetModelData()->SetScale(zeus::CVector3f(scale));
|
GetModelData()->SetScale(zeus::CVector3f(scale));
|
||||||
SpankLog.report(logvisor::Level::Warning,
|
spdlog::warn(
|
||||||
FMT_STRING("WARNING: Non-uniform scale {} applied to Spank Weed"
|
"WARNING: Non-uniform scale {} applied to Spank Weed"
|
||||||
"...changing scale to ({} {} {})\n"),
|
"...changing scale to ({} {} {})\n",
|
||||||
modelScale, scale, scale, scale);
|
modelScale, scale, scale, scale);
|
||||||
}
|
}
|
||||||
CMaterialList list = GetMaterialFilter().GetExcludeList();
|
CMaterialList list = GetMaterialFilter().GetExcludeList();
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "Runtime/World/CScriptDistanceFog.hpp"
|
#include "Runtime/World/CScriptDistanceFog.hpp"
|
||||||
#include "Runtime/World/CScriptWaypoint.hpp"
|
#include "Runtime/World/CScriptWaypoint.hpp"
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
@ -1320,7 +1321,7 @@ void CThardus::BreakRock(CStateManager& mgr, u32 rockIndex) {
|
|||||||
void CThardus::SetRockParticle(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle) {
|
void CThardus::SetRockParticle(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle) {
|
||||||
u32 w = x6f4_;
|
u32 w = x6f4_;
|
||||||
++x6f4_;
|
++x6f4_;
|
||||||
std::string particleName = fmt::format(FMT_STRING("ROCK_EFFECT{}-{}"), particle.Value(), w);
|
std::string particleName = fmt::format("ROCK_EFFECT{}-{}", particle.Value(), w);
|
||||||
GetModelData()->GetAnimationData()->GetParticleDB().AddAuxiliaryParticleEffect(
|
GetModelData()->GetAnimationData()->GetParticleDB().AddAuxiliaryParticleEffect(
|
||||||
particleName, 0x40, CAuxiliaryParticleData(0, {FOURCC('PART'), particle}, pos, 1.f),
|
particleName, 0x40, CAuxiliaryParticleData(0, {FOURCC('PART'), particle}, pos, 1.f),
|
||||||
2.f * GetModelData()->GetScale(), mgr, GetAreaIdAlways(), 0);
|
2.f * GetModelData()->GetScale(), mgr, GetAreaIdAlways(), 0);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "Runtime/World/CExplosion.hpp"
|
#include "Runtime/World/CExplosion.hpp"
|
||||||
#include "Runtime/World/CLightParameters.hpp"
|
#include "Runtime/World/CLightParameters.hpp"
|
||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
@ -343,7 +344,7 @@ void CThardusRockProjectile::SetMaterialProperties(const std::unique_ptr<CCollis
|
|||||||
void CThardusRockProjectile::DoExplosion(CStateManager& mgr, CAssetId particleId, const zeus::CVector3f& pos,
|
void CThardusRockProjectile::DoExplosion(CStateManager& mgr, CAssetId particleId, const zeus::CVector3f& pos,
|
||||||
const zeus::CVector3f& scale, u32 w2) {
|
const zeus::CVector3f& scale, u32 w2) {
|
||||||
TUniqueId uid = mgr.AllocateUniqueId();
|
TUniqueId uid = mgr.AllocateUniqueId();
|
||||||
std::string name = fmt::format(FMT_STRING("ROCK_PROJECTILE_EFFECT-{}-{}"), particleId.Value(), uid.Value());
|
std::string name = fmt::format("ROCK_PROJECTILE_EFFECT-{}-{}", particleId.Value(), uid.Value());
|
||||||
TLockedToken<CGenDescription> descTok = g_SimplePool->GetObj({SBIG('PART'), particleId});
|
TLockedToken<CGenDescription> descTok = g_SimplePool->GetObj({SBIG('PART'), particleId});
|
||||||
mgr.AddObject(new CExplosion(descTok, uid, true, CEntityInfo(mgr.GetNextAreaId(), NullConnectionList), name,
|
mgr.AddObject(new CExplosion(descTok, uid, true, CEntityInfo(mgr.GetNextAreaId(), NullConnectionList), name,
|
||||||
zeus::CTransform(zeus::CMatrix3f(), pos), w2, scale, zeus::skWhite));
|
zeus::CTransform(zeus::CMatrix3f(), pos), w2, scale, zeus::skWhite));
|
||||||
|
@ -4,12 +4,10 @@
|
|||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/Graphics/CModel.hpp"
|
#include "Runtime/Graphics/CModel.hpp"
|
||||||
#include "Runtime/Particle/CParticleDataFactory.hpp"
|
#include "Runtime/Particle/CParticleDataFactory.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CDecalDataFactory");
|
|
||||||
|
|
||||||
using CPF = CParticleDataFactory;
|
using CPF = CParticleDataFactory;
|
||||||
std::unique_ptr<CDecalDescription> CDecalDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* resPool) {
|
std::unique_ptr<CDecalDescription> CDecalDataFactory::GetGeneratorDesc(CInputStream& in, CSimplePool* resPool) {
|
||||||
return CreateGeneratorDescription(in, resPool);
|
return CreateGeneratorDescription(in, resPool);
|
||||||
@ -84,7 +82,7 @@ bool CDecalDataFactory::CreateDPSM(CDecalDescription* desc, CInputStream& in, CS
|
|||||||
desc->x5c_25_DMOO = CPF::GetBool(in);
|
desc->x5c_25_DMOO = CPF::GetBool(in);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unknown DPSC class {} @{}"), clsId, in.GetReadPosition());
|
spdlog::fatal("Unknown DPSC class {} @{}", clsId, in.GetReadPosition());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,12 @@
|
|||||||
#include "Runtime/Particle/CParticleSwoosh.hpp"
|
#include "Runtime/Particle/CParticleSwoosh.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
#include "Runtime/Particle/CWarp.hpp"
|
#include "Runtime/Particle/CWarp.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#define MAX_GLOBAL_PARTICLES 2560
|
#define MAX_GLOBAL_PARTICLES 2560
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
namespace {
|
||||||
logvisor::Module Log("metaforce::CElementGen");
|
|
||||||
|
|
||||||
// constexpr std::array ShadClsSizes{
|
// constexpr std::array ShadClsSizes{
|
||||||
// sizeof(SParticleInstanceTex),
|
// sizeof(SParticleInstanceTex),
|
||||||
// sizeof(SParticleInstanceIndTex),
|
// sizeof(SParticleInstanceIndTex),
|
||||||
@ -244,7 +243,7 @@ bool CElementGen::Update(double t) {
|
|||||||
if (pswtElem && !x26d_25_warmedUp) {
|
if (pswtElem && !x26d_25_warmedUp) {
|
||||||
int pswt = 0;
|
int pswt = 0;
|
||||||
pswtElem->GetValue(x74_curFrame, pswt);
|
pswtElem->GetValue(x74_curFrame, pswt);
|
||||||
// Log.report(logvisor::Info, FMT_STRING("Running warmup on particle system 0x%08x for %d ticks."), desc, pswt);
|
// spdlog::info("Running warmup on particle system 0x%08x for %d ticks.", desc, pswt);
|
||||||
InternalUpdate((1.f / 60.f) * pswt);
|
InternalUpdate((1.f / 60.f) * pswt);
|
||||||
x26d_25_warmedUp = true;
|
x26d_25_warmedUp = true;
|
||||||
}
|
}
|
||||||
@ -367,8 +366,7 @@ void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 par
|
|||||||
CGenDescription* desc = x28_loadedGenDesc;
|
CGenDescription* desc = x28_loadedGenDesc;
|
||||||
|
|
||||||
if (activeParticleCount >= x60_advValues.size()) {
|
if (activeParticleCount >= x60_advValues.size()) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"), activeParticleCount,
|
spdlog::fatal("activeParticleCount ({}) >= advValues size ({})", activeParticleCount, x60_advValues.size());
|
||||||
x60_advValues.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<float, 8>& arr = x60_advValues[activeParticleCount];
|
std::array<float, 8>& arr = x60_advValues[activeParticleCount];
|
||||||
@ -838,7 +836,7 @@ u32 CElementGen::GetSystemCount() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CElementGen::Render() {
|
void CElementGen::Render() {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::Render {}"), *x1c_genDesc.GetObjectTag()).c_str(),
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::Render {}", *x1c_genDesc.GetObjectTag()).c_str(),
|
||||||
zeus::skYellow);
|
zeus::skYellow);
|
||||||
|
|
||||||
CGenDescription* desc = x1c_genDesc.GetObj();
|
CGenDescription* desc = x1c_genDesc.GetObj();
|
||||||
@ -868,7 +866,7 @@ void CElementGen::Render() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CElementGen::RenderModels() {
|
void CElementGen::RenderModels() {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderModels")).c_str(), zeus::skYellow);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderModels").c_str(), zeus::skYellow);
|
||||||
|
|
||||||
CParticleGlobals::instance()->m_particleAccessParameters = nullptr;
|
CParticleGlobals::instance()->m_particleAccessParameters = nullptr;
|
||||||
if (x26d_26_modelsUseLights) {
|
if (x26d_26_modelsUseLights) {
|
||||||
@ -1093,7 +1091,7 @@ void CElementGen::RenderModels() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CElementGen::RenderLines() {
|
void CElementGen::RenderLines() {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderLines")).c_str(), zeus::skYellow);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderLines").c_str(), zeus::skYellow);
|
||||||
|
|
||||||
CGenDescription* desc = x1c_genDesc.GetObj();
|
CGenDescription* desc = x1c_genDesc.GetObj();
|
||||||
CGlobalRandom gr(x27c_randState);
|
CGlobalRandom gr(x27c_randState);
|
||||||
@ -1202,7 +1200,7 @@ void CElementGen::RenderParticles() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderParticles")).c_str(), zeus::skYellow);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderParticles").c_str(), zeus::skYellow);
|
||||||
|
|
||||||
CRealElement* size = desc->x4c_x38_SIZE.get();
|
CRealElement* size = desc->x4c_x38_SIZE.get();
|
||||||
if (size && size->IsConstant()) {
|
if (size && size->IsConstant()) {
|
||||||
@ -1526,7 +1524,7 @@ void CElementGen::RenderParticles() {
|
|||||||
// g_instNoTexData.reserve(x30_particles.size() * mbspVal);
|
// g_instNoTexData.reserve(x30_particles.size() * mbspVal);
|
||||||
// break;
|
// break;
|
||||||
// default:
|
// default:
|
||||||
// Log.report(logvisor::Fatal, FMT_STRING("unexpected particle shader class"));
|
// spdlog::fatal("unexpected particle shader class");
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
const float mbspFac = 1.f / float(mbspVal);
|
const float mbspFac = 1.f / float(mbspVal);
|
||||||
@ -1640,7 +1638,7 @@ void CElementGen::RenderParticles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CElementGen::RenderParticlesIndirectTexture() {
|
void CElementGen::RenderParticlesIndirectTexture() {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CElementGen::RenderParticlesIndirectTexture")).c_str(), zeus::skYellow);
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CElementGen::RenderParticlesIndirectTexture").c_str(), zeus::skYellow);
|
||||||
|
|
||||||
CGenDescription* desc = x1c_genDesc.GetObj();
|
CGenDescription* desc = x1c_genDesc.GetObj();
|
||||||
|
|
||||||
|
@ -7,12 +7,10 @@
|
|||||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||||
#include "Runtime/Particle/CGenDescription.hpp"
|
#include "Runtime/Particle/CGenDescription.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CParticleDataFactory");
|
|
||||||
|
|
||||||
float CParticleDataFactory::GetReal(CInputStream& in) { return in.ReadFloat(); }
|
float CParticleDataFactory::GetReal(CInputStream& in) { return in.ReadFloat(); }
|
||||||
|
|
||||||
s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); }
|
s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); }
|
||||||
@ -20,7 +18,7 @@ s32 CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); }
|
|||||||
bool CParticleDataFactory::GetBool(CInputStream& in) {
|
bool CParticleDataFactory::GetBool(CInputStream& in) {
|
||||||
FourCC cid = GetClassID(in);
|
FourCC cid = GetClassID(in);
|
||||||
if (cid != FOURCC('CNST'))
|
if (cid != FOURCC('CNST'))
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("bool element does not begin with CNST"));
|
spdlog::fatal("bool element does not begin with CNST");
|
||||||
return in.ReadBool();
|
return in.ReadBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1003,7 +1001,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i
|
|||||||
fillDesc->xec_xd8_SELC = GetElectricGeneratorDesc(in, resPool);
|
fillDesc->xec_xd8_SELC = GetElectricGeneratorDesc(in, resPool);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unknown GPSM class {} @{}"), clsId, in.GetReadPosition());
|
spdlog::fatal("Unknown GPSM class {} @{}", clsId, in.GetReadPosition());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ bool CParticleElectric::Update(double dt) {
|
|||||||
|
|
||||||
void CParticleElectric::Render() {
|
void CParticleElectric::Render() {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||||
fmt::format(FMT_STRING("CParticleElectric::Render {}"), *x1c_elecDesc.GetObjectTag()).c_str(), zeus::skYellow);
|
fmt::format("CParticleElectric::Render {}", *x1c_elecDesc.GetObjectTag()).c_str(), zeus::skYellow);
|
||||||
|
|
||||||
if (!x3e8_electricManagers.empty()) {
|
if (!x3e8_electricManagers.empty()) {
|
||||||
if (x450_29_transformDirty) {
|
if (x450_29_transformDirty) {
|
||||||
|
@ -5,12 +5,10 @@
|
|||||||
#include "Runtime/CToken.hpp"
|
#include "Runtime/CToken.hpp"
|
||||||
#include "Runtime/Graphics/CModel.hpp"
|
#include "Runtime/Graphics/CModel.hpp"
|
||||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CParticleElectricDataFactory");
|
|
||||||
|
|
||||||
using CPF = CParticleDataFactory;
|
using CPF = CParticleDataFactory;
|
||||||
|
|
||||||
std::unique_ptr<CElectricDescription> CParticleElectricDataFactory::GetGeneratorDesc(CInputStream& in,
|
std::unique_ptr<CElectricDescription> CParticleElectricDataFactory::GetGeneratorDesc(CInputStream& in,
|
||||||
@ -106,7 +104,7 @@ bool CParticleElectricDataFactory::CreateELSM(CElectricDescription* desc, CInput
|
|||||||
desc->x70_ZERY = CPF::GetBool(in);
|
desc->x70_ZERY = CPF::GetBool(in);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unknown ELSM class {} @{}"), clsId, in.GetReadPosition());
|
spdlog::fatal("Unknown ELSM class {} @{}", clsId, in.GetReadPosition());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "Runtime/RetroTypes.hpp"
|
#include "Runtime/RetroTypes.hpp"
|
||||||
|
|
||||||
|
@ -933,7 +933,7 @@ void CParticleSwoosh::Render() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CParticleSwoosh::Render {}"), *x1c_desc.GetObjectTag()).c_str(),
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CParticleSwoosh::Render {}", *x1c_desc.GetObjectTag()).c_str(),
|
||||||
zeus::skYellow);
|
zeus::skYellow);
|
||||||
|
|
||||||
m_cachedVerts.clear();
|
m_cachedVerts.clear();
|
||||||
|
@ -6,12 +6,10 @@
|
|||||||
#include "Runtime/Particle/CElectricDescription.hpp"
|
#include "Runtime/Particle/CElectricDescription.hpp"
|
||||||
#include "Runtime/Particle/CGenDescription.hpp"
|
#include "Runtime/Particle/CGenDescription.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CParticleSwooshDataFactory");
|
|
||||||
|
|
||||||
using CPF = CParticleDataFactory;
|
using CPF = CParticleDataFactory;
|
||||||
|
|
||||||
std::unique_ptr<CSwooshDescription> CParticleSwooshDataFactory::GetGeneratorDesc(CInputStream& in,
|
std::unique_ptr<CSwooshDescription> CParticleSwooshDataFactory::GetGeneratorDesc(CInputStream& in,
|
||||||
@ -124,7 +122,7 @@ bool CParticleSwooshDataFactory::CreateWPSM(CSwooshDescription* desc, CInputStre
|
|||||||
desc->x45_26_CRND = CPF::GetBool(in);
|
desc->x45_26_CRND = CPF::GetBool(in);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unknown SWSH class {} @{}"), clsId, in.GetReadPosition());
|
spdlog::fatal("Unknown SWSH class {} @{}", clsId, in.GetReadPosition());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,10 @@
|
|||||||
#include "Runtime/Particle/CGenDescription.hpp"
|
#include "Runtime/Particle/CGenDescription.hpp"
|
||||||
#include "Runtime/Particle/CSwooshDescription.hpp"
|
#include "Runtime/Particle/CSwooshDescription.hpp"
|
||||||
#include "Runtime/Particle/CWeaponDescription.hpp"
|
#include "Runtime/Particle/CWeaponDescription.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CProjectileWeaponDataFactory");
|
|
||||||
|
|
||||||
using CPF = CParticleDataFactory;
|
using CPF = CParticleDataFactory;
|
||||||
|
|
||||||
std::unique_ptr<CWeaponDescription> CProjectileWeaponDataFactory::GetGeneratorDesc(CInputStream& in,
|
std::unique_ptr<CWeaponDescription> CProjectileWeaponDataFactory::GetGeneratorDesc(CInputStream& in,
|
||||||
@ -160,7 +158,7 @@ bool CProjectileWeaponDataFactory::CreateWPSM(CWeaponDescription* desc, CInputSt
|
|||||||
desc->x29_FC60 = CPF::GetBool(in);
|
desc->x29_FC60 = CPF::GetBool(in);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unknown WPSM class {} @{}"), clsId, in.GetReadPosition());
|
spdlog::fatal("Unknown WPSM class {} @{}", clsId, in.GetReadPosition());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
#include "Runtime/Streams/IOStreams.hpp"
|
#include "Runtime/Streams/IOStreams.hpp"
|
||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
#include "Runtime/IMain.hpp"
|
#include "Runtime/IMain.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
logvisor::Module Log("metaforce::RetroTypes::CAssetId");
|
|
||||||
|
|
||||||
SObjectTag::SObjectTag(CInputStream& in) {
|
SObjectTag::SObjectTag(CInputStream& in) {
|
||||||
in.ReadBytes(reinterpret_cast<u8*>(&type), 4);
|
in.ReadBytes(reinterpret_cast<u8*>(&type), 4);
|
||||||
id = in.Get<CAssetId>();
|
id = in.Get<CAssetId>();
|
||||||
@ -25,10 +22,10 @@ CAssetId::CAssetId(CInputStream& in) {
|
|||||||
} else if (g_Main->GetExpectedIdSize() == sizeof(u64)) {
|
} else if (g_Main->GetExpectedIdSize() == sizeof(u64)) {
|
||||||
Assign(in.ReadLongLong());
|
Assign(in.ReadLongLong());
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unsupported id length {}"), g_Main->GetExpectedIdSize());
|
spdlog::fatal("Unsupported id length {}", g_Main->GetExpectedIdSize());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Input constructor called before runtime Main entered!"));
|
spdlog::fatal("Input constructor called before runtime Main entered!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,10 +36,10 @@ void CAssetId::PutTo(COutputStream& out) const {
|
|||||||
} else if (g_Main->GetExpectedIdSize() == sizeof(u64)) {
|
} else if (g_Main->GetExpectedIdSize() == sizeof(u64)) {
|
||||||
out.Put(id);
|
out.Put(id);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unsupported id length {}"), g_Main->GetExpectedIdSize());
|
spdlog::fatal("Unsupported id length {}", g_Main->GetExpectedIdSize());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("PutTo called before runtime Main entered!"));
|
spdlog::fatal("PutTo called before runtime Main entered!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,19 +3,11 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "GCNTypes.hpp"
|
#include "GCNTypes.hpp"
|
||||||
#include "rstl.hpp"
|
#include "rstl.hpp"
|
||||||
|
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
#include <zeus/CMatrix3f.hpp>
|
|
||||||
#include <zeus/CMatrix4f.hpp>
|
|
||||||
#include <zeus/CTransform.hpp>
|
|
||||||
#include <zeus/CVector2f.hpp>
|
|
||||||
#include <zeus/CVector3f.hpp>
|
|
||||||
|
|
||||||
#undef min
|
#undef min
|
||||||
#undef max
|
#undef max
|
||||||
|
|
||||||
@ -108,7 +100,8 @@ constexpr double SBig(double val) noexcept {
|
|||||||
return uval2.f;
|
return uval2.f;
|
||||||
}
|
}
|
||||||
#ifndef SBIG
|
#ifndef SBIG
|
||||||
#define SBIG(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)
|
#define SBIG(q) \
|
||||||
|
(((q) & 0x000000FF) << 24 | ((q) & 0x0000FF00) << 8 | ((q) & 0x00FF0000) >> 8 | ((q) & 0xFF000000) >> 24)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr int16_t SLittle(int16_t val) noexcept { return val; }
|
constexpr int16_t SLittle(int16_t val) noexcept { return val; }
|
||||||
@ -138,7 +131,8 @@ constexpr double SLittle(double val) noexcept {
|
|||||||
return *((double*)(&ival));
|
return *((double*)(&ival));
|
||||||
}
|
}
|
||||||
#ifndef SLITTLE
|
#ifndef SLITTLE
|
||||||
#define SLITTLE(q) (((q)&0x000000FF) << 24 | ((q)&0x0000FF00) << 8 | ((q)&0x00FF0000) >> 8 | ((q)&0xFF000000) >> 24)
|
#define SLITTLE(q) \
|
||||||
|
(((q) & 0x000000FF) << 24 | ((q) & 0x0000FF00) << 8 | ((q) & 0x00FF0000) >> 8 | ((q) & 0xFF000000) >> 24)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr int16_t SBig(int16_t val) noexcept { return val; }
|
constexpr int16_t SBig(int16_t val) noexcept { return val; }
|
||||||
@ -332,7 +326,6 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] size_t Size() const { return this->size(); }
|
[[nodiscard]] size_t Size() const { return this->size(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
@ -352,40 +345,6 @@ struct hash<metaforce::CAssetId> {
|
|||||||
};
|
};
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
FMT_CUSTOM_FORMATTER(metaforce::CAssetId, "{:08X}", obj.Value())
|
|
||||||
FMT_CUSTOM_FORMATTER(metaforce::TEditorId, "{:08X}", obj.id)
|
|
||||||
static_assert(sizeof(metaforce::kUniqueIdType) == sizeof(u16),
|
|
||||||
"TUniqueId size does not match expected size! Update TUniqueId format string!");
|
|
||||||
FMT_CUSTOM_FORMATTER(metaforce::TUniqueId, "{:04X}", obj.id)
|
|
||||||
FMT_CUSTOM_FORMATTER(metaforce::FourCC, "{:c}{:c}{:c}{:c}", obj.getChars()[0], obj.getChars()[1], obj.getChars()[2],
|
|
||||||
obj.getChars()[3])
|
|
||||||
FMT_CUSTOM_FORMATTER(metaforce::SObjectTag, "{} {}", obj.type, obj.id)
|
|
||||||
|
|
||||||
FMT_CUSTOM_FORMATTER(zeus::CVector3f, "({} {} {})", float(obj.x()), float(obj.y()), float(obj.z()))
|
|
||||||
FMT_CUSTOM_FORMATTER(zeus::CVector2f, "({} {})", float(obj.x()), float(obj.y()))
|
|
||||||
FMT_CUSTOM_FORMATTER(zeus::CMatrix3f,
|
|
||||||
"\n({} {} {})"
|
|
||||||
"\n({} {} {})"
|
|
||||||
"\n({} {} {})",
|
|
||||||
float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[0][1]), float(obj[1][1]),
|
|
||||||
float(obj[2][1]), float(obj[0][2]), float(obj[1][2]), float(obj[2][2]))
|
|
||||||
FMT_CUSTOM_FORMATTER(zeus::CMatrix4f,
|
|
||||||
"\n({} {} {} {})"
|
|
||||||
"\n({} {} {} {})"
|
|
||||||
"\n({} {} {} {})"
|
|
||||||
"\n({} {} {} {})",
|
|
||||||
float(obj[0][0]), float(obj[1][0]), float(obj[2][0]), float(obj[3][0]), float(obj[0][1]),
|
|
||||||
float(obj[1][1]), float(obj[2][1]), float(obj[3][1]), float(obj[0][2]), float(obj[1][2]),
|
|
||||||
float(obj[2][2]), float(obj[3][2]), float(obj[0][3]), float(obj[1][3]), float(obj[2][3]),
|
|
||||||
float(obj[3][3]))
|
|
||||||
FMT_CUSTOM_FORMATTER(zeus::CTransform,
|
|
||||||
"\n({} {} {} {})"
|
|
||||||
"\n({} {} {} {})"
|
|
||||||
"\n({} {} {} {})",
|
|
||||||
float(obj.basis[0][0]), float(obj.basis[1][0]), float(obj.basis[2][0]), float(obj.origin[0]),
|
|
||||||
float(obj.basis[0][1]), float(obj.basis[1][1]), float(obj.basis[2][1]), float(obj.origin[1]),
|
|
||||||
float(obj.basis[0][2]), float(obj.basis[1][2]), float(obj.basis[2][2]), float(obj.origin[2]))
|
|
||||||
|
|
||||||
#if defined(__has_feature)
|
#if defined(__has_feature)
|
||||||
#if __has_feature(memory_sanitizer)
|
#if __has_feature(memory_sanitizer)
|
||||||
#define URDE_MSAN 1
|
#define URDE_MSAN 1
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__
|
#if METAFORCE_TARGET_BYTE_ORDER == __ORDER_LITTLE_ENDIAN__
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NDEBUG
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::CInputStream");
|
|
||||||
|
|
||||||
static u32 min_containing_bytes(u32 v) {
|
static u32 min_containing_bytes(u32 v) {
|
||||||
v = 32 - v;
|
v = 32 - v;
|
||||||
v = (v >> 3) - (static_cast<s32>(-(v & 7)) >> 31);
|
v = (v >> 3) - (static_cast<s32>(-(v & 7)) >> 31);
|
||||||
@ -51,7 +51,7 @@ void CInputStream::Get(u8* dest, u32 len) {
|
|||||||
u32 readLen = Read(dest + readCount, len);
|
u32 readLen = Read(dest + readCount, len);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (readLen == 0) {
|
if (readLen == 0) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Invalid read size!"));
|
spdlog::fatal("Invalid read size!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -112,8 +112,7 @@ u32 CInputStream::ReadBits(u32 bitCount) {
|
|||||||
const u32 mask2 = shiftAmt == 32 ? 0xffffffff : (1 << shiftAmt) - 1;
|
const u32 mask2 = shiftAmt == 32 ? 0xffffffff : (1 << shiftAmt) - 1;
|
||||||
u32 tmp = x20_bitOffset;
|
u32 tmp = x20_bitOffset;
|
||||||
x20_bitOffset = len * 8;
|
x20_bitOffset = len * 8;
|
||||||
ret = ((mask & (bitWord >> (32 - bitOffset))) << shiftAmt) |
|
ret = ((mask & (bitWord >> (32 - bitOffset))) << shiftAmt) | ((mask2 & (x1c_bitWord >> (32 - shiftAmt))) << tmp);
|
||||||
((mask2 & (x1c_bitWord >> (32 - shiftAmt))) << tmp);
|
|
||||||
x20_bitOffset -= shiftAmt;
|
x20_bitOffset -= shiftAmt;
|
||||||
x1c_bitWord <<= u64(shiftAmt);
|
x1c_bitWord <<= u64(shiftAmt);
|
||||||
} else {
|
} else {
|
||||||
|
@ -212,7 +212,7 @@ void CEnergyProjectile::Think(float dt, CStateManager& mgr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CEnergyProjectile::Render(CStateManager& mgr) {
|
void CEnergyProjectile::Render(CStateManager& mgr) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CEnergyProjectile::Render WPSC_{}"), x2cc_wpscId).c_str(),
|
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format("CEnergyProjectile::Render WPSC_{}", x2cc_wpscId).c_str(),
|
||||||
zeus::skOrange);
|
zeus::skOrange);
|
||||||
|
|
||||||
const auto visor = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
const auto visor = mgr.GetPlayerState()->GetActiveVisor(mgr);
|
||||||
|
@ -228,7 +228,7 @@ void CNewFlameThrower::RenderParticles(std::array<CElementGen*, 5> const& elem_g
|
|||||||
active_particle_count++;
|
active_particle_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.report(logvisor::Info, FMT_STRING("Active particle count (render count) {}"), active_particle_count);
|
Log.report(logvisor::Info, "Active particle count (render count) {}", active_particle_count);
|
||||||
std::sort(translated_sorted_particles, translated_sorted_particles + active_particle_count,
|
std::sort(translated_sorted_particles, translated_sorted_particles + active_particle_count,
|
||||||
[](ParticleElement const& l, ParticleElement const& r) { return l.vec.y() > r.vec.y(); });
|
[](ParticleElement const& l, ParticleElement const& r) { return l.vec.y() > r.vec.y(); });
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ void CActor::DrawTouchBounds() {
|
|||||||
|
|
||||||
void CActor::RenderInternal(const CStateManager& mgr) const {
|
void CActor::RenderInternal(const CStateManager& mgr) const {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||||
fmt::format(FMT_STRING("CActor::RenderInternal {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(),
|
fmt::format("CActor::RenderInternal {} {} {}", x8_uid, xc_editorId, x10_name).c_str(),
|
||||||
zeus::skOrange);
|
zeus::skOrange);
|
||||||
|
|
||||||
CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr);
|
CModelData::EWhichModel which = CModelData::GetRenderingModel(mgr);
|
||||||
|
@ -596,7 +596,7 @@ void CFishCloud::Render(CStateManager& mgr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||||
fmt::format(FMT_STRING("CFishCloud::Render {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange);
|
fmt::format("CFishCloud::Render {} {} {}", x8_uid, xc_editorId, x10_name).c_str(), zeus::skOrange);
|
||||||
|
|
||||||
const bool thermalHot = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot;
|
const bool thermalHot = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot;
|
||||||
CModelFlags flags(0, 0, 3, zeus::skWhite);
|
CModelFlags flags(0, 0, 3, zeus::skWhite);
|
||||||
|
@ -9,14 +9,12 @@
|
|||||||
#include "Runtime/GameGlobalObjects.hpp"
|
#include "Runtime/GameGlobalObjects.hpp"
|
||||||
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
#include "Runtime/Graphics/CCubeRenderer.hpp"
|
||||||
#include "Runtime/Graphics/CCubeSurface.hpp"
|
#include "Runtime/Graphics/CCubeSurface.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include "Runtime/World/CScriptAreaAttributes.hpp"
|
#include "Runtime/World/CScriptAreaAttributes.hpp"
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
static logvisor::Module Log("CGameArea");
|
|
||||||
|
|
||||||
CAreaRenderOctTree::CAreaRenderOctTree(const u8* buf) : x0_buf(buf) {
|
CAreaRenderOctTree::CAreaRenderOctTree(const u8* buf) : x0_buf(buf) {
|
||||||
CMemoryInStream r(x0_buf + 8, INT32_MAX);
|
CMemoryInStream r(x0_buf + 8, INT32_MAX);
|
||||||
x8_bitmapCount = r.ReadLong();
|
x8_bitmapCount = r.ReadLong();
|
||||||
@ -259,7 +257,7 @@ std::pair<std::unique_ptr<u8[]>, s32> GetScriptingMemoryAlways(const IGameArea&
|
|||||||
CMemoryInStream r(data.get() + 4, 96 - 4);
|
CMemoryInStream r(data.get() + 4, 96 - 4);
|
||||||
u32 version = r.ReadLong();
|
u32 version = r.ReadLong();
|
||||||
if ((version & 0x10000) == 0) {
|
if ((version & 0x10000) == 0) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Attempted to load non-URDE MREA"));
|
spdlog::fatal("Attempted to load non-URDE MREA");
|
||||||
}
|
}
|
||||||
version &= ~0x10000;
|
version &= ~0x10000;
|
||||||
|
|
||||||
@ -1091,7 +1089,7 @@ SMREAHeader CGameArea::VerifyHeader() const {
|
|||||||
CMemoryInStream r(x110_mreaSecBufs[0].first.get() + 4, x110_mreaSecBufs[0].second - 4);
|
CMemoryInStream r(x110_mreaSecBufs[0].first.get() + 4, x110_mreaSecBufs[0].second - 4);
|
||||||
u32 version = r.ReadLong();
|
u32 version = r.ReadLong();
|
||||||
if ((version & 0x10000) != 0) {
|
if ((version & 0x10000) != 0) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Attempted to load non-retail MREA"));
|
spdlog::fatal("Attempted to load non-retail MREA");
|
||||||
}
|
}
|
||||||
|
|
||||||
SMREAHeader header;
|
SMREAHeader header;
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
#include "Runtime/World/CPathFindArea.hpp"
|
#include "Runtime/World/CPathFindArea.hpp"
|
||||||
|
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Logging.hpp"
|
||||||
|
|
||||||
#include "Runtime/CToken.hpp"
|
#include "Runtime/CToken.hpp"
|
||||||
#include "Runtime/IVParamObj.hpp"
|
#include "Runtime/IVParamObj.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
|
||||||
static logvisor::Module Log("CPathFindArea");
|
|
||||||
|
|
||||||
CPFAreaOctree::CPFAreaOctree(CMemoryInStream& in) {
|
CPFAreaOctree::CPFAreaOctree(CMemoryInStream& in) {
|
||||||
x0_isLeaf = in.ReadLong();
|
x0_isLeaf = in.ReadLong();
|
||||||
x4_aabb = in.Get<zeus::CAABox>();
|
x4_aabb = in.Get<zeus::CAABox>();
|
||||||
@ -127,7 +123,7 @@ CPFArea::CPFArea(std::unique_ptr<u8[]>&& buf, u32 len) {
|
|||||||
|
|
||||||
u32 version = r.ReadLong();
|
u32 version = r.ReadLong();
|
||||||
if (version != 4)
|
if (version != 4)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("Unexpected PATH version {}, should be 4"), version);
|
spdlog::fatal("Unexpected PATH version {}, should be 4", version);
|
||||||
|
|
||||||
u32 numNodes = r.ReadLong();
|
u32 numNodes = r.ReadLong();
|
||||||
x140_nodes.reserve(numNodes);
|
x140_nodes.reserve(numNodes);
|
||||||
|
@ -93,7 +93,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst) {
|
|||||||
q += mst.xc_orientation;
|
q += mst.xc_orientation;
|
||||||
zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
|
zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
|
||||||
// if (TCastToPtr<CPlayer>(this)) {
|
// if (TCastToPtr<CPlayer>(this)) {
|
||||||
// fmt::print(FMT_STRING("ADD {}\n"), mst.x0_translation);
|
// spdlog::debug("ADD {}\n", mst.x0_translation);
|
||||||
// }
|
// }
|
||||||
SetTransform(zeus::CTransform(quat, x34_transform.origin));
|
SetTransform(zeus::CTransform(quat, x34_transform.origin));
|
||||||
|
|
||||||
|
@ -29,15 +29,12 @@
|
|||||||
#include "Runtime/World/CScriptGrapplePoint.hpp"
|
#include "Runtime/World/CScriptGrapplePoint.hpp"
|
||||||
#include "Runtime/World/CScriptPlayerHint.hpp"
|
#include "Runtime/World/CScriptPlayerHint.hpp"
|
||||||
#include "Runtime/World/CScriptWater.hpp"
|
#include "Runtime/World/CScriptWater.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
|
||||||
|
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
namespace {
|
||||||
logvisor::Module Log("metaforce::CPlayer");
|
|
||||||
|
|
||||||
constexpr CMaterialFilter SolidMaterialFilter = CMaterialFilter::MakeInclude(CMaterialList(EMaterialTypes::Solid));
|
constexpr CMaterialFilter SolidMaterialFilter = CMaterialFilter::MakeInclude(CMaterialList(EMaterialTypes::Solid));
|
||||||
|
|
||||||
constexpr CMaterialFilter LineOfSightFilter = CMaterialFilter::MakeIncludeExclude(
|
constexpr CMaterialFilter LineOfSightFilter = CMaterialFilter::MakeIncludeExclude(
|
||||||
@ -3944,7 +3941,7 @@ void CPlayer::SetOrbitState(EPlayerOrbitState state, CStateManager& mgr) {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x310_orbitTargetId != kInvalidUniqueId) {
|
if (x310_orbitTargetId != kInvalidUniqueId) {
|
||||||
if (const CEntity* ent = mgr.GetObjectById(x310_orbitTargetId)) {
|
if (const CEntity* ent = mgr.GetObjectById(x310_orbitTargetId)) {
|
||||||
Log.report(logvisor::Info, FMT_STRING("Orbiting {} {}"), ent->GetEditorId(), ent->GetName());
|
Log.report(logvisor::Info, "Orbiting {} {}", ent->GetEditorId(), ent->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -406,7 +406,7 @@ void CScriptGunTurret::SetTurretState(ETurretState state, CStateManager& mgr) {
|
|||||||
|
|
||||||
if (state != ETurretState::Invalid && x520_state != state) {
|
if (state != ETurretState::Invalid && x520_state != state) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fmt::print(FMT_STRING("{} {} {} - {}\n"), GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]);
|
spdlog::debug("{} {} {} - {}\n", GetUniqueId(), GetEditorId(), GetName(), StateNames[size_t(state)]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void CScriptStreamedMusic::StartStream(CStateManager& mgr) {
|
|||||||
void CScriptStreamedMusic::TweakOverride(CStateManager& mgr) {
|
void CScriptStreamedMusic::TweakOverride(CStateManager& mgr) {
|
||||||
const CWorld* wld = mgr.GetWorld();
|
const CWorld* wld = mgr.GetWorld();
|
||||||
const CGameArea* area = wld->GetAreaAlways(x4_areaId);
|
const CGameArea* area = wld->GetAreaAlways(x4_areaId);
|
||||||
std::string twkName = fmt::format(FMT_STRING("Area {} MusicObject: {}"), area->GetAreaAssetId(), x10_name);
|
std::string twkName = fmt::format("Area {} MusicObject: {}", area->GetAreaAssetId(), x10_name);
|
||||||
if (g_TweakManager->HasTweakValue(twkName)) {
|
if (g_TweakManager->HasTweakValue(twkName)) {
|
||||||
const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio();
|
const CTweakValue::Audio& audio = g_TweakManager->GetTweakValue(twkName)->GetAudio();
|
||||||
x34_fileName = audio.GetFileName();
|
x34_fileName = audio.GetFileName();
|
||||||
|
@ -5,12 +5,10 @@
|
|||||||
#include "Runtime/Weapon/CGameProjectile.hpp"
|
#include "Runtime/Weapon/CGameProjectile.hpp"
|
||||||
#include "Runtime/World/CActorParameters.hpp"
|
#include "Runtime/World/CActorParameters.hpp"
|
||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
#include <logvisor/logvisor.hpp>
|
#include "Runtime/Logging.hpp"
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("CScriptTrigger");
|
|
||||||
|
|
||||||
CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo,
|
const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo,
|
||||||
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active,
|
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active,
|
||||||
@ -28,7 +26,7 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// HACK: For some reason MetroidPrime's lair doesn't enable this trigger until after the cutscene, activate it in debug build
|
// HACK: For some reason MetroidPrime's lair doesn't enable this trigger until after the cutscene, activate it in debug build
|
||||||
if (GetEditorId() == 0x000B01DB && !GetActive()) {
|
if (GetEditorId() == 0x000B01DB && !GetActive()) {
|
||||||
Log.report(logvisor::Warning, FMT_STRING("BUG THIS!: Overriding active for trigger {} in area {}"), GetEditorId(),
|
Log.report(logvisor::Warning, "BUG THIS!: Overriding active for trigger {} in area {}", GetEditorId(),
|
||||||
GetAreaIdAlways());
|
GetAreaIdAlways());
|
||||||
SetActive(true);
|
SetActive(true);
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
#include "Runtime/CStateManager.hpp"
|
#include "Runtime/CStateManager.hpp"
|
||||||
#include "Runtime/World/CAi.hpp"
|
#include "Runtime/World/CAi.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
#include "ConsoleVariables/CVarManager.hpp"
|
#include "ConsoleVariables/CVarManager.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace {
|
|
||||||
logvisor::Module Log("metaforce::CStateMachine");
|
|
||||||
}
|
|
||||||
|
|
||||||
CStateMachine::CStateMachine(CInputStream& in) {
|
CStateMachine::CStateMachine(CInputStream& in) {
|
||||||
CAiTrigger* lastTrig = nullptr;
|
CAiTrigger* lastTrig = nullptr;
|
||||||
u32 stateCount = in.ReadLong();
|
u32 stateCount = in.ReadLong();
|
||||||
@ -99,8 +97,8 @@ void CStateMachineState::Update(CStateManager& mgr, CAi& ai, float delta) {
|
|||||||
if (andPassed && state != nullptr) {
|
if (andPassed && state != nullptr) {
|
||||||
x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f);
|
x4_state->CallFunc(mgr, ai, EStateMsg::Deactivate, 0.f);
|
||||||
x4_state = state;
|
x4_state = state;
|
||||||
Log.report(logvisor::Info, FMT_STRING("{} {} {} - {} {}"), ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(),
|
spdlog::info("{} {} {} - {} {}", ai.GetUniqueId(), ai.GetEditorId(), ai.GetName(), state->xc_name,
|
||||||
state->xc_name, int(state - x0_machine->GetStateVector().data()));
|
int(state - x0_machine->GetStateVector().data()));
|
||||||
x8_time = 0.f;
|
x8_time = 0.f;
|
||||||
x18_24_codeTrigger = false;
|
x18_24_codeTrigger = false;
|
||||||
xc_random = mgr.GetActiveRandom()->Float();
|
xc_random = mgr.GetActiveRandom()->Float();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Runtime/CToken.hpp"
|
#include "Runtime/CToken.hpp"
|
||||||
|
@ -1070,7 +1070,7 @@ void CWallCrawlerSwarm::RenderBoid(const CBoid* boid, u32& drawMask, bool therma
|
|||||||
|
|
||||||
void CWallCrawlerSwarm::Render(CStateManager& mgr) {
|
void CWallCrawlerSwarm::Render(CStateManager& mgr) {
|
||||||
SCOPED_GRAPHICS_DEBUG_GROUP(
|
SCOPED_GRAPHICS_DEBUG_GROUP(
|
||||||
fmt::format(FMT_STRING("CWallCrawlerSwarm::Render {} {} {}"), x8_uid, xc_editorId, x10_name).c_str(),
|
fmt::format("CWallCrawlerSwarm::Render {} {} {}", x8_uid, xc_editorId, x10_name).c_str(),
|
||||||
zeus::skOrange);
|
zeus::skOrange);
|
||||||
u32 drawMask = 0xffffffff;
|
u32 drawMask = 0xffffffff;
|
||||||
const bool r24 = x560_24_enableLighting;
|
const bool r24 = x560_24_enableLighting;
|
||||||
|
@ -357,7 +357,7 @@ bool CWorld::CheckWorldComplete(CStateManager* mgr, TAreaId id, CAssetId mreaId)
|
|||||||
|
|
||||||
if (version > 12) {
|
if (version > 12) {
|
||||||
x84_defAudioTrack = r.Get<std::string>();
|
x84_defAudioTrack = r.Get<std::string>();
|
||||||
std::string trackKey = fmt::format(FMT_STRING("WorldDefault: {}"), x8_mlvlId);
|
std::string trackKey = fmt::format("WorldDefault: {}", x8_mlvlId);
|
||||||
if (g_TweakManager->HasTweakValue(trackKey))
|
if (g_TweakManager->HasTweakValue(trackKey))
|
||||||
x84_defAudioTrack = g_TweakManager->GetTweakValue(trackKey)->GetAudio().GetFileName();
|
x84_defAudioTrack = g_TweakManager->GetTweakValue(trackKey)->GetAudio().GetFileName();
|
||||||
}
|
}
|
||||||
|
@ -125,18 +125,17 @@
|
|||||||
#include "Runtime/World/CTeamAiMgr.hpp"
|
#include "Runtime/World/CTeamAiMgr.hpp"
|
||||||
#include "Runtime/World/CWallCrawlerSwarm.hpp"
|
#include "Runtime/World/CWallCrawlerSwarm.hpp"
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
|
#include "Runtime/Logging.hpp"
|
||||||
|
#include "Runtime/Formatting.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
static logvisor::Module Log("metaforce::ScriptLoader");
|
|
||||||
|
|
||||||
constexpr SObjectTag MorphballDoorANCS = {FOURCC('ANCS'), 0x1F9DA858u};
|
constexpr SObjectTag MorphballDoorANCS = {FOURCC('ANCS'), 0x1F9DA858u};
|
||||||
|
|
||||||
constexpr int skElitePiratePropCount = 41;
|
constexpr int skElitePiratePropCount = 41;
|
||||||
|
|
||||||
static bool EnsurePropertyCount(int count, int expected, const char* structName) {
|
static bool EnsurePropertyCount(int count, int expected, const char* structName) {
|
||||||
if (count < expected) {
|
if (count < expected) {
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Insufficient number of props ({}/{}) for {} entity"), count, expected,
|
spdlog::warn("Insufficient number of props ({}/{}) for {} entity", count, expected, structName);
|
||||||
structName);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -688,8 +687,7 @@ CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propC
|
|||||||
s32 pitch = in.ReadInt32();
|
s32 pitch = in.ReadInt32();
|
||||||
|
|
||||||
if (soundId < 0) {
|
if (soundId < 0) {
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Invalid sound ID specified in Sound {} ({}), dropping..."), head.x0_name,
|
spdlog::warn("Invalid sound ID specified in Sound {} ({}), dropping...", head.x0_name, info.GetEditorId());
|
||||||
info.GetEditorId());
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,7 +838,7 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int
|
|||||||
|
|
||||||
CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||||
if (propCount > 25) {
|
if (propCount > 25) {
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Too many props ({} > 25) for CameraHint entity"), propCount);
|
spdlog::warn("Too many props ({} > 25) for CameraHint entity", propCount);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,9 +1332,7 @@ CEntity* ScriptLoader::LoadSpacePirate(CStateManager& mgr, CInputStream& in, int
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (animParms.GetCharacter() == 0) {
|
if (animParms.GetCharacter() == 0) {
|
||||||
Log.report(logvisor::Warning,
|
spdlog::warn("SpacePirate <{}> has AnimationInformation property with invalid character selected", head.x0_name);
|
||||||
FMT_STRING("SpacePirate <{}> has AnimationInformation property with invalid character selected"),
|
|
||||||
head.x0_name);
|
|
||||||
animParms.SetCharacter(2);
|
animParms.SetCharacter(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1565,7 +1561,7 @@ CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int
|
|||||||
|
|
||||||
CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
|
||||||
if (propCount > 15) {
|
if (propCount > 15) {
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Too many props ({} > 15) for PathCamera entity"), propCount);
|
spdlog::warn("Too many props ({} > 15) for PathCamera entity", propCount);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2452,7 +2448,7 @@ CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int
|
|||||||
CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount,
|
CEntity* ScriptLoader::LoadWorldTeleporter(CStateManager& mgr, CInputStream& in, int propCount,
|
||||||
const CEntityInfo& info) {
|
const CEntityInfo& info) {
|
||||||
if (propCount < 4 || propCount > 26) {
|
if (propCount < 4 || propCount > 26) {
|
||||||
Log.report(logvisor::Warning, FMT_STRING("Incorrect number of props for WorldTeleporter"));
|
spdlog::warn("Incorrect number of props for WorldTeleporter");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public:
|
|||||||
void push_back(const T& d) {
|
void push_back(const T& d) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == N) {
|
if (x0_size == N) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("push_back() called on full rstl::reserved_vector."));
|
spdlog::fatal("push_back() called on full rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ public:
|
|||||||
void push_back(T&& d) {
|
void push_back(T&& d) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == N) {
|
if (x0_size == N) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("push_back() called on full rstl::reserved_vector."));
|
spdlog::fatal("push_back() called on full rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ public:
|
|||||||
T& emplace_back(_Args&&... args) {
|
T& emplace_back(_Args&&... args) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == N) {
|
if (x0_size == N) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("emplace_back() called on full rstl::reserved_vector."));
|
spdlog::fatal("emplace_back() called on full rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ public:
|
|||||||
void pop_back() {
|
void pop_back() {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == 0) {
|
if (x0_size == 0) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("pop_back() called on empty rstl::reserved_vector."));
|
spdlog::fatal("pop_back() called on empty rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ public:
|
|||||||
iterator insert(const_iterator pos, const T& value) {
|
iterator insert(const_iterator pos, const T& value) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == N) {
|
if (x0_size == N) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("insert() called on full rstl::reserved_vector."));
|
spdlog::fatal("insert() called on full rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ public:
|
|||||||
iterator insert(const_iterator pos, T&& value) {
|
iterator insert(const_iterator pos, T&& value) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == N)
|
if (x0_size == N)
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("insert() called on full rstl::reserved_vector."));
|
spdlog::fatal("insert() called on full rstl::reserved_vector.");
|
||||||
#endif
|
#endif
|
||||||
auto target_it = base::_const_cast_iterator(pos);
|
auto target_it = base::_const_cast_iterator(pos);
|
||||||
if (pos == cend()) {
|
if (pos == cend()) {
|
||||||
@ -361,7 +361,7 @@ public:
|
|||||||
void resize(size_t size) {
|
void resize(size_t size) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (size > N) {
|
if (size > N) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("resize() call overflows rstl::reserved_vector."));
|
spdlog::fatal("resize() call overflows rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ public:
|
|||||||
void resize(size_t size, const T& value) {
|
void resize(size_t size, const T& value) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (size > N) {
|
if (size > N) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("resize() call overflows rstl::reserved_vector."));
|
spdlog::fatal("resize() call overflows rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ public:
|
|||||||
iterator erase(const_iterator pos) {
|
iterator erase(const_iterator pos) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (x0_size == 0) {
|
if (x0_size == 0) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("erase() called on empty rstl::reserved_vector."));
|
spdlog::fatal("erase() called on empty rstl::reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ public:
|
|||||||
[[nodiscard]] T& operator[](size_t idx) {
|
[[nodiscard]] T& operator[](size_t idx) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (idx >= x0_size) {
|
if (idx >= x0_size) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("out of bounds access on reserved_vector."));
|
spdlog::fatal("out of bounds access on reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return _value(idx);
|
return _value(idx);
|
||||||
@ -468,7 +468,7 @@ public:
|
|||||||
[[nodiscard]] const T& operator[](size_t idx) const {
|
[[nodiscard]] const T& operator[](size_t idx) const {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (idx >= x0_size) {
|
if (idx >= x0_size) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("out of bounds access on reserved_vector."));
|
spdlog::fatal("out of bounds access on reserved_vector.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return _value(idx);
|
return _value(idx);
|
||||||
|
69
extern/CMakeLists.txt
vendored
69
extern/CMakeLists.txt
vendored
@ -1,43 +1,3 @@
|
|||||||
option(BUILD_ATHENA "Build Athena libraries from source" ON)
|
|
||||||
if (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows OR CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
|
|
||||||
# Default to binary atdna on Windows & macOS
|
|
||||||
option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" OFF)
|
|
||||||
else ()
|
|
||||||
option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" ON)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (NOT BUILD_ATDNA)
|
|
||||||
set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest")
|
|
||||||
if (CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
|
|
||||||
set(ATHENA_EXT 7z)
|
|
||||||
else ()
|
|
||||||
set(ATHENA_EXT tar.gz)
|
|
||||||
endif ()
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(athena-host
|
|
||||||
URL "${ATHENA_BASE_URL}/athena-${HOST_PLATFORM_NAME}-${ATHENA_HOST_ARCH}.${ATHENA_EXT}")
|
|
||||||
message(STATUS "Fetching atdna host binary")
|
|
||||||
FetchContent_Populate(athena-host)
|
|
||||||
include(${athena-host_SOURCE_DIR}/lib/cmake/atdna/atdnaConfig.cmake)
|
|
||||||
set(atdna_DIR "${athena-host_SOURCE_DIR}/lib/cmake/atdna" PARENT_SCOPE)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (BUILD_ATHENA OR BUILD_ATDNA)
|
|
||||||
add_subdirectory(athena EXCLUDE_FROM_ALL)
|
|
||||||
else ()
|
|
||||||
if (ATHENA_ARCH STREQUAL ATHENA_HOST_ARCH)
|
|
||||||
set(athena_SOURCE_DIR "${athena-host_SOURCE_DIR}")
|
|
||||||
else ()
|
|
||||||
FetchContent_Declare(athena
|
|
||||||
URL "${ATHENA_BASE_URL}/athena-${HOST_PLATFORM_NAME}-${ATHENA_ARCH}.tar.gz")
|
|
||||||
FetchContent_Populate(athena)
|
|
||||||
endif ()
|
|
||||||
include(${athena_SOURCE_DIR}/lib/cmake/athena/AthenaConfig.cmake)
|
|
||||||
include(${athena_SOURCE_DIR}/lib/cmake/lzokay/lzokayConfig.cmake)
|
|
||||||
add_library(lzokay ALIAS lzokay::lzokay)
|
|
||||||
include(athena/atdna/atdnaHelpers.cmake)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Enable MoltenVK
|
# Enable MoltenVK
|
||||||
#if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
#if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
# set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE)
|
# set(DAWN_ENABLE_VULKAN ON CACHE BOOL "Enable compilation of the Vulkan backend" FORCE)
|
||||||
@ -48,30 +8,13 @@ endif ()
|
|||||||
set(AURORA_NATIVE_MATRIX ON CACHE BOOL "Assume OpenGL-layout matrices, disables transposing" FORCE)
|
set(AURORA_NATIVE_MATRIX ON CACHE BOOL "Assume OpenGL-layout matrices, disables transposing" FORCE)
|
||||||
add_subdirectory(aurora)
|
add_subdirectory(aurora)
|
||||||
|
|
||||||
# boo must come after SDL2
|
if (NOT TARGET spdlog)
|
||||||
|
set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "Compile with -fno-exceptions. Call abort() on any spdlog exceptions" FORCE)
|
||||||
|
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "Use external fmt library instead of bundled" FORCE)
|
||||||
|
add_subdirectory(spdlog EXCLUDE_FROM_ALL)
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_subdirectory(nod EXCLUDE_FROM_ALL)
|
add_subdirectory(nod EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
|
|
||||||
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
|
|
||||||
if (NOT CMAKE_INSTALL_LIBDIR)
|
|
||||||
set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix)
|
|
||||||
endif ()
|
|
||||||
add_subdirectory(discord-rpc/src EXCLUDE_FROM_ALL)
|
|
||||||
target_include_directories(discord-rpc PRIVATE rapidjson/include PUBLIC discord-rpc/include)
|
|
||||||
if (APPLE)
|
|
||||||
# remove their nasty hack
|
|
||||||
get_target_property(DISCORD_LINK_LIBRARIES discord-rpc INTERFACE_LINK_LIBRARIES)
|
|
||||||
list(REMOVE_ITEM DISCORD_LINK_LIBRARIES "-framework AppKit, -mmacosx-version-min=10.10")
|
|
||||||
set_target_properties(discord-rpc PROPERTIES INTERFACE_LINK_LIBRARIES "${DISCORD_LINK_LIBRARIES}")
|
|
||||||
endif ()
|
|
||||||
if (UNIX)
|
|
||||||
# remove another nasty hack
|
|
||||||
get_target_property(DISCORD_COMPILE_OPTIONS discord-rpc COMPILE_OPTIONS)
|
|
||||||
list(REMOVE_ITEM DISCORD_COMPILE_OPTIONS "-g")
|
|
||||||
set_target_properties(discord-rpc PROPERTIES COMPILE_OPTIONS "${DISCORD_COMPILE_OPTIONS}")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_subdirectory(jbus EXCLUDE_FROM_ALL)
|
add_subdirectory(jbus EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(kabufuda EXCLUDE_FROM_ALL)
|
add_subdirectory(kabufuda EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user