Removed majority of TARGET_N64 logic from code
This commit is contained in:
parent
2e2e616821
commit
31f0d68ca2
|
@ -2499,41 +2499,23 @@ static const Lights1 segment2_lights_unused = gdSPDefLights1(
|
||||||
|
|
||||||
// 0x02014470 - 0x020144B0
|
// 0x02014470 - 0x020144B0
|
||||||
static const Mtx matrix_identity = {
|
static const Mtx matrix_identity = {
|
||||||
#ifdef TARGET_N64
|
|
||||||
{{0x00010000, 0x00000000,
|
|
||||||
0x00000001, 0x00000000},
|
|
||||||
{0x00000000, 0x00010000,
|
|
||||||
0x00000000, 0x00000001},
|
|
||||||
{0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000},
|
|
||||||
{0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000}}
|
|
||||||
#else
|
|
||||||
{{1.0f, 0.0f, 0.0f, 0.0f},
|
{{1.0f, 0.0f, 0.0f, 0.0f},
|
||||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
{0.0f, 1.0f, 0.0f, 0.0f},
|
||||||
{0.0f, 0.0f, 1.0f, 0.0f},
|
{0.0f, 0.0f, 1.0f, 0.0f},
|
||||||
{0.0f, 0.0f, 0.0f, 1.0f}}
|
{0.0f, 0.0f, 0.0f, 1.0f}}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 0x020144B0 - 0x020144F0
|
// 0x020144B0 - 0x020144F0
|
||||||
static const Mtx matrix_fullscreen = {
|
static const Mtx matrix_fullscreen = {
|
||||||
#if TARGET_N64
|
|
||||||
{{0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000},
|
|
||||||
{0x00000000, 0xffff0000,
|
|
||||||
0xffffffff, 0xffff0001},
|
|
||||||
{((65536 * 2 / SCREEN_WIDTH) << 16) | 0, 0x00000000,
|
|
||||||
(0 << 16) | (65536 * 2 / SCREEN_HEIGHT), 0x00000000},
|
|
||||||
{0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000}}
|
|
||||||
#else
|
|
||||||
{{2.0f / SCREEN_WIDTH, 0.0f, 0.0f, 0.0f},
|
{{2.0f / SCREEN_WIDTH, 0.0f, 0.0f, 0.0f},
|
||||||
{0.0f, 2.0f / SCREEN_HEIGHT, 0.0f, 0.0f},
|
{0.0f, 2.0f / SCREEN_HEIGHT, 0.0f, 0.0f},
|
||||||
{0.0f, 0.0f, -1.0f, 0.0f},
|
{0.0f, 0.0f, -1.0f, 0.0f},
|
||||||
{-1.0f, -1.0f, -1.0f, 1.0f}}
|
{-1.0f, -1.0f, -1.0f, 1.0f}}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1109,11 +1109,7 @@
|
||||||
* Vertex (set up for use with colors)
|
* Vertex (set up for use with colors)
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#ifdef TARGET_N64
|
|
||||||
short ob[3]; /* x, y, z */
|
|
||||||
#else
|
|
||||||
float ob[3]; /* x, y, z */
|
float ob[3]; /* x, y, z */
|
||||||
#endif
|
|
||||||
unsigned short flag;
|
unsigned short flag;
|
||||||
short tc[2]; /* texture coord */
|
short tc[2]; /* texture coord */
|
||||||
unsigned char cn[4]; /* color & alpha */
|
unsigned char cn[4]; /* color & alpha */
|
||||||
|
@ -1123,11 +1119,7 @@ typedef struct {
|
||||||
* Vertex (set up for use with normals)
|
* Vertex (set up for use with normals)
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#ifdef TARGET_N64
|
|
||||||
short ob[3]; /* x, y, z */
|
|
||||||
#else
|
|
||||||
float ob[3]; /* x, y, z */
|
float ob[3]; /* x, y, z */
|
||||||
#endif
|
|
||||||
unsigned short flag;
|
unsigned short flag;
|
||||||
short tc[2]; /* texture coord */
|
short tc[2]; /* texture coord */
|
||||||
signed char n[3]; /* normal */
|
signed char n[3]; /* normal */
|
||||||
|
@ -1176,23 +1168,9 @@ typedef struct {
|
||||||
unsigned char v[3];
|
unsigned char v[3];
|
||||||
} Tri;
|
} Tri;
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
/*
|
|
||||||
* 4x4 matrix, fixed point s15.16 format.
|
|
||||||
* First 8 words are integer portion of the 4x4 matrix
|
|
||||||
* Last 8 words are the fraction portion of the 4x4 matrix
|
|
||||||
*/
|
|
||||||
typedef s32 Mtx_t[4][4];
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
Mtx_t m;
|
|
||||||
long long int force_structure_alignment;
|
|
||||||
} Mtx;
|
|
||||||
#else
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float m[4][4];
|
float m[4][4];
|
||||||
} Mtx;
|
} Mtx;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Viewport
|
* Viewport
|
||||||
|
|
|
@ -29,16 +29,9 @@ typedef volatile s64 vs64;
|
||||||
typedef float f32;
|
typedef float f32;
|
||||||
typedef double f64;
|
typedef double f64;
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
typedef u32 size_t;
|
|
||||||
typedef s32 ssize_t;
|
|
||||||
typedef u32 uintptr_t;
|
|
||||||
typedef s32 intptr_t;
|
|
||||||
typedef s32 ptrdiff_t;
|
|
||||||
#else
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
typedef ptrdiff_t ssize_t;
|
typedef ptrdiff_t ssize_t;
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
|
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,15 +29,11 @@
|
||||||
#define SCREEN_HEIGHT 240
|
#define SCREEN_HEIGHT 240
|
||||||
|
|
||||||
// Border Height Define for NTSC Versions
|
// Border Height Define for NTSC Versions
|
||||||
#ifdef TARGET_N64
|
|
||||||
#ifndef VERSION_EU
|
|
||||||
#define BORDER_HEIGHT 8
|
|
||||||
#else
|
|
||||||
#define BORDER_HEIGHT 1
|
#define BORDER_HEIGHT 1
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
// What's the point of having a border?
|
// What's the point of having a border?
|
||||||
#define BORDER_HEIGHT 0
|
#define BORDER_HEIGHT 0
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#ifndef GFX_DIMENSIONS_H
|
#ifndef GFX_DIMENSIONS_H
|
||||||
#define GFX_DIMENSIONS_H
|
#define GFX_DIMENSIONS_H
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "pc/gfx/gfx_pc.h"
|
#include "pc/gfx/gfx_pc.h"
|
||||||
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (SCREEN_WIDTH / 2 - SCREEN_HEIGHT / 2 * gfx_current_dimensions.aspect_ratio + (v))
|
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (SCREEN_WIDTH / 2 - SCREEN_HEIGHT / 2 * gfx_current_dimensions.aspect_ratio + (v))
|
||||||
|
@ -9,12 +8,5 @@
|
||||||
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v))
|
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v))
|
||||||
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v))
|
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v))
|
||||||
#define GFX_DIMENSIONS_ASPECT_RATIO (gfx_current_dimensions.aspect_ratio)
|
#define GFX_DIMENSIONS_ASPECT_RATIO (gfx_current_dimensions.aspect_ratio)
|
||||||
#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
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,20 +46,9 @@
|
||||||
#define ALIGNED16
|
#define ALIGNED16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
// convert a virtual address to physical.
|
|
||||||
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr) & 0x1FFFFFFF)
|
|
||||||
|
|
||||||
// convert a physical address to virtual.
|
|
||||||
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) | 0x80000000)
|
|
||||||
|
|
||||||
// another way of converting virtual to physical
|
|
||||||
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8 *)(addr) - 0x80000000U)
|
|
||||||
#else
|
|
||||||
// no conversion for pc port other than cast
|
// no conversion for pc port other than cast
|
||||||
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr))
|
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr))
|
||||||
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr))
|
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr))
|
||||||
#define VIRTUAL_TO_PHYSICAL2(addr) ((void *)(addr))
|
#define VIRTUAL_TO_PHYSICAL2(addr) ((void *)(addr))
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
#ifndef MAKE_CONST_NONCONST_H
|
#ifndef MAKE_CONST_NONCONST_H
|
||||||
#define MAKE_CONST_NONCONST_H
|
#define MAKE_CONST_NONCONST_H
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
// IDO sometimes puts const variables in .rodata and sometimes in .data, which breaks ordering.
|
|
||||||
// This makes sure all variables are put into the same section (.data). We need to do this for
|
|
||||||
// both IDO and gcc for TARGET_N64.
|
|
||||||
#define const
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
#ifndef PLATFORM_INFO_H
|
#ifndef PLATFORM_INFO_H
|
||||||
#define PLATFORM_INFO_H
|
#define PLATFORM_INFO_H
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
#define IS_64_BIT 0
|
|
||||||
#define IS_BIG_ENDIAN 1
|
|
||||||
#else
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#define IS_64_BIT (UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFU)
|
#define IS_64_BIT (UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFU)
|
||||||
#define IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
#define IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
|
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#ifndef SEGMENT_SYMBOLS_H
|
#ifndef SEGMENT_SYMBOLS_H
|
||||||
#define SEGMENT_SYMBOLS_H
|
#define SEGMENT_SYMBOLS_H
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
#define DECLARE_SEGMENT(name) \
|
|
||||||
extern u8 _##name##SegmentRomStart[]; \
|
|
||||||
extern u8 _##name##SegmentRomEnd[];
|
|
||||||
#else
|
|
||||||
#define DECLARE_SEGMENT(name) \
|
#define DECLARE_SEGMENT(name) \
|
||||||
static u8 _##name##SegmentRomStart[1]; \
|
static u8 _##name##SegmentRomStart[1]; \
|
||||||
static u8 _##name##SegmentRomEnd[1];
|
static u8 _##name##SegmentRomEnd[1];
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DECLARE_ACTOR_SEGMENT(name) \
|
#define DECLARE_ACTOR_SEGMENT(name) \
|
||||||
DECLARE_SEGMENT(name##_mio0) \
|
DECLARE_SEGMENT(name##_mio0) \
|
||||||
|
@ -43,11 +37,7 @@ DECLARE_ACTOR_SEGMENT(group17)
|
||||||
DECLARE_SEGMENT(behavior)
|
DECLARE_SEGMENT(behavior)
|
||||||
DECLARE_SEGMENT(scripts)
|
DECLARE_SEGMENT(scripts)
|
||||||
DECLARE_SEGMENT(goddard)
|
DECLARE_SEGMENT(goddard)
|
||||||
#ifdef TARGET_N64
|
|
||||||
extern u8 _goddardSegmentStart[];
|
|
||||||
#else
|
|
||||||
static u8 _goddardSegmentStart[1];
|
static u8 _goddardSegmentStart[1];
|
||||||
#endif
|
|
||||||
|
|
||||||
DECLARE_LEVEL_SEGMENT(menu)
|
DECLARE_LEVEL_SEGMENT(menu)
|
||||||
DECLARE_LEVEL_SEGMENT(intro)
|
DECLARE_LEVEL_SEGMENT(intro)
|
||||||
|
|
|
@ -72,19 +72,16 @@ const LevelScript level_main_menu_entry_2[] = {
|
||||||
|
|
||||||
/*25*/ FREE_LEVEL_POOL(),
|
/*25*/ FREE_LEVEL_POOL(),
|
||||||
/*26*/ LOAD_AREA(/*area*/ 2),
|
/*26*/ LOAD_AREA(/*area*/ 2),
|
||||||
#ifndef TARGET_N64
|
|
||||||
// sVisibleStars is set to 0 during FIXED_LOAD above on N64, but not on PC-port.
|
// sVisibleStars is set to 0 during FIXED_LOAD above on N64, but not on PC-port.
|
||||||
// lvl_init_act_selector_values_and_stars must be called here otherwise the
|
// lvl_init_act_selector_values_and_stars must be called here otherwise the
|
||||||
// previous value is retained and causes incorrect drawing during the 16 transition
|
// previous value is retained and causes incorrect drawing during the 16 transition
|
||||||
// frames.
|
// frames.
|
||||||
CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars),
|
CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars),
|
||||||
#endif
|
|
||||||
/*27*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
|
/*27*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
|
||||||
/*29*/ SLEEP(/*frames*/ 16),
|
/*29*/ SLEEP(/*frames*/ 16),
|
||||||
/*30*/ SET_MENU_MUSIC(/*seq*/ 0x000D),
|
/*30*/ SET_MENU_MUSIC(/*seq*/ 0x000D),
|
||||||
#ifdef TARGET_N64
|
|
||||||
/*31*/ CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars),
|
|
||||||
#endif
|
|
||||||
/*33*/ CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_act_button_actions),
|
/*33*/ CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_act_button_actions),
|
||||||
/*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM),
|
/*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM),
|
||||||
/*36*/ STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
|
/*36*/ STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
|
||||||
|
|
|
@ -1,49 +1,9 @@
|
||||||
#include "libultra_internal.h"
|
#include "libultra_internal.h"
|
||||||
#ifndef TARGET_N64
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
void guMtxF2L(float mf[4][4], Mtx *m) {
|
|
||||||
int r, c;
|
|
||||||
s32 tmp1;
|
|
||||||
s32 tmp2;
|
|
||||||
s32 *m1 = &m->m[0][0];
|
|
||||||
s32 *m2 = &m->m[2][0];
|
|
||||||
for (r = 0; r < 4; r++) {
|
|
||||||
for (c = 0; c < 2; c++) {
|
|
||||||
tmp1 = mf[r][2 * c] * 65536.0f;
|
|
||||||
tmp2 = mf[r][2 * c + 1] * 65536.0f;
|
|
||||||
*m1++ = (tmp1 & 0xffff0000) | ((tmp2 >> 0x10) & 0xffff);
|
|
||||||
*m2++ = ((tmp1 << 0x10) & 0xffff0000) | (tmp2 & 0xffff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void guMtxL2F(float mf[4][4], Mtx *m) {
|
|
||||||
int r, c;
|
|
||||||
u32 tmp1;
|
|
||||||
u32 tmp2;
|
|
||||||
u32 *m1;
|
|
||||||
u32 *m2;
|
|
||||||
s32 stmp1, stmp2;
|
|
||||||
m1 = (u32 *) &m->m[0][0];
|
|
||||||
m2 = (u32 *) &m->m[2][0];
|
|
||||||
for (r = 0; r < 4; r++) {
|
|
||||||
for (c = 0; c < 2; c++) {
|
|
||||||
tmp1 = (*m1 & 0xffff0000) | ((*m2 >> 0x10) & 0xffff);
|
|
||||||
tmp2 = ((*m1++ << 0x10) & 0xffff0000) | (*m2++ & 0xffff);
|
|
||||||
stmp1 = *(s32 *) &tmp1;
|
|
||||||
stmp2 = *(s32 *) &tmp2;
|
|
||||||
mf[r][c * 2 + 0] = stmp1 / 65536.0f;
|
|
||||||
mf[r][c * 2 + 1] = stmp2 / 65536.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void guMtxF2L(float mf[4][4], Mtx *m) {
|
void guMtxF2L(float mf[4][4], Mtx *m) {
|
||||||
memcpy(m, mf, sizeof(Mtx));
|
memcpy(m, mf, sizeof(Mtx));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void guMtxIdentF(float mf[4][4]) {
|
void guMtxIdentF(float mf[4][4]) {
|
||||||
int r, c;
|
int r, c;
|
||||||
|
@ -58,11 +18,8 @@ void guMtxIdentF(float mf[4][4]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void guMtxIdent(Mtx *m) {
|
void guMtxIdent(Mtx *m) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
float mf[4][4];
|
|
||||||
guMtxIdentF(mf);
|
|
||||||
guMtxF2L(mf, m);
|
|
||||||
#else
|
|
||||||
guMtxIdentF(m->m);
|
guMtxIdentF(m->m);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -738,6 +738,7 @@ void func_8031D838(s32 player, FadeT fadeInTime, u8 targetVolume) {
|
||||||
}
|
}
|
||||||
seqPlayer->fadeVelocity =
|
seqPlayer->fadeVelocity =
|
||||||
(((f32)(FLOAT_CAST(targetVolume) / EU_FLOAT(127.0)) - seqPlayer->fadeVolume) / (f32) fadeInTime);
|
(((f32)(FLOAT_CAST(targetVolume) / EU_FLOAT(127.0)) - seqPlayer->fadeVolume) / (f32) fadeInTime);
|
||||||
|
|
||||||
#ifdef VERSION_EU
|
#ifdef VERSION_EU
|
||||||
seqPlayer->state = 0;
|
seqPlayer->state = 0;
|
||||||
#else
|
#else
|
||||||
|
@ -764,117 +765,15 @@ void func_eu_802e9bec(s32 player, s32 channel, s32 arg2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
// Stubbed N64-US/JP audio code
|
||||||
#ifdef TARGET_N64
|
// continue;
|
||||||
struct SPTask *create_next_audio_frame_task(void) {
|
|
||||||
u32 samplesRemainingInAI;
|
|
||||||
s32 writtenCmds;
|
|
||||||
s32 index;
|
|
||||||
OSTask_t *task;
|
|
||||||
s32 oldDmaCount;
|
|
||||||
s32 flags;
|
|
||||||
|
|
||||||
gAudioFrameCount++;
|
|
||||||
if (gAudioLoadLock != AUDIO_LOCK_NOT_LOADING) {
|
|
||||||
stubbed_printf("DAC:Lost 1 Frame.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gAudioTaskIndex ^= 1;
|
|
||||||
gCurrAiBufferIndex++;
|
|
||||||
gCurrAiBufferIndex %= NUMAIBUFFERS;
|
|
||||||
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
|
|
||||||
samplesRemainingInAI = osAiGetLength() / 4;
|
|
||||||
|
|
||||||
// Audio is triple buffered; the audio interface reads from two buffers
|
|
||||||
// while the third is being written by the RSP. More precisely, the
|
|
||||||
// lifecycle is:
|
|
||||||
// - this function computes an audio command list
|
|
||||||
// - wait for vblank
|
|
||||||
// - the command list is sent to the RSP (we could have sent it to the
|
|
||||||
// RSP before the vblank, but that gives the RSP less time to finish)
|
|
||||||
// - wait for vblank
|
|
||||||
// - the RSP is now expected to be finished, and we can send its output
|
|
||||||
// on to the AI
|
|
||||||
// Here we thus send to the AI the sound that was generated two frames ago.
|
|
||||||
if (gAiBufferLengths[index] != 0) {
|
|
||||||
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
oldDmaCount = gCurrAudioFrameDmaCount;
|
|
||||||
// There has to be some sort of no-op if here, but it's not exactly clear
|
|
||||||
// how it should look... It's also very unclear why gCurrAudioFrameDmaQueue
|
|
||||||
// isn't read from here, despite gCurrAudioFrameDmaCount being reset.
|
|
||||||
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
|
|
||||||
stubbed_printf("DMA: Request queue over.( %d )\n", oldDmaCount);
|
|
||||||
}
|
|
||||||
gCurrAudioFrameDmaCount = 0;
|
|
||||||
|
|
||||||
gAudioTask = &gAudioTasks[gAudioTaskIndex];
|
|
||||||
gAudioCmd = gAudioCmdBuffers[gAudioTaskIndex];
|
|
||||||
|
|
||||||
index = gCurrAiBufferIndex;
|
|
||||||
gCurrAiBuffer = gAiBuffers[index];
|
|
||||||
gAiBufferLengths[index] = ((gSamplesPerFrameTarget - samplesRemainingInAI +
|
|
||||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
|
|
||||||
if (gAiBufferLengths[index] < gMinAiBufferLength) {
|
|
||||||
gAiBufferLengths[index] = gMinAiBufferLength;
|
|
||||||
}
|
|
||||||
if (gAiBufferLengths[index] > gSamplesPerFrameTarget + SAMPLES_TO_OVERPRODUCE) {
|
|
||||||
gAiBufferLengths[index] = gSamplesPerFrameTarget + SAMPLES_TO_OVERPRODUCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sGameLoopTicked != 0) {
|
|
||||||
update_game_sound();
|
|
||||||
sGameLoopTicked = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For the function to match we have to preserve some arbitrary variable
|
|
||||||
// across this function call.
|
|
||||||
flags = 0;
|
|
||||||
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, gCurrAiBuffer, gAiBufferLengths[index]);
|
|
||||||
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
|
|
||||||
|
|
||||||
index = gAudioTaskIndex;
|
|
||||||
gAudioTask->msgqueue = NULL;
|
|
||||||
gAudioTask->msg = NULL;
|
|
||||||
|
|
||||||
task = &gAudioTask->task.t;
|
|
||||||
task->type = M_AUDTASK;
|
|
||||||
task->flags = flags;
|
|
||||||
task->ucode_boot = rspF3DBootStart;
|
|
||||||
task->ucode_boot_size = (u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart;
|
|
||||||
task->ucode = rspAspMainStart;
|
|
||||||
task->ucode_size = 0x800; // (this size is ignored)
|
|
||||||
task->ucode_data = rspAspMainDataStart;
|
|
||||||
task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
|
|
||||||
task->dram_stack = NULL;
|
|
||||||
task->dram_stack_size = 0;
|
|
||||||
task->output_buff = NULL;
|
|
||||||
task->output_buff_size = NULL;
|
|
||||||
task->data_ptr = gAudioCmdBuffers[index];
|
|
||||||
task->data_size = writtenCmds * sizeof(u64);
|
|
||||||
|
|
||||||
// The audio task never yields, so having a yield buffer is pointless.
|
|
||||||
// This wastefulness was fixed in US.
|
|
||||||
#ifdef VERSION_JP
|
|
||||||
task->yield_data_ptr = (u64 *) gAudioSPTaskYieldBuffer;
|
|
||||||
task->yield_data_size = OS_YIELD_AUDIO_SIZE;
|
|
||||||
#else
|
|
||||||
task->yield_data_ptr = NULL;
|
|
||||||
task->yield_data_size = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
decrease_sample_dma_ttls();
|
|
||||||
return gAudioTask;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
struct SPTask *create_next_audio_frame_task(void) {
|
struct SPTask *create_next_audio_frame_task(void) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
|
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
|
||||||
gAudioFrameCount++;
|
gAudioFrameCount++;
|
||||||
if (sGameLoopTicked != 0) {
|
if (sGameLoopTicked != 0) {
|
||||||
|
@ -886,7 +785,6 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
|
||||||
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
|
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
|
||||||
decrease_sample_dma_ttls();
|
decrease_sample_dma_ttls();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void play_sound(s32 soundBits, f32 *pos) {
|
void play_sound(s32 soundBits, f32 *pos) {
|
||||||
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
|
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
|
||||||
|
|
|
@ -651,12 +651,7 @@ s32 audio_shut_down_and_reset_step(void) {
|
||||||
*/
|
*/
|
||||||
void wait_for_audio_frames(s32 frames) {
|
void wait_for_audio_frames(s32 frames) {
|
||||||
gAudioFrameCount = 0;
|
gAudioFrameCount = 0;
|
||||||
#ifdef TARGET_N64
|
|
||||||
// Sound thread will update gAudioFrameCount
|
|
||||||
while (gAudioFrameCount < frames) {
|
|
||||||
// spin
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -507,9 +507,6 @@ struct Note
|
||||||
/* U/J, EU */
|
/* U/J, EU */
|
||||||
/*0xA4, 0x00*/ struct AudioListItem listItem;
|
/*0xA4, 0x00*/ struct AudioListItem listItem;
|
||||||
/* 0x10*/ struct NoteSynthesisState synthesisState;
|
/* 0x10*/ struct NoteSynthesisState synthesisState;
|
||||||
#ifdef TARGET_N64
|
|
||||||
u8 pad0[12];
|
|
||||||
#endif
|
|
||||||
/*0x04, 0x30*/ u8 priority;
|
/*0x04, 0x30*/ u8 priority;
|
||||||
/* 0x31*/ u8 waveId;
|
/* 0x31*/ u8 waveId;
|
||||||
/* 0x32*/ u8 sampleCountIndex;
|
/* 0x32*/ u8 sampleCountIndex;
|
||||||
|
|
|
@ -34,107 +34,6 @@ void decrease_sample_dma_ttls(void);
|
||||||
s32 audio_shut_down_and_reset_step(void);
|
s32 audio_shut_down_and_reset_step(void);
|
||||||
void func_802ad7ec(u32);
|
void func_802ad7ec(u32);
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
struct SPTask *create_next_audio_frame_task(void) {
|
|
||||||
u32 samplesRemainingInAI;
|
|
||||||
s32 writtenCmds;
|
|
||||||
s32 index;
|
|
||||||
OSTask_t *task;
|
|
||||||
s32 flags;
|
|
||||||
u16 *currAiBuffer;
|
|
||||||
s32 oldDmaCount;
|
|
||||||
OSMesg sp30;
|
|
||||||
OSMesg sp2C;
|
|
||||||
|
|
||||||
gAudioFrameCount++;
|
|
||||||
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) {
|
|
||||||
stubbed_printf("DAC:Lost 1 Frame.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
osSendMesg(OSMesgQueues[0], (OSMesg) gAudioFrameCount, 0);
|
|
||||||
|
|
||||||
gAudioTaskIndex ^= 1;
|
|
||||||
gCurrAiBufferIndex++;
|
|
||||||
gCurrAiBufferIndex %= NUMAIBUFFERS;
|
|
||||||
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
|
|
||||||
samplesRemainingInAI = osAiGetLength() / 4;
|
|
||||||
|
|
||||||
if (gAiBufferLengths[index] != 0) {
|
|
||||||
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
oldDmaCount = gCurrAudioFrameDmaCount;
|
|
||||||
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
|
|
||||||
stubbed_printf("DMA: Request queue over.( %d )\n", oldDmaCount);
|
|
||||||
}
|
|
||||||
gCurrAudioFrameDmaCount = 0;
|
|
||||||
|
|
||||||
decrease_sample_dma_ttls();
|
|
||||||
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1) {
|
|
||||||
gAudioResetPresetIdToLoad = (u8) (s32) sp30;
|
|
||||||
gAudioResetStatus = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gAudioResetStatus != 0) {
|
|
||||||
if (audio_shut_down_and_reset_step() == 0) {
|
|
||||||
if (gAudioResetStatus == 0) {
|
|
||||||
osSendMesg(OSMesgQueues[3], (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gAudioTask = &gAudioTasks[gAudioTaskIndex];
|
|
||||||
gAudioCmd = gAudioCmdBuffers[gAudioTaskIndex];
|
|
||||||
index = gCurrAiBufferIndex;
|
|
||||||
currAiBuffer = gAiBuffers[index];
|
|
||||||
|
|
||||||
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
|
|
||||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
|
|
||||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
|
||||||
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
|
|
||||||
}
|
|
||||||
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) {
|
|
||||||
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1) {
|
|
||||||
func_802ad7ec((u32) sp2C);
|
|
||||||
}
|
|
||||||
|
|
||||||
flags = 0;
|
|
||||||
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]);
|
|
||||||
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
|
|
||||||
gAudioRandom = gAudioRandom + writtenCmds / 8;
|
|
||||||
|
|
||||||
index = gAudioTaskIndex;
|
|
||||||
gAudioTask->msgqueue = NULL;
|
|
||||||
gAudioTask->msg = NULL;
|
|
||||||
|
|
||||||
task = &gAudioTask->task.t;
|
|
||||||
task->type = M_AUDTASK;
|
|
||||||
task->flags = flags;
|
|
||||||
#if TARGET_N64
|
|
||||||
task->ucode_boot = rspF3DBootStart;
|
|
||||||
task->ucode_boot_size = (u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart;
|
|
||||||
task->ucode = rspAspMainStart;
|
|
||||||
task->ucode_data = rspAspMainDataStart;
|
|
||||||
task->ucode_size = 0x800; // (this size is ignored)
|
|
||||||
task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
|
|
||||||
#endif
|
|
||||||
task->dram_stack = NULL;
|
|
||||||
task->dram_stack_size = 0;
|
|
||||||
task->output_buff = NULL;
|
|
||||||
task->output_buff_size = NULL;
|
|
||||||
task->data_ptr = gAudioCmdBuffers[index];
|
|
||||||
task->data_size = writtenCmds * sizeof(u64);
|
|
||||||
task->yield_data_ptr = NULL;
|
|
||||||
task->yield_data_size = 0;
|
|
||||||
return gAudioTask;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,7 @@
|
||||||
#include "seqplayer.h"
|
#include "seqplayer.h"
|
||||||
#include "external.h"
|
#include "external.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
#include "../pc/mixer.h"
|
#include "../pc/mixer.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DMEM_ADDR_TEMP 0x0
|
#define DMEM_ADDR_TEMP 0x0
|
||||||
#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x180
|
#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x180
|
||||||
|
|
|
@ -27,11 +27,8 @@ extern struct SaveBuffer gSaveBuffer;
|
||||||
|
|
||||||
extern u8 gGfxSPTaskStack[];
|
extern u8 gGfxSPTaskStack[];
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
#define GFX_NUM_POOLS 2
|
|
||||||
#else
|
|
||||||
#define GFX_NUM_POOLS 1
|
#define GFX_NUM_POOLS 1
|
||||||
#endif
|
|
||||||
extern struct GfxPool gGfxPools[GFX_NUM_POOLS];
|
extern struct GfxPool gGfxPools[GFX_NUM_POOLS];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include <ultra64.h>
|
#include <ultra64.h>
|
||||||
#ifndef TARGET_N64
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sm64.h"
|
#include "sm64.h"
|
||||||
#include "audio/external.h"
|
#include "audio/external.h"
|
||||||
|
@ -605,9 +604,7 @@ static void level_cmd_set_gamma(void) {
|
||||||
|
|
||||||
static void level_cmd_set_terrain_data(void) {
|
static void level_cmd_set_terrain_data(void) {
|
||||||
if (sCurrAreaIndex != -1) {
|
if (sCurrAreaIndex != -1) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
gAreas[sCurrAreaIndex].terrainData = segmented_to_virtual(CMD_GET(void *, 4));
|
|
||||||
#else
|
|
||||||
Collision *data;
|
Collision *data;
|
||||||
u32 size;
|
u32 size;
|
||||||
|
|
||||||
|
@ -615,7 +612,7 @@ static void level_cmd_set_terrain_data(void) {
|
||||||
size = get_area_terrain_size(data) * sizeof(Collision);
|
size = get_area_terrain_size(data) * sizeof(Collision);
|
||||||
gAreas[sCurrAreaIndex].terrainData = alloc_only_pool_alloc(sLevelPool, size);
|
gAreas[sCurrAreaIndex].terrainData = alloc_only_pool_alloc(sLevelPool, size);
|
||||||
memcpy(gAreas[sCurrAreaIndex].terrainData, data, size);
|
memcpy(gAreas[sCurrAreaIndex].terrainData, data, size);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
sCurrentCmd = CMD_NEXT;
|
sCurrentCmd = CMD_NEXT;
|
||||||
}
|
}
|
||||||
|
@ -629,9 +626,7 @@ static void level_cmd_set_rooms(void) {
|
||||||
|
|
||||||
static void level_cmd_set_macro_objects(void) {
|
static void level_cmd_set_macro_objects(void) {
|
||||||
if (sCurrAreaIndex != -1) {
|
if (sCurrAreaIndex != -1) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
gAreas[sCurrAreaIndex].macroObjects = segmented_to_virtual(CMD_GET(void *, 4));
|
|
||||||
#else
|
|
||||||
MacroObject *data = segmented_to_virtual(CMD_GET(void *, 4));
|
MacroObject *data = segmented_to_virtual(CMD_GET(void *, 4));
|
||||||
s32 len = 0;
|
s32 len = 0;
|
||||||
while (data[len++] != 0x001E) {
|
while (data[len++] != 0x001E) {
|
||||||
|
@ -639,7 +634,7 @@ static void level_cmd_set_macro_objects(void) {
|
||||||
}
|
}
|
||||||
gAreas[sCurrAreaIndex].macroObjects = alloc_only_pool_alloc(sLevelPool, len * sizeof(MacroObject));
|
gAreas[sCurrAreaIndex].macroObjects = alloc_only_pool_alloc(sLevelPool, len * sizeof(MacroObject));
|
||||||
memcpy(gAreas[sCurrAreaIndex].macroObjects, data, len * sizeof(MacroObject));
|
memcpy(gAreas[sCurrAreaIndex].macroObjects, data, len * sizeof(MacroObject));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
sCurrentCmd = CMD_NEXT;
|
sCurrentCmd = CMD_NEXT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -533,7 +533,6 @@ void alloc_surface_pools(void) {
|
||||||
reset_red_coins_collected();
|
reset_red_coins_collected();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the terrain data, to get the correct size when copying later.
|
* Get the size of the terrain data, to get the correct size when copying later.
|
||||||
*/
|
*/
|
||||||
|
@ -581,8 +580,6 @@ u32 get_area_terrain_size(s16 *data) {
|
||||||
|
|
||||||
return data - startPos;
|
return data - startPos;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the level file, loading in vertices, surfaces, some objects, and environmental
|
* Process the level file, loading in vertices, surfaces, some objects, and environmental
|
||||||
|
|
|
@ -28,9 +28,9 @@ extern struct Surface *sSurfacePool;
|
||||||
extern s16 sSurfacePoolSize;
|
extern s16 sSurfacePoolSize;
|
||||||
|
|
||||||
void alloc_surface_pools(void);
|
void alloc_surface_pools(void);
|
||||||
#ifndef TARGET_N64
|
|
||||||
u32 get_area_terrain_size(s16 *data);
|
u32 get_area_terrain_size(s16 *data);
|
||||||
#endif
|
|
||||||
void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects);
|
void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects);
|
||||||
void clear_dynamic_surfaces(void);
|
void clear_dynamic_surfaces(void);
|
||||||
void load_object_collision_model(void);
|
void load_object_collision_model(void);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define GFX_POOL_SIZE 6400
|
#define GFX_POOL_SIZE 64000
|
||||||
|
|
||||||
extern u16 frameBufferIndex;
|
extern u16 frameBufferIndex;
|
||||||
extern u32 gGlobalTimer;
|
extern u32 gGlobalTimer;
|
||||||
|
|
|
@ -217,13 +217,7 @@ void create_task_structure(void) {
|
||||||
gGfxSPTask->msgqueue = &D_80339CB8;
|
gGfxSPTask->msgqueue = &D_80339CB8;
|
||||||
gGfxSPTask->msg = (OSMesg) 2;
|
gGfxSPTask->msg = (OSMesg) 2;
|
||||||
gGfxSPTask->task.t.type = M_GFXTASK;
|
gGfxSPTask->task.t.type = M_GFXTASK;
|
||||||
#if TARGET_N64
|
|
||||||
gGfxSPTask->task.t.ucode_boot = rspF3DBootStart;
|
|
||||||
gGfxSPTask->task.t.ucode_boot_size = ((u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart);
|
|
||||||
gGfxSPTask->task.t.flags = 0;
|
|
||||||
gGfxSPTask->task.t.ucode = rspF3DStart;
|
|
||||||
gGfxSPTask->task.t.ucode_data = rspF3DDataStart;
|
|
||||||
#endif
|
|
||||||
gGfxSPTask->task.t.ucode_size = SP_UCODE_SIZE; // (this size is ignored)
|
gGfxSPTask->task.t.ucode_size = SP_UCODE_SIZE; // (this size is ignored)
|
||||||
gGfxSPTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE;
|
gGfxSPTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||||
gGfxSPTask->task.t.dram_stack = (u64 *) gGfxSPTaskStack;
|
gGfxSPTask->task.t.dram_stack = (u64 *) gGfxSPTaskStack;
|
||||||
|
@ -267,33 +261,9 @@ void end_master_display_list(void) {
|
||||||
create_task_structure();
|
create_task_structure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_reset_bars(void) {
|
//void draw_reset_bars(void) { // TARGET_64 only
|
||||||
s32 sp24;
|
// Stubbed. Only N64 target uses this
|
||||||
s32 sp20;
|
// }
|
||||||
s32 fbNum;
|
|
||||||
u64 *sp18;
|
|
||||||
|
|
||||||
if (gResetTimer != 0 && D_8032C648 < 15) {
|
|
||||||
if (sCurrFBNum == 0) {
|
|
||||||
fbNum = 2;
|
|
||||||
} else {
|
|
||||||
fbNum = sCurrFBNum - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sp18 = (u64 *) PHYSICAL_TO_VIRTUAL(gPhysicalFrameBuffers[fbNum]);
|
|
||||||
sp18 += D_8032C648++ * (SCREEN_WIDTH / 4);
|
|
||||||
|
|
||||||
for (sp24 = 0; sp24 < ((SCREEN_HEIGHT / 16) + 1); sp24++) {
|
|
||||||
// Must be on one line to match -O2
|
|
||||||
for (sp20 = 0; sp20 < (SCREEN_WIDTH / 4); sp20++) *sp18++ = 0;
|
|
||||||
sp18 += ((SCREEN_WIDTH / 4) * 14);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
osWritebackDCacheAll();
|
|
||||||
osRecvMesg(&gGameVblankQueue, &D_80339BEC, OS_MESG_BLOCK);
|
|
||||||
osRecvMesg(&gGameVblankQueue, &D_80339BEC, OS_MESG_BLOCK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rendering_init(void) {
|
void rendering_init(void) {
|
||||||
gGfxPool = &gGfxPools[0];
|
gGfxPool = &gGfxPools[0];
|
||||||
|
@ -626,16 +596,12 @@ void setup_game_memory(void) {
|
||||||
load_segment_decompress(2, _segment2_mio0SegmentRomStart, _segment2_mio0SegmentRomEnd);
|
load_segment_decompress(2, _segment2_mio0SegmentRomStart, _segment2_mio0SegmentRomEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
static struct LevelCommand *levelCommandAddr;
|
static struct LevelCommand *levelCommandAddr;
|
||||||
#endif
|
|
||||||
|
|
||||||
// main game loop thread. runs forever as long as the game
|
// main game loop thread. runs forever as long as the game
|
||||||
// continues.
|
// continues.
|
||||||
void thread5_game_loop(UNUSED void *arg) {
|
void thread5_game_loop(UNUSED void *arg) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
struct LevelCommand *levelCommandAddr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setup_game_memory();
|
setup_game_memory();
|
||||||
#ifdef VERSION_SH
|
#ifdef VERSION_SH
|
||||||
|
@ -655,32 +621,21 @@ void thread5_game_loop(UNUSED void *arg) {
|
||||||
play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0);
|
play_music(SEQ_PLAYER_SFX, SEQUENCE_ARGS(0, SEQ_SOUND_PLAYER), 0);
|
||||||
set_sound_mode(save_file_get_sound_mode());
|
set_sound_mode(save_file_get_sound_mode());
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
func_80247ED8();
|
|
||||||
rendering_init();
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
#else
|
|
||||||
gGlobalTimer++;
|
gGlobalTimer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_loop_one_iteration(void) {
|
void game_loop_one_iteration(void) {
|
||||||
#endif
|
|
||||||
// if the reset timer is active, run the process to reset the game.
|
// if the reset timer is active, run the process to reset the game.
|
||||||
if (gResetTimer) {
|
//if (gResetTimer) {
|
||||||
|
// draw_reset_bars(); (N64 target only?)
|
||||||
|
//}
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
draw_reset_bars();
|
|
||||||
continue;
|
|
||||||
#else
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
profiler_log_thread5_time(THREAD5_START);
|
profiler_log_thread5_time(THREAD5_START);
|
||||||
|
|
||||||
// if any controllers are plugged in, start read the data for when
|
// if any controllers are plugged in, start read the data for when
|
||||||
// read_controller_inputs is called later.
|
// read_controller_inputs is called later.
|
||||||
if (gControllerBits) {
|
if (gControllerBits) {
|
||||||
|
|
||||||
#ifdef VERSION_SH
|
#ifdef VERSION_SH
|
||||||
block_until_rumble_pak_free();
|
block_until_rumble_pak_free();
|
||||||
#endif
|
#endif
|
||||||
|
@ -699,7 +654,5 @@ void game_loop_one_iteration(void) {
|
||||||
// amount of free space remaining.
|
// amount of free space remaining.
|
||||||
print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead);
|
print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead);
|
||||||
}
|
}
|
||||||
#ifdef TARGET_N64
|
// } was here for ifdef targ 64
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern struct MarioAnimation gDemo;
|
||||||
extern u8 gMarioAnims[];
|
extern u8 gMarioAnims[];
|
||||||
extern u8 gDemoInputs[];
|
extern u8 gDemoInputs[];
|
||||||
|
|
||||||
#define GFX_POOL_SIZE 6400
|
#define GFX_POOL_SIZE 64000
|
||||||
|
|
||||||
struct GfxPool {
|
struct GfxPool {
|
||||||
Gfx buffer[GFX_POOL_SIZE];
|
Gfx buffer[GFX_POOL_SIZE];
|
||||||
|
@ -71,7 +71,7 @@ extern void clear_viewport(Vp *, s32);
|
||||||
void make_viewport_clip_rect(Vp *viewport);
|
void make_viewport_clip_rect(Vp *viewport);
|
||||||
extern void init_render_image(void);
|
extern void init_render_image(void);
|
||||||
extern void end_master_display_list(void);
|
extern void end_master_display_list(void);
|
||||||
extern void draw_reset_bars(void);
|
//extern void draw_reset_bars(void); Target_64 only. Not used
|
||||||
extern void rendering_init(void);
|
extern void rendering_init(void);
|
||||||
extern void config_gfx_pool(void);
|
extern void config_gfx_pool(void);
|
||||||
extern void display_and_vsync(void);
|
extern void display_and_vsync(void);
|
||||||
|
|
|
@ -46,11 +46,8 @@ s8 gFlyingCarpetState;
|
||||||
*
|
*
|
||||||
* Texture coordinates are s10.5 fixed-point, which means you should left-shift the actual coordinates by 5.
|
* Texture coordinates are s10.5 fixed-point, which means you should left-shift the actual coordinates by 5.
|
||||||
*/
|
*/
|
||||||
#ifdef TARGET_N64
|
|
||||||
void make_vertex(Vtx *vtx, s32 n, s16 x, s16 y, s16 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a) {
|
|
||||||
#else
|
|
||||||
void make_vertex(Vtx *vtx, s32 n, f32 x, f32 y, f32 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a) {
|
void make_vertex(Vtx *vtx, s32 n, f32 x, f32 y, f32 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a) {
|
||||||
#endif
|
|
||||||
vtx[n].v.ob[0] = x;
|
vtx[n].v.ob[0] = x;
|
||||||
vtx[n].v.ob[1] = y;
|
vtx[n].v.ob[1] = y;
|
||||||
vtx[n].v.ob[2] = z;
|
vtx[n].v.ob[2] = z;
|
||||||
|
|
|
@ -12,15 +12,9 @@ enum FlyingCarpetState
|
||||||
|
|
||||||
extern s8 gFlyingCarpetState;
|
extern s8 gFlyingCarpetState;
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
extern void make_vertex(
|
|
||||||
Vtx *vtx, s32 n, s16 x, s16 y, s16 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a
|
|
||||||
);
|
|
||||||
#else
|
|
||||||
extern void make_vertex(
|
extern void make_vertex(
|
||||||
Vtx *vtx, s32 n, f32 x, f32 y, f32 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a
|
Vtx *vtx, s32 n, f32 x, f32 y, f32 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
extern s16 round_float(f32);
|
extern s16 round_float(f32);
|
||||||
extern Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
extern Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||||
extern Gfx *geo_exec_flying_carpet_timer_update(s32 callContext, struct GraphNode *node,
|
extern Gfx *geo_exec_flying_carpet_timer_update(s32 callContext, struct GraphNode *node,
|
||||||
|
|
|
@ -131,14 +131,7 @@ void create_dl_identity_matrix(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
matrix->m[0][0] = 0x00010000; matrix->m[1][0] = 0x00000000; matrix->m[2][0] = 0x00000000; matrix->m[3][0] = 0x00000000;
|
|
||||||
matrix->m[0][1] = 0x00000000; matrix->m[1][1] = 0x00010000; matrix->m[2][1] = 0x00000000; matrix->m[3][1] = 0x00000000;
|
|
||||||
matrix->m[0][2] = 0x00000001; matrix->m[1][2] = 0x00000000; matrix->m[2][2] = 0x00000000; matrix->m[3][2] = 0x00000000;
|
|
||||||
matrix->m[0][3] = 0x00000000; matrix->m[1][3] = 0x00000001; matrix->m[2][3] = 0x00000000; matrix->m[3][3] = 0x00000000;
|
|
||||||
#else
|
|
||||||
guMtxIdent(matrix);
|
guMtxIdent(matrix);
|
||||||
#endif
|
|
||||||
|
|
||||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||||
|
@ -1802,25 +1795,18 @@ void render_dialog_entries(void) {
|
||||||
render_dialog_box_type(dialog, dialog->linesPerBox);
|
render_dialog_box_type(dialog, dialog->linesPerBox);
|
||||||
|
|
||||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE,
|
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE,
|
||||||
#ifdef TARGET_N64
|
|
||||||
ensure_nonnegative(dialog->leftOffset),
|
|
||||||
#else
|
|
||||||
0,
|
0,
|
||||||
#endif
|
|
||||||
ensure_nonnegative(DIAG_VAL2 - dialog->width),
|
ensure_nonnegative(DIAG_VAL2 - dialog->width),
|
||||||
#ifdef VERSION_EU
|
#ifdef VERSION_EU
|
||||||
#ifdef TARGET_N64
|
|
||||||
ensure_nonnegative(dialog->leftOffset + DIAG_VAL3 / gDialogBoxScale),
|
|
||||||
#else
|
|
||||||
SCREEN_WIDTH,
|
SCREEN_WIDTH,
|
||||||
#endif
|
|
||||||
ensure_nonnegative((240 - dialog->width) + ((dialog->linesPerBox * 80) / DIAG_VAL4) / gDialogBoxScale));
|
ensure_nonnegative((240 - dialog->width) + ((dialog->linesPerBox * 80) / DIAG_VAL4) / gDialogBoxScale));
|
||||||
#else
|
#else
|
||||||
#ifdef TARGET_N64
|
|
||||||
ensure_nonnegative(DIAG_VAL3 + dialog->leftOffset),
|
|
||||||
#else
|
|
||||||
SCREEN_WIDTH,
|
SCREEN_WIDTH,
|
||||||
#endif
|
|
||||||
ensure_nonnegative(240 + ((dialog->linesPerBox * 80) / DIAG_VAL4) - dialog->width));
|
ensure_nonnegative(240 + ((dialog->linesPerBox * 80) / DIAG_VAL4) - dialog->width));
|
||||||
#endif
|
#endif
|
||||||
#if defined(VERSION_JP) || defined(VERSION_SH)
|
#if defined(VERSION_JP) || defined(VERSION_SH)
|
||||||
|
@ -2133,12 +2119,9 @@ void shade_screen(void) {
|
||||||
|
|
||||||
// This is a bit weird. It reuses the dialog text box (width 130, height -80),
|
// This is a bit weird. It reuses the dialog text box (width 130, height -80),
|
||||||
// so scale to at least fit the screen.
|
// so scale to at least fit the screen.
|
||||||
#ifdef TARGET_N64
|
|
||||||
create_dl_scale_matrix(MENU_MTX_NOPUSH, 2.6f, 3.4f, 1.0f);
|
|
||||||
#else
|
|
||||||
create_dl_scale_matrix(MENU_MTX_NOPUSH,
|
create_dl_scale_matrix(MENU_MTX_NOPUSH,
|
||||||
GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_HEIGHT / 130.0f, 3.0f, 1.0f);
|
GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_HEIGHT / 130.0f, 3.0f, 1.0f);
|
||||||
#endif
|
|
||||||
|
|
||||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 110);
|
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 110);
|
||||||
gSPDisplayList(gDisplayListHead++, dl_draw_text_bg_box);
|
gSPDisplayList(gDisplayListHead++, dl_draw_text_bg_box);
|
||||||
|
|
|
@ -328,7 +328,7 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
// PC Port, so always use below
|
||||||
u32 get_special_objects_size(s16 *data) {
|
u32 get_special_objects_size(s16 *data) {
|
||||||
s16 *startPos = data;
|
s16 *startPos = data;
|
||||||
s32 numOfSpecialObjects;
|
s32 numOfSpecialObjects;
|
||||||
|
@ -372,4 +372,3 @@ u32 get_special_objects_size(s16 *data) {
|
||||||
|
|
||||||
return data - startPos;
|
return data - startPos;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ extern void spawn_macro_abs_special(u32 model, const BehaviorScript *behavior, s
|
||||||
extern void spawn_macro_objects(s16 areaIndex, s16 * macroObjList);
|
extern void spawn_macro_objects(s16 areaIndex, s16 * macroObjList);
|
||||||
extern void spawn_macro_objects_hardcoded(s16 areaIndex, s16 * macroObjList);
|
extern void spawn_macro_objects_hardcoded(s16 areaIndex, s16 * macroObjList);
|
||||||
extern void spawn_special_objects(s16 areaIndex, s16 ** specialObjList);
|
extern void spawn_special_objects(s16 areaIndex, s16 ** specialObjList);
|
||||||
#ifndef TARGET_N64
|
|
||||||
extern u32 get_special_objects_size(s16 *data);
|
extern u32 get_special_objects_size(s16 *data);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* MACRO_SPECIAL_OBJECTS_H */
|
#endif /* MACRO_SPECIAL_OBJECTS_H */
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include <ultra64.h>
|
#include <ultra64.h>
|
||||||
#ifndef TARGET_N64
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sm64.h"
|
#include "sm64.h"
|
||||||
|
|
||||||
|
@ -78,27 +76,6 @@ void *get_segment_base_addr(s32 segment) {
|
||||||
return (void *) (sSegmentTable[segment] | 0x80000000);
|
return (void *) (sSegmentTable[segment] | 0x80000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
void *segmented_to_virtual(const void *addr) {
|
|
||||||
size_t segment = (uintptr_t) addr >> 24;
|
|
||||||
size_t offset = (uintptr_t) addr & 0x00FFFFFF;
|
|
||||||
|
|
||||||
return (void *) ((sSegmentTable[segment] + offset) | 0x80000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *virtual_to_segmented(u32 segment, const void *addr) {
|
|
||||||
size_t offset = ((uintptr_t) addr & 0x1FFFFFFF) - sSegmentTable[segment];
|
|
||||||
|
|
||||||
return (void *) ((segment << 24) + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void move_segment_table_to_dmem(void) {
|
|
||||||
s32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
gSPSegment(gDisplayListHead++, i, sSegmentTable[i]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
void *segmented_to_virtual(const void *addr) {
|
void *segmented_to_virtual(const void *addr) {
|
||||||
return (void *) addr;
|
return (void *) addr;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +86,7 @@ void *virtual_to_segmented(u32 segment, const void *addr) {
|
||||||
|
|
||||||
void move_segment_table_to_dmem(void) {
|
void move_segment_table_to_dmem(void) {
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the main memory pool. This pool is conceptually a pair of stacks
|
* Initialize the main memory pool. This pool is conceptually a pair of stacks
|
||||||
|
@ -248,22 +225,8 @@ u32 main_pool_pop_state(void) {
|
||||||
*/
|
*/
|
||||||
static void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) {
|
static void dma_read(u8 *dest, u8 *srcStart, u8 *srcEnd) {
|
||||||
u32 size = ALIGN16(srcEnd - srcStart);
|
u32 size = ALIGN16(srcEnd - srcStart);
|
||||||
#ifdef TARGET_N64
|
|
||||||
osInvalDCache(dest, size);
|
|
||||||
while (size != 0) {
|
|
||||||
u32 copySize = (size >= 0x1000) ? 0x1000 : size;
|
|
||||||
|
|
||||||
osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ, (uintptr_t) srcStart, dest, copySize,
|
|
||||||
&gDmaMesgQueue);
|
|
||||||
osRecvMesg(&gDmaMesgQueue, &D_80339BEC, OS_MESG_BLOCK);
|
|
||||||
|
|
||||||
dest += copySize;
|
|
||||||
srcStart += copySize;
|
|
||||||
size -= copySize;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
memcpy(dest, srcStart, srcEnd - srcStart);
|
memcpy(dest, srcStart, srcEnd - srcStart);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,103 +244,6 @@ static void *dynamic_dma_read(u8 *srcStart, u8 *srcEnd, u32 side) {
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
/**
|
|
||||||
* Load data from ROM into a newly allocated block, and set the segment base
|
|
||||||
* address to this block.
|
|
||||||
*/
|
|
||||||
void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side) {
|
|
||||||
void *addr = dynamic_dma_read(srcStart, srcEnd, side);
|
|
||||||
|
|
||||||
if (addr != NULL) {
|
|
||||||
set_segment_base_addr(segment, addr);
|
|
||||||
}
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate a block of memory starting at destAddr and ending at the righthand
|
|
||||||
* end of the memory pool. Then copy srcStart through srcEnd from ROM to this
|
|
||||||
* block.
|
|
||||||
* If this block is not large enough to hold the ROM data, or that portion
|
|
||||||
* of the pool is already allocated, return NULL.
|
|
||||||
*/
|
|
||||||
void *load_to_fixed_pool_addr(u8 *destAddr, u8 *srcStart, u8 *srcEnd) {
|
|
||||||
void *dest = NULL;
|
|
||||||
u32 srcSize = ALIGN16(srcEnd - srcStart);
|
|
||||||
u32 destSize = ALIGN16((u8 *) sPoolListHeadR - destAddr);
|
|
||||||
|
|
||||||
if (srcSize <= destSize) {
|
|
||||||
dest = main_pool_alloc(destSize, MEMORY_POOL_RIGHT);
|
|
||||||
if (dest != NULL) {
|
|
||||||
bzero(dest, destSize);
|
|
||||||
osWritebackDCacheAll();
|
|
||||||
dma_read(dest, srcStart, srcEnd);
|
|
||||||
osInvalICache(dest, destSize);
|
|
||||||
osInvalDCache(dest, destSize);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decompress the block of ROM data from srcStart to srcEnd and return a
|
|
||||||
* pointer to an allocated buffer holding the decompressed data. Set the
|
|
||||||
* base address of segment to this address.
|
|
||||||
*/
|
|
||||||
void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
|
||||||
void *dest = NULL;
|
|
||||||
|
|
||||||
u32 compSize = ALIGN16(srcEnd - srcStart);
|
|
||||||
u8 *compressed = main_pool_alloc(compSize, MEMORY_POOL_RIGHT);
|
|
||||||
|
|
||||||
// Decompressed size from mio0 header
|
|
||||||
u32 *size = (u32 *) (compressed + 4);
|
|
||||||
|
|
||||||
if (compressed != NULL) {
|
|
||||||
dma_read(compressed, srcStart, srcEnd);
|
|
||||||
dest = main_pool_alloc(*size, MEMORY_POOL_LEFT);
|
|
||||||
if (dest != NULL) {
|
|
||||||
decompress(compressed, dest);
|
|
||||||
set_segment_base_addr(segment, dest);
|
|
||||||
main_pool_free(compressed);
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) {
|
|
||||||
UNUSED void *dest = NULL;
|
|
||||||
u32 compSize = ALIGN16(srcEnd - srcStart);
|
|
||||||
u8 *compressed = main_pool_alloc(compSize, MEMORY_POOL_RIGHT);
|
|
||||||
UNUSED u32 *pUncSize = (u32 *) (compressed + 4);
|
|
||||||
|
|
||||||
if (compressed != NULL) {
|
|
||||||
dma_read(compressed, srcStart, srcEnd);
|
|
||||||
decompress(compressed, gDecompressionHeap);
|
|
||||||
set_segment_base_addr(segment, gDecompressionHeap);
|
|
||||||
main_pool_free(compressed);
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
return gDecompressionHeap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void load_engine_code_segment(void) {
|
|
||||||
void *startAddr = (void *) SEG_ENGINE;
|
|
||||||
u32 totalSize = SEG_FRAMEBUFFERS - SEG_ENGINE;
|
|
||||||
UNUSED u32 alignedSize = ALIGN16(_engineSegmentRomEnd - _engineSegmentRomStart);
|
|
||||||
|
|
||||||
bzero(startAddr, totalSize);
|
|
||||||
osWritebackDCacheAll();
|
|
||||||
dma_read(startAddr, _engineSegmentRomStart, _engineSegmentRomEnd);
|
|
||||||
osInvalICache(startAddr, totalSize);
|
|
||||||
osInvalDCache(startAddr, totalSize);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate an allocation-only pool from the main pool. This pool doesn't
|
* Allocate an allocation-only pool from the main pool. This pool doesn't
|
||||||
* support freeing allocated memory.
|
* support freeing allocated memory.
|
||||||
|
|
|
@ -37,19 +37,11 @@ u32 main_pool_available(void);
|
||||||
u32 main_pool_push_state(void);
|
u32 main_pool_push_state(void);
|
||||||
u32 main_pool_pop_state(void);
|
u32 main_pool_pop_state(void);
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
void *load_segment(s32 segment, u8 *srcStart, u8 *srcEnd, u32 side);
|
|
||||||
void *load_to_fixed_pool_addr(u8 *destAddr, u8 *srcStart, u8 *srcEnd);
|
|
||||||
void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd);
|
|
||||||
void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd);
|
|
||||||
void load_engine_code_segment(void);
|
|
||||||
#else
|
|
||||||
#define load_segment(...)
|
#define load_segment(...)
|
||||||
#define load_to_fixed_pool_addr(...)
|
#define load_to_fixed_pool_addr(...)
|
||||||
#define load_segment_decompress(...)
|
#define load_segment_decompress(...)
|
||||||
#define load_segment_decompress_heap(...)
|
#define load_segment_decompress_heap(...)
|
||||||
#define load_engine_code_segment(...)
|
#define load_engine_code_segment(...)
|
||||||
#endif
|
|
||||||
|
|
||||||
struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side);
|
struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side);
|
||||||
void *alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size);
|
void *alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size);
|
||||||
|
|
|
@ -366,29 +366,6 @@ void add_glyph_texture(s8 glyphIndex) {
|
||||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_load_tex_block);
|
gSPDisplayList(gDisplayListHead++, dl_hud_img_load_tex_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
/**
|
|
||||||
* Clips textrect into the boundaries defined.
|
|
||||||
*/
|
|
||||||
void clip_to_bounds(s32 *x, s32 *y) {
|
|
||||||
if (*x < TEXRECT_MIN_X) {
|
|
||||||
*x = TEXRECT_MIN_X;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*x > TEXRECT_MAX_X) {
|
|
||||||
*x = TEXRECT_MAX_X;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*y < TEXRECT_MIN_Y) {
|
|
||||||
*y = TEXRECT_MIN_Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*y > TEXRECT_MAX_Y) {
|
|
||||||
*y = TEXRECT_MAX_Y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the glyph that's set at the given position.
|
* Renders the glyph that's set at the given position.
|
||||||
*/
|
*/
|
||||||
|
@ -398,9 +375,6 @@ void render_textrect(s32 x, s32 y, s32 pos) {
|
||||||
s32 rectX;
|
s32 rectX;
|
||||||
s32 rectY;
|
s32 rectY;
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
clip_to_bounds(&rectBaseX, &rectBaseY);
|
|
||||||
#endif
|
|
||||||
rectX = rectBaseX;
|
rectX = rectBaseX;
|
||||||
rectY = rectBaseY;
|
rectY = rectBaseY;
|
||||||
gSPTextureRectangle(gDisplayListHead++, rectX << 2, rectY << 2, (rectX + 15) << 2,
|
gSPTextureRectangle(gDisplayListHead++, rectX << 2, rectY << 2, (rectX + 15) << 2,
|
||||||
|
|
|
@ -506,11 +506,7 @@ static void geo_process_background(struct GraphNodeBackground *node) {
|
||||||
if (list != 0) {
|
if (list != 0) {
|
||||||
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
|
geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(list), node->fnNode.node.flags >> 8);
|
||||||
} else if (gCurGraphNodeMasterList != NULL) {
|
} else if (gCurGraphNodeMasterList != NULL) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
Gfx *gfxStart = alloc_display_list(sizeof(Gfx) * 7);
|
|
||||||
#else
|
|
||||||
Gfx *gfxStart = alloc_display_list(sizeof(Gfx) * 8);
|
Gfx *gfxStart = alloc_display_list(sizeof(Gfx) * 8);
|
||||||
#endif
|
|
||||||
Gfx *gfx = gfxStart;
|
Gfx *gfx = gfxStart;
|
||||||
|
|
||||||
gDPPipeSync(gfx++);
|
gDPPipeSync(gfx++);
|
||||||
|
@ -757,9 +753,7 @@ static int obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
|
||||||
// the amount of units between the center of the screen and the horizontal edge
|
// the amount of units between the center of the screen and the horizontal edge
|
||||||
// given the distance from the object to the camera.
|
// given the distance from the object to the camera.
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
hScreenEdge *= GFX_DIMENSIONS_ASPECT_RATIO;
|
hScreenEdge *= GFX_DIMENSIONS_ASPECT_RATIO;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (geo != NULL && geo->type == GRAPH_NODE_TYPE_CULLING_RADIUS) {
|
if (geo != NULL && geo->type == GRAPH_NODE_TYPE_CULLING_RADIUS) {
|
||||||
cullingRadius =
|
cullingRadius =
|
||||||
|
|
|
@ -241,13 +241,10 @@ int render_screen_transition(s8 fadeTimer, s8 transType, u8 transTime, struct Wa
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx *render_cannon_circle_base(void) {
|
Gfx *render_cannon_circle_base(void) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
Vtx *verts = alloc_display_list(4 * sizeof(*verts));
|
|
||||||
Gfx *dlist = alloc_display_list(16 * sizeof(*dlist));
|
|
||||||
#else
|
|
||||||
Vtx *verts = alloc_display_list(8 * sizeof(*verts));
|
Vtx *verts = alloc_display_list(8 * sizeof(*verts));
|
||||||
Gfx *dlist = alloc_display_list(20 * sizeof(*dlist));
|
Gfx *dlist = alloc_display_list(20 * sizeof(*dlist));
|
||||||
#endif
|
|
||||||
Gfx *g = dlist;
|
Gfx *g = dlist;
|
||||||
|
|
||||||
if (verts != NULL && dlist != NULL) {
|
if (verts != NULL && dlist != NULL) {
|
||||||
|
@ -256,12 +253,10 @@ Gfx *render_cannon_circle_base(void) {
|
||||||
make_vertex(verts, 2, SCREEN_WIDTH, SCREEN_HEIGHT, -1, 1152, 192, 0, 0, 0, 255);
|
make_vertex(verts, 2, SCREEN_WIDTH, SCREEN_HEIGHT, -1, 1152, 192, 0, 0, 0, 255);
|
||||||
make_vertex(verts, 3, 0, SCREEN_HEIGHT, -1, -1152, 192, 0, 0, 0, 255);
|
make_vertex(verts, 3, 0, SCREEN_HEIGHT, -1, -1152, 192, 0, 0, 0, 255);
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
make_vertex(verts, 4, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
|
make_vertex(verts, 4, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
|
||||||
make_vertex(verts, 5, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
|
make_vertex(verts, 5, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), 0, -1, 0, 0, 0, 0, 0, 255);
|
||||||
make_vertex(verts, 6, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
|
make_vertex(verts, 6, GFX_DIMENSIONS_FROM_RIGHT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
|
||||||
make_vertex(verts, 7, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
|
make_vertex(verts, 7, GFX_DIMENSIONS_FROM_LEFT_EDGE(0), SCREEN_HEIGHT, -1, 0, 0, 0, 0, 0, 255);
|
||||||
#endif
|
|
||||||
|
|
||||||
gSPDisplayList(g++, dl_proj_mtx_fullscreen);
|
gSPDisplayList(g++, dl_proj_mtx_fullscreen);
|
||||||
gDPSetCombineMode(g++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
gDPSetCombineMode(g++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
||||||
|
@ -272,12 +267,12 @@ Gfx *render_cannon_circle_base(void) {
|
||||||
gSPVertex(g++, VIRTUAL_TO_PHYSICAL(verts), 4, 0);
|
gSPVertex(g++, VIRTUAL_TO_PHYSICAL(verts), 4, 0);
|
||||||
gSPDisplayList(g++, dl_draw_quad_verts_0123);
|
gSPDisplayList(g++, dl_draw_quad_verts_0123);
|
||||||
gSPTexture(g++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
gSPTexture(g++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||||
#ifndef TARGET_N64
|
|
||||||
gDPSetCombineMode(g++, G_CC_SHADE, G_CC_SHADE);
|
gDPSetCombineMode(g++, G_CC_SHADE, G_CC_SHADE);
|
||||||
gSPVertex(g++, VIRTUAL_TO_PHYSICAL(verts + 4), 4, 4);
|
gSPVertex(g++, VIRTUAL_TO_PHYSICAL(verts + 4), 4, 4);
|
||||||
gSP2Triangles(g++, 4, 0, 3, 0, 4, 3, 7, 0);
|
gSP2Triangles(g++, 4, 0, 3, 0, 4, 3, 7, 0);
|
||||||
gSP2Triangles(g++, 1, 5, 6, 0, 1, 6, 2, 0);
|
gSP2Triangles(g++, 1, 5, 6, 0, 1, 6, 2, 0);
|
||||||
#endif
|
|
||||||
gSPDisplayList(g++, dl_screen_transition_end);
|
gSPDisplayList(g++, dl_screen_transition_end);
|
||||||
gSPEndDisplayList(g);
|
gSPEndDisplayList(g);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -242,7 +242,6 @@ void *create_skybox_ortho_matrix(s8 player) {
|
||||||
f32 top = sSkyBoxInfo[player].scaledY;
|
f32 top = sSkyBoxInfo[player].scaledY;
|
||||||
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
||||||
|
|
||||||
#ifndef TARGET_N64
|
|
||||||
f32 half_width = (4.0f / 3.0f) / GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_WIDTH / 2;
|
f32 half_width = (4.0f / 3.0f) / GFX_DIMENSIONS_ASPECT_RATIO * SCREEN_WIDTH / 2;
|
||||||
f32 center = (sSkyBoxInfo[player].scaledX + SCREEN_WIDTH / 2);
|
f32 center = (sSkyBoxInfo[player].scaledX + SCREEN_WIDTH / 2);
|
||||||
if (half_width < SCREEN_WIDTH / 2) {
|
if (half_width < SCREEN_WIDTH / 2) {
|
||||||
|
@ -250,7 +249,6 @@ void *create_skybox_ortho_matrix(s8 player) {
|
||||||
left = center - half_width;
|
left = center - half_width;
|
||||||
right = center + half_width;
|
right = center + half_width;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mtx != NULL) {
|
if (mtx != NULL) {
|
||||||
guOrtho(mtx, left, right, bottom, top, 0.0f, 3.0f, 1.0f);
|
guOrtho(mtx, left, right, bottom, top, 0.0f, 3.0f, 1.0f);
|
||||||
|
|
|
@ -27,15 +27,9 @@
|
||||||
#define MAX_GD_DLS 1000
|
#define MAX_GD_DLS 1000
|
||||||
#define OS_MESG_SI_COMPLETE 0x33333333
|
#define OS_MESG_SI_COMPLETE 0x33333333
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
#define GD_VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr) &0x0FFFFFFF)
|
|
||||||
#define GD_LOWER_24(addr) ((uintptr_t)(addr) &0x00FFFFFF)
|
|
||||||
#define GD_LOWER_29(addr) (((uintptr_t)(addr)) & 0x1FFFFFFF)
|
|
||||||
#else
|
|
||||||
#define GD_VIRTUAL_TO_PHYSICAL(addr) (addr)
|
#define GD_VIRTUAL_TO_PHYSICAL(addr) (addr)
|
||||||
#define GD_LOWER_24(addr) ((uintptr_t)(addr))
|
#define GD_LOWER_24(addr) ((uintptr_t)(addr))
|
||||||
#define GD_LOWER_29(addr) (((uintptr_t)(addr)))
|
#define GD_LOWER_29(addr) (((uintptr_t)(addr)))
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MTX_INTPART_PACK(w1, w2) (((w1) &0xFFFF0000) | (((w2) >> 16) & 0xFFFF))
|
#define MTX_INTPART_PACK(w1, w2) (((w1) &0xFFFF0000) | (((w2) >> 16) & 0xFFFF))
|
||||||
#define MTX_FRACPART_PACK(w1, w2) ((((w1) << 16) & 0xFFFF0000) | ((w2) &0xFFFF))
|
#define MTX_FRACPART_PACK(w1, w2) ((((w1) << 16) & 0xFFFF0000) | ((w2) &0xFFFF))
|
||||||
|
@ -1691,27 +1685,9 @@ u32 Unknown8019EC88(Gfx *dl, UNUSED s32 arg1) {
|
||||||
|
|
||||||
/* 24D4C4 -> 24D63C; orig name: func_8019ECF4 */
|
/* 24D4C4 -> 24D63C; orig name: func_8019ECF4 */
|
||||||
void mat4_to_mtx(const Mat4f *src, Mtx *dst) {
|
void mat4_to_mtx(const Mat4f *src, Mtx *dst) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
s32 i; // 14
|
|
||||||
s32 j; // 10
|
|
||||||
s32 w1;
|
|
||||||
s32 w2;
|
|
||||||
s32 *mtxInt = (s32 *) dst->m[0]; // s32 part
|
|
||||||
s32 *mtxFrc = (s32 *) dst->m[2]; // frac part
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
|
||||||
for (j = 0; j < 2; j++) {
|
|
||||||
w1 = (s32)((*src)[i][j * 2] * 65536.0f);
|
|
||||||
w2 = (s32)((*src)[i][j * 2 + 1] * 65536.0f);
|
|
||||||
*mtxInt = MTX_INTPART_PACK(w1, w2);
|
|
||||||
mtxInt++;
|
|
||||||
*mtxFrc = MTX_FRACPART_PACK(w1, w2);
|
|
||||||
mtxFrc++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
guMtxF2L(src, dst);
|
guMtxF2L(src, dst);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 24D63C -> 24D6E4; orig name: func_8019EE6C */
|
/* 24D63C -> 24D6E4; orig name: func_8019EE6C */
|
||||||
|
@ -3632,89 +3608,9 @@ void Unknown801A6E30(UNUSED u32 a0) {
|
||||||
void Unknown801A6E44(UNUSED u32 a0) {
|
void Unknown801A6E44(UNUSED u32 a0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_N64
|
|
||||||
/* 255628 -> 255704; orig name: func_801A6E58 */
|
|
||||||
void gd_block_dma(u32 devAddr, void *vAddr, s32 size) {
|
|
||||||
s32 transfer; // 2c
|
|
||||||
|
|
||||||
do {
|
|
||||||
if ((transfer = size) > 0x1000) {
|
|
||||||
transfer = 0x1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
osPiStartDma(&D_801BE980, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, transfer, &sGdDMAQueue);
|
|
||||||
osRecvMesg(&sGdDMAQueue, &D_801BE97C, OS_MESG_BLOCK);
|
|
||||||
devAddr += transfer;
|
|
||||||
vAddr = (void *) ((uintptr_t) vAddr + transfer);
|
|
||||||
size -= 0x1000;
|
|
||||||
} while (size > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 255704 -> 255988 */
|
|
||||||
struct GdObj *load_dynlist(struct DynList *dynlist) {
|
|
||||||
u32 segSize; // 4c
|
|
||||||
u8 *allocSegSpace; // 48
|
|
||||||
void *allocPtr; // 44
|
|
||||||
uintptr_t dynlistSegStart; // 40
|
|
||||||
uintptr_t dynlistSegEnd; // 3c
|
|
||||||
s32 i; // 38
|
|
||||||
s32 sp34; // tlbPage
|
|
||||||
struct GdObj *loadedList; // 30
|
|
||||||
|
|
||||||
i = -1;
|
|
||||||
|
|
||||||
while (sDynLists[++i].list != NULL) {
|
|
||||||
if (sDynLists[i].list == dynlist) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sDynLists[i].list == NULL) {
|
|
||||||
fatal_printf("load_dynlist() ptr not found in any banks");
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (sDynLists[i].flag) {
|
|
||||||
case STD_LIST_BANK:
|
|
||||||
dynlistSegStart = (uintptr_t) _gd_dynlistsSegmentRomStart;
|
|
||||||
dynlistSegEnd = (uintptr_t) _gd_dynlistsSegmentRomEnd;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fatal_printf("load_dynlist() unkown bank");
|
|
||||||
}
|
|
||||||
|
|
||||||
segSize = dynlistSegEnd - dynlistSegStart;
|
|
||||||
allocSegSpace = gd_malloc_temp(segSize + 0x10000);
|
|
||||||
|
|
||||||
if ((allocPtr = (void *) allocSegSpace) == NULL) {
|
|
||||||
fatal_printf("Not enough DRAM for DATA segment \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
allocSegSpace = (u8 *) (((uintptr_t) allocSegSpace + 0x10000) & 0xFFFF0000);
|
|
||||||
gd_block_dma(dynlistSegStart, (void *) allocSegSpace, segSize);
|
|
||||||
osUnmapTLBAll();
|
|
||||||
|
|
||||||
sp34 = (segSize / 0x10000) / 2 + 1; //? has to be written this way
|
|
||||||
if (sp34 >= 31) {
|
|
||||||
fatal_printf("load_dynlist() too many TLBs");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < sp34; i++) {
|
|
||||||
osMapTLB(i, OS_PM_64K, (void *) (uintptr_t) (0x04000000 + (i * 2 * 0x10000)),
|
|
||||||
GD_LOWER_24(((uintptr_t) allocSegSpace) + (i * 2 * 0x10000)),
|
|
||||||
GD_LOWER_24(((uintptr_t) allocSegSpace) + (i * 2 * 0x10000) + 0x10000), -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
loadedList = proc_dynlist(dynlist);
|
|
||||||
gd_free(allocPtr);
|
|
||||||
osUnmapTLBAll();
|
|
||||||
|
|
||||||
return loadedList;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
struct GdObj *load_dynlist(struct DynList *dynlist) {
|
struct GdObj *load_dynlist(struct DynList *dynlist) {
|
||||||
return proc_dynlist(dynlist);
|
return proc_dynlist(dynlist);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 255988 -> 25599C */
|
/* 255988 -> 25599C */
|
||||||
void stub_801A71B8(UNUSED u32 a0) {
|
void stub_801A71B8(UNUSED u32 a0) {
|
||||||
|
|
|
@ -303,9 +303,7 @@ void convert_gd_verts_to_Vn(struct ObjGroup *grp) {
|
||||||
u8 nx, ny, nz; // 24, 25, 26
|
u8 nx, ny, nz; // 24, 25, 26
|
||||||
UNUSED u32 pad20;
|
UNUSED u32 pad20;
|
||||||
register struct VtxLink *vtxlink; // a1
|
register struct VtxLink *vtxlink; // a1
|
||||||
#ifdef TARGET_N64
|
|
||||||
register s16 *vnPos; // a2
|
|
||||||
#endif
|
|
||||||
register s16 x; // a3
|
register s16 x; // a3
|
||||||
register s16 y; // t0
|
register s16 y; // t0
|
||||||
register s16 z; // t1
|
register s16 z; // t1
|
||||||
|
@ -325,18 +323,12 @@ void convert_gd_verts_to_Vn(struct ObjGroup *grp) {
|
||||||
nz = (u8)(vtx->normal.z * 255.0f);
|
nz = (u8)(vtx->normal.z * 255.0f);
|
||||||
|
|
||||||
for (vtxlink = vtx->gbiVerts; vtxlink != NULL; vtxlink = vtxlink->prev) {
|
for (vtxlink = vtx->gbiVerts; vtxlink != NULL; vtxlink = vtxlink->prev) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
vnPos = vtxlink->data->n.ob;
|
|
||||||
vn = vtxlink->data;
|
|
||||||
*vnPos++ = x;
|
|
||||||
*vnPos++ = y;
|
|
||||||
*vnPos++ = z;
|
|
||||||
#else
|
|
||||||
vn = vtxlink->data;
|
vn = vtxlink->data;
|
||||||
vn->n.ob[0] = x;
|
vn->n.ob[0] = x;
|
||||||
vn->n.ob[1] = y;
|
vn->n.ob[1] = y;
|
||||||
vn->n.ob[2] = z;
|
vn->n.ob[2] = z;
|
||||||
#endif
|
|
||||||
vn->n.n[0] = nx;
|
vn->n.n[0] = nx;
|
||||||
vn->n.n[1] = ny;
|
vn->n.n[1] = ny;
|
||||||
vn->n.n[2] = nz;
|
vn->n.n[2] = nz;
|
||||||
|
@ -348,9 +340,7 @@ void convert_gd_verts_to_Vn(struct ObjGroup *grp) {
|
||||||
void convert_gd_verts_to_Vtx(struct ObjGroup *grp) {
|
void convert_gd_verts_to_Vtx(struct ObjGroup *grp) {
|
||||||
UNUSED u32 pad24[6];
|
UNUSED u32 pad24[6];
|
||||||
register struct VtxLink *vtxlink; // a1
|
register struct VtxLink *vtxlink; // a1
|
||||||
#ifdef TARGET_N64
|
|
||||||
register s16 *vtxcoords; // a2
|
|
||||||
#endif
|
|
||||||
register s16 x; // a3
|
register s16 x; // a3
|
||||||
register s16 y; // t0
|
register s16 y; // t0
|
||||||
register s16 z; // t1
|
register s16 z; // t1
|
||||||
|
@ -366,16 +356,10 @@ void convert_gd_verts_to_Vtx(struct ObjGroup *grp) {
|
||||||
z = (s16) vtx->pos.z;
|
z = (s16) vtx->pos.z;
|
||||||
|
|
||||||
for (vtxlink = vtx->gbiVerts; vtxlink != NULL; vtxlink = vtxlink->prev) {
|
for (vtxlink = vtx->gbiVerts; vtxlink != NULL; vtxlink = vtxlink->prev) {
|
||||||
#ifdef TARGET_N64
|
|
||||||
vtxcoords = vtxlink->data->v.ob;
|
|
||||||
vtxcoords[0] = x;
|
|
||||||
vtxcoords[1] = y;
|
|
||||||
vtxcoords[2] = z;
|
|
||||||
#else
|
|
||||||
vtxlink->data->v.ob[0] = x;
|
vtxlink->data->v.ob[0] = x;
|
||||||
vtxlink->data->v.ob[1] = y;
|
vtxlink->data->v.ob[1] = y;
|
||||||
vtxlink->data->v.ob[2] = z;
|
vtxlink->data->v.ob[2] = z;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue