Improve mismatch of snd0000ee88

This commit is contained in:
Ryan Dwyer 2021-11-21 11:19:51 +10:00
parent d27b4e3070
commit 399edfc8c9
6 changed files with 23 additions and 16 deletions

View File

@ -3350,7 +3350,7 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
mult2 = gsetGetStrength(gset);
if (mult2 <= 0 && (chr->chrflags & CHRCFLAG_00008000)) {
if (mult2 <= 0 && (chr->chrflags & CHRCFLAG_DIEWITHFORCE)) {
mult2 = 6;
}
@ -3403,7 +3403,7 @@ void chrBeginDeath(struct chrdata *chr, struct coord *dir, f32 relangle, s32 hit
mult3 = gsetGetStrength(gset);
if (mult3 <= 0 && (chr->chrflags & CHRCFLAG_00008000)) {
if (mult3 <= 0 && (chr->chrflags & CHRCFLAG_DIEWITHFORCE)) {
mult3 = 6;
}

View File

@ -32,7 +32,6 @@ extern s32 g_SndMaxFxBusses;
extern struct seqinstance g_SeqInstances[3];
extern ALHeap g_SndHeap;
extern u32 var80095200;
extern struct var80095210 var80095210;
extern OSMesgQueue g_PiMesgQueue;
extern struct g_vars g_Vars;
extern u8 **var8009a874;

View File

@ -496,7 +496,7 @@
#define CHRCFLAG_UNEXPLODABLE 0x00001000
#define CHRCFLAG_NOSHADOW 0x00002000
#define CHRCFLAG_HAS_SPECIAL_DEATH_ANIMATION 0x00004000
#define CHRCFLAG_00008000 0x00008000 // Not used in scripts
#define CHRCFLAG_DIEWITHFORCE 0x00008000 // When killed with a weak weapon, fling the chr as if it was a strong weapon
#define CHRCFLAG_00010000 0x00010000 // Related to dead people in intro cutscenes
#define CHRCFLAG_FORCEAUTOAIM 0x00020000 // Allow auto aim even if chr is unarmed
#define CHRCFLAG_00040000 0x00040000 // Used a lot

View File

@ -7029,7 +7029,7 @@ struct var80095210 {
u16 *soundnums;
u8 unk04[45];
u16 unk32[45];
u8 unk90[0x2cc];
u8 unk8c[0x2d0];
struct var80095210_35c unk35c[1];
u8 unk364[0x3d88];
};

View File

@ -337,6 +337,8 @@ void __scHandleRetrace(OSSched *sc)
schedRenderCrashPeriodically(sc->frameCount);
}
extern struct var80095210 var80095210;
/**
* __scHandleTasks is called both on retrace and when the RDP completes a task.
*/

View File

@ -1368,28 +1368,31 @@ glabel snd0000ee88
);
#endif
// Mismatch:
// Goal calculates the address of var80095210.unk35c twice.
// The below demonstrates similar codegen by not adding arg1 to the return value.
//struct var80095210_35c *snd0000ee88(u32 segoffset, u16 arg1)
//{
//#if VERSION >= VERSION_NTSC_1_0
// s32 i;
// s32 sum1;
// s32 sum2;
// u32 stack;
// u8 spaf[0x40];
// u8 spaf[0x50];
// u8 sp5f[0x50];
// u32 *s2 = (u32 *)ALIGN16((u32)spaf);
// u32 *s1 = (u32 *)ALIGN16((u32)sp5f);
// u32 stack2;
// s32 i;
// s32 sum1;
// s32 sum2;
//
// segoffset += (u32)&_sfxctlSegmentRomStart;
//
// do {
// dmaExecHighPriority(s2, (u32)&_sfxctlSegmentRomStart + segoffset, 0x40);
// dmaExecHighPriority(s2, segoffset, 0x40);
// sum1 = 0;
//
// for (i = 0; i < 16U; i++) {
// sum1 += s2[i];
// }
//
// dmaExecHighPriority(s1, (u32)&_sfxctlSegmentRomStart + segoffset, 0x40);
// dmaExecHighPriority(s1, segoffset, 0x40);
// sum2 = 0;
//
// for (i = 0; i < 16U; i++) {
@ -1400,12 +1403,15 @@ glabel snd0000ee88
// u8 sp5f[0x50];
// u32 *s1 = (u32 *)ALIGN16((u32)sp5f);
//
// dmaExecHighPriority(s1, (u32)&_sfxctlSegmentRomStart + segoffset, 0x40);
// segoffset += (u32)&_sfxctlSegmentRomStart;
//
// dmaExecHighPriority(s1, segoffset, 0x40);
//#endif
//
// var80095210.unk35c[arg1] = *(struct var80095210_35c *)s1;
//
// return &var80095210.unk35c[arg1];
// //return &var80095210.unk35c[arg1];
// return (struct var80095210_35c *)((u32)&var80095210 + 0x35c);
//}
#if VERSION >= VERSION_NTSC_1_0
@ -2718,7 +2724,7 @@ void sndTick(void)
if (g_SndGuardStringPtr != NULL) {
if (strcmp(g_SndGuardStringPtr, &g_SndGuardString) != 0) {
#if VERSION <= VERSION_NTSC_1_0
#if VERSION < VERSION_NTSC_1_0
crashSetMessage("Snd Heap Check FAILED");
CRASH();
#endif