Skip to content

Commit

Permalink
Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
SandeMC committed Jan 17, 2024
2 parents 9c44681 + 0c18ade commit 744f6b1
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/msvc_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ jobs:
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@main

<<<<<<< HEAD
=======
- name: Auto Increment Version
uses: MCKanpolat/auto-semver-action@v2
id: versioning
with:
releaseType: ${{ env.VERINC }}
incrementPerCommit: false
github_token: ${{ secrets.GITHUB_TOKEN }}

>>>>>>> upstream/master
- name: Configure build
run: ./premake5 vs2022 --with-version=vs2022

Expand Down
2 changes: 2 additions & 0 deletions data/plugins/GTAIV.EFLC.FusionFix.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ FixRainDrops = 1
RainDropsBlur = 2 // 1, 2 or 4 only
WalkKey = 0x12 // VK_MENU, used by Always Run option
FixAutoExposure = 1
ExtraCutsceneFix = 1
ExtraInfo = 1 // shows extra info in the pause menu (loaded img files amount)

[BudgetedIV]
VehicleBudget = 0 // may cause issues, set to e.g. 260000000 to increase budget limit
Expand Down
4 changes: 2 additions & 2 deletions data/update/TLAD/common/data/frontend_pc.dat
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ HLP_help_text_size 0.19800 0.30000
HLP_help_text_spacing 0.01875 0.03650
HLP_help_but_size 0.46050 0.39750
HLP_help_but_spacing 0.01350 0.00600
BOT_position_of_bottom_line 0.80800 0.83200
BOT_position_of_bottom_line 0.80800 0.80000
BOT_clock_position 0.08900 0.83500
BOT_clock_size 0.23625 0.32200
BOT_clock_icon_pos -0.50000 0.00000
Expand Down Expand Up @@ -304,7 +304,7 @@ HLP_help_text_size 0.21400 0.29200
HLP_help_text_spacing 0.01875 0.03650
HLP_help_but_size 0.46050 0.42000
HLP_help_but_spacing 0.01350 0.00600
BOT_position_of_bottom_line 0.80800 0.846
BOT_position_of_bottom_line 0.80800 0.80000
BOT_clock_position 0.09700 0.83500
BOT_clock_size 0.24750 0.33750
BOT_clock_icon_pos -0.50000 0.00000
Expand Down
4 changes: 2 additions & 2 deletions data/update/common/data/frontend_pc.dat
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ HLP_help_text_size 0.19800 0.30000
HLP_help_text_spacing 0.01875 0.03650
HLP_help_but_size 0.46050 0.39750
HLP_help_but_spacing 0.01350 0.00600
BOT_position_of_bottom_line 0.80800 0.83200
BOT_position_of_bottom_line 0.80800 0.80000
BOT_clock_position 0.08900 0.83500
BOT_clock_size 0.23625 0.32200
BOT_clock_icon_pos -0.50000 0.00000
Expand Down Expand Up @@ -304,7 +304,7 @@ HLP_help_text_size 0.21400 0.29200
HLP_help_text_spacing 0.01875 0.03650
HLP_help_but_size 0.46050 0.42000
HLP_help_but_spacing 0.01350 0.00600
BOT_position_of_bottom_line 0.80800 0.846
BOT_position_of_bottom_line 0.80800 0.80000
BOT_clock_position 0.09700 0.83500
BOT_clock_size 0.24750 0.33750
BOT_clock_icon_pos -0.50000 0.00000
Expand Down
25 changes: 25 additions & 0 deletions source/comvars.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export module comvars;

import common;

#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)

export int32_t* _dwCurrentEpisode;
export uint8_t* CTimer__m_UserPause = nullptr;
export uint8_t* CTimer__m_CodePause = nullptr;
Expand Down Expand Up @@ -39,6 +41,26 @@ export inline LONG getWindowHeight()
return gRect.bottom - gRect.top;
}

#pragma pack(push, 1)
struct CImgFile
{
int m_nTimeLow;
int m_nTimeHigh;
int field_8;
int field_C;
char pszFilename[128];
int m_pDevice;
int field_94;
int m_hFile;
char field_9C;
char field_9D;
char m_bEpisode;
char m_bEpisodicContent;
}; VALIDATE_SIZE(CImgFile, 160);
#pragma pack(pop)

export CImgFile(*pCGameConfigReader__ms_imgFiles)[255];

class Common
{
public:
Expand Down Expand Up @@ -77,6 +99,9 @@ public:

pattern = find_pattern("F3 0F 10 05 ? ? ? ? F3 0F 59 05 ? ? ? ? 8B 43 20 53", "F3 0F 10 05 ? ? ? ? F3 0F 59 44 24 ? 83 C4 04 83 7C 24");
fTimeStep = *pattern.get_first<float*>(4);

pattern = hook::pattern("BE ? ? ? ? 8D 44 24 0C");
pCGameConfigReader__ms_imgFiles = *pattern.get_first<decltype(pCGameConfigReader__ms_imgFiles)>(1);
};
}
} Common;
15 changes: 15 additions & 0 deletions source/cutscenecam.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public:
{
FusionFix::onInitEvent() += []()
{
CIniReader iniReader("");
auto bExtraCutsceneFix = iniReader.ReadInteger("MISC", "ExtraCutsceneFix", 1) != 0;

// By Sergeanur
auto pattern = find_pattern("74 20 83 FF 03 74 1B 83", "74 24 8B 44 24 2C");
injector::WriteMemory<uint8_t>(pattern.get_first(), 0xEB, true);
Expand Down Expand Up @@ -83,6 +86,18 @@ public:

pattern = find_pattern("E8 ? ? ? ? 8B CD 88 44 24 0F", "E8 ? ? ? ? 8B CF 88 44 24 0F");
injector::MakeCALL(pattern.get_first(), *(void**)&dest, true);

if (bExtraCutsceneFix)
{
// ???
pattern = hook::pattern("F3 0F 11 86 ? ? ? ? 5E 5B 8B 4C 24 30 33 CC E8 ? ? ? ? 83 C4 34 C2 04 00");
if (!pattern.empty())
injector::MakeNOP(pattern.get_first(), 8, true);

pattern = hook::pattern("F3 0F 11 86 ? ? ? ? 5F 5E B8 ? ? ? ? 5B 8B 4C 24 30 33 CC E8 ? ? ? ? 83 C4 34 C2 04 00");
if (!pattern.empty())
injector::MakeNOP(pattern.get_first(), 8, true);
}
};
}
} CutsceneCam;
55 changes: 55 additions & 0 deletions source/extrainfo.ixx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module;

