Secondary Monitor (patch by mysoft)

General area for talk about ZSNES. The best place to ask for related questions as well as troubleshooting.

Moderator: ZSNES Mods

Post Reply
mysoft
New Member
Posts: 4
Joined: Fri May 09, 2014 1:34 am

Secondary Monitor (patch by mysoft)

Post by mysoft »

ok, i wanted to play zsnes on my secondary monitor... since zsnes doesnt support that
i had to forcefully make it work, and so i did... but since zsnes seems to do a lot of stuff
that doesnt work properly while on secondary monitor (ALL related to moving window)
then i can make it work only fullscreen...

there is still people interested in that? while the new version that probabily will have support for that
doesnt come along?

thanks :)
Gil_Hamilton
Buzzkill Gil
Posts: 4267
Joined: Wed Jan 12, 2005 7:14 pm

Re: Secondary Monitor (patch by mysoft)

Post by Gil_Hamilton »

I... wait a sec... did you just dig in, solve your problem on your own, and then come in offering to help others instead of not doing anything, assuming it was our job to fix your problems, and then disappear into the mist?
You are my hero. Would that the world was full of people like you.


I'm sure someone is interested in the patch, though I can't say I am(For multiple reasons, including the fact that I don't have space for dual monitors right now. It's a barbaric lifestyle, I tell you what. ).
Squall_Leonhart wrote:
You have your 2s, 4s, 8s, 16s, 32s, 64s, and 128s(crash course in binary counting!). But no 1s.
DirectInput represents all bits, not just powers of 2 in an axis.


KHDownloads
mysoft
New Member
Posts: 4
Joined: Fri May 09, 2014 1:34 am

Re: Secondary Monitor (patch by mysoft)

Post by mysoft »

ok, so here it is:
Image

just extract the .7z onto zsnes folder.... and run the MonitorConfig executable
it will then have the option to ENABLE the patch (it modifies zsnesw.exe)
or disable the patch (it will restore zsnesw.exe to it's original state)
how to use is pretty simple just select monitor and resolution (for fullscreen)
and for windowed you're locked to use the monitor (desktop) size...
which is the recommended setting anyway :)
since while in windowed mode... you can't move the window anyway...

hopefully i didnt forgot anything :)

here are the downLoad links:
https://drive.google.com/file/d/0B2Dy5Jj3MfB3WUI2LXpqdUI5ZFU/edit?usp=sharing
or...
http://www.mediafire.com/download/ol9684xi9yvl18c/ZSnes-MonitorConfig.7z

Have Fun... e feel free to report any bug :)
Gonzo
Regular
Posts: 280
Joined: Wed Sep 22, 2004 3:46 am
Location: Tromaville

Re: Secondary Monitor (patch by mysoft)

Post by Gonzo »

Wait you actually went and made it? That's really cool.

I'd be testing it out myself, but I don't have two monitors. Anyway like Gil said, I'm pretty sure someone here is going to love you for it.
Yuber
Trooper
Posts: 417
Joined: Tue Jan 08, 2013 12:24 pm

Re: Secondary Monitor (patch by mysoft)

Post by Yuber »

That's pretty fucking impressive man. You're like the polar opposite of slore even though I felt bad for the guy. I only have one monitor too(that I use with my PC) but making your creation public like that is definitely cool.
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Re: Secondary Monitor (patch by mysoft)

Post by paulguy »

So, how does it work? Source code would be nice.
Maybe these people were born without that part of their brain that lets you try different things to see if they work better. --Retsupurae
mysoft
New Member
Posts: 4
Joined: Fri May 09, 2014 1:34 am

Re: Secondary Monitor (patch by mysoft)

Post by mysoft »

paulguy wrote:So, how does it work? Source code would be nice.


in case anyone cares.... :P

ok, so it changes a DLL in zsnesw.exe (shell32.dll) to make zsnesw load my DLL instead (MULTMON.dll) that's more friendly to AV's instead of injecting into the app or something.... (and zsnesw only has one function from that shell32.dll so i just had to wrap it)

then it DETOURS.... DirectDrawCreateEx function... so that i can select a DISPLAY device to use (as the emulator is heavily tied to a single display device). all the info about resoluton and which display device to use (by partial name) is stored on zsnesw.cfg (i reused one of the graphic pack PATH's to store the display name... sorry if you would require that... i didnt wanted to save setting on registry or create a INI file just for a single setting).

so now i can move the window to the secondary screen and it will work... but if you're on windowed and try to move it will move on the main display... i couldnt really fix that, so instead i just "blocked" moving, by make it thinks the size of the screen is the same as the size of the window (by Detouring GetSystemMetrics). also i had to ClipCursor to reside inside the window only (otherwise when you leave the window it doesnt easily go back. because the zsnes emulates the mouse cursor inside it's window in a different way that again was not friendly to the secondary monitor.)

and last if you change the window (alt+tab) or something, i then disable the mouse clipping to the window, so you can use a different program hehee also if the window is moved to a different place, i will move it back to the correct display, because otherwise it will hang the emulator.

last... but not really necessary for this hack, i just had it for myself and ended being released along.... i detoured the DirectDraw::WaitForVerticalBlank... and "emulated" it slight different, so that waiting for vsync will not use 100% of a core (by using DirectDraw::GetScanLine), and that way allowing the emulator to work more smoothly with vsync even at "RealTime" priority without being too hard on the system.

i will update the third post to include the source code, since you asked... (and sorry if my explaining was too technical hehehe), it's made in Freebasic (which gives a hint on why i avoided just modifying zsnesw source or something (maybe?)), just need to clean up the code a bit, is still in a "hurry" state eheheh :P
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Re: Secondary Monitor (patch by mysoft)

Post by paulguy »

Nah I got it. I wonder if other direct draw applications have this same problem and can be fixed similarly. It'd have to be made a bit differently to be a bit more universal I guess. I suppose dxgl does the job though.
Maybe these people were born without that part of their brain that lets you try different things to see if they work better. --Retsupurae
mysoft
New Member
Posts: 4
Joined: Fri May 09, 2014 1:34 am

Re: Secondary Monitor (patch by mysoft)

Post by mysoft »

paulguy wrote:Nah I got it. I wonder if other direct draw applications have this same problem and can be fixed similarly. It'd have to be made a bit differently to be a bit more universal I guess. I suppose dxgl does the job though.


heh yeah... as dxgl is emulating the dx without being direclty tied to hardware... (which is good and bad at same time), however i assume for windows 8.1 where that stuff is (creeply?) emulated dxgl is probabily wonderful! (when it works :P)
Post Reply