| ... | ... |
@@ -56,7 +56,8 @@ INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0) |
| 56 | 56 |
|
| 57 | 57 |
void INFOEntryPLAYER::Read(PseudoFile &file) |
| 58 | 58 |
{
|
| 59 |
- file.ReadLE<std::uint16_t>(); // maxSeqs |
|
| 60 |
- this->channelMask = file.ReadLE<std::uint16_t>(); |
|
| 59 |
+ file.ReadLE<std::uint8_t>(); // maxSeqs |
|
| 60 |
+ this->channelMask = file.ReadLE<std::uint8_t>(); |
|
| 61 |
+ file.ReadLE<std::uint8_t>(); // padding |
|
| 61 | 62 |
file.ReadLE<std::uint32_t>(); // heapSize |
| 62 | 63 |
} |
| ... | ... |
@@ -17,7 +17,8 @@ INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0), ply(0) |
| 17 | 17 |
|
| 18 | 18 |
void INFOEntrySEQ::Read(PseudoFile &file) |
| 19 | 19 |
{
|
| 20 |
- this->fileID = file.ReadLE<std::uint32_t>(); |
|
| 20 |
+ this->fileID = file.ReadLE<std::uint16_t>(); |
|
| 21 |
+ file.ReadLE<std::uint16_t>(); // unknown |
|
| 21 | 22 |
this->bank = file.ReadLE<std::uint16_t>(); |
| 22 | 23 |
this->vol = file.ReadLE<std::uint8_t>(); |
| 23 | 24 |
if (!this->vol) |
| ... | ... |
@@ -34,7 +35,8 @@ INFOEntryBANK::INFOEntryBANK() : fileID(0) |
| 34 | 35 |
|
| 35 | 36 |
void INFOEntryBANK::Read(PseudoFile &file) |
| 36 | 37 |
{
|
| 37 |
- this->fileID = file.ReadLE<std::uint32_t>(); |
|
| 38 |
+ this->fileID = file.ReadLE<std::uint16_t>(); |
|
| 39 |
+ file.ReadLE<std::uint16_t>(); // unknown |
|
| 38 | 40 |
file.ReadLE(this->waveArc); |
| 39 | 41 |
} |
| 40 | 42 |
|
| ... | ... |
@@ -44,7 +46,8 @@ INFOEntryWAVEARC::INFOEntryWAVEARC() : fileID(0) |
| 44 | 46 |
|
| 45 | 47 |
void INFOEntryWAVEARC::Read(PseudoFile &file) |
| 46 | 48 |
{
|
| 47 |
- this->fileID = file.ReadLE<std::uint32_t>(); |
|
| 49 |
+ this->fileID = file.ReadLE<std::uint16_t>(); |
|
| 50 |
+ file.ReadLE<std::uint16_t>(); // unknown |
|
| 48 | 51 |
} |
| 49 | 52 |
|
| 50 | 53 |
INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0) |
* 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().
| ... | ... |
@@ -6,7 +6,10 @@ |
| 6 | 6 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
| 7 | 7 |
*/ |
| 8 | 8 |
|
| 9 |
+#include <algorithm> |
|
| 10 |
+#include <cstdint> |
|
| 9 | 11 |
#include "INFOEntry.h" |
| 12 |
+#include "common.h" |
|
| 10 | 13 |
|
| 11 | 14 |
INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0), ply(0) |
| 12 | 15 |
{
|
| ... | ... |
@@ -14,14 +17,14 @@ INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0), ply(0) |
| 14 | 17 |
|
| 15 | 18 |
void INFOEntrySEQ::Read(PseudoFile &file) |
| 16 | 19 |
{
|
| 17 |
- this->fileID = file.ReadLE<uint32_t>(); |
|
| 18 |
- this->bank = file.ReadLE<uint16_t>(); |
|
| 19 |
- this->vol = file.ReadLE<uint8_t>(); |
|
| 20 |
+ this->fileID = file.ReadLE<std::uint32_t>(); |
|
| 21 |
+ this->bank = file.ReadLE<std::uint16_t>(); |
|
| 22 |
+ this->vol = file.ReadLE<std::uint8_t>(); |
|
| 20 | 23 |
if (!this->vol) |
| 21 | 24 |
this->vol = 0x7F; // Prevents nothing for volume |
| 22 |
- file.ReadLE<uint8_t>(); // cpr |
|
| 23 |
- file.ReadLE<uint8_t>(); // ppr |
|
| 24 |
- this->ply = file.ReadLE<uint8_t>(); |
|
| 25 |
+ file.ReadLE<std::uint8_t>(); // cpr |
|
| 26 |
+ file.ReadLE<std::uint8_t>(); // ppr |
|
| 27 |
+ this->ply = file.ReadLE<std::uint8_t>(); |
|
| 25 | 28 |
} |
| 26 | 29 |
|
| 27 | 30 |
INFOEntryBANK::INFOEntryBANK() : fileID(0) |
| ... | ... |
@@ -31,7 +34,7 @@ INFOEntryBANK::INFOEntryBANK() : fileID(0) |
| 31 | 34 |
|
| 32 | 35 |
void INFOEntryBANK::Read(PseudoFile &file) |
| 33 | 36 |
{
|
| 34 |
- this->fileID = file.ReadLE<uint32_t>(); |
|
| 37 |
+ this->fileID = file.ReadLE<std::uint32_t>(); |
|
| 35 | 38 |
file.ReadLE(this->waveArc); |
| 36 | 39 |
} |
| 37 | 40 |
|
| ... | ... |
@@ -41,7 +44,7 @@ INFOEntryWAVEARC::INFOEntryWAVEARC() : fileID(0) |
| 41 | 44 |
|
| 42 | 45 |
void INFOEntryWAVEARC::Read(PseudoFile &file) |
| 43 | 46 |
{
|
| 44 |
- this->fileID = file.ReadLE<uint32_t>(); |
|
| 47 |
+ this->fileID = file.ReadLE<std::uint32_t>(); |
|
| 45 | 48 |
} |
| 46 | 49 |
|
| 47 | 50 |
INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0) |
| ... | ... |
@@ -50,7 +53,7 @@ INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0) |
| 50 | 53 |
|
| 51 | 54 |
void INFOEntryPLAYER::Read(PseudoFile &file) |
| 52 | 55 |
{
|
| 53 |
- file.ReadLE<uint16_t>(); // maxSeqs |
|
| 54 |
- this->channelMask = file.ReadLE<uint16_t>(); |
|
| 55 |
- file.ReadLE<uint32_t>(); // heapSize |
|
| 56 |
+ file.ReadLE<std::uint16_t>(); // maxSeqs |
|
| 57 |
+ this->channelMask = file.ReadLE<std::uint16_t>(); |
|
| 58 |
+ file.ReadLE<std::uint32_t>(); // heapSize |
|
| 56 | 59 |
} |
| ... | ... |
@@ -14,8 +14,7 @@ INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0), ply(0) |
| 14 | 14 |
|
| 15 | 15 |
void INFOEntrySEQ::Read(PseudoFile &file) |
| 16 | 16 |
{
|
| 17 |
- this->fileID = file.ReadLE<uint16_t>(); |
|
| 18 |
- file.ReadLE<uint16_t>(); // unknown |
|
| 17 |
+ this->fileID = file.ReadLE<uint32_t>(); |
|
| 19 | 18 |
this->bank = file.ReadLE<uint16_t>(); |
| 20 | 19 |
this->vol = file.ReadLE<uint8_t>(); |
| 21 | 20 |
if (!this->vol) |
| ... | ... |
@@ -32,8 +31,7 @@ INFOEntryBANK::INFOEntryBANK() : fileID(0) |
| 32 | 31 |
|
| 33 | 32 |
void INFOEntryBANK::Read(PseudoFile &file) |
| 34 | 33 |
{
|
| 35 |
- this->fileID = file.ReadLE<uint16_t>(); |
|
| 36 |
- file.ReadLE<uint16_t>(); // unknown |
|
| 34 |
+ this->fileID = file.ReadLE<uint32_t>(); |
|
| 37 | 35 |
file.ReadLE(this->waveArc); |
| 38 | 36 |
} |
| 39 | 37 |
|
| ... | ... |
@@ -43,8 +41,7 @@ INFOEntryWAVEARC::INFOEntryWAVEARC() : fileID(0) |
| 43 | 41 |
|
| 44 | 42 |
void INFOEntryWAVEARC::Read(PseudoFile &file) |
| 45 | 43 |
{
|
| 46 |
- this->fileID = file.ReadLE<uint16_t>(); |
|
| 47 |
- file.ReadLE<uint16_t>(); // unknown |
|
| 44 |
+ this->fileID = file.ReadLE<uint32_t>(); |
|
| 48 | 45 |
} |
| 49 | 46 |
|
| 50 | 47 |
INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0) |
(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 INFO Entry structures |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2014-10-25 |
|
| 5 | 4 |
* |
| 6 | 5 |
* Nintendo DS Nitro Composer (SDAT) Specification document found at |
| 7 | 6 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
Backwards compatibility is kept by treating the lack of PLAYER info as
if all channels are able to be allocated.
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - SDAT INFO Entry structures |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-03-21 |
|
| 4 |
+ * Last modification on 2014-10-25 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Nintendo DS Nitro Composer (SDAT) Specification document found at |
| 7 | 7 |
* http://www.feshrine.net/hacking/doc/nds-sdat.html |
| ... | ... |
@@ -9,7 +9,7 @@ |
| 9 | 9 |
|
| 10 | 10 |
#include "INFOEntry.h" |
| 11 | 11 |
|
| 12 |
-INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0) |
|
| 12 |
+INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0), ply(0) |
|
| 13 | 13 |
{
|
| 14 | 14 |
} |
| 15 | 15 |
|
| ... | ... |
@@ -23,7 +23,7 @@ void INFOEntrySEQ::Read(PseudoFile &file) |
| 23 | 23 |
this->vol = 0x7F; // Prevents nothing for volume |
| 24 | 24 |
file.ReadLE<uint8_t>(); // cpr |
| 25 | 25 |
file.ReadLE<uint8_t>(); // ppr |
| 26 |
- file.ReadLE<uint8_t>(); // ply |
|
| 26 |
+ this->ply = file.ReadLE<uint8_t>(); |
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
INFOEntryBANK::INFOEntryBANK() : fileID(0) |
| ... | ... |
@@ -45,4 +45,16 @@ INFOEntryWAVEARC::INFOEntryWAVEARC() : fileID(0) |
| 45 | 45 |
void INFOEntryWAVEARC::Read(PseudoFile &file) |
| 46 | 46 |
{
|
| 47 | 47 |
this->fileID = file.ReadLE<uint16_t>(); |
| 48 |
+ file.ReadLE<uint16_t>(); // unknown |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+INFOEntryPLAYER::INFOEntryPLAYER() : channelMask(0) |
|
| 52 |
+{
|
|
| 53 |
+} |
|
| 54 |
+ |
|
| 55 |
+void INFOEntryPLAYER::Read(PseudoFile &file) |
|
| 56 |
+{
|
|
| 57 |
+ file.ReadLE<uint16_t>(); // maxSeqs |
|
| 58 |
+ this->channelMask = file.ReadLE<uint16_t>(); |
|
| 59 |
+ file.ReadLE<uint32_t>(); // heapSize |
|
| 48 | 60 |
} |
| ... | ... |
@@ -9,7 +9,7 @@ |
| 9 | 9 |
|
| 10 | 10 |
#include "INFOEntry.h" |
| 11 | 11 |
|
| 12 |
-INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0) |
|
| 12 |
+INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0), vol(0) |
|
| 13 | 13 |
{
|
| 14 | 14 |
} |
| 15 | 15 |
|
| ... | ... |
@@ -18,7 +18,9 @@ void INFOEntrySEQ::Read(PseudoFile &file) |
| 18 | 18 |
this->fileID = file.ReadLE<uint16_t>(); |
| 19 | 19 |
file.ReadLE<uint16_t>(); // unknown |
| 20 | 20 |
this->bank = file.ReadLE<uint16_t>(); |
| 21 |
- file.ReadLE<uint8_t>(); // vol |
|
| 21 |
+ this->vol = file.ReadLE<uint8_t>(); |
|
| 22 |
+ if (!this->vol) |
|
| 23 |
+ this->vol = 0x7F; // Prevents nothing for volume |
|
| 22 | 24 |
file.ReadLE<uint8_t>(); // cpr |
| 23 | 25 |
file.ReadLE<uint8_t>(); // ppr |
| 24 | 26 |
file.ReadLE<uint8_t>(); // ply |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,46 @@ |
| 1 |
+/* |
|
| 2 |
+ * SSEQ Player - SDAT INFO Entry structures |
|
| 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 "INFOEntry.h" |
|
| 11 |
+ |
|
| 12 |
+INFOEntrySEQ::INFOEntrySEQ() : fileID(0), bank(0) |
|
| 13 |
+{
|
|
| 14 |
+} |
|
| 15 |
+ |
|
| 16 |
+void INFOEntrySEQ::Read(PseudoFile &file) |
|
| 17 |
+{
|
|
| 18 |
+ this->fileID = file.ReadLE<uint16_t>(); |
|
| 19 |
+ file.ReadLE<uint16_t>(); // unknown |
|
| 20 |
+ this->bank = file.ReadLE<uint16_t>(); |
|
| 21 |
+ file.ReadLE<uint8_t>(); // vol |
|
| 22 |
+ file.ReadLE<uint8_t>(); // cpr |
|
| 23 |
+ file.ReadLE<uint8_t>(); // ppr |
|
| 24 |
+ file.ReadLE<uint8_t>(); // ply |
|
| 25 |
+} |
|
| 26 |
+ |
|
| 27 |
+INFOEntryBANK::INFOEntryBANK() : fileID(0) |
|
| 28 |
+{
|
|
| 29 |
+ memset(this->waveArc, 0, sizeof(this->waveArc)); |
|
| 30 |
+} |
|
| 31 |
+ |
|
| 32 |
+void INFOEntryBANK::Read(PseudoFile &file) |
|
| 33 |
+{
|
|
| 34 |
+ this->fileID = file.ReadLE<uint16_t>(); |
|
| 35 |
+ file.ReadLE<uint16_t>(); // unknown |
|
| 36 |
+ file.ReadLE(this->waveArc); |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+INFOEntryWAVEARC::INFOEntryWAVEARC() : fileID(0) |
|
| 40 |
+{
|
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+void INFOEntryWAVEARC::Read(PseudoFile &file) |
|
| 44 |
+{
|
|
| 45 |
+ this->fileID = file.ReadLE<uint16_t>(); |
|
| 46 |
+} |