Implement dependencies system

Update PatternSelector(v0.2.0) [GMSJ01]
Update metadata to use drawText [GMSJ01]
This commit is contained in:
sup39 2022-03-24 16:55:08 +09:00
parent 8943d44f4d
commit c8410d8b2c
5 changed files with 106 additions and 190 deletions

265
Codes.xml
View file

@ -2865,9 +2865,10 @@
<title lang="de-CH">Position/Winkel/Geschw. Display</title>
<title lang="fr-FR">Affichage de position/angle/vitesse</title>
<title lang="ja-JP">位置/角度/速度表示</title>
<author>Noki Doki</author>
<version>1.3</version>
<date>Oct 28, 2019</date>
<author>Noki Doki, sup39(サポミク)</author>
<version>1.4</version>
<date>Mar 24, 2022</date>
<dependencies version="GMSJ01">drawText</dependencies>
<description lang="en-US">
Shows Mario's position, angle and speed at any given time.
@ -2958,57 +2959,23 @@
60000000 00000000
</source>
<source version="GMSJ01">
060F9B64 00000010
49700515 60000000
60000000 60000000
040ECE3C 4970D1C5
04206734 495F39E9
077FA000 000001E8
9421FFE0 7C0802A6
90010024 93E1001C
4A91239D 38E00200
38C00320 38A0FFD8
3880000A 38610008
4A8191F5 814D97F8
3FE08180 3BFFA1EC
39200000 39000002
3CE08180 38E7A164
80CA0048 38A10008
38800000 7FE3FB78
4A81F8AD 39200001
913F01B0 80010024
7C0803A6 83E1001C
38210020 4E800020
9421FFE8 7C0802A6
9001001C 93A1000C
93C10010 93E10014
7C7F1B78 81230000
83A90064 3D208180
8129A39C 2F890000
409E002C 7FE3FB78
7FA903A6 4E800421
8001001C 7C0803A6
83A1000C 83C10010
83E10014 38210018
4E800020 3D208040
6129A378 83C90000
3C608180 3863A1EC
4A81FC35 C0BE00A8
C09E00B0 A0DE0096
C07E0018 C05E0014
C03E0010 3CA08180
38A5A164 38800080
4CC63242 4A889FB1
4BFFFF94 9421FFF0
7C0802A6 90010014
93E1000C 7C7F1B78
4A83B0F9 38E00081
7FE6FB78 38A00000
38800000 3C608180
3863A1EC 4A81ED19
80010014 7C0803A6
83E1000C 38210010
4E800020 5820506F
04206734 495F38CD
077FA000 000000B5
9421FFF0 7C0802A6
90010014 93E1000C
7C7F1B78 4A83B215
3D208041 8149A378
3D008180 38600010
3908A074 C0AA00A8
38E0FFFF C08A00B0
38C0FFFF A12A0096
38A00014 C06A0018
388000C8 C04A0014
C02A0010 4CC63242
4BFF61E1 80010014
7FE3FB78 83E1000C
7C0803A6 38210010
4A83B1B8 5820506F
7320252E 30660A59
20506F73 20252E30
660A5A20 506F7320
@ -3016,19 +2983,7 @@
6C652025 68750A48
20537064 20252E32
660A5620 53706420
252E3266 20202020
20202020 20202020
20202020 20202020
20202020 20202020
20202020 20202020
20202020 20202020
20202020 20202020
20202020 20202020
20202000 00000000
C20FA0F8 00000003
38600000 3D808180
906CA39C 807F0040
60000000 00000000
252E3266 00000000
</source>
<source version="GMSJ0A">
06285FBC 00000010
@ -3183,9 +3138,10 @@
<title lang="de-CH">Geschwindigkeits-Display</title>
<title lang="fr-FR">Affichage de vitesse</title>
<title lang="ja-JP">速度表示</title>
<author>Noki Doki</author>
<version>1.4</version>
<date>Nov 28, 2021</date>
<author>Noki Doki, sup39(サポミク)</author>
<version>1.5</version>
<date>Mar 24, 2022</date>
<dependencies version="GMSJ01">drawText</dependencies>
<description lang="en-US">
Shows Mario's speed at any given time.
@ -3264,65 +3220,24 @@
60000000 00000000
</source>
<source version="GMSJ01">
060F9B64 00000010
49700515 60000000
60000000 60000000
040ECE3C 4970D1C5
04206734 495F39D9
077FA000 00000188
9421FFE0 7C0802A6
90010024 93E1001C
4A91239D 38E00200
38C00320 38A0FFD8
3880000A 38610008
4A8191F5 814D97F8
3FE08180 3BFFA214
39200000 39000002
3CE08180 38E7A154
80CA0048 38A10008
38800000 7FE3FB78
4A81F8AD 39200001
913F01B0 80010024
7C0803A6 83E1001C
38210020 4E800020
9421FFE8 7C0802A6
9001001C 93C10010
93E10014 7C7F1B78
81230000 83C90064
3D208180 8129A3C4
2C090000 40820028
7FE3FB78 7FC903A6
4E800421 8001001C
7C0803A6 83C10010
83E10014 38210018
4E800020 93A1000C
3D208040 6129A378
83A90000 3C608180
3863A214 4A81FC39
C05D00A8 C03D00B0
3CA08180 38A5A154
38800030 4CC63242
4A889FC5 83A1000C
4BFFFFA0 9421FFF0
7C0802A6 90010014
93E1000C 7C7F1B78
4A83B109 38E00081
7FE6FB78 38A00000
38800000 3C608180
3863A214 4A81ED29
80010014 7C0803A6
83E1000C 38210010
4E800020 48205370
04206734 495F38CD
077FA000 0000007C
9421FFF0 7C0802A6
90010014 93E1000C
7C7F1B78 4A83B215
3D208041 8129A378
3D008180 38600010
3908A064 C04900A8
38E0FFFF C02900B0
38C0FFFF 38A00014
388000F0 4CC63242
4BFF61F1 80010014
7FE3FB78 83E1000C
7C0803A6 38210010
4A83B1C8 48205370
6420252E 32660A56
20537064 20252E32
66202020 20202020
20202020 20202020
20202020 20202020
20202000 00000000
C20FA0F8 00000003
38600000 3D808180
906CA3C4 807F0040
60000000 00000000
66000000 00000000
</source>
<source version="GMSJ0A">
06285FBC 00000010
@ -3844,9 +3759,10 @@
<presets>recommended</presets>
<title lang="en-US">Pattern Selector</title>
<title lang="ja-JP">パターン選択</title>
<author>sup39[サポミク]</author>
<version>0.1.3</version>
<date>Feb 06, 2022</date>
<author>sup39(サポミク)</author>
<version>0.2.0</version>
<date>Mar 04, 2022</date>
<dependencies>drawText</dependencies>
<description lang="en-US">
![Preview](/img/PatternSelector/preview.jpg)
@ -3928,44 +3844,6 @@
%object[]{data="/img/PatternSelector/PV1-3.svg"}
</description>
<source version="GMSJ01">
<!-- drawText -->
077F0238 00000114
9421FED8 7C0802A6
BF810118 7C7F1B78
9001012C 7C9E2378
90C100B8 7CBD2B78
90E100BC 7D1C4378
912100C0 914100C4
40860024 D82100C8
D84100D0 D86100D8
D88100E0 D8A100E8
D8C100F0 D8E100F8
D9010100 39200600
390100BC B12100A0
39210130 912100A4
392100A8 912100A8
808D97F8 38E100B8
7FA6EB78 38A00000
38610008 6FDE8000
4A826AF5 3D204330
91210108 3D40817F
93C1010C 6FFF8000
C00A0348 38610070
C9810108 91210110
3D20817F 93E10114
FC4C0028 C0690344
C9810110 93A10064
FC2C0028 93A10060
4A8A43E9 38800000
38610070 4A8BD419
38C100A0 7F85E378
388000FF 38610008
4A826951 38610008
38210128 BB81FFF0
80010004 7C0803A6
4A826AEC 00000000
59800004 00000000
0420675C 495F2A79
0424F32C 495A9CED
077F9018 000003BA
@ -4114,4 +3992,55 @@
0402BF98 60000000
</source>
</code>
<code>
<id>drawText</id>
<category>lib</category>
<title lang="en-US">drawText</title>
<author>sup39(サポミク)</author>
<version>0.1.3</version>
<date>Mar 04, 2022</date>
<description lang="en-US">
```c
void drawText(int x, int y, int fontSize, uint32_t colorTop, uint32_t colorBot, const char *fmt, ...);
```
</description>
<source version="GMSJ01">
077F0238 00000114
9421FED8 7C0802A6
BF810118 7C7F1B78
9001012C 7C9E2378
90C100B8 7CBD2B78
90E100BC 7D1C4378
912100C0 914100C4
40860024 D82100C8
D84100D0 D86100D8
D88100E0 D8A100E8
D8C100F0 D8E100F8
D9010100 39200600
390100BC B12100A0
39210130 912100A4
392100A8 912100A8
808D97F8 38E100B8
7FA6EB78 38A00000
38610008 6FDE8000
4A826AF5 3D204330
91210108 3D40817F
93C1010C 6FFF8000
C00A0348 38610070
C9810108 91210110
3D20817F 93E10114
FC4C0028 C0690344
C9810110 93A10064
FC2C0028 93A10060
4A8A43E9 38800000
38610070 4A8BD419
38C100A0 7F85E378
388000FF 38610008
4A826951 38610008
38210128 BB81FFF0
80010004 7C0803A6
4A826AEC 00000000
59800004 00000000
</source>
</code>
</codes>

