revert changes to make it compile

This commit is contained in:
Narr the Reg 2023-08-20 22:28:45 -06:00
parent 600a02fe29
commit ce39e0dd45
10 changed files with 70 additions and 57 deletions

View File

@ -48,6 +48,8 @@ IActiveVibrationDeviceList::IActiveVibrationDeviceList(Core::System& system_,
RegisterHandlers(functions); RegisterHandlers(functions);
} }
IActiveVibrationDeviceList::~IActiveVibrationDeviceList() = default;
void IActiveVibrationDeviceList::InitializeVibrationDevice(HLERequestContext& ctx) { void IActiveVibrationDeviceList::InitializeVibrationDevice(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const auto vibration_device_handle{rp.PopRaw<VibrationDeviceHandle>()}; const auto vibration_device_handle{rp.PopRaw<VibrationDeviceHandle>()};
@ -1835,7 +1837,7 @@ Result IHidServer::SendVibrationValueImpl(const u64 aruid, const VibrationDevice
return ResultSuccess; return ResultSuccess;
} }
vibration->SendVibrationValue(vibration_value); // vibration->SendVibrationValue(vibration_value);
return ResultSuccess; return ResultSuccess;
} }
@ -1882,10 +1884,10 @@ void IHidServer::GetActualVibrationValue(HLERequestContext& ctx) {
return; return;
} }
const auto& vibration = GetResourceManager()->GetVibration(parameters.handle); // const auto& vibration = GetResourceManager()->GetVibration(parameters.handle);
if (vibration != nullptr) { // if (vibration != nullptr) {
vibration->GetActualVibrationValue(vibration_value); // vibration->GetActualVibrationValue(vibration_value);
} // }
} }
IPC::ResponseBuilder rb{ctx, 6}; IPC::ResponseBuilder rb{ctx, 6};
@ -2006,9 +2008,8 @@ void IHidServer::SendVibrationGcErmCommand(HLERequestContext& ctx) {
return; return;
} }
vibration->SendVibrationValue(parameters.gc_erm_command); // vibration->SendVibrationValue(parameters.gc_erm_command);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
@ -2049,10 +2050,10 @@ void IHidServer::GetActualVibrationGcErmCommand(HLERequestContext& ctx) {
return; return;
} }
const auto& vibration = GetResourceManager()->GetGCVibration(parameters.handle); // const auto& vibration = GetResourceManager()->GetGCVibration(parameters.handle);
if (vibration != nullptr) { // if (vibration != nullptr) {
vibration->GetActualVibrationValue(vibration_value); // vibration->GetActualVibrationValue(vibration_value);
} // }
} }
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
@ -2109,9 +2110,8 @@ void IHidServer::SendVibrationValueInBool(HLERequestContext& ctx) {
return; return;
} }
vibration->SendVibrationValue(parameters.should_vibrate); // vibration->SendVibrationValue(parameters.should_vibrate);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
@ -2215,7 +2215,7 @@ void IHidServer::PlayPalmaActivity(HLERequestContext& ctx) {
connection_handle.npad_id, palma_activity); connection_handle.npad_id, palma_activity);
const auto result = GetResourceManager()->GetPalma()->PlayPalmaActivity( const auto result = GetResourceManager()->GetPalma()->PlayPalmaActivity(
connection_handle.npad_id, palma_activity); connection_handle.npad_id, static_cast<u32>(palma_activity));
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result); rb.Push(result);
@ -2291,7 +2291,7 @@ void IHidServer::ReadPalmaApplicationSection(HLERequestContext& ctx) {
connection_handle.npad_id, starting_index, size); connection_handle.npad_id, starting_index, size);
const auto result = GetResourceManager()->GetPalma()->ReadPalmaApplicationSection( const auto result = GetResourceManager()->GetPalma()->ReadPalmaApplicationSection(
connection_handle.npad_id, starting_index, size); connection_handle.npad_id, static_cast<u32>(starting_index), static_cast<u32>(size));
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result); rb.Push(result);
@ -2308,7 +2308,8 @@ void IHidServer::WritePalmaApplicationSection(HLERequestContext& ctx) {
connection_handle.npad_id, starting_index, size); connection_handle.npad_id, starting_index, size);
const auto result = GetResourceManager()->GetPalma()->WritePalmaApplicationSection( const auto result = GetResourceManager()->GetPalma()->WritePalmaApplicationSection(
connection_handle.npad_id, starting_index, size, buffer); connection_handle.npad_id, static_cast<u32>(starting_index), static_cast<u32>(size),
buffer);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result); rb.Push(result);
@ -2369,7 +2370,7 @@ void IHidServer::WritePalmaRgbLedPatternEntry(HLERequestContext& ctx) {
connection_handle.npad_id, pattern_type); connection_handle.npad_id, pattern_type);
const auto result = GetResourceManager()->GetPalma()->WritePalmaRgbLedPatternEntry( const auto result = GetResourceManager()->GetPalma()->WritePalmaRgbLedPatternEntry(
connection_handle.npad_id, pattern_type, buffer); connection_handle.npad_id, static_cast<u16>(pattern_type), buffer);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(result); rb.Push(result);

