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 24, 2023
1 parent 12817d6 commit 344f870
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ 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
Expand Down
29 changes: 29 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,35 @@ 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

Expand Down
34 changes: 31 additions & 3 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,9 @@ 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))
// GetFileAttributes functions are not kept because of degraded loading times in some games
// Plugins can still use them via exports
if (!sFileLoaderPath.empty() && (i == eCreateFileA || i == eCreateFileW))
continue;

if (Kernel32Data[i][IATPtr] && Kernel32Data[i][ProcAddress])
Expand Down Expand Up @@ -725,6 +727,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 Down Expand Up @@ -939,6 +953,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 +1097,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 344f870

Please sign in to comment.