Remove all tab/space mismatches from the Core project. For anyone working on a branch that heavily involves the core, I am so sorry.

- Also killed off some trailing spaces/tabs.

- Updated the license header to be consistent with the rest of the project (All projects are now done moving over to this)

- Also, killed some dangling else's (where appropriate)

Now all the tab fixing is done. No more of this crap should be needed to be pushed. Rejoice!
This commit is contained in:
Lioncash 2013-04-16 23:14:36 -04:00
parent f498686289
commit 2316cb6876
324 changed files with 3133 additions and 2569 deletions

View File

@ -16,7 +16,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "ARDecrypt.h" #include "ARDecrypt.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _ARDECRYPT_H_ #ifndef _ARDECRYPT_H_
#define _ARDECRYPT_H_ #define _ARDECRYPT_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
@ -191,14 +191,16 @@ void LoadCodes(IniFile &ini, bool forceLoad)
{ {
AREntry op; AREntry op;
bool success_addr = TryParse(std::string("0x") + pieces[0], &op.cmd_addr); bool success_addr = TryParse(std::string("0x") + pieces[0], &op.cmd_addr);
bool success_val = TryParse(std::string("0x") + pieces[1], &op.value); bool success_val = TryParse(std::string("0x") + pieces[1], &op.value);
if (!(success_addr | success_val)) { if (!(success_addr | success_val)) {
PanicAlertT("Action Replay Error: invalid AR code line: %s", line.c_str()); PanicAlertT("Action Replay Error: invalid AR code line: %s", line.c_str());
if (!success_addr) PanicAlertT("The address is invalid"); if (!success_addr) PanicAlertT("The address is invalid");
if (!success_val) PanicAlertT("The value is invalid"); if (!success_val) PanicAlertT("The value is invalid");
} }
else else
{
currentCode.ops.push_back(op); currentCode.ops.push_back(op);
}
} }
else else
{ {

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _ACTIONREPLAY_H_ #ifndef _ACTIONREPLAY_H_

View File

@ -53,7 +53,8 @@
void CBoot::Load_FST(bool _bIsWii) void CBoot::Load_FST(bool _bIsWii)
{ {
if (!VolumeHandler::IsValid()) return; if (!VolumeHandler::IsValid())
return;
// copy first 20 bytes of disc to start of Mem 1 // copy first 20 bytes of disc to start of Mem 1
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20); VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
@ -108,7 +109,7 @@ std::string CBoot::GenerateMapFilename()
return File::GetUserPath(D_MAPS_IDX) + _StartupPara.GetUniqueID() + ".map"; return File::GetUserPath(D_MAPS_IDX) + _StartupPara.GetUniqueID() + ".map";
} }
return std::string("unknown map"); return std::string("unknown map");
} }
bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_gameID) bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_gameID)
@ -119,7 +120,7 @@ bool CBoot::LoadMapFromFilename(const std::string &_rFilename, const char *_game
std::string strMapFilename = GenerateMapFilename(); std::string strMapFilename = GenerateMapFilename();
bool success = false; bool success = false;
if (!g_symbolDB.LoadMap(strMapFilename.c_str())) if (!g_symbolDB.LoadMap(strMapFilename.c_str()))
{ {
if (_gameID != NULL) if (_gameID != NULL)
{ {
@ -184,7 +185,7 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
Memory::WriteBigEData((const u8*)data.data() + 0x100, 0x81200000, 0x700); Memory::WriteBigEData((const u8*)data.data() + 0x100, 0x81200000, 0x700);
Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, 0x1AFE00); Memory::WriteBigEData((const u8*)data.data() + 0x820, 0x81300000, 0x1AFE00);
PC = 0x81200000; PC = 0x81200000;
return true; return true;
} }
@ -321,7 +322,7 @@ bool CBoot::BootUp()
if (LoadMapFromFilename(_StartupPara.m_strFilename)) if (LoadMapFromFilename(_StartupPara.m_strFilename))
HLE::PatchFunctions(); HLE::PatchFunctions();
break; break;
} }
// ELF // ELF

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BOOT_H #ifndef _BOOT_H
@ -43,10 +43,10 @@ private:
static bool EmulatedBS2_GC(); static bool EmulatedBS2_GC();
static bool EmulatedBS2_Wii(); static bool EmulatedBS2_Wii();
static bool EmulatedBS2(bool _bIsWii); static bool EmulatedBS2(bool _bIsWii);
static bool Load_BS2(const std::string& _rBootROMFilename); static bool Load_BS2(const std::string& _rBootROMFilename);
static void Load_FST(bool _bIsWii); static void Load_FST(bool _bIsWii);
static bool SetupWiiMemory(unsigned int _CountryCode); static bool SetupWiiMemory(unsigned int _CountryCode);
}; };
#endif #endif

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -187,10 +187,10 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
switch((DiscIO::IVolume::ECountry)_CountryCode) switch((DiscIO::IVolume::ECountry)_CountryCode)
{ {
case DiscIO::IVolume::COUNTRY_KOREA: case DiscIO::IVolume::COUNTRY_KOREA:
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_KOR_SETTING; region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_KOR_SETTING;
break; break;
case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::IVolume::COUNTRY_TAIWAN:
// TODO: Determine if Taiwan has their own specific settings. // TODO: Determine if Taiwan has their own specific settings.
case DiscIO::IVolume::COUNTRY_JAPAN: case DiscIO::IVolume::COUNTRY_JAPAN:
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING; region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING;
break; break;
@ -234,7 +234,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
0x80000038 Start of FST 0x80000038 Start of FST
0x8000003c Size of FST Size 0x8000003c Size of FST Size
0x80000060 Copyright code 0x80000060 Copyright code
*/ */
DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20); // Game Code DVDInterface::DVDRead(0x00000000, 0x00000000, 0x20); // Game Code
Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word Memory::Write_U32(0x0D15EA5E, 0x00000020); // Another magic word
@ -297,7 +297,7 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
// copy the apploader to 0x81200000 // copy the apploader to 0x81200000
// execute the apploader // execute the apploader
bool CBoot::EmulatedBS2_Wii() bool CBoot::EmulatedBS2_Wii()
{ {
INFO_LOG(BOOT, "Faking Wii BS2..."); INFO_LOG(BOOT, "Faking Wii BS2...");
// setup wii memory // setup wii memory

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Boot_DOL.h" #include "Boot_DOL.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BOOT_DOL_H #ifndef _BOOT_DOL_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"
@ -63,7 +63,7 @@ bool CBoot::IsElfWii(const char *filename)
} }
delete[] mem; delete[] mem;
return isWii; return isWii;
} }
@ -92,5 +92,5 @@ bool CBoot::Boot_ELF(const char *filename)
PC = reader.GetEntryPoint(); PC = reader.GetEntryPoint();
delete[] mem; delete[] mem;
return true; return true;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#pragma once #pragma once

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Boot.h" #include "Boot.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <string> #include <string>

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _ELFREADER_H #ifndef _ELFREADER_H

View File

@ -189,59 +189,59 @@ typedef unsigned int Elf32_Word;
// ELF file header // ELF file header
struct Elf32_Ehdr struct Elf32_Ehdr
{ {
unsigned char e_ident[EI_NIDENT]; unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type; Elf32_Half e_type;
Elf32_Half e_machine; Elf32_Half e_machine;
Elf32_Word e_version; Elf32_Word e_version;
Elf32_Addr e_entry; Elf32_Addr e_entry;
Elf32_Off e_phoff; Elf32_Off e_phoff;
Elf32_Off e_shoff; Elf32_Off e_shoff;
Elf32_Word e_flags; Elf32_Word e_flags;
Elf32_Half e_ehsize; Elf32_Half e_ehsize;
Elf32_Half e_phentsize; Elf32_Half e_phentsize;
Elf32_Half e_phnum; Elf32_Half e_phnum;
Elf32_Half e_shentsize; Elf32_Half e_shentsize;
Elf32_Half e_shnum; Elf32_Half e_shnum;
Elf32_Half e_shstrndx; Elf32_Half e_shstrndx;
}; };
// Section header // Section header
struct Elf32_Shdr struct Elf32_Shdr
{ {
Elf32_Word sh_name; Elf32_Word sh_name;
Elf32_Word sh_type; Elf32_Word sh_type;
Elf32_Word sh_flags; Elf32_Word sh_flags;
Elf32_Addr sh_addr; Elf32_Addr sh_addr;
Elf32_Off sh_offset; Elf32_Off sh_offset;
Elf32_Word sh_size; Elf32_Word sh_size;
Elf32_Word sh_link; Elf32_Word sh_link;
Elf32_Word sh_info; Elf32_Word sh_info;
Elf32_Word sh_addralign; Elf32_Word sh_addralign;
Elf32_Word sh_entsize; Elf32_Word sh_entsize;
}; };
// Segment header // Segment header
struct Elf32_Phdr struct Elf32_Phdr
{ {
Elf32_Word p_type; Elf32_Word p_type;
Elf32_Off p_offset; Elf32_Off p_offset;
Elf32_Addr p_vaddr; Elf32_Addr p_vaddr;
Elf32_Addr p_paddr; Elf32_Addr p_paddr;
Elf32_Word p_filesz; Elf32_Word p_filesz;
Elf32_Word p_memsz; Elf32_Word p_memsz;
Elf32_Word p_flags; Elf32_Word p_flags;
Elf32_Word p_align; Elf32_Word p_align;
}; };
// Symbol table entry // Symbol table entry
struct Elf32_Sym struct Elf32_Sym
{ {
Elf32_Word st_name; Elf32_Word st_name;
Elf32_Addr st_value; Elf32_Addr st_value;
Elf32_Word st_size; Elf32_Word st_size;
unsigned char st_info; unsigned char st_info;
unsigned char st_other; unsigned char st_other;
Elf32_Half st_shndx; Elf32_Half st_shndx;
}; };
#define ELF32_ST_BIND(i) ((i)>>4) #define ELF32_ST_BIND(i) ((i)>>4)
@ -251,15 +251,15 @@ struct Elf32_Sym
// Relocation entries // Relocation entries
struct Elf32_Rel struct Elf32_Rel
{ {
Elf32_Addr r_offset; Elf32_Addr r_offset;
Elf32_Word r_info; Elf32_Word r_info;
}; };
struct Elf32_Rela struct Elf32_Rela
{ {
Elf32_Addr r_offset; Elf32_Addr r_offset;
Elf32_Word r_info; Elf32_Word r_info;
Elf32_Sword r_addend; Elf32_Sword r_addend;
}; };
#define ELF32_R_SYM(i) ((i)>>8) #define ELF32_R_SYM(i) ((i)>>8)
@ -273,8 +273,8 @@ struct Elf32_Dyn
union union
{ {
Elf32_Word d_val; Elf32_Word d_val;
Elf32_Addr d_ptr; Elf32_Addr d_ptr;
} d_un; } d_un;
}; };
#endif #endif

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// File description // File description
@ -78,7 +78,8 @@ bool BootCore(const std::string& _rFilename)
StartUp.hInstance = Host_GetInstance(); StartUp.hInstance = Host_GetInstance();
// If for example the ISO file is bad we return here // If for example the ISO file is bad we return here
if (!StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT)) return false; if (!StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT))
return false;
// Load game specific settings // Load game specific settings
IniFile game_ini; IniFile game_ini;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _BOOTMANAGER_H #ifndef _BOOTMANAGER_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <string> #include <string>
@ -37,17 +37,17 @@ static const struct {
{ "RefreshList", 0, 0 /* wxMOD_NONE */ }, { "RefreshList", 0, 0 /* wxMOD_NONE */ },
{ "PlayPause", 80 /* 'P' */, 2 /* wxMOD_CMD */ }, { "PlayPause", 80 /* 'P' */, 2 /* wxMOD_CMD */ },
{ "Stop", 87 /* 'W' */, 2 /* wxMOD_CMD */ }, { "Stop", 87 /* 'W' */, 2 /* wxMOD_CMD */ },
{ "Reset", 0, 0 /* wxMOD_NONE */ }, { "Reset", 0, 0 /* wxMOD_NONE */ },
{ "FrameAdvance", 0, 0 /* wxMOD_NONE */ }, { "FrameAdvance", 0, 0 /* wxMOD_NONE */ },
{ "StartRecording", 0, 0 /* wxMOD_NONE */ }, { "StartRecording", 0, 0 /* wxMOD_NONE */ },
{ "PlayRecording", 0, 0 /* wxMOD_NONE */ }, { "PlayRecording", 0, 0 /* wxMOD_NONE */ },
{ "ExportRecording", 0, 0 /* wxMOD_NONE */ }, { "ExportRecording", 0, 0 /* wxMOD_NONE */ },
{ "Readonlymode", 0, 0 /* wxMOD_NONE */ }, { "Readonlymode", 0, 0 /* wxMOD_NONE */ },
{ "ToggleFullscreen", 70 /* 'F' */, 2 /* wxMOD_CMD */ }, { "ToggleFullscreen", 70 /* 'F' */, 2 /* wxMOD_CMD */ },
{ "Screenshot", 83 /* 'S' */, 2 /* wxMOD_CMD */ }, { "Screenshot", 83 /* 'S' */, 2 /* wxMOD_CMD */ },
{ "Wiimote1Connect", 49 /* '1' */, 2 /* wxMOD_CMD */ }, { "Wiimote1Connect", 49 /* '1' */, 2 /* wxMOD_CMD */ },
{ "Wiimote2Connect", 50 /* '2' */, 2 /* wxMOD_CMD */ }, { "Wiimote2Connect", 50 /* '2' */, 2 /* wxMOD_CMD */ },
@ -60,12 +60,12 @@ static const struct {
{ "PlayPause", 349 /* WXK_F10 */, 0 /* wxMOD_NONE */ }, { "PlayPause", 349 /* WXK_F10 */, 0 /* wxMOD_NONE */ },
{ "Stop", 27 /* WXK_ESCAPE */, 0 /* wxMOD_NONE */ }, { "Stop", 27 /* WXK_ESCAPE */, 0 /* wxMOD_NONE */ },
{ "Reset", 0, 0 /* wxMOD_NONE */ }, { "Reset", 0, 0 /* wxMOD_NONE */ },
{ "FrameAdvance", 0, 0 /* wxMOD_NONE */ }, { "FrameAdvance", 0, 0 /* wxMOD_NONE */ },
{ "StartRecording", 0, 0 /* wxMOD_NONE */ }, { "StartRecording", 0, 0 /* wxMOD_NONE */ },
{ "PlayRecording", 0, 0 /* wxMOD_NONE */ }, { "PlayRecording", 0, 0 /* wxMOD_NONE */ },
{ "ExportRecording", 0, 0 /* wxMOD_NONE */ }, { "ExportRecording",0, 0 /* wxMOD_NONE */ },
{ "Readonlymode", 0, 0 /* wxMOD_NONE */ }, { "Readonlymode", 0, 0 /* wxMOD_NONE */ },
{ "ToggleFullscreen", 13 /* WXK_RETURN */, 1 /* wxMOD_ALT */ }, { "ToggleFullscreen", 13 /* WXK_RETURN */, 1 /* wxMOD_ALT */ },
@ -155,7 +155,7 @@ void SConfig::SaveSettings()
ini.Set("General", "NANDRoot", m_NANDPath); ini.Set("General", "NANDRoot", m_NANDPath);
ini.Set("General", "WirelessMac", m_WirelessMac); ini.Set("General", "WirelessMac", m_WirelessMac);
// Interface // Interface
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop); ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers); ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages); ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CONFIGMANAGER_H #ifndef _CONFIGMANAGER_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <iostream> #include <iostream>
@ -150,5 +150,7 @@ void Console_Submit(const char *cmd)
g_symbolDB.List(); g_symbolDB.List();
} }
else else
{
ERROR_LOG(CONSOLE, "Invalid command"); ERROR_LOG(CONSOLE, "Invalid command");
}
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
@ -143,7 +143,9 @@ void DisplayMessage(const char *message, int time_in_ms)
Host_UpdateStatusBar(message); Host_UpdateStatusBar(message);
} }
else else
{
Host_UpdateTitle(message); Host_UpdateTitle(message);
}
} }
void Callback_DebuggerBreak() void Callback_DebuggerBreak()
@ -555,7 +557,9 @@ static std::string GenerateScreenshotName()
std::string name; std::string name;
for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i) for (int i = 1; File::Exists(name = StringFromFormat("%s-%d.png", path.c_str(), i)); ++i)
{} {
// TODO?
}
return name; return name;
} }
@ -614,7 +618,8 @@ void VideoThrottle()
u32 frametime = ((SConfig::GetInstance().b_UseFPS)? Common::AtomicLoad(DrawnFrame) : DrawnVideo) * 1000 / TargetVPS; u32 frametime = ((SConfig::GetInstance().b_UseFPS)? Common::AtomicLoad(DrawnFrame) : DrawnVideo) * 1000 / TargetVPS;
u32 timeDifference = (u32)Timer.GetTimeDifference(); u32 timeDifference = (u32)Timer.GetTimeDifference();
if (timeDifference < frametime) { if (timeDifference < frametime)
{
Common::SleepCurrentThread(frametime - timeDifference - 1); Common::SleepCurrentThread(frametime - timeDifference - 1);
} }
@ -670,7 +675,7 @@ const char *Callback_ISOName()
SConfig::GetInstance().m_LocalCoreStartupParameter; SConfig::GetInstance().m_LocalCoreStartupParameter;
if (params.m_strName.length() > 0) if (params.m_strName.length() > 0)
return params.m_strName.c_str(); return params.m_strName.c_str();
else else
return ""; return "";
} }
@ -742,10 +747,12 @@ void UpdateTitle()
} }
if (_CoreParameter.bRenderToMain && if (_CoreParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar) { SConfig::GetInstance().m_InterfaceStatusbar)
{
Host_UpdateStatusBar(SMessage.c_str()); Host_UpdateStatusBar(SMessage.c_str());
Host_UpdateTitle(scm_rev_str); Host_UpdateTitle(scm_rev_str);
} else }
else
Host_UpdateTitle(TMessage.c_str()); Host_UpdateTitle(TMessage.c_str());
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
@ -44,9 +44,9 @@ void Callback_VideoCopiedToXFB(bool video_update);
enum EState enum EState
{ {
CORE_UNINITIALIZED, CORE_UNINITIALIZED,
CORE_PAUSE, CORE_PAUSE,
CORE_RUN, CORE_RUN,
CORE_STOPPING CORE_STOPPING
}; };
@ -69,7 +69,7 @@ void SaveScreenShot();
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size); void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
void* GetWindowHandle(); void* GetWindowHandle();
void StartTrace(bool write); void StartTrace(bool write);
// This displays messages in a user-visible way. // This displays messages in a user-visible way.
@ -82,7 +82,7 @@ inline void DisplayMessage(const std::string &message, int time_in_ms)
std::string GetStateFileName(); std::string GetStateFileName();
void SetStateFileName(std::string val); void SetStateFileName(std::string val);
int SyncTrace(); int SyncTrace();
void SetBlockStart(u32 addr); void SetBlockStart(u32 addr);
void StopTrace(); void StopTrace();

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _COREPARAMETER_H #ifndef _COREPARAMETER_H
@ -21,7 +21,8 @@
#include "IniFile.h" #include "IniFile.h"
#include <string> #include <string>
enum Hotkey { enum Hotkey
{
HK_OPEN, HK_OPEN,
HK_CHANGE_DISC, HK_CHANGE_DISC,
HK_REFRESH_LIST, HK_REFRESH_LIST,

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <vector> #include <vector>
@ -76,36 +76,36 @@ void (*advanceCallback)(int cyclesExecuted) = NULL;
Event* GetNewEvent() Event* GetNewEvent()
{ {
if(!eventPool) if(!eventPool)
return new Event; return new Event;
Event* ev = eventPool; Event* ev = eventPool;
eventPool = ev->next; eventPool = ev->next;
return ev; return ev;
} }
Event* GetNewTsEvent() Event* GetNewTsEvent()
{ {
allocatedTsEvents++; allocatedTsEvents++;
if(!eventTsPool) if(!eventTsPool)
return new Event; return new Event;
Event* ev = eventTsPool; Event* ev = eventTsPool;
eventTsPool = ev->next; eventTsPool = ev->next;
return ev; return ev;
} }
void FreeEvent(Event* ev) void FreeEvent(Event* ev)
{ {
ev->next = eventPool; ev->next = eventPool;
eventPool = ev; eventPool = ev;
} }
void FreeTsEvent(Event* ev) void FreeTsEvent(Event* ev)
{ {
ev->next = eventTsPool; ev->next = eventTsPool;
eventTsPool = ev; eventTsPool = ev;
allocatedTsEvents--; allocatedTsEvents--;
} }
@ -158,20 +158,20 @@ void Shutdown()
ClearPendingEvents(); ClearPendingEvents();
UnregisterAllEvents(); UnregisterAllEvents();
while(eventPool) while(eventPool)
{ {
Event *ev = eventPool; Event *ev = eventPool;
eventPool = ev->next; eventPool = ev->next;
delete ev; delete ev;
} }
std::lock_guard<std::recursive_mutex> lk(externalEventSection); std::lock_guard<std::recursive_mutex> lk(externalEventSection);
while(eventTsPool) while(eventTsPool)
{ {
Event *ev = eventTsPool; Event *ev = eventTsPool;
eventTsPool = ev->next; eventTsPool = ev->next;
delete ev; delete ev;
} }
} }
void EventDoState(PointerWrap &p, BaseEvent* ev) void EventDoState(PointerWrap &p, BaseEvent* ev)
@ -227,7 +227,7 @@ void DoState(PointerWrap &p)
u64 GetTicks() u64 GetTicks()
{ {
return (u64)globalTimer; return (u64)globalTimer;
} }
u64 GetIdleTicks() u64 GetIdleTicks()
@ -262,7 +262,9 @@ void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata)
event_types[event_type].callback(userdata, 0); event_types[event_type].callback(userdata, 0);
} }
else else
{
ScheduleEvent_Threadsafe(0, event_type, userdata); ScheduleEvent_Threadsafe(0, event_type, userdata);
}
} }
void ClearPendingEvents() void ClearPendingEvents()
@ -327,6 +329,7 @@ void RemoveEvent(int event_type)
{ {
if (!first) if (!first)
return; return;
while(first) while(first)
{ {
if (first->type == event_type) if (first->type == event_type)
@ -340,8 +343,10 @@ void RemoveEvent(int event_type)
break; break;
} }
} }
if (!first) if (!first)
return; return;
Event *prev = first; Event *prev = first;
Event *ptr = prev->next; Event *ptr = prev->next;
while (ptr) while (ptr)
@ -367,6 +372,7 @@ void RemoveThreadsafeEvent(int event_type)
{ {
return; return;
} }
while(tsFirst) while(tsFirst)
{ {
if (tsFirst->type == event_type) if (tsFirst->type == event_type)
@ -380,16 +386,18 @@ void RemoveThreadsafeEvent(int event_type)
break; break;
} }
} }
if (!tsFirst) if (!tsFirst)
{ {
return; return;
} }
Event *prev = tsFirst; Event *prev = tsFirst;
Event *ptr = prev->next; Event *ptr = prev->next;
while (ptr) while (ptr)
{ {
if (ptr->type == event_type) if (ptr->type == event_type)
{ {
prev->next = ptr->next; prev->next = ptr->next;
FreeTsEvent(ptr); FreeTsEvent(ptr);
ptr = prev->next; ptr = prev->next;
@ -455,7 +463,7 @@ void ProcessFifoWaitEvents()
void MoveEvents() void MoveEvents()
{ {
std::lock_guard<std::recursive_mutex> lk(externalEventSection); std::lock_guard<std::recursive_mutex> lk(externalEventSection);
// Move events from async queue into main queue // Move events from async queue into main queue
while (tsFirst) while (tsFirst)
{ {
Event *next = tsFirst->next; Event *next = tsFirst->next;
@ -464,20 +472,20 @@ void MoveEvents()
} }
tsLast = NULL; tsLast = NULL;
// Move free events to threadsafe pool // Move free events to threadsafe pool
while(allocatedTsEvents > 0 && eventPool) while(allocatedTsEvents > 0 && eventPool)
{ {
Event *ev = eventPool; Event *ev = eventPool;
eventPool = ev->next; eventPool = ev->next;
ev->next = eventTsPool; ev->next = eventTsPool;
eventTsPool = ev; eventTsPool = ev;
allocatedTsEvents--; allocatedTsEvents--;
} }
} }
void Advance() void Advance()
{ {
MoveEvents(); MoveEvents();
int cyclesExecuted = slicelength - downcount; int cyclesExecuted = slicelength - downcount;
globalTimer += cyclesExecuted; globalTimer += cyclesExecuted;
@ -499,6 +507,7 @@ void Advance()
break; break;
} }
} }
if (!first) if (!first)
{ {
WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000"); WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
@ -511,6 +520,7 @@ void Advance()
slicelength = maxSliceLength; slicelength = maxSliceLength;
downcount = slicelength; downcount = slicelength;
} }
if (advanceCallback) if (advanceCallback)
advanceCallback(cyclesExecuted); advanceCallback(cyclesExecuted);
} }
@ -534,7 +544,7 @@ void Idle()
//while we process only the events required by the FIFO. //while we process only the events required by the FIFO.
while (g_video_backend->Video_IsPossibleWaitingSetDrawDone()) while (g_video_backend->Video_IsPossibleWaitingSetDrawDone())
{ {
ProcessFifoWaitEvents(); ProcessFifoWaitEvents();
Common::YieldCPU(); Common::YieldCPU();
} }
@ -554,9 +564,11 @@ std::string GetScheduledEventsSummary()
unsigned int t = ptr->type; unsigned int t = ptr->type;
if (t >= event_types.size()) if (t >= event_types.size())
PanicAlertT("Invalid event type %i", t); PanicAlertT("Invalid event type %i", t);
const char *name = event_types[ptr->type].name; const char *name = event_types[ptr->type].name;
if (!name) if (!name)
name = "[unknown]"; name = "[unknown]";
text += StringFromFormat("%s : %i %08x%08x\n", event_types[ptr->type].name, ptr->time, ptr->userdata >> 32, ptr->userdata); text += StringFromFormat("%s : %i %08x%08x\n", event_types[ptr->type].name, ptr->time, ptr->userdata >> 32, ptr->userdata);
ptr = ptr->next; ptr = ptr->next;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CORETIMING_H #ifndef _CORETIMING_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -60,7 +60,7 @@ static s16 ADPCM_Step(u32& _rSamplePos)
_rSamplePos++; _rSamplePos++;
// The advanced interpolation (linear, polyphase,...) is done by the UCode, // The advanced interpolation (linear, polyphase,...) is done by the UCode,
// so we don't need to bother with it here. // so we don't need to bother with it here.
return val; return val;
} }
@ -78,7 +78,7 @@ u16 dsp_read_aram_d3()
Address++; Address++;
break; break;
case 0x6: // u16 reads case 0x6: // u16 reads
val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1); val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1);
Address++; Address++;
break; break;
default: default:
@ -134,25 +134,25 @@ u16 dsp_read_accelerator()
// address" and 0xd3. // address" and 0xd3.
switch (g_dsp.ifx_regs[DSP_FORMAT]) switch (g_dsp.ifx_regs[DSP_FORMAT])
{ {
case 0x00: // ADPCM audio case 0x00: // ADPCM audio
val = ADPCM_Step(Address); val = ADPCM_Step(Address);
break;
case 0x0A: // 16-bit PCM audio
val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1);
g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
g_dsp.ifx_regs[DSP_YN1] = val;
Address++;
break;
case 0x19: // 8-bit PCM audio
val = DSPHost_ReadHostMemory(Address) << 8;
g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
g_dsp.ifx_regs[DSP_YN1] = val;
Address++;
break; break;
default: case 0x0A: // 16-bit PCM audio
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]); val = (DSPHost_ReadHostMemory(Address*2) << 8) | DSPHost_ReadHostMemory(Address*2 + 1);
Address++; g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
val = 0; g_dsp.ifx_regs[DSP_YN1] = val;
Address++;
break;
case 0x19: // 8-bit PCM audio
val = DSPHost_ReadHostMemory(Address) << 8;
g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
g_dsp.ifx_regs[DSP_YN1] = val;
Address++;
break;
default:
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
Address++;
val = 0;
break; break;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSP_ACCELERATOR_H #ifndef _DSP_ACCELERATOR_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "DSPAnalyzer.h" #include "DSPAnalyzer.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Basic code analysis. // Basic code analysis.

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSP_BREAKPOINTS #ifndef _DSP_BREAKPOINTS
@ -21,38 +21,53 @@
#include "Common.h" #include "Common.h"
// super fast breakpoints for a limited range. // super fast breakpoints for a limited range.
// To be used interchangably with the BreakPoints class. // To be used interchangeably with the BreakPoints class.
class DSPBreakpoints class DSPBreakpoints
{ {
public: public:
DSPBreakpoints() {Clear();} DSPBreakpoints()
{
Clear();
}
// is address breakpoint // is address breakpoint
bool IsAddressBreakPoint(u32 addr) { bool IsAddressBreakPoint(u32 addr)
{
return b[addr] != 0; return b[addr] != 0;
} }
// AddBreakPoint // AddBreakPoint
bool Add(u32 addr, bool temp=false) { bool Add(u32 addr, bool temp=false)
{
bool was_one = b[addr] != 0; bool was_one = b[addr] != 0;
if (!was_one) {
if (!was_one)
{
b[addr] = temp ? 2 : 1; b[addr] = temp ? 2 : 1;
return true; return true;
} else { }
else
{
return false; return false;
} }
} }
// Remove Breakpoint // Remove Breakpoint
bool Remove(u32 addr) { bool Remove(u32 addr)
{
bool was_one = b[addr] != 0; bool was_one = b[addr] != 0;
b[addr] = 0; b[addr] = 0;
return was_one; return was_one;
} }
void Clear() {
void Clear()
{
for (int i = 0; i < 65536; i++) for (int i = 0; i < 65536; i++)
b[i] = 0; b[i] = 0;
} }
void DeleteByAddress(u32 addr) { void DeleteByAddress(u32 addr)
{
b[addr] = 0; b[addr] = 0;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <iostream> #include <iostream>
@ -38,7 +38,8 @@ bool Assemble(const char *text, std::vector<u16> &code, bool force)
// TODO: fix the terrible api of the assembler. // TODO: fix the terrible api of the assembler.
DSPAssembler assembler(settings); DSPAssembler assembler(settings);
if (!assembler.Assemble(text, code)) { if (!assembler.Assemble(text, code))
{
std::cerr << assembler.GetErrorString() << std::endl; std::cerr << assembler.GetErrorString() << std::endl;
return false; return false;
} }
@ -77,7 +78,9 @@ bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2)
for (int i = 0; i < min_size; i++) for (int i = 0; i < min_size; i++)
{ {
if (code1[i] == code2[i]) if (code1[i] == code2[i])
{
count_equal++; count_equal++;
}
else else
{ {
std::string line1, line2; std::string line1, line2;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPCODEUTIL_H #ifndef _DSPCODEUTIL_H

View File

@ -89,7 +89,7 @@ static bool VerifyRoms(const char *irom_filename, const char *coef_filename)
{ 0x9c8f593c, 0x10000001 }, { 0x9c8f593c, 0x10000001 },
// delroth's improvement on LM1234 replacement ROM (Zelda and AX only, // delroth's improvement on LM1234 replacement ROM (Zelda and AX only,
// IPL/Card/GBA still broken) // IPL/Card/GBA still broken)
{ 0xd9907f71, 0xb019c2fb } { 0xd9907f71, 0xb019c2fb }
}; };
@ -220,7 +220,7 @@ void DSPCore_Shutdown()
void DSPCore_Reset() void DSPCore_Reset()
{ {
g_dsp.pc = DSP_RESET_VECTOR; g_dsp.pc = DSP_RESET_VECTOR;
g_dsp.r.wr[0] = 0xffff; g_dsp.r.wr[0] = 0xffff;
g_dsp.r.wr[1] = 0xffff; g_dsp.r.wr[1] = 0xffff;
@ -260,11 +260,13 @@ void DSPCore_CheckExceptions()
if (g_dsp.exceptions == 0) if (g_dsp.exceptions == 0)
return; return;
for (int i = 7; i > 0; i--) { for (int i = 7; i > 0; i--)
{
// Seems exp int are not masked by sr_int_enable // Seems exp int are not masked by sr_int_enable
if (g_dsp.exceptions & (1 << i)) { if (g_dsp.exceptions & (1 << i))
if (dsp_SR_is_flag_set(SR_INT_ENABLE) || (i == EXP_INT)) { {
if (dsp_SR_is_flag_set(SR_INT_ENABLE) || (i == EXP_INT))
{
// store pc and sr until RTI // store pc and sr until RTI
dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc); dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc);
dsp_reg_store_stack(DSP_STACK_D, g_dsp.r.sr); dsp_reg_store_stack(DSP_STACK_D, g_dsp.r.sr);
@ -276,7 +278,9 @@ void DSPCore_CheckExceptions()
else else
g_dsp.r.sr &= ~SR_INT_ENABLE; g_dsp.r.sr &= ~SR_INT_ENABLE;
break; break;
} else { }
else
{
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
ERROR_LOG(DSPLLE, "Firing exception %d failed", i); ERROR_LOG(DSPLLE, "Firing exception %d failed", i);
#endif #endif
@ -381,8 +385,10 @@ void CompileCurrent()
} }
} }
u16 DSPCore_ReadRegister(int reg) { u16 DSPCore_ReadRegister(int reg)
switch(reg) { {
switch(reg)
{
case DSP_REG_AR0: case DSP_REG_AR0:
case DSP_REG_AR1: case DSP_REG_AR1:
case DSP_REG_AR2: case DSP_REG_AR2:
@ -430,8 +436,10 @@ u16 DSPCore_ReadRegister(int reg) {
} }
} }
void DSPCore_WriteRegister(int reg, u16 val) { void DSPCore_WriteRegister(int reg, u16 val)
switch(reg) { {
switch(reg)
{
case DSP_REG_AR0: case DSP_REG_AR0:
case DSP_REG_AR1: case DSP_REG_AR1:
case DSP_REG_AR2: case DSP_REG_AR2:

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <cstring> #include <cstring>
@ -147,28 +147,38 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst)
bool ext_is_jit = false; bool ext_is_jit = false;
// Call extended // Call extended
if (tinst->extended) { if (tinst->extended)
if ((inst >> 12) == 0x3) { {
if (! extOpTable[inst & 0x7F]->jitFunc) { if ((inst >> 12) == 0x3)
{
if (! extOpTable[inst & 0x7F]->jitFunc)
{
// Fall back to interpreter // Fall back to interpreter
gpr.pushRegs(); gpr.pushRegs();
ABI_CallFunctionC16((void*)extOpTable[inst & 0x7F]->intFunc, inst); ABI_CallFunctionC16((void*)extOpTable[inst & 0x7F]->intFunc, inst);
gpr.popRegs(); gpr.popRegs();
INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x\n", inst); INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x\n", inst);
ext_is_jit = false; ext_is_jit = false;
} else { }
else
{
(this->*extOpTable[inst & 0x7F]->jitFunc)(inst); (this->*extOpTable[inst & 0x7F]->jitFunc)(inst);
ext_is_jit = true; ext_is_jit = true;
} }
} else { }
if (!extOpTable[inst & 0xFF]->jitFunc) { else
{
if (!extOpTable[inst & 0xFF]->jitFunc)
{
// Fall back to interpreter // Fall back to interpreter
gpr.pushRegs(); gpr.pushRegs();
ABI_CallFunctionC16((void*)extOpTable[inst & 0xFF]->intFunc, inst); ABI_CallFunctionC16((void*)extOpTable[inst & 0xFF]->intFunc, inst);
gpr.popRegs(); gpr.popRegs();
INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x\n", inst); INFO_LOG(DSPLLE, "Instruction not JITed(ext part): %04x\n", inst);
ext_is_jit = false; ext_is_jit = false;
} else { }
else
{
(this->*extOpTable[inst & 0xFF]->jitFunc)(inst); (this->*extOpTable[inst & 0xFF]->jitFunc)(inst);
ext_is_jit = true; ext_is_jit = true;
} }
@ -176,7 +186,8 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst)
} }
// Main instruction // Main instruction
if (!opTable[inst]->jitFunc) { if (!opTable[inst]->jitFunc)
{
Default(inst); Default(inst);
INFO_LOG(DSPLLE, "Instruction not JITed(main part): %04x\n", inst); INFO_LOG(DSPLLE, "Instruction not JITed(main part): %04x\n", inst);
} }
@ -186,14 +197,18 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst)
} }
// Backlog // Backlog
if (tinst->extended) { if (tinst->extended)
if (!ext_is_jit) { {
if (!ext_is_jit)
{
//need to call the online cleanup function because //need to call the online cleanup function because
//the writeBackLog gets populated at runtime //the writeBackLog gets populated at runtime
gpr.pushRegs(); gpr.pushRegs();
ABI_CallFunction((void*)::applyWriteBackLog); ABI_CallFunction((void*)::applyWriteBackLog);
gpr.popRegs(); gpr.popRegs();
} else { }
else
{
popExtValueToReg(); popExtValueToReg();
} }
} }
@ -322,7 +337,8 @@ void DSPEmitter::Compile(u16 start_addr)
} }
} }
if (fixup_pc) { if (fixup_pc)
{
MOV(16, M(&(g_dsp.pc)), Imm16(compilePC)); MOV(16, M(&(g_dsp.pc)), Imm16(compilePC));
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPEMITTER_H #ifndef _DSPEMITTER_H

View File

@ -117,71 +117,76 @@ void gdsp_ifx_write(u32 addr, u32 val)
{ {
switch (addr & 0xff) switch (addr & 0xff)
{ {
case DSP_DIRQ: case DSP_DIRQ:
if (val & 0x1) if (val & 0x1)
DSPHost_InterruptRequest(); DSPHost_InterruptRequest();
else else
INFO_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val); INFO_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val);
break; break;
case DSP_DMBH: case DSP_DMBH:
gdsp_mbox_write_h(GDSP_MBOX_DSP, val); gdsp_mbox_write_h(GDSP_MBOX_DSP, val);
break; break;
case DSP_DMBL: case DSP_DMBL:
gdsp_mbox_write_l(GDSP_MBOX_DSP, val); gdsp_mbox_write_l(GDSP_MBOX_DSP, val);
break; break;
case DSP_CMBH: case DSP_CMBH:
return gdsp_mbox_write_h(GDSP_MBOX_CPU, val); return gdsp_mbox_write_h(GDSP_MBOX_CPU, val);
case DSP_CMBL: case DSP_CMBL:
return gdsp_mbox_write_l(GDSP_MBOX_CPU, val); return gdsp_mbox_write_l(GDSP_MBOX_CPU, val);
case DSP_DSBL: case DSP_DSBL:
g_dsp.ifx_regs[DSP_DSBL] = val; g_dsp.ifx_regs[DSP_DSBL] = val;
g_dsp.ifx_regs[DSP_DSCR] |= 4; // Doesn't really matter since we do DMA instantly g_dsp.ifx_regs[DSP_DSCR] |= 4; // Doesn't really matter since we do DMA instantly
if (!g_dsp.ifx_regs[DSP_AMDM]) if (!g_dsp.ifx_regs[DSP_AMDM])
gdsp_do_dma(); gdsp_do_dma();
else else
NOTICE_LOG(DSPLLE, "Masked DMA skipped"); NOTICE_LOG(DSPLLE, "Masked DMA skipped");
g_dsp.ifx_regs[DSP_DSCR] &= ~4; g_dsp.ifx_regs[DSP_DSCR] &= ~4;
g_dsp.ifx_regs[DSP_DSBL] = 0; g_dsp.ifx_regs[DSP_DSBL] = 0;
break; break;
case DSP_ACDATA1: // Accelerator write (Zelda type) - "UnkZelda" case DSP_ACDATA1: // Accelerator write (Zelda type) - "UnkZelda"
dsp_write_aram_d3(val); dsp_write_aram_d3(val);
break; break;
case DSP_GAIN: case DSP_GAIN:
if (val) { if (val)
{
INFO_LOG(DSPLLE,"Gain Written: 0x%04x", val); INFO_LOG(DSPLLE,"Gain Written: 0x%04x", val);
} }
case DSP_DSPA: case DSP_DSPA:
case DSP_DSMAH: case DSP_DSMAH:
case DSP_DSMAL: case DSP_DSMAL:
case DSP_DSCR: case DSP_DSCR:
g_dsp.ifx_regs[addr & 0xFF] = val; g_dsp.ifx_regs[addr & 0xFF] = val;
break; break;
/* /*
case DSP_ACCAL: case DSP_ACCAL:
dsp_step_accelerator(); dsp_step_accelerator();
break; break;
*/ */
default: default:
if ((addr & 0xff) >= 0xa0) { if ((addr & 0xff) >= 0xa0)
if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description) { {
INFO_LOG(DSPLLE, "%04x MW %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, val); if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description)
{
INFO_LOG(DSPLLE, "%04x MW %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, val);
} }
else { else
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val); {
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
} }
} }
else { else
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val); {
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
} }
g_dsp.ifx_regs[addr & 0xFF] = val; g_dsp.ifx_regs[addr & 0xFF] = val;
break; break;
} }
} }
@ -189,40 +194,44 @@ u16 gdsp_ifx_read(u16 addr)
{ {
switch (addr & 0xff) switch (addr & 0xff)
{ {
case DSP_DMBH: case DSP_DMBH:
return gdsp_mbox_read_h(GDSP_MBOX_DSP); return gdsp_mbox_read_h(GDSP_MBOX_DSP);
case DSP_DMBL: case DSP_DMBL:
return gdsp_mbox_read_l(GDSP_MBOX_DSP); return gdsp_mbox_read_l(GDSP_MBOX_DSP);
case DSP_CMBH: case DSP_CMBH:
return gdsp_mbox_read_h(GDSP_MBOX_CPU); return gdsp_mbox_read_h(GDSP_MBOX_CPU);
case DSP_CMBL: case DSP_CMBL:
return gdsp_mbox_read_l(GDSP_MBOX_CPU); return gdsp_mbox_read_l(GDSP_MBOX_CPU);
case DSP_DSCR: case DSP_DSCR:
return g_dsp.ifx_regs[addr & 0xFF]; return g_dsp.ifx_regs[addr & 0xFF];
case DSP_ACCELERATOR: // ADPCM Accelerator reads case DSP_ACCELERATOR: // ADPCM Accelerator reads
return dsp_read_accelerator(); return dsp_read_accelerator();
case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda" case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda"
return dsp_read_aram_d3(); return dsp_read_aram_d3();
default: default:
if ((addr & 0xff) >= 0xa0) { if ((addr & 0xff) >= 0xa0)
if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description) { {
INFO_LOG(DSPLLE, "%04x MR %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, g_dsp.ifx_regs[addr & 0xFF]); if (pdlabels[(addr & 0xFF) - 0xa0].name && pdlabels[(addr & 0xFF) - 0xa0].description)
{
INFO_LOG(DSPLLE, "%04x MR %s (%04x)", g_dsp.pc, pdlabels[(addr & 0xFF) - 0xa0].name, g_dsp.ifx_regs[addr & 0xFF]);
} }
else { else
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]); {
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
} }
} }
else { else
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]); {
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
} }
return g_dsp.ifx_regs[addr & 0xFF]; return g_dsp.ifx_regs[addr & 0xFF];
} }
} }
@ -326,20 +335,20 @@ static void gdsp_do_dma()
#endif #endif
switch (ctl & 0x3) switch (ctl & 0x3)
{ {
case (DSP_CR_DMEM | DSP_CR_TO_CPU): case (DSP_CR_DMEM | DSP_CR_TO_CPU):
gdsp_ddma_out(dsp_addr, addr, len); gdsp_ddma_out(dsp_addr, addr, len);
break; break;
case (DSP_CR_DMEM | DSP_CR_FROM_CPU): case (DSP_CR_DMEM | DSP_CR_FROM_CPU):
gdsp_ddma_in(dsp_addr, addr, len); gdsp_ddma_in(dsp_addr, addr, len);
break; break;
case (DSP_CR_IMEM | DSP_CR_TO_CPU): case (DSP_CR_IMEM | DSP_CR_TO_CPU):
gdsp_idma_out(dsp_addr, addr, len); gdsp_idma_out(dsp_addr, addr, len);
break; break;
case (DSP_CR_IMEM | DSP_CR_FROM_CPU): case (DSP_CR_IMEM | DSP_CR_FROM_CPU):
gdsp_idma_in(dsp_addr, addr, len); gdsp_idma_in(dsp_addr, addr, len);
break; break;
} }
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPHOST_H #ifndef _DSPHOST_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "DSPIntUtil.h" #include "DSPIntUtil.h"
#include "DSPMemoryMap.h" #include "DSPMemoryMap.h"
@ -56,22 +56,25 @@ inline bool IsSameMemArea(u16 a, u16 b)
// DR $arR // DR $arR
// xxxx xxxx 0000 01rr // xxxx xxxx 0000 01rr
// Decrement addressing register $arR. // Decrement addressing register $arR.
void dr(const UDSPInstruction opc) { void dr(const UDSPInstruction opc)
{
writeToBackLog(0, opc & 0x3, dsp_decrement_addr_reg(opc & 0x3)); writeToBackLog(0, opc & 0x3, dsp_decrement_addr_reg(opc & 0x3));
} }
// IR $arR // IR $arR
// xxxx xxxx 0000 10rr // xxxx xxxx 0000 10rr
// Increment addressing register $arR. // Increment addressing register $arR.
void ir(const UDSPInstruction opc) { void ir(const UDSPInstruction opc)
{
writeToBackLog(0, opc & 0x3, dsp_increment_addr_reg(opc & 0x3)); writeToBackLog(0, opc & 0x3, dsp_increment_addr_reg(opc & 0x3));
} }
// NR $arR // NR $arR
// xxxx xxxx 0000 11rr // xxxx xxxx 0000 11rr
// Add corresponding indexing register $ixR to addressing register $arR. // Add corresponding indexing register $ixR to addressing register $arR.
void nr(const UDSPInstruction opc) { void nr(const UDSPInstruction opc)
u8 reg = opc & 0x3; {
u8 reg = opc & 0x3;
writeToBackLog(0, reg, dsp_increase_addr_reg(reg, (s16)g_dsp.r.ix[reg])); writeToBackLog(0, reg, dsp_increase_addr_reg(reg, (s16)g_dsp.r.ix[reg]));
} }
@ -81,10 +84,11 @@ void nr(const UDSPInstruction opc) {
// Move value of $acS.S to the $axD.D. // Move value of $acS.S to the $axD.D.
void mv(const UDSPInstruction opc) void mv(const UDSPInstruction opc)
{ {
u8 sreg = (opc & 0x3) + DSP_REG_ACL0; u8 sreg = (opc & 0x3) + DSP_REG_ACL0;
u8 dreg = ((opc >> 2) & 0x3); u8 dreg = ((opc >> 2) & 0x3);
switch(sreg) { switch(sreg)
{
case DSP_REG_ACL0: case DSP_REG_ACL0:
case DSP_REG_ACL1: case DSP_REG_ACL1:
writeToBackLog(0, dreg + DSP_REG_AXL0, g_dsp.r.ac[sreg-DSP_REG_ACL0].l); writeToBackLog(0, dreg + DSP_REG_AXL0, g_dsp.r.ac[sreg-DSP_REG_ACL0].l);
@ -105,7 +109,8 @@ void s(const UDSPInstruction opc)
u8 dreg = opc & 0x3; u8 dreg = opc & 0x3;
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0; u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
switch(sreg) { switch(sreg)
{
case DSP_REG_ACL0: case DSP_REG_ACL0:
case DSP_REG_ACL1: case DSP_REG_ACL1:
dsp_dmem_write(g_dsp.r.ar[dreg], g_dsp.r.ac[sreg-DSP_REG_ACL0].l); dsp_dmem_write(g_dsp.r.ar[dreg], g_dsp.r.ac[sreg-DSP_REG_ACL0].l);
@ -115,7 +120,7 @@ void s(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[dreg], dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0)); dsp_dmem_write(g_dsp.r.ar[dreg], dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0));
break; break;
} }
writeToBackLog(0, dreg, dsp_increment_addr_reg(dreg)); writeToBackLog(0, dreg, dsp_increment_addr_reg(dreg));
} }
// SN @$arD, $acS.S // SN @$arD, $acS.S
@ -127,7 +132,8 @@ void sn(const UDSPInstruction opc)
u8 dreg = opc & 0x3; u8 dreg = opc & 0x3;
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0; u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
switch(sreg) { switch(sreg)
{
case DSP_REG_ACL0: case DSP_REG_ACL0:
case DSP_REG_ACL1: case DSP_REG_ACL1:
dsp_dmem_write(g_dsp.r.ar[dreg], g_dsp.r.ac[sreg-DSP_REG_ACL0].l); dsp_dmem_write(g_dsp.r.ar[dreg], g_dsp.r.ac[sreg-DSP_REG_ACL0].l);
@ -137,7 +143,7 @@ void sn(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[dreg], dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0)); dsp_dmem_write(g_dsp.r.ar[dreg], dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0));
break; break;
} }
writeToBackLog(0, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r.ix[dreg])); writeToBackLog(0, dreg, dsp_increase_addr_reg(dreg, (s16)g_dsp.r.ix[dreg]));
} }
// L $axD.D, @$arS // L $axD.D, @$arS
@ -153,13 +159,13 @@ void l(const UDSPInstruction opc)
{ {
u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]); u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]);
writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000); writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000);
writeToBackLog(1, dreg, val); writeToBackLog(1, dreg, val);
writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0); writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0);
writeToBackLog(3, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(3, sreg, dsp_increment_addr_reg(sreg));
} }
else else
{ {
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg]));
writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg));
} }
} }
@ -177,13 +183,13 @@ void ln(const UDSPInstruction opc)
{ {
u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]); u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]);
writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000); writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000);
writeToBackLog(1, dreg, val); writeToBackLog(1, dreg, val);
writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0); writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0);
writeToBackLog(3, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(3, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
} }
else else
{ {
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[sreg]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
} }
} }
@ -200,7 +206,7 @@ void ls(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0]));
writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
} }
@ -219,7 +225,7 @@ void lsn(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0]));
writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0]));
} }
@ -237,7 +243,7 @@ void lsm(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0]));
writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
} }
@ -256,7 +262,7 @@ void lsnm(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[3], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[0]));
writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0]));
} }
@ -273,7 +279,7 @@ void sl(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
} }
@ -291,7 +297,7 @@ void sln(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(1, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0]));
} }
@ -309,7 +315,7 @@ void slm(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0)); writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
} }
@ -327,7 +333,7 @@ void slnm(const UDSPInstruction opc)
dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg)); dsp_dmem_write(g_dsp.r.ar[0], dsp_op_read_reg_and_saturate(sreg));
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); writeToBackLog(1, DSP_REG_AR3, dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0])); writeToBackLog(2, DSP_REG_AR0, dsp_increase_addr_reg(DSP_REG_AR0, (s16)g_dsp.r.ix[0]));
} }
@ -354,7 +360,7 @@ void ld(const UDSPInstruction opc)
else else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
} }
@ -373,7 +379,7 @@ void ldax(const UDSPInstruction opc)
else else
writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
} }
@ -393,7 +399,7 @@ void ldn(const UDSPInstruction opc)
else else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
} }
@ -412,7 +418,7 @@ void ldaxn(const UDSPInstruction opc)
else else
writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3)); writeToBackLog(3, DSP_REG_AR3, dsp_increment_addr_reg(DSP_REG_AR3));
} }
@ -432,7 +438,7 @@ void ldm(const UDSPInstruction opc)
else else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(3, DSP_REG_AR3, writeToBackLog(3, DSP_REG_AR3,
dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -452,7 +458,7 @@ void ldaxm(const UDSPInstruction opc)
else else
writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg)); writeToBackLog(2, sreg, dsp_increment_addr_reg(sreg));
writeToBackLog(3, DSP_REG_AR3, writeToBackLog(3, DSP_REG_AR3,
dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -473,7 +479,7 @@ void ldnm(const UDSPInstruction opc)
else else
writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, (rreg << 1) + DSP_REG_AXL1, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
writeToBackLog(3, DSP_REG_AR3, writeToBackLog(3, DSP_REG_AR3,
dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -493,7 +499,7 @@ void ldaxnm(const UDSPInstruction opc)
else else
writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3])); writeToBackLog(1, rreg + DSP_REG_AXL0, dsp_dmem_read(g_dsp.r.ar[3]));
writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg])); writeToBackLog(2, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
writeToBackLog(3, DSP_REG_AR3, writeToBackLog(3, DSP_REG_AR3,
dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3])); dsp_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -520,7 +526,8 @@ void applyWriteBackLog()
{ {
// always make sure to have an extra entry at the end w/ -1 to avoid // always make sure to have an extra entry at the end w/ -1 to avoid
// infinitive loops // infinitive loops
for (int i = 0; writeBackLogIdx[i] != -1; i++) { for (int i = 0; writeBackLogIdx[i] != -1; i++)
{
#ifdef PRECISE_BACKLOG #ifdef PRECISE_BACKLOG
dsp_op_write_reg(writeBackLogIdx[i], dsp_op_read_reg(writeBackLogIdx[i]) | writeBackLog[i]); dsp_op_write_reg(writeBackLogIdx[i], dsp_op_read_reg(writeBackLogIdx[i]) | writeBackLog[i]);
#else #else
@ -543,7 +550,8 @@ void zeroWriteBackLog()
#ifdef PRECISE_BACKLOG #ifdef PRECISE_BACKLOG
// always make sure to have an extra entry at the end w/ -1 to avoid // always make sure to have an extra entry at the end w/ -1 to avoid
// infinitive loops // infinitive loops
for (int i = 0; writeBackLogIdx[i] != -1; i++) { for (int i = 0; writeBackLogIdx[i] != -1; i++)
{
dsp_op_write_reg(writeBackLogIdx[i], 0); dsp_op_write_reg(writeBackLogIdx[i], 0);
} }
#endif #endif
@ -552,8 +560,8 @@ void zeroWriteBackLog()
void zeroWriteBackLogPreserveAcc(u8 acc) void zeroWriteBackLogPreserveAcc(u8 acc)
{ {
#ifdef PRECISE_BACKLOG #ifdef PRECISE_BACKLOG
for (int i = 0; writeBackLogIdx[i] != -1; i++) { for (int i = 0; writeBackLogIdx[i] != -1; i++)
{
// acc0 // acc0
if ((acc == 0) && if ((acc == 0) &&
((writeBackLogIdx[i] == DSP_REG_ACL0) || (writeBackLogIdx[i] == DSP_REG_ACM0) || (writeBackLogIdx[i] == DSP_REG_ACH0))) ((writeBackLogIdx[i] == DSP_REG_ACL0) || (writeBackLogIdx[i] == DSP_REG_ACM0) || (writeBackLogIdx[i] == DSP_REG_ACH0)))

View File

@ -130,7 +130,9 @@ static inline u16 dsp_decrement_addr_reg(u16 reg)
static inline u16 dsp_op_read_reg(int _reg) static inline u16 dsp_op_read_reg(int _reg)
{ {
int reg = _reg & 0x1f; int reg = _reg & 0x1f;
switch (reg) {
switch (reg)
{
case DSP_REG_ST0: case DSP_REG_ST0:
case DSP_REG_ST1: case DSP_REG_ST1:
case DSP_REG_ST2: case DSP_REG_ST2:
@ -181,7 +183,9 @@ static inline u16 dsp_op_read_reg(int _reg)
static inline void dsp_op_write_reg(int _reg, u16 val) static inline void dsp_op_write_reg(int _reg, u16 val)
{ {
int reg = _reg & 0x1f; int reg = _reg & 0x1f;
switch (reg) {
switch (reg)
{
// 8-bit sign extended registers. Should look at prod.h too... // 8-bit sign extended registers. Should look at prod.h too...
case DSP_REG_ACH0: case DSP_REG_ACH0:
case DSP_REG_ACH1: case DSP_REG_ACH1:
@ -349,10 +353,14 @@ inline u16 dsp_op_read_reg_and_saturate(u8 _reg)
return 0x8000; return 0x8000;
} }
else else
{
return g_dsp.r.ac[_reg].m; return g_dsp.r.ac[_reg].m;
}
} }
else else
{
return g_dsp.r.ac[_reg].m; return g_dsp.r.ac[_reg].m;
}
} }
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPINTERPRETER_H #ifndef _DSPINTERPRETER_H
@ -48,9 +48,9 @@ typedef void (*DSPInterpreterFunc)(const UDSPInstruction opc);
void call(const UDSPInstruction opc); void call(const UDSPInstruction opc);
void callr(const UDSPInstruction opc); void callr(const UDSPInstruction opc);
void ifcc(const UDSPInstruction opc); void ifcc(const UDSPInstruction opc);
void jcc(const UDSPInstruction opc); void jcc(const UDSPInstruction opc);
void jmprcc(const UDSPInstruction opc); void jmprcc(const UDSPInstruction opc);
void ret(const UDSPInstruction opc); void ret(const UDSPInstruction opc);
void halt(const UDSPInstruction opc); void halt(const UDSPInstruction opc);
void loop(const UDSPInstruction opc); void loop(const UDSPInstruction opc);
void loopi(const UDSPInstruction opc); void loopi(const UDSPInstruction opc);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie (c) 2005 (duddie@walla.com) // Additional copyrights go to Duddie (c) 2005 (duddie@walla.com)
@ -27,7 +27,8 @@
void nop(const UDSPInstruction opc) void nop(const UDSPInstruction opc)
{ {
// The real nop is 0. Anything else is bad. // The real nop is 0. Anything else is bad.
if (opc) { if (opc)
{
ERROR_LOG(DSPLLE, "LLE: Unrecognized opcode 0x%04x", opc); ERROR_LOG(DSPLLE, "LLE: Unrecognized opcode 0x%04x", opc);
} }
} }
@ -536,7 +537,7 @@ void InitInstructionTable()
extOpTable[i] = &cw; extOpTable[i] = &cw;
for (int i = 0; i < EXT_OPTABLE_SIZE; i++) for (int i = 0; i < EXT_OPTABLE_SIZE; i++)
{ {
for (int j = 0; j < opcodes_ext_size; j++) for (int j = 0; j < opcodes_ext_size; j++)
{ {
u16 mask = opcodes_ext[j].opcode_mask; u16 mask = opcodes_ext[j].opcode_mask;
@ -576,4 +577,4 @@ void InitInstructionTable()
for (int i=0; i < WRITEBACKLOGSIZE; i++) for (int i=0; i < WRITEBACKLOGSIZE; i++)
writeBackLogIdx[i] = -1; writeBackLogIdx[i] = -1;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie (c) 2005 (duddie@walla.com) // Additional copyrights go to Duddie (c) 2005 (duddie@walla.com)
@ -34,14 +34,14 @@
enum partype_t enum partype_t
{ {
P_NONE = 0x0000, P_NONE = 0x0000,
P_VAL = 0x0001, P_VAL = 0x0001,
P_IMM = 0x0002, P_IMM = 0x0002,
P_MEM = 0x0003, P_MEM = 0x0003,
P_STR = 0x0004, P_STR = 0x0004,
P_ADDR_I = 0x0005, P_ADDR_I = 0x0005,
P_ADDR_D = 0x0006, P_ADDR_D = 0x0006,
P_REG = 0x8000, P_REG = 0x8000,
P_REG04 = P_REG | 0x0400, // IX P_REG04 = P_REG | 0x0400, // IX
P_REG08 = P_REG | 0x0800, P_REG08 = P_REG | 0x0800,
P_REG18 = P_REG | 0x1800, P_REG18 = P_REG | 0x1800,
P_REGM18 = P_REG | 0x1810, // used in multiply instructions P_REGM18 = P_REG | 0x1810, // used in multiply instructions
@ -58,8 +58,8 @@ enum partype_t
P_ACC_D = P_REG | 0x2080, P_ACC_D = P_REG | 0x2080,
P_AX = P_REG | 0x2200, P_AX = P_REG | 0x2200,
P_REGS_MASK = 0x03f80, // gcdsptool's value = 0x01f80 P_REGS_MASK = 0x03f80, // gcdsptool's value = 0x01f80
P_REF = P_REG | 0x4000, P_REF = P_REG | 0x4000,
P_PRG = P_REF | P_REG, P_PRG = P_REF | P_REG,
// The following seem like junk: // The following seem like junk:
// P_REG10 = P_REG | 0x1000, // P_REG10 = P_REG | 0x1000,
@ -143,14 +143,18 @@ inline void ExecuteInstruction(const UDSPInstruction inst)
{ {
const DSPOPCTemplate *tinst = GetOpTemplate(inst); const DSPOPCTemplate *tinst = GetOpTemplate(inst);
if (tinst->extended) { if (tinst->extended)
{
if ((inst >> 12) == 0x3) if ((inst >> 12) == 0x3)
extOpTable[inst & 0x7F]->intFunc(inst); extOpTable[inst & 0x7F]->intFunc(inst);
else else
extOpTable[inst & 0xFF]->intFunc(inst); extOpTable[inst & 0xFF]->intFunc(inst);
} }
tinst->intFunc(inst); tinst->intFunc(inst);
if (tinst->extended) {
if (tinst->extended)
{
applyWriteBackLog(); applyWriteBackLog();
} }
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004
@ -695,7 +695,7 @@ void dec(const UDSPInstruction opc)
{ {
u8 dreg = (opc >> 8) & 0x01; u8 dreg = (opc >> 8) & 0x01;
s64 acc = dsp_get_long_acc(dreg); s64 acc = dsp_get_long_acc(dreg);
s64 res = acc - 1; s64 res = acc - 1;
zeroWriteBackLog(); zeroWriteBackLog();
@ -734,7 +734,7 @@ void abs(const UDSPInstruction opc)
{ {
u8 dreg = (opc >> 11) & 0x1; u8 dreg = (opc >> 11) & 0x1;
s64 acc = dsp_get_long_acc(dreg); s64 acc = dsp_get_long_acc(dreg);
if (acc < 0) if (acc < 0)
acc = 0 - acc; acc = 0 - acc;
@ -756,9 +756,10 @@ void movr(const UDSPInstruction opc)
{ {
u8 areg = (opc >> 8) & 0x1; u8 areg = (opc >> 8) & 0x1;
u8 sreg = ((opc >> 9) & 0x3) + DSP_REG_AXL0; u8 sreg = ((opc >> 9) & 0x3) + DSP_REG_AXL0;
s64 ax = 0; s64 ax = 0;
switch(sreg) { switch(sreg)
{
case DSP_REG_AXL0: case DSP_REG_AXL0:
case DSP_REG_AXL1: case DSP_REG_AXL1:
ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l; ax = (s16)g_dsp.r.ax[sreg-DSP_REG_AXL0].l;
@ -973,9 +974,12 @@ void lsrn(const UDSPInstruction opc)
else else
shift = accm & 0x3f; shift = accm & 0x3f;
if (shift > 0) { if (shift > 0)
{
acc >>= shift; acc >>= shift;
} else if (shift < 0) { }
else if (shift < 0)
{
acc <<= -shift; acc <<= -shift;
} }
@ -1002,9 +1006,12 @@ void asrn(const UDSPInstruction opc)
else else
shift = accm & 0x3f; shift = accm & 0x3f;
if (shift > 0) { if (shift > 0)
{
acc >>= shift; acc >>= shift;
} else if (shift < 0) { }
else if (shift < 0)
{
acc <<= -shift; acc <<= -shift;
} }
@ -1035,9 +1042,12 @@ void lsrnrx(const UDSPInstruction opc)
else else
shift = axh & 0x3f; shift = axh & 0x3f;
if (shift > 0) { if (shift > 0)
{
acc <<= shift; acc <<= shift;
} else if (shift < 0) { }
else if (shift < 0)
{
acc >>= -shift; acc >>= -shift;
} }
@ -1069,9 +1079,12 @@ void asrnrx(const UDSPInstruction opc)
else else
shift = axh & 0x3f; shift = axh & 0x3f;
if (shift > 0) { if (shift > 0)
{
acc <<= shift; acc <<= shift;
} else if (shift < 0) { }
else if (shift < 0)
{
acc >>= -shift; acc >>= -shift;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004
@ -194,7 +194,9 @@ void loop(const UDSPInstruction opc)
dsp_reg_store_stack(3, cnt); dsp_reg_store_stack(3, cnt);
} }
else else
{
dsp_skip_inst(); dsp_skip_inst();
}
} }
// LOOPI #I // LOOPI #I
@ -217,7 +219,9 @@ void loopi(const UDSPInstruction opc)
dsp_reg_store_stack(3, cnt); dsp_reg_store_stack(3, cnt);
} }
else else
{
dsp_skip_inst(); dsp_skip_inst();
}
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004
@ -203,7 +203,7 @@ void mulaxh(const UDSPInstruction opc)
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
} }
//---- //----
@ -241,7 +241,7 @@ void mulac(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg); u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg); u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply(axl, axh); s64 prod = dsp_multiply(axl, axh);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
@ -265,7 +265,7 @@ void mulmv(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg); u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg); u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply(axl, axh); s64 prod = dsp_multiply(axl, axh);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
@ -335,7 +335,7 @@ void mulxac(const UDSPInstruction opc)
u16 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0); u16 val1 = (sreg == 0) ? dsp_get_ax_l(0) : dsp_get_ax_h(0);
u16 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1); u16 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1);
s64 prod = dsp_multiply_mulx(sreg, treg, val1, val2); s64 prod = dsp_multiply_mulx(sreg, treg, val1, val2);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
@ -408,7 +408,7 @@ void mulc(const UDSPInstruction opc)
u16 accm = dsp_get_acc_m(sreg); u16 accm = dsp_get_acc_m(sreg);
u16 axh = dsp_get_ax_h(treg); u16 axh = dsp_get_ax_h(treg);
s64 prod = dsp_multiply(accm, axh); s64 prod = dsp_multiply(accm, axh);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
@ -484,7 +484,7 @@ void mulcmvz(const UDSPInstruction opc)
u16 accm = dsp_get_acc_m(sreg); u16 accm = dsp_get_acc_m(sreg);
u16 axh = dsp_get_ax_h(treg); u16 axh = dsp_get_ax_h(treg);
s64 prod = dsp_multiply(accm, axh); s64 prod = dsp_multiply(accm, axh);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
@ -582,7 +582,7 @@ void madd(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg); u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg); u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply_add(axl, axh); s64 prod = dsp_multiply_add(axl, axh);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);
@ -600,7 +600,7 @@ void msub(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg); u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg); u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply_sub(axl, axh); s64 prod = dsp_multiply_sub(axl, axh);
zeroWriteBackLog(); zeroWriteBackLog();
dsp_set_long_prod(prod); dsp_set_long_prod(prod);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../DSPMemoryMap.h" #include "../DSPMemoryMap.h"
@ -29,7 +29,8 @@ template <void(*jitCode)(const UDSPInstruction, DSPEmitter&)>
static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter) static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter)
{ {
u8 cond = opc & 0xf; u8 cond = opc & 0xf;
if (cond == 0xf) {// Always true. if (cond == 0xf) // Always true.
{
jitCode(opc,emitter); jitCode(opc,emitter);
return; return;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../DSPMemoryMap.h" #include "../DSPMemoryMap.h"
#include "../DSPEmitter.h" #include "../DSPEmitter.h"
@ -41,21 +41,24 @@ using namespace Gen;
// DR $arR // DR $arR
// xxxx xxxx 0000 01rr // xxxx xxxx 0000 01rr
// Decrement addressing register $arR. // Decrement addressing register $arR.
void DSPEmitter::dr(const UDSPInstruction opc) { void DSPEmitter::dr(const UDSPInstruction opc)
{
decrement_addr_reg(opc & 0x3); decrement_addr_reg(opc & 0x3);
} }
// IR $arR // IR $arR
// xxxx xxxx 0000 10rr // xxxx xxxx 0000 10rr
// Increment addressing register $arR. // Increment addressing register $arR.
void DSPEmitter::ir(const UDSPInstruction opc) { void DSPEmitter::ir(const UDSPInstruction opc)
{
increment_addr_reg(opc & 0x3); increment_addr_reg(opc & 0x3);
} }
// NR $arR // NR $arR
// xxxx xxxx 0000 11rr // xxxx xxxx 0000 11rr
// Add corresponding indexing register $ixR to addressing register $arR. // Add corresponding indexing register $ixR to addressing register $arR.
void DSPEmitter::nr(const UDSPInstruction opc) { void DSPEmitter::nr(const UDSPInstruction opc)
{
u8 reg = opc & 0x3; u8 reg = opc & 0x3;
increase_addr_reg(reg, reg); increase_addr_reg(reg, reg);
@ -66,7 +69,7 @@ void DSPEmitter::nr(const UDSPInstruction opc) {
// Move value of $acS.S to the $axD.D. // Move value of $acS.S to the $axD.D.
void DSPEmitter::mv(const UDSPInstruction opc) void DSPEmitter::mv(const UDSPInstruction opc)
{ {
u8 sreg = (opc & 0x3) + DSP_REG_ACL0; u8 sreg = (opc & 0x3) + DSP_REG_ACL0;
u8 dreg = ((opc >> 2) & 0x3); u8 dreg = ((opc >> 2) & 0x3);
if (sreg >= DSP_REG_ACM0) { if (sreg >= DSP_REG_ACM0) {
dsp_op_read_reg_and_saturate(sreg, RBX, ZERO); dsp_op_read_reg_and_saturate(sreg, RBX, ZERO);
@ -74,7 +77,7 @@ void DSPEmitter::mv(const UDSPInstruction opc)
} else } else
pushExtValueFromReg(dreg + DSP_REG_AXL0, sreg); pushExtValueFromReg(dreg + DSP_REG_AXL0, sreg);
} }
// S @$arD, $acS.S // S @$arD, $acS.S
// xxxx xxxx 001s s0dd // xxxx xxxx 001s s0dd
// Store value of $acS.S in the memory pointed by register $arD. // Store value of $acS.S in the memory pointed by register $arD.
@ -652,12 +655,14 @@ void DSPEmitter::ldaxnm(const UDSPInstruction opc)
// Push value from g_dsp.r[sreg] into EBX and stores the destinationindex in // Push value from g_dsp.r[sreg] into EBX and stores the destinationindex in
// storeIndex // storeIndex
void DSPEmitter::pushExtValueFromReg(u16 dreg, u16 sreg) { void DSPEmitter::pushExtValueFromReg(u16 dreg, u16 sreg)
{
dsp_op_read_reg(sreg, RBX, ZERO); dsp_op_read_reg(sreg, RBX, ZERO);
storeIndex = dreg; storeIndex = dreg;
} }
void DSPEmitter::pushExtValueFromMem(u16 dreg, u16 sreg) { void DSPEmitter::pushExtValueFromMem(u16 dreg, u16 sreg)
{
// u16 addr = g_dsp.r[addr]; // u16 addr = g_dsp.r[addr];
X64Reg tmp1; X64Reg tmp1;
@ -673,7 +678,8 @@ void DSPEmitter::pushExtValueFromMem(u16 dreg, u16 sreg) {
storeIndex = dreg; storeIndex = dreg;
} }
void DSPEmitter::pushExtValueFromMem2(u16 dreg, u16 sreg) { void DSPEmitter::pushExtValueFromMem2(u16 dreg, u16 sreg)
{
// u16 addr = g_dsp.r[addr]; // u16 addr = g_dsp.r[addr];
X64Reg tmp1; X64Reg tmp1;
@ -690,7 +696,8 @@ void DSPEmitter::pushExtValueFromMem2(u16 dreg, u16 sreg) {
storeIndex2 = dreg; storeIndex2 = dreg;
} }
void DSPEmitter::popExtValueToReg() { void DSPEmitter::popExtValueToReg()
{
// in practise, we rarely ever have a non-NX main op // in practise, we rarely ever have a non-NX main op
// with an extended op, so the OR here is either // with an extended op, so the OR here is either
// not run (storeIndex == -1) or ends up OR'ing // not run (storeIndex == -1) or ends up OR'ing
@ -698,9 +705,11 @@ void DSPEmitter::popExtValueToReg() {
// nakee wants to keep it clean, so lets do that. // nakee wants to keep it clean, so lets do that.
// [nakeee] the or case never happens in real // [nakeee] the or case never happens in real
// [nakeee] it's just how the hardware works so we added it // [nakeee] it's just how the hardware works so we added it
if (storeIndex != -1) { if (storeIndex != -1)
{
dsp_op_write_reg(storeIndex, RBX); dsp_op_write_reg(storeIndex, RBX);
if (storeIndex >= DSP_REG_ACM0 && storeIndex2 == -1) { if (storeIndex >= DSP_REG_ACM0 && storeIndex2 == -1)
{
TEST(32, R(EBX), Imm32(SR_40_MODE_BIT << 16)); TEST(32, R(EBX), Imm32(SR_40_MODE_BIT << 16));
FixupBranch not_40bit = J_CC(CC_Z, true); FixupBranch not_40bit = J_CC(CC_Z, true);
DSPJitRegCache c(gpr); DSPJitRegCache c(gpr);
@ -722,9 +731,11 @@ void DSPEmitter::popExtValueToReg() {
storeIndex = -1; storeIndex = -1;
if (storeIndex2 != -1) { if (storeIndex2 != -1)
{
SHR(32, R(EBX), Imm8(16)); SHR(32, R(EBX), Imm8(16));
dsp_op_write_reg(storeIndex2, RBX); dsp_op_write_reg(storeIndex2, RBX);
} }
storeIndex2 = -1; storeIndex2 = -1;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004
@ -49,7 +49,6 @@ void DSPEmitter::srs(const UDSPInstruction opc)
dmem_write(tmp1); dmem_write(tmp1);
gpr.putXReg(tmp1); gpr.putXReg(tmp1);
} }
// LRS $(0x18+D), @M // LRS $(0x18+D), @M

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
@ -207,7 +207,8 @@ void DSPEmitter::dsp_conditional_extend_accum_imm(int reg, u16 val)
void DSPEmitter::dsp_op_read_reg(int reg, Gen::X64Reg host_dreg, DSPJitSignExtend extend) void DSPEmitter::dsp_op_read_reg(int reg, Gen::X64Reg host_dreg, DSPJitSignExtend extend)
{ {
switch (reg & 0x1f) { switch (reg & 0x1f)
{
case DSP_REG_ST0: case DSP_REG_ST0:
case DSP_REG_ST1: case DSP_REG_ST1:
case DSP_REG_ST2: case DSP_REG_ST2:
@ -424,13 +425,14 @@ void DSPEmitter::addarn(const UDSPInstruction opc)
// g_dsp.r[dreg] = dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]); // g_dsp.r[dreg] = dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]);
// From looking around it is always called with the matching index register // From looking around it is always called with the matching index register
increase_addr_reg(opc & 0x3, (opc >> 2) & 0x3); increase_addr_reg(opc & 0x3, (opc >> 2) & 0x3);
} }
//---- //----
void DSPEmitter::setCompileSR(u16 bit) { void DSPEmitter::setCompileSR(u16 bit)
{
// g_dsp.r[DSP_REG_SR] |= bit // g_dsp.r[DSP_REG_SR] |= bit
OpArg sr_reg; OpArg sr_reg;
@ -441,7 +443,8 @@ void DSPEmitter::setCompileSR(u16 bit) {
compileSR |= bit; compileSR |= bit;
} }
void DSPEmitter::clrCompileSR(u16 bit) { void DSPEmitter::clrCompileSR(u16 bit)
{
// g_dsp.r[DSP_REG_SR] &= bit // g_dsp.r[DSP_REG_SR] &= bit
OpArg sr_reg; OpArg sr_reg;
@ -498,7 +501,7 @@ void DSPEmitter::srbith(const UDSPInstruction opc)
break; break;
// Automatic 40-bit sign extension when loading ACx.M. // Automatic 40-bit sign extension when loading ACx.M.
// SET40 changes something very important: see the LRI instruction above. // SET40 changes something very important: see the LRI instruction above.
case 0xe: // SET16 (CLR40) case 0xe: // SET16 (CLR40)
clrCompileSR(SR_40_MODE_BIT); clrCompileSR(SR_40_MODE_BIT);
break; break;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Additional copyrights go to Duddie and Tratax (c) 2004 // Additional copyrights go to Duddie and Tratax (c) 2004

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "DSPJitRegCache.h" #include "DSPJitRegCache.h"
@ -21,8 +21,10 @@
using namespace Gen; using namespace Gen;
static void *reg_ptr(int reg) { static void *reg_ptr(int reg)
switch(reg) { {
switch(reg)
{
case DSP_REG_AR0: case DSP_REG_AR0:
case DSP_REG_AR1: case DSP_REG_AR1:
case DSP_REG_AR2: case DSP_REG_AR2:
@ -84,11 +86,14 @@ static void *reg_ptr(int reg) {
//#undef STATIC_REG_ACCS //#undef STATIC_REG_ACCS
DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter) DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
: emitter(_emitter), temporary(false), merged(false) { : emitter(_emitter), temporary(false), merged(false)
for(unsigned int i = 0; i < NUMXREGS; i++) { {
for(unsigned int i = 0; i < NUMXREGS; i++)
{
xregs[i].guest_reg = DSP_REG_STATIC; xregs[i].guest_reg = DSP_REG_STATIC;
xregs[i].pushed = false; xregs[i].pushed = false;
} }
xregs[RAX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV xregs[RAX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
xregs[RDX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV xregs[RDX].guest_reg = DSP_REG_STATIC;// reserved for MUL/DIV
xregs[RCX].guest_reg = DSP_REG_STATIC;// reserved for shifts xregs[RCX].guest_reg = DSP_REG_STATIC;// reserved for shifts
@ -98,7 +103,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
xregs[RSP].guest_reg = DSP_REG_STATIC;//stack pointer xregs[RSP].guest_reg = DSP_REG_STATIC;//stack pointer
xregs[RBP].guest_reg = DSP_REG_NONE;//definitely usable in dsplle because xregs[RBP].guest_reg = DSP_REG_NONE;//definitely usable in dsplle because
//all external calls are protected //all external calls are protected
xregs[RSI].guest_reg = DSP_REG_NONE; xregs[RSI].guest_reg = DSP_REG_NONE;
xregs[RDI].guest_reg = DSP_REG_NONE; xregs[RDI].guest_reg = DSP_REG_NONE;
@ -119,7 +124,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
xregs[R15].guest_reg = DSP_REG_NONE; xregs[R15].guest_reg = DSP_REG_NONE;
#endif #endif
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
regs[i].mem = reg_ptr(i); regs[i].mem = reg_ptr(i);
regs[i].size = 0; regs[i].size = 0;
regs[i].dirty = false; regs[i].dirty = false;
@ -140,7 +146,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
regs[DSP_REG_ACC0_64].host_reg = R8; regs[DSP_REG_ACC0_64].host_reg = R8;
regs[DSP_REG_ACC1_64].host_reg = R9; regs[DSP_REG_ACC1_64].host_reg = R9;
#endif #endif
for(unsigned int i = 0; i < 2; i++) { for(unsigned int i = 0; i < 2; i++)
{
regs[i+DSP_REG_ACC0_64].size = 8; regs[i+DSP_REG_ACC0_64].size = 8;
regs[i+DSP_REG_ACL0].parentReg = i+DSP_REG_ACC0_64; regs[i+DSP_REG_ACL0].parentReg = i+DSP_REG_ACC0_64;
regs[i+DSP_REG_ACM0].parentReg = i+DSP_REG_ACC0_64; regs[i+DSP_REG_ACM0].parentReg = i+DSP_REG_ACC0_64;
@ -149,6 +156,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
regs[i+DSP_REG_ACM0].shift = 16; regs[i+DSP_REG_ACM0].shift = 16;
regs[i+DSP_REG_ACH0].shift = 32; regs[i+DSP_REG_ACH0].shift = 32;
} }
regs[DSP_REG_PROD_64].size = 8; regs[DSP_REG_PROD_64].size = 8;
regs[DSP_REG_PRODL].parentReg = DSP_REG_PROD_64; regs[DSP_REG_PRODL].parentReg = DSP_REG_PROD_64;
regs[DSP_REG_PRODM].parentReg = DSP_REG_PROD_64; regs[DSP_REG_PRODM].parentReg = DSP_REG_PROD_64;
@ -160,7 +168,8 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter &_emitter)
regs[DSP_REG_PRODM2].shift = 48; regs[DSP_REG_PRODM2].shift = 48;
#endif #endif
for(unsigned int i = 0; i < 2; i++) { for(unsigned int i = 0; i < 2; i++)
{
regs[i+DSP_REG_AX0_32].size = 4; regs[i+DSP_REG_AX0_32].size = 4;
regs[i+DSP_REG_AXL0].parentReg = i+DSP_REG_AX0_32; regs[i+DSP_REG_AXL0].parentReg = i+DSP_REG_AX0_32;
regs[i+DSP_REG_AXH0].parentReg = i+DSP_REG_AX0_32; regs[i+DSP_REG_AXH0].parentReg = i+DSP_REG_AX0_32;
@ -206,22 +215,25 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
unsigned int i; unsigned int i;
//drop all guest register not used by cache //drop all guest register not used by cache
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
regs[i].used = false;//used is restored later regs[i].used = false;//used is restored later
if (regs[i].loc.IsSimpleReg() && if (regs[i].loc.IsSimpleReg() &&
!cache.regs[i].loc.IsSimpleReg()) !cache.regs[i].loc.IsSimpleReg())
movToMemory(i); movToMemory(i);
} }
//try to move guest regs in the wrong host reg to the correct one //try to move guest regs in the wrong host reg to the correct one
int movcnt; int movcnt;
do { do
{
movcnt = 0; movcnt = 0;
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
X64Reg simple = regs[i].loc.GetSimpleReg(); X64Reg simple = regs[i].loc.GetSimpleReg();
X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg(); X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg();
if (simple_cache != simple
&& xregs[simple_cache].guest_reg == DSP_REG_NONE) if (simple_cache != simple && xregs[simple_cache].guest_reg == DSP_REG_NONE)
{ {
movToHostReg(i, simple_cache, true); movToHostReg(i, simple_cache, true);
movcnt++; movcnt++;
@ -230,35 +242,42 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
} while (movcnt != 0); } while (movcnt != 0);
//free all host regs that are not used for the same guest reg //free all host regs that are not used for the same guest reg
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
if (cache.regs[i].loc.GetSimpleReg() != if (cache.regs[i].loc.GetSimpleReg() !=
regs[i].loc.GetSimpleReg() && regs[i].loc.GetSimpleReg() &&
regs[i].loc.IsSimpleReg()) regs[i].loc.IsSimpleReg())
movToMemory(i); movToMemory(i);
} }
//load all guest regs that are in memory and should be in host reg //load all guest regs that are in memory and should be in host reg
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
if (cache.regs[i].loc.IsSimpleReg()) { {
movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), if (cache.regs[i].loc.IsSimpleReg())
true); {
movToHostReg(i, cache.regs[i].loc.GetSimpleReg(), true);
rotateHostReg(i, cache.regs[i].shift, true); rotateHostReg(i, cache.regs[i].shift, true);
} else if(cache.regs[i].loc.IsImm()) {
//todo: immediates?
} }
else if(cache.regs[i].loc.IsImm())
{
// TODO: Immediates?
}
regs[i].used = cache.regs[i].used; regs[i].used = cache.regs[i].used;
regs[i].dirty |= cache.regs[i].dirty; regs[i].dirty |= cache.regs[i].dirty;
regs[i].last_use_ctr = cache.regs[i].last_use_ctr; regs[i].last_use_ctr = cache.regs[i].last_use_ctr;
} }
//consistency checks //consistency checks
for(i = 0; i < NUMXREGS; i++) { for(i = 0; i < NUMXREGS; i++)
{
_assert_msg_(DSPLLE, _assert_msg_(DSPLLE,
xregs[i].guest_reg == cache.xregs[i].guest_reg, xregs[i].guest_reg == cache.xregs[i].guest_reg,
"cache and current xreg guest_reg mismatch for %d", i); "cache and current xreg guest_reg mismatch for %d", i);
} }
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
_assert_msg_(DSPLLE, _assert_msg_(DSPLLE,
regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(), regs[i].loc.IsImm() == cache.regs[i].loc.IsImm(),
"cache and current reg loc mismatch for %x", i); "cache and current reg loc mismatch for %x", i);
@ -285,16 +304,21 @@ void DSPJitRegCache::flushMemBackedRegs()
//this should have the same effect as //this should have the same effect as
//merge(DSPJitRegCache(emitter)); //merge(DSPJitRegCache(emitter));
unsigned int i; for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { {
_assert_msg_(DSPLLE, !regs[i].used, _assert_msg_(DSPLLE, !regs[i].used,
"register %x still in use", i); "register %x still in use", i);
if (regs[i].used) if (regs[i].used)
emitter.INT3(); emitter.INT3();
if (regs[i].host_reg != INVALID_REG) {
if (regs[i].host_reg != INVALID_REG)
{
movToHostReg(i,regs[i].host_reg,true); movToHostReg(i,regs[i].host_reg,true);
rotateHostReg(i, 0, true); rotateHostReg(i, 0, true);
} else if (regs[i].parentReg == DSP_REG_NONE) { }
else if (regs[i].parentReg == DSP_REG_NONE)
{
movToMemory(i); movToMemory(i);
} }
} }
@ -304,12 +328,14 @@ void DSPJitRegCache::flushRegs()
{ {
flushMemBackedRegs(); flushMemBackedRegs();
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
if (regs[i].host_reg != INVALID_REG) if (regs[i].host_reg != INVALID_REG)
movToMemory(i); movToMemory(i);
} }
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
_assert_msg_(DSPLLE, _assert_msg_(DSPLLE,
!regs[i].loc.IsSimpleReg(), !regs[i].loc.IsSimpleReg(),
"register %x is still a simple reg", i); "register %x is still a simple reg", i);
@ -373,12 +399,14 @@ static u64 ebp_store;
void DSPJitRegCache::loadRegs(bool emit) void DSPJitRegCache::loadRegs(bool emit)
{ {
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
if (regs[i].host_reg != INVALID_REG) if (regs[i].host_reg != INVALID_REG)
movToHostReg(i,regs[i].host_reg); movToHostReg(i,regs[i].host_reg);
} }
if (emit) { if (emit)
{
#ifdef _M_X64 #ifdef _M_X64
emitter.MOV(64, M(&ebp_store), R(RBP)); emitter.MOV(64, M(&ebp_store), R(RBP));
#else #else
@ -391,12 +419,14 @@ void DSPJitRegCache::saveRegs()
{ {
flushRegs(); flushRegs();
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
if (regs[i].host_reg != INVALID_REG) if (regs[i].host_reg != INVALID_REG)
movToMemory(i); movToMemory(i);
} }
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
_assert_msg_(DSPLLE, _assert_msg_(DSPLLE,
!regs[i].loc.IsSimpleReg(), !regs[i].loc.IsSimpleReg(),
"register %x is still a simple reg", i); "register %x is still a simple reg", i);
@ -409,16 +439,19 @@ void DSPJitRegCache::saveRegs()
#endif #endif
} }
void DSPJitRegCache::pushRegs() { void DSPJitRegCache::pushRegs()
{
flushMemBackedRegs(); flushMemBackedRegs();
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
if (regs[i].host_reg != INVALID_REG) if (regs[i].host_reg != INVALID_REG)
movToMemory(i); movToMemory(i);
} }
int push_count = 0; int push_count = 0;
for(unsigned int i = 0; i < NUMXREGS; i++) { for(unsigned int i = 0; i < NUMXREGS; i++)
{
if (xregs[i].guest_reg == DSP_REG_USED) if (xregs[i].guest_reg == DSP_REG_USED)
push_count++; push_count++;
} }
@ -432,21 +465,25 @@ void DSPJitRegCache::pushRegs() {
emitter.SUB(32,R(ESP),Imm32(16 - 4 * (push_count & 3))); emitter.SUB(32,R(ESP),Imm32(16 - 4 * (push_count & 3)));
#endif #endif
for(unsigned int i = 0; i < NUMXREGS; i++) { for(unsigned int i = 0; i < NUMXREGS; i++)
if (xregs[i].guest_reg == DSP_REG_USED) { {
if (xregs[i].guest_reg == DSP_REG_USED)
{
emitter.PUSH((X64Reg)i); emitter.PUSH((X64Reg)i);
xregs[i].pushed = true; xregs[i].pushed = true;
xregs[i].guest_reg = DSP_REG_NONE; xregs[i].guest_reg = DSP_REG_NONE;
} }
} }
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
_assert_msg_(DSPLLE, _assert_msg_(DSPLLE,
!regs[i].loc.IsSimpleReg(), !regs[i].loc.IsSimpleReg(),
"register %x is still a simple reg", i); "register %x is still a simple reg", i);
} }
for(unsigned int i = 0; i < NUMXREGS; i++) { for(unsigned int i = 0; i < NUMXREGS; i++)
{
_assert_msg_(DSPLLE, _assert_msg_(DSPLLE,
xregs[i].guest_reg == DSP_REG_NONE || xregs[i].guest_reg == DSP_REG_NONE ||
xregs[i].guest_reg == DSP_REG_STATIC, xregs[i].guest_reg == DSP_REG_STATIC,
@ -467,13 +504,16 @@ void DSPJitRegCache::popRegs() {
emitter.MOV(32, M(&ebp_store), R(EBP)); emitter.MOV(32, M(&ebp_store), R(EBP));
#endif #endif
int push_count = 0; int push_count = 0;
for(unsigned int i = 0; i < NUMXREGS; i++) { for(unsigned int i = 0; i < NUMXREGS; i++)
{
if (xregs[i].pushed) if (xregs[i].pushed)
push_count++; push_count++;
} }
for(int i = NUMXREGS-1; i >= 0; i--) { for(int i = NUMXREGS-1; i >= 0; i--)
if (xregs[i].pushed) { {
if (xregs[i].pushed)
{
emitter.POP((X64Reg)i); emitter.POP((X64Reg)i);
xregs[i].pushed = false; xregs[i].pushed = false;
xregs[i].guest_reg = DSP_REG_USED; xregs[i].guest_reg = DSP_REG_USED;
@ -489,14 +529,17 @@ void DSPJitRegCache::popRegs() {
emitter.ADD(32,R(ESP),Imm32(16 - 4 * (push_count & 3))); emitter.ADD(32,R(ESP),Imm32(16 - 4 * (push_count & 3)));
#endif #endif
for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { for(unsigned int i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++)
{
if (regs[i].host_reg != INVALID_REG) if (regs[i].host_reg != INVALID_REG)
movToHostReg(i,regs[i].host_reg); movToHostReg(i,regs[i].host_reg);
} }
} }
X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg) { X64Reg DSPJitRegCache::makeABICallSafe(X64Reg reg)
if (reg != RBP) { {
if (reg != RBP)
{
return reg; return reg;
} }
@ -530,8 +573,10 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
if (xregs[host_reg].guest_reg != DSP_REG_STATIC) if (xregs[host_reg].guest_reg != DSP_REG_STATIC)
xregs[host_reg].guest_reg = reg; xregs[host_reg].guest_reg = reg;
if (load) { if (load)
switch(regs[reg].size) { {
switch(regs[reg].size)
{
case 2: case 2:
emitter.MOV(16, R(host_reg), regs[reg].loc); break; emitter.MOV(16, R(host_reg), regs[reg].loc); break;
case 4: case 4:
@ -545,9 +590,10 @@ void DSPJitRegCache::movToHostReg(int reg, X64Reg host_reg, bool load)
break; break;
} }
} }
regs[reg].loc = R(host_reg); regs[reg].loc = R(host_reg);
if (old_reg != INVALID_REG && if (old_reg != INVALID_REG &&
xregs[old_reg].guest_reg != DSP_REG_STATIC) xregs[old_reg].guest_reg != DSP_REG_STATIC)
xregs[old_reg].guest_reg = DSP_REG_NONE; xregs[old_reg].guest_reg = DSP_REG_NONE;
} }
@ -562,13 +608,16 @@ void DSPJitRegCache::movToHostReg(int reg, bool load)
if (regs[reg].loc.IsSimpleReg()) if (regs[reg].loc.IsSimpleReg())
return; return;
X64Reg tmp; X64Reg tmp;
if (regs[reg].host_reg != INVALID_REG) if (regs[reg].host_reg != INVALID_REG)
tmp = regs[reg].host_reg; tmp = regs[reg].host_reg;
else else
tmp = findSpillFreeXReg(); tmp = findSpillFreeXReg();
if (tmp == INVALID_REG) if (tmp == INVALID_REG)
return; return;
movToHostReg(reg, tmp, load); movToHostReg(reg, tmp, load);
} }
@ -582,37 +631,43 @@ void DSPJitRegCache::rotateHostReg(int reg, int shift, bool emit)
"register %x is not a simple reg", reg); "register %x is not a simple reg", reg);
_assert_msg_(DSPLLE, !regs[reg].used, _assert_msg_(DSPLLE, !regs[reg].used,
"rotating in use guest reg %x!", reg); "rotating in use guest reg %x!", reg);
if (shift > regs[reg].shift && emit) {
switch(regs[reg].size) { if (shift > regs[reg].shift && emit)
{
switch(regs[reg].size)
{
case 2: case 2:
emitter.ROR(16, regs[reg].loc, emitter.ROR(16, regs[reg].loc,
Imm8(shift - regs[reg].shift)); Imm8(shift - regs[reg].shift));
break; break;
case 4: case 4:
emitter.ROR(32, regs[reg].loc, emitter.ROR(32, regs[reg].loc,
Imm8(shift - regs[reg].shift)); Imm8(shift - regs[reg].shift));
break; break;
#ifdef _M_X64 #ifdef _M_X64
case 8: case 8:
emitter.ROR(64, regs[reg].loc, emitter.ROR(64, regs[reg].loc,
Imm8(shift - regs[reg].shift)); Imm8(shift - regs[reg].shift));
break; break;
#endif #endif
} }
} else if (shift < regs[reg].shift && emit) { }
switch(regs[reg].size) { else if (shift < regs[reg].shift && emit)
{
switch(regs[reg].size)
{
case 2: case 2:
emitter.ROL(16, regs[reg].loc, emitter.ROL(16, regs[reg].loc,
Imm8(regs[reg].shift - shift)); Imm8(regs[reg].shift - shift));
break; break;
case 4: case 4:
emitter.ROL(32, regs[reg].loc, emitter.ROL(32, regs[reg].loc,
Imm8(regs[reg].shift - shift)); Imm8(regs[reg].shift - shift));
break; break;
#ifdef _M_X64 #ifdef _M_X64
case 8: case 8:
emitter.ROL(64, regs[reg].loc, emitter.ROL(64, regs[reg].loc,
Imm8(regs[reg].shift - shift)); Imm8(regs[reg].shift - shift));
break; break;
#endif #endif
} }
@ -638,16 +693,23 @@ void DSPJitRegCache::movToMemory(int reg)
//but first, check for any needed rotations //but first, check for any needed rotations
if (regs[reg].loc.IsSimpleReg()) if (regs[reg].loc.IsSimpleReg())
{
rotateHostReg(reg, 0, true); rotateHostReg(reg, 0, true);
else {} //todo: immediates? }
else
{
// TODO: Immediates?
}
_assert_msg_(DSPLLE, regs[reg].shift == 0, "still shifted??"); _assert_msg_(DSPLLE, regs[reg].shift == 0, "still shifted??");
//move to mem //move to mem
OpArg tmp = M(regs[reg].mem); OpArg tmp = M(regs[reg].mem);
if (regs[reg].dirty) { if (regs[reg].dirty)
switch(regs[reg].size) { {
switch(regs[reg].size)
{
case 2: case 2:
emitter.MOV(16, tmp, regs[reg].loc); break; emitter.MOV(16, tmp, regs[reg].loc); break;
case 4: case 4:
@ -663,7 +725,8 @@ void DSPJitRegCache::movToMemory(int reg)
regs[reg].dirty = false; regs[reg].dirty = false;
} }
if (regs[reg].loc.IsSimpleReg()) { if (regs[reg].loc.IsSimpleReg())
{
X64Reg hostreg = regs[reg].loc.GetSimpleReg(); X64Reg hostreg = regs[reg].loc.GetSimpleReg();
if (xregs[hostreg].guest_reg != DSP_REG_STATIC) if (xregs[hostreg].guest_reg != DSP_REG_STATIC)
xregs[hostreg].guest_reg = DSP_REG_NONE; xregs[hostreg].guest_reg = DSP_REG_NONE;
@ -677,7 +740,8 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
{ {
int real_reg; int real_reg;
int shift; int shift;
if (regs[reg].parentReg != DSP_REG_NONE) { if (regs[reg].parentReg != DSP_REG_NONE)
{
real_reg = regs[reg].parentReg; real_reg = regs[reg].parentReg;
// always load and rotate since we need the other // always load and rotate since we need the other
@ -685,7 +749,9 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
load = true; load = true;
shift = regs[reg].shift; shift = regs[reg].shift;
} else { }
else
{
real_reg = reg; real_reg = reg;
shift = 0; shift = 0;
} }
@ -698,20 +764,24 @@ void DSPJitRegCache::getReg(int reg, OpArg &oparg, bool load)
// no nead to actually emit code for load or rotate if caller doesn't // no nead to actually emit code for load or rotate if caller doesn't
// use the contents, but see above for a reason to force the load // use the contents, but see above for a reason to force the load
movToHostReg(real_reg, load); movToHostReg(real_reg, load);
//todo: actually handle INVALID_REG
// TODO: actually handle INVALID_REG
_assert_msg_(DSPLLE, regs[real_reg].loc.IsSimpleReg(), _assert_msg_(DSPLLE, regs[real_reg].loc.IsSimpleReg(),
"did not get host reg for %x", reg); "did not get host reg for %x", reg);
rotateHostReg(real_reg, shift, load); rotateHostReg(real_reg, shift, load);
oparg = regs[real_reg].loc; oparg = regs[real_reg].loc;
regs[real_reg].used = true; regs[real_reg].used = true;
//do some register specific fixup //do some register specific fixup
switch(reg) { switch(reg)
{
#ifdef _M_X64 #ifdef _M_X64
case DSP_REG_ACC0_64: case DSP_REG_ACC0_64:
case DSP_REG_ACC1_64: case DSP_REG_ACC1_64:
{ {
if (load) { if (load)
{
//need to do this because interpreter only does 48 bits //need to do this because interpreter only does 48 bits
//(and putReg does the same) //(and putReg does the same)
emitter.SHL(64, oparg, Imm8(64-40));//sign extend emitter.SHL(64, oparg, Imm8(64-40));//sign extend
@ -730,15 +800,20 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
int real_reg = reg; int real_reg = reg;
if (regs[reg].parentReg != DSP_REG_NONE) if (regs[reg].parentReg != DSP_REG_NONE)
real_reg = regs[reg].parentReg; real_reg = regs[reg].parentReg;
OpArg oparg = regs[real_reg].loc; OpArg oparg = regs[real_reg].loc;
switch(reg) {
switch(reg)
{
case DSP_REG_ACH0: case DSP_REG_ACH0:
case DSP_REG_ACH1: case DSP_REG_ACH1:
{ {
if (dirty) { if (dirty)
{
//no need to extend to full 64bit here until interpreter //no need to extend to full 64bit here until interpreter
//uses that //uses that
if (oparg.IsSimpleReg()) { if (oparg.IsSimpleReg())
{
//register is already shifted correctly //register is already shifted correctly
//(if at all) //(if at all)
@ -747,9 +822,9 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
//cannot use movsx with SPL, BPL, SIL or DIL //cannot use movsx with SPL, BPL, SIL or DIL
//on 32 bit //on 32 bit
if (oparg.GetSimpleReg() == RSP || if (oparg.GetSimpleReg() == RSP ||
oparg.GetSimpleReg() == RBP || oparg.GetSimpleReg() == RBP ||
oparg.GetSimpleReg() == RSI || oparg.GetSimpleReg() == RSI ||
oparg.GetSimpleReg() == RDI) oparg.GetSimpleReg() == RDI)
{ {
emitter.SHL(16,oparg,Imm8(8)); emitter.SHL(16,oparg,Imm8(8));
emitter.SAR(16,oparg,Imm8(8)); emitter.SAR(16,oparg,Imm8(8));
@ -758,12 +833,16 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
#endif #endif
{ {
emitter.MOVSX(16, 8, emitter.MOVSX(16, 8,
oparg.GetSimpleReg(), oparg.GetSimpleReg(),
oparg); oparg);
} }
} else if (oparg.IsImm()) { }
//todo: immediates? else if (oparg.IsImm())
} else { {
// TODO: Immediates?
}
else
{
//this works on the memory, so use reg instead //this works on the memory, so use reg instead
//of real_reg, since it has the right loc //of real_reg, since it has the right loc
X64Reg tmp; X64Reg tmp;
@ -780,7 +859,8 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
case DSP_REG_ACC0_64: case DSP_REG_ACC0_64:
case DSP_REG_ACC1_64: case DSP_REG_ACC1_64:
{ {
if (dirty) { if (dirty)
{
emitter.SHL(64, oparg, Imm8(64-40));//sign extend emitter.SHL(64, oparg, Imm8(64-40));//sign extend
emitter.SAR(64, oparg, Imm8(64-40)); emitter.SAR(64, oparg, Imm8(64-40));
} }
@ -790,8 +870,11 @@ void DSPJitRegCache::putReg(int reg, bool dirty)
default: default:
break; break;
} }
regs[real_reg].used = false; regs[real_reg].used = false;
if (regs[real_reg].loc.IsSimpleReg()) {
if (regs[real_reg].loc.IsSimpleReg())
{
regs[real_reg].dirty |= dirty; regs[real_reg].dirty |= dirty;
regs[real_reg].last_use_ctr = use_ctr; regs[real_reg].last_use_ctr = use_ctr;
use_ctr++; use_ctr++;
@ -802,9 +885,12 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend
{ {
OpArg reg; OpArg reg;
getReg(sreg, reg); getReg(sreg, reg);
switch(regs[sreg].size) {
switch(regs[sreg].size)
{
case 2: case 2:
switch(extend) { switch(extend)
{
#ifdef _M_X64 #ifdef _M_X64
case SIGN: emitter.MOVSX(64, 16, host_dreg, reg); break; case SIGN: emitter.MOVSX(64, 16, host_dreg, reg); break;
case ZERO: emitter.MOVZX(64, 16, host_dreg, reg); break; case ZERO: emitter.MOVZX(64, 16, host_dreg, reg); break;
@ -817,7 +903,8 @@ void DSPJitRegCache::readReg(int sreg, X64Reg host_dreg, DSPJitSignExtend extend
break; break;
case 4: case 4:
#ifdef _M_X64 #ifdef _M_X64
switch(extend) { switch(extend)
{
case SIGN: emitter.MOVSX(64, 32, host_dreg, reg); break; case SIGN: emitter.MOVSX(64, 32, host_dreg, reg); break;
case ZERO: emitter.MOVZX(64, 32, host_dreg, reg); break; case ZERO: emitter.MOVZX(64, 32, host_dreg, reg); break;
case NONE: emitter.MOV(32, R(host_dreg), reg); break; case NONE: emitter.MOV(32, R(host_dreg), reg); break;
@ -842,7 +929,9 @@ void DSPJitRegCache::writeReg(int dreg, OpArg arg)
{ {
OpArg reg; OpArg reg;
getReg(dreg, reg, false); getReg(dreg, reg, false);
switch(regs[dreg].size) {
switch(regs[dreg].size)
{
case 2: emitter.MOV(16, reg, arg); break; case 2: emitter.MOV(16, reg, arg); break;
case 4: emitter.MOV(32, reg, arg); break; case 4: emitter.MOV(32, reg, arg); break;
#ifdef _M_X64 #ifdef _M_X64
@ -870,29 +959,36 @@ X64Reg DSPJitRegCache::spillXReg()
unsigned int i; unsigned int i;
unsigned int max_use_ctr_diff = 0; unsigned int max_use_ctr_diff = 0;
X64Reg least_recent_use_reg = INVALID_REG; X64Reg least_recent_use_reg = INVALID_REG;
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) { for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
{
X64Reg reg = alloc_order[i]; X64Reg reg = alloc_order[i];
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED && if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
!regs[xregs[reg].guest_reg].used) { !regs[xregs[reg].guest_reg].used)
{
unsigned int use_ctr_diff = use_ctr - unsigned int use_ctr_diff = use_ctr -
regs[xregs[reg].guest_reg].last_use_ctr; regs[xregs[reg].guest_reg].last_use_ctr;
if (use_ctr_diff >= max_use_ctr_diff) {
if (use_ctr_diff >= max_use_ctr_diff)
{
max_use_ctr_diff = use_ctr_diff; max_use_ctr_diff = use_ctr_diff;
least_recent_use_reg = reg; least_recent_use_reg = reg;
} }
} }
} }
if (least_recent_use_reg != INVALID_REG) { if (least_recent_use_reg != INVALID_REG)
{
movToMemory(xregs[least_recent_use_reg].guest_reg); movToMemory(xregs[least_recent_use_reg].guest_reg);
return least_recent_use_reg; return least_recent_use_reg;
} }
//just choose one. //just choose one.
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) { for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
{
X64Reg reg = alloc_order[i]; X64Reg reg = alloc_order[i];
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED && if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED &&
!regs[xregs[reg].guest_reg].used) { !regs[xregs[reg].guest_reg].used)
{
movToMemory(xregs[reg].guest_reg); movToMemory(xregs[reg].guest_reg);
return reg; return reg;
} }
@ -903,12 +999,16 @@ X64Reg DSPJitRegCache::spillXReg()
void DSPJitRegCache::spillXReg(X64Reg reg) void DSPJitRegCache::spillXReg(X64Reg reg)
{ {
if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED) { if (xregs[reg].guest_reg <= DSP_REG_MAX_MEM_BACKED)
{
_assert_msg_(DSPLLE, !regs[xregs[reg].guest_reg].used, _assert_msg_(DSPLLE, !regs[xregs[reg].guest_reg].used,
"to be spilled host reg %x(guest reg %x) still in use!", "to be spilled host reg %x(guest reg %x) still in use!",
reg, xregs[reg].guest_reg); reg, xregs[reg].guest_reg);
movToMemory(xregs[reg].guest_reg); movToMemory(xregs[reg].guest_reg);
} else { }
else
{
_assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_NONE, _assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_NONE,
"to be spilled host reg %x still in use!", "to be spilled host reg %x still in use!",
reg); reg);
@ -917,9 +1017,10 @@ void DSPJitRegCache::spillXReg(X64Reg reg)
X64Reg DSPJitRegCache::findFreeXReg() X64Reg DSPJitRegCache::findFreeXReg()
{ {
unsigned int i; for(unsigned int i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++)
for(i = 0; i < sizeof(alloc_order)/sizeof(alloc_order[0]); i++) { {
if (xregs[alloc_order[i]].guest_reg == DSP_REG_NONE) { if (xregs[alloc_order[i]].guest_reg == DSP_REG_NONE)
{
return alloc_order[i]; return alloc_order[i];
} }
} }
@ -946,23 +1047,29 @@ void DSPJitRegCache::getFreeXReg(X64Reg &reg)
void DSPJitRegCache::getXReg(X64Reg reg) void DSPJitRegCache::getXReg(X64Reg reg)
{ {
if (xregs[reg].guest_reg == DSP_REG_STATIC) { if (xregs[reg].guest_reg == DSP_REG_STATIC)
{
ERROR_LOG(DSPLLE, "Trying to get statically used XReg %d", reg); ERROR_LOG(DSPLLE, "Trying to get statically used XReg %d", reg);
return; return;
} }
if (xregs[reg].guest_reg != DSP_REG_NONE) if (xregs[reg].guest_reg != DSP_REG_NONE)
spillXReg(reg); spillXReg(reg);
_assert_msg_(DSPLLE, xregs[reg].guest_reg != DSP_REG_NONE, "register already in use"); _assert_msg_(DSPLLE, xregs[reg].guest_reg != DSP_REG_NONE, "register already in use");
xregs[reg].guest_reg = DSP_REG_USED; xregs[reg].guest_reg = DSP_REG_USED;
} }
void DSPJitRegCache::putXReg(X64Reg reg) void DSPJitRegCache::putXReg(X64Reg reg)
{ {
if (xregs[reg].guest_reg == DSP_REG_STATIC) { if (xregs[reg].guest_reg == DSP_REG_STATIC)
{
ERROR_LOG(DSPLLE, "Trying to put statically used XReg %d", reg); ERROR_LOG(DSPLLE, "Trying to put statically used XReg %d", reg);
return; return;
} }
_assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_USED, _assert_msg_(DSPLLE, xregs[reg].guest_reg == DSP_REG_USED,
"putXReg without get(Free)XReg"); "putXReg without get(Free)XReg");
xregs[reg].guest_reg = DSP_REG_NONE; xregs[reg].guest_reg = DSP_REG_NONE;
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPJITREGCACHE_H #ifndef _DSPJITREGCACHE_H
@ -22,7 +22,8 @@
class DSPEmitter; class DSPEmitter;
enum DSPJitRegSpecial { enum DSPJitRegSpecial
{
DSP_REG_AX0_32 =32, DSP_REG_AX0_32 =32,
DSP_REG_AX1_32 =33, DSP_REG_AX1_32 =33,
#ifdef _M_X64 #ifdef _M_X64
@ -39,8 +40,11 @@ enum DSPJitRegSpecial {
DSP_REG_NONE =255 DSP_REG_NONE =255
}; };
enum DSPJitSignExtend { enum DSPJitSignExtend
SIGN, ZERO, NONE {
SIGN,
ZERO,
NONE
}; };
#ifdef _M_X64 #ifdef _M_X64
@ -49,14 +53,17 @@ enum DSPJitSignExtend {
#define NUMXREGS 8 #define NUMXREGS 8
#endif #endif
class DSPJitRegCache { class DSPJitRegCache
{
private: private:
struct X64CachedReg struct X64CachedReg
{ {
int guest_reg; //including DSPJitRegSpecial int guest_reg; //including DSPJitRegSpecial
bool pushed; bool pushed;
}; };
struct DynamicReg {
struct DynamicReg
{
Gen::OpArg loc; Gen::OpArg loc;
void *mem; void *mem;
size_t size; size_t size;
@ -67,7 +74,7 @@ private:
int shift;//current shift if parentReg == DSP_REG_NONE int shift;//current shift if parentReg == DSP_REG_NONE
//otherwise the shift this part can be found at //otherwise the shift this part can be found at
Gen::X64Reg host_reg; Gen::X64Reg host_reg;
/* todo: /* TODO:
+ drop sameReg + drop sameReg
+ add parentReg + add parentReg
+ add shift: + add shift:

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "../DSPMemoryMap.h" #include "../DSPMemoryMap.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef __DSPJITUTIL_H__ #ifndef __DSPJITUTIL_H__

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "LabelMap.h" #include "LabelMap.h"
@ -68,10 +68,13 @@ bool LabelMap::GetLabelValue(const std::string &label, u16 *value, LabelType typ
{ {
if (!label.compare(labels[i].name)) if (!label.compare(labels[i].name))
{ {
if (type & labels[i].type) { if (type & labels[i].type)
{
*value = labels[i].addr; *value = labels[i].addr;
return true; return true;
} else { }
else
{
printf("WARNING: Wrong label type requested. %s\n", label.c_str()); printf("WARNING: Wrong label type requested. %s\n", label.c_str());
} }
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _LABELMAP_H #ifndef _LABELMAP_H

View File

@ -752,7 +752,7 @@ void DSPAssembler::InitPass(int pass)
bool DSPAssembler::AssembleFile(const char *fname, int pass) bool DSPAssembler::AssembleFile(const char *fname, int pass)
{ {
int disable_text = 0; // modified by Hermes int disable_text = 0; // modified by Hermes
std::ifstream fsrc; std::ifstream fsrc;
OpenFStream(fsrc, fname, std::ios_base::in); OpenFStream(fsrc, fname, std::ios_base::in);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "DSPEmulator.h" #include "DSPEmulator.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPEMULATOR_H_ #ifndef _DSPEMULATOR_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -40,7 +40,7 @@ void AddAutoBreakpoints()
{ {
Symbol *symbol = g_symbolDB.GetSymbolFromName(bps[i]); Symbol *symbol = g_symbolDB.GetSymbolFromName(bps[i]);
if (symbol) if (symbol)
PowerPC::breakpoints.Add(symbol->address, false); PowerPC::breakpoints.Add(symbol->address, false);
} }
#endif #endif
#endif #endif
@ -54,15 +54,15 @@ bool GetCallstack(std::vector<CallstackEntry> &output)
if (Core::GetState() == Core::CORE_UNINITIALIZED) if (Core::GetState() == Core::CORE_UNINITIALIZED)
return false; return false;
if (!Memory::IsRAMAddress(PowerPC::ppcState.gpr[1])) if (!Memory::IsRAMAddress(PowerPC::ppcState.gpr[1]))
return false; return false;
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
if (LR == 0) if (LR == 0)
{ {
CallstackEntry entry; CallstackEntry entry;
entry.Name = "(error: LR=0)"; entry.Name = "(error: LR=0)";
entry.vAddress = 0x0; entry.vAddress = 0x0;
output.push_back(entry); output.push_back(entry);
return false; return false;
} }
@ -78,31 +78,31 @@ bool GetCallstack(std::vector<CallstackEntry> &output)
//walk the stack chain //walk the stack chain
while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0)) while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
{ {
if (!Memory::IsRAMAddress(addr + 4)) if (!Memory::IsRAMAddress(addr + 4))
return false; return false;
u32 func = Memory::ReadUnchecked_U32(addr + 4); u32 func = Memory::ReadUnchecked_U32(addr + 4);
const char *str = g_symbolDB.GetDescription(func); const char *str = g_symbolDB.GetDescription(func);
if (!str || strlen(str) == 0 || !strcmp(str, "Invalid")) if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
str = "(unknown)"; str = "(unknown)";
entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func - 4); entry.Name = StringFromFormat(" * %s [ addr = %08x ]\n", str, func - 4);
entry.vAddress = func - 4; entry.vAddress = func - 4;
output.push_back(entry); output.push_back(entry);
if (!Memory::IsRAMAddress(addr)) if (!Memory::IsRAMAddress(addr))
return false; return false;
addr = Memory::ReadUnchecked_U32(addr); addr = Memory::ReadUnchecked_U32(addr);
} }
return true; return true;
} }
void PrintCallstack() void PrintCallstack()
{ {
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
printf("== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]); printf("== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]);
if (LR == 0) { if (LR == 0) {
@ -114,7 +114,7 @@ void PrintCallstack()
printf(" * %s [ LR = %08x ]", g_symbolDB.GetDescription(LR), LR); printf(" * %s [ LR = %08x ]", g_symbolDB.GetDescription(LR), LR);
count++; count++;
} }
//walk the stack chain //walk the stack chain
while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0)) while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
{ {

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DEBUGGER_SYMBOLMAP_H #ifndef _DEBUGGER_SYMBOLMAP_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <stdio.h> #include <stdio.h>

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// uncompress the dumps from costis GC-Debugger tool // uncompress the dumps from costis GC-Debugger tool
// //

View File

@ -43,12 +43,12 @@
typedef struct typedef struct
{ {
unsigned char ID[4]; unsigned char ID[4];
unsigned char clazz; unsigned char clazz;
unsigned char data; unsigned char data;
unsigned char version; unsigned char version;
unsigned char pad[9]; unsigned char pad[9];
unsigned short e_type; // ELF file type unsigned short e_type; // ELF file type
unsigned short e_machine; // ELF target machine unsigned short e_machine; // ELF target machine
unsigned int e_version; // ELF file version number unsigned int e_version; // ELF file version number
unsigned int e_entry; unsigned int e_entry;
@ -63,15 +63,16 @@ typedef struct
unsigned short e_shtrndx; unsigned short e_shtrndx;
} ELF_Header; } ELF_Header;
typedef struct { typedef struct
unsigned int type; {
unsigned int offset; unsigned int type;
unsigned int vaddr; unsigned int offset;
unsigned int paddr; unsigned int vaddr;
unsigned int filesz; unsigned int paddr;
unsigned int memsz; unsigned int filesz;
unsigned int flags; unsigned int memsz;
unsigned int align; unsigned int flags;
unsigned int align;
} Program_Header; } Program_Header;
typedef struct typedef struct
@ -88,16 +89,18 @@ typedef struct
unsigned int entsize; unsigned int entsize;
} Section_Header; } Section_Header;
typedef struct { typedef struct
unsigned int name; {
unsigned int value; unsigned int name;
unsigned int size; unsigned int value;
unsigned char info; unsigned int size;
unsigned char other; unsigned char info;
unsigned short shndx; unsigned char other;
unsigned short shndx;
} Symbol_Header; } Symbol_Header;
typedef struct { typedef struct
{
unsigned int offset; unsigned int offset;
unsigned int info; unsigned int info;
signed int addend; signed int addend;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Debugger_SymbolMap.h" #include "Debugger_SymbolMap.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// M O D U L E B E G I N // M O D U L E B E G I N

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FifoAnalyzer.h" #include "FifoAnalyzer.h"
@ -35,21 +35,21 @@ void Init()
} }
u8 ReadFifo8(u8 *&data) u8 ReadFifo8(u8 *&data)
{ {
u8 value = data[0]; u8 value = data[0];
data += 1; data += 1;
return value; return value;
} }
u16 ReadFifo16(u8 *&data) u16 ReadFifo16(u8 *&data)
{ {
u16 value = Common::swap16(data); u16 value = Common::swap16(data);
data += 2; data += 2;
return value; return value;
} }
u32 ReadFifo32(u8 *&data) u32 ReadFifo32(u8 *&data)
{ {
u32 value = Common::swap32(data); u32 value = Common::swap32(data);
data += 4; data += 4;
return value; return value;
@ -57,13 +57,13 @@ u32 ReadFifo32(u8 *&data)
void InitBPMemory(BPMemory *bpMem) void InitBPMemory(BPMemory *bpMem)
{ {
memset(bpMem, 0, sizeof(BPMemory)); memset(bpMem, 0, sizeof(BPMemory));
bpMem->bpMask = 0x00FFFFFF; bpMem->bpMask = 0x00FFFFFF;
} }
BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem) BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem)
{ {
//handle the mask register //handle the mask register
int opcode = value >> 24; int opcode = value >> 24;
int oldval = ((u32*)&bpMem)[opcode]; int oldval = ((u32*)&bpMem)[opcode];
int newval = (oldval & ~bpMem.bpMask) | (value & bpMem.bpMask); int newval = (oldval & ~bpMem.bpMask) | (value & bpMem.bpMask);
@ -71,7 +71,7 @@ BPCmd DecodeBPCmd(u32 value, const BPMemory &bpMem)
BPCmd bp = {opcode, changes, newval}; BPCmd bp = {opcode, changes, newval};
return bp; return bp;
} }
void LoadBPReg(const BPCmd &bp, BPMemory &bpMem) void LoadBPReg(const BPCmd &bp, BPMemory &bpMem)
@ -152,23 +152,23 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
const TVtxDesc &vtxDesc = cpMem.vtxDesc; const TVtxDesc &vtxDesc = cpMem.vtxDesc;
const VAT &vtxAttr = cpMem.vtxAttr[vatIndex]; const VAT &vtxAttr = cpMem.vtxAttr[vatIndex];
// Colors // Colors
const u32 colDesc[2] = {vtxDesc.Color0, vtxDesc.Color1}; const u32 colDesc[2] = {vtxDesc.Color0, vtxDesc.Color1};
const u32 colComp[2] = {vtxAttr.g0.Color0Comp, vtxAttr.g0.Color1Comp}; const u32 colComp[2] = {vtxAttr.g0.Color0Comp, vtxAttr.g0.Color1Comp};
const u32 tcElements[8] =
{
vtxAttr.g0.Tex0CoordElements, vtxAttr.g1.Tex1CoordElements, vtxAttr.g1.Tex2CoordElements,
vtxAttr.g1.Tex3CoordElements, vtxAttr.g1.Tex4CoordElements, vtxAttr.g2.Tex5CoordElements,
vtxAttr.g2.Tex6CoordElements, vtxAttr.g2.Tex7CoordElements
};
const u32 tcFormat[8] = const u32 tcElements[8] =
{ {
vtxAttr.g0.Tex0CoordFormat, vtxAttr.g1.Tex1CoordFormat, vtxAttr.g1.Tex2CoordFormat, vtxAttr.g0.Tex0CoordElements, vtxAttr.g1.Tex1CoordElements, vtxAttr.g1.Tex2CoordElements,
vtxAttr.g1.Tex3CoordFormat, vtxAttr.g1.Tex4CoordFormat, vtxAttr.g2.Tex5CoordFormat, vtxAttr.g1.Tex3CoordElements, vtxAttr.g1.Tex4CoordElements, vtxAttr.g2.Tex5CoordElements,
vtxAttr.g2.Tex6CoordFormat, vtxAttr.g2.Tex7CoordFormat vtxAttr.g2.Tex6CoordElements, vtxAttr.g2.Tex7CoordElements
}; };
const u32 tcFormat[8] =
{
vtxAttr.g0.Tex0CoordFormat, vtxAttr.g1.Tex1CoordFormat, vtxAttr.g1.Tex2CoordFormat,
vtxAttr.g1.Tex3CoordFormat, vtxAttr.g1.Tex4CoordFormat, vtxAttr.g2.Tex5CoordFormat,
vtxAttr.g2.Tex6CoordFormat, vtxAttr.g2.Tex7CoordFormat
};
// Add position and texture matrix indices // Add position and texture matrix indices
u64 vtxDescHex = cpMem.vtxDesc.Hex; u64 vtxDescHex = cpMem.vtxDesc.Hex;
@ -178,14 +178,14 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
vtxDescHex >>= 1; vtxDescHex >>= 1;
} }
// Position // Position
sizes[9] = VertexLoader_Position::GetSize(vtxDesc.Position, vtxAttr.g0.PosFormat, vtxAttr.g0.PosElements); sizes[9] = VertexLoader_Position::GetSize(vtxDesc.Position, vtxAttr.g0.PosFormat, vtxAttr.g0.PosElements);
// Normals // Normals
if (vtxDesc.Normal != NOT_PRESENT) if (vtxDesc.Normal != NOT_PRESENT)
{ {
sizes[10] = VertexLoader_Normal::GetSize(vtxDesc.Normal, vtxAttr.g0.NormalFormat, vtxAttr.g0.NormalElements, vtxAttr.g0.NormalIndex3); sizes[10] = VertexLoader_Normal::GetSize(vtxDesc.Normal, vtxAttr.g0.NormalFormat, vtxAttr.g0.NormalElements, vtxAttr.g0.NormalIndex3);
} }
else else
{ {
sizes[10] = 0; sizes[10] = 0;
@ -212,11 +212,11 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
default: _assert_(0); break; default: _assert_(0); break;
} }
break; break;
case INDEX8: case INDEX8:
size = 1; size = 1;
break; break;
case INDEX16: case INDEX16:
size = 2; size = 2;
break; break;
} }
@ -229,7 +229,7 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
{ {
sizes[13 + i] = VertexLoader_TextCoord::GetSize(vtxDescHex & 3, tcFormat[i], tcElements[i]); sizes[13 + i] = VertexLoader_TextCoord::GetSize(vtxDescHex & 3, tcFormat[i], tcElements[i]);
vtxDescHex >>= 2; vtxDescHex >>= 2;
} }
} }
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFOANALYZER_H #ifndef _FIFOANALYZER_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FifoDataFile.h" #include "FifoDataFile.h"
@ -38,7 +38,7 @@ FifoDataFile::~FifoDataFile()
delete []frame.memoryUpdates[i].data; delete []frame.memoryUpdates[i].data;
delete []frame.fifoData; delete []frame.fifoData;
} }
} }
void FifoDataFile::SetIsWii(bool isWii) void FifoDataFile::SetIsWii(bool isWii)

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFODATAFILE_H_ #ifndef _FIFODATAFILE_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFOFILESTRUCT_H_ #ifndef _FIFOFILESTRUCT_H_
@ -37,8 +37,8 @@ union FileHeader
struct struct
{ {
u32 fileId; u32 fileId;
u32 file_version; u32 file_version;
u32 min_loader_version; u32 min_loader_version;
u64 bpMemOffset; u64 bpMemOffset;
u32 bpMemSize; u32 bpMemSize;
u64 cpMemOffset; u64 cpMemOffset;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FifoAnalyzer.h" #include "FifoAnalyzer.h"
@ -57,7 +57,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
FifoAnalyzer::LoadCPReg(0x70 + i, cpMem[0x70 + i], m_CpMem); FifoAnalyzer::LoadCPReg(0x70 + i, cpMem[0x70 + i], m_CpMem);
FifoAnalyzer::LoadCPReg(0x80 + i, cpMem[0x80 + i], m_CpMem); FifoAnalyzer::LoadCPReg(0x80 + i, cpMem[0x80 + i], m_CpMem);
FifoAnalyzer::LoadCPReg(0x90 + i, cpMem[0x90 + i], m_CpMem); FifoAnalyzer::LoadCPReg(0x90 + i, cpMem[0x90 + i], m_CpMem);
} }
frameInfo.clear(); frameInfo.clear();
frameInfo.resize(file->GetFrameCount()); frameInfo.resize(file->GetFrameCount());
@ -82,7 +82,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
{ {
AddMemoryUpdate(frame.memoryUpdates[nextMemUpdate], analyzed); AddMemoryUpdate(frame.memoryUpdates[nextMemUpdate], analyzed);
++nextMemUpdate; ++nextMemUpdate;
} }
bool wasDrawing = m_DrawingObject; bool wasDrawing = m_DrawingObject;
@ -112,7 +112,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
analyzed.objectStarts.push_back(cmdStart); analyzed.objectStarts.push_back(cmdStart);
else else
analyzed.objectEnds.push_back(cmdStart); analyzed.objectEnds.push_back(cmdStart);
} }
cmdStart += cmdSize; cmdStart += cmdSize;
} }
@ -149,7 +149,7 @@ void FifoPlaybackAnalyzer::AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrame
u32 bytesToRangeEnd = range.end - memUpdate.address; u32 bytesToRangeEnd = range.end - memUpdate.address;
memUpdate.data += bytesToRangeEnd; memUpdate.data += bytesToRangeEnd;
memUpdate.size = postSize; memUpdate.size = postSize;
memUpdate.address = range.end; memUpdate.address = range.end;
} }
else if (preSize > 0) else if (preSize > 0)
{ {
@ -172,50 +172,50 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
int cmd = ReadFifo8(data); int cmd = ReadFifo8(data);
switch(cmd) switch(cmd)
{ {
case GX_NOP: case GX_NOP:
case 0x44: case 0x44:
case GX_CMD_INVL_VC: case GX_CMD_INVL_VC:
break; break;
case GX_LOAD_CP_REG: case GX_LOAD_CP_REG:
{ {
m_DrawingObject = false; m_DrawingObject = false;
u32 cmd2 = ReadFifo8(data); u32 cmd2 = ReadFifo8(data);
u32 value = ReadFifo32(data); u32 value = ReadFifo32(data);
FifoAnalyzer::LoadCPReg(cmd2, value, m_CpMem); FifoAnalyzer::LoadCPReg(cmd2, value, m_CpMem);
} }
break; break;
case GX_LOAD_XF_REG: case GX_LOAD_XF_REG:
{ {
m_DrawingObject = false; m_DrawingObject = false;
u32 cmd2 = ReadFifo32(data); u32 cmd2 = ReadFifo32(data);
u8 streamSize = ((cmd2 >> 16) & 15) + 1; u8 streamSize = ((cmd2 >> 16) & 15) + 1;
data += streamSize * 4; data += streamSize * 4;
} }
break; break;
case GX_LOAD_INDX_A: case GX_LOAD_INDX_A:
case GX_LOAD_INDX_B: case GX_LOAD_INDX_B:
case GX_LOAD_INDX_C: case GX_LOAD_INDX_C:
case GX_LOAD_INDX_D: case GX_LOAD_INDX_D:
m_DrawingObject = false; m_DrawingObject = false;
data += 4; data += 4;
break; break;
case GX_CMD_CALL_DL: case GX_CMD_CALL_DL:
// The recorder should have expanded display lists into the fifo stream and skipped the call to start them // The recorder should have expanded display lists into the fifo stream and skipped the call to start them
// That is done to make it easier to track where memory is updated // That is done to make it easier to track where memory is updated
_assert_(false); _assert_(false);
data += 8; data += 8;
break; break;
case GX_LOAD_BP_REG: case GX_LOAD_BP_REG:
{ {
m_DrawingObject = false; m_DrawingObject = false;
@ -227,11 +227,11 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
if (bp.address == BPMEM_TRIGGER_EFB_COPY) if (bp.address == BPMEM_TRIGGER_EFB_COPY)
StoreEfbCopyRegion(); StoreEfbCopyRegion();
} }
break; break;
default: default:
if (cmd & 0x80) if (cmd & 0x80)
{ {
m_DrawingObject = true; m_DrawingObject = true;
u32 vtxAttrGroup = cmd & GX_VAT_MASK; u32 vtxAttrGroup = cmd & GX_VAT_MASK;
@ -239,15 +239,15 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
u16 streamSize = ReadFifo16(data); u16 streamSize = ReadFifo16(data);
data += streamSize * vertexSize; data += streamSize * vertexSize;
} }
else else
{ {
PanicAlert("FifoPlayer: Unknown Opcode (0x%x).\nAborting frame analysis.\n", cmd); PanicAlert("FifoPlayer: Unknown Opcode (0x%x).\nAborting frame analysis.\n", cmd);
return 0; return 0;
} }
break; break;
} }
return data - dataStart; return data - dataStart;
} }
@ -326,8 +326,8 @@ void FifoPlaybackAnalyzer::StoreWrittenRegion(u32 address, u32 size)
used.end = std::max(used.end, range.end); used.end = std::max(used.end, range.end);
// Remove this entry // Remove this entry
iter = m_WrittenMemory.erase(iter); iter = m_WrittenMemory.erase(iter);
} }
} }
else else
{ {

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFOPLAYBACKANALYZER_H_ #ifndef _FIFOPLAYBACKANALYZER_H_
@ -43,7 +43,7 @@ private:
{ {
u32 begin; u32 begin;
u32 end; u32 end;
}; };
void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo); void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo);
@ -58,7 +58,7 @@ private:
std::vector<MemoryRange> m_WrittenMemory; std::vector<MemoryRange> m_WrittenMemory;
BPMemory m_BpMem; BPMemory m_BpMem;
FifoAnalyzer::CPMemory m_CpMem; FifoAnalyzer::CPMemory m_CpMem;
}; };
#endif #endif

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FifoDataFile.h" #include "FifoDataFile.h"
@ -194,7 +194,7 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
WriteFramePart(position, info.objectStarts[objectNum], memoryUpdate, frame, info); WriteFramePart(position, info.objectStarts[objectNum], memoryUpdate, frame, info);
position = info.objectEnds[objectNum]; position = info.objectEnds[objectNum];
++objectNum; ++objectNum;
} }
// Write objects in draw range // Write objects in draw range
@ -290,7 +290,7 @@ void FifoPlayer::WriteFifo(u8 *data, u32 start, u32 end)
u32 burstEnd = std::min(written + 255, lastBurstEnd); u32 burstEnd = std::min(written + 255, lastBurstEnd);
while (written < burstEnd) while (written < burstEnd)
GPFifo::FastWrite8(data[written++]); GPFifo::FastWrite8(data[written++]);
GPFifo::Write8(data[written++], 0); GPFifo::Write8(data[written++], 0);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFOPLAYER_H_ #ifndef _FIFOPLAYER_H_

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "FifoAnalyzer.h" #include "FifoAnalyzer.h"
@ -63,7 +63,7 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
case GX_NOP: case GX_NOP:
case 0x44: case 0x44:
case GX_CMD_INVL_VC: case GX_CMD_INVL_VC:
break; break;
case GX_LOAD_CP_REG: case GX_LOAD_CP_REG:
{ {
@ -84,28 +84,28 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
m_DrawingObject = false; m_DrawingObject = false;
ProcessLoadIndexedXf(ReadFifo32(data), 0xc); ProcessLoadIndexedXf(ReadFifo32(data), 0xc);
break; break;
case GX_LOAD_INDX_B: case GX_LOAD_INDX_B:
m_DrawingObject = false; m_DrawingObject = false;
ProcessLoadIndexedXf(ReadFifo32(data), 0xd); ProcessLoadIndexedXf(ReadFifo32(data), 0xd);
break; break;
case GX_LOAD_INDX_C: case GX_LOAD_INDX_C:
m_DrawingObject = false; m_DrawingObject = false;
ProcessLoadIndexedXf(ReadFifo32(data), 0xe); ProcessLoadIndexedXf(ReadFifo32(data), 0xe);
break; break;
case GX_LOAD_INDX_D: case GX_LOAD_INDX_D:
m_DrawingObject = false; m_DrawingObject = false;
ProcessLoadIndexedXf(ReadFifo32(data), 0xf); ProcessLoadIndexedXf(ReadFifo32(data), 0xf);
break; break;
case GX_CMD_CALL_DL: case GX_CMD_CALL_DL:
{ {
// The recorder should have expanded display lists into the fifo stream and skipped the call to start them // The recorder should have expanded display lists into the fifo stream and skipped the call to start them
// That is done to make it easier to track where memory is updated // That is done to make it easier to track where memory is updated
_assert_(false); _assert_(false);
} }
break; break;
case GX_LOAD_BP_REG: case GX_LOAD_BP_REG:
{ {
m_DrawingObject = false; m_DrawingObject = false;
@ -117,10 +117,10 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
if (bp.address == BPMEM_PRELOAD_MODE) if (bp.address == BPMEM_PRELOAD_MODE)
ProcessPreloadTexture(); ProcessPreloadTexture();
} }
break; break;
default: default:
if (cmd & 0x80) if (cmd & 0x80)
{ {
if (!m_DrawingObject) if (!m_DrawingObject)
{ {
@ -131,9 +131,9 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
ProcessVertexArrays(data, cmd & GX_VAT_MASK); ProcessVertexArrays(data, cmd & GX_VAT_MASK);
} }
else else
{ {
PanicAlert("FifoRecordAnalyzer: Unknown Opcode (0x%x).\n", cmd); PanicAlert("FifoRecordAnalyzer: Unknown Opcode (0x%x).\n", cmd);
} }
} }
} }
@ -160,7 +160,7 @@ void FifoRecordAnalyzer::ProcessPreloadTexture()
void FifoRecordAnalyzer::ProcessLoadIndexedXf(u32 val, int array) void FifoRecordAnalyzer::ProcessLoadIndexedXf(u32 val, int array)
{ {
int index = val >> 16; int index = val >> 16;
int size = ((val >> 12) & 0xF) + 1; int size = ((val >> 12) & 0xF) + 1;
u32 address = m_CpMem.arrayBases[array] + m_CpMem.arrayStrides[array] * index; u32 address = m_CpMem.arrayBases[array] + m_CpMem.arrayStrides[array] * index;
@ -216,7 +216,7 @@ void FifoRecordAnalyzer::WriteVertexArray(int arrayIndex, u8 *vertexData, int ve
if (index > maxIndex) if (index > maxIndex)
maxIndex = index; maxIndex = index;
} }
} }
} }
else else
{ {
@ -257,8 +257,8 @@ void FifoRecordAnalyzer::ProcessTexMaps()
{ {
int stageNum2 = i >> 1; int stageNum2 = i >> 1;
int stageOdd = i & 1; int stageOdd = i & 1;
TwoTevStageOrders &order = m_BpMem->tevorders[stageNum2]; TwoTevStageOrders &order = m_BpMem->tevorders[stageNum2];
int texMap = order.getTexMap(stageOdd); int texMap = order.getTexMap(stageOdd);
if (order.getEnable(stageOdd)) if (order.getEnable(stageOdd))
WriteTexMapMemory(texMap, writtenTexMaps); WriteTexMapMemory(texMap, writtenTexMaps);
@ -301,7 +301,7 @@ void FifoRecordAnalyzer::WriteTexMapMemory(int texMap, u32 &writtenTexMaps)
while (mip) while (mip)
{ {
width >>= 1; width >>= 1;
height >>= 1; height >>= 1;
width = max(width, fmtWidth); width = max(width, fmtWidth);
height = max(height, fmtHeight); height = max(height, fmtHeight);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFORECORDANALYZER_H_ #ifndef _FIFORECORDANALYZER_H_

View File

@ -9,7 +9,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "ConfigManager.h" #include "ConfigManager.h"
@ -182,11 +182,11 @@ void FifoRecorder::EndFrame(u32 fifoStart, u32 fifoEnd)
m_FifoData.reserve(1024 * 1024 * 4); m_FifoData.reserve(1024 * 1024 * 4);
m_FifoData.clear(); m_FifoData.clear();
} }
if (m_RequestedRecordingEnd) if (m_RequestedRecordingEnd)
{ {
// Skip data after the next time WriteFifoData is called // Skip data after the next time WriteFifoData is called
m_SkipFutureData = true; m_SkipFutureData = true;
// Signal video backend that it should not call this function when the next frame ends // Signal video backend that it should not call this function when the next frame ends
m_IsRecording = false; m_IsRecording = false;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _FIFORECORDER_H_ #ifndef _FIFORECORDER_H_

View File

@ -28,14 +28,14 @@ namespace Gecko
enum enum
{ {
// Code Types // Code Types
CODETYPE_WRITE_FILL = 0x0, CODETYPE_WRITE_FILL = 0x0,
CODETYPE_IF = 0x1, CODETYPE_IF = 0x1,
CODETYPE_BA_PO_OPS = 0x2, CODETYPE_BA_PO_OPS = 0x2,
CODETYPE_FLOW_CONTROL = 0x3, CODETYPE_FLOW_CONTROL = 0x3,
CODETYPE_REGISTER_OPS = 0x4, CODETYPE_REGISTER_OPS = 0x4,
CODETYPE_SPECIAL_IF = 0x5, CODETYPE_SPECIAL_IF = 0x5,
CODETYPE_ASM_SWITCH_RANGE = 0x6, CODETYPE_ASM_SWITCH_RANGE = 0x6,
CODETYPE_END_CODES = 0x7, CODETYPE_END_CODES = 0x7,
// Data Types // Data Types
DATATYPE_8BIT = 0x0, DATATYPE_8BIT = 0x0,
@ -104,12 +104,14 @@ void SetActiveCodes(const std::vector<GeckoCode>& gcodes)
gcodes_iter = gcodes.begin(), gcodes_iter = gcodes.begin(),
gcodes_end = gcodes.end(); gcodes_end = gcodes.end();
for (; gcodes_iter!=gcodes_end; ++gcodes_iter) for (; gcodes_iter!=gcodes_end; ++gcodes_iter)
{
if (gcodes_iter->enabled) if (gcodes_iter->enabled)
{ {
// TODO: apply modifiers // TODO: apply modifiers
// TODO: don't need description or creator string, just takin up memory // TODO: don't need description or creator string, just takin up memory
active_codes.push_back(*gcodes_iter); active_codes.push_back(*gcodes_iter);
} }
}
inserted_asm_codes.clear(); inserted_asm_codes.clear();
@ -289,7 +291,8 @@ void RunCodeHandler()
} }
} }
const std::map<u32, std::vector<u32> >& GetInsertedAsmCodes() { const std::map<u32, std::vector<u32> >& GetInsertedAsmCodes()
{
return inserted_asm_codes; return inserted_asm_codes;
} }
@ -365,7 +368,7 @@ bool RamWriteAndFill()
const u8 data_type = current_code->address >> 28; const u8 data_type = current_code->address >> 28;
const u32 data_inc = current_code->data; // amount to increment the data const u32 data_inc = current_code->data; // amount to increment the data
const u16 addr_inc = (u16)current_code->address; // amount to increment the address const u16 addr_inc = (u16)current_code->address; // amount to increment the address
count = ((current_code->address >> 16) & 0xFFF) + 1; // count is different from the other subtypes, note: +1 count = ((current_code->address >> 16) & 0xFFF) + 1; // count is different from the other subtypes, note: +1
while (count--) while (count--)
{ {
// switch inside the loop, :/ o well // switch inside the loop, :/ o well
@ -470,7 +473,7 @@ bool RegularIf()
// CST7 : 16bits (endif, then) If lower // CST7 : 16bits (endif, then) If lower
case 0x3 : case 0x3 :
result = (read_value < data_value); result = (read_value < data_value);
break; break;
} }
} }
@ -591,7 +594,9 @@ bool FlowControl()
current_code = target_code - 1; current_code = target_code - 1;
} }
else else
{
return false; // trying to GOTO to bad address return false; // trying to GOTO to bad address
}
} }
break; break;
@ -608,7 +613,9 @@ bool FlowControl()
current_code = target_code - 1; current_code = target_code - 1;
} }
else else
{
return false; // trying to GOSUB to bad address return false; // trying to GOSUB to bad address
}
} }
break; break;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _HLE_H #ifndef _HLE_H
@ -25,18 +25,18 @@ namespace HLE
{ {
enum enum
{ {
HLE_HOOK_START = 0, // Hook the beginning of the function and execute the function afterwards HLE_HOOK_START = 0, // Hook the beginning of the function and execute the function afterwards
HLE_HOOK_END = 1, // Hook the end of the function, executing the function first before the hook HLE_HOOK_END = 1, // Hook the end of the function, executing the function first before the hook
HLE_HOOK_REPLACE = 2, // Replace the function with the HLE version HLE_HOOK_REPLACE = 2, // Replace the function with the HLE version
HLE_HOOK_NONE = 3, // Do not hook the function HLE_HOOK_NONE = 3, // Do not hook the function
}; };
enum enum
{ {
HLE_TYPE_GENERIC = 0, // Miscellaneous function HLE_TYPE_GENERIC = 0, // Miscellaneous function
HLE_TYPE_MEMORY = 1, // Memory operation HLE_TYPE_MEMORY = 1, // Memory operation
HLE_TYPE_FP = 2, // Floating Point operation HLE_TYPE_FP = 2, // Floating Point operation
HLE_TYPE_DEBUG = 3, // Debug output function HLE_TYPE_DEBUG = 3, // Debug output function
}; };
void PatchFunctions(); void PatchFunctions();

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <cmath> #include <cmath>
@ -59,33 +59,33 @@ inline void FW(u32 addr, float x)
// According to the PPC ABI, the return value is always in r3. // According to the PPC ABI, the return value is always in r3.
void UnimplementedFunction() void UnimplementedFunction()
{ {
NPC = LR; NPC = LR;
} }
void UnimplementedFunctionTrue() void UnimplementedFunctionTrue()
{ {
GPR(3) = 1; GPR(3) = 1;
NPC = LR; NPC = LR;
} }
void UnimplementedFunctionFalse() void UnimplementedFunctionFalse()
{ {
GPR(3) = 0; GPR(3) = 0;
NPC = LR; NPC = LR;
} }
void GXPeekZ() void GXPeekZ()
{ {
// Just some fake Z value. // Just some fake Z value.
Memory::Write_U32(0xFFFFFF, GPR(5)); Memory::Write_U32(0xFFFFFF, GPR(5));
NPC = LR; NPC = LR;
} }
void GXPeekARGB() void GXPeekARGB()
{ {
// Just some fake color value. // Just some fake color value.
Memory::Write_U32(0xFFFFFFFF, GPR(5)); Memory::Write_U32(0xFFFFFFFF, GPR(5));
NPC = LR; NPC = LR;
} }
// If you want a function to panic, you can rename it PanicAlert :p // If you want a function to panic, you can rename it PanicAlert :p
@ -116,7 +116,7 @@ void SMB_EvilVecCosine()
float dot = x1*x2 + y1*y2 + z1*z2; float dot = x1*x2 + y1*y2 + z1*z2;
rPS0(1) = dot / sqrtf(s1 * s2); rPS0(1) = dot / sqrtf(s1 * s2);
NPC = LR; NPC = LR;
} }
// Normalizes the vector pointed at by r3. // Normalizes the vector pointed at by r3.
@ -130,7 +130,7 @@ void SMB_EvilNormalize()
float inv_len; float inv_len;
if (len <= 0) if (len <= 0)
inv_len = 0; inv_len = 0;
else else
inv_len = 1.0f / sqrtf(len); inv_len = 1.0f / sqrtf(len);
x *= inv_len; x *= inv_len;
y *= inv_len; y *= inv_len;

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef HLE_MISC_H #ifndef HLE_MISC_H
@ -20,19 +20,19 @@
namespace HLE_Misc namespace HLE_Misc
{ {
void Pass(); void Pass();
void HLEPanicAlert(); void HLEPanicAlert();
void UnimplementedFunction(); void UnimplementedFunction();
void UnimplementedFunctionTrue(); void UnimplementedFunctionTrue();
void UnimplementedFunctionFalse(); void UnimplementedFunctionFalse();
void GXPeekZ(); void GXPeekZ();
void GXPeekARGB(); void GXPeekARGB();
void SMB_EvilVecCosine(); void SMB_EvilVecCosine();
void SMB_EvilNormalize(); void SMB_EvilNormalize();
void SMB_sqrt_internal(); void SMB_sqrt_internal();
void SMB_rsqrt_internal(); void SMB_rsqrt_internal();
void SMB_atan2(); void SMB_atan2();
void SMB_evil_vec_setlength(); void SMB_evil_vec_setlength();
void FZero_kill_infinites(); void FZero_kill_infinites();
void FZero_evil_vec_normalize(); void FZero_evil_vec_normalize();
void FZ_sqrt(); void FZ_sqrt();

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "StringUtil.h" #include "StringUtil.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef HLE_OS_H #ifndef HLE_OS_H
@ -22,9 +22,9 @@
namespace HLE_OS namespace HLE_OS
{ {
void HLE_GeneralDebugPrint(); void HLE_GeneralDebugPrint();
void HLE_write_console(); void HLE_write_console();
void HLE_OSPanic(); void HLE_OSPanic();
} }
#endif #endif

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
/* /*
@ -97,7 +97,7 @@ union AICR
u32 AIINTVLD : 1; // This bit controls whether AIINT is affected by the Interrupt Timing register u32 AIINTVLD : 1; // This bit controls whether AIINT is affected by the Interrupt Timing register
// matching the sample counter. Once set, AIINT will hold its last value // matching the sample counter. Once set, AIINT will hold its last value
u32 SCRESET : 1; // write to reset counter u32 SCRESET : 1; // write to reset counter
u32 AIDFR : 1; // AID Frequency (0=48khz 1=32khz) u32 AIDFR : 1; // AID Frequency (0=48khz 1=32khz)
u32 :25; u32 :25;
}; };
u32 hex; u32 hex;
@ -183,7 +183,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
case AI_SAMPLE_COUNTER: case AI_SAMPLE_COUNTER:
Update(0, 0); Update(0, 0);
_rReturnValue = m_SampleCounter; _rReturnValue = m_SampleCounter;
break; break;
case AI_INTERRUPT_TIMING: case AI_INTERRUPT_TIMING:
@ -191,7 +191,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
break; break;
default: default:
ERROR_LOG(AUDIO_INTERFACE, "Unknown read 0x%08x", _Address); ERROR_LOG(AUDIO_INTERFACE, "Unknown read 0x%08x", _Address);
_dbg_assert_msg_(AUDIO_INTERFACE, 0, "AudioInterface - Read from 0x%08x", _Address); _dbg_assert_msg_(AUDIO_INTERFACE, 0, "AudioInterface - Read from 0x%08x", _Address);
_rReturnValue = 0; _rReturnValue = 0;
return; return;
@ -210,18 +210,18 @@ void Write32(const u32 _Value, const u32 _Address)
m_Control.AIINTMSK = tmpAICtrl.AIINTMSK; m_Control.AIINTMSK = tmpAICtrl.AIINTMSK;
m_Control.AIINTVLD = tmpAICtrl.AIINTVLD; m_Control.AIINTVLD = tmpAICtrl.AIINTVLD;
// Set frequency of streaming audio // Set frequency of streaming audio
if (tmpAICtrl.AISFR != m_Control.AISFR) if (tmpAICtrl.AISFR != m_Control.AISFR)
{ {
DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz":"32khz"); DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz":"32khz");
m_Control.AISFR = tmpAICtrl.AISFR; m_Control.AISFR = tmpAICtrl.AISFR;
} }
// Set frequency of DMA // Set frequency of DMA
if (tmpAICtrl.AIDFR != m_Control.AIDFR) if (tmpAICtrl.AIDFR != m_Control.AIDFR)
{ {
DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz":"48khz"); DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz":"48khz");
m_Control.AIDFR = tmpAICtrl.AIDFR; m_Control.AIDFR = tmpAICtrl.AIDFR;
} }
g_AISSampleRate = tmpAICtrl.AISFR ? 48000 : 32000; g_AISSampleRate = tmpAICtrl.AISFR ? 48000 : 32000;
g_AIDSampleRate = tmpAICtrl.AIDFR ? 32000 : 48000; g_AIDSampleRate = tmpAICtrl.AIDFR ? 32000 : 48000;
@ -229,36 +229,36 @@ void Write32(const u32 _Value, const u32 _Address)
g_CPUCyclesPerSample = SystemTimers::GetTicksPerSecond() / g_AISSampleRate; g_CPUCyclesPerSample = SystemTimers::GetTicksPerSecond() / g_AISSampleRate;
// Streaming counter // Streaming counter
if (tmpAICtrl.PSTAT != m_Control.PSTAT) if (tmpAICtrl.PSTAT != m_Control.PSTAT)
{ {
DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmpAICtrl.PSTAT ? "start":"stop"); DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmpAICtrl.PSTAT ? "start":"stop");
m_Control.PSTAT = tmpAICtrl.PSTAT; m_Control.PSTAT = tmpAICtrl.PSTAT;
g_LastCPUTime = CoreTiming::GetTicks(); g_LastCPUTime = CoreTiming::GetTicks();
// Tell Drive Interface to start/stop streaming // Tell Drive Interface to start/stop streaming
DVDInterface::g_bStream = tmpAICtrl.PSTAT; DVDInterface::g_bStream = tmpAICtrl.PSTAT;
CoreTiming::RemoveEvent(et_AI); CoreTiming::RemoveEvent(et_AI);
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI); CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
} }
// AI Interrupt // AI Interrupt
if (tmpAICtrl.AIINT) if (tmpAICtrl.AIINT)
{ {
DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt"); DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt");
m_Control.AIINT = 0; m_Control.AIINT = 0;
} }
// Sample Count Reset // Sample Count Reset
if (tmpAICtrl.SCRESET) if (tmpAICtrl.SCRESET)
{ {
DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter"); DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter");
m_SampleCounter = 0; m_SampleCounter = 0;
g_LastCPUTime = CoreTiming::GetTicks(); g_LastCPUTime = CoreTiming::GetTicks();
} }
UpdateInterrupts(); UpdateInterrupts();
} }
break; break;
@ -273,7 +273,7 @@ void Write32(const u32 _Value, const u32 _Address)
m_SampleCounter = _Value; m_SampleCounter = _Value;
break; break;
case AI_INTERRUPT_TIMING: case AI_INTERRUPT_TIMING:
m_InterruptTiming = _Value; m_InterruptTiming = _Value;
CoreTiming::RemoveEvent(et_AI); CoreTiming::RemoveEvent(et_AI);
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI); CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
@ -390,12 +390,12 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
else //1:1 no resampling else //1:1 no resampling
{ {
pcm_l = (((int)pcm[pos*2] * lvolume) >> 8) + (int)(*_pDestBuffer); pcm_l = (((int)pcm[pos*2] * lvolume) >> 8) + (int)(*_pDestBuffer);
if (pcm_l > 32767) pcm_l = 32767; if (pcm_l > 32767) pcm_l = 32767;
else if (pcm_l < -32767) pcm_l = -32767; else if (pcm_l < -32767) pcm_l = -32767;
*_pDestBuffer++ = pcm_l; *_pDestBuffer++ = pcm_l;
pcm_r = (((int)pcm[pos*2+1] * rvolume) >> 8) + (int)(*_pDestBuffer); pcm_r = (((int)pcm[pos*2+1] * rvolume) >> 8) + (int)(*_pDestBuffer);
if (pcm_r > 32767) pcm_r = 32767; if (pcm_r > 32767) pcm_r = 32767;
else if (pcm_r < -32767) pcm_r = -32767; else if (pcm_r < -32767) pcm_r = -32767;
*_pDestBuffer++ = pcm_r; *_pDestBuffer++ = pcm_r;
@ -456,17 +456,17 @@ unsigned int GetAIDSampleRate()
void Update(u64 userdata, int cyclesLate) void Update(u64 userdata, int cyclesLate)
{ {
if (m_Control.PSTAT) if (m_Control.PSTAT)
{ {
const u64 Diff = CoreTiming::GetTicks() - g_LastCPUTime; const u64 Diff = CoreTiming::GetTicks() - g_LastCPUTime;
if (Diff > g_CPUCyclesPerSample) if (Diff > g_CPUCyclesPerSample)
{ {
const u32 Samples = static_cast<u32>(Diff / g_CPUCyclesPerSample); const u32 Samples = static_cast<u32>(Diff / g_CPUCyclesPerSample);
g_LastCPUTime += Samples * g_CPUCyclesPerSample; g_LastCPUTime += Samples * g_CPUCyclesPerSample;
IncreaseSampleCount(Samples); IncreaseSampleCount(Samples);
} }
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2) - cyclesLate, et_AI); CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2) - cyclesLate, et_AI);
} }
} }
u64 GetAIPeriod() u64 GetAIPeriod()

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// See CPP file for comments. // See CPP file for comments.
@ -28,7 +28,7 @@ namespace AudioInterface
{ {
void Init(); void Init();
void Shutdown(); void Shutdown();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
void Update(u64 userdata, int cyclesLate); void Update(u64 userdata, int cyclesLate);

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "StringUtil.h" #include "StringUtil.h"

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h" #include "Common.h"
@ -78,7 +78,8 @@ reswitch:
PowerPC::SingleStep(); PowerPC::SingleStep();
//4: update disasm dialog //4: update disasm dialog
if (m_SyncEvent) { if (m_SyncEvent)
{
m_SyncEvent->Set(); m_SyncEvent->Set();
m_SyncEvent = 0; m_SyncEvent = 0;
} }
@ -106,7 +107,7 @@ bool CCPU::IsStepping()
void CCPU::Reset() void CCPU::Reset()
{ {
} }
void CCPU::StepOpcode(Common::Event *event) void CCPU::StepOpcode(Common::Event *event)
{ {
@ -157,6 +158,7 @@ bool CCPU::PauseAndLock(bool doLock, bool unpauseOnUnlock)
PowerPC::Start(); PowerPC::Start();
m_StepEvent.Set(); m_StepEvent.Set();
} }
if (!Core::IsCPUThread()) if (!Core::IsCPUThread())
m_csCpuOccupied.unlock(); m_csCpuOccupied.unlock();
} }

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _CPU_H #ifndef _CPU_H
#define _CPU_H #define _CPU_H

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// AID / AUDIO_DMA controls pushing audio out to the SRC and then the speakers. // AID / AUDIO_DMA controls pushing audio out to the SRC and then the speakers.
@ -59,7 +59,7 @@ enum
DSP_MAIL_FROM_DSP_HI = 0x5004, DSP_MAIL_FROM_DSP_HI = 0x5004,
DSP_MAIL_FROM_DSP_LO = 0x5006, DSP_MAIL_FROM_DSP_LO = 0x5006,
DSP_CONTROL = 0x500A, DSP_CONTROL = 0x500A,
DSP_INTERRUPT_CONTROL = 0x5010, DSP_INTERRUPT_CONTROL = 0x5010,
AR_INFO = 0x5012, // These names are a good guess at best AR_INFO = 0x5012, // These names are a good guess at best
AR_MODE = 0x5016, // AR_MODE = 0x5016, //
AR_REFRESH = 0x501a, AR_REFRESH = 0x501a,
@ -128,15 +128,15 @@ struct DSPState
// Blocks are 32 bytes. // Blocks are 32 bytes.
union UAudioDMAControl union UAudioDMAControl
{ {
u16 Hex; u16 Hex;
struct struct
{ {
u16 NumBlocks : 15; u16 NumBlocks : 15;
u16 Enable : 1; u16 Enable : 1;
}; };
UAudioDMAControl(u16 _Hex = 0) : Hex(_Hex) UAudioDMAControl(u16 _Hex = 0) : Hex(_Hex)
{} {}
}; };
// AudioDMA // AudioDMA
@ -160,7 +160,7 @@ struct AudioDMA
struct ARAM_DMA struct ARAM_DMA
{ {
u32 MMAddr; u32 MMAddr;
u32 ARAddr; u32 ARAddr;
UARAMCount Cnt; UARAMCount Cnt;
ARAM_DMA() ARAM_DMA()
@ -180,7 +180,8 @@ struct ARAMInfo
u8* ptr; // aka audio ram, auxiliary ram, MEM2, EXRAM, etc... u8* ptr; // aka audio ram, auxiliary ram, MEM2, EXRAM, etc...
// Default to GC mode // Default to GC mode
ARAMInfo() { ARAMInfo()
{
wii_mode = false; wii_mode = false;
size = ARAM_SIZE; size = ARAM_SIZE;
mask = ARAM_MASK; mask = ARAM_MASK;
@ -278,8 +279,8 @@ void Init(bool hle)
memset(&g_arDMA, 0, sizeof(g_arDMA)); memset(&g_arDMA, 0, sizeof(g_arDMA));
g_dspState.DSPControl.Hex = 0; g_dspState.DSPControl.Hex = 0;
g_dspState.DSPControl.DSPHalt = 1; g_dspState.DSPControl.DSPHalt = 1;
g_ARAM_Info.Hex = 0; g_ARAM_Info.Hex = 0;
g_AR_MODE = 1; // ARAM Controller has init'd g_AR_MODE = 1; // ARAM Controller has init'd
g_AR_REFRESH = 156; // 156MHz g_AR_REFRESH = 156; // 156MHz
@ -424,7 +425,7 @@ void Write16(const u16 _Value, const u32 _Address)
g_dspState.DSPControl.DSPReset = tmpControl.DSPReset; g_dspState.DSPControl.DSPReset = tmpControl.DSPReset;
g_dspState.DSPControl.DSPAssertInt = tmpControl.DSPAssertInt; g_dspState.DSPControl.DSPAssertInt = tmpControl.DSPAssertInt;
g_dspState.DSPControl.DSPHalt = tmpControl.DSPHalt; g_dspState.DSPControl.DSPHalt = tmpControl.DSPHalt;
g_dspState.DSPControl.DSPInit = tmpControl.DSPInit; g_dspState.DSPControl.DSPInit = tmpControl.DSPInit;
// Interrupt (mask) // Interrupt (mask)
g_dspState.DSPControl.AID_mask = tmpControl.AID_mask; g_dspState.DSPControl.AID_mask = tmpControl.AID_mask;
@ -438,14 +439,14 @@ void Write16(const u16 _Value, const u32 _Address)
// unknown // unknown
g_dspState.DSPControl.unk3 = tmpControl.unk3; g_dspState.DSPControl.unk3 = tmpControl.unk3;
g_dspState.DSPControl.pad = tmpControl.pad; g_dspState.DSPControl.pad = tmpControl.pad;
if (g_dspState.DSPControl.pad != 0) if (g_dspState.DSPControl.pad != 0)
{ {
PanicAlert("DSPInterface (w) g_dspState.DSPControl (CC00500A) gets a value with junk in the padding %08x", _Value); PanicAlert("DSPInterface (w) g_dspState.DSPControl (CC00500A) gets a value with junk in the padding %08x", _Value);
} }
UpdateInterrupts(); UpdateInterrupts();
} }
break; break;
// ARAM // ARAM
@ -635,7 +636,7 @@ void GenerateDSPInterrupt(DSPInterruptType type, bool _bSet)
switch (type) switch (type)
{ {
case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break; case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break;
case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break; case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break;
case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break; case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break;
} }
@ -651,14 +652,18 @@ void GenerateDSPInterruptFromDSPEmu(DSPInterruptType type, bool _bSet)
} }
// called whenever SystemTimers thinks the dsp deserves a few more cycles // called whenever SystemTimers thinks the dsp deserves a few more cycles
void UpdateDSPSlice(int cycles) { void UpdateDSPSlice(int cycles)
if (dsp_is_lle) { {
if (dsp_is_lle)
{
//use up the rest of the slice(if any) //use up the rest of the slice(if any)
dsp_emulator->DSP_Update(dsp_slice); dsp_emulator->DSP_Update(dsp_slice);
dsp_slice %= 6; dsp_slice %= 6;
//note the new budget //note the new budget
dsp_slice += cycles; dsp_slice += cycles;
} else { }
else
{
dsp_emulator->DSP_Update(cycles); dsp_emulator->DSP_Update(cycles);
} }
} }
@ -727,7 +732,10 @@ void Do_ARAM_DMA()
Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr); Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr);
} }
else else
{
Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr); Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr);
}
g_arDMA.MMAddr += 8; g_arDMA.MMAddr += 8;
g_arDMA.ARAddr += 8; g_arDMA.ARAddr += 8;
g_arDMA.Cnt.count -= 8; g_arDMA.Cnt.count -= 8;
@ -772,7 +780,9 @@ void Do_ARAM_DMA()
*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask] = Common::swap64(Memory::Read_U64(g_arDMA.MMAddr)); *(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask] = Common::swap64(Memory::Read_U64(g_arDMA.MMAddr));
} }
else else
{
*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask] = Common::swap64(Memory::Read_U64(g_arDMA.MMAddr)); *(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask] = Common::swap64(Memory::Read_U64(g_arDMA.MMAddr));
}
g_arDMA.MMAddr += 8; g_arDMA.MMAddr += 8;
g_arDMA.ARAddr += 8; g_arDMA.ARAddr += 8;
@ -803,7 +813,9 @@ u8 ReadARAM(u32 _iAddress)
return Memory::Read_U8(_iAddress & Memory::RAM_MASK); return Memory::Read_U8(_iAddress & Memory::RAM_MASK);
} }
else else
{
return g_ARAM.ptr[_iAddress & g_ARAM.mask]; return g_ARAM.ptr[_iAddress & g_ARAM.mask];
}
} }
void WriteARAM(u8 value, u32 _uAddress) void WriteARAM(u8 value, u32 _uAddress)

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _DSPINTERFACE_H #ifndef _DSPINTERFACE_H

Some files were not shown because too many files have changed in this diff Show More