Skip to content

Commit c49aed4

Browse files
committed
Various fixes, new NACP+icon cache system, and more
1 parent 37a9ff0 commit c49aed4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+710
-409
lines changed

libs/Atmosphere-libs

Submodule Atmosphere-libs updated 122 files

libs/uCommon/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec
2929

3030
CFLAGS := -g -Wall -Werror -O2 -ffunction-sections -fdata-sections $(ARCH) $(INCLUDE) -D__SWITCH__ $(UL_DEFS)
3131

32-
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++20
32+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++23
3333

3434
ASFLAGS := -g $(ARCH)
3535

libs/uCommon/include/ul/fs/fs_Stdio.hpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ namespace ul::fs {
6363
inline bool WriteFile(const S &path, const void *data, const size_t size, const bool overwrite) {
6464
auto f = fopen(util::GetCString(path), overwrite ? "wb" : "ab+");
6565
if(f) {
66-
fwrite(data, size, 1, f);
66+
const auto written = fwrite(data, size, 1, f);
6767
fclose(f);
68-
return true;
68+
return written == 1;
6969
}
7070
else {
7171
return false;
@@ -85,6 +85,27 @@ namespace ul::fs {
8585
}
8686
}
8787

88+
template<typename S>
89+
inline bool ReadAllFile(const S &path, void *data, const size_t size, size_t &out_actual_size) {
90+
auto f = fopen(util::GetCString(path), "rb");
91+
if(f) {
92+
fseek(f, 0, SEEK_END);
93+
const size_t file_size = ftell(f);
94+
rewind(f);
95+
if(file_size > size) {
96+
fclose(f);
97+
return false;
98+
}
99+
out_actual_size = file_size;
100+
const auto ok = fread(data, file_size, 1, f) == 1;
101+
fclose(f);
102+
return ok;
103+
}
104+
else {
105+
return false;
106+
}
107+
}
108+
88109
template<typename S>
89110
inline bool ReadFileAtOffset(const S &path, const size_t offset, void *data, const size_t size) {
90111
auto f = fopen(util::GetCString(path), "rb");

libs/uCommon/include/ul/menu/menu_Entries.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace ul::menu {
2828
SpecialEntryAmiibo
2929
};
3030

31-
using NacpLoadFunction = Result(*)(const u64 app_id, NacpStruct *out_nacp);
31+
using ControlEntryLoadFunction = bool(*)(const u64 app_id, std::string &out_name, std::string &out_author, std::string &out_version);
3232

3333
struct EntryApplicationInfo {
3434
u64 app_id;
@@ -145,7 +145,7 @@ namespace ul::menu {
145145
std::vector<Entry> LoadEntries(const std::string &path);
146146
const std::string &GetActiveMenuPath();
147147

148-
void SetNacpLoadFunction(NacpLoadFunction func);
148+
void SetControlEntryLoadFunction(ControlEntryLoadFunction func);
149149

150150
void EnsureApplicationEntry(const NsExtApplicationRecord &app_record, const std::string &menu_path = "");
151151
Entry CreateFolderEntry(const std::string &base_path, const std::string &folder_name, const s32 index = -1);
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace ul::sf {
55

6-
constexpr const char PrivateServiceName[] = "ulsf:p";
76
constexpr const char PublicServiceName[] = "ulsf:u";
87

98
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
#pragma once
3+
#include <ul/ul_Include.hpp>
4+
5+
namespace ul::smi::sf {
6+
7+
constexpr const char PrivateServiceName[] = "ulsf:p";
8+
9+
struct NacpMetadata {
10+
char name[sizeof(NacpLanguageEntry::name)];
11+
char author[sizeof(NacpLanguageEntry::author)];
12+
char display_version[sizeof(NacpStruct::display_version)];
13+
};
14+
15+
}

libs/uCommon/include/ul/ul_Include.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace ul {
2525

2626
constexpr const char RootCachePath[] = "sdmc:/ulaunch/cache";
2727
constexpr const char HomebrewCachePath[] = "sdmc:/ulaunch/cache/hb";
28+
constexpr const char ApplicationCachePath[] = "sdmc:/ulaunch/cache/app";
2829
constexpr const char ThemePreviewCachePath[] = "sdmc:/ulaunch/cache/preview";
2930
constexpr const char ActiveThemeCachePath[] = "sdmc:/ulaunch/cache/active";
3031

@@ -77,11 +78,7 @@ namespace ul {
7778
}
7879

7980
inline bool IsLocked() {
80-
if(this->TryLock()) {
81-
this->Unlock();
82-
return false;
83-
}
84-
return true;
81+
return mutexIsLockedByCurrentThread(&this->mutex);
8582
}
8683
};
8784

libs/uCommon/include/ul/ul_Results.rc.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace ulaunch {
1818
R_DEFINE_ERROR_RESULT(NoMessagesAvailable, 202);
1919
R_DEFINE_ERROR_RESULT(ApplicationCacheBusy, 203);
2020
R_DEFINE_ERROR_RESULT(ApplicationNotCached, 204);
21+
R_DEFINE_ERROR_RESULT(InsufficientIconSize, 205);
2122

2223
R_DEFINE_ERROR_RANGE(Loader, 301, 399);
2324
R_DEFINE_ERROR_RESULT(InvalidProcessType, 301);

0 commit comments

Comments
 (0)