Refresh 10

This commit is contained in:
n64
2020-06-02 12:44:34 -04:00
parent e58669b4b3
commit d43d9b7f20
444 changed files with 30163 additions and 7628 deletions
+3 -3
View File
@@ -391,7 +391,7 @@ typedef short ENVMIX_STATE[40];
* First call:
* aSetBuffer(cmd++, 0, 0, output, count)
*
* The count refers to the size of the output.
* The count refers to the size of each input. Hence 2 * count bytes will be written out.
* A left sample will be placed before the right sample.
*
* Note: count will be rounded up to the nearest multiple of 16 bytes.
@@ -472,7 +472,7 @@ typedef short ENVMIX_STATE[40];
* 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
* Note: count represents the number of output sample bytes 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
@@ -484,7 +484,7 @@ typedef short ENVMIX_STATE[40];
* 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
* When "count" bytes 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) \
+84 -1
View File
@@ -87,6 +87,13 @@
*
*/
#ifdef F3DEX_GBI_2E
# ifndef F3DEX_GBI_2
# define F3DEX_GBI_2
# endif
# define GBI_FLOATS
#endif
#ifdef F3DEX_GBI_2
# ifndef F3DEX_GBI
# define F3DEX_GBI
@@ -1103,7 +1110,11 @@
* Vertex (set up for use with colors)
*/
typedef struct {
#ifndef GBI_FLOATS
short ob[3]; /* x, y, z */
#else
float ob[3]; /* x, y, z */
#endif
unsigned short flag;
short tc[2]; /* texture coord */
unsigned char cn[4]; /* color & alpha */
@@ -1113,7 +1124,11 @@ typedef struct {
* Vertex (set up for use with normals)
*/
typedef struct {
#ifndef GBI_FLOATS
short ob[3]; /* x, y, z */
#else
float ob[3]; /* x, y, z */
#endif
unsigned short flag;
short tc[2]; /* texture coord */
signed char n[3]; /* normal */
@@ -1162,6 +1177,7 @@ typedef struct {
unsigned char v[3];
} Tri;
#ifndef GBI_FLOATS
/*
* 4x4 matrix, fixed point s15.16 format.
* First 8 words are integer portion of the 4x4 matrix
@@ -1173,6 +1189,11 @@ typedef union {
Mtx_t m;
long long int force_structure_alignment;
} Mtx;
#else
typedef struct {
float m[4][4];
} Mtx;
#endif
/*
* Viewport
@@ -4396,6 +4417,26 @@ typedef union {
}}
/* Fraction never used in fill */
#ifdef F3DEX_GBI_2E
#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \
{ \
Gfx *_g0 = (Gfx *)(pkt), *_g1 = (Gfx *)(pkt); \
_g0->words.w0 = _SHIFTL(G_FILLRECT, 24, 8) | \
_SHIFTL((lrx), 2, 22); \
_g0->words.w1 = _SHIFTL((lry), 2, 22); \
_g1->words.w0 = _SHIFTL((ulx), 2, 22); \
_g1->words.w1 = _SHIFTL((uly), 2, 22); \
}
#define gsDPFillRectangle(ulx, uly, lrx, lry) \
{{ \
(_SHIFTL(G_FILLRECT, 24, 8) | _SHIFTL((lrx), 2, 22)), \
_SHIFTL((lry), 2, 22), \
}}, \
{{ \
_SHIFTL((ulx), 2, 22), \
_SHIFTL((uly), 2, 22), \
}}
#else
#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \
{ \
Gfx *_g = (Gfx *)(pkt); \
@@ -4404,15 +4445,16 @@ typedef union {
_SHIFTL((lrx), 14, 10) | _SHIFTL((lry), 2, 10));\
_g->words.w1 = (_SHIFTL((ulx), 14, 10) | _SHIFTL((uly), 2, 10));\
}
#define gsDPFillRectangle(ulx, uly, lrx, lry) \
{{ \
(_SHIFTL(G_FILLRECT, 24, 8) | _SHIFTL((lrx), 14, 10) | \
_SHIFTL((lry), 2, 10)), \
(_SHIFTL((ulx), 14, 10) | _SHIFTL((uly), 2, 10)) \
}}
#endif
/* like gDPFillRectangle but accepts negative arguments */
#ifndef F3DEX_GBI_2E
#define gDPScisFillRectangle(pkt, ulx, uly, lrx, lry) \
{ \
Gfx *_g = (Gfx *)(pkt); \
@@ -4423,6 +4465,7 @@ typedef union {
_g->words.w1 = (_SHIFTL(MAX((ulx),0), 14, 10) | \
_SHIFTL(MAX((uly),0), 2, 10)); \
}
#endif
#define gDPSetConvert(pkt, k0, k1, k2, k3, k4, k5) \
{ \
@@ -4620,6 +4663,46 @@ typedef union {
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))); \
}
#elif defined(F3DEX_GBI_2E)
# define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
{ \
Gfx *_g0 = (Gfx *)(pkt), *_g1 = (Gfx *)(pkt), *_g2 = (Gfx *)(pkt); \
\
_g0->words.w0 = _SHIFTL(G_TEXRECT, 24, 8) | \
_SHIFTL((xh), 0, 24); \
_g0->words.w1 = _SHIFTL((yh), 0, 24); \
_g1->words.w0 = (_SHIFTL(tile, 24, 3) | _SHIFTL((xl), 0, 24)); \
_g1->words.w1 = _SHIFTL((yl), 0, 24); \
_g2->words.w0 = (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16)); \
_g2->words.w1 = (_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), 0, 24)), \
_SHIFTL((yh), 0, 24), \
}}, \
{{ \
(_SHIFTL((tile), 24, 3) | _SHIFTL((xl), 0, 24)), \
_SHIFTL((yl), 0, 24), \
}}, \
{{ \
_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16), \
_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16) \
}}
# define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
{ \
Gfx *_g0 = (Gfx *)(pkt), *_g1 = (Gfx *)(pkt), *_g2 = (Gfx *)(pkt); \
\
_g0->words.w0 = _SHIFTL(G_TEXRECTFLIP, 24, 8) | \
_SHIFTL((xh), 0, 24); \
_g0->words.w1 = _SHIFTL((yh), 0, 24); \
_g1->words.w0 = (_SHIFTL(tile, 24, 3) | _SHIFTL((xl), 0, 24)); \
_g1->words.w1 = _SHIFTL((yl), 0, 24); \
_g2->words.w0 = (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16)); \
_g2->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \
}
#else
# define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
{ \
+3 -3
View File
@@ -53,14 +53,14 @@ extern "C" {
typedef struct {
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errno;
u8 errnum;
}OSContStatus;
typedef struct {
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errno;
u8 errnum;
} OSContPad;
typedef struct {
@@ -68,7 +68,7 @@ typedef struct {
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errno;
u8 errnum;
} OSContRamIo;
+2
View File
@@ -37,6 +37,8 @@ typedef s32 intptr_t;
typedef s32 ptrdiff_t;
#else
#include <stddef.h>
#include <stdint.h>
typedef ptrdiff_t ssize_t;
#endif
#endif
+6 -6
View File
@@ -31,11 +31,11 @@
#define SOUND_NO_ECHO 0x20 // not in JP
#define SOUND_LO_BITFLAG_UNK8 0x80 // restart playing on each play_sound call?
/* Audio playback bitflags. TODO: Figure out what these mean and use them below. */
#define SOUND_PL_BITFLAG_UNK1 0x1000000
#define SOUND_PL_BITFLAG_UNK2 0x2000000
#define SOUND_PL_BITFLAG_UNK4 0x4000000
#define SOUND_PL_BITFLAG_UNK8 0x8000000
/* Audio playback bitflags. */
#define SOUND_NO_VOLUME_LOSS 0x1000000 // No volume loss with distance
#define SOUND_VIBRATO 0x2000000 // Randomly alter frequency each audio frame
#define SOUND_NO_PRIORITY_LOSS 0x4000000 // Do not prioritize closer sounds
#define SOUND_NO_FREQUENCY_LOSS 0x8000000 // Frequency scale does not change with distance
// silence
#define NO_SOUND 0
@@ -558,4 +558,4 @@
#define SOUND_OBJ2_BOSS_DIALOG_GRUNT SOUND_ARG_LOAD(9, 0, 0x69, 0x40, 8)
#define SOUND_OBJ2_MRI_SPINNING SOUND_ARG_LOAD(9, 0, 0x6B, 0x00, 8)
#endif /* AUDIO_DEFINES_H */
#endif // AUDIO_DEFINES_H
+15 -15
View File
@@ -1,5 +1,5 @@
#ifndef _BEHAVIOR_DATA_H
#define _BEHAVIOR_DATA_H
#ifndef BEHAVIOR_DATA_H
#define BEHAVIOR_DATA_H
#include "types.h"
@@ -302,20 +302,20 @@ extern const BehaviorScript bhvYellowBall[];
extern const BehaviorScript bhvMario[];
extern const BehaviorScript bhvToadMessage[];
extern const BehaviorScript bhvUnlockDoorStar[];
extern const BehaviorScript bhvWarps60[];
extern const BehaviorScript bhvWarps64[];
extern const BehaviorScript bhvWarps68[];
extern const BehaviorScript bhvWarps6C[];
extern const BehaviorScript bhvInstantActiveWarp[];
extern const BehaviorScript bhvAirborneWarp[];
extern const BehaviorScript bhvHardAirKnockBackWarp[];
extern const BehaviorScript bhvSpinAirborneCircleWarp[];
extern const BehaviorScript bhvDeathWarp[];
extern const BehaviorScript bhvWarps74[];
extern const BehaviorScript bhvWarps78[];
extern const BehaviorScript bhvWarps7C[];
extern const BehaviorScript bhvSpinAirborneWarp[];
extern const BehaviorScript bhvFlyingWarp[];
extern const BehaviorScript bhvPaintingStarCollectWarp[];
extern const BehaviorScript bhvPaintingDeathWarp[];
extern const BehaviorScript bhvWarps84[];
extern const BehaviorScript bhvWarps88[];
extern const BehaviorScript bhvWarps8C[];
extern const BehaviorScript bhvWarps90[];
extern const BehaviorScript bhvWarps94[];
extern const BehaviorScript bhvAirborneDeathWarp[];
extern const BehaviorScript bhvAirborneStarCollectWarp[];
extern const BehaviorScript bhvLaunchStarCollectWarp[];
extern const BehaviorScript bhvLaunchDeathWarp[];
extern const BehaviorScript bhvSwimmingWarp[];
extern const BehaviorScript bhvRandomAnimatedTexture[];
extern const BehaviorScript bhvYellowBackgroundInMenu[];
extern const BehaviorScript bhvMenuButton[];
@@ -543,4 +543,4 @@ extern const BehaviorScript bhvEndBirds2[];
extern const BehaviorScript bhvIntroScene[];
extern const BehaviorScript bhvUnusedFakeStar[];
#endif /* _BEHAVIOR_DATA_H */
#endif // BEHAVIOR_DATA_H
+1 -1
View File
@@ -25,4 +25,4 @@
#define CMD_HHHHHH(a, b, c, d, e, f) CMD_HH(a, b), CMD_HH(c, d), CMD_HH(e, f)
#endif
#endif // COMMAND_MACROS_BASE_H
+6 -1
View File
@@ -28,10 +28,15 @@
#define SCREEN_HEIGHT 240
// Border Height Define for NTSC Versions
#ifdef TARGET_N64
#ifndef VERSION_EU
#define BORDER_HEIGHT 8
#else
#define BORDER_HEIGHT 1
#endif
#else
// What's the point of having a border?
#define BORDER_HEIGHT 0
#endif
#endif // CONFIG_H
+5 -5
View File
@@ -1,5 +1,5 @@
#ifndef _COURSE_TABLE_H
#define _COURSE_TABLE_H
#ifndef COURSE_TABLE_H
#define COURSE_TABLE_H
// Start of the 3 cap courses in a row.
#define COURSE_CAP_COURSES COURSE_COTMC
@@ -15,8 +15,8 @@
enum CourseNum
{
#include "levels/course_defines.h"
COURSE_END, // To mark end + 1 for marking max and count.
// Todo: clean this up. This is still bad. Which
COURSE_END, // To mark end + 1 for marking max and count.
// TODO: clean this up. This is still bad. Which
// one is clearer? Need to get rid of one of these.
COURSE_MAX = COURSE_END - 1,
COURSE_COUNT = COURSE_MAX,
@@ -29,4 +29,4 @@ enum CourseNum
#define COURSE_IS_MAIN_COURSE(cmd) (cmd >= COURSE_MIN && cmd <= COURSE_STAGES_MAX)
#endif // _COURSE_TABLE_H
#endif // COURSE_TABLE_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef DIALOG_IDS
#define DIALOG_IDS
#ifndef DIALOG_IDS_H
#define DIALOG_IDS_H
enum DialogId {
DIALOG_000,
@@ -175,4 +175,4 @@ enum DialogId {
DIALOG_COUNT
};
#endif
#endif // DIALOG_IDS_H
+1 -11
View File
@@ -1,8 +1,6 @@
#ifndef EU_TRANSLATION_H
#define EU_TRANSLATION_H
#include "types.h"
// PAL changes most text to arrays for each language. This define allows these
// differences to be combined.
#ifdef VERSION_EU
@@ -11,14 +9,6 @@
#define LANGUAGE_ARRAY(cmd) cmd
#endif
// EU translations are contained in three segment 0x19 compressed data blocks
extern u8 _translation_en_mio0SegmentRomStart[];
extern u8 _translation_en_mio0SegmentRomEnd[];
extern u8 _translation_fr_mio0SegmentRomStart[];
extern u8 _translation_fr_mio0SegmentRomEnd[];
extern u8 _translation_de_mio0SegmentRomStart[];
extern u8 _translation_de_mio0SegmentRomEnd[];
extern void *dialog_table_eu_en[];
extern void *course_name_table_eu_en[];
extern void *act_name_table_eu_en[];
@@ -31,4 +21,4 @@ extern void *dialog_table_eu_de[];
extern void *course_name_table_eu_de[];
extern void *act_name_table_eu_de[];
#endif /* EU_TRANSLATION_H */
#endif // EU_TRANSLATION_H
+1 -1
View File
@@ -429,4 +429,4 @@
#define GEO_CULLING_RADIUS(cullingRadius) \
CMD_BBH(0x20, 0x00, cullingRadius)
#endif
#endif // GEO_COMMANDS_H
+41
View File
@@ -0,0 +1,41 @@
#ifndef GFX_DIMENSIONS_H
#define GFX_DIMENSIONS_H
/*
This file is for ports that want to enable widescreen.
Change the definitions to the following:
#include <math.h>
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (SCREEN_WIDTH / 2 - SCREEN_HEIGHT / 2 * [current_aspect_ratio] + (v))
#define GFX_DIMENSIONS_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH / 2 + SCREEN_HEIGHT / 2 * [current_aspect_ratio] - (v))
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) ((int)floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v)))
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ((int)ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v)))
#define GFX_DIMENSIONS_ASPECT_RATIO [current_aspect_ratio]
The idea is that SCREEN_WIDTH and SCREEN_HEIGHT are still hardcoded to 320 and 240, and that
x=0 lies at where a 4:3 left edge would be. On 16:9 widescreen, the left edge is hence at -53.33.
To get better accuracy, consider using floats instead of shorts for coordinates in Vertex and Matrix structures.
The conversion to integers above is for RECT commands which naturally only accept integer values.
Note that RECT commands must be enhanced to support negative coordinates with this modification.
*/
#ifdef WIDESCREEN
#error "widescreen not implemented"
#else
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (v)
#define GFX_DIMENSIONS_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH - (v))
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) (v)
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH - (v))
#define GFX_DIMENSIONS_ASPECT_RATIO (4.0f / 3.0f)
#endif
// If screen is taller than it is wide, radius should be equal to SCREEN_HEIGHT since we scale horizontally
#define GFX_DIMENSIONS_FULL_RADIUS (SCREEN_HEIGHT * (GFX_DIMENSIONS_ASPECT_RATIO > 1 ? GFX_DIMENSIONS_ASPECT_RATIO : 1))
#endif // GFX_DIMENSIONS_H
+3 -3
View File
@@ -1,6 +1,6 @@
#ifndef _HELPER_MACROS_H
#define _HELPER_MACROS_H
#ifndef HELPER_MACROS_H
#define HELPER_MACROS_H
#define LIST_NEXT_ITEM(curItem, type) ((type *)((s32)curItem + sizeof(type)))
#endif
#endif // HELPER_MACROS_H
+40 -1
View File
@@ -34,6 +34,19 @@
#define REGULAR_FACE 0x0002
#define DIZZY_FACE 0x0003
#ifdef NO_SEGMENTED_MEMORY
#define EXECUTE(seg, script, scriptEnd, entry) \
CMD_BBH(0x00, 0x10, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL), \
CMD_PTR(entry)
#define EXIT_AND_EXECUTE(seg, script, scriptEnd, entry) \
CMD_BBH(0x01, 0x10, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL), \
CMD_PTR(entry)
#else
#define EXECUTE(seg, script, scriptEnd, entry) \
CMD_BBH(0x00, 0x10, seg), \
CMD_PTR(script), \
@@ -45,6 +58,7 @@
CMD_PTR(script), \
CMD_PTR(scriptEnd), \
CMD_PTR(entry)
#endif
#define EXIT() \
CMD_BBH(0x02, 0x04, 0x0000)
@@ -117,6 +131,23 @@
#define POP_POOL() \
CMD_BBH(0x15, 0x04, 0x0000)
#ifdef NO_SEGMENTED_MEMORY
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
CMD_BBH(0x16, 0x10, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#define LOAD_RAW(seg, romStart, romEnd) \
CMD_BBH(0x17, 0x0C, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#define LOAD_MIO0(seg, romStart, romEnd) \
CMD_BBH(0x18, 0x0C, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#else
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
CMD_BBH(0x16, 0x10, 0x0000), \
CMD_PTR(loadAddr), \
@@ -132,14 +163,22 @@
CMD_BBH(0x18, 0x0C, seg), \
CMD_PTR(romStart), \
CMD_PTR(romEnd)
#endif
#define LOAD_MARIO_HEAD(sethead) \
CMD_BBH(0x19, 0x04, sethead)
#ifdef NO_SEGMENTED_MEMORY
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
CMD_BBH(0x1A, 0x0C, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#else
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
CMD_BBH(0x1A, 0x0C, seg), \
CMD_PTR(romStart), \
CMD_PTR(romEnd)
#endif
#define INIT_LEVEL() \
CMD_BBH(0x1B, 0x04, 0x0000)
@@ -275,4 +314,4 @@
#define GET_OR_SET(op, var) \
CMD_BBBB(0x3C, 0x04, op, var)
#endif
#endif // LEVEL_COMMANDS_H
+2 -2
View File
@@ -2,7 +2,7 @@
#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
((s16)((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)
@@ -25,4 +25,4 @@
#define TRAJECTORY_END() \
-1
#endif
#endif // LEVEL_MISC_MACROS_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef _LEVEL_TABLE_H
#define _LEVEL_TABLE_H
#ifndef LEVEL_TABLE_H
#define LEVEL_TABLE_H
// For LEVEL_NAME defines, see level_defines.h.
// Please include this file if you want to use them.
@@ -19,4 +19,4 @@ enum LevelNum
#undef STUB_LEVEL
#undef DEFINE_LEVEL
#endif // _LEVEL_TABLE_H
#endif // LEVEL_TABLE_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef _MACRO_PRESET_NAMES_H
#define _MACRO_PRESET_NAMES_H
#ifndef MACRO_PRESET_NAMES_H
#define MACRO_PRESET_NAMES_H
enum MacroPresets {
macro_yellow_coin,
@@ -370,4 +370,4 @@ enum MacroPresets {
macro_empty_365
};
#endif // _MACRO_PRESET_NAMES_H
#endif // MACRO_PRESET_NAMES_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef _MACRO_PRESETS_H
#define _MACRO_PRESETS_H
#ifndef MACRO_PRESETS_H
#define MACRO_PRESETS_H
#include "macro_preset_names.h"
#include "behavior_data.h"
@@ -381,4 +381,4 @@ struct MacroPreset MacroObjectPresets[] = {
{bhvYellowCoin, MODEL_YELLOW_COIN, 0}
};
#endif // _MACRO_PRESETS_H
#endif // MACRO_PRESETS_H
+17 -3
View File
@@ -1,5 +1,5 @@
#ifndef _MACROS_H_
#define _MACROS_H_
#ifndef MACROS_H
#define MACROS_H
#include "platform_info.h"
@@ -25,6 +25,13 @@
#define UNUSED
#endif
// Avoid undefined behaviour for non-returning functions
#ifdef __GNUC__
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
// Static assertions
#ifdef __GNUC__
#define STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
@@ -46,6 +53,7 @@
#define ALIGNED16
#endif
#ifndef NO_SEGMENTED_MEMORY
// convert a virtual address to physical.
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr) & 0x1FFFFFFF)
@@ -54,5 +62,11 @@
// another way of converting virtual to physical
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8 *)(addr) - 0x80000000U)
#else
// no conversion needed other than cast
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr))
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr))
#define VIRTUAL_TO_PHYSICAL2(addr) ((void *)(addr))
#endif
#endif // MACROS_H
+1 -1
View File
@@ -8,4 +8,4 @@
#define const
#endif
#endif
#endif // MAKE_CONST_NONCONST_H
+4 -4
View File
@@ -1,5 +1,5 @@
#ifndef _MARIO_ANIMATION_IDS_H
#define _MARIO_ANIMATION_IDS_H
#ifndef MARIO_ANIMATION_IDS_H
#define MARIO_ANIMATION_IDS_H
/* Mario Animation IDs */
@@ -208,7 +208,7 @@ enum MarioAnimID
/* 0xC8 */ MARIO_ANIM_WAKE_FROM_SLEEP,
/* 0xC9 */ MARIO_ANIM_WAKE_FROM_LYING,
/* 0xCA */ MARIO_ANIM_START_TIPTOE,
/* 0xCB */ MARIO_ANIM_SLIDEJUMP, // pole jump and wall kick
/* 0xCB */ MARIO_ANIM_SLIDEJUMP, // pole jump and wall kick
/* 0xCC */ MARIO_ANIM_START_WALLKICK,
/* 0xCD */ MARIO_ANIM_STAR_DANCE,
/* 0xCE */ MARIO_ANIM_RETURN_FROM_STAR_DANCE,
@@ -216,4 +216,4 @@ enum MarioAnimID
/* 0xD0 */ MARIO_ANIM_TRIPLE_JUMP_FLY
};
#endif /* _MARIO_ANIMATION_IDS_H */
#endif // MARIO_ANIMATION_IDS_H
+3 -4
View File
@@ -1,5 +1,5 @@
#ifndef _MARIO_GEO_SWITCH_CASE_IDS_H
#define _MARIO_GEO_SWITCH_CASE_IDS_H
#ifndef MARIO_GEO_SWITCH_CASE_IDS_H
#define MARIO_GEO_SWITCH_CASE_IDS_H
/* Mario Geo-Switch-Case IDs */
@@ -42,5 +42,4 @@ enum MarioGrabPosGSCId
/*0x03*/ GRAB_POS_BOWSER
};
#endif /* _MARIO_GEO_SWITCH_CASE_IDS_H */
#endif // MARIO_GEO_SWITCH_CASE_IDS_H
+4 -3
View File
@@ -1,5 +1,6 @@
#ifndef _MODEL_IDS_H
#define _MODEL_IDS_H
#ifndef MODEL_IDS_H
#define MODEL_IDS_H
#define ACT_1 (1 << 0)
#define ACT_2 (1 << 1)
#define ACT_3 (1 << 2)
@@ -585,4 +586,4 @@
#define MODEL_VCUTM_WARP_PIPE MODEL_LEVEL_GEOMETRY_16 // warp_pipe_geo
#define MODEL_CASTLE_GROUNDS_WARP_PIPE MODEL_LEVEL_GEOMETRY_16 // warp_pipe_geo
#endif
#endif // MODEL_IDS_H
+1 -1
View File
@@ -69,4 +69,4 @@
#define MOV_TEX_ROT_END() \
0, 0
#endif
#endif // MOVING_TEXTURE_MACROS_H
+10 -10
View File
@@ -1,10 +1,11 @@
#ifndef _OBJECT_CONSTANTS_H
#define _OBJECT_CONSTANTS_H
#ifndef OBJECT_CONSTANTS_H
#define OBJECT_CONSTANTS_H
// This file contains macros that provide descriptive names for
// field-specific and object-specific constants, e.g. actions.
/* activeFlags */
#define ACTIVE_FLAG_DEACTIVATED 0 // 0x0000
#define ACTIVE_FLAG_ACTIVE (1 << 0) // 0x0001
#define ACTIVE_FLAG_FAR_AWAY (1 << 1) // 0x0002
#define ACTIVE_FLAG_UNK2 (1 << 2) // 0x0004
@@ -12,12 +13,11 @@
#define ACTIVE_FLAG_UNIMPORTANT (1 << 4) // 0x0010
#define ACTIVE_FLAG_INITIATED_TIME_STOP (1 << 5) // 0x0020
#define ACTIVE_FLAG_MOVE_THROUGH_GRATE (1 << 6) // 0x0040
#define ACTIVE_FLAG_UNK7 (1 << 7) // 0x0080
#define ACTIVE_FLAG_DITHERED_ALPHA (1 << 7) // 0x0080
#define ACTIVE_FLAG_UNK8 (1 << 8) // 0x0100
#define ACTIVE_FLAG_UNK9 (1 << 9) // 0x0200
#define ACTIVE_FLAG_UNK10 (1 << 10) // 0x0400
#define ACTIVE_FLAGS_DEACTIVATED 0
/* respawnInfoType */
#define RESPAWN_INFO_TYPE_NULL 0
@@ -211,7 +211,7 @@
#define BLUE_FISH_ACT_TURN 1
#define BLUE_FISH_ACT_ASCEND 2
#define BLUE_FISH_ACT_TURN_BACK 3
/* oAction: bhv_blue_fish_spawn_loop */
#define BLUE_FISH_ACT_SPAWN 0
#define BLUE_FISH_ACT_ROOM 1
@@ -757,11 +757,11 @@
/* Walking sounds */
#define PENGUIN_WALK_BABY 0
#define PENGUIN_WALK_BIG 1
/* Animations */
#define PENGUIN_ANIM_WALK 0
#define PENGUIN_ANIM_IDLE 3
/* Racing penguin */
/* oAction */
#define RACING_PENGUIN_ACT_WAIT_FOR_MARIO 0
@@ -770,14 +770,14 @@
#define RACING_PENGUIN_ACT_RACE 3
#define RACING_PENGUIN_ACT_FINISH_RACE 4
#define RACING_PENGUIN_ACT_SHOW_FINAL_TEXT 5
/* SL walking penguin */
/* oAction */
#define SL_WALKING_PENGUIN_ACT_MOVING_FORWARDS 0
#define SL_WALKING_PENGUIN_ACT_TURNING_BACK 1
#define SL_WALKING_PENGUIN_ACT_RETURNING 2
#define SL_WALKING_PENGUIN_ACT_TURNING_FORWARDS 3
/* Snowman wind */
/* oSubAction */
#define SL_SNOWMAN_WIND_ACT_IDLE 0
@@ -971,4 +971,4 @@
#define BOWSER_PUZZLE_ACT_WAIT_FOR_COMPLETE 1
#define BOWSER_PUZZLE_ACT_DONE 2
#endif
#endif // OBJECT_CONSTANTS_H
+18 -19
View File
@@ -1,6 +1,5 @@
#ifndef _OBJECT_FIELDS_H
#define _OBJECT_FIELDS_H
#ifndef OBJECT_FIELDS_H
#define OBJECT_FIELDS_H
/**
* The array [0x88, 0x1C8) in struct Object consists of fields that can vary by
@@ -327,7 +326,7 @@
#define /*0x1B2*/ oBubbaUnk1B2 OBJECT_FIELD_S16(0x4A, + 1)
/* Bullet Bill */
#define /*0x0F8*/ oBulletBillUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0F8*/ oBulletBillInitialMoveYaw OBJECT_FIELD_S32(0x1C)
/* Bully (all variants) */
#define /*0x0F4*/ oBullySubtype OBJECT_FIELD_S32(0x1B)
@@ -703,15 +702,15 @@
#define /*0x0F4*/ oMontyMoleHoleCooldown OBJECT_FIELD_S32(0x1B)
/* Mr. Blizzard */
#define /*0x0F4*/ oMrBlizzardUnkF4 OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oMrBlizzardUnkF8 OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oMrBlizzardUnkFC OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oMrBlizzardUnk100 OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ oMrBlizzardUnk104 OBJECT_FIELD_F32(0x1F)
#define /*0x108*/ oMrBlizzardUnk108 OBJECT_FIELD_F32(0x20)
#define /*0x10C*/ oMrBlizzardUnk10C OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oMrBlizzardUnk110 OBJECT_FIELD_S32(0x22)
#define /*0x1AC*/ oMrBlizzardUnk1AC OBJECT_FIELD_S32(0x49)
#define /*0x0F4*/ oMrBlizzardScale OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oMrBlizzardHeldObj OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oMrBlizzardGraphYVel OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oMrBlizzardTimer OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ oMrBlizzardDizziness OBJECT_FIELD_F32(0x1F)
#define /*0x108*/ oMrBlizzardChangeInDizziness OBJECT_FIELD_F32(0x20)
#define /*0x10C*/ oMrBlizzardGraphYOffset OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oMrBlizzardDistFromHome OBJECT_FIELD_S32(0x22)
#define /*0x1AC*/ oMrBlizzardTargetMoveYaw OBJECT_FIELD_S32(0x49)
/* Mr. I */
#define /*0x0F4*/ oMrIUnkF4 OBJECT_FIELD_S32(0x1B)
@@ -953,7 +952,7 @@
#define /*0x0FC*/ oSwoopTargetYaw OBJECT_FIELD_S32(0x1D)
/* Thwomp */
#define /*0x0F4*/ oThwompUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oThwompRandomTimer OBJECT_FIELD_S32(0x1B)
/* Tilting Platform */
#define /*0x0F4*/ oTiltingPyramidNormalX OBJECT_FIELD_F32(0x1B)
@@ -1133,7 +1132,7 @@
#define /*0x0F4*/ oStrongWindParticlePenguinObj OBJECT_FIELD_OBJ(0x1B)
/* Whomp */
#define /*0x0F8*/ oWhompUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0F8*/ oWhompShakeVal OBJECT_FIELD_S32(0x1C)
/* Wiggler */
#define /*0x0F4*/ oWigglerFallThroughFloorsHeight OBJECT_FIELD_F32(0x1B)
@@ -1143,11 +1142,11 @@
#define /*0x108*/ oWigglerTimeUntilRandomTurn OBJECT_FIELD_S32(0x20)
#define /*0x10C*/ oWigglerTargetYaw OBJECT_FIELD_S32(0x21)
#define /*0x110*/ oWigglerWalkAwayFromWallTimer OBJECT_FIELD_S32(0x22)
#define /*0x1AC*/ oWigglerUnk1AC OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AC*/ oWigglerUnused OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AE*/ oWigglerTextStatus OBJECT_FIELD_S16(0x49, + 1)
/* Lll Wood Piece */
#define /*0x0F4*/ oLllWoodPieceUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oLllWoodPieceOscillationTimer OBJECT_FIELD_S32(0x1B)
/* Wooden Post */
#define /*0x0F4*/ oWoodenPostTotalMarioAngle OBJECT_FIELD_S32(0x1B)
@@ -1157,8 +1156,8 @@
#define /*0x104*/ oWoodenPostOffsetY OBJECT_FIELD_F32(0x1F)
/* Yoshi */
#define /*0x0F4*/ oYoshiUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oYoshiBlinkTimer OBJECT_FIELD_S32(0x1B)
#define /*0x0FC*/ oYoshiChosenHome OBJECT_FIELD_S32(0x1D)
#define /*0x100*/ oYoshiTargetYaw OBJECT_FIELD_S32(0x1E)
#endif
#endif // OBJECT_FIELDS_H
+1 -1
View File
@@ -12,4 +12,4 @@
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
#endif
#endif // PLATFORM_INFO_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef _PREVENT_BSS_REORDERING_H
#define _PREVENT_BSS_REORDERING_H
#ifndef PREVENT_BSS_REORDERING_H
#define PREVENT_BSS_REORDERING_H
/**
* To determine variable order for .bss, the compiler sorts variables by their
@@ -80,4 +80,4 @@ struct Dummy61 { int x; };
struct Dummy62 { int x; };
typedef int Dummy63;
#endif
#endif // PREVENT_BSS_REORDERING_H
+13
View File
@@ -1,6 +1,7 @@
#ifndef SEGMENT_SYMBOLS_H
#define SEGMENT_SYMBOLS_H
#ifndef NO_SEGMENTED_MEMORY
#define DECLARE_SEGMENT(name) \
extern u8 _##name##SegmentRomStart[]; \
extern u8 _##name##SegmentRomEnd[];
@@ -34,6 +35,8 @@ DECLARE_ACTOR_SEGMENT(group15)
DECLARE_ACTOR_SEGMENT(group16)
DECLARE_ACTOR_SEGMENT(group17)
DECLARE_SEGMENT(entry)
DECLARE_SEGMENT(engine)
DECLARE_SEGMENT(behavior)
DECLARE_SEGMENT(scripts)
DECLARE_SEGMENT(goddard)
@@ -51,6 +54,8 @@ DECLARE_LEVEL_SEGMENT(ending)
#undef STUB_LEVEL
#undef DEFINE_LEVEL
DECLARE_SEGMENT(segment2_mio0)
DECLARE_SEGMENT(water_skybox_mio0)
DECLARE_SEGMENT(ccm_skybox_mio0)
DECLARE_SEGMENT(clouds_skybox_mio0)
@@ -79,4 +84,12 @@ DECLARE_SEGMENT(title_screen_bg_mio0)
DECLARE_SEGMENT(debug_level_select_mio0)
#ifdef VERSION_EU
DECLARE_SEGMENT(translation_de_mio0)
DECLARE_SEGMENT(translation_en_mio0)
DECLARE_SEGMENT(translation_fr_mio0)
#endif
#endif
#endif // SEGMENT_SYMBOLS_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef _SEGMENTS_H
#define _SEGMENTS_H
#ifndef SEGMENTS_H
#define SEGMENTS_H
/*
* Memory addresses for segments. Ideally, this header file would not be
@@ -53,4 +53,4 @@
#define SEG_GODDARD SEG_POOL_START + 0x113000
#endif
#endif // _SEGMENTS_H
#endif // SEGMENTS_H
+1 -1
View File
@@ -42,4 +42,4 @@ enum SeqId {
SEQ_COUNT
};
#endif
#endif // SEQ_IDS_H
+3 -3
View File
@@ -1,5 +1,5 @@
#ifndef _SM64_H_
#define _SM64_H_
#ifndef SM64_H
#define SM64_H
// Global header for Super Mario 64
@@ -430,4 +430,4 @@
#define C_BUTTONS (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS )
#endif
#endif // SM64_H
+5 -6
View File
@@ -1,5 +1,5 @@
#ifndef _SPECIAL_PRESET_NAMES_H
#define _SPECIAL_PRESET_NAMES_H
#ifndef SPECIAL_PRESET_NAMES_H
#define SPECIAL_PRESET_NAMES_H
enum SpecialPresets {
special_null_start,
@@ -43,7 +43,7 @@ enum SpecialPresets {
special_rotating_counter_clockwise,
special_wf_tumbling_bridge,
special_large_bomp,
special_level_geo_03 = 0x65,
special_level_geo_04,
special_level_geo_05,
@@ -86,9 +86,8 @@ enum SpecialPresets {
special_1star_door,
special_3star_door,
special_key_door,
special_null_end = 0xFF
};
#endif // _SPECIAL_PRESET_NAMES_H
#endif // SPECIAL_PRESET_NAMES_H
+5 -5
View File
@@ -1,5 +1,5 @@
#ifndef _SPECIAL_PRESETS_H
#define _SPECIAL_PRESETS_H
#ifndef SPECIAL_PRESETS_H
#define SPECIAL_PRESETS_H
#include "special_preset_names.h"
#include "behavior_data.h"
@@ -17,13 +17,13 @@ struct SpecialPreset
/*00*/ u8 preset_id;
/*01*/ u8 type; // Determines whether object is 8, 10, 12 or 14 bytes long.
/*02*/ u8 defParam; // Default parameter, only used when type is SPTYPE_DEF_PARAM_AND_YROT
/*03*/ u8 model;
/*03*/ u8 model;
/*04*/ const BehaviorScript *behavior;
};
// Some Models ID's are missing their names because they are probably unused
static struct SpecialPreset SpecialObjectPresets[] =
static struct SpecialPreset SpecialObjectPresets[] =
{
{0x00, SPTYPE_YROT_NO_PARAMS , 0x00, MODEL_NONE, NULL},
{0x01, SPTYPE_NO_YROT_OR_PARAMS , 0x00, MODEL_YELLOW_COIN, bhvYellowCoin},
@@ -110,4 +110,4 @@ static struct SpecialPreset SpecialObjectPresets[] =
{0xFF, SPTYPE_NO_YROT_OR_PARAMS , 0x00, MODEL_NONE, NULL}
};
#endif // _SPECIAL_PRESETS_H
#endif // SPECIAL_PRESETS_H
+1 -1
View File
@@ -220,4 +220,4 @@
// Water Box
#define COL_WATER_BOX(id, x1, z1, x2, z2, y) id, x1, z1, x2, z2, y
#endif
#endif // SURFACE_TERRAINS_H
+1 -1
View File
@@ -15,4 +15,4 @@
#define TEXT_JPHUD_ERASE_FILE _("ファイルけす")
#define TEXT_JPHUD_SOUND_SELECT _("サウンドセレクト")
#endif
#endif // TEXT_MENU_STRINGS_H
+2 -2
View File
@@ -470,6 +470,6 @@
#define TEXT_MENU_SA_DE _(" VERSTECKTES AQUARIUM")
#define TEXT_MENU_NONE_DE _("")
#define TEXT_MENU_STARS_DE _(" GEHEIME STERNE")
#endif
#endif // VERSION_EU
#endif
#endif // TEXT_STRINGS_H
+3 -2
View File
@@ -1,7 +1,8 @@
#ifndef TEXTURES_H
#define TEXTURES_H
#include <ultra64.h>
#include <PR/ultratypes.h>
#include <PR/gbi.h>
// cave
extern const u8 cave_09000000[];
@@ -277,4 +278,4 @@ extern const Gfx title_screen_bg_dl_0A000190[];
extern const u8 *const mario_title_texture_table[];
extern const u8 *const game_over_texture_table[];
#endif
#endif // TEXTURES_H
+4 -4
View File
@@ -1,5 +1,5 @@
#ifndef _TYPES_H_
#define _TYPES_H_
#ifndef TYPES_H
#define TYPES_H
// This file contains various data types used in Super Mario 64 that don't yet
// have an appropriate header.
@@ -340,10 +340,10 @@ struct MarioState
/*0xB4*/ u8 squishTimer;
/*0xB5*/ u8 fadeWarpOpacity;
/*0xB6*/ u16 capTimer;
/*0xB8*/ s16 unkB8;
/*0xB8*/ s16 prevNumStarsForDialog;
/*0xBC*/ f32 peakHeight;
/*0xC0*/ f32 quicksandDepth;
/*0xC4*/ f32 unkC4;
};
#endif
#endif // TYPES_H