2020-01-10 03:31:12 +00:00
|
|
|
#include "common/assert.h"
|
|
|
|
#include "common/log.h"
|
2019-10-04 03:54:09 +00:00
|
|
|
#include "core/system.h"
|
2020-02-15 15:15:05 +00:00
|
|
|
#include "frontend-common/sdl_initializer.h"
|
2020-02-28 07:00:00 +00:00
|
|
|
#include "sdl_host_interface.h"
|
2019-09-09 07:01:26 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <cstdio>
|
2020-04-13 12:13:46 +00:00
|
|
|
#include <cstdlib>
|
2019-09-09 07:01:26 +00:00
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2020-02-15 15:15:05 +00:00
|
|
|
FrontendCommon::EnsureSDLInitialized();
|
|
|
|
|
2020-04-13 12:13:46 +00:00
|
|
|
std::unique_ptr<SDLHostInterface> host_interface = SDLHostInterface::Create();
|
|
|
|
std::unique_ptr<SystemBootParameters> boot_params;
|
|
|
|
if (!host_interface->ParseCommandLineParameters(argc, argv, &boot_params))
|
|
|
|
{
|
|
|
|
SDL_Quit();
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!host_interface->Initialize())
|
|
|
|
{
|
|
|
|
host_interface->Shutdown();
|
|
|
|
SDL_Quit();
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (boot_params)
|
|
|
|
{
|
|
|
|
if (!host_interface->BootSystem(*boot_params) && host_interface->InBatchMode())
|
|
|
|
{
|
|
|
|
host_interface->Shutdown();
|
|
|
|
host_interface.reset();
|
|
|
|
SDL_Quit();
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
boot_params.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
host_interface->Run();
|
|
|
|
host_interface->Shutdown();
|
|
|
|
host_interface.reset();
|
|
|
|
|
|
|
|
SDL_Quit();
|
|
|
|
return EXIT_SUCCESS;
|
2019-09-09 07:01:26 +00:00
|
|
|
}
|