mirror of https://github.com/zeldaret/botw.git
ksys/gdt: Add TriggerParamConfig
This commit is contained in:
parent
82a6c0152e
commit
fd9b8ad11d
|
|
@ -74543,8 +74543,9 @@
|
|||
0x0000007100df2630,sub_7100DF2630,60,
|
||||
0x0000007100df266c,sub_7100DF266C,60,
|
||||
0x0000007100df26a8,sub_7100DF26A8,60,
|
||||
0x0000007100df2738,sub_7100DF2738,460,
|
||||
0x0000007100df2904,sub_7100DF2904,360,
|
||||
0x0000007100df26f0,_ZN4ksys3gdt12TriggerParam23setCurrentRupeeFlagNameERKN4sead14SafeStringBaseIcEE,0x48,_ZN4ksys3gdt12TriggerParam23setCurrentRupeeFlagNameERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100df2738,sub_7100DF2738,460,_ZN4ksys3gdt19shouldLogFlagChangeERKN4sead14SafeStringBaseIcEENS0_8FlagTypeE
|
||||
0x0000007100df2904,sub_7100DF2904,360,_ZN4ksys3gdt12getFlagColorENS0_8FlagTypeE?
|
||||
0x0000007100df2a6c,sub_7100DF2A6C,8,
|
||||
0x0000007100df2a74,sub_7100DF2A74,44,
|
||||
0x0000007100df2aa0,nullsub_3859,4,
|
||||
|
|
@ -74763,7 +74764,7 @@
|
|||
0x0000007100df66ac,sub_7100DF66AC,268,
|
||||
0x0000007100df67b8,sub_7100DF67B8,268,
|
||||
0x0000007100df68c4,sub_7100DF68C4,268,
|
||||
0x0000007100df69d0,sub_7100DF69D0,268,
|
||||
0x0000007100df69d0,sub_7100DF69D0,268,_GLOBAL__sub_I_gdtTriggerParam.cpp
|
||||
0x0000007100df6adc,ResourceBgdata::ctor,136,_ZN4ksys3res8GameDataC1Ev
|
||||
0x0000007100df6b64,ResourceBgdata::dtor,20,_ZN4ksys3res8GameDataD1Ev
|
||||
0x0000007100df6b78,ResourceBgdata::dtorDelete,52,_ZN4ksys3res8GameDataD0Ev
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <mc/seadCoreInfo.h>
|
||||
#include "KingSystem/GameData/gdtFlagProxy.h"
|
||||
#include "KingSystem/Resource/resResourceGameData.h"
|
||||
#include "KingSystem/Utils/InitTimeInfo.h"
|
||||
#include "KingSystem/Utils/SafeDelete.h"
|
||||
|
||||
namespace ksys::gdt {
|
||||
|
|
@ -18,6 +19,33 @@ TriggerParam::TriggerParam() {
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct TriggerParamConfig {
|
||||
bool shouldLog(const sead::SafeString& flag_name, u8 event_type) const {
|
||||
if (enabled_events.isOffBit(event_type))
|
||||
return false;
|
||||
|
||||
return flag_to_log.isEmpty() || flag_name.include(flag_to_log);
|
||||
}
|
||||
|
||||
bool shouldPrintStackTrace(const sead::SafeString& flag_name) const {
|
||||
return !flag_to_log.isEmpty() && flag_name.include(flag_to_log) &&
|
||||
enabled_events.isOnBit(5);
|
||||
}
|
||||
|
||||
sead::SafeString& getCurrentRupeeFlagName() { return current_rupee_flag_name; }
|
||||
|
||||
sead::BitFlag8 enabled_events;
|
||||
s32 foo = 90;
|
||||
s32 index = 32;
|
||||
sead::FixedSafeString<128> flag_to_log{""};
|
||||
s32 num_current_rupee_flag_name_changes = 0;
|
||||
sead::SafeString current_rupee_flag_name;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(TriggerParamConfig, 0xc0);
|
||||
|
||||
util::InitTimeInfoEx sInitTimeInfo;
|
||||
TriggerParamConfig sConfig;
|
||||
|
||||
// TODO (low-priority): implement this without using <algorithm> to match the original code
|
||||
// The original code appears to perform a heapsort.
|
||||
[[gnu::noinline]] void sortFlagPtrArray(sead::PtrArray<FlagBase>& array) {
|
||||
|
|
@ -948,4 +976,58 @@ s32 TriggerParam::getVec4fArrayIdx(u32 name) const {
|
|||
return getFlagIndex(mVector4fArrayFlags, name);
|
||||
}
|
||||
|
||||
void TriggerParam::setCurrentRupeeFlagName(const sead::SafeString& name) {
|
||||
if (sConfig.num_current_rupee_flag_name_changes <= 0) {
|
||||
sConfig.getCurrentRupeeFlagName() = name;
|
||||
++sConfig.num_current_rupee_flag_name_changes;
|
||||
}
|
||||
}
|
||||
|
||||
bool shouldLogFlagChange(const sead::SafeString& flag_name, FlagType type) {
|
||||
u8 event_type;
|
||||
|
||||
if (s32(type) == FlagType::Bool || s32(type) == FlagType::BoolArray)
|
||||
event_type = 0;
|
||||
|
||||
else if (s32(type) == FlagType::S32 || s32(type) == FlagType::S32Array)
|
||||
event_type = 1;
|
||||
|
||||
else if (s32(type) == FlagType::F32 || s32(type) == FlagType::F32Array)
|
||||
event_type = 2;
|
||||
|
||||
else if (s32(type) == FlagType::Vector2f || s32(type) == FlagType::Vector2fArray ||
|
||||
s32(type) == FlagType::Vector3f || s32(type) == FlagType::Vector3fArray ||
|
||||
s32(type) == FlagType::Vector4f || s32(type) == FlagType::Vector4fArray)
|
||||
event_type = 4;
|
||||
|
||||
else if (s32(type) == FlagType::String || s32(type) == FlagType::StringArray ||
|
||||
s32(type) == FlagType::String64 || s32(type) == FlagType::String64Array ||
|
||||
s32(type) == FlagType::String256 || s32(type) == FlagType::String256Array)
|
||||
event_type = 3;
|
||||
|
||||
else
|
||||
event_type = 7;
|
||||
|
||||
return sConfig.shouldLog(flag_name, event_type);
|
||||
}
|
||||
|
||||
// NON_MATCHING: reorderings (which result in other small differences)
|
||||
sead::Color4f getFlagColor(FlagType type) {
|
||||
if (s32(type) == FlagType::Bool || s32(type) == FlagType::BoolArray)
|
||||
return sead::Color4f::cRed;
|
||||
|
||||
if (s32(type) == FlagType::F32 || s32(type) == FlagType::F32Array ||
|
||||
s32(type) == FlagType::Vector2f || s32(type) == FlagType::Vector2fArray ||
|
||||
s32(type) == FlagType::Vector3f || s32(type) == FlagType::Vector3fArray ||
|
||||
s32(type) == FlagType::Vector4f || s32(type) == FlagType::Vector4fArray)
|
||||
return sead::Color4f::cYellow;
|
||||
|
||||
if (s32(type) == FlagType::String || s32(type) == FlagType::StringArray ||
|
||||
s32(type) == FlagType::String64 || s32(type) == FlagType::String64Array ||
|
||||
s32(type) == FlagType::String256 || s32(type) == FlagType::String256Array)
|
||||
return sead::Color4f::cWhite;
|
||||
|
||||
return sead::Color4f::cBlue;
|
||||
}
|
||||
|
||||
} // namespace ksys::gdt
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <container/seadObjArray.h>
|
||||
#include <container/seadPtrArray.h>
|
||||
#include <container/seadSafeArray.h>
|
||||
#include <gfx/seadColor.h>
|
||||
#include <prim/seadStorageFor.h>
|
||||
#include <prim/seadTypedBitFlag.h>
|
||||
#include "KingSystem/GameData/gdtFlag.h"
|
||||
|
|
@ -50,6 +51,8 @@ public:
|
|||
|
||||
FlagType getFlagType(const sead::SafeString& name) const;
|
||||
|
||||
void setCurrentRupeeFlagName(const sead::SafeString& name);
|
||||
|
||||
// region Value getters (by hash)
|
||||
|
||||
bool getBool(bool* value, s32 index, bool check_permissions) const;
|
||||
|
|
@ -280,4 +283,7 @@ private:
|
|||
};
|
||||
KSYS_CHECK_SIZE_NX150(TriggerParam, 0x3f0);
|
||||
|
||||
bool shouldLogFlagChange(const sead::SafeString& flag_name, FlagType flag_type);
|
||||
sead::Color4f getFlagColor(FlagType type);
|
||||
|
||||
} // namespace ksys::gdt
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ namespace ksys::util {
|
|||
class InitTimeInfo {
|
||||
public:
|
||||
InitTimeInfo() = default;
|
||||
explicit InitTimeInfo(sead::TickTime start_time) : mInitStartTime(start_time) {}
|
||||
|
||||
sead::TickTime getInitStartTime() const { return mInitStartTime; }
|
||||
sead::TickSpan getInitDuration() const { return mInitDuration; }
|
||||
|
|
@ -20,4 +21,21 @@ private:
|
|||
};
|
||||
KSYS_CHECK_SIZE_NX150(InitTimeInfo, 0x10);
|
||||
|
||||
class InitTimeInfoEx {
|
||||
public:
|
||||
explicit InitTimeInfoEx(sead::TickTime start_time = {}) : mInfo(start_time) {}
|
||||
|
||||
u32 getField0() const { return _0; }
|
||||
u32 getField4() const { return _4; }
|
||||
|
||||
InitTimeInfo& getInfo() { return mInfo; }
|
||||
const InitTimeInfo& getInfo() const { return mInfo; }
|
||||
|
||||
private:
|
||||
u32 _0 = 0;
|
||||
u32 _4 = 0x8004EF;
|
||||
InitTimeInfo mInfo;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(InitTimeInfoEx, 0x18);
|
||||
|
||||
} // namespace ksys::util
|
||||
|
|
|
|||
Loading…
Reference in New Issue