Skip to content

Commit

Permalink
Merge branch 'develop' into changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Rackover authored Dec 3, 2024
2 parents 5336730 + 05fb0d8 commit 81553a6
Show file tree
Hide file tree
Showing 82 changed files with 812 additions and 342 deletions.
31 changes: 24 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
[*.{cpp,hpp}]
root = true

[*]
end_of_line = crlf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
brace_style = next_line
namespace_indentation = all
cpp_indent_namespace_contents = true

# Markdown
#
# A paragraph consists of one or more consecutive lines of text, separated by
# one or more blank lines. A blank line is defined as any line that appears
# empty; it may contain only spaces or tabs. Normal paragraphs should not begin
# with spaces or tabs for indentation.
#
# The rule of "one or more consecutive lines of text" means that Markdown
# supports "hard-wrapped" text paragraphs. This is notably different from many
# other text-to-HTML converters, such as Movable Type's "Convert Line Breaks"
# option, which converts every line break within a paragraph into a <br /> tag.
#
# If you need to insert a <br /> tag for a line break, end the line with two or
# more spaces and then press return. Note that editors must be told to preserve
# "trailing whitespace" to maintain this formatting.
#
[*.{[Mm][Dd],[Mm][Kk][Dd],[Mm][Dd][Oo][Ww][Nn],[Mm][Kk][Dd][Oo][Ww][Nn],[Mm][Aa][Rr][Kk][Dd][Oo][Ww][Nn]}]
trim_trailing_whitespace = false
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
[submodule "deps/iw4-open-formats"]
path = deps/iw4-open-formats
url = https://github.com/iw4x/iw4-open-formats.git
[submodule "deps/dualsense-windows"]
path = deps/dualsense-windows
url = git@github.com:Ohjurot/DualSense-Windows.git
[submodule "deps/dualsense-windows"]
path = deps/dualsense-windows
url = https://github.com/Ohjurot/DualSense-Windows.git
2 changes: 1 addition & 1 deletion src/Components/Modules/AssetHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Components
static void ExposeTemporaryAssets(bool expose);

static void OffsetToAlias(Utils::Stream::Offset* offset);

private:
static thread_local int BypassState;
static bool ShouldSearchTempAssets;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/AssetInterfaces/IFont_s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace Assets

auto w = fontDef["textureWidth"].get<int>();
auto h = fontDef["textureHeight"].get<int>();

auto size = fontDef["size"].get<int>();
auto yOffset = fontDef["yOffset"].get<int>();

Expand Down Expand Up @@ -218,7 +218,7 @@ namespace Assets

// Save generated image
Utils::IO::CreateDir("userraw\\images");

int fileSize = w * h * 4;
int iwiHeaderSize = static_cast<int>(sizeof(Game::GfxImageFileHeader));

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/AssetInterfaces/IFxEffectDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace Assets
if (visuals->soundName)
{
// Double "find call" but we have to because otherwise we'd crash on missing asset
// Sometimes Fx reference by name a sound that does not exist. IW oversight ?
// Sometimes Fx reference by name a sound that does not exist. IW oversight ?
// Never happens on iw3 but often happens on iw5, especially DLC maps.
if (Components::AssetHandler::FindAssetForZone(Game::XAssetType::ASSET_TYPE_SOUND, visuals->soundName, builder, false).data)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/AssetInterfaces/IFxWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ namespace Assets
}
}
}

void IFxWorld::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
{
if (!header->fxWorld) loadFromDisk(header, name, builder);
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/AssetInterfaces/ILocalizeEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ namespace Assets
{
assets.push_back(asset);
});

const auto* psLoadedFile = Game::SE_Load(filename.data(), false);
if (psLoadedFile)
{
Game::Com_PrintError(Game::CON_CHANNEL_SYSTEM, "^1Localization ERROR: %s\n", psLoadedFile);
return;
}
}

