called at the beginning of OSReceiveMessage if the queue is the system message queue
| 498 | |
| 499 | // called at the beginning of OSReceiveMessage if the queue is the system message queue |
| 500 | void UpdateSystemMessageQueue() |
| 501 | { |
| 502 | if(!OSIsInterruptEnabled()) |
| 503 | return; |
| 504 | cemu_assert_debug(!__OSHasSchedulerLock()); |
| 505 | // normally syscall 0x2E is used to get the next message |
| 506 | // for now we just have some preliminary logic here to allow a fake transition to background & foreground |
| 507 | if(s_transitionToBackground) |
| 508 | { |
| 509 | // add transition to background message |
| 510 | OSMessage msg{}; |
| 511 | msg.data0 = stdx::to_underlying(SysMessageId::MsgReleaseForeground); |
| 512 | msg.data1 = 0; // 1 -> System is shutting down 0 -> Begin transitioning to background |
| 513 | OSMessageQueue* systemMessageQueue = coreinit::OSGetSystemMessageQueue(); |
| 514 | if(OSSendMessage(systemMessageQueue, &msg, 0)) |
| 515 | s_transitionToBackground = false; |
| 516 | return; |
| 517 | } |
| 518 | if(s_transitionToForeground) |
| 519 | { |
| 520 | // add transition to foreground message |
| 521 | OSMessage msg{}; |
| 522 | msg.data0 = stdx::to_underlying(SysMessageId::MsgAcquireForeground); |
| 523 | msg.data1 = 1; // ? |
| 524 | msg.data2 = 1; // ? |
| 525 | OSMessageQueue* systemMessageQueue = coreinit::OSGetSystemMessageQueue(); |
| 526 | if(OSSendMessage(systemMessageQueue, &msg, 0)) |
| 527 | s_transitionToForeground = false; |
| 528 | return; |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | // called when OSReceiveMessage returns a message from the system message queue |
| 533 | void HandleReceivedSystemMessage(OSMessage* msg) |
no test coverage detected