-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d085e4
commit 8a136c4
Showing
12 changed files
with
333 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <list> | ||
|
||
#include "menu/Menu.h" | ||
#include "modules/Module.h" | ||
|
||
class Hook | ||
{ | ||
private: | ||
std::unique_ptr<Menu> m_menu; | ||
std::list<std::shared_ptr<Module>> m_modules; | ||
|
||
void Initialize(); | ||
void PostInitialize(); | ||
|
||
template<typename T> | ||
void RegisterModule(); | ||
void RegisterModules(); | ||
|
||
void OnMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); | ||
|
||
public: | ||
Hook(); | ||
|
||
void OnDevice(); | ||
|
||
const auto& GetModules() { return m_modules; } | ||
|
||
static Hook& GetInstance(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include "Vector.h" | ||
|
||
namespace cdc | ||
{ | ||
class Matrix | ||
{ | ||
public: | ||
cdc::Vector col0; | ||
cdc::Vector col1; | ||
cdc::Vector col2; | ||
cdc::Vector col3; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#pragma once | ||
|
||
#include <xmmintrin.h> | ||
|
||
namespace cdc | ||
{ | ||
class Vector | ||
{ | ||
public: | ||
union | ||
{ | ||
__m128 vec128; | ||
|
||
struct | ||
{ | ||
float x; | ||
float y; | ||
float z; | ||
float w; | ||
}; | ||
}; | ||
}; | ||
|
||
class Vector2 : public Vector | ||
{ | ||
}; | ||
|
||
class Vector3 : public Vector | ||
{ | ||
}; | ||
|
||
class Vector4 : public Vector | ||
{ | ||
}; | ||
|
||
class Euler : public Vector | ||
{ | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#pragma once | ||
|
||
#include "Object.h" | ||
|
||
#include "cdc/math/Vector.h" | ||
#include "cdc/math/Matrix.h" | ||
|
||
struct NodeType | ||
{ | ||
NodeType* prev; | ||
NodeType* next; | ||
}; | ||
|
||
struct Intro | ||
{ | ||
}; | ||
|
||
struct HModel; | ||
struct SoundInstanceData; | ||
struct Body; | ||
struct AnimatedGeoms; | ||
struct AnimComponent; | ||
struct CharacterProxy; | ||
|
||
struct Instance; | ||
|
||
struct BaseInstance | ||
{ | ||
NodeType node; | ||
|
||
Instance* next; | ||
Instance* prev; | ||
|
||
cdc::Vector3 position; | ||
cdc::Vector3 oldPos; | ||
|
||
cdc::Euler rotation; | ||
cdc::Euler oldRotation; | ||
|
||
cdc::Vector3 scale; | ||
cdc::Vector3 shadowPosition; | ||
cdc::Vector3 centerOfMass; | ||
|
||
cdc::Matrix* matrix; | ||
cdc::Matrix* oldMatrix; | ||
|
||
char pad1[12]; | ||
|
||
Object* object; | ||
Intro* intro; | ||
|
||
char pad2[100]; | ||
}; | ||
|
||
struct Instance : BaseInstance | ||
{ | ||
char pad1[192]; | ||
|
||
void* data; | ||
|
||
char pad2[12]; | ||
|
||
int introUniqueID; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "Instances.h" | ||
|
||
void Instances::Iterate(std::function<void(Instance*)> callback) | ||
{ | ||
auto first = *(Instance**)0x817D64; | ||
|
||
for (auto instance = first; instance != nullptr; instance = instance->next) | ||
{ | ||
callback(instance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include <functional> | ||
|
||
#include "Instance.h" | ||
|
||
class Instances | ||
{ | ||
public: | ||
static void Iterate(std::function<void(Instance*)> callback); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
struct Model | ||
{ | ||
}; | ||
|
||
struct AnimListEntry; | ||
struct AnimFxHeader; | ||
struct AnimScriptObject; | ||
struct ObjectBase; | ||
|
||
struct Object | ||
{ | ||
int oflags; | ||
int oflags2; | ||
|
||
int uniqueID; | ||
unsigned int guiID; | ||
int functionTableID; | ||
|
||
void* obsoleteSoundBank; | ||
|
||
__int16 numModels; | ||
__int16 numAnims; | ||
__int16 numAnimPatterns; | ||
|
||
Model** modelList; | ||
|
||
AnimListEntry* animList; | ||
AnimFxHeader** animFXList; | ||
AnimScriptObject** animPatternList; | ||
|
||
int introDist; | ||
int vvIntroDist; | ||
int removeDist; | ||
int vvRemoveDist; | ||
|
||
ObjectBase* baseData; | ||
|
||
void* data; | ||
char* name; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include <imgui.h> | ||
|
||
#include "InstanceViewer.h" | ||
#include "instance/Instances.h" | ||
|
||
void InstanceViewer::OnMenu() | ||
{ | ||
if (ImGui::BeginMenu("Instance")) | ||
{ | ||
ImGui::MenuItem("Instances", nullptr, &m_show); | ||
|
||
ImGui::EndMenu(); | ||
} | ||
} | ||
|
||
void InstanceViewer::OnDraw() | ||
{ | ||
if (m_show) | ||
{ | ||
ImGui::Begin("Instances", &m_show); | ||
ImGui::Columns(2, "instances"); | ||
|
||
// Instance list | ||
ImGui::BeginChild("InstancesTree"); | ||
|
||
Instances::Iterate([this](Instance* instance) | ||
{ | ||
if (ImGui::TreeNodeEx((void*)instance, ImGuiTreeNodeFlags_Leaf, "%d %s", instance->introUniqueID, instance->object->name)) | ||
{ | ||
if (ImGui::IsItemClicked()) | ||
{ | ||
m_selected = instance; | ||
} | ||
|
||
ImGui::TreePop(); | ||
} | ||
}); | ||
|
||
ImGui::EndChild(); | ||
|
||
// Instance properties | ||
ImGui::NextColumn(); | ||
|
||
// Check if the instance still exists | ||
if (m_selected && m_selected->node.prev == nullptr) | ||
{ | ||
m_selected = nullptr; | ||
} | ||
|
||
if (m_selected) | ||
{ | ||
DrawInstance(); | ||
} | ||
|
||
ImGui::End(); | ||
} | ||
} | ||
|
||
void InstanceViewer::DrawInstance() | ||
{ | ||
auto instance = m_selected; | ||
|
||
ImGui::Text("%s", instance->object->name); | ||
|
||
auto position = instance->position; | ||
auto rotation = instance->rotation; | ||
|
||
ImGui::Text("Position: %f %f %f", position.x, position.y, position.z); | ||
ImGui::Text("Rotation: %f %f %f", rotation.x, rotation.y, rotation.z); | ||
ImGui::Text("Intro: %d", instance->introUniqueID); | ||
ImGui::Text("Address: %p", instance); | ||
} |
Oops, something went wrong.