auto type = Game::DB_GetXAssetNameType("localize");
for (const auto& entry : assets)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/AssetInterfaces/IWeapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ namespace Assets
buffer->saveString(def->szScript);
Utils::Stream::ClearPointer(&dest->szScript);
}

if (def->locationDamageMultipliers)
{
buffer->align(Utils::Stream::ALIGN_4);
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/AssetInterfaces/ImenuDef_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ namespace Assets
buffer->enterStruct(Utils::String::VA("itemDef_s: name = '%s'", asset->window.name));
else if (asset->window.background)
buffer->enterStruct(Utils::String::VA("itemDef_s: bg = '%s'", asset->window.background->info.name));
else
else
buffer->enterStruct("itemDef_s");
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Assets
void Isnd_alias_list_t::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
{
header->sound = builder->getIW4OfApi()->read<Game::snd_alias_list_t>(Game::XAssetType::ASSET_TYPE_SOUND, name);

if (!header->sound)
{
header->sound = Components::AssetHandler::FindOriginalAsset(Game::XAssetType::ASSET_TYPE_SOUND_CURVE, name.data()).sound;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/Auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ namespace Components
Utils::IO::CreateDir(appdata.string());

const auto guidPath = appdata / "guid.dat";

return guidPath.string();
}

Expand Down Expand Up @@ -368,7 +368,7 @@ namespace Components
cert.set_token(GuidToken.toString());
cert.set_ctoken(ComputeToken.toString());
cert.set_privatekey(GuidKey.serialize(PK_PRIVATE));

const auto guidPath = GetGUIDFilePath();
Utils::IO::WriteFile(guidPath, cert.SerializeAsString());
}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/Auth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Components
static void StoreKey();
static void LoadKey(bool force = false);
static void GenerateKey();

static unsigned __int64 GetKeyHash();
static unsigned __int64 GetKeyHash(const std::string& key);

Expand Down Expand Up @@ -48,7 +48,7 @@ namespace Components
static std::vector<std::uint64_t> BannedUids;

static bool HasAccessToReservedSlot;

static void SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char* format, int len);
static void ParseConnectData(Game::msg_t* msg, Game::netadr_t* addr);
static void DirectConnectStub();
Expand Down
26 changes: 13 additions & 13 deletions src/Components/Modules/CardTitles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ namespace Components

