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

Re: PSO PC Windowed: Correct aspect ratio

Post by TulioAdriano »

Well, who'd have thought... a simple program with barely 20 lines of code to resize the PSO window grew... and grew...

... And now thanks to the amazing support here, it's now a full fledged loaded/patcher capable of allowing online connection to sylverant, patching the fixes and switching the game from fullscreen into a window... all with a clean installation of PSO, no extra tools needed.

Image
Capture of the program after launching PSO.

Thanks to Tremcaster for the encouragement (I had the chance of meeting him on Altimira while testing the program with a clean PSO for the first time) and suggestions.

And billion thanks to BlueCrab for sharing his loader source code with me. Thanks to that this patcher became done so quickly.

This doesn't do the patching that blocks the mouse from being used, but on the other hand, PSO doesn't read global inputs so switching windows in game is not a problem.

There's a strange bug in Fullscreen mode... but I think it's Windows 10 related. It is described in the readme along with all the other instructions and descriptions of the new features.

I learned a bunch working on this program and hopefully I'll be able to improve and contribute with more stuff in the future. :)

The download like is here. I changed the name of the file so the old URL will only download the resizer that's meant to work with the windowed exe. I haven't made tests using the windowed exe with this launcher but it *should* work fine. This launcher is really meant to work with a clean installation of PSO though. If launching a windowed version of PSO causes any issues, PSO can be launched first and then upon opening the Launcher, the resize tools will still be available to tweak the window size.

Well, that's it for now. Comments, feedbacks, bugs? I'm all ears.
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 »

Amazing work there! No need to thank me, I'm the one who should be thanking you!!

-Bug-report-
I tried with a clean full exe and a modified window exe and both seem to be working fine... however...
Apparently something got broken in this new release that was working fine before: The Ratio setting under "Custom size".. when you switch from the default "4:3 Pixel Perfect" to this and you try to change the numbers, things get messed up.

Oh, and I think you forgot to include the readme text file :)
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 »

Ah... Fun to see my Mithos.dll floating around now. :lol:

That said, please don't forget that you have to release the source code along with each binary and give credit where credit is due (copyright message/license information in an about box, for instance), in compliance with the GPLv3. :wink:

Also, for those that don't know (which is probably everyone), assuming most of the patching for the new functionality was borrowed from my code, this will work with many versions of the pso.exe binary. When I was writing Mithos.dll (and the corresponding unreleased launcher Yggdrasill), I tested it with a bunch of different versions of the main game binary, including the one that comes on the CD release of the game (which is not the same one that most people end up using).
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 »

Just tried with PC NTE and it works. Thing is, you can online play online if you select online mode in the autorun.exe first, and offline if you run autorun.exe again and select offline mode. You have to go back and forward if you want to play one mode or the other.

Bluecrab, are going to release a simple loader when PC NTE becomes available on Sylverant? I suppose you won't modify pso.exe since that would alter the nte installer sega provided thus making it illegal to distribute right?
Instead maybe you could offer a solution to patch the ip via a run-time patch option like the ones Tulio implemented on his launcher?

I would picture something like this:
Image

I wonder how you're going to manage PC NTE SNAKs... :roll:
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 again, sorry for forgetting the readme.txt, the link to the source code is there. But here's the direct one: https://bitbucket.org/tulioadriano/2dpsolauncher

I noticed that bug now. I think I know what it's causing it. I'll work on a fix for it ASAP. Also it's already set to connect to Sylverant... except... I don't know what NTE is. :D

Thanks a lot!
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:Also it's already set to connect to Sylverant... except... I don't know what NTE is. :D
Check out this topic.
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 »

Treamcaster wrote:Instead maybe you could offer a solution to patch the ip via a run-time patch option like the ones Tulio implemented on his launcher?
The patch he implemented in his launcher is actually my code from my (unreleased) launcher. :wink:

As for serial numbers and whatnot, haven't even looked at all. It's just not high on my list of things to do.
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 »

BlueCrab wrote:
Treamcaster wrote:Instead maybe you could offer a solution to patch the ip via a run-time patch option like the ones Tulio implemented on his launcher?
The patch he implemented in his launcher is actually my code from my (unreleased) launcher. :wink:

As for serial numbers and whatnot, haven't even looked at all. It's just not high on my list of things to do.
Interesting, thanks for sharing your code!

I was looking into NTE reg entries and it doesn't have any ACCESS nor SERIAL entries as the full version does...
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 »

Yep, my code taps straight into BlueCrab technology.

Updated the program, now the bug messing up the custom resolution input is gone. Try it and let me know.

