Move service implementation functions to separate header

This commit is contained in:
Pieter-Jan Briers
2026-08-30 23:51:53 +02:00
parent 51472856eb
commit cda0e50e0c
6 changed files with 75 additions and 70 deletions
@@ -4,8 +4,6 @@
#include "mods/svc/audio_res.h"
#include "../registry.hpp"
#include "wsys.hpp"
#include "bst.hpp"
namespace dusk::mods::svc {
+72 -1
View File
@@ -1,9 +1,80 @@
#pragma once
#include "mods/svc/audio_res.h"
namespace dusk::mods {
struct LoadedMod;
}
namespace dusk::mods::svc::audio_res {
namespace wsys {
void frame_end();
void remove_mod(LoadedMod& mod);
void sync_audio_replacements();
extern AudioWaveInfo const default_wave_info;
ModResult insert_replace_wave(
ModContext* ctx,
AudioWaveBank bank,
u16 wave_id,
char const* file_name,
AudioWaveInfo const* wave_info,
AudioWaveHandle* out_handle);
ModResult insert_add_wave(
ModContext* ctx,
AudioWaveBank bank,
char const* file_name,
AudioWaveInfo const* wave_info,
AudioWaveHandle* out_handle,
u16* out_wave_id);
ModResult remove_wave(ModContext* ctx, AudioWaveHandle handle);
}
namespace bst {
void frame_end();
void remove_mod(LoadedMod const& mod);
void sync_audio_replacements();
extern AudioSoundTableEffectInfo const default_effect_info;
ModResult replace_sound_table_effect(
ModContext* ctx,
SoundEffectCategory category_id,
uint16_t effect_id,
AudioSoundTableEffectInfo const* info,
AudioSoundTableHandle* out_handle);
ModResult add_sound_table_effect(
ModContext* ctx,
SoundEffectCategory category_id,
AudioSoundTableEffectInfo const* info,
AudioSoundTableHandle* out_handle,
uint16_t* out_effect_id);
extern AudioSoundTableStreamInfo const default_stream_info;
ModResult replace_sound_table_stream(
ModContext* ctx,
uint16_t stream_id,
char const* file_path,
AudioSoundTableStreamInfo const* info,
AudioSoundTableHandle* out_handle);
ModResult add_sound_table_stream(
ModContext* ctx,
char const* file_path,
AudioSoundTableStreamInfo const* info,
AudioSoundTableHandle* out_handle,
uint16_t* out_stream_id);
ModResult remove_sound_table(ModContext* ctx, AudioSoundTableHandle handle);
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
#include "bst.hpp"
#include "audio_res.hpp"
#include "aurora/lib/logging.hpp"
#include "dusk/mods/loader/loader.hpp"
#include "dusk/mods/svc/id_allocator.hpp"
@@ -173,7 +174,7 @@ void remove_mod(LoadedMod const& mod) {
void frame_end() {
if (sound_replacements_dirty) {
sync_audio_replacements();
wsys::sync_audio_replacements();
}
}
-42
View File
@@ -6,10 +6,6 @@
#include "JSystem/JAudio2/JAUSoundTable.h"
#include "mods/svc/audio_res.h"
namespace dusk::mods {
struct LoadedMod;
}
namespace dusk::mods::svc::audio_res::bst {
struct SoundTableReplacementSlot {
@@ -64,42 +60,4 @@ std::shared_ptr<SoundTableReplacementSlot> get_override_for(JAISoundID id);
std::shared_ptr<SoundEffectReplacementSlot> get_override_for_se(JAISoundID id);
std::shared_ptr<StreamReplacementSlot> get_override_for_stream(JAISoundID id);
void frame_end();
void remove_mod(LoadedMod const& mod);
void sync_audio_replacements();
extern AudioSoundTableEffectInfo const default_effect_info;
ModResult replace_sound_table_effect(
ModContext* ctx,
SoundEffectCategory category_id,
uint16_t effect_id,
AudioSoundTableEffectInfo const* info,
AudioSoundTableHandle* out_handle);
ModResult add_sound_table_effect(
ModContext* ctx,
SoundEffectCategory category_id,
AudioSoundTableEffectInfo const* info,
AudioSoundTableHandle* out_handle,
uint16_t* out_effect_id);
extern AudioSoundTableStreamInfo const default_stream_info;
ModResult replace_sound_table_stream(
ModContext* ctx,
uint16_t stream_id,
char const* file_path,
AudioSoundTableStreamInfo const* info,
AudioSoundTableHandle* out_handle);
ModResult add_sound_table_stream(
ModContext* ctx,
char const* file_path,
AudioSoundTableStreamInfo const* info,
AudioSoundTableHandle* out_handle,
uint16_t* out_stream_id);
ModResult remove_sound_table(ModContext* ctx, AudioSoundTableHandle handle);
}
+1
View File
@@ -1,3 +1,4 @@
#include "audio_res.hpp"
#include "wsys.hpp"
#include "../slot_map.hpp"
#include "../id_allocator.hpp"
-24
View File
@@ -104,28 +104,4 @@ using ContainerLoadFunction = ModResult (*)(LoadedMod const& mod, RuntimeWaveRep
ModResult load_wav(LoadedMod const& mod, RuntimeWaveReplacementSlot& slot, std::span<u8 const> fileData);
ModResult load_opus(LoadedMod const& mod, RuntimeWaveReplacementSlot& slot, std::span<u8 const> fileData);
void frame_end();
void remove_mod(LoadedMod& mod);
void sync_audio_replacements();
extern AudioWaveInfo const default_wave_info;
ModResult insert_replace_wave(
ModContext* ctx,
AudioWaveBank bank,
u16 wave_id,
char const* file_name,
AudioWaveInfo const* wave_info,
AudioWaveHandle* out_handle);
ModResult insert_add_wave(
ModContext* ctx,
AudioWaveBank bank,
char const* file_name,
AudioWaveInfo const* wave_info,
AudioWaveHandle* out_handle,
u16* out_wave_id);
ModResult remove_wave(ModContext* ctx, AudioWaveHandle handle);
}