void gp2x_clear_screen(void) { /* Clean screens */ gp2x_video_flip(); fast_memset(gp2x_screen8, 0, GP2X_BYTE_SIZE_SCREEN); gp2x_video_flip(); fast_memset(gp2x_screen8, 0, GP2X_BYTE_SIZE_SCREEN); gp2x_video_flip_single(); }
/* Pause Text Message */ void gp2x_text_pause(void) { gp2x_video_flip_single(); #ifdef GP2X if (gp2x_showfps) { int offsetx=0; int offsety=0; if (gp2x_bordertvout) { offsetx+=((((gp2x_bordertvout_width*gp2x_text_width)/100)+7)&~7)/2; offsety+=((((gp2x_bordertvout_height*(gp2x_rotate&1?visible_game_width:visible_game_height))/100)+7)&~7)/2; } fast_memset(&gp2x_screen8[(0+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(1+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(2+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(3+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(4+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(5+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(6+offsety)*gp2x_text_width]+offsetx,0,48); fast_memset(&gp2x_screen8[(7+offsety)*gp2x_text_width]+offsetx,0,48); } gp2x_text(gp2x_screen8,1,1,"PAUSE\0",0); gp2x_text(gp2x_screen8,0,0,"PAUSE\0",1); #else #ifdef PSP_RES gp2x_text(gp2x_screen8,190,160,"Arcade Paused!\0",0); gp2x_text(gp2x_screen8,190,160,"Arcade Paused!\0",1); gp2x_text(gp2x_screen8,190,170,"L+R to Continue\0",0); gp2x_text(gp2x_screen8,190,170,"L+R to Continue\0",1); gp2x_text(gp2x_screen8,190,180,"or HOME to Quit\0",0); gp2x_text(gp2x_screen8,190,180,"or HOME to Quit\0",1); #else gp2x_text(gp2x_screen8,141,111,"PAUSE\0",0); gp2x_text(gp2x_screen8,140,110,"PAUSE\0",1); #endif #endif gp2x_video_flip_single(); }
void gp2x_set_video_mode(int bpp,int width,int height) { //if(iOS_video_width!=width || iOS_video_height!=height) //{ iOS_video_width = width; iOS_video_height = height; iphone_Reset_Views(); //} memset(gp2x_screen15, 0, iOS_video_width*iOS_video_height*2); gp2x_video_flip(); gp2x_video_flip_single(); gp2x_pal_50hz=0; }
void gp2x_set_video_mode(int bpp,int width,int height) { //if(iOS_video_width!=width || iOS_video_height!=height) //{ droid_video_width = width; droid_video_height = height; changeVideo_callback(width, height); //} memset(gp2x_screen15, 0, droid_video_width*droid_video_height*2); gp2x_video_flip(); gp2x_video_flip_single(); gp2x_pal_50hz=0; }
void SysPrintf(const char *fmt, ...) { va_list list; va_start(list, fmt); vsprintf(__sysmsg, fmt, list); va_end(list); __sysmsg[1023]=0; if (Config.PsxOut) printf (PSX4ALL_STR, __sysmsg); #if defined(__WIN32__) && !defined(GIZMONDO) OutputDebugString(__sysmsg); #endif gp2x_printf(NULL, 0, 90, __sysmsg); gp2x_video_flip_single(); #ifdef EMU_LOG fprintf(emuLog, PSX4ALL_STR, __sysmsg); #endif }
static void gp2x_text(unsigned char *screen, int x, int y, char *text, int color) { unsigned int i,l; screen=screen+x+y*gp2x_text_width; for (i=0;i<strlen(text);i++) { for (l=0;l<8;l++) { screen[l*gp2x_text_width+0]=(fontdata8x8[((text[i])*8)+l]&0x80)?color:screen[l*gp2x_text_width+0]; screen[l*gp2x_text_width+1]=(fontdata8x8[((text[i])*8)+l]&0x40)?color:screen[l*gp2x_text_width+1]; screen[l*gp2x_text_width+2]=(fontdata8x8[((text[i])*8)+l]&0x20)?color:screen[l*gp2x_text_width+2]; screen[l*gp2x_text_width+3]=(fontdata8x8[((text[i])*8)+l]&0x10)?color:screen[l*gp2x_text_width+3]; screen[l*gp2x_text_width+4]=(fontdata8x8[((text[i])*8)+l]&0x08)?color:screen[l*gp2x_text_width+4]; screen[l*gp2x_text_width+5]=(fontdata8x8[((text[i])*8)+l]&0x04)?color:screen[l*gp2x_text_width+5]; screen[l*gp2x_text_width+6]=(fontdata8x8[((text[i])*8)+l]&0x02)?color:screen[l*gp2x_text_width+6]; screen[l*gp2x_text_width+7]=(fontdata8x8[((text[i])*8)+l]&0x01)?color:screen[l*gp2x_text_width+7]; } screen+=8; } #ifdef GP2X if (gp2x_bordertvout) { screen+=((((gp2x_bordertvout_width*gp2x_text_width)/100)+7)&~7)/2; if (gp2x_rotate) screen+=(((((gp2x_bordertvout_height*(gp2x_rotate&1?visible_game_width:visible_game_height))/100)+7)&~7)/2)*gp2x_text_width; else screen+=(((((gp2x_bordertvout_height*240)/100)+7)&~7)/2)*gp2x_text_width; } #endif #if !defined(GP2X) && defined(GP2X_SDLWRAPPER_NODOUBLEBUFFER) if (gp2x_sdlwrapper_is_single) gp2x_video_flip_single(); #endif }
int main(int argc, char *argv[]) #endif { #ifndef IPHONE #if defined(ARM_ARCH) ChangeWorkingDirectory(argv[0]); getcwd(gamepath, 256); #else #if defined(__WIN32__) if(argc == 1) strncpy(gamepath,"E:\\ps1",256); else strncpy(gamepath,argv[1],256); #else strncpy(gamepath,ROM_PREFIX,256); #endif #endif #endif #ifdef PSP sprintf(gamepath,""); #endif #ifdef IPHONE sprintf(gamepath,""); #endif memset(&Config, 0, sizeof(PsxConfig)); Config.PsxAuto = 1; Config.Cdda = 1; Config.Xa = 0; #ifdef DYNAREC Config.Cpu = 0; #else Config.Cpu = 1; #endif #ifdef WITH_HLE Config.HLE = 1; #else Config.HLE = 0; #endif Config.Mdec = 0; Config.PsxOut = 0; Config.PsxType = 0; Config.QKeys = 0; Config.RCntFix = 0; Config.Sio = 0; Config.SpuIrq = 1; Config.VSyncWA = 0; #if defined(PSP) || defined(SDL) || defined(IPHONE) sprintf(Config.BiosDir, "%s/Media/ROMs/PSX/", appworkdir); sprintf(Config.Bios, "scph1001.bin"); sprintf(Config.Mcd1, "mcd001.mcr"); sprintf(Config.Mcd2, "mcd002.mcr"); #else sprintf(Config.BiosDir, PSX4ALL_STR, gamepath); sprintf(Config.Bios, "/bios/scph1000.bin"); sprintf(Config.Mcd1, "%s/memory_card/mcd001.mcr", gamepath); sprintf(Config.Mcd2, "%s/memory_card/mcd002.mcr", gamepath); #endif gp2x_init(900, 16, 11025, 16, 1, 60, 1); #ifndef GP2X gp2x_video_flip_single(); #endif #ifdef IPHONE u32 loadsvs = 0; linesInterlace_user = preferences.interlace; skipCount = skipCountTablePhone[preferences.frameSkip]; skipRate = skipRateTablePhone[preferences.frameSkip]; iSoundMuted = preferences.muted; Config.Cdda = preferences.muted; Config.Xa = preferences.muted; #ifdef WITH_HLE Config.HLE = !preferences.bios; #else Config.HLE = 0; #endif if( (!strcasecmp(filename + (strlen(filename)-4), FORMAT_SV )) ) { u32 pos; loadsvs = 1; sprintf(svsfilename, PSX4ALL_STR, filename); sprintf(iphonefile, PSX4ALL_STR, filename); pos = strlen(iphonefile)-18; iphonefile[pos] = '\0'; packfile = iphonefile; } else { loadsvs = 0; sprintf(iphonefile, PSX4ALL_STR, filename); packfile = iphonefile; } gp2x_video_RGB_clearscreen16(); LoadCdBios = 0; if (SysInit() == -1) { gp2x_deinit(); return 0; } if (InitComponents() == -1) { gp2x_deinit(); return 0; } SysReset(); CheckCdrom(); if( Config.HLE ) { LoadCdBios = 0; if( LoadCdrom() == -1 ) { gp2x_printf(NULL, 120, 120, PSX4ALL_LDD); gp2x_video_flip(); gp2x_timer_delay(2000); gp2x_video_RGB_clearscreen16(); return 0; } } if (loadsvs) { if( LoadState(svsfilename) == -1 ) { gp2x_printf(NULL, 120, 120, PSX4ALL_LSF); gp2x_video_flip(); gp2x_timer_delay(2000); gp2x_video_RGB_clearscreen16(); psxShutdown(); CloseComponents(); gp2x_deinit(); pthread_exit(NULL); } } psx4all_emulating=1; psx4all_prof_start(PROFILER_TOTAL); psxCpu->Execute(); psx4all_prof_end(PROFILER_TOTAL); psx4all_emulating=0; psx4all_prof_show(); #else if( 0 != SelectGame() ) { psx4all_emulating=1; psx4all_prof_start(PROFILER_TOTAL); psxCpu->Execute(); psx4all_prof_end(PROFILER_TOTAL); psx4all_emulating=0; psx4all_prof_show(); } #endif gp2x_deinit(); return 0; }
//extern "C" int iphone_main (int argc, char **argv) { int res, i, j = 0, game_index; char *playbackname = NULL; int use_cyclone=0; int use_drz80=0; extern int video_scale; extern int video_border; extern int video_aspect; extern int throttle; extern int gp2x_ram_tweaks; memset(&options,0,sizeof(options)); /* these two are not available in mame.cfg */ errorlog = 0; game_index = -1; throttle=1;//FIX Seleuco for (i = 1;i < argc;i++) /* V.V_121997 */ { if (strcasecmp(argv[i],"-log") == 0) errorlog = fopen("error.log","wa"); #if 0 if (strcasecmp(argv[i],"-cyclone") == 0) use_cyclone=1; if (strcasecmp(argv[i],"-drz80") == 0) use_drz80=1; #endif if (strcasecmp(argv[i],"-scale") == 0) video_scale=1; if (strcasecmp(argv[i],"-border") == 0) video_border=1; if (strcasecmp(argv[i],"-aspect") == 0) video_aspect=1; if (strcasecmp(argv[i],"-nothrottle") == 0) { throttle=0; } //printf("throttle %d\n",throttle); if (strcasecmp(argv[i],"-ramtweaks") == 0) gp2x_ram_tweaks=1; if (strcasecmp(argv[i],"-playback") == 0) { i++; if (i < argc) /* point to inp file name */ playbackname = argv[i]; } } /* GP2X Initialization */ //gp2x_init(1000,8,22050,16,0,60); /* check for frontend options */ // res = frontend_help (argc, argv); /* if frontend options were used, return to DOS with the error code */ /* if (res != 1234) { return 0; //gp2x_deinit(); //execl("mame.gpe", "mame.gpe", "cache", NULL); //exit (res); } */ //TODO: MIRAR POR QUE ESTO PETA REARRANCANDO VARIOS GAMES /* handle playback which is not available in mame.cfg */ // init_inpdir(); /* Init input directory for opening .inp for playback */ ///LO DEJO COMENTADO if (playbackname != NULL) options.playback = osd_fopen(playbackname,0,OSD_FILETYPE_INPUTLOG,0); /* check for game name embedded in .inp header */ if (options.playback) { INP_HEADER inp_header; /* read playback header */ osd_fread(options.playback, &inp_header, sizeof(INP_HEADER)); if (!isalnum(inp_header.name[0])) /* If first byte is not alpha-numeric */ osd_fseek(options.playback, 0, SEEK_SET); /* old .inp file - no header */ else { for (i = 0; (drivers[i] != 0); i++) /* find game and play it */ { if (strcmp(drivers[i]->name, inp_header.name) == 0) { game_index = i; printf("Playing back previously recorded game %s (%s) [press return]\n", drivers[game_index]->name,drivers[game_index]->description); getchar(); break; } } } } /* If not playing back a new .inp file */ if (game_index == -1) { /* take the first commandline argument without "-" as the game name */ for (j = 1; j < argc; j++) { if (argv[j][0] != '-') break; } /* do we have a driver for this? */ { for (i = 0; drivers[i] && (game_index == -1); i++) { if (strcasecmp(argv[j],drivers[i]->name) == 0) { game_index = i; break; } } /* educated guess on what the user wants to play */ if (game_index == -1) { int fuzz = 9999; /* best fuzz factor so far */ for (i = 0; (drivers[i] != 0); i++) { int tmp; tmp = fuzzycmp(argv[j], drivers[i]->description); /* continue if the fuzz index is worse */ if (tmp > fuzz) continue; /* on equal fuzz index, we prefer working, original games */ if (tmp == fuzz) { /* game is a clone */ if (drivers[i]->clone_of != 0 && !(drivers[i]->clone_of->flags & NOT_A_DRIVER)) { /* if the game we already found works, why bother. */ /* and broken clones aren't very helpful either */ if ((!drivers[game_index]->flags & GAME_NOT_WORKING) || (drivers[i]->flags & GAME_NOT_WORKING)) continue; } else continue; } /* we found a better match */ game_index = i; fuzz = tmp; } if (game_index != -1) printf("fuzzy name compare, running %s\n",drivers[game_index]->name); } } if (game_index == -1) { printf("Game \"%s\" not supported\n", argv[j]); return 1; } } /* parse generic (os-independent) options */ parse_cmdline (argc, argv, game_index); { /* Mish: I need sample rate initialised _before_ rom loading for optional rom regions */ extern int soundcard; if (soundcard == 0) { /* silence, this would be -1 if unknown in which case all roms are loaded */ Machine->sample_rate = 0; /* update the Machine structure to show that sound is disabled */ options.samplerate=0; } } /* handle record which is not available in mame.cfg */ for (i = 1; i < argc; i++) { if (strcasecmp(argv[i],"-record") == 0) { i++; if (i < argc) options.record = osd_fopen(argv[i],0,OSD_FILETYPE_INPUTLOG,1); } } if (options.record) { INP_HEADER inp_header; memset(&inp_header, '\0', sizeof(INP_HEADER)); strcpy(inp_header.name, drivers[game_index]->name); /* MAME32 stores the MAME version numbers at bytes 9 - 11 * MAME DOS keeps this information in a string, the * Windows code defines them in the Makefile. */ /* inp_header.version[0] = 0; inp_header.version[1] = VERSION; inp_header.version[2] = BETA_VERSION; */ osd_fwrite(options.record, &inp_header, sizeof(INP_HEADER)); } #if 0 /* Replace M68000 by CYCLONE */ if (use_cyclone) { for (i=0;i<MAX_CPU;i++) { int *type=(int*)&(drivers[game_index]->drv->cpu[i].cpu_type); #ifdef NEOMAME if (((*type)&0xff)==CPU_M68000) #else if (((*type)&0xff)==CPU_M68000 || ((*type)&0xff)==CPU_M68010 ) #endif { *type=((*type)&(~0xff))|CPU_CYCLONE; } } } /* Replace Z80 by DRZ80 */ if (use_drz80) { for (i=0;i<MAX_CPU;i++) { int *type=(int*)&(drivers[game_index]->drv->cpu[i].cpu_type); if (((*type)&0xff)==CPU_Z80) { *type=((*type)&(~0xff))|CPU_DRZ80; } } } #endif // Remove the mouse usage for certain games if ( (strcasecmp(drivers[game_index]->name,"hbarrel")==0) || (strcasecmp(drivers[game_index]->name,"hbarrelw")==0) || (strcasecmp(drivers[game_index]->name,"midres")==0) || (strcasecmp(drivers[game_index]->name,"midresu")==0) || (strcasecmp(drivers[game_index]->name,"midresj")==0) || (strcasecmp(drivers[game_index]->name,"tnk3")==0) || (strcasecmp(drivers[game_index]->name,"tnk3j")==0) || (strcasecmp(drivers[game_index]->name,"ikari")==0) || (strcasecmp(drivers[game_index]->name,"ikarijp")==0) || (strcasecmp(drivers[game_index]->name,"ikarijpb")==0) || (strcasecmp(drivers[game_index]->name,"victroad")==0) || (strcasecmp(drivers[game_index]->name,"dogosoke")==0) || (strcasecmp(drivers[game_index]->name,"gwar")==0) || (strcasecmp(drivers[game_index]->name,"gwarj")==0) || (strcasecmp(drivers[game_index]->name,"gwara")==0) || (strcasecmp(drivers[game_index]->name,"gwarb")==0) || (strcasecmp(drivers[game_index]->name,"bermudat")==0) || (strcasecmp(drivers[game_index]->name,"bermudaj")==0) || (strcasecmp(drivers[game_index]->name,"bermudaa")==0) || (strcasecmp(drivers[game_index]->name,"mplanets")==0) || (strcasecmp(drivers[game_index]->name,"forgottn")==0) || (strcasecmp(drivers[game_index]->name,"lostwrld")==0) || (strcasecmp(drivers[game_index]->name,"gondo")==0) || (strcasecmp(drivers[game_index]->name,"makyosen")==0) || (strcasecmp(drivers[game_index]->name,"topgunr")==0) || (strcasecmp(drivers[game_index]->name,"topgunbl")==0) || (strcasecmp(drivers[game_index]->name,"tron")==0) || (strcasecmp(drivers[game_index]->name,"tron2")==0) || (strcasecmp(drivers[game_index]->name,"kroozr")==0) ||(strcasecmp(drivers[game_index]->name,"crater")==0) || (strcasecmp(drivers[game_index]->name,"dotron")==0) || (strcasecmp(drivers[game_index]->name,"dotrone")==0) || (strcasecmp(drivers[game_index]->name,"zwackery")==0) || (strcasecmp(drivers[game_index]->name,"ikari3")==0) || (strcasecmp(drivers[game_index]->name,"searchar")==0) || (strcasecmp(drivers[game_index]->name,"sercharu")==0) || (strcasecmp(drivers[game_index]->name,"timesold")==0) || (strcasecmp(drivers[game_index]->name,"timesol1")==0) || (strcasecmp(drivers[game_index]->name,"btlfield")==0) || (strcasecmp(drivers[game_index]->name,"aztarac")==0)) { extern int use_mouse; use_mouse=0; } /* go for it */ printf ("%s (%s)...\n",drivers[game_index]->description,drivers[game_index]->name); res = run_game (game_index); /* close open files */ if (errorlog) fclose (errorlog); if (options.playback) osd_fclose (options.playback); if (options.record) osd_fclose (options.record); if (options.language_file) osd_fclose (options.language_file); if (res!=0) { /* wait a key press */ gp2x_video_flip_single(); gp2x_joystick_press(0); } //gp2x_deinit(); //execl("mame.gpe", "mame.gpe", "cache", NULL); //exit (res); }