mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-27 23:45:21 +01:00
disable GameUX on windows 7
This commit is contained in:
parent
43fd64463b
commit
f3c57b477e
@ -1127,6 +1127,12 @@ void TConfigForm::SaveSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __fastcall TConfigForm::FormActivate(TObject *Sender)
|
void __fastcall TConfigForm::FormActivate(TObject *Sender)
|
||||||
|
{
|
||||||
|
DisableGameUX();
|
||||||
|
AddDllOverride();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TConfigForm::AddDllOverride()
|
||||||
{
|
{
|
||||||
/* Detect wine (Linux/macOS) and create the needed dll override */
|
/* Detect wine (Linux/macOS) and create the needed dll override */
|
||||||
if (!GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version"))
|
if (!GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version"))
|
||||||
@ -1166,6 +1172,47 @@ void __fastcall TConfigForm::FormActivate(TObject *Sender)
|
|||||||
reg->Free();
|
reg->Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TConfigForm::DisableGameUX()
|
||||||
|
{
|
||||||
|
/* Prevent bug where some games don't start properly and run in the background */
|
||||||
|
if (!(TOSVersion::Major == 6 && TOSVersion::Minor == 1))
|
||||||
|
return;
|
||||||
|
|
||||||
|
TRegistry* reg = new TRegistry(KEY_READ);
|
||||||
|
reg->RootKey = HKEY_CLASSES_ROOT;
|
||||||
|
|
||||||
|
if (reg->OpenKey(
|
||||||
|
"Local Settings\\Software\\Microsoft\\Windows\\GameUX\\ServiceLocation\\",
|
||||||
|
false)) {
|
||||||
|
|
||||||
|
if (reg->ValueExists("Games") &&
|
||||||
|
reg->ReadString("Games") != "127.0.0.1" &&
|
||||||
|
LowerCase(reg->ReadString("Games")) != "localhost") {
|
||||||
|
|
||||||
|
reg->CloseKey();
|
||||||
|
|
||||||
|
reg->Access = KEY_WRITE;
|
||||||
|
|
||||||
|
if (reg->OpenKey(
|
||||||
|
"Local Settings\\Software\\Microsoft\\Windows\\GameUX\\ServiceLocation\\",
|
||||||
|
false)) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
reg->WriteString("Games", "127.0.0.1");
|
||||||
|
} catch (...) {
|
||||||
|
/* maybe restart with admin rights here? */
|
||||||
|
}
|
||||||
|
|
||||||
|
reg->CloseKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
reg->CloseKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
reg->Free();
|
||||||
|
}
|
||||||
|
|
||||||
void __fastcall TConfigForm::HotkeyEdtKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
void __fastcall TConfigForm::HotkeyEdtKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||||
{
|
{
|
||||||
TEdit *edit = static_cast<TEdit*>(Sender);
|
TEdit *edit = static_cast<TEdit*>(Sender);
|
||||||
|
@ -121,6 +121,8 @@ private: // Benutzer-Deklarationen
|
|||||||
void ApplyTranslation(TIniFile *ini);
|
void ApplyTranslation(TIniFile *ini);
|
||||||
System::UnicodeString GetKeyText(WORD key);
|
System::UnicodeString GetKeyText(WORD key);
|
||||||
WORD GetKeyCode(System::UnicodeString key);
|
WORD GetKeyCode(System::UnicodeString key);
|
||||||
|
void DisableGameUX();
|
||||||
|
void AddDllOverride();
|
||||||
public: // Benutzer-Deklarationen
|
public: // Benutzer-Deklarationen
|
||||||
__fastcall TConfigForm(TComponent* Owner);
|
__fastcall TConfigForm(TComponent* Owner);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user