Exposed registering a handler for playing sounds.

This commit is contained in:
MeltyPlayer
2022-10-19 23:46:13 -05:00
parent babdc896b5
commit a179746889
5 changed files with 33 additions and 1 deletions
+1 -1
View File
@@ -4,6 +4,7 @@
#include "game/area.h"
#include "game/level_update.h"
#include "../libsm64.h"
#include "../play_sound.h"
#include "global_state.h"
#define COURSE_MIN 0
@@ -36,7 +37,6 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static void play_sound(s32 soundBits, f32 *pos) {}
static void enable_time_stop() {}
static void disable_time_stop() {}
static void *segmented_to_virtual(const void *addr) { return (void*)addr; }
+7
View File
@@ -85,6 +85,13 @@ SM64_LIB_FN void sm64_register_debug_print_function( SM64DebugPrintFunctionPtr d
g_debug_print_func = debugPrintFunction;
}
typedef void (*SM64PlaySoundFunctionPtr)( uint32_t soundBits, f32 *pos );
SM64_LIB_FN void sm64_register_play_sound_function( SM64PlaySoundFunctionPtr playSoundFunction )
{
g_play_sound_func = playSoundFunction;
}
SM64_LIB_FN void sm64_global_init( uint8_t *rom, uint8_t *outTexture )
{
if( s_init_global )
+7
View File
@@ -5,6 +5,8 @@
#include <stdint.h>
#include <stdbool.h>
#include "decomp/include/types.h"
#ifdef _WIN32
#ifdef SM64_LIB_EXPORT
#define SM64_LIB_FN __declspec(dllexport)
@@ -67,9 +69,14 @@ enum
SM64_GEO_MAX_TRIANGLES = 1024,
};
typedef void (*SM64DebugPrintFunctionPtr)( const char * );
extern SM64_LIB_FN void sm64_register_debug_print_function( SM64DebugPrintFunctionPtr debugPrintFunction );
typedef void (*SM64PlaySoundFunctionPtr)( uint32_t soundBits, f32 *pos );
extern SM64_LIB_FN void sm64_register_play_sound_function( SM64PlaySoundFunctionPtr playSoundFunction );
extern SM64_LIB_FN void sm64_global_init( uint8_t *rom, uint8_t *outTexture );
extern SM64_LIB_FN void sm64_global_terminate( void );
+9
View File
@@ -0,0 +1,9 @@
#include "play_sound.h"
SM64PlaySoundFunctionPtr g_play_sound_func = NULL;
extern void play_sound( uint32_t soundBits, f32 *pos ) {
if ( g_play_sound_func ) {
g_play_sound_func(soundBits, pos);
}
}
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include "decomp/include/types.h"
#include "libsm64.h"
#include <stdio.h>
extern SM64PlaySoundFunctionPtr g_play_sound_func;
extern void play_sound( uint32_t soundBits, f32 *pos );