From 4d755df5cf1555e9632ab6049b6d0f2df673f476 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 4 Feb 2024 05:25:18 +0900 Subject: [PATCH] Fix parameter matching for longs and doubles (they take two slots), and changes to namespace groups --- frontend/src/app/backend.ts | 8 ++++- .../mappings/MappingsEntryBlock.vue | 29 ++++++++++++++----- .../mappings/MappingsFilterBlock.vue | 11 +++---- frontend/src/locales/en_US.json | 3 +- frontend/src/locales/zh_CN.json | 11 ------- 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/backend.ts b/frontend/src/app/backend.ts index 68c0713..3b482c1 100644 --- a/frontend/src/app/backend.ts +++ b/frontend/src/app/backend.ts @@ -60,6 +60,12 @@ export let allNamespaceGroups: string[] = [ "Fabric", "Forge", "Quilt", + "Others", +] + +export let hiddenNamespaceGroups: string[] = [ + "Quilt", + "Others", ] export let namespaceGroups: { [key: string]: string | string[] } = { @@ -78,7 +84,7 @@ export let namespaceLocalizations: { [namespace: string]: string } = { "mojang": "Mojang (via Intermediary)", "mojang_srg": "Mojang (via SRG)", "mojang_hashed": "Mojang (via Hashed)", - "mcp": "MCP", + "mcp": "Legacy MCP", "quilt-mappings": "Quilt Mappings", "legacy-yarn": "Legacy Yarn", "yarrn": "Yarrn", diff --git a/frontend/src/components/mappings/MappingsEntryBlock.vue b/frontend/src/components/mappings/MappingsEntryBlock.vue index 25b30ed..404c897 100644 --- a/frontend/src/components/mappings/MappingsEntryBlock.vue +++ b/frontend/src/components/mappings/MappingsEntryBlock.vue @@ -501,15 +501,21 @@ export default defineComponent({ let args = [] as string[][] // Args can be single char or full class name wrapped with L and ; let index = desc.indexOf("(") + 1 + let array = 0 while (desc[index] !== ")") { let start = desc[index] - if (start === "L") { + if (start === "[") { + array++ + index++ + } else if (start === "L") { let end = desc.indexOf(";", index) let arg = desc.substring(index, end + 1) - args.push([arg, onlyClass(beautifyFieldType(arg).replaceAll(".", "/"))]) + args.push(["[".repeat(array) + arg, onlyClass(beautifyFieldType(arg).replaceAll(".", "/")) + "[]".repeat(array)]) + array = 0 index = end + 1 } else { - args.push([desc[index], beautifyFieldType(desc[index])]) + args.push(["[".repeat(array) + desc[index], beautifyFieldType(desc[index]) + "[]".repeat(array)]) + array = 0 index++ } } @@ -517,19 +523,26 @@ export default defineComponent({ }, methodArgs(entry: MappingEntry) { let args = this.getMethodArgs(entry) - let min = 1000000, max = 0 + let min = 1000000, max = 0, twoSpaces = 0 if (entry.args) { Object.keys(entry.args).filter(it => entry.args!!.hasOwnProperty(it)).map(it => +it).forEach(it => { if (it < min) min = it if (it > max) max = it }) + for (let i = 0; i < args.length - 1; i++) { + if (args[i][0] == "J" || args[i][0] == "D") { + twoSpaces++ + } + } + console.log(Object.values(entry.args), {...entry.args}, [...args], min, max, args.length, max - min + 1 - twoSpaces) } - let apply = -1 - if (max - min + 1 == args.length) apply = min + + let apply = false + if (max - min + 1 - twoSpaces == args.length) apply = true return args.map((arg, index) => { let name = `var${index}` - if (entry.args && apply >= 0) { - let argName = entry.args[index + apply] + if (entry.args && apply) { + let argName = Object.values(entry.args)[index] if (argName) { name = argName } diff --git a/frontend/src/components/mappings/MappingsFilterBlock.vue b/frontend/src/components/mappings/MappingsFilterBlock.vue index 06efaf3..732b25b 100644 --- a/frontend/src/components/mappings/MappingsFilterBlock.vue +++ b/frontend/src/components/mappings/MappingsFilterBlock.vue @@ -3,7 +3,7 @@ {{ $t("mappings.namespace") }}
-
+

{{ group }}

-
+

{{ group }}