Author Topic: OpenGL FFVII Graphics Driver and WINE  (Read 11416 times)

arew264

  • *
  • Posts: 94
    • View Profile
OpenGL FFVII Graphics Driver and WINE
« on: 2009-06-07 00:38:35 »
I'm wondering if anyone has tried to run FF7 in Wine (on linux) with Aali's OpenGL graphics driver. If I remember correctly, the main problem with running it was graphics problems, and the custom driver *should* resolve that. The only other OS-specific code that could give Wine problems would be the sound, but I've never heard of that causing problems in Wine, probably because the API is a lot simpler.

Oh wait... Hopefully CD checking won't cause issues, because that could be a showstopper.

Anyway, I'll copy my FFVII installation over to Linux and add the registry keys. I'll report my findings back here. Hopefully this post is in the right forum.

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #1 on: 2009-06-07 01:35:01 »
Okay, after fiddling with Timidity (MIDI driver), I can get to the main menu and watch the intro video. The game starts, but crashes in the first battle. I'm going to have to do it again to see if anything is obviously causing the crash.
[EDIT]
Well, the crash just happens a few moments after the battle starts, nothing seems to specifically happen. It could be at the start of one of the enemy soldier's attacks.
[/EDIT]
Wine gives this just after the crash occurs: err:ntdll:RtlpWaitForCriticalSection section 0x7d22f9c0 "x11drv_main.c: X11DRV_CritSection" wait timed out in thread 0018, blocked by 0009, retrying (60 sec)

Loading my current save game (which is in Cosmo Canyon) gives an instant crash.

What bothers me is that the crash dumps are blank, and an emergency save file is never created, even if I say yes at the prompt.

Aali, if you're reading this, when the renderer needs to play a video, does it just get a filename or something along those lines, or is the linkage more direct? If it's loose, would it be possible to try and load the file with the extension changed to mkv, and fall back to avi if such a file can't be found? I hate the current audio quality, and it seems to me that a good solution would be to repack the video with flac audio in a matroska, which is supported by ffmpeg.

[EDIT]
Well, the audio does have more problems than the quality that bugs me. It bugs me on Windows too, so that's not a Linux thing, but in Wine, sounds are clipped at the front and end, seemingly randomly, such that if I switch between "Continue" and "New Game" at the main menu, the sound I get varies from the full chirp to a short squeak to a small pop.
[/EDIT]

Anyway, I'm still fiddling at this point. Kudos to Aali, the graphics are flawless, including the battle swirl, except that the credits effect before the main menu where the words fly from different sides and converge runs really really fast. Is that symptomatic of anything involving the renderer? The only scenario where I can see that happening is if Wine is responding incorrectly to calls to gettimeofday and its cousins, but that would mess up more than this effect.
Oh, and the MIDI kind of falters every so often, and it bothers me that it can't keep a steady tempo. That's a problem with Wine/Timidity though, and I'll worry about it later. Right now, MIDI works, and that's good enough.
« Last Edit: 2009-06-07 01:44:42 by arew264 »

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #2 on: 2009-06-07 01:49:36 »
Okay, on to the debugging. Is there a way to make FFVII output more verbose? I doubt it, but I haven't had to do this before.

