Decompile alEvtqFlushType

This commit is contained in:
Ryan Dwyer committed 2021-03-27 21:48:16 +10:00
1 parent 0e6aa6a1bc
commit 7f085dcfb9
9 files changed
+164 -168

No files matched your search

+1 -1
View File
@@ -84,10 +84,10 @@ $(B_DIR)/lib/ultra/libc/llcvt.o: MIPSISET := -mips3 -32
# temporary include-stdin.u file during compilation.
# For these files, see their explicit targets towards the end of this file.
$(B_DIR)/lib/lib_3a100.o: OPT_LVL := -g
$(B_DIR)/lib/lib_3c4d0.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/audio/bnkf.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/audio/cseq.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/audio/csplayer.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/audio/event.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/audio/heap.o: OPT_LVL := -g
$(B_DIR)/lib/ultra/gu/align.o: OPT_LVL := -O3
$(B_DIR)/lib/ultra/gu/frustum.o: OPT_LVL := -O3
+2 -1
View File
@@ -79,7 +79,8 @@
build/ROMID/lib/lib_39fe0.o (section); \
build/ROMID/lib/lib_3a100.o (section); \
build/ROMID/lib/lib_3c430.o (section); \
build/ROMID/lib/lib_3c4d0.o (section); \
build/ROMID/lib/ultra/audio/event.o (section); \
build/ROMID/lib/lib_3c890.o (section); \
build/ROMID/lib/lib_3ccf0.o (section); \
build/ROMID/lib/lib_3cdc0.o (section); \
build/ROMID/lib/lib_3cef0.o (section); \
+2 -1
View File
@@ -77,7 +77,8 @@
build/ROMID/lib/lib_39fe0.o (section); \
build/ROMID/lib/lib_3a100.o (section); \
build/ROMID/lib/lib_3c430.o (section); \
build/ROMID/lib/lib_3c4d0.o (section); \
build/ROMID/lib/ultra/audio/event.o (section); \
build/ROMID/lib/lib_3c890.o (section); \
build/ROMID/lib/lib_3ccf0.o (section); \
build/ROMID/lib/lib_3cdc0.o (section); \
build/ROMID/lib/lib_3cef0.o (section); \
+2 -1
View File
@@ -77,7 +77,8 @@
build/ROMID/lib/lib_39fe0.o (section); \
build/ROMID/lib/lib_3a100.o (section); \
build/ROMID/lib/lib_3c430.o (section); \
build/ROMID/lib/lib_3c4d0.o (section); \
build/ROMID/lib/ultra/audio/event.o (section); \
build/ROMID/lib/lib_3c890.o (section); \
build/ROMID/lib/lib_3ccf0.o (section); \
build/ROMID/lib/lib_3cdc0.o (section); \
build/ROMID/lib/lib_3cef0.o (section); \
-1
View File
@@ -4,7 +4,6 @@
#include "data.h"
#include "types.h"
u32 func0003c7c0(void);
u32 func0003c900(void);
u32 func0003c9e0(void);
u32 func0003cbb4(void);
+11
View File
@@ -0,0 +1,11 @@
#ifndef _IN_LIB_LIB_3C890_H
#define _IN_LIB_LIB_3C890_H
#include <ultra64.h>
#include "data.h"
#include "types.h"
u32 func0003c900(void);
u32 func0003c9e0(void);
u32 func0003cbb4(void);
#endif
+1 -160
View File
@@ -8,167 +8,8 @@
#include "data.h"
#include "types.h"
void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items, s32 itemCount)
{
s32 i;
evtq->eventCount = 0;
evtq->allocList.next = 0;
evtq->allocList.prev = 0;
evtq->freeList.next = 0;
evtq->freeList.prev = 0;
for (i = 0; i < itemCount; i++) {
alLink((ALLink *)&items[i], &evtq->freeList);
}
}
ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt)
{
ALEventListItem *item;
ALMicroTime delta;
OSIntMask mask;
mask = osSetIntMask(OS_IM_NONE);
item = (ALEventListItem *)evtq->allocList.next;
if (item) {
alUnlink((ALLink *)item);
bcopy(&item->evt, evt, sizeof(*evt));
alLink((ALLink *)item, &evtq->freeList);
delta = item->delta;
} else {
/* sct 11/28/95 - If we get here, most like we overflowed the event queue */
/* with non-self-perpetuating events. Eg. if we filled the evtq with volume */
/* events, then when the seqp is told to play it will handle all the events */
/* at once completely emptying out the queue. At this point this problem */
/* must be treated as an out of resource error and the evtq should be increased. */
evt->type = -1;
delta = 0;
}
osSetIntMask(mask);
return delta;
}
void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt, ALMicroTime delta, s32 arg3)
{
ALEventListItem *item;
ALEventListItem *nextItem;
ALLink *node;
s32 postAtEnd = 0;
OSIntMask mask;
mask = osSetIntMask(OS_IM_NONE);
item = (ALEventListItem *)evtq->freeList.next;
if (!item) {
osSetIntMask(mask);
return;
}
if (!item->node.next && !arg3) {
osSetIntMask(mask);
return;
}
alUnlink((ALLink *)item);
bcopy(evt, &item->evt, sizeof(*evt));
if (delta == AL_EVTQ_END) {
postAtEnd = -1;
}
for (node = &evtq->allocList; node != 0; node = node->next) {
if (!node->next) { /* end of the list */
if (postAtEnd) {
item->delta = 0;
} else {
item->delta = delta;
}
alLink((ALLink *)item, node);
break;
} else {
nextItem = (ALEventListItem *)node->next;
if (delta < nextItem->delta) {
item->delta = delta;
nextItem->delta -= delta;
alLink((ALLink *)item, node);
break;
}
delta -= nextItem->delta;
}
}
osSetIntMask(mask);
}
GLOBAL_ASM(
glabel func0003c7c0
/* 3c7c0: 27bdffd0 */ addiu $sp,$sp,-48
/* 3c7c4: afbf0014 */ sw $ra,0x14($sp)
/* 3c7c8: afa40030 */ sw $a0,0x30($sp)
/* 3c7cc: afa50034 */ sw $a1,0x34($sp)
/* 3c7d0: 0c012194 */ jal osSetIntMask
/* 3c7d4: 24040001 */ addiu $a0,$zero,0x1
/* 3c7d8: afa2001c */ sw $v0,0x1c($sp)
/* 3c7dc: 8fae0030 */ lw $t6,0x30($sp)
/* 3c7e0: 8dcf0008 */ lw $t7,0x8($t6)
/* 3c7e4: afaf002c */ sw $t7,0x2c($sp)
/* 3c7e8: 8fb8002c */ lw $t8,0x2c($sp)
/* 3c7ec: 13000020 */ beqz $t8,.L0003c870
/* 3c7f0: 00000000 */ nop
.L0003c7f4:
/* 3c7f4: 8fb9002c */ lw $t9,0x2c($sp)
/* 3c7f8: 8f280000 */ lw $t0,0x0($t9)
/* 3c7fc: afa80028 */ sw $t0,0x28($sp)
/* 3c800: 8fa9002c */ lw $t1,0x2c($sp)
/* 3c804: afa90024 */ sw $t1,0x24($sp)
/* 3c808: 8faa0028 */ lw $t2,0x28($sp)
/* 3c80c: afaa0020 */ sw $t2,0x20($sp)
/* 3c810: 8fab0024 */ lw $t3,0x24($sp)
/* 3c814: 87ad0036 */ lh $t5,0x36($sp)
/* 3c818: 856c000c */ lh $t4,0xc($t3)
/* 3c81c: 158d000f */ bne $t4,$t5,.L0003c85c
/* 3c820: 00000000 */ nop
/* 3c824: 8fae0020 */ lw $t6,0x20($sp)
/* 3c828: 11c00007 */ beqz $t6,.L0003c848
/* 3c82c: 00000000 */ nop
/* 3c830: 8faf0020 */ lw $t7,0x20($sp)
/* 3c834: 8fb90024 */ lw $t9,0x24($sp)
/* 3c838: 8df80008 */ lw $t8,0x8($t7)
/* 3c83c: 8f280008 */ lw $t0,0x8($t9)
/* 3c840: 03084821 */ addu $t1,$t8,$t0
/* 3c844: ade90008 */ sw $t1,0x8($t7)
.L0003c848:
/* 3c848: 0c00c5e9 */ jal alUnlink
/* 3c84c: 8fa4002c */ lw $a0,0x2c($sp)
/* 3c850: 8fa4002c */ lw $a0,0x2c($sp)
/* 3c854: 0c00c5dc */ jal alLink
/* 3c858: 8fa50030 */ lw $a1,0x30($sp)
.L0003c85c:
/* 3c85c: 8faa0028 */ lw $t2,0x28($sp)
/* 3c860: afaa002c */ sw $t2,0x2c($sp)
/* 3c864: 8fab002c */ lw $t3,0x2c($sp)
/* 3c868: 1560ffe2 */ bnez $t3,.L0003c7f4
/* 3c86c: 00000000 */ nop
.L0003c870:
/* 3c870: 0c012194 */ jal osSetIntMask
/* 3c874: 8fa4001c */ lw $a0,0x1c($sp)
/* 3c878: 10000001 */ b .L0003c880
/* 3c87c: 00000000 */ nop
.L0003c880:
/* 3c880: 8fbf0014 */ lw $ra,0x14($sp)
/* 3c884: 27bd0030 */ addiu $sp,$sp,0x30
/* 3c888: 03e00008 */ jr $ra
/* 3c88c: 00000000 */ nop
glabel func0003c890
/* 3c890: 27bdffe0 */ addiu $sp,$sp,-32
/* 3c894: afbf0014 */ sw $ra,0x14($sp)
/* 3c898: afa40020 */ sw $a0,0x20($sp)
+3 -3
View File
@@ -1420,15 +1420,15 @@ glabel __CSPVoiceHandler
/* 34b6c: 00000000 */ nop
/* 34b70: 8fa40074 */ lw $a0,0x74($sp)
/* 34b74: 00002825 */ or $a1,$zero,$zero
/* 34b78: 0c00f1f0 */ jal func0003c7c0
/* 34b78: 0c00f1f0 */ jal alEvtqFlushType
/* 34b7c: 24840048 */ addiu $a0,$a0,0x48
/* 34b80: 8fa40074 */ lw $a0,0x74($sp)
/* 34b84: 24050015 */ addiu $a1,$zero,0x15
/* 34b88: 0c00f1f0 */ jal func0003c7c0
/* 34b88: 0c00f1f0 */ jal alEvtqFlushType
/* 34b8c: 24840048 */ addiu $a0,$a0,0x48
/* 34b90: 8fa40074 */ lw $a0,0x74($sp)
/* 34b94: 24050002 */ addiu $a1,$zero,0x2
/* 34b98: 0c00f1f0 */ jal func0003c7c0
/* 34b98: 0c00f1f0 */ jal alEvtqFlushType
/* 34b9c: 24840048 */ addiu $a0,$a0,0x48
/* 34ba0: 8faa0074 */ lw $t2,0x74($sp)
/* 34ba4: 8d490064 */ lw $t1,0x64($t2)
+142
View File
@@ -0,0 +1,142 @@
#include <ultra64.h>
#include "constants.h"
#include "bss.h"
#include "lib/lib_30ce0.h"
#include "lib/lib_3c4d0.h"
#include "lib/lib_3e730.h"
#include "lib/lib_4b170.h"
#include "data.h"
#include "types.h"
void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items, s32 itemCount)
{
s32 i;
evtq->eventCount = 0;
evtq->allocList.next = 0;
evtq->allocList.prev = 0;
evtq->freeList.next = 0;
evtq->freeList.prev = 0;
for (i = 0; i < itemCount; i++) {
alLink((ALLink *)&items[i], &evtq->freeList);
}
}
ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt)
{
ALEventListItem *item;
ALMicroTime delta;
OSIntMask mask;
mask = osSetIntMask(OS_IM_NONE);
item = (ALEventListItem *)evtq->allocList.next;
if (item) {
alUnlink((ALLink *)item);
bcopy(&item->evt, evt, sizeof(*evt));
alLink((ALLink *)item, &evtq->freeList);
delta = item->delta;
} else {
/* sct 11/28/95 - If we get here, most like we overflowed the event queue */
/* with non-self-perpetuating events. Eg. if we filled the evtq with volume */
/* events, then when the seqp is told to play it will handle all the events */
/* at once completely emptying out the queue. At this point this problem */
/* must be treated as an out of resource error and the evtq should be increased. */
evt->type = -1;
delta = 0;
}
osSetIntMask(mask);
return delta;
}
void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt, ALMicroTime delta, s32 arg3)
{
ALEventListItem *item;
ALEventListItem *nextItem;
ALLink *node;
s32 postAtEnd = 0;
OSIntMask mask;
mask = osSetIntMask(OS_IM_NONE);
item = (ALEventListItem *)evtq->freeList.next;
if (!item) {
osSetIntMask(mask);
return;
}
if (!item->node.next && !arg3) {
osSetIntMask(mask);
return;
}
alUnlink((ALLink *)item);
bcopy(evt, &item->evt, sizeof(*evt));
if (delta == AL_EVTQ_END) {
postAtEnd = -1;
}
for (node = &evtq->allocList; node != 0; node = node->next) {
if (!node->next) { /* end of the list */
if (postAtEnd) {
item->delta = 0;
} else {
item->delta = delta;
}
alLink((ALLink *)item, node);
break;
} else {
nextItem = (ALEventListItem *)node->next;
if (delta < nextItem->delta) {
item->delta = delta;
nextItem->delta -= delta;
alLink((ALLink *)item, node);
break;
}
delta -= nextItem->delta;
}
}
osSetIntMask(mask);
}
void alEvtqFlushType(ALEventQueue *evtq, s16 type)
{
ALLink *thisNode;
ALLink *nextNode;
ALEventListItem *thisItem, *nextItem;
OSIntMask mask;
mask = osSetIntMask(OS_IM_NONE);
thisNode = evtq->allocList.next;
while (thisNode != 0) {
nextNode = thisNode->next;
thisItem = (ALEventListItem *)thisNode;
nextItem = (ALEventListItem *)nextNode;
if (thisItem->evt.type == type) {
if (nextItem) {
nextItem->delta += thisItem->delta;
}
alUnlink(thisNode);
alLink(thisNode, &evtq->freeList);
}
thisNode = nextNode;
}
osSetIntMask(mask);
}