I read the topic and still one question remain: is that NTE the network trial edition? :D If so, now everything is clear, and based on what BlueCrab said, the patcher should be compatible with a wide scope of executables, including the pre-patched ones.
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 seems to be fixed now, thanks ;) I don't see the fullscreen bug you reported in the readme though.. (running w8.1). Might be a w10 issue like you said.
TulioAdriano wrote:
I read the topic and still one question remain: is that NTE the network trial edition? :D If so, now everything is clear, and based on what BlueCrab said, the patcher should be compatible with a wide scope of executables, including the pre-patched ones.
Yeah there are various NTEs for PC/GC/DC and they're all unique. Sega released 2 demos back in the day for PSO PC: NTE (Network Trial Edition) and an offline-only demo containing just the forest map.

NTE topics:
viewtopic.php?f=75&t=102447
viewtopic.php?f=75&t=103047

However your loader does not patch the nte pso.exe IP to Sylverant.net since it is in another location inside the .exe... but even if it did we wouldn't be able to go online because:
Aleron Ives wrote:Sylverant requires registration, and the NTE has no serial number or access key, so even if you did redirect the game to connect here, you'd be blocked. ;) BlueCrab would need to add an exception to the server to allow NTE users to connect by automatically assigning them temporary Guild Card numbers. The NTE probably connects on a different port, too, so Sylverant would need to be able to respond to it.
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 »

TulioAdriano wrote:This doesn't do the patching that blocks the mouse from being used, but on the other hand, PSO doesn't read global inputs so switching windows in game is not a problem.
Uh, yes it does, which is why the patch to disable the mouse exists. If you don't disable the mouse, you can't actually multitask, because PSO constantly steals the mouse cursor and places it in the center of your screen (so you can use it to move by dragging the cursor while holding the left button). Is this a Windows 10 quirk, or did you patch the window to no longer have global focus and to not blink in the task bar when minimised? I'm guessing it's the latter, as I think BlueCrab's loader already did those things.

One thing I wonder if you could do would be to add a "borderless full screen" option. As everybody knows, PSO isn't smart enough to hold its aspect ratio in full screen, so it will stretch to the dimensions of your monitor. You can play in a window, but then you don't get the same kind of immersive "console" experience. It would be pretty spiffy if you could add a borderless full screen option to automatically scale the window to fit the dimensions of your screen and then add black borders to pad the unused portions of your monitor (including covering the window borders and title bar). Dolphin is able to do this with GC/Wii games, so you might have a look at its code if you're not sure how to do such a thing (and want to do it).

