DSPSpy: Added preliminary support for realtime multiple microcode processing

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3383 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-06-08 21:15:01 +00:00
parent e9a08dc281
commit 2122da5cd2
2 changed files with 21 additions and 12 deletions

View File

@ -113,6 +113,7 @@ void GenRandomCode(int size, std::vector<u16> &code)
void CodeToHeader(const std::vector<u16> &code, const char *name, std::string &header)
{
int const ucodes = 1; // TODO: Make variable size
std::vector<u16> code_copy = code;
// Add some nops at the end to align the size a bit.
while (code_copy.size() & 7)
@ -120,21 +121,28 @@ void CodeToHeader(const std::vector<u16> &code, const char *name, std::string &h
char buffer[1024];
header.clear();
header.reserve(code.size() * 4);
sprintf(buffer, "#define NUM_UCODES %d\n\n", ucodes);
header.append(buffer);
header.append("#ifndef _MSCVER\n");
sprintf(buffer, "const unsigned short %s[0x1000] = {\n", name);
sprintf(buffer, "const unsigned short %s[NUM_UCODES][0x1000] = {\n", name);
header.append(buffer);
header.append("#else\n");
sprintf(buffer, "const unsigned short %s[0x1000] __attribute__ ((aligned (64))) = {\n", name);
sprintf(buffer, "const unsigned short %s[NUM_UCODES][0x1000] __attribute__ ((aligned (64))) = {\n", name);
header.append(buffer);
header.append("#endif\n\n ");
for (int i = 0; i < code.size(); i++)
{
if (i && ((i & 15) == 0))
header.append("\n ");
sprintf(buffer, "0x%04x, ", code[i]);
header.append(buffer);
header.append("#endif\n\n");
for(int i = 0; i < ucodes; i++) {
header.append("\t{\n\t\t");
for (int j = 0; j < code.size(); j++)
{
if (j && ((j & 15) == 0))
header.append("\n\t\t");
sprintf(buffer, "0x%04x, ", code[j]);
header.append(buffer);
}
header.append("\n\t},\n");
}
header.append("\n};\n");
header.append("};\n");
}
void CodeToBinaryStringBE(const std::vector<u16> &code, std::string &str)

View File

@ -339,8 +339,9 @@ int main()
dspbufC[0x00 + n] = dspreg_in[n];
DCFlushRange(dspbufC, 0x2000);
// Then send the code.
DCFlushRange((void *)dsp_code, 0x2000);
real_dsp.SendTask((void *)MEM_VIRTUAL_TO_PHYSICAL(dsp_code), 0, 4000, 0x10);
DCFlushRange((void *)dsp_code[0], 0x2000);
real_dsp.SendTask((void *)MEM_VIRTUAL_TO_PHYSICAL(dsp_code[0]),
0, 4000, 0x10);
}
else if (mail == 0x8888dead)
{