btdrv-mitm: create fake buffer in shared memory for all firmwares

This commit is contained in:
ndeadly 2020-08-05 20:38:31 +02:00
parent e310d89491
commit 1d55a4539c

View file

@ -96,9 +96,6 @@ 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);
@ -116,15 +113,9 @@ namespace ams::bluetooth::hid::report {
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<bluetooth::CircularBuffer *>(shmemGetAddr(&g_fakeBtShmem));
}
R_TRY(shmemCreate(&g_fakeBtShmem, BLUETOOTH_SHAREDMEM_SIZE, Perm_Rw, Perm_Rw));
R_TRY(shmemMap(&g_fakeBtShmem));
g_fakeBuffer = reinterpret_cast<bluetooth::CircularBuffer *>(shmemGetAddr(&g_fakeBtShmem));
g_fakeBuffer->Initialize("HID Report");
g_fakeBuffer->type = bluetooth::CircularBufferType_HidReport;