trig tables shiftable (#596)

This commit is contained in:
MegaMech
2024-04-05 21:42:14 -06:00
committed by GitHub
parent 12f332614e
commit c4d596d297
24 changed files with 297 additions and 305 deletions
+1 -1
View File
@@ -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)
-4
View File
@@ -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];
/*
+22
View File
@@ -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
+7
View File
@@ -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];
+4
View File
@@ -0,0 +1,4 @@
#include <segments.h>
u16 gRandomSeed16;
u8 randomSeedPadding[216];
+4
View File
@@ -0,0 +1,4 @@
#include <ultra64.h>
extern u16 gRandomSeed16;
extern u8 randomSeedPadding[];
+13
View File
@@ -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
-32
View File
@@ -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
-6
View File
@@ -1,6 +0,0 @@
#include <ultra64.h>
#include "gfx_output_buffer.h"
u64 gGfxSPTaskOutputBuffer[GFX_OUTPUT_BUFFER_SIZE];
u32 gGfxSPTaskOutputBufferSize;
+1 -1
View File
@@ -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>
+7 -7
View File
@@ -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);
+1 -6
View File
@@ -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
+1 -1
View File
@@ -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)
-4
View File
@@ -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
+4 -4
View File
@@ -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);