====== Paper Mario Dialog System ====== Paper Mario uses a mix of bytecode and encoded text for its written dialog. ===== Dialog Banks ===== The US and Japanese NTSC ROMs each use a single dialog bank while the PAL ROM uses four banks for English, German, French, and Spanish. Each bank is roughly 1MB in size. ==== Bank Locations ==== === NTSC US === ^ Address ^ Size ^ Language ^ | 01B83000 | 00101D30 | English | === NTSC J === ^ Address ^ Size ^ Language ^ | 01D40000 | (TODO) | Japanese | === PAL === ^ Address ^ Size ^ Language ^ | 02030000 | (TODO) | English | | 021B0000 | (TODO) | German | | 02330000 | (TODO) | French | | 024B0000 | (TODO) | Spanish | ==== Bank Structure ==== 1. Header 2. Sections 2a. Sequences 2b. Sequence Offsets === 1. Header === The header is a zero-terminated list of 32-bit offsets pointing to each section's Sequence Offsets (2b). All offsets are relative to the start of the dialog bank. === 2. Sections === Each section contains dialog data for a given area of the game. They are aligned to 16-byte boundaries in the original ROMs. === 2a. Sequences === Sequences consist of text with a custom encoding mixed in with some basic bytecode that controls attributes such as style, color, and timing. In the original ROMs, each sequence is aligned to a 4 byte boundary. === 2b. Sequence Offsets === This is a list of start and end offset pairs that reference each sequence within the section. Start and end offsets are overlapped. The list is terminated when an end offset points to the beginning of the list. ===== US & PAL Sequence Encoding ===== The NTSC-US and PAL ROMs share the same encoding for their dialog sequences. (Note: Names like "CHR_MUSIC_NOTE" are derived from [[http://hocuspocus.taloncrossing.com/rii/pmdiag/pm1docs.txt|this document]] or made up for documentation purposes). ^ Character(s) ^ Value ^ Params ^ Description ^ | CHR_MUSIC_NOTE | 0x00 | - | | | (! to /) | 0x01 to 0x0F | - | | | (0 to 9) | 0x10 to 0x19 | - | | | : | 0x1A | - | | | ; | 0x1B | - | | | < | 0x1C | - | | | = | 0x1D | - | | | > | 0x1E | - | | | ? | 0x1F | - | | | @ | 0x20 | - | | | (A to Z) | 0x21 to 0x3A | - | | | ( | 0x3B | - | | | ¥ | 0x3C | - | | | ) | 0x3D | - | | | %%^%% | 0x3E | - | | | _ | 0x3F | - | | | ` | 0x40 | - | | | (a to z) | 0x41 to 0x5A | - | | | { | 0x5B | - | | | %%|%% | 0x5C | - | | | } | 0x5D | - | | | ~ | 0x5E | - | | | ° | 0x5F | - | | | À | 0x60 | - | | | Á | 0x61 | - | | | Â | 0x62 | - | | | Ä | 0x63 | - | | | Ç | 0x64 | - | | | È | 0x65 | - | | | É | 0x66 | - | | | Ê | 0x67 | - | | | Ë | 0x68 | - | | | Ì | 0x69 | - | | | Í | 0x6A | - | | | Î | 0x6B | - | | | Ï | 0x6C | - | | | Ñ | 0x6D | - | | | Ò | 0x6E | - | | | Ó | 0x6F | - | | | Ô | 0x70 | - | | | Ö | 0x71 | - | | | Ù | 0x72 | - | | | Ú | 0x73 | - | | | Û | 0x74 | - | | | Ü | 0x75 | - | | | ß | 0x76 | - | | | à | 0x77 | - | | | á | 0x78 | - | | | â | 0x79 | - | | | ä | 0x7A | - | | | ç | 0x7B | - | | | è | 0x7C | - | | | é | 0x7D | - | | | ê | 0x7E | - | | | ë | 0x7F | - | | | ì | 0x80 | - | | | í | 0x81 | - | | | î | 0x82 | - | | | ï | 0x83 | - | | | ñ | 0x84 | - | | | ò | 0x85 | - | | | ó | 0x86 | - | | | ô | 0x87 | - | | | ö | 0x88 | - | | | ù | 0x89 | - | | | ú | 0x8A | - | | | û | 0x8B | - | | | ü | 0x8C | - | | | ¡ | 0x8D | - | | | ¿ | 0x8E | - | | | ª | 0x8F | - | | | CHR_HEART | 0x90 | - | | | CHR_STAR | 0x91 | - | | | CHR_UP_ARROW | 0x92 | - | | | CHR_DN_ARROW | 0x93 | - | | | CHR_LT_ARROW | 0x94 | - | | | CHR_RT_ARROW | 0x95 | - | | | CHR_O_NOUGHT | 0x96 | - | | | CHR_X_CROSS | 0x97 | - | | | CHR_A_BUTTON | 0x98 | - | | | CHR_B_BUTTON | 0x99 | - | | | CHR_L_BUTTON | 0x9A | - | | | CHR_R_BUTTON | 0x9B | - | | | CHR_Z_BUTTON | 0x9C | - | | | CHR_C_UP_BUTTON | 0x9D | - | | | CHR_C_DN_BUTTON | 0x9E | - | | | CHR_C_LT_BUTTON | 0x9F | - | | | CHR_C_RT_BUTTON | 0xA0 | - | | | CHR_START_BUTTON | 0xA1 | - | | | CHR_NULL_0 | 0xA2 | - | | | CHR_NULL_1 | 0xA3 | - | | | CHR_NULL_2 | 0xA4 | - | | | CHR_NULL_3 | 0xA5 | - | | | CHR_NULL_4 | 0xA6 | - | | | CHR_TAB_16 | 0xA8 | - | | | CHR_TAB_6 | 0xA9 | - | | | CHR_LINE_BREAK | 0xF0 | - | | | CHR_BELL | 0xF1 | - | Makes a bell sound and waits for player input | | CHR_DELAY | 0xF2 | yes | Pauses the dialog sequence for specified number of frames | | (Space) | 0xF7 | - | | | CHR_NEXT_BUBBLE | 0xFB | - | Advances to the next bubble in the dialog sequence | | CHR_STYLE | 0xFC | yes | Sets the style of the dialog box | | CHR_END | 0xFD | - | Ends the dialog sequence | | CHR_CMD | 0xFF | yes | Executes an advanced command | ===== Japanese Sequence Encoding ===== TODO: desu desu ==== CHR_DELAY (F2) ==== Pauses the dialog sequence for a specified number of frames. F1 [NN] NN = Number of frames ==== CHR_STYLE (FC) ==== Sets the visual style of the dialog specified by a [[#styles|Style ID]]. Additional arguments may be required depending the style. FC [SS] SS = Style ID ==== CHR_CMD (FF) ==== Runs an advanced command specified by a [[#commands|Command ID]]. Additional arguments may be required depending on the command. FF [CC] CC = Command ID ===== Styles ===== The following IDs are used with the CHR_STYLE special character. ^ Style ^ Value ^ Params ^ | STYLE_INVALID | 0x00 | - | | STYLE_BUBBLE_RIGHT | 0x01 | - | | STYLE_BUBBLE_LEFT | 0x02 | - | | STYLE_BUBBLE_A | 0x03 | - | | STYLE_BUBBLE_B | 0x04 | - | | STYLE_WHITE_BORDER | 0x05 | 4 | | STYLE_NARRATION_A | 0x06 | - | | STYLE_SIGN_POST | 0x07 | - | | STYLE_BLUE_MESSAGE | 0x08 | 1 | | STYLE_INVALID_2 | 0x09 | - | | STYLE_WHITE_BUBBLE_A | 0x0A | - | | STYLE_WHITE_BUBBLE_B | 0x0B | - | | STYLE_NO_DISPLAY | 0x0C | - | | STYLE_NARRATION_SILENT | 0x0D | - | | STYLE_NO_DISPLAY_V_CENTER | 0x0E | - | | STYLE_NARRATION_B | 0x0F | - | ==== STYLE_WHITE_BORDER (05) ==== FC 05 [XX] [YY] [WW] [HH] XX = X position from left YY = Y position from top WW = Width HH = Height ==== STYLE_BLUE_MESSAGE (08) ==== FC 08 [HH] HH = Height (0x40 = Normal height) ===== Commands ===== The following IDs are used with the CHR_CMD special character. ^ Command ^ Value ^ Params ^ | CMD_UNK_00 | 0x00 | ? | | CMD_UNK_04 | 0x04 | - | | CMD_TEXT_COLOR | 0x05 | 1 | | CMD_UNK_07 | 0x07 | - | | CMD_UNK_08 | 0x08 | - | | CMD_PRINT_INSTANT | 0x09 | - | | CMD_CANCEL_WRITING | 0x0A | - | | CMD_FONT_KERNING | 0x0B | 1 | | CMD_AUTO_SCROLL | 0x0C | 1 | | CMD_FONT_SIZE | 0x0D | 2 | | CMD_FONT_SIZE_RESET | 0x0E | - | | CMD_PRINT_SPEED | 0x0F | 2 | | CMD_MARGIN | 0x10 | 2 | | CMD_UNK_11 | 0x11 | 1 | | CMD_UNK_12 | 0x12 | 1 | | CMD_UNK_13 | 0x13 | 1 | | CMD_UNK_14 | 0x14 | 1 | | CMD_GRAPHIC_A | 0x15 | 1 | | CMD_ICON | 0x17 | 2 | | CMD_GRAPHIC_B | 0x18 | 7 | | CMD_UNK_1A | 0x1A | 8 | | CMD_UNK_1B | 0x1B | 7 | | CMD_UNK_1E | 0x1E | 1 | | CMD_UNK_1F | 0x1F | 1 | | CMD_UNK_20 | 0x20 | 1 | | CMD_UNK_21 | 0x21 | 1 | | CMD_UNK_22 | 0x21 | - | | CMD_UNK_23 | 0x23 | - | | CMD_SAVE_TEXT_COLOR | 0x24 | - | | CMD_LOAD_TEXT_COLOR | 0x25 | - | | CMD_START_EFFECT | 0x26 | 1 | | CMD_CANCEL_EFFECT | 0x27 | 1 | | CMD_UNK_28 | 0x28 | 1 | | CMD_UNK_29 | 0x29 | 1 | | CMD_UNK_2B | 0x2B | - | | CMD_VOLUME | 0x2E | 1 | | CMD_VOICE | 0x2F | 1 | === TODO params === === TODO asm checks needed: === * 1e through 21 selection related * 01, 02, 03 unused ? * 06 unused ? * 16 possibly unused * 19 unused? * 1c possibly unused * 2a unused? * 2C, 2d unused ? ===== Effects ===== The following IDs are used with the CMD_START_EFFECT and CMD_CANCEL_EFFECT commands. ^ Effect ^ Value ^ Params ^ | EFFECT_JITTER | 0x00 | - | | EFFECT_WAVE | 0x01 | - | | EFFECT_DARK_STATIC | 0x02 | - | | EFFECT_LIGHT_STATIC | 0x03 | 1 | | EFFECT_UNKNOWN | 0x04 | - | | EFFECT_GHOST_JITTER | 0x05 | 1 | | EFFECT_CHASING_RAINBOW_A | 0x06 | - | | EFFECT_GRAYED_OUT | 0x07 | 1 | | EFFECT_WAVE_B | 0x08 | - | | EFFECT_CHASING_RAINBOW_B | 0x09 | - | | EFFECT_SHRINK_PLACEMENT | 0x0A | - | | EFFECT_GROWTH_PLACEMENT | 0x0B | - | | EFFECT_SIZE_JITTER | 0x0C | - | | EFFECT_SIZE_WAVE | 0x0D | - | | EFFECT_DROP_SHADOW | 0x0E | - | ===== Colors ===== TODO color IDs and an image or two ====== References ====== * http://hocuspocus.taloncrossing.com/rii/pmdiag/pm1docs.txt ([[http://archive.is/WkXKB|archived]])