* Use enum class instead of enum (except for the enums for the resource IDs, not really necessary there).
* For NCSF specifically, included a function to convert an enum class to its underlying integral type (as this is needed for use with the std::bitset class).
* Cleanup headers so all the ones needed in a file are explicitly included even if they may possibly be included in another header.
* Used forward declarations in a few spots.
* Explicitly namespaced all (u)int*_t uses (this might seem like overkill, but it helps me see when the standard types are being used with a simple search for std::).
* Made sure it all builds with MinGW-w64 as well (both gcc and clang).
* Removed some std::move from DialogBuilder.cpp based on clang's warnings for that.
* Replaced use of std::copy_n on strings in DialogBuilder.cpp with my CopyToString functions that use wcscpy.
* Replaced CHAR_MIN/CHAR_MAX in eqstr.h and ltstr.h with std::numeric_limits<char>::min/max().
| ... | ... |
@@ -7,8 +7,11 @@ |
| 7 | 7 |
*/ |
| 8 | 8 |
|
| 9 | 9 |
#include <stdexcept> |
| 10 |
-#include "SSEQ.h" |
|
| 10 |
+#include <string> |
|
| 11 |
+#include <cstdint> |
|
| 11 | 12 |
#include "NDSStdHeader.h" |
| 13 |
+#include "SSEQ.h" |
|
| 14 |
+#include "common.h" |
|
| 12 | 15 |
|
| 13 | 16 |
SSEQ::SSEQ(const std::string &fn) : filename(fn), data(), bank(nullptr), info() |
| 14 | 17 |
{
|
| ... | ... |
@@ -16,16 +19,16 @@ SSEQ::SSEQ(const std::string &fn) : filename(fn), data(), bank(nullptr), info() |
| 16 | 19 |
|
| 17 | 20 |
void SSEQ::Read(PseudoFile &file) |
| 18 | 21 |
{
|
| 19 |
- uint32_t startOfSSEQ = file.pos; |
|
| 22 |
+ std::uint32_t startOfSSEQ = file.pos; |
|
| 20 | 23 |
NDSStdHeader header; |
| 21 | 24 |
header.Read(file); |
| 22 | 25 |
header.Verify("SSEQ", 0x0100FEFF);
|
| 23 |
- int8_t type[4]; |
|
| 26 |
+ std::int8_t type[4]; |
|
| 24 | 27 |
file.ReadLE(type); |
| 25 | 28 |
if (!VerifyHeader(type, "DATA")) |
| 26 | 29 |
throw std::runtime_error("SSEQ DATA structure invalid");
|
| 27 |
- uint32_t size = file.ReadLE<uint32_t>(); |
|
| 28 |
- uint32_t dataOffset = file.ReadLE<uint32_t>(); |
|
| 30 |
+ std::uint32_t size = file.ReadLE<std::uint32_t>(); |
|
| 31 |
+ std::uint32_t dataOffset = file.ReadLE<std::uint32_t>(); |
|
| 29 | 32 |
this->data.resize(size - 12, 0); |
| 30 | 33 |
file.pos = startOfSSEQ + dataOffset; |
| 31 | 34 |
file.ReadLE(this->data); |
(They were probably holdovers from copying the code from the NCSF creation tools.)
| ... | ... |
@@ -14,23 +14,6 @@ SSEQ::SSEQ(const std::string &fn) : filename(fn), data(), bank(nullptr), info() |
| 14 | 14 |
{
|
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
-SSEQ::SSEQ(const SSEQ &sseq) : filename(sseq.filename), data(sseq.data), bank(sseq.bank), info(sseq.info) |
|
| 18 |
-{
|
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 |
-SSEQ &SSEQ::operator=(const SSEQ &sseq) |
|
| 22 |
-{
|
|
| 23 |
- if (this != &sseq) |
|
| 24 |
- {
|
|
| 25 |
- this->filename = sseq.filename; |
|
| 26 |
- this->data = sseq.data; |
|
| 27 |
- |
|
| 28 |
- this->bank = sseq.bank; |
|
| 29 |
- this->info = sseq.info; |
|
| 30 |
- } |
|
| 31 |
- return *this; |
|
| 32 |
-} |
|
| 33 |
- |
|
| 34 | 17 |
void SSEQ::Read(PseudoFile &file) |
| 35 | 18 |
{
|
| 36 | 19 |
uint32_t startOfSSEQ = file.pos; |
(I never remember to update these and besides, GitHub history can show when they were last modified.)
| ... | ... |
@@ -1,7 +1,6 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - SDAT SSEQ (Sequence) structure |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-30 |
|
| 5 | 4 |
* |
| 6 | 5 |
* Nintendo DS Nitro Composer (SDAT) Specification document found at |
| 7 | 6 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
(It probably never triggered any errors in the past because of it being implicitly included by some other header file.)
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - SDAT SSEQ (Sequence) structure |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-21 |
|
| 4 |
+ * Last modification on 2013-03-30 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Nintendo DS Nitro Composer (SDAT) Specification document found at |
| 7 | 7 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
| ... | ... |
@@ -10,7 +10,7 @@ |
| 10 | 10 |
#include "SSEQ.h" |
| 11 | 11 |
#include "NDSStdHeader.h" |
| 12 | 12 |
|
| 13 |
-SSEQ::SSEQ(const std::string &fn) : filename(fn), data(), bank(NULL), info() |
|
| 13 |
+SSEQ::SSEQ(const std::string &fn) : filename(fn), data(), bank(nullptr), info() |
|
| 14 | 14 |
{
|
| 15 | 15 |
} |
| 16 | 16 |
|
| ... | ... |
@@ -43,7 +43,7 @@ void SSEQ::Read(PseudoFile &file) |
| 43 | 43 |
throw std::runtime_error("SSEQ DATA structure invalid");
|
| 44 | 44 |
uint32_t size = file.ReadLE<uint32_t>(); |
| 45 | 45 |
uint32_t dataOffset = file.ReadLE<uint32_t>(); |
| 46 |
- this->data.resize(size, 0); |
|
| 46 |
+ this->data.resize(size - 12, 0); |
|
| 47 | 47 |
file.pos = startOfSSEQ + dataOffset; |
| 48 | 48 |
file.ReadLE(this->data); |
| 49 | 49 |
} |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,49 @@ |
| 1 |
+/* |
|
| 2 |
+ * SSEQ Player - SDAT SSEQ (Sequence) structure |
|
| 3 |
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
|
| 4 |
+ * Last modification on 2013-03-21 |
|
| 5 |
+ * |
|
| 6 |
+ * Nintendo DS Nitro Composer (SDAT) Specification document found at |
|
| 7 |
+ * http://www.feshrine.net/hacking/doc/nds-sdat.html |
|
| 8 |
+ */ |
|
| 9 |
+ |
|
| 10 |
+#include "SSEQ.h" |
|
| 11 |
+#include "NDSStdHeader.h" |
|
| 12 |
+ |
|
| 13 |
+SSEQ::SSEQ(const std::string &fn) : filename(fn), data(), bank(NULL), info() |
|
| 14 |
+{
|
|
| 15 |
+} |
|
| 16 |
+ |
|
| 17 |
+SSEQ::SSEQ(const SSEQ &sseq) : filename(sseq.filename), data(sseq.data), bank(sseq.bank), info(sseq.info) |
|
| 18 |
+{
|
|
| 19 |
+} |
|
| 20 |
+ |
|
| 21 |
+SSEQ &SSEQ::operator=(const SSEQ &sseq) |
|
| 22 |
+{
|
|
| 23 |
+ if (this != &sseq) |
|
| 24 |
+ {
|
|
| 25 |
+ this->filename = sseq.filename; |
|
| 26 |
+ this->data = sseq.data; |
|
| 27 |
+ |
|
| 28 |
+ this->bank = sseq.bank; |
|
| 29 |
+ this->info = sseq.info; |
|
| 30 |
+ } |
|
| 31 |
+ return *this; |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+void SSEQ::Read(PseudoFile &file) |
|
| 35 |
+{
|
|
| 36 |
+ uint32_t startOfSSEQ = file.pos; |
|
| 37 |
+ NDSStdHeader header; |
|
| 38 |
+ header.Read(file); |
|
| 39 |
+ header.Verify("SSEQ", 0x0100FEFF);
|
|
| 40 |
+ int8_t type[4]; |
|
| 41 |
+ file.ReadLE(type); |
|
| 42 |
+ if (!VerifyHeader(type, "DATA")) |
|
| 43 |
+ throw std::runtime_error("SSEQ DATA structure invalid");
|
|
| 44 |
+ uint32_t size = file.ReadLE<uint32_t>(); |
|
| 45 |
+ uint32_t dataOffset = file.ReadLE<uint32_t>(); |
|
| 46 |
+ this->data.resize(size, 0); |
|
| 47 |
+ file.pos = startOfSSEQ + dataOffset; |
|
| 48 |
+ file.ReadLE(this->data); |
|
| 49 |
+} |