Support int32 and int16 for fields in CustomizedDisplay

This commit is contained in:
sup39 2023-02-07 16:29:10 +09:00
parent 3fa675ecea
commit 4d71083130
6 changed files with 14 additions and 9 deletions

View file

@ -4054,9 +4054,6 @@
::: warning
Shine Get Timer does not restart with this code.
:::
::: warning
Z menu will be disabled
:::
#### Instant Restart
- Press `B + D-Pad Up` to **restart the current area**
@ -4084,9 +4081,6 @@
::: warning
シャインゲットタイマーには未対応です。
:::
::: warning
Zメニューは無効化されます。
:::
#### ポーズせずにやり直し
- `B+十字キー上`で**現在のエリアをやり直す**

View file

@ -1,4 +1,8 @@
# Changelog
## Feb 07, 2023
### Updated 'Customized Display'
Support signed int32 and int16 for fields
## Feb 06, 2023
### Fixed 'Customized Display'
Fixed the hex value of multi-byte char in format string

View file

@ -86,7 +86,7 @@ export const fields = [
id: 'goop',
fmt: '%d',
preview: 600,
...makeFunctionLoader(32, (ver) => [
...makeFunctionLoader(-32, (ver) => [
{
type: 'call',
addr: addrs.getPollutionDegree[ver],

View file

@ -8,6 +8,8 @@ const dtype2fmtinfo = {
8: { prefix: 'hh', mask: 0xff },
16: { prefix: 'h', mask: 0xffff },
32: { prefix: '', mask: 0xffffffff },
[-16]: { prefix: 'h', mask: 0xffff },
[-32]: { prefix: '', mask: 0xffffffff },
};
/**
@ -58,7 +60,7 @@ export function parseFormat(input, version) {
ipvw &= mask;
const m = fmt2.trim().match(/^%?(\d*)h{,2}([dioxXu])$/);
padfmt = m?.[1] || '';
const t = m?.[2] || 'u';
const t = m?.[2] || (dtype > 0 ? 'u' : 'd');
fmt = `%${padfmt}${prefix}${t}`;
if ('di'.includes(t)) {
if (ipvw > mask >>> 1) ipvw -= mask;

View file

@ -12,7 +12,7 @@ export const fTmp = 12;
* @typedef {LoadDstReg|LoadDstStack} LoadDst
* @typedef {{
* asm(version: GameVersion, dst: LoadDst): ASMInst[]
* dtype: 8|16|32|'float'
* dtype: 8|16|-16|32|-32|'float'
* calling: boolean
* }} Loader
*/

View file

@ -123,6 +123,7 @@ export const ASM = {
// load rS, rA, D
lbz: makeInstD(34),
lhz: makeInstD(40),
lha: makeInstD(42),
lwz: makeInstD(32),
lfs: makeInstD(48),
lfd: makeInstD(50),
@ -161,12 +162,16 @@ export const $load = {
8: ASM.lbz,
16: ASM.lhz,
32: ASM.lwz,
[-16]: ASM.lha,
[-32]: ASM.lwz,
float: ASM.lfs,
};
export const $store = {
8: ASM.stb,
16: ASM.sth,
32: ASM.stw,
[-16]: ASM.sth,
[-32]: ASM.stw,
float: ASM.stfs,
double: ASM.stfd,
};