From 28163fdfb112b74cca079508e74005e8b4ab9d67 Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Wed, 3 Jun 2020 17:05:32 +0200 Subject: [PATCH] Custom patches can be enabled/disabled like plugins --- .../source/plugins/Launcher/framework.h | 54 ++++++ source-code/source/plugins/Launcher/ui.h | 158 +++++++++++++----- .../source/plugins/Patches/dllmain.cpp | 3 +- 3 files changed, 172 insertions(+), 43 deletions(-) diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index 8d3702f..2ae6835 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -40,6 +40,7 @@ wstring DIVA_EXECUTABLE_LAUNCH_STRING = DIVA_EXECUTABLE_STRING + L" --launch"; LPWSTR DIVA_EXECUTABLE_LAUNCH = const_cast(DIVA_EXECUTABLE_LAUNCH_STRING.c_str()); wstring PLUGINS_DIR = DirPath() + L"\\plugins"; +wstring PATCHES_DIR = DirPath() + L"\\patches"; wstring CONFIG_FILE_STRING = PLUGINS_DIR + L"\\config.ini"; LPCWSTR CONFIG_FILE = CONFIG_FILE_STRING.c_str(); @@ -426,6 +427,59 @@ std::vector GetPluginOptions(std::vector* plugins) // don't load until actually needed to avoid loading disabled plugins std::vector AllPluginOpts; // = GetPluginOptions(&AllPlugins); +std::vector LoadCustom() +{ + std::vector outvec; + + HANDLE hFind; + WIN32_FIND_DATAW ffd; + + hFind = FindFirstFileW((PATCHES_DIR + L"\\*.p?").c_str(), &ffd); + if (hFind != INVALID_HANDLE_VALUE) { + do { + if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + auto pos = wcslen(ffd.cFileName); + + if ((ffd.cFileName[pos - 2] == '.' && (ffd.cFileName[pos - 1] == 'p' || ffd.cFileName[pos - 1] == 'P')) || + (ffd.cFileName[pos - 3] == '.' && (ffd.cFileName[pos - 2] == 'p' || ffd.cFileName[pos - 2] == 'P') && (ffd.cFileName[pos - 1] == '2'))) + { + PluginInfo thisplugin; + thisplugin.filename = ffd.cFileName; + + thisplugin.name = thisplugin.filename; + if (thisplugin.filename[pos - 1] == '2') + thisplugin.name.resize(thisplugin.name.size() - 3); + else + thisplugin.name.resize(thisplugin.name.size() - 2); + + thisplugin.description = L"Custom patch"; + + outvec.push_back(thisplugin); + } + } + } while (FindNextFileW(hFind, &ffd)); + FindClose(hFind); + } + + return outvec; +} +std::vector AllCustomPatches; // = LoadCustom(); + +std::vector GetCustomOptions(std::vector* patches) +{ + std::vector outvec; + + for (PluginInfo& pi : *patches) + { + PluginOption* opt = new PluginOption(pi.filename.c_str(), L"plugins", CONFIG_FILE, pi.name.c_str(), pi.description.c_str(), true, pi.configopts); + outvec.push_back(opt); + } + + return outvec; +} +// don't load until actually needed to avoid loading disabled plugins +std::vector AllCustomOpts; // = GetCustomOptions(&AllCustomPatches); // used to trick Optimus into switching to the NVIDIA GPU HMODULE nvcudaModule = LoadLibraryW(L"nvcuda.dll"); diff --git a/source-code/source/plugins/Launcher/ui.h b/source-code/source/plugins/Launcher/ui.h index 85af197..dd33157 100644 --- a/source-code/source/plugins/Launcher/ui.h +++ b/source-code/source/plugins/Launcher/ui.h @@ -142,6 +142,22 @@ namespace Launcher { this->panel_Plugins->PerformLayout(); + AllCustomPatches = LoadCustom(); + AllCustomOpts = GetPluginOptions(&AllCustomPatches); + + this->panel_Custom->SuspendLayout(); + + int customY = 3; + for (ConfigOptionBase* custom : AllCustomOpts) + { + custom->hasChanged = new bool(false); + customY += custom->AddToPanel(panel_Custom, 12, customY, toolTip1); + } + + this->panel_Custom->ResumeLayout(false); + this->panel_Custom->PerformLayout(); + + // trick Optimus into switching to the NVIDIA GPU if (cuInit != NULL) cuInit(0); @@ -275,6 +291,8 @@ namespace Launcher { private: System::Windows::Forms::Panel^ panel_IntRes; private: System::Windows::Forms::LinkLabel^ labelGPU; private: System::Windows::Forms::Button^ button_Apply; +private: System::Windows::Forms::TabPage^ tabPage_Custom; +private: System::Windows::Forms::Panel^ panel_Custom; @@ -323,6 +341,8 @@ namespace Launcher { this->panel_Components = (gcnew System::Windows::Forms::Panel()); this->tabPage_Plugins = (gcnew System::Windows::Forms::TabPage()); this->panel_Plugins = (gcnew System::Windows::Forms::Panel()); + this->tabPage_Custom = (gcnew System::Windows::Forms::TabPage()); + this->panel_Custom = (gcnew System::Windows::Forms::Panel()); this->button_Discord = (gcnew System::Windows::Forms::Button()); this->button_github = (gcnew System::Windows::Forms::Button()); this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components)); @@ -335,15 +355,17 @@ namespace Launcher { this->tabPage_Playerdata->SuspendLayout(); this->tabPage_Components->SuspendLayout(); this->tabPage_Plugins->SuspendLayout(); + this->tabPage_Custom->SuspendLayout(); this->SuspendLayout(); // // button_Launch // this->button_Launch->FlatAppearance->BorderColor = System::Drawing::SystemColors::Control; this->button_Launch->FlatStyle = System::Windows::Forms::FlatStyle::Flat; - this->button_Launch->Location = System::Drawing::Point(3, 315); + this->button_Launch->Location = System::Drawing::Point(4, 472); + this->button_Launch->Margin = System::Windows::Forms::Padding(4); this->button_Launch->Name = L"button_Launch"; - this->button_Launch->Size = System::Drawing::Size(68, 23); + this->button_Launch->Size = System::Drawing::Size(102, 34); this->button_Launch->TabIndex = 20; this->button_Launch->Text = L"Launch"; this->button_Launch->Click += gcnew System::EventHandler(this, &ui::Button_Launch_Click); @@ -353,9 +375,10 @@ namespace Launcher { this->button_Help->DialogResult = System::Windows::Forms::DialogResult::Cancel; this->button_Help->FlatAppearance->BorderColor = System::Drawing::SystemColors::Control; this->button_Help->FlatStyle = System::Windows::Forms::FlatStyle::Flat; - this->button_Help->Location = System::Drawing::Point(76, 315); + this->button_Help->Location = System::Drawing::Point(114, 472); + this->button_Help->Margin = System::Windows::Forms::Padding(4); this->button_Help->Name = L"button_Help"; - this->button_Help->Size = System::Drawing::Size(69, 23); + this->button_Help->Size = System::Drawing::Size(104, 34); this->button_Help->TabIndex = 21; this->button_Help->Text = L"User guide"; this->button_Help->Click += gcnew System::EventHandler(this, &ui::Button_Help_Click); @@ -365,9 +388,11 @@ namespace Launcher { this->groupBox_ScreenRes->Controls->Add(this->panel_ScreenRes); this->groupBox_ScreenRes->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->groupBox_ScreenRes->ForeColor = System::Drawing::Color::White; - this->groupBox_ScreenRes->Location = System::Drawing::Point(5, 6); + this->groupBox_ScreenRes->Location = System::Drawing::Point(8, 9); + this->groupBox_ScreenRes->Margin = System::Windows::Forms::Padding(4); this->groupBox_ScreenRes->Name = L"groupBox_ScreenRes"; - this->groupBox_ScreenRes->Size = System::Drawing::Size(278, 113); + this->groupBox_ScreenRes->Padding = System::Windows::Forms::Padding(4); + this->groupBox_ScreenRes->Size = System::Drawing::Size(417, 170); this->groupBox_ScreenRes->TabIndex = 10; this->groupBox_ScreenRes->TabStop = false; this->groupBox_ScreenRes->Text = L"Screen Resolution"; @@ -375,9 +400,10 @@ namespace Launcher { // panel_ScreenRes // this->panel_ScreenRes->AutoScroll = true; - this->panel_ScreenRes->Location = System::Drawing::Point(4, 19); + this->panel_ScreenRes->Location = System::Drawing::Point(6, 28); + this->panel_ScreenRes->Margin = System::Windows::Forms::Padding(4); this->panel_ScreenRes->Name = L"panel_ScreenRes"; - this->panel_ScreenRes->Size = System::Drawing::Size(269, 89); + this->panel_ScreenRes->Size = System::Drawing::Size(404, 134); this->panel_ScreenRes->TabIndex = 0; // // tabControl @@ -387,10 +413,12 @@ namespace Launcher { this->tabControl->Controls->Add(this->tabPage_Playerdata); this->tabControl->Controls->Add(this->tabPage_Components); this->tabControl->Controls->Add(this->tabPage_Plugins); + this->tabControl->Controls->Add(this->tabPage_Custom); this->tabControl->Location = System::Drawing::Point(0, 0); + this->tabControl->Margin = System::Windows::Forms::Padding(4); this->tabControl->Name = L"tabControl"; this->tabControl->SelectedIndex = 0; - this->tabControl->Size = System::Drawing::Size(294, 310); + this->tabControl->Size = System::Drawing::Size(441, 465); this->tabControl->TabIndex = 10; // // tabPage_Resolution @@ -401,10 +429,11 @@ namespace Launcher { this->tabPage_Resolution->Controls->Add(this->labelGPU); this->tabPage_Resolution->Controls->Add(this->groupBox_InternalRes); this->tabPage_Resolution->Controls->Add(this->groupBox_ScreenRes); - this->tabPage_Resolution->Location = System::Drawing::Point(4, 22); + this->tabPage_Resolution->Location = System::Drawing::Point(4, 29); + this->tabPage_Resolution->Margin = System::Windows::Forms::Padding(4); this->tabPage_Resolution->Name = L"tabPage_Resolution"; - this->tabPage_Resolution->Padding = System::Windows::Forms::Padding(3); - this->tabPage_Resolution->Size = System::Drawing::Size(286, 284); + this->tabPage_Resolution->Padding = System::Windows::Forms::Padding(4); + this->tabPage_Resolution->Size = System::Drawing::Size(433, 432); this->tabPage_Resolution->TabIndex = 0; this->tabPage_Resolution->Text = L"Resolution"; // @@ -413,11 +442,10 @@ namespace Launcher { this->labelGPU->AutoSize = true; this->labelGPU->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(80)), static_cast(static_cast(24)), static_cast(static_cast(24)), static_cast(static_cast(24))); - this->labelGPU->Location = System::Drawing::Point(8, 209); - this->labelGPU->Margin = System::Windows::Forms::Padding(2, 0, 2, 0); - this->labelGPU->MinimumSize = System::Drawing::Size(273, 13); + this->labelGPU->Location = System::Drawing::Point(12, 314); + this->labelGPU->MinimumSize = System::Drawing::Size(410, 20); this->labelGPU->Name = L"labelGPU"; - this->labelGPU->Size = System::Drawing::Size(273, 13); + this->labelGPU->Size = System::Drawing::Size(410, 20); this->labelGPU->TabIndex = 21; this->labelGPU->TextAlign = System::Drawing::ContentAlignment::MiddleLeft; // @@ -426,9 +454,11 @@ namespace Launcher { this->groupBox_InternalRes->Controls->Add(this->panel_IntRes); this->groupBox_InternalRes->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->groupBox_InternalRes->ForeColor = System::Drawing::Color::White; - this->groupBox_InternalRes->Location = System::Drawing::Point(5, 124); + this->groupBox_InternalRes->Location = System::Drawing::Point(8, 186); + this->groupBox_InternalRes->Margin = System::Windows::Forms::Padding(4); this->groupBox_InternalRes->Name = L"groupBox_InternalRes"; - this->groupBox_InternalRes->Size = System::Drawing::Size(278, 83); + this->groupBox_InternalRes->Padding = System::Windows::Forms::Padding(4); + this->groupBox_InternalRes->Size = System::Drawing::Size(417, 124); this->groupBox_InternalRes->TabIndex = 20; this->groupBox_InternalRes->TabStop = false; this->groupBox_InternalRes->Text = L"Internal Resolution"; @@ -436,9 +466,10 @@ namespace Launcher { // panel_IntRes // this->panel_IntRes->AutoScroll = true; - this->panel_IntRes->Location = System::Drawing::Point(4, 19); + this->panel_IntRes->Location = System::Drawing::Point(6, 28); + this->panel_IntRes->Margin = System::Windows::Forms::Padding(4); this->panel_IntRes->Name = L"panel_IntRes"; - this->panel_IntRes->Size = System::Drawing::Size(269, 59); + this->panel_IntRes->Size = System::Drawing::Size(404, 88); this->panel_IntRes->TabIndex = 1; // // tabPage_Patches @@ -446,9 +477,10 @@ namespace Launcher { this->tabPage_Patches->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(64)), static_cast(static_cast(64)), static_cast(static_cast(64))); this->tabPage_Patches->Controls->Add(this->panel_Patches); - this->tabPage_Patches->Location = System::Drawing::Point(4, 22); + this->tabPage_Patches->Location = System::Drawing::Point(4, 29); + this->tabPage_Patches->Margin = System::Windows::Forms::Padding(4); this->tabPage_Patches->Name = L"tabPage_Patches"; - this->tabPage_Patches->Size = System::Drawing::Size(286, 284); + this->tabPage_Patches->Size = System::Drawing::Size(433, 432); this->tabPage_Patches->TabIndex = 1; this->tabPage_Patches->Text = L"Options"; // @@ -456,8 +488,9 @@ namespace Launcher { // this->panel_Patches->AutoScroll = true; this->panel_Patches->Location = System::Drawing::Point(0, 0); + this->panel_Patches->Margin = System::Windows::Forms::Padding(4); this->panel_Patches->Name = L"panel_Patches"; - this->panel_Patches->Size = System::Drawing::Size(286, 283); + this->panel_Patches->Size = System::Drawing::Size(429, 424); this->panel_Patches->TabIndex = 9; // // tabPage_Playerdata @@ -465,9 +498,10 @@ namespace Launcher { this->tabPage_Playerdata->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(64)), static_cast(static_cast(64)), static_cast(static_cast(64))); this->tabPage_Playerdata->Controls->Add(this->panel_Playerdata); - this->tabPage_Playerdata->Location = System::Drawing::Point(4, 22); + this->tabPage_Playerdata->Location = System::Drawing::Point(4, 29); + this->tabPage_Playerdata->Margin = System::Windows::Forms::Padding(4); this->tabPage_Playerdata->Name = L"tabPage_Playerdata"; - this->tabPage_Playerdata->Size = System::Drawing::Size(286, 284); + this->tabPage_Playerdata->Size = System::Drawing::Size(433, 432); this->tabPage_Playerdata->TabIndex = 3; this->tabPage_Playerdata->Text = L"Player"; // @@ -475,8 +509,9 @@ namespace Launcher { // this->panel_Playerdata->AutoScroll = true; this->panel_Playerdata->Location = System::Drawing::Point(0, 0); + this->panel_Playerdata->Margin = System::Windows::Forms::Padding(4); this->panel_Playerdata->Name = L"panel_Playerdata"; - this->panel_Playerdata->Size = System::Drawing::Size(286, 283); + this->panel_Playerdata->Size = System::Drawing::Size(429, 424); this->panel_Playerdata->TabIndex = 1; // // tabPage_Components @@ -484,10 +519,11 @@ namespace Launcher { this->tabPage_Components->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(64)), static_cast(static_cast(64)), static_cast(static_cast(64))); this->tabPage_Components->Controls->Add(this->panel_Components); - this->tabPage_Components->Location = System::Drawing::Point(4, 22); + this->tabPage_Components->Location = System::Drawing::Point(4, 29); + this->tabPage_Components->Margin = System::Windows::Forms::Padding(4); this->tabPage_Components->Name = L"tabPage_Components"; - this->tabPage_Components->Padding = System::Windows::Forms::Padding(3); - this->tabPage_Components->Size = System::Drawing::Size(286, 284); + this->tabPage_Components->Padding = System::Windows::Forms::Padding(4); + this->tabPage_Components->Size = System::Drawing::Size(433, 432); this->tabPage_Components->TabIndex = 2; this->tabPage_Components->Text = L"Components"; // @@ -495,8 +531,9 @@ namespace Launcher { // this->panel_Components->AutoScroll = true; this->panel_Components->Location = System::Drawing::Point(0, 0); + this->panel_Components->Margin = System::Windows::Forms::Padding(4); this->panel_Components->Name = L"panel_Components"; - this->panel_Components->Size = System::Drawing::Size(286, 283); + this->panel_Components->Size = System::Drawing::Size(429, 424); this->panel_Components->TabIndex = 0; // // tabPage_Plugins @@ -504,10 +541,11 @@ namespace Launcher { this->tabPage_Plugins->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(64)), static_cast(static_cast(64)), static_cast(static_cast(64))); this->tabPage_Plugins->Controls->Add(this->panel_Plugins); - this->tabPage_Plugins->Location = System::Drawing::Point(4, 22); + this->tabPage_Plugins->Location = System::Drawing::Point(4, 29); + this->tabPage_Plugins->Margin = System::Windows::Forms::Padding(4); this->tabPage_Plugins->Name = L"tabPage_Plugins"; - this->tabPage_Plugins->Padding = System::Windows::Forms::Padding(3); - this->tabPage_Plugins->Size = System::Drawing::Size(286, 284); + this->tabPage_Plugins->Padding = System::Windows::Forms::Padding(4); + this->tabPage_Plugins->Size = System::Drawing::Size(433, 432); this->tabPage_Plugins->TabIndex = 3; this->tabPage_Plugins->Text = L"Plugins"; // @@ -515,10 +553,31 @@ namespace Launcher { // this->panel_Plugins->AutoScroll = true; this->panel_Plugins->Location = System::Drawing::Point(0, 0); + this->panel_Plugins->Margin = System::Windows::Forms::Padding(4); this->panel_Plugins->Name = L"panel_Plugins"; - this->panel_Plugins->Size = System::Drawing::Size(286, 283); + this->panel_Plugins->Size = System::Drawing::Size(429, 424); this->panel_Plugins->TabIndex = 0; // + // tabPage_Custom + // + this->tabPage_Custom->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(64)), static_cast(static_cast(64)), + static_cast(static_cast(64))); + this->tabPage_Custom->Controls->Add(this->panel_Custom); + this->tabPage_Custom->Location = System::Drawing::Point(4, 29); + this->tabPage_Custom->Name = L"tabPage_Custom"; + this->tabPage_Custom->Size = System::Drawing::Size(433, 432); + this->tabPage_Custom->TabIndex = 4; + this->tabPage_Custom->Text = L"Patches"; + // + // panel_Custom + // + this->panel_Custom->AutoScroll = true; + this->panel_Custom->Location = System::Drawing::Point(0, 0); + this->panel_Custom->Margin = System::Windows::Forms::Padding(4); + this->panel_Custom->Name = L"panel_Custom"; + this->panel_Custom->Size = System::Drawing::Size(429, 424); + this->panel_Custom->TabIndex = 1; + // // button_Discord // this->button_Discord->BackColor = System::Drawing::Color::Transparent; @@ -527,9 +586,10 @@ namespace Launcher { this->button_Discord->FlatAppearance->MouseOverBackColor = System::Drawing::Color::Transparent; this->button_Discord->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->button_Discord->Image = (cli::safe_cast(resources->GetObject(L"button_Discord.Image"))); - this->button_Discord->Location = System::Drawing::Point(225, 311); + this->button_Discord->Location = System::Drawing::Point(338, 466); + this->button_Discord->Margin = System::Windows::Forms::Padding(4); this->button_Discord->Name = L"button_Discord"; - this->button_Discord->Size = System::Drawing::Size(32, 32); + this->button_Discord->Size = System::Drawing::Size(48, 48); this->button_Discord->TabIndex = 31; this->button_Discord->UseVisualStyleBackColor = false; this->button_Discord->Click += gcnew System::EventHandler(this, &ui::button_Discord_Click); @@ -543,9 +603,10 @@ namespace Launcher { this->button_github->FlatAppearance->MouseOverBackColor = System::Drawing::Color::Transparent; this->button_github->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->button_github->Image = (cli::safe_cast(resources->GetObject(L"button_github.Image"))); - this->button_github->Location = System::Drawing::Point(262, 311); + this->button_github->Location = System::Drawing::Point(393, 466); + this->button_github->Margin = System::Windows::Forms::Padding(4); this->button_github->Name = L"button_github"; - this->button_github->Size = System::Drawing::Size(32, 32); + this->button_github->Size = System::Drawing::Size(48, 48); this->button_github->TabIndex = 32; this->button_github->UseVisualStyleBackColor = false; this->button_github->Click += gcnew System::EventHandler(this, &ui::button_github_Click); @@ -554,9 +615,10 @@ namespace Launcher { // this->button_Apply->FlatAppearance->BorderColor = System::Drawing::SystemColors::Control; this->button_Apply->FlatStyle = System::Windows::Forms::FlatStyle::Flat; - this->button_Apply->Location = System::Drawing::Point(150, 315); + this->button_Apply->Location = System::Drawing::Point(225, 472); + this->button_Apply->Margin = System::Windows::Forms::Padding(4); this->button_Apply->Name = L"button_Apply"; - this->button_Apply->Size = System::Drawing::Size(69, 23); + this->button_Apply->Size = System::Drawing::Size(104, 34); this->button_Apply->TabIndex = 33; this->button_Apply->Text = L"Apply"; this->button_Apply->Click += gcnew System::EventHandler(this, &ui::button_Apply_Click); @@ -564,14 +626,14 @@ namespace Launcher { // ui // this->AcceptButton = this->button_Launch; - this->AutoScaleDimensions = System::Drawing::SizeF(96, 96); + this->AutoScaleDimensions = System::Drawing::SizeF(144, 144); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Dpi; this->AutoSize = true; this->AutoSizeMode = System::Windows::Forms::AutoSizeMode::GrowAndShrink; this->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(64)), static_cast(static_cast(64)), static_cast(static_cast(64))); this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch; - this->ClientSize = System::Drawing::Size(293, 343); + this->ClientSize = System::Drawing::Size(440, 514); this->Controls->Add(this->button_Apply); this->Controls->Add(this->tabControl); this->Controls->Add(this->button_Help); @@ -583,6 +645,7 @@ namespace Launcher { this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; this->Icon = (cli::safe_cast(resources->GetObject(L"$this.Icon"))); this->KeyPreview = true; + this->Margin = System::Windows::Forms::Padding(4); this->MaximizeBox = false; this->MinimizeBox = false; this->Name = L"ui"; @@ -600,6 +663,7 @@ namespace Launcher { this->tabPage_Playerdata->ResumeLayout(false); this->tabPage_Components->ResumeLayout(false); this->tabPage_Plugins->ResumeLayout(false); + this->tabPage_Custom->ResumeLayout(false); this->ResumeLayout(false); } @@ -659,6 +723,16 @@ private: System::Void SaveSettings() { *(option->hasChanged) = false; } + + for (ConfigOptionBase* option : AllCustomOpts) + { + if (*(option->hasChanged)) + { + option->SaveOption(); + } + + *(option->hasChanged) = false; + } } private: System::Void Ui_Load(System::Object^ sender, System::EventArgs^ e){ } diff --git a/source-code/source/plugins/Patches/dllmain.cpp b/source-code/source/plugins/Patches/dllmain.cpp index 673ec48..0d6cb31 100644 --- a/source-code/source/plugins/Patches/dllmain.cpp +++ b/source-code/source/plugins/Patches/dllmain.cpp @@ -784,7 +784,8 @@ void ApplyPatches() { for (std::filesystem::path p : std::filesystem::directory_iterator("../patches")) { std::string extension = std::filesystem::path(p).extension().string(); - if (extension == ".p" || extension == ".P" || extension == ".p2" || extension == ".P2") + if ((extension == ".p" || extension == ".P" || extension == ".p2" || extension == ".P2") && + GetPrivateProfileIntW(L"plugins", std::filesystem::path(p).filename().c_str(), TRUE, CONFIG_FILE)) { std::cout << "[Patches] Reading custom patch file: " << std::filesystem::path(p).filename().string() << std::endl; ApplyCustomPatches(std::filesystem::path(p).wstring());