예제 #1
0
void mountdrives()
{
    int mounted = 0;
    MountDevice("HDD:", "\\Device\\Harddisk0\\Partition1", "hdd mounted", &mounted);
    MountDevice("USB0:", "\\Device\\Mass0", "usb0 mounted", &mounted);
    MountDevice("USB1:", "\\Device\\Mass1", "usb1 mounted", &mounted);
    MountDevice("USB2:", "\\Device\\Mass2", "usb2 mounted", &mounted);
    MountDevice("USB3:", "\\Device\\Mass3", "usb3 mounted", &mounted);
    MountDevice("USB4:", "\\Device\\Mass4", "usb4 mounted", &mounted);
    MountDevice("USBMU0:", "\\Device\\Mass0PartitionFile\\Storage", "usbmu0 mounted", &mounted);
    MountDevice("USBMU1:", "\\Device\\Mass1PartitionFile\\Storage", "usbmu1 mounted", &mounted);
    MountDevice("USBMU2:", "\\Device\\Mass2PartitionFile\\Storage", "usbmu2 mounted", &mounted);
    MountDevice("USBMU3:", "\\Device\\Mass3PartitionFile\\Storage", "usbmu3 mounted", &mounted);
    MountDevice("USBMU4:", "\\Device\\Mass4PartitionFile\\Storage", "usbmu4 mounted", &mounted);
    if (mounted != 0)
    {
        debugLog("Drive(s) mounted, Scanning folders");
        console.Format("Scanning folders, please wait...");
    }
    else
    {
        debugLog("No Drives found!");
        console.Format("No drives found!\n");
    }
}
예제 #2
0
void mountdrives()
{
	int mounted = 0;
	if (Map("HDD:","\\Device\\Harddisk0\\Partition1") == S_OK)
	{
		devices.push_back("HDD:");
		debugLog("hdd mounted");
		mounted++;
	}
	if (Map("USBMU0:", "\\Device\\Mass0PartitionFile\\Storage") == S_OK)
	{
		devices.push_back("USBMU0:");
		debugLog("usbmu0 mounted");
		mounted++;
	}
	if (Map("USBMU1:", "\\Device\\Mass1PartitionFile\\Storage") == S_OK)
	{
		devices.push_back("USBMU1:");
		debugLog("usbmu1 mounted");
		mounted++;
	}
	if (Map("USBMU2:", "\\Device\\Mass2PartitionFile\\Storage") == S_OK)
	{
		devices.push_back("USBMU2:");
		debugLog("usbmu2 mounted");
		mounted++;
	}
	if (Map("USBMU3:", "\\Device\\Mass3PartitionFile\\Storage") == S_OK)
	{
		devices.push_back("USBMU3:");
		debugLog("usbmu3 mounted");
		mounted++;
	}
	if (Map("USBMU4:", "\\Device\\Mass4PartitionFile\\Storage") == S_OK)
	{
		devices.push_back("USBMU4:");
		debugLog("usbmu4 mounted");
		mounted++;
	}
	if (mounted != 0)
	{
		debugLog("Drive(s) mounted, Scanning folders");
		console.Format("Scanning folders, please wait...");
	}
	else
	{
		debugLog("No Drives found!");
		console.Format("No drives found!\n");
	}
}
예제 #3
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.
}
예제 #4
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);
    }
}
예제 #5
0
void nxetogod(NXE nxeGame)
{
    console.Format("Converting %ls to GOD... ", nxeGame.title);

    string goddirectory = nxeGame.path;
    goddirectory.replace(goddirectory.size() - 9, 9, "00007000");

    string olddatadirectory = nxeGame.path + nxeGame.fileName + ".data";

    string datadirectory = goddirectory + "\\" + nxeGame.fileName + ".data";

    string confile = nxeGame.path + nxeGame.fileName;

    string condirectory = nxeGame.path.substr(0, nxeGame.path.size() - 1);;

    //Create 00007000 directory if it doens't already exist
    ::CreateDirectory(goddirectory.c_str(),0);

    //Append CON file name to existing path strings to give the full path
    goddirectory += "\\" + nxeGame.fileName;

    //Move CON file from 00004000 to 00007000
    if(FileExists(goddirectory.c_str()))
    {
        //Delete target file if it already exists
        ::DeleteFile(goddirectory.c_str());
    }
    //Then move
    ::MoveFile(confile.c_str(),goddirectory.c_str());

    //Move .data directory from 00004000 to 00007000
    if(::CreateDirectory(datadirectory.c_str(),0) == 0)
    {
        //Target directory exists in 00007000 - Delete it to empty it
        DeleteDirectory(datadirectory.c_str(),true);
        //Recreate it
        ::CreateDirectory(datadirectory.c_str(),0);
    }
    //Now move data files there
    HANDLE hFind;
    WIN32_FIND_DATA wfd;

    string searchdir = olddatadirectory + "\\*";
    hFind = FindFirstFile( searchdir.c_str(), &wfd );
    if(INVALID_HANDLE_VALUE != hFind)
    {
        do
        {
            string oldFile = olddatadirectory + "\\" + wfd.cFileName;
            string newFile = datadirectory + "\\" + wfd.cFileName;
            ::MoveFile(oldFile.c_str(), newFile.c_str());
        } while( FindNextFile( hFind, &wfd ));
        FindClose( hFind );
    }
    // Patch to GOD
    if (MakeGOD(goddirectory.c_str()) != true)
    {
        genlog();
        console.Format("FAILED\n");
        debugLog("Unable to open new Games On Demand Live file at:");
        debugLog((char*)goddirectory.c_str());
        nxeGame.status = false;
    }

    if(nxeGame.status)
    {
        console.Format("Success!\n");
        //Delete old data directory
        ::RemoveDirectory(olddatadirectory.c_str());
        //Delete old 00004000 directory
        ::RemoveDirectory(nxeGame.path.c_str());
    }
}