Wine crash at bursting screen

Eidolon

Member
The anti-hack (or whatever binary changes there have been) used in the Ephinea client causes the game to crash just after the Connecting text disappears. This has been a problem for years under the Schthack client. I know it's a bit of a steep request, but could this be fixed or removed? The game runs otherwise fine on my Mac via WineBottler. If not, that's fine too, I would instead do server development with the Teth EXEs. Thanks!

EDIT: On further research this is not a problem with the binary mods, and somehow people are able to run PSOBB under Wine other than the method I am using. The 12510 and 12513 binaries both crash at the same point. I guess I'll look further into it sometime.

Unmodified 1.24.3 apparently works (gameguard patched out of course).

The bug entry on Wine's bug tracker has existed for years and the particular crash is in the d3d8 implementation. Something changed between 1.24 and 1.25 which must have introduced different behavior for rendering the ship select screen or something. I would like to investigate this further by using wined3d on Windows and seeing how it crashes there, but I'm on campus at the moment so I don't have access to my desktop.

I'm sure it's not too complicated to fix. It's a call into d3d8_texture_2d_UnlockRect+0x5a, call *0x28(%edx) where edx=b5d6ffdf which ends up page faulting on 0xb5d70007. The source file in question with line highlighted. I'll need to run with debugging symbols to figure out the exact line but I assume it's on IDirect3DSurface8_UnlockRect since it's the only place using a function pointer and it's a macro for UnlockRect in the interface struct.

https://bugs.winehq.org/show_bug.cgi?id=12964#c143
 

Eidolon

Member
I've fixed the crash and gotten into the lobby successfully. You must build wined3d.dll from source and set WINEDLLOVERRIDE="wined3d=n" in your environment before starting PsoBB.exe.

Use this patch. http://pastebin.com/pVwFfLEs

Build with "make dlls/wined3d"

Warning: this uses up to 16 times the memory compared to normal PSOBB for textures. This is likely not a problem, but worth mentioning.
 

Sodaboy

Administrator
Staff member
Good job, because we didn't add anything special that would have caused you to have issues.

So, obviously a problem from 1.24 to 1.25, as you said. But no way we'd go to version 1.24 and loose a bunch of items and what not.
 

Eidolon

Member
It's still a hack and simply spoofs an undocumented feature of Direct3D with contiguous mipmap allocation (as the same issue happens in League of Legends, someone pointed me in that direction). The comments on the Bugzilla entry suggested it was antihack but it didn't seem like it, so here we are.

Unfortunately due to the way this fix works, for textures that do have more than 1 mip level, the later mips show up as entirely black (zeroed out) creating a bizarre black fog that is very near to the camera.

wm8UHLz.png


Finally, there's a performance issue that I haven't pinned down, but it's mostly gone at 640x480.
 

Sodaboy

Administrator
Staff member
Adjusting sliders and graphical quality using the options menu doesn't alleviate any of that?
 

Eidolon

Member
The fog can only be fixed by correctly uploading the mips (as mentioned, PSO assumes it can just write mips 1-3 appended to 0, which is not supported in wined3d yet). I can probably write a more elaborate patch that detects when PSO tries to upload multiple mips in mip 0 and separate them out correctly.

Turning off Advanced Effect fixes all performance problems. Game runs flawlessly other than the mipmaps problem. Like, better than Vista/7/8/10. The music doesn't screw up at the title screen, there's no problems with alt-tabbing, everything just works as it did in 2004.

Here is the modified d3d8.dll and wined3d.dll for Mac OSX El Capitan using the patch I shared. Drop in the PSOBB folder on your mac, and you shouldn't have to change any DLL override settings. This is obviously incomplete because of the mipmap bug, but I thought I'd share.

I haven't tested it much, but I just finished simulating the contiguous mipmaps. I'll upload the patches and Mac DLLs later.

https://pbs.twimg.com/media/CUjnVSEUAAAmo4M.png:large
 

Aleron Ives

Member
Eidolon said:
The music doesn't screw up at the title screen, there's no problems with alt-tabbing, everything just works as it did in 2004.
What about typing? Do both the IME and direct input work?
 

Eidolon

Member
Typing works on both Linux and Mac. IME does not work on Mac (the game seems to pick up on it but compose input only typed latin characters. US keyboard, Japanese IME). Unable to test IME on Linux since I don't have it set up but I assume it doesn't work. Mac overrides the function keys (not even Fn+F11 works) so I don't know if direct input works there, but F11 did work on Linux. Controllers work on Linux, didn't test on Mac.

