4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
15 #include "../libpcsxcore/misc.h"
16 #include "../libpcsxcore/new_dynarec/new_dynarec.h"
18 // from softgpu plugin
19 extern int iUseDither;
20 extern int UseFrameSkip;
21 extern int UseFrameLimit;
22 extern uint32_t dwActFixes;
23 extern float fFrameRateHz;
24 extern int dwFrameRateTicks;
27 extern int iUseReverb;
28 extern int iUseInterpolation;
30 extern int iSPUIRQWait;
33 enum sched_action emu_action;
34 void do_emu_action(void);
36 static void ChangeWorkingDirectory(char *exe)
40 snprintf(exepath, sizeof(exepath), "%s", exe);
41 s = strrchr(exepath, '/');
48 int maemo_main(int argc, char **argv)
50 ChangeWorkingDirectory("c");
51 char file[MAXPATHLEN] = "";
52 char path[MAXPATHLEN];
53 const char *cdfile = NULL;
57 strcpy(Config.BiosDir, "/home/user/MyDocs");
58 strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
59 snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
62 // read command line options
63 for (i = 1; i < argc; i++) {
64 if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
65 else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
66 else if (!strcmp(argv[i], "-cdfile")) {
67 char isofilename[MAXPATHLEN];
69 if (i+1 >= argc) break;
70 strncpy(isofilename, argv[++i], MAXPATHLEN);
71 if (isofilename[0] != '/') {
72 getcwd(path, MAXPATHLEN);
73 if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
75 strcat(path, isofilename);
76 strcpy(isofilename, path);
83 else if (!strcmp(argv[i],"-frameskip")){
85 int tv_reg=atol(argv[++i]);
88 fFrameRateHz = (tv_reg==1)?50.0f: 59.94f;
89 dwFrameRateTicks = (100000*100 / (unsigned long)(fFrameRateHz*100));
92 else if (!strcmp(argv[i],"-sputhreaded")){
95 else if (!strcmp(argv[i],"-nosound")){
96 strcpy(Config.Spu, "spunull.so");
98 else if(!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
99 else if(!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
100 else if (!strcmp(argv[i],"-gles")){
101 strcpy(Config.Gpu, "gpuGLES.so");
103 else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1;
104 else if (!strcmp(argv[i], "-xa")) Config.Xa = 1;
105 else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ;
106 else if (!strcmp(argv[i], "-sio")) Config.Sio = 1;
107 else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1;
108 else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1;
109 else if (!strcmp(argv[i], "-h") ||
110 !strcmp(argv[i], "-help") ||
111 !strcmp(argv[i], "--help")) {
112 printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
114 " pcsx [options] [file]\n"
116 "\t-cdfile FILE\tRuns a CD image file\n"
117 "\t-psxout\t\tEnable PSX output\n"
118 "\t-nosound\t\tDisable sound using spunull plugin\n"
119 "\t-sputhreaded\t\tMove sound to separate thread\n"
120 "\t-frameskip\t\tEnable frameskip\n"
121 "\t-load STATENUM\tLoads savestate STATENUM (1-5)\n"
122 "\t-h -help\tDisplay this message\n"
123 "\tfile\t\tLoads file\n"));
126 strncpy(file, argv[i], MAXPATHLEN);
127 if (file[0] != '/') {
128 getcwd(path, MAXPATHLEN);
129 if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
139 hildon_init(&argc, &argv);
142 set_cd_image(cdfile);
147 if (LoadPlugins() == -1) {
148 SysMessage("Failed loading plugins!");
152 if (OpenPlugins() == -1) {
155 plugin_call_rearmed_cbs();
160 if (file[0] != '\0') {
161 if (Load(file) != -1)
165 if (LoadCdrom() == -1) {
167 printf(_("Could not load CD-ROM!\n"));
174 // If a state has been specified, then load that
176 int ret = emu_load_state(loadst - 1);
177 printf("%s state %d\n", ret ? "failed to load" : "loaded", loadst);
184 printf ("somethings goes wrong, maybe you forgot -cdfile ? \n");
191 emu_action = SACTION_NONE;
194 if (emu_action != SACTION_NONE)