5 #include "../../driver.h"
6 #include "../common/config.h"
7 #include "../common/args.h"
9 #include "gp2x-video.h"
11 #include "unix-netplay.h"
16 #include "squidgehack.h"
18 int CLImain(int argc, char *argv[]);
20 //#define SOUND_RATE 44100
21 #define SOUND_RATE 22050
22 #define GP2X_PORT_VERSION "0.4"
25 CFGSTRUCT DriverConfig[]={
27 ACA(Settings.joyBMap),
28 ACA(Settings.joyAMap),
32 AC(Settings.frameskip),
33 AC(Settings.sstate_confirm),
34 AC(Settings.region_force),
35 AC(Settings.cpuclock),
37 AC(Settings.ramtimings),
44 "-joyx y Use joystick y as virtual joystick x.\n\
47 Otherwise, x = playback rate.\n\
48 -showfps x Display fps counter if x is nonzero\n\
49 -mmuhack x Enable squidge's MMU hack if x is nonzero (GP2X).\n\
50 -ramtimings x Enable RAM overclocking if x is nonzero (GP2X).\n\
53 "-connect s Connect to server 's' for TCP/IP network play.\n\
54 -server Be a host/server for TCP/IP network play.\n\
55 -netport x Use TCP/IP port x for network play."
60 static int docheckie[2]={0,0};
62 ARGPSTRUCT DriverArgs[]={
63 {"-joy1",0,&Settings.joy[0],0},{"-joy2",0,&Settings.joy[1],0},
64 {"-joy3",0,&Settings.joy[2],0},{"-joy4",0,&Settings.joy[3],0},
65 {"-sound",0,&Settings.sound,0},
66 {"-showfps",0,&Settings.showfps,0},
67 {"-mmuhack",0,&Settings.mmuhack,0},
68 {"-ramtimings",0,&Settings.ramtimings,0},
69 {"-menu",0,&ext_menu,0x4001},
70 {"-menustate",0,&ext_state,0x4001},
72 {"-connect",&docheckie[0],&netplayhost,0x4001},
73 {"-server",&docheckie[1],0,0},
74 {"-netport",0,&Port,0},
81 void GetBaseDirectory(char *BaseDirectory)
83 strcpy(BaseDirectory, "fceultra");
86 static void SetDefaults(void)
88 memset(&Settings,0,sizeof(Settings));
89 Settings.cpuclock = 150;
90 Settings.frameskip = -1; // auto
92 Settings.sound=SOUND_RATE;
95 void DoDriverArgs(void)
102 else if(docheckie[1])
106 FCEUI_SetNetworkPlay(netplay);
112 memset(Settings.joyBMap[x],0,sizeof(Settings.joyBMap[0]));
113 memset(Settings.joyAMap[x],0,sizeof(Settings.joyAMap[0]));
122 void KillMouse(void){}
124 void GetMouseData(uint32 *d)
128 int InitKeyboard(void)
133 int UpdateKeyboard(void)
138 void KillKeyboard(void)
143 char *GetKeyboard(void)
148 extern int swapbuttons; // TODO: rm
153 int main(int argc, char *argv[])
158 puts("Starting GPFCE - Port version " GP2X_PORT_VERSION " (" __DATE__ ")");
159 puts("Based on FCE Ultra "VERSION_STRING"...");
160 puts("Ported by Zheng Zhu");
161 puts("Additional optimization/misc work by notaz\n");
166 // unscale the screen, in case this is bad.
167 gp2x_video_changemode(8);
168 gp2x_video_RGB_setscaling(0, 320, 240);
172 ret = CLImain(argc,argv);
174 // unscale the screen, in case this is bad.
175 gp2x_video_RGB_setscaling(0, 320, 240);
184 int mmuhack_status = 0;
186 /* optional GP2X stuff to be done after config is loaded */
187 void gp2x_opt_setup(void)
189 if (Settings.mmuhack) {
191 printf("squidge hack code finished and returned %i\n", ret); fflush(stdout);
192 mmuhack_status = ret;
194 if (Settings.ramtimings) {
195 printf("setting RAM timings.. "); fflush(stdout);
196 // craigix: --trc 6 --tras 4 --twr 1 --tmrd 1 --trfc 1 --trp 2 --trcd 2
197 set_RAM_Timings(6, 4, 1, 1, 1, 2, 2);
198 printf("done.\n"); fflush(stdout);