[source Code}mini Xex Loader And File Manager Beta


max2010
 Share

Messages recommandés

I share the project, because I am a bit tired / stuck, no debug This is a hell of trial and error.

I hope it will encourage more people to develop a self-loader and open source.

//--------------------------------------------------------------------------------------// XuiTutorial.cpp//// Shows how to display and use a simple XUI scene.//// Xbox Advanced Technology Group.// Copyright (C) Microsoft Corporation. All rights reserved.//--------------------------------------------------------------------------------------#include <xtl.h>#include <xui.h>#include <xuiapp.h>#include <stdio.h>#include <xtl.h>#include <string>using namespace std;/*		List of physical drive		"\\Device\\Flash"	"\\Device\\Mu1"	"\\Device\\Mu0"	"\\Device\\Cdrom0"	"\\Device\\Harddisk0\\Partition0"	"\\Device\\Harddisk0\\Partition1"	"\\Device\\Harddisk0\\Partition2"	"\\Device\\Harddisk0\\Partition3"	"\\Device\\Mass0"	"\\Device\\Mass1"	"\\Device\\Mass2"		*/		#define DEVICE_NAND_FLASH 0	#define DEVICE_MEMORY_UNIT0 1	#define DEVICE_MEMORY_UNIT1 2	#define DEVICE_CDROM0 3	#define DEVICE_HARDISK0_PART0 4	#define DEVICE_HARDISK0_PART1 5	#define DEVICE_HARDISK0_PART2 6	#define DEVICE_HARDISK0_PART3 7	#define DEVICE_USB0 8	#define DEVICE_USB1 9	#define DEVICE_USB2 10		typedef struct _STRING {		USHORT Length;		USHORT MaximumLength;		PCHAR Buffer;	} STRING;		// Follow the white rabbit 	extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*);	extern "C" int __stdcall ObDeleteSymbolicLink( STRING* );HRESULT Monter( int periphPhys, char* lettreLecteur ){	char lecteurCible[16];	sprintf_s(lecteurCible,"\\??\\%s", lettreLecteur );		char * periphOriginal;	switch( periphPhys )	{	case DEVICE_NAND_FLASH:		periphOriginal = "\\Device\\Flash";		break;	case DEVICE_MEMORY_UNIT0:		periphOriginal = "\\Device\\Mu0";		break;	case DEVICE_MEMORY_UNIT1:		periphOriginal = "\\Device\\Mu1";		break;	case DEVICE_CDROM0:		periphOriginal = "\\Device\\Cdrom0";		break;	case DEVICE_HARDISK0_PART0:		periphOriginal = "\\Device\\Harddisk0\\Partition0";		break;	case DEVICE_HARDISK0_PART1:		periphOriginal = "\\Device\\Harddisk0\\Partition1";		break;	case DEVICE_HARDISK0_PART2:		periphOriginal = "\\Device\\Harddisk0\\Partition2";		break;	case DEVICE_HARDISK0_PART3:		periphOriginal = "\\Device\\Harddisk0\\Partition3";		break;	case DEVICE_USB0:		periphOriginal = "\\Device\\Mass0";		break;	case DEVICE_USB1:		periphOriginal = "\\Device\\Mass1";		break;	case DEVICE_USB2:		periphOriginal = "\\Device\\Mass2";		break;	}	STRING PeriphOriginal = { strlen( periphOriginal ), strlen( periphOriginal ) + 1, periphOriginal };	STRING LienSymbolique = { strlen( lecteurCible ), strlen( lecteurCible ) + 1, lecteurCible };	return ( HRESULT )ObCreateSymbolicLink( &LienSymbolique, &PeriphOriginal );}	HRESULT Demonter( char* lettreLecteur ){	char lecteurCible[16];	sprintf_s( lecteurCible,"\\??\\%s", lettreLecteur );		STRING LienSymbolique = { strlen(lecteurCible), strlen(lecteurCible) + 1, lecteurCible };	return ( HRESULT )ObDeleteSymbolicLink( &LienSymbolique );}//--------------------------------------------------------------------------------------// Scene implementation class.//--------------------------------------------------------------------------------------class CMyMainScene : public CXuiSceneImpl{protected:	// Control and Element wrapper objects.	CXuiTextElement m_text1;	CXuiTextElement m_text2;	CXuiList m_list1;	CXuiList m_list2;	CXuiList m_list3;	CXuiImageElement m_image1;	CXuiScrollBar m_scrollBar1;	CXuiProgressBar m_progressBar1;	CXuiElement m_button1;	string directorioActual;	string filesToCopy[200][2];	string filesToMove[200][2];	// Message map.	XUI_BEGIN_MSG_MAP()		XUI_ON_XM_INIT( OnInit )		XUI_ON_XM_NOTIFY_PRESS( OnNotifyPress )		XUI_ON_XM_KEYDOWN( OnKeyDown )	XUI_END_MSG_MAP()	//----------------------------------------------------------------------------------	// Performs initialization tasks - retreives controls.	//----------------------------------------------------------------------------------	HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled )	{		// Retrieve controls for later use.		GetChildById( L"XuiText1", &m_text1 );		GetChildById( L"XuiText2", &m_text2 );		GetChildById( L"XuiCommonList1", &m_list1 );		GetChildById( L"XuiCommonList2", &m_list2 );		GetChildById( L"XuiCommonList3", &m_list3 );		GetChildById( L"XuiImage1", &m_image1 );		GetChildById( L"XuiScrollBar1", &m_scrollBar1 );		GetChildById( L"XuiProgressBar1", &m_progressBar1 );		GetChildById( L"XuiButton1", &m_button1 );		// Montamos los dispositivos//		if (ERROR_SUCCESS == Monter(DEVICE_CDROM0, "dvd0:"))//			m_list1.DeleteItems(3, 1);		Monter(DEVICE_CDROM0, "dvd0:");		Monter(DEVICE_USB0, "usb0:");		Monter(DEVICE_HARDISK0_PART1, "hdd1:");		Monter(DEVICE_NAND_FLASH, "flash:");		//Oculta los elementos inecesarios		m_list3.SetOpacity(0);		m_text2.SetOpacity(0);		m_progressBar1.SetOpacity(0);		m_button1.SetOpacity(0);		//Enfoca la lista de dispositivos		m_list1.SetFocus(XUSER_INDEX_ANY);		return S_OK;	}	//----------------------------------------------------------------------------------	// Handler for the button press message.	//----------------------------------------------------------------------------------	HRESULT OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )	{		LPSTR fileName = new char[MAX_PATH];		LPSTR fullPath = new char[MAX_PATH];		LPSTR device = new char[MAX_PATH];		LPSTR Option = new char[MAX_PATH];		// Si se ha pulsado un boton de la lista de dispositivos		if( hObjPressed == m_list1 )		{			bHandled = TRUE;			//Se convierte el nombre del dispositivo a caracteres anchos			::WideCharToMultiByte( CP_ACP, NULL,m_list1.GetText(m_list1.GetCurSel()), -1, device,MAX_PATH,NULL,NULL );			//Se ocualta la lista de dispositivos			m_list1.SetOpacity(0);			//Se muestra el dispositivo seleccionado			OpenDevice(device);		}		// Si se ha pulsado un boton de la lista de ficheros		else if( hObjPressed == m_list2 )		{				bHandled = TRUE;			//Añade una barra al directorio actual			directorioActual+="\\";			//Convierte el nombre del fichero a caracteres			::WideCharToMultiByte(CP_ACP,NULL,m_list2.GetText(m_list2.GetCurSel()),-1,fileName,MAX_PATH,NULL,NULL);			//Añade el nombre del fichero al directorio Actual			directorioActual+= fileName;			//Copia el directorioActual al puntero directorio			directorioActual._Copy_s(fullPath, directorioActual.length(),directorioActual.length());			//Añade el final del fichero			fullPath[directorioActual.length()]='\0';			//Si el fichero seleccionado es un directorio			if(FILE_ATTRIBUTE_DIRECTORY == GetFileAttributes(fullPath))			{				//Abre el directorio				OpenDevice(fullPath);			}			else			//Si es un fichero			{				//Se comprueba si es un ejecutable				string str = fileName;				if (str.find(".xex")!=string::npos)				{					//Se lanza el ejecutable					XLaunchNewImage(fullPath, NULL);				}				}		}		// Si se ha pulsado un boton de la lista de opciones de ficheros		else if( hObjPressed == m_list3 )		{			bHandled = TRUE;			//Si se ha seccionado "Copiar"			if (m_list3.GetCurSel()==0)			{				m_text1.SetText(L"Copiar");				CopyFiles();			}			//Si se ha seccionado "Cortar"			else if (m_list3.GetCurSel()==1)			{				m_text1.SetText(L"Cortar");				CutFiles();			}			//Si se ha seccionado "Pegar"			else if (m_list3.GetCurSel()==2)			{				m_text1.SetText(L"Pegar");				PasteFiles();			}			//Si se ha seccionado "Borrar"			else if (m_list3.GetCurSel()==3)			{				m_text1.SetText(L"Borrar");				DeleteFiles();			}			//Si se ha seccionado "Crear"			else if (m_list3.GetCurSel()==4)			{				m_text1.SetText(L"Crear");				CreateDir();			}			//Se oculta la lista de opciones			m_list3.SetOpacity(0);			//Se enfoca la lista de ficheros			m_list2.SetFocus(XUSER_INDEX_ANY);		}		return S_OK;	}	//----------------------------------------------------------------------------------	// Handler for the button press message.	//----------------------------------------------------------------------------------	HRESULT OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled)	{		string str;		CXuiControl ItemCtrl1;		CXuiControl ItemCtrl2;		CXuiControl ItemCtrl3;		// Recuperamos los botones seleccionado de todas las listas		// para comprobar en que lista esta enfocada		m_list1.GetCurSel(&ItemCtrl1);		m_list2.GetCurSel(&ItemCtrl2);		m_list3.GetCurSel(&ItemCtrl3);		// Si se pulsa sobre la lista de dispositivos		if ( ItemCtrl1 == ItemCtrl1.GetFocus(XUSER_INDEX_ANY))		{		}		// Si se pulsa sobre la lista de ficheros		else if ( ItemCtrl2 == ItemCtrl2.GetFocus(XUSER_INDEX_ANY))		{			// Si se pulsa el boton B			if ( pInputData->dwKeyCode == VK_PAD_B )			{				//Se obtiene la posicion de la ultima barra del directorio actual				size_t pos = directorioActual.find_last_of("\\");				if (pos!=string::npos)				{					//Se extrae el subdirectorio					directorioActual = directorioActual.substr(0,pos);					//Se abre el subdirectorio					OpenDevice(directorioActual);				}				bHandled = TRUE;			}			// Si se pulsa el boton BACK			else if ( pInputData->dwKeyCode == VK_PAD_BACK )			{				//Se muestra la lista de dispositivos				m_list1.SetOpacity(1);				//Se enfoca la lista de dispositivos				m_list1.SetFocus(XUSER_INDEX_ANY);				bHandled = TRUE;			}			// Si se pulsa el boton X			else if ( pInputData->dwKeyCode == VK_PAD_X )			{				// Si el boton seleccionado esta marcado				if ( TRUE == m_list2.GetItemCheck(m_list2.GetCurSel()))				{					// Se quita la marca y se habilita					m_list2.SetItemCheck(m_list2.GetCurSel(), FALSE);					m_list2.SetItemEnable(m_list2.GetCurSel(), TRUE);					m_text1.SetText(L"UnCheck");				}				// Si el boton seleccionado no esta marcado				else				{					// Se marca y se deshabilita					m_list2.SetItemCheck(m_list2.GetCurSel(), TRUE);					m_list2.SetItemEnable(m_list2.GetCurSel(), FALSE);					m_text1.SetText(L"Check");				}				bHandled = TRUE;			}			// Si se pulsa el boton Y			else if ( pInputData->dwKeyCode == VK_PAD_Y )			{				// Se muestra la lista de opciones				 m_list3.SetOpacity(1);				// Se enfoca la lista de opciones				m_list3.SetFocus(XUSER_INDEX_ANY);				bHandled = TRUE;			}			// Si se pulsa arriba en el pad			else if ( pInputData->dwKeyCode == VK_PAD_DPAD_UP )			{				XuiScrollBarSetItemData( m_scrollBar1, m_list2.GetItemCount(), m_list2.GetCurSel(), 7 );			}			// Si se pulsa abajo en el pad			else if ( pInputData->dwKeyCode == VK_PAD_DPAD_DOWN )			{				XuiScrollBarSetItemData( m_scrollBar1, m_list2.GetItemCount(), m_list2.GetCurSel(), 7 );			}		// Si se pulsa sobre la lista de opciones de ficheros		}else if( ItemCtrl3 == ItemCtrl2.GetFocus(XUSER_INDEX_ANY))			{			}		return S_OK;	}	//----------------------------------------------------------------------------------	// Abre un dispositivo y rellena la lista con los nombres.	//----------------------------------------------------------------------------------	HRESULT OpenDevice(string strFind)	{		HANDLE hFind;								//Manejador de ficheros		WIN32_FIND_DATA wfd;						//Informacion de los ficheros		LPSTR directorio = new char[MAX_PATH];		//Directorio		LPWSTR directorioW = new wchar_t[MAX_PATH];	//Directorio en caracteres anchos		LPSTR fileName = new char[MAX_PATH];		//Nombre del fichero		LPWSTR fileNameW = new wchar_t[MAX_PATH];	//Nombre del fichero en caracteres anchos		//Guarda el directorio actual		directorioActual = strFind;		//Enfoca la lista de archivos		m_list2.SetFocus(XUSER_INDEX_ANY);		//Añado \* al directorio para buscar todos los archivos		strFind+= "\\*";		//Copia el directorio al puntero directorio		strFind._Copy_s(directorio, strFind.length(),strFind.length());		//Añade el final del fichero		directorio[strFind.length()]='\0';		//Convierte el directorio a caracteres anchos directorioW				::MultiByteToWideChar( CP_ACP, NULL,directorio, -1, directorioW, MAX_PATH);		// Muestro el nombre del directorio explorado		m_text1.SetText(directorioW);		// Empieza la busqueda de ficheros		hFind = FindFirstFile( directorio, &wfd );		if( INVALID_HANDLE_VALUE == hFind )		{			//Si falla la busqueda		}		else		{			// Elimino todos los Items de la lista			m_list2.DeleteItems(0, m_list2.GetItemCount());			int i = 0;			// Se trata el fichero y se obtiene el siguiente			do			{				string str = wfd.cFileName;				// Si existe el fichero nxeart, cargo la imagen de fondo//				if (strcmp (wfd.cFileName,"nxeart")== 0)				if (str.find("nxeart")!=string::npos)				{					CargarFondo();				}					// Inserto un Item en la lista y le paso el nombre del fichero convirtiendolo en caracteres anchos				m_list2.InsertItems(i,1);				fileName = wfd.cFileName;				::MultiByteToWideChar( CP_ACP, NULL,fileName, -1, fileNameW, MAX_PATH);				m_list2.SetText(i,fileNameW);				//Segun el tipo de fichero se asigna un icono								if(FILE_ATTRIBUTE_DIRECTORY == wfd.dwFileAttributes)				{					m_list2.SetImage(i,L"file://game:/media/folder.png");				}				else if ((str.find(".xex"))!=string::npos)				{					m_list2.SetImage(i,L"file://game:/media/xex.png");				}				else					m_list2.SetImage(i,L"file://game:/media/file.png");				i++;			} while( FindNextFile( hFind, &wfd ));			// Cierra el manejador de la busqueda			FindClose( hFind );		}		return S_OK;	}	//----------------------------------------------------------------------------------	// Copia los ficheros	//----------------------------------------------------------------------------------	VOID CopyFiles()	{		LPSTR fileName = new char[MAX_PATH];		//Nombre del fichero		LPWSTR fileNameW = new wchar_t[MAX_PATH];	//Nombre del fichero en caracteres anchos		int cont = 0;		for (int i=0; i<m_list2.GetItemCount(); i++)		{			if (m_list2.GetItemCheck(i) == TRUE )			{				//Convierte el nombre del fichero a caracteres				::WideCharToMultiByte(CP_ACP,NULL,m_list2.GetText(i),-1,fileName,MAX_PATH,NULL,NULL);				//Añade el nombre del fichero al directorio Actual				filesToCopy[cont][0]+= directorioActual;				filesToCopy[cont][0]+= "\\";				filesToCopy[cont][0]+= fileName;				filesToCopy[cont][0]+= '\0';				cont++;			}			filesToCopy[cont][0].clear();			filesToMove[0][0].clear();			filesToCopy[0][0]._Copy_s(fileName, filesToCopy[0][0].length(),filesToCopy[0][0].length());			fileName[filesToCopy[0][0].length()]='\0';			::MultiByteToWideChar( CP_ACP, NULL,fileName, -1, fileNameW, MAX_PATH);			m_text1.SetText(fileNameW);		}	}	//----------------------------------------------------------------------------------	// Corta los ficheros	//----------------------------------------------------------------------------------	VOID CutFiles()	{		LPSTR fileName = new char[MAX_PATH];		//Nombre del fichero		int cont = 0;		for (int i=0; i<m_list2.GetItemCount(); i++)		{			if (m_list2.GetItemCheck(i) == TRUE )			{				//Convierte el nombre del fichero a caracteres				::WideCharToMultiByte(CP_ACP,NULL,m_list2.GetText(i),-1,fileName,MAX_PATH,NULL,NULL);				//Añade el nombre del fichero al directorio Actual				filesToMove[cont][0]+= directorioActual;				filesToMove[cont][0]+= "\\";				filesToMove[cont][0]+= fileName;				filesToCopy[cont][0]+= '\0';				cont++;			}		}		filesToMove[cont][0].clear();		filesToCopy[0][0].clear();	}	//----------------------------------------------------------------------------------	// Indica el progreso en la copia de ficheros	//----------------------------------------------------------------------------------/*	static DWORD CopyProgressRoutine(		  LARGE_INTEGER TotalFileSize, // file size		  LARGE_INTEGER TotalBytesTransferred, // bytes transferred		  LARGE_INTEGER StreamSize, // bytes in stream		  LARGE_INTEGER StreamBytesTransferred, // bytes transferred for stream		  DWORD dwStreamNumber, // current stream		  DWORD dwCallbackReason, // callback reason		  HANDLE hSourceFile, // handle to source file		  HANDLE hDestinationFile, // handle to destination file		  LPVOID lpData )// from CopyFileEx	{		int nValue = (TotalFileSize.QuadPart / TotalBytesTransferred.QuadPart) * 100;		m_progressBar1.std.SetValue(nValue);		return 0;	}*/  //----------------------------------------------------------------------------------	// Pega los ficheros	//----------------------------------------------------------------------------------	VOID PasteFiles()	{		LPSTR fileName = new char[MAX_PATH];		//Nombre del fichero		LPWSTR fileNameW = new wchar_t[MAX_PATH];	//Nombre del fichero caracteres anchos		string sfileName;		LPSTR origen;		LPSTR destino;		m_text2.SetOpacity(1);		m_button1.SetOpacity(1);		m_progressBar1.SetOpacity(1);		int i = 0;		if (filesToCopy[i][0] != "\0")		{			do{				//Inicializa la barra de progreso				m_progressBar1.SetRange(0,100);				m_progressBar1.SetValue(0);				//Copia el nombre del directorio actual				filesToCopy[i][1] = directorioActual;				//Se obtiene la posicion de la ultima barra del directorio actual				size_t pos = filesToCopy[i][0].find_last_of("\\");				//Extrae el nombre del fichero				sfileName = filesToCopy[i][0].substr( pos, filesToCopy[i][0].length() );				//Copiar el nombre del fichero a un puntero				sfileName._Copy_s(fileName, sfileName.length(),sfileName.length());				//Añade el nombre del fichero al directorio destino				filesToCopy[i][1]+=sfileName;				filesToCopy[i][1]+='\0';				//Convierte el nombre del fichero a caracteres anchos				::MultiByteToWideChar( CP_ACP, NULL,fileName, -1, fileNameW, MAX_PATH);				//Se muestra el nombre en el boton de la barra de progreso				m_text2.SetText(fileNameW);				//Copia el directorio al puntero directorio				filesToCopy[i][0]._Copy_s(origen, filesToCopy[i][0].length(),filesToCopy[i][0].length());				origen[filesToCopy[i][0].length()]='\0';				//Copia el directorio al puntero directorio				filesToCopy[i][1]._Copy_s(destino, filesToCopy[i][1].length(),filesToCopy[i][1].length());				destino[filesToCopy[i][1].length()]='\0';				CopyFileEx(				  origen, // name of existing file				  destino, // name of new file				  NULL,//CopyProgressRoutine, // callback function				  NULL, // callback parameter				  NULL, // cancel status				  COPY_FILE_FAIL_IF_EXISTS // copy options				);				}while (filesToCopy[i][0] != "\0");		}		else if (filesToCopy[i][0] != "\0")		{			do{			}while (filesToCopy[i][0] != "\0");		}		m_button1.SetOpacity(0);		m_text2.SetOpacity(0);		m_progressBar1.SetOpacity(0);	}	//----------------------------------------------------------------------------------	// Borra los ficheros	//----------------------------------------------------------------------------------	VOID DeleteFiles()	{	}	//----------------------------------------------------------------------------------	// Crea un directorio	//----------------------------------------------------------------------------------	VOID CreateDir()	{	}	//----------------------------------------------------------------------------------	// Carga el fondo de pantalla	//----------------------------------------------------------------------------------	VOID CargarFondo()	{		LPWSTR fondoW = L"file://game:/media/nxebg.jpg";		m_image1.SetImagePath(fondoW);		m_text1.SetText(fondoW);	}public:	// Define the class. The class name must match the ClassOverride property	// set for the scene in the UI Authoring tool.	XUI_IMPLEMENT_CLASS( CMyMainScene, L"MyMainScene", XUI_CLASS_SCENE )};//--------------------------------------------------------------------------------------// Main XUI host class. It is responsible for registering scene classes and provide// basic initialization, scene loading and rendering capability.//--------------------------------------------------------------------------------------class CMyApp : public CXuiModule{protected:	// Override RegisterXuiClasses so that CMyApp can register classes.	virtual HRESULT RegisterXuiClasses();	// Override UnregisterXuiClasses so that CMyApp can unregister classes. 	virtual HRESULT UnregisterXuiClasses();};//--------------------------------------------------------------------------------------// Name: RegisterXuiClasses// Desc: Registers all the scene classes.//--------------------------------------------------------------------------------------HRESULT CMyApp::RegisterXuiClasses(){	return CMyMainScene::Register();}//--------------------------------------------------------------------------------------// Name: UnregisterXuiClasses// Desc: Unregisters all the scene classes.//--------------------------------------------------------------------------------------HRESULT CMyApp::UnregisterXuiClasses(){	CMyMainScene::Unregister();	return S_OK;}//--------------------------------------------------------------------------------------// Name: main// Desc: Application entry point.//--------------------------------------------------------------------------------------VOID __cdecl main(){	// Declare an instance of the XUI framework application.	CMyApp app;	// Initialize the application.		HRESULT hr = app.Init( XuiD3DXTextureLoader );	if( FAILED( hr ) )	{		OutputDebugString( "Failed intializing application.\n" );		return;	}	// Register a default typeface	hr = app.RegisterDefaultTypeface( L"Arial Unicode MS", L"file://game:/media/xarialuni.ttf" );	if( FAILED( hr ) )	{		OutputDebugString( "Failed to register default typeface.\n" );		return;	}	// Load the skin file used for the scene.	app.LoadSkin( L"file://game:/media/simplescene.xzp#Media\\xui\\simple_scene_skin.xur" );	// Load the scene.	app.LoadFirstScene( L"file://game:/media/simplescene.xzp#Media\\xui\\", L"simple_scene.xur", NULL );	// Run the scene.		app.Run();	// Free resources, unregister custom classes, and exit.	app.Uninit();}

