void yyerror(char *error) { WRITELOG(ERROR, "Error in configuration file %s:\n", file_error); WRITELOG(ERROR, "%s.\n", error); free(x_sessions_directory); free(text_sessions_directory); free(xinit); free(font); free(theme_dir); free(screensavers_dir); free(themes_dir); set_default_paths(); theme_dir = StrApp((char**)NULL, themes_dir, "/default/", (char*)NULL); settings_parse_error = 1; }
int emu_core_preinit(void) { // what is the name of the config file? // it may be redefined by -cfg on the command line strcpy(cfgfile_basename, "pcsx.cfg"); emuLog = stdout; SetIsoFile(NULL); memset(&Config, 0, sizeof(Config)); set_default_paths(); emu_set_default_config(); strcpy(Config.Bios, "HLE"); return 0; }
int emu_core_preinit(void) { #ifdef IOS emuLog = fopen("/User/Documents/pcsxr.log", "w"); if (emuLog == NULL) emuLog = fopen("pcsxr.log", "w"); if (emuLog == NULL) #endif emuLog = stdout; SetIsoFile(NULL); memset(&Config, 0, sizeof(Config)); set_default_paths(); emu_set_default_config(); strcpy(Config.Bios, "HLE"); return 0; }
int emu_core_preinit(void) { // what is the name of the config file? // it may be redefined by -cfg on the command line strcpy(cfgfile_basename, "pcsx.cfg"); #ifdef IOS emuLog = fopen("/User/Documents/pcsxr.log", "w"); if (emuLog == NULL) emuLog = fopen("pcsxr.log", "w"); if (emuLog == NULL) #endif emuLog = stdout; SetIsoFile(NULL); memset(&Config, 0, sizeof(Config)); set_default_paths(); emu_set_default_config(); strcpy(Config.Bios, "HLE"); return 0; }
int main(int argc, char *argv[]) { char file[MAXPATHLEN] = ""; char path[MAXPATHLEN]; const char *cdfile = NULL; const char *loadst_f = NULL; int psxout = 0; int loadst = 0; int i; emu_core_preinit(); // read command line options for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-psxout")) psxout = 1; else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]); else if (!strcmp(argv[i], "-cfg")) { if (i+1 >= argc) break; strncpy(cfgfile_basename, argv[++i], MAXPATHLEN-100); /* TODO buffer overruns */ SysPrintf("Using config file %s.\n", cfgfile_basename); } else if (!strcmp(argv[i], "-cdfile")) { char isofilename[MAXPATHLEN]; if (i+1 >= argc) break; strncpy(isofilename, argv[++i], MAXPATHLEN); if (isofilename[0] != '/') { getcwd(path, MAXPATHLEN); if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) { strcat(path, "/"); strcat(path, isofilename); strcpy(isofilename, path); } else isofilename[0] = 0; } cdfile = isofilename; } else if (!strcmp(argv[i], "-loadf")) { if (i+1 >= argc) break; loadst_f = argv[++i]; } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) { printf("PCSX-ReARMed " REV "\n"); printf("%s\n", _( " pcsx [options] [file]\n" "\toptions:\n" "\t-cdfile FILE\tRuns a CD image file\n" "\t-cfg FILE\tLoads desired configuration file (default: ~/.pcsx/pcsx.cfg)\n" "\t-psxout\t\tEnable PSX output\n" "\t-load STATENUM\tLoads savestate STATENUM (1-5)\n" "\t-h -help\tDisplay this message\n" "\tfile\t\tLoads a PSX EXE file\n")); return 0; } else { strncpy(file, argv[i], MAXPATHLEN); if (file[0] != '/') { getcwd(path, MAXPATHLEN); if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) { strcat(path, "/"); strcat(path, file); strcpy(file, path); } else file[0] = 0; } } } if (cdfile) set_cd_image(cdfile); // frontend stuff // init input but leave probing to platform code, // they add input drivers and may need to modify them after probe in_init(); pl_init(); plat_init(); menu_init(); // loads config if (emu_core_init() != 0) return 1; if (psxout) Config.PsxOut = 1; if (LoadPlugins() == -1) { // FIXME: this recovery doesn't work, just delete bad config and bail out // SysMessage("could not load plugins, retrying with defaults\n"); set_default_paths(); snprintf(path, sizeof(path), "." PCSX_DOT_DIR "%s", cfgfile_basename); remove(path); SysMessage("Failed loading plugins!"); return 1; } pcnt_hook_plugins(); if (OpenPlugins() == -1) { return 1; } plugin_call_rearmed_cbs(); CheckCdrom(); SysReset(); if (file[0] != '\0') { if (Load(file) != -1) ready_to_go = 1; } else { if (cdfile) { if (LoadCdrom() == -1) { ClosePlugins(); SysPrintf(_("Could not load CD-ROM!\n")); return -1; } emu_on_new_cd(!loadst); ready_to_go = 1; } } if (loadst_f) { int ret = LoadState(loadst_f); SysPrintf("%s state file: %s\n", ret ? "failed to load" : "loaded", loadst_f); ready_to_go |= ret == 0; } if (ready_to_go) { menu_prepare_emu(); // If a state has been specified, then load that if (loadst) { int ret = emu_load_state(loadst - 1); SysPrintf("%s state %d\n", ret ? "failed to load" : "loaded", loadst); } } else menu_loop(); pl_start_watchdog(); while (!g_emu_want_quit) { stop = 0; emu_action = SACTION_NONE; psxCpu->Execute(); if (emu_action != SACTION_NONE) do_emu_action(); } printf("Exit..\n"); ClosePlugins(); SysClose(); menu_finish(); plat_finish(); return 0; }