fix codes getting bigger with each download
This commit is contained in:
parent
313ee79416
commit
efeeb8f40d
1 changed files with 10 additions and 10 deletions
|
@ -30,13 +30,13 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClick() {
|
onClick() {
|
||||||
if (!(this.codes || this.codes.length === 0) && !this.stageLoaderCode) {
|
if ((!this.codes || !this.codes.length) && !this.stageLoaderCode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const c = [...(this.codes ?? [])];
|
const codeList = this.codes.map((c) => ({ ...c }));
|
||||||
|
|
||||||
if (this.stageLoaderCode)
|
if (this.stageLoaderCode)
|
||||||
c.push({
|
codes.push({
|
||||||
title: 'Stage List Loader',
|
title: 'Stage List Loader',
|
||||||
author: 'Noki Doki',
|
author: 'Noki Doki',
|
||||||
date: '-',
|
date: '-',
|
||||||
|
@ -52,7 +52,7 @@ export default {
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
gameVersion: this.versionIdentifier,
|
gameVersion: this.versionIdentifier,
|
||||||
format: this.format,
|
format: this.format,
|
||||||
codes: c.map((code) => ({
|
codes: codeList.map((code) => ({
|
||||||
title: code.title,
|
title: code.title,
|
||||||
version: code.version,
|
version: code.version,
|
||||||
})),
|
})),
|
||||||
|
@ -63,7 +63,7 @@ export default {
|
||||||
const fileName = gameVersions.find((v) => v.identifier === this.versionIdentifier).version;
|
const fileName = gameVersions.find((v) => v.identifier === this.versionIdentifier).version;
|
||||||
|
|
||||||
// apply customizable codes
|
// apply customizable codes
|
||||||
for (const code of c) {
|
for (const code of codeList) {
|
||||||
const codegen = codegens[code.id];
|
const codegen = codegens[code.id];
|
||||||
if (codegen) {
|
if (codegen) {
|
||||||
code.source = codegen(this.versionIdentifier, code.source);
|
code.source = codegen(this.versionIdentifier, code.source);
|
||||||
|
@ -71,20 +71,20 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate file
|
// generate file
|
||||||
const codeSize = c.reduce((a, e) => a + e.source.length, 0) / 2 + 16; // 8(00D0)+8(F000)
|
const codeSize = codeList.reduce((a, e) => a + e.source.length, 0) / 2 + 16; // 8(00D0)+8(F000)
|
||||||
// console.log(codeSize, c);
|
// console.log(codeSize, codeList);
|
||||||
switch (this.format) {
|
switch (this.format) {
|
||||||
case 'gct':
|
case 'gct':
|
||||||
this.alertGCTCodeSize(codeSize);
|
this.alertGCTCodeSize(codeSize);
|
||||||
this.generateGCT(c, fileName);
|
this.generateGCT(codeList, fileName);
|
||||||
break;
|
break;
|
||||||
case 'dolphin':
|
case 'dolphin':
|
||||||
this.alertDolphinCodeSize(codeSize);
|
this.alertDolphinCodeSize(codeSize);
|
||||||
this.generateDolphinINI(c, fileName);
|
this.generateDolphinINI(codeList, fileName);
|
||||||
break;
|
break;
|
||||||
case 'gcm':
|
case 'gcm':
|
||||||
this.alertDolphinCodeSize(codeSize);
|
this.alertDolphinCodeSize(codeSize);
|
||||||
this.generateCheatManagerTXT(c, fileName);
|
this.generateCheatManagerTXT(codeList, fileName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue