Merge NativeUpdate and NativeRender, we always call them together.

This commit is contained in:
Henrik Rydgård committed 2023-08-07 22:50:57 +02:00
1 parent 096c168dd7
commit bcae36d8cb
10 files changed
+48 -60

No files matched your search

+33 -33
View File
@@ -151,6 +151,8 @@
#include <Core/HLE/Plugins.h>
void HandleGlobalMessage(const std::string &msg, const std::string &value);
ScreenManager *g_screenManager;
std::string config_filename;
@@ -1047,14 +1049,43 @@ void RenderOverlays(UIContext *dc, void *userdata) {
}
}
void NativeRender(GraphicsContext *graphicsContext) {
void NativeFrame(GraphicsContext *graphicsContext) {
PROFILE_END_FRAME();
std::vector<PendingMessage> toProcess;
{
std::lock_guard<std::mutex> lock(pendingMutex);
toProcess = std::move(pendingMessages);
pendingMessages.clear();
}
for (const auto &item : toProcess) {
HandleGlobalMessage(item.msg, item.value);
g_screenManager->sendMessage(item.msg.c_str(), item.value.c_str());
}
g_requestManager.ProcessRequests();
// it's ok to call this redundantly with DoFrame from EmuScreen
Achievements::Idle();
g_DownloadManager.Update();
g_screenManager->update();
g_Discord.Update();
g_BackgroundAudio.Play();
g_OSD.Update();
UI::SetSoundEnabled(g_Config.bUISound);
_dbg_assert_(graphicsContext != nullptr);
_dbg_assert_(g_screenManager != nullptr);
g_GameManager.Update();
if (GetUIState() != UISTATE_INGAME) {
// Note: We do this from NativeRender so that the graphics context is
// Note: We do this from NativeFrame so that the graphics context is
// guaranteed valid, to be safe - g_gameInfoCache messes around with textures.
g_BackgroundAudio.Update();
}
@@ -1206,37 +1237,6 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
}
}
void NativeUpdate() {
PROFILE_END_FRAME();
std::vector<PendingMessage> toProcess;
{
std::lock_guard<std::mutex> lock(pendingMutex);
toProcess = std::move(pendingMessages);
pendingMessages.clear();
}
for (const auto &item : toProcess) {
HandleGlobalMessage(item.msg, item.value);
g_screenManager->sendMessage(item.msg.c_str(), item.value.c_str());
}
g_requestManager.ProcessRequests();
// it's ok to call this redundantly with DoFrame from EmuScreen
Achievements::Idle();
g_DownloadManager.Update();
g_screenManager->update();
g_Discord.Update();
g_BackgroundAudio.Play();
g_OSD.Update();
UI::SetSoundEnabled(g_Config.bUISound);
}
bool NativeIsAtTopLevel() {
// This might need some synchronization?
if (!g_screenManager) {