16 changes: 8 additions & 8 deletions Source/Core/Core/Src/ConfigManager.cpp
Expand Up @@ -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>
Expand All @@ -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 */ },
Expand All @@ -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 */ },
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/ConfigManager.h
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/Core/Src/Console.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -150,5 +150,7 @@ void Console_Submit(const char *cmd)
g_symbolDB.List();
}
else
{
ERROR_LOG(CONSOLE, "Invalid command");
}
}
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/Console.h
Expand Up @@ -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/


Expand Down
19 changes: 13 additions & 6 deletions Source/Core/Core/Src/Core.cpp
Expand Up @@ -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/


Expand Down Expand Up @@ -143,7 +143,9 @@ void DisplayMessage(const char *message, int time_in_ms)
Host_UpdateStatusBar(message);
}
else
{
Host_UpdateTitle(message);
}
}

void Callback_DebuggerBreak()
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 "";
}

Expand Down Expand Up @@ -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());
}

Expand Down
12 changes: 6 additions & 6 deletions Source/Core/Core/Src/Core.h
Expand Up @@ -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/


Expand Down Expand Up @@ -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
};

Expand All @@ -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.
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/CoreParameter.cpp
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/CoreParameter.h
Expand Up @@ -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
Expand All @@ -21,7 +21,8 @@
#include "IniFile.h"
#include <string>

enum Hotkey {
enum Hotkey
{
HK_OPEN,
HK_CHANGE_DISC,
HK_REFRESH_LIST,
Expand Down
98 changes: 55 additions & 43 deletions Source/Core/Core/Src/CoreTiming.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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--;
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -227,7 +227,7 @@ void DoState(PointerWrap &p)

u64 GetTicks()
{
return (u64)globalTimer;
return (u64)globalTimer;
}

u64 GetIdleTicks()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -327,6 +329,7 @@ void RemoveEvent(int event_type)
{
if (!first)
return;

while(first)
{
if (first->type == event_type)
Expand All @@ -340,8 +343,10 @@ void RemoveEvent(int event_type)
break;
}
}

if (!first)
return;

Event *prev = first;
Event *ptr = prev->next;
while (ptr)
Expand All @@ -367,6 +372,7 @@ void RemoveThreadsafeEvent(int event_type)
{
return;
}

while(tsFirst)
{
if (tsFirst->type == event_type)
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -499,6 +507,7 @@ void Advance()
break;
}
}

if (!first)
{
WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
Expand All @@ -511,6 +520,7 @@ void Advance()
slicelength = maxSliceLength;
downcount = slicelength;
}

if (advanceCallback)
advanceCallback(cyclesExecuted);
}
Expand All @@ -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();
}

Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/CoreTiming.h
Expand Up @@ -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
Expand Down
42 changes: 21 additions & 21 deletions Source/Core/Core/Src/DSP/DSPAccelerator.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand All @@ -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:
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPAccelerator.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPAnalyzer.cpp
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPAnalyzer.h
Expand Up @@ -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.
Expand Down
35 changes: 25 additions & 10 deletions Source/Core/Core/Src/DSP/DSPBreakpoints.h
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
7 changes: 5 additions & 2 deletions Source/Core/Core/Src/DSP/DSPCodeUtil.cpp
Expand Up @@ -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>
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPCodeUtil.h
Expand Up @@ -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
Expand Down
30 changes: 19 additions & 11 deletions Source/Core/Core/Src/DSP/DSPCore.cpp
Expand Up @@ -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 }
};

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
42 changes: 29 additions & 13 deletions Source/Core/Core/Src/DSP/DSPEmitter.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -147,36 +147,47 @@ 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;
}
}
}

// Main instruction
if (!opTable[inst]->jitFunc) {
if (!opTable[inst]->jitFunc)
{
Default(inst);
INFO_LOG(DSPLLE, "Instruction not JITed(main part): %04x\n", inst);
}
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -322,7 +337,8 @@ void DSPEmitter::Compile(u16 start_addr)
}
}

