Ejemplo n.º 1
0
//--------------------------------------------------------------------------------------
// Name: main
// Desc: Entry point to the program
//--------------------------------------------------------------------------------------
VOID __cdecl main()
{
    bool keypush = false;
    console.Create("embed:\\font", 0x00000000, 0xFFFF6600);
    console.Format( "NXE2GOD V1.3 by Swizzy original source by Dstruktiv\n" );
    //genlog(); //<--- only use this when you're lazy ;)
    debuglog = FileExists("game:\\debug.log");
    mountdrives();
    console.Format("\n");
    for(unsigned int i = 0; i < devices.size(); i++)
    {
        if (devices.size() == 0)
            break;
        unsigned int tmpsize = allNXE.size();
        console.Format("Scanning %s\\ for NXE titles...", devices[i].c_str());
        string tmp = devices[i] + filePathzzz;
        ScanDir(tmp);
        if (allNXE.size() == tmpsize)
            console.Format("No NXE titles found!\n");
        else if (tmpsize != 0)
            console.Format("Found %d NXE titles!\n", allNXE.size() - tmpsize);
        else
            console.Format("Found %d NXE titles!\n", allNXE.size());
    }
    if ((allNXE.size() == 0) && (devices.size() == 0))
        console.Format("\nNo NXE titles found\n\nPush any key to exit" );
    else if (allNXE.size() == 0)
        console.Format("\n\nPush any key to exit" );
    else
    {
        console.Format("\nNXE Files found:\n\n");
        for(unsigned int i = 0; i < allNXE.size(); i++)
        {
            console.Format("%ls at location: %s%s\n", allNXE[i].title, allNXE[i].path.c_str(), allNXE[i].fileName.c_str());
        }
        console.Format("\nPush A to convert files from NXE to GOD or B to cancel and quit to NXE\n\n");
        while(!keypush)
        {
            ATG::GAMEPAD* pGamepad = ATG::Input::GetMergedInput();
            if( pGamepad->wPressedButtons & XINPUT_GAMEPAD_A)
                keypush = true;
            if( pGamepad->wPressedButtons & XINPUT_GAMEPAD_B)
                XLaunchNewImage(XLAUNCH_KEYWORD_DEFAULT_APP, 0);
        }
        console.Format("Converting NXE2GOD, please wait...\n\n");
        for(unsigned int i = 0; i < allNXE.size(); i++)
            nxetogod(allNXE[i]);
        console.Format( "\nProcessing complete, push any key to exit" );
    }
    keypush = false;
    while(!keypush)
    {
        ATG::GAMEPAD* pGamepad = ATG::Input::GetMergedInput();
        if( pGamepad->wPressedButtons)
            XLaunchNewImage(XLAUNCH_KEYWORD_DEFAULT_APP, 0);
    }
}
Ejemplo n.º 2
0
void AutoUpdater::RunInstaller( void )
{
	// Create predefined copy paths to easily change later
	string szDashPath = "game:\\";
	string szSkinPath = "game:\\skins\\";
	string szPluginPath = "game:\\plugins\\";
	
	// Create directories in case they don't exist
	CreateDirectory(szDashPath.c_str(), NULL);
	CreateDirectory(szSkinPath.c_str(), NULL);
	CreateDirectory(szPluginPath.c_str(), NULL);

	// Release current Direct 3D Device and initialize console view
	CFreestyleApp::getInstance().m_pd3dDevice->Release();
	ATG::Console console;

	DebugMsg("AutoUpdater", "Installer Running");
	
	// Locate the embedded font file in memory
	DWORD dwStoredDigest;
	VOID * pSectionData;

	
	BOOL retVal = XGetModuleSection( GetModuleHandle(NULL), "FSDFont", &pSectionData, &dwStoredDigest);
	if(retVal == FALSE)
	{
		// Font Section could not be found within Xex file- compiled wrong?
		DebugMsg("AutoUpdater", "Font File Could Not Be Extracted.");
		XNotifyQueueUICustom(L"Font Not Found - Update Manually");
		RestartDashboard(&console, true);
		return;
	}


	// Dump the file to a temporary file for use in this updater
	string szFontPath = "game:\\ConsoleFont.xpr";
	FILE * fHandle;
	fopen_s(&fHandle, szFontPath.c_str(), "wb");
	fwrite(pSectionData, dwStoredDigest, 1, fHandle);
	fclose(fHandle);
	
	// Verify that the font file was dumped and the file exists
	if(!FileExistsA(szFontPath))
	{
			XNotifyQueueUICustom(L"Font Not Found - Update Manually");
			RestartDashboard(&console, true);
			return;
	}

	// Font Extracted Fine- continue with updater.
	console.Create(szFontPath.c_str(), 0xFF000000, 0xFFFFFFFF );
	console.Clear();

	// Create and Display Intro along with all the version information...
	console.Format("Welcome to the Freestyle Dash Update Installer. (v.01a)\n\n");

	// Scan tempfolder for updates
	console.Format("** Checking system for downloaded updates....");
	bool hasDashFile = false, hasSkinFile = false, hasPluginFile = false;
	if(FileExistsA(getAutoupdaterTempXexPath(false))) hasDashFile = true;
	if(FileExistsA(getAutoupdaterTempSkinPath(false))) hasSkinFile = true;
	if(FileExistsA(getAutoupdaterTempPluginPath(false))) hasPluginFile = true;
	
	// Scan tempfolder for version files for updates that were found
	if(hasDashFile)
	{
		// Check Version File for display information
		string szVerFile = getAutoupdaterTempXexVerPath(false);
		string szUpdateDisplay = sprintfaA("\n\tFreestyle Dash Update Found ( Version: Unknown )");
		if(FileExistsA(szVerFile))
		{
			// File exists, so extract version information
			VERSION_DATA verInfo;
			FILE * fHandle;
			fopen_s(&fHandle, szVerFile.c_str(), "rb");
			fread(&verInfo, sizeof(VERSION_DATA), 1, fHandle);
			fclose(fHandle);
			szUpdateDisplay = sprintfaA("\n\tFreestyle Dash Update Found ( Version: %d.%d r%d %s )", verInfo.dwMajor, verInfo.dwMinor, verInfo.dwRevision, ConvertTypeToString(verInfo.dwVersionType).c_str());
		}
		// Output results to screen
		console.Format(szUpdateDisplay.c_str());
	}

	if(hasSkinFile)
	{
		// Check Version File for display information
		string szVerFile = getAutoupdaterTempSkinVerPath(false);
		string szUpdateDisplay = sprintfaA("\n\tFreestyle Skin Update Found ( Version: Unknown )");
		if(FileExistsA(szVerFile))
		{
			// File exists, so extract version information
			VERSION_DATA verInfo;
			FILE * fHandle;
			fopen_s(&fHandle, szVerFile.c_str(), "rb");
			fread(&verInfo, sizeof(VERSION_DATA), 1, fHandle);
			fclose(fHandle);
			szUpdateDisplay = sprintfaA("\n\tFreestyle Skin Update Found ( Version: %d.%d r%d %s )", verInfo.dwMajor, verInfo.dwMinor, verInfo.dwRevision, ConvertTypeToString(verInfo.dwVersionType).c_str());
		}
		// Output results to screen
		console.Format(szUpdateDisplay.c_str());
	}

	if(hasPluginFile)
	{
		// Check Version File for display information
		string szVerFile = getAutoupdaterTempPluginVerPath(false);
		string szUpdateDisplay = sprintfaA("\n\tFreestyle Plugin Update Found ( Version: Unknown )");
		if(FileExistsA(szVerFile))
		{
			// File exists, so extract version information
			VERSION_DATA verInfo;
			FILE * fHandle;
			fopen_s(&fHandle, szVerFile.c_str(), "rb");
			fread(&verInfo, sizeof(VERSION_DATA), 1, fHandle);
			fclose(fHandle);
			szUpdateDisplay = sprintfaA("\n\tFreestyle Plugin Update Found ( Version: %d.%d r%d %s )", verInfo.dwMajor, verInfo.dwMinor, verInfo.dwRevision, ConvertTypeToString(verInfo.dwVersionType).c_str());
		}
		// Output results to screen
		console.Format(szUpdateDisplay.c_str());
	}

	console.Format("\n\nTo Begin Installation - Press the 'Y' Button.");
	console.Format("\nTo Exit Installation - Press the 'Back' Button.");

	// Wait for Button Input to continue
	for( ; ; ) {
		ATG::Input::GetMergedInput();
		if(ATG::Input::m_DefaultGamepad.wPressedButtons & XINPUT_GAMEPAD_Y )
			break;
		if(ATG::Input::m_DefaultGamepad.wPressedButtons & XINPUT_GAMEPAD_BACK )
			RestartDashboard(&console, true);
	}

	// ExtractZip Files To Correct Location
	bool dashResult = false, skinResult = false, pluginResult = false;
	bool bError = false;
	if(hasDashFile)
	{
		dashResult = InstallDashUpdate(&console, szDashPath);
		if(!dashResult){
			bError = true;
			console.Format("\n An Error Occurred installing Dash Updates");
		}
	}
	if(hasSkinFile)
	{
		skinResult = InstallSkinUpdate(&console, szSkinPath);
		if(!skinResult){
			bError = true;
			console.Format("\n An Error Occurred installing Skin Updates");
		}
	}
	if(hasPluginFile)
	{
		pluginResult = InstallPluginUpdate(&console, szPluginPath);
		if(!pluginResult){
			bError = true;
			console.Format("\n An Error Occurred installing Plugin Updates");
		}
	}

	// Show Completion Message
	if(!bError)
	{
		console.Format("\n\nUpdate has completed successfully.");
	}
	else
	{
		console.Format("\n\nUpdate has not completed successfully- please update manually");
	}
	console.Format("\nPress Any Key to Reboot Dashboard.");

	// Reboot with changed files
	for( ; ; ) {
		ATG::Input::GetMergedInput();
		if(ATG::Input::m_DefaultGamepad.wPressedButtons )
			RestartDashboard(&console, true);
	}
	
	// Serious Error- should never get to this code - if we do, just restart.
}
Ejemplo n.º 3
0
void MakeConsole(const char* font, unsigned long BackgroundColor, unsigned long TextColor)
{
	g_console.Create(font, BackgroundColor, TextColor);
	g_console.SendOutputToDebugChannel(TRUE);
}