mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 00:54:23 -04:00
htcs: hook manager up to (unimplemented) manager impl
This commit is contained in:
parent
61929d6e21
commit
1541985222
12 changed files with 493 additions and 5 deletions
44
libraries/libstratosphere/source/htcs/impl/htcs_util.cpp
Normal file
44
libraries/libstratosphere/source/htcs/impl/htcs_util.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 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/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "htcs_util.hpp"
|
||||
|
||||
namespace ams::htcs::impl {
|
||||
|
||||
s32 ConvertResultToErrorCode(const Result result) {
|
||||
/* Convert success. */
|
||||
if (R_SUCCEEDED(result)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
R_TRY_CATCH(result) {
|
||||
R_CATCH(htclow::ResultNonBlockingReceiveFailed) { return HTCS_EWOULDBLOCK; }
|
||||
R_CATCH(htcs::ResultInvalidHandle) { return HTCS_EBADF; }
|
||||
R_CATCH(htc::ResultUnknown2001) { return HTCS_EINVAL; }
|
||||
R_CATCH(htc::ResultUnknown2101) { return HTCS_EMFILE; }
|
||||
R_CATCH(htc::ResultUnknown2021) { return HTCS_EINTR; }
|
||||
R_CATCH(htc::ResultInvalidTaskId) { return HTCS_EINTR; }
|
||||
R_CATCH(htc::ResultCancelled) { return HTCS_EINTR; }
|
||||
R_CATCH(htc::ResultUnknown2033) { return HTCS_ENETDOWN; }
|
||||
R_CATCH(htclow::ResultConnectionFailure) { return HTCS_ENETDOWN; }
|
||||
R_CATCH(htclow::ResultChannelNotExist) { return HTCS_ENOTCONN; }
|
||||
R_CATCH_ALL() { return HTCS_EUNKNOWN; }
|
||||
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
|
||||
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue