Skip to content

Commit

Permalink
gtade: update for new patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Nov 15, 2024
1 parent 4bd2778 commit 31d62ea
Show file tree
Hide file tree
Showing 14 changed files with 1,390 additions and 253 deletions.
3 changes: 3 additions & 0 deletions .github/docs/gta3de.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
![gta3de](https://thirteenag.github.io/screens/gta3de/main2.jpg)

![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Skip Intro.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Skip Menu.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to quicksave anywhere by pressing F5.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to disable first person aim mode for rifles.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to resize HUD.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to fix bugged mouse camera movement.

[Website](https://thirteenag.github.io/wfp#gta3de) | [Source](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/source/GTA3DE.FusionMod/dllmain.cpp) | [Default INI File](https://github.com/ThirteenAG/WidescreenFixesPack/blob/master/data/GTA3DE.FusionMod/Gameface/Binaries/Win64/scripts/GTA3DE.FusionMod.ini)

Expand Down
3 changes: 3 additions & 0 deletions .github/docs/gtasade.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
![gtasade](https://thirteenag.github.io/screens/gtasade/main2.jpg)

![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Skip Intro.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Skip Menu.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to quicksave anywhere by pressing F5.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to resize HUD.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to fix bugged mouse camera movement.

Installation:
Download and extract the archive to the game directory, where the exe is located.
Expand Down
3 changes: 3 additions & 0 deletions .github/docs/gtavcde.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
![gtavcde](https://thirteenag.github.io/screens/gtavcde/main2.jpg)

![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Skip Intro.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Skip Menu.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to quicksave anywhere by pressing F5.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to disable first person aim mode for rifles.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to resize HUD.
![](https://habrastorage.org/webt/d_/eg/ym/d_egymd6w_tem2erocab-e9ikna.png) Adds an ability to fix bugged mouse camera movement.

Installation:
Download and extract the archive to the game directory, where the exe is located.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[MAIN]
HudScale = 0.8 // Original value is 1.0.
RadarScale = 0.9 // Original value is 1.0.
SaveSlot = 5 // Available slots: 1 through 8
DisableFirstPersonAimForRifles = 1
SkipIntro = 1
SkipMenu = 1
HudScale = 0.8 // Original value is 1.0.
RadarScale = 0.75 // Original value is 1.0.
SaveSlot = 5 // Available slots: 1 through 8
DisableFirstPersonAimForRifles = 1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[MAIN]
HudScale = 0.8 // Original value is 1.0.
RadarScale = 0.9 // Original value is 1.0.
SaveSlot = 5 // Available slots: 1 through 8
SkipIntro = 1
SkipMenu = 1
HudScale = 0.8 // Original value is 1.0.
RadarScale = 0.75 // Original value is 1.0.
SaveSlot = 5 // Available slots: 1 through 8
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[MAIN]
HudScale = 0.8 // Original value is 1.0.
RadarScale = 0.9 // Original value is 1.0.
SaveSlot = 5 // Available slots: 1 through 8
DisableFirstPersonAimForRifles = 1
SkipIntro = 1
SkipMenu = 1
HudScale = 0.8 // Original value is 1.0.
RadarScale = 0.75 // Original value is 1.0.
SaveSlot = 5 // Available slots: 1 through 8
DisableFirstPersonAimForRifles = 1
66 changes: 66 additions & 0 deletions includes/GTA/ue.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#pragma once
#include <string>
#include <locale>

template<class T>
struct TArray
{
friend struct FString;

public:
inline TArray()
{
Data = nullptr;
Count = Max = 0;
};

inline int Num() const
{
return Count;
};

inline T& operator[](int i)
{
return Data[i];
};

inline const T& operator[](int i) const
{
return Data[i];
};

inline bool IsValidIndex(int i) const
{
return i < Num();
}

public:
T* Data;
int Count;
int Max;
};

struct FString : public TArray<wchar_t>
{
inline FString()
{
};

inline bool IsValid() const
{
return Data != nullptr;
}

inline const wchar_t* c_str() const
{
return Data;
}

std::string ToString() const
{
auto length = std::wcslen(Data);
std::string str(length, '\0');
std::use_facet<std::ctype<wchar_t>>(std::locale()).narrow(Data, Data + length, '?', &str[0]);
return str;
}
};
101 changes: 101 additions & 0 deletions includes/kananlib.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#pragma once
#define _WINTERNL_
#include <utility/Scan.hpp>
#include <utility/Module.hpp>

namespace utility {
static inline std::vector<uintptr_t> scan_references(uintptr_t start, size_t length, uintptr_t ptr)
{
std::vector<uintptr_t> results{};
const auto end = (start + length) - sizeof(void*);

for (auto ref = utility::scan_ptr(start, length, ptr); ref; ref = utility::scan_ptr(*ref + sizeof(void*), end - (*ref + sizeof(void*)), ptr)) {
results.push_back(*ref);
}

return results;
}

static inline std::vector<uintptr_t> scan_references(HMODULE module, uintptr_t ptr)
{
const auto module_size = utility::get_module_size(module);

if (!module_size) {
return {};
}

return scan_references((uintptr_t)module, *module_size, ptr);
}

template<class T, class S, class UnaryPred>
static T GetSymbolFromFuncStart(S& str, UnaryPred predicate)
{
auto func = utility::find_function_from_string_ref(utility::get_executable(), str, true);
if (func)
{
INSTRUX ix{};
auto ip = utility::find_function_start_with_call(func.value()).value_or(func.value());

while (ip)
{
const auto status = NdDecodeEx(&ix, (ND_UINT8*)ip, 1000, ND_CODE_64, ND_DATA_64);

if (!ND_SUCCESS(status)) {
break;
}

if (predicate(ix))
{
auto disp = utility::resolve_displacement(ip);
if (disp)
{
return reinterpret_cast<T>(disp.value());
break;
}
}

ip += ix.Length;
}
}
return T{};
}

template<class T, class S>
static T GetFunctionCallAfterStringParam(S& str, int callnum = 0)
{
auto scan_res = utility::scan_string(utility::get_executable(), str, true);
if (scan_res)
{
auto xref = utility::scan_reference(utility::get_executable(), scan_res.value());
if (xref)
{
INSTRUX ix{};
auto ip = xref.value() + 4;
auto counter = 0;

while (true)
{
const auto status = NdDecodeEx(&ix, (ND_UINT8*)ip, 1000, ND_CODE_64, ND_DATA_64);

if (!ND_SUCCESS(status)) {
break;
}

if (ix.Instruction == ND_INS_CALLNR)
{
auto disp = utility::resolve_displacement(ip);
if (disp && counter == callnum)
{
return reinterpret_cast<T>(disp.value());
break;
}
counter++;
}

ip += ix.Length;
}
}
}
return T{};
}
}
17 changes: 0 additions & 17 deletions includes/raw_mem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <initializer_list>
#include "injector/injector.hpp"
#include "../external/asmjit/src/asmjit/x86.h"
#include "Trampoline.h"
using namespace asmjit;
using namespace x86;
typedef void (*asmjit_Func)();
Expand Down Expand Up @@ -72,19 +71,3 @@ namespace injector
};
};

namespace injector
{
inline bool UnprotectMemory(memory_pointer_tr addr, size_t size)
{
DWORD out_oldprotect = 0;
return VirtualProtect(addr.get(), size, PAGE_EXECUTE_READWRITE, &out_oldprotect) != 0;
}

#ifdef _WIN64
inline injector::memory_pointer_raw MakeCALLTrampoline(injector::memory_pointer_tr at, injector::memory_pointer_raw dest, bool vp = true)
{
auto trampoline = Trampoline::MakeTrampoline((void*)at.as_int());
return MakeCALL(at, trampoline->Jump(dest));
}
#endif
};
20 changes: 19 additions & 1 deletion includes/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "callbacks.h"
#include "log.h"
#include "ModuleList.hpp"
#include "Trampoline.h"
#include <filesystem>
#include <stacktrace>
#include <shellapi.h>
Expand Down Expand Up @@ -1204,4 +1205,21 @@ class WFP
static Event<> GameProcessEvent;
return GameProcessEvent;
}
};
};

namespace injector
{
inline bool UnprotectMemory(memory_pointer_tr addr, size_t size)
{
DWORD out_oldprotect = 0;
return VirtualProtect(addr.get(), size, PAGE_EXECUTE_READWRITE, &out_oldprotect) != 0;
}

#ifdef _WIN64
inline injector::memory_pointer_raw MakeCALLTrampoline(injector::memory_pointer_tr at, injector::memory_pointer_raw dest, bool vp = true)
{
auto trampoline = Trampoline::MakeTrampoline((void*)at.as_int());
return MakeCALL(at, trampoline->Jump(dest));
}
#endif
};
6 changes: 3 additions & 3 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,17 @@ group "Win64/GrandTheftAuto"
project "GTA3DE.FusionMod"
platforms { "Win64" }
architecture "x64"
add_asmjit()
add_kananlib()
setpaths("Z:/WFP/Games/Grand Theft Auto The Definitive Edition/GTA III - Definitive Edition/", "Gameface/Binaries/Win64/LibertyCity.exe", "Gameface/Binaries/Win64/scripts/")
project "GTAVCDE.FusionMod"
platforms { "Win64" }
architecture "x64"
add_asmjit()
add_kananlib()
setpaths("Z:/WFP/Games/Grand Theft Auto The Definitive Edition/GTA Vice City - Definitive Edition/", "Gameface/Binaries/Win64/ViceCity.exe", "Gameface/Binaries/Win64/scripts/")
project "GTASADE.FusionMod"
platforms { "Win64" }
architecture "x64"
add_asmjit()
add_kananlib()
setpaths("Z:/WFP/Games/Grand Theft Auto The Definitive Edition/GTA San Andreas - Definitive Edition/", "Gameface/Binaries/Win64/SanAndreas.exe", "Gameface/Binaries/Win64/scripts/")
group "Win64"

Expand Down
Loading

0 comments on commit 31d62ea

Please sign in to comment.