early-access version 4048

This commit is contained in:
pineappleEA 2024-01-07 06:02:55 +01:00
parent dae302f84a
commit ce80dbf586
6 changed files with 79 additions and 28 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4047. This is the source code for early-access 4048.
## Legal Notice ## Legal Notice

View File

@ -81,7 +81,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
{522, nullptr, "SetJoyConRailEnabled"}, {522, nullptr, "SetJoyConRailEnabled"},
{523, nullptr, "IsJoyConRailEnabled"}, {523, nullptr, "IsJoyConRailEnabled"},
{524, nullptr, "IsHandheldHidsEnabled"}, {524, nullptr, "IsHandheldHidsEnabled"},
{525, nullptr, "IsJoyConAttachedOnAllRail"}, {525, &IHidSystemServer::IsJoyConAttachedOnAllRail, "IsJoyConAttachedOnAllRail"},
{540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"},
{541, nullptr, "GetPlayReportControllerUsages"}, {541, nullptr, "GetPlayReportControllerUsages"},
{542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"},
@ -131,7 +131,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
{1001, nullptr, "GetFirmwareVersion"}, {1001, nullptr, "GetFirmwareVersion"},
{1002, nullptr, "GetAvailableFirmwareVersion"}, {1002, nullptr, "GetAvailableFirmwareVersion"},
{1003, nullptr, "IsFirmwareUpdateAvailable"}, {1003, nullptr, "IsFirmwareUpdateAvailable"},
{1004, nullptr, "CheckFirmwareUpdateRequired"}, {1004, &IHidSystemServer::CheckFirmwareUpdateRequired, "CheckFirmwareUpdateRequired"},
{1005, nullptr, "StartFirmwareUpdate"}, {1005, nullptr, "StartFirmwareUpdate"},
{1006, nullptr, "AbortFirmwareUpdate"}, {1006, nullptr, "AbortFirmwareUpdate"},
{1007, nullptr, "GetFirmwareUpdateState"}, {1007, nullptr, "GetFirmwareUpdateState"},
@ -144,9 +144,9 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
{1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"}, {1052, nullptr, "CancelSixAxisSensorAccurateUserCalibration"},
{1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"}, {1053, nullptr, "GetSixAxisSensorAccurateUserCalibrationState"},
{1100, nullptr, "GetHidbusSystemServiceObject"}, {1100, nullptr, "GetHidbusSystemServiceObject"},
{1120, nullptr, "SetFirmwareHotfixUpdateSkipEnabled"}, {1120, &IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled, "SetFirmwareHotfixUpdateSkipEnabled"},
{1130, nullptr, "InitializeUsbFirmwareUpdate"}, {1130, &IHidSystemServer::InitializeUsbFirmwareUpdate, "InitializeUsbFirmwareUpdate"},
{1131, nullptr, "FinalizeUsbFirmwareUpdate"}, {1131, &IHidSystemServer::FinalizeUsbFirmwareUpdate, "FinalizeUsbFirmwareUpdate"},
{1132, nullptr, "CheckUsbFirmwareUpdateRequired"}, {1132, nullptr, "CheckUsbFirmwareUpdateRequired"},
{1133, nullptr, "StartUsbFirmwareUpdate"}, {1133, nullptr, "StartUsbFirmwareUpdate"},
{1134, nullptr, "GetUsbFirmwareUpdateState"}, {1134, nullptr, "GetUsbFirmwareUpdateState"},
@ -196,7 +196,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
{1268, nullptr, "DeleteButtonConfigStorageFull"}, {1268, nullptr, "DeleteButtonConfigStorageFull"},
{1269, nullptr, "DeleteButtonConfigStorageLeft"}, {1269, nullptr, "DeleteButtonConfigStorageLeft"},
{1270, nullptr, "DeleteButtonConfigStorageRight"}, {1270, nullptr, "DeleteButtonConfigStorageRight"},
{1271, nullptr, "IsUsingCustomButtonConfig"}, {1271, &IHidSystemServer::IsUsingCustomButtonConfig, "IsUsingCustomButtonConfig"},
{1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, {1272, nullptr, "IsAnyCustomButtonConfigEnabled"},
{1273, nullptr, "SetAllCustomButtonConfigEnabled"}, {1273, nullptr, "SetAllCustomButtonConfigEnabled"},
{1274, nullptr, "SetDefaultButtonConfig"}, {1274, nullptr, "SetDefaultButtonConfig"},
@ -555,6 +555,16 @@ void IHidSystemServer::EnableAppletToGetTouchScreen(HLERequestContext& ctx) {
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void IHidSystemServer::IsJoyConAttachedOnAllRail(HLERequestContext& ctx) {
const bool is_attached = true;
LOG_DEBUG(Service_HID, "(STUBBED) called, is_attached={}", is_attached);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(is_attached);
}
void IHidSystemServer::AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx) { void IHidSystemServer::AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx) {
LOG_INFO(Service_AM, "(STUBBED) called"); LOG_INFO(Service_AM, "(STUBBED) called");
@ -641,6 +651,34 @@ void IHidSystemServer::InitializeFirmwareUpdate(HLERequestContext& ctx) {
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void IHidSystemServer::CheckFirmwareUpdateRequired(HLERequestContext& ctx) {
LOG_WARNING(Service_HID, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IHidSystemServer::SetFirmwareHotfixUpdateSkipEnabled(HLERequestContext& ctx) {
LOG_WARNING(Service_HID, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IHidSystemServer::InitializeUsbFirmwareUpdate(HLERequestContext& ctx) {
LOG_WARNING(Service_HID, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IHidSystemServer::FinalizeUsbFirmwareUpdate(HLERequestContext& ctx) {
LOG_WARNING(Service_HID, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
void IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx) { void IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx) {
LOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
@ -665,6 +703,16 @@ void IHidSystemServer::GetTouchScreenDefaultConfiguration(HLERequestContext& ctx
rb.PushRaw(touchscreen_config); rb.PushRaw(touchscreen_config);
} }
void IHidSystemServer::IsUsingCustomButtonConfig(HLERequestContext& ctx) {
const bool is_enabled = false;
LOG_DEBUG(Service_HID, "(STUBBED) called, is_enabled={}", is_enabled);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(is_enabled);
}
std::shared_ptr<ResourceManager> IHidSystemServer::GetResourceManager() { std::shared_ptr<ResourceManager> IHidSystemServer::GetResourceManager() {
resource_manager->Initialize(); resource_manager->Initialize();
return resource_manager; return resource_manager;

View File

@ -44,6 +44,7 @@ private:
void EnableAppletToGetSixAxisSensor(HLERequestContext& ctx); void EnableAppletToGetSixAxisSensor(HLERequestContext& ctx);
void EnableAppletToGetPadInput(HLERequestContext& ctx); void EnableAppletToGetPadInput(HLERequestContext& ctx);
void EnableAppletToGetTouchScreen(HLERequestContext& ctx); void EnableAppletToGetTouchScreen(HLERequestContext& ctx);
void IsJoyConAttachedOnAllRail(HLERequestContext& ctx);
void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx); void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx);
void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx); void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx);
void GetRegisteredDevices(HLERequestContext& ctx); void GetRegisteredDevices(HLERequestContext& ctx);
@ -53,8 +54,13 @@ private:
void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx); void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx);
void IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx); void IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx);
void InitializeFirmwareUpdate(HLERequestContext& ctx); void InitializeFirmwareUpdate(HLERequestContext& ctx);
void CheckFirmwareUpdateRequired(HLERequestContext& ctx);
void SetFirmwareHotfixUpdateSkipEnabled(HLERequestContext& ctx);
void InitializeUsbFirmwareUpdate(HLERequestContext& ctx);
void FinalizeUsbFirmwareUpdate(HLERequestContext& ctx);
void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx); void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx);
void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx); void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx);
void IsUsingCustomButtonConfig(HLERequestContext& ctx);
std::shared_ptr<ResourceManager> GetResourceManager(); std::shared_ptr<ResourceManager> GetResourceManager();

View File

@ -224,6 +224,7 @@ Result ResourceManager::RegisterAppletResourceUserId(u64 aruid, bool bool_value)
void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) { void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) {
std::scoped_lock lock{shared_mutex}; std::scoped_lock lock{shared_mutex};
applet_resource->UnregisterAppletResourceUserId(aruid); applet_resource->UnregisterAppletResourceUserId(aruid);
npad->UnregisterAppletResourceUserId(aruid);
} }
Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) { Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {

View File

@ -87,7 +87,9 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input
data_index = i; data_index = i;
break; break;
} }
if (registration_list.flag[i] == RegistrationStatus::None) { // TODO: Don't Handle pending delete here
if (registration_list.flag[i] == RegistrationStatus::None ||
registration_list.flag[i] == RegistrationStatus::PendingDelete) {
data_index = i; data_index = i;
break; break;
} }
@ -104,30 +106,22 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input
} }
void AppletResource::UnregisterAppletResourceUserId(u64 aruid) { void AppletResource::UnregisterAppletResourceUserId(u64 aruid) {
u64 index = GetIndexFromAruid(aruid); const u64 index = GetIndexFromAruid(aruid);
if (index < AruidIndexMax) { if (index >= AruidIndexMax) {
if (data[index].flag.is_assigned) { return;
data[index].shared_memory_format = nullptr;
data[index].flag.is_assigned.Assign(false);
}
} }
index = GetIndexFromAruid(aruid); FreeAppletResourceId(aruid);
if (index < AruidIndexMax) { DestroySevenSixAxisTransferMemory();
DestroySevenSixAxisTransferMemory(); data[index].flag.raw = 0;
data[index].flag.raw = 0; data[index].aruid = 0;
data[index].aruid = 0;
index = GetIndexFromAruid(aruid); registration_list.flag[index] = RegistrationStatus::PendingDelete;
if (index < AruidIndexMax) {
registration_list.flag[index] = RegistrationStatus::PendingDelete;
}
}
} }
void AppletResource::FreeAppletResourceId(u64 aruid) { void AppletResource::FreeAppletResourceId(u64 aruid) {
u64 index = GetIndexFromAruid(aruid); const u64 index = GetIndexFromAruid(aruid);
if (index >= AruidIndexMax) { if (index >= AruidIndexMax) {
return; return;
} }
@ -144,7 +138,7 @@ u64 AppletResource::GetActiveAruid() {
} }
Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) { Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
u64 index = GetIndexFromAruid(aruid); const u64 index = GetIndexFromAruid(aruid);
if (index >= AruidIndexMax) { if (index >= AruidIndexMax) {
return ResultAruidNotRegistered; return ResultAruidNotRegistered;
} }
@ -155,7 +149,7 @@ Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle,
Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format, Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format,
u64 aruid) { u64 aruid) {
u64 index = GetIndexFromAruid(aruid); const u64 index = GetIndexFromAruid(aruid);
if (index >= AruidIndexMax) { if (index >= AruidIndexMax) {
return ResultAruidNotRegistered; return ResultAruidNotRegistered;
} }

View File

@ -46,7 +46,9 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) {
data_index = i; data_index = i;
break; break;
} }
if (registration_list.flag[i] == RegistrationStatus::None) { // TODO: Don't Handle pending delete here
if (registration_list.flag[i] == RegistrationStatus::None ||
registration_list.flag[i] == RegistrationStatus::PendingDelete) {
data_index = i; data_index = i;
break; break;
} }