mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
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:
@ -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)
|
||||
|
Reference in New Issue
Block a user