mirror of
https://gitlab.com/Theopse/fbi-i18n-zh.git
synced 2025-04-06 03:58:02 +08:00
Show console output for kernel access attempts.
This commit is contained in:
parent
256c19c3cc
commit
e1d2805281
@ -1,3 +1,4 @@
|
||||
#include <sys/iosupport.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,7 +53,23 @@ static int util_get_lines(PrintConsole* console, const char* str) {
|
||||
return lines;
|
||||
}
|
||||
|
||||
static const devoptab_t* consoleStdOut = NULL;
|
||||
static const devoptab_t* consoleStdErr = NULL;
|
||||
|
||||
void util_store_console_std() {
|
||||
consoleStdOut = devoptab_list[STD_OUT];
|
||||
consoleStdErr = devoptab_list[STD_ERR];
|
||||
}
|
||||
|
||||
void util_panic(const char* s, ...) {
|
||||
if(consoleStdOut != NULL) {
|
||||
devoptab_list[STD_OUT] = consoleStdOut;
|
||||
}
|
||||
|
||||
if(consoleStdErr != NULL) {
|
||||
devoptab_list[STD_ERR] = consoleStdErr;
|
||||
}
|
||||
|
||||
va_list list;
|
||||
va_start(list, s);
|
||||
|
||||
|
@ -38,6 +38,7 @@ typedef struct {
|
||||
u16 animationSequence[0x40];
|
||||
} BNR;
|
||||
|
||||
void util_store_console_std();
|
||||
void util_panic(const char* s, ...);
|
||||
|
||||
FS_Path* util_make_path_utf8(const char* path);
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include <sys/iosupport.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
@ -86,7 +88,21 @@ void init() {
|
||||
}
|
||||
|
||||
if(R_FAILED(init_services())) {
|
||||
const devoptab_t* oldStdOut = devoptab_list[STD_OUT];
|
||||
const devoptab_t* oldStdErr = devoptab_list[STD_ERR];
|
||||
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
util_store_console_std();
|
||||
|
||||
printf("Attempting to acquire kernel access...");
|
||||
svchax_init(true);
|
||||
|
||||
devoptab_list[STD_OUT] = oldStdOut;
|
||||
devoptab_list[STD_ERR] = oldStdErr;
|
||||
|
||||
gfxSetScreenFormat(GFX_TOP, GSP_BGR8_OES);
|
||||
gfxSetDoubleBuffering(GFX_TOP, true);
|
||||
|
||||
if(!__ctr_svchax || !__ctr_svchax_srv) {
|
||||
util_panic("Failed to acquire kernel access.");
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user