mirror of
https://github.com/wiiu-env/MochaPayload.git
synced 2024-12-22 22:21:52 +01:00
Remove unused code to reduce ios_kernel size
This commit is contained in:
parent
9af94a9fcd
commit
780b276460
@ -26,3 +26,4 @@ SECTIONS
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT((SIZEOF(.text) + SIZEOF(.rodata) + SIZEOF(.data) + SIZEOF(.bss)) < 0x4200, "elf is too big");
|
@ -1,52 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
|
||||
void crash_handler(unsigned int *context, int type) {
|
||||
clearScreen(0xFFFFFFFF);
|
||||
|
||||
if (type == 0) {
|
||||
_printf(0, 0, "GURU MEDITATION ERROR (prefetch abort)");
|
||||
} else if (type == 1) {
|
||||
_printf(0, 0, "GURU MEDITATION ERROR (data abort)");
|
||||
} else {
|
||||
_printf(0, 0, "GURU MEDITATION ERROR (undefined instruction)");
|
||||
}
|
||||
|
||||
int reg = 0;
|
||||
while (reg < 16) {
|
||||
if (reg < 10) {
|
||||
_printf(20, 40 + reg * 20, "r%d = %08X", reg, context[1 + reg]);
|
||||
} else {
|
||||
_printf(20, 40 + reg * 20, "r%d = %08X", reg, context[1 + reg]);
|
||||
}
|
||||
|
||||
reg++;
|
||||
}
|
||||
|
||||
_printf(400, 20, "%08X", *(u32 *) context[0x10]);
|
||||
|
||||
for (;;);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2016
|
||||
* by Dimok
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any
|
||||
* damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any
|
||||
* purpose, including commercial applications, and to alter it and
|
||||
* redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you
|
||||
* must not claim that you wrote the original software. If you use
|
||||
* this software in a product, an acknowledgment in the product
|
||||
* documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and
|
||||
* must not be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
***************************************************************************/
|
||||
#ifndef _EXCEPTION_HANDLER_H
|
||||
#define _EXCEPTION_HANDLER_H
|
||||
|
||||
void crash_handler(unsigned int *context, int type);
|
||||
|
||||
static inline void crash_handler_prefetch(unsigned int *context, int unused1, int unused2) {
|
||||
crash_handler(context, 0);
|
||||
}
|
||||
|
||||
static inline void crash_handler_data(unsigned int *context, int unused1, int unused2) {
|
||||
crash_handler(context, 1);
|
||||
}
|
||||
|
||||
static inline void crash_handler_undef_instr(unsigned int *context, int unused1, int unused2) {
|
||||
crash_handler(context, 2);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,65 +0,0 @@
|
||||
static const unsigned char font_bin[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x18,
|
||||
0x18, 0x00, 0x0c, 0x00, 0x00, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x66, 0x66, 0xff, 0x66, 0xff, 0x66, 0x66, 0x00, 0x18, 0x7c, 0x06,
|
||||
0x3c, 0x60, 0x3e, 0x18, 0x10, 0x46, 0x66, 0x30, 0x18, 0x0c, 0x66, 0x62,
|
||||
0x00, 0x3c, 0x66, 0x3c, 0x1c, 0xe6, 0x66, 0xfc, 0x00, 0x18, 0x0c, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x00,
|
||||
0x00, 0x0c, 0x18, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x66, 0x3c, 0xff,
|
||||
0x3c, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x3e,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
|
||||
0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x3c, 0x66, 0x76,
|
||||
0x6e, 0x66, 0x3c, 0x00, 0x00, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x7e, 0x00,
|
||||
0x00, 0x3c, 0x62, 0x30, 0x0c, 0x06, 0x7e, 0x00, 0x00, 0x3c, 0x62, 0x38,
|
||||
0x60, 0x66, 0x3c, 0x00, 0x00, 0x6c, 0x6c, 0x66, 0xfe, 0x60, 0x60, 0x00,
|
||||
0x00, 0x7e, 0x06, 0x7e, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x3c, 0x06, 0x3e,
|
||||
0x66, 0x66, 0x3c, 0x00, 0x00, 0x7e, 0x30, 0x30, 0x18, 0x18, 0x18, 0x00,
|
||||
0x00, 0x3c, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x3c, 0x66, 0x7c,
|
||||
0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00,
|
||||
0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x70, 0x1c, 0x06,
|
||||
0x06, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0e, 0x38, 0x60, 0x60, 0x38, 0x0e, 0x00, 0x00, 0x3c, 0x66, 0x30,
|
||||
0x18, 0x00, 0x18, 0x00, 0x00, 0x3c, 0x66, 0x76, 0x76, 0x06, 0x46, 0x3c,
|
||||
0x00, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x3e, 0x66, 0x3e,
|
||||
0x66, 0x66, 0x3e, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x1e, 0x36, 0x66, 0x66, 0x36, 0x1e, 0x00, 0x00, 0x7e, 0x06, 0x1e,
|
||||
0x06, 0x06, 0x7e, 0x00, 0x00, 0x3e, 0x06, 0x1e, 0x06, 0x06, 0x06, 0x00,
|
||||
0x00, 0x3c, 0x66, 0x06, 0x76, 0x66, 0x3c, 0x00, 0x00, 0x66, 0x66, 0x7e,
|
||||
0x66, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00,
|
||||
0x00, 0x78, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x66, 0x36, 0x1e,
|
||||
0x1e, 0x36, 0x66, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7e, 0x00,
|
||||
0x00, 0x46, 0x6e, 0x7e, 0x56, 0x46, 0x46, 0x00, 0x00, 0x66, 0x6e, 0x7e,
|
||||
0x76, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x3e, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x3c, 0x66, 0x66,
|
||||
0x66, 0x3c, 0x70, 0x00, 0x00, 0x3e, 0x66, 0x3e, 0x1e, 0x36, 0x66, 0x00,
|
||||
0x00, 0x3c, 0x66, 0x0c, 0x30, 0x66, 0x3c, 0x00, 0x00, 0x7e, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x46, 0x46, 0x56,
|
||||
0x7e, 0x6e, 0x46, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00,
|
||||
0x00, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x00, 0x7e, 0x30, 0x18,
|
||||
0x0c, 0x06, 0x7e, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c,
|
||||
0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x3c, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x3c, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x0c, 0x18, 0x30,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x7c, 0x00,
|
||||
0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x06,
|
||||
0x06, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x3c, 0x00, 0x00, 0x38, 0x0c, 0x3e,
|
||||
0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x7c, 0x40, 0x3c, 0x00,
|
||||
0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x18, 0x00, 0x1c,
|
||||
0x18, 0x18, 0x3c, 0x00, 0x00, 0x30, 0x00, 0x30, 0x30, 0x30, 0x1e, 0x00,
|
||||
0x00, 0x06, 0x06, 0x36, 0x1e, 0x36, 0x66, 0x00, 0x00, 0x1c, 0x18, 0x18,
|
||||
0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x66, 0xfe, 0xfe, 0xd6, 0xc6, 0x00,
|
||||
0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
||||
0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x00,
|
||||
0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x66,
|
||||
0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x06, 0x3c, 0x60, 0x3e, 0x00,
|
||||
0x00, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x66, 0x66,
|
||||
0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xd6, 0xfe, 0x7c, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x3c,
|
||||
0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x7c, 0x60, 0x3c, 0x00,
|
||||
0x00, 0x00, 0x7e, 0x30, 0x18, 0x0c, 0x7e, 0x00, 0x00, 0x00, 0x18, 0x08,
|
||||
0x08, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x0c, 0x08, 0x08, 0x10, 0x08, 0x08
|
||||
};
|
@ -26,7 +26,6 @@
|
||||
#include "elf_patcher.h"
|
||||
#include "ios_mcp_patches.h"
|
||||
#include "kernel_patches.h"
|
||||
#include "exception_handler.h"
|
||||
#include "fsa.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -108,10 +107,6 @@ void kernel_run_patches(u32 ios_elf_start) {
|
||||
|
||||
section_write(ios_elf_start, 0x08140DE0, KERNEL_MCP_IOMAPPINGS_STRUCT, sizeof(KERNEL_MCP_IOMAPPINGS_STRUCT));
|
||||
|
||||
section_write_word(ios_elf_start, 0x0812A134, ARM_BL(0x0812A134, crash_handler_prefetch));
|
||||
section_write_word(ios_elf_start, 0x0812A1AC, ARM_BL(0x0812A1AC, crash_handler_data));
|
||||
section_write_word(ios_elf_start, 0x08129E50, ARM_BL(0x08129E50, crash_handler_undef_instr));
|
||||
|
||||
// patch /dev/odm IOCTL 0x06 to return the disc key if in_buf[0] > 2.
|
||||
section_write_word(ios_elf_start, 0x10739948, 0xe3a0b001);
|
||||
section_write_word(ios_elf_start, 0x1073994C, 0xe3a07020);
|
||||
|
@ -86,11 +86,9 @@ int _main() {
|
||||
payload_info_t *payloads = (payload_info_t *) 0x00148000;
|
||||
kernel_memcpy((void *) USB_PHYS_CODE_BASE, payloads->data, payloads->size);
|
||||
|
||||
|
||||
payloads = (payload_info_t *) 0x00160000;
|
||||
kernel_memcpy((void *) mcp_get_phys_code_base(), payloads->data, payloads->size);
|
||||
|
||||
|
||||
// run all instant patches as necessary
|
||||
instant_patches_setup();
|
||||
|
||||
|
@ -1,82 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "font_bin.h"
|
||||
|
||||
#define FRAMEBUFFER_ADDRESS (0x14000000+0x38C0000)
|
||||
#define FRAMEBUFFER_STRIDE (0xE00)
|
||||
#define FRAMEBUFFER_STRIDE_WORDS (FRAMEBUFFER_STRIDE >> 2)
|
||||
|
||||
#define CHAR_MULT 2
|
||||
#define CHAR_SIZE_X 8
|
||||
#define CHAR_SIZE_Y 8
|
||||
|
||||
|
||||
u32 *const framebuffer = (u32 *) FRAMEBUFFER_ADDRESS;
|
||||
|
||||
void clearScreen(u32 color) {
|
||||
int i;
|
||||
for (i = 0; i < 896 * 504; i++) {
|
||||
framebuffer[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void drawCharacter(char c, int x, int y) {
|
||||
if (c < 32)return;
|
||||
c -= 32;
|
||||
u8 *charData = (u8 *) &font_bin[(int) c << 3];
|
||||
u32 *fb = &framebuffer[x + y * FRAMEBUFFER_STRIDE_WORDS];
|
||||
int i, j, n, k;
|
||||
for (i = 0; i < CHAR_SIZE_Y; i++) {
|
||||
for (k = 0; k < CHAR_MULT; k++) {
|
||||
u8 v = *charData;
|
||||
|
||||
for (j = 0; j < CHAR_SIZE_X; j++) {
|
||||
for (n = 0; n < CHAR_MULT; n++) {
|
||||
if (v & 1) {
|
||||
*fb = 0x00000000;
|
||||
} else {
|
||||
*fb = 0xFFFFFFFF;
|
||||
}
|
||||
fb++;
|
||||
}
|
||||
v >>= 1;
|
||||
}
|
||||
fb += FRAMEBUFFER_STRIDE_WORDS - CHAR_SIZE_X * CHAR_MULT;
|
||||
}
|
||||
charData++;
|
||||
}
|
||||
}
|
||||
|
||||
void drawString(char *str, int x, int y) {
|
||||
if (!str) return;
|
||||
int k;
|
||||
int dx = 0, dy = 0;
|
||||
for (k = 0; str[k]; k++) {
|
||||
if (str[k] >= 32 && str[k] < 128)
|
||||
drawCharacter(str[k], x + dx, y + dy);
|
||||
|
||||
dx += CHAR_SIZE_X * CHAR_MULT;
|
||||
|
||||
if (str[k] == '\n') {
|
||||
dx = 0;
|
||||
dy -= CHAR_SIZE_Y * CHAR_MULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _printf(int x, int y, const char *format, ...) {
|
||||
void (*kernel_vsnprintf)(char *s, size_t n, const char *format, va_list arg) = (void *) 0x0813293C;
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
static char buffer[0x100];
|
||||
|
||||
kernel_vsnprintf(buffer, 0xFF, format, args);
|
||||
drawString(buffer, x, y);
|
||||
|
||||
va_end(args);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
#ifndef TEXT_H
|
||||
#define TEXT_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
void drawSplashScreen(void);
|
||||
|
||||
void clearScreen(u32 color);
|
||||
|
||||
void drawString(char *str, int x, int y);
|
||||
|
||||
void _printf(int x, int y, const char *format, ...);
|
||||
|
||||
#endif
|
@ -6,8 +6,6 @@ ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),)
|
||||
export PATH:=$(DEVKITARM)/bin:$(PATH)
|
||||
endif
|
||||
|
||||
LOG_IP = 0xc0a800CC
|
||||
|
||||
ifneq ($(LOG_IP),)
|
||||
CFLAGS += -DLOG_IP=$(LOG_IP)
|
||||
endif
|
||||
@ -17,7 +15,7 @@ LINK = arm-none-eabi-gcc
|
||||
AS = arm-none-eabi-as
|
||||
OBJCOPY = arm-none-eabi-objcopy
|
||||
OBJDUMP = arm-none-eabi-objdump
|
||||
CFLAGS += -Wall -mbig-endian -std=gnu11 -mcpu=arm926ej-s -msoft-float -mfloat-abi=soft -Os
|
||||
CFLAGS += -Wall -mbig-endian -std=gnu11 -mcpu=arm926ej-s -msoft-float -mfloat-abi=soft -Os -ffunction-sections
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs -mbig-endian -Wl,-T,link.ld
|
||||
LIBS += -lgcc
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
const unsigned char font_bin[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x18, 0x18, 0x00, 0x0C, 0x00,
|
||||
0x00, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0xFF, 0x66, 0xFF, 0x66, 0x66,
|
||||
0x00, 0x18, 0x7C, 0x06, 0x3C, 0x60, 0x3E, 0x18, 0x10, 0x46, 0x66, 0x30, 0x18, 0x0C, 0x66, 0x62,
|
||||
0x00, 0x3C, 0x66, 0x3C, 0x1C, 0xE6, 0x66, 0xFC, 0x00, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x30, 0x18, 0x0C, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x18, 0x0C, 0x00,
|
||||
0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00,
|
||||
0x00, 0x3C, 0x66, 0x76, 0x6E, 0x66, 0x3C, 0x00, 0x00, 0x18, 0x1C, 0x18, 0x18, 0x18, 0x7E, 0x00,
|
||||
0x00, 0x3C, 0x62, 0x30, 0x0C, 0x06, 0x7E, 0x00, 0x00, 0x3C, 0x62, 0x38, 0x60, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x6C, 0x6C, 0x66, 0xFE, 0x60, 0x60, 0x00, 0x00, 0x7E, 0x06, 0x7E, 0x60, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x3C, 0x06, 0x3E, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x7E, 0x30, 0x30, 0x18, 0x18, 0x18, 0x00,
|
||||
0x00, 0x3C, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x3C, 0x66, 0x7C, 0x60, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x0C, 0x00,
|
||||
0x00, 0x70, 0x1C, 0x06, 0x06, 0x1C, 0x70, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0E, 0x38, 0x60, 0x60, 0x38, 0x0E, 0x00, 0x00, 0x3C, 0x66, 0x30, 0x18, 0x00, 0x18, 0x00,
|
||||
0x00, 0x3C, 0x66, 0x76, 0x76, 0x06, 0x46, 0x3C, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00,
|
||||
0x00, 0x3E, 0x66, 0x3E, 0x66, 0x66, 0x3E, 0x00, 0x00, 0x3C, 0x66, 0x06, 0x06, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x1E, 0x36, 0x66, 0x66, 0x36, 0x1E, 0x00, 0x00, 0x7E, 0x06, 0x1E, 0x06, 0x06, 0x7E, 0x00,
|
||||
0x00, 0x3E, 0x06, 0x1E, 0x06, 0x06, 0x06, 0x00, 0x00, 0x3C, 0x66, 0x06, 0x76, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
|
||||
0x00, 0x78, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x66, 0x36, 0x1E, 0x1E, 0x36, 0x66, 0x00,
|
||||
0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7E, 0x00, 0x00, 0x46, 0x6E, 0x7E, 0x56, 0x46, 0x46, 0x00,
|
||||
0x00, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x66, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x3E, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x70, 0x00,
|
||||
0x00, 0x3E, 0x66, 0x3E, 0x1E, 0x36, 0x66, 0x00, 0x00, 0x3C, 0x66, 0x0C, 0x30, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x46, 0x46, 0x56, 0x7E, 0x6E, 0x46, 0x00,
|
||||
0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00,
|
||||
0x00, 0x7E, 0x30, 0x18, 0x0C, 0x06, 0x7E, 0x00, 0x00, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C,
|
||||
0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C,
|
||||
0x00, 0x18, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E,
|
||||
0x00, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x60, 0x7C, 0x66, 0x7C, 0x00,
|
||||
0x00, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x00, 0x00, 0x00, 0x3C, 0x06, 0x06, 0x06, 0x3C, 0x00,
|
||||
0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00,
|
||||
0x00, 0x38, 0x0C, 0x3E, 0x0C, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x7C, 0x66, 0x7C, 0x40, 0x3C, 0x00,
|
||||
0x00, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x00, 0x00, 0x18, 0x00, 0x1C, 0x18, 0x18, 0x3C, 0x00,
|
||||
0x00, 0x30, 0x00, 0x30, 0x30, 0x30, 0x1E, 0x00, 0x00, 0x06, 0x06, 0x36, 0x1E, 0x36, 0x66, 0x00,
|
||||
0x00, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x66, 0xFE, 0xFE, 0xD6, 0xC6, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x66, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x7C, 0x06, 0x3C, 0x60, 0x3E, 0x00,
|
||||
0x00, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00,
|
||||
0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0xC6, 0xD6, 0xFE, 0x7C, 0x6C, 0x00,
|
||||
0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x7C, 0x60, 0x3C, 0x00,
|
||||
0x00, 0x00, 0x7E, 0x30, 0x18, 0x0C, 0x7E, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x04, 0x08, 0x08,
|
||||
0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x0C, 0x08, 0x08, 0x10, 0x08, 0x08,
|
||||
};
|
@ -1 +0,0 @@
|
||||
extern const u8 font_bin[];
|
@ -27,7 +27,6 @@
|
||||
#include "imports.h"
|
||||
#include "fsa.h"
|
||||
#include "svc.h"
|
||||
#include "text.h"
|
||||
#include "logger.h"
|
||||
#include "fsa.h"
|
||||
#include "wupserver.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <string.h>
|
||||
#include "socket.h"
|
||||
#include "svc.h"
|
||||
#include "text.h"
|
||||
#include "imports.h"
|
||||
|
||||
static int socket_handle = 0;
|
||||
|
@ -1,91 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "imports.h"
|
||||
#include "font_bin.h"
|
||||
|
||||
#define FRAMEBUFFER_ADDRESS (0x14000000+0x38C0000)
|
||||
#define FRAMEBUFFER_STRIDE (0xE00)
|
||||
#define FRAMEBUFFER_STRIDE_WORDS (FRAMEBUFFER_STRIDE >> 2)
|
||||
|
||||
#define CHAR_SIZE_X (8)
|
||||
#define CHAR_SIZE_Y (8)
|
||||
|
||||
static const u8 *launch_image_tga = (const u8 *) 0x27000000;
|
||||
|
||||
u32 *const framebuffer = (u32 *) FRAMEBUFFER_ADDRESS;
|
||||
|
||||
void drawSplashScreen(void) {
|
||||
// check if it is an unmapped RGB tga
|
||||
if (*(u32 *) launch_image_tga != 0x00000200)
|
||||
return;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < (896 * 504); i++) {
|
||||
u32 pixel;
|
||||
u32 pixelOffset = 0x12 + i * 2;
|
||||
// access only 4 byte aligned data as the file is in code section
|
||||
u32 dualPixel = *(u32 *) (launch_image_tga + (pixelOffset & ~3));
|
||||
|
||||
if ((pixelOffset & 3) == 0) {
|
||||
pixel = ((dualPixel >> 24) & 0xFF) | (((dualPixel >> 16) & 0xFF) << 8);
|
||||
} else {
|
||||
pixel = ((dualPixel >> 8) & 0xFF) | ((dualPixel & 0xFF) << 8);
|
||||
}
|
||||
|
||||
framebuffer[i] = (((pixel >> 10) & 0x1F) << (3 + 24)) | (((pixel >> 5) & 0x1F) << (3 + 16)) | ((pixel & 0x1F) << (3 + 8)) | 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void clearScreen(u32 color) {
|
||||
int i;
|
||||
for (i = 0; i < 896 * 504; i++) {
|
||||
framebuffer[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
void drawCharacter(char c, int x, int y) {
|
||||
if (c < 32)return;
|
||||
c -= 32;
|
||||
u8 *charData = (u8 *) &font_bin[(CHAR_SIZE_X * CHAR_SIZE_Y * c) / 8];
|
||||
u32 *fb = &framebuffer[x + y * FRAMEBUFFER_STRIDE_WORDS];
|
||||
int i, j;
|
||||
for (i = 0; i < CHAR_SIZE_Y; i++) {
|
||||
u8 v = *(charData++);
|
||||
for (j = 0; j < CHAR_SIZE_X; j++) {
|
||||
if (v & 1) *fb = 0x00000000;
|
||||
else *fb = 0xFFFFFFFF;
|
||||
v >>= 1;
|
||||
fb++;
|
||||
}
|
||||
fb += FRAMEBUFFER_STRIDE_WORDS - CHAR_SIZE_X;
|
||||
}
|
||||
}
|
||||
|
||||
void drawString(char *str, int x, int y) {
|
||||
if (!str) return;
|
||||
int k;
|
||||
int dx = 0, dy = 0;
|
||||
for (k = 0; str[k]; k++) {
|
||||
if (str[k] >= 32 && str[k] < 128) drawCharacter(str[k], x + dx, y + dy);
|
||||
|
||||
dx += 8;
|
||||
|
||||
if (str[k] == '\n') {
|
||||
dx = 0;
|
||||
dy -= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print(int x, int y, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
static char buffer[0x100];
|
||||
|
||||
vsnprintf(buffer, 0xFF, format, args);
|
||||
drawString(buffer, x, y);
|
||||
|
||||
va_end(args);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
#ifndef TEXT_H
|
||||
#define TEXT_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
void drawSplashScreen(void);
|
||||
|
||||
void clearScreen(u32 color);
|
||||
|
||||
void drawString(char *str, int x, int y);
|
||||
|
||||
void print(int x, int y, const char *format, ...);
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include "utils.h"
|
||||
#include "logger.h"
|
||||
|
||||
// https://gist.github.com/ccbrown/9722406
|
||||
void dumpHex(const void *data, size_t size) {
|
||||
char ascii[17];
|
||||
size_t i, j;
|
||||
ascii[16] = '\0';
|
||||
DEBUG_FUNCTION_LINE("0x%08X (0x0000): ", data);
|
||||
for (i = 0; i < size; ++i) {
|
||||
log_printf("%02X ", ((unsigned char *) data)[i]);
|
||||
if (((unsigned char *) data)[i] >= ' ' && ((unsigned char *) data)[i] <= '~') {
|
||||
ascii[i % 16] = ((unsigned char *) data)[i];
|
||||
} else {
|
||||
ascii[i % 16] = '.';
|
||||
}
|
||||
if ((i + 1) % 8 == 0 || i + 1 == size) {
|
||||
log_printf(" ");
|
||||
if ((i + 1) % 16 == 0) {
|
||||
log_printf("| %s \n", ascii);
|
||||
if (i + 1 < size) {
|
||||
DEBUG_FUNCTION_LINE("0x%08X (0x%04X); ", data + i + 1, i + 1);
|
||||
}
|
||||
} else if (i + 1 == size) {
|
||||
ascii[(i + 1) % 16] = '\0';
|
||||
if ((i + 1) % 16 <= 8) {
|
||||
log_printf(" ");
|
||||
}
|
||||
for (j = (i + 1) % 16; j < 16; ++j) {
|
||||
log_printf(" ");
|
||||
}
|
||||
log_printf("| %s \n", ascii);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#ifndef __UTILS_H_
|
||||
#define __UTILS_H_
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//Need to have log_init() called beforehand.
|
||||
void dumpHex(const void *data, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __UTILS_H_
|
@ -6,7 +6,6 @@
|
||||
#include "socket.h"
|
||||
#include "fsa.h"
|
||||
#include "svc.h"
|
||||
#include "text.h"
|
||||
#include "logger.h"
|
||||
#include "ipc.h"
|
||||
|
||||
@ -194,9 +193,9 @@ static int wupserver_thread(void *arg) {
|
||||
}
|
||||
|
||||
#ifdef LOG_IP
|
||||
log_init(LOG_IP);
|
||||
log_init(0xc0a8b2a1);
|
||||
#else
|
||||
log_init(0xC0A8B203);
|
||||
log_init(0xc0a8b2a1);
|
||||
#endif
|
||||
|
||||
//print(0, 0, "opened /dev/socket !");
|
||||
|
Loading…
Reference in New Issue
Block a user