diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/main.c | 36 | ||||
-rw-r--r-- | frontend/menu.c | 3 | ||||
-rw-r--r-- | frontend/plugin.c | 4 | ||||
-rw-r--r-- | frontend/plugin.h | 1 |
4 files changed, 38 insertions, 6 deletions
diff --git a/frontend/main.c b/frontend/main.c index b05893c..372fdf1 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -18,6 +18,7 @@ #include "menu.h" #include "../gui/Linux.h" #include "../libpcsxcore/misc.h" +#include "../plugins/cdrcimg/cdrcimg.h" #include "common/plat.h" #include "common/input.h" @@ -67,11 +68,31 @@ static void CreateMemcard(char *filename, char *conf_mcd) { } } +void set_cd_image(const char *fname) +{ + const char *ext; + int len; + + len = strlen(fname); + ext = fname; + if (len > 2) + ext = fname + len - 2; + + if (strcasecmp(ext, ".z") == 0) { + SetIsoFile(NULL); + cdrcimg_set_fname(fname); + strcpy(Config.Cdr, "builtin_cdrcimg"); + } else { + SetIsoFile(fname); + strcpy(Config.Cdr, "builtin_cdr"); + } +} + int main(int argc, char *argv[]) { char file[MAXPATHLEN] = ""; char path[MAXPATHLEN]; - int runcd = 0; + const char *cdfile = NULL; int loadst = 0; void *tmp; int i; @@ -118,8 +139,7 @@ int main(int argc, char *argv[]) isofilename[0] = 0; } - SetIsoFile(isofilename); - runcd = 1; + cdfile = isofilename; } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-help") || @@ -189,6 +209,10 @@ int main(int argc, char *argv[]) chdir(plugin_default_dir); g_free(plugin_default_dir); */ + + if (cdfile) + set_cd_image(cdfile); + if (SysInit() == -1) return 1; @@ -215,7 +239,7 @@ int main(int argc, char *argv[]) if (Load(file) != -1) ready_to_go = 1; } else { - if (runcd) { + if (cdfile) { if (LoadCdrom() == -1) { ClosePlugins(); printf(_("Could not load CD-ROM!\n")); @@ -406,11 +430,13 @@ char *getenv(const char *name) /* we hook statically linked plugins here */ static const char *builtin_plugins[] = { - "builtin_gpu", "builtin_spu", "builtin_cdr", "builtin_pad" + "builtin_gpu", "builtin_spu", "builtin_cdr", "builtin_pad", + "builtin_cdrcimg", }; static const int builtin_plugin_ids[] = { PLUGIN_GPU, PLUGIN_SPU, PLUGIN_CDR, PLUGIN_PAD, + PLUGIN_CDRCIMG, }; void *SysLoadLibrary(const char *lib) { diff --git a/frontend/menu.c b/frontend/menu.c index cae99a3..1b7418b 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -526,6 +526,7 @@ const char *plat_get_credits(void) static char *romsel_run(void) { + extern void set_cd_image(const char *fname); char *ret; ret = menu_loop_romsel(last_selected_fname, sizeof(last_selected_fname)); @@ -535,7 +536,7 @@ static char *romsel_run(void) lprintf("selected file: %s\n", ret); ready_to_go = 0; - SetIsoFile(ret); + set_cd_image(ret); LoadPlugins(); NetOpened = 0; if (OpenPlugins() == -1) { diff --git a/frontend/plugin.c b/frontend/plugin.c index ca359d7..e2c1ca3 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -11,6 +11,7 @@ #include "plugin_lib.h" #include "plugin.h" +#include "../plugins/cdrcimg/cdrcimg.h" static int dummy_func() { return 0; @@ -190,6 +191,9 @@ void *plugin_link(enum builtint_plugins_e id, const char *sym) { int i; + if (id == PLUGIN_CDRCIMG) + return cdrcimg_get_sym(sym); + for (i = 0; i < ARRAY_SIZE(plugin_funcs); i++) { if (id != plugin_funcs[i].id) continue; diff --git a/frontend/plugin.h b/frontend/plugin.h index 48ab719..76cab25 100644 --- a/frontend/plugin.h +++ b/frontend/plugin.h @@ -7,6 +7,7 @@ enum builtint_plugins_e { PLUGIN_SPU, PLUGIN_CDR, PLUGIN_PAD, + PLUGIN_CDRCIMG, }; void *plugin_link(enum builtint_plugins_e id, const char *sym); |