Skip to content

Commit

Permalink
Merge branch 'master' into pointer-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxann authored Jul 21, 2024
2 parents 72555e9 + 9944cbd commit 46f6cee
Show file tree
Hide file tree
Showing 209 changed files with 17,474 additions and 1,648 deletions.
89 changes: 67 additions & 22 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,33 @@ on:
- cron: "0 14 * * *"
workflow_dispatch:

concurrency:
group: nightly
cancel-in-progress: true

jobs:
check_recent_commit:
runs-on: ubuntu-latest
name: Check Recent Commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- uses: actions/checkout@v3

- id: should_run
name: Check if latest commit date is within the previous 24 hours
run: |
if [ -z "$(git rev-list --since="24 hours ago" --all)" ]; then
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "should_run=true" >> $GITHUB_OUTPUT
fi
build_nightly:
runs-on: [self-hosted, Windows]
name: Build Nightly
needs: check_recent_commit
if: needs.check_recent_commit.outputs.should_run == 'true'
outputs:
full_sha: ${{ steps.var.outputs.full_sha }}
short_sha: ${{ steps.var.outputs.short_sha }}
Expand Down Expand Up @@ -46,28 +69,55 @@ jobs:
echo "full_sha=$(git rev-parse HEAD)" >> $env:GITHUB_OUTPUT
echo "short_sha=$(git rev-parse --short HEAD)" >> $env:GITHUB_OUTPUT
check_date:
recreate_release:
runs-on: ubuntu-latest
name: Check latest commit
name: Recreate Release
needs: build_nightly
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
if: needs.check_recent_commit.outputs.should_run == 'true'
steps:
- uses: actions/checkout@v3

- id: should_run
continue-on-error: true
name: Check if latest commit date is within the previous 24 hours
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT
- name: Delete Existing Release
id: delete_release
uses: actions/github-script@v6
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag = "nightly";
// List all releases and find the release by tag
const releases = await github.rest.repos.listReleases({
owner: owner,
repo: repo,
});
const release = releases.data.find(release => release.tag_name === tag);
// Check if the release exists and delete it
if (release) {
await github.rest.repos.deleteRelease({
owner: owner,
repo: repo,
release_id: release.id,
});
console.log(`Deleted release with ID ${release.id}`);
} else {
console.log("No existing release to delete");
}
// Delete the tag
try {
await github.rest.git.deleteRef({
owner: owner,
repo: repo,
ref: `tags/${tag}`,
});
console.log(`Deleted tag ${tag}`);
} catch (error) {
console.error(`Error deleting tag: ${error.message}`);
}
create_release:
runs-on: ubuntu-latest
name: Create Release
needs: [check_date, build_nightly]
if: ${{ needs.check_date.outputs.should_run != 'false' }}
steps:
- uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
Expand All @@ -80,11 +130,6 @@ jobs:
echo "build_sha=$(cat sha256.checksum)" >> $GITHUB_OUTPUT
cat sha256.checksum
- name: Run latest-tag
uses: EndBug/latest-tag@84c87607fcb948bcef069c9a27445e653113979f
with:
ref: nightly

