Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
vibration_test.h
Go to the documentation of this file.
1#ifndef SHOCKTST_H
2#define SHOCKTST_H
3
4/* SHOCKTST.PRO: the debug vibration test. It loads the vibration patterns
5 from the PC (DLSKDATA.TXT), writes them back as DLSKDATA.BIN, and lets the
6 patterns be edited and played on the controller's two motors. */
7
8#include "engine/game.h"
9
10/* The name of this overlay's copy of a function of src/shared/ */
11#define OVL_NAME(name) SHOCKTST_##name
12
13/* A file the editor loads when it starts and never reads (ShockTest.file);
14 the discs number their files differently */
15#if VERSION_US || VERSION_JP
16#define SHOCKTST_FILE 0xC5
17#elif VERSION_EU
18#define SHOCKTST_FILE 0xBE
19#endif
20
21/* DLSKDATA.BIN: a header, then the offsets are from its start */
22typedef struct ShockFile {
23 /* 0x0 */ s32 count; /* number of patterns */
24 /* 0x4 */ s32 typesOffset; /* s32 per pattern */
25 /* 0x8 */ s32 timesOffset; /* u8 per motor and pattern */
26 /* 0xC */ s32 powersOffset; /* u8 per motor and pattern */
27} ShockFile;
28
29/* The patterns loader: the scene's first task */
30typedef struct ShockLoader {
32 /* 0x50 */ ShockFile *file; /* DLSKDATA.BIN being built */
33 /* 0x54 */ u8 *text; /* DLSKDATA.TXT */
34 /* 0x58 */ s32 pad; /* never read or written: createTask allocates 0x5C bytes */
36
37typedef struct ShockLoaderWindows {
38 /* 0x0 */ TextWindow *title;
39 /* 0x4 */ TextWindow *help[2];
40 /* 0xC */ struct ShockTest *test;
42
43/* One step of a motor's pattern */
44typedef struct ShockStep {
45 /* 0x0 */ u8 time; /* frames */
46 /* 0x1 */ u8 power; /* the small motor is only on (1) or off (0) */
47} ShockStep;
48
49/* The pattern editor */
50typedef struct ShockTest {
52 /* 0x50 */ u8 *file; /* SHOCKTST_FILE, never read */
53 /* 0x54 */ s32 windowId;
54 /* 0x58 */ s32 column; /* the motor */
55 /* 0x5C */ s32 row; /* pattern, time, power, play */
56 /* 0x60 */ s32 playing; /* the pattern being played by "play all" */
57 /* 0x64 */ s32 timers[2];
58 /* 0x6C */ s32 motors[2]; /* 0: start, 1: vibrating, -1: done */
59 /* 0x74 */ s32 pattern;
60 /* 0x78 */ s32 count;
61 /* 0x7C */ ShockStep *steps[2];
62 /* 0x84 */ s32 pad; /* never read or written: createTask allocates 0x88 bytes */
63} ShockTest;
64
65/* The editor's text windows */
66typedef struct ShockTestWindows {
67 /* 0x00 */ TextWindow *pattern;
68 /* 0x04 */ TextWindow *pad; /* never read or written */
69 /* 0x08 */ TextWindow *motors[2];
70 /* 0x10 */ TextWindow *times[2];
71 /* 0x18 */ TextWindow *powers[2];
72 /* 0x20 */ TextWindow *play;
74
75/* One row of the editor's menu */
76typedef struct ShockTestRow {
77 /* 0x0 */ s32 enabled[2]; /* per column */
78 /* 0x8 */ s32 highlight[4]; /* per column: selected, then being edited */
80
84s32 SHOCKTST_editValue(ShockTest *task, ShockTestWindows *win, TextWindow **windows, u8 *value, u8 toggle);
91void SHOCKTST_updateScene(Task *task, Task **child);
92void SHOCKTST_highlight(ShockTest *task, ShockTestWindows *win, s32 highlight);
94void SHOCKTST_showPattern(ShockTest *task, ShockTestWindows *win, s32 pattern);
95void SHOCKTST_showTimers(ShockTest *task, ShockTestWindows *win, s32 pattern);
97
98extern const char SHOCKTST_STR_START_BACK[];
99
100#endif /* SHOCKTST_H */
signed int s32
Definition common.h:11
unsigned char u8
Definition common.h:8
#define TASK_HEADER(Type)
Definition task.h:39
DLSKDATA.BIN: a header, then the offsets are from its start.
s32 typesOffset
s32 per pattern
s32 count
number of patterns
s32 powersOffset
u8 per motor and pattern
s32 timesOffset
u8 per motor and pattern
TextWindow * help[2]
struct ShockTest * test
The patterns loader: the scene's first task.
s32 pad
never read or written: createTask allocates 0x5C bytes
ShockFile * file
DLSKDATA.BIN being built.
u8 * text
DLSKDATA.TXT.
One step of a motor's pattern.
u8 power
the small motor is only on (1) or off (0)
u8 time
frames
One row of the editor's menu.
s32 highlight[4]
per column: selected, then being edited
s32 enabled[2]
per column
The editor's text windows.
TextWindow * times[2]
TextWindow * pad
never read or written
TextWindow * powers[2]
TextWindow * motors[2]
TextWindow * play
TextWindow * pattern
The pattern editor.
s32 playing
the pattern being played by "play all"
s32 pad
never read or written: createTask allocates 0x88 bytes
u8 * file
SHOCKTST_FILE, never read.
s32 row
pattern, time, power, play
s32 timers[2]
s32 motors[2]
0: start, 1: vibrating, -1: done
s32 column
the motor
ShockStep * steps[2]
Any task, seen through its header.
Definition task.h:62
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
Definition text.h:131
void SHOCKTST_loadPatterns(ShockTest *task, ShockFile *file)
Copies the pattern file's times and powers into the editor.
s32 SHOCKTST_editValue(ShockTest *task, ShockTestWindows *win, TextWindow **windows, u8 *value, u8 toggle)
Changes a time or power with up and down (by 10 when repeating), or flips it between 0 and 1 when tog...
void SHOCKTST_convertText(ShockLoader *task)
Turns DLSKDATA.TXT (the count, then a tab-separated row per pattern, of which type 1 holds the motors...
const char SHOCKTST_STR_START_BACK[]
"START:もどる" (START: back), padded to a word: the USA file's padding isn't zeros but what the assemble...
void SHOCKTST_showPattern(ShockTest *task, ShockTestWindows *win, s32 pattern)
Shows a pattern's number and each motor's time and power.
void SHOCKTST_updateScene(Task *task, Task **child)
Task * SHOCKTST_createLoader(void)
Creates the loader.
s32 SHOCKTST_moveCursor(ShockTest *task, ShockTestWindows *win)
Moves the editor's cursor over its rows and columns, skipping the empty ones: 1 when cross picks a va...
void SHOCKTST_updateLoader(ShockLoader *task, ShockLoaderWindows *win)
The loader's task: creates the title and help windows, reads DLSKDATA.TXT from the PC and starts the ...
s32 SHOCKTST_editRow(ShockTest *task, ShockTestWindows *win)
Edits what the cursor picked: the pattern, or a motor's time or power (the small motor's is only on o...
s32 SHOCKTST_playPattern(ShockTest *task, ShockTestWindows *win, s32 pattern)
Plays a pattern on both motors, one frame on: 1 once both have stopped or triangle stops them.
void SHOCKTST_showTimers(ShockTest *task, ShockTestWindows *win, s32 pattern)
Shows each motor's power and the time it has left.
ShockTest * SHOCKTST_createEditor(s32 count)
Creates the editor, with room for count patterns.
void SHOCKTST_updateEditor(ShockTest *task, ShockTestWindows *win)
The editor's task: creates its windows, then edits and plays the patterns (play with L1 held plays th...
s32 SHOCKTST_selectPattern(ShockTest *task, ShockTestWindows *win)
Picks the pattern with up and down: 1 on cross, -1 on triangle.
s32 SHOCKTST_playAllPatterns(ShockTest *task, ShockTestWindows *win)
Plays the patterns from task->playing to task->count in turn, the next one once a pattern ends or bot...
void SHOCKTST_highlight(ShockTest *task, ShockTestWindows *win, s32 highlight)
Colors the editor's windows: palette 3 for the one under the cursor (highlight 1-5 and 10),...