Gamepad not working when ZSNES is out of focus! [SOLVED]

Gamepad acting up? Keyboard not responding properly? Can't get that other user to work? Read and post about it here.

Moderator: ZSNES Mods

Post Reply
FenixThe3rd
New Member
Posts: 3
Joined: Fri Mar 21, 2008 8:49 am

Gamepad not working when ZSNES is out of focus! [SOLVED]

Post by FenixThe3rd »

Hi all :)

As the topic name says, the gamepad doesn't seem to be working when ZSNES is out of focus, even though it says in emu notes that:

"* You can now use gamepad in the background without ZSNES having focus. [pagefault]"

When I saw these notes I was so happy, I could finaly use ZSNES with Dual View TV-Out Mode but was allmost hearthbroken to find out that this doesn't seem to be working.

So my question now is, is this a bug or is there a way to turn this feature on in the emu...?

I love ZSNES and would love to be able to run it in Dual View Mode, I can run Snes9x just fine in Dual View since it has the out of focus support thing, but 9x just isn't on the same quality level as ZSNES.

Thank you! :) ( in advance )
Last edited by FenixThe3rd on Sat Apr 12, 2008 7:58 am, edited 1 time in total.
FenixThe3rd
New Member
Posts: 3
Joined: Fri Mar 21, 2008 8:49 am

Post by FenixThe3rd »

Just a small update on this matter.

Yesterday I asked my brother who happens to be a programer to take a look at this problem, and it took him less then a minute to enable the Out of Focus function!! :shock:

Seems one only needs to modify a few lines in the code to enable this. :shock:

Good thing that ZSNES is open source ey ^ ^
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

It helps a lot if you post the changes in a diff file or the code that was changed. This is assuming you want it part of the next ZSNES version.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
FenixThe3rd
New Member
Posts: 3
Joined: Fri Mar 21, 2008 8:49 am

Post by FenixThe3rd »

I've been somewhat bizzy these last few weeks, so it totally slipped my mind to actually post the modification :oops:

My bro has compiled the modified code for those that don't like to mess around with sourcecode stuff.

Click here to download

PS: he didn't like the scanlines in the NTSC Filter and the fact that one needs to mess around with resolutions just to make them "almost" display corectly so he disabled them.


Anyways here's the code part:


Out of Focus:


In the file: src/win/winlink.cpp change:

Code: Select all

BOOL InputDeAcquire(void)
{

   if (KeyboardInput) KeyboardInput->Unacquire();
   if (JoystickInput[0]) JoystickInput[0]->Unacquire();
   if (JoystickInput[1]) JoystickInput[1]->Unacquire();
   if (JoystickInput[2]) JoystickInput[2]->Unacquire();
   if (JoystickInput[3]) JoystickInput[3]->Unacquire();
   if (JoystickInput[4]) JoystickInput[4]->Unacquire();
   if (device1 && device2 && !GUIOn2) MultiMouseShutdown();
      else if (MouseInput) MouseInput->Unacquire();
   InputEn = 0;
   return TRUE;
}
to:

Code: Select all

BOOL InputDeAcquire(void)
{

   if (KeyboardInput) KeyboardInput->Unacquire();
   if (JoystickInput[0]) JoystickInput[0]->Acquire();
   if (JoystickInput[1]) JoystickInput[1]->Acquire();
   if (JoystickInput[2]) JoystickInput[2]->Acquire();
   if (JoystickInput[3]) JoystickInput[3]->Acquire();
   if (JoystickInput[4]) JoystickInput[4]->Acquire();
   if (device1 && device2 && !GUIOn2) MultiMouseShutdown();
      else if (MouseInput) MouseInput->Unacquire();
   InputEn = 1;
   return TRUE;
}
NTSC Filter Scanlines Disabled:


In the file: src/video/ntsc.c change:

Code: Select all

	/* output second scanline darkened by 25% */
	#define PIXEL_OUT( x )\
	{\
		unsigned pixel;\
		SNES_NTSC_RGB_OUT( x, pixel, 16 );\
		line_out  [x] = pixel;\
		line_out2 [x] = pixel - (pixel >> 2 & 0x39E7);\
	}
to:

Code: Select all

	/* output second scanline darkened by 25% */
	#define PIXEL_OUT( x )\
	{\
		unsigned pixel;\
		SNES_NTSC_RGB_OUT( x, pixel, 16 );\
		line_out  [x] = pixel;\
		line_out2 [x] = pixel;\
	}
Last edited by FenixThe3rd on Sat Apr 12, 2008 8:05 am, edited 1 time in total.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Ok, I'll see about what I can do about this.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

For those of you wants this in the next version of ZSNES, if you know how to make the changes and compile, please let me know if that does work for you, and I'll see about making said changes.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
outovfocus
New Member
Posts: 2
Joined: Mon Sep 27, 2010 4:30 pm

Re: Gamepad not working when ZSNES is out of focus! [SOLVED]

Post by outovfocus »

I have a dual monitor setup and it'd be really great if I could get this working.

The problem is that I have no idea how to compile code or do all that technical stuff. (I tried but I am seriously am out of my depth unfortunately.)

Does anyone have a copy of ZSNES the out of focus code fixed? Care to share?

Or at least could anyone tell me where to begin on compiling the source code after the lines have been changed?

Thanks for your help.
outovfocus
New Member
Posts: 2
Joined: Mon Sep 27, 2010 4:30 pm

Re: Gamepad not working when ZSNES is out of focus! [SOLVED]

Post by outovfocus »

Still hoping to have some sort of word on this. :?:
Post Reply