mirror of
https://github.com/HackerN64/HackerOoT.git
synced 2026-01-21 10:37:37 -08:00
* Improve rcp.h, remove `HW_REG` macro (#1425) * Real rcp.h * Correction to comment in initialize.c * Try fix R4300.h * Adjust rcp.h formatting, remove defines in other headers that are now in rcp.h * Suggested changes, document a bug in the modified osAiSetNextBuffer * More rcp.h formatting changes * Fix misc 18 (#1423) * two more ABS * fixup item_name_static texs outnames * fixup CollisionCheck_SetOCvsOC docs * Cleanup int comments alignments * collsion -> collision * `SQ*` macros fixup * use `LERP` more * static -> `s` prefix * grammar: dont -> don't * 3 * Improvements to Video Interface related functions and data (#1332) * Improvements to VI related functions * Fix * Suggested changes * Comment enum values Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Suggested changes, plus comments in visetspecial.c * Name gViConfigModeType * Further suggested changes * Format * Fix comment on modeLPN2 Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * TwoHeadArena and TwoHeadGfxArena docs (#1349) * TwoHeadArena and TwoHeadGfxArena docs, ALIGNOF macro * AllocStart -> AllocHead , AllocEnd -> AllocTail * Format * Suggested changes * Fix * Further suggested changes * z_en_horse_zelda doc (#1430) * z_en_horse_zelda doc Zelda's horse has been better documented. Horse seemed to follow a path around Hyrule Field * `z_en_horse_zelda` revised based on feedback * Update z_en_horse_zelda.c EnHorseZelda_ResetAnimation -> EnHorseZelda_SetupStop * z_horse_zelda: changes based on feedback * Mempak doc (#1382) * Mempak doc * Format * Suggested changes * Further changes * Update item names (#1376) * Reevaluate item names (`ItemID` enum) * format * Carry `ItemID` changes to `ExchangeItemID` * format * Add item enum comments on items to slots array * Rename slots according to current item enum names * Add item enum comments on items to PlayerItemAction array * Rename PlayerItemAction enum names according to current item enum names * gi, gid names... * `QUEST_GERUDO_CARD` -> `QUEST_GERUDOS_CARD` * `DUNGEON_KEY_BOSS` -> `DUNGEON_BOSS_KEY` * `UPG_` sticks/nuts : +deku * Fixed remove array enum comments in `sDebugSaveEquips` * "magic beans" -> "magic bean" (singular) * cucco -> chicken (the one from weird egg, "alarm clock bird" from literal japanese translation) * Document Timers (#1412) * Document Timers, First Draft * some progress * more timer docs * cleanup * small cleanup * more cleanup * comments * more cleanup * extra comment * more docs * brackets * PR Suggestions * cleanup, missed some * more suggestions * more PR Suggestions * small change * environmental * More documentation for `z_std_dma.c` (#1415) * More documentation for z_std_dma * uintptr casts for rom symbols in z64animation.h and z_kanfont.c * Format * Suggested changes, more defines for static texture sizes * PI Interface -> PI * Further suggested changes * Format * Comments about item_name and map_name texture assumptions * `z_en_bird` doc (#1431) * `z_en_bird` doc Documented `z_en_bird` * `Z_en_bird` changes from feedback * Update z_en_bird.c * `z_en_bird`: suggested changes * `z_en_bird`: changes based on feedback animation speed mod field changed, redundant comments removed. * z_shot_sun: minor doc (#1429) * z_shot_sun: minor doc document one field and function remaining in z_shot_sun * z_shot_sun: updated state doc'ing * Update z_shot_sun.c format enum * ran format.py * `z_shot_sun`: changes based on feedback gave enum better name, removed redundant comment. * Update z_shot_sun.c enum changed. * `z_obj_lift`: doc remaining funcs and field (#1440) * `z_obj_lift`: doc funcs and field doc remaining funcs and field in `z_obj_lift` * `z_obj_lift`: shakeVec->shakeOrientation * removed space from copy-paste of field name * Small `Actor_UpdateAll` doc (#1432) * Small `Actor_UpdateAll` doc * improve, "freeze" * rename "freeze category masks" * shorten to "category freeze mask" everywhere * Doc object_rs (#1439) * Document En_Ko Animations (#1306) * Document Kokiri Children animations * Remove BOY, GIRL, and FADO prefixes * Formatting * Further prefix removal * more fixups Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Document Hud Mode (#1323) * begin interface alpha docs * more progress/docs * First draft of docs done * cleanup * Consistency * Display -> Mode * Remaining display -> mode * Better docs * Small touchups * Small Update * Apply discord discussion * small fix * More discussions * PR Suggestions * Roman PR Suggestions * better comments * PR Suggestions * another suggestion * discord discussions * cleanup comments * more discord/pr suggestions * Document NPC talking and player tracking (#1426) * Rename npc dialog state variable * Rename and doc NPC actor talking funtion * Introduce NpcTalkState enum * Rename NPC_TALK_STATE enum values * Document NpcPlayerInteractionState and related functions * Rename player tracking opt enum variants * Rename npc functions, interact info * Minor npc actor function tweaks * Minor comment fixes for npc * Generalize NPC player tracking to point tracking * Change unused NpcInteractInfo field type and name Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Rename headRot and torsoRot * Rename GetTalkState to UpdateTalkState * Minor comment fixes * Rename rotateActorShape and clarify related comments * Remove unneeded parentheses in z_en_heishi4.c * Reformat * Remove unclear comment * Rename yPosOffset to yOffset Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Player doc: Temporary `PLAYER_ANIMGROUP` names from original animation names (#1446) * Name `PLAYER_ANIMGROUP_` based on original names * format * add comment indicating source of names * Document HREG debugging system (#1351) * progress * progress * change * named most * name prerender things * fix and format * play prefix * address most comments (still a few more things to do) * fix error * reword input test comments * some more * rework env draw flags * add hilite * merge and format * init to proper values * rename env draw flag names * 7 to 6 * more small changes * Name scenes (scene enum, entrance enum, various identifiers) (#1343) * Comment names on titled scenes * Comment some more scene names * Comment some map assets symbol prefixes * Name collapse sequence scenes (from the non-collapse equivalent scene's name + `_COLLAPSE`) * Name ganon/ganondorf boss scenes (symbol prefix suffixed with `Scene` to prevent confusion with boss actors) * Fix symbol prefix for back alley night scene * Name the two grave scenes (normal and fairy's fountain variant) * Name most houses, name/update misc scenes Co-authored-by: fig02 <fig02srl@gmail.com> * (hakaana) `GRAVE` -> `REDEAD_GRAVE` to be more specific Co-authored-by: fig02 <fig02srl@gmail.com> * `miharigoya_scene`: `market_guard_house` * `kakariko_scene` -> `kakariko_center_house` * `richards_house` -> `dog_lady_house` (for localization differences) * Revert "Comment some map assets symbol prefixes" This reverts commit 210a38a6288d5d2fa318059f31988ca7ceb5c708. * remove other xml prefixes * ganon_boss, ganondorf_boss * comments to namefixer * `KAKARIKO_CENTER_HOUSE` -> `KAKARIKO_CENTER_GUEST_HOUSE` * two collapse sequence scenes -> `GANONS_TOWER_COLLAPSE_`interior/exterior * Run namefixer `find src include -type f -exec ./tools/namefixer.py {} \;` * run formatter Co-authored-by: fig02 <fig02srl@gmail.com> * Add skybox .h and cleanup, `SkyboxDraw_` -> `Skybox_` (#1435) * Add skybox .h and cleanup * move forward declared structs to top of file * `SkyboxDraw_` -> `Skybox_` * format * move more forward declared structs to top of file * Document Surface Material (#1447) * material * cleanup * iron boots * climb * more docs * rename * small fix * comments * adjust bug comment * simplify comment * Document Camera for Elevator Platforms (Camera_Special7) (#1448) * document camera for vertical platforms * cleanup * another rename * small * another rename * add comment * PR Suggestions * more cleanup * oops * adjust comment * Skelanime/Animation header cleanup (#1434) * Skelanime/Animation header cleanup * touch up names of the two existing moveFlags macros * formatter is a dum dum D: * fixed z_select.h changes * fixed config entrance name Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: blackgamma7 <blackgamma7@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: Charles Averill <46544495+CharlesAverill@users.noreply.github.com> Co-authored-by: Lauri Koskela <luryus@users.noreply.github.com> Co-authored-by: fig02 <fig02srl@gmail.com>
195 lines
5.2 KiB
C
195 lines
5.2 KiB
C
#ifndef ULTRA64_CONTROLLER_H
|
|
#define ULTRA64_CONTROLLER_H
|
|
|
|
#include "message.h"
|
|
|
|
#define CHNL_ERR(readFormat) (((readFormat).rxsize & CHNL_ERR_MASK) >> 4)
|
|
|
|
#define BLOCKSIZE 32
|
|
#define MAXCONTROLLERS 4
|
|
#define PFS_ONE_PAGE 8
|
|
|
|
#define PFS_PAGE_SIZE (BLOCKSIZE*PFS_ONE_PAGE)
|
|
|
|
#define CONT_CMD_REQUEST_STATUS 0
|
|
#define CONT_CMD_READ_BUTTON 1
|
|
#define CONT_CMD_READ_MEMPACK 2
|
|
#define CONT_CMD_WRITE_MEMPACK 3
|
|
#define CONT_CMD_READ_EEPROM 4
|
|
#define CONT_CMD_WRITE_EEPROM 5
|
|
#define CONT_CMD_RESET 0xFF
|
|
|
|
#define CONT_CMD_REQUEST_STATUS_TX 1
|
|
#define CONT_CMD_READ_BUTTON_TX 1
|
|
#define CONT_CMD_READ_MEMPACK_TX 3
|
|
#define CONT_CMD_WRITE_MEMPACK_TX 35
|
|
#define CONT_CMD_READ_EEPROM_TX 2
|
|
#define CONT_CMD_WRITE_EEPROM_TX 10
|
|
#define CONT_CMD_RESET_TX 1
|
|
|
|
#define CONT_CMD_REQUEST_STATUS_RX 3
|
|
#define CONT_CMD_READ_BUTTON_RX 4
|
|
#define CONT_CMD_READ_MEMPACK_RX 33
|
|
#define CONT_CMD_WRITE_MEMPACK_RX 1
|
|
#define CONT_CMD_READ_EEPROM_RX 8
|
|
#define CONT_CMD_WRITE_EEPROM_RX 1
|
|
#define CONT_CMD_RESET_RX 3
|
|
|
|
#define CONT_CMD_NOP 0xFF
|
|
#define CONT_CMD_END 0xFE // Indicates end of a command
|
|
#define CONT_CMD_EXE 1 // Set pif ram status byte to this to do a command
|
|
#define CONT_CMD_SKIP_CHNL 0 // Skip channel
|
|
|
|
#define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */
|
|
#define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */
|
|
#define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */
|
|
#define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */
|
|
#define CONT_ERR_NOT_READY 12
|
|
#define CONT_ERR_VOICE_MEMORY 13
|
|
#define CONT_ERR_VOICE_WORD 14
|
|
#define CONT_ERR_VOICE_NO_RESPONSE 15
|
|
|
|
|
|
#define DIR_STATUS_EMPTY 0
|
|
#define DIR_STATUS_UNKNOWN 1
|
|
#define DIR_STATUS_OCCUPIED 2
|
|
|
|
#define PFS_FORCE 1
|
|
#define PFS_DELETE 1
|
|
|
|
#define PFS_LABEL_AREA 7
|
|
|
|
#define PFS_ERR_NOPACK 1
|
|
|
|
/* controller errors */
|
|
#define CONT_NO_RESPONSE_ERROR 0x8
|
|
#define CONT_OVERRUN_ERROR 0x4
|
|
|
|
/* Controller type */
|
|
#define CONT_ABSOLUTE 0x0001
|
|
#define CONT_RELATIVE 0x0002
|
|
#define CONT_JOYPORT 0x0004
|
|
#define CONT_EEPROM 0x8000
|
|
#define CONT_EEP16K 0x4000
|
|
#define CONT_TYPE_MASK 0x1F07
|
|
#define CONT_TYPE_NORMAL 0x0005
|
|
#define CONT_TYPE_MOUSE 0x0002
|
|
#define CONT_TYPE_VOICE 0x0100
|
|
|
|
/* Controller status */
|
|
#define CONT_CARD_ON 0x01
|
|
#define CONT_CARD_PULL 0x02
|
|
#define CONT_ADDR_CRC_ER 0x04
|
|
#define CONT_EEPROM_BUSY 0x80
|
|
|
|
/* Accessory detection */
|
|
#define CONT_ADDR_DETECT 0x8000
|
|
|
|
// Rumble
|
|
#define CONT_ADDR_RUMBLE 0xC000
|
|
|
|
// Controller Pak / Transfer Pak
|
|
#define CONT_ADDR_GB_POWER 0x8000 // Same as the detection address, but semantically different
|
|
#define CONT_ADDR_GB_BANK 0xA000
|
|
#define CONT_ADDR_GB_STATUS 0xB000
|
|
|
|
// Addresses sent to controller accessories are in blocks, not bytes
|
|
#define CONT_BLOCKS(x) ((x) / BLOCKSIZE)
|
|
|
|
// Block addresses of the above
|
|
#define CONT_BLOCK_DETECT CONT_BLOCKS(CONT_ADDR_DETECT)
|
|
#define CONT_BLOCK_RUMBLE CONT_BLOCKS(CONT_ADDR_RUMBLE)
|
|
#define CONT_BLOCK_GB_POWER CONT_BLOCKS(CONT_ADDR_GB_POWER)
|
|
#define CONT_BLOCK_GB_BANK CONT_BLOCKS(CONT_ADDR_GB_BANK)
|
|
#define CONT_BLOCK_GB_STATUS CONT_BLOCKS(CONT_ADDR_GB_STATUS)
|
|
|
|
/* Buttons */
|
|
#define BTN_CRIGHT 0x0001
|
|
#define BTN_CLEFT 0x0002
|
|
#define BTN_CDOWN 0x0004
|
|
#define BTN_CUP 0x0008
|
|
#define BTN_R 0x0010
|
|
#define BTN_L 0x0020
|
|
#define BTN_DRIGHT 0x0100
|
|
#define BTN_DLEFT 0x0200
|
|
#define BTN_DDOWN 0x0400
|
|
#define BTN_DUP 0x0800
|
|
#define BTN_START 0x1000
|
|
#define BTN_Z 0x2000
|
|
#define BTN_B 0x4000
|
|
#define BTN_A 0x8000
|
|
|
|
typedef union {
|
|
struct {
|
|
/* 0x00 */ u32 ram[15];
|
|
/* 0x3C */ u32 status;
|
|
};
|
|
u64 force_structure_alignment;
|
|
} OSPifRam; // size = 0x40
|
|
|
|
typedef struct {
|
|
/* 0x00 */ u16 type;
|
|
/* 0x02 */ u8 status;
|
|
/* 0x03 */ u8 errno;
|
|
} OSContStatus; // size = 0x04
|
|
|
|
typedef struct {
|
|
/* 0x00 */ u16 button;
|
|
/* 0x02 */ s8 stick_x;
|
|
/* 0x03 */ s8 stick_y;
|
|
/* 0x04 */ u8 errno;
|
|
} OSContPad; // size = 0x06
|
|
|
|
typedef struct {
|
|
/* 0x00 */ void* address;
|
|
/* 0x04 */ u8 databuffer[32];
|
|
/* 0x24 */ u8 addressCrc;
|
|
/* 0x25 */ u8 dataCrc;
|
|
/* 0x26 */ u8 errno;
|
|
} OSContRamIo; // size = 0x28
|
|
|
|
typedef struct {
|
|
/* 0x00 */ u8 align;
|
|
/* 0x01 */ u8 txsize;
|
|
/* 0x02 */ u8 rxsize;
|
|
/* 0x03 */ u8 cmd;
|
|
/* 0x04 */ u8 typeh;
|
|
/* 0x05 */ u8 typel;
|
|
/* 0x06 */ u8 status;
|
|
/* 0x07 */ u8 align1;
|
|
} __OSContRequesFormat; // size = 0x8
|
|
|
|
typedef struct {
|
|
/* 0x00 */ u8 txsize;
|
|
/* 0x01 */ u8 rxsize;
|
|
/* 0x02 */ u8 cmd;
|
|
/* 0x03 */ u8 typeh;
|
|
/* 0x04 */ u8 typel;
|
|
/* 0x05 */ u8 status;
|
|
} __OSContRequesFormatShort; // size = 0x6
|
|
|
|
typedef struct {
|
|
/* 0x00 */ u8 unk_00;
|
|
/* 0x01 */ u8 txsize;
|
|
/* 0x02 */ u8 rxsize;
|
|
/* 0x03 */ u8 cmd;
|
|
/* 0x04 */ u8 hi;
|
|
/* 0x05 */ u8 lo;
|
|
/* 0x06 */ u8 data[BLOCKSIZE];
|
|
/* 0x26 */ u8 datacrc;
|
|
} __OSContRamReadFormat; // size = 0x27
|
|
|
|
#define READFORMAT(ptr) ((__OSContRamReadFormat*)(ptr))
|
|
|
|
typedef struct {
|
|
/* 0x00 */ u8 align;
|
|
/* 0x01 */ u8 txsize;
|
|
/* 0x02 */ u8 rxsize;
|
|
/* 0x03 */ u8 cmd;
|
|
/* 0x04 */ u16 button;
|
|
/* 0x06 */ s8 joyX;
|
|
/* 0x07 */ s8 joyY;
|
|
} __OSContReadFormat; // size = 0x8
|
|
|
|
#endif
|