Skip to content

Commit

Permalink
additional hooks, appveyor and readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 25, 2023
1 parent 58bb234 commit 671a23e
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 39 deletions.
47 changes: 29 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
version: 5.{build}
branches:
only:
- master
version: 6.{build}
skip_tags: true
image: Visual Studio 2022
configuration: Release
Expand All @@ -22,25 +19,39 @@ artifacts:
name: Ultimate-ASI-Loader.zip
- path: bin\Ultimate-ASI-Loader_x64.zip
name: Ultimate-ASI-Loader_x64.zip
- path: bin\RE7Demo.InfiniteAmmo.zip
name: RE7Demo.InfiniteAmmo.zip
- path: bin\MessageBox_x64.zip
name: MessageBox_x64.zip
- path: bin\OverloadFromFolderDLL_x64.zip
name: OverloadFromFolderDLL_x64.zip
- path: bin\ExeUnprotect.zip
name: ExeUnprotect.zip
- path: bin\MessageBox.zip
name: MessageBox.zip
- path: bin\OverloadFromFolderDLL.zip
name: OverloadFromFolderDLL.zip
- path: bin\RE7Demo.InfiniteAmmo-x64.zip
name: RE7Demo.InfiniteAmmo-x64.zip
- path: bin\MessageBox-x64.zip
name: MessageBox-x64.zip
- path: bin\OverloadFromFolderDLL-x64.zip
name: OverloadFromFolderDLL-x64.zip
- path: bin\ExeUnprotect-Win32.zip
name: ExeUnprotect-Win32.zip
- path: bin\MessageBox-Win32.zip
name: MessageBox-Win32.zip
- path: bin\OverloadFromFolderDLL-Win32.zip
name: OverloadFromFolderDLL-Win32.zip
- path: bin\MonoLoader-Win32.zip
name: MonoLoader-Win32.zip
- path: bin\MonoLoader-x64.zip
name: MonoLoader-x64.zip
deploy:
- provider: GitHub
tag: v$(appveyor_build_version)
release: Ultimate ASI Loader v$(appveyor_build_version)
description: DESCRIPTION\n------------------------\nThis is a DLL file which adds ASI plugin loading functionality to any game, which uses any of the following libraries:\n* d3d8.dll\n* d3d9.dll\n* d3d11.dll\n* ddraw.dll\n* dinput.dll\n* dinput8.dll (x86 and x64)\n* dsound.dll (x86 and x64)\n* msacm32.dll\n* msvfw32.dll\n* version.dll (x86 and x64)\n* vorbisFile.dll\n* wininet.dll (x86 and x64)\n* winmm.dll (x86 and x64)\n* xlive.dll\n\n\nINSTALLATION\n------------------------\nIn order to install it, you just need to place DLL into game directory. Usually it works as dinput8.dll, but if it's not, there is a possibility to rename it(see the list of supported names above).
description: DESCRIPTION\n------------------------\nThis is a DLL file which adds ASI plugin loading functionality to any game, which uses any of the following libraries:\n* d3d8.dll\n* d3d9.dll\n* d3d11.dll\n* ddraw.dll\n* dinput.dll\n* dinput8.dll (x86 and x64)\n* dsound.dll (x86 and x64)\n* msacm32.dll\n* msvfw32.dll\n* version.dll (x86 and x64)\n* vorbisFile.dll\n* wininet.dll (x86 and x64)\n* winmm.dll (x86 and x64)\n* winhttp.dll (x86 and x64)\n* xlive.dll\n\n\nINSTALLATION\n------------------------\nIn order to install it, you just need to place DLL into game directory. Usually it works as dinput8.dll, but if it's not, there is a possibility to rename it(see the list of supported names above).
auth_token:
secure: ugbti+bXX/7zqu39OyiPxgRPd2pQn2FEV/12ABees2fHfpZob0tWXzqD/zSYmibJ
artifact: Ultimate-ASI-Loader.zip, Ultimate-ASI-Loader_x64.zip
on:
branch: master
branch: master
- provider: GitHub
tag: demo-plugins
release: Ultimate ASI Loader Demo Plugins
description: Demo plugins to test or extend Ultimate ASI Loader's functionality.
auth_token:
secure: ugbti+bXX/7zqu39OyiPxgRPd2pQn2FEV/12ABees2fHfpZob0tWXzqD/zSYmibJ
artifact: RE7Demo.InfiniteAmmo-x64.zip, MessageBox-x64.zip, OverloadFromFolderDLL-x64.zip, ExeUnprotect-Win32.zip, MessageBox-Win32.zip, OverloadFromFolderDLL-Win32.zip, MonoLoader-Win32.zip, MonoLoader-x64.zip
force_update: true
on:
branch: /^(master|monoloader)$/
45 changes: 38 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@

