Run code through the advanced tool 'sed' to remove trailing whitespace.

This commit is contained in:
comex committed 2013-11-03 20:54:05 -05:00
1 parent 965b32be9c
commit c579637eaf
568 files changed
+8650 -8654

No files matched your search

+17 -17
View File
@@ -38,13 +38,13 @@ enum
{
// Zero Code Types
ZCODE_END = 0x00,
ZCODE_NORM = 0x02,
ZCODE_ROW = 0x03,
ZCODE_NORM = 0x02,
ZCODE_ROW = 0x03,
ZCODE_04 = 0x04,
// Conditional Codes
CONDTIONAL_EQUAL = 0x01,
CONDTIONAL_NOT_EQUAL = 0x02,
CONDTIONAL_NOT_EQUAL = 0x02,
CONDTIONAL_LESS_THAN_SIGNED = 0x03,
CONDTIONAL_GREATER_THAN_SIGNED = 0x04,
CONDTIONAL_LESS_THAN_UNSIGNED = 0x05,
@@ -59,14 +59,14 @@ enum
// Data Types
DATATYPE_8BIT = 0x00,
DATATYPE_16BIT = 0x01,
DATATYPE_32BIT = 0x02,
DATATYPE_16BIT = 0x01,
DATATYPE_32BIT = 0x02,
DATATYPE_32BIT_FLOAT = 0x03,
// Normal Code 0 Subtypes
SUB_RAM_WRITE = 0x00,
SUB_WRITE_POINTER = 0x01,
SUB_ADD_CODE = 0x02,
SUB_WRITE_POINTER = 0x01,
SUB_ADD_CODE = 0x02,
SUB_MASTER_CODE = 0x03,
};
@@ -114,8 +114,8 @@ bool CompareValues(const u32 val1, const u32 val2, const int type);
void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
{
// Parses the Action Replay section of a game ini file.
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats
&& !forceLoad)
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats
&& !forceLoad)
return;
arCodes.clear();
@@ -196,7 +196,7 @@ void LoadCodes(IniFile &globalIni, IniFile &localIni, bool forceLoad)
else
{
SplitString(line, '-', pieces);
if (pieces.size() == 3 && pieces[0].size() == 4 && pieces[1].size() == 4 && pieces[2].size() == 5)
if (pieces.size() == 3 && pieces[0].size() == 4 && pieces[1].size() == 4 && pieces[2].size() == 5)
{
// Encrypted AR code
// Decryption is done in "blocks", so we must push blocks into a vector,
@@ -231,7 +231,7 @@ void LoadCodes(std::vector<ARCode> &_arCodes, IniFile &globalIni, IniFile& local
void LogInfo(const char *format, ...)
{
if (!b_RanOnce)
if (!b_RanOnce)
{
if (LogManager::GetMaxLevel() >= LogTypes::LINFO || logSelf)
{
@@ -257,7 +257,7 @@ void RunAllActive()
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats)
{
for (auto& activeCode : activeCodes)
for (auto& activeCode : activeCodes)
{
if (activeCode.active)
{
@@ -390,7 +390,7 @@ bool RunCode(const ARCode &arcode)
doMemoryCopy = true;
val_last = data;
}
else
else
{
LogInfo("ZCode: Fill And Slide");
doFillNSlide = true;
@@ -398,9 +398,9 @@ bool RunCode(const ARCode &arcode)
}
break;
default:
default:
LogInfo("ZCode: Unknown");
PanicAlertT("Zero code unknown to dolphin: %08x", zcode);
PanicAlertT("Zero code unknown to dolphin: %08x", zcode);
return false;
break;
}
@@ -702,7 +702,7 @@ bool ZeroCode_FillAndSlide(const u32 val_last, const ARAddr addr, const u32 data
case DATATYPE_8BIT:
LogInfo("8-bit Write");
LogInfo("--------");
for (int i = 0; i < write_num; ++i)
for (int i = 0; i < write_num; ++i)
{
Memory::Write_U8(val & 0xFF, curr_addr);
curr_addr += addr_incr;
@@ -766,7 +766,7 @@ bool ZeroCode_MemoryCopy(const u32 val_last, const ARAddr addr, const u32 data)
LogInfo("Size: %08x", num_bytes);
if ((data & ~0x7FFF) == 0x0000)
{
{
if ((data >> 24) != 0x0)
{ // Memory Copy With Pointers Support
LogInfo("Memory Copy With Pointers Support");
+1 -1
View File
@@ -66,7 +66,7 @@ void sigsegv_handler(int signal, siginfo_t *info, void *raw_context)
void *fault_memory_ptr = (void*)ctx->arm_r10;
u8 *fault_instruction_ptr = (u8 *)ctx->arm_pc;
if (!JitInterface::IsInCodeSpace(fault_instruction_ptr)) {
// Let's not prevent debugging.
return;
+8 -8
View File
@@ -41,11 +41,11 @@ void CBoot::Load_FST(bool _bIsWii)
return;
// copy first 20 bytes of disc to start of Mem 1
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
VolumeHandler::ReadToPtr(Memory::GetPointer(0x80000000), 0, 0x20);
// copy of game id
Memory::Write_U32(Memory::Read_U32(0x80000000), 0x80003180);
u32 shift = 0;
if (_bIsWii)
shift = 2;
@@ -137,7 +137,7 @@ bool CBoot::LoadMapFromFilename()
return false;
}
// If ipl.bin is not found, this function does *some* of what BS1 does:
// If ipl.bin is not found, this function does *some* of what BS1 does:
// loading IPL(BS2) and jumping to it.
// It does not initialize the hardware or anything else like BS1 does.
bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
@@ -190,7 +190,7 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
// Third boot step after BootManager and Core. See Call schedule in BootManager.cpp
bool CBoot::BootUp()
{
SCoreStartupParameter& _StartupPara =
SCoreStartupParameter& _StartupPara =
SConfig::GetInstance().m_LocalCoreStartupParameter;
NOTICE_LOG(BOOT, "Booting %s", _StartupPara.m_strFilename.c_str());
@@ -295,7 +295,7 @@ bool CBoot::BootUp()
NOTICE_LOG(BOOT, "Setting DVDRoot %s", _StartupPara.m_strDVDRoot.c_str());
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, dolWii, _StartupPara.m_strApploader, _StartupPara.m_strFilename);
BS2Success = EmulatedBS2(dolWii);
}
}
DVDInterface::SetDiscInside(VolumeHandler::IsValid());
@@ -326,7 +326,7 @@ bool CBoot::BootUp()
if (elfWii != _StartupPara.bWii)
{
PanicAlertT("Warning - starting ELF in wrong console mode!");
}
}
bool BS2Success = false;
@@ -347,7 +347,7 @@ bool CBoot::BootUp()
// TODO: auto-convert elf to dol, so we can load them :)
VolumeHandler::SetVolumeDirectory(_StartupPara.m_strDVDRoot, elfWii);
BS2Success = EmulatedBS2(elfWii);
}
}
else if (!_StartupPara.m_strDefaultGCM.empty())
{
NOTICE_LOG(BOOT, "Loading default ISO %s", _StartupPara.m_strDefaultGCM.c_str());
@@ -364,7 +364,7 @@ bool CBoot::BootUp()
else // Poor man's bootup
{
Load_FST(elfWii);
Boot_ELF(_StartupPara.m_strFilename.c_str());
Boot_ELF(_StartupPara.m_strFilename.c_str());
}
UpdateDebugger_MapLoaded();
Dolphin_Debugger::AddAutoBreakpoints();
+4 -4
View File
@@ -20,7 +20,7 @@ CDolLoader::CDolLoader(const char* _szFilename)
u8* const tmpBuffer = new u8[(size_t)size];
{
File::IOFile pStream(_szFilename, "rb");
File::IOFile pStream(_szFilename, "rb");
pStream.ReadBytes(tmpBuffer, (size_t)size);
}
@@ -44,19 +44,19 @@ CDolLoader::~CDolLoader()
}
void CDolLoader::Initialize(u8* _pBuffer, u32 _Size)
{
{
memcpy(&m_dolheader, _pBuffer, sizeof(SDolHeader));
// swap memory
u32* p = (u32*)&m_dolheader;
for (size_t i = 0; i < (sizeof(SDolHeader)/sizeof(u32)); i++)
for (size_t i = 0; i < (sizeof(SDolHeader)/sizeof(u32)); i++)
p[i] = Common::swap32(p[i]);
for (auto& sect : text_section)
sect = NULL;
for (auto& sect : data_section)
sect = NULL;
u32 HID4_pattern = 0x7c13fba6;
u32 HID4_mask = 0xfc1fffff;
+4 -4
View File
@@ -21,10 +21,10 @@ bool CBoot::IsElfWii(const char *filename)
File::IOFile f(filename, "rb");
f.ReadBytes(mem, (size_t)filesize);
}
// Use the same method as the DOL loader uses: search for mfspr from HID4,
// which should only be used in Wii ELFs.
//
//
// Likely to have some false positives/negatives, patches implementing a
// better heuristic are welcome.
@@ -63,7 +63,7 @@ bool CBoot::Boot_ELF(const char *filename)
File::IOFile f(filename, "rb");
f.ReadBytes(mem, (size_t)filesize);
}
ElfReader reader(mem);
reader.LoadInto(0x80000000);
if (!reader.LoadSymbols())
@@ -75,7 +75,7 @@ bool CBoot::Boot_ELF(const char *filename)
{
HLE::PatchFunctions();
}
PC = reader.GetEntryPoint();
delete[] mem;
+3 -3
View File
@@ -45,7 +45,7 @@ typedef struct {
bool CBoot::Boot_WiiWAD(const char* _pFilename)
{
std::string state_filename(Common::GetTitleDataPath(TITLEID_SYSMENU) + WII_STATE);
if (File::Exists(state_filename))
@@ -53,7 +53,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
File::IOFile state_file(state_filename, "r+b");
StateFlags state;
state_file.ReadBytes(&state, sizeof(StateFlags));
state.type = 0x03; // TYPE_RETURN
state.checksum = state_checksum((u32*)&state.flags, sizeof(StateFlags)-4);
@@ -79,7 +79,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
u64 titleID = ContentLoader.GetTitleID();
// create data directory
File::CreateFullPath(Common::GetTitleDataPath(titleID));
if (titleID == TITLEID_SYSMENU)
HLE_IPC_CreateVirtualFATFilesystem();
// setup wii mem
+5 -5
View File
@@ -64,7 +64,7 @@ ElfReader::ElfReader(void *ptr)
byteswapHeader(*header);
segments = (Elf32_Phdr *)(base + header->e_phoff);
sections = (Elf32_Shdr *)(base + header->e_shoff);
sections = (Elf32_Shdr *)(base + header->e_shoff);
for (int i = 0; i < GetNumSegments(); i++)
{
@@ -98,7 +98,7 @@ bool ElfReader::LoadInto(u32 vaddr)
// sectionOffsets = new u32[GetNumSections()];
// sectionAddrs = new u32[GetNumSections()];
// Should we relocate?
bRelocate = (header->e_type != ET_EXEC);
@@ -123,7 +123,7 @@ bool ElfReader::LoadInto(u32 vaddr)
Elf32_Phdr *p = segments + i;
INFO_LOG(MASTER_LOG, "Type: %i Vaddr: %08x Filesz: %i Memsz: %i ", p->p_type, p->p_vaddr, p->p_filesz, p->p_memsz);
if (p->p_type == PT_LOAD)
{
segmentVAddr[i] = baseAddress + p->p_vaddr;
@@ -154,7 +154,7 @@ bool ElfReader::LoadInto(u32 vaddr)
{
Elf32_Shdr *s = &sections[i];
const char *name = GetSectionName(i);
u32 writeAddr = s->sh_addr + baseAddress;
sectionOffsets[i] = writeAddr - vaddr;
sectionAddrs[i] = writeAddr;
@@ -162,7 +162,7 @@ bool ElfReader::LoadInto(u32 vaddr)
if (s->sh_flags & SHF_ALLOC)
{
LOG(MASTER_LOG,"Data Section found: %s Sitting at %08x, size %08x", name, writeAddr, s->sh_size);
}
else
{
+3 -3
View File
@@ -26,15 +26,15 @@ private:
Elf32_Ehdr *header;
Elf32_Phdr *segments;
Elf32_Shdr *sections;
u32 *sectionAddrs;
bool bRelocate;
u32 entryPoint;
public:
public:
ElfReader(void *ptr);
~ElfReader() { }
u32 Read32(int off) const { return base32[off>>2]; }
// Quick accessors
+15 -15
View File
@@ -107,12 +107,12 @@ enum ElfSectionFlags
SHF_MASKPROC =0xF0000000,
};
// Symbol binding
#define STB_LOCAL 0
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_LOPROC 13
#define STB_HIPROC 15
// Symbol binding
#define STB_LOCAL 0
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_LOPROC 13
#define STB_HIPROC 15
// Symbol types
#define STT_NOTYPE 0
@@ -191,7 +191,7 @@ typedef unsigned int Elf32_Word;
// ELF file header
struct Elf32_Ehdr
struct Elf32_Ehdr
{
unsigned char e_ident[EI_NIDENT];
Elf32_Half e_type;
@@ -210,7 +210,7 @@ struct Elf32_Ehdr
};
// Section header
struct Elf32_Shdr
struct Elf32_Shdr
{
Elf32_Word sh_name;
Elf32_Word sh_type;
@@ -225,7 +225,7 @@ struct Elf32_Shdr
};
// Segment header
struct Elf32_Phdr
struct Elf32_Phdr
{
Elf32_Word p_type;
Elf32_Off p_offset;
@@ -238,7 +238,7 @@ struct Elf32_Phdr
};
// Symbol table entry
struct Elf32_Sym
struct Elf32_Sym
{
Elf32_Word st_name;
Elf32_Addr st_value;
@@ -253,13 +253,13 @@ struct Elf32_Sym
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
// Relocation entries
struct Elf32_Rel
struct Elf32_Rel
{
Elf32_Addr r_offset;
Elf32_Word r_info;
};
struct Elf32_Rela
struct Elf32_Rela
{
Elf32_Addr r_offset;
Elf32_Word r_info;
@@ -271,13 +271,13 @@ struct Elf32_Rela
#define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t))
struct Elf32_Dyn
struct Elf32_Dyn
{
Elf32_Sword d_tag;
union
union
{
Elf32_Word d_val;
Elf32_Addr d_ptr;
Elf32_Addr d_ptr;
} d_un;
};
+2 -2
View File
@@ -9,7 +9,7 @@
// Call sequence: This file has one of the first function called when a game is booted,
// the boot sequence in the code is:
// DolphinWX: FrameTools.cpp StartGame
// Core BootManager.cpp BootCore
// Core.cpp Init Thread creation
@@ -141,7 +141,7 @@ bool BootCore(const std::string& _rFilename)
// Flush possible changes to SYSCONF to file
SConfig::GetInstance().m_SYSCONF->Save();
}
}
}
// movie settings
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
+2 -2
View File
@@ -171,8 +171,8 @@ void SConfig::SaveSettings()
#ifdef USE_GDBSTUB
ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort);
#endif
// Interface
// Interface
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);
+1 -1
View File
@@ -66,7 +66,7 @@ inline void DisplayMessage(const std::string &message, int time_in_ms)
{
DisplayMessage(message.c_str(), time_in_ms);
}
std::string GetStateFileName();
void SetStateFileName(std::string val);
+12 -12
View File
@@ -113,7 +113,7 @@ void Init()
slicelength = maxSliceLength;
globalTimer = 0;
idledCycles = 0;
ev_lost = RegisterEvent("_lost_event", &EmptyTimedCallback);
}
@@ -187,7 +187,7 @@ void DoState(PointerWrap &p)
u64 GetTicks()
{
return (u64)globalTimer;
return (u64)globalTimer;
}
u64 GetIdleTicks()
@@ -251,7 +251,7 @@ void AddEventToQueue(Event* ne)
// This must be run ONLY from within the cpu thread
// cyclesIntoFuture may be VERY inaccurate if called from anything else
// than Advance
// than Advance
void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata)
{
Event *ne = GetNewEvent();
@@ -266,7 +266,7 @@ void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted))
advanceCallback = callback;
}
bool IsScheduled(int event_type)
bool IsScheduled(int event_type)
{
if (!first)
return false;
@@ -297,7 +297,7 @@ void RemoveEvent(int event_type)
break;
}
}
if (!first)
return;
@@ -394,7 +394,7 @@ void Advance()
{
if (first->time <= globalTimer)
{
// LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
// LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
// event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
Event* evt = first;
first = first->next;
@@ -407,7 +407,7 @@ void Advance()
}
}
if (!first)
if (!first)
{
WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
downcount += 10000;
@@ -437,9 +437,9 @@ void LogPendingEvents()
void Idle()
{
//DEBUG_LOG(POWERPC, "Idle");
//When the FIFO is processing data we must not advance because in this way
//the VI will be desynchronized. So, We are waiting until the FIFO finish and
//the VI will be desynchronized. So, We are waiting until the FIFO finish and
//while we process only the events required by the FIFO.
while (g_video_backend->Video_IsPossibleWaitingSetDrawDone())
{
@@ -449,7 +449,7 @@ void Idle()
idledCycles += downcount;
downcount = 0;
Advance();
}
@@ -463,11 +463,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;
}
+2 -2
View File
@@ -73,7 +73,7 @@ u16 dsp_read_aram_d3()
break;
}
if (Address >= EndAddress)
if (Address >= EndAddress)
{
// Set address back to start address. (never seen this here!)
Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL];
@@ -131,7 +131,7 @@ u16 dsp_read_accelerator()
Address++;
break;
case 0x19: // 8-bit PCM audio
val = DSPHost_ReadHostMemory(Address) << 8;
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++;
+9 -9
View File
@@ -43,20 +43,20 @@ const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
{ 0x26fc, // lrs $AC0.M, @DMBH
0x02a0, 0x8000, // andf $AC0.M, #0x8000
0x029c, 0xFFFF, // jlnz 0x????
0, 0 },
0, 0 },
{ 0x27fc, // lrs $AC1.M, @DMBH
0x03a0, 0x8000, // andf $AC1.M, #0x8000
0x029c, 0xFFFF, // jlnz 0x????
0, 0 },
0, 0 },
// From Zelda:
{ 0x00de, 0xFFFE, // LR $AC0.M, @CMBH
0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
0x029c, 0xFFFF, // JLNZ 0x05cf
0 },
// From Zelda - experimental
{ 0x00da, 0x0352, // lr $AX0.H, @0x0352
0x8600, // tstaxh $AX0.H
0x0295, 0xFFFF, // jz 0x????
0x0295, 0xFFFF, // jz 0x????
0, 0 }
};
@@ -112,11 +112,11 @@ void AnalyzeRange(int start_addr, int end_addr)
// If an instruction potentially raises exceptions, mark the following
// instruction as needing to check for exceptions
if (opcode->opcode == 0x00c0 ||
opcode->opcode == 0x1800 ||
opcode->opcode == 0x1880 ||
opcode->opcode == 0x1900 ||
opcode->opcode == 0x1980 ||
if (opcode->opcode == 0x00c0 ||
opcode->opcode == 0x1800 ||
opcode->opcode == 0x1880 ||
opcode->opcode == 0x1900 ||
opcode->opcode == 0x1980 ||
opcode->opcode == 0x2000 ||
opcode->extended
)
+2 -2
View File
@@ -16,7 +16,7 @@ public:
{
Clear();
}
// is address breakpoint
bool IsAddressBreakPoint(u32 addr)
{
@@ -27,7 +27,7 @@ public:
bool Add(u32 addr, bool temp=false)
{
bool was_one = b[addr] != 0;
if (!was_one)
{
b[addr] = temp ? 2 : 1;
+4 -4
View File
@@ -54,7 +54,7 @@ bool Disassemble(const std::vector<u16> &code, bool line_numbers, std::string &t
}
bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2)
{
{
if (code1.size() != code2.size())
printf("Size difference! 1=%i 2=%i\n", (int)code1.size(), (int)code2.size());
u32 count_equal = 0;
@@ -94,7 +94,7 @@ bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2)
return code1.size() == code2.size() && code1.size() == count_equal;
}
void GenRandomCode(u32 size, std::vector<u16> &code)
void GenRandomCode(u32 size, std::vector<u16> &code)
{
code.resize(size);
for (u32 i = 0; i < size; i++)
@@ -149,7 +149,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
reserveSize += (u32)codes_padded.at(i).size();
}
header.clear();
header.reserve(reserveSize * 4);
sprintf(buffer, "#define NUM_UCODES %u\n\n", numCodes);
@@ -172,7 +172,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
continue;
header.append("\t{\n\t\t");
for (u32 j = 0; j < codes_padded.at(i).size(); j++)
for (u32 j = 0; j < codes_padded.at(i).size(); j++)
{
if (j && ((j & 15) == 0))
header.append("\n\t\t");
+4 -4
View File
@@ -52,7 +52,7 @@ static bool LoadRom(const char *fname, int size_in_words, u16 *rom)
{
pFile.ReadArray(rom, size_in_words);
pFile.Close();
// Byteswap the rom.
for (int i = 0; i < size_in_words; i++)
rom[i] = Common::swap16(rom[i]);
@@ -139,7 +139,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
cyclesLeft = 0;
init_hax = false;
dspjit = NULL;
g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE);
g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE);
g_dsp.dram = (u16*)AllocateMemoryPages(DSP_DRAM_BYTE_SIZE);
@@ -198,7 +198,7 @@ bool DSPCore_Init(const char *irom_filename, const char *coef_filename,
WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
// Initialize JIT, if necessary
if(bUsingJIT)
if(bUsingJIT)
dspjit = new DSPEmitter();
core_state = DSPCORE_RUNNING;
@@ -250,7 +250,7 @@ void DSPCore_CheckExternalInterrupt()
// Signal the SPU about new mail
DSPCore_SetException(EXP_INT);
g_dsp.cr &= ~CR_EXTERNAL_INT;
}
+1 -1
View File
@@ -222,7 +222,7 @@ struct SDSP
#if PROFILE
u16 err_pc;
#endif
// This is NOT the same cr as r.cr.
// This register is shared with the main emulation, see DSP.cpp
// The engine has control over 0x0C07 of this reg.
+8 -8
View File
@@ -25,7 +25,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
blocks = new DSPCompiledCode[MAX_BLOCKS];
blockLinks = new Block[MAX_BLOCKS];
blockSize = new u16[MAX_BLOCKS];
compileSR = 0;
compileSR |= SR_INT_ENABLE;
compileSR |= SR_EXT_INT_ENABLE;
@@ -42,7 +42,7 @@ DSPEmitter::DSPEmitter() : gpr(*this), storeIndex(-1), storeIndex2(-1)
}
}
DSPEmitter::~DSPEmitter()
DSPEmitter::~DSPEmitter()
{
delete[] blocks;
delete[] blockLinks;
@@ -62,7 +62,7 @@ void DSPEmitter::ClearIRAM()
g_dsp.reset_dspjit_codespace = true;
}
void DSPEmitter::ClearIRAMandDSPJITCodespaceReset()
void DSPEmitter::ClearIRAMandDSPJITCodespaceReset()
{
ClearCodeSpace();
CompileDispatcher();
@@ -101,9 +101,9 @@ void DSPEmitter::checkExceptions(u32 retval)
bool DSPEmitter::FlagsNeeded()
{
if (!(DSPAnalyzer::code_flags[compilePC] & DSPAnalyzer::CODE_START_OF_INST) ||
(DSPAnalyzer::code_flags[compilePC] & DSPAnalyzer::CODE_UPDATE_SR))
return true;
if (!(DSPAnalyzer::code_flags[compilePC] & DSPAnalyzer::CODE_START_OF_INST) ||
(DSPAnalyzer::code_flags[compilePC] & DSPAnalyzer::CODE_UPDATE_SR))
return true;
else
return false;
}
@@ -168,7 +168,7 @@ void DSPEmitter::EmitInstruction(UDSPInstruction inst)
}
}
}
// Main instruction
if (!opTable[inst]->jitFunc)
{
@@ -352,7 +352,7 @@ void DSPEmitter::Compile(u16 start_addr)
}
}
if (blockSize[start_addr] == 0)
if (blockSize[start_addr] == 0)
{
// just a safeguard, should never happen anymore.
// if it does we might get stuck over in RunForCycles.
+1 -1
View File
@@ -264,7 +264,7 @@ private:
// The index of the last stored ext value (compile time).
int storeIndex;
int storeIndex2;
// Counts down.
// int cycles;
+3 -3
View File
@@ -120,7 +120,7 @@ void gdsp_ifx_write(u32 addr, u32 val)
case DSP_DIRQ:
if (val & 0x1)
DSPHost_InterruptRequest();
else
else
INFO_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val);
break;
@@ -156,7 +156,7 @@ void gdsp_ifx_write(u32 addr, u32 val)
case DSP_GAIN:
if (val)
{
INFO_LOG(DSPLLE,"Gain Written: 0x%04x", val);
INFO_LOG(DSPLLE,"Gain Written: 0x%04x", val);
}
case DSP_DSPA:
case DSP_DSMAH:
@@ -241,7 +241,7 @@ static void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
u8* dst = ((u8*)g_dsp.iram);
for (u32 i = 0; i < size; i += 2)
{
{
*(u16*)&dst[dsp_addr + i] = Common::swap16(*(const u16*)&g_dsp.cpu_ram[(addr + i) & 0x0fffffff]);
}
WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
+6 -6
View File
@@ -27,7 +27,7 @@ void Update_SR_Register64(s64 _Value, bool carry, bool overflow)
if (overflow)
{
g_dsp.r.sr |= SR_OVERFLOW;
g_dsp.r.sr |= SR_OVERFLOW_STICKY;
g_dsp.r.sr |= SR_OVERFLOW_STICKY;
}
// 0x04
@@ -79,14 +79,14 @@ void Update_SR_Register16(s16 _Value, bool carry, bool overflow, bool overS32)
g_dsp.r.sr |= SR_ARITH_ZERO;
}
// 0x08
// 0x08
if (_Value < 0)
{
g_dsp.r.sr |= SR_SIGN;
}
// 0x10
if (overS32)
if (overS32)
{
g_dsp.r.sr |= SR_OVER_S32;
}
@@ -100,7 +100,7 @@ void Update_SR_Register16(s16 _Value, bool carry, bool overflow, bool overS32)
void Update_SR_LZ(bool value)
{
if (value == true)
if (value == true)
g_dsp.r.sr |= SR_LOGIC_ZERO;
else
g_dsp.r.sr &= ~SR_LOGIC_ZERO;
@@ -156,11 +156,11 @@ bool CheckCondition(u8 _Condition)
return isLess() || isZero();
case 0x4: // NZ - Not Zero
return !isZero();
case 0x5: // Z - Zero
case 0x5: // Z - Zero
return isZero();
case 0x6: // NC - Not carry
return !isCarry();
case 0x7: // C - Carry
case 0x7: // C - Carry
return isCarry();
case 0x8: // ? - Not over s32
return !isOverS32();
+1 -1
View File
@@ -26,7 +26,7 @@ inline bool isCarry(u64 val, u64 result) {
}
inline bool isCarry2(u64 val, u64 result) {
return (val>=result);
return (val>=result);
}
inline bool isOverflow(s64 val1, s64 val2, s64 res) {
+16 -16
View File
@@ -7,7 +7,7 @@
#include "DSPIntExtOps.h"
//not needed for game ucodes (it slows down interpreter/dspjit32 + easier to compare int VS dspjit64 without it)
//#define PRECISE_BACKLOG
//#define PRECISE_BACKLOG
// Extended opcodes do not exist on their own. These opcodes can only be
// attached to opcodes that allow extending (8 (or 7) lower bits of opcode not used by
@@ -29,7 +29,7 @@ inline static void writeToBackLog(int i, int idx, u16 value)
namespace DSPInterpreter
{
namespace Ext
namespace Ext
{
inline bool IsSameMemArea(u16 a, u16 b)
@@ -63,7 +63,7 @@ void ir(const UDSPInstruction opc)
void nr(const UDSPInstruction opc)
{
u8 reg = opc & 0x3;
writeToBackLog(0, reg, dsp_increase_addr_reg(reg, (s16)g_dsp.r.ix[reg]));
}
@@ -87,7 +87,7 @@ void mv(const UDSPInstruction opc)
break;
}
}
// S @$arD, $acS.S
// xxxx xxxx 001s s0dd
// Store value of $acS.S in the memory pointed by register $arD.
@@ -136,14 +136,14 @@ void sn(const UDSPInstruction opc)
// L $axD.D, @$arS
// xxxx xxxx 01dd d0ss
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Post increment register $arS.
void l(const UDSPInstruction opc)
{
u8 sreg = opc & 0x3;
u8 dreg = ((opc >> 3) & 0x7) + DSP_REG_AXL0;
if ((dreg >= DSP_REG_ACM0) && (g_dsp.r.sr & SR_40_MODE_BIT))
if ((dreg >= DSP_REG_ACM0) && (g_dsp.r.sr & SR_40_MODE_BIT))
{
u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]);
writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000);
@@ -160,14 +160,14 @@ void l(const UDSPInstruction opc)
// LN $axD.D, @$arS
// xxxx xxxx 01dd d0ss
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Add indexing register $ixS to register $arS.
void ln(const UDSPInstruction opc)
{
u8 sreg = opc & 0x3;
u8 dreg = ((opc >> 3) & 0x7) + DSP_REG_AXL0;
if ((dreg >= DSP_REG_ACM0) && (g_dsp.r.sr & SR_40_MODE_BIT))
if ((dreg >= DSP_REG_ACM0) && (g_dsp.r.sr & SR_40_MODE_BIT))
{
u16 val = dsp_dmem_read(g_dsp.r.ar[sreg]);
writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000);
@@ -196,7 +196,7 @@ void ls(const UDSPInstruction opc)
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));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
}
@@ -269,7 +269,7 @@ void sl(const UDSPInstruction opc)
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));
writeToBackLog(2, DSP_REG_AR0, dsp_increment_addr_reg(DSP_REG_AR0));
}
// SLN $acS.m, $axD.D
@@ -329,7 +329,7 @@ void slnm(const UDSPInstruction opc)
// LD $ax0.d, $ax1.r, @$arS
// xxxx xxxx 11dr 00ss
// example for "nx'ld $AX0.L, $AX1.L, @$AR3"
// Loads the word pointed by AR0 to AX0.H, then loads the word pointed by AR3 to AX0.L.
// Loads the word pointed by AR0 to AX0.H, then loads the word pointed by AR3 to AX0.L.
// Increments AR0 and AR3.
// If AR0 and AR3 point into the same memory page (upper 6 bits of addr are the same -> games are not doing that!)
// then the value pointed by AR0 is loaded to BOTH AX0.H and AX0.L.
@@ -545,18 +545,18 @@ void zeroWriteBackLog()
#endif
}
void zeroWriteBackLogPreserveAcc(u8 acc)
void zeroWriteBackLogPreserveAcc(u8 acc)
{
#ifdef PRECISE_BACKLOG
for (int i = 0; writeBackLogIdx[i] != -1; i++)
{
// acc0
if ((acc == 0) &&
if ((acc == 0) &&
((writeBackLogIdx[i] == DSP_REG_ACL0) || (writeBackLogIdx[i] == DSP_REG_ACM0) || (writeBackLogIdx[i] == DSP_REG_ACH0)))
continue;
// acc1
if ((acc == 1) &&
if ((acc == 1) &&
((writeBackLogIdx[i] == DSP_REG_ACL1) || (writeBackLogIdx[i] == DSP_REG_ACM1) || (writeBackLogIdx[i] == DSP_REG_ACH1)))
continue;
+3 -3
View File
@@ -30,12 +30,12 @@
// Extended opcode support.
// Many opcode have the lower 0xFF (some only 0x7f) free - there, an opcode extension
// can be stored.
// can be stored.
namespace DSPInterpreter
{
namespace Ext
{
{
void l(const UDSPInstruction opc);
void ln(const UDSPInstruction opc);
void ls(const UDSPInstruction opc);
@@ -61,7 +61,7 @@ void dr(const UDSPInstruction opc);
void ir(const UDSPInstruction opc);
void nr(const UDSPInstruction opc);
void nop(const UDSPInstruction opc);
} // end namespace Ext
} // end namespace DSPinterpeter
+11 -11
View File
@@ -57,7 +57,7 @@ static inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix)
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
s32 ix = _ix;
u32 mx = (wr | 1) << 1;
u32 nar = ar + ix;
u32 dar = (nar ^ ar ^ ix) & mx;
@@ -75,7 +75,7 @@ static inline u16 dsp_increase_addr_reg(u16 reg, s16 _ix)
return nar;
}
static inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix)
static inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
@@ -98,23 +98,23 @@ static inline u16 dsp_decrease_addr_reg(u16 reg, s16 _ix)
return nar;
}
static inline u16 dsp_increment_addr_reg(u16 reg)
static inline u16 dsp_increment_addr_reg(u16 reg)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
u32 nar = ar + 1;
if ((nar ^ ar) > ((wr | 1) << 1))
nar -= wr + 1;
return nar;
}
static inline u16 dsp_decrement_addr_reg(u16 reg)
static inline u16 dsp_decrement_addr_reg(u16 reg)
{
u32 ar = g_dsp.r.ar[reg];
u32 wr = g_dsp.r.wr[reg];
u32 nar = ar + wr;
if (((nar ^ ar) & ((wr | 1) << 1)) > wr)
@@ -244,9 +244,9 @@ static inline void dsp_op_write_reg(int _reg, u16 val)
}
}
static inline void dsp_conditional_extend_accum(int reg)
static inline void dsp_conditional_extend_accum(int reg)
{
switch (reg)
switch (reg)
{
case DSP_REG_ACM0:
case DSP_REG_ACM1:
@@ -344,12 +344,12 @@ inline u16 dsp_op_read_reg_and_saturate(u8 _reg)
if (g_dsp.r.sr & SR_40_MODE_BIT)
{
s64 acc = dsp_get_long_acc(_reg);
if (acc != (s32)acc)
if (acc != (s32)acc)
{
if (acc > 0)
return 0x7fff;
else
else
return 0x8000;
}
else
+8 -8
View File
@@ -36,7 +36,7 @@ volatile u32 gdsp_running;
// NOTE: These have nothing to do with g_dsp.r.cr !
void WriteCR(u16 val)
void WriteCR(u16 val)
{
// reset
if (val & 1)
@@ -96,7 +96,7 @@ void Step()
u16 opc = dsp_fetch_code();
ExecuteInstruction(UDSPInstruction(opc));
if (DSPAnalyzer::code_flags[g_dsp.pc - 1] & DSPAnalyzer::CODE_LOOP_END)
HandleLoop();
}
@@ -107,7 +107,7 @@ int RunCyclesThread(int cycles)
while (true)
{
if (g_dsp.cr & CR_HALT)
return 0;
return 0;
if (g_dsp.external_interrupt_waiting)
{
@@ -129,7 +129,7 @@ int RunCyclesDebug(int cycles)
for (int i = 0; i < 8; i++)
{
if (g_dsp.cr & CR_HALT)
return 0;
return 0;
if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
{
DSPCore_SetState(DSPCORE_STEPPING);
@@ -163,7 +163,7 @@ int RunCyclesDebug(int cycles)
return 0;
}
// Now, lets run some more without idle skipping.
// Now, lets run some more without idle skipping.
for (int i = 0; i < 200; i++)
{
if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc))
@@ -189,7 +189,7 @@ int RunCycles(int cycles)
for (int i = 0; i < 8; i++)
{
if (g_dsp.cr & CR_HALT)
return 0;
return 0;
Step();
cycles--;
if (cycles < 0)
@@ -213,8 +213,8 @@ int RunCycles(int cycles)
return 0;
}
// Now, lets run some more without idle skipping.
for (int i = 0; i < 200; i++)
// Now, lets run some more without idle skipping.
for (int i = 0; i < 200; i++)
{
Step();
cycles--;
+1 -1
View File
@@ -106,7 +106,7 @@ void asr16(const UDSPInstruction opc);
void lsl(const UDSPInstruction opc);
void lsr(const UDSPInstruction opc);
void asl(const UDSPInstruction opc);
void asr(const UDSPInstruction opc);
void asr(const UDSPInstruction opc);
void lsrn(const UDSPInstruction opc);
void asrn(const UDSPInstruction opc);
void dar(const UDSPInstruction opc);
+2 -2
View File
@@ -50,14 +50,14 @@ u16 dsp_dmem_read(u16 addr)
{
case 0x0: // 0xxx DRAM
return g_dsp.dram[addr & DSP_DRAM_MASK];
case 0x1: // 1xxx COEF
DEBUG_LOG(DSPLLE, "%04x : Coefficient Read @ %04x", g_dsp.pc, addr);
return g_dsp.coef[addr & DSP_COEF_MASK];
case 0xf: // Fxxx HW regs
return gdsp_ifx_read(addr);
default: // Unmapped/non-existing memory
ERROR_LOG(DSPLLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory", g_dsp.pc, addr);
return 0;
+5 -5
View File
@@ -19,7 +19,7 @@ void nop(const UDSPInstruction opc)
ERROR_LOG(DSPLLE, "LLE: Unrecognized opcode 0x%04x", opc);
}
}
const DSPOPCTemplate opcodes[] =
{
{"NOP", 0x0000, 0xfffc, nop, &DSPEmitter::nop, 1, 0, {}, false, false, false, false, false},
@@ -47,7 +47,7 @@ const DSPOPCTemplate opcodes[] =
{"RETLZ", 0x02dd, 0xffff, DSPInterpreter::ret, &DSPEmitter::ret, 1, 0, {}, false, true, false, true, false},
{"RETO", 0x02de, 0xffff, DSPInterpreter::ret, &DSPEmitter::ret, 1, 0, {}, false, true, false, true, false},
{"RET", 0x02df, 0xffff, DSPInterpreter::ret, &DSPEmitter::ret, 1, 0, {}, false, true, true, false, false},
{"RTI", 0x02ff, 0xffff, DSPInterpreter::rti, &DSPEmitter::rti, 1, 0, {}, false, true, true, false, false},
{"CALLGE", 0x02b0, 0xffff, DSPInterpreter::call, &DSPEmitter::call, 2, 1, {{P_ADDR_I, 2, 1, 0, 0xffff}}, false, true, false, true, false},
@@ -142,7 +142,7 @@ const DSPOPCTemplate opcodes[] =
{"LSR", 0x1440, 0xfec0, DSPInterpreter::lsr, &DSPEmitter::lsr, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, false, false, false, false, true},
{"ASL", 0x1480, 0xfec0, DSPInterpreter::asl, &DSPEmitter::asl, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, false, false, false, false, true},
{"ASR", 0x14c0, 0xfec0, DSPInterpreter::asr, &DSPEmitter::asr, 1, 2, {{P_ACC, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, false, false, false, false, true},
{"LSRN", 0x02ca, 0xffff, DSPInterpreter::lsrn, &DSPEmitter::lsrn, 1, 0, {}, false, false, false, false, true}, // discovered by ector!
{"ASRN", 0x02cb, 0xffff, DSPInterpreter::asrn, &DSPEmitter::asrn, 1, 0, {}, false, false, false, false, true}, // discovered by ector!
@@ -288,7 +288,7 @@ const DSPOPCTemplate opcodes[] =
{"MOVPZ", 0xfe00, 0xfe00, DSPInterpreter::movpz, &DSPEmitter::movpz, 1, 1, {{P_ACC, 1, 0, 8, 0x0100}}, true, false, false, false, true},
};
const DSPOPCTemplate cw =
const DSPOPCTemplate cw =
{"CW", 0x0000, 0x0000, nop, NULL, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, false, false, false, false, false};
// extended opcodes
@@ -556,7 +556,7 @@ void InitInstructionTable()
if (opTable[i] == &cw)
opTable[i] = &opcode;
else
ERROR_LOG(DSPLLE, "opcode table place %d already in use for %s", i, opcode.name);
ERROR_LOG(DSPLLE, "opcode table place %d already in use for %s", i, opcode.name);
}
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ enum partype_t
P_ADDR_D = 0x0006,
P_REG = 0x8000,
P_REG04 = P_REG | 0x0400, // IX
P_REG08 = P_REG | 0x0800,
P_REG08 = P_REG | 0x0800,
P_REG18 = P_REG | 0x1800,
P_REGM18 = P_REG | 0x1810, // used in multiply instructions
P_REG19 = P_REG | 0x1900,
+20 -20
View File
@@ -119,7 +119,7 @@ void cmp(const UDSPInstruction opc)
s64 acc0 = dsp_get_long_acc(0);
s64 acc1 = dsp_get_long_acc(1);
s64 res = dsp_convert_long_acc(acc0 - acc1);
Update_SR_Register64(res, isCarry2(acc0, res), isOverflow(acc0, -acc1, res)); // CF -> influence on ABS/0xa100
zeroWriteBackLog();
}
@@ -139,7 +139,7 @@ void cmpar(const UDSPInstruction opc)
s64 rr = (s16)g_dsp.r.ax[rreg-DSP_REG_AXH0].h;
rr <<= 16;
s64 res = dsp_convert_long_acc(sr - rr);
Update_SR_Register64(res, isCarry2(sr, res), isOverflow(sr, -rr, res));
zeroWriteBackLog();
}
@@ -147,7 +147,7 @@ void cmpar(const UDSPInstruction opc)
// CMPI $amD, #I
// 0000 001r 1000 0000
// iiii iiii iiii iiii
// Compares mid accumulator $acD.hm ($amD) with sign extended immediate value I.
// Compares mid accumulator $acD.hm ($amD) with sign extended immediate value I.
// Although flags are being set regarding whole accumulator register.
//
// flags out: x-xx xxxx
@@ -175,7 +175,7 @@ void cmpis(const UDSPInstruction opc)
s64 acc = dsp_get_long_acc(areg);
s64 val = (s8)opc;
val <<= 16;
val <<= 16;
s64 res = dsp_convert_long_acc(acc - val);
Update_SR_Register64(res, isCarry2(acc, res), isOverflow(acc, -val, res));
@@ -477,7 +477,7 @@ void addaxl(const UDSPInstruction opc)
Update_SR_Register64((s64)res, isCarry(acc, res), isOverflow((s64)acc, (s64)acx, (s64)res));
}
// ADDI $amR, #I
// ADDI $amR, #I
// 0000 001r 0000 0000
// iiii iiii iiii iiii
// Adds immediate (16-bit sign extended) to mid accumulator $acD.hm.
@@ -530,7 +530,7 @@ void incm(const UDSPInstruction opc)
s64 res = acc + sub;
zeroWriteBackLog();
dsp_set_long_acc(dreg, res);
res = dsp_get_long_acc(dreg);
Update_SR_Register64(res, isCarry(acc, res), isOverflow(acc, sub, res));
@@ -546,7 +546,7 @@ void inc(const UDSPInstruction opc)
u8 dreg = (opc >> 8) & 0x1;
s64 acc = dsp_get_long_acc(dreg);
s64 res = acc + 1;
s64 res = acc + 1;
zeroWriteBackLog();
@@ -615,7 +615,7 @@ void subax(const UDSPInstruction opc)
// SUB $acD, $ac(1-D)
// 0101 110d xxxx xxxx
// Subtracts accumulator $ac(1-D) from accumulator register $acD.
// Subtracts accumulator $ac(1-D) from accumulator register $acD.
//
// flags out: x-xx xxxx
void sub(const UDSPInstruction opc)
@@ -667,9 +667,9 @@ void decm(const UDSPInstruction opc)
s64 res = acc - sub;
zeroWriteBackLog();
dsp_set_long_acc(dreg, res);
res = dsp_get_long_acc(dreg);
res = dsp_get_long_acc(dreg);
Update_SR_Register64(res, isCarry2(acc, res), isOverflow(acc, -sub, res));
}
@@ -702,7 +702,7 @@ void dec(const UDSPInstruction opc)
void neg(const UDSPInstruction opc)
{
u8 dreg = (opc >> 8) & 0x1;
s64 acc = dsp_get_long_acc(dreg);
acc = 0 - acc;
@@ -713,7 +713,7 @@ void neg(const UDSPInstruction opc)
}
// ABS $acD
// 1010 d001 xxxx xxxx
// 1010 d001 xxxx xxxx
// absolute value of $acD
//
// flags out: --xx xx00
@@ -725,7 +725,7 @@ void abs(const UDSPInstruction opc)
if (acc < 0)
acc = 0 - acc;
zeroWriteBackLog();
dsp_set_long_acc(dreg, acc);
@@ -770,7 +770,7 @@ void movr(const UDSPInstruction opc)
// MOVAX $acD, $axS
// 0110 10sd xxxx xxxx
// Moves secondary accumulator $axS to accumulator $axD.
// Moves secondary accumulator $axS to accumulator $axD.
//
// flags out: --xx xx00
void movax(const UDSPInstruction opc)
@@ -833,7 +833,7 @@ void lsr16(const UDSPInstruction opc)
u64 acc = dsp_get_long_acc(areg);
acc &= 0x000000FFFFFFFFFFULL; // Lop off the extraneous sign extension our 64-bit fake accum causes
acc >>= 16;
acc >>= 16;
zeroWriteBackLog();
@@ -864,10 +864,10 @@ void asr16(const UDSPInstruction opc)
// Logically shifts left accumulator $acR by number specified by value I.
//
// flags out: --xx xx00
void lsl(const UDSPInstruction opc)
void lsl(const UDSPInstruction opc)
{
u8 rreg = (opc >> 8) & 0x01;
u16 shift = opc & 0x3f;
u16 shift = opc & 0x3f;
u64 acc = dsp_get_long_acc(rreg);
acc <<= shift;
@@ -895,7 +895,7 @@ void lsr(const UDSPInstruction opc)
shift = 0x40 - (opc & 0x3f);
acc >>= shift;
dsp_set_long_acc(rreg, (s64)acc);
Update_SR_Register64(dsp_get_long_acc(rreg));
}
@@ -912,7 +912,7 @@ void asl(const UDSPInstruction opc)
u64 acc = dsp_get_long_acc(rreg);
acc <<= shift;
dsp_set_long_acc(rreg, acc);
Update_SR_Register64(dsp_get_long_acc(rreg));
}
@@ -949,7 +949,7 @@ void asr(const UDSPInstruction opc)
// flags out: --xx xx00
void lsrn(const UDSPInstruction opc)
{
s16 shift;
s16 shift;
u16 accm = (u16)dsp_get_acc_m(1);
u64 acc = dsp_get_long_acc(0);
acc &= 0x000000FFFFFFFFFFULL;
+6 -6
View File
@@ -35,8 +35,8 @@ void call(const UDSPInstruction opc)
// Generic callr implementation
// CALLRcc $R
// 0001 0111 rrr1 cccc
// Call function if condition cc has been met. Push program counter of
// instruction following "call" to call stack $st0. Set program counter to
// Call function if condition cc has been met. Push program counter of
// instruction following "call" to call stack $st0. Set program counter to
// register $R.
void callr(const UDSPInstruction opc)
{
@@ -87,7 +87,7 @@ void jmprcc(const UDSPInstruction opc)
{
u8 reg = (opc >> 5) & 0x7;
g_dsp.pc = dsp_op_read_reg(reg);
}
}
}
// Generic ret implementation
@@ -116,7 +116,7 @@ void rti(const UDSPInstruction opc)
}
// HALT
// 0000 0000 0020 0001
// 0000 0000 0020 0001
// Stops execution of DSP code. Sets bit DSP_CR_HALT in register DREG_CR.
void halt(const UDSPInstruction opc)
{
@@ -133,7 +133,7 @@ void halt(const UDSPInstruction opc)
// continues at next opcode.
void HandleLoop()
{
// Handle looping hardware.
// Handle looping hardware.
const u16 rCallAddress = g_dsp.r.st[0];
const u16 rLoopAddress = g_dsp.r.st[2];
u16& rLoopCounter = g_dsp.r.st[3];
@@ -254,7 +254,7 @@ void bloopi(const UDSPInstruction opc)
u16 cnt = opc & 0xff;
u16 loop_pc = dsp_fetch_code();
if (cnt)
if (cnt)
{
dsp_reg_store_stack(0, g_dsp.pc);
dsp_reg_store_stack(2, loop_pc);
+11 -11
View File
@@ -13,15 +13,15 @@ namespace DSPInterpreter {
// SRS @M, $(0x18+S)
// 0010 1sss mmmm mmmm
// Move value from register $(0x18+D) to data memory pointed by address
// CR[0-7] | M. That is, the upper 8 bits of the address are the
// bottom 8 bits from CR, and the lower 8 bits are from the 8-bit immediate.
// Move value from register $(0x18+D) to data memory pointed by address
// CR[0-7] | M. That is, the upper 8 bits of the address are the
// bottom 8 bits from CR, and the lower 8 bits are from the 8-bit immediate.
// Note: pc+=2 in duddie's doc seems wrong
void srs(const UDSPInstruction opc)
{
u8 reg = ((opc >> 8) & 0x7) + 0x18;
u16 addr = (g_dsp.r.cr << 8) | (opc & 0xFF);
if (reg >= DSP_REG_ACM0)
dsp_dmem_write(addr, dsp_op_read_reg_and_saturate(reg-DSP_REG_ACM0));
else
@@ -97,7 +97,7 @@ void lrr(const UDSPInstruction opc)
// LRRD $D, @$S
// 0001 1000 1ssd dddd
// Move value from data memory pointed by addressing register $S toregister $D.
// Decrement register $S.
// Decrement register $S.
void lrrd(const UDSPInstruction opc)
{
u8 sreg = (opc >> 5) & 0x3;
@@ -112,7 +112,7 @@ void lrrd(const UDSPInstruction opc)
// LRRI $D, @$S
// 0001 1001 0ssd dddd
// Move value from data memory pointed by addressing register $S to register $D.
// Increment register $S.
// Increment register $S.
void lrri(const UDSPInstruction opc)
{
u8 sreg = (opc >> 5) & 0x3;
@@ -127,7 +127,7 @@ void lrri(const UDSPInstruction opc)
// LRRN $D, @$S
// 0001 1001 1ssd dddd
// Move value from data memory pointed by addressing register $S to register $D.
// Add indexing register $(0x4+S) to register $S.
// Add indexing register $(0x4+S) to register $S.
void lrrn(const UDSPInstruction opc)
{
u8 sreg = (opc >> 5) & 0x3;
@@ -141,8 +141,8 @@ void lrrn(const UDSPInstruction opc)
// SRR @$D, $S
// 0001 1010 0dds ssss
// Store value from source register $S to a memory location pointed by
// addressing register $D.
// Store value from source register $S to a memory location pointed by
// addressing register $D.
void srr(const UDSPInstruction opc)
{
u8 dreg = (opc >> 5) & 0x3;
@@ -157,7 +157,7 @@ void srr(const UDSPInstruction opc)
// SRRD @$D, $S
// 0001 1010 1dds ssss
// Store value from source register $S to a memory location pointed by
// addressing register $D. Decrement register $D.
// addressing register $D. Decrement register $D.
void srrd(const UDSPInstruction opc)
{
u8 dreg = (opc >> 5) & 0x3;
@@ -174,7 +174,7 @@ void srrd(const UDSPInstruction opc)
// SRRI @$D, $S
// 0001 1011 0dds ssss
// Store value from source register $S to a memory location pointed by
// addressing register $D. Increment register $D.
// addressing register $D. Increment register $D.
void srri(const UDSPInstruction opc)
{
u8 dreg = (opc >> 5) & 0x3;
+5 -5
View File
@@ -24,14 +24,14 @@ void mrr(const UDSPInstruction opc)
dsp_op_write_reg(dreg, dsp_op_read_reg_and_saturate(sreg-DSP_REG_ACM0));
else
dsp_op_write_reg(dreg, dsp_op_read_reg(sreg));
dsp_conditional_extend_accum(dreg);
}
// LRI $D, #I
// 0000 0000 100d dddd
// iiii iiii iiii iiii
// Load immediate value I to register $D.
// Load immediate value I to register $D.
//
// DSPSpy discovery: This, and possibly other instructions that load a
// register, has a different behaviour in S40 mode if loaded to AC0.M: The
@@ -47,7 +47,7 @@ void lri(const UDSPInstruction opc)
// LRIS $(0x18+D), #I
// 0000 1ddd iiii iiii
// Load immediate value I (8-bit sign extended) to accumulator register.
// Load immediate value I (8-bit sign extended) to accumulator register.
void lris(const UDSPInstruction opc)
{
u8 reg = ((opc >> 8) & 0x7) + DSP_REG_AXL0;
@@ -86,7 +86,7 @@ void iar(const UDSPInstruction opc)
g_dsp.r.ar[opc & 0x3] = dsp_increment_addr_reg(opc & 0x3);
}
// SUBARN $arD
// SUBARN $arD
// 0000 0000 0000 11dd
// Subtract indexing register $ixD from an addressing register $arD.
// used only in IPL-NTSC ucode
@@ -129,7 +129,7 @@ void sbset(const UDSPInstruction opc)
g_dsp.r.sr |= (1 << bit);
}
// This is a bunch of flag setters, flipping bits in SR.
// This is a bunch of flag setters, flipping bits in SR.
void srbith(const UDSPInstruction opc)
{
zeroWriteBackLog();
+15 -15
View File
@@ -32,7 +32,7 @@ inline s64 dsp_get_multiply_prod(u16 a, u16 b, u8 sign)
return prod;
}
inline s64 dsp_multiply(u16 a, u16 b, u8 sign = 0)
{
s64 prod = dsp_get_multiply_prod(a, b, sign);
@@ -120,7 +120,7 @@ void movp(const UDSPInstruction opc)
}
// MOVNP $acD
// 0111 111d xxxx xxxx
// 0111 111d xxxx xxxx
// Moves negative of multiply product from $prod register to accumulator
// $acD register.
//
@@ -160,7 +160,7 @@ void movpz(const UDSPInstruction opc)
// Adds secondary accumulator $axS to product register and stores result
// in accumulator register. Low 16-bits of $acD ($acD.l) are set (round) to 0.
//
// TODO: ugly code and still small error here (+/- 1 in .m - randomly)
// TODO: ugly code and still small error here (+/- 1 in .m - randomly)
// flags out: --xx xx0x
void addpaxz(const UDSPInstruction opc)
{
@@ -176,20 +176,20 @@ void addpaxz(const UDSPInstruction opc)
dsp_set_long_acc(dreg, res);
res = dsp_get_long_acc(dreg);
Update_SR_Register64(res, isCarry(oldprod, res), false);
Update_SR_Register64(res, isCarry(oldprod, res), false);
}
//----
// MULAXH
// 1000 0011 xxxx xxxx
// Multiply $ax0.h by $ax0.h
// Multiply $ax0.h by $ax0.h
void mulaxh(const UDSPInstruction opc)
{
s64 prod = dsp_multiply(dsp_get_ax_h(0), dsp_get_ax_h(0));
zeroWriteBackLog();
dsp_set_long_prod(prod);
}
@@ -206,7 +206,7 @@ void mul(const UDSPInstruction opc)
u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply(axh, axl);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@@ -277,7 +277,7 @@ void mulmvz(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);
@@ -418,7 +418,7 @@ void mulcac(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);
@@ -444,7 +444,7 @@ void mulcmv(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);
@@ -457,7 +457,7 @@ void mulcmv(const UDSPInstruction opc)
// (fixed possible bug in duddie's description, s->t)
// Multiply mid part of accumulator register $acS.m by high part $axT.h of
// secondary accumulator $axT (treat them both as signed). Move product
// register before multiplication to accumulator $acR, set (round) low part of
// register before multiplication to accumulator $acR, set (round) low part of
// accumulator $acR.l to zero.
//
// flags out: --xx xx0x
@@ -494,7 +494,7 @@ void maddx(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_add(val1, val2);
zeroWriteBackLog();
dsp_set_long_prod(prod);
@@ -547,7 +547,7 @@ void msubc(const UDSPInstruction opc)
{
u8 treg = (opc >> 8) & 0x1;
u8 sreg = (opc >> 9) & 0x1;
u16 accm = dsp_get_acc_m(sreg);
u16 axh = dsp_get_ax_h(treg);
s64 prod = dsp_multiply_sub(accm, axh);
@@ -565,7 +565,7 @@ void msubc(const UDSPInstruction opc)
void madd(const UDSPInstruction opc)
{
u8 sreg = (opc >> 8) & 0x1;
u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply_add(axl, axh);
@@ -583,7 +583,7 @@ void madd(const UDSPInstruction opc)
void msub(const UDSPInstruction opc)
{
u8 sreg = (opc >> 8) & 0x1;
u16 axl = dsp_get_ax_l(sreg);
u16 axh = dsp_get_ax_h(sreg);
s64 prod = dsp_multiply_sub(axl, axh);
@@ -77,7 +77,7 @@ void DSPEmitter::andcf(const UDSPInstruction opc)
// u16 val = dsp_get_acc_m(reg);
get_acc_m(reg);
// Update_SR_LZ(((val & imm) == imm) ? true : false);
// if ((val & imm) == imm)
// if ((val & imm) == imm)
// g_dsp.r.sr |= SR_LOGIC_ZERO;
// else
// g_dsp.r.sr &= ~SR_LOGIC_ZERO;
@@ -117,7 +117,7 @@ void DSPEmitter::andf(const UDSPInstruction opc)
// u16 val = dsp_get_acc_m(reg);
get_acc_m(reg);
// Update_SR_LZ(((val & imm) == 0) ? true : false);
// if ((val & imm) == 0)
// if ((val & imm) == 0)
// g_dsp.r.sr |= SR_LOGIC_ZERO;
// else
// g_dsp.r.sr &= ~SR_LOGIC_ZERO;
@@ -250,7 +250,7 @@ void DSPEmitter::cmpar(const UDSPInstruction opc)
// CMPI $amD, #I
// 0000 001r 1000 0000
// iiii iiii iiii iiii
// Compares mid accumulator $acD.hm ($amD) with sign extended immediate value I.
// Compares mid accumulator $acD.hm ($amD) with sign extended immediate value I.
// Although flags are being set regarding whole accumulator register.
//
// flags out: x-xx xxxx
@@ -791,7 +791,7 @@ void DSPEmitter::addaxl(const UDSPInstruction opc)
#endif
}
// ADDI $amR, #I
// ADDI $amR, #I
// 0000 001r 0000 0000
// iiii iiii iiii iiii
// Adds immediate (16-bit sign extended) to mid accumulator $acD.hm.
@@ -1033,7 +1033,7 @@ void DSPEmitter::subax(const UDSPInstruction opc)
// SUB $acD, $ac(1-D)
// 0101 110d xxxx xxxx
// Subtracts accumulator $ac(1-D) from accumulator register $acD.
// Subtracts accumulator $ac(1-D) from accumulator register $acD.
//
// flags out: x-xx xxxx
void DSPEmitter::sub(const UDSPInstruction opc)
@@ -1125,7 +1125,7 @@ void DSPEmitter::decm(const UDSPInstruction opc)
// s64 res = acc - sub;
SUB(64, R(RAX), Imm32((u32)subtract));
// dsp_set_long_acc(dreg, res);
// res = dsp_get_long_acc(dreg);
// res = dsp_get_long_acc(dreg);
// Update_SR_Register64(res, isCarry2(acc, res), isOverflow(acc, -subtract, res));
if (FlagsNeeded())
{
@@ -1155,7 +1155,7 @@ void DSPEmitter::dec(const UDSPInstruction opc)
u8 dreg = (opc >> 8) & 0x01;
X64Reg tmp1;
gpr.getFreeXReg(tmp1);
// s64 acc = dsp_get_long_acc(dreg);
// s64 acc = dsp_get_long_acc(dreg);
get_long_acc(dreg, tmp1);
MOV(64, R(RAX), R(tmp1));
// s64 res = acc - 1;
@@ -1208,7 +1208,7 @@ void DSPEmitter::neg(const UDSPInstruction opc)
}
// ABS $acD
// 1010 d001 xxxx xxxx
// 1010 d001 xxxx xxxx
// absolute value of $acD
//
// flags out: --xx xx00
@@ -1217,7 +1217,7 @@ void DSPEmitter::abs(const UDSPInstruction opc)
#ifdef _M_X64
u8 dreg = (opc >> 11) & 0x1;
// s64 acc = dsp_get_long_acc(dreg);
// s64 acc = dsp_get_long_acc(dreg);
get_long_acc(dreg);
// if (acc < 0) acc = 0 - acc;
CMP(64, R(RAX), Imm8(0));
@@ -1267,7 +1267,7 @@ void DSPEmitter::movr(const UDSPInstruction opc)
// MOVAX $acD, $axS
// 0110 10sd xxxx xxxx
// Moves secondary accumulator $axS to accumulator $axD.
// Moves secondary accumulator $axS to accumulator $axD.
//
// flags out: --xx xx00
void DSPEmitter::movax(const UDSPInstruction opc)
@@ -1353,7 +1353,7 @@ void DSPEmitter::lsr16(const UDSPInstruction opc)
// u64 acc = dsp_get_long_acc(areg);
get_long_acc(areg);
// acc &= 0x000000FFFFFFFFFFULL; // Lop off the extraneous sign extension our 64-bit fake accum causes
// acc >>= 16;
// acc >>= 16;
SHR(64, R(RAX), Imm8(16));
AND(64, R(RAX), Imm32(0xffffff));
// dsp_set_long_acc(areg, (s64)acc);
@@ -1399,11 +1399,11 @@ void DSPEmitter::asr16(const UDSPInstruction opc)
// Logically shifts left accumulator $acR by number specified by value I.
//
// flags out: --xx xx00
void DSPEmitter::lsl(const UDSPInstruction opc)
void DSPEmitter::lsl(const UDSPInstruction opc)
{
#ifdef _M_X64
u8 rreg = (opc >> 8) & 0x01;
u16 shift = opc & 0x3f;
u16 shift = opc & 0x3f;
// u64 acc = dsp_get_long_acc(rreg);
get_long_acc(rreg);
@@ -1448,7 +1448,7 @@ void DSPEmitter::lsr(const UDSPInstruction opc)
// acc >>= shift;
SHR(64, R(RAX), Imm8(shift + 24));
}
// dsp_set_long_acc(rreg, (s64)acc);
set_long_acc(rreg);
// Update_SR_Register64(dsp_get_long_acc(rreg));
@@ -1531,7 +1531,7 @@ void DSPEmitter::asr(const UDSPInstruction opc)
void DSPEmitter::lsrn(const UDSPInstruction opc)
{
#ifdef _M_X64
// s16 shift;
// s16 shift;
// u16 accm = (u16)dsp_get_acc_m(1);
get_acc_m(1);
// u64 acc = dsp_get_long_acc(0);
@@ -38,11 +38,11 @@ static void ReJitConditional(const UDSPInstruction opc, DSPEmitter& emitter)
emitter.TEST(16, R(EAX), Imm16(0x10));
break;
case 0x4: // NZ - Not Zero
case 0x5: // Z - Zero
case 0x5: // Z - Zero
emitter.TEST(16, R(EAX), Imm16(SR_ARITH_ZERO));
break;
case 0x6: // NC - Not carry
case 0x7: // C - Carry
case 0x7: // C - Carry
emitter.TEST(16, R(EAX), Imm16(SR_CARRY));
break;
case 0x8: // ? - Not over s32
@@ -200,8 +200,8 @@ void r_callr(const UDSPInstruction opc, DSPEmitter& emitter)
// Generic callr implementation
// CALLRcc $R
// 0001 0111 rrr1 cccc
// Call function if condition cc has been met. Push program counter of
// instruction following "call" to call stack $st0. Set program counter to
// Call function if condition cc has been met. Push program counter of
// instruction following "call" to call stack $st0. Set program counter to
// register $R.
// NOTE: Cannot use Default(opc) here because of the need to write branch exit
void DSPEmitter::callr(const UDSPInstruction opc)
@@ -261,7 +261,7 @@ void DSPEmitter::rti(const UDSPInstruction opc)
}
// HALT
// 0000 0000 0020 0001
// 0000 0000 0020 0001
// Stops execution of DSP code. Sets bit DSP_CR_HALT in register DREG_CR.
void DSPEmitter::halt(const UDSPInstruction opc)
{
@@ -429,7 +429,7 @@ void DSPEmitter::bloopi(const UDSPInstruction opc)
// u16 loop_pc = dsp_fetch_code();
u16 loop_pc = dsp_imem_read(compilePC + 1);
if (cnt)
if (cnt)
{
MOV(16, R(RDX), Imm16(compilePC + 2));
dsp_reg_store_stack(0);
@@ -220,8 +220,8 @@ void DSPEmitter::Update_SR_Register16_OverS32(Gen::X64Reg val)
//void DSPEmitter::Update_SR_LZ(bool value) {
// if (value == true)
// g_dsp.r[DSP_REG_SR] |= SR_LOGIC_ZERO;
// if (value == true)
// g_dsp.r[DSP_REG_SR] |= SR_LOGIC_ZERO;
// else
// g_dsp.r[DSP_REG_SR] &= ~SR_LOGIC_ZERO;
//}
@@ -276,11 +276,11 @@ void DSPEmitter::Update_SR_Register16_OverS32(Gen::X64Reg val)
// return isLess() || isZero();
// case 0x4: // NZ - Not Zero
// return !isZero();
// case 0x5: // Z - Zero
// case 0x5: // Z - Zero
// return isZero();
// case 0x6: // NC - Not carry
// return !isCarry();
// case 0x7: // C - Carry
// case 0x7: // C - Carry
// return isCarry();
// case 0x8: // ? - Not over s32
// return !isOverS32();
@@ -44,8 +44,8 @@ void DSPEmitter::ir(const UDSPInstruction opc)
// Add corresponding indexing register $ixR to addressing register $arR.
void DSPEmitter::nr(const UDSPInstruction opc)
{
u8 reg = opc & 0x3;
u8 reg = opc & 0x3;
increase_addr_reg(reg, reg);
}
@@ -106,7 +106,7 @@ void DSPEmitter::sn(const UDSPInstruction opc)
// L $axD.D, @$arS
// xxxx xxxx 01dd d0ss
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Post increment register $arS.
void DSPEmitter::l(const UDSPInstruction opc)
{
@@ -130,7 +130,7 @@ void DSPEmitter::l(const UDSPInstruction opc)
// LN $axD.D, @$arS
// xxxx xxxx 01dd d0ss
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Load $axD.D/$acD.D with value from memory pointed by register $arS.
// Add indexing register $ixS to register $arS.
void DSPEmitter::ln(const UDSPInstruction opc)
{
@@ -174,7 +174,7 @@ void DSPEmitter::ls(const UDSPInstruction opc)
pushExtValueFromMem(dreg, DSP_REG_AR0);
increment_addr_reg(DSP_REG_AR3);
increment_addr_reg(DSP_REG_AR0);
increment_addr_reg(DSP_REG_AR0);
}
@@ -199,7 +199,7 @@ void DSPEmitter::lsn(const UDSPInstruction opc)
gpr.putXReg(tmp1);
pushExtValueFromMem(dreg, DSP_REG_AR0);
increment_addr_reg(DSP_REG_AR3);
increase_addr_reg(DSP_REG_AR0, DSP_REG_AR0);
}
@@ -12,9 +12,9 @@ using namespace Gen;
// SRS @M, $(0x18+S)
// 0010 1sss mmmm mmmm
// Move value from register $(0x18+D) to data memory pointed by address
// CR[0-7] | M. That is, the upper 8 bits of the address are the
// bottom 8 bits from CR, and the lower 8 bits are from the 8-bit immediate.
// Move value from register $(0x18+D) to data memory pointed by address
// CR[0-7] | M. That is, the upper 8 bits of the address are the
// bottom 8 bits from CR, and the lower 8 bits are from the 8-bit immediate.
// Note: pc+=2 in duddie's doc seems wrong
void DSPEmitter::srs(const UDSPInstruction opc)
{
@@ -130,7 +130,7 @@ void DSPEmitter::lrr(const UDSPInstruction opc)
// LRRD $D, @$S
// 0001 1000 1ssd dddd
// Move value from data memory pointed by addressing register $S toregister $D.
// Decrement register $S.
// Decrement register $S.
void DSPEmitter::lrrd(const UDSPInstruction opc)
{
u8 sreg = (opc >> 5) & 0x3;
@@ -152,7 +152,7 @@ void DSPEmitter::lrrd(const UDSPInstruction opc)
// LRRI $D, @$S
// 0001 1001 0ssd dddd
// Move value from data memory pointed by addressing register $S to register $D.
// Increment register $S.
// Increment register $S.
void DSPEmitter::lrri(const UDSPInstruction opc)
{
u8 sreg = (opc >> 5) & 0x3;
@@ -174,7 +174,7 @@ void DSPEmitter::lrri(const UDSPInstruction opc)
// LRRN $D, @$S
// 0001 1001 1ssd dddd
// Move value from data memory pointed by addressing register $S to register $D.
// Add indexing register $(0x4+S) to register $S.
// Add indexing register $(0x4+S) to register $S.
void DSPEmitter::lrrn(const UDSPInstruction opc)
{
u8 sreg = (opc >> 5) & 0x3;
@@ -195,8 +195,8 @@ void DSPEmitter::lrrn(const UDSPInstruction opc)
// SRR @$D, $S
// 0001 1010 0dds ssss
// Store value from source register $S to a memory location pointed by
// addressing register $D.
// Store value from source register $S to a memory location pointed by
// addressing register $D.
void DSPEmitter::srr(const UDSPInstruction opc)
{
u8 dreg = (opc >> 5) & 0x3;
@@ -215,7 +215,7 @@ void DSPEmitter::srr(const UDSPInstruction opc)
// SRRD @$D, $S
// 0001 1010 1dds ssss
// Store value from source register $S to a memory location pointed by
// addressing register $D. Decrement register $D.
// addressing register $D. Decrement register $D.
void DSPEmitter::srrd(const UDSPInstruction opc)
{
u8 dreg = (opc >> 5) & 0x3;
@@ -236,7 +236,7 @@ void DSPEmitter::srrd(const UDSPInstruction opc)
// SRRI @$D, $S
// 0001 1011 0dds ssss
// Store value from source register $S to a memory location pointed by
// addressing register $D. Increment register $D.
// addressing register $D. Increment register $D.
void DSPEmitter::srri(const UDSPInstruction opc)
{
u8 dreg = (opc >> 5) & 0x3;
+3 -3
View File
@@ -80,7 +80,7 @@ void DSPEmitter::iar(const UDSPInstruction opc)
increment_addr_reg(opc & 0x3);
}
// SUBARN $arD
// SUBARN $arD
// 0000 0000 0000 11dd
// Subtract indexing register $ixD from an addressing register $arD.
// used only in IPL-NTSC ucode
@@ -110,7 +110,7 @@ void DSPEmitter::addarn(const UDSPInstruction opc)
void DSPEmitter::setCompileSR(u16 bit)
{
// g_dsp.r[DSP_REG_SR] |= bit
OpArg sr_reg;
gpr.getReg(DSP_REG_SR,sr_reg);
@@ -122,7 +122,7 @@ void DSPEmitter::setCompileSR(u16 bit)
void DSPEmitter::clrCompileSR(u16 bit)
{
// g_dsp.r[DSP_REG_SR] &= bit
OpArg sr_reg;
gpr.getReg(DSP_REG_SR,sr_reg);
@@ -209,7 +209,7 @@ void DSPEmitter::movp(const UDSPInstruction opc)
}
// MOVNP $acD
// 0111 111d xxxx xxxx
// 0111 111d xxxx xxxx
// Moves negative of multiply product from $prod register to accumulator
// $acD register.
@@ -286,7 +286,7 @@ void DSPEmitter::addpaxz(const UDSPInstruction opc)
// s64 oldprod = dsp_get_long_prod();
// dsp_set_long_acc(dreg, res);
// res = dsp_get_long_acc(dreg);
// Update_SR_Register64(res, isCarry(oldprod, res), false);
// Update_SR_Register64(res, isCarry(oldprod, res), false);
if (FlagsNeeded())
{
get_long_prod(RDX);
@@ -308,7 +308,7 @@ void DSPEmitter::addpaxz(const UDSPInstruction opc)
// MULAXH
// 1000 0011 xxxx xxxx
// Multiply $ax0.h by $ax0.h
// Multiply $ax0.h by $ax0.h
void DSPEmitter::mulaxh(const UDSPInstruction opc)
{
#ifdef _M_X64
@@ -702,7 +702,7 @@ void DSPEmitter::mulcmv(const UDSPInstruction opc)
// (fixed possible bug in duddie's description, s->t)
// Multiply mid part of accumulator register $acS.m by high part $axT.h of
// secondary accumulator $axT (treat them both as signed). Move product
// register before multiplication to accumulator $acR, set (round) low part of
// register before multiplication to accumulator $acR, set (round) low part of
// accumulator $acR.l to zero.
// flags out: --xx xx0x
@@ -613,7 +613,7 @@ void DSPJitRegCache::movToHostReg(int reg, bool load)
tmp = regs[reg].host_reg;
else
tmp = findSpillFreeXReg();
if (tmp == INVALID_REG)
return;
@@ -48,7 +48,7 @@ private:
int guest_reg; //including DSPJitRegSpecial
bool pushed;
};
struct DynamicReg
{
Gen::OpArg loc;
+1 -1
View File
@@ -27,7 +27,7 @@ void LabelMap::RegisterDefaults()
void LabelMap::RegisterLabel(const std::string &label, u16 lval, LabelType type)
{
u16 old_value;
if (GetLabelValue(label, &old_value) && old_value != lval)
if (GetLabelValue(label, &old_value) && old_value != lval)
{
printf("WARNING: Redefined label %s to %04x - old value %04x\n",
label.c_str(), lval, old_value);
+9 -9
View File
@@ -78,7 +78,7 @@ static const char *err_string[] =
"Number out of range"
};
DSPAssembler::DSPAssembler(const AssemblerSettings &settings) :
DSPAssembler::DSPAssembler(const AssemblerSettings &settings) :
gdg_buffer(NULL),
m_cur_addr(0),
m_cur_pass(0),
@@ -150,7 +150,7 @@ void DSPAssembler::ShowError(err_t err_code, const char *extra_info)
if (m_current_param == 0)
buf_ptr += sprintf(buf_ptr, "ERROR: %s Line: %d : %s\n", err_string[err_code], code_line, extra_info);
else
else
buf_ptr += sprintf(buf_ptr, "ERROR: %s Line: %d Param: %d : %s\n",
err_string[err_code], code_line, m_current_param, extra_info);
last_error_str = error_buffer;
@@ -525,7 +525,7 @@ bool DSPAssembler::VerifyParams(const opc_t *opc, param_t *par, int count, bool
// modified by Hermes: test the register range
switch ((unsigned)opc->params[i].type)
{
{
case P_REG18:
case P_REG19:
case P_REG1A:
@@ -775,27 +775,27 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
fsrc.getline(line, LINEBUF_SIZE);
if(fsrc.fail())
break;
cur_line = line;
//printf("A: %s\n", line);
code_line++;
param_t params[10] = {{0, P_NONE, NULL}};
param_t params_ext[10] = {{0, P_NONE, NULL}};
bool upper = true;
for (int i = 0; i < LINEBUF_SIZE; i++)
{
char c = line[i];
// This stuff handles /**/ and // comments.
// modified by Hermes : added // and /* */ for long commentaries
// modified by Hermes : added // and /* */ for long commentaries
if (c == '/')
{
if (i < 1023)
{
if (line[i+1] == '/')
c = 0x00;
else if (line[i+1] == '*')
else if (line[i+1] == '*')
{
// toggle comment mode.
disable_text = !disable_text;
@@ -916,7 +916,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
{
char *tmpstr;
u32 thisCodeline = code_line;
if (include_dir.size())
{
tmpstr = (char *)malloc(include_dir.size() + strlen(params[0].str) + 2);
@@ -927,7 +927,7 @@ bool DSPAssembler::AssembleFile(const char *fname, int pass)
tmpstr = (char *)malloc(strlen(params[0].str) + 1);
strcpy(tmpstr, params[0].str);
}
AssembleFile(tmpstr, pass);
code_line = thisCodeline;
+1 -1
View File
@@ -119,7 +119,7 @@ private:
u32 m_cur_addr;
int m_totalSize;
u8 m_cur_pass;
LabelMap labels;
u32 code_line;
+1 -1
View File
@@ -7,7 +7,7 @@
#include "HW/DSPLLE/DSPLLE.h"
#include "HW/DSPHLE/DSPHLE.h"
DSPEmulator *CreateDSPEmulator(bool HLE)
DSPEmulator *CreateDSPEmulator(bool HLE)
{
if (HLE)
{
@@ -35,7 +35,7 @@ void AddAutoBreakpoints()
// Returns callstack "formatted for debugging" - meaning that it
// includes LR as the last item, and all items are the last step,
// instead of "pointing ahead"
bool GetCallstack(std::vector<CallstackEntry> &output)
bool GetCallstack(std::vector<CallstackEntry> &output)
{
if (Core::GetState() == Core::CORE_UNINITIALIZED)
return false;
@@ -90,9 +90,9 @@ void PrintCallstack()
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
printf("== STACK TRACE - SP = %08x ==", PowerPC::ppcState.gpr[1]);
if (LR == 0) {
printf(" LR = 0 - this is bad");
printf(" LR = 0 - this is bad");
}
int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
@@ -117,16 +117,16 @@ void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
{
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==",
GENERIC_LOG(type, level, "== STACK TRACE - SP = %08x ==",
PowerPC::ppcState.gpr[1]);
if (LR == 0) {
GENERIC_LOG(type, level, " LR = 0 - this is bad");
GENERIC_LOG(type, level, " LR = 0 - this is bad");
}
int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
{
GENERIC_LOG(type, level, " * %s [ LR = %08x ]",
GENERIC_LOG(type, level, " * %s [ LR = %08x ]",
g_symbolDB.GetDescription(LR), LR);
count++;
}
@@ -145,7 +145,7 @@ void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
{
GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title);
GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title);
for (u32 j = 0; j < _Size;)
{
std::string Temp;
@@ -13,7 +13,7 @@
namespace Dolphin_Debugger
{
struct CallstackEntry
struct CallstackEntry
{
std::string Name;
u32 vAddress;
+3 -3
View File
@@ -37,7 +37,7 @@ CDump::GetNumberOfSteps(void)
return (int)(m_size / STRUCTUR_SIZE);
}
u32
u32
CDump::GetGPR(int _step, int _gpr)
{
u32 offset = _step * STRUCTUR_SIZE;
@@ -48,7 +48,7 @@ CDump::GetGPR(int _step, int _gpr)
return Read32(offset + OFFSET_GPR + (_gpr * 4));
}
u32
u32
CDump::GetPC(int _step)
{
u32 offset = _step * STRUCTUR_SIZE;
@@ -59,7 +59,7 @@ CDump::GetPC(int _step)
return Read32(offset + OFFSET_PC);
}
u32
u32
CDump::Read32(u32 _pos)
{
u32 result = (m_pData[_pos+0] << 24) |
+1 -1
View File
@@ -17,7 +17,7 @@ public:
CDump(const char* _szFilename);
~CDump();
int GetNumberOfSteps();
u32 GetGPR(int _step, int _gpr);
u32 GetPC(int _step);
@@ -15,7 +15,7 @@
#include "../PowerPC/JitCommon/JitBase.h"
#include "../PowerPC/PPCSymbolDB.h"
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
// Memory::ReadUnchecked_U32 seemed to crash on shutdown
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return;
@@ -93,7 +93,7 @@ bool PPCDebugInterface::isAlive()
return Core::GetState() != Core::CORE_UNINITIALIZED;
}
bool PPCDebugInterface::isBreakpoint(unsigned int address)
bool PPCDebugInterface::isBreakpoint(unsigned int address)
{
return PowerPC::breakpoints.IsAddressBreakPoint(address);
}
@@ -146,7 +146,7 @@ void PPCDebugInterface::toggleMemCheck(unsigned int address)
PowerPC::memchecks.Remove(address);
}
void PPCDebugInterface::insertBLR(unsigned int address, unsigned int value)
void PPCDebugInterface::insertBLR(unsigned int address, unsigned int value)
{
Memory::Write_U32(value, address);
}
@@ -165,7 +165,7 @@ int PPCDebugInterface::getColor(unsigned int address)
if (!Memory::IsRAMAddress(address, true, true))
return 0xeeeeee;
static const int colors[6] =
{
{
0xd0FFFF, // light cyan
0xFFd0d0, // light red
0xd8d8FF, // light blue
@@ -183,22 +183,22 @@ int PPCDebugInterface::getColor(unsigned int address)
// =============
std::string PPCDebugInterface::getDescription(unsigned int address)
std::string PPCDebugInterface::getDescription(unsigned int address)
{
return g_symbolDB.GetDescription(address);
}
unsigned int PPCDebugInterface::getPC()
unsigned int PPCDebugInterface::getPC()
{
return PowerPC::ppcState.pc;
}
void PPCDebugInterface::setPC(unsigned int address)
void PPCDebugInterface::setPC(unsigned int address)
{
PowerPC::ppcState.pc = address;
}
void PPCDebugInterface::showJitResults(unsigned int address)
void PPCDebugInterface::showJitResults(unsigned int address)
{
Host_ShowJitResults(address);
}
@@ -14,7 +14,7 @@
class PPCDebugInterface : public DebugInterface
{
public:
PPCDebugInterface(){}
PPCDebugInterface(){}
virtual void disasm(unsigned int address, char *dest, int max_size);
virtual void getRawMemoryString(int memory, unsigned int address, char *dest, int max_size);
virtual int getInstructionSize(int /*instruction*/) {return 4;}
@@ -124,7 +124,7 @@ void LoadCPReg(u32 subCmd, u32 value, CPMemory &cpMem)
u32 CalculateVertexSize(int vatIndex, const CPMemory &cpMem)
{
u32 vertexSize = 0;
int sizes[21];
CalculateVertexElementSizes(sizes, vatIndex, cpMem);
@@ -145,14 +145,14 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
const u32 tcElements[8] =
{
vtxAttr.g0.Tex0CoordElements, vtxAttr.g1.Tex1CoordElements, vtxAttr.g1.Tex2CoordElements,
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.g0.Tex0CoordFormat, vtxAttr.g1.Tex1CoordFormat, vtxAttr.g1.Tex2CoordFormat,
vtxAttr.g1.Tex3CoordFormat, vtxAttr.g1.Tex4CoordFormat, vtxAttr.g2.Tex5CoordFormat,
vtxAttr.g2.Tex6CoordFormat, vtxAttr.g2.Tex7CoordFormat
};
@@ -171,7 +171,7 @@ void CalculateVertexElementSizes(int sizes[], int vatIndex, const CPMemory &cpMe
// Normals
if (vtxDesc.Normal != NOT_PRESENT)
{
sizes[10] = VertexLoader_Normal::GetSize(vtxDesc.Normal, vtxAttr.g0.NormalFormat, vtxAttr.g0.NormalElements, vtxAttr.g0.NormalIndex3);
sizes[10] = VertexLoader_Normal::GetSize(vtxDesc.Normal, vtxAttr.g0.NormalFormat, vtxAttr.g0.NormalElements, vtxAttr.g0.NormalIndex3);
}
else
{
@@ -99,7 +99,7 @@ bool FifoDataFile::Save(const char *filename)
const FifoFrameInfo &srcFrame = m_Frames[i];
// Write FIFO data
file.Seek(0, SEEK_END);
file.Seek(0, SEEK_END);
u64 dataOffset = file.Tell();
file.WriteBytes(srcFrame.fifoData, srcFrame.fifoDataSize);
@@ -116,7 +116,7 @@ bool FifoDataFile::Save(const char *filename)
// Write frame info
u64 frameOffset = frameListOffset + (i * sizeof(FileFrameInfo));
file.Seek(frameOffset, SEEK_SET);
file.WriteBytes(&dstFrame, sizeof(FileFrameInfo));
file.WriteBytes(&dstFrame, sizeof(FileFrameInfo));
}
if (!file.Close())
@@ -150,7 +150,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
file.Close();
return dataFile;
}
u32 size = std::min((u32)BP_MEM_SIZE, header.bpMemSize);
file.Seek(header.bpMemOffset, SEEK_SET);
file.ReadArray(dataFile->m_BPMem, size);
@@ -230,7 +230,7 @@ u64 FifoDataFile::WriteMemoryUpdates(const std::vector<MemoryUpdate> &memUpdates
file.Seek(0, SEEK_END);
u64 dataOffset = file.Tell();
file.WriteBytes(srcUpdate.data, srcUpdate.size);
FileMemoryUpdate dstUpdate;
dstUpdate.address = srcUpdate.address;
dstUpdate.dataOffset = dataOffset;
@@ -54,7 +54,7 @@ public:
};
FifoDataFile();
~FifoDataFile();
~FifoDataFile();
void SetIsWii(bool isWii);
bool GetIsWii() const;
@@ -77,7 +77,7 @@ private:
{
FLAG_IS_WII = 1
};
void PadFile(u32 numBytes, File::IOFile &file);
void SetFlag(u32 flag, bool set);
@@ -21,7 +21,7 @@ enum
union FileHeader
{
struct
struct
{
u32 fileId;
u32 file_version;
@@ -45,7 +45,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
FifoAnalyzer::LoadCPReg(0x80 + i, cpMem[0x80 + i], m_CpMem);
FifoAnalyzer::LoadCPReg(0x90 + i, cpMem[0x90 + i], m_CpMem);
}
frameInfo.clear();
frameInfo.resize(file->GetFrameCount());
@@ -208,7 +208,7 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
BPCmd bp = FifoAnalyzer::DecodeBPCmd(cmd2, m_BpMem);
FifoAnalyzer::LoadBPReg(bp, m_BpMem);
if (bp.address == BPMEM_TRIGGER_EFB_COPY)
StoreEfbCopyRegion();
}
@@ -284,7 +284,7 @@ void FifoPlaybackAnalyzer::StoreWrittenRegion(u32 address, u32 size)
{
u32 end = address + size;
vector<MemoryRange>::iterator newRangeIter = m_WrittenMemory.end();
// Search for overlapping memory regions and expand them to include the new region
for (vector<MemoryRange>::iterator iter = m_WrittenMemory.begin(); iter != m_WrittenMemory.end();)
{
@@ -293,7 +293,7 @@ void FifoPlaybackAnalyzer::StoreWrittenRegion(u32 address, u32 size)
if (range.begin < end && range.end > address)
{
// range at iterator and new range overlap
if (newRangeIter == m_WrittenMemory.end())
{
// Expand range to include the written region
@@ -33,7 +33,7 @@ private:
};
void AddMemoryUpdate(MemoryUpdate memUpdate, AnalyzedFrameInfo &frameInfo);
u32 DecodeCommand(u8 *data);
void LoadBP(u32 value0);
@@ -92,7 +92,7 @@ bool FifoPlayer::Play()
if (m_EarlyMemoryUpdates && m_CurrentFrame == m_FrameRangeStart)
WriteAllMemoryUpdates();
WriteFrame(m_File->GetFrame(m_CurrentFrame), m_FrameInfo[m_CurrentFrame]);
WriteFrame(m_File->GetFrame(m_CurrentFrame), m_FrameInfo[m_CurrentFrame]);
++m_CurrentFrame;
}
@@ -310,7 +310,7 @@ void FifoPlayer::SetupFifo()
const FifoFrameInfo& frame = m_File->GetFrame(m_CurrentFrame);
// Set fifo bounds
// Set fifo bounds
WriteCP(0x20, frame.fifoStart);
WriteCP(0x22, frame.fifoStart >> 16);
WriteCP(0x24, frame.fifoEnd);
@@ -368,7 +368,7 @@ void FifoPlayer::LoadMemory()
LoadCPReg(0x80 + i, regs[0x80 + i]);
LoadCPReg(0x90 + i, regs[0x90 + i]);
}
for (int i = 0; i < 16; ++i)
{
LoadCPReg(0xa0 + i, regs[0xa0 + i]);
+1 -1
View File
@@ -106,7 +106,7 @@ private:
FifoDataFile *m_File;
std::vector<AnalyzedFrameInfo> m_FrameInfo;
std::vector<AnalyzedFrameInfo> m_FrameInfo;
};
#endif
@@ -60,7 +60,7 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
u32 value = ReadFifo32(data);
FifoAnalyzer::LoadCPReg(cmd2, value, m_CpMem);
}
break;
case GX_LOAD_XF_REG:
@@ -98,7 +98,7 @@ void FifoRecordAnalyzer::DecodeOpcode(u8 *data)
u32 cmd2 = ReadFifo32(data);
BPCmd bp = FifoAnalyzer::DecodeBPCmd(cmd2, *m_BpMem);
if (bp.address == BPMEM_LOADTLUT1)
ProcessLoadTlut1();
if (bp.address == BPMEM_PRELOAD_MODE)
@@ -38,7 +38,7 @@ private:
bool m_DrawingObject;
BPMemory *m_BpMem;
FifoAnalyzer::CPMemory m_CpMem;
FifoAnalyzer::CPMemory m_CpMem;
};
#endif
@@ -22,7 +22,7 @@ FifoRecorder::FifoRecorder() :
m_File(NULL),
m_SkipNextData(true),
m_SkipFutureData(true),
m_FrameEnded(false),
m_FrameEnded(false),
m_Ram(NULL),
m_ExRam(NULL)
{
@@ -53,7 +53,7 @@ void FifoRecorder::StartRecording(s32 numFrames, CallbackFunc finishedCb)
if (!m_IsRecording)
{
m_WasRecording = false;
m_IsRecording = true;
m_IsRecording = true;
m_RecordFramesRemaining = numFrames;
}
@@ -88,7 +88,7 @@ void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
memcpy(m_CurrentFrame.fifoData, &m_FifoData[0], dataSize);
sMutex.lock();
// Copy frame to file
// The file will be responsible for freeing the memory allocated for each frame's fifoData
m_File->AddFrame(m_CurrentFrame);
@@ -132,11 +132,11 @@ void FifoRecorder::WriteMemory(u32 address, u32 size, MemoryUpdate::Type type)
memUpdate.fifoPosition = m_FifoData.size();
memUpdate.size = size;
memUpdate.type = type;
memUpdate.data = new u8[size];
memUpdate.data = new u8[size];
memcpy(memUpdate.data, newData, size);
m_CurrentFrame.memoryUpdates.push_back(memUpdate);
}
}
}
void FifoRecorder::EndFrame(u32 fifoStart, u32 fifoEnd)
@@ -149,7 +149,7 @@ void FifoRecorder::EndFrame(u32 fifoStart, u32 fifoEnd)
m_CurrentFrame.fifoStart = fifoStart;
m_CurrentFrame.fifoEnd = fifoEnd;
if (m_WasRecording)
{
// If recording a fixed number of frames then check if the end of the recording was reached
@@ -27,7 +27,7 @@ public:
void WriteGPCommand(u8 *data, u32 size);
void WriteMemory(u32 address, u32 size, MemoryUpdate::Type type);
void EndFrame(u32 fifoStart, u32 fifoEnd);
// This function must be called before writing GP commands
+2 -2
View File
@@ -764,7 +764,7 @@ bool RegisterOps()
dst_addr += new_data;
else
src_addr += new_data;
while (count--)
Memory::Write_U8(Memory::Read_U8(src_addr++), dst_addr++);
}
@@ -922,7 +922,7 @@ bool SpecialIf()
result = (left_val < right_val);
break;
}
}
}
else if (code.subtype & 0x4)
{
// counters get reset if code execution is off
+1 -1
View File
@@ -52,7 +52,7 @@ namespace Gecko
u32 data;
//struct
//{
//
//
//};
};
+2 -2
View File
@@ -38,8 +38,8 @@ struct SPatch
int flags;
};
static const SPatch OSPatches[] =
{
static const SPatch OSPatches[] =
{
{ "FAKE_TO_SKIP_0", HLE_Misc::UnimplementedFunction, HLE_HOOK_REPLACE, HLE_TYPE_GENERIC },
{ "PanicAlert", HLE_Misc::HLEPanicAlert, HLE_HOOK_REPLACE, HLE_TYPE_DEBUG },
+8 -8
View File
@@ -88,13 +88,13 @@ union AICR
{
AICR() { hex = 0;}
AICR(u32 _hex) { hex = _hex;}
struct
struct
{
u32 PSTAT : 1; // sample counter/playback enable
u32 AISFR : 1; // AIS Frequency (0=32khz 1=48khz)
u32 AIINTMSK : 1; // 0=interrupt masked 1=interrupt enabled
u32 AIINT : 1; // audio interrupt status
u32 AIINTVLD : 1; // This bit controls whether AIINT is affected by the Interrupt Timing register
u32 AIINTVLD : 1; // This bit controls whether AIINT is affected by the Interrupt Timing register
// matching the sample counter. Once set, AIINT will hold its last value
u32 SCRESET : 1; // write to reset counter
u32 AIDFR : 1; // AID Frequency (0=48khz 1=32khz)
@@ -206,7 +206,7 @@ void Write32(const u32 _Value, const u32 _Address)
case AI_CONTROL_REGISTER:
{
AICR tmpAICtrl(_Value);
m_Control.AIINTMSK = tmpAICtrl.AIINTMSK;
m_Control.AIINTVLD = tmpAICtrl.AIINTVLD;
@@ -250,7 +250,7 @@ void Write32(const u32 _Value, const u32 _Address)
}
// Sample Count Reset
if (tmpAICtrl.SCRESET)
if (tmpAICtrl.SCRESET)
{
DEBUG_LOG(AUDIO_INTERFACE, "Reset AIS sample counter");
m_SampleCounter = 0;
@@ -360,7 +360,7 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
static s16 l1 = 0;
static s16 l2 = 0;
if ( frac >= 0x10000 || frac == 0)
{
frac &= 0xffff;
@@ -388,7 +388,7 @@ 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;
else if (pcm_l < -32767) pcm_l = -32767;
@@ -398,11 +398,11 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
if (pcm_r > 32767) pcm_r = 32767;
else if (pcm_r < -32767) pcm_r = -32767;
*_pDestBuffer++ = pcm_r;
pos++;
}
if (pos == NGCADPCM::SAMPLES_PER_BLOCK)
if (pos == NGCADPCM::SAMPLES_PER_BLOCK)
pos = 0;
}
}
+2 -2
View File
@@ -88,7 +88,7 @@ void CEXIETHERNET::Deactivate()
}
bool CEXIETHERNET::IsActivated()
{
{
#ifdef __linux__
return fd != -1 ? true : false;
#else
@@ -96,7 +96,7 @@ bool CEXIETHERNET::IsActivated()
#endif
}
bool CEXIETHERNET::SendFrame(u8* frame, u32 size)
bool CEXIETHERNET::SendFrame(u8* frame, u32 size)
{
#ifdef __linux__
INFO_LOG(SP1, "SendFrame %x\n%s", size, ArrayToString(frame, size, 0x10).c_str());
@@ -95,7 +95,7 @@ bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
if (status != ERROR_SUCCESS)
return false;
while (!found_all)
{
TCHAR enum_name[256];
@@ -240,7 +240,7 @@ void CEXIETHERNET::Deactivate()
}
bool CEXIETHERNET::IsActivated()
{
{
return mHAdapter != INVALID_HANDLE_VALUE;
}
@@ -266,14 +266,14 @@ bool CEXIETHERNET::SendFrame(u8 *frame, u32 size)
// Always report the packet as being sent successfully, even though it might be a lie
SendComplete();
return true;
}
VOID CALLBACK CEXIETHERNET::ReadWaitCallback(PVOID lpParameter, BOOLEAN TimerFired)
{
CEXIETHERNET* self = (CEXIETHERNET*)lpParameter;
GetOverlappedResult(self->mHAdapter, &self->mReadOverlapped,
(LPDWORD)&self->mRecvBufferLength, false);
@@ -332,7 +332,7 @@ void CEXIETHERNET::RecvStop()
return;
UnregisterWaitEx(mHReadWait, INVALID_HANDLE_VALUE);
CloseHandle(mHRecvEvent);
mHRecvEvent = INVALID_HANDLE_VALUE;
}
+4 -4
View File
@@ -75,7 +75,7 @@ reswitch:
case PowerPC::CPU_POWERDOWN:
//1: Exit loop!!
return;
return;
}
}
}
@@ -96,7 +96,7 @@ void CCPU::Reset()
}
void CCPU::StepOpcode(Common::Event *event)
void CCPU::StepOpcode(Common::Event *event)
{
m_StepEvent.Set();
if (PowerPC::GetState() == PowerPC::CPU_STEPPING)
@@ -106,7 +106,7 @@ void CCPU::StepOpcode(Common::Event *event)
}
void CCPU::EnableStepping(const bool _bStepping)
{
{
if (_bStepping)
{
PowerPC::Pause();
@@ -123,7 +123,7 @@ void CCPU::EnableStepping(const bool _bStepping)
}
}
void CCPU::Break()
void CCPU::Break()
{
EnableStepping(true);
}
+3 -3
View File
@@ -14,7 +14,7 @@ namespace Common {
class CCPU
{
public:
// init
// init
static void Init(int cpu_core);
// shutdown
@@ -24,7 +24,7 @@ public:
static void Run();
// causes shutdown
static void Stop();
static void Stop();
// Reset
static void Reset();
@@ -35,7 +35,7 @@ public:
static void SingleStep();
// Enable or Disable Stepping
static void EnableStepping(const bool _bStepping);
static void EnableStepping(const bool _bStepping);
// break, same as EnableStepping(true).
static void Break();
+5 -5
View File
@@ -554,7 +554,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
case AR_DMA_CNT_H:
_uReturnValue = g_arDMA.Cnt.Hex;
break;
case AR_DMA_MMADDR_H:
_uReturnValue = g_arDMA.MMAddr;
break;
@@ -592,7 +592,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
g_arDMA.ARAddr = _iValue & ~31;
break;
case AR_DMA_CNT_H:
case AR_DMA_CNT_H:
g_arDMA.Cnt.Hex = _iValue & ~31;
Do_ARAM_DMA();
break;
@@ -665,7 +665,7 @@ void UpdateAudioDMA()
// external audio fifo in the emulator, to be mixed with the disc
// streaming output. If that audio queue fills up, we delay the
// emulator.
g_audioDMA.BlocksLeft--;
g_audioDMA.ReadAddress += 32;
@@ -811,10 +811,10 @@ u8 ReadARAM(u32 _iAddress)
{
//NOTICE_LOG(DSPINTERFACE, "ReadARAM 0x%08x", _iAddress);
if (g_ARAM.wii_mode)
{
{
if (_iAddress & 0x10000000)
return g_ARAM.ptr[_iAddress & g_ARAM.mask];
else
else
return Memory::Read_U8(_iAddress & Memory::RAM_MASK);
}
else
+1 -1
View File
@@ -38,7 +38,7 @@ void GenerateDSPInterruptFromDSPEmu(DSPInterruptType _DSPInterruptType, bool _bS
// Read32
void Read16(u16& _uReturnValue, const u32 _uAddress);
void Read32(u32& _uReturnValue, const u32 _uAddress);
void Read32(u32& _uReturnValue, const u32 _uAddress);
// Write
void Write16(const u16 _uValue, const u32 _uAddress);
+2 -2
View File
@@ -252,7 +252,7 @@ void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
m_dspState.CPUMailbox = (m_dspState.CPUMailbox & 0xFFFF0000) | _Value;
SendMailToDSP(m_dspState.CPUMailbox);
// Mail sent so clear MSB to show that it is progressed
m_dspState.CPUMailbox &= 0x7FFFFFFF;
m_dspState.CPUMailbox &= 0x7FFFFFFF;
}
else
{
@@ -333,5 +333,5 @@ void DSPHLE::DSP_ClearAudioBuffer(bool mute)
void DSPHLE::PauseAndLock(bool doLock, bool unpauseOnUnlock)
{
if (doLock || unpauseOnUnlock)
DSP_ClearAudioBuffer(doLock);
DSP_ClearAudioBuffer(doLock);
}
+1 -1
View File
@@ -49,7 +49,7 @@ private:
// Declarations and definitions
void *m_hWnd;
bool m_bWii;
bool m_InitMixer;
// Fake mailbox utility
+2 -2
View File
@@ -9,12 +9,12 @@
class DSPHLE;
class HLEMixer : public CMixer
class HLEMixer : public CMixer
{
public:
HLEMixer(DSPHLE *dsp_hle, unsigned int AISampleRate = 48000, unsigned int DACSampleRate = 48000, unsigned int BackendSampleRate = 32000)
: CMixer(AISampleRate, DACSampleRate, BackendSampleRate), m_DSPHLE(dsp_hle) {};
virtual void Premix(short *samples, unsigned int numSamples);
private:
DSPHLE *m_DSPHLE;
+1 -1
View File
@@ -26,7 +26,7 @@ public:
u16 ReadDSPMailboxLow();
u32 GetNextMail()
{
{
if (m_Mails.size())
{
return m_Mails.front();
@@ -237,7 +237,7 @@ struct AXPB
u16 is_stream; // 1 = stream, 0 = one shot
PBMixer mixer;
PBInitialTimeDelay initial_time_delay;
PBInitialTimeDelay initial_time_delay;
PBUpdates updates;
PBDpop dpop;
PBVolumeEnvelope vol_env;
@@ -18,7 +18,7 @@
CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
:
:
IUCode(dsp_hle, _CRC),
m_bSyncInProgress(false),
@@ -60,7 +60,7 @@ CUCode_Zelda::CUCode_Zelda(DSPHLE *dsp_hle, u32 _CRC)
if (IsLightVersion())
{
NOTICE_LOG(DSPHLE, "Luigi Stylee!");
m_rMailHandler.PushMail(0x88881111);
m_rMailHandler.PushMail(0x88881111);
}
else
{
@@ -125,7 +125,7 @@ void CUCode_Zelda::HandleMail(u32 _uMail)
void CUCode_Zelda::HandleMail_LightVersion(u32 _uMail)
{
//ERROR_LOG(DSPHLE, "Light version mail %08X, list in progress: %s, step: %i/%i",
//ERROR_LOG(DSPHLE, "Light version mail %08X, list in progress: %s, step: %i/%i",
// _uMail, m_bListInProgress ? "yes":"no", m_step, m_numSteps);
if (m_bSyncCmdPending)
@@ -322,7 +322,7 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
m_rMailHandler.PushMail(DSP_SYNC);
DSP::GenerateDSPInterruptFromDSPEmu(DSP::INT_DSP);
m_rMailHandler.PushMail(0xF355FF00 | m_CurBuffer);
m_CurVoice = 0;
if (m_CurBuffer == m_NumBuffers)
@@ -371,10 +371,10 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
// - 00000000, 000X0000 - Sync mails
// - CDD1XXXX - comes after DsyncFrame completed, seems to be debugging stuff
if (_uMail == 0)
if (_uMail == 0)
{
m_bSyncInProgress = true;
}
}
else if ((_uMail >> 16) == 0)
{
m_bListInProgress = true;
@@ -542,7 +542,7 @@ void CUCode_Zelda::ExecuteList()
{
if (m_bSyncCmdPending)
m_rMailHandler.PushMail(0x80000000 | m_NumBuffers); // after CMD_2
else
else
m_rMailHandler.PushMail(0x80000000 | Sync); // after CMD_0, CMD_1
}
else
@@ -15,11 +15,11 @@
union ZeldaVoicePB
{
struct
struct
{
// Read-Write part
u16 Status; // 0x00 | 1 = play, 0 = stop
u16 KeyOff; // 0x01 | writing 1 stops voice?
u16 KeyOff; // 0x01 | writing 1 stops voice?
u16 RatioInt; // 0x02 | Position delta (playback speed)
u16 Unk03; // 0x03 | unknown
u16 NeedsReset; // 0x04 | indicates if some values in PB need to be reset
@@ -48,10 +48,10 @@ union ZeldaVoicePB
u16 Unk17; // 0x17 | unknown
u16 Unk18[0x10]; // 0x18 | unknown
u16 Unk28; // 0x28 | unknown
u16 Unk28; // 0x28 | unknown
u16 Unk29; // 0x29 | unknown // multiplied by 0x2a @ 0d21/ZWW
u16 Unk2a; // 0x2A | unknown // loaded at 0d2e/ZWW
u16 Unk2b; // 0x2B | unknown
u16 Unk2b; // 0x2B | unknown
u16 VolumeMode; // 0x2C | unknown // See 0337/ZWW
u16 Unk2D; // 0x2D | unknown
u16 Unk2E; // 0x2E | unknown
@@ -75,7 +75,7 @@ union ZeldaVoicePB
u16 FilterState1; // 0x78 | unknown // ZWW: 0c84_FilterBufferInPlace loads and stores. Simply, the filter state.
u16 FilterState2; // 0x79 | unknown // ZWW: same as above. these two are active if 0x04a8 != 0.
u16 Unk7A; // 0x7A | unknown
u16 Unk7B; // 0x7B | unknown
u16 Unk7B; // 0x7B | unknown
u16 Unk7C; // 0x7C | unknown
u16 Unk7D; // 0x7D | unknown
u16 Unk7E; // 0x7E | unknown
@@ -22,7 +22,7 @@ void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed shor
src++;
}
for (auto& nibble : nibbles) {
if (nibble >= 8)
if (nibble >= 8)
nibble = nibble - 16;
nibble <<= 11;
}
@@ -41,9 +41,9 @@ void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed shor
src++;
}
for (auto& nibble : nibbles)
for (auto& nibble : nibbles)
{
if (nibble >= 2)
if (nibble >= 2)
nibble = nibble - 4;
nibble <<= 13;
}
@@ -65,4 +65,4 @@ void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed shor
}
*histp = hist;
*hist2p = hist2;
}
}
@@ -18,9 +18,9 @@ void CUCode_Zelda::RenderSynth_RectWave(ZeldaVoicePB &PB, s32* _Buffer, int _Siz
s64 TrueSamplePosition = PB.CurSampleFrac;
// PB.Format == 0x3 -> Rectangular Wave, 0x0 -> Square Wave
unsigned int mask = PB.Format ? 3 : 1;
unsigned int mask = PB.Format ? 3 : 1;
// int shift = PB.Format ? 2 : 1; // Unused?
u32 pos[2] = {0, 0};
int i = 0;
@@ -55,7 +55,7 @@ _lRestart:
}
}
while(i < _Size)
while(i < _Size)
{
s16 sample = ((pos[1] & mask) == mask) ? 0xc000 : 0x4000;
@@ -84,12 +84,12 @@ _lRestart:
PB.CurSampleFrac = TrueSamplePosition & 0xFFFF;
}
void CUCode_Zelda::RenderSynth_SawWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
void CUCode_Zelda::RenderSynth_SawWave(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
s32 ratio = (s32)ceil((float)PB.RatioInt / 3);
s64 pos = PB.CurSampleFrac;
for (int i = 0; i < _Size; i++)
for (int i = 0; i < _Size; i++)
{
pos += ratio;
_Buffer[i] = pos & 0xFFFF;
@@ -161,10 +161,10 @@ void CUCode_Zelda::RenderSynth_WaveTable(ZeldaVoicePB &PB, s32* _Buffer, int _Si
address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff));
ACC0 &= 0xffff0000ffffULL;
for(int i = 0; i < 0x50; i++)
for(int i = 0; i < 0x50; i++)
{
_Buffer[i] = m_MiscTable[address];
ACC0 += PB.RatioInt << 5;
address = AddValueToReg(address, ((ACC0 >> 16) & 0xffff));
@@ -77,7 +77,7 @@ void CUCode_Zelda::Resample(ZeldaVoicePB &PB, int size, s16 *in, s32 *out, bool
int ratio = ConvertRatio(PB.RatioInt);
int in_size = SizeForResampling(PB, size, ratio);
int position = PB.CurSampleFrac;
for (int i = 0; i < size; i++)
{
@@ -110,7 +110,7 @@ void CUCode_Zelda::RenderVoice_PCM16(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
if (PB.NeedsReset)
{
UpdateSampleCounters10(PB);
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
PB.ResamplerOldData[i] = 0; // Doesn't belong here, but dunno where to do it.
}
if (PB.ReachedEnd)
@@ -168,7 +168,7 @@ void CUCode_Zelda::RenderVoice_PCM8(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
if (PB.NeedsReset)
{
UpdateSampleCounters8(PB);
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
PB.ResamplerOldData[i] = 0; // Doesn't belong here, but dunno where to do it.
}
if (PB.ReachedEnd)
@@ -211,8 +211,8 @@ clear_buffer:
PB.CurAddr += rem_samples;
}
template <typename T>
void PrintObject(const T &Obj)
template <typename T>
void PrintObject(const T &Obj)
{
std::stringstream ss;
u8 *o = (u8 *)&Obj;
@@ -248,11 +248,11 @@ void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
{
// This is 0717_ReadOutPBStuff
// increment 4fb
// zelda:
// zelda:
// perhaps init or "has played before"
PB.CurBlock = 0x00;
PB.YN2 = 0x00; // history1
PB.YN1 = 0x00; // history2
PB.YN2 = 0x00; // history1
PB.YN1 = 0x00; // history2
// Length in samples.
PB.RemLength = PB.Length;
@@ -261,7 +261,7 @@ void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
PB.ReachedEnd = 0;
PB.CurSampleFrac = 0;
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
PB.ResamplerOldData[i] = 0;
}
@@ -300,7 +300,7 @@ restart:
PB.KeyOff = 1;
PB.RemLength = 0;
PB.CurAddr = PB.StartAddr + PB.RestartPos + PB.Length;
while (sampleCount < _RealSize)
_Buffer[sampleCount++] = 0;
return;
@@ -413,7 +413,7 @@ void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
u64 ACC1 = (u32)(PB.raw[0x34 ^ 1] << 16); // 0x34
// ERROR_LOG(DSPHLE, "%08x %08x", (u32)ACC0, (u32)ACC1);
ACC0 -= ACC1;
PB.Unk36[0] = (u16)(ACC0 >> 16);
@@ -461,7 +461,7 @@ void Decoder21_ReadAudio(ZeldaVoicePB &PB, int size, s16 *_Buffer)
#endif
// ACC0 is the address
// ACC1 is the read size
const u32 ram_mask = 0x1FFFFFF;
const u8 *source = Memory::GetPointer(0x80000000);
const u16 *src = (u16 *)(source + (ACC0 & ram_mask));
@@ -525,12 +525,12 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
break;
case 0x0021:
// Raw sound from RAM. Important for Zelda WW. Cutscenes use the music
// Raw sound from RAM. Important for Zelda WW. Cutscenes use the music
// to let the game know they ended
RenderVoice_Raw(PB, m_ResampleBuffer + 4, _Size);
Resample(PB, _Size, m_ResampleBuffer + 4, m_VoiceBuffer, true);
break;
default:
// Second jump table
// TODO: Cases to find examples of:
@@ -546,7 +546,7 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
RenderSynth_RectWave(PB, m_VoiceBuffer, _Size);
break;
case 0x0001: // Example: "Denied" sound when trying to pull out a sword
case 0x0001: // Example: "Denied" sound when trying to pull out a sword
// indoors in ZWW
RenderSynth_SawWave(PB, m_VoiceBuffer, _Size);
break;
@@ -577,7 +577,7 @@ void CUCode_Zelda::RenderAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _Righ
}
ContinueWithBlock:
if (PB.FilterEnable)
{ // 0x04a8
for (int i = 0; i < _Size; i++)
@@ -590,7 +590,7 @@ ContinueWithBlock:
{
// TODO?
}
// Apply volume. There are two different modes.
if (PB.VolumeMode != 0)
{
@@ -629,7 +629,7 @@ ContinueWithBlock:
}
// ZWW 0d34
int diff = (s16)PB.raw[0x2b] - (s16)PB.raw[0x2a];
PB.raw[0x2a] = PB.raw[0x2b];
@@ -649,7 +649,7 @@ ContinueWithBlock:
// We just mix to the first two and call it stereo :p
int value = b00[0x4 + count];
//int delta = b00[0xC + count] << 11; // Unused?
int ramp = value << 16;
for (int i = 0; i < _Size; i++)
{
@@ -730,7 +730,7 @@ ContinueWithBlock:
}
// Update the PB with the volume actually reached.
PB.raw[addr++] = ramp >> 16;
addr++;
}
}
@@ -90,7 +90,7 @@ protected:
// Some ucodes (notably zelda) require a resume mail to be
// sent if they are be started via PrepareBootUCode.
// The HLE can use this to
// The HLE can use this to
bool NeedsResumeMail();
void DoStateShared(PointerWrap &p);
@@ -10,7 +10,7 @@
#include "DSPSymbols.h"
#include "DSP/DSPMemoryMap.h"
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
void DSPDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
// we'll treat addresses as line numbers.
strncpy(dest, DSPSymbols::GetLineText(address), max_size);
@@ -72,7 +72,7 @@ bool DSPDebugInterface::isAlive()
return true; //Core::GetState() != Core::CORE_UNINITIALIZED;
}
bool DSPDebugInterface::isBreakpoint(unsigned int address)
bool DSPDebugInterface::isBreakpoint(unsigned int address)
{
int real_addr = DSPSymbols::Line2Addr(address);
if (real_addr >= 0)
@@ -97,7 +97,7 @@ void DSPDebugInterface::setBreakpoint(unsigned int address)
void DSPDebugInterface::clearBreakpoint(unsigned int address)
{
int real_addr = DSPSymbols::Line2Addr(address);
if (real_addr >= 0)
{
if (dsp_breakpoints.Remove(real_addr))
@@ -134,7 +134,7 @@ void DSPDebugInterface::toggleMemCheck(unsigned int address)
PanicAlert("MemCheck functionality not supported in DSP module.");
}
void DSPDebugInterface::insertBLR(unsigned int address, unsigned int value)
void DSPDebugInterface::insertBLR(unsigned int address, unsigned int value)
{
PanicAlert("insertBLR functionality not supported in DSP module.");
}
@@ -145,7 +145,7 @@ void DSPDebugInterface::insertBLR(unsigned int address, unsigned int value)
int DSPDebugInterface::getColor(unsigned int address)
{
static const int colors[6] =
{
{
0xd0FFFF, // light cyan
0xFFd0d0, // light red
0xd8d8FF, // light blue
@@ -175,24 +175,24 @@ int DSPDebugInterface::getColor(unsigned int address)
// =============
std::string DSPDebugInterface::getDescription(unsigned int address)
std::string DSPDebugInterface::getDescription(unsigned int address)
{
return ""; // g_symbolDB.GetDescription(address);
}
unsigned int DSPDebugInterface::getPC()
unsigned int DSPDebugInterface::getPC()
{
return DSPSymbols::Addr2Line(g_dsp.pc);
}
void DSPDebugInterface::setPC(unsigned int address)
void DSPDebugInterface::setPC(unsigned int address)
{
int new_pc = DSPSymbols::Line2Addr(address);
if (new_pc > 0)
g_dsp.pc = new_pc;
}
void DSPDebugInterface::runToBreakpoint()
void DSPDebugInterface::runToBreakpoint()
{
}
@@ -14,7 +14,7 @@
class DSPDebugInterface : public DebugInterface
{
public:
DSPDebugInterface(){}
DSPDebugInterface(){}
virtual void disasm(unsigned int address, char *dest, int max_size);
virtual void getRawMemoryString(int memory, unsigned int address, char *dest, int max_size);
virtual int getInstructionSize(int instruction) {return 1;}
+1 -1
View File
@@ -58,7 +58,7 @@ void DSPHost_CodeLoaded(const u8 *ptr, int size)
DSPSymbols::Clear();
// Auto load text file - if none just disassemble.
NOTICE_LOG(DSPLLE, "g_dsp.iram_crc: %08x", g_dsp.iram_crc);
DSPSymbols::Clear();
+3 -3
View File
@@ -184,7 +184,7 @@ void DSPLLE::InitMixer()
unsigned int AISampleRate, DACSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000));
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000));
if(!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized
m_InitMixer = true;
@@ -293,7 +293,7 @@ void DSPLLE::DSP_Update(int cycles)
cycles_between_ss_update = 121500000 / 200;
else
cycles_between_ss_update = 81000000 / 200;
m_cycle_count += cycles;
if (m_cycle_count > cycles_between_ss_update)
{
@@ -349,7 +349,7 @@ void DSPLLE::DSP_ClearAudioBuffer(bool mute)
void DSPLLE::PauseAndLock(bool doLock, bool unpauseOnUnlock)
{
if (doLock || unpauseOnUnlock)
DSP_ClearAudioBuffer(doLock);
DSP_ClearAudioBuffer(doLock);
if (doLock)
m_csDSPThreadActive.lock();
@@ -12,7 +12,7 @@
#define PROFILE 0
#if PROFILE
#if PROFILE
void ProfilerDump(u64 _count);
void ProfilerInit();
void ProfilerAddDelta(int _addr, int _delta);
@@ -108,7 +108,7 @@ bool IsAlpha(char c)
void DisasssembleRange(u16 start, u16 end)
{
}
bool ReadAnnotatedAssembly(const char *filename)
@@ -120,9 +120,9 @@ bool ReadAnnotatedAssembly(const char *filename)
return false;
}
char line[512];
int last_addr = 0;
lines.reserve(3000);
// Symbol generation
@@ -229,7 +229,7 @@ bool ReadAnnotatedAssembly(const char *filename)
return false;
}
}
else
else
{
// if (line_counter >= 200 && line_counter <= 220)
// NOTICE_LOG(DSPLLE, "Got Hex Digit %04x from %s, line %i", hex, line, line_counter);
+2 -2
View File
@@ -10,12 +10,12 @@
namespace DSPSymbols {
class DSPSymbolDB : public SymbolDB
class DSPSymbolDB : public SymbolDB
{
public:
DSPSymbolDB() {}
~DSPSymbolDB() {}
Symbol *GetSymbolFromAddr(u32 addr);
};
+12 -12
View File
@@ -36,7 +36,7 @@ enum
DI_COMMAND_1 = 0x0C,
DI_COMMAND_2 = 0x10,
DI_DMA_ADDRESS_REGISTER = 0x14,
DI_DMA_LENGTH_REGISTER = 0x18,
DI_DMA_LENGTH_REGISTER = 0x18,
DI_DMA_CONTROL_REGISTER = 0x1C,
DI_IMMEDIATE_DATA_BUFFER = 0x20,
DI_CONFIG_REGISTER = 0x24
@@ -62,7 +62,7 @@ enum
};
// DI Status Register
union UDISR
union UDISR
{
u32 Hex;
struct
@@ -284,7 +284,7 @@ void SetDiscInside(bool _DiscInside)
}
bool IsDiscInside()
{
{
return g_bDiscInside;
}
@@ -342,7 +342,7 @@ void SetLidOpen(bool _bOpen)
}
bool IsLidOpen()
{
{
return (m_DICVR.CVR == 1);
}
@@ -455,7 +455,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
{
_dbg_assert_(DVDINTERFACE, 0);
}
UpdateInterrupts();
}
break;
@@ -487,14 +487,14 @@ void Write32(const u32 _iValue, const u32 _iAddress)
m_DILENGTH.Hex = _iValue & ~0x1f;
}
break;
case DI_DMA_CONTROL_REGISTER:
case DI_DMA_CONTROL_REGISTER:
{
m_DICR.Hex = _iValue & 7;
if (m_DICR.TSTART)
{
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed)
{
u64 ticksUntilTC = m_DILENGTH.Length *
u64 ticksUntilTC = m_DILENGTH.Length *
(SystemTimers::GetTicksPerSecond() / (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii ? 1 : DISC_TRANSFER_RATE_GC)) +
(SystemTimers::GetTicksPerSecond() * DISC_ACCESS_TIME_MS / 1000);
CoreTiming::ScheduleEvent((int)ticksUntilTC, tc);
@@ -541,7 +541,7 @@ void UpdateInterrupts()
void GenerateDIInterrupt(DI_InterruptType _DVDInterrupt)
{
switch(_DVDInterrupt)
switch(_DVDInterrupt)
{
case INT_DEINT: m_DISR.DEINT = 1; break;
case INT_TCINT: m_DISR.TCINT = 1; break;
@@ -709,7 +709,7 @@ void ExecuteCommand(UDICR& _DICR)
{
ERROR_LOG(DVDINTERFACE, "GC-AM: 0xAA, DMABuffer=%08x, DMALength=%08x", m_DIMAR.Address, m_DILENGTH.Length);
u32 iDVDOffset = m_DICMDBUF[1].Hex << 2;
unsigned int len = m_DILENGTH.Length;
unsigned int len = m_DILENGTH.Length;
int offset = iDVDOffset - 0x1F900000;
/*
if (iDVDOffset == 0x84800000)
@@ -794,7 +794,7 @@ void ExecuteCommand(UDICR& _DICR)
3 - "Testing a game program. %d%%"
4 - "Loading a game program. %d%%"
5 - go
6 - error xx
6 - error xx
*/
media_buffer[8] = percentage;
media_buffer[4] = 0x05;
@@ -803,7 +803,7 @@ void ExecuteCommand(UDICR& _DICR)
}
case 0x101:
media_buffer[4] = 3; // version
media_buffer[5] = 3;
media_buffer[5] = 3;
media_buffer[6] = 1; // xxx
media_buffer[8] = 1;
media_buffer[16] = 0xFF;
@@ -846,7 +846,7 @@ void ExecuteCommand(UDICR& _DICR)
// Audio Stream (Immediate)
// m_DICMDBUF[0].CMDBYTE1 = subcommand
// m_DICMDBUF[1].Hex << 2 = offset on disc
// m_DICMDBUF[1].Hex << 2 = offset on disc
// m_DICMDBUF[2].Hex = Length of the stream
case 0xE1:
{
+1 -1
View File
@@ -88,7 +88,7 @@ public:
};
// F A C T O R Y
// F A C T O R Y
IEXIDevice* EXIDevice_Create(TEXIDevices device_type, const int channel_num)
{
IEXIDevice* result = NULL;
+2 -2
View File
@@ -9,7 +9,7 @@
CEXIAD16::CEXIAD16() :
m_uPosition(0),
m_uCommand(0)
m_uCommand(0)
{
m_uAD16Register.U32 = 0x00;
}
@@ -40,7 +40,7 @@ void CEXIAD16::TransferByte(u8& _byte)
m_uAD16Register.U32 = 0x04120000;
switch(m_uPosition)
{
case 1: _dbg_assert_(EXPANSIONINTERFACE, (_byte == 0x00)); break; // just skip
case 1: _dbg_assert_(EXPANSIONINTERFACE, (_byte == 0x00)); break; // just skip
case 2: _byte = m_uAD16Register.U8[0]; break;
case 3: _byte = m_uAD16Register.U8[1]; break;
case 4: _byte = m_uAD16Register.U8[2]; break;
+1 -1
View File
@@ -14,7 +14,7 @@ public:
virtual void DoState(PointerWrap &p);
private:
enum
enum
{
init = 0x00,
write = 0xa0,
Loaded 100 of 568 files, more files were not shown because too many files have changed in this diff. Show more