From 36fe2b0f9fefb797d2864411be9aab74a32d1108 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Fri, 14 Feb 2025 23:43:31 +0000 Subject: [PATCH] Treewide: Format --- ChaosMod/Components/DebugMenu.cpp | 2 +- .../ConditionProportionalVotingEnabled.cpp | 6 +- ChaosMod/Effects/Condition/EffectCondition.h | 8 +- .../db/Peds/PedsSpawnCompanionBrad.cpp | 6 +- .../db/Peds/PedsSpawnCompanionChimp.cpp | 4 +- .../db/Peds/PedsSpawnCompanionChop.cpp | 4 +- ChaosMod/Memory/Hooks/ShaderHook.cpp | 75 ++++++++++--------- ChaosMod/Memory/Memory.cpp | 3 +- ChaosMod/Memory/Snow.h | 6 +- ConfigApp/EffectConfig.xaml.cs | 2 +- ConfigApp/EffectsTreeMenuItem.cs | 2 +- .../Workshop/WorkshopSubmissionFileHandler.cs | 2 +- .../ChaosPipe/ChaosPipeClient.cs | 2 +- 13 files changed, 63 insertions(+), 59 deletions(-) diff --git a/ChaosMod/Components/DebugMenu.cpp b/ChaosMod/Components/DebugMenu.cpp index 00f7a9741..62c7656b2 100644 --- a/ChaosMod/Components/DebugMenu.cpp +++ b/ChaosMod/Components/DebugMenu.cpp @@ -4,8 +4,8 @@ #include "Components/EffectDispatcher.h" #include "Effects/EnabledEffects.h" -#include "Util/OptionsManager.h" #include "Util/HelpText.h" +#include "Util/OptionsManager.h" #define MAX_VIS_ITEMS 15 diff --git a/ChaosMod/Effects/Condition/ConditionProportionalVotingEnabled.cpp b/ChaosMod/Effects/Condition/ConditionProportionalVotingEnabled.cpp index 61d131c66..b4c36e639 100644 --- a/ChaosMod/Effects/Condition/ConditionProportionalVotingEnabled.cpp +++ b/ChaosMod/Effects/Condition/ConditionProportionalVotingEnabled.cpp @@ -5,7 +5,9 @@ static bool OnCondition() { - return ComponentExists() && GetComponent()->IsEnabled() && GetComponent()->GetVotingMode() == VotingMode::Percentage; + return ComponentExists() && GetComponent()->IsEnabled() + && GetComponent()->GetVotingMode() == VotingMode::Percentage; } -REGISTER_EFFECT_CONDITION(EffectConditionType::ProportionalVotingEnabled, OnCondition, "Proportional voting is not enabled"); \ No newline at end of file +REGISTER_EFFECT_CONDITION(EffectConditionType::ProportionalVotingEnabled, OnCondition, + "Proportional voting is not enabled"); \ No newline at end of file diff --git a/ChaosMod/Effects/Condition/EffectCondition.h b/ChaosMod/Effects/Condition/EffectCondition.h index 32801a7e1..ac3ad7911 100644 --- a/ChaosMod/Effects/Condition/EffectCondition.h +++ b/ChaosMod/Effects/Condition/EffectCondition.h @@ -3,8 +3,8 @@ #include "Util/Logging.h" #include "Util/MacroConcat.h" -#include #include +#include enum class EffectConditionType { @@ -13,9 +13,9 @@ enum class EffectConditionType ProportionalVotingEnabled }; -#define REGISTER_EFFECT_CONDITION(conditionType, condition, failReason) \ - namespace \ - { \ +#define REGISTER_EFFECT_CONDITION(conditionType, condition, failReason) \ + namespace \ + { \ EffectCondition CHAOSCONCAT(_effectCondition, __LINE__)(conditionType, condition, failReason); \ } diff --git a/ChaosMod/Effects/db/Peds/PedsSpawnCompanionBrad.cpp b/ChaosMod/Effects/db/Peds/PedsSpawnCompanionBrad.cpp index b1d883a77..dfe4a506f 100644 --- a/ChaosMod/Effects/db/Peds/PedsSpawnCompanionBrad.cpp +++ b/ChaosMod/Effects/db/Peds/PedsSpawnCompanionBrad.cpp @@ -8,10 +8,10 @@ static void OnStart() { static const Hash model = "ig_brad"_hash; - Ped playerPed = PLAYER_PED_ID(); - Vector3 playerPos = GET_ENTITY_COORDS(playerPed, false); + Ped playerPed = PLAYER_PED_ID(); + Vector3 playerPos = GET_ENTITY_COORDS(playerPed, false); - Ped ped = CreatePoolPed(4, model, playerPos.x, playerPos.y, playerPos.z, GET_ENTITY_HEADING(playerPed)); + Ped ped = CreatePoolPed(4, model, playerPos.x, playerPos.y, playerPos.z, GET_ENTITY_HEADING(playerPed)); CurrentEffect::SetEffectSoundPlayOptions( { .PlayType = EffectSoundPlayType::FollowEntity, .PlayFlags = EffectSoundPlayFlags_Looping, .Entity = ped }); if (IS_PED_IN_ANY_VEHICLE(playerPed, false)) diff --git a/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChimp.cpp b/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChimp.cpp index 27165aeaa..c69ed0639 100644 --- a/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChimp.cpp +++ b/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChimp.cpp @@ -8,8 +8,8 @@ static void OnStart() { static const Hash modelHash = "a_c_chimp"_hash; - Ped playerPed = PLAYER_PED_ID(); - Vector3 playerPos = GET_ENTITY_COORDS(playerPed, false); + Ped playerPed = PLAYER_PED_ID(); + Vector3 playerPos = GET_ENTITY_COORDS(playerPed, false); Ped ped = CreatePoolPed(28, modelHash, playerPos.x, playerPos.y, playerPos.z, GET_ENTITY_HEADING(playerPed)); CurrentEffect::SetEffectSoundPlayOptions({ .PlayType = EffectSoundPlayType::FollowEntity, .Entity = ped }); diff --git a/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChop.cpp b/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChop.cpp index ee82d261b..3460df3f2 100644 --- a/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChop.cpp +++ b/ChaosMod/Effects/db/Peds/PedsSpawnCompanionChop.cpp @@ -8,8 +8,8 @@ static void OnStart() { static const Hash modelHash = "a_c_chop"_hash; - Ped playerPed = PLAYER_PED_ID(); - Vector3 playerPos = GET_ENTITY_COORDS(playerPed, false); + Ped playerPed = PLAYER_PED_ID(); + Vector3 playerPos = GET_ENTITY_COORDS(playerPed, false); Ped ped = CreatePoolPed(28, modelHash, playerPos.x, playerPos.y, playerPos.z, GET_ENTITY_HEADING(playerPed)); CurrentEffect::SetEffectSoundPlayOptions({ .PlayType = EffectSoundPlayType::FollowEntity, .Entity = ped }); diff --git a/ChaosMod/Memory/Hooks/ShaderHook.cpp b/ChaosMod/Memory/Hooks/ShaderHook.cpp index d06aac1ad..189f7087b 100644 --- a/ChaosMod/Memory/Hooks/ShaderHook.cpp +++ b/ChaosMod/Memory/Hooks/ShaderHook.cpp @@ -78,43 +78,44 @@ namespace Hooks auto result = shaderCache.find(hash); if (result == shaderCache.end()) { - auto future = std::async( - std::launch::async, - [&]() - { - ID3DBlob *shader; - ID3DBlob *errorMessages; - HRESULT compileResult; - if ((compileResult = D3DCompile(shaderSrc.data(), shaderSrc.size(), NULL, NULL, NULL, "main", - "ps_4_0", 0, 0, &shader, &errorMessages)) - == S_OK) - { - auto ptr = reinterpret_cast(shader->GetBufferPointer()); - std::vector shaderBytecode; - shaderBytecode.reserve(shader->GetBufferSize()); - std::copy(ptr, ptr + shader->GetBufferSize(), std::back_inserter(shaderBytecode)); - - if (shaderCache.size() > SHADER_CACHE_MAX_ENTRIES) - shaderCache.erase(shaderCache.begin()); - - shaderCache[hash] = shaderBytecode; - result = shaderCache.find(hash); - } - else - { - LOG("Error compiling shader: Error code 0x" << std::hex << std::uppercase << compileResult << std::dec); - if (errorMessages) - { - auto ptr = reinterpret_cast(errorMessages->GetBufferPointer()); - std::string buffer; - buffer.reserve(errorMessages->GetBufferSize()); - std::copy(ptr, ptr + errorMessages->GetBufferSize(), std::back_inserter(buffer)); - - LOG(buffer); - return; - } - } - }); + auto future = + std::async(std::launch::async, + [&]() + { + ID3DBlob *shader; + ID3DBlob *errorMessages; + HRESULT compileResult; + if ((compileResult = D3DCompile(shaderSrc.data(), shaderSrc.size(), NULL, NULL, NULL, + "main", "ps_4_0", 0, 0, &shader, &errorMessages)) + == S_OK) + { + auto ptr = reinterpret_cast(shader->GetBufferPointer()); + std::vector shaderBytecode; + shaderBytecode.reserve(shader->GetBufferSize()); + std::copy(ptr, ptr + shader->GetBufferSize(), std::back_inserter(shaderBytecode)); + + if (shaderCache.size() > SHADER_CACHE_MAX_ENTRIES) + shaderCache.erase(shaderCache.begin()); + + shaderCache[hash] = shaderBytecode; + result = shaderCache.find(hash); + } + else + { + LOG("Error compiling shader: Error code 0x" << std::hex << std::uppercase + << compileResult << std::dec); + if (errorMessages) + { + auto ptr = reinterpret_cast(errorMessages->GetBufferPointer()); + std::string buffer; + buffer.reserve(errorMessages->GetBufferSize()); + std::copy(ptr, ptr + errorMessages->GetBufferSize(), std::back_inserter(buffer)); + + LOG(buffer); + return; + } + } + }); using namespace std::chrono_literals; while (future.wait_for(0ms) != std::future_status::ready) diff --git a/ChaosMod/Memory/Memory.cpp b/ChaosMod/Memory/Memory.cpp index 4e67ca168..7e153aef4 100644 --- a/ChaosMod/Memory/Memory.cpp +++ b/ChaosMod/Memory/Memory.cpp @@ -196,7 +196,8 @@ namespace Memory return {}; auto resultAddr = reinterpret_cast(thePattern.get_first()); - DEBUG_LOG("Found pattern \"" << pattern << "\" at address 0x" << std::uppercase << std::hex << resultAddr << std::dec); + DEBUG_LOG("Found pattern \"" << pattern << "\" at address 0x" << std::uppercase << std::hex << resultAddr + << std::dec); return resultAddr; }; diff --git a/ChaosMod/Memory/Snow.h b/ChaosMod/Memory/Snow.h index b559b7c6a..42f9bdaf8 100644 --- a/ChaosMod/Memory/Snow.h +++ b/ChaosMod/Memory/Snow.h @@ -13,11 +13,11 @@ namespace Memory { /* Thanks to menyoo! */ - static bool init = false; + static bool init = false; static bool isPre3095 = getGameVersion() < eGameVersion::VER_1_0_3095_0; - auto snowPattern1 = isPre3095 ? "80 3D ?? ?? ?? ?? 00 74 25 B9 40 00 00 00" - : "44 38 ?? ?? ?? ?? 01 74 12 B9 40 00 00 00"; + auto snowPattern1 = + isPre3095 ? "80 3D ?? ?? ?? ?? 00 74 25 B9 40 00 00 00" : "44 38 ?? ?? ?? ?? 01 74 12 B9 40 00 00 00"; static auto handle = FindPattern(snowPattern1); if (!handle.IsValid()) return; diff --git a/ConfigApp/EffectConfig.xaml.cs b/ConfigApp/EffectConfig.xaml.cs index 9a084d3b5..f7f1a24a3 100644 --- a/ConfigApp/EffectConfig.xaml.cs +++ b/ConfigApp/EffectConfig.xaml.cs @@ -42,7 +42,7 @@ public EffectConfig(string? effectId, EffectData? effectData, EffectInfo effectI if (m_IsTimedEffect) { effectconf_timer_type_enable.IsChecked = m_EffectData.TimedType.HasValue && - m_EffectData.TimedType != defaultTimedType && + m_EffectData.TimedType != defaultTimedType && m_EffectData.TimedType != EffectTimedType.Custom; effectconf_timer_type.ItemsSource = new string[] { diff --git a/ConfigApp/EffectsTreeMenuItem.cs b/ConfigApp/EffectsTreeMenuItem.cs index 8b0709387..3e04fe0a3 100644 --- a/ConfigApp/EffectsTreeMenuItem.cs +++ b/ConfigApp/EffectsTreeMenuItem.cs @@ -87,7 +87,7 @@ public ICommand OnConfigureCommand { get => new TreeMenuItemAction(OnConfigureClick); } - + public TreeMenuItem(string text, TreeMenuItem? parent = null) { Text = text; diff --git a/ConfigApp/Workshop/WorkshopSubmissionFileHandler.cs b/ConfigApp/Workshop/WorkshopSubmissionFileHandler.cs index 37d643181..f28421e3a 100644 --- a/ConfigApp/Workshop/WorkshopSubmissionFileHandler.cs +++ b/ConfigApp/Workshop/WorkshopSubmissionFileHandler.cs @@ -6,9 +6,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; - using Newtonsoft.Json.Linq; using System.Windows; using Newtonsoft.Json; + using Newtonsoft.Json.Linq; public class WorkshopSubmissionFileHandler { diff --git a/TwitchChatVotingProxy/ChaosPipe/ChaosPipeClient.cs b/TwitchChatVotingProxy/ChaosPipe/ChaosPipeClient.cs index b627492a5..6d1b6753f 100644 --- a/TwitchChatVotingProxy/ChaosPipe/ChaosPipeClient.cs +++ b/TwitchChatVotingProxy/ChaosPipe/ChaosPipeClient.cs @@ -256,7 +256,7 @@ private void ChangeVotingMode(List? options) m_Logger.Error("Unknown voting mode: " + modeName); return; } - + m_Logger.Information("Setting voting mode to " + modeName); OnSetVotingMode?.Invoke(this, new((EVotingMode)mode)); }