mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
set svn:eol-style=native for Plugins/**.cpp
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1441 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,86 +1,86 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "DSPHandler.h"
|
||||
|
||||
CDSPHandler* CDSPHandler::m_pInstance = NULL;
|
||||
|
||||
CDSPHandler::CDSPHandler()
|
||||
: m_pUCode(NULL),
|
||||
m_bHalt(false),
|
||||
m_bAssertInt(false)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
m_DSPControl.DSPHalt = 1;
|
||||
m_DSPControl.DSPInit = 1;
|
||||
}
|
||||
|
||||
CDSPHandler::~CDSPHandler()
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = NULL;
|
||||
}
|
||||
|
||||
void CDSPHandler::Update()
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
m_pUCode->Update();
|
||||
}
|
||||
|
||||
unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
UDSPControl Temp(_Value);
|
||||
if (Temp.DSPReset)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
Temp.DSPReset = 0;
|
||||
}
|
||||
if (Temp.DSPInit == 0)
|
||||
{
|
||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||
Temp.DSPInitCode = 0;
|
||||
// MessageBox(NULL, "UCODE_INIT_AUDIO_SYSTEM", "DSP-HLE", MB_OK);
|
||||
}
|
||||
|
||||
m_DSPControl.Hex = Temp.Hex;
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
unsigned short CDSPHandler::ReadControlRegister()
|
||||
{
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
void CDSPHandler::SendMailToDSP(u32 _uMail)
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
}
|
||||
|
||||
IUCode* CDSPHandler::GetUCode()
|
||||
{
|
||||
return m_pUCode;
|
||||
}
|
||||
|
||||
void CDSPHandler::SetUCode(u32 _crc)
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = NULL;
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, m_MailHandler);
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "DSPHandler.h"
|
||||
|
||||
CDSPHandler* CDSPHandler::m_pInstance = NULL;
|
||||
|
||||
CDSPHandler::CDSPHandler()
|
||||
: m_pUCode(NULL),
|
||||
m_bHalt(false),
|
||||
m_bAssertInt(false)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
m_DSPControl.DSPHalt = 1;
|
||||
m_DSPControl.DSPInit = 1;
|
||||
}
|
||||
|
||||
CDSPHandler::~CDSPHandler()
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = NULL;
|
||||
}
|
||||
|
||||
void CDSPHandler::Update()
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
m_pUCode->Update();
|
||||
}
|
||||
|
||||
unsigned short CDSPHandler::WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
UDSPControl Temp(_Value);
|
||||
if (Temp.DSPReset)
|
||||
{
|
||||
SetUCode(UCODE_ROM);
|
||||
Temp.DSPReset = 0;
|
||||
}
|
||||
if (Temp.DSPInit == 0)
|
||||
{
|
||||
// copy 128 byte from ARAM 0x000000 to IMEM
|
||||
SetUCode(UCODE_INIT_AUDIO_SYSTEM);
|
||||
Temp.DSPInitCode = 0;
|
||||
// MessageBox(NULL, "UCODE_INIT_AUDIO_SYSTEM", "DSP-HLE", MB_OK);
|
||||
}
|
||||
|
||||
m_DSPControl.Hex = Temp.Hex;
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
unsigned short CDSPHandler::ReadControlRegister()
|
||||
{
|
||||
return m_DSPControl.Hex;
|
||||
}
|
||||
|
||||
void CDSPHandler::SendMailToDSP(u32 _uMail)
|
||||
{
|
||||
if (m_pUCode != NULL)
|
||||
m_pUCode->HandleMail(_uMail);
|
||||
}
|
||||
|
||||
IUCode* CDSPHandler::GetUCode()
|
||||
{
|
||||
return m_pUCode;
|
||||
}
|
||||
|
||||
void CDSPHandler::SetUCode(u32 _crc)
|
||||
{
|
||||
delete m_pUCode;
|
||||
m_pUCode = NULL;
|
||||
m_MailHandler.Clear();
|
||||
m_pUCode = UCodeFactory(_crc, m_MailHandler);
|
||||
}
|
||||
|
@ -1,53 +1,53 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
|
||||
void __Log(int, const char *fmt, ...)
|
||||
{
|
||||
DebugLog(fmt);
|
||||
}
|
||||
|
||||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
g_dspInitialize.pLog(Msg, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
extern u8* g_pMemory;
|
||||
|
||||
// TODO: Wii support? Most likely audio data still must be in the old 24MB TRAM.
|
||||
#define RAM_MASK 0x1FFFFFF
|
||||
|
||||
u8 Memory_Read_U8(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return g_pMemory[_uAddress];
|
||||
}
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap16(*(u16*)&g_pMemory[_uAddress]);
|
||||
}
|
||||
|
||||
u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap32(*(u32*)&g_pMemory[_uAddress]);
|
||||
}
|
||||
|
||||
float Memory_Read_Float(u32 _uAddress)
|
||||
{
|
||||
u32 uTemp = Memory_Read_U32(_uAddress);
|
||||
return *(float*)&uTemp;
|
||||
}
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
|
||||
void __Log(int, const char *fmt, ...)
|
||||
{
|
||||
DebugLog(fmt);
|
||||
}
|
||||
|
||||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
g_dspInitialize.pLog(Msg, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
extern u8* g_pMemory;
|
||||
|
||||
// TODO: Wii support? Most likely audio data still must be in the old 24MB TRAM.
|
||||
#define RAM_MASK 0x1FFFFFF
|
||||
|
||||
u8 Memory_Read_U8(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return g_pMemory[_uAddress];
|
||||
}
|
||||
|
||||
u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap16(*(u16*)&g_pMemory[_uAddress]);
|
||||
}
|
||||
|
||||
u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
_uAddress &= RAM_MASK;
|
||||
return Common::swap32(*(u32*)&g_pMemory[_uAddress]);
|
||||
}
|
||||
|
||||
float Memory_Read_Float(u32 _uAddress)
|
||||
{
|
||||
u32 uTemp = Memory_Read_U32(_uAddress);
|
||||
return *(float*)&uTemp;
|
||||
}
|
||||
|
@ -1,96 +1,96 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "MailHandler.h"
|
||||
|
||||
CMailHandler::CMailHandler()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMailHandler::~CMailHandler()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void CMailHandler::PushMail(u32 _Mail)
|
||||
{
|
||||
m_Mails.push(_Mail);
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
u16 CMailHandler::ReadDSPMailboxHigh()
|
||||
{
|
||||
// check if we have a mail for the core
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
u16 result = (m_Mails.front() >> 16) & 0xFFFF;
|
||||
Update();
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
u16 CMailHandler::ReadDSPMailboxLow()
|
||||
{
|
||||
// check if we have a mail for the core
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
u16 result = m_Mails.front() & 0xFFFF;
|
||||
m_Mails.pop();
|
||||
|
||||
Update();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void CMailHandler::Clear()
|
||||
{
|
||||
while (!m_Mails.empty())
|
||||
m_Mails.pop();
|
||||
}
|
||||
|
||||
bool CMailHandler::IsEmpty()
|
||||
{
|
||||
return m_Mails.empty();
|
||||
}
|
||||
|
||||
void CMailHandler::Halt(bool _Halt)
|
||||
{
|
||||
if (_Halt)
|
||||
{
|
||||
Clear();
|
||||
m_Mails.push(0x80544348);
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
void CMailHandler::Update()
|
||||
{
|
||||
if (!IsEmpty())
|
||||
{
|
||||
// g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "MailHandler.h"
|
||||
|
||||
CMailHandler::CMailHandler()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMailHandler::~CMailHandler()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void CMailHandler::PushMail(u32 _Mail)
|
||||
{
|
||||
m_Mails.push(_Mail);
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
u16 CMailHandler::ReadDSPMailboxHigh()
|
||||
{
|
||||
// check if we have a mail for the core
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
u16 result = (m_Mails.front() >> 16) & 0xFFFF;
|
||||
Update();
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
u16 CMailHandler::ReadDSPMailboxLow()
|
||||
{
|
||||
// check if we have a mail for the core
|
||||
if (!m_Mails.empty())
|
||||
{
|
||||
u16 result = m_Mails.front() & 0xFFFF;
|
||||
m_Mails.pop();
|
||||
|
||||
Update();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
void CMailHandler::Clear()
|
||||
{
|
||||
while (!m_Mails.empty())
|
||||
m_Mails.pop();
|
||||
}
|
||||
|
||||
bool CMailHandler::IsEmpty()
|
||||
{
|
||||
return m_Mails.empty();
|
||||
}
|
||||
|
||||
void CMailHandler::Halt(bool _Halt)
|
||||
{
|
||||
if (_Halt)
|
||||
{
|
||||
Clear();
|
||||
m_Mails.push(0x80544348);
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
void CMailHandler::Update()
|
||||
{
|
||||
if (!IsEmpty())
|
||||
{
|
||||
// g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,63 +1,63 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_CARD.h"
|
||||
|
||||
|
||||
CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
{
|
||||
DebugLog("CUCode_CARD - initialized");
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
}
|
||||
|
||||
|
||||
CUCode_CARD::~CUCode_CARD()
|
||||
{
|
||||
m_rMailHandler.Clear();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_CARD::Update()
|
||||
{
|
||||
// check if we have to sent something
|
||||
if (!m_rMailHandler.IsEmpty())
|
||||
{
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_CARD::HandleMail(u32 _uMail)
|
||||
{
|
||||
if (_uMail == 0xFF000000) // unlock card
|
||||
{
|
||||
// m_Mails.push(0x00000001); // ACK (actualy anything != 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog("CUCode_CARD - unknown cmd: %x (size %i)", _uMail);
|
||||
}
|
||||
|
||||
m_rMailHandler.PushMail(DSP_DONE);
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_CARD.h"
|
||||
|
||||
|
||||
CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
{
|
||||
DebugLog("CUCode_CARD - initialized");
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
}
|
||||
|
||||
|
||||
CUCode_CARD::~CUCode_CARD()
|
||||
{
|
||||
m_rMailHandler.Clear();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_CARD::Update()
|
||||
{
|
||||
// check if we have to sent something
|
||||
if (!m_rMailHandler.IsEmpty())
|
||||
{
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_CARD::HandleMail(u32 _uMail)
|
||||
{
|
||||
if (_uMail == 0xFF000000) // unlock card
|
||||
{
|
||||
// m_Mails.push(0x00000001); // ACK (actualy anything != 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugLog("CUCode_CARD - unknown cmd: %x (size %i)", _uMail);
|
||||
}
|
||||
|
||||
m_rMailHandler.PushMail(DSP_DONE);
|
||||
CDSPHandler::GetInstance().SetUCode(UCODE_ROM);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,54 +1,54 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_InitAudioSystem.h"
|
||||
|
||||
CUCode_InitAudioSystem::CUCode_InitAudioSystem(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_BootTask_numSteps(0)
|
||||
, m_NextParameter(0)
|
||||
, IsInitialized(false)
|
||||
{
|
||||
DebugLog("CUCode_InitAudioSystem - initialized");
|
||||
}
|
||||
|
||||
|
||||
CUCode_InitAudioSystem::~CUCode_InitAudioSystem()
|
||||
{}
|
||||
|
||||
|
||||
void CUCode_InitAudioSystem::Init()
|
||||
{}
|
||||
|
||||
|
||||
void CUCode_InitAudioSystem::Update()
|
||||
{
|
||||
if (m_rMailHandler.IsEmpty())
|
||||
{
|
||||
m_rMailHandler.PushMail(0x80544348);
|
||||
// HALT
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_InitAudioSystem::HandleMail(u32 _uMail)
|
||||
{}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_InitAudioSystem.h"
|
||||
|
||||
CUCode_InitAudioSystem::CUCode_InitAudioSystem(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_BootTask_numSteps(0)
|
||||
, m_NextParameter(0)
|
||||
, IsInitialized(false)
|
||||
{
|
||||
DebugLog("CUCode_InitAudioSystem - initialized");
|
||||
}
|
||||
|
||||
|
||||
CUCode_InitAudioSystem::~CUCode_InitAudioSystem()
|
||||
{}
|
||||
|
||||
|
||||
void CUCode_InitAudioSystem::Init()
|
||||
{}
|
||||
|
||||
|
||||
void CUCode_InitAudioSystem::Update()
|
||||
{
|
||||
if (m_rMailHandler.IsEmpty())
|
||||
{
|
||||
m_rMailHandler.PushMail(0x80544348);
|
||||
// HALT
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_InitAudioSystem::HandleMail(u32 _uMail)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -1,162 +1,162 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_Jac.h"
|
||||
#include "../MailHandler.h"
|
||||
|
||||
CUCode_Jac::CUCode_Jac(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_bListInProgress(false)
|
||||
{
|
||||
DebugLog("CUCode_Jac: init");
|
||||
m_rMailHandler.PushMail(0xDCD10000);
|
||||
m_rMailHandler.PushMail(0x80000000);
|
||||
}
|
||||
|
||||
|
||||
CUCode_Jac::~CUCode_Jac()
|
||||
{
|
||||
m_rMailHandler.Clear();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Jac::HandleMail(u32 _uMail)
|
||||
{
|
||||
// this is prolly totally bullshit and should work like the zelda one...
|
||||
// but i am to lazy to change it atm
|
||||
|
||||
if (m_bListInProgress == false)
|
||||
{
|
||||
// get the command to find out how much steps it has
|
||||
switch (_uMail & 0xFFFF)
|
||||
{
|
||||
// release halt
|
||||
case 0x00:
|
||||
// m_Mails.push(0x80000000);
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
break;
|
||||
|
||||
case 0x40:
|
||||
m_step = 0;
|
||||
((u32*)m_Buffer)[m_step++] = _uMail;
|
||||
m_bListInProgress = true;
|
||||
m_numSteps = 5;
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
case 0x4000:
|
||||
m_step = 0;
|
||||
((u32*)m_Buffer)[m_step++] = _uMail;
|
||||
m_bListInProgress = true;
|
||||
m_numSteps = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
PanicAlert("UCode Jac");
|
||||
DebugLog("UCode Jac - unknown cmd: %x", _uMail & 0xFFFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
((u32*)m_Buffer)[m_step] = _uMail;
|
||||
m_step++;
|
||||
|
||||
if (m_step == m_numSteps)
|
||||
{
|
||||
ExecuteList();
|
||||
m_bListInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Jac::Update()
|
||||
{
|
||||
// check if we have to sent something
|
||||
/* if (!g_MailHandler.empty())
|
||||
{
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Jac::ExecuteList()
|
||||
{
|
||||
// begin with the list
|
||||
m_readOffset = 0;
|
||||
|
||||
u16 cmd = Read16();
|
||||
u16 sync = Read16();
|
||||
|
||||
DebugLog("==============================================================================");
|
||||
DebugLog("UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
// ==============================================================================
|
||||
// DsetupTable
|
||||
// ==============================================================================
|
||||
case 0x40:
|
||||
{
|
||||
u32 tmp[4];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
tmp[3] = Read32();
|
||||
|
||||
DebugLog("DsetupTable");
|
||||
DebugLog("???: 0x%08x", tmp[0]);
|
||||
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
|
||||
DebugLog("???: 0x%08x", tmp[3]);
|
||||
}
|
||||
break;
|
||||
|
||||
// ==============================================================================
|
||||
// UpdateDSPChannel
|
||||
// ==============================================================================
|
||||
case 0x2000:
|
||||
case 0x4000: // animal crossing
|
||||
{
|
||||
u32 tmp[3];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
|
||||
DebugLog("UpdateDSPChannel");
|
||||
DebugLog("audiomemory: 0x%08x", tmp[0]);
|
||||
DebugLog("audiomemory: 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
PanicAlert("UCode Jac unknown cmd: %s (size %)", cmd, m_numSteps);
|
||||
DebugLog("Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps);
|
||||
break;
|
||||
}
|
||||
|
||||
// sync, we are rdy
|
||||
m_rMailHandler.PushMail(DSP_SYNC);
|
||||
m_rMailHandler.PushMail(0xF3550000 | sync);
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_Jac.h"
|
||||
#include "../MailHandler.h"
|
||||
|
||||
CUCode_Jac::CUCode_Jac(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_bListInProgress(false)
|
||||
{
|
||||
DebugLog("CUCode_Jac: init");
|
||||
m_rMailHandler.PushMail(0xDCD10000);
|
||||
m_rMailHandler.PushMail(0x80000000);
|
||||
}
|
||||
|
||||
|
||||
CUCode_Jac::~CUCode_Jac()
|
||||
{
|
||||
m_rMailHandler.Clear();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Jac::HandleMail(u32 _uMail)
|
||||
{
|
||||
// this is prolly totally bullshit and should work like the zelda one...
|
||||
// but i am to lazy to change it atm
|
||||
|
||||
if (m_bListInProgress == false)
|
||||
{
|
||||
// get the command to find out how much steps it has
|
||||
switch (_uMail & 0xFFFF)
|
||||
{
|
||||
// release halt
|
||||
case 0x00:
|
||||
// m_Mails.push(0x80000000);
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
break;
|
||||
|
||||
case 0x40:
|
||||
m_step = 0;
|
||||
((u32*)m_Buffer)[m_step++] = _uMail;
|
||||
m_bListInProgress = true;
|
||||
m_numSteps = 5;
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
case 0x4000:
|
||||
m_step = 0;
|
||||
((u32*)m_Buffer)[m_step++] = _uMail;
|
||||
m_bListInProgress = true;
|
||||
m_numSteps = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
PanicAlert("UCode Jac");
|
||||
DebugLog("UCode Jac - unknown cmd: %x", _uMail & 0xFFFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
((u32*)m_Buffer)[m_step] = _uMail;
|
||||
m_step++;
|
||||
|
||||
if (m_step == m_numSteps)
|
||||
{
|
||||
ExecuteList();
|
||||
m_bListInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Jac::Update()
|
||||
{
|
||||
// check if we have to sent something
|
||||
/* if (!g_MailHandler.empty())
|
||||
{
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Jac::ExecuteList()
|
||||
{
|
||||
// begin with the list
|
||||
m_readOffset = 0;
|
||||
|
||||
u16 cmd = Read16();
|
||||
u16 sync = Read16();
|
||||
|
||||
DebugLog("==============================================================================");
|
||||
DebugLog("UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
// ==============================================================================
|
||||
// DsetupTable
|
||||
// ==============================================================================
|
||||
case 0x40:
|
||||
{
|
||||
u32 tmp[4];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
tmp[3] = Read32();
|
||||
|
||||
DebugLog("DsetupTable");
|
||||
DebugLog("???: 0x%08x", tmp[0]);
|
||||
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
|
||||
DebugLog("???: 0x%08x", tmp[3]);
|
||||
}
|
||||
break;
|
||||
|
||||
// ==============================================================================
|
||||
// UpdateDSPChannel
|
||||
// ==============================================================================
|
||||
case 0x2000:
|
||||
case 0x4000: // animal crossing
|
||||
{
|
||||
u32 tmp[3];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
|
||||
DebugLog("UpdateDSPChannel");
|
||||
DebugLog("audiomemory: 0x%08x", tmp[0]);
|
||||
DebugLog("audiomemory: 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
PanicAlert("UCode Jac unknown cmd: %s (size %)", cmd, m_numSteps);
|
||||
DebugLog("Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps);
|
||||
break;
|
||||
}
|
||||
|
||||
// sync, we are rdy
|
||||
m_rMailHandler.PushMail(DSP_SYNC);
|
||||
m_rMailHandler.PushMail(0xF3550000 | sync);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,113 +1,113 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_ROM.h"
|
||||
|
||||
CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_BootTask_numSteps(0)
|
||||
, m_NextParameter(0)
|
||||
{
|
||||
DebugLog("UCode_Rom - initialized");
|
||||
m_rMailHandler.Clear();
|
||||
m_rMailHandler.PushMail(0x8071FEED);
|
||||
}
|
||||
|
||||
CUCode_Rom::~CUCode_Rom()
|
||||
{}
|
||||
|
||||
void CUCode_Rom::Update()
|
||||
{}
|
||||
|
||||
void CUCode_Rom::HandleMail(u32 _uMail)
|
||||
{
|
||||
if (m_NextParameter == 0)
|
||||
{
|
||||
// wait for beginning of UCode
|
||||
if ((_uMail & 0xFFFF0000) != 0x80F30000)
|
||||
{
|
||||
u32 Message = 0xFEEE0000 | (_uMail & 0xFFFF);
|
||||
m_rMailHandler.PushMail(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextParameter = _uMail;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_NextParameter)
|
||||
{
|
||||
case 0x80F3A001:
|
||||
m_CurrentUCode.m_RAMAddress = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3A002:
|
||||
m_CurrentUCode.m_Length = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3C002:
|
||||
m_CurrentUCode.m_IMEMAddress = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3B002:
|
||||
m_CurrentUCode.m_Unk = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3D001:
|
||||
{
|
||||
m_CurrentUCode.m_StartPC = _uMail;
|
||||
BootUCode();
|
||||
return; // FIXES THE OVERWRITE
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// THE GODDAMN OVERWRITE WAS HERE. Without the return above, since BootUCode may delete "this", well ...
|
||||
m_NextParameter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_Rom::BootUCode()
|
||||
{
|
||||
// simple non-scientific crc invented by ector :P
|
||||
// too annoying to change now, and probably good enough anyway
|
||||
u32 crc = 0;
|
||||
|
||||
for (u32 i = 0; i < m_CurrentUCode.m_Length; i++)
|
||||
{
|
||||
crc ^= Memory_Read_U8(m_CurrentUCode.m_RAMAddress + i);
|
||||
//let's rol
|
||||
crc = (crc << 3) | (crc >> 29);
|
||||
}
|
||||
|
||||
DebugLog("CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress);
|
||||
DebugLog("CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length);
|
||||
DebugLog("CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress);
|
||||
DebugLog("CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk);
|
||||
DebugLog("CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC);
|
||||
DebugLog("CurrentUCode CRC: 0x%08x", crc);
|
||||
DebugLog("BootTask - done");
|
||||
|
||||
CDSPHandler::GetInstance().SetUCode(crc);
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "../DSPHandler.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_ROM.h"
|
||||
|
||||
CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_BootTask_numSteps(0)
|
||||
, m_NextParameter(0)
|
||||
{
|
||||
DebugLog("UCode_Rom - initialized");
|
||||
m_rMailHandler.Clear();
|
||||
m_rMailHandler.PushMail(0x8071FEED);
|
||||
}
|
||||
|
||||
CUCode_Rom::~CUCode_Rom()
|
||||
{}
|
||||
|
||||
void CUCode_Rom::Update()
|
||||
{}
|
||||
|
||||
void CUCode_Rom::HandleMail(u32 _uMail)
|
||||
{
|
||||
if (m_NextParameter == 0)
|
||||
{
|
||||
// wait for beginning of UCode
|
||||
if ((_uMail & 0xFFFF0000) != 0x80F30000)
|
||||
{
|
||||
u32 Message = 0xFEEE0000 | (_uMail & 0xFFFF);
|
||||
m_rMailHandler.PushMail(Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextParameter = _uMail;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_NextParameter)
|
||||
{
|
||||
case 0x80F3A001:
|
||||
m_CurrentUCode.m_RAMAddress = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3A002:
|
||||
m_CurrentUCode.m_Length = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3C002:
|
||||
m_CurrentUCode.m_IMEMAddress = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3B002:
|
||||
m_CurrentUCode.m_Unk = _uMail;
|
||||
break;
|
||||
|
||||
case 0x80F3D001:
|
||||
{
|
||||
m_CurrentUCode.m_StartPC = _uMail;
|
||||
BootUCode();
|
||||
return; // FIXES THE OVERWRITE
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// THE GODDAMN OVERWRITE WAS HERE. Without the return above, since BootUCode may delete "this", well ...
|
||||
m_NextParameter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CUCode_Rom::BootUCode()
|
||||
{
|
||||
// simple non-scientific crc invented by ector :P
|
||||
// too annoying to change now, and probably good enough anyway
|
||||
u32 crc = 0;
|
||||
|
||||
for (u32 i = 0; i < m_CurrentUCode.m_Length; i++)
|
||||
{
|
||||
crc ^= Memory_Read_U8(m_CurrentUCode.m_RAMAddress + i);
|
||||
//let's rol
|
||||
crc = (crc << 3) | (crc >> 29);
|
||||
}
|
||||
|
||||
DebugLog("CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress);
|
||||
DebugLog("CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length);
|
||||
DebugLog("CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress);
|
||||
DebugLog("CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk);
|
||||
DebugLog("CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC);
|
||||
DebugLog("CurrentUCode CRC: 0x%08x", crc);
|
||||
DebugLog("BootTask - done");
|
||||
|
||||
CDSPHandler::GetInstance().SetUCode(crc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,166 +1,166 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// Games that uses this UCode:
|
||||
// Zelda: The Windwaker, Mario Sunshine, Mario Kart
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_Zelda.h"
|
||||
#include "../MailHandler.h"
|
||||
|
||||
|
||||
CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_numSteps(0)
|
||||
, m_bListInProgress(false)
|
||||
, m_step(0)
|
||||
, m_readOffset(0)
|
||||
{
|
||||
DebugLog("UCode_Zelda - add boot mails for handshake");
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
m_rMailHandler.PushMail(0x80000000); // handshake
|
||||
memset(m_Buffer, 0, sizeof(m_Buffer));
|
||||
}
|
||||
|
||||
|
||||
CUCode_Zelda::~CUCode_Zelda()
|
||||
{
|
||||
m_rMailHandler.Clear();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Zelda::Update()
|
||||
{
|
||||
// check if we have to sent something
|
||||
if (!m_rMailHandler.IsEmpty())
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Zelda::HandleMail(u32 _uMail)
|
||||
{
|
||||
if (m_bListInProgress == false)
|
||||
{
|
||||
m_bListInProgress = true;
|
||||
m_numSteps = _uMail;
|
||||
m_step = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_step < 0 || m_step >= sizeof(m_Buffer)/4)
|
||||
PanicAlert("m_step out of range");
|
||||
((u32*)m_Buffer)[m_step] = _uMail;
|
||||
m_step++;
|
||||
|
||||
if (m_step == m_numSteps)
|
||||
{
|
||||
ExecuteList();
|
||||
m_bListInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Zelda::ExecuteList()
|
||||
{
|
||||
// begin with the list
|
||||
m_readOffset = 0;
|
||||
|
||||
u32 Temp = Read32();
|
||||
u32 Command = (Temp >> 24) & 0x7f;
|
||||
u32 Sync = Temp >> 16;
|
||||
|
||||
DebugLog("==============================================================================");
|
||||
DebugLog("Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync);
|
||||
|
||||
switch (Command)
|
||||
{
|
||||
// DsetupTable ... zelda ww jumps to 0x0095
|
||||
case 0x01:
|
||||
{
|
||||
u32 tmp[4];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
tmp[3] = Read32();
|
||||
|
||||
DebugLog("DsetupTable");
|
||||
DebugLog("???: 0x%08x", tmp[0]);
|
||||
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
|
||||
DebugLog("???: 0x%08x", tmp[3]);
|
||||
}
|
||||
break;
|
||||
|
||||
// SyncFrame ... zelda ww jumps to 0x0243
|
||||
case 0x02:
|
||||
{
|
||||
u32 tmp[3];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
|
||||
DebugLog("DsyncFrame");
|
||||
DebugLog("???: 0x%08x", tmp[0]);
|
||||
DebugLog("???: 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case 0x03: break; // dunno ... zelda ww jmps to 0x0073
|
||||
case 0x04: break; // dunno ... zelda ww jmps to 0x0580
|
||||
case 0x05: break; // dunno ... zelda ww jmps to 0x0592
|
||||
case 0x06: break; // dunno ... zelda ww jmps to 0x0469
|
||||
|
||||
case 0x07: break; // dunno ... zelda ww jmps to 0x044d
|
||||
case 0x08: break; // Mixer ... zelda ww jmps to 0x0485
|
||||
case 0x09: break; // dunno ... zelda ww jmps to 0x044d
|
||||
*/
|
||||
|
||||
// DsetDolbyDelay ... zelda ww jumps to 0x00b2
|
||||
case 0x0d:
|
||||
{
|
||||
u32 tmp[2];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
|
||||
DebugLog("DSetDolbyDelay");
|
||||
DebugLog("DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]);
|
||||
DebugLog("DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
// Set VARAM
|
||||
case 0x0e:
|
||||
// MessageBox(NULL, "Zelda VARAM", "cmd", MB_OK);
|
||||
break;
|
||||
|
||||
// default ... zelda ww jumps to 0x0043
|
||||
default:
|
||||
PanicAlert("Zelda UCode - unknown cmd: %x (size %i)", Command, m_numSteps);
|
||||
break;
|
||||
}
|
||||
|
||||
// sync, we are rdy
|
||||
m_rMailHandler.PushMail(DSP_SYNC);
|
||||
m_rMailHandler.PushMail(0xF3550000 | Sync);
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// Games that uses this UCode:
|
||||
// Zelda: The Windwaker, Mario Sunshine, Mario Kart
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
#include "UCodes.h"
|
||||
#include "UCode_Zelda.h"
|
||||
#include "../MailHandler.h"
|
||||
|
||||
|
||||
CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler)
|
||||
: IUCode(_rMailHandler)
|
||||
, m_numSteps(0)
|
||||
, m_bListInProgress(false)
|
||||
, m_step(0)
|
||||
, m_readOffset(0)
|
||||
{
|
||||
DebugLog("UCode_Zelda - add boot mails for handshake");
|
||||
m_rMailHandler.PushMail(DSP_INIT);
|
||||
m_rMailHandler.PushMail(0x80000000); // handshake
|
||||
memset(m_Buffer, 0, sizeof(m_Buffer));
|
||||
}
|
||||
|
||||
|
||||
CUCode_Zelda::~CUCode_Zelda()
|
||||
{
|
||||
m_rMailHandler.Clear();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Zelda::Update()
|
||||
{
|
||||
// check if we have to sent something
|
||||
if (!m_rMailHandler.IsEmpty())
|
||||
g_dspInitialize.pGenerateDSPInterrupt();
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Zelda::HandleMail(u32 _uMail)
|
||||
{
|
||||
if (m_bListInProgress == false)
|
||||
{
|
||||
m_bListInProgress = true;
|
||||
m_numSteps = _uMail;
|
||||
m_step = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_step < 0 || m_step >= sizeof(m_Buffer)/4)
|
||||
PanicAlert("m_step out of range");
|
||||
((u32*)m_Buffer)[m_step] = _uMail;
|
||||
m_step++;
|
||||
|
||||
if (m_step == m_numSteps)
|
||||
{
|
||||
ExecuteList();
|
||||
m_bListInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CUCode_Zelda::ExecuteList()
|
||||
{
|
||||
// begin with the list
|
||||
m_readOffset = 0;
|
||||
|
||||
u32 Temp = Read32();
|
||||
u32 Command = (Temp >> 24) & 0x7f;
|
||||
u32 Sync = Temp >> 16;
|
||||
|
||||
DebugLog("==============================================================================");
|
||||
DebugLog("Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync);
|
||||
|
||||
switch (Command)
|
||||
{
|
||||
// DsetupTable ... zelda ww jumps to 0x0095
|
||||
case 0x01:
|
||||
{
|
||||
u32 tmp[4];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
tmp[3] = Read32();
|
||||
|
||||
DebugLog("DsetupTable");
|
||||
DebugLog("???: 0x%08x", tmp[0]);
|
||||
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
|
||||
DebugLog("???: 0x%08x", tmp[3]);
|
||||
}
|
||||
break;
|
||||
|
||||
// SyncFrame ... zelda ww jumps to 0x0243
|
||||
case 0x02:
|
||||
{
|
||||
u32 tmp[3];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
tmp[2] = Read32();
|
||||
|
||||
DebugLog("DsyncFrame");
|
||||
DebugLog("???: 0x%08x", tmp[0]);
|
||||
DebugLog("???: 0x%08x", tmp[1]);
|
||||
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case 0x03: break; // dunno ... zelda ww jmps to 0x0073
|
||||
case 0x04: break; // dunno ... zelda ww jmps to 0x0580
|
||||
case 0x05: break; // dunno ... zelda ww jmps to 0x0592
|
||||
case 0x06: break; // dunno ... zelda ww jmps to 0x0469
|
||||
|
||||
case 0x07: break; // dunno ... zelda ww jmps to 0x044d
|
||||
case 0x08: break; // Mixer ... zelda ww jmps to 0x0485
|
||||
case 0x09: break; // dunno ... zelda ww jmps to 0x044d
|
||||
*/
|
||||
|
||||
// DsetDolbyDelay ... zelda ww jumps to 0x00b2
|
||||
case 0x0d:
|
||||
{
|
||||
u32 tmp[2];
|
||||
tmp[0] = Read32();
|
||||
tmp[1] = Read32();
|
||||
|
||||
DebugLog("DSetDolbyDelay");
|
||||
DebugLog("DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]);
|
||||
DebugLog("DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]);
|
||||
}
|
||||
break;
|
||||
|
||||
// Set VARAM
|
||||
case 0x0e:
|
||||
// MessageBox(NULL, "Zelda VARAM", "cmd", MB_OK);
|
||||
break;
|
||||
|
||||
// default ... zelda ww jumps to 0x0043
|
||||
default:
|
||||
PanicAlert("Zelda UCode - unknown cmd: %x (size %i)", Command, m_numSteps);
|
||||
break;
|
||||
}
|
||||
|
||||
// sync, we are rdy
|
||||
m_rMailHandler.PushMail(DSP_SYNC);
|
||||
m_rMailHandler.PushMail(0xF3550000 | Sync);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,87 +1,87 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
|
||||
#include "UCodes.h"
|
||||
|
||||
#include "UCode_AX.h"
|
||||
#include "UCode_Zelda.h"
|
||||
#include "UCode_Jac.h"
|
||||
#include "UCode_ROM.h"
|
||||
#include "UCode_CARD.h"
|
||||
#include "UCode_InitAudioSystem.h"
|
||||
|
||||
IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
|
||||
{
|
||||
switch (_CRC)
|
||||
{
|
||||
case UCODE_ROM:
|
||||
return new CUCode_Rom(_rMailHandler);
|
||||
|
||||
case UCODE_INIT_AUDIO_SYSTEM:
|
||||
return new CUCode_InitAudioSystem(_rMailHandler);
|
||||
|
||||
case 0x65d6cc6f: // CARD
|
||||
return new CUCode_CARD(_rMailHandler);
|
||||
|
||||
case 0x088e38a5: // IPL - JAP
|
||||
case 0xd73338cf: // IPL
|
||||
case 0x42f64ac4: // Luigi (after fix)
|
||||
case 0x4be6a5cb: // AC, Pikmin (after fix)
|
||||
DebugLog("JAC ucode chosen");
|
||||
return new CUCode_Jac(_rMailHandler);
|
||||
|
||||
case 0x3ad3b7ac: // Naruto3
|
||||
case 0x3daf59b9: // Alien Hominid
|
||||
case 0x4e8a8b21: // spdemo, ctaxi, 18 wheeler, disney, monkeyball2,cubivore,puzzlecollection,wario,
|
||||
// capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat,
|
||||
// smugglers run warzone, smash brothers, sonic mega collection, ZooCube
|
||||
// nddemo, starfox
|
||||
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
|
||||
// Zelda:OOT, Tony hawk, viewtiful joe
|
||||
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
|
||||
DebugLog("AX ucode chosen, yay!");
|
||||
return new CUCode_AX(_rMailHandler);
|
||||
|
||||
case 0x6CA33A6D: // DK Jungle Beat
|
||||
case 0x86840740: // zelda
|
||||
case 0x56d36052: // mario
|
||||
case 0x2fcdf1ec: // mariokart, zelda 4 swords
|
||||
DebugLog("Zelda ucode chosen");
|
||||
return new CUCode_Zelda(_rMailHandler);
|
||||
|
||||
// WII CRCs
|
||||
case 0x6c3f6f94: // zelda - PAL
|
||||
case 0xd643001f: // mario galaxy - PAL
|
||||
DebugLog("Zelda Wii ucode chosen");
|
||||
return new CUCode_Zelda(_rMailHandler);
|
||||
|
||||
case 0x347112ba: // raving rabbits
|
||||
DebugLog("Wii - AX chosen");
|
||||
return new CUCode_AX(_rMailHandler, true);
|
||||
|
||||
default:
|
||||
PanicAlert("Unknown ucode (CRC = %08x) - forcing AX", _CRC);
|
||||
return new CUCode_AX(_rMailHandler);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "../Globals.h"
|
||||
|
||||
#include "UCodes.h"
|
||||
|
||||
#include "UCode_AX.h"
|
||||
#include "UCode_Zelda.h"
|
||||
#include "UCode_Jac.h"
|
||||
#include "UCode_ROM.h"
|
||||
#include "UCode_CARD.h"
|
||||
#include "UCode_InitAudioSystem.h"
|
||||
|
||||
IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
|
||||
{
|
||||
switch (_CRC)
|
||||
{
|
||||
case UCODE_ROM:
|
||||
return new CUCode_Rom(_rMailHandler);
|
||||
|
||||
case UCODE_INIT_AUDIO_SYSTEM:
|
||||
return new CUCode_InitAudioSystem(_rMailHandler);
|
||||
|
||||
case 0x65d6cc6f: // CARD
|
||||
return new CUCode_CARD(_rMailHandler);
|
||||
|
||||
case 0x088e38a5: // IPL - JAP
|
||||
case 0xd73338cf: // IPL
|
||||
case 0x42f64ac4: // Luigi (after fix)
|
||||
case 0x4be6a5cb: // AC, Pikmin (after fix)
|
||||
DebugLog("JAC ucode chosen");
|
||||
return new CUCode_Jac(_rMailHandler);
|
||||
|
||||
case 0x3ad3b7ac: // Naruto3
|
||||
case 0x3daf59b9: // Alien Hominid
|
||||
case 0x4e8a8b21: // spdemo, ctaxi, 18 wheeler, disney, monkeyball2,cubivore,puzzlecollection,wario,
|
||||
// capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat,
|
||||
// smugglers run warzone, smash brothers, sonic mega collection, ZooCube
|
||||
// nddemo, starfox
|
||||
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
|
||||
// Zelda:OOT, Tony hawk, viewtiful joe
|
||||
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
|
||||
DebugLog("AX ucode chosen, yay!");
|
||||
return new CUCode_AX(_rMailHandler);
|
||||
|
||||
case 0x6CA33A6D: // DK Jungle Beat
|
||||
case 0x86840740: // zelda
|
||||
case 0x56d36052: // mario
|
||||
case 0x2fcdf1ec: // mariokart, zelda 4 swords
|
||||
DebugLog("Zelda ucode chosen");
|
||||
return new CUCode_Zelda(_rMailHandler);
|
||||
|
||||
// WII CRCs
|
||||
case 0x6c3f6f94: // zelda - PAL
|
||||
case 0xd643001f: // mario galaxy - PAL
|
||||
DebugLog("Zelda Wii ucode chosen");
|
||||
return new CUCode_Zelda(_rMailHandler);
|
||||
|
||||
case 0x347112ba: // raving rabbits
|
||||
DebugLog("Wii - AX chosen");
|
||||
return new CUCode_AX(_rMailHandler, true);
|
||||
|
||||
default:
|
||||
PanicAlert("Unknown ucode (CRC = %08x) - forcing AX", _CRC);
|
||||
return new CUCode_AX(_rMailHandler);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,203 +1,203 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
//#include "Common.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "pluginspecs_dsp.h"
|
||||
|
||||
#include "DSPHandler.h"
|
||||
|
||||
DSPInitialize g_dspInitialize;
|
||||
u8* g_pMemory;
|
||||
|
||||
struct DSPState
|
||||
{
|
||||
u32 CPUMailbox;
|
||||
bool CPUMailbox_Written[2];
|
||||
|
||||
u32 DSPMailbox;
|
||||
bool DSPMailbox_Read[2];
|
||||
|
||||
DSPState()
|
||||
{
|
||||
CPUMailbox = 0x00000000;
|
||||
CPUMailbox_Written[0] = false;
|
||||
CPUMailbox_Written[1] = false;
|
||||
|
||||
DSPMailbox = 0x00000000;
|
||||
DSPMailbox_Read[0] = true;
|
||||
DSPMailbox_Read[1] = true;
|
||||
}
|
||||
};
|
||||
|
||||
DSPState g_dspState;
|
||||
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance = NULL;
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DllDebugger(HWND _hParent)
|
||||
{
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
_PluginInfo->Type = PLUGIN_TYPE_DSP;
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (DebugFast) ");
|
||||
#else
|
||||
#ifndef _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin ");
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (Debug) ");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllAbout(HWND _hParent)
|
||||
{
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
}
|
||||
|
||||
void DSP_Initialize(DSPInitialize _dspInitialize)
|
||||
{
|
||||
g_dspInitialize = _dspInitialize;
|
||||
|
||||
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
|
||||
|
||||
CDSPHandler::CreateInstance();
|
||||
}
|
||||
|
||||
void DSP_Shutdown()
|
||||
{
|
||||
|
||||
CDSPHandler::Destroy();
|
||||
}
|
||||
|
||||
void DSP_DoState(unsigned char **ptr, int mode) {
|
||||
PointerWrap p(ptr, mode);
|
||||
}
|
||||
|
||||
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
return (g_dspState.CPUMailbox >> 16) & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
return g_dspState.CPUMailbox & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow();
|
||||
}
|
||||
}
|
||||
|
||||
void Update_DSP_WriteRegister()
|
||||
{
|
||||
// check if the whole message is complete and if we can send it
|
||||
if (g_dspState.CPUMailbox_Written[0] && g_dspState.CPUMailbox_Written[1])
|
||||
{
|
||||
CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox);
|
||||
g_dspState.CPUMailbox_Written[0] = g_dspState.CPUMailbox_Written[1] = false;
|
||||
g_dspState.CPUMailbox = 0; // Mail sent so clear it to show that it is progressed
|
||||
}
|
||||
}
|
||||
|
||||
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
|
||||
g_dspState.CPUMailbox_Written[0] = true;
|
||||
|
||||
Update_DSP_WriteRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
||||
}
|
||||
}
|
||||
|
||||
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value;
|
||||
g_dspState.CPUMailbox_Written[1] = true;
|
||||
|
||||
Update_DSP_WriteRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short DSP_WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
return CDSPHandler::GetInstance().WriteControlRegister(_Value);
|
||||
}
|
||||
|
||||
unsigned short DSP_ReadControlRegister()
|
||||
{
|
||||
return CDSPHandler::GetInstance().ReadControlRegister();
|
||||
}
|
||||
|
||||
void DSP_Update(int cycles)
|
||||
{
|
||||
CDSPHandler::GetInstance().Update();
|
||||
}
|
||||
|
||||
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
|
||||
{
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
//#include "Common.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "pluginspecs_dsp.h"
|
||||
|
||||
#include "DSPHandler.h"
|
||||
|
||||
DSPInitialize g_dspInitialize;
|
||||
u8* g_pMemory;
|
||||
|
||||
struct DSPState
|
||||
{
|
||||
u32 CPUMailbox;
|
||||
bool CPUMailbox_Written[2];
|
||||
|
||||
u32 DSPMailbox;
|
||||
bool DSPMailbox_Read[2];
|
||||
|
||||
DSPState()
|
||||
{
|
||||
CPUMailbox = 0x00000000;
|
||||
CPUMailbox_Written[0] = false;
|
||||
CPUMailbox_Written[1] = false;
|
||||
|
||||
DSPMailbox = 0x00000000;
|
||||
DSPMailbox_Read[0] = true;
|
||||
DSPMailbox_Read[1] = true;
|
||||
}
|
||||
};
|
||||
|
||||
DSPState g_dspState;
|
||||
|
||||
#ifdef _WIN32
|
||||
HINSTANCE g_hInstance = NULL;
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void DllDebugger(HWND _hParent)
|
||||
{
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
_PluginInfo->Type = PLUGIN_TYPE_DSP;
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (DebugFast) ");
|
||||
#else
|
||||
#ifndef _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin ");
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (Debug) ");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllAbout(HWND _hParent)
|
||||
{
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
}
|
||||
|
||||
void DSP_Initialize(DSPInitialize _dspInitialize)
|
||||
{
|
||||
g_dspInitialize = _dspInitialize;
|
||||
|
||||
g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
|
||||
|
||||
CDSPHandler::CreateInstance();
|
||||
}
|
||||
|
||||
void DSP_Shutdown()
|
||||
{
|
||||
|
||||
CDSPHandler::Destroy();
|
||||
}
|
||||
|
||||
void DSP_DoState(unsigned char **ptr, int mode) {
|
||||
PointerWrap p(ptr, mode);
|
||||
}
|
||||
|
||||
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
return (g_dspState.CPUMailbox >> 16) & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxHigh();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
return g_dspState.CPUMailbox & 0xFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CDSPHandler::GetInstance().AccessMailHandler().ReadDSPMailboxLow();
|
||||
}
|
||||
}
|
||||
|
||||
void Update_DSP_WriteRegister()
|
||||
{
|
||||
// check if the whole message is complete and if we can send it
|
||||
if (g_dspState.CPUMailbox_Written[0] && g_dspState.CPUMailbox_Written[1])
|
||||
{
|
||||
CDSPHandler::GetInstance().SendMailToDSP(g_dspState.CPUMailbox);
|
||||
g_dspState.CPUMailbox_Written[0] = g_dspState.CPUMailbox_Written[1] = false;
|
||||
g_dspState.CPUMailbox = 0; // Mail sent so clear it to show that it is progressed
|
||||
}
|
||||
}
|
||||
|
||||
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF) | (_Value << 16);
|
||||
g_dspState.CPUMailbox_Written[0] = true;
|
||||
|
||||
Update_DSP_WriteRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
||||
}
|
||||
}
|
||||
|
||||
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value)
|
||||
{
|
||||
if (_CPUMailbox)
|
||||
{
|
||||
g_dspState.CPUMailbox = (g_dspState.CPUMailbox & 0xFFFF0000) | _Value;
|
||||
g_dspState.CPUMailbox_Written[1] = true;
|
||||
|
||||
Update_DSP_WriteRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("CPU can't write %08x to DSP mailbox", _Value);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short DSP_WriteControlRegister(unsigned short _Value)
|
||||
{
|
||||
return CDSPHandler::GetInstance().WriteControlRegister(_Value);
|
||||
}
|
||||
|
||||
unsigned short DSP_ReadControlRegister()
|
||||
{
|
||||
return CDSPHandler::GetInstance().ReadControlRegister();
|
||||
}
|
||||
|
||||
void DSP_Update(int cycles)
|
||||
{
|
||||
CDSPHandler::GetInstance().Update();
|
||||
}
|
||||
|
||||
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user