diff options
author | Arisotura <thetotalworm@gmail.com> | 2022-01-07 14:00:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 14:00:43 +0100 |
commit | e665e25bd3ea4b9af932e182b1c93e77b762ccb0 (patch) | |
tree | 06b5ceb336e42868806113cbf1f45add2b56a3e8 /src/ARCodeFile.cpp | |
parent | c4cd9da674bcfb8dca89086ce3ffa2d3b03438eb (diff) |
Custom path support (#1333)
also including:
* getting rid of shitty strings
* all new, cleaner ROM handling code
* base for DSi savestates
* GBA slot addons (for now, memory cart)
Diffstat (limited to 'src/ARCodeFile.cpp')
-rw-r--r-- | src/ARCodeFile.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ARCodeFile.cpp b/src/ARCodeFile.cpp index d79cd39..4e44f06 100644 --- a/src/ARCodeFile.cpp +++ b/src/ARCodeFile.cpp @@ -26,10 +26,9 @@ // TODO: more user-friendly error reporting -ARCodeFile::ARCodeFile(const char* filename) +ARCodeFile::ARCodeFile(std::string filename) { - memset(Filename, 0, sizeof(Filename)); - strncpy(Filename, filename, 1023); + Filename = filename; Error = false; @@ -91,7 +90,7 @@ bool ARCodeFile::Load() if (isincat) Categories.push_back(curcat); isincat = true; - memcpy(curcat.Name, catname, 128); + curcat.Name = catname; curcat.Codes.clear(); } else if (!strncasecmp(start, "CODE", 4)) @@ -118,7 +117,7 @@ bool ARCodeFile::Load() if (isincode) curcat.Codes.push_back(curcode); isincode = true; - memcpy(curcode.Name, codename, 128); + curcode.Name = codename; curcode.Enabled = enable!=0; curcode.CodeLen = 0; } @@ -172,12 +171,12 @@ bool ARCodeFile::Save() ARCodeCat& cat = *it; 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++) { 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) { |