summaryrefslogtreecommitdiff
path: root/lib/nes/util
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-01-26 23:19:56 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-01-26 23:19:56 +0100
commit430a246fe81d7eab6823bf6ca4562fd1e99f2a5d (patch)
tree75c5f4e8eeeb1e5f25c866e828440e5c493bed8b /lib/nes/util
parentd1f4b65eafe9c41ecca7bbe8026ec0a693c1ecda (diff)
refactor mappers
Diffstat (limited to 'lib/nes/util')
-rw-r--r--lib/nes/util/CMakeLists.txt3
-rw-r--r--lib/nes/util/status.hh36
2 files changed, 38 insertions, 1 deletions
diff --git a/lib/nes/util/CMakeLists.txt b/lib/nes/util/CMakeLists.txt
index fdbc939..6f5c112 100644
--- a/lib/nes/util/CMakeLists.txt
+++ b/lib/nes/util/CMakeLists.txt
@@ -7,4 +7,5 @@ target_sources(
debug.hh
display.hh
rgb.hh
- snapshot.hh) \ No newline at end of file
+ snapshot.hh
+ status.hh) \ No newline at end of file
diff --git a/lib/nes/util/status.hh b/lib/nes/util/status.hh
new file mode 100644
index 0000000..64f5969
--- /dev/null
+++ b/lib/nes/util/status.hh
@@ -0,0 +1,36 @@
+#pragma once
+
+namespace nes
+{
+ /// A status code.
+ enum class status
+ {
+ success,
+ error_uninitialized,
+ error_system_error,
+ error_invalid_ines_data,
+ error_unsupported_mapper,
+ error_unsupported_instruction,
+ };
+
+ constexpr auto to_string(status const status) -> char const*
+ {
+ switch (status)
+ {
+ case status::success:
+ return "Success";
+ case status::error_uninitialized:
+ return "Uninitialized";
+ case status::error_system_error:
+ return "System error";
+ case status::error_invalid_ines_data:
+ return "Invalid iNES data";
+ case status::error_unsupported_mapper:
+ return "Unsupported mapper";
+ case status::error_unsupported_instruction:
+ return "Unsupported instruction";
+ }
+
+ return "(invalid)";
+ }
+} // namespace nes \ No newline at end of file