diff --git a/Codes.xml b/Codes.xml
index 1bdbe93..2ebda20 100644
--- a/Codes.xml
+++ b/Codes.xml
@@ -4040,4 +4040,34 @@
00000000 59800004
+
+ InstantRestart
+ qol
+ recommended
+ Instant Restart
+ ポーズせずにやり直し
+ sup39(サポミク)
+ 0.1.3
+ Jan 07, 2022
+
+ When you pressed the buttons configured in [#Button Config](#config) simultaneously,
+ you can restart the current area without selecting "Exit Area" in pause menu.
+ Note that the restart function behaves differently than pressing Y or Z with "Level Select".
+ This code only supports restarting 1 area only.
+ For example, you can restart outside a secret stage or inside a secret stage individually,
+ but you can NOT restart a combination of outside+inside a secret stage.
+
+ ::: warning
+ You can NOT restart after destroying the last platform in Bowser fight at the moment.
+ :::
+
+
+ [#ボタン設定](#config)で設定したボタンを同時に押すと、ポーズメニューから「コースから出る」を選択せずに所在のエリアをやり直すことができます。ただし、Level SelectのYとZのやり直し機能と異なり、エリアごとのやり直ししかできないので注意してください。例えば、ヒミツ外部のみ、ヒミツ内部のみといった一つのエリアのやり直しはできますが、ヒミツ外部+ヒミツ内部といった組み合わせのやり直しはできません。
+
+ ::: warning
+ 現時点ではクッパ戦で最後の足場を破壊するとやり直しできません。
+ :::
+
+
+
diff --git a/changelog.md b/changelog.md
index 2969a0d..e92b7b8 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,27 @@
# Changelog
+## Apr 08, 2022
+### Implemented customizable code
+- Add code info in `Codes.xml` as other code,
+ but you should specify `` and available versions with ``
+ (the code in `` will be ignored).
+- Create directory `site/.vuepress/components/codes/YOUR_CODE_NAME`,
+ and create the following two files (file names are arbitrary):
+ + `codegen.js`: **export default** a `codegen(version: string): string` function,
+ where `version` is the game version (e.g. `GMSJ01`),
+ and the return value is the gecko code string.
+ The config of the code can be read from localStorage
+ (with key = `config/YOUR_CODE_ID` as convention) directly.
+ + `config.vue`: The vue component of the config UI,
+ which is shown below the `` given in `Codes.xml`.
+ When the config is changed, store the new config into localStorage
+ (with key = `config/YOUR_CODE_ID` as convention).
+- Register `codegen.js` in `site/.vuepress/components/codes/codegen.js`
+ and `config.vue` in `site/.vuepress/components/codes/ui.js`.
+ Note that the name used in export must match the `` of the code.
+
+### Added 'Instant Restart' (GMSJ01 only)
+Restarts the area without pausing.
+
## Mar 25, 2022
### Implemented dependencies system
Add `` tag in `` (e.g. `dep1,dep2,dep3`)
diff --git a/scripts/inject_codes.js b/scripts/inject_codes.js
index b3edd6f..876a227 100644
--- a/scripts/inject_codes.js
+++ b/scripts/inject_codes.js
@@ -107,8 +107,7 @@ const validateXML = (xmlString) => {
// Each source has a valid length
for (let j = 0; j < codeSources.length; j++) {
if (
- codeSources[j].textContent.replace(/[\s\n\r\t]+/gm, '').length % 16 != 0 ||
- codeSources[j].textContent.replace(/[\s\n\r\t]+/gm, '').length < 16
+ codeSources[j].textContent.replace(/[\s\n\r\t]+/gm, '').length % 16 != 0
)
throw new Error(
`Invalid source length for code '${codeTitle.textContent}' and version ${
diff --git a/site/.vuepress/components/CodeInfo.vue b/site/.vuepress/components/CodeInfo.vue
index 1c53ef4..9a031eb 100644
--- a/site/.vuepress/components/CodeInfo.vue
+++ b/site/.vuepress/components/CodeInfo.vue
@@ -11,21 +11,27 @@
{{ getLabel('codeinfo.author') }} {{ translatedCode.author }}
+
+
+
diff --git a/site/.vuepress/components/codes/InstantRestart/labels.json b/site/.vuepress/components/codes/InstantRestart/labels.json
new file mode 100644
index 0000000..eb785fc
--- /dev/null
+++ b/site/.vuepress/components/codes/InstantRestart/labels.json
@@ -0,0 +1,18 @@
+{
+ "h3Config": {
+ "ja-JP": "ボタン設定",
+ "en-US": "Button Config"
+ },
+ "lblDPad": {
+ "ja-JP": "【十字キー】",
+ "en-US": "D-Pad: "
+ },
+ "lblButton": {
+ "ja-JP": "【ボタン】",
+ "en-US": "Button: "
+ },
+ "pCautionZ": {
+ "ja-JP": "Zメニューが無効化されるので注意してください",
+ "en-US": "Note that Z menu will be disabled."
+ }
+}
diff --git a/site/.vuepress/components/codes/codegen.js b/site/.vuepress/components/codes/codegen.js
new file mode 100644
index 0000000..54c05c6
--- /dev/null
+++ b/site/.vuepress/components/codes/codegen.js
@@ -0,0 +1,17 @@
+import InstantRestart from './InstantRestart/codegen.js';
+
+export default {
+ InstantRestart,
+};
+
+/**
+ * @param {string|null} s -- raw input string
+ */
+export function parseJSON(s) {
+ if (s == null) return null;
+ try {
+ return JSON.parse(s);
+ } catch {
+ return null;
+ }
+}
diff --git a/site/.vuepress/components/codes/ui.js b/site/.vuepress/components/codes/ui.js
new file mode 100644
index 0000000..5c0c8a3
--- /dev/null
+++ b/site/.vuepress/components/codes/ui.js
@@ -0,0 +1,5 @@
+import InstantRestart from './InstantRestart/config.vue';
+
+export default {
+ InstantRestart,
+};