Browse code

Silence various Visual Studio warnings:

* Fix the ones in my code where I could use a proper type or valid casts.
* Ignore the designer-time and compiler-time warnings in vendor code or in my code where I am unable to suppress them via casting.
(Most of these were ignored already before introducing the CMake scripts, because they were in vendor code or were annoying to deal with.)

Naram Qashat authored on 2021/03/29 00:10:11
Showing 1 changed files
... ...
@@ -14,7 +14,7 @@
14 14
 
15 15
 NDSStdHeader::NDSStdHeader() : magic(0)
16 16
 {
17
-	std::fill_n(&this->type[0], 4, 0);
17
+	std::fill_n(&this->type[0], 4, static_cast<std::int8_t>(0));
18 18
 }
19 19
 
20 20
 void NDSStdHeader::Read(PseudoFile &file)
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
... ...
@@ -6,8 +6,11 @@
6 6
  * http://www.feshrine.net/hacking/doc/nds-sdat.html
7 7
  */
8 8
 
9
+#include <algorithm>
9 10
 #include <stdexcept>
11
+#include <cstdint>
10 12
 #include "NDSStdHeader.h"
13
+#include "common.h"
11 14
 
12 15
 NDSStdHeader::NDSStdHeader() : magic(0)
13 16
 {
... ...
@@ -17,13 +20,13 @@ NDSStdHeader::NDSStdHeader() : magic(0)
17 20
 void NDSStdHeader::Read(PseudoFile &file)
18 21
 {
19 22
 	file.ReadLE(this->type);
20
-	this->magic = file.ReadLE<uint32_t>();
21
-	file.ReadLE<uint32_t>(); // file size
22
-	file.ReadLE<uint16_t>(); // structure size
23
-	file.ReadLE<uint16_t>(); // # of blocks
23
+	this->magic = file.ReadLE<std::uint32_t>();
24
+	file.ReadLE<std::uint32_t>(); // file size
25
+	file.ReadLE<std::uint16_t>(); // structure size
26
+	file.ReadLE<std::uint16_t>(); // # of blocks
24 27
 }
25 28
 
26
-void NDSStdHeader::Verify(const std::string &typeToCheck, uint32_t magicToCheck)
29
+void NDSStdHeader::Verify(const std::string &typeToCheck, std::uint32_t magicToCheck)
27 30
 {
28 31
 	if (!VerifyHeader(this->type, typeToCheck) || this->magic != magicToCheck)
29 32
 		throw std::runtime_error("NDS Standard Header for " + typeToCheck + " invalid");
Browse code

Replace memcpy/memset with std::copy_n/std::fill_n.

Naram Qashat authored on 2021/03/19 16:25:21
Showing 1 changed files
... ...
@@ -11,7 +11,7 @@
11 11
 
12 12
 NDSStdHeader::NDSStdHeader() : magic(0)
13 13
 {
14
-	memset(this->type, 0, sizeof(this->type));
14
+	std::fill_n(&this->type[0], 4, 0);
15 15
 }
16 16
 
17 17
 void NDSStdHeader::Read(PseudoFile &file)
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 - Nintendo DS Standard Header structure
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2014-09-17
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

* Fixes for gcc and clang (while they can compile the code, the DLLs made aren't functional, but oh well).

* [2SF] Used more up-to-date asmjit, despite the ugly looking code.

Naram Qashat authored on 2014/09/17 19:51:45
Showing 1 changed files
... ...
@@ -1,12 +1,13 @@
1 1
 /*
2 2
  * SSEQ Player - Nintendo DS Standard Header structure
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-03-21
4
+ * Last modification on 2014-09-17
5 5
  *
6 6
  * Nintendo DS Nitro Composer (SDAT) Specification document found at
7 7
  * http://www.feshrine.net/hacking/doc/nds-sdat.html
8 8
  */
9 9
 
10
+#include <stdexcept>
10 11
 #include "NDSStdHeader.h"
11 12
 
12 13
 NDSStdHeader::NDSStdHeader() : magic(0)
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,30 @@
1
+/*
2
+ * SSEQ Player - Nintendo DS Standard Header 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 "NDSStdHeader.h"
11
+
12
+NDSStdHeader::NDSStdHeader() : magic(0)
13
+{
14
+	memset(this->type, 0, sizeof(this->type));
15
+}
16
+
17
+void NDSStdHeader::Read(PseudoFile &file)
18
+{
19
+	file.ReadLE(this->type);
20
+	this->magic = file.ReadLE<uint32_t>();
21
+	file.ReadLE<uint32_t>(); // file size
22
+	file.ReadLE<uint16_t>(); // structure size
23
+	file.ReadLE<uint16_t>(); // # of blocks
24
+}
25
+
26
+void NDSStdHeader::Verify(const std::string &typeToCheck, uint32_t magicToCheck)
27
+{
28
+	if (!VerifyHeader(this->type, typeToCheck) || this->magic != magicToCheck)
29
+		throw std::runtime_error("NDS Standard Header for " + typeToCheck + " invalid");
30
+}