Here's the patch for wine's source, and some brief instructions. https://gist.github.com/Furyhunter/d80373b08f45e43f82e6
 
Kudos to you, Eidolon. I just switched over my gaming rig to run Linux and I was disappointed when I couldn't get Wine to run PSO and the bug tracker didn't have any solutions. I'll try your fix.
 

Mylandra

Member
The regular exe everyone is using has been patched so language is forced to latin due to a bug preventing you from typing these characters at all. Doing so technically broke chinese/japanese which is kinda the opposite of what initially worked. Fully working patches for this exist, but aren't in use in any of the popular private servers. Some of these servers even ban you for using foreign languages so I do not exactly recommend this unless you have approval from the administrator.
 

Sodaboy

Administrator
Staff member
Mylandra said:
The regular exe everyone is using has been patched so language is forced to latin due to a bug preventing you from typing these characters at all. Doing so technically broke chinese/japanese which is kinda the opposite of what initially worked. Fully working patches for this exist, but aren't in use in any of the popular private servers. Some of these servers even ban you for using foreign languages so I do not exactly recommend this unless you have approval from the administrator.
Luckily, this server supports multiple languages and even patches your client automatically to Japanese should you set your language preference to that. It even loads all the quests in Japanese too.
 

Mylandra

Member
Aleron Ives said:
Did you ever get the Kanji popup menu working, or did somebody else fix it?
Last I remember, this was already part of the original game, you don't have anything to do about it. You have to remember the client being used is also the one that was used on the japanese servers. I'm surprised no one else even bothered to make a proper fix for this up to this day, I made this one back in 2007 for people using Vista while never even logging on that OS nor did I know how to program at that point lol I could give everyone the proper fix, I just felt it was pointless at this point.

Sodaboy said:
Luckily, this server supports multiple languages and even patches your client automatically to Japanese should you set your language preference to that. It even loads all the quests in Japanese too.
I'm guessing if this switches your game to the japanese client then it also gives you a client without those patches so that you can type japanese as well
 

Sodaboy

Administrator
Staff member
Mylandra said:
I'm guessing if this switches your game to the japanese client then it also gives you a client without those patches so that you can type japanese as well
Bingo.
 

Aleron Ives

Member
Unless BB got an update, the Kanji popup menu doesn't work unless you're on XP. You can still type Japanese, but you don't get the list of Kanji options for the kana you type. It doesn't work with Windows 7 on PSO PC, at least, but I've never tried BB on Win7.
 

Eidolon

Member
pig_stacks said:
can anyone explain how to do this do a complete noob please? specifically with where to insert the codes and such?

http://wiki.winehq.org/BuildingWine

You don't need any of the extra dependencies that are normally required to build all of Wine. When you're asked to run Make, you only need to run:

Code:
make dlls/wined3d dlls/d3d8
cp dlls/wined3d/wined3d.dll.so dlls/d3d8/d3d8.dll.so /path/to/PSOBB

Before running the compilation, you need to run this command as well:

Code:
git apply name-of.patch

at the root of the Wine source checkout with git, after saving the patch file somewhere.

If you are running on 64-bit, you need to do all of this inside a 32-bit virtual machine. I am personally doing this with Vagrant, and that is really straight-forward, just follow the instructions on their site and find a box image that suits your needs (same distribution version, but 32-bit) and run the compilation inside of the VM instead (preferably under /vagrant so your host OS can access the output). Don't bother with a multiarch GCC, that is a huge pain in the ass to set up when you can get a vagrant VM running in less than 10 minutes + download time.

Copy the d3d8.dll.so and wined3d.dll.so into your PSOBB directory, and rename them removing the .so part. Then run PSOBB under Wine.

Sadly I can't build Linux DLLs for anyone because there may be system library differences between platforms.
 
I'm working on building the dlls for Ubuntu Trusty / Linux Mint 17. At least I think it should work on both of these. I couldn't get it working at first but that's because I built the dlls from master and was trying to run them on Wine 1.6. I'm hoping to have a working solution before the weekend is over.

[EDIT]
Here are the dlls built on Trusty 32-bit for Wine 1.7.55. I used these on 64-bit Linux Mint 17.2 by just dropping them in the PSOBB directory. The game ran great during the ten minutes or so while I screwed around.
 
Top