Skip to content

Commit

Permalink
Add workflow for verify
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsterDruide1 committed Oct 6, 2023
1 parent 53fe6e9 commit 06ed9fc
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 85 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/compile-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Compile and verify functions
on: [push, pull_request]

jobs:
compile_verify:
runs-on: ubuntu-latest
steps:
- name: Check out project
uses: actions/checkout@v3
with:
submodules: recursive
- name: Check for W-state functions
run: |
if grep -q ",W," "data/odyssey_functions.csv"; then
echo "Function list should not contain WIP-functions!"
echo "Found the following lines:"
grep ",W," "data/odyssey_functions.csv"
exit 1
fi
- name: Set up dependencies
run: |
sudo apt install -y python3-pip ninja-build cmake ccache xdelta3 clang libssl-dev python-is-python3 curl libncurses5
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Set up python package dependencies
run: pip install capstone colorama cxxfilt pyelftools ansiwrap watchdog python-Levenshtein toml
- name: Set up rust toolchain
uses: actions-rust-lang/[email protected]
with:
cache: false
- name: Set up rust caching
uses: Swatinem/rust-cache@v2
with:
workspaces: "tools/common/viking"
cache-directories: |
toolchain/clang-3.9.1
toolchain/clang-4.0.1
- name: Download main.nso from secret
env:
EXEFS_SHARED_PASS: ${{ secrets.EXEFS_SHARED_PASS }}
run: curl -u "github-odyssey:$EXEFS_SHARED_PASS" https://monsterdruide.one/secrets/smo-main.nso -O
- name: Run setup
run: tools/setup.py smo-main.nso
- name: Build project
run: tools/build.py
- name: Verify function states
run: |
var="$(tools/check 2>&1)"
if [[ "$var" == "OK" ]]; then
exit 0
else
echo $var;
exit 1
fi
12 changes: 12 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: lint
on: [push, pull_request]
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: 'src lib'
exclude: 'lib/NintendoSDK lib/aarch64 lib/agl lib/eui lib/sead'
clangFormatVersion: 12
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The instructions below assume that you are using Linux (native or WSL) or macOS.
Ubuntu users can install those dependencies by running:

```shell
sudo apt install python3 ninja-build cmake ccache xdelta3 clang libssl-dev
sudo apt install python3 ninja-build cmake ccache xdelta3 clang libssl-dev libncurses5
```

