Linux support

53pages on
this wiki
Add New Page
Talk2 Share

Linux support for SWR & Soku Edit

Directly, there isn't any, but you can get the game to run under Wine. Sort of. This page contains workarounds to make it run, but it's very much in-development.

  • Requirements
  • A recent Wine version, such as 1.1.28, probably helps.
  • d3dx9_33.dll needs to be supplied, as Wine does not properly support D3DX9 yet. This can be extracted from the install CD with a cab utility.
  • 32-bit Linux only. 64-bit platforms will fail, unfortunately, due to the DLL injection used. If you have an alternate functioning method I'd like to hear it.
  • Touhou Hisouten ~ Scarlet Weather Rhapsody
  • Japanese
  • English
  • Touhou Hisoutensoku

Later I'll integrate a wine test to the dll so it's all one code base. In the meantime, deal with it.

Bugs Edit

This is a list of known bugs regarding the game, and any relevant information on them.

Resolved bugs Edit

  • NVIDIA freeze on startup
Game freezes on startup when using NVIDIA drivers. (Same for Patchcon and Higurashi Daybreak) This is the one that most people complain about.
The bug:
This is a hilarious combination of several different bugs. If you're not into technical explanations, just skip ahead.
First, there's a bug in NVIDIA's libGLcore. During glXCreateContext it does this:
        leal        0x2ac(%esp),%esi
        leal        0x2b0(%esp),%ecx
195230: movl        0x2a8(%esp),%eax
195237: movl        %eax,0x2a4(%esp)
19523e: flds        0x2a8(%esp)
195245: fmul        %st(1),%st 
195247: fstps       0x2a8(%esp)
19524e: flds        0x2b0(%esp)      
195255: flds        0x2a8(%esp)      
19525c: faddp       %st,%st(1)    
19525e: fstps       0x2ac(%esp)   
195265: movl        0x0(%esi),%edx
195267: movl        0x0(%ecx),%eax
195269: cmpl        %eax,%edx
19526b: jnz 195230
Those of you with experience programming floating point code are probably facepalming already. The short answer is that it's directly equating floating point values which is incredibly stupid.
While this exact code is called on every context creation, it clearly doesn't cause anything problematic for most non-Tasofro apps. This is because of the FPU rounding mode. In the default setting, it will always converge because the two values are constants. However, Tasofro sets the FPU Control Word to 0A7F at some point, which means it always rounds up rather than rounds to nearest. This means that the value will never converge. So it just gets stuck in an infinite loop.
The fix:
FPUCW 0A7F -> FPUCW 027F during first call to IDirect3DDevice::SetFVF(), resetting the rounding mode to default, when the relevant context is created. Or the entire code block that is called at th123_102.41DAD7 can also be wrappered by this.
The fix in the DLL is incomplete at this time, it'll still freeze sometimes. Need to put a wrapper on a lot more d3d calls/threads than I have at this time. (I would just find and kill the 0A7F completely, except netplay synchronization is an issue.)
  • Crashes in certain menus and when Sanae is picked
When entering various menus in the game or entering any fight where Sanae is involved, the game will immediately crash.
The bug:
th123's GetGlyphOutline() code does not check to see if it returned an invalid glyph, since this never happens on Windows. So, whenever any text includes a glyph that is returned as invalid by wine, such as a space, the game will just crash with an integer divide by zero.
The fix:
Override GetGlyphOutline() and return a faked response for spaces.
  • The game runs too slowly
Instead of running at about 60-62fps, like the game is supposed to, it'll run closer to 53fps. This is not ideal.
The bug:
This seems to be a wine issue. The game calls timeBeginPeriod with a timer period of 16ms and then simply waits for the events to roll in, which is fairly standard. But unfortunately it's getting something closer to a 19ms period, which is frankly just strange.
The fix:
I hacked around this by setting the timer period to 14ms. This oddly makes it run at right around 16ms exactly, leading to a steady 62-63fps. Which is close enough for use, really. For a constant 60fps turn on vsync in your video drivers.
  • Missing textures with AIGLX:
With AIGLX in use many textures are just outright missing. They are not rendered incorrectly, they're simply just not there. However, not all are invisible, which is honestly a bit confusing.
The bug:
Older drivers don't handle the game properly.
The fix:
Update your drivers.

Unresolved bugs Edit

  • Shadows don't display and many bullets are invisible
Anything that is rendered with depth buffer use, such as shadows, Reimu 2B/2C, Sanae 6C, etc show a only one pixel wide chunk of the texture.
The bug:
Unknown. Forcing a call to SetViewport() at the right place seems to fix it for most of the cast, but then Utsuho comes along and it completely ceases to work again. Is this related to the depth buffer itself, the depth function, or what?
This is also most likely the bug that is causing PatchCon to be invisible when I get it to run with the freeze workaround.
  • Freezes when canceling netplay host or connection
When you host a server or try to connect to a server, and then cancel with the escape key, the game freezes and gets stuck in an infinite loop. Music continues to play. Actual netplay still works fine.
The bug:
Unknown. Probably that a winsock call is getting hung up somewhere. Either way it doesn't want me to debug it.
  • The game crashes when I close the window
If you close the window while the game is running it'll probably crash and leave a zombie process behind that will prevent you from clicking on the stupid message box Wine brings up. You'll likely need to run 'pkill th123' or something to get it working again. This does not occur when you exit normally.
The bug:
Seems to be a threading issue: Wine tries to create another child context after the current ones have been deleted, since apparently the th123 render thread is still going, fails, and summarily explodes.
I don't have a fix for this at this time, just exit the game normally or kill the game's process.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.