View File

@ -10,7 +10,13 @@ class System;
} }
namespace Service::HID { namespace Service::HID {
struct VibrationDeviceHandle;
struct VibrationValue;
class ResourceManager; class ResourceManager;
} // namespace Service::HID
namespace Service::HID {
class IAppletResource final : public ServiceFramework<IAppletResource> { class IAppletResource final : public ServiceFramework<IAppletResource> {
public: public:

View File

@ -10,6 +10,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/point.h" #include "common/point.h"
#include "common/uuid.h" #include "common/uuid.h"
#include "core/hle/result.h"
namespace Service::HID { namespace Service::HID {
@ -926,9 +927,9 @@ using PalmaOperationData = std::array<u8, 0x140>;
// This is nn::hid::PalmaOperationInfo // This is nn::hid::PalmaOperationInfo
struct PalmaOperationInfo { struct PalmaOperationInfo {
PalmaOperationType operation{}; PalmaOperationType operation;
Result result{}; Result result;
PalmaOperationData data{}; PalmaOperationData data;
}; };
static_assert(sizeof(PalmaOperationInfo) == 0x148, "PalmaOperationInfo is an invalid size"); static_assert(sizeof(PalmaOperationInfo) == 0x148, "PalmaOperationInfo is an invalid size");

View File

@ -26,7 +26,7 @@ constexpr bool IsNpadIdValid(const NpadIdType npad_id) {
} }
} }
Result IsVibrationHandleValid(const VibrationDeviceHandle& handle) const { constexpr Result IsVibrationHandleValid(const VibrationDeviceHandle& handle) {
switch (handle.npad_style_index) { switch (handle.npad_style_index) {
case NpadStyleIndex::FullKey: case NpadStyleIndex::FullKey:
case NpadStyleIndex::Handheld: case NpadStyleIndex::Handheld:

View File

@ -79,7 +79,7 @@ void ResourceManager::Initialize() {
gesture = std::make_shared<Gesture>(); gesture = std::make_shared<Gesture>();
keyboard = std::make_shared<Keyboard>(); keyboard = std::make_shared<Keyboard>();
mouse = std::make_shared<Mouse>(); mouse = std::make_shared<Mouse>();
npad = std::make_shared<Npad>(service_context); npad = std::make_shared<Npad>(service_context, this);
palma = std::make_shared<Palma>(); palma = std::make_shared<Palma>();
sixaxis = std::make_shared<SixAxis>(); sixaxis = std::make_shared<SixAxis>();
touch_screen = std::make_shared<TouchScreen>(); touch_screen = std::make_shared<TouchScreen>();
@ -215,9 +215,10 @@ std::shared_ptr<Vibration> ResourceManager::GetVibration(const VibrationDeviceHa
default: default:
return nullptr; return nullptr;
} }
return GetNpad() return nullptr;
/*return GetNpad()
->GetAbstractNpad(static_cast<NpadIdType>(handle.npad_id)) ->GetAbstractNpad(static_cast<NpadIdType>(handle.npad_id))
->GetVibration(handle.device_index); ->GetVibration(handle.device_index);*/
} }
std::shared_ptr<Vibration> ResourceManager::GetGCVibration(const VibrationDeviceHandle& handle) { std::shared_ptr<Vibration> ResourceManager::GetGCVibration(const VibrationDeviceHandle& handle) {
@ -227,7 +228,8 @@ std::shared_ptr<Vibration> ResourceManager::GetGCVibration(const VibrationDevice
if (handle.npad_style_index != NpadStyleIndex::GameCube) { if (handle.npad_style_index != NpadStyleIndex::GameCube) {
return nullptr; return nullptr;
} }
return GetNpad()->GetAbstractNpad(static_cast<NpadIdType>(handle.npad_id))->GetGcVibration(); return nullptr;
// return GetNpad()->GetAbstractNpad(static_cast<NpadIdType>(handle.npad_id))->GetGcVibration();
} }
std::shared_ptr<Vibration> ResourceManager::GetN64Vibration(const VibrationDeviceHandle& handle) { std::shared_ptr<Vibration> ResourceManager::GetN64Vibration(const VibrationDeviceHandle& handle) {
@ -237,7 +239,9 @@ std::shared_ptr<Vibration> ResourceManager::GetN64Vibration(const VibrationDevic
if (handle.npad_style_index != NpadStyleIndex::N64) { if (handle.npad_style_index != NpadStyleIndex::N64) {
return nullptr; return nullptr;
} }
return GetNpad()->GetAbstractNpad(static_cast<NpadIdType>(handle.npad_id))->GetN64Vibration(); return nullptr;
// return
// GetNpad()->GetAbstractNpad(static_cast<NpadIdType>(handle.npad_id))->GetN64Vibration();
} }
} // namespace Service::HID } // namespace Service::HID

View File

@ -25,6 +25,7 @@ class TouchScreen;
} // namespace Service::HID } // namespace Service::HID
namespace Service::HID { namespace Service::HID {
class Vibration {};
class ResourceManager { class ResourceManager {
public: public:

View File

@ -78,7 +78,7 @@ void AbstractNpadState::UpdateBatteryLifoImpl(const BatteryState& battery_state,
internal_state.battery_level_right = battery_state.battery_level_right; internal_state.battery_level_right = battery_state.battery_level_right;
} }
Npad::Npad(KernelHelpers::ServiceContext& context, std::shared_ptr<ResourceManager> resource) Npad::Npad(KernelHelpers::ServiceContext& context, ResourceManager* resource)
: service_context{context}, resource_manager{resource} { : service_context{context}, resource_manager{resource} {
for (auto& npad : npad_state) { for (auto& npad : npad_state) {
npad = std::make_shared<NpadState>(); npad = std::make_shared<NpadState>();

View File

@ -77,8 +77,7 @@ private:
class Npad final : public BaseResource { class Npad final : public BaseResource {
public: public:
explicit Npad(KernelHelpers::ServiceContext& context, explicit Npad(KernelHelpers::ServiceContext& context, ResourceManager* resource);
std::shared_ptr<ResourceManager> resource);
~Npad(); ~Npad();
Result Activate(const u64 aruid); Result Activate(const u64 aruid);
@ -188,7 +187,7 @@ private:
float vibration_master_volume{}; float vibration_master_volume{};
KernelHelpers::ServiceContext& service_context; KernelHelpers::ServiceContext& service_context;
std::shared_ptr<ResourceManager> resource_manager = nullptr; ResourceManager* resource_manager;
}; };
} // namespace Service::HID } // namespace Service::HID

View File

@ -9,9 +9,9 @@
namespace Service::HID { namespace Service::HID {
PalmaState::PalmaState() {} Result PalmaState::Initialize() {
return ResultSuccess;
PalmaState::~PalmaState() = default; }
Result PalmaState::GetPalmaConnectionHandle(PalmaConnectionHandle& out_handle) const { Result PalmaState::GetPalmaConnectionHandle(PalmaConnectionHandle& out_handle) const {
if (npad_id != NpadIdType::Invalid) { if (npad_id != NpadIdType::Invalid) {
@ -41,6 +41,7 @@ Result PalmaState::GetPalmaOperationInfo(PalmaOperationType& out_type,
} }
// Too complicated here // Too complicated here
return ResultSuccess;
} }
Result PalmaState::PlayPalmaActivity(const u32 activity) const { Result PalmaState::PlayPalmaActivity(const u32 activity) const {
@ -48,7 +49,7 @@ Result PalmaState::PlayPalmaActivity(const u32 activity) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->PlayPalmaActivity(activity); const Result result = ResultSuccess; // xcd->PlayPalmaActivity(activity);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -58,7 +59,7 @@ Result PalmaState::SetPalmaFrModeType(const PalmaFrModeType type) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->SetPalmaFrModeType(type); const Result result = ResultSuccess; // xcd->SetPalmaFrModeType(type);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -68,7 +69,7 @@ Result PalmaState::ReadPalmaStep() const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->ReadPalmaStep(); const Result result = ResultSuccess; // xcd->ReadPalmaStep();
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -78,7 +79,7 @@ Result PalmaState::EnablePalmaStep(const bool is_enabled) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->EnablePalmaStep(is_enabled); const Result result = ResultSuccess; // xcd->EnablePalmaStep(is_enabled);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -88,7 +89,7 @@ Result PalmaState::ResetPalmaStep() const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->ResetPalmaStep(); const Result result = ResultSuccess; // xcd->ResetPalmaStep();
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -98,7 +99,7 @@ Result PalmaState::ReadPalmaApplicationSection(const u32 starting_index, u32 siz
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->ReadPalmaApplicationSection(starting_index, size); const Result result = ResultSuccess; // xcd->ReadPalmaApplicationSection(starting_index, size);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -109,7 +110,8 @@ Result PalmaState::WritePalmaApplicationSection(const u32 starting_index, u32 si
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->WritePalmaApplicationSection(starting_index, size, buffer); const Result result =
ResultSuccess; // xcd->WritePalmaApplicationSection(starting_index, size, buffer);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -119,7 +121,7 @@ Result PalmaState::ReadPalmaUniqueCode() const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->ReadPalmaUniqueCode(); const Result result = ResultSuccess; // xcd->ReadPalmaUniqueCode();
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -129,7 +131,7 @@ Result PalmaState::SetPalmaUniqueCodeInvalid() const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->SetPalmaUniqueCodeInvalid(); const Result result = ResultSuccess; // xcd->SetPalmaUniqueCodeInvalid();
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -146,7 +148,7 @@ Result PalmaState::WritePalmaActivityEntry(const u16 a, const u16 b, const u8 c,
} }
// TODO: Verify This one // TODO: Verify This one
const Result result = xcd->WritePalmaActivityEntry(a, b, c, d); const Result result = ResultSuccess; // xcd->WritePalmaActivityEntry(a, b, c, d);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -158,7 +160,7 @@ Result PalmaState::WritePalmaRgbLedPatternEntry(const u16 pattern_type,
} }
// TODO: Verify This one // TODO: Verify This one
const Result result = xcd->WritePalmaRgbLedPatternEntry(pattern_type, buffer); const Result result = ResultSuccess; // xcd->WritePalmaRgbLedPatternEntry(pattern_type, buffer);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -177,7 +179,8 @@ Result PalmaState::WritePalmaWaveEntry(const PalmaWaveSet wave_set,
} }
// TODO: Verify This one // TODO: Verify This one
const Result result = xcd->WritePalmaRgbLedPatternEntry(wave_set, t_mem, size); const Result result =
ResultSuccess; // xcd->WritePalmaRgbLedPatternEntry(wave_set, t_mem, size);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -186,7 +189,7 @@ Result PalmaState::SetPalmaDataBaseIdentificationVersion(const s32 version) cons
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->SetPalmaDataBaseIdentificationVersion(version); const Result result = ResultSuccess; // xcd->SetPalmaDataBaseIdentificationVersion(version);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -196,7 +199,7 @@ Result PalmaState::GetPalmaDataBaseIdentificationVersion() const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->GetPalmaDataBaseIdentificationVersion(); const Result result = ResultSuccess; // xcd->GetPalmaDataBaseIdentificationVersion();
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -206,7 +209,7 @@ Result PalmaState::SuspendPalmaFeature(const s32 feature) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->SuspendPalmaFeature(feature); const Result result = ResultSuccess; // xcd->SuspendPalmaFeature(feature);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -220,7 +223,7 @@ Result PalmaState::ReadPalmaPlayLog(const u32 entries) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->ReadPalmaPlayLog(entries); const Result result = ResultSuccess; // xcd->ReadPalmaPlayLog(entries);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -230,13 +233,13 @@ Result PalmaState::ResetPalmaPlayLog(const u32 entries) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->ResetPalmaPlayLog(entries); const Result result = ResultSuccess; // xcd->ResetPalmaPlayLog(entries);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
Result PalmaState::PairPalma() const { Result PalmaState::PairPalma() const {
return xcd->PairPalma(); return ResultSuccess; // xcd->PairPalma();
} }
Result PalmaState::CancelWritePalmaWaveEntry() const { Result PalmaState::CancelWritePalmaWaveEntry() const {
@ -244,7 +247,7 @@ Result PalmaState::CancelWritePalmaWaveEntry() const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
xcd->CancelWritePalmaWaveEntry(); // xcd->CancelWritePalmaWaveEntry();
return ResultSuccess; return ResultSuccess;
} }
@ -253,7 +256,7 @@ Result PalmaState::GetPalmaBluetoothAddress(std::span<u8> out_address) const {
return ResultInvalidPalmaHandle; return ResultInvalidPalmaHandle;
} }
const Result result = xcd->GetPalmaBluetoothAddress(out_address); const Result result = ResultSuccess; // xcd->GetPalmaBluetoothAddress(out_address);
return XcdResultToPalma(result); return XcdResultToPalma(result);
} }
@ -467,7 +470,8 @@ Result Palma::WritePalmaActivityEntry(const NpadIdType handle, const u64 a, cons
return result; return result;
} }
return palma_state[active_index].WritePalmaActivityEntry(a, b, c, d); return palma_state[active_index].WritePalmaActivityEntry(
static_cast<u16>(a), static_cast<u16>(b), static_cast<u8>(c), static_cast<u16>(d));
} }
Result Palma::WritePalmaRgbLedPatternEntry(const NpadIdType handle, const u16 pattern_type, Result Palma::WritePalmaRgbLedPatternEntry(const NpadIdType handle, const u16 pattern_type,

View File

@ -21,9 +21,6 @@ namespace Service::HID {
class PalmaState { class PalmaState {
public: public:
explicit PalmaState();
~PalmaState();
Result Initialize(); Result Initialize();
Result GetPalmaConnectionHandle(PalmaConnectionHandle& out_handle) const; Result GetPalmaConnectionHandle(PalmaConnectionHandle& out_handle) const;
Result AcquirePalmaOperationCompleteEvent(Kernel::KReadableEvent** out_event) const; Result AcquirePalmaOperationCompleteEvent(Kernel::KReadableEvent** out_event) const;