summaryrefslogtreecommitdiff
path: root/include/PR
diff options
context:
space:
mode:
authorLucas Shaw <49287729+shawlucas@users.noreply.github.com>2021-03-27 14:17:41 -0700
committerGitHub <noreply@github.com>2021-03-27 16:17:41 -0500
commit623b6d531855aecb3f64cdb678843e9d423ce415 (patch)
treebfa2514d5320425eb74764290057f2a21155f4d7 /include/PR
parentfee7a49abc84fbe91116f969a90570cff15decde (diff)
Some OOT transfers, some renaming, etc (#75)
* Progress on various files * gfxprint stuff * split some rodata, add iconv for rodata string parsing * z_std_dma rodata * 2 nonmatchings in gfxprint * mtxuty-cvt ok * more * match a function in idle.c * progress * Cleanup * Rename BgPolygon to CollisionPoly * progress * some effect stuff * more effect progress * updates * made suggested changes * z_effect_soft_sprite_old_init mostly ok Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com> Co-authored-by: Rozelette <Rozelette@users.noreply.github.com>
Diffstat (limited to 'include/PR')
-rw-r--r--include/PR/hardware.h88
-rw-r--r--include/PR/pfs.h137
2 files changed, 225 insertions, 0 deletions
diff --git a/include/PR/hardware.h b/include/PR/hardware.h
new file mode 100644
index 000000000..1f4fe9dd8
--- /dev/null
+++ b/include/PR/hardware.h
@@ -0,0 +1,88 @@
+#ifndef _ULTRA64_HARDWARE_H_
+#define _ULTRA64_HARDWARE_H_
+
+#define AI_DRAM_ADDR_REG 0x04500000
+#define AI_LEN_REG 0x04500004
+#define AI_CONTROL_REG 0x04500008
+#define AI_STATUS_REG 0x0450000C
+#define AI_STATUS_AI_FULL (1 << 31)
+#define AI_STATUS_AI_BUSY (1 << 30)
+#define AI_DACRATE_REG 0x04500010
+#define AI_BITRATE_REG 0x04500014
+
+#define VI_STATUS_REG 0x04400000
+#define VI_CONTROL_REG 0x04400000
+#define VI_ORIGIN_REG 0x04400004
+#define VI_DRAM_ADDR_REG 0x04400004
+#define VI_WIDTH_REG 0x04400008
+#define VI_H_WIDTH_REG 0x04400008
+#define VI_INTR_REG 0x0440000C
+#define VI_V_INTER_REG 0x0440000C
+#define VI_CURRENT_REG 0x04400010
+#define VI_V_CURRENT_LINE_REG 0x04400010
+#define VI_BURST_REG 0x04400014
+#define VI_TIMING_REG 0x04400014
+#define VI_V_SYNC_REG 0x04400018 //VI vertical sync
+#define VI_H_SYNC_REG 0x0440001C //VI horizontal sync
+#define VI_LEAP_REG 0x04400020 //VI horizontal sync leap
+#define VI_H_SYNC_LEAP_REG 0x04400020
+#define VI_H_START_REG 0x04400024 //VI horizontal video
+#define VI_H_VIDEO_REG 0x04400024
+#define VI_V_START_REG 0x04400028 //VI vertical video
+#define VI_V_VIDEO_REG 0x04400028
+#define VI_V_BURST_REG 0x0440002C //VI vertical burst
+#define VI_X_SCALE_REG 0x04400030 //VI x-scale
+#define VI_Y_SCALE_REG 0x04400034 //VI y-scale
+
+#define SP_IMEM_START 0x04001000
+#define SP_DMEM_START 0x04000000
+
+#define SP_MEM_ADDR_REG 0x04040000
+#define SP_DRAM_ADDR_REG 0x04040004
+#define SP_RD_LEN_REG 0x04040008
+#define SP_WR_LEN_REG 0x0404000C
+#define SP_STATUS_REG 0x04040010
+#define SP_PC_REG 0x04080000
+
+#define PI_DRAM_ADDR_REG 0x04600000 //PI DRAM address
+#define PI_CART_ADDR_REG 0x04600004 //PI pbus (cartridge) address
+#define PI_RD_LEN_REG 0x04600008 //PI read length
+#define PI_WR_LEN_REG 0x0460000C //PI write length
+#define PI_STATUS_REG 0x04600010 //PI status
+#define PI_BSD_DOM1_LAT_REG 0x04600014 //PI dom1 latency
+#define PI_DOMAIN1_REG 0x04600014
+#define PI_BSD_DOM1_PWD_REG 0x04600018 //PI dom1 pulse width
+#define PI_BSD_DOM1_PGS_REG 0x0460001C //PI dom1 page size
+#define PI_BSD_DOM1_RLS_REG 0x04600020 //PI dom1 release
+#define PI_BSD_DOM2_LAT_REG 0x04600024 //PI dom2 latency
+#define PI_DOMAIN2_REG 0x04600024
+#define PI_BSD_DOM2_PWD_REG 0x04600028 //PI dom2 pulse width
+#define PI_BSD_DOM2_PGS_REG 0x0460002C //PI dom2 page size
+#define PI_BSD_DOM2_RLS_REG 0x04600030 //PI dom2 release
+
+#define PI_STATUS_BUSY 0x1
+#define PI_STATUS_IOBUSY 0x2
+#define PI_STATUS_ERROR 0x3
+
+#define PI_STATUS_RESET_CONTROLLER 0x1
+#define PI_STATUS_CLEAR_INTR 0x2
+
+#define SI_DRAM_ADDR_REG 0x04800000
+#define SI_PIF_ADDR_RD64B_REG 0x04800004
+#define SI_PIF_ADDR_WR64B_REG 0x04800010
+#define SI_STATUS_REG 0x04800018
+
+#define SI_STATUS_DMA_BUSY 0x1
+#define SI_STATUS_IO_READ_BUSY 0x2
+#define SI_STATUS_DMA_ERROR 0x8
+#define SI_STATUS_INTERRUPT (1 << 12)
+
+#define PIF_RAM_START 0x1FC007C0
+
+#define MI_INIT_MODE_REG 0x04300000
+#define MI_MODE_REG MI_INIT_MODE_REG
+#define MI_VERSION_REG 0x04300004
+#define MI_INTR_REG 0x04300008
+#define MI_INTR_MASK_REG 0x0430000C
+
+#endif
diff --git a/include/PR/pfs.h b/include/PR/pfs.h
new file mode 100644
index 000000000..71e2a20f6
--- /dev/null
+++ b/include/PR/pfs.h
@@ -0,0 +1,137 @@
+#ifndef _ULTRA64_PFS_H_
+#define _ULTRA64_PFS_H_
+
+#include "global.h"
+
+/* File System size */
+#define OS_PFS_VERSION 0x0200
+#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
+#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
+
+#define PFS_INODE_SIZE_PER_PAGE 128
+#define PFS_FILE_NAME_LEN 16
+#define PFS_FILE_EXT_LEN 4
+#define BLOCKSIZE 32
+#define PFS_ONE_PAGE 8
+#define PFS_MAX_BANKS 62
+
+/* File System flag */
+
+#define PFS_READ 0
+#define PFS_WRITE 1
+#define PFS_CREATE 2
+
+/* File System status */
+#define PFS_INITIALIZED 0x1
+#define PFS_CORRUPTED 0x2
+#define PFS_ID_BROKEN 0x4
+#define PFS_MOTOR_INITIALIZED 0x8
+#define PFS_GBPAK_INITIALIZED 0x10
+
+/* Definition for page usage */
+#define PFS_EOF 1
+#define PFS_PAGE_NOT_EXIST 2
+#define PFS_PAGE_NOT_USED 3
+
+/* File System error number */
+
+#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */
+#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a different one */
+#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker*/
+#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
+#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/
+#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/
+#define PFS_DATA_FULL 7 /* no free pages on ram pack*/
+#define PFS_DIR_FULL 8 /* no free directories on ram pack*/
+#define PFS_ERR_EXIST 9 /* file exists*/
+#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
+#define PFS_ERR_DEVICE 11 /* wrong device type*/
+#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */
+#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */
+
+/* Definition for bank */
+#define PFS_ID_BANK_256K 0
+#define PFS_ID_BANK_1M 4
+#define PFS_BANKS_256K 1
+
+#define PFS_WRITTEN 2
+#define DEF_DIR_PAGES 2
+
+#define PFS_ID_0AREA 1
+#define PFS_ID_1AREA 3
+#define PFS_ID_2AREA 4
+#define PFS_ID_3AREA 6
+#define PFS_LABEL_AREA 7
+#define PFS_ID_PAGE PFS_ONE_PAGE * 0
+
+#define PFS_BANK_LAPPED_BY 8 /* => u8 */
+#define PFS_SECTOR_PER_BANK 32
+#define PFS_INODE_DIST_MAP (PFS_BANK_LAPPED_BY * PFS_SECTOR_PER_BANK)
+#define PFS_SECTOR_SIZE (PFS_INODE_SIZE_PER_PAGE/PFS_SECTOR_PER_BANK)
+
+typedef struct {
+ /* 0x00 */ s32 status;
+ /* 0x04 */ OSMesgQueue* queue;
+ /* 0x08 */ s32 channel;
+ /* 0x0C */ u8 id[32];
+ /* 0x2C */ u8 label[32];
+ /* 0x4C */ s32 version;
+ /* 0x50 */ s32 dir_size;
+ /* 0x54 */ s32 inode_table; /* block location */
+ /* 0x58 */ s32 minode_table; /* mirrioring inode_table */
+ /* 0x5C */ s32 dir_table; /* block location */
+ /* 0x60 */ s32 inodeStartPage; /* page # */
+ /* 0x64 */ u8 banks;
+ /* 0x65 */ u8 activebank;
+} OSPfs; // size = 0x68
+
+typedef struct {
+ /* 0x00 */ u32 file_size; /* bytes */
+ /* 0x04 */ u32 game_code;
+ /* 0x08 */ u16 company_code;
+ /* 0x0C */ char ext_name[4];
+ /* 0x10 */ char game_name[16];
+} OSPfsState; // size = 0x20
+
+typedef union {
+ struct {
+ /* 0x00 */ u8 bank;
+ /* 0x01 */ u8 page;
+ } inode_t;
+ /* 0x00 */ u16 ipage;
+} __OSInodeUnit; // size = 0x02
+
+typedef struct {
+ /* 0x00 */ __OSInodeUnit inodePage[128];
+} __OSInode; // size = 0x100
+
+typedef struct {
+ /* 0x00 */ u32 game_code;
+ /* 0x04 */ u16 company_code;
+ /* 0x06 */ __OSInodeUnit start_page;
+ /* 0x08 */ u8 status;
+ /* 0x09 */ s8 reserved;
+ /* 0x0A */ u16 data_sum;
+ /* 0x0C */ u8 ext_name[PFS_FILE_EXT_LEN];
+ /* 0x10 */ u8 game_name[PFS_FILE_NAME_LEN];
+} __OSDir; // size = 0x20
+
+typedef struct {
+ /* 0x00 */ u32 repaired;
+ /* 0x04 */ u32 random;
+ /* 0x08 */ u64 serialMid;
+ /* 0x10 */ u64 serialLow;
+ /* 0x18 */ u16 deviceid;
+ /* 0x1A */ u8 banks;
+ /* 0x1B */ u8 version;
+ /* 0x1C */ u16 checksum;
+ /* 0x1E */ u16 invertedChecksum;
+} __OSPackId; // size = 0x20
+
+typedef struct {
+ /* 0x000 */ __OSInode inode;
+ /* 0x100 */ u8 bank;
+ /* 0x101 */ u8 map[PFS_INODE_DIST_MAP];
+} __OSInodeCache; // size = 0x202
+
+#endif