diff --git a/ToolchainNX64.cmake b/ToolchainNX64.cmake index f04a421..fac0fb7 100644 --- a/ToolchainNX64.cmake +++ b/ToolchainNX64.cmake @@ -1,12 +1,12 @@ -if (NOT DEFINED ENV{UKING_CLANG}) - message(FATAL_ERROR "Please define the UKING_CLANG env variable. It should point to a path such that $UKING_CLANG/bin/clang exists") +if (NOT DEFINED ENV{ODYSSEY_CLANG}) + message(FATAL_ERROR "Please define the ODYSSEY_CLANG env variable. It should point to a path such that $ODYSSEY_CLANG/bin/clang exists") endif() if (NOT DEFINED ENV{DEVKITA64}) message(FATAL_ERROR "Please define the DEVKITA64 env variable.") endif() -set(UKING_CLANG "$ENV{UKING_CLANG}") +set(ODYSSEY_CLANG "$ENV{ODYSSEY_CLANG}") set(DEVKITA64 "$ENV{DEVKITA64}") set(NX64_OPT_FLAGS "-O3 -g") set(triple aarch64-none-elf) @@ -15,10 +15,10 @@ set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR aarch64) -set(CMAKE_SYSROOT ${UKING_CLANG}) -set(CMAKE_C_COMPILER "${UKING_CLANG}/bin/clang") +set(CMAKE_SYSROOT ${ODYSSEY_CLANG}) +set(CMAKE_C_COMPILER "${ODYSSEY_CLANG}/bin/clang") set(CMAKE_C_COMPILER_TARGET ${triple}) -set(CMAKE_CXX_COMPILER "${UKING_CLANG}/bin/clang++") +set(CMAKE_CXX_COMPILER "${ODYSSEY_CLANG}/bin/clang++") set(CMAKE_CXX_COMPILER_TARGET ${triple}) set(CMAKE_C_FLAGS_RELEASE ${NX64_OPT_FLAGS}) @@ -28,7 +28,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${NX64_OPT_FLAGS}) set(ARCH "-mcpu=cortex-a57+fp+simd+crypto+crc") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH} -isystem ${DEVKITA64}/aarch64-none-elf/include") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${UKING_CLANG}/include/c++/v1 -D _LIBCPP_HAS_THREAD_API_PTHREAD ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${ODYSSEY_CLANG}/include/c++/v1 -D _LIBCPP_HAS_THREAD_API_PTHREAD ${CMAKE_C_FLAGS}") set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -x assembler-with-cpp ${ARCH}") add_compile_options(-fPIC -stdlib=libc++ -mno-implicit-float) diff --git a/__pycache__/diff_settings.cpython-38.pyc b/__pycache__/diff_settings.cpython-38.pyc deleted file mode 100644 index c7ea7b0..0000000 Binary files a/__pycache__/diff_settings.cpython-38.pyc and /dev/null differ diff --git a/data/odyssey_functions.csv b/data/odyssey_functions.csv index c35dacf..d718e2b 100644 --- a/data/odyssey_functions.csv +++ b/data/odyssey_functions.csv @@ -58007,7 +58007,7 @@ 0x000000710090cc10,_ZN2al17HitReactionKeeper19tryFindReactionInfoEPKc,120, 0x000000710090cc88,_ZN2al17HitReactionKeeperC1EPKcPKN4sead7Vector3IfEEPNS_16IUseEffectKeeperEPKNS_15IUseAudioKeeperEPKNS_10IUseCameraEPNS_17PadRumbleDirectorEPNS_13SceneStopCtrlEPNS_18RadialBlurDirectorEPKNS_12PlayerHolderEPKNS_8ResourceES2_,1592, 0x000000710090d2c0,_ZNK2al17HitReactionKeeper19tryFindReactionInfoEPKc,120, -0x000000710090d338,_ZN2al9LiveActorC2EPKc,304,_ZN2al9LiveActorC2EPKc +0x000000710090d338,_ZN2al9LiveActorC2EPKc,304, 0x000000710090d468,_ZN2al9LiveActorC1EPKc,148, 0x000000710090d4fc,_ZN2al9LiveActor18initAfterPlacementEv,52, 0x000000710090d530,_ZN2al9LiveActor6appearEv,12, @@ -60072,16 +60072,16 @@ 0x0000007100959c8c,_ZN2al12getNerveStepEPKNS_9IUseNerveE,32,_ZN2al12getNerveStepEPKNS_9IUseNerveE 0x0000007100959cac,_ZN2al15getCurrentNerveEPKNS_9IUseNerveE,28,_ZN2al15getCurrentNerveEPKNS_9IUseNerveE 0x0000007100959cc8,_ZN2al11isFirstStepEPKNS_9IUseNerveE,40,_ZN2al11isFirstStepEPKNS_9IUseNerveE -0x0000007100959cf0,_ZN2al10isLessStepEPKNS_9IUseNerveEi,52,_ZN2al15isLessEqualStepEPKNS_9IUseNerveEi -0x0000007100959d24,_ZN2al15isLessEqualStepEPKNS_9IUseNerveEi,52,_ZN2al10isLessStepEPKNS_9IUseNerveEi +0x0000007100959cf0,_ZN2al10isLessStepEPKNS_9IUseNerveEi,52,_ZN2al10isLessStepEPKNS_9IUseNerveEi +0x0000007100959d24,_ZN2al15isLessEqualStepEPKNS_9IUseNerveEi,52,_ZN2al15isLessEqualStepEPKNS_9IUseNerveEi 0x0000007100959d58,_ZN2al13isGreaterStepEPKNS_9IUseNerveEi,52,_ZN2al13isGreaterStepEPKNS_9IUseNerveEi 0x0000007100959d8c,_ZN2al13isInRangeStepEPKNS_9IUseNerveEii,68,_ZN2al13isInRangeStepEPKNS_9IUseNerveEii 0x0000007100959dd0,_ZN2al14isIntervalStepEPKNS_9IUseNerveEii,80, 0x0000007100959e20,_ZN2al19isIntervalOnOffStepEPKNS_9IUseNerveEii,64, 0x0000007100959e60,_ZN2al10isNewNerveEPKNS_9IUseNerveE,36, -0x0000007100959e84,_ZN2al17calcNerveIntervalEPKNS_9IUseNerveEii,80, +0x0000007100959e84,_ZN2al17calcNerveIntervalEPKNS_9IUseNerveEii,80,_ZN2al17calcNerveIntervalEPKNS_9IUseNerveEii 0x0000007100959ed4,_ZN2al13calcNerveRateEPKNS_9IUseNerveEi,104,_ZN2al13calcNerveRateEPKNS_9IUseNerveEi -0x0000007100959f3c,_ZN2al13calcNerveRateEPKNS_9IUseNerveEii,96,_ZN2al17calcNerveIntervalEPKNS_9IUseNerveEii +0x0000007100959f3c,_ZN2al13calcNerveRateEPKNS_9IUseNerveEii,96, 0x0000007100959f9c,_ZN2al19calcNerveEaseInRateEPKNS_9IUseNerveEi,104, 0x000000710095a004,_ZN2al19calcNerveEaseInRateEPKNS_9IUseNerveEii,96, 0x000000710095a064,_ZN2al20calcNerveEaseOutRateEPKNS_9IUseNerveEi,104, diff --git a/include/NintendoSDK b/include/NintendoSDK index 1838960..a840c04 160000 --- a/include/NintendoSDK +++ b/include/NintendoSDK @@ -1 +1 @@ -Subproject commit 1838960fa158df935ae7f329cf1ebe062d80584a +Subproject commit a840c04b1749fbdb4c554fc55d24b72e4033797c diff --git a/include/al/byaml/ByamlContainerHeader.h b/include/al/byaml/ByamlContainerHeader.h index c960301..e90bade 100755 --- a/include/al/byaml/ByamlContainerHeader.h +++ b/include/al/byaml/ByamlContainerHeader.h @@ -1,5 +1,7 @@ #pragma once +#include + namespace al { class ByamlContainerHeader @@ -8,6 +10,6 @@ namespace al int getType() const; int getCount(bool) const; - int mType; // _0 + u32 mType; // _0 }; }; \ No newline at end of file diff --git a/include/al/byaml/ByamlStringTableIter.h b/include/al/byaml/ByamlStringTableIter.h index c183b99..2a241f7 100755 --- a/include/al/byaml/ByamlStringTableIter.h +++ b/include/al/byaml/ByamlStringTableIter.h @@ -1,5 +1,7 @@ #pragma once +#include + namespace al { class ByamlStringTableIter @@ -9,7 +11,7 @@ namespace al ByamlStringTableIter(const unsigned char *, bool); int getSize() const; - const unsigned char* getAddressTable() const; + const u32* getAddressTable() const; int getStringAddress(int) const; int getEndAddress() const; const char* getString(int) const; @@ -17,7 +19,7 @@ namespace al int findStringIndex(const char *) const; bool isValidate() const; - const unsigned char* mData; // _0 - unsigned char _8; + const u8* mData; // _0 + bool mReversed; }; }; \ No newline at end of file diff --git a/include/al/nerve/NerveStateBase.h b/include/al/nerve/NerveStateBase.h index e071e53..289496d 100755 --- a/include/al/nerve/NerveStateBase.h +++ b/include/al/nerve/NerveStateBase.h @@ -8,8 +8,8 @@ namespace al { public: NerveStateBase(const char *); - virtual ~NerveStateBase(); + virtual void init(); virtual void appear(); virtual void kill(); diff --git a/include/al/sensor/HitSensor.h b/include/al/sensor/HitSensor.h index 21da920..07d8050 100755 --- a/include/al/sensor/HitSensor.h +++ b/include/al/sensor/HitSensor.h @@ -34,7 +34,7 @@ namespace al al::SensorHitGroup* mHitGroup; // _30 bool mIsValidBySystem; // _38 bool mIsValid; // _39 - unsigned int _3A; + bool _3A[4]; // unknown type unsigned short _3E; al::LiveActor* mParentActor; // _40 const sead::Vector3* mFollowPos; // _48 diff --git a/src/al/LiveActor/LiveActor.cpp b/src/al/LiveActor/LiveActor.cpp index 9153800..79e80a6 100755 --- a/src/al/LiveActor/LiveActor.cpp +++ b/src/al/LiveActor/LiveActor.cpp @@ -4,11 +4,6 @@ namespace al { - LiveActor::LiveActor(const char *pName) - { - - } - al::NerveKeeper* LiveActor::getNerveKeeper() const { return mNerveKeeper; diff --git a/src/al/LiveActor/LiveActorGroup.cpp b/src/al/LiveActor/LiveActorGroup.cpp index 8e0a311..e75303b 100755 --- a/src/al/LiveActor/LiveActorGroup.cpp +++ b/src/al/LiveActor/LiveActorGroup.cpp @@ -18,19 +18,12 @@ namespace al return count; } - void LiveActorGroup::removeActor(const al::LiveActor *pActor) - { - auto actorCount = mActorCount; - - if (actorCount >= 1) - { - for (auto i = 0; i < actorCount; i++) - { - if (mActors[i] == pActor) - { - mActors[mActorCount] = mActors[mActorCount - 1]; - mActorCount--; - } + void LiveActorGroup::removeActor(const al::LiveActor *pActor) { + for (int i = 0; i < mActorCount; i++) { + if (mActors[i] == pActor) { + mActors[i] = mActors[mActorCount - 1]; + mActorCount--; + break; } } } diff --git a/src/al/byaml/ByamlContainerHeader.cpp b/src/al/byaml/ByamlContainerHeader.cpp index f7ad54a..030400d 100755 --- a/src/al/byaml/ByamlContainerHeader.cpp +++ b/src/al/byaml/ByamlContainerHeader.cpp @@ -1,4 +1,5 @@ #include "al/byaml/ByamlContainerHeader.h" +#include namespace al { @@ -10,17 +11,9 @@ namespace al int ByamlContainerHeader::getCount(bool isRev) const { /* todo -- attempt to remove ASR instruction for the else block */ - int val; - if (isRev) - { - val = ((mType >> 24) & 0xFF) | ((mType >> 16) & 0xFF) << 8 | ((mType >> 8) & 0xFF) << 16; - } - else - { - val = mType >> 8; - } + return ((mType >> 24) & 0xFF) | ((mType >> 16) & 0xFF) << 8 | ((mType >> 8) & 0xFF) << 16; - return val; + return (mType >> 8); } }; \ No newline at end of file diff --git a/src/al/byaml/ByamlHashPair.cpp b/src/al/byaml/ByamlHashPair.cpp index 76bda56..47671b2 100755 --- a/src/al/byaml/ByamlHashPair.cpp +++ b/src/al/byaml/ByamlHashPair.cpp @@ -22,14 +22,9 @@ namespace al int ByamlHashPair::getValue(bool isSwap) const { - int swap = __bswap_32(mData); - int val; - - if (isSwap) - val = swap; + if(isSwap) + return __bswap_32(mValue); else - val = mData; - - return val; + return mValue; } }; \ No newline at end of file diff --git a/src/al/byaml/ByamlStringTableIter.cpp b/src/al/byaml/ByamlStringTableIter.cpp index f5110b1..fe658b2 100755 --- a/src/al/byaml/ByamlStringTableIter.cpp +++ b/src/al/byaml/ByamlStringTableIter.cpp @@ -4,43 +4,34 @@ namespace al { ByamlStringTableIter::ByamlStringTableIter() - : mData(0), _8(0) { } + : mData(0), mReversed(0) { } - ByamlStringTableIter::ByamlStringTableIter(const unsigned char *pData, bool unk) + ByamlStringTableIter::ByamlStringTableIter(const u8* pData, bool pReversed) { mData = pData; - _8 = unk; + mReversed = pReversed; } int ByamlStringTableIter::getSize() const { - /* todo -- why does this use different register numbers? */ - return _8 != 0 ? ((*mData >> 24) & 0xFF) | ((*mData >> 16) & 0xFF) << 8 | ((*mData >> 8) & 0xFF) << 16 : *mData >> 8; + u32 type_and_size = *reinterpret_cast(mData); + if(mReversed) + return ((type_and_size >> 24) & 0xFF) | ((type_and_size >> 16) & 0xFF) << 8 | ((type_and_size >> 8) & 0xFF) << 16; + return type_and_size >> 8; } - const unsigned char* ByamlStringTableIter::getAddressTable() const + const u32* ByamlStringTableIter::getAddressTable() const { // mData is an integer pointer, so getting to the table is just increasing the pointer by 1 (which is + 4) - return reinterpret_cast(mData + 4); + return reinterpret_cast(mData + 4); } int ByamlStringTableIter::getStringAddress(int idx) const { - /* todo -- scheduling issues */ - int offs = *((int*)(mData + idx) + 1); - int offsRev = __bswap_32(offs); - int ret; - - if (_8) - { - ret = offsRev; - } - else - { - ret = offs; - } - - return ret; + if (mReversed) + return __bswap_32(getAddressTable()[idx]); + + return getAddressTable()[idx]; } bool ByamlStringTableIter::isValidate() const diff --git a/src/al/nerve/NerveStateBase.cpp b/src/al/nerve/NerveStateBase.cpp index 7fbc2ac..02ab70a 100755 --- a/src/al/nerve/NerveStateBase.cpp +++ b/src/al/nerve/NerveStateBase.cpp @@ -6,11 +6,7 @@ namespace al { mIsDead = true; } - - NerveStateBase::~NerveStateBase() - { - delete this; - } + NerveStateBase::~NerveStateBase() = default; void NerveStateBase::init() { diff --git a/src/al/nerve/NerveStateCtrl.cpp b/src/al/nerve/NerveStateCtrl.cpp index 4049c5d..31085d4 100755 --- a/src/al/nerve/NerveStateCtrl.cpp +++ b/src/al/nerve/NerveStateCtrl.cpp @@ -5,8 +5,12 @@ namespace al // todo -- some scheduling problems with mStateCount's incrementation // adds a state to the list of states in the controller void NerveStateCtrl::addState(al::NerveStateBase *pBase, const al::Nerve *pNerve, const char *pName) - { - mStates[mStateCount].mStateBase = pBase, mStates[mStateCount].mNerve = pNerve, mStates[mStateCount++].mName = pName; + { + auto& state = mStates[mStateCount]; + state.mStateBase = pBase; + state.mNerve = pNerve; + state.mName = pName; + mStateCount++; } // run the state's update function, if there is a current state active diff --git a/src/al/resource/Resource.cpp b/src/al/resource/Resource.cpp index 25d95a2..5ec0889 100755 --- a/src/al/resource/Resource.cpp +++ b/src/al/resource/Resource.cpp @@ -21,9 +21,6 @@ namespace al Resource::Resource(const sead::SafeStringBase &rPath, sead::ArchiveRes *pResource) : mArchive(nullptr), mDevice(nullptr), mName(rPath) { - mArchive = 0; - mDevice = 0; - mHeap = sead::HeapMgr::sInstancePtr->getCurrentHeap(); _B0 = 0; mResFile = 0; @@ -40,13 +37,17 @@ namespace al unsigned int Resource::getFileSize(const sead::SafeStringBase &rFileName) const { - unsigned int ret; - mDevice->tryGetFileSize(&ret, rFileName); + auto device = mDevice; + u32 ret = 0; + device->tryGetFileSize(&ret, rFileName); return ret; } void Resource::cleanupResGraphicsFile() { + if(!mResFile) + return; + mResFile->ReleaseTexture(); mResFile->Reset(); agl::g3d::ResFile::Cleanup(mResFile); diff --git a/src/al/sensor/HitSensor.cpp b/src/al/sensor/HitSensor.cpp index f7f8aab..978c63b 100755 --- a/src/al/sensor/HitSensor.cpp +++ b/src/al/sensor/HitSensor.cpp @@ -4,7 +4,8 @@ namespace al { void HitSensor::setFollowPosPtr(const sead::Vector3 *pFollowPos) { - mFollowPos = pFollowPos, mFollowMtx = nullptr; + mFollowPos = pFollowPos; + mFollowMtx = nullptr; } void HitSensor::setFollowMtxPtr(const sead::Matrix34 *pFollowMtx) diff --git a/src/al/sensor/SensorHitGroup.cpp b/src/al/sensor/SensorHitGroup.cpp index 81d1f80..357ee03 100755 --- a/src/al/sensor/SensorHitGroup.cpp +++ b/src/al/sensor/SensorHitGroup.cpp @@ -2,11 +2,10 @@ namespace al { - void SensorHitGroup::add(al::HitSensor *pSensor) + void SensorHitGroup::add(al::HitSensor* pSensor) { - // todo -- fix incrementation issue mSensors[mSensorCount] = pSensor; - ++mSensorCount; + mSensorCount++; } al::HitSensor* SensorHitGroup::getSensor(int idx) const diff --git a/src/al/util/ByamlUtil.cpp b/src/al/util/ByamlUtil.cpp index 8386b69..1264500 100755 --- a/src/al/util/ByamlUtil.cpp +++ b/src/al/util/ByamlUtil.cpp @@ -3,62 +3,37 @@ namespace alByamlLocalUtil { /* doesn't match but it's close enough */ - const char* getDataTypeString(int type) - { - const char* str; - - switch (type) - { + const char* getDataTypeString(int type) { + switch (type) { + case 0x00: + return "None"; case 0xA0: - str = "String"; - break; + return "String"; case 0xC0: - str = "Array"; - break; + return "Array"; case 0xC1: - str = "Hash"; - break; + return "Hash"; case 0xC2: - str = "StringTable"; - break; + return "StringTable"; case 0xD0: - str = "Bool"; - break; + return "Bool"; case 0xD1: - str = "Int"; - break; + return "Int"; case 0xD2: - str = "Float"; - break; + return "Float"; case 0xD3: - str = "UInt"; - break; + return "UInt"; case 0xD4: - str = "Int64"; - break; + return "Int64"; case 0xD5: - str = "UInt64"; - break; + return "UInt64"; case 0xD6: - str = "Double"; - break; + return "Double"; case 0xFF: - str = "NULL"; - break; + return "NULL"; default: - if (type) - { - str = "Unknown"; - } - else - { - str = "None"; - } - - break; + return "Unknown"; } - - return str; } }; @@ -167,8 +142,7 @@ namespace al float y = 0; bool y_ret = rIter.tryGetFloatByKey(&y, "YZ"); - pOut->x = x; - pOut->y = y; + *pOut = {x, y}; return (x_ret | y_ret) & 0x1; } diff --git a/src/al/util/MathUtil.cpp b/src/al/util/MathUtil.cpp index 1c6b66d..e58ba6b 100755 --- a/src/al/util/MathUtil.cpp +++ b/src/al/util/MathUtil.cpp @@ -1,43 +1,19 @@ #include "al/util/MathUtil.h" #include +#include namespace al { - float normalize(float var, float min, float max) - { - float v4; - bool v5; - float result; - float v7; + float normalize(float var, float min, float max) { + if (sead::absf(max-min) < 0.001f) { + if (var < min) + return 0.0f; + else + return 1.0f; + } - v4 = -(max - min); - if ((max - min) > 0.0f) - { - v4 = max - min; - } - if (v4 >= 0.001f) - { - v7 = min; - if (var >= min) - { - v7 = var; - if (var > max) - { - v7 = max; - } - } - result = (v7 - min) / (max - min); - } - else - { - v5 = var < min; - result = 1.0f; - if (v5) - { - result = 0.0f; - } - } - return result; + float clamped = sead::clamp(var, min, max); + return (clamped - min) / (max - min); } @@ -47,34 +23,23 @@ namespace al float result; if (var <= min) - { return 0.0f; - } - if (max - min <= 0) - { + if (max - min <= 0) { result = 1.0f; if (var < min) - { result = 0.0f; - } } else { if (var <= max) - { v3 = var; - } else - { v3 = max; - } if (var < min) - { v3 = min; - } result = (static_cast(v3 - min) / static_cast(max - min)); } @@ -144,13 +109,10 @@ namespace al } float lerpValue(float x, float y, float time) { - if (time >= 0.0f) - { - if (time > 1.0f) - time = 1.0f; - } else { + if(time < 0.0f) time = 0.0f; - } + else if(time > 1.0f) + time = 1.0f; return (x * (1.0f - time)) + (time * y); } }; \ No newline at end of file diff --git a/src/al/util/NerveUtil.cpp b/src/al/util/NerveUtil.cpp index ad1ab44..5c749af 100755 --- a/src/al/util/NerveUtil.cpp +++ b/src/al/util/NerveUtil.cpp @@ -1,6 +1,7 @@ #include "al/util/NerveUtil.h" #include "al/nerve/NerveKeeper.h" #include "al/nerve/NerveStateCtrl.h" +#include namespace al { @@ -75,51 +76,28 @@ namespace al return (step <= high) & (step >= low); } - // logic just won't add up for some reason - int calcNerveInterval(const al::IUseNerve *pKeeper, int start, int end) - { + int calcNerveInterval(const al::IUseNerve *pKeeper, int start, int end) { al::NerveKeeper* keeper = pKeeper->getNerveKeeper(); + + int dist = keeper->mStep - end; - if (start >= -1) - { - int dist = keeper->mStep - end; + if(start < 1 || dist < 1) + return 0; - if (dist >= -1) - { - return dist / start; - } - } - - return 0; + return dist / start; } - float calcNerveRate(const al::IUseNerve *pKeeper, int step) - { - float ret; - + float calcNerveRate(const al::IUseNerve *pKeeper, int step) { if (step < 1) - { - ret = 1.0f; - } - else - { - float curStep = pKeeper->getNerveKeeper()->mStep; - ret = curStep / step; + return 1.0f; + + float curStep = pKeeper->getNerveKeeper()->mStep; + float ret = curStep / step; - // TODO -- technically the same code, - // but this one uses B.GE and not B.PL - if (ret >= 0) - { - if (ret > 1.0f) - { - ret = 1.0f; - } - } - else - { - ret = 0; - } - } + if (ret < 0.0f) + ret = 0.0f; + else if (ret > 1.0f) + ret = 1.0f; return ret; } diff --git a/src/al/util/StringUtil.cpp b/src/al/util/StringUtil.cpp index 42398b0..0e7006a 100755 --- a/src/al/util/StringUtil.cpp +++ b/src/al/util/StringUtil.cpp @@ -32,61 +32,32 @@ namespace al return strstr(pString_0, pString_1); } - /*bool isEqualSubString(const sead::SafeStringBase &pString_0, const sead::SafeStringBase &pString_1) - { - pString_0.assureTerminationImpl_(); - const char* str = pString_0.mStringTop; - pString_1.assureTerminationImpl_(); - return strstr(str, pString_1.mStringTop); - }*/ - - bool isStartWithString(const char *pString_0, const char *pString_1) - { - char val = *pString_1; - + bool isStartWithString(const char *pString_0, const char *pString_1) { if (!*pString_1) - { return true; - } - const char* nextVal = pString_1 + 1; - - while(*pString_0 && *pString_0 == val) - { - char e = *nextVal++; - val = e; + while(*pString_0 && *pString_0 == *pString_1) { ++pString_0; + ++pString_1; - if (!e) - { + if (!*pString_1) return true; - } } return false; } - bool isEqualString(const char *pString_0, const char *pString_1) - { - char val; + bool isEqualString(const char *pString_0, const char *pString_1) { + while (*pString_0 == *pString_1) { + char val = *pString_0; //required to match - while (1) - { - val = *pString_0; - if (val != *pString_1) - { - break; - } + if (!*pString_0) + return true; ++pString_1; ++pString_0; - - if (!val) - { - return true; - } } - + return false; } @@ -96,12 +67,8 @@ namespace al int pString1_Len = strlen(pString_1); if (pString0_Len < pString1_Len) - { return false; - } - else - { - return isEqualString(&pString_0[pString0_Len - pString1_Len], pString_1); - } + + return isEqualString(&pString_0[pString0_Len - pString1_Len], pString_1); } }; \ No newline at end of file diff --git a/tools/__pycache__/check.cpython-38.pyc b/tools/__pycache__/check.cpython-38.pyc deleted file mode 100755 index af613f5..0000000 Binary files a/tools/__pycache__/check.cpython-38.pyc and /dev/null differ diff --git a/tools/__pycache__/diff_settings.cpython-38.pyc b/tools/__pycache__/diff_settings.cpython-38.pyc deleted file mode 100644 index 14dda51..0000000 Binary files a/tools/__pycache__/diff_settings.cpython-38.pyc and /dev/null differ diff --git a/tools/util/__pycache__/__init__.cpython-38.pyc b/tools/util/__pycache__/__init__.cpython-38.pyc deleted file mode 100755 index d7b0309..0000000 Binary files a/tools/util/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/tools/util/__pycache__/checker.cpython-38.pyc b/tools/util/__pycache__/checker.cpython-38.pyc deleted file mode 100755 index 51f4ba2..0000000 Binary files a/tools/util/__pycache__/checker.cpython-38.pyc and /dev/null differ diff --git a/tools/util/__pycache__/dsym.cpython-38.pyc b/tools/util/__pycache__/dsym.cpython-38.pyc deleted file mode 100755 index f0433a9..0000000 Binary files a/tools/util/__pycache__/dsym.cpython-38.pyc and /dev/null differ diff --git a/tools/util/__pycache__/elf.cpython-38.pyc b/tools/util/__pycache__/elf.cpython-38.pyc deleted file mode 100755 index 9bdec67..0000000 Binary files a/tools/util/__pycache__/elf.cpython-38.pyc and /dev/null differ diff --git a/tools/util/__pycache__/utils.cpython-38.pyc b/tools/util/__pycache__/utils.cpython-38.pyc deleted file mode 100644 index 9fffea3..0000000 Binary files a/tools/util/__pycache__/utils.cpython-38.pyc and /dev/null differ