Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
691a453d77 | ||
|
|
88246f475c | ||
|
|
269d4496b2 | ||
|
|
bb4c7a390b | ||
|
|
b846628362 | ||
|
|
26fb201518 | ||
|
|
01ce7cef14 | ||
|
|
3f3aaa01fa | ||
|
|
bf8de39e69 | ||
|
|
6bb4253df5 | ||
|
|
cfd7121574 | ||
|
|
972681c57e | ||
|
|
0a11cbc2d6 | ||
|
|
32f487abfb | ||
|
|
7d61cab01c | ||
|
|
14ed4e4057 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -49,6 +49,8 @@ X.X.X</br>
|
|||||||
- [ Ex: Kosmos' distribution of Atmosphère ]
|
- [ Ex: Kosmos' distribution of Atmosphère ]
|
||||||
- Do you have additional kips or sysmodules you're loading:
|
- Do you have additional kips or sysmodules you're loading:
|
||||||
- Homebrew software installed: [ * ]
|
- Homebrew software installed: [ * ]
|
||||||
|
- EmuMMC or SysNAND:
|
||||||
|
- [ If using an EmuMMC, include whether it's partition-based or file-based. ]
|
||||||
|
|
||||||
### Additional context?
|
### Additional context?
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
## 0.19.3
|
||||||
|
+ Support was added for 12.0.2.
|
||||||
|
+ A number of minor issues were fixed, including:
|
||||||
|
+ An issue was fixed in dns.mitm that caused a crash when games attempted to resolve the IP address of nullptr.
|
||||||
|
+ An issue was fixed in erpt that would cause an abort when booting without having ever booted stock previously.
|
||||||
|
+ An issue was fixed in (file-based) emummc that caused an error on system format/downloading certain games.
|
||||||
|
+ General system stability improvements to enhance the user's experience.
|
||||||
## 0.19.2
|
## 0.19.2
|
||||||
+ Atmosphère's components were further updated to reflect latest official behaviors as of 12.0.0.
|
+ Atmosphère's components were further updated to reflect latest official behaviors as of 12.0.0.
|
||||||
+ Notably, `erpt` was updated to implement the new forced shutdown detection feature.
|
+ Notably, `erpt` was updated to implement the new forced shutdown detection feature.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
[subrepo]
|
[subrepo]
|
||||||
remote = https://github.com/m4xw/emuMMC
|
remote = https://github.com/m4xw/emuMMC
|
||||||
branch = develop
|
branch = develop
|
||||||
commit = b355ee6a8f376faa615785419c7d73a8814d9d65
|
commit = c6717b9320247d3ec81b372adae5e5623be7d16b
|
||||||
parent = b24784f5c13a142bd0cb5d7edb82691c71f4bd00
|
parent = bf8de39e694dc64431180bc513ce110f07fc3531
|
||||||
method = rebase
|
method = rebase
|
||||||
cmdver = 0.4.1
|
cmdver = 0.4.1
|
||||||
|
|||||||
@@ -292,6 +292,36 @@ static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned
|
|||||||
{
|
{
|
||||||
fp = &f_emu.fp_gpp[sector / f_emu.part_size];
|
fp = &f_emu.fp_gpp[sector / f_emu.part_size];
|
||||||
sector = sector % f_emu.part_size;
|
sector = sector % f_emu.part_size;
|
||||||
|
|
||||||
|
// Special handling for reads/writes which cross file-boundaries.
|
||||||
|
if (__builtin_expect(sector + num_sectors > f_emu.part_size, 0))
|
||||||
|
{
|
||||||
|
unsigned int remaining = num_sectors;
|
||||||
|
while (remaining > 0) {
|
||||||
|
const unsigned int cur_sectors = MIN(remaining, f_emu.part_size - sector);
|
||||||
|
|
||||||
|
if (f_lseek(fp, (u64)sector << 9) != FR_OK)
|
||||||
|
return 0; // Out of bounds.
|
||||||
|
|
||||||
|
if (is_write)
|
||||||
|
{
|
||||||
|
if (f_write_fast(fp, buf, (u64)cur_sectors << 9) != FR_OK)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (f_read_fast(fp, buf, (u64)cur_sectors << 9) != FR_OK)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = (char *)buf + ((u64)cur_sectors << 9);
|
||||||
|
remaining -= cur_sectors;
|
||||||
|
sector = 0;
|
||||||
|
++fp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -306,14 +336,14 @@ static uint64_t emummc_read_write_inner(void *buf, unsigned int sector, unsigned
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_lseek(fp, sector << 9) != FR_OK)
|
if (f_lseek(fp, (u64)sector << 9) != FR_OK)
|
||||||
return 0; // Out of bounds.
|
return 0; // Out of bounds.
|
||||||
|
|
||||||
uint64_t res = 0;
|
uint64_t res = 0;
|
||||||
if (!is_write)
|
if (!is_write)
|
||||||
res = !f_read_fast(fp, buf, num_sectors << 9);
|
res = !f_read_fast(fp, buf, (u64)num_sectors << 9);
|
||||||
else
|
else
|
||||||
res = !f_write_fast(fp, buf, num_sectors << 9);
|
res = !f_write_fast(fp, buf, (u64)num_sectors << 9);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ uint32_t fuse_get_regulator(void) {
|
|||||||
|
|
||||||
|
|
||||||
static const uint32_t fuse_version_increment_firmwares[] = {
|
static const uint32_t fuse_version_increment_firmwares[] = {
|
||||||
|
ATMOSPHERE_TARGET_FIRMWARE_12_0_2,
|
||||||
ATMOSPHERE_TARGET_FIRMWARE_11_0_0,
|
ATMOSPHERE_TARGET_FIRMWARE_11_0_0,
|
||||||
ATMOSPHERE_TARGET_FIRMWARE_10_0_0,
|
ATMOSPHERE_TARGET_FIRMWARE_10_0_0,
|
||||||
ATMOSPHERE_TARGET_FIRMWARE_9_1_0,
|
ATMOSPHERE_TARGET_FIRMWARE_9_1_0,
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ static uint32_t nxboot_get_specific_target_firmware(uint32_t target_firmware){
|
|||||||
#define CHECK_NCA(NCA_ID, VERSION) do { if (is_nca_present(NCA_ID)) { return ATMOSPHERE_TARGET_FIRMWARE_##VERSION; } } while(0)
|
#define CHECK_NCA(NCA_ID, VERSION) do { if (is_nca_present(NCA_ID)) { return ATMOSPHERE_TARGET_FIRMWARE_##VERSION; } } while(0)
|
||||||
|
|
||||||
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_12_0_0) {
|
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_12_0_0) {
|
||||||
|
CHECK_NCA("63d928b5a3016fe8cc0e76d2f06f4e98", 12_0_2);
|
||||||
CHECK_NCA("e65114b456f9d0b566a80e53bade2d89", 12_0_1);
|
CHECK_NCA("e65114b456f9d0b566a80e53bade2d89", 12_0_1);
|
||||||
CHECK_NCA("bd4185843550fbba125b20787005d1d2", 12_0_0);
|
CHECK_NCA("bd4185843550fbba125b20787005d1d2", 12_0_0);
|
||||||
} else if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_11_0_0) {
|
} else if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_11_0_0) {
|
||||||
@@ -393,6 +394,8 @@ static uint32_t nxboot_get_target_firmware(const void *package1loader) {
|
|||||||
return ATMOSPHERE_TARGET_FIRMWARE_11_0_0;
|
return ATMOSPHERE_TARGET_FIRMWARE_11_0_0;
|
||||||
} else if (memcmp(package1loader_header->build_timestamp, "20210129", 8) == 0) {
|
} else if (memcmp(package1loader_header->build_timestamp, "20210129", 8) == 0) {
|
||||||
return ATMOSPHERE_TARGET_FIRMWARE_12_0_0;
|
return ATMOSPHERE_TARGET_FIRMWARE_12_0_0;
|
||||||
|
} else if (memcmp(package1loader_header->build_timestamp, "20210422", 8) == 0) {
|
||||||
|
return ATMOSPHERE_TARGET_FIRMWARE_12_0_2;
|
||||||
} else {
|
} else {
|
||||||
fatal_error("[NXBOOT] Unable to identify package1!\n");
|
fatal_error("[NXBOOT] Unable to identify package1!\n");
|
||||||
}
|
}
|
||||||
@@ -604,6 +607,11 @@ static void nxboot_configure_stratosphere(uint32_t target_firmware) {
|
|||||||
/* NOTE: 12.0.0 added a new lotus firmware, but did not burn a fuse. */
|
/* NOTE: 12.0.0 added a new lotus firmware, but did not burn a fuse. */
|
||||||
/* This is literally undetectable using normal fuses.... */
|
/* This is literally undetectable using normal fuses.... */
|
||||||
/* C'est la vie. */
|
/* C'est la vie. */
|
||||||
|
|
||||||
|
/* Check if the fuses are < 12.0.0, but firmware is >= 12.0.0 */
|
||||||
|
if (target_firmware >= ATMOSPHERE_TARGET_FIRMWARE_12_0_2 && !(fuse_get_reserved_odm(7) & ~0x00003FFF)) {
|
||||||
|
kip_patches_set_enable_nogc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ static bool package2_validate_metadata(package2_meta_t *metadata, uint8_t data[]
|
|||||||
|
|
||||||
/* Perform version checks. */
|
/* Perform version checks. */
|
||||||
/* We will be compatible with all package2s released before current, but not newer ones. */
|
/* We will be compatible with all package2s released before current, but not newer ones. */
|
||||||
if (metadata->version_max >= PACKAGE2_MINVER_THEORETICAL && metadata->version_min < PACKAGE2_MAXVER_1100_CURRENT) {
|
if (metadata->version_max >= PACKAGE2_MINVER_THEORETICAL && metadata->version_min < PACKAGE2_MAXVER_1202_CURRENT) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,8 @@
|
|||||||
#define PACKAGE2_MAXVER_900 0xC
|
#define PACKAGE2_MAXVER_900 0xC
|
||||||
#define PACKAGE2_MAXVER_910_920 0xD
|
#define PACKAGE2_MAXVER_910_920 0xD
|
||||||
#define PACKAGE2_MAXVER_1000 0xE
|
#define PACKAGE2_MAXVER_1000 0xE
|
||||||
#define PACKAGE2_MAXVER_1100_CURRENT 0xF
|
#define PACKAGE2_MAXVER_1100 0xF
|
||||||
|
#define PACKAGE2_MAXVER_1202_CURRENT 0x10
|
||||||
|
|
||||||
#define PACKAGE2_MINVER_100 0x3
|
#define PACKAGE2_MINVER_100 0x3
|
||||||
#define PACKAGE2_MINVER_200 0x4
|
#define PACKAGE2_MINVER_200 0x4
|
||||||
@@ -56,7 +57,8 @@
|
|||||||
#define PACKAGE2_MINVER_900 0xD
|
#define PACKAGE2_MINVER_900 0xD
|
||||||
#define PACKAGE2_MINVER_910_920 0xE
|
#define PACKAGE2_MINVER_910_920 0xE
|
||||||
#define PACKAGE2_MINVER_1000 0xF
|
#define PACKAGE2_MINVER_1000 0xF
|
||||||
#define PACKAGE2_MINVER_1100_CURRENT 0x10
|
#define PACKAGE2_MINVER_1100 0x10
|
||||||
|
#define PACKAGE2_MINVER_1202_CURRENT 0x11
|
||||||
|
|
||||||
#define NX_BOOTLOADER_PACKAGE2_LOAD_ADDRESS ((void *)(0xA9800000ull))
|
#define NX_BOOTLOADER_PACKAGE2_LOAD_ADDRESS ((void *)(0xA9800000ull))
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
[subrepo]
|
[subrepo]
|
||||||
remote = https://github.com/Atmosphere-NX/Atmosphere-libs
|
remote = https://github.com/Atmosphere-NX/Atmosphere-libs
|
||||||
branch = master
|
branch = master
|
||||||
commit = acee57e888aa87ba8976db889dfcf20701cb38a8
|
commit = 9ac6f527e2a48ba97636ba8f65538f960870cd8a
|
||||||
parent = dbcb1e15648ef7b050b9b59b40d413038b4888ec
|
parent = 269d4496b2365785c87545b0337f89078cb76c3e
|
||||||
method = merge
|
method = merge
|
||||||
cmdver = 0.4.1
|
cmdver = 0.4.1
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
|||||||
-Wl,--wrap,_Unwind_Resume \
|
-Wl,--wrap,_Unwind_Resume \
|
||||||
-Wl,--wrap,_ZSt19__throw_logic_errorPKc \
|
-Wl,--wrap,_ZSt19__throw_logic_errorPKc \
|
||||||
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
||||||
-Wl,--wrap,_ZNSt11logic_errorC2EPKc
|
-Wl,--wrap,_ZNSt11logic_errorC2EPKc \
|
||||||
|
-Wl,--wrap,exit
|
||||||
|
|
||||||
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) $(CXXWRAPS) -Wl,-Map,$(notdir $*.map)
|
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) $(CXXWRAPS) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace ams::pkg2 {
|
|||||||
|
|
||||||
constexpr inline int PayloadCount = 3;
|
constexpr inline int PayloadCount = 3;
|
||||||
|
|
||||||
constexpr inline int MinimumValidDataVersion = 0; /* We allow older package2 to load; this value is currently 0x10 in Nintendo's code. */
|
constexpr inline int MinimumValidDataVersion = 0; /* We allow older package2 to load; this value is currently 0x11 in Nintendo's code. */
|
||||||
constexpr inline int CurrentBootloaderVersion = 0xE;
|
constexpr inline int CurrentBootloaderVersion = 0xF;
|
||||||
|
|
||||||
struct Package2Meta {
|
struct Package2Meta {
|
||||||
using Magic = util::FourCC<'P','K','2','1'>;
|
using Magic = util::FourCC<'P','K','2','1'>;
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ namespace ams::fuse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constexpr const TargetFirmware FuseVersionIncrementFirmwares[] = {
|
constexpr const TargetFirmware FuseVersionIncrementFirmwares[] = {
|
||||||
|
TargetFirmware_12_0_2,
|
||||||
TargetFirmware_11_0_0,
|
TargetFirmware_11_0_0,
|
||||||
TargetFirmware_10_0_0,
|
TargetFirmware_10_0_0,
|
||||||
TargetFirmware_9_1_0,
|
TargetFirmware_9_1_0,
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ $(OFILES_SRC) : $(HFILES_BIN)
|
|||||||
|
|
||||||
ams_environment_weak.o: CXXFLAGS += -fno-lto
|
ams_environment_weak.o: CXXFLAGS += -fno-lto
|
||||||
pm_info_api_weak.o: CXXFLAGS += -fno-lto
|
pm_info_api_weak.o: CXXFLAGS += -fno-lto
|
||||||
|
hos_stratosphere_api.o: CXXFLAGS += -fno-lto
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%_bin.h %.bin.o : %.bin
|
%_bin.h %.bin.o : %.bin
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ namespace ams::hos {
|
|||||||
Version_11_0_1 = ::ams::TargetFirmware_11_0_1,
|
Version_11_0_1 = ::ams::TargetFirmware_11_0_1,
|
||||||
Version_12_0_0 = ::ams::TargetFirmware_12_0_0,
|
Version_12_0_0 = ::ams::TargetFirmware_12_0_0,
|
||||||
Version_12_0_1 = ::ams::TargetFirmware_12_0_1,
|
Version_12_0_1 = ::ams::TargetFirmware_12_0_1,
|
||||||
|
Version_12_0_2 = ::ams::TargetFirmware_12_0_2,
|
||||||
|
|
||||||
Version_Current = ::ams::TargetFirmware_Current,
|
Version_Current = ::ams::TargetFirmware_Current,
|
||||||
|
|
||||||
|
|||||||
@@ -153,29 +153,14 @@ namespace ams {
|
|||||||
::ams::ExceptionHandler(&ams_ctx);
|
::ams::ExceptionHandler(&ams_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NORETURN void AbortImpl() {
|
NORETURN void AbortImpl();
|
||||||
/* Just perform a data abort. */
|
|
||||||
register u64 addr __asm__("x27") = FatalErrorContext::StdAbortMagicAddress;
|
|
||||||
register u64 val __asm__("x28") = FatalErrorContext::StdAbortMagicValue;
|
|
||||||
while (true) {
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"str %[val], [%[addr]]"
|
|
||||||
:
|
|
||||||
: [val]"r"(val), [addr]"r"(addr)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
__builtin_unreachable();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
/* Redefine abort to trigger these handlers. */
|
|
||||||
void abort();
|
|
||||||
|
|
||||||
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
||||||
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { abort(); __builtin_unreachable(); }
|
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { ::ams::AbortImpl(); __builtin_unreachable(); }
|
||||||
WRAP_ABORT_FUNC(__cxa_throw)
|
WRAP_ABORT_FUNC(__cxa_throw)
|
||||||
WRAP_ABORT_FUNC(__cxa_rethrow)
|
WRAP_ABORT_FUNC(__cxa_rethrow)
|
||||||
WRAP_ABORT_FUNC(__cxa_allocate_exception)
|
WRAP_ABORT_FUNC(__cxa_allocate_exception)
|
||||||
@@ -195,9 +180,3 @@ extern "C" {
|
|||||||
#undef WRAP_ABORT_FUNC
|
#undef WRAP_ABORT_FUNC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom abort handler, so that std::abort will trigger these. */
|
|
||||||
void abort() {
|
|
||||||
ams::AbortImpl();
|
|
||||||
__builtin_unreachable();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
|
extern "C" void NORETURN __real_exit(int rc);
|
||||||
|
|
||||||
namespace ams {
|
namespace ams {
|
||||||
|
|
||||||
WEAK_SYMBOL void *Malloc(size_t size) {
|
WEAK_SYMBOL void *Malloc(size_t size) {
|
||||||
@@ -37,13 +39,43 @@ namespace ams {
|
|||||||
return std::free(ptr);
|
return std::free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WEAK_SYMBOL void NORETURN Exit(int rc) {
|
||||||
|
__real_exit(rc);
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
|
||||||
|
NOINLINE NORETURN void AbortImpl() {
|
||||||
|
/* Just perform a data abort. */
|
||||||
|
register u64 addr __asm__("x27") = FatalErrorContext::StdAbortMagicAddress;
|
||||||
|
register u64 val __asm__("x28") = FatalErrorContext::StdAbortMagicValue;
|
||||||
|
while (true) {
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
"str %[val], [%[addr]]"
|
||||||
|
:
|
||||||
|
: [val]"r"(val), [addr]"r"(addr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
/* Redefine abort to trigger these handlers. */
|
||||||
|
void abort();
|
||||||
|
|
||||||
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
||||||
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { abort(); __builtin_unreachable(); }
|
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { ::ams::AbortImpl(); __builtin_unreachable(); }
|
||||||
WRAP_ABORT_FUNC(__cxa_pure_virtual)
|
WRAP_ABORT_FUNC(__cxa_pure_virtual)
|
||||||
#undef WRAP_ABORT_FUNC
|
#undef WRAP_ABORT_FUNC
|
||||||
|
|
||||||
|
void NORETURN __wrap_exit(int rc) { ::ams::Exit(rc); __builtin_unreachable(); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom abort handler, so that std::abort will trigger these. */
|
||||||
|
void abort() {
|
||||||
|
ams::AbortImpl();
|
||||||
|
__builtin_unreachable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace ams::erpt::srv {
|
|||||||
} else {
|
} else {
|
||||||
R_UNLESS(mode == StreamMode_Read, erpt::ResultInvalidArgument());
|
R_UNLESS(mode == StreamMode_Read, erpt::ResultInvalidArgument());
|
||||||
|
|
||||||
fs::OpenFile(std::addressof(this->file_handle), path, fs::OpenMode_Read);
|
R_TRY(fs::OpenFile(std::addressof(this->file_handle), path, fs::OpenMode_Read));
|
||||||
}
|
}
|
||||||
auto file_guard = SCOPE_GUARD { fs::CloseFile(this->file_handle); };
|
auto file_guard = SCOPE_GUARD { fs::CloseFile(this->file_handle); };
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,14 @@ namespace ams::fs::impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<> const char *IdString::ToString<fs::DirectoryEntryType>(fs::DirectoryEntryType type) {
|
||||||
|
switch (type) {
|
||||||
|
case fs::DirectoryEntryType_Directory: return "Directory";
|
||||||
|
case fs::DirectoryEntryType_File: return "File";
|
||||||
|
default: return ToValueString(static_cast<int>(type));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class AccessLogPrinterCallbackManager {
|
class AccessLogPrinterCallbackManager {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include "hos_version_api_private.hpp"
|
#include "hos_version_api_private.hpp"
|
||||||
|
#include "../os/impl/os_rng_manager.hpp"
|
||||||
|
|
||||||
namespace ams::os {
|
namespace ams::os {
|
||||||
|
|
||||||
@@ -22,6 +23,15 @@ namespace ams::os {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
/* Provide libnx address space allocation shim. */
|
||||||
|
uintptr_t __libnx_virtmem_rng(void) {
|
||||||
|
return static_cast<uintptr_t>(::ams::os::impl::GetRngManager().GenerateRandomU64());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace ams::hos {
|
namespace ams::hos {
|
||||||
|
|
||||||
void InitializeForStratosphere() {
|
void InitializeForStratosphere() {
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ namespace ams::os::impl {
|
|||||||
class RngManager {
|
class RngManager {
|
||||||
private:
|
private:
|
||||||
util::TinyMT mt;
|
util::TinyMT mt;
|
||||||
os::Mutex lock;
|
os::SdkMutex lock;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
private:
|
private:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
public:
|
public:
|
||||||
constexpr RngManager() : mt(), lock(false), initialized() { /* ... */ }
|
constexpr RngManager() : mt(), lock(), initialized() { /* ... */ }
|
||||||
public:
|
public:
|
||||||
u64 GenerateRandomU64();
|
u64 GenerateRandomU64();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ namespace ams::os {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
util::TinyMT g_random;
|
constinit util::TinyMT g_random;
|
||||||
os::Mutex g_random_mutex(false);
|
constinit os::SdkMutex g_random_mutex;
|
||||||
bool g_initialized_random;
|
constinit bool g_initialized_random;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T GenerateRandomTImpl(T max) {
|
inline T GenerateRandomTImpl(T max) {
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#define ATMOSPHERE_RELEASE_VERSION_MAJOR 0
|
#define ATMOSPHERE_RELEASE_VERSION_MAJOR 0
|
||||||
#define ATMOSPHERE_RELEASE_VERSION_MINOR 19
|
#define ATMOSPHERE_RELEASE_VERSION_MINOR 19
|
||||||
#define ATMOSPHERE_RELEASE_VERSION_MICRO 2
|
#define ATMOSPHERE_RELEASE_VERSION_MICRO 3
|
||||||
|
|
||||||
#define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO
|
#define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO
|
||||||
|
|
||||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 12
|
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 12
|
||||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 0
|
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 0
|
||||||
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 1
|
#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 2
|
||||||
|
|||||||
@@ -60,8 +60,9 @@
|
|||||||
#define ATMOSPHERE_TARGET_FIRMWARE_11_0_1 ATMOSPHERE_TARGET_FIRMWARE(11, 0, 1)
|
#define ATMOSPHERE_TARGET_FIRMWARE_11_0_1 ATMOSPHERE_TARGET_FIRMWARE(11, 0, 1)
|
||||||
#define ATMOSPHERE_TARGET_FIRMWARE_12_0_0 ATMOSPHERE_TARGET_FIRMWARE(12, 0, 0)
|
#define ATMOSPHERE_TARGET_FIRMWARE_12_0_0 ATMOSPHERE_TARGET_FIRMWARE(12, 0, 0)
|
||||||
#define ATMOSPHERE_TARGET_FIRMWARE_12_0_1 ATMOSPHERE_TARGET_FIRMWARE(12, 0, 1)
|
#define ATMOSPHERE_TARGET_FIRMWARE_12_0_1 ATMOSPHERE_TARGET_FIRMWARE(12, 0, 1)
|
||||||
|
#define ATMOSPHERE_TARGET_FIRMWARE_12_0_2 ATMOSPHERE_TARGET_FIRMWARE(12, 0, 2)
|
||||||
|
|
||||||
#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_12_0_1
|
#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_12_0_2
|
||||||
|
|
||||||
#define ATMOSPHERE_TARGET_FIRMWARE_MIN ATMOSPHERE_TARGET_FIRMWARE(0, 0, 0)
|
#define ATMOSPHERE_TARGET_FIRMWARE_MIN ATMOSPHERE_TARGET_FIRMWARE(0, 0, 0)
|
||||||
#define ATMOSPHERE_TARGET_FIRMWARE_MAX ATMOSPHERE_TARGET_FIRMWARE_CURRENT
|
#define ATMOSPHERE_TARGET_FIRMWARE_MAX ATMOSPHERE_TARGET_FIRMWARE_CURRENT
|
||||||
@@ -114,6 +115,7 @@ namespace ams {
|
|||||||
TargetFirmware_11_0_1 = ATMOSPHERE_TARGET_FIRMWARE_11_0_1,
|
TargetFirmware_11_0_1 = ATMOSPHERE_TARGET_FIRMWARE_11_0_1,
|
||||||
TargetFirmware_12_0_0 = ATMOSPHERE_TARGET_FIRMWARE_12_0_0,
|
TargetFirmware_12_0_0 = ATMOSPHERE_TARGET_FIRMWARE_12_0_0,
|
||||||
TargetFirmware_12_0_1 = ATMOSPHERE_TARGET_FIRMWARE_12_0_1,
|
TargetFirmware_12_0_1 = ATMOSPHERE_TARGET_FIRMWARE_12_0_1,
|
||||||
|
TargetFirmware_12_0_2 = ATMOSPHERE_TARGET_FIRMWARE_12_0_2,
|
||||||
|
|
||||||
TargetFirmware_Current = ATMOSPHERE_TARGET_FIRMWARE_CURRENT,
|
TargetFirmware_Current = ATMOSPHERE_TARGET_FIRMWARE_CURRENT,
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#define PINMUX_AUX_DVFS_PWM (0x3184)
|
#define PINMUX_AUX_DVFS_PWM (0x3184)
|
||||||
#define PINMUX_AUX_NFC_EN (0x31D0)
|
#define PINMUX_AUX_NFC_EN (0x31D0)
|
||||||
#define PINMUX_AUX_NFC_INT (0x31D4)
|
#define PINMUX_AUX_NFC_INT (0x31D4)
|
||||||
|
#define PINMUX_AUX_CAM_FLASH_EN (0x31E8)
|
||||||
#define PINMUX_AUX_LCD_BL_PWM (0x31FC)
|
#define PINMUX_AUX_LCD_BL_PWM (0x31FC)
|
||||||
#define PINMUX_AUX_LCD_BL_EN (0x3200)
|
#define PINMUX_AUX_LCD_BL_EN (0x3200)
|
||||||
#define PINMUX_AUX_LCD_RST (0x3204)
|
#define PINMUX_AUX_LCD_RST (0x3204)
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ namespace ams::mitm::socket::resolver {
|
|||||||
|
|
||||||
LogDebug("[%016lx]: GetHostByNameRequest(%s)\n", this->client_info.program_id.value, hostname);
|
LogDebug("[%016lx]: GetHostByNameRequest(%s)\n", this->client_info.program_id.value, hostname);
|
||||||
|
|
||||||
|
R_UNLESS(hostname != nullptr, sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
ams::socket::InAddrT redirect_addr = {};
|
ams::socket::InAddrT redirect_addr = {};
|
||||||
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
@@ -107,6 +109,8 @@ namespace ams::mitm::socket::resolver {
|
|||||||
|
|
||||||
LogDebug("[%016lx]: GetAddrInfoRequest(%s, %s)\n", this->client_info.program_id.value, reinterpret_cast<const char *>(node.GetPointer()), reinterpret_cast<const char *>(srv.GetPointer()));
|
LogDebug("[%016lx]: GetAddrInfoRequest(%s, %s)\n", this->client_info.program_id.value, reinterpret_cast<const char *>(node.GetPointer()), reinterpret_cast<const char *>(srv.GetPointer()));
|
||||||
|
|
||||||
|
R_UNLESS(hostname != nullptr, sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
ams::socket::InAddrT redirect_addr = {};
|
ams::socket::InAddrT redirect_addr = {};
|
||||||
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
@@ -142,6 +146,8 @@ namespace ams::mitm::socket::resolver {
|
|||||||
|
|
||||||
LogDebug("[%016lx]: GetHostByNameRequestWithOptions(%s)\n", this->client_info.program_id.value, hostname);
|
LogDebug("[%016lx]: GetHostByNameRequestWithOptions(%s)\n", this->client_info.program_id.value, hostname);
|
||||||
|
|
||||||
|
R_UNLESS(hostname != nullptr, sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
ams::socket::InAddrT redirect_addr = {};
|
ams::socket::InAddrT redirect_addr = {};
|
||||||
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
@@ -160,6 +166,8 @@ namespace ams::mitm::socket::resolver {
|
|||||||
|
|
||||||
LogDebug("[%016lx]: GetAddrInfoRequestWithOptions(%s, %s)\n", this->client_info.program_id.value, hostname, reinterpret_cast<const char *>(srv.GetPointer()));
|
LogDebug("[%016lx]: GetAddrInfoRequestWithOptions(%s, %s)\n", this->client_info.program_id.value, hostname, reinterpret_cast<const char *>(srv.GetPointer()));
|
||||||
|
|
||||||
|
R_UNLESS(hostname != nullptr, sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
ams::socket::InAddrT redirect_addr = {};
|
ams::socket::InAddrT redirect_addr = {};
|
||||||
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
R_UNLESS(GetRedirectedHostByName(std::addressof(redirect_addr), hostname), sm::mitm::ResultShouldForwardToSession());
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,12 @@ namespace ams::boot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result Initialize(bool set_input_current_limit) {
|
Result Initialize(bool set_input_current_limit) {
|
||||||
|
/* Configure PINMUX_AUX_CAM_FLASH_EN as tristate + passthrough. */
|
||||||
|
{
|
||||||
|
const uintptr_t apb_regs = dd::QueryIoMapping(0x70000000ul, os::MemoryPageSize);
|
||||||
|
reg::ClearBits(apb_regs + PINMUX_AUX_CAM_FLASH_EN, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
|
||||||
|
}
|
||||||
|
|
||||||
/* Set input current limit to 500 ma. */
|
/* Set input current limit to 500 ma. */
|
||||||
if (set_input_current_limit) {
|
if (set_input_current_limit) {
|
||||||
R_TRY(powctl::SetChargerInputCurrentLimit(this->charger_session, 500));
|
R_TRY(powctl::SetChargerInputCurrentLimit(this->charger_session, 500));
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
extern u32 __start__;
|
extern u32 __start__;
|
||||||
|
|
||||||
|
extern int __system_argc;
|
||||||
|
extern char** __system_argv;
|
||||||
|
|
||||||
u32 __nx_applet_type = AppletType_None;
|
u32 __nx_applet_type = AppletType_None;
|
||||||
|
|
||||||
#define INNER_HEAP_SIZE 0x0
|
#define INNER_HEAP_SIZE 0x0
|
||||||
@@ -26,6 +29,7 @@ extern "C" {
|
|||||||
char nx_inner_heap[INNER_HEAP_SIZE];
|
char nx_inner_heap[INNER_HEAP_SIZE];
|
||||||
|
|
||||||
void __libnx_initheap(void);
|
void __libnx_initheap(void);
|
||||||
|
void argvSetup(void);
|
||||||
void __appInit(void);
|
void __appInit(void);
|
||||||
void __appExit(void);
|
void __appExit(void);
|
||||||
|
|
||||||
@@ -39,10 +43,20 @@ extern "C" {
|
|||||||
void __libnx_free(void *mem);
|
void __libnx_free(void *mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constinit char *g_empty_argv = nullptr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace ams {
|
namespace ams {
|
||||||
|
|
||||||
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Sm;
|
ncm::ProgramId CurrentProgramId = ncm::SystemProgramId::Sm;
|
||||||
|
|
||||||
|
void NORETURN Exit(int rc) {
|
||||||
|
AMS_ABORT("Exit called by immortal process");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace ams;
|
using namespace ams;
|
||||||
@@ -64,6 +78,12 @@ void __libnx_initheap(void) {
|
|||||||
fake_heap_end = (char*)addr + size;
|
fake_heap_end = (char*)addr + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void argvSetup(void) {
|
||||||
|
/* We don't need argc/argv, so set them to empty defaults. */
|
||||||
|
__system_argc = 0;
|
||||||
|
__system_argv = std::addressof(g_empty_argv);
|
||||||
|
}
|
||||||
|
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user