diff --git a/src/Audio.cpp b/src/Audio.cpp index 53e59143..40ca6ad3 100644 --- a/src/Audio.cpp +++ b/src/Audio.cpp @@ -35,6 +35,7 @@ Audio::Audio(Cartridge * pCartridge) m_bYM2413Enabled = false; m_bPSGEnabled = true; m_bYM2413ForceDisabled = false; + m_bYM2413CartridgeNotSupported = false; m_bMute = false; } @@ -78,6 +79,7 @@ void Audio::Reset(bool bPAL) m_pBuffer->clock_rate(m_bPAL ? GS_MASTER_CLOCK_PAL : GS_MASTER_CLOCK_NTSC); m_pYM2413->Reset(m_bPAL ? GS_MASTER_CLOCK_PAL : GS_MASTER_CLOCK_NTSC); m_ElapsedCycles = 0; + m_bYM2413CartridgeNotSupported = (m_pCartridge->GetFeatures() & GS_DB_FEATURE_DISABLE_YM2413); } void Audio::Mute(bool bMute) @@ -107,7 +109,7 @@ void Audio::EndFrame(s16* pSampleBuffer, int* pSampleCount) if (!m_bMute) { pSampleBuffer[i] += m_bPSGEnabled ? m_pSampleBuffer[(i >= psg_count) ? psg_count-1 : i] : 0; - pSampleBuffer[i] += (m_bYM2413Enabled && !m_bYM2413ForceDisabled) ? m_pYM2413Buffer[i] * 4 : 0; + pSampleBuffer[i] += (m_bYM2413Enabled && !m_bYM2413ForceDisabled && !m_bYM2413CartridgeNotSupported) ? m_pYM2413Buffer[i] * 4 : 0; } } } diff --git a/src/Audio.h b/src/Audio.h index 9717618a..088aa498 100644 --- a/src/Audio.h +++ b/src/Audio.h @@ -56,6 +56,7 @@ class Audio bool m_bYM2413Enabled; bool m_bPSGEnabled; bool m_bYM2413ForceDisabled; + bool m_bYM2413CartridgeNotSupported; Cartridge* m_pCartridge; s16* m_pYM2413Buffer; bool m_bMute; @@ -81,7 +82,7 @@ inline void Audio::WriteGGStereoRegister(u8 value) inline void Audio::YM2413Write(u8 port, u8 value) { - if (m_bYM2413ForceDisabled) + if (m_bYM2413ForceDisabled || m_bYM2413CartridgeNotSupported) return; if (port == 0xF2) @@ -106,7 +107,7 @@ inline void Audio::YM2413Write(u8 port, u8 value) inline u8 Audio::YM2413Read(u8 port) { - if (m_bYM2413ForceDisabled) + if (m_bYM2413ForceDisabled || m_bYM2413CartridgeNotSupported) return 0xFF; else return m_pYM2413->Read(port); diff --git a/src/game_db.h b/src/game_db.h index 50a49692..ef6668d2 100644 --- a/src/game_db.h +++ b/src/game_db.h @@ -46,6 +46,7 @@ #define GS_DB_FEATURE_NO_BATTERY 0x04 #define GS_DB_FEATURE_YM2413 0x08 #define GS_DB_FEATURE_INITIAL_VINT 0x10 +#define GS_DB_FEATURE_DISABLE_YM2413 0x20 struct GS_GameDBEntry { @@ -404,8 +405,12 @@ const GS_GameDBEntry kGameDatabase[] = {0x7F667485, GS_DB_KOREAN_MD_FFF5_MAPPER, GS_DB_FEATURE_NONE, "Mega Mode Super Game 138"}, {0xC0AC6956, GS_DB_KOREAN_MD_FFF5_MAPPER, GS_DB_FEATURE_NONE, "Pigu-Wang 7 Hap - Jaemiiss-neun Game Mo-eumjip"}, + // Requires vint flag on boot {0xD9096263, GS_DB_DEFAULT_MAPPER, GS_DB_FEATURE_INITIAL_VINT, "Sonic's Edusoft [Proto]"}, + // Does not work if YM2413 is enabled + {0x5359762D, GS_DB_DEFAULT_MAPPER, GS_DB_FEATURE_DISABLE_YM2413, "Wanted"}, + {0, 0, 0, 0} };