4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
16 #include "plugin_lib.h"
17 #include "../libpcsxcore/misc.h"
18 #include "../libpcsxcore/new_dynarec/new_dynarec.h"
19 #include "maemo_common.h"
24 int g_opts = OPT_SHOWFPS;
26 char file_name[MAXPATHLEN];
28 enum sched_action emu_action;
29 void do_emu_action(void);
31 static void ChangeWorkingDirectory(char *exe)
35 snprintf(exepath, sizeof(exepath), "%s", exe);
36 s = strrchr(exepath, '/');
43 int maemo_main(int argc, char **argv)
45 ChangeWorkingDirectory("c");
46 char file[MAXPATHLEN] = "";
47 char path[MAXPATHLEN];
48 const char *cdfile = NULL;
52 strcpy(Config.BiosDir, "/home/user/MyDocs");
53 strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
54 snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
57 // read command line options
58 for (i = 1; i < argc; i++) {
59 if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
60 else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
61 else if (!strcmp(argv[i], "-cdfile")) {
62 char isofilename[MAXPATHLEN];
63 if (i+1 >= argc) break;
64 strncpy(isofilename, argv[++i], MAXPATHLEN);
65 if (isofilename[0] != '/') {
66 getcwd(path, MAXPATHLEN);
67 if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
69 strcat(path, isofilename);
70 strcpy(isofilename, path);
76 else if (!strcmp(argv[i],"-frameskip")) {
77 int tv_reg = atol(argv[++i]);
79 pl_rearmed_cbs.frameskip = -1;
81 else if (!strcmp(argv[i],"-fullscreen")) g_maemo_opts |= 2;
82 else if (!strcmp(argv[i],"-accel")) g_maemo_opts |= 4;
83 else if (!strcmp(argv[i],"-sputhreaded")) iUseTimer=1;
84 else if (!strcmp(argv[i],"-nosound")) strcpy(Config.Spu, "spunull.so");
86 else if(!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
87 else if(!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
88 else if (!strcmp(argv[i],"-gles")) strcpy(Config.Gpu, "gpuGLES.so");
90 else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1;
91 else if (!strcmp(argv[i], "-xa")) Config.Xa = 1;
92 else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ;
93 else if (!strcmp(argv[i], "-sio")) Config.Sio = 1;
94 else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1;
95 else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1;
98 hildon_init(&argc, &argv);
101 set_cd_image(cdfile);
102 strcpy(file_name, strrchr(cdfile,'/'));
110 if (LoadPlugins() == -1) {
111 SysMessage("Failed loading plugins!");
115 if (OpenPlugins() == -1) {
118 plugin_call_rearmed_cbs();
123 if (file[0] != '\0') {
124 if (Load(file) != -1)
128 if (LoadCdrom() == -1) {
130 printf(_("Could not load CD-ROM!\n"));
137 // If a state has been specified, then load that
139 int ret = emu_load_state(loadst - 1);
140 printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
144 maemo_init(&argc, &argv);
147 printf ("somethings goes wrong, maybe you forgot -cdfile ? \n");
151 pl_timing_prepare(Config.PsxType);
156 emu_action = SACTION_NONE;
159 if (emu_action != SACTION_NONE)