mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-12 19:37:01 +00:00
* script changes - no arguments * script changes with 2 arguments * script changes with > 2 arguments * script conversions with 1 argument - pt. 1 * script conversions with 1 argument - pt. 2 * script conversions with 1 argument - pt. 3 * script conversions with 1 argument - pt. 4 * script conversions with 1 argument - pt. 5 Pointer format hunting * Fixed pointer format * script conversions with 1 argument - final * fixed conversion in non utf-8 file * fixed conversion with capital letter * actually fixed conversion with capital letter * fixed another capital lettering issue * Added conversions with LR removed * removed LR from logs * Converted logs that previously contained LR * converted log that originally specified string length * fixed log with commas in main text * fixed multi-line log * Fixed more logs with commas in main text * Fixed unformatted pointer * added conversion with float value * converted lines with double parameters * converted missed line * corrected argument formatting Co-authored-by: Crementif <26669564+Crementif@users.noreply.github.com> * Fixed misspellings of "unhandled" unhandeled -> unhandled Co-authored-by: Crementif <26669564+Crementif@users.noreply.github.com> --------- Co-authored-by: Crementif <26669564+Crementif@users.noreply.github.com>
68 lines
2.1 KiB
C++
68 lines
2.1 KiB
C++
#include "Cafe/OS/common/OSCommon.h"
|
|
#include "Cafe/OS/libs/coreinit/coreinit_Thread.h"
|
|
#include "Cafe/OS/libs/coreinit/coreinit.h"
|
|
#include "iosu_ioctl.h"
|
|
#include "util/helpers/ringbuffer.h"
|
|
|
|
#include "util/helpers/Semaphore.h"
|
|
|
|
// deprecated IOCTL handling code
|
|
|
|
RingBuffer<ioQueueEntry_t*, 256> _ioctlRingbuffer[IOS_DEVICE_COUNT];
|
|
CounterSemaphore _ioctlRingbufferSemaphore[IOS_DEVICE_COUNT];
|
|
|
|
std::mutex ioctlMutex;
|
|
|
|
sint32 iosuIoctl_pushAndWait(uint32 ioctlHandle, ioQueueEntry_t* ioQueueEntry)
|
|
{
|
|
if (ioctlHandle != IOS_DEVICE_ACT && ioctlHandle != IOS_DEVICE_ACP_MAIN && ioctlHandle != IOS_DEVICE_MCP && ioctlHandle != IOS_DEVICE_BOSS && ioctlHandle != IOS_DEVICE_NIM && ioctlHandle != IOS_DEVICE_FPD)
|
|
{
|
|
cemuLog_logDebug(LogType::Force, "Unsupported IOSU device {}", ioctlHandle);
|
|
cemu_assert_debug(false);
|
|
return 0;
|
|
}
|
|
__OSLockScheduler();
|
|
ioctlMutex.lock();
|
|
ioQueueEntry->ppcThread = coreinitThread_getCurrentThreadDepr(ppcInterpreterCurrentInstance);
|
|
|
|
_ioctlRingbuffer[ioctlHandle].Push(ioQueueEntry);
|
|
ioctlMutex.unlock();
|
|
_ioctlRingbufferSemaphore[ioctlHandle].increment();
|
|
coreinit::__OSSuspendThreadInternal(coreinit::OSGetCurrentThread());
|
|
if (ioQueueEntry->isCompleted == false)
|
|
assert_dbg();
|
|
__OSUnlockScheduler();
|
|
return ioQueueEntry->returnValue;
|
|
}
|
|
|
|
ioQueueEntry_t* iosuIoctl_getNextWithWait(uint32 deviceIndex)
|
|
{
|
|
_ioctlRingbufferSemaphore[deviceIndex].decrementWithWait();
|
|
if (_ioctlRingbuffer[deviceIndex].HasData() == false)
|
|
assert_dbg();
|
|
return _ioctlRingbuffer[deviceIndex].Pop();
|
|
}
|
|
|
|
ioQueueEntry_t* iosuIoctl_getNextWithTimeout(uint32 deviceIndex, sint32 ms)
|
|
{
|
|
if (!_ioctlRingbufferSemaphore[deviceIndex].decrementWithWaitAndTimeout(ms))
|
|
return nullptr; // timeout or spurious wake up
|
|
if (_ioctlRingbuffer[deviceIndex].HasData() == false)
|
|
return nullptr;
|
|
return _ioctlRingbuffer[deviceIndex].Pop();
|
|
}
|
|
|
|
void iosuIoctl_completeRequest(ioQueueEntry_t* ioQueueEntry, uint32 returnValue)
|
|
{
|
|
ioQueueEntry->returnValue = returnValue;
|
|
ioQueueEntry->isCompleted = true;
|
|
coreinit::OSResumeThread(ioQueueEntry->ppcThread);
|
|
}
|
|
|
|
void iosuIoctl_init()
|
|
{
|
|
for (sint32 i = 0; i < IOS_DEVICE_COUNT; i++)
|
|
{
|
|
_ioctlRingbuffer[i].Clear();
|
|
}
|
|
}
|