From 669cd24960ec388f11b6e56cde13c5478cbcc392 Mon Sep 17 00:00:00 2001 From: LapisRegia Date: Sat, 17 Feb 2024 17:34:45 +0800 Subject: [PATCH] Renamed GunListener to ScreenPositionListener --- Source/CMakeLists.txt | 2 +- Source/GunListener.h | 9 ------ Source/PS2VM.cpp | 12 +++---- Source/PS2VM.h | 12 +++---- Source/ScreenPositionListener.h | 9 ++++++ Source/iop/namco_sys246/Iop_NamcoSys246.cpp | 32 +++++++++---------- Source/iop/namco_sys246/Iop_NamcoSys246.h | 18 +++++------ Source/ui_qt/mainwindow.cpp | 2 +- Source/ui_shared/ArcadeDefinition.h | 2 +- Source/ui_shared/ArcadeUtils.cpp | 8 ++--- .../arcadedrivers/NamcoSys246Driver.cpp | 4 +-- arcadedefs/cobrata.arcadedef | 2 +- arcadedefs/idolm.arcadedef | 2 +- arcadedefs/idolmtower.arcadedef | 2 +- arcadedefs/timecrs3.arcadedef | 2 +- arcadedefs/timecrs3e.arcadedef | 2 +- arcadedefs/timecrs3u.arcadedef | 2 +- arcadedefs/timecrs4.arcadedef | 2 +- arcadedefs/vnight.arcadedef | 2 +- 19 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 Source/GunListener.h create mode 100644 Source/ScreenPositionListener.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 24466d4fe..df3903bfa 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -249,7 +249,7 @@ set(COMMON_SRC_FILES FrameDump.h FrameLimiter.cpp FrameLimiter.h - GunListener.h + ScreenPositionListener.h InputConfig.cpp InputConfig.h GenericMipsExecutor.h diff --git a/Source/GunListener.h b/Source/GunListener.h deleted file mode 100644 index c6734b19b..000000000 --- a/Source/GunListener.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -class CGunListener -{ -public: - virtual ~CGunListener() = default; - virtual void SetGunPosition(float, float) = 0; - virtual void ReleaseTouchPosition() = 0; -}; diff --git a/Source/PS2VM.cpp b/Source/PS2VM.cpp index 6f1d29d8e..d0599d095 100644 --- a/Source/PS2VM.cpp +++ b/Source/PS2VM.cpp @@ -136,7 +136,7 @@ bool CPS2VM::HasGunListener() const return m_gunListener != nullptr; } -void CPS2VM::SetGunListener(CGunListener* listener) +void CPS2VM::SetGunListener(CScreenPositionListener* listener) { m_gunListener = listener; } @@ -145,7 +145,7 @@ void CPS2VM::ReportGunPosition(float x, float y) { if(m_gunListener) { - m_gunListener->SetGunPosition(x, y); + m_gunListener->SetScreenPosition(x, y); } } @@ -154,7 +154,7 @@ bool CPS2VM::HasTouchListener() const return m_touchListener != nullptr; } -void CPS2VM::SetTouchListener(CGunListener* listener) +void CPS2VM::SetTouchListener(CScreenPositionListener* listener) { m_touchListener = listener; } @@ -163,15 +163,15 @@ void CPS2VM::ReportTouchPosition(float x, float y) { if(m_touchListener) { - m_touchListener->SetGunPosition(x, y); + m_touchListener->SetScreenPosition(x, y); } } -void CPS2VM::ReleaseTouchPosition() +void CPS2VM::ReleaseScreenPosition() { if(m_touchListener) { - m_touchListener->ReleaseTouchPosition(); + m_touchListener->ReleaseScreenPosition(); } } diff --git a/Source/PS2VM.h b/Source/PS2VM.h index 41b885b39..c54cc1911 100644 --- a/Source/PS2VM.h +++ b/Source/PS2VM.h @@ -7,7 +7,7 @@ #include "MIPS.h" #include "MailBox.h" #include "PadHandler.h" -#include "GunListener.h" +#include "ScreenPositionListener.h" #include "OpticalMedia.h" #include "VirtualMachine.h" #include "ee/Ee_SubSystem.h" @@ -87,12 +87,12 @@ public: void ReportGunPosition(float, float); bool HasGunListener() const; - void SetGunListener(CGunListener*); + void SetGunListener(CScreenPositionListener*); void ReportTouchPosition(float, float); bool HasTouchListener() const; - void SetTouchListener(CGunListener*); - void ReleaseTouchPosition(); + void SetTouchListener(CScreenPositionListener*); + void ReleaseScreenPosition(); OpticalMediaPtr m_cdrom0; CPadHandler* m_pad = nullptr; @@ -193,8 +193,8 @@ private: int m_spuBlockCount = 0; CSoundHandler* m_soundHandler = nullptr; - CGunListener* m_gunListener = nullptr; - CGunListener* m_touchListener = nullptr; + CScreenPositionListener* m_gunListener = nullptr; + CScreenPositionListener* m_touchListener = nullptr; CProfiler::ZoneHandle m_eeProfilerZone = 0; CProfiler::ZoneHandle m_iopProfilerZone = 0; diff --git a/Source/ScreenPositionListener.h b/Source/ScreenPositionListener.h new file mode 100644 index 000000000..1acfac32f --- /dev/null +++ b/Source/ScreenPositionListener.h @@ -0,0 +1,9 @@ +#pragma once + +class CScreenPositionListener +{ +public: + virtual ~CScreenPositionListener() = default; + virtual void SetScreenPosition(float, float) = 0; + virtual void ReleaseScreenPosition() = 0; +}; diff --git a/Source/iop/namco_sys246/Iop_NamcoSys246.cpp b/Source/iop/namco_sys246/Iop_NamcoSys246.cpp index 768ac44a3..927223d20 100644 --- a/Source/iop/namco_sys246/Iop_NamcoSys246.cpp +++ b/Source/iop/namco_sys246/Iop_NamcoSys246.cpp @@ -403,10 +403,10 @@ void CSys246::ProcessJvsPacket(const uint8* input, uint8* output) if(m_jvsMode == JVS_MODE::LIGHTGUN) { assert(channel == 2); - (*output++) = static_cast(m_jvsGunPosX >> 8); //Pos X MSB - (*output++) = static_cast(m_jvsGunPosX); //Pos X LSB - (*output++) = static_cast(m_jvsGunPosY >> 8); //Pos Y MSB - (*output++) = static_cast(m_jvsGunPosY); //Pos Y LSB + (*output++) = static_cast(m_jvsScreenPosX >> 8); //Pos X MSB + (*output++) = static_cast(m_jvsScreenPosX); //Pos X LSB + (*output++) = static_cast(m_jvsScreenPosY >> 8); //Pos Y MSB + (*output++) = static_cast(m_jvsScreenPosY); //Pos Y LSB } else if(m_jvsMode == JVS_MODE::DRUM) { @@ -443,10 +443,10 @@ void CSys246::ProcessJvsPacket(const uint8* input, uint8* output) (*output++) = 0x01; //Command success - (*output++) = static_cast(m_jvsGunPosX >> 8); //Pos X MSB - (*output++) = static_cast(m_jvsGunPosX); //Pos X LSB - (*output++) = static_cast(m_jvsGunPosY >> 8); //Pos Y MSB - (*output++) = static_cast(m_jvsGunPosY); //Pos Y LSB + (*output++) = static_cast(m_jvsScreenPosX >> 8); //Pos X MSB + (*output++) = static_cast(m_jvsScreenPosX); //Pos X LSB + (*output++) = static_cast(m_jvsScreenPosY >> 8); //Pos Y MSB + (*output++) = static_cast(m_jvsScreenPosY); //Pos Y LSB (*dstSize) += 5; } @@ -486,9 +486,9 @@ void CSys246::SetButton(unsigned int buttonIndex, PS2::CControllerInfo::BUTTON b m_jvsButtonBits[buttonValue] = (1 << buttonIndex); } -void CSys246::SetLightGunXform(const std::array& lightGunXform) +void CSys246::SetScreenPosXform(const std::array& screenPosXform) { - m_lightGunXform = lightGunXform; + m_screenPosXform = screenPosXform; } void CSys246::SetButtonState(unsigned int padNumber, PS2::CControllerInfo::BUTTON button, bool pressed, uint8* ram) @@ -606,16 +606,16 @@ void CSys246::SetAxisState(unsigned int padNumber, PS2::CControllerInfo::BUTTON } } -void CSys246::SetGunPosition(float x, float y) +void CSys246::SetScreenPosition(float x, float y) { - m_jvsGunPosX = static_cast((x * m_lightGunXform[0]) + m_lightGunXform[1]); - m_jvsGunPosY = static_cast((y * m_lightGunXform[2]) + m_lightGunXform[3]); + m_jvsScreenPosX = static_cast((x * m_screenPosXform[0]) + m_screenPosXform[1]); + m_jvsScreenPosY = static_cast((y * m_screenPosXform[2]) + m_screenPosXform[3]); } -void CSys246::ReleaseTouchPosition() +void CSys246::ReleaseScreenPosition() { - m_jvsGunPosX = 0xFFFF; - m_jvsGunPosY = 0xFFFF; //Y position is negligible + m_jvsScreenPosX = 0xFFFF; + m_jvsScreenPosY = 0xFFFF; //Y position is negligible } bool CSys246::Invoke001(uint32 method, uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram) diff --git a/Source/iop/namco_sys246/Iop_NamcoSys246.h b/Source/iop/namco_sys246/Iop_NamcoSys246.h index 9a31d6ad7..0f7bb519f 100644 --- a/Source/iop/namco_sys246/Iop_NamcoSys246.h +++ b/Source/iop/namco_sys246/Iop_NamcoSys246.h @@ -5,7 +5,7 @@ #include "../Iop_SifMan.h" #include "../../SifModuleAdapter.h" #include "../../PadInterface.h" -#include "../../GunListener.h" +#include "../../ScreenPositionListener.h" #include "filesystem_def.h" namespace Iop @@ -16,7 +16,7 @@ namespace Iop { class CAcRam; - class CSys246 : public CModule, public CPadInterface, public CGunListener + class CSys246 : public CModule, public CPadInterface, public CScreenPositionListener { public: enum class JVS_MODE @@ -40,16 +40,16 @@ namespace Iop void SetJvsMode(JVS_MODE); void SetButton(unsigned int, PS2::CControllerInfo::BUTTON); - void SetLightGunXform(const std::array&); + void SetScreenPosXform(const std::array&); //CPadInterface void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override; void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override; void GetVibration(unsigned int, uint8& largeMotor, uint8& smallMotor) override{}; - //CGunListener - void SetGunPosition(float, float) override; - void ReleaseTouchPosition() override; + //CScreenPositionListener + void SetScreenPosition(float, float) override; + void ReleaseScreenPosition() override; private: enum MODULE_ID @@ -119,13 +119,13 @@ namespace Iop uint32 m_sendAddr = 0; JVS_MODE m_jvsMode = JVS_MODE::DEFAULT; - std::array m_lightGunXform = {65535, 0, 65535, 0}; + std::array m_screenPosXform = {65535, 0, 65535, 0}; std::array m_jvsButtonBits = {}; uint16 m_jvsButtonState[JVS_PLAYER_COUNT] = {}; uint16 m_jvsSystemButtonState = 0; - uint16 m_jvsGunPosX = 0x7FFF; - uint16 m_jvsGunPosY = 0x7FFF; + uint16 m_jvsScreenPosX = 0x7FFF; + uint16 m_jvsScreenPosY = 0x7FFF; uint16 m_jvsDrumChannels[JVS_DRUM_CHANNEL_MAX] = {}; uint16 m_jvsWheelChannels[JVS_WHEEL_CHANNEL_MAX] = {}; uint16 m_jvsWheel = 0x0; diff --git a/Source/ui_qt/mainwindow.cpp b/Source/ui_qt/mainwindow.cpp index e82e15e67..c52104e02 100644 --- a/Source/ui_qt/mainwindow.cpp +++ b/Source/ui_qt/mainwindow.cpp @@ -892,7 +892,7 @@ void MainWindow::outputWindow_mouseReleaseEvent(QMouseEvent* ev) m_qtMouseInputProvider->OnMouseRelease(ev->button()); if(m_virtualMachine->HasTouchListener()) { - m_virtualMachine->ReleaseTouchPosition(); + m_virtualMachine->ReleaseScreenPosition(); } } diff --git a/Source/ui_shared/ArcadeDefinition.h b/Source/ui_shared/ArcadeDefinition.h index 7fc185948..54266bd7f 100644 --- a/Source/ui_shared/ArcadeDefinition.h +++ b/Source/ui_shared/ArcadeDefinition.h @@ -40,7 +40,7 @@ struct ARCADE_MACHINE_DEF std::string nandFileName; std::map buttons; INPUT_MODE inputMode = INPUT_MODE::DEFAULT; - std::array lightGunXform = {65535, 0, 65535, 0}; + std::array screenPosXform = {65535, 0, 65535, 0}; uint32 eeFreqScaleNumerator = 1; uint32 eeFreqScaleDenominator = 1; std::string boot; diff --git a/Source/ui_shared/ArcadeUtils.cpp b/Source/ui_shared/ArcadeUtils.cpp index 74e4f50e3..8540e930a 100644 --- a/Source/ui_shared/ArcadeUtils.cpp +++ b/Source/ui_shared/ArcadeUtils.cpp @@ -166,14 +166,14 @@ ARCADE_MACHINE_DEF ReadArcadeMachineDefinition(const fs::path& arcadeDefPath) std::string inputModeString = defJson["inputMode"]; def.inputMode = ParseEnumValue(inputModeString.c_str(), std::begin(g_inputModeValues), std::end(g_inputModeValues)); } - if(defJson.contains("lightGunXform")) + if(defJson.contains("screenPosXform")) { - auto lightGunXformArray = defJson["lightGunXform"]; - if(lightGunXformArray.is_array() && (lightGunXformArray.size() >= 4)) + auto screenPosXformArray = defJson["screenPosXform"]; + if(screenPosXformArray.is_array() && (screenPosXformArray.size() >= 4)) { for(int i = 0; i < 4; i++) { - def.lightGunXform[i] = lightGunXformArray[i]; + def.screenPosXform[i] = screenPosXformArray[i]; } } } diff --git a/Source/ui_shared/arcadedrivers/NamcoSys246Driver.cpp b/Source/ui_shared/arcadedrivers/NamcoSys246Driver.cpp index 5bf9c40d0..cbe642514 100644 --- a/Source/ui_shared/arcadedrivers/NamcoSys246Driver.cpp +++ b/Source/ui_shared/arcadedrivers/NamcoSys246Driver.cpp @@ -123,7 +123,7 @@ void CNamcoSys246Driver::PrepareEnvironment(CPS2VM* virtualMachine, const ARCADE case ARCADE_MACHINE_DEF::INPUT_MODE::LIGHTGUN: virtualMachine->SetGunListener(namcoArcadeModule.get()); namcoArcadeModule->SetJvsMode(Iop::Namco::CSys246::JVS_MODE::LIGHTGUN); - namcoArcadeModule->SetLightGunXform(def.lightGunXform); + namcoArcadeModule->SetScreenPosXform(def.screenPosXform); break; case ARCADE_MACHINE_DEF::INPUT_MODE::DRUM: namcoArcadeModule->SetJvsMode(Iop::Namco::CSys246::JVS_MODE::DRUM); @@ -134,7 +134,7 @@ void CNamcoSys246Driver::PrepareEnvironment(CPS2VM* virtualMachine, const ARCADE case ARCADE_MACHINE_DEF::INPUT_MODE::TOUCH: virtualMachine->SetTouchListener(namcoArcadeModule.get()); namcoArcadeModule->SetJvsMode(Iop::Namco::CSys246::JVS_MODE::TOUCH); - namcoArcadeModule->SetLightGunXform(def.lightGunXform); + namcoArcadeModule->SetScreenPosXform(def.screenPosXform); break; default: break; diff --git a/arcadedefs/cobrata.arcadedef b/arcadedefs/cobrata.arcadedef index 83372dc7e..3291563f7 100644 --- a/arcadedefs/cobrata.arcadedef +++ b/arcadedefs/cobrata.arcadedef @@ -15,7 +15,7 @@ "3": "circle" }, "inputMode": "lightgun", - "lightGunXform": [ -65535, 0, 65535, 0 ], + "screenPosXform": [ -65535, 0, 65535, 0 ], "eeFrequencyScale": [4, 3], "boot": "ac0:CBRLOAD", "patches": diff --git a/arcadedefs/idolm.arcadedef b/arcadedefs/idolm.arcadedef index 3406ad533..fe6c137c5 100644 --- a/arcadedefs/idolm.arcadedef +++ b/arcadedefs/idolm.arcadedef @@ -11,7 +11,7 @@ "name": "NM00022 IDM1-HA (HDD).chd" }, "inputMode": "touch", - "lightGunXform": [ 65535, 0, -65535, 0 ], + "screenPosXform": [ 65535, 0, -65535, 0 ], "eeFrequencyScale": [4, 3], "boot": "ac0:IDLLOAD", "patches": diff --git a/arcadedefs/idolmtower.arcadedef b/arcadedefs/idolmtower.arcadedef index 16d34f0ee..da1d31a83 100644 --- a/arcadedefs/idolmtower.arcadedef +++ b/arcadedefs/idolmtower.arcadedef @@ -11,7 +11,7 @@ "name": "NM00022 IDM1-HA (HDD).chd" }, "inputMode": "touch", - "lightGunXform": [ 65535, 0, -65535, 0 ], + "screenPosXform": [ 65535, 0, -65535, 0 ], "eeFrequencyScale": [4, 3], "boot": "ac0:IDLLOAD", "patches": diff --git a/arcadedefs/timecrs3.arcadedef b/arcadedefs/timecrs3.arcadedef index f28ffe2fe..1d1a2911c 100644 --- a/arcadedefs/timecrs3.arcadedef +++ b/arcadedefs/timecrs3.arcadedef @@ -11,7 +11,7 @@ "name": "tst1dvd0.chd" }, "inputMode": "lightgun", - "lightGunXform": [ 660, 16053, 220, 16273 ], + "screenPosXform": [ 660, 16053, 220, 16273 ], "boot": "ac0:TC3LOAD", "patches": [ diff --git a/arcadedefs/timecrs3e.arcadedef b/arcadedefs/timecrs3e.arcadedef index 1f86e05ea..2aecce8a5 100644 --- a/arcadedefs/timecrs3e.arcadedef +++ b/arcadedefs/timecrs3e.arcadedef @@ -12,7 +12,7 @@ "name": "tst1dvd0.chd" }, "inputMode": "lightgun", - "lightGunXform": [ 660, 16053, 220, 16273 ], + "screenPosXform": [ 660, 16053, 220, 16273 ], "boot": "ac0:TC3LOAD", "patches": [ diff --git a/arcadedefs/timecrs3u.arcadedef b/arcadedefs/timecrs3u.arcadedef index f1e2ce20b..9089f162b 100644 --- a/arcadedefs/timecrs3u.arcadedef +++ b/arcadedefs/timecrs3u.arcadedef @@ -12,7 +12,7 @@ "name": "tst1dvd0.chd" }, "inputMode": "lightgun", - "lightGunXform": [ 660, 16053, 220, 16273 ], + "screenPosXform": [ 660, 16053, 220, 16273 ], "boot": "ac0:TC3LOAD", "patches": [ diff --git a/arcadedefs/timecrs4.arcadedef b/arcadedefs/timecrs4.arcadedef index 82cf4b944..a47a7bf75 100644 --- a/arcadedefs/timecrs4.arcadedef +++ b/arcadedefs/timecrs4.arcadedef @@ -15,7 +15,7 @@ "3": "circle" }, "inputMode": "lightgun", - "lightGunXform": [ -65535, 0, 65535, 0 ], + "screenPosXform": [ -65535, 0, 65535, 0 ], "eeFrequencyScale": [3, 2], "boot": "ac0:TC4LOAD", "patches": diff --git a/arcadedefs/vnight.arcadedef b/arcadedefs/vnight.arcadedef index 6380743a3..011f0c424 100644 --- a/arcadedefs/vnight.arcadedef +++ b/arcadedefs/vnight.arcadedef @@ -11,7 +11,7 @@ "name": "vpn1cd0.chd" }, "inputMode": "lightgun", - "lightGunXform": [ 53000, 7000, -48146, 50321 ], + "screenPosXform": [ 53000, 7000, -48146, 50321 ], "boot": "ac0:VPNGAME", "patches": [