mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-29 06:07:56 +03:00
Fix code style.
This commit is contained in:
parent
25bad61f4f
commit
1700b901b6
8 changed files with 57 additions and 56 deletions
|
@ -189,7 +189,7 @@ private:
|
||||||
CSoundHandler* m_soundHandler = nullptr;
|
CSoundHandler* m_soundHandler = nullptr;
|
||||||
|
|
||||||
CGunListener* m_gunListener = nullptr;
|
CGunListener* m_gunListener = nullptr;
|
||||||
|
|
||||||
CProfiler::ZoneHandle m_eeProfilerZone = 0;
|
CProfiler::ZoneHandle m_eeProfilerZone = 0;
|
||||||
CProfiler::ZoneHandle m_iopProfilerZone = 0;
|
CProfiler::ZoneHandle m_iopProfilerZone = 0;
|
||||||
CProfiler::ZoneHandle m_spuProfilerZone = 0;
|
CProfiler::ZoneHandle m_spuProfilerZone = 0;
|
||||||
|
|
|
@ -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_1, &m_module001);
|
||||||
sif.RegisterModule(MODULE_ID_3, &m_module003);
|
sif.RegisterModule(MODULE_ID_3, &m_module003);
|
||||||
sif.RegisterModule(MODULE_ID_4, &m_module004);
|
sif.RegisterModule(MODULE_ID_4, &m_module004);
|
||||||
|
|
||||||
m_jvsButtonBits = g_defaultJvsButtonBits;
|
m_jvsButtonBits = g_defaultJvsButtonBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output)
|
||||||
(*output++) = 0x01; //channels
|
(*output++) = 0x01; //channels
|
||||||
|
|
||||||
(*output++) = 0x00; //End of features
|
(*output++) = 0x00; //End of features
|
||||||
|
|
||||||
(*dstSize) += 18;
|
(*dstSize) += 18;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -300,15 +300,15 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output)
|
||||||
assert(channel == 2);
|
assert(channel == 2);
|
||||||
inWorkChecksum += channel;
|
inWorkChecksum += channel;
|
||||||
inSize--;
|
inSize--;
|
||||||
|
|
||||||
(*output++) = 0x01; //Command success
|
(*output++) = 0x01; //Command success
|
||||||
|
|
||||||
//Time Crisis 4 reads from this to determine screen position
|
//Time Crisis 4 reads from this to determine screen position
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosX >> 8); //Pos X MSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosX >> 8); //Pos X MSB
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosX); //Pos X LSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosX); //Pos X LSB
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosY >> 8); //Pos Y MSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosY >> 8); //Pos Y MSB
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosY); //Pos Y LSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosY); //Pos Y LSB
|
||||||
|
|
||||||
(*output++) = 0;
|
(*output++) = 0;
|
||||||
(*output++) = 0;
|
(*output++) = 0;
|
||||||
(*output++) = 0;
|
(*output++) = 0;
|
||||||
|
@ -324,14 +324,14 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output)
|
||||||
assert(channel == 1);
|
assert(channel == 1);
|
||||||
inWorkChecksum += channel;
|
inWorkChecksum += channel;
|
||||||
inSize--;
|
inSize--;
|
||||||
|
|
||||||
(*output++) = 0x01; //Command success
|
(*output++) = 0x01; //Command success
|
||||||
|
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosX >> 8); //Pos X MSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosX >> 8); //Pos X MSB
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosX); //Pos X LSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosX); //Pos X LSB
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosY >> 8); //Pos Y MSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosY >> 8); //Pos Y MSB
|
||||||
(*output++) = static_cast<uint8>(m_jvsGunPosY); //Pos Y LSB
|
(*output++) = static_cast<uint8>(m_jvsGunPosY); //Pos Y LSB
|
||||||
|
|
||||||
(*dstSize) += 5;
|
(*dstSize) += 5;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,14 +30,14 @@ namespace Iop
|
||||||
|
|
||||||
void SetButton(unsigned int, PS2::CControllerInfo::BUTTON);
|
void SetButton(unsigned int, PS2::CControllerInfo::BUTTON);
|
||||||
void SetLightGunXform(const std::array<float, 4>&);
|
void SetLightGunXform(const std::array<float, 4>&);
|
||||||
|
|
||||||
//CPadListener
|
//CPadListener
|
||||||
void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override;
|
void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override;
|
||||||
void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override;
|
void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override;
|
||||||
|
|
||||||
//CGunListener
|
//CGunListener
|
||||||
void SetGunPosition(float, float) override;
|
void SetGunPosition(float, float) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum MODULE_ID
|
enum MODULE_ID
|
||||||
{
|
{
|
||||||
|
@ -70,8 +70,8 @@ namespace Iop
|
||||||
std::string m_gameId;
|
std::string m_gameId;
|
||||||
uint32 m_recvAddr = 0;
|
uint32 m_recvAddr = 0;
|
||||||
uint32 m_sendAddr = 0;
|
uint32 m_sendAddr = 0;
|
||||||
|
|
||||||
std::array<float, 4> m_lightGunXform = { 65535, 0, 65535, 0 };
|
std::array<float, 4> m_lightGunXform = {65535, 0, 65535, 0};
|
||||||
|
|
||||||
std::array<uint16, PS2::CControllerInfo::MAX_BUTTONS> m_jvsButtonBits = {};
|
std::array<uint16, PS2::CControllerInfo::MAX_BUTTONS> m_jvsButtonBits = {};
|
||||||
uint16 m_jvsButtonState = 0;
|
uint16 m_jvsButtonState = 0;
|
||||||
|
|
|
@ -28,16 +28,16 @@ CPixelBufferView::CPixelBufferView(QWidget* parent, QComboBox* contextBuffer)
|
||||||
auto container = QWidget::createWindowContainer(m_openglpanel, this);
|
auto container = QWidget::createWindowContainer(m_openglpanel, this);
|
||||||
container->sizePolicy().setHorizontalStretch(3);
|
container->sizePolicy().setHorizontalStretch(3);
|
||||||
container->sizePolicy().setHorizontalPolicy(QSizePolicy::Expanding);
|
container->sizePolicy().setHorizontalPolicy(QSizePolicy::Expanding);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout;
|
auto layout = new QVBoxLayout;
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
layout->addWidget(container);
|
layout->addWidget(container);
|
||||||
|
|
||||||
m_openglpanel->create();
|
m_openglpanel->create();
|
||||||
m_gs = std::make_unique<CGSH_OpenGLFramedebugger>(m_openglpanel);
|
m_gs = std::make_unique<CGSH_OpenGLFramedebugger>(m_openglpanel);
|
||||||
m_gs->InitializeImpl();
|
m_gs->InitializeImpl();
|
||||||
m_gs->PrepareFramedebugger();
|
m_gs->PrepareFramedebugger();
|
||||||
|
|
||||||
connect(m_openglpanel, &QWindow::widthChanged, this, &CPixelBufferView::Refresh);
|
connect(m_openglpanel, &QWindow::widthChanged, this, &CPixelBufferView::Refresh);
|
||||||
connect(m_openglpanel, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(OnMouseMoveEvent(QMouseEvent*)));
|
connect(m_openglpanel, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(OnMouseMoveEvent(QMouseEvent*)));
|
||||||
connect(m_openglpanel, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(OnMousePressEvent(QMouseEvent*)));
|
connect(m_openglpanel, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(OnMousePressEvent(QMouseEvent*)));
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
class CPixelBufferView : public QWidget
|
class CPixelBufferView : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
typedef std::pair<std::string, Framework::CBitmap> PixelBuffer;
|
typedef std::pair<std::string, Framework::CBitmap> PixelBuffer;
|
||||||
typedef std::vector<PixelBuffer> PixelBufferArray;
|
typedef std::vector<PixelBuffer> PixelBufferArray;
|
||||||
|
|
|
@ -12,16 +12,15 @@ uint32 CInputProviderQtMouse::GetId() const
|
||||||
std::string CInputProviderQtMouse::GetTargetDescription(const BINDINGTARGET& target) const
|
std::string CInputProviderQtMouse::GetTargetDescription(const BINDINGTARGET& target) const
|
||||||
{
|
{
|
||||||
assert(target.providerId == PROVIDER_ID);
|
assert(target.providerId == PROVIDER_ID);
|
||||||
auto description = [&]() -> std::string
|
auto description = [&]() -> std::string {
|
||||||
{
|
|
||||||
switch(target.keyId)
|
switch(target.keyId)
|
||||||
{
|
{
|
||||||
case Qt::LeftButton:
|
case Qt::LeftButton:
|
||||||
return "Left Button";
|
return "Left Button";
|
||||||
case Qt::RightButton:
|
case Qt::RightButton:
|
||||||
return "Right Button";
|
return "Right Button";
|
||||||
default:
|
default:
|
||||||
return string_format("Unknown button %d", target.keyId);
|
return string_format("Unknown button %d", target.keyId);
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
return string_format("Mouse: %s", description.c_str());
|
return string_format("Mouse: %s", description.c_str());
|
||||||
|
|
|
@ -257,7 +257,7 @@ void MainWindow::SetupGsHandler()
|
||||||
connect(m_outputwindow, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(outputWindow_mouseMoveEvent(QMouseEvent*)));
|
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(mousePress(QMouseEvent*)), this, SLOT(outputWindow_mousePressEvent(QMouseEvent*)));
|
||||||
connect(m_outputwindow, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(outputWindow_mouseReleaseEvent(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));
|
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<float>(mouseX, 0, vpWidth);
|
mouseX = std::clamp<float>(mouseX, 0, vpWidth);
|
||||||
mouseY = std::clamp<float>(mouseY, 0, vpHeight);
|
mouseY = std::clamp<float>(mouseY, 0, vpHeight);
|
||||||
m_virtualMachine->ReportGunPosition(
|
m_virtualMachine->ReportGunPosition(
|
||||||
static_cast<float>(mouseX) / static_cast<float>(vpWidth),
|
static_cast<float>(mouseX) / static_cast<float>(vpWidth),
|
||||||
static_cast<float>(mouseY) / static_cast<float>(vpHeight));
|
static_cast<float>(mouseY) / static_cast<float>(vpHeight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,12 @@ struct ARCADE_MACHINE_DEF
|
||||||
std::string hddFileName;
|
std::string hddFileName;
|
||||||
std::map<unsigned int, PS2::CControllerInfo::BUTTON> buttons;
|
std::map<unsigned int, PS2::CControllerInfo::BUTTON> buttons;
|
||||||
bool hasLightGun = false;
|
bool hasLightGun = false;
|
||||||
std::array<float, 4> lightGunXform = { 65535, 0, 65535, 0 };
|
std::array<float, 4> lightGunXform = {65535, 0, 65535, 0};
|
||||||
std::string boot;
|
std::string boot;
|
||||||
std::vector<PATCH> patches;
|
std::vector<PATCH> patches;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
static const std::pair<const char*, PS2::CControllerInfo::BUTTON> g_buttonValues[] =
|
static const std::pair<const char*, PS2::CControllerInfo::BUTTON> g_buttonValues[] =
|
||||||
{
|
{
|
||||||
{ "dpad_up", PS2::CControllerInfo::DPAD_UP },
|
{ "dpad_up", PS2::CControllerInfo::DPAD_UP },
|
||||||
|
@ -57,6 +58,7 @@ static const std::pair<const char*, PS2::CControllerInfo::BUTTON> g_buttonValues
|
||||||
{ "r2", PS2::CControllerInfo::R2 },
|
{ "r2", PS2::CControllerInfo::R2 },
|
||||||
{ "r3", PS2::CControllerInfo::R3 }
|
{ "r3", PS2::CControllerInfo::R3 }
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
uint32 ParseHexStringValue(const std::string& value)
|
uint32 ParseHexStringValue(const std::string& value)
|
||||||
{
|
{
|
||||||
|
@ -69,30 +71,30 @@ uint32 ParseHexStringValue(const std::string& value)
|
||||||
ARCADE_MACHINE_DEF ReadArcadeMachineDefinition(const fs::path& arcadeDefPath)
|
ARCADE_MACHINE_DEF ReadArcadeMachineDefinition(const fs::path& arcadeDefPath)
|
||||||
{
|
{
|
||||||
auto parseButtons =
|
auto parseButtons =
|
||||||
[](const nlohmann::json& buttonsObject) {
|
[](const nlohmann::json& buttonsObject) {
|
||||||
auto buttonMap = buttonsObject.get<std::map<std::string, std::string>>();
|
auto buttonMap = buttonsObject.get<std::map<std::string, std::string>>();
|
||||||
decltype(ARCADE_MACHINE_DEF::buttons) buttons;
|
decltype(ARCADE_MACHINE_DEF::buttons) buttons;
|
||||||
for(const auto& buttonPair : buttonMap)
|
for(const auto& buttonPair : buttonMap)
|
||||||
{
|
{
|
||||||
char* endPtr = nullptr;
|
char* endPtr = nullptr;
|
||||||
const char* buttonNumber = buttonPair.first.c_str();
|
const char* buttonNumber = buttonPair.first.c_str();
|
||||||
const char* buttonName = buttonPair.second.c_str();
|
const char* buttonName = buttonPair.second.c_str();
|
||||||
int number = strtol(buttonPair.first.c_str(), &endPtr, 10);
|
int number = strtol(buttonPair.first.c_str(), &endPtr, 10);
|
||||||
if(endPtr == buttonPair.first.c_str())
|
if(endPtr == buttonPair.first.c_str())
|
||||||
{
|
{
|
||||||
throw std::runtime_error(string_format("Failed to parse button number '%s'.", buttonNumber));
|
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),
|
auto buttonValueIterator = std::find_if(std::begin(g_buttonValues), std::end(g_buttonValues),
|
||||||
[&](const auto& buttonValuePair) { return strcmp(buttonValuePair.first, buttonName) == 0; });
|
[&](const auto& buttonValuePair) { return strcmp(buttonValuePair.first, buttonName) == 0; });
|
||||||
if(buttonValueIterator == std::end(g_buttonValues))
|
if(buttonValueIterator == std::end(g_buttonValues))
|
||||||
{
|
{
|
||||||
throw std::runtime_error(string_format("Unknown button name '%s'.", buttonName));
|
throw std::runtime_error(string_format("Unknown button name '%s'.", buttonName));
|
||||||
}
|
}
|
||||||
buttons[number] = buttonValueIterator->second;
|
buttons[number] = buttonValueIterator->second;
|
||||||
}
|
}
|
||||||
return buttons;
|
return buttons;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto parsePatches =
|
auto parsePatches =
|
||||||
[](const nlohmann::json& patchesArray) {
|
[](const nlohmann::json& patchesArray) {
|
||||||
std::vector<ARCADE_MACHINE_DEF::PATCH> patches;
|
std::vector<ARCADE_MACHINE_DEF::PATCH> patches;
|
||||||
|
@ -301,7 +303,7 @@ void ArcadeUtils::RegisterArcadeMachines()
|
||||||
catch(const std::exception& exception)
|
catch(const std::exception& exception)
|
||||||
{
|
{
|
||||||
printf("Warning: Failed to register arcade machine '%s': %s\r\n",
|
printf("Warning: Failed to register arcade machine '%s': %s\r\n",
|
||||||
arcadeDefFilename.c_str(), exception.what());
|
arcadeDefFilename.c_str(), exception.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue