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.
// 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/
#include "ARDecrypt.h"

View File

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

View File

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

View File

@ -53,7 +53,8 @@
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
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 std::string("unknown map");
return std::string("unknown map");
}
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();
bool success = false;
if (!g_symbolDB.LoadMap(strMapFilename.c_str()))
if (!g_symbolDB.LoadMap(strMapFilename.c_str()))
{
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() + 0x820, 0x81300000, 0x1AFE00);
PC = 0x81200000;
return true;
return true;
}
@ -321,7 +322,7 @@ bool CBoot::BootUp()
if (LoadMapFromFilename(_StartupPara.m_strFilename))
HLE::PatchFunctions();
break;
break;
}
// ELF

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// File description
@ -78,7 +78,8 @@ bool BootCore(const std::string& _rFilename)
StartUp.hInstance = Host_GetInstance();
// 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
IniFile game_ini;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
@ -60,7 +60,7 @@ static s16 ADPCM_Step(u32& _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.
return val;
}
@ -78,7 +78,7 @@ u16 dsp_read_aram_d3()
Address++;
break;
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++;
break;
default:
@ -134,25 +134,25 @@ u16 dsp_read_accelerator()
// address" and 0xd3.
switch (g_dsp.ifx_regs[DSP_FORMAT])
{
case 0x00: // ADPCM audio
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++;
case 0x00: // ADPCM audio
val = ADPCM_Step(Address);
break;
default:
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
Address++;
val = 0;
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;
default:
ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
Address++;
val = 0;
break;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#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.
DSPAssembler assembler(settings);
if (!assembler.Assemble(text, code)) {
if (!assembler.Assemble(text, code))
{
std::cerr << assembler.GetErrorString() << std::endl;
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++)
{
if (code1[i] == code2[i])
{
count_equal++;
}
else
{
std::string line1, line2;

View File

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

View File

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

View File

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

View File

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

View File

@ -117,71 +117,76 @@ void gdsp_ifx_write(u32 addr, u32 val)
{
switch (addr & 0xff)
{
case DSP_DIRQ:
if (val & 0x1)
DSPHost_InterruptRequest();
case DSP_DIRQ:
if (val & 0x1)
DSPHost_InterruptRequest();
else
INFO_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val);
break;
break;
case DSP_DMBH:
gdsp_mbox_write_h(GDSP_MBOX_DSP, val);
break;
case DSP_DMBH:
gdsp_mbox_write_h(GDSP_MBOX_DSP, val);
break;
case DSP_DMBL:
gdsp_mbox_write_l(GDSP_MBOX_DSP, val);
break;
case DSP_DMBL:
gdsp_mbox_write_l(GDSP_MBOX_DSP, val);
break;
case DSP_CMBH:
return gdsp_mbox_write_h(GDSP_MBOX_CPU, val);
case DSP_CMBH:
return gdsp_mbox_write_h(GDSP_MBOX_CPU, val);
case DSP_CMBL:
return gdsp_mbox_write_l(GDSP_MBOX_CPU, val);
case DSP_CMBL:
return gdsp_mbox_write_l(GDSP_MBOX_CPU, val);
case DSP_DSBL:
g_dsp.ifx_regs[DSP_DSBL] = val;
case DSP_DSBL:
g_dsp.ifx_regs[DSP_DSBL] = val;
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();
else
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;
break;
break;
case DSP_ACDATA1: // Accelerator write (Zelda type) - "UnkZelda"
dsp_write_aram_d3(val);
break;
case DSP_GAIN:
if (val) {
if (val)
{
INFO_LOG(DSPLLE,"Gain Written: 0x%04x", val);
}
case DSP_DSPA:
case DSP_DSMAH:
case DSP_DSMAL:
case DSP_DSCR:
g_dsp.ifx_regs[addr & 0xFF] = val;
break;
case DSP_DSPA:
case DSP_DSMAH:
case DSP_DSMAL:
case DSP_DSCR:
g_dsp.ifx_regs[addr & 0xFF] = val;
break;
/*
case DSP_ACCAL:
dsp_step_accelerator();
break;
*/
default:
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);
default:
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);
}
else {
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
else
{
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
}
}
else {
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
else
{
ERROR_LOG(DSPLLE, "%04x MW %04x (%04x)", g_dsp.pc, addr, val);
}
g_dsp.ifx_regs[addr & 0xFF] = val;
break;
g_dsp.ifx_regs[addr & 0xFF] = val;
break;
}
}
@ -189,40 +194,44 @@ u16 gdsp_ifx_read(u16 addr)
{
switch (addr & 0xff)
{
case DSP_DMBH:
return gdsp_mbox_read_h(GDSP_MBOX_DSP);
case DSP_DMBH:
return gdsp_mbox_read_h(GDSP_MBOX_DSP);
case DSP_DMBL:
return gdsp_mbox_read_l(GDSP_MBOX_DSP);
case DSP_DMBL:
return gdsp_mbox_read_l(GDSP_MBOX_DSP);
case DSP_CMBH:
return gdsp_mbox_read_h(GDSP_MBOX_CPU);
case DSP_CMBH:
return gdsp_mbox_read_h(GDSP_MBOX_CPU);
case DSP_CMBL:
return gdsp_mbox_read_l(GDSP_MBOX_CPU);
case DSP_CMBL:
return gdsp_mbox_read_l(GDSP_MBOX_CPU);
case DSP_DSCR:
return g_dsp.ifx_regs[addr & 0xFF];
case DSP_DSCR:
return g_dsp.ifx_regs[addr & 0xFF];
case DSP_ACCELERATOR: // ADPCM Accelerator reads
return dsp_read_accelerator();
case DSP_ACCELERATOR: // ADPCM Accelerator reads
return dsp_read_accelerator();
case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda"
return dsp_read_aram_d3();
case DSP_ACDATA1: // Accelerator reads (Zelda type) - "UnkZelda"
return dsp_read_aram_d3();
default:
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]);
default:
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]);
}
else {
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
else
{
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
}
}
else {
ERROR_LOG(DSPLLE, "%04x MR %04x (%04x)", g_dsp.pc, addr, g_dsp.ifx_regs[addr & 0xFF]);
else
{
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
switch (ctl & 0x3)
{
case (DSP_CR_DMEM | DSP_CR_TO_CPU):
gdsp_ddma_out(dsp_addr, addr, len);
break;
case (DSP_CR_DMEM | DSP_CR_TO_CPU):
gdsp_ddma_out(dsp_addr, addr, len);
break;
case (DSP_CR_DMEM | DSP_CR_FROM_CPU):
gdsp_ddma_in(dsp_addr, addr, len);
break;
case (DSP_CR_DMEM | DSP_CR_FROM_CPU):
gdsp_ddma_in(dsp_addr, addr, len);
break;
case (DSP_CR_IMEM | DSP_CR_TO_CPU):
gdsp_idma_out(dsp_addr, addr, len);
break;
case (DSP_CR_IMEM | DSP_CR_TO_CPU):
gdsp_idma_out(dsp_addr, addr, len);
break;
case (DSP_CR_IMEM | DSP_CR_FROM_CPU):
gdsp_idma_in(dsp_addr, addr, len);
break;
case (DSP_CR_IMEM | DSP_CR_FROM_CPU):
gdsp_idma_in(dsp_addr, addr, len);
break;
}
}

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// 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.
// 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/
// 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.
// 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/
#include "DSPIntUtil.h"
#include "DSPMemoryMap.h"
@ -56,22 +56,25 @@ inline bool IsSameMemArea(u16 a, u16 b)
// DR $arR
// xxxx xxxx 0000 01rr
// Decrement addressing register $arR.
void dr(const UDSPInstruction opc) {
void dr(const UDSPInstruction opc)
{
writeToBackLog(0, opc & 0x3, dsp_decrement_addr_reg(opc & 0x3));
}
// IR $arR
// xxxx xxxx 0000 10rr
// Increment addressing register $arR.
void ir(const UDSPInstruction opc) {
void ir(const UDSPInstruction opc)
{
writeToBackLog(0, opc & 0x3, dsp_increment_addr_reg(opc & 0x3));
}
// NR $arR
// xxxx xxxx 0000 11rr
// Add corresponding indexing register $ixR to addressing register $arR.
void nr(const UDSPInstruction opc) {
u8 reg = opc & 0x3;
void nr(const UDSPInstruction opc)
{
u8 reg = opc & 0x3;
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.
void mv(const UDSPInstruction opc)
{
u8 sreg = (opc & 0x3) + DSP_REG_ACL0;
u8 sreg = (opc & 0x3) + DSP_REG_ACL0;
u8 dreg = ((opc >> 2) & 0x3);
switch(sreg) {
switch(sreg)
{
case DSP_REG_ACL0:
case DSP_REG_ACL1:
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 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
switch(sreg) {
switch(sreg)
{
case DSP_REG_ACL0:
case DSP_REG_ACL1:
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));
break;
}
writeToBackLog(0, dreg, dsp_increment_addr_reg(dreg));
writeToBackLog(0, dreg, dsp_increment_addr_reg(dreg));
}
// SN @$arD, $acS.S
@ -127,7 +132,8 @@ void sn(const UDSPInstruction opc)
u8 dreg = opc & 0x3;
u8 sreg = ((opc >> 3) & 0x3) + DSP_REG_ACL0;
switch(sreg) {
switch(sreg)
{
case DSP_REG_ACL0:
case DSP_REG_ACL1:
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));
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
@ -153,13 +159,13 @@ void l(const UDSPInstruction opc)
{
u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]);
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(3, sreg, dsp_increment_addr_reg(sreg));
}
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));
}
}
@ -177,13 +183,13 @@ void ln(const UDSPInstruction opc)
{
u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]);
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(3, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r.ix[sreg]));
}
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]));
}
}
@ -200,7 +206,7 @@ void ls(const UDSPInstruction opc)
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(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));
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(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));
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(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));
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(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));
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(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));
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(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));
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(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));
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(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
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));
}
@ -373,7 +379,7 @@ void ldax(const UDSPInstruction opc)
else
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));
}
@ -393,7 +399,7 @@ void ldn(const UDSPInstruction opc)
else
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));
}
@ -412,7 +418,7 @@ void ldaxn(const UDSPInstruction opc)
else
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));
}
@ -432,7 +438,7 @@ void ldm(const UDSPInstruction opc)
else
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_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -452,7 +458,7 @@ void ldaxm(const UDSPInstruction opc)
else
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_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -473,7 +479,7 @@ void ldnm(const UDSPInstruction opc)
else
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_increase_addr_reg(DSP_REG_AR3, (s16)g_dsp.r.ix[3]));
@ -493,7 +499,7 @@ void ldaxnm(const UDSPInstruction opc)
else
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_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
// infinitive loops
for (int i = 0; writeBackLogIdx[i] != -1; i++) {
for (int i = 0; writeBackLogIdx[i] != -1; i++)
{
#ifdef PRECISE_BACKLOG
dsp_op_write_reg(writeBackLogIdx[i], dsp_op_read_reg(writeBackLogIdx[i]) | writeBackLog[i]);
#else
@ -543,7 +550,8 @@ void zeroWriteBackLog()
#ifdef PRECISE_BACKLOG
// always make sure to have an extra entry at the end w/ -1 to avoid
// 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);
}
#endif
@ -552,8 +560,8 @@ void zeroWriteBackLog()
void zeroWriteBackLogPreserveAcc(u8 acc)
{
#ifdef PRECISE_BACKLOG
for (int i = 0; writeBackLogIdx[i] != -1; i++) {
for (int i = 0; writeBackLogIdx[i] != -1; i++)
{
// acc0
if ((acc == 0) &&
((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)
{
int reg = _reg & 0x1f;
switch (reg) {
switch (reg)
{
case DSP_REG_ST0:
case DSP_REG_ST1:
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)
{
int reg = _reg & 0x1f;
switch (reg) {
switch (reg)
{
// 8-bit sign extended registers. Should look at prod.h too...
case DSP_REG_ACH0:
case DSP_REG_ACH1:
@ -349,10 +353,14 @@ inline u16 dsp_op_read_reg_and_saturate(u8 _reg)
return 0x8000;
}
else
{
return g_dsp.r.ac[_reg].m;
}
}
else
{
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.
// 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/
#ifndef _DSPINTERPRETER_H
@ -48,9 +48,9 @@ typedef void (*DSPInterpreterFunc)(const UDSPInstruction opc);
void call(const UDSPInstruction opc);
void callr(const UDSPInstruction opc);
void ifcc(const UDSPInstruction opc);
void jcc(const UDSPInstruction opc);
void jcc(const UDSPInstruction opc);
void jmprcc(const UDSPInstruction opc);
void ret(const UDSPInstruction opc);
void ret(const UDSPInstruction opc);
void halt(const UDSPInstruction opc);
void loop(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.
// 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/
// Additional copyrights go to Duddie (c) 2005 (duddie@walla.com)
@ -27,7 +27,8 @@
void nop(const UDSPInstruction opc)
{
// The real nop is 0. Anything else is bad.
if (opc) {
if (opc)
{
ERROR_LOG(DSPLLE, "LLE: Unrecognized opcode 0x%04x", opc);
}
}
@ -536,7 +537,7 @@ void InitInstructionTable()
extOpTable[i] = &cw;
for (int i = 0; i < EXT_OPTABLE_SIZE; i++)
{
{
for (int j = 0; j < opcodes_ext_size; j++)
{
u16 mask = opcodes_ext[j].opcode_mask;
@ -576,4 +577,4 @@ void InitInstructionTable()
for (int i=0; i < WRITEBACKLOGSIZE; i++)
writeBackLogIdx[i] = -1;
}
}

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// 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.
// 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/
// 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.
// 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/
// Additional copyrights go to Duddie and Tratax (c) 2004
@ -203,7 +203,7 @@ void mulaxh(const UDSPInstruction opc)
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 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply(axl, axh);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@ -265,7 +265,7 @@ void mulmv(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply(axl, axh);
zeroWriteBackLog();
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 val2 = (treg == 0) ? dsp_get_ax_l(1) : dsp_get_ax_h(1);
s64 prod = dsp_multiply_mulx(sreg, treg, val1, val2);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@ -408,7 +408,7 @@ void mulc(const UDSPInstruction opc)
u16 accm = dsp_get_acc_m(sreg);
u16 axh = dsp_get_ax_h(treg);
s64 prod = dsp_multiply(accm, axh);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@ -484,7 +484,7 @@ void mulcmvz(const UDSPInstruction opc)
u16 accm = dsp_get_acc_m(sreg);
u16 axh = dsp_get_ax_h(treg);
s64 prod = dsp_multiply(accm, axh);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@ -582,7 +582,7 @@ void madd(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply_add(axl, axh);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@ -600,7 +600,7 @@ void msub(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply_sub(axl, axh);
zeroWriteBackLog();
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.
// 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/
// 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.
// 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/
#include "../DSPMemoryMap.h"
@ -29,7 +29,8 @@ template <void(*jitCode)(const UDSPInstruction, DSPEmitter&)>
static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter)
{
u8 cond = opc & 0xf;
if (cond == 0xf) {// Always true.
if (cond == 0xf) // Always true.
{
jitCode(opc,emitter);
return;
}

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// 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)
{
switch (reg & 0x1f) {
switch (reg & 0x1f)
{
case DSP_REG_ST0:
case DSP_REG_ST1:
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]);
// 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
OpArg sr_reg;
@ -441,7 +443,8 @@ void DSPEmitter::setCompileSR(u16 bit) {
compileSR |= bit;
}
void DSPEmitter::clrCompileSR(u16 bit) {
void DSPEmitter::clrCompileSR(u16 bit)
{
// g_dsp.r[DSP_REG_SR] &= bit
OpArg sr_reg;
@ -498,7 +501,7 @@ void DSPEmitter::srbith(const UDSPInstruction opc)
break;
// 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)
clrCompileSR(SR_40_MODE_BIT);
break;

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#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 (type & labels[i].type) {
if (type & labels[i].type)
{
*value = labels[i].addr;
return true;
} else {
}
else
{
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.
// 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/
#ifndef _LABELMAP_H

View File

@ -752,7 +752,7 @@ void DSPAssembler::InitPass(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;
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.
// 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/
#include "DSPEmulator.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "FifoDataFile.h"
@ -194,7 +194,7 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
WriteFramePart(position, info.objectStarts[objectNum], memoryUpdate, frame, info);
position = info.objectEnds[objectNum];
++objectNum;
++objectNum;
}
// 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);
while (written < burstEnd)
GPFifo::FastWrite8(data[written++]);
GPFifo::FastWrite8(data[written++]);
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.
// 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/
#ifndef _FIFOPLAYER_H_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#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.
void UnimplementedFunction()
{
NPC = LR;
NPC = LR;
}
void UnimplementedFunctionTrue()
{
GPR(3) = 1;
NPC = LR;
GPR(3) = 1;
NPC = LR;
}
void UnimplementedFunctionFalse()
{
GPR(3) = 0;
NPC = LR;
GPR(3) = 0;
NPC = LR;
}
void GXPeekZ()
{
// Just some fake Z value.
Memory::Write_U32(0xFFFFFF, GPR(5));
NPC = LR;
Memory::Write_U32(0xFFFFFF, GPR(5));
NPC = LR;
}
void GXPeekARGB()
{
// Just some fake color value.
Memory::Write_U32(0xFFFFFFFF, GPR(5));
NPC = LR;
Memory::Write_U32(0xFFFFFFFF, GPR(5));
NPC = LR;
}
// 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;
rPS0(1) = dot / sqrtf(s1 * s2);
NPC = LR;
NPC = LR;
}
// Normalizes the vector pointed at by r3.
@ -130,7 +130,7 @@ void SMB_EvilNormalize()
float inv_len;
if (len <= 0)
inv_len = 0;
else
else
inv_len = 1.0f / sqrtf(len);
x *= 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.
// 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/
#ifndef HLE_MISC_H
@ -20,19 +20,19 @@
namespace HLE_Misc
{
void Pass();
void HLEPanicAlert();
void UnimplementedFunction();
void UnimplementedFunctionTrue();
void UnimplementedFunctionFalse();
void GXPeekZ();
void GXPeekARGB();
void SMB_EvilVecCosine();
void SMB_EvilNormalize();
void SMB_sqrt_internal();
void SMB_rsqrt_internal();
void SMB_atan2();
void SMB_evil_vec_setlength();
void Pass();
void HLEPanicAlert();
void UnimplementedFunction();
void UnimplementedFunctionTrue();
void UnimplementedFunctionFalse();
void GXPeekZ();
void GXPeekARGB();
void SMB_EvilVecCosine();
void SMB_EvilNormalize();
void SMB_sqrt_internal();
void SMB_rsqrt_internal();
void SMB_atan2();
void SMB_evil_vec_setlength();
void FZero_kill_infinites();
void FZero_evil_vec_normalize();
void FZ_sqrt();

View File

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

View File

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

View File

@ -12,7 +12,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// Official Git repository and contact information can be found at
// 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
// matching the sample counter. Once set, AIINT will hold its last value
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 hex;
@ -183,7 +183,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
case AI_SAMPLE_COUNTER:
Update(0, 0);
_rReturnValue = m_SampleCounter;
_rReturnValue = m_SampleCounter;
break;
case AI_INTERRUPT_TIMING:
@ -191,7 +191,7 @@ void Read32(u32& _rReturnValue, const u32 _Address)
break;
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);
_rReturnValue = 0;
return;
@ -210,18 +210,18 @@ void Write32(const u32 _Value, const u32 _Address)
m_Control.AIINTMSK = tmpAICtrl.AIINTMSK;
m_Control.AIINTVLD = tmpAICtrl.AIINTVLD;
// Set frequency of streaming audio
if (tmpAICtrl.AISFR != m_Control.AISFR)
{
DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz":"32khz");
m_Control.AISFR = tmpAICtrl.AISFR;
}
// Set frequency of streaming audio
if (tmpAICtrl.AISFR != m_Control.AISFR)
{
DEBUG_LOG(AUDIO_INTERFACE, "Change AISFR to %s", tmpAICtrl.AISFR ? "48khz":"32khz");
m_Control.AISFR = tmpAICtrl.AISFR;
}
// Set frequency of DMA
if (tmpAICtrl.AIDFR != m_Control.AIDFR)
{
DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz":"48khz");
m_Control.AIDFR = tmpAICtrl.AIDFR;
}
if (tmpAICtrl.AIDFR != m_Control.AIDFR)
{
DEBUG_LOG(AUDIO_INTERFACE, "Change AIDFR to %s", tmpAICtrl.AIDFR ? "32khz":"48khz");
m_Control.AIDFR = tmpAICtrl.AIDFR;
}
g_AISSampleRate = tmpAICtrl.AISFR ? 48000 : 32000;
g_AIDSampleRate = tmpAICtrl.AIDFR ? 32000 : 48000;
@ -229,36 +229,36 @@ void Write32(const u32 _Value, const u32 _Address)
g_CPUCyclesPerSample = SystemTimers::GetTicksPerSecond() / g_AISSampleRate;
// Streaming counter
if (tmpAICtrl.PSTAT != m_Control.PSTAT)
{
DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmpAICtrl.PSTAT ? "start":"stop");
m_Control.PSTAT = tmpAICtrl.PSTAT;
g_LastCPUTime = CoreTiming::GetTicks();
if (tmpAICtrl.PSTAT != m_Control.PSTAT)
{
DEBUG_LOG(AUDIO_INTERFACE, "%s streaming audio", tmpAICtrl.PSTAT ? "start":"stop");
m_Control.PSTAT = tmpAICtrl.PSTAT;
g_LastCPUTime = CoreTiming::GetTicks();
// Tell Drive Interface to start/stop streaming
DVDInterface::g_bStream = tmpAICtrl.PSTAT;
CoreTiming::RemoveEvent(et_AI);
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2), et_AI);
}
}
// AI Interrupt
// AI Interrupt
if (tmpAICtrl.AIINT)
{
DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt");
m_Control.AIINT = 0;
}
{
DEBUG_LOG(AUDIO_INTERFACE, "Clear AIS Interrupt");
m_Control.AIINT = 0;
}
// Sample Count Reset
if (tmpAICtrl.SCRESET)
{
DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter");
m_SampleCounter = 0;
// Sample Count Reset
if (tmpAICtrl.SCRESET)
{
DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter");
m_SampleCounter = 0;
g_LastCPUTime = CoreTiming::GetTicks();
}
g_LastCPUTime = CoreTiming::GetTicks();
}
UpdateInterrupts();
UpdateInterrupts();
}
break;
@ -273,7 +273,7 @@ void Write32(const u32 _Value, const u32 _Address)
m_SampleCounter = _Value;
break;
case AI_INTERRUPT_TIMING:
case AI_INTERRUPT_TIMING:
m_InterruptTiming = _Value;
CoreTiming::RemoveEvent(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
{
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;
*_pDestBuffer++ = pcm_l;
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;
*_pDestBuffer++ = pcm_r;
@ -456,17 +456,17 @@ unsigned int GetAIDSampleRate()
void Update(u64 userdata, int cyclesLate)
{
if (m_Control.PSTAT)
{
const u64 Diff = CoreTiming::GetTicks() - g_LastCPUTime;
if (Diff > g_CPUCyclesPerSample)
{
const u32 Samples = static_cast<u32>(Diff / g_CPUCyclesPerSample);
g_LastCPUTime += Samples * g_CPUCyclesPerSample;
if (m_Control.PSTAT)
{
const u64 Diff = CoreTiming::GetTicks() - g_LastCPUTime;
if (Diff > g_CPUCyclesPerSample)
{
const u32 Samples = static_cast<u32>(Diff / g_CPUCyclesPerSample);
g_LastCPUTime += Samples * g_CPUCyclesPerSample;
IncreaseSampleCount(Samples);
}
}
CoreTiming::ScheduleEvent(((int)GetAIPeriod() / 2) - cyclesLate, et_AI);
}
}
}
u64 GetAIPeriod()

View File

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

View File

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

View File

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

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