Fix headless mode

This commit is contained in:
Megamouse 2021-11-14 16:49:32 +01:00
parent cfe08de951
commit 7dc3a50ddf
3 changed files with 24 additions and 3 deletions

View File

@ -105,7 +105,7 @@ public:
MsgDialogType type{};
std::function<void(s32 status)> on_close;
std::function<void(s32 status)> on_close = nullptr;
virtual ~MsgDialogBase();
virtual void Create(const std::string& msg, const std::string& title = "") = 0;

View File

@ -81,9 +81,8 @@ void progress_dialog_server::operator()()
}
}
if (!skip_this_one && !native_dlg)
if (!skip_this_one && !native_dlg && (dlg = Emu.GetCallbacks().get_msg_dialog()))
{
dlg = Emu.GetCallbacks().get_msg_dialog();
dlg->type.se_normal = true;
dlg->type.bg_invisible = true;
dlg->type.progress_bar_count = 1;

View File

@ -5,6 +5,7 @@
#include "Emu/Cell/Modules/cellOskDialog.h"
#include "Emu/Cell/Modules/cellSaveData.h"
#include "Emu/Cell/Modules/sceNpTrophy.h"
#include "Emu/Io/Null/null_camera_handler.h"
#include <clocale>
@ -87,6 +88,23 @@ void headless_application::InitializeCallbacks()
}
};
callbacks.get_camera_handler = []() -> std::shared_ptr<camera_handler_base>
{
switch (g_cfg.io.camera.get())
{
case camera_handler::null:
case camera_handler::fake:
{
return std::make_shared<null_camera_handler>();
}
case camera_handler::qt:
{
fmt::throw_exception("Headless mode can not be used with this camera handler. Current handler: %s", g_cfg.io.camera.get());
}
}
return nullptr;
};
callbacks.get_gs_frame = []() -> std::unique_ptr<GSFrameBase>
{
if (g_cfg.video.renderer != video_renderer::null)
@ -107,6 +125,10 @@ void headless_application::InitializeCallbacks()
callbacks.on_stop = []() {};
callbacks.on_ready = []() {};
callbacks.on_missing_fw = []() { return false; };
callbacks.handle_taskbar_progress = [](s32, s32) {};
callbacks.get_localized_string = [](localized_string_id, const char*) -> std::string { return {}; };
callbacks.get_localized_u32string = [](localized_string_id, const char*) -> std::u32string { return {}; };