Menu

Neverwinter Nights: Diamond Edition (GOG)

pxc
2018-08-09
2018-09-16
  • pxc

    pxc - 2018-08-09

    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?

    Unhandled exception at 0x10045AF2 (dxwnd.dll) in nwmain.exe: 0xC0000005: Access violation reading location 0x00000008.
    
    10045AD0  push        ecx
    10045AD1  cmp         dword ptr ds:[100DB9B4h],0
    10045AD8  push        ebx
    10045AD9  push        ebp
    10045ADA  mov         ebp,dword ptr [esp+14h]
    10045ADE  push        esi
    10045ADF  mov         esi,dword ptr [esp+1Ch]
    10045AE3  push        edi
    10045AE4  mov         edi,dword ptr [esp+18h]
    10045AE8  mov         dword ptr [esp+10h],0
    10045AF0  je          10045B3E
    10045AF2  mov         al,byte ptr [esi+8]           <<<<<<<<<<<<<<<<<
    10045AF5  mov         ecx,100AB970h
    10045AFA  test        al,al
    10045AFC  jne         10045B03
    10045AFE  mov         ecx,100AB960h
    10045B03  movzx       edx,byte ptr [esi+0Fh]
    10045B07  push        edx
    10045B08  movzx       edx,byte ptr [esi+0Dh]
    10045B0C  push        edx
    10045B0D  movzx       edx,byte ptr [esi+0Bh]
    10045B11  push        edx
    10045B12  movzx       edx,byte ptr [esi+0Eh]
    10045B16  push        edx
    
    --------------------------------------------------------
    
    Unhandled exception at 0x10045BCF (dxwnd.dll) in nwmain.exe: 0xC0000005: Access violation reading location 0x00000009.
    
    10045BA6  call        dword ptr ds:[100DAA78h]
    10045BAC  inc         dword ptr ds:[100DC7E4h]
    10045BB2  mov         ebx,eax
    10045BB4  mov         dword ptr ds:[100DC7E0h],edi
    10045BBA  cmp         dword ptr [esp+10h],0
    10045BBF  je          10045BCF
    10045BC1  mov         ecx,dword ptr ds:[100DBA48h]
    10045BC7  push        edi
    10045BC8  push        ecx
    10045BC9  call        dword ptr ds:[100DAAE4h]
    10045BCF  movzx       edx,byte ptr [esi+9]               <<<<<<<<<<<<<<<<<<
    10045BD3  mov         dword ptr ds:[100DB148h],edx
    10045BD9  test        ebx,ebx
    10045BDB  jne         10045BF6
    10045BDD  push        0B6Eh
    10045BE2  call        dword ptr ds:[100934B4h]
    10045BE8  push        eax
    10045BE9  push        100AB888h
    10045BEE  call        10034FE0
    10045BF3  add         esp,0Ch
    10045BF6  pop         edi
    
     
  • gho

    gho - 2018-08-12

    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 ....

     
  • gho

    gho - 2018-08-18

    Nwn GOG edition installed on Win10: in effect it works in fullscreen mode but crashes with DxWnd & window mode. I'm ready to investigate ...

     
    • pxc

      pxc - 2018-08-18

      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)

       
      • gho

        gho - 2018-08-18

        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.

         

        Last edit: gho 2018-08-18
        • pxc

          pxc - 2018-08-19

          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.

          Settings:
            Main > Window initial position & size: 0, 0, 1920, 1080 
            Video > Window style: modal
            Video > Initial resolution: 1920, 1080
          

          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.

          [Display Options]
          Width=1920
          Height=1080
          BitsPerPixels=32
          RefreshRate=60
          TexturePack=3
          SafeMovie=0
          FullScreen=0
          AllowWindowedMode=1
          UseLargeFont=1
          

          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:

          Unhandled exception at 0x1005D21E (dxwnd.dll) in nwmain.exe: 0xC0000094: Integer division by zero.
          
          1005D1FA  add         esp,14h  
          1005D1FD  mov         edx,dword ptr ds:[100DCA4Ch]  
          1005D203  lea         ecx,[esp+8]  
          1005D207  push        ecx  
          1005D208  push        edx  
          1005D209  call        dword ptr ds:[100DB978h]  
          1005D20F  mov         eax,dword ptr [esi]  
          1005D211  imul        eax,dword ptr ds:[100DCA40h]  
          1005D218  mov         ecx,dword ptr [esp+10h]  
          1005D21C  xor         edx,edx  
          1005D21E  div         eax,ecx                     <<<<<<<<<<<<<
          1005D220  mov         edi,dword ptr [esp+14h]  
          1005D224  xor         edx,edx  
          1005D226  mov         dword ptr [esi],eax  
          1005D228  mov         eax,dword ptr [esi+4]  
          1005D22B  imul        eax,dword ptr ds:[100DCA44h]  
          1005D232  div         eax,edi  
          1005D234  xor         edx,edx  
          1005D236  mov         dword ptr [esi+4],eax  
          1005D239  mov         eax,dword ptr [esi+8]  
          1005D23C  imul        eax,dword ptr ds:[100DCA40h]  
          
           
  • gho

    gho - 2018-08-19

    Yes, I noticed that something was not ok, but not that bad ...
    I'll do more research ...

     
  • gho

    gho - 2018-08-21

    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 ...

     
  • gho

    gho - 2018-08-21

    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 ...

     
  • gho

    gho - 2018-08-22

    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 ....

     
  • gho

    gho - 2018-08-28

    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.....

     
  • gho

    gho - 2018-08-31

    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.

     
  • gho

    gho - 2018-09-07

    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.

     
  • gho

    gho - 2018-09-07

    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
  • gho

    gho - 2018-09-11

    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 ...

     
  • ZellSF

    ZellSF - 2018-09-14

    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
    • gho

      gho - 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.

       
      • gho

        gho - 2018-09-15

        follows on dedicated thread ...

         
      • ZellSF

        ZellSF - 2018-09-16

        Thanks, it was "Scaled GDI calls"

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.