struct CClient
{
std::uint32_t IsValid; // 0x0000
std::uint32_t IsValid2; // 0x0004
std::uint32_t ClientNumber; // 0x0008
char Name[16]; // 0x000C
std::uint32_t Team; // 0x001C
std::uint32_t Team2; // 0x0020
std::uint32_t IsValid; // 0x0000
std::uint32_t IsValid2; // 0x0004
std::uint32_t ClientNumber; // 0x0008
char Name[16]; // 0x000C
std::uint32_t Team; // 0x001C
std::uint32_t Team2; // 0x0020
std::uint32_t Rank; // 0x0024 (rank - 1)
std::uint32_t Prestige; // 0x0028
std::uint32_t Perks; // 0x002C
std::uint32_t Perks; // 0x002C
std::uint32_t Kills; // 0x0030
std::uint32_t Score; // 0x0034
std::uint32_t Score; // 0x0034
std::uint8_t _0x0038[968];
std::uint32_t ViewAngles; // 0x0400
std::uint32_t ViewAngles; // 0x0400
std::uint8_t _0x040C[136];
std::uint32_t IsShooting; // 0x0494
std::uint32_t IsShooting; // 0x0494
std::uint8_t _0x0498[4];
std::uint32_t IsZoomed; // 0x049C
std::uint32_t IsZoomed; // 0x049C
std::uint8_t _0x04A0[68];
std::uint32_t weaponID; // 0x04E4
std::uint32_t weaponID; // 0x04E4
std::uint8_t _0x04E8[24];
std::uint32_t weaponID2; // 0x0500
std::uint32_t weaponID2; // 0x0500
std::uint8_t _0x0504[40];
std::uint8_t _padding[8];
};
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/ClanTags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace Components
{
char saneNameBuf[MAX_CLAN_NAME_LENGTH]{};
auto* saneName = saneNameBuf;

assert(ClanName);
const auto* currentName = ClanName->current.string;
if (currentName)
Expand Down
12 changes: 6 additions & 6 deletions src/Components/Modules/ConfigStrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ namespace Components
Utils::Hook(0x4503F6, ConfigStrings::CL_GetCachedModelConfigString, HOOK_CALL).install()->quick();
Utils::Hook(0x4504A0, ConfigStrings::CL_GetCachedModelConfigString, HOOK_CALL).install()->quick();
Utils::Hook(0x450A30, ConfigStrings::CL_GetCachedModelConfigString, HOOK_CALL).install()->quick();

Utils::Hook(0x44F217, ConfigStrings::SV_GetCachedModelConfigStringConst, HOOK_CALL).install()->quick();
Utils::Hook(0X418F93, ConfigStrings::SV_GetCachedModelConfigStringConst, HOOK_CALL).install()->quick();
Utils::Hook(0x497B0A, ConfigStrings::SV_GetCachedModelConfigStringConst, HOOK_CALL).install()->quick();
Utils::Hook(0x4F4493, ConfigStrings::SV_GetCachedModelConfigStringConst, HOOK_CALL).install()->quick();
Utils::Hook(0x5FC46D, ConfigStrings::SV_GetCachedModelConfigStringConst, HOOK_JUMP).install()->quick();

Utils::Hook(0x44F282, ConfigStrings::SV_SetCachedModelConfigString, HOOK_CALL).install()->quick();

Utils::Hook::Set<DWORD>(0x44A333, sizeof(cl_gameState));
Utils::Hook::Set<DWORD>(0x5A1F56, sizeof(cl_gameState));
Utils::Hook::Set<DWORD>(0x5A2043, sizeof(cl_gameState));
Expand Down Expand Up @@ -151,7 +151,7 @@ namespace Components
// This will go back to our reallocated game state anyway
return Game::SV_SetConfigstring(index, data);
}

