From 0781c9b120a1306cdb4862c79ee5aaf187f92092 Mon Sep 17 00:00:00 2001 From: KatieFrogs <23621460+KatieFrogs@users.noreply.github.com> Date: Fri, 4 Mar 2022 01:41:56 +0300 Subject: [PATCH] More fixes - Add list of enabled plugins to the diagnostics - Fix broken image permormance in the diagnostics - Fix parsing undefined values in score storage - Do not error when verticalText or layeredText gets undefined text --- public/src/js/about.js | 4 ++++ public/src/js/canvasdraw.js | 4 ++-- public/src/js/loader.js | 7 ++++--- public/src/js/scorestorage.js | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/src/js/about.js b/public/src/js/about.js index 7611145..7734e9b 100644 --- a/public/src/js/about.js +++ b/public/src/js/about.js @@ -160,6 +160,10 @@ diag.push("Language: " + strings.id + userLangStr) var latency = settings.getItem("latency") diag.push("Audio Latency: " + (latency.audio > 0 ? "+" : "") + latency.audio.toString() + "ms, Video Latency: " + (latency.video > 0 ? "+" : "") + latency.video.toString() + "ms") + var pluginList = plugins.allPlugins.map(pluginLoader => { + return (pluginLoader.plugin.module && pluginLoader.plugin.module.name || pluginLoader.name) + (pluginLoader.plugin.started ? " (started)" : "") + }) + diag.push("Plugins: " + pluginList.join(", ")) var errorObj = {} if(localStorage["lastError"]){ try{ diff --git a/public/src/js/canvasdraw.js b/public/src/js/canvasdraw.js index e80529e..ee021f0 100644 --- a/public/src/js/canvasdraw.js +++ b/public/src/js/canvasdraw.js @@ -299,7 +299,7 @@ verticalText(config){ var ctx = config.ctx - var inputText = config.text.toString() + var inputText = "" + config.text var mul = config.fontSize / 40 var ura = false var r = this.regex @@ -623,7 +623,7 @@ layeredText(config, layers){ var ctx = config.ctx - var inputText = config.text.toString() + var inputText = "" + config.text var mul = config.fontSize / 40 var ura = false var r = this.regex diff --git a/public/src/js/loader.js b/public/src/js/loader.js index 1ca40d7..bf52532 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -327,7 +327,9 @@ class Loader{ p2.hash("") } - promises.push(this.canvasTest.drawAllImages()) + promises.push(this.canvasTest.drawAllImages().then(result => { + perf.allImg = result + })) if(gameConfig.plugins){ gameConfig.plugins.forEach(obj => { @@ -349,8 +351,7 @@ class Loader{ }) } - Promise.all(promises).then(result => { - perf.allImg = result + Promise.all(promises).then(() => { perf.load = Date.now() - this.startTime this.canvasTest.clean() this.clean() diff --git a/public/src/js/scorestorage.js b/public/src/js/scorestorage.js index 2d2ce2f..6fac5c0 100644 --- a/public/src/js/scorestorage.js +++ b/public/src/js/scorestorage.js @@ -48,7 +48,7 @@ class ScoreStorage{ var scoreArray = diffArray[i].slice(1).split(",") for(var j in this.scoreKeys){ var name = this.scoreKeys[j] - var value = parseInt(scoreArray[j], 36) || 0 + var value = parseInt(scoreArray[j] || 0, 36) || 0 if(value < 0){ value = 0 }