Merge pull request #2029 from vgturtle127/beautification-11

Beautification 11 - Source/Project64-input directory
This commit is contained in:
zilmar 2021-04-12 13:26:14 +09:30 committed by GitHub
commit 1af0e1183f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 192 additions and 168 deletions

View File

@ -1,6 +1,5 @@
/**********************************************************************************
Project64 Controller plugin spec, version #1.1
**********************************************************************************/
// Project64 controller plugin spec, version 1.1
#pragma once
#include <Common/stdtypes.h>
@ -29,12 +28,13 @@ enum
PLUGIN_RAW = 5,
};
/***** Structures *****/
// Structures
typedef struct
{
uint16_t Version; /* Should be set to 0x0101 */
uint16_t Type; /* Set to PLUGIN_TYPE_CONTROLLER */
char Name[100]; /* Name of the DLL */
uint16_t Version; // Should be set to 0x0101
uint16_t Type; // Set to PLUGIN_TYPE_CONTROLLER
char Name[100]; // Name of the DLL
int32_t NormalMemory;
int32_t MemoryBswaped;
} PLUGIN_INFO;
@ -85,140 +85,152 @@ typedef struct
void * hwnd;
void * hinst;
int32_t MemoryBswaped; // Set this to true
uint8_t * HEADER; // This is the rom header (first 40h bytes of the rom)
uint8_t * HEADER; // This is the ROM header (first 40h bytes of the ROM)
CONTROL * Controls; // A pointer to an array of 4 controllers .. eg:
} CONTROL_INFO;
/******************************************************************
/*
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise.
down allowing the DLL to de-initialize.
input: none
output: none
*******************************************************************/
*/
EXPORT void CALL CloseDLL(void);
/******************************************************************
/*
Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a
specific controller.
input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram.
input: - Controller Number (0 to 3) and -1 signaling end of
processing the PIF RAM.
- Pointer of data to be processed.
output: none
note: This function is only needed if the DLL is allowing raw
data, or the plugin is set to raw
the data that is being processed looks like this:
initilize controller: 01 03 00 FF FF FF
read controller: 01 04 01 FF FF FF FF
*******************************************************************/
The data that is being processed looks like this:
Initialize controller: 01 03 00 FF FF FF
Read controller: 01 04 01 FF FF FF FF
*/
EXPORT void CALL ControllerCommand(int32_t Control, uint8_t * Command);
/******************************************************************
/*
Function: DllAbout
Purpose: This function is optional function that is provided
to give further information about the DLL.
input: a handle to the window that calls this function
output: none
*******************************************************************/
*/
EXPORT void CALL DllAbout(void * hParent);
/******************************************************************
/*
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the dll
to allow the user to configure the DLL
input: a handle to the window that calls this function
output: none
*******************************************************************/
*/
EXPORT void CALL DllConfig(void * hParent);
/******************************************************************
/*
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the dll
to allow the user to test the DLL
input: a handle to the window that calls this function
output: none
*******************************************************************/
*/
EXPORT void CALL DllTest(void * hParent);
/******************************************************************
/*
Function: GetDllInfo
Purpose: This function allows the emulator to gather information
about the dll by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO stucture that needs to be
about the DLL by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO structure that needs to be
filled by the function. (see def above)
output: none
*******************************************************************/
*/
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo);
/******************************************************************
/*
Function: GetKeys
Purpose: To get the current state of the controllers buttons.
input: - Controller Number (0 to 3)
- A pointer to a BUTTONS structure to be filled with
the controller state.
output: none
*******************************************************************/
*/
EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys);
/******************************************************************
/*
Function: InitiateControllers
Purpose: This function initialises how each of the controllers
Purpose: This function initializes how each of the controllers
should be handled.
input: - The handle to the main window.
- A controller structure that needs to be filled for
the emulator to know how to handle each controller.
output: none
*******************************************************************/
*/
EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo);
/******************************************************************
/*
Function: ReadController
Purpose: To process the raw data in the pif ram that is about to
Purpose: To process the raw data in the PIF RAM that is about to
be read.
input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram.
input: - Controller Number (0 to 3) and -1 signaling end of
processing the PIF RAM.
- Pointer of data to be processed.
output: none
note: This function is only needed if the DLL is allowing raw
data.
*******************************************************************/
*/
EXPORT void CALL ReadController(int Control, uint8_t * Command);
/******************************************************************
/*
Function: RomClosed
Purpose: This function is called when a rom is closed.
Purpose: This function is called when a ROM is closed.
input: none
output: none
*******************************************************************/
*/
EXPORT void CALL RomClosed(void);
/******************************************************************
/*
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
Purpose: This function is called when a ROM is open. (from the
emulation thread)
input: none
output: none
*******************************************************************/
*/
EXPORT void CALL RomOpen(void);
/******************************************************************
/*
Function: WM_KeyDown
Purpose: To pass the WM_KeyDown message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
*/
EXPORT void CALL WM_KeyDown(uint32_t wParam, uint32_t lParam);
/******************************************************************
/*
Function: WM_KeyUp
Purpose: To pass the WM_KEYUP message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
*/
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);

