From e6b8fde68ff7e71319fb02c4ab611763e65ea5fd Mon Sep 17 00:00:00 2001 From: MonsterDruide1 <5958456@gmail.com> Date: Thu, 4 Jan 2024 02:00:55 +0100 Subject: [PATCH] Format: No "// 0x" offset comments --- .../Controller/JoyPadAccelPoseAnalyzer.h | 50 +++++++++---------- src/Player/HackCap.h | 4 +- src/Scene/StageScene.h | 6 +-- tools/check-format.py | 6 ++- 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/lib/al/include/Library/Controller/JoyPadAccelPoseAnalyzer.h b/lib/al/include/Library/Controller/JoyPadAccelPoseAnalyzer.h index 3965de9d..73bf6424 100644 --- a/lib/al/include/Library/Controller/JoyPadAccelPoseAnalyzer.h +++ b/lib/al/include/Library/Controller/JoyPadAccelPoseAnalyzer.h @@ -10,10 +10,10 @@ class JoyPadAccelPoseAnalyzer { public: void calcHistory(sead::Vector3f const&, sead::Vector3f const&, f32); - unsigned char padding_0[0x60]; // 0x0 - 0x60 - f32 hist0; // 0x60 + unsigned char padding_0[0x60]; + f32 hist0; unsigned char padding_1[0x70 - 0x64]; - f32 hist1; // 0x70 + f32 hist1; unsigned char padding_2[0x1c]; }; @@ -22,7 +22,7 @@ class JoyPadAccelPoseAnalyzer { void calcHistory(sead::Vector3f const&, sead::Vector3f const&); unsigned char padding_1[0x88]; - sead::Vector2f unkVec0; // 0x18 + sead::Vector2f unkVec0; unsigned char padding_0[0x98 - (0x88 + 0x8)]; }; @@ -38,27 +38,27 @@ class JoyPadAccelPoseAnalyzer { void update(); JoyPadAccelPoseAnalyzer getSwingDirDoubleHandSameDir() const; - s32 mControllerPort; // 0x0 port of the controller - s32 mAccelDeviceNum; // 0x4 number of accelerometers - bool gap00; // 0x8 unknown - bool mSwingLeft; // 0x9 shaking the left joycon - bool mSwingRight; // 0xa shaking the right joycon - bool mSwingAny; // 0xb shaking anything - sead::Vector2f mSwingBorder; // 0xc Border to trigger a motion shake - sead::Vector2f mAccelLeftVel; // 0x14 Accelerometer of the Left Joycon - sead::Vector2f mAccelRightVel; // 0x1c Accelerometer of the Right Joycon - sead::Vector2f mAccelCombinedVel; // 0x24 Combined vectors of the left and right joycons - sead::Vector2f mAccelLeftAccel; // 0x2c Acceleration of the left joycon - sead::Vector2f mAccelRightAccel; // 0x34 Acceleration of the right joycon - sead::Vector2f mGyroRoll; // 0x3c Roll of the gyroscope, each component is left/right joycon. - unsigned char padding_0[0x4]; // 0x44 padding because there is nothing here - HistoryInfo mHistoryLeft; // 0x48 History info of the left joycon - HistoryInfo mHistoryRight; // 0xd8 History info of the right joycon - bool gap01; // 0x168 unknown bool - unsigned char padding_1[0x7]; // 0x16a padding because there is nothing here - PoseAxisDir unknown0; // 0x170 - PoseAxisDir unknown1; // 0x208 - PoseAxisDir unknown2; // 0x2a0 + s32 mControllerPort; // port of the controller + s32 mAccelDeviceNum; // number of accelerometers + bool gap00; // unknown + bool mSwingLeft; // shaking the left joycon + bool mSwingRight; // shaking the right joycon + bool mSwingAny; // shaking anything + sead::Vector2f mSwingBorder; // Border to trigger a motion shake + sead::Vector2f mAccelLeftVel; // Accelerometer of the Left Joycon + sead::Vector2f mAccelRightVel; // Accelerometer of the Right Joycon + sead::Vector2f mAccelCombinedVel; // Combined vectors of the left and right joycons + sead::Vector2f mAccelLeftAccel; // Acceleration of the left joycon + sead::Vector2f mAccelRightAccel; // Acceleration of the right joycon + sead::Vector2f mGyroRoll; // Roll of the gyroscope, each component is left/right joycon. + unsigned char padding_0[0x4]; // padding because there is nothing here + HistoryInfo mHistoryLeft; // History info of the left joycon + HistoryInfo mHistoryRight; // History info of the right joycon + bool gap01; // unknown bool + unsigned char padding_1[0x7]; // padding because there is nothing here + PoseAxisDir unknown0; + PoseAxisDir unknown1; + PoseAxisDir unknown2; }; } // namespace al diff --git a/src/Player/HackCap.h b/src/Player/HackCap.h index 5c606a59..ff0c431e 100644 --- a/src/Player/HackCap.h +++ b/src/Player/HackCap.h @@ -16,7 +16,7 @@ class HackCap : public al::LiveActor { bool isThrowTypeSpiral(void) const; unsigned char padding_118[0x118 - HACKSIZE]; - al::LiveActor* mActorA; // 0x118 + al::LiveActor* mActorA; unsigned char padding_08[0x08]; - al::LiveActor* mPlayerActor; // 0x128 + al::LiveActor* mPlayerActor; }; diff --git a/src/Scene/StageScene.h b/src/Scene/StageScene.h index 2096664e..4b374c54 100644 --- a/src/Scene/StageScene.h +++ b/src/Scene/StageScene.h @@ -22,12 +22,12 @@ class StageScene : public al::Scene { bool isEnableSave(void) const; - // 0xE0 stageName + // somewhere here at 0xE0: stageName unsigned char padding_2D0[0x2D0 - INHERITSIZE]; - GameDataHolderAccessor* mHolder; // 0x2D0 + GameDataHolderAccessor* mHolder; unsigned char padding_2F8[0x20]; - StageSceneLayout* stageSceneLayout; // 0x2F8 + StageSceneLayout* stageSceneLayout; }; namespace rs { diff --git a/tools/check-format.py b/tools/check-format.py index 5b098a8f..fb4c8ac8 100755 --- a/tools/check-format.py +++ b/tools/check-format.py @@ -163,6 +163,7 @@ def common_include_order(c, path, is_header): def common_newline_eof(c, path): CHECK(lambda a:a=="", c.split("\n")[-1], "Files should end with a newline!", path) + # Header files def header_sorted_visibility(c, path): @@ -195,7 +196,9 @@ def header_sorted_visibility(c, path): print("nest_level", nest_level) exit(1) - +def header_no_offset_comments(c, path): + for line in c.splitlines(): + CHECK(lambda a:"// 0x" not in a, line, "Offset comments are not allowed in headers!", path) # Source files @@ -213,6 +216,7 @@ def check_header(c, path): common_no_namespace_qualifiers(c, path) common_include_order(c, path, True) header_sorted_visibility(c, path) + header_no_offset_comments(c, path) def check_file(file_str): file = open(file_str, mode="r")