mirror of
https://github.com/zeldaret/botw
synced 2026-06-02 01:59:59 -04:00
ksys/gdt: Add reset wrappers to Manager and CommonFlags
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -160,4 +160,28 @@ GDT_SET_FLAG_(setVec4f, const sead::Vector4f&)
|
||||
|
||||
#undef GDT_SET_FLAG_
|
||||
|
||||
#define GDT_RESET_FLAG_(NAME) \
|
||||
[[gnu::noinline]] inline void NAME(FlagHandle handle, bool debug = false) { \
|
||||
auto* mgr = Manager::instance(); \
|
||||
if (mgr) \
|
||||
mgr->NAME(handle, debug); \
|
||||
} \
|
||||
[[gnu::noinline]] inline void NAME(FlagHandle handle, s32 sub_idx, bool debug = false) { \
|
||||
auto* mgr = Manager::instance(); \
|
||||
if (mgr) \
|
||||
mgr->NAME(handle, debug, sub_idx); \
|
||||
}
|
||||
|
||||
GDT_RESET_FLAG_(resetBool)
|
||||
GDT_RESET_FLAG_(resetS32)
|
||||
GDT_RESET_FLAG_(resetF32)
|
||||
GDT_RESET_FLAG_(resetStr)
|
||||
GDT_RESET_FLAG_(resetStr64)
|
||||
GDT_RESET_FLAG_(resetStr256)
|
||||
GDT_RESET_FLAG_(resetVec2f)
|
||||
GDT_RESET_FLAG_(resetVec3f)
|
||||
GDT_RESET_FLAG_(resetVec4f)
|
||||
|
||||
#undef GDT_SET_FLAG_
|
||||
|
||||
} // namespace ksys::gdt
|
||||
|
||||
@@ -145,6 +145,30 @@ public:
|
||||
|
||||
#undef PROXY_GET_SET_IMPL_
|
||||
|
||||
#define PROXY_RESET_IMPL_(NAME) \
|
||||
bool NAME(s32 idx) { return getBuffer1()->NAME(idx, mRef.mCheckPermissions); } \
|
||||
bool NAME(s32 idx, s32 sub_idx) { \
|
||||
return getBuffer1()->NAME(idx, sub_idx, mRef.mCheckPermissions); \
|
||||
} \
|
||||
bool NAME(const sead::SafeString& name) { \
|
||||
return getBuffer1()->NAME(name, mRef.mCheckPermissions); \
|
||||
} \
|
||||
bool NAME(const sead::SafeString& name, s32 sub_idx) { \
|
||||
return getBuffer1()->NAME(name, sub_idx, mRef.mCheckPermissions); \
|
||||
}
|
||||
|
||||
PROXY_RESET_IMPL_(resetBool)
|
||||
PROXY_RESET_IMPL_(resetS32)
|
||||
PROXY_RESET_IMPL_(resetF32)
|
||||
PROXY_RESET_IMPL_(resetStr)
|
||||
PROXY_RESET_IMPL_(resetStr64)
|
||||
PROXY_RESET_IMPL_(resetStr256)
|
||||
PROXY_RESET_IMPL_(resetVec2f)
|
||||
PROXY_RESET_IMPL_(resetVec3f)
|
||||
PROXY_RESET_IMPL_(resetVec4f)
|
||||
|
||||
#undef PROXY_RESET_IMPL_
|
||||
|
||||
private:
|
||||
friend class TriggerParamRef;
|
||||
Proxy(const TriggerParamRef& ref, bool param1) : mUseParam1(param1), mRef(ref) {}
|
||||
@@ -345,16 +369,14 @@ public:
|
||||
\
|
||||
bool NAME(TRAITS::WrapperArgType value, FlagHandle handle, bool debug) { \
|
||||
if (debug) { \
|
||||
setBool(true, "IsChangedByDebug"); \
|
||||
mBitFlags.set(BitFlag::_800); \
|
||||
onChangedByDebug(); \
|
||||
return NAME##NoCheckForce(TRAITS::convertValue(value), handle); \
|
||||
} \
|
||||
return NAME(TRAITS::convertValue(value), handle); \
|
||||
} \
|
||||
bool NAME(TRAITS::WrapperArgType value, const sead::SafeString& name, bool debug) { \
|
||||
if (debug) { \
|
||||
setBool(true, "IsChangedByDebug"); \
|
||||
mBitFlags.set(BitFlag::_800); \
|
||||
onChangedByDebug(); \
|
||||
return NAME##NoCheckForce(TRAITS::convertValue(value), name); \
|
||||
} \
|
||||
return NAME(TRAITS::convertValue(value), name); \
|
||||
@@ -362,8 +384,7 @@ public:
|
||||
\
|
||||
bool NAME(TRAITS::WrapperArgType value, FlagHandle handle, bool debug, s32 sub_idx) { \
|
||||
if (debug) { \
|
||||
setBool(true, "IsChangedByDebug"); \
|
||||
mBitFlags.set(BitFlag::_800); \
|
||||
onChangedByDebug(); \
|
||||
return NAME##NoCheckForce(TRAITS::convertValue(value), handle, sub_idx); \
|
||||
} \
|
||||
return NAME(TRAITS::convertValue(value), handle, sub_idx); \
|
||||
@@ -371,8 +392,7 @@ public:
|
||||
bool NAME(TRAITS::WrapperArgType value, const sead::SafeString& name, bool debug, \
|
||||
s32 sub_idx) { \
|
||||
if (debug) { \
|
||||
setBool(true, "IsChangedByDebug"); \
|
||||
mBitFlags.set(BitFlag::_800); \
|
||||
onChangedByDebug(); \
|
||||
return NAME##NoCheckForce(TRAITS::convertValue(value), name, sub_idx); \
|
||||
} \
|
||||
return NAME(TRAITS::convertValue(value), name, sub_idx); \
|
||||
@@ -390,6 +410,55 @@ public:
|
||||
|
||||
#undef GDT_SET_
|
||||
|
||||
#define GDT_RESET_(NAME) \
|
||||
KSYS_ALWAYS_INLINE bool NAME##_(FlagHandle handle, bool debug) { \
|
||||
if (mBitFlags.isOn(BitFlag::_40000)) \
|
||||
return false; \
|
||||
return unwrapHandle<false>( \
|
||||
handle, debug, [&](u32 idx, TriggerParamRef& ref) { return ref.get().NAME(idx); }); \
|
||||
} \
|
||||
inline bool NAME(FlagHandle handle) { return NAME##_(handle, false); } \
|
||||
inline bool NAME##NoCheck(FlagHandle handle) { return NAME##_(handle, true); } \
|
||||
\
|
||||
KSYS_ALWAYS_INLINE bool NAME##_(FlagHandle handle, bool debug, s32 sub_idx) { \
|
||||
if (mBitFlags.isOn(BitFlag::_40000)) \
|
||||
return false; \
|
||||
return unwrapHandle<false>(handle, debug, [&](u32 idx, TriggerParamRef& ref) { \
|
||||
return ref.get().NAME(idx, sub_idx); \
|
||||
}); \
|
||||
} \
|
||||
inline bool NAME(FlagHandle handle, s32 sub_idx) { return NAME##_(handle, false, sub_idx); } \
|
||||
inline bool NAME##NoCheck(FlagHandle handle, s32 sub_idx) { \
|
||||
return NAME##_(handle, true, sub_idx); \
|
||||
} \
|
||||
\
|
||||
inline bool NAME(FlagHandle handle, bool debug) { \
|
||||
if (debug) { \
|
||||
onChangedByDebug(); \
|
||||
return NAME##NoCheck(handle); \
|
||||
} \
|
||||
return NAME(handle); \
|
||||
} \
|
||||
inline bool NAME(FlagHandle handle, bool debug, s32 sub_idx) { \
|
||||
if (debug) { \
|
||||
onChangedByDebug(); \
|
||||
return NAME##NoCheck(handle, sub_idx); \
|
||||
} \
|
||||
return NAME(handle, sub_idx); \
|
||||
}
|
||||
|
||||
GDT_RESET_(resetBool)
|
||||
GDT_RESET_(resetS32)
|
||||
GDT_RESET_(resetF32)
|
||||
GDT_RESET_(resetStr)
|
||||
GDT_RESET_(resetStr64)
|
||||
GDT_RESET_(resetStr256)
|
||||
GDT_RESET_(resetVec2f)
|
||||
GDT_RESET_(resetVec3f)
|
||||
GDT_RESET_(resetVec4f)
|
||||
|
||||
#undef GDT_RESET_
|
||||
|
||||
void init(sead::Heap* heap, sead::Framework* framework);
|
||||
|
||||
void addReinitCallback(ReinitSignal::Slot& slot);
|
||||
@@ -467,6 +536,11 @@ private:
|
||||
unwrapHandle<Write, false>(handle, fn);
|
||||
}
|
||||
|
||||
void onChangedByDebug() {
|
||||
setBool(true, "IsChangedByDebug");
|
||||
mBitFlags.set(BitFlag::_800);
|
||||
}
|
||||
|
||||
void loadGameData(const sead::SafeString& path);
|
||||
void loadShopGameDataInfo(const sead::SafeString& path);
|
||||
void unloadResources();
|
||||
|
||||
Reference in New Issue
Block a user