mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-12 19:05:45 -04:00
Frontends: Add shared command line interface
Also provides batch mode and automatic fullscreen switching. -help: Displays this information and exits. -version: Displays version information and exits. -batch: Enables batch mode (exits after powering off) -fastboot: Force fast boot for provided filename -slowboot: Force slow boot for provided filename -resume: Load resume save state. If a boot filename is provided, that game's resume state will be loaded, otherwise the most recent resume save state will be loaded. -state <index>: Loads specified save state by index. If a boot filename is provided, a per-game state will be loaded, otherwise a global state will be loaded. -statefile <filename>: Loads state from the specified filename. No boot filename is required with this option. -fullscreen: Enters fullscreen mode immediately after starting. -nofullscreen: Prevents fullscreen mode from triggering if enabled. -portable: Forces "portable mode", data in same directory. --: Signals that no more arguments will follow and the remaining parameters make up the filename. Use when the filename contains spaces or starts with a dash.
This commit is contained in:
@ -61,6 +61,14 @@ void HostInterface::CreateAudioStream()
|
||||
|
||||
bool HostInterface::BootSystem(const SystemBootParameters& parameters)
|
||||
{
|
||||
if (parameters.filename.empty())
|
||||
Log_InfoPrintf("Boot Filename: <BIOS/Shell>");
|
||||
else
|
||||
Log_InfoPrintf("Boot Filename: %s", parameters.filename.c_str());
|
||||
|
||||
if (!parameters.state_filename.empty())
|
||||
Log_InfoPrintf("Save State Filename: %s", parameters.filename.c_str());
|
||||
|
||||
if (!AcquireHostDisplay())
|
||||
{
|
||||
ReportFormattedError("Failed to acquire host display");
|
||||
@ -81,6 +89,9 @@ bool HostInterface::BootSystem(const SystemBootParameters& parameters)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parameters.state_filename.empty())
|
||||
LoadState(parameters.state_filename.c_str());
|
||||
|
||||
OnSystemCreated();
|
||||
|
||||
m_paused = m_settings.start_paused;
|
||||
@ -611,6 +622,9 @@ void HostInterface::OnControllerTypeChanged(u32 slot) {}
|
||||
|
||||
void HostInterface::SetUserDirectory()
|
||||
{
|
||||
if (!m_user_directory.empty())
|
||||
return;
|
||||
|
||||
const std::string program_path = FileSystem::GetProgramPath();
|
||||
const std::string program_directory = FileSystem::GetPathDirectory(program_path.c_str());
|
||||
Log_InfoPrintf("Program path: \"%s\" (directory \"%s\")", program_path.c_str(), program_directory.c_str());
|
||||
@ -653,6 +667,13 @@ void HostInterface::SetUserDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
void HostInterface::SetUserDirectoryToProgramDirectory()
|
||||
{
|
||||
const std::string program_path = FileSystem::GetProgramPath();
|
||||
const std::string program_directory = FileSystem::GetPathDirectory(program_path.c_str());
|
||||
m_user_directory = program_directory;
|
||||
}
|
||||
|
||||
void HostInterface::InitializeUserDirectory()
|
||||
{
|
||||
Log_InfoPrintf("User directory: \"%s\"", m_user_directory.c_str());
|
||||
|
@ -50,10 +50,11 @@ public:
|
||||
/// Shuts down the emulator frontend.
|
||||
virtual void Shutdown();
|
||||
|
||||
bool BootSystem(const SystemBootParameters& parameters);
|
||||
virtual bool BootSystem(const SystemBootParameters& parameters);
|
||||
virtual void PowerOffSystem();
|
||||
|
||||
void PauseSystem(bool paused);
|
||||
void ResetSystem();
|
||||
void PowerOffSystem();
|
||||
void DestroySystem();
|
||||
|
||||
/// Loads state from the specified filename.
|
||||
@ -158,6 +159,9 @@ protected:
|
||||
/// Sets the base path for the user directory. Can be overridden by platform/frontend/command line.
|
||||
virtual void SetUserDirectory();
|
||||
|
||||
/// Sets the user directory to the program directory, i.e. "portable mode".
|
||||
void SetUserDirectoryToProgramDirectory();
|
||||
|
||||
/// Performs the initial load of settings. Should call CheckSettings() and m_settings.Load().
|
||||
virtual void LoadSettings() = 0;
|
||||
|
||||
@ -229,14 +233,14 @@ protected:
|
||||
Settings m_settings;
|
||||
std::string m_user_directory;
|
||||
|
||||
std::deque<OSDMessage> m_osd_messages;
|
||||
std::mutex m_osd_messages_lock;
|
||||
|
||||
bool m_paused = false;
|
||||
bool m_speed_limiter_temp_disabled = false;
|
||||
bool m_speed_limiter_enabled = false;
|
||||
bool m_timer_resolution_increased = false;
|
||||
|
||||
std::deque<OSDMessage> m_osd_messages;
|
||||
std::mutex m_osd_messages_lock;
|
||||
|
||||
private:
|
||||
void InitializeUserDirectory();
|
||||
void CreateAudioStream();
|
||||
|
@ -35,7 +35,9 @@ struct SystemBootParameters
|
||||
~SystemBootParameters();
|
||||
|
||||
std::string filename;
|
||||
std::string state_filename;
|
||||
std::optional<bool> override_fast_boot;
|
||||
std::optional<bool> override_fullscreen;
|
||||
};
|
||||
|
||||
class System
|
||||
|
Reference in New Issue
Block a user