Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: DLPB_ on 2017-03-18 04:26:56

Title: Help required making old ff7 modes windowed.
Post by: DLPB_ on 2017-03-18 04:26:56
I know I can cheat using something like dxwnd, but I want to do this properly.  I have spent a lot of time looking at the apis (like destroy / createwindow, which aali seems to use), setwindowpos, setwindowlong... you name it. But I clearly have no idea what I am doing. It's like the blind leading the blind.

The game starts full screen and I have no idea how to make the game work in a window. Aali's driver seems to destroy the initial window, and recreate it - but it's not as simple as that, since that alone just leaves a black window. So how is it done?

If anyone can help, then please do.  Set ff7config to software mode (using nvidia tnt seems to work ok for me) or hardware nvidia tnt - and have a look at 6786bf.

Title: Re: Help required making old ff7 modes windowed.
Post by: JWP on 2017-03-19 22:07:05
For Direct3D, I guess you'd want to hook onto the IDirect3D9::CreateDevice method and edit the parameter passed into the D3DPRESENT_PARAMETERS struct, see:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb204867(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/bb204867(v=vs.85).aspx)
https://msdn.microsoft.com/en-us/library/windows/desktop/bb172588(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/bb172588(v=vs.85).aspx)

I did have the offsets for the creation somewhere but I have no idea where they are at the moment.
As for the software rendering, I don't really know without looking at it.
Title: Re: Help required making old ff7 modes windowed.
Post by: nfitc1 on 2017-03-20 03:18:38
Except this was created when DirectX 5 was the latest version. You'll have to find docs to those methods and replicate it with DX9 methods.

A lot of the mechanics of drawing seem to be related to absolute positioning on the screen. I don't know how well that'd translate to windowed coordinates.
Title: Re: Help required making old ff7 modes windowed.
Post by: JWP on 2017-03-20 18:38:09
oh god, I forgot it's that old xD.
All the DirectDraw/D3D init stuff starts at 0x00678079, no idea what the functions calls for the ancient versions look like though.
I'd guess you'd need the directx 5 SDK since I doubt there's much information around the internet still.
Title: Re: Help required making old ff7 modes windowed.
Post by: Kranmer on 2017-03-20 20:54:46
A long time ago in a galaxy far far away there was a patch for ff7 that made it windowed, what it was was patch the following bytes
Code: [Select]
    RAW Offset   | Old Byte | New Byte
-----------------+----------+----------
     002775A2         83         C7
     002775A3         B9         82
     002775A8         00         01
     002775A9         75         00
     002775AA         0D         00
     002775AB         8B         00
     002775AC         55         90
     002775AD         08         90
     002775B4         01         00
Hope that helps. I no longer have the original patch i just have the patched EXE but i'm sure it exists out there somewhere.
PS. Sorry i haven't been around much but depression and health problems have really gotten to me recently but trying to get back into things again.
Title: Re: Help required making old ff7 modes windowed.
Post by: DLPB_ on 2017-03-20 22:35:48
After all these years, you're still solving issues :P

For testing purposes, the above will work well enough.  The initial window remains open in the corner. The changes you gave me force it to stay on screen windowed.

Resizing this window to be larger than 640*480 using setwindowpos will result in invalid triangle error, though, because it still has everything set to that resolution.

The fix above is for D3D and not software mode.
Title: Re: Help required making old ff7 modes windowed.
Post by: sithlord48 on 2017-03-21 13:12:51
doesnt ff7 work currently in windowed mode? Pretty sure that is how i run it.. (its been a while )
Title: Re: Help required making old ff7 modes windowed.
Post by: DLPB_ on 2017-03-21 13:15:23
Only with aali's driver.