#include <common.hxx>

export module extrainfo;

import common;
import comvars;

class ExtraInfo
{
public:
ExtraInfo()
{
FusionFix::onInitEvent() += []()
{
CIniReader iniReader("");

auto bExraInfo = iniReader.ReadInteger("MISC", "ExraInfo", 1) != 0;

if (bExraInfo)
{
auto pattern = hook::pattern("05 ? ? ? ? E9 ? ? ? ? E8 ? ? ? ? 84 C0");
if (!pattern.empty())
{
struct MS_PAUSED_HOOK
{
void operator()(SafetyHookContext& regs)
{
static std::wstring extra = L"";
regs.eax += 0x78;
auto s = std::wstring_view((wchar_t*)regs.eax);

auto imgNum = 0;
auto imgArrSize = 0;
for (auto& it : *pCGameConfigReader__ms_imgFiles)
{
if (it.m_hFile != -1)
imgNum++;
imgArrSize++;
}
extra = s;
extra += L"~n~";
extra += L" ";
extra += L"IMG Files: " + std::to_wstring(imgNum) + L" / " + std::to_wstring(imgArrSize);
if (imgNum >= imgArrSize) extra += L"; WARNING: IMG Files limit reached!";

regs.eax = (uintptr_t)extra.c_str();
}
}; injector::MakeInline2<MS_PAUSED_HOOK>(pattern.get_first(0));
}
}
};
}
} ExtraInfo;
51 changes: 50 additions & 1 deletion source/imgloader.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,56 @@ public:
return str1.contains(str2);
};

auto imgPath = std::filesystem::relative(filePath, exePath).native();
static auto lexicallyRelativeCaseIns = [](const std::filesystem::path& path, const std::filesystem::path& base) -> std::filesystem::path
{
class input_iterator_range
{
public:
input_iterator_range(const std::filesystem::path::const_iterator& first, const std::filesystem::path::const_iterator& last)
: _first(first)
, _last(last)
{}
std::filesystem::path::const_iterator begin() const { return _first; }
std::filesystem::path::const_iterator end() const { return _last; }
private:
std::filesystem::path::const_iterator _first;
std::filesystem::path::const_iterator _last;
};

if (!iequals(path.root_name().wstring(), base.root_name().wstring()) || path.is_absolute() != base.is_absolute() || (!path.has_root_directory() && base.has_root_directory())) {
return std::filesystem::path();
}
std::filesystem::path::const_iterator a = path.begin(), b = base.begin();
while (a != path.end() && b != base.end() && iequals(a->wstring(), b->wstring())) {
++a;
++b;
}
if (a == path.end() && b == base.end()) {
return std::filesystem::path(".");
}
int count = 0;
for (const auto& element : input_iterator_range(b, base.end())) {
if (element != "." && element != "" && element != "..") {
++count;
}
else if (element == "..") {
--count;
}
}
if (count < 0) {
return std::filesystem::path();
}
std::filesystem::path result;
for (int i = 0; i < count; ++i) {
result /= "..";
}
for (const auto& element : input_iterator_range(a, path.end())) {
result /= element;
}
return result;
};

auto imgPath = lexicallyRelativeCaseIns(filePath, exePath).native();
std::replace(std::begin(imgPath), std::end(imgPath), L'\\', L'/');
auto pos = imgPath.find(std::filesystem::path("/").native());

Expand Down
1 change: 1 addition & 0 deletions source/includes/assembly2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace injector
template<class FuncT>
void MakeInline2(memory_pointer_tr at)
{
MakeNOP(at, 5);
typedef injector_asm2::wrapper<FuncT> functor;
if(false) functor::call(nullptr); // To instantiate the template, if not done _asm will fail
injector_asm2::make_SafetyHookContext_and_call<functor>(at);
Expand Down
12 changes: 6 additions & 6 deletions source/loadingdelays.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import common;
import framelimit;
import comvars;

bool bRestoreSleep = false;
//bool bRestoreSleep = false;
void WINAPI FusionSleep(DWORD dwMilliseconds)
{
if (!bRestoreSleep)
//if (!bRestoreSleep)
{
auto bMenuActive = CMenuManager__m_MenuActive && *CMenuManager__m_MenuActive;
auto bLoadscreenActive = (bLoadscreenShown && *bLoadscreenShown) || bLoadingShown;
Expand Down Expand Up @@ -43,9 +43,9 @@ public:
);
};

FusionFix::onGameInitEvent() += []()
{
bRestoreSleep = true;
};
//FusionFix::onGameInitEvent() += []()
//{
// bRestoreSleep = true;
//};
}
} LoadingDelays;

0 comments on commit 744f6b1

Please sign in to comment.