Game: Neverwinter Nights: Diamond Edition
Source: GOG
Patches: No external patches, just a plain new install from GoG launcher.
Install location: Secondary HDD
Platform: Windows 7 Home Premium SP1
Just wondering if there has been any progress with this issue. The last reply in the old thread is from 2016.
My own findings:
- When running the game as hooked, it will crash (just like in the old thread).
- When running the game as unhooked, it will play in window mode. Managed to get it "work" this way only three times. Game screen was rendered near bottom left corner and mouse location was off.
- Setting the game window maximized will crash the game.
- When using "Son process hook>Extend Injection" the game process will run, but no window will be displayed. The game CPU usage shows 0% (unresponsive?).
- When using "Son process hook>Extend Injection" with "Main>Generic>Fullscreen only" with "Main>Generic>Run in Window" will create a window. However the game is unresponsive. (How does this combo even work? lol)
- When disabling "Hook>Hook enabled" the game will open normally (I guess this was expected result :p).
- Disabling all possible hooks except "Hook>Hook enabled" will still crash the game.
Hints given:
- Compatibility settings for a different OS detected (No effect when clearing flags).
- DirectDraw dependency detected (DirectX Version Hook tested with DX9/DX11/Auto).
- OpenGL dependency detected (OpenGL hook enabled. Tested hooking Glut32 and WGL Context Calls).
- Movie libraries detected (Not sure what I can do with this).
- DirectInput dependency detected (Tested "Hook dinput/dinput8").
Exceptions:
Are there any debugging symbols available that I could use with the latest version of DxWnd?
I apologize, I was distracted by other issues and completely forgot this topic.
I'm currently on vacation, with a portable pc, almost full HD and very limited bandwidth, I think I could be full steam again to work on this NWN game from september. Please, reming me again at the beginning of september, my memory is not that good and I could easily forget again ....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Shh... I'm stealing ADSL bandwidth from my brother's access point... :)
The problem with the game was very silly, a wrong assumption about the input parameter to a system call that I didn't think it could be NULL. In attach the patched leaked beta of next release together with the Neverwinter Nights configuration file. It seems that the game requires the following:
DxWnd running with administrator rights
early injection mode (es. "Inject suspended process")
OpenGL hooking
Please let me know if everything is ok.
P.s. this beta had some problems with (I believe) some AV program. In case, let me know, I can patch some other less suspicious release.
With a default settings + the settings you gave me, it works nicely in window mode 800x600. However, the window cannot be resized or dragged (there might be settings for this in the DxWnd that I haven't found yet).
When changing the window size from 800x600 to 1920x1080, everything gets drawn to the bottom left corner.
I also tested to disable window mode from nwn.ini (above). It caused everything to be stretched and later crashed in the main menu (same exception as below).
There was also an exception when trying to change the game's resolution from in-game options (same exception as below).
First big oddity: all intro stuff is within .bik files played by binkw32.dll calls, but current DxWnd release seems unable to hook this dll. Probably I broke something ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The game seems to have two different types of problems.
1) First one is the scaled rendering of binkw32 movies. I fixed some bugs, but the game uses new function calls, so I have to find a strategy to properly scale the images. But you can skip this problem simply renaming the "movies" folder - this way NWN will skip all bink movies rendering and will bring you to the next problem
2) the game uses OpenGL in a way that is not properly scaled by currend DxWnd logic. Curiously, there is some scaling, but not fully correct.
Well, it seems that this game will give me some work for a while ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some small but significative progress.
Putting aside for the moment the movies problem (that is, leaving the movie folder renamed), I concentrated to the opengl scaling and possition anomalies. The problem seems to depend on the fact that the game keep querying the current viewport value, but never tries to initialize it. Forcing the viewport figures to the constant values pos=0,0, size=800,600 the game works almost perfectly at any selected window size, apart from the character selection panel where (probably) a different viewport value is expected.
In any case, it seems that all opengl problems depend on a weird usage of viewports, I can't say wrong because at the expected size of 800x600 everything works fine, but in a way that doens't allow for window scaling.
Well, once found the illness, it should be possible to find a proper cure ....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another progress: the bink movies are now properly scaled and fitting the window. The only remaining (and mysterious) problem is the OpenGL rendering that is scaled correctly, but oddly shifted. Without fixing this problem, the game is still not at all playable.....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got some highlights about the remaining problem:
If you run the game natively at different resolutions, you'll see that the menu panels (main menu, character selection, new character, ...) are not scaled to the full size but are always kept in a 800x600 window centered in the game window. The game does that apparently finding the window size (no matter if it's fullscreen or windowed mode) and shifting the menu window accordingly.
Now the problem with DxWnd is that the game is mart enough to avoid being cheated: it gets somehow the ACTUAL window size instead of the emulated value that DxWnd tries to make it believe, and that causes the calculation of a bad offset, here in the attached screenshot the result at 400x300 window size.
The fix of the shift problem is much harder that I expected.
But maybe I found a trick to bypass the problem.
In short, the problem is that when you run the game with no antialiasing in fullscreen mode, the game engine shifts the game rectangle to the center of the desktop and DxWnd fails to provide a correctly emulated scenario.
But if you set "Antialiasing Mode=1" in the nwn.ini game configuration, the game expects to enlarge the image to the whole screen and DxWnd seems to work much better.
If the trick will prove to work as I hope, I'm going to release a beta for testing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here comes (maybe) a good news. After some partial success on the game demo, it seems that the GOG full game release is less troublesome, this WIP release is working quite well.
I cross my fingers when I say that because the game sometimes changes its behavior depending on some unknown situation, but let's hope this is not the case now.
In attach all is needed for some testing: the files for a v2.04.87 upgrade plus the game export file, with the pathname to be tuned to your game folder. In my tests, the game scaled correctly from 400x300 to fullscreen, and also "keep aspect ratio" and "hide desktop background" were working ok.
BEWARE: the WIP release was taken in the middle of some critical code reorganization about windows handling, so probably it won't work well on some other games.
The new posted release v2.04.88 seems to work fairly well both with NeverWinter and all other supported games. The handling of windows was reorganized, so there might be some bad surprises, let's hope not!
There is no Neverwinter export file included because this game still behaves strangely, on some starts it works perfectly, then on other starts if shows problems: maybe there are time critical situations, who knows? In any case I'd like to polish it up a little more ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Any chance you can look at Star Wars: Knights of the Old Republic next? It's based on a similiar engine and could hopefully benefit from DxWnd's OpenGL scaling... but it just crashes.
Edit: also I couldn't get the bink movies to scale, am I missing the correct setting for that?
Last edit: ZellSF 2018-09-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The correct setting for NWN is the "Neverwinter Nights.dxv" that you could find within the archive v2.0.88.neverwinter.rar posted above, better to be used with the official DxWnd v2.04.88, but this game sometimes behaves in a crazy way, so I'm not sure it will be good on every situation. In any case, the trick for movie scaling was (if I recall correctly) setting the "Scaled GDI calls" flag in the Libs tab.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Old Thread: Link
Game: Neverwinter Nights: Diamond Edition
Source: GOG
Patches: No external patches, just a plain new install from GoG launcher.
Install location: Secondary HDD
Platform: Windows 7 Home Premium SP1
Just wondering if there has been any progress with this issue. The last reply in the old thread is from 2016.
My own findings:
- When running the game as hooked, it will crash (just like in the old thread).
- When running the game as unhooked, it will play in window mode. Managed to get it "work" this way only three times. Game screen was rendered near bottom left corner and mouse location was off.
- Setting the game window maximized will crash the game.
- When using "Son process hook>Extend Injection" the game process will run, but no window will be displayed. The game CPU usage shows 0% (unresponsive?).
- When using "Son process hook>Extend Injection" with "Main>Generic>Fullscreen only" with "Main>Generic>Run in Window" will create a window. However the game is unresponsive. (How does this combo even work? lol)
- When disabling "Hook>Hook enabled" the game will open normally (I guess this was expected result :p).
- Disabling all possible hooks except "Hook>Hook enabled" will still crash the game.
Hints given:
- Compatibility settings for a different OS detected (No effect when clearing flags).
- DirectDraw dependency detected (DirectX Version Hook tested with DX9/DX11/Auto).
- OpenGL dependency detected (OpenGL hook enabled. Tested hooking Glut32 and WGL Context Calls).
- Movie libraries detected (Not sure what I can do with this).
- DirectInput dependency detected (Tested "Hook dinput/dinput8").
Exceptions:
Are there any debugging symbols available that I could use with the latest version of DxWnd?
I apologize, I was distracted by other issues and completely forgot this topic.
I'm currently on vacation, with a portable pc, almost full HD and very limited bandwidth, I think I could be full steam again to work on this NWN game from september. Please, reming me again at the beginning of september, my memory is not that good and I could easily forget again ....
Nwn GOG edition installed on Win10: in effect it works in fullscreen mode but crashes with DxWnd & window mode. I'm ready to investigate ...
Yush. Let me know if you need anything. I'll try to provide necessary info.
(Wasn't I suppose to remind you at the beginning of september? lol)
Shh... I'm stealing ADSL bandwidth from my brother's access point... :)
The problem with the game was very silly, a wrong assumption about the input parameter to a system call that I didn't think it could be NULL. In attach the patched leaked beta of next release together with the Neverwinter Nights configuration file. It seems that the game requires the following:
Please let me know if everything is ok.
P.s. this beta had some problems with (I believe) some AV program. In case, let me know, I can patch some other less suspicious release.
Last edit: gho 2018-08-18
Tested. Kinda works. :P
https://imgur.com/a/gh6YfCR
With a default settings + the settings you gave me, it works nicely in window mode 800x600. However, the window cannot be resized or dragged (there might be settings for this in the DxWnd that I haven't found yet).
When changing the window size from 800x600 to 1920x1080, everything gets drawn to the bottom left corner.
For mouse input, the game handles it as if everything was drawn to the top left corner.
When running the game from DxWnd, the game uses 800x600 resolution, even though nwn.ini has 1920x1080 resolution defined.
I also tested to disable window mode from nwn.ini (above). It caused everything to be stretched and later crashed in the main menu (same exception as below).
There was also an exception when trying to change the game's resolution from in-game options (same exception as below).
Exceptions:
Yes, I noticed that something was not ok, but not that bad ...
I'll do more research ...
First big oddity: all intro stuff is within .bik files played by binkw32.dll calls, but current DxWnd release seems unable to hook this dll. Probably I broke something ...
The game seems to have two different types of problems.
1) First one is the scaled rendering of binkw32 movies. I fixed some bugs, but the game uses new function calls, so I have to find a strategy to properly scale the images. But you can skip this problem simply renaming the "movies" folder - this way NWN will skip all bink movies rendering and will bring you to the next problem
2) the game uses OpenGL in a way that is not properly scaled by currend DxWnd logic. Curiously, there is some scaling, but not fully correct.
Well, it seems that this game will give me some work for a while ...
Some small but significative progress.
Putting aside for the moment the movies problem (that is, leaving the movie folder renamed), I concentrated to the opengl scaling and possition anomalies. The problem seems to depend on the fact that the game keep querying the current viewport value, but never tries to initialize it. Forcing the viewport figures to the constant values pos=0,0, size=800,600 the game works almost perfectly at any selected window size, apart from the character selection panel where (probably) a different viewport value is expected.
In any case, it seems that all opengl problems depend on a weird usage of viewports, I can't say wrong because at the expected size of 800x600 everything works fine, but in a way that doens't allow for window scaling.
Well, once found the illness, it should be possible to find a proper cure ....
Another progress: the bink movies are now properly scaled and fitting the window. The only remaining (and mysterious) problem is the OpenGL rendering that is scaled correctly, but oddly shifted. Without fixing this problem, the game is still not at all playable.....
I got some highlights about the remaining problem:
If you run the game natively at different resolutions, you'll see that the menu panels (main menu, character selection, new character, ...) are not scaled to the full size but are always kept in a 800x600 window centered in the game window. The game does that apparently finding the window size (no matter if it's fullscreen or windowed mode) and shifting the menu window accordingly.
Now the problem with DxWnd is that the game is mart enough to avoid being cheated: it gets somehow the ACTUAL window size instead of the emulated value that DxWnd tries to make it believe, and that causes the calculation of a bad offset, here in the attached screenshot the result at 400x300 window size.
The fix of the shift problem is much harder that I expected.
But maybe I found a trick to bypass the problem.
In short, the problem is that when you run the game with no antialiasing in fullscreen mode, the game engine shifts the game rectangle to the center of the desktop and DxWnd fails to provide a correctly emulated scenario.
But if you set "Antialiasing Mode=1" in the nwn.ini game configuration, the game expects to enlarge the image to the whole screen and DxWnd seems to work much better.
If the trick will prove to work as I hope, I'm going to release a beta for testing.
Here comes (maybe) a good news. After some partial success on the game demo, it seems that the GOG full game release is less troublesome, this WIP release is working quite well.
I cross my fingers when I say that because the game sometimes changes its behavior depending on some unknown situation, but let's hope this is not the case now.
In attach all is needed for some testing: the files for a v2.04.87 upgrade plus the game export file, with the pathname to be tuned to your game folder. In my tests, the game scaled correctly from 400x300 to fullscreen, and also "keep aspect ratio" and "hide desktop background" were working ok.
BEWARE: the WIP release was taken in the middle of some critical code reorganization about windows handling, so probably it won't work well on some other games.
Last edit: gho 2018-09-07
The new posted release v2.04.88 seems to work fairly well both with NeverWinter and all other supported games. The handling of windows was reorganized, so there might be some bad surprises, let's hope not!
There is no Neverwinter export file included because this game still behaves strangely, on some starts it works perfectly, then on other starts if shows problems: maybe there are time critical situations, who knows? In any case I'd like to polish it up a little more ...
Any chance you can look at Star Wars: Knights of the Old Republic next? It's based on a similiar engine and could hopefully benefit from DxWnd's OpenGL scaling... but it just crashes.
Edit: also I couldn't get the bink movies to scale, am I missing the correct setting for that?
Last edit: ZellSF 2018-09-14
Sure, I'll try SWKOTOR ASAP.
The correct setting for NWN is the "Neverwinter Nights.dxv" that you could find within the archive v2.0.88.neverwinter.rar posted above, better to be used with the official DxWnd v2.04.88, but this game sometimes behaves in a crazy way, so I'm not sure it will be good on every situation. In any case, the trick for movie scaling was (if I recall correctly) setting the "Scaled GDI calls" flag in the Libs tab.
follows on dedicated thread ...
Thanks, it was "Scaled GDI calls"