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"
21 extern int iUseReverb;
22 extern int iUseInterpolation;
23 extern int iSPUIRQWait;
26 int g_opts = OPT_SHOWFPS;
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];
64 if (i+1 >= argc) break;
65 strncpy(isofilename, argv[++i], MAXPATHLEN);
66 if (isofilename[0] != '/') {
67 getcwd(path, MAXPATHLEN);
68 if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
70 strcat(path, isofilename);
71 strcpy(isofilename, path);
78 else if (!strcmp(argv[i],"-frameskip")) {
80 int tv_reg = atol(argv[++i]);
82 pl_rearmed_cbs.frameskip = 1;
84 else if (!strcmp(argv[i],"-sputhreaded")) {
87 else if (!strcmp(argv[i],"-nosound")) {
88 strcpy(Config.Spu, "spunull.so");
90 else if(!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
91 else if(!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
92 else if (!strcmp(argv[i],"-gles")){
93 strcpy(Config.Gpu, "gpuGLES.so");
95 else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1;
96 else if (!strcmp(argv[i], "-xa")) Config.Xa = 1;
97 else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ;
98 else if (!strcmp(argv[i], "-sio")) Config.Sio = 1;
99 else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1;
100 else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1;
101 else if (!strcmp(argv[i], "-h") ||
102 !strcmp(argv[i], "-help") ||
103 !strcmp(argv[i], "--help")) {
104 printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
106 " pcsx [options] [file]\n"
108 "\t-cdfile FILE\tRuns a CD image file\n"
109 "\t-psxout\t\tEnable PSX output\n"
110 "\t-nosound\t\tDisable sound using spunull plugin\n"
111 "\t-sputhreaded\t\tMove sound to separate thread\n"
112 "\t-frameskip\t\tEnable frameskip\n"
113 "\t-load STATENUM\tLoads savestate STATENUM (1-5)\n"
114 "\t-h -help\tDisplay this message\n"
115 "\tfile\t\tLoads file\n"));
118 strncpy(file, argv[i], MAXPATHLEN);
119 if (file[0] != '/') {
120 getcwd(path, MAXPATHLEN);
121 if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
131 pl_rearmed_cbs.gpu_peops.dwActFixes = 1<<7;
133 iUseInterpolation = 1;
137 in_type1 = PSE_PAD_TYPE_STANDARD;
138 in_type2 = PSE_PAD_TYPE_STANDARD;
140 hildon_init(&argc, &argv);
143 set_cd_image(cdfile);
150 if (LoadPlugins() == -1) {
151 SysMessage("Failed loading plugins!");
155 if (OpenPlugins() == -1) {
158 plugin_call_rearmed_cbs();
163 if (file[0] != '\0') {
164 if (Load(file) != -1)
168 if (LoadCdrom() == -1) {
170 printf(_("Could not load CD-ROM!\n"));
177 // If a state has been specified, then load that
179 int ret = emu_load_state(loadst - 1);
180 printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
187 printf ("somethings goes wrong, maybe you forgot -cdfile ? \n");
191 pl_timing_prepare(Config.PsxType);
196 emu_action = SACTION_NONE;
199 if (emu_action != SACTION_NONE)