update build for OABI
[pcsx_rearmed.git] / maemo / main.c
index e5faacf..4531704 100644 (file)
 #include "plugin_lib.h"
 #include "../libpcsxcore/misc.h"
 #include "../libpcsxcore/new_dynarec/new_dynarec.h"
 #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
 
 // sound plugin
-extern int iUseReverb;
-extern int iUseInterpolation;
-extern int iSPUIRQWait;
 extern int iUseTimer;
 
 int g_opts = OPT_SHOWFPS;
 extern int iUseTimer;
 
 int g_opts = OPT_SHOWFPS;
+int g_maemo_opts;
+char file_name[MAXPATHLEN];
 
 enum sched_action emu_action;
 void do_emu_action(void);
 
 enum sched_action emu_action;
 void do_emu_action(void);
-char* file_name;
 
 static void ChangeWorkingDirectory(char *exe)
 {
 
 static void ChangeWorkingDirectory(char *exe)
 {
@@ -79,15 +79,13 @@ int maemo_main(int argc, char **argv)
                        if (tv_reg > 0)
                                pl_rearmed_cbs.frameskip = -1;
                }
                        if (tv_reg > 0)
                                pl_rearmed_cbs.frameskip = -1;
                }
-               else if (!strcmp(argv[i],"-fullscreen"))                g_opts |= 2;
-               else if (!strcmp(argv[i],"-accel"))                             g_opts |= 4;
+               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");
                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 ;
                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 ;
@@ -96,23 +94,12 @@ int maemo_main(int argc, char **argv)
                else if (!strcmp(argv[i], "-vsync"))    Config.VSyncWA = 1;
        }
 
                else if (!strcmp(argv[i], "-vsync"))    Config.VSyncWA = 1;
        }
 
-       pl_rearmed_cbs.gpu_peops.dwActFixes = 1<<7;
-       iUseReverb = 2;
-       iUseInterpolation = 1;
-       iSPUIRQWait = 1;
-       iUseTimer = 2;
-
-       in_type1 = PSE_PAD_TYPE_STANDARD;
-       in_type2 = PSE_PAD_TYPE_STANDARD;
-
        hildon_init(&argc, &argv);
        
        hildon_init(&argc, &argv);
        
-       char f_name[MAXPATHLEN];
-       strcpy(f_name, strrchr(cdfile,'/'));
-       file_name=f_name;
-
-       if (cdfile)
+       if (cdfile) {
                set_cd_image(cdfile);
                set_cd_image(cdfile);
+               strcpy(file_name, strrchr(cdfile,'/'));
+       }
 
        if (SysInit() == -1)
                return 1;
 
        if (SysInit() == -1)
                return 1;
@@ -146,20 +133,26 @@ int maemo_main(int argc, char **argv)
                }
        }
 
                }
        }
 
+       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 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();
-       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)
        pl_timing_prepare(Config.PsxType);
 
        while (1)