diff --git a/Source/PS2VM.h b/Source/PS2VM.h index cb739dbf5..d7bb7e739 100644 --- a/Source/PS2VM.h +++ b/Source/PS2VM.h @@ -189,7 +189,7 @@ private: CSoundHandler* m_soundHandler = nullptr; CGunListener* m_gunListener = nullptr; - + CProfiler::ZoneHandle m_eeProfilerZone = 0; CProfiler::ZoneHandle m_iopProfilerZone = 0; CProfiler::ZoneHandle m_spuProfilerZone = 0; diff --git a/Source/iop/Iop_NamcoArcade.cpp b/Source/iop/Iop_NamcoArcade.cpp index ed76d7cca..5d4a018cd 100644 --- a/Source/iop/Iop_NamcoArcade.cpp +++ b/Source/iop/Iop_NamcoArcade.cpp @@ -102,7 +102,7 @@ CNamcoArcade::CNamcoArcade(CSifMan& sif, Namco::CAcRam& acRam, const std::string sif.RegisterModule(MODULE_ID_1, &m_module001); sif.RegisterModule(MODULE_ID_3, &m_module003); sif.RegisterModule(MODULE_ID_4, &m_module004); - + m_jvsButtonBits = g_defaultJvsButtonBits; } @@ -225,7 +225,7 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output) (*output++) = 0x01; //channels (*output++) = 0x00; //End of features - + (*dstSize) += 18; } break; @@ -300,15 +300,15 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output) assert(channel == 2); inWorkChecksum += channel; inSize--; - + (*output++) = 0x01; //Command success //Time Crisis 4 reads from this to determine screen position (*output++) = static_cast(m_jvsGunPosX >> 8); //Pos X MSB - (*output++) = static_cast(m_jvsGunPosX); //Pos X LSB + (*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_jvsGunPosY); //Pos Y LSB + (*output++) = 0; (*output++) = 0; (*output++) = 0; @@ -324,14 +324,14 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output) assert(channel == 1); inWorkChecksum += channel; inSize--; - + (*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_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_jvsGunPosY); //Pos Y LSB + (*dstSize) += 5; } break; diff --git a/Source/iop/Iop_NamcoArcade.h b/Source/iop/Iop_NamcoArcade.h index db471bd79..c4046819e 100644 --- a/Source/iop/Iop_NamcoArcade.h +++ b/Source/iop/Iop_NamcoArcade.h @@ -30,14 +30,14 @@ namespace Iop void SetButton(unsigned int, PS2::CControllerInfo::BUTTON); void SetLightGunXform(const std::array&); - + //CPadListener void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override; void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override; //CGunListener void SetGunPosition(float, float) override; - + private: enum MODULE_ID { @@ -70,8 +70,8 @@ namespace Iop std::string m_gameId; uint32 m_recvAddr = 0; uint32 m_sendAddr = 0; - - std::array m_lightGunXform = { 65535, 0, 65535, 0 }; + + std::array m_lightGunXform = {65535, 0, 65535, 0}; std::array m_jvsButtonBits = {}; uint16 m_jvsButtonState = 0; diff --git a/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.cpp b/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.cpp index 23f25dcb6..e4cab0f1d 100644 --- a/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.cpp +++ b/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.cpp @@ -28,16 +28,16 @@ CPixelBufferView::CPixelBufferView(QWidget* parent, QComboBox* contextBuffer) auto container = QWidget::createWindowContainer(m_openglpanel, this); container->sizePolicy().setHorizontalStretch(3); container->sizePolicy().setHorizontalPolicy(QSizePolicy::Expanding); - + auto layout = new QVBoxLayout; setLayout(layout); layout->addWidget(container); - + m_openglpanel->create(); m_gs = std::make_unique(m_openglpanel); m_gs->InitializeImpl(); m_gs->PrepareFramedebugger(); - + connect(m_openglpanel, &QWindow::widthChanged, this, &CPixelBufferView::Refresh); connect(m_openglpanel, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(OnMouseMoveEvent(QMouseEvent*))); connect(m_openglpanel, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(OnMousePressEvent(QMouseEvent*))); diff --git a/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.h b/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.h index e24632ef1..5e137616b 100644 --- a/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.h +++ b/Source/ui_qt/DebugSupport/FrameDebugger/PixelBufferView.h @@ -12,7 +12,7 @@ class CPixelBufferView : public QWidget { - Q_OBJECT + Q_OBJECT public: typedef std::pair PixelBuffer; typedef std::vector PixelBufferArray; diff --git a/Source/ui_qt/InputProviderQtMouse.cpp b/Source/ui_qt/InputProviderQtMouse.cpp index 603f6f846..56fadbd59 100644 --- a/Source/ui_qt/InputProviderQtMouse.cpp +++ b/Source/ui_qt/InputProviderQtMouse.cpp @@ -12,16 +12,15 @@ uint32 CInputProviderQtMouse::GetId() const std::string CInputProviderQtMouse::GetTargetDescription(const BINDINGTARGET& target) const { assert(target.providerId == PROVIDER_ID); - auto description = [&]() -> std::string - { + auto description = [&]() -> std::string { switch(target.keyId) { - case Qt::LeftButton: - return "Left Button"; - case Qt::RightButton: - return "Right Button"; - default: - return string_format("Unknown button %d", target.keyId); + case Qt::LeftButton: + return "Left Button"; + case Qt::RightButton: + return "Right Button"; + default: + return string_format("Unknown button %d", target.keyId); } }(); return string_format("Mouse: %s", description.c_str()); diff --git a/Source/ui_qt/mainwindow.cpp b/Source/ui_qt/mainwindow.cpp index 439b0d678..5a78f3c25 100644 --- a/Source/ui_qt/mainwindow.cpp +++ b/Source/ui_qt/mainwindow.cpp @@ -257,7 +257,7 @@ void MainWindow::SetupGsHandler() connect(m_outputwindow, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(outputWindow_mouseMoveEvent(QMouseEvent*))); connect(m_outputwindow, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(outputWindow_mousePressEvent(QMouseEvent*))); connect(m_outputwindow, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(outputWindow_mouseReleaseEvent(QMouseEvent*))); - + m_OnNewFrameConnection = m_virtualMachine->m_ee->m_gs->OnNewFrame.Connect(std::bind(&CStatsManager::OnNewFrame, &CStatsManager::GetInstance(), m_virtualMachine, std::placeholders::_1)); } @@ -857,8 +857,8 @@ void MainWindow::outputWindow_mouseMoveEvent(QMouseEvent* ev) mouseX = std::clamp(mouseX, 0, vpWidth); mouseY = std::clamp(mouseY, 0, vpHeight); m_virtualMachine->ReportGunPosition( - static_cast(mouseX) / static_cast(vpWidth), - static_cast(mouseY) / static_cast(vpHeight)); + static_cast(mouseX) / static_cast(vpWidth), + static_cast(mouseY) / static_cast(vpHeight)); } } diff --git a/Source/ui_shared/ArcadeUtils.cpp b/Source/ui_shared/ArcadeUtils.cpp index d1ce1ac9e..1edfbf6bf 100644 --- a/Source/ui_shared/ArcadeUtils.cpp +++ b/Source/ui_shared/ArcadeUtils.cpp @@ -33,11 +33,12 @@ struct ARCADE_MACHINE_DEF std::string hddFileName; std::map buttons; bool hasLightGun = false; - std::array lightGunXform = { 65535, 0, 65535, 0 }; + std::array lightGunXform = {65535, 0, 65535, 0}; std::string boot; std::vector patches; }; +// clang-format off static const std::pair g_buttonValues[] = { { "dpad_up", PS2::CControllerInfo::DPAD_UP }, @@ -57,6 +58,7 @@ static const std::pair g_buttonValues { "r2", PS2::CControllerInfo::R2 }, { "r3", PS2::CControllerInfo::R3 } }; +// clang-format on uint32 ParseHexStringValue(const std::string& value) { @@ -69,30 +71,30 @@ uint32 ParseHexStringValue(const std::string& value) ARCADE_MACHINE_DEF ReadArcadeMachineDefinition(const fs::path& arcadeDefPath) { auto parseButtons = - [](const nlohmann::json& buttonsObject) { - auto buttonMap = buttonsObject.get>(); - decltype(ARCADE_MACHINE_DEF::buttons) buttons; - for(const auto& buttonPair : buttonMap) - { - char* endPtr = nullptr; - const char* buttonNumber = buttonPair.first.c_str(); - const char* buttonName = buttonPair.second.c_str(); - int number = strtol(buttonPair.first.c_str(), &endPtr, 10); - if(endPtr == buttonPair.first.c_str()) - { - throw std::runtime_error(string_format("Failed to parse button number '%s'.", buttonNumber)); - } - auto buttonValueIterator = std::find_if(std::begin(g_buttonValues), std::end(g_buttonValues), - [&](const auto& buttonValuePair) { return strcmp(buttonValuePair.first, buttonName) == 0; }); - if(buttonValueIterator == std::end(g_buttonValues)) - { - throw std::runtime_error(string_format("Unknown button name '%s'.", buttonName)); - } - buttons[number] = buttonValueIterator->second; - } - return buttons; - }; - + [](const nlohmann::json& buttonsObject) { + auto buttonMap = buttonsObject.get>(); + decltype(ARCADE_MACHINE_DEF::buttons) buttons; + for(const auto& buttonPair : buttonMap) + { + char* endPtr = nullptr; + const char* buttonNumber = buttonPair.first.c_str(); + const char* buttonName = buttonPair.second.c_str(); + int number = strtol(buttonPair.first.c_str(), &endPtr, 10); + if(endPtr == buttonPair.first.c_str()) + { + throw std::runtime_error(string_format("Failed to parse button number '%s'.", buttonNumber)); + } + auto buttonValueIterator = std::find_if(std::begin(g_buttonValues), std::end(g_buttonValues), + [&](const auto& buttonValuePair) { return strcmp(buttonValuePair.first, buttonName) == 0; }); + if(buttonValueIterator == std::end(g_buttonValues)) + { + throw std::runtime_error(string_format("Unknown button name '%s'.", buttonName)); + } + buttons[number] = buttonValueIterator->second; + } + return buttons; + }; + auto parsePatches = [](const nlohmann::json& patchesArray) { std::vector patches; @@ -301,7 +303,7 @@ void ArcadeUtils::RegisterArcadeMachines() catch(const std::exception& exception) { printf("Warning: Failed to register arcade machine '%s': %s\r\n", - arcadeDefFilename.c_str(), exception.what()); + arcadeDefFilename.c_str(), exception.what()); } } }