diff options
author | Chris Robinson <[email protected]> | 2023-03-17 08:39:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-03-17 08:39:18 -0700 |
commit | 186a29b77d8ec01c14d13797f9d51c7c21b22b60 (patch) | |
tree | 1817aac09c3e404132db2baa15d883726edc00de /alc | |
parent | 24508c3901ad9df62b264d5c0d8b7294bb0e218f (diff) |
Add a compat option to restore AL_SOFT_buffer_sub_data
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 3 | ||||
-rw-r--r-- | alc/context.cpp | 50 | ||||
-rw-r--r-- | alc/context.h | 4 |
3 files changed, 39 insertions, 18 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 1a4a89ad..bb83e1f7 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -455,6 +455,8 @@ const struct { DECL(alSourcePlayAtTimeSOFT), DECL(alSourcePlayAtTimevSOFT), + + DECL(alBufferSubDataSOFT), #ifdef ALSOFT_EAX }, eaxFunctions[] = { DECL(EAXGet), @@ -1158,6 +1160,7 @@ void alc_initconfig(void) } return GetConfigValueBool(nullptr, "game_compat", optname, false); }; + sBufferSubDataCompat = checkflag("__ALSOFT_ENABLE_SUB_DATA_EXT", "enable-sub-data-ext"); compatflags.set(CompatFlags::ReverseX, checkflag("__ALSOFT_REVERSE_X", "reverse-x")); compatflags.set(CompatFlags::ReverseY, checkflag("__ALSOFT_REVERSE_Y", "reverse-y")); compatflags.set(CompatFlags::ReverseZ, checkflag("__ALSOFT_REVERSE_Z", "reverse-z")); diff --git a/alc/context.cpp b/alc/context.cpp index cb2410f4..65689a5b 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -171,6 +171,20 @@ void ALCcontext::init() mExtensionList = alExtList; + if(sBufferSubDataCompat) + { + std::string extlist{mExtensionList}; + + const auto pos = extlist.find("AL_EXT_SOURCE_RADIUS "); + if(pos != std::string::npos) + extlist.replace(pos, 20, "AL_SOFT_buffer_sub_data"); + else + extlist += " AL_SOFT_buffer_sub_data"; + + mExtensionListOverride = std::move(extlist); + mExtensionList = mExtensionListOverride.c_str(); + } + #ifdef ALSOFT_EAX eax_initialize_extensions(); #endif // ALSOFT_EAX @@ -441,30 +455,34 @@ void ALCcontext::eax_initialize_extensions() std::strlen(eax5_ext_name) + 1 + std::strlen(eax_x_ram_ext_name) + 1; - mEaxExtensionList.reserve(string_max_capacity); + std::string extlist; + extlist.reserve(string_max_capacity); - if(eaxIsCapable()) { - mEaxExtensionList += eax1_ext_name; - mEaxExtensionList += ' '; + if(eaxIsCapable()) + { + extlist += eax1_ext_name; + extlist += ' '; - mEaxExtensionList += eax2_ext_name; - mEaxExtensionList += ' '; + extlist += eax2_ext_name; + extlist += ' '; - mEaxExtensionList += eax3_ext_name; - mEaxExtensionList += ' '; + extlist += eax3_ext_name; + extlist += ' '; - mEaxExtensionList += eax4_ext_name; - mEaxExtensionList += ' '; + extlist += eax4_ext_name; + extlist += ' '; - mEaxExtensionList += eax5_ext_name; - mEaxExtensionList += ' '; + extlist += eax5_ext_name; + extlist += ' '; } - mEaxExtensionList += eax_x_ram_ext_name; - mEaxExtensionList += ' '; + extlist += eax_x_ram_ext_name; + extlist += ' '; + + extlist += mExtensionList; - mEaxExtensionList += mExtensionList; - mExtensionList = mEaxExtensionList.c_str(); + mExtensionListOverride = std::move(extlist); + mExtensionList = mExtensionListOverride.c_str(); } void ALCcontext::eax_initialize() diff --git a/alc/context.h b/alc/context.h index 926a76a4..e8efdbf1 100644 --- a/alc/context.h +++ b/alc/context.h @@ -103,6 +103,8 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { const char *mExtensionList{nullptr}; + std::string mExtensionListOverride{}; + ALCcontext(al::intrusive_ptr<ALCdevice> device); ALCcontext(const ALCcontext&) = delete; @@ -401,8 +403,6 @@ private: Eax5Props mEax{}; // Current EAX state. EAXSESSIONPROPERTIES mEaxSession{}; - std::string mEaxExtensionList{}; - [[noreturn]] static void eax_fail(const char* message); [[noreturn]] static void eax_fail_unknown_property_set_id(); [[noreturn]] static void eax_fail_unknown_primary_fx_slot_id(); |