Пример #1
0
void osd_sound_enable(int enable_it)
{
	if (enable_it)
		gp2x_sound_volume(master_volume,master_volume);
	else
		gp2x_sound_volume(0,0);
}
Пример #2
0
void volume_down(void)
{
    if (volume > 0) {
        volume -= 5;
    }
    gp2x_sound_volume(volume, volume);
}
Пример #3
0
void volume_up(void)
{
    if (volume < 100) {
        volume += 5;
    }
    gp2x_sound_volume(volume, volume);
}
Пример #4
0
void emu_WriteConfig(void)
{
	FILE *f;

	getcwd(currentConfig.lastRomDir, MAXPATHLEN);
    printf("currentDir -> %s\n", currentConfig.lastRomDir);

	chdir(runPath); //change to dir where you launched app

	f = fopen("Potator2x.cfg", "wb");
	if (f) {
		fwrite(&currentConfig, 1, sizeof(currentConfig), f);
		fflush(f);
		fclose(f);
		sync();
	}

	chdir(currentConfig.lastRomDir); // change back to last dir (where you loaded the rom from)

	if(currentConfig.videoMode==2) 
		gp2x_video_RGB_setscaling(160, 160);
	else
		gp2x_video_RGB_setscaling(320, 240);

	CPUSetting(clocklist[currentConfig.CPUclock]);
	//gp2x_sound_rate(currentConfig.SoundRate);
	gp2x_sound_volume(currentConfig.volume,currentConfig.volume);
	gp2x_sound_pause(1^currentConfig.enable_sound);
}
Пример #5
0
void emu_ReadConfig(void)
{
	FILE *f;

	getcwd(currentConfig.lastRomDir, MAXPATHLEN);
    printf("currentDir -> %s\n", currentConfig.lastRomDir);

	chdir(runPath); //change to dir where you launched app

	// set default config
	memset(&currentConfig, 0, sizeof(currentConfig));
	//currentConfig.lastRomDir[0] = 0;
	currentConfig.videoMode = 0;
	currentConfig.show_fps = 0;
	currentConfig.enable_sound = 0;
	currentConfig.SoundRate = 11025;
	currentConfig.Frameskip = 0; // auto
	currentConfig.CPUclock = 1;
	currentConfig.volume = 255;
	gp2x_sound_volume(currentConfig.volume,currentConfig.volume);

	f = fopen("Potator2x.cfg", "rb");
	if (f) {
		fread(&currentConfig, 1, sizeof(currentConfig), f);
		fclose(f);
	}

	chdir(currentConfig.lastRomDir); // change back to last dir (where you loaded the rom from)

	if(currentConfig.videoMode==2) 
		gp2x_video_RGB_setscaling(160, 160);
	else
		gp2x_video_RGB_setscaling(320, 240);

	CPUSetting(clocklist[currentConfig.CPUclock]);
	//gp2x_sound_rate(currentConfig.SoundRate);
	gp2x_sound_volume(currentConfig.volume,currentConfig.volume);
	gp2x_sound_pause(1^currentConfig.enable_sound);
}
Пример #6
0
void gp2x_overclock()
{
  gpsp_gp2x_dev = open("/dev/mem",   O_RDWR);
  gpsp_gp2x_dev_audio = open("/dev/mixer", O_RDWR);
  gpsp_gp2x_memregl =
   (unsigned long  *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED,
   gpsp_gp2x_dev, 0xc0000000);
  gpsp_gp2x_memregs = (unsigned short *)gpsp_gp2x_memregl;

  clear_screen(0);
  main_cpuspeed(0, NULL);
  gp2x_sound_volume(1);
}
Пример #7
0
/* attenuation in dB */
void osd_set_mastervolume(int _attenuation)
{
	float volume;


	if (_attenuation > 0) _attenuation = 0;
	if (_attenuation < -32) _attenuation = -32;

	attenuation = _attenuation;

 	volume = 100.0;	/* range is 0-100 */
	while (_attenuation++ < 0)
		volume /= 1.122018454;	/* = (10 ^ (1/20)) = 1dB */

	master_volume = volume;

	gp2x_sound_volume(master_volume,master_volume);
}
Пример #8
0
void CheckKeys(void)
{
	unsigned long  pad=gp2x_joystick_read(0);

	if(pad & GP2X_VOL_DOWN) if(pad & GP2X_START) {
		supervision_done(); //shutsdown the system
		//gp2x_deinit();
		exit(0);
	}

	if(pad & GP2X_L) if(pad & GP2X_R) //Checks if L and R are pushed
	supervision_reset(); //Reset emulator

	if(pad & GP2X_L) if(pad & GP2X_LEFT) //Checks if L and LEFT pushed
	supervision_set_colour_scheme(COLOUR_SCHEME_DEFAULT); //Changes the color scheme

	if(pad & GP2X_L) if(pad & GP2X_RIGHT) //Checks if L and RIGHT are pushed
	supervision_set_colour_scheme(COLOUR_SCHEME_AMBER); //Changes the color scheme

	if(pad & GP2X_L) if(pad & GP2X_UP) //Checks if L and UP pushed
	supervision_set_colour_scheme(COLOUR_SCHEME_GREEN); //Changes the color scheme

	if(pad & GP2X_L) if(pad & GP2X_DOWN) //Checks if L and DOWN pushed
	supervision_set_colour_scheme(COLOUR_SCHEME_BLUE); //Changes the color scheme

	if(pad & GP2X_Y) {
	paused=TRUE;
	textClear();
	handleMainMenu(); // File menu
	paused=FALSE;}

	if (pad & (GP2X_VOL_UP|GP2X_VOL_DOWN)) {
		int vol = currentConfig.volume;
		if (pad & GP2X_VOL_UP) {
			if (vol < 255) vol++;
		} else {
			if (vol >   0) vol--;
		}
		gp2x_sound_volume(vol, vol);
		currentConfig.volume = vol;
	}
}
Пример #9
0
int main(int argc, char *argv[])
{
	gp2x_init(1000, 16, 11025,16,1,60, 1);
	gp2x_sound_volume(100,100);

	screen16 = (unsigned short *)gp2x_video_RGB[0].screen;

	int i,j;
	char temp[255];

	FILE *in = NULL;
    
    if(argc <= 1) {
		printf("\nnot enough arguments\n");
		//return(TRUE);
	} else {
	
		// the hard-core UI, a command line:
		for (i=0; (i < argc || argv[i] != NULL); i++) {
		
			if(strcmp(argv[i], "--double") == 0) {
				//screen_size = 1;
			}
			if(strcmp(argv[i], "--color white") == 0) {
				supervision_set_colour_scheme(COLOUR_SCHEME_DEFAULT);
			}
			if(strcmp(argv[i], "--color amber") == 0) {
				supervision_set_colour_scheme(COLOUR_SCHEME_AMBER);
			}
			if(strcmp(argv[i], "--color green") == 0) {
				supervision_set_colour_scheme(COLOUR_SCHEME_GREEN);
			}
			if(strcmp(argv[i], "--color blue") == 0) {
				supervision_set_colour_scheme(COLOUR_SCHEME_BLUE);
			}
		}
	
		romname = strdup(argv[1]);
		in = fopen(romname, "r");
	
		if(in == NULL) {
			printf("The file %s doesn't exist.\n",romname);
			exit(0);
		}
		fflush(in);
		fclose(in);
	}
		
	supervision_init(); //Init the emulator

	getRunDir();

	if(romname!=NULL){
		loadROM(romname);
		supervision_load((u8*)buffer, (uint32)buffer_size);
	} else {
		handleFileMenu(); // File menu
	}

	emu_ReadConfig();

	gp2x_sound_volume(255,255);
	gp2x_sound_pause(0);

	while(1)
	{
	  CheckKeys();

	  while(!paused)
	  {
		 CheckKeys(); //key control

		 controls_update();

		 switch(currentConfig.videoMode){
			case 0: 
				supervision_exec((int16*)screenbuffer,1);

				for(j=0; j < 160; j++) 
		 			gp2x_memcpy(screen16+(80+(j+40)*320),screenbuffer+(j * 160),160*2);
				break;
			case 1: 
				supervision_exec2((int16*)screen16,1); 
				break;
			case 2: 
				supervision_exec3((int16*)screen16,1);
				break;
			default: break;
		 }

		 /*gp2x_video_waitvsync();

		 sprintf(temp,"FPS: %3d", FPS);
		 gp2x_printf(NULL,0,0,temp);
		 ++svFrm;*/

		 gp2x_video_RGB_flip(0);


		 controls_reset();
	  }
	}
	supervision_done(); //shutsdown the system
	gp2x_deinit();
}
Пример #10
0
int InitSound(void)
{
	FCEUI_Sound(Settings.sound_rate);
	gp2x_sound_volume(soundvol, soundvol);
	return 1;
}