diff options
Diffstat (limited to 'Source/Core/DSPCore/Src/DSPCodeUtil.cpp')
| -rw-r--r-- | Source/Core/DSPCore/Src/DSPCodeUtil.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Source/Core/DSPCore/Src/DSPCodeUtil.cpp b/Source/Core/DSPCore/Src/DSPCodeUtil.cpp index c78f0caae3..5df23e09c8 100644 --- a/Source/Core/DSPCore/Src/DSPCodeUtil.cpp +++ b/Source/Core/DSPCore/Src/DSPCodeUtil.cpp @@ -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)
|
