DXGL r842 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r841
|
r842
|
r843
>
Date:
20:40, 5 August 2018
Author:
admin
Status:
new
Tags:
Comment:
Add automatic installation of Wine DLL overrides when the installer runs under Wine.
Add descriptions for installer sections.
Modified paths:
/Installer/dxgl.nsi
(modified) (
history
)
/dxgl-nsis/dxgl-nsis.c
(modified) (
history
)
Diff
[
purge
]
Index: Installer/dxgl.nsi
—
—
@@ -215,6 +215,11 @@
216
216
ExecWait '"$INSTDIR\dxglcfg.exe" profile_install'
217
217
SectionEnd
218
218
219
+Section "Set Wine DLL Overrides" SEC_WINEDLLOVERRIDE
220
+ DetailPrint "Setting Wine DLL Overrides"
221
+ WriteRegStr HKCU "Software\Wine\DllOverrides" "ddraw" "native,builtin"
222
+SectionEnd
223
+
219
224
Section "Fix DDraw COM registration" SEC_COMFIX
220
225
DetailPrint "Setting DDraw Runtime path in registry"
221
226
${If} ${RunningX64}
—
—
@@ -338,9 +343,26 @@
339
344
BelowEight:
340
345
SectionSetFlags ${SEC_COMFIX} 0
341
346
VersionFinish:
347
+ dxgl-nsis::IsWine $0
348
+ Pop $0
349
+ ${If} $0 == "0"
350
+ SectionSetFlags ${SEC_WINEDLLOVERRIDE} 0
351
+ SectionSetText ${SEC_WINEDLLOVERRIDE} ""
352
+ ${EndIf}
342
353
FunctionEnd
343
354
355
+LangString DESC_SEC01 ${LANG_ENGLISH} "Installs the required components for DXGL."
356
+LangString DESC_SEC_VCREDIST ${LANG_ENGLISH} "The Visual C++ Redistributable package required for this version of DXGL was not detected. Selecting this will download a copy of the redistributable hosted on dxgl.info and install it."
357
+LangString DESC_SEC_WINEDLLOVERRIDE ${LANG_ENGLISH} "Sets a DLL override in Wine to allow DXGL to be used."
358
+LangString DESC_SEC_COMFIX ${LANG_ENGLISH} "Adjusts the COM registration of ddraw.dll to allow DXGL to be used from a game's folder. This option only applies to the user profile being used to install DXGL. Use for Windows 8 and above."
344
359
360
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
361
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC01)
362
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_VCREDIST} $(DESC_SEC_VCREDIST)
363
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_WINEDLLOVERRIDE} $(DESC_SEC_WINEDLLOVERRIDE)
364
+!insertmacro MUI_DESCRIPTION_TEXT ${SEC_COMFIX} $(DESC_SEC_COMFIX)
365
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
366
+
345
367
Function un.onUninstSuccess
346
368
HideWindow
347
369
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
Index: dxgl-nsis/dxgl-nsis.c
—
—
@@ -79,7 +79,7 @@
80
80
{
81
81
filename[0] = '1';
82
82
}
83
- filename[1] = 0;
83
+ filename[1] = filename[2] = filename[3] = 0;
84
84
pushstring(comp);
85
85
pushstring(filename);
86
86
}
—
—
@@ -95,10 +95,33 @@
96
96
__cpuid(cpuid, 1);
97
97
if ((cpuid[3] >> 26) & 1) out[0] = '1';
98
98
else out[0] = '0';
99
- out[1] = 0;
99
+ out[1] = out[2] = out[3] = 0;
100
100
pushstring(out);
101
101
}
102
102
103
+void __declspec(dllexport) IsWine(HWND hwndParent, int string_size,
104
+ TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
105
+{
106
+ HMODULE ntdll;
107
+ char* (__cdecl *wine_get_version)();
108
+ char out[256];
109
+ EXDLL_INIT();
110
+ ntdll = LoadLibraryA("ntdll.dll");
111
+ if (!ntdll)
112
+ {
113
+ out[0] = '0';
114
+ out[1] = out[2] = out[3] = 0;
115
+ pushstring(out);
116
+ return;
117
+ }
118
+ wine_get_version = (char*(__cdecl*)())GetProcAddress(ntdll, "wine_get_version");
119
+ if (wine_get_version) out[0] = '1';
120
+ else out[0] = '0';
121
+ FreeLibrary(ntdll);
122
+ out[1] = out[2] = out[3] = 0;
123
+ pushstring(out);
124
+}
125
+
103
126
// Quick and dirty memcpy
104
127
void *memcpy(unsigned char *dest, unsigned char *src, size_t size)
105
128
{
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version