You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Refresh 3
This commit is contained in:
205
include/PR/abi.h
205
include/PR/abi.h
@@ -269,6 +269,56 @@ typedef short ENVMIX_STATE[40];
|
||||
* Macros to assemble the audio command list
|
||||
*/
|
||||
|
||||
/*
|
||||
* Info about parameters:
|
||||
*
|
||||
* A "count" in the following macros is always measured in bytes.
|
||||
*
|
||||
* All volumes/gains are in Q1.15 signed fixed point numbers:
|
||||
* 0x8000 is the minimum volume (-100%), negating the audio curve.
|
||||
* 0x0000 is silent.
|
||||
* 0x7fff is maximum volume (99.997%).
|
||||
*
|
||||
* All DRAM addresses refer to segmented addresses. A segment table shall
|
||||
* first be set up by calling aSegment for each segment. When a DRAM
|
||||
* 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.
|
||||
*
|
||||
* 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
|
||||
* rounded down to the nearest multiple of 8 bytes.
|
||||
* All DRAM lengths should be aligned by 8 bytes, or they will be
|
||||
* rounded up to the nearest multiple of 8 bytes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Decompresses ADPCM data.
|
||||
* Possible flags: A_INIT and A_LOOP.
|
||||
*
|
||||
* First set up internal data in DMEM:
|
||||
* aLoadADPCM(cmd++, nEntries * 16, physicalAddressOfBook)
|
||||
* 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.
|
||||
*
|
||||
* ADPCM decompression works on a block of 16 (uncompressed) samples.
|
||||
* The previous 2 samples and 9 bytes of input are decompressed to
|
||||
* 16 new samples using the code book previously loaded.
|
||||
*
|
||||
* 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 aADPCMdec(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -277,6 +327,9 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Not used in SM64.
|
||||
*/
|
||||
#define aPoleFilter(pkt, f, g, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -286,6 +339,11 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Clears DMEM data, where d is address and c is count, by writing zeros.
|
||||
*
|
||||
* Note: c is rounded up to the nearest multiple of 16 bytes.
|
||||
*/
|
||||
#define aClearBuffer(pkt, d, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -294,6 +352,31 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(c); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Mixes an envelope with mono sound into 2 or 4 channels.
|
||||
* Possible flags: A_INIT, A_AUX (indicates that 4 channels should be used).
|
||||
*
|
||||
* Before this command, call:
|
||||
* aSetBuffer(cmd++, 0, inBuf, dryLeft, count)
|
||||
* aSetBuffer(cmd++, A_AUX, dryRight, wetLeft, wetRight)
|
||||
*
|
||||
* The first time (A_INIT is set), volume also needs to be set:
|
||||
* aSetVolume(cmd++, A_VOL | A_LEFT, initialVolumeLeft, 0, 0)
|
||||
* aSetVolume(cmd++, A_VOL | A_RIGHT, initialVolumeRight, 0, 0)
|
||||
* aSetVolume32(cmd++, A_RATE | A_LEFT, targetVolumeLeft, rampLeft)
|
||||
* aSetVolume32(cmd++, A_RATE | A_RIGHT, targetVolumeRight, rampRight)
|
||||
* aSetVolume(cmd++, A_AUX, dryVolume, 0, wetVolume)
|
||||
*
|
||||
* This command will now mix samples in inBuf into the destination buffers (dry and wet),
|
||||
* but with the volume increased (or decreased) from initial volumes to target volumes,
|
||||
* with the specified ramp rate. Once the target volume is reached, the volume stays
|
||||
* at that level. Before the samples are finally mixed (added) into the destination
|
||||
* buffers (dry and wet), the volume is changed according to dryVolume and wetVolume.
|
||||
*
|
||||
* Note: count will be rounded up to the nearest multiple of 16 bytes.
|
||||
* Note: the wet channels are used for reverb.
|
||||
*
|
||||
*/
|
||||
#define aEnvMixer(pkt, f, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -302,6 +385,17 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Interleaves two mono channels into stereo.
|
||||
*
|
||||
* First call:
|
||||
* aSetBuffer(cmd++, 0, 0, output, count)
|
||||
*
|
||||
* The count refers to the size of the output.
|
||||
* A left sample will be placed before the right sample.
|
||||
*
|
||||
* Note: count will be rounded up to the nearest multiple of 16 bytes.
|
||||
*/
|
||||
#define aInterleave(pkt, l, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -310,6 +404,15 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Loads a buffer from DRAM to DMEM.
|
||||
*
|
||||
* First call:
|
||||
* aSetBuffer(cmd++, 0, in, 0, count)
|
||||
*
|
||||
* The in parameter to aSetBuffer is the destination in DMEM and the
|
||||
* s parameter to this command is the source in DRAM.
|
||||
*/
|
||||
#define aLoadBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -318,6 +421,20 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Mixes audio.
|
||||
* Possible flags: no flags used, although parameter present.
|
||||
*
|
||||
* First call:
|
||||
* aSetBuffer(cmd++, 0, 0, 0, count)
|
||||
*
|
||||
* Input and output addresses are taken from the i and o parameters.
|
||||
* The volume with which the input is changed is taken from the g parameter.
|
||||
* After the volume of the input samples have been changed, the result
|
||||
* is added to the output.
|
||||
*
|
||||
* Note: count will be rounded up to the nearest multiple of 32 bytes.
|
||||
*/
|
||||
#define aMix(pkt, f, g, i, o) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -327,6 +444,7 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
|
||||
}
|
||||
|
||||
// Not present in the audio microcode.
|
||||
#define aPan(pkt, f, d, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -336,6 +454,39 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Resamples audio.
|
||||
* Possible flags: A_INIT, A_OUT? (not used in SM64).
|
||||
*
|
||||
* First call:
|
||||
* aSetBuffer(cmd++, 0, in, out, count)
|
||||
*
|
||||
* This command resamples the audio using the given frequency ratio (pitch)
|
||||
* using a filter that uses a window of 4 source samples. This can be used
|
||||
* either for just resampling audio to be able to be played back at a different
|
||||
* sample rate, or to change the pitch if the result is played back at
|
||||
* the same sample rate as the input.
|
||||
*
|
||||
* The frequency ratio is given in UQ1.15 fixed point format.
|
||||
* For no change in frequency, use pitch 0x8000.
|
||||
* For 1 octave up or downsampling to (roughly) half number of samples, use pitch 0xffff.
|
||||
* For 1 octave down or upsampling to double as many samples, use pitch 0x4000.
|
||||
*
|
||||
* Note: count represents the number of output samples and is rounded up to
|
||||
* the nearest multiple of 16 bytes.
|
||||
*
|
||||
* The state consists of the four following source samples when the algorithm stopped as
|
||||
* well as a fractional position, and is initialized to all zeros if A_INIT is given.
|
||||
* Otherwise it is loaded from DRAM at address s.
|
||||
*
|
||||
* The algorithm starts by writing the four source samples from the state (or zero)
|
||||
* to just before the input address given. It then creates one output sample by examining
|
||||
* the four next source samples and then moving the source position zero or more
|
||||
* samples forward. The first output sample (when A_INIT is given) is always 0.
|
||||
*
|
||||
* When "count" samples have been written, the following four source samples
|
||||
* are written to the state in DRAM as well as a fractional position.
|
||||
*/
|
||||
#define aResample(pkt, f, p, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -345,6 +496,15 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Stores a buffer in DMEM to DRAM.
|
||||
*
|
||||
* First call:
|
||||
* aSetBuffer(cmd++, 0, 0, out, count)
|
||||
*
|
||||
* The out parameter to aSetBuffer is the source in DMEM and the
|
||||
* s parameter to this command is the destination in DRAM.
|
||||
*/
|
||||
#define aSaveBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -353,6 +513,12 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = (uintptr_t)(s); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets up an entry in the segment table.
|
||||
*
|
||||
* The s parameter is a segment index, 0 to 15.
|
||||
* The b parameter is the base offset.
|
||||
*/
|
||||
#define aSegment(pkt, s, b) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -361,6 +527,10 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets internal DMEM buffer addresses used for later commands.
|
||||
* See each command for how to use aSetBuffer.
|
||||
*/
|
||||
#define aSetBuffer(pkt, f, i, o, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -370,6 +540,10 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets internal volume parameters.
|
||||
* See aEnvMixer for more info.
|
||||
*/
|
||||
#define aSetVolume(pkt, f, v, t, r) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -379,13 +553,29 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the address to ADPCM loop state.
|
||||
*
|
||||
* The a parameter is a DRAM address.
|
||||
* See aADPCMdec for more info.
|
||||
*/
|
||||
#define aSetLoop(pkt, a) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
_a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
|
||||
_a->words.w1 = (uintptr_t)(a); \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copies memory in DMEM.
|
||||
*
|
||||
* Copies c bytes from address i to address o.
|
||||
*
|
||||
* Note: count is rounded up to the nearest multiple of 16 bytes.
|
||||
*
|
||||
* Note: This acts as memcpy where 16 bytes are moved at a time, therefore
|
||||
* if input and output overlap, output address should be less than input address.
|
||||
*/
|
||||
#define aDMEMMove(pkt, i, o, c) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -394,6 +584,14 @@ typedef short ENVMIX_STATE[40];
|
||||
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Loads ADPCM book from DRAM into DMEM.
|
||||
*
|
||||
* This command loads ADPCM table entries from DRAM to DMEM.
|
||||
*
|
||||
* The count parameter c should be a multiple of 16 bytes.
|
||||
* The d parameter is a DRAM address.
|
||||
*/
|
||||
#define aLoadADPCM(pkt, c, d) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
@@ -406,7 +604,10 @@ typedef short ENVMIX_STATE[40];
|
||||
// instead of two 16-bit ones. According to AziAudio, it is used to set
|
||||
// ramping values when neither bit 4 nor bit 8 is set in the flags parameter.
|
||||
// It does not appear in the official abi.h header.
|
||||
|
||||
/*
|
||||
* Sets internal volume parameters.
|
||||
* See aEnvMixer for more info.
|
||||
*/
|
||||
#define aSetVolume32(pkt, f, v, tr) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
|
||||
342
include/PR/gbi.h
342
include/PR/gbi.h
@@ -441,118 +441,147 @@
|
||||
* G_SETCOMBINE: color combine modes
|
||||
*/
|
||||
/* Color combiner constants: */
|
||||
#define G_CCMUX_COMBINED 0
|
||||
#define G_CCMUX_TEXEL0 1
|
||||
#define G_CCMUX_TEXEL1 2
|
||||
#define G_CCMUX_PRIMITIVE 3
|
||||
#define G_CCMUX_SHADE 4
|
||||
#define G_CCMUX_ENVIRONMENT 5
|
||||
#define G_CCMUX_CENTER 6
|
||||
#define G_CCMUX_SCALE 6
|
||||
#define G_CCMUX_COMBINED_ALPHA 7
|
||||
#define G_CCMUX_TEXEL0_ALPHA 8
|
||||
#define G_CCMUX_TEXEL1_ALPHA 9
|
||||
#define G_CCMUX_PRIMITIVE_ALPHA 10
|
||||
#define G_CCMUX_SHADE_ALPHA 11
|
||||
#define G_CCMUX_ENV_ALPHA 12
|
||||
#define G_CCMUX_LOD_FRACTION 13
|
||||
#define G_CCMUX_PRIM_LOD_FRAC 14
|
||||
#define G_CCMUX_NOISE 7
|
||||
#define G_CCMUX_K4 7
|
||||
#define G_CCMUX_K5 15
|
||||
#define G_CCMUX_1 6
|
||||
#define G_CCMUX_0 31
|
||||
#define G_CCMUX_COMBINED 0
|
||||
#define G_CCMUX_TEXEL0 1
|
||||
#define G_CCMUX_TEXEL1 2
|
||||
#define G_CCMUX_PRIMITIVE 3
|
||||
#define G_CCMUX_SHADE 4
|
||||
#define G_CCMUX_ENVIRONMENT 5
|
||||
#define G_CCMUX_CENTER 6
|
||||
#define G_CCMUX_SCALE 6
|
||||
#define G_CCMUX_COMBINED_ALPHA 7
|
||||
#define G_CCMUX_TEXEL0_ALPHA 8
|
||||
#define G_CCMUX_TEXEL1_ALPHA 9
|
||||
#define G_CCMUX_PRIMITIVE_ALPHA 10
|
||||
#define G_CCMUX_SHADE_ALPHA 11
|
||||
#define G_CCMUX_ENV_ALPHA 12
|
||||
#define G_CCMUX_LOD_FRACTION 13
|
||||
#define G_CCMUX_PRIM_LOD_FRAC 14
|
||||
#define G_CCMUX_NOISE 7
|
||||
#define G_CCMUX_K4 7
|
||||
#define G_CCMUX_K5 15
|
||||
#define G_CCMUX_1 6
|
||||
#define G_CCMUX_0 31
|
||||
|
||||
/* Alpha combiner constants: */
|
||||
#define G_ACMUX_COMBINED 0
|
||||
#define G_ACMUX_TEXEL0 1
|
||||
#define G_ACMUX_TEXEL1 2
|
||||
#define G_ACMUX_PRIMITIVE 3
|
||||
#define G_ACMUX_SHADE 4
|
||||
#define G_ACMUX_ENVIRONMENT 5
|
||||
#define G_ACMUX_COMBINED 0
|
||||
#define G_ACMUX_TEXEL0 1
|
||||
#define G_ACMUX_TEXEL1 2
|
||||
#define G_ACMUX_PRIMITIVE 3
|
||||
#define G_ACMUX_SHADE 4
|
||||
#define G_ACMUX_ENVIRONMENT 5
|
||||
#define G_ACMUX_LOD_FRACTION 0
|
||||
#define G_ACMUX_PRIM_LOD_FRAC 6
|
||||
#define G_ACMUX_1 6
|
||||
#define G_ACMUX_0 7
|
||||
#define G_ACMUX_1 6
|
||||
#define G_ACMUX_0 7
|
||||
|
||||
/* typical CC cycle 1 modes */
|
||||
#define G_CC_PRIMITIVE 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE
|
||||
#define G_CC_SHADE 0, 0, 0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_MODULATEI TEXEL0, 0, SHADE, 0, 0, 0, 0, SHADE
|
||||
#define G_CC_MODULATEIA TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0
|
||||
#define G_CC_MODULATEIDECALA TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0
|
||||
#define G_CC_MODULATERGB G_CC_MODULATEI
|
||||
#define G_CC_MODULATERGBA G_CC_MODULATEIA
|
||||
#define G_CC_MODULATERGBDECALA G_CC_MODULATEIDECALA
|
||||
#define G_CC_MODULATEI_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE
|
||||
#define G_CC_MODULATEIA_PRIM TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0
|
||||
#define G_CC_MODULATEIDECALA_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0
|
||||
#define G_CC_MODULATERGB_PRIM G_CC_MODULATEI_PRIM
|
||||
#define G_CC_MODULATERGBA_PRIM G_CC_MODULATEIA_PRIM
|
||||
#define G_CC_MODULATERGBDECALA_PRIM G_CC_MODULATEIDECALA_PRIM
|
||||
#define G_CC_DECALRGB 0, 0, 0, TEXEL0, 0, 0, 0, SHADE
|
||||
#define G_CC_DECALRGBA 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0
|
||||
#define G_CC_BLENDI ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_BLENDIA ENVIRONMENT, SHADE, TEXEL0, SHADE, TEXEL0, 0, SHADE, 0
|
||||
#define G_CC_BLENDIDECALA ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_BLENDRGBA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_BLENDRGBDECALA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_ADDRGB 1, 0, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_ADDRGBDECALA 1, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_REFLECTRGB ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_REFLECTRGBDECALA ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_HILITERGB PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_HILITERGBA PRIMITIVE, SHADE, TEXEL0, SHADE, PRIMITIVE, SHADE, TEXEL0, SHADE
|
||||
#define G_CC_HILITERGBDECALA PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_SHADEDECALA 0, 0, 0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_BLENDPE PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, SHADE, 0
|
||||
#define G_CC_BLENDPEDECALA PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, TEXEL0
|
||||
#define G_CC_PRIMITIVE 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE
|
||||
#define G_CC_SHADE 0, 0, 0, SHADE, 0, 0, 0, SHADE
|
||||
|
||||
#define G_CC_MODULATEI TEXEL0, 0, SHADE, 0, 0, 0, 0, SHADE
|
||||
#define G_CC_MODULATEIDECALA TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0
|
||||
#define G_CC_MODULATEIFADE TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT
|
||||
|
||||
#define G_CC_MODULATERGB G_CC_MODULATEI
|
||||
#define G_CC_MODULATERGBDECALA G_CC_MODULATEIDECALA
|
||||
#define G_CC_MODULATERGBFADE G_CC_MODULATEIFADE
|
||||
|
||||
#define G_CC_MODULATEIA TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0
|
||||
#define G_CC_MODULATEIFADEA TEXEL0, 0, SHADE, 0, TEXEL0, 0, ENVIRONMENT, 0
|
||||
|
||||
#define G_CC_MODULATEFADE TEXEL0, 0, SHADE, 0, ENVIRONMENT, 0, TEXEL0, 0
|
||||
|
||||
#define G_CC_MODULATERGBA G_CC_MODULATEIA
|
||||
#define G_CC_MODULATERGBFADEA G_CC_MODULATEIFADEA
|
||||
|
||||
#define G_CC_MODULATEI_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE
|
||||
#define G_CC_MODULATEIA_PRIM TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0
|
||||
#define G_CC_MODULATEIDECALA_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0
|
||||
|
||||
#define G_CC_MODULATERGB_PRIM G_CC_MODULATEI_PRIM
|
||||
#define G_CC_MODULATERGBA_PRIM G_CC_MODULATEIA_PRIM
|
||||
#define G_CC_MODULATERGBDECALA_PRIM G_CC_MODULATEIDECALA_PRIM
|
||||
|
||||
#define G_CC_FADE SHADE, 0, ENVIRONMENT, 0, SHADE, 0, ENVIRONMENT, 0
|
||||
#define G_CC_FADEA TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0
|
||||
|
||||
#define G_CC_DECALRGB 0, 0, 0, TEXEL0, 0, 0, 0, SHADE
|
||||
#define G_CC_DECALRGBA 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0
|
||||
#define G_CC_DECALFADE 0, 0, 0, TEXEL0, 0, 0, 0, ENVIRONMENT
|
||||
|
||||
#define G_CC_DECALFADEA 0, 0, 0, TEXEL0, TEXEL0, 0, ENVIRONMENT, 0
|
||||
|
||||
#define G_CC_BLENDI ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_BLENDIA ENVIRONMENT, SHADE, TEXEL0, SHADE, TEXEL0, 0, SHADE, 0
|
||||
#define G_CC_BLENDIDECALA ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
|
||||
#define G_CC_BLENDRGBA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_BLENDRGBDECALA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_BLENDRGBFADEA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, ENVIRONMENT
|
||||
|
||||
#define G_CC_ADDRGB TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_ADDRGBDECALA TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_ADDRGBFADE TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, ENVIRONMENT
|
||||
|
||||
#define G_CC_REFLECTRGB ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_REFLECTRGBDECALA ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
|
||||
#define G_CC_HILITERGB PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_HILITERGBA PRIMITIVE, SHADE, TEXEL0, SHADE, PRIMITIVE, SHADE, TEXEL0, SHADE
|
||||
#define G_CC_HILITERGBDECALA PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0
|
||||
|
||||
#define G_CC_SHADEDECALA 0, 0, 0, SHADE, 0, 0, 0, TEXEL0
|
||||
#define G_CC_SHADEFADEA 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT
|
||||
|
||||
#define G_CC_BLENDPE PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, SHADE, 0
|
||||
#define G_CC_BLENDPEDECALA PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, TEXEL0
|
||||
|
||||
/* oddball modes */
|
||||
#define _G_CC_BLENDPE ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, SHADE, 0
|
||||
#define _G_CC_BLENDPEDECALA ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, 0, 0, 0, TEXEL0
|
||||
#define _G_CC_TWOCOLORTEX PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
#define _G_CC_BLENDPE ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, SHADE, 0
|
||||
#define _G_CC_BLENDPEDECALA ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, 0, 0, 0, TEXEL0
|
||||
#define _G_CC_TWOCOLORTEX PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE
|
||||
/* used for 1-cycle sparse mip-maps, primitive color has color of lowest LOD */
|
||||
#define _G_CC_SPARSEST PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0, PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0
|
||||
#define G_CC_TEMPLERP TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0
|
||||
#define _G_CC_SPARSEST PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0, PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0
|
||||
#define G_CC_TEMPLERP TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0
|
||||
|
||||
/* typical CC cycle 1 modes, usually followed by other cycle 2 modes */
|
||||
#define G_CC_TRILERP TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0, TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0
|
||||
#define G_CC_INTERFERENCE TEXEL0, 0, TEXEL1, 0, TEXEL0, 0, TEXEL1, 0
|
||||
#define G_CC_TRILERP TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0, TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0
|
||||
#define G_CC_INTERFERENCE TEXEL0, 0, TEXEL1, 0, TEXEL0, 0, TEXEL1, 0
|
||||
|
||||
/*
|
||||
* One-cycle color convert operation
|
||||
*/
|
||||
#define G_CC_1CYUV2RGB TEXEL0, K4, K5, TEXEL0, 0, 0, 0, SHADE
|
||||
#define G_CC_1CYUV2RGB TEXEL0, K4, K5, TEXEL0, 0, 0, 0, SHADE
|
||||
|
||||
/*
|
||||
* NOTE: YUV2RGB expects TF step1 color conversion to occur in 2nd clock.
|
||||
* Therefore, CC looks for step1 results in TEXEL1
|
||||
*/
|
||||
#define G_CC_YUV2RGB TEXEL1, K4, K5, TEXEL1, 0, 0, 0, 0
|
||||
#define G_CC_YUV2RGB TEXEL1, K4, K5, TEXEL1, 0, 0, 0, 0
|
||||
|
||||
/* typical CC cycle 2 modes */
|
||||
#define G_CC_PASS2 0, 0, 0, COMBINED, 0, 0, 0, COMBINED
|
||||
#define G_CC_MODULATEI2 COMBINED, 0, SHADE, 0, 0, 0, 0, SHADE
|
||||
#define G_CC_MODULATEIA2 COMBINED, 0, SHADE, 0, COMBINED, 0, SHADE, 0
|
||||
#define G_CC_MODULATERGB2 G_CC_MODULATEI2
|
||||
#define G_CC_MODULATERGBA2 G_CC_MODULATEIA2
|
||||
#define G_CC_MODULATEI_PRIM2 COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE
|
||||
#define G_CC_MODULATEIA_PRIM2 COMBINED, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0
|
||||
#define G_CC_MODULATERGB_PRIM2 G_CC_MODULATEI_PRIM2
|
||||
#define G_CC_MODULATERGBA_PRIM2 G_CC_MODULATEIA_PRIM2
|
||||
#define G_CC_DECALRGB2 0, 0, 0, COMBINED, 0, 0, 0, SHADE
|
||||
#define G_CC_PASS2 0, 0, 0, COMBINED, 0, 0, 0, COMBINED
|
||||
#define G_CC_MODULATEI2 COMBINED, 0, SHADE, 0, 0, 0, 0, SHADE
|
||||
#define G_CC_MODULATEIA2 COMBINED, 0, SHADE, 0, COMBINED, 0, SHADE, 0
|
||||
#define G_CC_MODULATERGB2 G_CC_MODULATEI2
|
||||
#define G_CC_MODULATERGBA2 G_CC_MODULATEIA2
|
||||
#define G_CC_MODULATEI_PRIM2 COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE
|
||||
#define G_CC_MODULATEIA_PRIM2 COMBINED, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0
|
||||
#define G_CC_MODULATERGB_PRIM2 G_CC_MODULATEI_PRIM2
|
||||
#define G_CC_MODULATERGBA_PRIM2 G_CC_MODULATEIA_PRIM2
|
||||
#define G_CC_DECALRGB2 0, 0, 0, COMBINED, 0, 0, 0, SHADE
|
||||
/*
|
||||
* ?
|
||||
#define G_CC_DECALRGBA2 COMBINED, SHADE, COMBINED_ALPHA, SHADE, 0, 0, 0, SHADE
|
||||
*/
|
||||
#define G_CC_BLENDI2 ENVIRONMENT, SHADE, COMBINED, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_BLENDIA2 ENVIRONMENT, SHADE, COMBINED, SHADE, COMBINED, 0, SHADE, 0
|
||||
#define G_CC_CHROMA_KEY2 TEXEL0, CENTER, SCALE, 0, 0, 0, 0, 0
|
||||
#define G_CC_HILITERGB2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, SHADE
|
||||
#define G_CC_HILITERGBA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, ENVIRONMENT, COMBINED, TEXEL0, COMBINED
|
||||
#define G_CC_HILITERGBDECALA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, TEXEL0
|
||||
#define G_CC_HILITERGBPASSA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, COMBINED
|
||||
#define G_CC_BLENDI2 ENVIRONMENT, SHADE, COMBINED, SHADE, 0, 0, 0, SHADE
|
||||
#define G_CC_BLENDIA2 ENVIRONMENT, SHADE, COMBINED, SHADE, COMBINED, 0, SHADE, 0
|
||||
#define G_CC_CHROMA_KEY2 TEXEL0, CENTER, SCALE, 0, 0, 0, 0, 0
|
||||
#define G_CC_HILITERGB2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, SHADE
|
||||
#define G_CC_HILITERGBA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, ENVIRONMENT, COMBINED, TEXEL0, COMBINED
|
||||
#define G_CC_HILITERGBDECALA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, TEXEL0
|
||||
#define G_CC_HILITERGBPASSA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, COMBINED
|
||||
|
||||
/*
|
||||
* G_SETOTHERMODE_L sft: shift count
|
||||
@@ -902,6 +931,9 @@
|
||||
CVG_DST_CLAMP | ZMODE_OPA | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)
|
||||
|
||||
/* Custom version of RM_AA_ZB_XLU_SURF with Z_UPD */
|
||||
#define RM_CUSTOM_AA_ZB_XLU_SURF(clk) \
|
||||
RM_AA_ZB_XLU_SURF(clk) | Z_UPD
|
||||
|
||||
|
||||
#define G_RM_AA_ZB_OPA_SURF RM_AA_ZB_OPA_SURF(1)
|
||||
@@ -1000,6 +1032,9 @@
|
||||
#define G_RM_OPA_CI RM_OPA_CI(1)
|
||||
#define G_RM_OPA_CI2 RM_OPA_CI(2)
|
||||
|
||||
#define G_RM_CUSTOM_AA_ZB_XLU_SURF RM_CUSTOM_AA_ZB_XLU_SURF(1)
|
||||
#define G_RM_CUSTOM_AA_ZB_XLU_SURF2 RM_CUSTOM_AA_ZB_XLU_SURF(2)
|
||||
|
||||
|
||||
#define G_RM_FOG_SHADE_A GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA)
|
||||
#define G_RM_FOG_PRIM_A GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA)
|
||||
@@ -1132,7 +1167,7 @@ typedef struct {
|
||||
* First 8 words are integer portion of the 4x4 matrix
|
||||
* Last 8 words are the fraction portion of the 4x4 matrix
|
||||
*/
|
||||
typedef long Mtx_t[4][4];
|
||||
typedef s32 Mtx_t[4][4];
|
||||
|
||||
typedef union {
|
||||
Mtx_t m;
|
||||
@@ -1478,6 +1513,8 @@ typedef union {
|
||||
{ {{ {{0,0,0},0,{0,0,0},0,{rightx,righty,rightz},0}}, \
|
||||
{ {{0,0x80,0},0,{0,0x80,0},0,{upx,upy,upz},0}}} }
|
||||
|
||||
/* Don't declare these for F3D_OLD to avoid bss reordering */
|
||||
#ifndef F3D_OLD
|
||||
/*
|
||||
* Graphics DMA Packet
|
||||
*/
|
||||
@@ -1650,9 +1687,6 @@ typedef struct {
|
||||
unsigned int dtdy:16;/* Change in T per change in Y */
|
||||
} Gtexrect;
|
||||
|
||||
#define MakeTexRect(xh,yh,flip,tile,xl,yl,s,t,dsdx,dtdy) \
|
||||
G_TEXRECT, xh, yh, 0, flip, 0, tile, xl, yl, s, t, dsdx, dtdy
|
||||
|
||||
/*
|
||||
* Textured rectangles are 128 bits not 64 bits
|
||||
*/
|
||||
@@ -1662,6 +1696,10 @@ typedef struct {
|
||||
unsigned long w2;
|
||||
unsigned long w3;
|
||||
} TexRect;
|
||||
#endif
|
||||
|
||||
#define MakeTexRect(xh,yh,flip,tile,xl,yl,s,t,dsdx,dtdy) \
|
||||
G_TEXRECT, xh, yh, 0, flip, 0, tile, xl, yl, s, t, dsdx, dtdy
|
||||
|
||||
/*
|
||||
* Generic Gfx Packet
|
||||
@@ -1681,7 +1719,7 @@ typedef struct {
|
||||
*/
|
||||
typedef union {
|
||||
Gwords words;
|
||||
#if !defined(__x86_64__) && !defined(__i386__)
|
||||
#if !defined(F3D_OLD) && !defined(__x86_64__) && !defined(__i386__)
|
||||
Gdma dma;
|
||||
Gtri tri;
|
||||
Gline3D line;
|
||||
@@ -2159,7 +2197,15 @@ typedef union {
|
||||
__gsSP1Triangle_w1f(v00, v01, v02, flag0)), \
|
||||
__gsSP1Triangle_w1f(v10, v11, v12, flag1) \
|
||||
}}
|
||||
|
||||
#else
|
||||
#define gSP2Triangles(pkt, v00, v01, v02, flag0, v10, v11, v12, flag1) \
|
||||
{ \
|
||||
gSP1Triangle(pkt, v00, v01, v02, flag0); \
|
||||
gSP1Triangle(pkt, v10, v11, v12, flag1); \
|
||||
}
|
||||
#define gsSP2Triangles(v00, v01, v02, flag0, v10, v11, v12, flag1) \
|
||||
gsSP1Triangle(v00, v01, v02, flag0), \
|
||||
gsSP1Triangle(v10, v11, v12, flag1)
|
||||
#endif /* F3DEX_GBI/F3DLP_GBI */
|
||||
|
||||
#if (defined(F3DEX_GBI)||defined(F3DLP_GBI))
|
||||
@@ -2797,8 +2843,23 @@ typedef union {
|
||||
}}
|
||||
#endif
|
||||
|
||||
#define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s))
|
||||
#define gsSPPerspNormalize(s) gsMoveWd( G_MW_PERSPNORM, 0, (s))
|
||||
#ifndef F3D_OLD
|
||||
# define gSPPerspNormalize(pkt, s) gMoveWd(pkt, G_MW_PERSPNORM, 0, (s))
|
||||
# define gsSPPerspNormalize(s) gsMoveWd( G_MW_PERSPNORM, 0, (s))
|
||||
#else
|
||||
# define gSPPerspNormalize(pkt, s) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = _SHIFTL(G_RDPHALF_1, 24, 8); \
|
||||
_g->words.w1 = (s); \
|
||||
}
|
||||
# define gsSPPerspNormalize(s) \
|
||||
{{ \
|
||||
_SHIFTL(G_RDPHALF_1, 24, 8), \
|
||||
(s) \
|
||||
}}
|
||||
#endif
|
||||
|
||||
#ifdef F3DEX_GBI_2
|
||||
# define gSPPopMatrixN(pkt, n, num) gDma2p((pkt),G_POPMTX,(num)*64,64,2,0)
|
||||
@@ -2849,7 +2910,7 @@ typedef union {
|
||||
#define gsSPClearGeometryMode(word) gsSPGeometryMode((word),0)
|
||||
#define gSPLoadGeometryMode(pkt, word) gSPGeometryMode((pkt),-1,(word))
|
||||
#define gsSPLoadGeometryMode(word) gsSPGeometryMode(-1,(word))
|
||||
|
||||
#define gsSPGeometryModeSetFirst(c, s) gsSPGeometryMode(c, s)
|
||||
#else /* F3DEX_GBI_2 */
|
||||
#define gSPSetGeometryMode(pkt, word) \
|
||||
{ \
|
||||
@@ -2876,6 +2937,18 @@ typedef union {
|
||||
{{ \
|
||||
_SHIFTL(G_CLEARGEOMETRYMODE, 24, 8), (unsigned int)(word) \
|
||||
}}
|
||||
|
||||
/*
|
||||
* gsSPGeometryMode
|
||||
* In Fast3DEX2 it is better to use this, as the RSP geometry mode
|
||||
* is able to be set and cleared in a single command.
|
||||
*/
|
||||
#define gsSPGeometryMode(c, s) \
|
||||
gsSPClearGeometryMode(c), \
|
||||
gsSPSetGeometryMode(s)
|
||||
#define gsSPGeometryModeSetFirst(c, s) \
|
||||
gsSPSetGeometryMode(s), \
|
||||
gsSPClearGeometryMode(c)
|
||||
#endif /* F3DEX_GBI_2 */
|
||||
|
||||
#ifdef F3DEX_GBI_2
|
||||
@@ -4482,13 +4555,73 @@ typedef union {
|
||||
_g->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \
|
||||
}
|
||||
|
||||
#ifdef F3D_OLD
|
||||
# define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | \
|
||||
_SHIFTL(yh, 0, 12)); \
|
||||
_g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \
|
||||
_SHIFTL(yl, 0, 12)); \
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)));\
|
||||
}
|
||||
|
||||
#define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | _SHIFTL(yh, 0, 12)),\
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
gsImmp1(G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
|
||||
#define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
|
||||
/* like gSPTextureRectangle but accepts negative position arguments */
|
||||
# define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | \
|
||||
_SHIFTL(MAX((s16)(xh),0), 12, 12) | \
|
||||
_SHIFTL(MAX((s16)(yh),0), 0, 12)); \
|
||||
_g->words.w1 = (_SHIFTL((tile), 24, 3) | \
|
||||
_SHIFTL(MAX((s16)(xl),0), 12, 12) | \
|
||||
_SHIFTL(MAX((s16)(yl),0), 0, 12)); \
|
||||
gImmp1(pkt, G_RDPHALF_2, \
|
||||
(_SHIFTL(((s) - \
|
||||
(((s16)(xl) < 0) ? \
|
||||
(((s16)(dsdx) < 0) ? \
|
||||
(MAX((((s16)(xl)*(s16)(dsdx))>>7),0)) : \
|
||||
(MIN((((s16)(xl)*(s16)(dsdx))>>7),0))) : 0)), \
|
||||
16, 16) | \
|
||||
_SHIFTL(((t) - \
|
||||
(((yl) < 0) ? \
|
||||
(((s16)(dtdy) < 0) ? \
|
||||
(MAX((((s16)(yl)*(s16)(dtdy))>>7),0)) : \
|
||||
(MIN((((s16)(yl)*(s16)(dtdy))>>7),0))) : 0)), \
|
||||
0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL((dsdx), 16, 16) | \
|
||||
_SHIFTL((dtdy), 0, 16))); \
|
||||
}
|
||||
|
||||
# define gsSPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) | \
|
||||
_SHIFTL(yh, 0, 12)), \
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
|
||||
# define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) |\
|
||||
_SHIFTL(yh, 0, 12)); \
|
||||
_g->words.w1 = (_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | \
|
||||
_SHIFTL(yl, 0, 12)); \
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))); \
|
||||
}
|
||||
#else
|
||||
# define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
@@ -4500,8 +4633,14 @@ typedef union {
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)));\
|
||||
}
|
||||
|
||||
#define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL(xh, 12, 12) | _SHIFTL(yh, 0, 12)),\
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
gsImmp1(G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
|
||||
/* like gSPTextureRectangle but accepts negative position arguments */
|
||||
#define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
# define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
@@ -4528,14 +4667,14 @@ typedef union {
|
||||
_SHIFTL((dtdy), 0, 16))); \
|
||||
}
|
||||
|
||||
#define gsSPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
# define gsSPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{{(_SHIFTL(G_TEXRECTFLIP, 24, 8) | _SHIFTL(xh, 12, 12) | \
|
||||
_SHIFTL(yh, 0, 12)), \
|
||||
(_SHIFTL(tile, 24, 3) | _SHIFTL(xl, 12, 12) | _SHIFTL(yl, 0, 12))}}, \
|
||||
gsImmp1(G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))), \
|
||||
gsImmp1(G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)))
|
||||
|
||||
#define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
# define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
@@ -4546,6 +4685,7 @@ typedef union {
|
||||
gImmp1(pkt, G_RDPHALF_1, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
|
||||
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define gsDPWord(wordhi, wordlo) \
|
||||
gsImmp1(G_RDPHALF_1, (uintptr_t)(wordhi)), \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1614
include/PR/gbi_old.h
1614
include/PR/gbi_old.h
File diff suppressed because it is too large
Load Diff
@@ -60,11 +60,7 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef F3D_OLD
|
||||
#include <PR/gbi_old.h>
|
||||
#else
|
||||
#include <PR/gbi.h>
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
|
||||
@@ -1,98 +1,10 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_libc.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.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_libc.h,v $
|
||||
$Revision: 1.3 $
|
||||
$Date: 1999/07/13 01:43:47 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_LIBC_H_
|
||||
#define _OS_LIBC_H_
|
||||
#define _OS_LIBC_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "ultratypes.h"
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* byte string operations */
|
||||
|
||||
|
||||
extern void bcopy(const void *, void *, int);
|
||||
extern int bcmp(const void *, const void *, int);
|
||||
extern void bzero(void *, int);
|
||||
|
||||
/* Printf */
|
||||
|
||||
extern int sprintf(char *s, const char *fmt, ...);
|
||||
extern void osSyncPrintf(const char *fmt, ...);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
// Old deprecated functions from strings.h, replaced by memcpy/memset.
|
||||
extern void bcopy(const void *, void *, size_t);
|
||||
extern void bzero(void *, size_t);
|
||||
|
||||
#endif /* !_OS_LIBC_H_ */
|
||||
|
||||
@@ -66,13 +66,13 @@
|
||||
#define SOUND_TERRAIN_ICE 6
|
||||
#define SOUND_TERRAIN_SAND 7
|
||||
|
||||
#define SOUND_ACTION_TERRAIN_JUMP SOUND_ARG_LOAD(0, 4, 0x00, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_LANDING SOUND_ARG_LOAD(0, 4, 0x08, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_STEP SOUND_ARG_LOAD(0, 6, 0x10, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_BODY_HIT_GROUND SOUND_ARG_LOAD(0, 4, 0x18, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_STEP_TIPTOE SOUND_ARG_LOAD(0, 6, 0x20, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_STUCK_IN_GROUND SOUND_ARG_LOAD(0, 4, 0x48, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_HEAVY_LANDING SOUND_ARG_LOAD(0, 4, 0x60, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_JUMP SOUND_ARG_LOAD(0, 4, 0x00, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_LANDING SOUND_ARG_LOAD(0, 4, 0x08, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_STEP SOUND_ARG_LOAD(0, 6, 0x10, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_BODY_HIT_GROUND SOUND_ARG_LOAD(0, 4, 0x18, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_STEP_TIPTOE SOUND_ARG_LOAD(0, 6, 0x20, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_STUCK_IN_GROUND SOUND_ARG_LOAD(0, 4, 0x48, 0x80, 8)
|
||||
#define SOUND_ACTION_TERRAIN_HEAVY_LANDING SOUND_ARG_LOAD(0, 4, 0x60, 0x80, 8)
|
||||
|
||||
#define SOUND_ACTION_METAL_JUMP SOUND_ARG_LOAD(0, 4, 0x28, 0x90, 8)
|
||||
#define SOUND_ACTION_METAL_LANDING SOUND_ARG_LOAD(0, 4, 0x29, 0x90, 8)
|
||||
@@ -85,44 +85,44 @@
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN430 SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN431 SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN432 SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN433 SOUND_ARG_LOAD(0, 4, 0x33, 0x80, 8)
|
||||
#define SOUND_ACTION_SWIM SOUND_ARG_LOAD(0, 4, 0x33, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN434 SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN435 SOUND_ARG_LOAD(0, 4, 0x35, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_SWISH1 SOUND_ARG_LOAD(0, 4, 0x36, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_SWISH2 SOUND_ARG_LOAD(0, 4, 0x37, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_SWISH2_2 SOUND_ARG_LOAD(0, 4, 0x38, 0x80, 8)
|
||||
#define SOUND_ACTION_THROW SOUND_ARG_LOAD(0, 4, 0x35, 0x80, 8)
|
||||
#define SOUND_ACTION_KEY_SWISH SOUND_ARG_LOAD(0, 4, 0x36, 0x80, 8)
|
||||
#define SOUND_ACTION_SPIN SOUND_ARG_LOAD(0, 4, 0x37, 0x80, 8)
|
||||
#define SOUND_ACTION_TWIRL SOUND_ARG_LOAD(0, 4, 0x38, 0x80, 8) // same sound as spin
|
||||
/* not verified */ #define SOUND_ACTION_CLIMB_UP_TREE SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_CLIMB_DOWN_TREE 0x003B
|
||||
/* not verified */ #define SOUND_ACTION_UNK3C 0x003C
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN43D SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN43E SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_PAT_BACK SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_BRUSH_HAIR SOUND_ARG_LOAD(0, 4, 0x40, 0x80, 8)
|
||||
#define SOUND_ACTION_BRUSH_HAIR SOUND_ARG_LOAD(0, 4, 0x40, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_CLIMB_UP_POLE SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN442 SOUND_ARG_LOAD(0, 4, 0x42, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN443 SOUND_ARG_LOAD(0, 4, 0x43, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN444 SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN444_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN444_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN445 SOUND_ARG_LOAD(0, 4, 0x45, 0xA0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN446 SOUND_ARG_LOAD(0, 4, 0x46, 0xA0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN447 SOUND_ARG_LOAD(0, 4, 0x47, 0xA0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN450 SOUND_ARG_LOAD(0, 4, 0x50, 0x90, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN451 SOUND_ARG_LOAD(0, 4, 0x51, 0x90, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN452 SOUND_ARG_LOAD(0, 4, 0x52, 0x90, 8)
|
||||
#define SOUND_ACTION_METAL_BONK SOUND_ARG_LOAD(0, 4, 0x42, 0x80, 8)
|
||||
#define SOUND_ACTION_UNSTUCK_FROM_GROUND SOUND_ARG_LOAD(0, 4, 0x43, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_HIT SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_HIT_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_HIT_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)
|
||||
#define SOUND_ACTION_BONK SOUND_ARG_LOAD(0, 4, 0x45, 0xA0, 8)
|
||||
#define SOUND_ACTION_SHRINK_INTO_BBH SOUND_ARG_LOAD(0, 4, 0x46, 0xA0, 8)
|
||||
#define SOUND_ACTION_SWIM_FAST SOUND_ARG_LOAD(0, 4, 0x47, 0xA0, 8)
|
||||
#define SOUND_ACTION_METAL_JUMP_WATER SOUND_ARG_LOAD(0, 4, 0x50, 0x90, 8)
|
||||
#define SOUND_ACTION_METAL_LAND_WATER SOUND_ARG_LOAD(0, 4, 0x51, 0x90, 8)
|
||||
#define SOUND_ACTION_METAL_STEP_WATER SOUND_ARG_LOAD(0, 4, 0x52, 0x90, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNK53 0x0053
|
||||
/* not verified */ #define SOUND_ACTION_UNK54 0x0054
|
||||
/* not verified */ #define SOUND_ACTION_UNK55 0x0055
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN456 SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN457 SOUND_ARG_LOAD(0, 4, 0x57, 0xC0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_FLYING_FAST SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8) // "swoop"?
|
||||
#define SOUND_ACTION_TELEPORT SOUND_ARG_LOAD(0, 4, 0x57, 0xC0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN458 SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN459 SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN45A SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN45B SOUND_ARG_LOAD(0, 4, 0x5B, 0xFF, 8)
|
||||
/* not verified */ #define SOUND_ACTION_BOUNCE_OFF_OBJECT SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)
|
||||
/* not verified */ #define SOUND_ACTION_SIDE_FLIP_UNK SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)
|
||||
#define SOUND_ACTION_READ_SIGN SOUND_ARG_LOAD(0, 4, 0x5B, 0xFF, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN45C SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNK5D 0x005D
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_UNKNOWN45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_INTRO_UNK45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)
|
||||
/* not verified */ #define SOUND_ACTION_INTRO_UNK45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)
|
||||
|
||||
/* Moving Sound Effects */
|
||||
|
||||
@@ -492,7 +492,6 @@
|
||||
#define SOUND_MENU_CAMERA_TURN SOUND_ARG_LOAD(7, 0, 0x0F, 0x00, 8)
|
||||
/* not verified */ #define SOUND_MENU_UNK10 0x7010
|
||||
#define SOUND_MENU_CLICK_FILE_SELECT SOUND_ARG_LOAD(7, 0, 0x11, 0x00, 8)
|
||||
/* not verified */ #define SOUND_MENU_READ_SIGN 0x7012
|
||||
/* not verified */ #define SOUND_MENU_MESSAGE_NEXT_PAGE SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8)
|
||||
#define SOUND_MENU_COIN_ITS_A_ME_MARIO SOUND_ARG_LOAD(7, 0, 0x14, 0x00, 8)
|
||||
#define SOUND_MENU_YOSHI_GAIN_LIVES SOUND_ARG_LOAD(7, 0, 0x15, 0x00, 8)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
28
include/command_macros_base.h
Normal file
28
include/command_macros_base.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef COMMAND_MACROS_BASE_H
|
||||
#define COMMAND_MACROS_BASE_H
|
||||
|
||||
#include "platform_info.h"
|
||||
|
||||
#if IS_BIG_ENDIAN
|
||||
#if IS_64_BIT
|
||||
#define CMD_BBBB(a, b, c, d) ((uintptr_t)(_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8)) << 32)
|
||||
#define CMD_BBH(a, b, c) ((uintptr_t)(_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 0, 16)) << 32)
|
||||
#define CMD_HH(a, b) ((uintptr_t)(_SHIFTL(a, 16, 16) | _SHIFTL(b, 0, 16)) << 32)
|
||||
#define CMD_W(a) ((uintptr_t)(a) << 32)
|
||||
#else
|
||||
#define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8))
|
||||
#define CMD_BBH(a, b, c) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 0, 16))
|
||||
#define CMD_HH(a, b) (_SHIFTL(a, 16, 16) | _SHIFTL(b, 0, 16))
|
||||
#define CMD_W(a) (a)
|
||||
#endif
|
||||
#else
|
||||
#define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 0, 8) | _SHIFTL(b, 8, 8) | _SHIFTL(c, 16, 8) | _SHIFTL(d, 24, 8))
|
||||
#define CMD_BBH(a, b, c) (_SHIFTL(a, 0, 8) | _SHIFTL(b, 8, 8) | _SHIFTL(c, 16, 16))
|
||||
#define CMD_HH(a, b) (_SHIFTL(a, 0, 16) | _SHIFTL(b, 16, 16))
|
||||
#define CMD_W(a) (a)
|
||||
#endif
|
||||
#define CMD_PTR(a) ((uintptr_t)(a))
|
||||
|
||||
#define CMD_HHHHHH(a, b, c, d, e, f) CMD_HH(a, b), CMD_HH(c, d), CMD_HH(e, f)
|
||||
|
||||
#endif
|
||||
@@ -9,15 +9,19 @@
|
||||
|
||||
// Bug Fixes
|
||||
// --| Categories
|
||||
/// Turn on bug fixes for really bad, C standard breaking code. As these bugs
|
||||
/// have caused compilation issues with modern GCC, these bug fixes are
|
||||
/// automatically enabled when compiling with GCC
|
||||
#define BUGFIXES_CRITICAL (0 || __GNUC__)
|
||||
/// Turn on bug fixes for really bad, C standard breaking code. This is
|
||||
/// enabled automatically when building with non-IDO compilers, or if
|
||||
/// NON_MATCHING is set.
|
||||
#if !defined(__sgi) || defined(NON_MATCHING)
|
||||
#define BUGFIXES_CRITICAL 1
|
||||
#else
|
||||
#define BUGFIXES_CRITICAL 0
|
||||
#endif
|
||||
|
||||
// --| US 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)
|
||||
/// Fixes bug where the Boss music won't fade out after defeating King Bob-omb
|
||||
/// Fixes bug where the Boss music won't fade out after defeating King Bob-omb
|
||||
#define BUGFIX_KING_BOB_OMB_FADE_MUSIC (0 || VERSION_US || VERSION_EU)
|
||||
/// Fixes bug in Bob-Omb Battlefield where entering a warp stops the Koopa race music
|
||||
#define BUGFIX_KOOPA_RACE_MUSIC (0 || VERSION_US || VERSION_EU)
|
||||
|
||||
433
include/geo_commands.h
Normal file
433
include/geo_commands.h
Normal file
@@ -0,0 +1,433 @@
|
||||
#ifndef GEO_COMMANDS_H
|
||||
#define GEO_COMMANDS_H
|
||||
|
||||
#include "command_macros_base.h"
|
||||
|
||||
#include "game/shadow.h"
|
||||
#include "game/object_helpers.h"
|
||||
#include "game/object_helpers2.h"
|
||||
#include "game/behavior_actions.h"
|
||||
#include "game/segment2.h"
|
||||
#include "game/mario_misc.h"
|
||||
#include "game/mario_actions_cutscene.h"
|
||||
|
||||
// sky background params
|
||||
#define BACKGROUND_OCEAN_SKY 0
|
||||
#define BACKGROUND_FLAMING_SKY 1
|
||||
#define BACKGROUND_UNDERWATER_CITY 2
|
||||
#define BACKGROUND_BELOW_CLOUDS 3
|
||||
#define BACKGROUND_SNOW_MOUNTAINS 4
|
||||
#define BACKGROUND_DESERT 5
|
||||
#define BACKGROUND_HAUNTED 6
|
||||
#define BACKGROUND_GREEN_SKY 7
|
||||
#define BACKGROUND_ABOVE_CLOUDS 8
|
||||
#define BACKGROUND_PURPLE_SKY 9
|
||||
|
||||
// geo layout macros
|
||||
|
||||
/**
|
||||
* 0x00: Branch and store return address
|
||||
* 0x04: scriptTarget, segment address of geo layout
|
||||
*/
|
||||
#define GEO_BRANCH_AND_LINK(scriptTarget) \
|
||||
CMD_BBH(0x00, 0x00, 0x0000), \
|
||||
CMD_PTR(scriptTarget)
|
||||
|
||||
/**
|
||||
* 0x01: Terminate geo layout
|
||||
* 0x01-0x03: unused
|
||||
*/
|
||||
#define GEO_END() \
|
||||
CMD_BBH(0x01, 0x00, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x02: Branch
|
||||
* 0x01: if 1, store next geo layout address on stack
|
||||
* 0x02-0x03: unused
|
||||
* 0x04: scriptTarget, segment address of geo layout
|
||||
*/
|
||||
#define GEO_BRANCH(type, scriptTarget) \
|
||||
CMD_BBH(0x02, type, 0x0000), \
|
||||
CMD_PTR(scriptTarget)
|
||||
|
||||
/**
|
||||
* 0x03: Return from branch
|
||||
* 0x01-0x03: unused
|
||||
*/
|
||||
#define GEO_RETURN() \
|
||||
CMD_BBH(0x03, 0x00, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x04: Open node
|
||||
* 0x01-0x03: unused
|
||||
*/
|
||||
#define GEO_OPEN_NODE() \
|
||||
CMD_BBH(0x04, 0x00, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x05: Close node
|
||||
* 0x01-0x03: unused
|
||||
*/
|
||||
#define GEO_CLOSE_NODE() \
|
||||
CMD_BBH(0x05, 0x00, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x06: Register the current node at the given index in the gGeoViews array
|
||||
* 0x01: unused
|
||||
* 0x02: s16 index
|
||||
*/
|
||||
#define GEO_ASSIGN_AS_VIEW(index) \
|
||||
CMD_BBH(0x06, 0x00, index)
|
||||
|
||||
/**
|
||||
* 0x07: Update current scene graph node flags
|
||||
* 0x01: u8 operation (0 = reset, 1 = set, 2 = clear)
|
||||
* 0x02: s16 bits
|
||||
*/
|
||||
#define GEO_UPDATE_NODE_FLAGS(operation, flagBits) \
|
||||
CMD_BBH(0x07, operation, flagBits)
|
||||
|
||||
/**
|
||||
* 0x08: Create screen area scene graph node
|
||||
* 0x01: unused
|
||||
* 0x02: s16 num entries (+2) to allocate
|
||||
* 0x04: s16 x
|
||||
* 0x06: s16 y
|
||||
* 0x08: s16 width
|
||||
* 0x0A: s16 height
|
||||
*/
|
||||
#define GEO_NODE_SCREEN_AREA(numEntries, x, y, width, height) \
|
||||
CMD_BBH(0x08, 0x00, numEntries), \
|
||||
CMD_HH(x, y), \
|
||||
CMD_HH(width, height)
|
||||
|
||||
/**
|
||||
* 0x09: Create orthographic projection scene graph node
|
||||
* 0x02: s16 scale as percentage
|
||||
*/
|
||||
#define GEO_NODE_ORTHO(scale) \
|
||||
CMD_BBH(0x09, 0x00, scale)
|
||||
|
||||
/**
|
||||
* 0x0A: Create camera frustum scene graph node
|
||||
* 0x01: u8 if nonzero, enable function field
|
||||
* 0x02: s16 field of view
|
||||
* 0x04: s16 near
|
||||
* 0x06: s16 far
|
||||
* 0x08: [GraphNodeFunc function]
|
||||
*/
|
||||
#define GEO_CAMERA_FRUSTUM(fov, near, far) \
|
||||
CMD_BBH(0x0A, 0x00, fov), \
|
||||
CMD_HH(near, far)
|
||||
#define GEO_CAMERA_FRUSTUM_WITH_FUNC(fov, near, far, func) \
|
||||
CMD_BBH(0x0A, 0x01, fov), \
|
||||
CMD_HH(near, far), \
|
||||
CMD_PTR(func)
|
||||
|
||||
/**
|
||||
* 0x0B: Create a root scene graph node
|
||||
* 0x01-0x03: unused
|
||||
*/
|
||||
#define GEO_NODE_START() \
|
||||
CMD_BBH(0x0B, 0x00, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x0C: Create zbuffer-toggling scene graph node
|
||||
* 0x01: u8 enableZBuffer (1 = on, 0 = off)
|
||||
* 0x02-0x03: unused
|
||||
*/
|
||||
#define GEO_ZBUFFER(enable) \
|
||||
CMD_BBH(0x0C, enable, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x0D: Create render range scene graph node
|
||||
* 0x01-0x03: unused
|
||||
* 0x04: s16 minDistance
|
||||
* 0x06: s16 maxDistance
|
||||
*/
|
||||
#define GEO_RENDER_RANGE(minDistance, maxDistance) \
|
||||
CMD_BBH(0x0D, 0x00, 0x0000), \
|
||||
CMD_HH(minDistance, maxDistance)
|
||||
|
||||
/**
|
||||
* 0x0E: Create switch-case scene graph node
|
||||
* 0x01: unused
|
||||
* 0x02: s16 numCases
|
||||
* 0x04: GraphNodeFunc caseSelectorFunc
|
||||
*/
|
||||
#define GEO_SWITCH_CASE(count, function) \
|
||||
CMD_BBH(0x0E, 0x00, count), \
|
||||
CMD_PTR(function)
|
||||
|
||||
/**
|
||||
* 0x0F: Create a camera scene graph node.
|
||||
* 0x01: unused
|
||||
* 0x02: s16 camera type
|
||||
* 0x04: s16 fromX
|
||||
* 0x06: s16 fromY
|
||||
* 0x08: s16 fromZ
|
||||
* 0x0A: s16 toX
|
||||
* 0x0C: s16 toY
|
||||
* 0x0E: s16 toZ
|
||||
* 0x10: GraphNodeFunc function
|
||||
*/
|
||||
#define GEO_CAMERA(type, x1, y1, z1, x2, y2, z2, function) \
|
||||
CMD_BBH(0x0F, 0x00, type), \
|
||||
CMD_HHHHHH(x1, y1, z1, x2, y2, z2), \
|
||||
CMD_PTR(function)
|
||||
|
||||
/**
|
||||
* 0x10: Create translation & rotation scene graph node with optional display list
|
||||
* Four different versions of 0x10
|
||||
* cmd+0x01: u8 params
|
||||
* 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
* 0b0111_0000: fieldLayout (determines how rest of data is formatted
|
||||
* 0b0000_1111: drawingLayer
|
||||
*
|
||||
* fieldLayout = 0: Translate & Rotate
|
||||
* 0x04: s16 xTranslation
|
||||
* 0x06: s16 yTranslation
|
||||
* 0x08: s16 zTranslation
|
||||
* 0x0A: s16 xRotation
|
||||
* 0x0C: s16 yRotation
|
||||
* 0x0E: s16 zRotation
|
||||
* 0x10: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
*/
|
||||
#define GEO_TRANSLATE_ROTATE(layer, tx, ty, tz, rx, ry, rz) \
|
||||
CMD_BBH(0x10, (0x00 | layer), 0x0000), \
|
||||
CMD_HHHHHH(tx, ty, tz, rx, ry, rz)
|
||||
#define GEO_TRANSLATE_ROTATE_WITH_DL(layer, tx, ty, tz, rx, ry, rz, displayList) \
|
||||
CMD_BBH(0x10, (0x00 | layer | 0x80), 0x0000), \
|
||||
CMD_HHHHHH(tx, ty, tz, rx, ry, rz), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* fieldLayout = 1: Translate
|
||||
* 0x02: s16 xTranslation
|
||||
* 0x04: s16 yTranslation
|
||||
* 0x06: s16 zTranslation
|
||||
* 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
*/
|
||||
#define GEO_TRANSLATE(layer, tx, ty, tz) \
|
||||
CMD_BBH(0x10, (0x10 | layer), tx), \
|
||||
CMD_HH(ty, tz)
|
||||
#define GEO_TRANSLATE_WITH_DL(layer, tx, ty, tz, displayList) \
|
||||
CMD_BBH(0x10, (0x10 | layer | 0x80), tx), \
|
||||
CMD_HH(ty, tz), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* fieldLayout = 2: Rotate
|
||||
* 0x02: s16 xRotation
|
||||
* 0x04: s16 yRotation
|
||||
* 0x06: s16 zRotation
|
||||
* 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
*/
|
||||
#define GEO_ROTATE(layer, rx, ry, rz) \
|
||||
CMD_BBH(0x10, (0x20 | layer), rx), \
|
||||
CMD_HH(ry, rz)
|
||||
#define GEO_ROTATE_WITH_DL(layer, rx, ry, rz, displayList) \
|
||||
CMD_BBH(0x10, (0x20 | layer | 0x80), rx), \
|
||||
CMD_HH(ry, rz), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* fieldLayout = 3: Rotate Y
|
||||
* 0x02: s16 yRotation
|
||||
* 0x04: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
*/
|
||||
#define GEO_ROTATE_Y(layer, ry) \
|
||||
CMD_BBH(0x10, (0x30 | layer), ry)
|
||||
#define GEO_ROTATE_Y_WITH_DL(layer, ry, displayList) \
|
||||
CMD_BBH(0x10, (0x30 | layer | 0x80), ry), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* 0x11: Create translation scene graph node with optional display list
|
||||
* 0x01: u8 params
|
||||
* 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
* 0b0000_1111: drawingLayer
|
||||
* 0x02: s16 translationX
|
||||
* 0x04: s16 translationY
|
||||
* 0x06: s16 translationZ
|
||||
* 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
*/
|
||||
#define GEO_TRANSLATE_NODE(layer, ux, uy, uz) \
|
||||
CMD_BBH(0x11, layer, ux), \
|
||||
CMD_HH(uy, uz)
|
||||
#define GEO_TRANSLATE_NODE_WITH_DL(layer, ux, uy, uz, displayList) \
|
||||
CMD_BBH(0x11, (layer | 0x80), ux), \
|
||||
CMD_HH(uy, uz), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* 0x12: Create rotation scene graph node with optional display list
|
||||
* 0x01: u8 params
|
||||
* 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
* 0b0000_1111: drawingLayer
|
||||
* 0x02: s16 rotationX
|
||||
* 0x04: s16 rotationY
|
||||
* 0x06: s16 rotationZ
|
||||
* 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
*/
|
||||
#define GEO_ROTATION_NODE(layer, ux, uy, uz) \
|
||||
CMD_BBH(0x12, layer, ux), \
|
||||
CMD_HH(uy, uz)
|
||||
#define GEO_ROTATION_NODE_WITH_DL(layer, ux, uy, uz, displayList) \
|
||||
CMD_BBH(0x12, (layer | 0x80), ux), \
|
||||
CMD_HH(uy, uz), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* 0x13: Create a scene graph node that is rotated by the object's animation.
|
||||
* 0x01: u8 drawingLayer
|
||||
* 0x02: s16 xTranslation
|
||||
* 0x04: s16 yTranslation
|
||||
* 0x06: s16 zTranslation
|
||||
* 0x08: u32 displayList: dislay list segmented address
|
||||
*/
|
||||
#define GEO_ANIMATED_PART(layer, x, y, z, displayList) \
|
||||
CMD_BBH(0x13, layer, x), \
|
||||
CMD_HH(y, z), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* 0x14: Create billboarding node with optional display list
|
||||
* 0x01: u8 params
|
||||
* 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
* 0b0000_1111: drawingLayer
|
||||
* 0x02: s16 xTranslation
|
||||
* 0x04: s16 yTranslation
|
||||
* 0x06: s16 zTranslation
|
||||
* 0x08: [u32 displayList: if MSbit of params is set, display list segmented address]
|
||||
*/
|
||||
#define GEO_BILLBOARD_WITH_PARAMS(layer, tx, ty, tz) \
|
||||
CMD_BBH(0x14, layer, tx), \
|
||||
CMD_HH(ty, tz)
|
||||
#define GEO_BILLBOARD_WITH_PARAMS_AND_DL(layer, tx, ty, tz, displayList) \
|
||||
CMD_BBH(0x14, (layer | 0x80), tx), \
|
||||
CMD_HH(ty, tz), \
|
||||
CMD_PTR(displayList)
|
||||
#define GEO_BILLBOARD() \
|
||||
GEO_BILLBOARD_WITH_PARAMS(0, 0, 0, 0)
|
||||
|
||||
/**
|
||||
* 0x15: Create plain display list scene graph node
|
||||
* 0x01: u8 drawingLayer
|
||||
* 0x02-0x03: unused
|
||||
* 0x04: u32 displayList: display list segmented address
|
||||
*/
|
||||
#define GEO_DISPLAY_LIST(layer, displayList) \
|
||||
CMD_BBH(0x15, layer, 0x0000), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* 0x16: Create shadow scene graph node
|
||||
* 0x01: unused
|
||||
* 0x02: s16 shadowType (cast to u8)
|
||||
* 0x04: s16 shadowSolidity (cast to u8)
|
||||
* 0x06: s16 shadowScale
|
||||
*/
|
||||
#define GEO_SHADOW(type, solidity, scale) \
|
||||
CMD_BBH(0x16, 0x00, type), \
|
||||
CMD_HH(solidity, scale)
|
||||
|
||||
/**
|
||||
* 0x17: Create render object scene graph node
|
||||
* 0x01-0x03: unused
|
||||
*/
|
||||
#define GEO_RENDER_OBJ() \
|
||||
CMD_BBH(0x17, 0x00, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x18: Create dynamically generated displaylist scene graph node
|
||||
* 0x01: unused
|
||||
* 0x02: s16 parameter
|
||||
* 0x04: GraphNodeFunc function
|
||||
*/
|
||||
#define GEO_ASM(param, function) \
|
||||
CMD_BBH(0x18, 0x00, param), \
|
||||
CMD_PTR(function)
|
||||
|
||||
/**
|
||||
* 0x19: Create background scene graph node
|
||||
* 0x02: s16 background: background ID, or RGBA5551 color if backgroundFunc is null
|
||||
* 0x04: GraphNodeFunc backgroundFunc
|
||||
*/
|
||||
#define GEO_BACKGROUND(background, function) \
|
||||
CMD_BBH(0x19, 0x00, background), \
|
||||
CMD_PTR(function)
|
||||
#define GEO_BACKGROUND_COLOR(background) \
|
||||
GEO_BACKGROUND(background, NULL)
|
||||
|
||||
/**
|
||||
* 0x1A: No operation
|
||||
*/
|
||||
#define GEO_NOP_1A() \
|
||||
CMD_BBH(0x1A, 0x00, 0x0000), \
|
||||
CMD_HH(0x0000, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x1B: Copy the shared children from an object parent node from a specific view
|
||||
* to a newly created object parent.
|
||||
* 0x02: s16 index of array
|
||||
*/
|
||||
#define GEO_COPY_VIEW(index) \
|
||||
CMD_BBH(0x1B, 0x00, index)
|
||||
|
||||
/**
|
||||
* 0x1C: Create a held object scene graph node
|
||||
* cmd+0x01: u8 unused
|
||||
* cmd+0x02: s16 offsetX
|
||||
* cmd+0x04: s16 offsetY
|
||||
* cmd+0x06: s16 offsetZ
|
||||
* cmd+0x08: GraphNodeFunc nodeFunc
|
||||
*/
|
||||
#define GEO_HELD_OBJECT(param, ux, uy, uz, nodeFunc) \
|
||||
CMD_BBH(0x1C, param, ux), \
|
||||
CMD_HH(uy, uz), \
|
||||
CMD_PTR(nodeFunc)
|
||||
|
||||
/**
|
||||
* 0x1D: Create scale scene graph node with optional display list
|
||||
* 0x01: u8 params
|
||||
* 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
* 0b0000_1111: drawingLayer
|
||||
* 0x02-0x03: unused
|
||||
* 0x04: u32 scale (0x10000 = 1.0)
|
||||
* 0x08: [u32 displayList: if MSbit of params is set, display list segment address]
|
||||
*/
|
||||
#define GEO_SCALE(layer, scale) \
|
||||
CMD_BBH(0x1D, layer, 0x0000), \
|
||||
CMD_W(scale)
|
||||
#define GEO_SCALE_WITH_DL(layer, scale, displayList) \
|
||||
CMD_BBH(0x1D, (layer | 0x80), 0x0000), \
|
||||
CMD_W(scale), \
|
||||
CMD_PTR(displayList)
|
||||
|
||||
/**
|
||||
* 0x1E: No operation
|
||||
*/
|
||||
#define GEO_NOP_1E() \
|
||||
CMD_BBH(0x1E, 0x00, 0x0000), \
|
||||
CMD_HH(0x0000, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x1F: No operation
|
||||
*/
|
||||
#define GEO_NOP_1F() \
|
||||
CMD_BBH(0x1F, 0x00, 0x0000), \
|
||||
CMD_HH(0x0000, 0x0000), \
|
||||
CMD_HH(0x0000, 0x0000), \
|
||||
CMD_HH(0x0000, 0x0000)
|
||||
|
||||
/**
|
||||
* 0x20: Create a scene graph node that specifies for an object the radius that
|
||||
* is used for frustum culling.
|
||||
* 0x01: unused
|
||||
* 0x02: s16 cullingRadius
|
||||
*/
|
||||
#define GEO_CULLING_RADIUS(cullingRadius) \
|
||||
CMD_BBH(0x20, 0x00, cullingRadius)
|
||||
|
||||
#endif
|
||||
@@ -1,444 +0,0 @@
|
||||
# drawing layers
|
||||
.set LAYER_FORCE, 0
|
||||
.set LAYER_OPAQUE, 1
|
||||
.set LAYER_OPAQUE_DECAL, 2
|
||||
.set LAYER_OPAQUE_INTER, 3
|
||||
.set LAYER_ALPHA, 4
|
||||
.set LAYER_TRANSPARENT, 5
|
||||
.set LAYER_TRANSPARENT_DECAL, 6
|
||||
.set LAYER_TRANSPARENT_INTER, 7
|
||||
|
||||
# sky background params
|
||||
.set BACKGROUND_OCEAN_SKY, 0
|
||||
.set BACKGROUND_FLAMING_SKY, 1
|
||||
.set BACKGROUND_UNDERWATER_CITY, 2
|
||||
.set BACKGROUND_BELOW_CLOUDS, 3
|
||||
.set BACKGROUND_SNOW_MOUNTAINS, 4
|
||||
.set BACKGROUND_DESERT, 5
|
||||
.set BACKGROUND_HAUNTED, 6
|
||||
.set BACKGROUND_GREEN_SKY, 7
|
||||
.set BACKGROUND_ABOVE_CLOUDS, 8
|
||||
.set BACKGROUND_PURPLE_SKY, 9
|
||||
|
||||
# geo layout macros
|
||||
|
||||
# 0x00: Branch and store return address
|
||||
# 0x04: scriptTarget, segment address of geo layout
|
||||
.macro geo_branch_and_link scriptTarget
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
.word \scriptTarget
|
||||
.endm
|
||||
|
||||
# 0x01: Terminate geo layout
|
||||
# 0x01-0x03: unused
|
||||
.macro geo_end
|
||||
.byte 0x01, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x02: Branch
|
||||
# 0x01: if 1, store next geo layout address on stack
|
||||
# 0x02-0x03: unused
|
||||
# 0x04: scriptTarget, segment address of geo layout
|
||||
.macro geo_branch type, scriptTarget
|
||||
.byte 0x02, \type, 0x00, 0x00
|
||||
.word \scriptTarget
|
||||
.endm
|
||||
|
||||
# 0x03: Return from branch
|
||||
# 0x01-0x03: unused
|
||||
.macro geo_return
|
||||
.byte 0x03, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x04: Open node
|
||||
# 0x01-0x03: unused
|
||||
.macro geo_open_node
|
||||
.byte 0x04, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x05: Close node
|
||||
# 0x01-0x03: unused
|
||||
.macro geo_close_node
|
||||
.byte 0x05, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x06: Register the current node at the given index in the gGeoViews array
|
||||
# 0x01: unused
|
||||
# 0x02: s16 index
|
||||
.macro geo_assign_as_view param
|
||||
.byte 0x06, 0x00
|
||||
.hword \param
|
||||
.endm
|
||||
|
||||
# 0x07: Update current scene graph node flags
|
||||
# 0x01: u8 operation (0 = reset, 1 = set, 2 = clear)
|
||||
# 0x02: s16 bits
|
||||
.macro geo_update_node_flags operation, flagBits
|
||||
.byte 0x07, \operation
|
||||
.hword \flagBits
|
||||
.endm
|
||||
|
||||
# 0x08: Create screen area scene graph node
|
||||
# 0x01: unused
|
||||
# 0x02: s16 num entries (+2) to allocate
|
||||
# 0x04: s16 x
|
||||
# 0x06: s16 y
|
||||
# 0x08: s16 width
|
||||
# 0x0A: s16 height
|
||||
.macro geo_node_screen_area numEntries, x, y, width, height
|
||||
.byte 0x08, 0x00
|
||||
.hword \numEntries
|
||||
.hword \x, \y, \width, \height
|
||||
.endm
|
||||
|
||||
# 0x09: Create orthographic projection scene graph node
|
||||
# 0x02: s16 scale as percentage
|
||||
.macro geo_node_ortho param
|
||||
.byte 0x09, 0x00
|
||||
.hword \param
|
||||
.endm
|
||||
|
||||
# 0x0A: Create camera frustum scene graph node
|
||||
# 0x01: u8 if nonzero, enable function field
|
||||
# 0x02: s16 field of view
|
||||
# 0x04: s16 near
|
||||
# 0x06: s16 far
|
||||
# 0x08: [GraphNodeFunc function]
|
||||
.macro geo_camera_frustum fov, near, far, function=0
|
||||
.byte 0x0A
|
||||
.if (\function != 0)
|
||||
.byte 0x01
|
||||
.else
|
||||
.byte 0x00
|
||||
.endif
|
||||
.hword \fov, \near, \far
|
||||
.if (\function != 0)
|
||||
.word \function
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# 0x0B: Create a root scene graph node
|
||||
# 0x01-0x03: unused
|
||||
.macro geo_node_start
|
||||
.byte 0x0B, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x0C: Create zbuffer-toggling scene graph node
|
||||
# 0x01: u8 enableZBuffer (1 = on, 0 = off)
|
||||
# 0x02-0x03: unused
|
||||
.macro geo_zbuffer enable
|
||||
.byte 0x0C, \enable, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x0D: Create render range scene graph node
|
||||
# 0x01-0x03: unused
|
||||
# 0x04: s16 minDistance
|
||||
# 0x06: s16 maxDistance
|
||||
.macro geo_render_range minDistance, maxDistance
|
||||
.byte 0x0D, 0x00, 0x00, 0x00
|
||||
.hword \minDistance, \maxDistance
|
||||
.endm
|
||||
|
||||
# 0x0E: Create switch-case scene graph node
|
||||
# 0x01: unused
|
||||
# 0x02: s16 numCases
|
||||
# 0x04: GraphNodeFunc caseSelectorFunc
|
||||
.macro geo_switch_case count, function
|
||||
.byte 0x0E, 0x00
|
||||
.hword \count
|
||||
.word \function
|
||||
.endm
|
||||
|
||||
# 0x0F: Create a camera scene graph node.
|
||||
# 0x01: unused
|
||||
# 0x02: s16 camera type
|
||||
# 0x04: s16 fromX
|
||||
# 0x06: s16 fromY
|
||||
# 0x08: s16 fromZ
|
||||
# 0x0A: s16 toX
|
||||
# 0x0C: s16 toY
|
||||
# 0x0E: s16 toZ
|
||||
# 0x10: GraphNodeFunc function
|
||||
.macro geo_camera type, x1, y1, z1, x2, y2, z2, function
|
||||
.byte 0x0F, 0x00
|
||||
.hword \type, \x1, \y1, \z1, \x2, \y2, \z2
|
||||
.word \function
|
||||
.endm
|
||||
|
||||
# 0x10: Create translation & rotation scene graph node with optional display list
|
||||
# Four different versions of 0x10
|
||||
# cmd+0x01: u8 params
|
||||
# 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
# 0b0111_0000: fieldLayout (determines how rest of data is formatted
|
||||
# 0b0000_1111: drawingLayer
|
||||
#
|
||||
# fieldLayout = 0: Translate & Rotate
|
||||
# 0x04: s16 xTranslation
|
||||
# 0x06: s16 xTranslation
|
||||
# 0x08: s16 xTranslation
|
||||
# 0x0A: s16 xRotation
|
||||
# 0x0C: s16 xRotation
|
||||
# 0x0E: s16 xRotation
|
||||
# 0x10: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
.macro geo_translate_rotate layer, tx, ty, tz, rx, ry, rz, displayList=0
|
||||
.byte 0x10
|
||||
.if (\displayList != 0)
|
||||
.byte 0x00 | \layer | 0x80
|
||||
.else
|
||||
.byte 0x00 | \layer
|
||||
.endif
|
||||
.hword 0x0000
|
||||
.hword \tx, \ty, \tz
|
||||
.hword \rx, \ry, \rz
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# fieldLayout = 1: Translate
|
||||
# 0x02: s16 xTranslation
|
||||
# 0x04: s16 yTranslation
|
||||
# 0x06: s16 zTranslation
|
||||
# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
.macro geo_translate layer, tx, ty, tz, displayList=0
|
||||
.byte 0x10
|
||||
.if (\displayList != 0)
|
||||
.byte 0x10 | \layer | 0x80
|
||||
.else
|
||||
.byte 0x10 | \layer
|
||||
.endif
|
||||
.hword \tx, \ty, \tz
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# fieldLayout = 2: Rotate
|
||||
# 0x02: s16 xRotation
|
||||
# 0x04: s16 yRotation
|
||||
# 0x06: s16 zRotation
|
||||
# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
.macro geo_rotate layer, rx, ry, rz, displayList=0
|
||||
.byte 0x10
|
||||
.if (\displayList != 0)
|
||||
.byte 0x20 | \layer | 0x80
|
||||
.else
|
||||
.byte 0x20 | \layer
|
||||
.endif
|
||||
.hword \rx, \ry, \rz
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# fieldLayout = 3: Rotate Y
|
||||
# 0x02: s16 yRotation
|
||||
# 0x04: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
.macro geo_rotate_y layer, ry, displayList=0
|
||||
.byte 0x10
|
||||
.if (\displayList != 0)
|
||||
.byte 0x30 | \layer | 0x80
|
||||
.else
|
||||
.byte 0x30 | \layer
|
||||
.endif
|
||||
.hword \ry
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# 0x11: Create translation scene graph node with optional display list
|
||||
# 0x01: u8 params
|
||||
# 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
# 0b0000_1111: drawingLayer
|
||||
# 0x02: s16 translationX
|
||||
# 0x04: s16 translationY
|
||||
# 0x06: s16 translationZ
|
||||
# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
.macro geo_translate_node layer, ux, uy, uz, displayList=0
|
||||
.byte 0x11
|
||||
.if (\displayList != 0)
|
||||
.byte 0x80 | \layer
|
||||
.else
|
||||
.byte 0x00
|
||||
.endif
|
||||
.hword \ux, \uy, \uz
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# 0x12: Create rotation scene graph node with optional display list
|
||||
# 0x01: u8 params
|
||||
# 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
# 0b0000_1111: drawingLayer
|
||||
# 0x02: s16 rotationX
|
||||
# 0x04: s16 rotationY
|
||||
# 0x06: s16 rotationZ
|
||||
# 0x08: [u32 displayList: if MSbit of params set, display list segmented address]
|
||||
.macro geo_rotation_node layer, ux, uy, uz, displayList=0
|
||||
.byte 0x12
|
||||
.if (\displayList != 0)
|
||||
.byte 0x80 | \layer
|
||||
.else
|
||||
.byte 0x00
|
||||
.endif
|
||||
.hword \ux, \uy, \uz
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# 0x13: Create a scene graph node that is rotated by the object's animation.
|
||||
# 0x01: u8 drawingLayer
|
||||
# 0x02: s16 xTranslation
|
||||
# 0x04: s16 yTranslation
|
||||
# 0x06: s16 zTranslation
|
||||
# 0x08: u32 displayList: dislay list segmented address
|
||||
.macro geo_animated_part layer, x, y, z, displayList=0
|
||||
.byte 0x13, \layer
|
||||
.hword \x, \y, \z
|
||||
.word \displayList
|
||||
.endm
|
||||
|
||||
# 0x14: Create billboarding node with optional display list
|
||||
# 0x01: u8 params
|
||||
# 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
# 0b0000_1111: drawingLayer
|
||||
# 0x02: s16 xTranslation
|
||||
# 0x04: s16 yTranslation
|
||||
# 0x06: s16 zTranslation
|
||||
# 0x08: [u32 displayList: if MSbit of params is set, display list segmented address]
|
||||
.macro geo_billboard layer=0, tx=0, ty=0, tz=0, displayList=0
|
||||
.byte 0x14
|
||||
.if (\displayList != 0)
|
||||
.byte 0x80 | \layer
|
||||
.else
|
||||
.byte 0x00
|
||||
.endif
|
||||
.hword \tx, \ty, \tz
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# 0x15: Create plain display list scene graph node
|
||||
# 0x01: u8 drawingLayer
|
||||
# 0x02=0x03: unused
|
||||
# 0x04: u32 displayList: display list segmented address
|
||||
.macro geo_display_list layer, displayList
|
||||
.byte 0x15, \layer, 0x00, 0x00
|
||||
.word \displayList
|
||||
.endm
|
||||
|
||||
# 0x16: Create shadow scene graph node
|
||||
# 0x01: unused
|
||||
# 0x02: s16 shadowType (cast to u8)
|
||||
# 0x04: s16 shadowSolidity (cast to u8)
|
||||
# 0x06: s16 shadowScale
|
||||
.set SHADOW_CIRCLE_9_VERTS, 0x00
|
||||
.set SHADOW_CIRCLE_4_VERTS, 0x01
|
||||
.set SHADOW_CIRCLE_4_VERTS_FLAT_UNUSED, 0x02 # unused shadow type
|
||||
.set SHADOW_SQUARE_PERMANENT, 0x0A # square shadow that never disappears
|
||||
.set SHADOW_SQUARE_SCALABLE, 0x0B # square shadow, shrinks with distance
|
||||
.set SHADOW_SQUARE_TOGGLABLE, 0x0C # square shadow, disappears with distance
|
||||
.set SHADOW_CIRCLE_PLAYER, 0x63 # player (Mario) shadow
|
||||
.set SHADOW_RECTANGLE_HARDCODED_OFFSET, 0x32 # offset of hard-coded shadows
|
||||
.macro geo_shadow type, solidity, scale
|
||||
.byte 0x16, 0x00
|
||||
.hword \type, \solidity, \scale
|
||||
.endm
|
||||
|
||||
# 0x17: TODO Create render object scene graph node
|
||||
# 0x01-0x03: unused
|
||||
.macro geo_render_obj
|
||||
.byte 0x17, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x18: Create dynamically generated displaylist scene graph node
|
||||
# 0x01: unused
|
||||
# 0x02: s16 parameter
|
||||
# 0x04: GraphNodeFunc function
|
||||
.macro geo_asm param, function
|
||||
.byte 0x18, 0x00
|
||||
.hword \param
|
||||
.word \function
|
||||
.endm
|
||||
|
||||
# 0x19: Create background scene graph node
|
||||
# 0x02: s16 background: background ID, or RGBA5551 color if backgroundFunc is null
|
||||
# 0x04: GraphNodeFunc backgroundFunc
|
||||
.macro geo_background param, function=0
|
||||
.byte 0x19, 0x00
|
||||
.hword \param
|
||||
.word \function
|
||||
.endm
|
||||
|
||||
# 0x1A: No operation
|
||||
.macro geo_nop_1A
|
||||
.byte 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x1B: Copy the shared children from an object parent node from a specific view
|
||||
# to a newly created object parent.
|
||||
# 0x02: s16 index of array
|
||||
.macro geo_copy_view param
|
||||
.byte 0x1B, 0x00
|
||||
.hword \param
|
||||
.endm
|
||||
|
||||
# 0x1C: Create a held object scene graph node
|
||||
# cmd+0x01: u8 unused
|
||||
# cmd+0x02: s16 offsetX
|
||||
# cmd+0x04: s16 offsetY
|
||||
# cmd+0x06: s16 offsetZ
|
||||
# cmd+0x08: GraphNodeFunc nodeFunc
|
||||
.macro geo_held_object param, ux, uy, uz, nodeFunc
|
||||
.byte 0x1C, \param
|
||||
.hword \ux, \uy, \uz
|
||||
.word \nodeFunc
|
||||
.endm
|
||||
|
||||
# 0x1D: Create scale scene graph node with optional display list
|
||||
# 0x01: u8 params
|
||||
# 0b1000_0000: if set, enable displayList field and drawingLayer
|
||||
# 0b0000_1111: drawingLayer
|
||||
# 0x02-0x03: unused
|
||||
# 0x04: u32 scale (0x10000 = 1.0)
|
||||
# 0x08: [u32 displayList: if MSbit of params is set, display list segment address]
|
||||
.macro geo_scale layer, scale, displayList=0
|
||||
.byte 0x1D
|
||||
.if (\displayList != 0)
|
||||
.byte 0x80 | \layer
|
||||
.else
|
||||
.byte 0x00
|
||||
.endif
|
||||
.byte 0x00, 0x00
|
||||
.word32 \scale
|
||||
.if (\displayList != 0)
|
||||
.word \displayList
|
||||
.endif
|
||||
.endm
|
||||
|
||||
# 0x1E: No operation
|
||||
.macro geo_nop_1E
|
||||
.byte 0x1E, 0x00, 0x00, 0x00
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x1F: No operation
|
||||
.macro geo_nop_1F
|
||||
.byte 0x1F, 0x00, 0x00, 0x00
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
.byte 0x00, 0x00, 0x00, 0x00
|
||||
.endm
|
||||
|
||||
# 0x20: Create a scene graph node that specifies for an object the radius that
|
||||
# is used for frustum culling.
|
||||
# 0x01: unused
|
||||
# 0x02: s16 cullingRadius
|
||||
.macro geo_culling_radius cullingRadius
|
||||
.byte 0x20, 0x00
|
||||
.hword \cullingRadius
|
||||
.endm
|
||||
276
include/level_commands.h
Normal file
276
include/level_commands.h
Normal file
@@ -0,0 +1,276 @@
|
||||
#ifndef LEVEL_COMMANDS_H
|
||||
#define LEVEL_COMMANDS_H
|
||||
|
||||
#include "command_macros_base.h"
|
||||
|
||||
#define OP_AND 0
|
||||
#define OP_NAND 1
|
||||
#define OP_EQ 2
|
||||
#define OP_NEQ 3
|
||||
#define OP_LT 4
|
||||
#define OP_LEQ 5
|
||||
#define OP_GT 6
|
||||
#define OP_GEQ 7
|
||||
|
||||
#define OP_SET 0
|
||||
#define OP_GET 1
|
||||
|
||||
#define VAR_CURR_SAVE_FILE_NUM 0
|
||||
#define VAR_CURR_COURSE_NUM 1
|
||||
#define VAR_CURR_ACT_NUM 2
|
||||
#define VAR_CURR_LEVEL_NUM 3
|
||||
#define VAR_CURR_AREA_INDEX 4
|
||||
|
||||
#define WARP_CHECKPOINT 0x80
|
||||
#define WARP_NO_CHECKPOINT 0x00
|
||||
|
||||
#define WHIRLPOOL_COND_ALWAYS 0
|
||||
#define WHIRLPOOL_COND_BOWSER2_BEATEN 2
|
||||
#define WHIRLPOOL_COND_AT_LEAST_SECOND_STAR 3
|
||||
|
||||
// Head defines
|
||||
#define REGULAR_FACE 0x0002
|
||||
#define DIZZY_FACE 0x0003
|
||||
|
||||
#define EXECUTE(seg, script, scriptEnd, entry) \
|
||||
CMD_BBH(0x00, 0x10, seg), \
|
||||
CMD_PTR(script), \
|
||||
CMD_PTR(scriptEnd), \
|
||||
CMD_PTR(entry)
|
||||
|
||||
#define EXIT_AND_EXECUTE(seg, script, scriptEnd, entry) \
|
||||
CMD_BBH(0x01, 0x10, seg), \
|
||||
CMD_PTR(script), \
|
||||
CMD_PTR(scriptEnd), \
|
||||
CMD_PTR(entry)
|
||||
|
||||
#define EXIT() \
|
||||
CMD_BBH(0x02, 0x04, 0x0000)
|
||||
|
||||
#define SLEEP(frames) \
|
||||
CMD_BBH(0x03, 0x04, frames)
|
||||
|
||||
#define SLEEP_BEFORE_EXIT(frames) \
|
||||
CMD_BBH(0x04, 0x04, frames)
|
||||
|
||||
#define JUMP(target) \
|
||||
CMD_BBH(0x05, 0x08, 0x0000), \
|
||||
CMD_PTR(target)
|
||||
|
||||
#define JUMP_LINK(target) \
|
||||
CMD_BBH(0x06, 0x08, 0x0000), \
|
||||
CMD_PTR(target)
|
||||
|
||||
#define RETURN() \
|
||||
CMD_BBH(0x07, 0x04, 0x0000)
|
||||
|
||||
#define JUMP_LINK_PUSH_ARG(arg) \
|
||||
CMD_BBH(0x08, 0x04, arg)
|
||||
|
||||
#define JUMP_N_TIMES() \
|
||||
CMD_BBH(0x09, 0x04, 0x0000)
|
||||
|
||||
#define LOOP_BEGIN() \
|
||||
CMD_BBH(0x0A, 0x04, 0x0000)
|
||||
|
||||
#define LOOP_UNTIL(op, arg) \
|
||||
CMD_BBBB(0x0B, 0x08, op, 0x00), \
|
||||
CMD_W(arg)
|
||||
|
||||
#define JUMP_IF(op, arg, target) \
|
||||
CMD_BBBB(0x0C, 0x0C, op, 0x00), \
|
||||
CMD_W(arg), \
|
||||
CMD_PTR(target)
|
||||
|
||||
#define JUMP_LINK_IF(op, arg, target) \
|
||||
CMD_BBBB(0x0D, 0x0C, op, 0x00), \
|
||||
CMD_W(arg), \
|
||||
CMD_PTR(target)
|
||||
|
||||
|
||||
#define SKIP_IF(op, arg) \
|
||||
CMD_BBBB(0x0E, 0x08, op, 0) \
|
||||
CMD_W(arg)
|
||||
|
||||
#define SKIP() \
|
||||
CMD_BBH(0x0F, 0x04, 0x0000)
|
||||
|
||||
#define SKIP_NOP() \
|
||||
CMD_BBH(0x10, 0x04, 0x0000)
|
||||
|
||||
#define CALL(arg, func) \
|
||||
CMD_BBH(0x11, 0x08, arg), \
|
||||
CMD_PTR(func)
|
||||
|
||||
#define CALL_LOOP(arg, func) \
|
||||
CMD_BBH(0x12, 0x08, arg), \
|
||||
CMD_PTR(func)
|
||||
|
||||
#define SET_REG(value) \
|
||||
CMD_BBH(0x13, 0x04, value)
|
||||
|
||||
#define PUSH_POOL() \
|
||||
CMD_BBH(0x14, 0x04, 0x0000)
|
||||
|
||||
#define POP_POOL() \
|
||||
CMD_BBH(0x15, 0x04, 0x0000)
|
||||
|
||||
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
|
||||
CMD_BBH(0x16, 0x10, 0x0000), \
|
||||
CMD_PTR(loadAddr), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
|
||||
#define LOAD_RAW(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x17, 0x0C, seg), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
|
||||
#define LOAD_MIO0(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x18, 0x0C, seg), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
|
||||
#define LOAD_MARIO_HEAD(sethead) \
|
||||
CMD_BBH(0x19, 0x04, sethead)
|
||||
|
||||
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
|
||||
CMD_BBH(0x1A, 0x0C, seg), \
|
||||
CMD_PTR(romStart), \
|
||||
CMD_PTR(romEnd)
|
||||
|
||||
#define INIT_LEVEL() \
|
||||
CMD_BBH(0x1B, 0x04, 0x0000)
|
||||
|
||||
#define CLEAR_LEVEL() \
|
||||
CMD_BBH(0x1C, 0x04, 0x0000)
|
||||
|
||||
#define ALLOC_LEVEL_POOL() \
|
||||
CMD_BBH(0x1D, 0x04, 0x0000)
|
||||
|
||||
#define FREE_LEVEL_POOL() \
|
||||
CMD_BBH(0x1E, 0x04, 0x0000)
|
||||
|
||||
#define AREA(index, geo) \
|
||||
CMD_BBBB(0x1F, 0x08, index, 0), \
|
||||
CMD_PTR(geo)
|
||||
|
||||
#define END_AREA() \
|
||||
CMD_BBH(0x20, 0x04, 0x0000)
|
||||
|
||||
#define LOAD_MODEL_FROM_DL(model, dl, layer) \
|
||||
CMD_BBH(0x21, 0x08, ((layer << 12) | model)), \
|
||||
CMD_PTR(dl)
|
||||
|
||||
#define LOAD_MODEL_FROM_GEO(model, geo) \
|
||||
CMD_BBH(0x22, 0x08, model), \
|
||||
CMD_PTR(geo)
|
||||
|
||||
// unk8 is float, but doesn't really matter since CMD23 is unused
|
||||
#define CMD23(model, unk4, unk8) \
|
||||
CMD_BBH(0x22, 0x08, model), \
|
||||
CMD_PTR(unk4), \
|
||||
CMD_W(unk8)
|
||||
|
||||
#define OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, acts) \
|
||||
CMD_BBBB(0x24, 0x18, acts, model), \
|
||||
CMD_HHHHHH(posX, posY, posZ, angleX, angleY, angleZ), \
|
||||
CMD_W(behParam), \
|
||||
CMD_PTR(beh)
|
||||
|
||||
#define OBJECT(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh) \
|
||||
OBJECT_WITH_ACTS(model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, 0x1F)
|
||||
|
||||
#define MARIO(unk3, behArg, beh) \
|
||||
CMD_BBBB(0x25, 0x0C, 0x00, unk3), \
|
||||
CMD_W(behArg), \
|
||||
CMD_PTR(beh)
|
||||
|
||||
#define WARP_NODE(id, destLevel, destArea, destNode, flags) \
|
||||
CMD_BBBB(0x26, 0x08, id, destLevel), \
|
||||
CMD_BBBB(destArea, destNode, flags, 0x00)
|
||||
|
||||
#define PAINTING_WARP_NODE(id, destLevel, destArea, destNode, flags) \
|
||||
CMD_BBBB(0x27, 0x08, id, destLevel), \
|
||||
CMD_BBBB(destArea, destNode, flags, 0x00)
|
||||
|
||||
#define INSTANT_WARP(index, destArea, displaceX, displaceY, displaceZ) \
|
||||
CMD_BBBB(0x28, 0x0C, index, destArea), \
|
||||
CMD_HH(displaceX, displaceY), \
|
||||
CMD_HH(displaceZ, 0x0000)
|
||||
|
||||
#define LOAD_AREA(area) \
|
||||
CMD_BBBB(0x29, 0x04, area, 0x00)
|
||||
|
||||
#define CMD2A(unk2) \
|
||||
CMD_BBBB(0x2A, 0x04, unk2, 0x00)
|
||||
|
||||
#define MARIO_POS(area, yaw, posX, posY, posZ) \
|
||||
CMD_BBBB(0x2B, 0x0C, area, 0x00), \
|
||||
CMD_HH(yaw, posX), \
|
||||
CMD_HH(posY, posZ)
|
||||
|
||||
// unused
|
||||
#define CMD2C() \
|
||||
CMD_BBH(0x2C, 0x04, 0x0000)
|
||||
|
||||
// unused
|
||||
#define CMD2D() \
|
||||
CMD_BBH(0x2D, 0x04, 0x0000)
|
||||
|
||||
#define TERRAIN(terrainData) \
|
||||
CMD_BBH(0x2E, 0x08, 0x0000), \
|
||||
CMD_PTR(terrainData)
|
||||
|
||||
#define ROOMS(surfaceRooms) \
|
||||
CMD_BBH(0x2F, 0x08, 0x0000), \
|
||||
CMD_PTR(surfaceRooms)
|
||||
|
||||
#define SHOW_DIALOG(index, dialogId) \
|
||||
CMD_BBBB(0x30, 0x04, index, dialogId)
|
||||
|
||||
#define TERRAIN_TYPE(terrainType) \
|
||||
CMD_BBH(0x31, 0x04, terrainType)
|
||||
|
||||
#define NOP() \
|
||||
CMD_BBH(0x32, 0x04, 0x0000)
|
||||
|
||||
#define TRANSITION(transType, time, colorR, colorG, colorB) \
|
||||
CMD_BBBB(0x33, 0x08, transType, time), \
|
||||
CMD_BBBB(colorR, colorG, colorB, 0x00)
|
||||
|
||||
#define BLACKOUT(active) \
|
||||
CMD_BBBB(0x34, 0x04, active, 0x00)
|
||||
|
||||
#define GAMMA(enabled) \
|
||||
CMD_BBBB(0x35, 0x04, enabled, 0x00)
|
||||
|
||||
#define SET_BACKGROUND_MUSIC(settingsPreset, seq) \
|
||||
CMD_BBH(0x36, 0x08, settingsPreset), \
|
||||
CMD_HH(seq, 0x0000)
|
||||
|
||||
#define SET_MENU_MUSIC(seq) \
|
||||
CMD_BBH(0x37, 0x04, seq)
|
||||
|
||||
#define STOP_MUSIC(fadeOutTime) \
|
||||
CMD_BBH(0x38, 0x04, fadeOutTime)
|
||||
|
||||
#define MACRO_OBJECTS(objList) \
|
||||
CMD_BBH(0x39, 0x08, 0x0000), \
|
||||
CMD_PTR(objList)
|
||||
|
||||
// unused
|
||||
#define CMD3A(unk2, unk4, unk6, unk8, unk10) \
|
||||
CMD_BBH(0x3A, 0x0C, unk2), \
|
||||
CMD_HH(unk6, unk8), \
|
||||
CMD_HH(unk10, 0x0000)
|
||||
|
||||
#define WHIRLPOOL(index, condition, posX, posY, posZ, strength) \
|
||||
CMD_BBBB(0x3B, 0x0C, index, condition), \
|
||||
CMD_HH(posX, posY), \
|
||||
CMD_HH(posZ, strength)
|
||||
|
||||
#define GET_OR_SET(op, var) \
|
||||
CMD_BBBB(0x3C, 0x04, op, var)
|
||||
|
||||
#endif
|
||||
@@ -1,415 +0,0 @@
|
||||
.include "model_ids.inc"
|
||||
.include "seq_ids.inc"
|
||||
|
||||
.set OP_AND, 0
|
||||
.set OP_NAND, 1
|
||||
.set OP_EQ, 2
|
||||
.set OP_NEQ, 3
|
||||
.set OP_LT, 4
|
||||
.set OP_LEQ, 5
|
||||
.set OP_GT, 6
|
||||
.set OP_GEQ, 7
|
||||
|
||||
.set OP_SET, 0
|
||||
.set OP_GET, 1
|
||||
|
||||
.set VAR_CURR_SAVE_FILE_NUM, 0
|
||||
.set VAR_CURR_COURSE_NUM, 1
|
||||
.set VAR_CURR_ACT_NUM, 2
|
||||
.set VAR_CURR_LEVEL_NUM, 3
|
||||
.set VAR_CURR_AREA_INDEX, 4
|
||||
|
||||
|
||||
.macro execute seg, script, scriptEnd, entry
|
||||
.byte 0x00, 0x04 + 3 * PTR_WIDTH
|
||||
.hword \seg
|
||||
.word \script
|
||||
.word \scriptEnd
|
||||
.word \entry
|
||||
.endm
|
||||
|
||||
.macro exit_and_execute seg, script, scriptEnd, entry
|
||||
.byte 0x01, 0x04 + 3 * PTR_WIDTH
|
||||
.hword \seg
|
||||
.word \script
|
||||
.word \scriptEnd
|
||||
.word \entry
|
||||
.endm
|
||||
|
||||
.macro exit
|
||||
.byte 0x02, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro sleep frames
|
||||
.byte 0x03, 0x04
|
||||
.hword \frames
|
||||
.endm
|
||||
|
||||
.macro sleep_before_exit frames
|
||||
.byte 0x04, 0x04
|
||||
.hword \frames
|
||||
.endm
|
||||
|
||||
.macro jump target
|
||||
.byte 0x05, 0x04 + PTR_WIDTH
|
||||
.hword 0
|
||||
.word \target
|
||||
.endm
|
||||
|
||||
.macro jump_link target
|
||||
.byte 0x06, 0x04 + PTR_WIDTH
|
||||
.hword 0
|
||||
.word \target
|
||||
.endm
|
||||
|
||||
.macro return
|
||||
.byte 0x07, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro jump_link_push_arg arg
|
||||
.byte 0x08, 0x04
|
||||
.hword \arg
|
||||
.endm
|
||||
|
||||
.macro jump_n_times
|
||||
.byte 0x09, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro loop_begin
|
||||
.byte 0x0A, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro loop_until op, arg
|
||||
.byte 0x0B, 0x04 + PTR_WIDTH
|
||||
.byte \op
|
||||
.byte 0
|
||||
.word \arg
|
||||
.endm
|
||||
|
||||
.macro jump_if op, arg, target
|
||||
.byte 0x0C, 0x08 + PTR_WIDTH
|
||||
.byte \op
|
||||
.byte 0
|
||||
.word32 \arg
|
||||
.word \target
|
||||
.endm
|
||||
|
||||
.macro jump_link_if op, arg, target
|
||||
.byte 0x0D, 0x08 + PTR_WIDTH
|
||||
.byte \op
|
||||
.byte 0
|
||||
.word32 \arg
|
||||
.word \target
|
||||
.endm
|
||||
|
||||
.macro skip_if op, arg
|
||||
.byte 0x0E, 0x08
|
||||
.byte \op
|
||||
.byte 0
|
||||
.word32 \arg
|
||||
.endm
|
||||
|
||||
.macro skip
|
||||
.byte 0x0F, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro skip_nop
|
||||
.byte 0x10, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro call arg, func
|
||||
.byte 0x11, 0x04 + PTR_WIDTH
|
||||
.hword \arg
|
||||
.word \func
|
||||
.endm
|
||||
|
||||
.macro call_loop arg, func
|
||||
.byte 0x12, 0x04 + PTR_WIDTH
|
||||
.hword \arg
|
||||
.word \func
|
||||
.endm
|
||||
|
||||
.macro set_reg value
|
||||
.byte 0x13, 0x04
|
||||
.hword \value
|
||||
.endm
|
||||
|
||||
.macro push_pool
|
||||
.byte 0x14, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro pop_pool
|
||||
.byte 0x15, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro fixed_load loadAddr, romStart, romEnd
|
||||
.byte 0x16, 0x04 + 3 * PTR_WIDTH
|
||||
.hword 0
|
||||
.word \loadAddr
|
||||
.word \romStart
|
||||
.word \romEnd
|
||||
.endm
|
||||
|
||||
.macro load_raw seg, romStart, romEnd
|
||||
.byte 0x17, 0x04 + 2 * PTR_WIDTH
|
||||
.hword \seg
|
||||
.word \romStart
|
||||
.word \romEnd
|
||||
.endm
|
||||
|
||||
.macro load_mio0 seg, romStart, romEnd
|
||||
.byte 0x18, 0x04 + 2 * PTR_WIDTH
|
||||
.hword \seg
|
||||
.word \romStart
|
||||
.word \romEnd
|
||||
.endm
|
||||
|
||||
.macro load_mario_head sethead
|
||||
.byte 0x19, 0x04
|
||||
.hword \sethead
|
||||
.endm
|
||||
|
||||
.macro load_mio0_texture seg, romStart, romEnd
|
||||
.byte 0x1A, 0x04 + 2 * PTR_WIDTH
|
||||
.hword \seg
|
||||
.word \romStart
|
||||
.word \romEnd
|
||||
.endm
|
||||
|
||||
.macro init_level
|
||||
.byte 0x1B, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro clear_level
|
||||
.byte 0x1C, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro alloc_level_pool
|
||||
.byte 0x1D, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro free_level_pool
|
||||
.byte 0x1E, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro area index, geo
|
||||
.byte 0x1F, 0x04 + PTR_WIDTH
|
||||
.byte \index
|
||||
.byte 0
|
||||
.word \geo
|
||||
.endm
|
||||
|
||||
.macro end_area
|
||||
.byte 0x20, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro load_model_from_dl model, dl, layer
|
||||
.byte 0x21, 0x04 + PTR_WIDTH
|
||||
.hword (\layer << 12) | \model
|
||||
.word \dl
|
||||
.endm
|
||||
|
||||
.macro load_model_from_geo model, geo
|
||||
.byte 0x22, 0x04 + PTR_WIDTH
|
||||
.hword \model
|
||||
.word \geo
|
||||
.endm
|
||||
|
||||
.macro cmd23 model, unk4, unk8
|
||||
.byte 0x23, 0x08 + PTR_WIDTH
|
||||
.hword \model
|
||||
.word \unk4
|
||||
.float \unk8
|
||||
.endm
|
||||
|
||||
.macro object model, posX, posY, posZ, angleX, angleY, angleZ, behParam, beh, acts=0x1F
|
||||
.byte 0x24, 0x14 + PTR_WIDTH
|
||||
.byte \acts
|
||||
.byte \model
|
||||
.hword \posX
|
||||
.hword \posY
|
||||
.hword \posZ
|
||||
.hword \angleX
|
||||
.hword \angleY
|
||||
.hword \angleZ
|
||||
.word32 \behParam
|
||||
.word \beh
|
||||
.endm
|
||||
|
||||
.macro mario unk3, behArg, beh
|
||||
.byte 0x25, 0x08 + PTR_WIDTH
|
||||
.byte 0
|
||||
.byte \unk3
|
||||
.word32 \behArg
|
||||
.word \beh
|
||||
.endm
|
||||
|
||||
.macro warp_node id, destLevel, destArea, destNode, unk6
|
||||
.byte 0x26, 0x08
|
||||
.byte \id, \destLevel, \destArea, \destNode
|
||||
.hword \unk6
|
||||
.endm
|
||||
|
||||
.macro painting_warp_node id, destLevel, destArea, destNode, unk6
|
||||
.byte 0x27, 0x08
|
||||
.byte \id, \destLevel, \destArea, \destNode
|
||||
.hword \unk6
|
||||
.endm
|
||||
|
||||
.macro instant_warp index, destArea, displaceX, displaceY, displaceZ
|
||||
.byte 0x28, 0x0C
|
||||
.byte \index
|
||||
.byte \destArea
|
||||
.hword \displaceX
|
||||
.hword \displaceY
|
||||
.hword \displaceZ
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro load_area area
|
||||
.byte 0x29, 0x04
|
||||
.byte \area
|
||||
.byte 0
|
||||
.endm
|
||||
|
||||
.macro cmd2A unk2
|
||||
.byte 0x2A, 0x04
|
||||
.byte \unk2
|
||||
.byte 0
|
||||
.endm
|
||||
|
||||
.macro mario_pos area, yaw, posX, posY, posZ
|
||||
.byte 0x2B, 0x0C
|
||||
.byte \area
|
||||
.byte 0
|
||||
.hword \yaw
|
||||
.hword \posX
|
||||
.hword \posY
|
||||
.hword \posZ
|
||||
.endm
|
||||
|
||||
.macro cmd2C
|
||||
.byte 0x2C, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro cmd2D
|
||||
.byte 0x2D, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro terrain terrainData
|
||||
.byte 0x2E, 0x04 + PTR_WIDTH
|
||||
.hword 0
|
||||
.word \terrainData
|
||||
.endm
|
||||
|
||||
.macro rooms surfaceRooms
|
||||
.byte 0x2F, 0x04 + PTR_WIDTH
|
||||
.hword 0
|
||||
.word \surfaceRooms
|
||||
.endm
|
||||
|
||||
.macro show_dialog unk2, unk3
|
||||
.byte 0x30, 0x04
|
||||
.byte \unk2
|
||||
.byte \unk3
|
||||
.endm
|
||||
|
||||
.macro terrain_type terrainType
|
||||
.byte 0x31, 0x04
|
||||
.hword \terrainType
|
||||
.endm
|
||||
|
||||
.macro nop
|
||||
.byte 0x32, 0x04
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro transition unk2, unk3, colorR, colorG, colorB
|
||||
.byte 0x33, 0x08
|
||||
.byte \unk2
|
||||
.byte \unk3
|
||||
.byte \colorR
|
||||
.byte \colorG
|
||||
.byte \colorB
|
||||
.byte 0
|
||||
.endm
|
||||
|
||||
.macro blackout active
|
||||
.byte 0x34, 0x04
|
||||
.byte \active
|
||||
.byte 0
|
||||
.endm
|
||||
|
||||
.macro gamma enabled
|
||||
.byte 0x35, 0x04
|
||||
.byte \enabled
|
||||
.byte 0
|
||||
.endm
|
||||
|
||||
.macro set_background_music unk2, seq
|
||||
.byte 0x36, 0x08
|
||||
.hword \unk2
|
||||
.hword \seq
|
||||
.hword 0
|
||||
.endm
|
||||
|
||||
.macro set_menu_music seq
|
||||
.byte 0x37, 0x04
|
||||
.hword \seq
|
||||
.endm
|
||||
|
||||
.macro cmd38 unk2
|
||||
.byte 0x38, 0x04
|
||||
.hword \unk2
|
||||
.endm
|
||||
|
||||
.macro macro_objects objList
|
||||
.byte 0x39, 0x04 + PTR_WIDTH
|
||||
.hword 0
|
||||
.word \objList
|
||||
.endm
|
||||
|
||||
.macro cmd3A unk2, unk4, unk6, unk8, unk10
|
||||
.byte 0x3A, 0x0C
|
||||
.hword \unk2
|
||||
.hword \unk4
|
||||
.hword \unk6
|
||||
.hword \unk8
|
||||
.hword \unk10
|
||||
.endm
|
||||
|
||||
.macro whirlpool unk2, unk3, posX, posY, posZ, strength
|
||||
.byte 0x3B, 0x0C
|
||||
.byte \unk2
|
||||
.byte \unk3
|
||||
.hword \posX
|
||||
.hword \posY
|
||||
.hword \posZ
|
||||
.hword \strength
|
||||
.endm
|
||||
|
||||
.macro get_or_set op, var
|
||||
.byte 0x3C, 0x04
|
||||
.byte \op
|
||||
.byte \var
|
||||
.endm
|
||||
|
||||
/* Head Defines */
|
||||
|
||||
.set REGULAR_FACE, 0x0002
|
||||
.set DIZZY_FACE, 0x0003
|
||||
28
include/level_misc_macros.h
Normal file
28
include/level_misc_macros.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef LEVEL_MISC_MACROS_H
|
||||
#define LEVEL_MISC_MACROS_H
|
||||
|
||||
#define MACRO_OBJECT_WITH_BEH_PARAM(preset, yaw, posX, posY, posZ, behParam) \
|
||||
(((yaw * 0x10 / 45) << 9) | (preset + 0x1F)), posX, posY, posZ, behParam
|
||||
|
||||
#define MACRO_OBJECT(preset, yaw, posX, posY, posZ) \
|
||||
MACRO_OBJECT_WITH_BEH_PARAM(preset, yaw, posX, posY, posZ, 0)
|
||||
|
||||
#define MACRO_OBJECT_END() \
|
||||
0x001E
|
||||
|
||||
#define SPECIAL_OBJECT(preset, posX, posY, posZ) \
|
||||
preset, posX, posY, posZ
|
||||
|
||||
#define SPECIAL_OBJECT_WITH_YAW(preset, posX, posY, posZ, yaw) \
|
||||
preset, posX, posY, posZ, yaw
|
||||
|
||||
#define SPECIAL_OBJECT_WITH_YAW_AND_PARAM(preset, posX, posY, posZ, yaw, param) \
|
||||
preset, posX, posY, posZ, yaw, param
|
||||
|
||||
#define TRAJECTORY_POS(trajId, x, y, z) \
|
||||
trajId, x, y, z
|
||||
|
||||
#define TRAJECTORY_END() \
|
||||
-1
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef _MATH_H_
|
||||
#define _MATH_H_
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#ifndef _STDARG_H_
|
||||
#define _STDARG_H_
|
||||
#ifndef STDARG_H
|
||||
#define STDARG_H
|
||||
|
||||
#include <ultra64.h>
|
||||
|
||||
// When building with GCC, use the official vaarg macros to avoid warnings
|
||||
// and possibly bad codegen.
|
||||
#ifdef __GNUC__
|
||||
// When not building with IDO, use the builtin vaarg macros for portability.
|
||||
#ifndef __sgi
|
||||
#define va_list __builtin_va_list
|
||||
#define va_start __builtin_va_start
|
||||
#define va_arg __builtin_va_arg
|
||||
10
include/libc/stddef.h
Normal file
10
include/libc/stddef.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef STDDEF_H
|
||||
#define STDDEF_H
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(st, m) ((size_t)&(((st *)0)->m))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
6
include/libc/stdio.h
Normal file
6
include/libc/stdio.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef STDIO_H
|
||||
#define STDIO_H
|
||||
|
||||
extern int sprintf(char *s, const char *fmt, ...);
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef _STDLIB_H_
|
||||
#define _STDLIB_H_
|
||||
#ifndef STDLIB_H
|
||||
#define STDLIB_H
|
||||
|
||||
typedef struct lldiv_t
|
||||
{
|
||||
@@ -13,7 +13,7 @@ typedef struct ldiv_t
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
lldiv_t lldiv(long long, long long);
|
||||
ldiv_t ldiv(long, long);
|
||||
lldiv_t lldiv(long long num, long long denom);
|
||||
ldiv_t ldiv(long num, long denom);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user