20
package-lock.json generated
View file

@ -17,7 +17,6 @@
"@vuepress/plugin-back-to-top": "1.9.7",
"@vuepress/plugin-medium-zoom": "1.9.7",
"jsdom": "19.0.0",
"markdown-it-attrs": "4.1.3",
"pre-commit": "1.2.2",
"prettier": "2.6.0",
"serve": "^13.0.2",
@ -9530,18 +9529,6 @@
"markdown-it": "*"
}
},
"node_modules/markdown-it-attrs": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-4.1.3.tgz",
"integrity": "sha512-d5yg/lzQV2KFI/4LPsZQB3uxQrf0/l2/RnMPCPm4lYLOZUSmFlpPccyojnzaHkfQpAD8wBHfnfUW0aMhpKOS2g==",
"dev": true,
"engines": {
"node": ">=6"
},
"peerDependencies": {
"markdown-it": ">= 9.0.0 < 13.0.0"
}
},
"node_modules/markdown-it-chain": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/markdown-it-chain/-/markdown-it-chain-1.3.0.tgz",
@ -23972,13 +23959,6 @@
"dev": true,
"requires": {}
},
"markdown-it-attrs": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-4.1.3.tgz",
"integrity": "sha512-d5yg/lzQV2KFI/4LPsZQB3uxQrf0/l2/RnMPCPm4lYLOZUSmFlpPccyojnzaHkfQpAD8wBHfnfUW0aMhpKOS2g==",
"dev": true,
"requires": {}
},
"markdown-it-chain": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/markdown-it-chain/-/markdown-it-chain-1.3.0.tgz",

