Merge branch 'master' into gci
This commit is contained in:
commit
c9d3b824ca
3 changed files with 43 additions and 8 deletions
|
@ -1,4 +1,7 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
## Oct 16, 2023
|
||||||
|
Added dependencies information to generated ini/txt
|
||||||
|
|
||||||
## Jul 15, 2023
|
## Jul 15, 2023
|
||||||
### Fixed the bug that background color cannot be changed in 'Controller Input Display'
|
### Fixed the bug that background color cannot be changed in 'Controller Input Display'
|
||||||
### Ported 'FastForward', 'InstantRestart', 'SpawnYoshi', 'StageIntroSkip' to all versions
|
### Ported 'FastForward', 'InstantRestart', 'SpawnYoshi', 'StageIntroSkip' to all versions
|
||||||
|
|
|
@ -114,7 +114,7 @@ export default {
|
||||||
const selectedCodes = this.availableCodes.filter((c) => c.selected);
|
const selectedCodes = this.availableCodes.filter((c) => c.selected);
|
||||||
// add dependencies
|
// add dependencies
|
||||||
const deps = new Set(selectedCodes.flatMap(c => c.dependencies));
|
const deps = new Set(selectedCodes.flatMap(c => c.dependencies));
|
||||||
selectedCodes.push(...this.codes.filter(c => deps.has(c.id)));
|
selectedCodes.push(...this.availableCodes.filter(c => !c.selected && deps.has(c.id)));
|
||||||
// emit
|
// emit
|
||||||
this.onSelectionChanged(selectedCodes);
|
this.onSelectionChanged(selectedCodes);
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,7 +35,39 @@ export default {
|
||||||
if ((!this.codes || !this.codes.length) && !this.stageLoaderCode) {
|
if ((!this.codes || !this.codes.length) && !this.stageLoaderCode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const codeList = this.codes.map((c) => ({ ...c }));
|
|
||||||
|
const codeList = this.codes.map((c) => ({
|
||||||
|
...c,
|
||||||
|
// for recording previous downloaded code
|
||||||
|
titleEN: c.title.find(o => o.lang === 'en-US').content,
|
||||||
|
// for generated txt, ini
|
||||||
|
title: translateCode(c, this.$lang).title,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// add dependencies information to title
|
||||||
|
const id2code = Object.fromEntries(codeList.map(c => [c.id, c]));
|
||||||
|
const depBys = {};
|
||||||
|
/* depends on */
|
||||||
|
for (const c of codeList) {
|
||||||
|
if (c.dependencies.length) {
|
||||||
|
c.dependencies.forEach(id => {
|
||||||
|
depBys[id] ??= [];
|
||||||
|
depBys[id].push(c.title);
|
||||||
|
});
|
||||||
|
const depList = c.dependencies.map(id => id2code[id].title).join(', ');
|
||||||
|
c.title += ` **(REQUIRES: ${depList})**`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* used by */
|
||||||
|
for (const [id, depBy] of Object.entries(depBys)) {
|
||||||
|
id2code[id].title += ` (Used by: ${depBy.join(', ')})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save downloaded code list
|
||||||
|
try {
|
||||||
|
const codeTitles = codeList.map(c => c.titleEN);
|
||||||
|
localStorage.setItem(lskeyLDC, JSON.stringify(codeTitles));
|
||||||
|
} catch {}
|
||||||
|
|
||||||
if (this.stageLoaderCode)
|
if (this.stageLoaderCode)
|
||||||
codeList.push({
|
codeList.push({
|
||||||
|
@ -93,7 +125,10 @@ export default {
|
||||||
// download GCI Loader + GCT only code as remaining format
|
// download GCI Loader + GCT only code as remaining format
|
||||||
const {codes} = gameVersions.find((v) => v.identifier === this.versionIdentifier);
|
const {codes} = gameVersions.find((v) => v.identifier === this.versionIdentifier);
|
||||||
const gciLoader = codes.find(code => code.id === 'GCILoader');
|
const gciLoader = codes.find(code => code.id === 'GCILoader');
|
||||||
codeList.push(gciLoader, ...codeListGCT);
|
codeList.push({
|
||||||
|
...gciLoader,
|
||||||
|
title: translateCode(gciLoader, this.$lang).title,
|
||||||
|
}, ...codeListGCT);
|
||||||
if (!format && codeListGCT.length) {
|
if (!format && codeListGCT.length) {
|
||||||
const list = codeListGCT.map(c => (
|
const list = codeListGCT.map(c => (
|
||||||
c.title.find(o => o.lang === this.$lang) ??
|
c.title.find(o => o.lang === this.$lang) ??
|
||||||
|
@ -163,10 +198,7 @@ export default {
|
||||||
let data = 'Paste the following on top of your games .ini file:\r\n[Gecko]';
|
let data = 'Paste the following on top of your games .ini file:\r\n[Gecko]';
|
||||||
|
|
||||||
codes.forEach((code) => {
|
codes.forEach((code) => {
|
||||||
const codeTitle =
|
data += `\r\n$${code.title} (${code.date}) [${code.author}]\r\n`;
|
||||||
typeof code.title === 'string' ? code.title : translateCode(code, this.$lang).title;
|
|
||||||
|
|
||||||
data += `\r\n$${codeTitle} (${code.date}) [${code.author}]\r\n`;
|
|
||||||
data += code.source
|
data += code.source
|
||||||
.match(/.{8}/g)
|
.match(/.{8}/g)
|
||||||
.join(' ')
|
.join(' ')
|
||||||
|
@ -182,7 +214,7 @@ export default {
|
||||||
const codeTitle =
|
const codeTitle =
|
||||||
typeof code.title === 'string' ? code.title : translateCode(code, this.$lang).title;
|
typeof code.title === 'string' ? code.title : translateCode(code, this.$lang).title;
|
||||||
|
|
||||||
data += `\r\n\r\n${codeTitle} (${code.date}) [${code.author}]\r\n`;
|
data += `\r\n\r\n${code.title} (${code.date}) [${code.author}]\r\n`;
|
||||||
data += code.source
|
data += code.source
|
||||||
.match(/.{8}/g)
|
.match(/.{8}/g)
|
||||||
.join(' ')
|
.join(' ')
|
||||||
|
|
Loading…
Reference in a new issue