mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-05 14:31:17 +12:00
Code clean up + replace some wstring instances with utf8 (#640)
This commit is contained in:
parent
ca79a6aa0d
commit
f3ff919be2
41 changed files with 163 additions and 641 deletions
|
@ -176,12 +176,11 @@ namespace coreinit
|
|||
alarm->setMagic();
|
||||
}
|
||||
|
||||
void coreinitExport_OSCreateAlarmEx(PPCInterpreter_t* hCPU)
|
||||
void OSCreateAlarmEx(OSAlarm_t* alarm, const char* alarmName)
|
||||
{
|
||||
OSAlarm_t* OSAlarm = (OSAlarm_t*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
|
||||
OSCreateAlarm(OSAlarm);
|
||||
OSAlarm->name = _swapEndianU32(hCPU->gpr[4]);
|
||||
osLib_returnFromFunction(hCPU, 0);
|
||||
memset(alarm, 0, sizeof(OSAlarm_t));
|
||||
alarm->setMagic();
|
||||
alarm->name = alarmName;
|
||||
}
|
||||
|
||||
std::unordered_map<OSAlarm_t*, OSHostAlarm*> g_activeAlarms;
|
||||
|
@ -274,14 +273,12 @@ namespace coreinit
|
|||
|
||||
void OSSetAlarmUserData(OSAlarm_t* alarm, uint32 userData)
|
||||
{
|
||||
alarm->userData = _swapEndianU32(userData);
|
||||
alarm->userData = userData;
|
||||
}
|
||||
|
||||
void coreinitExport_OSGetAlarmUserData(PPCInterpreter_t* hCPU)
|
||||
uint32 OSGetAlarmUserData(OSAlarm_t* alarm)
|
||||
{
|
||||
OSAlarm_t* OSAlarmBE = (OSAlarm_t*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
|
||||
MPTR userData = _swapEndianU32(OSAlarmBE->userData);
|
||||
osLib_returnFromFunction(hCPU, userData);
|
||||
return alarm->userData;
|
||||
}
|
||||
|
||||
void OSAlarm_resetAll()
|
||||
|
@ -337,15 +334,13 @@ namespace coreinit
|
|||
|
||||
void InitializeAlarm()
|
||||
{
|
||||
cafeExportRegister("coreinit", OSCreateAlarm, LogType::Placeholder);
|
||||
cafeExportRegister("coreinit", OSCancelAlarm, LogType::Placeholder);
|
||||
cafeExportRegister("coreinit", OSSetAlarm, LogType::Placeholder);
|
||||
cafeExportRegister("coreinit", OSSetPeriodicAlarm, LogType::Placeholder);
|
||||
|
||||
cafeExportRegister("coreinit", OSSetAlarmUserData, LogType::Placeholder);
|
||||
|
||||
osLib_addFunction("coreinit", "OSCreateAlarmEx", coreinitExport_OSCreateAlarmEx);
|
||||
osLib_addFunction("coreinit", "OSGetAlarmUserData", coreinitExport_OSGetAlarmUserData);
|
||||
cafeExportRegister("coreinit", OSCreateAlarm, LogType::CoreinitAlarm);
|
||||
cafeExportRegister("coreinit", OSCreateAlarmEx, LogType::CoreinitAlarm);
|
||||
cafeExportRegister("coreinit", OSCancelAlarm, LogType::CoreinitAlarm);
|
||||
cafeExportRegister("coreinit", OSSetAlarm, LogType::CoreinitAlarm);
|
||||
cafeExportRegister("coreinit", OSSetPeriodicAlarm, LogType::CoreinitAlarm);
|
||||
cafeExportRegister("coreinit", OSSetAlarmUserData, LogType::CoreinitAlarm);
|
||||
cafeExportRegister("coreinit", OSGetAlarmUserData, LogType::CoreinitAlarm);
|
||||
|
||||
// init event
|
||||
OSInitEvent(g_alarmEvent.GetPtr(), OSEvent::EVENT_STATE::STATE_NOT_SIGNALED, OSEvent::EVENT_MODE::MODE_AUTO);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
namespace coreinit
|
||||
{
|
||||
|
||||
class OSHostAlarm;
|
||||
OSHostAlarm* OSHostAlarmCreate(uint64 nextFire, uint64 period, void(*callbackFunc)(uint64 currentTick, void* context), void* context);
|
||||
void OSHostAlarmDestroy(OSHostAlarm* hostAlarm);
|
||||
|
@ -11,7 +10,7 @@ namespace coreinit
|
|||
struct OSAlarm_t
|
||||
{
|
||||
/* +0x00 */ betype<uint32> magic;
|
||||
/* +0x04 */ MPTR_UINT8 name;
|
||||
/* +0x04 */ MEMPTR<const char> name;
|
||||
/* +0x08 */ uint32 ukn08;
|
||||
/* +0x0C */ MPTR handler;
|
||||
/* +0x10 */ uint32 ukn10;
|
||||
|
@ -21,7 +20,7 @@ namespace coreinit
|
|||
/* +0x24 */ MPTR next; // pointer to OSAlarm
|
||||
/* +0x28 */ uint64 period; // period (zero for non-periodic timer)
|
||||
/* +0x30 */ uint64 startTime; // period start
|
||||
/* +0x38 */ MPTR userData;
|
||||
/* +0x38 */ uint32be userData;
|
||||
/* +0x3C */ uint32 ukn3C;
|
||||
/* +0x40 */ OSThreadQueue uknThreadQueue;
|
||||
/* +0x50 */ MPTR alarmQueue;
|
||||
|
|
|
@ -428,8 +428,8 @@ struct OSThread_t
|
|||
|
||||
/* +0x38C */ coreinit::OSThreadLink activeThreadChain; // queue of active threads (g_activeThreadQueue)
|
||||
|
||||
/* +0x394 */ MPTR_UINT8 stackBase; // upper limit of stack
|
||||
/* +0x398 */ MPTR_UINT32 stackEnd; // lower limit of stack
|
||||
/* +0x394 */ MPTR stackBase; // upper limit of stack
|
||||
/* +0x398 */ MPTR stackEnd; // lower limit of stack
|
||||
|
||||
/* +0x39C */ MPTR entrypoint;
|
||||
/* +0x3A0 */ crt_t crt;
|
||||
|
@ -443,8 +443,7 @@ struct OSThread_t
|
|||
/* +0x5C8 */ uint32 userStackPointer;
|
||||
|
||||
/* +0x5CC */ MEMPTR<void> cleanupCallback2;
|
||||
/* +0x5D0 */ //MPTR deallocator;
|
||||
MEMPTR<void> deallocatorFunc;
|
||||
/* +0x5D0 */ MEMPTR<void> deallocatorFunc;
|
||||
|
||||
/* +0x5D4 */ uint32 stateFlags; // 0x5D4 | various flags? Controls if canceling/suspension is allowed (at cancel points) or not? If 1 -> Cancel/Suspension not allowed, if 0 -> Cancel/Suspension allowed
|
||||
/* +0x5D8 */ betype<REQUEST_FLAG_BIT> requestFlags;
|
||||
|
|
|
@ -37,8 +37,8 @@ void gx2Export_GX2GetSwapStatus(PPCInterpreter_t* hCPU)
|
|||
{
|
||||
memory_writeU32(hCPU->gpr[3], _swapEndianU32(LatteGPUState.sharedArea->flipRequestCountBE));
|
||||
memory_writeU32(hCPU->gpr[4], _swapEndianU32(LatteGPUState.sharedArea->flipExecuteCountBE));
|
||||
memory_writeU64Slow(hCPU->gpr[5], lastSwapTime);
|
||||
memory_writeU64Slow(hCPU->gpr[6], lastSwapTime);
|
||||
memory_writeU64(hCPU->gpr[5], lastSwapTime);
|
||||
memory_writeU64(hCPU->gpr[6], lastSwapTime);
|
||||
|
||||
osLib_returnFromFunction(hCPU, 0);
|
||||
}
|
||||
|
@ -54,14 +54,14 @@ void gx2Export_GX2GetGPUTimeout(PPCInterpreter_t* hCPU)
|
|||
void gx2Export_GX2SampleTopGPUCycle(PPCInterpreter_t* hCPU)
|
||||
{
|
||||
gx2Log_printf("GX2SampleTopGPUCycle(0x%08x)\n", hCPU->gpr[3]);
|
||||
memory_writeU64Slow(hCPU->gpr[3], coreinit::coreinit_getTimerTick());
|
||||
memory_writeU64(hCPU->gpr[3], coreinit::coreinit_getTimerTick());
|
||||
osLib_returnFromFunction(hCPU, 0);
|
||||
}
|
||||
|
||||
void gx2Export_GX2SampleBottomGPUCycle(PPCInterpreter_t* hCPU)
|
||||
{
|
||||
gx2Log_printf("GX2SampleBottomGPUCycle(0x%08x)\n", hCPU->gpr[3]);
|
||||
memory_writeU64Slow(hCPU->gpr[3], GX2_INVALID_COUNTER_VALUE_U64);
|
||||
memory_writeU64(hCPU->gpr[3], GX2_INVALID_COUNTER_VALUE_U64);
|
||||
|
||||
osLib_returnFromFunction(hCPU, 0);
|
||||
return;
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace nn::temp
|
|||
forceLogDebug_printf("TEMPCreateAndInitTempDir(...) - placeholder");
|
||||
|
||||
// create random temp id
|
||||
memory_writeU64Slow(hCPU->gpr[5], tempIdGenerator);
|
||||
memory_writeU64(hCPU->gpr[5], tempIdGenerator);
|
||||
tempIdGenerator = (tempIdGenerator << 3) | (tempIdGenerator >> 61);
|
||||
tempIdGenerator += 0x56e28bd5f4ULL;
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace nsyshid
|
|||
deviceItr->hFile = openDevice(deviceItr->devicePath);
|
||||
if (deviceItr->hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
forceLog_printfW(L"HID: Failed to open device \"%s\"", deviceItr->devicePath);
|
||||
cemuLog_log(LogType::Force, "HID: Failed to open device \"{}\"", boost::nowide::narrow(std::wstring(deviceItr->devicePath)));
|
||||
return nullptr;
|
||||
}
|
||||
HidD_SetNumInputBuffers(deviceItr->hFile, 2); // dont cache too many reports
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue