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

@ -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 {}; };