From efff7c37a6b0e42d689d90dddc12043f8bdd2216 Mon Sep 17 00:00:00 2001 From: Allan Niles <60013695a@gmail.com> Date: Fri, 25 Aug 2023 01:43:15 +0000 Subject: [PATCH] fix joystick and keyboard input localization --- data/emulator.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/data/emulator.js b/data/emulator.js index a1c2a3c..e2cdaf5 100644 --- a/data/emulator.js +++ b/data/emulator.js @@ -2249,22 +2249,32 @@ class EmulatorJS { if (this.controls[i][k] && this.controls[i][k].value !== undefined) { let value = this.controls[i][k].value.toString(); if (value === " ") value = "space"; + value = this.localization(value); textBox2.value = value; } if (this.controls[i][k] && this.controls[i][k].value2 !== undefined && this.controls[i][k].value2 !== "") { - let value2 = this.controls[i][k].value2.toString().split(":"); - textBox1.value = this.localization(value2[0]) + ":" + this.localization(value2[1]); + let value2 = this.controls[i][k].value2.toString(); + if (value2.indexOf(":") !== -1) { + value2 = value2.split(":"); + value2 = this.localization(value2[0]) + ":" + this.localization(value2[1]) + } + textBox1.value = value2; } }) if (this.controls[i][k] && this.controls[i][k].value) { let value = this.controls[i][k].value.toString(); if (value === " ") value = "space"; + value = this.localization(value); textBox2.value = value; } if (this.controls[i][k] && this.controls[i][k].value2) { - let value2 = this.controls[i][k].value2.toString().split(":"); - textBox1.value = this.localization("button") + " " + this.localization(value2[0]) + ":" + this.localization(value2[1]); + let value2 = this.controls[i][k].value2.toString(); + if (value2.indexOf(":") !== -1) { + value2 = value2.split(":"); + value2 = this.localization(value2[0]) + ":" + this.localization(value2[1]) + } + textBox1.value = value2; } textBoxes.appendChild(textBox1Parent);