mirror of
https://github.com/ndeadly/MissionControl
synced 2024-11-26 22:30:21 +00:00
btdrv-mitm: change shared memory initialisation function to also initialise report buffer on firmware < 7.0.0
This commit is contained in:
parent
42e49af006
commit
990f704480
3 changed files with 29 additions and 3 deletions
|
@ -95,6 +95,9 @@ namespace ams::bluetooth::hid::report {
|
|||
void Finalize(void) {
|
||||
os::DestroyThread(&g_eventHandlerThread);
|
||||
|
||||
//if (hos::GetVersion() < hos::Version_7_0_0)
|
||||
//delete g_fakeBuffer;
|
||||
|
||||
os::DestroySystemEvent(&g_btHidReportSystemEventUser);
|
||||
os::DestroySystemEvent(&g_btHidReportSystemEventFwd);
|
||||
|
||||
|
@ -110,6 +113,27 @@ namespace ams::bluetooth::hid::report {
|
|||
return ams::ResultSuccess();
|
||||
}
|
||||
|
||||
Result InitializeReportBuffer(void) {
|
||||
BTDRV_LOG_FMT("btdrv-mitm: InitializeReportBuffer");
|
||||
|
||||
// Todo: maybe just create shared memory for all fw?
|
||||
if (hos::GetVersion() < hos::Version_7_0_0) {
|
||||
g_fakeBuffer = new CircularBuffer();
|
||||
}
|
||||
else {
|
||||
R_TRY(shmemCreate(&g_fakeBtShmem, BLUETOOTH_SHAREDMEM_SIZE, Perm_Rw, Perm_Rw));
|
||||
R_TRY(shmemMap(&g_fakeBtShmem));
|
||||
g_fakeBuffer = reinterpret_cast<CircularBuffer *>(shmemGetAddr(&g_fakeBtShmem));
|
||||
}
|
||||
|
||||
g_fakeBuffer->Initialize("HID Report");
|
||||
g_fakeBuffer->type = CircularBufferType_HidReport;
|
||||
g_fakeBuffer->_unk3 = 1;
|
||||
|
||||
return ams::ResultSuccess();
|
||||
}
|
||||
|
||||
/*
|
||||
Result InitializeFakeSharedMemory(void) {
|
||||
R_TRY(shmemCreate(&g_fakeBtShmem, BLUETOOTH_SHAREDMEM_SIZE, Perm_Rw, Perm_Rw));
|
||||
R_TRY(shmemMap(&g_fakeBtShmem));
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace ams::bluetooth::hid::report {
|
|||
void Finalize(void);
|
||||
|
||||
Result MapRemoteSharedMemory(Handle handle);
|
||||
Result InitializeFakeSharedMemory(void);
|
||||
//Result InitializeFakeSharedMemory(void);
|
||||
Result InitializeReportBuffer(void);
|
||||
|
||||
Result WriteFakeHidData(const Address *address, const HidData *data);
|
||||
|
||||
|
|
|
@ -18,9 +18,10 @@ namespace ams::mitm::btdrv {
|
|||
Handle handle = INVALID_HANDLE;
|
||||
R_TRY(btdrvInitializeBluetoothFwd(this->forward_service.get(), &handle));
|
||||
R_TRY(bluetooth::core::Initialize(handle));
|
||||
R_TRY(bluetooth::hid::report::InitializeReportBuffer());
|
||||
|
||||
if (hos::GetVersion() >= hos::Version_7_0_0)
|
||||
R_TRY(bluetooth::hid::report::InitializeFakeSharedMemory());
|
||||
//if (hos::GetVersion() >= hos::Version_7_0_0)
|
||||
//R_TRY(bluetooth::hid::report::InitializeFakeSharedMemory());
|
||||
|
||||
out_handle.SetValue(os::GetReadableHandleOfSystemEvent(bluetooth::core::GetForwardEvent()));
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue