Expose full gameplay rules, difficulty, HUD, and control options
This commit is contained in:
1 parent
6c24f715a0
commit
cd63921ea4
15 files changed
+564
-164
No files matched your search
@@ -71,11 +71,13 @@ bool AudioEngine::init(const Vfs& vfs, const GameConfig& cfg, bool open_device)
|
||||
|
||||
// Optional external SoundFont (.sf2)
|
||||
has_custom_sf_ = false;
|
||||
loaded_custom_sf_path_.clear();
|
||||
if (!cfg.custom_soundfont_path.empty()) {
|
||||
std::vector<uint8_t> sf_bytes;
|
||||
if (Vfs::read_raw_file(cfg.custom_soundfont_path, sf_bytes) &&
|
||||
custom_sf_bank_.load_from_bytes(sf_bytes.data(), sf_bytes.size())) {
|
||||
has_custom_sf_ = true;
|
||||
loaded_custom_sf_path_ = cfg.custom_soundfont_path;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,6 +161,30 @@ void AudioEngine::apply_config(const GameConfig& cfg, bool window_focused) {
|
||||
music_vol_.store(cfg.music_volume, std::memory_order_relaxed);
|
||||
muted_.store(cfg.mute_on_focus_loss && !window_focused, std::memory_order_relaxed);
|
||||
|
||||
if (cfg.custom_soundfont_path != loaded_custom_sf_path_) {
|
||||
assets::SoundFontBank next_sf;
|
||||
bool ok = false;
|
||||
if (!cfg.custom_soundfont_path.empty()) {
|
||||
std::vector<uint8_t> sf_bytes;
|
||||
if (Vfs::read_raw_file(cfg.custom_soundfont_path, sf_bytes) &&
|
||||
next_sf.load_from_bytes(sf_bytes.data(), sf_bytes.size())) {
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
if (dev_id_ != 0) SDL_LockAudioDevice(dev_id_);
|
||||
if (ok) {
|
||||
custom_sf_bank_ = std::move(next_sf);
|
||||
has_custom_sf_ = true;
|
||||
} else {
|
||||
custom_sf_bank_ = assets::SoundFontBank{};
|
||||
has_custom_sf_ = false;
|
||||
}
|
||||
loaded_custom_sf_path_ = cfg.custom_soundfont_path;
|
||||
sf_synth_.reset();
|
||||
sf_synth_.set_soundfont(has_custom_sf_ ? &custom_sf_bank_ : &sf_bank_);
|
||||
if (dev_id_ != 0) SDL_UnlockAudioDevice(dev_id_);
|
||||
}
|
||||
|
||||
if (cfg.music_backend != requested_backend_) {
|
||||
requested_backend_ = cfg.music_backend;
|
||||
AudioCommand cmd;
|
||||
|
||||
@@ -115,6 +115,7 @@ private:
|
||||
assets::OplTimbreBank opl_bank_;
|
||||
assets::SoundFontBank sf_bank_;
|
||||
assets::SoundFontBank custom_sf_bank_;
|
||||
std::string loaded_custom_sf_path_;
|
||||
bool has_custom_sf_ = false;
|
||||
|
||||
// Pre-parsed sequences for 2 banks (Adlib .XMI and AWE32 .WTB) x 5 songs
|
||||
|
||||
Reference in new issue
Block a user