From edf111f305bca4159f9af6df49afd52790510bd7 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 30 Nov 2015 03:03:52 +0100 Subject: [PATCH 1/5] Fix Illaoi related bug --- src/app/js/controllers.js | 3 ++- src/app/tpl/main.html | 12 ++++++------ src/index.js | 2 +- src/modules/aof-parser.js | 2 +- src/package.json | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/js/controllers.js b/src/app/js/controllers.js index a2f6a25..7295023 100644 --- a/src/app/js/controllers.js +++ b/src/app/js/controllers.js @@ -3,7 +3,7 @@ var app = angular.module('app.controllers', ['ngSanitize']); app.controller('MainController', ['$scope', '$rootScope', '$mdDialog', function($scope, $rootScope, $mdDialog) { var ipc = require('ipc'); - + var matchClientVersionToReplayVersion = function() { if ($scope.lolClientVersion && $scope.replay && $scope.replay.riotVersion) { var regex = $scope.lolClientVersion.match(/(?:.*?\s)(\d+)\.(\d+)\./); @@ -14,6 +14,7 @@ app.controller('MainController', ['$scope', '$rootScope', '$mdDialog', } }; + $scope.ddragonBase = "http://ddragon.leagueoflegends.com/cdn/5.23.1/img/"; $scope.loading = true; $scope.msg = "Loading..."; $scope.replay = null; diff --git a/src/app/tpl/main.html b/src/app/tpl/main.html index 0446e4b..e873548 100644 --- a/src/app/tpl/main.html +++ b/src/app/tpl/main.html @@ -34,10 +34,10 @@ {{ player.summonerName }} - +
-
-
+
+
@@ -64,10 +64,10 @@ - +
-
-
+
+
{{ player.summonerName }} diff --git a/src/index.js b/src/index.js index 62b2497..aa802d3 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,7 @@ let _ = require("underscore"); let fs = require("fs"); let winston = require("winston"); -let ddragonBase = "http://ddragon.leagueoflegends.com/cdn/5.21.1/"; +let ddragonBase = "http://ddragon.leagueoflegends.com/cdn/5.23.1/"; let replay = null; let mainWindow = null; let settings = {}; diff --git a/src/modules/aof-parser.js b/src/modules/aof-parser.js index 6cbc1cd..5bef423 100644 --- a/src/modules/aof-parser.js +++ b/src/modules/aof-parser.js @@ -44,7 +44,7 @@ module.exports = function(extLogger) { replayMetadata.complete = buff.readUInt8(c); c += 1; replayMetadata.endStartupChunkId = buff.readUInt8(c); c += 1; replayMetadata.startGameChunkId = buff.readUInt8(c); c += 1; - + // Read the player data replayMetadata.players = []; let num = buff.readUInt8(c); c += 1; diff --git a/src/package.json b/src/package.json index 798e980..7b0d468 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "aof-replay-client", - "version": "0.1.4", + "version": "0.1.5", "main": "./index.js", "scripts": { "start": "cd .. && npm start", From 1db7c0f7a15b6a2ecf5fe61d033481b77de509a0 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 30 Nov 2015 18:59:36 +0100 Subject: [PATCH 2/5] Support aof file version 11 --- src/modules/aof-parser.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/modules/aof-parser.js b/src/modules/aof-parser.js index 5bef423..19934bf 100644 --- a/src/modules/aof-parser.js +++ b/src/modules/aof-parser.js @@ -67,10 +67,18 @@ module.exports = function(extLogger) { // Read the keyframes replayData.keyframes = []; - num = buff.readUInt8(c); c += 1; + if (replayMetadata.version < 11) { + num = buff.readUInt8(c); c += 1; + } else { + num = buff.readUInt16BE(c); c += 2; + } for (let i = 0; i < num; i++) { let keyframe = {}; - keyframe.id = buff.readUInt8(c); c += 1; + if (replayMetadata.version < 11) { + keyframe.id = buff.readUInt8(c); c += 1; + } else { + keyframe.id = buff.readUInt16BE(c); c += 1; + } len = buff.readInt32BE(c); c += 4; keyframe.data = new Buffer(len); buff.copy(keyframe.data, 0, c, c + len); c += len; @@ -80,10 +88,18 @@ module.exports = function(extLogger) { // Read the chunks replayData.chunks = []; - num = buff.readUInt8(c); c += 1; + if (replayMetadata.version < 11) { + num = buff.readUInt8(c); c += 1; + } else { + num = buff.readUInt16BE(c); c += 2; + } for (let i = 0; i < num; i++) { let chunk = {}; - chunk.id = buff.readUInt8(c); c += 1; + if (replayMetadata.version < 11) { + chunk.id = buff.readUInt8(c); c += 1; + } else { + chunk.id = buff.readUInt16BE(c); c += 1; + } len = buff.readInt32BE(c); c += 4; chunk.data = new Buffer(len); buff.copy(chunk.data, 0, c, c + len); c += len; From 61f0777558da4206f3bceb14d3154219067b9a80 Mon Sep 17 00:00:00 2001 From: andreasgassmann Date: Fri, 4 Dec 2015 00:16:58 +0100 Subject: [PATCH 3/5] Fix detection of league client if multiple releases are present --- src/modules/lol-client.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/lol-client.js b/src/modules/lol-client.js index 1433206..ef3235e 100644 --- a/src/modules/lol-client.js +++ b/src/modules/lol-client.js @@ -7,6 +7,8 @@ let _ = require("underscore"); let domain = require("domain"); let logger; +const INTERNAL_PATH = "/solutions/lol_game_client_sln/releases/"; + let leaguePath = false; let fullPath = false; let leagueVersion = ""; @@ -66,14 +68,14 @@ function checkPath(callback) { callback(false); }; - fs.readdir(leaguePath + "/solutions/lol_game_client_sln/releases/", function(err, files) { + fs.readdir(leaguePath + INTERNAL_PATH, function(err, files) { if (err) { errorCallback(err); } else { files.sort(function(a, b) { - return fs.statSync(leaguePath + b).mtime.getTime() - fs.statSync(leaguePath + a).mtime.getTime(); + return fs.statSync(leaguePath + INTERNAL_PATH + b).mtime.getTime() - fs.statSync(leaguePath + INTERNAL_PATH + a).mtime.getTime(); }); - fullPath = leaguePath + "/solutions/lol_game_client_sln/releases/" + files[0] + "/deploy/"; + fullPath = leaguePath + INTERNAL_PATH + files[0] + "/deploy/"; fs.readdir(fullPath, function(err, files) { if (err) { From c8ad0404764359e11d48e3f17979dc4153d93d3f Mon Sep 17 00:00:00 2001 From: andreasgassmann Date: Fri, 4 Dec 2015 00:17:23 +0100 Subject: [PATCH 4/5] Add support for aof file version 12 --- src/modules/aof-parser.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/aof-parser.js b/src/modules/aof-parser.js index 19934bf..0865997 100644 --- a/src/modules/aof-parser.js +++ b/src/modules/aof-parser.js @@ -76,8 +76,10 @@ module.exports = function(extLogger) { let keyframe = {}; if (replayMetadata.version < 11) { keyframe.id = buff.readUInt8(c); c += 1; + } else if (replayMetadata.version == 11) { + keyframe.id = i + 1; c += 1; } else { - keyframe.id = buff.readUInt16BE(c); c += 1; + keyframe.id = buff.readUInt16BE(c); c += 2; } len = buff.readInt32BE(c); c += 4; keyframe.data = new Buffer(len); @@ -97,8 +99,10 @@ module.exports = function(extLogger) { let chunk = {}; if (replayMetadata.version < 11) { chunk.id = buff.readUInt8(c); c += 1; + } else if (replayMetadata.version == 11) { + chunk.id = i + 1; c += 1; } else { - chunk.id = buff.readUInt16BE(c); c += 1; + chunk.id = buff.readUInt16BE(c); c += 2; } len = buff.readInt32BE(c); c += 4; chunk.data = new Buffer(len); From 3c819ffeaacf061057f9de86465a7dfe49299c07 Mon Sep 17 00:00:00 2001 From: andreasgassmann Date: Fri, 4 Dec 2015 00:31:04 +0100 Subject: [PATCH 5/5] Bump version number --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index 7b0d468..04c7ec7 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "aof-replay-client", - "version": "0.1.5", + "version": "0.1.6", "main": "./index.js", "scripts": { "start": "cd .. && npm start",