forked from drunderscore/ImGTA
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for watching local script variables in version 372
+ Added a start for Comms mod + Changed some default settings +Made a memory watcher for local and global variables + Improved handling of memory variables
- Loading branch information
Showing
26 changed files
with
795 additions
and
383 deletions.
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
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
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,105 @@ | ||
#include "comms_mod.h" | ||
#include "natives.h" | ||
#include "script.h" | ||
#include "imgui.h" | ||
#include "main.h" | ||
#include "utils.h" | ||
#include "watch_entry.h" | ||
#include "imgui_extras.h" | ||
#include "mission_mod.h" | ||
#include "global_id.h" | ||
|
||
void CommsMod::Load() | ||
{ | ||
|
||
} | ||
|
||
void CommsMod::Unload() | ||
{ | ||
|
||
} | ||
|
||
void CommsMod::Think() | ||
{ | ||
if (m_constantUpdate || m_wantsUpdate) | ||
{ | ||
UpdateLocationData(); | ||
m_wantsUpdate = false; | ||
} | ||
} | ||
|
||
void CommsMod::UpdateLocationData() | ||
{ | ||
if (m_supportGlobals) | ||
{ | ||
int characterArrayOffset = m_characterArrayStartAddr + m_characterID * sizeof(MessageArray) / 8; | ||
m_characterCount = *(int *)getGlobalPtr(m_characterArraySizeAddr); | ||
m_characterArray = *(MessageArray *)getGlobalPtr(characterArrayOffset); | ||
} | ||
} | ||
|
||
void CommsMod::DrawMenuBar() | ||
{ | ||
if (ImGui::BeginMenuBar()) | ||
{ | ||
if (ImGui::BeginMenu("Menu")) | ||
{ | ||
ImGui::MenuItem("Empty"); | ||
ImGui::EndMenu(); | ||
} | ||
|
||
ImGui::EndMenuBar(); | ||
} | ||
} | ||
|
||
bool CommsMod::Draw() | ||
{ | ||
ImGui::SetWindowFontScale(m_menuFontSize); | ||
DrawMenuBar(); | ||
|
||
ImGui::SetWindowFontScale(m_contentFontSize); | ||
|
||
ImGui::Checkbox("Constant Updates?", &m_constantUpdate); | ||
if (!m_constantUpdate) | ||
if (ImGui::Button("Update")) | ||
m_wantsUpdate = true; | ||
|
||
if (m_supportGlobals) | ||
{ | ||
if (ImGui::TreeNode("Messages")) | ||
{ | ||
if (ImGui::InputInt("Message ID", &m_characterID)) | ||
{ | ||
ClipInt(m_characterID, 0, m_characterCount - 1); | ||
m_wantsUpdate = true; | ||
} | ||
|
||
ImGui::Text("Hash: %d", m_characterArray.field_0); | ||
ImGui::Text("Field 1: %d", m_characterArray.field_1); | ||
ImGui::Text("Field 2: %d", m_characterArray.field_2); | ||
ImGui::Text("Field 3: %s", m_characterArray.field_3); | ||
ImGui::Text("Field 7: %s", m_characterArray.field_7); | ||
ImGui::Text("Field B: %d", m_characterArray.field_B); | ||
ImGui::Text("Field C: %d", m_characterArray.field_C_size); | ||
std::string field_C = "Field C: "; | ||
for (int i = 0; i < m_characterArray.field_C_size; ++i) | ||
field_C += std::to_string(m_characterArray.field_C[i].val) + ", "; | ||
ImGui::Text(field_C.c_str()); | ||
ImGui::Text("Field 11: %d", m_characterArray.field_11); | ||
ImGui::Text("Field 12: %d", m_characterArray.field_12); | ||
ImGui::Text("Field 13: %d", m_characterArray.field_13_size); | ||
std::string field_13 = "Field 13: "; | ||
for (int i = 0; i < m_characterArray.field_13_size; ++i) | ||
field_13 += std::to_string(m_characterArray.field_13[i].val) + ", "; | ||
ImGui::Text(field_13.c_str()); | ||
ImGui::Text("Field 18: %d", m_characterArray.field_18_size); | ||
std::string field_18 = "Field 18: "; | ||
for (int i = 0; i < m_characterArray.field_18_size; ++i) | ||
field_18 += std::to_string(m_characterArray.field_18[i].val) + ", "; | ||
ImGui::Text(field_18.c_str()); | ||
ImGui::TreePop(); | ||
} | ||
} | ||
return true; | ||
} | ||
|
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 @@ | ||
#pragma once | ||
#include "mod.h" | ||
#include "lua_engine.h" | ||
#include "types.h" | ||
#include "mission_mod.h" | ||
|
||
struct MessageArray | ||
{ | ||
// Global_127127 Global_17C49.f_744E | ||
int field_0; // Hash example 'ig_devin' -> Look in standard_global_reg for correspondance | ||
DWORD _padding0; | ||
int field_1; | ||
DWORD _padding1; | ||
int field_2; | ||
DWORD _padding2; | ||
char field_3[32]; | ||
char field_7[32]; | ||
int field_B; | ||
DWORD _paddingB; | ||
int field_C_size; // 4? | ||
DWORD _paddingC; | ||
PaddedInt field_C[4]; | ||
int field_11; | ||
DWORD _padding11; | ||
int field_12; | ||
DWORD _padding12; | ||
int field_13_size = 4; | ||
DWORD _padding13; | ||
PaddedInt field_13[4]; | ||
int field_18_size; // 4? | ||
DWORD _padding18; | ||
PaddedInt field_18[4]; | ||
}; // Size 29 * 8 bytes | ||
|
||
// TODO | ||
/*struct MessageArray2 { | ||
// Global_97 | ||
};*/ // Size | ||
|
||
|
||
class CommsMod : public Mod | ||
{ | ||
public: | ||
CommsMod(bool supportGlobals) : Mod("Comms", true, supportGlobals) | ||
{ | ||
m_windowFlags = ImGuiWindowFlags_MenuBar; | ||
} | ||
|
||
bool Draw() override; | ||
void Think() override; | ||
void Load() override; | ||
void Unload() override; | ||
|
||
private: | ||
void DrawMenuBar(); | ||
void UpdateLocationData(); | ||
|
||
MessageArray m_characterArray; | ||
int m_characterID = 0; | ||
int m_characterCount = 0; | ||
int m_characterArraySizeAddr = GlobalID::_127127; | ||
int m_characterArrayStartAddr = m_characterArraySizeAddr + 1; | ||
|
||
// ImGui inputs / internals | ||
bool m_wantsUpdate = false; | ||
int m_locationID = 0; | ||
bool m_constantUpdate = true; | ||
char m_animDictInput[256] = ""; | ||
char m_animNameInput[256] = ""; | ||
unsigned int m_animFlags = 0; | ||
bool m_animLoop = false; | ||
}; |
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,29 @@ | ||
#pragma once | ||
|
||
namespace GlobalID | ||
{ | ||
const int | ||
_15311 = 15311, | ||
_15762 = 15762, | ||
_16696 = 16696, | ||
_15146 = 15146, | ||
_89962 = 89962, | ||
_84544 = 84544, | ||
_54748 = 54748, | ||
_15692 = 15692, | ||
_68477 = 68477, | ||
_87299 = 87299, | ||
_68507 = 68507, | ||
_81155 = 81155, | ||
_84353 = 84353, | ||
_24748 = 24748, | ||
_87300 = 87300, | ||
_68623 = 68623, // Global_10BA2.f_6D | ||
_75339 = 75339, // Global_10BA2.f_1AA9 | ||
_104696 = 104696, // Global_17C49.f_1CAD.f_2 | ||
_85405 = 85405, | ||
_127127 = 127127, // Global_17C49.f_744E | ||
_68523 = 68523, // 0x10BAB->Global_10BA2.f_9 | ||
_6580 = 6580, // Global_17C49.f_6C1.f_21B.f_C8F | ||
_102834 = 102834; // Global_17C49.f_6C1.f_21B.f_C8D | ||
} |
Oops, something went wrong.