Beispiel #1
0
void Settings_Load()
{
	TYPE_File* fp;
	bool validSettings = FALSE;

	TAP_Hdd_ChangeDir( ".." );
	TAP_Hdd_ChangeDir( ".." );
	TAP_Hdd_ChangeDir( "ProgramFiles" );
	TAP_Hdd_ChangeDir( "Settings" );

	if ( fp = TAP_Hdd_Fopen(settingsFile) )
	{
		int version = 0;
		TAP_Hdd_Fread( &version, 1, sizeof(version), fp );
		if ( version == INI_VERSION )
		{
			TAP_Hdd_Fread( &settings, 1, sizeof(settings), fp );
			validSettings = TRUE;
		}
		TAP_Hdd_Fclose( fp );
	}

	if ( !validSettings )
	{
		Settings_Reset();
		Settings_Save();
	}
}
/**
DEBUG procedure: a random sequence of moves to check correct implementation
*/
void Game_Engine::Debug_Test_Sequence()
{

	Game_Reset();
	Settings_Reset();
	Game_Reset();
	for(int i = 0; i < maximum_plys+1; i++){
		Play_Move(Select_Move_Random());
		fflush(stdout);
		Output_Board_State();
	}

	Settings_Reset();
	Game_Reset();
	Settings_Reset();
	for(int i = 0; i < maximum_plys+1; i++){
		Play_Move(Select_Move_Random());
		fflush(stdout);
		Output_Board_State();
	}

	Settings_Reset();
	for(int i = 0; i < maximum_plys+1; i++){
		if(game_ended == 0){
			Play_Move_Unsafe(Select_Move_Random());
			fflush(stdout);
			Output_Board_State();
		}else
			i = maximum_plys;
	}

	fflush(stdout);
	gmp->Print("Moves history:");
	for(int i = 0; i < maximum_plys+1; i++)
		gmp->Print(" %d", history_moves[i]);
	gmp->Print("\n");

	fflush(stdout);
	Settings_Reset();

	for(int i = 0; i < 10; i++)
		Game_Reset();

	for(int i = 0; i < 10; i++)
		Settings_Reset();

	fflush(stdout);
}
Beispiel #3
0
dword OptionsMenu_HandleKey( dword key, dword keyHW )
{
	if ( windowActive )
	{
		int selection = TAP_Win_GetSelection( &window );

		switch ( key )
		{
		case RKEY_Ok:
			if ( selection == optionCount )
			{
				WriteErrorLog();
				OptionsMenu_Close();
			}
			if ( selection == optionCount+2 )
			{
				// Cancel - Reload original settings
				OptionsMenu_Close();
				Settings_Load();
			}
			return 0;

		case RKEY_0:
			if ( selection == optionCount+1 )
			{
				// Reset to defaults
				Settings_Reset();
				OptionsMenu_UpdateText();
			}
			return 0;

		case RKEY_Exit:
			OptionsMenu_Close();
			Settings_Save();
			return 0;

		case RKEY_VolUp:
			if ( selection == 0 )
				settings.insertSpace = !settings.insertSpace;
			else if ( selection == 1 )
				settings.addGenre = !settings.addGenre;
			OptionsMenu_UpdateText();
			return 0;

		case RKEY_VolDown:
			if ( selection == 0 )
				settings.insertSpace = !settings.insertSpace;
			else if ( selection == 1 )
				settings.addGenre = !settings.addGenre;
			OptionsMenu_UpdateText();
			return 0;

		case RKEY_ChDown:
			if ( selection < optionCount+2 )
			{
				TAP_Win_Action( &window, key );
				OptionsMenu_UpdateText();
			}
			return 0;
		case RKEY_ChUp:
			if ( selection > 0 )
			{
				TAP_Win_Action( &window, key );
				OptionsMenu_UpdateText();
			}
			return 0;

		default:
			TAP_Win_Action( &window, key ); // send all other key's to menu-Win
			return 0;
		}
	}

	return key;
}
Beispiel #4
0
dword OptionsMenu_HandleKey( dword key, dword keyHW )
{
	int selection = TAP_Win_GetSelection( &window );

	switch ( key )
	{
	case RKEY_Ok:
		if ( selection == optionCount+1 )
		{
			// Cancel - Reload original settings
			OptionsMenu_Close();
			Settings_Load();
		}
		return 0;

	case RKEY_Recall:
		if ( selection == optionCount )
		{
			// Reset to defaults
			Settings_Reset();
			OptionsMenu_UpdateText();
		}
		return 0;

	case RKEY_Exit:
		OptionsMenu_Close();
		Settings_Save();
		UndoFirmwareHacks();
		RemoteExtender_Init();
		if ( settings.mheg )
			MHEGState_Enable();
		if ( settings.quickAspectBlocker )
			QuickAspectBlocker_Enable();
		return 0;

	case RKEY_VolUp:
		if ( selection == 0 && RemoteExtender_Available )
			settings.remoteExtendingDisabled = !settings.remoteExtendingDisabled;
		else if ( selection == 1 && MHEGState_Available )
			settings.mheg = !settings.mheg;
		else if ( selection == 2 && QuickAspectBlocker_Available )
			settings.quickAspectBlocker = !settings.quickAspectBlocker;
		else
			return 0;
		OptionsMenu_UpdateText();
		return 0;

	case RKEY_VolDown:
		if ( selection == 0 && MHEGState_Available )
			settings.mheg = !settings.mheg;
		else if ( selection == 1 && MHEGState_Available )
			settings.mheg = !settings.mheg;
		else if ( selection == 2 && QuickAspectBlocker_Available )
			settings.quickAspectBlocker = !settings.quickAspectBlocker;
		else
			return 0;
		OptionsMenu_UpdateText();
		return 0;

	case RKEY_ChDown:
		if ( selection < optionCount+1 )
		{
			TAP_Win_Action( &window, key );
			OptionsMenu_UpdateText();
		}
		return 0;
	case RKEY_ChUp:
		if ( selection > 0 )
		{
			TAP_Win_Action( &window, key );
			OptionsMenu_UpdateText();
		}
		return 0;

	default:
		TAP_Win_Action( &window, key ); // send all other key's to menu-Win
		return 0;
	}

	return key;
}