PSO PC Windowed: Correct aspect ratio

Sylverant is a homebrew open source server for Phantasy Star Online. Dreamcast users still play PSO online with this server even today! This is the official forum for both the online game server as well as the open source project itself. Feel free to post and get a gathering started online! We can also show you how to get connected!

Moderators: BlueCrab, Aleron Ives

User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Hi everyone!

I've been feeling so welcome to the community and you guys gave me so much, I think it's time I give something back.

I'm trying to get my friends to play PSO with me (I got one person already, more to come soon) but obviously most of them don't have their DCs anymore, so the only choice is PSO for PC.

So I set out to setup it on my computer (I had a copy of PSO PC from around 2004) and I wanted to make sure I could make it run in Sylverant. Turns out it was quite easy with the executables available in PSO Palace so that was a great achievement.

The thing is... with these days wide screen monitors, PSO looks horrible, because it sets the monitor resolution to 640x480 and it displays stretched. I'm running Windows 10 which looks even worse because there's a constant bar on top. So my obvious choice was to run it windowed. It so happens that PSO, instead of launching on it's native resolution, seems to try to adapt to your screen size and make it proportional to it, thus getting stretched by wide screen monitors as well. Luckily the borders aren't locked, so you can run around with your mouse and grab the borders and move them until they reach precision, and make it look just right.

But let's agree that it's terribly inconvenient having to do that every time you launch the game. So I decided to write a small program to resize PSO to the correct aspect ratio, and resize the window for me, with pixel perfect precision.
Image
This is how the program looks right after it's
launched, see the strange window size that
looks stretched.
The program allows to select a pixel perfect preset (1x, 2x, and 3x the native 640x480 resolution) or a desired custom resolution.

This is how the game looks on all of it's native resolution glory.
Image

So that's it. For a detailed explanation about how the program works and how to use it there's a Readme included in the compressed file. I hope someone out there using windowed PSO on PC enjoys this program as much as me and my PSO buddies do. With that I think the game experience is more pristine, and it's free of the undesired stretching, for great justice!

You can download it here.

I welcome any suggestions and feedback to the program, I'm subscribed to this thread so you can post a reply here or PM me. If anyone would like to host the tool on their site, feel free to do so too.
There are 10 types of people. Those who understand binaries and those who don't.
User avatar
Aleron Ives
DCEmu Nutter
DCEmu Nutter
Posts: 870
Joined: Wed Jan 05, 2011 2:15 pm
Location: California
Has thanked: 0
Been thanked: 25 times
Contact:

Re: PSO PC Windowed: Correct aspect ratio

Post by Aleron Ives »

You can also use the window mode in deathrabbit's loader to do the same thing, at least if you want to use one of the common resolutions. I'm not sure how you're setting the size, but his loader makes assumptions about the size of the window border and sizes the window accordingly. If you simply size to 640x480, that includes the pixels used for the window border, so the AR of the actual game image won't be quite right. I'm not sure if there's a way to universally compensate for that regardless of the Windows theme you're using.

There's also a tool called Sizer that lets you set shortcuts for resizing any window to a particular shape. The reason window mode doesn't assume the correct AR or hold its AR when you stretch the window is that it's a hack. PSO PC was made to run full screen only, so the window mode patch is a bit, shall we say, primitive. It's also worth noting that window mode breaks the game's screenshot functionality, so you need something like Fraps to take screenshots if you use window mode.
"Fear the HUnewearl."
Image
User avatar
K_I_R_E_E_K
Mental DCEmu
Mental DCEmu
Posts: 302
Joined: Mon Oct 27, 2008 6:47 pm
Has thanked: 0
Been thanked: 3 times

Re: PSO PC Windowed: Correct aspect ratio

Post by K_I_R_E_E_K »

I actually use window mode a lot considering i do a lot of things in the background and having to alt tab everytime would be a pain.
For accuracy i guess your tool would be really nice, for me however i just change the shape of the window at my own will.

Fraps actually takes a screenshot at the correct resolution of the game, no matter what shape it is, however some of the programs that take screenshot will use the game's window to do it and having an incorrect ratio or size will result in some weird screenshots, so your tool will certainly fix that, trying to manually nail the correct shape (of the window) might be hard.
Image
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Aleron Ives wrote:I'm not sure if there's a way to universally compensate for that regardless of the Windows theme you're using.
My program does just that. It considers the size of the internal DC rather than the entire window. The calculation is simple, get the Window size, then the Client size. Subtract to find the difference (therefore finding the border sizes for your running windows/theme) and then adding that value to the desired resolution when resizing the window, so there's no assumption about the border size of a specific windows or theme. :)

I could possibly attempt to add a screenshot functionality, to eliminate the need of fraps. If anyone is interested, let me know.
There are 10 types of people. Those who understand binaries and those who don't.
Treamcaster
Insane DCEmu
Insane DCEmu
Posts: 148
Joined: Mon Jul 02, 2007 1:11 pm
Has thanked: 1 time
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by Treamcaster »

