Small updates:

- added methods to CModel3 to access sound board and drive board
 - added methods to CSoundBoard to access 68K and DSB (if attached)
 - added methods to CDSB1 & CDSB2 to access Z80 & 68K respectively
 - small code tweak in DriveBoard.cpp
 - comment tweaks in Model3.h & Model3.cpp
This commit is contained in:
Nik Henson 2011-09-15 21:10:38 +00:00
parent 1629cd711c
commit 58954ee4cc
7 changed files with 101 additions and 15 deletions

View file

@ -590,6 +590,11 @@ bool CDSB1::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr)
return OKAY; return OKAY;
} }
CZ80 *CDSB1::GetZ80(void)
{
return &Z80;
}
CDSB1::CDSB1(void) CDSB1::CDSB1(void)
{ {
progROM = NULL; progROM = NULL;
@ -1161,6 +1166,11 @@ bool CDSB2::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr)
return OKAY; return OKAY;
} }
M68KCtx *CDSB2::GetM68K(void)
{
return &M68K;
}
CDSB2::CDSB2(void) CDSB2::CDSB2(void)
{ {
progROM = NULL; progROM = NULL;

View file

@ -241,6 +241,9 @@ public:
void LoadState(CBlockFile *StateFile); void LoadState(CBlockFile *StateFile);
bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr); bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr);
// Returns a reference to the Z80 CPU
CZ80 *GetZ80(void);
// Constructor and destructor // Constructor and destructor
CDSB1(void); CDSB1(void);
~CDSB1(void); ~CDSB1(void);
@ -313,6 +316,9 @@ public:
void LoadState(CBlockFile *StateFile); void LoadState(CBlockFile *StateFile);
bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr); bool Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr);
// Returns a reference to the 68K CPU context
M68KCtx *GetM68K(void);
// Constructor and destructor // Constructor and destructor
CDSB2(void); CDSB2(void);
~CDSB2(void); ~CDSB2(void);

View file

@ -646,15 +646,12 @@ void CDriveBoard::ProcessEncoderCmd(void)
// Disable uncentering // Disable uncentering
SendVibrate(0); SendVibrate(0);
} }
else if (seqNum == 3) else if (seqNum == 3 && m_uncenterVal1 > 0)
{ {
if (m_uncenterVal1 > 0) // Uncentering - unsure exactly how values sent map to strength or whether they specify some other attributes of effect
{ // For now just attempting to map them to a sensible value in range 0x00-0xFF
// Uncentering - unsure exactly how values sent map to strength or whether they specify some other attributes of effect UINT8 strength = ((m_uncenterVal1>>1) - 7) * 0x50 + ((m_uncenterVal2>>1) - 5) * 0x10 + 0xF;
// For now just attempting to map them to a sensible value in range 0x00-0xFF SendVibrate(strength);
UINT8 strength = ((m_uncenterVal1>>1) - 7) * 0x50 + ((m_uncenterVal2>>1) - 5) * 0x10 + 0xF;
SendVibrate(strength);
}
} }
} }
break; break;

View file

@ -2197,7 +2197,7 @@ void CModel3::RunSoundBoardThread(void)
goto ThreadError; goto ThreadError;
} }
// Keep processing frames until audio buffer is half full // Keep processing frames until audio buffer is full
bool repeat = true; bool repeat = true;
// NOTE - performs an unlocked read of pausedThreads here, but this is okay // NOTE - performs an unlocked read of pausedThreads here, but this is okay
while (!pausedThreads && !SoundBoard.RunFrame()) while (!pausedThreads && !SoundBoard.RunFrame())
@ -2928,6 +2928,16 @@ bool CModel3::Init(void)
return OKAY; return OKAY;
} }
CSoundBoard *CModel3::GetSoundBoard(void)
{
return &SoundBoard;
}
CDriveBoard *CModel3::GetDriveBoard(void)
{
return &DriveBoard;
}
CModel3::CModel3(void) CModel3::CModel3(void)
{ {
// Initialize pointers so dtor can know whether to free them // Initialize pointers so dtor can know whether to free them

View file

@ -170,8 +170,9 @@ public:
* *
* Loads and resumes execution from a state image. Modifies data that may * Loads and resumes execution from a state image. Modifies data that may
* be used by multiple threads -- use with caution and ensure threads are * be used by multiple threads -- use with caution and ensure threads are
* not accessing data that will be touched. Must never be called while * not accessing data that will be touched, this can be done by calling
* emulator is running (inside RunFrame()). * PauseThreads beforehand. Must never be called while emulator is running
* (inside RunFrame()).
* *
* Parameters: * Parameters:
* SaveState Block file to load state information from. * SaveState Block file to load state information from.
@ -279,6 +280,41 @@ public:
*/ */
bool Init(void); bool Init(void);
/*
* GetSoundBoard(void):
*
* Returns a reference to the sound board.
*
* Returns:
* Pointer to CSoundBoard object.
*/
CSoundBoard *GetSoundBoard(void);
/*
* GetDriveBoard(void):
*
* Returns a reference to the drive board.
* Returns:
* Pointer to CDriveBoard object.
*/
CDriveBoard *GetDriveBoard(void);
/*
* PauseThreads(void):
*
* Flags that any running threads should pause and waits for them to do so.
* Should be used before invoking any method that accesses the internal state, eg LoadState or SaveState.
*/
bool PauseThreads(void);
/*
* ResumeThreads(void):
*
* Flags that any paused threads should resume running.
*/
void ResumeThreads(void);
/* /*
* CModel3(void): * CModel3(void):
* ~CModel3(void): * ~CModel3(void):
@ -291,9 +327,6 @@ public:
CModel3(void); CModel3(void);
~CModel3(void); ~CModel3(void);
bool PauseThreads(void);
void ResumeThreads(void);
/* /*
* Private Property. * Private Property.
* Tresspassers will be shot! ;) * Tresspassers will be shot! ;)

View file

@ -515,6 +515,16 @@ bool CSoundBoard::Init(const UINT8 *soundROMPtr, const UINT8 *sampleROMPtr)
return OKAY; return OKAY;
} }
M68KCtx *CSoundBoard::GetM68K(void)
{
return &M68K;
}
CDSB *CSoundBoard::GetDSB(void)
{
return DSB;
}
CSoundBoard::CSoundBoard(void) CSoundBoard::CSoundBoard(void)
{ {
DSB = NULL; DSB = NULL;

View file

@ -148,6 +148,26 @@ public:
*/ */
void AttachDSB(CDSB *DSBPtr); void AttachDSB(CDSB *DSBPtr);
/*
* GetMS68K(void):
*
* Returns a reference to the 68K CPU of the sound board.
*
* Returns:
* A pointer to the M68K context.
*/
M68KCtx *GetM68K(void);
/*
* GetDSB(void):
*
* Returns a reference the Digital Sound Board (if attached).
*
* Returns:
* A pointer to the DSB object or NULL if not attached.
*/
CDSB *GetDSB(void);
/* /*
* Init(soundROMPtr, sampleROMPtr): * Init(soundROMPtr, sampleROMPtr):
* *