Created 'Quarterframe Section Timer'

This commit is contained in:
sup39 2023-02-01 02:49:55 +09:00
parent 20e3af3816
commit 2f0be0bf68
11 changed files with 306 additions and 17 deletions

152
Codes.xml
View file

@ -4221,4 +4221,156 @@
040eb024 60000000
</source>
</code>
<code>
<id>qfst</id>
<category>misc</category>
<title lang="en-US">Quarterframe Section Timer</title>
<title lang="ja-JP">QFセクションタイマー</title>
<author>sup39(サポミク)</author>
<version>0.1</version>
<date>Jan 31, 2023</date>
<dependencies>drawText</dependencies>
<description lang="en-US">
Calculate and display section times whenever Quarterframe Timer freezes.
</description>
<description lang="ja-JP">
QFタイマーが一時停止する度にセクションタイムを計算して表示します。
</description>
<source version="GMSJ01">
C20F9DD0 00000003
3C60817F 3BA00004
93A303CC 3BA00000
B3A303CA 00000000
C22069E4 0000001B
3821FFD0 BF210008
3F20817F AB9903B2
3BF903D0 A3D903CA
7F9DE378 835903B4
80D900BC 28060000
41A2002C 809900B8
80B903CC 7C042800
40A1001C 7C052050
57CC16BA 7C1F612E
909903CC 3BDE0001
B3D903CA 3879039C
389903AC 3D808020
398C1EA8 7D8803A6
4E800021 57DBE13F
41820008 3B7EFFF0
7C1BF040 4080004C
576316BA 7C1F182E
1D6003E9 38000078
7D6B0396 380003E8
7CAB0396 1C0503E8
7CC05850 387903B0
389903C0 39990238
7D8803A6 4E800021
7FBDD214 3B7B0001
B3B903B2 4BFFFFB4
B39903B2 BB210008
38210030 00000000
</source>
<source version="GMSJ0A">
C2286228 00000003
3C60817F 3BA00004
93A303CC 3BA00000
B3A303CA 00000000
C2125550 0000001B
3821FFD0 BF210008
3F20817F AB9903B2
3BF903D0 A3D903CA
7F9DE378 835903B4
80D900BC 28060000
41A2002C 809900B8
80B903CC 7C042800
40A1001C 7C052050
57CC16BA 7C1F612E
909903CC 3BDE0001
B3D903CA 3879039C
389903AC 3D808012
398C1660 7D8803A6
4E800021 57DBE13F
41820008 3B7EFFF0
7C1BF040 4080004C
576316BA 7C1F182E
1D6003E9 38000078
7D6B0396 380003E8
7CAB0396 1C0503E8
7CC05850 387903B0
389903C0 39990238
7D8803A6 4E800021
7FBDD214 3B7B0001
B3B903B2 4BFFFFB4
B39903B2 BB210008
38210030 00000000
</source>
<source version="GMSP01">
C229E2DC 00000003
3C60817F 3BA00004
93A303CC 3BA00000
B3A303CA 00000000
C2138E00 0000001B
3821FFD0 BF210008
3F20817F AB9903B2
3BF903D0 A3D903CA
7F9DE378 835903B4
80D900BC 28060000
41A2002C 809900B8
80B903CC 7C042800
40A1001C 7C052050
57CC16BA 7C1F612E
909903CC 3BDE0001
B3D903CA 3879039C
389903AC 3D808013
398C4F0C 7D8803A6
4E800021 57DBE13F
41820008 3B7EFFF0
7C1BF040 4080004C
576316BA 7C1F182E
1D6003E9 38000078
7D6B0396 380003E8
7CAB0396 1C0503E8
7CC05850 387903B0
389903C0 39990238
7D8803A6 4E800021
7FBDD214 3B7B0001
B3B903B2 4BFFFFB4
B39903B2 BB210008
38210030 00000000
</source>
<source version="GMSE01">
C22A63CC 00000003
3C60817F 3BA00004
93A303CC 3BA00000
B3A303CA 00000000
C21441C4 0000001B
3821FFD0 BF210008
3F20817F AB9903B2
3BF903D0 A3D903CA
7F9DE378 835903B4
80D900BC 28060000
41A2002C 809900B8
80B903CC 7C042800
40A1001C 7C052050
57CC16BA 7C1F612E
909903CC 3BDE0001
B3D903CA 3879039C
389903AC 3D808014
398C0390 7D8803A6
4E800021 57DBE13F
41820008 3B7EFFF0
7C1BF040 4080004C
576316BA 7C1F182E
1D6003E9 38000078
7D6B0396 380003E8
7CAB0396 1C0503E8
7CC05850 387903B0
389903C0 39990238
7D8803A6 4E800021
7FBDD214 3B7B0001
B3B903B2 4BFFFFB4
B39903B2 BB210008
38210030 00000000
</source>
</code>
</codes>

View file

@ -1,5 +1,8 @@
# Changelog
## Jan 31, 2023
### Created 'Quarterframe Section Timer'
Calculate and display section times whenever Quarterframe Timer freezes
### Updated 'Pattern Selector'
- Rewrote with C2 + separated config 06
- Remove label option

View file

@ -38,10 +38,9 @@ export default {
showPreview() {
return [
'PatternSelector',
'PASDisplay',
'SpeedDisplay',
'CustomizedDisplay',
'qft',
'qfst',
].includes(this.code.id); // TODO
},
},

View file

@ -113,6 +113,7 @@ import { translate } from '../i18n/localeHelper';
// Code Configs
import {getConfig as getConfigQFT} from './codes/qft/codegen';
import {getConfig as getConfigQFST} from './codes/qfst/codegen';
import {getConfig as getConfigCD} from './codes/CustomizedDisplay/codegen';
import {getConfig as getConfigPS} from './codes/PatternSelector/codegen';
@ -163,6 +164,7 @@ export default {
// update config for preview
this.codeConfigs = {
qft: getConfigQFT(),
qfst: getConfigQFST(),
PatternSelector: getConfigPS(),
CustomizedDisplay: getConfigCD(e),
};

View file

@ -1,10 +1,11 @@
<template>
<div class="preview-root">
<div class="preview-ctn">
<PreviewString :config="config.qft" :version="_version" />
<PreviewString v-for="mdp,i in (config.CustomizedDisplay || [])"
:key="'mdp'+i" :config="mdp" :version="_version" />
<PreviewString :config="config.PatternSelector" :version="_version" />
<PreviewString :config="config.qft" :version="_version" />
<PreviewString :config="config.qfst" :version="_version" />
</div>
</div>
</template>

View file

@ -1,11 +1,13 @@
import InstantRestart from './InstantRestart/codegen.js';
import qft from './qft/codegen.js';
import qfst from './qfst/codegen.js';
import CustomizedDisplay from './CustomizedDisplay/codegen.js';
import PatternSelector from './PatternSelector/codegen.js';
export default {
InstantRestart,
qft,
qfst,
CustomizedDisplay,
PatternSelector,
};

View file

@ -1,5 +1,8 @@
{
"ja-JP": {
"h3": {
"appearance": "見た目"
},
"location": "位置:",
"fontSize": "文字サイズ:",
"fgColor": "文字色:",
@ -15,6 +18,9 @@
"bottom": "下"
},
"en-US": {
"h3": {
"appearance": "Appearance"
},
"location": "Location: ",
"fontSize": "Font size: ",
"fgColor": "Font color: ",

View file

@ -0,0 +1,66 @@
import { parseJSON } from '../codegen.js';
import { insts2hex, getDrawTextOpt, getFillRectParams } from '../asm';
import { measureText } from '../text.js';
export const lskey = 'config/qfst';
export const defaultConfig = {
x: 533,
y: 150,
fontSize: 13,
fgRGB: 0xffffff,
fgA: 0xff,
fgRGB2: null,
fgA2: null,
bgRGB: 0x000000,
bgA: 0x40,
bgLeft: 4,
bgRight: 3,
bgTop: 4,
bgBot: 2,
};
export const getPreviewText = () => ` 0.426
0.427
0.428
1.515
3.117
39.000
9.999
11.111
22.222
33.333
44.444
55.555
66.666
77.777
88.888
99.999`;
/** @returns {typeof defaultConfig} */
export function getConfig() {
const config =
(typeof localStorage !== 'undefined' && parseJSON(localStorage.getItem(lskey))) || {};
return {
...defaultConfig,
...config,
text: getPreviewText(),
};
}
/**
* @param {keyof typeof import('../addrs.js').ctxSpOff} version
* @param {string=} baseCode
*/
export default function codegen(version, baseCode) {
if (!baseCode) return '';
const config = getConfig();
let code = baseCode;
code += '077F039C 0000002C';
code += insts2hex(getFillRectParams(config, measureText(getPreviewText(), version)));
code += insts2hex(getDrawTextOpt(config));
code += '2532642E 25303364 00000000'; // fmt = "%2d.%03d"
return code.replace(/\s/g, '');
}

View file

@ -0,0 +1,69 @@
<template>
<div>
<section class="appearance">
<h3>{{ l('h3.appearance') }}</h3>
<TextConfig v-model="textConfig" />
</section>
</div>
</template>
<script>
import { defaultConfig, lskey, getConfig, getPreviewText } from './codegen.js';
import { makeUpdateConfig, makeGetLabel } from '../utils';
import labels from '../labels.json';
import TextConfig from '../TextConfig.vue';
const updateConfig = makeUpdateConfig(lskey, defaultConfig, getPreviewText);
export default {
components: {
TextConfig,
},
props: {
version: { type: String },
},
methods: {
updateConfig,
},
data() {
const config = getConfig();
return {...config};
},
computed: {
l() {
return makeGetLabel(labels, this.$lang);
},
textConfig: {
get() {
return this;
},
set(value) {
Object.assign(this, value);
this.updateConfig();
},
},
},
};
</script>
<style scoped>
input[type='number'],
td.right {
text-align: right;
}
input[type='number'] {
width: 3em;
margin: 0 2px;
}
.appearance > div {
padding: 0 0 4px;
}
input[type='number'] {
-moz-appearance: textfield;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>

View file

@ -26,7 +26,7 @@
<script>
import { defaultConfig, lskey, getConfig, getPreviewText, codes, statusKeys } from './codegen.js';
import { makeUpdateConfig, rgbI2S, rgbS2I, rgbaI2S } from '../utils';
import { makeUpdateConfig } from '../utils';
import labels from './labels.json';
import TextConfig from '../TextConfig.vue';
@ -43,19 +43,7 @@ export default {
this.freeze[key] = $event.target.checked;
this.updateConfig();
},
toggleGradient($event) {
if ($event.target.checked) {
this.fgRGB2 = this.fgRGB;
this.fgA2 = this.fgA;
} else {
this.fgRGB2 = null;
this.fgA2 = null;
}
},
updateConfig,
rgbI2S,
rgbS2I,
rgbaI2S,
},
data() {
const config = getConfig();
@ -83,7 +71,6 @@ export default {
},
},
watch: {
width: updateConfig,
freezeDuration: updateConfig,
},
};

View file

@ -2,10 +2,12 @@ import InstantRestart from './InstantRestart/config.vue';
import CustomizedDisplay from './CustomizedDisplay/config.vue';
import PatternSelector from './PatternSelector/config.vue';
import qft from './qft/config.vue';
import qfst from './qfst/config.vue';
export default {
InstantRestart,
CustomizedDisplay,
PatternSelector,
qft,
qfst,
};