if (fixup_pc) {
if (fixup_pc)
{
MOV(16, M(&(g_dsp.pc)), Imm16(compilePC));
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPEmitter.h
Expand Up @@ -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
Expand Down
151 changes: 80 additions & 71 deletions Source/Core/Core/Src/DSP/DSPHWInterface.cpp
Expand Up @@ -117,112 +117,121 @@ 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;
}
}

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];
}
}

Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPHost.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPIntCCUtil.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DSPIntCCUtil.h
Expand Up @@ -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
Expand Down
78 changes: 43 additions & 35 deletions Source/Core/Core/Src/DSP/DSPIntExtOps.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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]));
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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));
}
}
Expand All @@ -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]));
}
}
Expand All @@ -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));
}
Expand All @@ -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]));
}
Expand All @@ -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));
}
Expand All @@ -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]));
}
Expand All @@ -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));
}
Expand All @@ -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]));
}
Expand All @@ -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));
}
Expand All @@ -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]));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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));
}
Expand All @@ -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]));
Expand All @@ -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]));
Expand All @@ -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]));
Expand All @@ -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]));
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)))
Expand Down
12 changes: 10 additions & 2 deletions Source/Core/Core/Src/DSP/DSPIntUtil.h
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
}

// ---------------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/Src/DSP/DSPInterpreter.h
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions Source/Core/Core/Src/DSP/DSPTables.cpp
Expand Up @@ -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)
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -576,4 +577,4 @@ void InitInstructionTable()

for (int i=0; i < WRITEBACKLOGSIZE; i++)
writeBackLogIdx[i] = -1;
}
}
18 changes: 11 additions & 7 deletions Source/Core/Core/Src/DSP/DSPTables.h
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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();
}
}
Expand Down
39 changes: 26 additions & 13 deletions Source/Core/Core/Src/DSP/DspIntArithmetic.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 5 additions & 1 deletion Source/Core/Core/Src/DSP/DspIntBranch.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -194,7 +194,9 @@ void loop(const UDSPInstruction opc)
dsp_reg_store_stack(3, cnt);
}
else
{
dsp_skip_inst();
}
}

// LOOPI #I
Expand All @@ -217,7 +219,9 @@ void loopi(const UDSPInstruction opc)
dsp_reg_store_stack(3, cnt);
}
else
{
dsp_skip_inst();
}
}


Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DspIntLoadStore.cpp
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/DspIntMisc.cpp
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions Source/Core/Core/Src/DSP/DspIntMultiplier.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -203,7 +203,7 @@ void mulaxh(const UDSPInstruction opc)

zeroWriteBackLog();

dsp_set_long_prod(prod);
dsp_set_long_prod(prod);
}

//----
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/Jit/DSPJitArithmetic.cpp
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/DSP/Jit/DSPJitBranch.cpp
Expand Up @@ -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"
Expand All @@ -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;
}
Expand Down
37 changes: 24 additions & 13 deletions Source/Core/Core/Src/DSP/Jit/DSPJitExtOps.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand All @@ -66,15 +69,15 @@ 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);
storeIndex = dreg + DSP_REG_AXL0;
} 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.
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -690,17 +696,20 @@ 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
// EBX with 0 (becoming the MOV we have here)
// 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);
Expand All @@ -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;
}
3 changes: 1 addition & 2 deletions Source/Core/Core/Src/DSP/Jit/DSPJitLoadStore.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -49,7 +49,6 @@ void DSPEmitter::srs(const UDSPInstruction opc)
dmem_write(tmp1);

gpr.putXReg(tmp1);

}

// LRS $(0x18+D), @M
Expand Down
15 changes: 9 additions & 6 deletions Source/Core/Core/Src/DSP/Jit/DSPJitMisc.cpp
Expand Up @@ -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/


Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/Jit/DSPJitMultiplier.cpp
Expand Up @@ -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
Expand Down
309 changes: 208 additions & 101 deletions Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.h
Expand Up @@ -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
Expand All @@ -22,7 +22,8 @@

class DSPEmitter;

