Advertisement
Jhynjhiruu

iQue Player stuff

Feb 12th, 2018
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getCardDesc()
  2. {
  3.     var owned = new Array();
  4.     var cached = new Array();
  5.     var usedspace = 0;
  6.     var totalspace = 0;
  7.     var prop = [ "icon", "title", "size", "location", "titleID", "type", "ticketType" ];
  8.     var ownedTitles = null;
  9.     if (window.external != null) {
  10.     ownedTitles = window.external.IAH_ownedTitles;
  11.     }      
  12.  
  13.     var version = window.external ? external.IAH_swVersion : "0.0.0";
  14.    
  15.     if (ownedTitles != null) {
  16.     // Convert data from SafeArray into JavaScript array
  17.     var a = new VBArray(ownedTitles);
  18.     for (i = 0; i <= a.ubound(1); i++) {
  19.         var game = new Array();
  20.         for (j =0; j <= a.ubound(2); j++) {
  21.         game[prop[j]] = a.getItem(i,j);
  22.         }
  23.         game.size = new Number(game.size);
  24.         owned[i] = game;
  25.     }
  26.         // For backward compatibility
  27.     if (version == "1.3.1" || version == "1.3.2")
  28.             totalspace = 240;
  29.         else
  30.             totalspace = window.external.IAH_totalSpaceBlks; // (contentSpace + freeSpace - maxGameStateSize)/USER_BLKSIZE
  31.     } else {
  32.     // Test Data
  33.         var data = new Array();
  34.     data[0] = [ "", "Mario Kart", "1", "PC", "31019", "Manual", "PR" ];
  35.     data[1] = [ "", "Zelda", "33", "PC", "31011", "Manual", "PR" ];
  36.     data[2] = [ "", "Mario", "48", "iQue", "21011", "Manual", "PR" ];
  37.     data[3] = [ "", "Mario2", "130", "Card", "21021", "Manual", "PR" ];
  38.     data[4] = [ "", "Mario3", "69", "Card", "21031", "Manual", "LP" ];
  39.     for (i = 0; i < 5; i++) {
  40.         var game = new Object();
  41.         game.icon = data[i][0];
  42.         game.title = data[i][1];
  43.         game.size = new Number(data[i][2]);
  44.         game.location = data[i][3];
  45.         game.titleID = data[i][4];
  46.         game.type = data[i][5];
  47.         game.ticketType = data[i][6];
  48.         owned[i] = game;
  49.     }
  50.     totalspace = 240;
  51.     }
  52.  
  53.     // compute usedspace and determine cached contents
  54.     usedspace = 0;
  55.     for (i = 0; i < owned.length; i++) {
  56.     var g = owned[i];
  57.     if (g.location == "Card,PC") {
  58.         cached[g.titleID] = true;
  59.         g.location = "Card";
  60.     } else if (g.location == "PC") {
  61.         cached[g.titleID] = true;
  62.     }
  63.     if (g.location == "Card") {
  64.        usedspace += g.size;
  65.     }
  66.     }
  67.     if (usedspace > totalspace)
  68.         usedspace = totalspace;
  69.  
  70.     var card = new Object();
  71.     card.owned = owned;
  72.     card.cached = cached;
  73.     card.totalspace = totalspace;
  74.     card.usedspace = usedspace;
  75.     card.prop = prop;
  76.     return card;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement