Skip to content

Commit dc09573

Browse files
committed
Use arc for result stuff
1 parent 217d3de commit dc09573

File tree

31 files changed

+110
-160
lines changed

31 files changed

+110
-160
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ SdOut/
99
*.nacp
1010
*.nro
1111
*.lst
12+
*.gen.hpp
1213
.vs/
1314
bin/
1415
obj/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "Atmosphere-libs"]
55
path = libs/Atmosphere-libs
66
url = https://github.com/Atmosphere-NX/Atmosphere-libs
7+
[submodule "arc"]
8+
path = arc
9+
url = https://github.com/XorTroll/arc

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ VERSION := $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)
55

66
export UL_DEFS := -DUL_VERSION=\"$(VERSION)\"
77

8-
.PHONY: all fresh clean pu usystem uloader umenu umanager uscreen
8+
.PHONY: all fresh clean pu arc usystem uloader umenu umanager uscreen
99

10-
all: usystem uloader umenu umanager uscreen
10+
all: arc usystem uloader umenu umanager uscreen
1111

1212
fresh: clean all
1313

1414
pu:
1515
@$(MAKE) -C libs/Plutonium/
1616

17+
arc:
18+
@python arc/arc.py gen_db default+./libs/uCommon/include/ul/ul_Results.rc.hpp
19+
@python arc/arc.py gen_cpp rc UL ./libs/uCommon/include/ul/ul_Results.gen.hpp
20+
1721
clean:
1822
@$(MAKE) clean -C projects/uSystem
1923
@$(MAKE) clean -C projects/uLoader

arc

Submodule arc added at 44cf5de

assets/default/Cursor.xcf

29 KB
Binary file not shown.

assets/uManager.xcf

0 Bytes
Binary file not shown.

libs/uCommon/include/extras/json.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@
1818
#ifndef INCLUDE_NLOHMANN_JSON_HPP_
1919
#define INCLUDE_NLOHMANN_JSON_HPP_
2020

21+
//////////////////////////////////////////////////////////////////////////////////
2122
// Custom config for this project
23+
2224
#include <ul/ul_Result.hpp>
23-
#define JSON_THROW_USER(exception) ::ul::OnAssertionFailed(::ul::res::ResultAssertionFailed, "JSON libraries threw " #exception "...\n")
25+
#define JSON_THROW_USER(exception) ::ul::OnAssertionFailed(::rc::ulaunch::ResultAssertionFailed, "JSON libraries threw " #exception "...\n")
2426
#define JSON_TRY_USER if(true)
2527
#define JSON_CATCH_USER(exception) if(false)
2628
#define JSON_INTERNAL_CATCH_USER(exception) if(false)
2729

30+
//////////////////////////////////////////////////////////////////////////////////
31+
2832
#include <algorithm> // all_of, find, for_each
2933
#include <cstddef> // nullptr_t, ptrdiff_t, size_t
3034
#include <functional> // hash, less

libs/uCommon/include/ul/smi/smi_Protocol.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
#pragma once
33
#include <ul/loader/loader_TargetTypes.hpp>
4-
#include <ul/smi/smi_Results.hpp>
4+
#include <ul/ul_Result.hpp>
55
#include <functional>
66

77
namespace ul::smi {

libs/uCommon/include/ul/smi/smi_Results.hpp

Lines changed: 0 additions & 15 deletions
This file was deleted.

libs/uCommon/include/ul/ul_Result.hpp

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,23 @@
66
#include <stratosphere.hpp>
77
#endif
88

9-
namespace ul {
10-
11-
// All 2380-**** results are from us
12-
13-
constexpr u32 Module = 380;
14-
constexpr u32 SubmoduleOffset = 100;
15-
16-
#define UL_RC_DEFINE_SUBMODULE(val) constexpr u32 Submodule = val
17-
#define UL_RC_DEFINE(name, val) constexpr Result Result ## name = MAKERESULT(Module, Submodule * SubmoduleOffset + val)
9+
#include <ul/ul_Results.gen.hpp>
1810

19-
constexpr Result ResultSuccess = 0;
11+
namespace ul {
2012

21-
/*
22-
23-
Result submodules:
24-
0 -> misc
25-
1 -> smi
26-
2 -> sf (ipc)
27-
3 -> loader
28-
4 -> smi
29-
5 -> util
30-
6 -> menu
31-
32-
*/
13+
using namespace rc;
14+
using namespace rc::ulaunch;
3315

3416
namespace res {
3517

36-
UL_RC_DEFINE_SUBMODULE(0);
37-
38-
UL_RC_DEFINE(AssertionFailed, 1);
39-
UL_RC_DEFINE(InvalidTransform, 2);
40-
4118
template<typename T>
4219
inline ::Result TransformIntoResult(const T t) {
4320
return static_cast<::Result>(t);
4421
}
4522

4623
#ifdef ATMOSPHERE
4724
template<>
48-
inline ::Result TransformIntoResult<ams::Result>(const ams::Result ams_rc) {
25+
inline ::Result TransformIntoResult<::ams::Result>(const ::ams::Result ams_rc) {
4926
return ams_rc.GetValue();
5027
}
5128
#endif
@@ -90,7 +67,7 @@ namespace ul {
9067
#define UL_ASSERT_TRUE(expr) ({ \
9168
const auto _tmp_expr = (expr); \
9269
if(!_tmp_expr) { \
93-
::ul::OnAssertionFailed(::ul::res::ResultAssertionFailed, #expr " asserted to be false...\n"); \
70+
::ul::OnAssertionFailed(::rc::ulaunch::ResultAssertionFailed, #expr " asserted to be false...\n"); \
9471
} \
9572
})
9673

0 commit comments

Comments
 (0)