diff --git a/include/stratosphere/mitm/mitm_session.hpp b/include/stratosphere/mitm/mitm_session.hpp
index 86fa06ae..73a444d1 100644
--- a/include/stratosphere/mitm/mitm_session.hpp
+++ b/include/stratosphere/mitm/mitm_session.hpp
@@ -22,9 +22,6 @@
#include "../results.hpp"
#include "mitm_query_service.hpp"
-/* TODO: Change this. */
-#define RESULT_FORWARD_TO_SESSION 0xCAFEFC
-
class MitmSession final : public ServiceSession {
private:
/* This will be for the actual session. */
@@ -157,7 +154,7 @@ class MitmSession final : public ServiceSession {
}
}
- if (!found_entry || rc == RESULT_FORWARD_TO_SESSION) {
+ if (!found_entry || rc == ResultAtmosphereMitmShouldForwardToSession) {
memcpy(armGetTls(), this->backup_tls, sizeof(this->backup_tls));
rc = ForwardRequest(ctx);
}
diff --git a/include/stratosphere/results.hpp b/include/stratosphere/results.hpp
index 660c97a0..1428430f 100644
--- a/include/stratosphere/results.hpp
+++ b/include/stratosphere/results.hpp
@@ -16,6 +16,7 @@
#pragma once
+/* Official. */
#include "results/creport_results.hpp"
#include "results/debug_results.hpp"
#include "results/dmnt_results.hpp"
@@ -28,4 +29,7 @@
#include "results/sf_results.hpp"
#include "results/sm_results.hpp"
+/* Unofficial. */
+#include "results/ams_results.hpp"
+
static constexpr Result ResultSuccess = 0;
diff --git a/include/stratosphere/results/ams_results.hpp b/include/stratosphere/results/ams_results.hpp
new file mode 100644
index 00000000..a4ff024d
--- /dev/null
+++ b/include/stratosphere/results/ams_results.hpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 Atmosphère-NX
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+#include
+
+/* Please note: These results are all custom, and not official. */
+
+static constexpr u32 Module_Atmosphere = 444;
+
+/* Result 1-1000 reserved for Atmosphere. */
+static constexpr Result ResultAtmosphereExosphereNotPresent = MAKERESULT(Module_Atmosphere, 1);
+static constexpr Result ResultAtmosphereVersionMismatch = MAKERESULT(Module_Atmosphere, 2);
+
+/* Results 1000-2000 reserved for Atmosphere Mitm. */
+static constexpr Result ResultAtmosphereMitmShouldForwardToSession = MAKERESULT(Module_Atmosphere, 1000);
+static constexpr Result ResultAtmosphereMitmProcessNotAssociated = MAKERESULT(Module_Atmosphere, 1100);
+
diff --git a/include/stratosphere/version_check.hpp b/include/stratosphere/version_check.hpp
index 668d429b..4fc46c4b 100644
--- a/include/stratosphere/version_check.hpp
+++ b/include/stratosphere/version_check.hpp
@@ -17,11 +17,13 @@
#pragma once
#include
+#include "results.hpp"
+
static inline void GetAtmosphereApiVersion(u32 *major, u32 *minor, u32 *micro, u32 *target_fw, u32 *mkey_rev) {
/* Check for exosphere API compatibility. */
u64 exosphere_cfg;
if (R_FAILED(SmcGetConfig((SplConfigItem)65000, &exosphere_cfg))) {
- fatalSimple(0xCAFE << 4 | 0xE);
+ fatalSimple(ResultAtmosphereExosphereNotPresent);
}
if (mkey_rev) {
@@ -54,7 +56,7 @@ static inline void CheckAtmosphereVersion(u32 expected_major, u32 expected_minor
GetAtmosphereApiVersion(&major, &minor, µ, nullptr, nullptr);
if (MakeAtmosphereVersion(major, minor, micro) < MakeAtmosphereVersion(expected_major, expected_minor, expected_micro)) {
- fatalSimple(0xCAFE << 4 | 0xF);
+ fatalSimple(ResultAtmosphereVersionMismatch);
}
}
diff --git a/source/mitm_query_service.cpp b/source/mitm_query_service.cpp
index eb365457..f6b1dd86 100644
--- a/source/mitm_query_service.cpp
+++ b/source/mitm_query_service.cpp
@@ -23,7 +23,7 @@ static std::vector g_known_tids;
static HosMutex g_pid_tid_mutex;
Result MitmQueryUtils::GetAssociatedTidForPid(u64 pid, u64 *tid) {
- Result rc = 0xCAFE;
+ Result rc = ResultAtmosphereMitmProcessNotAssociated;
std::scoped_lock lk{g_pid_tid_mutex};
for (unsigned int i = 0; i < g_known_pids.size(); i++) {
if (g_known_pids[i] == pid) {