ThirteenAG / Ultimate-ASI-Loader

ASI Loader is the tool that loads custom libraries with the file extension .asi into any game process.
MIT License
1.16k stars 103 forks source link

[GTA VC] [GTA III] Ultimate ASI Loader doesn't work on wine #12

Closed xnqs closed 7 years ago

xnqs commented 7 years ago

Title says all. I tried renaming dinput8 into xlive, ddraw, d3d9 etc.

ThirteenAG commented 7 years ago

https://github.com/ThirteenAG/WidescreenFixesPack/issues/207

dw5 commented 7 years ago

should be mentioned like on site, so no need for this in future :pager:

ThirteenAG commented 7 years ago

I'm not sure how to phrase it since I never used that myself, so feel free to pull request updated readme if you want.

keybreak commented 4 years ago

@ThirteenAG Problem is - it still doesn't work in Wine, just tested with GTA III on Wine 5.7-staging under Manjaro Linux...

For me overrides of d3d9 / d3d8 / dinput8 haven't helped (game just doesn't start or start with black screen) like with case for Gun in this issue above.

Is there anything that can be done?

ThirteenAG commented 4 years ago

I have no idea, I never used wine.

keybreak commented 4 years ago

Well, i know...

Although, regardless of your own preferences for OS - i think you should give it a go, at least for fun if anything, since people are already playing stuff like GTA V / Far Cry 5 / Hitman 2 on either very close to Win (or even better performance in some cases) on Linux it's only matter of time before more and more people would want to replay classics with d3d8to9 or reshade or asiloader...

So they'll come here anyway, just like myself :smile:

Thx for all your hard work, i've been a huge fan for years and years!


If anyone else have some hacky / override solution specifically for GTA III / VC - please do post it! :+1:

elishacloud commented 4 years ago

@keybreak, I have not used Wine much either. However, I have seen that API hooking does not work the same way on Linux as it does on Windows. You may want to make sure that both ForceEntryPointHook and DontLoadFromDLLMain are disabled in the ini file.

Also, you could try using my dxwrapper project. It also has the ability to load ASI scripts and should work with Wine on Linux.

keybreak commented 4 years ago

@elishacloud Thx!

Well, at least in theory ideally it should work same as Windows (i'll try more different games though, something like Max Payne or Mafia)...

DontLoadFromDllMain=0
ForceEntryPointHook=0

Those two options sadly doesn't change anything...

Haven't heard of dxwrapper project before, looks a little bit more complex on configuration side, i've tried to copy those files "as is":

dinput8.dll
dxwrapper.dll
dxwrapper.ini
Stub.ini

Which doesn't seem to make difference either, it it correctly done, or should i try some settings?

elishacloud commented 4 years ago

Did you see a dxwrapper log file get generated? Can you attach it?

Did you configure the dxwrapper.ini file? These settings may need to be set if you want to load the ASI plug-ins:

[Plugins]
LoadPlugins                = 0
LoadFromScriptsOnly        = 0

Finally, try it without any ASI plug-ins first. It could be the plug-in that has an issue, not the dxwrapper ASI loader.

keybreak commented 4 years ago

Did you see a dxwrapper log file get generated?

Nope :frowning_face:

Did you configure the dxwrapper.ini file?

Not until now, i have applied settings you've just mentioned (LoadPlugins = 1 i assume you've meant?) and also this one:

[Compatibility]
D3d8to9                    = 1

Since i need at least D3d8to9 for ReShade to work, but obviously .asi as well, since without windescreenfix, silent's patch, SkyGFX - GTA III / VC is very sad story!

Finally, try it without any ASI plug-ins first. It could be the plug-in that has an issue, not the dxwrapper ASI loader.

Makes sense, but no, just tested apparently it's not plugins...

btw dwrapper also doesn't load .asi from scripts folder, which means it doesn't work at all too...?

elishacloud commented 4 years ago

If you did not see a log file then it means that the game is not loading the dinput8.dll file. Try renaming it to some other supported dll. Apparently the game is either loading that dll from the Windows folder or does not use that dll.

You could try these ones:

keybreak commented 4 years ago

You got me thinking, since i know for fact that GTA III use this file, that must be some Windows folder "Wine" priority, so i did override of *dinput8 (native, builtin) in Wine...

Well - certainly d3d9 wrapper at least somehow worked, but game started at default 640x480 resolution, so when i've decided to change it to my native prior to further test - it came up as some jagged messed constant crashes + crash of my compositor, so i had to go to Linux terminal for killing that nasty process.