The only other potential missing feature I guess would be the ability to have the PSO window hold its aspect ratio when you click and drag it, so you can scale it to whatever dimensions you like without having to worry about distorting the window (unless that's what the lock ratio checkbox does?).
"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 »

Aleron Ives wrote:Uh, yes it does, which is why the patch to disable the mouse exists. If you don't disable the mouse, you can't actually multitask, because PSO constantly steals the mouse cursor and places it in the center of your screen (so you can use it to move by dragging the cursor while holding the left button). Is this a Windows 10 quirk, or did you patch the window to no longer have global focus and to not blink in the task bar when minimised? I'm guessing it's the latter, as I think BlueCrab's loader already did those things.
I don't know what I did, hehe but running on a clean EXE installed from the installation disc, I don't have that issue. I had it when I was used that "psoexe_vista7window.zip", but here I'm typing this message as PSO runs on the other monitor and the mouse input and keyboard strokes are not being captured at all. What I did was to remove all vestiges of PSO from my computer (that includes the registry keys) and then doing a clean install. All I did after that was to run the loaded, set the SN/AK and launch PSO. So far multitasking has been a breeze, but I don't believe that cleaning the reg keys is necessary, perhaps just a clean exe.
Aleron Ives wrote:One thing I wonder if you could do would be to add a "borderless full screen" option. As everybody knows, PSO isn't smart enough to hold its aspect ratio in full screen, so it will stretch to the dimensions of your monitor. You can play in a window, but then you don't get the same kind of immersive "console" experience. It would be pretty spiffy if you could add a borderless full screen option to automatically scale the window to fit the dimensions of your screen and then add black borders to pad the unused portions of your monitor (including covering the window borders and title bar). Dolphin is able to do this with GC/Wii games, so you might have a look at its code if you're not sure how to do such a thing (and want to do it).
Now that I've gained control of PSO display I want to study how to add a few things here and there. They include a letterboxed full screen and hopefully antialias, so that people don't need to set pixel perfect resolutions to get it looking good. I experimented with antialias yesterday but so far, enabling it is crashing PSO. :(
Aleron Ives wrote:The only other potential missing feature I guess would be the ability to have the PSO window hold its aspect ratio when you click and drag it, so you can scale it to whatever dimensions you like without having to worry about distorting the window (unless that's what the lock ratio checkbox does?).
With auto-size enabled, you could use the updown controls to make the window grow or shrink in aspect ratio at will. I know it's not as practical as resizing directly from the PSO window, but all in due time. I'm still grasping the API hooking techniques and soon enough I'll hook up windows events so that I can make it possible to intercept the windows resize messages and adjust the window size accordingly. :)
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 »

TulioAdriano wrote:I don't know what I did, hehe but running on a clean EXE installed from the installation disc, I don't have that issue.
You would never want to do that, though. For one thing, the original pso.exe will still delete your Meseta if the game crashes for any reason in online mode. Newer pso.exe versions don't do that anymore.
TulioAdriano wrote:Now that I've gained control of PSO display I want to study how to add a few things here and there. They include a letterboxed full screen and hopefully antialias, so that people don't need to set pixel perfect resolutions to get it looking good. I experimented with antialias yesterday but so far, enabling it is crashing PSO. :(
You have to enable AA through the graphics driver AFAIK, so the method will probably be different depending upon which graphics vendor supplied the GPU for the PC. I have a guide on how to enable AA/AF/Vsync for nVidia cards here.
"Fear the HUnewearl."
Image
tueidj
Insane DCEmu
Insane DCEmu
Posts: 115
Joined: Wed Aug 15, 2012 12:05 pm
Has thanked: 0
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by tueidj »

TulioAdriano wrote:They include a letterboxed full screen and hopefully antialias, so that people don't need to set pixel perfect resolutions to get it looking good.
You want pillarboxing (black borders on sides), not letterboxing (black borders on top+bottom).
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 »

Ah, of course, these names... :P

Small update to the program, now all screenshots are in native resolution rather than the window size, just like PSO would do it. ;)

Did some more experimenting with modifying the dx parameters but it isn't going well. I better study it a little more before poking around. As for the driver pso profile for AA, although I'm running on an ATI card, I tried it before I started writing the resizer program... the thing is... whenever I set the AA settings, the driver window crash (!). This isn't a good sign... and I made sure to update the drivers right before I started my tests... This could be related to Windows 10 though. I'm running on a 2011 laptop so it shouldn't be happening.

Other than that, spent some quality time this afternoon with Treamcaster and (Little One) on Altimira. For those who wonder, I always play with a FOmarl character named LAYA.
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 »

tueidj wrote:You want pillarboxing (black borders on sides), not letterboxing (black borders on top+bottom).
No I don't. Not all of us use 16:9 monitors, you know.
TulioAdriano wrote:whenever I set the AA settings, the driver window crash (!).
I wonder if PSO is even sophisticated enough to be able to be AAed in a window. On Windows 7 at least, the game looks horrible in window mode: the entire screen gets massively aliased, as though the image is made with sprites from a 16-bit game that are being upscaled. Even the SEGA logo becomes jagged. It doesn't happen on XP, though, so I don't know if it's a flaw with the window mode hack or if 7 is having trouble with a D3D8 game.
"Fear the HUnewearl."
Image
tueidj
Insane DCEmu
Insane DCEmu
Posts: 115
Joined: Wed Aug 15, 2012 12:05 pm
Has thanked: 0
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by tueidj »

Aleron Ives wrote:No I don't. Not all of us use 16:9 monitors, you know.
Sounds like you are, just not with the proper orientation.
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 »

Nope. Mine is 5:4.
"Fear the HUnewearl."
Image
tueidj
Insane DCEmu
Insane DCEmu
Posts: 115
Joined: Wed Aug 15, 2012 12:05 pm
Has thanked: 0
Been thanked: 0

Re: PSO PC Windowed: Correct aspect ratio

Post by tueidj »

So why would that need vertical padding to properly display a 4:3 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 »

So i decided to test this and it's not really working.

When i tick the checkbox to make this windowed (despite already using a window mode) the launcher gives an error, i'm not sure if it's because i'm trying to use window on window mode or if it will work if i grab the fullscreen exe, but for now i get this: (unticking the window part, the game launches)
Spoiler!
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: Process has exited, so the requested information is not available.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_Threads()
at PsoWindowSize.frmResizer.cmdLaunch_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1022 (RTMGDR.030319-1000)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
PsoWindowSize
Assembly Version: 1.2.1.0
Win32 Version: 1.2.1.0
CodeBase: file:///C:/Programas/SEGA/PhantasyStarOnline/PsoWindowSize.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1002 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1001 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1001 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1015 (RTMGDR.030319-1000)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1015 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
EasyHook
Assembly Version: 2.7.4761.0
Win32 Version: 2.7.4761.0
CodeBase: file:///C:/Programas/SEGA/PhantasyStarOnline/EasyHook.DLL
----------------------------------------
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Web
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1022 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Screenshots work even in window mode but i can't have the launcher on top of the window otherwise it appears on top of the screenshot
Spoiler!
Image
*tries to run the game in higher resolutions*
The screenshots always come at 640x480 it seems
Yes i know it was likely not to work, but i had to try anyway.
Spoiler!
Image
Image
Post Reply