mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 10:39:16 +01:00
WIP
This commit is contained in:
parent
a8dfb4d5d7
commit
060499bf79
524
src/main.cpp
524
src/main.cpp
@ -3,9 +3,16 @@
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <coreinit/title.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <coreinit/mcp.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <coreinit/memorymap.h>
|
||||
#include <coreinit/dynload.h>
|
||||
#include <sysapp/title.h>
|
||||
#include <nn/acp.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include <vpad/input.h>
|
||||
@ -18,6 +25,8 @@
|
||||
#define TARGET_HEIGHT (480)
|
||||
|
||||
|
||||
WUPS_ALLOW_KERNEL()
|
||||
|
||||
void printVPADButtons(VPADStatus * buffer);
|
||||
|
||||
WUPS_PLUGIN_NAME("Vpad input logger");
|
||||
@ -28,288 +37,11 @@ WUPS_PLUGIN_LICENSE("GPL");
|
||||
IOSHandle handles[100];
|
||||
|
||||
|
||||
struct WUT_PACKED _ACPMetaData{
|
||||
struct WUT_PACKED ACPMetaData {
|
||||
char bootmovie[80696];
|
||||
char bootlogo[28604];
|
||||
void * test;
|
||||
};
|
||||
|
||||
struct WUT_PACKED _ACPMetaXml{
|
||||
uint64_t title_id; // 0x0C
|
||||
uint64_t boss_id; // 0x0E
|
||||
uint64_t os_version; // 0x0F
|
||||
uint64_t app_size; // 0x10
|
||||
uint64_t common_save_size; // 0x11
|
||||
uint64_t account_save_size; // 0x12
|
||||
uint64_t common_boss_size; // 0x13
|
||||
uint64_t account_boss_size; // 0x14
|
||||
uint64_t join_game_mode_mask; // 0x17
|
||||
uint32_t version; // 0x01
|
||||
char product_code[32]; // AAAAA
|
||||
char content_platform[32]; // BBBBB
|
||||
char company_code[8]; // CCCCC
|
||||
char mastering_date[32]; // DDDDD
|
||||
uint32_t logo_type; // 0x02
|
||||
uint32_t app_launch_type; // 0x03
|
||||
uint32_t invisible_flag; // 0x04
|
||||
uint32_t no_managed_flag; // 0x05
|
||||
uint32_t no_event_log; // 0x06
|
||||
uint32_t no_icon_database; // 0x07
|
||||
uint32_t launching_flag; // 0x08
|
||||
uint32_t install_flag; // 0x09
|
||||
uint32_t closing_msg; // 0x0A
|
||||
uint32_t title_version; // 0x0B
|
||||
uint32_t group_id; // 0x0D
|
||||
uint32_t save_no_rollback; // 0x15
|
||||
uint32_t bg_daemon_enable; //0x18
|
||||
uint32_t join_game_id; // 0x16
|
||||
uint32_t olv_accesskey; // 0x19
|
||||
uint32_t wood_tin; // 0x1A
|
||||
uint32_t e_manual; // 0x1B
|
||||
uint32_t e_manual_version; // 0x1C
|
||||
uint32_t region; // 0x1D
|
||||
uint32_t pc_cero; // 0x1E
|
||||
uint32_t pc_esrb; // 0x1F
|
||||
uint32_t pc_bbfc; // 0x20
|
||||
uint32_t pc_usk; // 0x21
|
||||
uint32_t pc_pegi_gen; // 0x22
|
||||
uint32_t pc_pegi_fin; // 0x23
|
||||
uint32_t pc_pegi_prt; // 0x24
|
||||
uint32_t pc_pegi_bbfc; // 0x25
|
||||
uint32_t pc_cob; // 0x26
|
||||
uint32_t pc_grb; // 0x27
|
||||
uint32_t pc_cgsrr; // 0x28
|
||||
uint32_t pc_oflc; // 0x29
|
||||
uint32_t pc_reserved0; // 0x2A
|
||||
uint32_t pc_reserved1; // 0x2B
|
||||
uint32_t pc_reserved2; // 0x2C
|
||||
uint32_t pc_reserved3; // 0x2D
|
||||
uint32_t ext_dev_nunchaku; // 0x2E
|
||||
uint32_t ext_dev_classic; // 0x2F
|
||||
uint32_t ext_dev_urcc; // 0x30
|
||||
uint32_t ext_dev_board; // 0x31
|
||||
uint32_t ext_dev_usb_keyboard; // 0x32
|
||||
uint32_t ext_dev_etc; // 0x33
|
||||
char ext_dev_etc_name[512]; // EEEE
|
||||
uint32_t eula_version; // 0x34
|
||||
uint32_t drc_use; // 0x35
|
||||
uint32_t network_use; // 0x36
|
||||
uint32_t online_account_use; // 0x37
|
||||
uint32_t direct_boot; // 0x38
|
||||
uint32_t reserved_flag0; // 0x39
|
||||
uint32_t reserved_flag1; // 0x3A
|
||||
uint32_t reserved_flag2; // 0x3B
|
||||
uint32_t reserved_flag3; // 0x3C
|
||||
uint32_t reserved_flag4; // 0x3D
|
||||
uint32_t reserved_flag5; // 0x3E
|
||||
uint32_t reserved_flag6; // 0x3F
|
||||
uint32_t reserved_flag7; // 0x40
|
||||
char longname_ja[512]; // FF
|
||||
char longname_en[512]; // HH
|
||||
char longname_fr[512]; // II
|
||||
char longname_de[512]; // JJ
|
||||
char longname_it[512]; // KK
|
||||
char longname_es[512]; // L
|
||||
char longname_zhs[512]; // M
|
||||
char longname_ko[512]; // N
|
||||
char longname_nl[512]; // O
|
||||
char longname_pt[512]; // P
|
||||
char longname_ru[512]; // Q
|
||||
char longname_zht[512]; // R
|
||||
char shortname_ja[256]; // S
|
||||
char shortname_en[256]; // T
|
||||
char shortname_fr[256]; // U
|
||||
char shortname_de[256]; // V
|
||||
char shortname_it[256]; // W
|
||||
char shortname_es[256]; // X
|
||||
char shortname_zhs[256]; // Y
|
||||
char shortname_ko[256]; // Z
|
||||
char shortname_nl[256]; // 11
|
||||
char shortname_pt[256]; // 22
|
||||
char shortname_ru[256]; // 33
|
||||
char shortname_zht[256]; // 44
|
||||
char publisher_ja[256]; // 55
|
||||
char publisher_en[256]; // 66
|
||||
char publisher_fr[256]; // 77
|
||||
char publisher_de[256]; // 88
|
||||
char publisher_it[256]; // 99
|
||||
char publisher_es[256]; // 1010
|
||||
char publisher_zhs[256]; // 1212
|
||||
char publisher_ko[256]; // 1313
|
||||
char publisher_nl[256]; // 1414
|
||||
char publisher_pt[256]; // 1515
|
||||
char publisher_ru[256]; // 1616
|
||||
char publisher_zht[256]; // 1717
|
||||
uint32_t add_on_unique_id0; // 0x41
|
||||
uint32_t add_on_unique_id1; // 0x42
|
||||
uint32_t add_on_unique_id2; // 0x43
|
||||
uint32_t add_on_unique_id3; // 0x44
|
||||
uint32_t add_on_unique_id4; // 0x45
|
||||
uint32_t add_on_unique_id5; // 0x46
|
||||
uint32_t add_on_unique_id6; // 0x47
|
||||
uint32_t add_on_unique_id7; // 0x48
|
||||
uint32_t add_on_unique_id8; // 0x49
|
||||
uint32_t add_on_unique_id9; // 0x4A
|
||||
uint32_t add_on_unique_id10; // 0x4B
|
||||
uint32_t add_on_unique_id11; // 0x4C
|
||||
uint32_t add_on_unique_id12; // 0x4D
|
||||
uint32_t add_on_unique_id13; // 0x4E
|
||||
uint32_t add_on_unique_id14; // 0x4F
|
||||
uint32_t add_on_unique_id15; // 0x50
|
||||
uint32_t add_on_unique_id16; // 0x51
|
||||
uint32_t add_on_unique_id17; // 0x52
|
||||
uint32_t add_on_unique_id18; // 0x53
|
||||
uint32_t add_on_unique_id19; // 0x54
|
||||
uint32_t add_on_unique_id20; // 0x55
|
||||
uint32_t add_on_unique_id21; // 0x56
|
||||
uint32_t add_on_unique_id22; // 0x57
|
||||
uint32_t add_on_unique_id23; // 0x58
|
||||
uint32_t add_on_unique_id24; // 0x59
|
||||
uint32_t add_on_unique_id25; // 0x5A
|
||||
uint32_t add_on_unique_id26; // 0x5B
|
||||
uint32_t add_on_unique_id27; // 0x5C
|
||||
uint32_t add_on_unique_id28; // 0x5D
|
||||
uint32_t add_on_unique_id29; // 0x5E
|
||||
uint32_t add_on_unique_id30; // 0x5F
|
||||
uint32_t add_on_unique_id31; // 0x60
|
||||
};
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x00, title_id);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x08, boss_id);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x10, os_version);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x18, app_size);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x20, common_save_size);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x28, account_save_size);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x30, common_boss_size);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x38, account_boss_size);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x40, join_game_mode_mask);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x48, version);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x4C, product_code);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x6C, content_platform);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x8C, company_code);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x94, mastering_date);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xB4, logo_type);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xB8, app_launch_type);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xBC, invisible_flag);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xC0, no_managed_flag);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xC4, no_event_log);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xC8, no_icon_database);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xCC, launching_flag);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xD0, install_flag);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xD4, closing_msg);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xD8, title_version);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xDC, group_id);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xE0, save_no_rollback);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xE4, bg_daemon_enable);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xE8, join_game_id);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xEC, olv_accesskey);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xF0, wood_tin);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xF4, e_manual);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xF8, e_manual_version);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xFC, region);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x100, pc_cero);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x104, pc_esrb);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x108, pc_bbfc);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x10C, pc_usk);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x110, pc_pegi_gen);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x114, pc_pegi_fin);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x118, pc_pegi_prt);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x11C, pc_pegi_bbfc);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x120, pc_cob);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x124, pc_grb);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x128, pc_cgsrr);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x12C, pc_oflc);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x130, pc_reserved0);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x134, pc_reserved1);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x138, pc_reserved2);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x13C, pc_reserved3);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x140, ext_dev_nunchaku);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x144, ext_dev_classic);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x148, ext_dev_urcc);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x14C, ext_dev_board);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x150, ext_dev_usb_keyboard);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x154, ext_dev_etc);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x158, ext_dev_etc_name);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x358, eula_version);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x35C, drc_use);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x360, network_use);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x364, online_account_use);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x368, direct_boot);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x36C, reserved_flag0);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x370, reserved_flag1);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x374, reserved_flag2);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x378, reserved_flag3);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x37C, reserved_flag4);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x380, reserved_flag5);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x384, reserved_flag6);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x388, reserved_flag7);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x38C, longname_ja);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x58C, longname_en);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x78C, longname_fr);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x98C, longname_de);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xB8C, longname_it);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xD8C, longname_es);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0xF8C, longname_zhs);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x118C, longname_ko);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x138C, longname_nl);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x158C, longname_pt);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x178C, longname_ru);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x198C, longname_zht);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x1B8C, shortname_ja);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x1C8C, shortname_en);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x1D8C, shortname_fr);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x1E8C, shortname_de);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x1F8C, shortname_it);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x208C, shortname_es);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x218C, shortname_zhs);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x228C, shortname_ko);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x238C, shortname_nl);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x248C, shortname_pt);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x258C, shortname_ru);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x268C, shortname_zht);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x278C, publisher_ja);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x288C, publisher_en);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x298C, publisher_fr);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x2A8C, publisher_de);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x2B8C, publisher_it);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x2C8C, publisher_es);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x2D8C, publisher_zhs);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x2E8C, publisher_ko);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x2F8C, publisher_nl);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x308C, publisher_pt);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x318C, publisher_ru);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x328C, publisher_zht);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x338C, add_on_unique_id0);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x3394, add_on_unique_id2);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x3398, add_on_unique_id3);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x339C, add_on_unique_id4);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33A0, add_on_unique_id5);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33A4, add_on_unique_id6);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33A8, add_on_unique_id7);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33AC, add_on_unique_id8);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33B0, add_on_unique_id9);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33B4, add_on_unique_id10);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33B8, add_on_unique_id11);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33BC, add_on_unique_id12);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33C0, add_on_unique_id13);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33C4, add_on_unique_id14);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33C8, add_on_unique_id15);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33CC, add_on_unique_id16);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33D0, add_on_unique_id17);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33D4, add_on_unique_id18);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33D8, add_on_unique_id19);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33DC, add_on_unique_id20);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33E0, add_on_unique_id21);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33E4, add_on_unique_id22);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33E8, add_on_unique_id23);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33EC, add_on_unique_id24);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33F0, add_on_unique_id25);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33F4, add_on_unique_id26);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33F8, add_on_unique_id27);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x33FC, add_on_unique_id28);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x3400, add_on_unique_id29);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x3404, add_on_unique_id30);
|
||||
WUT_CHECK_OFFSET(_ACPMetaXml, 0x3408, add_on_unique_id31);
|
||||
WUT_CHECK_SIZE(_ACPMetaXml,0x340C);
|
||||
|
||||
extern "C" {
|
||||
extern void __init_wut_malloc();
|
||||
@ -318,40 +50,47 @@ extern "C" {
|
||||
|
||||
WUPS_FS_ACCESS()
|
||||
|
||||
MCPTitleListType my[25] __attribute__((section(".data")));
|
||||
MCPTitleListType template_title;
|
||||
ACPMetaXml gLaunchXML __attribute__((section(".data")));
|
||||
MCPTitleListType template_title __attribute__((section(".data")));
|
||||
BOOL gHomebrewLaunched __attribute__((section(".data")));
|
||||
|
||||
INITIALIZE_PLUGIN() {
|
||||
memset((void*) &template_title,0,sizeof(template_title));
|
||||
memset((void*) &gLaunchXML,0,sizeof(gLaunchXML));
|
||||
gHomebrewLaunched = FALSE;
|
||||
}
|
||||
|
||||
ON_APPLICATION_START(args) {
|
||||
__init_wut_malloc();
|
||||
socket_lib_init();
|
||||
log_init();
|
||||
DEBUG_FUNCTION_LINE("###############\n");
|
||||
|
||||
if(_SYSGetSystemApplicationTitleId(APP_ID_Updater) == OSGetTitleID()) {
|
||||
gHomebrewLaunched = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
ON_APPLICATION_ENDING() {
|
||||
__fini_wut_malloc();
|
||||
DEBUG_FUNCTION_LINE("###############\n");
|
||||
}
|
||||
|
||||
void fillXmlForTitleID(uint32_t titleid_upper, uint32_t titleid_lower, ACPMetaXml* out_buf) {
|
||||
out_buf->title_id = ((uint64_t)titleid_upper * 0x100000000) + titleid_lower;
|
||||
// TODO
|
||||
char buffer [25];
|
||||
snprintf(buffer,25,"/custom/%08X%08X", titleid_upper,titleid_lower);
|
||||
DEBUG_FUNCTION_LINE("%s\n",buffer);
|
||||
strncpy(out_buf->longname_en,buffer,strlen(buffer));
|
||||
strncpy(out_buf->shortname_en,buffer,strlen(buffer));
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t* outTitleCount, MCPTitleListType* titleList, uint32_t size) {
|
||||
int32_t result = real_MCP_TitleList(handle, outTitleCount, titleList, size);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X = %08X\n",handle,*outTitleCount,titleList,size,result);
|
||||
|
||||
uint32_t titlecount = *outTitleCount;
|
||||
|
||||
for(uint32_t i = 0;i<titlecount;i++){
|
||||
if(titleList[i].titleId == 0x000500101004e200){
|
||||
memcpy(&template_title, &(titleList[i]),sizeof(MCPTitleListType));
|
||||
}
|
||||
}
|
||||
|
||||
DirList dirList("sd:/wiiu/apps", ".rpx", DirList::Files | DirList::CheckSubfolders, 1);
|
||||
|
||||
dirList.SortList();
|
||||
|
||||
int j = 0;
|
||||
|
||||
for(int i = 0; i < dirList.GetFilecount(); i++) {
|
||||
//! skip our own application in the listing
|
||||
if(strcasecmp(dirList.GetFilename(i), "homebrew_launcher.elf") == 0)
|
||||
@ -364,56 +103,49 @@ DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t* outTitleCount,
|
||||
if(dirList.GetFilename(i)[0] == '.' || dirList.GetFilename(i)[0] == '_')
|
||||
continue;
|
||||
|
||||
DEBUG_FUNCTION_LINE("%s\n",dirList.GetFilename(i));
|
||||
|
||||
char buffer [100];
|
||||
|
||||
snprintf(buffer,100,"/custom/%08X%08X", 0x0005000F, j);
|
||||
|
||||
char buffer [25];
|
||||
snprintf(buffer,25,"/custom/%08X%08X", 0x0005000F, j);
|
||||
strcpy(template_title.path,buffer);
|
||||
template_title.titleId = 0x0005000F00000000 + j;
|
||||
|
||||
memcpy(&(titleList[titlecount]), &template_title ,sizeof(MCPTitleListType));
|
||||
memcpy(&(my[j]), &template_title ,sizeof(MCPTitleListType));
|
||||
const char * indexedDevice = "mlc";
|
||||
strcpy(template_title.indexedDevice,indexedDevice);
|
||||
template_title.appType = MCP_APP_TYPE_SystemApps;
|
||||
template_title.titleId = 0x0005000F00000000 + j;
|
||||
template_title.titleVersion = 1;
|
||||
template_title.groupId = 0x400;
|
||||
template_title.osVersion = OSGetOSID();
|
||||
template_title.sdkVersion = __OSGetProcessSDKVersion();
|
||||
template_title.unk0x60 = 1;
|
||||
|
||||
memcpy(&(titleList[titlecount]), &template_title,sizeof(template_title));
|
||||
titlecount++;
|
||||
j++;
|
||||
}
|
||||
|
||||
for(uint32_t i = 0;i<titlecount;i++){
|
||||
DEBUG_FUNCTION_LINE("%d %016llX %s \n",i, titleList[i].titleId, titleList[i].path);
|
||||
}
|
||||
|
||||
*outTitleCount = titlecount;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_TitleListByAppType,int32_t handle,
|
||||
MCPAppType appType,
|
||||
uint32_t *outTitleCount,
|
||||
MCPTitleListType *titleList,
|
||||
uint32_t titleListSizeBytes) {
|
||||
|
||||
int32_t result = real_MCP_TitleListByAppType(handle, appType, outTitleCount, titleList,titleListSizeBytes);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X = %08X\n",handle,appType,*outTitleCount,titleList,titleListSizeBytes,result);
|
||||
|
||||
for(uint32_t i = 0;i<*outTitleCount;i++){
|
||||
//DEBUG_FUNCTION_LINE("%016llX %s \n",titleList[i].titleId, titleList[i].path);
|
||||
for(int i = 0; i< *outTitleCount; i++) {
|
||||
DEBUG_FUNCTION_LINE("%s %08X %016llX %08X %08X %s \n",titleList[i].path, titleList[i].appType, titleList[i].osVersion, titleList[i].sdkVersion,titleList[i].groupId,titleList[i].indexedDevice);
|
||||
//dumpHex(&titleList[i],sizeof(MCPTitleListType));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleInfoByTitleAndDevice, uint32_t mcp_handle, uint32_t titleid_lower_1, uint32_t titleid_upper, uint32_t titleid_lower_2, uint32_t u5, MCPTitleListType* u6) {
|
||||
DEBUG_FUNCTION_LINE("lower1: %08X ID: %08X%08X %08X %08X \n",titleid_lower_1 ,titleid_upper ,titleid_lower_2 ,u5 ,u6);
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleInfoByTitleAndDevice, uint32_t mcp_handle, uint32_t titleid_lower_1, uint32_t titleid_upper, uint32_t titleid_lower_2, uint32_t unknown, MCPTitleListType* title) {
|
||||
|
||||
if(titleid_upper == 0x0005000F){
|
||||
memcpy(u6, &(my[titleid_lower_2]), sizeof(MCPTitleListType));
|
||||
if(gHomebrewLaunched) {
|
||||
memcpy(title, &(template_title), sizeof(MCPTitleListType));
|
||||
} else if(titleid_upper == 0x0005000F) {
|
||||
char buffer [25];
|
||||
snprintf(buffer,25,"/custom/%08X%08X", titleid_lower_2, titleid_upper);
|
||||
strcpy(template_title.path,buffer);
|
||||
template_title.titleId = 0x0005000F00000000 + titleid_lower_1;
|
||||
memcpy(title, &(template_title), sizeof(MCPTitleListType));
|
||||
DEBUG_FUNCTION_LINE("%s %08X %016llX %08X \n",title->path, title->appType, title->osVersion, title->sdkVersion);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int result = real_MCP_GetTitleInfoByTitleAndDevice(mcp_handle, titleid_lower_1, titleid_upper, titleid_lower_2, u5, u6);
|
||||
DEBUG_FUNCTION_LINE("lower1: %08X ID: %08X%08X %08X %s = %08X \n",titleid_lower_1 ,titleid_upper ,titleid_lower_2 ,u5 ,u6->path ,result);
|
||||
int result = real_MCP_GetTitleInfoByTitleAndDevice(mcp_handle, titleid_lower_1, titleid_upper, titleid_lower_2, unknown, title);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -422,45 +154,61 @@ DECL_FUNCTION(int32_t, MCP_GetTitleInfoByTitleAndDevice, uint32_t mcp_handle, ui
|
||||
DECL_FUNCTION(int32_t, ACPCheckTitleLaunchByTitleListType, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
int result = real_ACPCheckTitleLaunchByTitleListType(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X will force it to 0 \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
|
||||
gHomebrewLaunched = TRUE;
|
||||
fillXmlForTitleID(0x0005000F,0x00000000, &gLaunchXML);
|
||||
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int, FSOpenFile, FSClient *pClient, FSCmdBlock *pCmd, char *path, const char *mode, int *handle, int error) {
|
||||
socket_lib_init();
|
||||
log_init();
|
||||
int EndsWith(const char *str, const char *suffix) {
|
||||
if (!str || !suffix)
|
||||
return 0;
|
||||
size_t lenstr = strlen(str);
|
||||
size_t lensuffix = strlen(suffix);
|
||||
if (lensuffix > lenstr)
|
||||
return 0;
|
||||
return strncmp(str + lenstr - lensuffix, suffix, lensuffix) == 0;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int, FSOpenFile, FSClient *pClient, FSCmdBlock *pCmd, char *path, const char *mode, int *handle, int error) {
|
||||
char * start = "/vol/storage_mlc01/sys/title/0005000F";
|
||||
if(strncmp(path,start,strlen(start)) == 0){
|
||||
char * icon = "iconTex.tga";
|
||||
|
||||
if(EndsWith(path,icon)) {
|
||||
if(gHomebrewLaunched || strncmp(path,start,strlen(start)) == 0) {
|
||||
strcpy(path,"/vol/storage_mlc01/usr/title/00050000/10172000/meta/iconTex.tga");
|
||||
}
|
||||
}
|
||||
|
||||
int result = real_FSOpenFile(pClient, pCmd, path, mode, handle, error);
|
||||
|
||||
DEBUG_FUNCTION_LINE("%s! Result %d\n",path,result);
|
||||
DEBUG_FUNCTION_LINE("%s! Result %08X %d\n",path,*handle, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint32_t titleid_lower, _ACPMetaXml* out_buf, uint32_t device, uint32_t u1) {
|
||||
DECL_FUNCTION(FSStatus, FSReadFile, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle,uint32_t unk1, uint32_t flags) {
|
||||
FSStatus result = real_FSReadFile(client, block, buffer, size, count, handle, unk1, flags);
|
||||
DEBUG_FUNCTION_LINE("%08X %d\n", handle, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(FSStatus, FSReadDir, FSClient *client, FSCmdBlock *block, FSDirectoryHandle handle, FSDirectoryEntry *entry, uint32_t flags) {
|
||||
FSStatus result = real_FSReadDir(client, block, handle, entry, flags);
|
||||
DEBUG_FUNCTION_LINE("%s %d\n", entry->name, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint32_t titleid_lower, ACPMetaXml* out_buf, uint32_t device, uint32_t u1) {
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
int result = real_ACPGetTitleMetaXmlByDevice(titleid_upper, titleid_lower, out_buf, device,u1);
|
||||
|
||||
if(titleid_upper == 0x00050000 && titleid_lower == 0x13374842) {
|
||||
//dumpHex((void*)out_buf,0x3500);
|
||||
}
|
||||
|
||||
|
||||
if(titleid_upper == 0x0005000F) {
|
||||
out_buf->title_id = 0x000500101004e200;
|
||||
|
||||
char buffer [100];
|
||||
|
||||
snprintf (buffer,100,"/custom/%08X%08X", titleid_upper,titleid_lower) ;
|
||||
|
||||
|
||||
strncpy(out_buf->longname_en,buffer,strlen(buffer));
|
||||
strncpy(out_buf->shortname_en,buffer,strlen(buffer));
|
||||
|
||||
fillXmlForTitleID(titleid_upper,titleid_lower, out_buf);
|
||||
result = 0;
|
||||
}
|
||||
|
||||
@ -469,17 +217,12 @@ DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint3
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaDirByDevice, uint32_t titleid_upper, uint32_t titleid_lower, char* out_buf, uint32_t size, int device) {
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
int result = real_ACPGetTitleMetaDirByDevice(titleid_upper, titleid_lower, out_buf, size, device);
|
||||
|
||||
|
||||
if(titleid_upper == 0x0005000F) {
|
||||
strcpy(out_buf,"/vol/storage_mlc01/usr/title/00050000/10119b00");
|
||||
return -1;
|
||||
/*DEBUG_FUNCTION_LINE("Replace\n");
|
||||
char * newPath = "/vol/storage_mlc01/usr/title/0005000F/13374842/meta";
|
||||
|
||||
strcpy(out_buf,newPath);
|
||||
|
||||
result = 0;*/
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("TitleID: %08X%08X path:%s (%d)device: %d = %08X \n",titleid_upper,titleid_lower,out_buf,size, device,result);
|
||||
@ -537,51 +280,9 @@ char *str_replace(char *orig, char *rep, char *with) {
|
||||
|
||||
DECL_FUNCTION(int32_t, _SYSLaunchTitleByPathFromLauncher, char* pathToLoad, uint32_t u2) {
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
|
||||
const char * start = "/custom/";
|
||||
if(strncmp(pathToLoad,start,strlen(start)) == 0) {
|
||||
/*
|
||||
std::map<std::string,std::string>::iterator it;
|
||||
it = rpxList.find(pathToLoad);
|
||||
if (it != rpxList.end()){
|
||||
std::string copy = it->second;
|
||||
|
||||
char * repl = (char*)"fs:/vol/external01/";
|
||||
char * with = (char*)"/vol/storage_iosu_homebrew/";
|
||||
char * input = (char*) copy.c_str();
|
||||
|
||||
char* extension = input + strlen(input) - 4;
|
||||
if (extension[0] == '.' &&
|
||||
extension[1] == 'r' &&
|
||||
extension[2] == 'p' &&
|
||||
extension[3] == 'x') {
|
||||
|
||||
char rpxpath[280];
|
||||
char * path = str_replace(input,repl, with);
|
||||
if(path != NULL) {
|
||||
log_printf("Loading file %s\n", path);
|
||||
|
||||
strncpy(rpxpath, path, sizeof(rpxpath) - 1);
|
||||
rpxpath[sizeof(rpxpath) - 1] = '\0';
|
||||
|
||||
free(path);
|
||||
|
||||
int mcpFd = IOS_Open("/dev/mcp", (IOSOpenMode)0);
|
||||
if(mcpFd >= 0) {
|
||||
int out = 0;
|
||||
IOS_Ioctl(mcpFd, 100, (void*)rpxpath, strlen(rpxpath), &out, sizeof(out));
|
||||
IOS_Close(mcpFd);
|
||||
if(out == 2) {
|
||||
DEBUG_FUNCTION_LINE("sucess\n");
|
||||
}else{
|
||||
DEBUG_FUNCTION_LINE("failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
DEBUG_FUNCTION_LINE("Mapping failed\n");
|
||||
}*/
|
||||
strcpy(template_title.path,pathToLoad);
|
||||
|
||||
// always load H&S app
|
||||
strcpy(pathToLoad,"/vol/storage_mlc01/usr/title/00050000/10119b00");
|
||||
@ -589,33 +290,38 @@ DECL_FUNCTION(int32_t, _SYSLaunchTitleByPathFromLauncher, char* pathToLoad, uint
|
||||
|
||||
int32_t result = real__SYSLaunchTitleByPathFromLauncher(pathToLoad, strlen(pathToLoad));
|
||||
|
||||
|
||||
DEBUG_FUNCTION_LINE("%s %08X result %08X \n",pathToLoad,u2,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetLaunchMetaData, _ACPMetaData* metadata) {
|
||||
int result = real_ACPGetLaunchMetaData(metadata);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, ACPMetaXml * metaxml) {
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, _ACPMetaXml * metaxml) {
|
||||
int result = real_ACPGetLaunchMetaXml(metaxml);
|
||||
|
||||
char buffer [100];
|
||||
|
||||
snprintf (buffer,100,"Hello World!");
|
||||
strncpy(metaxml->longname_en,buffer,strlen(buffer));
|
||||
strncpy(metaxml->shortname_en,buffer,strlen(buffer));
|
||||
if(gHomebrewLaunched) {
|
||||
memcpy(metaxml, &gLaunchXML, sizeof(gLaunchXML));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, PHYS_ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint32_t titleid_lower, ACPMetaXml* metaxml, uint32_t device) {
|
||||
if(gHomebrewLaunched) {
|
||||
memcpy(metaxml, &gLaunchXML, sizeof(gLaunchXML));
|
||||
return 0;
|
||||
}
|
||||
int result = real_PHYS_ACPGetTitleMetaXmlByDevice(titleid_upper, titleid_lower, metaxml, device);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
WUPS_MUST_REPLACE_PHYSICAL(PHYS_ACPGetTitleMetaXmlByDevice, 0x2E36CE44, 0x0E36CE44);
|
||||
WUPS_MUST_REPLACE(FSReadDir, WUPS_LOADER_LIBRARY_COREINIT, FSReadDir);
|
||||
WUPS_MUST_REPLACE(FSReadFile, WUPS_LOADER_LIBRARY_COREINIT, FSReadFile);
|
||||
WUPS_MUST_REPLACE(FSOpenFile, WUPS_LOADER_LIBRARY_COREINIT, FSOpenFile);
|
||||
WUPS_MUST_REPLACE(MCP_TitleList, WUPS_LOADER_LIBRARY_COREINIT, MCP_TitleList);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleInfoByTitleAndDevice, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleInfoByTitleAndDevice );
|
||||
WUPS_MUST_REPLACE(ACPCheckTitleLaunchByTitleListType, WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckTitleLaunchByTitleListType );
|
||||
WUPS_MUST_REPLACE(ACPGetTitleMetaXmlByDevice, WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaXmlByDevice );
|
||||
WUPS_MUST_REPLACE(ACPGetLaunchMetaData , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetLaunchMetaData );
|
||||
WUPS_MUST_REPLACE(ACPGetLaunchMetaXml, WUPS_LOADER_LIBRARY_NN_ACP, ACPGetLaunchMetaXml );
|
||||
WUPS_MUST_REPLACE(ACPGetTitleMetaDirByDevice, WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaDirByDevice );
|
||||
WUPS_MUST_REPLACE(_SYSLaunchTitleByPathFromLauncher, WUPS_LOADER_LIBRARY_SYSAPP, _SYSLaunchTitleByPathFromLauncher);
|
||||
|
Loading…
Reference in New Issue
Block a user