elishacloud / dxwrapper

Fixes compatibility issues with older games running on Windows 10/11 by wrapping DirectX dlls. Also allows loading custom libraries with the file extension .asi into game processes.
zlib License
1.17k stars 83 forks source link

Resolution issue with a obscure game #36

Closed nipkownix closed 4 years ago

nipkownix commented 5 years ago

Hey Elisha. I'm having a problem with a game that I couldn't solve myself for quite a few months, so the only thing I could come up with was to ask for help from the masterminds behind Silent-Hill-2-Enhancements.

I'm not sure if this issue belongs in this specific repository, but I couldn't think of any other appropriate way to contact you.

The issue is the following: back in 2008, a visual novel was released for PC only and it was quite successful. It was a simple game running on a simple visual novel engine. 800x600 was a "common" resolution back then, so that naturally is what the game runs at.

Some time later, the game was vastly improved with a higher resolution of 1280x720, refined visuals, extra content and so on. This new version, however, was only released on consoles. Xbox 360, to be precise.

Turns out this improved Xbox 360 version was made on the exact same engine as the PC version. They basically ported its engine to console and worked from there.

The engine used is very mod friendly and almost everything is programmed using the game's script files instead of being hardcoded in the .exe

Because of that, by modifying the scripts, it is possible to "port" games from one build of this engine to another. Naturally, people thought: lets port the improved X360 version of the game to PC. And it actually works... sort of. This is where the problem appears: Although games running on this engine are 99% programmed using scripts, the game's resolution is hardcoded in the exe.

Basically, we can port the game to PC using a build of the engine that was compiled for another game, but there is no existing version of this engine that renders a 1280x720 on PC. The highest we can get is 1024x768.

Because of that, only half of the game is displayed, since the game itself is bigger than the window itself.

I have programmed a simple example to illustrate what is happening.

This is my 1280x720 test image:

sWOYFua 1

This is how it looks running on a PC build of the engine that is hardcoded to run at 800x600:

cXfydSY 1

This is how it looks running on a build that is hardcoded to run at 1024x768:

WTm2lOg 1

Here is my question: is it possible to increase the resolution to 1280x720? You, Aero and ThirteenAG are the only people I know that could correctly answer, or perhaps help me to achieve this.

elishacloud commented 5 years ago

@brunibunny, what game is this? If you can show me where I can download it I will take a look at it and see what I can do.

nipkownix commented 5 years ago

@elishacloud , the screenshots I showed you are from two different "games". They're Japanese games, so your Windows would need to be running on a Japanese locale. But as I said, they're the same engine in the end, and everything is programmed using uncompiled scripts, so I believe it is easier for me to simply send you the test build I made, shown in the screenshot. Since it is not using any Japanese code or file names, it should run on your PC without any hassle.

800x600: n2s_demo.zip

1024x768: n2s_kiko.zip

Pressing F will switch between fullscreen/windowed and clicking the image will close the game.

elishacloud commented 5 years ago

This is a very interesting program. I only looked at it for a few minutes, but this is what I found out so far. It statically links to both ddraw.dll and d3d9.dll but it does not use either of these versions of DirectX to draw the graphic. It is only using ddraw.dll to get the video memory and it does not appear to be using d3d9.dll at all.

It also dynamically loads both d3d10.dll and d3d11.dll from the system folder (not the local folder). I am not sure yet if the graphic is being drawn directly by GDI or if it is using DirectX10 or DirectX11.

I tried manually forcing the window to be 1280x720 but it still only showed the 800x600 pixels of the graphic, the rest of the graphic was cut off (just showing black). Something internally is preventing more then that of graphic from showing.

nipkownix commented 5 years ago

Wait, it doesn't use d3d9 to draw the game? ..I guess that explains why I wasn't having any luck with dxwnd. Pretty weird. It's probably using GDI then. Since the game runs on Windows XP, I don't think DX10 and DX11 are a possibility.

@AeroWidescreen summoning another legend

AeroWidescreen commented 5 years ago

I have the same problem as Elisha. I can change the window size, but I can't get it to render anything beyond 1024x768. I think the game sets the resolution on launch, but I have no way of making changes before that happens. The exe appears to be compressed, so I can't hex edit either.

Interestingly, I can make the amount it displays smaller but not larger.

window window

nipkownix commented 4 years ago

On further investigation, turns out this engine is a complete mess. Pure and utter trash in every way. Any further work here would be a waste. But really, thanks for the effort, guys. I really appreciate it.

@elishacloud before we close this issue, I want to ask you something real quick. Apparently, games made using this engine (surprise-surprise, terrible engine) don't auto refresh the primary surface on screen. DxWnd can workaround this as mentioned here. Is it possible for you to implement the same workaround in dxwrapper? You know, just so we I can avoid hooking the entire DxWnd just to use this one workaround.