diff --git a/src/mips/psyqo/gte-registers.hh b/src/mips/psyqo/gte-registers.hh index 2f69fdbb7..ef4e3da41 100644 --- a/src/mips/psyqo/gte-registers.hh +++ b/src/mips/psyqo/gte-registers.hh @@ -252,7 +252,9 @@ enum class PseudoRegister { V1, /* pseudo register for full Vector 1, mapped to registers VXY1 and VZ1 */ V2, /* pseudo register for full Vector 2, mapped to registers VXY2 and VZ2 */ SV, /* pseudo register for full 16bit Accumulator Vector, mapped to registers IR1-IR3 */ - LV /* pseudo register for full 32bit Maths Accumulator Vector, mapped to registers MAC1-MAC3 */ + LV, /* pseudo register for full 32bit Maths Accumulator Vector, mapped to registers MAC1-MAC3 */ + Translation, /* pseudo register for full Translation vector, mapped to registers TRX-TRZ */ + ScreenOffset, /* pseudo register for full Screen offset, mapped to registers OFX and OFY */ }; /** @@ -291,6 +293,18 @@ static inline void writeSafe(const Vec3& in) { static_assert(valid, "Unable to write vector to pseudo register"); } +/** + * @brief Write a 2D vector to a GTE pseudo register, adding nops after the + * operation. + * + * @tparam reg The pseudo register to write to. + * @param in The vector to write. + */ +template +static inline void writeSafe(const Vec2& in) { + static_assert(valid, "Unable to write vector to pseudo register"); +} + /** * @brief Write a 3D vector to a GTE pseudo register, without adding nops after * the operation. @@ -303,6 +317,18 @@ static inline void writeUnsafe(const Vec3& in) { static_assert(valid, "Unable to write vector to pseudo register"); } +/** + * @brief Write a 2D vector to a GTE pseudo register, without adding nops after + * the operation. + * + * @tparam reg The pseudo register to write to. + * @param in The vector to write. + */ +template +static inline void writeUnsafe(const Vec2& in) { + static_assert(valid, "Unable to write vector to pseudo register"); +} + /** * @brief Writes a 32-bits value to a GTE register from memory. * @@ -806,6 +832,19 @@ inline void writeSafe(const Vec3& in) { writeSafe(Short(in.z)); } +template <> +inline void writeSafe(const Vec3& in) { + write(in.x.raw()); + write(in.y.raw()); + write(in.z.raw()); +} + +template <> +inline void writeSafe(const Vec2& in) { + write(in.x.raw()); + write(in.y.raw()); +} + template <> inline void writeUnsafe(const Matrix33& in) { writeUnsafe(Short(in.vs[0].x), Short(in.vs[0].y)); @@ -851,6 +890,19 @@ inline void writeUnsafe(const Vec3& in) { writeUnsafe(Short(in.z)); } +template <> +inline void writeUnsafe(const Vec3& in) { + write(in.x.raw()); + write(in.y.raw()); + write(in.z.raw()); +} + +template <> +inline void writeUnsafe(const Vec2& in) { + write(in.x.raw()); + write(in.y.raw()); +} + template <> inline PackedVec3 readSafe() { return PackedVec3(Short(readRaw(), Short::RAW),