Added 'Previous Downloaded Codes' as a preset

This commit is contained in:
sup39 2023-02-11 16:59:34 +09:00
parent db587f8f54
commit 6607b1cb6e
8 changed files with 52 additions and 10 deletions

View file

@ -1,4 +1,7 @@
# Changelog
## Feb 11, 2023
Added 'Previous Downloaded Codes' as a preset
## Feb 08, 2023
### Updated 'Instant Level Select'
Overwrite button input value to prevent Level Select being activated when AreaLock is enabled

View file

@ -66,6 +66,7 @@
import { translateCode, translate } from '../i18n/localeHelper';
import codeCategories from '../data/codeCategories.json';
import presetCategories from '../data/presetCategories.json';
import {lskeyLDC} from './DownloadButton.vue';
export default {
props: {
@ -98,10 +99,16 @@ export default {
},
methods: {
getPresetOptions() {
return presetCategories.map((c) => ({
label: c.i18nKey,
value: c.identifier,
}));
return [
...presetCategories.map((c) => ({
label: c.i18nKey,
value: c.identifier,
})),
{
label: 'generatorconfig.presets.@lastDLCodes',
value: lskeyLDC,
},
];
},
emitChangeEvent() {
const selectedCodes = this.availableCodes.filter((c) => c.selected);
@ -120,8 +127,23 @@ export default {
return;
}
for (const code of this.availableCodes) {
code.selected = code.presets.includes(identifier);
if (identifier === lskeyLDC) {
// previous downloaded code
let titles = new Set();
try {
const o = JSON.parse(localStorage.getItem(lskeyLDC));
if (o instanceof Array) {
titles = new Set(o);
}
} catch {}
for (const code of this.availableCodes) {
code.selected = titles.has(code.title.find(o => o.lang === 'en-US').content);
}
} else {
// regular preset
for (const code of this.availableCodes) {
code.selected = code.presets.includes(identifier);
}
}
this.unselectStageLoader();

View file

@ -18,6 +18,8 @@ import { translate, translateCode } from '../i18n/localeHelper';
// customizable code
import codegens from './codes/codegen.js';
export const lskeyLDC = '@/lastDLCodes';
export default {
props: {
codes: { type: Array },
@ -60,6 +62,12 @@ export default {
]);
} catch {}
// save download code list
try {
const codeTitles = codeList.map(c => c.title.find(o => o.lang === 'en-US').content);
localStorage.setItem(lskeyLDC, JSON.stringify(codeTitles));
} catch {}
const fileName = gameVersions.find((v) => v.identifier === this.versionIdentifier).version;
// apply customizable codes

View file

@ -66,7 +66,8 @@
"recommended": "Recommended",
"il": "IL Runs",
"fap": "Fast Any%",
"hfsetup": "Hacked File Setup"
"hfsetup": "Hacked File Setup",
"@lastDLCodes": "(Previous Downloaded Codes)"
}
},
"landingpage": {

View file

@ -32,6 +32,14 @@
"gcm": "CheatManager TXT"
}
},
"presets": {
"standard": "標準",
"recommended": "おすすめ",
"il": "IL Runs",
"fap": "Fast Any%",
"hfsetup": "Hacked Fileセットアップ",
"@lastDLCodes": "(前回ダウンロードしたコード)"
},
"alert": {
"gct": "生成されたGCTファイルのサイズが5000バイトを超えました({size}バイト)。NintendontでこのGCTファイルを使う時、全ての機能が動作しなくなることがあるため、5000バイトを超えないようにいくつかの機能を減らすことをおすすめします。",
"dolphin": "コードの合計サイズが3256バイトを超えました({size}バイト)。Dolphinで全てのコードをONにすると、全ての機能が動作しなくなることがあります。その場合はいくつかのコードをOFFにしてください。"

View file

@ -5,4 +5,4 @@ editLink: false
# Code Referenz
<!-- injectionpoint -->
<!-- injectionpoint -->

View file

@ -5,4 +5,4 @@ editLink: false
# Référence des codes
<!-- injectionpoint -->
<!-- injectionpoint -->

View file

@ -5,4 +5,4 @@ editLink: false
# チートコード一覧
<!-- injectionpoint -->
<!-- injectionpoint -->