YM2612: fix CSM on ymfm
finally
This commit is contained in:
		
							parent
							
								
									c665326b2d
								
							
						
					
					
						commit
						26739bba11
					
				| 
						 | 
				
			
			@ -30,17 +30,26 @@
 | 
			
		|||
 | 
			
		||||
void DivYM2612Interface::ymfm_set_timer(uint32_t tnum, int32_t duration_in_clocks) {
 | 
			
		||||
  if (tnum==1) {
 | 
			
		||||
    countB=duration_in_clocks;
 | 
			
		||||
    setB=duration_in_clocks;
 | 
			
		||||
  } else if (tnum==0) {
 | 
			
		||||
    countA=duration_in_clocks;
 | 
			
		||||
    setA=duration_in_clocks;
 | 
			
		||||
  }
 | 
			
		||||
  //logV("ymfm_set_timer(%d,%d)",tnum,duration_in_clocks);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DivYM2612Interface::clock() {
 | 
			
		||||
  if (countA>=0) {
 | 
			
		||||
  if (setA>=0) {
 | 
			
		||||
    countA-=144;
 | 
			
		||||
    if (countA<0) m_engine->engine_timer_expired(0);
 | 
			
		||||
    if (countA<0) {
 | 
			
		||||
      m_engine->engine_timer_expired(0);
 | 
			
		||||
      countA+=setA;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (setB>=0) {
 | 
			
		||||
    countB-=144;
 | 
			
		||||
    if (countB<0) {
 | 
			
		||||
      m_engine->engine_timer_expired(1);
 | 
			
		||||
      countB+=setB;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class DivYM2612Interface: public ymfm::ymfm_interface {
 | 
			
		||||
  int setA, setB;
 | 
			
		||||
  int countA, countB;
 | 
			
		||||
 | 
			
		||||
  public:
 | 
			
		||||
| 
						 | 
				
			
			@ -32,8 +33,8 @@ class DivYM2612Interface: public ymfm::ymfm_interface {
 | 
			
		|||
    void ymfm_set_timer(uint32_t tnum, int32_t duration_in_clocks);
 | 
			
		||||
    DivYM2612Interface():
 | 
			
		||||
      ymfm::ymfm_interface(),
 | 
			
		||||
      countA(-1),
 | 
			
		||||
      countB(-1) {}
 | 
			
		||||
      countA(0),
 | 
			
		||||
      countB(0) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class DivPlatformGenesis: public DivPlatformOPN {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -431,6 +431,12 @@ bool fm_operator<RegisterType>::prepare()
 | 
			
		|||
 | 
			
		||||
	// clock the key state
 | 
			
		||||
	clock_keystate(uint32_t(m_keyon_live != 0));
 | 
			
		||||
        if (m_keyon_live & (1<<KEYON_CSM)) {
 | 
			
		||||
          if (!(m_keyon_live & (1<<KEYON_NORMAL))) {
 | 
			
		||||
            clock_keystate(0);
 | 
			
		||||
          } else {
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
	m_keyon_live &= ~(1 << KEYON_CSM);
 | 
			
		||||
 | 
			
		||||
	// we're active until we're quiet after the release
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue