Skip to content

Commit

Permalink
Update to v3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
g0aty committed May 7, 2024
1 parent 0185bfd commit c38ffdd
Show file tree
Hide file tree
Showing 20 changed files with 426 additions and 118 deletions.
3 changes: 2 additions & 1 deletion appdata/il2cpp-functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,5 @@ DO_APP_FUNC(bool, LogicGameFlowNormal_IsGameOverDueToDeath, (LogicGameFlowNormal
DO_APP_FUNC(bool, LogicGameFlowHnS_IsGameOverDueToDeath, (LogicGameFlowHnS* __this, MethodInfo* method), "Assembly-CSharp, System.Boolean LogicGameFlowHnS::IsGameOverDueToDeath()");
DO_APP_FUNC(void, ChatController_OnResolutionChanged, (ChatController* __this, float aspectRatio, int32_t width, int32_t height, bool fullscreen, MethodInfo* method), "Assembly-CSharp, System.Void ChatController::OnResolutionChanged(System.Single, System.Int32, System.Int32, System.Boolean)");
DO_APP_FUNC(void, ChatController_ForceClosed, (ChatController* __this, MethodInfo* method), "Assembly-CSharp, System.Void ChatController::ForceClosed()");
DO_APP_FUNC(Byte__Array*, GameOptionsFactory_ToBytes, (GameOptionsFactory* __this, IGameOptions* data, bool forceAprilFoolsMode, MethodInfo* method), "Assembly-CSharp, System.Byte[] AmongUs.GameOptions.GameOptionsFactory::ToBytes(AmongUs.GameOptions.IGameOptions, System.Boolean)");
//DO_APP_FUNC(Byte__Array*, GameOptionsFactory_ToBytes, (GameOptionsFactory* __this, IGameOptions* data, bool forceAprilFoolsMode, MethodInfo* method), "Assembly-CSharp, System.Byte[] AmongUs.GameOptions.GameOptionsFactory::ToBytes(AmongUs.GameOptions.IGameOptions, System.Boolean)");
DO_APP_FUNC(void, NotificationPopper_AddItem, (NotificationPopper* __this, String* item, MethodInfo* method), "Assembly-CSharp, System.Void NotificationPopper::AddItem(System.String)");
46 changes: 42 additions & 4 deletions appdata/il2cpp-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7758,7 +7758,7 @@ namespace app
void* shhhEmblem;
void* IntroPrefab;
void* GameMenu;
void* Notifier;
struct NotificationPopper* Notifier;
void* roomTracker;
void* TaskCompleteSound;
void* TaskUpdateSound;
Expand Down Expand Up @@ -8234,8 +8234,6 @@ namespace app
#endif
#pragma endregion

typedef Il2CppObject GameOptionsFactory;

#pragma region InnerNetClient

#if defined(_CPLUSPLUS_)
Expand Down Expand Up @@ -8355,7 +8353,7 @@ namespace app
void* LastMatchmakerError;
void* PreSpawnDispatcher;
void* Dispatcher;
GameOptionsFactory* gameOptionsFactory;
void* gameOptionsFactory;
bool _IsGamePublic_k__BackingField;
#if defined(_CPLUSPLUS_)
InnerNetClient_GameStates__Enum GameState;
Expand Down Expand Up @@ -11553,6 +11551,46 @@ namespace app
};
#pragma endregion

#pragma region NotificationPopper
struct NotificationPopper__Fields {
struct MonoBehaviour__Fields _;
struct TextMeshPro* TextArea;
float zPos;
float alphaTimer;
float ShowDuration;
float FadeDuration;
struct Color textColor;
struct AudioClip* NotificationSound;
struct Camera* mainCamera;
struct StringBuilder* builder;
};

struct NotificationPopper {
struct NotificationPopper__Class* klass;
MonitorData* monitor;
struct NotificationPopper__Fields fields;
};

struct NotificationPopper__VTable {
VirtualInvokeData Equals;
VirtualInvokeData Finalize;
VirtualInvokeData GetHashCode;
VirtualInvokeData ToString;
};

struct NotificationPopper__StaticFields {
};

struct NotificationPopper__Class {
Il2CppClass_0 _0;
Il2CppRuntimeInterfaceOffsetPair* interfaceOffsets;
struct NotificationPopper__StaticFields* static_fields;
const Il2CppRGCTXData* rgctx_data;
Il2CppClass_1 _1;
struct NotificationPopper__VTable vtable;
};
#pragma endregion

typedef Il2CppReflectionMethod MonoMethod;

typedef Il2CppObject ActivityManager;
Expand Down
130 changes: 111 additions & 19 deletions gui/esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static void RenderText(std::string_view text, const ImVec2& pos, const ImVec4& c
{
CurrentWindow->DrawList->AddText(nullptr, 0.f,
ImScreen + 0.5f * State.dpiScale,
ImGui::GetColorU32(ImVec4(0.f, 0.f, 0.f, 0.f)), text.data(), text.data() + text.length());
ImGui::GetColorU32(IM_COL32_BLACK), text.data(), text.data() + text.length());
}

CurrentWindow->DrawList->AddText(nullptr, 0.f, ImScreen, ImGui::GetColorU32(color), text.data(), text.data() + text.length());
Expand Down Expand Up @@ -59,7 +59,7 @@ static void RenderBox(const ImVec2& top, const ImVec2& bottom, const float heigh
};

if (wantsShadow) {
const ImVec4& shadowColor = ImVec4(0.f, 0.f, 0.f, 0.f);
const ImVec4& shadowColor = ImGui::ColorConvertU32ToFloat4(ImGui::GetColorU32(color) & IM_COL32_A_MASK);
for (size_t i = 0; i < std::size(points); i += 2) {
RenderLine(points[i] + 0.5f * State.dpiScale, points[i + 1] + 0.5f * State.dpiScale, shadowColor, false);
}
Expand All @@ -69,6 +69,8 @@ static void RenderBox(const ImVec2& top, const ImVec2& bottom, const float heigh
}
}

bool renderPlayerEsp = false;

void Esp::Render()
{
CurrentWindow = ImGui::GetCurrentWindow();
Expand All @@ -77,11 +79,54 @@ void Esp::Render()

// Lock our mutex when we render (this will unlock when it goes out of scope)
synchronized(instance.m_DrawingMutex) {
// testing some stuffs
if (renderPlayerEsp) {
for (auto& it : instance.m_Players)
{
if (const auto& player = it.playerData.validate();
player.has_value() //Verify PlayerControl hasn't been destroyed (happens when disconnected)
&& !player.is_Disconnected() //Sanity check, shouldn't ever be true
&& player.is_LocalPlayer() //highlight yourself, you're ugly
&& (!player.get_PlayerData()->fields.IsDead || State.ShowEsp_Ghosts)
&& it.OnScreen)
{
if (State.ShowEsp_Box)
{
float width = GetScaleFromValue(35.0f);
float height = GetScaleFromValue(120.0f);

ImVec2 top{ it.Position.x + width, it.Position.y };
ImVec2 bottom{ it.Position.x - width, it.Position.y - height };

RenderBox(top, bottom, height, width, it.Color);
}

// TODO: show x and y
if (State.ShowEsp_Distance)
{
const ImVec2 position{ it.Position.x, it.Position.y + 15.0f * State.dpiScale };

Vector2 mouse = {
ImGui::GetMousePos().x, ImGui::GetMousePos().y
};

std::string lel = std::to_string(ScreenToWorld(mouse).x) + ", " + std::to_string(ScreenToWorld(mouse).y);

std::string lol = std::to_string(it.Position.x) + ", " + std::to_string(it.Position.y);
char* player = lol.data();

RenderText(player, position, it.Color);
}
}
}
}
// track player codes
for (auto& it : instance.m_Players)
{
if (const auto& player = it.playerData.validate();
player.has_value() //Verify PlayerControl hasn't been destroyed (happens when disconnected)
&& !player.is_Disconnected() //Sanity check, shouldn't ever be true
&& !player.is_LocalPlayer() //Don't highlight yourself, you're ugly
&& (!player.get_PlayerData()->fields.IsDead || State.ShowEsp_Ghosts)
&& it.OnScreen)
{
Expand All @@ -98,28 +143,75 @@ void Esp::Render()

RenderBox(top, bottom, height, width, it.Color);
}
if (!player.is_LocalPlayer()) { //Don't highlight yourself, you're ugly
/////////////////////////////////
//// Distance ///////////////////
/////////////////////////////////
if (State.ShowEsp_Distance)
{
const ImVec2 position{ it.Position.x, it.Position.y + 15.0f * State.dpiScale };
/////////////////////////////////
//// Distance ///////////////////
/////////////////////////////////

if (State.ShowEsp_Distance)
{
// logic and calculation
ImVec2 position = { it.Position.x, it.Position.y + 15.0f * State.dpiScale };
ImVec2 position2 = { it.Position.x, it.Position.y + 30.0f * State.dpiScale };

// infamous trash codes
float minX = 40.0f, minY = 0.0f,
maxX = DirectX::GetWindowSize().x - 46.0f, // 1320
maxY = DirectX::GetWindowSize().y - 38.0f; // 730

char distance[32];
sprintf_s(distance, "[%.2fm]", it.Distance);
float x = it.Position.x, y = it.Position.y;
float offset = 15.0f * State.dpiScale;

RenderText(distance, position, it.Color);
if (x < minX) {
x = minX;
}
/////////////////////////////////
//// Tracers ////////////////////
/////////////////////////////////
if (State.ShowEsp_Tracers && !player.is_LocalPlayer())
{
RenderLine(instance.LocalPosition, it.Position, it.Color, true);
else if (x > maxX) {
x = maxX;
}

if (y < minY) {
y = minY;
}
else if (y > maxY) {
y = maxY;
}

position = { x, y + offset };
position2 = { x, y + 2 * offset };

// strings
char distance[32];
sprintf_s(distance, "[%.0fm]", it.Distance);

std::string lol = it.Name;
char* player = lol.data();

//std::string lol2 = std::to_string(it.Position.x) + ", " + std::to_string(it.Position.y);
//char* pl = lol2.data();

// kill cd update
GameOptions options;
if (const auto& player = it.playerData.validate();
State.ShowKillCD
&& !player.get_PlayerData()->fields.IsDead
&& player.get_PlayerData()->fields.Role
&& player.get_PlayerData()->fields.Role->fields.CanUseKillButton
) {
float killTimer = player.get_PlayerControl()->fields.killTimer;
sprintf_s(distance, "[%.1fs]", killTimer);
}

// render info
RenderText(player, position, it.Color);
RenderText(distance, position2, it.Color);
}
/////////////////////////////////
//// Tracers ////////////////////
/////////////////////////////////
if (State.ShowEsp_Tracers)
{
RenderLine(instance.LocalPosition, it.Position, it.Color, true);
}
}
}
}
}
}
28 changes: 28 additions & 0 deletions gui/tabs/game_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,34 @@ namespace GameTab {
State.rpcQueue.push(new RpcVent(*Game::pLocalPlayer, 1, true));
}*/

if (IsInLobby() && ImGui::Button("Allow Everyone to NoClip")) {
for (auto p : GetAllPlayerControl())
State.lobbyRpcQueue.push(new RpcMurderLoop(*Game::pLocalPlayer, p, 1, true));
State.NoClip = true;
ShowHudNotification("Allowed everyone to NoClip!");
}
ImGui::SameLine();
if ((IsInGame() || IsInLobby()) && ImGui::Button("Kill Everyone")) {
for (auto player : GetAllPlayerControl()) {
if (IsInGame())
State.rpcQueue.push(new RpcMurderPlayer(*Game::pLocalPlayer, player));
else if (IsInLobby())
State.lobbyRpcQueue.push(new RpcMurderPlayer(*Game::pLocalPlayer, player));
}
}
if ((IsInGame() || IsInLobby()) && (IsHost() || !State.SafeMode)) {
ImGui::SameLine();
if (ImGui::Button("Protect Everyone")) {
for (auto player : GetAllPlayerControl()) {
uint8_t colorId = GetPlayerOutfit(GetPlayerData(player))->fields.ColorId;
if (IsInGame())
State.rpcQueue.push(new RpcProtectPlayer(*Game::pLocalPlayer, PlayerSelection(player), colorId));
else if (IsInLobby())
State.lobbyRpcQueue.push(new RpcProtectPlayer(*Game::pLocalPlayer, PlayerSelection(player), colorId));
}
}
}

if (IsInGame() && ToggleButton("Disable Venting", &State.DisableVents)) {
State.Save();
}
Expand Down

0 comments on commit c38ffdd

Please sign in to comment.