Merge pull request #3080 from Allofich/svn

SVN r4468 + r4469
This commit is contained in:
Jonathan Campbell
2021-11-17 22:25:12 +00:00
committed by GitHub
4 changed files with 18 additions and 11 deletions

View File

@@ -104,6 +104,9 @@
the remaining block of undefined/undocumented EGC
ROPs. This fixes "Atomic Punker" which uses EGC ROP
0xBE for sprite rendering. (joncampbell123)
- Integrated commits from mainline (Allofich)
- Add proper opl3 handling of the waveform select
to dbopl.
0.83.19
- Reorganized the "List network interfaces" and "List
printer devices" dialogs (under the "Help" menu) to

View File

@@ -1207,10 +1207,7 @@ Module::Module( Section* configuration ) : Module_base(configuration) {
//Used to be 2.0, which was measured to be too high. Exact value depends on card/clone.
mixerChan->SetScale( 1.5f );
if (oplemu == "fast") {
handler = new DBOPL::Handler();
}
else if (oplemu == "compat") {
if (oplemu == "compat") {
if (oplmode == OPL_opl2) {
handler = new OPL2::Handler();
}
@@ -1239,8 +1236,11 @@ Module::Module( Section* configuration ) : Module_base(configuration) {
else {
handler = new MAMEOPL3::Handler();
}
} else {
handler = new DBOPL::Handler();
}
//Fall back to dbop, will also catch auto
else if (oplemu == "fast" || 1) {
const bool opl3Mode = oplmode >= OPL_opl3;
handler = new DBOPL::Handler( opl3Mode );
}
usedoplemu = oplemu;
handler->Init( rate );

View File

@@ -510,7 +510,7 @@ void Operator::WriteE0( const Chip* chip, uint8_t val ) {
if ( !(regE0 ^ val) )
return;
//in opl3 mode you can always selet 7 waveforms regardless of waveformselect
uint8_t waveForm = val & ( ( 0x3 & chip->waveFormMask ) | (0x7 & chip->opl3Active ) );
const uint8_t waveForm = val & ( ( 0x3 & chip->waveFormMask ) | (0x7 & chip->opl3Active ) );
regE0 = val;
#if ( DBOPL_WAVE == WAVE_HANDLER )
waveHandler = WaveHandlerTable[ waveForm ];
@@ -985,7 +985,7 @@ Channel* Channel::BlockTemplate( Chip* chip, uint32_t samples, int32_t* output )
Chip
*/
Chip::Chip() {
Chip::Chip( bool _opl3Mode ) : opl3Mode( _opl3Mode ) {
reg08 = 0;
reg04 = 0;
regBD = 0;
@@ -1122,7 +1122,8 @@ void Chip::WriteReg( uint32_t reg, uint8_t val ) {
switch ( (reg & 0xf0) >> 4 ) {
case 0x00 >> 4:
if ( reg == 0x01 ) {
waveFormMask = ( val & 0x20 ) ? 0x7 : 0x0;
//When the chip is running in opl3 compatible mode, you can't actually disable the waveforms
waveFormMask = ( (val & 0x20) || opl3Mode ) ? 0x7 : 0x0;
} else if ( reg == 0x104 ) {
//Only detect changes in lowest 6 bits
if ( !((reg104 ^ val) & 0x3f) )

View File

@@ -199,7 +199,6 @@ struct Chip {
uint32_t lfoCounter = 0;
uint32_t lfoAdd = 0;
uint32_t noiseCounter = 0;
uint32_t noiseAdd = 0;
uint32_t noiseValue = 0;
@@ -226,6 +225,8 @@ struct Chip {
uint8_t waveFormMask = 0;
//0 or -1 when enabled
int8_t opl3Active;
//Running in opl3 mode
const bool opl3Mode;
//Return the maximum amount of samples before and LFO change
uint32_t ForwardLFO( uint32_t samples );
@@ -244,7 +245,7 @@ struct Chip {
void Generate( uint32_t samples );
void Setup( uint32_t rate );
Chip();
Chip( bool opl3Mode );
};
struct Handler : public Adlib::Handler {
@@ -256,6 +257,8 @@ struct Handler : public Adlib::Handler {
virtual void SaveState( std::ostream& stream );
virtual void LoadState( std::istream& stream );
Handler(bool opl3Mode) : chip(opl3Mode) {
}
};