Merge pull request #135 from TakaRikka/pjb-audio

Audio
This commit is contained in:
TakaRikka
2026-03-27 20:36:06 -07:00
committed by GitHub
111 changed files with 2651 additions and 966 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ public:
virtual ~Z2HioSeSeqDataMgr() {}
virtual SeqDataReturnValue getSeqData(JAISoundID param_1, JAISeqData* param_2) {
if (field_0x18->getSeqList()->getSeqData(param_1, param_2)) {
param_2->field_0x4 = 4;
param_2->mOffset = 4;
return SeqDataReturnValue_2;
} else {
return JAUSeqDataMgr_SeqCollection::getSeqData(param_1, param_2);
+1 -1
View File
@@ -22,7 +22,7 @@ public:
bool isActive() const;
Z2SoundHandlePool* getHandleSoundID(JAISoundID soundID);
Z2SoundHandlePool* getHandleUserData(u32 userData);
Z2SoundHandlePool* getHandleUserData(uintptr_t userData);
void stopAllSounds(u32 fadeTime);
+2 -2
View File
@@ -2,13 +2,13 @@
#define DUSK_AUDIO_H
#if TARGET_PC
#define DUSK_AUDIO_DISABLED 1
#define DUSK_AUDIO_DISABLED 0
#else
#define DUSK_AUDIO_DISABLED 0
#endif
#if TARGET_PC
#define DUSK_AUDIO_SKIP(...) return __VA_ARGS__;
#define DUSK_AUDIO_SKIP(...)
#else
#define DUSK_AUDIO_SKIP(...)
#endif
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include <dolphin/types.h>
namespace dusk::audio {
/**
* Initialize the audio system and start playing audio.
*/
void Initialize();
void SetMasterVolume(f32 value);
u32 GetResetCount(int channelIdx);
f32 VolumeFromU16(u16 value);
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef DUSK_MAIN_H
#define DUSK_MAIN_H
namespace dusk {
extern bool IsShuttingDown;
}
#endif // DUSK_MAIN_H
+14
View File
@@ -0,0 +1,14 @@
#ifndef DUSK_OS_H
#define DUSK_OS_H
#ifdef __cplusplus
extern "C" {
#endif
void OSSetCurrentThreadName(const char* name);
#ifdef __cplusplus
}
#endif
#endif // DUSK_OS_H
+58
View File
@@ -0,0 +1,58 @@
#ifndef DUSK_STRING_HPP
#define DUSK_STRING_HPP
#include "global.h"
#include <cstring>
#include <dolphin/os.h>
namespace dusk {
inline void strncpyProxy(char* dst, const char* src, size_t count) {
#if _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
#endif
strncpy(dst, src, count);
#if _MSC_VER
#pragma warning(pop)
#endif
}
/**
* Copy a string to a fixed-size array.
* Truncates if the destination is not large enough, always inserts a null terminator (padding the remainder of the buffer with zeroes.)
*/
template <size_t BufSize>
void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) {
static_assert(BufSize > 0, "Target buffer cannot be size zero");
if (buffer == src) {
CRASH("Cannot copy string to same buffer");
}
strncpyProxy(buffer, src, BufSize);
buffer[BufSize - 1] = 0;
}
/**
* Copy a string to a fixed-size array.
* Aborts if the destination is not large enough, always inserts a null terminator (padding the remainder of the buffer with zeroes.)
*/
template <size_t BufSize>
void SafeStringCopy(char (&buffer)[BufSize], const char* src) {
static_assert(BufSize > 0, "Target buffer cannot be size zero");
if (buffer == src) {
CRASH("Cannot copy string to same buffer");
}
if (strlen(src) > BufSize - 1) {
CRASH("Destination buffer too small!");
}
strncpyProxy(buffer, src, BufSize);
buffer[BufSize - 1] = 0;
}
}
#endif // DUSK_STRING_HPP
+4
View File
@@ -9,7 +9,11 @@
#include "f_pc/f_pc_stdcreate_req.h"
#include "f_pc/f_pc_searcher.h"
#if TARGET_PC
enum : u32 {
#else
enum {
#endif
fpcM_UNK_PROCESS_ID_e = 0xFFFFFFFE,
fpcM_ERROR_PROCESS_ID_e = 0xFFFFFFFF,
};
+8 -2
View File
@@ -83,7 +83,11 @@ extern int __abs(int);
void* __memcpy(void*, const void*, int);
#endif
#ifdef _MSVC_LANG
#ifndef M_PI
#define M_PI 3.14159265358979323846f
#endif
#if defined(_MSVC_LANG) && !defined(__clang__)
inline int __builtin_clz(unsigned int v) {
int count = 32;
while (v != 0) {
@@ -94,7 +98,6 @@ inline int __builtin_clz(unsigned int v) {
}
#define COMPOUND_LITERAL(x)
#define M_PI 3.14159265358979323846f
#else
#define COMPOUND_LITERAL(x) (x)
@@ -215,4 +218,7 @@ using std::isnan;
#define IS_REF_NONNULL(r) (1)
#endif
#define CRASH(msg) OSPanic(__FILE__, __LINE__, "%s", msg)
#define CRASHF(msg, ...) OSPanic(__FILE__, __LINE__, msg, __VA_ARGS__)
#endif