win32: fix start paused commandline flag, and i had forgotten to checkin xinput.h earlier
This commit is contained in:
parent
9248e9454b
commit
b2faef8aad
|
@ -0,0 +1,258 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* *
|
||||||
|
* XInput.h -- This module defines XBOX controller APIs *
|
||||||
|
* and constansts for the Windows platform. *
|
||||||
|
* *
|
||||||
|
* Copyright (c) Microsoft Corp. All rights reserved. *
|
||||||
|
* *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef _XINPUT_H_
|
||||||
|
#define _XINPUT_H_
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
|
||||||
|
// Current name of the DLL shipped in the same SDK as this header.
|
||||||
|
// The name reflects the current version
|
||||||
|
#define XINPUT_DLL_A "xinput1_3.dll"
|
||||||
|
#define XINPUT_DLL_W L"xinput1_3.dll"
|
||||||
|
#ifdef UNICODE
|
||||||
|
#define XINPUT_DLL XINPUT_DLL_W
|
||||||
|
#else
|
||||||
|
#define XINPUT_DLL XINPUT_DLL_A
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Device types available in XINPUT_CAPABILITIES
|
||||||
|
//
|
||||||
|
#define XINPUT_DEVTYPE_GAMEPAD 0x01
|
||||||
|
|
||||||
|
//
|
||||||
|
// Device subtypes available in XINPUT_CAPABILITIES
|
||||||
|
//
|
||||||
|
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
|
||||||
|
#define XINPUT_DEVSUBTYPE_WHEEL 0x02
|
||||||
|
#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
|
||||||
|
#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
|
||||||
|
#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
|
||||||
|
#define XINPUT_DEVSUBTYPE_GUITAR 0x06
|
||||||
|
#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags for XINPUT_CAPABILITIES
|
||||||
|
//
|
||||||
|
#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constants for gamepad buttons
|
||||||
|
//
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||||
|
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||||
|
#define XINPUT_GAMEPAD_START 0x0010
|
||||||
|
#define XINPUT_GAMEPAD_BACK 0x0020
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||||
|
#define XINPUT_GAMEPAD_A 0x1000
|
||||||
|
#define XINPUT_GAMEPAD_B 0x2000
|
||||||
|
#define XINPUT_GAMEPAD_X 0x4000
|
||||||
|
#define XINPUT_GAMEPAD_Y 0x8000
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Gamepad thresholds
|
||||||
|
//
|
||||||
|
#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
|
||||||
|
#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
|
||||||
|
#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags to pass to XInputGetCapabilities
|
||||||
|
//
|
||||||
|
#define XINPUT_FLAG_GAMEPAD 0x00000001
|
||||||
|
|
||||||
|
//
|
||||||
|
// Devices that support batteries
|
||||||
|
//
|
||||||
|
#define BATTERY_DEVTYPE_GAMEPAD 0x00
|
||||||
|
#define BATTERY_DEVTYPE_HEADSET 0x01
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags for battery status level
|
||||||
|
//
|
||||||
|
#define BATTERY_TYPE_DISCONNECTED 0x00 // This device is not connected
|
||||||
|
#define BATTERY_TYPE_WIRED 0x01 // Wired device, no battery
|
||||||
|
#define BATTERY_TYPE_ALKALINE 0x02 // Alkaline battery source
|
||||||
|
#define BATTERY_TYPE_NIMH 0x03 // Nickel Metal Hydride battery source
|
||||||
|
#define BATTERY_TYPE_UNKNOWN 0xFF // Cannot determine the battery type
|
||||||
|
|
||||||
|
// These are only valid for wireless, connected devices, with known battery types
|
||||||
|
// The amount of use time remaining depends on the type of device.
|
||||||
|
#define BATTERY_LEVEL_EMPTY 0x00
|
||||||
|
#define BATTERY_LEVEL_LOW 0x01
|
||||||
|
#define BATTERY_LEVEL_MEDIUM 0x02
|
||||||
|
#define BATTERY_LEVEL_FULL 0x03
|
||||||
|
|
||||||
|
// User index definitions
|
||||||
|
#define XUSER_MAX_COUNT 4
|
||||||
|
|
||||||
|
#define XUSER_INDEX_ANY 0x000000FF
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Codes returned for the gamepad keystroke
|
||||||
|
//
|
||||||
|
|
||||||
|
#define VK_PAD_A 0x5800
|
||||||
|
#define VK_PAD_B 0x5801
|
||||||
|
#define VK_PAD_X 0x5802
|
||||||
|
#define VK_PAD_Y 0x5803
|
||||||
|
#define VK_PAD_RSHOULDER 0x5804
|
||||||
|
#define VK_PAD_LSHOULDER 0x5805
|
||||||
|
#define VK_PAD_LTRIGGER 0x5806
|
||||||
|
#define VK_PAD_RTRIGGER 0x5807
|
||||||
|
|
||||||
|
#define VK_PAD_DPAD_UP 0x5810
|
||||||
|
#define VK_PAD_DPAD_DOWN 0x5811
|
||||||
|
#define VK_PAD_DPAD_LEFT 0x5812
|
||||||
|
#define VK_PAD_DPAD_RIGHT 0x5813
|
||||||
|
#define VK_PAD_START 0x5814
|
||||||
|
#define VK_PAD_BACK 0x5815
|
||||||
|
#define VK_PAD_LTHUMB_PRESS 0x5816
|
||||||
|
#define VK_PAD_RTHUMB_PRESS 0x5817
|
||||||
|
|
||||||
|
#define VK_PAD_LTHUMB_UP 0x5820
|
||||||
|
#define VK_PAD_LTHUMB_DOWN 0x5821
|
||||||
|
#define VK_PAD_LTHUMB_RIGHT 0x5822
|
||||||
|
#define VK_PAD_LTHUMB_LEFT 0x5823
|
||||||
|
#define VK_PAD_LTHUMB_UPLEFT 0x5824
|
||||||
|
#define VK_PAD_LTHUMB_UPRIGHT 0x5825
|
||||||
|
#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
|
||||||
|
#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
|
||||||
|
|
||||||
|
#define VK_PAD_RTHUMB_UP 0x5830
|
||||||
|
#define VK_PAD_RTHUMB_DOWN 0x5831
|
||||||
|
#define VK_PAD_RTHUMB_RIGHT 0x5832
|
||||||
|
#define VK_PAD_RTHUMB_LEFT 0x5833
|
||||||
|
#define VK_PAD_RTHUMB_UPLEFT 0x5834
|
||||||
|
#define VK_PAD_RTHUMB_UPRIGHT 0x5835
|
||||||
|
#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
|
||||||
|
#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
|
||||||
|
|
||||||
|
//
|
||||||
|
// Flags used in XINPUT_KEYSTROKE
|
||||||
|
//
|
||||||
|
#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
|
||||||
|
#define XINPUT_KEYSTROKE_KEYUP 0x0002
|
||||||
|
#define XINPUT_KEYSTROKE_REPEAT 0x0004
|
||||||
|
|
||||||
|
//
|
||||||
|
// Structures used by XInput APIs
|
||||||
|
//
|
||||||
|
typedef struct _XINPUT_GAMEPAD
|
||||||
|
{
|
||||||
|
WORD wButtons;
|
||||||
|
BYTE bLeftTrigger;
|
||||||
|
BYTE bRightTrigger;
|
||||||
|
SHORT sThumbLX;
|
||||||
|
SHORT sThumbLY;
|
||||||
|
SHORT sThumbRX;
|
||||||
|
SHORT sThumbRY;
|
||||||
|
} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_STATE
|
||||||
|
{
|
||||||
|
DWORD dwPacketNumber;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
} XINPUT_STATE, *PXINPUT_STATE;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_VIBRATION
|
||||||
|
{
|
||||||
|
WORD wLeftMotorSpeed;
|
||||||
|
WORD wRightMotorSpeed;
|
||||||
|
} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_CAPABILITIES
|
||||||
|
{
|
||||||
|
BYTE Type;
|
||||||
|
BYTE SubType;
|
||||||
|
WORD Flags;
|
||||||
|
XINPUT_GAMEPAD Gamepad;
|
||||||
|
XINPUT_VIBRATION Vibration;
|
||||||
|
} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_BATTERY_INFORMATION
|
||||||
|
{
|
||||||
|
BYTE BatteryType;
|
||||||
|
BYTE BatteryLevel;
|
||||||
|
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
|
||||||
|
|
||||||
|
typedef struct _XINPUT_KEYSTROKE
|
||||||
|
{
|
||||||
|
WORD VirtualKey;
|
||||||
|
WCHAR Unicode;
|
||||||
|
WORD Flags;
|
||||||
|
BYTE UserIndex;
|
||||||
|
BYTE HidCode;
|
||||||
|
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XInput APIs
|
||||||
|
//
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetState
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
XINPUT_STATE* pState // [out] Receives the current state
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputSetState
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
XINPUT_VIBRATION* pVibration // [in, out] The vibration information to send to the controller
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetCapabilities
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
DWORD dwFlags, // [in] Input flags that identify the device type
|
||||||
|
XINPUT_CAPABILITIES* pCapabilities // [out] Receives the capabilities
|
||||||
|
);
|
||||||
|
|
||||||
|
void WINAPI XInputEnable
|
||||||
|
(
|
||||||
|
BOOL enable // [in] Indicates whether xinput is enabled or disabled.
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetDSoundAudioDeviceGuids
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
GUID* pDSoundRenderGuid, // [out] DSound device ID for render
|
||||||
|
GUID* pDSoundCaptureGuid // [out] DSound device ID for capture
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetBatteryInformation
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
BYTE devType, // [in] Which device on this user index
|
||||||
|
XINPUT_BATTERY_INFORMATION* pBatteryInformation // [out] Contains the level and types of batteries
|
||||||
|
);
|
||||||
|
|
||||||
|
DWORD WINAPI XInputGetKeystroke
|
||||||
|
(
|
||||||
|
DWORD dwUserIndex, // [in] Index of the gamer associated with the device
|
||||||
|
DWORD dwReserved, // [in] Reserved for future use
|
||||||
|
PXINPUT_KEYSTROKE pKeystroke // [out] Pointer to an XINPUT_KEYSTROKE structure that receives an input event.
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //_XINPUT_H_
|
||||||
|
|
|
@ -161,14 +161,14 @@ void HK_StateLoadSlot(int num, bool justPressed)
|
||||||
if (romloaded && justPressed)
|
if (romloaded && justPressed)
|
||||||
{
|
{
|
||||||
BOOL wasPaused = paused;
|
BOOL wasPaused = paused;
|
||||||
NDS_Pause();
|
Pause();
|
||||||
loadstate_slot(num); //Loadstate
|
loadstate_slot(num); //Loadstate
|
||||||
lastSaveState = num; //Set last savestate used
|
lastSaveState = num; //Set last savestate used
|
||||||
|
|
||||||
UpdateToolWindows();
|
UpdateToolWindows();
|
||||||
|
|
||||||
if(!wasPaused)
|
if(!wasPaused)
|
||||||
NDS_UnPause();
|
Unpause();
|
||||||
else
|
else
|
||||||
Display();
|
Display();
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,7 @@ HMENU mainMenu = NULL; //Holds handle to the main DeSmuME menu
|
||||||
CToolBar* MainWindowToolbar;
|
CToolBar* MainWindowToolbar;
|
||||||
|
|
||||||
DWORD hKeyInputTimer;
|
DWORD hKeyInputTimer;
|
||||||
|
bool start_paused;
|
||||||
|
|
||||||
extern LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
extern LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
void InitRamSearch();
|
void InitRamSearch();
|
||||||
|
@ -2011,7 +2012,7 @@ void LoadSaveStateInfo()
|
||||||
static BOOL LoadROM(const char * filename, const char * logicalName)
|
static BOOL LoadROM(const char * filename, const char * logicalName)
|
||||||
{
|
{
|
||||||
ResetSaveStateTimes();
|
ResetSaveStateTimes();
|
||||||
NDS_Pause();
|
Pause();
|
||||||
//if (strcmp(filename,"")!=0) INFO("Attempting to load ROM: %s\n",filename);
|
//if (strcmp(filename,"")!=0) INFO("Attempting to load ROM: %s\n",filename);
|
||||||
|
|
||||||
if (NDS_LoadROM(filename, logicalName) > 0)
|
if (NDS_LoadROM(filename, logicalName) > 0)
|
||||||
|
@ -2553,6 +2554,7 @@ int _main()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
cmdline.validate();
|
cmdline.validate();
|
||||||
|
start_paused = cmdline.start_paused;
|
||||||
|
|
||||||
Desmume_InitOnce();
|
Desmume_InitOnce();
|
||||||
|
|
||||||
|
@ -2851,11 +2853,6 @@ int _main()
|
||||||
if(OpenCore(cmdline.nds_file.c_str()))
|
if(OpenCore(cmdline.nds_file.c_str()))
|
||||||
{
|
{
|
||||||
romloaded = TRUE;
|
romloaded = TRUE;
|
||||||
if(cmdline.start_paused)
|
|
||||||
{
|
|
||||||
NDS_Pause();
|
|
||||||
cmdline.start_paused = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3279,7 +3276,11 @@ static BOOL OpenCore(const char* filename)
|
||||||
{
|
{
|
||||||
romloaded = TRUE;
|
romloaded = TRUE;
|
||||||
if(movieMode == MOVIEMODE_INACTIVE)
|
if(movieMode == MOVIEMODE_INACTIVE)
|
||||||
Unpause();
|
{
|
||||||
|
if(!start_paused)
|
||||||
|
Unpause();
|
||||||
|
start_paused = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Update the toolbar
|
// Update the toolbar
|
||||||
MainWindowToolbar->EnableButton(IDM_PAUSE, true);
|
MainWindowToolbar->EnableButton(IDM_PAUSE, true);
|
||||||
|
|
Loading…
Reference in New Issue