diff options
| author | Michael Maltese <mchtly@gmail.com> | 2017-05-19 19:18:17 -0700 |
|---|---|---|
| committer | Michael Maltese <mchtly@gmail.com> | 2017-06-05 19:28:40 -0700 |
| commit | 97e6ba773b3dae4167f8cf383df94d40eaaeac5b (patch) | |
| tree | bd7defc63f2d7459091d685e7c0aacf4d440c07e /Source/Core | |
| parent | 1765e54ab3e084334179e5540066cb5bbf62ee33 (diff) | |
Move DSP::CodesToHeader to DSPTool
It's the only place it's used, and highly-specific to DSPTool's needs.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/DSP/DSPCodeUtil.cpp | 73 | ||||
| -rw-r--r-- | Source/Core/Core/DSP/DSPCodeUtil.h | 4 |
2 files changed, 0 insertions, 77 deletions
diff --git a/Source/Core/Core/DSP/DSPCodeUtil.cpp b/Source/Core/Core/DSP/DSPCodeUtil.cpp index db8e6f6b24..cef0e12f63 100644 --- a/Source/Core/Core/DSP/DSPCodeUtil.cpp +++ b/Source/Core/Core/DSP/DSPCodeUtil.cpp @@ -100,79 +100,6 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2) return code1.size() == code2.size() && code1.size() == count_equal; } -void CodeToHeader(const std::vector<u16>& code, std::string _filename, const char* name, - std::string& header) -{ - std::vector<u16> code_padded = code; - // Pad with nops to 32byte boundary - while (code_padded.size() & 0x7f) - code_padded.push_back(0); - header.clear(); - header.reserve(code_padded.size() * 4); - header.append("#define NUM_UCODES 1\n\n"); - std::string filename; - SplitPath(_filename, nullptr, &filename, nullptr); - header.append( - StringFromFormat("const char* UCODE_NAMES[NUM_UCODES] = {\"%s\"};\n\n", filename.c_str())); - header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n"); - - header.append("\t{\n\t\t"); - for (u32 j = 0; j < code_padded.size(); j++) - { - if (j && ((j & 15) == 0)) - header.append("\n\t\t"); - header.append(StringFromFormat("0x%04x, ", code_padded[j])); - } - header.append("\n\t},\n"); - - header.append("};\n"); -} - -void CodesToHeader(const std::vector<u16>* codes, const std::vector<std::string>* filenames, - u32 numCodes, const char* name, std::string& header) -{ - std::vector<std::vector<u16>> codes_padded; - u32 reserveSize = 0; - for (u32 i = 0; i < numCodes; i++) - { - codes_padded.push_back(codes[i]); - // Pad with nops to 32byte boundary - while (codes_padded.at(i).size() & 0x7f) - codes_padded.at(i).push_back(0); - - reserveSize += (u32)codes_padded.at(i).size(); - } - header.clear(); - header.reserve(reserveSize * 4); - header.append(StringFromFormat("#define NUM_UCODES %u\n\n", numCodes)); - header.append("const char* UCODE_NAMES[NUM_UCODES] = {\n"); - for (u32 i = 0; i < numCodes; i++) - { - std::string filename; - if (!SplitPath(filenames->at(i), nullptr, &filename, nullptr)) - filename = filenames->at(i); - header.append(StringFromFormat("\t\"%s\",\n", filename.c_str())); - } - header.append("};\n\n"); - header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n"); - - for (u32 i = 0; i < numCodes; i++) - { - if (codes[i].size() == 0) - continue; - - header.append("\t{\n\t\t"); - for (u32 j = 0; j < codes_padded.at(i).size(); j++) - { - if (j && ((j & 15) == 0)) - header.append("\n\t\t"); - header.append(StringFromFormat("0x%04x, ", codes_padded.at(i).at(j))); - } - header.append("\n\t},\n"); - } - header.append("};\n"); -} - void CodeToBinaryStringBE(const std::vector<u16>& code, std::string& str) { str.resize(code.size() * 2); diff --git a/Source/Core/Core/DSP/DSPCodeUtil.h b/Source/Core/Core/DSP/DSPCodeUtil.h index a4906746ac..08dc8edd2d 100644 --- a/Source/Core/Core/DSP/DSPCodeUtil.h +++ b/Source/Core/Core/DSP/DSPCodeUtil.h @@ -14,10 +14,6 @@ namespace DSP bool Assemble(const std::string& text, std::vector<u16>& code, bool force = false); bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& text); bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2); -void CodeToHeader(const std::vector<u16>& code, std::string _filename, const char* name, - std::string& header); -void CodesToHeader(const std::vector<u16>* codes, const std::vector<std::string>* filenames, - u32 numCodes, const char* name, std::string& header); // Big-endian, for writing straight to file using File::WriteStringToFile. void CodeToBinaryStringBE(const std::vector<u16>& code, std::string& str); |
