frontend: avoid loading msg when not needed
[pcsx_rearmed.git] / maemo / main.c
index 977f6a3..eb757f0 100644 (file)
 #include "plugin_lib.h"
 #include "../libpcsxcore/misc.h"
 #include "../libpcsxcore/new_dynarec/new_dynarec.h"
+#include "../plugins/dfinput/main.h"
 #include "maemo_common.h"
 
-// sound plugin
-extern int iUseTimer;
-
 int g_opts = OPT_SHOWFPS;
 int g_maemo_opts;
+int g_scaler, soft_filter;
+int g_menuscreen_w, g_menuscreen_h;
+
 char file_name[MAXPATHLEN];
 
 enum sched_action emu_action;
@@ -40,20 +41,29 @@ static void ChangeWorkingDirectory(char *exe)
        }
 }
 
-int maemo_main(int argc, char **argv)
+int main(int argc, char **argv)
 {
-       ChangeWorkingDirectory("c");
        char file[MAXPATHLEN] = "";
        char path[MAXPATHLEN];
        const char *cdfile = NULL;
        int loadst = 0;
        int i;
 
+       emu_core_preinit();
+       ChangeWorkingDirectory("c");
+
        strcpy(Config.BiosDir, "/home/user/MyDocs");
        strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
        snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
        Config.PsxAuto = 1;
-       
+
+       g_menuscreen_w = 800;
+       g_menuscreen_h = 480;
+
+       pl_init();
+
+       emu_core_init();
+
        // read command line options
        for (i = 1; i < argc; i++) {
                     if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
@@ -80,13 +90,10 @@ int maemo_main(int argc, char **argv)
                }
                else if (!strcmp(argv[i],"-fullscreen"))                g_maemo_opts |= 2;
                else if (!strcmp(argv[i],"-accel"))                             g_maemo_opts |= 4;
-               else if (!strcmp(argv[i],"-sputhreaded"))               iUseTimer=1;
                else if (!strcmp(argv[i],"-nosound"))           strcpy(Config.Spu, "spunull.so");
-               /* unworking with r10
-               else if(!strcmp(argv[i], "-bdir"))                      sprintf(Config.BiosDir, "%s", argv[++i]);
-               else if(!strcmp(argv[i], "-bios"))                      sprintf(Config.Bios, "%s", argv[++i]);
-               else if (!strcmp(argv[i],"-gles"))                      strcpy(Config.Gpu, "gpuGLES.so");
-               */
+               else if (!strcmp(argv[i], "-bdir"))                     sprintf(Config.BiosDir, "%s", argv[++i]);
+               else if (!strcmp(argv[i], "-bios"))                     sprintf(Config.Bios, "%s", argv[++i]);
+               else if (!strcmp(argv[i], "-gles"))                     strcpy(Config.Gpu, "gpuGLES.so");
                else if (!strcmp(argv[i], "-cdda"))             Config.Cdda = 1;
                else if (!strcmp(argv[i], "-xa"))               Config.Xa = 1;
                else if (!strcmp(argv[i], "-rcnt"))             Config.RCntFix = 1 ;
@@ -102,11 +109,6 @@ int maemo_main(int argc, char **argv)
                strcpy(file_name, strrchr(cdfile,'/'));
        }
 
-       if (SysInit() == -1)
-               return 1;
-
-       pl_init();
-
        if (LoadPlugins() == -1) {
                SysMessage("Failed loading plugins!");
                return 1;
@@ -130,24 +132,31 @@ int maemo_main(int argc, char **argv)
                                printf(_("Could not load CD-ROM!\n"));
                                return -1;
                        }
+                       emu_on_new_cd(0);
                        ready_to_go = 1;
                }
        }
 
+       if (!ready_to_go) {
+               printf ("something goes wrong, maybe you forgot -cdfile ? \n");
+               return 1;
+       }
+
        // If a state has been specified, then load that
        if (loadst) {
                int ret = emu_load_state(loadst - 1);
                printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
        }
 
-       if (ready_to_go)
-               maemo_init(&argc, &argv);
-       else
-       {
-               printf ("somethings goes wrong, maybe you forgot -cdfile ? \n");
-               return 0;
+       maemo_init(&argc, &argv);
+
+       if (GPU_open != NULL) {
+               int ret = GPU_open(&gpuDisp, "PCSX", NULL);
+               if (ret)
+                       fprintf(stderr, "Warning: GPU_open returned %d\n", ret);
        }
 
+       dfinput_activate();
        pl_timing_prepare(Config.PsxType);
 
        while (1)