xboxscene.org forums

Pages: [1] 2

Author Topic: Hard Drive, Free And Used Space Display  (Read 1346 times)

MrSin

  • Archived User
  • Newbie
  • *
  • Posts: 9
Hard Drive, Free And Used Space Display
« on: January 06, 2005, 12:50:00 AM »

Hard Drive, Free and Used Space Display

To add Hard Drive Free and Used Space information display, when 'Y' button is pressed.

(IMG:http://www.globe.net.nz/downloads/harddrive_display.jpg)

Paste the following code at the end of default.xip/default.xap file:

CODE

//
//  HDD Space.
//
function GetXboxHardDiskStats()
{
        var DDPartition;
        var nFreeSpace = 0;
        var nTotalSpace = 0;
        var nArraySize = 7; // Can be 4 or 7.
        var hddInfo = "          XBOX HARD DISK\n";

        DDPartition = new Array(nArraySize);

        DDPartition[1] = "C:";
        DDPartition[2] = "E:";
        DDPartition[3] = "F:";
        DDPartition[4] = "G:";
        DDPartition[5] = "X:";
        DDPartition[6] = "Y:";
        DDPartition[7] = "Z:";

        for (var i = 1; i < nArraySize + 1; i = i + 1)
        {
                nFreeSpace = theHardDrive.GetFreeSpace(DDPartition + "\\");
                nTotalSpace = theHardDrive.GetTotalSpace(DDPartition + "\\");
                if(nTotalSpace != 0){
                        hddInfo = hddInfo + DDPartition + " " + nFreeSpace + "MB of " + nTotalSpace + "MB\r";
                }
        }

        TellUser(theTranslator.Translate(hddInfo),"");
}
//
//  End.
//


To view HHD information from the main menu when the 'Y' button is pressed, find the following in default.xip/default.xap:

CODE

DEF theMainMenu Level
{

     ..........

    control DEF theMainMenuJoy Joystick
    {
        function OnADown()
        {
        ..............
        }


or to view it from the Hard Drive menu (I have it on both), find the following in default.xip/hard_drive.xap:

CODE

DEF theHardDriveMenu Level
{

     ..........

    control DEF theMainMenuJoy Joystick
    {
        function OnADown()
        {
        ..............
        }


and insert this code (below) after the 'OnADown()' function.

CODE

//
//  XBox Hard Disk Space Information.
//
function OnYDown()
{
        PlaySoundB();
        GetXboxHardDiskStats();
}
//
//  End.
//


You don't need to use 'OnYDown()' function, your could use any of the other buttons, with the exception of 'A' and 'B', 'B' can be used from the main menu, but I have the quick shutdown function assigned to 'B' for my main menu.

Done! <
Logged

MrSin

  • Archived User
  • Newbie
  • *
  • Posts: 9
Hard Drive, Free And Used Space Display
« Reply #1 on: January 06, 2005, 02:12:00 AM »

if you don't want drives 'X', 'Y' or 'Z' to be displayed, change the following:

CODE

function GetXboxHardDiskStats()
{
       var DDPartition;
       var nFreeSpace = 0;
       var nTotalSpace = 0;

       var nArraySize = 7; // Can be 4 or 7.


change to:

CODE

var nArraySize = 4; // Can be 4 or 7.


Then it will only display 'C', 'E', 'F' and 'G' (if you have one). Plus if you have a 'G' drive there are to many lines to fit on the window, so removing X, Y and Z looks better.
 <
Logged

iLLNESS

  • Archived User
  • Sr. Member
  • *
  • Posts: 361
Hard Drive, Free And Used Space Display
« Reply #2 on: January 06, 2005, 02:23:00 AM »

uhm.. im sure i could manage this myself.. but since im lazy ill ask

uhm... what exactly are you telling us to do?
i know to add the function to the bottom of the default.xap

but the next 3 codes..?

well after looking a the code some more... i know

but most people here are used to full code replacements.. so ill do the liberty of this:


paste this in no matter what at the bottom of your default.xap
CODE

//
//  HDD Space.
//
function GetXboxHardDiskStats()
{
       var DDPartition;
       var nFreeSpace = 0;
       var nTotalSpace = 0;
       var nArraySize = 7; // Can be 4 or 7.
       var hddInfo = "          XBOX HARD DISK\n";

       DDPartition = new Array(nArraySize);

       DDPartition[1] = "C:";
       DDPartition[2] = "E:";
       DDPartition[3] = "F:";
       DDPartition[4] = "G:";
       DDPartition[5] = "X:";
       DDPartition[6] = "Y:";
       DDPartition[7] = "Z:";

       for (var i = 1; i < nArraySize + 1; i = i + 1)
       {
               nFreeSpace = theHardDrive.GetFreeSpace(DDPartition + "\\");
               nTotalSpace = theHardDrive.GetTotalSpace(DDPartition + "\\");
               if(nTotalSpace != 0){
                       hddInfo = hddInfo + DDPartition + " " + nFreeSpace + "MB of " + nTotalSpace + "MB\r";
               }
       }

       TellUser(theTranslator.Translate(hddInfo),"");
}
//
//  End.
//


if u want to use Y button as hdd info from the root menu, replace this:
CODE

control DEF theMainMenuJoy Joystick
    {
        function OnADown()
        {
            PlaySoundA();
            if(nCurMainMenuItem == 0)
            {
                theMusicMenuIn.Play();
                GoToMusic();
            }
            else if(nCurMainMenuItem == 1)
            {
                theSettingsMenuIn.Play();
                GoToHardDrive();
            }
            else if(nCurMainMenuItem == 2)
            {
            }
            else if(nCurMainMenuItem == 3)
            {
                theSettingsMenuIn.Play();
                GoToSettings();
            }
        }

with this:
CODE

control DEF theMainMenuJoy Joystick
    {
        function OnADown()
        {
            PlaySoundA();
            if(nCurMainMenuItem == 0)
            {
                theMusicMenuIn.Play();
                GoToMusic();
            }
            else if(nCurMainMenuItem == 1)
            {
                theSettingsMenuIn.Play();
                GoToHardDrive();
            }
            else if(nCurMainMenuItem == 2)
            {
            }
            else if(nCurMainMenuItem == 3)
            {
                theSettingsMenuIn.Play();
                GoToSettings();
            }
        }
   function OnYDown()
   {
     PlaySoundB();
            GetXboxHardDiskStats();
   }

basically the reason i was confused is cause MrSin didnt explain those .......s meant to scroll to a spot where u could fit in the snippet :o
hopefully this will prevent some confusion

props to mrsin however... great script :) <
Logged

MrSin

  • Archived User
  • Newbie
  • *
  • Posts: 9
Hard Drive, Free And Used Space Display
« Reply #3 on: January 06, 2005, 02:50:00 AM »

Sorry about that, mine doesn't look like that (been altered) so thats why I did not include the whole code.

Also as an easier option that would be accessible from all menu, you could do step one (as above) and then do this instead of the other steps:

In default.xip/default.xap, locate:

CODE

function QuickLaunchA()
{

}

function QuickLaunchB()
{
   
}


Now all you need to do is add the following code to either one:

CODE

PlaySoundB();
GetXboxHardDiskStats();


Like so:

CODE

function QuickLaunchA()
{
      PlaySoundB();
      GetXboxHardDiskStats();
}


This will allow access via Left Trigger + Right Trigger + A or B. <
Logged

wsly

  • Archived User
  • Jr. Member
  • *
  • Posts: 67
Hard Drive, Free And Used Space Display
« Reply #4 on: January 06, 2005, 08:46:00 AM »

sweet.... any way to add the IP in there too? <
Logged

clif

  • Archived User
  • Newbie
  • *
  • Posts: 15
Hard Drive, Free And Used Space Display
« Reply #5 on: January 06, 2005, 04:51:00 PM »

yes there is i can post a code for it when i  get home, if someone hasent already. it is a fairly easy code, but you will have to get rid of the other options so you could have like space for e and f your ip and you mb temp and your cpu temp, anything els that i could throw on there? <
Logged

wsly

  • Archived User
  • Jr. Member
  • *
  • Posts: 67
Hard Drive, Free And Used Space Display
« Reply #6 on: January 06, 2005, 07:02:00 PM »

awesome... I think that'll cover it... that just complete's the whole dash for me!! <
Logged

wsly

  • Archived User
  • Jr. Member
  • *
  • Posts: 67
Hard Drive, Free And Used Space Display
« Reply #7 on: January 07, 2005, 05:03:00 AM »

still waiting... <
Logged

Dazza

  • Archived User
  • Newbie
  • *
  • Posts: 5
Hard Drive, Free And Used Space Display
« Reply #8 on: January 07, 2005, 05:52:00 AM »

Heres the code I used.....

In the default.xip/default.xap file just replace the old GetXboxHardDiskStats function with this code

CODE

function GetXboxHardDiskStats()
{
       var DDPartition;
       var nFreeSpace = 0;
       var nTotalSpace = 0;
       var nArraySize = 4; // Needs to be 4 for everything else to fit
       var xboxInfo = "         XBOX INFORMATION\r";
       var sIPAddress = theXboxNetwork.GetXboxIP();
       var nIntTemp = theConfig.GetInternalTemp();
       var nCPUTemp = theConfig.GetCPUTemp();

       DDPartition = new Array(nArraySize);

       DDPartition[1] = "C:";
       DDPartition[2] = "E:";
       DDPartition[3] = "F:";
       DDPartition[4] = "G:";

       for (var i = 1; i < nArraySize + 1; i = i + 1)
       {
               nFreeSpace = theHardDrive.GetFreeSpace(DDPartition + "\\");
               nTotalSpace = theHardDrive.GetTotalSpace(DDPartition + "\\");
               if(nTotalSpace != 0){
                       xboxInfo = xboxInfo + DDPartition + " " + nFreeSpace + "MB of " + nTotalSpace + "MB\r";
               }
       }
       xboxInfo = xboxInfo + "\r";
       xboxInfo = xboxInfo + "IP: " + sIPAddress + "\r"; // Show IP Address
       xboxInfo = xboxInfo + "Int Temp: " + nIntTemp + " C  CPU Temp: " + nCPUTemp + " C\r"; // Show Temps
       TellUser(theTranslator.Translate(xboxInfo),"");
}

 <
Logged

motofo

  • Archived User
  • Jr. Member
  • *
  • Posts: 58
Hard Drive, Free And Used Space Display
« Reply #9 on: January 07, 2005, 08:04:00 AM »

How can I add the IP on the Main menu itself instead of having the information pop up in its own window? Tweakin this dash ROCKS  :D <
Logged

wsly

  • Archived User
  • Jr. Member
  • *
  • Posts: 67
Hard Drive, Free And Used Space Display
« Reply #10 on: January 07, 2005, 11:58:00 AM »

the ip addition doesn't seem to be working <
Logged

dope_ghost18

  • Archived User
  • Newbie
  • *
  • Posts: 17
Hard Drive, Free And Used Space Display
« Reply #11 on: January 07, 2005, 12:17:00 PM »

worked for me <
Logged

wsly

  • Archived User
  • Jr. Member
  • *
  • Posts: 67
Hard Drive, Free And Used Space Display
« Reply #12 on: January 07, 2005, 12:20:00 PM »

my bad... had to reboot a cpl times till it finally showed... <
Logged

HoBoz

  • Archived User
  • Newbie
  • *
  • Posts: 22
Hard Drive, Free And Used Space Display
« Reply #13 on: January 07, 2005, 09:18:00 PM »

is there a way to show it in fahreheit? <
Logged

MrSin

  • Archived User
  • Newbie
  • *
  • Posts: 9
Hard Drive, Free And Used Space Display
« Reply #14 on: January 07, 2005, 10:50:00 PM »

I have not tested this, but their is no reason why it should not work:

After:

CODE

var nIntTemp = theConfig.GetInternalTemp();
var nCPUTemp = theConfig.GetCPUTemp();


add:

CODE

// Convert C to F.
var nIntTempF = nIntTemp * 9/5 + 32;
var nCPUTempF = nCPUTemp * 9/5 + 32;

// If you wanted to convert to Kelvin:
K = C + 273.


You could round it with the Math.round() function also if you like:

CODE

// Convert C to F.
var nIntTempF = Math.round(nIntTemp * 9/5 + 32);
var nCPUTempF = Math.round(nCPUTemp * 9/5 + 32);


Then change this line:

CODE

xboxInfo = xboxInfo + "Int Temp: " + nIntTemp + " C  CPU Temp: " + nCPUTemp + " C\r";


To look like:

CODE

xboxInfo = xboxInfo + "Int Temp: " + nIntTempF + " F  CPU Temp: " + nCPUTempF + " F\r";


That should do it. <
Logged
Pages: [1] 2