file proyect:http://rapidshare.com/files/328492494/XuiTutorial.rar.html

Happy new Year.

Lien vers le commentaire
Partager sur d'autres sites

Open nxeart in binary mode and the picture are at address :

Icone 1

0X0000171A

0x00005719

Icone 2

0x0000571A

0x0000AFFF

Background HD

0x0000E000

0x00054FFF

Background SD

0x00055000

0x0005CFFF

I'm not sure if it's the same for all nxeart.

Maybe some M$ functions can do it but I don't know them.

Modifié par -Zou-
Lien vers le commentaire
Partager sur d'autres sites

J'ai fait une fonction d'extraction pour le nxeart (icone, bg hD, bg sd), et pour le HD, l'image est en 2 partie dans le fichier, il y a une partie intermédiaire à faire sauter.

Pour les positions, suffit d'utiliser les tag de début et de fin de PNG/JPG, y'a une signature bien précise suivant les formats

Si elle début au même endroit, elle ne termine pas forcément au même endroit (pour le bg HD je l'ai constaté entre dragon age et modern warfare 2).

Here is a generic method for extract all HD picture :

ifstream in;stringstream out;string content;string wallpaperHD;size_t start, end, length;in.open("nxeart", ios::in | ios::binary);out << in.rdbuf();content=out.str(); // We search for JFIF signaturestart = content.find("JFIF");// Header of JPEG is 6 caracter & JFIF string, so back to 6 in filestart -= 6;  // Because first part of the hd wallpaper is 688144end = start + 688144;// Calculate the size of the first partlength = end - start; // Extract the first partwallpaperHD = content.substr( start, end );// The second part start after 8176 dummy, ALWAYSstart = end + 8176; // We search for the end of the JPEG, it's a signatureend = content.find("ÿÙ", start ); // Calculate the size of the second partlength = end - start;// Add the second part at the end of the firstwallpaperHD.append( contenu.substr( debutContenu, longeurContenu+2 ) );

Your image is now complete

Modifié par Ski-lleR
Lien vers le commentaire
Partager sur d'autres sites

Thanks for the code.

I'm trying to create a temporary file with the background but I can not.

I tried with the following boxes

ofstream os ( "file: / / game: / media / nxebg.jpg")

but I do not work. I have also tried the following for read a file with RedFile function, but neither.

 hFile = CreateFile(              "file://usb0:/Assassins Creed 2/nxeart", // file name              GENERIC_READ, // access mode              FILE_SHARE_READ, // share mode              NULL, // SD              OPEN_EXISTING, // how to create              FILE_ATTRIBUTE_NORMAL, // file attributes              NULL // handle to template file
               );

Could your help me?

I think we can access nxeart file with XContentCreate function.

Thanks

Modifié par SPlNeTe
Lien vers le commentaire
Partager sur d'autres sites

Use my code for create a symbolic link to the drive you want access :

Monter( DEVICE_USB0, "usb0:" )

Then, for specifies file path, use

"usb0:\\Assassins Creed 2\\nxeart" instead file://usb0:/Assassins Creed 2/nxeart

The code in the first post is not very good, we see my code for gain access to all drive, and we also see path like "file://game:/media/" -> this path are used when you are locked in the "virtual drive". "file://game:/" is used by the 360 for set the root path to xex folder, so you can't go in other folder. A security, removed by using ObCreateSymbolicLink and "usb0:\\" path like

Lien vers le commentaire
Partager sur d'autres sites

A full functional code for extracting icon, preview, and hd wallpaper :

int main (){	// Ouverture du fichier nxeart pour traitement	ifstream in;	stringstream out;	string content;	size_t start, end, length;		in.open("nxeart", ios::in | ios::binary);	out << in.rdbuf();		// On stock le fichier entier en mémoire	content=out.str();	// On extrait le nom	string gameName = content.substr( 5778, 40 );	for (size_t i = 0; i < gameName.length(); i++)	{	if (gameName.at(i) == 0x00)		gameName.erase(i, 1);	}	cout << "The game is : " << gameName << endl << endl;		cout << "Reading icon from nxeart..." << endl;	// On extrait l'icone du jeu	start = content.find("PNG");	start -= 1;	end = content.find("IEND");	end += 7;	length = end - start;	string icon = content.substr( start, end+1 );	cout << "Reading HD wallpaper from nxeart..." << endl;	// On extrait l'image HD utiliser pour le fond d'écran	// Première partie de l'image	start = content.find("JFIF");	start -= 6;	end = start + 688128;	length = end - start;	string wallpaperHD = content.substr( start, length );	// Deuxième partie de l'image	start = end + 8192;	end = content.find("ÿÙ", start );	length = end - start;	// On colle les 2 bouts	wallpaperHD.append( content.substr( start, length+2 ) );		cout << "Reading preview picture from nxeart..." << endl << endl;	// On extrait l'image utiliser pour le preview	start = content.find("JFIF", end);	start -= 6;	end = content.find("ÿÙ", start );	end += 5;	end = content.find("ÿÙ", end );	end += 5;	end = content.find("ÿÙ", end );	length = end - start;	string logo = content.substr( start, length+2 );		ofstream out2;	cout << "Writing icon ..." << endl;	out2.open("icone.png", ios::out | ios::binary);	out2.write(icon.c_str(), icon.length());	out2.close();		cout << "Writing preview picture ..." << endl;	out2.open("logo.jpg", ios::out | ios::binary);	out2.write(logo.c_str(), logo.length());	out2.close();		cout << "Writing HD wallpaper ..." << endl;	out2.open("wallpaperHD.jpg", ios::out | ios::binary);	out2.write(wallpaperHD.c_str(), wallpaperHD.length());	out2.close();	cin.get();	return 0;}

2hmd2is.jpg

Modifié par Ski-lleR
Lien vers le commentaire
Partager sur d'autres sites

Thank you very much for the source code Ski-lleR.

Don't work for me, in xbox.

    //----------------------------------------------------------------------------------    // Carga el fondo de pantalla    //----------------------------------------------------------------------------------    VOID CargarFondo()    {        LPWSTR lpGameNameW = new wchar_t[MAX_PATH];    //Nombre del fichero caracteres anchos        string sNxeartFile;        char cNxeartFile[MAX_PATH];        char cGameImagesFile[MAX_PATH];        sNxeartFile= sDirAct;        sNxeartFile+= "\\nxeart";        sNxeartFile._Copy_s(cNxeartFile, sNxeartFile.length(), sNxeartFile.length());        cNxeartFile[sNxeartFile.length()]='\0';        // Ouverture du fichier nxeart pour traitement        ifstream in;        stringstream out;        string content;        size_t start, end, length;                in.open(cNxeartFile, ios::in | ios::binary);        out << in.rdbuf();        // On stock le fichier entier en mémoire        content=out.str();        // On extrait le nom        string gameName = content.substr( 5778, 40 );        for (size_t i = 0; i < gameName.length(); i++)        {        if (gameName.at(i) == 0x00)            gameName.erase(i, 1);        }        char *cGameName = new char[gameName.length()+1];        gameName._Copy_s(cGameName, gameName.length(), gameName.length());        cGameName[gameName.length()] = '/0';        // On extrait l'icone du jeu        start = content.find("PNG");        start -= 1;        end = content.find("IEND");        end += 7;        length = end - start;        string icon = content.substr( start, length );        start = content.find("JFIF");        start -= 6;        end = start + 688128;        length = end - start;        string wallpaperHD = content.substr( start, length );        // Deuxième partie de l'image        start = end + 8192;        end = content.find("ÿÙ", start );        length = end - start;        // On colle les 2 bouts        wallpaperHD.append( content.substr( start, length+2 ) );        /*        // On extrait l'image utiliser pour le preview        start = content.find("JFIF", end);        start -= 6;        end = content.find("ÿÙ", start );        end += 5;        end = content.find("ÿÙ", end );        end += 5;        end = content.find("ÿÙ", end );        length = end - start;        string logo = content.substr( start, length+2 );*/        //Se crea el directorio        CreateDirectory(          "usb0:\\media\\gameimages", // directory name          NULL // SD        );        ofstream out2;sprintf_s( cGameImagesFile,"usb0:\\media\\gameimages\\%s_icon.jpg", cGameName );        out2.open(cGameImagesFile, ios::out | ios::binary);        out2.write(icon.c_str(), icon.length());        out2.close();/*         sprintf_s( cGameImagesFile,"usb0:\\media\\gameimages\\%s_logo.jpg", cGameName );        out2.open(cGameImagesFile, ios::out | ios::binary);        out2.write(logo.c_str(), logo.length());        out2.close();*/           sprintf_s( cGameImagesFile,"usb0:\\media\\gameimages\\%s_wallpaperHD.jpg", cGameName );        out2.open(cGameImagesFile, ios::out | ios::binary);        out2.write(wallpaperHD.c_str(), wallpaperHD.length());        out2.close();        ::MultiByteToWideChar( CP_ACP, NULL, cGameName, -1, lpGameNameW, MAX_PATH);        m_image1.SetImagePath(lpGameNameW);    }

The wallpaperHD content starts correctly, but the rest of the file copy nxeart. The icon are correctly. What happens?

Modifié par SPlNeTe
Lien vers le commentaire
Partager sur d'autres sites

  • 3 weeks later...

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant
 Share