Example #1
0
int os_process_arguments (int argc, char *argv[])
{
    return iphone_main(argc, argv);
}/* os_process_arguments */
void *app_Thread_Start(void *args) {
    iphone_main(__fileName);
}
void execute_game (char *playemu, char *playgame)
{
	char *args[255];
	char str[8][64];
	int n=0;
	int i=0;
	
	/* executable */
	args[n]=playemu; n++;

	/* playgame */
	args[n]=playgame; n++;
/*
	args[n]="-depth"; n++;
	if(!safe_render_path)
		args[n]="8";
	else
		args[n]="16";
	n++;
	*/

	/* gp2x_video_depth */
	if (iOS_video_depth==8)
	{
		args[n]="-depth"; n++;
		args[n]="8"; n++;
	}
	if (iOS_video_depth==16)
	{
		args[n]="-depth"; n++;
		args[n]="16"; n++;
	}

	/* iOS_video_aspect */
	iOS_aspectRatio = iOS_cropVideo = iOS_fixedRes = 0;
    if (iOS_video_aspect==0)
	{
    	iOS_aspectRatio = 1;
    }else if(iOS_video_aspect==1){
		iOS_cropVideo = 1;
    }else if(iOS_video_aspect==2){
		iOS_cropVideo = 2;
    }else if(iOS_video_aspect==3){
		iOS_fixedRes = 1;
		//printf("fixed %d,%d,%d\n",iOS_aspectRatio,iOS_cropVideo,iOS_320x240);
    }else if(iOS_video_aspect==4){
		iOS_fixedRes = 2;
    }else if(iOS_video_aspect==5){
		iOS_fixedRes = 3;
    }else if(iOS_video_aspect==6){
		iOS_fixedRes = 4;
    }

	/* iOS_video_rotate */
	if ((iOS_video_rotate>=1) && (iOS_video_rotate<=2))
	{
		args[n]="-ror"; n++;
	}

	if ((iOS_video_rotate>=2) && (iOS_video_rotate<=2))
	{
		args[n]="-rotatecontrols"; n++;
	}
	
	/* iOS_video_sync */
    if (iOS_video_sync==1)
	{
		args[n]="-nodirty"; n++;
	}
	else if (iOS_video_sync==-1)
	{
		args[n]="-nothrottle"; n++;
	}
	
	/* iOS_frameskip */
	if (iOS_frameskip>=0)
	{
		args[n]="-frameskip"; n++;
		sprintf(str[i],"%d",iOS_frameskip);
		args[n]=str[i]; i++; n++;
	}

	/* iOS_sound */
	if (iOS_sound==0)
	{
		args[n]="-soundcard"; n++;
		args[n]="0"; n++;
	}
	if ((iOS_sound==1) || (iOS_sound==5) || (iOS_sound==9))
	{
		args[n]="-samplerate"; n++;
		args[n]="11025"; n++;
	}
	if ((iOS_sound==2) || (iOS_sound==6) || (iOS_sound==10))
	{
		args[n]="-samplerate"; n++;
		args[n]="22050"; n++;
	}
	if ((iOS_sound==3) || (iOS_sound==7) || (iOS_sound==11))
	{
		args[n]="-samplerate"; n++;
		args[n]="32000"; n++;
	}
	if ((iOS_sound==4) || (iOS_sound==8) || (iOS_sound==12))
	{
		args[n]="-samplerate"; n++;
		args[n]="44100"; n++;
	}

	if ((iOS_sound>=1) && (iOS_sound<=4))
	{
		args[n]="-fastsound"; n++;
	}
	if (iOS_sound>=9)
	{
		args[n]="-stereo"; n++;
	}

	/* iOS_clock_cpu */
	if (iOS_clock_cpu!=100)
	{
		args[n]="-uclock"; n++;
		sprintf(str[i],"%d",100-iOS_clock_cpu);
		args[n]=str[i]; i++; n++;
	}

	/* iOS_clock_sound */
	if (iOS_clock_cpu!=100)
	{
		args[n]="-uclocks"; n++;
		sprintf(str[i],"%d",100-iOS_clock_sound);
		args[n]=str[i]; i++; n++;
	}

	if (iOS_cheat)
	{
		args[n]="-cheat"; n++;
	}

	if (0)
	{
		args[n]="-romdir"; n++;
		sprintf(str[i],"%s",get_documents_path("roms"));
		args[n]=str[i]; i++; n++;
	}

	args[n]=NULL;
	
	for (i=0; i<n; i++)
	{
		printf("%s ",args[i]);
	}
	printf("\n");
	
	iOS_inGame = 1;
	iOS_exitGame=0;
	iOS_hide_LR = iOS_buttons!=6;
	iOS_BplusX = iOS_buttons==3;
	iOS_landscape_buttons = iOS_buttons <= 3 ? iOS_buttons : (iOS_buttons - 1) ;
	//gp2x_set_video_mode(16,320,240);
	iphone_main(n, args);

	if(isIpad)
		iOS_buttons=2;
	else
		iOS_buttons=2;

	iOS_hide_LR = 0;
	iOS_BplusX = 0;

	iOS_exitGame=0;
	iOS_inGame = 0;
	iOS_landscape_buttons = 2;
	emulated_width = 320;
	emulated_height = 240;
	gp2x_set_video_mode(16,320,240);

}