mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 23:29:55 -06:00
remove some shitty strings
This commit is contained in:
@ -26,10 +26,9 @@
|
|||||||
// TODO: more user-friendly error reporting
|
// TODO: more user-friendly error reporting
|
||||||
|
|
||||||
|
|
||||||
ARCodeFile::ARCodeFile(const char* filename)
|
ARCodeFile::ARCodeFile(std::string filename)
|
||||||
{
|
{
|
||||||
memset(Filename, 0, sizeof(Filename));
|
Filename = filename;
|
||||||
strncpy(Filename, filename, 1023);
|
|
||||||
|
|
||||||
Error = false;
|
Error = false;
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ bool ARCodeFile::Load()
|
|||||||
if (isincat) Categories.push_back(curcat);
|
if (isincat) Categories.push_back(curcat);
|
||||||
isincat = true;
|
isincat = true;
|
||||||
|
|
||||||
memcpy(curcat.Name, catname, 128);
|
curcat.Name = catname;
|
||||||
curcat.Codes.clear();
|
curcat.Codes.clear();
|
||||||
}
|
}
|
||||||
else if (!strncasecmp(start, "CODE", 4))
|
else if (!strncasecmp(start, "CODE", 4))
|
||||||
@ -118,7 +117,7 @@ bool ARCodeFile::Load()
|
|||||||
if (isincode) curcat.Codes.push_back(curcode);
|
if (isincode) curcat.Codes.push_back(curcode);
|
||||||
isincode = true;
|
isincode = true;
|
||||||
|
|
||||||
memcpy(curcode.Name, codename, 128);
|
curcode.Name = codename;
|
||||||
curcode.Enabled = enable!=0;
|
curcode.Enabled = enable!=0;
|
||||||
curcode.CodeLen = 0;
|
curcode.CodeLen = 0;
|
||||||
}
|
}
|
||||||
@ -172,12 +171,12 @@ bool ARCodeFile::Save()
|
|||||||
ARCodeCat& cat = *it;
|
ARCodeCat& cat = *it;
|
||||||
|
|
||||||
if (it != Categories.begin()) fprintf(f, "\r\n");
|
if (it != Categories.begin()) fprintf(f, "\r\n");
|
||||||
fprintf(f, "CAT %s\r\n\r\n", cat.Name);
|
fprintf(f, "CAT %s\r\n\r\n", cat.Name.c_str());
|
||||||
|
|
||||||
for (ARCodeList::iterator jt = cat.Codes.begin(); jt != cat.Codes.end(); jt++)
|
for (ARCodeList::iterator jt = cat.Codes.begin(); jt != cat.Codes.end(); jt++)
|
||||||
{
|
{
|
||||||
ARCode& code = *jt;
|
ARCode& code = *jt;
|
||||||
fprintf(f, "CODE %d %s\r\n", code.Enabled, code.Name);
|
fprintf(f, "CODE %d %s\r\n", code.Enabled, code.Name.c_str());
|
||||||
|
|
||||||
for (u32 i = 0; i < code.CodeLen; i+=2)
|
for (u32 i = 0; i < code.CodeLen; i+=2)
|
||||||
{
|
{
|
||||||
|
@ -19,13 +19,14 @@
|
|||||||
#ifndef ARCODEFILE_H
|
#ifndef ARCODEFILE_H
|
||||||
#define ARCODEFILE_H
|
#define ARCODEFILE_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
struct ARCode
|
struct ARCode
|
||||||
{
|
{
|
||||||
char Name[128];
|
std::string Name;
|
||||||
bool Enabled;
|
bool Enabled;
|
||||||
u32 CodeLen;
|
u32 CodeLen;
|
||||||
u32 Code[2*64];
|
u32 Code[2*64];
|
||||||
@ -35,7 +36,7 @@ typedef std::list<ARCode> ARCodeList;
|
|||||||
|
|
||||||
struct ARCodeCat
|
struct ARCodeCat
|
||||||
{
|
{
|
||||||
char Name[128];
|
std::string Name;
|
||||||
ARCodeList Codes;
|
ARCodeList Codes;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ typedef std::list<ARCodeCat> ARCodeCatList;
|
|||||||
class ARCodeFile
|
class ARCodeFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ARCodeFile(const char* filename);
|
ARCodeFile(std::string filename);
|
||||||
~ARCodeFile();
|
~ARCodeFile();
|
||||||
|
|
||||||
bool Error;
|
bool Error;
|
||||||
@ -56,7 +57,7 @@ public:
|
|||||||
ARCodeCatList Categories;
|
ARCodeCatList Categories;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char Filename[1024];
|
std::string Filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ARCODEFILE_H
|
#endif // ARCODEFILE_H
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
class ROMSource
|
class ROMSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~ROMSource();
|
virtual ~ROMSource() = 0;
|
||||||
|
|
||||||
//
|
//virtual
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ROMSOURCE_H
|
#endif // ROMSOURCE_H
|
||||||
|
@ -55,7 +55,7 @@ CheatsDialog::CheatsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Cheats
|
|||||||
{
|
{
|
||||||
ARCodeCat& cat = *i;
|
ARCodeCat& cat = *i;
|
||||||
|
|
||||||
QStandardItem* catitem = new QStandardItem(cat.Name);
|
QStandardItem* catitem = new QStandardItem(QString::fromStdString(cat.Name));
|
||||||
catitem->setEditable(true);
|
catitem->setEditable(true);
|
||||||
catitem->setData(QVariant::fromValue(i));
|
catitem->setData(QVariant::fromValue(i));
|
||||||
root->appendRow(catitem);
|
root->appendRow(catitem);
|
||||||
@ -64,7 +64,7 @@ CheatsDialog::CheatsDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Cheats
|
|||||||
{
|
{
|
||||||
ARCode& code = *j;
|
ARCode& code = *j;
|
||||||
|
|
||||||
QStandardItem* codeitem = new QStandardItem(code.Name);
|
QStandardItem* codeitem = new QStandardItem(QString::fromStdString(code.Name));
|
||||||
codeitem->setEditable(true);
|
codeitem->setEditable(true);
|
||||||
codeitem->setCheckable(true);
|
codeitem->setCheckable(true);
|
||||||
codeitem->setCheckState(code.Enabled ? Qt::Checked : Qt::Unchecked);
|
codeitem->setCheckState(code.Enabled ? Qt::Checked : Qt::Unchecked);
|
||||||
@ -113,13 +113,12 @@ void CheatsDialog::on_btnNewCat_clicked()
|
|||||||
|
|
||||||
ARCodeCat cat;
|
ARCodeCat cat;
|
||||||
cat.Codes.clear();
|
cat.Codes.clear();
|
||||||
memset(cat.Name, 0, 128);
|
cat.Name = "(new category)";
|
||||||
strncpy(cat.Name, "(new category)", 127);
|
|
||||||
|
|
||||||
codeFile->Categories.push_back(cat);
|
codeFile->Categories.push_back(cat);
|
||||||
ARCodeCatList::iterator id = codeFile->Categories.end(); id--;
|
ARCodeCatList::iterator id = codeFile->Categories.end(); id--;
|
||||||
|
|
||||||
QStandardItem* catitem = new QStandardItem(cat.Name);
|
QStandardItem* catitem = new QStandardItem(QString::fromStdString(cat.Name));
|
||||||
catitem->setEditable(true);
|
catitem->setEditable(true);
|
||||||
catitem->setData(QVariant::fromValue(id));
|
catitem->setData(QVariant::fromValue(id));
|
||||||
root->appendRow(catitem);
|
root->appendRow(catitem);
|
||||||
@ -160,8 +159,7 @@ void CheatsDialog::on_btnNewARCode_clicked()
|
|||||||
ARCodeCat& cat = *it_cat;
|
ARCodeCat& cat = *it_cat;
|
||||||
|
|
||||||
ARCode code;
|
ARCode code;
|
||||||
memset(code.Name, 0, 128);
|
code.Name = "(new AR code)";
|
||||||
strncpy(code.Name, "(new AR code)", 127);
|
|
||||||
code.Enabled = true;
|
code.Enabled = true;
|
||||||
code.CodeLen = 0;
|
code.CodeLen = 0;
|
||||||
memset(code.Code, 0, sizeof(code.Code));
|
memset(code.Code, 0, sizeof(code.Code));
|
||||||
@ -169,7 +167,7 @@ void CheatsDialog::on_btnNewARCode_clicked()
|
|||||||
cat.Codes.push_back(code);
|
cat.Codes.push_back(code);
|
||||||
ARCodeList::iterator id = cat.Codes.end(); id--;
|
ARCodeList::iterator id = cat.Codes.end(); id--;
|
||||||
|
|
||||||
QStandardItem* codeitem = new QStandardItem(code.Name);
|
QStandardItem* codeitem = new QStandardItem(QString::fromStdString(code.Name));
|
||||||
codeitem->setEditable(true);
|
codeitem->setEditable(true);
|
||||||
codeitem->setCheckable(true);
|
codeitem->setCheckable(true);
|
||||||
codeitem->setCheckState(code.Enabled ? Qt::Checked : Qt::Unchecked);
|
codeitem->setCheckState(code.Enabled ? Qt::Checked : Qt::Unchecked);
|
||||||
@ -275,13 +273,12 @@ void CheatsDialog::onCheatEntryModified(QStandardItem* item)
|
|||||||
|
|
||||||
if (item->text().isEmpty())
|
if (item->text().isEmpty())
|
||||||
{
|
{
|
||||||
QString oldname = QString(cat.Name);
|
QString oldname = QString::fromStdString(cat.Name);
|
||||||
item->setText(oldname.isEmpty() ? "(blank category name?)" : oldname);
|
item->setText(oldname.isEmpty() ? "(blank category name?)" : oldname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(cat.Name, item->text().toStdString().c_str(), 127);
|
cat.Name = item->text().toStdString();
|
||||||
cat.Name[127] = '\0';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (data.canConvert<ARCodeList::iterator>())
|
else if (data.canConvert<ARCodeList::iterator>())
|
||||||
@ -290,13 +287,12 @@ void CheatsDialog::onCheatEntryModified(QStandardItem* item)
|
|||||||
|
|
||||||
if (item->text().isEmpty())
|
if (item->text().isEmpty())
|
||||||
{
|
{
|
||||||
QString oldname = QString(code.Name);
|
QString oldname = QString::fromStdString(code.Name);
|
||||||
item->setText(oldname.isEmpty() ? "(blank code name?)" : oldname);
|
item->setText(oldname.isEmpty() ? "(blank code name?)" : oldname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(code.Name, item->text().toStdString().c_str(), 127);
|
code.Name = item->text().toStdString();
|
||||||
code.Name[127] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
code.Enabled = (item->checkState() == Qt::Checked);
|
code.Enabled = (item->checkState() == Qt::Checked);
|
||||||
|
Reference in New Issue
Block a user