Use libmocha

This commit is contained in:
Maschell 2022-09-04 22:46:59 +02:00
parent fd647fc2e8
commit f8f33ea7c2
2 changed files with 13 additions and 11 deletions

View File

@ -48,13 +48,13 @@ CXXFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
CFLAGS += -DDEBUG -DVERBOSE_DEBUG -g
endif
LIBS := -lwums -lwut -lkernel
LIBS := -lwums -lwut -lkernel -lmocha
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level
# containing include and lib
#-------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(WUT_ROOT) $(WUMS_ROOT)
LIBDIRS := $(PORTLIBS) $(WUT_ROOT) $(WUT_ROOT)/usr $(WUMS_ROOT)
#-------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional

View File

@ -3,6 +3,7 @@
#include <coreinit/cache.h>
#include <coreinit/ios.h>
#include <kernel/kernel.h>
#include <mocha/mocha.h>
#include <wums.h>
WUMS_MODULE_EXPORT_NAME("homebrew_usbseriallogging");
@ -12,15 +13,16 @@ extern "C" void SC_0x51();
WUMS_INITIALIZE() {
initLogging();
// Start syslogging on iosu side
int mcpFd = IOS_Open("/dev/mcp", (IOSOpenMode) 0);
if (mcpFd >= 0) {
int in = 0xFA; // IPC_CUSTOM_START_USB_LOGGING
int out = 0;
IOS_Ioctl(mcpFd, 100, &in, sizeof(in), &out, sizeof(out));
IOS_Close(mcpFd);
} else {
DEBUG_FUNCTION_LINE_ERR("Failed to open /dev/mcp");
int res;
if ((res = Mocha_InitLibrary()) != MOCHA_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE_ERR("Mocha_InitLibrary() failed %d", res);
return;
}
if (Mocha_StartUSBLogging(false) != MOCHA_RESULT_SUCCESS) {
DEBUG_FUNCTION_LINE_ERR("Mocha_StartUSBLogging failed");
return;
}
// Patch loader.elf to spit out less warnings when loading .rpx built with wut