forked from Ports/perfect_dark
port: more UB/bug fixes
This commit is contained in:
1 parent
a37441b221
commit
18bab30c59
2 files changed
+8
No files matched your search
@@ -219,6 +219,7 @@ void memaReset(void *heapaddr, u32 heapsize)
|
||||
{
|
||||
struct memaspace *space;
|
||||
|
||||
#ifdef PLATFORM_N64
|
||||
#ifndef DEBUG
|
||||
// Adding an amount to the heap size here means that mema can allocate past
|
||||
// the end of its heap. This would overflow into the gun names language
|
||||
@@ -226,6 +227,7 @@ void memaReset(void *heapaddr, u32 heapsize)
|
||||
// meant for it to be ifdef instead?
|
||||
// @bug @dangerous
|
||||
heapsize += 0x8e0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
g_MemaHeap.unk000 = 0;
|
||||
|
||||
@@ -936,12 +936,18 @@ void __n_CSPHandleMIDIMsg(N_ALCSPlayer *seqp, N_ALEvent *event)
|
||||
} else if (vs->phase == AL_PHASE_SUSTREL) {
|
||||
vs->phase = AL_PHASE_RELEASE;
|
||||
|
||||
#ifdef AVOID_UB
|
||||
chanstate = &seqp->chanState[chan];
|
||||
#endif
|
||||
// @bug: chanstate is uninitialised
|
||||
if (chanstate->unk24) {
|
||||
__n_seqpReleaseVoice((N_ALSeqPlayer*)seqp,
|
||||
&vs->voice,
|
||||
(seqp->chanState[chan].releaseTime < AL_USEC_PER_FRAME ? AL_USEC_PER_FRAME : seqp->chanState[chan].releaseTime));
|
||||
} else {
|
||||
#ifdef AVOID_UB
|
||||
vstate = __n_lookupVoice((N_ALSeqPlayer*)seqp, key, chan);
|
||||
#endif
|
||||
__n_seqpReleaseVoice((N_ALSeqPlayer*)seqp,
|
||||
&vs->voice,
|
||||
vstate->sound->envelope->releaseTime < AL_USEC_PER_FRAME ? AL_USEC_PER_FRAME : vstate->sound->envelope->releaseTime);
|
||||
|
||||
Reference in new issue
Block a user