예제 #1
0
파일: 7.c 프로젝트: eeallen1/Assignments
int main()
{
	PC p;

	setRam(2048, &p);
	setSpeed(7.5, &p);

	printf("This computer has %d MBs of memory and a %f GHz processor!", getRam(p), getSpeed(p));
}
예제 #2
0
void KatMenu::action(const gcn::ActionEvent &actionEvent)
{
	std::string tmp_string;
	t_config *p_config = config_get_ptr();

	mMenuListener.setGuiMain ( mGuiMain );

	if ( actionEvent.getId() == "mLoad" ) 
	{
		mGuiMain->getFileBrowser()->deleteActions();
		mGuiMain->getFileBrowser()->addActionListener(&mMenuListener);
		mGuiMain->getFileBrowser()->setActionEventId("LoadBrowser");
		mGuiMain->getFileBrowser()->show("Load ROM", p_config->rom_file, FileBrowser::LOAD);
	}
	else if ( actionEvent.getId() == "mSaveState" ) 
	{
		mGuiMain->getProfilePopup()->deleteActions();
		mGuiMain->getProfilePopup()->addActionListener(&mMenuListener);
		mGuiMain->getProfilePopup()->setActionEventId("SaveState");
		mGuiMain->getProfilePopup()->show( "Choose State or Create New", "SELECT Name FROM States", "", true );
	}
	else if ( actionEvent.getId() == "mLoadState" ) 
	{
		mGuiMain->getProfilePopup()->deleteActions();
		mGuiMain->getProfilePopup()->addActionListener(&mMenuListener);
		mGuiMain->getProfilePopup()->setActionEventId("LoadState");
		mGuiMain->getProfilePopup()->show( "Load State", "SELECT Name FROM States", "", false );
	}
	else if ( actionEvent.getId().find( "mQuickSaveState", 0 ) != std::string::npos ) 
	{
		save_quick_state ( atoi(actionEvent.getId().c_str()+15), console_get_ptr() );
		checkSaveStateExistance();
	}
	else if ( actionEvent.getId().find( "mQuickLoadState", 0 ) != std::string::npos ) 
	{
		if ( recall_quick_state ( atoi(actionEvent.getId().c_str()+15), console_get_ptr() ) )
		{
			mGuiMain->getInfoPopup()->deleteActions();
			mGuiMain->getInfoPopup()->show( "Error Loading State" );
			return;
		}
		mGuiMain->launch( 1, 0 );
	}
	else if ( actionEvent.getId() == "mLauncher" ) 
		mGuiMain->showLauncher();

	else if ( actionEvent.getId() == "mBack" ) 
		mGuiMain->launch( 0, 0 );

	else if ( actionEvent.getId() == "mExit" ) 
		mGuiMain->exit();

	else if ( actionEvent.getId().find( "mAtari", 0 ) != std::string::npos ) 
	{
		if ( actionEvent.getId().find( "5200", 0 ) != std::string::npos ) 
			setMachine ( MACHINE_TYPE_5200 );
		else if ( actionEvent.getId().find( "800", 0 ) != std::string::npos ) 
			setMachine ( MACHINE_TYPE_800 );
		else
			setMachine ( MACHINE_TYPE_XL );
		setRam ( p_config->machine_type, p_config->ram_size[p_config->machine_type] );
		config_save();
	}
	else if ( actionEvent.getId().find( "mRam", 0 ) != std::string::npos ) 
		setRam ( p_config->machine_type, atoi(actionEvent.getId().c_str()+4) );

	else if ( actionEvent.getId() == "mNTSC" ) 
	{
		setItemChecked ( "mNTSC", true );
		setItemChecked ( "mPAL", false );
		p_config->system_type = NTSC;
		config_save();
	}
	else if ( actionEvent.getId() == "mPAL" ) 
	{
		setItemChecked ( "mNTSC", false );
		setItemChecked ( "mPAL", true );
		p_config->system_type = PAL;
		config_save();
	}
	else if ( actionEvent.getId() == "mThrottle" ) 
		mGuiMain->showThrottle();

	else if ( actionEvent.getId() == "mBios" ) 
		mGuiMain->showBiosCfg();

	else if ( actionEvent.getId() == "mMedia" ) 
		mGuiMain->showMediaCfg();

	else if ( actionEvent.getId() == "mSioPatch" ) 
	{
		if ( p_config->sio_patch )
		{
			setItemChecked ( "mSioPatch", false );
			p_config->sio_patch = 0;
		}
		else
		{
			setItemChecked ( "mSioPatch", true );
			p_config->sio_patch = 1;
		}
		config_save();
	}
	else if ( actionEvent.getId() == "mBasicEnabled" ) 
	{
		if ( p_config->basic_enable )
		{
			setItemChecked ( "mBasicEnabled", false );
			p_config->basic_enable = 0;
		}
		else
		{
			setItemChecked ( "mBasicEnabled", true );
			p_config->basic_enable = 1;
		}
		config_save();
	}
	else if ( actionEvent.getId() == "mResetWarm" ) 
	{
		/* FIXME: What if no ROM loaded?  It will crash! */
		reset_6502();
	}
	else if ( actionEvent.getId() == "mResetCold" ) {
		console_reset ( p_config->machine_type, p_config->system_type, p_config->ram_size[p_config->machine_type], g_sound.freq  );
	}
	else if ( actionEvent.getId() == "m1x" ) 
	{
		setItemChecked ( "m1x", true );
		setItemChecked ( "m2x", false );
		setItemChecked ( "m3x", false );
		g_video.zoom = 0;
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "m2x" ) 
	{
		setItemChecked ( "m1x", false );
		setItemChecked ( "m2x", true );
		setItemChecked ( "m3x", false );
		g_video.zoom = 1;
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "m3x" ) 
	{
		setItemChecked ( "m1x", false );
		setItemChecked ( "m2x", false );
		setItemChecked ( "m3x", true );
		g_video.zoom = 2;
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "mFullscreen" ) 
	{
		if ( g_video.fullscreen )
		{
			g_video.fullscreen = 0;
			setItemChecked ( "mFullscreen", false );
		}
		else
		{
			g_video.fullscreen = 1;
			setItemChecked ( "mFullscreen", true );
		}
		video_save_profile ( g_video.name, &g_video );
	}
	else if ( actionEvent.getId() == "mVideo" ) 
		mGuiMain->showVideoCfg();

	else if ( actionEvent.getId() == "mSound" ) 
		mGuiMain->showSoundCfg();

	else if ( actionEvent.getId() == "mInput" ) 
		mGuiMain->showInputCfg();

	else if ( actionEvent.getId() == "mPalEdit" ) 
		mGuiMain->showPaletteCfg();

	else if ( actionEvent.getId() == "mUI" ) 
		mGuiMain->showUserInterfaceCfg();

	else if ( actionEvent.getId() == "mImport" ) 
		mGuiMain->showConvert ( Convert::CONVERT_A800 );

	else if ( actionEvent.getId() == "mExport" ) 
		mGuiMain->showConvert ( Convert::CONVERT_KAT5200 );

	else if ( actionEvent.getId() == "mWizard" ) 
	{
		tmp_string = " ";
		mGuiMain->showWizard( tmp_string );
	}

	else if ( actionEvent.getId() == "mMediaCreate" ) 
		mGuiMain->showMediaCreate();

	else if ( actionEvent.getId() == "mViewLog" ) 
		mGuiMain->showLog();
}