APP.LOG looks like this:
Code: [Select]
$ cat APP.LOG
INITIALIZE DD/D3D START
INFO: Auto-detected version: 1.02 US English
INFO: OpenGL 2.0 support detected
INFO: Found swap_control extension
INFO: Original resolution 640x480, window size 800x600, output resolution 800x600, internal resolution 1280x960
INFO: FBO extension detected, using fast scaling/postprocessing path
LOCK UNLOCK TEST
MATRIX INITIALIZE
ERROR: COULD NOT WRITE TO FILE TF2D.P
ERROR: COULD NOT READ FROM FILE TF2D.P
ERROR: COULD NOT WRITE TO FILE TF3D.P
ERROR: COULD NOT READ FROM FILE TF3D.P
ERROR: COULD NOT WRITE TO FILE TG2D.P
ERROR: COULD NOT READ FROM FILE TG2D.P
ERROR: COULD NOT WRITE TO FILE TG3D.P
ERROR: COULD NOT READ FROM FILE TG3D.P
ERROR: COULD NOT WRITE TO FILE T2D.P
ERROR: COULD NOT READ FROM FILE T2D.P
ERROR: COULD NOT WRITE TO FILE T3D.P
ERROR: COULD NOT READ FROM FILE T3D.P
ERROR: COULD NOT WRITE TO FILE TGT2D.P
ERROR: COULD NOT READ FROM FILE TGT2D.P
ERROR: COULD NOT WRITE TO FILE TGT3D.P
ERROR: COULD NOT READ FROM FILE TGT3D.P
ERROR: COULD NOT WRITE TO FILE SF2D.P
ERROR: COULD NOT READ FROM FILE SF2D.P
ERROR: COULD NOT WRITE TO FILE SF3D.P
ERROR: COULD NOT READ FROM FILE SF3D.P
ERROR: COULD NOT WRITE TO FILE SG2D.P
ERROR: COULD NOT READ FROM FILE SG2D.P
ERROR: COULD NOT WRITE TO FILE SG3D.P
ERROR: COULD NOT READ FROM FILE SG3D.P
ERROR: COULD NOT WRITE TO FILE S2D.P
ERROR: COULD NOT READ FROM FILE S2D.P
ERROR: COULD NOT WRITE TO FILE S3D.P
ERROR: COULD NOT READ FROM FILE S3D.P
ERROR: COULD NOT WRITE TO FILE SGT2D.P
ERROR: COULD NOT READ FROM FILE SGT2D.P
ERROR: COULD NOT WRITE TO FILE SGT3D.P
ERROR: COULD NOT READ FROM FILE SGT3D.P
INITIALIZE DD/D3D END
initializing sound...
creating dsound primary buffer
reading audio file
loading static sounds
sound initialized
INITIALIZING MIDI...
selecting device 0:TiMidity - TiMidity port 0, mid=255, pid=1,
midi data type: GENERAL MIDI
using midi data file: C:\ff7\Data\midi\midi.lgp
midiOutGetVolume returned: ffffffff
MIDI INITIALIZED
set music volume: 127
MIDI set volume: 127
10036743060f 127 = 127
set music volume: 127
MIDI set master volume: 100
MIDI set volume: 127
10036743060f 127 = 127
Entering MAIN
Exiting MAIN
START OF CREDITS!!!
INFO: C:\ff7\movies\eidoslogo.avi; rawvideo/null 364x353, 15.000000 FPS, duration: 0.066667, frames: 1
INFO: C:\ff7\movies\sqlogo.avi; mpeg4/mp3 640x480, 15.000000 FPS, duration: 247.788000, frames: 3717
set music volume trans: 127->0, step=60
MIDI set volume trans: 127->0; step=60
MIDI stop - OK
MIDI stop - OK
END OF CREDITS!!!
Entering MAIN
set music volume: 127
MIDI set volume: 127
10036743060f 127 = 127
Exiting MAIN
START OF MENU SYSTEM!!!
SET VOLUME 5: 127
ERROR: COULD NOT OPEN FILE C:\ff7\save/save02.ff7
ERROR: COULD NOT OPEN FILE C:\ff7\save/save03.ff7
ERROR: COULD NOT OPEN FILE C:\ff7\save/save04.ff7
ERROR: COULD NOT OPEN FILE C:\ff7\save/save05.ff7
ERROR: COULD NOT OPEN FILE C:\ff7\save/save06.ff7
ERROR: COULD NOT OPEN FILE C:\ff7\save/save07.ff7
ERROR: COULD NOT OPEN FILE C:\ff7\save/save08.ff7
END OF MENU SYSTEM!!!
Entering MAIN
Exiting MAIN
Field Start
MIDI stop - OK
INFO: C:\ff7\movies\opening.avi; mpeg4/mp3 1280x960, 15.000000 FPS, duration: 119.510167, frames: 1793
MIDI play: 2
reading midi file: OB.mid
current volume: 127
MIDI is playing SUCCESSFULLY!!!
Field Quit
Entering MAIN
Exiting MAIN
Entering FRAME_INITIALIZE SWIRL
Exitting FRAME_INITIALIZE SWIRL
Swirl sound_effect1
stop_sound
End of Swirl sound_effect1
Entering FRAME_QUIT SWIRL
Exitting FRAME_QUIT SWIRL
Entering MAIN
Exiting MAIN
[BATTLE] Entering FRAME_INITIALIZE
[BATTLE] Scene# 300
[BATTLE] Exitting FRAME_INITIALIZE
ERROR: COULD NOT WRITE TO FILE TF2D.P
ERROR: COULD NOT READ FROM FILE TF2D.P
ERROR: COULD NOT WRITE TO FILE TF3D.P
ERROR: COULD NOT READ FROM FILE TF3D.P
ERROR: COULD NOT WRITE TO FILE TG2D.P
ERROR: COULD NOT READ FROM FILE TG2D.P
ERROR: COULD NOT WRITE TO FILE TG3D.P
ERROR: COULD NOT READ FROM FILE TG3D.P
ERROR: COULD NOT WRITE TO FILE T2D.P
ERROR: COULD NOT READ FROM FILE T2D.P
ERROR: COULD NOT WRITE TO FILE T3D.P
ERROR: COULD NOT READ FROM FILE T3D.P
ERROR: COULD NOT WRITE TO FILE TGT2D.P
ERROR: COULD NOT READ FROM FILE TGT2D.P
ERROR: COULD NOT WRITE TO FILE TGT3D.P
ERROR: COULD NOT READ FROM FILE TGT3D.P
ERROR: COULD NOT WRITE TO FILE SF2D.P
ERROR: COULD NOT READ FROM FILE SF2D.P
ERROR: COULD NOT WRITE TO FILE SF3D.P
ERROR: COULD NOT READ FROM FILE SF3D.P
ERROR: COULD NOT WRITE TO FILE SG2D.P
ERROR: COULD NOT READ FROM FILE SG2D.P
ERROR: COULD NOT WRITE TO FILE SG3D.P
ERROR: COULD NOT READ FROM FILE SG3D.P
ERROR: COULD NOT WRITE TO FILE S2D.P
ERROR: COULD NOT READ FROM FILE S2D.P
ERROR: COULD NOT WRITE TO FILE S3D.P
ERROR: COULD NOT READ FROM FILE S3D.P
ERROR: COULD NOT WRITE TO FILE SGT2D.P
ERROR: COULD NOT READ FROM FILE SGT2D.P
ERROR: COULD NOT WRITE TO FILE SGT3D.P
ERROR: COULD NOT READ FROM FILE SGT3D.P
[BATTLE] Begin main battle loop

