mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 10:39:16 +01:00
first
This commit is contained in:
commit
a8dfb4d5d7
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
build/*
|
||||
*.mod
|
272
Makefile
Normal file
272
Makefile
Normal file
@ -0,0 +1,272 @@
|
||||
# You probably never need to adjust this Makefile.
|
||||
# All changes can be done in the makefile.mk
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
|
||||
endif
|
||||
|
||||
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
||||
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
||||
export WUPSDIR := $(DEVKITPRO)/wups
|
||||
export GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion)
|
||||
|
||||
PREFIX := powerpc-eabi-
|
||||
|
||||
export AS := $(PREFIX)as
|
||||
export CC := $(PREFIX)gcc
|
||||
export CXX := $(PREFIX)g++
|
||||
export LD := $(PREFIX)ld
|
||||
export AR := $(PREFIX)ar
|
||||
export OBJCOPY := $(PREFIX)objcopy
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
|
||||
ifeq ($(notdir $(CURDIR)),$(BUILD))
|
||||
include ../makefile.mk
|
||||
else
|
||||
include makefile.mk
|
||||
endif
|
||||
|
||||
include $(WUPSDIR)/plugin_makefile.mk
|
||||
|
||||
|
||||
#MAP ?= $(TARGET:.mod=.map)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
MACHDEP = -DESPRESSO -mcpu=750 -meabi -mhard-float
|
||||
|
||||
# -Os: optimise size
|
||||
# -Wall: generate lots of warnings
|
||||
# -D__wiiu__: define the symbol __wiiu__ (used in some headers)
|
||||
# -mcpu=750: enable processor specific compilation
|
||||
# -meabi: enable eabi specific compilation
|
||||
# -mhard-float: enable hardware floating point instructions
|
||||
# -nostartfiles: Do not use the standard system startup files when linking
|
||||
# -ffunction-sections: split up functions so linker can garbage collect
|
||||
# -fdata-sections: split up data so linker can garbage collect
|
||||
COMMON_CFLAGS := -O2 -Wall $(MACHDEP) -ffunction-sections -fdata-sections -Wl,-q $(COMMON_CFLAGS)
|
||||
|
||||
CFLAGS += -D__WIIU__ -D__WUT__
|
||||
|
||||
# -x c: compile as c code
|
||||
# -std=c11: use the c11 standard
|
||||
CFLAGS := $(COMMON_CFLAGS) -x c -std=gnu11 $(CFLAGS)
|
||||
|
||||
# -x c++: compile as c++ code
|
||||
# -std=gnu++11: use the c++11 standard
|
||||
CXXFLAGS := $(COMMON_CFLAGS) -x c++ -std=gnu++11 $(CXXFLAGS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra ld flags
|
||||
#--------------------------------------------------------------------------------
|
||||
# --gc-sections: remove unneeded symbols
|
||||
# -Map: generate a map file
|
||||
LDFLAGS += $(ARCH) -Wl,-Map,$(notdir $@).map,--gc-sections,-wrap,__gxx_personality_v0
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
Q := @
|
||||
MAKEFLAGS += --no-print-directory
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS +=
|
||||
#
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS +=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
export PROJECTDIR := $(CURDIR)
|
||||
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
|
||||
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export REAL_LD := $(CC)
|
||||
else
|
||||
export REAL_LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o) \
|
||||
$(PNGFILES:.png=.png.o) $(addsuffix .o,$(BINFILES))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE_FULL += $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
$(EXTERNAL_INCLUDE)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS_FULL += $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
$(EXTERNAL_LIBPATHS)
|
||||
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean install
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).mod $(OUTPUT)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
THIS_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
###############################################################################
|
||||
# Rule to make everything.
|
||||
PHONY += all
|
||||
|
||||
all : $(OUTPUT)
|
||||
###############################################################################
|
||||
# Special build rules
|
||||
|
||||
|
||||
# Rule to make the module file.
|
||||
$(OUTPUT) : $(OFILES)
|
||||
@echo "linking ... " $@
|
||||
@$(REAL_LD) $(OFILES) $(LDFLAGS) $(LIBS) $(LIBPATHS_FULL) -o $@
|
||||
|
||||
###############################################################################
|
||||
# Standard build rules
|
||||
#---------------------------------------------------------------------------------
|
||||
%.a:
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $@)
|
||||
@rm -f $@
|
||||
@$(AR) -rc $@ $^
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.cpp
|
||||
@echo $(notdir $<)
|
||||
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.c
|
||||
@echo $(notdir $<)
|
||||
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o: %.S
|
||||
@echo $(notdir $<)
|
||||
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(INCLUDE_FULL) -c $< -o $@ $(ERROR_FILTER)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.png.o : %.png
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.ttf.o : %.ttf
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.bin.o : %.bin
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.wav.o : %.wav
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.mp3.o : %.mp3
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.ogg.o : %.ogg
|
||||
@echo $(notdir $<)
|
||||
@bin2s -a 32 $< | $(AS) -o $(@)
|
||||
|
||||
###############################################################################
|
||||
# Assembly listing rules
|
||||
|
||||
# Rule to make assembly listing.
|
||||
PHONY += list
|
||||
list : $(LIST)
|
||||
|
||||
# Rule to make the listing file.
|
||||
%.list : $(TARGET)
|
||||
$(LOG)
|
||||
-$Qmkdir -p $(dir $@)
|
||||
$Q$(OBJDUMP) -d $< > $@
|
||||
|
||||
###############################################################################
|
||||
# Clean rule
|
||||
|
||||
# Rule to clean files.
|
||||
PHONY += clean
|
||||
clean :
|
||||
$Qrm -rf $(wildcard $(BUILD) $(BIN))
|
||||
|
||||
###############################################################################
|
||||
# Phony targets
|
||||
|
||||
.PHONY : $(PHONY)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
||||
# VPAD Input viewer
|
||||
|
||||
# Wii U Plugin System
|
||||
This is a plugin for the [Wii U Plugin System (WUPS)](https://github.com/Maschell/WiiUPluginSystem/). To be able to use this plugin you have to place the resulting `.mod` file into the following folder:
|
||||
|
||||
```
|
||||
sd:/wiiu/plugins
|
||||
```
|
||||
When the file is placed on the SDCard you can load it with [plugin loader](https://github.com/Maschell/WiiUPluginSystem/).
|
||||
|
||||
## Building
|
||||
|
||||
For building you need:
|
||||
- [wups](https://github.com/Maschell/WiiUPluginSystem)
|
||||
- [wut](https://github.com/decaf-emu/wut)
|
||||
- [libutilswut](https://github.com/Maschell/libutils/tree/wut) (WUT version) for common functions.
|
||||
|
||||
Install them (in this order) according to their README's. Don't forget the dependencies of the libs itself.
|
50
makefile.mk
Normal file
50
makefile.mk
Normal file
@ -0,0 +1,50 @@
|
||||
# Compiling the projects with libutils logging code?
|
||||
DO_LOGGING := 1
|
||||
|
||||
# Target filename
|
||||
TARGET := $(notdir $(CURDIR)).mod
|
||||
|
||||
# Source directories
|
||||
SOURCES := src src/utils src/fs
|
||||
|
||||
# Data directories
|
||||
DATA :=
|
||||
|
||||
# Include directories
|
||||
INCLUDES := src
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation and linking
|
||||
#---------------------------------------------------------------------------------
|
||||
# Extra C AND C++ compiler flags
|
||||
COMMON_CFLAGS :=
|
||||
# Extra C compiler flags
|
||||
CFLAGS :=
|
||||
# Extra C++ compiler flags
|
||||
CXXFLAGS :=
|
||||
# Extra linking flags for all linking steps
|
||||
LDFLAGS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(WUPSDIR) $(WUT_ROOT)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lwups -lwut
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Will be added to the final lib paths
|
||||
# example:
|
||||
# -L$C:/library1/lib
|
||||
#---------------------------------------------------------------------------------
|
||||
EXTERNAL_LIBPATHS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# Will be added to the final include paths
|
||||
# -IC:/library1/include
|
||||
#---------------------------------------------------------------------------------
|
||||
EXTERNAL_INCLUDE := -I$(WUT_ROOT)/include/libutilswut
|
140
meta - Kopie.xml
Normal file
140
meta - Kopie.xml
Normal file
@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu type="complex" access="777">
|
||||
<version type="unsignedInt" length="4">1</version>
|
||||
<product_code type="string" length="32">AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</product_code>
|
||||
<content_platform type="string" length="32">BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</content_platform>
|
||||
<company_code type="string" length="8">CCCCCCCC</company_code>
|
||||
<mastering_date type="string" length="32">DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD</mastering_date>
|
||||
<logo_type type="unsignedInt" length="4">2</logo_type>
|
||||
<app_launch_type type="hexBinary" length="4">00000003</app_launch_type>
|
||||
<invisible_flag type="hexBinary" length="4">00000004</invisible_flag>
|
||||
<no_managed_flag type="hexBinary" length="4">00000005</no_managed_flag>
|
||||
<no_event_log type="hexBinary" length="4">00000006</no_event_log>
|
||||
<no_icon_database type="hexBinary" length="4">00000007</no_icon_database>
|
||||
<launching_flag type="hexBinary" length="4">00000008</launching_flag>
|
||||
<install_flag type="hexBinary" length="4">00000009</install_flag>
|
||||
<closing_msg type="unsignedInt" length="4">10</closing_msg>
|
||||
<title_version type="unsignedInt" length="4">11</title_version>
|
||||
<title_id type="hexBinary" length="8">00000000000000000C</title_id>
|
||||
<group_id type="hexBinary" length="4">0000000D</group_id>
|
||||
<boss_id type="hexBinary" length="8">000000000000000E</boss_id>
|
||||
<os_version type="hexBinary" length="8">000000000000000F</os_version>
|
||||
<app_size type="hexBinary" length="8">0000000000000010</app_size>
|
||||
<common_save_size type="hexBinary" length="8">0000000000000011</common_save_size>
|
||||
<account_save_size type="hexBinary" length="8">0000000000000012</account_save_size>
|
||||
<common_boss_size type="hexBinary" length="8">0000000000000013</common_boss_size>
|
||||
<account_boss_size type="hexBinary" length="8">0000000000000014</account_boss_size>
|
||||
<save_no_rollback type="unsignedInt" length="4">21</save_no_rollback>
|
||||
<join_game_id type="hexBinary" length="4">00000016</join_game_id>
|
||||
<join_game_mode_mask type="hexBinary" length="8">0000000000000017</join_game_mode_mask>
|
||||
<bg_daemon_enable type="unsignedInt" length="4">24</bg_daemon_enable>
|
||||
<olv_accesskey type="unsignedInt" length="4">25</olv_accesskey>
|
||||
<wood_tin type="unsignedInt" length="4">26</wood_tin>
|
||||
<e_manual type="unsignedInt" length="4">27</e_manual>
|
||||
<e_manual_version type="unsignedInt" length="4">28</e_manual_version>
|
||||
<region type="hexBinary" length="4">0000001D</region>
|
||||
<pc_cero type="unsignedInt" length="4">30</pc_cero>
|
||||
<pc_esrb type="unsignedInt" length="4">31</pc_esrb>
|
||||
<pc_bbfc type="unsignedInt" length="4">32</pc_bbfc>
|
||||
<pc_usk type="unsignedInt" length="4">33</pc_usk>
|
||||
<pc_pegi_gen type="unsignedInt" length="4">34</pc_pegi_gen>
|
||||
<pc_pegi_fin type="unsignedInt" length="4">35</pc_pegi_fin>
|
||||
<pc_pegi_prt type="unsignedInt" length="4">36</pc_pegi_prt>
|
||||
<pc_pegi_bbfc type="unsignedInt" length="4">37</pc_pegi_bbfc>
|
||||
<pc_cob type="unsignedInt" length="4">38</pc_cob>
|
||||
<pc_grb type="unsignedInt" length="4">39</pc_grb>
|
||||
<pc_cgsrr type="unsignedInt" length="4">40</pc_cgsrr>
|
||||
<pc_oflc type="unsignedInt" length="4">41</pc_oflc>
|
||||
<pc_reserved0 type="unsignedInt" length="4">42</pc_reserved0>
|
||||
<pc_reserved1 type="unsignedInt" length="4">43</pc_reserved1>
|
||||
<pc_reserved2 type="unsignedInt" length="4">44</pc_reserved2>
|
||||
<pc_reserved3 type="unsignedInt" length="4">45</pc_reserved3>
|
||||
<ext_dev_nunchaku type="unsignedInt" length="4">46</ext_dev_nunchaku>
|
||||
<ext_dev_classic type="unsignedInt" length="4">47</ext_dev_classic>
|
||||
<ext_dev_urcc type="unsignedInt" length="4">48</ext_dev_urcc>
|
||||
<ext_dev_board type="unsignedInt" length="4">49</ext_dev_board>
|
||||
<ext_dev_usb_keyboard type="unsignedInt" length="4">50</ext_dev_usb_keyboard>
|
||||
<ext_dev_etc type="unsignedInt" length="4">51</ext_dev_etc>
|
||||
<ext_dev_etc_name type="string" length="512">EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE</ext_dev_etc_name>
|
||||
<eula_version type="unsignedInt" length="4">52</eula_version>
|
||||
<drc_use type="unsignedInt" length="4">53</drc_use>
|
||||
<network_use type="unsignedInt" length="4">54</network_use>
|
||||
<online_account_use type="unsignedInt" length="4">55</online_account_use>
|
||||
<direct_boot type="unsignedInt" length="4">56</direct_boot>
|
||||
<reserved_flag0 type="hexBinary" length="4">00000039</reserved_flag0>
|
||||
<reserved_flag1 type="hexBinary" length="4">0000003A</reserved_flag1>
|
||||
<reserved_flag2 type="hexBinary" length="4">0000003B</reserved_flag2>
|
||||
<reserved_flag3 type="hexBinary" length="4">0000003C</reserved_flag3>
|
||||
<reserved_flag4 type="hexBinary" length="4">0000003D</reserved_flag4>
|
||||
<reserved_flag5 type="hexBinary" length="4">0000003E</reserved_flag5>
|
||||
<reserved_flag6 type="hexBinary" length="4">0000003F</reserved_flag6>
|
||||
<reserved_flag7 type="hexBinary" length="4">00000040</reserved_flag7>
|
||||
<longname_ja type="string" length="512">FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</longname_ja>
|
||||
<longname_en type="string" length="512">HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH</longname_en>
|
||||
<longname_fr type="string" length="512">III</longname_fr>
|
||||
<longname_de type="string" length="512">JJJ</longname_de>
|
||||
<longname_it type="string" length="512">KKK</longname_it>
|
||||
<longname_es type="string" length="512">LLL</longname_es>
|
||||
<longname_zhs type="string" length="512">MMM</longname_zhs>
|
||||
<longname_ko type="string" length="512">NNN</longname_ko>
|
||||
<longname_nl type="string" length="512">OOO</longname_nl>
|
||||
<longname_pt type="string" length="512">PPP</longname_pt>
|
||||
<longname_ru type="string" length="512">QQQ</longname_ru>
|
||||
<longname_zht type="string" length="512">RRR</longname_zht>
|
||||
<shortname_ja type="string" length="256">SSS</shortname_ja>
|
||||
<shortname_en type="string" length="256">TTT</shortname_en>
|
||||
<shortname_fr type="string" length="256">UUU</shortname_fr>
|
||||
<shortname_de type="string" length="256">VVV</shortname_de>
|
||||
<shortname_it type="string" length="256">WWW</shortname_it>
|
||||
<shortname_es type="string" length="256">XXX</shortname_es>
|
||||
<shortname_zhs type="string" length="256">YYY</shortname_zhs>
|
||||
<shortname_ko type="string" length="256">ZZZ</shortname_ko>
|
||||
<shortname_nl type="string" length="256">111</shortname_nl>
|
||||
<shortname_pt type="string" length="256">222</shortname_pt>
|
||||
<shortname_ru type="string" length="256">333</shortname_ru>
|
||||
<shortname_zht type="string" length="256">444</shortname_zht>
|
||||
<publisher_ja type="string" length="256">555</publisher_ja>
|
||||
<publisher_en type="string" length="256">666</publisher_en>
|
||||
<publisher_fr type="string" length="256">777</publisher_fr>
|
||||
<publisher_de type="string" length="256">888</publisher_de>
|
||||
<publisher_it type="string" length="256">999</publisher_it>
|
||||
<publisher_es type="string" length="256">1010</publisher_es>
|
||||
<publisher_zhs type="string" length="256">1212</publisher_zhs>
|
||||
<publisher_ko type="string" length="256">1313</publisher_ko>
|
||||
<publisher_nl type="string" length="256">1414</publisher_nl>
|
||||
<publisher_pt type="string" length="256">1515</publisher_pt>
|
||||
<publisher_ru type="string" length="256">1616</publisher_ru>
|
||||
<publisher_zht type="string" length="256">GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG</publisher_zht>
|
||||
<add_on_unique_id0 type="hexBinary" length="4">00000041</add_on_unique_id0>
|
||||
<add_on_unique_id1 type="hexBinary" length="4">00000042</add_on_unique_id1>
|
||||
<add_on_unique_id2 type="hexBinary" length="4">00000043</add_on_unique_id2>
|
||||
<add_on_unique_id3 type="hexBinary" length="4">00000044</add_on_unique_id3>
|
||||
<add_on_unique_id4 type="hexBinary" length="4">00000045</add_on_unique_id4>
|
||||
<add_on_unique_id5 type="hexBinary" length="4">00000046</add_on_unique_id5>
|
||||
<add_on_unique_id6 type="hexBinary" length="4">00000047</add_on_unique_id6>
|
||||
<add_on_unique_id7 type="hexBinary" length="4">00000048</add_on_unique_id7>
|
||||
<add_on_unique_id8 type="hexBinary" length="4">00000049</add_on_unique_id8>
|
||||
<add_on_unique_id9 type="hexBinary" length="4">0000004A</add_on_unique_id9>
|
||||
<add_on_unique_id10 type="hexBinary" length="4">0000004B</add_on_unique_id10>
|
||||
<add_on_unique_id11 type="hexBinary" length="4">0000004C</add_on_unique_id11>
|
||||
<add_on_unique_id12 type="hexBinary" length="4">0000004D</add_on_unique_id12>
|
||||
<add_on_unique_id13 type="hexBinary" length="4">0000004E</add_on_unique_id13>
|
||||
<add_on_unique_id14 type="hexBinary" length="4">0000004F</add_on_unique_id14>
|
||||
<add_on_unique_id15 type="hexBinary" length="4">00000050</add_on_unique_id15>
|
||||
<add_on_unique_id16 type="hexBinary" length="4">00000051</add_on_unique_id16>
|
||||
<add_on_unique_id17 type="hexBinary" length="4">00000052</add_on_unique_id17>
|
||||
<add_on_unique_id18 type="hexBinary" length="4">00000053</add_on_unique_id18>
|
||||
<add_on_unique_id19 type="hexBinary" length="4">00000054</add_on_unique_id19>
|
||||
<add_on_unique_id20 type="hexBinary" length="4">00000055</add_on_unique_id20>
|
||||
<add_on_unique_id21 type="hexBinary" length="4">00000056</add_on_unique_id21>
|
||||
<add_on_unique_id22 type="hexBinary" length="4">00000057</add_on_unique_id22>
|
||||
<add_on_unique_id23 type="hexBinary" length="4">00000058</add_on_unique_id23>
|
||||
<add_on_unique_id24 type="hexBinary" length="4">00000059</add_on_unique_id24>
|
||||
<add_on_unique_id25 type="hexBinary" length="4">0000005A</add_on_unique_id25>
|
||||
<add_on_unique_id26 type="hexBinary" length="4">0000005B</add_on_unique_id26>
|
||||
<add_on_unique_id27 type="hexBinary" length="4">0000005C</add_on_unique_id27>
|
||||
<add_on_unique_id28 type="hexBinary" length="4">0000005D</add_on_unique_id28>
|
||||
<add_on_unique_id29 type="hexBinary" length="4">0000005E</add_on_unique_id29>
|
||||
<add_on_unique_id30 type="hexBinary" length="4">0000005F</add_on_unique_id30>
|
||||
<add_on_unique_id31 type="hexBinary" length="4">00000060</add_on_unique_id31>
|
||||
</menu>
|
140
meta.xml
Normal file
140
meta.xml
Normal file
@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu type="complex" access="777">
|
||||
<version type="unsignedInt" length="4">1</version>
|
||||
<product_code type="string" length="32">WUP-P-HBLD</product_code>
|
||||
<content_platform type="string" length="32">WUP</content_platform>
|
||||
<company_code type="string" length="8">0001</company_code>
|
||||
<mastering_date type="string" length="32"></mastering_date>
|
||||
<logo_type type="unsignedInt" length="4">0</logo_type>
|
||||
<app_launch_type type="hexBinary" length="4">00000000</app_launch_type>
|
||||
<invisible_flag type="hexBinary" length="4">00000000</invisible_flag>
|
||||
<no_managed_flag type="hexBinary" length="4">00000000</no_managed_flag>
|
||||
<no_event_log type="hexBinary" length="4">00000000</no_event_log>
|
||||
<no_icon_database type="hexBinary" length="4">00000000</no_icon_database>
|
||||
<launching_flag type="hexBinary" length="4">00000004</launching_flag>
|
||||
<install_flag type="hexBinary" length="4">00000000</install_flag>
|
||||
<closing_msg type="unsignedInt" length="4">1</closing_msg>
|
||||
<title_version type="unsignedInt" length="4">0</title_version>
|
||||
<title_id type="hexBinary" length="8">0005000013374842</title_id>
|
||||
<group_id type="hexBinary" length="4">00003748</group_id>
|
||||
<boss_id type="hexBinary" length="8">0000000000000000</boss_id>
|
||||
<os_version type="hexBinary" length="8">000500101000400A</os_version>
|
||||
<app_size type="hexBinary" length="8">0000000000000000</app_size>
|
||||
<common_save_size type="hexBinary" length="8">0000000001790000</common_save_size>
|
||||
<account_save_size type="hexBinary" length="8">0000000000000000</account_save_size>
|
||||
<common_boss_size type="hexBinary" length="8">0000000000000000</common_boss_size>
|
||||
<account_boss_size type="hexBinary" length="8">0000000000000000</account_boss_size>
|
||||
<save_no_rollback type="unsignedInt" length="4">0</save_no_rollback>
|
||||
<join_game_id type="hexBinary" length="4">00000000</join_game_id>
|
||||
<join_game_mode_mask type="hexBinary" length="8">0000000000000000</join_game_mode_mask>
|
||||
<bg_daemon_enable type="unsignedInt" length="4">1</bg_daemon_enable>
|
||||
<olv_accesskey type="unsignedInt" length="4">0</olv_accesskey>
|
||||
<wood_tin type="unsignedInt" length="4">0</wood_tin>
|
||||
<e_manual type="unsignedInt" length="4">0</e_manual>
|
||||
<e_manual_version type="unsignedInt" length="4">0</e_manual_version>
|
||||
<region type="hexBinary" length="4">FFFFFFFF</region>
|
||||
<pc_cero type="unsignedInt" length="4">128</pc_cero>
|
||||
<pc_esrb type="unsignedInt" length="4">128</pc_esrb>
|
||||
<pc_bbfc type="unsignedInt" length="4">192</pc_bbfc>
|
||||
<pc_usk type="unsignedInt" length="4">128</pc_usk>
|
||||
<pc_pegi_gen type="unsignedInt" length="4">128</pc_pegi_gen>
|
||||
<pc_pegi_fin type="unsignedInt" length="4">192</pc_pegi_fin>
|
||||
<pc_pegi_prt type="unsignedInt" length="4">128</pc_pegi_prt>
|
||||
<pc_pegi_bbfc type="unsignedInt" length="4">128</pc_pegi_bbfc>
|
||||
<pc_cob type="unsignedInt" length="4">128</pc_cob>
|
||||
<pc_grb type="unsignedInt" length="4">128</pc_grb>
|
||||
<pc_cgsrr type="unsignedInt" length="4">128</pc_cgsrr>
|
||||
<pc_oflc type="unsignedInt" length="4">128</pc_oflc>
|
||||
<pc_reserved0 type="unsignedInt" length="4">192</pc_reserved0>
|
||||
<pc_reserved1 type="unsignedInt" length="4">192</pc_reserved1>
|
||||
<pc_reserved2 type="unsignedInt" length="4">192</pc_reserved2>
|
||||
<pc_reserved3 type="unsignedInt" length="4">192</pc_reserved3>
|
||||
<ext_dev_nunchaku type="unsignedInt" length="4">1</ext_dev_nunchaku>
|
||||
<ext_dev_classic type="unsignedInt" length="4">0</ext_dev_classic>
|
||||
<ext_dev_urcc type="unsignedInt" length="4">1</ext_dev_urcc>
|
||||
<ext_dev_board type="unsignedInt" length="4">0</ext_dev_board>
|
||||
<ext_dev_usb_keyboard type="unsignedInt" length="4">1</ext_dev_usb_keyboard>
|
||||
<ext_dev_etc type="unsignedInt" length="4">0</ext_dev_etc>
|
||||
<ext_dev_etc_name type="string" length="512"></ext_dev_etc_name>
|
||||
<eula_version type="unsignedInt" length="4">0</eula_version>
|
||||
<drc_use type="unsignedInt" length="4">1</drc_use>
|
||||
<network_use type="unsignedInt" length="4">1</network_use>
|
||||
<online_account_use type="unsignedInt" length="4">0</online_account_use>
|
||||
<direct_boot type="unsignedInt" length="4">0</direct_boot>
|
||||
<reserved_flag0 type="hexBinary" length="4">00010001</reserved_flag0>
|
||||
<reserved_flag1 type="hexBinary" length="4">00000000</reserved_flag1>
|
||||
<reserved_flag2 type="hexBinary" length="4">00000000</reserved_flag2>
|
||||
<reserved_flag3 type="hexBinary" length="4">00000000</reserved_flag3>
|
||||
<reserved_flag4 type="hexBinary" length="4">00000000</reserved_flag4>
|
||||
<reserved_flag5 type="hexBinary" length="4">00000000</reserved_flag5>
|
||||
<reserved_flag6 type="hexBinary" length="4">00000003</reserved_flag6>
|
||||
<reserved_flag7 type="hexBinary" length="4">00000000</reserved_flag7>
|
||||
<longname_ja type="string" length="512">Homebrew Launcher</longname_ja>
|
||||
<longname_en type="string" length="512">Homebrew Launcher</longname_en>
|
||||
<longname_fr type="string" length="512">Homebrew Launcher</longname_fr>
|
||||
<longname_de type="string" length="512">Homebrew Launcher</longname_de>
|
||||
<longname_it type="string" length="512">Homebrew Launcher</longname_it>
|
||||
<longname_es type="string" length="512">Homebrew Launcher</longname_es>
|
||||
<longname_zhs type="string" length="512">Homebrew Launcher</longname_zhs>
|
||||
<longname_ko type="string" length="512">Homebrew Launcher</longname_ko>
|
||||
<longname_nl type="string" length="512">Homebrew Launcher</longname_nl>
|
||||
<longname_pt type="string" length="512">Homebrew Launcher</longname_pt>
|
||||
<longname_ru type="string" length="512">Homebrew Launcher</longname_ru>
|
||||
<longname_zht type="string" length="512">Homebrew Launcher</longname_zht>
|
||||
<shortname_ja type="string" length="256">Homebrew Launcher</shortname_ja>
|
||||
<shortname_en type="string" length="256">Homebrew Launcher</shortname_en>
|
||||
<shortname_fr type="string" length="256">Homebrew Launcher</shortname_fr>
|
||||
<shortname_de type="string" length="256">Homebrew Launcher</shortname_de>
|
||||
<shortname_it type="string" length="256">Homebrew Launcher</shortname_it>
|
||||
<shortname_es type="string" length="256">Homebrew Launcher</shortname_es>
|
||||
<shortname_zhs type="string" length="256">Homebrew Launcher</shortname_zhs>
|
||||
<shortname_ko type="string" length="256">Homebrew Launcher</shortname_ko>
|
||||
<shortname_nl type="string" length="256">Homebrew Launcher</shortname_nl>
|
||||
<shortname_pt type="string" length="256">Homebrew Launcher</shortname_pt>
|
||||
<shortname_ru type="string" length="256">Homebrew Launcher</shortname_ru>
|
||||
<shortname_zht type="string" length="256">Homebrew Launcher</shortname_zht>
|
||||
<publisher_ja type="string" length="256">dimok</publisher_ja>
|
||||
<publisher_en type="string" length="256">dimok</publisher_en>
|
||||
<publisher_fr type="string" length="256">dimok</publisher_fr>
|
||||
<publisher_de type="string" length="256">dimok</publisher_de>
|
||||
<publisher_it type="string" length="256">dimok</publisher_it>
|
||||
<publisher_es type="string" length="256">dimok</publisher_es>
|
||||
<publisher_zhs type="string" length="256">dimok</publisher_zhs>
|
||||
<publisher_ko type="string" length="256">dimok</publisher_ko>
|
||||
<publisher_nl type="string" length="256">dimok</publisher_nl>
|
||||
<publisher_pt type="string" length="256">dimok</publisher_pt>
|
||||
<publisher_ru type="string" length="256">dimok</publisher_ru>
|
||||
<publisher_zht type="string" length="256">dimok</publisher_zht>
|
||||
<add_on_unique_id0 type="hexBinary" length="4">00000000</add_on_unique_id0>
|
||||
<add_on_unique_id1 type="hexBinary" length="4">00000000</add_on_unique_id1>
|
||||
<add_on_unique_id2 type="hexBinary" length="4">00000000</add_on_unique_id2>
|
||||
<add_on_unique_id3 type="hexBinary" length="4">00000000</add_on_unique_id3>
|
||||
<add_on_unique_id4 type="hexBinary" length="4">00000000</add_on_unique_id4>
|
||||
<add_on_unique_id5 type="hexBinary" length="4">00000000</add_on_unique_id5>
|
||||
<add_on_unique_id6 type="hexBinary" length="4">00000000</add_on_unique_id6>
|
||||
<add_on_unique_id7 type="hexBinary" length="4">00000000</add_on_unique_id7>
|
||||
<add_on_unique_id8 type="hexBinary" length="4">00000000</add_on_unique_id8>
|
||||
<add_on_unique_id9 type="hexBinary" length="4">00000000</add_on_unique_id9>
|
||||
<add_on_unique_id10 type="hexBinary" length="4">00000000</add_on_unique_id10>
|
||||
<add_on_unique_id11 type="hexBinary" length="4">00000000</add_on_unique_id11>
|
||||
<add_on_unique_id12 type="hexBinary" length="4">00000000</add_on_unique_id12>
|
||||
<add_on_unique_id13 type="hexBinary" length="4">00000000</add_on_unique_id13>
|
||||
<add_on_unique_id14 type="hexBinary" length="4">00000000</add_on_unique_id14>
|
||||
<add_on_unique_id15 type="hexBinary" length="4">00000000</add_on_unique_id15>
|
||||
<add_on_unique_id16 type="hexBinary" length="4">00000000</add_on_unique_id16>
|
||||
<add_on_unique_id17 type="hexBinary" length="4">00000000</add_on_unique_id17>
|
||||
<add_on_unique_id18 type="hexBinary" length="4">00000000</add_on_unique_id18>
|
||||
<add_on_unique_id19 type="hexBinary" length="4">00000000</add_on_unique_id19>
|
||||
<add_on_unique_id20 type="hexBinary" length="4">00000000</add_on_unique_id20>
|
||||
<add_on_unique_id21 type="hexBinary" length="4">00000000</add_on_unique_id21>
|
||||
<add_on_unique_id22 type="hexBinary" length="4">00000000</add_on_unique_id22>
|
||||
<add_on_unique_id23 type="hexBinary" length="4">00000000</add_on_unique_id23>
|
||||
<add_on_unique_id24 type="hexBinary" length="4">00000000</add_on_unique_id24>
|
||||
<add_on_unique_id25 type="hexBinary" length="4">00000000</add_on_unique_id25>
|
||||
<add_on_unique_id26 type="hexBinary" length="4">00000000</add_on_unique_id26>
|
||||
<add_on_unique_id27 type="hexBinary" length="4">00000000</add_on_unique_id27>
|
||||
<add_on_unique_id28 type="hexBinary" length="4">00000000</add_on_unique_id28>
|
||||
<add_on_unique_id29 type="hexBinary" length="4">00000000</add_on_unique_id29>
|
||||
<add_on_unique_id30 type="hexBinary" length="4">00000000</add_on_unique_id30>
|
||||
<add_on_unique_id31 type="hexBinary" length="4">00000000</add_on_unique_id31>
|
||||
</menu>
|
175
src/fs/CFile.cpp
Normal file
175
src/fs/CFile.cpp
Normal file
@ -0,0 +1,175 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <fs/CFile.hpp>
|
||||
|
||||
CFile::CFile() {
|
||||
iFd = -1;
|
||||
mem_file = NULL;
|
||||
filesize = 0;
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
CFile::CFile(const std::string & filepath, eOpenTypes mode) {
|
||||
iFd = -1;
|
||||
this->open(filepath, mode);
|
||||
}
|
||||
|
||||
CFile::CFile(const uint8_t * mem, int32_t size) {
|
||||
iFd = -1;
|
||||
this->open(mem, size);
|
||||
}
|
||||
|
||||
CFile::~CFile() {
|
||||
this->close();
|
||||
}
|
||||
|
||||
int32_t CFile::open(const std::string & filepath, eOpenTypes mode) {
|
||||
this->close();
|
||||
int32_t openMode = 0;
|
||||
|
||||
// This depend on the devoptab implementation.
|
||||
// see https://github.com/devkitPro/wut/blob/master/libraries/wutdevoptab/devoptab_fs_open.c#L21 fpr reference
|
||||
|
||||
switch(mode) {
|
||||
default:
|
||||
case ReadOnly: // file must exist
|
||||
openMode = O_RDONLY;
|
||||
break;
|
||||
case WriteOnly: // file will be created / zerod
|
||||
openMode = O_TRUNC | O_CREAT | O_WRONLY;
|
||||
break;
|
||||
case ReadWrite: // file must exist
|
||||
openMode = O_RDWR;
|
||||
break;
|
||||
case Append: // append to file, file will be created if missing. write only
|
||||
openMode = O_CREAT | O_APPEND | O_WRONLY;
|
||||
break;
|
||||
}
|
||||
|
||||
//! Using fopen works only on the first launch as expected
|
||||
//! on the second launch it causes issues because we don't overwrite
|
||||
//! the .data sections which is needed for a normal application to re-init
|
||||
//! this will be added with launching as RPX
|
||||
iFd = ::open(filepath.c_str(), openMode);
|
||||
if(iFd < 0)
|
||||
return iFd;
|
||||
|
||||
|
||||
filesize = ::lseek(iFd, 0, SEEK_END);
|
||||
::lseek(iFd, 0, SEEK_SET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t CFile::open(const uint8_t * mem, int32_t size) {
|
||||
this->close();
|
||||
|
||||
mem_file = mem;
|
||||
filesize = size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CFile::close() {
|
||||
if(iFd >= 0)
|
||||
::close(iFd);
|
||||
|
||||
iFd = -1;
|
||||
mem_file = NULL;
|
||||
filesize = 0;
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
int32_t CFile::read(uint8_t * ptr, size_t size) {
|
||||
if(iFd >= 0) {
|
||||
int32_t ret = ::read(iFd, ptr,size);
|
||||
if(ret > 0)
|
||||
pos += ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t readsize = size;
|
||||
|
||||
if(readsize > (int64_t) (filesize-pos))
|
||||
readsize = filesize-pos;
|
||||
|
||||
if(readsize <= 0)
|
||||
return readsize;
|
||||
|
||||
if(mem_file != NULL) {
|
||||
memcpy(ptr, mem_file+pos, readsize);
|
||||
pos += readsize;
|
||||
return readsize;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t CFile::write(const uint8_t * ptr, size_t size) {
|
||||
if(iFd >= 0) {
|
||||
size_t done = 0;
|
||||
while(done < size) {
|
||||
int32_t ret = ::write(iFd, ptr, size - done);
|
||||
if(ret <= 0)
|
||||
return ret;
|
||||
|
||||
ptr += ret;
|
||||
done += ret;
|
||||
pos += ret;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t CFile::seek(long int offset, int32_t origin) {
|
||||
int32_t ret = 0;
|
||||
int64_t newPos = pos;
|
||||
|
||||
if(origin == SEEK_SET) {
|
||||
newPos = offset;
|
||||
} else if(origin == SEEK_CUR) {
|
||||
newPos += offset;
|
||||
} else if(origin == SEEK_END) {
|
||||
newPos = filesize+offset;
|
||||
}
|
||||
|
||||
if(newPos < 0) {
|
||||
pos = 0;
|
||||
} else {
|
||||
pos = newPos;
|
||||
}
|
||||
|
||||
if(iFd >= 0)
|
||||
ret = ::lseek(iFd, pos, SEEK_SET);
|
||||
|
||||
if(mem_file != NULL) {
|
||||
if(pos > filesize) {
|
||||
pos = filesize;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t CFile::fwrite(const char *format, ...) {
|
||||
char tmp[512];
|
||||
tmp[0] = 0;
|
||||
int32_t result = -1;
|
||||
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(tmp, format, va) >= 0)) {
|
||||
result = this->write((uint8_t *)tmp, strlen(tmp));
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
61
src/fs/CFile.hpp
Normal file
61
src/fs/CFile.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef CFILE_HPP_
|
||||
#define CFILE_HPP_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <wut_types.h>
|
||||
|
||||
class CFile {
|
||||
public:
|
||||
enum eOpenTypes {
|
||||
ReadOnly,
|
||||
WriteOnly,
|
||||
ReadWrite,
|
||||
Append
|
||||
};
|
||||
|
||||
CFile();
|
||||
CFile(const std::string & filepath, eOpenTypes mode);
|
||||
CFile(const uint8_t * memory, int32_t memsize);
|
||||
virtual ~CFile();
|
||||
|
||||
int32_t open(const std::string & filepath, eOpenTypes mode);
|
||||
int32_t open(const uint8_t * memory, int32_t memsize);
|
||||
|
||||
BOOL isOpen() const {
|
||||
if(iFd >= 0)
|
||||
return true;
|
||||
|
||||
if(mem_file)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void close();
|
||||
|
||||
int32_t read(uint8_t * ptr, size_t size);
|
||||
int32_t write(const uint8_t * ptr, size_t size);
|
||||
int32_t fwrite(const char *format, ...);
|
||||
int32_t seek(long int offset, int32_t origin);
|
||||
uint64_t tell() {
|
||||
return pos;
|
||||
};
|
||||
uint64_t size() {
|
||||
return filesize;
|
||||
};
|
||||
void rewind() {
|
||||
this->seek(0, SEEK_SET);
|
||||
};
|
||||
|
||||
protected:
|
||||
int32_t iFd;
|
||||
const uint8_t * mem_file;
|
||||
uint64_t filesize;
|
||||
uint64_t pos;
|
||||
};
|
||||
|
||||
#endif
|
218
src/fs/DirList.cpp
Normal file
218
src/fs/DirList.cpp
Normal file
@ -0,0 +1,218 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* 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.
|
||||
*
|
||||
* DirList Class
|
||||
* for WiiXplorer 2010
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <strings.h>
|
||||
#include <algorithm>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
#include <fs/DirList.h>
|
||||
#include <utils/StringTools.h>
|
||||
|
||||
DirList::DirList() {
|
||||
Flags = 0;
|
||||
Filter = 0;
|
||||
Depth = 0;
|
||||
}
|
||||
|
||||
DirList::DirList(const std::string & path, const char *filter, uint32_t flags, uint32_t maxDepth) {
|
||||
this->LoadPath(path, filter, flags, maxDepth);
|
||||
this->SortList();
|
||||
}
|
||||
|
||||
DirList::~DirList() {
|
||||
ClearList();
|
||||
}
|
||||
|
||||
BOOL DirList::LoadPath(const std::string & folder, const char *filter, uint32_t flags, uint32_t maxDepth) {
|
||||
if(folder.empty())
|
||||
return false;
|
||||
|
||||
Flags = flags;
|
||||
Filter = filter;
|
||||
Depth = maxDepth;
|
||||
|
||||
std::string folderpath(folder);
|
||||
uint32_t length = folderpath.size();
|
||||
|
||||
//! clear path of double slashes
|
||||
StringTools::RemoveDoubleSlashs(folderpath);
|
||||
|
||||
//! remove last slash if exists
|
||||
if(length > 0 && folderpath[length-1] == '/')
|
||||
folderpath.erase(length-1);
|
||||
|
||||
//! add root slash if missing
|
||||
if(folderpath.find('/') == std::string::npos) {
|
||||
folderpath += '/';
|
||||
}
|
||||
|
||||
return InternalLoadPath(folderpath);
|
||||
}
|
||||
|
||||
BOOL DirList::InternalLoadPath(std::string &folderpath) {
|
||||
if(folderpath.size() < 3)
|
||||
return false;
|
||||
|
||||
struct dirent *dirent = NULL;
|
||||
DIR *dir = NULL;
|
||||
|
||||
dir = opendir(folderpath.c_str());
|
||||
if (dir == NULL)
|
||||
return false;
|
||||
|
||||
while ((dirent = readdir(dir)) != 0) {
|
||||
BOOL isDir = dirent->d_type & DT_DIR;
|
||||
const char *filename = dirent->d_name;
|
||||
|
||||
if(isDir) {
|
||||
if(strcmp(filename,".") == 0 || strcmp(filename,"..") == 0)
|
||||
continue;
|
||||
|
||||
if((Flags & CheckSubfolders) && (Depth > 0)) {
|
||||
int32_t length = folderpath.size();
|
||||
if(length > 2 && folderpath[length-1] != '/') {
|
||||
folderpath += '/';
|
||||
}
|
||||
folderpath += filename;
|
||||
|
||||
Depth--;
|
||||
InternalLoadPath(folderpath);
|
||||
folderpath.erase(length);
|
||||
Depth++;
|
||||
}
|
||||
|
||||
if(!(Flags & Dirs))
|
||||
continue;
|
||||
} else if(!(Flags & Files)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(Filter) {
|
||||
char * fileext = strrchr(filename, '.');
|
||||
if(!fileext)
|
||||
continue;
|
||||
|
||||
if(StringTools::strtokcmp(fileext, Filter, ",") == 0)
|
||||
AddEntrie(folderpath, filename, isDir);
|
||||
} else {
|
||||
AddEntrie(folderpath, filename, isDir);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DirList::AddEntrie(const std::string &filepath, const char * filename, BOOL isDir) {
|
||||
if(!filename)
|
||||
return;
|
||||
|
||||
int32_t pos = FileInfo.size();
|
||||
|
||||
FileInfo.resize(pos+1);
|
||||
|
||||
FileInfo[pos].FilePath = (char *) malloc(filepath.size()+strlen(filename)+2);
|
||||
if(!FileInfo[pos].FilePath) {
|
||||
FileInfo.resize(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(FileInfo[pos].FilePath, "%s/%s", filepath.c_str(), filename);
|
||||
FileInfo[pos].isDir = isDir;
|
||||
}
|
||||
|
||||
void DirList::ClearList() {
|
||||
for(uint32_t i = 0; i < FileInfo.size(); ++i) {
|
||||
if(FileInfo[i].FilePath) {
|
||||
free(FileInfo[i].FilePath);
|
||||
FileInfo[i].FilePath = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
FileInfo.clear();
|
||||
std::vector<DirEntry>().swap(FileInfo);
|
||||
}
|
||||
|
||||
const char * DirList::GetFilename(int32_t ind) const {
|
||||
if (!valid(ind))
|
||||
return "";
|
||||
|
||||
return StringTools::FullpathToFilename(FileInfo[ind].FilePath);
|
||||
}
|
||||
|
||||
static BOOL SortCallback(const DirEntry & f1, const DirEntry & f2) {
|
||||
if(f1.isDir && !(f2.isDir))
|
||||
return true;
|
||||
if(!(f1.isDir) && f2.isDir)
|
||||
return false;
|
||||
|
||||
if(f1.FilePath && !f2.FilePath)
|
||||
return true;
|
||||
if(!f1.FilePath)
|
||||
return false;
|
||||
|
||||
if(strcasecmp(f1.FilePath, f2.FilePath) > 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DirList::SortList() {
|
||||
if(FileInfo.size() > 1)
|
||||
std::sort(FileInfo.begin(), FileInfo.end(), SortCallback);
|
||||
}
|
||||
|
||||
void DirList::SortList(BOOL (*SortFunc)(const DirEntry &a, const DirEntry &b)) {
|
||||
if(FileInfo.size() > 1)
|
||||
std::sort(FileInfo.begin(), FileInfo.end(), SortFunc);
|
||||
}
|
||||
|
||||
uint64_t DirList::GetFilesize(int32_t index) const {
|
||||
struct stat st;
|
||||
const char *path = GetFilepath(index);
|
||||
|
||||
if(!path || stat(path, &st) != 0)
|
||||
return 0;
|
||||
|
||||
return st.st_size;
|
||||
}
|
||||
|
||||
int32_t DirList::GetFileIndex(const char *filename) const {
|
||||
if(!filename)
|
||||
return -1;
|
||||
|
||||
for (uint32_t i = 0; i < FileInfo.size(); ++i) {
|
||||
if (strcasecmp(GetFilename(i), filename) == 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
106
src/fs/DirList.h
Normal file
106
src/fs/DirList.h
Normal file
@ -0,0 +1,106 @@
|
||||
/****************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* 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.
|
||||
*
|
||||
* DirList Class
|
||||
* for WiiXplorer 2010
|
||||
***************************************************************************/
|
||||
#ifndef ___DIRLIST_H_
|
||||
#define ___DIRLIST_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <wut_types.h>
|
||||
|
||||
typedef struct {
|
||||
char * FilePath;
|
||||
BOOL isDir;
|
||||
} DirEntry;
|
||||
|
||||
class DirList {
|
||||
public:
|
||||
//!Constructor
|
||||
DirList(void);
|
||||
//!\param path Path from where to load the filelist of all files
|
||||
//!\param filter A fileext that needs to be filtered
|
||||
//!\param flags search/filter flags from the enum
|
||||
DirList(const std::string & path, const char *filter = NULL, uint32_t flags = Files | Dirs, uint32_t maxDepth = 0xffffffff);
|
||||
//!Destructor
|
||||
virtual ~DirList();
|
||||
//! Load all the files from a directory
|
||||
BOOL LoadPath(const std::string & path, const char *filter = NULL, uint32_t flags = Files | Dirs, uint32_t maxDepth = 0xffffffff);
|
||||
//! Get a filename of the list
|
||||
//!\param list index
|
||||
const char * GetFilename(int32_t index) const;
|
||||
//! Get the a filepath of the list
|
||||
//!\param list index
|
||||
const char *GetFilepath(int32_t index) const {
|
||||
if (!valid(index))
|
||||
return "";
|
||||
else
|
||||
return FileInfo[index].FilePath;
|
||||
}
|
||||
//! Get the a filesize of the list
|
||||
//!\param list index
|
||||
uint64_t GetFilesize(int32_t index) const;
|
||||
//! Is index a dir or a file
|
||||
//!\param list index
|
||||
BOOL IsDir(int32_t index) const {
|
||||
if(!valid(index))
|
||||
return false;
|
||||
return FileInfo[index].isDir;
|
||||
};
|
||||
//! Get the filecount of the whole list
|
||||
int32_t GetFilecount() const {
|
||||
return FileInfo.size();
|
||||
};
|
||||
//! Sort list by filepath
|
||||
void SortList();
|
||||
//! Custom sort command for custom sort functions definitions
|
||||
void SortList(BOOL (*SortFunc)(const DirEntry &a, const DirEntry &b));
|
||||
//! Get the index of the specified filename
|
||||
int32_t GetFileIndex(const char *filename) const;
|
||||
//! Enum for search/filter flags
|
||||
enum {
|
||||
Files = 0x01,
|
||||
Dirs = 0x02,
|
||||
CheckSubfolders = 0x08,
|
||||
};
|
||||
protected:
|
||||
// Internal parser
|
||||
BOOL InternalLoadPath(std::string &path);
|
||||
//!Add a list entrie
|
||||
void AddEntrie(const std::string &filepath, const char * filename, BOOL isDir);
|
||||
//! Clear the list
|
||||
void ClearList();
|
||||
//! Check if valid pos is requested
|
||||
inline BOOL valid(uint32_t pos) const {
|
||||
return (pos < FileInfo.size());
|
||||
};
|
||||
|
||||
uint32_t Flags;
|
||||
uint32_t Depth;
|
||||
const char *Filter;
|
||||
std::vector<DirEntry> FileInfo;
|
||||
};
|
||||
|
||||
#endif
|
142
src/fs/FSUtils.cpp
Normal file
142
src/fs/FSUtils.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "fs/FSUtils.h"
|
||||
#include "fs/CFile.hpp"
|
||||
#include "utils/logger.h"
|
||||
|
||||
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
|
||||
//! always initialze input
|
||||
*inbuffer = NULL;
|
||||
if(size)
|
||||
*size = 0;
|
||||
|
||||
int32_t iFd = open(filepath, O_RDONLY);
|
||||
if (iFd < 0)
|
||||
return -1;
|
||||
|
||||
uint32_t filesize = lseek(iFd, 0, SEEK_END);
|
||||
lseek(iFd, 0, SEEK_SET);
|
||||
|
||||
uint8_t *buffer = (uint8_t *) malloc(filesize);
|
||||
if (buffer == NULL) {
|
||||
close(iFd);
|
||||
return -2;
|
||||
}
|
||||
|
||||
uint32_t blocksize = 0x4000;
|
||||
uint32_t done = 0;
|
||||
int32_t readBytes = 0;
|
||||
|
||||
while(done < filesize) {
|
||||
if(done + blocksize > filesize) {
|
||||
blocksize = filesize - done;
|
||||
}
|
||||
readBytes = read(iFd, buffer + done, blocksize);
|
||||
if(readBytes <= 0)
|
||||
break;
|
||||
done += readBytes;
|
||||
}
|
||||
|
||||
close(iFd);
|
||||
|
||||
if (done != filesize) {
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
return -3;
|
||||
}
|
||||
|
||||
*inbuffer = buffer;
|
||||
|
||||
//! sign is optional input
|
||||
if(size) {
|
||||
*size = filesize;
|
||||
}
|
||||
|
||||
return filesize;
|
||||
}
|
||||
|
||||
int32_t FSUtils::CheckFile(const char * filepath) {
|
||||
if(!filepath)
|
||||
return 0;
|
||||
|
||||
struct stat filestat;
|
||||
|
||||
char dirnoslash[strlen(filepath)+2];
|
||||
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
|
||||
|
||||
while(dirnoslash[strlen(dirnoslash)-1] == '/')
|
||||
dirnoslash[strlen(dirnoslash)-1] = '\0';
|
||||
|
||||
char * notRoot = strrchr(dirnoslash, '/');
|
||||
if(!notRoot) {
|
||||
strcat(dirnoslash, "/");
|
||||
}
|
||||
|
||||
if (stat(dirnoslash, &filestat) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t FSUtils::CreateSubfolder(const char * fullpath) {
|
||||
if(!fullpath)
|
||||
return 0;
|
||||
|
||||
int32_t result = 0;
|
||||
|
||||
char dirnoslash[strlen(fullpath)+1];
|
||||
strcpy(dirnoslash, fullpath);
|
||||
|
||||
int32_t pos = strlen(dirnoslash)-1;
|
||||
while(dirnoslash[pos] == '/') {
|
||||
dirnoslash[pos] = '\0';
|
||||
pos--;
|
||||
}
|
||||
|
||||
if(CheckFile(dirnoslash)) {
|
||||
return 1;
|
||||
} else {
|
||||
char parentpath[strlen(dirnoslash)+2];
|
||||
strcpy(parentpath, dirnoslash);
|
||||
char * ptr = strrchr(parentpath, '/');
|
||||
|
||||
if(!ptr) {
|
||||
//!Device root directory (must be with '/')
|
||||
strcat(parentpath, "/");
|
||||
struct stat filestat;
|
||||
if (stat(parentpath, &filestat) == 0)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ptr++;
|
||||
ptr[0] = '\0';
|
||||
|
||||
result = CreateSubfolder(parentpath);
|
||||
}
|
||||
|
||||
if(!result)
|
||||
return 0;
|
||||
|
||||
if (mkdir(dirnoslash, 0777) == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t FSUtils::saveBufferToFile(const char * path, void * buffer, uint32_t size) {
|
||||
CFile file(path, CFile::WriteOnly);
|
||||
if (!file.isOpen()) {
|
||||
DEBUG_FUNCTION_LINE("Failed to open %s\n",path);
|
||||
return 0;
|
||||
}
|
||||
int32_t written = file.write((const uint8_t*) buffer, size);
|
||||
file.close();
|
||||
return written;
|
||||
}
|
||||
|
16
src/fs/FSUtils.h
Normal file
16
src/fs/FSUtils.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef __FS_UTILS_H_
|
||||
#define __FS_UTILS_H_
|
||||
|
||||
#include <wut_types.h>
|
||||
|
||||
class FSUtils {
|
||||
public:
|
||||
static int32_t LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size);
|
||||
|
||||
//! todo: C++ class
|
||||
static int32_t CreateSubfolder(const char * fullpath);
|
||||
static int32_t CheckFile(const char * filepath);
|
||||
static int32_t saveBufferToFile(const char * path, void * buffer, uint32_t size);
|
||||
};
|
||||
|
||||
#endif // __FS_UTILS_H_
|
621
src/main.cpp
Normal file
621
src/main.cpp
Normal file
@ -0,0 +1,621 @@
|
||||
#include <wups.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <coreinit/mcp.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include <vpad/input.h>
|
||||
#include <utils/logger.h>
|
||||
#include <map>
|
||||
#include <utils/utils.h>
|
||||
#include <fs/DirList.h>
|
||||
|
||||
#define TARGET_WIDTH (854)
|
||||
#define TARGET_HEIGHT (480)
|
||||
|
||||
|
||||
void printVPADButtons(VPADStatus * buffer);
|
||||
|
||||
WUPS_PLUGIN_NAME("Vpad input logger");
|
||||
WUPS_PLUGIN_DESCRIPTION("Prints information about vpad inputs and sensors");
|
||||
WUPS_PLUGIN_VERSION("v1.0");
|
||||
WUPS_PLUGIN_AUTHOR("Maschell");
|
||||
WUPS_PLUGIN_LICENSE("GPL");
|
||||
IOSHandle handles[100];
|
||||
|
||||
|
||||
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();
|
||||
extern void __fini_wut_malloc();
|
||||
}
|
||||
|
||||
WUPS_FS_ACCESS()
|
||||
|
||||
MCPTitleListType my[25] __attribute__((section(".data")));
|
||||
MCPTitleListType template_title;
|
||||
|
||||
ON_APPLICATION_START(args) {
|
||||
__init_wut_malloc();
|
||||
socket_lib_init();
|
||||
log_init();
|
||||
DEBUG_FUNCTION_LINE("###############\n");
|
||||
}
|
||||
|
||||
ON_APPLICATION_ENDING(){
|
||||
__fini_wut_malloc();
|
||||
DEBUG_FUNCTION_LINE("###############\n");
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
continue;
|
||||
//! skip our own application in the listing
|
||||
if(strcasecmp(dirList.GetFilename(i), "homebrew_launcher.rpx") == 0)
|
||||
continue;
|
||||
|
||||
//! skip hidden linux and mac files
|
||||
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);
|
||||
|
||||
strcpy(template_title.path,buffer);
|
||||
template_title.titleId = 0x0005000F00000000 + j;
|
||||
|
||||
memcpy(&(titleList[titlecount]), &template_title ,sizeof(MCPTitleListType));
|
||||
memcpy(&(my[j]), &template_title ,sizeof(MCPTitleListType));
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if(titleid_upper == 0x0005000F){
|
||||
memcpy(u6, &(my[titleid_lower_2]), sizeof(MCPTitleListType));
|
||||
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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int, FSOpenFile, FSClient *pClient, FSCmdBlock *pCmd, char *path, const char *mode, int *handle, int error) {
|
||||
socket_lib_init();
|
||||
log_init();
|
||||
|
||||
char * start = "/vol/storage_mlc01/sys/title/0005000F";
|
||||
if(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);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint32_t titleid_upper, uint32_t titleid_lower, _ACPMetaXml* out_buf, uint32_t device, uint32_t u1) {
|
||||
|
||||
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));
|
||||
|
||||
result = 0;
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("TitleID: %08X%08X res:%016llX device: %d %08X = %08X \n",titleid_upper ,titleid_lower ,out_buf->title_id , device ,u1,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaDirByDevice, uint32_t titleid_upper, uint32_t titleid_lower, char* out_buf, uint32_t size, int device) {
|
||||
int result = real_ACPGetTitleMetaDirByDevice(titleid_upper, titleid_lower, out_buf, size, device);
|
||||
|
||||
|
||||
if(titleid_upper == 0x0005000F){
|
||||
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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// You must free the result if result is non-NULL.
|
||||
char *str_replace(char *orig, char *rep, char *with) {
|
||||
char *result; // the return string
|
||||
char *ins; // the next insert point
|
||||
char *tmp; // varies
|
||||
int len_rep; // length of rep (the string to remove)
|
||||
int len_with; // length of with (the string to replace rep with)
|
||||
int len_front; // distance between rep and end of last rep
|
||||
int count; // number of replacements
|
||||
|
||||
// sanity checks and initialization
|
||||
if (!orig || !rep)
|
||||
return NULL;
|
||||
len_rep = strlen(rep);
|
||||
if (len_rep == 0)
|
||||
return NULL; // empty rep causes infinite loop during count
|
||||
if (!with)
|
||||
with = "";
|
||||
len_with = strlen(with);
|
||||
|
||||
// count the number of replacements needed
|
||||
ins = orig;
|
||||
for (count = 0; tmp = strstr(ins, rep); ++count) {
|
||||
ins = tmp + len_rep;
|
||||
}
|
||||
|
||||
tmp = result = (char*)malloc(strlen(orig) + (len_with - len_rep) * count + 1);
|
||||
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
// first time through the loop, all the variable are set correctly
|
||||
// from here on,
|
||||
// tmp points to the end of the result string
|
||||
// ins points to the next occurrence of rep in orig
|
||||
// orig points to the remainder of orig after "end of rep"
|
||||
while (count--) {
|
||||
ins = strstr(orig, rep);
|
||||
len_front = ins - orig;
|
||||
tmp = strncpy(tmp, orig, len_front) + len_front;
|
||||
tmp = strcpy(tmp, with) + len_with;
|
||||
orig += len_front + len_rep; // move to next "end of rep"
|
||||
}
|
||||
strcpy(tmp, orig);
|
||||
return result;
|
||||
}
|
||||
|
||||
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");
|
||||
}*/
|
||||
|
||||
// always load H&S app
|
||||
strcpy(pathToLoad,"/vol/storage_mlc01/usr/title/00050000/10119b00");
|
||||
}
|
||||
|
||||
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) {
|
||||
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));
|
||||
return result;
|
||||
}
|
||||
|
||||
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);
|
912
src/sss.txt
Normal file
912
src/sss.txt
Normal file
@ -0,0 +1,912 @@
|
||||
#include <wups.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <coreinit/mcp.h>
|
||||
#include <coreinit/filesystem.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#include <coreinit/ios.h>
|
||||
#include <vpad/input.h>
|
||||
#include <utils/logger.h>
|
||||
#include <utils/utils.h>
|
||||
|
||||
#define TARGET_WIDTH (854)
|
||||
#define TARGET_HEIGHT (480)
|
||||
|
||||
|
||||
void printVPADButtons(VPADStatus * buffer);
|
||||
|
||||
WUPS_PLUGIN_NAME("Vpad input logger");
|
||||
WUPS_PLUGIN_DESCRIPTION("Prints information about vpad inputs and sensors");
|
||||
WUPS_PLUGIN_VERSION("v1.0");
|
||||
WUPS_PLUGIN_AUTHOR("Maschell");
|
||||
WUPS_PLUGIN_LICENSE("GPL");
|
||||
IOSHandle handles[100];
|
||||
|
||||
|
||||
struct WUT_PACKED _ACPMetaData{
|
||||
char bootmovie[80696];
|
||||
char bootlogo[28604];
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
static BOOL
|
||||
sMounted = FALSE;
|
||||
|
||||
static char
|
||||
sMountPath[128] = { 0 };
|
||||
|
||||
static FSClient
|
||||
sClient;
|
||||
|
||||
BOOL
|
||||
WHBMountSdCard()
|
||||
{
|
||||
FSCmdBlock cmd;
|
||||
FSMountSource mountSource;
|
||||
FSStatus result;
|
||||
|
||||
if (sMounted) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
FSInit();
|
||||
|
||||
result = FSAddClient(&sClient, -1);
|
||||
if (result != FS_STATUS_OK) {
|
||||
DEBUG_FUNCTION_LINE("%s: FSAddClient error %d", __FUNCTION__, result);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FSInitCmdBlock(&cmd);
|
||||
result = FSGetMountSource(&sClient, &cmd, FS_MOUNT_SOURCE_SD, &mountSource, -1);
|
||||
if (result < 0) {
|
||||
DEBUG_FUNCTION_LINE("%s: FSGetMountSource error %d", __FUNCTION__, result);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
result = FSMount(&sClient, &cmd, &mountSource, sMountPath, sizeof(sMountPath), -1);
|
||||
if (result < 0) {
|
||||
DEBUG_FUNCTION_LINE("%s: FSMount error %d", __FUNCTION__, result);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
sMounted = TRUE;
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FSDelClient(&sClient, -1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
char *
|
||||
WHBGetSdCardMountPath()
|
||||
{
|
||||
return sMountPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ON_APPLICATION_START(args) {
|
||||
socket_lib_init();
|
||||
log_init();
|
||||
WHBMountSdCard();
|
||||
DEBUG_FUNCTION_LINE("%s\n",WHBGetSdCardMountPath());
|
||||
}
|
||||
|
||||
MCPTitleListType my;
|
||||
|
||||
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(&my, &(titleList[i]),sizeof(MCPTitleListType));
|
||||
DEBUG_FUNCTION_LINE("%s \n", my.path);
|
||||
}
|
||||
}
|
||||
char * test = "/vol/external01/usr/title/00050000/101c6400";
|
||||
strcpy(my.path,test);
|
||||
my.titleId = 0x00050000101C6400;
|
||||
|
||||
memcpy(&(titleList[titlecount]), &my ,sizeof(MCPTitleListType));
|
||||
titlecount++;
|
||||
|
||||
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, ACPGetLaunchMetaData, _ACPMetaData* metadata) {
|
||||
int result = real_ACPGetLaunchMetaData(metadata);
|
||||
//DEBUG_FUNCTION_LINE("%08X = %08X \n",metadata ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, _ACPMetaXml* u1) {
|
||||
//dumpHex(u1,0x100);
|
||||
int result = real_ACPGetLaunchMetaXml(u1);
|
||||
//dumpHex(u1,0x100);
|
||||
//DEBUG_FUNCTION_LINE("%08X = %08X \n",u1 ,result);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
if(titleid_upper == 0x00050000 && titleid_lower_2 == 0x101C6400){
|
||||
memcpy(u6, &my, sizeof(MCPTitleListType));
|
||||
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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, GetTitlePackageInfos__Q2_2nn3nimFPQ3_2nn3nim16TitlePackageInfoPCULUi, uint32_t u1, uint32_t u2, uint32_t u3) {
|
||||
int result = real_GetTitlePackageInfos__Q2_2nn3nimFPQ3_2nn3nim16TitlePackageInfoPCULUi(u1, u2, u3);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X \n",u1 ,u2 ,u3 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int, FSOpenFileAsync, FSClient *pClient, FSCmdBlock *pCmd, char *path, const char *mode, int *handle, int error,FSAsyncData *asyncData) {
|
||||
|
||||
int result = real_FSOpenFileAsync(pClient, pCmd, path, mode, handle, error,asyncData);
|
||||
|
||||
DEBUG_FUNCTION_LINE("%s! Result %d\n",path,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) {
|
||||
|
||||
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 == 0x00050000 && titleid_lower == 0x101C6400){
|
||||
|
||||
out_buf->title_id = 0x000500101004e200;
|
||||
out_buf->os_version = 0x000500101000400A;
|
||||
out_buf->account_save_size = 0x0000000000040000;
|
||||
out_buf->account_boss_size = 0;
|
||||
out_buf->version = 32;
|
||||
strncpy(out_buf->product_code,"WUP-N-HAYP",10);
|
||||
strncpy(out_buf->content_platform,"WUP",3);
|
||||
|
||||
strncpy(out_buf->longname_en,"Maschell",8);
|
||||
strncpy(out_buf->shortname_ja,"Maschell",8);
|
||||
|
||||
dumpHex((void*)out_buf,0x100);
|
||||
|
||||
result = 0;
|
||||
}
|
||||
/*
|
||||
DEBUG_FUNCTION_LINE("longname_ja: %s\n", out_buf->longname_ja);
|
||||
DEBUG_FUNCTION_LINE("longname_en: %s\n", out_buf->longname_en);
|
||||
DEBUG_FUNCTION_LINE("longname_fr: %s\n", out_buf->longname_fr);
|
||||
DEBUG_FUNCTION_LINE("longname_de: %s\n", out_buf->longname_de);
|
||||
DEBUG_FUNCTION_LINE("longname_it: %s\n", out_buf->longname_it);
|
||||
DEBUG_FUNCTION_LINE("longname_es: %s\n", out_buf->longname_es);
|
||||
DEBUG_FUNCTION_LINE("longname_zhs: %s\n", out_buf->longname_zhs);
|
||||
DEBUG_FUNCTION_LINE("longname_ko: %s\n", out_buf->longname_ko);
|
||||
DEBUG_FUNCTION_LINE("longname_nl: %s\n", out_buf->longname_nl);
|
||||
DEBUG_FUNCTION_LINE("longname_pt: %s\n", out_buf->longname_pt);
|
||||
DEBUG_FUNCTION_LINE("longname_ru: %s\n", out_buf->longname_ru);
|
||||
DEBUG_FUNCTION_LINE("longname_zht: %s\n", out_buf->longname_zht);
|
||||
DEBUG_FUNCTION_LINE("shortname_ja: %s\n", out_buf->shortname_ja);
|
||||
DEBUG_FUNCTION_LINE("shortname_en: %s\n", out_buf->shortname_en);
|
||||
DEBUG_FUNCTION_LINE("shortname_fr: %s\n", out_buf->shortname_fr);
|
||||
DEBUG_FUNCTION_LINE("shortname_de: %s\n", out_buf->shortname_de);
|
||||
DEBUG_FUNCTION_LINE("shortname_it: %s\n", out_buf->shortname_it);
|
||||
DEBUG_FUNCTION_LINE("shortname_es: %s\n", out_buf->shortname_es);
|
||||
DEBUG_FUNCTION_LINE("shortname_zhs: %s\n", out_buf->shortname_zhs);
|
||||
DEBUG_FUNCTION_LINE("shortname_ko: %s\n", out_buf->shortname_ko);
|
||||
DEBUG_FUNCTION_LINE("shortname_nl: %s\n", out_buf->shortname_nl);
|
||||
DEBUG_FUNCTION_LINE("shortname_pt: %s\n", out_buf->shortname_pt);
|
||||
DEBUG_FUNCTION_LINE("shortname_ru: %s\n", out_buf->shortname_ru);
|
||||
DEBUG_FUNCTION_LINE("shortname_zht: %s\n", out_buf->shortname_zht);
|
||||
DEBUG_FUNCTION_LINE("publisher_ja: %s\n", out_buf->publisher_ja);
|
||||
DEBUG_FUNCTION_LINE("publisher_en: %s\n", out_buf->publisher_en);
|
||||
DEBUG_FUNCTION_LINE("publisher_fr: %s\n", out_buf->publisher_fr);
|
||||
DEBUG_FUNCTION_LINE("publisher_de: %s\n", out_buf->publisher_de);
|
||||
DEBUG_FUNCTION_LINE("publisher_it: %s\n", out_buf->publisher_it);
|
||||
DEBUG_FUNCTION_LINE("publisher_es: %s\n", out_buf->publisher_es);
|
||||
DEBUG_FUNCTION_LINE("publisher_zhs: %s\n", out_buf->publisher_zhs);
|
||||
DEBUG_FUNCTION_LINE("publisher_ko: %s\n", out_buf->publisher_ko);
|
||||
DEBUG_FUNCTION_LINE("publisher_nl: %s\n", out_buf->publisher_nl);
|
||||
DEBUG_FUNCTION_LINE("publisher_pt: %s\n", out_buf->publisher_pt);
|
||||
DEBUG_FUNCTION_LINE("publisher_ru: %s\n", out_buf->publisher_ru);
|
||||
DEBUG_FUNCTION_LINE("publisher_zht: %s\n", out_buf->publisher_zht);*/
|
||||
|
||||
|
||||
//DEBUG_FUNCTION_LINE("titleid: %016llX os_version;: %016llX common_save_size: %016llX account_save_size: %016llX common_boss_size: %016llX\n",
|
||||
//out_buf->titleId, out_buf->os_version,out_buf->common_save_size,out_buf->account_save_size,out_buf->common_boss_size);
|
||||
//DEBUG_FUNCTION_LINE("account_boss_size: %016llX join_game_mode_mask: %016llX version %d product_code: %s content_plattform: %s\n",out_buf->account_boss_size,out_buf->join_game_mode_mask,out_buf->version,out_buf->product_code,out_buf->content_plattform );
|
||||
DEBUG_FUNCTION_LINE("TitleID: %08X%08X res:%016llX device: %d %08X = %08X \n",titleid_upper ,titleid_lower ,out_buf->title_id , device ,u1,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaDirByDevice, uint32_t titleid_upper, uint32_t titleid_lower, char* out_buf, uint32_t size, int device) {
|
||||
int result = real_ACPGetTitleMetaDirByDevice(titleid_upper, titleid_lower, out_buf, size, device);
|
||||
|
||||
|
||||
if(titleid_upper == 0x00050000 && titleid_lower == 0x101C6400){
|
||||
DEBUG_FUNCTION_LINE("Replace\n");
|
||||
char * newPath = "/vol/external01/usr/title/00050000/101c6400/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);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DECL_FUNCTION(int32_t, _SYSLaunchTitleByPathFromLauncher, char* pathToLoad, uint32_t u2) {
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
|
||||
char * toReplace = "/vol/external01/usr/title/00050000/101c6400";
|
||||
char * newPath = "/vol/storage_mlc01/sys/title/00050010/1004e200";
|
||||
|
||||
if(strcmp(pathToLoad,toReplace) == 0){
|
||||
strcpy(pathToLoad,newPath);
|
||||
}
|
||||
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, ListTitlePackages__Q2_2nn3nimFPULUi, uint32_t u1, uint32_t u2) {
|
||||
//dumpHex((void*)u1,0x100);
|
||||
int result = real_ListTitlePackages__Q2_2nn3nimFPULUi(u1, u2);
|
||||
//dumpHex((void*)u1,0x100);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X= %08X \n",u1 ,u2,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_TitleListUpdateGetNext, uint32_t u1, uint32_t u2) {
|
||||
int result = real_MCP_TitleListUpdateGetNext(u1, u2);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X = %08X \n",u1 ,u2 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_AppTagReadWithPos, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_AppTagReadWithPos(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleSize, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_GetTitleSize(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleInfoByTitleAndIndexedDevice, 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_MCP_GetTitleInfoByTitleAndIndexedDevice(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleInfo, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_GetTitleInfo(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByTitleListType, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetTitleMetaXmlByTitleListType(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleInfoByTitleAndDeviceType, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_GetTitleInfoByTitleAndDeviceType(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleInfoOfMainApplication, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetTitleInfoOfMainApplication(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleInfoByDevice, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_GetTitleInfoByDevice(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, MCP_GetContentInfos, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_GetContentInfos(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, ACPCheckApplicationDeviceEmulation, uint32_t u1) {
|
||||
int result = real_ACPCheckApplicationDeviceEmulation(u1);
|
||||
//DEBUG_FUNCTION_LINE("%08X = %08X \n",u1 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaXml, 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_ACPGetTitleMetaXml(u1, u2, u3, u4, u5, u6, u7);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
WUPS_MUST_REPLACE(MCP_AppTagReadWithPos, WUPS_LOADER_LIBRARY_COREINIT, MCP_AppTagReadWithPos);
|
||||
WUPS_MUST_REPLACE(MCP_TitleListUpdateGetNext, WUPS_LOADER_LIBRARY_COREINIT, MCP_TitleListUpdateGetNext);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleInfoByDevice, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleInfoByDevice);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleSize, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleSize);
|
||||
WUPS_MUST_REPLACE(MCP_GetContentInfos, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetContentInfos);
|
||||
WUPS_MUST_REPLACE(MCP_TitleList, WUPS_LOADER_LIBRARY_COREINIT, MCP_TitleList);
|
||||
WUPS_MUST_REPLACE(MCP_TitleListByAppType, WUPS_LOADER_LIBRARY_COREINIT, MCP_TitleListByAppType);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleInfoByTitleAndDevice, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleInfoByTitleAndDevice);
|
||||
WUPS_MUST_REPLACE(ACPGetTitleMetaXmlByTitleListType , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaXmlByTitleListType );
|
||||
WUPS_MUST_REPLACE(ACPCheckTitleLaunchByTitleListType , WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckTitleLaunchByTitleListType );
|
||||
WUPS_MUST_REPLACE(ACPGetTitleMetaXmlByDevice , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaXmlByDevice );
|
||||
WUPS_MUST_REPLACE(ACPGetTitleMetaDirByDevice , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaDirByDevice );
|
||||
WUPS_MUST_REPLACE(ACPCheckApplicationDeviceEmulation , WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckApplicationDeviceEmulation );
|
||||
WUPS_MUST_REPLACE(ACPGetTitleInfoOfMainApplication , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleInfoOfMainApplication );
|
||||
WUPS_MUST_REPLACE(_SYSLaunchTitleByPathFromLauncher, WUPS_LOADER_LIBRARY_SYSAPP, _SYSLaunchTitleByPathFromLauncher);
|
||||
|
||||
|
||||
|
||||
//WUPS_MUST_REPLACE( OSSendMessage , WUPS_LOADER_LIBRARY_COREINIT, OSSendMessage );
|
||||
//WUPS_MUST_REPLACE(GetNumTitlePackages__Q2_2nn3nimFv , WUPS_LOADER_LIBRARY_NN_NIM, GetNumTitlePackages__Q2_2nn3nimFv );
|
||||
//WUPS_MUST_REPLACE(ListTitlePackages__Q2_2nn3nimFPULUi , WUPS_LOADER_LIBRARY_NN_NIM, ListTitlePackages__Q2_2nn3nimFPULUi );
|
||||
//WUPS_MUST_REPLACE(GetTitlePackageInfos__Q2_2nn3nimFPQ3_2nn3nim16TitlePackageInfoPCULUi , WUPS_LOADER_LIBRARY_NN_NIM, GetTitlePackageInfos__Q2_2nn3nimFPQ3_2nn3nim16TitlePackageInfoPCULUi );
|
||||
//WUPS_MUST_REPLACE(IOS_Open , WUPS_LOADER_LIBRARY_COREINIT, IOS_Open );
|
||||
//WUPS_MUST_REPLACE(ACPCheckPreOrderTitle , WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckPreOrderTitle );
|
||||
WUPS_MUST_REPLACE(ACPGetLaunchMetaXml , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetLaunchMetaXml );
|
||||
//WUPS_MUST_REPLACE(CheckTitleLaunchByTitleListType__Q2_2nn3acpFPC17MCP_TitleListTypePC13ACPPCAuthInfo , WUPS_LOADER_LIBRARY_NN_ACP, CheckTitleLaunchByTitleListType__Q2_2nn3acpFPC17MCP_TitleListTypePC13ACPPCAuthInfo );
|
||||
//WUPS_MUST_REPLACE(MCP_GetOverlayAppInfo , WUPS_LOADER_LIBRARY_COREINIT, MCP_GetOverlayAppInfo );
|
||||
//WUPS_MUST_REPLACE(ACPGetSaveDataTitleIdList , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetSaveDataTitleIdList );
|
||||
//WUPS_MUST_REPLACE(ACPGetTitleCmpTitleId , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleCmpTitleId );
|
||||
//WUPS_MUST_REPLACE(ACPGetTitleSaveDir , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleSaveDir );
|
||||
//WUPS_MUST_REPLACE(ACPGetTitleSaveDirEx , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleSaveDirEx );
|
||||
WUPS_MUST_REPLACE(ACPGetTitleMetaXml , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaXml );
|
||||
//WUPS_MUST_REPLACE(ACPGetTitleSaveMetaXml , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleSaveMetaXml );
|
||||
//WUPS_MUST_REPLACE(ACPGetApplicationBox , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetApplicationBox );
|
||||
//WUPS_MUST_REPLACE(ACPGetTitleInfoOfMainApplication , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleInfoOfMainApplication );
|
||||
//WUPS_MUST_REPLACE(ACPGetTitleMetaDir , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaDir );
|
||||
WUPS_MUST_REPLACE(ACPGetLaunchMetaData , WUPS_LOADER_LIBRARY_NN_ACP, ACPGetLaunchMetaData );
|
||||
//WUPS_MUST_REPLACE(ACPCheckTitleLaunchEx , WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckTitleLaunchEx );
|
||||
//WUPS_MUST_REPLACE(ACPCheckTitleLaunchByTitleListTypeEx , WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckTitleLaunchByTitleListTypeEx );
|
||||
//WUPS_MUST_REPLACE(ACPCheckTitleLaunch , WUPS_LOADER_LIBRARY_NN_ACP, ACPCheckTitleLaunch );
|
||||
//WUPS_MUST_REPLACE(GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL , WUPS_LOADER_LIBRARY_NN_SL, GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL );
|
||||
//WUPS_MUST_REPLACE(MCP_PatchCheckTitleVersion , WUPS_LOADER_LIBRARY_COREINIT, MCP_PatchCheckTitleVersion );
|
||||
//WUPS_MUST_REPLACE(MCP_DeviceList , WUPS_LOADER_LIBRARY_COREINIT, MCP_DeviceList );
|
||||
//WUPS_MUST_REPLACE(MCP_FullDeviceList , WUPS_LOADER_LIBRARY_COREINIT, MCP_FullDeviceList );
|
||||
//WUPS_MUST_REPLACE(MCP_GetTitleId , WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleId );
|
||||
//WUPS_MUST_REPLACE(MCP_Open, WUPS_LOADER_LIBRARY_COREINIT, MCP_Open);
|
||||
//WUPS_MUST_REPLACE(IOS_Ioctl, WUPS_LOADER_LIBRARY_COREINIT, IOS_Ioctl);
|
||||
WUPS_MUST_REPLACE(FSOpenFileAsync, WUPS_LOADER_LIBRARY_COREINIT, FSOpenFileAsync);
|
||||
//WUPS_MUST_REPLACE(MCP_UpdateSetUpdater, WUPS_LOADER_LIBRARY_COREINIT, MCP_UpdateSetUpdater);
|
||||
//WUPS_MUST_REPLACE(MCP_PreloadTitleFolder, WUPS_LOADER_LIBRARY_COREINIT, MCP_PreloadTitleFolder);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleInfo, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleInfo);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleInfoByTitleAndIndexedDevice, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleInfoByTitleAndIndexedDevice);
|
||||
WUPS_MUST_REPLACE(MCP_GetTitleInfoByTitleAndDeviceType, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetTitleInfoByTitleAndDeviceType);
|
||||
//WUPS_MUST_REPLACE(MCP_GetInstalledTitleVersion, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetInstalledTitleVersion);
|
||||
//WUPS_MUST_REPLACE(SYSCheckTitleExists, WUPS_LOADER_LIBRARY_SYSAPP, SYSCheckTitleExists);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
DECL_FUNCTION(IOSHandle, MCP_Open,void){
|
||||
IOSHandle result = real_MCP_Open();
|
||||
DEBUG_FUNCTION_LINE("%08X \n",result);
|
||||
|
||||
for(int i = 0;i<100;i++){
|
||||
if(handles[i] == 0){
|
||||
handles[i] = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_DeviceList , uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_DeviceList(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_GetTitleId , uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_GetTitleId(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_PreloadTitleFolder, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_PreloadTitleFolder(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_UpdateSetUpdater, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_UpdateSetUpdater(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, SYSCheckTitleExists, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_SYSCheckTitleExists(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, MCP_PatchCheckTitleVersion, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_PatchCheckTitleVersion(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_GetLaunchInfoById__Q3_2nn2sl18LaunchInfoDatabaseCFPQ3_2nn2sl10LaunchInfoUL(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPCheckTitleLaunch, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPCheckTitleLaunch(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, MCP_GetOverlayAppInfo, 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_MCP_GetOverlayAppInfo(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPCheckTitleLaunchByTitleListTypeEx, 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_ACPCheckTitleLaunchByTitleListTypeEx(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, MCP_FullDeviceList, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_MCP_FullDeviceList(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
DECL_FUNCTION(int32_t, ACPCheckTitleLaunchEx, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPCheckTitleLaunchEx(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, ACPGetLaunchMetaData, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetLaunchMetaData(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleSaveMetaXml, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetTitleSaveMetaXml(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleSaveDir, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetTitleSaveDir(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}DECL_FUNCTION(int32_t, ACPGetTitleSaveDirEx, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetTitleSaveDirEx(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}DECL_FUNCTION(int32_t, ACPGetTitleCmpTitleId, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetTitleCmpTitleId(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}DECL_FUNCTION(int32_t, ACPGetSaveDataTitleIdList, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetSaveDataTitleIdList(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, uint32_t u1, uint32_t u2, uint32_t u3, uint32_t u4, uint32_t u5, uint32_t u6, uint32_t u7) {
|
||||
int result = real_ACPGetLaunchMetaXml(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}DECL_FUNCTION(int32_t, ACPCheckPreOrderTitle, 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_ACPCheckPreOrderTitle(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, CheckTitleLaunchByTitleListType__Q2_2nn3acpFPC17MCP_TitleListTypePC13ACPPCAuthInfo, 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_CheckTitleLaunchByTitleListType__Q2_2nn3acpFPC17MCP_TitleListTypePC13ACPPCAuthInfo(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, GetNumTitlePackages__Q2_2nn3nimFv, 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_GetNumTitlePackages__Q2_2nn3nimFv(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, MCP_GetInstalledTitleVersion, 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_MCP_GetInstalledTitleVersion(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, ACPGetApplicationBox, 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_ACPGetApplicationBox(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, ACPGetTitleMetaDir, 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_ACPGetTitleMetaDir(u1, u2, u3, u4, u5, u6, u7);
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,u4 ,u5 ,u6 ,u7 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, OSSendMessage, OSMessageQueue * u1, OSMessage * u2, OSMessageFlags u3) {
|
||||
int result = real_OSSendMessage(u1, u2, u3);
|
||||
//DEBUG_FUNCTION_LINE("%08X %08X %08X = %08X \n",u1 ,u2 ,u3 ,result);
|
||||
return result;
|
||||
}
|
||||
DECL_FUNCTION(int32_t, IOS_Open, char * path, int a) {
|
||||
int result = real_IOS_Open(path,a);
|
||||
DEBUG_FUNCTION_LINE("%s %d = %08X \n",path,a,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DECL_FUNCTION(IOSError, IOS_Ioctl, IOSHandle handle, uint32_t request, void *inBuf, uint32_t inLen, void *outBuf, uint32_t outLen){
|
||||
int result = real_IOS_Ioctl(handle, request, inBuf, inLen, outBuf, outLen);
|
||||
|
||||
for(int i = 0;i<100;i++){
|
||||
if(handles[i] == handle){
|
||||
DEBUG_FUNCTION_LINE("%08X %08X %08X %08X %08X %08X %08X = %08X \n",handle ,request ,inBuf ,inLen ,outBuf ,outLen,result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//DEBUG_FUNCTION_LINE("OTHER %08X %08X %08X %08X %08X %08X %08X = %08X \n",handle ,request ,inBuf ,inLen ,outBuf ,outLen,result);
|
||||
|
||||
|
||||
return (IOSError)result;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
211
src/utils/StringTools.cpp
Normal file
211
src/utils/StringTools.cpp
Normal file
@ -0,0 +1,211 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* 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.
|
||||
*
|
||||
* for WiiXplorer 2010
|
||||
***************************************************************************/
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>
|
||||
#include <strings.h>
|
||||
#include <wut_types.h>
|
||||
#include <stdio.h>
|
||||
#include <utils/StringTools.h>
|
||||
|
||||
|
||||
BOOL StringTools::EndsWith(const std::string& a, const std::string& b) {
|
||||
if (b.size() > a.size())
|
||||
return false;
|
||||
return std::equal(a.begin() + a.size() - b.size(), a.end(), b.begin());
|
||||
}
|
||||
|
||||
const char * StringTools::byte_to_binary(int32_t x) {
|
||||
static char b[9];
|
||||
b[0] = '\0';
|
||||
|
||||
int32_t z;
|
||||
for (z = 128; z > 0; z >>= 1) {
|
||||
strcat(b, ((x & z) == z) ? "1" : "0");
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
std::string StringTools::removeCharFromString(std::string& input,char toBeRemoved) {
|
||||
std::string output = input;
|
||||
size_t position;
|
||||
while(1) {
|
||||
position = output.find(toBeRemoved);
|
||||
if(position == std::string::npos)
|
||||
break;
|
||||
output.erase(position, 1);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
const char * StringTools::fmt(const char * format, ...) {
|
||||
static char strChar[512];
|
||||
strChar[0] = 0;
|
||||
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(strChar, format, va) >= 0)) {
|
||||
va_end(va);
|
||||
return (const char *) strChar;
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const wchar_t * StringTools::wfmt(const char * format, ...) {
|
||||
static char tmp[512];
|
||||
static wchar_t strWChar[512];
|
||||
strWChar[0] = 0;
|
||||
tmp[0] = 0;
|
||||
|
||||
if(!format)
|
||||
return (const wchar_t *) strWChar;
|
||||
|
||||
if(strcmp(format, "") == 0)
|
||||
return (const wchar_t *) strWChar;
|
||||
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(tmp, format, va) >= 0)) {
|
||||
int bt;
|
||||
int32_t strlength = strlen(tmp);
|
||||
bt = mbstowcs(strWChar, tmp, (strlength < 512) ? strlength : 512 );
|
||||
|
||||
if(bt > 0) {
|
||||
strWChar[bt] = 0;
|
||||
return (const wchar_t *) strWChar;
|
||||
}
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int32_t StringTools::strprintf(std::string &str, const char * format, ...) {
|
||||
static char tmp[512];
|
||||
tmp[0] = 0;
|
||||
int32_t result = 0;
|
||||
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(tmp, format, va) >= 0)) {
|
||||
str = tmp;
|
||||
result = str.size();
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string StringTools::strfmt(const char * format, ...) {
|
||||
std::string str;
|
||||
static char tmp[512];
|
||||
tmp[0] = 0;
|
||||
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(tmp, format, va) >= 0)) {
|
||||
str = tmp;
|
||||
}
|
||||
va_end(va);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
BOOL StringTools::char2wchar_t(const char * strChar, wchar_t * dest) {
|
||||
if(!strChar || !dest)
|
||||
return false;
|
||||
|
||||
int bt;
|
||||
bt = mbstowcs(dest, strChar, strlen(strChar));
|
||||
if (bt > 0) {
|
||||
dest[bt] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t StringTools::strtokcmp(const char * string, const char * compare, const char * separator) {
|
||||
if(!string || !compare)
|
||||
return -1;
|
||||
|
||||
char TokCopy[512];
|
||||
strncpy(TokCopy, compare, sizeof(TokCopy));
|
||||
TokCopy[511] = '\0';
|
||||
|
||||
char * strTok = strtok(TokCopy, separator);
|
||||
|
||||
while (strTok != NULL) {
|
||||
if (strcasecmp(string, strTok) == 0) {
|
||||
return 0;
|
||||
}
|
||||
strTok = strtok(NULL,separator);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t StringTools::strextcmp(const char * string, const char * extension, char seperator) {
|
||||
if(!string || !extension)
|
||||
return -1;
|
||||
|
||||
char *ptr = strrchr(string, seperator);
|
||||
if(!ptr)
|
||||
return -1;
|
||||
|
||||
return strcasecmp(ptr + 1, extension);
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> StringTools::stringSplit(const std::string & inValue, const std::string & splitter) {
|
||||
std::string value = inValue;
|
||||
std::vector<std::string> result;
|
||||
while (true) {
|
||||
uint32_t index = value.find(splitter);
|
||||
if (index == std::string::npos) {
|
||||
result.push_back(value);
|
||||
break;
|
||||
}
|
||||
std::string first = value.substr(0, index);
|
||||
result.push_back(first);
|
||||
if (index + splitter.size() == value.length()) {
|
||||
result.push_back("");
|
||||
break;
|
||||
}
|
||||
if(index + splitter.size() > value.length()) {
|
||||
break;
|
||||
}
|
||||
value = value.substr(index + splitter.size(), value.length());
|
||||
}
|
||||
return result;
|
||||
}
|
80
src/utils/StringTools.h
Normal file
80
src/utils/StringTools.h
Normal file
@ -0,0 +1,80 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010
|
||||
* 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.
|
||||
*
|
||||
* for WiiXplorer 2010
|
||||
***************************************************************************/
|
||||
#ifndef __STRING_TOOLS_H
|
||||
#define __STRING_TOOLS_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <wut_types.h>
|
||||
|
||||
class StringTools {
|
||||
public:
|
||||
static BOOL EndsWith(const std::string& a, const std::string& b);
|
||||
static const char * byte_to_binary(int32_t x);
|
||||
static std::string removeCharFromString(std::string& input,char toBeRemoved);
|
||||
static const char * fmt(const char * format, ...);
|
||||
static const wchar_t * wfmt(const char * format, ...);
|
||||
static int32_t strprintf(std::string &str, const char * format, ...);
|
||||
static std::string strfmt(const char * format, ...);
|
||||
static BOOL char2wchar_t(const char * src, wchar_t * dest);
|
||||
static int32_t strtokcmp(const char * string, const char * compare, const char * separator);
|
||||
static int32_t strextcmp(const char * string, const char * extension, char seperator);
|
||||
|
||||
static const char * FullpathToFilename(const char *path) {
|
||||
if(!path)
|
||||
return path;
|
||||
|
||||
const char * ptr = path;
|
||||
const char * Filename = ptr;
|
||||
|
||||
while(*ptr != '\0') {
|
||||
if(ptr[0] == '/' && ptr[1] != '\0')
|
||||
Filename = ptr+1;
|
||||
|
||||
++ptr;
|
||||
}
|
||||
|
||||
return Filename;
|
||||
}
|
||||
|
||||
static void RemoveDoubleSlashs(std::string &str) {
|
||||
uint32_t length = str.size();
|
||||
|
||||
//! clear path of double slashes
|
||||
for(uint32_t i = 1; i < length; ++i) {
|
||||
if(str[i-1] == '/' && str[i] == '/') {
|
||||
str.erase(i, 1);
|
||||
i--;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static std::vector<std::string> stringSplit(const std::string & value, const std::string & splitter);
|
||||
};
|
||||
|
||||
#endif /* __STRING_TOOLS_H */
|
||||
|
82
src/utils/logger.c
Normal file
82
src/utils/logger.c
Normal file
@ -0,0 +1,82 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <utils/logger.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#include <coreinit/debug.h>
|
||||
|
||||
#include <coreinit/systeminfo.h>
|
||||
#include <coreinit/thread.h>
|
||||
|
||||
static int log_socket __attribute__((section(".data")))= -1;
|
||||
static struct sockaddr_in connect_addr __attribute__((section(".data")));
|
||||
static volatile int log_lock __attribute__((section(".data"))) = 0;
|
||||
|
||||
void log_init_() {
|
||||
int broadcastEnable = 1;
|
||||
log_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (log_socket < 0)
|
||||
return;
|
||||
|
||||
setsockopt(log_socket, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));
|
||||
|
||||
memset(&connect_addr, 0, sizeof(struct sockaddr_in));
|
||||
connect_addr.sin_family = AF_INET;
|
||||
connect_addr.sin_port = 4405;
|
||||
connect_addr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
|
||||
}
|
||||
|
||||
void log_print_(const char *str) {
|
||||
// socket is always 0 initially as it is in the BSS
|
||||
if(log_socket < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while(log_lock)
|
||||
OSSleepTicks(OSMicrosecondsToTicks(1000));
|
||||
log_lock = 1;
|
||||
|
||||
int len = strlen(str);
|
||||
int ret;
|
||||
while (len > 0) {
|
||||
int block = len < 1400 ? len : 1400; // take max 1400 bytes per UDP packet
|
||||
ret = sendto(log_socket, str, block, 0, (struct sockaddr *)&connect_addr, sizeof(struct sockaddr_in));
|
||||
if(ret < 0)
|
||||
break;
|
||||
|
||||
len -= ret;
|
||||
str += ret;
|
||||
}
|
||||
|
||||
log_lock = 0;
|
||||
}
|
||||
|
||||
void OSFatal_printf(const char *format, ...) {
|
||||
char tmp[512];
|
||||
tmp[0] = 0;
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(tmp, format, va) >= 0)) {
|
||||
OSFatal(tmp);
|
||||
}
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
void log_printf_(const char *format, ...) {
|
||||
if(log_socket < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char tmp[512];
|
||||
tmp[0] = 0;
|
||||
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
if((vsprintf(tmp, format, va) >= 0)) {
|
||||
log_print_(tmp);
|
||||
}
|
||||
va_end(va);
|
||||
}
|
||||
|
38
src/utils/logger.h
Normal file
38
src/utils/logger.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef __LOGGER_H_
|
||||
#define __LOGGER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void log_init_();
|
||||
//void log_deinit_(void);
|
||||
void log_print_(const char *str);
|
||||
void log_printf_(const char *format, ...);
|
||||
void OSFatal_printf(const char *format, ...);
|
||||
|
||||
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
|
||||
|
||||
#define OSFATAL_FUNCTION_LINE(FMT, ARGS...)do { \
|
||||
OSFatal_printf("[%s]%s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
#define log_init() log_init_()
|
||||
//#define log_deinit() log_deinit_()
|
||||
#define log_print(str) log_print_(str)
|
||||
#define log_printf(FMT, ARGS...) log_printf_(FMT, ## ARGS);
|
||||
|
||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
|
||||
log_printf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
41
src/utils/utils.c
Normal file
41
src/utils/utils.c
Normal file
@ -0,0 +1,41 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <utils/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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
src/utils/utils.h
Normal file
35
src/utils/utils.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef __UTILS_H_
|
||||
#define __UTILS_H_
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIMIT(x, min, max) \
|
||||
({ \
|
||||
typeof( x ) _x = x; \
|
||||
typeof( min ) _min = min; \
|
||||
typeof( max ) _max = max; \
|
||||
( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \
|
||||
})
|
||||
|
||||
#define DegToRad(a) ( (a) * 0.01745329252f )
|
||||
#define RadToDeg(a) ( (a) * 57.29577951f )
|
||||
|
||||
#define ALIGN4(x) (((x) + 3) & ~3)
|
||||
#define ALIGN32(x) (((x) + 31) & ~31)
|
||||
|
||||
#define le16(i) ((((uint16_t) ((i) & 0xFF)) << 8) | ((uint16_t) (((i) & 0xFF00) >> 8)))
|
||||
#define le32(i) ((((uint32_t)le16((i) & 0xFFFF)) << 16) | ((uint32_t)le16(((i) & 0xFFFF0000) >> 16)))
|
||||
#define le64(i) ((((uint64_t)le32((i) & 0xFFFFFFFFLL)) << 32) | ((uint64_t)le32(((i) & 0xFFFFFFFF00000000LL) >> 32)))
|
||||
|
||||
//Needs to have log_init() called beforehand.
|
||||
void dumpHex(const void* data, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __UTILS_H_
|
Loading…
Reference in New Issue
Block a user