win32: dont screensave while using gamepad

This commit is contained in:
zeromus 2009-12-20 20:56:44 +00:00
parent 0490039779
commit 3f59a0b5d4
4 changed files with 25 additions and 7 deletions

View File

@ -1,4 +1,4 @@
0.9.5 -> 0.9.6 (r3075-r3153-r3xxx)
0.9.5 -> 0.9.6 (r3075-r3197-r3xxx)
General/Core:
bug: emulate keypad interrupt
@ -8,8 +8,10 @@ General/Core:
bug: fix vectest
bug: fix lid savestate desync
bug: fix texcache memory GB explosion when games use tons of tiny 3d sprites
bug: fix huge rerecording movie file handle leak
enh: support devkitpro argv
enh: add gbaslot-rom commandline
enh: add EXXXXXXX cheat codes
Graphics:
bug: fix a mistakenly rendered OBJ window
@ -18,9 +20,11 @@ Windows:
bug: fix 16bpp display
bug: more fixes to multi-gamepads
bug: cheat windows robustification
bug: fix that sticky pause state when resetting and loading roms
enh: dont screensave while using gamepad
enh: add EPX and EPX1.5X resize filters
enh: add a japanese translation which will soon be stale like the others
enh: add fancy printscreen with emulator info on it
enh: add fancy ctrl+printscreen with emulator info on it
enh: add "lockdown" window mode to keep window safe from fast stylus action
Linux/OSX:

View File

@ -28,7 +28,6 @@
#include <algorithm>
#include <string>
#include <vector>
//#include <sstream>
#include <Winuser.h>
#include <Winnls.h>
@ -83,6 +82,7 @@
#include "video.h"
#include "aggdraw.h"
#include "agg2d.h"
#include "winutil.h"
//tools and dialogs
#include "pathsettings.h"
@ -3013,10 +3013,6 @@ void WavRecordTo(int wavmode)
NDS_UnPause();
}
static BOOL OpenCore(const char* filename)
{
char LogicalName[1024], PhysicalName[1024];
@ -3820,6 +3816,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_SYSKEYDOWN:
case WM_CUSTKEYDOWN:
{
//since the user has used a gamepad,
//send some fake input to keep the screensaver from running
PreventScreensaver();
int modifiers = GetModifiers(wParam);
wParam = PurgeModifiers(wParam);
if(!HandleKeyMessage(wParam,lParam, modifiers))

View File

@ -53,6 +53,19 @@ void GetINIPath()
}
}
void PreventScreensaver()
{
//a 0,0 mouse motion is indeed sufficient
//i have been unable to notice any ill effects
INPUT fakeMouse;
fakeMouse.type = INPUT_MOUSE;
fakeMouse.mi.dx = fakeMouse.mi.dy = 0;
fakeMouse.mi.dwFlags = MOUSEEVENTF_MOVE;
fakeMouse.mi.time = 0;
fakeMouse.mi.dwExtraInfo = 0;
SendInput(1,&fakeMouse,sizeof(INPUT));
}
void WritePrivateProfileBool(char* appname, char* keyname, bool val, char* file)
{
char temp[256] = "";

View File

@ -28,5 +28,6 @@
extern char IniName[MAX_PATH];
void GetINIPath();
void PreventScreensaver();
#endif