mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-05 04:29:09 -06:00
Some tidy up of sprintf to StringFromFormat
Includes a small fix to SetupWiiMemory
This commit is contained in:
@ -110,8 +110,6 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
|
||||
// Pad with nops to 32byte boundary
|
||||
while (code_padded.size() & 0x7f)
|
||||
code_padded.push_back(0);
|
||||
|
||||
char buffer[1024];
|
||||
header.clear();
|
||||
header.reserve(code_padded.size() * 4);
|
||||
header.append("#define NUM_UCODES 1\n\n");
|
||||
@ -125,8 +123,7 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
|
||||
{
|
||||
if (j && ((j & 15) == 0))
|
||||
header.append("\n\t\t");
|
||||
sprintf(buffer, "0x%04x, ", code_padded[j]);
|
||||
header.append(buffer);
|
||||
header.append(StringFromFormat("0x%04x, ", code_padded[j]));
|
||||
}
|
||||
header.append("\n\t},\n");
|
||||
|
||||
@ -137,7 +134,6 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||
u32 numCodes, const char *name, std::string &header)
|
||||
{
|
||||
std::vector<std::vector<u16> > codes_padded;
|
||||
char buffer[1024];
|
||||
u32 reserveSize = 0;
|
||||
for(u32 i = 0; i < numCodes; i++)
|
||||
{
|
||||
@ -148,20 +144,16 @@ 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);
|
||||
header.append(buffer);
|
||||
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), NULL, &filename, NULL))
|
||||
filename = filenames->at(i);
|
||||
sprintf(buffer, "\t\"%s\",\n", filename.c_str());
|
||||
header.append(buffer);
|
||||
header.append(StringFromFormat("\t\"%s\",\n", filename.c_str()));
|
||||
}
|
||||
header.append("};\n\n");
|
||||
header.append("const unsigned short dsp_code[NUM_UCODES][0x1000] = {\n");
|
||||
@ -176,8 +168,7 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
|
||||
{
|
||||
if (j && ((j & 15) == 0))
|
||||
header.append("\n\t\t");
|
||||
sprintf(buffer, "0x%04x, ", codes_padded.at(i).at(j));
|
||||
header.append(buffer);
|
||||
header.append(StringFromFormat("0x%04x, ", codes_padded.at(i).at(j)));
|
||||
}
|
||||
header.append("\n\t},\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user