6 #include "gp2x-video.h"
8 #include "unix-netplay.h"
12 int CLImain(int argc, char *argv[]);
13 extern void SetVideoScaling(int, int, int);
15 //#define SOUND_RATE 44100
16 #define SOUND_RATE 22050
17 #define GP2X_PORT_VERSION "0.3"
20 CFGSTRUCT DriverConfig[]={
44 //-fshack x Set the environment variable SDL_VIDEODRIVER to \"x\" when
45 // entering full screen mode and x is not \"0\".
48 "-xres x Set horizontal resolution to x for full screen mode.\n\
49 -yres x Set vertical resolution to x for full screen mode.\n\
50 -xscale(fs) x Multiply width by x.\n\
51 -yscale(fs) x Multiply height by x.\n\
52 -efx(fs) x Enable scanlines effect if x is non zero. yscale must be >=2\n\
53 and preferably a multiple of 2.\n\
54 -fs x Select full screen mode if x is non zero.\n\
55 -joyx y Use joystick y as virtual joystick x.\n\
58 Otherwise, x = playback rate.\n\
61 "-f8bit x Force 8-bit sound.\n\
66 "-lbufsize x Internal FCE Ultra sound buffer size. Size = 2^x samples.\n\
67 -ebufsize x External SDL sound buffer size. Size = 2^x samples.\n\
70 "-connect s Connect to server 's' for TCP/IP network play.\n\
71 -server Be a host/server for TCP/IP network play.\n\
72 -netport x Use TCP/IP port x for network play.";
75 static int docheckie[2]={0,0};
77 ARGPSTRUCT DriverArgs[]={
78 {"-joy1",0,&joy[0],0},{"-joy2",0,&joy[1],0},
79 {"-joy3",0,&joy[2],0},{"-joy4",0,&joy[3],0},
80 {"-xscale",0,&_xscale,0},
81 {"-yscale",0,&_yscale,0},
83 {"-xscalefs",0,&_xscalefs,0},
84 {"-yscalefs",0,&_yscalefs,0},
85 {"-efxfs",0,&_efxfs,0},
88 {"-fs",0,&_fullscreen,0},
89 //{"-fshack",0,&_fshack,0x4001},
90 {"-sound",0,&_sound,0},
92 {"-f8bit",0,&_f8bit,0},
94 {"-lbufsize",0,&_lbufsize,0},
95 {"-ebufsize",0,&_ebufsize,0},
98 {"-connect",&docheckie[0],&netplayhost,0x4001},
99 {"-server",&docheckie[1],0,0},
100 {"-netport",0,&Port,0},
109 void GetBaseDirectory(char *BaseDirectory)
113 ol="/mnt/sd/roms/nes";
117 strncpy(BaseDirectory,ol,2047);
118 BaseDirectory[2047]=0;
119 strcat(BaseDirectory,"/fceultra");
123 static void SetDefaults(void)
128 _sound=SOUND_RATE; // 48000 wrong
135 _xscale=_yscale=_xscalefs=_yscalefs=1;
137 //_fshack=_fshacksave=0;
138 memset(joy,0,sizeof(joy));
141 void DoDriverArgs(void)
160 else if(docheckie[1])
164 FCEUI_SetNetworkPlay(netplay);
170 memset(joyBMap[x],0,sizeof(joyBMap[0]));
171 memset(joyAMap[x],0,sizeof(joyAMap[0]));
178 void KillMouse(void){}
179 void GetMouseData(uint32 *d)
183 int InitKeyboard(void)
188 int UpdateKeyboard(void)
193 void KillKeyboard(void)
198 char *GetKeyboard(void)
203 #include "unix-basedir.h"
205 extern int swapbuttons;
208 int main(int argc, char *argv[])
212 puts("Starting GPFCE - Port version " GP2X_PORT_VERSION " (" __DATE__ ")");
213 puts("Based on FCE Ultra "VERSION_STRING"...");
214 puts("Ported by Zheng Zhu");
215 puts("Additional optimization/misc work by notaz\n");
218 //gp2x_init (1000, 8, SOUND_RATE, 16, 1, 60);
221 //gp2x_init (1000, 8, SOUND_RATE<<1, 16, 0, 60);
223 gp2x_init (1000, 8, SOUND_RATE, 16, 0, 60);
225 // unscale the screen, in case this is bad.
226 SetVideoScaling(320, 320, 240);
229 int ret=CLImain(argc,argv);
231 // unscale the screen, in case this is bad.
232 SetVideoScaling(320, 320, 240);
235 // make sure sound thread has exited cleanly
236 printf("Exiting main(). terminated");
237 if (showfps && swapbuttons)
239 execl("./selector","./selector","./gpfce_showfps_swapbuttons_config",NULL);
243 execl("./selector","./selector","./gpfce_showfps_config",NULL);
245 else if (swapbuttons)
247 execl("./selector","./selector","./gpfce_swapbuttons_config",NULL);
251 execl("./selector","./selector","./gpfce_config",NULL);