input: backport PJ64-Input's N64 Mouse emulation
This commit is contained in:
parent
dd281e4e34
commit
13b1783141
|
@ -459,7 +459,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
Command[4] = 0x00;
|
Command[4] = 0x00;
|
||||||
switch (Controllers[Control].Plugin)
|
switch (Controllers[Control].Plugin)
|
||||||
{
|
{
|
||||||
case PLUGIN_TANSFER_PAK:
|
case PLUGIN_TRANSFER_PAK:
|
||||||
case PLUGIN_RUMBLE_PAK:
|
case PLUGIN_RUMBLE_PAK:
|
||||||
case PLUGIN_MEMPAK:
|
case PLUGIN_MEMPAK:
|
||||||
case PLUGIN_RAW:
|
case PLUGIN_RAW:
|
||||||
|
@ -506,7 +506,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
{
|
{
|
||||||
case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break;
|
case PLUGIN_RUMBLE_PAK: Rumblepak::ReadFrom(address, data); break;
|
||||||
case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break;
|
case PLUGIN_MEMPAK: g_Mempak->ReadFrom(Control, address, data); break;
|
||||||
case PLUGIN_TANSFER_PAK: Transferpak::ReadFrom((uint16_t)address, data); break;
|
case PLUGIN_TRANSFER_PAK: Transferpak::ReadFrom((uint16_t)address, data); break;
|
||||||
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
|
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
|
||||||
default:
|
default:
|
||||||
memset(&Command[5], 0, 0x20);
|
memset(&Command[5], 0, 0x20);
|
||||||
|
@ -547,7 +547,7 @@ void CPifRam::ProcessControllerCommand(int32_t Control, uint8_t * Command)
|
||||||
{
|
{
|
||||||
case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break;
|
case PLUGIN_MEMPAK: g_Mempak->WriteTo(Control, address, data); break;
|
||||||
case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break;
|
case PLUGIN_RUMBLE_PAK: Rumblepak::WriteTo(Control, address, data); break;
|
||||||
case PLUGIN_TANSFER_PAK: Transferpak::WriteTo((uint16_t)address, data); break;
|
case PLUGIN_TRANSFER_PAK: Transferpak::WriteTo((uint16_t)address, data); break;
|
||||||
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
|
case PLUGIN_RAW: if (g_Plugins->Control()->ControllerCommand) { g_Plugins->Control()->ControllerCommand(Control, Command); } break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -763,6 +763,10 @@ void CN64System::EndEmulation(void)
|
||||||
|
|
||||||
void CN64System::Pause()
|
void CN64System::Pause()
|
||||||
{
|
{
|
||||||
|
if (m_Plugins && m_Plugins->Control()->EmulationPaused)
|
||||||
|
{
|
||||||
|
m_Plugins->Control()->EmulationPaused();
|
||||||
|
}
|
||||||
if (m_EndEmulation)
|
if (m_EndEmulation)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
|
||||||
#include <Project64-core/N64System/N64Rom.h>
|
|
||||||
#include <Project64-core/N64System/N64Disk.h>
|
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/Register.h>
|
#include <Project64-core/N64System/Mips/Register.h>
|
||||||
|
#include <Project64-core/N64System/N64Disk.h>
|
||||||
|
#include <Project64-core/N64System/N64Rom.h>
|
||||||
#include <Project64-core/N64System/N64System.h>
|
#include <Project64-core/N64System/N64System.h>
|
||||||
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
#include <Project64-core/Plugins/AudioPlugin.h>
|
#include <Project64-core/Plugins/AudioPlugin.h>
|
||||||
|
#include <Project64-plugin-spec/Audio.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,15 +42,39 @@ bool CAudioPlugin::LoadFunctions(void)
|
||||||
LoadFunction(ProcessAList);
|
LoadFunction(ProcessAList);
|
||||||
|
|
||||||
// Make sure DLL has all needed functions
|
// Make sure DLL has all needed functions
|
||||||
if (AiDacrateChanged == nullptr) { UnloadPlugin(); return false; }
|
if (AiDacrateChanged == nullptr)
|
||||||
if (AiLenChanged == nullptr) { UnloadPlugin(); return false; }
|
{
|
||||||
if (AiReadLength == nullptr) { UnloadPlugin(); return false; }
|
UnloadPlugin();
|
||||||
if (InitiateAudio == nullptr) { UnloadPlugin(); return false; }
|
return false;
|
||||||
if (ProcessAList == nullptr) { UnloadPlugin(); return false; }
|
}
|
||||||
|
if (AiLenChanged == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (AiReadLength == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (InitiateAudio == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ProcessAList == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -57,12 +83,10 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
{
|
{
|
||||||
struct AUDIO_INFO
|
struct AUDIO_INFO
|
||||||
{
|
{
|
||||||
void * hwnd;
|
void * hWnd;
|
||||||
void * hinst;
|
void * hinst;
|
||||||
|
|
||||||
int32_t MemoryBswaped; // If this is set to TRUE, then the memory has been pre-bswap'd on a DWORD (32-bit) boundary
|
int32_t Reserved;
|
||||||
// eg. the first 8 bytes are stored like this:
|
|
||||||
// 4 3 2 1 8 7 6 5
|
|
||||||
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)
|
||||||
// This will be in the same memory format as the rest of the memory
|
// This will be in the same memory format as the rest of the memory
|
||||||
uint8_t * RDRAM;
|
uint8_t * RDRAM;
|
||||||
|
@ -84,18 +108,21 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
// Get function from DLL
|
// Get function from DLL
|
||||||
int32_t(CALL * InitiateAudio)(AUDIO_INFO Audio_Info);
|
int32_t(CALL * InitiateAudio)(AUDIO_INFO Audio_Info);
|
||||||
LoadFunction(InitiateAudio);
|
LoadFunction(InitiateAudio);
|
||||||
if (InitiateAudio == nullptr) { return false; }
|
if (InitiateAudio == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AUDIO_INFO Info = {0};
|
AUDIO_INFO Info = {0};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Info.hwnd = Window ? Window->GetWindowHandle() : nullptr;
|
Info.hWnd = Window ? Window->GetWindowHandle() : nullptr;
|
||||||
Info.hinst = Window ? Window->GetModuleInstance() : nullptr;
|
Info.hinst = Window ? Window->GetModuleInstance() : nullptr;
|
||||||
#else
|
#else
|
||||||
Info.hwnd = nullptr;
|
Info.hWnd = nullptr;
|
||||||
Info.hinst = nullptr;
|
Info.hinst = nullptr;
|
||||||
#endif
|
#endif
|
||||||
Info.MemoryBswaped = true;
|
Info.Reserved = true;
|
||||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||||
|
|
||||||
// We are initializing the plugin before any ROM is loaded so we do not have any correct
|
// We are initializing the plugin before any ROM is loaded so we do not have any correct
|
||||||
|
@ -138,7 +165,6 @@ bool CAudioPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
Info.AI__DACRATE_REG = &Reg.AI_DACRATE_REG;
|
Info.AI__DACRATE_REG = &Reg.AI_DACRATE_REG;
|
||||||
Info.AI__BITRATE_REG = &Reg.AI_BITRATE_REG;
|
Info.AI__BITRATE_REG = &Reg.AI_BITRATE_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Initialized = InitiateAudio(Info) != 0;
|
m_Initialized = InitiateAudio(Info) != 0;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -183,7 +209,10 @@ void CAudioPlugin::UnloadPluginDetails(void)
|
||||||
|
|
||||||
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
void CAudioPlugin::DacrateChanged(SYSTEM_TYPE Type)
|
||||||
{
|
{
|
||||||
if (!Initialized()) { return; }
|
if (!Initialized())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
||||||
|
|
||||||
//uint32_t Frequency = g_Reg->AI_DACRATE_REG * 30;
|
//uint32_t Frequency = g_Reg->AI_DACRATE_REG * 30;
|
||||||
|
|
|
@ -18,9 +18,18 @@ private:
|
||||||
CAudioPlugin(const CAudioPlugin &);
|
CAudioPlugin(const CAudioPlugin &);
|
||||||
CAudioPlugin & operator=(const CAudioPlugin &);
|
CAudioPlugin & operator=(const CAudioPlugin &);
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstAudioDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstAudioSettings; }
|
{
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_AUDIO; }
|
return FirstAudioDefaultSet;
|
||||||
|
}
|
||||||
|
virtual int32_t GetSettingStartRange() const
|
||||||
|
{
|
||||||
|
return FirstAudioSettings;
|
||||||
|
}
|
||||||
|
PLUGIN_TYPE type()
|
||||||
|
{
|
||||||
|
return PLUGIN_TYPE_AUDIO;
|
||||||
|
}
|
||||||
|
|
||||||
void * m_hAudioThread;
|
void * m_hAudioThread;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
|
||||||
#include <Project64-core/N64System/N64Rom.h>
|
|
||||||
#include <Project64-core/N64System/Mips/Register.h>
|
|
||||||
#include "ControllerPlugin.h"
|
#include "ControllerPlugin.h"
|
||||||
|
#include <Project64-core/N64System/Mips/Register.h>
|
||||||
|
#include <Project64-core/N64System/N64Rom.h>
|
||||||
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
|
|
||||||
CControl_Plugin::CControl_Plugin(void) :
|
CControl_Plugin::CControl_Plugin(void) :
|
||||||
WM_KeyDown(nullptr),
|
WM_KeyDown(nullptr),
|
||||||
|
@ -34,13 +35,23 @@ bool CControl_Plugin::LoadFunctions(void)
|
||||||
LoadFunction(WM_KeyDown);
|
LoadFunction(WM_KeyDown);
|
||||||
LoadFunction(WM_KeyUp);
|
LoadFunction(WM_KeyUp);
|
||||||
LoadFunction(RumbleCommand);
|
LoadFunction(RumbleCommand);
|
||||||
|
LoadFunction(WM_KillFocus);
|
||||||
|
LoadFunction(EmulationPaused);
|
||||||
|
|
||||||
// Make sure DLL had all needed functions
|
// Make sure DLL had all needed functions
|
||||||
if (InitiateControllers == nullptr) { UnloadPlugin(); return false; }
|
if (InitiateControllers == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0102)
|
if (m_PluginInfo.Version >= 0x0102)
|
||||||
{
|
{
|
||||||
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate our own controller
|
// Allocate our own controller
|
||||||
|
@ -58,7 +69,7 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
|
|
||||||
for (int32_t i = 0; i < 4; i++)
|
for (int32_t i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
m_PluginControllers[i].Present = false;
|
m_PluginControllers[i].Present = PRESENT_NONE;
|
||||||
m_PluginControllers[i].RawData = false;
|
m_PluginControllers[i].RawData = false;
|
||||||
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
m_PluginControllers[i].Plugin = PLUGIN_NONE;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +80,10 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
// Get function from DLL
|
// Get function from DLL
|
||||||
void(CALL * InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
void(CALL * InitiateControllers_1_0)(void * hMainWindow, CONTROL Controls[4]);
|
||||||
_LoadFunction("InitiateControllers", InitiateControllers_1_0);
|
_LoadFunction("InitiateControllers", InitiateControllers_1_0);
|
||||||
if (InitiateControllers_1_0 == nullptr) { return false; }
|
if (InitiateControllers_1_0 == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
InitiateControllers_1_0(Window->GetWindowHandle(), m_PluginControllers);
|
||||||
#else
|
#else
|
||||||
|
@ -84,19 +98,22 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
ControlInfo.HEADER = (System == nullptr ? Buffer : g_Rom->GetRomAddress());
|
ControlInfo.HEADER = (System == nullptr ? Buffer : g_Rom->GetRomAddress());
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ControlInfo.hinst = Window ? Window->GetModuleInstance() : nullptr;
|
ControlInfo.hinst = Window ? Window->GetModuleInstance() : nullptr;
|
||||||
ControlInfo.hMainWindow = Window ? Window->GetWindowHandle() : nullptr;
|
ControlInfo.hWnd = Window ? Window->GetWindowHandle() : nullptr;
|
||||||
#else
|
#else
|
||||||
ControlInfo.hinst = nullptr;
|
ControlInfo.hinst = nullptr;
|
||||||
ControlInfo.hMainWindow = nullptr;
|
ControlInfo.hWnd = nullptr;
|
||||||
#endif
|
#endif
|
||||||
ControlInfo.MemoryBswaped = true;
|
ControlInfo.Reserved = true;
|
||||||
|
|
||||||
if (m_PluginInfo.Version == 0x0101)
|
if (m_PluginInfo.Version == 0x0101)
|
||||||
{
|
{
|
||||||
// Get function from DLL
|
// Get function from DLL
|
||||||
void(CALL * InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
void(CALL * InitiateControllers_1_1)(CONTROL_INFO ControlInfo);
|
||||||
_LoadFunction("InitiateControllers", InitiateControllers_1_1);
|
_LoadFunction("InitiateControllers", InitiateControllers_1_1);
|
||||||
if (InitiateControllers_1_1 == nullptr) { return false; }
|
if (InitiateControllers_1_1 == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
InitiateControllers_1_1(ControlInfo);
|
InitiateControllers_1_1(ControlInfo);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
@ -106,7 +123,10 @@ bool CControl_Plugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||||
// Get function from DLL
|
// Get function from DLL
|
||||||
void(CALL * InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
void(CALL * InitiateControllers_1_2)(CONTROL_INFO * ControlInfo);
|
||||||
_LoadFunction("InitiateControllers", InitiateControllers_1_2);
|
_LoadFunction("InitiateControllers", InitiateControllers_1_2);
|
||||||
if (InitiateControllers_1_2 == nullptr) { return false; }
|
if (InitiateControllers_1_2 == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
InitiateControllers_1_2(&ControlInfo);
|
InitiateControllers_1_2(&ControlInfo);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
|
@ -136,10 +156,16 @@ void CControl_Plugin::UnloadPluginDetails(void)
|
||||||
|
|
||||||
void CControl_Plugin::UpdateKeys(void)
|
void CControl_Plugin::UpdateKeys(void)
|
||||||
{
|
{
|
||||||
if (!m_AllocatedControllers) { return; }
|
if (!m_AllocatedControllers)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (int32_t cont = 0; cont < sizeof(m_Controllers) / sizeof(m_Controllers[0]); cont++)
|
for (int32_t cont = 0; cont < sizeof(m_Controllers) / sizeof(m_Controllers[0]); cont++)
|
||||||
{
|
{
|
||||||
if (!m_Controllers[cont]->Present()) { continue; }
|
if (!m_Controllers[cont]->Present())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!m_Controllers[cont]->m_RawData)
|
if (!m_Controllers[cont]->m_RawData)
|
||||||
{
|
{
|
||||||
GetKeys(cont, &m_Controllers[cont]->m_Buttons);
|
GetKeys(cont, &m_Controllers[cont]->m_Buttons);
|
||||||
|
@ -149,7 +175,10 @@ void CControl_Plugin::UpdateKeys(void)
|
||||||
g_Notify->BreakPoint(__FILE__, __LINE__);
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ReadController) { ReadController(-1, nullptr); }
|
if (ReadController)
|
||||||
|
{
|
||||||
|
ReadController(-1, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
void CControl_Plugin::SetControl(CControl_Plugin const * const Plugin)
|
||||||
|
|
|
@ -1,64 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
#include <Project64-plugin-spec/Input.h>
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4201) // warning C4201: nonstandard extension used : nameless struct/union
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
uint32_t Value;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned R_DPAD : 1;
|
|
||||||
unsigned L_DPAD : 1;
|
|
||||||
unsigned D_DPAD : 1;
|
|
||||||
unsigned U_DPAD : 1;
|
|
||||||
unsigned START_BUTTON : 1;
|
|
||||||
unsigned Z_TRIG : 1;
|
|
||||||
unsigned B_BUTTON : 1;
|
|
||||||
unsigned A_BUTTON : 1;
|
|
||||||
|
|
||||||
unsigned R_CBUTTON : 1;
|
|
||||||
unsigned L_CBUTTON : 1;
|
|
||||||
unsigned D_CBUTTON : 1;
|
|
||||||
unsigned U_CBUTTON : 1;
|
|
||||||
unsigned R_TRIG : 1;
|
|
||||||
unsigned L_TRIG : 1;
|
|
||||||
unsigned Reserved1 : 1;
|
|
||||||
unsigned Reserved2 : 1;
|
|
||||||
|
|
||||||
signed X_AXIS : 8;
|
|
||||||
|
|
||||||
signed Y_AXIS : 8;
|
|
||||||
};
|
|
||||||
} BUTTONS;
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int32_t Present;
|
|
||||||
int32_t RawData;
|
|
||||||
int32_t Plugin;
|
|
||||||
} CONTROL;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
void * hMainWindow;
|
|
||||||
void * hinst;
|
|
||||||
|
|
||||||
int32_t MemoryBswaped; // Memory in client or server-native endian
|
|
||||||
uint8_t * HEADER; // The ROM header (first 40h bytes of the ROM)
|
|
||||||
CONTROL * Controls; // Pointer to array of 4 controllers, i.e.: CONTROL Controls[4];
|
|
||||||
} CONTROL_INFO;
|
|
||||||
|
|
||||||
enum PluginType
|
|
||||||
{
|
|
||||||
PLUGIN_NONE = 1,
|
|
||||||
PLUGIN_MEMPAK = 2,
|
|
||||||
PLUGIN_RUMBLE_PAK = 3,
|
|
||||||
PLUGIN_TANSFER_PAK = 4, // Not implemented for non-raw data
|
|
||||||
PLUGIN_RAW = 5, // The controller plugin is passed in raw data
|
|
||||||
};
|
|
||||||
|
|
||||||
class CControl_Plugin;
|
class CControl_Plugin;
|
||||||
|
|
||||||
|
@ -66,9 +8,19 @@ class CCONTROL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CCONTROL(int32_t & Present, int32_t & RawData, int32_t & PlugType);
|
CCONTROL(int32_t & Present, int32_t & RawData, int32_t & PlugType);
|
||||||
inline bool Present(void) const { return m_Present != 0; }
|
inline bool Present(void) const
|
||||||
inline uint32_t Buttons(void) const { return m_Buttons.Value; }
|
{
|
||||||
inline PluginType Plugin(void) const { return static_cast<PluginType>(m_PlugType); }
|
return m_Present != 0;
|
||||||
|
}
|
||||||
|
inline uint32_t Buttons(void) const
|
||||||
|
{
|
||||||
|
return m_Buttons.Value;
|
||||||
|
}
|
||||||
|
inline PluginType Plugin(void) const
|
||||||
|
{
|
||||||
|
return static_cast<PluginType>(m_PlugType);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CControl_Plugin;
|
friend class CControl_Plugin;
|
||||||
|
|
||||||
|
@ -94,21 +46,38 @@ public:
|
||||||
|
|
||||||
void(CALL * WM_KeyDown)(uint32_t wParam, uint32_t lParam);
|
void(CALL * WM_KeyDown)(uint32_t wParam, uint32_t lParam);
|
||||||
void(CALL * WM_KeyUp)(uint32_t wParam, uint32_t lParam);
|
void(CALL * WM_KeyUp)(uint32_t wParam, uint32_t lParam);
|
||||||
|
void(CALL * WM_KillFocus)(uint32_t wParam, uint32_t lParam);
|
||||||
|
void(CALL * EmulationPaused)();
|
||||||
void(CALL * RumbleCommand)(int32_t Control, int32_t bRumble);
|
void(CALL * RumbleCommand)(int32_t Control, int32_t bRumble);
|
||||||
void(CALL * GetKeys) (int32_t Control, BUTTONS * Keys);
|
void(CALL * GetKeys) (int32_t Control, BUTTONS * Keys);
|
||||||
void(CALL * ReadController)(int32_t Control, uint8_t * Command);
|
void(CALL * ReadController)(int32_t Control, uint8_t * Command);
|
||||||
void(CALL * ControllerCommand)(int32_t Control, uint8_t * Command);
|
void(CALL * ControllerCommand)(int32_t Control, uint8_t * Command);
|
||||||
|
|
||||||
inline CCONTROL const * Controller(int32_t control) { return m_Controllers[control]; }
|
inline CCONTROL const * Controller(int32_t control)
|
||||||
inline CONTROL * PluginControllers(void) { return m_PluginControllers; }
|
{
|
||||||
|
return m_Controllers[control];
|
||||||
|
}
|
||||||
|
inline CONTROL * PluginControllers(void)
|
||||||
|
{
|
||||||
|
return m_PluginControllers;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CControl_Plugin(const CControl_Plugin &);
|
CControl_Plugin(const CControl_Plugin &);
|
||||||
CControl_Plugin & operator=(const CControl_Plugin &);
|
CControl_Plugin & operator=(const CControl_Plugin &);
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstCtrlDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstCtrlSettings; }
|
{
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_CONTROLLER; }
|
return FirstCtrlDefaultSet;
|
||||||
|
}
|
||||||
|
virtual int32_t GetSettingStartRange() const
|
||||||
|
{
|
||||||
|
return FirstCtrlSettings;
|
||||||
|
}
|
||||||
|
PLUGIN_TYPE type()
|
||||||
|
{
|
||||||
|
return PLUGIN_TYPE_CONTROLLER;
|
||||||
|
}
|
||||||
bool LoadFunctions(void);
|
bool LoadFunctions(void);
|
||||||
void UnloadPluginDetails(void);
|
void UnloadPluginDetails(void);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
|
||||||
#include <Project64-core/N64System/N64Rom.h>
|
#include "GFXPlugin.h"
|
||||||
#include <Project64-core/N64System/N64Disk.h>
|
|
||||||
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
#include <Project64-core/N64System/Mips/MemoryVirtualMem.h>
|
||||||
#include <Project64-core/N64System/Mips/Register.h>
|
#include <Project64-core/N64System/Mips/Register.h>
|
||||||
|
#include <Project64-core/N64System/N64Disk.h>
|
||||||
|
#include <Project64-core/N64System/N64Rom.h>
|
||||||
#include <Project64-core/N64System/N64System.h>
|
#include <Project64-core/N64System/N64System.h>
|
||||||
#include "GFXPlugin.h"
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
|
|
||||||
CGfxPlugin::CGfxPlugin() :
|
CGfxPlugin::CGfxPlugin() :
|
||||||
CaptureScreen(nullptr),
|
CaptureScreen(nullptr),
|
||||||
|
@ -62,15 +63,46 @@ bool CGfxPlugin::LoadFunctions(void)
|
||||||
LoadFunction(OnRomBrowserMenuItem);
|
LoadFunction(OnRomBrowserMenuItem);
|
||||||
|
|
||||||
// Make sure DLL had all needed functions
|
// Make sure DLL had all needed functions
|
||||||
if (ChangeWindow == nullptr) { UnloadPlugin(); return false; }
|
if (ChangeWindow == nullptr)
|
||||||
if (DrawScreen == nullptr) { DrawScreen = DummyDrawScreen; }
|
{
|
||||||
if (InitiateGFX == nullptr) { UnloadPlugin(); return false; }
|
UnloadPlugin();
|
||||||
if (MoveScreen == nullptr) { MoveScreen = DummyMoveScreen; }
|
return false;
|
||||||
if (ProcessDList == nullptr) { UnloadPlugin(); return false; }
|
}
|
||||||
if (UpdateScreen == nullptr) { UnloadPlugin(); return false; }
|
if (DrawScreen == nullptr)
|
||||||
if (ViStatusChanged == nullptr) { ViStatusChanged = DummyViStatusChanged; }
|
{
|
||||||
if (ViWidthChanged == nullptr) { ViWidthChanged = DummyViWidthChanged; }
|
DrawScreen = DummyDrawScreen;
|
||||||
if (SoftReset == nullptr) { SoftReset = DummySoftReset; }
|
}
|
||||||
|
if (InitiateGFX == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (MoveScreen == nullptr)
|
||||||
|
{
|
||||||
|
MoveScreen = DummyMoveScreen;
|
||||||
|
}
|
||||||
|
if (ProcessDList == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (UpdateScreen == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ViStatusChanged == nullptr)
|
||||||
|
{
|
||||||
|
ViStatusChanged = DummyViStatusChanged;
|
||||||
|
}
|
||||||
|
if (ViWidthChanged == nullptr)
|
||||||
|
{
|
||||||
|
ViWidthChanged = DummyViWidthChanged;
|
||||||
|
}
|
||||||
|
if (SoftReset == nullptr)
|
||||||
|
{
|
||||||
|
SoftReset = DummySoftReset;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0103)
|
if (m_PluginInfo.Version >= 0x0103)
|
||||||
{
|
{
|
||||||
|
@ -80,14 +112,30 @@ bool CGfxPlugin::LoadFunctions(void)
|
||||||
LoadFunction(GetDebugInfo);
|
LoadFunction(GetDebugInfo);
|
||||||
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
_LoadFunction("InitiateGFXDebugger", InitiateDebugger);
|
||||||
|
|
||||||
if (ProcessRDPList == nullptr) { UnloadPlugin(); return false; }
|
if (ProcessRDPList == nullptr)
|
||||||
if (CaptureScreen == nullptr) { UnloadPlugin(); return false; }
|
{
|
||||||
if (ShowCFB == nullptr) { UnloadPlugin(); return false; }
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (CaptureScreen == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (ShowCFB == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_PluginInfo.Version >= 0x0104)
|
if (m_PluginInfo.Version >= 0x0104)
|
||||||
{
|
{
|
||||||
if (PluginOpened == nullptr) { UnloadPlugin(); return false; }
|
if (PluginOpened == nullptr)
|
||||||
|
{
|
||||||
|
UnloadPlugin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetDebugInfo != nullptr)
|
if (GetDebugInfo != nullptr)
|
||||||
|
@ -267,13 +315,10 @@ void CGfxPlugin::UnloadPluginDetails(void)
|
||||||
}
|
}
|
||||||
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
memset(&m_GFXDebug, 0, sizeof(m_GFXDebug));
|
||||||
|
|
||||||
// CaptureScreen = nullptr;
|
|
||||||
ChangeWindow = nullptr;
|
ChangeWindow = nullptr;
|
||||||
GetDebugInfo = nullptr;
|
GetDebugInfo = nullptr;
|
||||||
DrawScreen = nullptr;
|
DrawScreen = nullptr;
|
||||||
DrawStatus = nullptr;
|
DrawStatus = nullptr;
|
||||||
// FrameBufferRead = nullptr;
|
|
||||||
// FrameBufferWrite = nullptr;
|
|
||||||
InitiateDebugger = nullptr;
|
InitiateDebugger = nullptr;
|
||||||
MoveScreen = nullptr;
|
MoveScreen = nullptr;
|
||||||
ProcessDList = nullptr;
|
ProcessDList = nullptr;
|
||||||
|
|
|
@ -66,16 +66,28 @@ public:
|
||||||
void *(CALL * GetRomBrowserMenu)(void); // Items should have an ID between 4101 and 4200
|
void *(CALL * GetRomBrowserMenu)(void); // Items should have an ID between 4101 and 4200
|
||||||
void(CALL * OnRomBrowserMenuItem)(int32_t MenuID, void * hParent, uint8_t * HEADER);
|
void(CALL * OnRomBrowserMenuItem)(int32_t MenuID, void * hParent, uint8_t * HEADER);
|
||||||
|
|
||||||
void * GetDebugMenu(void) { return m_GFXDebug.hGFXMenu; }
|
void * GetDebugMenu(void)
|
||||||
|
{
|
||||||
|
return m_GFXDebug.hGFXMenu;
|
||||||
|
}
|
||||||
void ProcessMenuItem(int32_t id);
|
void ProcessMenuItem(int32_t id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CGfxPlugin(const CGfxPlugin &);
|
CGfxPlugin(const CGfxPlugin &);
|
||||||
CGfxPlugin & operator=(const CGfxPlugin &);
|
CGfxPlugin & operator=(const CGfxPlugin &);
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const { return FirstGfxDefaultSet; }
|
virtual int32_t GetDefaultSettingStartRange() const
|
||||||
virtual int32_t GetSettingStartRange() const { return FirstGfxSettings; }
|
{
|
||||||
PLUGIN_TYPE type() { return PLUGIN_TYPE_GFX; }
|
return FirstGfxDefaultSet;
|
||||||
|
}
|
||||||
|
virtual int32_t GetSettingStartRange() const
|
||||||
|
{
|
||||||
|
return FirstGfxSettings;
|
||||||
|
}
|
||||||
|
PLUGIN_TYPE type()
|
||||||
|
{
|
||||||
|
return PLUGIN_TYPE_VIDEO;
|
||||||
|
}
|
||||||
|
|
||||||
void UnloadPluginDetails(void);
|
void UnloadPluginDetails(void);
|
||||||
|
|
||||||
|
@ -87,9 +99,19 @@ private:
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
static void SwapBuffers(void);
|
static void SwapBuffers(void);
|
||||||
#endif
|
#endif
|
||||||
static void CALL DummyDrawScreen(void) {}
|
static void CALL DummyDrawScreen(void)
|
||||||
static void CALL DummyMoveScreen(int32_t /*xpos*/, int32_t /*ypos*/) {}
|
{
|
||||||
static void CALL DummyViStatusChanged(void) {}
|
}
|
||||||
static void CALL DummyViWidthChanged(void) {}
|
static void CALL DummyMoveScreen(int32_t /*xpos*/, int32_t /*ypos*/)
|
||||||
static void CALL DummySoftReset(void) {}
|
{
|
||||||
|
}
|
||||||
|
static void CALL DummyViStatusChanged(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static void CALL DummyViWidthChanged(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static void CALL DummySoftReset(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
|
@ -1,14 +1,15 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/N64System/SystemGlobals.h>
|
|
||||||
#include <Project64-core/N64System/N64System.h>
|
|
||||||
#include <Project64-core/Plugins/Plugin.h>
|
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
#include <Project64-core/N64System/N64System.h>
|
||||||
|
#include <Project64-core/N64System/SystemGlobals.h>
|
||||||
|
#include <Project64-core/Plugins/Plugin.h>
|
||||||
|
|
||||||
CPlugins::CPlugins(SettingID PluginDirSetting, bool SyncPlugins) :
|
CPlugins::CPlugins(SettingID PluginDirSetting, bool SyncPlugins) :
|
||||||
m_MainWindow(nullptr),
|
m_MainWindow(nullptr),
|
||||||
m_SyncWindow(nullptr),
|
m_SyncWindow(nullptr),
|
||||||
m_PluginDirSetting(PluginDirSetting),
|
m_PluginDirSetting(PluginDirSetting),
|
||||||
m_PluginDir(g_Settings->LoadStringVal(PluginDirSetting)),
|
m_PluginDir(CPath(g_Settings->LoadStringVal(PluginDirSetting)).NormalizePath(CPath(CPath::MODULE_DIRECTORY))),
|
||||||
m_Gfx(nullptr),
|
m_Gfx(nullptr),
|
||||||
m_Audio(nullptr),
|
m_Audio(nullptr),
|
||||||
m_RSP(nullptr),
|
m_RSP(nullptr),
|
||||||
|
@ -63,12 +64,12 @@ void CPlugins::PluginChanged(CPlugins * _this)
|
||||||
bool bAudioChange = _stricmp(_this->m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
|
bool bAudioChange = _stricmp(_this->m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str()) != 0;
|
||||||
bool bRspChange = _stricmp(_this->m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
|
bool bRspChange = _stricmp(_this->m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
|
||||||
bool bContChange = _stricmp(_this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
bool bContChange = _stricmp(_this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
||||||
bool bDirChange = _stricmp(_this->m_PluginDir.c_str(), g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str()) != 0;
|
bool bDirChange = _stricmp(_this->m_PluginDir, CPath(g_Settings->LoadStringVal(_this->m_PluginDirSetting)).NormalizePath(CPath(CPath::MODULE_DIRECTORY))) != 0;
|
||||||
WriteTrace(TracePlugins, TraceVerbose, "m_GfxFile: \"%s\" Game_Plugin_Gfx: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bGfxChange ? "true" : "false");
|
WriteTrace(TracePlugins, TraceVerbose, "m_GfxFile: \"%s\" Game_Plugin_Gfx: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bGfxChange ? "true" : "false");
|
||||||
WriteTrace(TracePlugins, TraceVerbose, "m_AudioFile: \"%s\" Game_Plugin_Audio: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bAudioChange ? "true" : "false");
|
WriteTrace(TracePlugins, TraceVerbose, "m_AudioFile: \"%s\" Game_Plugin_Audio: \"%s\" changed: %s", _this->m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str(), bAudioChange ? "true" : "false");
|
||||||
WriteTrace(TracePlugins, TraceVerbose, "m_RSPFile: \"%s\" Game_Plugin_RSP: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bRspChange ? "true" : "false");
|
WriteTrace(TracePlugins, TraceVerbose, "m_RSPFile: \"%s\" Game_Plugin_RSP: \"%s\" changed: %s", _this->m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str(), bRspChange ? "true" : "false");
|
||||||
WriteTrace(TracePlugins, TraceVerbose, "m_ControlFile: \"%s\" Game_Plugin_Controller: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bContChange ? "true" : "false");
|
WriteTrace(TracePlugins, TraceVerbose, "m_ControlFile: \"%s\" Game_Plugin_Controller: \"%s\" changed: %s", _this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str(), bContChange ? "true" : "false");
|
||||||
WriteTrace(TracePlugins, TraceVerbose, "m_PluginDir: \"%s\" m_PluginDirSetting: \"%s\" changed: %s", _this->m_PluginDir.c_str(), g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str(), bDirChange ? "true" : "false");
|
WriteTrace(TracePlugins, TraceVerbose, "m_PluginDir: \"%s\" m_PluginDirSetting: \"%s\" changed: %s", (const char *)_this->m_PluginDir, g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str(), bDirChange ? "true" : "false");
|
||||||
if (bDirChange)
|
if (bDirChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Plugin directory changed");
|
WriteTrace(TracePlugins, TraceDebug, "Plugin directory changed");
|
||||||
|
@ -81,10 +82,22 @@ void CPlugins::PluginChanged(CPlugins * _this)
|
||||||
|
|
||||||
if (bGfxChange || bAudioChange || bRspChange || bContChange)
|
if (bGfxChange || bAudioChange || bRspChange || bContChange)
|
||||||
{
|
{
|
||||||
if (bGfxChange) { WriteTrace(TracePlugins, TraceDebug, "GFX plugin changed"); }
|
if (bGfxChange)
|
||||||
if (bAudioChange) { WriteTrace(TracePlugins, TraceDebug, "Audio plugin changed"); }
|
{
|
||||||
if (bRspChange) { WriteTrace(TracePlugins, TraceDebug, "RSP plugin changed"); }
|
WriteTrace(TracePlugins, TraceDebug, "GFX plugin changed");
|
||||||
if (bContChange) { WriteTrace(TracePlugins, TraceDebug, "Controller plugin changed"); }
|
}
|
||||||
|
if (bAudioChange)
|
||||||
|
{
|
||||||
|
WriteTrace(TracePlugins, TraceDebug, "Audio plugin changed");
|
||||||
|
}
|
||||||
|
if (bRspChange)
|
||||||
|
{
|
||||||
|
WriteTrace(TracePlugins, TraceDebug, "RSP plugin changed");
|
||||||
|
}
|
||||||
|
if (bContChange)
|
||||||
|
{
|
||||||
|
WriteTrace(TracePlugins, TraceDebug, "Controller plugin changed");
|
||||||
|
}
|
||||||
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
if (g_Settings->LoadBool(GameRunning_CPU_Running))
|
||||||
{
|
{
|
||||||
// Ensure that base system actually exists before we go triggering the event
|
// Ensure that base system actually exists before we go triggering the event
|
||||||
|
@ -141,10 +154,10 @@ void CPlugins::CreatePlugins(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceInfo, "Start");
|
WriteTrace(TracePlugins, TraceInfo, "Start");
|
||||||
|
|
||||||
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir.c_str(), m_GfxFile, TraceGFXPlugin, "GFX", m_SyncPlugins);
|
LoadPlugin(Game_Plugin_Gfx, Plugin_GFX_CurVer, m_Gfx, m_PluginDir, m_GfxFile, TraceGFXPlugin, "GFX", m_SyncPlugins);
|
||||||
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir.c_str(), m_AudioFile, TraceAudioPlugin, "Audio", m_SyncPlugins);
|
LoadPlugin(Game_Plugin_Audio, Plugin_AUDIO_CurVer, m_Audio, m_PluginDir, m_AudioFile, TraceAudioPlugin, "Audio", m_SyncPlugins);
|
||||||
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir.c_str(), m_RSPFile, TraceRSPPlugin, "RSP", m_SyncPlugins);
|
LoadPlugin(Game_Plugin_RSP, Plugin_RSP_CurVer, m_RSP, m_PluginDir, m_RSPFile, TraceRSPPlugin, "RSP", m_SyncPlugins);
|
||||||
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir.c_str(), m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
|
LoadPlugin(Game_Plugin_Controller, Plugin_CONT_CurVer, m_Control, m_PluginDir, m_ControlFile, TraceControllerPlugin, "Control", m_SyncPlugins);
|
||||||
|
|
||||||
// Enable debugger
|
// Enable debugger
|
||||||
if (m_RSP != nullptr && m_RSP->EnableDebugging)
|
if (m_RSP != nullptr && m_RSP->EnableDebugging)
|
||||||
|
@ -276,22 +289,46 @@ bool CPlugins::Initiate(CN64System * System)
|
||||||
{
|
{
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Start");
|
WriteTrace(TracePlugins, TraceDebug, "Start");
|
||||||
// Check to make sure we have the plugin available to be used
|
// Check to make sure we have the plugin available to be used
|
||||||
if (m_Gfx == nullptr) { return false; }
|
if (m_Gfx == nullptr)
|
||||||
if (m_Audio == nullptr) { return false; }
|
{
|
||||||
if (m_RSP == nullptr) { return false; }
|
return false;
|
||||||
if (m_Control == nullptr) { return false; }
|
}
|
||||||
|
if (m_Audio == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (m_RSP == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (m_Control == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate starting");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate starting");
|
||||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Gfx->Initiate(System, m_MainWindow))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate done");
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate starting");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate starting");
|
||||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Audio->Initiate(System, m_MainWindow))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate done");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate done");
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate starting");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate starting");
|
||||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Control->Initiate(System, m_MainWindow))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate done");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate done");
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate starting");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate starting");
|
||||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
if (!m_RSP->Initiate(this, System))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate done");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate done");
|
||||||
WriteTrace(TracePlugins, TraceDebug, "Done");
|
WriteTrace(TracePlugins, TraceDebug, "Done");
|
||||||
m_initilized = true;
|
m_initilized = true;
|
||||||
|
@ -322,35 +359,59 @@ bool CPlugins::Reset(CN64System * System)
|
||||||
bRspChange = true;
|
bRspChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bGfxChange) { DestroyGfxPlugin(); }
|
if (bGfxChange)
|
||||||
if (bAudioChange) { DestroyAudioPlugin(); }
|
{
|
||||||
if (bRspChange) { DestroyRspPlugin(); }
|
DestroyGfxPlugin();
|
||||||
if (bContChange) { DestroyControlPlugin(); }
|
}
|
||||||
|
if (bAudioChange)
|
||||||
|
{
|
||||||
|
DestroyAudioPlugin();
|
||||||
|
}
|
||||||
|
if (bRspChange)
|
||||||
|
{
|
||||||
|
DestroyRspPlugin();
|
||||||
|
}
|
||||||
|
if (bContChange)
|
||||||
|
{
|
||||||
|
DestroyControlPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
CreatePlugins();
|
CreatePlugins();
|
||||||
|
|
||||||
if (m_Gfx && bGfxChange)
|
if (m_Gfx && bGfxChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate starting");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate starting");
|
||||||
if (!m_Gfx->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Gfx->Initiate(System, m_MainWindow))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate done");
|
WriteTrace(TraceGFXPlugin, TraceDebug, "GFX initiate done");
|
||||||
}
|
}
|
||||||
if (m_Audio && bAudioChange)
|
if (m_Audio && bAudioChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate starting");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate starting");
|
||||||
if (!m_Audio->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Audio->Initiate(System, m_MainWindow))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate done");
|
WriteTrace(TraceAudioPlugin, TraceDebug, "Audio initiate done");
|
||||||
}
|
}
|
||||||
if (m_Control && bContChange)
|
if (m_Control && bContChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate starting");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate starting");
|
||||||
if (!m_Control->Initiate(System, m_MainWindow)) { return false; }
|
if (!m_Control->Initiate(System, m_MainWindow))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate done");
|
WriteTrace(TraceControllerPlugin, TraceDebug, "Control initiate done");
|
||||||
}
|
}
|
||||||
if (m_RSP && bRspChange)
|
if (m_RSP && bRspChange)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate starting");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate starting");
|
||||||
if (!m_RSP->Initiate(this, System)) { return false; }
|
if (!m_RSP->Initiate(this, System))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate done");
|
WriteTrace(TraceRSPPlugin, TraceDebug, "RSP initiate done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +433,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_RSP:
|
case PLUGIN_TYPE_RSP:
|
||||||
if (m_RSP == nullptr || m_RSP->DllConfig == nullptr) { break; }
|
if (m_RSP == nullptr || m_RSP->DllConfig == nullptr)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!m_RSP->Initialized())
|
if (!m_RSP->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_RSP->Initiate(this, nullptr))
|
if (!m_RSP->Initiate(this, nullptr))
|
||||||
|
@ -382,8 +446,11 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
}
|
}
|
||||||
m_RSP->DllConfig(hParent);
|
m_RSP->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_GFX:
|
case PLUGIN_TYPE_VIDEO:
|
||||||
if (m_Gfx == nullptr || m_Gfx->DllConfig == nullptr) { break; }
|
if (m_Gfx == nullptr || m_Gfx->DllConfig == nullptr)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!m_Gfx->Initialized())
|
if (!m_Gfx->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Gfx->Initiate(nullptr, m_MainWindow))
|
if (!m_Gfx->Initiate(nullptr, m_MainWindow))
|
||||||
|
@ -394,7 +461,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
m_Gfx->DllConfig(hParent);
|
m_Gfx->DllConfig(hParent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_AUDIO:
|
case PLUGIN_TYPE_AUDIO:
|
||||||
if (m_Audio == nullptr || m_Audio->DllConfig == nullptr) { break; }
|
if (m_Audio == nullptr || m_Audio->DllConfig == nullptr)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!m_Audio->Initialized())
|
if (!m_Audio->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Audio->Initiate(nullptr, m_MainWindow))
|
if (!m_Audio->Initiate(nullptr, m_MainWindow))
|
||||||
|
@ -409,7 +479,10 @@ void CPlugins::ConfigPlugin(void* hParent, PLUGIN_TYPE Type)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_CONTROLLER:
|
case PLUGIN_TYPE_CONTROLLER:
|
||||||
if (m_Control == nullptr || m_Control->DllConfig == nullptr) { break; }
|
if (m_Control == nullptr || m_Control->DllConfig == nullptr)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!m_Control->Initialized())
|
if (!m_Control->Initialized())
|
||||||
{
|
{
|
||||||
if (!m_Control->Initiate(nullptr, m_MainWindow))
|
if (!m_Control->Initiate(nullptr, m_MainWindow))
|
||||||
|
@ -441,7 +514,7 @@ void DummyFunction(void)
|
||||||
bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
{
|
{
|
||||||
// Copy GFX plugin
|
// Copy GFX plugin
|
||||||
CPath srcGfxPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
CPath srcGfxPlugin((const char *)m_PluginDir, g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
||||||
CPath dstGfxPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
CPath dstGfxPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str());
|
||||||
dstGfxPlugin.SetName(stdstr_f("%s-copy", dstGfxPlugin.GetName().c_str()).c_str());
|
dstGfxPlugin.SetName(stdstr_f("%s-copy", dstGfxPlugin.GetName().c_str()).c_str());
|
||||||
|
|
||||||
|
@ -456,7 +529,7 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy m_Audio plugin
|
// Copy m_Audio plugin
|
||||||
CPath srcAudioPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
CPath srcAudioPlugin((const char *)m_PluginDir, g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
||||||
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
CPath dstAudioPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str());
|
||||||
dstAudioPlugin.SetName(stdstr_f("%s-copy", dstAudioPlugin.GetName().c_str()).c_str());
|
dstAudioPlugin.SetName(stdstr_f("%s-copy", dstAudioPlugin.GetName().c_str()).c_str());
|
||||||
if (!dstAudioPlugin.DirectoryExists())
|
if (!dstAudioPlugin.DirectoryExists())
|
||||||
|
@ -468,7 +541,7 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Copy RSP plugin
|
// Copy RSP plugin
|
||||||
CPath srcRSPPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
CPath srcRSPPlugin((const char *)m_PluginDir, g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
||||||
CPath dstRSPPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
CPath dstRSPPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str());
|
||||||
dstRSPPlugin.SetName(stdstr_f("%s-copy", dstRSPPlugin.GetName().c_str()).c_str());
|
dstRSPPlugin.SetName(stdstr_f("%s-copy", dstRSPPlugin.GetName().c_str()).c_str());
|
||||||
if (!dstRSPPlugin.DirectoryExists())
|
if (!dstRSPPlugin.DirectoryExists())
|
||||||
|
@ -481,7 +554,7 @@ bool CPlugins::CopyPlugins(const stdstr & DstDir) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy Controller plugin
|
// Copy Controller plugin
|
||||||
CPath srcContPlugin(m_PluginDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
CPath srcContPlugin((const char *)m_PluginDir, g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
||||||
CPath dstContPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
CPath dstContPlugin(DstDir.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str());
|
||||||
dstContPlugin.SetName(stdstr_f("%s-copy", dstContPlugin.GetName().c_str()).c_str());
|
dstContPlugin.SetName(stdstr_f("%s-copy", dstContPlugin.GetName().c_str()).c_str());
|
||||||
if (!dstContPlugin.DirectoryExists())
|
if (!dstContPlugin.DirectoryExists())
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <list>
|
#include <Common/path.h>
|
||||||
#include <Project64-core/Settings.h>
|
#include <Project64-core/Settings.h>
|
||||||
#include <Project64-core/Settings/DebugSettings.h>
|
#include <Project64-core/Settings/DebugSettings.h>
|
||||||
|
#include <Project64-plugin-spec/Base.h>
|
||||||
#ifndef PLUGIN_INFO_STRUCT
|
#include <list>
|
||||||
#define PLUGIN_INFO_STRUCT
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint16_t Version; // Should be set to 1
|
|
||||||
uint16_t Type; // Set to PLUGIN_TYPE_GFX
|
|
||||||
char Name[100]; // Name of the DLL
|
|
||||||
|
|
||||||
// If DLL supports these memory options then set them to TRUE or FALSE if it does not support it
|
|
||||||
int32_t NormalMemory; // A normal BYTE array
|
|
||||||
int32_t MemoryBswaped; // A normal BYTE array where the memory has been pre-bswap'd on a DWORD (32-bit) boundary
|
|
||||||
} PLUGIN_INFO;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Enums
|
// Enums
|
||||||
enum SETTING_DATA_TYPE
|
enum SETTING_DATA_TYPE
|
||||||
|
@ -77,17 +63,11 @@ typedef struct
|
||||||
void (*BreakPoint)(const char * FileName, int32_t LineNumber);
|
void (*BreakPoint)(const char * FileName, int32_t LineNumber);
|
||||||
} PLUGIN_NOTIFICATION;
|
} PLUGIN_NOTIFICATION;
|
||||||
|
|
||||||
enum PLUGIN_TYPE
|
|
||||||
{
|
|
||||||
PLUGIN_TYPE_NONE = 0,
|
|
||||||
PLUGIN_TYPE_RSP = 1,
|
|
||||||
PLUGIN_TYPE_GFX = 2,
|
|
||||||
PLUGIN_TYPE_AUDIO = 3,
|
|
||||||
PLUGIN_TYPE_CONTROLLER = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
class CSettings;
|
class CSettings;
|
||||||
class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin;
|
class CGfxPlugin;
|
||||||
|
class CAudioPlugin;
|
||||||
|
class CRSP_Plugin;
|
||||||
|
class CControl_Plugin;
|
||||||
class CN64System;
|
class CN64System;
|
||||||
class CPlugins;
|
class CPlugins;
|
||||||
|
|
||||||
|
@ -130,15 +110,36 @@ public:
|
||||||
bool ResetInUiThread(CN64System * System);
|
bool ResetInUiThread(CN64System * System);
|
||||||
void GameReset(void);
|
void GameReset(void);
|
||||||
|
|
||||||
inline CGfxPlugin * Gfx(void) const { return m_Gfx; }
|
inline CGfxPlugin * Gfx(void) const
|
||||||
inline CAudioPlugin * Audio(void) const { return m_Audio; }
|
{
|
||||||
inline CRSP_Plugin * RSP(void) const { return m_RSP; }
|
return m_Gfx;
|
||||||
inline CControl_Plugin * Control(void) const { return m_Control; }
|
}
|
||||||
|
inline CAudioPlugin * Audio(void) const
|
||||||
|
{
|
||||||
|
return m_Audio;
|
||||||
|
}
|
||||||
|
inline CRSP_Plugin * RSP(void) const
|
||||||
|
{
|
||||||
|
return m_RSP;
|
||||||
|
}
|
||||||
|
inline CControl_Plugin * Control(void) const
|
||||||
|
{
|
||||||
|
return m_Control;
|
||||||
|
}
|
||||||
|
|
||||||
inline RenderWindow * MainWindow(void) const { return m_MainWindow; }
|
inline RenderWindow * MainWindow(void) const
|
||||||
inline RenderWindow * SyncWindow(void) const { return m_SyncWindow; }
|
{
|
||||||
|
return m_MainWindow;
|
||||||
|
}
|
||||||
|
inline RenderWindow * SyncWindow(void) const
|
||||||
|
{
|
||||||
|
return m_SyncWindow;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool initilized(void) const { return m_initilized; }
|
inline bool initilized(void) const
|
||||||
|
{
|
||||||
|
return m_initilized;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CPlugins(void);
|
CPlugins(void);
|
||||||
|
@ -156,7 +157,7 @@ private:
|
||||||
RenderWindow * m_SyncWindow;
|
RenderWindow * m_SyncWindow;
|
||||||
|
|
||||||
SettingID m_PluginDirSetting;
|
SettingID m_PluginDirSetting;
|
||||||
stdstr m_PluginDir;
|
CPath m_PluginDir;
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
CGfxPlugin * m_Gfx;
|
CGfxPlugin * m_Gfx;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
|
||||||
#include <Common/path.h>
|
#include <Common/path.h>
|
||||||
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
|
||||||
CPlugin::CPlugin() :
|
CPlugin::CPlugin() :
|
||||||
DllAbout(nullptr),
|
DllAbout(nullptr),
|
||||||
|
@ -48,11 +48,20 @@ bool CPlugin::Load(const char * FileName)
|
||||||
// Get DLL information
|
// Get DLL information
|
||||||
void(CALL * GetDllInfo)(PLUGIN_INFO * PluginInfo);
|
void(CALL * GetDllInfo)(PLUGIN_INFO * PluginInfo);
|
||||||
LoadFunction(GetDllInfo);
|
LoadFunction(GetDllInfo);
|
||||||
if (GetDllInfo == nullptr) { return false; }
|
if (GetDllInfo == nullptr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GetDllInfo(&m_PluginInfo);
|
GetDllInfo(&m_PluginInfo);
|
||||||
if (!ValidPluginVersion(m_PluginInfo)) { return false; }
|
if (!ValidPluginVersion(m_PluginInfo))
|
||||||
if (m_PluginInfo.Type != type()) { return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (m_PluginInfo.Type != type())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LoadFunction(CloseDLL);
|
LoadFunction(CloseDLL);
|
||||||
LoadFunction(RomOpen);
|
LoadFunction(RomOpen);
|
||||||
|
@ -154,7 +163,7 @@ void CPlugin::RomOpened(RenderWindow * Render)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
|
if (m_PluginInfo.Type == PLUGIN_TYPE_VIDEO)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
||||||
if (Render != nullptr)
|
if (Render != nullptr)
|
||||||
|
@ -186,7 +195,7 @@ void CPlugin::RomClose(RenderWindow * Render)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
if (m_PluginInfo.Type == PLUGIN_TYPE_GFX)
|
if (m_PluginInfo.Type == PLUGIN_TYPE_VIDEO)
|
||||||
{
|
{
|
||||||
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
WriteTrace(PluginTraceType(), TraceDebug, "Render = %p", Render);
|
||||||
if (Render != NULL)
|
if (Render != NULL)
|
||||||
|
@ -258,7 +267,7 @@ const char * CPlugin::PluginType() const
|
||||||
switch (m_PluginInfo.Type)
|
switch (m_PluginInfo.Type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_RSP: return "RSP";
|
case PLUGIN_TYPE_RSP: return "RSP";
|
||||||
case PLUGIN_TYPE_GFX: return "GFX";
|
case PLUGIN_TYPE_VIDEO: return "Video";
|
||||||
case PLUGIN_TYPE_AUDIO: return "Audio";
|
case PLUGIN_TYPE_AUDIO: return "Audio";
|
||||||
case PLUGIN_TYPE_CONTROLLER: return "Control";
|
case PLUGIN_TYPE_CONTROLLER: return "Control";
|
||||||
}
|
}
|
||||||
|
@ -270,7 +279,7 @@ TraceModuleProject64 CPlugin::PluginTraceType() const
|
||||||
switch (m_PluginInfo.Type)
|
switch (m_PluginInfo.Type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_RSP: return TraceRSPPlugin;
|
case PLUGIN_TYPE_RSP: return TraceRSPPlugin;
|
||||||
case PLUGIN_TYPE_GFX: return TraceGFXPlugin;
|
case PLUGIN_TYPE_VIDEO: return TraceGFXPlugin;
|
||||||
case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin;
|
case PLUGIN_TYPE_AUDIO: return TraceAudioPlugin;
|
||||||
case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin;
|
case PLUGIN_TYPE_CONTROLLER: return TraceControllerPlugin;
|
||||||
}
|
}
|
||||||
|
@ -282,28 +291,64 @@ bool CPlugin::ValidPluginVersion(PLUGIN_INFO & PluginInfo)
|
||||||
switch (PluginInfo.Type)
|
switch (PluginInfo.Type)
|
||||||
{
|
{
|
||||||
case PLUGIN_TYPE_RSP:
|
case PLUGIN_TYPE_RSP:
|
||||||
if (!PluginInfo.MemoryBswaped) { return false; }
|
if (PluginInfo.Version == 0x0001)
|
||||||
if (PluginInfo.Version == 0x0001) { return true; }
|
{
|
||||||
if (PluginInfo.Version == 0x0100) { return true; }
|
return true;
|
||||||
if (PluginInfo.Version == 0x0101) { return true; }
|
}
|
||||||
if (PluginInfo.Version == 0x0102) { return true; }
|
if (PluginInfo.Version == 0x0100)
|
||||||
if (PluginInfo.Version == 0x0103) { return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0101)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0102)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0103)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_GFX:
|
case PLUGIN_TYPE_VIDEO:
|
||||||
if (!PluginInfo.MemoryBswaped) { return false; }
|
if (PluginInfo.Version == 0x0102)
|
||||||
if (PluginInfo.Version == 0x0102) { return true; }
|
{
|
||||||
if (PluginInfo.Version == 0x0103) { return true; }
|
return true;
|
||||||
if (PluginInfo.Version == 0x0104) { return true; }
|
}
|
||||||
|
if (PluginInfo.Version == 0x0103)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0104)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_AUDIO:
|
case PLUGIN_TYPE_AUDIO:
|
||||||
if (!PluginInfo.MemoryBswaped) { return false; }
|
if (PluginInfo.Version == 0x0101)
|
||||||
if (PluginInfo.Version == 0x0101) { return true; }
|
{
|
||||||
if (PluginInfo.Version == 0x0102) { return true; }
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0102)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_CONTROLLER:
|
case PLUGIN_TYPE_CONTROLLER:
|
||||||
if (PluginInfo.Version == 0x0100) { return true; }
|
if (PluginInfo.Version == 0x0100)
|
||||||
if (PluginInfo.Version == 0x0101) { return true; }
|
{
|
||||||
if (PluginInfo.Version == 0x0102) { return true; }
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0101)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PluginInfo.Version == 0x0102)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <Common/DynamicLibrary.h>
|
||||||
|
#include <Project64-core/Plugins/Plugin.h>
|
||||||
#include <Project64-core/Settings/DebugSettings.h>
|
#include <Project64-core/Settings/DebugSettings.h>
|
||||||
#include <Project64-core/TraceModulesProject64.h>
|
#include <Project64-core/TraceModulesProject64.h>
|
||||||
#include <Project64-core/Plugins/Plugin.h>
|
#include <Project64-plugin-spec/Base.h>
|
||||||
#include <Common/DynamicLibrary.h>
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#define CALL __cdecl
|
|
||||||
#else
|
|
||||||
#define CALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class CPlugin :
|
class CPlugin :
|
||||||
private CDebugSettings
|
protected CDebugSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CPlugin();
|
CPlugin();
|
||||||
virtual ~CPlugin();
|
virtual ~CPlugin();
|
||||||
inline const char * PluginName() const { return m_PluginInfo.Name; }
|
inline const char * PluginName() const
|
||||||
inline bool Initialized() { return m_Initialized; }
|
{
|
||||||
|
return m_PluginInfo.Name;
|
||||||
|
}
|
||||||
|
inline bool Initialized()
|
||||||
|
{
|
||||||
|
return m_Initialized;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int32_t GetDefaultSettingStartRange() const = 0;
|
virtual int32_t GetDefaultSettingStartRange() const = 0;
|
||||||
virtual int32_t GetSettingStartRange() const = 0;
|
virtual int32_t GetSettingStartRange() const = 0;
|
||||||
|
|
|
@ -132,8 +132,11 @@
|
||||||
<ClInclude Include="..\3rdParty\zlib\contrib\minizip\zip.h" />
|
<ClInclude Include="..\3rdParty\zlib\contrib\minizip\zip.h" />
|
||||||
<ClInclude Include="..\3rdParty\zlib\zconf.h" />
|
<ClInclude Include="..\3rdParty\zlib\zconf.h" />
|
||||||
<ClInclude Include="..\3rdParty\zlib\zlib.h" />
|
<ClInclude Include="..\3rdParty\zlib\zlib.h" />
|
||||||
|
<ClInclude Include="..\Project64-plugin-spec\Audio.h" />
|
||||||
<ClInclude Include="..\Project64-plugin-spec\Base.h" />
|
<ClInclude Include="..\Project64-plugin-spec\Base.h" />
|
||||||
<ClInclude Include="..\Project64-plugin-spec\Input.h" />
|
<ClInclude Include="..\Project64-plugin-spec\Input.h" />
|
||||||
|
<ClInclude Include="..\Project64-plugin-spec\Rsp.h" />
|
||||||
|
<ClInclude Include="..\Project64-plugin-spec\Video.h" />
|
||||||
<ClInclude Include="3rdParty\7zip.h" />
|
<ClInclude Include="3rdParty\7zip.h" />
|
||||||
<ClInclude Include="3rdParty\zip.h" />
|
<ClInclude Include="3rdParty\zip.h" />
|
||||||
<ClInclude Include="AppInit.h" />
|
<ClInclude Include="AppInit.h" />
|
||||||
|
|
|
@ -677,6 +677,15 @@
|
||||||
<ClInclude Include="..\Project64-plugin-spec\Input.h">
|
<ClInclude Include="..\Project64-plugin-spec\Input.h">
|
||||||
<Filter>Header Files\Plugin Spec</Filter>
|
<Filter>Header Files\Plugin Spec</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Project64-plugin-spec\Audio.h">
|
||||||
|
<Filter>Header Files\Plugin Spec</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Project64-plugin-spec\Rsp.h">
|
||||||
|
<Filter>Header Files\Plugin Spec</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Project64-plugin-spec\Video.h">
|
||||||
|
<Filter>Header Files\Plugin Spec</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Version.h.in">
|
<None Include="Version.h.in">
|
||||||
|
|
|
@ -8,7 +8,8 @@ CProject64Input::CProject64Input(HINSTANCE hinst) :
|
||||||
m_hinst(hinst),
|
m_hinst(hinst),
|
||||||
m_Scanning(false),
|
m_Scanning(false),
|
||||||
m_DisplayCtrlId(0),
|
m_DisplayCtrlId(0),
|
||||||
m_iFirstController(-1)
|
m_iFirstController(-1),
|
||||||
|
m_MouseLock(false)
|
||||||
{
|
{
|
||||||
memset(m_Controllers, 0, sizeof(m_Controllers));
|
memset(m_Controllers, 0, sizeof(m_Controllers));
|
||||||
}
|
}
|
||||||
|
@ -45,11 +46,17 @@ void CProject64Input::InitiateControllers(CONTROL_INFO * ControlInfo)
|
||||||
{
|
{
|
||||||
g_Settings->LoadController(i, m_ControlInfo.Controls[i], m_Controllers[i]);
|
g_Settings->LoadController(i, m_ControlInfo.Controls[i], m_Controllers[i]);
|
||||||
m_DirectInput->MapControllerDevice(m_Controllers[i]);
|
m_DirectInput->MapControllerDevice(m_Controllers[i]);
|
||||||
if (m_ControlInfo.Controls[i].Present != 0 && m_iFirstController < 0)
|
if (m_ControlInfo.Controls[i].Present != PRESENT_NONE && m_iFirstController < 0)
|
||||||
{
|
{
|
||||||
m_iFirstController = i;
|
m_iFirstController = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_Settings->GetControllerMouse(m_N64Mouse);
|
||||||
|
m_DirectInput->MapControllerDevice(m_N64Mouse);
|
||||||
|
|
||||||
|
g_Settings->LoadShortcuts(m_Shortcuts);
|
||||||
|
m_DirectInput->MapShortcutDevice(m_Shortcuts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
||||||
|
@ -62,7 +69,35 @@ void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
||||||
if (Control == m_iFirstController)
|
if (Control == m_iFirstController)
|
||||||
{
|
{
|
||||||
m_DirectInput->UpdateDeviceData();
|
m_DirectInput->UpdateDeviceData();
|
||||||
|
CheckShortcuts();
|
||||||
}
|
}
|
||||||
|
if (m_ControlInfo.Controls[Control].Present == PRESENT_MOUSE)
|
||||||
|
{
|
||||||
|
//Mouse
|
||||||
|
if (m_MouseLock)
|
||||||
|
{
|
||||||
|
LockCursor();
|
||||||
|
m_N64Mouse.Sensitivity = m_Controllers[Control].Sensitivity;
|
||||||
|
Keys->R_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.R_DPAD);
|
||||||
|
Keys->L_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.L_DPAD);
|
||||||
|
Keys->D_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.D_DPAD);
|
||||||
|
Keys->U_DPAD = m_DirectInput->IsButtonPressed(m_N64Mouse.U_DPAD);
|
||||||
|
Keys->START_BUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.START_BUTTON);
|
||||||
|
Keys->Z_TRIG = m_DirectInput->IsButtonPressed(m_N64Mouse.Z_TRIG);
|
||||||
|
Keys->B_BUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.B_BUTTON);
|
||||||
|
Keys->A_BUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.A_BUTTON);
|
||||||
|
Keys->R_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.R_CBUTTON);
|
||||||
|
Keys->L_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.L_CBUTTON);
|
||||||
|
Keys->D_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.D_CBUTTON);
|
||||||
|
Keys->U_CBUTTON = m_DirectInput->IsButtonPressed(m_N64Mouse.U_CBUTTON);
|
||||||
|
Keys->R_TRIG = m_DirectInput->IsButtonPressed(m_N64Mouse.R_TRIG);
|
||||||
|
Keys->L_TRIG = m_DirectInput->IsButtonPressed(m_N64Mouse.L_TRIG);
|
||||||
|
m_DirectInput->GetAxis(m_N64Mouse, Keys);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Controller
|
||||||
N64CONTROLLER& Controller = m_Controllers[Control];
|
N64CONTROLLER& Controller = m_Controllers[Control];
|
||||||
Keys->R_DPAD = m_DirectInput->IsButtonPressed(Controller.R_DPAD);
|
Keys->R_DPAD = m_DirectInput->IsButtonPressed(Controller.R_DPAD);
|
||||||
Keys->L_DPAD = m_DirectInput->IsButtonPressed(Controller.L_DPAD);
|
Keys->L_DPAD = m_DirectInput->IsButtonPressed(Controller.L_DPAD);
|
||||||
|
@ -81,6 +116,8 @@ void CProject64Input::GetKeys(int32_t Control, BUTTONS * Keys)
|
||||||
m_DirectInput->GetAxis(Controller, Keys);
|
m_DirectInput->GetAxis(Controller, Keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CProject64Input::StartScanDevices(int32_t DisplayCtrlId)
|
void CProject64Input::StartScanDevices(int32_t DisplayCtrlId)
|
||||||
{
|
{
|
||||||
m_Scanning = true;
|
m_Scanning = true;
|
||||||
|
@ -141,3 +178,75 @@ bool CProject64Input::ResetController(uint32_t ControlIndex, CONTROL & ControlIn
|
||||||
m_DirectInput->MapControllerDevice(Controller);
|
m_DirectInput->MapControllerDevice(Controller);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CProject64Input::CheckShortcuts()
|
||||||
|
{
|
||||||
|
bool isPressed = m_DirectInput->IsButtonPressed(m_Shortcuts.LOCKMOUSE);
|
||||||
|
if ((isPressed == true) && (m_Shortcuts.LOCKMOUSE_PRESSED == false))
|
||||||
|
{
|
||||||
|
LockMouseSwitch();
|
||||||
|
}
|
||||||
|
m_Shortcuts.LOCKMOUSE_PRESSED = isPressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProject64Input::SaveShortcuts()
|
||||||
|
{
|
||||||
|
CGuard guard(m_CS);
|
||||||
|
|
||||||
|
g_Settings->SaveShortcuts(m_Shortcuts);
|
||||||
|
m_DirectInput->MapShortcutDevice(m_Shortcuts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProject64Input::ResetShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
g_Settings->ResetShortcuts(Shortcuts);
|
||||||
|
m_DirectInput->MapShortcutDevice(Shortcuts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::LockMouse()
|
||||||
|
{
|
||||||
|
if (IsMouseUsed() == false) return UnlockMouse();
|
||||||
|
if (m_MouseLock == true) return;
|
||||||
|
PostMessage((HWND)m_ControlInfo.hWnd, WM_HIDE_CUROSR, false, 0);
|
||||||
|
m_MouseLock = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::UnlockMouse()
|
||||||
|
{
|
||||||
|
if (m_MouseLock == false) return;
|
||||||
|
PostMessage((HWND)m_ControlInfo.hWnd, WM_HIDE_CUROSR, true, 0);
|
||||||
|
m_MouseLock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::LockMouseSwitch()
|
||||||
|
{
|
||||||
|
if (m_MouseLock == true)
|
||||||
|
{
|
||||||
|
UnlockMouse();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LockMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CProject64Input::IsMouseUsed()
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0, n = sizeof(m_Controllers) / sizeof(m_Controllers[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
if (m_ControlInfo.Controls[i].Present == PRESENT_MOUSE)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProject64Input::LockCursor()
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetWindowRect((HWND)m_ControlInfo.hWnd, &rect);
|
||||||
|
SetCursorPos((rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2);
|
||||||
|
}
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
#include <Project64-plugin-spec/Input.h>
|
#include <Project64-plugin-spec/Input.h>
|
||||||
#include "DirectInput.h"
|
#include "DirectInput.h"
|
||||||
#include "N64Controller.h"
|
#include "N64Controller.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
#include <Common/CriticalSection.h>
|
#include <Common/CriticalSection.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class CProject64Input
|
class CProject64Input
|
||||||
{
|
{
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
WM_HIDE_CUROSR = WM_USER + 10,
|
||||||
|
WM_MAKE_FOCUS = WM_USER + 17
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CProject64Input(HINSTANCE hinst);
|
CProject64Input(HINSTANCE hinst);
|
||||||
~CProject64Input();
|
~CProject64Input();
|
||||||
|
@ -22,12 +29,21 @@ public:
|
||||||
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
||||||
bool SaveController(uint32_t ControlIndex);
|
bool SaveController(uint32_t ControlIndex);
|
||||||
bool ResetController(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller);
|
bool ResetController(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller);
|
||||||
|
void CheckShortcuts();
|
||||||
|
bool SaveShortcuts();
|
||||||
|
bool ResetShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
void LockMouse();
|
||||||
|
void UnlockMouse();
|
||||||
|
void LockMouseSwitch();
|
||||||
|
bool IsMouseUsed();
|
||||||
|
void LockCursor();
|
||||||
|
|
||||||
inline HINSTANCE hInst(void) const { return m_hinst; }
|
inline HINSTANCE hInst(void) const { return m_hinst; }
|
||||||
inline bool IsScanning(void) const { return m_Scanning; }
|
inline bool IsScanning(void) const { return m_Scanning; }
|
||||||
inline int32_t DisplayCtrlId(void) const { return m_DisplayCtrlId; }
|
inline int32_t DisplayCtrlId(void) const { return m_DisplayCtrlId; }
|
||||||
inline N64CONTROLLER & Controllers(int32_t Controller) { return m_Controllers[Controller]; }
|
inline N64CONTROLLER & Controllers(int32_t Controller) { return m_Controllers[Controller]; }
|
||||||
inline CONTROL & ControlInfo(int32_t Controller) { return m_ControlInfo.Controls[Controller]; }
|
inline CONTROL & ControlInfo(int32_t Controller) { return m_ControlInfo.Controls[Controller]; }
|
||||||
|
inline SHORTCUTS& Shortcuts() { return m_Shortcuts; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CProject64Input();
|
CProject64Input();
|
||||||
|
@ -37,11 +53,14 @@ private:
|
||||||
CriticalSection m_CS;
|
CriticalSection m_CS;
|
||||||
CONTROL_INFO m_ControlInfo;
|
CONTROL_INFO m_ControlInfo;
|
||||||
N64CONTROLLER m_Controllers[4];
|
N64CONTROLLER m_Controllers[4];
|
||||||
|
N64CONTROLLER m_N64Mouse;
|
||||||
|
SHORTCUTS m_Shortcuts;
|
||||||
std::unique_ptr<CDirectInput> m_DirectInput;
|
std::unique_ptr<CDirectInput> m_DirectInput;
|
||||||
HINSTANCE m_hinst;
|
HINSTANCE m_hinst;
|
||||||
bool m_Scanning;
|
bool m_Scanning;
|
||||||
int32_t m_DisplayCtrlId;
|
int32_t m_DisplayCtrlId;
|
||||||
int32_t m_iFirstController;
|
int32_t m_iFirstController;
|
||||||
|
bool m_MouseLock;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CProject64Input * g_InputPlugin;
|
extern CProject64Input * g_InputPlugin;
|
||||||
|
|
|
@ -90,6 +90,28 @@ void CDirectInput::MapControllerDevice(N64CONTROLLER & Controller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDirectInput::MapShortcutDevice(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
BUTTON* Buttons[] =
|
||||||
|
{
|
||||||
|
&Shortcuts.LOCKMOUSE,
|
||||||
|
};
|
||||||
|
|
||||||
|
CGuard Guard(m_DeviceCS);
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
DEVICE_MAP::iterator itr = m_Devices.find(Buttons[i]->DeviceGuid);
|
||||||
|
if (itr != m_Devices.end())
|
||||||
|
{
|
||||||
|
Buttons[i]->Device = &itr->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buttons[i]->Device = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CDirectInput::stEnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
BOOL CDirectInput::stEnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
||||||
{
|
{
|
||||||
return ((CDirectInput *)pvRef)->EnumMakeDeviceList(lpddi);
|
return ((CDirectInput *)pvRef)->EnumMakeDeviceList(lpddi);
|
||||||
|
@ -231,6 +253,13 @@ std::wstring CDirectInput::ButtonAssignment(BUTTON & Button)
|
||||||
" \\/",
|
" \\/",
|
||||||
" <"
|
" <"
|
||||||
};
|
};
|
||||||
|
static const char* iMouse[] =
|
||||||
|
{
|
||||||
|
"X-axis",
|
||||||
|
"Y-axis",
|
||||||
|
"Z-axis",
|
||||||
|
"Button"
|
||||||
|
};
|
||||||
|
|
||||||
if (Button.BtnType == BTNTYPE_JOYBUTTON)
|
if (Button.BtnType == BTNTYPE_JOYBUTTON)
|
||||||
{
|
{
|
||||||
|
@ -278,6 +307,24 @@ std::wstring CDirectInput::ButtonAssignment(BUTTON & Button)
|
||||||
return L"Keyboard: ???";
|
return L"Keyboard: ???";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Button.BtnType == BTNTYPE_MOUSEAXE)
|
||||||
|
{
|
||||||
|
stdstr_f Offset("%u", Button.Offset);
|
||||||
|
if (Button.Offset < (sizeof(iMouse) / sizeof(iMouse[0])))
|
||||||
|
{
|
||||||
|
Offset = iMouse[Button.Offset];
|
||||||
|
}
|
||||||
|
stdstr_f AxisId(" %u", Button.AxisID);
|
||||||
|
if (Button.AxisID < (sizeof(AxeID) / sizeof(AxeID[0])))
|
||||||
|
{
|
||||||
|
AxisId = AxeID[Button.AxisID];
|
||||||
|
}
|
||||||
|
return stdstr_f("%s%s", Offset.c_str(), AxisId.c_str()).ToUTF16();
|
||||||
|
}
|
||||||
|
if (Button.BtnType == BTNTYPE_MOUSEBUTTON)
|
||||||
|
{
|
||||||
|
return stdstr_f("Button %u", Button.Offset).ToUTF16();
|
||||||
|
}
|
||||||
if (Button.BtnType == BTNTYPE_UNASSIGNED)
|
if (Button.BtnType == BTNTYPE_UNASSIGNED)
|
||||||
{
|
{
|
||||||
return L"";
|
return L"";
|
||||||
|
@ -361,11 +408,15 @@ bool CDirectInput::IsButtonPressed(BUTTON & Button)
|
||||||
return (Device.State.Keyboard[Button.Offset] & 0x80) != 0;
|
return (Device.State.Keyboard[Button.Offset] & 0x80) != 0;
|
||||||
case BTNTYPE_JOYBUTTON:
|
case BTNTYPE_JOYBUTTON:
|
||||||
return (Device.State.Joy.rgbButtons[Button.Offset] & 0x80) != 0;
|
return (Device.State.Joy.rgbButtons[Button.Offset] & 0x80) != 0;
|
||||||
|
case BTNTYPE_MOUSEBUTTON:
|
||||||
|
return (Device.State.Mouse.rgbButtons[Button.Offset] & 0x80) != 0;
|
||||||
case BTNTYPE_JOYPOV:
|
case BTNTYPE_JOYPOV:
|
||||||
return JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
return JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
||||||
case BTNTYPE_JOYSLIDER:
|
case BTNTYPE_JOYSLIDER:
|
||||||
case BTNTYPE_JOYAXE:
|
case BTNTYPE_JOYAXE:
|
||||||
return Button.AxisID ? ((uint32_t*)&Device.State.Joy)[Button.Offset] > AXIS_BOTTOM_VALUE : ((uint32_t *)&Device.State.Joy)[Button.Offset] < AXIS_TOP_VALUE;
|
return Button.AxisID ? ((uint32_t*)&Device.State.Joy)[Button.Offset] > AXIS_BOTTOM_VALUE : ((uint32_t *)&Device.State.Joy)[Button.Offset] < AXIS_TOP_VALUE;
|
||||||
|
case BTNTYPE_MOUSEAXE:
|
||||||
|
return Button.AxisID ? ((uint32_t*)&Device.State.Mouse)[Button.Offset] > AXIS_BOTTOM_VALUE : ((uint32_t*)&Device.State.Mouse)[Button.Offset] < AXIS_TOP_VALUE;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -413,6 +464,7 @@ void CDirectInput::GetAxis(N64CONTROLLER & Controller, BUTTONS * Keys)
|
||||||
}
|
}
|
||||||
DEVICE & Device = *(DEVICE *)Button.Device;
|
DEVICE & Device = *(DEVICE *)Button.Device;
|
||||||
LPLONG plRawState = (LPLONG)&Device.State.Joy;
|
LPLONG plRawState = (LPLONG)&Device.State.Joy;
|
||||||
|
LPLONG plRawStateMouse = (LPLONG)&Device.State.Mouse;
|
||||||
|
|
||||||
switch (Button.BtnType)
|
switch (Button.BtnType)
|
||||||
{
|
{
|
||||||
|
@ -420,6 +472,20 @@ void CDirectInput::GetAxis(N64CONTROLLER & Controller, BUTTONS * Keys)
|
||||||
case BTNTYPE_JOYAXE:
|
case BTNTYPE_JOYAXE:
|
||||||
l_Value = (plRawState[Button.Offset] - MAX_AXIS_VALUE) * -1;
|
l_Value = (plRawState[Button.Offset] - MAX_AXIS_VALUE) * -1;
|
||||||
|
|
||||||
|
if (Button.AxisID == AI_AXE_NEGATIVE)
|
||||||
|
{
|
||||||
|
fNegInput = !fNegInput;
|
||||||
|
b_Value = (l_Value < 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b_Value = (l_Value > 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case BTNTYPE_MOUSEAXE:
|
||||||
|
l_Value = (plRawStateMouse[Button.Offset]) * -1;
|
||||||
|
l_Value *= Controller.Sensitivity * MOUSESCALEVALUE;
|
||||||
|
|
||||||
if (Button.AxisID == AI_AXE_NEGATIVE)
|
if (Button.AxisID == AI_AXE_NEGATIVE)
|
||||||
{
|
{
|
||||||
fNegInput = !fNegInput;
|
fNegInput = !fNegInput;
|
||||||
|
@ -444,6 +510,13 @@ void CDirectInput::GetAxis(N64CONTROLLER & Controller, BUTTONS * Keys)
|
||||||
l_Value = MAX_AXIS_VALUE;
|
l_Value = MAX_AXIS_VALUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BTNTYPE_MOUSEBUTTON:
|
||||||
|
b_Value = (Device.State.Mouse.rgbButtons[Button.Offset] & 0x80) != 0;
|
||||||
|
if (b_Value)
|
||||||
|
{
|
||||||
|
l_Value = MAX_AXIS_VALUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BTNTYPE_JOYPOV:
|
case BTNTYPE_JOYPOV:
|
||||||
b_Value = JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
b_Value = JoyPadPovPressed((AI_POV)Button.AxisID, ((uint32_t *)&Device.State.Joy)[Button.Offset]);
|
||||||
if (b_Value)
|
if (b_Value)
|
||||||
|
@ -705,6 +778,93 @@ CDirectInput::ScanResult CDirectInput::ScanGamePad(const GUID & DeviceGuid, LPDI
|
||||||
return SCAN_FAILED;
|
return SCAN_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CDirectInput::ScanResult CDirectInput::ScanMouse(const GUID& DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIMOUSESTATE2& BaseState, BUTTON& pButton)
|
||||||
|
{
|
||||||
|
DIJOYSTATE MouseState = { 0 };
|
||||||
|
HRESULT hr = didHandle->GetDeviceState(sizeof(DIMOUSESTATE2), &MouseState);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
didHandle->Acquire();
|
||||||
|
return SCAN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Mouse[][2] =
|
||||||
|
{
|
||||||
|
{ DIMOFS_X / sizeof(uint32_t), BTNTYPE_MOUSEAXE },
|
||||||
|
{ DIMOFS_Y / sizeof(uint32_t), BTNTYPE_MOUSEAXE },
|
||||||
|
{ DIMOFS_Z / sizeof(uint32_t), BTNTYPE_MOUSEAXE }
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t bAxeDirection = 0;
|
||||||
|
int32_t foundJoyPad = -1;
|
||||||
|
|
||||||
|
for (int32_t i = 0, n = sizeof(Mouse) / sizeof(Mouse[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
uint32_t lValue = ((int32_t*)&MouseState)[Mouse[i][0]];
|
||||||
|
uint32_t BaseValue = ((int32_t*)&BaseState)[Mouse[i][0]];
|
||||||
|
|
||||||
|
if (Mouse[i][1] == BTNTYPE_MOUSEAXE)
|
||||||
|
{
|
||||||
|
if ((lValue < AXIS_TOP_VALUE && BaseValue < AXIS_TOP_VALUE) || (lValue > AXIS_BOTTOM_VALUE && BaseValue > AXIS_BOTTOM_VALUE))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
((int32_t*)&(BaseState))[Mouse[i][0]] = lValue;
|
||||||
|
if (lValue < AXIS_TOP_VALUE)
|
||||||
|
{
|
||||||
|
bAxeDirection = AI_AXE_POSITIVE;
|
||||||
|
foundJoyPad = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (lValue > AXIS_BOTTOM_VALUE)
|
||||||
|
{
|
||||||
|
bAxeDirection = AI_AXE_NEGATIVE;
|
||||||
|
foundJoyPad = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (lValue == BaseValue)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
((int32_t*)&(BaseState))[Mouse[i][0]] = lValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foundJoyPad >= 0)
|
||||||
|
{
|
||||||
|
pButton.Offset = (uint8_t)Mouse[foundJoyPad][0];
|
||||||
|
pButton.AxisID = (uint8_t)bAxeDirection;
|
||||||
|
pButton.BtnType = (BtnType)Mouse[foundJoyPad][1];
|
||||||
|
pButton.DeviceGuid = DeviceGuid;
|
||||||
|
pButton.Device = nullptr;
|
||||||
|
return SCAN_SUCCEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint8_t i = 0, n = sizeof(MouseState.rgbButtons) / sizeof(MouseState.rgbButtons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
if (BaseState.rgbButtons[i] == MouseState.rgbButtons[i])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BaseState.rgbButtons[i] = MouseState.rgbButtons[i];
|
||||||
|
|
||||||
|
if ((MouseState.rgbButtons[i] & 0x80) == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pButton.Offset = i;
|
||||||
|
pButton.AxisID = 0;
|
||||||
|
pButton.BtnType = BTNTYPE_MOUSEBUTTON;
|
||||||
|
pButton.DeviceGuid = DeviceGuid;
|
||||||
|
pButton.Device = nullptr;
|
||||||
|
return SCAN_SUCCEED;
|
||||||
|
}
|
||||||
|
return SCAN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
bool CDirectInput::AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice)
|
bool CDirectInput::AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice)
|
||||||
{
|
{
|
||||||
HRESULT hResult = lpDirectInputDevice->Acquire();
|
HRESULT hResult = lpDirectInputDevice->Acquire();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Button.h"
|
#include "Button.h"
|
||||||
#include "DeviceNotification.h"
|
#include "DeviceNotification.h"
|
||||||
#include "N64Controller.h"
|
#include "N64Controller.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
#include <Common/CriticalSection.h>
|
#include <Common/CriticalSection.h>
|
||||||
#define DIRECTINPUT_VERSION 0x0800
|
#define DIRECTINPUT_VERSION 0x0800
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -23,6 +24,7 @@ class CDirectInput
|
||||||
AI_AXE_POSITIVE = 0,
|
AI_AXE_POSITIVE = 0,
|
||||||
AI_AXE_NEGATIVE = 1,
|
AI_AXE_NEGATIVE = 1,
|
||||||
THRESHOLD = 50,
|
THRESHOLD = 50,
|
||||||
|
MOUSESCALEVALUE = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AI_POV
|
enum AI_POV
|
||||||
|
@ -46,6 +48,7 @@ public:
|
||||||
|
|
||||||
void Initiate(CONTROL_INFO * ControlInfo);
|
void Initiate(CONTROL_INFO * ControlInfo);
|
||||||
void MapControllerDevice(N64CONTROLLER & Controller);
|
void MapControllerDevice(N64CONTROLLER & Controller);
|
||||||
|
void MapShortcutDevice(SHORTCUTS& Shortcuts);
|
||||||
ScanResult ScanDevices(BUTTON & Button);
|
ScanResult ScanDevices(BUTTON & Button);
|
||||||
std::wstring ButtonAssignment(BUTTON & Button);
|
std::wstring ButtonAssignment(BUTTON & Button);
|
||||||
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
std::wstring ControllerDevices(const N64CONTROLLER & Controller);
|
||||||
|
@ -63,6 +66,7 @@ private:
|
||||||
BOOL EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi);
|
BOOL EnumMakeDeviceList(LPCDIDEVICEINSTANCE lpddi);
|
||||||
ScanResult ScanKeyboard(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, uint8_t * KeyboardState, BUTTON & pButton);
|
ScanResult ScanKeyboard(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, uint8_t * KeyboardState, BUTTON & pButton);
|
||||||
ScanResult ScanGamePad(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIJOYSTATE & BaseState, BUTTON & pButton);
|
ScanResult ScanGamePad(const GUID & DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIJOYSTATE & BaseState, BUTTON & pButton);
|
||||||
|
ScanResult ScanMouse(const GUID& DeviceGuid, LPDIRECTINPUTDEVICE8 didHandle, DIMOUSESTATE2& BaseState, BUTTON& pButton);
|
||||||
bool AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice);
|
bool AcquireDevice(LPDIRECTINPUTDEVICE8 lpDirectInputDevice);
|
||||||
void RefreshDeviceList(void);
|
void RefreshDeviceList(void);
|
||||||
bool JoyPadPovPressed(AI_POV Pov, int32_t Angle);
|
bool JoyPadPovPressed(AI_POV Pov, int32_t Angle);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "wtl-BitmapPicture.h"
|
#include "wtl-BitmapPicture.h"
|
||||||
#include "wtl-ScanButton.h"
|
#include "wtl-ScanButton.h"
|
||||||
#include "OptionsUI.h"
|
#include "OptionsUI.h"
|
||||||
|
#include "ShortcutsUI.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <Common/StdString.h>
|
#include <Common/StdString.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
@ -30,7 +31,8 @@ public:
|
||||||
COMMAND_HANDLER_EX(IDC_BTN_DEFAULTS, BN_CLICKED, DefaultBtnClicked)
|
COMMAND_HANDLER_EX(IDC_BTN_DEFAULTS, BN_CLICKED, DefaultBtnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_BTN_SETUP, BN_CLICKED, SetupBtnClicked)
|
COMMAND_HANDLER_EX(IDC_BTN_SETUP, BN_CLICKED, SetupBtnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_BTN_OPTIONS, BN_CLICKED, OptionsBtnClicked)
|
COMMAND_HANDLER_EX(IDC_BTN_OPTIONS, BN_CLICKED, OptionsBtnClicked)
|
||||||
COMMAND_HANDLER_EX(IDC_CHK_PLUGGED_IN, BN_CLICKED, PluggedInChanged)
|
COMMAND_HANDLER_EX(IDC_BTN_SHORTCUT, BN_CLICKED, ShortcutsBtnClicked)
|
||||||
|
COMMAND_HANDLER_EX(IDC_DEVICETYPE, CBN_SELCHANGE, PluggedInChanged)
|
||||||
NOTIFY_HANDLER_EX(IDC_TACK_RANGE, NM_RELEASEDCAPTURE, ItemChangedNotify);
|
NOTIFY_HANDLER_EX(IDC_TACK_RANGE, NM_RELEASEDCAPTURE, ItemChangedNotify);
|
||||||
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
|
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
|
||||||
MESSAGE_HANDLER(CScanButton::WM_SCAN_SUCCESS, OnScanSuccess)
|
MESSAGE_HANDLER(CScanButton::WM_SCAN_SUCCESS, OnScanSuccess)
|
||||||
|
@ -51,11 +53,13 @@ private:
|
||||||
void DefaultBtnClicked(UINT Code, int id, HWND ctl);
|
void DefaultBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
void SetupBtnClicked(UINT Code, int id, HWND ctl);
|
void SetupBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
void OptionsBtnClicked(UINT Code, int id, HWND ctl);
|
void OptionsBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
|
void ShortcutsBtnClicked(UINT Code, int id, HWND ctl);
|
||||||
void PluggedInChanged(UINT Code, int id, HWND ctl);
|
void PluggedInChanged(UINT Code, int id, HWND ctl);
|
||||||
LRESULT ItemChangedNotify(NMHDR* /*pNMHDR*/);
|
LRESULT ItemChangedNotify(NMHDR* /*pNMHDR*/);
|
||||||
|
void DisplayControllerImage(void);
|
||||||
void DisplayController(void);
|
void DisplayController(void);
|
||||||
void ButtonChannged(const BUTTON & Button);
|
void ButtonChannged(const BUTTON & Button);
|
||||||
void EnablePage(bool Enable);
|
void EnablePage(int32_t Present);
|
||||||
static void stButtonChanged(size_t data, const BUTTON & Button) { ((CControllerSettings *)data)->ButtonChannged(Button); }
|
static void stButtonChanged(size_t data, const BUTTON & Button) { ((CControllerSettings *)data)->ButtonChannged(Button); }
|
||||||
|
|
||||||
std::wstring m_Title;
|
std::wstring m_Title;
|
||||||
|
@ -73,6 +77,8 @@ private:
|
||||||
CScanButton m_ButtonA, m_ButtonB, m_ButtonStart;
|
CScanButton m_ButtonA, m_ButtonB, m_ButtonStart;
|
||||||
CScanButton m_ButtonZtrigger, m_ButtonRTrigger, m_ButtonLTrigger;
|
CScanButton m_ButtonZtrigger, m_ButtonRTrigger, m_ButtonLTrigger;
|
||||||
CScanButton m_ButtonAnalogU, m_ButtonAnalogD, m_ButtonAnalogL, m_ButtonAnalogR;
|
CScanButton m_ButtonAnalogU, m_ButtonAnalogD, m_ButtonAnalogL, m_ButtonAnalogR;
|
||||||
|
CComboBox m_DeviceType;
|
||||||
|
SHORTCUTS m_Shortcuts;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInputConfigUI :
|
class CInputConfigUI :
|
||||||
|
@ -96,6 +102,7 @@ CControllerSettings::CControllerSettings(uint32_t ControllerNumber) :
|
||||||
m_SetupIndex(-1),
|
m_SetupIndex(-1),
|
||||||
m_Controller(g_InputPlugin->Controllers(ControllerNumber)),
|
m_Controller(g_InputPlugin->Controllers(ControllerNumber)),
|
||||||
m_ControlInfo(g_InputPlugin->ControlInfo(ControllerNumber)),
|
m_ControlInfo(g_InputPlugin->ControlInfo(ControllerNumber)),
|
||||||
|
m_Shortcuts(g_InputPlugin->Shortcuts()),
|
||||||
m_ButtonUDPad(m_Controller.U_DPAD, IDC_EDIT_DIGITIAL_UP, IDC_BTN_DIGITIAL_UP),
|
m_ButtonUDPad(m_Controller.U_DPAD, IDC_EDIT_DIGITIAL_UP, IDC_BTN_DIGITIAL_UP),
|
||||||
m_ButtonDDPad(m_Controller.D_DPAD, IDC_EDIT_DIGITIAL_DOWN, IDC_BTN_DIGITIAL_DOWN),
|
m_ButtonDDPad(m_Controller.D_DPAD, IDC_EDIT_DIGITIAL_DOWN, IDC_BTN_DIGITIAL_DOWN),
|
||||||
m_ButtonLDPad(m_Controller.L_DPAD, IDC_EDIT_DIGITIAL_LEFT, IDC_BTN_DIGITIAL_LEFT),
|
m_ButtonLDPad(m_Controller.L_DPAD, IDC_EDIT_DIGITIAL_LEFT, IDC_BTN_DIGITIAL_LEFT),
|
||||||
|
@ -130,9 +137,10 @@ BOOL CControllerSettings::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam
|
||||||
m_Range.SetRangeMin(1);
|
m_Range.SetRangeMin(1);
|
||||||
m_Range.SetRangeMax(100);
|
m_Range.SetRangeMax(100);
|
||||||
m_PluggedIn.Attach(GetDlgItem(IDC_CHK_PLUGGED_IN));
|
m_PluggedIn.Attach(GetDlgItem(IDC_CHK_PLUGGED_IN));
|
||||||
|
m_DeviceType.Attach(GetDlgItem(IDC_DEVICETYPE));
|
||||||
|
|
||||||
m_ControllerImg.SubclassWindow(GetDlgItem(IDC_BMP_CONTROLLER));
|
m_ControllerImg.SubclassWindow(GetDlgItem(IDC_BMP_CONTROLLER));
|
||||||
m_ControllerImg.SetBitmap(MAKEINTRESOURCE(IDB_CONTROLLER));
|
|
||||||
CScanButton * Buttons[] = {
|
CScanButton * Buttons[] = {
|
||||||
&m_ButtonUDPad, &m_ButtonDDPad, &m_ButtonLDPad, &m_ButtonRDPad, &m_ButtonA, &m_ButtonB,
|
&m_ButtonUDPad, &m_ButtonDDPad, &m_ButtonLDPad, &m_ButtonRDPad, &m_ButtonA, &m_ButtonB,
|
||||||
&m_ButtonCUp, &m_ButtonCDown, &m_ButtonCLeft, &m_ButtonCRight, &m_ButtonStart,
|
&m_ButtonCUp, &m_ButtonCDown, &m_ButtonCLeft, &m_ButtonCRight, &m_ButtonStart,
|
||||||
|
@ -145,8 +153,16 @@ BOOL CControllerSettings::OnInitDialog(CWindow /*wndFocus*/, LPARAM /*lInitParam
|
||||||
Buttons[i]->SubclassWindow(m_hWnd);
|
Buttons[i]->SubclassWindow(m_hWnd);
|
||||||
Buttons[i]->SetChangeCallback(stButtonChanged, (size_t)this);
|
Buttons[i]->SetChangeCallback(stButtonChanged, (size_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Index = m_DeviceType.AddString(L"None");
|
||||||
|
m_DeviceType.SetItemData(Index, PRESENT_NONE);
|
||||||
|
Index = m_DeviceType.AddString(L"N64 Controller");
|
||||||
|
m_DeviceType.SetItemData(Index, PRESENT_CONT);
|
||||||
|
Index = m_DeviceType.AddString(L"N64 Mouse");
|
||||||
|
m_DeviceType.SetItemData(Index, PRESENT_MOUSE);
|
||||||
|
|
||||||
DisplayController();
|
DisplayController();
|
||||||
EnablePage(m_PluggedIn.GetCheck() == BST_CHECKED);
|
EnablePage(m_DeviceType.GetItemData(m_DeviceType.GetCurSel()));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +186,7 @@ LRESULT CControllerSettings::OnApply()
|
||||||
Controller.Range = (uint8_t)m_Range.GetPos();
|
Controller.Range = (uint8_t)m_Range.GetPos();
|
||||||
Controller.DeadZone = (uint8_t)m_DeadZone.GetPos();
|
Controller.DeadZone = (uint8_t)m_DeadZone.GetPos();
|
||||||
CONTROL & ControlInfo = g_InputPlugin->ControlInfo(m_ControllerNumber);
|
CONTROL & ControlInfo = g_InputPlugin->ControlInfo(m_ControllerNumber);
|
||||||
ControlInfo.Present = (m_PluggedIn.GetCheck() == BST_CHECKED) ? 1 : 0;
|
ControlInfo.Present = m_DeviceType.GetItemData(m_DeviceType.GetCurSel());
|
||||||
ControlInfo.Plugin = m_ControlInfo.Plugin;
|
ControlInfo.Plugin = m_ControlInfo.Plugin;
|
||||||
return g_InputPlugin->SaveController(m_ControllerNumber) ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE;
|
return g_InputPlugin->SaveController(m_ControllerNumber) ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE;
|
||||||
}
|
}
|
||||||
|
@ -238,10 +254,16 @@ void CControllerSettings::OptionsBtnClicked(UINT /*Code*/, int /*id*/, HWND /*ct
|
||||||
ConfigOption(m_ControllerNumber, m_ControlInfo, m_Controller);
|
ConfigOption(m_ControllerNumber, m_ControlInfo, m_Controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CControllerSettings::ShortcutsBtnClicked(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
|
{
|
||||||
|
ConfigShortcut(m_Shortcuts);
|
||||||
|
}
|
||||||
|
|
||||||
void CControllerSettings::PluggedInChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
void CControllerSettings::PluggedInChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
|
||||||
{
|
{
|
||||||
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
|
||||||
EnablePage(m_PluggedIn.GetCheck() == BST_CHECKED);
|
EnablePage(m_DeviceType.GetItemData(m_DeviceType.GetCurSel()));
|
||||||
|
DisplayControllerImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CControllerSettings::ItemChangedNotify(NMHDR* /*pNMHDR*/)
|
LRESULT CControllerSettings::ItemChangedNotify(NMHDR* /*pNMHDR*/)
|
||||||
|
@ -250,9 +272,34 @@ LRESULT CControllerSettings::ItemChangedNotify(NMHDR* /*pNMHDR*/)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CControllerSettings::DisplayControllerImage(void)
|
||||||
|
{
|
||||||
|
if (m_DeviceType.GetItemData(m_DeviceType.GetCurSel()) != PRESENT_MOUSE)
|
||||||
|
{
|
||||||
|
m_ControllerImg.SetBitmap(MAKEINTRESOURCE(IDB_CONTROLLER));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ControllerImg.SetBitmap(MAKEINTRESOURCE(IDB_MOUSE));
|
||||||
|
}
|
||||||
|
m_ControllerImg.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
void CControllerSettings::DisplayController(void)
|
void CControllerSettings::DisplayController(void)
|
||||||
{
|
{
|
||||||
m_PluggedIn.SetCheck(m_ControlInfo.Present != 0 ? BST_CHECKED : BST_UNCHECKED);
|
int32_t index = 0;
|
||||||
|
m_DeviceType.SetCurSel(0);
|
||||||
|
for (index = 0; index < m_DeviceType.GetCount(); index++)
|
||||||
|
{
|
||||||
|
if (m_DeviceType.GetItemData(index) == m_ControlInfo.Present)
|
||||||
|
{
|
||||||
|
m_DeviceType.SetCurSel(index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayControllerImage();
|
||||||
|
|
||||||
m_Range.SetPos(m_Controller.Range);
|
m_Range.SetPos(m_Controller.Range);
|
||||||
m_DeadZone.SetPos(m_Controller.DeadZone);
|
m_DeadZone.SetPos(m_Controller.DeadZone);
|
||||||
CWindow(GetDlgItem(IDC_LABEL_RANGE)).SetWindowText(stdstr_f("%d%%", m_Range.GetPos()).ToUTF16().c_str());
|
CWindow(GetDlgItem(IDC_LABEL_RANGE)).SetWindowText(stdstr_f("%d%%", m_Range.GetPos()).ToUTF16().c_str());
|
||||||
|
@ -281,8 +328,9 @@ void CControllerSettings::ButtonChannged(const BUTTON & Button)
|
||||||
CPropertySheetWindow(GetParent()).SetModified(m_hWnd);
|
CPropertySheetWindow(GetParent()).SetModified(m_hWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControllerSettings::EnablePage(bool Enable)
|
void CControllerSettings::EnablePage(int32_t Present)
|
||||||
{
|
{
|
||||||
|
bool Enable = Present == PRESENT_CONT;
|
||||||
GetDlgItem(IDC_SLIDE_DEADZONE).EnableWindow(Enable);
|
GetDlgItem(IDC_SLIDE_DEADZONE).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_SLIDER_RANGE).EnableWindow(Enable);
|
GetDlgItem(IDC_SLIDER_RANGE).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_EDIT_LTRIGGER).EnableWindow(Enable);
|
GetDlgItem(IDC_EDIT_LTRIGGER).EnableWindow(Enable);
|
||||||
|
@ -322,6 +370,8 @@ void CControllerSettings::EnablePage(bool Enable)
|
||||||
GetDlgItem(IDC_BTN_BUTTON_START).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_BUTTON_START).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_BTN_BUTTON_Z).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_BUTTON_Z).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_BTN_SETUP).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_SETUP).EnableWindow(Enable);
|
||||||
|
|
||||||
|
Enable = Present != PRESENT_NONE;
|
||||||
GetDlgItem(IDC_BTN_DEFAULTS).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_DEFAULTS).EnableWindow(Enable);
|
||||||
GetDlgItem(IDC_BTN_OPTIONS).EnableWindow(Enable);
|
GetDlgItem(IDC_BTN_OPTIONS).EnableWindow(Enable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,10 @@ Output: None
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
EXPORT void CALL DllConfig(void * hParent)
|
EXPORT void CALL DllConfig(void * hParent)
|
||||||
{
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
ConfigInput(hParent);
|
ConfigInput(hParent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,6 +158,10 @@ Output: None
|
||||||
|
|
||||||
EXPORT void CALL RomClosed(void)
|
EXPORT void CALL RomClosed(void)
|
||||||
{
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -166,6 +174,26 @@ Output: None
|
||||||
|
|
||||||
EXPORT void CALL RomOpen(void)
|
EXPORT void CALL RomOpen(void)
|
||||||
{
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->LockMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: EmulationPaused
|
||||||
|
Purpose: This function is called when the emulation is paused. (from the
|
||||||
|
emulation thread)
|
||||||
|
Input: None
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPORT void CALL EmulationPaused(void)
|
||||||
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -192,6 +220,22 @@ EXPORT void CALL WM_KeyUp(uint32_t /*wParam*/, uint32_t /*lParam*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: WM_KillFocus
|
||||||
|
Purpose: To pass the WM_KILLFOCUS message from the emulator to the
|
||||||
|
plugin.
|
||||||
|
Input: wParam and lParam of the WM_KILLFOCUS message.
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
|
||||||
|
EXPORT void CALL WM_KillFocus(uint32_t /*wParam*/, uint32_t /*lParam*/)
|
||||||
|
{
|
||||||
|
if (g_InputPlugin != nullptr)
|
||||||
|
{
|
||||||
|
g_InputPlugin->UnlockMouse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EXPORT void CALL PluginLoaded(void)
|
EXPORT void CALL PluginLoaded(void)
|
||||||
{
|
{
|
||||||
SetupInputSettings();
|
SetupInputSettings();
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
CInputSettings * g_Settings = nullptr;
|
CInputSettings * g_Settings = nullptr;
|
||||||
|
|
||||||
|
/* Default First N64 Controller Setup */
|
||||||
static char * Control0_U_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 17 0 5";
|
static char * Control0_U_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 17 0 5";
|
||||||
static char * Control0_D_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 25 0 5";
|
static char * Control0_D_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 25 0 5";
|
||||||
static char * Control0_L_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 24 0 5";
|
static char * Control0_L_DPAD_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 24 0 5";
|
||||||
|
@ -25,10 +26,28 @@ static char * Control0_L_ANALOG_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000
|
||||||
static char * Control0_R_ANALOG_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} CD 0 5";
|
static char * Control0_R_ANALOG_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} CD 0 5";
|
||||||
static const uint32_t Default_DeadZone = 25;
|
static const uint32_t Default_DeadZone = 25;
|
||||||
static const uint32_t Default_Range = 100;
|
static const uint32_t Default_Range = 100;
|
||||||
|
static const uint32_t Default_Sensitivity = 100;
|
||||||
static const uint32_t Default_Plugin = PLUGIN_MEMPAK;
|
static const uint32_t Default_Plugin = PLUGIN_MEMPAK;
|
||||||
static const bool Default_RealN64Range = true;
|
static const bool Default_RealN64Range = true;
|
||||||
static const bool Default_RemoveDuplicate = true;
|
static const bool Default_RemoveDuplicate = true;
|
||||||
|
|
||||||
|
/* Default Mouse Setup (Forced) */
|
||||||
|
static char* Mouse_A_BUTTON_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 00 0 6";
|
||||||
|
static char* Mouse_B_BUTTON_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 01 0 6";
|
||||||
|
static char* Mouse_U_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 01 0 7";
|
||||||
|
static char* Mouse_D_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 01 1 7";
|
||||||
|
static char* Mouse_L_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 00 0 7";
|
||||||
|
static char* Mouse_R_ANALOG_Default = "{6F1D2B60-D5A0-11CF-BFC7-444553540000} 00 1 7";
|
||||||
|
static const uint32_t DefaultMouse_DeadZone = 1;
|
||||||
|
static const uint32_t DefaultMouse_Range = 100;
|
||||||
|
static const uint32_t DefaultMouse_Plugin = PLUGIN_NONE;
|
||||||
|
static const uint32_t DefaultMouse_Sensitivity = 100;
|
||||||
|
static const bool DefaultMouse_RealN64Range = false;
|
||||||
|
static const bool DefaultMouse_RemoveDuplicate = true;
|
||||||
|
|
||||||
|
/* Default Shortcuts Setup */
|
||||||
|
static char* Shortcuts_LOCKMOUSE_Default = "{6F1D2B61-D5A0-11CF-BFC7-444553540000} 0F 0 5";
|
||||||
|
|
||||||
CInputSettings::CInputSettings()
|
CInputSettings::CInputSettings()
|
||||||
{
|
{
|
||||||
RegisterSettings();
|
RegisterSettings();
|
||||||
|
@ -40,6 +59,12 @@ CInputSettings::~CInputSettings()
|
||||||
|
|
||||||
void CInputSettings::LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller)
|
void CInputSettings::LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller)
|
||||||
{
|
{
|
||||||
|
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
||||||
|
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
||||||
|
|
||||||
|
ControllerInfo.Present = ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])) ? GetSetting((short)PresentSettings[ControlIndex]) : PRESENT_NONE;
|
||||||
|
ControllerInfo.Plugin = ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])) ? GetSetting((short)PluginSettings[ControlIndex]) : Default_Plugin;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
BUTTON& Button;
|
BUTTON& Button;
|
||||||
|
@ -135,26 +160,37 @@ void CInputSettings::LoadController(uint32_t ControlIndex, CONTROL & ControllerI
|
||||||
Buttons[i].Button = StrToButton(GetSettingSz((short)Buttons[i].SettingId, Buffer, sizeof(Buffer) / sizeof(Buffer[0])));
|
Buttons[i].Button = StrToButton(GetSettingSz((short)Buttons[i].SettingId, Buffer, sizeof(Buffer) / sizeof(Buffer[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
|
||||||
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
|
||||||
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
||||||
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
||||||
|
InputSettingID SensitivitySettings[] = { Set_Control0_Sensitivity, Set_Control1_Sensitivity, Set_Control2_Sensitivity, Set_Control3_Sensitivity };
|
||||||
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
||||||
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
||||||
|
|
||||||
ControllerInfo.Present = ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])) ? GetSetting((short)PresentSettings[ControlIndex]) != 0 : 0;
|
|
||||||
ControllerInfo.Plugin = ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])) ? GetSetting((short)PluginSettings[ControlIndex]) : Default_Plugin;
|
|
||||||
Controller.Range = (uint8_t)(ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])) ? GetSetting((short)RangeSettings[ControlIndex]) : Default_Range);
|
Controller.Range = (uint8_t)(ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])) ? GetSetting((short)RangeSettings[ControlIndex]) : Default_Range);
|
||||||
if (Controller.Range == 0) { Controller.Range = 1; }
|
if (Controller.Range == 0) { Controller.Range = 1; }
|
||||||
if (Controller.Range > 100) { Controller.Range = 100; }
|
if (Controller.Range > 100) { Controller.Range = 100; }
|
||||||
Controller.DeadZone = (uint8_t)(ControlIndex < (sizeof(DeadZoneSettings) / sizeof(DeadZoneSettings[0])) ? GetSetting((short)DeadZoneSettings[ControlIndex]) : Default_DeadZone);
|
Controller.DeadZone = (uint8_t)(ControlIndex < (sizeof(DeadZoneSettings) / sizeof(DeadZoneSettings[0])) ? GetSetting((short)DeadZoneSettings[ControlIndex]) : Default_DeadZone);
|
||||||
if (Controller.DeadZone > 100) { Controller.DeadZone = 100; }
|
if (Controller.DeadZone > 100) { Controller.DeadZone = 100; }
|
||||||
|
Controller.Sensitivity = (uint8_t)(ControlIndex < (sizeof(SensitivitySettings) / sizeof(SensitivitySettings[0])) ? GetSetting((short)SensitivitySettings[ControlIndex]) : Default_Sensitivity);
|
||||||
|
if (Controller.Sensitivity > 100) { Controller.Sensitivity = 100; }
|
||||||
Controller.RealN64Range = (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])) ? GetSetting((short)RealN64RangeSettings[ControlIndex]) != 0 : Default_RealN64Range);
|
Controller.RealN64Range = (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])) ? GetSetting((short)RealN64RangeSettings[ControlIndex]) != 0 : Default_RealN64Range);
|
||||||
Controller.RemoveDuplicate = (ControlIndex < (sizeof(RemoveDuplicateSettings) / sizeof(RemoveDuplicateSettings[0])) ? GetSetting((short)RemoveDuplicateSettings[ControlIndex]) != 0 : Default_RemoveDuplicate);
|
Controller.RemoveDuplicate = (ControlIndex < (sizeof(RemoveDuplicateSettings) / sizeof(RemoveDuplicateSettings[0])) ? GetSetting((short)RemoveDuplicateSettings[ControlIndex]) != 0 : Default_RemoveDuplicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller)
|
void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller)
|
||||||
{
|
{
|
||||||
|
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
||||||
|
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
||||||
|
|
||||||
|
if (ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])))
|
||||||
|
{
|
||||||
|
SetSetting((short)PresentSettings[ControlIndex], ControllerInfo.Present);
|
||||||
|
}
|
||||||
|
if (ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])))
|
||||||
|
{
|
||||||
|
SetSetting((short)PluginSettings[ControlIndex], ControllerInfo.Plugin);
|
||||||
|
}
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
const BUTTON & Button;
|
const BUTTON & Button;
|
||||||
|
@ -181,6 +217,7 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
{ Controller.D_ANALOG, Set_Control0_D_ANALOG, 0 },
|
{ Controller.D_ANALOG, Set_Control0_D_ANALOG, 0 },
|
||||||
{ Controller.L_ANALOG, Set_Control0_L_ANALOG, 0 },
|
{ Controller.L_ANALOG, Set_Control0_L_ANALOG, 0 },
|
||||||
{ Controller.R_ANALOG, Set_Control0_R_ANALOG, 0 },
|
{ Controller.R_ANALOG, Set_Control0_R_ANALOG, 0 },
|
||||||
|
|
||||||
{ Controller.U_DPAD, Set_Control1_U_DPAD, 1 },
|
{ Controller.U_DPAD, Set_Control1_U_DPAD, 1 },
|
||||||
{ Controller.D_DPAD, Set_Control1_D_DPAD, 1 },
|
{ Controller.D_DPAD, Set_Control1_D_DPAD, 1 },
|
||||||
{ Controller.L_DPAD, Set_Control1_L_DPAD, 1 },
|
{ Controller.L_DPAD, Set_Control1_L_DPAD, 1 },
|
||||||
|
@ -239,10 +276,9 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
{ Controller.R_ANALOG, Set_Control3_R_ANALOG, 3 },
|
{ Controller.R_ANALOG, Set_Control3_R_ANALOG, 3 },
|
||||||
};
|
};
|
||||||
|
|
||||||
InputSettingID PresentSettings[] = { Set_Control0_Present, Set_Control1_Present, Set_Control2_Present, Set_Control3_Present };
|
|
||||||
InputSettingID PluginSettings[] = { Set_Control0_Plugin, Set_Control1_Plugin, Set_Control2_Plugin, Set_Control3_Plugin };
|
|
||||||
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
InputSettingID RangeSettings[] = { Set_Control0_Range, Set_Control1_Range, Set_Control2_Range, Set_Control3_Range };
|
||||||
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
InputSettingID DeadZoneSettings[] = { Set_Control0_Deadzone, Set_Control1_Deadzone, Set_Control2_Deadzone,Set_Control3_Deadzone };
|
||||||
|
InputSettingID SensitivitySettings[] = { Set_Control0_Sensitivity, Set_Control1_Sensitivity, Set_Control2_Sensitivity, Set_Control3_Sensitivity };
|
||||||
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
InputSettingID RealN64RangeSettings[] = { Set_Control0_RealN64Range, Set_Control1_RealN64Range, Set_Control2_RealN64Range, Set_Control3_RealN64Range };
|
||||||
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
InputSettingID RemoveDuplicateSettings[] = { Set_Control0_RemoveDuplicate, Set_Control1_RemoveDuplicate, Set_Control2_RemoveDuplicate, Set_Control3_RemoveDuplicate };
|
||||||
|
|
||||||
|
@ -255,15 +291,6 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
SetSettingSz((short)Buttons[i].SettingId, ButtonToStr(Buttons[i].Button).c_str());
|
SetSettingSz((short)Buttons[i].SettingId, ButtonToStr(Buttons[i].Button).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ControlIndex < (sizeof(PresentSettings) / sizeof(PresentSettings[0])))
|
|
||||||
{
|
|
||||||
SetSetting((short)PresentSettings[ControlIndex], ControllerInfo.Present);
|
|
||||||
}
|
|
||||||
if (ControlIndex < (sizeof(PluginSettings) / sizeof(PluginSettings[0])))
|
|
||||||
{
|
|
||||||
SetSetting((short)PluginSettings[ControlIndex], ControllerInfo.Plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])))
|
if (ControlIndex < (sizeof(RangeSettings) / sizeof(RangeSettings[0])))
|
||||||
{
|
{
|
||||||
SetSetting((short)RangeSettings[ControlIndex], Controller.Range);
|
SetSetting((short)RangeSettings[ControlIndex], Controller.Range);
|
||||||
|
@ -273,6 +300,10 @@ void CInputSettings::SaveController(uint32_t ControlIndex, const CONTROL & Contr
|
||||||
{
|
{
|
||||||
SetSetting((short)DeadZoneSettings[ControlIndex], Controller.DeadZone);
|
SetSetting((short)DeadZoneSettings[ControlIndex], Controller.DeadZone);
|
||||||
}
|
}
|
||||||
|
if (ControlIndex < (sizeof(SensitivitySettings) / sizeof(SensitivitySettings[0])))
|
||||||
|
{
|
||||||
|
SetSetting((short)SensitivitySettings[ControlIndex], Controller.Sensitivity);
|
||||||
|
}
|
||||||
if (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])))
|
if (ControlIndex < (sizeof(RealN64RangeSettings) / sizeof(RealN64RangeSettings[0])))
|
||||||
{
|
{
|
||||||
SetSetting((short)RealN64RangeSettings[ControlIndex], Controller.RealN64Range ? 1 : 0);
|
SetSetting((short)RealN64RangeSettings[ControlIndex], Controller.RealN64Range ? 1 : 0);
|
||||||
|
@ -381,10 +412,110 @@ void CInputSettings::ResetController(uint32_t ControlIndex, CONTROL & Controller
|
||||||
}
|
}
|
||||||
Controller.Range = Default_Range;
|
Controller.Range = Default_Range;
|
||||||
Controller.DeadZone = Default_DeadZone;
|
Controller.DeadZone = Default_DeadZone;
|
||||||
ControllerInfo.Present = ControlIndex == 0 ? 1 : 0;
|
Controller.Sensitivity = Default_Sensitivity;
|
||||||
|
ControllerInfo.Present = ControlIndex == 0 ? PRESENT_CONT : PRESENT_NONE;
|
||||||
ControllerInfo.Plugin = Default_Plugin;
|
ControllerInfo.Plugin = Default_Plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInputSettings::GetControllerMouse(N64CONTROLLER& Controller)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BUTTON& Button;
|
||||||
|
const char* DefaultValue;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Controller.U_DPAD, "" },
|
||||||
|
{ Controller.D_DPAD, "" },
|
||||||
|
{ Controller.L_DPAD, "" },
|
||||||
|
{ Controller.R_DPAD, "" },
|
||||||
|
{ Controller.A_BUTTON, Mouse_A_BUTTON_Default },
|
||||||
|
{ Controller.B_BUTTON, Mouse_B_BUTTON_Default },
|
||||||
|
{ Controller.U_CBUTTON, "" },
|
||||||
|
{ Controller.D_CBUTTON, "" },
|
||||||
|
{ Controller.L_CBUTTON, "" },
|
||||||
|
{ Controller.R_CBUTTON, "" },
|
||||||
|
{ Controller.START_BUTTON, "" },
|
||||||
|
{ Controller.Z_TRIG, "" },
|
||||||
|
{ Controller.R_TRIG, "" },
|
||||||
|
{ Controller.L_TRIG, "" },
|
||||||
|
{ Controller.U_ANALOG, Mouse_U_ANALOG_Default },
|
||||||
|
{ Controller.D_ANALOG, Mouse_D_ANALOG_Default },
|
||||||
|
{ Controller.L_ANALOG, Mouse_L_ANALOG_Default },
|
||||||
|
{ Controller.R_ANALOG, Mouse_R_ANALOG_Default },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i].Button = StrToButton(Buttons[i].DefaultValue);
|
||||||
|
}
|
||||||
|
Controller.Range = DefaultMouse_Range;
|
||||||
|
Controller.DeadZone = DefaultMouse_DeadZone;
|
||||||
|
Controller.Sensitivity = DefaultMouse_Sensitivity;
|
||||||
|
Controller.RealN64Range = DefaultMouse_RealN64Range;
|
||||||
|
Controller.RemoveDuplicate = DefaultMouse_RemoveDuplicate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputSettings::LoadShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BUTTON& Button;
|
||||||
|
InputSettingID SettingId;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Shortcuts.LOCKMOUSE, Set_Shortcut_LOCKMOUSE },
|
||||||
|
};
|
||||||
|
|
||||||
|
char Buffer[400];
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i].Button = StrToButton(GetSettingSz((short)Buttons[i].SettingId, Buffer, sizeof(Buffer) / sizeof(Buffer[0])));
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcuts.LOCKMOUSE_PRESSED = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputSettings::SaveShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const BUTTON& Button;
|
||||||
|
InputSettingID SettingId;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Shortcuts.LOCKMOUSE, Set_Shortcut_LOCKMOUSE },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
SetSettingSz((short)Buttons[i].SettingId, ButtonToStr(Buttons[i].Button).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CInputSettings::ResetShortcuts(SHORTCUTS& Shortcuts)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BUTTON& Button;
|
||||||
|
const char* DefaultValue;
|
||||||
|
}
|
||||||
|
Buttons[] =
|
||||||
|
{
|
||||||
|
{ Shortcuts.LOCKMOUSE, Shortcuts_LOCKMOUSE_Default },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i].Button = StrToButton(Buttons[i].DefaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcuts.LOCKMOUSE_PRESSED = false;
|
||||||
|
}
|
||||||
|
|
||||||
BUTTON CInputSettings::StrToButton(const char * Buffer)
|
BUTTON CInputSettings::StrToButton(const char * Buffer)
|
||||||
{
|
{
|
||||||
BUTTON Button = { 0 };
|
BUTTON Button = { 0 };
|
||||||
|
@ -419,6 +550,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control0_Plugin, Data_DWORD_General, "Plugin", "Controller 1", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control0_Plugin, Data_DWORD_General, "Plugin", "Controller 1", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control0_Range, Data_DWORD_General, "Range", "Controller 1", Default_Range, nullptr);
|
RegisterSetting(Set_Control0_Range, Data_DWORD_General, "Range", "Controller 1", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control0_Deadzone, Data_DWORD_General, "Deadzone", "Controller 1", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control0_Deadzone, Data_DWORD_General, "Deadzone", "Controller 1", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control0_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 1", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control0_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 1", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control0_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 1", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control0_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 1", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control0_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 1", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control0_U_DPAD, Data_String_General, "DPadUp", "Controller 1", 0, Control0_U_DPAD_Default);
|
RegisterSetting(Set_Control0_U_DPAD, Data_String_General, "DPadUp", "Controller 1", 0, Control0_U_DPAD_Default);
|
||||||
|
@ -444,6 +576,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control1_Plugin, Data_DWORD_General, "Plugin", "Controller 2", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control1_Plugin, Data_DWORD_General, "Plugin", "Controller 2", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control1_Range, Data_DWORD_General, "Range", "Controller 2", Default_Range, nullptr);
|
RegisterSetting(Set_Control1_Range, Data_DWORD_General, "Range", "Controller 2", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control1_Deadzone, Data_DWORD_General, "Deadzone", "Controller 2", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control1_Deadzone, Data_DWORD_General, "Deadzone", "Controller 2", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control1_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 2", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control1_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 2", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control1_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 2", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control1_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 2", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control1_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 2", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control1_U_DPAD, Data_String_General, "DPadUp", "Controller 2", 0, "");
|
RegisterSetting(Set_Control1_U_DPAD, Data_String_General, "DPadUp", "Controller 2", 0, "");
|
||||||
|
@ -469,6 +602,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control2_Plugin, Data_DWORD_General, "Plugin", "Controller 3", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control2_Plugin, Data_DWORD_General, "Plugin", "Controller 3", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control2_Range, Data_DWORD_General, "Range", "Controller 3", Default_Range, nullptr);
|
RegisterSetting(Set_Control2_Range, Data_DWORD_General, "Range", "Controller 3", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control2_Deadzone, Data_DWORD_General, "Deadzone", "Controller 3", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control2_Deadzone, Data_DWORD_General, "Deadzone", "Controller 3", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control2_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 3", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control2_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 3", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control2_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 3", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control2_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 3", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control2_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 3", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control2_U_DPAD, Data_String_General, "DPadUp", "Controller 3", 0, "");
|
RegisterSetting(Set_Control2_U_DPAD, Data_String_General, "DPadUp", "Controller 3", 0, "");
|
||||||
|
@ -494,6 +628,7 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control3_Plugin, Data_DWORD_General, "Plugin", "Controller 4", Default_Plugin, nullptr);
|
RegisterSetting(Set_Control3_Plugin, Data_DWORD_General, "Plugin", "Controller 4", Default_Plugin, nullptr);
|
||||||
RegisterSetting(Set_Control3_Range, Data_DWORD_General, "Range", "Controller 4", Default_Range, nullptr);
|
RegisterSetting(Set_Control3_Range, Data_DWORD_General, "Range", "Controller 4", Default_Range, nullptr);
|
||||||
RegisterSetting(Set_Control3_Deadzone, Data_DWORD_General, "Deadzone", "Controller 4", Default_DeadZone, nullptr);
|
RegisterSetting(Set_Control3_Deadzone, Data_DWORD_General, "Deadzone", "Controller 4", Default_DeadZone, nullptr);
|
||||||
|
RegisterSetting(Set_Control3_Sensitivity, Data_DWORD_General, "Sensitivity", "Controller 4", Default_Sensitivity, nullptr);
|
||||||
RegisterSetting(Set_Control3_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 4", Default_RealN64Range, nullptr);
|
RegisterSetting(Set_Control3_RealN64Range, Data_DWORD_General, "RealN64Range", "Controller 4", Default_RealN64Range, nullptr);
|
||||||
RegisterSetting(Set_Control3_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 4", Default_RemoveDuplicate, nullptr);
|
RegisterSetting(Set_Control3_RemoveDuplicate, Data_DWORD_General, "Remove Duplicate", "Controller 4", Default_RemoveDuplicate, nullptr);
|
||||||
RegisterSetting(Set_Control3_U_DPAD, Data_String_General, "DPadUp", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_U_DPAD, Data_String_General, "DPadUp", "Controller 4", 0, "");
|
||||||
|
@ -514,6 +649,8 @@ void CInputSettings::RegisterSettings(void)
|
||||||
RegisterSetting(Set_Control3_D_ANALOG, Data_String_General, "AnalogDown", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_D_ANALOG, Data_String_General, "AnalogDown", "Controller 4", 0, "");
|
||||||
RegisterSetting(Set_Control3_L_ANALOG, Data_String_General, "AnalogLeft", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_L_ANALOG, Data_String_General, "AnalogLeft", "Controller 4", 0, "");
|
||||||
RegisterSetting(Set_Control3_R_ANALOG, Data_String_General, "AnalogRight", "Controller 4", 0, "");
|
RegisterSetting(Set_Control3_R_ANALOG, Data_String_General, "AnalogRight", "Controller 4", 0, "");
|
||||||
|
|
||||||
|
RegisterSetting(Set_Shortcut_LOCKMOUSE, Data_String_General, "LockMouse", "Shortcuts", 0, Shortcuts_LOCKMOUSE_Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupInputSettings(void)
|
void SetupInputSettings(void)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "N64Controller.h"
|
#include "N64Controller.h"
|
||||||
|
#include "Shortcuts.h"
|
||||||
#include <Project64-plugin-spec/Input.h>
|
#include <Project64-plugin-spec/Input.h>
|
||||||
|
|
||||||
class CInputSettings
|
class CInputSettings
|
||||||
|
@ -13,6 +14,11 @@ public:
|
||||||
void LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
void LoadController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
||||||
void SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller);
|
void SaveController(uint32_t ControlIndex, const CONTROL & ControllerInfo, const N64CONTROLLER & Controller);
|
||||||
void ResetController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
void ResetController(uint32_t ControlIndex, CONTROL & ControllerInfo, N64CONTROLLER & Controller);
|
||||||
|
void GetControllerMouse(N64CONTROLLER& Controller);
|
||||||
|
|
||||||
|
void LoadShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
void SaveShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
void ResetShortcuts(SHORTCUTS& Shortcuts);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CInputSettings(const CInputSettings&);
|
CInputSettings(const CInputSettings&);
|
||||||
|
|
|
@ -6,6 +6,7 @@ enum InputSettingID
|
||||||
Set_Control0_Plugin,
|
Set_Control0_Plugin,
|
||||||
Set_Control0_Range,
|
Set_Control0_Range,
|
||||||
Set_Control0_Deadzone,
|
Set_Control0_Deadzone,
|
||||||
|
Set_Control0_Sensitivity,
|
||||||
Set_Control0_RealN64Range,
|
Set_Control0_RealN64Range,
|
||||||
Set_Control0_RemoveDuplicate,
|
Set_Control0_RemoveDuplicate,
|
||||||
Set_Control0_U_DPAD,
|
Set_Control0_U_DPAD,
|
||||||
|
@ -31,6 +32,7 @@ enum InputSettingID
|
||||||
Set_Control1_Plugin,
|
Set_Control1_Plugin,
|
||||||
Set_Control1_Range,
|
Set_Control1_Range,
|
||||||
Set_Control1_Deadzone,
|
Set_Control1_Deadzone,
|
||||||
|
Set_Control1_Sensitivity,
|
||||||
Set_Control1_RealN64Range,
|
Set_Control1_RealN64Range,
|
||||||
Set_Control1_RemoveDuplicate,
|
Set_Control1_RemoveDuplicate,
|
||||||
Set_Control1_U_DPAD,
|
Set_Control1_U_DPAD,
|
||||||
|
@ -56,6 +58,7 @@ enum InputSettingID
|
||||||
Set_Control2_Plugin,
|
Set_Control2_Plugin,
|
||||||
Set_Control2_Range,
|
Set_Control2_Range,
|
||||||
Set_Control2_Deadzone,
|
Set_Control2_Deadzone,
|
||||||
|
Set_Control2_Sensitivity,
|
||||||
Set_Control2_RealN64Range,
|
Set_Control2_RealN64Range,
|
||||||
Set_Control2_RemoveDuplicate,
|
Set_Control2_RemoveDuplicate,
|
||||||
Set_Control2_U_DPAD,
|
Set_Control2_U_DPAD,
|
||||||
|
@ -81,6 +84,7 @@ enum InputSettingID
|
||||||
Set_Control3_Plugin,
|
Set_Control3_Plugin,
|
||||||
Set_Control3_Range,
|
Set_Control3_Range,
|
||||||
Set_Control3_Deadzone,
|
Set_Control3_Deadzone,
|
||||||
|
Set_Control3_Sensitivity,
|
||||||
Set_Control3_RealN64Range,
|
Set_Control3_RealN64Range,
|
||||||
Set_Control3_RemoveDuplicate,
|
Set_Control3_RemoveDuplicate,
|
||||||
Set_Control3_U_DPAD,
|
Set_Control3_U_DPAD,
|
||||||
|
@ -101,4 +105,6 @@ enum InputSettingID
|
||||||
Set_Control3_D_ANALOG,
|
Set_Control3_D_ANALOG,
|
||||||
Set_Control3_L_ANALOG,
|
Set_Control3_L_ANALOG,
|
||||||
Set_Control3_R_ANALOG,
|
Set_Control3_R_ANALOG,
|
||||||
|
|
||||||
|
Set_Shortcut_LOCKMOUSE,
|
||||||
};
|
};
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
|
@ -23,6 +23,7 @@ typedef struct
|
||||||
BUTTON R_ANALOG;
|
BUTTON R_ANALOG;
|
||||||
uint8_t Range;
|
uint8_t Range;
|
||||||
uint8_t DeadZone;
|
uint8_t DeadZone;
|
||||||
|
uint8_t Sensitivity;
|
||||||
bool RealN64Range;
|
bool RealN64Range;
|
||||||
bool RemoveDuplicate;
|
bool RemoveDuplicate;
|
||||||
} N64CONTROLLER;
|
} N64CONTROLLER;
|
||||||
|
|
|
@ -11,6 +11,7 @@ public:
|
||||||
|
|
||||||
BEGIN_MSG_MAP(COptionsDlg)
|
BEGIN_MSG_MAP(COptionsDlg)
|
||||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
MESSAGE_HANDLER(WM_HSCROLL, OnScroll)
|
||||||
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
@ -29,6 +30,13 @@ public:
|
||||||
CButton(GetDlgItem(IDC_REAL_N64_RANGE)).SetCheck(m_Controller.RealN64Range ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_REAL_N64_RANGE)).SetCheck(m_Controller.RealN64Range ? BST_CHECKED : BST_UNCHECKED);
|
||||||
CButton(GetDlgItem(IDC_REMOVE_DUPLICATE)).SetCheck(m_Controller.RemoveDuplicate ? BST_CHECKED : BST_UNCHECKED);
|
CButton(GetDlgItem(IDC_REMOVE_DUPLICATE)).SetCheck(m_Controller.RemoveDuplicate ? BST_CHECKED : BST_UNCHECKED);
|
||||||
|
|
||||||
|
m_Sensitivity.Attach(GetDlgItem(IDC_SLIDE_SENSITIVITY));
|
||||||
|
m_Sensitivity.SetTicFreq(1);
|
||||||
|
m_Sensitivity.SetRangeMin(1);
|
||||||
|
m_Sensitivity.SetRangeMax(100);
|
||||||
|
m_Sensitivity.SetPos(m_Controller.Sensitivity);
|
||||||
|
CWindow(GetDlgItem(IDC_TXT_SENSITIVITY)).SetWindowText(stdstr_f("Mouse Sensitivity: %d%%", m_Sensitivity.GetPos()).ToUTF16().c_str());
|
||||||
|
|
||||||
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
||||||
int Index = ControllerPak.AddString(L"None");
|
int Index = ControllerPak.AddString(L"None");
|
||||||
ControllerPak.SetItemData(Index, PLUGIN_NONE);
|
ControllerPak.SetItemData(Index, PLUGIN_NONE);
|
||||||
|
@ -67,9 +75,16 @@ public:
|
||||||
bChanged = true;
|
bChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t Sensitivity = (uint8_t)m_Sensitivity.GetPos();
|
||||||
|
if (Sensitivity != m_Controller.Sensitivity)
|
||||||
|
{
|
||||||
|
m_Controller.Sensitivity = Sensitivity;
|
||||||
|
bChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
CComboBox ControllerPak(GetDlgItem(IDC_PAKTYPE));
|
||||||
DWORD_PTR Pak = ControllerPak.GetItemData(ControllerPak.GetCurSel());
|
DWORD_PTR Pak = ControllerPak.GetItemData(ControllerPak.GetCurSel());
|
||||||
if (Pak != m_ControlInfo.Plugin)
|
if (Pak != (DWORD_PTR)m_ControlInfo.Plugin)
|
||||||
{
|
{
|
||||||
m_ControlInfo.Plugin = (Pak & 0xFFFFFFFF);
|
m_ControlInfo.Plugin = (Pak & 0xFFFFFFFF);
|
||||||
bChanged = true;
|
bChanged = true;
|
||||||
|
@ -87,9 +102,19 @@ public:
|
||||||
EndDialog(wID);
|
EndDialog(wID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
LRESULT OnScroll(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
LONG SliderId = CWindow((HWND)lParam).GetWindowLong(GWL_ID);
|
||||||
|
if (SliderId == IDC_SLIDE_SENSITIVITY)
|
||||||
|
{
|
||||||
|
CWindow(GetDlgItem(IDC_TXT_SENSITIVITY)).SetWindowText(stdstr_f("Mouse Sensitivity: %d%%", m_Sensitivity.GetPos()).ToUTF16().c_str());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
uint32_t m_ControlIndex;
|
uint32_t m_ControlIndex;
|
||||||
CONTROL & m_ControlInfo;
|
CONTROL & m_ControlInfo;
|
||||||
N64CONTROLLER & m_Controller;
|
N64CONTROLLER & m_Controller;
|
||||||
|
CTrackBarCtrl m_Sensitivity;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ConfigOption(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller)
|
void ConfigOption(uint32_t ControlIndex, CONTROL & ControlInfo, N64CONTROLLER & Controller)
|
||||||
|
|
Binary file not shown.
|
@ -60,6 +60,7 @@
|
||||||
<ClCompile Include="CProject64Input.cpp" />
|
<ClCompile Include="CProject64Input.cpp" />
|
||||||
<ClCompile Include="InputSettings.cpp" />
|
<ClCompile Include="InputSettings.cpp" />
|
||||||
<ClCompile Include="OptionsUI.cpp" />
|
<ClCompile Include="OptionsUI.cpp" />
|
||||||
|
<ClCompile Include="ShortcutsUI.cpp" />
|
||||||
<ClCompile Include="wtl-BitmapPicture.cpp" />
|
<ClCompile Include="wtl-BitmapPicture.cpp" />
|
||||||
<ClCompile Include="wtl-ScanButton.cpp" />
|
<ClCompile Include="wtl-ScanButton.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -71,10 +72,11 @@
|
||||||
<ClInclude Include="N64Controller.h" />
|
<ClInclude Include="N64Controller.h" />
|
||||||
<ClInclude Include="DirectInput.h" />
|
<ClInclude Include="DirectInput.h" />
|
||||||
<ClInclude Include="InputConfigUI.h" />
|
<ClInclude Include="InputConfigUI.h" />
|
||||||
<ClInclude Include="ControllerSpec1.1.h" />
|
|
||||||
<ClInclude Include="CProject64Input.h" />
|
<ClInclude Include="CProject64Input.h" />
|
||||||
<ClInclude Include="OptionsUI.h" />
|
<ClInclude Include="OptionsUI.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
|
<ClInclude Include="Shortcuts.h" />
|
||||||
|
<ClInclude Include="ShortcutsUI.h" />
|
||||||
<ClInclude Include="wtl-BitmapPicture.h" />
|
<ClInclude Include="wtl-BitmapPicture.h" />
|
||||||
<ClInclude Include="wtl-ScanButton.h" />
|
<ClInclude Include="wtl-ScanButton.h" />
|
||||||
<ClInclude Include="wtl.h" />
|
<ClInclude Include="wtl.h" />
|
||||||
|
@ -87,6 +89,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="Controller.bmp" />
|
<Image Include="Controller.bmp" />
|
||||||
|
<Image Include="Mouse.bmp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Common\Common.vcxproj">
|
<ProjectReference Include="..\Common\Common.vcxproj">
|
||||||
|
|
|
@ -42,11 +42,11 @@
|
||||||
<ClCompile Include="OptionsUI.cpp">
|
<ClCompile Include="OptionsUI.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="ShortcutsUI.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="ControllerSpec1.1.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="resource.h">
|
<ClInclude Include="resource.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -86,6 +86,12 @@
|
||||||
<ClInclude Include="OptionsUI.h">
|
<ClInclude Include="OptionsUI.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Shortcuts.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ShortcutsUI.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Version.h.in">
|
<None Include="Version.h.in">
|
||||||
|
@ -101,5 +107,8 @@
|
||||||
<Image Include="Controller.bmp">
|
<Image Include="Controller.bmp">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</Image>
|
</Image>
|
||||||
|
<Image Include="Mouse.bmp">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</Image>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
#include "Button.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
BUTTON LOCKMOUSE;
|
||||||
|
|
||||||
|
bool LOCKMOUSE_PRESSED;
|
||||||
|
} SHORTCUTS;
|
|
@ -0,0 +1,132 @@
|
||||||
|
#include "ShortcutsUI.h"
|
||||||
|
#include "CProject64Input.h"
|
||||||
|
#include "wtl.h"
|
||||||
|
#include "wtl-ScanButton.h"
|
||||||
|
#include "resource.h"
|
||||||
|
#include <Common/StdString.h>
|
||||||
|
|
||||||
|
class CShortcutsDlg :
|
||||||
|
public CDialogImpl<CShortcutsDlg>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { IDD = IDD_Shortcuts };
|
||||||
|
|
||||||
|
BEGIN_MSG_MAP(CShortcutsDlg)
|
||||||
|
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||||
|
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||||
|
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||||
|
MESSAGE_HANDLER(CScanButton::WM_SCAN_SUCCESS, OnScanSuccess)
|
||||||
|
MESSAGE_HANDLER(CScanButton::WM_SCAN_CANCELED, OnScanCanceled)
|
||||||
|
END_MSG_MAP()
|
||||||
|
|
||||||
|
CShortcutsDlg(SHORTCUTS & Shortcuts) :
|
||||||
|
m_Shortcuts(Shortcuts),
|
||||||
|
m_SetupIndex(-1),
|
||||||
|
m_ButtonLockMouse(m_Shortcuts.LOCKMOUSE, IDC_EDIT_LOCKMOUSE, IDC_BTN_LOCKMOUSE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
CenterWindow(GetParent());
|
||||||
|
SetWindowText(stdstr_f("Shortcuts").ToUTF16().c_str());
|
||||||
|
|
||||||
|
CScanButton* Buttons[] = {
|
||||||
|
&m_ButtonLockMouse
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(Buttons) / sizeof(Buttons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
Buttons[i]->SubclassWindow(m_hWnd);
|
||||||
|
Buttons[i]->SetChangeCallback(stButtonChanged, (size_t)this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
SHORTCUTS& Shortcuts = g_InputPlugin->Shortcuts();
|
||||||
|
Shortcuts = m_Shortcuts;
|
||||||
|
g_InputPlugin->SaveShortcuts();
|
||||||
|
EndDialog(wID);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
EndDialog(wID);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SHORTCUTS& m_Shortcuts;
|
||||||
|
CScanButton m_ButtonLockMouse;
|
||||||
|
int32_t m_SetupIndex;
|
||||||
|
|
||||||
|
static void stButtonChanged(size_t data, const BUTTON& Button) { ((CShortcutsDlg*)data)->ButtonChannged(Button); }
|
||||||
|
|
||||||
|
void ButtonChannged(const BUTTON& Button)
|
||||||
|
{
|
||||||
|
BUTTON EmptyButton = { 0 };
|
||||||
|
BUTTON* buttons[] =
|
||||||
|
{
|
||||||
|
&m_Shortcuts.LOCKMOUSE,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Changed = false;
|
||||||
|
for (size_t b = 0; b < (sizeof(buttons) / sizeof(buttons[0])); b++)
|
||||||
|
{
|
||||||
|
if (buttons[b]->Offset == Button.Offset &&
|
||||||
|
buttons[b]->AxisID == Button.AxisID &&
|
||||||
|
buttons[b]->BtnType == Button.BtnType &&
|
||||||
|
memcmp(&buttons[b]->DeviceGuid, &Button.DeviceGuid, sizeof(Button.DeviceGuid)) == 0)
|
||||||
|
{
|
||||||
|
*buttons[b] = EmptyButton;
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Changed)
|
||||||
|
{
|
||||||
|
CScanButton* ScanButtons[] = {
|
||||||
|
&m_ButtonLockMouse,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (size_t i = 0, n = sizeof(ScanButtons) / sizeof(ScanButtons[0]); i < n; i++)
|
||||||
|
{
|
||||||
|
ScanButtons[i]->DisplayButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CPropertySheetWindow(GetParent()).SetModified(m_hWnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnScanSuccess(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
if (m_SetupIndex < 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CScanButton* Buttons[] = {
|
||||||
|
&m_ButtonLockMouse
|
||||||
|
};
|
||||||
|
|
||||||
|
m_SetupIndex += 1;
|
||||||
|
if (m_SetupIndex < (sizeof(Buttons) / sizeof(Buttons[0])))
|
||||||
|
{
|
||||||
|
Buttons[m_SetupIndex]->DetectKey();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT OnScanCanceled(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||||
|
{
|
||||||
|
m_SetupIndex = -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void ConfigShortcut(SHORTCUTS & Shortcuts)
|
||||||
|
{
|
||||||
|
CShortcutsDlg(Shortcuts).DoModal();
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <Project64-plugin-spec/Input.h>
|
||||||
|
#include "Shortcuts.h"
|
||||||
|
|
||||||
|
void ConfigShortcut(SHORTCUTS & Shortcuts);
|
|
@ -6,6 +6,7 @@
|
||||||
#define VERSION_REVISION 2
|
#define VERSION_REVISION 2
|
||||||
#define VERSION_BUILD 9999
|
#define VERSION_BUILD 9999
|
||||||
#define VERSION_PREFIX "Dev-"
|
#define VERSION_PREFIX "Dev-"
|
||||||
|
#define VERSION_BUILD_YEAR 2025
|
||||||
|
|
||||||
#define GIT_REVISION ""
|
#define GIT_REVISION ""
|
||||||
#define GIT_REVISION_SHORT ""
|
#define GIT_REVISION_SHORT ""
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
#define VER_PRODUCT_VERSION_STR VER_FILE_VERSION_STR
|
#define VER_PRODUCT_VERSION_STR VER_FILE_VERSION_STR
|
||||||
#define VER_ORIGINAL_FILENAME_STR VER_PRODUCTNAME_STR ".dll"
|
#define VER_ORIGINAL_FILENAME_STR VER_PRODUCTNAME_STR ".dll"
|
||||||
#define VER_INTERNAL_NAME_STR VER_PRODUCTNAME_STR
|
#define VER_INTERNAL_NAME_STR VER_PRODUCTNAME_STR
|
||||||
#define VER_COPYRIGHT_STR "Copyright (C) 2021"
|
#define VER_COPYRIGHT_STR "Copyright (C) " STRINGIZE(VERSION_BUILD_YEAR)
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define VER_VER_DEBUG VS_FF_DEBUG
|
#define VER_VER_DEBUG VS_FF_DEBUG
|
||||||
|
|
Binary file not shown.
|
@ -15,6 +15,13 @@ enum PluginType
|
||||||
PLUGIN_RAW = 5,
|
PLUGIN_RAW = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PresentType
|
||||||
|
{
|
||||||
|
PRESENT_NONE = 0,
|
||||||
|
PRESENT_CONT = 1,
|
||||||
|
PRESENT_MOUSE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,6 +126,15 @@ data.
|
||||||
*/
|
*/
|
||||||
EXPORT void CALL ReadController(int Control, uint8_t * Command);
|
EXPORT void CALL ReadController(int Control, uint8_t * Command);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: EmulationPaused
|
||||||
|
Purpose: This function is called when the emulation is paused. (from the
|
||||||
|
emulation thread)
|
||||||
|
Input: None
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
EXPORT void CALL EmulationPaused(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: WM_KeyDown
|
Function: WM_KeyDown
|
||||||
Purpose: To pass the WM_KeyDown message from the emulator to the
|
Purpose: To pass the WM_KeyDown message from the emulator to the
|
||||||
|
@ -137,6 +153,15 @@ Output: None
|
||||||
*/
|
*/
|
||||||
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
|
EXPORT void CALL WM_KeyUp(uint32_t wParam, uint32_t lParam);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: WM_KillFocus
|
||||||
|
Purpose: To pass the WM_KILLFOCUS message from the emulator to the
|
||||||
|
plugin.
|
||||||
|
Input: wParam and lParam of the WM_KILLFOCUS message.
|
||||||
|
Output: None
|
||||||
|
*/
|
||||||
|
EXPORT void CALL WM_KillFocus(uint32_t wParam, uint32_t lParam);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <io.h>
|
|
||||||
#include "PluginList.h"
|
#include "PluginList.h"
|
||||||
#include <Project64-core/Plugins/PluginBase.h>
|
#include <Project64-core/Plugins/PluginBase.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
CPluginList::CPluginList(bool bAutoFill /* = true */) :
|
||||||
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
|
m_PluginDir(g_Settings->LoadStringVal(Directory_Plugin), "")
|
||||||
{
|
{
|
||||||
|
m_PluginDir.NormalizePath(CPath(CPath::MODULE_DIRECTORY));
|
||||||
if (bAutoFill)
|
if (bAutoFill)
|
||||||
{
|
{
|
||||||
LoadList();
|
LoadList();
|
||||||
|
@ -18,7 +20,7 @@ CPluginList::~CPluginList()
|
||||||
|
|
||||||
int CPluginList::GetPluginCount() const
|
int CPluginList::GetPluginCount() const
|
||||||
{
|
{
|
||||||
return m_PluginList.size();
|
return (int)((INT_PTR)m_PluginList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
|
const CPluginList::PLUGIN * CPluginList::GetPluginInfo(int indx) const
|
||||||
|
@ -83,7 +85,7 @@ void CPluginList::AddPluginFromDir(CPath Dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
PLUGIN Plugin = {0};
|
PLUGIN Plugin = {0};
|
||||||
Plugin.Info.MemoryBswaped = true;
|
Plugin.Info.Reserved2 = true;
|
||||||
GetDllInfo(&Plugin.Info);
|
GetDllInfo(&Plugin.Info);
|
||||||
if (!CPlugin::ValidPluginVersion(Plugin.Info))
|
if (!CPlugin::ValidPluginVersion(Plugin.Info))
|
||||||
{
|
{
|
||||||
|
|
|
@ -468,7 +468,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
|
||||||
break;
|
break;
|
||||||
case ID_OPTIONS_CONFIG_GFX:
|
case ID_OPTIONS_CONFIG_GFX:
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_GFX");
|
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_GFX");
|
||||||
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_GFX);
|
g_Plugins->ConfigPlugin(hWnd, PLUGIN_TYPE_VIDEO);
|
||||||
break;
|
break;
|
||||||
case ID_OPTIONS_CONFIG_AUDIO:
|
case ID_OPTIONS_CONFIG_AUDIO:
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_AUDIO");
|
WriteTrace(TraceUserInterface, TraceDebug, "ID_OPTIONS_CONFIG_AUDIO");
|
||||||
|
|
|
@ -822,12 +822,20 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this->m_bMainWindow && bCPURunning() && bAutoSleep())
|
if (_this->m_bMainWindow && bCPURunning())
|
||||||
{
|
{
|
||||||
if (g_BaseSystem)
|
if (g_BaseSystem)
|
||||||
|
{
|
||||||
|
if (bAutoSleep())
|
||||||
{
|
{
|
||||||
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_AppLostFocus);
|
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_AppLostFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_Plugins && g_Plugins->Control()->WM_KillFocus)
|
||||||
|
{
|
||||||
|
g_Plugins->Control()->WM_KillFocus((uint32_t)((UINT_PTR)wParam), (uint32_t)((UINT_PTR)lParam));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -29,7 +29,7 @@ CGamePluginPage::CGamePluginPage(HWND hParent, const RECT & rcDispay)
|
||||||
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
|
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
|
||||||
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
|
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
|
||||||
|
|
||||||
AddPlugins(GFX_LIST, Game_EditPlugin_Gfx, PLUGIN_TYPE_GFX);
|
AddPlugins(GFX_LIST, Game_EditPlugin_Gfx, PLUGIN_TYPE_VIDEO);
|
||||||
AddPlugins(AUDIO_LIST, Game_EditPlugin_Audio, PLUGIN_TYPE_AUDIO);
|
AddPlugins(AUDIO_LIST, Game_EditPlugin_Audio, PLUGIN_TYPE_AUDIO);
|
||||||
AddPlugins(CONT_LIST, Game_EditPlugin_Contr, PLUGIN_TYPE_CONTROLLER);
|
AddPlugins(CONT_LIST, Game_EditPlugin_Contr, PLUGIN_TYPE_CONTROLLER);
|
||||||
AddPlugins(RSP_LIST, Game_EditPlugin_RSP, PLUGIN_TYPE_RSP);
|
AddPlugins(RSP_LIST, Game_EditPlugin_RSP, PLUGIN_TYPE_RSP);
|
||||||
|
|
|
@ -28,7 +28,7 @@ COptionPluginPage::COptionPluginPage(HWND hParent, const RECT & rcDispay)
|
||||||
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
|
m_ControlGroup.Attach(GetDlgItem(IDC_CONT_NAME));
|
||||||
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
|
m_RspGroup.Attach(GetDlgItem(IDC_RSP_NAME));
|
||||||
|
|
||||||
AddPlugins(GFX_LIST, Plugin_GFX_Current, PLUGIN_TYPE_GFX);
|
AddPlugins(GFX_LIST, Plugin_GFX_Current, PLUGIN_TYPE_VIDEO);
|
||||||
AddPlugins(AUDIO_LIST, Plugin_AUDIO_Current, PLUGIN_TYPE_AUDIO);
|
AddPlugins(AUDIO_LIST, Plugin_AUDIO_Current, PLUGIN_TYPE_AUDIO);
|
||||||
AddPlugins(CONT_LIST, Plugin_CONT_Current, PLUGIN_TYPE_CONTROLLER);
|
AddPlugins(CONT_LIST, Plugin_CONT_Current, PLUGIN_TYPE_CONTROLLER);
|
||||||
AddPlugins(RSP_LIST, Plugin_RSP_Current, PLUGIN_TYPE_RSP);
|
AddPlugins(RSP_LIST, Plugin_RSP_Current, PLUGIN_TYPE_RSP);
|
||||||
|
|
Loading…
Reference in New Issue