I'm not sure what's with those COULD NOT READ/WRITE FROM/TO FILE *.P. Aren't those files created at the root ff7 directory? I'll see if there's anything wrong there. Crash file is still blank, and emergency save isn't created.

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #3 on: 2009-06-07 01:57:41 »
Eventually I'll stop posting after myself, but it seems like the most logical thing to do right now.

This time, when I started the game, the crash didn't occur until the first soldier was halfway through his attack, and the machine gun sound was played and everything, so the only thing I can think of that might be causing the crash is camera movement, if only because the camera doesn't move before the crash. Then again, I also didn't pick an attack before the crash, so the camera might still be locked in place. Anyway, I don't see what's happening there. Anything I should investigate?

As to the file errors, I deleted all the existing *.P files and made sure the game had write permissions, and it recreated the files at next run, but the errors are still there. It's not a case-sensitivity issue or anything, so I don't see what's going on there either.

I'm seeing if Wine has any good ways of figuring out what's crashing.

[EDIT]
Gah, winedbg (the Wine debugger for applications run within Wine) is crashing and starting itself to debug itself and crashing again and again and so on. It's probably because I'm running 32 bit Wine on 64 bit Linux. I'll switch to a 32 bit linux installation and see if anything changes.
[/EDIT]
« Last Edit: 2009-06-07 02:02:43 by arew264 »

Re: OpenGL FFVII Graphics Driver and WINE
« Reply #4 on: 2009-06-07 02:54:50 »
Isn't Linux all binary code...?

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #5 on: 2009-06-07 03:01:38 »
Isn't Linux all binary code...?

