diff --git a/config/G2ME01/splits.txt b/config/G2ME01/splits.txt index ff9a339..0ab1031 100644 --- a/config/G2ME01/splits.txt +++ b/config/G2ME01/splits.txt @@ -24,6 +24,9 @@ Kyoto/Math/CVector2f.cpp: .sbss start:0x80419A50 end:0x80419A58 .sdata2 start:0x8041E5E8 end:0x8041E5F8 +Kyoto/Math/CVector2i.cpp: + .text start:0x802CA5B0 end:0x802CA6EC + Runtime/__init_cpp_exceptions.cpp: .text start:0x80345C34 end:0x80345CA4 .ctors start:0x803A54A0 end:0x803A54A4 diff --git a/config/G2ME01/symbols.txt b/config/G2ME01/symbols.txt index 05ca2e4..97fca11 100644 --- a/config/G2ME01/symbols.txt +++ b/config/G2ME01/symbols.txt @@ -12904,13 +12904,13 @@ __apl__9CVector2fFRC9CVector2f = .text:0x802CA4F0; // type:function size:0x24 sc Normalize__9CVector2fFv = .text:0x802CA514; // type:function size:0x50 scope:global __ct__9CVector2fFff = .text:0x802CA564; // type:function size:0xC scope:global __sinit_CVector2f_cpp = .text:0x802CA570; // type:function size:0x40 scope:local align:0x4 -fn_802CA5B0 = .text:0x802CA5B0; // type:function size:0x30 align:0x4 -fn_802CA5E0 = .text:0x802CA5E0; // type:function size:0x30 align:0x4 -fn_802CA610 = .text:0x802CA610; // type:function size:0x30 align:0x4 -fn_802CA640 = .text:0x802CA640; // type:function size:0x30 -fn_802CA670 = .text:0x802CA670; // type:function size:0x38 align:0x4 -fn_802CA6A8 = .text:0x802CA6A8; // type:function size:0x38 align:0x4 -fn_802CA6E0 = .text:0x802CA6E0; // type:function size:0xC +__dv__FRC9CVector2ii = .text:0x802CA5B0; // type:function size:0x30 scope:global align:0x4 +__ml__FRC9CVector2ii = .text:0x802CA5E0; // type:function size:0x30 scope:global align:0x4 +__ne__FRC9CVector2iRC9CVector2i = .text:0x802CA610; // type:function size:0x30 scope:global align:0x4 +__eq__FRC9CVector2iRC9CVector2i = .text:0x802CA640; // type:function size:0x30 scope:global +__mi__FRC9CVector2iRC9CVector2i = .text:0x802CA670; // type:function size:0x38 scope:global align:0x4 +__pl__FRC9CVector2iRC9CVector2i = .text:0x802CA6A8; // type:function size:0x38 scope:global align:0x4 +__ct__9CVector2iFii = .text:0x802CA6E0; // type:function size:0xC scope:global fn_802CA6EC = .text:0x802CA6EC; // type:function size:0x3C align:0x4 fn_802CA728 = .text:0x802CA728; // type:function size:0x38 align:0x4 fn_802CA760 = .text:0x802CA760; // type:function size:0x44 diff --git a/configure.py b/configure.py index dafe6ed..96d9e03 100644 --- a/configure.py +++ b/configure.py @@ -33,6 +33,7 @@ LIBS = [ ["Kyoto/Basics/CStopwatch.cpp", False], ["Kyoto/Basics/RAssertDolphin.cpp", False], ["Kyoto/Math/CVector2f.cpp", False], + ["Kyoto/Math/CVector2i.cpp", True], ] } ] diff --git a/include/Kyoto/Math/CVector2i.hpp b/include/Kyoto/Math/CVector2i.hpp new file mode 100644 index 0000000..d616b39 --- /dev/null +++ b/include/Kyoto/Math/CVector2i.hpp @@ -0,0 +1,28 @@ +#ifndef _CVECTOR2I +#define _CVECTOR2I + +#include "types.h" + +class CVector2i { +public: + CVector2i(int, int); + + int GetX() const { return mX; } + int GetY() const { return mY; } + + int& operator[](int idx) { return *(&mX + idx); } + const int& operator[](int idx) const { return *(&mX + idx); } + +private: + int mX; + int mY; +}; + +CVector2i operator+(const CVector2i& lhs, const CVector2i& rhs); +CVector2i operator+(const CVector2i& lhs, const CVector2i& rhs); +bool operator==(const CVector2i& lhs, const CVector2i& rhs); +bool operator!=(const CVector2i& lhs, const CVector2i& rhs); +CVector2i operator*(const CVector2i& lhs, int rhs); +CVector2i operator/(const CVector2i& lhs, int rhs); + +#endif // _CVECTOR2I diff --git a/src/Kyoto/Math/CVector2i.cpp b/src/Kyoto/Math/CVector2i.cpp new file mode 100644 index 0000000..183a6c9 --- /dev/null +++ b/src/Kyoto/Math/CVector2i.cpp @@ -0,0 +1,27 @@ +#include "Kyoto/Math/CVector2i.hpp" + +CVector2i::CVector2i(int x, int y) : mX(x), mY(y) {} + +CVector2i operator+(const CVector2i& lhs, const CVector2i& rhs) { + return CVector2i(lhs.GetX() + rhs.GetX(), lhs.GetY() + rhs.GetY()); +} + +CVector2i operator-(const CVector2i& lhs, const CVector2i& rhs) { + return CVector2i(lhs.GetX() - rhs.GetX(), lhs.GetY() - rhs.GetY()); +} + +bool operator==(const CVector2i& lhs, const CVector2i& rhs) { + return lhs.GetX() == rhs.GetX() && lhs.GetY() == rhs.GetY(); +} + +bool operator!=(const CVector2i& lhs, const CVector2i& rhs) { + return lhs.GetX() != rhs.GetX() || lhs.GetY() != rhs.GetY(); +} + +CVector2i operator*(const CVector2i& lhs, int rhs) { + return CVector2i(lhs.GetX() * rhs, lhs.GetY() * rhs); +} + +CVector2i operator/(const CVector2i& lhs, int rhs) { + return CVector2i(lhs.GetX() / rhs, lhs.GetY() / rhs); +}