Matched 2.0I and 2.0J, fixed matched object count calculation (#53)

* Matched 2.0I and 2.0J, fixed matched object count calculation

* Update version checkbox matrix

* Mark irix 2.0H as N/A in the checkbox matrix since it's not available

* Address PR comments

* Changed tab to spaces on new files

* Converted tabs to spaces in other changes, fixed os_motor.h definitions
This commit is contained in:
Mr-Wiseguy
2023-09-02 23:17:04 -04:00
committed by GitHub
parent 454e949ff1
commit 2ab125a5f3
118 changed files with 2666 additions and 203 deletions

View File

@@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [K, L] # [H, I, I_patch, J, K, L]
version: [I, J, K, L] # [H, I, I_patch, J, K, L]
suffix: [~, _d, _rom]
steps:

View File

@@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [K, L] # [E, F, G, H, I, I_patch, J, K, L]
version: [I, J, K, L] # [E, F, G, H, I, I_patch, J, K, L]
suffix: [~, _rom] # [~, _d, _rom]
steps:

2
.gitignore vendored
View File

@@ -24,3 +24,5 @@ tools/ido
# Tool artifacts
ctx.c
libultra_collection/

View File

@@ -30,6 +30,12 @@ VERSION_L := 9
VERSION_DEFINE := -DBUILD_VERSION=$(VERSION_$(VERSION)) -DBUILD_VERSION_STRING=\"2.0$(VERSION)\"
ifeq ($(findstring _d,$(TARGET)),_d)
DEBUGFLAG := -D_DEBUG
else
DEBUGFLAG := -DNDEBUG
endif
ifeq ($(findstring libgultra,$(TARGET)),libgultra)
-include Makefile.gcc
else ifeq ($(findstring libultra,$(TARGET)),libultra)
@@ -38,12 +44,6 @@ else
$(error Invalid Target)
endif
ifeq ($(findstring _d,$(TARGET)),_d)
CPPFLAGS += -D_DEBUG
else
CPPFLAGS += -DNDEBUG
endif
ifeq ($(findstring _rom,$(TARGET)),_rom)
CPPFLAGS += -D_FINALROM
endif
@@ -52,11 +52,24 @@ SRC_DIRS := $(shell find src -type d)
ASM_DIRS := $(shell find asm -type d -not -path "asm/non_matchings*")
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
S_FILES := $(foreach dir,$(SRC_DIRS) $(ASM_DIRS),$(wildcard $(dir)/*.s))
O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f)
# Versions J and below used the C matrix math implementations
MGU_MATRIX_FILES := mtxcatf normalize scale translate
ifneq ($(filter $(VERSION),D E F G H I J),)
S_FILES := $(filter-out $(addprefix src/mgu/,$(MGU_MATRIX_FILES:=.s)),$(S_FILES))
else
C_FILES := $(filter-out $(addprefix src/gu/,$(MGU_MATRIX_FILES:=.c)),$(C_FILES))
endif
C_O_FILES := $(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f)
S_O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f)
O_FILES := $(S_O_FILES) $(C_O_FILES)
# Because we patch the object file timestamps, we can't use them as the targets since they'll always be older than the C file
# Therefore instead we use marker files that have actual timestamps as the dependencies for the archive
MARKER_FILES := $(O_FILES:.o=.marker)
C_MARKER_FILES := $(C_O_FILES:.o=.marker)
S_MARKER_FILES := $(S_O_FILES:.o=.marker)
S_MARKER_FILES := $(filter-out $(MDEBUG_FILES),$(S_MARKER_FILES))
MARKER_FILES := $(C_MARKER_FILES) $(S_MARKER_FILES)
ifneq ($(NON_MATCHING),1)
COMPARE_OBJ = cmp $(BASE_DIR)/$(@F:.marker=.o) $(@:.marker=.o) && echo "$(@:.marker=.o): OK"
@@ -85,8 +98,8 @@ endif
endif
# Try to find a file corresponding to an archive file in any of src/ asm/ or the base directory, prioritizing src then asm then the original file
AR_ORDER = $(foreach f,$(shell $(AR) t $(BASE_AR)),$(shell find $(BUILD_DIR)/src $(BUILD_DIR)/asm $(BUILD_DIR)/$(BASE_DIR) -iname $f -type f -print -quit))
MATCHED_OBJS = $(filter-out $(BUILD_DIR)/$(BASE_DIR)/%,$(AR_ORDER))
AR_ORDER = $(foreach f,$(shell $(AR) t $(BASE_AR)),$(shell find $(BUILD_DIR)/src $(BUILD_DIR)/asm $(BASE_DIR) -iname $f -type f -print -quit))
MATCHED_OBJS = $(filter-out $(BASE_DIR)/%,$(AR_ORDER))
UNMATCHED_OBJS = $(filter-out $(MATCHED_OBJS),$(AR_ORDER))
NUM_OBJS = $(words $(AR_ORDER))
NUM_OBJS_MATCHED = $(words $(MATCHED_OBJS))
@@ -131,7 +144,7 @@ ifneq ($(NON_MATCHING),1)
@touch $@
endif
GBIDEFINE := -DF3DEX_GBI_2
GBIDEFINE := -DF3DEX_GBI
$(BUILD_DIR)/src/gu/parse_gbi.marker: GBIDEFINE := -DF3D_GBI
$(BUILD_DIR)/src/gu/us2dex_emu.marker: GBIDEFINE :=
@@ -142,7 +155,7 @@ $(BUILD_DIR)/src/sp/spriteex2.marker: GBIDEFINE :=
$(BUILD_DIR)/src/voice/%.marker: OPTFLAGS += -DLANG_JAPANESE -I$(WORKING_DIR)/src -I$(WORKING_DIR)/src/voice
$(BUILD_DIR)/src/voice/%.marker: CC := tools/compile_sjis.py -D__CC=$(WORKING_DIR)/$(CC) -D__BUILD_DIR=$(BUILD_DIR)
$(BUILD_DIR)/%.marker: %.c
$(C_MARKER_FILES): $(BUILD_DIR)/%.marker: %.c
cd $(<D) && $(WORKING_DIR)/$(CC) $(CFLAGS) $(MIPS_VERSION) $(CPPFLAGS) $(OPTFLAGS) $(<F) $(IINC) -o $(WORKING_DIR)/$(@:.marker=.o)
ifneq ($(NON_MATCHING),1)
# check if this file is in the archive; patch corrupted bytes and change file timestamps to match original if so
@@ -156,7 +169,7 @@ ifneq ($(NON_MATCHING),1)
@touch $@
endif
$(BUILD_DIR)/%.marker: %.s
$(S_MARKER_FILES): $(BUILD_DIR)/%.marker: %.s
cd $(<D) && $(WORKING_DIR)/$(CC) $(ASFLAGS) $(MIPS_VERSION) $(CPPFLAGS) $(ASOPTFLAGS) $(<F) $(IINC) -o $(WORKING_DIR)/$(@:.marker=.o)
ifneq ($(NON_MATCHING),1)
# check if this file is in the archive; patch corrupted bytes and change file timestamps to match original if so

View File

@@ -9,11 +9,26 @@ export COMPILER_PATH := $(WORKING_DIR)/tools/gcc
CFLAGS := -w -nostdinc -c -G 0 -mgp32 -mfp32 -D_LANGUAGE_C
ASFLAGS := -w -nostdinc -c -G 0 -mgp32 -mfp32 -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_MIPS_SIM=1 -D_ULTRA64 -x assembler-with-cpp
CPPFLAGS = -D_MIPS_SZLONG=32 -D__USE_ISOC99 $(GBIDEFINE) $(VERSION_DEFINE)
CPPFLAGS = -D_MIPS_SZLONG=32 -D__USE_ISOC99 $(GBIDEFINE) $(VERSION_DEFINE) $(DEBUGFLAG)
IINC = -I . -I $(WORKING_DIR)/include -I $(WORKING_DIR)/include/gcc -I $(WORKING_DIR)/include/PR
MIPS_VERSION := -mips3
ASOPTFLAGS :=
ifneq ($(filter $(VERSION),D E F G H I J),)
CFLAGS += -funsigned-char
endif
# 2.0I libgultra_rom was not compiled with -DNDEBUG and instead libgultra had -DNDEBUG
ifneq ($(filter $(VERSION),I),)
ifeq ($(findstring _rom,$(TARGET)),_rom)
DEBUGFLAG :=
else ifeq ($(findstring _d,$(TARGET)),_d)
DEBUGFLAG := -D_DEBUG
else
DEBUGFLAG := -DNDEBUG
endif
endif
ifeq ($(findstring _d,$(TARGET)),_d)
OPTFLAGS := -O0
else
@@ -33,7 +48,9 @@ export VR4300MUL := ON
$(BUILD_DIR)/src/os/initialize_isv.marker: OPTFLAGS := -O2
$(BUILD_DIR)/src/os/initialize_isv.marker: STRIP = && tools/gcc/strip-2.7 -N initialize_isv.c $(WORKING_DIR)/$(@:.marker=.o)
$(BUILD_DIR)/src/os/assert.marker: OPTFLAGS := -O0
ifeq ($(filter $(VERSION),D E F G H I),)
$(BUILD_DIR)/src/os/seterrorhandler.marker: OPTFLAGS := -O0
endif
$(BUILD_DIR)/src/mgu/%.marker: export VR4300MUL := OFF
$(BUILD_DIR)/src/mgu/rotate.marker: export VR4300MUL := ON
$(BUILD_DIR)/src/debug/%.marker: ASFLAGS += -P

View File

@@ -9,7 +9,7 @@ export COMPILER_PATH := $(WORKING_DIR)/tools/ido
CFLAGS := -c -Wab,-r4300_mul -G 0 -nostdinc -Xcpluscomm -fullwarn -woff 516,649,838,712
ASFLAGS := -c -Wab,-r4300_mul -G 0 -nostdinc -woff 516,649,838,712
CPPFLAGS = -D_MIPS_SZLONG=32 $(GBIDEFINE) $(VERSION_DEFINE) $(PICFLAGS)
CPPFLAGS = -D_MIPS_SZLONG=32 $(GBIDEFINE) $(VERSION_DEFINE) $(PICFLAGS) $(DEBUGFLAG)
IINC = -I $(WORKING_DIR)/include -I $(WORKING_DIR)/include/ido -I $(WORKING_DIR)/include/PR
MIPS_VERSION := -mips2 -o32
PICFLAGS := -non_shared
@@ -18,7 +18,11 @@ ifeq ($(findstring _d,$(TARGET)),_d)
OPTFLAGS := -O1 -g2
ASOPTFLAGS := -O0 -g2
else
ifneq ($(filter $(VERSION),D E F G H I),)
OPTFLAGS := -O1
else
OPTFLAGS := -O2
endif
ASOPTFLAGS := -O1
endif
@@ -43,3 +47,14 @@ $(BUILD_DIR)/src/libc/llcvt.marker: MIPS_VERSION := -mips3 -32
$(BUILD_DIR)/src/os/exceptasm.marker: MIPS_VERSION := -mips3 -32
$(BUILD_DIR)/src/log/delay.marker: MIPS_VERSION := -mips1 -o32
$(BUILD_DIR)/src/log/delay.marker: PICFLAGS := -KPIC
ifneq ($(filter $(VERSION),D E F G H I),)
$(BUILD_DIR)/src/libc/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/sched/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/gu/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/mgu/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/sp/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/audio/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/rg/%.marker: OPTFLAGS := -O3
$(BUILD_DIR)/src/gt/%.marker: OPTFLAGS := -O3
endif

View File

@@ -11,10 +11,10 @@ Currently this repo supports building the following versions:
| 2.0E | :x: / N/A | :x: / N/A | :x: / N/A |
| 2.0F | :x: / N/A | :x: / N/A | :x: / N/A |
| 2.0G | :x: / N/A | :x: / N/A | :x: / N/A |
| 2.0H | :x: / :x: | :x: / :x: | :x: / :x: |
| 2.0I | :x: / :x: | :x: / :x: | :x: / :x: |
| 2.0H | N/A / :x: | N/A / :x: | N/A / :x: |
| 2.0I | :heavy_check_mark: / :heavy_check_mark: | :x: / :heavy_check_mark: | :heavy_check_mark: / :heavy_check_mark: |
| 2.0I_patch | :x: / :x: | :x: / :x: | :x: / :x: |
| 2.0J | :x: / :x: | :x: / :x: | :x: / :x: |
| 2.0J | :heavy_check_mark: / :heavy_check_mark: | :x: / :heavy_check_mark: | :heavy_check_mark: / :heavy_check_mark: |
| 2.0K | :heavy_check_mark: / :heavy_check_mark: | :x: / :heavy_check_mark: | :heavy_check_mark: / :heavy_check_mark: |
| 2.0L | :heavy_check_mark: / :heavy_check_mark: | :x: / :heavy_check_mark: | :heavy_check_mark: / :heavy_check_mark: |
| ique_v1.5 | :x: | :x: | :x: |

0
base/I/.gitkeep Normal file
View File

View File

@@ -24,6 +24,7 @@
#include <PR/mbi.h>
#include <PR/ultratypes.h>
#include <PR/sptask.h>
#include <PR/os_version.h>
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
@@ -192,7 +193,7 @@ extern float cosf(float angle);
extern signed short sins (unsigned short angle);
extern signed short coss (unsigned short angle);
extern float sqrtf(float value);
#ifdef __sgi
#if defined(__sgi) && BUILD_VERSION >= VERSION_K
#pragma intrinsic(sqrtf);
#endif

View File

@@ -35,6 +35,7 @@ extern "C" {
#endif
#include <PR/ultratypes.h>
#include <PR/os_version.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -126,6 +127,10 @@ extern void __osInitialize_emu(void);
#endif /* _FINAL_ROM */
#if BUILD_VERSION < VERSION_K
#undef osInitialize
#endif
/**************************************************************************
*
* Extern variables

View File

@@ -26,14 +26,22 @@ extern "C" {
#endif
#include "os.h"
#include "os_version.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Routine for HW interrupt "handler" */
#if BUILD_VERSION >= VERSION_J
extern void __osSetHWIntrRoutine(OSHWIntr interrupt,
s32 (*handler)(void), void *stackEnd);
extern void __osGetHWIntrRoutine(OSHWIntr interrupt,
s32 (**handler)(void), void **stackEnd);
#else
extern void __osSetHWIntrRoutine(OSHWIntr interrupt,
s32 (*handler)(void));
extern void __osGetHWIntrRoutine(OSHWIntr interrupt,
s32 (**handler)(void));
#endif
/* Routine for global interrupt mask */
extern void __osSetGlobalIntMask(OSHWIntr);

View File

@@ -17,6 +17,7 @@ extern "C" {
#include <PR/ultratypes.h>
#include "os_message.h"
#include "os_pfs.h"
#include "os_version.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
@@ -62,7 +63,7 @@ extern "C" {
/* Rumble PAK interface */
extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int);
#if 1
#if BUILD_VERSION >= VERSION_J
#define MOTOR_START 1
#define MOTOR_STOP 0
#define osMotorStart(x) __osMotorAccess((x), MOTOR_START)

View File

@@ -81,9 +81,9 @@ void alCSPNew(ALCSPlayer *seqp, ALSeqpConfig *c)
seqp->initOsc = c->initOsc;
seqp->updateOsc = c->updateOsc;
seqp->stopOsc = c->stopOsc;
seqp->nextEvent.type = AL_SEQP_API_EVT; /* this will start the voice handler "spinning" */
/*
* init the channel state
*/
@@ -104,14 +104,13 @@ void alCSPNew(ALCSPlayer *seqp, ALSeqpConfig *c)
seqp->vAllocHead = 0;
seqp->vAllocTail = 0;
/*
* init the event queue
*/
#if BUILD_VERSION < VERSION_J
#line 109
#endif
// init the event queue
items = alHeapAlloc(hp, c->maxEvents, sizeof(ALEventListItem));
alEvtqNew(&seqp->evtq, items, c->maxEvents);
/*
* add ourselves to the driver
*/
@@ -292,10 +291,10 @@ static ALMicroTime __CSPVoiceHandler(void *node)
break;
case (AL_SEQP_SEQ_EVT):
#ifdef _DEBUG
assert(seqp->state != AL_PLAYING); /* Must be done playing to change sequences. */
#if BUILD_VERSION < VERSION_J
#line 294
#endif
assert(seqp->state != AL_PLAYING); /* Must be done playing to change sequences. */
seqp->target = seqp->nextEvent.msg.spseq.seq;
__setUsptFromTempo (seqp, 500000.0);
@@ -304,10 +303,10 @@ static ALMicroTime __CSPVoiceHandler(void *node)
break;
case (AL_SEQP_BANK_EVT):
#ifdef _DEBUG
assert(seqp->state == AL_STOPPED); /* Must be fully stopped to change banks. */
#if BUILD_VERSION < VERSION_J
#line 303
#endif
assert(seqp->state == AL_STOPPED); /* Must be fully stopped to change banks. */
seqp->bank = seqp->nextEvent.msg.spbank.bank;
__initFromBank((ALSeqPlayer *)seqp, seqp->bank);
@@ -317,10 +316,10 @@ static ALMicroTime __CSPVoiceHandler(void *node)
case (AL_SEQ_END_EVT):
case (AL_TEMPO_EVT):
case (AL_SEQ_MIDI_EVT):
#ifdef _DEBUG
assert(FALSE);
#if BUILD_VERSION < VERSION_J
#line 313
#endif
assert(FALSE);
break;
}
@@ -407,16 +406,16 @@ __CSPHandleNextSeqEvent(ALCSPlayer *seqp)
break;
default:
#ifdef _DEBUG
assert(FALSE); /* Sequence event type not supported. */
#if BUILD_VERSION < VERSION_J
#line 399
#endif
assert(FALSE); /* Sequence event type not supported. */
#if BUILD_VERSION >= VERSION_J
break;
#endif
}
}
static void __CSPHandleMIDIMsg(ALCSPlayer *seqp, ALEvent *event)
{
ALVoice *voice;
@@ -723,10 +722,10 @@ static void __CSPHandleMIDIMsg(ALCSPlayer *seqp, ALEvent *event)
break;
case (AL_MIDI_ProgramChange):
/* sct 1/16/96 - We must have a valid bank in order to process the program change. */
#ifdef _DEBUG
assert(seqp->bank != NULL);
#if BUILD_VERSION < VERSION_J
#line 710
#endif
assert(seqp->bank != NULL);
if (key < seqp->bank->instCount)
{

View File

@@ -93,19 +93,19 @@ Acmd *alEnvmixerPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
*/
inp = AL_RESAMPLER_OUT;
while (e->ctrlList != 0) {
while (e->ctrlList != 0) {
lastOffset = thisOffset;
thisOffset = e->ctrlList->delta;
samples = thisOffset - lastOffset;
if (samples > outCount)
break;
#ifdef _DEBUG
#if BUILD_VERSION < VERSION_J
#line 103
#endif
assert(samples >= 0);
assert(samples <= AL_MAX_RSP_SAMPLES);
#endif
switch (e->ctrlList->type) {
case (AL_FILTER_START_VOICE_ALT):
{
@@ -307,8 +307,7 @@ Acmd *alEnvmixerPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
return ptr;
}
s32
alEnvmixerParam(void *filter, s32 paramID, void *param)
s32 alEnvmixerParam(void *filter, s32 paramID, void *param)
{
ALFilter *f = (ALFilter *) filter;
ALEnvMixer *e = (ALEnvMixer *) filter;
@@ -349,9 +348,10 @@ alEnvmixerParam(void *filter, s32 paramID, void *param)
}
return 0;
}
static
Acmd* _pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount,
#if BUILD_VERSION < VERSION_J
#line 350
#endif
static Acmd* _pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount,
s32 sampleOffset, Acmd *p)
{
Acmd *ptr = p;
@@ -366,9 +366,9 @@ Acmd* _pullSubFrame(void *filter, s16 *inp, s16 *outp, s32 outCount,
* ask all filters upstream from us to build their command
* lists.
*/
#ifdef _DEBUG
assert(source);
#endif
ptr = (*source->handler)(source, inp, outCount, sampleOffset, p);

View File

@@ -46,7 +46,6 @@ extern u32 load_num, load_cnt, load_max, load_min, save_num, save_cnt, save_max,
}
Acmd *_loadOutputBuffer(ALFx *r, ALDelay *d, s32 buff, s32 incount, Acmd *p);
Acmd *_loadBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p);
Acmd *_saveBuffer(ALFx *r, s16 *curr_ptr, s32 buff, s32 count, Acmd *p);
@@ -71,10 +70,10 @@ Acmd *alFxPull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
#ifdef AUD_PROFILE
lastCnt[++cnt_index] = osGetCount();
#endif
#ifdef _DEBUG
assert(source);
#if BUILD_VERSION < VERSION_J
#line 74
#endif
assert(source);
/*
* pull channels going into this effect first

View File

@@ -25,15 +25,15 @@
Acmd *alSavePull(void *filter, s16 *outp, s32 outCount, s32 sampleOffset,
Acmd *p)
{
Acmd *ptr = p;
ALSave *f = (ALSave *)filter;
ALFilter *source = f->filter.source;
#ifdef _DEBUG
assert(f->filter.source);
#if BUILD_VERSION < VERSION_J
#line 33
#endif
assert(f->filter.source);
ptr = (*source->handler)(source, outp, outCount, sampleOffset, ptr);

View File

@@ -17,22 +17,22 @@
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
#include <PR/os_version.h>
#include <libaudio.h>
#include <assert.h>
// TODO: this comes from a header
#ident "$Revision: 1.17 $"
void alSeqpDelete(ALSeqPlayer *seqp)
{
/* sct 1/4/96 - If the sequence player isn't stopped, then you may end
up with stuck notes. Application should check state before calling
this routine to be sure. */
#ifdef _DEBUG
assert(seqp->state == AL_STOPPED);
#if BUILD_VERSION < VERSION_J
#line 31
#endif
assert(seqp->state == AL_STOPPED);
alSynRemovePlayer(seqp->drvr, &seqp->node);
}

View File

@@ -291,25 +291,24 @@ ALMicroTime __seqpVoiceHandler(void *node)
chan = seqp->nextEvent.msg.sppriority.chan;
seqp->chanState[chan].priority = seqp->nextEvent.msg.sppriority.priority;
break;
case (AL_SEQP_SEQ_EVT):
#ifdef _DEBUG
assert(seqp->state != AL_PLAYING); /* Must be done playing to change sequences. */
#if BUILD_VERSION < VERSION_J // Adjust line numbers to match asserts
#line 295
#endif
assert(seqp->state != AL_PLAYING); /* Must be done playing to change sequences. */
seqp->target = seqp->nextEvent.msg.spseq.seq;
__setUsptFromTempo (seqp, 500000.0);
if (seqp->bank)
__initFromBank(seqp, seqp->bank);
break;
case (AL_SEQP_BANK_EVT):
#ifdef _DEBUG
assert(seqp->state == AL_STOPPED); /* Must be fully stopped to change banks. */
#if BUILD_VERSION < VERSION_J
#line 304
#endif
assert(seqp->state == AL_STOPPED); /* Must be fully stopped to change banks. */
seqp->bank = seqp->nextEvent.msg.spbank.bank;
__initFromBank(seqp, seqp->bank);
break;
@@ -318,10 +317,11 @@ ALMicroTime __seqpVoiceHandler(void *node)
case (AL_SEQ_END_EVT):
case (AL_TEMPO_EVT):
case (AL_SEQ_MIDI_EVT):
#ifdef _DEBUG
assert(FALSE);
#if BUILD_VERSION < VERSION_J
#line 314
#endif
assert(FALSE);
break;
}
@@ -381,7 +381,6 @@ void __postNextSeqEvent(ALSeqPlayer *seqp)
alEvtqPostEvent(&seqp->evtq, &evt, deltaTicks * seqp->uspt);
}
/*
Call this routine to handle the next event in the sequence.
Assumes that the next sequence event is scheduled to be processed
@@ -419,16 +418,16 @@ __handleNextSeqEvent(ALSeqPlayer *seqp)
break;
default:
#ifdef _DEBUG
assert(FALSE); /* Sequence event type not supported. */
#if BUILD_VERSION < VERSION_J
#line 411
#endif
assert(FALSE); /* Sequence event type not supported. */
#if BUILD_VERSION >= VERSION_J
break;
#endif
}
}
void __handleMIDIMsg(ALSeqPlayer *seqp, ALEvent *event)
{
ALVoice *voice;
@@ -446,11 +445,12 @@ void __handleMIDIMsg(ALSeqPlayer *seqp, ALEvent *event)
ALVoiceState *vstate;
ALPan pan;
ALFxRef fxref;
#ifdef _DEBUG
#if BUILD_VERSION < VERSION_J
#line 434
#endif
/* sct 12/15/95 - Fixed assert to also allow seqp midi event types. */
assert(event->type == AL_SEQ_MIDI_EVT || event->type == AL_SEQP_MIDI_EVT);
#endif
status = midi->status & AL_MIDI_StatusMask;
chan = midi->status & AL_MIDI_ChannelMask;
@@ -722,16 +722,16 @@ void __handleMIDIMsg(ALSeqPlayer *seqp, ALEvent *event)
case (AL_MIDI_FX3_CTRL):
default:
break;
}
break;
case (AL_MIDI_ProgramChange):
/* sct 1/16/96 - We must have a valid bank in order to process the program change. */
#ifdef _DEBUG
assert(seqp->bank != NULL);
#if BUILD_VERSION < VERSION_J
#line 713
#endif
assert(seqp->bank != NULL);
if (key < seqp->bank->instCount) {
ALInstrument *inst = seqp->bank->instArray[key];
@@ -873,7 +873,6 @@ ALVoiceState *__lookupVoice(ALSeqPlayer *seqp, u8 key, u8 channel)
return 0;
}
#if 0
ALSound *__lookupSound(ALSeqPlayer *seqp, u8 key, u8 vel, u8 chan)
{
@@ -902,10 +901,11 @@ ALSound *__lookupSoundQuick(ALSeqPlayer *seqp, u8 key, u8 vel, u8 chan)
s32 r = inst->soundCount;
s32 i;
ALKeyMap *keymap;
#ifdef _DEBUG
assert(inst != NULL); /* sct 10/31/95 - If inst is NULL, then the seqp probably wasn't setup correctly. */
#if BUILD_VERSION < VERSION_J
#line 885
#endif
assert(inst != NULL); /* sct 10/31/95 - If inst is NULL, then the seqp probably wasn't setup correctly. */
while (r >= l) {
i = (l+r)/2;

View File

@@ -80,7 +80,9 @@ ALMicroTime _sndpVoiceHandler(void *node)
switch (sndp->nextEvent.type) {
case (AL_SNDP_API_EVT):
evt.common.type = AL_SNDP_API_EVT;
evt.common.state = (ALSoundState*)-1;
#if BUILD_VERSION >= VERSION_K
evt.common.state = (ALSoundState*)-1;
#endif
alEvtqPostEvent(&sndp->evtq, (ALEvent *)&evt, sndp->frameTime);
break;
@@ -230,9 +232,7 @@ void _handleEvent(ALSndPlayer *sndp, ALSndpEvent *event)
break;
}
}
static
void _removeEvents(ALEventQueue *evtq, ALSoundState *state)
static void _removeEvents(ALEventQueue *evtq, ALSoundState *state)
{
ALLink *thisNode;
ALLink *nextNode;
@@ -260,8 +260,6 @@ void _removeEvents(ALEventQueue *evtq, ALSoundState *state)
osSetIntMask(mask);
}
/*
This routine safely divides a signed 32-bit integer
by a floating point value. It avoids overflow by using
@@ -275,17 +273,18 @@ void _removeEvents(ALEventQueue *evtq, ALSoundState *state)
very small pitch ratios can cause the reult to overflow,
causing a floating point exception.
*/
static
s32 _DivS32ByF32 (s32 i, f32 f)
#if BUILD_VERSION == VERSION_J // Adjust line numbers to match assert
#line 277
#elif BUILD_VERSION < VERSION_J
#line 278
#endif
static s32 _DivS32ByF32 (s32 i, f32 f)
{
#define INT_MAX 2147483647 /* Should be in a limits.h file. */
f64 rd;
int ri;
#ifdef _DEBUG
assert(f!=0); /* Caller must make sure we do not divide by zero! */
#endif
rd = i/f; /* Store result as a double to avoid overflow. */

View File

@@ -39,9 +39,18 @@ void alSynSetFXMix(ALSynth *synth, ALVoice *v, u8 fxmix)
*/
update->delta = synth->paramSamples + v->pvoice->offset;
update->type = AL_FILTER_SET_FXAMT;
if (fxmix > 127)
#if BUILD_VERSION >= VERSION_J
if (fxmix > 127) {
fxmix = 127;
update->data.i = fxmix;
}
update->data.i = fxmix;
#else
if (fxmix < 0) { // Not possible
update->data.i = -fxmix;
} else {
update->data.i = fxmix;
}
#endif
update->next = 0;
f = v->pvoice->channelKnob;

Some files were not shown because too many files have changed in this diff Show More