mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 11:02:45 +02:00
results: Add unofficial atmosphere results header
This commit is contained in:
parent
27164564a1
commit
8d15f82a9b
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
31
include/stratosphere/results/ams_results.hpp
Normal file
31
include/stratosphere/results/ams_results.hpp
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
|
||||
/* 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);
|
||||
|
@ -17,11 +17,13 @@
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ static std::vector<u64> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user