4 * This work is licensed under the terms of the GNU GPLv2 or later.
5 * See the COPYING file in the top-level directory.
13 #include <sys/types.h>
19 #include "../libpcsxcore/misc.h"
20 #include "../plugins/cdrcimg/cdrcimg.h"
22 // from softgpu plugin
23 extern int iUseDither;
24 extern int UseFrameSkip;
25 extern int UseFrameLimit;
26 extern uint32_t dwActFixes;
27 extern float fFrameRateHz;
28 extern int dwFrameRateTicks;
31 extern int iUseReverb;
32 extern int iUseInterpolation;
34 extern int iSPUIRQWait;
37 static void ChangeWorkingDirectory(char *exe)
41 sprintf(exepath, "%s", exe);
42 s = strrchr(exepath, '/');
49 int maemo_main(int argc, char **argv)
51 ChangeWorkingDirectory("c");
52 char file[MAXPATHLEN] = "";
53 char path[MAXPATHLEN];
54 const char *cdfile = NULL;
59 strcpy(Config.BiosDir, "/home/user/MyDocs");
60 strcpy(Config.PluginsDir, "/opt/maemo/usr/games/plugins");
61 snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "/opt/maemo/usr/games" PATCHES_DIR);
64 // read command line options
65 for (i = 1; i < argc; i++) {
66 if (!strcmp(argv[i], "-psxout")) Config.PsxOut = 1;
67 else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
68 else if (!strcmp(argv[i], "-cdfile")) {
69 char isofilename[MAXPATHLEN];
71 if (i+1 >= argc) break;
72 strncpy(isofilename, argv[++i], MAXPATHLEN);
73 if (isofilename[0] != '/') {
74 getcwd(path, MAXPATHLEN);
75 if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
77 strcat(path, isofilename);
78 strcpy(isofilename, path);
85 else if (!strcmp(argv[i],"-frameskip")){
87 int tv_reg=atol(argv[++i]);
90 fFrameRateHz = (tv_reg==1)?50.0f: 59.94f;
91 dwFrameRateTicks = (100000*100 / (unsigned long)(fFrameRateHz*100));
94 else if (!strcmp(argv[i],"-sputhreaded")){
97 else if (!strcmp(argv[i],"-nosound")){
98 strcpy(Config.Spu, "spunull.so");
100 else if(!strcmp(argv[i], "-bdir")) sprintf(Config.BiosDir, "%s", argv[++i]);
101 else if(!strcmp(argv[i], "-bios")) sprintf(Config.Bios, "%s", argv[++i]);
102 else if (!strcmp(argv[i],"-gles")){
103 strcpy(Config.Gpu, "gpuGLES.so");
105 else if (!strcmp(argv[i], "-cdda")) Config.Cdda = 1;
106 else if (!strcmp(argv[i], "-xa")) Config.Xa = 1;
107 else if (!strcmp(argv[i], "-rcnt")) Config.RCntFix = 1 ;
108 else if (!strcmp(argv[i], "-sio")) Config.Sio = 1;
109 else if (!strcmp(argv[i], "-spuirq")) Config.SpuIrq = 1;
110 else if (!strcmp(argv[i], "-vsync")) Config.VSyncWA = 1;
111 else if (!strcmp(argv[i], "-h") ||
112 !strcmp(argv[i], "-help") ||
113 !strcmp(argv[i], "--help")) {
114 printf(PACKAGE_NAME " " PACKAGE_VERSION "\n");
116 " pcsx [options] [file]\n"
118 "\t-cdfile FILE\tRuns a CD image file\n"
119 "\t-psxout\t\tEnable PSX output\n"
120 "\t-nosound\t\tDisable sound using spunull plugin\n"
121 "\t-sputhreaded\t\tMove sound to separate thread\n"
122 "\t-frameskip\t\tEnable frameskip\n"
123 "\t-load STATENUM\tLoads savestate STATENUM (1-5)\n"
124 "\t-h -help\tDisplay this message\n"
125 "\tfile\t\tLoads file\n"));
128 strncpy(file, argv[i], MAXPATHLEN);
129 if (file[0] != '/') {
130 getcwd(path, MAXPATHLEN);
131 if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
141 hildon_init(&argc, &argv);
144 set_cd_image(cdfile);
149 if (LoadPlugins() == -1) {
150 SysMessage("Failed loading plugins!");
154 if (OpenPlugins() == -1) {
157 plugin_call_rearmed_cbs();
162 if (file[0] != '\0') {
163 if (Load(file) != -1)
167 if (LoadCdrom() == -1) {
169 printf(_("Could not load CD-ROM!\n"));
176 // If a state has been specified, then load that
178 char state_filename[MAXPATHLEN];
179 int ret = get_state_filename(state_filename, sizeof(state_filename), loadst - 1);
181 ret = LoadState(state_filename);
182 printf("%s state %s\n", ret ? "failed to load" : "loaded", state_filename);
189 printf ("somethings goes wrong, maybe you forgot -cdfile ? \n");