Refresh 14

This commit is contained in:
n64
2021-07-12 23:17:54 -04:00
parent ecd3d152fb
commit f9982e0ef5
251 changed files with 7496 additions and 5757 deletions
+192 -37
View File
@@ -56,13 +56,14 @@
#define A_ADDMIXER 4
#define A_RESAMPLE_ZOH 6
#define A_INTERL 17
#define A_DMEMMOVE2 16
#define A_DOWNSAMPLE_HALF 17
#define A_ENVSETUP1 18
#define A_ENVMIXER 19
#define A_LOADBUFF 20
#define A_SAVEBUFF 21
#define A_ENVSETUP2 22
#define A_UNK_23 23
#define A_S8DEC 23
#define A_HILOGAIN 24
#define A_UNK_25 25
#define A_DUPLICATE 26
@@ -306,6 +307,8 @@ typedef short ENVMIX_STATE[40];
* address is later used as parameter, the 8 high bits will be an index
* to the segment table and the lower 24 bits are added to the base address
* stored in the segment table for this entry. The result is the physical address.
* With the newer rsp audio code, this segment table is not used. The address is
* used directly instead.
*
* Transfers to/from DRAM are executed using DMA and hence follow these restrictions:
* All DRAM addresses should be aligned by 8 bytes, or they will be
@@ -349,14 +352,6 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t)(s); \
}
#define aADPCM_23(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_UNK_23, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
/*
* Not used in SM64.
*/
@@ -570,15 +565,6 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
#define aInterl(pkt, f, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_INTERL, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(i, 0, 16)); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Sets internal volume parameters.
* See aEnvMixer for more info.
@@ -663,12 +649,50 @@ typedef short ENVMIX_STATE[40];
#undef aEnvMixer
#undef aInterleave
// New or modified operations in the new audio microcode below
/**
* Decompresses S8 data.
* Possible flags: A_INIT and A_LOOP.
*
* First set up internal data in DMEM:
* aSetLoop(cmd++, physicalAddressOfLoopState) (if A_LOOP is set)
*
* Then before this command, call:
* aSetBuffer(cmd++, 0, in, out, count)
*
* Note: count will be rounded up to the nearest multiple of 32 bytes.
*
* S8 decompression works by expanding s8 bytes into s16 numbers,
* by performing a left shift of 8 steps.
*
* Before the algorithm starts, the previous 16 samples are loaded according to flag:
* A_INIT: all zeros
* A_LOOP: the address set by aSetLoop
* no flags: the DRAM address in the s parameter
* These 16 samples are immediately copied to the destination address.
*
* The result of "count" bytes will be written after these 16 initial samples.
* The last 16 samples written to the destination will also be written to
* the state address in DRAM.
*/
#define aS8Dec(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_S8DEC, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
/*
* Mix two tracks by simple clamped addition.
*
* s: DMEM source track 1
* d: DMEM source track 2 and destination
* c: number of bytes to write (rounded down to 16 byte alignment)
* c: number of bytes to write
*
* Note: count is first rounded down to the nearest multiple of 16 bytes
* and then rounded up to the nearest multiple of 64 bytes.
*/
#define aAddMixer(pkt, s, d, c) \
{ \
@@ -726,6 +750,28 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (_SHIFTL(d, 16, 16) | _SHIFTL(0x80, 0, 16)); \
}
/*
* Copies memory in DMEM, second version.
*
* Copies t * c bytes from address i to address o.
*
* Note: count is first rounded up to the nearest multiple of 32 bytes,
* before the multiplication by t.
*
* Note: This acts as memcpy where 32 bytes are moved at a time, therefore
* if input and output overlap, output address should be less than input address.
*
* Not used in SM64.
*/
#define aDMEMMove2(pkt, t, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_DMEMMOVE2, 24, 8) | \
_SHIFTL(t, 16, 8) | _SHIFTL(i, 0, 16); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Fast resample.
*
@@ -734,14 +780,37 @@ typedef short ENVMIX_STATE[40];
*
* This works like the other resample command but just takes the "nearest" sample,
* instead of a function of the four nearest samples.
*
* Initially the current position is calculated as (in << 16) + startFract.
* For every sample to create, the value is simply taken from the sample
* at address ((position >> 17) << 1). Then the current position is incremented
* by (pitch << 2).
*
* Note: count represents the number of output bytes to create, and is
* rounded up to the nearest multiple of 8 bytes.
*/
#define aResampleZoh(pkt, pitch, start_fract) \
#define aResampleZoh(pkt, pitch, startFract) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | \
_SHIFTL(pitch, 0, 16)); \
_a->words.w1 = _SHIFTL(start_fract, 0, 16); \
_a->words.w1 = _SHIFTL(startFract, 0, 16); \
}
/*
* Fast downsampling by taking every other sample, discarding others.
*
* Note: nSamples refers to the number of output samples to create, and
* is first rounded up to the nearest multiple of 8.
*/
#define aDownsampleHalf(pkt, nSamples, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_DOWNSAMPLE_HALF, 24, 8) | \
_SHIFTL(nSamples, 0, 16)); \
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
}
/*
@@ -764,39 +833,87 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \
}
#define aEnvSetup1(pkt, a, b, c, d) \
/*
* See aEnvMixer for more info.
*/
#define aEnvSetup1(pkt, initialVolReverb, rampReverb, rampLeft, rampRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | \
_SHIFTL(a, 16, 8) | _SHIFTL(b, 0, 16)); \
_a->words.w1 = _SHIFTL(c, 16, 16) | _SHIFTL(d, 0, 16); \
_SHIFTL(initialVolReverb, 16, 8) | \
_SHIFTL(rampReverb, 0, 16)); \
_a->words.w1 = _SHIFTL(rampLeft, 16, 16) | \
_SHIFTL(rampRight, 0, 16); \
}
#define aEnvSetup2(pkt, volLeft, volRight) \
/*
* See aEnvMixer for more info.
*/
#define aEnvSetup2(pkt, initialVolLeft, initialVolRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \
_a->words.w1 = _SHIFTL(volLeft, 16, 16) | \
_SHIFTL(volRight, 0, 16); \
_a->words.w1 = _SHIFTL(initialVolLeft, 16, 16) | \
_SHIFTL(initialVolRight, 0, 16); \
}
#define aEnvMixer(pkt, inBuf, nSamples, bit1, bit2, bit3, dryLeft, dryRight, wetLeft, wetRight) \
/*
* Mixes an envelope with mono sound into 4 channels.
*
* To allow for many parameters, a sequence of aEnvSetup1, aEnvSetup2,
* aEnvMixer shall always be called.
*
* The function works in blocks of 8 samples.
* However, nSamples is rounded up to the nearest multiple of 16 samples.
*
* For each sample in a block:
* 1. sampleLeft = in * volLeft * (negLeft ? -1 : 1)
* 2. sampleRight = in * volRight * (negRight ? -1 : 1)
* 3. dryLeft += sampleLeft
* 4. dryRight += sampleRight
* 5. if swapReverb: swap sampleLeft and sampleRight
* 6. wetLeft += sampleLeft * volReverb
* 7. wetRight += sampleRight * volReverb
*
* After each block, all vol variables are added by their corresponding
* ramp value.
*
* Each volume variable is treated as a UQ0.16 number. Make sure
* the ramp additions don't overflow, or wrapping will occur.
* The initialVolReverb parameter is only 8 bits, but will be left
* shifted 8 bits by the rsp.
*/
#define aEnvMixer(pkt, inBuf, nSamples, swapReverb, negLeft, negRight, \
dryLeft, dryRight, wetLeft, wetRight) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | \
_SHIFTL((inBuf) >> 4, 16, 8) | \
_SHIFTL(nSamples, 8, 8)) | \
_SHIFTL(bit1, 2, 1) | _SHIFTL(bit2, 1, 1) | \
_SHIFTL(bit3, 0, 1); \
_SHIFTL(swapReverb, 2, 1) | _SHIFTL(negLeft, 1, 1) |\
_SHIFTL(negRight, 0, 1); \
_a->words.w1 = _SHIFTL((dryLeft) >> 4, 24, 8) | \
_SHIFTL((dryRight) >> 4, 16, 8) | \
_SHIFTL((wetLeft) >> 4, 8, 8) | \
_SHIFTL((wetRight) >> 4, 0, 8); \
}
/*
* Interleaves two mono channels into stereo.
*
* The count refers to the size of each input. Hence 2 * count bytes
* will be written out.
*
* A left sample will be placed before the right sample.
* All addresses (output, left, right) are DMEM addresses.
*
* Note: count will be rounded up to the nearest multiple of 8 bytes.
* The previous version of this function rounded up to the nearest
* multiple of 16 bytes.
*/
#define aInterleave(pkt, o, l, r, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -806,7 +923,26 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
}
// countOrBuf meaning depends on flag
/*
* Linear filter function.
*
* Calculates out[i] = sum all elements in the vector in[i..i-7] * filter[0..7],
* where "*" represents dot multiplication. The input/output contains s16
* samples and filter contains Q1.15 signed fixed point numbers.
* Every result sample is rounded and clamped.
*
* First initiate by calling with the flag f set to 2, countOrBuf contains
* the length in bytes that shall be processed in the next call. The addr
* parameter shall contain the DRAM address to the filter table (16 bytes).
* The count will be rounded up to the nearest multiple of 16 bytes.
*
* The aFilter function shall then be called in direct succession, with flag
* set to either 0 or 1. The countOrBuf parameter shall contain the DMEM
* address for the input/output. The addr parameter shall contain the DRAM
* address for the state, containing the last previous 8 input samples.
* The state is always written to upon exit, but is only read at entry if
* the flag is 0 (otherwise all-zero samples are used instead).
*/
#define aFilter(pkt, f, countOrBuf, addr) \
{ \
Acmd *_a = (Acmd *)pkt; \
@@ -816,22 +952,41 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t)(addr); \
}
#define aHilogain(pkt, id, buflen, i) \
/*
* Modifies the volume of samples using a simple UQ4.4 gain multiplier.
*
* Performs the following:
*
* 1. Count c is rounded up to 32 byte alignment
* 2. g is a u8 that contains a UQ4.4 number
* 3. Modify each sample s, so that s = clamp_s16(s * g >> 4)
*/
#define aHiLoGain(pkt, g, buflen, i) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_HILOGAIN, 24, 8) | \
_SHIFTL((id), 16, 8) | _SHIFTL((buflen), 0, 16); \
_SHIFTL((g), 16, 8) | _SHIFTL((buflen), 0, 16); \
_a->words.w1 = _SHIFTL((i), 16, 16); \
}
#define aUnknown25(pkt, f, g, i, o) \
/*
* Performs the following:
*
* 1. Count c is rounded up to 64 byte alignment
* 2. f is added to i
* 3. i and o are from now treated as s16 pointers
* 4. 32 s16 samples are loaded from i to tbl
* 5. for (u32 idx = 0; idx * sizeof(s16) < c; idx++)
* o[idx] = clamp_s16((s32)o[idx] * (s32)tbl[idx % 32]);
*/
#define aUnknown25(pkt, f, c, o, i) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_UNK_25, 24, 8) | \
_SHIFTL((f), 16, 8) | _SHIFTL((g), 0, 16)); \
_a->words.w1 = _SHIFTL((i), 16, 16) | _SHIFTL((o), 0, 16); \
_SHIFTL((f), 16, 8) | _SHIFTL((c), 0, 16)); \
_a->words.w1 = _SHIFTL((o), 16, 16) | _SHIFTL((i), 0, 16); \
}
#endif
+4 -1
View File
@@ -8,7 +8,8 @@ typedef struct
u8 *offset;
s32 len;
#ifdef VERSION_SH
s8 magic[2]; // tbl: 0x0204, otherwise: 0x0203
s8 medium;
s8 magic; // tbl: 0x04, otherwise: 0x03
// for ctl (else zeros):
union {
@@ -38,7 +39,9 @@ typedef struct
#ifdef VERSION_SH
s16 unk2;
u8 *data;
#if !IS_64_BIT
s32 pad[2];
#endif
#endif
ALSeqData seqArray[1];
} ALSeqFile;
+800
View File
@@ -0,0 +1,800 @@
/*====================================================================
* os.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.149 $
* $Date: 1997/12/15 04:30:52 $
* $Source: /disk6/Master/cvsmdev2/PR/include/os.h,v $
*
**************************************************************************/
#ifndef _OS_H_
#define _OS_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "PR/os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Structure for device manager block
*/
typedef struct {
s32 active; /* Status flag */
OSThread *thread; /* Calling thread */
OSMesgQueue *cmdQueue; /* Command queue */
OSMesgQueue *evtQueue; /* Event queue */
OSMesgQueue *acsQueue; /* Access queue */
/* Raw DMA routine */
s32 (*dma)(s32, u32, void *, u32);
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
} OSDevMgr;
/*
* Structure for file system
*/
typedef struct {
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
} OSPfs;
typedef struct {
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
} OSPfsState;
/*
* Structure for Profiler
*/
typedef struct {
u16 *histo_base; /* histogram base */
u32 histo_size; /* histogram size */
u32 *text_start; /* start of text segment */
u32 *text_end; /* end of text segment */
} OSProf;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* Thread states */
#define OS_STATE_STOPPED 1
#define OS_STATE_RUNNABLE 2
#define OS_STATE_RUNNING 4
#define OS_STATE_WAITING 8
/* Events */
#ifdef _FINALROM
#define OS_NUM_EVENTS 15
#else
#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 */
#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
#endif
/* Flags for debugging purpose */
#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
/* Recommended thread priorities for the system threads */
#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 /* Must be 0 */
/* Flags to turn blocking on/off when sending/receiving message */
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
/* Flags to indicate direction of data transfer */
#define OS_READ 0 /* device -> RDRAM */
#define OS_WRITE 1 /* device <- RDRAM */
#define OS_OTHERS 2 /* for Leo disk only */
/*
* I/O message types
*/
#define OS_MESG_TYPE_BASE (10)
#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE+0)
#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE+1)
#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE+2)
#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE+3)
#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE+4)
#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE+5)
#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE+6)
/*
* I/O message priority
*/
#define OS_MESG_PRI_NORMAL 0
#define OS_MESG_PRI_HIGH 1
/*
* 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
/*
* Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager),
* SIM (SI Manager)
*
*/
#define OS_PIM_STACKSIZE 4096
#define OS_VIM_STACKSIZE 4096
#define OS_SIM_STACKSIZE 4096
#define OS_MIN_STACKSIZE 72
/*
* Values for osTvType
*/
#define OS_TV_PAL 0
#define OS_TV_NTSC 1
#define OS_TV_MPAL 2
/*
* Video Interface (VI) mode type
*/
#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
#define OS_VI_MPAL_LPN1 28 /* MPAL - mainly Brazil */
#define OS_VI_MPAL_LPF1 29
#define OS_VI_MPAL_LAN1 30
#define OS_VI_MPAL_LAF1 31
#define OS_VI_MPAL_LPN2 32
#define OS_VI_MPAL_LPF2 33
#define OS_VI_MPAL_LAN2 34
#define OS_VI_MPAL_LAF2 35
#define OS_VI_MPAL_HPN1 36
#define OS_VI_MPAL_HPF1 37
#define OS_VI_MPAL_HAN1 38
#define OS_VI_MPAL_HAF1 39
#define OS_VI_MPAL_HPN2 40
#define OS_VI_MPAL_HPF2 41
/*
* Video Interface (VI) special features
*/
#define OS_VI_GAMMA_ON 0x0001
#define OS_VI_GAMMA_OFF 0x0002
#define OS_VI_GAMMA_DITHER_ON 0x0004
#define OS_VI_GAMMA_DITHER_OFF 0x0008
#define OS_VI_DIVOT_ON 0x0010
#define OS_VI_DIVOT_OFF 0x0020
#define OS_VI_DITHER_FILTER_ON 0x0040
#define OS_VI_DITHER_FILTER_OFF 0x0080
/*
* Video Interface (VI) mode attribute bit
*/
#define OS_VI_BIT_NONINTERLACE 0x0001 /* lo-res */
#define OS_VI_BIT_INTERLACE 0x0002 /* lo-res */
#define OS_VI_BIT_NORMALINTERLACE 0x0004 /* hi-res */
#define OS_VI_BIT_DEFLICKINTERLACE 0x0008 /* hi-res */
#define OS_VI_BIT_ANTIALIAS 0x0010
#define OS_VI_BIT_POINTSAMPLE 0x0020
#define OS_VI_BIT_16PIXEL 0x0040
#define OS_VI_BIT_32PIXEL 0x0080
#define OS_VI_BIT_LORES 0x0100
#define OS_VI_BIT_HIRES 0x0200
#define OS_VI_BIT_NTSC 0x0400
#define OS_VI_BIT_PAL 0x0800
/*
* Leo Disk
*/
/* transfer mode */
#define LEO_BLOCK_MODE 1
#define LEO_TRACK_MODE 2
#define LEO_SECTOR_MODE 3
/*
* Controllers number
*/
#ifndef _HW_VERSION_1
#define MAXCONTROLLERS 4
#else
#define MAXCONTROLLERS 6
#endif
/* controller errors */
#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
/* 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
/* Controller status */
#define CONT_CARD_ON 0x01
#define CONT_CARD_PULL 0x02
#define CONT_ADDR_CRC_ER 0x04
#define CONT_EEPROM_BUSY 0x80
/* EEPROM TYPE */
#define EEPROM_TYPE_4K 0x01
#define EEPROM_TYPE_16K 0x02
/* 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
/* 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
/* File System size */
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
#define PFS_FILE_NAME_LEN 16
#define PFS_FILE_EXT_LEN 4
#define BLOCKSIZE 32 /* bytes */
#define PFS_ONE_PAGE 8 /* blocks */
#define PFS_MAX_BANKS 62
/* File System flag */
#define PFS_READ 0
#define PFS_WRITE 1
#define PFS_CREATE 2
/* File System status */
#define PFS_INITIALIZED 0x1
#define PFS_CORRUPTED 0x2 /* File system was corrupted */
/* File System error number */
#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */
#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */
/* different one */
#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */
#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/
#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/
#define PFS_DATA_FULL 7 /* no free pages on ram pack */
#define PFS_DIR_FULL 8 /* no free directories on ram pack*/
#define PFS_ERR_EXIST 9 /* file exists */
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
#define PFS_ERR_DEVICE 11 /* wrong device type*/
/* definition for EEPROM */
#define EEPROM_MAXBLOCKS 64
#define EEP16K_MAXBLOCKS 256
#define EEPROM_BLOCK_SIZE 8
/*
* PI/EPI
*/
#define PI_DOMAIN1 0
#define PI_DOMAIN2 1
/*
* Profiler constants
*/
#define PROF_MIN_INTERVAL 50 /* microseconds */
/*
* Boot addresses
*/
#define BOOT_ADDRESS_ULTRA 0x80000400
#define BOOT_ADDRESS_COSIM 0x80002000
#define BOOT_ADDRESS_EMU 0x20010000
#define BOOT_ADDRESS_INDY 0x88100000
/*
* Size of buffer the retains contents after NMI
*/
#define OS_APP_NMI_BUFSIZE 64
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/* PARTNER-N64 */
#ifdef PTN64
#define osReadHost osReadHost_pt
#define osWriteHost osWriteHost_pt
#endif
/* Get count of valid messages in queue */
#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)
/*
* CPU counter increments at 3/4 of bus clock rate:
*
* Bus Clock Proc Clock Counter (1/2 Proc Clock)
* --------- ---------- ------------------------
* 62.5 Mhz 93.75 Mhz 46.875 Mhz
*/
extern u64 osClockRate;
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
/**************************************************************************
*
* Extern variables
*
*/
extern OSViMode osViModeTable[]; /* Global VI mode table */
extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */
extern OSViMode osViModeNtscLpf1;
extern OSViMode osViModeNtscLan1;
extern OSViMode osViModeNtscLaf1;
extern OSViMode osViModeNtscLpn2;
extern OSViMode osViModeNtscLpf2;
extern OSViMode osViModeNtscLan2;
extern OSViMode osViModeNtscLaf2;
extern OSViMode osViModeNtscHpn1;
extern OSViMode osViModeNtscHpf1;
extern OSViMode osViModeNtscHan1;
extern OSViMode osViModeNtscHaf1;
extern OSViMode osViModeNtscHpn2;
extern OSViMode osViModeNtscHpf2;
extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */
extern OSViMode osViModePalLpf1;
extern OSViMode osViModePalLan1;
extern OSViMode osViModePalLaf1;
extern OSViMode osViModePalLpn2;
extern OSViMode osViModePalLpf2;
extern OSViMode osViModePalLan2;
extern OSViMode osViModePalLaf2;
extern OSViMode osViModePalHpn1;
extern OSViMode osViModePalHpf1;
extern OSViMode osViModePalHan1;
extern OSViMode osViModePalHaf1;
extern OSViMode osViModePalHpn2;
extern OSViMode osViModePalHpf2;
extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */
extern OSViMode osViModeMpalLpf1;
extern OSViMode osViModeMpalLan1;
extern OSViMode osViModeMpalLaf1;
extern OSViMode osViModeMpalLpn2;
extern OSViMode osViModeMpalLpf2;
extern OSViMode osViModeMpalLan2;
extern OSViMode osViModeMpalLaf2;
extern OSViMode osViModeMpalHpn1;
extern OSViMode osViModeMpalHpf1;
extern OSViMode osViModeMpalHan1;
extern OSViMode osViModeMpalHaf1;
extern OSViMode osViModeMpalHpn2;
extern OSViMode osViModeMpalHpf2;
extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
extern u32 osRomBase; /* Rom base address of the game image */
extern u32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
extern u32 osResetType; /* 0 = cold reset, 1 = NMI */
extern s32 osCicId;
extern s32 osVersion;
extern u32 osMemSize; /* Memory Size */
extern s32 osAppNMIBuffer[];
extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Thread operations */
extern void osCreateThread(OSThread *, OSId, void (*)(void *),
void *, void *, OSPri);
extern void osDestroyThread(OSThread *);
extern void osYieldThread(void);
extern void osStartThread(OSThread *);
extern void osStopThread(OSThread *);
extern OSId osGetThreadId(OSThread *);
extern void osSetThreadPri(OSThread *, OSPri);
extern OSPri osGetThreadPri(OSThread *);
/* 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);
/* Event operations */
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
/* Interrupt operations */
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
/* RDB port operations */
extern void osInitRdb(u8 *sendBuf, u32 sendSize);
/* 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);
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
/* 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);
/* Address translation routines and macros */
extern u32 osVirtualToPhysical(void *);
extern void * osPhysicalToVirtual(u32);
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000))
#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000))
/* I/O operations */
/* Audio interface (Ai) */
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
/* Display processor interface (Dp) */
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
/* Peripheral interface (Pi) */
extern u32 osPiGetStatus(void);
extern s32 osPiGetDeviceType(void);
extern s32 osPiRawWriteIo(u32, u32);
extern s32 osPiRawReadIo(u32, u32 *);
extern s32 osPiRawStartDma(s32, u32, void *, u32);
extern s32 osPiWriteIo(u32, u32);
extern s32 osPiReadIo(u32, u32 *);
extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32,
OSMesgQueue *);
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
/* Video interface (Vi) */
extern u32 osViGetStatus(void);
extern u32 osViGetCurrentMode(void);
extern u32 osViGetCurrentLine(void);
extern u32 osViGetCurrentField(void);
extern void *osViGetCurrentFramebuffer(void);
extern void *osViGetNextFramebuffer(void);
extern void osViSetXScale(f32);
extern void osViSetYScale(f32);
extern void osViSetSpecialFeatures(u32);
extern void osViSetMode(OSViMode *);
extern void osViSetEvent(OSMesgQueue *, OSMesg, u32);
extern void osViSwapBuffer(void *);
extern void osViBlack(u8);
extern void osViFade(u8, u16);
extern void osViRepeatLine(u8);
extern void osCreateViManager(OSPri);
/* Timer interface */
extern OSTime osGetTime(void);
extern void osSetTime(OSTime);
extern u32 osSetTimer(OSTimer *, OSTime, OSTime,
OSMesgQueue *, OSMesg);
extern int osStopTimer(OSTimer *);
/* Controller interface */
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);
#endif
extern void osContGetQuery(OSContStatus *);
extern void osContGetReadData(OSContPad *);
/* file system interface */
extern s32 osPfsInitPak(OSMesgQueue *, OSPfs *, int);
extern s32 osPfsRepairId(OSPfs *);
extern s32 osPfsInit(OSMesgQueue *, OSPfs *, int);
extern s32 osPfsReFormat(OSPfs *, OSMesgQueue *, int);
extern s32 osPfsChecker(OSPfs *);
extern s32 osPfsAllocateFile(OSPfs *, u16, u32, u8 *, u8 *, int, s32 *);
extern s32 osPfsFindFile(OSPfs *, u16, u32, u8 *, u8 *, s32 *);
extern s32 osPfsDeleteFile(OSPfs *, u16, u32, u8 *, u8 *);
extern s32 osPfsReadWriteFile(OSPfs *, s32, u8, int, int, u8 *);
extern s32 osPfsFileState(OSPfs *, s32, OSPfsState *);
extern s32 osPfsGetLabel(OSPfs *, u8 *, int *);
extern s32 osPfsSetLabel(OSPfs *, u8 *);
extern s32 osPfsIsPlug(OSMesgQueue *, u8 *);
extern s32 osPfsFreeBlocks(OSPfs *, s32 *);
extern s32 osPfsNumFiles(OSPfs *, s32 *, s32 *);
/* 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);
/* MOTOR interface */
extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int);
extern s32 osMotorStop(OSPfs *);
extern s32 osMotorStart(OSPfs *);
/* Enhanced PI interface */
extern OSPiHandle *osCartRomInit(void);
extern OSPiHandle *osLeoDiskInit(void);
extern OSPiHandle *osDriveRomInit(void);
extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *);
extern s32 osEPiRawWriteIo(OSPiHandle *, u32 , u32);
extern s32 osEPiRawReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 );
extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 );
extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32);
extern s32 osEPiLinkHandle(OSPiHandle *);
/* Profiler Interface */
extern void osProfileInit(OSProf *, u32 profcnt);
extern void osProfileStart(u32);
extern void osProfileFlush(void);
extern void osProfileStop(void);
/* Game <> Host data transfer functions */
extern s32 osTestHost(void);
extern void osReadHost(void *, u32);
extern void osWriteHost(void *, u32);
extern void osAckRamromRead(void);
extern void osAckRamromWrite(void);
/* byte string operations */
extern void bcopy(const void *, void *, size_t);
extern int bcmp(const void *, const void *, int);
extern void bzero(void *, size_t);
/* Miscellaneous operations */
extern void osInitialize(void);
extern u32 osGetCount(void);
extern void osExit(void);
extern u32 osGetMemSize(void);
/* Printf */
extern int sprintf(char *s, const char *fmt, ...);
extern void osSyncPrintf(const char *fmt, ...);
extern void osAsyncPrintf(const char *fmt, ...);
extern int osSyncGetChars(char *buf);
extern int osAsyncGetChars(char *buf);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_H */
+1 -1
View File
@@ -261,7 +261,7 @@ extern const BehaviorScript bhvBoo[];
extern const BehaviorScript bhvMerryGoRoundBoo[];
extern const BehaviorScript bhvGhostHuntBoo[];
extern const BehaviorScript bhvHiddenStaircaseStep[];
extern const BehaviorScript bhvBooBossSpawnedBridge[];
extern const BehaviorScript bhvBooStaircase[];
extern const BehaviorScript bhvBbhTiltingTrapPlatform[];
extern const BehaviorScript bhvHauntedBookshelf[];
extern const BehaviorScript bhvMeshElevator[];
+12 -1
View File
@@ -8,7 +8,7 @@
*/
// Bug Fixes
// --| US Version Nintendo Bug Fixes
// --| Post-JP Version Nintendo Bug Fixes
/// Fixes bug where obtaining over 999 coins sets the number of lives to 999 (or -25)
#define BUGFIX_MAX_LIVES (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where the Boss music won't fade out after defeating King Bob-omb
@@ -22,6 +22,17 @@
#define BUGFIX_PIRANHA_PLANT_SLEEP_DAMAGE (0 || VERSION_US || VERSION_SH)
/// Fixes bug where it shows a star when you grab a key in bowser battle stages
#define BUGFIX_STAR_BOWSER_KEY (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug that enables Mario in time stop even if is not ready to speak
#define BUGFIX_DIALOG_TIME_STOP (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug that causes Mario to still collide with Bowser in BITS after his defeat
#define BUGFIX_BOWSER_COLLIDE_BITS_DEAD (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where Bowser wouldn't reset his speed when fallen off (and adds missing checks)
#define BUGFIX_BOWSER_FALLEN_OFF_STAGE (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where Bowser would look weird while fading out
#define BUGFIX_BOWSER_FADING_OUT (0 || VERSION_US || VERSION_EU || VERSION_SH)
// Support Rumble Pak
#define ENABLE_RUMBLE (0 || VERSION_SH)
// Screen Size Defines
#define SCREEN_WIDTH 320
+1
View File
@@ -2,6 +2,7 @@
#define DIALOG_IDS_H
enum DialogId {
DIALOG_NONE = -1,
DIALOG_000,
DIALOG_001,
DIALOG_002,
+1 -1
View File
@@ -1,4 +1,4 @@
# Assembly Macros
// Assembly Macros
.set K0BASE, 0x80000000
.set K1BASE, 0xA0000000
+3 -3
View File
@@ -410,12 +410,12 @@
// second set of actor bins, (0x64-0x73)
// group 12
#define MODEL_BOWSER 0x64 // bowser_geo - 2nd geo loaded is bowser_geo_000424, starts with shadow command
#define MODEL_BOWSER 0x64 // bowser_geo
#define MODEL_BOWSER_BOMB_CHILD_OBJ 0x65 // bowser_bomb_geo - Spawns as a chill object in bowser's behavior command, causing an explosion if it touches a bomb
#define MODEL_BOWSER_SMOKE 0x66 // bowser_impact_smoke_geo
#define MODEL_BOWSER_FLAMES 0x67 // bowser_flames_geo
#define MODEL_BOWSER_WAVE 0x68 // invisible_bowser_accessory_geo
#define MODEL_BOWSER2 0x69 // bowser2_geo - 2nd geo loaded is bowser_geo_000770, starts with node command, only difference
#define MODEL_BOWSER_NO_SHADOW 0x69 // bowser_geo_no_shadow
// group 13
#define MODEL_BUB 0x64 // cheep_cheep_geo
@@ -531,7 +531,7 @@
#define MODEL_KOOPA_WITHOUT_SHELL 0xBF // koopa_without_shell_geo
#define MODEL_GOOMBA 0xC0 // goomba_geo
#define MODEL_SEAWEED 0xC1 // seaweed_geo
#define MODEL_AMP 0xC2 // amp_geo
#define MODEL_AMP 0xC2 // dAmpGeo
#define MODEL_BOBOMB_BUDDY 0xC3 // bobomb_buddy_geo
// find me
// find me
+117 -16
View File
@@ -53,23 +53,18 @@
#define HELD_DROPPED 3
/* oDialogState */
#define DIALOG_UNK1_ENABLE_TIME_STOP 0
#define DIALOG_UNK1_INTERRUPT_MARIO_ACTION 1
#define DIALOG_UNK1_BEGIN_DIALOG 2
#define DIALOG_UNK1_AWAIT_DIALOG 3
#define DIALOG_UNK1_DISABLE_TIME_STOP 4
#define DIALOG_STATUS_ENABLE_TIME_STOP 0
#define DIALOG_STATUS_INTERRUPT 1
#define DIALOG_STATUS_START_DIALOG 2
#define DIALOG_STATUS_STOP_DIALOG 3
#define DIALOG_STATUS_DISABLE_TIME_STOP 4
#define DIALOG_UNK1_FLAG_DEFAULT (1 << 1) // 0x02
#define DIALOG_UNK1_FLAG_RESPONSE (1 << 2) // 0x04
#define DIALOG_UNK1_FLAG_4 (1 << 4) // 0x10
#define DIALOG_UNK2_ENABLE_TIME_STOP 0
#define DIALOG_UNK2_TURN_AND_INTERRUPT_MARIO_ACTION 1
#define DIALOG_UNK2_AWAIT_DIALOG 2
#define DIALOG_UNK2_END_DIALOG 3
#define DIALOG_UNK2_FLAG_0 (1 << 0) // 0x01
#define DIALOG_UNK2_LEAVE_TIME_STOP_ENABLED (1 << 4) // 0x10
#define DIALOG_FLAG_NONE 0
#define DIALOG_FLAG_TURN_TO_MARIO (1 << 0) // 0x01 // cutscene only
#define DIALOG_FLAG_TEXT_DEFAULT (1 << 1) // 0x02
#define DIALOG_FLAG_TEXT_RESPONSE (1 << 2) // 0x04 // non-cutscene only
#define DIALOG_FLAG_UNK_CAPSWITCH (1 << 3) // 0x08 // not defined
#define DIALOG_FLAG_TIME_STOP_ENABLED (1 << 4) // 0x10
/* oMoveFlags */
#define OBJ_MOVE_LANDED (1 << 0) // 0x0001
@@ -191,6 +186,112 @@
#define BOBOMB_BUDDY_HAS_NOT_TALKED 0
#define BOBOMB_BUDDY_HAS_TALKED 2
/* Bowser */
/* Tail oAction */
#define BOWSER_ACT_TAIL_DEFAULT 0
#define BOWSER_ACT_TAIL_THROWN 1
#define BOWSER_ACT_TAIL_TOUCHED_MARIO 2
/* oAction */
#define BOWSER_ACT_DEFAULT 0
#define BOWSER_ACT_THROWN 1
#define BOWSER_ACT_JUMP_ONTO_STAGE 2
#define BOWSER_ACT_DANCE 3
#define BOWSER_ACT_DEAD 4
#define BOWSER_ACT_WAIT 5
#define BOWSER_ACT_INTRO_WALK 6
#define BOWSER_ACT_CHARGE_MARIO 7
#define BOWSER_ACT_SPIT_FIRE_INTO_SKY 8
#define BOWSER_ACT_SPIT_FIRE_ONTO_FLOOR 9
#define BOWSER_ACT_HIT_EDGE 10
#define BOWSER_ACT_TURN_FROM_EDGE 11
#define BOWSER_ACT_HIT_MINE 12
#define BOWSER_ACT_BIG_JUMP 13
#define BOWSER_ACT_WALK_TO_MARIO 14
#define BOWSER_ACT_BREATH_FIRE 15
#define BOWSER_ACT_TELEPORT 16
#define BOWSER_ACT_QUICK_JUMP 17
#define BOWSER_ACT_UNUSED_SLOW_WALK 18
#define BOWSER_ACT_TILT_LAVA_PLATFORM 19
/* Animations */
#define BOWSER_ANIM_STAND_UP 0
#define BOWSER_ANIM_STAND_UP_UNUSED 1 // slightly different
#define BOWSER_ANIM_SHAKING 2
#define BOWSER_ANIM_GRABBED 3
#define BOWSER_ANIM_BROKEN 4 // broken animation
#define BOWSER_ANIM_FALL_DOWN 5 // unused
#define BOWSER_ANIM_BREATH 6
#define BOWSER_ANIM_JUMP 7 // unused, short jump, replaced by start/stop
#define BOWSER_ANIM_JUMP_STOP 8
#define BOWSER_ANIM_JUMP_START 9
#define BOWSER_ANIM_DANCE 10
#define BOWSER_ANIM_BREATH_UP 11
#define BOWSER_ANIM_IDLE 12
#define BOWSER_ANIM_SLOW_GAIT 13
#define BOWSER_ANIM_LOOK_DOWN_STOP_WALK 14
#define BOWSER_ANIM_LOOK_UP_START_WALK 15
#define BOWSER_ANIM_FLIP_DOWN 16
#define BOWSER_ANIM_LAY_DOWN 17
#define BOWSER_ANIM_RUN_START 18
#define BOWSER_ANIM_RUN 19
#define BOWSER_ANIM_RUN_STOP 20
#define BOWSER_ANIM_RUN_SLIP 21
#define BOWSER_ANIM_BREATH_QUICK 22
#define BOWSER_ANIM_EDGE_MOVE 23
#define BOWSER_ANIM_EDGE_STOP 24
#define BOWSER_ANIM_FLIP 25
#define BOWSER_ANIM_STAND_UP_FROM_FLIP 26
/* oBehParams2ndByte */
#define BOWSER_BP_BITDW 0
#define BOWSER_BP_BITFS 1
#define BOWSER_BP_BITS 2
/* oBowserCamAct */
#define BOWSER_CAM_ACT_IDLE 0
#define BOWSER_CAM_ACT_WALK 1
#define BOWSER_CAM_ACT_END 2
/* oBowserStatus */
#define BOWSER_STATUS_ANGLE_MARIO (1 << 1) // 0x00000002
#define BOWSER_STATUS_ANGLE_CENTRE (1 << 2) // 0x00000004
#define BOWSER_STATUS_DIST_MARIO (1 << 3) // 0x00000008
#define BOWSER_STATUS_DIST_CENTRE (1 << 4) // 0x00000010
#define BOWSER_STATUS_BIG_JUMP (1 << 16) // 0x00010000
#define BOWSER_STATUS_FIRE_SKY (1 << 17) // 0x00020000
/* oBowserGrabbedStatus */
#define BOWSER_GRAB_STATUS_NONE 0
#define BOWSER_GRAB_STATUS_GRABBED 1
#define BOWSER_GRAB_STATUS_HOLDING 2
/* oSubAction */
#define BOWSER_SUB_ACT_DEAD_FLY_BACK 0
#define BOWSER_SUB_ACT_DEAD_BOUNCE 1
#define BOWSER_SUB_ACT_DEAD_WAIT 2
#define BOWSER_SUB_ACT_DEAD_DEFAULT_END 3
#define BOWSER_SUB_ACT_DEAD_DEFAULT_END_OVER 4
#define BOWSER_SUB_ACT_DEAD_FINAL_END 10
#define BOWSER_SUB_ACT_DEAD_FINAL_END_OVER 11
#define BOWSER_SUB_ACT_CHARGE_START 0
#define BOWSER_SUB_ACT_CHARGE_RUN 1
#define BOWSER_SUB_ACT_CHARGE_END 2
#define BOWSER_SUB_ACT_CHARGE_SLIP 3
#define BOWSER_SUB_ACT_TELEPORT_START 0
#define BOWSER_SUB_ACT_TELEPORT_MOVE 1
#define BOWSER_SUB_ACT_TELEPORT_STOP 2
#define BOWSER_SUB_ACT_HIT_MINE_START 0
#define BOWSER_SUB_ACT_HIT_MINE_FALL 1
#define BOWSER_SUB_ACT_HIT_MINE_STOP 2
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_IDLE 0
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_START 1
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_LAND 2
#define BOWSER_SUB_ACT_JUMP_ON_STAGE_STOP 3
/* Bowser Bits Platform*/
/* oAction */
#define BOWSER_BITS_PLAT_ACT_START 0
#define BOWSER_BITS_PLAT_ACT_CHECK 1
#define BOWSER_BITS_PLAT_ACT_FALL 2
/* Fish Spawer */
/* oAction */
#define FISH_SPAWNER_ACT_SPAWN 0
+24 -20
View File
@@ -65,8 +65,8 @@
#define /*0x0B4*/ oVelZ OBJECT_FIELD_F32(0x0B)
#define /*0x0B8*/ oForwardVel OBJECT_FIELD_F32(0x0C)
#define /*0x0B8*/ oForwardVelS32 OBJECT_FIELD_S32(0x0C)
#define /*0x0BC*/ oUnkBC OBJECT_FIELD_F32(0x0D)
#define /*0x0C0*/ oUnkC0 OBJECT_FIELD_F32(0x0E)
#define /*0x0BC*/ oLeftVel OBJECT_FIELD_F32(0x0D)
#define /*0x0C0*/ oUpVel OBJECT_FIELD_F32(0x0E)
#define /*0x0C4*/ O_MOVE_ANGLE_INDEX 0x0F
#define /*0x0C4*/ O_MOVE_ANGLE_PITCH_INDEX (O_MOVE_ANGLE_INDEX + 0)
#define /*0x0C4*/ O_MOVE_ANGLE_YAW_INDEX (O_MOVE_ANGLE_INDEX + 1)
@@ -274,24 +274,24 @@
#define /*0x0FC*/ oBBallSpawnerPeriodMinus1 OBJECT_FIELD_S32(0x1D)
/* Bowser */
#define /*0x088*/ oBowserUnk88 OBJECT_FIELD_S32(0x00)
#define /*0x0F4*/ oBowserUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oBowserUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x088*/ oBowserCamAct OBJECT_FIELD_S32(0x00)
#define /*0x0F4*/ oBowserStatus OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oBowserTimer OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oBowserDistToCentre OBJECT_FIELD_F32(0x1D)
#define /*0x106*/ oBowserUnk106 OBJECT_FIELD_S16(0x1F, 1)
#define /*0x108*/ oBowserUnk108 OBJECT_FIELD_S16(0x20, 0)
#define /*0x106*/ oBowserBitsJustJump OBJECT_FIELD_S16(0x1F, 1)
#define /*0x108*/ oBowserRandSplitFloor OBJECT_FIELD_S16(0x20, 0)
#define /*0x10A*/ oBowserHeldAnglePitch OBJECT_FIELD_S16(0x20, 1)
#define /*0x10D*/ oBowserHeldAngleVelYaw OBJECT_FIELD_S16(0x21, 0)
#define /*0x10E*/ oBowserUnk10E OBJECT_FIELD_S16(0x21, 1)
#define /*0x110*/ oBowserUnk110 OBJECT_FIELD_S16(0x22, 0)
#define /*0x10E*/ oBowserGrabbedStatus OBJECT_FIELD_S16(0x21, 1)
#define /*0x110*/ oBowserIsReacting OBJECT_FIELD_S16(0x22, 0)
#define /*0x112*/ oBowserAngleToCentre OBJECT_FIELD_S16(0x22, 1)
#define /*0x1AC*/ oBowserUnk1AC OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AE*/ oBowserUnk1AE OBJECT_FIELD_S16(0x49, 1)
#define /*0x1AC*/ oBowserTargetOpacity OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AE*/ oBowserEyesTimer OBJECT_FIELD_S16(0x49, 1)
#define /*0x1B0*/ oBowserEyesShut OBJECT_FIELD_S16(0x4A, 0)
#define /*0x1B2*/ oBowserUnk1B2 OBJECT_FIELD_S16(0x4A, 1)
#define /*0x1B2*/ oBowserRainbowLight OBJECT_FIELD_S16(0x4A, 1)
/* Bowser Shockwave */
#define /*0x0F4*/ oBowserShockWaveUnkF4 OBJECT_FIELD_F32(0x1B)
#define /*0x0F4*/ oBowserShockWaveScale OBJECT_FIELD_F32(0x1B)
/* Black Smoke Bowser */
#define /*0x0F4*/ oBlackSmokeBowserUnkF4 OBJECT_FIELD_F32(0x1B)
@@ -497,7 +497,7 @@
/* Flame */
#define /*0x0F4*/ oFlameScale OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oFlameSpeedTimerOffset OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oFlameUnkFC OBJECT_FIELD_F32(0x1D)
#define /*0x0FC*/ oFlameUnusedRand OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oFlameBowser OBJECT_FIELD_OBJ(0x1E)
/* Blue Flame */
@@ -626,7 +626,7 @@
#define /*0x0F4*/ oKoopaRaceEndpointRaceBegun OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oKoopaRaceEndpointKoopaFinished OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oKoopaRaceEndpointRaceStatus OBJECT_FIELD_S32(0x1D)
#define /*0x100*/ oKoopaRaceEndpointUnk100 OBJECT_FIELD_S32(0x1E)
#define /*0x100*/ oKoopaRaceEndpointDialog OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ oKoopaRaceEndpointRaceEnded OBJECT_FIELD_S32(0x1F)
/* Koopa Shell Flame */
@@ -770,10 +770,14 @@
#define /*0x0F8*/ oPitouneUnkF8 OBJECT_FIELD_F32(0x1C)
#define /*0x0FC*/ oPitouneUnkFC OBJECT_FIELD_F32(0x1D)
/* Platform */
#define /*0x0F4*/ oPlatformTimer OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oPlatformUnkF8 OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oPlatformUnkFC OBJECT_FIELD_S32(0x1D)
/* Falling Rising Bitfs Platform */
#define /*0x0F4*/ oBitfsPlatformTimer OBJECT_FIELD_S32(0x1B)
/* Falling Bowser Bits Platform */
#define /*0x0F8*/ oBitsPlatformBowser OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oBitsPlatformTimer OBJECT_FIELD_S32(0x1D)
/* WF Platform */
#define /*0x10C*/ oPlatformUnk10C OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oPlatformUnk110 OBJECT_FIELD_F32(0x22)
@@ -877,7 +881,7 @@
// 0x1D-0x21 reserved for pathing
/* Snowman's Head */
#define /*0x0F4*/ oSnowmansHeadUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oSnowmansHeadDialogActive OBJECT_FIELD_S32(0x1B)
/* Snowman Wind Blowing */
#define /*0x0F4*/ oSLSnowmanWindOriginalYaw OBJECT_FIELD_S32(0x1B)
+5 -3
View File
@@ -1,6 +1,8 @@
#ifndef SEGMENTS_H
#define SEGMENTS_H
#include "config.h"
/*
* Memory addresses for segments. Ideally, this header file would not be
* needed, and the addresses would be defined in sm64.ld and linker-inserted
@@ -20,10 +22,10 @@
#define SEG_BUFFERS 0x801C1000
#ifdef VERSION_EU
#define SEG_MAIN 0x80241800 // TODO: Investigate why it's different?
#elif defined(VERSION_SH)
#if defined(VERSION_SH) || ENABLE_RUMBLE
#define SEG_MAIN 0x80249000
#elif defined(VERSION_EU)
#define SEG_MAIN 0x80241800 // TODO: Investigate why it's different?
#else
#define SEG_MAIN 0x80246000
#endif
+2
View File
@@ -6,6 +6,8 @@
#define SEQ_BASE_ID 0x7f
#define SEQ_VARIATION 0x80
#define SEQ_MENU_GAME_OVER (SEQ_MENU_TITLE_SCREEN | SEQ_VARIATION)
enum SeqId {
SEQ_SOUND_PLAYER, // 0x00
SEQ_EVENT_CUTSCENE_COLLECT_STAR, // 0x01
+19 -19
View File
@@ -1,7 +1,7 @@
# Macros for disassembled sequence files. This file was automatically generated by seq_decoder.py.
# To regenerate it, run: ./tools/seq_decoder.py --emit-asm-macros >seq_macros.inc
// Macros for disassembled sequence files. This file was automatically generated by seq_decoder.py.
// To regenerate it, run: ./tools/seq_decoder.py --emit-asm-macros > include/seq_macros.inc
# seq commands
// seq commands
.macro seq_testchdisabled a
.byte 0x0 + \a
@@ -155,7 +155,7 @@
.byte 0xff
.endm
.ifdef VERSION_SH
#ifdef VERSION_SH
.macro seq_unreservenotes
.byte 0xf0
@@ -166,9 +166,9 @@
.byte \a
.endm
.else
#else
.ifdef VERSION_EU
#ifdef VERSION_EU
.macro seq_unreservenotes
.byte 0xf0
@@ -179,7 +179,7 @@
.byte \a
.endm
.else
#else
.macro seq_unreservenotes
.byte 0xf1
@@ -190,11 +190,11 @@
.byte \a
.endm
.endif
#endif
.endif
#endif
# chan commands
// chan commands
.macro chan_startchannel a, b
.byte 0x10 + \a
@@ -462,7 +462,7 @@
var_long \a
.endm
.ifdef VERSION_SH
#ifdef VERSION_SH
.macro chan_setnotepriority a
.byte 0xe9
@@ -495,7 +495,7 @@
.byte 0x90 + \a
.endm
.else
#else
.macro chan_testlayerfinished a
.byte 0x0 + \a
@@ -514,7 +514,7 @@
.byte 0xa0 + \a
.endm
.ifdef VERSION_EU
#ifdef VERSION_EU
.macro chan_setnotepriority a
.byte 0xe9
@@ -530,7 +530,7 @@
.byte \a
.endm
.else
#else
.macro chan_setnotepriority a
.byte 0x60 + \a
@@ -545,11 +545,11 @@
.byte \a
.endm
.endif
#endif
.endif
#endif
# layer commands
// layer commands
.macro layer_note0 a, b, c, d
.byte 0x0 + \a
@@ -659,7 +659,7 @@
.byte \c
.endm
# envelope commands
// envelope commands
.macro envelope_disable a
.byte 0x0, 0x0
@@ -686,7 +686,7 @@
.byte \b >> 8, \b & 0xff
.endm
# other commands
// other commands
.macro var_long x
.byte (0x80 | (\x & 0x7f00) >> 8), (\x & 0xff)
+1 -1
View File
@@ -59,7 +59,7 @@
#define INPUT_A_DOWN 0x0080
#define INPUT_IN_POISON_GAS 0x0100
#define INPUT_IN_WATER 0x0200
#define INPUT_UNKNOWN_10 0x0400
#define INPUT_STOMPED 0x0400
#define INPUT_INTERACT_OBJ_GRABBABLE 0x0800
#define INPUT_UNKNOWN_12 0x1000
#define INPUT_B_PRESSED 0x2000
+1 -1
View File
@@ -386,7 +386,7 @@
#define SOUND_ENV_UNK12 /* 0x40120000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x12, 0x00, 0) // unverified, unused
#define SOUND_ENV_SLIDING /* 0x40130000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x13, 0x00, 0) // unverified
#define SOUND_ENV_STAR /* 0x40140010 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x14, 0x00, SOUND_LOWER_BACKGROUND_MUSIC) // unverified
#define SOUND_ENV_UNKNOWN4 /* 0x41150000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x15, 0x00, SOUND_NO_VOLUME_LOSS) // unverified
#define SOUND_ENV_MOVING_BIG_PLATFORM /* 0x41150000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x15, 0x00, SOUND_NO_VOLUME_LOSS) // unverified
#define SOUND_ENV_WATER_DRAIN /* 0x41160000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x16, 0x00, SOUND_NO_VOLUME_LOSS) // unverified
#define SOUND_ENV_METAL_BOX_PUSH /* 0x40178000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x17, 0x80, 0) // unverified
#define SOUND_ENV_SINK_QUICKSAND /* 0x40188000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x18, 0x80, 0) // unverified
+4 -24
View File
@@ -6,6 +6,7 @@
#include <ultra64.h>
#include "macros.h"
#include "config.h"
// Certain functions are marked as having return values, but do not
@@ -30,8 +31,8 @@ struct Controller
/*0x12*/ u16 buttonPressed;
/*0x14*/ OSContStatus *statusData;
/*0x18*/ OSContPad *controllerData;
#ifdef VERSION_SH
/*0x1C*/ int port;
#if ENABLE_RUMBLE
/*0x1C*/ s32 port;
#endif
};
@@ -261,27 +262,6 @@ struct MarioBodyState
u8 padding[4];
};
struct OffsetSizePair
{
u32 offset;
u32 size;
};
struct MarioAnimDmaRelatedThing
{
u32 count;
u8 *srcAddr;
struct OffsetSizePair anim[1]; // dynamic size
};
struct MarioAnimation
{
struct MarioAnimDmaRelatedThing *animDmaTable;
u8 *currentAnimAddr;
struct Animation *targetAnim;
u8 padding[4];
};
struct MarioState
{
/*0x00*/ u16 unk00;
@@ -327,7 +307,7 @@ struct MarioState
/*0x94*/ struct PlayerCameraState *statusForCamera;
/*0x98*/ struct MarioBodyState *marioBodyState;
/*0x9C*/ struct Controller *controller;
/*0xA0*/ struct MarioAnimation *animation;
/*0xA0*/ struct DmaHandlerList *animList;
/*0xA4*/ u32 collidedObjInteractTypes;
/*0xA8*/ s16 numCoins;
/*0xAA*/ s16 numStars;