enum DSPJitRegSpecial {
enum DSPJitRegSpecial
{
DSP_REG_AX0_32 =32,
DSP_REG_AX1_32 =33,
#ifdef _M_X64
Expand All @@ -39,8 +40,11 @@ enum DSPJitRegSpecial {
DSP_REG_NONE =255
};

enum DSPJitSignExtend {
SIGN, ZERO, NONE
enum DSPJitSignExtend
{
SIGN,
ZERO,
NONE
};

#ifdef _M_X64
Expand All @@ -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;
Expand All @@ -67,7 +74,7 @@ class DSPJitRegCache {
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:
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/Jit/DSPJitUtil.cpp
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/Jit/DSPJitUtil.h
Expand Up @@ -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__
Expand Down
9 changes: 6 additions & 3 deletions Source/Core/Core/Src/DSP/LabelMap.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/LabelMap.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSP/assemble.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSPEmulator.cpp
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DSPEmulator.h
Expand Up @@ -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_
Expand Down
34 changes: 17 additions & 17 deletions Source/Core/Core/Src/Debugger/Debugger_SymbolMap.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/Debugger/Debugger_SymbolMap.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/Debugger/Dump.cpp
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/Debugger/Dump.h
Expand Up @@ -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
//
Expand Down
49 changes: 26 additions & 23 deletions Source/Core/Core/Src/Debugger/GCELF.h
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/DolLoader.h
Expand Up @@ -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
Expand Down
52 changes: 26 additions & 26 deletions Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.cpp
Expand Up @@ -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"
Expand All @@ -35,43 +35,43 @@ 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;
}

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);
int changes = (oldval ^ newval) & 0xFFFFFF;

BPCmd bp = {opcode, changes, newval};

return bp;
return bp;
}

void LoadBPReg(const BPCmd &bp, BPMemory &bpMem)
Expand Down Expand Up @@ -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] =

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
};
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 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
};
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;
Expand All @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
}
}
}

}
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/FifoPlayer/FifoAnalyzer.h
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Src/FifoPlayer/FifoDataFile.cpp
Expand Up @@ -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"
Expand All @@ -38,7 +38,7 @@ FifoDataFile::~FifoDataFile()
delete []frame.memoryUpdates[i].data;

delete []frame.fifoData;
}
}
}

void FifoDataFile::SetIsWii(bool isWii)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/FifoPlayer/FifoDataFile.h
Expand Up @@ -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_
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/Src/FifoPlayer/FifoFileStruct.h
Expand Up @@ -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_
Expand All @@ -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;
Expand Down
92 changes: 46 additions & 46 deletions Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
Expand All @@ -82,7 +82,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
{
AddMemoryUpdate(frame.memoryUpdates[nextMemUpdate], analyzed);
++nextMemUpdate;
}
}

bool wasDrawing = m_DrawingObject;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;

Expand All @@ -227,27 +227,27 @@ 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;
int vertexSize = FifoAnalyzer::CalculateVertexSize(vtxAttrGroup, m_CpMem);

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;
}
Expand Down Expand Up @@ -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
{
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/Src/FifoPlayer/FifoPlaybackAnalyzer.h
Expand Up @@ -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_
Expand Down Expand Up @@ -43,7 +43,7 @@ class FifoPlaybackAnalyzer
{
u32 begin;
u32 end;
};
};

void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo);

Expand All @@ -58,7 +58,7 @@ class FifoPlaybackAnalyzer
std::vector<MemoryRange> m_WrittenMemory;

BPMemory m_BpMem;
FifoAnalyzer::CPMemory m_CpMem;
FifoAnalyzer::CPMemory m_CpMem;
};

#endif
6 changes: 3 additions & 3 deletions Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/FifoPlayer/FifoPlayer.h
Expand Up @@ -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_
Expand Down
40 changes: 20 additions & 20 deletions Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
{
Expand All @@ -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;

Expand All @@ -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)
{
Expand All @@ -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);
}
}
}

Expand All @@ -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;

Expand Down Expand Up @@ -216,7 +216,7 @@ void FifoRecordAnalyzer::WriteVertexArray(int arrayIndex, u8 *vertexData, int ve
if (index > maxIndex)
maxIndex = index;
}
}
}
}
else
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/FifoPlayer/FifoRecordAnalyzer.h
Expand Up @@ -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_
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/Src/FifoPlayer/FifoRecorder.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/FifoPlayer/FifoRecorder.h
Expand Up @@ -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_
Expand Down