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
... ...
@@ -7,9 +7,13 @@
7 7
  */
8 8
 
9 9
 #include <stdexcept>
10
+#include <string>
10 11
 #include <vector>
11
-#include "SWAR.h"
12
+#include <cstdint>
12 13
 #include "NDSStdHeader.h"
14
+#include "SWAR.h"
15
+#include "SWAV.h"
16
+#include "common.h"
13 17
 
14 18
 SWAR::SWAR(const std::string &fn) : filename(fn), swavs(), info()
15 19
 {
... ...
@@ -17,21 +21,21 @@ SWAR::SWAR(const std::string &fn) : filename(fn), swavs(), info()
17 21
 
18 22
 void SWAR::Read(PseudoFile &file)
19 23
 {
20
-	uint32_t startOfSWAR = file.pos;
24
+	std::uint32_t startOfSWAR = file.pos;
21 25
 	NDSStdHeader header;
22 26
 	header.Read(file);
23 27
 	header.Verify("SWAR", 0x0100FEFF);
24
-	int8_t type[4];
28
+	std::int8_t type[4];
25 29
 	file.ReadLE(type);
26 30
 	if (!VerifyHeader(type, "DATA"))
27 31
 		throw std::runtime_error("SWAR DATA structure invalid");
28
-	file.ReadLE<uint32_t>(); // size
29
-	uint32_t reserved[8];
32
+	file.ReadLE<std::uint32_t>(); // size
33
+	std::uint32_t reserved[8];
30 34
 	file.ReadLE(reserved);
31
-	uint32_t count = file.ReadLE<uint32_t>();
32
-	auto offsets = std::vector<uint32_t>(count);
35
+	std::uint32_t count = file.ReadLE<std::uint32_t>();
36
+	auto offsets = std::vector<std::uint32_t>(count);
33 37
 	file.ReadLE(offsets);
34
-	for (uint32_t i = 0; i < count; ++i)
38
+	for (std::uint32_t i = 0; i < count; ++i)
35 39
 		if (offsets[i])
36 40
 		{
37 41
 			file.pos = startOfSWAR + offsets[i];
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 SWAR (Wave Archive) structures
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-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 "SWAR.h"
12 13
 #include "NDSStdHeader.h"
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,41 @@
1
+/*
2
+ * SSEQ Player - SDAT SWAR (Wave Archive) 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 "SWAR.h"
12
+#include "NDSStdHeader.h"
13
+
14
+SWAR::SWAR(const std::string &fn) : filename(fn), swavs(), info()
15
+{
16
+}
17
+
18
+void SWAR::Read(PseudoFile &file)
19
+{
20
+	uint32_t startOfSWAR = file.pos;
21
+	NDSStdHeader header;
22
+	header.Read(file);
23
+	header.Verify("SWAR", 0x0100FEFF);
24
+	int8_t type[4];
25
+	file.ReadLE(type);
26
+	if (!VerifyHeader(type, "DATA"))
27
+		throw std::runtime_error("SWAR DATA structure invalid");
28
+	file.ReadLE<uint32_t>(); // size
29
+	uint32_t reserved[8];
30
+	file.ReadLE(reserved);
31
+	uint32_t count = file.ReadLE<uint32_t>();
32
+	auto offsets = std::vector<uint32_t>(count);
33
+	file.ReadLE(offsets);
34
+	for (uint32_t i = 0; i < count; ++i)
35
+		if (offsets[i])
36
+		{
37
+			file.pos = startOfSWAR + offsets[i];
38
+			this->swavs[i] = SWAV();
39
+			this->swavs[i].Read(file);
40
+		}
41
+}