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
19 CFGSTRUCT DriverConfig[]={
43 //-fshack x Set the environment variable SDL_VIDEODRIVER to \"x\" when
44 // entering full screen mode and x is not \"0\".
47 "-xres x Set horizontal resolution to x for full screen mode.\n\
48 -yres x Set vertical resolution to x for full screen mode.\n\
49 -xscale(fs) x Multiply width by x.\n\
50 -yscale(fs) x Multiply height by x.\n\
51 -efx(fs) x Enable scanlines effect if x is non zero. yscale must be >=2\n\
52 and preferably a multiple of 2.\n\
53 -fs x Select full screen mode if x is non zero.\n\
54 -joyx y Use joystick y as virtual joystick x.\n\
57 Otherwise, x = playback rate.\n\
60 "-f8bit x Force 8-bit sound.\n\
65 "-lbufsize x Internal FCE Ultra sound buffer size. Size = 2^x samples.\n\
66 -ebufsize x External SDL sound buffer size. Size = 2^x samples.\n\
69 "-connect s Connect to server 's' for TCP/IP network play.\n\
70 -server Be a host/server for TCP/IP network play.\n\
71 -netport x Use TCP/IP port x for network play.";
74 static int docheckie[2]={0,0};
76 ARGPSTRUCT DriverArgs[]={
77 {"-joy1",0,&joy[0],0},{"-joy2",0,&joy[1],0},
78 {"-joy3",0,&joy[2],0},{"-joy4",0,&joy[3],0},
79 {"-xscale",0,&_xscale,0},
80 {"-yscale",0,&_yscale,0},
82 {"-xscalefs",0,&_xscalefs,0},
83 {"-yscalefs",0,&_yscalefs,0},
84 {"-efxfs",0,&_efxfs,0},
87 {"-fs",0,&_fullscreen,0},
88 //{"-fshack",0,&_fshack,0x4001},
89 {"-sound",0,&_sound,0},
91 {"-f8bit",0,&_f8bit,0},
93 {"-lbufsize",0,&_lbufsize,0},
94 {"-ebufsize",0,&_ebufsize,0},
97 {"-connect",&docheckie[0],&netplayhost,0x4001},
98 {"-server",&docheckie[1],0,0},
99 {"-netport",0,&Port,0},
108 void GetBaseDirectory(char *BaseDirectory)
112 ol="/mnt/sd/roms/nes";
116 strncpy(BaseDirectory,ol,2047);
117 BaseDirectory[2047]=0;
118 strcat(BaseDirectory,"/fceultra");
122 static void SetDefaults(void)
127 _sound=SOUND_RATE; // 48000 wrong
134 _xscale=_yscale=_xscalefs=_yscalefs=1;
136 //_fshack=_fshacksave=0;
137 memset(joy,0,sizeof(joy));
140 void DoDriverArgs(void)
159 else if(docheckie[1])
163 FCEUI_SetNetworkPlay(netplay);
169 memset(joyBMap[x],0,sizeof(joyBMap[0]));
170 memset(joyAMap[x],0,sizeof(joyAMap[0]));
177 void KillMouse(void){}
178 void GetMouseData(uint32 *d)
182 int InitKeyboard(void)
187 int UpdateKeyboard(void)
192 void KillKeyboard(void)
197 char *GetKeyboard(void)
202 #include "unix-basedir.h"
204 extern int swapbuttons;
206 int main(int argc, char *argv[])
209 puts("Starting GPFCE - Port version 0.2 05-29-2006");
210 puts("Based on FCE Ultra "VERSION_STRING"...");
211 puts("Ported by Zheng Zhu\n");
214 //gp2x_init (1000, 8, SOUND_RATE, 16, 1, 60);
217 //gp2x_init (1000, 8, SOUND_RATE<<1, 16, 0, 60);
219 gp2x_init (1000, 8, SOUND_RATE, 16, 0, 60);
222 int ret=CLImain(argc,argv);
224 // unscale the screen, in case this is bad.
225 SetVideoScaling(320, 320, 240);
228 // make sure sound thread has exited cleanly
229 printf("Exiting main(). terminated");
230 if (showfps && swapbuttons)
232 execl("./selector","./selector","./gpfce_showfps_swapbuttons_config",NULL);
236 execl("./selector","./selector","./gpfce_showfps_config",NULL);
238 else if (swapbuttons)
240 execl("./selector","./selector","./gpfce_swapbuttons_config",NULL);
244 execl("./selector","./selector","./gpfce_config",NULL);