View previous topic :: View next topic |
Author |
Message |
dlpb Advanced Cheater Reputation: 0
Joined: 11 Dec 2013 Posts: 71
|
Posted: Tue Mar 14, 2017 10:23 pm Post subject: Make a fullscreen game use window mode with dll |
|
|
How to make an old game (that always forces full screen) windowed from inside a DLL?
I've tried a load of apis and tests, but got nowhere. The program dxwnd can do it, so what's the secret?
I also assume that somewhere in this game, the window setting api is called - and I may be able to edit that directly.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Tue Mar 14, 2017 11:35 pm Post subject: |
|
|
Depends on what graphics engine the game is using. dxwnd is a more or less 'all-in-one' type solution covering multiple enginges (dx7/8/9/gl/etc.)
For Direct3D8 and Direct3D9 you will need to hook CreateDevice and Reset mainly to tell the device adapter to run windowed. You may also have to hook CreateWindowA/CreateWindowW/CreateWindowExA/CreateWindowExW and other similar API to help enforce the windowing depending on how the game is coded.
For OpenGL, you would want to hook glViewport / glScissor / glCreateContext and similar to do pretty much the same as Direct3D, faking the device into thinking its windowed.
The source code to dxwnd is around the net somewhere if you look for it and want to see how it handles things. It's not the best in terms of code quality and overall usage for every game since some games implement things to attempt to prevent running in a window etc. that you will have to handle yourself differently.
_________________
- Retired. |
|
Back to top |
|
|
dlpb Advanced Cheater Reputation: 0
Joined: 11 Dec 2013 Posts: 71
|
Posted: Wed Mar 15, 2017 2:42 am Post subject: |
|
|
Thanks. I also had a look at how someone else had done it. They basically called these:
//destroywindow(windowhan);
//adjustwindowrectex (....)
//windowhan:= createwindowex ( .... )
//showwindow(windowhan,SW_SHOW);
Destroying the current window just after it is created - and then planting a new one straight after.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Fri Mar 17, 2017 2:08 am Post subject: |
|
|
dlpb wrote: | Thanks. I also had a look at how someone else had done it. They basically called these:
//destroywindow(windowhan);
//adjustwindowrectex (....)
//windowhan:= createwindowex ( .... )
//showwindow(windowhan,SW_SHOW);
Destroying the current window just after it is created - and then planting a new one straight after. |
While in some cases it may be needed to do this (mainly to resize the window properly with the window rect etc.) the main device context still needs to be told to render windowed or in most cases you will just crash the game or it will have extremely weird window issues. (Flickering, invalid sizes, stretched textures etc.)
_________________
- Retired. |
|
Back to top |
|
|
dlpb Advanced Cheater Reputation: 0
Joined: 11 Dec 2013 Posts: 71
|
Posted: Fri Mar 17, 2017 3:28 am Post subject: |
|
|
How does a ddraw app decide full screen mode? For that matter, what IS full screen mode? I don't see any documentation online that really explains this in terms of the apis.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8517 Location: 127.0.0.1
|
Posted: Fri Mar 17, 2017 1:31 pm Post subject: |
|
|
Fullscreen mode is when an application takes exclusive "ownership" of the graphics device and projects to the screen in a manner that renders to the whole screen regardless of what resolution is used.
For DDraw, I'm not that familiar with it personally. However MSDN has some old docs explaining that the internal palettes are what are used to draw to the hardware and are done either in exclusive mode (fullscreen) or in windowed mode here:
https://msdn.microsoft.com/en-us/library/aa451268.aspx
_________________
- Retired. |
|
Back to top |
|
|
|