Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hooks/AlliedRangeRings.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
0x007A7858:
jmp asm__ShouldAddUnit
nop

0x007EF12B:
push esp
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you push stack pointer? Why not use lea to get proper pointer to structure on stack?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

push = 1 byte
lea > 3

mov ecx, esi
call RenderRange__Moho__UserUnit__UserUnit
nop

0x005BF011:
mov ecx, edi
mov edx, eax
call Hooked_SyncVisionRange
jmp 0x005BF02C
5 changes: 0 additions & 5 deletions hooks/RangeRings.cpp

This file was deleted.

8 changes: 4 additions & 4 deletions include/LuaAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct TObject {
inline TObject() : tt{LUA_TNIL} {}
};

VALIDATE_SIZE(TObject, 8)
VALIDATE_SIZE(TObject, 8);

// namespace gpg
namespace gpg
Expand All @@ -150,7 +150,7 @@ class LuaStackObject {
LuaState *m_state;
int m_stackIndex;
};
VALIDATE_SIZE(LuaStackObject, 8)
VALIDATE_SIZE(LuaStackObject, 8);

extern const char *luaT_typenames[] asm("0x00D474D8");

Expand Down Expand Up @@ -280,7 +280,7 @@ class LuaObject { // 0x14 bytes
LuaObject __Clone(LuaObject &backref) const;
void RemoveFromUsedList();
};
VALIDATE_SIZE(LuaObject, 0x14)
VALIDATE_SIZE(LuaObject, 0x14);

enum StandardLibraries { LIB_NONE, LIB_BASE, LIB_OSIO };
class LuaState { // 0x34 bytes
Expand Down Expand Up @@ -316,7 +316,7 @@ class LuaState { // 0x34 bytes
LuaObject *m_prev; // only valid when in used list
} m_headObject, m_tailObject;
};
VALIDATE_SIZE(LuaState, 0x34)
VALIDATE_SIZE(LuaState, 0x34);

lua_State *__cdecl luaV_settable(lua_State *L, const TObject *t,
const TObject *key,
Expand Down
95 changes: 0 additions & 95 deletions include/Maths.h

This file was deleted.

11 changes: 8 additions & 3 deletions include/PatchBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
(*(type*)addr)

#define CSTR(name, addr) \
extern const char name[] asm(#addr);
extern const char name[] asm(#addr)


#define GDecl(name, addr, type) \
extern type name asm(#addr);
extern type name asm(#addr)

#define WDecl(addr, type) \
((type)*(uintptr_t*)addr)

#define VALIDATE_SIZE(struc, size) \
static_assert(sizeof(struc) == size, "Invalid structure size of " #struc);
static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)

#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#define VALIDATE_OFFSET(struc, member, offset) \
static_assert(offsetof(struc, member) == offset, "Invalid offset of " #member " in " #struc)
156 changes: 156 additions & 0 deletions include/Wm3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#pragma once

template<class R>
struct Vector2
{
R x, y;
};
using Vector2i = Vector2<int>;
using Vector2f = Vector2<float>;

template<class R>
class Vector3
{
public:
using value_t = R;

R x, y, z;

Vector3() : x(0), y(0), z(0) {}
Vector3(R x_, R y_, R z_) : x(x_), y(y_), z(z_) {}

Vector3(const Vector3<R> &other) : x(other.x), y(other.y), z(other.z) {}

Vector3<R> &operator=(const Vector3<R> &other)
{
if (this != &other)
{
x = other.x;
y = other.y;
z = other.z;
}
return *this;
}

Vector3<R> operator+(const Vector3<R> &other) const
{
return Vector3<R>(x + other.x, y + other.y, z + other.z);
}

Vector3<R> operator-(const Vector3<R> &other) const
{
return Vector3<R>(x - other.x, y - other.y, z - other.z);
}

Vector3<R> operator*(R scalar) const
{
return Vector3<R>(x * scalar, y * scalar, z * scalar);
}

friend Vector3<R> operator*(R scalar, const Vector3<R> &vec)
{
return vec * scalar;
}

R dot(const Vector3<R> &other) const
{
return x * other.x + y * other.y + z * other.z;
}

Vector3<R> cross(const Vector3<R> &other) const
{
return Vector3<R>(
y * other.z - z * other.y,
z * other.x - x * other.z,
x * other.y - y * other.x);
}

float length() const
{
return sqrtf(x * x + y * y + z * z);
}

Vector3<float> normalized() const
{
float len = length();
if (len > 0)
return {x / len, y / len, z / len};

return *this;
}

Vector3<R> &operator+=(const Vector3<R> &other)
{
x += other.x;
y += other.y;
z += other.z;
return *this;
}

Vector3<R> &operator-=(const Vector3<R> &other)
{
x -= other.x;
y -= other.y;
z -= other.z;
return *this;
}

Vector3<R> &operator*=(R scalar)
{
x *= scalar;
y *= scalar;
z *= scalar;
return *this;
}
};
using Vector3f = Vector3<float>;

template<class R>
struct Vector4
{ // 0x10 bytes
R x, y, z, w;
};
using Vector4f = Vector4<float>;

template<class R>
struct Quaternion
{
R x, y, z, w;
};
using Quaternionf = Quaternion<float>;

template<class R>
struct Rect2
{
R x0, z0, x1, z1;
};
using Rect2i = Rect2<int>;

template<class R>
struct Circle2
{
Vector2<R> Center;
R Radius;

Circle2(R x, R y, R r):
Center{x, y},
Radius{r}
{}
};
using Circle2f = Circle2<float>;

template<class R>
struct Plane3
{
Vector3<R> Normal;
R Constant;
};
using Plane3f = Plane3<float>;

template<class R>
struct AxisAlignedBox3
{
Vector3<R> Min;
Vector3<R> Max;
};
using AxisAlignedBox3f = AxisAlignedBox3<float>;
Loading
Loading