I'm glad you made this program, I'll be using it for sure, thanks!
I've always had window issues with pso.exe, even deathrabbits loader doesn't resize to the selected resolution. Maybe you could integrate a button to load pso.exe from your app?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PSO PC Windowed: Correct aspect ratio

Post by BlueCrab »

Heh, good to see some interesting programs coming from people around the server.

I'm assuming your program requires an exe already patched for windowed mode and doesn't work properly with a fullscreen exe?

EDIT: Also, just to let you know, your program doesn't appear to work in a base install of Wine. I'm guessing it uses .NET of some sort, since I see a bunch of stuff related to .NET exceptions. What version of the runtime does it require?
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Treamcaster wrote:I'm glad you made this program, I'll be using it for sure, thanks!
I've always had window issues with pso.exe, even deathrabbits loader doesn't resize to the selected resolution. Maybe you could integrate a button to load pso.exe from your app?
If someone tells me what the loader does, I sure can integrate it on my program.
BlueCrab wrote:Heh, good to see some interesting programs coming from people around the server.

I'm assuming your program requires an exe already patched for windowed mode and doesn't work properly with a fullscreen exe?

EDIT: Also, just to let you know, your program doesn't appear to work in a base install of Wine. I'm guessing it uses .NET of some sort, since I see a bunch of stuff related to .NET exceptions. What version of the runtime does it require?
Yeah it was built in C#.

I lowered the framework specs to the minimum possible, so it's using framework 2.0. It should work on most windows machines, but yeah, it requires the framework to be installed.

Considering the simplicity of this program I could really build it on anything (Visual Basic 6, c++) I just choose C# because it offers the quickest path to build an interface and it's more tailored for "modern" systems. VB would be the next choice since it's still quick to build the interface, but it also requires the VB runtime. .Net is quite standard these days so I'm pretty sure wine has some way of installing / mapping it.

The program will only resize an already patched windowed exe... I'm thinking about possible solutions to work with a fullscreen exe but I don't think it'd be easy since PSO switches the screen resolution to go fullscreen, etc...

Again, I'll research more and try improving it if there is interest from the community. Adding the screenshot button should be fairly simple... solutions over the fullscreen exe are a tad more complex... but I don't know that it's impossible.
There are 10 types of people. Those who understand binaries and those who don't.
User avatar
Aleron Ives
DCEmu Nutter
DCEmu Nutter
Posts: 870
Joined: Wed Jan 05, 2011 2:15 pm
Location: California
Has thanked: 0
Been thanked: 25 times
Contact:

Re: PSO PC Windowed: Correct aspect ratio

Post by Aleron Ives »

Call me old fashioned, but since PSO is technically compatible with Windows 98, I'm of the opinion that PSO tools should be as compatible as possible and not use .NET when it isn't necessary for the desired functionality. ;)

It is indeed possible to patch the exe for window mode in memory; that's what deathrabbit's loader does. You use it with a full screen pso.exe, and the loader supplies the window mode patch. Making a loader requires you to patch the registry keys for toggling online/offline mode, and that's about it.
"Fear the HUnewearl."
Image
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Sounds good.

I added screenshot functionality to my program, and based on your information about the launcher, added it as well. Now the program can launch PSO in Online or Offline mode and resize the window, as well as take screenshots, which will be saved on the same folder as the Screenshots from PSO would, same naming convention, same format.

As for patching it to a window, well, I must admit I don't have enough knowledge/information about how to do that yet, so I'll have to go on a quest to research it. For now, it's great to work with the windowed exe provided at PSO Palace.

As for using C#... well, as I said, it's for making interfaces quickly. I started this program yesterday morning so I haven't really spent much time on it, nevertheless the functions it does now are quite cool, and it will work with any computer that runs windows XP or above. (Techincally it runs on windows 98 too, but it requires some kernel updates.)

If there's really a demand for making this program work with a fullscreen exe and to run without the framework, I'll work on it. But I'd like to hear about the people who want to use it! :)

If there are any other functionalities it could perform, please tell me about it too.

Download the updated program here. it's the same URL as above.
There are 10 types of people. Those who understand binaries and those who don't.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: PSO PC Windowed: Correct aspect ratio

Post by BlueCrab »

I certainly don't have any problem with using C# or .NET. Heck... I wrote my own loader/patcher for PSO that is in C# (and requires a newer version of the .NET runtime than yours does). :wink:

For even more fun, my loader/patcher loads a .NET-based C# DLL into PSO to do some of the fun runtime patching that it does. :lol:

I'm not sure why it wouldn't work under Wine for me, as I definitely have the 2.0 runtime installed... Oh well, was worth asking anyway.
Treamcaster
Insane DCEmu
Insane DCEmu
Posts: 148
Joined: Mon Jul 02, 2007 1:11 pm
Has thanked: 1 time
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by Treamcaster »

