temp fix for dpad
This commit is contained in:
parent
2b48a6e645
commit
ad417d0523
|
|
@ -41,6 +41,7 @@ constexpr u32 EXPECTED_MAGIC = 0x36f81a1e; // What we expect the encrypted bftt
|
|||
constexpr u64 SHARED_FONT_MEM_SIZE = 0x1100000;
|
||||
constexpr FontRegion EMPTY_REGION{0, 0};
|
||||
|
||||
#ifndef __OPENORBIS__
|
||||
static void DecryptSharedFont(const std::span<u32 const> input, std::span<u8> output, std::size_t& offset) {
|
||||
ASSERT(offset + (input.size() * sizeof(u32)) < SHARED_FONT_MEM_SIZE && "Shared fonts exceeds 17mb!");
|
||||
ASSERT(input[0] == EXPECTED_MAGIC && "Failed to derive key, unexpected magic number");
|
||||
|
|
@ -52,6 +53,7 @@ static void DecryptSharedFont(const std::span<u32 const> input, std::span<u8> ou
|
|||
std::memcpy(output.data() + offset, transformed_font.data(), transformed_font.size() * sizeof(u32));
|
||||
offset += transformed_font.size() * sizeof(u32);
|
||||
}
|
||||
#endif
|
||||
|
||||
void DecryptSharedFontToTTF(const std::vector<u32>& input, std::vector<u8>& output) {
|
||||
ASSERT_MSG(input[0] == EXPECTED_MAGIC, "Failed to derive key, unexpected magic number");
|
||||
|
|
@ -84,8 +86,10 @@ struct IPlatformServiceManager::Impl {
|
|||
// Automatically populated based on shared_fonts dump or system archives.
|
||||
// 6 builtin fonts + extra 2 for whatever may come after
|
||||
boost::container::static_vector<FontRegion, 8> shared_font_regions;
|
||||
#ifndef __OPENORBIS__
|
||||
/// Backing memory for the shared font data
|
||||
std::array<u8, SHARED_FONT_MEM_SIZE> shared_font;
|
||||
#endif
|
||||
};
|
||||
|
||||
IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const char* service_name_)
|
||||
|
|
@ -112,8 +116,8 @@ IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const ch
|
|||
// clang-format on
|
||||
RegisterHandlers(functions);
|
||||
|
||||
#ifndef __OPENORBIS__
|
||||
auto& fsc = system.GetFileSystemController();
|
||||
|
||||
// Attempt to load shared font data from disk
|
||||
const auto* nand = fsc.GetSystemNANDContents();
|
||||
std::size_t offset = 0;
|
||||
|
|
@ -145,6 +149,7 @@ IPlatformServiceManager::IPlatformServiceManager(Core::System& system_, const ch
|
|||
LOG_ERROR(Service_NS, "Failed to find or synthesize {:016X}! Skipping", font.first);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
IPlatformServiceManager::~IPlatformServiceManager() = default;
|
||||
|
|
@ -178,8 +183,10 @@ Result IPlatformServiceManager::GetSharedMemoryNativeHandle(OutCopyHandle<Kernel
|
|||
// Map backing memory for the font data
|
||||
LOG_DEBUG(Service_NS, "called");
|
||||
|
||||
#ifndef __OPENORBIS__
|
||||
// Create shared font memory object
|
||||
std::memcpy(kernel.GetFontSharedMem().GetPointer(), impl->shared_font.data(), impl->shared_font.size());
|
||||
#endif
|
||||
|
||||
// FIXME: this shouldn't belong to the kernel
|
||||
*out_shared_memory_native_handle = &kernel.GetFontSharedMem();
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ Result ResourceManager::CreateAppletResource(u64 aruid) {
|
|||
}
|
||||
|
||||
Result ResourceManager::CreateAppletResourceImpl(u64 aruid) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
return applet_resource->CreateAppletResource(aruid);
|
||||
}
|
||||
|
||||
|
|
@ -291,17 +291,17 @@ void ResourceManager::InitializeAHidSampler() {
|
|||
}
|
||||
|
||||
Result ResourceManager::RegisterCoreAppletResource() {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
return applet_resource->RegisterCoreAppletResource();
|
||||
}
|
||||
|
||||
Result ResourceManager::UnregisterCoreAppletResource() {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
return applet_resource->UnregisterCoreAppletResource();
|
||||
}
|
||||
|
||||
Result ResourceManager::RegisterAppletResourceUserId(u64 aruid, bool bool_value) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
auto result = applet_resource->RegisterAppletResourceUserId(aruid, bool_value);
|
||||
if (result.IsSuccess()) {
|
||||
result = npad->RegisterAppletResourceUserId(aruid);
|
||||
|
|
@ -310,40 +310,40 @@ Result ResourceManager::RegisterAppletResourceUserId(u64 aruid, bool bool_value)
|
|||
}
|
||||
|
||||
void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
applet_resource->UnregisterAppletResourceUserId(aruid);
|
||||
npad->UnregisterAppletResourceUserId(aruid);
|
||||
// palma->UnregisterAppletResourceUserId(aruid);
|
||||
}
|
||||
|
||||
Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
return applet_resource->GetSharedMemoryHandle(out_handle, aruid);
|
||||
}
|
||||
|
||||
void ResourceManager::FreeAppletResourceId(u64 aruid) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
applet_resource->FreeAppletResourceId(aruid);
|
||||
npad->FreeAppletResourceId(aruid);
|
||||
}
|
||||
|
||||
void ResourceManager::EnableInput(u64 aruid, bool is_enabled) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
applet_resource->EnableInput(aruid, is_enabled);
|
||||
}
|
||||
|
||||
void ResourceManager::EnableSixAxisSensor(u64 aruid, bool is_enabled) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
applet_resource->EnableSixAxisSensor(aruid, is_enabled);
|
||||
}
|
||||
|
||||
void ResourceManager::EnablePadInput(u64 aruid, bool is_enabled) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
applet_resource->EnablePadInput(aruid, is_enabled);
|
||||
}
|
||||
|
||||
void ResourceManager::EnableTouchScreen(u64 aruid, bool is_enabled) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
applet_resource->EnableTouchScreen(aruid, is_enabled);
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ NpadGcVibrationDevice* ResourceManager::GetGcVibrationDevice(
|
|||
}
|
||||
|
||||
Result ResourceManager::SetAruidValidForVibration(u64 aruid, bool is_enabled) {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
const bool has_changed = applet_resource->SetAruidValidForVibration(aruid, is_enabled);
|
||||
|
||||
if (has_changed) {
|
||||
|
|
@ -391,7 +391,7 @@ void ResourceManager::SetForceHandheldStyleVibration(bool is_forced) {
|
|||
}
|
||||
|
||||
Result ResourceManager::IsVibrationAruidActive(u64 aruid, bool& is_active) const {
|
||||
std::scoped_lock lock{shared_mutex};
|
||||
//std::scoped_lock lock{shared_mutex};
|
||||
is_active = applet_resource->IsVibrationAruidActive(aruid);
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ void AbstractPad::Update() {
|
|||
|
||||
interface_type = properties_handler.GetInterfaceType();
|
||||
|
||||
std::scoped_lock lock{*applet_resource_holder->shared_mutex};
|
||||
//std::scoped_lock lock{*applet_resource_holder->shared_mutex};
|
||||
properties_handler.UpdateAllDeviceProperties();
|
||||
battery_handler.UpdateCoreBatteryState();
|
||||
button_handler.UpdateCoreBatteryState();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ void DebugPad::OnInit() {}
|
|||
void DebugPad::OnRelease() {}
|
||||
|
||||
void DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void Digitizer::OnInit() {}
|
|||
void Digitizer::OnRelease() {}
|
||||
|
||||
void Digitizer::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void Keyboard::OnInit() {}
|
|||
void Keyboard::OnRelease() {}
|
||||
|
||||
void Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ void DebugMouse::OnInit() {}
|
|||
void DebugMouse::OnRelease() {}
|
||||
|
||||
void DebugMouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ void Mouse::OnInit() {}
|
|||
void Mouse::OnRelease() {}
|
||||
|
||||
void Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ Result NPad::Activate() {
|
|||
|
||||
Result NPad::Activate(u64 aruid) {
|
||||
std::scoped_lock lock{mutex};
|
||||
std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
|
||||
//std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
|
||||
|
||||
auto* data = applet_resource_holder.applet_resource->GetAruidData(aruid);
|
||||
const auto aruid_index = applet_resource_holder.applet_resource->GetIndexFromAruid(aruid);
|
||||
|
|
@ -393,7 +393,7 @@ void NPad::WriteEmptyEntry(NpadInternalState* npad) {
|
|||
}
|
||||
|
||||
void NPad::RequestPadStateUpdate(u64 aruid, Core::HID::NpadIdType npad_id) {
|
||||
std::scoped_lock lock{*applet_resource_holder.shared_mutex};
|
||||
//std::scoped_lock lock{*applet_resource_holder.shared_mutex};
|
||||
auto& controller = GetControllerFromNpadIdType(aruid, npad_id);
|
||||
const auto controller_type = controller.device->GetNpadStyleIndex();
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
|||
return;
|
||||
}
|
||||
|
||||
std::scoped_lock lock{*applet_resource_holder.shared_mutex};
|
||||
//std::scoped_lock lock{*applet_resource_holder.shared_mutex};
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; ++aruid_index) {
|
||||
const auto* data = applet_resource_holder.applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
||||
|
|
@ -1221,7 +1221,7 @@ Result NPad::SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled) {
|
|||
const auto result = npad_resource.SetNpadSystemExtStateEnabled(aruid, is_enabled);
|
||||
|
||||
if (result.IsSuccess()) {
|
||||
std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
|
||||
//std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
|
||||
// TODO: abstracted_pad->EnableAppletToGetInput(aruid);
|
||||
}
|
||||
|
||||
|
|
@ -1339,8 +1339,7 @@ void NPad::UpdateHandheldAbstractState() {
|
|||
|
||||
void NPad::EnableAppletToGetInput(u64 aruid) {
|
||||
std::scoped_lock lock{mutex};
|
||||
std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
|
||||
|
||||
//std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
|
||||
for (auto& abstract_pad : abstracted_pads) {
|
||||
abstract_pad.EnableAppletToGetInput(aruid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ void ConsoleSixAxis::OnInit() {}
|
|||
void ConsoleSixAxis::OnRelease() {}
|
||||
|
||||
void ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ void SixAxis::OnInit() {}
|
|||
void SixAxis::OnRelease() {}
|
||||
|
||||
void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; ++aruid_index) {
|
||||
const auto* data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void CaptureButton::OnInit() {}
|
|||
void CaptureButton::OnRelease() {}
|
||||
|
||||
void CaptureButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void HomeButton::OnInit() {}
|
|||
void HomeButton::OnRelease() {}
|
||||
|
||||
void HomeButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ void SleepButton::OnInit() {}
|
|||
void SleepButton::OnRelease() {}
|
||||
|
||||
void SleepButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||
std::scoped_lock shared_lock{*shared_mutex};
|
||||
//std::scoped_lock shared_lock{*shared_mutex};
|
||||
const u64 aruid = applet_resource->GetActiveAruid();
|
||||
auto* data = applet_resource->GetAruidData(aruid);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Result TouchResource::ActivateTouch() {
|
|||
}
|
||||
|
||||
if (global_ref_counter == 0) {
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
const auto result = touch_driver->StartTouchSensor();
|
||||
if (result.IsError()) {
|
||||
|
|
@ -60,7 +60,7 @@ Result TouchResource::ActivateTouch() {
|
|||
}
|
||||
|
||||
Result TouchResource::ActivateTouch(u64 aruid) {
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) {
|
||||
auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
@ -121,7 +121,7 @@ Result TouchResource::ActivateGesture() {
|
|||
}
|
||||
|
||||
Result TouchResource::ActivateGesture(u64 aruid, u32 basic_gesture_id) {
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) {
|
||||
auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
@ -300,7 +300,7 @@ void TouchResource::SetTouchScreenMagnification(f32 point1_x, f32 point1_y, f32
|
|||
}
|
||||
|
||||
Result TouchResource::SetTouchScreenResolution(u32 width, u32 height, u64 aruid) {
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) {
|
||||
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
@ -321,7 +321,7 @@ Result TouchResource::SetTouchScreenResolution(u32 width, u32 height, u64 aruid)
|
|||
|
||||
Result TouchResource::SetTouchScreenConfiguration(
|
||||
const Core::HID::TouchScreenConfigurationForNx& touch_configuration, u64 aruid) {
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) {
|
||||
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
@ -341,7 +341,7 @@ Result TouchResource::SetTouchScreenConfiguration(
|
|||
|
||||
Result TouchResource::GetTouchScreenConfiguration(
|
||||
Core::HID::TouchScreenConfigurationForNx& out_touch_configuration, u64 aruid) const {
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) {
|
||||
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
@ -518,7 +518,7 @@ void TouchResource::OnTouchUpdate(s64 timestamp) {
|
|||
gesture_handler.SetTouchState(current_touch_state.states, current_touch_state.entry_count,
|
||||
timestamp);
|
||||
|
||||
std::scoped_lock lock{*shared_mutex};
|
||||
//std::scoped_lock lock{*shared_mutex};
|
||||
|
||||
for (std::size_t aruid_index = 0; aruid_index < AruidIndexMax; aruid_index++) {
|
||||
const auto* applet_data = applet_resource->GetAruidDataByIndex(aruid_index);
|
||||
|
|
|
|||
Loading…
Reference in New Issue