void ConfigStrings::SV_SetWeaponConfigString(int index, const char* data)
{
SV_SetConfigString(index, data, Game::CS_WEAPONFILES_LAST, EXTRA_WEAPONS_FIRST);
Expand All @@ -171,12 +171,12 @@ namespace Components
{
SV_SetConfigString(RUMBLE_FIRST + index, data, Game::CS_LAST, Game::MAX_CONFIGSTRINGS);
}

void ConfigStrings::SV_SetCachedModelConfigString(int index, const char* data)
{
SV_SetConfigString(index, data, Game::CS_MODELS_LAST, EXTRA_MODELCACHE_FIRST);
}

unsigned int ConfigStrings::SV_GetConfigString(int index, Game::ConfigString basegameLastPosition, int extendedFirstPosition)
{
if (index > basegameLastPosition)
Expand Down Expand Up @@ -229,7 +229,7 @@ namespace Components

int ConfigStrings::CG_ParseExtraConfigStrings()
{
Command::ClientParams params;
Command::ClientParams params;

if (params.size() <= 1)
return 0;
Expand Down
22 changes: 11 additions & 11 deletions src/Components/Modules/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Components
bool Console::HasConsole = false;
bool Console::SkipShutdown = false;

COLORREF Console::TextColor =
COLORREF Console::TextColor =
#ifdef _DEBUG
RGB(255, 200, 117);
#else
Expand Down Expand Up @@ -156,7 +156,7 @@ namespace Components
const auto user32 = Utils::Library("user32.dll");
const auto getDpiForWindow = user32.getProc<UINT(WINAPI*)(HWND)>("GetDpiForWindow");
const auto getDpiForMonitor = user32.getProc<HRESULT(WINAPI*)(HMONITOR, int, UINT*, UINT*)>("GetDpiForMonitor");

int dpi;

if (getDpiForWindow)
Expand All @@ -168,15 +168,15 @@ namespace Components
HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
UINT xdpi, ydpi;
getDpiForMonitor(hMonitor, 0, &xdpi, &ydpi);

dpi = 96;
}
else
{
HDC hDC = GetDC(hWnd);
INT ydpi = GetDeviceCaps(hDC, LOGPIXELSY);
ReleaseDC(nullptr, hDC);

dpi = ydpi;
}

Expand Down Expand Up @@ -467,13 +467,13 @@ namespace Components
auto isInputBox = id == INPUT_BOX;
auto isOutputBox = id == OUTPUT_BOX;

if (isInputBox || isOutputBox)
if (isInputBox || isOutputBox)
{
RECT newParentRect = *reinterpret_cast<LPRECT>(lParam);

RECT childRect;

if (GetWindowRect(hwndChild, &childRect))
if (GetWindowRect(hwndChild, &childRect))
{

int childX, childY;
Expand All @@ -484,7 +484,7 @@ namespace Components

auto scale = GetDpiScale(parent);

if (isInputBox)
if (isInputBox)
{

auto newX = childX; // No change!
Expand All @@ -494,7 +494,7 @@ namespace Components

MoveWindow(hwndChild, newX, newY, newWidth, newHeight, TRUE);
}

if (isOutputBox)
{
auto newX = childX; // No change!
Expand Down Expand Up @@ -619,7 +619,7 @@ namespace Components
return RegisterClassA(lpWndClass);
}

void Console::ApplyConsoleStyle()
void Console::ApplyConsoleStyle()
{
Utils::Hook::Set<std::uint8_t>(0x428A8E, 0); // Adjust logo Y pos
Utils::Hook::Set<std::uint8_t>(0x428A90, 0); // Adjust logo X pos
Expand Down Expand Up @@ -871,10 +871,10 @@ namespace Components
static float consoleColor[] = { 0.70f, 1.00f, 0.00f, 1.00f };
Utils::Hook::Set<float*>(0x5A451A, consoleColor);
Utils::Hook::Set<float*>(0x5A4400, consoleColor);

// Remove the need to type '\' or '/' to send a console command
Utils::Hook::Set<std::uint8_t>(0x431565, 0xEB);

// Internal console
Utils::Hook(0x4F690C, Con_ToggleConsole, HOOK_CALL).install()->quick();
Utils::Hook(0x4F65A5, Con_ToggleConsole, HOOK_JUMP).install()->quick();
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/Console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace Components

static bool Con_IsDvarCommand_Stub(const char* cmd);
static void Cmd_ForEach_Stub(void(*callback)(const char* str));

static LRESULT CALLBACK ConWndProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam);
static ATOM CALLBACK RegisterClassHook(WNDCLASSA* lpWndClass);
static BOOL CALLBACK ResizeChildWindow(HWND hwndChild, LPARAM lParam);
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Modules/Dedicated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace Components
}

void Dedicated::Heartbeat()
{
{
// Do not send a heartbeat if sv_lanOnly is set to true
if (SVLanOnly.get<bool>())
{
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Modules/Dvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ namespace Components

// un-cheat camera_thirdPersonCrosshairOffset and add archive flags
Utils::Hook::Xor<std::uint8_t>(0x447B41, Game::DVAR_CHEAT | Game::DVAR_ARCHIVE);

// un-cheat cg_fov and add archive flags
Utils::Hook::Xor<std::uint8_t>(0x4F8E35, Game::DVAR_CHEAT | Game::DVAR_ARCHIVE);

// un-cheat cg_fovscale and add archive flags
Utils::Hook::Xor<std::uint8_t>(0x4F8E68, Game::DVAR_CHEAT | Game::DVAR_ARCHIVE);

Expand Down
Loading

0 comments on commit 81553a6

Please sign in to comment.