- name: Nightly Release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -105,7 +150,7 @@ jobs:
These are nightly builds of HorseMenu, they are provided for testing purposes only:
- Test if your build environment produces a broken HorseMenu.dll
- Test if source code is out of date and no longer compatible with the current version of GTA V
- Test if source code is out of date and no longer compatible with the current version of Red Dead Redemption 2
If you wish to use this menu as-is you are on your own, no warranty is provided.
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,5 @@ add_compile_definitions(${PROJECT_NAME} "_CRT_SECURE_NO_WARNINGS" "NOMINMAX" "WI

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

set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /O2 /Ox /Oi /Ot /Oy /Ob3 /sdl- /GL /GF /GS- /Gw")
string(REPLACE "/Ob1" "/Ob3" CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
endif()
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# HorseMenu

A trainer for the popular horse riding game from Rockstar Games.
A mod menu for Red Dead Redemption 2 and Red Dead Online published by Rockstar Games. Strictly for educational purposes.

## How to use
Use a popular injector (FateInjector/Xenos/Etc.) and inject into rdr2.exe

(INSERT) Open/Close the menu

## Structure

- `core/` : Essential general features for the base
- `game/` : Game specific implemented things
- `util/` : Loose functions that aren't game specific

**Current Look (Outdated)**
## Screenshots / UI Design

![image](https://github.com/YimMenu/HorseMenu/assets/24372625/e1395e75-7feb-4c4a-9286-bd774e2aaeca)


![image](https://github.com/YimMenu/HorseMenu/assets/79384354/f4c0dbd8-9d89-417d-b1c1-b45c70a5f91a)
![image](https://github.com/YimMenu/HorseMenu/assets/79384354/610f28bd-fe28-4a25-987f-520d75460d67)
![image](https://github.com/YimMenu/HorseMenu/assets/79384354/ce5fbff0-6553-4998-a5dd-ef1747af53b2)
4 changes: 3 additions & 1 deletion cmake/async-logger.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
include(FetchContent)

add_compile_definitions(CXX_FORMAT_SUPPORT)

message(STATUS "Setting up AsyncLogger")
FetchContent_Declare(
AsyncLogger
GIT_REPOSITORY https://github.com/Yimura/AsyncLogger.git
GIT_TAG v0.0.6
GIT_TAG 6fcfd90b3f4ca4dae09c4a96e9a506e6aea06472
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(AsyncLogger)
Expand Down
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 1d566f23329b756aa3ef57be7b53525d949af14a
GIT_TAG 7c78535a483e85fc714525ddce330b2e776e9b8f
GIT_PROGRESS TRUE
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
Expand Down
25 changes: 0 additions & 25 deletions src/core/byte_patch_manager/byte_patch_manager.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions src/core/byte_patch_manager/byte_patch_manager.hpp

This file was deleted.

10 changes: 8 additions & 2 deletions src/core/commands/BoolCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

namespace YimMenu
{
BoolCommand::BoolCommand(std::string name, std::string label, std::string description) :
Command(name, label, description, 0)
BoolCommand::BoolCommand(std::string name, std::string label, std::string description, bool def_value) :
Command(name, label, description, 0),
m_State(def_value)
{
}

Expand Down Expand Up @@ -43,6 +44,11 @@ namespace YimMenu
MarkDirty();
}

void BoolCommand::Initialize()
{
OnEnable();
}

void BoolCommand::Shutdown()
{
OnDisable();
Expand Down
4 changes: 2 additions & 2 deletions src/core/commands/BoolCommand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace YimMenu

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

void Initialize();
void Shutdown();
};
}
7 changes: 7 additions & 0 deletions src/core/commands/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ namespace YimMenu
m_LoopedCommands.push_back(command);
}

void Commands::EnableLoopedCommandsImpl()
{
for (auto& command : m_LoopedCommands)
if (command->GetState())
command->Initialize();
}

void Commands::RunLoopedCommandsImpl()
{
for (auto& command : m_LoopedCommands)
Expand Down
8 changes: 7 additions & 1 deletion src/core/commands/Commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ namespace YimMenu
static void AddLoopedCommand(LoopedCommand* command)
{
GetInstance().AddLoopedCommandImpl(command);

}

static void RunLoopedCommands()
{
GetInstance().RunLoopedCommandsImpl();
}

// TODO: what about bool commands?
static void EnableLoopedCommands()
{
GetInstance().EnableLoopedCommandsImpl();
}

template<typename T = Command>
static T* GetCommand(joaat_t hash)
{
Expand Down Expand Up @@ -61,6 +66,7 @@ namespace YimMenu
private:
void AddCommandImpl(Command* command);
void AddLoopedCommandImpl(LoopedCommand* command);
void EnableLoopedCommandsImpl();
void RunLoopedCommandsImpl();
Command* GetCommandImpl(joaat_t hash);
virtual void SaveStateImpl(nlohmann::json& state) override;
Expand Down
51 changes: 51 additions & 0 deletions src/core/commands/FloatCommand.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "FloatCommand.hpp"
#include "game/backend/FiberPool.hpp" // TODO: game import in core

namespace YimMenu
{
void FloatCommand::OnCall()
{
}

void FloatCommand::SaveState(nlohmann::json& value)
{
value = m_State;
}

void FloatCommand::LoadState(nlohmann::json& value)
{
m_State = value;
}

FloatCommand::FloatCommand(std::string name, std::string label, std::string description, std::optional<float> min, std::optional<float> max, float def_val) :
Command(name, label, description, 0),
m_Min(min),
m_Max(max),
m_State(def_val)
{
}

float FloatCommand::GetState()
{
return m_State;
}

void FloatCommand::SetState(float state)
{
FiberPool::Push([this] {
OnChange();
});
m_State = state;
MarkDirty();
}

std::optional<float> FloatCommand::GetMinimum()
{
return m_Min;
}

std::optional<float> FloatCommand::GetMaximum()
{
return m_Max;
}
}
Loading

0 comments on commit 46f6cee

Please sign in to comment.