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 "../plugins/dfinput/main.h"
20 #include "maemo_common.h"
22 int g_opts = OPT_SHOWFPS;
24 char file_name[MAXPATHLEN];
26 enum sched_action emu_action;
27 void do_emu_action(void);
29 static void ChangeWorkingDirectory(char *exe)
33 snprintf(exepath, sizeof(exepath), "%s", exe);
34 s = strrchr(exepath, '/');
41 int maemo_main(int argc, char **argv)
43 ChangeWorkingDirectory("c");
44 char file[MAXPATHLEN] = "";
45 char path[MAXPATHLEN];
46 const char *cdfile = NULL;
50 strcpy(Config.BiosDir, "/home/user/MyDocs");
51 strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
52 snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
55 // read command line options
56 for (i = 1; i < argc; i++) {
57 if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
58 else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
59 else if (!strcmp(argv[i], "-cdfile")) {
60 char isofilename[MAXPATHLEN];
61 if (i+1 >= argc) break;
62 strncpy(isofilename, argv[++i], MAXPATHLEN);
63 if (isofilename[0] != '/') {
64 getcwd(path, MAXPATHLEN);
65 if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
67 strcat(path, isofilename);
68 strcpy(isofilename, path);
74 else if (!strcmp(argv[i],"-frameskip")) {
75 int tv_reg = atol(argv[++i]);
77 pl_rearmed_cbs.frameskip = -1;
79 else if (!strcmp(argv[i],"-fullscreen")) g_maemo_opts |= 2;
80 else if (!strcmp(argv[i],"-accel")) g_maemo_opts |= 4;
81 else if (!strcmp(argv[i],"-nosound")) strcpy(Config.Spu, "spunull.so");
82 else if (!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
83 else if (!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
84 else if (!strcmp(argv[i], "-gles")) strcpy(Config.Gpu, "gpuGLES.so");
85 else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1;
86 else if (!strcmp(argv[i], "-xa")) Config.Xa = 1;
87 else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ;
88 else if (!strcmp(argv[i], "-sio")) Config.Sio = 1;
89 else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1;
90 else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1;
93 hildon_init(&argc, &argv);
97 strcpy(file_name, strrchr(cdfile,'/'));
105 if (LoadPlugins() == -1) {
106 SysMessage("Failed loading plugins!");
110 if (OpenPlugins() == -1) {
113 plugin_call_rearmed_cbs();
118 if (file[0] != '\0') {
119 if (Load(file) != -1)
123 if (LoadCdrom() == -1) {
125 printf(_("Could not load CD-ROM!\n"));
134 printf ("something goes wrong, maybe you forgot -cdfile ? \n");
138 // If a state has been specified, then load that
140 int ret = emu_load_state(loadst - 1);
141 printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
144 maemo_init(&argc, &argv);
146 if (GPU_open != NULL) {
147 int ret = GPU_open(&gpuDisp, "PCSX", NULL);
149 fprintf(stderr, "Warning: GPU_open returned %d\n", ret);
153 pl_timing_prepare(Config.PsxType);
158 emu_action = SACTION_NONE;
161 if (emu_action != SACTION_NONE)