Permalink
Browse files

Minor bug fixes

  • Loading branch information...
RedDuckss committed Nov 13, 2017
1 parent dca72e4 commit e00b258fe2c6c23b7e0186ac218d5e4e507b17d8
Showing with 31 additions and 41 deletions.
  1. +3 −21 NodeNUSRipper.js
  2. +27 −19 app.js
  3. +1 −1 package.json
@@ -230,9 +230,6 @@ Main.prototype._patchDLC = function(ticket) {
}
Main.prototype._generateTicket = function(tid, version, key, output, cb) {
console.log(tid)
console.log(version)
console.log(key)
var ticket = TIK,
version_buffer = new Buffer.from(version.toString()),
tid_buffer = new Buffer.from(this._stringToBin(tid), 'binary'),
@@ -451,8 +448,6 @@ Main.prototype.downloadTID = function(TID, location, update, cb) {
}
}
console.log(tmd_total_size)
self.emit('download_total_size', {
tid: TID,
size: tmd_total_size
@@ -495,7 +490,6 @@ Main.prototype.downloadTID = function(TID, location, update, cb) {
});
queue.drain = () => {
console.log(tmd_hashes)
async.each(tmd_hashes, (hash, callback) => {
this._ripFile(TID, URL_BASE + '/' + hash + '.h3', path.join(location, hash + '.h3'), (error) => {
return callback();
@@ -518,7 +512,7 @@ Main.prototype.downloadTMD = function(TID, file, update, cb) {
TID = this.formatTID(TID);
let tmd_url = this.getTIDURL(TID) + '/tmd';
if (update) tmd_url = tmd_url.concat('.', update);
console.log(tmd_url)
this._ripFile(TID, tmd_url, file, () => {
return cb();
});
@@ -583,21 +577,13 @@ Main.prototype._ripFile = function(TID, url, file, cb) {
}, (error, response) => {
if (response.statusCode !== 200) {
if (response.statusCode == 404) {
console.log(file);
return cb();
}
console.log(url);
console.log(file);
console.log(response.statusCode)
throw new Error('Invalid response code', response.statusCode);
} else {
req.on('error', (error) => {
console.log(error);
console.log(error.message);
console.log(url);
console.log(file);
throw error;
throw new Error(error);
});
}
});
@@ -638,11 +624,7 @@ Main.prototype._ripFile = function(TID, url, file, cb) {
});
out.on('error', (error) => {
console.log(error);
console.log(error.message);
console.log(url);
console.log(file);
throw error
throw new Error(error)
});
});
}
46 app.js
@@ -1,4 +1,4 @@
const APP_VERSION = '2.3.0';
const APP_VERSION = '2.3.1';
const CACHE_VERSION = 2;
let electron = require('electron'),
@@ -1728,12 +1728,28 @@ function loadGames(dir, master_callback) {
if (data.game_genres) {
game_data.genres = data.game_genres.split('|')
}
let xml = XMLParser.parse(path.join(dir, name, 'code', 'app.xml'));
if (xml.title_id._Data.substring(4, 8) == '0002') {
game_data.name = game_data.name.concat(' (possible demo)');
game_data.name_clean = game_data.name_clean.concat(' (possible demo)');
}
if (xml.title_id._Data.substring(4, 8).toUpperCase() == '000E') {
game_data.name = game_data.name.concat(' (possible update data)');
game_data.name_clean = game_data.name_clean.concat(' (possible update data)');
}
if (xml.title_id._Data.substring(4, 8).toUpperCase() == '000C') {
game_data.name = game_data.name.concat(' (possible DLC data)');
game_data.name_clean = game_data.name_clean.concat(' (possible DLC data)');
}
game_storage.get('games').push(game_data).write();
callback(null);
});
} else {
console.log('no', dir + '/' + file)
callback(null);
}
}, (error) => {
@@ -1824,25 +1840,15 @@ function isGame(game_path) {
subfolders = fs.readdirSync(game_path);
}
if (subfolders.contains('code') && subfolders.contains('content')) {
if (subfolders.contains('code') && subfolders.contains('content') && subfolders.contains('meta')) {
if (!fs.pathExistsSync(game_path + '/code/app.xml')) {
return false;
}
if (subfolders.contains('meta') && fs.pathExistsSync(game_path + '/meta/meta.xml')) {
let xml = XMLParser.parse(game_path + '/meta/meta.xml');
if (xml.title_id._Data.substring(4, 8) != '0000') return false;
xml = XMLParser.parse(game_path + '/code/app.xml');
if (xml.title_id._Data.substring(4, 8) != '0000') return false;
var rom = fs.readdirSync(game_path + '/code').filter(/./.test, /\.rpx$/i);
if (!rom || rom.length < 0) return false;
} else if (fs.pathExistsSync(game_path + '/code/app.xml')) {
let xml = XMLParser.parse(game_path + '/code/app.xml');
if (xml.title_id._Data.substring(4, 8) != '0000') return false;
var rom = fs.readdirSync(game_path + '/code').filter(/./.test, /\.rpx$/i);
if (!rom || rom.length < 0) return false;
} else return false;
let xml = XMLParser.parse(game_path + '/code/app.xml');
if (!xml.title_id) return false;
var rom = fs.readdirSync(game_path + '/code').filter(/./.test, /\.rpx$/i);
if (!rom || rom.length < 0) return false;
} else return false;
} else return false;
@@ -2099,7 +2105,9 @@ function setupDefaultFiles() {
fs.writeFileSync(DATA_ROOT + 'cache/json/games.json', JSON.stringify({}));
}
if (!fs.existsSync(DATA_ROOT + 'cache/json/settings.json')) {
fs.writeFileSync(DATA_ROOT + 'cache/json/settings.json', JSON.stringify({}));
fs.writeFileSync(DATA_ROOT + 'cache/json/settings.json', JSON.stringify({
cache_version: CACHE_VERSION
}));
}
}
@@ -2108,7 +2116,7 @@ function verifyCacheVersion(cb) {
if (!c_version || c_version != CACHE_VERSION) {
dialog.showMessageBox(ApplicationWindow, {
type: 'question',
buttons: ['Yes delete old cache and restart', 'No, continue'],
buttons: ['No, continue', 'Yes delete old cache and restart'],
title: 'CemUI Error',
message: 'Out of date cache version',
detail: 'CemUI has detected an out of date/invalid cache version. You may experience issues with this cache version.\nWould you like CemUI to delete and remake the cache?',
@@ -1,7 +1,7 @@
{
"name": "cemui",
"productName": "CemUI",
"version": "2.3.0",
"version": "2.3.1",
"description": "Front end launcher for the WiiU emulator, Cemu",
"author": "RedDucks",
"main": "app.js",

0 comments on commit e00b258

Please sign in to comment.