diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..5bdca45d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "extern/musyx"] + path = extern/musyx + url = https://github.com/AxioDL/musyx diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 8e77c051..490e5c47 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -3151,8 +3151,8 @@ sndOutputMode = .text:0x800FA130; // type:function size:0xEC sndSetAuxProcessingCallbacks = .text:0x800FA21C; // type:function size:0x158 synthActivateStudio = .text:0x800FA374; // type:function size:0xA8 synthDeactivateStudio = .text:0x800FA41C; // type:function size:0xF0 -synthChangeStudioMasterMix = .text:0x800FA50C; // type:function size:0x20 -sndAddStudioInput = .text:0x800FA52C; // type:function size:0x20 +synthAddStudioInput = .text:0x800FA50C; // type:function size:0x20 +synthRemoveStudioInput = .text:0x800FA52C; // type:function size:0x20 streamInit = .text:0x800FA54C; // type:function size:0xBC SetHWMix = .text:0x800FA608; // type:function size:0x8C scope:local streamHandle = .text:0x800FA694; // type:function size:0x8AC @@ -5640,7 +5640,7 @@ gWriteBuf = .bss:0x801AA7E4; // type:object size:0x110A scope:local bUseSerialIO = .bss:0x801AB8F0; // type:object size:0x1 scope:local data:byte seqNote = .bss:0x801AB8F8; // type:object size:0x1400 scope:local data:4byte seqInstance = .bss:0x801ACCF8; // type:object size:0xC340 -seqMIDIPriority = .bss:0x801B9038; // type:object size:0x100 scope:local data:2byte +seqMIDIPriority = .bss:0x801B9038; // type:object size:0x100 data:2byte synthTicksPerSecond = .bss:0x801B9138; // type:object size:0x240 scope:local synthInfo = .bss:0x801B9378; // type:object size:0x214 data:4byte synthMasterFader = .bss:0x801B958C; // type:object size:0x600 data:float diff --git a/configure.py b/configure.py index 091c3847..351e770b 100644 --- a/configure.py +++ b/configure.py @@ -150,9 +150,11 @@ cflags_base = [ "-fp_contract on", "-str reuse", "-i include", + "-i extern/musyx/include", f"-i build/{config.version}/include", "-multibyte", f"-DVERSION={version_num}", + "-DMUSY_TARGET=MUSY_TARGET_DOLPHIN", ] # Debug flags @@ -210,6 +212,7 @@ cflags_musyx = [ "-nodefaults", "-nosyspath", "-i include", + "-i extern/musyx/include", "-inline auto", "-O4,p", "-fp hard", @@ -661,37 +664,37 @@ config.libs = [ }, MusyX( objects={ - Object(NonMatching, "musyx/runtime/seq.c"), + Object(Matching, "musyx/runtime/seq.c"), Object(NonMatching, "musyx/runtime/synth.c"), - Object(NonMatching, "musyx/runtime/seq_api.c"), - Object(NonMatching, "musyx/runtime/snd_synthapi.c"), + Object(Matching, "musyx/runtime/seq_api.c"), + Object(Matching, "musyx/runtime/snd_synthapi.c"), Object(NonMatching, "musyx/runtime/stream.c"), - Object(NonMatching, "musyx/runtime/synthdata.c"), + Object(Matching, "musyx/runtime/synthdata.c"), Object(NonMatching, "musyx/runtime/synthmacros.c"), Object(NonMatching, "musyx/runtime/synthvoice.c"), - Object(NonMatching, "musyx/runtime/synth_ac.c"), - Object(NonMatching, "musyx/runtime/synth_dbtab.c"), + Object(Matching, "musyx/runtime/synth_ac.c"), + Object(Matching, "musyx/runtime/synth_dbtab.c"), Object(NonMatching, "musyx/runtime/synth_adsr.c"), Object(NonMatching, "musyx/runtime/synth_vsamples.c"), Object(NonMatching, "musyx/runtime/s_data.c"), Object(NonMatching, "musyx/runtime/hw_dspctrl.c"), - Object(NonMatching, "musyx/runtime/hw_volconv.c"), - Object(NonMatching, "musyx/runtime/snd3d.c"), - Object(NonMatching, "musyx/runtime/snd_init.c"), + Object(Matching, "musyx/runtime/hw_volconv.c"), + Object(Matching, "musyx/runtime/snd3d.c"), + Object(Matching, "musyx/runtime/snd_init.c"), Object(NonMatching, "musyx/runtime/snd_math.c"), Object(NonMatching, "musyx/runtime/snd_midictrl.c"), Object(NonMatching, "musyx/runtime/snd_service.c"), - Object(NonMatching, "musyx/runtime/hardware.c"), - Object(NonMatching, "musyx/runtime/dsp_import.c"), - Object(NonMatching, "musyx/runtime/hw_aramdma.c"), - Object(NonMatching, "musyx/runtime/hw_dolphin.c"), - Object(NonMatching, "musyx/runtime/hw_memory.c"), - Object(NonMatching, "musyx/runtime/CheapReverb/creverb_fx.c"), + Object(Matching, "musyx/runtime/hardware.c"), + Object(Matching, "musyx/runtime/dsp_import.c"), + Object(Matching, "musyx/runtime/hw_aramdma.c"), + Object(Matching, "musyx/runtime/hw_dolphin.c"), + Object(Matching, "musyx/runtime/hw_memory.c"), + Object(Matching, "musyx/runtime/CheapReverb/creverb_fx.c"), Object(NonMatching, "musyx/runtime/CheapReverb/creverb.c"), - Object(NonMatching, "musyx/runtime/StdReverb/reverb_fx.c"), + Object(Matching, "musyx/runtime/StdReverb/reverb_fx.c"), Object(NonMatching, "musyx/runtime/StdReverb/reverb.c"), - Object(NonMatching, "musyx/runtime/Delay/delay_fx.c"), - Object(NonMatching, "musyx/runtime/Chorus/chorus_fx.c"), + Object(Matching, "musyx/runtime/Delay/delay_fx.c"), + Object(Matching, "musyx/runtime/Chorus/chorus_fx.c"), } ), { diff --git a/extern/musyx b/extern/musyx new file mode 160000 index 00000000..ddfad60c --- /dev/null +++ b/extern/musyx @@ -0,0 +1 @@ +Subproject commit ddfad60c3e4fede55479c744a1c70081e0d6cd12 diff --git a/include/float.h b/include/float.h new file mode 100644 index 00000000..2df8e712 --- /dev/null +++ b/include/float.h @@ -0,0 +1,18 @@ +#ifndef _FLOAT_H_ +#define _FLOAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define FLT_MAX 3.402823466e+38f +#define FLT_EPSILON 1.192092896e-07f +#define FLT_MIN 1.175494351e-38f + +#define DBL_EPSILON 1.1920929e-07 + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/include/math.h b/include/math.h index 588a248e..8643d415 100644 --- a/include/math.h +++ b/include/math.h @@ -3,6 +3,10 @@ #define M_PI 3.141592653589793 +#ifndef _MATH_INLINE +#define _MATH_INLINE static inline +#endif + #ifdef MATH_EXPORT_CONST extern inline float sqrtf(float x) { @@ -36,6 +40,7 @@ extern inline float sqrtf(float x) return x; } #endif + double atan(double x); double copysign(double x, double y); double cos(double x); @@ -58,4 +63,14 @@ float acosf(float x); #define abs(x) __abs(x) +_MATH_INLINE float fabsf(float x) { return (float)fabs((double)x); } +_MATH_INLINE float sinf(float x) { return (float)sin((double)x); } +_MATH_INLINE float cosf(float x) { return (float)cos((double)x); } +_MATH_INLINE float atan2f(float y, float x) { return (float)atan2((double)y, (double)x); } +_MATH_INLINE float fmodf(float x, float m) { return (float)fmod((double)x, (double)m); } + +_MATH_INLINE float floorf(float x) { return floor(x); } + +_MATH_INLINE float powf(float __x, float __y) { return pow(__x, __y); } + #endif diff --git a/include/stddef.h b/include/stddef.h new file mode 100644 index 00000000..5a133946 --- /dev/null +++ b/include/stddef.h @@ -0,0 +1,23 @@ +#ifndef _STDDEF_H_ +#define _STDDEF_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define offsetof(type, member) ((size_t) & (((type*)0)->member)) + +/* These break 1.2.5 */ +//typedef __typeof__(sizeof(0)) size_t; +//typedef __typeof__((char*)0 - (char*)0) ptrdiff_t; +typedef unsigned long size_t; +typedef long ptrdiff_t; +#ifndef NULL +#define NULL 0L +#endif + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/include/stdint.h b/include/stdint.h new file mode 100644 index 00000000..5219be07 --- /dev/null +++ b/include/stdint.h @@ -0,0 +1,14 @@ +#ifndef _STDINT_H_ +#define _STDINT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned long int uintptr_t; + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/tools/project.py b/tools/project.py index 4c315aa6..0cc9e4c0 100644 --- a/tools/project.py +++ b/tools/project.py @@ -509,11 +509,12 @@ def generate_build_ninja(config, build_config): lib, obj = result lib_name = lib["lib"] + src_dir = Path(lib.get("src_dir", config.src_dir)) options = obj.options completed = obj.completed - unit_src_path = config.src_dir / options["source"] + unit_src_path = src_dir / options["source"] if not unit_src_path.exists(): if config.warn_missing_source or completed: print(f"Missing source file {unit_src_path}")