TulioAdriano, your new version is great!! I'll definitely use it, it's probably the best loader around I would say.
I'll just point a few nitpicks if you don't mind: "Laucher" is misspelled; and in the buttons I would just put "Online" and "Offline".

Off-topic: Now that we're talking about pso.exe loaders, there's one neat loader out there that I don't know if many people are aware of its existence... check it out: http://www.sappharad.com/14-uncategoris ... al-release

Edit:
Suggestion: Just in case you have nothing more interesting to do, since this is not important at all, but I was thinking what other features your loader could have under the "Tools" section, I thought that maybe you could add "IP Patch"? Should be easy for you... "camera hack" would be interesting too. But that's probably more complicated and out of scope of a simple pso.exe loader...
Last edited by Treamcaster on Tue Aug 25, 2015 6:29 pm, edited 2 times in total.
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Hi Treamcaster,

I updated the launcher according to your suggestion.

I'd like to further improve the launcher, to make it eventually work with any PSO, patched or unpatched. It won't come out as fast as this one which basically started +/- 24 hours ago, but in time, if there's interest I'll surely continue developing it.
There are 10 types of people. Those who understand binaries and those who don't.
User avatar
K_I_R_E_E_K
Mental DCEmu
Mental DCEmu
Posts: 302
Joined: Mon Oct 27, 2008 6:47 pm
Has thanked: 0
Been thanked: 3 times

Re: PSO PC Windowed: Correct aspect ratio

Post by K_I_R_E_E_K »

I really liked if i had a launcher that would patch the exe with the high resolution version of PSO, sadly all i have are numerous exes that i use to replace the original, also the large majority are still alpha versions and have no hud adjustements, the exe that has partial hud adjustment only has it for 1 resolution and i was unable to figure out where these adjustments are made to make them available for other resolutions.
Still it's something to consider in the future.
Image
Treamcaster
Insane DCEmu
Insane DCEmu
Posts: 148
Joined: Mon Jul 02, 2007 1:11 pm
Has thanked: 1 time
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by Treamcaster »

K_I_R_E_E_K wrote:I really liked if i had a launcher that would patch the exe with the high resolution version of PSO, sadly all i have are numerous exes that i use to replace the original, also the large majority are still alpha versions and have no hud adjustements, the exe that has partial hud adjustment only has it for 1 resolution and i was unable to figure out where these adjustments are made to make them available for other resolutions.
Still it's something to consider in the future.
Mee too... that demo you had on your blog (link's broken) really showed up its potential, too bad nobody figured out yet how to adjust the hud.
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Step by step we add functionalities here and there, hopefully one day we can get that far.

For now, I've updated the program (same download url), added a button to launch the game options, screenshot shutter noise and auto resize checkbox.

Note that the program can be run before or after PSO is launched, it doesn't matter, if PSO is already running the program will detect it and make its functions available.

I'm studying some code sent by BlueCrab and understanding the basics of run-time patching. So far it seems quite daunting, so those fancy functions may take quite some time to appear, as I'm still new to all of these techniques.
There are 10 types of people. Those who understand binaries and those who don't.
Treamcaster
Insane DCEmu
Insane DCEmu
Posts: 148
Joined: Mon Jul 02, 2007 1:11 pm
Has thanked: 1 time
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by Treamcaster »

Bug report:
I had PSO running in the background when I launched your new loader and these windows kept popping up..
Image
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Sorry about that.

It seems I left one line from my prototype (handling PSO fullscreen) before I built that version.

It has been fixed. :)

Thansk for reporting.
There are 10 types of people. Those who understand binaries and those who don't.
Treamcaster
Insane DCEmu
Insane DCEmu
Posts: 148
Joined: Mon Jul 02, 2007 1:11 pm
Has thanked: 1 time
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by Treamcaster »

I'm glad you added the "Options" button, as I was going to suggest that.
Can you make your loader to remember the windows size settings from previous use? For eg. I normally set Custom Size to 800x600 every time I run the loader.
User avatar
TulioAdriano
DCEmu Freak
DCEmu Freak
Posts: 59
Joined: Tue Aug 18, 2015 9:32 am
Has thanked: 1 time
Been thanked: 2 times

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Yeah I thought I was going to need adding that sooner or later, so I might as well do it now. New update coming in a few hours. Anything else while I'm at it?
There are 10 types of people. Those who understand binaries and those who don't.
Treamcaster
Insane DCEmu
Insane DCEmu
Posts: 148
Joined: Mon Jul 02, 2007 1:11 pm
Has thanked: 1 time
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by Treamcaster »

TulioAdriano wrote:Yeah I thought I was going to need adding that sooner or later, so I might as well do it now. New update coming in a few hours. Anything else while I'm at it?
I guess it's all for now. Kireek should send you his high res pso.exe for you to check out. Maybe you two can work it out together.
Post Reply