But at least i have log, maybe it will tell you something useful dxwrapper-gta3.log

P.S. Now somehow i've managed to get both .asi from plugins and ReShade technically to work with dxwrapper.ini, but unusable due to any mouse move cause freeze of whole game for something like 3-5 seconds, not using mouse works fine though...weird

elishacloud commented 4 years ago

"certainly d3d9 wrapper at least somehow worked"

Can you tell me what the d3d8.dll and d3d9.dll files are? Is d3d8.dll from dxwrapper and d3d9.dll from ReShade?

My recommendation is first to disable everything in dxwrapper.ini and then see if that works. Then enable the settings one-by-one to see which ones have issues.

BTW: the log looks ok other than it does not show the process ending, since it was terminated prematurely.

elishacloud commented 4 years ago

"but unusable due to any mouse move cause freeze of whole game for something like 3-5 seconds, not using mouse works fine though...weird"

Mouse issues could have to do with dinput8.dll. Most likely this is used for the mouse controls.

keybreak commented 4 years ago

d3d8.dll - leftover from widescreenfix, sorry forgot to remove it d3d9.dll - yes, Reshade

So to be on safe side i've just clean installed game with dxwrapper, first i've tried with only this options change from default config, just to see if asi loading from scripts folder works:

[Plugins]
LoadPlugins                = 1
LoadFromScriptsOnly        = 0

Tested with SilentPatchIII.asi which is always easy to see by headlights - nope, it doesn't work at all (no log, no effect etc).

If i use *dinput8 (native, builtin) override in Wine, there is a log which seems to indicate that everything is ok and .asi plugin is loaded: dxwrapper-gta3.log

But in fact it is not active (headlights obviously doesn't work). Mouse works fine though! Well...at least this test tells us that with *dinput8 (native, builtin) Wine override it's actual dinput8 from game folder is in use, otherwise dxwrapper-gta3.log won't be there, right?


Then i've removed dxwrapper-gta3.log and added (also removed Wine's *dinput8 (native, builtin) override):

[Compatibility]
D3d8to9                    = 1

No log, hence no effect.

Then again, added *dinput8 (native, builtin) override in Wine: dxwrapper-gta3.log

It works and produces log, but again headlights doesn't work and it started with resolution reset to 640x480 - never a good sign. Mouse still works though! Note that there are still d3d8 mentioned in log, perhaps one from Windows folder?

Also, here's log created by Wine (dxvk), maybe it will tell you something (specifically warnings) gta3_d3d9.log

If i add Reshade:

reshade-shaders/
d3d9.dll
d3dcompiler_47.dll
ReShade.ini

It certainly works and loads, but mouse is not usable. Logs looks kinda similar: dxwrapper-gta3.log gta3_d3d9.log d3d9.log

And...btw headlights from silent are still not here, so nothing works fully :smiley:


However, when i add widescreen fix with it's d3d8.dll - headlights from silent's patch are working as well as widescreenfix! Also it's certainly silent's headlights, since i've used:

GTA3.WidescreenFix.ini

[MAIN]
FixVehicleLights = 0

Mouse obviously still doesn't.


So sine it's d3d8.dll which makes a big change, i figure i'd try again:

[Compatibility]
D3d8to9                    = 0