Additionally, you'll also need:
Expand Down
44 changes: 11 additions & 33 deletions lib/al/include/Library/LiveActor/SubActorKeeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,17 @@ public:
CLASS(const CLASS& c) : m_value(c.m_value) {} \
CLASS(s32 i) : m_value(i) {} \
CLASS(Enum e) : m_value(e) {} \
operator s32() const { \
return m_value; \
} \
bool operator==(const CLASS& c) const { \
return m_value == c.m_value; \
} \
bool operator==(const Enum& e) const { \
return m_value == e; \
} \
bool operator!=(const CLASS& c) const { \
return m_value != c.m_value; \
} \
bool operator!=(const Enum& e) const { \
return m_value != e; \
} \
CLASS operator|(const CLASS& c) const { \
return CLASS(m_value | c.m_value); \
} \
CLASS operator|(const Enum& e) const { \
return CLASS(m_value | e); \
} \
CLASS operator&(const CLASS& c) const { \
return CLASS(m_value & c.m_value); \
} \
CLASS operator&(const Enum& e) const { \
return CLASS(m_value & e); \
} \
CLASS operator^(const CLASS& c) const { \
return CLASS(m_value ^ c.m_value); \
} \
CLASS operator^(const Enum& e) const { \
return CLASS(m_value ^ e); \
} \
operator s32() const { return m_value; } \
bool operator==(const CLASS& c) const { return m_value == c.m_value; } \
bool operator==(const Enum& e) const { return m_value == e; } \
bool operator!=(const CLASS& c) const { return m_value != c.m_value; } \
bool operator!=(const Enum& e) const { return m_value != e; } \
CLASS operator|(const CLASS& c) const { return CLASS(m_value | c.m_value); } \
CLASS operator|(const Enum& e) const { return CLASS(m_value | e); } \
CLASS operator&(const CLASS& c) const { return CLASS(m_value & c.m_value); } \
CLASS operator&(const Enum& e) const { return CLASS(m_value & e); } \
CLASS operator^(const CLASS& c) const { return CLASS(m_value ^ c.m_value); } \
CLASS operator^(const Enum& e) const { return CLASS(m_value ^ e); } \
CLASS& operator|=(const CLASS& c) { \
m_value |= c.m_value; \
return *this; \
Expand Down
15 changes: 10 additions & 5 deletions lib/al/include/Library/Math/MathAngleUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ f32 calcAngleDegree(const sead::Vector3f&, const sead::Vector3f&);
f32 calcAngleDegree(const sead::Vector2f&, const sead::Vector2f&);
f32 calcAngleOnPlaneRadian(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
f32 calcAngleOnPlaneDegree(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
f32 calcAngleOnPlaneDegreeOrZero(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
f32 calcAngleOnPlaneDegreeOrZero(const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
s32 calcAngleSignOnPlane(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);

bool tryCalcAngleDegree(f32*, const sead::Vector3f&, const sead::Vector3f&);
bool tryCalcAngleOnPlaneDegree(f32*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
bool tryCalcAngleOnPlaneDegree(f32*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);

bool isNearZero(const sead::Vector2f& vec, f32 tolerance);
bool isNearZero(const sead::Vector3f& vec, f32 tolerance);
Expand All @@ -23,9 +25,12 @@ bool isNearAngleRadian(const sead::Vector2f&, const sead::Vector2f&, f32);
bool isNearAngleRadian(const sead::Vector3f&, const sead::Vector3f&, f32);
bool isNearAngleDegree(const sead::Vector2f&, const sead::Vector2f&, f32);
bool isNearAngleDegree(const sead::Vector3f&, const sead::Vector3f&, f32);
bool isNearAngleRadianHV(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&, f32, f32);
bool isNearAngleDegreeHV(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&, f32, f32);
bool isInAngleOnPlaneDegreeHV(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&, f32, f32, f32, f32);
bool isNearAngleRadianHV(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&, f32,
f32);
bool isNearAngleDegreeHV(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&, f32,
f32);
bool isInAngleOnPlaneDegreeHV(const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&,
f32, f32, f32, f32);

void normalize(sead::Vector2f*, const sead::Vector2f&);
void normalize(sead::Vector3f*, const sead::Vector3f&);
Expand Down
57 changes: 38 additions & 19 deletions lib/al/include/Library/Matrix/MatrixUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,47 @@ void makeMtxUpNoSupportPos(sead::Matrix34f*, const sead::Vector3f&, const sead::
void makeMtxSideNoSupport(sead::Matrix34f*, const sead::Vector3f&);
void makeMtxSideNoSupportPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxQuatPos(sead::Matrix34f*, const sead::Quatf&, const sead::Vector3f&);
void makeMtxQuatScalePos(sead::Matrix34f*, const sead::Quatf&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxQuatScalePos(sead::Matrix44f*, const sead::Quatf&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxFrontUpPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxFrontSidePos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxUpFrontPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxUpSidePos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxSideUpPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxSideFrontPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxFollowTarget(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxProj(sead::Matrix44f*, const sead::Vector2f&, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxProjFromQuatPoseUp(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&, const sead::Vector3f&);
void makeMtxProjFromQuatPoseFront(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&, const sead::Vector3f&);
void makeMtxProjFromQuatPoseSide(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&, const sead::Vector3f&);
void makeMtxQuatScalePos(sead::Matrix34f*, const sead::Quatf&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxQuatScalePos(sead::Matrix44f*, const sead::Quatf&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxFrontUpPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxFrontSidePos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxUpFrontPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxUpSidePos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxSideUpPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxSideFrontPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxFollowTarget(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxProj(sead::Matrix44f*, const sead::Vector2f&, const sead::Vector3f&,
const sead::Vector3f&);
void makeMtxProjFromQuatPoseUp(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&,
const sead::Vector3f&);
void makeMtxProjFromQuatPoseFront(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&,
const sead::Vector3f&);
void makeMtxProjFromQuatPoseSide(sead::Matrix44f*, const sead::Quatf&, const sead::Vector2f&,
const sead::Vector3f&);
void makeMtxProjFromUp(sead::Matrix44f*, const sead::Vector2f&, const sead::Vector3f&);

void rotateMtxXDirDegree(sead::Matrix34f*, const sead::Matrix34f&, f32);
void rotateMtxYDirDegree(sead::Matrix34f*, const sead::Matrix34f&, f32);
void rotateMtxZDirDegree(sead::Matrix34f*, const sead::Matrix34f&, f32);
void rotateMtxCenterPosXDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32);
void rotateMtxCenterPosAxisDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, const sead::Vector3f&, f32);
void rotateMtxCenterPosYDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32);
void rotateMtxCenterPosZDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32);
void rotateMtxCenterPosQuat(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, const sead::Quatf&);
void rotateMtxCenterPosXDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&,
f32);
void rotateMtxCenterPosAxisDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&,
const sead::Vector3f&, f32);
void rotateMtxCenterPosYDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&,
f32);
void rotateMtxCenterPosZDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&,
f32);
void rotateMtxCenterPosQuat(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&,
const sead::Quatf&);

bool turnMtxXDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32);
bool turnMtxYDirDegree(sead::Matrix34f*, const sead::Matrix34f&, const sead::Vector3f&, f32);
Expand Down Expand Up @@ -82,7 +100,8 @@ bool calcRotAxisOrZero(sead::Vector3f*, const sead::Matrix34f&);
void calcMxtInvertOrtho(sead::Matrix34f*, const sead::Matrix34f&);
void calcNearFarByInvProjection(f32*, f32*, const sead::Matrix44f&);
void calcMovedInertiaTensor(sead::Matrix33f*, const sead::Matrix33f&, const sead::Vector3f&, f32);
void calcInertiaTensorByMovedTensorAndCenter(sead::Matrix33f*, const sead::Matrix33f&, const sead::Vector3f&, f32);
void calcInertiaTensorByMovedTensorAndCenter(sead::Matrix33f*, const sead::Matrix33f&,
const sead::Vector3f&, f32);
void calcInertiaTensorSphere(sead::Matrix33f*, f32, f32);
void calcInertiaTensorBox(sead::Matrix33f*, const sead::Vector3f&, f32);

Expand Down
17 changes: 11 additions & 6 deletions lib/al/src/Library/Area/AreaShapeCube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ bool AreaShapeCube::isInVolume(const sead::Vector3f& trans) const {
}

// bool AreaShapeCube::isInVolumeOffset(const sead::Vector3f& trans, f32 offset) const {}
// bool AreaShapeCube::calcNearestEdgePoint(sead::Vector3f* edgePoint, const sead::Vector3f& trans) const {}
// bool AreaShapeCube::checkArrowCollision(sead::Vector3f*, sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&) const {}
// bool AreaShapeCube::calcLocalBoundingBox(sead::BoundBox3f* boundingBox) const {}
// bool AreaShapeCube::calcNearestEdgePoint(sead::Vector3f* edgePoint, const sead::Vector3f& trans)
// const {} bool AreaShapeCube::checkArrowCollision(sead::Vector3f*, sead::Vector3f*, const
// sead::Vector3f&, const sead::Vector3f&) const {} bool
// AreaShapeCube::calcLocalBoundingBox(sead::BoundBox3f* boundingBox) const {}

bool AreaShapeCube::isInLocalVolume(const sead::Vector3f& trans) const {
float bottom = mOriginType == OriginType::Base ? 0.0f : (mOriginType == OriginType::Top ? -1000.0f : 500.0f);
float top = mOriginType == OriginType::Base ? 1000.0f : (mOriginType == OriginType::Top ? 0.0f : 500.0f);
float bottom = mOriginType == OriginType::Base ?
0.0f :
(mOriginType == OriginType::Top ? -1000.0f : 500.0f);
float top = mOriginType == OriginType::Base ? 1000.0f :
(mOriginType == OriginType::Top ? 0.0f : 500.0f);

sead::Vector3f min = {-500.0f, bottom, -500.0f};
sead::Vector3f max = {500.0f, top, 500.0f};

if ((trans.y < min.y || max.y < trans.y) || (trans.x < min.x || max.x < trans.x) || (trans.z < min.z || max.z < trans.z))
if ((trans.y < min.y || max.y < trans.y) || (trans.x < min.x || max.x < trans.x) ||
(trans.z < min.z || max.z < trans.z))
return false;

return true;
Expand Down
1 change: 0 additions & 1 deletion lib/al/src/Library/LiveActor/ActorMovementFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,4 @@ void addVelocityZ(al::LiveActor* actor, f32 z) {
currentVelocity->z += z;
}


} // namespace al
2 changes: 1 addition & 1 deletion lib/al/src/Library/Obj/PartsModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "Library/LiveActor/SubActorKeeper.h"
#include "Library/Math/MathAngleUtil.h"
#include "Library/Math/MathLengthUtil.h"
#include "Library/Matrix/MatrixUtil.h"
#include "Library/Math/MathUtil.h"
#include "Library/Matrix/MatrixUtil.h"
#include "Library/Yaml/ByamlUtil.h"

namespace al {
Expand Down
Loading

0 comments on commit 06ed9fc

Please sign in to comment.