Merge branch 'master' into 3d-objects

This commit is contained in:
coco875
2024-08-31 15:41:44 +02:00
438 changed files with 193869 additions and 209398 deletions
+308 -308
View File
@@ -26,328 +26,328 @@
/*
* Segment base addresses and sizes
*/
#define KUBASE 0
#define KUSIZE 0x80000000
#define K0BASE 0x80000000
#define K0SIZE 0x20000000
#define K1BASE 0xA0000000
#define K1SIZE 0x20000000
#define K2BASE 0xC0000000
#define K2SIZE 0x20000000
#define KUBASE 0
#define KUSIZE 0x80000000
#define K0BASE 0x80000000
#define K0SIZE 0x20000000
#define K1BASE 0xA0000000
#define K1SIZE 0x20000000
#define K2BASE 0xC0000000
#define K2SIZE 0x20000000
/*
* Exception vectors
*/
#define SIZE_EXCVEC 0x80 /* Size of an exc. vec */
#define UT_VEC K0BASE /* utlbmiss vector */
#define R_VEC (K1BASE+0x1fc00000) /* reset vector */
#define XUT_VEC (K0BASE+0x80) /* extended address tlbmiss */
#define ECC_VEC (K0BASE+0x100) /* Ecc exception vector */
#define E_VEC (K0BASE+0x180) /* Gen. exception vector */
#define SIZE_EXCVEC 0x80 /* Size of an exc. vec */
#define UT_VEC K0BASE /* utlbmiss vector */
#define R_VEC (K1BASE + 0x1fc00000) /* reset vector */
#define XUT_VEC (K0BASE + 0x80) /* extended address tlbmiss */
#define ECC_VEC (K0BASE + 0x100) /* Ecc exception vector */
#define E_VEC (K0BASE + 0x180) /* Gen. exception vector */
/*
* Address conversion macros
*/
#ifdef _LANGUAGE_ASSEMBLY
#define K0_TO_K1(x) ((x)|0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((x)&0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((x)&0x1FFFFFFF) /* kseg1 to physical */
#define KDM_TO_PHYS(x) ((x)&0x1FFFFFFF) /* direct mapped to physical */
#define PHYS_TO_K0(x) ((x)|0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((x)|0xA0000000) /* physical to kseg1 */
#define K0_TO_K1(x) ((x) | 0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((x) & 0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((x) & 0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((x) & 0x1FFFFFFF) /* kseg1 to physical */
#define KDM_TO_PHYS(x) ((x) & 0x1FFFFFFF) /* direct mapped to physical */
#define PHYS_TO_K0(x) ((x) | 0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((x) | 0xA0000000) /* physical to kseg1 */
#else /* _LANGUAGE_C */
#define K0_TO_K1(x) ((u32)(x)|0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((u32)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* kseg1 to physical */
#define KDM_TO_PHYS(x) ((u32)(x)&0x1FFFFFFF) /* direct mapped to physical */
#define PHYS_TO_K0(x) ((u32)(x)|0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((u32)(x)|0xA0000000) /* physical to kseg1 */
#define K0_TO_K1(x) ((u32) (x) | 0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((u32) (x) & 0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((u32) (x) & 0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((u32) (x) & 0x1FFFFFFF) /* kseg1 to physical */
#define KDM_TO_PHYS(x) ((u32) (x) & 0x1FFFFFFF) /* direct mapped to physical */
#define PHYS_TO_K0(x) ((u32) (x) | 0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((u32) (x) | 0xA0000000) /* physical to kseg1 */
#endif /* _LANGUAGE_ASSEMBLY */
#endif /* _LANGUAGE_ASSEMBLY */
/*
* Address predicates
*/
#define IS_KSEG0(x) ((u32)(x) >= K0BASE && (u32)(x) < K1BASE)
#define IS_KSEG1(x) ((u32)(x) >= K1BASE && (u32)(x) < K2BASE)
#define IS_KSEGDM(x) ((u32)(x) >= K0BASE && (u32)(x) < K2BASE)
#define IS_KSEG2(x) ((u32)(x) >= K2BASE && (u32)(x) < KPTE_SHDUBASE)
#define IS_KPTESEG(x) ((u32)(x) >= KPTE_SHDUBASE)
#define IS_KUSEG(x) ((u32)(x) < K0BASE)
#define IS_KSEG0(x) ((u32) (x) >= K0BASE && (u32) (x) < K1BASE)
#define IS_KSEG1(x) ((u32) (x) >= K1BASE && (u32) (x) < K2BASE)
#define IS_KSEGDM(x) ((u32) (x) >= K0BASE && (u32) (x) < K2BASE)
#define IS_KSEG2(x) ((u32) (x) >= K2BASE && (u32) (x) < KPTE_SHDUBASE)
#define IS_KPTESEG(x) ((u32) (x) >= KPTE_SHDUBASE)
#define IS_KUSEG(x) ((u32) (x) < K0BASE)
/*
* TLB size constants
*/
#define NTLBENTRIES 31 /* entry 31 is reserved by rdb */
#define NTLBENTRIES 31 /* entry 31 is reserved by rdb */
#define TLBHI_VPN2MASK 0xffffe000
#define TLBHI_VPN2SHIFT 13
#define TLBHI_PIDMASK 0xff
#define TLBHI_PIDSHIFT 0
#define TLBHI_NPID 255 /* 255 to fit in 8 bits */
#define TLBHI_VPN2MASK 0xffffe000
#define TLBHI_VPN2SHIFT 13
#define TLBHI_PIDMASK 0xff
#define TLBHI_PIDSHIFT 0
#define TLBHI_NPID 255 /* 255 to fit in 8 bits */
#define TLBLO_PFNMASK 0x3fffffc0
#define TLBLO_PFNSHIFT 6
#define TLBLO_CACHMASK 0x38 /* cache coherency algorithm */
#define TLBLO_CACHSHIFT 3
#define TLBLO_UNCACHED 0x10 /* not cached */
#define TLBLO_NONCOHRNT 0x18 /* Cacheable non-coherent */
#define TLBLO_EXLWR 0x28 /* Exclusive write */
#define TLBLO_D 0x4 /* writeable */
#define TLBLO_V 0x2 /* valid bit */
#define TLBLO_G 0x1 /* global access bit */
#define TLBLO_PFNMASK 0x3fffffc0
#define TLBLO_PFNSHIFT 6
#define TLBLO_CACHMASK 0x38 /* cache coherency algorithm */
#define TLBLO_CACHSHIFT 3
#define TLBLO_UNCACHED 0x10 /* not cached */
#define TLBLO_NONCOHRNT 0x18 /* Cacheable non-coherent */
#define TLBLO_EXLWR 0x28 /* Exclusive write */
#define TLBLO_D 0x4 /* writeable */
#define TLBLO_V 0x2 /* valid bit */
#define TLBLO_G 0x1 /* global access bit */
#define TLBINX_PROBE 0x80000000
#define TLBINX_INXMASK 0x3f
#define TLBINX_INXSHIFT 0
#define TLBINX_PROBE 0x80000000
#define TLBINX_INXMASK 0x3f
#define TLBINX_INXSHIFT 0
#define TLBRAND_RANDMASK 0x3f
#define TLBRAND_RANDSHIFT 0
#define TLBRAND_RANDMASK 0x3f
#define TLBRAND_RANDSHIFT 0
#define TLBWIRED_WIREDMASK 0x3f
#define TLBWIRED_WIREDMASK 0x3f
#define TLBCTXT_BASEMASK 0xff800000
#define TLBCTXT_BASESHIFT 23
#define TLBCTXT_BASEBITS 9
#define TLBCTXT_BASEMASK 0xff800000
#define TLBCTXT_BASESHIFT 23
#define TLBCTXT_BASEBITS 9
#define TLBCTXT_VPNMASK 0x7ffff0
#define TLBCTXT_VPNSHIFT 4
#define TLBCTXT_VPNMASK 0x7ffff0
#define TLBCTXT_VPNSHIFT 4
#define TLBPGMASK_4K 0x0
#define TLBPGMASK_16K 0x6000
#define TLBPGMASK_64K 0x1e000
#define TLBPGMASK_4K 0x0
#define TLBPGMASK_16K 0x6000
#define TLBPGMASK_64K 0x1e000
/*
* Status register
*/
#define SR_CUMASK 0xf0000000 /* coproc usable bits */
#define SR_CUMASK 0xf0000000 /* coproc usable bits */
#define SR_CU3 0x80000000 /* Coprocessor 3 usable */
#define SR_CU2 0x40000000 /* Coprocessor 2 usable */
#define SR_CU1 0x20000000 /* Coprocessor 1 usable */
#define SR_CU0 0x10000000 /* Coprocessor 0 usable */
#define SR_RP 0x08000000 /* Reduced power (quarter speed) */
#define SR_FR 0x04000000 /* MIPS III FP register mode */
#define SR_RE 0x02000000 /* Reverse endian */
#define SR_ITS 0x01000000 /* Instruction trace support */
#define SR_BEV 0x00400000 /* Use boot exception vectors */
#define SR_TS 0x00200000 /* TLB shutdown */
#define SR_SR 0x00100000 /* Soft reset occured */
#define SR_CH 0x00040000 /* Cache hit for last 'cache' op */
#define SR_CE 0x00020000 /* Create ECC */
#define SR_DE 0x00010000 /* ECC of parity does not cause error */
#define SR_CU3 0x80000000 /* Coprocessor 3 usable */
#define SR_CU2 0x40000000 /* Coprocessor 2 usable */
#define SR_CU1 0x20000000 /* Coprocessor 1 usable */
#define SR_CU0 0x10000000 /* Coprocessor 0 usable */
#define SR_RP 0x08000000 /* Reduced power (quarter speed) */
#define SR_FR 0x04000000 /* MIPS III FP register mode */
#define SR_RE 0x02000000 /* Reverse endian */
#define SR_ITS 0x01000000 /* Instruction trace support */
#define SR_BEV 0x00400000 /* Use boot exception vectors */
#define SR_TS 0x00200000 /* TLB shutdown */
#define SR_SR 0x00100000 /* Soft reset occured */
#define SR_CH 0x00040000 /* Cache hit for last 'cache' op */
#define SR_CE 0x00020000 /* Create ECC */
#define SR_DE 0x00010000 /* ECC of parity does not cause error */
/*
* Interrupt enable bits
* (NOTE: bits set to 1 enable the corresponding level interrupt)
*/
#define SR_IMASK 0x0000ff00 /* Interrupt mask */
#define SR_IMASK8 0x00000000 /* mask level 8 */
#define SR_IMASK7 0x00008000 /* mask level 7 */
#define SR_IMASK6 0x0000c000 /* mask level 6 */
#define SR_IMASK5 0x0000e000 /* mask level 5 */
#define SR_IMASK4 0x0000f000 /* mask level 4 */
#define SR_IMASK3 0x0000f800 /* mask level 3 */
#define SR_IMASK2 0x0000fc00 /* mask level 2 */
#define SR_IMASK1 0x0000fe00 /* mask level 1 */
#define SR_IMASK0 0x0000ff00 /* mask level 0 */
#define SR_IMASK 0x0000ff00 /* Interrupt mask */
#define SR_IMASK8 0x00000000 /* mask level 8 */
#define SR_IMASK7 0x00008000 /* mask level 7 */
#define SR_IMASK6 0x0000c000 /* mask level 6 */
#define SR_IMASK5 0x0000e000 /* mask level 5 */
#define SR_IMASK4 0x0000f000 /* mask level 4 */
#define SR_IMASK3 0x0000f800 /* mask level 3 */
#define SR_IMASK2 0x0000fc00 /* mask level 2 */
#define SR_IMASK1 0x0000fe00 /* mask level 1 */
#define SR_IMASK0 0x0000ff00 /* mask level 0 */
#define SR_IBIT8 0x00008000 /* bit level 8 */
#define SR_IBIT7 0x00004000 /* bit level 7 */
#define SR_IBIT6 0x00002000 /* bit level 6 */
#define SR_IBIT5 0x00001000 /* bit level 5 */
#define SR_IBIT4 0x00000800 /* bit level 4 */
#define SR_IBIT3 0x00000400 /* bit level 3 */
#define SR_IBIT2 0x00000200 /* bit level 2 */
#define SR_IBIT1 0x00000100 /* bit level 1 */
#define SR_IBIT8 0x00008000 /* bit level 8 */
#define SR_IBIT7 0x00004000 /* bit level 7 */
#define SR_IBIT6 0x00002000 /* bit level 6 */
#define SR_IBIT5 0x00001000 /* bit level 5 */
#define SR_IBIT4 0x00000800 /* bit level 4 */
#define SR_IBIT3 0x00000400 /* bit level 3 */
#define SR_IBIT2 0x00000200 /* bit level 2 */
#define SR_IBIT1 0x00000100 /* bit level 1 */
#define SR_IMASKSHIFT 8
#define SR_IMASKSHIFT 8
#define SR_KX 0x00000080 /* extended-addr TLB vec in kernel */
#define SR_SX 0x00000040 /* xtended-addr TLB vec supervisor */
#define SR_UX 0x00000020 /* xtended-addr TLB vec in user mode */
#define SR_KSU_MASK 0x00000018 /* mode mask */
#define SR_KSU_USR 0x00000010 /* user mode */
#define SR_KSU_SUP 0x00000008 /* supervisor mode */
#define SR_KSU_KER 0x00000000 /* kernel mode */
#define SR_ERL 0x00000004 /* Error level, 1=>cache error */
#define SR_EXL 0x00000002 /* Exception level, 1=>exception */
#define SR_IE 0x00000001 /* interrupt enable, 1=>enable */
#define SR_KX 0x00000080 /* extended-addr TLB vec in kernel */
#define SR_SX 0x00000040 /* xtended-addr TLB vec supervisor */
#define SR_UX 0x00000020 /* xtended-addr TLB vec in user mode */
#define SR_KSU_MASK 0x00000018 /* mode mask */
#define SR_KSU_USR 0x00000010 /* user mode */
#define SR_KSU_SUP 0x00000008 /* supervisor mode */
#define SR_KSU_KER 0x00000000 /* kernel mode */
#define SR_ERL 0x00000004 /* Error level, 1=>cache error */
#define SR_EXL 0x00000002 /* Exception level, 1=>exception */
#define SR_IE 0x00000001 /* interrupt enable, 1=>enable */
/*
* Cause Register
*/
#define CAUSE_BD 0x80000000 /* Branch delay slot */
#define CAUSE_CEMASK 0x30000000 /* coprocessor error */
#define CAUSE_CESHIFT 28
#define CAUSE_BD 0x80000000 /* Branch delay slot */
#define CAUSE_CEMASK 0x30000000 /* coprocessor error */
#define CAUSE_CESHIFT 28
/* Interrupt pending bits */
#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */
#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */
#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */
#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */
#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */
#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */
#define CAUSE_SW2 0x00000200 /* Software level 2 pending */
#define CAUSE_SW1 0x00000100 /* Software level 1 pending */
#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */
#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */
#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */
#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */
#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */
#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */
#define CAUSE_SW2 0x00000200 /* Software level 2 pending */
#define CAUSE_SW1 0x00000100 /* Software level 1 pending */
#define CAUSE_IPMASK 0x0000FF00 /* Pending interrupt mask */
#define CAUSE_IPSHIFT 8
#define CAUSE_IPMASK 0x0000FF00 /* Pending interrupt mask */
#define CAUSE_IPSHIFT 8
#define CAUSE_EXCMASK 0x0000007C /* Cause code bits */
#define CAUSE_EXCMASK 0x0000007C /* Cause code bits */
#define CAUSE_EXCSHIFT 2
#define CAUSE_EXCSHIFT 2
/* Cause register exception codes */
#define EXC_CODE(x) ((x)<<2)
#define EXC_CODE(x) ((x) << 2)
/* Hardware exception codes */
#define EXC_INT EXC_CODE(0) /* interrupt */
#define EXC_MOD EXC_CODE(1) /* TLB mod */
#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */
#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */
#define EXC_RADE EXC_CODE(4) /* Read Address Error */
#define EXC_WADE EXC_CODE(5) /* Write Address Error */
#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */
#define EXC_DBE EXC_CODE(7) /* Data Bus Error */
#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */
#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */
#define EXC_II EXC_CODE(10) /* Illegal Instruction */
#define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */
#define EXC_OV EXC_CODE(12) /* OVerflow */
#define EXC_TRAP EXC_CODE(13) /* Trap exception */
#define EXC_VCEI EXC_CODE(14) /* Virt. Coherency on Inst. fetch */
#define EXC_FPE EXC_CODE(15) /* Floating Point Exception */
#define EXC_WATCH EXC_CODE(23) /* Watchpoint reference */
#define EXC_VCED EXC_CODE(31) /* Virt. Coherency on data read */
#define EXC_INT EXC_CODE(0) /* interrupt */
#define EXC_MOD EXC_CODE(1) /* TLB mod */
#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */
#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */
#define EXC_RADE EXC_CODE(4) /* Read Address Error */
#define EXC_WADE EXC_CODE(5) /* Write Address Error */
#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */
#define EXC_DBE EXC_CODE(7) /* Data Bus Error */
#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */
#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */
#define EXC_II EXC_CODE(10) /* Illegal Instruction */
#define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */
#define EXC_OV EXC_CODE(12) /* OVerflow */
#define EXC_TRAP EXC_CODE(13) /* Trap exception */
#define EXC_VCEI EXC_CODE(14) /* Virt. Coherency on Inst. fetch */
#define EXC_FPE EXC_CODE(15) /* Floating Point Exception */
#define EXC_WATCH EXC_CODE(23) /* Watchpoint reference */
#define EXC_VCED EXC_CODE(31) /* Virt. Coherency on data read */
/* C0_PRID Defines */
#define C0_IMPMASK 0xff00
#define C0_IMPSHIFT 8
#define C0_REVMASK 0xff
#define C0_MAJREVMASK 0xf0
#define C0_MAJREVSHIFT 4
#define C0_MINREVMASK 0xf
#define C0_IMPMASK 0xff00
#define C0_IMPSHIFT 8
#define C0_REVMASK 0xff
#define C0_MAJREVMASK 0xf0
#define C0_MAJREVSHIFT 4
#define C0_MINREVMASK 0xf
/*
* Coprocessor 0 operations
*/
#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */
#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */
#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */
#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */
#define C0_RFE 0x10 /* restore for exception */
#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */
#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */
#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */
#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */
#define C0_RFE 0x10 /* restore for exception */
/*
* 'cache' instruction definitions
*/
/* Target cache */
#define CACH_PI 0x0 /* specifies primary inst. cache */
#define CACH_PD 0x1 /* primary data cache */
#define CACH_SI 0x2 /* secondary instruction cache */
#define CACH_SD 0x3 /* secondary data cache */
#define CACH_PI 0x0 /* specifies primary inst. cache */
#define CACH_PD 0x1 /* primary data cache */
#define CACH_SI 0x2 /* secondary instruction cache */
#define CACH_SD 0x3 /* secondary data cache */
/* Cache operations */
#define C_IINV 0x0 /* index invalidate (inst, 2nd inst) */
#define C_IWBINV 0x0 /* index writeback inval (d, sd) */
#define C_ILT 0x4 /* index load tag (all) */
#define C_IST 0x8 /* index store tag (all) */
#define C_CDX 0xc /* create dirty exclusive (d, sd) */
#define C_HINV 0x10 /* hit invalidate (all) */
#define C_HWBINV 0x14 /* hit writeback inv. (d, sd) */
#define C_FILL 0x14 /* fill (i) */
#define C_HWB 0x18 /* hit writeback (i, d, sd) */
#define C_HSV 0x1c /* hit set virt. (si, sd) */
#define C_IINV 0x0 /* index invalidate (inst, 2nd inst) */
#define C_IWBINV 0x0 /* index writeback inval (d, sd) */
#define C_ILT 0x4 /* index load tag (all) */
#define C_IST 0x8 /* index store tag (all) */
#define C_CDX 0xc /* create dirty exclusive (d, sd) */
#define C_HINV 0x10 /* hit invalidate (all) */
#define C_HWBINV 0x14 /* hit writeback inv. (d, sd) */
#define C_FILL 0x14 /* fill (i) */
#define C_HWB 0x18 /* hit writeback (i, d, sd) */
#define C_HSV 0x1c /* hit set virt. (si, sd) */
/*
* Cache size definitions
*/
#define ICACHE_SIZE 0x4000 /* 16K */
#define ICACHE_LINESIZE 32 /* 8 words */
#define ICACHE_LINEMASK (ICACHE_LINESIZE-1)
#define ICACHE_SIZE 0x4000 /* 16K */
#define ICACHE_LINESIZE 32 /* 8 words */
#define ICACHE_LINEMASK (ICACHE_LINESIZE - 1)
#define DCACHE_SIZE 0x2000 /* 8K */
#define DCACHE_LINESIZE 16 /* 4 words */
#define DCACHE_LINEMASK (DCACHE_LINESIZE-1)
#define DCACHE_SIZE 0x2000 /* 8K */
#define DCACHE_LINESIZE 16 /* 4 words */
#define DCACHE_LINEMASK (DCACHE_LINESIZE - 1)
/*
* C0_CONFIG register definitions
*/
#define CONFIG_CM 0x80000000 /* 1 == Master-Checker enabled */
#define CONFIG_EC 0x70000000 /* System Clock ratio */
#define CONFIG_EC_1_1 0x6 /* System Clock ratio 1 :1 */
#define CONFIG_EC_3_2 0x7 /* System Clock ratio 1.5 :1 */
#define CONFIG_EC_2_1 0x0 /* System Clock ratio 2 :1 */
#define CONFIG_EC_3_1 0x1 /* System Clock ratio 3 :1 */
#define CONFIG_EP 0x0f000000 /* Transmit Data Pattern */
#define CONFIG_SB 0x00c00000 /* Secondary cache block size */
#define CONFIG_CM 0x80000000 /* 1 == Master-Checker enabled */
#define CONFIG_EC 0x70000000 /* System Clock ratio */
#define CONFIG_EC_1_1 0x6 /* System Clock ratio 1 :1 */
#define CONFIG_EC_3_2 0x7 /* System Clock ratio 1.5 :1 */
#define CONFIG_EC_2_1 0x0 /* System Clock ratio 2 :1 */
#define CONFIG_EC_3_1 0x1 /* System Clock ratio 3 :1 */
#define CONFIG_EP 0x0f000000 /* Transmit Data Pattern */
#define CONFIG_SB 0x00c00000 /* Secondary cache block size */
#define CONFIG_SS 0x00200000 /* Split scache: 0 == I&D combined */
#define CONFIG_SW 0x00100000 /* scache port: 0==128, 1==64 */
#define CONFIG_EW 0x000c0000 /* System Port width: 0==64, 1==32 */
#define CONFIG_SC 0x00020000 /* 0 -> 2nd cache present */
#define CONFIG_SM 0x00010000 /* 0 -> Dirty Shared Coherency enabled*/
#define CONFIG_BE 0x00008000 /* Endian-ness: 1 --> BE */
#define CONFIG_EM 0x00004000 /* 1 -> ECC mode, 0 -> parity */
#define CONFIG_EB 0x00002000 /* Block order:1->sequent,0->subblock */
#define CONFIG_SS 0x00200000 /* Split scache: 0 == I&D combined */
#define CONFIG_SW 0x00100000 /* scache port: 0==128, 1==64 */
#define CONFIG_EW 0x000c0000 /* System Port width: 0==64, 1==32 */
#define CONFIG_SC 0x00020000 /* 0 -> 2nd cache present */
#define CONFIG_SM 0x00010000 /* 0 -> Dirty Shared Coherency enabled*/
#define CONFIG_BE 0x00008000 /* Endian-ness: 1 --> BE */
#define CONFIG_EM 0x00004000 /* 1 -> ECC mode, 0 -> parity */
#define CONFIG_EB 0x00002000 /* Block order:1->sequent,0->subblock */
#define CONFIG_IC 0x00000e00 /* Primary Icache size */
#define CONFIG_DC 0x000001c0 /* Primary Dcache size */
#define CONFIG_IB 0x00000020 /* Icache block size */
#define CONFIG_DB 0x00000010 /* Dcache block size */
#define CONFIG_CU 0x00000008 /* Update on Store-conditional */
#define CONFIG_K0 0x00000007 /* K0SEG Coherency algorithm */
#define CONFIG_IC 0x00000e00 /* Primary Icache size */
#define CONFIG_DC 0x000001c0 /* Primary Dcache size */
#define CONFIG_IB 0x00000020 /* Icache block size */
#define CONFIG_DB 0x00000010 /* Dcache block size */
#define CONFIG_CU 0x00000008 /* Update on Store-conditional */
#define CONFIG_K0 0x00000007 /* K0SEG Coherency algorithm */
#define CONFIG_UNCACHED 0x00000002 /* K0 is uncached */
#define CONFIG_NONCOHRNT 0x00000003
#define CONFIG_COHRNT_EXLWR 0x00000005
#define CONFIG_SB_SHFT 22 /* shift SB to bit position 0 */
#define CONFIG_IC_SHFT 9 /* shift IC to bit position 0 */
#define CONFIG_DC_SHFT 6 /* shift DC to bit position 0 */
#define CONFIG_BE_SHFT 15 /* shift BE to bit position 0 */
#define CONFIG_UNCACHED 0x00000002 /* K0 is uncached */
#define CONFIG_NONCOHRNT 0x00000003
#define CONFIG_COHRNT_EXLWR 0x00000005
#define CONFIG_SB_SHFT 22 /* shift SB to bit position 0 */
#define CONFIG_IC_SHFT 9 /* shift IC to bit position 0 */
#define CONFIG_DC_SHFT 6 /* shift DC to bit position 0 */
#define CONFIG_BE_SHFT 15 /* shift BE to bit position 0 */
/*
* C0_TAGLO definitions for setting/getting cache states and physaddr bits
*/
#define SADDRMASK 0xFFFFE000 /* 31..13 -> scache paddr bits 35..17 */
#define SVINDEXMASK 0x00000380 /* 9..7: prim virt index bits 14..12 */
#define SSTATEMASK 0x00001c00 /* bits 12..10 hold scache line state */
#define SINVALID 0x00000000 /* invalid --> 000 == state 0 */
#define SCLEANEXCL 0x00001000 /* clean exclusive --> 100 == state 4 */
#define SDIRTYEXCL 0x00001400 /* dirty exclusive --> 101 == state 5 */
#define SECC_MASK 0x0000007f /* low 7 bits are ecc for the tag */
#define SADDR_SHIFT 4 /* shift STagLo (31..13) to 35..17 */
#define SADDRMASK 0xFFFFE000 /* 31..13 -> scache paddr bits 35..17 */
#define SVINDEXMASK 0x00000380 /* 9..7: prim virt index bits 14..12 */
#define SSTATEMASK 0x00001c00 /* bits 12..10 hold scache line state */
#define SINVALID 0x00000000 /* invalid --> 000 == state 0 */
#define SCLEANEXCL 0x00001000 /* clean exclusive --> 100 == state 4 */
#define SDIRTYEXCL 0x00001400 /* dirty exclusive --> 101 == state 5 */
#define SECC_MASK 0x0000007f /* low 7 bits are ecc for the tag */
#define SADDR_SHIFT 4 /* shift STagLo (31..13) to 35..17 */
#define PADDRMASK 0xFFFFFF00 /* PTagLo31..8->prim paddr bits35..12 */
#define PADDR_SHIFT 4 /* roll bits 35..12 down to 31..8 */
#define PSTATEMASK 0x00C0 /* bits 7..6 hold primary line state */
#define PINVALID 0x0000 /* invalid --> 000 == state 0 */
#define PCLEANEXCL 0x0080 /* clean exclusive --> 10 == state 2 */
#define PDIRTYEXCL 0x00C0 /* dirty exclusive --> 11 == state 3 */
#define PPARITY_MASK 0x0001 /* low bit is parity bit (even). */
#define PADDRMASK 0xFFFFFF00 /* PTagLo31..8->prim paddr bits35..12 */
#define PADDR_SHIFT 4 /* roll bits 35..12 down to 31..8 */
#define PSTATEMASK 0x00C0 /* bits 7..6 hold primary line state */
#define PINVALID 0x0000 /* invalid --> 000 == state 0 */
#define PCLEANEXCL 0x0080 /* clean exclusive --> 10 == state 2 */
#define PDIRTYEXCL 0x00C0 /* dirty exclusive --> 11 == state 3 */
#define PPARITY_MASK 0x0001 /* low bit is parity bit (even). */
/*
* C0_CACHE_ERR definitions.
*/
#define CACHERR_ER 0x80000000 /* 0: inst ref, 1: data ref */
#define CACHERR_EC 0x40000000 /* 0: primary, 1: secondary */
#define CACHERR_ED 0x20000000 /* 1: data error */
#define CACHERR_ET 0x10000000 /* 1: tag error */
#define CACHERR_ES 0x08000000 /* 1: external ref, e.g. snoop*/
#define CACHERR_EE 0x04000000 /* error on SysAD bus */
#define CACHERR_EB 0x02000000 /* complicated, see spec. */
#define CACHERR_EI 0x01000000 /* complicated, see spec. */
#define CACHERR_SIDX_MASK 0x003ffff8 /* secondary cache index */
#define CACHERR_PIDX_MASK 0x00000007 /* primary cache index */
#define CACHERR_PIDX_SHIFT 12 /* bits 2..0 are paddr14..12 */
#define CACHERR_ER 0x80000000 /* 0: inst ref, 1: data ref */
#define CACHERR_EC 0x40000000 /* 0: primary, 1: secondary */
#define CACHERR_ED 0x20000000 /* 1: data error */
#define CACHERR_ET 0x10000000 /* 1: tag error */
#define CACHERR_ES 0x08000000 /* 1: external ref, e.g. snoop*/
#define CACHERR_EE 0x04000000 /* error on SysAD bus */
#define CACHERR_EB 0x02000000 /* complicated, see spec. */
#define CACHERR_EI 0x01000000 /* complicated, see spec. */
#define CACHERR_SIDX_MASK 0x003ffff8 /* secondary cache index */
#define CACHERR_PIDX_MASK 0x00000007 /* primary cache index */
#define CACHERR_PIDX_SHIFT 12 /* bits 2..0 are paddr14..12 */
/* R4000 family supports hardware watchpoints:
* C0_WATCHLO:
@@ -359,95 +359,95 @@
* bits 31..4 are reserved and must be written as zeros.
* bits 3..0 are bits 35..32 of the physaddr to watch
*/
#define WATCHLO_WTRAP 0x00000001
#define WATCHLO_RTRAP 0x00000002
#define WATCHLO_ADDRMASK 0xfffffff8
#define WATCHLO_VALIDMASK 0xfffffffb
#define WATCHHI_VALIDMASK 0x0000000f
#define WATCHLO_WTRAP 0x00000001
#define WATCHLO_RTRAP 0x00000002
#define WATCHLO_ADDRMASK 0xfffffff8
#define WATCHLO_VALIDMASK 0xfffffffb
#define WATCHHI_VALIDMASK 0x0000000f
/*
* Coprocessor 0 registers
*/
#ifdef _LANGUAGE_ASSEMBLY
#define C0_INX $0
#define C0_RAND $1
#define C0_ENTRYLO0 $2
#define C0_ENTRYLO1 $3
#define C0_CONTEXT $4
#define C0_PAGEMASK $5 /* page mask */
#define C0_WIRED $6 /* # wired entries in tlb */
#define C0_BADVADDR $8
#define C0_COUNT $9 /* free-running counter */
#define C0_ENTRYHI $10
#define C0_SR $12
#define C0_CAUSE $13
#define C0_EPC $14
#define C0_PRID $15 /* revision identifier */
#define C0_COMPARE $11 /* counter comparison reg. */
#define C0_CONFIG $16 /* hardware configuration */
#define C0_LLADDR $17 /* load linked address */
#define C0_WATCHLO $18 /* watchpoint */
#define C0_WATCHHI $19 /* watchpoint */
#define C0_ECC $26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR $27 /* cache error status */
#define C0_TAGLO $28 /* cache operations */
#define C0_TAGHI $29 /* cache operations */
#define C0_ERROR_EPC $30 /* ECC error prg. counter */
#define C0_INX $0
#define C0_RAND $1
#define C0_ENTRYLO0 $2
#define C0_ENTRYLO1 $3
#define C0_CONTEXT $4
#define C0_PAGEMASK $5 /* page mask */
#define C0_WIRED $6 /* # wired entries in tlb */
#define C0_BADVADDR $8
#define C0_COUNT $9 /* free-running counter */
#define C0_ENTRYHI $10
#define C0_SR $12
#define C0_CAUSE $13
#define C0_EPC $14
#define C0_PRID $15 /* revision identifier */
#define C0_COMPARE $11 /* counter comparison reg. */
#define C0_CONFIG $16 /* hardware configuration */
#define C0_LLADDR $17 /* load linked address */
#define C0_WATCHLO $18 /* watchpoint */
#define C0_WATCHHI $19 /* watchpoint */
#define C0_ECC $26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR $27 /* cache error status */
#define C0_TAGLO $28 /* cache operations */
#define C0_TAGHI $29 /* cache operations */
#define C0_ERROR_EPC $30 /* ECC error prg. counter */
# else /* ! _LANGUAGE_ASSEMBLY */
#else /* ! _LANGUAGE_ASSEMBLY */
#define C0_INX 0
#define C0_RAND 1
#define C0_ENTRYLO0 2
#define C0_ENTRYLO1 3
#define C0_CONTEXT 4
#define C0_PAGEMASK 5 /* page mask */
#define C0_WIRED 6 /* # wired entries in tlb */
#define C0_BADVADDR 8
#define C0_COUNT 9 /* free-running counter */
#define C0_ENTRYHI 10
#define C0_SR 12
#define C0_CAUSE 13
#define C0_EPC 14
#define C0_PRID 15 /* revision identifier */
#define C0_COMPARE 11 /* counter comparison reg. */
#define C0_CONFIG 16 /* hardware configuration */
#define C0_LLADDR 17 /* load linked address */
#define C0_WATCHLO 18 /* watchpoint */
#define C0_WATCHHI 19 /* watchpoint */
#define C0_ECC 26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR 27 /* cache error status */
#define C0_TAGLO 28 /* cache operations */
#define C0_TAGHI 29 /* cache operations */
#define C0_ERROR_EPC 30 /* ECC error prg. counter */
#define C0_INX 0
#define C0_RAND 1
#define C0_ENTRYLO0 2
#define C0_ENTRYLO1 3
#define C0_CONTEXT 4
#define C0_PAGEMASK 5 /* page mask */
#define C0_WIRED 6 /* # wired entries in tlb */
#define C0_BADVADDR 8
#define C0_COUNT 9 /* free-running counter */
#define C0_ENTRYHI 10
#define C0_SR 12
#define C0_CAUSE 13
#define C0_EPC 14
#define C0_PRID 15 /* revision identifier */
#define C0_COMPARE 11 /* counter comparison reg. */
#define C0_CONFIG 16 /* hardware configuration */
#define C0_LLADDR 17 /* load linked address */
#define C0_WATCHLO 18 /* watchpoint */
#define C0_WATCHHI 19 /* watchpoint */
#define C0_ECC 26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR 27 /* cache error status */
#define C0_TAGLO 28 /* cache operations */
#define C0_TAGHI 29 /* cache operations */
#define C0_ERROR_EPC 30 /* ECC error prg. counter */
#endif /* _LANGUAGE_ASSEMBLY */
#endif /* _LANGUAGE_ASSEMBLY */
/*
* floating-point status register
* floating-point status register
*/
#define FPCSR_FS 0x01000000 /* flush denorm to zero */
#define FPCSR_C 0x00800000 /* condition bit */
#define FPCSR_CE 0x00020000 /* cause: unimplemented operation */
#define FPCSR_CV 0x00010000 /* cause: invalid operation */
#define FPCSR_CZ 0x00008000 /* cause: division by zero */
#define FPCSR_CO 0x00004000 /* cause: overflow */
#define FPCSR_CU 0x00002000 /* cause: underflow */
#define FPCSR_CI 0x00001000 /* cause: inexact operation */
#define FPCSR_EV 0x00000800 /* enable: invalid operation */
#define FPCSR_EZ 0x00000400 /* enable: division by zero */
#define FPCSR_EO 0x00000200 /* enable: overflow */
#define FPCSR_EU 0x00000100 /* enable: underflow */
#define FPCSR_EI 0x00000080 /* enable: inexact operation */
#define FPCSR_FV 0x00000040 /* flag: invalid operation */
#define FPCSR_FZ 0x00000020 /* flag: division by zero */
#define FPCSR_FO 0x00000010 /* flag: overflow */
#define FPCSR_FU 0x00000008 /* flag: underflow */
#define FPCSR_FI 0x00000004 /* flag: inexact operation */
#define FPCSR_RM_MASK 0x00000003 /* rounding mode mask */
#define FPCSR_RM_RN 0x00000000 /* round to nearest */
#define FPCSR_RM_RZ 0x00000001 /* round to zero */
#define FPCSR_RM_RP 0x00000002 /* round to positive infinity */
#define FPCSR_RM_RM 0x00000003 /* round to negative infinity */
#define FPCSR_FS 0x01000000 /* flush denorm to zero */
#define FPCSR_C 0x00800000 /* condition bit */
#define FPCSR_CE 0x00020000 /* cause: unimplemented operation */
#define FPCSR_CV 0x00010000 /* cause: invalid operation */
#define FPCSR_CZ 0x00008000 /* cause: division by zero */
#define FPCSR_CO 0x00004000 /* cause: overflow */
#define FPCSR_CU 0x00002000 /* cause: underflow */
#define FPCSR_CI 0x00001000 /* cause: inexact operation */
#define FPCSR_EV 0x00000800 /* enable: invalid operation */
#define FPCSR_EZ 0x00000400 /* enable: division by zero */
#define FPCSR_EO 0x00000200 /* enable: overflow */
#define FPCSR_EU 0x00000100 /* enable: underflow */
#define FPCSR_EI 0x00000080 /* enable: inexact operation */
#define FPCSR_FV 0x00000040 /* flag: invalid operation */
#define FPCSR_FZ 0x00000020 /* flag: division by zero */
#define FPCSR_FO 0x00000010 /* flag: overflow */
#define FPCSR_FU 0x00000008 /* flag: underflow */
#define FPCSR_FI 0x00000004 /* flag: inexact operation */
#define FPCSR_RM_MASK 0x00000003 /* rounding mode mask */
#define FPCSR_RM_RN 0x00000000 /* round to nearest */
#define FPCSR_RM_RZ 0x00000001 /* round to zero */
#define FPCSR_RM_RP 0x00000002 /* round to positive infinity */
#define FPCSR_RM_RM 0x00000003 /* round to negative infinity */
#endif /* __R4300_H */
+361 -389
View File
File diff suppressed because it is too large Load Diff
+2822 -3380
View File
File diff suppressed because it is too large Load Diff
+267 -262
View File
@@ -1,16 +1,16 @@
/*---------------------------------------------------------------------
Copyright (C) 1997, Nintendo.
File gs2dex.h
Coded by Yoshitaka Yasumoto. Jul 31, 1997.
Modified by
Comments Header file for S2DEX ucode.
$Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $
Copyright (C) 1997, Nintendo.
File gs2dex.h
Coded by Yoshitaka Yasumoto. Jul 31, 1997.
Modified by
Comments Header file for S2DEX ucode.
$Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $
---------------------------------------------------------------------*/
#ifndef _GS2DEX_H_
#define _GS2DEX_H_
#ifndef _GS2DEX_H_
#define _GS2DEX_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -21,9 +21,9 @@ extern "C" {
/*===========================================================================*
* Macro
*===========================================================================*/
#define GS_CALC_DXT(line) (((1<< G_TX_DXT_FRAC)-1)/(line)+1)
#define GS_PIX2TMEM(pix, siz) ((pix)>>(4-(siz)))
#define GS_PIX2DXT(pix, siz) GS_CALC_DXT(GS_PIX2TMEM((pix), (siz)))
#define GS_CALC_DXT(line) (((1 << G_TX_DXT_FRAC) - 1) / (line) + 1)
#define GS_PIX2TMEM(pix, siz) ((pix) >> (4 - (siz)))
#define GS_PIX2DXT(pix, siz) GS_CALC_DXT(GS_PIX2TMEM((pix), (siz)))
/*===========================================================================*
* Data structures for S2DEX microcode
@@ -32,356 +32,361 @@ extern "C" {
/*---------------------------------------------------------------------------*
* Background
*---------------------------------------------------------------------------*/
#define G_BGLT_LOADBLOCK 0x0033
#define G_BGLT_LOADTILE 0xfff4
#define G_BGLT_LOADBLOCK 0x0033
#define G_BGLT_LOADTILE 0xfff4
#define G_BG_FLAG_FLIPS 0x01
#define G_BG_FLAG_FLIPT 0x10
#define G_BG_FLAG_FLIPS 0x01
#define G_BG_FLAG_FLIPT 0x10
/* Non scalable background plane */
typedef struct {
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of the texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
typedef struct {
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of the texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of the texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of the texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u64 *imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* which to use, LoadBlock or LoadTile */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
u64* imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* which to use, LoadBlock or LoadTile */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
/* The following is set in the initialization routine guS2DInitBg(). There is no need for the user to set it. */
u16 tmemW; /* TMEM width and Word size of frame 1 line.
At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz)
At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* height of TMEM loadable at a time (s13.2) 4 times value
When the normal texture, 512/tmemW*4
When the CI texture, 256/tmemW*4 */
u16 tmemLoadSH; /* SH value
At LoadBlock, tmemSize/2-1
At LoadTile, tmemW*16-1 */
u16 tmemLoadTH; /* TH value or Stride value
At LoadBlock, GS_CALC_DXT(tmemW)
At LoadTile, tmemH-1 */
u16 tmemSizeW; /* skip value of imagePtr for image 1-line
At LoadBlock, tmemW*2
At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* skip value of imagePtr for 1-loading
= tmemSizeW*tmemH */
} uObjBg_t; /* 40 bytes */
/* The following is set in the initialization routine guS2DInitBg(). There is no need for the user to set it. */
u16 tmemW; /* TMEM width and Word size of frame 1 line.
At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz)
At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* height of TMEM loadable at a time (s13.2) 4 times value
When the normal texture, 512/tmemW*4
When the CI texture, 256/tmemW*4 */
u16 tmemLoadSH; /* SH value
At LoadBlock, tmemSize/2-1
At LoadTile, tmemW*16-1 */
u16 tmemLoadTH; /* TH value or Stride value
At LoadBlock, GS_CALC_DXT(tmemW)
At LoadTile, tmemH-1 */
u16 tmemSizeW; /* skip value of imagePtr for image 1-line
At LoadBlock, tmemW*2
At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* skip value of imagePtr for 1-loading
= tmemSizeW*tmemH */
} uObjBg_t; /* 40 bytes */
/* Scalable background plane */
typedef struct {
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
typedef struct {
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u64 *imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
u64* imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
u16 scaleW; /* scale value of X-direction (u5.10) */
u16 scaleH; /* scale value of Y-direction (u5.10) */
s32 imageYorig; /* start point of drawing on image (s20.5) */
u8 padding[4];
} uObjScaleBg_t; /* 40 bytes */
u16 scaleW; /* scale value of X-direction (u5.10) */
u16 scaleH; /* scale value of Y-direction (u5.10) */
s32 imageYorig; /* start point of drawing on image (s20.5) */
u8 padding[4];
} uObjScaleBg_t; /* 40 bytes */
typedef union {
uObjBg_t b;
uObjScaleBg_t s;
long long int force_structure_alignment;
uObjBg_t b;
uObjScaleBg_t s;
long long int force_structure_alignment;
} uObjBg;
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define G_OBJ_FLAG_FLIPS 1<<0 /* inversion to S-direction */
#define G_OBJ_FLAG_FLIPT 1<<4 /* nversion to T-direction */
#define G_OBJ_FLAG_FLIPS 1 << 0 /* inversion to S-direction */
#define G_OBJ_FLAG_FLIPT 1 << 4 /* nversion to T-direction */
typedef struct {
s16 objX; /* s10.2 OBJ x-coordinate of upper-left end */
u16 scaleW; /* u5.10 Scaling of u5.10 width direction */
u16 imageW; /* u10.5 width of u10.5 texture (length of S-direction) */
u16 paddingX; /* Unused - Always 0 */
s16 objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */
u16 scaleH; /* u5.10 Scaling of u5.10 height direction */
u16 imageH; /* u10.5 height of u10.5 texture (length of T-direction) */
u16 paddingY; /* Unused - Always 0 */
u16 imageStride; /* folding width of texel (In units of 64bit word) */
u16 imageAdrs; /* texture header position in TMEM (In units of 64bit word) */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u8 imagePal; /* pallet number (0-7) */
u8 imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */
} uObjSprite_t; /* 24 bytes */
s16 objX; /* s10.2 OBJ x-coordinate of upper-left end */
u16 scaleW; /* u5.10 Scaling of u5.10 width direction */
u16 imageW; /* u10.5 width of u10.5 texture (length of S-direction) */
u16 paddingX; /* Unused - Always 0 */
s16 objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */
u16 scaleH; /* u5.10 Scaling of u5.10 height direction */
u16 imageH; /* u10.5 height of u10.5 texture (length of T-direction) */
u16 paddingY; /* Unused - Always 0 */
u16 imageStride; /* folding width of texel (In units of 64bit word) */
u16 imageAdrs; /* texture header position in TMEM (In units of 64bit word) */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u8 imagePal; /* pallet number (0-7) */
u8 imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */
} uObjSprite_t; /* 24 bytes */
typedef union {
uObjSprite_t s;
long long int force_structure_alignment;
uObjSprite_t s;
long long int force_structure_alignment;
} uObjSprite;
/*---------------------------------------------------------------------------*
* 2D Matrix
*---------------------------------------------------------------------------*/
typedef struct {
s32 A, B, C, D; /* s15.16 */
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjMtx_t; /* 24 bytes */
s32 A, B, C, D; /* s15.16 */
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjMtx_t; /* 24 bytes */
typedef union {
uObjMtx_t m;
long long int force_structure_alignment;
uObjMtx_t m;
long long int force_structure_alignment;
} uObjMtx;
typedef struct {
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjSubMtx_t; /* 8 bytes */
s16 X, Y; /* s10.2 */
u16 BaseScaleX; /* u5.10 */
u16 BaseScaleY; /* u5.10 */
} uObjSubMtx_t; /* 8 bytes */
typedef union {
uObjSubMtx_t m;
long long int force_structure_alignment;
uObjSubMtx_t m;
long long int force_structure_alignment;
} uObjSubMtx;
/*---------------------------------------------------------------------------*
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define G_OBJLT_TXTRBLOCK 0x00001033
#define G_OBJLT_TXTRTILE 0x00fc1034
#define G_OBJLT_TLUT 0x00000030
#define G_OBJLT_TXTRBLOCK 0x00001033
#define G_OBJLT_TXTRTILE 0x00fc1034
#define G_OBJLT_TLUT 0x00000030
#define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1)
#define GS_TB_TLINE(pix,siz) (GS_CALC_DXT(GS_PIX2TMEM((pix),(siz))))
#define GS_TB_TSIZE(pix, siz) (GS_PIX2TMEM((pix), (siz)) - 1)
#define GS_TB_TLINE(pix, siz) (GS_CALC_DXT(GS_PIX2TMEM((pix), (siz))))
typedef struct {
u32 type; /* G_OBJLT_TXTRBLOCK divided into types */
u64 *image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD) */
u16 tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */
u16 tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrBlock_t; /* 24 bytes */
typedef struct {
u32 type; /* G_OBJLT_TXTRBLOCK divided into types */
u64* image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD) */
u16 tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */
u16 tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrBlock_t; /* 24 bytes */
#define GS_TT_TWIDTH(pix,siz) ((GS_PIX2TMEM((pix), (siz))<<2)-1)
#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1)
#define GS_TT_TWIDTH(pix, siz) ((GS_PIX2TMEM((pix), (siz)) << 2) - 1)
#define GS_TT_THEIGHT(pix, siz) (((pix) << 2) - 1)
typedef struct {
u32 type; /* G_OBJLT_TXTRTILE divided into types */
u64 *image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD)*/
u16 twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */
u16 theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTile_t; /* 24 bytes */
typedef struct {
u32 type; /* G_OBJLT_TXTRTILE divided into types */
u64* image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD)*/
u16 twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */
u16 theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTile_t; /* 24 bytes */
#define GS_PAL_HEAD(head) ((head)+256)
#define GS_PAL_NUM(num) ((num)-1)
#define GS_PAL_HEAD(head) ((head) + 256)
#define GS_PAL_NUM(num) ((num) - 1)
typedef struct {
u32 type; /* G_OBJLT_TLUT divided into types */
u64 *image; /* texture source address on DRAM */
u16 phead; /* pallet number of load header (Between 256 and 511) */
u16 pnum; /* loading pallet number -1 */
u16 zero; /* Assign 0 all the time */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTLUT_t; /* 24 bytes */
typedef struct {
u32 type; /* G_OBJLT_TLUT divided into types */
u64* image; /* texture source address on DRAM */
u16 phead; /* pallet number of load header (Between 256 and 511) */
u16 pnum; /* loading pallet number -1 */
u16 zero; /* Assign 0 all the time */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTLUT_t; /* 24 bytes */
typedef union {
uObjTxtrBlock_t block;
uObjTxtrTile_t tile;
uObjTxtrTLUT_t tlut;
long long int force_structure_alignment;
uObjTxtrBlock_t block;
uObjTxtrTile_t tile;
uObjTxtrTLUT_t tlut;
long long int force_structure_alignment;
} uObjTxtr;
/*---------------------------------------------------------------------------*
* Loading into TMEM & 2D Objects
*---------------------------------------------------------------------------*/
typedef struct {
uObjTxtr txtr;
uObjSprite sprite;
} uObjTxSprite; /* 48 bytes */
typedef struct {
uObjTxtr txtr;
uObjSprite sprite;
} uObjTxSprite; /* 48 bytes */
/*===========================================================================*
* GBI Commands for S2DEX microcode
*===========================================================================*/
/* GBI Header */
#ifdef F3DEX_GBI_2
#define G_OBJ_RECTANGLE_R 0xda
#define G_OBJ_MOVEMEM 0xdc
#define G_RDPHALF_0 0xe4
#define G_OBJ_RECTANGLE 0x01
#define G_OBJ_SPRITE 0x02
#define G_SELECT_DL 0x04
#define G_OBJ_LOADTXTR 0x05
#define G_OBJ_LDTX_SPRITE 0x06
#define G_OBJ_LDTX_RECT 0x07
#define G_OBJ_LDTX_RECT_R 0x08
#define G_BG_1CYC 0x09
#define G_BG_COPY 0x0a
#define G_OBJ_RENDERMODE 0x0b
#ifdef F3DEX_GBI_2
#define G_OBJ_RECTANGLE_R 0xda
#define G_OBJ_MOVEMEM 0xdc
#define G_RDPHALF_0 0xe4
#define G_OBJ_RECTANGLE 0x01
#define G_OBJ_SPRITE 0x02
#define G_SELECT_DL 0x04
#define G_OBJ_LOADTXTR 0x05
#define G_OBJ_LDTX_SPRITE 0x06
#define G_OBJ_LDTX_RECT 0x07
#define G_OBJ_LDTX_RECT_R 0x08
#define G_BG_1CYC 0x09
#define G_BG_COPY 0x0a
#define G_OBJ_RENDERMODE 0x0b
#else
#define G_BG_1CYC 0x01
#define G_BG_COPY 0x02
#define G_OBJ_RECTANGLE 0x03
#define G_OBJ_SPRITE 0x04
#define G_OBJ_MOVEMEM 0x05
#define G_SELECT_DL 0xb0
#define G_OBJ_RENDERMODE 0xb1
#define G_OBJ_RECTANGLE_R 0xb2
#define G_OBJ_LOADTXTR 0xc1
#define G_OBJ_LDTX_SPRITE 0xc2
#define G_OBJ_LDTX_RECT 0xc3
#define G_OBJ_LDTX_RECT_R 0xc4
#define G_RDPHALF_0 0xe4
#define G_BG_1CYC 0x01
#define G_BG_COPY 0x02
#define G_OBJ_RECTANGLE 0x03
#define G_OBJ_SPRITE 0x04
#define G_OBJ_MOVEMEM 0x05
#define G_SELECT_DL 0xb0
#define G_OBJ_RENDERMODE 0xb1
#define G_OBJ_RECTANGLE_R 0xb2
#define G_OBJ_LOADTXTR 0xc1
#define G_OBJ_LDTX_SPRITE 0xc2
#define G_OBJ_LDTX_RECT 0xc3
#define G_OBJ_LDTX_RECT_R 0xc4
#define G_RDPHALF_0 0xe4
#endif
/*---------------------------------------------------------------------------*
* Background wrapped screen
*---------------------------------------------------------------------------*/
#define gSPBgRectangle(pkt, m, mptr) gDma0p((pkt),(m),(mptr),0)
#define gsSPBgRectangle(m, mptr) gsDma0p( (m),(mptr),0)
#define gSPBgRectCopy(pkt, mptr) gSPBgRectangle((pkt), G_BG_COPY, (mptr))
#define gsSPBgRectCopy(mptr) gsSPBgRectangle( G_BG_COPY, (mptr))
#define gSPBgRect1Cyc(pkt, mptr) gSPBgRectangle((pkt), G_BG_1CYC, (mptr))
#define gsSPBgRect1Cyc(mptr) gsSPBgRectangle( G_BG_1CYC, (mptr))
#define gSPBgRectangle(pkt, m, mptr) gDma0p((pkt), (m), (mptr), 0)
#define gsSPBgRectangle(m, mptr) gsDma0p((m), (mptr), 0)
#define gSPBgRectCopy(pkt, mptr) gSPBgRectangle((pkt), G_BG_COPY, (mptr))
#define gsSPBgRectCopy(mptr) gsSPBgRectangle(G_BG_COPY, (mptr))
#define gSPBgRect1Cyc(pkt, mptr) gSPBgRectangle((pkt), G_BG_1CYC, (mptr))
#define gsSPBgRect1Cyc(mptr) gsSPBgRectangle(G_BG_1CYC, (mptr))
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define gSPObjSprite(pkt, mptr) gDma0p((pkt),G_OBJ_SPRITE, (mptr),0)
#define gsSPObjSprite(mptr) gsDma0p( G_OBJ_SPRITE, (mptr),0)
#define gSPObjRectangle(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE, (mptr),0)
#define gsSPObjRectangle(mptr) gsDma0p( G_OBJ_RECTANGLE, (mptr),0)
#define gSPObjRectangleR(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE_R,(mptr),0)
#define gsSPObjRectangleR(mptr) gsDma0p( G_OBJ_RECTANGLE_R,(mptr),0)
#define gSPObjSprite(pkt, mptr) gDma0p((pkt), G_OBJ_SPRITE, (mptr), 0)
#define gsSPObjSprite(mptr) gsDma0p(G_OBJ_SPRITE, (mptr), 0)
#define gSPObjRectangle(pkt, mptr) gDma0p((pkt), G_OBJ_RECTANGLE, (mptr), 0)
#define gsSPObjRectangle(mptr) gsDma0p(G_OBJ_RECTANGLE, (mptr), 0)
#define gSPObjRectangleR(pkt, mptr) gDma0p((pkt), G_OBJ_RECTANGLE_R, (mptr), 0)
#define gsSPObjRectangleR(mptr) gsDma0p(G_OBJ_RECTANGLE_R, (mptr), 0)
/*---------------------------------------------------------------------------*
* 2D Matrix
*---------------------------------------------------------------------------*/
#define gSPObjMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),0,23)
#define gsSPObjMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),0,23)
#define gSPObjSubMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),2, 7)
#define gsSPObjSubMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),2, 7)
#define gSPObjMatrix(pkt, mptr) gDma1p((pkt), G_OBJ_MOVEMEM, (mptr), 0, 23)
#define gsSPObjMatrix(mptr) gsDma1p(G_OBJ_MOVEMEM, (mptr), 0, 23)
#define gSPObjSubMatrix(pkt, mptr) gDma1p((pkt), G_OBJ_MOVEMEM, (mptr), 2, 7)
#define gsSPObjSubMatrix(mptr) gsDma1p(G_OBJ_MOVEMEM, (mptr), 2, 7)
/*---------------------------------------------------------------------------*
* Loading into TMEM
*---------------------------------------------------------------------------*/
#define gSPObjLoadTxtr(pkt, tptr) gDma0p((pkt),G_OBJ_LOADTXTR, (tptr),23)
#define gsSPObjLoadTxtr(tptr) gsDma0p( G_OBJ_LOADTXTR, (tptr),23)
#define gSPObjLoadTxSprite(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_SPRITE,(tptr),47)
#define gsSPObjLoadTxSprite(tptr) gsDma0p( G_OBJ_LDTX_SPRITE,(tptr),47)
#define gSPObjLoadTxRect(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT, (tptr),47)
#define gsSPObjLoadTxRect(tptr) gsDma0p( G_OBJ_LDTX_RECT, (tptr),47)
#define gSPObjLoadTxRectR(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT_R,(tptr),47)
#define gsSPObjLoadTxRectR(tptr) gsDma0p( G_OBJ_LDTX_RECT_R,(tptr),47)
#define gSPObjLoadTxtr(pkt, tptr) gDma0p((pkt), G_OBJ_LOADTXTR, (tptr), 23)
#define gsSPObjLoadTxtr(tptr) gsDma0p(G_OBJ_LOADTXTR, (tptr), 23)
#define gSPObjLoadTxSprite(pkt, tptr) gDma0p((pkt), G_OBJ_LDTX_SPRITE, (tptr), 47)
#define gsSPObjLoadTxSprite(tptr) gsDma0p(G_OBJ_LDTX_SPRITE, (tptr), 47)
#define gSPObjLoadTxRect(pkt, tptr) gDma0p((pkt), G_OBJ_LDTX_RECT, (tptr), 47)
#define gsSPObjLoadTxRect(tptr) gsDma0p(G_OBJ_LDTX_RECT, (tptr), 47)
#define gSPObjLoadTxRectR(pkt, tptr) gDma0p((pkt), G_OBJ_LDTX_RECT_R, (tptr), 47)
#define gsSPObjLoadTxRectR(tptr) gsDma0p(G_OBJ_LDTX_RECT_R, (tptr), 47)
/*---------------------------------------------------------------------------*
* Select Display List
*---------------------------------------------------------------------------*/
#define gSPSelectDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gsSPSelectDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
#define gsSPSelectBranchDL(mptr, sid, flag, mask) \
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
#define gSPSelectDL(pkt, mptr, sid, flag, mask) \
{ \
gDma1p((pkt), G_RDPHALF_0, (flag), (u32) (mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32) (mptr) >> 16, G_DL_PUSH); \
}
#define gsSPSelectDL(mptr, sid, flag, mask) \
{ \
gsDma1p(G_RDPHALF_0, (flag), (u32) (mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32) (mptr) >> 16, G_DL_PUSH); \
}
#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \
{ \
gDma1p((pkt), G_RDPHALF_0, (flag), (u32) (mptr) & 0xffff, (sid)); \
gDma1p((pkt), G_SELECT_DL, (mask), (u32) (mptr) >> 16, G_DL_NOPUSH); \
}
#define gsSPSelectBranchDL(mptr, sid, flag, mask) \
{ \
gsDma1p(G_RDPHALF_0, (flag), (u32) (mptr) & 0xffff, (sid)); \
gsDma1p(G_SELECT_DL, (mask), (u32) (mptr) >> 16, G_DL_NOPUSH); \
}
/*---------------------------------------------------------------------------*
* Set general status
*---------------------------------------------------------------------------*/
#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG */
#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG */
#define gSPSetStatus(pkt, sid, val) \
gMoveWd((pkt), G_MW_GENSTAT, (sid), (val))
#define gsSPSetStatus(sid, val) \
gsMoveWd( G_MW_GENSTAT, (sid), (val))
#define gSPSetStatus(pkt, sid, val) gMoveWd((pkt), G_MW_GENSTAT, (sid), (val))
#define gsSPSetStatus(sid, val) gsMoveWd(G_MW_GENSTAT, (sid), (val))
/*---------------------------------------------------------------------------*
* Set Object Render Mode
*---------------------------------------------------------------------------*/
#define G_OBJRM_NOTXCLAMP 0x01
#define G_OBJRM_XLU 0x02 /* Ignored */
#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */
#define G_OBJRM_BILERP 0x08
#define G_OBJRM_SHRINKSIZE_1 0x10
#define G_OBJRM_SHRINKSIZE_2 0x20
#define G_OBJRM_WIDEN 0x40
#define G_OBJRM_NOTXCLAMP 0x01
#define G_OBJRM_XLU 0x02 /* Ignored */
#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */
#define G_OBJRM_BILERP 0x08
#define G_OBJRM_SHRINKSIZE_1 0x10
#define G_OBJRM_SHRINKSIZE_2 0x20
#define G_OBJRM_WIDEN 0x40
#define gSPObjRenderMode(pkt, mode) gImmp1((pkt),G_OBJ_RENDERMODE,(mode))
#define gsSPObjRenderMode(mode) gsImmp1( G_OBJ_RENDERMODE,(mode))
#define gSPObjRenderMode(pkt, mode) gImmp1((pkt), G_OBJ_RENDERMODE, (mode))
#define gsSPObjRenderMode(mode) gsImmp1(G_OBJ_RENDERMODE, (mode))
/*===========================================================================*
* Render Mode Macro
*===========================================================================*/
#define RM_RA_SPRITE(clk) \
AA_EN | CVG_DST_CLAMP | \
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
#define RM_RA_SPRITE(clk) \
AA_EN | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
#define G_RM_SPRITE G_RM_OPA_SURF
#define G_RM_SPRITE2 G_RM_OPA_SURF2
#define G_RM_RA_SPRITE RM_RA_SPRITE(1)
#define G_RM_RA_SPRITE2 RM_RA_SPRITE(2)
#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR
#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2
#define G_RM_XLU_SPRITE G_RM_XLU_SURF
#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2
#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF
#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2
#define G_RM_SPRITE G_RM_OPA_SURF
#define G_RM_SPRITE2 G_RM_OPA_SURF2
#define G_RM_RA_SPRITE RM_RA_SPRITE(1)
#define G_RM_RA_SPRITE2 RM_RA_SPRITE(2)
#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR
#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2
#define G_RM_XLU_SPRITE G_RM_XLU_SURF
#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2
#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF
#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2
/*===========================================================================*
* External functions
* External functions
*===========================================================================*/
extern u64 gspS2DEX_fifoTextStart[], gspS2DEX_fifoTextEnd[];
extern u64 gspS2DEX_fifoDataStart[], gspS2DEX_fifoDataEnd[];
extern u64 gspS2DEX_fifo_dTextStart[], gspS2DEX_fifo_dTextEnd[];
extern u64 gspS2DEX_fifo_dDataStart[], gspS2DEX_fifo_dDataEnd[];
extern u64 gspS2DEX2_fifoTextStart[], gspS2DEX2_fifoTextEnd[];
extern u64 gspS2DEX2_fifoDataStart[], gspS2DEX2_fifoDataEnd[];
extern u64 gspS2DEX2_xbusTextStart[], gspS2DEX2_xbusTextEnd[];
extern u64 gspS2DEX2_xbusDataStart[], gspS2DEX2_xbusDataEnd[];
extern void guS2DInitBg(uObjBg *);
extern u64 gspS2DEX_fifoTextStart[], gspS2DEX_fifoTextEnd[];
extern u64 gspS2DEX_fifoDataStart[], gspS2DEX_fifoDataEnd[];
extern u64 gspS2DEX_fifo_dTextStart[], gspS2DEX_fifo_dTextEnd[];
extern u64 gspS2DEX_fifo_dDataStart[], gspS2DEX_fifo_dDataEnd[];
extern u64 gspS2DEX2_fifoTextStart[], gspS2DEX2_fifoTextEnd[];
extern u64 gspS2DEX2_fifoDataStart[], gspS2DEX2_fifoDataEnd[];
extern u64 gspS2DEX2_xbusTextStart[], gspS2DEX2_xbusTextEnd[];
extern u64 gspS2DEX2_xbusDataStart[], gspS2DEX2_xbusDataEnd[];
extern void guS2DInitBg(uObjBg*);
#ifdef F3DEX_GBI_2
# define guS2DEmuBgRect1Cyc guS2D2EmuBgRect1Cyc /*Wrapper*/
# define guS2DEmuSetScissor guS2D2EmuSetScissor /*Wrapper*/
extern void guS2D2EmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2D2EmuBgRect1Cyc(Gfx **, uObjBg *);
#ifdef F3DEX_GBI_2
#define guS2DEmuBgRect1Cyc guS2D2EmuBgRect1Cyc /*Wrapper*/
#define guS2DEmuSetScissor guS2D2EmuSetScissor /*Wrapper*/
extern void guS2D2EmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2D2EmuBgRect1Cyc(Gfx**, uObjBg*);
#else
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *);
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2DEmuBgRect1Cyc(Gfx**, uObjBg*);
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
+15 -39
View File
@@ -8,48 +8,24 @@
#define GU_PI 3.1415926
/* Functions */
void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect,
float near, float far, float scale);
void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near,
float far, float scale);
void guFrustum(Mtx *m, float left, float right, float bottom, float top,
float near, float far, float scale);
void guOrtho(Mtx *m, float left, float right, float bottom, float top,
float near, float far, float scale);
void guTranslate(Mtx *m, float x, float y, float z);
void guRotate(Mtx *m, float a, float x, float y, float z);
void guScale(Mtx *m, float x, float y, float z);
void guMtxF2L(float mf[4][4], Mtx *m);
void guMtxIdent(Mtx *m);
void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far, float scale);
void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale);
void guFrustum(Mtx* m, float left, float right, float bottom, float top, float near, float far, float scale);
void guOrtho(Mtx* m, float left, float right, float bottom, float top, float near, float far, float scale);
void guTranslate(Mtx* m, float x, float y, float z);
void guRotate(Mtx* m, float a, float x, float y, float z);
void guScale(Mtx* m, float x, float y, float z);
void guMtxF2L(float mf[4][4], Mtx* m);
void guMtxIdent(Mtx* m);
void guMtxIdentF(float mf[4][4]);
void guMtxL2F(float mf[4][4], Mtx *m);
void guNormalize(float *, float *, float *);
void guMtxL2F(float mf[4][4], Mtx* m);
void guNormalize(float*, float*, float*);
void guLookAt(Mtx*, f32, f32, f32, f32, f32, f32, f32, f32, f32);
void guLookAt(Mtx *,
f32,
f32,
f32,
f32,
f32,
f32,
f32,
f32,
f32);
void guLookAtF(f32[4][4],
f32,
f32,
f32,
f32,
f32,
f32,
f32,
f32,
f32);
void guLookAtF(f32[4][4], f32, f32, f32, f32, f32, f32, f32, f32, f32);
/* Used only in Fast3DEX2 */
void guLookAtReflect (Mtx *m, LookAt *l, float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
void guLookAtReflect(Mtx* m, LookAt* l, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp,
float yUp, float zUp);
#endif
+4 -6
View File
@@ -3,19 +3,17 @@
#include "abi.h"
typedef struct
{
u8 *offset;
typedef struct {
u8* offset;
s32 len;
} ALSeqData;
typedef struct
{
typedef struct {
s16 revision;
s16 seqCount;
ALSeqData seqArray[1];
} ALSeqFile;
void alSeqFileNew(ALSeqFile *f, u8 *base);
void alSeqFileNew(ALSeqFile* f, u8* base);
#endif
+18 -21
View File
@@ -1,5 +1,5 @@
#ifndef _MBI_H_
#define _MBI_H_
#define _MBI_H_
/**************************************************************************
* *
@@ -29,13 +29,12 @@
*
*/
/*
* the SHIFT macros are used to build display list commands, inserting
* bit-fields into a 32-bit word. They take a value, a shift amount,
* bit-fields into a 32-bit word. They take a value, a shift amount,
* and a width.
*
* For the left shift, the lower bits of the value are masked,
* For the left shift, the lower bits of the value are masked,
* then shifted left.
*
* For the right shift, the value is shifted right, then the lower bits
@@ -44,15 +43,13 @@
* (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment)
*
*/
#define _SHIFTL(v, s, w) \
((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
#define _SHIFTR(v, s, w) \
((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
#define _SHIFTL(v, s, w) ((unsigned int) (((unsigned int) (v) & ((0x01 << (w)) - 1)) << (s)))
#define _SHIFTR(v, s, w) ((unsigned int) (((unsigned int) (v) >> (s)) & ((0x01 << (w)) - 1)))
#define _SHIFT _SHIFTL /* old, for compatibility only */
#define _SHIFT _SHIFTL /* old, for compatibility only */
#define G_ON (1)
#define G_OFF (0)
#define G_ON (1)
#define G_OFF (0)
/**************************************************************************
*
@@ -76,11 +73,11 @@
*
**************************************************************************/
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_HVQTASK 6
#define M_HVQMTASK 7
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_HVQTASK 6
#define M_HVQMTASK 7
/**************************************************************************
*
@@ -88,11 +85,11 @@
*
**************************************************************************/
#define NUM_SEGMENTS (16)
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28)
#define SEGMENT_NUMBER2(a) ((unsigned int)(a) >> 24)
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
#define NUM_SEGMENTS (16)
#define SEGMENT_OFFSET(a) ((unsigned int) (a) & 0x00ffffff)
#define SEGMENT_NUMBER(a) (((unsigned int) (a) << 4) >> 28)
#define SEGMENT_NUMBER2(a) ((unsigned int) (a) >> 24)
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
#ifndef NULL
#define NULL 0
+468 -479
View File
File diff suppressed because it is too large Load Diff
+7 -12
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_ai.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:04 $
*---------------------------------------------------------------------*/
#ifndef _OS_AI_H_
#define _OS_AI_H_
#define _OS_AI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -44,7 +44,6 @@ extern "C" {
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -53,7 +52,6 @@ extern "C" {
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
@@ -62,14 +60,12 @@ extern "C" {
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
@@ -77,13 +73,12 @@ extern "C" {
*/
/* Audio interface (Ai) */
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void*, u32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+9 -14
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_cache.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:04 $
*---------------------------------------------------------------------*/
#ifndef _OS_CACHE_H_
#define _OS_CACHE_H_
#define _OS_CACHE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -44,7 +44,6 @@ extern "C" {
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -53,7 +52,6 @@ extern "C" {
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
@@ -62,9 +60,8 @@ extern "C" {
*
*/
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
#define OS_DCACHE_ROUNDUP_ADDR(x) (void*) (((((u32) (x) + 0xf) / 0x10) * 0x10))
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32) (x) + 0xf) / 0x10) * 0x10))
/**************************************************************************
*
@@ -72,7 +69,6 @@ extern "C" {
*
*/
/**************************************************************************
*
* Function prototypes
@@ -81,13 +77,12 @@ extern "C" {
/* Cache operations and macros */
extern void osInvalDCache(void *, size_t);
extern void osInvalICache(void *, size_t);
extern void osWritebackDCache(void *, size_t);
extern void osWritebackDCacheAll(void);
extern void osInvalDCache(void*, size_t);
extern void osInvalICache(void*, size_t);
extern void osWritebackDCache(void*, size_t);
extern void osWritebackDCacheAll(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+80 -86
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_cont.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:05 $
*---------------------------------------------------------------------*/
#ifndef _OS_CONT_H_
#define _OS_CONT_H_
#define _OS_CONT_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -37,7 +37,6 @@ extern "C" {
#include <PR/ultratypes.h>
#include "os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
@@ -47,31 +46,30 @@ extern "C" {
*/
/*
* Structure for controllers
* Structure for controllers
*/
typedef struct {
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errnum;
}OSContStatus;
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errnum;
} OSContStatus;
typedef struct {
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errno;
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errno;
} OSContPad;
typedef struct {
void *address; /* Ram pad Address: 11 bits */
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errno;
void* address; /* Ram pad Address: 11 bits */
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errno;
} OSContRamIo;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -85,83 +83,82 @@ typedef struct {
*/
#ifndef _HW_VERSION_1
#define MAXCONTROLLERS 4
#define MAXCONTROLLERS 4
#else
#define MAXCONTROLLERS 6
#define MAXCONTROLLERS 6
#endif
/* controller errors */
#define CONT_NO_RESPONSE_ERROR 0x8
#define CONT_OVERRUN_ERROR 0x4
#define CONT_NO_RESPONSE_ERROR 0x8
#define CONT_OVERRUN_ERROR 0x4
#ifdef _HW_VERSION_1
#define CONT_FRAME_ERROR 0x2
#define CONT_COLLISION_ERROR 0x1
#endif
#define CONT_FRAME_ERROR 0x2
#define CONT_COLLISION_ERROR 0x1
#endif
/* 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
#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
#define CONT_CARD_ON 0x01
#define CONT_CARD_PULL 0x02
#define CONT_ADDR_CRC_ER 0x04
#define CONT_EEPROM_BUSY 0x80
/* Buttons */
#define CONT_A 0x8000
#define CONT_B 0x4000
#define CONT_G 0x2000
#define CONT_START 0x1000
#define CONT_UP 0x0800
#define CONT_DOWN 0x0400
#define CONT_LEFT 0x0200
#define CONT_RIGHT 0x0100
#define CONT_L 0x0020
#define CONT_R 0x0010
#define CONT_E 0x0008
#define CONT_D 0x0004
#define CONT_C 0x0002
#define CONT_F 0x0001
#define CONT_A 0x8000
#define CONT_B 0x4000
#define CONT_G 0x2000
#define CONT_START 0x1000
#define CONT_UP 0x0800
#define CONT_DOWN 0x0400
#define CONT_LEFT 0x0200
#define CONT_RIGHT 0x0100
#define CONT_L 0x0020
#define CONT_R 0x0010
#define CONT_E 0x0008
#define CONT_D 0x0004
#define CONT_C 0x0002
#define CONT_F 0x0001
/* Nintendo's official button names */
#define A_BUTTON CONT_A
#define B_BUTTON CONT_B
#define L_TRIG CONT_L
#define R_TRIG CONT_R
#define Z_TRIG CONT_G
#define START_BUTTON CONT_START
#define U_JPAD CONT_UP
#define L_JPAD CONT_LEFT
#define R_JPAD CONT_RIGHT
#define D_JPAD CONT_DOWN
#define U_CBUTTONS CONT_E
#define L_CBUTTONS CONT_C
#define R_CBUTTONS CONT_F
#define D_CBUTTONS CONT_D
#define A_BUTTON CONT_A
#define B_BUTTON CONT_B
#define L_TRIG CONT_L
#define R_TRIG CONT_R
#define Z_TRIG CONT_G
#define START_BUTTON CONT_START
#define U_JPAD CONT_UP
#define L_JPAD CONT_LEFT
#define R_JPAD CONT_RIGHT
#define D_JPAD CONT_DOWN
#define U_CBUTTONS CONT_E
#define L_CBUTTONS CONT_C
#define R_CBUTTONS CONT_F
#define D_CBUTTONS CONT_D
/* Controller error number */
#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 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
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -171,14 +168,12 @@ typedef struct {
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
@@ -187,18 +182,17 @@ typedef struct {
/* Controller interface */
extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
extern s32 osContReset(OSMesgQueue *, OSContStatus *);
extern s32 osContStartQuery(OSMesgQueue *);
extern s32 osContStartReadData(OSMesgQueue *);
extern s32 osContInit(OSMesgQueue*, u8*, OSContStatus*);
extern s32 osContReset(OSMesgQueue*, OSContStatus*);
extern s32 osContStartQuery(OSMesgQueue*);
extern s32 osContStartReadData(OSMesgQueue*);
#ifndef _HW_VERSION_1
extern s32 osContSetCh(u8);
extern s32 osContSetCh(u8);
#endif
extern void osContGetQuery(OSContStatus *);
extern void osContGetReadData(OSContPad *);
extern void osContGetQuery(OSContStatus*);
extern void osContGetReadData(OSContPad*);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+13 -19
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_eeprom.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:06 $
*---------------------------------------------------------------------*/
#ifndef _OS_EEPROM_H_
#define _OS_EEPROM_H_
#define _OS_EEPROM_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -37,7 +37,6 @@ extern "C" {
#include <PR/ultratypes.h>
#include "os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
@@ -46,7 +45,6 @@ extern "C" {
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -57,15 +55,14 @@ extern "C" {
/* EEPROM TYPE */
#define EEPROM_TYPE_4K 0x01
#define EEPROM_TYPE_16K 0x02
#define EEPROM_TYPE_4K 0x01
#define EEPROM_TYPE_16K 0x02
/* definition for EEPROM */
#define EEPROM_MAXBLOCKS 64
#define EEP16K_MAXBLOCKS 256
#define EEPROM_BLOCK_SIZE 8
#define EEPROM_MAXBLOCKS 64
#define EEP16K_MAXBLOCKS 256
#define EEPROM_BLOCK_SIZE 8
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -75,14 +72,12 @@ extern "C" {
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
@@ -91,14 +86,13 @@ extern "C" {
/* EEPROM interface */
extern s32 osEepromProbe(OSMesgQueue *);
extern s32 osEepromRead(OSMesgQueue *, u8, u8 *);
extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *);
extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int);
extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int);
extern s32 osEepromProbe(OSMesgQueue*);
extern s32 osEepromRead(OSMesgQueue*, u8, u8*);
extern s32 osEepromWrite(OSMesgQueue*, u8, u8*);
extern s32 osEepromLongRead(OSMesgQueue*, u8, u8*, int);
extern s32 osEepromLongWrite(OSMesgQueue*, u8, u8*, int);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+25 -29
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_exception.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:07 $
*---------------------------------------------------------------------*/
#ifndef _OS_EXCEPTION_H_
#define _OS_EXCEPTION_H_
#define _OS_EXCEPTION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -57,30 +57,29 @@ typedef u32 OSHWIntr;
/* Flags for debugging purpose */
#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */
#define OS_FLAG_FAULT 2 /* CPU fault has occurred */
#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */
#define OS_FLAG_FAULT 2 /* CPU fault has occurred */
/* Interrupt masks */
#define OS_IM_NONE 0x00000001
#define OS_IM_SW1 0x00000501
#define OS_IM_SW2 0x00000601
#define OS_IM_CART 0x00000c01
#define OS_IM_PRENMI 0x00001401
#define OS_IM_RDBWRITE 0x00002401
#define OS_IM_RDBREAD 0x00004401
#define OS_IM_COUNTER 0x00008401
#define OS_IM_CPU 0x0000ff01
#define OS_IM_SP 0x00010401
#define OS_IM_SI 0x00020401
#define OS_IM_AI 0x00040401
#define OS_IM_VI 0x00080401
#define OS_IM_PI 0x00100401
#define OS_IM_DP 0x00200401
#define OS_IM_ALL 0x003fff01
#define RCP_IMASK 0x003f0000
#define RCP_IMASKSHIFT 16
#define OS_IM_NONE 0x00000001
#define OS_IM_SW1 0x00000501
#define OS_IM_SW2 0x00000601
#define OS_IM_CART 0x00000c01
#define OS_IM_PRENMI 0x00001401
#define OS_IM_RDBWRITE 0x00002401
#define OS_IM_RDBREAD 0x00004401
#define OS_IM_COUNTER 0x00008401
#define OS_IM_CPU 0x0000ff01
#define OS_IM_SP 0x00010401
#define OS_IM_SI 0x00020401
#define OS_IM_AI 0x00040401
#define OS_IM_VI 0x00080401
#define OS_IM_PI 0x00100401
#define OS_IM_DP 0x00200401
#define OS_IM_ALL 0x003fff01
#define RCP_IMASK 0x003f0000
#define RCP_IMASKSHIFT 16
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -90,14 +89,12 @@ typedef u32 OSHWIntr;
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
@@ -106,11 +103,10 @@ typedef u32 OSHWIntr;
/* Interrupt operations */
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+2 -2
View File
@@ -6,13 +6,13 @@
/* Variables */
//extern u64 osClockRate;
// extern u64 osClockRate;
/* Functions */
/*u32 __osProbeTLB(void *);
u32 __osDisableInt(void);
void __osRestoreInt(u32);*/
OSThread *__osGetCurrFaultedThread(void);
OSThread* __osGetCurrFaultedThread(void);
#endif
+2 -2
View File
@@ -4,7 +4,7 @@
#include "ultratypes.h"
// Old deprecated functions from strings.h, replaced by memcpy/memset.
extern void bcopy(const void *, void *, size_t);
extern void bzero(void *, size_t);
extern void bcopy(const void*, void*, size_t);
extern void bzero(void*, size_t);
#endif /* !_OS_LIBC_H_ */
+47 -52
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_message.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:15 $
*---------------------------------------------------------------------*/
#ifndef _OS_MESSAGE_H_
#define _OS_MESSAGE_H_
#define _OS_MESSAGE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -50,23 +50,22 @@ typedef u32 OSEvent;
/*
* Structure for message
*/
typedef void * OSMesg;
typedef void* OSMesg;
/*
* Structure for message queue
*/
typedef struct OSMesgQueue_s {
OSThread *mtqueue; /* Queue to store threads blocked
on empty mailboxes (receive) */
OSThread *fullqueue; /* Queue to store threads blocked
on full mailboxes (send) */
s32 validCount; /* Contains number of valid message */
s32 first; /* Points to first valid message */
s32 msgCount; /* Contains total # of messages */
OSMesg *msg; /* Points to message buffer array */
OSThread* mtqueue; /* Queue to store threads blocked
on empty mailboxes (receive) */
OSThread* fullqueue; /* Queue to store threads blocked
on full mailboxes (send) */
s32 validCount; /* Contains number of valid message */
s32 first; /* Points to first valid message */
s32 msgCount; /* Contains total # of messages */
OSMesg* msg; /* Points to message buffer array */
} OSMesgQueue;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -77,42 +76,41 @@ typedef struct OSMesgQueue_s {
/* Events */
#ifdef _FINALROM
#define OS_NUM_EVENTS 15
#define OS_NUM_EVENTS 15
#else
#define OS_NUM_EVENTS 23
#define OS_NUM_EVENTS 23
#endif
#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
#define OS_EVENT_SP 4 /* SP task done interrupt */
#define OS_EVENT_SI 5 /* SI (controller) interrupt */
#define OS_EVENT_AI 6 /* AI interrupt */
#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
#define OS_EVENT_DP 9 /* DP full sync interrupt */
#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
#define OS_EVENT_SP 4 /* SP task done interrupt */
#define OS_EVENT_SI 5 /* SI (controller) interrupt */
#define OS_EVENT_AI 6 /* AI interrupt */
#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
#define OS_EVENT_DP 9 /* DP full sync interrupt */
#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
#ifndef _FINALROM
#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
#define OS_EVENT_RDB_DBG_DONE 20
#define OS_EVENT_RDB_FLUSH_PROF 21
#define OS_EVENT_RDB_ACK_PROF 22
#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
#define OS_EVENT_RDB_DBG_DONE 20
#define OS_EVENT_RDB_FLUSH_PROF 21
#define OS_EVENT_RDB_ACK_PROF 22
#endif
/* Flags to turn blocking on/off when sending/receiving message */
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -123,12 +121,11 @@ typedef struct OSMesgQueue_s {
*/
/* Get count of valid messages in queue */
#define MQ_GET_COUNT(mq) ((mq)->validCount)
#define MQ_GET_COUNT(mq) ((mq)->validCount)
/* Figure out if message queue is empty or full */
#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
/**************************************************************************
*
@@ -136,7 +133,6 @@ typedef struct OSMesgQueue_s {
*
*/
/**************************************************************************
*
* Function prototypes
@@ -145,17 +141,16 @@ typedef struct OSMesgQueue_s {
/* Message operations */
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
extern void osCreateMesgQueue(OSMesgQueue*, OSMesg*, s32);
extern s32 osSendMesg(OSMesgQueue*, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue*, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue*, OSMesg*, s32);
/* Event operations */
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
extern void osSetEventMesg(OSEvent, OSMesgQueue*, OSMesg);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+1 -1
View File
@@ -6,6 +6,6 @@
void osInitialize(void);
u32 osGetCount(void);
uintptr_t osVirtualToPhysical(void *);
uintptr_t osVirtualToPhysical(void*);
#endif
+19 -19
View File
@@ -6,27 +6,27 @@
/* Types */
typedef struct {
void *dramAddr;
void *C2Addr;
void* dramAddr;
void* C2Addr;
u32 sectorSize;
u32 C1ErrNum;
u32 C1ErrSector[4];
} __OSBlockInfo;
typedef struct {
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
s32 sectorNum; // 8
uintptr_t devAddr; // c
u32 errStatus; //error status added moved to blockinfo
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
s32 sectorNum; // 8
uintptr_t devAddr; // c
u32 errStatus; // error status added moved to blockinfo
u32 bmCtlShadow; // 10
u32 seqCtlShadow; // 14
__OSBlockInfo block[2]; // 18
} __OSTranxInfo;
typedef struct OSPiHandle_s {
struct OSPiHandle_s *next;
struct OSPiHandle_s* next;
u8 type;
u8 latency;
u8 pageSize;
@@ -47,15 +47,15 @@ typedef struct {
u16 type;
u8 pri;
u8 status;
OSMesgQueue *retQueue;
OSMesgQueue* retQueue;
} OSIoMesgHdr;
typedef struct {
/*0x00*/ OSIoMesgHdr hdr;
/*0x08*/ void *dramAddr;
/*0x08*/ void* dramAddr;
/*0x0C*/ uintptr_t devAddr;
/*0x10*/ size_t size;
OSPiHandle *piHandle; // from the official definition
OSPiHandle* piHandle; // from the official definition
} OSIoMesg;
/* Definitions */
@@ -68,13 +68,13 @@ typedef struct {
/* Functions */
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
size_t nbytes, OSMesgQueue *mq);
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
OSMesgQueue *osPiGetCmdQueue(void);
s32 osPiStartDma(OSIoMesg* mb, s32 priority, s32 direction, uintptr_t devAddr, void* vAddr, size_t nbytes,
OSMesgQueue* mq);
void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt);
OSMesgQueue* osPiGetCmdQueue(void);
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
s32 osPiReadIo(uintptr_t devAddr, u32* data);
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void* dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle* piHandle, s32 dir, u32 cart_addr, void* dram_addr, size_t size);
#endif
+7 -12
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_rdp.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:16 $
*---------------------------------------------------------------------*/
#ifndef _OS_RDP_H_
#define _OS_RDP_H_
#define _OS_RDP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -44,7 +44,6 @@ extern "C" {
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -53,7 +52,6 @@ extern "C" {
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
@@ -62,14 +60,12 @@ extern "C" {
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
@@ -77,13 +73,12 @@ extern "C" {
*/
/* Display processor interface (Dp) */
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32*);
extern s32 osDpSetNextBuffer(void*, u64);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+34 -37
View File
@@ -2,74 +2,71 @@
#define _ULTRA64_THREAD_H_
#include "ultratypes.h"
/* Recommended priorities for system threads */
#define OS_PRIORITY_MAX 255
#define OS_PRIORITY_VIMGR 254
#define OS_PRIORITY_RMON 250
#define OS_PRIORITY_MAX 255
#define OS_PRIORITY_VIMGR 254
#define OS_PRIORITY_RMON 250
#define OS_PRIORITY_RMONSPIN 200
#define OS_PRIORITY_PIMGR 150
#define OS_PRIORITY_SIMGR 140
#define OS_PRIORITY_APPMAX 127
#define OS_PRIORITY_IDLE 0
#define OS_PRIORITY_PIMGR 150
#define OS_PRIORITY_SIMGR 140
#define OS_PRIORITY_APPMAX 127
#define OS_PRIORITY_IDLE 0
#define OS_STATE_STOPPED 1
#define OS_STATE_RUNNABLE 2
#define OS_STATE_RUNNING 4
#define OS_STATE_WAITING 8
#define OS_STATE_STOPPED 1
#define OS_STATE_RUNNABLE 2
#define OS_STATE_RUNNING 4
#define OS_STATE_WAITING 8
/* Types */
typedef s32 OSPri;
typedef s32 OSId;
typedef union
{
struct {f32 f_odd; f32 f_even;} f;
typedef union {
struct {
f32 f_odd;
f32 f_even;
} f;
} __OSfp;
typedef struct
{
typedef struct {
/* registers */
/*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
/*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
/*0x108*/ u64 lo, hi;
/*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
/*0x12C*/ u32 fpcsr;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
} __OSThreadContext;
typedef struct
{
typedef struct {
u32 flag;
u32 count;
u64 time;
} __OSThreadprofile_s;
typedef struct OSThread_s
{
/*0x00*/ struct OSThread_s *next;
typedef struct OSThread_s {
/*0x00*/ struct OSThread_s* next;
/*0x04*/ OSPri priority;
/*0x08*/ struct OSThread_s **queue;
/*0x0C*/ struct OSThread_s *tlnext;
/*0x08*/ struct OSThread_s** queue;
/*0x0C*/ struct OSThread_s* tlnext;
/*0x10*/ u16 state;
/*0x12*/ u16 flags;
/*0x14*/ OSId id;
/*0x18*/ int fp;
/*0x1C*/ __OSThreadprofile_s *thprof;
/*0x1C*/ __OSThreadprofile_s* thprof;
/*0x20*/ __OSThreadContext context;
} OSThread;
/* Functions */
void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *),
void *arg, void *sp, OSPri pri);
OSId osGetThreadId(OSThread *thread);
OSPri osGetThreadPri(OSThread *thread);
void osSetThreadPri(OSThread *thread, OSPri pri);
void osStartThread(OSThread *thread);
void osStopThread(OSThread *thread);
void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri);
OSId osGetThreadId(OSThread* thread);
OSPri osGetThreadPri(OSThread* thread);
void osSetThreadPri(OSThread* thread, OSPri pri);
void osStartThread(OSThread* thread);
void osStopThread(OSThread* thread);
#endif
+6 -7
View File
@@ -6,14 +6,13 @@
/* Types */
typedef struct OSTimer_str
{
struct OSTimer_str *next;
struct OSTimer_str *prev;
typedef struct OSTimer_str {
struct OSTimer_str* next;
struct OSTimer_str* prev;
u64 interval;
u64 remaining;
OSMesgQueue *mq;
OSMesg *msg;
OSMesgQueue* mq;
OSMesg* msg;
} OSTimer;
typedef u64 OSTime;
@@ -22,6 +21,6 @@ typedef u64 OSTime;
OSTime osGetTime(void);
void osSetTime(OSTime time);
u32 osSetTimer(OSTimer *, OSTime, u64, OSMesgQueue *, OSMesg);
u32 osSetTimer(OSTimer*, OSTime, u64, OSMesgQueue*, OSMesg);
#endif
+15 -20
View File
@@ -21,14 +21,14 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_tlb.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:20 $
*---------------------------------------------------------------------*/
#ifndef _OS_TLB_H_
#define _OS_TLB_H_
#define _OS_TLB_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -46,7 +46,6 @@ extern "C" {
typedef u32 OSPageMask;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
@@ -58,14 +57,13 @@ typedef u32 OSPageMask;
/*
* Page size argument for TLB routines
*/
#define OS_PM_4K 0x0000000
#define OS_PM_16K 0x0006000
#define OS_PM_64K 0x001e000
#define OS_PM_256K 0x007e000
#define OS_PM_1M 0x01fe000
#define OS_PM_4M 0x07fe000
#define OS_PM_16M 0x1ffe000
#define OS_PM_4K 0x0000000
#define OS_PM_16K 0x0006000
#define OS_PM_64K 0x001e000
#define OS_PM_256K 0x007e000
#define OS_PM_1M 0x01fe000
#define OS_PM_4M 0x07fe000
#define OS_PM_16M 0x1ffe000
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -75,14 +73,12 @@ typedef u32 OSPageMask;
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
@@ -91,14 +87,13 @@ typedef u32 OSPageMask;
/* TLB management routines */
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
extern void osMapTLB(s32, OSPageMask, void*, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
+40 -48
View File
@@ -6,7 +6,6 @@
/* Ultra64 Video Interface */
/* Special Features */
#define OS_VI_GAMMA_ON 0x0001
#define OS_VI_GAMMA_OFF 0x0002
@@ -24,11 +23,9 @@
#define OS_VI_UNK200 0x200
#define OS_VI_UNK100 0x100
/* Types */
typedef struct
{
typedef struct {
u32 ctrl;
u32 width;
u32 burst;
@@ -40,8 +37,7 @@ typedef struct
u32 vCurrent;
} OSViCommonRegs;
typedef struct
{
typedef struct {
u32 origin;
u32 yScale;
u32 vStart;
@@ -49,22 +45,20 @@ typedef struct
u32 vIntr;
} OSViFieldRegs;
typedef struct
{
typedef struct {
u8 type;
OSViCommonRegs comRegs;
OSViFieldRegs fldRegs[2];
} OSViMode;
typedef struct
{
/* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10
typedef struct {
/* 0x00 */ u16 unk00; // some kind of flags. swap buffer sets to 0x10
/* 0x02 */ u16 retraceCount;
/* 0x04 */ void* buffer;
/* 0x08 */ OSViMode *modep;
/* 0x08 */ OSViMode* modep;
/* 0x0c */ u32 features;
/* 0x10 */ OSMesgQueue *mq;
/* 0x14 */ OSMesg *msg;
/* 0x10 */ OSMesgQueue* mq;
/* 0x14 */ OSMesg* msg;
/* 0x18 */ u32 unk18;
/* 0x1c */ u32 unk1c;
/* 0x20 */ u32 unk20;
@@ -74,44 +68,42 @@ typedef struct
} OSViContext;
void osCreateViManager(OSPri pri);
void osViSetMode(OSViMode *mode);
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
void osViSetMode(OSViMode* mode);
void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount);
void osViBlack(u8 active);
void osViSetSpecialFeatures(u32 func);
void osViSwapBuffer(void *vaddr);
void osViSwapBuffer(void* vaddr);
#define OS_VI_NTSC_LPN1 0 /* NTSC */
#define OS_VI_NTSC_LPF1 1
#define OS_VI_NTSC_LAN1 2
#define OS_VI_NTSC_LAF1 3
#define OS_VI_NTSC_LPN2 4
#define OS_VI_NTSC_LPF2 5
#define OS_VI_NTSC_LAN2 6
#define OS_VI_NTSC_LAF2 7
#define OS_VI_NTSC_HPN1 8
#define OS_VI_NTSC_HPF1 9
#define OS_VI_NTSC_HAN1 10
#define OS_VI_NTSC_HAF1 11
#define OS_VI_NTSC_HPN2 12
#define OS_VI_NTSC_HPF2 13
#define OS_VI_NTSC_LPN1 0 /* NTSC */
#define OS_VI_NTSC_LPF1 1
#define OS_VI_NTSC_LAN1 2
#define OS_VI_NTSC_LAF1 3
#define OS_VI_NTSC_LPN2 4
#define OS_VI_NTSC_LPF2 5
#define OS_VI_NTSC_LAN2 6
#define OS_VI_NTSC_LAF2 7
#define OS_VI_NTSC_HPN1 8
#define OS_VI_NTSC_HPF1 9
#define OS_VI_NTSC_HAN1 10
#define OS_VI_NTSC_HAF1 11
#define OS_VI_NTSC_HPN2 12
#define OS_VI_NTSC_HPF2 13
#define OS_VI_PAL_LPN1 14 /* PAL */
#define OS_VI_PAL_LPF1 15
#define OS_VI_PAL_LAN1 16
#define OS_VI_PAL_LAF1 17
#define OS_VI_PAL_LPN2 18
#define OS_VI_PAL_LPF2 19
#define OS_VI_PAL_LAN2 20
#define OS_VI_PAL_LAF2 21
#define OS_VI_PAL_HPN1 22
#define OS_VI_PAL_HPF1 23
#define OS_VI_PAL_HAN1 24
#define OS_VI_PAL_HAF1 25
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
extern OSViMode osViModeTable[]; /* Global VI mode table */
#define OS_VI_PAL_LPN1 14 /* PAL */
#define OS_VI_PAL_LPF1 15
#define OS_VI_PAL_LAN1 16
#define OS_VI_PAL_LAF1 17
#define OS_VI_PAL_LPN2 18
#define OS_VI_PAL_LPF2 19
#define OS_VI_PAL_LAN2 20
#define OS_VI_PAL_LAF2 21
#define OS_VI_PAL_HPN1 22
#define OS_VI_PAL_HPF1 23
#define OS_VI_PAL_HAN1 24
#define OS_VI_PAL_HAF1 25
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
extern OSViMode osViModeTable[]; /* Global VI mode table */
#endif
+373 -393
View File
File diff suppressed because it is too large Load Diff
+23 -26
View File
@@ -19,7 +19,7 @@
**************************************************************************/
#ifndef _SPTASK_H_
#define _SPTASK_H_
#define _SPTASK_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
@@ -50,7 +50,7 @@ extern "C" {
* - pointer to ucode
* - size of ucode
* - pointer to initial DMEM data
* - size of initial DMEM data
* - size of initial DMEM data
* - pointer to DRAM stack
* - size of DRAM stack (max)
* - pointer to output buffer
@@ -71,30 +71,29 @@ extern "C" {
* any necessary translation.
*
*/
typedef struct
{
typedef struct {
/*0x00*/ u32 type;
/*0x04*/ u32 flags;
/*0x08*/ u64 *ucode_boot;
/*0x08*/ u64* ucode_boot;
/*0x0C*/ u32 ucode_boot_size;
/*0x10*/ u64 *ucode;
/*0x10*/ u64* ucode;
/*0x14*/ u32 ucode_size;
/*0x18*/ u64 *ucode_data;
/*0x18*/ u64* ucode_data;
/*0x1C*/ u32 ucode_data_size;
/*0x20*/ u64 *dram_stack;
/*0x20*/ u64* dram_stack;
/*0x24*/ u32 dram_stack_size;
/*0x28*/ u64 *output_buff;
/*0x2C*/ u64 *output_buff_size;
/*0x28*/ u64* output_buff;
/*0x2C*/ u64* output_buff_size;
/*0x30*/ u64 *data_ptr;
/*0x30*/ u64* data_ptr;
/*0x34*/ u32 data_size;
/*0x38*/ u64 *yield_data_ptr;
/*0x38*/ u64* yield_data_ptr;
/*0x3C*/ u32 yield_data_size;
} OSTask_t; // size = 0x40
@@ -106,21 +105,20 @@ typedef union {
typedef u32 OSYieldResult;
#endif /* _LANGUAGE_C */
/*
* Task Flags field
*/
#define OS_TASK_YIELDED 0x0001
#define OS_TASK_DP_WAIT 0x0002
#define OS_TASK_LOADABLE 0x0004
#define OS_TASK_SP_ONLY 0x0008
#define OS_TASK_USR0 0x0010
#define OS_TASK_USR1 0x0020
#define OS_TASK_USR2 0x0040
#define OS_TASK_USR3 0x0080
#define OS_TASK_YIELDED 0x0001
#define OS_TASK_DP_WAIT 0x0002
#define OS_TASK_LOADABLE 0x0004
#define OS_TASK_SP_ONLY 0x0008
#define OS_TASK_USR0 0x0010
#define OS_TASK_USR1 0x0020
#define OS_TASK_USR2 0x0040
#define OS_TASK_USR3 0x0080
/*
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
* buffer of this size. (The size is in bytes). ONLY If the task will NEVER
* yield it may be a null pointer. The buffer must be aligned to a 64 bit
* boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
@@ -205,7 +203,6 @@ typedef u32 OSYieldResult;
*
*/
/**************************************************************************
*
* Function prototypes
@@ -215,11 +212,11 @@ typedef u32 OSYieldResult;
/*
* break this up into two steps for debugging.
*/
extern void osSpTaskLoad(OSTask *task);
extern void osSpTaskStartGo(OSTask *task);
extern void osSpTaskLoad(OSTask* task);
extern void osSpTaskStartGo(OSTask* task);
extern void osSpTaskYield(void);
extern OSYieldResult osSpTaskYielded(OSTask *task);
extern OSYieldResult osSpTaskYielded(OSTask* task);
#endif /* _LANGUAGE_C */
+2 -2
View File
@@ -2,8 +2,8 @@
#define _ULTRA64_UCODE_H_
#define SP_DRAM_STACK_SIZE8 0x400
#define SP_UCODE_SIZE 0x1000
#define SP_UCODE_DATA_SIZE 0x800
#define SP_UCODE_SIZE 0x1000
#define SP_UCODE_DATA_SIZE 0x800
// standard boot ucode
extern u64 rspF3DBootStart[], rspF3DBootEnd[];
+14 -14
View File
@@ -2,43 +2,43 @@
#define _ULTRA64_TYPES_H_
#ifndef NULL
#define NULL (void *)0
#define NULL (void*) 0
#endif
#define true 1
#define false 0
typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long int s64;
typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long int s64;
typedef unsigned long long int u64;
#define bool signed int
typedef signed char bool8;
typedef unsigned char ubool8;
typedef signed char bool8;
typedef unsigned char ubool8;
typedef volatile u8 vu8;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef float f32;
typedef float f32;
typedef double f64;
#ifdef TARGET_N64
typedef u32 size_t;
typedef s32 ssize_t;
typedef u32 uintptr_t;
typedef u8 uint8_t;
typedef u8 uint8_t;
typedef s32 intptr_t;
typedef s32 ptrdiff_t;
#else
+35 -32
View File
@@ -5,33 +5,33 @@
#include <macros.h>
#include <common_structs.h>
//#pragma GCC diagnostic push
//#pragma GCC diagnostic ignored "-Wmicrosoft-extension"
//#pragma GCC diagnostic ignored "-Wmissing-member-name-in-structure-/-union"
// #pragma GCC diagnostic push
// #pragma GCC diagnostic ignored "-Wmicrosoft-extension"
// #pragma GCC diagnostic ignored "-Wmissing-member-name-in-structure-/-union"
/**
* gActorList should be understood to be populated by generic Actor structs.
* However, for human readability, many functions interacting with actor list elements expect one of the many
* specialized types found in this file.
*
*
* Note that specialized types must be the same size as a plain Actor. Don't be mislead into thinking that
* because its a separate type that it can modified separately from plain Actor. If you modify/add an actor type
* and its size is different from plain Actor's, you WILL run into buggy (potentially crash inducing) behaviour.
*
*
* Specialized structs are customizable so long as the following member specifications are met:
*
*
* In general:
* 0x00 -> s16 type
* 0x02 -> s16 flags
* 0x30 -> Collision unk30
*
*
* If player can collide with the actor:
* 0x0C -> f32 boundingBoxSize
*
*
* If the actor makes sound (necessary for doppler/volume stuff):
* 0x18 -> Vec3f pos
* 0x24 -> Vec3f velocity
*
*
* Other members are more flexible, and even the non-general specifications can be ignored IF AND ONLY IF you know
* exactly what you're doing.
*/
@@ -90,16 +90,16 @@ enum ActorType {
// Actor shell->state (green, red and blue)
enum ShellState {
HELD_SHELL, // Single shell that has not been dropped. (probably holding Z).
RELEASED_SHELL, // This is the short window where single shells aren't being held or launched.
MOVING_SHELL, // Moving towards its target after being shot.
RED_SHELL_LOCK_ON, // Red shell is targeting.
TRIPLE_GREEN_SHELL, // Loses triple shell state when shot.
GREEN_SHELL_HIT_A_RACER, // A racer has been hit by a green shell.
TRIPLE_RED_SHELL, // Loses triple shell state when shot.
DESTROYED_SHELL, // Collision with the shell.
BLUE_SHELL_LOCK_ON, // A blue shell has found a target and is hastily approaching it.
BLUE_SHELL_TARGET_ELIMINATED // Mission completed, well done boss.
HELD_SHELL, // Single shell that has not been dropped. (probably holding Z).
RELEASED_SHELL, // This is the short window where single shells aren't being held or launched.
MOVING_SHELL, // Moving towards its target after being shot.
RED_SHELL_LOCK_ON, // Red shell is targeting.
TRIPLE_GREEN_SHELL, // Loses triple shell state when shot.
GREEN_SHELL_HIT_A_RACER, // A racer has been hit by a green shell.
TRIPLE_RED_SHELL, // Loses triple shell state when shot.
DESTROYED_SHELL, // Collision with the shell.
BLUE_SHELL_LOCK_ON, // A blue shell has found a target and is hastily approaching it.
BLUE_SHELL_TARGET_ELIMINATED // Mission completed, well done boss.
};
// Actor banana->state
@@ -113,7 +113,7 @@ enum BananaState {
};
// Actor fakeItemBox->state
#define HELD_FAKE_ITEM_BOX 0 // Item box is being held be Z.
#define HELD_FAKE_ITEM_BOX 0 // Item box is being held be Z.
#define FAKE_ITEM_BOX_ON_GROUND 1 // Item box is on the ground.
#define DESTROYED_FAKE_ITEM_BOX 2 // Collision with fake item box.
@@ -200,7 +200,7 @@ struct ActorSpawnData {
* So, this struct type acts as both spawn data AND a stripped down Actor for those trees.
* Give the tree a position, a byte for flags stuffed into an s16 used to indicate tree sub-type,
* and an s16 containing as the tree's original Y position.
**/
**/
struct UnkActorSpawnData {
/* 0x00 */ Vec3s pos;
// Techinically only the bottom byte of someId is the "id". The top byte is used for flags.
@@ -230,9 +230,11 @@ struct YoshiValleyEgg {
struct KiwanoFruit {
/* 0x00 */ s16 type;
/* 0x02 */ s16 flags;
/* 0x04 */ s16 targetPlayer; // Id of the player this actor tracks. Each player has their own kiwano actor just for them
/* 0x04 */ s16
targetPlayer; // Id of the player this actor tracks. Each player has their own kiwano actor just for them
/* 0x06 */ s16 state;
/* 0x08 */ f32 bonkTimer; // bonkState? Not sure what this is tracking, but its some form of count down that starts after the fruit hits you
/* 0x08 */ f32 bonkTimer; // bonkState? Not sure what this is tracking, but its some form of count down that starts
// after the fruit hits you
/* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ s16 animState;
/* 0x12 */ s16 animTimer;
@@ -315,8 +317,9 @@ struct ShellActor {
/* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ s16 rotVelocity; // Change in rotAngle on a per-update basis
union {
/* 0x12 */ s16 rotAngle; // Angle of rotation around player (or parent?), not the rotation of the shell itself
/* 0x12 */ u16 pathIndex; // Index in the set of points that make up the "path" the red/blue shell follows (may be GP mode exclusive)
/* 0x12 */ s16 rotAngle; // Angle of rotation around player (or parent?), not the rotation of the shell itself
/* 0x12 */ u16 pathIndex; // Index in the set of points that make up the "path" the red/blue shell follows (may
// be GP mode exclusive)
};
/* 0x14 */ s16 playerId; // Id of the player that "owns" the shell
/* 0x16 */ s16 unk_16;
@@ -331,8 +334,8 @@ struct ItemBox {
/* 0x04 */ s16 someTimer;
/* 0x06 */ s16 state;
/* 0x08 */ f32 resetDistance; // Value added to the Y position when box is touched. Expected to be negative
// Distance at which a player can activate the item box
// Named "bounding box" to match the name used for the "size" of a kart
// Distance at which a player can activate the item box
// Named "bounding box" to match the name used for the "size" of a kart
/* 0x0C */ f32 boundingBoxSize;
/* 0x10 */ Vec3s rot;
/* 0x16 */ s16 unk_16;
@@ -366,7 +369,7 @@ struct BananaBunchParent {
/* 0x06 */ s16 state;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
/* 0x10 */ s16 playerId; // Player that own the bananas
/* 0x10 */ s16 playerId; // Player that own the bananas
/* 0x12 */ s16 bananaIndices[5]; // Indices in gActorList for the bananas owned by this parent
/* 0x1C */ s16 bananasAvailable;
/* 0x1E */ s16 unk_1E;
@@ -385,9 +388,9 @@ struct BananaActor {
union {
/* 0x10 */ Vec3s rot;
struct {
/* 0x10 */ s16 playerId; // Id of the player that owns this banana
/* 0x12 */ s16 elderIndex; // Index in gActorList of the next-oldest banana in the bunch
/* 0x14 */ s16 youngerIndex; // Index in gActorList of the next-youngest banana in the bunch
/* 0x10 */ s16 playerId; // Id of the player that owns this banana
/* 0x12 */ s16 elderIndex; // Index in gActorList of the next-oldest banana in the bunch
/* 0x14 */ s16 youngerIndex; // Index in gActorList of the next-youngest banana in the bunch
};
};
/* 0x16 */ s16 unk_16;
@@ -396,6 +399,6 @@ struct BananaActor {
/* 0x30 */ Collision unk30;
}; // size = 0x70
//#pragma GCC diagnostic pop
// #pragma GCC diagnostic pop
#endif // ACTOR_TYPES_H
+38 -38
View File
@@ -4,53 +4,53 @@
#include <common_structs.h>
#include <mk64.h>
#define NUM_BOMB_KARTS_MAX 7
#define NUM_BOMB_KARTS_MAX 7
#define NUM_BOMB_KARTS_VERSUS 7
#define NUM_BOMB_KARTS_BATTLE 4
#define BOMB_STATE_INACTIVE 0
#define BOMB_STATE_CCW 1
#define BOMB_STATE_CW 2
#define BOMB_STATE_INACTIVE 0
#define BOMB_STATE_CCW 1
#define BOMB_STATE_CW 2
#define BOMB_STATE_STATIONARY 3 // Paused?
#define BOMB_STATE_EXPLODED 4 // Or maybe exploding?
#define BOMB_STATE_UNKNOWN 5
#define BOMB_STATE_EXPLODED 4 // Or maybe exploding?
#define BOMB_STATE_UNKNOWN 5
typedef struct {
/* 0x00 */ u16 waypointIndex;
/* 0x02 */ u16 startingState;
/* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in BombKart
/* 0x08 */ f32 startingXPos;
/* 0x0C */ f32 startingZPos;
/**
* These 2 never seem to get referenced. They also only have non-zero
* data for the Yoshi Valley set of spawns
**/
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
/* 0x00 */ u16 waypointIndex;
/* 0x02 */ u16 startingState;
/* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in BombKart
/* 0x08 */ f32 startingXPos;
/* 0x0C */ f32 startingZPos;
/**
* These 2 never seem to get referenced. They also only have non-zero
* data for the Yoshi Valley set of spawns
**/
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
} BombKartSpawn; // size = 0x18
typedef struct {
/**
* This struct is in part representative of the
* bomb kart hazards in VS mode.
* There may be objects associated with them too
**/
/* 0x00 */ Vec3f bombPos;
/* 0x0C */ Vec3f wheel1Pos;
/* 0x18 */ Vec3f wheel2Pos;
/* 0x24 */ Vec3f wheel3Pos;
/* 0x30 */ Vec3f wheel4Pos;
/* 0x3C */ f32 unk_3C;
/* 0x40 */ u16 someRot; // seems like an angle of some variety, can't figure out its purpose
/* 0x42 */ u16 waypointIndex; // probably the waypoint that the bomb circles
/* 0x44 */ u16 state;
/* 0x46 */ u16 bounceTimer; // timer? state? height?
/* 0x48 */ u16 circleTimer; // timer? state? Somehow controls how it circles around
/* 0x4A */ u16 unk_4A;
/* 0x4C */ s16 unk_4C;
/* 0x4E */ // s16 compilerPadding;
/* 0x50 */ f32 yPos; // Y position of the center of the circle
} BombKart; // size = 0x54
/**
* This struct is in part representative of the
* bomb kart hazards in VS mode.
* There may be objects associated with them too
**/
/* 0x00 */ Vec3f bombPos;
/* 0x0C */ Vec3f wheel1Pos;
/* 0x18 */ Vec3f wheel2Pos;
/* 0x24 */ Vec3f wheel3Pos;
/* 0x30 */ Vec3f wheel4Pos;
/* 0x3C */ f32 unk_3C;
/* 0x40 */ u16 someRot; // seems like an angle of some variety, can't figure out its purpose
/* 0x42 */ u16 waypointIndex; // probably the waypoint that the bomb circles
/* 0x44 */ u16 state;
/* 0x46 */ u16 bounceTimer; // timer? state? height?
/* 0x48 */ u16 circleTimer; // timer? state? Somehow controls how it circles around
/* 0x4A */ u16 unk_4A;
/* 0x4C */ s16 unk_4C;
/* 0x4E */ // s16 compilerPadding;
/* 0x50 */ f32 yPos; // Y position of the center of the circle
} BombKart; // size = 0x54
//! Indexes for the objects associated with the Bomb Karts
extern s32 gIndexObjectBombKart[NUM_BOMB_KARTS_MAX];
+72 -77
View File
@@ -16,20 +16,13 @@ typedef f32 Mat3[3][3];
typedef f32 Mat4[4][4];
// might not be real, used by func_8002C954
typedef struct
{
f32 x, y, z;
typedef struct {
f32 x, y, z;
} Vec3fs;
// This was added as a silly idea:
// In the data to use "A, B, Z, R" instead of hex numbers.
typedef enum {
A = 0x80,
B = 0x40,
Z = 0x20,
R = 0x10
} GhostController;
typedef enum { A = 0x80, B = 0x40, Z = 0x20, R = 0x10 } GhostController;
/*** types.h ***/
@@ -47,17 +40,15 @@ enum SpTaskState {
SPTASK_STATE_FINISHED_DP
};
struct SPTask
{
struct SPTask {
/*0x00*/ OSTask task;
/*0x40*/ OSMesgQueue *msgqueue;
/*0x40*/ OSMesgQueue* msgqueue;
/*0x44*/ OSMesg msg;
/*0x48*/ enum SpTaskState state;
}; // size = 0x4C, align = 0x8
struct VblankHandler
{
OSMesgQueue *queue;
struct VblankHandler {
OSMesgQueue* queue;
OSMesg msg;
};
@@ -75,8 +66,8 @@ struct Controller {
u16 buttonPressed; // OnTriggered
u16 buttonDepressed; // OffTriggered
u16 stickDirection;
u16 stickPressed; // OffTriggered
u16 stickDepressed; // OnTriggered
u16 stickPressed; // OffTriggered
u16 stickDepressed; // OnTriggered
};
// Camera path struct? Or something like that. For GP race won scene?
@@ -119,14 +110,17 @@ struct UnkStruct_802B53C8 {
// end math util structs
struct UnkStruct_800DDB68 {
s32 *D_800ED600; s32 *D_800ED608; s32 *D_800ED610; s32 *D_800ED618;
s32 *D_800ED620; s32 *D_800ED628; s32 *D_800ED630; s32 *D_800ED638;
s32* D_800ED600;
s32* D_800ED608;
s32* D_800ED610;
s32* D_800ED618;
s32* D_800ED620;
s32* D_800ED628;
s32* D_800ED630;
s32* D_800ED638;
};
/*** Types.h end ***/
typedef struct {
u8 button;
s8 frameDuration;
@@ -182,9 +176,9 @@ typedef struct {
// This struct is almost identical to the GBI Vtx_t type,
// except that its missing the "flag" member.
typedef struct {
s16 ob[3]; /* x, y, z */
s16 tc[2]; /* texture coord */
s8 ca[4]; /* color & alpha */
s16 ob[3]; /* x, y, z */
s16 tc[2]; /* texture coord */
s8 ca[4]; /* color & alpha */
} CourseVtx;
/*
@@ -195,25 +189,25 @@ The original author is assumed to be RenaKunisaki
*/
typedef struct {
/* 0x00 */ u16 flags;
// Top bytes is a collections of flags, bottom byte is of unknown purpose
//bit 7: 1 = only tangible if landed on, not if driven onto?
// very weird. game crashes sometimes when playing with this.
//bit 6: 1 = Lakitu can drop you here (XXX verify)
//bit 4: 1 = out of bounds
//bit 3: 1 = player tumbles upon contact (may fall right through)
// Top bytes is a collections of flags, bottom byte is of unknown purpose
// bit 7: 1 = only tangible if landed on, not if driven onto?
// very weird. game crashes sometimes when playing with this.
// bit 6: 1 = Lakitu can drop you here (XXX verify)
// bit 4: 1 = out of bounds
// bit 3: 1 = player tumbles upon contact (may fall right through)
/* 0x02 */ u16 surfaceType;
// For AABB bounding-box style collision. Box style collision is cheaper than checking each vtx.
/* 0x04 */ s16 minX; // Minimum x coordinate
s16 minY; // Minimum y coordinate
s16 minZ; // Minimum z coordinate
s16 maxX; // Maximum x coordinate
s16 maxY; // Maximum y coordinate
/* 0x0A */ s16 maxZ; // Maximum z coordinate
/* 0x10 */ Vtx *vtx1; //pointer to the 3 vertices of this poly
Vtx *vtx2;
Vtx *vtx3;
// Face normal. Should really be Vec3f normal
// For AABB bounding-box style collision. Box style collision is cheaper than checking each vtx.
/* 0x04 */ s16 minX; // Minimum x coordinate
s16 minY; // Minimum y coordinate
s16 minZ; // Minimum z coordinate
s16 maxX; // Maximum x coordinate
s16 maxY; // Maximum y coordinate
/* 0x0A */ s16 maxZ; // Maximum z coordinate
/* 0x10 */ Vtx* vtx1; // pointer to the 3 vertices of this poly
Vtx* vtx2;
Vtx* vtx3;
// Face normal. Should really be Vec3f normal
/* 0x1C */ f32 normalX;
/* 0x20 */ f32 normalY;
/* 0x24 */ f32 normalZ;
@@ -222,20 +216,20 @@ typedef struct {
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ u8 surfaceType; // Surface type that the tyre is touching.
/* 0x0D */ u8 surfaceFlags;
/* 0x0C */ u8 surfaceType; // Surface type that the tyre is touching.
/* 0x0D */ u8 surfaceFlags;
/* 0x0E */ u16 collisionMeshIndex; // Index into gCollisionMesh
// Height of tyre attached to ground. When flying it floats with the kart.
// Height of tyre attached to ground. When flying it floats with the kart.
/* 0x10 */ f32 baseHeight;
// Something lighting related. 1 when in a shaded region, 2 when in a tree's shadow
// 3 when getting crushed by a whomp, but curiously only the front left tyre will ever have this value
/* 0x14 */ s32 unk_14;
} KartTyre; // size = 0x18
#define FRONT_LEFT 0
#define FRONT_LEFT 0
#define FRONT_RIGHT 1
#define BACK_LEFT 2
#define BACK_RIGHT 3
#define BACK_LEFT 2
#define BACK_RIGHT 3
struct UnkPlayerInner {
/* 0xDB4 */ s16 unk0;
@@ -259,13 +253,11 @@ typedef struct {
/* 0x0006 */ u16 unk_006;
/* 0x0008 */ s16 lapCount;
/* 0x000A */ char unk_00A[0x2];
/* 0x000C */ s32 soundEffects; // Bitflag.
/* 0x000C */ s32 soundEffects; // Bitflag.
/* 0x0010 */ s16 currentItemCopy; // Has no effect on what item the players has, It is just a synced copy
/* 0x0012 */ s16 unk_012;
/* 0x0014 */ Vec3f pos;
/* 0x0020 */ f32 copy_rotation_x;
/* 0x0024 */ f32 copy_rotation_y;
/* 0x0028 */ f32 copy_rotation_z;
/* 0x0020 */ Vec3f oldPos;
/* 0x002C */ Vec3s rotation;
/* 0x0032 */ char unk_032[0x2];
/* 0x0034 */ Vec3f velocity;
@@ -374,7 +366,7 @@ typedef struct {
/* 0x0DB4 */ struct UnkPlayerInner unk_DB4;
/* 0x0DB6 */ // s16 unk_DB6;
/* 0x0DB8 */ // f32 unk_DB8;
/* 0x0DBC */ //f32 unk_DBC;
/* 0x0DBC */ // f32 unk_DBC;
/* 0x0DC0 */ // f32 unk_DC0;
/* 0x0DC4 */ // f32 unk_DC4;
/* 0x0DC8 */ // f32 unk_DC8;
@@ -383,18 +375,17 @@ typedef struct {
/* 0x0DD0 */ // s16 unk_DD0;
/* 0x0DD2 */ // s16 unk_DD2;
/* 0x0DD4 */ // s16 unk_DD4;
} Player; // size = 0xDD8
} Player; // size = 0xDD8
typedef struct
{
typedef struct {
// Something related to time trial ghost data?
/* 0x00 */ s32 unk_00;
/* 0x04 */ u8 ghostDataSaved;
/* 0x05 */ s8 courseIndex;
/* 0x06 */ u8 characterId;
/* 0x07 */ u8 unk_07[0x3C];
/* 0x43 */ u8 pad_43[0x7F-0x43];
/* 0x7F */ u8 checksum;
/* 0x04 */ u8 ghostDataSaved;
/* 0x05 */ s8 courseIndex;
/* 0x06 */ u8 characterId;
/* 0x07 */ u8 unk_07[0x3C];
/* 0x43 */ u8 pad_43[0x7F - 0x43];
/* 0x7F */ u8 checksum;
} struct_8018EE10_entry; // size = 0x80
typedef struct {
@@ -408,9 +399,9 @@ typedef struct {
// Also might be used for the camera during the post race screens
typedef struct {
/* 0x00 */ f32 unknownScaling; // Looks to be some type of scaling, unknown use
/* 0x04 */ f32 rankScaling; // Scaling done on the rank text in the bottom left corner of the screen
// All time measurements are in centiseconds
/* 0x08 */ u32 someTimer; // The someTimers seem to always have the same value, the total time since race start
/* 0x04 */ f32 rankScaling; // Scaling done on the rank text in the bottom left corner of the screen
// All time measurements are in centiseconds
/* 0x08 */ u32 someTimer; // The someTimers seem to always have the same value, the total time since race start
/* 0x0C */ u32 someTimer1;
/* 0x10 */ u32 timeLastTouchedFinishLine; // Sum of time of all completed laps
// Times at which each lap was completed
@@ -453,30 +444,33 @@ typedef struct {
// These 4 X coordinates are "slide" values
union {
struct {
/* 0x50 */ s16 lap1CompletionTimeX; // Pulls double-duty as timerAfterImage1X
/* 0x52 */ s16 lap2CompletionTimeX; // Pulls double-duty as timerAfterImage2X
/* 0x54 */ s16 lap3CompletionTimeX;
/* 0x50 */ s16 lap1CompletionTimeX; // Pulls double-duty as timerAfterImage1X
/* 0x52 */ s16 lap2CompletionTimeX; // Pulls double-duty as timerAfterImage2X
/* 0x54 */ s16 lap3CompletionTimeX;
};
/* 0x50 */ s16 lapCompletionTimeXs[3];
};
/* 0x56 */ s16 totalTimeX;
/* 0x58 */ s16 timerY; // Y coordinate of the on screen timer (used as Y coordinate for lap completion times in post-race screen)
/* 0x5A */ s16 lapX; // X coordinate of the on screen lap counter
// 0x5C and 0x5E seem to be relative to lapX
/* 0x58 */ s16 timerY; // Y coordinate of the on screen timer (used as Y coordinate for lap completion times in
// post-race screen)
/* 0x5A */ s16 lapX; // X coordinate of the on screen lap counter
// 0x5C and 0x5E seem to be relative to lapX
/* 0x5C */ s16 lapAfterImage1X;
/* 0x5E */ s16 lapAfterImage2X;
/* 0x60 */ s16 lapY; // Y coordinate of the on screen lap counter
/* 0x60 */ s16 lapY; // Y coordinate of the on screen lap counter
/* 0x62 */ s16 rankX; // X coordinate of the on screen rank indicator
/* 0x64 */ s16 rankY; // Y coordinate of the on screen rank indicator
/* 0x66 */ s16 slideRankX; // Adds with the other rankX, used during post race screen to make the rank "slide" into place
/* 0x68 */ s16 slideRankY; // Adds with the other rankY, used during post race screen to make the rank "slide" into place
/* 0x66 */ s16
slideRankX; // Adds with the other rankX, used during post race screen to make the rank "slide" into place
/* 0x68 */ s16
slideRankY; // Adds with the other rankY, used during post race screen to make the rank "slide" into place
/* 0x6A */ s16 stagingPosition; // Position to take during race staging
// These s16's occasionally have values, but I have yet to identify any places that read them
// They appear to have values when in 3/4 player split screen mode, otherwise they're 0
/* 0x6C */ s16 unk_6C;
/* 0x6E */ s16 unk_6E;
/* 0x70 */ s8 raceCompleteBool; // Indicates if race is over?
/* 0x71 */ s8 lapCount; // This increases to 3 when a race is over, while alsoLapCount stays at 2
/* 0x71 */ s8 lapCount; // This increases to 3 when a race is over, while alsoLapCount stays at 2
/* 0x72 */ s8 alsoLapCount;
// Related to the timer blinking on lap completion
// If blinkTimer is counting down:
@@ -489,7 +483,8 @@ typedef struct {
/* 0x76 */ u8 itemOverride; // Something related to item generation. If non-zero, it determines the item you get
/* 0x77 */ s8 unk_77;
// 0x78 to 0x7F appear to be some type of "state" trackers for the lap and timer text during a race start
// When a race starts those texts (and their afterimages) slide in and "bounce" a bit. These states control the bouncing (somehow)
// When a race starts those texts (and their afterimages) slide in and "bounce" a bit. These states control the
// bouncing (somehow)
/* 0x78 */ u8 unk_78;
/* 0x79 */ u8 unk_79;
/* 0x7A */ u8 unk_7A;
+2 -2
View File
@@ -7,10 +7,10 @@
/**
* @file Include for course gfx.inc.c.
*/
*/
typedef struct {
Gfx *addr;
Gfx* addr;
u8 surfaceType;
u8 sectionId;
u16 flags;
+2 -3
View File
@@ -3,9 +3,8 @@
#include <PR/ultratypes.h>
typedef struct
{
u8 *addr; // segmented address texture file
typedef struct {
u8* addr; // segmented address texture file
u32 file_size; // compressed file size
u32 data_size; // uncompressed texture size
u32 padding; // always zero
+18 -19
View File
@@ -27,37 +27,36 @@
#define TEXT_X_POSSITION -0x5
// flags
#define DISPLAY_DECIMAL_NUMBER 0x1
#define DISPLAY_HEXIDECIMAL_NUMBER 0x2
#define DISPLAY_OCTAL_NUMBER 0x4
#define DISPLAY_BINARY_NUMBER 0x8
#define DISPLAY_SIGNED_NUMBER 0x10
#define DISPLAY_FLOAT_AS_TYPE 0x20
#define DISPLAY_FLOAT_WITH_ROUNDING 0x40
#define DISPLAY_FLOAT_NUMBER 0x80
#define DISPLAY_DECIMAL_NUMBER 0x1
#define DISPLAY_HEXIDECIMAL_NUMBER 0x2
#define DISPLAY_OCTAL_NUMBER 0x4
#define DISPLAY_BINARY_NUMBER 0x8
#define DISPLAY_SIGNED_NUMBER 0x10
#define DISPLAY_FLOAT_AS_TYPE 0x20
#define DISPLAY_FLOAT_WITH_ROUNDING 0x40
#define DISPLAY_FLOAT_NUMBER 0x80
#define HEXIDECIMAL 16
#define DECIMAL 10
#define OCTAL 8
#define BINARY 2
/**
/**
* This structure is the heart of the DVDL.
* only the first 4 attributes should be set by the user, the other 2 are used by the program.
*/
typedef struct
{
char *variableName; // name of the variable to be displayed
void *variablePointer; // pointer to the variable so it can display it
u8 variableSize; // size of the variable to make up for templates from C++
u8 variableFlag; // flag to change how the variable is displayed
char buffer[CHARACTER_BUFFER_SIZE]; // when converting a variable to string this will be filled
char *characterBuffer; // silly pointer so i don't need to do stuff
typedef struct {
char* variableName; // name of the variable to be displayed
void* variablePointer; // pointer to the variable so it can display it
u8 variableSize; // size of the variable to make up for templates from C++
u8 variableFlag; // flag to change how the variable is displayed
char buffer[CHARACTER_BUFFER_SIZE]; // when converting a variable to string this will be filled
char* characterBuffer; // silly pointer so i don't need to do stuff
} variableWatchAttributes;
/**
* This structure array is what you edit to display in the list.
* First index is the variable name, second is a pointer to the variable and
* First index is the variable name, second is a pointer to the variable and
* third is the size of the variable.
*
* initilized in debug/debug.inc.c
@@ -65,7 +64,7 @@ typedef struct
extern variableWatchAttributes gMainVariableWatchList[];
/**
* This is what calls the debug watch list. Because of how mk64 was programed,
* This is what calls the debug watch list. Because of how mk64 was programed,
* It's called at 4 different parts of the code. One for menus, race,
* ending sequence and creditis. It does not display during loading time because
* the RSP is not initialized during that portion of the code.
+104 -104
View File
@@ -1,7 +1,6 @@
#ifndef DEFINES_H
#define DEFINES_H
/**
* @brief Options for Controller Pak state
*/
@@ -10,23 +9,23 @@
/**
* @brief Enable debug mode
*
*
* Press start to skip through menus
*
*
* Toggle resource meters by holding R and tapping B. L must not be held.
*
*
* Reset to start screen by holding A, B, R, and L.
*
*
* View player direction and currentPathPoint in a single player race during staging tap L while holding A and B.
* Turn off this UI by tapping R while holding A and B.
* @bug This looks like it should work at any point in the race.
*
*
* Set player 1 to the final lap by tapping D-pad up.
* Set player 1 and player 2 to the final lap by tapping D-pad right.
* Set player all players to the final lap by tapping D-pad down.
*
*
* Immediately start the race if any controller presses Z.
*
*
* As the ceremony cutscene starts hold a C or D-pad to switch characters.
* C UP = LUIGI
* C LEFT = YOSHI
@@ -36,17 +35,18 @@
* D-pad LEFT = PEACH
* D-pad RIGHT = BOWSER
* D-pad DOWN = MARIO
*
*
*/
#if defined(GCC) || defined(DEBUG)
#define DEBUG_MODE 1
#define DEBUG_MENU 2
#define DEBUG_MODE 1
#define DEBUG_MENU 2
#else
#define DEBUG_MODE 0
#define DEBUG_MENU 1
#define DEBUG_MODE 0
#define DEBUG_MENU 1
#endif
#define HOLD_ALL_DPAD_AND_C_BUTTONS (U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS)
#define HOLD_ALL_DPAD_AND_C_BUTTONS \
(U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS)
/**
* @brief Options for gDebugMenuSelection
@@ -75,11 +75,11 @@
#define DEMO_MODE_INACTIVE 0
#ifdef VERSION_EU
#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
#else
#define COURSE_TIMER_ITER 0.01666666 // 1 / 60
#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60
#define COURSE_TIMER_ITER 0.01666666 // 1 / 60
#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60
#endif
#define V_BlANK_TIMER_ITER 0.01666666
@@ -90,16 +90,16 @@
* Start sequence means waiting for the light to turn green.
* Used in the Player struct's 'type' member: player->type
*/
#define PLAYER_INACTIVE 0 // 0x0000
#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_KART_AI (1 << 12) // 0x1000
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_HUMAN (1 << 14) // 0x4000
#define PLAYER_EXISTS (1 << 15) // 0x8000
#define PLAYER_INACTIVE 0 // 0x0000
#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_KART_AI (1 << 12) // 0x1000
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_HUMAN (1 << 14) // 0x4000
#define PLAYER_EXISTS (1 << 15) // 0x8000
// Compiles to -0x1000 in diff.py
#define PLAYER_HUMAN_AND_KART_AI PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_KART_AI | PLAYER_START_SEQUENCE
@@ -125,13 +125,13 @@ enum PlayerId {
#define NUM_PLAYERS 8
#define MARIO_SIZE 0.75f
#define LUIGI_SIZE 0.75f
#define YOSHI_SIZE 0.75f
#define TOAD_SIZE 0.75f
#define DK_SIZE 0.75f
#define WARIO_SIZE 0.75f
#define PEACH_SIZE 0.75f
#define MARIO_SIZE 0.75f
#define LUIGI_SIZE 0.75f
#define YOSHI_SIZE 0.75f
#define TOAD_SIZE 0.75f
#define DK_SIZE 0.75f
#define WARIO_SIZE 0.75f
#define PEACH_SIZE 0.75f
#define BOWSER_SIZE 0.75f
// 2P Game has Grand Prix, VS, and Battle as available game types
@@ -140,10 +140,10 @@ enum PlayerId {
/**
* @brief Options for gModeSelection
*/
#define GRAND_PRIX 0
#define GRAND_PRIX 0
#define TIME_TRIALS 1
#define VERSUS 2
#define BATTLE 3
#define VERSUS 2
#define BATTLE 3
/**
* @brief Options for gCCSelection
@@ -153,11 +153,11 @@ enum PlayerId {
* Generally, the main determiner of horsepower output.
*/
#define CC_50 0
#define CC_100 1
#define CC_150 2
#define CC_EXTRA 3
#define CC_BATTLE 4
#define CC_50 0
#define CC_100 1
#define CC_150 2
#define CC_EXTRA 3
#define CC_BATTLE 4
/**
* @brief Options for gCupSelection
@@ -166,11 +166,11 @@ enum PlayerId {
* way race courses are.
*/
#define MUSHROOM_CUP 0
#define FLOWER_CUP 1
#define STAR_CUP 2
#define SPECIAL_CUP 3
#define BATTLE_CUP 4
#define NUM_CUPS 5
#define FLOWER_CUP 1
#define STAR_CUP 2
#define SPECIAL_CUP 3
#define BATTLE_CUP 4
#define NUM_CUPS 5
/**
* @brief Character IDs
@@ -178,13 +178,13 @@ enum PlayerId {
* found in gCharacterGridSelections as those are
* ordered by table
*/
#define MARIO 0
#define LUIGI 1
#define YOSHI 2
#define TOAD 3
#define DK 4
#define WARIO 5
#define PEACH 6
#define MARIO 0
#define LUIGI 1
#define YOSHI 2
#define TOAD 3
#define DK 4
#define WARIO 5
#define PEACH 6
#define BOWSER 7
/**
@@ -220,7 +220,8 @@ enum PlayerId {
#define DATA_SELECTION 2
#define PLAYER_NUM_SELECTION 3
#define GAME_MODE_SELECTION 4
#define GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION 5 // Selecting CC for GP and Versus. Selecting "Begin" or "Data" for Time Trials. Unused for Battle
#define GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION \
5 // Selecting CC for GP and Versus. Selecting "Begin" or "Data" for Time Trials. Unused for Battle
#define CONFIRM_OK_SELECTION 6
#define CONFIRM_OK_SELECTION_FROM_BACK_OUT 7
#define TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT 8
@@ -256,7 +257,7 @@ enum PlayerId {
#define TIME_TRIAL_3LAP_RECORD_3 2
#define TIME_TRIAL_3LAP_RECORD_4 3
#define TIME_TRIAL_3LAP_RECORD_5 4
#define TIME_TRIAL_1LAP_RECORD 5
#define TIME_TRIAL_1LAP_RECORD 5
/**
* @brief Text color options
@@ -266,10 +267,10 @@ enum PlayerId {
* flashing between 2 colors, but also cause individual characters
* to be cutoff on their right side
*/
#define TEXT_BLUE 0
#define TEXT_GREEN 1
#define TEXT_RED 2
#define TEXT_YELLOW 3
#define TEXT_BLUE 0
#define TEXT_GREEN 1
#define TEXT_RED 2
#define TEXT_YELLOW 3
#define TEXT_BLUE_GREEN_RED_CYCLE_1 4
#define TEXT_BLUE_GREEN_RED_CYCLE_2 5
@@ -278,28 +279,28 @@ enum PlayerId {
* Option 2 appears to be unused, as such its probably not
* a valid option
*/
#define SOUND_STEREO 0
#define SOUND_HEADPHONES 1
#define SOUND_UNUSED 2
#define SOUND_MONO 3
#define NUM_SOUND_MODES 4
#define SOUND_STEREO 0
#define SOUND_HEADPHONES 1
#define SOUND_UNUSED 2
#define SOUND_MONO 3
#define NUM_SOUND_MODES 4
/**
* @brief Title screen demo options
* All demos use 100 CC
*/
#define DEMO_ONE 0 // Mario, Mario Raceway, Grand Prix
#define DEMO_TWO 1 // Yoshi DK, Choco Mountain, Versus
#define DEMO_ONE 0 // Mario, Mario Raceway, Grand Prix
#define DEMO_TWO 1 // Yoshi DK, Choco Mountain, Versus
#define DEMO_THREE 2 // Luigi, Kalamari Desert, Grand Prix
#define DEMO_FOUR 3 // Wario Yoshi Bowser, Wario Stadium, Versus
#define DEMO_FIVE 4 // Bowser, Bowser Castle, Grand Prix
#define DEMO_SIX 5 // Mario Luigi Peach Toad, Sherbert Land, Versus
#define NUM_DEMOS 6
#define DEMO_FOUR 3 // Wario Yoshi Bowser, Wario Stadium, Versus
#define DEMO_FIVE 4 // Bowser, Bowser Castle, Grand Prix
#define DEMO_SIX 5 // Mario Luigi Peach Toad, Sherbert Land, Versus
#define NUM_DEMOS 6
#define CUP_COURSE_ONE 0
#define CUP_COURSE_TWO 1
#define CUP_COURSE_THREE 2
#define CUP_COURSE_FOUR 3
#define CUP_COURSE_ONE 0
#define CUP_COURSE_TWO 1
#define CUP_COURSE_THREE 2
#define CUP_COURSE_FOUR 3
#define NUM_COURSES_PER_CUP 4
/**
@@ -349,9 +350,9 @@ enum DIRECTION {
/**
* @brief Balloon status
*/
#define BALLOON_STATUS_GONE 0
#define BALLOON_STATUS_PRESENT 1
#define BALLOON_STATUS_DEPARTING 2
#define BALLOON_STATUS_GONE 0
#define BALLOON_STATUS_PRESENT 1
#define BALLOON_STATUS_DEPARTING 2
/**
* @brief Max representable time, 100 minutes measured in centiseconds
@@ -362,33 +363,33 @@ enum DIRECTION {
* @brief sound effect of player's
* for soundEffect
*/
#define HIT_SOUND_EFFECT 0x100 // hitting an object
#define BOOST_SOUND_EFFECT 0x200 // being boosted by trigger a mushroom
#define BOO_SOUND_EFFECT 0x800 // being a boo
#define STAR_SOUND_EFFECT 0x2000 // being a star
#define HIT_ROTATING_SOUND_EFFECT 0x4000 // hitting a rotating object
#define BOOST_RAMP_WOOD_SOUND_EFFECT 0x8000 // being boosted by a ramp
#define HOLD_BANANA_SOUND_EFFECT 0x40000 // holding a banana
#define REVERSE_SOUND_EFFECT 0x400000 // being in the wrong direction
#define BOOST_RAMP_ASPHALT_SOUND_EFFECT 0x800000 // being boosted by a boost pad
#define HIT_BY_ITEM_SOUND_EFFECT 0x1000000 // being hit by an item
#define HIT_SOUND_EFFECT 0x100 // hitting an object
#define BOOST_SOUND_EFFECT 0x200 // being boosted by trigger a mushroom
#define BOO_SOUND_EFFECT 0x800 // being a boo
#define STAR_SOUND_EFFECT 0x2000 // being a star
#define HIT_ROTATING_SOUND_EFFECT 0x4000 // hitting a rotating object
#define BOOST_RAMP_WOOD_SOUND_EFFECT 0x8000 // being boosted by a ramp
#define HOLD_BANANA_SOUND_EFFECT 0x40000 // holding a banana
#define REVERSE_SOUND_EFFECT 0x400000 // being in the wrong direction
#define BOOST_RAMP_ASPHALT_SOUND_EFFECT 0x800000 // being boosted by a boost pad
#define HIT_BY_ITEM_SOUND_EFFECT 0x1000000 // being hit by an item
/**
* @brief effect of player's
* for effects
*/
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
#define STAR_EFFECT 0x200 // being a star
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
#define HIT_EFFECT 0x4000000 // hitting an object
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define BOO_EFFECT 0x80000000 // being a boo
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
#define STAR_EFFECT 0x200 // being a star
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
#define HIT_EFFECT 0x4000000 // hitting an object
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define BOO_EFFECT 0x80000000 // being a boo
/**
* @brief shell state
*
*
*/
#define SPAWN_FIRST_SHELL 0
#define SPAWN_SECOND_SHELL 1
@@ -396,17 +397,16 @@ enum DIRECTION {
#define GPACK_RGB888(r, g, b) (((r) << 16) | ((g) << 8) | (b))
#define COLOR_LIGHT GPACK_RGB888(0x1C, 0x00, 0x00)
#define COLOR_LAVA GPACK_RGB888(0x34, 0x00, 0x00)
#define COLOR_BLACK GPACK_RGB888(0, 0, 0)
#define COLOR_LAVA GPACK_RGB888(0x34, 0x00, 0x00)
#define COLOR_BLACK GPACK_RGB888(0, 0, 0)
#endif // DEFINES_H
/**
*
*
* Collision mesh flags
*
*/
*
*/
#define GRID_SIZE 32
+12 -12
View File
@@ -8,28 +8,28 @@ extern f32 D_800E2380[8];
extern f32 D_800E23A0[8];
extern f32 D_800E23C0[8];
extern f32 D_800E23E0[8];
extern f32 *D_800E2400[5];
extern f32* D_800E2400[5];
extern f32 D_800E2414[8];
extern f32 D_800E2434[8];
extern f32 D_800E2454[8];
extern f32 D_800E2474[8];
extern f32 D_800E2494[8];
extern f32 *D_800E24B4[5];
extern f32* D_800E24B4[5];
extern f32 D_800E24C8[8];
extern f32 D_800E24E8[8];
extern f32 D_800E2508[8];
extern f32 D_800E2528[8];
extern f32 D_800E2548[8];
extern f32 *D_800E2568[5];
extern f32* D_800E2568[5];
extern f32 gTopSpeed50cc[8];
extern f32 gTopSpeed100cc[8];
extern f32 gTopSpeed150cc[8];
extern f32 gTopSpeedExtra[8];
extern f32 gTopSpeedBattle[8];
extern f32 *gTopSpeedTable[5];
extern f32* gTopSpeedTable[5];
extern f32 gKartFrictionTable[8];
extern f32 gKartGravityTable[8];
@@ -53,8 +53,8 @@ extern f32 D_800E29A0[15];
extern f32 D_800E29DC[15];
extern f32 D_800E2A18[15];
extern f32 D_800E2A54[15];
extern f32 *D_800E2A90[8];
extern f32 *D_800E2AB0[8];
extern f32* D_800E2A90[8];
extern f32* D_800E2AB0[8];
extern f32 D_800E2AD0[15];
extern f32 D_800E2B0C[15];
@@ -72,8 +72,8 @@ extern f32 D_800E2DA0[15];
extern f32 D_800E2DDC[15];
extern f32 D_800E2E18[15];
extern f32 D_800E2E54[15];
extern f32 *D_800E2E90[8];
extern f32 *D_800E2EB0[8];
extern f32* D_800E2E90[8];
extern f32* D_800E2EB0[8];
extern f32 gKartAccelerationMario[10];
extern f32 gKartAccelerationLuigi[10];
@@ -83,7 +83,7 @@ extern f32 gKartAccelerationDK[10];
extern f32 gKartAccelerationWario[10];
extern f32 gKartAccelerationPeach[10];
extern f32 gKartAccelerationBowser[10];
extern f32 *gKartAccelerationTables[8];
extern f32* gKartAccelerationTables[8];
extern f32 D_800E3030[15];
extern f32 D_800E306C[15];
@@ -93,7 +93,7 @@ extern f32 D_800E3120[15];
extern f32 D_800E315C[15];
extern f32 D_800E3198[15];
extern f32 D_800E31D4[15];
extern f32 *D_800E3210[8];
extern f32* D_800E3210[8];
extern f32 D_800E3230[15];
extern f32 D_800E326C[15];
@@ -103,7 +103,7 @@ extern f32 D_800E3320[15];
extern f32 D_800E335C[15];
extern f32 D_800E3398[15];
extern f32 D_800E33D4[15];
extern f32 *D_800E3410[8];
extern f32* D_800E3410[8];
extern f32 D_800E3430[15];
extern f32 D_800E346C[15];
@@ -113,7 +113,7 @@ extern f32 D_800E3520[15];
extern f32 D_800E355C[15];
extern f32 D_800E3598[15];
extern f32 D_800E35D4[15];
extern f32 *D_800E3610[8];
extern f32* D_800E3610[8];
extern f32 gKartHandlingTable[8];
extern f32 gKartTable800E3650[8];
+16 -19
View File
@@ -9,33 +9,30 @@
#define va_end __builtin_va_end
#else
typedef char *va_list;
typedef char* va_list;
#define _FP 1
#define _INT 0
#define _STRUCT 2
#define _VA_FP_SAVE_AREA 0x10
#define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
#define _VA_ALIGN(p, a) (((unsigned int) (((char*) p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
#define va_start(vp, parmN) (vp = ((va_list) & parmN + sizeof(parmN)))
#define __va_stack_arg(list, mode) \
( \
((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \
_VA_ALIGN(sizeof(mode), 4)), \
(((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
#define __va_stack_arg(list, mode) \
(((list) = (char*) _VA_ALIGN(list, __builtin_alignof(mode)) + _VA_ALIGN(sizeof(mode), 4)), \
(((char*) list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
#define __va_double_arg(list, mode) \
( \
(((long)list & 0x1) /* 1 byte aligned? */ \
? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \
: (((long)list & 0x2) /* 2 byte aligned? */ \
? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \
: __va_stack_arg(list, mode))))
#define __va_double_arg(list, mode) \
((((long) list & 0x1) /* 1 byte aligned? */ \
? (list = (char*) ((long) list + 7), (char*) ((long) list - 6 - _VA_FP_SAVE_AREA)) \
: (((long) list & 0x2) /* 2 byte aligned? */ \
? (list = (char*) ((long) list + 10), (char*) ((long) list - 24 - _VA_FP_SAVE_AREA)) \
: __va_stack_arg(list, mode))))
#define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \
__builtin_alignof(mode) == sizeof(double)) \
? __va_double_arg(list, mode) \
: __va_stack_arg(list, mode))))[-1]
#define va_arg(list, mode) \
((mode*) (((__builtin_classof(mode) == _FP && __builtin_alignof(mode) == sizeof(double)) \
? __va_double_arg(list, mode) \
: __va_stack_arg(list, mode))))[-1]
#define va_end(__list)
#endif
+1 -1
View File
@@ -4,7 +4,7 @@
#include <PR/ultratypes.h>
#ifndef offsetof
#define offsetof(st, m) ((size_t)&(((st *)0)->m))
#define offsetof(st, m) ((size_t) & (((st*) 0)->m))
#endif
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef STDIO_H
#define STDIO_H
extern int sprintf(char *s, const char *fmt, ...);
extern int sprintf(char* s, const char* fmt, ...);
#endif
+2 -4
View File
@@ -1,14 +1,12 @@
#ifndef STDLIB_H
#define STDLIB_H
typedef struct lldiv_t
{
typedef struct lldiv_t {
long long quot;
long long rem;
} lldiv_t;
typedef struct ldiv_t
{
typedef struct ldiv_t {
long quot;
long rem;
} ldiv_t;
+3 -3
View File
@@ -3,8 +3,8 @@
#include <PR/ultratypes.h>
void *memcpy(void *dst, const void *src, size_t size);
size_t strlen(const char *str);
char *strchr(const char *str, s32 ch);
void* memcpy(void* dst, const void* src, size_t size);
size_t strlen(const char* str);
char* strchr(const char* str, s32 ch);
#endif
+32 -18
View File
@@ -1,7 +1,6 @@
#ifndef _MACROS_H_
#define _MACROS_H_
#ifndef __sgi
#define GLOBAL_ASM(...)
#endif
@@ -9,12 +8,12 @@
#if !defined(__sgi) && (!defined(NON_MATCHING) || !defined(AVOID_UB))
// asm-process isn't supported outside of IDO, and undefined behavior causes
// crashes.
//#error Matching build is only possible on IDO; please build with NON_MATCHING=1.
// #error Matching build is only possible on IDO; please build with NON_MATCHING=1.
#endif
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
#define GLUE(a, b) a ## b
#define GLUE(a, b) a##b
#define GLUE2(a, b) GLUE(a, b)
// Avoid compiler warnings for unused variables
@@ -31,6 +30,13 @@
#define NORETURN
#endif
// Avoid undefined behaviour for non-returning functions
#ifdef __GNUC__
#define NO_REORDER __attribute__((no_reorder))
#else
#define NO_REORDER
#endif
// Static assertions
#ifdef __GNUC__
#define STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
@@ -53,30 +59,38 @@
#endif
// Fixed point macros
#define FTOFIX(f) ((s32)((f) * 65536.0))
#define ITOFIX(i) ((s32)((i) << 16))
#define FIXTOF(x) ((double)((x) / 65536.0))
#define FIXTOI(x) ((s32)((x) >> 16))
#define FTOFIX(f) ((s32) ((f) * 65536.0))
#define ITOFIX(i) ((s32) ((i) << 16))
#define FIXTOF(x) ((double) ((x) / 65536.0))
#define FIXTOI(x) ((s32) ((x) >> 16))
// Split fixed-point values into its integer or fractional parts.
#define toFixedInt(f) (FTOFIX(f) >> 16)
#define toFrac(f) (FTOFIX(f) & 0xFFFF)
#define toFixedInt(f) (FTOFIX(f) >> 16)
#define toFrac(f) (FTOFIX(f) & 0xFFFF)
// Setup a fixed-point matrix using floats or doubles. Recommend using doubles for more precision.
#define toFixedPointMatrix(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) \
{{((toFixedInt(x1)) << 16) | toFixedInt(x2), ((toFixedInt(x3)) << 16) | toFixedInt(x4), (toFixedInt(x5) << 16) | toFixedInt(x6), (toFixedInt(x7) << 16) | toFixedInt(x8)}, \
{((toFixedInt(x9)) << 16) | toFixedInt(x10), ((toFixedInt(x11)) << 16) | toFixedInt(x12), (toFixedInt(x13) << 16) | toFixedInt(x14), (toFixedInt(x15) << 16) | toFixedInt(x16)}, \
{((toFrac(x1)) << 16) | toFrac(x2), ((toFrac(x3)) << 16) | toFrac(x4), (toFrac(x5) << 16) | toFrac(x6), (toFrac(x7) << 16) | toFrac(x8)}, \
{((toFrac(x9)) << 16) | toFrac(x10), ((toFrac(x11)) << 16) | toFrac(x12), (toFrac(x13) << 16) | toFrac(x14), (toFrac(x15) << 16) | toFrac(x16)}}
#define toFixedPointMatrix(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) \
{ \
{ ((toFixedInt(x1)) << 16) | toFixedInt(x2), ((toFixedInt(x3)) << 16) | toFixedInt(x4), \
(toFixedInt(x5) << 16) | toFixedInt(x6), (toFixedInt(x7) << 16) | toFixedInt(x8) }, \
{ ((toFixedInt(x9)) << 16) | toFixedInt(x10), ((toFixedInt(x11)) << 16) | toFixedInt(x12), \
(toFixedInt(x13) << 16) | toFixedInt(x14), (toFixedInt(x15) << 16) | toFixedInt(x16) }, \
{ ((toFrac(x1)) << 16) | toFrac(x2), ((toFrac(x3)) << 16) | toFrac(x4), (toFrac(x5) << 16) | toFrac(x6), \
(toFrac(x7) << 16) | toFrac(x8) }, \
{ \
((toFrac(x9)) << 16) | toFrac(x10), ((toFrac(x11)) << 16) | toFrac(x12), \
(toFrac(x13) << 16) | toFrac(x14), (toFrac(x15) << 16) | toFrac(x16) \
} \
}
// convert a virtual address to physical.
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr) & 0x1FFFFFFF)
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t) (addr) & 0x1FFFFFFF)
// convert a physical address to virtual.
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) | 0x80000000)
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t) (addr) | 0x80000000)
// another way of converting virtual to physical
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8 *)(addr) - 0x80000000U)
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8*) (addr) - 0x80000000U)
// aligns an address to the next 16 bytes
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
@@ -87,6 +101,6 @@
* - sizeof(dl[0]) : walk back 1 Gfx macro
* - 0x07000000 : get just the offset
**/
#define GET_PACKED_END(dl) (((u8 *) dl) + sizeof(dl) - sizeof(dl[0]) - 0x07000000)
#define GET_PACKED_END(dl) (((u8*) dl) + sizeof(dl) - sizeof(dl[0]) - 0x07000000)
#endif
+1216 -11
View File
File diff suppressed because it is too large Load Diff
+37 -30
View File
@@ -10,6 +10,11 @@
Configuration
=======================*/
#define AUDIO_HEAP_SIZE 0x48C00
#define AUDIO_HEAP_INIT_SIZE 0x2600
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void*) / 4))
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
@@ -67,53 +72,55 @@ typedef enum {
/**
* @brief The different types of surface in the game.
*/
*/
enum SURFACE_TYPE {
/* -0x1 */ SURFACE_DEFAULT = -1,
/* 0x00 */ AIRBORNE,
/* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper
/* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK Jungle on course, Yoshi Valley
/* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway
/* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle
/* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel
/* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut
/* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal
// Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper
/* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK
// Jungle on course, Yoshi Valley
/* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway
/* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle
/* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel
/* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut
/* 0x07 */ SAND_OFFROAD, // Mario Raceway
/* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley
/* 0x09 */ ICE, // Sherbert Land
/* 0x0A */ WET_SAND, // Koop Troopa Beach dark color
/* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley
/* 0x09 */ ICE, // Sherbert Land
/* 0x0A */ WET_SAND, // Koop Troopa Beach dark color
/* 0x0B */ SNOW_OFFROAD, // Frappe Snowland off course
/* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain
/* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain
/* 0x0D */ DIRT_OFFROAD, // Kalimari Desert off course
/* 0x0E */ TRAIN_TRACK, // Kalimari Desert
/* 0x0F */ CAVE, // DK Jungle cave
/* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge
/* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2
/* 0x0E */ TRAIN_TRACK, // Kalimari Desert
/* 0x0F */ CAVE, // DK Jungle cave
/* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge
/* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2
/* 0xFC */ BOOST_RAMP_WOOD = 0xFC, // DK Jungle
/* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island
/* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway
/* 0xFF */ RAMP // Koopa Troopa beach
/* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island
/* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway
/* 0xFF */ RAMP // Koopa Troopa beach
};
#define GFX_GET_OPCODE(var) ((s32)((var) & 0xFF000000))
#define GFX_GET_OPCODE(var) ((s32) ((var) & 0xFF000000))
// Pointer casting is technically UB, and avoiding it gets rid of endian issues
// as well as a nice side effect.
#ifdef AVOID_UB
#define GET_HIGH_U16_OF_32(var) ((u16)((var) >> 16))
#define GET_HIGH_S16_OF_32(var) ((s16)((var) >> 16))
#define GET_LOW_U16_OF_32(var) ((u16)((var) & 0xFFFF))
#define GET_LOW_S16_OF_32(var) ((s16)((var) & 0xFFFF))
#define GET_HIGH_U16_OF_32(var) ((u16) ((var) >> 16))
#define GET_HIGH_S16_OF_32(var) ((s16) ((var) >> 16))
#define GET_LOW_U16_OF_32(var) ((u16) ((var) & 0xFFFF))
#define GET_LOW_S16_OF_32(var) ((s16) ((var) & 0xFFFF))
#define SET_HIGH_U16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
#define SET_HIGH_S16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
#else
#define GET_HIGH_U16_OF_32(var) (((u16 *)&(var))[0])
#define GET_HIGH_S16_OF_32(var) (((s16 *)&(var))[0])
#define GET_LOW_U16_OF_32(var) (((u16 *)&(var))[1])
#define GET_LOW_S16_OF_32(var) (((s16 *)&(var))[1])
#define SET_HIGH_U16_OF_32(var, x) ((((u16 *)&(var))[0]) = (x))
#define SET_HIGH_S16_OF_32(var, x) ((((s16 *)&(var))[0]) = (x))
#define GET_HIGH_U16_OF_32(var) (((u16*) &(var))[0])
#define GET_HIGH_S16_OF_32(var) (((s16*) &(var))[0])
#define GET_LOW_U16_OF_32(var) (((u16*) &(var))[1])
#define GET_LOW_S16_OF_32(var) (((s16*) &(var))[1])
#define SET_HIGH_U16_OF_32(var, x) ((((u16*) &(var))[0]) = (x))
#define SET_HIGH_S16_OF_32(var, x) ((((s16*) &(var))[0]) = (x))
#endif
#define MACRO_COLOR_FLAG(r, g, b, flag) (r&~0x3) | (flag & 0x3), (g&~0x3) | ((flag>>2) & 0x3), b
#define MACRO_COLOR_FLAG(r, g, b, flag) (r & ~0x3) | (flag & 0x3), (g & ~0x3) | ((flag >> 2) & 0x3), b
#endif // MK64_H
+77 -78
View File
@@ -7,8 +7,7 @@
#define OBJECT_LIST_SIZE 0x226
#define SOME_OBJECT_INDEX_LIST_SIZE 32
typedef struct
{
typedef struct {
/* 0x00 */ f32 sizeScaling;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f origin_pos;
@@ -23,20 +22,20 @@ typedef struct
/* 0x54 */ s32 status;
/* 0x58 */ s32 unk_058;
/* 0x5C */ s32 unk_05C;
/* 0x60 */ u8 *activeTLUT;
/* 0x64 */ u8 *activeTexture;
/* 0x60 */ u8* activeTLUT;
/* 0x64 */ u8* activeTexture;
/**
* "list" is something of a misnomer for the names here
* they can be pointers to just 1 tlut/texture, but it is common for one or the other
* to be a pointer to an array of tluts/textures.
**/
/* 0x68 */ u8 *tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
/* 0x6C */ u8 *textureList;
/* 0x70 */ Gfx *model;
/* 0x74 */ Vtx *vertex;
/* 0x78 */ s8 unk_078[0x04];
/* 0x7C */ SplineControlPoint *controlPoints;
/* 0x80 */ SplineData *spline;
**/
/* 0x68 */ u8* tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
/* 0x6C */ u8* textureList;
/* 0x70 */ Gfx* model;
/* 0x74 */ Vtx* vertex;
/* 0x78 */ s8 unk_078[0x04];
/* 0x7C */ SplineControlPoint* controlPoints;
/* 0x80 */ SplineData* spline;
/* 0x84 */ s16 unk_084[0xA];
/* 0x98 */ u16 timer;
/* 0x9A */ u16 unk_09A;
@@ -57,34 +56,33 @@ typedef struct
/* 0xC4 */ u16 unk_0C4;
/* 0xC6 */ u16 unk_0C6;
/* 0xC8 */ u16 boundingBoxSize;
/* 0xCA */ s8 unk_0CA;
/* 0xCB */ s8 unk_0CB;
/* 0xCC */ s8 unk_0CC;
/* 0xCD */ s8 unk_0CD;
/* 0xCE */ s8 unk_0CE;
/* 0xCF */ s8 unk_0CF;
/* 0xD0 */ s8 unk_0D0;
/* 0xD1 */ s8 unk_0D1;
/* 0xD2 */ s8 itemDisplay;
/* 0xD3 */ s8 unk_0D3;
/* 0xD4 */ s8 unk_0D4;
/* 0xD5 */ u8 unk_0D5;
/* 0xD6 */ u8 unk_0D6;
/* 0xD7 */ u8 unk_0D7;
/* 0xD8 */ u8 unk_0D8;
/* 0xD9 */ u8 textureWidth;
/* 0xDA */ u8 textureHeight;
/* 0xDB */ u8 unk_0DB;
/* 0xDC */ u8 unk_0DC;
/* 0xDD */ u8 unk_0DD;
/* 0xDE */ s8 unk_0DE;
/* 0xDF */ u8 unk_0DF;
/* 0xCA */ s8 unk_0CA;
/* 0xCB */ s8 unk_0CB;
/* 0xCC */ s8 unk_0CC;
/* 0xCD */ s8 unk_0CD;
/* 0xCE */ s8 unk_0CE;
/* 0xCF */ s8 unk_0CF;
/* 0xD0 */ s8 unk_0D0;
/* 0xD1 */ s8 unk_0D1;
/* 0xD2 */ s8 itemDisplay;
/* 0xD3 */ s8 unk_0D3;
/* 0xD4 */ s8 unk_0D4;
/* 0xD5 */ u8 unk_0D5;
/* 0xD6 */ u8 unk_0D6;
/* 0xD7 */ u8 unk_0D7;
/* 0xD8 */ u8 unk_0D8;
/* 0xD9 */ u8 textureWidth;
/* 0xDA */ u8 textureHeight;
/* 0xDB */ u8 unk_0DB;
/* 0xDC */ u8 unk_0DC;
/* 0xDD */ u8 unk_0DD;
/* 0xDE */ s8 unk_0DE;
/* 0xDF */ u8 unk_0DF;
} Object; // size = 0xE0
extern Object gObjectList[];
typedef struct
{
typedef struct {
/* 0x00 */ f32 sizeScaling;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f origin_pos;
@@ -99,20 +97,20 @@ typedef struct
/* 0x54 */ s32 status;
/* 0x58 */ s32 unk_058;
/* 0x5C */ s32 unk_05C;
/* 0x60 */ u8 *activeTLUT;
/* 0x64 */ u8 *activeTexture;
/* 0x60 */ u8* activeTLUT;
/* 0x64 */ u8* activeTexture;
/**
* "list" is something of a misnomer for the names here
* they can be pointers to just 1 tlut/texture, but it is common for one or the other
* to be a pointer to an array of tluts/textures.
**/
/* 0x68 */ u8 *tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
/* 0x6C */ u8 *textureList;
/* 0x70 */ Gfx *model;
/* 0x74 */ Vtx *vertex;
/* 0x78 */ s8 unk_078[0x04];
/* 0x7C */ Vec4s *unk_07C;
/* 0x80 */ Vec4s *unk_080; // unk_080[][4]?
**/
/* 0x68 */ u8* tlutList; // I feel like this should actually be `u8 (*tlutList)[512]`, but that causes mismatches
/* 0x6C */ u8* textureList;
/* 0x70 */ Gfx* model;
/* 0x74 */ Vtx* vertex;
/* 0x78 */ s8 unk_078[0x04];
/* 0x7C */ Vec4s* unk_07C;
/* 0x80 */ Vec4s* unk_080; // unk_080[][4]?
/* 0x84 */ s16 unk_084[0xA];
/* 0x98 */ u16 goldenMushroomTimer;
/* 0x9A */ u16 unk_09A;
@@ -133,28 +131,28 @@ typedef struct
/* 0xC4 */ u16 unk_0C4;
/* 0xC6 */ u16 unk_0C6;
/* 0xC8 */ u16 unk_0C8;
/* 0xCA */ s8 unk_0CA;
/* 0xCB */ s8 unk_0CB;
/* 0xCC */ s8 unk_0CC;
/* 0xCD */ s8 unk_0CD;
/* 0xCE */ s8 unk_0CE;
/* 0xCF */ s8 unk_0CF;
/* 0xD0 */ s8 unk_0D0;
/* 0xD1 */ s8 unk_0D1;
/* 0xD2 */ s8 itemDisplay;
/* 0xD3 */ s8 unk_0D3;
/* 0xD4 */ s8 unk_0D4;
/* 0xD5 */ u8 unk_0D5;
/* 0xD6 */ u8 unk_0D6;
/* 0xD7 */ u8 unk_0D7;
/* 0xD8 */ u8 unk_0D8;
/* 0xD9 */ u8 textureWidth;
/* 0xDA */ u8 textureHeight;
/* 0xDB */ u8 unk_0DB;
/* 0xDC */ u8 unk_0DC;
/* 0xDD */ u8 unk_0DD;
/* 0xDE */ s8 unk_0DE;
/* 0xDF */ u8 unk_0DF;
/* 0xCA */ s8 unk_0CA;
/* 0xCB */ s8 unk_0CB;
/* 0xCC */ s8 unk_0CC;
/* 0xCD */ s8 unk_0CD;
/* 0xCE */ s8 unk_0CE;
/* 0xCF */ s8 unk_0CF;
/* 0xD0 */ s8 unk_0D0;
/* 0xD1 */ s8 unk_0D1;
/* 0xD2 */ s8 itemDisplay;
/* 0xD3 */ s8 unk_0D3;
/* 0xD4 */ s8 unk_0D4;
/* 0xD5 */ u8 unk_0D5;
/* 0xD6 */ u8 unk_0D6;
/* 0xD7 */ u8 unk_0D7;
/* 0xD8 */ u8 unk_0D8;
/* 0xD9 */ u8 textureWidth;
/* 0xDA */ u8 textureHeight;
/* 0xDB */ u8 unk_0DB;
/* 0xDC */ u8 unk_0DC;
/* 0xDD */ u8 unk_0DD;
/* 0xDE */ s8 unk_0DE;
/* 0xDF */ u8 unk_0DF;
} ItemWindowObjects; // size = 0xE0
// This are other lists of indices in gObjectList.
@@ -199,10 +197,11 @@ extern Collision D_8018C0B0[];
/**
* indexObjectList1, indexObjectList2, indexObjectList3, and indexObjectList4 are all lists of indices in gObjectList.
* init_object_list_index initializes them in such a way that the indicies in each list are not adjacent.
* First indexObjectList1 gets an unused index, then indexObjectList2, then indexObjectList3, then indexObjectList4, and then it loops.
*
* First indexObjectList1 gets an unused index, then indexObjectList2, then indexObjectList3, then indexObjectList4, and
*then it loops.
*
* The objects found at the indices in each list appears to be course dependent
**/
**/
#define NUM_YV_FLAG_POLES 4
@@ -235,12 +234,12 @@ typedef struct {
/* 0x2 */ s16 startZ;
/* 0x4 */ s16 unk_4; // Group Id?
/* 0x6 */ s16 unk_6; // Starting State?
} ThwompSpawn; // size = 0x8;
} ThwompSpawn; // size = 0x8;
extern ThwompSpawn gThomwpSpawns50CC[];
extern ThwompSpawn gThwompSpawns100CCExtra[];
extern ThwompSpawn gThomwpSpawns150CC[];
extern ThwompSpawn *gThowmpSpawnList;
extern ThwompSpawn* gThowmpSpawnList;
extern s16 gNumActiveThwomps;
@@ -267,14 +266,14 @@ extern s32 indexObjectList1[];
typedef struct {
/* 0x0 */ Vec3s pos;
/* 0x6 */ s16 unk_6; // Group Id?
} SnowmanSpawn; // size = 0x8;
} SnowmanSpawn; // size = 0x8;
extern SnowmanSpawn gSnowmanSpawns[];
typedef struct {
/* 0x0 */ Vec3s pos;
/* 0x6 */ s16 unk_06; // Group Id?
} HegdehogSpawn; // size = 0x8;
} HegdehogSpawn; // size = 0x8;
extern HegdehogSpawn gHedgehogSpawns[];
extern Vec3s gHedgehogPatrolPoints[];
@@ -311,15 +310,15 @@ extern s32 indexObjectList3[];
extern s32 indexObjectList4[];
#define gObjectParticle1_SIZE 128
#define NUM_GROUP1_MOLES 8
#define NUM_GROUP1_MOLES 8
#define NUM_GROUP2_MOLES 11
#define NUM_GROUP3_MOLES 12
#define NUM_TOTAL_MOLES (NUM_GROUP1_MOLES + NUM_GROUP2_MOLES + NUM_GROUP3_MOLES)
#define NUM_TOTAL_MOLES (NUM_GROUP1_MOLES + NUM_GROUP2_MOLES + NUM_GROUP3_MOLES)
#define NUM_SNOWFLAKES 0x32
typedef union {
Vec3s asVec3sList[NUM_TOTAL_MOLES];
s16 asFlatList[NUM_TOTAL_MOLES*3];
s16 asFlatList[NUM_TOTAL_MOLES * 3];
} MoleSpawnUnion;
extern MoleSpawnUnion gMoleSpawns;
+6 -2
View File
@@ -41,6 +41,10 @@ typedef struct {
// Lowest dibit is the Mushroom Cup, 2nd dibit is the Flower Cup, etc
u8 grandPrixPoints[4];
u8 soundMode;
} SaveInfo;
typedef struct {
SaveInfo saveInfo;
// It's unknown what the first byte is used for
u8 checksum[3];
} Stuff; // size = 0x8
@@ -53,13 +57,13 @@ typedef struct {
* Instead of 4 entries, one per cup. Or even just one big entry for all 4 cups
* Its also unknown why these are here when they're identical to the values found
* in allCourseTimeTrialRecords
**/
**/
/* 0x188 */ OnlyBestTimeTrialRecords onlyBestTimeTrialRecords[2];
/**
* If checksum[1] or checksum[2] does not match their expected value,
* the grandPrixPoints and soundMode are reset. Then if the backup data's
* checksums are valid, copy the backup data to the main data.
**/
**/
/* 0x1F8 */ Stuff backup;
} SaveData; // size = 0x200
+50 -51
View File
@@ -38,80 +38,79 @@ extern u8 _startupLogoSegmentRomEnd[];
* main 0x80000400
* ending 0x80280000 size 0xDF00
* race 0x8028DF00 size 0x2C470
**/
#define SEG_START 0x80000000
**/
#define SEG_START 0x80000000
// Defines duplicated even if the same for both for easier readability
#ifdef AVOID_UB
#define MEMORY_POOL_START (uintptr_t) &_memoryPoolSegmentNoloadStart[0]
#define MEMORY_POOL_END (uintptr_t) &_memoryPoolSegmentNoloadEnd[0]
#define MEMORY_POOL_START (uintptr_t) & _memoryPoolSegmentNoloadStart[0]
#define MEMORY_POOL_END (uintptr_t) & _memoryPoolSegmentNoloadEnd[0]
#define SEG_ENDING (uintptr_t) &_endingSegmentStart[0]
#define SEG_ENDING_ROM_START (uintptr_t) &_endingSegmentRomStart[0]
/**
* Ending segment original size is 0xDF00 but much of that remains unused.
* This auto fits the segment to its proper size.
*/
#define SEG_ENDING_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_endingSegmentNoloadEnd[0] - &_endingSegmentStart[0]) )
#define SEG_ENDING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]) )
#define SEG_ENDING (uintptr_t) & _endingSegmentStart[0]
#define SEG_ENDING_ROM_START (uintptr_t) & _endingSegmentRomStart[0]
/**
* Ending segment original size is 0xDF00 but much of that remains unused.
* This auto fits the segment to its proper size.
*/
#define SEG_ENDING_SIZE (size_t) ALIGN16((ptrdiff_t) (&_endingSegmentNoloadEnd[0] - &_endingSegmentStart[0]))
#define SEG_ENDING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]))
#define SEG_RACING (uintptr_t) &_racingSegmentStart[0]
#define SEG_RACING_ROM_START (uintptr_t) &_racingSegmentRomStart[0]
#define SEG_RACING_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_racingSegmentNoloadEnd[0] - &_racingSegmentStart[0]) )
#define SEG_RACING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]) )
#define SEG_RACING (uintptr_t) & _racingSegmentStart[0]
#define SEG_RACING_ROM_START (uintptr_t) & _racingSegmentRomStart[0]
#define SEG_RACING_SIZE (size_t) ALIGN16((ptrdiff_t) (&_racingSegmentNoloadEnd[0] - &_racingSegmentStart[0]))
#define SEG_RACING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]))
#define TRIG_TABLES (uintptr_t) &_trigTablesSegmentStart[0]
#define TRIG_TABLES_ROM_START (uintptr_t) &_trigTablesSegmentRomStart[0]
#define TRIG_TABLES_SIZE (size_t) _trigTablesSegmentSize
#define TRIG_TABLES (uintptr_t) & _trigTablesSegmentStart[0]
#define TRIG_TABLES_ROM_START (uintptr_t) & _trigTablesSegmentRomStart[0]
#define TRIG_TABLES_SIZE (size_t) _trigTablesSegmentSize
#define SEG_DATA_START (uintptr_t) &_data_segment2SegmentRomStart[0]
#define SEG_DATA_END (uintptr_t) &_data_segment2SegmentRomEnd[0]
#define SEG_DATA_START (uintptr_t) & _data_segment2SegmentRomStart[0]
#define SEG_DATA_END (uintptr_t) & _data_segment2SegmentRomEnd[0]
#define COMMON_TEXTURES_ROM_START (uintptr_t) &_common_texturesSegmentRomStart[0]
#define COMMON_TEXTURES_SIZE (ptrdiff_t) (&_common_texturesSegmentRomEnd[0] - &_common_texturesSegmentRomStart[0])
#define COMMON_TEXTURES_ROM_START (uintptr_t) & _common_texturesSegmentRomStart[0]
#define COMMON_TEXTURES_SIZE (ptrdiff_t)(&_common_texturesSegmentRomEnd[0] - &_common_texturesSegmentRomStart[0])
#define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
#define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
#define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
#define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
#define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
#define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
#define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
#define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
#else // Required for ok
#define MEMORY_POOL_START (uintptr_t) &_memoryPoolSegmentNoloadStart
#define MEMORY_POOL_END (uintptr_t) 0x80242F00
#define MEMORY_POOL_START (uintptr_t) & _memoryPoolSegmentNoloadStart
#define MEMORY_POOL_END (uintptr_t) 0x80242F00
#define SEG_ENDING (uintptr_t) 0x80280000
#define SEG_ENDING_ROM_START (u8 *) &_endingSegmentRomStart[0]
#define SEG_ENDING_SIZE (size_t) 0xDF00
#define SEG_ENDING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]) )
#define SEG_ENDING (uintptr_t) 0x80280000
#define SEG_ENDING_ROM_START (u8*) &_endingSegmentRomStart[0]
#define SEG_RACING (uintptr_t) 0x8028DF00
#define SEG_RACING_ROM_START (u8 *) &_racingSegmentRomStart[0]
#define SEG_RACING_SIZE (size_t) 0x2C470
#define SEG_ENDING_SIZE (size_t) 0xDF00
#define SEG_ENDING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_endingSegmentRomEnd[0] - &_endingSegmentRomStart[0]))
#define SEG_RACING_ROM_SIZE (size_t) ALIGN16( (ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]) )
#define SEG_RACING (uintptr_t) 0x8028DF00
#define SEG_RACING_ROM_START (u8*) &_racingSegmentRomStart[0]
#define SEG_RACING_SIZE (size_t) 0x2C470
#define TRIG_TABLES (uintptr_t) 0x802BA370
#define TRIG_TABLES_ROM_START (uintptr_t) &_trigTablesSegmentRomStart[0]
#define TRIG_TABLES_SIZE (size_t) 0x5810
#define SEG_RACING_ROM_SIZE (size_t) ALIGN16((ptrdiff_t) (&_racingSegmentRomEnd[0] - &_racingSegmentRomStart[0]))
#define SEG_DATA_START (uintptr_t) &_data_segment2SegmentRomStart[0]
#define SEG_DATA_END (uintptr_t) &_data_segment2SegmentRomEnd[0]
#define TRIG_TABLES (uintptr_t) 0x802BA370
#define TRIG_TABLES_ROM_START (uintptr_t) & _trigTablesSegmentRomStart[0]
#define TRIG_TABLES_SIZE (size_t) 0x5810
#define COMMON_TEXTURES_ROM_START (uintptr_t) &_common_texturesSegmentRomStart[0]
#define COMMON_TEXTURES_SIZE (ptrdiff_t) ((uintptr_t)&_common_texturesSegmentRomEnd - (uintptr_t)&_common_texturesSegmentRomStart)
#define SEG_DATA_START (uintptr_t) & _data_segment2SegmentRomStart[0]
#define SEG_DATA_END (uintptr_t) & _data_segment2SegmentRomEnd[0]
#define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
#define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
#define COMMON_TEXTURES_ROM_START (uintptr_t) & _common_texturesSegmentRomStart[0]
#define COMMON_TEXTURES_SIZE \
(ptrdiff_t)((uintptr_t) & _common_texturesSegmentRomEnd - (uintptr_t) & _common_texturesSegmentRomStart)
#define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
#define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
#define CEREMONY_DATA_ROM_START &_ceremonyDataSegmentRomStart[0]
#define CEREMONY_DATA_ROM_END &_ceremonyDataSegmentRomEnd[0]
#define STARTUP_LOGO_ROM_START &_startupLogoSegmentRomStart[0]
#define STARTUP_LOGO_ROM_END &_startupLogoSegmentRomEnd[0]
#endif /* AVOID_UB */
+1 -8
View File
@@ -15,7 +15,7 @@
((sound_bank << 24) | (byte2 << 16) | (byte3 << 8) | sound_id)
/* Intro */
#define SOUND_INTRO_LOGO SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08) //SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08)
#define SOUND_INTRO_LOGO SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08) // SOUND_ARG_LOAD(0x49, 0x01, 0x80, 0x08)
// Welcome to Mario Kart. Used in intro and credits.
#define SOUND_INTRO_WELCOME SOUND_ARG_LOAD(0x49, 0x00, 0x90, 0x09)
#define SOUND_INTRO_ENTER_MENU SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x1A)
@@ -66,7 +66,6 @@
#define SOUND_MENU_HEADPHONES SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x25)
#define SOUND_MENU_MONO SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x29)
/* Staging */
// Red and orange staging lights that Lakitu holds.
#define SOUND_ACTION_COUNTDOWN_LIGHT SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x03)
@@ -93,7 +92,6 @@
#define SOUND_ITEM_STAR SOUND_ARG_LOAD(0x31, 0x02, 0x90, 0x08)
#define SOUND_ITEM_THUNDERBOLT SOUND_ARG_LOAD(0x51, 0x01, 0xC0, 0x0C)
/* Score Screen */
// Coin pickup sound (perfect fourth; B to E)
#define SOUND_ACTION_COUNT_SCORE SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x17)
@@ -101,7 +99,6 @@
// Same sound as ENTER_MENU
#define SOUND_ACTION_CONTINUE_UNKNOWN SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x1B)
/* Ceremony */
// Congratulation
#define SOUND_CEREMONY_CONGRATULATION SOUND_ARG_LOAD(0x49, 0x00, 0x90, 0x14)
@@ -118,8 +115,4 @@
// Hey, you're very good. See you next time!
#define SOUND_CREDITS_FAREWELL SOUND_ARG_LOAD(0x49, 0x00, 0x80, 0x26)
#endif // SOUNDS_H
-1
View File
@@ -48,7 +48,6 @@ typedef struct {
// Seagulls in KoopaTroopaBeach x 1
// length of 24
// Ghosts in BansheeBoardwalk x 1
// Seagulls in KoopaTroopaBeach x 1
// Penguins in Sherbet Land x 1
+60 -60
View File
@@ -3,12 +3,12 @@
#include <common_structs.h>
#define NUM_1P_PASSENGER_CARS 4
#define NUM_2P_PASSENGER_CARS 1
#define NUM_1P_PASSENGER_CARS 4
#define NUM_2P_PASSENGER_CARS 1
#define NUM_PASSENGER_CAR_ENTRIES 5 // Max 16
#define NUM_TENDERS 1
#define NUM_TRAINS 2
#define LOCOMOTIVE_ONLY 0
#define NUM_TENDERS 1
#define NUM_TRAINS 2
#define LOCOMOTIVE_ONLY 0
#define NUM_CROSSINGS 2
// This allows karts to jump the train despite the crossing being activated.
@@ -19,15 +19,15 @@
#define NUM_ACTIVE_PADDLE_BOATS 1
#define NUM_PADDLE_BOATS 2
#define NUM_RACE_BOX_TRUCKS 7
#define NUM_RACE_SCHOOL_BUSES 7
#define NUM_RACE_BOX_TRUCKS 7
#define NUM_RACE_SCHOOL_BUSES 7
#define NUM_RACE_TANKER_TRUCKS 7
#define NUM_RACE_CARS 7
#define NUM_RACE_CARS 7
#define NUM_TIME_TRIAL_BOX_TRUCKS (NUM_RACE_BOX_TRUCKS + 1)
#define NUM_TIME_TRIAL_SCHOOL_BUSES (NUM_RACE_SCHOOL_BUSES + 1)
#define NUM_TIME_TRIAL_BOX_TRUCKS (NUM_RACE_BOX_TRUCKS + 1)
#define NUM_TIME_TRIAL_SCHOOL_BUSES (NUM_RACE_SCHOOL_BUSES + 1)
#define NUM_TIME_TRIAL_TANKER_TRUCKS (NUM_RACE_TANKER_TRUCKS + 1)
#define NUM_TIME_TRIAL_CARS (NUM_RACE_CARS + 1)
#define NUM_TIME_TRIAL_CARS (NUM_RACE_CARS + 1)
#define TRAIN_SMOKE_RENDER_DISTANCE 2000.0f
#define TRAIN_CROSSING_AI_DISTANCE 1000.0f
@@ -36,62 +36,62 @@
#define RENDER_VEHICLE 1
typedef struct {
/* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives
/* 0x02 */ s16 compilerPadding;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ u16 waypointIndex;
/* 0x1E */ s16 actorIndex;
/* 0x20 */ s32 unused; // Not read or written. Could be padding?
} TrainCarStuff; // size = 0x24;
/* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives
/* 0x02 */ s16 compilerPadding;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ u16 waypointIndex;
/* 0x1E */ s16 actorIndex;
/* 0x20 */ s32 unused; // Not read or written. Could be padding?
} TrainCarStuff; // size = 0x24;
typedef struct {
/* 0x000 */ TrainCarStuff locomotive;
/* 0x024 */ TrainCarStuff tender;
/* 0x048 */ TrainCarStuff passengerCars[NUM_PASSENGER_CAR_ENTRIES];
/* 0x0FC */ f32 someMultiplier;
/* 0x100 */ s32 someFlags;
/* 0x104 */ s32 numCars; // Non-locomotive car count?
/* 0x108 */ s32 unused; // Not read or written. Could be padding?
} TrainStuff; // size = 0x10C
/* 0x000 */ TrainCarStuff locomotive;
/* 0x024 */ TrainCarStuff tender;
/* 0x048 */ TrainCarStuff passengerCars[NUM_PASSENGER_CAR_ENTRIES];
/* 0x0FC */ f32 speed;
/* 0x100 */ s32 someFlags;
/* 0x104 */ s32 numCars; // Non-locomotive car count?
/* 0x108 */ s32 unused; // Not read or written. Could be padding?
} TrainStuff; // size = 0x10C
typedef struct {
/* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position; //
/* 0x10 */ Vec3f velocity; //
/* 0x1C */ u16 waypointIndex; //
/* 0x1E */ s16 actorIndex; //
/* 0x20 */ f32 someMultiplier; //
/* 0x24 */ s16 rotY; // Only Y rotation is tracked in this struct
/* 0x26 */ // s16 compilerPadding2;
/**
* Bit field that tracks whether a given human player is within a certain distance of the boat
* Probably audio related
**/
/* 0x28 */ s32 someFlags;
/* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position; //
/* 0x10 */ Vec3f velocity; //
/* 0x1C */ u16 waypointIndex; //
/* 0x1E */ s16 actorIndex; //
/* 0x20 */ f32 speed; //
/* 0x24 */ s16 rotY; // Only Y rotation is tracked in this struct
/* 0x26 */ // s16 compilerPadding2;
/**
* Bit field that tracks whether a given human player is within a certain distance of the boat
* Probably audio related
**/
/* 0x28 */ s32 someFlags;
} PaddleBoatStuff; // size = 0x2C
typedef struct {
/* 0x00 */ s16 unused; // Gets set to 0, but doesn't seem to have any purpose
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ u16 waypointIndex;
/* 0x1E */ s16 actorIndex;
/* 0x20 */ f32 someMultiplier; //
/* 0x24 */ f32 someMultiplierTheSequel; //
/* 0x28 */ Vec3s rotation;
/* 0x2E */ s16 someType; //
/**
* Each set of flags seems to be a bit field tracking whether a given human player
* is within a certain distance of the vehicle. Likely related to audio stuff
* Seems to turn on/off based on player distance from the vehicle
**/
/* 0x30 */ s8 someFlags; //
/* 0x31 */ s8 someFlagsTheSequel; //
/* 0x32 */ // s16 compilerPadding2;
} VehicleStuff; // size = 0x34
/* 0x00 */ s16 unused; // Gets set to 0, but doesn't seem to have any purpose
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ u16 waypointIndex;
/* 0x1E */ s16 actorIndex;
/* 0x20 */ f32 speed; //
/* 0x24 */ f32 someMultiplierTheSequel; //
/* 0x28 */ Vec3s rotation;
/* 0x2E */ s16 someType; //
/**
* Each set of flags seems to be a bit field tracking whether a given human player
* is within a certain distance of the vehicle. Likely related to audio stuff
* Seems to turn on/off based on player distance from the vehicle
**/
/* 0x30 */ s8 someFlags; //
/* 0x31 */ s8 someFlagsTheSequel; //
/* 0x32 */ // s16 compilerPadding2;
} VehicleStuff; // size = 0x34
extern TrainStuff gTrainList[];
+15 -16
View File
@@ -7,30 +7,30 @@ typedef struct {
/* 0x00 */ s16 posX;
/* 0x02 */ s16 posY;
/* 0x04 */ s16 posZ;
/* 0x06 */ u16 courseSection;
/* 0x06 */ u16 trackSectionId;
} TrackWaypoint; // size = 0x08
/**
* These are per-path arrays that contain some information relating to waypoints
* The arrays in D_80164550 contain X/Y/Z and track segment information
* The arrays in D_80164560 and D_80164570 track some other X/Y/Z, but the track segment is always 0 (so, untracked/unused)
* Its unclear how these arrays relate to each other
* The arrays in D_80164560 and D_80164570 track some other X/Y/Z, but the track segment is always 0 (so,
*untracked/unused) Its unclear how these arrays relate to each other
**/
extern TrackWaypoint *D_80164550[];
extern TrackWaypoint *D_80164560[];
extern TrackWaypoint *D_80164570[];
extern TrackWaypoint* D_80164550[];
extern TrackWaypoint* D_80164560[];
extern TrackWaypoint* D_80164570[];
/**
* Don't know what exactly these are, but like D_80164550, D_80164560, and D_80164570
* they track something about the waypoints on a per-path basis
**/
// Waypoint types?
extern s16 *D_80164580[];
extern s16* D_80164580[];
// Based on func_80010DBC this may be angles between waypoints
// D_80164590[i] = atan2(waypoint_i, waypoint_i+1)?
extern s16 *D_80164590[];
extern s16* D_80164590[];
// No idea. Adjacency list?
extern s16 *D_801645A0[];
extern s16* D_801645A0[];
/**
* Certain parts of the waypoint logic will copy some path/player specific data to a temporary variable.
@@ -42,20 +42,19 @@ extern s16 sSomeNearestWaypoint;
// Shadows values from gPathIndexByPlayerId
extern s32 D_80163448;
// Shadows values from D_80164560
extern TrackWaypoint *D_801631D0;
extern TrackWaypoint* D_801631D0;
// Shadows values from D_80164570
extern TrackWaypoint *D_801631D4;
extern TrackWaypoint* D_801631D4;
// Shadows values from D_80164580
extern s16 *D_801631D8;
extern s16* D_801631D8;
// Shadows values from D_80164590
extern s16 *D_801631DC;
extern s16* D_801631DC;
// Shadowd values from gWaypointCountByPathIndex
extern u16 D_80164430;
// Shadows values from D_80164550
extern TrackWaypoint *D_80164490;
extern TrackWaypoint* D_80164490;
// Shadows values from D_801645A0
extern s16 *D_801645E0;
extern s16* D_801645E0;
extern u16 gNearestWaypointByPlayerId[]; // D_80164438
// Total waypoints passed by playerId?