Merge pull request #7852 from Morph1984/new-uuid
common: Revise and fix the UUID implementation
This commit is contained in:
commit
ca9da569ce
31 changed files with 373 additions and 196 deletions
|
@ -248,7 +248,7 @@ bool GCAdapter::Setup() {
|
|||
std::size_t port = 0;
|
||||
for (GCController& pad : pads) {
|
||||
pad.identifier = {
|
||||
.guid = Common::UUID{Common::INVALID_UUID},
|
||||
.guid = Common::UUID{},
|
||||
.port = port++,
|
||||
.pad = 0,
|
||||
};
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
namespace InputCommon {
|
||||
|
||||
constexpr PadIdentifier key_identifier = {
|
||||
.guid = Common::UUID{Common::INVALID_UUID},
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 0,
|
||||
};
|
||||
constexpr PadIdentifier keyboard_key_identifier = {
|
||||
.guid = Common::UUID{Common::INVALID_UUID},
|
||||
.guid = Common::UUID{},
|
||||
.port = 1,
|
||||
.pad = 0,
|
||||
};
|
||||
constexpr PadIdentifier keyboard_modifier_identifier = {
|
||||
.guid = Common::UUID{Common::INVALID_UUID},
|
||||
.guid = Common::UUID{},
|
||||
.port = 1,
|
||||
.pad = 1,
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ constexpr int motion_wheel_y = 4;
|
|||
constexpr int touch_axis_x = 10;
|
||||
constexpr int touch_axis_y = 11;
|
||||
constexpr PadIdentifier identifier = {
|
||||
.guid = Common::UUID{Common::INVALID_UUID},
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 0,
|
||||
};
|
||||
|
|
|
@ -502,7 +502,7 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
|
|||
Common::Input::VibrationError SDLDriver::SetRumble(
|
||||
const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) {
|
||||
const auto joystick =
|
||||
GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port));
|
||||
GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port));
|
||||
const auto process_amplitude_exp = [](f32 amplitude, f32 factor) {
|
||||
return (amplitude + std::pow(amplitude, factor)) * 0.5f * 0xFFFF;
|
||||
};
|
||||
|
@ -599,7 +599,7 @@ Common::ParamPackage SDLDriver::BuildParamPackageForAnalog(PadIdentifier identif
|
|||
Common::ParamPackage params;
|
||||
params.Set("engine", GetEngineName());
|
||||
params.Set("port", static_cast<int>(identifier.port));
|
||||
params.Set("guid", identifier.guid.Format());
|
||||
params.Set("guid", identifier.guid.RawString());
|
||||
params.Set("axis_x", axis_x);
|
||||
params.Set("axis_y", axis_y);
|
||||
params.Set("offset_x", offset_x);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace InputCommon {
|
||||
|
||||
constexpr PadIdentifier identifier = {
|
||||
.guid = Common::UUID{Common::INVALID_UUID},
|
||||
.guid = Common::UUID{},
|
||||
.port = 0,
|
||||
.pad = 0,
|
||||
};
|
||||
|
|
|
@ -353,7 +353,7 @@ PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
|
|||
|
||||
Common::UUID UDPClient::GetHostUUID(const std::string& host) const {
|
||||
const auto ip = boost::asio::ip::make_address_v4(host);
|
||||
const auto hex_host = fmt::format("{:06x}", ip.to_uint());
|
||||
const auto hex_host = fmt::format("00000000-0000-0000-0000-0000{:06x}", ip.to_uint());
|
||||
return Common::UUID{hex_host};
|
||||
}
|
||||
|
||||
|
@ -385,7 +385,7 @@ std::vector<Common::ParamPackage> UDPClient::GetInputDevices() const {
|
|||
Common::ParamPackage identifier{};
|
||||
identifier.Set("engine", GetEngineName());
|
||||
identifier.Set("display", fmt::format("UDP Controller {}", pad_identifier.pad));
|
||||
identifier.Set("guid", pad_identifier.guid.Format());
|
||||
identifier.Set("guid", pad_identifier.guid.RawString());
|
||||
identifier.Set("port", static_cast<int>(pad_identifier.port));
|
||||
identifier.Set("pad", static_cast<int>(pad_identifier.pad));
|
||||
devices.emplace_back(identifier);
|
||||
|
|
|
@ -126,7 +126,7 @@ private:
|
|||
struct ClientConnection {
|
||||
ClientConnection();
|
||||
~ClientConnection();
|
||||
Common::UUID uuid{"7F000001"};
|
||||
Common::UUID uuid{"00000000-0000-0000-0000-00007F000001"};
|
||||
std::string host{"127.0.0.1"};
|
||||
u16 port{26760};
|
||||
s8 active{-1};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue