Revert "Add #ifdef declarations for NON_MATCHING code"

This reverts commit 42807160cf.

It makes searching for NON_MATCHING comment descriptions much less
convenient in most text editors or IDEs, and we want the function
CSV to be the single source of truth for function statuses. Having
a function marked as matching but not built because of a stray #ifdef
would be bad.
This commit is contained in:
Léo Lam 2022-02-27 12:48:28 +01:00
parent a564186002
commit df36d65665
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
52 changed files with 93 additions and 257 deletions

View File

@ -8,8 +8,7 @@ HasSetItem::HasSetItem(const InitArg& arg) : ksys::act::ai::Query(arg) {}
HasSetItem::~HasSetItem() = default;
// temp duplication
#ifdef NON_MATCHING
// NON_MATCHING: temp duplication
int HasSetItem::doQuery() {
auto* gdm = ksys::gdt::Manager::instance();
if (gdm == nullptr)
@ -28,7 +27,6 @@ int HasSetItem::doQuery() {
}
return 0;
}
#endif
void HasSetItem::loadParams(const evfl::QueryArg& arg) {
loadInt(arg.param_accessor, "Count");

View File

@ -309,8 +309,7 @@ bool WeaponModifierInfo::pickRandomYellowModifierAmiibo(const sead::SafeString&
return pickRandomModifierAmiibo(ranges);
}
// isConfigValid() somehow does not match when inlined (but matches the Wii U version)
#ifdef NON_MATCHING
// NON_MATCHING: isConfigValid() somehow does not match when inlined (but matches the Wii U version)
bool WeaponModifierInfo::pickRandomBlueModifierTbox(const sead::SafeString& actor) {
auto* info = ksys::act::InfoData::instance();
if (!info)
@ -329,7 +328,6 @@ bool WeaponModifierInfo::pickRandomBlueModifierTbox(const sead::SafeString& acto
return pickRandomModifier(ranges);
}
#endif
bool WeaponModifierInfo::pickRandomModifier(const WeaponModifierRanges& ranges) {
const auto modifier = ranges.getRandomModifier();
@ -410,8 +408,7 @@ bool WeaponModifierRanges::loadTierBlue(const ksys::res::GParamList& gparamlist)
return true;
}
// isConfigValid() somehow does not match when inlined (but matches the Wii U version)
#ifdef NON_MATCHING
// NON_MATCHING: isConfigValid() somehow does not match when inlined (but matches the Wii U version)
bool WeaponModifierInfo::pickRandomBlueModifierActor(const ksys::act::ActorConstDataAccess& acc) {
WeaponModifierRanges ranges;
const auto& gparamlist = *acc.getGParamList();
@ -422,10 +419,8 @@ bool WeaponModifierInfo::pickRandomBlueModifierActor(const ksys::act::ActorConst
}
return false;
}
#endif
// isConfigValid() somehow does not match when inlined (but matches the Wii U version)
#ifdef NON_MATCHING
// NON_MATCHING: isConfigValid() somehow does not match when inlined (but matches the Wii U version)
bool WeaponModifierInfo::pickRandomYellowModifierTbox(const sead::SafeString& actor) {
auto* info = ksys::act::InfoData::instance();
if (!info)
@ -444,7 +439,6 @@ bool WeaponModifierInfo::pickRandomYellowModifierTbox(const sead::SafeString& ac
return pickRandomModifier(ranges);
}
#endif
bool WeaponModifierRanges::loadTierYellow(const ksys::res::GParamList& gparamlist) {
const auto* param = gparamlist.getWeaponCommon();
@ -465,8 +459,7 @@ bool WeaponModifierRanges::loadTierYellow(const ksys::res::GParamList& gparamlis
return true;
}
// isConfigValid() somehow does not match when inlined (but matches the Wii U version)
#ifdef NON_MATCHING
// NON_MATCHING: isConfigValid() somehow does not match when inlined (but matches the Wii U version)
bool WeaponModifierInfo::pickRandomYellowModifierActor(const ksys::act::ActorConstDataAccess& acc) {
WeaponModifierRanges ranges;
const auto& gparamlist = *acc.getGParamList();
@ -477,6 +470,5 @@ bool WeaponModifierInfo::pickRandomYellowModifierActor(const ksys::act::ActorCon
}
return false;
}
#endif
} // namespace uking::act

View File

@ -450,8 +450,7 @@ bool Manager::parseVersion() {
return true;
}
// stack and duplicated branch -- volatile variables are painful
#ifdef NON_MATCHING
// NON_MATCHING: stack and duplicated branch -- volatile variables are painful
void Manager::checkVersion() {
if (mVersion == 0)
return;
@ -470,7 +469,6 @@ void Manager::checkVersion() {
mVersionFlags.isOnBit(VersionError(VersionError::TooOld));
mVersionFlags.isOnBit(VersionError(VersionError::TooNew));
}
#endif
bool Manager::VersionFile::readVersion() {
if (!file_handle.requestedLoad())

View File

@ -18,11 +18,9 @@ DamageManagerBase_UnknownBase1::DamageManagerBase_UnknownBase1(ksys::act::Actor*
// when writing the vtable and Actor.
// The original Compiler writes (0x8, 0x10) in one 'stp', and writes 0x0 and 0x18 individually with
// 'str'. The rest seems to fall out of sync due to that, but it's otherwise functionally the same.
// Incorrect order.
#ifdef NON_MATCHING
// NON_MATCHING: Incorrect order.
DamageManagerBase::DamageManagerBase(ksys::act::Actor* actor)
: DamageManagerBase_UnknownBase1(actor) {}
#endif
u32 DamageManagerBase::getDamage() {
u32 result;

View File

@ -1054,8 +1054,7 @@ void PauseMenuDataMgr::autoEquipLastAddedItem() {
}
}
// branching
#ifdef NON_MATCHING
// NON_MATCHING: branching
const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
const sead::OffsetList<PouchItem>& list) {
const auto type = item->getType();
@ -1086,10 +1085,8 @@ const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
saveToGameData(list);
return sead::SafeString::cEmptyString;
}
#endif
// harmless reordering
#ifdef NON_MATCHING
// NON_MATCHING: harmless reordering
void PauseMenuDataMgr::unequipAll(PouchItemType type) {
const auto lock = sead::makeScopedLock(mCritSection);
@ -1113,7 +1110,6 @@ void PauseMenuDataMgr::unequipAll(PouchItemType type) {
}
}
}
#endif
KSYS_ALWAYS_INLINE inline void
PauseMenuDataMgr::deleteItem_(const sead::OffsetList<PouchItem>& list, PouchItem* item,
@ -1198,8 +1194,7 @@ void PauseMenuDataMgr::removeArrow(const sead::SafeString& arrow_name, int count
ksys::gdt::setFlag_PorchItem_Value1(num, idx);
}
// branch merging -- but this is pretty clearly equivalent
#ifdef NON_MATCHING
// NON_MATCHING: branch merging -- but this is pretty clearly equivalent
int PauseMenuDataMgr::getItemCount(const sead::SafeString& name, bool count_equipped) const {
const auto type = getType(name);
if (isPouchItemInvalid(type))
@ -1266,7 +1261,6 @@ int PauseMenuDataMgr::getItemCount(const sead::SafeString& name, bool count_equi
}
return count;
}
#endif
void PauseMenuDataMgr::setEquippedWeaponItemValue(s32 value, PouchItemType type) {
if (isPouchItemNotWeapon(type))
@ -1344,8 +1338,7 @@ void PauseMenuDataMgr::removeGrabbedItems() {
saveToGameData(items);
}
// mostly branching (which leads to other differences), but visibly equivalent
#ifdef NON_MATCHING
// NON_MATCHING: mostly branching (which leads to other differences), but visibly equivalent
bool PauseMenuDataMgr::addGrabbedItem(ksys::act::BaseProcLink* link) {
if (!link || !link->hasProc())
return false;
@ -1385,7 +1378,6 @@ bool PauseMenuDataMgr::addGrabbedItem(ksys::act::BaseProcLink* link) {
mGrabbedItems[4] = {};
return found;
}
#endif
bool PauseMenuDataMgr::getEquippedArrowType(sead::BufferedSafeString* name, int* count) const {
const auto lock = sead::makeScopedLock(mCritSection);
@ -1656,8 +1648,7 @@ PouchCategory PauseMenuDataMgr::getCategoryForType(PouchItemType type) const {
}
}
// two harmless reorderings
#ifdef NON_MATCHING
// NON_MATCHING: two harmless reorderings
void PauseMenuDataMgr::removeCookResult(const sead::SafeString& name, s32 effect_type,
bool check_effect) {
auto* info = ksys::act::InfoData::instance();
@ -1716,7 +1707,6 @@ void PauseMenuDataMgr::removeCookResult(const sead::SafeString& name, s32 effect
updateInventoryInfo(items);
updateListHeads();
}
#endif
bool PauseMenuDataMgr::switchEquipment(const sead::SafeString& name, int* value,
act::WeaponModifierInfo* modifier) {
@ -2203,8 +2193,7 @@ int pouchItemSortPredicateForArrow(const PouchItem* lhs, const PouchItem* rhs) {
return (*fn)(lhs, rhs, info_data);
}
// branching, but this is so trivial it isn't worth spending time on matching this
#ifdef NON_MATCHING
// NON_MATCHING: branching, but this is so trivial it isn't worth spending time on matching this
const sead::SafeString* PauseMenuDataMgr::getEquippedItemName(PouchItemType type) const {
const auto lock = sead::makeScopedLock(mCritSection);
const auto& items = getItems();
@ -2219,7 +2208,6 @@ const sead::SafeString* PauseMenuDataMgr::getEquippedItemName(PouchItemType type
}
return nullptr;
}
#endif
const PouchItem* PauseMenuDataMgr::getEquippedItem(PouchItemType type) const {
const auto lock = sead::makeScopedLock(mCritSection);
@ -2556,8 +2544,7 @@ bool PauseMenuDataMgr::isOverCategoryLimit(PouchItemType type) const {
return true;
}
// branching (really weird issue...)
#ifdef NON_MATCHING
// NON_MATCHING: branching (really weird issue...)
int PauseMenuDataMgr::countArmors(const sead::SafeString& lowest_rank_armor_name) const {
if (!isPouchItemArmor(getType(lowest_rank_armor_name)))
return 0;
@ -2584,7 +2571,6 @@ int PauseMenuDataMgr::countArmors(const sead::SafeString& lowest_rank_armor_name
}
return count;
}
#endif
void PauseMenuDataMgr::addNonDefaultItem(const sead::SafeString& name, int value,
const act::WeaponModifierInfo* modifier) {

View File

@ -10,8 +10,7 @@
namespace ksys::act {
// reorders at the beginning because of initFlags -- should be equivalent
#ifdef NON_MATCHING
// NON_MATCHING: reorders at the beginning because of initFlags -- should be equivalent
LodState::LodState(sead::Heap* heap, sead::BitFlag32 flags, Actor* actor,
int disable_calc_skip_frame, float x)
: mFlags14(flags), mActor(actor), _44(x), mDisableCalcSkipFrame(disable_calc_skip_frame) {
@ -302,15 +301,13 @@ LodState::LodState(sead::Heap* heap, sead::BitFlag32 flags, Actor* actor,
_50 = 3.0f;
}
}
#endif
LodState::~LodState() {
if (mOcclusionQueryCylinder)
delete mOcclusionQueryCylinder;
}
// ????? reordering
#ifdef NON_MATCHING
// NON_MATCHING: ????? reordering
void LodState::initFlags() {
_28 = 1.0;
_40 = 0.0;
@ -331,6 +328,5 @@ void LodState::initFlags() {
_60 = 0xFFFF;
_64 = -3;
}
#endif
} // namespace ksys::act

View File

@ -15,8 +15,7 @@ void ASSetting::init(const sead::SafeString& config_path, sead::Heap* heap) {
mHandle.load(config_path, &req);
}
// sead::DirectResource to res::ASSetting cast nullptr check; branching for the return
#ifdef NON_MATCHING
// NON_MATCHING: sead::DirectResource to res::ASSetting cast nullptr check; branching for the return
res::ASParamParser* ASSetting::getBoneParams(const sead::SafeString& key) const {
auto* res = sead::DynamicCast<res::ASSetting>(mHandle.getResource());
if (!res)
@ -28,6 +27,5 @@ res::ASParamParser* ASSetting::getBoneParams(const sead::SafeString& key) const
}
return nullptr;
}
#endif
} // namespace ksys::act

View File

@ -166,8 +166,7 @@ bool ActorCreator::requestCreateActor(const char* name, sead::Heap* heap, BasePr
return requestCreateActor_(actor_class, name, heap, map_object, handle, task_lane_id, params);
}
// OffsetList iteration
#ifdef NON_MATCHING
// NON_MATCHING: OffsetList iteration
void ActorCreator::enableDistanceUnloadChecks() {
const auto lock = sead::makeScopedLock(mActorListCS);
for (auto it = mActorList.robustBegin(); it != mActorList.robustEnd(); ++it) {
@ -177,7 +176,6 @@ void ActorCreator::enableDistanceUnloadChecks() {
}
mEnableDistanceChecks = true;
}
#endif
void ActorCreator::eraseActor(Actor* actor) {
const auto lock = sead::makeScopedLock(mActorListCS);

View File

@ -175,8 +175,7 @@ ActorParam* ActorParamMgr::allocParam(const char* actor_name, bool* allocated_ne
return param;
}
// addressing mode
#ifdef NON_MATCHING
// NON_MATCHING: addressing mode
ActorParam* ActorParamMgr::getParam(const char* actor_name, ActorParam** out_free_param) const {
auto lock = sead::makeScopedLock(mCS);
for (s32 i = 0; i < NumParams; ++i) {
@ -190,7 +189,6 @@ ActorParam* ActorParamMgr::getParam(const char* actor_name, ActorParam** out_fre
}
return nullptr;
}
#endif
ActorParam* ActorParamMgr::loadParam(const char* actor_name, res::Handle* pack_handle, void* x,
u32 load_req_c) {
@ -293,8 +291,7 @@ bool ActorParamMgr::loadFileAsync(ActorParam* param, ActorParam::ResourceType ty
return true;
}
// different address calculation for static_cast<ParamIO*>(res)->getPath()
#ifdef NON_MATCHING
// NON_MATCHING: different address calculation for static_cast<ParamIO*>(res)->getPath()
template <typename T>
T* ActorParamMgr::handleAsyncFileLoad(ActorParam* param, s32* idx, ActorParam::ResourceType type,
void*) {
@ -332,7 +329,6 @@ T* ActorParamMgr::handleAsyncFileLoad(ActorParam* param, s32* idx, ActorParam::R
return res;
}
#endif
bool ActorParamMgr::finishLoadingActorLink(ActorParam* param, void* x) {
s32 idx = 0;

View File

@ -115,8 +115,7 @@ bool hasOneTagAtLeast(const ActorConstDataAccess& accessor, const sead::SafeStri
return false;
}
// this version doesn't have unnecessary register moves.
#ifdef NON_MATCHING
// NON_MATCHING: this version doesn't have unnecessary register moves.
bool shouldSkipSpawnWhenRaining(map::Object* obj) {
if (obj->getFlags().isOff(map::Object::Flag::CreateNotRain))
return false;
@ -127,7 +126,6 @@ bool shouldSkipSpawnWhenRaining(map::Object* obj) {
const auto pos = obj->getTranslate();
return !world::Manager::instance()->isRaining(pos);
}
#endif
bool shouldSkipSpawnIfGodForestOff(map::Object* obj) {
bool value = false;
@ -181,8 +179,7 @@ auto initSpawnConditionGameDataFlags_dummy() {
return sIsGetStopTimerLv2Handle;
}
// redundant branches in the original code.
#ifdef NON_MATCHING
// NON_MATCHING: redundant branches in the original code.
bool hasAnyRevivalTag(const sead::SafeString& actor) {
auto* info = InfoData::instance();
al::ByamlIter iter;
@ -203,7 +200,6 @@ bool hasAnyRevivalTag(const sead::SafeString& actor) {
}
return false;
}
#endif
bool hasStopTimerMiddleTag(Actor* actor) {
return hasTag(actor, tags::StopTimerMiddle);
@ -213,12 +209,10 @@ bool hasStopTimerShortTag(Actor* actor) {
return hasTag(actor, tags::StopTimerShort);
}
// ???
#ifdef NON_MATCHING
// NON_MATCHING: ???
const char* arrowTypeToString(ArrowType idx) {
return sArrowTypes[u32(idx)];
}
#endif
ArrowType arrowTypeFromString(const sead::SafeString& name) {
for (s32 i = 0; i < sArrowTypes.size(); ++i) {

View File

@ -42,8 +42,7 @@ void AIClassDef::init(const sead::SafeString& aidef_file_name, sead::Heap* heap)
mData->load(heap);
}
// not trying to match the heap sort. The rest should be equivalent
#ifdef NON_MATCHING
// NON_MATCHING: not trying to match the heap sort. The rest should be equivalent
bool AIClassDef::Data::load(sead::Heap* heap) {
root_iter.tryGetIterByKey(&iters[s32(AIDefType::AI)], str_AIs);
root_iter.tryGetIterByKey(&iters[s32(AIDefType::Action)], str_Actions);
@ -83,7 +82,6 @@ bool AIClassDef::Data::load(sead::Heap* heap) {
return true;
}
#endif
s32 AIClassDef::getRawDefIdx(const sead::SafeString& def_name, AIDefType type) const {
const auto hash = sead::HashCRC32::calcStringHash(def_name);
@ -139,8 +137,7 @@ void AIClassDef::getDef(const sead::SafeString& class_name, AIDefSet* set,
data->inst_params_key_idx[s32(AIDefInstParamKind::AITree)]);
}
// CalcTiming ifs are reordered
#ifdef NON_MATCHING
// NON_MATCHING: CalcTiming ifs are reordered
void AIClassDef::doGetDef(AIDef* def, const al::ByamlIter& iter, AIDefInstParamKind param_kind,
AIDefType class_type, s32 key_idx) const {
def->no_stop = false;
@ -262,7 +259,6 @@ void AIClassDef::doGetDef(AIDef* def, const al::ByamlIter& iter, AIDefInstParamK
++def->num_params;
}
}
#endif
void AIClassDef::getDef(AIDef* def, const sead::SafeString& class_name,
AIDefInstParamKind param_kind, AIDefType class_type) const {

View File

@ -155,8 +155,7 @@ BaseProc::PreDeletePrepareResult BaseProc::prepareForPreDelete_() {
return PreDeletePrepareResult::Done;
}
// branching
#ifdef NON_MATCHING
// NON_MATCHING: branching
bool BaseProc::startPreparingForPreDelete_() {
if (mUpdateStateListNode.isLinked())
return false;
@ -164,7 +163,6 @@ bool BaseProc::startPreparingForPreDelete_() {
return !mBaseProcLinkData || mBaseProcLinkData->refCount() <= 0 ||
BaseProcMgr::instance()->getUnk3() || tera::checkTeraSystemStatus();
}
#endif
void BaseProc::destruct_(int should_destruct) {
if (should_destruct == 1) {
@ -348,8 +346,7 @@ void BaseProc::jobInvoked(JobType type) {
}
}
// branching
#ifdef NON_MATCHING
// NON_MATCHING: branching
bool BaseProc::processStateUpdate(u8 counter) {
const bool delete_requested = mStateFlags.isOn(StateFlags::RequestDelete);
const bool initialized = mFlags.isOn(Flags::Initialized);
@ -447,7 +444,6 @@ bool BaseProc::processStateUpdate(u8 counter) {
mStateFlags = new_flags;
return ret;
}
#endif
void BaseProc::processPreDelete() {
if (!mFlags.isOn(Flags::Initialized))

View File

@ -80,6 +80,7 @@ bool BaseProcJobQue::pushJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists,
return true;
}
// NON_MATCHING: sxtw + madd -> smaddl
bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists, int priority,
JobType type) {
const auto& list = lists->getList(priority);

View File

@ -40,8 +40,7 @@ BaseProcMgr::~BaseProcMgr() {
BaseProcHeapMgr::deleteInstance();
}
// mJobLists.allocBufferAssert - BaseProcJobLists ctor
#ifdef NON_MATCHING
// NON_MATCHING: mJobLists.allocBufferAssert - BaseProcJobLists ctor
void BaseProcMgr::init(sead::Heap* heap, s32 num_job_types, u32 main_thread_id,
u32 havok_thread_id1, u32 havok_thread_id2,
const BaseProcInitializerArgs& initializer_args) {
@ -67,7 +66,6 @@ void BaseProcMgr::init(sead::Heap* heap, s32 num_job_types, u32 main_thread_id,
BaseProcHeapMgr::createInstance(heap);
BaseProcLinkDataMgr::createInstance(heap);
}
#endif
void BaseProcMgr::generateProcId(u32* id) {
*id = mCreatedProcCounter.increment();
@ -531,8 +529,7 @@ BaseProc* BaseProcMgr::getProc(const u32& id, BaseProcMgr::ProcFilters filters)
return proc;
}
// stack
#ifdef NON_MATCHING
// NON_MATCHING: stack
void BaseProcMgr::forEachProc(sead::IDelegate1<BaseProc*>& callback, ProcFilters filters) {
const auto lock = sead::makeScopedLock(mProcMapCS);
@ -545,7 +542,6 @@ void BaseProcMgr::forEachProc(sead::IDelegate1<BaseProc*>& callback, ProcFilters
mProcMap.forEach(sead::Delegate1<ProcForEachContext, util::StrTreeMapNode*>(
&context, &ProcForEachContext::forEach));
}
#endif
void BaseProcMgr::forEachProc(const sead::SafeString& proc_name,
sead::IDelegate1<BaseProc*>& callback,
@ -637,12 +633,12 @@ void BaseProcMgr::decrementUnk3() {
--mUnk3;
}
// NON_MATCHING: reorderings
void BaseProcMgr::queueExtraJobPush(BaseProcJobLink* job_link) {
getExtraJobs().pushBack(job_link);
}
// ???
#ifdef NON_MATCHING
// NON_MATCHING: ???
void BaseProcMgr::moveExtraJobsToOtherBuffer(JobType type) {
const auto old_idx = mCurrentExtraJobArrayIdx;
swapExtraJobArray();
@ -651,7 +647,6 @@ void BaseProcMgr::moveExtraJobsToOtherBuffer(JobType type) {
link.getProc()->queueExtraJobPush_(type, mCurrentExtraJobArrayIdx);
}
}
#endif
bool BaseProcMgr::hasExtraJobLink(BaseProcJobLink* job_link, s32 idx) {
for (auto& ptr : mExtraJobLinkArrays[idx]) {

View File

@ -9,8 +9,7 @@ void InstParamPack::Buffer::clear() {
mData.fill(0);
}
// write()
#ifdef NON_MATCHING
// NON_MATCHING: write()
void InstParamPack::Buffer::add(const void* data, const sead::SafeString& name, s32 byte_size,
InstParamPack::EntryType type) {
if (byte_size + mPosition + u32(sizeof(const char*)) + 1 > mData.getByteSize()) {
@ -23,16 +22,13 @@ void InstParamPack::Buffer::add(const void* data, const sead::SafeString& name,
writeBytes(data, byte_size);
++mNumItems;
}
#endif
// write()
#ifdef NON_MATCHING
// NON_MATCHING: write()
void InstParamPack::Buffer::add(ActorCallback* callback, const sead::SafeString& name) {
add(callback, name, sizeof(callback), EntryType::UInt64);
}
#endif
#ifdef NON_MATCHING
// NON_MATCHING
bool InstParamPack::Buffer::pop(s32* position, InstParamPack::Entry* out_entry) {
if (!read(out_entry->key, position))
return false;
@ -71,7 +67,6 @@ bool InstParamPack::Buffer::pop(s32* position, InstParamPack::Entry* out_entry)
return false;
}
}
#endif
InstParamPack::Buffer& InstParamPack::Buffer::operator=(const InstParamPack::Buffer& other) {
size_t pos = other.mPosition;

View File

@ -97,6 +97,7 @@ void Ecosystem::init(sead::Heap* heap) {
void Ecosystem::calc() {}
// NON_MATCHING: FP instructions rearranged.
s32 Ecosystem::getMapArea(const EcoMapInfo& info, f32 posX, f32 posZ) const {
posX = sead::Mathf::clamp(posX, -5000.0f, 4999.0f);
posZ = sead::Mathf::clamp(posZ, -4000.0f, 4000.0f);
@ -201,8 +202,7 @@ void Ecosystem::getAreaNameByNum(s32 areaNum, const char** out) const {
iter.tryGetStringByKey(out, "Area");
}
// Equivalent, minor conditional differences and register usage
#ifdef NON_MATCHING
// NON_MATCHING: Equivalent, minor conditional differences and register usage
void Ecosystem::getStatusEffectInfo(StatusEffect statusEffectIdx, s32 idx,
eco::StatusEffectInfo* out) const {
al::ByamlIter listIter;
@ -262,7 +262,6 @@ void Ecosystem::getStatusEffectInfo(StatusEffect statusEffectIdx, s32 idx,
out->val._f32 = val2;
}
}
#endif
void Ecosystem::getClimateNameByNum(s32 areaNum, const char** out) const {
*out = nullptr;

View File

@ -118,8 +118,7 @@ long bindActorActions(evfl::TimelineObj& obj, res::EventFlowActionBinder binder)
return int(ok) | (int(failed) << 8);
}
// minor reordering for the buildTimeline loop
#ifdef NON_MATCHING
// NON_MATCHING: minor reordering for the buildTimeline loop
bool ResourceTimeline::setUpBindings(ActorBindings* bindings, sead::Heap* heap) {
sead::Buffer<evfl::TimelineObj> timeline_objs;
timeline_objs.allocBufferAssert(mTimelines.size(), heap);
@ -163,7 +162,6 @@ bool ResourceTimeline::setUpBindings(ActorBindings* bindings, sead::Heap* heap)
timeline_objs.freeBuffer();
return true;
}
#endif
bool ResourceTimeline::buildTimeline(evfl::TimelineObj* obj, int idx, sead::Heap* heap) {
auto& timeline = mTimelines[idx];

View File

@ -76,8 +76,7 @@ Manager::~Manager() {
}
}
// address differences for the static bgdata_factory that causes different regalloc
#ifdef NON_MATCHING
// NON_MATCHING: address differences for the static bgdata_factory that causes different regalloc
void Manager::init(sead::Heap* heap, sead::Framework* framework) {
sead::TickTime a;
sead::TickTime b;
@ -138,7 +137,6 @@ void Manager::init(sead::Heap* heap, sead::Framework* framework) {
mBitFlags.set(BitFlag::_1000);
mNumFlagsToReset = 0;
}
#endif
void Manager::loadShopGameDataInfo(const sead::SafeString& path) {
res::LoadRequest req;
@ -797,8 +795,7 @@ void Manager::syncStart() {
util::safeDeleteArray(buffer);
}
// recordFlagChange calls not being merged, or merged in the wrong way
#ifdef NON_MATCHING
// NON_MATCHING: recordFlagChange calls not being merged, or merged in the wrong way
void Manager::syncUpdate(const char* data) {
const sead::SafeString cmd = data;
auto it = cmd.tokenBegin("|");
@ -1035,7 +1032,6 @@ void Manager::syncUpdate(const char* data) {
return;
}
}
#endif
void Manager::recordFlagChange(u32 platform_core_id, TriggerParam* tparam, u8 type, const s32& idx,
const s32& sub_idx) {

View File

@ -2457,8 +2457,7 @@ bool shouldLogFlagChange(const sead::SafeString& flag_name, FlagType type) {
return sConfig.shouldLog(flag_name, event_type);
}
// reorderings (which result in other small differences)
#ifdef NON_MATCHING
// 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;
@ -2476,6 +2475,5 @@ sead::Color4f getFlagColor(FlagType type) {
return sead::Color4f::cBlue;
}
#endif
} // namespace ksys::gdt

View File

@ -12,7 +12,7 @@
namespace ksys::map {
#ifdef NON_MATCHING
// NON_MATCHING
Object::Object() {
mHardModeFlags.makeAllZero();
_b = 0xFF;
@ -21,7 +21,6 @@ Object::Object() {
mProc = nullptr;
mLinkData = nullptr;
}
#endif
Object::~Object() {
if (mLinkData != nullptr) {
@ -51,7 +50,7 @@ void Object::free() {
mLinkData->field_57 = 0;
}
#ifdef NON_MATCHING
// NON_MATCHING
void Object::initData(MubinIter* iter, u8 idx, u32 actor_data_idx, ActorData* data) {
mActorDataIdx = 0xFFFF;
mFlags0.makeAllZero();
@ -102,7 +101,6 @@ void Object::initData(MubinIter* iter, u8 idx, u32 actor_data_idx, ActorData* da
}
initRevivalGameDataFlagAndMiscFlags(data, false);
}
#endif
act::BaseProc* Object::tryGetProc(bool force) {
auto* bpm = act::BaseProcMgr::instance();
@ -406,7 +404,7 @@ void Object::setRevivalFlagValue(bool value) {
gdt::Manager::instance()->setBool(value, mRevivalGameDataFlagHash);
}
#ifdef NON_MATCHING
// NON_MATCHING
bool Object::x_18() const {
act::InfoData::InvalidLifeConditions info;
const char* s;
@ -422,7 +420,6 @@ bool Object::x_18() const {
sead::Vector3f temp = mTranslate;
return !id->sub_7100D30DF8(info, temp);
}
#endif
bool Object::setupTargetLinks(Object* src, ObjectLink* link, sead::Heap* heap) {
if (mNumLinksPointingToMe == 0)
@ -458,7 +455,7 @@ bool Object::checkTraverseFlags() const {
return mFlags0.isOn(Flag0::_500400);
}
#ifdef NON_MATCHING
// NON_MATCHING
bool Object::x_20() const {
if (getActorData().mFlags.isOffBit(ActorData::Flag::RevivalEnable))
return false;
@ -471,7 +468,6 @@ bool Object::x_20() const {
}
return false;
}
#endif
void Object::onBaseProcCreated(act::BaseProc* actor) {
if (actor != nullptr) {
@ -548,8 +544,7 @@ sead::Vector3f Object::getRotate() const {
return result;
}
// Vec3f copy incorrect
#ifdef NON_MATCHING
// NON_MATCHING: Vec3f copy incorrect
void Object::getTraversePosAndLoadDistance(sead::Vector3f* traverse_pos, f32* load_dist) const {
if (mFlags.isOn(Flag::HasTraversePos))
mMubinIter.tryGetFloatArrayByKey(&traverse_pos->x, "TraversePos");
@ -557,7 +552,6 @@ void Object::getTraversePosAndLoadDistance(sead::Vector3f* traverse_pos, f32* lo
*traverse_pos = mTranslate;
*load_dist = getLoadDistance(false);
}
#endif
void Object::getUniqueName(const char** out) const {
if (mFlags.isOff(Flag::HasUniqueName) || !mMubinIter.tryGetParamStringByKey(out, "UniqueName"))

View File

@ -185,7 +185,7 @@ void ObjectLinkData::setGenGroup(GenGroup* group) {
mGenGroup = group;
}
#ifdef NON_MATCHING
// NON_MATCHING
bool ObjectLinkArray::checkLink(MapLinkDefType t, bool b) {
bool x_exists;
ObjectLink* link = nullptr;
@ -216,7 +216,6 @@ done:
acc.acquire(nullptr);
return acc.checkLinkTagActivated(b, x_exists);
}
#endif
ObjectLink* ObjectLinkArray::findLinkWithType(MapLinkDefType type) {
return findLinkWithType_0(type);

View File

@ -29,7 +29,7 @@ void PlacementMgr::releaseTree() {
mPlacementTree = nullptr;
}
#ifdef NON_MATCHING
// NON_MATCHING
void PlacementMgr::x_3() {
auto ac = act::ActorCreator::instance();
const auto loc = sead::makeScopedLock(ac->getCS());
@ -42,13 +42,12 @@ void PlacementMgr::x_3() {
}
}
}
#endif
void PlacementMgr::reset7F0() {
_7f0 = 0;
}
#ifdef NON_MATCHING
// NON_MATCHING
void PlacementMgr::initClusteredRenderer() {
if (mThread != nullptr && mClusteredRenderer == nullptr)
return;
@ -70,7 +69,6 @@ void PlacementMgr::initClusteredRenderer() {
mClusteredRenderer->startThread();
}
}
#endif
void PlacementMgr::auto0() {
if (mThread == nullptr)

View File

@ -12,8 +12,7 @@ Indicator::~Indicator() {
finalize();
}
// Confusing control flow
#ifdef NON_MATCHING
// NON_MATCHING: Confusing control flow
bool Indicator::init(al::ByamlIter* iter, sead::BufferedSafeString* out_message) {
if (!iter->isValid()) {
// Step (%s) is invalid data.
@ -143,7 +142,6 @@ bool Indicator::init(al::ByamlIter* iter, sead::BufferedSafeString* out_message)
acquireActors();
return true;
}
#endif
void Indicator::finalize() {
actors.freeBuffer();

View File

@ -44,8 +44,7 @@ bool Manager::isQuestActor(act::Actor* actor) const {
return false;
}
// leftovers from a stripped debug function
#ifdef NON_MATCHING
// NON_MATCHING: leftovers from a stripped debug function
void Manager::auto0(act::Actor* actor) {
if (actor == nullptr)
return;
@ -56,7 +55,6 @@ void Manager::auto0(act::Actor* actor) {
quest->x_9(actor);
}
}
#endif
bool Manager::auto4(act::Actor* actor) const {
auto end = mQuests.end();
@ -67,8 +65,7 @@ bool Manager::auto4(act::Actor* actor) const {
return true;
}
// loops are nonmatching
#ifdef NON_MATCHING
// NON_MATCHING: loops are nonmatching
bool Manager::sub_7100FD78F8() {
s32 size = mQuests.size();
u32 data_count = 0;
@ -93,7 +90,6 @@ bool Manager::sub_7100FD78F8() {
}
return true;
}
#endif
bool Manager::sub_7100FD7B30(const sead::SafeString& quest_name, const sead::SafeString& step_name,
bool setAocVersionFlag1) {
@ -106,8 +102,7 @@ bool Manager::setQuestStepFromEvent(const sead::SafeString& quest_name,
return setQuestStep(quest_name, step_name, true, force_run_telop, setAocVersionFlag1);
}
// quest is dereferenced several times
#ifdef NON_MATCHING
// NON_MATCHING: quest is dereferenced several times
bool Manager::setQuestStep(const sead::SafeString& quest_name, const sead::SafeString& step_name,
bool copy_name, bool force_run_telop, bool setAocVersionFlag1) {
u32 hash = sead::HashCRC32::calcStringHash(quest_name.cstr());
@ -140,6 +135,5 @@ bool Manager::setQuestStep(const sead::SafeString& quest_name, const sead::SafeS
quest->mAocVersionFlags |= 1;
return true;
}
#endif
} // namespace ksys::qst

View File

@ -8,7 +8,7 @@ Quest::~Quest() {
mSteps.freeBuffer();
}
#ifdef NON_MATCHING
// NON_MATCHING
Quest::Quest(const sead::SafeString& name, sead::Heap* heap) : mName(name), mHeap(heap) {
_8 = 0;
_c = 0;
@ -16,7 +16,6 @@ Quest::Quest(const sead::SafeString& name, sead::Heap* heap) : mName(name), mHea
mNameHash = agl::utl::ParameterBase::calcHash(mName);
mAocVersionFlags = 0;
}
#endif
void Quest::initFlags(gdt::Manager* gdm) {
if (gdm == nullptr)

View File

@ -6,14 +6,12 @@
namespace ksys::qst {
// regalloc
#ifdef NON_MATCHING
// NON_MATCHING: regalloc
Step::Step(const u8** iter_data, sead::Heap* heap) : heap(heap) {
if (*iter_data != nullptr) {
iter = new (heap, std::nothrow_t()) al::ByamlIter(*iter_data);
}
}
#endif
bool Step::sub_7100FDB89C(act::Actor* actor) const {
for (int i = 0; i < links.size(); ++i) {

View File

@ -68,8 +68,7 @@ static bool parseBehaviorIdx(agl::utl::ResParameterObj obj, sead::Buffer<u8>& bu
return true;
}
// the parameter iteration loops in parseAIActionIdx and parseBehaviorIdx
#ifdef NON_MATCHING
// NON_MATCHING: the parameter iteration loops in parseAIActionIdx and parseBehaviorIdx
bool AIProgram::parse_(u8* data, size_t, sead::Heap* parent_heap) {
if (data) {
auto* heap = util::tryCreateDualHeap(parent_heap);
@ -107,10 +106,8 @@ bool AIProgram::parse_(u8* data, size_t, sead::Heap* parent_heap) {
mHeap->adjust();
return true;
}
#endif
// the parameter iteration loops in parseAIActionIdx and parseBehaviorIdx
#ifdef NON_MATCHING
// NON_MATCHING: the parameter iteration loops in parseAIActionIdx and parseBehaviorIdx
bool AIProgram::parseAIActions(sead::Buffer<AIActionDef>& defs, sead::Heap* heap,
agl::utl::ParameterList& target_list,
const agl::utl::ResParameterList& root, const char* type_name) {
@ -173,7 +170,6 @@ bool AIProgram::parseAIActions(sead::Buffer<AIActionDef>& defs, sead::Heap* heap
addList(&target_list, type_name);
return true;
}
#endif
bool AIProgram::parseBehaviors(sead::Heap* heap, const agl::utl::ResParameterList& root) {
const auto list = agl::utl::getResParameterList(root, "Behavior");

View File

@ -18,8 +18,7 @@ AS::~AS() = default;
void AS::doCreate_(u8*, u32, sead::Heap*) {}
// SafeString vtable load is reordered
#ifdef NON_MATCHING
// NON_MATCHING: SafeString vtable load is reordered
bool AS::parse_(u8* data, size_t size, sead::Heap* parent_heap) {
mHeap = util::tryCreateDualHeap(parent_heap);
if (!mHeap)
@ -144,7 +143,6 @@ bool AS::parse_(u8* data, size_t size, sead::Heap* parent_heap) {
mHeap->adjust();
return true;
}
#endif
ASResource* AS::getFirstResource() const {
if (mElementResources.size() == 0)

View File

@ -216,8 +216,7 @@ ASResourceWithChildren::~ASResourceWithChildren() {
mChildren.freeBuffer();
}
// getParameterData (redundant uxtw which leads to localised regalloc diffs)
#ifdef NON_MATCHING
// NON_MATCHING: getParameterData (redundant uxtw which leads to localised regalloc diffs)
bool ASResourceWithChildren::doParse(const ASResource::ParseArgs& args) {
const auto Children = agl::utl::getResParameterObj(args.list, "Children");
if (!Children)
@ -239,7 +238,6 @@ bool ASResourceWithChildren::doParse(const ASResource::ParseArgs& args) {
return true;
}
#endif
int ASResourceWithChildren::callOnChildren_(MemberFunction fn) {
int ret = 0;

View File

@ -42,8 +42,6 @@ ActorLink::ActorLink() : ParamIO("xml", 0) {
addObj(&mUsers.obj, "LinkTarget");
}
// getResParameter (redundant uxtw; i and res increment order)
#ifdef NON_MATCHING
bool ActorLink::parse_(u8* data, size_t, sead::Heap* heap) {
if (!data)
return true;
@ -52,7 +50,7 @@ bool ActorLink::parse_(u8* data, size_t, sead::Heap* heap) {
const auto root = archive.getRootList();
const s32 tags_idx = root.searchObjIndex(agl::utl::ParameterBase::calcHash("Tags"));
// NON_MATCHING: getResParameter (redundant uxtw; i and res increment order)
const auto parse_tags = [&] {
if (tags_idx == -1)
return;
@ -81,7 +79,6 @@ bool ActorLink::parse_(u8* data, size_t, sead::Heap* heap) {
applyResParameterArchive(agl::utl::ResParameterArchive{data});
return true;
}
#endif
void ActorLink::finalize_() {
if (!mTags.isBufferReady())
@ -94,12 +91,10 @@ void ActorLink::finalize_() {
mTags.freeBuffer();
}
// operands are swapped for an equality comparison in binarySearch
#ifdef NON_MATCHING
// NON_MATCHING: operands are swapped for an equality comparison in binarySearch
bool ActorLink::hasTag(const char* tag_name) const {
return mTags.size() >= 1 && mTags.binarySearch(sead::HashCRC32::calcStringHash(tag_name)) != -1;
}
#endif
bool ActorLink::hasTag(u32 tag) const {
return mTags.size() >= 1 && mTags.binarySearch(tag) != -1;

View File

@ -16,8 +16,7 @@ BoneControl::~BoneControl() {
void BoneControl::doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) {}
// mFootIkController.isInvalidFt (???)
#ifdef NON_MATCHING
// NON_MATCHING: mFootIkController.isInvalidFt (???)
bool BoneControl::parse_(u8* data, size_t size, sead::Heap* heap) {
if (!data)
return true;
@ -226,7 +225,6 @@ bool BoneControl::parse_(u8* data, size_t size, sead::Heap* heap) {
applyResParameterArchive(agl::utl::ResParameterArchive{data});
return true;
}
#endif
const BoneControl::BoneGroup* BoneControl::getBoneGroup(const sead::SafeString& name) const {
const auto idx = mBoneGroups.binarySearch(

View File

@ -2,8 +2,7 @@
namespace ksys::res {
// two instructions swapped
#ifdef NON_MATCHING
// NON_MATCHING: two instructions swapped
bool LifeCondition::parse_(u8* data, size_t, sead::Heap* heap) {
if (!data)
return true;
@ -56,7 +55,6 @@ bool LifeCondition::parse_(u8* data, size_t, sead::Heap* heap) {
return true;
}
#endif
void LifeCondition::parseArray(const agl::utl::ResParameterObj* data, agl::utl::IParameterObj* obj,
sead::Buffer<agl::utl::Parameter<sead::SafeString>>* buffer,

View File

@ -36,6 +36,7 @@ ModelList::~ModelList() {
void ModelList::doCreate_(u8* buffer, u32 buffer_size, sead::Heap* heap) {}
// NON_MATCHING: reorderings
bool ModelList::parse_(u8* data, size_t size, sead::Heap* heap) {
agl::utl::ResParameterArchive archive{data};
const auto root = archive.getRootList();
@ -306,8 +307,7 @@ act::InfoData::Locator::Type ModelList::getLocatorTypeFromStr(const sead::SafeSt
return act::InfoData::Locator::Type::Invalid;
}
// weird unrolling and Vector3f store (str should be a stp)
#ifdef NON_MATCHING
// NON_MATCHING: weird unrolling and Vector3f store (str should be a stp)
bool ModelList::getLocatorInfo(act::InfoData::Locator* info,
act::InfoData::Locator::Type type) const {
agl::utl::ResParameterArchive archive{mRawData};
@ -332,7 +332,6 @@ bool ModelList::getLocatorInfo(act::InfoData::Locator* info,
return false;
}
#endif
bool ModelList::isParticalEnable(int anm_target_idx) const {
return mAnmTargets[anm_target_idx].is_partical_enable.ref();

View File

@ -2,8 +2,7 @@
namespace ksys::res {
// first line (see also Drop::parse_)
#ifdef NON_MATCHING
// NON_MATCHING: first line (see also Drop::parse_)
bool Recipe::parse_(u8* data, size_t, sead::Heap* heap) {
mTableNum.init(0, "TableNum", "テーブルの数", &mObj);
addObj(&mObj, "Header");
@ -51,7 +50,6 @@ bool Recipe::parse_(u8* data, size_t, sead::Heap* heap) {
applyResParameterArchive(agl::utl::ResParameterArchive{data});
return true;
}
#endif
void Recipe::parseTable_(const s32& table_idx) {
const s32 num = mTables[table_idx].column_num.ref();

View File

@ -275,8 +275,7 @@ bool Handle::hasParsedResource() const {
return mFlags.isOn(Flag::Parsed);
}
// switch
#ifdef NON_MATCHING
// NON_MATCHING: switch
void Handle::updateResourceMgrFlag_() {
sead::FixedSafeString<128> path("***");
if (mUnit)
@ -323,7 +322,6 @@ void Handle::updateResourceMgrFlag_() {
(heap->getName().startsWith("Sound") || heap->getName().startsWith("Audio")) ? 0 : 1;
res::ResourceMgrTask::instance()->setFlag2000Or5000(type);
}
#endif
void Handle::updateStatusAndUnload_() {
auto* unit = mUnit;

View File

@ -11,8 +11,7 @@ ResourceInfoContainer::ResourceInfoContainer() = default;
ResourceInfoContainer::~ResourceInfoContainer() = default;
// LoadRequest field write order
#ifdef NON_MATCHING
// NON_MATCHING: LoadRequest field write order
bool ResourceInfoContainer::loadResourceSizeTable() {
const auto load_res = [&] {
LoadRequest req;
@ -79,10 +78,8 @@ bool ResourceInfoContainer::loadResourceSizeTable() {
stubbedLogFunction();
return true;
}
#endif
// missing mStringEntries(string_entry_idx).res_size > 0 check
#ifdef NON_MATCHING
// NON_MATCHING: missing mStringEntries(string_entry_idx).res_size > 0 check
u32 ResourceInfoContainer::getResourceSize(const sead::SafeString& name) const {
const u32 name_hash = sead::HashCRC32::calcStringHash(name);
@ -97,7 +94,6 @@ u32 ResourceInfoContainer::getResourceSize(const sead::SafeString& name) const {
return 0;
}
#endif
namespace {
[[gnu::noinline]] bool stringLessThan(const sead::SafeString& a, const sead::SafeString& b) {

View File

@ -163,7 +163,7 @@ KSYS_ALWAYS_INLINE inline bool tryGetVector(const al::ByamlIter& value_iter, T*
}
} // namespace
#ifdef NON_MATCHING
// NON_MATCHING:
// * stack layout and reordering (possibly caused by the stack differences).
// * In init_string_array_flag_config, some calls to memcpy (for string copies) are replaced
// with memset and calcLength() is optimized out.
@ -404,7 +404,6 @@ void GameData::doCreate_(u8* data, u32, sead::Heap*) {
gdt::FlagType::Vector4fArray, init_vector_array_flag_config,
init_vector_array_child_flag_config);
}
#endif
void GameData::loadDebugData(gdt::FlagDebugData* data, const al::ByamlIter& iter) {
if (!data)

View File

@ -44,9 +44,8 @@ s32 GameSaveData::File::findFlagIndex(u32 flag_name_hash) const {
return -1;
}
// cNullChar is loaded too late (which throws off a lot of things) and Clang is
// NON_MATCHING: cNullChar is loaded too late (which throws off a lot of things) and Clang is
// using a different register to access file->info
#ifdef NON_MATCHING
void GameSaveData::doCreate_(u8* buffer, u32, sead::Heap*) {
auto* heap = gdt::Manager::instance()->getSaveAreaHeap();
al::ByamlIter root_iter{buffer};
@ -114,7 +113,6 @@ void GameSaveData::doCreate_(u8* buffer, u32, sead::Heap*) {
mFiles.pushBack(file);
}
#endif
void GameSaveData::finalize() {
if (mSaveInfo)

View File

@ -488,8 +488,7 @@ void ResourceMgrTask::updateResourceArenasFlag8() {
mArenaForResourceL.updateFlag8(false);
}
// branching
#ifdef NON_MATCHING
// NON_MATCHING: branching
sead::Heap* ResourceMgrTask::makeHeapForUnit(const MakeHeapArg& arg) {
const auto heap_size = arg.heap_size;
const auto path = arg.path;
@ -518,7 +517,6 @@ sead::Heap* ResourceMgrTask::makeHeapForUnit(const MakeHeapArg& arg) {
*arg.out_arena2 = arena;
return heap;
}
#endif
ResourceUnit* ResourceMgrTask::clearCachesAndGetUnit(const GetUnitArg& arg) {
auto* unit = mUnitPool.tryAlloc();
@ -674,8 +672,7 @@ void ResourceMgrTask::systemCalc_() {
mTexHandleMgr->calc();
}
// reordering
#ifdef NON_MATCHING
// NON_MATCHING: reordering
void ResourceMgrTask::setCompactionStopped(bool stopped) {
u32 old_counter;
if (stopped)
@ -687,7 +684,6 @@ void ResourceMgrTask::setCompactionStopped(bool stopped) {
if (mCompactionCounter == 0 || old_counter == 0)
stubbedLogFunction();
}
#endif
bool ResourceMgrTask::isCompactionStopped() const {
return mCompactionCounter == 0;

View File

@ -146,14 +146,12 @@ static const ResourceUnit::Status sUnitStatusTransitionTable[] = {
ResourceUnit::Status::_14, ResourceUnit::Status::_14,
};
// ldr + sxtw -> ldrsw
#ifdef NON_MATCHING
// NON_MATCHING: ldr + sxtw -> ldrsw
void ResourceUnit::updateStatus() {
const s32 idx = mStatus;
if (Status::_2 <= idx && idx <= Status::_6)
mStatus = sUnitStatusTransitionTable[idx];
}
#endif
bool ResourceUnit::isTask1NotQueued() const {
return mTask1.getStatus() == util::Task::Status::RemovedFromQueue;
@ -186,8 +184,7 @@ bool ResourceUnit::isStatus9_12_15() const {
return mStatus == Status::_9 || mStatus == Status::_12 || mStatus == Status::_15;
}
// branching for the second if
#ifdef NON_MATCHING
// NON_MATCHING: branching for the second if
bool ResourceUnit::isParseOk() const {
auto* ksys_res = sead::DynamicCast<res::Resource>(mResource);
@ -204,7 +201,6 @@ bool ResourceUnit::isParseOk() const {
return false;
}
#endif
bool ResourceUnit::isStatusFlag8000Set() const {
return mStatusFlags.isOn(StatusFlag::NeedToIncrementRefCount);

View File

@ -16,8 +16,7 @@ OverlayArena::~OverlayArena() {
destroy();
}
// branching at the end (csel instead of a branch)
#ifdef NON_MATCHING
// NON_MATCHING: branching at the end (csel instead of a branch)
bool OverlayArena::init(const OverlayArena::InitArg& arg) {
if (!arg.heap) {
res::stubbedLogFunction();
@ -60,7 +59,6 @@ bool OverlayArena::init(const OverlayArena::InitArg& arg) {
return true;
}
#endif
void OverlayArena::stubbed() {}
@ -128,8 +126,7 @@ bool OverlayArena::checkIsOom() const {
// FIXME: figure out what sead function this is
bool seadCheckPointer(void* ptr);
// branching
#ifdef NON_MATCHING
// NON_MATCHING: branching
util::DualHeap* OverlayArena::makeDualHeap(u32 size, const sead::SafeString& name,
sead::Heap::HeapDirection direction,
res::ResourceUnit* unit, bool) {
@ -160,7 +157,6 @@ util::DualHeap* OverlayArena::makeDualHeap(u32 size, const sead::SafeString& nam
mFlags.set(Flag::_4);
return heap;
}
#endif
void OverlayArena::addSize(s32 size) {
mSize += size;

View File

@ -63,8 +63,7 @@ void OverlayArenaSystem::destroyHeaps() {
mFlags.set(Flag::_2);
}
// reordering for TaskThread::InitArg
#ifdef NON_MATCHING
// NON_MATCHING: reordering for TaskThread::InitArg
bool OverlayArenaSystem::init(const InitArg& arg, sead::Heap* heap) {
mSystemPauseMgr = arg.system_pause_mgr;
@ -126,7 +125,6 @@ bool OverlayArenaSystem::init(const InitArg& arg, sead::Heap* heap) {
return true;
}
#endif
void OverlayArenaSystem::getSzsDecompressor(sead::SZSDecompressor** decompressor) const {
if (decompressor)

View File

@ -57,12 +57,10 @@ VFRVec3f::VFRVec3f() : value{0, 0, 0}, prev_value{0, 0, 0}, mean{0, 0, 0} {}
VFRVec3f::VFRVec3f(const sead::Vector3f& value) : value{value}, prev_value{value}, mean{value} {}
// float regalloc
#ifdef NON_MATCHING
// NON_MATCHING: float regalloc
void VFRVec3f::updateStats() {
updateStatsImpl(value, &prev_value, &mean);
}
#endif
void VFRVec3f::operator*=(f32 scalar) {
VFR::multiply(&value, scalar);

View File

@ -69,13 +69,11 @@ const char* ParamIO::getString(const agl::utl::ResParameterObj& obj, const char*
return param.getData<const char>();
}
// how the default_value Vec3f is stored on the stack
#ifdef NON_MATCHING
// NON_MATCHING: how the default_value Vec3f is stored on the stack
sead::Vector3f ParamIO::getVec3(const agl::utl::ResParameterObj& obj, const char* key,
sead::Vector3f default_value, void*) const {
const auto param = agl::utl::getResParameter(obj, key);
return param.ptr() ? *param.getData<sead::Vector3f>() : default_value;
}
#endif
} // namespace ksys

View File

@ -83,8 +83,7 @@ void ManagedTask::attachHandle(ManagedTaskHandle* handle, TaskQueueBase* queue)
mHandle = handle;
}
// switch
#ifdef NON_MATCHING
// NON_MATCHING: switch
void ManagedTask::detachHandle() {
TaskQueueLock lock;
lock.lock(mQueue);
@ -103,6 +102,5 @@ void ManagedTask::detachHandle() {
}
}
}
#endif
} // namespace ksys::util

View File

@ -239,8 +239,7 @@ bool MessageDispatcher::Queues::sendMessageOnProcessingThread(const MesTransceiv
return mMainQueue.addMessage(message);
}
// branching: deduplicated Message destructor call
#ifdef NON_MATCHING
// NON_MATCHING: branching: deduplicated Message destructor call
bool MessageDispatcher::sendMessageOnProcessingThread(const MesTransceiverId& src,
const MesTransceiverId& dest,
const MessageType& type, void* user_data,
@ -249,7 +248,6 @@ bool MessageDispatcher::sendMessageOnProcessingThread(const MesTransceiverId& sr
return false;
return mQueues->sendMessageOnProcessingThread(src, dest, type, user_data, ack);
}
#endif
struct AddMessageContext : IMessageBrokerRegister::IForEachContext {
AddMessageContext(MessageQueue* queue, Message* message) : queue(queue), message(message) {}
@ -333,8 +331,7 @@ void MessageDispatcher::Queues::process() {
mIsProcessing = false;
}
// regalloc
#ifdef NON_MATCHING
// NON_MATCHING: regalloc
void MessageDispatcher::update() {
mUpdateEndEvent.resetSignal();
mProcessingThread = sead::ThreadMgr::instance()->getCurrentThread();
@ -345,6 +342,5 @@ void MessageDispatcher::update() {
mProcessingThread = nullptr;
mUpdateEndEvent.setSignal();
}
#endif
} // namespace ksys

View File

@ -34,8 +34,7 @@ void Task::deleteDelegate_() {
}
}
// mDelegate2 = nullptr store
#ifdef NON_MATCHING
// NON_MATCHING: mDelegate2 = nullptr store
void Task::finalize_() {
if (mStatus == Status::Finalized)
return;
@ -48,7 +47,6 @@ void Task::finalize_() {
mRemoveCallback = nullptr;
mStatus = Status::Finalized;
}
#endif
bool Task::setDelegate(const TaskDelegateSetter& setter) {
mDelegate = setter.getDelegate();
@ -58,8 +56,7 @@ bool Task::setDelegate(const TaskDelegateSetter& setter) {
return onSetDelegate_(setter);
}
// branching
#ifdef NON_MATCHING
// NON_MATCHING: branching
bool Task::submitRequest(TaskRequest& request) {
// Processing this request is impossible if there is no thread *and* no queue!
if (request.mThread == nullptr && request.mQueue == nullptr)
@ -117,7 +114,6 @@ bool Task::submitRequest(TaskRequest& request) {
}
return push_ok || b;
}
#endif
bool Task::canSubmitRequest() const {
const bool run_finished_on_current_thread =

View File

@ -80,8 +80,7 @@ void TaskMgr::submitRequest(TaskMgrRequest& request) {
request.task = nullptr;
}
// reorderings
#ifdef NON_MATCHING
// NON_MATCHING: reorderings
bool TaskMgr::fetchIdleTaskForRequest_(TaskMgrRequest& request, bool retry_until_success) {
if (!hasTasks())
return false;
@ -109,7 +108,6 @@ bool TaskMgr::fetchIdleTaskForRequest_(TaskMgrRequest& request, bool retry_until
request.task = task;
return true;
}
#endif
void TaskMgr::freeTask(ManagedTask* task) {
auto lock = sead::makeScopedLock(mCS2);
@ -157,8 +155,7 @@ bool TaskMgr::trySubmitRequest(TaskMgrRequest& request) {
return ok;
}
// the factory invoke function pointer is loaded earlier in the original code
#ifdef NON_MATCHING
// NON_MATCHING: the factory invoke function pointer is loaded earlier in the original code
void TaskMgr::init(s32 num_tasks, sead::Heap* heap, ManagedTaskFactory& factory) {
if (!heap->isFreeable())
mFlags.reset(Flag::HeapIsFreeable);
@ -180,7 +177,6 @@ void TaskMgr::init(s32 num_tasks, sead::Heap* heap, ManagedTaskFactory& factory)
factory(&mTask);
}
#endif
bool TaskMgr::hasTasks() const {
return mTasks.size() > 0;

View File

@ -234,8 +234,7 @@ void TaskQueueBase::blockTasks(u8 id) {
mLanes[id].blocked = true;
}
// the while (!areAllThreadsPaused()) loop generates weird code in the original
#ifdef NON_MATCHING
// NON_MATCHING: the while (!areAllThreadsPaused()) loop generates weird code in the original
void TaskQueueBase::blockTasksAndReloadThreads(u8 id) {
blockTasks(id);
@ -258,7 +257,6 @@ void TaskQueueBase::blockTasksAndReloadThreads(u8 id) {
thread.resume();
}
}
#endif
void TaskQueueBase::unblockTasks(u8 id) {
if (mLanes[id].blocked) {
@ -409,8 +407,7 @@ void TaskQueueBase::removeTask(Task* task, bool b) {
unlock();
}
// regalloc inside the task lambda + reorderings for the loop counters.
#ifdef NON_MATCHING
// NON_MATCHING: regalloc inside the task lambda + reorderings for the loop counters.
void TaskQueueBase::fetchTask(Task** out_task) {
lock();
@ -484,6 +481,5 @@ void TaskQueueBase::fetchTask(Task** out_task) {
unlock();
}
#endif
} // namespace ksys::util

View File

@ -136,9 +136,8 @@ bool TaskThread::isLookingForTask() const {
return mFlags.isOn(Flag::IsLookingForTask);
}
// branching for `if (mTaskQueue->getNumActiveTasks() == 0)`:
// NON_MATCHING: branching for `if (mTaskQueue->getNumActiveTasks() == 0)`:
// Clang got rid of the branch and merged the two mFlags writes
#ifdef NON_MATCHING
void TaskThread::calc_(sead::MessageQueue::Element msg) {
if (mFlags.isOn(Flag::Paused)) {
if (msg != cMessage_Resume)
@ -240,7 +239,6 @@ void TaskThread::calc_(sead::MessageQueue::Element msg) {
mFlags.reset(Flag::IsActive);
mFlags.reset(Flag::IsLookingForTask);
}
#endif
bool TaskThread::receivedPauseMsg() const {
return mMessageQueue.peek(sead::MessageQueue::BlockType::NonBlocking) == cMessage_Pause;

View File

@ -321,10 +321,8 @@ void Manager::unload() {
getWeatherMgr()->onUnload();
}
// stores in a different order (handwritten assignments?) but should be equivalent
#ifdef NON_MATCHING
// NON_MATCHING: stores in a different order (handwritten assignments?) but should be equivalent
Manager::Manager() = default;
#endif
static Job* makeJob(JobType type, sead::Heap* heap) {
switch (type) {
@ -879,8 +877,7 @@ void Manager::setTemperatureNight(float temp) {
mTempDirectNightTimer = 4;
}
// mPlayerPos.y gets loaded into s8 instead of w20
#ifdef NON_MATCHING
// NON_MATCHING: mPlayerPos.y gets loaded into s8 instead of w20
void Manager::setIgnitedLevel(int level, float radius, sead::Vector3f center) {
mIgnitedTimer = 4;
mIgnitedRadius = radius;
@ -893,6 +890,5 @@ void Manager::setIgnitedLevel(int level, float radius, sead::Vector3f center) {
mIgnitedRadius = 7.0;
}
}
#endif
} // namespace ksys::world

View File

@ -30,7 +30,7 @@ void ShootingStarMgr::init_(sead::Heap* heap) {
initSchedule();
}
#ifdef NON_MATCHING
// NON_MATCHING
void ShootingStarMgr::initSchedule() {
if (sHours.start >= sHours.end) {
sead::FixedObjArray<u32, 24> validHours;
@ -54,7 +54,6 @@ void ShootingStarMgr::initSchedule() {
mFallMinute = sead::GlobalRandom::instance()->getU32(59);
mInitialised = true;
}
#endif
void ShootingStarMgr::calc_() {
if (Manager::instance() != nullptr) {