View file

@ -25,7 +25,6 @@
"@vuepress/plugin-back-to-top": "1.9.7",
"@vuepress/plugin-medium-zoom": "1.9.7",
"jsdom": "19.0.0",
"markdown-it-attrs": "4.1.3",
"pre-commit": "1.2.2",
"prettier": "2.6.0",
"serve": "^13.0.2",

View file

@ -47,7 +47,7 @@ const validateXML = (xmlString) => {
if (!codeCategory || !codeCategory.textContent)
throw new Error(`Missing code category in ${codeTitle.textContent}`);
if (!codeCategories.map((c) => c.identifier).includes(codeCategory.textContent))
if (!['lib', ...codeCategories.map((c) => c.identifier)].includes(codeCategory.textContent))
throw new Error(`Invalid code category for ${codeTitle.textContent}`);
const codePresets = codes[i].querySelector('presets');
@ -279,6 +279,7 @@ const parseXml = (xmlString, gameVersion = null) => {
return codes
.map((code) => ({
id: code.querySelector('id')?.textContent ?? null,
author: readTextNode(code, 'author'),
title: localizeNode(code, 'title'),
description: localizeMarkdown(code, 'description'),
@ -288,6 +289,9 @@ const parseXml = (xmlString, gameVersion = null) => {
presets: readPresetList(code, gameVersion),
category: readTextNode(code, 'category'),
dependsOn: code.querySelector('depends-on')?.textContent ?? null,
dependencies:
code.querySelector('dependencies:not([version])')?.textContent.split(',') ??
code.querySelector(`dependencies[version=${gameVersion}]`)?.textContent.split(',') ?? [],
}))
.filter((code) => code.source != null);
};

View file

@ -105,6 +105,10 @@ export default {
},
emitChangeEvent() {
const selectedCodes = this.availableCodes.filter((c) => c.selected);
// add dependencies
const deps = new Set(selectedCodes.flatMap(c => c.dependencies));
selectedCodes.push(...this.codes.filter(c => deps.has(c.id)));
// emit
this.onSelectionChanged(selectedCodes);
},
loadPreset(identifier) {