Fix Virtual Controller Remapper's bug (contd)

This commit is contained in:
redphx
2024-10-23 20:51:04 +07:00
parent 5b67b4c37d
commit 53442557e1
4 changed files with 37 additions and 33 deletions

View File

@@ -2656,7 +2656,7 @@ class NativeMkbHandler extends MkbHandler {
}
class LocalDb {
static DB_NAME = "BetterXcloud";
static DB_VERSION = 1;
static DB_VERSION = 2;
db;
open() {
return new Promise((resolve, reject) => {
@@ -2713,17 +2713,16 @@ class MkbPresetsDb extends LocalDb {
super();
BxLogger.info(this.LOG_TAG, "constructor()");
}
createTable(db) {
db.createObjectStore(this.TABLE_PRESETS, {
keyPath: "id",
autoIncrement: !0
}).createIndex("name_idx", "name");
}
onUpgradeNeeded(e) {
let db = e.target.result;
switch (e.oldVersion) {
case 0: {
db.createObjectStore(this.TABLE_PRESETS, {
keyPath: "id",
autoIncrement: !0
}).createIndex("name_idx", "name");
break;
}
}
if (db.objectStoreNames.contains("undefined")) db.deleteObjectStore("undefined");
if (!db.objectStoreNames.contains(this.TABLE_PRESETS)) this.createTable(db);
}
async presetsTable() {
return await this.open(), await this.table(this.TABLE_PRESETS, "readwrite");