mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 21:57:57 +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;
|
||||
|
||||
CGunListener* m_gunListener = nullptr;
|
||||
|
||||
|
||||
CProfiler::ZoneHandle m_eeProfilerZone = 0;
|
||||
CProfiler::ZoneHandle m_iopProfilerZone = 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_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<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); //Pos Y LSB
|
||||
|
||||
(*output++) = static_cast<uint8>(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<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); //Pos Y LSB
|
||||
|
||||
(*output++) = static_cast<uint8>(m_jvsGunPosY); //Pos Y LSB
|
||||
|
||||
(*dstSize) += 5;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -30,14 +30,14 @@ namespace Iop
|
|||
|
||||
void SetButton(unsigned int, PS2::CControllerInfo::BUTTON);
|
||||
void SetLightGunXform(const std::array<float, 4>&);
|
||||
|
||||
|
||||
//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<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 = {};
|
||||
uint16 m_jvsButtonState = 0;
|
||||
|
|
|
@ -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<CGSH_OpenGLFramedebugger>(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*)));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
class CPixelBufferView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef std::pair<std::string, Framework::CBitmap> PixelBuffer;
|
||||
typedef std::vector<PixelBuffer> PixelBufferArray;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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<float>(mouseX, 0, vpWidth);
|
||||
mouseY = std::clamp<float>(mouseY, 0, vpHeight);
|
||||
m_virtualMachine->ReportGunPosition(
|
||||
static_cast<float>(mouseX) / static_cast<float>(vpWidth),
|
||||
static_cast<float>(mouseY) / static_cast<float>(vpHeight));
|
||||
static_cast<float>(mouseX) / static_cast<float>(vpWidth),
|
||||
static_cast<float>(mouseY) / static_cast<float>(vpHeight));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,11 +33,12 @@ struct ARCADE_MACHINE_DEF
|
|||
std::string hddFileName;
|
||||
std::map<unsigned int, PS2::CControllerInfo::BUTTON> buttons;
|
||||
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::vector<PATCH> patches;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static const std::pair<const char*, PS2::CControllerInfo::BUTTON> g_buttonValues[] =
|
||||
{
|
||||
{ "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 },
|
||||
{ "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<std::map<std::string, std::string>>();
|
||||
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<std::map<std::string, std::string>>();
|
||||
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<ARCADE_MACHINE_DEF::PATCH> 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue