Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getCardDesc()
- {
- var owned = new Array();
- var cached = new Array();
- var usedspace = 0;
- var totalspace = 0;
- var prop = [ "icon", "title", "size", "location", "titleID", "type", "ticketType" ];
- var ownedTitles = null;
- if (window.external != null) {
- ownedTitles = window.external.IAH_ownedTitles;
- }
- var version = window.external ? external.IAH_swVersion : "0.0.0";
- if (ownedTitles != null) {
- // Convert data from SafeArray into JavaScript array
- var a = new VBArray(ownedTitles);
- for (i = 0; i <= a.ubound(1); i++) {
- var game = new Array();
- for (j =0; j <= a.ubound(2); j++) {
- game[prop[j]] = a.getItem(i,j);
- }
- game.size = new Number(game.size);
- owned[i] = game;
- }
- // For backward compatibility
- if (version == "1.3.1" || version == "1.3.2")
- totalspace = 240;
- else
- totalspace = window.external.IAH_totalSpaceBlks; // (contentSpace + freeSpace - maxGameStateSize)/USER_BLKSIZE
- } else {
- // Test Data
- var data = new Array();
- data[0] = [ "", "Mario Kart", "1", "PC", "31019", "Manual", "PR" ];
- data[1] = [ "", "Zelda", "33", "PC", "31011", "Manual", "PR" ];
- data[2] = [ "", "Mario", "48", "iQue", "21011", "Manual", "PR" ];
- data[3] = [ "", "Mario2", "130", "Card", "21021", "Manual", "PR" ];
- data[4] = [ "", "Mario3", "69", "Card", "21031", "Manual", "LP" ];
- for (i = 0; i < 5; i++) {
- var game = new Object();
- game.icon = data[i][0];
- game.title = data[i][1];
- game.size = new Number(data[i][2]);
- game.location = data[i][3];
- game.titleID = data[i][4];
- game.type = data[i][5];
- game.ticketType = data[i][6];
- owned[i] = game;
- }
- totalspace = 240;
- }
- // compute usedspace and determine cached contents
- usedspace = 0;
- for (i = 0; i < owned.length; i++) {
- var g = owned[i];
- if (g.location == "Card,PC") {
- cached[g.titleID] = true;
- g.location = "Card";
- } else if (g.location == "PC") {
- cached[g.titleID] = true;
- }
- if (g.location == "Card") {
- usedspace += g.size;
- }
- }
- if (usedspace > totalspace)
- usedspace = totalspace;
- var card = new Object();
- card.owned = owned;
- card.cached = cached;
- card.totalspace = totalspace;
- card.usedspace = usedspace;
- card.prop = prop;
- return card;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement