static void print_version(void) { char str[PATH_MAX_LENGTH] = {0}; fprintf(stderr, "%s: Frontend for libretro -- v%s", msg_hash_to_str(MSG_PROGRAM), PACKAGE_VERSION); #ifdef HAVE_GIT_VERSION printf(" -- %s --\n", rarch_git_version); #endif rarch_info_get_capabilities(RARCH_CAPABILITIES_COMPILER, str, sizeof(str)); fprintf(stdout, "%s", str); fprintf(stdout, "Built: %s\n", __DATE__); }
/** * print_help: * * Prints help message explaining RetroArch's commandline switches. **/ static void print_help(void) { char str[PATH_MAX_LENGTH]; puts("==================================================================="); #ifdef HAVE_GIT_VERSION printf(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " -- %s --\n", rarch_git_version); #else puts(RETRO_FRONTEND ": Frontend for libretro -- v" PACKAGE_VERSION " --"); #endif rarch_info_get_capabilities(RARCH_CAPABILITIES_COMPILER, str, sizeof(str)); fprintf(stdout, "%s", str); fprintf(stdout, "Built: %s\n", __DATE__); puts("==================================================================="); puts("Usage: retroarch [content file] [options...]"); puts("\t-h/--help: Show this help message."); puts("\t--menu: Do not require content or libretro core to be loaded, starts directly in menu."); puts("\t\tIf no arguments are passed to " RETRO_FRONTEND ", it is equivalent to using --menu as only argument."); puts("\t--features: Prints available features compiled into " RETRO_FRONTEND "."); puts("\t-s/--save: Path for save file (*.srm)."); puts("\t-f/--fullscreen: Start " RETRO_FRONTEND " in fullscreen regardless of config settings."); puts("\t-S/--savestate: Path to use for save states. If not selected, *.state will be assumed."); puts("\t-c/--config: Path for config file." RARCH_DEFAULT_CONF_PATH_STR); puts("\t--appendconfig: Extra config files are loaded in, and take priority over config selected in -c (or default)."); puts("\t\tMultiple configs are delimited by '|'."); #ifdef HAVE_DYNAMIC puts("\t-L/--libretro: Path to libretro implementation. Overrides any config setting."); #endif puts("\t--subsystem: Use a subsystem of the libretro core. Multiple content files are loaded as multiple arguments."); puts("\t\tIf a content file is skipped, use a blank (\"\") command line argument"); puts("\t\tContent must be loaded in an order which depends on the particular subsystem used."); puts("\t\tSee verbose log output to learn how a particular subsystem wants content to be loaded."); printf("\t-N/--nodevice: Disconnects controller device connected to port (1 to %d).\n", MAX_USERS); printf("\t-A/--dualanalog: Connect a DualAnalog controller to port (1 to %d).\n", MAX_USERS); printf("\t-d/--device: Connect a generic device into port of the device (1 to %d).\n", MAX_USERS); puts("\t\tFormat is port:ID, where ID is an unsigned number corresponding to the particular device.\n"); puts("\t-P/--bsvplay: Playback a BSV movie file."); puts("\t-R/--bsvrecord: Start recording a BSV movie file from the beginning."); puts("\t--eof-exit: Exit upon reaching the end of the BSV movie file."); puts("\t-M/--sram-mode: Takes an argument telling how SRAM should be handled in the session."); puts("\t\t{no,}load-{no,}save describes if SRAM should be loaded, and if SRAM should be saved."); puts("\t\tDo note that noload-save implies that save files will be deleted and overwritten."); #ifdef HAVE_NETPLAY puts("\t-H/--host: Host netplay as user 1."); puts("\t-C/--connect: Connect to netplay as user 2."); puts("\t--port: Port used to netplay. Default is 55435."); puts("\t-F/--frames: Sync frames when using netplay."); puts("\t--spectate: Netplay will become spectating mode."); puts("\t\tHost can live stream the game content to users that connect."); puts("\t\tHowever, the client will not be able to play. Multiple clients can connect to the host."); #endif puts("\t--nick: Picks a username (for use with netplay). Not mandatory."); #if defined(HAVE_NETWORK_CMD) && defined(HAVE_NETPLAY) puts("\t--command: Sends a command over UDP to an already running " RETRO_FRONTEND " process."); puts("\t\tAvailable commands are listed if command is invalid."); #endif puts("\t-r/--record: Path to record video file.\n\t\tUsing .mkv extension is recommended."); puts("\t--recordconfig: Path to settings used during recording."); puts("\t--size: Overrides output video size when recording (format: WIDTHxHEIGHT)."); puts("\t-v/--verbose: Verbose logging."); puts("\t-U/--ups: Specifies path for UPS patch that will be applied to content."); puts("\t--bps: Specifies path for BPS patch that will be applied to content."); puts("\t--ips: Specifies path for IPS patch that will be applied to content."); puts("\t--no-patch: Disables all forms of content patching."); puts("\t-D/--detach: Detach " RETRO_FRONTEND " from the running console. Not relevant for all platforms."); puts("\t--max-frames: Runs for the specified number of frames, then exits.\n"); }
/** * rarch_main_init: * @argc : Count of (commandline) arguments. * @argv : (Commandline) arguments. * * Initializes RetroArch. * * Returns: 0 on success, otherwise 1 if there was an error. **/ int rarch_main_init(int argc, char *argv[]) { int sjlj_ret; global_t *global = global_get_ptr(); init_state(); if ((sjlj_ret = setjmp(global->error_sjlj_context)) > 0) { RARCH_ERR("Fatal error received in: \"%s\"\n", global->error_string); return sjlj_ret; } global->error_in_init = true; parse_input(argc, argv); if (global->verbosity) { char str[PATH_MAX_LENGTH] = {0}; RARCH_LOG_OUTPUT("=== Build ======================================="); rarch_info_get_capabilities(RARCH_CAPABILITIES_CPU, str, sizeof(str)); fprintf(stderr, "%s", str); fprintf(stderr, "Built: %s\n", __DATE__); RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION); #ifdef HAVE_GIT_VERSION RARCH_LOG_OUTPUT("Git: %s\n", rarch_git_version); #endif RARCH_LOG_OUTPUT("=================================================\n"); } validate_cpu_features(); config_load(); init_libretro_sym(global->libretro_dummy); init_system_info(); init_drivers_pre(); if (!event_command(EVENT_CMD_CORE_INIT)) goto error; event_command(EVENT_CMD_DRIVERS_INIT); event_command(EVENT_CMD_COMMAND_INIT); event_command(EVENT_CMD_REWIND_INIT); event_command(EVENT_CMD_CONTROLLERS_INIT); event_command(EVENT_CMD_RECORD_INIT); event_command(EVENT_CMD_CHEATS_INIT); event_command(EVENT_CMD_REMAPPING_INIT); event_command(EVENT_CMD_SAVEFILES_INIT); #if defined(GEKKO) && defined(HW_RVL) { settings_t *settings = config_get_ptr(); if (settings) { event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx); } } #endif global->error_in_init = false; global->main_is_init = true; return 0; error: event_command(EVENT_CMD_CORE_DEINIT); global->main_is_init = false; return 1; }
/** * rarch_main_init: * @argc : Count of (commandline) arguments. * @argv : (Commandline) arguments. * * Initializes the program. * * Returns: 0 on success, otherwise 1 if there was an error. **/ int rarch_main_init(int argc, char *argv[]) { int sjlj_ret; global_t *global = global_get_ptr(); init_state(); if ((sjlj_ret = setjmp(global->error_sjlj_context)) > 0) { RARCH_ERR("Fatal error received in: \"%s\"\n", global->error_string); return sjlj_ret; } global->inited.error = true; global->log_file = stderr; parse_input(argc, argv); if (global->verbosity) { char str[PATH_MAX_LENGTH] = {0}; RARCH_LOG_OUTPUT("=== Build ======================================="); rarch_info_get_capabilities(RARCH_CAPABILITIES_CPU, str, sizeof(str)); fprintf(stderr, "%s", str); fprintf(stderr, "Built: %s\n", __DATE__); RARCH_LOG_OUTPUT("Version: %s\n", PACKAGE_VERSION); #ifdef HAVE_GIT_VERSION RARCH_LOG_OUTPUT("Git: %s\n", rarch_git_version); #endif RARCH_LOG_OUTPUT("=================================================\n"); } rarch_ctl(RARCH_ACTION_STATE_VALIDATE_CPU_FEATURES, NULL); config_load(); { settings_t *settings = config_get_ptr(); if (settings && (settings->multimedia.builtin_mediaplayer_enable || settings->multimedia.builtin_imageviewer_enable)) { switch (rarch_path_is_media_type(global->path.fullpath)) { case RARCH_CONTENT_MOVIE: case RARCH_CONTENT_MUSIC: if (settings->multimedia.builtin_mediaplayer_enable) { #ifdef HAVE_FFMPEG global->has_set.libretro = false; global->inited.core.type = CORE_TYPE_FFMPEG; #endif } break; #ifdef HAVE_IMAGEVIEWER case RARCH_CONTENT_IMAGE: if (settings->multimedia.builtin_imageviewer_enable) { global->has_set.libretro = false; global->inited.core.type = CORE_TYPE_IMAGEVIEWER; } break; #endif default: break; } } } init_libretro_sym(global->inited.core.type); rarch_system_info_init(); init_drivers_pre(); if (!event_command(EVENT_CMD_CORE_INIT)) goto error; event_command(EVENT_CMD_DRIVERS_INIT); event_command(EVENT_CMD_COMMAND_INIT); event_command(EVENT_CMD_REWIND_INIT); event_command(EVENT_CMD_CONTROLLERS_INIT); event_command(EVENT_CMD_RECORD_INIT); event_command(EVENT_CMD_CHEATS_INIT); event_command(EVENT_CMD_REMAPPING_INIT); event_command(EVENT_CMD_SAVEFILES_INIT); #if defined(GEKKO) && defined(HW_RVL) { settings_t *settings = config_get_ptr(); if (settings) { event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); video_driver_set_aspect_ratio(settings->video.aspect_ratio_idx); } unsigned width = 0, height = 0; (void)width; (void)height; width = global->console.screen.resolutions.width; height = global->console.screen.resolutions.height; video_driver_set_video_mode(width, height, true); char msg[PATH_MAX_LENGTH] = {0}; snprintf(msg, sizeof(msg),"Resolution: %dx%d",width, height); rarch_main_msg_queue_push(msg, 1, 100, true); } #endif global->inited.error = false; global->inited.main = true; return 0; error: event_command(EVENT_CMD_CORE_DEINIT); global->inited.main = false; return 1; }