mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
ddraw.dll for III/VC to fix 640x480x16 not being found
This commit is contained in:
parent
7d4d231fd5
commit
249201627c
6 changed files with 219 additions and 0 deletions
3
ResSock/ResSock.def
Normal file
3
ResSock/ResSock.def
Normal file
|
@ -0,0 +1,3 @@
|
|||
LIBRARY DDRAW
|
||||
EXPORTS
|
||||
DirectDrawCreateEx=_DirectDrawCreateEx@16
|
73
ResSock/ResSock.vcxproj
Normal file
73
ResSock/ResSock.vcxproj
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B695EC1B-7258-426A-81CF-9323C016ACFB}</ProjectGuid>
|
||||
<RootNamespace>ResSock</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>ddraw</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>..\SilentPatch;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<MinimumRequiredVersion>5.0</MinimumRequiredVersion>
|
||||
<EntryPointSymbol>DllMain@12</EntryPointSymbol>
|
||||
<AdditionalDependencies>ntdllp.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>ResSock.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto Vice City\ddraw.dll"
|
||||
copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto 3\ddraw.dll"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SilentPatch\MemoryMgr.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
27
ResSock/ResSock.vcxproj.filters
Normal file
27
ResSock/ResSock.vcxproj.filters
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SilentPatch\MemoryMgr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
111
ResSock/dllmain.cpp
Normal file
111
ResSock/dllmain.cpp
Normal file
|
@ -0,0 +1,111 @@
|
|||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <Shlwapi.h>
|
||||
#include "MemoryMgr.h"
|
||||
|
||||
extern "C" HRESULT WINAPI DirectDrawCreateEx(GUID FAR *lpGUID, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter)
|
||||
{
|
||||
static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID FAR*, LPVOID*, REFIID, IUnknown FAR*);
|
||||
static bool bLoaded = false;
|
||||
if ( !bLoaded )
|
||||
{
|
||||
wchar_t wcSystemPath[MAX_PATH];
|
||||
GetSystemDirectoryW(wcSystemPath, MAX_PATH);
|
||||
PathAppendW(wcSystemPath, L"ddraw.dll");
|
||||
|
||||
HMODULE hLib = LoadLibraryW(wcSystemPath);
|
||||
pDirectDrawCreateEx = (HRESULT(WINAPI*)(GUID FAR*, LPVOID*, REFIID, IUnknown FAR*))GetProcAddress(hLib, "DirectDrawCreateEx");
|
||||
|
||||
bLoaded = true;
|
||||
}
|
||||
return pDirectDrawCreateEx(lpGUID, lplpDD, iid, pUnkOuter);
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hinstDLL);
|
||||
UNREFERENCED_PARAMETER(lpvReserved);
|
||||
|
||||
if ( fdwReason == DLL_PROCESS_ATTACH )
|
||||
{
|
||||
static char aNoDesktopMode[64];
|
||||
using namespace MemoryVP;
|
||||
|
||||
if (*(DWORD*)0x5C1E70 == 0x53E58955)
|
||||
{
|
||||
// III 1.0
|
||||
RECT desktop;
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
Patch<DWORD>(0x581E5E, desktop.right);
|
||||
Patch<DWORD>(0x581E68, desktop.bottom);
|
||||
Patch<BYTE>(0x581E72, 32);
|
||||
Patch<const char*>(0x581EA8, aNoDesktopMode);
|
||||
}
|
||||
else if (*(DWORD*)0x5C2130 == 0x53E58955)
|
||||
{
|
||||
// III 1.1
|
||||
RECT desktop;
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
Patch<DWORD>(0x58219E, desktop.right);
|
||||
Patch<DWORD>(0x5821A8, desktop.bottom);
|
||||
Patch<BYTE>(0x5821B2, 32);
|
||||
Patch<const char*>(0x5821E8, aNoDesktopMode);
|
||||
}
|
||||
else if (*(DWORD*)0x5C6FD0 == 0x53E58955)
|
||||
{
|
||||
// III Steam
|
||||
RECT desktop;
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
Patch<DWORD>(0x58208E, desktop.right);
|
||||
Patch<DWORD>(0x582098, desktop.bottom);
|
||||
Patch<BYTE>(0x5820A2, 32);
|
||||
Patch<const char*>(0x5820D8, aNoDesktopMode);
|
||||
}
|
||||
else if (*(DWORD*)0x667BF0 == 0x53E58955)
|
||||
{
|
||||
// VC 1.0
|
||||
RECT desktop;
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
Patch<DWORD>(0x600E7E, desktop.right);
|
||||
Patch<DWORD>(0x600E88, desktop.bottom);
|
||||
Patch<BYTE>(0x600E92, 32);
|
||||
Patch<const char*>(0x600EC8, aNoDesktopMode);
|
||||
}
|
||||
else if (*(DWORD*)0x667C40 == 0x53E58955)
|
||||
{
|
||||
// VC 1.1
|
||||
RECT desktop;
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
Patch<DWORD>(0x600E9E, desktop.right);
|
||||
Patch<DWORD>(0x600EA8, desktop.bottom);
|
||||
Patch<BYTE>(0x600EB2, 32);
|
||||
Patch<const char*>(0x600EE8, aNoDesktopMode);
|
||||
}
|
||||
else if (*(DWORD*)0x666BA0 == 0x53E58955)
|
||||
{
|
||||
// VC Steam
|
||||
RECT desktop;
|
||||
GetWindowRect(GetDesktopWindow(), &desktop);
|
||||
sprintf(aNoDesktopMode, "Cannot find %dx%dx32 video mode", desktop.right, desktop.bottom);
|
||||
|
||||
Patch<DWORD>(0x600ADE, desktop.right);
|
||||
Patch<DWORD>(0x600AE8, desktop.bottom);
|
||||
Patch<BYTE>(0x600AF2, 32);
|
||||
Patch<const char*>(0x600B28, aNoDesktopMode);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
BIN
ResSock/ntdllp.lib
Normal file
BIN
ResSock/ntdllp.lib
Normal file
Binary file not shown.
|
@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCFix", "VCFix\VCFix.vcxpro
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SAFix", "SAFix\SAFix.vcxproj", "{D3E18BC0-A120-451D-A16A-F77072625D66}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResSock", "ResSock\ResSock.vcxproj", "{B695EC1B-7258-426A-81CF-9323C016ACFB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -25,6 +27,9 @@ Global
|
|||
{D3E18BC0-A120-451D-A16A-F77072625D66}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D3E18BC0-A120-451D-A16A-F77072625D66}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D3E18BC0-A120-451D-A16A-F77072625D66}.Release|Win32.Build.0 = Release|Win32
|
||||
{B695EC1B-7258-426A-81CF-9323C016ACFB}.Debug|Win32.ActiveCfg = Release|Win32
|
||||
{B695EC1B-7258-426A-81CF-9323C016ACFB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B695EC1B-7258-426A-81CF-9323C016ACFB}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Loading…
Reference in a new issue