Add master libnx as a temporary submodule, fix weird apm bugs with QDaemon

This commit is contained in:
XorTroll 2019-12-23 14:17:02 +01:00
parent 1f0b9782de
commit 4e9fc02180
11 changed files with 40 additions and 42 deletions

3
.gitmodules vendored
View file

@ -4,3 +4,6 @@
[submodule "libstratosphere"]
path = libstratosphere
url = https://github.com/Atmosphere-NX/libstratosphere
[submodule "master-libnx"]
path = master-libnx
url = https://github.com/switchbrew/libnx

View file

@ -1,26 +0,0 @@
#include <q_Include.hpp>
extern "C"
{
void __appExit(void);
void NORETURN __nx_exit(Result rc, LoaderReturnFn retaddr);
void NORETURN __libnx_exit(int rc)
{
// Call destructors.
void __libc_fini_array(void);
__libc_fini_array();
// Clean up services.
__appExit();
// 3.0.0 libnx fucked up _appletExitProcess() process-exiting call, and fixed it in later commits.
// Adding this manually until a new version is released with the fix, then this will be removed.
// Explicitly initialize applet again, since applet-based exiting needs this, and since it isn't added in 3.0.0, we wrap it here
// TODO: remove this when next libnx releases
appletInitialize();
__nx_exit(0, envGetExitFuncPtr());
}
}

View file

@ -45,7 +45,7 @@ LIBS := -lnx
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
LIBDIRS := $(PORTLIBS) $(CURDIR)/../master-libnx/nx
#---------------------------------------------------------------------------------

View file

@ -5,6 +5,10 @@ extern "C"
{
u32 __nx_applet_type = AppletType_LibraryApplet;
u32 __nx_applet_exit_mode = 2;
void __appExit(void)
{
}
}
hb::TargetInput hb_input;

View file

@ -4,10 +4,10 @@
"title_id_range_min": "0x010000000000100B",
"title_id_range_max": "0x010000000000100B",
"main_thread_stack_size": "0x100000",
"main_thread_priority": 49,
"default_cpu_id": 3,
"main_thread_priority": 44,
"default_cpu_id": 0,
"process_category": 0,
"pool_partition": 1,
"pool_partition": 0,
"is_64_bit": true,
"address_space_type": 1,
"is_retail": true,
@ -24,10 +24,10 @@
{
"type": "kernel_flags",
"value": {
"highest_thread_priority": 63,
"lowest_thread_priority": 16,
"lowest_cpu_id": 3,
"highest_cpu_id": 3
"highest_thread_priority": 59,
"lowest_thread_priority": 28,
"highest_cpu_id": 2,
"lowest_cpu_id": 0
}
},
{
@ -146,7 +146,18 @@
},
{
"type": "min_kernel_version",
"value": "0x0030"
"value": "0x30"
},
{
"type": "handle_table_size",
"value": 512
},
{
"type": "debug_flags",
"value": {
"allow_debug": true,
"force_debug": true
}
}
]
}

View file

@ -45,7 +45,7 @@ LIBS := -lnx -lpu -lfreetype -lSDL2_mixer -lopusfile -lopus -lmodplug -lmpg123 -
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX) $(CURDIR)/../Plutonium/Plutonium/Output
LIBDIRS := $(PORTLIBS) $(CURDIR)/../master-libnx/nx $(CURDIR)/../Plutonium/Plutonium/Output
#---------------------------------------------------------------------------------

View file

@ -55,9 +55,6 @@ namespace qmenu
net::Finalize();
nsExit();
accountExit();
// Explicitly call appletExit (due to bad handling in 3.0.0 libnx)
appletExit();
}
}
@ -116,6 +113,9 @@ int main()
if(smode == am::QMenuStartMode::MenuApplicationSuspended) qapp->Show();
else qapp->ShowWithFadeIn();
// Exit RomFs manually, Plutonium won't do it for us since we're initializing it manually
romfsExit();
delete[] app_buf;
qmenu::Exit();
}

View file

@ -4,6 +4,7 @@ export Q_VERSION := 0.2
.PHONY: all dev clean
all:
@$(MAKE) -C master-libnx/
@$(MAKE) -C libstratosphere/
@$(MAKE) -C SystemAppletQDaemon/
@$(MAKE) -C LibraryAppletQMenu/
@ -28,6 +29,7 @@ dev: setdev all
clean:
@rm -rf $(CURDIR)/SdOut
@$(MAKE) clean -C master-libnx/
@$(MAKE) clean -C libstratosphere/
@$(MAKE) clean -C SystemAppletQDaemon/
@$(MAKE) clean -C LibraryAppletQMenu/

View file

@ -3,7 +3,10 @@
#---------------------------------------------------------------------------------
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../libstratosphere/config/templates/stratosphere.mk
CXXFLAGS += -fexceptions -DQ_VERSION=\"$(Q_VERSION)\"
APMWRAPS := -Wl,-wrap,apmInitialize -Wl,-wrap,apmSetPerformanceConfiguration -Wl,-wrap,apmExit
CXXFLAGS += -fexceptions -DQ_VERSION=\"$(Q_VERSION)\" $(APMWRAPS)
LDFLAGS += $(APMWRAPS)
ifeq ($(Q_DEV),1)
CXXFLAGS += -DQ_DEV

View file

@ -45,7 +45,7 @@ LIBS := -lnx
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
LIBDIRS := $(PORTLIBS) $(CURDIR)/../master-libnx/nx
#---------------------------------------------------------------------------------

1
master-libnx Submodule

@ -0,0 +1 @@
Subproject commit f043307e7f580f6507f4285c898c6ac725bb364f