dfinput: return 0xff when the packet ends, like the real thing does
[pcsx_rearmed.git] / frontend / main.c
index 1030a32..f97610a 100644 (file)
@@ -225,12 +225,14 @@ 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;
 
        // read command line options
        for (i = 1; i < argc; i++) {
-                    if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
+                    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;
@@ -254,6 +256,10 @@ int main(int argc, char *argv[])
 
                        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")) {
@@ -293,7 +299,10 @@ int main(int argc, char *argv[])
        in_init();
        //in_probe();
        plat_init();
-       menu_init();
+       menu_init(); // loads config
+
+       if (psxout)
+               Config.PsxOut = 1;
 
        if (LoadPlugins() == -1) {
                // FIXME: this recovery doesn't work, just delete bad config and bail out
@@ -336,6 +345,10 @@ int main(int argc, char *argv[])
                        int ret = emu_load_state(loadst - 1);
                        printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
                }
+               if (loadst_f) {
+                       int ret = LoadState(loadst_f);
+                       printf("%s state file: %s\n", ret ? "failed to load" : "loaded", loadst_f);
+               }
        }
        else
                menu_loop();