Ejemplo n.º 1
0
bool Panel_Remaps::DoChangeImgDest( bool b_quiet, bool standalone)
{
	if( !paletteCtrl->b_init )
		return false;

	if( curr_remap == NULL )
		return false;

	//******************************
	// Get the new path
	wxString dest_obPath = txtctrl_destimg->GetValue();
	wxString _destPath = GetObFile( dest_obPath ).GetFullPath();
	if( _destPath == wxString() )
		b_quiet = true;

	//******************************
	// Make the change to the ob_object
	if( mode8bit )
	{
		wxString old_path = curr_remap->GetToken( 1 );
		if( old_path != dest_obPath )
		{
			entity->SetChanged();
			if( curr_remap->GetToken( 0 ) == wxString() )
				curr_remap->SetToken( 0, wxT("UNSETTED") );
			curr_remap->SetToken( 1, dest_obPath );
		}
	}
	else
	{
		// Set the palette tag
		wxString old_path = curr_remap->GetToken( 0 );
		if( old_path != dest_obPath )
		{
			entity->SetChanged();
			curr_remap->SetToken( 0, dest_obPath );
		}
	}

	//******************************
	// Undo the previous remapping
	paletteCtrl->UndoRemapping();

	bool res = false;

	//******************************
	// Check if the destination file exist
	if( ! wxFileName( _destPath ).FileExists() && !b_quiet )
		wxMessageBox( wxT("The Destination image for the remap doesn't exist")
		, wxT("ProPlem"), wxOK | wxICON_INFORMATION, this );

	else if( IsFileEmpty(_destPath) && !b_quiet )
		wxMessageBox( wxT("The Destination image for the remap is an empty file")
		, wxT("ProPlem"), wxOK | wxICON_INFORMATION, this );

	else if( ! wxImage( _destPath ).IsOk() && !b_quiet)
		wxMessageBox( wxT("Problem with the loading destination image of the remap")
		, wxT("ProPlem"), wxOK | wxICON_INFORMATION, this );

	else if( paletteCtrl->b_init )
	{
		res = paletteCtrl->InitRemapping_With( _destPath );
		if( ! res && !b_quiet)
			wxMessageBox(   wxT( "Problem with apply remapping between the two images\nAre they really fit each others ?")
			, wxT("ProPlem"), wxOK | wxICON_INFORMATION, this );

	}

	// Force refresh in case remapping didn"t work
	if( ! res )
		paletteCtrl->Refresh();

	if( standalone )
		Refresh();

	return res;
}
Ejemplo n.º 2
0
bool Panel_Remaps::DoChangeImgBase( bool b_quiet, bool standalone)
{
	paletteCtrl->Reset(false);
	if( curr_remap == NULL )
		return false;

	int i_EnableEditingTheRemap = 1;
	bool res = false;

	wxString ob_basePath = txtctrl_imgBase->GetValue();
	wxString _basePath = GetObFile( ob_basePath ).GetFullPath();

	//******************************
	// Make the change to the ob_object
	if( mode8bit )
	{
		wxString old_path = curr_remap->GetToken( 0 );
		if( old_path != ob_basePath )
		{
			entity->SetChanged();
			curr_remap->SetToken( 0, ob_basePath );
		}
	}
	else
	{
		ob_object *pal_obobj = entity->GetProperty( wxT("palette") );

		// No current palette tag in the current entity
		wxString old_path = wxString();
		if( pal_obobj == NULL )
		{
			pal_obobj = new ob_object();
			pal_obobj->SetName( wxT("palette") );

			//Try to insert one before the first alternatepal
			size_t nb_remap;
			ob_object** _t = entity->GetSubObjectS( wxT("alternatepal"),nb_remap );
			
			if( _t != NULL )
			{
				_t[nb_remap-1]->InsertObject_After( pal_obobj );
				delete[] _t;
			}
			// Try to insert it before the first anim
			else
				entity->AddProperty( pal_obobj );
		}
		else
			old_path = pal_obobj->GetToken( 0 );

		// Set the palette tag
		if( old_path != ob_basePath )
		{
			// Check if the user really want to change the image base for all remaps
			int res = wxMessageBox( wxT("Do your really want to change the image base for all 16Bits remaps ?"), wxT("Question"), wxYES_NO | wxICON_INFORMATION, this );
			if( res != wxYES )
				return false;

			entity->SetChanged();
			pal_obobj->SetToken( 0, ob_basePath );
		}
	}


	//******************************
	// Check if it's a valid path
	if( ! wxFileName( _basePath ).FileExists() && !b_quiet )
	{
		wxMessageBox( wxT("The Base image for this remap doesn't exist")
		, wxT("ProPlem"), wxOK | wxICON_INFORMATION, this );
	}

	else if( IsFileEmpty(_basePath) && !b_quiet )
	{
		wxMessageBox( wxT("The Base image for this remap is an empty file !!")
		, wxT("ProPlem"), wxOK | wxICON_INFORMATION, this );
	}


	//******************************
	// Try to load the palette
	else if( paletteCtrl->TryToInitWithImage( _basePath ) )
	{
		res = true;
		i_EnableEditingTheRemap = 0;

		//******************************
		// Try to quietly to load the dest palette
		if( standalone  )
			DoChangeImgDest( true, false);
	}

	EnableEditingTheRemap(i_EnableEditingTheRemap);
	if( standalone )
		Refresh();

	return res;
}
Ejemplo n.º 3
0
int main(int argc, char *argv[ ]){
	ClearPrints();
	chdir(CombineStrings("/home/", GetUser()));
	DelFile(output_log);
	DebugLog("--- Begin Android Dev Tools ARGS");
	for(tick = 1; tick < argc; tick++) DebugLog(CombineStrings("ARG: ", argv[tick]));
	DebugLog("");
	DebugLog("--- Begin Android Dev Tools");
	CmdOut("aDev_adb devices > tmp.txt");
	if(IsFileEmpty("tmp.txt")){
		ClearPrints();
		PrintText("--- Proprietary Files Not Found! ---");
		PrintText("Run: \'aDev config\'");
		LineSkip();
		exit(-1);		
	}
	DelFile("tmp.txt");
	if(argc <= 1){
		PrintText("--- Invalid parameters! ---");
		PrintText("Run: \'aDev --help\'");
		LineSkip();
		exit(-1);
	}
	for(tick = 1; tick < argc; tick++){
		if(IsStringEmpty(argv[tick])) continue;
		if(CompareStrings(argv[tick], "--help") || CompareStrings(argv[tick], "-h")){
			PrintHelp();
			exit(0);
		}
		if(CompareStrings(argv[tick], "--version") || CompareStrings(argv[tick], "-v")){
			PrintVersion();
			exit(0);
		}
		else if(CompareStrings(argv[tick], "test")){
			PrintText("aDev was properly installed, enjoy!");
			LineSkip();
			exit(0);
		}
		else if(CompareStrings(argv[tick], "logcat")){
			DevLog(1);
			exit(0);
		}
		else if(CompareStrings(argv[tick], "dmesg")){
			DevLog(2);
			exit(0);
		}
		else if(CompareStrings(argv[tick], "kmsg")){
			DevLog(3);
			exit(0);
		}
		else if(CompareStrings(argv[tick], "screenshot")){
			ScreenShot();
			exit(0);
		}
		else if(CompareStrings(argv[tick], "info")){
			Info();
			exit(0);
		}
		else if(CompareStrings(argv[tick], "adb")){
			text = "aDev_adb ";
			for(tick2 = 1; tick2 < argc; tick2++) if(!CompareStrings(argv[tick2], "adb")) text = CombineStrings(text, CombineStrings(argv[tick2], " "));
			CmdOut(text);
			exit(0);
		}
		else if(CompareStrings(argv[tick], "fastboot")){
			text = "aDev_fastboot ";
			for(tick2 = 1; tick2 < argc; tick2++) if(!CompareStrings(argv[tick2], "fastboot")) text = CombineStrings(text, CombineStrings(argv[tick2], " "));
			CmdOut(text);
			exit(0);
		}
		else{
			for(tick2 = (argc - 1); tick2 < 0; tick2--){
				if(!IsValidArg(argv[tick2])) break;
				if(tick2 == 1) quit();
			}
			if(IsValidArg(argv[tick2])) tick2--;
			if(IsValidArg(argv[tick2])) quit();
			PrintText(CombineStrings("Unknown Parameter: ", argv[tick2]));
			quit();
		}
	}
	return 0;
}