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 10
This commit is contained in:
@@ -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) \
|
||||
|
||||
@@ -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)\
|
||||
{ \
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -429,4 +429,4 @@
|
||||
#define GEO_CULLING_RADIUS(cullingRadius) \
|
||||
CMD_BBH(0x20, 0x00, cullingRadius)
|
||||
|
||||
#endif
|
||||
#endif // GEO_COMMANDS_H
|
||||
|
||||
41
include/gfx_dimensions.h
Normal file
41
include/gfx_dimensions.h
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user