DSPCodeUtil some code fixing

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3485 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-06-17 23:36:04 +00:00
parent a536460067
commit 37ceb042e1
2 changed files with 10 additions and 9 deletions

View File

@ -338,14 +338,14 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _
if (last_slash == std::string::npos) if (last_slash == std::string::npos)
{ {
return false; return false; // FIXME return the filename
} }
size_t last_dot = full_path.rfind('.'); size_t last_dot = full_path.rfind('.');
if ((last_dot == std::string::npos) || (last_dot < last_slash)) if ((last_dot == std::string::npos) || (last_dot < last_slash))
{ {
return false; return false; // FIXME why missing . is critical?
} }
if (_pPath) if (_pPath)

View File

@ -150,7 +150,7 @@ void CodeToHeader(const std::vector<u16> &code, std::string _filename,
void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>* filenames, void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>* filenames,
int numCodes, const char *name, std::string &header) int numCodes, const char *name, std::string &header)
{ {
char buffer[0x1000]; char buffer[1024];
int reserveSize = 0; int reserveSize = 0;
for(int i = 0; i < numCodes; i++) for(int i = 0; i < numCodes; i++)
reserveSize += (int)codes[i].size(); reserveSize += (int)codes[i].size();
@ -160,15 +160,16 @@ void CodesToHeader(const std::vector<u16> *codes, const std::vector<std::string>
header.reserve(reserveSize * 4); header.reserve(reserveSize * 4);
sprintf(buffer, "#define NUM_UCODES %d\n\n", numCodes); sprintf(buffer, "#define NUM_UCODES %d\n\n", numCodes);
header.append(buffer); header.append(buffer);
sprintf(buffer, "const char* UCODE_NAMES[NUM_UCODES] = {\n"); header.append("const char* UCODE_NAMES[NUM_UCODES] = {\n");
for (int i = 0; i < numCodes; i++) for (int i = 0; i < numCodes; i++)
{ {
std::string filename; std::string filename;
SplitPath(filenames->at(i), NULL, &filename, NULL); if (! SplitPath(filenames->at(i), NULL, &filename, NULL))
sprintf(buffer, "%s\t\"%s\",\n", buffer, filename.c_str()); filename = filenames->at(i);
sprintf(buffer, "\t\"%s\",\n", filename.c_str());
header.append(buffer);
} }
sprintf(buffer, "%s};\n\n", buffer); header.append("};\n\n");
header.append(buffer);
header.append("#ifndef _MSCVER\n"); header.append("#ifndef _MSCVER\n");
sprintf(buffer, "const unsigned short %s[NUM_UCODES][0x1000] = {\n", name); sprintf(buffer, "const unsigned short %s[NUM_UCODES][0x1000] = {\n", name);
header.append(buffer); header.append(buffer);