Skip to content

Commit 8727e0b

Browse files
authored
Rebranding, Map Editor and Improvements (#217)
String Commands Map Editor Rewrite Global Editor and add Local Editor Added Option to Force Enable Snow and Halloween Events Improved Shows Menu Improved Native Invoker ...and more + lots of bug fixes
1 parent ceed442 commit 8727e0b

File tree

113 files changed

+12677
-7750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+12677
-7750
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
BasedOnStyle: Microsoft
22
AccessModifierOffset: '-4'
33
AlignAfterOpenBracket: DontAlign
4-
AlignConsecutiveAssignments: 'true'
4+
AlignConsecutiveAssignments: 'false'
55
AlignEscapedNewlines: Left
66
AlignOperands: 'false'
77
AlignTrailingComments: 'true'

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ jobs:
2121
run: cmake -D CMAKE_BUILD_TYPE=Release -S. -Bbuild -G Ninja
2222

2323
- name: Build 64bit release DLL
24-
run: cmake --build ./build --config Release --target HorseMenu --
24+
run: cmake --build ./build --config Release --target Terminus --
2525

2626
- name: Check if DLL got built
27-
run: if (-Not (Test-Path -path "build/HorseMenu.dll")) {throw 1}
27+
run: if (-Not (Test-Path -path "build/Terminus.dll")) {throw 1}
2828

29-
- name: Rename DLL to HorseMenu-dev-{GITHUB_SHA}.dll
29+
- name: Rename DLL to Terminus-dev-{GITHUB_SHA}.dll
3030
run: |
31-
del HorseMenu-dev-*.dll
32-
ren HorseMenu.dll HorseMenu-dev-${{github.sha}}.dll
31+
del Terminus-dev-*.dll
32+
ren Terminus.dll Terminus-dev-${{github.sha}}.dll
3333
working-directory: build/
3434

3535
- name: Upload Artifact
3636
uses: actions/upload-artifact@v3
3737
with:
3838
name: binary
39-
path: build/HorseMenu-dev-*.dll
39+
path: build/Terminus-dev-*.dll

.github/workflows/nightly.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ jobs:
5353
run: cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D OPTIMIZE=YES -S. -Bbuild -G Ninja
5454

5555
- name: Build 64bit release DLL
56-
run: cmake --build ./build --config RelWithDebInfo --target HorseMenu --
56+
run: cmake --build ./build --config RelWithDebInfo --target Terminus --
5757

5858
- name: Upload Artifact
5959
uses: actions/upload-artifact@v3
6060
with:
6161
name: binary
6262
path: |
63-
build/HorseMenu.dll
64-
build/HorseMenu.pdb
63+
build/Terminus.dll
64+
build/Terminus.pdb
6565
6666
- name: Generate Build Info
6767
id: var
@@ -126,7 +126,7 @@ jobs:
126126
- name: Echo build sha256
127127
id: build_sha
128128
run: |
129-
sha256sum HorseMenu.dll > sha256.checksum
129+
sha256sum Terminus.dll > sha256.checksum
130130
echo "build_sha=$(cat sha256.checksum)" >> $GITHUB_OUTPUT
131131
cat sha256.checksum
132132
@@ -148,8 +148,8 @@ jobs:
148148
You can download the build artifacts, generate a SHA256 checksum and compare it with the below binary.
149149
Build artifacts ARE NOT automatically the same as release assets since release assets can be modified afterwards.
150150
151-
These are nightly builds of HorseMenu, they are provided for testing purposes only:
152-
- Test if your build environment produces a broken HorseMenu.dll
151+
These are nightly builds of Terminus, they are provided for testing purposes only:
152+
- Test if your build environment produces a broken Terminus.dll
153153
- Test if source code is out of date and no longer compatible with the current version of Red Dead Redemption 2
154154
155155
If you wish to use this menu as-is you are on your own, no warranty is provided.
@@ -159,4 +159,4 @@ jobs:
159159
${{ needs.build_nightly.outputs.full_sha }}
160160
```
161161
files: |
162-
HorseMenu.dll
162+
Terminus.dll

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.20.x)
22

3-
project(HorseMenu VERSION 0.0.1 DESCRIPTION "HorseMenu, a beta-stage mod menu for Red Dead Redemption 2 and Red Dead Online, inspired by YimMenu, that protects against crashes and enhances your experience.")
3+
project(Terminus VERSION 0.0.1 DESCRIPTION "Terminus, a beta-stage mod menu for Red Dead Redemption 2 and Red Dead Online, inspired by YimMenu, that protects against crashes and enhances your experience.")
44

55
# libs
66
include(cmake/vulkan.cmake)
@@ -37,7 +37,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE
3737
message(STATUS "Setting up linked libraries")
3838
target_link_libraries(${PROJECT_NAME} PRIVATE AsyncLogger imgui minhook nlohmann_json::nlohmann_json dbghelp RDR-Classes "${DEPS_DIR}/vulkan-1.lib")
3939

40-
add_compile_definitions(${PROJECT_NAME} "_CRT_SECURE_NO_WARNINGS" "NOMINMAX" "WIN32_LEAN_AND_MEAN")
40+
add_compile_definitions("_CRT_SECURE_NO_WARNINGS" "NOMINMAX" "WIN32_LEAN_AND_MEAN")
4141

4242
if(MSVC)
4343
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /LTCG /OPT:REF,ICF /GUARD:NO")

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# HorseMenu
1+
# Terminus (formerly HorseMenu)
22

33
A mod menu for Red Dead Redemption 2 and Red Dead Online published by Rockstar Games. Strictly for educational purposes.
44

55
## How to use
6-
Use a popular injector (FateInjector/Xenos/Etc.) and inject into rdr2.exe
6+
Use a popular injector (Xenos/Extreme Injector/Etc.) and inject into rdr2.exe
77

88
(INSERT) Open/Close the menu
99

cmake/rdr-classes.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ message(STATUS "RDR-Classes")
55
FetchContent_Declare(
66
RDR-Classes
77
GIT_REPOSITORY https://github.com/YimMenu/RDR-Classes.git
8-
GIT_TAG a61459d3b100408f736f32046ed2545dc729e617
8+
GIT_TAG 30ffb972079e1f61b7035d2dfc23d2ce642e7513
99
GIT_PROGRESS TRUE
1010
)
1111
FetchContent_MakeAvailable(RDR-Classes)

src/common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace YimMenu
3838

3939
using namespace std::chrono_literals;
4040
using namespace std::string_literals;
41+
using namespace std::string_view_literals;
4142

4243
extern std::atomic<bool> g_Running;
4344
extern HINSTANCE g_DllInstance;

src/core/commands/Commands.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace YimMenu
4949
return reinterpret_cast<T*>(GetInstance().GetCommandImpl(hash));
5050
}
5151

52-
static std::unordered_map<joaat_t, Command*> GetCommands()
52+
static std::unordered_map<joaat_t, Command*>& GetCommands()
5353
{
5454
return GetInstance().m_Commands;
5555
};

src/core/commands/HotkeySystem.cpp

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "HotkeySystem.hpp"
2-
3-
#include "game/rdr/Natives.hpp" // TODO: game import in core
2+
#include "game/backend/FiberPool.hpp" // TODO: yet another game import in core
3+
// we should migrate the FiberPool to core eventually
44
#include "game/backend/ScriptMgr.hpp"
55
#include "Commands.hpp"
66
#include "LoopedCommand.hpp"
@@ -16,12 +16,12 @@ namespace YimMenu
1616

1717
void HotkeySystem::RegisterCommands()
1818
{
19-
auto Commands = Commands::GetCommands();
19+
auto& cmds = Commands::GetCommands();
2020

21-
for (auto [Hash, Command] : Commands)
21+
for (auto& [hash, cmd] : cmds)
2222
{
2323
CommandLink link;
24-
m_CommandHotkeys.insert(std::make_pair(Command->GetHash(), link));
24+
m_CommandHotkeys.insert(std::make_pair(hash, link));
2525
}
2626

2727
LOG(INFO) << "Registered " << m_CommandHotkeys.size() << " commands";
@@ -64,54 +64,61 @@ namespace YimMenu
6464
}
6565

6666
// Meant to be called in a loop
67-
void HotkeySystem::CreateHotkey(std::vector<int>& Hotkey)
67+
void HotkeySystem::CreateHotkey(std::vector<int>& chain)
6868
{
69-
static auto IsKeyUnique = [this](int Key, std::vector<int> List) -> bool {
69+
static auto is_key_unique = [this](int Key, std::vector<int> List) -> bool {
7070
for (auto& Key_ : List)
7171
if (GetHotkeyLabel(Key_) == GetHotkeyLabel(Key))
7272
return false;
7373

7474
return true;
7575
};
7676

77-
int PressedKey = 0;
78-
ListenAndApply(PressedKey, Hotkey);
79-
77+
int pressed_key = 0;
78+
ListenAndApply(pressed_key, chain);
8079

81-
if (PressedKey > 1)
80+
if (pressed_key > 1)
8281
{
83-
if (IsKeyUnique(PressedKey, Hotkey))
82+
if (is_key_unique(pressed_key, chain))
8483
{
85-
Hotkey.push_back(PressedKey);
84+
chain.push_back(pressed_key);
8685
}
8786
}
8887

8988
MarkStateDirty();
9089
}
9190

92-
void HotkeySystem::FeatureCommandsHotkeyLoop()
91+
void HotkeySystem::Update()
9392
{
94-
for (auto& [Hash, Link] : m_CommandHotkeys)
93+
for (auto& [hash, link] : m_CommandHotkeys)
9594
{
96-
if (Link.Hotkey.empty() || Link.Listening)
95+
if (link.m_Chain.empty() || link.m_BeingModified)
9796
continue;
9897

99-
bool AllKeysPressed = true;
98+
bool all_keys_pressed = true;
10099

101-
for (auto HotkeyModifier : Link.Hotkey)
100+
for (auto modifier : link.m_Chain)
102101
{
103-
if (!(GetAsyncKeyState(HotkeyModifier) & 0x8000))
102+
if (!(GetAsyncKeyState(modifier) & 0x8000))
104103
{
105-
AllKeysPressed = false;
104+
all_keys_pressed = false;
106105
}
107106
}
108107

109-
if (AllKeysPressed && GetForegroundWindow() == *Pointers.Hwnd && std::chrono::system_clock::now() - m_LastHotkeyTriggerTime > 100ms)
108+
if (all_keys_pressed && std::chrono::system_clock::now() - m_LastHotkeyTriggerTime > 100ms)
110109
{
111-
auto Command = Commands::GetCommand(Hash);
112-
if (Command)
110+
auto command = Commands::GetCommand(hash);
111+
if (command)
113112
{
114-
Command->Call();
113+
// TODO: this is the only way I can prevent chat from blocking the main loop while keeping everything else fast
114+
if (hash != "chathelper"_J)
115+
command->Call();
116+
else
117+
{
118+
FiberPool::Push([command] {
119+
command->Call();
120+
});
121+
}
115122
}
116123
m_LastHotkeyTriggerTime = std::chrono::system_clock::now();
117124
}
@@ -122,9 +129,9 @@ namespace YimMenu
122129
{
123130
for (auto& hotkey : m_CommandHotkeys)
124131
{
125-
if (!hotkey.second.Hotkey.empty())
132+
if (!hotkey.second.m_Chain.empty())
126133
{
127-
state[std::to_string(hotkey.first).data()] = hotkey.second.Hotkey;
134+
state[std::to_string(hotkey.first).data()] = hotkey.second.m_Chain;
128135
}
129136
}
130137
}
@@ -134,7 +141,7 @@ namespace YimMenu
134141
for (auto& [key, value] : state.items())
135142
{
136143
if (m_CommandHotkeys.contains(std::atoi(key.data())))
137-
m_CommandHotkeys[std::atoi(key.data())].Hotkey = value.get<std::vector<int>>();
144+
m_CommandHotkeys[std::atoi(key.data())].m_Chain = value.get<std::vector<int>>();
138145
}
139146
}
140147
}

src/core/commands/HotkeySystem.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace YimMenu
66
struct CommandLink
77
{
88
public:
9-
std::vector<int> Hotkey{};
10-
bool Listening = false;
9+
std::vector<int> m_Chain{};
10+
bool m_BeingModified = false;
1111

1212
CommandLink(){};
1313
};
@@ -26,7 +26,7 @@ namespace YimMenu
2626
std::string GetHotkeyLabel(int hotkey_modifiers);
2727
void CreateHotkey(std::vector<int>& Hotkey);
2828

29-
void FeatureCommandsHotkeyLoop();
29+
void Update();
3030

3131
virtual void SaveStateImpl(nlohmann::json& state) override;
3232
virtual void LoadStateImpl(nlohmann::json& state) override;

src/core/commands/StringCommand.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include "StringCommand.hpp"
2+
3+
namespace YimMenu
4+
{
5+
void StringCommand::OnCall()
6+
{
7+
}
8+
9+
void StringCommand::SaveState(nlohmann::json& value)
10+
{
11+
value = m_StringValue;
12+
}
13+
14+
void StringCommand::LoadState(nlohmann::json& value)
15+
{
16+
m_StringValue = value.get<std::string>();
17+
}
18+
19+
StringCommand::StringCommand(std::string name, std::string label, std::string description, std::string defaultValue) :
20+
Command(name, label, description, 0),
21+
m_StringValue(defaultValue)
22+
{
23+
}
24+
25+
std::string StringCommand::GetString() const
26+
{
27+
return m_StringValue;
28+
}
29+
30+
void StringCommand::SetStringValue(const std::string& value)
31+
{
32+
m_StringValue = value;
33+
OnChange();
34+
MarkDirty();
35+
}
36+
}

src/core/commands/StringCommand.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
#include "Command.hpp"
3+
4+
namespace YimMenu
5+
{
6+
class StringCommand : public Command
7+
{
8+
protected:
9+
std::string m_StringValue;
10+
11+
virtual void OnChange()
12+
{
13+
}
14+
15+
virtual void OnCall() override;
16+
virtual void SaveState(nlohmann::json& value) override;
17+
virtual void LoadState(nlohmann::json& value) override;
18+
19+
public:
20+
StringCommand(std::string name, std::string label, std::string description, std::string defaultValue = "");
21+
22+
std::string GetString() const;
23+
void SetStringValue(const std::string& value);
24+
};
25+
}

src/core/frontend/manager/UIManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace YimMenu
3131
}
3232
ImGui::EndChild();
3333

34-
ImGui::Text("HorseMenu");
34+
ImGui::Text("Terminus");
3535

3636
pos.y -= 28;
3737
ImGui::SetCursorPos(ImVec2(pos.x + 130, pos.y));

src/core/frontend/widgets/imgui_colors.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
namespace ImGui
55
{
6+
// https://easyrgb.com/en/convert.php
67
struct Colors
78
{
9+
// CSS colors
810
inline static ImColor AliceBlue{0.94f, 0.97f, 1.0f, 1.0f}; // ARGB: #FFF0F8FF
911
inline static ImColor AntiqueWhite{0.98f, 0.92f, 0.84f, 1.0f}; // ARGB: #FFFAEBD7
1012
inline static ImColor Aqua{0.0f, 1.0f, 1.0f, 1.0f}; // ARGB: #FF00FFFF
@@ -146,5 +148,10 @@ namespace ImGui
146148
inline static ImColor WhiteSmoke{0.96f, 0.96f, 0.96f, 1.0f}; // ARGB: #FFF5F5F5
147149
inline static ImColor Yellow{1.0f, 1.0f, 0.0f, 1.0f}; // ARGB: #FFFFFF00
148150
inline static ImColor YellowGreen{0.60f, 0.80f, 0.20f, 1.0f}; // ARGB: #FF9ACD32
151+
152+
// others
153+
inline static ImColor Freemode{0.17647f, 0.43137f, 0.72549, 1.0f}; // ARGB: #FF2D6EB9
154+
inline static ImColor IngameBg{0.0f, 0.0f, 0.0f, 0.54901f}; // ARGB: #8C000000
155+
inline static ImColor DisabledText{0.0f, 0.0f, 0.0f, 0.8f}; // ARGB: #CC000000
149156
};
150157
}

src/core/hooking/Hooking.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ namespace YimMenu
5252
BaseHook::Add<Hooks::Script::RunScriptThreads>(new DetourHook("RunScriptThreads", Pointers.RunScriptThreads, Hooks::Script::RunScriptThreads));
5353
BaseHook::Add<Hooks::Script::InitNativeTables>(new DetourHook("InitNativeTables", Pointers.InitNativeTables, Hooks::Script::InitNativeTables));
5454
BaseHook::Add<Hooks::Script::ScriptVM>(new DetourHook("ScriptVM", Pointers.ScriptVM, Hooks::Script::ScriptVM));
55+
BaseHook::Add<Hooks::Script::RegisterCompappNatives>(new DetourHook("RegisterCompappNatives", Pointers.RegisterCompappNatives, Hooks::Script::RegisterCompappNatives));
5556

5657
BaseHook::Add<Hooks::Protections::HandleNetGameEvent>(new DetourHook("HandleNetGameEvent", Pointers.HandleNetGameEvent, Hooks::Protections::HandleNetGameEvent));
5758
BaseHook::Add<Hooks::Protections::HandleCloneCreate>(new DetourHook("HandleCloneCreate", Pointers.HandleCloneCreate, Hooks::Protections::HandleCloneCreate));
@@ -86,6 +87,9 @@ namespace YimMenu
8687

8788
BaseHook::Add<Hooks::Misc::ThrowFatalError>(new DetourHook("ThrowFatalError", Pointers.ThrowFatalError, Hooks::Misc::ThrowFatalError));
8889
BaseHook::Add<Hooks::Misc::IsAnimSceneInScope>(new DetourHook("IsAnimSceneInScope", Pointers.IsAnimSceneInScope, Hooks::Misc::IsAnimSceneInScope));
90+
BaseHook::Add<Hooks::Misc::GetTextLabel>(new DetourHook("GetTextLabel", Pointers.GetTextLabel, Hooks::Misc::GetTextLabel));
91+
BaseHook::Add<Hooks::Misc::CheckConditionIsMale>(new DetourHook("CheckConditionIsMale", Pointers.CheckConditionIsMale, Hooks::Misc::CheckConditionIsMale));
92+
BaseHook::Add<Hooks::Misc::CheckConditionIsFemale>(new DetourHook("CheckConditionIsFemale", Pointers.CheckConditionIsFemale, Hooks::Misc::CheckConditionIsFemale));
8993

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

0 commit comments

Comments
 (0)