Maidens of the Kaleidoscope

~Hakurei Shrine~ => Help Me, Eirin! => Tech Support => Topic started by: Momiji on June 08, 2009, 10:07:44 PM

Title: Touhou on Wine Status
Post by: Momiji on June 08, 2009, 10:07:44 PM
For those of us that run Touhou games under Wine, in Linux, there are two major bugs keeping things from working correctly.  One, the in-game text isn't rendered properly, due to Wine's lack of a full implementation of Windows' Device Independent Bitmap engine.  Two, Wine doesn't fully implement a specific DirectX dll (d3dx9_36.dll) that many later Touhou games use.  Using a native Windows file will work to a certain extent, but it can cause other problems as well.

Well the first problem has been a longstanding Wine issue, and it looks like there's been some major work (http://bugs.winehq.org/show_bug.cgi?id=421) done on developing a working DIB engine.  Here (http://bugs2.winehq.org/attachment.cgi?id=21182) you can see the difference;  DIB engine disabled on top, enabled on the bottom.

As for the second problem, one of Wine's Summer of Code students is working on implementing texture, mesh, and font handling (http://socghop.appspot.com/student_project/show/google/gsoc2009/wine/t124024893863) in Direct3D.  Hopefully this will cover the texture loading routines that're missing.

Anyway, I hope that all of the longstanding Touhou on Wine bugs get solved this year, preferably soon.  I build Wine from their git repository, so I test how things work between different builds.  I'll post here with any updates.
Title: Re: Touhou on Wine Status
Post by: Momiji on June 12, 2009, 01:07:26 AM
An update:  I managed to get a Wine+DIB engine installer working.  It's a Gentoo ebuild, so if you're using Gentoo you can use it.  I just need to find a way to upload it somehow.  If you use Ubuntu there's a .deb here (http://bugs.winehq.org/show_bug.cgi?id=421#c193).  Whether or not it works, I don't know.

Anyway, the results aren't exactly perfect.  In general, you'll see the biggest difference with chat text and the music menu.  While before it looks practically invisible (see pictures above), it now alphas correctly.  But for me, all of that text is now very dark blue.  Some of the games didn't have problems before (mainly Seirensen), but now they do.  So YMMV.