Not sure what you mean. My installation of linux has all applications, libraries, and kernel compiled for a 64 bit processor, but Wine doesn't work when compiled as 64 bit (I don't remember exactly why), so I have Wine compiled for a 32 bit processor, and I have a number of libraries compiled for a 32 bit processor so Wine can run. However, this sort of setup means that many things that Wine expects to do simply can't be done because a 32 bit application cannot load and use 64 bit libraries.

If you're referring to this whole setup, Wine is a linux application that can parse and run Windows binaries. Windows has a binary format slightly different from Linux, so such a layer is needed. Wine also provides equivalents for many Windows dll's like DirectX and the Windows kernel, essentially recreating the Windows API. It forms a compatibility layer to run Windows applications, essentially translating Windows API calls into calls to Linux API calls.

Re: OpenGL FFVII Graphics Driver and WINE
« Reply #6 on: 2009-06-07 03:06:04 »
I thought linux wasn't user friendly and somewhat old fashioned... where you had to type in the commands?

Aali

  • *
  • Posts: 1196
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #7 on: 2009-06-07 03:27:38 »
Don't worry about it, this is on my todo list.

I know about the crash but I haven't figured out what's going on yet. I did not experience any of the other issues you had except for the slurry of errors about the .P files, which should be harmless.

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #8 on: 2009-06-07 03:29:09 »
Linux is whatever you make out of it. You can get the equivalent of a DOS prompt and run your system from there (as is done on many servers), or you can run a full desktop environment like KDE or Gnome and have 3d accelerated OpenGL graphics for gaming (or many variations in between). There are games made for Linux as well as Windows like Enemy Territory Quake Wars and other Quake derivatives, and there's the Wine project to let you run pure Windows games like Battlefield xx42 and Crysis on linux.
Linux is a full operating system that's every bit as capable as Windows. Yes, it isn't as user friendly, but it also isn't a black box.
For more, check out Wikipedia: http://en.wikipedia.org/wiki/Linux

Aali: which part of this is on your todo list?
« Last Edit: 2009-06-07 03:32:11 by arew264 »

Aali

  • *
  • Posts: 1196
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #9 on: 2009-06-07 03:46:08 »
Aali: which part of this is on your todo list?

Wine compatibility.

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #10 on: 2009-06-07 03:48:08 »
Ah, that's good to know. I'm about to fire it up in winedbg on my 32 bit laptop.

Aali

  • *
  • Posts: 1196
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #11 on: 2009-06-07 04:14:59 »
Well you wont have much luck, I'm pretty sure the problem is due to windows XP giving special treatment to ff7.exe (rename it and a similar crash occurs on windows)

I'm looking through the ACT database for a fix.

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #12 on: 2009-06-07 04:19:48 »
I'm hoping that i can get the API call that's crashing. It's possible that there isn't one, though, and (I hate to sound like a noob here), I assume FF7 doesn't have debugging symbols included? That would make it too easy.

Aali

  • *
  • Posts: 1196
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #13 on: 2009-06-07 04:22:53 »
It doesn't, and the crash can happen inside *or* outside an API call, there's nothing wrong with the API function, the parameters are simply incorrect.

arew264

  • *
  • Posts: 94
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #14 on: 2009-06-07 04:24:52 »
I dunno, I'm just hoping to get a clue. Sometimes that works, sometimes it doesn't.

Aali

  • *
  • Posts: 1196
    • View Profile
Re: OpenGL FFVII Graphics Driver and WINE
« Reply #15 on: 2009-06-07 04:33:14 »
So, it turns out FF7 has a few compatibility fixes, one of them a special "compatibility patch" made just for FF7. Any windows gurus who knows where you can find out anything about those, get in touch with me.

In the meantime, I'm going to make a memory dump of FF7 to see if XP is patching anything at load time.

:EDIT:

While I could not figure out what that special FF7 patch does, the good old EmulateWriteFile shim fixes the crashing problem. I will be implementing a fix for it in the driver.
« Last Edit: 2009-06-07 06:19:42 by Aali »