Yes, it works. And mouse is fine (since ReShade haven't been loaded due to dx8 in use)


It seems that mouse bug is caused by combination of using dinput8 dll override in Wine and using ReShade though. But it's more likely a problem of dxwrapper or widescreenfix d3d8.dll, perhaps wine's native d3d8.dll, than ReShade. since i've used this version of ReShade sucessfully with mutiple dx9, dx10 and dx11 games under Wine

keybreak commented 4 years ago

Yeah it should be wrapper or d3d8.dll, since even with Wine's *dinput8 (native, builtin) overrided @ThirteenAG Ultimate-ASI-Loader doesn't start game at all... It says:

wine: Unhandled exception 0x40000015 in thread 9 at address 100435F2 (thread 0009), starting debugger...
winedbg: Internal crash at 0x7bca44d2

P.S. Well, apparently Ultimate-ASI-Loader it finally works with combination of Wine's *dinput8 (native, builtin) and those set of settings:

[GlobalSets]
LoadPlugins=1
LoadFromScriptsOnly=0
DontLoadFromDllMain=0
ForceEntryPointHook=0
UseD3D8to9=1

At least it loads .asi plugins from scripts folder! But no D3D8to9 :cry:

Although seems that ReShade is really trying to load d3d9.dll, here's log: d3d9.log

elishacloud commented 4 years ago

From the log I would guess that the issue has to do with ReShade. It also looks like ReShade is trying to hook OpenGL, which I don't think it should be doing for this game.

13:07:22:504 [00009] | INFO  | Initializing crosire's ReShade version '4.6.1.826' (32-bit) built on '2020-04-14 19:08:11' loaded from "C:\Games\GTA III\d3d9.dll" into "C:\Games\GTA III\gta3.exe" ...
13:07:22:513 [00009] | INFO  | Registering hooks for "user32.dll" ...
13:07:22:513 [00009] | INFO  | > Libraries loaded.
13:07:22:513 [00009] | INFO  | > Found 13 match(es). Installing ...
13:07:22:516 [00009] | INFO  | Registering hooks for "ws2_32.dll" ...
13:07:22:516 [00009] | INFO  | > Libraries loaded.
13:07:22:516 [00009] | INFO  | > Found 8 match(es). Installing ...
13:07:22:519 [00009] | INFO  | Registering hooks for "C:\windows\system32\d2d1.dll" ...
13:07:22:520 [00009] | INFO  | > Delayed.
13:07:22:520 [00009] | INFO  | Registering hooks for "C:\windows\system32\d3d9.dll" ...
13:07:22:520 [00009] | INFO  | > Delayed until first call to an exported function.
13:07:22:520 [00009] | INFO  | Registering hooks for "C:\windows\system32\d3d10.dll" ...
13:07:22:521 [00009] | INFO  | > Delayed.
13:07:22:521 [00009] | INFO  | Registering hooks for "C:\windows\system32\d3d10_1.dll" ...
13:07:22:521 [00009] | INFO  | > Delayed.
13:07:22:521 [00009] | INFO  | Registering hooks for "C:\windows\system32\d3d11.dll" ...
13:07:22:522 [00009] | INFO  | > Delayed.
13:07:22:522 [00009] | INFO  | Registering hooks for "C:\windows\system32\d3d12.dll" ...
13:07:22:523 [00009] | INFO  | > Delayed.
13:07:22:523 [00009] | INFO  | Registering hooks for "C:\windows\system32\dxgi.dll" ...
13:07:22:523 [00009] | INFO  | > Delayed.
13:07:22:523 [00009] | INFO  | Registering hooks for "C:\windows\system32\opengl32.dll" ...
13:07:22:523 [00009] | INFO  | > Libraries loaded.
13:07:22:524 [00009] | INFO  | > Found 359 match(es). Installing ...
13:07:22:528 [00009] | INFO  | Initialized.
keybreak commented 4 years ago

It also looks like ReShade is trying to hook OpenGL, which I don't think it should be doing for this game.

Nah, it's some process ReShade does in log for any game regardless of actual api actually used, i don't know why but that's part of initialization process...

Here's for example how d3d9.log looks for Mirror's edge (which is dx9 and plays with ReShade successfully) d3d9.log

But anyway, i don't think it's ReShade at all, since Ultimate-ASI-Loader or dxwrapper doesn't work without it's d3d9.dll at all, for example if i remove ReShade files and try last working dxwrapper config with something that require working D3d8to9 like SkyGFX for example - you got this error if you try to start new game or load save: image

elishacloud commented 4 years ago

since Ultimate-ASI-Loader or dxwrapper doesn't work without it's d3d9.dll at all

This means you are using the wrong dll for dxwrapper and Ultimate-ASI-Loader. What is happening is ReShade is loading dxwrapper/Ultimate-ASI-Loader rather than the game loading it. This can lead to all kinds of problems because it can mean that dxwrapper and Ultimate-ASI-Loader are loading too late in the game startup.

Here is what you should do:

  1. Remove everything from the game and have nothing but the game only.
  2. Then drop in dxwrapper and it's stub only, making sure that dxwrapper has all settings disabled.
  3. Enable dxwrapper's settings one-by-one until they are all enabled and the game still works correctly.
  4. Once dxwrapper is working then start adding other items (ReShade, ASI plug-ins, etc.) one-by-one, making sure not to replace or delete any of dxwrapper's files.

Note: I strongly recommend using d3d8.dll for the dxwrapper's stub. Using dinput8.dll or some other dll may cause dxwrapper to load too late in the game loading process, which will cause all kinds of issues.

keybreak commented 4 years ago

Well i did that already and posted results it seems...

Note: I strongly recommend using d3d8.dll for the dxwrapper's stub. Using dinput8.dll or some other dll may cause dxwrapper to load too late in the game loading process, which will cause all kinds of issues.

That's not an option, if you do that with override *d3d8 (native, builtin) it will throw exactly same unhandled exception on loading, if you don't do override obviously dxwrapper don't work at all.

elishacloud commented 4 years ago

That's not an option, if you do that with override *d3d8 (native, builtin) it will throw exactly same unhandled exception on loading, if you don't do override obviously dxwrapper don't work at all.

If you enable d3d8to9 it will also override the native, builtin d3d8 anyways. The code hooks d3d8 and redirects it to d3d9 so the native d3d8 is bypassed. Maybe just backup the native d3d8 and replace it with dxwrapper's stub and then enable d3d8to9. The native d3d8 may not be needed if you are using d3d8to9.

keybreak commented 4 years ago

Ok, makes sense...But it doesn't work as well.


You know, i've just tested again to exclude all asi loaders hackery at all:

  1. Clean Wine prefix 5.7-staging
  2. Clean GTA III game (retail v1.0)
  3. Latest https://github.com/crosire/d3d8to9 (d3d8.dll)
  4. Latest ReShade

ReShade loads and technically works, but mouse movement freezes whole game for 3-5 seconds, so it is unusable.

I would assume it is problem of d3d8to9 / Wine, @crosire should i create issue for d3d8to9? Or maybe you can give some advice, if we missed something?

P.S. Did exactly same test on Vice city - it works (again only with Wine's *d3d8 (native, builtin) override) - it works good, except mouse freeze same as GTA III when inside menus, inside game it's ok.

elishacloud commented 4 years ago

Can you zip up and attach the native d3d8.dll file the game uses?

keybreak commented 4 years ago

Sure, i suppose you mean Wine's ones since there are no native d3d8.dll in vanilla game? windows.zip

and source in https://dl.winehq.org/wine/source/5.x/ (5.7) + staging patches https://github.com/wine-staging/wine-staging/releases (5.7) here (if there were any patches this time for d3d8)

elishacloud commented 4 years ago

there are no native d3d8.dll in vanilla game

I am a little bit confused. Earlier you said if you do that with override *d3d8 (native, builtin). Why are you worried about overriding the native, builtin d3d8 if there is no native d3d8 file in the game folder to override?

Does the game run natively without any updates or patches? If so, you should be able to drop the d3d8.dll stub file only into the game's folder and it should continue running as is, albeit you will get a pop-up that says it cannot load dxwrapper.

keybreak commented 4 years ago

Well, turns out we both don't understand what exactly wine's overrides mean... It's some voodoo magic for most cases it just wouldn't work without override.

Well, as far as i know - you can try few options one by one:

elishacloud commented 4 years ago

gta3.dxvk-cache finally gets created - which strongly indicates that you're running dx9, or at least trying. Game seems to work, .asi loading from scripts folder as well, but how to actually test in game?

If I understood your detailed response, It looks like the game works until you add ReShade. There may be an issue with ReShade. I have never seen this type of an issue before. But if it works fine without ReShade then you could try using some other d3d9 shader (such as injectSMAA) and see if that works.

keybreak commented 4 years ago

Well, as expected injectSMAA it won't even start game with both Ultimate ASI Loader and dxwrapper, but that's ok coz ReShade is only known injector which fully works on Wine / DXVK (at least in native dx 9-11)

infoman commented 4 years ago

Apparently it works when you also have real dinput8 placed in system32/syswow64 directory

keybreak commented 4 years ago

@infoman Hey! Can you please be more specific?

I've tested on: Manjaro KDE stable Wine 5.7-staging dxvk 1.7L overrides: *d3d8 (native, builtin)

Ultimate ASI loader, still see same Unhandled exception with Windows 7 SP1 original dinput8 files thrown to system32 / system64, while trying SKYGFX for example.

infoman commented 4 years ago

I tried running a GTA III bundle built by another person, with what seems to be ASI Loader pretending to be dinput8.dll. First, when trying to just set dinput8 to native, I got unhandled exception errors and that's all. Then, I installed dinput8 from PlayOnLinux settings, and got some of the bundled mods working, but car models were broken, and dxvk cache was not created. After also setting d3d8 to native, everything worked even without having real d3d8 installed.

Maybe if you are trying to replace d3d8 then you must have real d3d8 installed.

keybreak commented 4 years ago

@infoman Wait, but do you use d3d8 to 9 functionality at all?