Bug fixes
This commit is contained in:
parent
caf7927445
commit
66b83d98e4
|
@ -1 +1 @@
|
||||||
Subproject commit d14a926d3221b5ae3782bb7d60b2ab8696978682
|
Subproject commit 02353e8aa552f3db60804626e29838406f206443
|
|
@ -78,7 +78,6 @@ LRESULT CALLBACK ButtonDukeSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
|
||||||
Button *button = reinterpret_cast<Button *>(dwRefData);
|
Button *button = reinterpret_cast<Button *>(dwRefData);
|
||||||
if (wParam & MK_SHIFT) {
|
if (wParam & MK_SHIFT) {
|
||||||
static_cast<DukeInputWindow *>(button->GetWnd())->SwapMoCursorAxis(button);
|
static_cast<DukeInputWindow *>(button->GetWnd())->SwapMoCursorAxis(button);
|
||||||
static_cast<DukeInputWindow *>(button->GetWnd())->UpdateProfile(std::string(), BUTTON_SWAP);
|
|
||||||
}
|
}
|
||||||
else if (!(wParam & ~MK_RBUTTON)) {
|
else if (!(wParam & ~MK_RBUTTON)) {
|
||||||
button->ClearText();
|
button->ClearText();
|
||||||
|
@ -109,7 +108,6 @@ LRESULT CALLBACK ButtonSbcSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
||||||
Button *button = reinterpret_cast<Button *>(dwRefData);
|
Button *button = reinterpret_cast<Button *>(dwRefData);
|
||||||
if (wParam & MK_SHIFT) {
|
if (wParam & MK_SHIFT) {
|
||||||
static_cast<SbcInputWindow *>(button->GetWnd())->SwapMoCursorAxis(button);
|
static_cast<SbcInputWindow *>(button->GetWnd())->SwapMoCursorAxis(button);
|
||||||
static_cast<SbcInputWindow *>(button->GetWnd())->UpdateProfile(std::string(), BUTTON_SWAP);
|
|
||||||
}
|
}
|
||||||
else if (!(wParam & ~MK_RBUTTON)) {
|
else if (!(wParam & ~MK_RBUTTON)) {
|
||||||
button->ClearText();
|
button->ClearText();
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include <core\kernel\exports\xboxkrnl.h> // For PKINTERRUPT, etc.
|
#include <core\kernel\exports\xboxkrnl.h> // For PKINTERRUPT, etc.
|
||||||
#include "D3dx9math.h" // For the matrix math functions
|
|
||||||
#include "SdlJoystick.h"
|
#include "SdlJoystick.h"
|
||||||
#include "XInputPad.h"
|
#include "XInputPad.h"
|
||||||
#include "RawDevice.h"
|
#include "RawDevice.h"
|
||||||
|
@ -515,9 +514,6 @@ bool InputDeviceManager::UpdateInputLightgun(std::shared_ptr<InputDevice> &Devic
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
g_devs[Port_num].info.ligthgun.laser ^= 1;
|
g_devs[Port_num].info.ligthgun.laser ^= 1;
|
||||||
if (g_devs[Port_num].info.ligthgun.laser) {
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,13 +581,17 @@ bool InputDeviceManager::UpdateInputLightgun(std::shared_ptr<InputDevice> &Devic
|
||||||
ControlState state = state_plus ? state_plus * 0x7FFF : state_minus ? -state_minus * 0x8000 : 0.0;
|
ControlState state = state_plus ? state_plus * 0x7FFF : state_minus ? -state_minus * 0x8000 : 0.0;
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 10:
|
case 10: {
|
||||||
in_buf->sThumbLX = static_cast<int16_t>(state) + g_devs[Port_num].info.ligthgun.offset_x;
|
xbox::short_xt offset = std::abs(state) > 16383.0 ? g_devs[Port_num].info.ligthgun.offset_upp_x : g_devs[Port_num].info.ligthgun.offset_x;
|
||||||
break;
|
in_buf->sThumbLX = static_cast<int16_t>(state) + offset;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 12:
|
case 12: {
|
||||||
in_buf->sThumbLY = static_cast<int16_t>(state) + g_devs[Port_num].info.ligthgun.offset_y;
|
xbox::short_xt offset = std::abs(state) > 16383.0 ? g_devs[Port_num].info.ligthgun.offset_upp_y : g_devs[Port_num].info.ligthgun.offset_y;
|
||||||
break;
|
in_buf->sThumbLY = static_cast<int16_t>(state) + offset;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -907,41 +907,25 @@ ImVec2 InputDeviceManager::CalcLaserPos(int port)
|
||||||
|
|
||||||
// If somebody else is currently holding the lock, we won't wait and instead we report the last known laser position
|
// If somebody else is currently holding the lock, we won't wait and instead we report the last known laser position
|
||||||
if (m_Mtx.try_lock()) {
|
if (m_Mtx.try_lock()) {
|
||||||
static D3DXVECTOR4 coeff_vec;
|
|
||||||
|
|
||||||
// If the rendering window was not resized, we can skip calculating the conversion matrix
|
// NOTE: even when switching to faux fullscreen, imgui will still use the original window size. Because of this, we only need to do this once.
|
||||||
if (g_bRenderWindowResized) {
|
// If in the future the above is fixed, then this code will have to recalculate the new window size after a resizing has occured.
|
||||||
g_bRenderWindowResized = false;
|
static long width, height = -1;
|
||||||
|
if (height == -1) {
|
||||||
|
|
||||||
// We convert the laser input coordinates given by xinput (in the sThumbLXY members of XpadInput) with the procedure described in the link below
|
|
||||||
// https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/samples/jj635757(v=vs.85)?redirectedfrom=MSDN
|
|
||||||
// NOTE: the d3d math functions work even when d3d was not intialized, which happens when running with LLE GPU turned on
|
|
||||||
/*
|
|
||||||
xinput -> screen
|
|
||||||
v = M^-1 * u
|
|
||||||
width 0 0 1 0 a
|
|
||||||
height = 0 0 0 1 * b
|
|
||||||
0 -32768 32767 1 0 c
|
|
||||||
0 -32767 -32768 0 1 d
|
|
||||||
*/
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetClientRect(m_hwnd, &rect);
|
GetClientRect(m_hwnd, &rect);
|
||||||
const auto width = std::max(rect.right - rect.left, 1l);
|
width = std::max(rect.right - rect.left, 1l);
|
||||||
const auto height = std::max(rect.bottom - rect.top, 1l);
|
height = std::max(rect.bottom - rect.top, 1l);
|
||||||
D3DXMATRIX inverted_mtx, transposed_mtx;
|
|
||||||
D3DXMATRIX src_mtx(0, 0, 1, 0, 0, 0, 0, 1, -32768, 32767, 1, 0, -32767, -32768, 0, 1);
|
|
||||||
D3DXVECTOR4 screen_vec(width, height, 0, 0);
|
|
||||||
D3DXMatrixInverse(&inverted_mtx, nullptr, &src_mtx);
|
|
||||||
D3DXMatrixTranspose(&transposed_mtx, &inverted_mtx);
|
|
||||||
D3DXVec4Transform(&coeff_vec, &screen_vec, &transposed_mtx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// x' = ax + by + c
|
// We convert the laser input coordinates given by xinput (in the sThumbLXY members of XpadInput) with linear interpolation y = y0 + (x - x0) * (y1 - y0) / (x1 - x0)
|
||||||
// y' = bx - ay + d
|
// For laser_x x0 = -32768; x1 = 32767; y0 = 0; y1 = width
|
||||||
|
// For laser_y x0 = -32768; x1 = 32767; y0 = height; y1 = 0
|
||||||
int16_t laser_x = g_devs[port].info.buff.ctrl.InBuffer.sThumbLX;
|
int16_t laser_x = g_devs[port].info.buff.ctrl.InBuffer.sThumbLX;
|
||||||
int16_t laser_y = g_devs[port].info.buff.ctrl.InBuffer.sThumbLY;
|
int16_t laser_y = g_devs[port].info.buff.ctrl.InBuffer.sThumbLY;
|
||||||
laser_coord[port].x = coeff_vec.x * laser_x + coeff_vec.y * laser_y + coeff_vec.z;
|
laser_coord[port].x = ((laser_x + 32768) * width) / 65535.0f;
|
||||||
laser_coord[port].y = coeff_vec.y * laser_x - coeff_vec.x * laser_y + coeff_vec.w;
|
laser_coord[port].y = height - ((laser_y + 32768) * height) / 65535.0f;
|
||||||
|
|
||||||
m_Mtx.unlock();
|
m_Mtx.unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,8 @@ struct XidSBCOutput {
|
||||||
struct LightGunData {
|
struct LightGunData {
|
||||||
xbox::short_xt offset_x;
|
xbox::short_xt offset_x;
|
||||||
xbox::short_xt offset_y;
|
xbox::short_xt offset_y;
|
||||||
|
xbox::short_xt offset_upp_x;
|
||||||
|
xbox::short_xt offset_upp_y;
|
||||||
uint8_t last_in_state;
|
uint8_t last_in_state;
|
||||||
uint8_t last_turbo;
|
uint8_t last_turbo;
|
||||||
uint8_t turbo_delay;
|
uint8_t turbo_delay;
|
||||||
|
|
|
@ -166,7 +166,7 @@ int InputWindow::EnableDefaultButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputWindow::BindButton(int ControlID)
|
void InputWindow::BindButton(int ControlID, bool auto_swap)
|
||||||
{
|
{
|
||||||
// Check if binding thread is still active
|
// Check if binding thread is still active
|
||||||
// testcase: spacebar and enter keys; without this fix will cause repeat binding result.
|
// testcase: spacebar and enter keys; without this fix will cause repeat binding result.
|
||||||
|
@ -179,7 +179,7 @@ void InputWindow::BindButton(int ControlID)
|
||||||
m_bIsBinding = true;
|
m_bIsBinding = true;
|
||||||
|
|
||||||
// Don't block the message processing loop
|
// Don't block the message processing loop
|
||||||
std::thread([this, dev, ControlID]() {
|
std::thread([this, dev, ControlID, auto_swap]() {
|
||||||
EnableWindow(m_hwnd_window, FALSE);
|
EnableWindow(m_hwnd_window, FALSE);
|
||||||
char current_text[HOST_BUTTON_NAME_LENGTH];
|
char current_text[HOST_BUTTON_NAME_LENGTH];
|
||||||
Button* xbox_button = m_DeviceConfig->FindButtonById(ControlID);
|
Button* xbox_button = m_DeviceConfig->FindButtonById(ControlID);
|
||||||
|
@ -189,6 +189,9 @@ void InputWindow::BindButton(int ControlID)
|
||||||
InputDevice::Input* dev_button = fut.get();
|
InputDevice::Input* dev_button = fut.get();
|
||||||
if (dev_button) {
|
if (dev_button) {
|
||||||
xbox_button->UpdateText(dev_button->GetName().c_str());
|
xbox_button->UpdateText(dev_button->GetName().c_str());
|
||||||
|
if (auto_swap) {
|
||||||
|
SwapMoCursorAxis(xbox_button);
|
||||||
|
}
|
||||||
m_bHasChanges = true;
|
m_bHasChanges = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -217,7 +220,6 @@ void InputWindow::UpdateProfile(const std::string &name, int command)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_CLEAR:
|
case BUTTON_CLEAR:
|
||||||
case BUTTON_SWAP:
|
|
||||||
m_bHasChanges = true;
|
m_bHasChanges = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -364,6 +366,7 @@ void InputWindow::SwapMoCursorAxis(Button *button)
|
||||||
else {
|
else {
|
||||||
button->UpdateText("Cursor X-");
|
button->UpdateText("Cursor X-");
|
||||||
}
|
}
|
||||||
|
m_bHasChanges = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
|
@ -373,6 +376,7 @@ void InputWindow::SwapMoCursorAxis(Button *button)
|
||||||
else {
|
else {
|
||||||
button->UpdateText("Cursor Y+");
|
button->UpdateText("Cursor Y+");
|
||||||
}
|
}
|
||||||
|
m_bHasChanges = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -390,6 +394,7 @@ void InputWindow::SwapMoCursorAxis(Button *button)
|
||||||
else {
|
else {
|
||||||
button->UpdateText("Axis X-");
|
button->UpdateText("Axis X-");
|
||||||
}
|
}
|
||||||
|
m_bHasChanges = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
|
@ -399,6 +404,7 @@ void InputWindow::SwapMoCursorAxis(Button *button)
|
||||||
else {
|
else {
|
||||||
button->UpdateText("Axis Y+");
|
button->UpdateText("Axis Y+");
|
||||||
}
|
}
|
||||||
|
m_bHasChanges = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#define RUMBLE_TEST 6
|
#define RUMBLE_TEST 6
|
||||||
#define RUMBLE_CLEAR 7
|
#define RUMBLE_CLEAR 7
|
||||||
#define BUTTON_CLEAR 8
|
#define BUTTON_CLEAR 8
|
||||||
#define BUTTON_SWAP 9
|
|
||||||
|
|
||||||
#define XINPUT_DEFAULT 0
|
#define XINPUT_DEFAULT 0
|
||||||
#define DINPUT_DEFAULT 1
|
#define DINPUT_DEFAULT 1
|
||||||
|
@ -56,7 +55,7 @@ public:
|
||||||
virtual void Initialize(HWND hwnd, int port_num, int dev_type) = 0;
|
virtual void Initialize(HWND hwnd, int port_num, int dev_type) = 0;
|
||||||
~InputWindow();
|
~InputWindow();
|
||||||
virtual void UpdateDeviceList();
|
virtual void UpdateDeviceList();
|
||||||
virtual void BindButton(int ControlID);
|
void BindButton(int ControlID, bool auto_swap = false);
|
||||||
virtual void ClearBindings() = 0;
|
virtual void ClearBindings() = 0;
|
||||||
virtual void UpdateProfile(const std::string& name, int command);
|
virtual void UpdateProfile(const std::string& name, int command);
|
||||||
void UpdateCurrentDevice();
|
void UpdateCurrentDevice();
|
||||||
|
@ -162,6 +161,5 @@ public:
|
||||||
void Initialize(HWND hwnd, int port_num, int dev_type) override;
|
void Initialize(HWND hwnd, int port_num, int dev_type) override;
|
||||||
~LightgunInputWindow();
|
~LightgunInputWindow();
|
||||||
void BindDefault();
|
void BindDefault();
|
||||||
void BindButton(int ControlID) override;
|
|
||||||
void ClearBindings() override;
|
void ClearBindings() override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -152,6 +152,7 @@ EmuShared::EmuShared()
|
||||||
m_bEmulating_status = false;
|
m_bEmulating_status = false;
|
||||||
m_bFirstLaunch = false;
|
m_bFirstLaunch = false;
|
||||||
m_bClipCursor = false;
|
m_bClipCursor = false;
|
||||||
|
m_LightgunLaser = 1; // laser on by default
|
||||||
|
|
||||||
std::memset(m_DeviceControlNames, '\0', sizeof(m_DeviceControlNames));
|
std::memset(m_DeviceControlNames, '\0', sizeof(m_DeviceControlNames));
|
||||||
std::memset(m_DeviceName, '\0', sizeof(m_DeviceName));
|
std::memset(m_DeviceName, '\0', sizeof(m_DeviceName));
|
||||||
|
|
|
@ -257,6 +257,12 @@ class EmuShared : public Mutex
|
||||||
void GetClipCursorFlag(bool *value) { Lock(); *value = m_bClipCursor; Unlock(); }
|
void GetClipCursorFlag(bool *value) { Lock(); *value = m_bClipCursor; Unlock(); }
|
||||||
void SetClipCursorFlag(const bool value) { Lock(); m_bClipCursor = value; Unlock(); }
|
void SetClipCursorFlag(const bool value) { Lock(); m_bClipCursor = value; Unlock(); }
|
||||||
|
|
||||||
|
// ******************************************************************
|
||||||
|
// * LightgunLaser flag Accessors
|
||||||
|
// ******************************************************************
|
||||||
|
void GetLightgunLaser(uint8_t *value) { Lock(); *value = m_LightgunLaser; Unlock(); }
|
||||||
|
void SetLightgunLaser(const uint8_t *value) { Lock(); m_LightgunLaser = *value; Unlock(); }
|
||||||
|
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
// * ImGui Accessors
|
// * ImGui Accessors
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
@ -364,6 +370,7 @@ class EmuShared : public Mutex
|
||||||
#else
|
#else
|
||||||
unsigned int m_Reserved;
|
unsigned int m_Reserved;
|
||||||
#endif
|
#endif
|
||||||
|
uint8_t m_LightgunLaser;
|
||||||
bool m_bFirstLaunch;
|
bool m_bFirstLaunch;
|
||||||
bool m_bClipCursor;
|
bool m_bClipCursor;
|
||||||
unsigned int m_dwKrnlProcID; // Only used for kernel mode level.
|
unsigned int m_dwKrnlProcID; // Only used for kernel mode level.
|
||||||
|
|
|
@ -22,7 +22,7 @@ const ImColor ImGuiUI::m_laser_col[4] = {
|
||||||
ImColor(ImVec4(1.0f, 1.0f, 0.0f, 1.0f)) // ply4: yellow
|
ImColor(ImVec4(1.0f, 1.0f, 0.0f, 1.0f)) // ply4: yellow
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ImGuiUI::Initialize(int backbuffer_scale)
|
bool ImGuiUI::Initialize()
|
||||||
{
|
{
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
m_imgui_context = ImGui::CreateContext();
|
m_imgui_context = ImGui::CreateContext();
|
||||||
|
@ -55,7 +55,6 @@ bool ImGuiUI::Initialize(int backbuffer_scale)
|
||||||
|
|
||||||
// Internal initialize (when necessary, move into its own function.)
|
// Internal initialize (when necessary, move into its own function.)
|
||||||
fps_counter = 30.0f;
|
fps_counter = 30.0f;
|
||||||
m_backbuffer_scale = backbuffer_scale;
|
|
||||||
|
|
||||||
// Miscs
|
// Miscs
|
||||||
m_audio.Initialize();
|
m_audio.Initialize();
|
||||||
|
@ -203,7 +202,7 @@ void ImGuiUI::DrawLightgunLaser(int port)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Laser", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoDecoration);
|
ImGui::Begin("Laser", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoDecoration);
|
||||||
|
|
||||||
ImGui::GetForegroundDrawList()->AddCircleFilled(g_InputDeviceManager.CalcLaserPos(port), 10 * m_backbuffer_scale, m_laser_col[port], 32);
|
ImGui::GetForegroundDrawList()->AddCircleFilled(g_InputDeviceManager.CalcLaserPos(port), 5, m_laser_col[port], 0);
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool Initialize(int backbuffer_scale);
|
bool Initialize();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
template<class C, class T>
|
template<class C, class T>
|
||||||
|
@ -62,7 +62,6 @@ protected:
|
||||||
overlay_settings m_settings;
|
overlay_settings m_settings;
|
||||||
unsigned int m_lle_flags;
|
unsigned int m_lle_flags;
|
||||||
float fps_counter;
|
float fps_counter;
|
||||||
int m_backbuffer_scale;
|
|
||||||
static const ImColor m_laser_col[4];
|
static const ImColor m_laser_col[4];
|
||||||
// Make them as settings storage.
|
// Make them as settings storage.
|
||||||
/*bool m_show_fps;
|
/*bool m_show_fps;
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
std::unique_ptr<RenderBase> g_renderbase;
|
std::unique_ptr<RenderBase> g_renderbase;
|
||||||
|
|
||||||
bool RenderBase::Initialize(int backbuffer_scale)
|
bool RenderBase::Initialize()
|
||||||
{
|
{
|
||||||
if (!ImGuiUI::Initialize(backbuffer_scale)) {
|
if (!ImGuiUI::Initialize()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
RenderBase() = default;
|
RenderBase() = default;
|
||||||
virtual ~RenderBase() = default;
|
virtual ~RenderBase() = default;
|
||||||
|
|
||||||
virtual bool Initialize(int backbuffer_scale);
|
virtual bool Initialize();
|
||||||
virtual void Shutdown();
|
virtual void Shutdown();
|
||||||
|
|
||||||
template<class C, class T>
|
template<class C, class T>
|
||||||
|
|
|
@ -87,7 +87,6 @@ using namespace std::literals::chrono_literals;
|
||||||
|
|
||||||
// Global(s)
|
// Global(s)
|
||||||
HWND g_hEmuWindow = NULL; // rendering window
|
HWND g_hEmuWindow = NULL; // rendering window
|
||||||
bool g_bRenderWindowResized = true; // indicates that the rendering window has had its size changed
|
|
||||||
bool g_bClipCursor = false; // indicates that the mouse cursor should be confined inside the rendering window
|
bool g_bClipCursor = false; // indicates that the mouse cursor should be confined inside the rendering window
|
||||||
IDirect3DDevice9Ex *g_pD3DDevice = nullptr; // Direct3D Device
|
IDirect3DDevice9Ex *g_pD3DDevice = nullptr; // Direct3D Device
|
||||||
|
|
||||||
|
@ -669,7 +668,7 @@ void CxbxInitWindow(bool bFullInit)
|
||||||
|
|
||||||
SetFocus(g_hEmuWindow);
|
SetFocus(g_hEmuWindow);
|
||||||
g_renderbase = std::unique_ptr<RenderBase>(new RenderBase());
|
g_renderbase = std::unique_ptr<RenderBase>(new RenderBase());
|
||||||
g_renderbase->Initialize(g_RenderUpscaleFactor);
|
g_renderbase->Initialize();
|
||||||
|
|
||||||
ImGui_ImplWin32_Init(g_hEmuWindow);
|
ImGui_ImplWin32_Init(g_hEmuWindow);
|
||||||
g_renderbase->SetWindowRelease([] {
|
g_renderbase->SetWindowRelease([] {
|
||||||
|
@ -2038,7 +2037,6 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
g_bRenderWindowResized = true;
|
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
case SIZE_RESTORED:
|
case SIZE_RESTORED:
|
||||||
|
|
|
@ -59,7 +59,7 @@ std::atomic<bool> g_bIsDevicesEmulating = false;
|
||||||
std::atomic<bool> g_bXppGuard = false;
|
std::atomic<bool> g_bXppGuard = false;
|
||||||
|
|
||||||
// Allocate enough memory for the max number of devices we can support simultaneously
|
// Allocate enough memory for the max number of devices we can support simultaneously
|
||||||
// 4 duke / S / sbc / arcade joystick (mutually exclusive) + 8 memory units
|
// 4 duke / S / sbc / arcade joystick / lightgun (mutually exclusive) + 8 memory units
|
||||||
DeviceState g_devs[MAX_DEVS];
|
DeviceState g_devs[MAX_DEVS];
|
||||||
|
|
||||||
xbox::ulong_xt g_Mounted_MUs = 0;
|
xbox::ulong_xt g_Mounted_MUs = 0;
|
||||||
|
@ -264,10 +264,11 @@ void ConstructHleInputDevice(DeviceState *dev, DeviceState *upstream, int type,
|
||||||
dev->info.ucSubType = XINPUT_DEVSUBTYPE_GC_LIGHTGUN;
|
dev->info.ucSubType = XINPUT_DEVSUBTYPE_GC_LIGHTGUN;
|
||||||
dev->info.ucInputStateSize = sizeof(XpadInput);
|
dev->info.ucInputStateSize = sizeof(XpadInput);
|
||||||
dev->info.ucFeedbackSize = sizeof(XpadOutput);
|
dev->info.ucFeedbackSize = sizeof(XpadOutput);
|
||||||
dev->info.ligthgun.offset_x = dev->info.ligthgun.offset_x = 0;
|
dev->info.ligthgun.offset_x = dev->info.ligthgun.offset_y = 0;
|
||||||
|
dev->info.ligthgun.offset_upp_x = dev->info.ligthgun.offset_upp_x = 0;
|
||||||
dev->info.ligthgun.last_in_state = dev->info.ligthgun.turbo_delay = 0;
|
dev->info.ligthgun.last_in_state = dev->info.ligthgun.turbo_delay = 0;
|
||||||
dev->info.ligthgun.turbo = dev->info.ligthgun.last_turbo = 0;
|
dev->info.ligthgun.turbo = dev->info.ligthgun.last_turbo = 0;
|
||||||
dev->info.ligthgun.laser = 1; // laser on by default
|
g_EmuShared->GetLightgunLaser(&dev->info.ligthgun.laser);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case to_underlying(XBOX_INPUT_DEVICE::STEEL_BATTALION_CONTROLLER):
|
case to_underlying(XBOX_INPUT_DEVICE::STEEL_BATTALION_CONTROLLER):
|
||||||
|
@ -871,6 +872,8 @@ xbox::dword_xt WINAPI xbox::EMUPATCH(XInputSetLightgunCalibration)
|
||||||
if (g_devs[port].type == XBOX_INPUT_DEVICE::LIGHTGUN) {
|
if (g_devs[port].type == XBOX_INPUT_DEVICE::LIGHTGUN) {
|
||||||
g_devs[port].info.ligthgun.offset_x = pCalibrationOffsets->wCenterX;
|
g_devs[port].info.ligthgun.offset_x = pCalibrationOffsets->wCenterX;
|
||||||
g_devs[port].info.ligthgun.offset_y = pCalibrationOffsets->wCenterY;
|
g_devs[port].info.ligthgun.offset_y = pCalibrationOffsets->wCenterY;
|
||||||
|
g_devs[port].info.ligthgun.offset_upp_x = pCalibrationOffsets->wUpperLeftX;
|
||||||
|
g_devs[port].info.ligthgun.offset_upp_y = pCalibrationOffsets->wUpperLeftY;
|
||||||
ret = ERROR_SUCCESS;
|
ret = ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -276,9 +276,9 @@ XINPUT_FEEDBACK, *PXINPUT_FEEDBACK;
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
typedef struct _XINPUT_DEVICE_DESCRIPTION
|
typedef struct _XINPUT_DEVICE_DESCRIPTION
|
||||||
{
|
{
|
||||||
WORD wVendorID;
|
xbox::ushort_xt wVendorID;
|
||||||
WORD wProductID;
|
xbox::ushort_xt wProductID;
|
||||||
WORD wVersion;
|
xbox::ushort_xt wVersion;
|
||||||
}
|
}
|
||||||
XINPUT_DEVICE_DESCRIPTION, *PXINPUT_DEVICE_DESCRIPTION;
|
XINPUT_DEVICE_DESCRIPTION, *PXINPUT_DEVICE_DESCRIPTION;
|
||||||
|
|
||||||
|
@ -287,10 +287,10 @@ XINPUT_DEVICE_DESCRIPTION, *PXINPUT_DEVICE_DESCRIPTION;
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
typedef struct _XINPUT_LIGHTGUN_CALIBRATION_OFFSETS
|
typedef struct _XINPUT_LIGHTGUN_CALIBRATION_OFFSETS
|
||||||
{
|
{
|
||||||
WORD wCenterX;
|
xbox::short_xt wCenterX;
|
||||||
WORD wCenterY;
|
xbox::short_xt wCenterY;
|
||||||
WORD wUpperLeftX;
|
xbox::short_xt wUpperLeftX;
|
||||||
WORD wUpperLeftY;
|
xbox::short_xt wUpperLeftY;
|
||||||
}
|
}
|
||||||
XINPUT_LIGHTGUN_CALIBRATION_OFFSETS, *PXINPUT_LIGHTGUN_CALIBRATION_OFFSETS;
|
XINPUT_LIGHTGUN_CALIBRATION_OFFSETS, *PXINPUT_LIGHTGUN_CALIBRATION_OFFSETS;
|
||||||
|
|
||||||
|
|
|
@ -535,6 +535,8 @@ XBSYSAPI EXPORTNUM(49) xbox::void_xt DECLSPEC_NORETURN NTAPI xbox::HalReturnToFi
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save lightgun laser status
|
||||||
|
g_EmuShared->SetLightgunLaser(&g_devs->info.ligthgun.laser);
|
||||||
|
|
||||||
std::string TitlePath = xbox::LaunchDataPage->Header.szLaunchPath;
|
std::string TitlePath = xbox::LaunchDataPage->Header.szLaunchPath;
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,6 @@ bool CxbxIsElevated();
|
||||||
/*! kernel thunk table */
|
/*! kernel thunk table */
|
||||||
extern uint32_t CxbxKrnl_KernelThunkTable[379];
|
extern uint32_t CxbxKrnl_KernelThunkTable[379];
|
||||||
|
|
||||||
extern bool g_bRenderWindowResized;
|
|
||||||
extern bool g_bClipCursor;
|
extern bool g_bClipCursor;
|
||||||
extern bool g_CxbxPrintUEM;
|
extern bool g_CxbxPrintUEM;
|
||||||
extern ULONG g_CxbxFatalErrorCode;
|
extern ULONG g_CxbxFatalErrorCode;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
// ******************************************************************
|
// ******************************************************************
|
||||||
|
|
||||||
#define LOG_PREFIX CXBXR_MODULE::GUI
|
#define LOG_PREFIX CXBXR_MODULE::GUI
|
||||||
#define AUTORELOAD_DELAY 5000
|
|
||||||
|
|
||||||
#include "Windows.h"
|
#include "Windows.h"
|
||||||
#include "gui\resource\ResCxbx.h"
|
#include "gui\resource\ResCxbx.h"
|
||||||
|
@ -105,12 +104,6 @@ void LightgunInputWindow::BindDefault()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightgunInputWindow::BindButton(int ControlID)
|
|
||||||
{
|
|
||||||
InputWindow::BindButton(ControlID);
|
|
||||||
SwapMoCursorAxis(m_DeviceConfig->FindButtonById(ControlID));
|
|
||||||
}
|
|
||||||
|
|
||||||
INT_PTR CALLBACK DlgLightgunConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK DlgLightgunConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
|
@ -217,7 +210,7 @@ INT_PTR CALLBACK DlgLightgunConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, L
|
||||||
case IDC_TURBO_RIGHT:
|
case IDC_TURBO_RIGHT:
|
||||||
case IDC_LASER: {
|
case IDC_LASER: {
|
||||||
if (HIWORD(wParam) == BN_CLICKED) {
|
if (HIWORD(wParam) == BN_CLICKED) {
|
||||||
g_InputWindow->BindButton(LOWORD(wParam));
|
g_InputWindow->BindButton(LOWORD(wParam), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -251,12 +251,12 @@ BEGIN
|
||||||
PUSHBUTTON "Default Bindings",IDC_DEFAULT,362,200,69,14,BS_FLAT
|
PUSHBUTTON "Default Bindings",IDC_DEFAULT,362,200,69,14,BS_FLAT
|
||||||
PUSHBUTTON "Clear",IDC_CLEAR,443,200,50,14,BS_FLAT
|
PUSHBUTTON "Clear",IDC_CLEAR,443,200,50,14,BS_FLAT
|
||||||
GROUPBOX "Turbo switch",IDC_POWER_SWITCH,396,66,121,52,WS_GROUP
|
GROUPBOX "Turbo switch",IDC_POWER_SWITCH,396,66,121,52,WS_GROUP
|
||||||
PUSHBUTTON "",IDC_TURBO_LEFT,443,132,57,14,BS_FLAT
|
PUSHBUTTON "",IDC_TURBO_LEFT,443,76,57,14,BS_FLAT
|
||||||
PUSHBUTTON "",IDC_TURBO_RIGHT,443,94,57,14,BS_FLAT
|
PUSHBUTTON "",IDC_TURBO_RIGHT,443,94,57,14,BS_FLAT
|
||||||
LTEXT "Left",IDC_STATIC,412,76,20,14,SS_CENTERIMAGE
|
LTEXT "Left",IDC_STATIC,412,76,20,14,SS_CENTERIMAGE
|
||||||
LTEXT "Right",IDC_STATIC,412,94,20,14,SS_CENTERIMAGE
|
LTEXT "Right",IDC_STATIC,412,94,20,14,SS_CENTERIMAGE
|
||||||
GROUPBOX "Power switch",IDC_TURBO,396,121,121,66,WS_GROUP
|
GROUPBOX "Power switch",IDC_TURBO,396,121,121,66,WS_GROUP
|
||||||
PUSHBUTTON "",IDC_LASER,443,76,57,14,BS_FLAT
|
PUSHBUTTON "",IDC_LASER,443,132,57,14,BS_FLAT
|
||||||
LTEXT "Laser",IDC_STATIC,412,132,20,14,SS_CENTERIMAGE
|
LTEXT "Laser",IDC_STATIC,412,132,20,14,SS_CENTERIMAGE
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue