review remarks
This commit is contained in:
parent
66b83d98e4
commit
0b2c0a2e33
|
@ -152,7 +152,7 @@ EmuShared::EmuShared()
|
|||
m_bEmulating_status = false;
|
||||
m_bFirstLaunch = false;
|
||||
m_bClipCursor = false;
|
||||
m_LightgunLaser = 1; // laser on by default
|
||||
m_LightgunLaser = 0xF; // laser on by default on all ports
|
||||
|
||||
std::memset(m_DeviceControlNames, '\0', sizeof(m_DeviceControlNames));
|
||||
std::memset(m_DeviceName, '\0', sizeof(m_DeviceName));
|
||||
|
|
|
@ -260,8 +260,8 @@ class EmuShared : public Mutex
|
|||
// ******************************************************************
|
||||
// * LightgunLaser flag Accessors
|
||||
// ******************************************************************
|
||||
void GetLightgunLaser(uint8_t *value) { Lock(); *value = m_LightgunLaser; Unlock(); }
|
||||
void SetLightgunLaser(const uint8_t *value) { Lock(); m_LightgunLaser = *value; Unlock(); }
|
||||
void GetLightgunLaser(uint8_t *value, int port) { Lock(); *value = (m_LightgunLaser >> port) & 1; Unlock(); }
|
||||
void SetLightgunLaser(const uint8_t *value, int port) { Lock(); (m_LightgunLaser &= ~(1 << port)) |= ((*value) << port); Unlock(); }
|
||||
|
||||
// ******************************************************************
|
||||
// * ImGui Accessors
|
||||
|
|
|
@ -15,13 +15,6 @@
|
|||
|
||||
#include "core/kernel/init/CxbxKrnl.h"
|
||||
|
||||
const ImColor ImGuiUI::m_laser_col[4] = {
|
||||
ImColor(ImVec4(1.0f, 0.0f, 0.0f, 1.0f)), // ply1: red
|
||||
ImColor(ImVec4(0.0f, 1.0f, 0.0f, 1.0f)), // ply2: green
|
||||
ImColor(ImVec4(0.0f, 0.0f, 1.0f, 1.0f)), // ply3: blue
|
||||
ImColor(ImVec4(1.0f, 1.0f, 0.0f, 1.0f)) // ply4: yellow
|
||||
};
|
||||
|
||||
bool ImGuiUI::Initialize()
|
||||
{
|
||||
IMGUI_CHECKVERSION();
|
||||
|
@ -197,12 +190,3 @@ void ImGuiUI::DrawWidgets()
|
|||
|
||||
m_audio.DrawWidgets(m_is_focus, input_handler);
|
||||
}
|
||||
|
||||
void ImGuiUI::DrawLightgunLaser(int port)
|
||||
{
|
||||
ImGui::Begin("Laser", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoDecoration);
|
||||
|
||||
ImGui::GetForegroundDrawList()->AddCircleFilled(g_InputDeviceManager.CalcLaserPos(port), 5, m_laser_col[port], 0);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ public:
|
|||
|
||||
void DrawMenu();
|
||||
void DrawWidgets();
|
||||
void DrawLightgunLaser(int port);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -62,7 +61,6 @@ protected:
|
|||
overlay_settings m_settings;
|
||||
unsigned int m_lle_flags;
|
||||
float fps_counter;
|
||||
static const ImColor m_laser_col[4];
|
||||
// Make them as settings storage.
|
||||
/*bool m_show_fps;
|
||||
bool m_show_LLE_stats;
|
||||
|
|
|
@ -14,6 +14,13 @@
|
|||
#include "core/kernel/init/CxbxKrnl.h"
|
||||
#include "core/hle/D3D8/XbVertexBuffer.h"
|
||||
|
||||
const ImColor ImGuiVideo::m_laser_col[4] = {
|
||||
ImColor(ImVec4(1.0f, 0.0f, 0.0f, 1.0f)), // player1: red
|
||||
ImColor(ImVec4(0.0f, 1.0f, 0.0f, 1.0f)), // player2: green
|
||||
ImColor(ImVec4(0.0f, 0.0f, 1.0f, 1.0f)), // player3: blue
|
||||
ImColor(ImVec4(1.0f, 1.0f, 0.0f, 1.0f)) // player4: yellow
|
||||
};
|
||||
|
||||
bool ImGuiVideo::Initialize()
|
||||
{
|
||||
g_EmuShared->GetImGuiVideoWindows(&m_windows);
|
||||
|
@ -46,4 +53,13 @@ void ImGuiVideo::DrawWidgets(bool is_focus, ImGuiWindowFlags input_handler)
|
|||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
// Render the lightgun laser
|
||||
for (int port = PORT_1; port < XBOX_NUM_PORTS; ++port) {
|
||||
if (g_devs[port].type == XBOX_INPUT_DEVICE::LIGHTGUN && g_devs[port].info.ligthgun.laser) {
|
||||
ImGui::Begin("Laser", nullptr, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoDecoration);
|
||||
ImGui::GetForegroundDrawList()->AddCircleFilled(g_InputDeviceManager.CalcLaserPos(port), 5, m_laser_col[port], 0);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,5 @@ public:
|
|||
|
||||
protected:
|
||||
imgui_video_windows m_windows;
|
||||
static const ImColor m_laser_col[4];
|
||||
};
|
||||
|
|
|
@ -194,11 +194,6 @@ static void CxbxImGui_RenderD3D9(ImGuiUI* m_imgui, IDirect3DSurface9* renderTarg
|
|||
|
||||
m_imgui->DrawMenu();
|
||||
m_imgui->DrawWidgets();
|
||||
for (int port = PORT_1; port < XBOX_NUM_PORTS; ++port) {
|
||||
if (g_devs[port].type == XBOX_INPUT_DEVICE::LIGHTGUN && g_devs[port].info.ligthgun.laser) {
|
||||
m_imgui->DrawLightgunLaser(port);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndFrame();
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ void ConstructHleInputDevice(DeviceState *dev, DeviceState *upstream, int type,
|
|||
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.turbo = dev->info.ligthgun.last_turbo = 0;
|
||||
g_EmuShared->GetLightgunLaser(&dev->info.ligthgun.laser);
|
||||
g_EmuShared->GetLightgunLaser(&dev->info.ligthgun.laser, port_num);
|
||||
break;
|
||||
|
||||
case to_underlying(XBOX_INPUT_DEVICE::STEEL_BATTALION_CONTROLLER):
|
||||
|
|
|
@ -536,7 +536,11 @@ XBSYSAPI EXPORTNUM(49) xbox::void_xt DECLSPEC_NORETURN NTAPI xbox::HalReturnToFi
|
|||
}
|
||||
|
||||
// Save lightgun laser status
|
||||
g_EmuShared->SetLightgunLaser(&g_devs->info.ligthgun.laser);
|
||||
for (int port = PORT_1; port < XBOX_NUM_PORTS; ++port) {
|
||||
if (g_devs[port].type == XBOX_INPUT_DEVICE::LIGHTGUN) {
|
||||
g_EmuShared->SetLightgunLaser(&g_devs[port].info.ligthgun.laser, port);
|
||||
}
|
||||
}
|
||||
|
||||
std::string TitlePath = xbox::LaunchDataPage->Header.szLaunchPath;
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
// *
|
||||
// ******************************************************************
|
||||
|
||||
#include "common\input\InputManager.h"
|
||||
|
||||
// FIXME
|
||||
#define qemu_mutex_lock_iothread()
|
||||
#define qemu_mutex_unlock_iothread()
|
||||
|
@ -715,11 +713,6 @@ static void CxbxImGui_RenderOpenGL(ImGuiUI* m_imgui, std::nullptr_t unused)
|
|||
|
||||
m_imgui->DrawMenu();
|
||||
m_imgui->DrawWidgets();
|
||||
for (int port = PORT_1; port < XBOX_NUM_PORTS; ++port) {
|
||||
if (g_devs[port].type == XBOX_INPUT_DEVICE::LIGHTGUN && g_devs[port].info.ligthgun.laser) {
|
||||
m_imgui->DrawLightgunLaser(port);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
|
|
Loading…
Reference in New Issue