mirror of
https://github.com/pret/pokestadium.git
synced 2026-09-29 21:38:01 -05:00
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "ultra64.h"
|
||||
|
||||
f32 __sinf(f32);
|
||||
|
||||
void func_80057FD0(void *, int);
|
||||
s32 func_8005A990(OSPiHandle *);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _COMMON_H
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <PR/sched.h>
|
||||
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
@@ -13,6 +14,7 @@ typedef unsigned int uintptr_t;
|
||||
#include "sections.h"
|
||||
#include "gfx.h"
|
||||
#include "color.h"
|
||||
#include "sound.h"
|
||||
#include "math.h"
|
||||
|
||||
typedef struct unk_D_86002F58_004_000_00C_028 {
|
||||
|
||||
17
include/sound.h
Normal file
17
include/sound.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _SOUND_H
|
||||
#define _SOUND_H
|
||||
|
||||
#include <ultra64.h>
|
||||
#include <PR/libaudio.h>
|
||||
|
||||
typedef struct SoundBank {
|
||||
/* 0x00 */ char header_name[16]; // N64 PtrTablesV2\x0
|
||||
/* 0x10 */ u32 flags;
|
||||
/* 0x14 */ char wbk_name[12];
|
||||
/* 0x20 */ s32 count;
|
||||
/* 0x24 */ char* basenote;
|
||||
/* 0x28 */ f32* detune;
|
||||
/* 0x2C */ ALWaveTable** wave_list;
|
||||
} SoundBank; // size = 0x30
|
||||
|
||||
#endif
|
||||
@@ -116,7 +116,9 @@ extern struct Vec3s D_8006F05C;
|
||||
extern struct Vec3f D_8006F064;
|
||||
|
||||
typedef struct unk_D_8006FF00 {
|
||||
/* 0x00 */ char unk_00[0x10];
|
||||
/* 0x00 */ char unk_00[0x4];
|
||||
/* 0x04 */ char* name;
|
||||
/* 0x08 */ char unk_08[0x8];
|
||||
/* 0x10 */ s16 unk_10;
|
||||
/* 0x12 */ s16 unk_12;
|
||||
/* 0x14 */ char unk_14[0x8];
|
||||
@@ -143,11 +145,6 @@ extern unk_D_800AC870* D_800AC870;
|
||||
|
||||
extern Gfx D_8006F498[];
|
||||
|
||||
extern f32 D_80077DD4;
|
||||
extern f32 D_80077DD8;
|
||||
extern f32 D_80077DDC;
|
||||
extern f32 D_80077DE0;
|
||||
extern s8 D_80077DE4;
|
||||
extern s32 D_80078E60;
|
||||
extern s32 D_80078E64;
|
||||
extern s32 D_80078E68;
|
||||
@@ -191,6 +188,6 @@ extern u8 D_87B000D0;
|
||||
extern u8 D_87B000D4;
|
||||
|
||||
extern s32 D_800FC820;
|
||||
extern s32 D_800FF9C0;
|
||||
extern u8* D_800FF9C0;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -271,3 +271,22 @@ CHORUS_PARAMS_N = 0x80079488;
|
||||
FLANGE_PARAMS_N = 0x800794B0;
|
||||
NULL_PARAMS_N = 0x800794D8;
|
||||
n_eqpower = 0x80078600;
|
||||
frameSize = 0x800FCAC8;
|
||||
curAcmdList = 0x80077DB8;
|
||||
maxRSPCmds = 0x800FCAD0;
|
||||
minFrameSize = 0x800FCAC4;
|
||||
maxFrameSize = 0x800FCACC;
|
||||
dmaBuffs = 0x800FCAF8;
|
||||
dmaState = 0x800FCAB8; // size:0xC
|
||||
__am = 0x800FC830; // size:0x288
|
||||
lastInfo = 0x80077DBC;
|
||||
min_only_one = 0x80077DC0;
|
||||
audFrameCt = 0x80077DB0;
|
||||
dmaBufferLen = 0x800FCB04;
|
||||
audDMAIOMesgBuf = 0x800FCAFC;
|
||||
nextDMA = 0x80077DB4;
|
||||
audDMAMessageBuf = 0x800FCB00;
|
||||
rspbootTextStart = 0x80065FC0;
|
||||
aspMainTextStart = 0x80067420;
|
||||
aspMainDataStart = 0x8007EA70;
|
||||
audDMAMessageQ = 0x800FCAE0;
|
||||
|
||||
@@ -1257,11 +1257,11 @@ func_8003C2F8 = 0x8003C2F8; // type:func
|
||||
func_8003C35C = 0x8003C35C; // type:func
|
||||
func_8003C3A0 = 0x8003C3A0; // type:func
|
||||
func_8003C408 = 0x8003C408; // type:func
|
||||
func_8003C540 = 0x8003C540; // type:func
|
||||
func_8003C8DC = 0x8003C8DC; // type:func
|
||||
amCreateAudioMgr = 0x8003C540; // type:func
|
||||
__amDMA = 0x8003C8DC; // type:func
|
||||
func_8003CADC = 0x8003CADC; // type:func
|
||||
func_8003D128 = 0x8003D128; // type:func
|
||||
func_8003D160 = 0x8003D160; // type:func
|
||||
__amDmaNew = 0x8003D128; // type:func
|
||||
__clearAudioDMA = 0x8003D160; // type:func
|
||||
func_8003D264 = 0x8003D264; // type:func
|
||||
func_8003D2B8 = 0x8003D2B8; // type:func
|
||||
func_8003D32C = 0x8003D32C; // type:func
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "19840.h"
|
||||
#include "src/18480.h"
|
||||
#include "src/1C720.h"
|
||||
#include "src/3FB0.h"
|
||||
#include "src/dma.h"
|
||||
#include "src/memmap.h"
|
||||
#include "src/memory.h"
|
||||
#include "src/util.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/19840/func_80018C40.s")
|
||||
|
||||
|
||||
20
src/1CF30.c
20
src/1CF30.c
@@ -3,6 +3,7 @@
|
||||
#include "include/string.h"
|
||||
#include "src/3FB0.h"
|
||||
#include "src/6A40.h"
|
||||
#include "src/20470.h"
|
||||
#include "src/6BC0.h"
|
||||
#include "src/E890.h"
|
||||
#include "src/memory.h"
|
||||
@@ -10,7 +11,6 @@
|
||||
#include "lib/ultralib/src/libc/xstdio.h"
|
||||
|
||||
extern Gfx D_8006F4C0[];
|
||||
extern Gfx D_8006F610[];
|
||||
extern Gfx D_8006F710[];
|
||||
extern Gfx D_8006F750[];
|
||||
extern Gfx D_8006F768[];
|
||||
@@ -66,7 +66,7 @@ void func_8001C6AC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001C8C4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6) {
|
||||
void func_8001C8C4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_RGBA, G_IM_SIZ_32b, arg5, arg3, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
@@ -74,40 +74,40 @@ void func_8001C8C4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5,
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001CADC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6) {
|
||||
void func_8001CADC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_IA, G_IM_SIZ_8b, arg5, arg3, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001CCF8(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6) {
|
||||
void func_8001CCF8(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_IA, G_IM_SIZ_16b, arg5, arg3, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001CF10(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6) {
|
||||
void func_8001CF10(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6) {
|
||||
gDPLoadTextureBlock_4b(gDisplayListHead++, arg4, G_IM_FMT_I, arg5, arg3, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001D12C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6) {
|
||||
void func_8001D12C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_I, G_IM_SIZ_8b, arg5, arg3, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001D348(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6) {
|
||||
void func_8001D348(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_I, G_IM_SIZ_16b, arg5, arg3, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400, arg6);
|
||||
}
|
||||
|
||||
void func_8001D560(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, u32* arg5, s16 arg6, s32 arg7) {
|
||||
void func_8001D560(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, u8* arg5, s16 arg6, s32 arg7) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_RGBA, G_IM_SIZ_16b, arg6, arg3, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
@@ -315,9 +315,9 @@ u8 func_8001E730(u16 arg0) {
|
||||
u8 var_v1 = 0;
|
||||
|
||||
if ((arg0 >= 0x20) && (arg0 < 0x80)) {
|
||||
var_v1 = ((u8*)D_8006F630)[arg0 + 0];
|
||||
var_v1 = ((u8*)D_8006F630)[arg0];
|
||||
} else if ((arg0 >= 0xA0) && (arg0 < 0x100)) {
|
||||
var_v1 = ((u8*)D_8006F610)[arg0 + 0];
|
||||
var_v1 = ((u8*)D_8006F608)[sizeof(Gfx) + arg0];
|
||||
}
|
||||
|
||||
return var_v1;
|
||||
|
||||
14
src/1CF30.h
14
src/1CF30.h
@@ -8,13 +8,13 @@ void func_8001C4E4(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s
|
||||
void func_8001C560(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5, u8 arg6);
|
||||
void func_8001C604(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5, u8 arg6, u8 arg7);
|
||||
void func_8001C6AC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001C8C4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001CADC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001CCF8(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001CF10(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001D12C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001D348(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001D560(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u32* arg4, u32* arg5, s16 arg6, s32 arg7);
|
||||
void func_8001C8C4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001CADC(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001CCF8(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001CF10(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001D12C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001D348(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, s16 arg5, s32 arg6);
|
||||
void func_8001D560(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8* arg4, u8* arg5, s16 arg6, s32 arg7);
|
||||
void func_8001D924(u8* arg0);
|
||||
void func_8001DBDC(u32 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4);
|
||||
void func_8001E000(s16 arg0, s16 arg1, s16 arg2, f32 arg3, Vtx* arg4, u32 arg5);
|
||||
|
||||
517
src/20470.c
517
src/20470.c
@@ -1,36 +1,517 @@
|
||||
#include "global.h"
|
||||
#include "20470.h"
|
||||
#include "src/1CF30.h"
|
||||
#include "src/2E110.h"
|
||||
#include "src/6A40.h"
|
||||
#include "src/6BC0.h"
|
||||
#include "src/hal_libc.h"
|
||||
#include "src/stage_loader.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8001F870.s")
|
||||
extern u8 D_10025D0[];
|
||||
extern u8 D_1002650[];
|
||||
extern u8 D_10026D0[];
|
||||
extern u8 D_1002750[];
|
||||
extern u8 D_10027D0[];
|
||||
extern u8 D_1002850[];
|
||||
extern u8 D_10028D0[];
|
||||
extern u8 D_1002950[];
|
||||
extern u8 D_10029D0[];
|
||||
extern u8 D_1002A50[];
|
||||
extern u8 D_1002AD0[];
|
||||
extern u8 D_1002B50[];
|
||||
extern u8 D_1002BD0[];
|
||||
extern u8 D_1002C50[];
|
||||
extern u8 D_1002CD0[];
|
||||
extern u8 D_1002D50[];
|
||||
extern u8 D_1002DD0[];
|
||||
extern u8 D_1002E50[];
|
||||
extern u8 D_1002ED0[];
|
||||
extern u8 D_1002F50[];
|
||||
extern u8 D_1002FD0[];
|
||||
extern u8 D_1003050[];
|
||||
extern u8 D_10030D0[];
|
||||
extern u8 D_1003150[];
|
||||
extern u8 D_10031D0[];
|
||||
extern u8 D_1003750[];
|
||||
extern u8 D_1003890[];
|
||||
extern u8 D_1003930[];
|
||||
extern u8 D_10039F0[];
|
||||
extern u8 D_1003AB0[];
|
||||
extern u8 D_1003B70[];
|
||||
extern u8 D_1003C30[];
|
||||
extern u8 D_1003CF0[];
|
||||
extern u8 D_1003DB0[];
|
||||
extern u8 D_1003E50[];
|
||||
extern u8 D_1003EA0[];
|
||||
extern u8 D_1003EC8[];
|
||||
extern u8 D_1003EF0[];
|
||||
extern u8 D_2004000[];
|
||||
extern u8 D_2004320[];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8001F9D4.s")
|
||||
Gfx D_8006F470[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetRenderMode(G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2),
|
||||
gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8001FB40.s")
|
||||
Gfx D_8006F498[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetRenderMode(G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2),
|
||||
gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8001FCAC.s")
|
||||
Gfx D_8006F4C0[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_FILL),
|
||||
gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8001FE18.s")
|
||||
Gfx D_8006F4E0[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_COPY),
|
||||
gsDPSetTexturePersp(G_TP_NONE),
|
||||
gsDPSetAlphaCompare(G_AC_THRESHOLD),
|
||||
gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2),
|
||||
gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8001FF68.s")
|
||||
Gfx D_8006F518[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetTexturePersp(G_TP_NONE),
|
||||
gsDPSetCombineLERP(TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0,
|
||||
ENVIRONMENT, 0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsDPSetEnvColor(255, 255, 255, 255),
|
||||
gsSPClearGeometryMode(G_ZBUFFER | G_LIGHTING),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_800200B8.s")
|
||||
Gfx D_8006F558[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetTexturePersp(G_TP_NONE),
|
||||
gsDPSetCombineLERP(ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, ENVIRONMENT, 0, ENVIRONMENT, PRIMITIVE,
|
||||
TEXEL0, PRIMITIVE, TEXEL0, 0, ENVIRONMENT, 0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsDPSetEnvColor(255, 255, 255, 255),
|
||||
gsDPSetPrimColor(0, 0, 0, 0, 0, 255),
|
||||
gsSPClearGeometryMode(G_ZBUFFER | G_LIGHTING),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80020460.s")
|
||||
Gfx D_8006F5A0[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_2CYCLE),
|
||||
gsDPSetTexturePersp(G_TP_NONE),
|
||||
gsDPSetRenderMode(G_RM_PASS, G_RM_XLU_SURF2),
|
||||
gsDPSetCombineLERP(TEXEL0, 0, ENVIRONMENT, 0, TEXEL1, 0, ENVIRONMENT, 0, 0, 0, 0, COMBINED, 0, 0, 0, COMBINED),
|
||||
gsDPSetEnvColor(255, 255, 255, 255),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_8002053C.s")
|
||||
Gfx D_8006F5D8[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_2CYCLE),
|
||||
gsDPSetRenderMode(G_RM_PASS, G_RM_XLU_SURF2),
|
||||
gsDPSetCombineLERP(ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, ENVIRONMENT, 0, COMBINED, 0, TEXEL1, 0, 0,
|
||||
0, 0, COMBINED),
|
||||
gsDPSetPrimColor(0, 0, 255, 255, 255, 255),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80020678.s")
|
||||
Gfx D_8006F608[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetCombineLERP(TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0,
|
||||
ENVIRONMENT, 0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80020754.s")
|
||||
Gfx D_8006F630[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetTexturePersp(G_TP_PERSP),
|
||||
gsDPSetAlphaCompare(G_AC_NONE),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_800207FC.s")
|
||||
static u8 D_8006F650[] = {
|
||||
0x00, 0x34, 0x35, 0x0F, 0x00, 0x06, 0x0D, 0x37, 0x03, 0x04, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x10, 0x11,
|
||||
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x3E, 0x42, 0x00, 0x3F, 0x00, 0x40, 0x00, 0x1A, 0x1B, 0x1C,
|
||||
0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
|
||||
0x2F, 0x30, 0x31, 0x32, 0x33, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B,
|
||||
0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D,
|
||||
0x5E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x8F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x8D, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x8C, 0x00, 0x43, 0x44,
|
||||
0x41, 0x8E, 0x67, 0x66, 0x68, 0x00, 0x5F, 0x00, 0x00, 0x69, 0x6B, 0x6A, 0x6C, 0x6D, 0x7F, 0x7E, 0x80, 0x6F,
|
||||
0x00, 0x81, 0x83, 0x82, 0x6E, 0x00, 0x60, 0x36, 0x00, 0x70, 0x84, 0x71, 0x61, 0x00, 0x00, 0x65, 0x73, 0x72,
|
||||
0x74, 0x00, 0x62, 0x00, 0x00, 0x75, 0x77, 0x76, 0x78, 0x79, 0x86, 0x85, 0x87, 0x7B, 0x00, 0x88, 0x8A, 0x89,
|
||||
0x7A, 0x00, 0x63, 0x00, 0x00, 0x7C, 0x8B, 0x7D, 0x64, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80020928.s")
|
||||
Gfx D_8006F710[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsSPClearGeometryMode(G_ZBUFFER),
|
||||
gsDPSetTexturePersp(G_TP_NONE),
|
||||
gsDPSetCombineLERP(TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0,
|
||||
ENVIRONMENT, 0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsDPSetEnvColor(255, 255, 255, 255),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_800209B4.s")
|
||||
Gfx D_8006F750[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetTexturePersp(G_TP_PERSP),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80020B88.s")
|
||||
Gfx D_8006F768[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_2CYCLE),
|
||||
gsDPSetRenderMode(G_RM_PASS, G_RM_XLU_SURF2),
|
||||
gsDPSetCombineLERP(ENVIRONMENT, PRIMITIVE, TEXEL1, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, TEXEL1, 0, TEXEL1, 0,
|
||||
ENVIRONMENT, 0),
|
||||
gsDPSetPrimColor(0, 0, 255, 255, 255, 255),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80021270.s")
|
||||
Gfx D_8006F798[] = {
|
||||
gsDPPipeSync(),
|
||||
gsDPSetCycleType(G_CYC_1CYCLE),
|
||||
gsDPSetCombineLERP(TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0,
|
||||
ENVIRONMENT, 0),
|
||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||
gsSPEndDisplayList(),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/20470/func_80021920.s")
|
||||
static s32 pad_D_8006F7C0[] = { 0, 0, 0, 0 };
|
||||
|
||||
void func_8001F870(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u8* arg4) {
|
||||
s32 sp34 = (arg2 < 9) ? 0x400 : 0;
|
||||
s32 sp30 = (arg3 < 9) ? 0x400 : 0;
|
||||
|
||||
gDPLoadTextureBlock(gDisplayListHead++, arg4, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
func_8001C330(arg0, arg1, arg2, arg3, 0, 0, sp34, sp30, 0);
|
||||
}
|
||||
|
||||
void func_8001F9D4(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
func_8001F870(arg0, arg1, 8, 8, D_10027D0);
|
||||
func_8001F870(arg0, (arg1 + arg3) - 8, 8, 8, D_1002850);
|
||||
func_8001F870((arg0 + arg2) - 8, (arg1 + arg3) - 8, 8, 8, D_10028D0);
|
||||
func_8001F870((arg0 + arg2) - 8, arg1, 8, 8, D_1002950);
|
||||
|
||||
if (arg2 > 16) {
|
||||
func_8001F870(arg0 + 8, arg1, arg2 - 0x10, 8, D_10025D0);
|
||||
func_8001F870(arg0 + 8, (arg1 + arg3) - 8, arg2 - 0x10, 8, D_1002650);
|
||||
}
|
||||
|
||||
if (arg3 > 16) {
|
||||
func_8001F870(arg0, arg1 + 8, 8, arg3 - 0x10, D_10026D0);
|
||||
func_8001F870((arg0 + arg2) - 8, arg1 + 8, 8, arg3 - 0x10, D_1002750);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8001FB40(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
func_8001F870(arg0, arg1, 8, 8, D_1002BD0);
|
||||
func_8001F870(arg0, (arg1 + arg3) - 8, 8, 8, D_1002C50);
|
||||
func_8001F870((arg0 + arg2) - 8, (arg1 + arg3) - 8, 8, 8, D_1002CD0);
|
||||
func_8001F870((arg0 + arg2) - 8, arg1, 8, 8, D_1002D50);
|
||||
|
||||
if (arg2 > 16) {
|
||||
func_8001F870(arg0 + 8, arg1, arg2 - 0x10, 8, D_10029D0);
|
||||
func_8001F870(arg0 + 8, (arg1 + arg3) - 8, arg2 - 0x10, 8, D_1002A50);
|
||||
}
|
||||
|
||||
if (arg3 > 16) {
|
||||
func_8001F870(arg0, arg1 + 8, 8, arg3 - 0x10, D_1002AD0);
|
||||
func_8001F870((arg0 + arg2) - 8, arg1 + 8, 8, arg3 - 0x10, D_1002B50);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8001FCAC(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
func_8001F870(arg0, arg1, 8, 8, D_1002FD0);
|
||||
func_8001F870(arg0, (arg1 + arg3) - 8, 8, 8, D_1003050);
|
||||
func_8001F870((arg0 + arg2) - 8, (arg1 + arg3) - 8, 8, 8, D_10030D0);
|
||||
func_8001F870((arg0 + arg2) - 8, arg1, 8, 8, D_1003150);
|
||||
|
||||
if (arg2 > 16) {
|
||||
func_8001F870(arg0 + 8, arg1, arg2 - 0x10, 8, D_1002DD0);
|
||||
func_8001F870(arg0 + 8, (arg1 + arg3) - 8, arg2 - 0x10, 8, D_1002E50);
|
||||
}
|
||||
|
||||
if (arg3 > 16) {
|
||||
func_8001F870(arg0, arg1 + 8, 8, arg3 - 0x10, D_1002ED0);
|
||||
func_8001F870((arg0 + arg2) - 8, arg1 + 8, 8, arg3 - 0x10, D_1002F50);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8001FE18(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u16 arg4) {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F4C0);
|
||||
gDPSetFillColor(gDisplayListHead++, (arg4 << 0x10) | arg4);
|
||||
|
||||
if (func_80007A58() != 0) {
|
||||
gDPFillRectangle(gDisplayListHead++, arg0 + 7, arg1 + 7, (arg0 + arg2) - 8, (arg1 + arg3) - 8);
|
||||
} else {
|
||||
gDPFillRectangle(gDisplayListHead++, arg0 + 3, arg1 + 3, (arg0 + arg2) - 4, (arg1 + arg3) - 4);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8001FF68(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u16 arg4) {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F4C0);
|
||||
gDPSetFillColor(gDisplayListHead++, (arg4 << 0x10) | arg4);
|
||||
|
||||
if (func_80007A58() != 0) {
|
||||
gDPFillRectangle(gDisplayListHead++, arg0 + 5, arg1 + 5, (arg0 + arg2) - 6, (arg1 + arg3) - 6);
|
||||
} else {
|
||||
gDPFillRectangle(gDisplayListHead++, arg0 + 3, arg1 + 3, (arg0 + arg2) - 4, (arg1 + arg3) - 4);
|
||||
}
|
||||
}
|
||||
|
||||
void func_800200B8(s32 arg0, s32 arg1, s32 arg2, s32 arg3, Color_RGB8* arg4, Color_RGB8* arg5) {
|
||||
Vtx* temp_s2;
|
||||
unk_D_80068BB0* temp_s1;
|
||||
Mtx* sp7C;
|
||||
Vp* sp78;
|
||||
|
||||
temp_s1 = func_8000648C();
|
||||
temp_s2 = func_80005F5C(sizeof(Vtx) * 4);
|
||||
sp7C = func_80005F5C(sizeof(Mtx) * 1);
|
||||
sp78 = func_80005F5C(sizeof(Vp) * 1);
|
||||
|
||||
func_8001E6E8(sp78, temp_s1->width, temp_s1->height);
|
||||
|
||||
gSPViewport(gDisplayListHead++, (u32)sp78 & 0x1FFFFFFF);
|
||||
|
||||
guOrtho(sp7C, 0.5f, temp_s1->width - 0.5f, temp_s1->height - 0.5f, 0.5f, -2.0f, 2.0f, 1.0f);
|
||||
func_8001E680(&temp_s2[0], arg0, arg1, -1, 0, 0, arg4->r, arg4->g, arg4->b, 0xFF);
|
||||
func_8001E680(&temp_s2[1], arg0 + arg2, arg1, -1, 0, 0, arg4->r, arg4->g, arg4->b, 0xFF);
|
||||
func_8001E680(&temp_s2[2], arg0, arg1 + arg3, -1, 0, 0, arg5->r, arg5->g, arg5->b, 0xFF);
|
||||
func_8001E680(&temp_s2[3], arg0 + arg2, arg1 + arg3, -1, 0, 0, arg5->r, arg5->g, arg5->b, 0xFF);
|
||||
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
|
||||
gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
|
||||
|
||||
gSPMatrix(gDisplayListHead++, (u32)sp7C & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPMatrix(gDisplayListHead++, (u32)&D_8006F010 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPVertex(gDisplayListHead++, (u32)temp_s2 & 0x1FFFFFFF, 4, 0);
|
||||
gSP2Triangles(gDisplayListHead++, 0, 2, 3, 0, 0, 3, 1, 0);
|
||||
}
|
||||
|
||||
void func_80020460(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u16 arg4) {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F518);
|
||||
|
||||
if (func_80007A58() != 0) {
|
||||
func_8001F9D4(arg0, arg1, arg2, arg3);
|
||||
} else {
|
||||
func_8001FCAC(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
if ((arg2 >= 0xF) && (arg3 >= 0xF)) {
|
||||
func_8001FE18(arg0, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_8002053C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, Color_RGB8* arg4, Color_RGB8* arg5) {
|
||||
if ((arg2 >= 0xF) && (arg3 >= 0xF)) {
|
||||
if (func_80007A58() != 0) {
|
||||
func_800200B8(arg0 + 6, arg1 + 6, arg2 - 0xC, arg3 - 0xC, arg4, arg5);
|
||||
} else {
|
||||
func_800200B8(arg0 + 2, arg1 + 2, arg2 - 4, arg3 - 4, arg4, arg5);
|
||||
}
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F518);
|
||||
|
||||
if (func_80007A58() != 0) {
|
||||
func_8001F9D4(arg0, arg1, arg2, arg3);
|
||||
} else {
|
||||
func_8001FCAC(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_80020678(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u16 arg4) {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F518);
|
||||
|
||||
if (func_80007A58() != 0) {
|
||||
func_8001FB40(arg0, arg1, arg2, arg3);
|
||||
} else {
|
||||
func_8001FCAC(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
if ((arg2 >= 0xF) && (arg3 >= 0xF)) {
|
||||
func_8001FF68(arg0, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_80020754(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F518);
|
||||
|
||||
if (func_80007A58() != 0) {
|
||||
func_8001F9D4(arg0, arg1, arg2, arg3);
|
||||
} else {
|
||||
func_8001FCAC(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_800207FC(s32 arg0, s32 arg1) {
|
||||
if (func_80007A58() != 0) {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F4E0);
|
||||
func_8001C6AC(arg0, arg1, 0x20, 0x16, D_10031D0, 0x20, 0x200000);
|
||||
} else {
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F5A0);
|
||||
func_8001D560(arg0, arg1, 0xC, 0xA, D_1003750, D_1003890, 0x10, 0x100000);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_80020928(s16 arg0, s16 arg1) {
|
||||
static s16 D_8006F7D0 = 0;
|
||||
|
||||
if (D_8006F7D0 < 6) {
|
||||
arg0 += D_8006F7D0;
|
||||
} else {
|
||||
arg0 = (arg0 - D_8006F7D0) + 0xC;
|
||||
}
|
||||
func_800207FC(arg0, arg1);
|
||||
D_8006F7D0 = (D_8006F7D0 + 1) % 12;
|
||||
}
|
||||
|
||||
void func_800209B4(s32 arg0, s32 arg1, s32 arg2) {
|
||||
u8* var_t4;
|
||||
|
||||
if (arg2 != 0) {
|
||||
var_t4 = D_2004320;
|
||||
} else {
|
||||
var_t4 = D_2004000;
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F4E0);
|
||||
gDPLoadTextureBlock(gDisplayListHead++, var_t4, G_IM_FMT_RGBA, G_IM_SIZ_16b, 20, 20, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, arg0 << 2, arg1 << 2, (arg0 + 0x13) << 2, (arg1 + 0x13) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 0x1000, 0x0400);
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_80020B88(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
|
||||
u8* spDC;
|
||||
s32 spD8 = arg2 - 4;
|
||||
s32 temp_lo = ((arg4 - arg3) * (arg2 - 4)) / arg4;
|
||||
s32 sp1C = (arg2 - temp_lo) - 4;
|
||||
|
||||
if ((arg3 * 0x30) < (arg4 * 0xA)) {
|
||||
spDC = D_1003CF0;
|
||||
} else if ((arg3 * 0x30) < (arg4 * 0x1B)) {
|
||||
spDC = D_1003C30;
|
||||
} else {
|
||||
spDC = D_1003B70;
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F4E0);
|
||||
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_1003930, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 12, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, arg0 << 2, arg1 << 2, (arg0 + 1) << 2, (arg1 + 0xB) << 2, G_TX_RENDERTILE,
|
||||
0, 0, 0x1000, 0x0400);
|
||||
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_10039F0, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 12, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, ((arg0 + spD8) + 2) << 2, arg1 << 2, ((arg0 + spD8) + 3) << 2,
|
||||
(arg1 + 0xB) << 2, G_TX_RENDERTILE, 0, 0, 0x1000, 0x0400);
|
||||
|
||||
if (sp1C > 0) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, spDC, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 12, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, (arg0 + 2) << 2, arg1 << 2, (arg0 + sp1C + 1) << 2, (arg1 + 0xB) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
}
|
||||
|
||||
if (temp_lo > 0) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_1003AB0, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 12, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, ((arg0 + sp1C) + 2) << 2, arg1 << 2, ((arg0 + sp1C) + temp_lo + 1) << 2,
|
||||
(arg1 + 0xB) << 2, G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_80021270(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
u8* spCC;
|
||||
s32 temp_lo = ((arg3 - arg2) * 0x30) / arg3;
|
||||
s32 sp14 = 0x30 - temp_lo;
|
||||
|
||||
if ((arg2 * 0x30) < (arg3 * 0xA)) {
|
||||
spCC = D_1003EF0;
|
||||
} else if ((arg2 * 0x30) < (arg3 * 0x1B)) {
|
||||
spCC = D_1003EC8;
|
||||
} else {
|
||||
spCC = D_1003EA0;
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F518);
|
||||
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_1003DB0, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 5, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
|
||||
G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, arg0 << 2, arg1 << 2, (arg0 + 0x10) << 2, (arg1 + 5) << 2, G_TX_RENDERTILE,
|
||||
0, 0, 0x0400, 0x0400);
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_1003E50, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 5, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, (arg0 + 0x40) << 2, arg1 << 2, (arg0 + 0x41) << 2, (arg1 + 5) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
|
||||
|
||||
if (sp14 > 0) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, spCC, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 5, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, (arg0 + 0x10) << 2, arg1 << 2, (arg0 + sp14 + 0x10) << 2,
|
||||
(arg1 + 5) << 2, G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
}
|
||||
|
||||
if (temp_lo > 0) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_1003E78, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 5, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, ((arg0 + sp14) + 0x10) << 2, arg1 << 2,
|
||||
((arg0 + sp14) + temp_lo + 0x10) << 2, (arg1 + 5) << 2, G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
|
||||
void func_80021920(void) {
|
||||
s32 temp_s2 = func_8002D5AC(0x24);
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 151; i++) {
|
||||
HAL_Strcpy(D_8006FF00[i].name, func_8002D7C0(NULL, 0, temp_s2, i));
|
||||
}
|
||||
}
|
||||
|
||||
18
src/20470.h
18
src/20470.h
@@ -3,8 +3,22 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_80020460(s32, s32, s32, s32, s32);
|
||||
void func_8002053C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u8*, u8*);
|
||||
extern Gfx D_8006F470[];
|
||||
extern Gfx D_8006F498[];
|
||||
extern Gfx D_8006F4C0[];
|
||||
extern Gfx D_8006F4E0[];
|
||||
extern Gfx D_8006F518[];
|
||||
extern Gfx D_8006F558[];
|
||||
extern Gfx D_8006F5A0[];
|
||||
extern Gfx D_8006F608[];
|
||||
extern Gfx D_8006F630[];
|
||||
extern Gfx D_8006F710[];
|
||||
extern Gfx D_8006F750[];
|
||||
extern Gfx D_8006F768[];
|
||||
extern Gfx D_8006F798[];
|
||||
|
||||
void func_80020460(s32, s32, s32, s32, u16);
|
||||
void func_8002053C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, Color_RGB8*, Color_RGB8*);
|
||||
void func_80021920(void);
|
||||
|
||||
|
||||
|
||||
80
src/373A0.c
80
src/373A0.c
@@ -5,7 +5,7 @@
|
||||
#include "src/38BB0.h"
|
||||
#include "src/4B940.h"
|
||||
#include "src/4BA90.h"
|
||||
#include "src/50CC0.h"
|
||||
#include "src/51740.h"
|
||||
#include "src/4F410.h"
|
||||
#include "src/485C0.h"
|
||||
|
||||
@@ -428,7 +428,7 @@ s32 func_800367A0(u32 arg0, s32 arg1, s32 arg2) {
|
||||
return sp2C;
|
||||
}
|
||||
|
||||
s32 func_80037234(s32 arg0, s32 arg1) {
|
||||
s32 func_80037234(s32 arg0, u32 arg1) {
|
||||
switch (arg0) {
|
||||
case 0x0:
|
||||
if (arg1 == 0) {
|
||||
@@ -487,6 +487,8 @@ void func_80037360(u32* arg0, u32 arg1, s32 arg2) {
|
||||
}
|
||||
}
|
||||
|
||||
#define AUDIO_HEAP_SIZE 300000
|
||||
|
||||
s32 func_800373D8(void) {
|
||||
s32 i;
|
||||
FileHeaders* sp78;
|
||||
@@ -498,9 +500,9 @@ s32 func_800373D8(void) {
|
||||
sp38.unk_04 = 0x34;
|
||||
sp38.unk_08 = 0x18;
|
||||
sp38.unk_0C = D_800B32A0;
|
||||
sp38.unk_10 = 0x493E0;
|
||||
sp38.unk_10 = AUDIO_HEAP_SIZE;
|
||||
sp38.unk_14 = 0x100;
|
||||
sp38.unk_18 = 0x7D00;
|
||||
sp38.unk_18 = 32000;
|
||||
sp38.unk_1C = 0x440;
|
||||
sp38.unk_20 = 1;
|
||||
sp38.unk_24 = 0x30;
|
||||
@@ -510,9 +512,9 @@ s32 func_800373D8(void) {
|
||||
func_80038B68(&sp38);
|
||||
func_8004AD40(2);
|
||||
|
||||
D_800FC6DC = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x61A8);
|
||||
D_800FC798 = alHeapDBAlloc(NULL, 0, D_800FC810, 8, 4);
|
||||
D_800FC6E0 = alHeapDBAlloc(NULL, 0, D_800FC810, 7, 4);
|
||||
D_800FC6DC = alHeapAlloc(D_800FC810, 1, 0x61A8);
|
||||
D_800FC798 = alHeapAlloc(D_800FC810, 8, 4);
|
||||
D_800FC6E0 = alHeapAlloc(D_800FC810, 7, 4);
|
||||
|
||||
// Copy rom data from 0x15C0000 into D_800FC6E0
|
||||
func_8004ADB0(&D_15C0000, D_800FC6E0, sizeof(u8*) * 7);
|
||||
@@ -526,7 +528,7 @@ s32 func_800373D8(void) {
|
||||
num_files = sp78->file1.num_files;
|
||||
// Allocate vram, copy rom bytes, and add address to make absolute,
|
||||
// for all of the first archive's files, including header.
|
||||
D_800FC6E4 = alHeapDBAlloc(NULL, 0, D_800FC810, (0xC / sizeof(u32)) + num_files, sizeof(u32));
|
||||
D_800FC6E4 = alHeapAlloc(D_800FC810, (0xC / sizeof(u32)) + num_files, sizeof(u32));
|
||||
func_8004ADB0(D_800FC6E0[1], D_800FC6E4, 0xC + (num_files * 4));
|
||||
// Update just the first 2 pointers from the header,
|
||||
// pointer to first file, and pointer to N64 wave tables.
|
||||
@@ -538,7 +540,7 @@ s32 func_800373D8(void) {
|
||||
func_8004ADB0(D_800FC6E4->offset1, D_800FC6DC, D_800FC6E4->wave_tables_offset - D_800FC6E4->offset1);
|
||||
|
||||
// Decompressed first file memory.
|
||||
D_800FC684 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x4120);
|
||||
D_800FC684 = alHeapAlloc(D_800FC810, 1, 0x4120);
|
||||
|
||||
// Decompress first file Yay0 from D_800FC6DC, into D_800FC684
|
||||
func_80050B40(D_800FC6DC, D_800FC684, 0x4120);
|
||||
@@ -546,27 +548,27 @@ s32 func_800373D8(void) {
|
||||
// ??
|
||||
func_8003979C(D_800FC684, D_800FC6E4->wave_tables_offset);
|
||||
|
||||
D_800FC680 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x98D8);
|
||||
D_800FC680 = alHeapAlloc(D_800FC810, 1, 0x98D8);
|
||||
|
||||
// Load second archive header at 0x16F27E0
|
||||
func_8004ADB0(D_800FC6E0[2], sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
// Memory to hold archive toc
|
||||
D_800FC6E8 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC6E8 = alHeapAlloc(D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
// Read the alSeqFile into D_800FC6E8
|
||||
func_8004ADB0(D_800FC6E0[2], D_800FC6E8, 4 + (num_files * sizeof(ALSeqData)));
|
||||
// Initialise the memory as an alSeqFile
|
||||
alSeqFileNew(D_800FC6E8, D_800FC6E0[2]);
|
||||
|
||||
// Read the first archive sub header from 0x16F2804, into D_800FC6EC
|
||||
D_800FC6EC = alHeapDBAlloc(NULL, 0, D_800FC810, 3, 4);
|
||||
D_800FC6EC = alHeapAlloc(D_800FC810, 3, 4);
|
||||
func_8004ADB0(D_800FC6E8->seqArray[0].offset, D_800FC6EC, sizeof(File2SubHeader1));
|
||||
func_80037360(D_800FC6EC, D_800FC6E8->seqArray[0].offset, sizeof(File2SubHeader1) / sizeof(u32));
|
||||
|
||||
// Read the first file from the sub header into D_800FC6DC (0x16F2814)
|
||||
func_8004ADB0(D_800FC6EC->offset1, D_800FC6DC, D_800FC6EC->offset2 - D_800FC6EC->offset1);
|
||||
// Decompress the yay0 file into D_800FC688
|
||||
D_800FC688 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0xBB8);
|
||||
D_800FC688 = alHeapAlloc(D_800FC810, 1, 0xBB8);
|
||||
func_80050B40(D_800FC6DC, D_800FC688, 0xBB8);
|
||||
// ???
|
||||
func_800397BC(D_800FC688);
|
||||
@@ -574,7 +576,7 @@ s32 func_800373D8(void) {
|
||||
// Read the second file from the sub header into D_800FC6DC (0x16F2BD0)
|
||||
func_8004ADB0(D_800FC6EC->offset2, D_800FC6DC, D_800FC6EC->wave_tables_offset - D_800FC6EC->offset2);
|
||||
// Decompress the yay0 file into D_800FC688
|
||||
D_800FC68C = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x157C);
|
||||
D_800FC68C = alHeapAlloc(D_800FC810, 1, 0x157C);
|
||||
func_80050B40(D_800FC6DC, D_800FC68C, 0x157C);
|
||||
// ???
|
||||
func_8003979C(D_800FC68C, D_800FC6EC->wave_tables_offset);
|
||||
@@ -583,42 +585,42 @@ s32 func_800373D8(void) {
|
||||
func_8004ADB0(D_800FC6E8->seqArray[1].offset, sp78, sizeof(File2SubHeader2));
|
||||
num_files = sp78->file2sub2.num_files;
|
||||
|
||||
D_800FC6F0 = alHeapDBAlloc(NULL, 0, D_800FC810, 4, (sizeof(File2SubHeader2) / sizeof(u32)) + num_files);
|
||||
D_800FC6F0 = alHeapAlloc(D_800FC810, 4, (sizeof(File2SubHeader2) / sizeof(u32)) + num_files);
|
||||
func_8004ADB0(D_800FC6E8->seqArray[1].offset, D_800FC6F0, sizeof(File2SubHeader2) + (num_files * sizeof(u32)));
|
||||
func_80037360(&D_800FC6F0->offset1, D_800FC6E8->seqArray[1].offset, num_files + 2);
|
||||
func_8004ADB0(D_800FC6F0->offset1, D_800FC6DC, D_800FC6F0->wave_tables_offset - D_800FC6F0->offset1);
|
||||
// Decompress the yay0 file into D_800FC688
|
||||
D_800FC690 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x2EE0);
|
||||
D_800FC690 = alHeapAlloc(D_800FC810, 1, 0x2EE0);
|
||||
func_80050B40(D_800FC6DC, D_800FC690, 0x2EE0);
|
||||
// ???
|
||||
func_8003979C(D_800FC690, D_800FC6F0->wave_tables_offset);
|
||||
|
||||
D_800FC698[0] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x258);
|
||||
D_800FC698[1] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x258);
|
||||
D_800FC698[2] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x258);
|
||||
D_800FC698[0] = alHeapAlloc(D_800FC810, 1, 0x258);
|
||||
D_800FC698[1] = alHeapAlloc(D_800FC810, 1, 0x258);
|
||||
D_800FC698[2] = alHeapAlloc(D_800FC810, 1, 0x258);
|
||||
|
||||
// Read the second seq array (0x17C9C24)
|
||||
func_8004ADB0(D_800FC6E8->seqArray[2].offset, sp78, sizeof(File2SubHeader2));
|
||||
num_files = sp78->file2sub2.num_files;
|
||||
|
||||
D_800FC6FC = alHeapDBAlloc(NULL, 0, D_800FC810, 4, num_files + 3);
|
||||
D_800FC6FC = alHeapAlloc(D_800FC810, 4, num_files + 3);
|
||||
func_8004ADB0(D_800FC6E8->seqArray[2].offset, D_800FC6FC, sizeof(File2SubHeader2) + (num_files * sizeof(u32)));
|
||||
func_80037360(&D_800FC6FC->offset1, D_800FC6E8->seqArray[2].offset, num_files + 2);
|
||||
func_8004ADB0(D_800FC6FC->offset1, D_800FC6DC, D_800FC6FC->wave_tables_offset - D_800FC6FC->offset1);
|
||||
D_800FC6AC = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x9C4);
|
||||
D_800FC6AC = alHeapAlloc(D_800FC810, 1, 0x9C4);
|
||||
// Decompress
|
||||
func_80050B40(D_800FC6DC, D_800FC6AC, 0x9C4);
|
||||
func_8003979C(D_800FC6AC, D_800FC6FC->wave_tables_offset);
|
||||
|
||||
D_800FC6B0[0] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x3E8);
|
||||
D_800FC6B0[1] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x3E8);
|
||||
D_800FC6B0[2] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x3E8);
|
||||
D_800FC6B0[0] = alHeapAlloc(D_800FC810, 1, 0x3E8);
|
||||
D_800FC6B0[1] = alHeapAlloc(D_800FC810, 1, 0x3E8);
|
||||
D_800FC6B0[2] = alHeapAlloc(D_800FC810, 1, 0x3E8);
|
||||
|
||||
// Read seq header from 0x17DC304
|
||||
func_8004ADB0(D_800FC6E8->seqArray[3].offset, sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
|
||||
D_800FC6F4 = alHeapDBAlloc(NULL, 0, D_800FC810, 4, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC6F4 = alHeapAlloc(D_800FC810, 4, 4 + (num_files * sizeof(ALSeqData)));
|
||||
func_8004ADB0(D_800FC6E8->seqArray[3].offset, D_800FC6F4, 4 + (num_files * sizeof(ALSeqData)));
|
||||
alSeqFileNew(D_800FC6F4, D_800FC6E8->seqArray[3].offset);
|
||||
|
||||
@@ -626,18 +628,18 @@ s32 func_800373D8(void) {
|
||||
func_8004ADB0(D_800FC6F4->seqArray[1].offset, sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
|
||||
D_800FC6F8 = alHeapDBAlloc(NULL, 0, D_800FC810, 4, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC6F8 = alHeapAlloc(D_800FC810, 4, 4 + (num_files * sizeof(ALSeqData)));
|
||||
func_8004ADB0(D_800FC6F4->seqArray[1].offset, D_800FC6F8, 4 + (num_files * sizeof(ALSeqData)));
|
||||
alSeqFileNew(D_800FC6F8, D_800FC6F4->seqArray[1].offset);
|
||||
|
||||
D_800FC6A4 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x1388);
|
||||
D_800FC6A8 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0xBB8);
|
||||
D_800FC6A4 = alHeapAlloc(D_800FC810, 1, 0x1388);
|
||||
D_800FC6A8 = alHeapAlloc(D_800FC810, 1, 0xBB8);
|
||||
|
||||
// load third archive from the main list, archive is at 0x1978820
|
||||
func_8004ADB0(D_800FC6E0[3], sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
|
||||
D_800FC700 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC700 = alHeapAlloc(D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
func_8004ADB0(D_800FC6E0[3], D_800FC700, 4 + (num_files * sizeof(ALSeqData)));
|
||||
alSeqFileNew(D_800FC700, D_800FC6E0[3]);
|
||||
|
||||
@@ -645,18 +647,18 @@ s32 func_800373D8(void) {
|
||||
func_8004ADB0(D_800FC6E0[4], sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
|
||||
D_800FC704 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC704 = alHeapAlloc(D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
func_8004ADB0(D_800FC6E0[4], D_800FC704, 4 + (num_files * sizeof(ALSeqData)));
|
||||
alSeqFileNew(D_800FC704, D_800FC6E0[4]);
|
||||
|
||||
D_800FC6C0[0] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x44C);
|
||||
D_800FC6C0[1] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x44C);
|
||||
D_800FC6C0[2] = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 0x44C);
|
||||
D_800FC6C0[0] = alHeapAlloc(D_800FC810, 1, 0x44C);
|
||||
D_800FC6C0[1] = alHeapAlloc(D_800FC810, 1, 0x44C);
|
||||
D_800FC6C0[2] = alHeapAlloc(D_800FC810, 1, 0x44C);
|
||||
|
||||
// load the fourth archive's first seq, at 0x197C1FC
|
||||
func_8004ADB0(D_800FC704->seqArray[0].offset, sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
D_800FC708 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC708 = alHeapAlloc(D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
func_8004ADB0(D_800FC704->seqArray[0].offset, D_800FC708, 4 + (num_files * sizeof(ALSeqData)));
|
||||
alSeqFileNew(D_800FC708, D_800FC704->seqArray[0].offset);
|
||||
|
||||
@@ -665,25 +667,25 @@ s32 func_800373D8(void) {
|
||||
// load the fourth archive's third seq at 0x1A2AD20
|
||||
func_8004ADB0(D_800FC704->seqArray[2].offset, sp78, 4 + 4);
|
||||
num_files = sp78->seq.seqCount;
|
||||
D_800FC714 = alHeapDBAlloc(NULL, 0, D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
D_800FC714 = alHeapAlloc(D_800FC810, 1, 4 + (num_files * sizeof(ALSeqData)));
|
||||
func_8004ADB0(D_800FC704->seqArray[2].offset, D_800FC714, 4 + (num_files * sizeof(ALSeqData)));
|
||||
alSeqFileNew(D_800FC714, D_800FC704->seqArray[2].offset);
|
||||
|
||||
D_800FC6D8 = alHeapDBAlloc(NULL, 0, D_800FC810, 0xB80, 2);
|
||||
D_800FC6D8 = alHeapAlloc(D_800FC810, 0xB80, 2);
|
||||
|
||||
// load the 5th main archive at 0x1FBA260
|
||||
D_800FC6D4 = alHeapDBAlloc(NULL, 0, D_800FC810, 0x1388, 1);
|
||||
D_800FC6D4 = alHeapAlloc(D_800FC810, 0x1388, 1);
|
||||
func_8004ADB0(D_800FC6E0[5], D_800FC6D4, D_800FC6E0[6] - D_800FC6E0[5]);
|
||||
|
||||
// load the 6th main archive at 0x1FBB220
|
||||
D_800FC6CC = alHeapDBAlloc(NULL, 0, D_800FC810, 0x100, 1);
|
||||
D_800FC6CC = alHeapAlloc(D_800FC810, 0x100, 1);
|
||||
func_8004ADB0(D_800FC6E0[6], D_800FC6CC, 0x100);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
D_800FC6CC[i].unk_00 += D_800FC6E0[6];
|
||||
}
|
||||
|
||||
D_800FC6D0 = alHeapDBAlloc(NULL, 0, D_800FC810, 0x2328, 1);
|
||||
D_800FC6D0 = alHeapAlloc(D_800FC810, 0x2328, 1);
|
||||
|
||||
func_8004AE90(2, 2);
|
||||
func_8004AE90(1, 3);
|
||||
|
||||
@@ -65,7 +65,7 @@ extern ALSeqFile* D_800FC714;
|
||||
extern u32* D_800FC798;
|
||||
|
||||
s32 func_800367A0(u32, s32, s32);
|
||||
s32 func_80037234(s32, s32);
|
||||
s32 func_80037234(s32, u32);
|
||||
void func_80037360(u32*, u32, s32);
|
||||
|
||||
#endif // _373A0_H_
|
||||
|
||||
2287
src/38BB0.c
2287
src/38BB0.c
File diff suppressed because it is too large
Load Diff
276
src/38BB0.h
276
src/38BB0.h
@@ -2,13 +2,16 @@
|
||||
#define _38BB0_H_
|
||||
|
||||
#include "global.h"
|
||||
#include "src/libnaudio/n_libaudio_sc.h"
|
||||
#include "src/libnaudio/n_libaudio_sn_sc.h"
|
||||
#include "src/libnaudio/n_synthInternals.h"
|
||||
|
||||
typedef struct sp38_func_800373D8 {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
/* 0x04 */ u32 unk_04;
|
||||
/* 0x08 */ u32 unk_08;
|
||||
/* 0x0C */ void* unk_0C;
|
||||
/* 0x10 */ u32 unk_10;
|
||||
/* 0x10 */ s32 unk_10;
|
||||
/* 0x14 */ u32 unk_14;
|
||||
/* 0x18 */ u32 unk_18;
|
||||
/* 0x1C */ u32 unk_1C;
|
||||
@@ -18,25 +21,260 @@ typedef struct sp38_func_800373D8 {
|
||||
/* 0x2C */ u32 unk_2C;
|
||||
} sp38_func_800373D8; // size >= 0x30
|
||||
|
||||
extern ALHeap* D_800FC810;
|
||||
typedef struct unk_D_800FC7D0_08C_010 {
|
||||
/* 0x00 */ char unk00[0x7];
|
||||
} unk_D_800FC7D0_08C_010; // size = 0x7
|
||||
|
||||
void func_80038B68(sp38_func_800373D8*);
|
||||
void func_80038E98(s32, s32);
|
||||
s32 func_80038F30(s32, s32);
|
||||
s32 func_80039024(s32, s32, s32, s32, u32, s32);
|
||||
void func_8003916C(s32, s32);
|
||||
s32 func_80039204(s32);
|
||||
void func_800392A8(s32, s32);
|
||||
s32 func_80039354(s32);
|
||||
void func_800393DC(s32, s32);
|
||||
void func_80039534(s32, f32);
|
||||
void func_800395FC(s32, s32);
|
||||
void func_8003979C(s32, s32);
|
||||
void func_800397BC(s32);
|
||||
void func_8003986C(s32);
|
||||
void func_800398F0(s32);
|
||||
typedef struct unk_D_800FC7D0_08C_008 {
|
||||
/* 0x00 */ u8 unk_00[4];
|
||||
} unk_D_800FC7D0_08C_008; // size = 0x4
|
||||
|
||||
typedef struct unk_D_800FC7D0_08C {
|
||||
/* 0x00 */ u32 unk_00;
|
||||
/* 0x04 */ u32* unk_04;
|
||||
/* 0x08 */ unk_D_800FC7D0_08C_008** unk_08;
|
||||
/* 0x0C */ u32* unk_0C;
|
||||
/* 0x10 */ unk_D_800FC7D0_08C_010* unk_10;
|
||||
/* 0x14 */ s32* unk_14;
|
||||
/* 0x18 */ char unk18[0x10];
|
||||
/* 0x28 */ f32* unk_28;
|
||||
/* 0x2C */ u32* unk_2C;
|
||||
} unk_D_800FC7D0_08C; // size >= 0x18
|
||||
|
||||
typedef struct unk_D_800FC7D0_140 {
|
||||
/* 0x00 */ char unk00[0x8];
|
||||
/* 0x08 */ unk_D_800FC7D0_08C_008** unk_08;
|
||||
/* 0x0C */ u32* unk_0C;
|
||||
} unk_D_800FC7D0_140; // size >= 0x10
|
||||
|
||||
typedef struct unk_D_800FC7D0_148 {
|
||||
/* 0x00 */ ALLink node;
|
||||
/* 0x08 */ N_ALVoice voice;
|
||||
/* 0x24 */ s32 unk_24;
|
||||
/* 0x28 */ u16 unk_28;
|
||||
/* 0x2A */ u8 unk_2A;
|
||||
} unk_D_800FC7D0_148; // size >= 0x2C
|
||||
|
||||
typedef struct unk_D_800FC7D0 {
|
||||
/* 0x000 */ struct unk_D_800FC7D0* unk_000;
|
||||
/* 0x004 */ char unk004[0x4];
|
||||
/* 0x008 */ u64 unk_008;
|
||||
/* 0x010 */ u64 unk_010;
|
||||
/* 0x018 */ u64 unk_018;
|
||||
/* 0x020 */ u64 unk_020;
|
||||
/* 0x028 */ u64 unk_028;
|
||||
/* 0x030 */ u64 unk_030;
|
||||
/* 0x038 */ u8* unk_038;
|
||||
/* 0x03C */ s32 unk_03C;
|
||||
/* 0x040 */ s32 unk_040;
|
||||
/* 0x044 */ s32 unk_044;
|
||||
/* 0x048 */ f32 unk_048;
|
||||
/* 0x04C */ f32 unk_04C;
|
||||
/* 0x050 */ f32 unk_050;
|
||||
/* 0x054 */ f32 unk_054;
|
||||
/* 0x058 */ f32 unk_058;
|
||||
/* 0x05C */ u8* unk_05C;
|
||||
/* 0x060 */ u8* unk_060;
|
||||
/* 0x064 */ s32 unk_064;
|
||||
/* 0x067 */ s32 unk_068;
|
||||
/* 0x06C */ f32 unk_06C;
|
||||
/* 0x070 */ f32 unk_070;
|
||||
/* 0x074 */ f32 unk_074;
|
||||
/* 0x078 */ f32 unk_078;
|
||||
/* 0x07C */ s32 unk_07C;
|
||||
/* 0x080 */ f32 unk_080;
|
||||
/* 0x084 */ f32 unk_084;
|
||||
/* 0x088 */ f32 unk_088;
|
||||
/* 0x08C */ unk_D_800FC7D0_08C* unk_08C;
|
||||
/* 0x090 */ unk_D_800FC7D0_08C* unk_090;
|
||||
/* 0x094 */ u8* unk_094;
|
||||
/* 0x098 */ u8* unk_098;
|
||||
/* 0x09C */ u8* unk_09C;
|
||||
/* 0x0A0 */ u8* unk_0A0;
|
||||
/* 0x0A4 */ f32 unk_0A4;
|
||||
/* 0x0A8 */ u32 unk_0A8;
|
||||
/* 0x0AC */ s16 unk_0AC;
|
||||
/* 0x0AE */ u16 unk_0AE;
|
||||
/* 0x0B0 */ u16 unk_0B0;
|
||||
/* 0x0B2 */ s16 unk_0B2;
|
||||
/* 0x0B4 */ u16 unk_0B4;
|
||||
/* 0x0B6 */ u16 unk_0B6;
|
||||
/* 0x0B8 */ u16 unk_0B8;
|
||||
/* 0x0BA */ u16 unk_0BA;
|
||||
/* 0x0BC */ u16 unk_0BC;
|
||||
/* 0x0BE */ u16 unk_0BE;
|
||||
/* 0x0C0 */ u16 unk_0C0;
|
||||
/* 0x0C2 */ u16 unk_0C2;
|
||||
/* 0x0C4 */ s16 unk_0C4;
|
||||
/* 0x0C6 */ u16 unk_0C6;
|
||||
/* 0x0C8 */ u16 unk_0C8;
|
||||
/* 0x0CA */ u8 unk_0CA;
|
||||
/* 0x0CB */ u8 unk_0CB;
|
||||
/* 0x0CC */ u8 unk_0CC;
|
||||
/* 0x0CD */ s8 unk_0CD;
|
||||
/* 0x0CE */ u8 unk_0CE;
|
||||
/* 0x0CF */ u8 unk_0CF;
|
||||
/* 0x0D0 */ u8 unk_0D0;
|
||||
/* 0x0D1 */ u8 unk_0D1;
|
||||
/* 0x0D2 */ u8 unk_0D2;
|
||||
/* 0x0D3 */ u8 unk_0D3;
|
||||
/* 0x0D4 */ u8 unk_0D4;
|
||||
/* 0x0D5 */ u8 unk_0D5;
|
||||
/* 0x0D6 */ u8 unk_0D6;
|
||||
/* 0x0D7 */ u8 unk_0D7;
|
||||
/* 0x0D8 */ u8 unk_0D8;
|
||||
/* 0x0D9 */ u8 unk_0D9;
|
||||
/* 0x0DA */ u8 unk_0DA;
|
||||
/* 0x0DB */ u8 unk_0DB;
|
||||
/* 0x0DC */ u32 unk_0DC;
|
||||
/* 0x0E0 */ u8 unk_0E0;
|
||||
/* 0x0E1 */ u8 unk_0E1;
|
||||
/* 0x0E2 */ u8 unk_0E2;
|
||||
/* 0x0E3 */ u8 unk_0E3;
|
||||
/* 0x0E4 */ u8 unk_0E4;
|
||||
/* 0x0E5 */ u8 unk_0E5;
|
||||
/* 0x0E6 */ u8 unk_0E6;
|
||||
/* 0x0E7 */ u8 unk_0E7;
|
||||
/* 0x0E8 */ s8 unk_0E8;
|
||||
/* 0x0E9 */ u8 unk_0E9;
|
||||
/* 0x0EA */ u8 unk_0EA;
|
||||
/* 0x0EB */ u8 unk_0EB;
|
||||
/* 0x0EC */ u8 unk_0EC;
|
||||
/* 0x0ED */ u8 unk_0ED;
|
||||
/* 0x0EE */ u8 unk_0EE;
|
||||
/* 0x0EF */ s8 unk_0EF;
|
||||
/* 0x0F0 */ u8 unk_0F0;
|
||||
/* 0x0F1 */ u8 unk_0F1;
|
||||
/* 0x0F2 */ u8 unk_0F2;
|
||||
/* 0x0F4 */ u8* unk_0F4[4];
|
||||
/* 0x104 */ u8* unk_104[4];
|
||||
/* 0x114 */ u8* unk_114[4];
|
||||
/* 0x124 */ u16 unk_124[4];
|
||||
/* 0x12C */ u16 unk_12C[4];
|
||||
/* 0x134 */ u8 unk_134[4];
|
||||
/* 0x138 */ u8 unk_138[4];
|
||||
/* 0x13C */ u8 unk_13C[4];
|
||||
/* 0x140 */ unk_D_800FC7D0_140* unk_140;
|
||||
/* 0x144 */ char unk144[0x4];
|
||||
/* 0x148 */ unk_D_800FC7D0_148* unk_148;
|
||||
/* 0x14C */ char unk14C[0x4];
|
||||
} unk_D_800FC7D0; // size = 0x150
|
||||
|
||||
typedef struct unk_func_800397BC {
|
||||
/* 0x00 */ u32 num_entries;
|
||||
/* 0x04 */ u32 flags;
|
||||
/* 0x08 */ u32* unk_offset;
|
||||
/* 0x0C */ u32* entries_offset;
|
||||
} unk_func_800397BC; // size = 0x10
|
||||
|
||||
extern ALHeap* D_800FC810;
|
||||
extern u32 D_800FC814;
|
||||
extern s32 D_800FC818;
|
||||
extern s32 D_800FC81C;
|
||||
|
||||
u8* func_80037FB0(unk_D_800FC7D0* arg0, UNUSED u8* arg1);
|
||||
u8* func_80037FD0(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038008(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_8003802C(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038038(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800381B4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038268(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_8003827C(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800382AC(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038304(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038360(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038374(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800383B8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800383C8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800383D8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800383E8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_8003844C(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800384AC(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800384BC(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800384C8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800384D8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800384E4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800385D0(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038688(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800386A8(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800386B4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800386C4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800386D0(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800386E4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038704(UNUSED unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038710(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038738(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038744(UNUSED unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038750(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800387B4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800387C4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038814(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038864(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800388B4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800388C4(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_800389C0(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038A10(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
u8* func_80038A34(unk_D_800FC7D0* arg0, u8* arg1);
|
||||
void func_80038B30(u8* arg0, u32 arg1);
|
||||
void func_80038B54(u8* arg0, u32 arg1);
|
||||
s32 func_80038B68(sp38_func_800373D8* arg0);
|
||||
void func_80038E98(s32 arg0, u32 arg1);
|
||||
s32 func_80038F30(SoundBank* arg0, s32 arg1);
|
||||
s32 func_80039024(SoundBank* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32 arg5);
|
||||
void func_8003916C(s32 arg0, u32 arg1);
|
||||
s32 func_80039204(s32 arg0);
|
||||
void func_800392A8(s32 arg0, u32 arg1);
|
||||
s32 func_80039354(s32 arg0);
|
||||
void func_800393DC(s32 arg0, u32 arg1);
|
||||
void func_80039488(s32 arg0, u16 arg1);
|
||||
void func_80039534(s32 arg0, f32 arg1);
|
||||
void func_800395FC(s32 arg0, s32 arg1);
|
||||
void func_800396D0(u32 arg0, s32 arg1);
|
||||
void func_8003979C(s32 arg0, s32 arg1);
|
||||
void func_800397BC(unk_func_800397BC* arg0);
|
||||
void func_8003986C(s32 arg0);
|
||||
void func_800398F0(s32 arg0);
|
||||
void func_80039940(void);
|
||||
s32 func_80039A7C(s32, s32, s32);
|
||||
void func_80039B88(s32, s32, s32, s32);
|
||||
s32 func_80039A7C(SoundBank* arg0, s32 arg1, s32 arg2);
|
||||
s32 func_80039B88(s32 arg0, u8 arg1, u8 arg2, u32 arg3);
|
||||
u32 func_80039C84(u8* arg0);
|
||||
u16 func_80039CB4(u8* arg0);
|
||||
void func_80039CD0(void);
|
||||
u8* func_80039D58(u8* arg0);
|
||||
u8* func_80039F28(u8* arg0);
|
||||
u8* func_8003A10C(u8* arg0);
|
||||
u8* func_8003A234(u8* arg0);
|
||||
u8* func_8003A2F0(u8* arg0);
|
||||
u8* func_8003A39C(u8* arg0);
|
||||
u8* func_8003A438(u8* arg0);
|
||||
u8* func_8003A4D8(u8* arg0);
|
||||
u8* func_8003A564(u8* arg0);
|
||||
u8* func_8003A614(u8* arg0);
|
||||
u8* func_8003A6D4(u8* arg0);
|
||||
u8* func_8003A744(u8* arg0);
|
||||
s32 func_8003A78C(void* arg0);
|
||||
void func_8003AD58(unk_D_800FC7D0* arg0);
|
||||
s32 func_8003B00C(unk_D_800FC7D0* arg0);
|
||||
f32 func_8003B0DC(unk_D_800FC7D0* arg0, f32 arg1);
|
||||
void func_8003B214(unk_D_800FC7D0* arg0);
|
||||
void func_8003B2B4(unk_D_800FC7D0* arg0);
|
||||
void func_8003B76C(unk_D_800FC7D0* arg0);
|
||||
void func_8003B788(unk_D_800FC7D0* arg0);
|
||||
f32 func_8003B854(unk_D_800FC7D0* arg0);
|
||||
f32 func_8003B8A4(unk_D_800FC7D0* arg0);
|
||||
void func_8003B94C(unk_D_800FC7D0* arg0);
|
||||
void func_8003BA44(unk_D_800FC7D0* arg0);
|
||||
f32 func_8003BBA4(f32 arg0);
|
||||
void func_8003BD2C(u8* arg0, s32 arg1);
|
||||
s32 func_8003BEF4(s32 arg0);
|
||||
void func_8003BFF4(unk_D_800FC7D0* arg0);
|
||||
s32 func_8003C180(unk_D_800FC7D0_08C* arg0, s32 arg1);
|
||||
void func_8003C1D0(u8* arg0, u8 arg1, u32 arg2);
|
||||
void func_8003C204(u8* arg0, u32 arg1, u32 arg2);
|
||||
s32 func_8003C2A4(unk_D_800FC7D0* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
|
||||
void func_8003C2F8(unk_D_800FC7D0_148* arg0);
|
||||
unk_D_800FC7D0_148* func_8003C35C(void);
|
||||
void func_8003C3A0(unk_D_800FC7D0_148* arg0);
|
||||
void func_8003C408(void);
|
||||
|
||||
#endif // _38BB0_H_
|
||||
|
||||
546
src/3D140.c
546
src/3D140.c
@@ -1,12 +1,70 @@
|
||||
#include "3D140.h"
|
||||
#include "373A0.h"
|
||||
#include "45720.h"
|
||||
#include "lib/ultralib/include/PR/leo.h"
|
||||
#include "src/373A0.h"
|
||||
#include "src/38BB0.h"
|
||||
#include "src/3D140.h"
|
||||
#include "src/435D0.h"
|
||||
#include "src/libnaudio/n_libaudio_sc.h"
|
||||
#include "src/libnaudio/n_libaudio_sn_sc.h"
|
||||
#include "src/45720.h"
|
||||
#include "src/4A3E0.h"
|
||||
#include "src/4BDC0.h"
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
s16 type;
|
||||
} gen;
|
||||
struct {
|
||||
s16 type;
|
||||
struct AudioInfo* info;
|
||||
} done;
|
||||
} AudioMsg; // size = 0x8
|
||||
|
||||
typedef struct AudioInfo {
|
||||
/* 0x00 */ s16* data;
|
||||
/* 0x04 */ s16 frameSamples;
|
||||
/* 0x08 */ AudioMsg msg;
|
||||
} AudioInfo; // size = 0x10
|
||||
|
||||
#define NUM_ACMD_LISTS 2
|
||||
#define NUM_OUTPUT_BUFFERS 2
|
||||
#define MAX_MESGS 3
|
||||
#define NUM_DMA_BUFFERS 48
|
||||
#define SAMPLES 184
|
||||
|
||||
typedef struct AMAudioMgr {
|
||||
/* 0x000 */ Acmd* ACMDList[NUM_ACMD_LISTS];
|
||||
/* 0x008 */ AudioInfo* audioInfo[NUM_OUTPUT_BUFFERS];
|
||||
/* 0x010 */ char unk10[0x228];
|
||||
///* 0x010 */ OSThread thread;
|
||||
///* 0x1C0 */ OSMesgQueue audioFrameMsgQ;
|
||||
///* 0x1D8 */ OSMesg audioFrameMsgBuf[MAX_MESGS];
|
||||
///* 0x1E0 */ OSMesgQueue audioReplyMsgQ;
|
||||
///* 0x1F8 */ OSMesg audioReplyMsgBuf[MAX_MESGS];
|
||||
/* 0x238 */ ALGlobals g;
|
||||
} AMAudioMgr; // size = 0x284 ??
|
||||
|
||||
typedef struct AMDMABuffer {
|
||||
/* 0x00 */ ALLink node;
|
||||
/* 0x08 */ u32 startAddr;
|
||||
/* 0x0C */ u32 lastFrame;
|
||||
/* 0x10 */ char* ptr;
|
||||
} AMDMABuffer; // size = 0x14
|
||||
|
||||
typedef struct AMDMAState {
|
||||
/* 0x00 */ u8 initialized;
|
||||
/* 0x04 */ AMDMABuffer* firstUsed;
|
||||
/* 0x08 */ AMDMABuffer* firstFree;
|
||||
} AMDMAState; // size = 0xC
|
||||
|
||||
extern u8 D_800783FC;
|
||||
extern u8 D_80078400;
|
||||
extern u16 D_80078410[1][9];
|
||||
extern u16 D_80078446[1][9];
|
||||
extern u16 D_800784EA[1][9];
|
||||
extern s32 D_80077DC4;
|
||||
extern f32 D_80077DC8;
|
||||
extern u8 D_80077DCC;
|
||||
extern u16 D_80077DF0[];
|
||||
extern u16 D_80077E00[];
|
||||
extern u16 D_80077E10[];
|
||||
@@ -29,7 +87,7 @@ extern u16 D_800780A8[];
|
||||
extern u8 D_800783BC;
|
||||
extern u8 D_800783C0;
|
||||
extern u8 D_800783C4;
|
||||
extern s32 D_800783C8;
|
||||
extern u32 D_800783C8;
|
||||
extern u32 D_800783CC;
|
||||
extern u8 D_800783D4;
|
||||
extern u8 D_800783D8;
|
||||
@@ -42,6 +100,16 @@ extern f64 D_8007C7E8;
|
||||
extern f64 D_8007C7F0;
|
||||
extern f64 D_8007C7F8;
|
||||
extern u8 D_800FCD18[];
|
||||
extern u8 D_80077D90;
|
||||
extern u8 D_80077D98;
|
||||
extern u8 D_80077D9C;
|
||||
extern u8 D_80077DA8;
|
||||
extern s32 D_80077DAC;
|
||||
extern u32 audFrameCt;
|
||||
extern AudioInfo* lastInfo;
|
||||
extern s32 min_only_one;
|
||||
extern u8 D_800FC825;
|
||||
extern s32 D_800FC828;
|
||||
|
||||
typedef struct unk_D_800FCB18 {
|
||||
/* 0x00 */ char pad00[0xC];
|
||||
@@ -67,8 +135,9 @@ typedef struct unk_D_800FCB48 {
|
||||
/* 0x7C */ s32 unk_7C;
|
||||
/* 0x80 */ char pad80[0x4];
|
||||
} unk_D_800FCB48; // size = 0x84
|
||||
|
||||
extern unk_D_800FCB48 D_800FCB48[2];
|
||||
extern s32 D_800FCCA4;
|
||||
extern u32 D_800FCCA4;
|
||||
extern u8 D_800FCCAE;
|
||||
extern u8 D_800FCCAF;
|
||||
extern u8 D_800FCCB0;
|
||||
@@ -87,8 +156,8 @@ extern u8 D_800FCB38[2][8];
|
||||
extern s32 D_800FCC50[];
|
||||
extern s8 D_800FCCA0;
|
||||
extern s8 D_800FCCA1;
|
||||
extern s8 D_800FCCA2;
|
||||
extern s8 D_800FCCAC;
|
||||
extern u8 D_800FCCA2;
|
||||
extern u8 D_800FCCAC;
|
||||
extern s8 D_800FCCB7;
|
||||
extern s8 D_800FCCB8[];
|
||||
extern s8 D_800FCCBA[];
|
||||
@@ -102,28 +171,400 @@ extern s8 D_800FCCD8[];
|
||||
extern s32 D_80078388;
|
||||
extern u32 D_800783A4[4];
|
||||
extern s32 D_800783B8;
|
||||
extern u32 nextDMA;
|
||||
extern u16 D_80077DA0;
|
||||
extern u32 D_80077DA4;
|
||||
extern s8 D_800FC824;
|
||||
extern AMAudioMgr __am;
|
||||
extern AMDMAState dmaState;
|
||||
extern s32 minFrameSize;
|
||||
extern u32 frameSize;
|
||||
extern s32 maxFrameSize;
|
||||
extern s32 maxRSPCmds;
|
||||
extern s32 D_800FCAD4;
|
||||
extern s32 D_800FCAD8;
|
||||
extern OSMesgQueue audDMAMessageQ;
|
||||
extern AMDMABuffer (*dmaBuffs)[NUM_DMA_BUFFERS];
|
||||
extern OSIoMesg (*audDMAIOMesgBuf)[NUM_DMA_BUFFERS];
|
||||
extern OSMesg (*audDMAMessageBuf)[NUM_DMA_BUFFERS];
|
||||
extern u32 dmaBufferLen;
|
||||
extern OSPiHandle* D_800FCB08;
|
||||
extern u32 curAcmdList;
|
||||
extern u16 D_80077E98;
|
||||
extern u16 D_80077EA4;
|
||||
extern u16 D_80077EB4;
|
||||
extern u16 D_80077F04;
|
||||
extern u16 D_80077F44;
|
||||
extern u16 D_80077F60;
|
||||
extern u32 D_800783B4;
|
||||
extern s32 D_800FCCA8;
|
||||
extern u8 D_800FCCAD;
|
||||
|
||||
void func_80041A98(void);
|
||||
void func_80041C70(u32);
|
||||
void func_800420C0(u16*);
|
||||
ALDMAproc __amDmaNew(AMDMAState** state);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003C540.s")
|
||||
#ifdef NON_MATCHING
|
||||
void amCreateAudioMgr(ALSynConfig* c, amConfig* amc, u32 num_dma_buffers, s32 arg3, s32 arg4) {
|
||||
u32 i;
|
||||
f32 fsize;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003C8DC.s")
|
||||
D_800FCB08 = osCartRomInit();
|
||||
dmaBufferLen = arg3;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003CADC.s")
|
||||
dmaState.initialized = FALSE;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D128.s")
|
||||
c->dmaproc = __amDmaNew;
|
||||
c->outputRate = amc->outputRate;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D160.s")
|
||||
dmaBuffs = alHeapAlloc(c->heap, 1, num_dma_buffers * sizeof(AMDMABuffer));
|
||||
audDMAIOMesgBuf = alHeapAlloc(c->heap, 1, (num_dma_buffers << 1) * sizeof(OSIoMesg));
|
||||
audDMAMessageBuf = alHeapAlloc(c->heap, 1, (num_dma_buffers << 1) * sizeof(OSMesg));
|
||||
|
||||
fsize = (f32)amc->framesPerField * c->outputRate / arg4;
|
||||
frameSize = (s32)fsize;
|
||||
if (frameSize < fsize) {
|
||||
frameSize++;
|
||||
}
|
||||
|
||||
frameSize = ((frameSize / SAMPLES) + 1) * SAMPLES;
|
||||
minFrameSize = frameSize - SAMPLES;
|
||||
maxFrameSize = frameSize + 0x100;
|
||||
|
||||
alInit(&__am.g, c);
|
||||
|
||||
(*dmaBuffs)[0].node.prev = NULL;
|
||||
(*dmaBuffs)[0].node.next = NULL;
|
||||
|
||||
for (i = 0; i < num_dma_buffers - 1; i++) {
|
||||
alLink(&(*dmaBuffs)[i + 1].node, &(*dmaBuffs)[i].node);
|
||||
(*dmaBuffs)[i].ptr = alHeapAlloc(c->heap, 1, arg3);
|
||||
}
|
||||
|
||||
(*dmaBuffs)[i].ptr = alHeapAlloc(c->heap, 1, arg3);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
__am.ACMDList[i] = alHeapAlloc(c->heap, 1, amc->maxACMDSize * 8);
|
||||
}
|
||||
|
||||
maxRSPCmds = amc->maxACMDSize;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
__am.audioInfo[i] = alHeapAlloc(c->heap, 1, sizeof(AudioInfo));
|
||||
__am.audioInfo[i]->msg.done.type = 0;
|
||||
__am.audioInfo[i]->msg.done.info = __am.audioInfo[i];
|
||||
__am.audioInfo[i]->data = alHeapAlloc(c->heap, 1, maxFrameSize * 4);
|
||||
}
|
||||
|
||||
osCreateMesgQueue(&audDMAMessageQ, audDMAMessageBuf, num_dma_buffers << 1);
|
||||
|
||||
D_800FCAD4 = c->outputRate;
|
||||
D_800FCAD8 = c->maxVVoices;
|
||||
D_800FC824 = 0;
|
||||
|
||||
func_80044B20(c->heap, minFrameSize, maxFrameSize);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/amCreateAudioMgr.s")
|
||||
#endif
|
||||
|
||||
s32 __amDMA(s32 addr, s32 len, void* state) {
|
||||
void* foundBuffer;
|
||||
s32 delta;
|
||||
AMDMABuffer* sp34;
|
||||
OSIoMesg* ioMesg;
|
||||
AMDMABuffer* dmaPtr;
|
||||
AMDMABuffer* lastDmaPtr;
|
||||
OSPiHandle* sp2C;
|
||||
s32 buffEnd;
|
||||
|
||||
if (D_800FC820 & 0x80000000) {
|
||||
return osVirtualToPhysical(addr);
|
||||
}
|
||||
|
||||
sp2C = D_800FCB08;
|
||||
dmaPtr = dmaState.firstUsed;
|
||||
lastDmaPtr = NULL;
|
||||
while (dmaPtr) {
|
||||
buffEnd = dmaPtr->startAddr + dmaBufferLen;
|
||||
|
||||
if (dmaPtr->startAddr > addr) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (buffEnd >= (addr + len)) {
|
||||
dmaPtr->lastFrame = audFrameCt;
|
||||
return osVirtualToPhysical(dmaPtr->ptr + addr - dmaPtr->startAddr);
|
||||
}
|
||||
|
||||
lastDmaPtr = dmaPtr;
|
||||
dmaPtr = dmaPtr->node.next;
|
||||
}
|
||||
|
||||
dmaPtr = dmaState.firstFree;
|
||||
if (!dmaPtr) {
|
||||
return osVirtualToPhysical(dmaState.firstUsed);
|
||||
}
|
||||
|
||||
dmaState.firstFree = dmaPtr->node.next;
|
||||
alUnlink(&dmaPtr->node);
|
||||
|
||||
if (lastDmaPtr != NULL) {
|
||||
alLink(&dmaPtr->node, &lastDmaPtr->node);
|
||||
} else if (dmaState.firstUsed) {
|
||||
lastDmaPtr = dmaState.firstUsed;
|
||||
|
||||
dmaState.firstUsed = dmaPtr;
|
||||
dmaPtr->node.next = lastDmaPtr;
|
||||
dmaPtr->node.prev = NULL;
|
||||
|
||||
lastDmaPtr->node.prev = &dmaPtr->node;
|
||||
} else {
|
||||
dmaState.firstUsed = dmaPtr;
|
||||
dmaPtr->node.next = NULL;
|
||||
dmaPtr->node.prev = NULL;
|
||||
}
|
||||
|
||||
foundBuffer = dmaPtr->ptr;
|
||||
delta = addr & 1;
|
||||
addr -= delta;
|
||||
dmaPtr->startAddr = addr;
|
||||
dmaPtr->lastFrame = audFrameCt;
|
||||
|
||||
ioMesg = (*audDMAIOMesgBuf) + nextDMA++;
|
||||
ioMesg->hdr.pri = OS_MESG_PRI_HIGH;
|
||||
ioMesg->hdr.retQueue = &audDMAMessageQ;
|
||||
ioMesg->devAddr = addr;
|
||||
ioMesg->dramAddr = foundBuffer;
|
||||
ioMesg->size = dmaBufferLen;
|
||||
|
||||
osInvalDCache(foundBuffer, dmaBufferLen);
|
||||
osEPiStartDma(sp2C, ioMesg, OS_READ);
|
||||
|
||||
return osVirtualToPhysical(foundBuffer) + delta;
|
||||
}
|
||||
|
||||
OSTask* func_8003CADC(OSTask* arg0) {
|
||||
s16* audioPtr;
|
||||
Acmd* cmdp;
|
||||
s32 cmdLen;
|
||||
s32 samplesLeft;
|
||||
OSTask sp38;
|
||||
s32 pad[2];
|
||||
AudioInfo* info;
|
||||
AMAudioMgr* mgr;
|
||||
|
||||
info = __am.audioInfo[audFrameCt % 3];
|
||||
audioPtr = osVirtualToPhysical(info->data);
|
||||
samplesLeft = HW_REG(AI_LEN_REG, u32) >> 2;
|
||||
|
||||
if ((D_80077DA8 == 0) && (lastInfo != NULL)) {
|
||||
osAiSetNextBuffer(lastInfo->data, lastInfo->frameSamples << 2);
|
||||
}
|
||||
|
||||
if ((samplesLeft >= 0x1A9) && (min_only_one != 0)) {
|
||||
info->frameSamples = minFrameSize;
|
||||
min_only_one = 0;
|
||||
} else {
|
||||
info->frameSamples = frameSize;
|
||||
min_only_one = 1;
|
||||
}
|
||||
|
||||
__clearAudioDMA();
|
||||
|
||||
if (D_80077DAC != 0) {
|
||||
D_800FC828 = LeoTestUnitReady(&D_800FC825);
|
||||
}
|
||||
|
||||
cmdp = alAudioFrame(__am.ACMDList[curAcmdList], &cmdLen, audioPtr, info->frameSamples);
|
||||
sp38.t.data_ptr = __am.ACMDList[curAcmdList];
|
||||
sp38.t.data_size = (cmdp - __am.ACMDList[curAcmdList]) * sizeof(Acmd);
|
||||
|
||||
sp38.t.type = M_AUDTASK;
|
||||
sp38.t.ucode_boot = &rspbootTextStart;
|
||||
sp38.t.ucode_boot_size = (s32)_binary_assets_us_F3DEX2_bin_start - (s32)rspbootTextStart;
|
||||
sp38.t.flags = 0;
|
||||
sp38.t.ucode = &aspMainTextStart;
|
||||
sp38.t.ucode_data = &aspMainDataStart;
|
||||
sp38.t.ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||
sp38.t.dram_stack = NULL;
|
||||
sp38.t.dram_stack_size = 0;
|
||||
sp38.t.output_buff = NULL;
|
||||
sp38.t.output_buff_size = 0;
|
||||
sp38.t.yield_data_ptr = NULL;
|
||||
sp38.t.yield_data_size = 0;
|
||||
|
||||
curAcmdList ^= 1;
|
||||
lastInfo = __am.audioInfo[audFrameCt % 3];
|
||||
audFrameCt++;
|
||||
|
||||
if (D_80077D9C != 0) {
|
||||
func_8003D32C();
|
||||
}
|
||||
|
||||
if (D_80077D90 != 0) {
|
||||
func_800429D0();
|
||||
if (lastInfo != NULL) {
|
||||
func_800497E0(lastInfo->data, 0, ((audFrameCt % 3) == 0) ? 0x216 : 0x215, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (D_80077D98 != 0) {
|
||||
func_80044EA4();
|
||||
}
|
||||
|
||||
func_800416BC();
|
||||
|
||||
if (D_80077DC4 != 0) {
|
||||
D_80077DC8 += D_80077DD0;
|
||||
if (D_80077DD0 > 0.0f) {
|
||||
if (D_80077DCC <= D_80077DC8) {
|
||||
D_80077DC8 = D_80077DCC;
|
||||
}
|
||||
} else {
|
||||
if (D_80077DC8 <= D_80077DCC) {
|
||||
D_80077DC8 = D_80077DCC;
|
||||
}
|
||||
}
|
||||
|
||||
func_800393DC(D_80077DC4, (u32)D_80077DC8 & 0xFF);
|
||||
|
||||
if (D_80077DC8 == D_80077DCC) {
|
||||
D_80077DC4 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (D_80077DD4 != 0.0f) {
|
||||
D_80077DD4 -= D_80077DD8;
|
||||
if (D_80077DD4 <= 0) {
|
||||
D_80077DD4 = 0.0f;
|
||||
func_8003916C(2, 1);
|
||||
}
|
||||
func_80038E98(2, D_80077DD4);
|
||||
}
|
||||
|
||||
if (D_80077DDC != 0.0f) {
|
||||
D_80077DDC -= D_80077DE0;
|
||||
if (D_80077DDC <= 0) {
|
||||
D_80077DDC = 0.0f;
|
||||
func_8003916C(1, 1);
|
||||
}
|
||||
func_80038E98(1, D_80077DDC);
|
||||
}
|
||||
|
||||
if (D_80077DA8 != 0) {
|
||||
sp38.t.data_size = 0;
|
||||
}
|
||||
|
||||
*arg0 = sp38;
|
||||
|
||||
return arg0;
|
||||
}
|
||||
|
||||
ALDMAproc __amDmaNew(AMDMAState** state) {
|
||||
if (!dmaState.initialized) {
|
||||
dmaState.firstUsed = NULL;
|
||||
dmaState.firstFree = &dmaBuffs[0];
|
||||
dmaState.initialized = TRUE;
|
||||
}
|
||||
|
||||
*state = &dmaState;
|
||||
|
||||
return __amDMA;
|
||||
}
|
||||
|
||||
#define FRAME_LAG 1
|
||||
|
||||
void __clearAudioDMA(void) {
|
||||
s32 i;
|
||||
void* sp40;
|
||||
AMDMABuffer* var_s0_2;
|
||||
ALLink* node;
|
||||
|
||||
for (i = 0; i < nextDMA; i++) {
|
||||
osRecvMesg(&audDMAMessageQ, &sp40, 0);
|
||||
}
|
||||
|
||||
var_s0_2 = dmaState.firstUsed;
|
||||
while (var_s0_2 != NULL) {
|
||||
node = var_s0_2->node.next;
|
||||
|
||||
if ((var_s0_2->lastFrame + FRAME_LAG) < audFrameCt) {
|
||||
if (var_s0_2 == dmaState.firstUsed) {
|
||||
dmaState.firstUsed = var_s0_2->node.next;
|
||||
}
|
||||
|
||||
alUnlink(var_s0_2);
|
||||
|
||||
if (dmaState.firstFree != NULL) {
|
||||
alLink(var_s0_2, dmaState.firstFree);
|
||||
} else {
|
||||
dmaState.firstFree = var_s0_2;
|
||||
var_s0_2->node.next = NULL;
|
||||
var_s0_2->node.prev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
var_s0_2 = node;
|
||||
}
|
||||
|
||||
nextDMA = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D264.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D2B8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D32C.s")
|
||||
#ifdef NON_MATCHING
|
||||
void func_8003D32C(void) {
|
||||
switch (D_80077D9C) {
|
||||
case 1:
|
||||
func_80039B88(D_80078E70, 0x50, 0x18, 3);
|
||||
func_80042AB0(D_80077DA0);
|
||||
D_80077D9C++;
|
||||
D_80077DA4 = 0;
|
||||
break;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D494.s")
|
||||
case 2:
|
||||
D_80077DA4++;
|
||||
if (D_80077DA4 >= 2) {
|
||||
D_80077DA4 = 0;
|
||||
D_80077D9C++;
|
||||
D_800FC824 = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (func_800449F8() == 0) {
|
||||
D_80077D9C++;
|
||||
D_80077DA4 = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (D_80077DA4 == 0) {
|
||||
func_80039B88(D_80078E70, 0x18, 0x50, 0x14);
|
||||
}
|
||||
|
||||
if (D_80077DA4 >= 0x1F) {
|
||||
D_80077D9C++;
|
||||
}
|
||||
|
||||
D_80077DA4++;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
D_80077D9C = 0;
|
||||
D_80077D90 = 0;
|
||||
D_800FC824 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D32C.s")
|
||||
#endif
|
||||
|
||||
s32 func_8003D494(void) {
|
||||
return D_80077D90;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D4A0.s")
|
||||
|
||||
@@ -135,7 +576,13 @@ void func_800420C0(u16*);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D624.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D68C.s")
|
||||
void func_8003D68C(s32 arg0) {
|
||||
if (arg0 != 0) {
|
||||
D_80078388 = 1;
|
||||
} else {
|
||||
D_80078388 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_8003D6B0.s")
|
||||
|
||||
@@ -652,7 +1099,70 @@ void func_8003DB84(s32 arg0) {
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_80041688.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/3D140/func_800416BC.s")
|
||||
void func_800416BC(void) {
|
||||
u8* seq;
|
||||
|
||||
if ((D_800783B4 < D_800783B8) && (D_80078388 != 0) && (func_80044E54(1) == 0)) {
|
||||
if (D_800783A4[D_800783B4 & 3] != 0) {
|
||||
seq = D_800FC714->seqArray[D_800783A4[D_800783B4 & 3] - 1].offset;
|
||||
func_80044CBC(1, seq, 0x7E, 0);
|
||||
}
|
||||
D_800783B4++;
|
||||
}
|
||||
|
||||
if (D_800783BC != 0) {
|
||||
if ((D_800783C8 >= 0x3E9) && (D_800783C0 == 0) && (D_800783CC != 0)) {
|
||||
func_80041C70(0x248);
|
||||
D_800783C0 = 1;
|
||||
} else if ((D_800783C8 >= 0x7D1) && (D_800783C0 == 0) && (D_800783CC == 0)) {
|
||||
func_80041C70(0x248);
|
||||
D_800783C0 = 1;
|
||||
D_800783C8 = 0x3E8;
|
||||
} else if ((D_800783C8 >= 0x641) && (D_800783C0 == 1)) {
|
||||
func_80041C70(0x249);
|
||||
if (D_800783C4 == 0) {
|
||||
func_800367A0(0x5B, D_80078400, 0);
|
||||
D_800783C4 = 1;
|
||||
}
|
||||
D_800783C0 = 2;
|
||||
} else if ((D_800783C8 >= 0x899) && (D_800783C0 == 2)) {
|
||||
func_80041C70(0x24A);
|
||||
D_800783C8 = 0x3E8;
|
||||
D_800783C0 = 1;
|
||||
}
|
||||
|
||||
D_800783C8++;
|
||||
}
|
||||
|
||||
if (D_800FCCA2 != 0) {
|
||||
if (D_800FCCA2 == 1) {
|
||||
if (D_800FCCA4 != 0) {
|
||||
if (D_800FCCA4 >= 0x29) {
|
||||
if (((D_800FCCAD == 0x10) || (D_800FCCAD == 0x11) || (D_800FCCAD == 0x12) || (D_800FCCAD == 0x15) ||
|
||||
(D_800FCCAD == 0x16) || (D_800FCCAD == 0x53) || (D_800FCCAD == 0x54) ||
|
||||
(D_800FCCAD == 0x55)) &&
|
||||
((D_800FCCAC == 0x34) || (D_800FCCAC == 0x35) || (D_800FCCAC == 0x7E))) {
|
||||
func_800420C0(&D_80077F44);
|
||||
} else {
|
||||
func_800420C0(&D_80077E98);
|
||||
}
|
||||
} else if (D_800FCCA4 >= 6) {
|
||||
if ((D_800FCB18[0]->unk_0C > 0) && (D_800FCB18[1]->unk_0C > 0)) {
|
||||
func_800420C0(&D_80077EA4);
|
||||
} else {
|
||||
func_800420C0(&D_80077F60);
|
||||
}
|
||||
} else if ((D_800FCB18[0]->unk_0C > 0) && (D_800FCB18[1]->unk_0C > 0)) {
|
||||
func_800420C0(&D_80077EB4);
|
||||
} else {
|
||||
func_800420C0(&D_80077F04);
|
||||
}
|
||||
}
|
||||
D_800FCCA8 = D_800FCCA4;
|
||||
}
|
||||
D_800FCCA2--;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void func_80041A98(void) {
|
||||
|
||||
23
src/3D140.h
23
src/3D140.h
@@ -3,11 +3,32 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_8003CADC(void*);
|
||||
extern s32 D_80077DC4;
|
||||
extern f32 D_80077DC8;
|
||||
extern u8 D_80077DCC;
|
||||
extern f32 D_80077DD0;
|
||||
extern f32 D_80077DD4;
|
||||
extern f32 D_80077DD8;
|
||||
extern f32 D_80077DDC;
|
||||
extern f32 D_80077DE0;
|
||||
extern u8 D_80077DE4;
|
||||
|
||||
typedef struct amConfig {
|
||||
/* 0x00 */ u32 outputRate;
|
||||
/* 0x04 */ u32 framesPerField;
|
||||
/* 0x08 */ u32 maxACMDSize;
|
||||
} amConfig; // size = 0xC
|
||||
|
||||
|
||||
void amCreateAudioMgr(ALSynConfig*, amConfig*, u32, s32, s32);
|
||||
OSTask* func_8003CADC(OSTask*);
|
||||
void __clearAudioDMA(void);
|
||||
void func_8003D32C(void);
|
||||
s32 func_8003D494(void);
|
||||
void func_8003D68C(s32);
|
||||
void func_8003D918(u32 arg0, u32 arg1);
|
||||
void func_8003DB84(s32 arg0);
|
||||
void func_800416BC(void);
|
||||
void func_80041A98(void);
|
||||
void func_80041C70(u32 arg0);
|
||||
void func_80041D50(u8* arg0, u8* arg1);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "3FB0.h"
|
||||
#include "include/functions.h"
|
||||
#include "src/3FB0.h"
|
||||
#include "src/D470.h"
|
||||
#include "src/dma.h"
|
||||
@@ -96,15 +95,14 @@ void func_800033C8(unk_func_80003680_sp300* arg0, u8* arg1) {
|
||||
arg0->height = (arg0->start_of_frame[1] << 8) | arg0->start_of_frame[2];
|
||||
}
|
||||
|
||||
extern u64 D_80065FC0[];
|
||||
extern u64 D_80068080[];
|
||||
extern u64 D_8007ED20[];
|
||||
|
||||
void func_80003558(UnkStruct80001380* arg0, unk_func_80003680_sp90* arg1) {
|
||||
arg0->task.t.type = 4;
|
||||
arg0->task.t.flags = 0;
|
||||
arg0->task.t.ucode_boot = D_80065FC0;
|
||||
arg0->task.t.ucode_boot_size = (u32)_binary_assets_us_F3DEX2_bin_start - (u32)D_80065FC0;
|
||||
arg0->task.t.ucode_boot = rspbootTextStart;
|
||||
arg0->task.t.ucode_boot_size = (u32)_binary_assets_us_F3DEX2_bin_start - (u32)rspbootTextStart;
|
||||
arg0->task.t.ucode = D_80068080;
|
||||
arg0->task.t.ucode_size = 0x1000;
|
||||
arg0->task.t.ucode_data = D_8007ED20;
|
||||
|
||||
11
src/435B0.c
11
src/435B0.c
@@ -1,10 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "435B0.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char unk_00[0x16];
|
||||
/* 0x16 */ s16 unk_16;
|
||||
} struct_800429B0;
|
||||
|
||||
void func_800429B0(struct_800429B0* arg0, s16 arg1) {
|
||||
arg0->unk_16 = arg1;
|
||||
void func_800429B0(N_ALVoice* arg0, s16 arg1) {
|
||||
arg0->priority = arg1;
|
||||
}
|
||||
|
||||
10
src/435B0.h
Normal file
10
src/435B0.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _435B0_H_
|
||||
#define _435B0_H_
|
||||
|
||||
#include "global.h"
|
||||
#include "src/libnaudio/n_libaudio_sc.h"
|
||||
#include "src/libnaudio/n_libaudio_sn_sc.h"
|
||||
|
||||
void func_800429B0(N_ALVoice* arg0, s16 arg1);
|
||||
|
||||
#endif // _435B0_H_
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "435D0.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/435D0/func_800429D0.s")
|
||||
|
||||
|
||||
10
src/435D0.h
Normal file
10
src/435D0.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _435D0_H_
|
||||
#define _435D0_H_
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_800429D0(void);
|
||||
void func_80042AB0(u16);
|
||||
s32 func_800449F8(void);
|
||||
|
||||
#endif // _435D0_H_
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_80044B20(ALHeap*, s32, s32);
|
||||
void func_80044CBC(s32, s32, s32, s32);
|
||||
void func_80044D78(u32, u32);
|
||||
s32 func_80044E54(s32);
|
||||
void func_80044E80(s32);
|
||||
void func_80044EA4(void);
|
||||
|
||||
#endif // _45720_H_
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
extern s32 D_800FC814;
|
||||
extern s32 D_800FC818;
|
||||
extern s32 D_800FC81C;
|
||||
|
||||
void func_800484A0(s32 arg0);
|
||||
s32 func_800484C0(s32 arg0);
|
||||
s32 func_800484E0(void);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "global.h"
|
||||
#include "4A3E0.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/4A3E0/func_800497E0.s")
|
||||
|
||||
|
||||
8
src/4A3E0.h
Normal file
8
src/4A3E0.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _4A3E0_H_
|
||||
#define _4A3E0_H_
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_800497E0(void*, s32, s32, f32);
|
||||
|
||||
#endif // _4A3E0_H_
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "4BA90.h"
|
||||
#include "src/49790.h"
|
||||
#include "src/38BB0.h"
|
||||
#include "src/3D140.h"
|
||||
|
||||
void func_8004AE90(s32 arg0, u32 arg1) {
|
||||
s32 var_a1;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "src/4CBC0.h"
|
||||
#include "src/4B940.h"
|
||||
#include "src/45720.h"
|
||||
#include "src/50CC0.h"
|
||||
#include "src/51740.h"
|
||||
#include "src/3D140.h"
|
||||
#include "src/373A0.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "src/49790.h"
|
||||
#include "src/4B940.h"
|
||||
#include "src/4BDC0.h"
|
||||
#include "src/50CC0.h"
|
||||
#include "src/51740.h"
|
||||
#include "src/373A0.h"
|
||||
#include "src/50860.h"
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
#include "global.h"
|
||||
|
||||
void func_8004FC60(s32, s32);
|
||||
void func_8004FCD8(s32);
|
||||
|
||||
#endif // _50860_H_
|
||||
|
||||
32
src/50A00.c
32
src/50A00.c
@@ -1,5 +1,33 @@
|
||||
#include "50A00.h"
|
||||
#include "src/38BB0.h"
|
||||
#include "src/4B940.h"
|
||||
#include "src/51740.h"
|
||||
#include "src/50860.h"
|
||||
#include "src/373A0.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/50A00/func_8004FE00.s")
|
||||
s32 func_8004FE00(u8* arg0) {
|
||||
UNUSED s32 pad[2];
|
||||
u8* sp1C;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/50A00/func_8004FF20.s")
|
||||
func_8004FCD8(1);
|
||||
D_800FF9C0 = arg0;
|
||||
sp1C = D_800FF9C0 + 0x4120;
|
||||
|
||||
if (1) {}
|
||||
|
||||
func_8004ADB0(D_800FC6E4->offset1, D_800FC6DC, D_800FC6E4->wave_tables_offset - D_800FC6E4->offset1);
|
||||
func_80050B40(D_800FC6DC, D_800FF9C0, 0x4120);
|
||||
func_8004ADB0(D_800FC6E4->wave_tables_offset, sp1C, D_800FC6E4->files[0] - D_800FC6E4->wave_tables_offset);
|
||||
func_8003979C(D_800FF9C0, sp1C);
|
||||
D_800FC820 |= 0x80000000;
|
||||
func_8004ADB0(D_800FC6E4->files[0], D_800FC6DC, D_800FC6E4->files[1] - D_800FC6E4->files[0]);
|
||||
func_80050B40(D_800FC6DC, D_800FC680, 0x98D8);
|
||||
D_80078E70 = func_80038F30(D_800FF9C0, D_800FC680);
|
||||
func_800393DC(D_80078E70, 0x70);
|
||||
|
||||
return D_80078E70;
|
||||
}
|
||||
|
||||
void func_8004FF20(void) {
|
||||
D_800FC820 &= ~0x80000000;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_8004FE00(void*);
|
||||
s32 func_8004FE00(u8*);
|
||||
void func_8004FF20(void);
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef _50CC0_H_
|
||||
#define _50CC0_H_
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_80050B40(s32, s32, s32);
|
||||
|
||||
#endif // _50CC0_H_
|
||||
10
src/51740.c
10
src/51740.c
@@ -1,4 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "51740.h"
|
||||
|
||||
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/51740/func_80050B40.s")
|
||||
void func_80050B40(s32 arg0, void* arg1, s32 arg2) {
|
||||
osInvalICache(arg1, arg2);
|
||||
osInvalDCache(arg1, arg2);
|
||||
func_80050BA0(arg0, arg1);
|
||||
osWritebackDCache(arg1, arg2);
|
||||
}
|
||||
|
||||
8
src/51740.h
Normal file
8
src/51740.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _51740_H_
|
||||
#define _51740_H_
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_80050B40(s32, void*, s32);
|
||||
|
||||
#endif // _51740_H_
|
||||
8
src/517A0.h
Normal file
8
src/517A0.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef _517A0_H_
|
||||
#define _517A0_H_
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void func_80050BA0(s32, void*);
|
||||
|
||||
#endif // _517A0_H_
|
||||
@@ -8,7 +8,7 @@ typedef struct UnkStruct80001380 {
|
||||
/* 0x04 */ OSMesgQueue queue;
|
||||
/* 0x1C */ s16 unk_1C;
|
||||
/* 0x1E */ s16 unk_1E;
|
||||
/* 0x1C */ OSTask task;
|
||||
/* 0x20 */ OSTask task;
|
||||
/* 0x60 */ char unk60[0x8];
|
||||
} UnkStruct80001380; // size = 0x68
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "4BDC0.h"
|
||||
#include "5580.h"
|
||||
#include "373A0.h"
|
||||
#include "src/50860.h"
|
||||
|
||||
extern s32 D_800A83A0;
|
||||
|
||||
@@ -21,7 +22,6 @@ s32 func_800484E0(void);
|
||||
void func_80009210(void);
|
||||
void func_8004FD44(void);
|
||||
void func_8004B9C4();
|
||||
void func_8004FCD8(s32);
|
||||
void func_8003D4A0(s32);
|
||||
void func_8004AF24(s32);
|
||||
void func_8004FD64(s32);
|
||||
|
||||
@@ -36,7 +36,6 @@ static s32 pad_D_8780FA4C;
|
||||
s16 D_8780FA50;
|
||||
s16 D_8780FA52[2][4];
|
||||
s16 D_8780FA68[4];
|
||||
u32* D_8780FA70;
|
||||
|
||||
void func_87800020(void) {
|
||||
func_8002D510();
|
||||
@@ -93,13 +92,11 @@ u32 func_878001E8(s32 arg0) {
|
||||
return var_v1;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void func_8780024C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
|
||||
s32 temp_lo;
|
||||
s32 spF0;
|
||||
|
||||
spF0 = arg2 - 2;
|
||||
temp_lo = ((arg4 - arg3) * spF0) / arg4;
|
||||
UNUSED s32 pad;
|
||||
s32 spF0 = arg2 - 2;
|
||||
s32 temp_lo = ((arg4 - arg3) * spF0) / arg4;
|
||||
s32 sp1C = (arg2 - temp_lo) - 2;
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F518);
|
||||
|
||||
@@ -126,13 +123,11 @@ void func_8780024C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
|
||||
gSPTextureRectangle(gDisplayListHead++, ((arg0 + spF0) + 2) << 2, arg1 << 2, ((arg0 + spF0) + 4) << 2,
|
||||
(arg1 + 0xC) << 2, G_TX_RENDERTILE, 0x00C0, 0, 0x0400, 0x0400);
|
||||
|
||||
spF0 = (arg2 - temp_lo) - 2;
|
||||
|
||||
if (spF0 > 0) {
|
||||
if (sp1C > 0) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_87806730, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 12, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, (arg0 + 2) << 2, arg1 << 2, ((arg0 + 2) + spF0) << 2, (arg1 + 0xC) << 2,
|
||||
gSPTextureRectangle(gDisplayListHead++, (arg0 + 2) << 2, arg1 << 2, ((arg0 + 2) + sp1C) << 2, (arg1 + 0xC) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
}
|
||||
|
||||
@@ -140,21 +135,17 @@ void func_8780024C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_878065B0, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 12, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(gDisplayListHead++, ((arg0 + 2) + spF0) << 2, arg1 << 2,
|
||||
(((arg0 + 2) + spF0) + temp_lo) << 2, (arg1 + 0xC) << 2, G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
gSPTextureRectangle(gDisplayListHead++, ((arg0 + 2) + sp1C) << 2, arg1 << 2,
|
||||
(((arg0 + 2) + sp1C) + temp_lo) << 2, (arg1 + 0xC) << 2, G_TX_RENDERTILE, 0, 0, 0, 0x0400);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/2/fragment2/func_8780024C.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void func_878009BC(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
u32* spCC;
|
||||
s32 sp14;
|
||||
s32 temp_lo;
|
||||
s32 temp_lo = ((arg3 - arg2) * 0x30) / arg3;
|
||||
s32 sp14 = 0x30 - temp_lo;
|
||||
|
||||
if (arg2 < ((arg3 * 0xA) / 48)) {
|
||||
spCC = D_87806730;
|
||||
@@ -178,9 +169,6 @@ void func_878009BC(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
gSPTextureRectangle(gDisplayListHead++, (arg0 + 0x40) << 2, arg1 << 2, (arg0 + 0x41) << 2, (arg1 + 5) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400);
|
||||
|
||||
temp_lo = ((arg3 - arg2) * 0x30) / arg3;
|
||||
sp14 = 0x30 - temp_lo;
|
||||
|
||||
if (sp14 > 0) {
|
||||
gDPLoadTextureBlock(gDisplayListHead++, spCC, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 5, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
@@ -198,9 +186,6 @@ void func_878009BC(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, D_8006F630);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/2/fragment2/func_878009BC.s")
|
||||
#endif
|
||||
|
||||
s16 D_87806338 = -1;
|
||||
u32* D_8780633C[] = { D_878067F0, D_87807690, D_87808530, D_878093D0 };
|
||||
@@ -321,8 +306,11 @@ s32 func_878013D4(UNUSED unk_D_800AC870* arg0, char* arg1) {
|
||||
return func_8001F5B0(0, 0, arg1);
|
||||
}
|
||||
|
||||
// Needs in-function static to match, but D_8780FA70 is referenced in fragment 20 and 39?
|
||||
#ifdef NON_MATCHING
|
||||
void func_87801400(s32 arg0, s16 arg1, s16 arg2, f32 arg3, f32 arg4) {
|
||||
static u32* D_8780FA70;
|
||||
|
||||
f32 temp_fa0;
|
||||
f32 temp_fv1;
|
||||
s16 a;
|
||||
@@ -332,36 +320,23 @@ void func_87801400(s32 arg0, s16 arg1, s16 arg2, f32 arg3, f32 arg4) {
|
||||
if ((arg3 != 0.0f) && (arg4 != 0.0f)) {
|
||||
if (arg0 < 0) {
|
||||
arg0 = -1 - arg0;
|
||||
var_t3 = D_8780634C[arg0];
|
||||
D_8780FA70 = D_8780634C[arg0];
|
||||
} else {
|
||||
var_t3 = D_8780633C[arg0 % 4];
|
||||
D_8780FA70 = D_8780633C[arg0 % 4];
|
||||
}
|
||||
|
||||
gDPLoadTextureBlock(gDisplayListHead++, var_t3, G_IM_FMT_RGBA, G_IM_SIZ_32b, 36, 26, 0,
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_8780FA70, G_IM_FMT_RGBA, G_IM_SIZ_32b, 36, 26, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOLOD);
|
||||
D_8780FA70 = var_t3;
|
||||
|
||||
temp_fa0 = 36.0f * arg3;
|
||||
if (temp_fa0 > 0.0f) {
|
||||
temp_fv1 = 0.5f;
|
||||
} else {
|
||||
temp_fv1 = -0.5f;
|
||||
}
|
||||
a = temp_fv1 + temp_fa0;
|
||||
|
||||
temp_fa0 = 26.0f * arg4;
|
||||
if (temp_fa0 > 0.0f) {
|
||||
temp_fv1 = 0.5f;
|
||||
} else {
|
||||
temp_fv1 = -0.5f;
|
||||
}
|
||||
b = temp_fv1 + temp_fa0;
|
||||
a = ROUND_MAX(36.0f * arg3);
|
||||
b = ROUND_MAX(26.0f * arg4);
|
||||
|
||||
func_8001C330(arg1, arg2, a, b, 0, 0, 1024.0f / arg3, 1024.0f / arg4, 0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
u32* D_8780FA70;
|
||||
#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/2/fragment2/func_87801400.s")
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,22 +19,20 @@
|
||||
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
Acmd *n_alAuxBusPull(s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
N_ALAuxBus *m = (N_ALAuxBus *)n_syn->auxBus;
|
||||
N_PVoice **sources = m->sources;
|
||||
s32 i;
|
||||
Acmd* n_alAuxBusPull(s32 sampleOffset, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
N_ALAuxBus* m = (N_ALAuxBus*)n_syn->auxBus;
|
||||
N_PVoice** sources = m->sources;
|
||||
s32 i;
|
||||
|
||||
#ifndef N_MICRO
|
||||
aClearBuffer(ptr++, AL_AUX_L_OUT, FIXED_SAMPLE<<1);
|
||||
aClearBuffer(ptr++, AL_AUX_R_OUT, FIXED_SAMPLE<<1);
|
||||
aClearBuffer(ptr++, AL_AUX_L_OUT, FIXED_SAMPLE << 1);
|
||||
aClearBuffer(ptr++, AL_AUX_R_OUT, FIXED_SAMPLE << 1);
|
||||
#else
|
||||
aClearBuffer(ptr++, N_AL_AUX_L_OUT, N_AL_DIVIDED<<1);
|
||||
aClearBuffer(ptr++, N_AL_AUX_L_OUT, N_AL_DIVIDED << 1);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < m->sourceCount; i++)
|
||||
ptr = n_alEnvmixerPull(sources[i],sampleOffset,ptr);
|
||||
return ptr;
|
||||
for (i = 0; i < m->sourceCount; i++)
|
||||
ptr = n_alEnvmixerPull(sources[i], sampleOffset, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
|
||||
#include "n_synthInternals.h"
|
||||
#include <os.h>
|
||||
#include <stdio.h>
|
||||
@@ -26,185 +25,188 @@
|
||||
* WARNING: THE FOLLOWING CONSTANT MUST BE KEPT IN SYNC
|
||||
* WITH SCALING IN MICROCODE!!!
|
||||
*/
|
||||
#define SCALE 16384
|
||||
#define SCALE 16384
|
||||
|
||||
/*
|
||||
* the following arrays contain default parameters for
|
||||
* a few hopefully useful effects.
|
||||
*/
|
||||
#define ms *(((s32)((f32)44.1))&~0x7)
|
||||
|
||||
#define ms *(((s32)((f32)44.1)) & ~0x7)
|
||||
|
||||
s32 SMALLROOM_PARAMS_N[26] = {
|
||||
/* sections length */
|
||||
3, 100 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 54 ms, 9830, -9830, 0, 0, 0, 0,
|
||||
19 ms, 38 ms, 3276, -3276, 0x3fff, 0, 0, 0,
|
||||
0, 60 ms, 5000, 0, 0, 0, 0, 0x5000
|
||||
3, 100 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 54 ms, 9830, -9830, 0, 0, 0, 0, 19 ms, 38 ms, 3276, -3276, 0x3fff, 0, 0, 0, 0, 60 ms, 5000, 0, 0, 0, 0, 0x5000
|
||||
};
|
||||
|
||||
s32 BIGROOM_PARAMS_N[34] = {
|
||||
/* sections length */
|
||||
4, 100 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 66 ms, 9830, -9830, 0, 0, 0, 0,
|
||||
22 ms, 54 ms, 3276, -3276, 0x3fff, 0, 0, 0,
|
||||
66 ms, 91 ms, 3276, -3276, 0x3fff, 0, 0, 0,
|
||||
0, 94 ms, 8000, 0, 0, 0, 0, 0x5000
|
||||
4, 100 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 66 ms, 9830, -9830, 0, 0, 0, 0, 22 ms, 54 ms, 3276, -3276, 0x3fff, 0, 0, 0, 66 ms, 91 ms, 3276, -3276, 0x3fff, 0,
|
||||
0, 0, 0, 94 ms, 8000, 0, 0, 0, 0, 0x5000
|
||||
};
|
||||
|
||||
s32 ECHO_PARAMS_N[10] = {
|
||||
/* sections length */
|
||||
1, 200 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 179 ms, 12000, 0, 0x7fff, 0, 0, 0
|
||||
1, 200 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 179 ms, 12000, 0, 0x7fff, 0, 0, 0
|
||||
};
|
||||
|
||||
s32 CHORUS_PARAMS_N[10] = {
|
||||
/* sections length */
|
||||
1, 20 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 5 ms, 0x4000, 0, 0x7fff, 7600, 700, 0
|
||||
1, 20 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 5 ms, 0x4000, 0, 0x7fff, 7600, 700, 0
|
||||
};
|
||||
|
||||
s32 FLANGE_PARAMS_N[10] = {
|
||||
/* sections length */
|
||||
1, 20 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 5 ms, 0, 0x5fff, 0x7fff, 380, 500, 0
|
||||
1, 20 ms,
|
||||
/* chorus chorus filter
|
||||
input output fbcoef ffcoef gain rate depth coef */
|
||||
0, 5 ms, 0, 0x5fff, 0x7fff, 380, 500, 0
|
||||
};
|
||||
|
||||
s32 NULL_PARAMS_N[10] = {
|
||||
0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
s32 NULL_PARAMS_N[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
void n_alFxNew(ALFx **fx_ar, ALSynConfig *c, ALHeap *hp)
|
||||
{
|
||||
u16 i, j, k;
|
||||
s32 *param = 0;
|
||||
ALDelay *d;
|
||||
ALFx *r;
|
||||
void n_alFxNew(ALFx** fx_ar, ALSynConfig* c, ALHeap* hp) {
|
||||
u16 i, j, k;
|
||||
s32* param = 0;
|
||||
ALDelay* d;
|
||||
ALFx* r;
|
||||
|
||||
*fx_ar = r = (ALFx *)alHeapAlloc(hp, 1, sizeof(ALFx));
|
||||
*fx_ar = r = (ALFx*)alHeapAlloc(hp, 1, sizeof(ALFx));
|
||||
|
||||
switch (c->fxType) {
|
||||
case AL_FX_SMALLROOM: param = SMALLROOM_PARAMS_N; break;
|
||||
case AL_FX_BIGROOM: param = BIGROOM_PARAMS_N; break;
|
||||
case AL_FX_ECHO: param = ECHO_PARAMS_N; break;
|
||||
case AL_FX_CHORUS: param = CHORUS_PARAMS_N; break;
|
||||
case AL_FX_FLANGE: param = FLANGE_PARAMS_N; break;
|
||||
case AL_FX_CUSTOM: param = c->params; break;
|
||||
default: param = NULL_PARAMS_N; break;
|
||||
case AL_FX_SMALLROOM:
|
||||
param = SMALLROOM_PARAMS_N;
|
||||
break;
|
||||
case AL_FX_BIGROOM:
|
||||
param = BIGROOM_PARAMS_N;
|
||||
break;
|
||||
case AL_FX_ECHO:
|
||||
param = ECHO_PARAMS_N;
|
||||
break;
|
||||
case AL_FX_CHORUS:
|
||||
param = CHORUS_PARAMS_N;
|
||||
break;
|
||||
case AL_FX_FLANGE:
|
||||
param = FLANGE_PARAMS_N;
|
||||
break;
|
||||
case AL_FX_CUSTOM:
|
||||
param = c->params;
|
||||
break;
|
||||
default:
|
||||
param = NULL_PARAMS_N;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
j = 0;
|
||||
|
||||
|
||||
r->section_count = param[j++];
|
||||
r->length = param[j++];
|
||||
r->length = param[j++];
|
||||
|
||||
r->delay = alHeapAlloc(hp, r->section_count, sizeof(ALDelay));
|
||||
r->base = alHeapAlloc(hp, r->length, sizeof(s16));
|
||||
r->input = r->base;
|
||||
|
||||
for ( k=0; k < r->length; k++)
|
||||
r->base[k] = 0;
|
||||
for (k = 0; k < r->length; k++)
|
||||
r->base[k] = 0;
|
||||
|
||||
for ( i=0; i<r->section_count; i++ ){
|
||||
d = &r->delay[i];
|
||||
d->input = param[j++];
|
||||
d->output = param[j++];
|
||||
d->fbcoef = param[j++];
|
||||
d->ffcoef = param[j++];
|
||||
d->gain = param[j++];
|
||||
for (i = 0; i < r->section_count; i++) {
|
||||
d = &r->delay[i];
|
||||
d->input = param[j++];
|
||||
d->output = param[j++];
|
||||
d->fbcoef = param[j++];
|
||||
d->ffcoef = param[j++];
|
||||
d->gain = param[j++];
|
||||
|
||||
if (param[j]) {
|
||||
if (param[j]) {
|
||||
#define RANGE 2.0
|
||||
/* d->rsinc = ((f32) param[j++])/0xffffff; */
|
||||
d->rsinc = ((((f32)param[j++])/1000) * RANGE)/c->outputRate;
|
||||
/* d->rsinc = ((f32) param[j++])/0xffffff; */
|
||||
d->rsinc = ((((f32)param[j++]) / 1000) * RANGE) / c->outputRate;
|
||||
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
*
|
||||
* ratio = 2^(cents/1200)
|
||||
*
|
||||
* and therefore for hundredths of a cent
|
||||
* x
|
||||
* ln(ratio) = ---------------
|
||||
* (120,000)/ln(2)
|
||||
* where
|
||||
* 120,000/ln(2) = 173123.40...
|
||||
*/
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
*
|
||||
* ratio = 2^(cents/1200)
|
||||
*
|
||||
* and therefore for hundredths of a cent
|
||||
* x
|
||||
* ln(ratio) = ---------------
|
||||
* (120,000)/ln(2)
|
||||
* where
|
||||
* 120,000/ln(2) = 173123.40...
|
||||
*/
|
||||
#define CONVERT 173123.404906676
|
||||
#define LENGTH (d->output - d->input)
|
||||
d->rsgain = (((f32) param[j++])/CONVERT) * LENGTH;
|
||||
d->rsval = 1.0;
|
||||
d->rsdelta = 0.0;
|
||||
d->rs = alHeapAlloc(hp, 1, sizeof(ALResampler));
|
||||
d->rs->state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE));
|
||||
d->rs->delta = 0.0;
|
||||
d->rs->first = 1;
|
||||
} else {
|
||||
d->rs = 0;
|
||||
j++;
|
||||
j++;
|
||||
}
|
||||
#define LENGTH (d->output - d->input)
|
||||
d->rsgain = (((f32)param[j++]) / CONVERT) * LENGTH;
|
||||
d->rsval = 1.0;
|
||||
d->rsdelta = 0.0;
|
||||
d->rs = alHeapAlloc(hp, 1, sizeof(ALResampler));
|
||||
d->rs->state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE));
|
||||
d->rs->delta = 0.0;
|
||||
d->rs->first = 1;
|
||||
} else {
|
||||
d->rs = 0;
|
||||
j++;
|
||||
j++;
|
||||
}
|
||||
|
||||
if (param[j]) {
|
||||
d->lp = alHeapAlloc(hp, 1, sizeof(ALLowPass));
|
||||
d->lp->fstate = alHeapAlloc(hp, 1, sizeof(POLEF_STATE));
|
||||
d->lp->fc = param[j++];
|
||||
if (param[j]) {
|
||||
d->lp = alHeapAlloc(hp, 1, sizeof(ALLowPass));
|
||||
d->lp->fstate = alHeapAlloc(hp, 1, sizeof(POLEF_STATE));
|
||||
d->lp->fc = param[j++];
|
||||
#ifdef _OLD_AUDIO_LIBRARY
|
||||
init_lpfilter(d->lp);
|
||||
init_lpfilter(d->lp);
|
||||
#else
|
||||
_init_lpfilter(d->lp);
|
||||
_init_lpfilter(d->lp);
|
||||
#endif
|
||||
} else {
|
||||
d->lp = 0;
|
||||
j++;
|
||||
}
|
||||
} else {
|
||||
d->lp = 0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void alN_PVoiceNew(N_PVoice *mv, ALDMANew dmaNew, ALHeap *hp)
|
||||
{
|
||||
mv->dc_state = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE));
|
||||
mv->dc_lstate = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE));
|
||||
mv->dc_dma = dmaNew(&mv->dc_dmaState);
|
||||
mv->dc_lastsam = 0;
|
||||
mv->dc_first = 1;
|
||||
mv->dc_memin = 0;
|
||||
void alN_PVoiceNew(N_PVoice* mv, ALDMANew dmaNew, ALHeap* hp) {
|
||||
mv->dc_state = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE));
|
||||
mv->dc_lstate = alHeapAlloc(hp, 1, sizeof(ADPCM_STATE));
|
||||
mv->dc_dma = dmaNew(&mv->dc_dmaState);
|
||||
mv->dc_lastsam = 0;
|
||||
mv->dc_first = 1;
|
||||
mv->dc_memin = 0;
|
||||
|
||||
mv->rs_state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE));
|
||||
mv->rs_delta = 0.0;
|
||||
mv->rs_first = 1;
|
||||
mv->rs_ratio = 1.0;
|
||||
mv->rs_upitch = 0;
|
||||
mv->rs_state = alHeapAlloc(hp, 1, sizeof(RESAMPLE_STATE));
|
||||
mv->rs_delta = 0.0;
|
||||
mv->rs_first = 1;
|
||||
mv->rs_ratio = 1.0;
|
||||
mv->rs_upitch = 0;
|
||||
|
||||
mv->em_state = alHeapAlloc(hp, 1, sizeof(ENVMIX_STATE));
|
||||
mv->em_first = 1;
|
||||
mv->em_motion = AL_STOPPED;
|
||||
mv->em_volume = 1;
|
||||
mv->em_ltgt = 1;
|
||||
mv->em_rtgt = 1;
|
||||
mv->em_cvolL = 1;
|
||||
mv->em_cvolR = 1;
|
||||
mv->em_dryamt = 0;
|
||||
mv->em_wetamt = 0;
|
||||
mv->em_lratm = 1;
|
||||
mv->em_lratl = 0;
|
||||
mv->em_lratm = 1;
|
||||
mv->em_lratl = 0;
|
||||
mv->em_delta = 0;
|
||||
mv->em_segEnd = 0;
|
||||
mv->em_pan = 0;
|
||||
mv->em_ctrlList = 0;
|
||||
mv->em_ctrlTail = 0;
|
||||
mv->em_state = alHeapAlloc(hp, 1, sizeof(ENVMIX_STATE));
|
||||
mv->em_first = 1;
|
||||
mv->em_motion = AL_STOPPED;
|
||||
mv->em_volume = 1;
|
||||
mv->em_ltgt = 1;
|
||||
mv->em_rtgt = 1;
|
||||
mv->em_cvolL = 1;
|
||||
mv->em_cvolR = 1;
|
||||
mv->em_dryamt = 0;
|
||||
mv->em_wetamt = 0;
|
||||
mv->em_lratm = 1;
|
||||
mv->em_lratl = 0;
|
||||
mv->em_lratm = 1;
|
||||
mv->em_lratl = 0;
|
||||
mv->em_delta = 0;
|
||||
mv->em_segEnd = 0;
|
||||
mv->em_pan = 0;
|
||||
mv->em_ctrlList = 0;
|
||||
mv->em_ctrlTail = 0;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,305 +22,303 @@
|
||||
#include <R4300.h>
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
extern u32 cnt_index, adpcm_num, adpcm_cnt, adpcm_max, adpcm_min, lastCnt[];
|
||||
#endif
|
||||
|
||||
#define ADPCMFBYTES 9
|
||||
#define LFSAMPLES 4
|
||||
#define ADPCMFBYTES 9
|
||||
#define LFSAMPLES 4
|
||||
|
||||
static
|
||||
Acmd *_decodeChunk(Acmd *ptr, N_PVoice *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags);
|
||||
static Acmd* _decodeChunk(Acmd* ptr, N_PVoice* f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags);
|
||||
|
||||
Acmd* n_alAdpcmPull(N_PVoice* filter, s16* outp, s32 outCount, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
s16 inp;
|
||||
s32 tsam;
|
||||
s32 nframes;
|
||||
s32 nbytes;
|
||||
s32 overFlow;
|
||||
s32 startZero;
|
||||
s32 nOver;
|
||||
s32 nSam;
|
||||
s32 op;
|
||||
s32 nLeft;
|
||||
s32 bEnd;
|
||||
s32 decoded = 0;
|
||||
s32 looped = 0;
|
||||
|
||||
N_PVoice* f = filter;
|
||||
|
||||
Acmd *n_alAdpcmPull(N_PVoice *filter, s16 *outp, s32 outCount, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s16 inp;
|
||||
s32 tsam;
|
||||
s32 nframes;
|
||||
s32 nbytes;
|
||||
s32 overFlow;
|
||||
s32 startZero;
|
||||
s32 nOver;
|
||||
s32 nSam;
|
||||
s32 op;
|
||||
s32 nLeft;
|
||||
s32 bEnd;
|
||||
s32 decoded = 0;
|
||||
s32 looped = 0;
|
||||
|
||||
N_PVoice *f = filter;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
if (outCount == 0)
|
||||
return ptr;
|
||||
|
||||
#ifndef N_MICRO
|
||||
inp = AL_DECODER_IN;
|
||||
if (outCount == 0)
|
||||
return ptr;
|
||||
|
||||
#ifndef N_MICRO
|
||||
inp = AL_DECODER_IN;
|
||||
#else
|
||||
inp = N_AL_DECODER_IN;
|
||||
inp = N_AL_DECODER_IN;
|
||||
#endif
|
||||
|
||||
aLoadADPCM(ptr++, f->dc_bookSize,
|
||||
K0_TO_PHYS(f->dc_table->waveInfo.adpcmWave.book->book));
|
||||
|
||||
looped = (outCount + f->dc_sample > f->dc_loop.end) && (f->dc_loop.count != 0);
|
||||
if (looped)
|
||||
nSam = f->dc_loop.end - f->dc_sample;
|
||||
else
|
||||
nSam = outCount;
|
||||
|
||||
if (f->dc_lastsam)
|
||||
nLeft = ADPCMFSIZE - f->dc_lastsam;
|
||||
else
|
||||
nLeft = 0;
|
||||
tsam = nSam - nLeft;
|
||||
if (tsam<0) tsam = 0;
|
||||
|
||||
nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES;
|
||||
nbytes = nframes*ADPCMFBYTES;
|
||||
|
||||
if (looped){
|
||||
|
||||
ptr = _decodeChunk(ptr, f, tsam, nbytes, *outp, inp, f->dc_first);
|
||||
|
||||
/*
|
||||
* Fix up output pointer, which will be used as the input pointer
|
||||
* by the following module.
|
||||
*/
|
||||
if (f->dc_lastsam)
|
||||
*outp += (f->dc_lastsam<<1);
|
||||
else
|
||||
*outp += (ADPCMFSIZE<<1);
|
||||
|
||||
/*
|
||||
* Now fix up state info to reflect the loop start point
|
||||
*/
|
||||
f->dc_lastsam = f->dc_loop.start &0xf;
|
||||
f->dc_memin = (s32) f->dc_table->base + ADPCMFBYTES *
|
||||
((s32) (f->dc_loop.start>>LFSAMPLES) + 1);
|
||||
f->dc_sample = f->dc_loop.start;
|
||||
|
||||
bEnd = *outp;
|
||||
while (outCount > nSam){
|
||||
|
||||
outCount -= nSam;
|
||||
|
||||
/*
|
||||
* Put next one after the end of the last lot - on the
|
||||
* frame boundary (32 byte) after the end.
|
||||
*/
|
||||
aLoadADPCM(ptr++, f->dc_bookSize, K0_TO_PHYS(f->dc_table->waveInfo.adpcmWave.book->book));
|
||||
|
||||
looped = (outCount + f->dc_sample > f->dc_loop.end) && (f->dc_loop.count != 0);
|
||||
if (looped) {
|
||||
nSam = f->dc_loop.end - f->dc_sample;
|
||||
} else {
|
||||
nSam = outCount;
|
||||
}
|
||||
|
||||
if (f->dc_lastsam) {
|
||||
nLeft = ADPCMFSIZE - f->dc_lastsam;
|
||||
} else {
|
||||
nLeft = 0;
|
||||
}
|
||||
tsam = nSam - nLeft;
|
||||
if (tsam < 0) {
|
||||
tsam = 0;
|
||||
}
|
||||
|
||||
nframes = (tsam + ADPCMFSIZE - 1) >> LFSAMPLES;
|
||||
nbytes = nframes * ADPCMFBYTES;
|
||||
|
||||
if (looped) {
|
||||
|
||||
ptr = _decodeChunk(ptr, f, tsam, nbytes, *outp, inp, f->dc_first);
|
||||
|
||||
/*
|
||||
* Fix up output pointer, which will be used as the input pointer
|
||||
* by the following module.
|
||||
*/
|
||||
if (f->dc_lastsam)
|
||||
*outp += (f->dc_lastsam << 1);
|
||||
else
|
||||
*outp += (ADPCMFSIZE << 1);
|
||||
|
||||
/*
|
||||
* Now fix up state info to reflect the loop start point
|
||||
*/
|
||||
f->dc_lastsam = f->dc_loop.start & 0xf;
|
||||
f->dc_memin = (s32)f->dc_table->base + ADPCMFBYTES * ((s32)(f->dc_loop.start >> LFSAMPLES) + 1);
|
||||
f->dc_sample = f->dc_loop.start;
|
||||
|
||||
bEnd = *outp;
|
||||
while (outCount > nSam) {
|
||||
|
||||
outCount -= nSam;
|
||||
|
||||
/*
|
||||
* Put next one after the end of the last lot - on the
|
||||
* frame boundary (32 byte) after the end.
|
||||
*/
|
||||
#if 0
|
||||
op = (bEnd + ((nframes+1)<<(LFSAMPLES+1))) & ~0x1f;
|
||||
#else
|
||||
op = (bEnd + ((nframes+1)<<(LFSAMPLES+1)) + 16) & ~0x1f;
|
||||
op = (bEnd + ((nframes + 1) << (LFSAMPLES + 1)) + 16) & ~0x1f;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The actual end of data
|
||||
*/
|
||||
bEnd += (nSam<<1);
|
||||
|
||||
/*
|
||||
* -1 is loop forever - the loop count is not exact now
|
||||
* for small loops!
|
||||
*/
|
||||
if ((f->dc_loop.count != -1) && (f->dc_loop.count != 0))
|
||||
f->dc_loop.count--;
|
||||
|
||||
/*
|
||||
* What's left to compute.
|
||||
*/
|
||||
nSam = MIN(outCount, f->dc_loop.end - f->dc_loop.start);
|
||||
tsam = nSam - ADPCMFSIZE + f->dc_lastsam;
|
||||
if (tsam<0) tsam = 0;
|
||||
nframes = (tsam+ADPCMFSIZE-1)>>LFSAMPLES;
|
||||
nbytes = nframes*ADPCMFBYTES;
|
||||
ptr = _decodeChunk(ptr, f, tsam, nbytes, op, inp, f->dc_first | A_LOOP);
|
||||
/*
|
||||
* Merge the two sections in DMEM.
|
||||
*/
|
||||
aDMEMMove(ptr++, op+(f->dc_lastsam<<1), bEnd, nSam<<1);
|
||||
|
||||
/*
|
||||
* The actual end of data
|
||||
*/
|
||||
bEnd += (nSam << 1);
|
||||
|
||||
/*
|
||||
* -1 is loop forever - the loop count is not exact now
|
||||
* for small loops!
|
||||
*/
|
||||
if ((f->dc_loop.count != -1) && (f->dc_loop.count != 0)) {
|
||||
f->dc_loop.count--;
|
||||
}
|
||||
|
||||
/*
|
||||
* What's left to compute.
|
||||
*/
|
||||
nSam = MIN(outCount, f->dc_loop.end - f->dc_loop.start);
|
||||
tsam = nSam - ADPCMFSIZE + f->dc_lastsam;
|
||||
if (tsam < 0) {
|
||||
tsam = 0;
|
||||
}
|
||||
nframes = (tsam + ADPCMFSIZE - 1) >> LFSAMPLES;
|
||||
nbytes = nframes * ADPCMFBYTES;
|
||||
ptr = _decodeChunk(ptr, f, tsam, nbytes, op, inp, f->dc_first | A_LOOP);
|
||||
/*
|
||||
* Merge the two sections in DMEM.
|
||||
*/
|
||||
aDMEMMove(ptr++, op + (f->dc_lastsam << 1), bEnd, nSam << 1);
|
||||
}
|
||||
|
||||
f->dc_lastsam = (outCount + f->dc_lastsam) & 0xf;
|
||||
f->dc_sample += outCount;
|
||||
f->dc_memin += ADPCMFBYTES * nframes;
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* The unlooped case, which is executed most of the time
|
||||
*/
|
||||
|
||||
nSam = nframes << LFSAMPLES;
|
||||
|
||||
/*
|
||||
* overFlow is the number of bytes past the end
|
||||
* of the bitstream I try to generate
|
||||
*/
|
||||
overFlow = f->dc_memin + nbytes - ((s32)f->dc_table->base + f->dc_table->len);
|
||||
if (overFlow < 0) {
|
||||
overFlow = 0;
|
||||
}
|
||||
nOver = (overFlow / ADPCMFBYTES) << LFSAMPLES;
|
||||
if (nOver > nSam + nLeft) {
|
||||
nOver = nSam + nLeft;
|
||||
}
|
||||
|
||||
nbytes -= overFlow;
|
||||
|
||||
if ((nOver - (nOver & 0xf)) < outCount) {
|
||||
decoded = 1;
|
||||
ptr = _decodeChunk(ptr, f, nSam - nOver, nbytes, *outp, inp, f->dc_first);
|
||||
|
||||
if (f->dc_lastsam)
|
||||
*outp += (f->dc_lastsam << 1);
|
||||
else
|
||||
*outp += (ADPCMFSIZE << 1);
|
||||
|
||||
f->dc_lastsam = (outCount + f->dc_lastsam) & 0xf;
|
||||
f->dc_sample += outCount;
|
||||
f->dc_memin += ADPCMFBYTES * nframes;
|
||||
} else {
|
||||
f->dc_lastsam = 0;
|
||||
f->dc_memin += ADPCMFBYTES * nframes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put zeros in if necessary
|
||||
*/
|
||||
if (nOver) {
|
||||
f->dc_lastsam = 0;
|
||||
if (decoded) {
|
||||
startZero = (nLeft + nSam - nOver) << 1;
|
||||
} else {
|
||||
startZero = 0;
|
||||
}
|
||||
aClearBuffer(ptr++, startZero + *outp, nOver << 1);
|
||||
}
|
||||
|
||||
f->dc_lastsam = (outCount + f->dc_lastsam) & 0xf;
|
||||
f->dc_sample += outCount;
|
||||
f->dc_memin += ADPCMFBYTES*nframes;
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min);
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* The unlooped case, which is executed most of the time
|
||||
*/
|
||||
|
||||
nSam = nframes<<LFSAMPLES;
|
||||
|
||||
/*
|
||||
* overFlow is the number of bytes past the end
|
||||
* of the bitstream I try to generate
|
||||
*/
|
||||
overFlow = f->dc_memin + nbytes - ((s32) f->dc_table->base + f->dc_table->len);
|
||||
if (overFlow < 0)
|
||||
overFlow = 0;
|
||||
nOver = (overFlow/ADPCMFBYTES)<<LFSAMPLES;
|
||||
if (nOver > nSam + nLeft)
|
||||
nOver = nSam + nLeft;
|
||||
|
||||
nbytes -= overFlow;
|
||||
|
||||
if ((nOver - (nOver & 0xf))< outCount){
|
||||
decoded = 1;
|
||||
ptr = _decodeChunk(ptr, f, nSam - nOver, nbytes, *outp, inp, f->dc_first);
|
||||
|
||||
if (f->dc_lastsam)
|
||||
*outp += (f->dc_lastsam<<1);
|
||||
else
|
||||
*outp += (ADPCMFSIZE<<1);
|
||||
|
||||
f->dc_lastsam = (outCount + f->dc_lastsam) & 0xf;
|
||||
f->dc_sample += outCount;
|
||||
f->dc_memin += ADPCMFBYTES*nframes;
|
||||
} else {
|
||||
f->dc_lastsam = 0;
|
||||
f->dc_memin += ADPCMFBYTES*nframes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put zeros in if necessary
|
||||
*/
|
||||
if (nOver){
|
||||
f->dc_lastsam = 0;
|
||||
if (decoded)
|
||||
startZero = (nLeft + nSam - nOver)<<1;
|
||||
else
|
||||
startZero = 0;
|
||||
aClearBuffer(ptr++, startZero + *outp, nOver<<1);
|
||||
}
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(adpcm_num, adpcm_cnt, adpcm_max, adpcm_min);
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32
|
||||
n_alLoadParam(N_PVoice *filter, s32 paramID, void *param)
|
||||
{
|
||||
N_PVoice *a = filter;
|
||||
s32 n_alLoadParam(N_PVoice* filter, s32 paramID, void* param) {
|
||||
N_PVoice* a = filter;
|
||||
#if 0
|
||||
ALFilter *f = (ALFilter *) filter;
|
||||
#endif
|
||||
|
||||
switch (paramID) {
|
||||
case (AL_FILTER_SET_WAVETABLE):
|
||||
a->dc_table = (ALWaveTable *) param;
|
||||
a->dc_memin = (s32) a->dc_table->base;
|
||||
a->dc_sample = 0;
|
||||
switch (a->dc_table->type){
|
||||
case (AL_ADPCM_WAVE):
|
||||
|
||||
a->dc_table->len = ADPCMFBYTES *
|
||||
((s32) (a->dc_table->len/ADPCMFBYTES));
|
||||
|
||||
a->dc_bookSize = 2*a->dc_table->waveInfo.adpcmWave.book->order*
|
||||
a->dc_table->waveInfo.adpcmWave.book->npredictors*ADPCMVSIZE;
|
||||
if (a->dc_table->waveInfo.adpcmWave.loop) {
|
||||
a->dc_loop.start = a->dc_table->waveInfo.adpcmWave.loop->start;
|
||||
a->dc_loop.end = a->dc_table->waveInfo.adpcmWave.loop->end;
|
||||
a->dc_loop.count = a->dc_table->waveInfo.adpcmWave.loop->count;
|
||||
alCopy(a->dc_table->waveInfo.adpcmWave.loop->state,
|
||||
a->dc_lstate, sizeof(ADPCM_STATE));
|
||||
} else {
|
||||
a->dc_loop.start = a->dc_loop.end = a->dc_loop.count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_RAW16_WAVE):
|
||||
if (a->dc_table->waveInfo.rawWave.loop) {
|
||||
a->dc_loop.start = a->dc_table->waveInfo.rawWave.loop->start;
|
||||
a->dc_loop.end = a->dc_table->waveInfo.rawWave.loop->end;
|
||||
a->dc_loop.count = a->dc_table->waveInfo.rawWave.loop->count;
|
||||
} else {
|
||||
a->dc_loop.start = a->dc_loop.end = a->dc_loop.count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
switch (paramID) {
|
||||
case (AL_FILTER_SET_WAVETABLE):
|
||||
a->dc_table = (ALWaveTable*)param;
|
||||
a->dc_memin = (s32)a->dc_table->base;
|
||||
a->dc_sample = 0;
|
||||
switch (a->dc_table->type) {
|
||||
case (AL_ADPCM_WAVE):
|
||||
|
||||
a->dc_table->len = ADPCMFBYTES * ((s32)(a->dc_table->len / ADPCMFBYTES));
|
||||
|
||||
a->dc_bookSize = 2 * a->dc_table->waveInfo.adpcmWave.book->order *
|
||||
a->dc_table->waveInfo.adpcmWave.book->npredictors * ADPCMVSIZE;
|
||||
if (a->dc_table->waveInfo.adpcmWave.loop) {
|
||||
a->dc_loop.start = a->dc_table->waveInfo.adpcmWave.loop->start;
|
||||
a->dc_loop.end = a->dc_table->waveInfo.adpcmWave.loop->end;
|
||||
a->dc_loop.count = a->dc_table->waveInfo.adpcmWave.loop->count;
|
||||
alCopy(a->dc_table->waveInfo.adpcmWave.loop->state, a->dc_lstate, sizeof(ADPCM_STATE));
|
||||
} else {
|
||||
a->dc_loop.start = a->dc_loop.end = a->dc_loop.count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_RAW16_WAVE):
|
||||
if (a->dc_table->waveInfo.rawWave.loop) {
|
||||
a->dc_loop.start = a->dc_table->waveInfo.rawWave.loop->start;
|
||||
a->dc_loop.end = a->dc_table->waveInfo.rawWave.loop->end;
|
||||
a->dc_loop.count = a->dc_table->waveInfo.rawWave.loop->count;
|
||||
} else {
|
||||
a->dc_loop.start = a->dc_loop.end = a->dc_loop.count = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_FILTER_RESET):
|
||||
a->dc_lastsam = 0;
|
||||
a->dc_first = 1;
|
||||
a->dc_sample = 0;
|
||||
|
||||
/* sct 2/14/96 - Check table since it is initialized to null and */
|
||||
/* Get loop info according to table type. */
|
||||
if (a->dc_table) {
|
||||
a->dc_memin = (s32)a->dc_table->base;
|
||||
if (a->dc_table->type == AL_ADPCM_WAVE) {
|
||||
if (a->dc_table->waveInfo.adpcmWave.loop) {
|
||||
a->dc_loop.count = a->dc_table->waveInfo.adpcmWave.loop->count;
|
||||
}
|
||||
} else if (a->dc_table->type == AL_RAW16_WAVE) {
|
||||
if (a->dc_table->waveInfo.rawWave.loop) {
|
||||
a->dc_loop.count = a->dc_table->waveInfo.rawWave.loop->count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case (AL_FILTER_RESET):
|
||||
a->dc_lastsam = 0;
|
||||
a->dc_first = 1;
|
||||
a->dc_sample = 0;
|
||||
|
||||
/* sct 2/14/96 - Check table since it is initialized to null and */
|
||||
/* Get loop info according to table type. */
|
||||
if (a->dc_table)
|
||||
{
|
||||
a->dc_memin = (s32) a->dc_table->base;
|
||||
if (a->dc_table->type == AL_ADPCM_WAVE)
|
||||
{
|
||||
if (a->dc_table->waveInfo.adpcmWave.loop)
|
||||
a->dc_loop.count = a->dc_table->waveInfo.adpcmWave.loop->count;
|
||||
}
|
||||
else if (a->dc_table->type == AL_RAW16_WAVE)
|
||||
{
|
||||
if (a->dc_table->waveInfo.rawWave.loop)
|
||||
a->dc_loop.count = a->dc_table->waveInfo.rawWave.loop->count;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Acmd *_decodeChunk(Acmd *ptr, N_PVoice *f, s32 tsam,
|
||||
s32 nbytes, s16 outp, s16 inp, u32 flags)
|
||||
{
|
||||
s32 dramAlign, dramLoc;
|
||||
|
||||
if (nbytes > 0){
|
||||
dramLoc = (f->dc_dma)(f->dc_memin, nbytes, f->dc_dmaState);
|
||||
/*
|
||||
* Make sure enough is loaded into DMEM to take care
|
||||
* of 8 byte alignment
|
||||
*/
|
||||
dramAlign = dramLoc & 0x7;
|
||||
nbytes += dramAlign;
|
||||
Acmd* _decodeChunk(Acmd* ptr, N_PVoice* f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags) {
|
||||
s32 dramAlign, dramLoc;
|
||||
|
||||
if (nbytes > 0) {
|
||||
dramLoc = (f->dc_dma)(f->dc_memin, nbytes, f->dc_dmaState);
|
||||
/*
|
||||
* Make sure enough is loaded into DMEM to take care
|
||||
* of 8 byte alignment
|
||||
*/
|
||||
dramAlign = dramLoc & 0x7;
|
||||
nbytes += dramAlign;
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, inp, 0, nbytes + 8 - (nbytes & 0x7));
|
||||
aLoadBuffer(ptr++, dramLoc - dramAlign);
|
||||
aSetBuffer(ptr++, 0, inp, 0, nbytes + 8 - (nbytes & 0x7));
|
||||
aLoadBuffer(ptr++, dramLoc - dramAlign);
|
||||
#else
|
||||
n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 0x7), inp, dramLoc - dramAlign);
|
||||
n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 0x7), inp, dramLoc - dramAlign);
|
||||
#endif
|
||||
} else
|
||||
dramAlign = 0;
|
||||
|
||||
if (flags & A_LOOP){
|
||||
aSetLoop(ptr++, K0_TO_PHYS(f->dc_lstate));
|
||||
}
|
||||
} else {
|
||||
dramAlign = 0;
|
||||
}
|
||||
|
||||
if (flags & A_LOOP) {
|
||||
aSetLoop(ptr++, K0_TO_PHYS(f->dc_lstate));
|
||||
}
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, inp + dramAlign, outp, tsam<<1);
|
||||
aADPCMdec(ptr++, flags, K0_TO_PHYS(f->dc_state));
|
||||
aSetBuffer(ptr++, 0, inp + dramAlign, outp, tsam << 1);
|
||||
aADPCMdec(ptr++, flags, K0_TO_PHYS(f->dc_state));
|
||||
#else
|
||||
n_aADPCMdec(ptr++, K0_TO_PHYS(f->dc_state), flags, tsam<<1, dramAlign, outp);
|
||||
n_aADPCMdec(ptr++, K0_TO_PHYS(f->dc_state), flags, tsam << 1, dramAlign, outp);
|
||||
#endif
|
||||
f->dc_first = 0;
|
||||
return ptr;
|
||||
f->dc_first = 0;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -28,49 +28,47 @@ extern u32 D_800FD6F0;
|
||||
extern u8* D_800FCF28[];
|
||||
extern u32 D_800FCF30[];
|
||||
|
||||
Acmd *n_alMainBusPull(s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
Acmd* n_alMainBusPull(s32 sampleOffset, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
s32 i;
|
||||
|
||||
aClearBuffer(ptr++, N_AL_MAIN_L_OUT, N_AL_DIVIDED<<1);
|
||||
aClearBuffer(ptr++, N_AL_MAIN_L_OUT, N_AL_DIVIDED << 1);
|
||||
|
||||
ptr = (n_syn->mainBus->filter.handler)(sampleOffset,ptr);
|
||||
ptr = (n_syn->mainBus->filter.handler)(sampleOffset, ptr);
|
||||
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
|
||||
// theres more code after?
|
||||
if (D_800FC824 != 0) {
|
||||
aClearBuffer(ptr++, 0x7C0, 0x2E0);
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
|
||||
// theres more code after?
|
||||
if (D_800FC824 != 0) {
|
||||
aClearBuffer(ptr++, 0x7C0, 0x2E0);
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FC6D8[D_800FD6F0 * 2]));
|
||||
|
||||
D_800FD6F0 += 0xB8;
|
||||
D_800FD6F0 += 0xB8;
|
||||
if (D_800FD6F0 >= 0xB80) {
|
||||
D_800FD6F0 = 0;
|
||||
}
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
aClearBuffer(ptr++, 0x7C0, 0x2E0);
|
||||
}
|
||||
|
||||
if (D_80077D98 != 0) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
aClearBuffer(ptr++, 0x7C0, 0x2E0);
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
|
||||
|
||||
D_800FCF30[i] += 0xB8;
|
||||
if (D_800FCF30[i] >= 0x8A0) {
|
||||
D_800FCF30[i] = 0;
|
||||
}
|
||||
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
aClearBuffer(ptr++, 0x7C0, 0x2E0);
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
if (D_80077D98 != 0) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
aClearBuffer(ptr++, 0x7C0, 0x2E0);
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x7C0, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
|
||||
n_aLoadBuffer(ptr++, 0x170, 0x930, osVirtualToPhysical(&D_800FCF28[i][D_800FCF30[i] * 2]));
|
||||
|
||||
D_800FCF30[i] += 0xB8;
|
||||
if (D_800FCF30[i] >= 0x8A0) {
|
||||
D_800FCF30[i] = 0;
|
||||
}
|
||||
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(ptr++, 0, 0x7fff, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -29,14 +29,13 @@ extern u32 cnt_index, resampler_num, resampler_cnt, resampler_max, resampler_min
|
||||
/***********************************************************************
|
||||
* Resampler filter public interfaces
|
||||
***********************************************************************/
|
||||
Acmd *n_alResamplePull(N_PVoice *e, s16 *outp, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s16 inp;
|
||||
s32 inCount;
|
||||
s32 incr;
|
||||
f32 finCount;
|
||||
|
||||
Acmd* n_alResamplePull(N_PVoice* e, s16* outp, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
s16 inp;
|
||||
s32 inCount;
|
||||
s32 incr;
|
||||
f32 finCount;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
@@ -46,69 +45,69 @@ Acmd *n_alResamplePull(N_PVoice *e, s16 *outp, Acmd *p)
|
||||
#else
|
||||
inp = N_AL_DECODER_OUT;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* check if resampler is required
|
||||
*/
|
||||
if (e->rs_upitch) {
|
||||
|
||||
ptr = n_alAdpcmPull(e, &inp, FIXED_SAMPLE, p);
|
||||
aDMEMMove(ptr++, inp, *outp , FIXED_SAMPLE<<1);
|
||||
ptr = n_alAdpcmPull(e, &inp, FIXED_SAMPLE, p);
|
||||
aDMEMMove(ptr++, inp, *outp, FIXED_SAMPLE << 1);
|
||||
|
||||
} else {
|
||||
|
||||
/*
|
||||
* clip to maximum allowable pitch
|
||||
* FIXME: should we check for some minimum as well?
|
||||
*/
|
||||
if (e->rs_ratio > MAX_RATIO) e->rs_ratio = MAX_RATIO;
|
||||
/*
|
||||
* clip to maximum allowable pitch
|
||||
* FIXME: should we check for some minimum as well?
|
||||
*/
|
||||
if (e->rs_ratio > MAX_RATIO)
|
||||
e->rs_ratio = MAX_RATIO;
|
||||
|
||||
/*
|
||||
* quantize the pitch
|
||||
*/
|
||||
e->rs_ratio = (s32)(e->rs_ratio * UNITY_PITCH);
|
||||
e->rs_ratio = e->rs_ratio / UNITY_PITCH;
|
||||
/*
|
||||
* quantize the pitch
|
||||
*/
|
||||
e->rs_ratio = (s32)(e->rs_ratio * UNITY_PITCH);
|
||||
e->rs_ratio = e->rs_ratio / UNITY_PITCH;
|
||||
|
||||
/*
|
||||
* determine how many samples to generate
|
||||
*/
|
||||
finCount = e->rs_delta + (e->rs_ratio * (f32)FIXED_SAMPLE);
|
||||
inCount = (s32) finCount;
|
||||
e->rs_delta = finCount - (f32)inCount;
|
||||
/*
|
||||
* determine how many samples to generate
|
||||
*/
|
||||
finCount = e->rs_delta + (e->rs_ratio * (f32)FIXED_SAMPLE);
|
||||
inCount = (s32)finCount;
|
||||
e->rs_delta = finCount - (f32)inCount;
|
||||
|
||||
/*
|
||||
* ask all filters upstream from us to build their command
|
||||
* lists.
|
||||
*/
|
||||
ptr = n_alAdpcmPull(e, &inp,inCount, p);
|
||||
/*
|
||||
* ask all filters upstream from us to build their command
|
||||
* lists.
|
||||
*/
|
||||
ptr = n_alAdpcmPull(e, &inp, inCount, p);
|
||||
|
||||
/*
|
||||
* construct our portion of the command list
|
||||
*/
|
||||
incr = (s32)(e->rs_ratio * UNITY_PITCH);
|
||||
/*
|
||||
* construct our portion of the command list
|
||||
*/
|
||||
incr = (s32)(e->rs_ratio * UNITY_PITCH);
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, inp , *outp, FIXED_SAMPLE<<1);
|
||||
aResample(ptr++, e->rs_first, incr, osVirtualToPhysical(e->rs_state));
|
||||
aSetBuffer(ptr++, 0, inp, *outp, FIXED_SAMPLE << 1);
|
||||
aResample(ptr++, e->rs_first, incr, osVirtualToPhysical(e->rs_state));
|
||||
#else
|
||||
n_aResample(ptr++, osVirtualToPhysical(e->rs_state), e->rs_first, incr, inp, 0);
|
||||
n_aResample(ptr++, osVirtualToPhysical(e->rs_state), e->rs_first, incr, inp, 0);
|
||||
#endif
|
||||
e->rs_first = 0;
|
||||
e->rs_first = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(resampler_num, resampler_cnt, resampler_max, resampler_min);
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
s32 n_alResampleParam(N_PVoice *filter, s32 paramID, void *param)
|
||||
{
|
||||
N_PVoice *r = filter;
|
||||
s32 n_alResampleParam(N_PVoice* filter, s32 paramID, void* param) {
|
||||
N_PVoice* r = filter;
|
||||
union {
|
||||
f32 f;
|
||||
s32 i;
|
||||
f32 f;
|
||||
s32 i;
|
||||
} data;
|
||||
|
||||
|
||||
switch (paramID) {
|
||||
#if 0
|
||||
case (AL_FILTER_RESET):
|
||||
@@ -127,11 +126,10 @@ s32 n_alResampleParam(N_PVoice *filter, s32 paramID, void *param)
|
||||
case (AL_FILTER_SET_UNITY_PITCH):
|
||||
r->rs_upitch = 1;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
n_alLoadParam(filter, paramID, param);
|
||||
n_alLoadParam(filter, paramID, param);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,261 +33,255 @@ extern u32 load_num, load_cnt, load_max, load_min, save_num, save_cnt, save_max,
|
||||
/*
|
||||
* macros
|
||||
*/
|
||||
#define SWAP(in, out) \
|
||||
{ \
|
||||
s16 t = out; \
|
||||
out = in; \
|
||||
in = t; \
|
||||
}
|
||||
#define SWAP(in, out) \
|
||||
{ \
|
||||
s16 t = out; \
|
||||
out = in; \
|
||||
in = t; \
|
||||
}
|
||||
|
||||
Acmd *_n_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, Acmd *p);
|
||||
Acmd *_n_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p);
|
||||
Acmd *_n_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, Acmd *p);
|
||||
Acmd *_n_filterBuffer(ALLowPass *lp, s32 buff, Acmd *p);
|
||||
Acmd* _n_loadOutputBuffer(ALFx* r, ALDelay* d, s32 buff, Acmd* p);
|
||||
Acmd* _n_loadBuffer(ALFx* r, s16* curr_ptr, s32 buff, s32 count, Acmd* p);
|
||||
Acmd* _n_saveBuffer(ALFx* r, s16* curr_ptr, s32 buff, Acmd* p);
|
||||
Acmd* _n_filterBuffer(ALLowPass* lp, s32 buff, Acmd* p);
|
||||
|
||||
extern f32 _doModFunc(ALDelay *d, s32 count);
|
||||
extern f32 _doModFunc(ALDelay* d, s32 count);
|
||||
extern s32 L_INC[];
|
||||
|
||||
/***********************************************************************
|
||||
* Reverb filter public interfaces
|
||||
***********************************************************************/
|
||||
Acmd *n_alFxPull(s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
ALFx *r = (ALFx *)n_syn->auxBus->fx;
|
||||
s16 i, buff1, buff2, input, output;
|
||||
s16 *in_ptr, *out_ptr, gain, *prev_out_ptr = 0;
|
||||
ALDelay *d, *pd;
|
||||
|
||||
Acmd* n_alFxPull(s32 sampleOffset, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
ALFx* r = (ALFx*)n_syn->auxBus->fx;
|
||||
s16 i, buff1, buff2, input, output;
|
||||
s16 *in_ptr, *out_ptr, gain, *prev_out_ptr = 0;
|
||||
ALDelay *d, *pd;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* pull channels going into this effect first
|
||||
*/
|
||||
ptr = n_alAuxBusPull(sampleOffset, p);
|
||||
|
||||
#ifndef N_MICRO
|
||||
input = AL_AUX_L_OUT;
|
||||
output = AL_AUX_R_OUT;
|
||||
buff1 = AL_TEMP_0;
|
||||
buff2 = AL_TEMP_1;
|
||||
#else
|
||||
input = N_AL_AUX_L_OUT;
|
||||
output = N_AL_AUX_R_OUT;
|
||||
buff1 = N_AL_TEMP_0;
|
||||
buff2 = N_AL_TEMP_1;
|
||||
#endif
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE<<1); /* set the buffer size */
|
||||
aMix(ptr++, 0, 0xda83, AL_AUX_L_OUT, input); /* .707L = L - .293L */
|
||||
aMix(ptr++, 0, 0x5a82, AL_AUX_R_OUT, input); /* mix the AuxL and AuxR into the AuxL */
|
||||
#else
|
||||
aMix(ptr++, 0, 0xda83, N_AL_AUX_L_OUT, input);
|
||||
aMix(ptr++, 0, 0x5a82, N_AL_AUX_R_OUT, input);
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
/* and write the mixed value to the delay line at r->input */
|
||||
ptr = _n_saveBuffer(r, r->input, input, ptr);
|
||||
|
||||
aClearBuffer(ptr++, output, FIXED_SAMPLE<<1); /* clear the AL_AUX_R_OUT */
|
||||
|
||||
for (i = 0; i < r->section_count; i++) {
|
||||
d = &r->delay[i]; /* get the ALDelay structure */
|
||||
in_ptr = &r->input[-d->input];
|
||||
out_ptr = &r->input[-d->output];
|
||||
|
||||
if (in_ptr == prev_out_ptr) {
|
||||
SWAP(buff1, buff2);
|
||||
} else { /* load data at in_ptr into buff1 */
|
||||
ptr = _n_loadBuffer(r, in_ptr, buff1, FIXED_SAMPLE, ptr);
|
||||
}
|
||||
ptr = _n_loadOutputBuffer(r, d, buff2, ptr);
|
||||
|
||||
if (d->ffcoef) {
|
||||
aMix(ptr++, 0, (u16)d->ffcoef, buff1, buff2);
|
||||
if (!d->rs && !d->lp) {
|
||||
ptr = _n_saveBuffer(r, out_ptr, buff2, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (d->fbcoef) {
|
||||
aMix(ptr++, 0, (u16)d->fbcoef, buff2, buff1);
|
||||
ptr = _n_saveBuffer(r, in_ptr, buff1, ptr);
|
||||
}
|
||||
|
||||
if (d->lp)
|
||||
ptr = _n_filterBuffer(d->lp, buff2, ptr);
|
||||
|
||||
if (!d->rs)
|
||||
ptr = _n_saveBuffer(r, out_ptr, buff2, ptr);
|
||||
|
||||
if (d->gain)
|
||||
aMix(ptr++, 0, (u16)d->gain, buff2, output);
|
||||
|
||||
prev_out_ptr = &r->input[d->output];
|
||||
}
|
||||
|
||||
/*
|
||||
* bump the master delay line input pointer
|
||||
* modulo the length
|
||||
*/
|
||||
r->input += FIXED_SAMPLE;
|
||||
if (r->input > &r->base[r->length])
|
||||
r->input -= r->length;
|
||||
|
||||
/*
|
||||
* output already in AL_AUX_R_OUT
|
||||
* just copy to AL_AUX_L_OUT
|
||||
*/
|
||||
/*
|
||||
* pull channels going into this effect first
|
||||
*/
|
||||
ptr = n_alAuxBusPull(sampleOffset, p);
|
||||
|
||||
#ifndef N_MICRO
|
||||
aDMEMMove(ptr++, output, AL_AUX_L_OUT, FIXED_SAMPLE<<1);
|
||||
input = AL_AUX_L_OUT;
|
||||
output = AL_AUX_R_OUT;
|
||||
buff1 = AL_TEMP_0;
|
||||
buff2 = AL_TEMP_1;
|
||||
#else
|
||||
aDMEMMove(ptr++, output, N_AL_AUX_L_OUT, FIXED_SAMPLE<<1);
|
||||
input = N_AL_AUX_L_OUT;
|
||||
output = N_AL_AUX_R_OUT;
|
||||
buff1 = N_AL_TEMP_0;
|
||||
buff2 = N_AL_TEMP_1;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE << 1); /* set the buffer size */
|
||||
aMix(ptr++, 0, 0xda83, AL_AUX_L_OUT, input); /* .707L = L - .293L */
|
||||
aMix(ptr++, 0, 0x5a82, AL_AUX_R_OUT, input); /* mix the AuxL and AuxR into the AuxL */
|
||||
#else
|
||||
aMix(ptr++, 0, 0xda83, N_AL_AUX_L_OUT, input);
|
||||
aMix(ptr++, 0, 0x5a82, N_AL_AUX_R_OUT, input);
|
||||
#endif
|
||||
|
||||
/* and write the mixed value to the delay line at r->input */
|
||||
ptr = _n_saveBuffer(r, r->input, input, ptr);
|
||||
|
||||
aClearBuffer(ptr++, output, FIXED_SAMPLE << 1); /* clear the AL_AUX_R_OUT */
|
||||
|
||||
for (i = 0; i < r->section_count; i++) {
|
||||
d = &r->delay[i]; /* get the ALDelay structure */
|
||||
in_ptr = &r->input[-d->input];
|
||||
out_ptr = &r->input[-d->output];
|
||||
|
||||
if (in_ptr == prev_out_ptr) {
|
||||
SWAP(buff1, buff2);
|
||||
} else { /* load data at in_ptr into buff1 */
|
||||
ptr = _n_loadBuffer(r, in_ptr, buff1, FIXED_SAMPLE, ptr);
|
||||
}
|
||||
ptr = _n_loadOutputBuffer(r, d, buff2, ptr);
|
||||
|
||||
if (d->ffcoef) {
|
||||
aMix(ptr++, 0, (u16)d->ffcoef, buff1, buff2);
|
||||
if (!d->rs && !d->lp) {
|
||||
ptr = _n_saveBuffer(r, out_ptr, buff2, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (d->fbcoef) {
|
||||
aMix(ptr++, 0, (u16)d->fbcoef, buff2, buff1);
|
||||
ptr = _n_saveBuffer(r, in_ptr, buff1, ptr);
|
||||
}
|
||||
|
||||
if (d->lp)
|
||||
ptr = _n_filterBuffer(d->lp, buff2, ptr);
|
||||
|
||||
if (!d->rs)
|
||||
ptr = _n_saveBuffer(r, out_ptr, buff2, ptr);
|
||||
|
||||
if (d->gain)
|
||||
aMix(ptr++, 0, (u16)d->gain, buff2, output);
|
||||
|
||||
prev_out_ptr = &r->input[d->output];
|
||||
}
|
||||
|
||||
/*
|
||||
* bump the master delay line input pointer
|
||||
* modulo the length
|
||||
*/
|
||||
r->input += FIXED_SAMPLE;
|
||||
if (r->input > &r->base[r->length]) {
|
||||
r->input -= r->length;
|
||||
}
|
||||
|
||||
/*
|
||||
* output already in AL_AUX_R_OUT
|
||||
* just copy to AL_AUX_L_OUT
|
||||
*/
|
||||
#ifndef N_MICRO
|
||||
aDMEMMove(ptr++, output, AL_AUX_L_OUT, FIXED_SAMPLE << 1);
|
||||
#else
|
||||
aDMEMMove(ptr++, output, N_AL_AUX_L_OUT, FIXED_SAMPLE << 1);
|
||||
#endif
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(reverb_num, reverb_cnt, reverb_max, reverb_min);
|
||||
PROFILE_AUD(reverb_num, reverb_cnt, reverb_max, reverb_min);
|
||||
#endif
|
||||
return ptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine gets called by alSynSetFXParam. No checking takes place to
|
||||
* verify the validity of the paramID or the param value. input and output
|
||||
* values must be 8 byte aligned, so round down any param passed.
|
||||
* This routine gets called by alSynSetFXParam. No checking takes place to
|
||||
* verify the validity of the paramID or the param value. input and output
|
||||
* values must be 8 byte aligned, so round down any param passed.
|
||||
*/
|
||||
s32 n_alFxParamHdl(void *filter, s32 paramID, void *param)
|
||||
{
|
||||
ALFx *f = (ALFx *) filter;
|
||||
s32 p = (paramID - 2) % 8;
|
||||
s32 s = (paramID - 2) / 8;
|
||||
s32 val = *(s32*)param;
|
||||
|
||||
#define INPUT_PARAM 0
|
||||
#define OUTPUT_PARAM 1
|
||||
#define FBCOEF_PARAM 2
|
||||
#define FFCOEF_PARAM 3
|
||||
#define GAIN_PARAM 4
|
||||
#define CHORUSRATE_PARAM 5
|
||||
#define CHORUSDEPTH_PARAM 6
|
||||
#define LPFILT_PARAM 7
|
||||
|
||||
switch(p)
|
||||
{
|
||||
case INPUT_PARAM:
|
||||
f->delay[s].input = (u32)val & 0xFFFFFFF8;
|
||||
break;
|
||||
case OUTPUT_PARAM:
|
||||
f->delay[s].output = (u32)val & 0xFFFFFFF8;
|
||||
break;
|
||||
case FFCOEF_PARAM:
|
||||
f->delay[s].ffcoef = (s16)val;
|
||||
break;
|
||||
case FBCOEF_PARAM:
|
||||
f->delay[s].fbcoef = (s16)val;
|
||||
break;
|
||||
case GAIN_PARAM:
|
||||
f->delay[s].gain = (s16)val;
|
||||
break;
|
||||
case CHORUSRATE_PARAM:
|
||||
/* f->delay[s].rsinc = ((f32)val)/0xffffff; */
|
||||
f->delay[s].rsinc
|
||||
= ((((f32)val)/1000) * RANGE)/n_syn->outputRate;
|
||||
break;
|
||||
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
*
|
||||
* ratio = 2^(cents/1200)
|
||||
*
|
||||
* and therefore for hundredths of a cent
|
||||
* x
|
||||
* ln(ratio) = ---------------
|
||||
* (120,000)/ln(2)
|
||||
* where
|
||||
* 120,000/ln(2) = 173123.40...
|
||||
*/
|
||||
s32 n_alFxParamHdl(void* filter, s32 paramID, void* param) {
|
||||
ALFx* f = (ALFx*)filter;
|
||||
s32 p = (paramID - 2) % 8;
|
||||
s32 s = (paramID - 2) / 8;
|
||||
s32 val = *(s32*)param;
|
||||
|
||||
#define INPUT_PARAM 0
|
||||
#define OUTPUT_PARAM 1
|
||||
#define FBCOEF_PARAM 2
|
||||
#define FFCOEF_PARAM 3
|
||||
#define GAIN_PARAM 4
|
||||
#define CHORUSRATE_PARAM 5
|
||||
#define CHORUSDEPTH_PARAM 6
|
||||
#define LPFILT_PARAM 7
|
||||
|
||||
switch (p) {
|
||||
case INPUT_PARAM:
|
||||
f->delay[s].input = (u32)val & 0xFFFFFFF8;
|
||||
break;
|
||||
case OUTPUT_PARAM:
|
||||
f->delay[s].output = (u32)val & 0xFFFFFFF8;
|
||||
break;
|
||||
case FFCOEF_PARAM:
|
||||
f->delay[s].ffcoef = (s16)val;
|
||||
break;
|
||||
case FBCOEF_PARAM:
|
||||
f->delay[s].fbcoef = (s16)val;
|
||||
break;
|
||||
case GAIN_PARAM:
|
||||
f->delay[s].gain = (s16)val;
|
||||
break;
|
||||
case CHORUSRATE_PARAM:
|
||||
/* f->delay[s].rsinc = ((f32)val)/0xffffff; */
|
||||
f->delay[s].rsinc = ((((f32)val) / 1000) * RANGE) / n_syn->outputRate;
|
||||
break;
|
||||
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
*
|
||||
* ratio = 2^(cents/1200)
|
||||
*
|
||||
* and therefore for hundredths of a cent
|
||||
* x
|
||||
* ln(ratio) = ---------------
|
||||
* (120,000)/ln(2)
|
||||
* where
|
||||
* 120,000/ln(2) = 173123.40...
|
||||
*/
|
||||
#define CONVERT 173123.404906676
|
||||
#define LENGTH (f->delay[s].output - f->delay[s].input)
|
||||
|
||||
case CHORUSDEPTH_PARAM:
|
||||
/*f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH; */
|
||||
f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH;
|
||||
break;
|
||||
case LPFILT_PARAM:
|
||||
if(f->delay[s].lp)
|
||||
{
|
||||
f->delay[s].lp->fc = (s16)val;
|
||||
#define LENGTH (f->delay[s].output - f->delay[s].input)
|
||||
|
||||
case CHORUSDEPTH_PARAM:
|
||||
/*f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH; */
|
||||
f->delay[s].rsgain = (((f32)val) / CONVERT) * LENGTH;
|
||||
break;
|
||||
case LPFILT_PARAM:
|
||||
if (f->delay[s].lp) {
|
||||
f->delay[s].lp->fc = (s16)val;
|
||||
#ifdef _OLD_AUDIO_LIBRARY
|
||||
init_lpfilter(f->delay[s].lp);
|
||||
init_lpfilter(f->delay[s].lp);
|
||||
#else
|
||||
_init_lpfilter(f->delay[s].lp);
|
||||
_init_lpfilter(f->delay[s].lp);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Acmd *_n_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
Acmd* _n_loadOutputBuffer(ALFx* r, ALDelay* d, s32 buff, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
#ifndef N_MICRO
|
||||
s32 ratio, count, rbuff = AL_TEMP_2;
|
||||
s32 ratio, count, rbuff = AL_TEMP_2;
|
||||
#else
|
||||
s32 ratio, count, rbuff = N_AL_TEMP_2;
|
||||
s32 ratio, count, rbuff = N_AL_TEMP_2;
|
||||
#endif
|
||||
s16 *out_ptr;
|
||||
f32 fincount, fratio, delta;
|
||||
s32 ramalign = 0, length;
|
||||
static f32 val=0.0, lastval=-10.0;
|
||||
static f32 blob=0;
|
||||
s32 incount = FIXED_SAMPLE;
|
||||
s16* out_ptr;
|
||||
f32 fincount, fratio, delta;
|
||||
s32 ramalign = 0, length;
|
||||
static f32 val = 0.0, lastval = -10.0;
|
||||
static f32 blob = 0;
|
||||
s32 incount = FIXED_SAMPLE;
|
||||
|
||||
if (d->rs) {
|
||||
length = d->output - d->input;
|
||||
delta = _doModFunc(d, incount);
|
||||
delta /= length;
|
||||
delta = (s32)(delta * UNITY_PITCH);
|
||||
delta = delta / UNITY_PITCH;
|
||||
fratio = 1.0 - delta;
|
||||
fincount = d->rs->delta + (fratio * (f32)incount);
|
||||
count = (s32) fincount;
|
||||
d->rs->delta = fincount - (f32)count;
|
||||
out_ptr = &r->input[-(d->output - d->rsdelta)];
|
||||
ramalign = ((s32)out_ptr & 0x7) >> 1;
|
||||
ptr = _n_loadBuffer(r, out_ptr - ramalign, rbuff, count + ramalign, ptr);
|
||||
|
||||
ratio = (s32)(fratio * UNITY_PITCH);
|
||||
if (d->rs) {
|
||||
length = d->output - d->input;
|
||||
delta = _doModFunc(d, incount);
|
||||
delta /= length;
|
||||
delta = (s32)(delta * UNITY_PITCH);
|
||||
delta = delta / UNITY_PITCH;
|
||||
fratio = 1.0 - delta;
|
||||
fincount = d->rs->delta + (fratio * (f32)incount);
|
||||
count = (s32)fincount;
|
||||
d->rs->delta = fincount - (f32)count;
|
||||
out_ptr = &r->input[-(d->output - d->rsdelta)];
|
||||
ramalign = ((s32)out_ptr & 0x7) >> 1;
|
||||
ptr = _n_loadBuffer(r, out_ptr - ramalign, rbuff, count + ramalign, ptr);
|
||||
|
||||
ratio = (s32)(fratio * UNITY_PITCH);
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, rbuff + (ramalign<<1), buff, incount<<1);
|
||||
aResample(ptr++, d->rs->first, ratio, osVirtualToPhysical(d->rs->state));
|
||||
aSetBuffer(ptr++, 0, rbuff + (ramalign << 1), buff, incount << 1);
|
||||
aResample(ptr++, d->rs->first, ratio, osVirtualToPhysical(d->rs->state));
|
||||
#else
|
||||
{
|
||||
s16 tmp;
|
||||
{
|
||||
s16 tmp;
|
||||
|
||||
tmp = buff >> 8;
|
||||
n_aResample(ptr++, osVirtualToPhysical(d->rs->state), d->rs->first, ratio, rbuff + (ramalign<<1), tmp);
|
||||
}
|
||||
#endif
|
||||
d->rs->first = 0;
|
||||
d->rsdelta += count - incount;
|
||||
} else {
|
||||
out_ptr = &r->input[-d->output];
|
||||
ptr = _n_loadBuffer(r, out_ptr, buff, FIXED_SAMPLE, ptr);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
tmp = buff >> 8;
|
||||
n_aResample(ptr++, osVirtualToPhysical(d->rs->state), d->rs->first, ratio, rbuff + (ramalign << 1), tmp);
|
||||
}
|
||||
#endif
|
||||
d->rs->first = 0;
|
||||
d->rsdelta += count - incount;
|
||||
} else {
|
||||
out_ptr = &r->input[-d->output];
|
||||
ptr = _n_loadBuffer(r, out_ptr, buff, FIXED_SAMPLE, ptr);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Acmd *_n_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff,s32 count, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s32 after_end, before_end;
|
||||
s16 *updated_ptr, *delay_end;
|
||||
Acmd* _n_loadBuffer(ALFx* r, s16* curr_ptr, s32 buff, s32 count, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
s32 after_end, before_end;
|
||||
s16 *updated_ptr, *delay_end;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
@@ -296,35 +290,35 @@ Acmd *_n_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff,s32 count, Acmd *p)
|
||||
delay_end = &r->base[r->length];
|
||||
|
||||
#ifdef _DEBUG
|
||||
if(curr_ptr > delay_end)
|
||||
if (curr_ptr > delay_end)
|
||||
__osError(ERR_ALMODDELAYOVERFLOW, 1, delay_end - curr_ptr);
|
||||
#endif
|
||||
|
||||
if (curr_ptr < r->base)
|
||||
curr_ptr += r->length;
|
||||
curr_ptr += r->length;
|
||||
updated_ptr = curr_ptr + count;
|
||||
|
||||
|
||||
if (updated_ptr > delay_end) {
|
||||
after_end = updated_ptr - delay_end;
|
||||
before_end = delay_end - curr_ptr;
|
||||
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, buff, 0, before_end<<1);
|
||||
aSetBuffer(ptr++, 0, buff, 0, before_end << 1);
|
||||
aLoadBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
aSetBuffer(ptr++, 0, buff+(before_end<<1), 0, after_end<<1);
|
||||
aSetBuffer(ptr++, 0, buff + (before_end << 1), 0, after_end << 1);
|
||||
aLoadBuffer(ptr++, osVirtualToPhysical(r->base));
|
||||
} else {
|
||||
aSetBuffer(ptr++, 0, buff, 0, count<<1);
|
||||
aSetBuffer(ptr++, 0, buff, 0, count << 1);
|
||||
aLoadBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
|
||||
aSetBuffer(ptr++, 0, 0, 0, count<<1);
|
||||
aSetBuffer(ptr++, 0, 0, 0, count << 1);
|
||||
#else
|
||||
n_aLoadBuffer(ptr++, before_end<<1, buff, osVirtualToPhysical(curr_ptr));
|
||||
n_aLoadBuffer(ptr++, after_end<<1, buff+(before_end<<1), osVirtualToPhysical(r->base));
|
||||
} else {
|
||||
n_aLoadBuffer(ptr++, count<<1, buff, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
n_aLoadBuffer(ptr++, before_end << 1, buff, osVirtualToPhysical(curr_ptr));
|
||||
n_aLoadBuffer(ptr++, after_end << 1, buff + (before_end << 1), osVirtualToPhysical(r->base));
|
||||
} else {
|
||||
n_aLoadBuffer(ptr++, count << 1, buff, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
@@ -333,18 +327,17 @@ Acmd *_n_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff,s32 count, Acmd *p)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Acmd *_n_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
s32 after_end, before_end;
|
||||
s16 *updated_ptr, *delay_end;
|
||||
Acmd* _n_saveBuffer(ALFx* r, s16* curr_ptr, s32 buff, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
s32 after_end, before_end;
|
||||
s16 *updated_ptr, *delay_end;
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
delay_end = &r->base[r->length];
|
||||
if (curr_ptr < r->base) /* probably just security */
|
||||
curr_ptr += r->length; /* shouldn't occur */
|
||||
if (curr_ptr < r->base) /* probably just security */
|
||||
curr_ptr += r->length; /* shouldn't occur */
|
||||
updated_ptr = curr_ptr + FIXED_SAMPLE;
|
||||
|
||||
if (updated_ptr > delay_end) { /* if the data wraps past end of r->base */
|
||||
@@ -352,44 +345,42 @@ Acmd *_n_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, Acmd *p)
|
||||
before_end = delay_end - curr_ptr;
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, 0, buff, before_end<<1);
|
||||
aSetBuffer(ptr++, 0, 0, buff, before_end << 1);
|
||||
aSaveBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
aSetBuffer(ptr++, 0, 0, buff+(before_end<<1), after_end<<1);
|
||||
aSetBuffer(ptr++, 0, 0, buff + (before_end << 1), after_end << 1);
|
||||
aSaveBuffer(ptr++, osVirtualToPhysical(r->base));
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE<<1);
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE << 1);
|
||||
} else {
|
||||
aSetBuffer(ptr++, 0, 0, buff, FIXED_SAMPLE<<1);
|
||||
aSetBuffer(ptr++, 0, 0, buff, FIXED_SAMPLE << 1);
|
||||
aSaveBuffer(ptr++, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
#else
|
||||
n_aSaveBuffer(ptr++, before_end<<1, buff, osVirtualToPhysical(curr_ptr));
|
||||
n_aSaveBuffer(ptr++, after_end<<1, buff+(before_end<<1), osVirtualToPhysical(r->base));
|
||||
} else {
|
||||
n_aSaveBuffer(ptr++, FIXED_SAMPLE<<1, buff, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
n_aSaveBuffer(ptr++, before_end << 1, buff, osVirtualToPhysical(curr_ptr));
|
||||
n_aSaveBuffer(ptr++, after_end << 1, buff + (before_end << 1), osVirtualToPhysical(r->base));
|
||||
} else {
|
||||
n_aSaveBuffer(ptr++, FIXED_SAMPLE << 1, buff, osVirtualToPhysical(curr_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(save_num, save_cnt, save_max, save_min);
|
||||
#endif
|
||||
return ptr;
|
||||
|
||||
}
|
||||
|
||||
Acmd *_n_filterBuffer(ALLowPass *lp, s32 buff, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
Acmd* _n_filterBuffer(ALLowPass* lp, s32 buff, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer(ptr++, 0, buff, buff, FIXED_SAMPLE<<1);
|
||||
aSetBuffer(ptr++, 0, buff, buff, FIXED_SAMPLE << 1);
|
||||
aLoadADPCM(ptr++, 32, osVirtualToPhysical(lp->fcvec.fccoef));
|
||||
aPoleFilter(ptr++, lp->first, lp->fgain, osVirtualToPhysical(lp->fstate));
|
||||
#else
|
||||
{
|
||||
s16 tmp;
|
||||
s16 tmp;
|
||||
|
||||
tmp = buff >> 8;
|
||||
n_aLoadADPCM(ptr++, 32, osVirtualToPhysical(lp->fcvec.fccoef));
|
||||
n_aPoleFilter(ptr++, lp->first, lp->fgain, tmp, osVirtualToPhysical(lp->fstate));
|
||||
tmp = buff >> 8;
|
||||
n_aLoadADPCM(ptr++, 32, osVirtualToPhysical(lp->fcvec.fccoef));
|
||||
n_aPoleFilter(ptr++, lp->first, lp->fgain, tmp, osVirtualToPhysical(lp->fstate));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -397,5 +388,3 @@ Acmd *_n_filterBuffer(ALLowPass *lp, s32 buff, Acmd *p)
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,22 +21,21 @@
|
||||
|
||||
#include <os.h>
|
||||
|
||||
Acmd *n_alSavePull(s32 sampleOffset, Acmd *p)
|
||||
{
|
||||
Acmd *ptr = p;
|
||||
Acmd* n_alSavePull(s32 sampleOffset, Acmd* p) {
|
||||
Acmd* ptr = p;
|
||||
|
||||
ptr = n_alMainBusPull(sampleOffset, ptr);
|
||||
|
||||
|
||||
#ifndef N_MICRO
|
||||
aSetBuffer (ptr++, 0, 0, 0, FIXED_SAMPLE<<1);
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE << 1);
|
||||
aInterleave(ptr++, AL_MAIN_L_OUT, AL_MAIN_R_OUT);
|
||||
aSetBuffer (ptr++, 0, 0, 0, FIXED_SAMPLE<<2);
|
||||
aSetBuffer(ptr++, 0, 0, 0, FIXED_SAMPLE << 2);
|
||||
aSaveBuffer(ptr++, n_syn->sv_dramout);
|
||||
#else
|
||||
n_aInterleave(ptr++); n_aSaveBuffer(ptr++, FIXED_SAMPLE<<2, 0, n_syn->sv_dramout);
|
||||
// clang-format off
|
||||
n_aInterleave(ptr++); \
|
||||
n_aSaveBuffer(ptr++, FIXED_SAMPLE << 2, 0, n_syn->sv_dramout);
|
||||
// clang-format on
|
||||
#endif
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,25 +19,23 @@
|
||||
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
N_ALGlobals *n_alGlobals = 0;
|
||||
N_ALSynth *n_syn = 0;
|
||||
N_ALGlobals* n_alGlobals = 0;
|
||||
N_ALSynth* n_syn = 0;
|
||||
|
||||
void n_alInit(N_ALGlobals *g, ALSynConfig *c)
|
||||
{
|
||||
void n_alInit(N_ALGlobals* g, ALSynConfig* c) {
|
||||
if (!n_alGlobals) { /* already initialized? */
|
||||
n_alGlobals = g;
|
||||
if(!n_syn) {
|
||||
n_syn = &n_alGlobals -> drvr;
|
||||
n_alSynNew(c);
|
||||
}
|
||||
n_alGlobals = g;
|
||||
if (!n_syn) {
|
||||
n_syn = &n_alGlobals->drvr;
|
||||
n_alSynNew(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void n_alClose(void)
|
||||
{
|
||||
void n_alClose(void) {
|
||||
if (n_alGlobals) {
|
||||
n_alSynDelete();
|
||||
n_alGlobals = 0;
|
||||
n_syn = 0;
|
||||
n_syn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,12 @@
|
||||
#include <os_internal.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
|
||||
void n_alSynAddPlayer(ALPlayer *client)
|
||||
{
|
||||
void n_alSynAddPlayer(ALPlayer* client) {
|
||||
OSIntMask mask = osSetIntMask(OS_IM_NONE);
|
||||
|
||||
client->samplesLeft = n_syn->curSamples;
|
||||
client->next = n_syn->head;
|
||||
n_syn->head = client;
|
||||
n_syn->head = client;
|
||||
|
||||
osSetIntMask(mask);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
*====================================================================*/
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
ALFxRef n_alSynAllocFX(s16 bus, ALSynConfig *c, ALHeap *hp)
|
||||
{
|
||||
ALFxRef n_alSynAllocFX(s16 bus, ALSynConfig* c, ALHeap* hp) {
|
||||
n_alFxNew(&n_syn->auxBus->fx_array[bus], c, hp);
|
||||
return(n_syn->auxBus->fx_array[bus]);
|
||||
return (n_syn->auxBus->fx_array[bus]);
|
||||
}
|
||||
|
||||
@@ -20,16 +20,14 @@
|
||||
#include <ultraerror.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
static s32 _allocatePVoice(N_PVoice** pvoice, s16 priority);
|
||||
|
||||
static s32 _allocatePVoice(N_PVoice **pvoice, s16 priority);
|
||||
|
||||
s32 n_alSynAllocVoice(N_ALVoice *voice, ALVoiceConfig *vc)
|
||||
{
|
||||
N_PVoice *pvoice = 0;
|
||||
ALFilter *f;
|
||||
ALParam *update;
|
||||
s32 n_alSynAllocVoice(N_ALVoice* voice, ALVoiceConfig* vc) {
|
||||
N_PVoice* pvoice = 0;
|
||||
ALFilter* f;
|
||||
ALParam* update;
|
||||
s32 stolen;
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
/* need two updates if voice is stolen */
|
||||
if (n_syn->paramList == 0) {
|
||||
@@ -39,42 +37,42 @@ s32 n_alSynAllocVoice(N_ALVoice *voice, ALVoiceConfig *vc)
|
||||
__osError(ERR_ALSYN_NO_UPDATE, 0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
voice->priority = vc->priority;
|
||||
voice->unityPitch = vc->unityPitch;
|
||||
voice->table = 0;
|
||||
voice->fxBus = vc->fxBus;
|
||||
voice->state = AL_STOPPED;
|
||||
voice->pvoice = 0;
|
||||
voice->priority = vc->priority;
|
||||
voice->unityPitch = vc->unityPitch;
|
||||
voice->table = 0;
|
||||
voice->fxBus = vc->fxBus;
|
||||
voice->state = AL_STOPPED;
|
||||
voice->pvoice = 0;
|
||||
|
||||
stolen = _allocatePVoice(&pvoice, vc->priority);
|
||||
|
||||
if (pvoice) { /* if we were able to allocate a voice */
|
||||
|
||||
if (pvoice) { /* if we were able to allocate a voice */
|
||||
if (stolen) {
|
||||
|
||||
|
||||
pvoice->offset = 552;
|
||||
pvoice->vvoice->pvoice = 0; /* zero stolen voice */
|
||||
|
||||
#if 1
|
||||
pvoice->vvoice = voice;
|
||||
voice->pvoice = pvoice;
|
||||
pvoice->vvoice = voice;
|
||||
voice->pvoice = pvoice;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* ramp down stolen voice
|
||||
*/
|
||||
update = __n_allocParam();
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples );
|
||||
update->delta = SAMPLE184(n_syn->paramSamples);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples;
|
||||
update->delta = n_syn->paramSamples;
|
||||
#endif
|
||||
update->type = AL_FILTER_SET_VOLUME;
|
||||
update->data.i = 0;
|
||||
update->type = AL_FILTER_SET_VOLUME;
|
||||
update->data.i = 0;
|
||||
update->moredata.i = 368; /* pvoice->offset - 184 */
|
||||
|
||||
n_alEnvmixerParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
|
||||
/*
|
||||
* stop stolen voice
|
||||
@@ -82,16 +80,16 @@ s32 n_alSynAllocVoice(N_ALVoice *voice, ALVoiceConfig *vc)
|
||||
update = __n_allocParam();
|
||||
if (update) {
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_STOP_VOICE;
|
||||
update->next = 0;
|
||||
n_alEnvmixerParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
update->type = AL_FILTER_STOP_VOICE;
|
||||
update->next = 0;
|
||||
n_alEnvmixerParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
__osError(ERR_ALSYN_NO_UPDATE, 0);
|
||||
#endif
|
||||
}
|
||||
@@ -99,37 +97,35 @@ s32 n_alSynAllocVoice(N_ALVoice *voice, ALVoiceConfig *vc)
|
||||
} else {
|
||||
pvoice->offset = 0;
|
||||
#if 1
|
||||
pvoice->vvoice = voice;
|
||||
voice->pvoice = pvoice;
|
||||
pvoice->vvoice = voice;
|
||||
voice->pvoice = pvoice;
|
||||
#endif
|
||||
|
||||
}
|
||||
#if 0
|
||||
pvoice->vvoice = voice; /* assign new voice */
|
||||
voice->pvoice = pvoice;
|
||||
#endif
|
||||
}
|
||||
|
||||
return (pvoice != 0);
|
||||
|
||||
return (pvoice != 0);
|
||||
}
|
||||
|
||||
s32 _allocatePVoice(N_PVoice **pvoice, s16 priority)
|
||||
{
|
||||
ALLink *dl;
|
||||
N_PVoice *pv;
|
||||
s32 stolen = 0;
|
||||
|
||||
s32 _allocatePVoice(N_PVoice** pvoice, s16 priority) {
|
||||
ALLink* dl;
|
||||
N_PVoice* pv;
|
||||
s32 stolen = 0;
|
||||
|
||||
if ((dl = n_syn->pLameList.next) != 0) { /* check the lame list first */
|
||||
*pvoice = (N_PVoice *)dl;
|
||||
*pvoice = (N_PVoice*)dl;
|
||||
alUnlink(dl);
|
||||
alLink(dl, &n_syn->pAllocList);
|
||||
alLink(dl, &n_syn->pAllocList);
|
||||
} else if ((dl = n_syn->pFreeList.next) != 0) { /* from the free list */
|
||||
*pvoice = (N_PVoice *) dl;
|
||||
*pvoice = (N_PVoice*)dl;
|
||||
alUnlink(dl);
|
||||
alLink(dl, &n_syn->pAllocList);
|
||||
alLink(dl, &n_syn->pAllocList);
|
||||
} else { /* steal one */
|
||||
for (dl = n_syn->pAllocList.next; dl != 0; dl = dl->next) {
|
||||
pv = (N_PVoice *)dl;
|
||||
pv = (N_PVoice*)dl;
|
||||
|
||||
/*
|
||||
* if it is lower priority and not already stolen, keep it
|
||||
@@ -142,7 +138,6 @@ s32 _allocatePVoice(N_PVoice **pvoice, s16 priority)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return stolen;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
*====================================================================*/
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynDelete(void)
|
||||
{
|
||||
void n_alSynDelete(void) {
|
||||
n_syn->head = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,28 +22,27 @@
|
||||
#include <os.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynFreeVoice(N_ALVoice *voice)
|
||||
{
|
||||
ALFilter *f;
|
||||
N_ALFreeParam *update;
|
||||
void n_alSynFreeVoice(N_ALVoice* voice) {
|
||||
ALFilter* f;
|
||||
N_ALFreeParam* update;
|
||||
|
||||
if (voice->pvoice) {
|
||||
if (voice->pvoice->offset) { /* if voice was stolen */
|
||||
update = (N_ALFreeParam *)__n_allocParam();
|
||||
update = (N_ALFreeParam*)__n_allocParam();
|
||||
ALFailIf(update == 0, ERR_ALSYN_NO_UPDATE);
|
||||
|
||||
/*
|
||||
* set voice data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + voice->pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + voice->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + voice->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + voice->pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_FREE_VOICE;
|
||||
update->type = AL_FILTER_FREE_VOICE;
|
||||
update->pvoice = voice->pvoice;
|
||||
|
||||
n_alEnvmixerParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(voice->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
} else {
|
||||
_n_freePVoice(voice->pvoice);
|
||||
}
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
#include <ultraerror.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynSetFXMix(N_ALVoice *v, u8 fxmix)
|
||||
{
|
||||
ALParam *update;
|
||||
void n_alSynSetFXMix(N_ALVoice* v, u8 fxmix) {
|
||||
ALParam* update;
|
||||
|
||||
if (v->pvoice) {
|
||||
/*
|
||||
@@ -36,17 +35,16 @@ void n_alSynSetFXMix(N_ALVoice *v, u8 fxmix)
|
||||
* set offset and fxmix data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_SET_FXAMT;
|
||||
if (fxmix > 127)
|
||||
fxmix = 127;
|
||||
update->data.i = fxmix;
|
||||
update->next = 0;
|
||||
update->type = AL_FILTER_SET_FXAMT;
|
||||
if (fxmix > 127)
|
||||
fxmix = 127;
|
||||
update->data.i = fxmix;
|
||||
update->next = 0;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
#include <ultraerror.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynSetPan(N_ALVoice *v, u8 pan)
|
||||
{
|
||||
ALParam *update;
|
||||
void n_alSynSetPan(N_ALVoice* v, u8 pan) {
|
||||
ALParam* update;
|
||||
|
||||
if (v->pvoice) {
|
||||
|
||||
@@ -37,15 +36,14 @@ void n_alSynSetPan(N_ALVoice *v, u8 pan)
|
||||
* set offset and pan data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_SET_PAN;
|
||||
update->type = AL_FILTER_SET_PAN;
|
||||
update->data.i = pan;
|
||||
update->next = 0;
|
||||
update->next = 0;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,15 +21,14 @@
|
||||
#include <ultraerror.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynSetPitch(N_ALVoice *v, f32 pitch)
|
||||
{
|
||||
ALParam *update;
|
||||
void n_alSynSetPitch(N_ALVoice* v, f32 pitch) {
|
||||
ALParam* update;
|
||||
|
||||
if (v->pvoice) {
|
||||
if (v->pvoice) {
|
||||
/*
|
||||
* get new update struct from the free list
|
||||
*/
|
||||
|
||||
|
||||
update = __n_allocParam();
|
||||
ALFailIf(update == 0, ERR_ALSYN_NO_UPDATE);
|
||||
|
||||
@@ -37,15 +36,14 @@ void n_alSynSetPitch(N_ALVoice *v, f32 pitch)
|
||||
* set offset and pitch data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_SET_PITCH;
|
||||
update->type = AL_FILTER_SET_PITCH;
|
||||
update->data.f = pitch;
|
||||
update->next = 0;
|
||||
update->next = 0;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,9 @@
|
||||
#include <ultraerror.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynSetVol(N_ALVoice *v, s16 volume, ALMicroTime t)
|
||||
{
|
||||
ALParam *update;
|
||||
ALFilter *f;
|
||||
void n_alSynSetVol(N_ALVoice* v, s16 volume, ALMicroTime t) {
|
||||
ALParam* update;
|
||||
ALFilter* f;
|
||||
|
||||
if (v->pvoice) {
|
||||
/*
|
||||
@@ -37,21 +36,20 @@ void n_alSynSetVol(N_ALVoice *v, s16 volume, ALMicroTime t)
|
||||
* set offset and volume data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_SET_VOLUME;
|
||||
update->data.i = volume;
|
||||
update->type = AL_FILTER_SET_VOLUME;
|
||||
update->data.i = volume;
|
||||
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->moredata.i = SAMPLE184( _n_timeToSamples(t) );
|
||||
update->moredata.i = SAMPLE184(_n_timeToSamples(t));
|
||||
#else
|
||||
update->moredata.i = _n_timeToSamples(t);
|
||||
update->moredata.i = _n_timeToSamples(t);
|
||||
#endif
|
||||
update->next = 0;
|
||||
update->next = 0;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,47 +20,42 @@
|
||||
#include <ultraerror.h>
|
||||
#include <os_internal.h>
|
||||
|
||||
void n_alSynStartVoiceParams(N_ALVoice *v, ALWaveTable *w, f32 pitch,
|
||||
s16 vol, ALPan pan, u8 fxmix, ALMicroTime t)
|
||||
{
|
||||
ALStartParamAlt *update;
|
||||
void n_alSynStartVoiceParams(N_ALVoice* v, ALWaveTable* w, f32 pitch, s16 vol, ALPan pan, u8 fxmix, ALMicroTime t) {
|
||||
ALStartParamAlt* update;
|
||||
|
||||
if (v->pvoice) {
|
||||
/*
|
||||
* get new update struct from the free list
|
||||
*/
|
||||
update = (ALStartParamAlt *)__n_allocParam();
|
||||
update = (ALStartParamAlt*)__n_allocParam();
|
||||
ALFailIf(update == 0, ERR_ALSYN_NO_UPDATE);
|
||||
|
||||
if (fxmix > 127)
|
||||
if (fxmix > 127)
|
||||
fxmix = 127;
|
||||
|
||||
/*
|
||||
* set offset and fxmix data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->next = 0;
|
||||
update->type = AL_FILTER_START_VOICE_ALT;
|
||||
|
||||
update->unity = v->unityPitch;
|
||||
update->pan = pan;
|
||||
update->volume = vol;
|
||||
update->fxMix = fxmix;
|
||||
update->pitch = pitch;
|
||||
/*
|
||||
* set offset and fxmix data
|
||||
*/
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->samples = SAMPLE184( _n_timeToSamples(t) );
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->next = 0;
|
||||
update->type = AL_FILTER_START_VOICE_ALT;
|
||||
|
||||
update->unity = v->unityPitch;
|
||||
update->pan = pan;
|
||||
update->volume = vol;
|
||||
update->fxMix = fxmix;
|
||||
update->pitch = pitch;
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->samples = SAMPLE184(_n_timeToSamples(t));
|
||||
#else
|
||||
update->samples = _n_timeToSamples(t);
|
||||
#endif
|
||||
update->wave = w;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
update->wave = w;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,26 +21,23 @@
|
||||
#include <ultraerror.h>
|
||||
#include "n_synthInternals.h"
|
||||
|
||||
void n_alSynStopVoice(N_ALVoice* v) {
|
||||
ALParam* update;
|
||||
ALFilter* f;
|
||||
|
||||
void n_alSynStopVoice(N_ALVoice *v)
|
||||
{
|
||||
ALParam *update;
|
||||
ALFilter *f;
|
||||
|
||||
if (v->pvoice) {
|
||||
|
||||
|
||||
update = __n_allocParam();
|
||||
ALFailIf(update == 0, ERR_ALSYN_NO_UPDATE);
|
||||
|
||||
#ifdef SAMPLE_ROUND
|
||||
update->delta = SAMPLE184( n_syn->paramSamples + v->pvoice->offset);
|
||||
update->delta = SAMPLE184(n_syn->paramSamples + v->pvoice->offset);
|
||||
#else
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
update->delta = n_syn->paramSamples + v->pvoice->offset;
|
||||
#endif
|
||||
update->type = AL_FILTER_STOP_VOICE;
|
||||
update->next = 0;
|
||||
update->type = AL_FILTER_STOP_VOICE;
|
||||
update->next = 0;
|
||||
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
n_alEnvmixerParam(v->pvoice, AL_FILTER_ADD_UPDATE, update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef __N_SYNTHINTERNALS__
|
||||
#define __N_SYNTHINTERNALS__
|
||||
|
||||
#include <synthInternals.h>
|
||||
#include "synthInternals.h"
|
||||
#include "n_libaudio_sc.h"
|
||||
#include "n_abi.h"
|
||||
|
||||
|
||||
@@ -30,63 +30,61 @@ extern u32 client_num, client_cnt, client_max, client_min;
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static s32 __n_nextSampleTime(ALPlayer **client);
|
||||
static s32 __n_nextSampleTime(ALPlayer** client);
|
||||
static s32 _n_timeToSamplesNoRound(s32 micros);
|
||||
|
||||
/***********************************************************************
|
||||
* Synthesis driver public interfaces
|
||||
***********************************************************************/
|
||||
void n_alSynNew(ALSynConfig *c)
|
||||
{
|
||||
s32 i;
|
||||
N_ALVoice *vv;
|
||||
N_PVoice *pv;
|
||||
N_ALVoice *vvoices;
|
||||
N_PVoice *pvoices;
|
||||
ALHeap *hp = c->heap;
|
||||
ALSave *save;
|
||||
ALFilter *sources;
|
||||
N_PVoice *m_sources;
|
||||
ALParam *params;
|
||||
ALParam *paramPtr;
|
||||
|
||||
n_syn->head = NULL;
|
||||
n_syn->numPVoices = c->maxPVoices;
|
||||
n_syn->curSamples = 0;
|
||||
n_syn->paramSamples = 0;
|
||||
n_syn->outputRate = c->outputRate;
|
||||
#ifndef N_MICRO
|
||||
n_syn->maxOutSamples = AL_MAX_RSP_SAMPLES;
|
||||
#else
|
||||
n_syn->maxOutSamples = FIXED_SAMPLE;
|
||||
#endif
|
||||
n_syn->dma = (ALDMANew) c->dmaproc;
|
||||
void n_alSynNew(ALSynConfig* c) {
|
||||
s32 i;
|
||||
N_ALVoice* vv;
|
||||
N_PVoice* pv;
|
||||
N_ALVoice* vvoices;
|
||||
N_PVoice* pvoices;
|
||||
ALHeap* hp = c->heap;
|
||||
ALSave* save;
|
||||
ALFilter* sources;
|
||||
N_PVoice* m_sources;
|
||||
ALParam* params;
|
||||
ALParam* paramPtr;
|
||||
|
||||
/******* save new *******************************/
|
||||
n_syn->head = NULL;
|
||||
n_syn->numPVoices = c->maxPVoices;
|
||||
n_syn->curSamples = 0;
|
||||
n_syn->paramSamples = 0;
|
||||
n_syn->outputRate = c->outputRate;
|
||||
#ifndef N_MICRO
|
||||
n_syn->maxOutSamples = AL_MAX_RSP_SAMPLES;
|
||||
#else
|
||||
n_syn->maxOutSamples = FIXED_SAMPLE;
|
||||
#endif
|
||||
n_syn->dma = (ALDMANew)c->dmaproc;
|
||||
|
||||
/******* save new *******************************/
|
||||
n_syn->sv_dramout = 0;
|
||||
n_syn->sv_first = 1;
|
||||
|
||||
/******* aux new *******************************/
|
||||
n_syn->auxBus = (N_ALAuxBus *)alHeapAlloc(hp, 1, sizeof(N_ALAuxBus));
|
||||
/******* aux new *******************************/
|
||||
n_syn->auxBus = (N_ALAuxBus*)alHeapAlloc(hp, 1, sizeof(N_ALAuxBus));
|
||||
|
||||
n_syn->auxBus->sourceCount = 0;
|
||||
n_syn->auxBus->maxSources = c->maxPVoices;
|
||||
n_syn->auxBus->sources = (N_PVoice **)
|
||||
alHeapAlloc(hp, c->maxPVoices, sizeof(N_PVoice *));
|
||||
n_syn->auxBus->sources = (N_PVoice**)alHeapAlloc(hp, c->maxPVoices, sizeof(N_PVoice*));
|
||||
|
||||
/******* main new *******************************/
|
||||
n_syn->mainBus = (N_ALMainBus *)alHeapAlloc(hp, 1, sizeof(N_ALMainBus));
|
||||
/******* main new *******************************/
|
||||
n_syn->mainBus = (N_ALMainBus*)alHeapAlloc(hp, 1, sizeof(N_ALMainBus));
|
||||
|
||||
/******* fx new *******************************/
|
||||
/******* fx new *******************************/
|
||||
|
||||
if (c->fxType != AL_FX_NONE){
|
||||
n_syn->auxBus->fx = n_alSynAllocFX(0, c, hp);
|
||||
n_syn->mainBus->filter.handler = (N_ALCmdHandler)n_alFxPull;
|
||||
if (c->fxType != AL_FX_NONE) {
|
||||
n_syn->auxBus->fx = n_alSynAllocFX(0, c, hp);
|
||||
n_syn->mainBus->filter.handler = (N_ALCmdHandler)n_alFxPull;
|
||||
} else {
|
||||
n_syn->mainBus->filter.handler = (N_ALCmdHandler)n_alAuxBusPull;
|
||||
n_syn->mainBus->filter.handler = (N_ALCmdHandler)n_alAuxBusPull;
|
||||
}
|
||||
|
||||
n_syn->pFreeList.next = 0;
|
||||
@@ -98,40 +96,39 @@ void n_alSynNew(ALSynConfig *c)
|
||||
|
||||
pvoices = alHeapAlloc(hp, c->maxPVoices, sizeof(N_PVoice));
|
||||
for (i = 0; i < c->maxPVoices; i++) {
|
||||
pv = &pvoices[i];
|
||||
alLink((ALLink *)pv, &n_syn->pFreeList);
|
||||
pv->vvoice = 0;
|
||||
alN_PVoiceNew(pv, n_syn->dma, hp);
|
||||
n_syn->auxBus->sources[n_syn->auxBus->sourceCount++] = pv;
|
||||
pv = &pvoices[i];
|
||||
alLink((ALLink*)pv, &n_syn->pFreeList);
|
||||
pv->vvoice = 0;
|
||||
alN_PVoiceNew(pv, n_syn->dma, hp);
|
||||
n_syn->auxBus->sources[n_syn->auxBus->sourceCount++] = pv;
|
||||
}
|
||||
|
||||
params = alHeapAlloc(hp, c->maxUpdates, sizeof(ALParam));
|
||||
n_syn->paramList = 0;
|
||||
for (i = 0; i < c->maxUpdates; i++) {
|
||||
paramPtr= ¶ms[i];
|
||||
paramPtr = ¶ms[i];
|
||||
paramPtr->next = n_syn->paramList;
|
||||
n_syn->paramList = paramPtr;
|
||||
}
|
||||
n_syn->heap = hp;
|
||||
}
|
||||
|
||||
Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
||||
{
|
||||
ALPlayer *client;
|
||||
s16 tmp = 0; /* Starting buffer in DMEM */
|
||||
Acmd *cmdlEnd = cmdList;
|
||||
Acmd *cmdPtr;
|
||||
s32 nOut;
|
||||
s16 *lOutBuf = outBuf;
|
||||
Acmd* n_alAudioFrame(Acmd* cmdList, s32* cmdLen, s16* outBuf, s32 outLen) {
|
||||
ALPlayer* client;
|
||||
s16 tmp = 0; /* Starting buffer in DMEM */
|
||||
Acmd* cmdlEnd = cmdList;
|
||||
Acmd* cmdPtr;
|
||||
s32 nOut;
|
||||
s16* lOutBuf = outBuf;
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
lastCnt[++cnt_index] = osGetCount();
|
||||
#endif
|
||||
|
||||
|
||||
if (n_syn->head == 0) {
|
||||
*cmdLen = 0;
|
||||
return cmdList; /* nothing to do */
|
||||
}
|
||||
*cmdLen = 0;
|
||||
return cmdList; /* nothing to do */
|
||||
}
|
||||
|
||||
/*
|
||||
* run down list of clients and execute callback if needed this
|
||||
@@ -155,19 +152,16 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
||||
*/
|
||||
|
||||
#ifndef ONLY_ONE_PLAYER
|
||||
for (n_syn->paramSamples = __n_nextSampleTime(&client);
|
||||
n_syn->paramSamples - n_syn->curSamples < outLen;
|
||||
n_syn->paramSamples = __n_nextSampleTime(&client))
|
||||
{
|
||||
n_syn->paramSamples &= ~0xf;
|
||||
client->samplesLeft += _n_timeToSamplesNoRound((*client->handler)(client));
|
||||
for (n_syn->paramSamples = __n_nextSampleTime(&client); n_syn->paramSamples - n_syn->curSamples < outLen;
|
||||
n_syn->paramSamples = __n_nextSampleTime(&client)) {
|
||||
n_syn->paramSamples &= ~0xf;
|
||||
client->samplesLeft += _n_timeToSamplesNoRound((*client->handler)(client));
|
||||
}
|
||||
#else
|
||||
client = n_syn->head;
|
||||
while(client->samplesLeft - n_syn->curSamples < outLen)
|
||||
{
|
||||
n_syn->paramSamples = (client->samplesLeft & ~0xf);
|
||||
client->samplesLeft += _n_timeToSamplesNoRound((*client->handler)(client));
|
||||
while (client->samplesLeft - n_syn->curSamples < outLen) {
|
||||
n_syn->paramSamples = (client->samplesLeft & ~0xf);
|
||||
client->samplesLeft += _n_timeToSamplesNoRound((*client->handler)(client));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -185,7 +179,7 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
||||
/*
|
||||
* Now build the command list in small chunks
|
||||
*/
|
||||
while (outLen > 0){
|
||||
while (outLen > 0) {
|
||||
nOut = MIN(n_syn->maxOutSamples, outLen);
|
||||
|
||||
/*
|
||||
@@ -196,18 +190,17 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
||||
#ifndef N_MICRO
|
||||
aSegment(cmdPtr++, 0, 0);
|
||||
#endif
|
||||
n_syn->sv_dramout = (s32)lOutBuf;
|
||||
n_syn->sv_dramout = (s32)lOutBuf;
|
||||
cmdlEnd = n_alSavePull(n_syn->curSamples, cmdPtr);
|
||||
|
||||
|
||||
outLen -= nOut;
|
||||
lOutBuf += nOut<<1; /* For Stereo */
|
||||
lOutBuf += nOut << 1; /* For Stereo */
|
||||
n_syn->curSamples += nOut;
|
||||
|
||||
}
|
||||
*cmdLen = (s32) (cmdlEnd - cmdList);
|
||||
*cmdLen = (s32)(cmdlEnd - cmdList);
|
||||
|
||||
_n_collectPVoices(); /* collect free physical voices */
|
||||
|
||||
|
||||
#ifdef AUD_PROFILE
|
||||
PROFILE_AUD(drvr_num, drvr_cnt, drvr_max, drvr_min);
|
||||
#endif
|
||||
@@ -218,78 +211,70 @@ Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen)
|
||||
* Synthesis driver private interfaces
|
||||
***********************************************************************/
|
||||
|
||||
ALParam *__n_allocParam(void)
|
||||
{
|
||||
ALParam *update = 0;
|
||||
ALParam* __n_allocParam(void) {
|
||||
ALParam* update = 0;
|
||||
|
||||
if (n_syn->paramList) {
|
||||
if (n_syn->paramList) {
|
||||
update = n_syn->paramList;
|
||||
n_syn->paramList = n_syn->paramList->next;
|
||||
update->next = 0;
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
void _n_freeParam(ALParam *param)
|
||||
{
|
||||
|
||||
void _n_freeParam(ALParam* param) {
|
||||
param->next = n_syn->paramList;
|
||||
n_syn->paramList = param;
|
||||
}
|
||||
|
||||
void _n_collectPVoices(void)
|
||||
{
|
||||
ALLink *dl;
|
||||
N_PVoice *pv;
|
||||
void _n_collectPVoices(void) {
|
||||
ALLink* dl;
|
||||
N_PVoice* pv;
|
||||
|
||||
while ((dl = n_syn->pLameList.next) != 0) {
|
||||
pv = (N_PVoice *)dl;
|
||||
pv = (N_PVoice*)dl;
|
||||
|
||||
/* ### remove from mixer */
|
||||
|
||||
alUnlink(dl);
|
||||
alLink(dl, &n_syn->pFreeList);
|
||||
alLink(dl, &n_syn->pFreeList);
|
||||
}
|
||||
}
|
||||
|
||||
void _n_freePVoice(N_PVoice *pvoice)
|
||||
{
|
||||
void _n_freePVoice(N_PVoice* pvoice) {
|
||||
/*
|
||||
* move the voice from the allocated list to the lame list
|
||||
*/
|
||||
alUnlink((ALLink *)pvoice);
|
||||
alLink((ALLink *)pvoice, &n_syn->pLameList);
|
||||
alUnlink((ALLink*)pvoice);
|
||||
alLink((ALLink*)pvoice, &n_syn->pLameList);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Add 0.5 to adjust the average affect of
|
||||
the truncation error produced by casting
|
||||
a float to an int.
|
||||
*/
|
||||
s32 _n_timeToSamplesNoRound(s32 micros)
|
||||
{
|
||||
s32 _n_timeToSamplesNoRound(s32 micros) {
|
||||
f32 tmp = ((f32)micros) * n_syn->outputRate / 1000000.0 + 0.5;
|
||||
|
||||
return (s32)tmp;
|
||||
}
|
||||
|
||||
s32 _n_timeToSamples(s32 micros)
|
||||
{
|
||||
s32 _n_timeToSamples(s32 micros) {
|
||||
return _n_timeToSamplesNoRound(micros) & ~0xf;
|
||||
}
|
||||
|
||||
#ifndef ONLY_ONE_PLAYER
|
||||
static s32 __n_nextSampleTime(ALPlayer **client)
|
||||
{
|
||||
ALMicroTime delta = 0x7fffffff; /* max delta for s32 */
|
||||
ALPlayer *cl;
|
||||
static s32 __n_nextSampleTime(ALPlayer** client) {
|
||||
ALMicroTime delta = 0x7fffffff; /* max delta for s32 */
|
||||
ALPlayer* cl;
|
||||
u32 tt;
|
||||
|
||||
#ifdef _DEBUG
|
||||
assert(n_syn->head);
|
||||
#endif
|
||||
*client = 0;
|
||||
|
||||
|
||||
for (cl = n_syn->head; cl != 0; cl = cl->next) {
|
||||
if ((cl->samplesLeft - n_syn->curSamples) < delta) {
|
||||
*client = cl;
|
||||
|
||||
@@ -340,10 +340,13 @@
|
||||
- [0x6A3E0, data, rom_data_6A3E0]
|
||||
- [0x6A3F0, .data, math_util]
|
||||
- [0x6FC00, data, rom_data_6FC00]
|
||||
- [0x70070, .data, 20470]
|
||||
- [0x703E0, data, rom_data_703E0]
|
||||
- [0x76260, .data, 29BA0]
|
||||
- [0x76280, data, rom_data_76280]
|
||||
- [0x78570, .data, 373A0]
|
||||
- [0x78890, data, rom_data_78890]
|
||||
- [0x78890, .data, 38BB0]
|
||||
- [0x78990, data, rom_data_78990]
|
||||
- [0x79180, .data, libnaudio/n_sl]
|
||||
- [0x79190, data, rom_data_79190]
|
||||
- [0x79200, .data, libnaudio/n_env]
|
||||
@@ -416,7 +419,8 @@
|
||||
- [0x7D110, rodata, rom_rodata_7D110]
|
||||
- [0x7D1B0, rodata, rom_rodata_7D1B0]
|
||||
- [0x7D230, .rodata, 373A0]
|
||||
- [0x7D340, rodata, rom_rodata_7D340]
|
||||
- [0x7D340, .rodata, 38BB0]
|
||||
- [0x7D3C0, rodata, rom_rodata_7D3C0]
|
||||
- [0x7D3E0, rodata, rom_rodata_7D3E0]
|
||||
- [0x7D880, .rodata, libnaudio/n_env]
|
||||
- [0x7D8D0, rodata, rom_rodata_7D8D0]
|
||||
@@ -484,7 +488,8 @@
|
||||
- {vram: 0x800AE520, type: .bss, name: 29BA0}
|
||||
- {vram: 0x800AF740, type: bss, name: unk_bss_7}
|
||||
- {vram: 0x800B32A0, type: .bss, name: 373A0}
|
||||
- {vram: 0x800FC7A0, type: bss, name: unk_bss_12}
|
||||
- {vram: 0x800FC7A0, type: .bss, name: 38BB0}
|
||||
- {vram: 0x800FC820, type: bss, name: unk_bss_12}
|
||||
- {vram: 0x800FF990, type: .bss, name: 4B940}
|
||||
- {vram: 0x800FF9B0, type: .bss, name: 4BDC0}
|
||||
- {vram: 0x800FF9C0, type: bss, name: unk_bss_10}
|
||||
|
||||
Reference in New Issue
Block a user