Force disable some settings in headless mode

This commit is contained in:
Megamouse 2026-06-02 00:42:33 +02:00
parent 7c2bd56776
commit cc999d4210
7 changed files with 34 additions and 6 deletions

View File

@ -279,9 +279,32 @@ void init_fxo_for_exec(utils::serial* ar, bool full = false)
}
}
// Some settings are not allowed in certain PPU decoders
// Some settings are not allowed with certain conditions
static void fixup_settings(const psf::registry* _psf)
{
// Disable some incompatible settings in headless mode
if (Emu.IsHeadless())
{
if (g_cfg.video.renderer != video_renderer::null)
{
sys_log.warning("The video renderer '%s' is currently not supported in headless mode and will therefore be set to '%s'.", g_cfg.video.renderer.get(), video_renderer::null);
g_cfg.video.renderer.set(video_renderer::null);
}
if (g_cfg.io.camera == camera_handler::qt)
{
sys_log.warning("The camera handler '%s' is currently not supported in headless mode and will therefore be set to '%s'.", g_cfg.io.camera.get(), camera_handler::null);
g_cfg.io.camera.set(camera_handler::null);
}
if (g_cfg.audio.music == music_handler::qt)
{
sys_log.warning("The music handler '%s' is currently not supported in headless mode and will therefore be set to '%s'.", g_cfg.audio.music.get(), music_handler::null);
g_cfg.audio.music.set(music_handler::null);
}
}
// Some settings are not allowed in certain PPU decoders
if (g_cfg.core.ppu_decoder != ppu_decoder_type::_static)
{
if (g_cfg.core.ppu_use_nj_bit)

View File

@ -172,6 +172,7 @@ class Emulator final
bool m_continuous_mode = false;
bool m_has_gui = true;
bool m_headless = false;
bool m_add_database_config = false;
bool m_state_inspection_savestate = false;
@ -472,6 +473,9 @@ public:
bool HasGui() const { return m_has_gui; }
void SetHasGui(bool has_gui) { m_has_gui = has_gui; }
bool IsHeadless() const { return m_headless; }
void SetHeadless(bool headless) { m_headless = headless; }
void SetDefaultRenderer(video_renderer renderer) { m_default_renderer = renderer; }
void SetDefaultGraphicsAdapter(std::string adapter) { m_default_graphics_adapter = std::move(adapter); }

View File

@ -24,7 +24,7 @@ headless_application::headless_application(int& argc, char** argv) : QCoreApplic
bool headless_application::Init()
{
// Force init the emulator
InitializeEmulator(m_active_user.empty() ? "00000001" : m_active_user, false);
InitializeEmulator(m_active_user.empty() ? "00000001" : m_active_user, false, true);
// Create callbacks from the emulator, which reference the handlers.
InitializeCallbacks();

View File

@ -61,9 +61,10 @@ namespace rsx::overlays
extern void qt_events_aware_op(int repeat_duration_ms, std::function<bool()> wrapped_op);
/** Emu.Init() wrapper for user management */
void main_application::InitializeEmulator(const std::string& user, bool show_gui)
void main_application::InitializeEmulator(const std::string& user, bool show_gui, bool headless)
{
Emu.SetHasGui(show_gui);
Emu.SetHeadless(headless);
Emu.SetUsr(user);
Emu.Init();

View File

@ -11,7 +11,7 @@ class main_application
public:
virtual bool Init() = 0;
static void InitializeEmulator(const std::string& user, bool show_gui);
static void InitializeEmulator(const std::string& user, bool show_gui, bool headless);
void SetActiveUser(const std::string& user)
{

View File

@ -152,7 +152,7 @@ bool gui_application::Init()
}
// Force init the emulator
InitializeEmulator(m_active_user, m_show_gui);
InitializeEmulator(m_active_user, m_show_gui, false);
// Create callbacks from the emulator, which reference the handlers.
InitializeCallbacks();

View File

@ -365,7 +365,7 @@ void user_manager_dialog::OnUserLogin()
const u32 key = GetUserKey();
const std::string new_user = m_user_list[key].GetUserId();
main_application::InitializeEmulator(new_user, Emu.HasGui());
main_application::InitializeEmulator(new_user, Emu.HasGui(), Emu.IsHeadless());
m_active_user = new_user;
m_persistent_settings->SetValue(gui::persistent::active_user, QString::fromStdString(m_active_user));