*** empty log message ***
This commit is contained in:
parent
6023f825ad
commit
15f6886d5c
4
Cxbe.dsp
4
Cxbe.dsp
|
@ -107,6 +107,10 @@ SOURCE=.\Doc\Changelog.txt
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Doc\Input.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Doc\RemovedCode.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
12
Cxbx.dsp
12
Cxbx.dsp
|
@ -117,6 +117,10 @@ SOURCE=.\Doc\Changelog.txt
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Doc\Input.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Doc\RemovedCode.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -145,6 +149,10 @@ SOURCE=.\Include\Cxbx.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\Win32\Cxbx\DlgGamepadConfig.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Include\Win32\Cxbx\EmuExe.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -209,6 +217,10 @@ SOURCE=.\Resource\Splash.bmp
|
|||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\Win32\Cxbx\DlgGamepadConfig.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Source\Win32\Cxbx\EmuExe.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -113,6 +113,10 @@ SOURCE=.\Doc\Changelog.txt
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Doc\Input.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Doc\RemovedCode.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -3,7 +3,7 @@ cxbx website: http://www.caustik.com/xbox/
|
|||
version: 0.6.1 (??/??/??)
|
||||
--------------------------------
|
||||
|
||||
- Controller input is working
|
||||
- Gamepad input is working
|
||||
|
||||
- Some color issues were resolved (hopefully)
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
Gamepad Input is configured using a dialog inside
|
||||
EmuDInput.cpp/.h
|
||||
|
||||
Configuration is actually saved into both the registry
|
||||
and shared memory within Cxbx.dll. This means that all
|
||||
active emulated games (even if there are many of them
|
||||
at the same time) will have the ability to refresh the
|
||||
current configuration at any given time.
|
||||
|
||||
This works out really great because this means you can
|
||||
make changes in the input configuration at any time and
|
||||
immediately see the changes take affect.
|
||||
|
||||
It is important to note that all access to this shared
|
||||
memory, as with all shared memory, should be protected
|
||||
with a mutual exclusion mechanism. Win32 provides such
|
||||
a mechanism and will be used.
|
||||
|
||||
-caustik
|
|
@ -0,0 +1,44 @@
|
|||
// ******************************************************************
|
||||
// *
|
||||
// * .,-::::: .,:: .::::::::. .,:: .:
|
||||
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
|
||||
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
|
||||
// * $$$ Y$$$P $$""""Y$$ Y$$$P
|
||||
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||
// *
|
||||
// * Cxbx->Win32->Cxbx->DlgGamepadConfig.h
|
||||
// *
|
||||
// * This file is part of the Cxbx project.
|
||||
// *
|
||||
// * Cxbx and Cxbe are free software; you can redistribute them
|
||||
// * and/or modify them under the terms of the GNU General Public
|
||||
// * License as published by the Free Software Foundation; either
|
||||
// * version 2 of the license, or (at your option) any later version.
|
||||
// *
|
||||
// * This program is distributed in the hope that it will be useful,
|
||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// * GNU General Public License for more details.
|
||||
// *
|
||||
// * You should have recieved a copy of the GNU General Public License
|
||||
// * along with this program; see the file COPYING.
|
||||
// * If not, write to the Free Software Foundation, Inc.,
|
||||
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
||||
// *
|
||||
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
|
||||
// *
|
||||
// * All rights reserved
|
||||
// *
|
||||
// ******************************************************************
|
||||
#ifndef DLGGAMEPADCONFIG_H
|
||||
#define DLGGAMEPADCONFIG_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// ******************************************************************
|
||||
// * Show Dialog
|
||||
// ******************************************************************
|
||||
extern void ShowGamepadConfig(HWND hwnd);
|
||||
|
||||
#endif
|
|
@ -7,7 +7,7 @@
|
|||
#define IDR_MAINMENU 103
|
||||
#define IDB_LOGO 106
|
||||
#define IDB_ABOUT 108
|
||||
#define IDD_CTRLCFG 111
|
||||
#define IDD_GAMEPAD_CFG 111
|
||||
#define IDC_SET_X 1000
|
||||
#define IDC_SET_Y 1001
|
||||
#define IDC_SET_A 1002
|
||||
|
@ -53,6 +53,7 @@
|
|||
#define ID_EMULATION_DEBUGOUTPUTKERNEL_FILE 40038
|
||||
#define ID_SETTINGS_AUTOGEN 40045
|
||||
#define ID_SETTINGS_CONFIGURECONTROLLER 40046
|
||||
#define ID_SETTINGS_CONFIG_GAMEPAD 40046
|
||||
#define ID_SETTINGS_CONFIGUREGRAPHICS 40047
|
||||
#define ID_SETTINGS_CONFIGURESOUND 40048
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#define WNDMAIN_H
|
||||
|
||||
#include "Wnd.h"
|
||||
#include "DlgGamepadConfig.h"
|
||||
|
||||
// ******************************************************************
|
||||
// * class : WndMain
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace xboxkrnl
|
|||
// * globals
|
||||
// ******************************************************************
|
||||
extern win32::HWND g_EmuWindow; // Rendering Window
|
||||
extern xboxkrnl::XINPUT_STATE g_EmuController1;
|
||||
extern xboxkrnl::XINPUT_STATE g_EmuGamepad1;
|
||||
|
||||
#include "OOVPA.h"
|
||||
#include "HLEDataBase.h"
|
||||
|
|
|
@ -37,14 +37,26 @@
|
|||
#include "Emu.h"
|
||||
|
||||
// ******************************************************************
|
||||
// * globals
|
||||
// * GamepadConfiguration
|
||||
// ******************************************************************
|
||||
extern VOID EmuPollController();
|
||||
class GamepadConfiguration
|
||||
{
|
||||
public:
|
||||
GamepadConfiguration() {}
|
||||
~GamepadConfiguration() {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
// ******************************************************************
|
||||
// * func: EmuPollGamepad
|
||||
// ******************************************************************
|
||||
extern void EmuPollGamepad();
|
||||
|
||||
// ******************************************************************
|
||||
// * func: EmuInitDInput
|
||||
// ******************************************************************
|
||||
VOID EmuInitDInput();
|
||||
extern void EmuInitDInput();
|
||||
|
||||
// ******************************************************************
|
||||
// * offsets into analog button array
|
||||
|
|
|
@ -106,16 +106,17 @@ BEGIN
|
|||
END
|
||||
POPUP "&Settings"
|
||||
BEGIN
|
||||
MENUITEM "Config &Controller...", ID_SETTINGS_CONFIGURECONTROLLER
|
||||
MENUITEM "Config &Gamepad...", ID_SETTINGS_CONFIG_GAMEPAD
|
||||
MENUITEM "Config &Audio...", ID_SETTINGS_CONFIGURESOUND
|
||||
MENUITEM "Config &Video...", ID_SETTINGS_CONFIGUREGRAPHICS
|
||||
|
||||
MENUITEM "Config &Graphics...", ID_SETTINGS_CONFIGUREGRAPHICS
|
||||
|
||||
MENUITEM "Config &Sound...", ID_SETTINGS_CONFIGURESOUND
|
||||
MENUITEM "", 1
|
||||
MENUITEM "&Generate Exe Automatically", ID_SETTINGS_AUTOGEN
|
||||
MENUITEM "Generate &Exe Automatically", ID_SETTINGS_AUTOGEN
|
||||
END
|
||||
POPUP "E&mulation"
|
||||
BEGIN
|
||||
MENUITEM "&Start\tF5", ID_EMULATION_START, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "&Debug Output (GUI)"
|
||||
BEGIN
|
||||
MENUITEM "&Console", ID_EMULATION_DEBUGOUTPUTGUI_CONSOLE
|
||||
|
@ -130,8 +131,6 @@ BEGIN
|
|||
MENUITEM "&File...", ID_EMULATION_DEBUGOUTPUTKERNEL_FILE
|
||||
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Start\tF5", ID_EMULATION_START, GRAYED
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
|
@ -150,7 +149,7 @@ END
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_CTRLCFG, DIALOG
|
||||
IDD_GAMEPAD_CFG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 336
|
||||
|
@ -166,9 +165,9 @@ END
|
|||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CTRLCFG DIALOG DISCARDABLE 0, 0, 343, 127
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Cxbx : Controller Configuration"
|
||||
IDD_GAMEPAD_CFG DIALOG DISCARDABLE 0, 0, 343, 127
|
||||
STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Cxbx : Gamepad Configuration"
|
||||
FONT 8, "Verdana"
|
||||
BEGIN
|
||||
GROUPBOX "Analog Buttons",IDC_STATIC,2,1,221,47
|
||||
|
@ -202,7 +201,7 @@ BEGIN
|
|||
PUSHBUTTON "&Cancel",IDC_INPUT_CONFIG_CANCEL,231,106,50,14,BS_FLAT
|
||||
PUSHBUTTON "&Accept",IDC_INPUT_CONFIG_ACCEPT,285,106,50,14,BS_FLAT
|
||||
GROUPBOX "Status",IDC_STATIC,2,98,338,27
|
||||
LTEXT "Waiting for YOU to push a button for configuration...",
|
||||
LTEXT "Waiting for you to push any of the above buttons...",
|
||||
IDC_STATIC,8,107,212,15,SS_CENTERIMAGE
|
||||
END
|
||||
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
// ******************************************************************
|
||||
// *
|
||||
// * .,-::::: .,:: .::::::::. .,:: .:
|
||||
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
|
||||
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
|
||||
// * $$$ Y$$$P $$""""Y$$ Y$$$P
|
||||
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
||||
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
||||
// *
|
||||
// * Cxbx->Win32->Cxbx->DlgGamepadConfig.cpp
|
||||
// *
|
||||
// * This file is part of the Cxbx project.
|
||||
// *
|
||||
// * Cxbx and Cxbe are free software; you can redistribute them
|
||||
// * and/or modify them under the terms of the GNU General Public
|
||||
// * License as published by the Free Software Foundation; either
|
||||
// * version 2 of the license, or (at your option) any later version.
|
||||
// *
|
||||
// * This program is distributed in the hope that it will be useful,
|
||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// * GNU General Public License for more details.
|
||||
// *
|
||||
// * You should have recieved a copy of the GNU General Public License
|
||||
// * along with this program; see the file COPYING.
|
||||
// * If not, write to the Free Software Foundation, Inc.,
|
||||
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
||||
// *
|
||||
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
|
||||
// *
|
||||
// * All rights reserved
|
||||
// *
|
||||
// ******************************************************************
|
||||
#include "Cxbx.h"
|
||||
#include "ResCxbx.h"
|
||||
#include "DlgGamepadConfig.h"
|
||||
|
||||
// ******************************************************************
|
||||
// * globals / static
|
||||
// ******************************************************************
|
||||
static INT_PTR CALLBACK DlgGamepadConfigProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// ******************************************************************
|
||||
// * Show Dialog
|
||||
// ******************************************************************
|
||||
void ShowGamepadConfig(HWND hwnd)
|
||||
{
|
||||
DialogBox
|
||||
(
|
||||
GetModuleHandle(NULL),
|
||||
MAKEINTRESOURCE(IDD_GAMEPAD_CFG),
|
||||
hwnd,
|
||||
DlgGamepadConfigProc
|
||||
);
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * Gamepad configuration dialog procedure
|
||||
// ******************************************************************
|
||||
INT_PTR CALLBACK DlgGamepadConfigProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SetClassLong(hwndDlg, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_CXBX)));
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
EndDialog(hwndDlg, wParam);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_INPUT_CONFIG_CANCEL:
|
||||
EndDialog(hwndDlg, wParam);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
|
@ -37,19 +37,30 @@
|
|||
#include "WndAbout.h"
|
||||
#include "ResCxbx.h"
|
||||
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
|
||||
// ******************************************************************
|
||||
// * constructor
|
||||
// ******************************************************************
|
||||
WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_bCreated(false), m_Xbe(0), m_Exe(0), m_bExeChanged(false), m_bXbeChanged(false), m_bAutoConvertToExe(TRUE), m_KrnlDebug(DM_NONE), m_CxbxDebug(DM_NONE)
|
||||
{
|
||||
m_classname = "WndMain";
|
||||
m_wndname = "Cxbx : Xbox Emulator";
|
||||
// ******************************************************************
|
||||
// * Initialize members
|
||||
// ******************************************************************
|
||||
{
|
||||
m_classname = "WndMain";
|
||||
m_wndname = "Cxbx : Xbox Emulator";
|
||||
|
||||
m_w = 327;
|
||||
m_h = 253;
|
||||
m_w = 327;
|
||||
m_h = 253;
|
||||
|
||||
m_ExeFilename = (char*)calloc(1, 260);
|
||||
m_XbeFilename = (char*)calloc(1, 260);
|
||||
|
||||
m_CxbxDebugFilename = (char*)calloc(1, 260);
|
||||
m_KrnlDebugFilename = (char*)calloc(1, 260);
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * Center to desktop
|
||||
|
@ -63,12 +74,6 @@ WndMain::WndMain(HINSTANCE x_hInstance) : Wnd(x_hInstance), m_bCreated(false), m
|
|||
m_y = rect.top + (rect.bottom - rect.top)/2 - m_h/2;
|
||||
}
|
||||
|
||||
m_ExeFilename = (char*)calloc(1, 260);
|
||||
m_XbeFilename = (char*)calloc(1, 260);
|
||||
|
||||
m_CxbxDebugFilename = (char*)calloc(1, 260);
|
||||
m_KrnlDebugFilename = (char*)calloc(1, 260);
|
||||
|
||||
// ******************************************************************
|
||||
// * Load configuration from registry
|
||||
// ******************************************************************
|
||||
|
@ -131,14 +136,19 @@ WndMain::~WndMain()
|
|||
}
|
||||
}
|
||||
|
||||
delete m_Xbe;
|
||||
delete m_Exe;
|
||||
// ******************************************************************
|
||||
// * Cleanup allocations
|
||||
// ******************************************************************
|
||||
{
|
||||
delete m_Xbe;
|
||||
delete m_Exe;
|
||||
|
||||
delete[] m_XbeFilename;
|
||||
delete[] m_ExeFilename;
|
||||
delete[] m_XbeFilename;
|
||||
delete[] m_ExeFilename;
|
||||
|
||||
delete[] m_CxbxDebugFilename;
|
||||
delete[] m_KrnlDebugFilename;
|
||||
delete[] m_CxbxDebugFilename;
|
||||
delete[] m_KrnlDebugFilename;
|
||||
}
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
|
@ -202,6 +212,9 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
{
|
||||
static bool s_bInitMenu = true;
|
||||
|
||||
// ******************************************************************
|
||||
// * initialize menu's if they haven't been yet
|
||||
// ******************************************************************
|
||||
if(s_bInitMenu)
|
||||
{
|
||||
RefreshMenus();
|
||||
|
@ -262,11 +275,12 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
switch(wParam)
|
||||
{
|
||||
case VK_F5:
|
||||
{
|
||||
if(m_Xbe != 0)
|
||||
StartEmulation(m_bAutoConvertToExe == TRUE);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -633,9 +647,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
m_bExeChanged = true;
|
||||
m_bXbeChanged = true;
|
||||
|
||||
// ******************************************************************
|
||||
// * patch to/from debug mode
|
||||
// ******************************************************************
|
||||
// patch to/from debug mode
|
||||
if((m_Xbe->m_Header.dwEntryAddr ^ XOR_EP_RETAIL) > 0x01000000)
|
||||
{
|
||||
// we're in debug mode, so switch over to retail
|
||||
|
@ -686,38 +698,36 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
|
||||
if(GetSaveFileName(&ofn) == TRUE)
|
||||
{
|
||||
// ******************************************************************
|
||||
// * ask permission to overwrite if file exists
|
||||
// ******************************************************************
|
||||
// ask permission to overwrite if file exists
|
||||
if(_access(ofn.lpstrFile, 0) != -1)
|
||||
{
|
||||
if(MessageBox(m_hwnd, "Overwrite existing file?", "Cxbx", MB_ICONQUESTION | MB_YESNO) != IDYES)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * dump xbe information
|
||||
// ******************************************************************
|
||||
{
|
||||
m_Xbe->DumpInformation(ofn.lpstrFile);
|
||||
// dump xbe information
|
||||
m_Xbe->DumpInformation(ofn.lpstrFile);
|
||||
|
||||
if(m_Xbe->GetError() != 0)
|
||||
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
|
||||
else
|
||||
{
|
||||
char buffer[255];
|
||||
if(m_Xbe->GetError() != 0)
|
||||
MessageBox(m_hwnd, m_Xbe->GetError(), "Cxbx", MB_ICONSTOP | MB_OK);
|
||||
else
|
||||
{
|
||||
char buffer[255];
|
||||
|
||||
sprintf(buffer, "%s's .xbe info was successfully exported.", m_Xbe->m_szAsciiTitle);
|
||||
sprintf(buffer, "%s's .xbe info was successfully exported.", m_Xbe->m_szAsciiTitle);
|
||||
|
||||
printf("WndMain: %s\n", buffer);
|
||||
printf("WndMain: %s\n", buffer);
|
||||
|
||||
MessageBox(m_hwnd, buffer, "Cxbx", MB_ICONINFORMATION | MB_OK);
|
||||
}
|
||||
}
|
||||
MessageBox(m_hwnd, buffer, "Cxbx", MB_ICONINFORMATION | MB_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_SETTINGS_CONFIG_GAMEPAD:
|
||||
ShowGamepadConfig(hwnd);
|
||||
break;
|
||||
|
||||
case ID_EMULATION_DEBUGOUTPUTKERNEL_CONSOLE:
|
||||
{
|
||||
if(m_KrnlDebug == DM_NONE || m_KrnlDebug == DM_FILE)
|
||||
|
@ -1093,8 +1103,8 @@ void WndMain::RefreshMenus()
|
|||
// ******************************************************************
|
||||
{
|
||||
HMENU emul_menu = GetSubMenu(menu, 3);
|
||||
HMENU emul_debg = GetSubMenu(emul_menu, 0);
|
||||
HMENU emul_krnl = GetSubMenu(emul_menu, 1);
|
||||
HMENU emul_debg = GetSubMenu(emul_menu, 2);
|
||||
HMENU emul_krnl = GetSubMenu(emul_menu, 3);
|
||||
|
||||
if(m_KrnlDebug == DM_CONSOLE)
|
||||
{
|
||||
|
@ -1429,4 +1439,4 @@ void WndMain::StartEmulation(bool x_bAutoConvert)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ using namespace win32;
|
|||
// ******************************************************************
|
||||
LPDIRECTINPUT8 g_pDI = NULL;
|
||||
LPDIRECTINPUTDEVICE8 g_pGameCtrl = NULL;
|
||||
xboxkrnl::XINPUT_STATE g_EmuController1 = {0};
|
||||
xboxkrnl::XINPUT_STATE g_EmuGamepad1 = {0};
|
||||
|
||||
// ******************************************************************
|
||||
// * statics
|
||||
|
@ -53,7 +53,7 @@ static BOOL CALLBACK EnumObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOI
|
|||
// ******************************************************************
|
||||
// * func: EmuInitDInput
|
||||
// ******************************************************************
|
||||
VOID xboxkrnl::EmuInitDInput()
|
||||
void xboxkrnl::EmuInitDInput()
|
||||
{
|
||||
// ******************************************************************
|
||||
// * Create DirectInput object
|
||||
|
@ -73,7 +73,7 @@ VOID xboxkrnl::EmuInitDInput()
|
|||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * Enumerate controller(s)
|
||||
// * Enumerate Gamepad(s)
|
||||
// ******************************************************************
|
||||
{
|
||||
HRESULT hRet = g_pDI->EnumDevices
|
||||
|
@ -92,7 +92,7 @@ VOID xboxkrnl::EmuInitDInput()
|
|||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * Set controller data format
|
||||
// * Set Gamepad data format
|
||||
// ******************************************************************
|
||||
{
|
||||
HRESULT hRet = g_pGameCtrl->SetDataFormat(&c_dfDIJoystick2);
|
||||
|
@ -112,7 +112,7 @@ VOID xboxkrnl::EmuInitDInput()
|
|||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * Enumerate controller objects
|
||||
// * Enumerate Gamepad objects
|
||||
// ******************************************************************
|
||||
{
|
||||
HRESULT hRet = g_pGameCtrl->EnumObjects(EnumObjectsCallback, NULL, DIDFT_ALL);
|
||||
|
@ -164,11 +164,11 @@ static BOOL CALLBACK EnumObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOI
|
|||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * func: EmuPollController
|
||||
// * func: EmuPollGamepad
|
||||
// ******************************************************************
|
||||
VOID xboxkrnl::EmuPollController()
|
||||
void xboxkrnl::EmuPollGamepad()
|
||||
{
|
||||
DIJOYSTATE2 ControllerState;
|
||||
DIJOYSTATE2 GamepadState;
|
||||
|
||||
if(g_pGameCtrl == NULL)
|
||||
return;
|
||||
|
@ -185,16 +185,16 @@ VOID xboxkrnl::EmuPollController()
|
|||
return;
|
||||
}
|
||||
|
||||
hRet = g_pGameCtrl->GetDeviceState(sizeof(DIJOYSTATE2), &ControllerState);
|
||||
hRet = g_pGameCtrl->GetDeviceState(sizeof(DIJOYSTATE2), &GamepadState);
|
||||
|
||||
if(FAILED(hRet))
|
||||
return;
|
||||
|
||||
g_EmuController1.dwPacketNumber++;
|
||||
g_EmuController1.Gamepad.sThumbRX = (short)ControllerState.lX;
|
||||
g_EmuController1.Gamepad.sThumbRY = (short)(-1 - ControllerState.lY);
|
||||
g_EmuController1.Gamepad.sThumbLX = (short)ControllerState.lRx;
|
||||
g_EmuController1.Gamepad.sThumbLY = (short)(-1 - ControllerState.lRy);
|
||||
g_EmuGamepad1.dwPacketNumber++;
|
||||
g_EmuGamepad1.Gamepad.sThumbRX = (short)GamepadState.lX;
|
||||
g_EmuGamepad1.Gamepad.sThumbRY = (short)(-1 - GamepadState.lY);
|
||||
g_EmuGamepad1.Gamepad.sThumbLX = (short)GamepadState.lRx;
|
||||
g_EmuGamepad1.Gamepad.sThumbLY = (short)(-1 - GamepadState.lRy);
|
||||
|
||||
return;
|
||||
}
|
|
@ -140,7 +140,7 @@ DWORD WINAPI xboxkrnl::EmuXGetDevices
|
|||
|
||||
EmuSwapFS(); // XBox FS
|
||||
|
||||
// TODO: Temporarily just return 1 controller, even if the user didn't ask about controllers
|
||||
// TODO: Temporarily just return 1 Gamepad, even if the user didn't ask about Gamepads
|
||||
return (1 << 0);
|
||||
}
|
||||
|
||||
|
@ -211,8 +211,8 @@ DWORD WINAPI xboxkrnl::EmuXInputGetCapabilities
|
|||
|
||||
DWORD ret = ERROR_INVALID_HANDLE;
|
||||
|
||||
// TODO: For now, the only valid handles are controllers 1 through 4,
|
||||
// and they are always normal controllers
|
||||
// TODO: For now, the only valid handles are Gamepad 1 through 4,
|
||||
// and they are always normal Gamepads
|
||||
if((int)hDevice >= 1 && (int)hDevice <= 4)
|
||||
{
|
||||
pCapabilities->SubType = XINPUT_DEVSUBTYPE_GC_GAMEPAD;
|
||||
|
@ -254,14 +254,14 @@ DWORD WINAPI xboxkrnl::EmuXInputGetState
|
|||
|
||||
DWORD ret = ERROR_INVALID_HANDLE;
|
||||
|
||||
// TODO: For now, the only valid handles are controllers 1 through 4,
|
||||
// and they are always normal controllers
|
||||
// TODO: For now, the only valid handles are Gamepad 1 through 4,
|
||||
// and they are always normal Gamepads
|
||||
if((int)hDevice >= 1 && (int)hDevice <= 4)
|
||||
{
|
||||
EmuPollController();
|
||||
EmuPollGamepad();
|
||||
|
||||
if((int)hDevice == 1)
|
||||
memcpy(pState, &g_EmuController1, sizeof(XINPUT_STATE));
|
||||
memcpy(pState, &g_EmuGamepad1, sizeof(XINPUT_STATE));
|
||||
|
||||
ret = ERROR_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue