trig tables shiftable (#596)
This commit is contained in:
parent
12f332614e
commit
c4d596d297
2
Makefile
2
Makefile
|
|
@ -212,7 +212,7 @@ DATA_DIR := data
|
|||
INCLUDE_DIRS := include
|
||||
|
||||
# Directories containing source files
|
||||
SRC_DIRS := src src/data src/racing src/ending src/audio src/debug src/os src/os/math courses
|
||||
SRC_DIRS := src src/data src/buffers src/racing src/ending src/audio src/debug src/os src/os/math courses
|
||||
ASM_DIRS := asm asm/os asm/unused $(DATA_DIR) $(DATA_DIR)/sound_data $(DATA_DIR)/karts
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
#include "src/data/data_800E8700.h"
|
||||
#include "src/data/some_data.h"
|
||||
#include "src/data/path_spawn_data.h"
|
||||
#include "src/data/trig_tables.h"
|
||||
#include "src/buffers/trig_tables.h"
|
||||
#include "src/data_segment2.h"
|
||||
#include "src/effects.h"
|
||||
#include "src/ending/ceremony_and_credits.h"
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef HARDCODED_SEGMENTS_H
|
||||
#define HARDCODED_SEGMENTS_H
|
||||
|
||||
/**
|
||||
* @file Contains hardcoded segment addresses
|
||||
* Only used in the linker
|
||||
**/
|
||||
|
||||
|
||||
#define LINKER_MAIN 0x80000400
|
||||
|
||||
#define LINKER_ENDING 0x80280000
|
||||
|
||||
#define LINKER_RACING 0x8028DF00
|
||||
|
||||
#define LINKER_TRIG_TABLES 0x802BA370
|
||||
|
||||
// End of Jumper pak memory
|
||||
#define RDRAM_END 0x807FFFFF
|
||||
|
||||
#endif /* HARDCODED_SEGMENTS_H */
|
||||
33
mk64.ld
33
mk64.ld
|
|
@ -3,7 +3,14 @@
|
|||
|
||||
OUTPUT_ARCH (mips)
|
||||
|
||||
#include "include/linker_segments.h"
|
||||
#define LINKER_MAIN 0x80000400
|
||||
|
||||
#define LINKER_ENDING 0x80280000
|
||||
|
||||
#define LINKER_RACING 0x8028DF00
|
||||
|
||||
// End of Jumper pak memory
|
||||
#define RDRAM_END 0x807FFFFF
|
||||
|
||||
#define BEGIN_SEG(name, addr) \
|
||||
_##name##SegmentStart = ADDR(.name); \
|
||||
|
|
@ -81,7 +88,7 @@ SECTIONS
|
|||
BUILD_DIR/src/debug/crash_screen_enhancement.o(.text);
|
||||
BUILD_DIR/src/debug/debug.o(.text);
|
||||
BUILD_DIR/src/os/sprintf.o(.text);
|
||||
BUILD_DIR/src/os/is_debug.o(.text);
|
||||
BUILD_DIR/src/os/is_debug.o(.text);
|
||||
#endif
|
||||
BUILD_DIR/src/os/osCreateThread.o(.text);
|
||||
#ifdef VERSION_EU
|
||||
|
|
@ -342,13 +349,15 @@ SECTIONS
|
|||
BUILD_DIR/src/os/osEepromWrite.o(.bss);
|
||||
BUILD_DIR/asm/os/__osException.o(.bss);
|
||||
BUILD_DIR/src/os/osLeoDiskInit.o(.bss);
|
||||
. = ALIGN(0x10);
|
||||
}
|
||||
END_NOLOAD(main)
|
||||
|
||||
/* Checks that segments are not overlapping into the memory pool but is not strictly necessary */
|
||||
BEGIN_NOLOAD(memoryPool)
|
||||
{
|
||||
BUILD_DIR/src/data/memory_pool.o(.bss);
|
||||
BUILD_DIR/src/buffers/memory_pool.o(.bss);
|
||||
. = ALIGN(0x10);
|
||||
}
|
||||
END_NOLOAD(memoryPool)
|
||||
|
||||
|
|
@ -387,19 +396,21 @@ SECTIONS
|
|||
BUILD_DIR/src/racing/race_logic.o(.bss*);
|
||||
BUILD_DIR/src/racing/actors.o(.bss*);
|
||||
BUILD_DIR/src/racing/memory.o(.bss*);
|
||||
BUILD_DIR/src/buffers/random.o(.bss*);
|
||||
. = ALIGN(0x10);
|
||||
}
|
||||
END_NOLOAD(racing)
|
||||
|
||||
BEGIN_NOLOAD(buffers)
|
||||
{
|
||||
BUILD_DIR/src/data/buffers.o(.bss*);
|
||||
BUILD_DIR/src/data/gfx_output_buffer.o(.bss*);
|
||||
BUILD_DIR/src/buffers/trig_tables_bss.o(.bss*);
|
||||
BUILD_DIR/src/buffers/buffers.o(.bss*);
|
||||
BUILD_DIR/src/buffers/gfx_output_buffer.o(.bss*);
|
||||
BUILD_DIR/src/audio/synthesis.o(.bss*);
|
||||
BUILD_DIR/src/audio/heap.o(.bss*);
|
||||
BUILD_DIR/src/audio/load.o(.bss);
|
||||
BUILD_DIR/src/audio/data.o(.bss);
|
||||
. = ALIGN(0x8);
|
||||
BUILD_DIR/src/audio/load.o(.bss*);
|
||||
BUILD_DIR/src/audio/data.o(.bss*);
|
||||
. = ALIGN(0x10);
|
||||
}
|
||||
END_NOLOAD(buffers)
|
||||
|
||||
|
|
@ -476,9 +487,9 @@ SECTIONS
|
|||
END_SEG(other_textures)
|
||||
|
||||
/* 0x802BA370 724220-729A30 [0x5810] */
|
||||
BEGIN_SEG(trigTables, LINKER_TRIG_TABLES)
|
||||
BEGIN_SEG(trigTables, _buffersSegmentNoloadStart)
|
||||
{
|
||||
BUILD_DIR/src/data/trig_tables.o(.data);
|
||||
BUILD_DIR/src/buffers/trig_tables.o(.data);
|
||||
. = ALIGN(0x10);
|
||||
}
|
||||
END_SEG(trigTables)
|
||||
|
|
@ -645,6 +656,8 @@ SECTIONS
|
|||
ASSERT((_mainSegmentNoloadEnd <= _memoryPoolSegmentNoloadStart), "Error: Main segment extended into the memory pool.")
|
||||
ASSERT((_memoryPoolSegmentNoloadEnd <= _endingSegmentStart), "Error: Memory pool extended into the ending segment.")
|
||||
ASSERT((_endingSegmentNoloadEnd <= _racingSegmentStart), "Error: Ending segment extended into the racing segment")
|
||||
ASSERT((_endingSegmentNoloadEnd <= _racingSegmentStart), "Error: Ending segment extended into the racing segment.")
|
||||
ASSERT((_racingSegmentNoloadEnd <= _buffersSegmentNoloadStart), "Error: Racing segment extended into the buffers segment.")
|
||||
ASSERT((_buffersSegmentNoloadEnd <= RDRAM_END), "Error: Buffers segment extended past 8MB of memory")
|
||||
ASSERT((_buffersSegmentNoloadEnd <= RDRAM_END), "Error: Buffers segment extended into trig tables segment.")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "audio/synthesis.h"
|
||||
#include "audio/seqplayer.h"
|
||||
#include "audio/port_eu.h"
|
||||
#include "data/gfx_output_buffer.h"
|
||||
#include "buffers/gfx_output_buffer.h"
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
|
|
|
|||
|
|
@ -109,10 +109,6 @@ Acmd *final_resample(Acmd *acmd, struct NoteSynthesisState *synthesisState, s32
|
|||
Acmd *func_800B86A0(Acmd *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, u32 flags);
|
||||
Acmd *note_apply_headset_pan_effects(Acmd *acmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight);
|
||||
|
||||
// These 2 are almost certainly misnamed and misplaced
|
||||
extern u64 gGfxSPTaskOutputBuffer[];
|
||||
extern u32 gGfxSPTaskOutputBufferSize;
|
||||
|
||||
extern struct SynthesisReverb gSynthesisReverbs[4];
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
#include "config.h"
|
||||
#include "buffers.h"
|
||||
|
||||
ALIGNED8 union_D_802BFB80 D_802BFB80;
|
||||
ALIGNED8 struct_D_802DFB80 D_802DFB80[2][2][8];
|
||||
#ifdef AVOID_UB
|
||||
ALIGNED8 struct_D_802F1F80 D_802F1F80[2][4][8];
|
||||
#else
|
||||
ALIGNED8 u16 D_802F1F80[2][4][0x100 * 8];
|
||||
#endif
|
||||
|
||||
ALIGNED8 u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
|
||||
#ifdef AVOID_UB
|
||||
ALIGNED8 u16 gFramebuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#else
|
||||
u16 gFramebuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
#include "gfx_output_buffer.h"
|
||||
|
||||
ALIGNED8 u64 gGfxSPTaskOutputBuffer[GFX_OUTPUT_BUFFER_SIZE];
|
||||
|
||||
u32 gGfxSPTaskOutputBufferSize;
|
||||
|
|
@ -9,6 +9,5 @@
|
|||
|
||||
// 0x3F00
|
||||
extern u64 gGfxSPTaskOutputBuffer[GFX_OUTPUT_BUFFER_SIZE];
|
||||
extern u32 gGfxSPTaskOutputBufferSize;
|
||||
|
||||
#endif // GFX_OUTPUT_BUFFER_H
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#define MEMORY_POOL_SIZE 0xAB630
|
||||
|
||||
/**
|
||||
* Memory pool setup to prevent other code segments flowing into the memory pool
|
||||
* and for easier portability.
|
||||
* Memory pool variable prevents code segments flowing into the memory pool
|
||||
* for easier portability.
|
||||
*/
|
||||
u8 memoryPool[MEMORY_POOL_SIZE];
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#include <segments.h>
|
||||
|
||||
u16 gRandomSeed16;
|
||||
u8 randomSeedPadding[216];
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#include <ultra64.h>
|
||||
|
||||
extern u16 gRandomSeed16;
|
||||
extern u8 randomSeedPadding[];
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
|
||||
/**
|
||||
* Trig tables get loaded into memory at this location.
|
||||
* See trig_tables.c for the real file.
|
||||
*/
|
||||
|
||||
#ifdef VERSION_EU
|
||||
ALIGNED8 u8 trigTablesPadding[0x5750];
|
||||
#else
|
||||
ALIGNED8 u8 trigTablesPadding[0x5810];
|
||||
#endif
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "buffers.h"
|
||||
|
||||
u16 gRandomSeed16;
|
||||
|
||||
u8 randomSeedPadding[216];
|
||||
|
||||
#ifdef VERSION_EU
|
||||
u8 frameBufferPadding[0x5750];
|
||||
#else
|
||||
u8 frameBufferPadding[0x5810];
|
||||
#endif
|
||||
|
||||
union_D_802BFB80 D_802BFB80;
|
||||
struct_D_802DFB80 D_802DFB80[2][2][8];
|
||||
#ifdef AVOID_UB
|
||||
struct_D_802F1F80 D_802F1F80[2][4][8];
|
||||
#else
|
||||
u16 D_802F1F80[2][4][0x100 * 8];
|
||||
#endif
|
||||
|
||||
u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
|
||||
#ifdef AVOID_UB
|
||||
u16 gFramebuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#else
|
||||
u16 gFramebuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#include <ultra64.h>
|
||||
#include "gfx_output_buffer.h"
|
||||
|
||||
u64 gGfxSPTaskOutputBuffer[GFX_OUTPUT_BUFFER_SIZE];
|
||||
|
||||
u32 gGfxSPTaskOutputBufferSize;
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
#include <objects.h>
|
||||
#include <segments.h>
|
||||
#include <sounds.h>
|
||||
#include "data/trig_tables.h"
|
||||
#include "buffers/trig_tables.h"
|
||||
#include <types.h>
|
||||
#include <ultra64.h>
|
||||
#include <vehicles.h>
|
||||
|
|
|
|||
14
src/main.c
14
src/main.c
|
|
@ -35,7 +35,7 @@
|
|||
#include "staff_ghosts.h"
|
||||
#include <debug.h>
|
||||
#include "crash_screen.h"
|
||||
#include "data/gfx_output_buffer.h"
|
||||
#include "buffers/gfx_output_buffer.h"
|
||||
|
||||
// Declarations (not in this file)
|
||||
void func_80091B78(void);
|
||||
|
|
@ -53,9 +53,9 @@ struct VblankHandler *gVblankHandler2 = NULL;
|
|||
|
||||
struct SPTask *gActiveSPTask = NULL;
|
||||
struct SPTask *sCurrentAudioSPTask = NULL;
|
||||
struct SPTask* sCurrentDisplaySPTask = NULL;
|
||||
struct SPTask* sNextAudioSPTask = NULL;
|
||||
struct SPTask* sNextDisplaySPTask = NULL;
|
||||
struct SPTask *sCurrentDisplaySPTask = NULL;
|
||||
struct SPTask *sNextAudioSPTask = NULL;
|
||||
struct SPTask *sNextDisplaySPTask = NULL;
|
||||
|
||||
|
||||
struct Controller gControllers[NUM_PLAYERS];
|
||||
|
|
@ -137,7 +137,7 @@ struct SPTask *gGfxSPTask;
|
|||
s32 D_801502A0;
|
||||
s32 D_801502A4;
|
||||
u16 *gPhysicalFramebuffers[3];
|
||||
u32 D_801502B4;
|
||||
uintptr_t gPhysicalZBuffer;
|
||||
UNUSED u32 D_801502B8;
|
||||
UNUSED u32 D_801502BC;
|
||||
Mat4 D_801502C0;
|
||||
|
|
@ -368,7 +368,7 @@ void read_controllers(void) {
|
|||
}
|
||||
|
||||
void func_80000BEC(void) {
|
||||
D_801502B4 = VIRTUAL_TO_PHYSICAL(&gZBuffer);
|
||||
gPhysicalZBuffer = VIRTUAL_TO_PHYSICAL(&gZBuffer);
|
||||
}
|
||||
|
||||
void dispatch_audio_sptask(struct SPTask *spTask) {
|
||||
|
|
@ -538,7 +538,7 @@ void setup_game_memory(void) {
|
|||
textureSegStart = (ptrdiff_t) SEG_RACING - commonCourseDataSize;
|
||||
#else
|
||||
textureSegStart = SEG_RACING - commonCourseDataSize;
|
||||
#endif
|
||||
#endif
|
||||
osPiStartDma(&gDmaIoMesg, 0, 0, COMMON_TEXTURES_ROM_START, (void *) textureSegStart, commonCourseDataSize, &gDmaMesgQueue);
|
||||
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ extern struct SPTask *gGfxSPTask;
|
|||
extern s32 D_801502A0;
|
||||
extern s32 D_801502A4;
|
||||
extern u16 *gPhysicalFramebuffers[];
|
||||
extern u32 D_801502B4;
|
||||
extern uintptr_t gPhysicalZBuffer;
|
||||
extern Mat4 D_801502C0;
|
||||
|
||||
extern s32 padding[];
|
||||
|
|
@ -231,9 +231,4 @@ extern f32 gCourseTimer;
|
|||
|
||||
// end of definition of main.c variables
|
||||
|
||||
extern u64 gGfxSPTaskOutputBuffer[];
|
||||
extern u32 gGfxSPTaskOutputBufferSize;
|
||||
|
||||
extern u32 *D_801978D0; // Segment? Keeps track of segmented addresses?
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <main.h>
|
||||
#include "buffers.h"
|
||||
#include <PR/rcp.h>
|
||||
#include "data/trig_tables.h"
|
||||
#include "buffers/trig_tables.h"
|
||||
#include "math.h"
|
||||
|
||||
#pragma intrinsic (sqrtf,fabs)
|
||||
|
|
|
|||
|
|
@ -69,8 +69,4 @@ f32 is_within_render_distance(Vec3f, Vec3f, u16, f32, f32, f32);
|
|||
extern s32 D_802B91C0[];
|
||||
extern Vec3f D_802B91C8;
|
||||
|
||||
// end of math_util.c variables
|
||||
|
||||
extern u16 gRandomSeed16;
|
||||
|
||||
#endif // MATH_UTIL_H
|
||||
|
|
|
|||
|
|
@ -177,8 +177,8 @@ void func_802A39E0(struct UnkStruct_800DC5EC *arg0) {
|
|||
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
|
||||
gDPSetDepthImage(gDisplayListHead++, D_801502B4);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, D_801502B4);
|
||||
gDPSetDepthImage(gDisplayListHead++, gPhysicalZBuffer);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, gPhysicalZBuffer);
|
||||
gDPSetFillColor(gDisplayListHead++, 0xFFFCFFFC);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry);
|
||||
|
|
@ -197,8 +197,8 @@ void func_802A39E0(struct UnkStruct_800DC5EC *arg0) {
|
|||
void init_z_buffer(void) {
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
|
||||
gDPSetDepthImage(gDisplayListHead++, D_801502B4);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, D_801502B4);
|
||||
gDPSetDepthImage(gDisplayListHead++, gPhysicalZBuffer);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, gPhysicalZBuffer);
|
||||
gDPSetFillColor(gDisplayListHead++, 0xFFFCFFFC);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue