Browse code

Various changes:

* 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().

Naram Qashat authored on 2021/03/21 03:16:45
Showing 1 changed files
... ...
@@ -8,18 +8,20 @@
8 8
 
9 9
 #include <stdexcept>
10 10
 #include <vector>
11
+#include <cstdint>
11 12
 #include "INFOSection.h"
13
+#include "common.h"
12 14
 
13 15
 template<typename T> INFORecord<T>::INFORecord() : entries()
14 16
 {
15 17
 }
16 18
 
17
-template<typename T> void INFORecord<T>::Read(PseudoFile &file, uint32_t startOffset)
19
+template<typename T> void INFORecord<T>::Read(PseudoFile &file, std::uint32_t startOffset)
18 20
 {
19
-	uint32_t count = file.ReadLE<uint32_t>();
20
-	auto entryOffsets = std::vector<uint32_t>(count);
21
+	std::uint32_t count = file.ReadLE<std::uint32_t>();
22
+	auto entryOffsets = std::vector<std::uint32_t>(count);
21 23
 	file.ReadLE(entryOffsets);
22
-	for (uint32_t i = 0; i < count; ++i)
24
+	for (std::uint32_t i = 0; i < count; ++i)
23 25
 		if (entryOffsets[i])
24 26
 		{
25 27
 			file.pos = startOffset + entryOffsets[i];
... ...
@@ -34,13 +36,13 @@ INFOSection::INFOSection() : SEQrecord(), BANKrecord(), WAVEARCrecord(), PLAYERr
34 36
 
35 37
 void INFOSection::Read(PseudoFile &file)
36 38
 {
37
-	uint32_t startOfINFO = file.pos;
38
-	int8_t type[4];
39
+	std::uint32_t startOfINFO = file.pos;
40
+	std::int8_t type[4];
39 41
 	file.ReadLE(type);
40 42
 	if (!VerifyHeader(type, "INFO"))
41 43
 		throw std::runtime_error("SDAT INFO Section invalid");
42
-	file.ReadLE<uint32_t>(); // size
43
-	uint32_t recordOffsets[8];
44
+	file.ReadLE<std::uint32_t>(); // size
45
+	std::uint32_t recordOffsets[8];
44 46
 	file.ReadLE(recordOffsets);
45 47
 	if (recordOffsets[REC_SEQ])
46 48
 	{
Browse code

Remove last modification date from files.

(I never remember to update these and besides, GitHub history can show when they were last modified.)

Naram Qashat authored on 2021/03/19 10:58:12
Showing 1 changed files
... ...
@@ -1,7 +1,6 @@
1 1
 /*
2 2
  * SSEQ Player - SDAT INFO Section 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
Browse code

[NCSF] <stdexcept> is actually needed...

(It probably never triggered any errors in the past because of it being implicitly included by some other header file.)

Naram Qashat authored on 2020/08/07 23:18:16
Showing 1 changed files
... ...
@@ -7,6 +7,7 @@
7 7
  * http://www.feshrine.net/hacking/doc/nds-sdat.html
8 8
  */
9 9
 
10
+#include <stdexcept>
10 11
 #include <vector>
11 12
 #include "INFOSection.h"
12 13
 
Browse code

[NCSF] Utilize the PLAYER blocks in the SDAT if they exist.

Backwards compatibility is kept by treating the lack of PLAYER info as
if all channels are able to be allocated.

Naram Qashat authored on 2014/10/25 23:12:53
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - SDAT INFO Section structures
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-25
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
... ...
@@ -28,7 +28,7 @@ template<typename T> void INFORecord<T>::Read(PseudoFile &file, uint32_t startOf
28 28
 		}
29 29
 }
30 30
 
31
-INFOSection::INFOSection() : SEQrecord(), BANKrecord(), WAVEARCrecord()
31
+INFOSection::INFOSection() : SEQrecord(), BANKrecord(), WAVEARCrecord(), PLAYERrecord()
32 32
 {
33 33
 }
34 34
 
... ...
@@ -57,4 +57,9 @@ void INFOSection::Read(PseudoFile &file)
57 57
 		file.pos = startOfINFO + recordOffsets[REC_WAVEARC];
58 58
 		this->WAVEARCrecord.Read(file, startOfINFO);
59 59
 	}
60
+	if (recordOffsets[REC_PLAYER])
61
+	{
62
+		file.pos = startOfINFO + recordOffsets[REC_PLAYER];
63
+		this->PLAYERrecord.Read(file, startOfINFO);
64
+	}
60 65
 }
Browse code

Import actual code.

Naram Qashat authored on 2013/03/26 02:41:19
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,60 @@
1
+/*
2
+ * SSEQ Player - SDAT INFO Section structures
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ * Last modification on 2013-03-25
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 <vector>
11
+#include "INFOSection.h"
12
+
13
+template<typename T> INFORecord<T>::INFORecord() : entries()
14
+{
15
+}
16
+
17
+template<typename T> void INFORecord<T>::Read(PseudoFile &file, uint32_t startOffset)
18
+{
19
+	uint32_t count = file.ReadLE<uint32_t>();
20
+	auto entryOffsets = std::vector<uint32_t>(count);
21
+	file.ReadLE(entryOffsets);
22
+	for (uint32_t i = 0; i < count; ++i)
23
+		if (entryOffsets[i])
24
+		{
25
+			file.pos = startOffset + entryOffsets[i];
26
+			this->entries[i] = T();
27
+			this->entries[i].Read(file);
28
+		}
29
+}
30
+
31
+INFOSection::INFOSection() : SEQrecord(), BANKrecord(), WAVEARCrecord()
32
+{
33
+}
34
+
35
+void INFOSection::Read(PseudoFile &file)
36
+{
37
+	uint32_t startOfINFO = file.pos;
38
+	int8_t type[4];
39
+	file.ReadLE(type);
40
+	if (!VerifyHeader(type, "INFO"))
41
+		throw std::runtime_error("SDAT INFO Section invalid");
42
+	file.ReadLE<uint32_t>(); // size
43
+	uint32_t recordOffsets[8];
44
+	file.ReadLE(recordOffsets);
45
+	if (recordOffsets[REC_SEQ])
46
+	{
47
+		file.pos = startOfINFO + recordOffsets[REC_SEQ];
48
+		this->SEQrecord.Read(file, startOfINFO);
49
+	}
50
+	if (recordOffsets[REC_BANK])
51
+	{
52
+		file.pos = startOfINFO + recordOffsets[REC_BANK];
53
+		this->BANKrecord.Read(file, startOfINFO);
54
+	}
55
+	if (recordOffsets[REC_WAVEARC])
56
+	{
57
+		file.pos = startOfINFO + recordOffsets[REC_WAVEARC];
58
+		this->WAVEARCrecord.Read(file, startOfINFO);
59
+	}
60
+}