mirror of https://github.com/AxioDL/metaforce.git
Remove athena from Runtime, use raw zlib in bintoc rather than gzip
This commit is contained in:
parent
c33674b9ab
commit
15900053fa
|
@ -3,6 +3,7 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <algorithm>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#else
|
#else
|
||||||
|
@ -62,6 +63,7 @@ public:
|
||||||
static int RecursiveMakeDir(const char* dir);
|
static int RecursiveMakeDir(const char* dir);
|
||||||
static void MakeDir(const char* dir);
|
static void MakeDir(const char* dir);
|
||||||
static int Stat(const char* path, Sstat* statOut);
|
static int Stat(const char* path, Sstat* statOut);
|
||||||
|
static inline void ToLower(std::string& str) { std::transform(str.begin(), str.end(), str.begin(), ::tolower); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
|
@ -23,31 +23,16 @@ union BitsToDouble {
|
||||||
double doub;
|
double doub;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Word Bitmap reader/writer */
|
|
||||||
void WordBitmap::read(athena::io::IStreamReader& reader, size_t bitCount) {
|
|
||||||
m_bitCount = bitCount;
|
|
||||||
size_t wordCount = (bitCount + 31) / 32;
|
|
||||||
m_words.clear();
|
|
||||||
m_words.reserve(wordCount);
|
|
||||||
for (size_t w = 0; w < wordCount; ++w)
|
|
||||||
m_words.push_back(reader.readUint32Big());
|
|
||||||
}
|
|
||||||
void WordBitmap::write(athena::io::IStreamWriter& writer) const {
|
|
||||||
for (atUint32 word : m_words)
|
|
||||||
writer.writeUint32Big(word);
|
|
||||||
}
|
|
||||||
void WordBitmap::binarySize(size_t& __isz) const { __isz += m_words.size() * 4; }
|
|
||||||
|
|
||||||
CScriptLayerManager::CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld) {
|
CScriptLayerManager::CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld) {
|
||||||
const u32 bitCount = reader.ReadBits(10);
|
const u32 bitCount = reader.ReadBits(10);
|
||||||
x10_saveLayers.reserve(bitCount);
|
x10_saveLayers.Reserve(bitCount);
|
||||||
|
|
||||||
for (u32 i = 0; i < bitCount; ++i) {
|
for (u32 i = 0; i < bitCount; ++i) {
|
||||||
const bool bit = reader.ReadBits(1) != 0;
|
const bool bit = reader.ReadBits(1) != 0;
|
||||||
if (bit) {
|
if (bit) {
|
||||||
x10_saveLayers.setBit(i);
|
x10_saveLayers.SetBit(i);
|
||||||
} else {
|
} else {
|
||||||
x10_saveLayers.unsetBit(i);
|
x10_saveLayers.UnsetBit(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +48,7 @@ void CScriptLayerManager::PutTo(COutputStream& writer) const {
|
||||||
for (size_t i = 0; i < x0_areaLayers.size(); ++i) {
|
for (size_t i = 0; i < x0_areaLayers.size(); ++i) {
|
||||||
const u32 count = GetAreaLayerCount(s32(i));
|
const u32 count = GetAreaLayerCount(s32(i));
|
||||||
for (u32 l = 1; l < count; ++l) {
|
for (u32 l = 1; l < count; ++l) {
|
||||||
writer.WriteBits(IsLayerActive(s32(i), s32(l)), 1);
|
writer.WriteBits(static_cast<u32>(IsLayerActive(s32(i), s32(l))), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,19 +59,20 @@ void CScriptLayerManager::InitializeWorldLayers(const std::vector<CWorldLayers::
|
||||||
}
|
}
|
||||||
|
|
||||||
x0_areaLayers = layers;
|
x0_areaLayers = layers;
|
||||||
if (x10_saveLayers.getBitCount() == 0) {
|
if (x10_saveLayers.GetBitCount() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 a = 0;
|
u32 a = 0;
|
||||||
u32 b = 0;
|
u32 b = 0;
|
||||||
for (const CWorldLayers::Area& area : x0_areaLayers) {
|
for (const CWorldLayers::Area& area : x0_areaLayers) {
|
||||||
for (u32 l = 1; l < area.m_layerCount; ++l)
|
for (u32 l = 1; l < area.m_layerCount; ++l) {
|
||||||
SetLayerActive(a, l, x10_saveLayers.getBit(b++));
|
SetLayerActive(a, l, x10_saveLayers.GetBit(b++));
|
||||||
|
}
|
||||||
++a;
|
++a;
|
||||||
}
|
}
|
||||||
|
|
||||||
x10_saveLayers.clear();
|
x10_saveLayers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorldState::CWorldState(CAssetId id) : x0_mlvlId(id), x4_areaId(0) {
|
CWorldState::CWorldState(CAssetId id) : x0_mlvlId(id), x4_areaId(0) {
|
||||||
|
@ -97,9 +83,7 @@ CWorldState::CWorldState(CAssetId id) : x0_mlvlId(id), x4_areaId(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorldState::CWorldState(CInputStream& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld)
|
CWorldState::CWorldState(CInputStream& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld)
|
||||||
: x0_mlvlId(mlvlId) {
|
: x0_mlvlId(mlvlId), x4_areaId(TAreaId(reader.ReadBits(32))), x10_desiredAreaAssetId(reader.ReadBits(32)) {
|
||||||
x4_areaId = TAreaId(reader.ReadBits(32));
|
|
||||||
x10_desiredAreaAssetId = u32(reader.ReadBits(32));
|
|
||||||
x8_mailbox = std::make_shared<CScriptMailbox>(reader, saveWorld);
|
x8_mailbox = std::make_shared<CScriptMailbox>(reader, saveWorld);
|
||||||
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(reader, saveWorld, mlvlId);
|
xc_mapWorldInfo = std::make_shared<CMapWorldInfo>(reader, saveWorld, mlvlId);
|
||||||
x14_layerState = std::make_shared<CScriptLayerManager>(reader, saveWorld);
|
x14_layerState = std::make_shared<CScriptLayerManager>(reader, saveWorld);
|
||||||
|
|
|
@ -4,54 +4,53 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Runtime/AutoMapper/CMapWorldInfo.hpp"
|
||||||
#include "Runtime/CBasics.hpp"
|
#include "Runtime/CBasics.hpp"
|
||||||
#include "Runtime/CGameOptions.hpp"
|
#include "Runtime/CGameOptions.hpp"
|
||||||
#include "Runtime/CPlayerState.hpp"
|
#include "Runtime/CPlayerState.hpp"
|
||||||
#include "Runtime/CScriptMailbox.hpp"
|
#include "Runtime/CScriptMailbox.hpp"
|
||||||
#include "Runtime/AutoMapper/CMapWorldInfo.hpp"
|
|
||||||
#include "Runtime/World/CWorld.hpp"
|
#include "Runtime/World/CWorld.hpp"
|
||||||
#include "Runtime/World/CWorldTransManager.hpp"
|
#include "Runtime/World/CWorldTransManager.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CSaveWorldMemory;
|
class CSaveWorldMemory;
|
||||||
|
|
||||||
// TODO: copied from DataSpec, should be reimplemented
|
|
||||||
class WordBitmap {
|
class WordBitmap {
|
||||||
std::vector<atUint32> m_words;
|
std::vector<u32> x0_words;
|
||||||
size_t m_bitCount = 0;
|
size_t x10_bitCount = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void read(athena::io::IStreamReader& reader, size_t bitCount);
|
void Reserve(size_t bitCount) { x0_words.reserve((bitCount + 31) / 32); }
|
||||||
void write(athena::io::IStreamWriter& writer) const;
|
[[nodiscard]] size_t GetBitCount() const { return x10_bitCount; }
|
||||||
void reserve(size_t bitCount) { m_words.reserve((bitCount + 31) / 32); }
|
[[nodiscard]] bool GetBit(size_t idx) const {
|
||||||
void binarySize(size_t& __isz) const;
|
|
||||||
size_t getBitCount() const { return m_bitCount; }
|
|
||||||
bool getBit(size_t idx) const {
|
|
||||||
size_t wordIdx = idx / 32;
|
size_t wordIdx = idx / 32;
|
||||||
if (wordIdx >= m_words.size())
|
if (wordIdx >= x0_words.size()) {
|
||||||
return false;
|
return false;
|
||||||
size_t wordCur = idx % 32;
|
|
||||||
return (m_words[wordIdx] >> wordCur) & 0x1;
|
|
||||||
}
|
}
|
||||||
void setBit(size_t idx) {
|
size_t wordCur = idx % 32;
|
||||||
|
return ((x0_words[wordIdx] >> wordCur) & 0x1) != 0u;
|
||||||
|
}
|
||||||
|
void SetBit(size_t idx) {
|
||||||
size_t wordIdx = idx / 32;
|
size_t wordIdx = idx / 32;
|
||||||
while (wordIdx >= m_words.size())
|
while (wordIdx >= x0_words.size()) {
|
||||||
m_words.push_back(0);
|
x0_words.push_back(0);
|
||||||
size_t wordCur = idx % 32;
|
|
||||||
m_words[wordIdx] |= (1 << wordCur);
|
|
||||||
m_bitCount = std::max(m_bitCount, idx + 1);
|
|
||||||
}
|
}
|
||||||
void unsetBit(size_t idx) {
|
size_t wordCur = idx % 32;
|
||||||
|
x0_words[wordIdx] |= (1 << wordCur);
|
||||||
|
x10_bitCount = std::max(x10_bitCount, idx + 1);
|
||||||
|
}
|
||||||
|
void UnsetBit(size_t idx) {
|
||||||
size_t wordIdx = idx / 32;
|
size_t wordIdx = idx / 32;
|
||||||
while (wordIdx >= m_words.size())
|
while (wordIdx >= x0_words.size()) {
|
||||||
m_words.push_back(0);
|
x0_words.push_back(0);
|
||||||
size_t wordCur = idx % 32;
|
|
||||||
m_words[wordIdx] &= ~(1 << wordCur);
|
|
||||||
m_bitCount = std::max(m_bitCount, idx + 1);
|
|
||||||
}
|
}
|
||||||
void clear() {
|
size_t wordCur = idx % 32;
|
||||||
m_words.clear();
|
x0_words[wordIdx] &= ~(1 << wordCur);
|
||||||
m_bitCount = 0;
|
x10_bitCount = std::max(x10_bitCount, idx + 1);
|
||||||
|
}
|
||||||
|
void Clear() {
|
||||||
|
x0_words.clear();
|
||||||
|
x10_bitCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Iterator {
|
class Iterator {
|
||||||
|
@ -71,11 +70,11 @@ public:
|
||||||
++m_idx;
|
++m_idx;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
bool operator*() const { return m_bmp.getBit(m_idx); }
|
bool operator*() const { return m_bmp.GetBit(m_idx); }
|
||||||
bool operator!=(const Iterator& other) const { return m_idx != other.m_idx; }
|
bool operator!=(const Iterator& other) const { return m_idx != other.m_idx; }
|
||||||
};
|
};
|
||||||
Iterator begin() const { return Iterator(*this, 0); }
|
[[nodiscard]] Iterator begin() const { return Iterator(*this, 0); }
|
||||||
Iterator end() const { return Iterator(*this, m_bitCount); }
|
[[nodiscard]] Iterator end() const { return Iterator(*this, x10_bitCount); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CScriptLayerManager {
|
class CScriptLayerManager {
|
||||||
|
@ -87,19 +86,22 @@ public:
|
||||||
CScriptLayerManager() = default;
|
CScriptLayerManager() = default;
|
||||||
CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld);
|
CScriptLayerManager(CInputStream& reader, const CWorldSaveGameInfo& saveWorld);
|
||||||
|
|
||||||
bool IsLayerActive(int areaIdx, int layerIdx) const { return ((x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1); }
|
[[nodiscard]] bool IsLayerActive(int areaIdx, int layerIdx) const {
|
||||||
|
return ((x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1) != 0u;
|
||||||
|
}
|
||||||
|
|
||||||
void SetLayerActive(int areaIdx, int layerIdx, bool active) {
|
void SetLayerActive(int areaIdx, int layerIdx, bool active) {
|
||||||
if (active)
|
if (active) {
|
||||||
x0_areaLayers[areaIdx].m_layerBits |= uint64_t(1) << layerIdx;
|
x0_areaLayers[areaIdx].m_layerBits |= uint64_t(1) << layerIdx;
|
||||||
else
|
} else {
|
||||||
x0_areaLayers[areaIdx].m_layerBits &= ~(uint64_t(1) << layerIdx);
|
x0_areaLayers[areaIdx].m_layerBits &= ~(uint64_t(1) << layerIdx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers);
|
void InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers);
|
||||||
|
|
||||||
u32 GetAreaLayerCount(int areaIdx) const { return x0_areaLayers[areaIdx].m_layerCount; }
|
[[nodiscard]] u32 GetAreaLayerCount(int areaIdx) const { return x0_areaLayers[areaIdx].m_layerCount; }
|
||||||
u32 GetAreaCount() const { return x0_areaLayers.size(); }
|
[[nodiscard]] u32 GetAreaCount() const { return x0_areaLayers.size(); }
|
||||||
|
|
||||||
void PutTo(COutputStream& writer) const;
|
void PutTo(COutputStream& writer) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,12 +31,6 @@
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
static logvisor::Module AthenaLog("Athena");
|
|
||||||
static void AthenaExc(athena::error::Level level, const char* file, const char*, int line, fmt::string_view fmt,
|
|
||||||
fmt::format_args args) {
|
|
||||||
AthenaLog.vreport(logvisor::Level(level), fmt, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Limiter {
|
class Limiter {
|
||||||
using delta_clock = std::chrono::high_resolution_clock;
|
using delta_clock = std::chrono::high_resolution_clock;
|
||||||
using duration_t = std::chrono::nanoseconds;
|
using duration_t = std::chrono::nanoseconds;
|
||||||
|
@ -567,7 +561,6 @@ static void SetupBasics(bool logging) {
|
||||||
logvisor::RegisterStandardExceptions();
|
logvisor::RegisterStandardExceptions();
|
||||||
if (logging)
|
if (logging)
|
||||||
logvisor::RegisterConsoleLogger();
|
logvisor::RegisterConsoleLogger();
|
||||||
atSetExceptionHandler(AthenaExc);
|
|
||||||
|
|
||||||
#if SENTRY_ENABLED
|
#if SENTRY_ENABLED
|
||||||
FileStoreManager fileMgr{"sentry-native-metaforce"};
|
FileStoreManager fileMgr{"sentry-native-metaforce"};
|
||||||
|
|
|
@ -437,7 +437,7 @@ CPlayerState::EItemType CPlayerState::ItemNameToType(std::string_view name) {
|
||||||
}};
|
}};
|
||||||
|
|
||||||
std::string lowName{name};
|
std::string lowName{name};
|
||||||
athena::utility::tolower(lowName);
|
CBasics::ToLower(lowName);
|
||||||
|
|
||||||
const auto iter = std::find_if(typeNameMap.cbegin(), typeNameMap.cend(),
|
const auto iter = std::find_if(typeNameMap.cbegin(), typeNameMap.cend(),
|
||||||
[&lowName](const auto& entry) { return entry.first == lowName; });
|
[&lowName](const auto& entry) { return entry.first == lowName; });
|
||||||
|
|
|
@ -52,9 +52,9 @@ CCharLayoutNode::CCharLayoutNode(CInputStream& in) : x0_boneMap(in.ReadLong()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CCharLayoutInfo::CCharLayoutInfo(CInputStream& in) : x0_node(std::make_shared<CCharLayoutNode>(in)), x8_segIdList(in) {
|
CCharLayoutInfo::CCharLayoutInfo(CInputStream& in) : x0_node(std::make_shared<CCharLayoutNode>(in)), x8_segIdList(in) {
|
||||||
const atUint32 mapCount = in.ReadLong();
|
const u32 mapCount = in.ReadLong();
|
||||||
|
|
||||||
for (atUint32 i = 0; i < mapCount; ++i) {
|
for (u32 i = 0; i < mapCount; ++i) {
|
||||||
std::string key = in.Get<std::string>();
|
std::string key = in.Get<std::string>();
|
||||||
x18_segIdMap.emplace(std::move(key), in);
|
x18_segIdMap.emplace(std::move(key), in);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,63 @@
|
||||||
#include "Runtime/ConsoleVariables/CVar.hpp"
|
#include "Runtime/ConsoleVariables/CVar.hpp"
|
||||||
|
#include "Runtime/CBasics.hpp"
|
||||||
|
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
namespace {
|
||||||
|
// TODO: Move these to CBasics?
|
||||||
|
inline bool parseBool(std::string_view boolean, bool* valid) {
|
||||||
|
std::string val(boolean);
|
||||||
|
// compare must be case insensitive
|
||||||
|
// This is the cleanest solution since I only need to do it once
|
||||||
|
CBasics::ToLower(val);
|
||||||
|
|
||||||
|
// Check for true first
|
||||||
|
if (val == "true" || val == "1" || val == "yes" || val == "on") {
|
||||||
|
if (valid)
|
||||||
|
*valid = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now false
|
||||||
|
if (val == "false" || val == "0" || val == "no" || val == "off") {
|
||||||
|
if (valid)
|
||||||
|
*valid = true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Well that could've gone better
|
||||||
|
|
||||||
|
if (valid)
|
||||||
|
*valid = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::vector<std::string>& split(std::string_view s, char delim, std::vector<std::string>& elems) {
|
||||||
|
std::string tmps(s);
|
||||||
|
std::stringstream ss(tmps);
|
||||||
|
std::string item;
|
||||||
|
|
||||||
|
while (std::getline(ss, item, delim)) {
|
||||||
|
elems.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return elems;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> split(std::string_view s, char delim) {
|
||||||
|
std::vector<std::string> elems;
|
||||||
|
split(s, delim, elems);
|
||||||
|
return elems;
|
||||||
|
}
|
||||||
|
}
|
||||||
extern CVar* com_developer;
|
extern CVar* com_developer;
|
||||||
extern CVar* com_enableCheats;
|
extern CVar* com_enableCheats;
|
||||||
|
|
||||||
|
@ -197,7 +250,7 @@ bool CVar::toBoolean(bool* isValid) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return athena::utility::parseBool(m_value, isValid);
|
return parseBool(m_value, isValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CVar::toSigned(bool* isValid) const {
|
int32_t CVar::toSigned(bool* isValid) const {
|
||||||
|
@ -441,12 +494,12 @@ bool isReal(const std::vector<std::string>& v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVar::isValidInput(std::string_view input) const {
|
bool CVar::isValidInput(std::string_view input) const {
|
||||||
std::vector<std::string> parts = athena::utility::split(input, ' ');
|
std::vector<std::string> parts = split(input, ' ');
|
||||||
char* p;
|
char* p;
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case EType::Boolean: {
|
case EType::Boolean: {
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
athena::utility::parseBool(input, &valid);
|
parseBool(input, &valid);
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
case EType::Signed:
|
case EType::Signed:
|
||||||
|
|
|
@ -6,40 +6,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#ifndef ENABLE_BITWISE_ENUM
|
|
||||||
#define ENABLE_BITWISE_ENUM(type) \
|
|
||||||
constexpr type operator|(type a, type b) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
return type(static_cast<T>(a) | static_cast<T>(b)); \
|
|
||||||
} \
|
|
||||||
constexpr type operator&(type a, type b) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
return type(static_cast<T>(a) & static_cast<T>(b)); \
|
|
||||||
} \
|
|
||||||
constexpr type& operator|=(type& a, type b) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
a = type(static_cast<T>(a) | static_cast<T>(b)); \
|
|
||||||
return a; \
|
|
||||||
} \
|
|
||||||
constexpr type& operator&=(type& a, type b) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
a = type(static_cast<T>(a) & static_cast<T>(b)); \
|
|
||||||
return a; \
|
|
||||||
} \
|
|
||||||
constexpr type operator~(type key) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
return type(~static_cast<T>(key)); \
|
|
||||||
} \
|
|
||||||
constexpr bool True(type key) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
return static_cast<T>(key) != 0; \
|
|
||||||
} \
|
|
||||||
constexpr bool False(type key) noexcept { \
|
|
||||||
using T = std::underlying_type_t<type>; \
|
|
||||||
return static_cast<T>(key) == 0; \
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
namespace StoreCVar {
|
namespace StoreCVar {
|
||||||
enum class EType : uint32_t { Boolean, Signed, Unsigned, Real, Literal, Vec2f, Vec2d, Vec3f, Vec3d, Vec4f, Vec4d };
|
enum class EType : uint32_t { Boolean, Signed, Unsigned, Real, Literal, Vec2f, Vec2d, Vec3f, Vec3d, Vec4f, Vec4d };
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||||
|
|
||||||
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
||||||
|
#include "Runtime/CBasics.hpp"
|
||||||
|
|
||||||
#include <logvisor/logvisor.hpp>
|
#include <logvisor/logvisor.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -37,7 +38,7 @@ CVarManager::~CVarManager() {}
|
||||||
|
|
||||||
CVar* CVarManager::registerCVar(std::unique_ptr<CVar>&& cvar) {
|
CVar* CVarManager::registerCVar(std::unique_ptr<CVar>&& cvar) {
|
||||||
std::string tmp(cvar->name());
|
std::string tmp(cvar->name());
|
||||||
athena::utility::tolower(tmp);
|
CBasics::ToLower(tmp);
|
||||||
|
|
||||||
if (m_cvars.find(tmp) != m_cvars.end()) {
|
if (m_cvars.find(tmp) != m_cvars.end()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -50,7 +51,7 @@ CVar* CVarManager::registerCVar(std::unique_ptr<CVar>&& cvar) {
|
||||||
|
|
||||||
CVar* CVarManager::findCVar(std::string_view name) {
|
CVar* CVarManager::findCVar(std::string_view name) {
|
||||||
std::string lower(name);
|
std::string lower(name);
|
||||||
athena::utility::tolower(lower);
|
CBasics::ToLower(lower);
|
||||||
auto search = m_cvars.find(lower);
|
auto search = m_cvars.find(lower);
|
||||||
if (search == m_cvars.end())
|
if (search == m_cvars.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -85,7 +86,7 @@ void CVarManager::deserialize(CVar* cvar) {
|
||||||
|
|
||||||
/* First let's check for a deferred value */
|
/* First let's check for a deferred value */
|
||||||
std::string lowName = cvar->name().data();
|
std::string lowName = cvar->name().data();
|
||||||
athena::utility::tolower(lowName);
|
CBasics::ToLower(lowName);
|
||||||
if (const auto iter = m_deferedCVars.find(lowName); iter != m_deferedCVars.end()) {
|
if (const auto iter = m_deferedCVars.find(lowName); iter != m_deferedCVars.end()) {
|
||||||
std::string val = std::move(iter->second);
|
std::string val = std::move(iter->second);
|
||||||
m_deferedCVars.erase(lowName);
|
m_deferedCVars.erase(lowName);
|
||||||
|
@ -175,7 +176,7 @@ void CVarManager::serialize() {
|
||||||
container.cvars.push_back(*cvar);
|
container.cvars.push_back(*cvar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
container.cvarCount = atUint32(container.cvars.size());
|
container.cvarCount = u32(container.cvars.size());
|
||||||
|
|
||||||
filename += ".bin";
|
filename += ".bin";
|
||||||
athena::io::FileWriter writer(filename);
|
athena::io::FileWriter writer(filename);
|
||||||
|
@ -233,7 +234,7 @@ bool CVarManager::restartRequired() const {
|
||||||
void CVarManager::parseCommandLine(const std::vector<std::string>& args) {
|
void CVarManager::parseCommandLine(const std::vector<std::string>& args) {
|
||||||
bool oldDeveloper = suppressDeveloper();
|
bool oldDeveloper = suppressDeveloper();
|
||||||
std::string developerName(com_developer->name());
|
std::string developerName(com_developer->name());
|
||||||
athena::utility::tolower(developerName);
|
CBasics::ToLower(developerName);
|
||||||
for (const std::string& arg : args) {
|
for (const std::string& arg : args) {
|
||||||
if (arg[0] != '+') {
|
if (arg[0] != '+') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -266,13 +267,13 @@ void CVarManager::parseCommandLine(const std::vector<std::string>& args) {
|
||||||
cv->fromLiteralToType(cvarValue);
|
cv->fromLiteralToType(cvarValue);
|
||||||
}
|
}
|
||||||
cv->m_wasDeserialized = true;
|
cv->m_wasDeserialized = true;
|
||||||
athena::utility::tolower(cvarName);
|
CBasics::ToLower(cvarName);
|
||||||
if (developerName == cvarName)
|
if (developerName == cvarName)
|
||||||
/* Make sure we're not overriding developer mode when we restore */
|
/* Make sure we're not overriding developer mode when we restore */
|
||||||
oldDeveloper = com_developer->toBoolean();
|
oldDeveloper = com_developer->toBoolean();
|
||||||
} else {
|
} else {
|
||||||
/* Unable to find an existing CVar, let's defer for the time being 8 */
|
/* Unable to find an existing CVar, let's defer for the time being 8 */
|
||||||
athena::utility::tolower(cvarName);
|
CBasics::ToLower(cvarName);
|
||||||
m_deferedCVars.insert_or_assign(std::move(cvarName), std::move(cvarValue));
|
m_deferedCVars.insert_or_assign(std::move(cvarName), std::move(cvarValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,3 +11,56 @@ using s32 = int32_t;
|
||||||
using u32 = uint32_t;
|
using u32 = uint32_t;
|
||||||
using s64 = int64_t;
|
using s64 = int64_t;
|
||||||
using u64 = uint64_t;
|
using u64 = uint64_t;
|
||||||
|
|
||||||
|
#ifndef ROUND_UP_256
|
||||||
|
#define ROUND_UP_256(val) (((val) + 255) & ~255)
|
||||||
|
#endif
|
||||||
|
#ifndef ROUND_UP_64
|
||||||
|
#define ROUND_UP_64(val) (((val) + 63) & ~63)
|
||||||
|
#endif
|
||||||
|
#ifndef ROUND_UP_32
|
||||||
|
#define ROUND_UP_32(val) (((val) + 31) & ~31)
|
||||||
|
#endif
|
||||||
|
#ifndef ROUND_UP_16
|
||||||
|
#define ROUND_UP_16(val) (((val) + 15) & ~15)
|
||||||
|
#endif
|
||||||
|
#ifndef ROUND_UP_8
|
||||||
|
#define ROUND_UP_8(val) (((val) + 7) & ~7)
|
||||||
|
#endif
|
||||||
|
#ifndef ROUND_UP_4
|
||||||
|
#define ROUND_UP_4(val) (((val) + 3) & ~3)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENABLE_BITWISE_ENUM
|
||||||
|
#define ENABLE_BITWISE_ENUM(type) \
|
||||||
|
constexpr type operator|(type a, type b) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return type(static_cast<T>(a) | static_cast<T>(b)); \
|
||||||
|
} \
|
||||||
|
constexpr type operator&(type a, type b) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return type(static_cast<T>(a) & static_cast<T>(b)); \
|
||||||
|
} \
|
||||||
|
constexpr type& operator|=(type& a, type b) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
a = type(static_cast<T>(a) | static_cast<T>(b)); \
|
||||||
|
return a; \
|
||||||
|
} \
|
||||||
|
constexpr type& operator&=(type& a, type b) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
a = type(static_cast<T>(a) & static_cast<T>(b)); \
|
||||||
|
return a; \
|
||||||
|
} \
|
||||||
|
constexpr type operator~(type key) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return type(~static_cast<T>(key)); \
|
||||||
|
} \
|
||||||
|
constexpr bool True(type key) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return static_cast<T>(key) != 0; \
|
||||||
|
} \
|
||||||
|
constexpr bool False(type key) noexcept { \
|
||||||
|
using T = std::underlying_type_t<type>; \
|
||||||
|
return static_cast<T>(key) == 0; \
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -9,15 +9,15 @@ struct ImGuiPlayerLoadouts : athena::io::DNA<athena::Endian::Big> {
|
||||||
struct Item : athena::io::DNA<athena::Endian::Big> {
|
struct Item : athena::io::DNA<athena::Endian::Big> {
|
||||||
AT_DECL_DNA_YAML
|
AT_DECL_DNA_YAML
|
||||||
String<-1> type;
|
String<-1> type;
|
||||||
Value<atUint32> amount;
|
Value<u32> amount;
|
||||||
};
|
};
|
||||||
struct LoadOut : athena::io::DNA<athena::Endian::Big> {
|
struct LoadOut : athena::io::DNA<athena::Endian::Big> {
|
||||||
AT_DECL_DNA_YAML
|
AT_DECL_DNA_YAML
|
||||||
String<-1> name;
|
String<-1> name;
|
||||||
Value<atUint32> itemCount;
|
Value<u32> itemCount;
|
||||||
Vector<Item, AT_DNA_COUNT(itemCount)> items;
|
Vector<Item, AT_DNA_COUNT(itemCount)> items;
|
||||||
};
|
};
|
||||||
Value<atUint32> loadoutCount;
|
Value<u32> loadoutCount;
|
||||||
Vector<LoadOut, AT_DNA_COUNT(loadoutCount)> loadouts;
|
Vector<LoadOut, AT_DNA_COUNT(loadoutCount)> loadouts;
|
||||||
};
|
};
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
|
@ -230,7 +230,7 @@ bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(u32(cmd)));
|
||||||
if (func < EFunctionList::MAX) {
|
if (func < EFunctionList::MAX) {
|
||||||
if (BoolReturnFn fn = skPressFuncs[size_t(func)]) {
|
if (BoolReturnFn fn = skPressFuncs[size_t(func)]) {
|
||||||
ret = (input.*fn)();
|
ret = (input.*fn)();
|
||||||
|
@ -257,7 +257,7 @@ bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(u32(cmd)));
|
||||||
if (func < EFunctionList::MAX) {
|
if (func < EFunctionList::MAX) {
|
||||||
if (BoolReturnFn fn = skDigitalFuncs[size_t(func)])
|
if (BoolReturnFn fn = skDigitalFuncs[size_t(func)])
|
||||||
ret = (input.*fn)();
|
ret = (input.*fn)();
|
||||||
|
@ -333,7 +333,7 @@ float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float ret = 0.f;
|
float ret = 0.f;
|
||||||
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(u32(cmd)));
|
||||||
if (func < EFunctionList::MAX) {
|
if (func < EFunctionList::MAX) {
|
||||||
if (FloatReturnFn fn = skAnalogFuncs[size_t(func)]) {
|
if (FloatReturnFn fn = skAnalogFuncs[size_t(func)]) {
|
||||||
ret = (input.*fn)();
|
ret = (input.*fn)();
|
||||||
|
|
|
@ -686,7 +686,7 @@ void CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
||||||
x164_archSupport = std::make_unique<CGameArchitectureSupport>(*this, voiceEngine, backend);
|
x164_archSupport = std::make_unique<CGameArchitectureSupport>(*this, voiceEngine, backend);
|
||||||
g_archSupport = x164_archSupport.get();
|
g_archSupport = x164_archSupport.get();
|
||||||
x164_archSupport->PreloadAudio();
|
x164_archSupport->PreloadAudio();
|
||||||
std::srand(static_cast<u32>(std::time(nullptr)));
|
std::srand(static_cast<u32>(CBasics::GetTime()));
|
||||||
// g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
// g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
namespace metaforce::MP1 {
|
namespace metaforce::MP1 {
|
||||||
struct CTweakPlayerControl final : Tweaks::ITweakPlayerControl {
|
struct CTweakPlayerControl final : Tweaks::ITweakPlayerControl {
|
||||||
std::array<ControlMapper::EFunctionList, 67> m_mappings;
|
std::array<ControlMapper::EFunctionList, 67> m_mappings;
|
||||||
[[nodiscard]] ControlMapper::EFunctionList GetMapping(atUint32 command) const override { return m_mappings[command]; }
|
[[nodiscard]] ControlMapper::EFunctionList GetMapping(u32 command) const override { return m_mappings[command]; }
|
||||||
CTweakPlayerControl() = default;
|
CTweakPlayerControl() = default;
|
||||||
CTweakPlayerControl(CInputStream& reader);
|
CTweakPlayerControl(CInputStream& reader);
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct CTweakPlayerGun final : Tweaks::ITweakPlayerGun {
|
||||||
float GetGunExtendDistance() const override { return x48_gunExtendDistance; }
|
float GetGunExtendDistance() const override { return x48_gunExtendDistance; }
|
||||||
const zeus::CVector3f& GetGunPosition() const override { return x4c_gunPosition; }
|
const zeus::CVector3f& GetGunPosition() const override { return x4c_gunPosition; }
|
||||||
const zeus::CVector3f& GetGrapplingArmPosition() const override { return x64_grapplingArmPosition; }
|
const zeus::CVector3f& GetGrapplingArmPosition() const override { return x64_grapplingArmPosition; }
|
||||||
float GetRichochetDamage(atUint32 type) const override {
|
float GetRichochetDamage(u32 type) const override {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0: // Power
|
case 0: // Power
|
||||||
return x280_ricochetData[0];
|
return x280_ricochetData[0];
|
||||||
|
@ -82,14 +82,14 @@ struct CTweakPlayerGun final : Tweaks::ITweakPlayerGun {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SWeaponInfo& GetBeamInfo(atInt32 beam) const override {
|
const SWeaponInfo& GetBeamInfo(s32 beam) const override {
|
||||||
if (beam < 0 || beam >= 5) {
|
if (beam < 0 || beam >= 5) {
|
||||||
return xa8_beams[0];
|
return xa8_beams[0];
|
||||||
}
|
}
|
||||||
return xa8_beams[beam];
|
return xa8_beams[beam];
|
||||||
}
|
}
|
||||||
|
|
||||||
const SComboShotParam& GetComboShotInfo(atInt32 beam) const override {
|
const SComboShotParam& GetComboShotInfo(s32 beam) const override {
|
||||||
if (beam < 0 || beam >= 5) {
|
if (beam < 0 || beam >= 5) {
|
||||||
return x1f0_combos[0];
|
return x1f0_combos[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,10 +88,10 @@ constexpr uint64_t SBig(uint64_t val) noexcept { return bswap64(val); }
|
||||||
constexpr float SBig(float val) noexcept {
|
constexpr float SBig(float val) noexcept {
|
||||||
union {
|
union {
|
||||||
float f;
|
float f;
|
||||||
atInt32 i;
|
u32 i;
|
||||||
} uval1 = {val};
|
} uval1 = {val};
|
||||||
union {
|
union {
|
||||||
atInt32 i;
|
u32 i;
|
||||||
float f;
|
float f;
|
||||||
} uval2 = {bswap32(uval1.i)};
|
} uval2 = {bswap32(uval1.i)};
|
||||||
return uval2.f;
|
return uval2.f;
|
||||||
|
@ -99,10 +99,10 @@ constexpr float SBig(float val) noexcept {
|
||||||
constexpr double SBig(double val) noexcept {
|
constexpr double SBig(double val) noexcept {
|
||||||
union {
|
union {
|
||||||
double f;
|
double f;
|
||||||
atInt64 i;
|
u32 i;
|
||||||
} uval1 = {val};
|
} uval1 = {val};
|
||||||
union {
|
union {
|
||||||
atInt64 i;
|
u32 i;
|
||||||
double f;
|
double f;
|
||||||
} uval2 = {bswap64(uval1.i)};
|
} uval2 = {bswap64(uval1.i)};
|
||||||
return uval2.f;
|
return uval2.f;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CInputStream.hpp"
|
#include "Runtime/Streams/CInputStream.hpp"
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
class CMemoryInStream final : public CInputStream {
|
class CMemoryInStream final : public CInputStream {
|
||||||
|
|
|
@ -70,7 +70,7 @@ zeus::CTransform cinput_stream_helper(CInputStream& in) {
|
||||||
auto r0 = in.Get<zeus::CVector4f>();
|
auto r0 = in.Get<zeus::CVector4f>();
|
||||||
auto r1 = in.Get<zeus::CVector4f>();
|
auto r1 = in.Get<zeus::CVector4f>();
|
||||||
auto r2 = in.Get<zeus::CVector4f>();
|
auto r2 = in.Get<zeus::CVector4f>();
|
||||||
ret.basis = zeus::CMatrix3f(r0, r1, r2);
|
ret.basis = zeus::CMatrix3f(r0.toVec3f(), r1.toVec3f(), r2.toVec3f());
|
||||||
ret.basis.transpose();
|
ret.basis.transpose();
|
||||||
ret.origin = zeus::CVector3f(r0.w(), r1.w(), r2.w());
|
ret.origin = zeus::CVector3f(r0.w(), r1.w(), r2.w());
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
namespace metaforce::Tweaks {
|
namespace metaforce::Tweaks {
|
||||||
|
|
||||||
struct ITweakGui : ITweak {
|
struct ITweakGui : ITweak {
|
||||||
enum class EHudVisMode : atUint32 { Zero, One, Two, Three };
|
enum class EHudVisMode : u32 { Zero, One, Two, Three };
|
||||||
|
|
||||||
enum class EHelmetVisMode : atUint32 { ReducedUpdate, NotVisible, Deco, HelmetDeco, GlowHelmetDeco, HelmetOnly };
|
enum class EHelmetVisMode : u32 { ReducedUpdate, NotVisible, Deco, HelmetDeco, GlowHelmetDeco, HelmetOnly };
|
||||||
|
|
||||||
virtual float GetMapAlphaInterpolant() const = 0;
|
virtual float GetMapAlphaInterpolant() const = 0;
|
||||||
virtual float GetPauseBlurFactor() const = 0;
|
virtual float GetPauseBlurFactor() const = 0;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
namespace metaforce::Tweaks {
|
namespace metaforce::Tweaks {
|
||||||
|
|
||||||
struct ITweakPlayerControl : ITweak {
|
struct ITweakPlayerControl : ITweak {
|
||||||
[[nodiscard]] virtual ControlMapper::EFunctionList GetMapping(atUint32) const = 0;
|
[[nodiscard]] virtual ControlMapper::EFunctionList GetMapping(u32) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DataSpec
|
} // namespace DataSpec
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
/* Same as CDamageInfo */
|
/* Same as CDamageInfo */
|
||||||
struct SShotParam {
|
struct SShotParam {
|
||||||
atInt32 x0_weaponType = -1;
|
u32 x0_weaponType = -1;
|
||||||
bool x4_24_charged : 1;
|
bool x4_24_charged : 1;
|
||||||
bool x4_25_combo : 1;
|
bool x4_25_combo : 1;
|
||||||
bool x4_26_instaKill : 1;
|
bool x4_26_instaKill : 1;
|
||||||
|
@ -63,9 +63,9 @@ struct ITweakPlayerGun : ITweak {
|
||||||
virtual float GetGunExtendDistance() const = 0;
|
virtual float GetGunExtendDistance() const = 0;
|
||||||
virtual const zeus::CVector3f& GetGunPosition() const = 0;
|
virtual const zeus::CVector3f& GetGunPosition() const = 0;
|
||||||
virtual const zeus::CVector3f& GetGrapplingArmPosition() const = 0;
|
virtual const zeus::CVector3f& GetGrapplingArmPosition() const = 0;
|
||||||
virtual float GetRichochetDamage(atUint32) const = 0;
|
virtual float GetRichochetDamage(u32) const = 0;
|
||||||
virtual const SWeaponInfo& GetBeamInfo(atInt32 beam) const = 0;
|
virtual const SWeaponInfo& GetBeamInfo(s32 beam) const = 0;
|
||||||
virtual const SComboShotParam& GetComboShotInfo(atInt32 beam) const = 0;
|
virtual const SComboShotParam& GetComboShotInfo(s32 beam) const = 0;
|
||||||
virtual const SShotParam& GetBombInfo() const = 0;
|
virtual const SShotParam& GetBombInfo() const = 0;
|
||||||
virtual const SShotParam& GetPowerBombInfo() const = 0;
|
virtual const SShotParam& GetPowerBombInfo() const = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
namespace metaforce::Tweaks {
|
namespace metaforce::Tweaks {
|
||||||
struct ITweakTargeting : public ITweak {
|
struct ITweakTargeting : public ITweak {
|
||||||
virtual atUint32 GetTargetRadiusMode() const = 0;
|
virtual u32 GetTargetRadiusMode() const = 0;
|
||||||
virtual float GetCurrLockOnExitDuration() const = 0;
|
virtual float GetCurrLockOnExitDuration() const = 0;
|
||||||
virtual float GetCurrLockOnEnterDuration() const = 0;
|
virtual float GetCurrLockOnEnterDuration() const = 0;
|
||||||
virtual float GetCurrLockOnSwitchDuration() const = 0;
|
virtual float GetCurrLockOnSwitchDuration() const = 0;
|
||||||
|
@ -40,7 +40,7 @@ struct ITweakTargeting : public ITweak {
|
||||||
virtual float GetChargeGaugeAngle(int i) const = 0;
|
virtual float GetChargeGaugeAngle(int i) const = 0;
|
||||||
virtual float GetChargeGaugeScale() const = 0;
|
virtual float GetChargeGaugeScale() const = 0;
|
||||||
virtual const zeus::CColor& GetChargeGaugeNonFullColor() const = 0;
|
virtual const zeus::CColor& GetChargeGaugeNonFullColor() const = 0;
|
||||||
virtual atUint32 GetChargeTickCount() const = 0;
|
virtual u32 GetChargeTickCount() const = 0;
|
||||||
virtual float GetChargeTickAnglePitch() const = 0;
|
virtual float GetChargeTickAnglePitch() const = 0;
|
||||||
virtual float GetLockFireScale() const = 0;
|
virtual float GetLockFireScale() const = 0;
|
||||||
virtual float GetLockFireDuration() const = 0;
|
virtual float GetLockFireDuration() const = 0;
|
||||||
|
|
|
@ -47,7 +47,7 @@ int main(int argc, char** argv) {
|
||||||
if (compress) {
|
if (compress) {
|
||||||
size_t compressedSz = 0;
|
size_t compressedSz = 0;
|
||||||
z_stream strm = {.zalloc = Z_NULL, .zfree = Z_NULL, .opaque = Z_NULL};
|
z_stream strm = {.zalloc = Z_NULL, .zfree = Z_NULL, .opaque = Z_NULL};
|
||||||
int ret = deflateInit2(&strm, Z_BEST_COMPRESSION, Z_DEFLATED, MAX_WBITS | 16, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
|
int ret = deflateInit(&strm, Z_BEST_COMPRESSION);
|
||||||
if (ret != Z_OK) {
|
if (ret != Z_OK) {
|
||||||
fprintf(stderr, "zlib initialization failed %d\n", ret);
|
fprintf(stderr, "zlib initialization failed %d\n", ret);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -11,7 +11,7 @@ add_library(imgui
|
||||||
NotoMono.cpp
|
NotoMono.cpp
|
||||||
MetaforceIcon.cpp
|
MetaforceIcon.cpp
|
||||||
)
|
)
|
||||||
target_include_directories(imgui PUBLIC ${CMAKE_SOURCE_DIR}/extern/imgui ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(imgui PUBLIC ${CMAKE_SOURCE_DIR}/extern/imgui ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
|
||||||
target_compile_definitions(imgui PUBLIC IMGUI_USER_CONFIG="imconfig_user.h") # IMGUI_USE_WCHAR32
|
target_compile_definitions(imgui PUBLIC IMGUI_USER_CONFIG="imconfig_user.h") # IMGUI_USE_WCHAR32
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
# currently explicitly ignored for clang in imgui code, but not gcc (yet)
|
# currently explicitly ignored for clang in imgui code, but not gcc (yet)
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
#include <aurora/imgui.hpp>
|
#include <aurora/imgui.hpp>
|
||||||
|
|
||||||
#include "athena/Compression.hpp"
|
#include "Runtime/Streams/CMemoryInStream.hpp"
|
||||||
|
#include "Runtime/Streams/CZipInputStream.hpp"
|
||||||
|
|
||||||
#define STBI_NO_STDIO
|
#define STBI_NO_STDIO
|
||||||
#define STB_IMAGE_STATIC
|
#define STB_IMAGE_STATIC
|
||||||
|
@ -30,8 +31,10 @@ void ImGuiEngine_Initialize(float scale) {
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
auto* fontData = new uint8_t[NOTO_MONO_FONT_DECOMPRESSED_SZ];
|
auto* fontData = new uint8_t[NOTO_MONO_FONT_DECOMPRESSED_SZ];
|
||||||
athena::io::Compression::decompressZlib(static_cast<const atUint8*>(NOTO_MONO_FONT), atUint32(NOTO_MONO_FONT_SZ),
|
metaforce::CMemoryInStream memStream(static_cast<const u8*>(NOTO_MONO_FONT), NOTO_MONO_FONT_SZ,
|
||||||
fontData, NOTO_MONO_FONT_DECOMPRESSED_SZ);
|
metaforce::CMemoryInStream::EOwnerShip::NotOwned);
|
||||||
|
metaforce::CZipInputStream zipInputStream(std::make_unique<metaforce::CMemoryInStream>(memStream));
|
||||||
|
zipInputStream.Get(fontData, NOTO_MONO_FONT_DECOMPRESSED_SZ);
|
||||||
|
|
||||||
ImFontConfig fontConfig{};
|
ImFontConfig fontConfig{};
|
||||||
fontConfig.FontData = fontData;
|
fontConfig.FontData = fontData;
|
||||||
|
|
Loading…
Reference in New Issue