2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** i_input.cpp
|
|
|
|
** Handles input from keyboard, mouse, and joystick
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2009-06-20 03:16:08 +00:00
|
|
|
** Copyright 1998-2009 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
// DI3 only supports up to 4 mouse buttons, and I want the joystick to
|
|
|
|
// be read using DirectInput instead of winmm.
|
|
|
|
|
|
|
|
#define DIRECTINPUT_VERSION 0x800
|
|
|
|
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0501)
|
|
|
|
#define _WIN32_WINNT 0x0501 // Support the mouse wheel and session notification.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#define __BYTEBOOL__
|
|
|
|
#ifndef __GNUC__
|
|
|
|
#define INITGUID
|
|
|
|
#endif
|
|
|
|
#include <windows.h>
|
|
|
|
#include <mmsystem.h>
|
2009-07-15 05:53:06 +00:00
|
|
|
#include <dbt.h>
|
2006-02-24 04:48:15 +00:00
|
|
|
#include <dinput.h>
|
2009-06-20 03:16:08 +00:00
|
|
|
#include <malloc.h>
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2009-05-15 10:39:40 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable:4244)
|
|
|
|
#endif
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Compensate for w32api's lack
|
|
|
|
#ifndef WM_WTSSESSION_CHANGE
|
|
|
|
#define WM_WTSSESSION_CHANGE 0x02B1
|
|
|
|
#define WTS_CONSOLE_CONNECT 1
|
|
|
|
#define WTS_CONSOLE_DISCONNECT 2
|
|
|
|
#define WTS_SESSION_LOCK 7
|
|
|
|
#define WTS_SESSION_UNLOCK 8
|
|
|
|
#endif
|
|
|
|
#ifndef PBT_APMSUSPEND
|
|
|
|
// w32api does not #define the PBT_ macros in winuser.h like the PSDK does
|
|
|
|
#include <pbt.h>
|
|
|
|
#endif
|
2009-06-11 03:41:24 +00:00
|
|
|
#ifndef GET_RAWINPUT_CODE_WPARAM
|
|
|
|
#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff)
|
|
|
|
#endif
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
#define USE_WINDOWS_DWORD
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "c_dispatch.h"
|
|
|
|
#include "doomtype.h"
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "i_input.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "i_sound.h"
|
|
|
|
#include "g_game.h"
|
|
|
|
#include "d_main.h"
|
|
|
|
#include "d_gui.h"
|
|
|
|
#include "c_console.h"
|
|
|
|
#include "c_cvars.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "m_misc.h"
|
|
|
|
#include "gameconfigfile.h"
|
|
|
|
#include "win32iface.h"
|
|
|
|
#include "templates.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "d_event.h"
|
2009-02-10 03:12:41 +00:00
|
|
|
#include "v_text.h"
|
2010-01-18 20:55:49 +00:00
|
|
|
#include "version.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
// Prototypes and declarations.
|
|
|
|
#include "rawinput.h"
|
|
|
|
// Definitions
|
|
|
|
#define RIF(name, ret, args) \
|
|
|
|
name##Proto My##name;
|
|
|
|
#include "rawinput.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-23 02:22:30 +00:00
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
#define INGAME_PRIORITY_CLASS NORMAL_PRIORITY_CLASS
|
|
|
|
#else
|
|
|
|
//#define INGAME_PRIORITY_CLASS HIGH_PRIORITY_CLASS
|
|
|
|
#define INGAME_PRIORITY_CLASS NORMAL_PRIORITY_CLASS
|
|
|
|
#endif
|
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
static void FindRawInputFunctions();
|
2009-07-15 05:53:06 +00:00
|
|
|
FJoystickCollection *JoyDevices[NUM_JOYDEVICES];
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern HINSTANCE g_hInst;
|
|
|
|
extern DWORD SessionID;
|
|
|
|
|
|
|
|
extern void ShowEAXEditor ();
|
|
|
|
extern bool SpawnEAXWindow;
|
|
|
|
|
|
|
|
static HMODULE DInputDLL;
|
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
bool GUICapture;
|
|
|
|
extern FMouse *Mouse;
|
2009-05-27 20:44:54 +00:00
|
|
|
extern FKeyboard *Keyboard;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool VidResizing;
|
|
|
|
|
|
|
|
extern bool SpawnEAXWindow;
|
|
|
|
extern BOOL vidactive;
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
extern HWND Window, ConWindow;
|
2006-02-24 04:48:15 +00:00
|
|
|
extern HWND EAXEditWindow;
|
|
|
|
|
|
|
|
EXTERN_CVAR (String, language)
|
|
|
|
EXTERN_CVAR (Bool, lookstrafe)
|
2009-06-20 03:16:08 +00:00
|
|
|
EXTERN_CVAR (Bool, use_joystick)
|
2010-09-14 17:28:18 +00:00
|
|
|
EXTERN_CVAR (Bool, use_mouse)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-27 22:57:21 +00:00
|
|
|
static int WheelDelta;
|
2010-08-08 01:53:41 +00:00
|
|
|
extern bool CursorState;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern BOOL paused;
|
|
|
|
static bool noidle = false;
|
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
LPDIRECTINPUT8 g_pdi;
|
|
|
|
LPDIRECTINPUT g_pdi3;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
BOOL AppActive = TRUE;
|
|
|
|
int SessionState = 0;
|
|
|
|
|
|
|
|
CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
|
2010-01-18 20:55:49 +00:00
|
|
|
CUSTOM_CVAR(Bool, norawinput, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
|
|
|
{
|
|
|
|
Printf("This won't take effect until "GAMENAME" is restarted.\n");
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
extern int chatmodeon;
|
|
|
|
|
|
|
|
static void I_CheckGUICapture ()
|
|
|
|
{
|
|
|
|
bool wantCapt;
|
|
|
|
|
|
|
|
if (menuactive == MENU_Off)
|
|
|
|
{
|
|
|
|
wantCapt = ConsoleState == c_down || ConsoleState == c_falling || chatmodeon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wantCapt = (menuactive == MENU_On || menuactive == MENU_OnNoPause);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wantCapt != GUICapture)
|
|
|
|
{
|
|
|
|
GUICapture = wantCapt;
|
2009-05-27 20:44:54 +00:00
|
|
|
if (wantCapt && Keyboard != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-27 20:44:54 +00:00
|
|
|
Keyboard->AllKeysUp();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-14 17:28:18 +00:00
|
|
|
void I_SetMouseCapture()
|
|
|
|
{
|
|
|
|
SetCapture(Window);
|
|
|
|
}
|
|
|
|
|
|
|
|
void I_ReleaseMouseCapture()
|
|
|
|
{
|
|
|
|
ReleaseCapture();
|
|
|
|
}
|
|
|
|
|
2009-05-27 22:17:11 +00:00
|
|
|
bool GUIWndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
|
|
|
|
{
|
|
|
|
event_t ev = { EV_GUI_Event };
|
|
|
|
|
|
|
|
*result = 0;
|
|
|
|
|
|
|
|
switch (message)
|
|
|
|
{
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
case WM_SYSKEYDOWN:
|
|
|
|
case WM_KEYUP:
|
|
|
|
case WM_SYSKEYUP:
|
|
|
|
if (message == WM_KEYUP || message == WM_SYSKEYUP)
|
|
|
|
{
|
|
|
|
ev.subtype = EV_GUI_KeyUp;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ev.subtype = (lParam & 0x40000000) ? EV_GUI_KeyRepeat : EV_GUI_KeyDown;
|
|
|
|
}
|
|
|
|
if (GetKeyState(VK_SHIFT) & 0x8000) ev.data3 |= GKM_SHIFT;
|
|
|
|
if (GetKeyState(VK_CONTROL) & 0x8000) ev.data3 |= GKM_CTRL;
|
|
|
|
if (GetKeyState(VK_MENU) & 0x8000) ev.data3 |= GKM_ALT;
|
2009-08-08 00:36:35 +00:00
|
|
|
if (wParam == VK_PROCESSKEY)
|
|
|
|
{ // Use the scan code to determine the real virtual-key code.
|
|
|
|
// ImmGetVirtualKey() will supposedly do this, but it just returns
|
|
|
|
// VK_PROCESSKEY again.
|
|
|
|
wParam = MapVirtualKey((lParam >> 16) & 255, 1);
|
|
|
|
}
|
2009-05-27 22:17:11 +00:00
|
|
|
if ( (ev.data1 = MapVirtualKey(wParam, 2)) )
|
|
|
|
{
|
|
|
|
D_PostEvent(&ev);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (wParam)
|
|
|
|
{
|
2010-09-14 17:28:18 +00:00
|
|
|
case VK_PRIOR: ev.data1 = GK_PGUP; break;
|
|
|
|
case VK_NEXT: ev.data1 = GK_PGDN; break;
|
|
|
|
case VK_END: ev.data1 = GK_END; break;
|
|
|
|
case VK_HOME: ev.data1 = GK_HOME; break;
|
|
|
|
case VK_LEFT: ev.data1 = GK_LEFT; break;
|
|
|
|
case VK_RIGHT: ev.data1 = GK_RIGHT; break;
|
|
|
|
case VK_UP: ev.data1 = GK_UP; break;
|
|
|
|
case VK_DOWN: ev.data1 = GK_DOWN; break;
|
|
|
|
case VK_DELETE: ev.data1 = GK_DEL; break;
|
|
|
|
case VK_ESCAPE: ev.data1 = GK_ESCAPE; break;
|
|
|
|
case VK_F1: ev.data1 = GK_F1; break;
|
|
|
|
case VK_F2: ev.data1 = GK_F2; break;
|
|
|
|
case VK_F3: ev.data1 = GK_F3; break;
|
|
|
|
case VK_F4: ev.data1 = GK_F4; break;
|
|
|
|
case VK_F5: ev.data1 = GK_F5; break;
|
|
|
|
case VK_F6: ev.data1 = GK_F6; break;
|
|
|
|
case VK_F7: ev.data1 = GK_F7; break;
|
|
|
|
case VK_F8: ev.data1 = GK_F8; break;
|
|
|
|
case VK_F9: ev.data1 = GK_F9; break;
|
|
|
|
case VK_F10: ev.data1 = GK_F10; break;
|
|
|
|
case VK_F11: ev.data1 = GK_F11; break;
|
|
|
|
case VK_F12: ev.data1 = GK_F12; break;
|
|
|
|
case VK_BROWSER_BACK: ev.data1 = GK_BACK; break;
|
2009-05-27 22:17:11 +00:00
|
|
|
}
|
|
|
|
if (ev.data1 != 0)
|
|
|
|
{
|
|
|
|
D_PostEvent(&ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Return false for key downs so that we can handle special hotkeys
|
|
|
|
// in the main WndProc.
|
|
|
|
return ev.subtype == EV_GUI_KeyUp;
|
|
|
|
|
|
|
|
case WM_CHAR:
|
|
|
|
case WM_SYSCHAR:
|
|
|
|
if (wParam >= ' ') // only send displayable characters
|
|
|
|
{
|
|
|
|
ev.subtype = EV_GUI_Char;
|
|
|
|
ev.data1 = wParam;
|
|
|
|
ev.data2 = (message == WM_SYSCHAR);
|
|
|
|
D_PostEvent(&ev);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
case WM_LBUTTONUP:
|
|
|
|
case WM_RBUTTONDOWN:
|
|
|
|
case WM_RBUTTONUP:
|
|
|
|
case WM_MBUTTONDOWN:
|
|
|
|
case WM_MBUTTONUP:
|
2010-09-14 17:28:18 +00:00
|
|
|
case WM_XBUTTONDOWN:
|
|
|
|
case WM_XBUTTONUP:
|
|
|
|
case WM_MOUSEMOVE:
|
2009-05-27 22:17:11 +00:00
|
|
|
if (message >= WM_LBUTTONDOWN && message <= WM_LBUTTONDBLCLK)
|
|
|
|
{
|
|
|
|
ev.subtype = message - WM_LBUTTONDOWN + EV_GUI_LButtonDown;
|
|
|
|
}
|
|
|
|
else if (message >= WM_RBUTTONDOWN && message <= WM_RBUTTONDBLCLK)
|
|
|
|
{
|
|
|
|
ev.subtype = message - WM_RBUTTONDOWN + EV_GUI_RButtonDown;
|
|
|
|
}
|
|
|
|
else if (message >= WM_MBUTTONDOWN && message <= WM_MBUTTONDBLCLK)
|
|
|
|
{
|
|
|
|
ev.subtype = message - WM_MBUTTONDOWN + EV_GUI_MButtonDown;
|
|
|
|
}
|
2010-09-14 17:28:18 +00:00
|
|
|
else if (message >= WM_XBUTTONDOWN && message <= WM_XBUTTONUP)
|
|
|
|
{
|
|
|
|
ev.subtype = message - WM_XBUTTONDOWN + EV_GUI_BackButtonDown;
|
|
|
|
if (GET_XBUTTON_WPARAM(wParam) == 2)
|
|
|
|
{
|
|
|
|
ev.subtype += EV_GUI_FwdButtonDown - EV_GUI_BackButtonDown;
|
|
|
|
}
|
|
|
|
else if (GET_XBUTTON_WPARAM(wParam) != 1)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (message == WM_MOUSEMOVE)
|
|
|
|
{
|
|
|
|
ev.subtype = EV_GUI_MouseMove;
|
|
|
|
}
|
2010-09-14 20:53:12 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
int shift = screen? screen->GetPixelDoubling() : 0;
|
|
|
|
ev.data1 = LOWORD(lParam) >> shift;
|
|
|
|
ev.data2 = HIWORD(lParam) >> shift;
|
2010-09-15 21:53:12 +00:00
|
|
|
if (screen) ev.data2 -= (screen->GetTrueHeight() - screen->GetHeight())/2;
|
2010-09-14 20:53:12 +00:00
|
|
|
}
|
2010-09-14 17:28:18 +00:00
|
|
|
|
|
|
|
if (wParam & MK_SHIFT) ev.data3 |= GKM_SHIFT;
|
|
|
|
if (wParam & MK_CONTROL) ev.data3 |= GKM_CTRL;
|
|
|
|
if (GetKeyState(VK_MENU) & 0x8000) ev.data3 |= GKM_ALT;
|
|
|
|
|
|
|
|
if (use_mouse) D_PostEvent(&ev);
|
2009-05-27 22:17:11 +00:00
|
|
|
return true;
|
2009-05-27 22:57:21 +00:00
|
|
|
|
|
|
|
// Note: If the mouse is grabbed, it sends the mouse wheel events itself.
|
|
|
|
case WM_MOUSEWHEEL:
|
2010-09-14 17:28:18 +00:00
|
|
|
if (!use_mouse) return false;
|
2009-05-27 22:57:21 +00:00
|
|
|
if (wParam & MK_SHIFT) ev.data3 |= GKM_SHIFT;
|
|
|
|
if (wParam & MK_CONTROL) ev.data3 |= GKM_CTRL;
|
|
|
|
if (GetKeyState(VK_MENU) & 0x8000) ev.data3 |= GKM_ALT;
|
|
|
|
WheelDelta += (SHORT)HIWORD(wParam);
|
|
|
|
if (WheelDelta < 0)
|
|
|
|
{
|
|
|
|
ev.subtype = EV_GUI_WheelDown;
|
|
|
|
while (WheelDelta <= -WHEEL_DELTA)
|
|
|
|
{
|
|
|
|
D_PostEvent(&ev);
|
|
|
|
WheelDelta += WHEEL_DELTA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ev.subtype = EV_GUI_WheelUp;
|
|
|
|
while (WheelDelta >= WHEEL_DELTA)
|
|
|
|
{
|
|
|
|
D_PostEvent(&ev);
|
|
|
|
WheelDelta -= WHEEL_DELTA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
2009-05-27 22:17:11 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-05-27 03:16:46 +00:00
|
|
|
bool CallHook(FInputDevice *device, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-27 03:16:46 +00:00
|
|
|
if (device == NULL)
|
2009-05-23 02:22:30 +00:00
|
|
|
{
|
2009-05-27 03:16:46 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*result = 0;
|
|
|
|
return device->WndProcHook(hWnd, message, wParam, lParam, result);
|
|
|
|
}
|
2009-05-23 02:22:30 +00:00
|
|
|
|
2009-05-27 03:16:46 +00:00
|
|
|
LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
LRESULT result;
|
|
|
|
|
2009-06-11 03:41:24 +00:00
|
|
|
if (message == WM_INPUT)
|
|
|
|
{
|
|
|
|
if (MyGetRawInputData != NULL)
|
|
|
|
{
|
|
|
|
UINT size;
|
|
|
|
|
|
|
|
if (!MyGetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)) &&
|
|
|
|
size != 0)
|
|
|
|
{
|
|
|
|
BYTE *buffer = (BYTE *)alloca(size);
|
|
|
|
if (MyGetRawInputData((HRAWINPUT)lParam, RID_INPUT, buffer, &size, sizeof(RAWINPUTHEADER)) == size)
|
|
|
|
{
|
|
|
|
int code = GET_RAWINPUT_CODE_WPARAM(wParam);
|
|
|
|
if (Keyboard == NULL || !Keyboard->ProcessRawInput((RAWINPUT *)buffer, code))
|
|
|
|
{
|
2009-07-11 01:40:01 +00:00
|
|
|
if (Mouse == NULL || !Mouse->ProcessRawInput((RAWINPUT *)buffer, code))
|
2009-06-11 03:41:24 +00:00
|
|
|
{
|
2009-07-11 01:40:01 +00:00
|
|
|
if (JoyDevices[INPUT_RawPS2] != NULL)
|
|
|
|
{
|
|
|
|
JoyDevices[INPUT_RawPS2]->ProcessRawInput((RAWINPUT *)buffer, code);
|
|
|
|
}
|
2009-06-11 03:41:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2009-05-27 03:16:46 +00:00
|
|
|
if (CallHook(Keyboard, hWnd, message, wParam, lParam, &result))
|
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
if (CallHook(Mouse, hWnd, message, wParam, lParam, &result))
|
|
|
|
{
|
|
|
|
return result;
|
2009-05-23 02:22:30 +00:00
|
|
|
}
|
2009-06-20 03:16:08 +00:00
|
|
|
for (int i = 0; i < NUM_JOYDEVICES; ++i)
|
|
|
|
{
|
|
|
|
if (CallHook(JoyDevices[i], hWnd, message, wParam, lParam, &result))
|
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
2009-05-27 22:17:11 +00:00
|
|
|
if (GUICapture && GUIWndProcHook(hWnd, message, wParam, lParam, &result))
|
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-09-14 17:28:18 +00:00
|
|
|
if ((gamestate == GS_DEMOSCREEN || gamestate == GS_TITLELEVEL) && message == WM_LBUTTONDOWN)
|
|
|
|
{
|
|
|
|
if (GUIWndProcHook(hWnd, message, wParam, lParam, &result))
|
|
|
|
{
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
switch (message)
|
|
|
|
{
|
|
|
|
case WM_DESTROY:
|
|
|
|
SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
|
|
|
//PostQuitMessage (0);
|
|
|
|
exit (0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_HOTKEY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_PAINT:
|
2007-02-19 23:48:52 +00:00
|
|
|
if (screen != NULL && 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
static_cast<BaseWinFB *> (screen)->PaintToWindow ();
|
|
|
|
}
|
|
|
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
|
|
|
|
|
|
|
case WM_SETTINGCHANGE:
|
|
|
|
// If regional settings were changed, reget preferred languages
|
|
|
|
if (wParam == 0 && lParam != 0 && strcmp ((const char *)lParam, "intl") == 0)
|
|
|
|
{
|
|
|
|
language.Callback ();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
case WM_KILLFOCUS:
|
|
|
|
I_CheckNativeMouse (true); // Make sure mouse gets released right away
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_SETFOCUS:
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
I_CheckNativeMouse (false);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-08 01:53:41 +00:00
|
|
|
case WM_SETCURSOR:
|
|
|
|
if (!CursorState)
|
|
|
|
{
|
|
|
|
SetCursor(NULL); // turn off window cursor
|
|
|
|
return TRUE; // Prevent Windows from setting cursor to window class cursor
|
|
|
|
}
|
2010-09-14 17:28:18 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
|
|
|
}
|
2010-08-08 01:53:41 +00:00
|
|
|
break;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
case WM_SIZE:
|
|
|
|
InvalidateRect (Window, NULL, FALSE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
// When the EAX editor is open, pressing Ctrl+Tab will switch to it
|
|
|
|
if (EAXEditWindow != 0 && wParam == VK_TAB && !(lParam & 0x40000000) &&
|
|
|
|
(GetKeyState (VK_CONTROL) & 0x8000))
|
|
|
|
{
|
|
|
|
SetForegroundWindow (EAXEditWindow);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-05-27 22:17:11 +00:00
|
|
|
case WM_SYSKEYDOWN:
|
|
|
|
// Pressing Alt+Enter can toggle between fullscreen and windowed.
|
|
|
|
if (wParam == VK_RETURN && k_allowfullscreentoggle && !(lParam & 0x40000000))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
ToggleFullscreen = !ToggleFullscreen;
|
|
|
|
}
|
2009-09-30 04:44:14 +00:00
|
|
|
// Pressing Alt+F4 quits the program.
|
|
|
|
if (wParam == VK_F4 && !(lParam & 0x40000000))
|
|
|
|
{
|
|
|
|
PostQuitMessage(0);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_SYSCOMMAND:
|
2009-05-27 22:17:11 +00:00
|
|
|
// Prevent activation of the window menu with Alt+Space
|
|
|
|
if ((wParam & 0xFFF0) != SC_KEYMENU)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-27 22:17:11 +00:00
|
|
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
2009-02-08 03:45:41 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DISPLAYCHANGE:
|
|
|
|
if (SpawnEAXWindow)
|
|
|
|
{
|
|
|
|
SpawnEAXWindow = false;
|
|
|
|
ShowEAXEditor ();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_GETMINMAXINFO:
|
|
|
|
if (screen && !VidResizing)
|
|
|
|
{
|
|
|
|
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
|
|
|
mmi->ptMinTrackSize.x = SCREENWIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
|
|
mmi->ptMinTrackSize.y = SCREENHEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 +
|
|
|
|
GetSystemMetrics (SM_CYCAPTION);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_ACTIVATEAPP:
|
|
|
|
AppActive = wParam;
|
|
|
|
if (wParam)
|
|
|
|
{
|
|
|
|
SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
|
|
|
|
}
|
|
|
|
else if (!noidle && !netgame)
|
|
|
|
{
|
|
|
|
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
|
|
|
|
}
|
2009-05-23 03:09:50 +00:00
|
|
|
S_SetSoundPaused (wParam);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_WTSSESSION_CHANGE:
|
|
|
|
case WM_POWERBROADCAST:
|
|
|
|
{
|
|
|
|
int oldstate = SessionState;
|
|
|
|
|
|
|
|
if (message == WM_WTSSESSION_CHANGE && lParam == (LPARAM)SessionID)
|
|
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
|
|
OutputDebugString ("SessionID matched\n");
|
|
|
|
#endif
|
|
|
|
// When using fast user switching, XP will lock a session before
|
|
|
|
// disconnecting it, and the session will be unlocked before reconnecting it.
|
|
|
|
// For our purposes, video output will only happen when the session is
|
|
|
|
// both unlocked and connected (that is, SessionState is 0).
|
|
|
|
switch (wParam)
|
|
|
|
{
|
|
|
|
case WTS_SESSION_LOCK:
|
|
|
|
SessionState |= 1;
|
|
|
|
break;
|
|
|
|
case WTS_SESSION_UNLOCK:
|
|
|
|
SessionState &= ~1;
|
|
|
|
break;
|
|
|
|
case WTS_CONSOLE_DISCONNECT:
|
|
|
|
SessionState |= 2;
|
|
|
|
//I_MovieDisableSound ();
|
|
|
|
break;
|
|
|
|
case WTS_CONSOLE_CONNECT:
|
|
|
|
SessionState &= ~2;
|
|
|
|
//I_MovieResumeSound ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (message == WM_POWERBROADCAST)
|
|
|
|
{
|
|
|
|
switch (wParam)
|
|
|
|
{
|
|
|
|
case PBT_APMSUSPEND:
|
|
|
|
SessionState |= 4;
|
|
|
|
break;
|
|
|
|
case PBT_APMRESUMESUSPEND:
|
|
|
|
SessionState &= ~4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- The sound code now handles restarting looping sounds itself. As far as
the rest of the game is concerned, these sounds will never stop once they
have been started until they are explicitly stopped. If they are evicted
from their channels, the sound code will restart them as soon as possible.
This means that instead of this:
if (!S_IsActorPlayingSomething(actor, CHAN_WEAPON, -1))
{
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
}
The following is now just as effective:
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
There are also a couple of other ramifications presented by this change:
* The full state of the sound system (sans music) is now stored in save
games. Any sounds that were playing when you saved will still be
playing when you load. (Try saving while Korax is making a speech in
Hexen to hear it.)
* Using snd_reset will also preserve any playing sounds.
* Movie playback is disabled, probably forever. I did not want to
update the MovieDisable/ResumeSound stuff for the new eviction
tracking code. A properly updated movie player will use the VMR,
which doesn't need these functions, since it would pipe the sound
straight through the sound system like everything else, so I decided
to dump them now, which leaves the movie player in a totally unworkable
state.
June 26, 2008
- Changed S_Sound() to take the same floating point attenuation that the
internal S_StartSound() uses. Now ambient sounds can use the public
S_Sound() interface.
- Fixed: S_RelinkSound() compared the points of the channels against the
from actor's point, rather than checking the channels' mover.
- Changed Strife's animated doors so that their sounds originate from the
interior of the sector making them and not from the entire vertical height
of the map.
SVN r1055 (trunk)
2008-06-29 04:19:38 +00:00
|
|
|
if (GSnd != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- The sound code now handles restarting looping sounds itself. As far as
the rest of the game is concerned, these sounds will never stop once they
have been started until they are explicitly stopped. If they are evicted
from their channels, the sound code will restart them as soon as possible.
This means that instead of this:
if (!S_IsActorPlayingSomething(actor, CHAN_WEAPON, -1))
{
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
}
The following is now just as effective:
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
There are also a couple of other ramifications presented by this change:
* The full state of the sound system (sans music) is now stored in save
games. Any sounds that were playing when you saved will still be
playing when you load. (Try saving while Korax is making a speech in
Hexen to hear it.)
* Using snd_reset will also preserve any playing sounds.
* Movie playback is disabled, probably forever. I did not want to
update the MovieDisable/ResumeSound stuff for the new eviction
tracking code. A properly updated movie player will use the VMR,
which doesn't need these functions, since it would pipe the sound
straight through the sound system like everything else, so I decided
to dump them now, which leaves the movie player in a totally unworkable
state.
June 26, 2008
- Changed S_Sound() to take the same floating point attenuation that the
internal S_StartSound() uses. Now ambient sounds can use the public
S_Sound() interface.
- Fixed: S_RelinkSound() compared the points of the channels against the
from actor's point, rather than checking the channels' mover.
- Changed Strife's animated doors so that their sounds originate from the
interior of the sector making them and not from the entire vertical height
of the map.
SVN r1055 (trunk)
2008-06-29 04:19:38 +00:00
|
|
|
#if 0
|
|
|
|
// Do we actually need this here?
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!oldstate && SessionState)
|
|
|
|
{
|
- The sound code now handles restarting looping sounds itself. As far as
the rest of the game is concerned, these sounds will never stop once they
have been started until they are explicitly stopped. If they are evicted
from their channels, the sound code will restart them as soon as possible.
This means that instead of this:
if (!S_IsActorPlayingSomething(actor, CHAN_WEAPON, -1))
{
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
}
The following is now just as effective:
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
There are also a couple of other ramifications presented by this change:
* The full state of the sound system (sans music) is now stored in save
games. Any sounds that were playing when you saved will still be
playing when you load. (Try saving while Korax is making a speech in
Hexen to hear it.)
* Using snd_reset will also preserve any playing sounds.
* Movie playback is disabled, probably forever. I did not want to
update the MovieDisable/ResumeSound stuff for the new eviction
tracking code. A properly updated movie player will use the VMR,
which doesn't need these functions, since it would pipe the sound
straight through the sound system like everything else, so I decided
to dump them now, which leaves the movie player in a totally unworkable
state.
June 26, 2008
- Changed S_Sound() to take the same floating point attenuation that the
internal S_StartSound() uses. Now ambient sounds can use the public
S_Sound() interface.
- Fixed: S_RelinkSound() compared the points of the channels against the
from actor's point, rather than checking the channels' mover.
- Changed Strife's animated doors so that their sounds originate from the
interior of the sector making them and not from the entire vertical height
of the map.
SVN r1055 (trunk)
2008-06-29 04:19:38 +00:00
|
|
|
GSnd->SuspendSound ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else if (oldstate && !SessionState)
|
|
|
|
{
|
|
|
|
GSnd->MovieResumeSound ();
|
|
|
|
}
|
- The sound code now handles restarting looping sounds itself. As far as
the rest of the game is concerned, these sounds will never stop once they
have been started until they are explicitly stopped. If they are evicted
from their channels, the sound code will restart them as soon as possible.
This means that instead of this:
if (!S_IsActorPlayingSomething(actor, CHAN_WEAPON, -1))
{
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
}
The following is now just as effective:
S_Sound(actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
There are also a couple of other ramifications presented by this change:
* The full state of the sound system (sans music) is now stored in save
games. Any sounds that were playing when you saved will still be
playing when you load. (Try saving while Korax is making a speech in
Hexen to hear it.)
* Using snd_reset will also preserve any playing sounds.
* Movie playback is disabled, probably forever. I did not want to
update the MovieDisable/ResumeSound stuff for the new eviction
tracking code. A properly updated movie player will use the VMR,
which doesn't need these functions, since it would pipe the sound
straight through the sound system like everything else, so I decided
to dump them now, which leaves the movie player in a totally unworkable
state.
June 26, 2008
- Changed S_Sound() to take the same floating point attenuation that the
internal S_StartSound() uses. Now ambient sounds can use the public
S_Sound() interface.
- Fixed: S_RelinkSound() compared the points of the channels against the
from actor's point, rather than checking the channels' mover.
- Changed Strife's animated doors so that their sounds originate from the
interior of the sector making them and not from the entire vertical height
of the map.
SVN r1055 (trunk)
2008-06-29 04:19:38 +00:00
|
|
|
#endif
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
#ifdef _DEBUG
|
|
|
|
char foo[256];
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (foo, countof(foo), "Session Change: %ld %d\n", lParam, wParam);
|
2006-02-24 04:48:15 +00:00
|
|
|
OutputDebugString (foo);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_PALETTECHANGED:
|
|
|
|
if ((HWND)wParam == Window)
|
|
|
|
break;
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
screen->PaletteChanged ();
|
|
|
|
}
|
|
|
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
|
|
|
|
|
|
|
case WM_QUERYNEWPALETTE:
|
|
|
|
if (screen != NULL)
|
|
|
|
{
|
|
|
|
return screen->QueryNewPalette ();
|
|
|
|
}
|
|
|
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
|
|
|
|
2008-03-24 17:48:55 +00:00
|
|
|
case WM_ERASEBKGND:
|
|
|
|
return true;
|
|
|
|
|
2009-07-15 05:53:06 +00:00
|
|
|
case WM_DEVICECHANGE:
|
|
|
|
if (wParam == DBT_DEVNODES_CHANGED ||
|
|
|
|
wParam == DBT_DEVICEARRIVAL ||
|
|
|
|
wParam == DBT_CONFIGCHANGED)
|
|
|
|
{
|
|
|
|
event_t ev = { EV_DeviceChange };
|
|
|
|
D_PostEvent(&ev);
|
|
|
|
}
|
|
|
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
default:
|
|
|
|
return DefWindowProc (hWnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
bool I_InitInput (void *hwnd)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
Printf ("I_InitInput\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
atterm (I_ShutdownInput);
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
noidle = !!Args->CheckParm ("-noidle");
|
2006-02-24 04:48:15 +00:00
|
|
|
g_pdi = NULL;
|
|
|
|
g_pdi3 = NULL;
|
|
|
|
|
2010-01-22 05:17:57 +00:00
|
|
|
FindRawInputFunctions();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
// Try for DirectInput 8 first, then DirectInput 3 for NT 4's benefit.
|
2009-02-10 03:12:41 +00:00
|
|
|
DInputDLL = LoadLibrary("dinput8.dll");
|
|
|
|
if (DInputDLL != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-19 23:12:48 +00:00
|
|
|
typedef HRESULT (WINAPI *blah)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
|
2009-02-10 03:12:41 +00:00
|
|
|
blah di8c = (blah)GetProcAddress(DInputDLL, "DirectInput8Create");
|
|
|
|
if (di8c != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-10 03:12:41 +00:00
|
|
|
hr = di8c(g_hInst, DIRECTINPUT_VERSION, IID_IDirectInput8A, (void **)&g_pdi, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
Printf(TEXTCOLOR_ORANGE "DirectInput8Create failed: %08lx", hr);
|
|
|
|
g_pdi = NULL; // Just to be sure DirectInput8Create didn't change it
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf(TEXTCOLOR_ORANGE "Could not find DirectInput8Create in dinput8.dll\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_pdi == NULL)
|
|
|
|
{
|
2009-02-10 03:12:41 +00:00
|
|
|
if (DInputDLL != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-10 03:12:41 +00:00
|
|
|
FreeLibrary(DInputDLL);
|
|
|
|
}
|
|
|
|
DInputDLL = LoadLibrary ("dinput.dll");
|
|
|
|
if (DInputDLL == NULL)
|
|
|
|
{
|
|
|
|
I_FatalError ("Could not load dinput.dll: %08lx", GetLastError());
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-19 23:12:48 +00:00
|
|
|
typedef HRESULT (WINAPI *blah)(HINSTANCE, DWORD, LPDIRECTINPUT*, LPUNKNOWN);
|
2009-02-10 03:12:41 +00:00
|
|
|
blah dic = (blah)GetProcAddress (DInputDLL, "DirectInputCreateA");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-10 03:12:41 +00:00
|
|
|
if (dic == NULL)
|
|
|
|
{
|
|
|
|
I_FatalError ("dinput.dll is corrupt");
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-02-10 03:12:41 +00:00
|
|
|
|
|
|
|
hr = dic (g_hInst, 0x0300, &g_pdi3, NULL);
|
|
|
|
if (FAILED(hr))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-10 03:12:41 +00:00
|
|
|
I_FatalError ("DirectInputCreate failed: %08lx", hr);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
Printf ("I_StartupMouse\n");
|
|
|
|
I_StartupMouse();
|
|
|
|
|
|
|
|
Printf ("I_StartupKeyboard\n");
|
|
|
|
I_StartupKeyboard();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-06-28 03:09:17 +00:00
|
|
|
Printf ("I_StartupXInput\n");
|
|
|
|
I_StartupXInput();
|
|
|
|
|
2009-07-11 01:40:01 +00:00
|
|
|
Printf ("I_StartupRawPS2\n");
|
|
|
|
I_StartupRawPS2();
|
|
|
|
|
2009-06-28 03:09:17 +00:00
|
|
|
Printf ("I_StartupDirectInputJoystick\n");
|
|
|
|
I_StartupDirectInputJoystick();
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Free all input resources
|
2006-05-12 03:14:40 +00:00
|
|
|
void I_ShutdownInput ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-27 03:16:46 +00:00
|
|
|
if (Keyboard != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-27 03:16:46 +00:00
|
|
|
delete Keyboard;
|
2009-06-09 07:57:21 +00:00
|
|
|
Keyboard = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-05-23 02:22:30 +00:00
|
|
|
if (Mouse != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-23 02:22:30 +00:00
|
|
|
delete Mouse;
|
2009-06-09 07:57:21 +00:00
|
|
|
Mouse = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-06-20 03:16:08 +00:00
|
|
|
for (int i = 0; i < NUM_JOYDEVICES; ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-06-20 03:16:08 +00:00
|
|
|
if (JoyDevices[i] != NULL)
|
|
|
|
{
|
|
|
|
delete JoyDevices[i];
|
|
|
|
JoyDevices[i] = NULL;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
if (g_pdi)
|
|
|
|
{
|
|
|
|
g_pdi->Release ();
|
|
|
|
g_pdi = NULL;
|
|
|
|
}
|
|
|
|
if (g_pdi3)
|
|
|
|
{
|
|
|
|
g_pdi3->Release ();
|
|
|
|
g_pdi3 = NULL;
|
2009-05-23 02:22:30 +00:00
|
|
|
}
|
|
|
|
if (DInputDLL != NULL)
|
|
|
|
{
|
|
|
|
FreeLibrary (DInputDLL);
|
|
|
|
DInputDLL = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void I_GetEvent ()
|
|
|
|
{
|
|
|
|
MSG mess;
|
|
|
|
|
|
|
|
// Briefly enter an alertable state so that if a secondary thread
|
|
|
|
// crashed, we will execute the APC it sent now.
|
2008-03-05 03:10:31 +00:00
|
|
|
SleepEx (0, TRUE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-04 06:36:23 +00:00
|
|
|
while (PeekMessage (&mess, NULL, 0, 0, PM_REMOVE))
|
|
|
|
{
|
|
|
|
if (mess.message == WM_QUIT)
|
|
|
|
exit (mess.wParam);
|
|
|
|
if (EAXEditWindow == 0 || !IsDialogMessage (EAXEditWindow, &mess))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-08-08 00:36:35 +00:00
|
|
|
if (GUICapture)
|
|
|
|
{
|
|
|
|
TranslateMessage (&mess);
|
|
|
|
}
|
2008-03-04 06:36:23 +00:00
|
|
|
DispatchMessage (&mess);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-03-04 06:36:23 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-27 03:16:46 +00:00
|
|
|
if (Keyboard != NULL)
|
|
|
|
{
|
|
|
|
Keyboard->ProcessInput();
|
|
|
|
}
|
2009-05-23 02:22:30 +00:00
|
|
|
if (Mouse != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-05-23 02:22:30 +00:00
|
|
|
Mouse->ProcessInput();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// I_StartTic
|
|
|
|
//
|
|
|
|
void I_StartTic ()
|
|
|
|
{
|
|
|
|
ResetButtonTriggers ();
|
|
|
|
I_CheckGUICapture ();
|
|
|
|
I_CheckNativeMouse (false);
|
|
|
|
I_GetEvent ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// I_StartFrame
|
|
|
|
//
|
|
|
|
void I_StartFrame ()
|
|
|
|
{
|
|
|
|
if (use_joystick)
|
|
|
|
{
|
2009-06-20 03:16:08 +00:00
|
|
|
for (int i = 0; i < NUM_JOYDEVICES; ++i)
|
|
|
|
{
|
|
|
|
if (JoyDevices[i] != NULL)
|
|
|
|
{
|
|
|
|
JoyDevices[i]->ProcessInput();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void I_GetAxes(float axes[NUM_JOYAXIS])
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_JOYAXIS; ++i)
|
|
|
|
{
|
|
|
|
axes[i] = 0;
|
|
|
|
}
|
|
|
|
if (use_joystick)
|
|
|
|
{
|
|
|
|
for (i = 0; i < NUM_JOYDEVICES; ++i)
|
|
|
|
{
|
|
|
|
if (JoyDevices[i] != NULL)
|
|
|
|
{
|
|
|
|
JoyDevices[i]->AddAxes(axes);
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-26 02:45:05 +00:00
|
|
|
void I_GetJoysticks(TArray<IJoystickConfig *> &sticks)
|
|
|
|
{
|
|
|
|
sticks.Clear();
|
|
|
|
for (int i = 0; i < NUM_JOYDEVICES; ++i)
|
|
|
|
{
|
|
|
|
if (JoyDevices[i] != NULL)
|
|
|
|
{
|
|
|
|
JoyDevices[i]->GetDevices(sticks);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-15 05:53:06 +00:00
|
|
|
// If a new controller was added, returns a pointer to it.
|
|
|
|
IJoystickConfig *I_UpdateDeviceList()
|
|
|
|
{
|
|
|
|
IJoystickConfig *newone = NULL;
|
|
|
|
for (int i = 0; i < NUM_JOYDEVICES; ++i)
|
|
|
|
{
|
|
|
|
if (JoyDevices[i] != NULL)
|
|
|
|
{
|
|
|
|
IJoystickConfig *thisnewone = JoyDevices[i]->Rescan();
|
|
|
|
if (newone == NULL)
|
|
|
|
{
|
|
|
|
newone = thisnewone;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newone;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void I_PutInClipboard (const char *str)
|
|
|
|
{
|
|
|
|
if (str == NULL || !OpenClipboard (Window))
|
|
|
|
return;
|
|
|
|
EmptyClipboard ();
|
|
|
|
|
|
|
|
HGLOBAL cliphandle = GlobalAlloc (GMEM_DDESHARE, strlen (str) + 1);
|
|
|
|
if (cliphandle != NULL)
|
|
|
|
{
|
|
|
|
char *ptr = (char *)GlobalLock (cliphandle);
|
|
|
|
strcpy (ptr, str);
|
|
|
|
GlobalUnlock (cliphandle);
|
|
|
|
SetClipboardData (CF_TEXT, cliphandle);
|
|
|
|
}
|
|
|
|
CloseClipboard ();
|
|
|
|
}
|
|
|
|
|
2009-02-10 02:16:41 +00:00
|
|
|
FString I_GetFromClipboard (bool return_nothing)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-08 03:32:27 +00:00
|
|
|
FString retstr;
|
2006-02-24 04:48:15 +00:00
|
|
|
HGLOBAL cliphandle;
|
|
|
|
char *clipstr;
|
|
|
|
char *nlstr;
|
|
|
|
|
2009-02-10 02:16:41 +00:00
|
|
|
if (return_nothing || !IsClipboardFormatAvailable (CF_TEXT) || !OpenClipboard (Window))
|
2009-02-08 03:32:27 +00:00
|
|
|
return retstr;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
cliphandle = GetClipboardData (CF_TEXT);
|
|
|
|
if (cliphandle != NULL)
|
|
|
|
{
|
|
|
|
clipstr = (char *)GlobalLock (cliphandle);
|
|
|
|
if (clipstr != NULL)
|
|
|
|
{
|
2009-02-08 03:32:27 +00:00
|
|
|
// Convert CR-LF pairs to just LF while copying to the FString
|
|
|
|
for (nlstr = clipstr; *nlstr != '\0'; ++nlstr)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-08 03:32:27 +00:00
|
|
|
if (nlstr[0] == '\r' && nlstr[1] == '\n')
|
|
|
|
{
|
|
|
|
nlstr++;
|
|
|
|
}
|
|
|
|
retstr += *nlstr;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-02-08 03:32:27 +00:00
|
|
|
GlobalUnlock (clipstr);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CloseClipboard ();
|
|
|
|
return retstr;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "i_movie.h"
|
|
|
|
|
|
|
|
CCMD (playmovie)
|
|
|
|
{
|
|
|
|
if (argv.argc() != 2)
|
|
|
|
{
|
|
|
|
Printf ("Usage: playmovie <movie name>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
I_PlayMovie (argv[1]);
|
|
|
|
}
|
2009-05-23 02:22:30 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2009-05-24 03:15:04 +00:00
|
|
|
// FInputDevice - Destructor
|
2009-05-23 02:22:30 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
FInputDevice::~FInputDevice()
|
2009-05-23 02:22:30 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-06-11 03:41:24 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FInputDevice :: ProcessInput
|
|
|
|
//
|
|
|
|
// Gives subclasses an opportunity to do input handling that doesn't involve
|
|
|
|
// window messages.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FInputDevice::ProcessInput()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FInputDevice :: ProcessRawInput
|
|
|
|
//
|
|
|
|
// Gives subclasses a chance to handle WM_INPUT messages. This is not part
|
|
|
|
// of WndProcHook so that we only need to fill the RAWINPUT buffer once
|
|
|
|
// per message and be sure it gets cleaned up properly.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool FInputDevice::ProcessRawInput(RAWINPUT *raw, int code)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-05-23 02:22:30 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2009-05-24 03:15:04 +00:00
|
|
|
// FInputDevice :: WndProcHook
|
2009-05-23 02:22:30 +00:00
|
|
|
//
|
2009-05-24 03:15:04 +00:00
|
|
|
// Gives subclasses a chance to intercept window messages.
|
2009-05-23 02:22:30 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
bool FInputDevice::WndProcHook(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result)
|
2009-05-23 02:22:30 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2009-05-24 03:15:04 +00:00
|
|
|
// FindRawInputFunctions
|
2009-05-23 02:22:30 +00:00
|
|
|
//
|
2009-05-24 03:15:04 +00:00
|
|
|
// Finds functions for raw input, if available.
|
2009-05-23 02:22:30 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-05-24 03:15:04 +00:00
|
|
|
static void FindRawInputFunctions()
|
2009-05-23 02:22:30 +00:00
|
|
|
{
|
2010-01-22 05:17:57 +00:00
|
|
|
if (!norawinput)
|
2009-05-23 02:22:30 +00:00
|
|
|
{
|
2010-01-22 05:17:57 +00:00
|
|
|
HMODULE user32 = GetModuleHandle("user32.dll");
|
|
|
|
|
|
|
|
if (user32 == NULL)
|
|
|
|
{
|
|
|
|
return; // WTF kind of broken system are we running on?
|
|
|
|
}
|
2009-05-24 03:15:04 +00:00
|
|
|
#define RIF(name,ret,args) \
|
2010-01-22 05:17:57 +00:00
|
|
|
My##name = (name##Proto)GetProcAddress(user32, #name);
|
2009-05-24 03:15:04 +00:00
|
|
|
#include "rawinput.h"
|
2010-01-22 05:17:57 +00:00
|
|
|
}
|
2009-05-23 02:22:30 +00:00
|
|
|
}
|