mirror of
https://github.com/jpd002/Play-.git
synced 2025-05-06 19:01:55 +03:00
Fix code style.
This commit is contained in:
parent
25bad61f4f
commit
1700b901b6
8 changed files with 57 additions and 56 deletions
|
@ -305,9 +305,9 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output)
|
||||||
|
|
||||||
//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;
|
||||||
|
@ -328,9 +328,9 @@ void CNamcoArcade::ProcessJvsPacket(const uint8* input, uint8* output)
|
||||||
(*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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Iop
|
||||||
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;
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -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,29 +71,29 @@ 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) {
|
||||||
|
@ -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