Here's Bunkachou:
Before
(http://i280.photobucket.com/albums/kk172/MichikoEchidna/Misc%20Images/bunka_nodib-jun11-2k9.png)
After
(http://i280.photobucket.com/albums/kk172/MichikoEchidna/Misc%20Images/bunka_dib-jun11-2k9.png)

Doesn't look like much difference, the text is still impossible to read.  But it's definitely getting somewhere.

Outside of that, only 3 games don't work at this point (at least for me).  Suimusou and Hisouten still need a fully-functional d3dx9_36.dll, and Kaeizuka crashes when loading a character.

[Edit]  I've found a patch implementing the DirectX texture function needed by Suimusou and Hisouten, but it's a bit of a pain to use.  I'll work on getting my installer to merge it, and what kind've results I get with it plus the DIB engine patches.
Title: Re: Touhou on Wine Status
Post by: Starks on June 29, 2009, 02:30:17 AM
Where can I find the D3DXCreateTexture patch and is it better than the native dlls?

Edit: Is this it? http://bugs.winehq.org/attachment.cgi?id=21373
Title: Re: Touhou on Wine Status
Post by: Momiji on June 29, 2009, 05:41:00 AM
That'd be it.  I tried to convert that into an actual patch file for use with my Gentoo ebuild, and managed to get it working, but it doesn't seem to have any affect on SWR and IaMP.  So I'm still messing around with it.

[Edit]  Looks like there's been some changes to d3dx9_36, I'm going to need to regenerate my patch.
Title: Re: Touhou on Wine Status
Post by: Starks on June 29, 2009, 09:17:01 AM
Without D3DXLoadSurfaceFromMemory from the new git commits, this old patch is worthless.
Title: Re: Touhou on Wine Status
Post by: Momiji on June 29, 2009, 06:09:44 PM
Yeah, I'm going to regenerate my patch file so it doesn't remove anything new, I'll post it here once I'm done.
Title: Re: Touhou on Wine Status
Post by: Starks on June 30, 2009, 02:17:56 AM
Is there a way to have git do that or is it more or less a manual, painstaking process?
Title: Re: Touhou on Wine Status
Post by: Momiji on June 30, 2009, 05:32:40 AM
Git makes the patch, but it'll also remove the newer d3dx9 stuff.  So you have to do a little patch editing to keep it in there.
Title: Re: Touhou on Wine Status
Post by: Starks on June 30, 2009, 06:44:18 PM
I had tried doing it manually myself and wine compiled fine, but I was getting black screens during some of my apps that used dx9.
Title: Re: Touhou on Wine Status
Post by: Starks on July 05, 2009, 01:26:21 AM
Here's Wai Ling's new patch. I modified a few things so that it applies cleanly with the latest git.

http://bugs2.winehq.org/attachment.cgi?id=22189

While everything compiles fine, I can't get the new code working on my Intel card and Wine is giving nothing but a black screen and sounds when I run my games.

Apparently D3DXLoadSurfaceFromMemory is still needed.
Title: Re: Touhou on Wine Status
Post by: Momiji on July 06, 2009, 06:29:21 AM
Yeah, they're still working on the rest of that stuff under the GSoC project.

I updated my Gentoo ebuild with the complete patchset, everything compiled just fine.  SWR crashes, but IaMP seems somewhat useable.

Anyway, here's the ebuild and patchset in a tarball.  For anyone out there using Gentoo, just create your own private overlay and extract this into it (/usr/local/portage/private/app-emulation/wine/ is what I use for the ebuild, /usr/local/portage/private being my private overlay).

Just a heads up, for anyone that uses this, I've added two USE flags that toggle support for the two patchsets;  "dibengine" for the DIB Engine patch, and "dx9patch" for the d3dx9_36 patch.  So you can enable one or the other, or both, to experiment with them.  Just a heads up, my Portage programming skills are terrible, but hopefully this doesn't do anything crazy to your computer.  Lemme know if there're any problems with it.

Thanks for persueing the patch, hopefully this'll get into mainline Wine. =]
Title: Re: Touhou on Wine Status
Post by: Starks on July 07, 2009, 06:02:01 AM
Here's Tony's work.

http://tonwas.freefronthost.com/gsoc.php
http://neobrain.wordpress.com/
http://tonwas.freefronthost.com/gsocwork.tar.gz (June 16th and before LoadSurface code landed)

I shot him an email about a more up-to-date tarball with his LoadSurface work and he said it should be ready in a few days.
Title: Re: Touhou on Wine Status
Post by: Momiji on July 08, 2009, 12:27:18 AM
Awesome.  If the patch doesn't immediately make it into Git, I'll add it to the patchset.

Someone should make some Debian/Ubuntu and Redhat binaries for this. =o
Title: Re: Touhou on Wine Status
Post by: Momiji on July 09, 2009, 06:03:52 PM
I tried adding his patchset to my ebuild, but they fail to patch.  =/  Hopefully he releases his updated stuff soon, preferably into Git.

On the DIB engine side, Massimo (DIB engine dev) seems to be real busy IRL, so it looks like we might not see updates from him for awhile.  =[
Title: Re: Touhou on Wine Status
Post by: Momiji on July 22, 2009, 06:00:24 PM
Tony updated his blog (http://neobrain.wordpress.com/), with new stuff and his own Git tree.  Looks like he's going to start merging his work into mainline Wine now.
Title: Re: Touhou on Wine Status
Post by: Tengukami on July 23, 2009, 12:39:56 AM
Ah, that's good to hear. I'm happy to see we're not forgotten.
Title: Re: Touhou on Wine Status
Post by: Momiji on August 18, 2009, 05:10:54 PM
GSoC has ended, and it looks like Tony's (mostly) done with his work (http://neobrain.wordpress.com/2009/08/18/end-of-gsoc/).  Now he's to (hopefully) merge his 8000-some lines of code into Wine.
Title: Re: Touhou on Wine Status
Post by: arcanesign on August 18, 2009, 06:55:18 PM
GSoC has ended, and it looks like Tony's (mostly) done with his work (http://neobrain.wordpress.com/2009/08/18/end-of-gsoc/).  Now he's to (hopefully) merge his 8000-some lines of code into Wine.

Sounds pretty awesome. Since he's using git, it shouldn't take too long to merge it.
Title: Re: Touhou on Wine Status
Post by: BigBrain on August 20, 2009, 09:18:01 AM
Hi everyone,
Just registered to thank everyone here for your support :D

About my patches -  I already tried to integrate my D3DXLoadSurfaceFromMemory implementation into mainline once, but it got rejected (sometimes it can be somewhat hard to get patches in...) which was why I decided to focus on other work than integrating first.
The problem with D3DXLoadSurfaceFromMemory is that this functions handles conversion from and to all possible Direct3D pixel formats and also supports several different filters (linear, trilinear, box, etc), so getting the design right is quite a critical task. Thus it still might need some time to get that in, but I'm trying to get it in as fast as possible. The good point is, once I got D3DXLoadSurfaceFromMemory upstream, the remaining functions shouldn't be that much of a problem anymore.
Until then, everyone can still try out the implementation from my git repository at http://repo.or.cz/w/wine/d3dx9TW.git?a=shortlog;h=refs/heads/Merge by either downloading one of the snapshots (big download, at least 70 MB) or using these three commands on top of an already existing Wine tree (small download, this just fetches the necessary patches):
git remote add TextureRemote git://repo.or.cz/wine/d3dx9TW.git
git fetch TextureRemote
git checkout -b Merge TextureRemote/Merge


Best regards,
    Tony
Title: Re: Touhou on Wine Status
Post by: Tengukami on August 20, 2009, 09:20:05 AM
... so does this mean I can play SWR at last?

(Welcome to MoTK, by the by.)
Title: Re: Touhou on Wine Status
Post by: BigBrain on August 20, 2009, 09:42:12 AM
A D3DX9 implementation within Wine won't help much more than using a native dll, sorry :/
Title: Re: Touhou on Wine Status
Post by: Tengukami on August 20, 2009, 09:49:20 AM
I suck at fighting games anyway. Your efforts are appreciated.
Title: Re: Touhou on Wine Status
Post by: Momiji on August 21, 2009, 06:44:34 PM
Hi everyone,
Just registered to thank everyone here for your support :D
Awesome, and welcome. XD  I'll work on my Gentoo ebuild to see if I can get it to patch from your Git.  Anyway, thanks for all the work you're doing on Wine!  Hope to see your work merged in without problems.