mirror of
https://github.com/XorTroll/uLaunch
synced 2025-02-16 12:38:29 +00:00
Update libraries, fix some stuff
This commit is contained in:
parent
330634ab74
commit
e29bc11be5
23 changed files with 184 additions and 80 deletions
7
Makefile
7
Makefile
|
@ -4,17 +4,20 @@ export UL_MINOR := 3
|
|||
export UL_MICRO := 0
|
||||
export UL_VERSION := $(UL_MAJOR).$(UL_MINOR).$(UL_MICRO)
|
||||
|
||||
export UL_DEV := 1
|
||||
export UL_DEV := 0
|
||||
|
||||
export UL_APM_WRAPS := -Wl,-wrap,apmInitialize -Wl,-wrap,apmSetPerformanceConfiguration -Wl,-wrap,apmExit
|
||||
|
||||
export UL_DEFS := -DUL_DEV=$(UL_DEV) -DUL_MAJOR=$(UL_MAJOR) -DUL_MINOR=$(UL_MINOR) -DUL_MICRO=$(UL_MICRO) -DUL_VERSION=\"$(UL_VERSION)\"
|
||||
|
||||
export UL_COMMON_SOURCES := ../uLaunch/source ../uLaunch/source/am ../uLaunch/source/cfg ../uLaunch/source/db ../uLaunch/source/fs ../uLaunch/source/net ../uLaunch/source/os ../uLaunch/source/util
|
||||
export UL_COMMON_INCLUDES := ../uLaunch/include
|
||||
export UL_COMMON_INCLUDES := ../uLaunch/include ../master-libnx/nx/external/bsd/include
|
||||
|
||||
export UL_CXXFLAGS := -fno-rtti -fexceptions -std=gnu++17
|
||||
|
||||
# TODO: remove this and libnx master submodule when libnx releases
|
||||
export LIBNX := $(CURDIR)/master-libnx/nx
|
||||
|
||||
.PHONY: all base make_hbtarget hbtarget make_daemon daemon make_menu menu clean
|
||||
|
||||
all: hbtarget daemon menu
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 59c76cbeeca3c8ffe7a18a543943b21ad94dab04
|
||||
Subproject commit 5d0e7274a346bd3ef0950128b691e5505979c4bf
|
|
@ -34,7 +34,7 @@ uLaunch is a very ambitious project, consisting on two custom library applets, a
|
|||
|
||||
- Settings:
|
||||
|
||||
- Show connected WiFi network's name
|
||||
- Show connected WiFi network's name, MAC and IP address...
|
||||
|
||||
- Open connection applet in case user wants to change network settings
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 08c9b3cbf85471fe6adb5f42ba9f03357a5f633a
|
||||
Subproject commit 07630f73a72cf2d3ea2cefc70dcd8a0449fbcbd3
|
|
@ -1 +1 @@
|
|||
Subproject commit c4ebdb4cd8382d277616f3a463b33cf690efe4ac
|
||||
Subproject commit f0f21507db78a15b1ac4dbc48ecfd3ebdd4d4e75
|
|
@ -6,18 +6,14 @@ namespace ecs
|
|||
{
|
||||
// Slightly modified version of ams's RemoteFileSystem
|
||||
|
||||
class RemoteFileSystem : public ams::fs::fsa::IFileSystem {
|
||||
class RemoteSdCardFileSystem : public ams::fs::fsa::IFileSystem {
|
||||
private:
|
||||
FsFileSystem *base_fs;
|
||||
bool close_fs;
|
||||
public:
|
||||
RemoteFileSystem(::FsFileSystem *fs, bool close) : base_fs(fs), close_fs(close) { /* ... */ }
|
||||
|
||||
virtual ~RemoteFileSystem() {
|
||||
if(close_fs) {
|
||||
fsFsClose(this->base_fs);
|
||||
}
|
||||
}
|
||||
public:
|
||||
RemoteSdCardFileSystem() : base_fs(fsdevGetDeviceFileSystem("sdmc")) { /* ... */ }
|
||||
|
||||
virtual ~RemoteSdCardFileSystem() { /* Don't close the fs */ }
|
||||
|
||||
public:
|
||||
virtual ams::Result CreateFileImpl(const char *path, s64 size, int flags) override final {
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C"
|
|||
// Needed by libstratosphere
|
||||
namespace ams
|
||||
{
|
||||
ncm::ProgramId CurrentProgramId = ncm::ProgramId::AppletQlaunch;
|
||||
ncm::ProgramId CurrentProgramId = ncm::SystemAppletId::Qlaunch;
|
||||
namespace result
|
||||
{
|
||||
bool CallFatalOnResultAssertion = true;
|
||||
|
@ -371,7 +371,7 @@ namespace
|
|||
ams::sf::hipc::ServerManager<NumServers, ServerOptions, MaxSessions> daemon_ipc_manager;
|
||||
}
|
||||
|
||||
namespace daemn
|
||||
namespace impl
|
||||
{
|
||||
void IPCManagerThread(void *arg)
|
||||
{
|
||||
|
@ -608,7 +608,7 @@ namespace daemn
|
|||
// Daemon handles basic qlaunch functionality and serves as a back-end for uLaunch, communicating with Menu front-end when neccessary.
|
||||
int main()
|
||||
{
|
||||
daemn::Initialize();
|
||||
impl::Initialize();
|
||||
|
||||
// Cache everything on startup
|
||||
cfg::CacheEverything();
|
||||
|
@ -618,11 +618,11 @@ int main()
|
|||
|
||||
while(true)
|
||||
{
|
||||
daemn::LoopUpdate();
|
||||
impl::LoopUpdate();
|
||||
svcSleepThread(10'000'000);
|
||||
}
|
||||
|
||||
daemn::Exit();
|
||||
impl::Exit();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -55,7 +55,7 @@ namespace ecs
|
|||
}
|
||||
}
|
||||
|
||||
static Result ldrShellAtmosphereSetExternalContentSource(u64 app_id, Handle *out_h)
|
||||
static inline Result ldrShellAtmosphereRegisterExternalCode(u64 app_id, Handle *out_h)
|
||||
{
|
||||
return serviceDispatchIn(ldrShellGetServiceSession(), 65000, app_id,
|
||||
.out_handle_attrs = { SfOutHandleAttr_HipcMove },
|
||||
|
@ -63,7 +63,7 @@ namespace ecs
|
|||
);
|
||||
}
|
||||
|
||||
static Result ldrShellAtmosphereClearExternalContentSource(u64 app_id)
|
||||
static inline Result ldrShellAtmosphereUnregisterExternalCode(u64 app_id)
|
||||
{
|
||||
return serviceDispatchIn(ldrShellGetServiceSession(), 65001, app_id);
|
||||
}
|
||||
|
@ -71,16 +71,16 @@ namespace ecs
|
|||
Result RegisterExternalContent(u64 app_id, std::string exefs_path)
|
||||
{
|
||||
Handle move_h = INVALID_HANDLE;
|
||||
ldrShellAtmosphereClearExternalContentSource(app_id);
|
||||
R_TRY(ldrShellAtmosphereSetExternalContentSource(app_id, &move_h));
|
||||
ldrShellAtmosphereUnregisterExternalCode(app_id);
|
||||
R_TRY(ldrShellAtmosphereRegisterExternalCode(app_id, &move_h));
|
||||
|
||||
// Create a remote access session to SD's filesystem (ams's original remote fs would close it, and we don't want that!)
|
||||
std::unique_ptr<ams::fs::fsa::IFileSystem> sd_ifs = std::make_unique<RemoteFileSystem>(fsdevGetDeviceFileSystem("sdmc"), false);
|
||||
std::unique_ptr<ams::fs::fsa::IFileSystem> sd_ifs = std::make_unique<RemoteSdCardFileSystem>();
|
||||
auto sd_ifs_ipc = std::make_shared<ams::fssrv::impl::FileSystemInterfaceAdapter>(std::make_shared<ams::fssystem::SubDirectoryFileSystem>(std::move(sd_ifs), exefs_path.c_str()), false);
|
||||
|
||||
ams::sf::cmif::ServiceObjectHolder srv_holder(std::move(sd_ifs_ipc));
|
||||
R_TRY(manager_instance.RegisterSession(move_h, std::move(srv_holder)).GetValue());
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ extern "C"
|
|||
u32 __nx_applet_type;
|
||||
u32 __nx_applet_exit_mode = 2;
|
||||
|
||||
u32 __nx_fs_num_sessions = 1;
|
||||
u32 __nx_fsdev_direntry_cache_size = 1;
|
||||
bool __nx_fsdev_support_cwd = false;
|
||||
|
||||
void hb_hbl_Target(const char *path, const char *argv, int do_once);
|
||||
}
|
||||
|
||||
|
@ -17,7 +21,7 @@ NX_CONSTEXPR bool IsApplet(u64 program_id)
|
|||
|
||||
NX_CONSTEXPR bool IsApplication(u64 program_id)
|
||||
{
|
||||
return (0x0100000000010000 <= program_id); // (For forwarders :p) && (program_id <= 0x01FFFFFFFFFFFFFF);
|
||||
return (0x0100000000010000 <= program_id); // (For forwarders :p) /* && (program_id <= 0x01FFFFFFFFFFFFFF); */
|
||||
}
|
||||
|
||||
NX_CONSTEXPR bool IsSystemProcess(u64 program_id)
|
||||
|
|
|
@ -12,4 +12,5 @@ namespace net
|
|||
Result GetMACAddress(u64 *out);
|
||||
|
||||
std::string FormatMACAddress(u64 addr);
|
||||
std::string GetConsoleIPAddress();
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
#include <net/net_Service.hpp>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace net
|
||||
{
|
||||
|
@ -48,4 +51,12 @@ namespace net
|
|||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string GetConsoleIPAddress()
|
||||
{
|
||||
char ipaddr[0x20] = {0};
|
||||
auto ip = gethostid();
|
||||
inet_ntop(AF_INET, &ip, ipaddr, sizeof(ipaddr));
|
||||
return ipaddr;
|
||||
}
|
||||
}
|
82
uLaunch/source/ul_Results.cpp
Normal file
82
uLaunch/source/ul_Results.cpp
Normal file
|
@ -0,0 +1,82 @@
|
|||
|
||||
#include <ul_Results.hpp>
|
||||
#include <vector>
|
||||
|
||||
// Result-making macros
|
||||
|
||||
#define RES_BLOCK_BEGIN static std::vector<ResultModuleImpl> g_result_impl_table = {
|
||||
|
||||
#define RES_MODULE_BEGIN(name, val) { val * 100, #name, {
|
||||
|
||||
#define RES_DEFINE(name, desc) { desc, #name },
|
||||
|
||||
#define RES_MODULE_END } },
|
||||
|
||||
#define RES_BLOCK_END };
|
||||
|
||||
namespace res
|
||||
{
|
||||
struct ResultImpl
|
||||
{
|
||||
u32 res_desc;
|
||||
std::string res_name;
|
||||
};
|
||||
|
||||
struct ResultModuleImpl
|
||||
{
|
||||
u32 mod_val;
|
||||
std::string mod_name;
|
||||
std::vector<ResultImpl> results;
|
||||
};
|
||||
|
||||
RES_BLOCK_BEGIN
|
||||
|
||||
RES_MODULE_BEGIN(Misc, 1)
|
||||
RES_DEFINE(InvalidJSONFile, 1)
|
||||
RES_MODULE_END
|
||||
|
||||
RES_MODULE_BEGIN(Daemon, 2)
|
||||
RES_DEFINE(ApplicationActive, 1)
|
||||
RES_DEFINE(InvalidSelectedUser, 2)
|
||||
RES_DEFINE(AlreadyQueued, 3)
|
||||
RES_DEFINE(ApplicationNotActive, 4)
|
||||
RES_DEFINE(PrivateServiceInvalidProcess, 5)
|
||||
RES_MODULE_END
|
||||
|
||||
RES_MODULE_BEGIN(Menu, 3)
|
||||
RES_DEFINE(RomfsBinNotFound, 1)
|
||||
RES_MODULE_END
|
||||
|
||||
RES_BLOCK_END
|
||||
|
||||
Result GetResultByModuleAndName(std::string mod, std::string name)
|
||||
{
|
||||
for(auto &module: g_result_impl_table)
|
||||
{
|
||||
if(module.mod_name == mod)
|
||||
{
|
||||
for(auto &res: module.results)
|
||||
{
|
||||
if(res.res_name == name)
|
||||
{
|
||||
return MAKERESULT(Module, module.mod_val + res.res_desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetDescriptionByResult(Result rc)
|
||||
{
|
||||
for(auto &module: g_result_impl_table)
|
||||
{
|
||||
for(auto &res: module.results)
|
||||
{
|
||||
auto resval = MAKERESULT(Module, module.mod_val + res.res_desc);
|
||||
if(resval == rc) return module.mod_name + " - " + res.res_name;
|
||||
}
|
||||
}
|
||||
return "Unknown result";
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ namespace ui
|
|||
void OnInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos);
|
||||
protected:
|
||||
pu::String img;
|
||||
pu::ui::render::NativeTexture ntex;
|
||||
pu::sdl2::Texture ntex;
|
||||
s32 x;
|
||||
s32 y;
|
||||
s32 w;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace ui
|
|||
|
||||
void OnLoad() override;
|
||||
|
||||
void SetInformation(am::MenuStartMode mode, am::DaemonStatus status);
|
||||
void SetInformation(am::MenuStartMode mode, am::DaemonStatus status, JSON ui_json);
|
||||
void LoadMenu();
|
||||
void LoadStartupMenu();
|
||||
void LoadThemeMenu();
|
||||
|
@ -44,7 +44,7 @@ namespace ui
|
|||
void ShowNotification(const std::string &text, u64 timeout = 1500);
|
||||
|
||||
template<typename T>
|
||||
T GetUIConfigValue(const std::string &name, T def)
|
||||
inline T GetUIConfigValue(const std::string &name, T def)
|
||||
{
|
||||
return this->uijson.value<T>(name, def);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace ui
|
|||
struct QuickMenuSubItem
|
||||
{
|
||||
std::function<void()> on_select;
|
||||
pu::ui::render::NativeTexture nicon;
|
||||
pu::sdl2::Texture nicon;
|
||||
};
|
||||
|
||||
class QuickMenu : public pu::ui::elm::Element
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ui
|
|||
s32 y;
|
||||
s32 w;
|
||||
s32 h;
|
||||
pu::ui::render::NativeTexture ntex;
|
||||
pu::sdl2::Texture ntex;
|
||||
u8 falpha;
|
||||
void *ptr;
|
||||
size_t fullsz;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace ui
|
|||
static constexpr u32 ExtraIconSize = ItemSize + (Margin * 2);
|
||||
|
||||
public:
|
||||
SideMenu(pu::ui::Color suspended_clr, std::string cursor_path, std::string suspended_img_path, std::string multiselect_img_path, u32 txt_x, u32 txt_y, u32 txt_sz, pu::ui::Color txt_clr, s32 y);
|
||||
SideMenu(pu::ui::Color suspended_clr, std::string cursor_path, std::string suspended_img_path, std::string multiselect_img_path, u32 txt_x, u32 txt_y, pu::String font_name, pu::ui::Color txt_clr, s32 y);
|
||||
PU_SMART_CTOR(SideMenu)
|
||||
~SideMenu();
|
||||
|
||||
|
@ -65,14 +65,14 @@ namespace ui
|
|||
std::vector<bool> icons_mselected;
|
||||
std::function<void(u64, u32)> onselect;
|
||||
std::function<void(u32)> onselch;
|
||||
std::vector<pu::ui::render::NativeTexture> ricons;
|
||||
std::vector<pu::ui::render::NativeTexture> ricons_texts;
|
||||
pu::ui::render::NativeTexture cursoricon;
|
||||
pu::ui::render::NativeTexture suspicon;
|
||||
pu::ui::render::NativeTexture leftbicon;
|
||||
pu::ui::render::NativeTexture rightbicon;
|
||||
pu::ui::render::NativeTexture mselicon;
|
||||
pu::ui::render::NativeFont textfont;
|
||||
std::vector<pu::sdl2::Texture> ricons;
|
||||
std::vector<pu::sdl2::Texture> ricons_texts;
|
||||
pu::sdl2::Texture cursoricon;
|
||||
pu::sdl2::Texture suspicon;
|
||||
pu::sdl2::Texture leftbicon;
|
||||
pu::sdl2::Texture rightbicon;
|
||||
pu::sdl2::Texture mselicon;
|
||||
pu::String textfont;
|
||||
std::chrono::steady_clock::time_point scrolltp;
|
||||
bool scrollmoveflag;
|
||||
std::chrono::steady_clock::time_point scrollmovetp;
|
||||
|
|
|
@ -31,7 +31,7 @@ cfg::TitleList g_entry_list;
|
|||
std::vector<cfg::TitleRecord> g_homebrew_records;
|
||||
cfg::Config g_ul_config;
|
||||
cfg::Theme g_ul_theme;
|
||||
u8 *app_buf;
|
||||
u8 *g_app_capture_buffer;
|
||||
|
||||
namespace qmenu
|
||||
{
|
||||
|
@ -50,8 +50,7 @@ namespace qmenu
|
|||
ui::QuickMenu::RegisterHomeButtonDetection();
|
||||
|
||||
// Initialize Daemon message handling
|
||||
UL_ASSERT(am::InitializeDaemonMessageHandler())
|
||||
|
||||
UL_ASSERT(am::InitializeDaemonMessageHandler());
|
||||
|
||||
// Load menu g_ul_config and theme
|
||||
g_ul_config = cfg::EnsureConfig();
|
||||
|
@ -92,7 +91,7 @@ int main()
|
|||
UL_ASSERT(romfsMountFromFsdev(MENU_ROMFS_BIN, 0, "romfs"))
|
||||
|
||||
// After initializing RomFs, start initializing the rest of stuff here
|
||||
app_buf = new u8[RawRGBAScreenBufferSize]();
|
||||
g_app_capture_buffer = new u8[RawRGBAScreenBufferSize]();
|
||||
qmenu::Initialize();
|
||||
|
||||
g_entry_list = cfg::LoadTitleList();
|
||||
|
@ -103,33 +102,33 @@ int main()
|
|||
std::string syslang = (char*)&lcode;
|
||||
auto lpath = cfg::GetLanguageJSONPath(syslang);
|
||||
auto [rc1, defjson] = util::LoadJSONFromFile(CFG_LANG_DEFAULT);
|
||||
if(R_SUCCEEDED(rc1))
|
||||
UL_ASSERT(rc1);
|
||||
g_ul_config.default_lang = defjson;
|
||||
g_ul_config.main_lang = defjson;
|
||||
if(fs::ExistsFile(lpath))
|
||||
{
|
||||
g_ul_config.default_lang = defjson;
|
||||
g_ul_config.main_lang = defjson;
|
||||
if(fs::ExistsFile(lpath))
|
||||
{
|
||||
auto [rc2, ljson] = util::LoadJSONFromFile(lpath);
|
||||
if(R_SUCCEEDED(rc2)) g_ul_config.main_lang = ljson;
|
||||
}
|
||||
auto [rc2, ljson] = util::LoadJSONFromFile(lpath);
|
||||
if(R_SUCCEEDED(rc2)) g_ul_config.main_lang = ljson;
|
||||
}
|
||||
|
||||
auto renderoptions = pu::ui::render::RendererInitOptions::RendererEverything;
|
||||
renderoptions.InitRomFs = false; // We have loaded RomFs from an external file, so :P
|
||||
// Get the text sizes to initialize default fonts
|
||||
auto [rc2, uijson] = util::LoadJSONFromFile(cfg::GetAssetByTheme(g_ul_theme, "ui/UI.json"));
|
||||
UL_ASSERT(rc2);
|
||||
auto menu_folder_txt_sz = uijson.value<u32>("menu_folder_text_size", 25);
|
||||
|
||||
auto renderer = pu::ui::render::Renderer::New(SDL_INIT_EVERYTHING, renderoptions, pu::ui::render::RendererHardwareFlags);
|
||||
auto renderer = pu::ui::render::Renderer::New(pu::ui::render::RendererInitOptions(SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags).WithIMG(pu::ui::render::IMGAllFlags).WithMixer(pu::ui::render::MixerAllFlags).WithTTF().WithDefaultFontSize(menu_folder_txt_sz));
|
||||
g_menu_app_instance = ui::MenuApplication::New(renderer);
|
||||
|
||||
g_menu_app_instance->SetInformation(smode, status);
|
||||
g_menu_app_instance->SetInformation(smode, status, uijson);
|
||||
g_menu_app_instance->Prepare();
|
||||
|
||||
if(smode == am::MenuStartMode::MenuApplicationSuspended) g_menu_app_instance->Show();
|
||||
else g_menu_app_instance->ShowWithFadeIn();
|
||||
|
||||
// Exit RomFs manually, Plutonium won't do it for us since we're initializing it manually
|
||||
// Exit RomFs manually, as we initialized it manually too
|
||||
romfsExit();
|
||||
|
||||
delete[] app_buf;
|
||||
delete[] g_app_capture_buffer;
|
||||
qmenu::Exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <ui/ui_MenuApplication.hpp>
|
||||
#include <util/util_Misc.hpp>
|
||||
|
||||
extern u8 *app_buf;
|
||||
extern u8 *g_app_capture_buffer;
|
||||
extern cfg::Theme g_ul_theme;
|
||||
extern ui::MenuApplication::Ref g_menu_app_instance;
|
||||
|
||||
|
@ -46,16 +46,14 @@ namespace ui
|
|||
|
||||
void MenuApplication::OnLoad()
|
||||
{
|
||||
pu::ui::render::SetDefaultFont(cfg::GetAssetByTheme(g_ul_theme, "ui/Font.ttf"));
|
||||
// pu::ui::render::SetDefaultFont(cfg::GetAssetByTheme(g_ul_theme, "ui/Font.ttf"));
|
||||
|
||||
if(this->IsSuspended())
|
||||
{
|
||||
bool flag;
|
||||
appletGetLastApplicationCaptureImageEx(app_buf, RawRGBAScreenBufferSize, &flag);
|
||||
appletGetLastApplicationCaptureImageEx(g_app_capture_buffer, RawRGBAScreenBufferSize, &flag);
|
||||
}
|
||||
|
||||
auto [_rc, jui] = util::LoadJSONFromFile(cfg::GetAssetByTheme(g_ul_theme, "ui/UI.json"));
|
||||
this->uijson = jui;
|
||||
auto [_rc2, jbgm] = util::LoadJSONFromFile(cfg::GetAssetByTheme(g_ul_theme, "sound/BGM.json"));
|
||||
this->bgmjson = jbgm;
|
||||
this->bgm_loop = this->bgmjson.value("loop", true);
|
||||
|
@ -64,12 +62,12 @@ namespace ui
|
|||
|
||||
pu::ui::Color toasttextclr = pu::ui::Color::FromHex(GetUIConfigValue<std::string>("toast_text_color", "#e1e1e1ff"));
|
||||
pu::ui::Color toastbaseclr = pu::ui::Color::FromHex(GetUIConfigValue<std::string>("toast_base_color", "#282828ff"));
|
||||
this->notifToast = pu::ui::extras::Toast::New("...", 20, toasttextclr, toastbaseclr);
|
||||
this->notifToast = pu::ui::extras::Toast::New("...", "DefaultFont@20", toasttextclr, toastbaseclr);
|
||||
|
||||
this->bgm = pu::audio::Open(cfg::GetAssetByTheme(g_ul_theme, "sound/BGM.mp3"));
|
||||
|
||||
this->startupLayout = StartupLayout::New();
|
||||
this->menuLayout = MenuLayout::New(app_buf, this->uijson.value("suspended_final_alpha", 80));
|
||||
this->menuLayout = MenuLayout::New(g_app_capture_buffer, this->uijson.value("suspended_final_alpha", 80));
|
||||
this->themeMenuLayout = ThemeMenuLayout::New();
|
||||
this->settingsMenuLayout = SettingsMenuLayout::New();
|
||||
this->languagesMenuLayout = LanguagesMenuLayout::New();
|
||||
|
@ -86,10 +84,11 @@ namespace ui
|
|||
}
|
||||
}
|
||||
|
||||
void MenuApplication::SetInformation(am::MenuStartMode mode, am::DaemonStatus status)
|
||||
void MenuApplication::SetInformation(am::MenuStartMode mode, am::DaemonStatus status, JSON ui_json)
|
||||
{
|
||||
this->stmode = mode;
|
||||
this->status = status;
|
||||
this->uijson = ui_json;
|
||||
}
|
||||
|
||||
void MenuApplication::LoadMenu()
|
||||
|
|
|
@ -105,20 +105,23 @@ namespace ui
|
|||
g_menu_app_instance->ApplyConfigForElement("main_menu", "menu_toggle_button", this->menuToggle);
|
||||
this->Add(this->menuToggle);
|
||||
|
||||
this->itemName = pu::ui::elm::TextBlock::New(40, 610, "", 30);
|
||||
this->itemName = pu::ui::elm::TextBlock::New(40, 610, "");
|
||||
this->itemName->SetFont("DefaultFont@30");
|
||||
this->itemName->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("main_menu", "banner_name_text", this->itemName);
|
||||
this->Add(this->itemName);
|
||||
this->itemAuthor = pu::ui::elm::TextBlock::New(45, 650, "", 20);
|
||||
this->itemAuthor = pu::ui::elm::TextBlock::New(45, 650, "");
|
||||
this->itemAuthor->SetFont("DefaultFont@20");
|
||||
this->itemAuthor->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("main_menu", "banner_author_text", this->itemAuthor);
|
||||
this->Add(this->itemAuthor);
|
||||
this->itemVersion = pu::ui::elm::TextBlock::New(45, 675, "", 20);
|
||||
this->itemVersion = pu::ui::elm::TextBlock::New(45, 675, "");
|
||||
this->itemVersion->SetFont("DefaultFont@30");
|
||||
this->itemVersion->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("main_menu", "banner_version_text", this->itemVersion);
|
||||
this->Add(this->itemVersion);
|
||||
|
||||
this->itemsMenu = SideMenu::New(pu::ui::Color(0, 255, 120, 255), cfg::GetAssetByTheme(g_ul_theme, "ui/Cursor.png"), cfg::GetAssetByTheme(g_ul_theme, "ui/Suspended.png"), cfg::GetAssetByTheme(g_ul_theme, "ui/Multiselect.png"), menutextx, menutexty, menutextsz, textclr, 294);
|
||||
std::string font_name = "DefaultFont@" + std::to_string(menutextsz);
|
||||
this->itemsMenu = SideMenu::New(pu::ui::Color(0, 255, 120, 255), cfg::GetAssetByTheme(g_ul_theme, "ui/Cursor.png"), cfg::GetAssetByTheme(g_ul_theme, "ui/Suspended.png"), cfg::GetAssetByTheme(g_ul_theme, "ui/Multiselect.png"), menutextx, menutexty, font_name, textclr, 294);
|
||||
this->MoveFolder("", false);
|
||||
this->itemsMenu->SetOnItemSelected(std::bind(&MenuLayout::menu_Click, this, std::placeholders::_1, std::placeholders::_2));
|
||||
this->itemsMenu->SetOnSelectionChanged(std::bind(&MenuLayout::menu_OnSelected, this, std::placeholders::_1));
|
||||
|
|
|
@ -129,6 +129,8 @@ namespace ui
|
|||
net::GetMACAddress(&mac);
|
||||
auto strmac = net::FormatMACAddress(mac);
|
||||
this->PushSettingItem(cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "set_mac_addr"), EncodeForSettings(strmac), -1);
|
||||
auto ipstr = net::GetConsoleIPAddress();
|
||||
this->PushSettingItem("Console IP address", EncodeForSettings(ipstr), -1);
|
||||
}
|
||||
|
||||
void SettingsMenuLayout::PushSettingItem(const std::string &name, const std::string &value_display, int id)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace ui
|
||||
{
|
||||
SideMenu::SideMenu(pu::ui::Color suspended_clr, std::string cursor_path, std::string suspended_img_path, std::string multiselect_img_path, u32 txt_x, u32 txt_y, u32 txt_sz, pu::ui::Color txt_clr, s32 y)
|
||||
SideMenu::SideMenu(pu::ui::Color suspended_clr, std::string cursor_path, std::string suspended_img_path, std::string multiselect_img_path, u32 txt_x, u32 txt_y, pu::String font_name, pu::ui::Color txt_clr, s32 y)
|
||||
{
|
||||
this->selitm = 0;
|
||||
this->suspitm = -1;
|
||||
|
@ -15,7 +15,7 @@ namespace ui
|
|||
this->cursoricon = pu::ui::render::LoadImage(cursor_path);
|
||||
this->suspicon = pu::ui::render::LoadImage(suspended_img_path);
|
||||
this->mselicon = pu::ui::render::LoadImage(multiselect_img_path);
|
||||
this->textfont = pu::ui::render::LoadDefaultFont(txt_sz);
|
||||
this->textfont = font_name;
|
||||
this->textx = txt_x;
|
||||
this->texty = txt_y;
|
||||
this->textclr = txt_clr;
|
||||
|
@ -80,7 +80,7 @@ namespace ui
|
|||
auto icon = pu::ui::render::LoadImage(this->icons[this->baseiconidx + i]);
|
||||
auto text = this->icons_texts[this->baseiconidx + i];
|
||||
this->ricons.push_back(icon);
|
||||
pu::ui::render::NativeTexture ntext = nullptr;
|
||||
pu::sdl2::Texture ntext = nullptr;
|
||||
if(!text.empty()) ntext = pu::ui::render::RenderText(this->textfont, text, this->textclr);
|
||||
this->ricons_texts.push_back(ntext);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ namespace ui
|
|||
auto icon = pu::ui::render::LoadImage(this->icons[this->selitm]);
|
||||
this->ricons.insert(this->ricons.begin(), icon);
|
||||
auto text = this->icons_texts[this->selitm];
|
||||
pu::ui::render::NativeTexture ntext = nullptr;
|
||||
pu::sdl2::Texture ntext = nullptr;
|
||||
if(!text.empty()) ntext = pu::ui::render::RenderText(this->textfont, text, this->textclr);
|
||||
this->ricons_texts.insert(this->ricons_texts.begin(), ntext);
|
||||
this->baseiconidx--;
|
||||
|
|
|
@ -27,20 +27,24 @@ namespace ui
|
|||
g_menu_app_instance->ApplyConfigForElement("themes_menu", "themes_menu_item", this->themesMenu);
|
||||
this->Add(this->themesMenu);
|
||||
|
||||
this->curThemeText = pu::ui::elm::TextBlock::New(20, 540, cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "theme_current") + ":", 30);
|
||||
this->curThemeText = pu::ui::elm::TextBlock::New(20, 540, cfg::GetLanguageString(g_ul_config.main_lang, g_ul_config.default_lang, "theme_current") + ":");
|
||||
this->curThemeText->SetFont("DefaultFont@30");
|
||||
this->curThemeText->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("themes_menu", "current_theme_text", this->curThemeText);
|
||||
this->Add(this->curThemeText);
|
||||
|
||||
this->curThemeName = pu::ui::elm::TextBlock::New(40, 610, "", 30);
|
||||
this->curThemeName = pu::ui::elm::TextBlock::New(40, 610, "");
|
||||
this->curThemeName->SetFont("DefaultFont@30");
|
||||
this->curThemeName->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("themes_menu", "current_theme_name_text", this->curThemeName);
|
||||
this->Add(this->curThemeName);
|
||||
this->curThemeAuthor = pu::ui::elm::TextBlock::New(45, 650, "", 20);
|
||||
this->curThemeAuthor = pu::ui::elm::TextBlock::New(45, 650, "");
|
||||
this->curThemeAuthor->SetFont("DefaultFont@20");
|
||||
this->curThemeAuthor->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("themes_menu", "current_theme_author_text", this->curThemeAuthor);
|
||||
this->Add(this->curThemeAuthor);
|
||||
this->curThemeVersion = pu::ui::elm::TextBlock::New(45, 675, "", 20);
|
||||
this->curThemeVersion = pu::ui::elm::TextBlock::New(45, 675, "");
|
||||
this->curThemeVersion->SetFont("DefaultFont@30");
|
||||
this->curThemeVersion->SetColor(textclr);
|
||||
g_menu_app_instance->ApplyConfigForElement("themes_menu", "current_theme_version_text", this->curThemeVersion);
|
||||
this->Add(this->curThemeVersion);
|
||||
|
|
Loading…
Add table
Reference in a new issue