Compare commits
7 Commits
40bee0f224
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 56d1db9bbe | |||
| 8daff2b6a2 | |||
| 53731adf81 | |||
| 54b5e31836 | |||
| 618902d50b | |||
| afa2edaf4e | |||
| 42132a5646 |
+61
-40
@@ -1,6 +1,10 @@
|
|||||||
name: Build libsm64
|
name: Build libsm64
|
||||||
|
|
||||||
on: [ push, pull_request ]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "**"
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build:
|
Build:
|
||||||
@@ -13,9 +17,9 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- identifier: windows
|
- identifier: windows
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- identifier: web
|
|
||||||
os: ubuntu-latest
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout project
|
- name: Checkout project
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -23,10 +27,10 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: "3.10"
|
||||||
|
|
||||||
- name: (Windows) Install MinGW
|
- name: (Windows) Install MinGW
|
||||||
if: ${{ startsWith(matrix.identifier, 'windows') }}
|
if: matrix.identifier == 'windows'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y -qq
|
sudo apt-get update -y -qq
|
||||||
sudo apt-get install -y mingw-w64
|
sudo apt-get install -y mingw-w64
|
||||||
@@ -40,22 +44,15 @@ jobs:
|
|||||||
echo "OS=Windows_NT" >> $GITHUB_ENV
|
echo "OS=Windows_NT" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: (Linux) Install dependencies
|
- name: (Linux) Install dependencies
|
||||||
if: ${{ startsWith(matrix.identifier, 'linux') }}
|
if: matrix.identifier == 'linux'
|
||||||
run: |
|
run: |
|
||||||
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
|
||||||
sudo apt-get update -y -qq
|
sudo apt-get update -y -qq
|
||||||
sudo apt-get install -y libsdl2-dev libglew-dev
|
sudo apt-get install -y libsdl2-dev libglew-dev
|
||||||
|
|
||||||
- name: (Web) Set up Emscripten
|
|
||||||
if: ${{ startsWith(matrix.identifier, 'web') }}
|
|
||||||
uses: mymindstorm/setup-emsdk@v14
|
|
||||||
|
|
||||||
- name: Build shared library
|
- name: Build shared library
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ matrix.identifier }}" == "web" ]]; then
|
if [[ "${{ matrix.identifier }}" == "windows" ]]; then
|
||||||
emmake make lib -j $(nproc) CC=emcc
|
|
||||||
elif [[ "${{ matrix.identifier }}" == "windows" ]]; then
|
|
||||||
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
|
||||||
CC=x86_64-w64-mingw32-gcc \
|
CC=x86_64-w64-mingw32-gcc \
|
||||||
CXX=x86_64-w64-mingw32-g++
|
CXX=x86_64-w64-mingw32-g++
|
||||||
@@ -63,36 +60,60 @@ jobs:
|
|||||||
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: (Linux) Build test executable
|
- name: Build test executable (Linux only)
|
||||||
if: ${{ startsWith(matrix.identifier, 'linux') }}
|
if: matrix.identifier == 'linux'
|
||||||
run: |
|
run: make test -j$(nproc)
|
||||||
make test -j`nproc`
|
|
||||||
|
|
||||||
- name: Upload build
|
- name: Prepare artifacts
|
||||||
|
run: |
|
||||||
|
mkdir -p artifacts/${{ matrix.identifier }}
|
||||||
|
cp -r dist artifacts/${{ matrix.identifier }}/
|
||||||
|
cp README.md artifacts/${{ matrix.identifier }}/
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: libsm64_${{ matrix.identifier }}
|
name: libsm64_${{ matrix.identifier }}
|
||||||
path: |
|
path: artifacts/${{ matrix.identifier }}
|
||||||
./README.md
|
|
||||||
./dist
|
|
||||||
./run-test
|
|
||||||
|
|
||||||
#Release:
|
Release:
|
||||||
# name: "Snapshot Release"
|
name: Snapshot Release
|
||||||
# runs-on: "ubuntu-latest"
|
runs-on: ubuntu-latest
|
||||||
# needs: Build
|
needs: Build
|
||||||
|
|
||||||
# steps:
|
if: github.ref_type == 'branch'
|
||||||
# - name: Download artifacts
|
|
||||||
# uses: actions/download-artifact@v3
|
|
||||||
|
|
||||||
# - name: Create a Release
|
steps:
|
||||||
# uses: "marvinpinto/action-automatic-releases@latest"
|
- name: Get short SHA
|
||||||
# with:
|
id: vars
|
||||||
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
shell: bash
|
||||||
# automatic_release_tag: "latest"
|
run: |
|
||||||
# prerelease: true
|
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
|
||||||
# title: "Snapshot Build"
|
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
||||||
# files: |
|
|
||||||
# ./README.md
|
- name: Download artifacts
|
||||||
# ./dist
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Create zip files
|
||||||
|
run: |
|
||||||
|
mkdir -p release_files
|
||||||
|
|
||||||
|
cd artifacts/libsm64_linux
|
||||||
|
zip -r ../../release_files/libsm64_linux.zip .
|
||||||
|
|
||||||
|
cd ../libsm64_windows
|
||||||
|
zip -r ../../release_files/libsm64_windows.zip .
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
repository: NepuShiro/libsm64
|
||||||
|
tag_name: build-${{ github.ref_name }}-${{ steps.vars.outputs.short_sha }}
|
||||||
|
name: Snapshot Build ${{ github.ref_name }}-${{ steps.vars.outputs.short_sha }}
|
||||||
|
prerelease: true
|
||||||
|
files: |
|
||||||
|
release_files/libsm64_linux.zip
|
||||||
|
release_files/libsm64_windows.zip
|
||||||
Generated
+4
@@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="CMakePythonSetting">
|
||||||
|
<option name="pythonIntegrationState" value="YES" />
|
||||||
|
</component>
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="MakefileSettings">
|
<component name="MakefileSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
@@ -16,4 +19,5 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
<component name="WestSettings"><![CDATA[{}]]></component>
|
||||||
</project>
|
</project>
|
||||||
+1
-5
@@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by nepushiro on 5/29/26.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "FakeObject.h"
|
#include "FakeObject.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -11,9 +7,9 @@
|
|||||||
#include "decomp/game/interaction.h"
|
#include "decomp/game/interaction.h"
|
||||||
#include "decomp/game/object_stuff.h"
|
#include "decomp/game/object_stuff.h"
|
||||||
#include "decomp/include/object_fields.h"
|
#include "decomp/include/object_fields.h"
|
||||||
#include "libsm64.h"
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include "decomp/shim.h"
|
||||||
|
|
||||||
void fake_object_init(struct FakeObject *fake, float x, float y, float z)
|
void fake_object_init(struct FakeObject *fake, float x, float y, float z)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-6
@@ -1,12 +1,6 @@
|
|||||||
//
|
|
||||||
// Created by nepushiro on 5/29/26.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef LIBSM64_FAKEOBJECT_H
|
#ifndef LIBSM64_FAKEOBJECT_H
|
||||||
#define LIBSM64_FAKEOBJECT_H
|
#define LIBSM64_FAKEOBJECT_H
|
||||||
|
|
||||||
#endif //LIBSM64_FAKEOBJECT_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -23,3 +17,5 @@ bool fake_object_overlaps_mario(struct FakeObject *fake, struct MarioState *m);
|
|||||||
void fake_object_add_collision(struct FakeObject *fake, struct MarioState *m);
|
void fake_object_add_collision(struct FakeObject *fake, struct MarioState *m);
|
||||||
void fake_object_apply_pole(struct FakeObject *fake);
|
void fake_object_apply_pole(struct FakeObject *fake);
|
||||||
void fake_object_set_preset(struct FakeObject *fake, uint32_t preset);
|
void fake_object_set_preset(struct FakeObject *fake, uint32_t preset);
|
||||||
|
|
||||||
|
#endif // LIBSM64_FAKEOBJECT_H
|
||||||
@@ -872,14 +872,12 @@ static void process_sound_request(u32 bits, f32 *pos)
|
|||||||
|
|
||||||
if (soundId >= sNumSoundsPerBank[bank] || sSoundBankDisabled[bank])
|
if (soundId >= sNumSoundsPerBank[bank] || sSoundBankDisabled[bank])
|
||||||
{
|
{
|
||||||
//DEBUG_PRINT("process_sound_request: invalid soundId %d\n", soundId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 soundIndex = sSoundBanks[bank][0].next;
|
u8 soundIndex = sSoundBanks[bank][0].next;
|
||||||
while (soundIndex != 0xff && soundIndex != 0)
|
while (soundIndex != 0xff && soundIndex != 0)
|
||||||
{
|
{
|
||||||
//DEBUG_PRINT("process_sound_request: soundIndex %d\n", soundIndex);
|
|
||||||
// If an existing sound from the same source exists in the bank, then we should either
|
// If an existing sound from the same source exists in the bank, then we should either
|
||||||
// interrupt that sound and replace it with the new sound, or we should drop the new sound.
|
// interrupt that sound and replace it with the new sound, or we should drop the new sound.
|
||||||
if (sSoundBanks[bank][soundIndex].x == pos)
|
if (sSoundBanks[bank][soundIndex].x == pos)
|
||||||
@@ -930,7 +928,6 @@ static void process_sound_request(u32 bits, f32 *pos)
|
|||||||
// If free list has more than one element remaining
|
// If free list has more than one element remaining
|
||||||
if (sSoundBanks[bank][sSoundBankFreeListFront[bank]].next != 0xff && soundIndex != 0)
|
if (sSoundBanks[bank][sSoundBankFreeListFront[bank]].next != 0xff && soundIndex != 0)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("process_sound_request2: soundIndex %d\n", soundIndex);
|
|
||||||
// Allocate from free list
|
// Allocate from free list
|
||||||
soundIndex = sSoundBankFreeListFront[bank];
|
soundIndex = sSoundBankFreeListFront[bank];
|
||||||
|
|
||||||
@@ -966,7 +963,6 @@ static void process_all_sound_requests(void)
|
|||||||
struct Sound *sound = &sSoundRequests[sNumProcessedSoundRequests];
|
struct Sound *sound = &sSoundRequests[sNumProcessedSoundRequests];
|
||||||
process_sound_request(sound->soundBits, sound->position);
|
process_sound_request(sound->soundBits, sound->position);
|
||||||
sNumProcessedSoundRequests++;
|
sNumProcessedSoundRequests++;
|
||||||
//DEBUG_PRINT("processed sounds: %d\n", sNumProcessedSoundRequests);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,17 +120,10 @@ ALSeqFile *get_audio_file_header(s32 arg0);
|
|||||||
*/
|
*/
|
||||||
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes)
|
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("audio_dma_copy_immediate()");
|
|
||||||
DEBUG_PRINT("- dev addr: %x", devAddr);
|
|
||||||
DEBUG_PRINT("- vAddr: %x", vAddr);
|
|
||||||
DEBUG_PRINT("- # bytes: %d", nbytes);
|
|
||||||
eu_stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes);
|
eu_stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes);
|
||||||
DEBUG_PRINT("- invalidate d cache");
|
|
||||||
osInvalDCache(vAddr, nbytes);
|
osInvalDCache(vAddr, nbytes);
|
||||||
DEBUG_PRINT("- start dma");
|
|
||||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes,
|
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes,
|
||||||
&gAudioDmaMesgQueue);
|
&gAudioDmaMesgQueue);
|
||||||
DEBUG_PRINT("- recv message");
|
|
||||||
osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_BLOCK);
|
osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_BLOCK);
|
||||||
eu_stubbed_printf_0("Romcopyend\n");
|
eu_stubbed_printf_0("Romcopyend\n");
|
||||||
}
|
}
|
||||||
@@ -646,43 +639,31 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
|||||||
|
|
||||||
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1)
|
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("bank_load_immediate()");
|
|
||||||
|
|
||||||
UNUSED u32 pad1[4];
|
UNUSED u32 pad1[4];
|
||||||
u32 buf[4];
|
u32 buf[4];
|
||||||
|
|
||||||
// (This is broken if the length is 1 (mod 16), but that never happens --
|
// (This is broken if the length is 1 (mod 16), but that never happens --
|
||||||
// it's always divisible by 4.)
|
// it's always divisible by 4.)
|
||||||
DEBUG_PRINT("- getting alloc");
|
|
||||||
s32 alloc = gAlCtlHeader->seqArray[bankId].len + 0xf;
|
s32 alloc = gAlCtlHeader->seqArray[bankId].len + 0xf;
|
||||||
DEBUG_PRINT("- aligning");
|
|
||||||
alloc = ALIGN16(alloc);
|
alloc = ALIGN16(alloc);
|
||||||
alloc -= 0x10;
|
alloc -= 0x10;
|
||||||
DEBUG_PRINT("- getting ctl data for bank %d", bankId);
|
|
||||||
u8 *ctlData = gAlCtlHeader->seqArray[bankId].offset;
|
u8 *ctlData = gAlCtlHeader->seqArray[bankId].offset;
|
||||||
DEBUG_PRINT("- alloc bank or seq");
|
|
||||||
struct AudioBank *ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
|
struct AudioBank *ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- copying dma immediate 1");
|
|
||||||
DEBUG_PRINT("- ctlData: %x", ctlData);
|
|
||||||
audio_dma_copy_immediate((uintptr_t)ctlData, buf, 0x10);
|
audio_dma_copy_immediate((uintptr_t)ctlData, buf, 0x10);
|
||||||
DEBUG_PRINT("- getting nums");
|
|
||||||
u32 numInstruments = buf[0];
|
u32 numInstruments = buf[0];
|
||||||
u32 numDrums = buf[1];
|
u32 numDrums = buf[1];
|
||||||
DEBUG_PRINT("- copying dma immediate 2");
|
|
||||||
audio_dma_copy_immediate((uintptr_t)(ctlData + 0x10), ret, alloc);
|
audio_dma_copy_immediate((uintptr_t)(ctlData + 0x10), ret, alloc);
|
||||||
DEBUG_PRINT("- patching bank");
|
|
||||||
patch_audio_bank(ret, gAlTbl->seqArray[bankId].offset, numInstruments, numDrums);
|
patch_audio_bank(ret, gAlTbl->seqArray[bankId].offset, numInstruments, numDrums);
|
||||||
DEBUG_PRINT("- setting ctl entries");
|
|
||||||
gCtlEntries[bankId].numInstruments = (u8)numInstruments;
|
gCtlEntries[bankId].numInstruments = (u8)numInstruments;
|
||||||
gCtlEntries[bankId].numDrums = (u8)numDrums;
|
gCtlEntries[bankId].numDrums = (u8)numDrums;
|
||||||
gCtlEntries[bankId].instruments = ret->instruments;
|
gCtlEntries[bankId].instruments = ret->instruments;
|
||||||
gCtlEntries[bankId].drums = ret->drums;
|
gCtlEntries[bankId].drums = ret->drums;
|
||||||
DEBUG_PRINT("- setting load status");
|
|
||||||
gBankLoadStatus[bankId] = SOUND_LOAD_STATUS_COMPLETE;
|
gBankLoadStatus[bankId] = SOUND_LOAD_STATUS_COMPLETE;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -851,12 +832,10 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount)
|
|||||||
|
|
||||||
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
|
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("load_banks_immediate()");
|
|
||||||
void *ret;
|
void *ret;
|
||||||
u32 bankId;
|
u32 bankId;
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
DEBUG_PRINT("- getting offset");
|
|
||||||
u16 offset = ((u16 *)gAlBankSets)[seqId];
|
u16 offset = ((u16 *)gAlBankSets)[seqId];
|
||||||
#ifdef VERSION_EU
|
#ifdef VERSION_EU
|
||||||
for (i = gAlBankSets[offset++]; i != 0; i--)
|
for (i = gAlBankSets[offset++]; i != 0; i--)
|
||||||
@@ -864,21 +843,17 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
|
|||||||
bankId = gAlBankSets[offset++];
|
bankId = gAlBankSets[offset++];
|
||||||
#else
|
#else
|
||||||
offset++;
|
offset++;
|
||||||
DEBUG_PRINT("- looping through bank sets");
|
|
||||||
for (i = gAlBankSets[offset - 1]; i != 0; i--)
|
for (i = gAlBankSets[offset - 1]; i != 0; i--)
|
||||||
{
|
{
|
||||||
offset++;
|
offset++;
|
||||||
DEBUG_PRINT("- getting bank id");
|
|
||||||
bankId = gAlBankSets[offset - 1];
|
bankId = gAlBankSets[offset - 1];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUG_PRINT("- checking if bank load is complete");
|
|
||||||
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE)
|
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE)
|
||||||
{
|
{
|
||||||
#ifdef VERSION_EU
|
#ifdef VERSION_EU
|
||||||
ret = get_bank_or_seq(&gBankLoadedPool, 2, bankId);
|
ret = get_bank_or_seq(&gBankLoadedPool, 2, bankId);
|
||||||
#else
|
#else
|
||||||
DEBUG_PRINT("- getting bank or seq");
|
|
||||||
ret = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]);
|
ret = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -889,7 +864,6 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
|
|||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- bank load immediate");
|
|
||||||
ret = bank_load_immediate(bankId, 2);
|
ret = bank_load_immediate(bankId, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -899,7 +873,6 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
|
|||||||
|
|
||||||
void preload_sequence(u32 seqId, u8 preloadMask)
|
void preload_sequence(u32 seqId, u8 preloadMask)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("preload_sequence()");
|
|
||||||
void *sequenceData;
|
void *sequenceData;
|
||||||
u8 temp;
|
u8 temp;
|
||||||
|
|
||||||
@@ -911,25 +884,21 @@ void preload_sequence(u32 seqId, u8 preloadMask)
|
|||||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||||
if (preloadMask & PRELOAD_BANKS)
|
if (preloadMask & PRELOAD_BANKS)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- load banks immediate");
|
|
||||||
load_banks_immediate(seqId, &temp);
|
load_banks_immediate(seqId, &temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preloadMask & PRELOAD_SEQUENCE)
|
if (preloadMask & PRELOAD_SEQUENCE)
|
||||||
{
|
{
|
||||||
// @bug should be IS_SEQ_LOAD_COMPLETE
|
// @bug should be IS_SEQ_LOAD_COMPLETE
|
||||||
DEBUG_PRINT("- checking if bank load immediate");
|
|
||||||
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE)
|
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE)
|
||||||
{
|
{
|
||||||
eu_stubbed_printf_1("SEQ %d ALREADY CACHED\n", seqId);
|
eu_stubbed_printf_1("SEQ %d ALREADY CACHED\n", seqId);
|
||||||
DEBUG_PRINT("- getting bank or seq");
|
|
||||||
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
|
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sequenceData = NULL;
|
sequenceData = NULL;
|
||||||
}
|
}
|
||||||
DEBUG_PRINT("- checking dma immediate");
|
|
||||||
if (sequenceData == NULL && sequence_dma_immediate(seqId, 2) == NULL)
|
if (sequenceData == NULL && sequence_dma_immediate(seqId, 2) == NULL)
|
||||||
{
|
{
|
||||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||||
@@ -1037,7 +1006,6 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync)
|
|||||||
// (void) must be omitted from parameters to fix stack with -framepointer
|
// (void) must be omitted from parameters to fix stack with -framepointer
|
||||||
void audio_init()
|
void audio_init()
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("audio_init()");
|
|
||||||
UNUSED s8 pad[32];
|
UNUSED s8 pad[32];
|
||||||
u8 buf[0x10];
|
u8 buf[0x10];
|
||||||
s32 i, UNUSED k;
|
s32 i, UNUSED k;
|
||||||
@@ -1048,7 +1016,6 @@ void audio_init()
|
|||||||
|
|
||||||
gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||||
|
|
||||||
DEBUG_PRINT("- setting values in unused");
|
|
||||||
s32 lim1 = gUnusedCount80333EE8;
|
s32 lim1 = gUnusedCount80333EE8;
|
||||||
for (i = 0; i < lim1; i++)
|
for (i = 0; i < lim1; i++)
|
||||||
{
|
{
|
||||||
@@ -1056,7 +1023,6 @@ void audio_init()
|
|||||||
gUnused80226E98[i] = 0;
|
gUnused80226E98[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- clearing audio heap");
|
|
||||||
s32 lim2 = gAudioHeapSize;
|
s32 lim2 = gAudioHeapSize;
|
||||||
for (i = 0; i <= lim2 / 8 - 1; i++)
|
for (i = 0; i <= lim2 / 8 - 1; i++)
|
||||||
{
|
{
|
||||||
@@ -1114,39 +1080,22 @@ void audio_init()
|
|||||||
alSeqFileNew(gSeqFileHeader, data);
|
alSeqFileNew(gSeqFileHeader, data);
|
||||||
|
|
||||||
// Load header for CTL (instrument metadata)
|
// Load header for CTL (instrument metadata)
|
||||||
DEBUG_PRINT("- loading ctl header");
|
|
||||||
gAlCtlHeader = (ALSeqFile *)buf;
|
gAlCtlHeader = (ALSeqFile *)buf;
|
||||||
data = gSoundDataADSR;
|
data = gSoundDataADSR;
|
||||||
DEBUG_PRINT("- copying dma immediate");
|
|
||||||
audio_dma_copy_immediate((uintptr_t)data, gAlCtlHeader, 0x10);
|
audio_dma_copy_immediate((uintptr_t)data, gAlCtlHeader, 0x10);
|
||||||
size = gAlCtlHeader->seqCount * sizeof(ALSeqData) + 4;
|
size = gAlCtlHeader->seqCount * sizeof(ALSeqData) + 4;
|
||||||
DEBUG_PRINT("- seq count: %d", gAlCtlHeader->seqCount);
|
|
||||||
DEBUG_PRINT("- size after read: %d", size);
|
|
||||||
size = ALIGN16(size);
|
size = ALIGN16(size);
|
||||||
DEBUG_PRINT("- size after align: %d", size);
|
|
||||||
gCtlEntries = soundAlloc(&gAudioInitPool, gAlCtlHeader->seqCount * sizeof(struct CtlEntry));
|
gCtlEntries = soundAlloc(&gAudioInitPool, gAlCtlHeader->seqCount * sizeof(struct CtlEntry));
|
||||||
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
|
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
|
||||||
DEBUG_PRINT("@ copying data from sound data adsr to ctl header");
|
|
||||||
DEBUG_PRINT("- data: %x", data);
|
|
||||||
DEBUG_PRINT("- ctl header: %x", gAlCtlHeader);
|
|
||||||
DEBUG_PRINT("- size: %d", size);
|
|
||||||
audio_dma_copy_immediate((uintptr_t)data, gAlCtlHeader, size);
|
audio_dma_copy_immediate((uintptr_t)data, gAlCtlHeader, size);
|
||||||
DEBUG_PRINT("- creating new seq file for ctl");
|
|
||||||
alSeqFileNew(gAlCtlHeader, data);
|
alSeqFileNew(gAlCtlHeader, data);
|
||||||
|
|
||||||
// Load header for TBL (raw sound data)
|
// Load header for TBL (raw sound data)
|
||||||
DEBUG_PRINT("- loading tbl");
|
|
||||||
gAlTbl = (ALSeqFile *)buf;
|
gAlTbl = (ALSeqFile *)buf;
|
||||||
DEBUG_PRINT("- copying dma");
|
|
||||||
audio_dma_copy_immediate((uintptr_t)data, gAlTbl, 0x10);
|
audio_dma_copy_immediate((uintptr_t)data, gAlTbl, 0x10);
|
||||||
DEBUG_PRINT("- tbl seq count: %d", gAlTbl->seqCount);
|
|
||||||
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
|
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
|
||||||
DEBUG_PRINT("- size: %d", size);
|
|
||||||
size = ALIGN16(size);
|
size = ALIGN16(size);
|
||||||
DEBUG_PRINT("- size after align: %d", size);
|
|
||||||
gAlTbl = soundAlloc(&gAudioInitPool, size);
|
gAlTbl = soundAlloc(&gAudioInitPool, size);
|
||||||
DEBUG_PRINT("- tbl alloc at %x", gAlTbl);
|
|
||||||
DEBUG_PRINT("- gSoundDataRaw at %x", gSoundDataRaw);
|
|
||||||
audio_dma_copy_immediate((uintptr_t)gSoundDataRaw, gAlTbl, size);
|
audio_dma_copy_immediate((uintptr_t)gSoundDataRaw, gAlTbl, size);
|
||||||
alSeqFileNew(gAlTbl, (u8 *)gSoundDataRaw);
|
alSeqFileNew(gAlTbl, (u8 *)gSoundDataRaw);
|
||||||
|
|
||||||
|
|||||||
@@ -447,10 +447,7 @@ void init_layer_freelist(void)
|
|||||||
|
|
||||||
u8 m64_read_u8(struct M64ScriptState *state)
|
u8 m64_read_u8(struct M64ScriptState *state)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("m64_read_u8()");
|
|
||||||
DEBUG_PRINT("- state at %x", state);
|
|
||||||
u8 *midiArg = state->pc++;
|
u8 *midiArg = state->pc++;
|
||||||
DEBUG_PRINT("- read u8 (%d) at (%x)", *midiArg, midiArg);
|
|
||||||
return *midiArg;
|
return *midiArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1205,10 +1202,8 @@ s32 seq_channel_layer_process_script_part2(struct SequenceChannelLayer *layer)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xc6: // layer_setinstr
|
case 0xc6: // layer_setinstr
|
||||||
DEBUG_PRINT(" - cmd 0xc6, setinstr");
|
|
||||||
|
|
||||||
cmd = m64_read_u8(state);
|
cmd = m64_read_u8(state);
|
||||||
DEBUG_PRINT(" - read %d from state", cmd);
|
|
||||||
|
|
||||||
if (cmd >= 0x7f)
|
if (cmd >= 0x7f)
|
||||||
{
|
{
|
||||||
@@ -1552,8 +1547,6 @@ s32 seq_channel_layer_process_script_part3(struct SequenceChannelLayer *layer, s
|
|||||||
|
|
||||||
u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrument **instOut, struct AdsrSettings *adsr)
|
u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrument **instOut, struct AdsrSettings *adsr)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("@ get_instrument()");
|
|
||||||
DEBUG_PRINT("- instrument id: %d", instId);
|
|
||||||
|
|
||||||
struct Instrument *inst;
|
struct Instrument *inst;
|
||||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||||
@@ -1619,9 +1612,6 @@ u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrume
|
|||||||
|
|
||||||
void set_instrument(struct SequenceChannel *seqChannel, u8 instId)
|
void set_instrument(struct SequenceChannel *seqChannel, u8 instId)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("@ set_instrument()");
|
|
||||||
DEBUG_PRINT("- bank id: %d", seqChannel->bankId);
|
|
||||||
DEBUG_PRINT("- instrument id: %d", instId);
|
|
||||||
|
|
||||||
if (instId >= 0x80)
|
if (instId >= 0x80)
|
||||||
{
|
{
|
||||||
@@ -1658,7 +1648,6 @@ void sequence_channel_set_volume(struct SequenceChannel *seqChannel, u8 volume)
|
|||||||
|
|
||||||
void sequence_channel_process_script(struct SequenceChannel *seqChannel)
|
void sequence_channel_process_script(struct SequenceChannel *seqChannel)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("sequence_channel_process_script()");
|
|
||||||
|
|
||||||
s8 temp;
|
s8 temp;
|
||||||
u8 loBits;
|
u8 loBits;
|
||||||
@@ -1702,7 +1691,6 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel)
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
u8 cmd = m64_read_u8(state);
|
u8 cmd = m64_read_u8(state);
|
||||||
DEBUG_PRINT("- handling command: %x", cmd);
|
|
||||||
|
|
||||||
#if !defined(VERSION_EU) && !defined(VERSION_SH)
|
#if !defined(VERSION_EU) && !defined(VERSION_SH)
|
||||||
if (cmd == 0xff) // chan_end
|
if (cmd == 0xff) // chan_end
|
||||||
@@ -1895,10 +1883,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 0xc1: // chan_setinstr ("set program"?)
|
case 0xc1: // chan_setinstr ("set program"?)
|
||||||
DEBUG_PRINT(" - cmd 0xc1, setinstr");
|
|
||||||
|
|
||||||
u8 instrId = m64_read_u8(state);
|
u8 instrId = m64_read_u8(state);
|
||||||
DEBUG_PRINT(" - read %d from state", instrId);
|
|
||||||
|
|
||||||
set_instrument(seqChannel, instrId);
|
set_instrument(seqChannel, instrId);
|
||||||
break;
|
break;
|
||||||
@@ -2030,12 +2016,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0xc6: // chan_setbank; switch bank within set
|
case 0xc6: // chan_setbank; switch bank within set
|
||||||
DEBUG_PRINT(" - case 0xc6 - switch bank");
|
|
||||||
|
|
||||||
DEBUG_PRINT(" - seq id %d", seqPlayer->seqId);
|
|
||||||
|
|
||||||
cmd = m64_read_u8(state);
|
cmd = m64_read_u8(state);
|
||||||
DEBUG_PRINT(" - backwards bank id %d", cmd);
|
|
||||||
|
|
||||||
// Switch to the temp's (0-indexed) bank in this sequence's
|
// Switch to the temp's (0-indexed) bank in this sequence's
|
||||||
// bank set. Note that in the binary format (not in the JSON!)
|
// bank set. Note that in the binary format (not in the JSON!)
|
||||||
@@ -2362,8 +2345,6 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel)
|
|||||||
#else
|
#else
|
||||||
case 0x80: // chan_ioreadval; read data from audio lib
|
case 0x80: // chan_ioreadval; read data from audio lib
|
||||||
#endif
|
#endif
|
||||||
DEBUG_PRINT("- cmd 0x80, read data from audio lib");
|
|
||||||
DEBUG_PRINT(" - reading index: %d", loBits);
|
|
||||||
value = seqChannel->soundScriptIO[loBits];
|
value = seqChannel->soundScriptIO[loBits];
|
||||||
if (loBits < 4)
|
if (loBits < 4)
|
||||||
{
|
{
|
||||||
@@ -2463,7 +2444,6 @@ out:
|
|||||||
|
|
||||||
void sequence_player_process_sequence(struct SequencePlayer *seqPlayer)
|
void sequence_player_process_sequence(struct SequencePlayer *seqPlayer)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("sequence_player_process_sequence()");
|
|
||||||
|
|
||||||
u8 cmd;
|
u8 cmd;
|
||||||
#ifdef VERSION_SH
|
#ifdef VERSION_SH
|
||||||
|
|||||||
@@ -28,13 +28,9 @@
|
|||||||
#define DMEM_ADDR_WET_RIGHT_CH 0x880
|
#define DMEM_ADDR_WET_RIGHT_CH 0x880
|
||||||
|
|
||||||
#define aSetLoadBufferPair(pkt, c, off) \
|
#define aSetLoadBufferPair(pkt, c, off) \
|
||||||
DEBUG_PRINT("- (in set load buffer pair, set buffer 1) "); \
|
|
||||||
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_LEFT_CH, 0, DEFAULT_LEN_1CH - c); \
|
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_LEFT_CH, 0, DEFAULT_LEN_1CH - c); \
|
||||||
DEBUG_PRINT("- (in set load buffer pair, load buffer 1) "); \
|
|
||||||
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.left + (off))); \
|
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.left + (off))); \
|
||||||
DEBUG_PRINT("- (in set load buffer pair, set buffer 2) "); \
|
|
||||||
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_RIGHT_CH, 0, DEFAULT_LEN_1CH - c); \
|
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_RIGHT_CH, 0, DEFAULT_LEN_1CH - c); \
|
||||||
DEBUG_PRINT("- (in set load buffer pair, load buffer 2) "); \
|
|
||||||
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)))
|
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)))
|
||||||
|
|
||||||
#define aSetSaveBufferPair(pkt, c, d, off) \
|
#define aSetSaveBufferPair(pkt, c, d, off) \
|
||||||
@@ -362,7 +358,6 @@ aiBufPtr+= chunkLen;
|
|||||||
// bufLen will be divisible by 16
|
// bufLen will be divisible by 16
|
||||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen)
|
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("synthesis_execute()");
|
|
||||||
s32 chunkLen;
|
s32 chunkLen;
|
||||||
u32 *aiBufPtr = (u32 *)aiBuf;
|
u32 *aiBufPtr = (u32 *)aiBuf;
|
||||||
u64 *cmd = cmdBuf + 1;
|
u64 *cmd = cmdBuf + 1;
|
||||||
@@ -583,66 +578,51 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
|||||||
#else
|
#else
|
||||||
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex)
|
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("synthesis_do_one_audio_update()");
|
|
||||||
|
|
||||||
UNUSED s32 pad1[1];
|
UNUSED s32 pad1[1];
|
||||||
UNUSED s32 pad[2];
|
UNUSED s32 pad[2];
|
||||||
UNUSED s32 pad2[1];
|
UNUSED s32 pad2[1];
|
||||||
s16 temp;
|
s16 temp;
|
||||||
|
|
||||||
DEBUG_PRINT("- curFrame: %d", gSynthesisReverb.curFrame);
|
|
||||||
DEBUG_PRINT("- updateIndex: %d", updateIndex);
|
|
||||||
|
|
||||||
struct ReverbRingBufferItem *v1 = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
|
struct ReverbRingBufferItem *v1 = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
|
||||||
DEBUG_PRINT("- v1: %x", v1);
|
|
||||||
|
|
||||||
if (gSynthesisReverb.useReverb == 0)
|
if (gSynthesisReverb.useReverb == 0)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- w/o reverb");
|
|
||||||
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||||
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
|
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- w/ reverb");
|
|
||||||
if (gReverbDownsampleRate == 1)
|
if (gReverbDownsampleRate == 1)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- w/ reverb downsample");
|
|
||||||
|
|
||||||
// Put the oldest samples in the ring buffer into the wet channels
|
// Put the oldest samples in the ring buffer into the wet channels
|
||||||
DEBUG_PRINT("- set load buffer pair 1");
|
|
||||||
DEBUG_PRINT("- startPos: %d", v1->startPos);
|
|
||||||
aSetLoadBufferPair(cmd++, 0, v1->startPos);
|
aSetLoadBufferPair(cmd++, 0, v1->startPos);
|
||||||
if (v1->lengthB != 0)
|
if (v1->lengthB != 0)
|
||||||
{
|
{
|
||||||
// Ring buffer wrapped
|
// Ring buffer wrapped
|
||||||
DEBUG_PRINT("- set load buffer pair 2");
|
|
||||||
aSetLoadBufferPair(cmd++, v1->lengthA, 0);
|
aSetLoadBufferPair(cmd++, v1->lengthA, 0);
|
||||||
temp = 0;
|
temp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the reverb sound as initial sound for this audio update
|
// Use the reverb sound as initial sound for this audio update
|
||||||
DEBUG_PRINT("- dmem move");
|
|
||||||
aDMEMMove(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
aDMEMMove(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||||
|
|
||||||
// (Hopefully) lower the volume of the wet channels. New reverb will later be mixed into
|
// (Hopefully) lower the volume of the wet channels. New reverb will later be mixed into
|
||||||
// these channels.
|
// these channels.
|
||||||
DEBUG_PRINT("- set buffer");
|
|
||||||
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
|
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
|
||||||
// 0x8000 here is -100%
|
// 0x8000 here is -100%
|
||||||
DEBUG_PRINT("- mix");
|
|
||||||
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_WET_LEFT_CH,
|
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_WET_LEFT_CH,
|
||||||
/*out*/ DMEM_ADDR_WET_LEFT_CH);
|
/*out*/ DMEM_ADDR_WET_LEFT_CH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- w/o reverb downsample");
|
|
||||||
|
|
||||||
// Same as above but upsample the previously downsampled samples used for reverb first
|
// Same as above but upsample the previously downsampled samples used for reverb first
|
||||||
temp = 0; //! jesus christ
|
temp = 0; //! jesus christ
|
||||||
s16 t4 = (v1->startPos & 7) * 2;
|
s16 t4 = (v1->startPos & 7) * 2;
|
||||||
s16 ra = ALIGN(v1->lengthA + t4, 4);
|
s16 ra = ALIGN(v1->lengthA + t4, 4);
|
||||||
DEBUG_PRINT("- set load buffer pair");
|
|
||||||
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
|
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
|
||||||
if (v1->lengthB != 0)
|
if (v1->lengthB != 0)
|
||||||
{
|
{
|
||||||
@@ -654,19 +634,12 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
|||||||
//! useless assignment.
|
//! useless assignment.
|
||||||
ra = ra + temp;
|
ra = ra + temp;
|
||||||
}
|
}
|
||||||
DEBUG_PRINT("- set buffer 1");
|
|
||||||
aSetBuffer(cmd++, 0, t4 + DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, bufLen << 1);
|
aSetBuffer(cmd++, 0, t4 + DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, bufLen << 1);
|
||||||
DEBUG_PRINT("- resample 1");
|
|
||||||
aResample(cmd++, gSynthesisReverb.resampleFlags, gSynthesisReverb.resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateLeft));
|
aResample(cmd++, gSynthesisReverb.resampleFlags, gSynthesisReverb.resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateLeft));
|
||||||
DEBUG_PRINT("- set buffer 2");
|
|
||||||
aSetBuffer(cmd++, 0, t4 + DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_RIGHT_CH, bufLen << 1);
|
aSetBuffer(cmd++, 0, t4 + DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_RIGHT_CH, bufLen << 1);
|
||||||
DEBUG_PRINT("- resample 2");
|
|
||||||
aResample(cmd++, gSynthesisReverb.resampleFlags, gSynthesisReverb.resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateRight));
|
aResample(cmd++, gSynthesisReverb.resampleFlags, gSynthesisReverb.resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateRight));
|
||||||
DEBUG_PRINT("- set buffer 3");
|
|
||||||
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
|
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
|
||||||
DEBUG_PRINT("- mix");
|
|
||||||
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_LEFT_CH, /*out*/ DMEM_ADDR_LEFT_CH);
|
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_LEFT_CH, /*out*/ DMEM_ADDR_LEFT_CH);
|
||||||
DEBUG_PRINT("- dmem move");
|
|
||||||
aDMEMMove(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
aDMEMMove(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||||
}
|
}
|
||||||
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
|
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
|
||||||
@@ -700,7 +673,6 @@ u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, stru
|
|||||||
#else
|
#else
|
||||||
u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("synthesis_process_notes()");
|
|
||||||
|
|
||||||
s32 noteIndex; // sp174
|
s32 noteIndex; // sp174
|
||||||
struct Note *note; // s7
|
struct Note *note; // s7
|
||||||
@@ -787,29 +759,22 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
|
|
||||||
for (noteIndex = 0; noteIndex < gMaxSimultaneousNotes; noteIndex++)
|
for (noteIndex = 0; noteIndex < gMaxSimultaneousNotes; noteIndex++)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- for note index %d/%d", noteIndex, gMaxSimultaneousNotes);
|
|
||||||
|
|
||||||
DEBUG_PRINT("- getting note");
|
|
||||||
note = &gNotes[noteIndex];
|
note = &gNotes[noteIndex];
|
||||||
|
|
||||||
//! This function requires note->enabled to be volatile, but it breaks other functions like note_enable.
|
//! This function requires note->enabled to be volatile, but it breaks other functions like note_enable.
|
||||||
//! Casting to a struct with just the volatile bitfield works, but there may be a better way to match.
|
//! Casting to a struct with just the volatile bitfield works, but there may be a better way to match.
|
||||||
DEBUG_PRINT("- if note is enabled but not loaded");
|
|
||||||
if (((struct vNote *)note)->enabled && IS_BANK_LOAD_COMPLETE(note->bankId) == FALSE)
|
if (((struct vNote *)note)->enabled && IS_BANK_LOAD_COMPLETE(note->bankId) == FALSE)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- note is enabled but not loaded");
|
|
||||||
gAudioErrorFlags = (note->bankId << 8) + noteIndex + 0x1000000;
|
gAudioErrorFlags = (note->bankId << 8) + noteIndex + 0x1000000;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- if note is enabled");
|
|
||||||
if (((struct vNote *)note)->enabled)
|
if (((struct vNote *)note)->enabled)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("$ note is enabled!");
|
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
DEBUG_PRINT("- if note needs to be init");
|
|
||||||
if (note->needsInit == TRUE)
|
if (note->needsInit == TRUE)
|
||||||
{
|
{
|
||||||
flags = A_INIT;
|
flags = A_INIT;
|
||||||
@@ -817,7 +782,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
note->samplePosFrac = 0;
|
note->samplePosFrac = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- if note frequency is less than 2");
|
|
||||||
if (note->frequency < US_FLOAT(2.0))
|
if (note->frequency < US_FLOAT(2.0))
|
||||||
{
|
{
|
||||||
nParts = 1;
|
nParts = 1;
|
||||||
@@ -842,12 +806,10 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
samplesLenFixedPoint = note->samplePosFrac + resamplingRateFixedPoint * bufLen * 2;
|
samplesLenFixedPoint = note->samplePosFrac + resamplingRateFixedPoint * bufLen * 2;
|
||||||
note->samplePosFrac = samplesLenFixedPoint & 0xFFFF; // 16-bit store, can't reuse
|
note->samplePosFrac = samplesLenFixedPoint & 0xFFFF; // 16-bit store, can't reuse
|
||||||
|
|
||||||
DEBUG_PRINT("- if note sound is null");
|
|
||||||
if (note->sound == NULL)
|
if (note->sound == NULL)
|
||||||
{
|
{
|
||||||
// A wave synthesis note (not ADPCM)
|
// A wave synthesis note (not ADPCM)
|
||||||
|
|
||||||
DEBUG_PRINT("- note is null, do wave synthesis");
|
|
||||||
cmd = load_wave_samples(cmd, note, samplesLenFixedPoint >> 0x10);
|
cmd = load_wave_samples(cmd, note, samplesLenFixedPoint >> 0x10);
|
||||||
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + note->samplePosInt * 2;
|
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + note->samplePosInt * 2;
|
||||||
note->samplePosInt += samplesLenFixedPoint >> 0x10;
|
note->samplePosInt += samplesLenFixedPoint >> 0x10;
|
||||||
@@ -856,7 +818,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ADPCM note
|
// ADPCM note
|
||||||
DEBUG_PRINT("- @ handle adpcm note");
|
|
||||||
|
|
||||||
audioBookSample = note->sound->sample;
|
audioBookSample = note->sound->sample;
|
||||||
|
|
||||||
@@ -866,7 +827,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
resampledTempLen = 0;
|
resampledTempLen = 0;
|
||||||
for (curPart = 0; curPart < nParts; curPart++)
|
for (curPart = 0; curPart < nParts; curPart++)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("- for part %d", curPart);
|
|
||||||
nAdpcmSamplesProcessed = 0; // s8
|
nAdpcmSamplesProcessed = 0; // s8
|
||||||
s5 = 0; // s4
|
s5 = 0; // s4
|
||||||
|
|
||||||
@@ -888,7 +848,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
u32 nEntries; // v1
|
u32 nEntries; // v1
|
||||||
curLoadedBook = audioBookSample->book->book;
|
curLoadedBook = audioBookSample->book->book;
|
||||||
nEntries = audioBookSample->book->order * audioBookSample->book->npredictors;
|
nEntries = audioBookSample->book->order * audioBookSample->book->npredictors;
|
||||||
DEBUG_PRINT("- loading adpcm");
|
|
||||||
aLoadADPCM(cmd++, nEntries * 16, VIRTUAL_TO_PHYSICAL2(curLoadedBook));
|
aLoadADPCM(cmd++, nEntries * 16, VIRTUAL_TO_PHYSICAL2(curLoadedBook));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,7 +911,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
a3 = 0;
|
a3 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- if not note restart");
|
|
||||||
if (note->restart != FALSE)
|
if (note->restart != FALSE)
|
||||||
{
|
{
|
||||||
aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state));
|
aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state));
|
||||||
@@ -1000,7 +958,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
}
|
}
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
DEBUG_PRINT("- if note finished");
|
|
||||||
if (noteFinished)
|
if (noteFinished)
|
||||||
{
|
{
|
||||||
aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5,
|
aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5,
|
||||||
@@ -1011,7 +968,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- if restart");
|
|
||||||
if (restart)
|
if (restart)
|
||||||
{
|
{
|
||||||
note->restart = TRUE;
|
note->restart = TRUE;
|
||||||
@@ -1097,20 +1053,14 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINT("- done handling notes");
|
|
||||||
|
|
||||||
DEBUG_PRINT("- setting buffer 1");
|
|
||||||
t9 = bufLen * 2;
|
t9 = bufLen * 2;
|
||||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, t9);
|
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, t9);
|
||||||
DEBUG_PRINT("- interleaving");
|
|
||||||
aInterleave(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_RIGHT_CH);
|
aInterleave(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_RIGHT_CH);
|
||||||
t9 *= 2;
|
t9 *= 2;
|
||||||
DEBUG_PRINT("- setting buffer 2");
|
|
||||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, t9);
|
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, t9);
|
||||||
DEBUG_PRINT("- saving buffer");
|
|
||||||
aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(aiBuf));
|
aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(aiBuf));
|
||||||
|
|
||||||
DEBUG_PRINT("- returning from process notes");
|
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,31 +72,31 @@ static u32 interact_noop(struct MarioState *m, u32 interactType, struct Object *
|
|||||||
}
|
}
|
||||||
|
|
||||||
void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 padding);
|
void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 padding);
|
||||||
|
|
||||||
void reset_mario_pitch(struct MarioState *m);
|
void reset_mario_pitch(struct MarioState *m);
|
||||||
|
|
||||||
static u32 interact_pole(struct MarioState *m, u32 interactType, struct Object *o)
|
u32 interact_pole(struct MarioState *m, UNUSED u32 interactType, struct Object *o)
|
||||||
{
|
{
|
||||||
|
if (!m || !o) { return FALSE; }
|
||||||
s32 actionId = m->action & ACT_ID_MASK;
|
s32 actionId = m->action & ACT_ID_MASK;
|
||||||
|
|
||||||
if (actionId >= 0x080 && actionId < 0x0A0)
|
if (actionId >= 0x080 && actionId < 0x0A0)
|
||||||
{
|
{
|
||||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
|
||||||
f32 velConv = m->forwardVel; // conserve the velocity.
|
|
||||||
struct Object *marioObj = m->marioObj;
|
|
||||||
u32 lowSpeed;
|
|
||||||
#else
|
|
||||||
u32 lowSpeed = (m->forwardVel <= 10.0f);
|
|
||||||
struct Object *marioObj = m->marioObj;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(m->prevAction & ACT_FLAG_ON_POLE) || m->usedObj != o)
|
if (!(m->prevAction & ACT_FLAG_ON_POLE) || m->usedObj != o)
|
||||||
{
|
{
|
||||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
#ifdef VERSION_SH
|
||||||
lowSpeed = (velConv <= 10.0f);
|
f32 velConv = m->forwardVel; // conserve the velocity.
|
||||||
#endif
|
struct Object *marioObj = m->marioObj; u32 lowSpeed;
|
||||||
|
#else
|
||||||
|
u32 lowSpeed = (m->forwardVel <= 10.0f);
|
||||||
|
struct Object *marioObj = m->marioObj;
|
||||||
|
#endif
|
||||||
|
|
||||||
mario_stop_riding_and_holding(m);
|
mario_stop_riding_and_holding(m);
|
||||||
|
|
||||||
|
#ifdef VERSION_SH
|
||||||
|
lowSpeed = (velConv <= 10.0f);
|
||||||
|
#endif
|
||||||
|
|
||||||
m->interactObj = o;
|
m->interactObj = o;
|
||||||
m->usedObj = o;
|
m->usedObj = o;
|
||||||
m->vel[1] = 0.0f;
|
m->vel[1] = 0.0f;
|
||||||
@@ -111,15 +111,15 @@ static u32 interact_pole(struct MarioState *m, u32 interactType, struct Object *
|
|||||||
return set_mario_action(m, ACT_GRAB_POLE_SLOW, 0);
|
return set_mario_action(m, ACT_GRAB_POLE_SLOW, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(VERSION_SH) || defined(VERSION_CN)
|
//! @bug Using m->forwardVel here is assumed to be 0.0f due to the set from earlier.
|
||||||
|
// This is fixed in the Shindou version.
|
||||||
|
#ifdef VERSION_SH
|
||||||
marioObj->oMarioPoleYawVel = (s32)(velConv * 0x100 + 0x1000);
|
marioObj->oMarioPoleYawVel = (s32)(velConv * 0x100 + 0x1000);
|
||||||
#else
|
#else
|
||||||
marioObj->oMarioPoleYawVel = (s32)(m->forwardVel * 0x100 + 0x1000);
|
marioObj->oMarioPoleYawVel = (s32)(m->forwardVel * 0x100 + 0x1000);
|
||||||
#endif
|
#endif
|
||||||
reset_mario_pitch(m);
|
reset_mario_pitch(m);
|
||||||
#if ENABLE_RUMBLE
|
|
||||||
queue_rumble_data(5, 80);
|
queue_rumble_data(5, 80);
|
||||||
#endif
|
|
||||||
return set_mario_action(m, ACT_GRAB_POLE_FAST, 0);
|
return set_mario_action(m, ACT_GRAB_POLE_FAST, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,51 +127,11 @@ static u32 interact_pole(struct MarioState *m, u32 interactType, struct Object *
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct InteractionHandler sInteractionHandlers[] = {
|
static struct InteractionHandler sInteractionHandlers[] = {{INTERACT_COIN, interact_noop}, {INTERACT_WATER_RING, interact_noop}, {INTERACT_STAR_OR_KEY, interact_noop}, {INTERACT_BBH_ENTRANCE, interact_noop}, {INTERACT_WARP, interact_noop}, {INTERACT_WARP_DOOR, interact_noop}, {INTERACT_DOOR, interact_noop}, {INTERACT_CANNON_BASE, interact_noop}, {INTERACT_IGLOO_BARRIER, interact_noop}, {INTERACT_TORNADO, interact_noop}, {INTERACT_WHIRLPOOL, interact_noop}, {INTERACT_STRONG_WIND, interact_noop}, {INTERACT_FLAME, interact_noop}, {INTERACT_SNUFIT_BULLET, interact_noop}, {INTERACT_CLAM_OR_BUBBA, interact_noop}, {INTERACT_BULLY, interact_noop}, {INTERACT_SHOCK, interact_noop}, {INTERACT_BOUNCE_TOP2, interact_noop}, {INTERACT_MR_BLIZZARD, interact_noop}, {INTERACT_HIT_FROM_BELOW, interact_noop}, {INTERACT_BOUNCE_TOP, interact_noop}, {INTERACT_DAMAGE, interact_noop}, {INTERACT_POLE, interact_pole}, {INTERACT_HOOT, interact_noop}, {INTERACT_BREAKABLE, interact_noop}, {INTERACT_KOOPA, interact_noop}, {INTERACT_KOOPA_SHELL, interact_noop}, {INTERACT_UNKNOWN_08, interact_noop}, {INTERACT_CAP, interact_noop}, {INTERACT_GRABBABLE, interact_noop}, {INTERACT_TEXT, interact_noop},};
|
||||||
{INTERACT_COIN, interact_noop},
|
|
||||||
{INTERACT_WATER_RING, interact_noop},
|
|
||||||
{INTERACT_STAR_OR_KEY, interact_noop},
|
|
||||||
{INTERACT_BBH_ENTRANCE, interact_noop},
|
|
||||||
{INTERACT_WARP, interact_noop},
|
|
||||||
{INTERACT_WARP_DOOR, interact_noop},
|
|
||||||
{INTERACT_DOOR, interact_noop},
|
|
||||||
{INTERACT_CANNON_BASE, interact_noop},
|
|
||||||
{INTERACT_IGLOO_BARRIER, interact_noop},
|
|
||||||
{INTERACT_TORNADO, interact_noop},
|
|
||||||
{INTERACT_WHIRLPOOL, interact_noop},
|
|
||||||
{INTERACT_STRONG_WIND, interact_noop},
|
|
||||||
{INTERACT_FLAME, interact_noop},
|
|
||||||
{INTERACT_SNUFIT_BULLET, interact_noop},
|
|
||||||
{INTERACT_CLAM_OR_BUBBA, interact_noop},
|
|
||||||
{INTERACT_BULLY, interact_noop},
|
|
||||||
{INTERACT_SHOCK, interact_noop},
|
|
||||||
{INTERACT_BOUNCE_TOP2, interact_noop},
|
|
||||||
{INTERACT_MR_BLIZZARD, interact_noop},
|
|
||||||
{INTERACT_HIT_FROM_BELOW, interact_noop},
|
|
||||||
{INTERACT_BOUNCE_TOP, interact_noop},
|
|
||||||
{INTERACT_DAMAGE, interact_noop},
|
|
||||||
{INTERACT_POLE, interact_pole},
|
|
||||||
{INTERACT_HOOT, interact_noop},
|
|
||||||
{INTERACT_BREAKABLE, interact_noop},
|
|
||||||
{INTERACT_KOOPA, interact_noop},
|
|
||||||
{INTERACT_KOOPA_SHELL, interact_noop},
|
|
||||||
{INTERACT_UNKNOWN_08, interact_noop},
|
|
||||||
{INTERACT_CAP, interact_noop},
|
|
||||||
{INTERACT_GRABBABLE, interact_noop},
|
|
||||||
{INTERACT_TEXT, interact_noop},
|
|
||||||
};
|
|
||||||
|
|
||||||
static u32 sForwardKnockbackActions[][3] = {
|
static u32 sForwardKnockbackActions[][3] = {{ACT_SOFT_FORWARD_GROUND_KB, ACT_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB}, {ACT_FORWARD_AIR_KB, ACT_FORWARD_AIR_KB, ACT_HARD_FORWARD_AIR_KB}, {ACT_FORWARD_WATER_KB, ACT_FORWARD_WATER_KB, ACT_FORWARD_WATER_KB},};
|
||||||
{ACT_SOFT_FORWARD_GROUND_KB, ACT_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB},
|
|
||||||
{ACT_FORWARD_AIR_KB, ACT_FORWARD_AIR_KB, ACT_HARD_FORWARD_AIR_KB},
|
|
||||||
{ACT_FORWARD_WATER_KB, ACT_FORWARD_WATER_KB, ACT_FORWARD_WATER_KB},
|
|
||||||
};
|
|
||||||
|
|
||||||
static u32 sBackwardKnockbackActions[][3] = {
|
static u32 sBackwardKnockbackActions[][3] = {{ACT_SOFT_BACKWARD_GROUND_KB, ACT_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB}, {ACT_BACKWARD_AIR_KB, ACT_BACKWARD_AIR_KB, ACT_HARD_BACKWARD_AIR_KB}, {ACT_BACKWARD_WATER_KB, ACT_BACKWARD_WATER_KB, ACT_BACKWARD_WATER_KB},};
|
||||||
{ACT_SOFT_BACKWARD_GROUND_KB, ACT_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB},
|
|
||||||
{ACT_BACKWARD_AIR_KB, ACT_BACKWARD_AIR_KB, ACT_HARD_BACKWARD_AIR_KB},
|
|
||||||
{ACT_BACKWARD_WATER_KB, ACT_BACKWARD_WATER_KB, ACT_BACKWARD_WATER_KB},
|
|
||||||
};
|
|
||||||
|
|
||||||
static u8 sDisplayingDoorText = FALSE;
|
static u8 sDisplayingDoorText = FALSE;
|
||||||
static u8 sJustTeleported = FALSE;
|
static u8 sJustTeleported = FALSE;
|
||||||
@@ -540,8 +500,7 @@ u32 mario_check_object_grab(struct MarioState *m)
|
|||||||
|
|
||||||
if (!(m->action & ACT_FLAG_AIR))
|
if (!(m->action & ACT_FLAG_AIR))
|
||||||
{
|
{
|
||||||
set_mario_action(
|
set_mario_action(m, m->action & ACT_FLAG_DIVING ? ACT_DIVE_PICKING_UP : ACT_PICKING_UP, 0);
|
||||||
m, m->action & ACT_FLAG_DIVING ? ACT_DIVE_PICKING_UP : ACT_PICKING_UP, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
@@ -566,11 +525,9 @@ u32 bully_knock_back_mario(struct MarioState *mario)
|
|||||||
f32 bullyToMarioRatio = bully->hitboxRadius * 3 / 53;
|
f32 bullyToMarioRatio = bully->hitboxRadius * 3 / 53;
|
||||||
f32 marioToBullyRatio = 53.0f / bully->hitboxRadius;
|
f32 marioToBullyRatio = 53.0f / bully->hitboxRadius;
|
||||||
|
|
||||||
init_bully_collision_data(&marioData, mario->pos[0], mario->pos[2], mario->forwardVel,
|
init_bully_collision_data(&marioData, mario->pos[0], mario->pos[2], mario->forwardVel, mario->faceAngle[1], bullyToMarioRatio, 52.0f);
|
||||||
mario->faceAngle[1], bullyToMarioRatio, 52.0f);
|
|
||||||
|
|
||||||
init_bully_collision_data(&bullyData, bully->oPosX, bully->oPosZ, bully->oForwardVel,
|
init_bully_collision_data(&bullyData, bully->oPosX, bully->oPosZ, bully->oForwardVel, bully->oMoveAngleYaw, marioToBullyRatio, bully->hitboxRadius + 2.0f);
|
||||||
bully->oMoveAngleYaw, marioToBullyRatio, bully->hitboxRadius + 2.0f);
|
|
||||||
|
|
||||||
if (mario->forwardVel != 0.0f)
|
if (mario->forwardVel != 0.0f)
|
||||||
{
|
{
|
||||||
@@ -864,8 +821,7 @@ u32 take_damage_from_interact_object(struct MarioState *m)
|
|||||||
|
|
||||||
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o)
|
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o)
|
||||||
{
|
{
|
||||||
if (!sInvulnerable && !(m->flags & MARIO_VANISH_CAP)
|
if (!sInvulnerable && !(m->flags & MARIO_VANISH_CAP) && !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY))
|
||||||
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY))
|
|
||||||
{
|
{
|
||||||
o->oInteractStatus = INT_STATUS_INTERACTED | INT_STATUS_ATTACKED_MARIO;
|
o->oInteractStatus = INT_STATUS_INTERACTED | INT_STATUS_ATTACKED_MARIO;
|
||||||
m->interactObj = o;
|
m->interactObj = o;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#include "../include/object_fields.h"
|
#include "../include/object_fields.h"
|
||||||
#include "../include/mario_geo_switch_case_ids.h"
|
#include "../include/mario_geo_switch_case_ids.h"
|
||||||
#include "../../rumble.h"
|
#include "../../rumble.h"
|
||||||
|
#include "../../FakeObject.h"
|
||||||
|
#include "../../libsm64.h"
|
||||||
|
|
||||||
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
|
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
|
||||||
|
|
||||||
@@ -35,16 +37,21 @@ static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
|
|||||||
void add_tree_leaf_particles(struct MarioState *m)
|
void add_tree_leaf_particles(struct MarioState *m)
|
||||||
{
|
{
|
||||||
f32 leafHeight;
|
f32 leafHeight;
|
||||||
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
s32 isOnTree = false; //(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||||
|
|
||||||
if (isOnTree) {
|
if (isOnTree)
|
||||||
|
{
|
||||||
// make leaf effect spawn higher on the Shifting Sand Land palm tree
|
// make leaf effect spawn higher on the Shifting Sand Land palm tree
|
||||||
if (gCurrLevelNum == LEVEL_SSL) {
|
if (gCurrLevelNum == LEVEL_SSL)
|
||||||
|
{
|
||||||
leafHeight = 250.0f;
|
leafHeight = 250.0f;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
leafHeight = 100.0f;
|
leafHeight = 100.0f;
|
||||||
}
|
}
|
||||||
if (m->pos[1] - m->floorHeight > leafHeight) {
|
if (m->pos[1] - m->floorHeight > leafHeight)
|
||||||
|
{
|
||||||
m->particleFlags |= PARTICLE_LEAF;
|
m->particleFlags |= PARTICLE_LEAF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,16 +59,18 @@ void add_tree_leaf_particles(struct MarioState *m)
|
|||||||
|
|
||||||
void play_climbing_sounds(struct MarioState *m, s32 b)
|
void play_climbing_sounds(struct MarioState *m, s32 b)
|
||||||
{
|
{
|
||||||
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
s32 isOnTree = false; //(m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||||
|
|
||||||
if (b == 1) {
|
if (b == 1)
|
||||||
if (is_anim_past_frame(m, 1)) {
|
{
|
||||||
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
|
if (is_anim_past_frame(m, 1))
|
||||||
m->marioObj->header.gfx.cameraToObject);
|
{
|
||||||
|
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE, m->marioObj->header.gfx.cameraToObject);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
|
else
|
||||||
m->marioObj->header.gfx.cameraToObject);
|
{
|
||||||
|
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE, m->marioObj->header.gfx.cameraToObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +81,15 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
|||||||
return POLE_NONE;
|
return POLE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is here so if somehow a pole despawns while you are on it.
|
||||||
|
// You will just drop from it.
|
||||||
|
if (m->usedObj == NULL)
|
||||||
|
{
|
||||||
|
// If Mario is no longer interacting with the pole, stop the pole holding action.
|
||||||
|
set_mario_action(m, ACT_FREEFALL, 0);
|
||||||
|
return POLE_FELL_OFF;
|
||||||
|
}
|
||||||
|
|
||||||
UNUSED s32 unused1;
|
UNUSED s32 unused1;
|
||||||
UNUSED s32 unused2;
|
UNUSED s32 unused2;
|
||||||
UNUSED s32 unused3;
|
UNUSED s32 unused3;
|
||||||
@@ -155,9 +173,7 @@ s32 act_holding_pole(struct MarioState *m)
|
|||||||
add_tree_leaf_particles(m);
|
add_tree_leaf_particles(m);
|
||||||
m->faceAngle[1] += 0x8000;
|
m->faceAngle[1] += 0x8000;
|
||||||
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
|
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
|
||||||
}
|
} if (m->input & INPUT_Z_PRESSED)
|
||||||
|
|
||||||
if (m->input & INPUT_Z_PRESSED)
|
|
||||||
{
|
{
|
||||||
add_tree_leaf_particles(m);
|
add_tree_leaf_particles(m);
|
||||||
m->forwardVel = -2.0f;
|
m->forwardVel = -2.0f;
|
||||||
@@ -356,8 +372,7 @@ s32 act_top_of_pole_transition(struct MarioState *m)
|
|||||||
|
|
||||||
s32 act_top_of_pole(struct MarioState *m)
|
s32 act_top_of_pole(struct MarioState *m)
|
||||||
{
|
{
|
||||||
UNUSED
|
UNUSED struct Object *marioObj = m->marioObj;
|
||||||
struct Object *marioObj = m->marioObj;
|
|
||||||
f32 poleStickY = -m->controller->stickY;
|
f32 poleStickY = -m->controller->stickY;
|
||||||
|
|
||||||
if (m->input & INPUT_A_PRESSED)
|
if (m->input & INPUT_A_PRESSED)
|
||||||
@@ -435,8 +450,7 @@ s32 update_hang_moving(struct MarioState *m)
|
|||||||
m->forwardVel = maxSpeed;
|
m->forwardVel = maxSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->faceAngle[1] =
|
m->faceAngle[1] = m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
|
||||||
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
|
|
||||||
|
|
||||||
m->slideYaw = m->faceAngle[1];
|
m->slideYaw = m->faceAngle[1];
|
||||||
m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
|
m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
|
||||||
@@ -739,9 +753,7 @@ s32 act_ledge_climb_slow(struct MarioState *m)
|
|||||||
|
|
||||||
m->actionTimer++;
|
m->actionTimer++;
|
||||||
|
|
||||||
if (m->actionTimer >= 28
|
if (m->actionTimer >= 28 && m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))
|
||||||
&& m->input
|
|
||||||
& (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))
|
|
||||||
{
|
{
|
||||||
climb_up_ledge(m);
|
climb_up_ledge(m);
|
||||||
return check_common_action_exits(m);
|
return check_common_action_exits(m);
|
||||||
@@ -810,8 +822,7 @@ s32 act_grabbed(struct MarioState *m)
|
|||||||
queue_rumble_data(5, 60);
|
queue_rumble_data(5, 60);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
return set_mario_action(m, m->forwardVel >= 0.0f ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD,
|
return set_mario_action(m, m->forwardVel >= 0.0f ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD, thrown);
|
||||||
thrown);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mario_animation(m, MARIO_ANIM_BEING_GRABBED);
|
set_mario_animation(m, MARIO_ANIM_BEING_GRABBED);
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../obj_pool.h"
|
|
||||||
|
|
||||||
struct GlobalState *g_state = 0;
|
struct GlobalState *g_state = 0;
|
||||||
|
|
||||||
struct GlobalState *global_state_create(void)
|
struct GlobalState *global_state_create(void)
|
||||||
@@ -23,6 +21,5 @@ void global_state_bind(struct GlobalState *state)
|
|||||||
|
|
||||||
void global_state_delete(struct GlobalState *state)
|
void global_state_delete(struct GlobalState *state)
|
||||||
{
|
{
|
||||||
obj_pool_free_all(&state->mgFakeObjects);
|
|
||||||
free(state);
|
free(state);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,6 @@ struct GlobalState
|
|||||||
struct Area *mgCurrentArea;
|
struct Area *mgCurrentArea;
|
||||||
struct Object *mgCurrentObject;
|
struct Object *mgCurrentObject;
|
||||||
struct Object *mgMarioObject;
|
struct Object *mgMarioObject;
|
||||||
struct ObjPool mgFakeObjects;
|
|
||||||
struct MarioAnimation mD_80339D10;
|
struct MarioAnimation mD_80339D10;
|
||||||
struct MarioState mgMarioStateVal;
|
struct MarioState mgMarioStateVal;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -460,13 +460,9 @@ typedef short ENVMIX_STATE[40];
|
|||||||
*/
|
*/
|
||||||
#define aLoadBuffer(pkt, s) \
|
#define aLoadBuffer(pkt, s) \
|
||||||
{ \
|
{ \
|
||||||
DEBUG_PRINT("aLoadBuffer()"); \
|
|
||||||
DEBUG_PRINT("- getting pkt"); \
|
|
||||||
Acmd *_a = (Acmd *)pkt; \
|
Acmd *_a = (Acmd *)pkt; \
|
||||||
\
|
\
|
||||||
DEBUG_PRINT("- setting first word"); \
|
|
||||||
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
|
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
|
||||||
DEBUG_PRINT("- setting second word"); \
|
|
||||||
_a->words.w1 = (uintptr_t)(s); \
|
_a->words.w1 = (uintptr_t)(s); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,8 +578,6 @@ typedef short ENVMIX_STATE[40];
|
|||||||
*/
|
*/
|
||||||
#define aSetBuffer(pkt, f, i, o, c) \
|
#define aSetBuffer(pkt, f, i, o, c) \
|
||||||
{ \
|
{ \
|
||||||
DEBUG_PRINT("aSetBuffer()"); \
|
|
||||||
DEBUG_PRINT("- getting pkt"); \
|
|
||||||
Acmd *_a = (Acmd *)pkt; \
|
Acmd *_a = (Acmd *)pkt; \
|
||||||
\
|
\
|
||||||
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
|
||||||
|
|||||||
@@ -162,8 +162,6 @@ void aSaveBufferImpl(uint16_t source_addr, int16_t *dest_addr, uint16_t nbytes)
|
|||||||
#else
|
#else
|
||||||
void aLoadBufferImpl(const void *source_addr)
|
void aLoadBufferImpl(const void *source_addr)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("aLoadBufferImpl()");
|
|
||||||
DEBUG_PRINT("- source_addr: %x", source_addr);
|
|
||||||
memcpy(BUF_U8(rspa.in), source_addr, ROUND_UP_8(rspa.nbytes));
|
memcpy(BUF_U8(rspa.in), source_addr, ROUND_UP_8(rspa.nbytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -68,7 +68,19 @@ static void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { return 0; }
|
static s16 level_trigger_warp(struct MarioState *m, s32 warpOp)
|
||||||
|
{
|
||||||
|
if (warpOp == WARP_OP_DEATH && m->health > 0xFF)
|
||||||
|
{
|
||||||
|
m->health = 0xFF;
|
||||||
|
}
|
||||||
|
if (warpOp == WARP_OP_WARP_FLOOR && m->health > 0xFF)
|
||||||
|
{
|
||||||
|
m->health = 0xFF;
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
//static void play_cap_music(u16 seqArgs) {}
|
//static void play_cap_music(u16 seqArgs) {}
|
||||||
//static void fadeout_cap_music(void) {}
|
//static void fadeout_cap_music(void) {}
|
||||||
//static void stop_cap_music(void) {}
|
//static void stop_cap_music(void) {}
|
||||||
|
|||||||
+44
-16
@@ -1,3 +1,4 @@
|
|||||||
|
#include "decomp/game/interaction.h"
|
||||||
#ifndef SM64_LIB_EXPORT
|
#ifndef SM64_LIB_EXPORT
|
||||||
#define SM64_LIB_EXPORT
|
#define SM64_LIB_EXPORT
|
||||||
#endif
|
#endif
|
||||||
@@ -55,6 +56,49 @@ struct MarioInstance
|
|||||||
struct ObjPool s_mario_instance_pool = {0, 0};
|
struct ObjPool s_mario_instance_pool = {0, 0};
|
||||||
struct ObjPool s_fakeobj_instance_pool = {0, 0};
|
struct ObjPool s_fakeobj_instance_pool = {0, 0};
|
||||||
|
|
||||||
|
f32 dist_between_objects(struct Object *obj1, struct Object *obj2)
|
||||||
|
{
|
||||||
|
if (obj1 == NULL || obj2 == NULL) { return 0; }
|
||||||
|
f32 dx = obj1->oPosX - obj2->oPosX;
|
||||||
|
f32 dy = obj1->oPosY - obj2->oPosY;
|
||||||
|
f32 dz = obj1->oPosZ - obj2->oPosZ;
|
||||||
|
|
||||||
|
return sqrtf(dx * dx + dy * dy + dz * dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Object *get_closest_pole_object()
|
||||||
|
{
|
||||||
|
struct Object *closestObj = NULL;
|
||||||
|
f32 minDist = 0x20000;
|
||||||
|
|
||||||
|
for (int i = 0; i < s_fakeobj_instance_pool.size; i++)
|
||||||
|
{
|
||||||
|
struct Object *obj = &((struct FakeObject *)s_fakeobj_instance_pool.objects[i])->object;
|
||||||
|
if (obj == NULL || obj->activeFlags == ACTIVE_FLAG_DEACTIVATED || !(obj->oInteractType & INTERACT_POLE) || obj == gMarioObject) continue;
|
||||||
|
|
||||||
|
DEBUG_PRINT(
|
||||||
|
"POOL: %d ptr=%p interact=%X active=%X pos=(%f,%f,%f)",
|
||||||
|
i,
|
||||||
|
obj,
|
||||||
|
obj->oInteractType,
|
||||||
|
obj->activeFlags,
|
||||||
|
obj->oPosX,
|
||||||
|
obj->oPosY,
|
||||||
|
obj->oPosZ
|
||||||
|
);
|
||||||
|
|
||||||
|
f32 objDist = dist_between_objects(gMarioObject, obj);
|
||||||
|
if (objDist < minDist)
|
||||||
|
{
|
||||||
|
closestObj = obj;
|
||||||
|
DEBUG_PRINT("Found pole object with ID %d at distance %f", i, objDist);
|
||||||
|
minDist = objDist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return closestObj;
|
||||||
|
}
|
||||||
|
|
||||||
static void update_button(bool on, u16 button)
|
static void update_button(bool on, u16 button)
|
||||||
{
|
{
|
||||||
gController.buttonPressed &= ~button;
|
gController.buttonPressed &= ~button;
|
||||||
@@ -655,28 +699,12 @@ SM64_LIB_FN void sm64_fake_object_delete(int32_t objectId)
|
|||||||
struct FakeObject *fake = s_fakeobj_instance_pool.objects[objectId];
|
struct FakeObject *fake = s_fakeobj_instance_pool.objects[objectId];
|
||||||
|
|
||||||
struct MarioState *m = &g_state->mgMarioStateVal;
|
struct MarioState *m = &g_state->mgMarioStateVal;
|
||||||
uint32_t action = m->action;
|
|
||||||
|
|
||||||
if (m->interactObj == &fake->object || m->usedObj == &fake->object || m->heldObj == &fake->object)
|
if (m->interactObj == &fake->object || m->usedObj == &fake->object || m->heldObj == &fake->object)
|
||||||
{
|
{
|
||||||
m->interactObj = NULL;
|
m->interactObj = NULL;
|
||||||
m->usedObj = NULL;
|
m->usedObj = NULL;
|
||||||
m->heldObj = NULL;
|
m->heldObj = NULL;
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case ACT_HOLDING_POLE:
|
|
||||||
case ACT_CLIMBING_POLE:
|
|
||||||
case ACT_TOP_OF_POLE:
|
|
||||||
m->action = ACT_FREEFALL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
m->action = ACT_IDLE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m->actionState = 0;
|
|
||||||
}
|
}
|
||||||
if (m->marioBodyState != NULL && m->heldObj == NULL)
|
if (m->marioBodyState != NULL && m->heldObj == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "obj_pool.h"
|
||||||
|
#include "decomp/include/types.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#ifdef SM64_LIB_EXPORT
|
#ifdef SM64_LIB_EXPORT
|
||||||
#define SM64_LIB_FN __declspec(dllexport)
|
#define SM64_LIB_FN __declspec(dllexport)
|
||||||
@@ -154,6 +157,10 @@ enum
|
|||||||
SM64_GEO_MAX_TRIANGLES = 1024,
|
SM64_GEO_MAX_TRIANGLES = 1024,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern f32 dist_between_objects(struct Object *obj1, struct Object *obj2);
|
||||||
|
|
||||||
|
extern struct Object *get_closest_pole_object();
|
||||||
|
|
||||||
typedef void (*SM64RumbleCallbackFunctionPtr)(int32_t marioId, int16_t level, int16_t time);
|
typedef void (*SM64RumbleCallbackFunctionPtr)(int32_t marioId, int16_t level, int16_t time);
|
||||||
|
|
||||||
extern SM64_LIB_FN void sm64_register_rumble_callback_function(SM64RumbleCallbackFunctionPtr rumbleCallbackFunction);
|
extern SM64_LIB_FN void sm64_register_rumble_callback_function(SM64RumbleCallbackFunctionPtr rumbleCallbackFunction);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ extern void play_sound(uint32_t soundBits, f32 *pos)
|
|||||||
{
|
{
|
||||||
if (g_is_audio_initialized)
|
if (g_is_audio_initialized)
|
||||||
{
|
{
|
||||||
DEBUG_PRINT("$ play_sound(%d) request %d; pos %f %f %f\n", soundBits, sSoundRequestCount, pos[0], pos[1], pos[2]);
|
|
||||||
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
|
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
|
||||||
sSoundRequests[sSoundRequestCount].position = pos;
|
sSoundRequests[sSoundRequestCount].position = pos;
|
||||||
sSoundRequestCount++;
|
sSoundRequestCount++;
|
||||||
|
|||||||
Reference in New Issue
Block a user