View File

@ -100,7 +100,7 @@ BOOL CDirectInput::EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi)
uint32_t DeviceType = GET_DIDEVICE_TYPE(lpddi->dwDevType);
if (DeviceType == DI8DEVTYPE_DEVICE)
{
// ignore generic devices
// Ignore generic devices
return DIENUM_CONTINUE;
}

View File

@ -384,7 +384,7 @@ CInputConfigUI::CInputConfigUI() :
m_pgController2(2),
m_pgController3(3)
{
m_psh.pszCaption = L"Configure Input";
m_psh.pszCaption = L"Configure input";
AddPage(&m_pgController0.m_psp);
AddPage(&m_pgController1.m_psp);
AddPage(&m_pgController2.m_psp);

View File

@ -5,24 +5,25 @@
#include "InputSettings.h"
#include <stdio.h>
/******************************************************************
/*
Function: CloseDLL
Purpose: This function is called when the emulator is closing
down allowing the dll to de-initialise.
down allowing the DLL to de-initialize.
input: none
output: none
*******************************************************************/
*/
EXPORT void CALL CloseDLL(void)
{
CleanupInputSettings();
}
/******************************************************************
/*
Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a
specific controller.
input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram.
input: - Controller Number (0 to 3) and -1 signaling end of
processing the PIF RAM.
- Pointer of data to be processed.
output: none
@ -30,14 +31,15 @@ note: This function is only needed if the DLL is allowing raw
data, or the plugin is set to raw
the data that is being processed looks like this:
initilize controller: 01 03 00 FF FF FF
read controller: 01 04 01 FF FF FF FF
*******************************************************************/
Initialize controller: 01 03 00 FF FF FF
Read controller: 01 04 01 FF FF FF FF
*/
EXPORT void CALL ControllerCommand(int32_t /*Control*/, uint8_t * /*Command*/)
{
}
/******************************************************************
/*
Function: DllAbout
Purpose: This function is optional function that is provided
to give further information about the DLL.
@ -51,10 +53,11 @@ output: none
/******************************************************************
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the dll
to allow the user to configure the DLL
input: a handle to the window that calls this function
output: none
*******************************************************************/
*/
#ifdef _WIN32
EXPORT void CALL DllConfig(void * hParent)
{
@ -62,59 +65,63 @@ EXPORT void CALL DllConfig(void * hParent)
}
#endif
/******************************************************************
/*
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the dll
to allow the user to test the DLL
input: a handle to the window that calls this function
output: none
*******************************************************************/
*/
EXPORT void CALL DllTest(void * /*hParent*/)
{
}
/******************************************************************
/*
Function: GetDllInfo
Purpose: This function allows the emulator to gather information
about the dll by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO stucture that needs to be
about the DLL by filling in the PluginInfo structure.
input: a pointer to a PLUGIN_INFO structure that needs to be
filled by the function. (see def above)
output: none
*******************************************************************/
*/
EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
{
PluginInfo->Version = CONTROLLER_SPECS_VERSION;
PluginInfo->Type = PLUGIN_TYPE_CONTROLLER;
#ifdef _DEBUG
sprintf(PluginInfo->Name, "Project64 Input Plugin (Debug): %s", VER_FILE_VERSION_STR);
sprintf(PluginInfo->Name, "Project64 input plugin (Debug): %s", VER_FILE_VERSION_STR);
#else
sprintf(PluginInfo->Name, "Project64 Input Plugin: %s", VER_FILE_VERSION_STR);
sprintf(PluginInfo->Name, "Project64 input plugin: %s", VER_FILE_VERSION_STR);
#endif
PluginInfo->MemoryBswaped = true;
PluginInfo->NormalMemory = false;
}
/******************************************************************
/*
Function: GetKeys
Purpose: To get the current state of the controllers buttons.
input: - Controller Number (0 to 3)
- A pointer to a BUTTONS structure to be filled with
the controller state.
output: none
*******************************************************************/
*/
EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys)
{
g_InputPlugin->GetKeys(Control, Keys);
}
/******************************************************************
/*
Function: InitiateControllers
Purpose: This function initialises how each of the controllers
Purpose: This function initializes how each of the controllers
should be handled.
input: - A controller structure that needs to be filled for
the emulator to know how to handle each controller.
output: none
*******************************************************************/
*/
EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo)
{
if (g_InputPlugin != nullptr)
@ -123,60 +130,65 @@ EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo)
}
}
/******************************************************************
/*
Function: ReadController
Purpose: To process the raw data in the pif ram that is about to
Purpose: To process the raw data in the PIF RAM that is about to
be read.
input: - Controller Number (0 to 3) and -1 signalling end of
processing the pif ram.
input: - Controller Number (0 to 3) and -1 signaling end of
processing the PIF RAM.
- Pointer of data to be processed.
output: none
note: This function is only needed if the DLL is allowing raw
data.
*******************************************************************/
*/
EXPORT void CALL ReadController(int /*Control*/, uint8_t * /*Command*/)
{
}
/******************************************************************
/*
Function: RomClosed
Purpose: This function is called when a rom is closed.
Purpose: This function is called when a ROM is closed.
input: none
output: none
*******************************************************************/
*/
EXPORT void CALL RomClosed(void)
{
}
/******************************************************************
/*
Function: RomOpen
Purpose: This function is called when a rom is open. (from the
Purpose: This function is called when a ROM is open. (from the
emulation thread)
input: none
output: none
*******************************************************************/
*/
EXPORT void CALL RomOpen(void)
{
}
/******************************************************************
/*
Function: WM_KeyDown
Purpose: To pass the WM_KeyDown message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
*/
EXPORT void CALL WM_KeyDown(uint32_t /*wParam*/, uint32_t /*lParam*/)
{
}
/******************************************************************
/*
Function: WM_KeyUp
Purpose: To pass the WM_KEYUP message from the emulator to the
plugin.
input: wParam and lParam of the WM_KEYDOWN message.
output: none
*******************************************************************/
*/
EXPORT void CALL WM_KeyUp(uint32_t /*wParam*/, uint32_t /*lParam*/)
{
}

View File

@ -90,7 +90,7 @@ void CScanButton::OnTimer(UINT_PTR nIDEvent)
time_t Now = time(nullptr);
if (10 - (Now - m_ScanStart) > 0)
{
Dialog.SetWindowText(stdstr_f("Configure Input: Press Key ... (%d seconds)", 10 - (Now - m_ScanStart)).ToUTF16().c_str());
Dialog.SetWindowText(stdstr_f("Configure input: Press key... (%d seconds)", 10 - (Now - m_ScanStart)).ToUTF16().c_str());
}
else
{
@ -116,7 +116,7 @@ void CScanButton::OnTimer(UINT_PTR nIDEvent)
{
m_ScanBtn.KillTimer(DETECT_KEY_TIMER);
CWindow Dialog = m_ScanBtn.GetParent().GetParent();
Dialog.SetWindowText(L"Configure Input");
Dialog.SetWindowText(L"Configure input");
if (m_Overlay.m_hWnd != NULL)
{