diff --git a/changelog.md b/changelog.md index ebc6840..7a24c44 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/site/.vuepress/components/CodeList.vue b/site/.vuepress/components/CodeList.vue index 4749823..4aed5b2 100644 --- a/site/.vuepress/components/CodeList.vue +++ b/site/.vuepress/components/CodeList.vue @@ -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(); diff --git a/site/.vuepress/components/DownloadButton.vue b/site/.vuepress/components/DownloadButton.vue index d7ea060..5602644 100644 --- a/site/.vuepress/components/DownloadButton.vue +++ b/site/.vuepress/components/DownloadButton.vue @@ -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 diff --git a/site/.vuepress/i18n/en-US.json b/site/.vuepress/i18n/en-US.json index 81a767e..ffdd08c 100644 --- a/site/.vuepress/i18n/en-US.json +++ b/site/.vuepress/i18n/en-US.json @@ -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": { diff --git a/site/.vuepress/i18n/ja-JP.json b/site/.vuepress/i18n/ja-JP.json index 47727f0..e065a6e 100644 --- a/site/.vuepress/i18n/ja-JP.json +++ b/site/.vuepress/i18n/ja-JP.json @@ -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にしてください。" diff --git a/site/de/code-reference/index.md b/site/de/code-reference/index.md index 1d77685..5bd94ed 100644 --- a/site/de/code-reference/index.md +++ b/site/de/code-reference/index.md @@ -5,4 +5,4 @@ editLink: false # Code Referenz - + \ No newline at end of file diff --git a/site/fr/code-reference/index.md b/site/fr/code-reference/index.md index 8a1900d..59b5403 100644 --- a/site/fr/code-reference/index.md +++ b/site/fr/code-reference/index.md @@ -5,4 +5,4 @@ editLink: false # Référence des codes - + \ No newline at end of file diff --git a/site/ja/code-reference/index.md b/site/ja/code-reference/index.md index 4e1fd7e..812ede9 100644 --- a/site/ja/code-reference/index.md +++ b/site/ja/code-reference/index.md @@ -5,4 +5,4 @@ editLink: false # チートコード一覧 - + \ No newline at end of file