4 {{1, 0}, {1, 0, 0, 0}},
5 {{1, 1}, {2, 3, 6, 7}},
6 {{1, 1}, {4, 5, 8, 9}},
7 {{1, 0}, {10, 0, 11, 0}},
14 "\xC3\xB1\xE8\xE3\x01\x07\x02\x05\x01",
15 "\xC7\xDE\xE8\xD2\x01\x07\x02\x05\x01",
16 "\x65\x89\x56\x01\x07\x02\x05\x01",
19#define SCENE_TASK Task
20#define SCENE_CHILD Task
21#define SCENE_CREATE OVL_NAME(createLoader)
22#define SCENE_PRIM_BUFFERS 0x5000
23#define SCENE_OT_SHIFT 1
33 for (i = 0; i < 2; i++) {
105 for (i = 0; i < 2; i++) {
115 for (i = 0; i < 2; i++) {
126 for (i = 0; i < 2; i++) {
127 if (task->
motors[i] == 0) {
137 }
else if (task->
motors[i] == 1) {
138 if (--task->
timers[i] < 0) {
146 for (i = 0; i < 2; i++) {
193 if (++task->
column >= 2) {
200 if (--task->
row < 0) {
206 if (++task->
row >= 4) {
213 if (task->
row == 3) {
269 if (task->
step != 0) {
283 "\x82\xB1\x82\xA4\x82\xBB\x82\xAD",
284 "\x82\xC4\x82\xA2\x82\xBB\x82\xAD",
294 switch (task->
state) {
303 for (i = 0; i < 2; i++) {
314 win->
play->
setText(win->
play,
"\x83\x70\x83\x5E\x81\x5B\x83\x93\x82\xB6\x82\xC1\x82\xB1\x82\xA4");
366 for (motor = 0; motor < 2; motor++) {
380 for (i = 0; i < task->
count; i++) {
430 *header = header[-1] + count * 4;
432 *header = header[-1] + count * 2;
441 times = t += ((
ShockFile *)t)->timesOffset;
442 powers = p += ((
ShockFile *)p)->powersOffset;
460 for (i = 0; i < 4; i++) {
464 while (*s ==
'\t' || *s ==
'\n') {
486 fd =
open(
"sim:C:\\DEVELOP\\DLSKDATA.BIN", 0x200);
499 switch (task->
state) {
504 win->
title->
setText(win->
title,
"\x82\xB5\x82\xF1\x82\xC7\x82\xA4\x83\x65\x83\x58\x83\x67");
506 win->
help[0]->
setText(win->
help[0],
"\x81\x7E\x81\x46\x82\xB6\x82\xC1\x82\xB1\x82\xA4\x82\xC4\x82\xA2\x82\xB5");
559 "\x82\x72\x82\x73\x82\x60\x82\x71\x82\x73\x81\x46\x82\xE0\x82\xC7\x82\xE9\0\x03";
560#elif VERSION_EU || VERSION_JP
561 "\x82\x72\x82\x73\x82\x60\x82\x71\x82\x73\x81\x46\x82\xE0\x82\xC7\x82\xE9\0\0";
GameState GAME
The save data, the game mode and the methods.
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
FileCache FILE_CACHE
The file cache.
int strcspn(u8 *s, char *reject)
long read(long fd, void *buf, long n)
long write(long fd, void *buf, long n)
int atoi(u8 *s)
stdlib.h's; SHOCKTST parses its text file with these two
long open(char *name, unsigned long mode)
The kernel's file functions (libapi.h); the sim: device is the PC's.
#define MODE_STAGE_SELECT
STAGSLCT, the debug stage select.
#define SCREEN_LAYER
The layer over the whole screen that most modes create first and draw their menus on (FIELDSTG and ST...
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
MemCardFuncs MEMCARD_FUNCS
PadState PAD
Controller input: cleared by initPad, then the methods.
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
#define PAD_REPEATED(button)
void(* requestMode)(s32 mode, s32 arg)
void *(* allocZeroed)(s32 size, s32 tag)
s32(* setVibration)(u16 port, s32 motor, s16 time, u8 value)
DLSKDATA.BIN: a header, then the offsets are from its start.
s32 count
number of patterns
s32 powersOffset
u8 per motor and pattern
s32 timesOffset
u8 per motor and pattern
The patterns loader: the scene's first task.
ShockFile * file
DLSKDATA.BIN being built.
void(* setState)(struct ShockLoader *task, s32 state)
void(* nextState)(struct ShockLoader *task)
One step of a motor's pattern.
u8 power
the small motor is only on (1) or off (0)
One row of the editor's menu.
s32 highlight[4]
per column: selected, then being edited
The editor's text windows.
s32 playing
the pattern being played by "play all"
u8 * file
SHOCKTST_FILE, never read.
s32 row
pattern, time, power, play
s32 motors[2]
0: start, 1: vibrating, -1: done
void(* nextState)(struct ShockTest *task)
void(* setSubstate)(struct ShockTest *task, s32 substate)
void(* nextSubstate)(struct ShockTest *task)
Any task, seen through its header.
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
void(* setPalette)(struct TextWindow *obj, u8 arg)
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
#define PALETTE_BLUE
a light blue: what is highlighted or current
#define PALETTE_WHITE
The text windows' palettes (TextWindow.palette, setPalette): rows of the font's CLUTs,...
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)
void SHOCKTST_loadPatterns(ShockTest *task, ShockFile *file)
Copies the pattern file's times and powers into the editor.
const char SHOCKTST_STR_START_BACK[20]
"START:もどる" (START: back), padded to a word: the USA file's padding isn't zeros but what the assemble...
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...
char * SHOCKTST_motorNames[2]
The names of the motors: "こうそく" (fast) and "ていそく" (slow)
void SHOCKTST_showPattern(ShockTest *task, ShockTestWindows *win, s32 pattern)
Shows a pattern's number and each motor's time and power.
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.
char SHOCKTST_numberFormats[3][0x40]
The strings of the pattern, time and power windows (setString), in font codes: the label,...
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...
ShockTestRow SHOCKTST_menuRows[4]
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),...
SHOCKTST.PRO: the debug vibration test.
#define SHOCKTST_FILE
A file the editor loads when it starts and never reads (ShockTest.file); the discs number their files...