mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
add dll override
This commit is contained in:
parent
9238a3e874
commit
9974d70a5e
@ -7,6 +7,7 @@
|
||||
#include <StrUtils.hpp>
|
||||
#include <IOUtils.hpp>
|
||||
#include <SysUtils.hpp>
|
||||
#include <Registry.hpp>
|
||||
#include "ConfigFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
@ -856,6 +857,46 @@ void TConfigForm::SaveSettings()
|
||||
delete ini;
|
||||
}
|
||||
|
||||
|
||||
void __fastcall TConfigForm::FormActivate(TObject *Sender)
|
||||
{
|
||||
if (!GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version"))
|
||||
return;
|
||||
|
||||
TRegistry* reg = new TRegistry(KEY_READ);
|
||||
reg->RootKey = HKEY_CURRENT_USER;
|
||||
|
||||
if(reg->OpenKey("Software\\Wine\\DllOverrides\\", true)) {
|
||||
|
||||
if (!reg->ValueExists("ddraw")) {
|
||||
|
||||
reg->CloseKey();
|
||||
|
||||
if (Application->MessageBox(
|
||||
L"cnc-ddraw requires a dll override in winecfg, "
|
||||
"would you like to add it now?",
|
||||
L"cnc-ddraw",
|
||||
MB_YESNO) == IDNO) {
|
||||
|
||||
reg->Free();
|
||||
return;
|
||||
}
|
||||
|
||||
reg->Access = KEY_WRITE;
|
||||
|
||||
if (reg->OpenKey("Software\\Wine\\DllOverrides\\", true)) {
|
||||
|
||||
reg->WriteString("ddraw", "native,builtin");
|
||||
reg->CloseKey();
|
||||
}
|
||||
}
|
||||
else
|
||||
reg->CloseKey();
|
||||
}
|
||||
|
||||
reg->Free();
|
||||
}
|
||||
|
||||
bool TConfigForm::GetBool(TIniFile *ini, System::UnicodeString key, bool defValue)
|
||||
{
|
||||
auto s = LowerCase(ini->ReadString("ddraw", key, defValue ? "true" : "false"));
|
||||
@ -954,3 +995,5 @@ void __fastcall TConfigForm::PboxPaint(TObject *Sender)
|
||||
//pbox->Canvas->Rectangle(pbox->ClientRect);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -2678,6 +2678,7 @@ object ConfigForm: TConfigForm
|
||||
BBBF4CD8CBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCBB88CCB
|
||||
B88CB18EFF1FA2974C1C31AF16A40000000049454E44AE426082}
|
||||
Position = poDesktopCenter
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
TextHeight = 13
|
||||
object AdvancedPnl: TPanel
|
||||
|
@ -85,6 +85,7 @@ __published: // Von der IDE verwaltete Komponenten
|
||||
void __fastcall NonexclusiveChkClick(TObject *Sender);
|
||||
void __fastcall PboxPaint(TObject *Sender);
|
||||
void __fastcall LanguageImgClick(TObject *Sender);
|
||||
void __fastcall FormActivate(TObject *Sender);
|
||||
private: // Benutzer-Deklarationen
|
||||
void SaveSettings();
|
||||
bool GetBool(TIniFile *ini, System::UnicodeString key, bool defValue);
|
||||
|
Loading…
x
Reference in New Issue
Block a user