Skip to content

Commit

Permalink
Misc stuff and code changes (#59)
Browse files Browse the repository at this point in the history
* fix: revert original call for ThrowFatalError

* fix: fix Player::Player(CNetGamePlayer *)

* feat: test commit

* feat(protections): add some more

* feat: commit for merge

* Merge

* getting ready to merge

* Merge fixes

* feat(spoofing): hide godmode

* feat(invoker): add varargs support

* refactor(ContextMenu): cleanup

* fix code

* fix: remove duplicate invis entry

* fix: use upstream classes

* fix(spectate): by @DayibBaba

---------
Co-authored-by: DayibBaba <[email protected]>
  • Loading branch information
maybegreat48 authored Nov 16, 2023
1 parent d5a9136 commit 61dd656
Show file tree
Hide file tree
Showing 71 changed files with 949 additions and 607 deletions.
2 changes: 1 addition & 1 deletion cmake/rdr-classes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
rdr_classes
GIT_REPOSITORY https://github.com/YimMenu/RDR-Classes.git
GIT_TAG 0132075d1c6a88066ce6f6225f168a49e76a51a3
GIT_TAG 1d566f23329b756aa3ef57be7b53525d949af14a
GIT_PROGRESS TRUE
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
Expand Down
1 change: 1 addition & 0 deletions src/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ using namespace al;
namespace YimMenu
{
using namespace std::chrono_literals;
using namespace std::string_literals;

extern std::atomic<bool> g_Running;
extern HINSTANCE g_DllInstance;
Expand Down
10 changes: 0 additions & 10 deletions src/core/commands/BoolCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ namespace YimMenu
MarkDirty();
}

void BoolCommand::SetDisabled(bool state)
{
m_Disabled = state;
}

bool BoolCommand::GetDisabled()
{
return m_Disabled;
}

void BoolCommand::Shutdown()
{
OnDisable();
Expand Down
4 changes: 0 additions & 4 deletions src/core/commands/BoolCommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ namespace YimMenu
virtual void LoadState(nlohmann::json& value) override;

bool m_State = false;
bool m_Disabled = false;
public:
BoolCommand(std::string name, std::string label, std::string description);
bool GetState();
void SetState(bool state);

bool GetDisabled();
void SetDisabled(bool state);

void Shutdown();
};
}
5 changes: 2 additions & 3 deletions src/core/commands/HotkeySystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,14 @@ namespace YimMenu
}
}

if (AllKeysPressed && GetForegroundWindow() == Pointers.Hwnd)
if (AllKeysPressed && GetForegroundWindow() == Pointers.Hwnd && std::chrono::system_clock::now() - m_LastHotkeyTriggerTime > 100ms)
{
auto Command = Commands::GetCommand(Hash);
if (Command)
{
Command->Call();
}

ScriptMgr::Yield(100ms);
m_LastHotkeyTriggerTime = std::chrono::system_clock::now();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/commands/HotkeySystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace YimMenu
class HotkeySystem :
private IStateSerializer
{
std::chrono::system_clock::time_point m_LastHotkeyTriggerTime;

public:
HotkeySystem();

Expand Down
11 changes: 1 addition & 10 deletions src/core/commands/LoopedCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ namespace YimMenu

void LoopedCommand::Tick()
{
if (LoopedCommand::GetState())
{
LoopedCommand::SetDisabled(false);
OnTick();
}
else if (!LoopedCommand::GetDisabled())
{
LoopedCommand::SetDisabled(true);
OnDisable();
}
OnTick();
}
}
4 changes: 4 additions & 0 deletions src/core/frontend/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ namespace YimMenu
bool Notifications::EraseImpl(Notification notification)
{
for (auto& [id, n] : m_Notifications)
{
if (id == notification.GetIdentifier())
{
n.erasing = true;
return true;
}
}

return false;
}

static void DrawNotification(Notification& notification, int position)
Expand Down
3 changes: 2 additions & 1 deletion src/core/hooking/Hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace YimMenu
{

Hooking::Hooking()
{
BaseHook::Add<Hooks::Window::WndProc>(new DetourHook("WndProc", Pointers.WndProc, Hooks::Window::WndProc));
Expand Down Expand Up @@ -51,6 +50,8 @@ namespace YimMenu

BaseHook::Add<Hooks::Info::NetworkRequest>(new DetourHook("NetworkReqeust", Pointers.NetworkRequest, Hooks::Info::NetworkRequest));
BaseHook::Add<Hooks::Info::AssignPhysicalIndex>(new DetourHook("AssignPhysicalIndex", Pointers.AssignPhysicalIndex, Hooks::Info::AssignPhysicalIndex));

BaseHook::Add<Hooks::Spoofing::WritePlayerHealthData>(new DetourHook("WritePlayerHealthData", Pointers.WritePlayerHealthData, Hooks::Spoofing::WritePlayerHealthData));
}

Hooking::~Hooking()
Expand Down
4 changes: 2 additions & 2 deletions src/game/backend/Players.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace YimMenu
{
class Players
{
std::map<uint8_t, Player> m_Players{};
std::unordered_map<uint8_t, Player> m_Players{};
Player m_SelectedPlayer = Player((uint8_t)0);

public:
Expand All @@ -24,7 +24,7 @@ namespace YimMenu
GetInstance().m_SelectedPlayer = Player(idx);
}

static std::map<uint8_t, Player>& GetPlayers()
static std::unordered_map<uint8_t, Player>& GetPlayers()
{
return GetInstance().m_Players;
}
Expand Down
168 changes: 0 additions & 168 deletions src/game/bigfeatures/ContextMenu.cpp

This file was deleted.

Loading

0 comments on commit 61dd656

Please sign in to comment.