This is a DLL file which adds ASI plugin loading functionality to any game, which uses any of the following libraries:

- [d3d8.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/d3d8-Win32.zip)
- [d3d8.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/d3d8-Win32.zip) (x86)
- d3d9.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/d3d9-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/d3d9-x64.zip))
- d3d10.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/d3d10-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/d3d10-x64.zip))
- d3d11.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/d3d11-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/d3d11-x64.zip))
- d3d12.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/d3d12-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/d3d12-x64.zip))
- [ddraw.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/ddraw-Win32.zip)
- [dinput.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/dinput-Win32.zip)
- [ddraw.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/ddraw-Win32.zip) (x86)
- [dinput.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/dinput-Win32.zip) (x86)
- dinput8.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/dinput8-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/dinput8-x64.zip))
- dsound.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/dsound-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/dsound-x64.zip))
- [msacm32.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/msacm32-Win32.zip)
- [msvfw32.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/msvfw32-Win32.zip)
- [msacm32.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/msacm32-Win32.zip) (x86)
- [msvfw32.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/msvfw32-Win32.zip) (x86)
- version.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/version-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/version-x64.zip))
- wininet.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/wininet-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/wininet-x64.zip))
- winmm.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/winmm-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/winmm-x64.zip))
- [xlive.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/xlive-Win32.zip)
- winhttp.dll ([x86](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/winhttp-Win32.zip) and [x64](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/winhttp-x64.zip))
- [xlive.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/xlive-Win32.zip) (x86)
- [binkw32.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/binkw32-Win32.zip) (rename original to binkw32Hooked.dll, optional)
- [bink2w64.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/x64-latest/bink2w64-x64.zip) (rename original to bink2w64Hooked.dll)
- [vorbisFile.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/vorbisFile-Win32.zip) (rename original to vorbisHooked.dll, optional)
- [binkw32.dll](https://github.com/ThirteenAG/Ultimate-ASI-Loader/releases/download/Win32-latest/binkw32-Win32.zip) (rename original to binkw32Hooked.dll, optional)

With the last two, it is possible to load the original dll by renaming it to 'vorbisHooked.dll' or 'binkw32Hooked.dll'.
Usually it is not required and you can simply replace the dll. Always make a backup before replacing any files.
Expand All @@ -39,6 +40,36 @@ Put ASI files in game root directory, 'scripts' or 'plugins' folder.
If configuration is necessary, global.ini file can be placed to 'scripts' or 'plugins' folder. It can be used alongside the chosen dll and if so, it is also possible to use dll name for ini file, e.g. version.dll/version.ini.
[See example of global.ini here](https://github.com/ThirteenAG/Ultimate-ASI-Loader/blob/master/data/scripts/global.ini).

## UPDATE FOLDER (Overload From Folder)

It is possible to install mods that replace files via the `update` folder, allowing you to avoid actual file replacement.

For example, if a mod replaces the file located at:

```
Resident Evil 5\nativePC_MT\Image\Archive\ChapterEnd11.arc
```

With Ultimate ASI Loader installed, you can create an `update` folder and place the file at:

```
Resident Evil 5\update\nativePC_MT\Image\Archive\ChapterEnd11.arc
```

To revert the game to its initial state, simply remove the `update` folder.

Please note that the `update` folder is relative to the location of the ASI loader, so you need to adjust paths accordingly. For example:

```
\Gameface\Content\Movies\1080\GTA_SA_CREDITS_FINAL_1920x1080.mp4
```

Should be adjusted to:

```
\Gameface\Binaries\Win64\update\Content\Movies\1080\GTA_SA_CREDITS_FINAL_1920x1080.mp4
```

## ADDITIONAL WINDOWED MODE FEATURE

ASI loader have built-in wndmode.dll, which can be loaded, if you create empty wndmode.ini in the folder with asi loader's dll. It will be automatically filled with example configuration at the first run of the game. Settings are not universal and should be changed in every specific case, but usually it works as is.
Expand Down
2 changes: 1 addition & 1 deletion release-Win32.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set list=d3d8, d3d9, d3d10, d3d11, d3d12, ddraw, dinput, dinput8, dsound, msacm32, msvfw32, version, wininet, winmm, xlive, vorbisFile, binkw32
set list=d3d8, d3d9, d3d10, d3d11, d3d12, ddraw, dinput, dinput8, dsound, msacm32, msvfw32, version, wininet, winmm, winhttp, xlive, vorbisFile, binkw32
mkdir dist\Win32
cd .\bin\Win32\Release
(for %%a in (%list%) do (
Expand Down
2 changes: 1 addition & 1 deletion release-x64.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set list=d3d9, d3d10, d3d11, d3d12, dinput8, dsound, version, wininet, winmm, bink2w64
set list=d3d9, d3d10, d3d11, d3d12, dinput8, dsound, version, wininet, winmm, winhttp, bink2w64
mkdir dist\x64
cd bin\x64\Release\
(for %%a in (%list%) do (
Expand Down
12 changes: 6 additions & 6 deletions release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
7za a -tzip ".\bin\Ultimate-ASI-Loader_x64.zip" ".\bin\x64\Release\dinput8.dll"

type nul >"bin\place both files in RESIDENT EVIL 7 biohazard Demo folder"
7za a -tzip ".\bin\RE7Demo.InfiniteAmmo.zip" ".\bin\x64\Release\dinput8.dll" ".\bin\x64\Release\scripts\RE7Demo.InfiniteAmmo.asi" ".\bin\place both files in RESIDENT EVIL 7 biohazard Demo folder"
7za a -tzip ".\bin\MessageBox_x64.zip" ".\bin\x64\Release\scripts\MessageBox_x64.asi"
7za a -tzip ".\bin\OverloadFromFolderDLL_x64.zip" ".\bin\x64\Release\scripts\OverloadFromFolderDLL_x64.asi"
7za a -tzip ".\bin\ExeUnprotect.zip" ".\bin\Win32\Release\scripts\ExeUnprotect.asi"
7za a -tzip ".\bin\MessageBox.zip" ".\bin\Win32\Release\scripts\MessageBox.asi"
7za a -tzip ".\bin\OverloadFromFolderDLL.zip" ".\bin\Win32\Release\scripts\OverloadFromFolderDLL.asi"
7za a -tzip ".\bin\ExeUnprotect-Win32.zip" ".\bin\Win32\Release\scripts\ExeUnprotect.asi"
7za a -tzip ".\bin\RE7Demo.InfiniteAmmo-x64.zip" ".\bin\x64\Release\dinput8.dll" ".\bin\x64\Release\scripts\RE7Demo.InfiniteAmmo.asi" ".\bin\place both files in RESIDENT EVIL 7 biohazard Demo folder"
7za a -tzip ".\bin\MessageBox-Win32.zip" ".\bin\Win32\Release\scripts\MessageBox.asi"
7za a -tzip ".\bin\MessageBox-x64.zip" ".\bin\x64\Release\scripts\MessageBox_x64.asi"
7za a -tzip ".\bin\OverloadFromFolderDLL-x64.zip" ".\bin\x64\Release\scripts\OverloadFromFolderDLL_x64.asi"
7za a -tzip ".\bin\OverloadFromFolderDLL-Win32.zip" ".\bin\Win32\Release\scripts\OverloadFromFolderDLL.asi"
EXIT

7-Zip Extra
Expand Down
4 changes: 2 additions & 2 deletions release.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$aliases_array_Win32 = "d3d8", "d3d9", "d3d10", "d3d11", "d3d12", "dinput8", "ddraw", "dinput", "dsound", "msacm32", "msvfw32", "version", "wininet", "winmm", "xlive", "vorbisFile", "binkw32"
$aliases_array_x64 = "d3d9", "d3d10", "d3d11", "d3d12", "dinput8", "dsound", "version", "wininet", "winmm", "bink2w64"
$aliases_array_Win32 = "d3d8", "d3d9", "d3d10", "d3d11", "d3d12", "dinput8", "ddraw", "dinput", "dsound", "msacm32", "msvfw32", "version", "wininet", "winmm", "winhttp", "xlive", "vorbisFile", "binkw32"
$aliases_array_x64 = "d3d9", "d3d10", "d3d11", "d3d12", "dinput8", "dsound", "version", "wininet", "winmm", "winhttp", "bink2w64"
$platform_array = "Win32", "x64"
$hash_alrg = "SHA512"

Expand Down
35 changes: 31 additions & 4 deletions source/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ enum Kernel32ExportsNames
eSleep,
eGetSystemTimeAsFileTime,
eGetCurrentProcessId,
eGetCommandLineA,
eGetCommandLineW,
eCreateFileA,
eCreateFileW,
eGetFileAttributesA,
Expand Down Expand Up @@ -597,9 +599,8 @@ void LoadPluginsAndRestoreIAT(uintptr_t retaddr)

for (size_t i = 0; i < Kernel32ExportsNamesCount; i++)
{
if (!sFileLoaderPath.empty() &&
(i == eCreateFileA || i == eCreateFileW || i == eGetFileAttributesA ||
i == eGetFileAttributesW || i == eGetFileAttributesExA || i == eGetFileAttributesExW))
if (!sFileLoaderPath.empty() && (i == eCreateFileA || i == eCreateFileW
|| i == eGetFileAttributesA || i == eGetFileAttributesW || i == eGetFileAttributesExA || i == eGetFileAttributesExW))
continue;

if (Kernel32Data[i][IATPtr] && Kernel32Data[i][ProcAddress])
Expand Down Expand Up @@ -725,6 +726,18 @@ DWORD WINAPI CustomGetCurrentProcessId()
return GetCurrentProcessId();
}

LPSTR WINAPI CustomGetCommandLineA()
{
LoadPluginsAndRestoreIAT((uintptr_t)_ReturnAddress());
return GetCommandLineA();
}

LPWSTR WINAPI CustomGetCommandLineW()
{
LoadPluginsAndRestoreIAT((uintptr_t)_ReturnAddress());
return GetCommandLineW();
}

std::filesystem::path GetFileName(auto lpFilename)
{
std::error_code ec;
Expand All @@ -741,7 +754,7 @@ std::filesystem::path GetFileName(auto lpFilename)

auto filePath = std::filesystem::path(lpFilename);
auto absolutePath = std::filesystem::absolute(filePath, ec);
auto relativePath = std::filesystem::weakly_canonical(absolutePath, ec).lexically_relative(gamePath);
auto relativePath = std::filesystem::canonical(absolutePath, ec).lexically_relative(gamePath);
auto commonPath = gamePath;

if (starts_with(relativePath, ".."))
Expand Down Expand Up @@ -939,6 +952,8 @@ bool HookKernel32IAT(HMODULE mod, bool exe)
Kernel32Data[eSleep][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "Sleep");
Kernel32Data[eGetSystemTimeAsFileTime][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "GetSystemTimeAsFileTime");
Kernel32Data[eGetCurrentProcessId][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "GetCurrentProcessId");
Kernel32Data[eGetCommandLineA][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "GetCommandLineA");
Kernel32Data[eGetCommandLineW][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "GetCommandLineW");
Kernel32Data[eCreateFileA][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "CreateFileA");
Kernel32Data[eCreateFileW][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "CreateFileW");
Kernel32Data[eGetFileAttributesA][ProcAddress] = (size_t)GetProcAddress(GetModuleHandle(TEXT("KERNEL32.DLL")), "GetFileAttributesA");
Expand Down Expand Up @@ -1081,6 +1096,18 @@ bool HookKernel32IAT(HMODULE mod, bool exe)
*(size_t*)i = (size_t)CustomGetCurrentProcessId;
matchedImports++;
}
else if (ptr == Kernel32Data[eGetCommandLineA][ProcAddress])
{
if (exe) Kernel32Data[eGetCommandLineA][IATPtr] = i;
*(size_t*)i = (size_t)CustomGetCommandLineA;
matchedImports++;
}
else if (ptr == Kernel32Data[eGetCommandLineW][ProcAddress])
{
if (exe) Kernel32Data[eGetCommandLineW][IATPtr] = i;
*(size_t*)i = (size_t)CustomGetCommandLineW;
matchedImports++;
}
else if (ptr == Kernel32Data[eCreateFileA][ProcAddress])
{
if (exe) Kernel32Data[eCreateFileA][IATPtr] = i;
Expand Down

0 comments on commit 671a23e

Please sign in to comment.