├── .github └── workflows │ └── main.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── SysCheckME ├── icon.png └── meta.xml ├── Version.txt ├── data ├── Checkicon.png ├── Deleteicon.png ├── Refreshicon.png ├── WiiButtonA.png ├── WiiButtonHome.png ├── WiiButtonMinus.png ├── WiiButtonPlus.png ├── WiiDpadLeft.png ├── WiiDpadRight.png ├── background.png ├── loadingbarblue.png ├── loadingbargrey.png ├── tahoma.ttf ├── ticket.dat ├── tmd.dat └── window.png ├── include ├── SysMenuInfo.h ├── fatMounter.h ├── gecko.h ├── gui.h ├── http.h ├── languages.h ├── mload.h ├── runtimeiospatch.h ├── sha1.h ├── ssl.h ├── sys.h ├── title.h ├── tmdIdentification.h ├── tools.h ├── update.h └── wiibasics.h ├── libs ├── include │ ├── CheckRegion.h │ ├── bzlib.h │ ├── freetype2 │ │ ├── freetype │ │ │ ├── config │ │ │ │ ├── ftconfig.h │ │ │ │ ├── ftheader.h │ │ │ │ ├── ftmodule.h │ │ │ │ ├── ftoption.h │ │ │ │ └── ftstdlib.h │ │ │ ├── freetype.h │ │ │ ├── ftadvanc.h │ │ │ ├── ftbbox.h │ │ │ ├── ftbdf.h │ │ │ ├── ftbitmap.h │ │ │ ├── ftbzip2.h │ │ │ ├── ftcache.h │ │ │ ├── ftchapters.h │ │ │ ├── ftcid.h │ │ │ ├── ftdriver.h │ │ │ ├── fterrdef.h │ │ │ ├── fterrors.h │ │ │ ├── ftfntfmt.h │ │ │ ├── ftgasp.h │ │ │ ├── ftglyph.h │ │ │ ├── ftgxval.h │ │ │ ├── ftgzip.h │ │ │ ├── ftimage.h │ │ │ ├── ftincrem.h │ │ │ ├── ftlcdfil.h │ │ │ ├── ftlist.h │ │ │ ├── ftlzw.h │ │ │ ├── ftmac.h │ │ │ ├── ftmm.h │ │ │ ├── ftmodapi.h │ │ │ ├── ftmoderr.h │ │ │ ├── ftotval.h │ │ │ ├── ftoutln.h │ │ │ ├── ftparams.h │ │ │ ├── ftpfr.h │ │ │ ├── ftrender.h │ │ │ ├── ftsizes.h │ │ │ ├── ftsnames.h │ │ │ ├── ftstroke.h │ │ │ ├── ftsynth.h │ │ │ ├── ftsystem.h │ │ │ ├── fttrigon.h │ │ │ ├── fttypes.h │ │ │ ├── ftwinfnt.h │ │ │ ├── t1tables.h │ │ │ ├── ttnameid.h │ │ │ ├── tttables.h │ │ │ └── tttags.h │ │ └── ft2build.h │ ├── grrlib.h │ ├── grrlib │ │ ├── GRRLIB__inline.h │ │ ├── GRRLIB__lib.h │ │ ├── GRRLIB_cExtn.h │ │ ├── GRRLIB_clipping.h │ │ ├── GRRLIB_collision.h │ │ ├── GRRLIB_fbComplex.h │ │ ├── GRRLIB_fbGX.h │ │ ├── GRRLIB_fbSimple.h │ │ ├── GRRLIB_handle.h │ │ ├── GRRLIB_pixel.h │ │ ├── GRRLIB_private.h │ │ ├── GRRLIB_settings.h │ │ ├── GRRLIB_texSetup.h │ │ └── GRRLIB_ttf.h │ ├── jconfig.h │ ├── jerror.h │ ├── jmorecfg.h │ ├── jpeglib.h │ ├── png.h │ ├── pngconf.h │ ├── pnglibconf.h │ ├── pngu.h │ ├── turbojpeg.h │ ├── zconf.h │ └── zlib.h └── lib │ ├── libCheckRegion.a │ ├── libbz2.a │ ├── libfreetype.a │ ├── libgrrlib.a │ ├── libjpeg.a │ ├── libpng.a │ ├── libpngu.a │ ├── libturbojpeg.a │ └── libz.a └── source ├── SysMenuInfo.c ├── fatMounter.c ├── gecko.c ├── gui.c ├── http.c ├── languages.c ├── mload.c ├── runtimeiospatch.c ├── sha1.c ├── ssl.c ├── sys.c ├── sysCheck.c ├── title.c ├── tmdIdentification.c ├── tools.c ├── update.c ├── upload.c └── wiibasics.c /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build binaries 2 | 3 | on: 4 | push: 5 | branches: 6 | - "**" 7 | paths-ignore: 8 | - '**.md' 9 | - '.github/ISSUE_TEMPLATE/**' 10 | - '.github/FUNDING.yml' 11 | - '.github/**/*.md' 12 | pull_request: 13 | paths-ignore: 14 | - '**.md' 15 | - '.github/ISSUE_TEMPLATE/**' 16 | - '.github/FUNDING.yml' 17 | - '.github/**/*.md' 18 | 19 | jobs: 20 | build: 21 | runs-on: ubuntu-latest 22 | container: devkitpro/devkitppc:20230110 23 | steps: 24 | - uses: actions/checkout@v3 25 | 26 | - name: Compile 27 | run: make 28 | 29 | - name: Package 30 | run: | 31 | mkdir -p upload/apps/SysCheckME 32 | cp boot.dol upload/apps/SysCheckME 33 | cp SysCheckME/icon.png upload/apps/SysCheckME 34 | cp SysCheckME/meta.xml upload/apps/SysCheckME 35 | echo "sha=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV 36 | 37 | - name: Upload artifact 38 | uses: actions/upload-artifact@v3 39 | with: 40 | name: SysCheckME-${{ env.sha }} 41 | path: upload 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all of this stuff... 2 | *.bat 3 | *.dol 4 | *.elf 5 | *.exe 6 | *.zip 7 | *.7z 8 | .vs/ 9 | .vscode/ 10 | build/ 11 | /wiiload 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | # Clear the implicit built in rules 3 | #--------------------------------------------------------------------------------- 4 | .SUFFIXES: 5 | #--------------------------------------------------------------------------------- 6 | ifeq ($(strip $(DEVKITPPC)),) 7 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 8 | endif 9 | 10 | include $(DEVKITPPC)/wii_rules 11 | 12 | #--------------------------------------------------------------------------------- 13 | # TARGET is the name of the output 14 | # BUILD is the directory where object files & intermediate files will be placed 15 | # SOURCES is a list of directories containing source code 16 | # INCLUDES is a list of directories containing extra header files 17 | #--------------------------------------------------------------------------------- 18 | TARGET := boot 19 | BUILD := build 20 | SOURCES := source 21 | DATA := data 22 | INCLUDES := include 23 | 24 | #--------------------------------------------------------------------------------- 25 | # options for code generation 26 | #--------------------------------------------------------------------------------- 27 | 28 | CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE 29 | CXXFLAGS = $(CFLAGS) 30 | LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map 31 | 32 | #--------------------------------------------------------------------------------- 33 | # any extra libraries we wish to link with the project 34 | #--------------------------------------------------------------------------------- 35 | LIBS := -lgrrlib -lfreetype -lbz2 -lpngu -lpng -ljpeg -lz -lfat -ldi -lwiiuse \ 36 | -lbte -logc -lm -lCheckRegion 37 | 38 | #--------------------------------------------------------------------------------- 39 | # list of directories containing libraries, this must be the top level containing 40 | # include and lib 41 | #--------------------------------------------------------------------------------- 42 | LIBDIRS := $(PORTLIBS) 43 | LIBDIRS += LIBDIRS := $(CURDIR)/libs 44 | 45 | #--------------------------------------------------------------------------------- 46 | # no real need to edit anything past this point unless you need to add additional 47 | # rules for different file extensions 48 | #--------------------------------------------------------------------------------- 49 | ifneq ($(BUILD),$(notdir $(CURDIR))) 50 | #--------------------------------------------------------------------------------- 51 | 52 | export OUTPUT := $(CURDIR)/$(TARGET) 53 | 54 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 55 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 56 | 57 | export DEPSDIR := $(CURDIR)/$(BUILD) 58 | 59 | #--------------------------------------------------------------------------------- 60 | # automatically build a list of object files for our project 61 | #--------------------------------------------------------------------------------- 62 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 63 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 64 | sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 65 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) 66 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 67 | 68 | #--------------------------------------------------------------------------------- 69 | # use CXX for linking C++ projects, CC for standard C 70 | #--------------------------------------------------------------------------------- 71 | ifeq ($(strip $(CPPFILES)),) 72 | export LD := $(CC) 73 | else 74 | export LD := $(CXX) 75 | endif 76 | 77 | export OFILES := $(addsuffix .o,$(BINFILES)) \ 78 | $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ 79 | $(sFILES:.s=.o) $(SFILES:.S=.o) 80 | 81 | #--------------------------------------------------------------------------------- 82 | # build a list of include paths 83 | #--------------------------------------------------------------------------------- 84 | export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ 85 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 86 | -I$(CURDIR)/$(BUILD) \ 87 | -I$(LIBOGC_INC) 88 | 89 | #--------------------------------------------------------------------------------- 90 | # build a list of library paths 91 | #--------------------------------------------------------------------------------- 92 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ 93 | -L$(LIBOGC_LIB) 94 | 95 | export OUTPUT := $(CURDIR)/$(TARGET) 96 | .PHONY: $(BUILD) clean 97 | 98 | #--------------------------------------------------------------------------------- 99 | $(BUILD): 100 | @[ -d $@ ] || mkdir -p $@ 101 | @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 102 | 103 | #--------------------------------------------------------------------------------- 104 | clean: 105 | @echo clean ... 106 | @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol 107 | 108 | #--------------------------------------------------------------------------------- 109 | run: 110 | wiiload $(TARGET).dol 111 | 112 | #--------------------------------------------------------------------------------- 113 | else 114 | 115 | DEPENDS := $(OFILES:.o=.d) 116 | 117 | #--------------------------------------------------------------------------------- 118 | # main targets 119 | #--------------------------------------------------------------------------------- 120 | $(OUTPUT).dol: $(OUTPUT).elf 121 | $(OUTPUT).elf: $(OFILES) 122 | 123 | #--------------------------------------------------------------------------------- 124 | # This rule links in binary data with the .jpg extension 125 | #--------------------------------------------------------------------------------- 126 | %.ttf.o : %.ttf 127 | @echo $(notdir $<) 128 | $(bin2o) 129 | 130 | %.png.o : %.png 131 | @echo $(notdir $<) 132 | $(bin2o) 133 | 134 | %.dat.o : %.dat 135 | @echo $(notdir $<) 136 | $(bin2o) 137 | 138 | -include $(DEPENDS) 139 | 140 | #--------------------------------------------------------------------------------- 141 | endif 142 | #--------------------------------------------------------------------------------- 143 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SysCheck-ModMii-Edition 2 | 3 | Homebrew application which does several checks on installed IOS and custom IOS: 4 | - Base IOS Detection 5 | - vIOS Detection 6 | - Beer Ticket 7 | - IOS Stub 8 | - Fake Signature (aka Trucha Bug) 9 | - ES_DiVerify (aka ES_Identify) 10 | - Flash Access 11 | - NAND Access 12 | - Boot2 Access 13 | - USB 2.0 14 | 15 | SysCheck generates a report on the root of your storage device (e.g. usb:/SysCheck.csv). 16 | 17 | **The author can not be held responsible for any damage SysCheck might cause!** 18 | -------------------------------------------------------------------------------- /SysCheckME/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/SysCheckME/icon.png -------------------------------------------------------------------------------- /SysCheckME/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SysCheck ModMii Edition 4 | blackb0x, JoostinOnline, Double_A, R2-D2199, Nano 5 | 2.5.0 6 | 20230309000000 7 | System Checker ModMii Edition 8 | Homebrew application which does several checks on installed IOS and custom IOS: 9 | - Base IOS Detection 10 | - vIOS Detection 11 | - Beer Ticket 12 | - IOS Stub 13 | - Fake Signature (aka Trucha Bug) 14 | - ES_DiVerify (aka ES_Identify) 15 | - Flash Access 16 | - NAND Access 17 | - Boot2 Access 18 | - USB 2.0 19 | 20 | SysCheck generates a report on the root of your storage device (e.g. usb:/SysCheck.csv). 21 | 22 | The author can not be held responsible for any damage SysCheck might cause! 23 | 24 | --debug=false 25 | --forceNoAHBPROT=false 26 | --skipIOS=0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Version.txt: -------------------------------------------------------------------------------- 1 | Version=52 -------------------------------------------------------------------------------- /data/Checkicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/Checkicon.png -------------------------------------------------------------------------------- /data/Deleteicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/Deleteicon.png -------------------------------------------------------------------------------- /data/Refreshicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/Refreshicon.png -------------------------------------------------------------------------------- /data/WiiButtonA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/WiiButtonA.png -------------------------------------------------------------------------------- /data/WiiButtonHome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/WiiButtonHome.png -------------------------------------------------------------------------------- /data/WiiButtonMinus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/WiiButtonMinus.png -------------------------------------------------------------------------------- /data/WiiButtonPlus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/WiiButtonPlus.png -------------------------------------------------------------------------------- /data/WiiDpadLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/WiiDpadLeft.png -------------------------------------------------------------------------------- /data/WiiDpadRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/WiiDpadRight.png -------------------------------------------------------------------------------- /data/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/background.png -------------------------------------------------------------------------------- /data/loadingbarblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/loadingbarblue.png -------------------------------------------------------------------------------- /data/loadingbargrey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/loadingbargrey.png -------------------------------------------------------------------------------- /data/tahoma.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/tahoma.ttf -------------------------------------------------------------------------------- /data/ticket.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/ticket.dat -------------------------------------------------------------------------------- /data/tmd.dat: -------------------------------------------------------------------------------- 1 | Root-CA00000001-CP00000004 -------------------------------------------------------------------------------- /data/window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/data/window.png -------------------------------------------------------------------------------- /include/SysMenuInfo.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | detect_settings.h -- detects various system settings 4 | 5 | Copyright (C) 2008 tona 6 | Copyright (C) 2014 JoostinOnline 7 | Unless other credit specified 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1.The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2.Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3.This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | -------------------------------------------------------------*/ 29 | 30 | #ifndef __SYSMENUINFO_H__ 31 | #define __SYSMENUINFO_H__ 32 | 33 | 34 | #define SADR_LENGTH 0x1007+1 35 | #define round_up(x,n) (-(-(x) & -(n))) 36 | 37 | typedef struct { 38 | u32 deviceID; 39 | u8 deviceType; 40 | u32 boot2version; 41 | u32 sysMenuVer; 42 | u32 dvdSupport; 43 | s32 sysMenuIOS; 44 | s32 sysMenuIOSVersion; 45 | s32 sysMenuIOSType; 46 | float sysNinVersion; 47 | char sysMenuRegion; 48 | s32 systemRegion; 49 | bool validregion; 50 | char country[44]; 51 | char miosInfo[128]; 52 | u32 countTitles; 53 | u32 countBCMIOS; 54 | u32 countIOS; 55 | u32 countStubs; 56 | u8 shopcode; 57 | u8 priiloader; 58 | bool nandAccess; 59 | u32 runningIOS; 60 | bool runningIOSType; 61 | u32 runningIOSRevision; 62 | } SysSettings_t; 63 | 64 | typedef struct { 65 | char name[ISFS_MAXPATH + 1]; 66 | int type; 67 | } dirent_t; 68 | 69 | typedef struct { 70 | u32 hbcversion; 71 | u32 hbfversion; 72 | s32 hbc; 73 | s32 hbf; 74 | u32 hbcIOS; 75 | } homebrew_t; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /include/fatMounter.h: -------------------------------------------------------------------------------- 1 | #ifndef _FATMOUNTER_H_ 2 | #define _FATMOUNTER_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | // Prototypes 10 | int MountSD(void); 11 | void UnmountSD(void); 12 | int MountUSB(void); 13 | void UnmountUSB(void); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /include/gecko.h: -------------------------------------------------------------------------------- 1 | #ifndef _GECKO_H_ 2 | #define _GECKO_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | //#define NO_DEBUG 9 | 10 | #ifndef NO_DEBUG 11 | //use this just like printf(); 12 | void gprintf(const char *str, ...); 13 | void gsenddata(const u8 *data, int length, const char *filename); 14 | bool InitGecko(); 15 | #else 16 | #define gprintf(...) 17 | #define gsenddata(...) 18 | #define InitGecko() false 19 | #endif /* NO_DEBUG */ 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /include/gui.h: -------------------------------------------------------------------------------- 1 | #ifndef __GUI_H__ 2 | #define __GUI_H__ 3 | 4 | #include 5 | 6 | #define HEX_WHITE 0xFFFFFFFF 7 | #define HEX_BLACK 0x00000000 8 | 9 | #define CopyBuf() GRRLIB_Screen2Texture(0, 0, tex_ScreenBuf, GX_FALSE) 10 | #define DrawBuf() GRRLIB_DrawImg(0, 0, tex_ScreenBuf, 0, 1, 1, HEX_WHITE) 11 | 12 | int initGUI(void); 13 | void deinitGUI(void); 14 | int printError(const char* msg); 15 | int printSuccess(const char* msg); 16 | int printLoading(const char* msg); 17 | int printSelectIOS(const char* msg, const char* ios); 18 | int printLoadingBar(const char* msg, const f32 percent); 19 | int printEndSuccess(const char* msg); 20 | int printEndError(const char* msg); 21 | int printReport(char report[200][100], int firstLine, bool completeReport); 22 | int printUploadSuccess(const char* msg); 23 | int printUploadError(const char* msg); 24 | 25 | #endif -------------------------------------------------------------------------------- /include/http.h: -------------------------------------------------------------------------------- 1 | #ifndef _HTTP_H_ 2 | #define _HTTP_H_ 3 | 4 | #include 5 | #define TCP_CONNECT_TIMEOUT 5000 6 | #define TCP_BLOCK_SIZE (16 * 1024) 7 | #define TCP_BLOCK_RECV_TIMEOUT 4000 8 | #define TCP_BLOCK_SEND_TIMEOUT 4000 9 | 10 | s32 tcp_socket (void); 11 | s32 tcp_connect (char *host, const u16 port); 12 | 13 | char * tcp_readln (const s32 s, const u16 max_length, const u64 start_time, const u16 timeout); 14 | bool tcp_read (const s32 s, u8 **buffer, const u32 length); 15 | bool tcp_write (const s32 s, const u8 *buffer, const u32 length); 16 | 17 | #define HTTP_TIMEOUT 300000 18 | 19 | typedef enum { 20 | HTTPR_OK, 21 | HTTPR_ERR_CONNECT, 22 | HTTPR_ERR_REQUEST, 23 | HTTPR_ERR_STATUS, 24 | HTTPR_ERR_TOOBIG, 25 | HTTPR_ERR_RECEIVE 26 | } http_res; 27 | 28 | bool http_request (const char *url, const u32 max_size); 29 | bool http_post (const char *url, const u32 max_size, const char *postData); 30 | bool http_get_result (u32 *http_status, u8 **content, u32 *length); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /include/languages.h: -------------------------------------------------------------------------------- 1 | #ifndef _LANGUAGES_H_ 2 | #define _LANGUAGES_H_ 3 | 4 | extern const char* TXT_AppVersion; 5 | extern const char* MSG_GetConsoleRegion; 6 | extern const char* MSG_GetSysMenuVer; 7 | extern const char* MSG_GetHBCVer; 8 | extern const char* MSG_GetRunningIOS; 9 | extern const char* MSG_GetConsoleID; 10 | extern const char* MSG_GetBoot2; 11 | extern const char* MSG_Update; 12 | extern const char* MSG_NoUpdate; 13 | extern const char* MSG_UpdateSuccess; 14 | extern const char* MSG_UpdateFail; 15 | extern const char* TXT_Region; 16 | extern const char* TXT_Unknown; 17 | extern const char* MSG_GetNrOfTitles; 18 | extern const char* ERR_GetNrOfTitles; 19 | extern const char* MSG_GetTitleList; 20 | extern const char* ERR_GetTitleList; 21 | extern const char* ERR_GetIosTMDSize; 22 | extern const char* ERR_GetIosTMD; 23 | extern const char* MSG_MountSD; 24 | extern const char* MSG_UnmountSD; 25 | extern const char* MSG_MountUSB; 26 | extern const char* MSG_UnmountUSB; 27 | extern const char* MSG_InitFAT; 28 | extern const char* ERR_InitFAT; 29 | extern const char* MSG_SortTitles; 30 | extern const char* MSG_GetCertificates; 31 | extern const char* ERR_GetCertificates; 32 | extern const char* TXT_SysMenu; 33 | extern const char* TXT_SysMenu2; 34 | extern const char* TXT_SysMenu3; 35 | extern const char* TXT_HBF; 36 | extern const char* TXT_NO_HBC; 37 | extern const char* TXT_HBC; 38 | extern const char* TXT_HBC_NEW; 39 | extern const char* TXT_HBC_112; 40 | extern const char* TXT_HBC_STUB; 41 | extern const char* TXT_Hollywood; 42 | extern const char* TXT_ConsoleID; 43 | extern const char* TXT_ConsoleType; 44 | extern const char* TXT_ShopCountry; 45 | extern const char* TXT_vBoot2; 46 | extern const char* TXT_NrOfTitles; 47 | extern const char* TXT_NrOfIOS; 48 | extern const char* TXT_AppTitle; 49 | extern const char* TXT_AppIOS; 50 | extern const char* ERR_AllocateMemory; 51 | extern const char* ERR_OpenFile; 52 | extern const char* MSG_SelectIOS; 53 | extern const char* MSG_All; 54 | extern const char* MSG_TestingIOS; 55 | extern const char* MSG_ReloadIOS; 56 | extern const char* MSG_GenerateReport; 57 | extern const char* MSG_ReportSuccess; 58 | extern const char* MSG_ReportError; 59 | extern const char* TXT_Stub; 60 | extern const char* TXT_Trucha; 61 | extern const char* TXT_ES; 62 | extern const char* TXT_Flash; 63 | extern const char* TXT_NAND; 64 | extern const char* TXT_Boot2; 65 | extern const char* TXT_USB; 66 | extern const char* TXT_BeerTicket; 67 | extern const char* TXT_NoPatch; 68 | extern const char* TXT_Priiloader; 69 | extern const char* TXT_PreFiix; 70 | extern const char* BUT_HBC; 71 | extern const char* BUT_Shutoff; 72 | extern const char* BUT_SysMenu; 73 | extern const char* BUT_Update; 74 | extern const char* TXT_VersionP; 75 | extern const char* TXT_DVD; 76 | extern const char* TXT_NoDVD; 77 | extern const char* BUT_ConfirmUpload; 78 | extern const char* TXT_Upload; 79 | extern const char* BUT_OK; 80 | extern const char* TXT_OriginalRegion; 81 | extern const char* TXT_IOSSkipped; 82 | extern char TXT_ReportDate[]; 83 | extern char MSG_Buffer[]; 84 | extern char MSG_Buffer2[]; 85 | 86 | int initLanguages(struct tm today); 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /include/mload.h: -------------------------------------------------------------------------------- 1 | /* mload.c (for PPC) (c) 2009, Hermes 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | */ 17 | 18 | #ifndef __MLOAD_H__ 19 | #define __MLOAD_H__ 20 | 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "unistd.h" 28 | 29 | #define MLOAD_MLOAD_THREAD_ID 0x4D4C4400 30 | #define MLOAD_GET_IOS_BASE 0x4D4C4401 31 | #define MLOAD_GET_MLOAD_VERSION 0x4D4C4402 32 | 33 | #define MLOAD_LOAD_MODULE 0x4D4C4480 34 | #define MLOAD_RUN_MODULE 0x4D4C4481 35 | #define MLOAD_RUN_THREAD 0x4D4C4482 36 | 37 | #define MLOAD_STOP_THREAD 0x4D4C4484 38 | #define MLOAD_CONTINUE_THREAD 0x4D4C4485 39 | 40 | #define MLOAD_GET_LOAD_BASE 0x4D4C4490 41 | #define MLOAD_MEMSET 0x4D4C4491 42 | 43 | #define MLOAD_GET_EHCI_DATA 0x4D4C44A0 44 | #define MLOAD_GET_LOG 0x4D4C44A1 45 | 46 | #define MLOAD_SET_ES_IOCTLV 0x4D4C44B0 47 | 48 | #define MLOAD_GETW 0x4D4C44C0 49 | #define MLOAD_GETH 0x4D4C44C1 50 | #define MLOAD_GETB 0x4D4C44C2 51 | #define MLOAD_SETW 0x4D4C44C3 52 | #define MLOAD_SETH 0x4D4C44C4 53 | #define MLOAD_SETB 0x4D4C44C5 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | 60 | // from IOS ELF stripper of neimod 61 | 62 | #define getbe32(x) ((adr[x]<<24) | (adr[x+1]<<16) | (adr[x+2]<<8) | (adr[x+3])) 63 | 64 | typedef struct 65 | { 66 | u32 ident0; 67 | u32 ident1; 68 | u32 ident2; 69 | u32 ident3; 70 | u32 machinetype; 71 | u32 version; 72 | u32 entry; 73 | u32 phoff; 74 | u32 shoff; 75 | u32 flags; 76 | u16 ehsize; 77 | u16 phentsize; 78 | u16 phnum; 79 | u16 shentsize; 80 | u16 shnum; 81 | u16 shtrndx; 82 | } elfheader; 83 | 84 | typedef struct 85 | { 86 | u32 type; 87 | u32 offset; 88 | u32 vaddr; 89 | u32 paddr; 90 | u32 filesz; 91 | u32 memsz; 92 | u32 flags; 93 | u32 align; 94 | } elfphentry; 95 | 96 | typedef struct 97 | { 98 | void *start; 99 | int prio; 100 | void *stack; 101 | int size_stack; 102 | } data_elf; 103 | 104 | /*--------------------------------------------------------------------------------------------------------------*/ 105 | 106 | // to init/test if the device is running 107 | 108 | int mload_init(); 109 | 110 | /*--------------------------------------------------------------------------------------------------------------*/ 111 | 112 | // to close the device (remember call it when rebooting the IOS!) 113 | 114 | int mload_close(); 115 | 116 | /*--------------------------------------------------------------------------------------------------------------*/ 117 | 118 | // to get the thread id of mload 119 | 120 | int mload_get_thread_id(); 121 | 122 | /*--------------------------------------------------------------------------------------------------------------*/ 123 | 124 | // get the base and the size of the memory readable/writable to load modules 125 | 126 | int mload_get_load_base(u32 *starlet_base, int *size); 127 | 128 | /*--------------------------------------------------------------------------------------------------------------*/ 129 | 130 | // load and run a module from starlet (it need to allocate MEM2 to send the elf file) 131 | // the module must be a elf made with stripios 132 | 133 | int mload_module(void *addr, int len); 134 | 135 | /*--------------------------------------------------------------------------------------------------------------*/ 136 | 137 | // load a module from the PPC 138 | // the module must be a elf made with stripios 139 | 140 | int mload_elf(void *my_elf, data_elf *data_elf); 141 | 142 | /*--------------------------------------------------------------------------------------------------------------*/ 143 | 144 | // run one thread (you can use to load modules or binary files) 145 | 146 | int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority); 147 | 148 | /*--------------------------------------------------------------------------------------------------------------*/ 149 | 150 | // stops one starlet thread 151 | 152 | int mload_stop_thread(int id); 153 | 154 | /*--------------------------------------------------------------------------------------------------------------*/ 155 | 156 | // continue one stopped starlet thread 157 | 158 | int mload_continue_thread(int id); 159 | 160 | /*--------------------------------------------------------------------------------------------------------------*/ 161 | 162 | // fix starlet address to read/write (uses SEEK_SET, etc as mode) 163 | 164 | int mload_seek(int offset, int mode); 165 | 166 | /*--------------------------------------------------------------------------------------------------------------*/ 167 | 168 | // read bytes from starlet (it update the offset) 169 | 170 | int mload_read(void* buf, u32 size); 171 | 172 | /*--------------------------------------------------------------------------------------------------------------*/ 173 | 174 | // write bytes from starlet (it update the offset) 175 | 176 | int mload_write(const void * buf, u32 size); 177 | 178 | /*--------------------------------------------------------------------------------------------------------------*/ 179 | 180 | // fill a block (similar to memset) 181 | 182 | int mload_memset(void *starlet_addr, int set, int len); 183 | 184 | /*--------------------------------------------------------------------------------------------------------------*/ 185 | 186 | // get the ehci datas ( ehcmodule.elf uses this address) 187 | 188 | void * mload_get_ehci_data(); 189 | 190 | /*--------------------------------------------------------------------------------------------------------------*/ 191 | 192 | // set the dev/es ioctlv in routine 193 | 194 | int mload_set_ES_ioctlv_vector(void *starlet_addr); 195 | 196 | /*--------------------------------------------------------------------------------------------------------------*/ 197 | 198 | 199 | // to get log buffer 200 | // this function return the size of the log buffer and prepare it to read with mload_read() the datas 201 | 202 | int mload_get_log(); 203 | 204 | /*--------------------------------------------------------------------------------------------------------------*/ 205 | 206 | 207 | // to get IOS base for dev/es to create the cIOS 208 | 209 | int mload_get_IOS_base(); 210 | 211 | int mload_get_version(); 212 | 213 | /*--------------------------------------------------------------------------------------------------------------*/ 214 | 215 | int mload_getw(const void * addr, u32 *dat); 216 | int mload_geth(const void * addr, u16 *dat); 217 | int mload_getb(const void * addr, u8 *dat); 218 | 219 | int mload_setw(const void * addr, u32 dat); 220 | int mload_seth(const void * addr, u16 dat); 221 | int mload_setb(const void * addr, u8 dat); 222 | 223 | int wanin_mload_get_IOS_base(); 224 | 225 | #ifdef __cplusplus 226 | } 227 | #endif 228 | 229 | 230 | #endif 231 | -------------------------------------------------------------------------------- /include/runtimeiospatch.h: -------------------------------------------------------------------------------- 1 | // This program is free software: you can redistribute it and/or modify 2 | // it under the terms of the GNU General Public License as published by 3 | // the Free Software Foundation, version 2.0. 4 | 5 | // This program is distributed in the hope that it will be useful, 6 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 7 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8 | // GNU General Public License 2.0 for more details. 9 | 10 | // Copyright (C) 2010 Joseph Jordan 11 | // Copyright (C) 2012-2013 damysteryman 12 | // Copyright (C) 2012-2015 Christopher Bratusek 13 | // Copyright (C) 2013 DarkMatterCore 14 | // Copyright (C) 2014 megazig 15 | // Copyright (C) 2015 FIX94 16 | 17 | #ifndef __RUNTIMEIOSPATCH_H__ 18 | #define __RUNTIMEIOSPATCH_H__ 19 | 20 | /** 21 | * Version information for Libruntimeiospatch. 22 | */ 23 | #define LIB_RUNTIMEIOSPATCH_VERSION "1.5.2" 24 | 25 | //============================================================================== 26 | // HW_RVL header 27 | //============================================================================== 28 | #if defined(HW_RVL) /* defined(HW_RVL) */ 29 | 30 | /** 31 | *Returns true when HW_AHBPROT access can be applied 32 | */ 33 | #define AHBPROT_DISABLED (*(vu32*)0xcd800064 == 0xFFFFFFFF) 34 | 35 | //============================================================================== 36 | // Error code definitions: 37 | //============================================================================== 38 | #define ERROR_AHBPROT -5 39 | #define ERROR_PATCH -7 40 | 41 | //============================================================================== 42 | // C++ header 43 | //============================================================================== 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | /* __cplusplus */ 48 | 49 | //============================================================================== 50 | // Extra standard declarations 51 | //============================================================================== 52 | typedef signed int s32; 53 | //============================================================================== 54 | 55 | //============================================================================== 56 | // Patchsets: 57 | //============================================================================== 58 | /* 59 | Wii: 60 | * DI Readlimit 61 | * ISFS Permissions 62 | * ES SetUID 63 | * ES SetIdentify 64 | * Hash Check (aka Trucha) 65 | * New Hash Check (aka New Trucha) 66 | * SSL patches 67 | 68 | Sciifii: 69 | * MEM2 Prot 70 | * ES OpenTitleContent 1 & 2 71 | * ES ReadContent Prot 72 | * ES CloseContent 73 | * ES TitleVersionCheck 74 | * ES TitleDeleteCheck 75 | 76 | vWii: 77 | * Kill Anti-SystemTitle-Install 1, 2, 3, 4 & 5 78 | */ 79 | 80 | 81 | //============================================================================== 82 | // Functions: 83 | //============================================================================== 84 | 85 | /** 86 | * This function can be used to keep HW_AHBPROT access when going to reload IOS 87 | * @param verbose Flag determing whether or not to print messages on-screen 88 | * @example 89 | * if(AHBPROT_DISABLED) { 90 | * s32 ret; 91 | * ret = IosPatch_AHBPROT(false); 92 | * if (ret) { 93 | * IOS_ReloadIOS(36); 94 | * } else { 95 | * printf("IosPatch_AHBPROT failed."); 96 | * } 97 | * } 98 | * @return Signed 32bit integer representing code 99 | * > 0 : Success - return equals to number of applied patches 100 | * ERROR_AHBPROT : Error - No HW_AHBPROT access 101 | */ 102 | s32 IosPatch_AHBPROT(bool verbose); 103 | 104 | 105 | /** 106 | * This function applies patches on current IOS 107 | * @see Patchsets 108 | * @param wii Flag determing whether or not to apply Wii patches. 109 | * @param sciifii Flag determing whether or not to apply extra Sciifii patches. 110 | * @param vwii Flag determing whether or not to apply extra vWii patches. 111 | * @param verbose Flag determing whether or not to print messages on-screen. 112 | * @example if(AHBPROT_DISABLED) IosPatch_FULL(true, false, false, false); 113 | * @return Signed 32bit integer representing code 114 | * > 0 : Success - return equals to number of applied patches 115 | * ERROR_AHBPROT : Error - No HW_AHBPROT access 116 | * ERROR_PATCH : Error - Patching HW_AHBPROT access failed 117 | */ 118 | s32 IosPatch_RUNTIME(bool wii, bool sciifii, bool vwii, bool verbose); 119 | 120 | 121 | /** 122 | * This function combines IosPatch_AHBPROT + IOS_ReloadIOS + IosPatch_RUNTIME 123 | * @see Patchsets 124 | * @param wii Flag determing whether or not to apply Wii patches. 125 | * @param sciifii Flag determing whether or not to apply extra Sciifii patches. 126 | * @param vwii Flag determing whether or not to apply extra vWii patches. 127 | * @param verbose Flag determing whether or not to print messages on-screen. 128 | * @param IOS Which IOS to reload into. 129 | * @example if(AHBPROT_DISABLED) IosPatch_FULL(true, false, false, false, 58); 130 | * @return Signed 32bit integer representing code 131 | * > 0 : Success - return equals to number of applied patches 132 | * ERROR_AHBPROT : Error - No HW_AHBPROT access 133 | * ERROR_PATCH : Error - Patching HW_AHBPROT access failed 134 | */ 135 | s32 IosPatch_FULL(bool wii, bool sciifii, bool vwii, bool verbose, int IOS); 136 | 137 | //============================================================================== 138 | // C++ footer 139 | //============================================================================== 140 | #ifdef __cplusplus 141 | } 142 | #endif /* __cplusplus */ 143 | 144 | //============================================================================== 145 | // HW_RVL footer 146 | //============================================================================== 147 | #endif /* defined(HW_RVL) */ 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /include/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHA1_H__ 2 | #define __SHA1_H__ 3 | 4 | typedef struct { 5 | unsigned long state[5]; 6 | unsigned long count[2]; 7 | unsigned char buffer[64]; 8 | } SHA1_CTX; 9 | 10 | void SHA1Transform(unsigned long state[5], unsigned char buffer[64]); 11 | void SHA1Init(SHA1_CTX* context); 12 | void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len); 13 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context); 14 | void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf); 15 | 16 | #endif -------------------------------------------------------------------------------- /include/ssl.h: -------------------------------------------------------------------------------- 1 | /* Code taken from http://wiibrew.org/wiki//dev/net/ssl/code */ 2 | 3 | #ifndef _SSL_H_ 4 | #define _SSL_H_ 5 | 6 | #define IOCTLV_SSL_NEW 1 7 | #define IOCTLV_SSL_CONNECT 2 8 | #define IOCTLV_SSL_HANDSHAKE 3 9 | #define IOCTLV_SSL_READ 4 10 | #define IOCTLV_SSL_WRITE 5 11 | #define IOCTLV_SSL_SHUTDOWN 6 12 | #define IOCTLV_SSL_SETROOTCA 10 13 | #define IOCTLV_SSL_SETBUILTINCLIENTCERT 14 14 | 15 | #define SSL_HEAP_SIZE 0xB000 16 | 17 | u32 ssl_init(void); 18 | u32 ssl_open(void); 19 | u32 ssl_close(void); 20 | s32 ssl_new(u8 * CN, u32 verify_options); 21 | s32 ssl_setbuiltinclientcert(s32 ssl_context, s32 index); 22 | s32 ssl_setrootca(s32 ssl_context, const void *root, u32 length); 23 | s32 ssl_connect(s32 ssl_context, s32 socket); 24 | s32 ssl_handshake(s32 ssl_context); 25 | s32 ssl_read(s32 ssl_context, void* buffer, u32 length); 26 | s32 ssl_write(s32 ssl_context, const void * buffer, u32 length); 27 | s32 ssl_shutdown(s32 ssl_context); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/sys.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYS_H__ 2 | #define __SYS_H__ 3 | 4 | #include 5 | #include "tools.h" 6 | 7 | #define AHB_ACCESS (*(vu32*)0xcd800064 == 0xFFFFFFFF) 8 | #define MEM_REG_BASE 0xd8b4000 9 | #define MEM_PROT (MEM_REG_BASE + 0x20a) 10 | #define HOLLYWOOD_VERSION (*(vu32*)0x80003138) 11 | #define LOADER_STUB (vu32*)0x80001800 12 | #define IOS_TOP (*((vu32*)0x80003130)) 13 | #define IS_WII_U ((*(vu32*)(0xCd8005A0) >> 16 ) == 0xCAFE) 14 | #define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0]))) 15 | 16 | // Turn upper and lower into a full title ID 17 | #define TITLE_ID(x,y) (((u64)(x) << 32) | (y)) 18 | // Get upper or lower half of a title ID 19 | #define TITLE_UPPER(x) ((u32)((x) >> 32)) 20 | // Turn upper and lower into a full title ID 21 | #define TITLE_LOWER(x) ((u32)(x)) 22 | 23 | enum { 24 | APP_TITLE = 0, 25 | APP_IOS, 26 | BLANK_LINE, 27 | TEXT_REGION, 28 | SYSMENU, 29 | PRIILOADER, 30 | DVD, 31 | HBC, 32 | HBF, 33 | HOLLYWOOD, 34 | CONSOLE_ID, 35 | CONSOLE_TYPE, 36 | COUNTRY, 37 | BOOT2_VERSION, 38 | NR_OF_TITLES, 39 | NR_OF_IOS, 40 | BLANK, 41 | LAST 42 | }; 43 | 44 | enum { 45 | CONSOLE_WII = 0, 46 | CONSOLE_WII_U, 47 | CONSOLE_UNKNOWN 48 | }; 49 | 50 | enum { 51 | IOS_WII = 0, 52 | IOS_WII_U 53 | }; 54 | 55 | enum { 56 | HBC_NONE = 0, 57 | HBC_HAXX, 58 | HBC_JODI, 59 | HBC_1_0_7, 60 | HBC_LULZ, 61 | HBC_OPEN 62 | }; 63 | 64 | enum { 65 | HBF_NONE = 0, 66 | HBF_HBF0, 67 | HBF_THBF 68 | }; 69 | 70 | enum { 71 | TID_CBOOT2 = 252, // cBoot252 72 | TID_NANDEMU, 73 | TID_BOOTMII, 74 | TID_BC = 256, 75 | TID_MIOS, 76 | TID_NAND = 512, 77 | TID_WFS 78 | }; 79 | 80 | #define HBC_TID_HAXX 0x48415858 81 | #define HBC_TID_JODI 0x4A4F4449 82 | #define HBC_TID_1_0_7 0xAF1BF516 83 | #define HBC_TID_LULZ 0x4C554C5A 84 | #define HBC_TID_OPEN 0x4F484243 85 | 86 | typedef struct { 87 | s32 revision; 88 | bool isStub; 89 | bool infoFakeSignature; 90 | bool infoESIdentify; 91 | bool infoFlashAccess; 92 | bool infoNANDAccess; 93 | bool infoBoot2Access; 94 | bool infoUSB2; 95 | bool infoVersionPatch; 96 | bool infovIOS; 97 | bool infoBeerTicket; 98 | s32 baseIOS; 99 | s32 mloadVersion; 100 | char info[64]; 101 | u8 infoContent; 102 | u32 titleID; 103 | u8 num_contents; 104 | u32 titleSize; 105 | } IOS_t; 106 | 107 | typedef struct { 108 | bool hasInfo; 109 | u32 realRevision; 110 | char info[0x20]; 111 | } sysMenu_t; 112 | 113 | typedef struct _U8Header 114 | { 115 | u32 fcc; 116 | u32 rootNodeOffset; 117 | u32 headerSize; 118 | u32 dataOffset; 119 | u8 zeroes[16]; 120 | } __attribute__((packed)) U8Header; 121 | 122 | typedef struct _U8Entry 123 | { 124 | struct 125 | { 126 | u32 fileType :8; 127 | u32 nameOffset :24; 128 | }; 129 | u32 fileOffset; 130 | union 131 | { 132 | u32 fileLength; 133 | u32 numEntries; 134 | }; 135 | } __attribute__( ( packed ) ) U8Entry; 136 | 137 | extern const char *Regions[]; 138 | extern u8 sysMenuInfoContent; 139 | 140 | #ifdef __cplusplus 141 | extern "C" 142 | { 143 | #endif 144 | 145 | // Prototypes 146 | 147 | char GetSysMenuRegion(u32 sysVersion); 148 | bool GetCertificates(void); 149 | u32 GetSysMenuVersion(void); 150 | float GetSysMenuNintendoVersion(u32 sysVersion); 151 | u32 GetBoot2Version(void); 152 | u32 GetDeviceID(void); 153 | bool CheckIOSType(u32 titleID, s32 revision); 154 | bool CheckFakeSignature(void); 155 | bool CheckESIdentify(void); 156 | bool CheckFlashAccess(void); 157 | bool CheckNANDAccess(void); 158 | bool CheckBoot2Access(void); 159 | bool CheckMload(void); 160 | bool CheckUSB2(u32 titleID); 161 | bool CheckBeerTicket(u32 titleID); 162 | bool IsKnownStub(u32 noIOS, s32 noRevision); 163 | s32 GetTMD(u64 TicketID, signed_blob **Output, u32 *Length); 164 | s32 read_file_from_nand(char *filepath, u8 **buffer, u32 *filesize); 165 | int checkSysLoader(void); 166 | void transmitSyscheck(char ReportBuffer[200][100], int *lines); 167 | s32 brute_tmd(tmd *p_tmd); 168 | s32 get_miosinfo(char *str); 169 | int get_title_ios(u64 title); 170 | bool getInfoFromContent(IOS_t *ios); 171 | 172 | #ifdef __cplusplus 173 | } 174 | #endif 175 | 176 | #endif -------------------------------------------------------------------------------- /include/title.h: -------------------------------------------------------------------------------- 1 | #ifndef _TITLE_H_ 2 | #define _TITLE_H_ 3 | 4 | /* Constants */ 5 | #define BLOCK_SIZE 1024 6 | 7 | /* Macros */ 8 | #define round_up(x,n) (-(-(x) & -(n))) 9 | 10 | /* Prototypes */ 11 | s32 Title_FakesignTMD(signed_blob *); 12 | s32 Title_GetList(u64 **, u32 *); 13 | s32 Title_GetTicketViews(u64, tikview **, u32 *); 14 | s32 Title_GetTMD(u64, signed_blob **, u32 *); 15 | s32 Title_GetVersion(u64, u16 *); 16 | s32 Title_GetSysVersion(u64, u64 *); 17 | s32 Title_GetSize(u64, u32 *); 18 | s32 Title_GetVersionNObuf(u64 tid); 19 | u32 Title_GetSize_FromTMD(tmd *tmd_data); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /include/tmdIdentification.h: -------------------------------------------------------------------------------- 1 | #ifndef __TMDIDENT_H__ 2 | #define __TMDIDENT_H__ 3 | 4 | #include 5 | 6 | #define base_number 125 7 | 8 | typedef struct { 9 | u32 hashes[5]; 10 | u32 base; 11 | char info[0x10]; 12 | } iosHashes; 13 | 14 | typedef struct _iosinfo_t { 15 | u32 magicword; //0x1ee7c105 16 | u32 magicversion; // 1 17 | u32 version; // Example: 5 18 | u32 baseios; // Example: 56 19 | char name[0x10]; // Example: d2x 20 | char versionstring[0x10]; // Example: beta2 21 | } __attribute__((packed)) iosinfo_t; 22 | 23 | extern iosHashes iosHash[base_number]; 24 | 25 | #endif -------------------------------------------------------------------------------- /include/tools.h: -------------------------------------------------------------------------------- 1 | #ifndef __TOOLS_H__ 2 | #define __TOOLS_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | // Values for DetectInput 10 | #define DI_BUTTONS_HELD 0 11 | #define DI_BUTTONS_DOWN 1 12 | 13 | #define CHECK_ARG(X) (!strncmp((X), argv[i], sizeof((X))-1)) 14 | #define CHECK_ARG_VAL(X) (argv[i] + sizeof((X))-1) 15 | 16 | #define CheckTime() while(!(ticks_to_millisecs(diff_ticks(current_time, gettime())) > 450)) 17 | #define UpdateTime() current_time = gettime(); 18 | 19 | typedef struct { 20 | bool AHB_At_Start; 21 | bool debug; 22 | int skipIOSlist[512]; 23 | int skipIOScnt; 24 | bool USB; 25 | } arguments_t; 26 | 27 | extern arguments_t arguments; 28 | 29 | void logfile(const char *format, ...); 30 | void *allocate_memory(u32 size); 31 | int NandStartup(void); 32 | void NandShutdown(void); 33 | void Wpad_Disconnect(void); 34 | u32 DetectInput(u8 DownOrHeld); 35 | void sort(u64 *titles, u32 cnt); 36 | void formatDate(u32 date, char ReportBuffer[200][100]); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/update.h: -------------------------------------------------------------------------------- 1 | #ifndef _UPDATE_H_ 2 | #define _UPDATE_H_ 3 | 4 | /* Constants */ 5 | //#define REVISION 0 // For testing updateApp function 6 | #define REVISION 52 7 | 8 | s32 updateApp(void); 9 | 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /include/wiibasics.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | wiibasics.h -- basic Wii initialization and functions 4 | 5 | Copyright (C) 2008 tona 6 | Unless other credit specified 7 | 8 | This software is provided 'as-is', without any express or implied 9 | warranty. In no event will the authors be held liable for any 10 | damages arising from the use of this software. 11 | 12 | Permission is granted to anyone to use this software for any 13 | purpose, including commercial applications, and to alter it and 14 | redistribute it freely, subject to the following restrictions: 15 | 16 | 1.The origin of this software must not be misrepresented; you 17 | must not claim that you wrote the original software. If you use 18 | this software in a product, an acknowledgment in the product 19 | documentation would be appreciated but is not required. 20 | 21 | 2.Altered source versions must be plainly marked as such, and 22 | must not be misrepresented as being the original software. 23 | 24 | 3.This notice may not be removed or altered from any source 25 | distribution. 26 | 27 | -------------------------------------------------------------*/ 28 | 29 | #ifndef _WII_BASICS_H_ 30 | #define _WII_BASICS_H_ 31 | 32 | // Turn upper and lower into a full title ID 33 | #define TITLE_ID(x,y) (((u64)(x) << 32) | (y)) 34 | // Get upper or lower half of a title ID 35 | #define TITLE_UPPER(x) ((u32)((x) >> 32)) 36 | // Turn upper and lower into a full title ID 37 | #define TITLE_LOWER(x) ((u32)(x)) 38 | 39 | // be function from segher's wii.git 40 | u64 be64(const u8 *p); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /libs/include/bzlib.h: -------------------------------------------------------------------------------- 1 | 2 | /*-------------------------------------------------------------*/ 3 | /*--- Public header file for the library. ---*/ 4 | /*--- bzlib.h ---*/ 5 | /*-------------------------------------------------------------*/ 6 | 7 | /* ------------------------------------------------------------------ 8 | This file is part of bzip2/libbzip2, a program and library for 9 | lossless, block-sorting data compression. 10 | 11 | bzip2/libbzip2 version 1.0.6 of 6 September 2010 12 | Copyright (C) 1996-2010 Julian Seward 13 | 14 | Please read the WARNING, DISCLAIMER and PATENTS sections in the 15 | README file. 16 | 17 | This program is released under the terms of the license contained 18 | in the file LICENSE. 19 | ------------------------------------------------------------------ */ 20 | 21 | 22 | #ifndef _BZLIB_H 23 | #define _BZLIB_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | #define BZ_RUN 0 30 | #define BZ_FLUSH 1 31 | #define BZ_FINISH 2 32 | 33 | #define BZ_OK 0 34 | #define BZ_RUN_OK 1 35 | #define BZ_FLUSH_OK 2 36 | #define BZ_FINISH_OK 3 37 | #define BZ_STREAM_END 4 38 | #define BZ_SEQUENCE_ERROR (-1) 39 | #define BZ_PARAM_ERROR (-2) 40 | #define BZ_MEM_ERROR (-3) 41 | #define BZ_DATA_ERROR (-4) 42 | #define BZ_DATA_ERROR_MAGIC (-5) 43 | #define BZ_IO_ERROR (-6) 44 | #define BZ_UNEXPECTED_EOF (-7) 45 | #define BZ_OUTBUFF_FULL (-8) 46 | #define BZ_CONFIG_ERROR (-9) 47 | 48 | typedef 49 | struct { 50 | char *next_in; 51 | unsigned int avail_in; 52 | unsigned int total_in_lo32; 53 | unsigned int total_in_hi32; 54 | 55 | char *next_out; 56 | unsigned int avail_out; 57 | unsigned int total_out_lo32; 58 | unsigned int total_out_hi32; 59 | 60 | void *state; 61 | 62 | void *(*bzalloc)(void *,int,int); 63 | void (*bzfree)(void *,void *); 64 | void *opaque; 65 | } 66 | bz_stream; 67 | 68 | 69 | #ifndef BZ_IMPORT 70 | #define BZ_EXPORT 71 | #endif 72 | 73 | #ifndef BZ_NO_STDIO 74 | /* Need a definitition for FILE */ 75 | #include 76 | #endif 77 | 78 | #ifdef _WIN32 79 | # include 80 | # ifdef small 81 | /* windows.h define small to char */ 82 | # undef small 83 | # endif 84 | # ifdef BZ_EXPORT 85 | # define BZ_API(func) WINAPI func 86 | # define BZ_EXTERN extern 87 | # else 88 | /* import windows dll dynamically */ 89 | # define BZ_API(func) (WINAPI * func) 90 | # define BZ_EXTERN 91 | # endif 92 | #else 93 | # define BZ_API(func) func 94 | # define BZ_EXTERN extern 95 | #endif 96 | 97 | 98 | /*-- Core (low-level) library functions --*/ 99 | 100 | BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 101 | bz_stream* strm, 102 | int blockSize100k, 103 | int verbosity, 104 | int workFactor 105 | ); 106 | 107 | BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 108 | bz_stream* strm, 109 | int action 110 | ); 111 | 112 | BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 113 | bz_stream* strm 114 | ); 115 | 116 | BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 117 | bz_stream *strm, 118 | int verbosity, 119 | int small 120 | ); 121 | 122 | BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 123 | bz_stream* strm 124 | ); 125 | 126 | BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 127 | bz_stream *strm 128 | ); 129 | 130 | 131 | 132 | /*-- High(er) level library functions --*/ 133 | 134 | #ifndef BZ_NO_STDIO 135 | #define BZ_MAX_UNUSED 5000 136 | 137 | typedef void BZFILE; 138 | 139 | BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 140 | int* bzerror, 141 | FILE* f, 142 | int verbosity, 143 | int small, 144 | void* unused, 145 | int nUnused 146 | ); 147 | 148 | BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 149 | int* bzerror, 150 | BZFILE* b 151 | ); 152 | 153 | BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 154 | int* bzerror, 155 | BZFILE* b, 156 | void** unused, 157 | int* nUnused 158 | ); 159 | 160 | BZ_EXTERN int BZ_API(BZ2_bzRead) ( 161 | int* bzerror, 162 | BZFILE* b, 163 | void* buf, 164 | int len 165 | ); 166 | 167 | BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 168 | int* bzerror, 169 | FILE* f, 170 | int blockSize100k, 171 | int verbosity, 172 | int workFactor 173 | ); 174 | 175 | BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 176 | int* bzerror, 177 | BZFILE* b, 178 | void* buf, 179 | int len 180 | ); 181 | 182 | BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 183 | int* bzerror, 184 | BZFILE* b, 185 | int abandon, 186 | unsigned int* nbytes_in, 187 | unsigned int* nbytes_out 188 | ); 189 | 190 | BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 191 | int* bzerror, 192 | BZFILE* b, 193 | int abandon, 194 | unsigned int* nbytes_in_lo32, 195 | unsigned int* nbytes_in_hi32, 196 | unsigned int* nbytes_out_lo32, 197 | unsigned int* nbytes_out_hi32 198 | ); 199 | #endif 200 | 201 | 202 | /*-- Utility functions --*/ 203 | 204 | BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 205 | char* dest, 206 | unsigned int* destLen, 207 | char* source, 208 | unsigned int sourceLen, 209 | int blockSize100k, 210 | int verbosity, 211 | int workFactor 212 | ); 213 | 214 | BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 215 | char* dest, 216 | unsigned int* destLen, 217 | char* source, 218 | unsigned int sourceLen, 219 | int small, 220 | int verbosity 221 | ); 222 | 223 | 224 | /*-- 225 | Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) 226 | to support better zlib compatibility. 227 | This code is not _officially_ part of libbzip2 (yet); 228 | I haven't tested it, documented it, or considered the 229 | threading-safeness of it. 230 | If this code breaks, please contact both Yoshioka and me. 231 | --*/ 232 | 233 | BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( 234 | void 235 | ); 236 | 237 | #ifndef BZ_NO_STDIO 238 | BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( 239 | const char *path, 240 | const char *mode 241 | ); 242 | 243 | BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( 244 | int fd, 245 | const char *mode 246 | ); 247 | 248 | BZ_EXTERN int BZ_API(BZ2_bzread) ( 249 | BZFILE* b, 250 | void* buf, 251 | int len 252 | ); 253 | 254 | BZ_EXTERN int BZ_API(BZ2_bzwrite) ( 255 | BZFILE* b, 256 | void* buf, 257 | int len 258 | ); 259 | 260 | BZ_EXTERN int BZ_API(BZ2_bzflush) ( 261 | BZFILE* b 262 | ); 263 | 264 | BZ_EXTERN void BZ_API(BZ2_bzclose) ( 265 | BZFILE* b 266 | ); 267 | 268 | BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( 269 | BZFILE *b, 270 | int *errnum 271 | ); 272 | #endif 273 | 274 | #ifdef __cplusplus 275 | } 276 | #endif 277 | 278 | #endif 279 | 280 | /*-------------------------------------------------------------*/ 281 | /*--- end bzlib.h ---*/ 282 | /*-------------------------------------------------------------*/ 283 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/config/ftmodule.h: -------------------------------------------------------------------------------- 1 | /* This is a generated file. */ 2 | FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class ) 3 | FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class ) 4 | FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class ) 5 | FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class ) 6 | FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class ) 7 | FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class ) 8 | FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class ) 9 | FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class ) 10 | FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class ) 11 | FT_USE_MODULE( FT_Module_Class, sfnt_module_class ) 12 | FT_USE_MODULE( FT_Module_Class, autofit_module_class ) 13 | FT_USE_MODULE( FT_Module_Class, pshinter_module_class ) 14 | FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class ) 15 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class ) 16 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class ) 17 | FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class ) 18 | FT_USE_MODULE( FT_Module_Class, psaux_module_class ) 19 | FT_USE_MODULE( FT_Module_Class, psnames_module_class ) 20 | /* EOF */ 21 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftbbox.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbbox.h */ 4 | /* */ 5 | /* FreeType exact bbox computation (specification). */ 6 | /* */ 7 | /* Copyright 1996-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This component has a _single_ role: to compute exact outline bounding */ 22 | /* boxes. */ 23 | /* */ 24 | /* It is separated from the rest of the engine for various technical */ 25 | /* reasons. It may well be integrated in `ftoutln' later. */ 26 | /* */ 27 | /*************************************************************************/ 28 | 29 | 30 | #ifndef FTBBOX_H_ 31 | #define FTBBOX_H_ 32 | 33 | 34 | #include 35 | #include FT_FREETYPE_H 36 | 37 | #ifdef FREETYPE_H 38 | #error "freetype.h of FreeType 1 has been loaded!" 39 | #error "Please fix the directory search order for header files" 40 | #error "so that freetype.h of FreeType 2 is found first." 41 | #endif 42 | 43 | 44 | FT_BEGIN_HEADER 45 | 46 | 47 | /*************************************************************************/ 48 | /* */ 49 | /*
*/ 50 | /* outline_processing */ 51 | /* */ 52 | /*************************************************************************/ 53 | 54 | 55 | /*************************************************************************/ 56 | /* */ 57 | /* */ 58 | /* FT_Outline_Get_BBox */ 59 | /* */ 60 | /* */ 61 | /* Compute the exact bounding box of an outline. This is slower */ 62 | /* than computing the control box. However, it uses an advanced */ 63 | /* algorithm that returns _very_ quickly when the two boxes */ 64 | /* coincide. Otherwise, the outline Bezier arcs are traversed to */ 65 | /* extract their extrema. */ 66 | /* */ 67 | /* */ 68 | /* outline :: A pointer to the source outline. */ 69 | /* */ 70 | /* */ 71 | /* abbox :: The outline's exact bounding box. */ 72 | /* */ 73 | /* */ 74 | /* FreeType error code. 0~means success. */ 75 | /* */ 76 | /* */ 77 | /* If the font is tricky and the glyph has been loaded with */ 78 | /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ 79 | /* reasonable values for the BBox it is necessary to load the glyph */ 80 | /* at a large ppem value (so that the hinting instructions can */ 81 | /* properly shift and scale the subglyphs), then extracting the BBox, */ 82 | /* which can be eventually converted back to font units. */ 83 | /* */ 84 | FT_EXPORT( FT_Error ) 85 | FT_Outline_Get_BBox( FT_Outline* outline, 86 | FT_BBox *abbox ); 87 | 88 | /* */ 89 | 90 | 91 | FT_END_HEADER 92 | 93 | #endif /* FTBBOX_H_ */ 94 | 95 | 96 | /* END */ 97 | 98 | 99 | /* Local Variables: */ 100 | /* coding: utf-8 */ 101 | /* End: */ 102 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftbdf.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbdf.h */ 4 | /* */ 5 | /* FreeType API for accessing BDF-specific strings (specification). */ 6 | /* */ 7 | /* Copyright 2002-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTBDF_H_ 20 | #define FTBDF_H_ 21 | 22 | #include 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /*
*/ 38 | /* bdf_fonts */ 39 | /* */ 40 | /* */ 41 | /* BDF and PCF Files */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* BDF and PCF specific API. */ 45 | /* */ 46 | /* <Description> */ 47 | /* This section contains the declaration of functions specific to BDF */ 48 | /* and PCF fonts. */ 49 | /* */ 50 | /*************************************************************************/ 51 | 52 | 53 | /********************************************************************** 54 | * 55 | * @enum: 56 | * BDF_PropertyType 57 | * 58 | * @description: 59 | * A list of BDF property types. 60 | * 61 | * @values: 62 | * BDF_PROPERTY_TYPE_NONE :: 63 | * Value~0 is used to indicate a missing property. 64 | * 65 | * BDF_PROPERTY_TYPE_ATOM :: 66 | * Property is a string atom. 67 | * 68 | * BDF_PROPERTY_TYPE_INTEGER :: 69 | * Property is a 32-bit signed integer. 70 | * 71 | * BDF_PROPERTY_TYPE_CARDINAL :: 72 | * Property is a 32-bit unsigned integer. 73 | */ 74 | typedef enum BDF_PropertyType_ 75 | { 76 | BDF_PROPERTY_TYPE_NONE = 0, 77 | BDF_PROPERTY_TYPE_ATOM = 1, 78 | BDF_PROPERTY_TYPE_INTEGER = 2, 79 | BDF_PROPERTY_TYPE_CARDINAL = 3 80 | 81 | } BDF_PropertyType; 82 | 83 | 84 | /********************************************************************** 85 | * 86 | * @type: 87 | * BDF_Property 88 | * 89 | * @description: 90 | * A handle to a @BDF_PropertyRec structure to model a given 91 | * BDF/PCF property. 92 | */ 93 | typedef struct BDF_PropertyRec_* BDF_Property; 94 | 95 | 96 | /********************************************************************** 97 | * 98 | * @struct: 99 | * BDF_PropertyRec 100 | * 101 | * @description: 102 | * This structure models a given BDF/PCF property. 103 | * 104 | * @fields: 105 | * type :: 106 | * The property type. 107 | * 108 | * u.atom :: 109 | * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be 110 | * NULL, indicating an empty string. 111 | * 112 | * u.integer :: 113 | * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER. 114 | * 115 | * u.cardinal :: 116 | * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL. 117 | */ 118 | typedef struct BDF_PropertyRec_ 119 | { 120 | BDF_PropertyType type; 121 | union { 122 | const char* atom; 123 | FT_Int32 integer; 124 | FT_UInt32 cardinal; 125 | 126 | } u; 127 | 128 | } BDF_PropertyRec; 129 | 130 | 131 | /********************************************************************** 132 | * 133 | * @function: 134 | * FT_Get_BDF_Charset_ID 135 | * 136 | * @description: 137 | * Retrieve a BDF font character set identity, according to 138 | * the BDF specification. 139 | * 140 | * @input: 141 | * face :: 142 | * A handle to the input face. 143 | * 144 | * @output: 145 | * acharset_encoding :: 146 | * Charset encoding, as a C~string, owned by the face. 147 | * 148 | * acharset_registry :: 149 | * Charset registry, as a C~string, owned by the face. 150 | * 151 | * @return: 152 | * FreeType error code. 0~means success. 153 | * 154 | * @note: 155 | * This function only works with BDF faces, returning an error otherwise. 156 | */ 157 | FT_EXPORT( FT_Error ) 158 | FT_Get_BDF_Charset_ID( FT_Face face, 159 | const char* *acharset_encoding, 160 | const char* *acharset_registry ); 161 | 162 | 163 | /********************************************************************** 164 | * 165 | * @function: 166 | * FT_Get_BDF_Property 167 | * 168 | * @description: 169 | * Retrieve a BDF property from a BDF or PCF font file. 170 | * 171 | * @input: 172 | * face :: A handle to the input face. 173 | * 174 | * name :: The property name. 175 | * 176 | * @output: 177 | * aproperty :: The property. 178 | * 179 | * @return: 180 | * FreeType error code. 0~means success. 181 | * 182 | * @note: 183 | * This function works with BDF _and_ PCF fonts. It returns an error 184 | * otherwise. It also returns an error if the property is not in the 185 | * font. 186 | * 187 | * A `property' is a either key-value pair within the STARTPROPERTIES 188 | * ... ENDPROPERTIES block of a BDF font or a key-value pair from the 189 | * `info->props' array within a `FontRec' structure of a PCF font. 190 | * 191 | * Integer properties are always stored as `signed' within PCF fonts; 192 | * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value 193 | * for BDF fonts only. 194 | * 195 | * In case of error, `aproperty->type' is always set to 196 | * @BDF_PROPERTY_TYPE_NONE. 197 | */ 198 | FT_EXPORT( FT_Error ) 199 | FT_Get_BDF_Property( FT_Face face, 200 | const char* prop_name, 201 | BDF_PropertyRec *aproperty ); 202 | 203 | /* */ 204 | 205 | FT_END_HEADER 206 | 207 | #endif /* FTBDF_H_ */ 208 | 209 | 210 | /* END */ 211 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftbzip2.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftbzip2.h */ 4 | /* */ 5 | /* Bzip2-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2010-2018 by */ 8 | /* Joel Klinghed. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTBZIP2_H_ 20 | #define FTBZIP2_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* bzip2 */ 38 | /* */ 39 | /* <Title> */ 40 | /* BZIP2 Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using bzip2-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of Bzip2-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | 51 | /************************************************************************ 52 | * 53 | * @function: 54 | * FT_Stream_OpenBzip2 55 | * 56 | * @description: 57 | * Open a new stream to parse bzip2-compressed font files. This is 58 | * mainly used to support the compressed `*.pcf.bz2' fonts that come 59 | * with XFree86. 60 | * 61 | * @input: 62 | * stream :: 63 | * The target embedding stream. 64 | * 65 | * source :: 66 | * The source stream. 67 | * 68 | * @return: 69 | * FreeType error code. 0~means success. 70 | * 71 | * @note: 72 | * The source stream must be opened _before_ calling this function. 73 | * 74 | * Calling the internal function `FT_Stream_Close' on the new stream will 75 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 76 | * objects will be released to the heap. 77 | * 78 | * The stream implementation is very basic and resets the decompression 79 | * process each time seeking backwards is needed within the stream. 80 | * 81 | * In certain builds of the library, bzip2 compression recognition is 82 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 83 | * This means that if no font driver is capable of handling the raw 84 | * compressed file, the library will try to open a bzip2 compressed stream 85 | * from it and re-open the face with it. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature' if your build 88 | * of FreeType was not compiled with bzip2 support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenBzip2( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | /* */ 95 | 96 | 97 | FT_END_HEADER 98 | 99 | #endif /* FTBZIP2_H_ */ 100 | 101 | 102 | /* END */ 103 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftcid.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftcid.h */ 4 | /* */ 5 | /* FreeType API for accessing CID font information (specification). */ 6 | /* */ 7 | /* Copyright 2007-2018 by */ 8 | /* Dereg Clegg and Michael Toftdal. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTCID_H_ 20 | #define FTCID_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* cid_fonts */ 39 | /* */ 40 | /* <Title> */ 41 | /* CID Fonts */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* CID-keyed font specific API. */ 45 | /* */ 46 | /* <Description> */ 47 | /* This section contains the declaration of CID-keyed font specific */ 48 | /* functions. */ 49 | /* */ 50 | /*************************************************************************/ 51 | 52 | 53 | /********************************************************************** 54 | * 55 | * @function: 56 | * FT_Get_CID_Registry_Ordering_Supplement 57 | * 58 | * @description: 59 | * Retrieve the Registry/Ordering/Supplement triple (also known as the 60 | * "R/O/S") from a CID-keyed font. 61 | * 62 | * @input: 63 | * face :: 64 | * A handle to the input face. 65 | * 66 | * @output: 67 | * registry :: 68 | * The registry, as a C~string, owned by the face. 69 | * 70 | * ordering :: 71 | * The ordering, as a C~string, owned by the face. 72 | * 73 | * supplement :: 74 | * The supplement. 75 | * 76 | * @return: 77 | * FreeType error code. 0~means success. 78 | * 79 | * @note: 80 | * This function only works with CID faces, returning an error 81 | * otherwise. 82 | * 83 | * @since: 84 | * 2.3.6 85 | */ 86 | FT_EXPORT( FT_Error ) 87 | FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, 88 | const char* *registry, 89 | const char* *ordering, 90 | FT_Int *supplement ); 91 | 92 | 93 | /********************************************************************** 94 | * 95 | * @function: 96 | * FT_Get_CID_Is_Internally_CID_Keyed 97 | * 98 | * @description: 99 | * Retrieve the type of the input face, CID keyed or not. In 100 | * contrast to the @FT_IS_CID_KEYED macro this function returns 101 | * successfully also for CID-keyed fonts in an SFNT wrapper. 102 | * 103 | * @input: 104 | * face :: 105 | * A handle to the input face. 106 | * 107 | * @output: 108 | * is_cid :: 109 | * The type of the face as an @FT_Bool. 110 | * 111 | * @return: 112 | * FreeType error code. 0~means success. 113 | * 114 | * @note: 115 | * This function only works with CID faces and OpenType fonts, 116 | * returning an error otherwise. 117 | * 118 | * @since: 119 | * 2.3.9 120 | */ 121 | FT_EXPORT( FT_Error ) 122 | FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, 123 | FT_Bool *is_cid ); 124 | 125 | 126 | /********************************************************************** 127 | * 128 | * @function: 129 | * FT_Get_CID_From_Glyph_Index 130 | * 131 | * @description: 132 | * Retrieve the CID of the input glyph index. 133 | * 134 | * @input: 135 | * face :: 136 | * A handle to the input face. 137 | * 138 | * glyph_index :: 139 | * The input glyph index. 140 | * 141 | * @output: 142 | * cid :: 143 | * The CID as an @FT_UInt. 144 | * 145 | * @return: 146 | * FreeType error code. 0~means success. 147 | * 148 | * @note: 149 | * This function only works with CID faces and OpenType fonts, 150 | * returning an error otherwise. 151 | * 152 | * @since: 153 | * 2.3.9 154 | */ 155 | FT_EXPORT( FT_Error ) 156 | FT_Get_CID_From_Glyph_Index( FT_Face face, 157 | FT_UInt glyph_index, 158 | FT_UInt *cid ); 159 | 160 | /* */ 161 | 162 | 163 | FT_END_HEADER 164 | 165 | #endif /* FTCID_H_ */ 166 | 167 | 168 | /* END */ 169 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftfntfmt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftfntfmt.h */ 4 | /* */ 5 | /* Support functions for font formats. */ 6 | /* */ 7 | /* Copyright 2002-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTFNTFMT_H_ 20 | #define FTFNTFMT_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* font_formats */ 39 | /* */ 40 | /* <Title> */ 41 | /* Font Formats */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* Getting the font format. */ 45 | /* */ 46 | /* <Description> */ 47 | /* The single function in this section can be used to get the font */ 48 | /* format. Note that this information is not needed normally; */ 49 | /* however, there are special cases (like in PDF devices) where it is */ 50 | /* important to differentiate, in spite of FreeType's uniform API. */ 51 | /* */ 52 | /*************************************************************************/ 53 | 54 | 55 | /*************************************************************************/ 56 | /* */ 57 | /* <Function> */ 58 | /* FT_Get_Font_Format */ 59 | /* */ 60 | /* <Description> */ 61 | /* Return a string describing the format of a given face. Possible */ 62 | /* values are `TrueType', `Type~1', `BDF', `PCF', `Type~42', */ 63 | /* `CID~Type~1', `CFF', `PFR', and `Windows~FNT'. */ 64 | /* */ 65 | /* The return value is suitable to be used as an X11 FONT_PROPERTY. */ 66 | /* */ 67 | /* <Input> */ 68 | /* face :: */ 69 | /* Input face handle. */ 70 | /* */ 71 | /* <Return> */ 72 | /* Font format string. NULL in case of error. */ 73 | /* */ 74 | /* <Note> */ 75 | /* A deprecated name for the same function is */ 76 | /* `FT_Get_X11_Font_Format'. */ 77 | /* */ 78 | FT_EXPORT( const char* ) 79 | FT_Get_Font_Format( FT_Face face ); 80 | 81 | 82 | /* deprecated */ 83 | FT_EXPORT( const char* ) 84 | FT_Get_X11_Font_Format( FT_Face face ); 85 | 86 | 87 | /* */ 88 | 89 | 90 | FT_END_HEADER 91 | 92 | #endif /* FTFNTFMT_H_ */ 93 | 94 | 95 | /* END */ 96 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftgasp.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgasp.h */ 4 | /* */ 5 | /* Access of TrueType's `gasp' table (specification). */ 6 | /* */ 7 | /* Copyright 2007-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTGASP_H_ 20 | #define FTGASP_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************** 36 | * 37 | * @section: 38 | * gasp_table 39 | * 40 | * @title: 41 | * Gasp Table 42 | * 43 | * @abstract: 44 | * Retrieving TrueType `gasp' table entries. 45 | * 46 | * @description: 47 | * The function @FT_Get_Gasp can be used to query a TrueType or OpenType 48 | * font for specific entries in its `gasp' table, if any. This is 49 | * mainly useful when implementing native TrueType hinting with the 50 | * bytecode interpreter to duplicate the Windows text rendering results. 51 | */ 52 | 53 | /************************************************************************* 54 | * 55 | * @enum: 56 | * FT_GASP_XXX 57 | * 58 | * @description: 59 | * A list of values and/or bit-flags returned by the @FT_Get_Gasp 60 | * function. 61 | * 62 | * @values: 63 | * FT_GASP_NO_TABLE :: 64 | * This special value means that there is no GASP table in this face. 65 | * It is up to the client to decide what to do. 66 | * 67 | * FT_GASP_DO_GRIDFIT :: 68 | * Grid-fitting and hinting should be performed at the specified ppem. 69 | * This *really* means TrueType bytecode interpretation. If this bit 70 | * is not set, no hinting gets applied. 71 | * 72 | * FT_GASP_DO_GRAY :: 73 | * Anti-aliased rendering should be performed at the specified ppem. 74 | * If not set, do monochrome rendering. 75 | * 76 | * FT_GASP_SYMMETRIC_SMOOTHING :: 77 | * If set, smoothing along multiple axes must be used with ClearType. 78 | * 79 | * FT_GASP_SYMMETRIC_GRIDFIT :: 80 | * Grid-fitting must be used with ClearType's symmetric smoothing. 81 | * 82 | * @note: 83 | * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be 84 | * used for standard font rasterization only. Independently of that, 85 | * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to 86 | * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and 87 | * `FT_GASP_DO_GRAY' are consequently ignored). 88 | * 89 | * `ClearType' is Microsoft's implementation of LCD rendering, partly 90 | * protected by patents. 91 | * 92 | * @since: 93 | * 2.3.0 94 | */ 95 | #define FT_GASP_NO_TABLE -1 96 | #define FT_GASP_DO_GRIDFIT 0x01 97 | #define FT_GASP_DO_GRAY 0x02 98 | #define FT_GASP_SYMMETRIC_GRIDFIT 0x04 99 | #define FT_GASP_SYMMETRIC_SMOOTHING 0x08 100 | 101 | 102 | /************************************************************************* 103 | * 104 | * @func: 105 | * FT_Get_Gasp 106 | * 107 | * @description: 108 | * For a TrueType or OpenType font file, return the rasterizer behaviour 109 | * flags from the font's `gasp' table corresponding to a given 110 | * character pixel size. 111 | * 112 | * @input: 113 | * face :: The source face handle. 114 | * 115 | * ppem :: The vertical character pixel size. 116 | * 117 | * @return: 118 | * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no 119 | * `gasp' table in the face. 120 | * 121 | * @note: 122 | * If you want to use the MM functionality of OpenType variation fonts 123 | * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this 124 | * function *after* setting an instance since the return values can 125 | * change. 126 | * 127 | * @since: 128 | * 2.3.0 129 | */ 130 | FT_EXPORT( FT_Int ) 131 | FT_Get_Gasp( FT_Face face, 132 | FT_UInt ppem ); 133 | 134 | /* */ 135 | 136 | 137 | FT_END_HEADER 138 | 139 | #endif /* FTGASP_H_ */ 140 | 141 | 142 | /* END */ 143 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftgzip.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftgzip.h */ 4 | /* */ 5 | /* Gzip-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2002-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTGZIP_H_ 20 | #define FTGZIP_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* gzip */ 38 | /* */ 39 | /* <Title> */ 40 | /* GZIP Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using gzip-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of Gzip-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | 51 | /************************************************************************ 52 | * 53 | * @function: 54 | * FT_Stream_OpenGzip 55 | * 56 | * @description: 57 | * Open a new stream to parse gzip-compressed font files. This is 58 | * mainly used to support the compressed `*.pcf.gz' fonts that come 59 | * with XFree86. 60 | * 61 | * @input: 62 | * stream :: 63 | * The target embedding stream. 64 | * 65 | * source :: 66 | * The source stream. 67 | * 68 | * @return: 69 | * FreeType error code. 0~means success. 70 | * 71 | * @note: 72 | * The source stream must be opened _before_ calling this function. 73 | * 74 | * Calling the internal function `FT_Stream_Close' on the new stream will 75 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 76 | * objects will be released to the heap. 77 | * 78 | * The stream implementation is very basic and resets the decompression 79 | * process each time seeking backwards is needed within the stream. 80 | * 81 | * In certain builds of the library, gzip compression recognition is 82 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 83 | * This means that if no font driver is capable of handling the raw 84 | * compressed file, the library will try to open a gzipped stream from 85 | * it and re-open the face with it. 86 | * 87 | * This function may return `FT_Err_Unimplemented_Feature' if your build 88 | * of FreeType was not compiled with zlib support. 89 | */ 90 | FT_EXPORT( FT_Error ) 91 | FT_Stream_OpenGzip( FT_Stream stream, 92 | FT_Stream source ); 93 | 94 | 95 | /************************************************************************ 96 | * 97 | * @function: 98 | * FT_Gzip_Uncompress 99 | * 100 | * @description: 101 | * Decompress a zipped input buffer into an output buffer. This function 102 | * is modeled after zlib's `uncompress' function. 103 | * 104 | * @input: 105 | * memory :: 106 | * A FreeType memory handle. 107 | * 108 | * input :: 109 | * The input buffer. 110 | * 111 | * input_len :: 112 | * The length of the input buffer. 113 | * 114 | * @output: 115 | * output:: 116 | * The output buffer. 117 | * 118 | * @inout: 119 | * output_len :: 120 | * Before calling the function, this is the total size of the output 121 | * buffer, which must be large enough to hold the entire uncompressed 122 | * data (so the size of the uncompressed data must be known in 123 | * advance). After calling the function, `output_len' is the size of 124 | * the used data in `output'. 125 | * 126 | * @return: 127 | * FreeType error code. 0~means success. 128 | * 129 | * @note: 130 | * This function may return `FT_Err_Unimplemented_Feature' if your build 131 | * of FreeType was not compiled with zlib support. 132 | * 133 | * @since: 134 | * 2.5.1 135 | */ 136 | FT_EXPORT( FT_Error ) 137 | FT_Gzip_Uncompress( FT_Memory memory, 138 | FT_Byte* output, 139 | FT_ULong* output_len, 140 | const FT_Byte* input, 141 | FT_ULong input_len ); 142 | 143 | /* */ 144 | 145 | 146 | FT_END_HEADER 147 | 148 | #endif /* FTGZIP_H_ */ 149 | 150 | 151 | /* END */ 152 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftlzw.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftlzw.h */ 4 | /* */ 5 | /* LZW-compressed stream support. */ 6 | /* */ 7 | /* Copyright 2004-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTLZW_H_ 20 | #define FTLZW_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | /*************************************************************************/ 35 | /* */ 36 | /* <Section> */ 37 | /* lzw */ 38 | /* */ 39 | /* <Title> */ 40 | /* LZW Streams */ 41 | /* */ 42 | /* <Abstract> */ 43 | /* Using LZW-compressed font files. */ 44 | /* */ 45 | /* <Description> */ 46 | /* This section contains the declaration of LZW-specific functions. */ 47 | /* */ 48 | /*************************************************************************/ 49 | 50 | /************************************************************************ 51 | * 52 | * @function: 53 | * FT_Stream_OpenLZW 54 | * 55 | * @description: 56 | * Open a new stream to parse LZW-compressed font files. This is 57 | * mainly used to support the compressed `*.pcf.Z' fonts that come 58 | * with XFree86. 59 | * 60 | * @input: 61 | * stream :: The target embedding stream. 62 | * 63 | * source :: The source stream. 64 | * 65 | * @return: 66 | * FreeType error code. 0~means success. 67 | * 68 | * @note: 69 | * The source stream must be opened _before_ calling this function. 70 | * 71 | * Calling the internal function `FT_Stream_Close' on the new stream will 72 | * *not* call `FT_Stream_Close' on the source stream. None of the stream 73 | * objects will be released to the heap. 74 | * 75 | * The stream implementation is very basic and resets the decompression 76 | * process each time seeking backwards is needed within the stream 77 | * 78 | * In certain builds of the library, LZW compression recognition is 79 | * automatically handled when calling @FT_New_Face or @FT_Open_Face. 80 | * This means that if no font driver is capable of handling the raw 81 | * compressed file, the library will try to open a LZW stream from it 82 | * and re-open the face with it. 83 | * 84 | * This function may return `FT_Err_Unimplemented_Feature' if your build 85 | * of FreeType was not compiled with LZW support. 86 | */ 87 | FT_EXPORT( FT_Error ) 88 | FT_Stream_OpenLZW( FT_Stream stream, 89 | FT_Stream source ); 90 | 91 | /* */ 92 | 93 | 94 | FT_END_HEADER 95 | 96 | #endif /* FTLZW_H_ */ 97 | 98 | 99 | /* END */ 100 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftparams.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftparams.h */ 4 | /* */ 5 | /* FreeType API for possible FT_Parameter tags (specification only). */ 6 | /* */ 7 | /* Copyright 2017-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTPARAMS_H_ 20 | #define FTPARAMS_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /************************************************************************** 36 | * 37 | * @section: 38 | * parameter_tags 39 | * 40 | * @title: 41 | * Parameter Tags 42 | * 43 | * @abstract: 44 | * Macros for driver property and font loading parameter tags. 45 | * 46 | * @description: 47 | * This section contains macros for the @FT_Parameter structure that are 48 | * used with various functions to activate some special functionality or 49 | * different behaviour of various components of FreeType. 50 | * 51 | */ 52 | 53 | 54 | /*************************************************************************** 55 | * 56 | * @constant: 57 | * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY 58 | * 59 | * @description: 60 | * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic 61 | * family names in the `name' table (introduced in OpenType version 62 | * 1.4). Use this for backward compatibility with legacy systems that 63 | * have a four-faces-per-family restriction. 64 | * 65 | * @since: 66 | * 2.8 67 | * 68 | */ 69 | #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \ 70 | FT_MAKE_TAG( 'i', 'g', 'p', 'f' ) 71 | 72 | 73 | /* this constant is deprecated */ 74 | #define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \ 75 | FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY 76 | 77 | 78 | /*************************************************************************** 79 | * 80 | * @constant: 81 | * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY 82 | * 83 | * @description: 84 | * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic 85 | * subfamily names in the `name' table (introduced in OpenType version 86 | * 1.4). Use this for backward compatibility with legacy systems that 87 | * have a four-faces-per-family restriction. 88 | * 89 | * @since: 90 | * 2.8 91 | * 92 | */ 93 | #define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \ 94 | FT_MAKE_TAG( 'i', 'g', 'p', 's' ) 95 | 96 | 97 | /* this constant is deprecated */ 98 | #define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \ 99 | FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY 100 | 101 | 102 | /*************************************************************************** 103 | * 104 | * @constant: 105 | * FT_PARAM_TAG_INCREMENTAL 106 | * 107 | * @description: 108 | * An @FT_Parameter tag to be used with @FT_Open_Face to indicate 109 | * incremental glyph loading. 110 | * 111 | */ 112 | #define FT_PARAM_TAG_INCREMENTAL \ 113 | FT_MAKE_TAG( 'i', 'n', 'c', 'r' ) 114 | 115 | 116 | /************************************************************************** 117 | * 118 | * @constant: 119 | * FT_PARAM_TAG_LCD_FILTER_WEIGHTS 120 | * 121 | * @description: 122 | * An @FT_Parameter tag to be used with @FT_Face_Properties. The 123 | * corresponding argument specifies the five LCD filter weights for a 124 | * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding 125 | * the global default values or the values set up with 126 | * @FT_Library_SetLcdFilterWeights. 127 | * 128 | * @since: 129 | * 2.8 130 | * 131 | */ 132 | #define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \ 133 | FT_MAKE_TAG( 'l', 'c', 'd', 'f' ) 134 | 135 | 136 | /************************************************************************** 137 | * 138 | * @constant: 139 | * FT_PARAM_TAG_RANDOM_SEED 140 | * 141 | * @description: 142 | * An @FT_Parameter tag to be used with @FT_Face_Properties. The 143 | * corresponding 32bit signed integer argument overrides the font 144 | * driver's random seed value with a face-specific one; see 145 | * @random-seed. 146 | * 147 | * @since: 148 | * 2.8 149 | * 150 | */ 151 | #define FT_PARAM_TAG_RANDOM_SEED \ 152 | FT_MAKE_TAG( 's', 'e', 'e', 'd' ) 153 | 154 | 155 | /************************************************************************** 156 | * 157 | * @constant: 158 | * FT_PARAM_TAG_STEM_DARKENING 159 | * 160 | * @description: 161 | * An @FT_Parameter tag to be used with @FT_Face_Properties. The 162 | * corresponding Boolean argument specifies whether to apply stem 163 | * darkening, overriding the global default values or the values set up 164 | * with @FT_Property_Set (see @no-stem-darkening). 165 | * 166 | * This is a passive setting that only takes effect if the font driver 167 | * or autohinter honors it, which the CFF, Type~1, and CID drivers 168 | * always do, but the autohinter only in `light' hinting mode (as of 169 | * version 2.9). 170 | * 171 | * @since: 172 | * 2.8 173 | * 174 | */ 175 | #define FT_PARAM_TAG_STEM_DARKENING \ 176 | FT_MAKE_TAG( 'd', 'a', 'r', 'k' ) 177 | 178 | 179 | /*************************************************************************** 180 | * 181 | * @constant: 182 | * FT_PARAM_TAG_UNPATENTED_HINTING 183 | * 184 | * @description: 185 | * Deprecated, no effect. 186 | * 187 | * Previously: A constant used as the tag of an @FT_Parameter structure to 188 | * indicate that unpatented methods only should be used by the TrueType 189 | * bytecode interpreter for a typeface opened by @FT_Open_Face. 190 | * 191 | */ 192 | #define FT_PARAM_TAG_UNPATENTED_HINTING \ 193 | FT_MAKE_TAG( 'u', 'n', 'p', 'a' ) 194 | 195 | 196 | /* */ 197 | 198 | 199 | FT_END_HEADER 200 | 201 | 202 | #endif /* FTPARAMS_H_ */ 203 | 204 | 205 | /* END */ 206 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftpfr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftpfr.h */ 4 | /* */ 5 | /* FreeType API for accessing PFR-specific data (specification only). */ 6 | /* */ 7 | /* Copyright 2002-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef FTPFR_H_ 20 | #define FTPFR_H_ 21 | 22 | #include <ft2build.h> 23 | #include FT_FREETYPE_H 24 | 25 | #ifdef FREETYPE_H 26 | #error "freetype.h of FreeType 1 has been loaded!" 27 | #error "Please fix the directory search order for header files" 28 | #error "so that freetype.h of FreeType 2 is found first." 29 | #endif 30 | 31 | 32 | FT_BEGIN_HEADER 33 | 34 | 35 | /*************************************************************************/ 36 | /* */ 37 | /* <Section> */ 38 | /* pfr_fonts */ 39 | /* */ 40 | /* <Title> */ 41 | /* PFR Fonts */ 42 | /* */ 43 | /* <Abstract> */ 44 | /* PFR/TrueDoc specific API. */ 45 | /* */ 46 | /* <Description> */ 47 | /* This section contains the declaration of PFR-specific functions. */ 48 | /* */ 49 | /*************************************************************************/ 50 | 51 | 52 | /********************************************************************** 53 | * 54 | * @function: 55 | * FT_Get_PFR_Metrics 56 | * 57 | * @description: 58 | * Return the outline and metrics resolutions of a given PFR face. 59 | * 60 | * @input: 61 | * face :: Handle to the input face. It can be a non-PFR face. 62 | * 63 | * @output: 64 | * aoutline_resolution :: 65 | * Outline resolution. This is equivalent to `face->units_per_EM' 66 | * for non-PFR fonts. Optional (parameter can be NULL). 67 | * 68 | * ametrics_resolution :: 69 | * Metrics resolution. This is equivalent to `outline_resolution' 70 | * for non-PFR fonts. Optional (parameter can be NULL). 71 | * 72 | * ametrics_x_scale :: 73 | * A 16.16 fixed-point number used to scale distance expressed 74 | * in metrics units to device subpixels. This is equivalent to 75 | * `face->size->x_scale', but for metrics only. Optional (parameter 76 | * can be NULL). 77 | * 78 | * ametrics_y_scale :: 79 | * Same as `ametrics_x_scale' but for the vertical direction. 80 | * optional (parameter can be NULL). 81 | * 82 | * @return: 83 | * FreeType error code. 0~means success. 84 | * 85 | * @note: 86 | * If the input face is not a PFR, this function will return an error. 87 | * However, in all cases, it will return valid values. 88 | */ 89 | FT_EXPORT( FT_Error ) 90 | FT_Get_PFR_Metrics( FT_Face face, 91 | FT_UInt *aoutline_resolution, 92 | FT_UInt *ametrics_resolution, 93 | FT_Fixed *ametrics_x_scale, 94 | FT_Fixed *ametrics_y_scale ); 95 | 96 | 97 | /********************************************************************** 98 | * 99 | * @function: 100 | * FT_Get_PFR_Kerning 101 | * 102 | * @description: 103 | * Return the kerning pair corresponding to two glyphs in a PFR face. 104 | * The distance is expressed in metrics units, unlike the result of 105 | * @FT_Get_Kerning. 106 | * 107 | * @input: 108 | * face :: A handle to the input face. 109 | * 110 | * left :: Index of the left glyph. 111 | * 112 | * right :: Index of the right glyph. 113 | * 114 | * @output: 115 | * avector :: A kerning vector. 116 | * 117 | * @return: 118 | * FreeType error code. 0~means success. 119 | * 120 | * @note: 121 | * This function always return distances in original PFR metrics 122 | * units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED 123 | * mode, which always returns distances converted to outline units. 124 | * 125 | * You can use the value of the `x_scale' and `y_scale' parameters 126 | * returned by @FT_Get_PFR_Metrics to scale these to device subpixels. 127 | */ 128 | FT_EXPORT( FT_Error ) 129 | FT_Get_PFR_Kerning( FT_Face face, 130 | FT_UInt left, 131 | FT_UInt right, 132 | FT_Vector *avector ); 133 | 134 | 135 | /********************************************************************** 136 | * 137 | * @function: 138 | * FT_Get_PFR_Advance 139 | * 140 | * @description: 141 | * Return a given glyph advance, expressed in original metrics units, 142 | * from a PFR font. 143 | * 144 | * @input: 145 | * face :: A handle to the input face. 146 | * 147 | * gindex :: The glyph index. 148 | * 149 | * @output: 150 | * aadvance :: The glyph advance in metrics units. 151 | * 152 | * @return: 153 | * FreeType error code. 0~means success. 154 | * 155 | * @note: 156 | * You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics 157 | * to convert the advance to device subpixels (i.e., 1/64th of pixels). 158 | */ 159 | FT_EXPORT( FT_Error ) 160 | FT_Get_PFR_Advance( FT_Face face, 161 | FT_UInt gindex, 162 | FT_Pos *aadvance ); 163 | 164 | /* */ 165 | 166 | 167 | FT_END_HEADER 168 | 169 | #endif /* FTPFR_H_ */ 170 | 171 | 172 | /* END */ 173 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/ftsynth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ftsynth.h */ 4 | /* */ 5 | /* FreeType synthesizing code for emboldening and slanting */ 6 | /* (specification). */ 7 | /* */ 8 | /* Copyright 2000-2018 by */ 9 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 10 | /* */ 11 | /* This file is part of the FreeType project, and may only be used, */ 12 | /* modified, and distributed under the terms of the FreeType project */ 13 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 14 | /* this file you indicate that you have read the license and */ 15 | /* understand and accept it fully. */ 16 | /* */ 17 | /***************************************************************************/ 18 | 19 | 20 | /*************************************************************************/ 21 | /*************************************************************************/ 22 | /*************************************************************************/ 23 | /*************************************************************************/ 24 | /*************************************************************************/ 25 | /********* *********/ 26 | /********* WARNING, THIS IS ALPHA CODE! THIS API *********/ 27 | /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/ 28 | /********* FREETYPE DEVELOPMENT TEAM *********/ 29 | /********* *********/ 30 | /*************************************************************************/ 31 | /*************************************************************************/ 32 | /*************************************************************************/ 33 | /*************************************************************************/ 34 | /*************************************************************************/ 35 | 36 | 37 | /* Main reason for not lifting the functions in this module to a */ 38 | /* `standard' API is that the used parameters for emboldening and */ 39 | /* slanting are not configurable. Consider the functions as a */ 40 | /* code resource that should be copied into the application and */ 41 | /* adapted to the particular needs. */ 42 | 43 | 44 | #ifndef FTSYNTH_H_ 45 | #define FTSYNTH_H_ 46 | 47 | 48 | #include <ft2build.h> 49 | #include FT_FREETYPE_H 50 | 51 | #ifdef FREETYPE_H 52 | #error "freetype.h of FreeType 1 has been loaded!" 53 | #error "Please fix the directory search order for header files" 54 | #error "so that freetype.h of FreeType 2 is found first." 55 | #endif 56 | 57 | 58 | FT_BEGIN_HEADER 59 | 60 | /* Embolden a glyph by a `reasonable' value (which is highly a matter of */ 61 | /* taste). This function is actually a convenience function, providing */ 62 | /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ 63 | /* */ 64 | /* For emboldened outlines the height, width, and advance metrics are */ 65 | /* increased by the strength of the emboldening -- this even affects */ 66 | /* mono-width fonts! */ 67 | /* */ 68 | /* You can also call @FT_Outline_Get_CBox to get precise values. */ 69 | FT_EXPORT( void ) 70 | FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); 71 | 72 | /* Slant an outline glyph to the right by about 12 degrees. */ 73 | FT_EXPORT( void ) 74 | FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); 75 | 76 | /* */ 77 | 78 | 79 | FT_END_HEADER 80 | 81 | #endif /* FTSYNTH_H_ */ 82 | 83 | 84 | /* END */ 85 | -------------------------------------------------------------------------------- /libs/include/freetype2/freetype/tttags.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* tttags.h */ 4 | /* */ 5 | /* Tags for TrueType and OpenType tables (specification only). */ 6 | /* */ 7 | /* Copyright 1996-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | #ifndef TTAGS_H_ 20 | #define TTAGS_H_ 21 | 22 | 23 | #include <ft2build.h> 24 | #include FT_FREETYPE_H 25 | 26 | #ifdef FREETYPE_H 27 | #error "freetype.h of FreeType 1 has been loaded!" 28 | #error "Please fix the directory search order for header files" 29 | #error "so that freetype.h of FreeType 2 is found first." 30 | #endif 31 | 32 | 33 | FT_BEGIN_HEADER 34 | 35 | 36 | #define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) 37 | #define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) 38 | #define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) 39 | #define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' ) 40 | #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) 41 | #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) 42 | #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) 43 | #define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) 44 | #define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) 45 | #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) 46 | #define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' ) 47 | #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) 48 | #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) 49 | #define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) 50 | #define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) 51 | #define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) 52 | #define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) 53 | #define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) 54 | #define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) 55 | #define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' ) 56 | #define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' ) 57 | #define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) 58 | #define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) 59 | #define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) 60 | #define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) 61 | #define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) 62 | #define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) 63 | #define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) 64 | #define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) 65 | #define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' ) 66 | #define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) 67 | #define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) 68 | #define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) 69 | #define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) 70 | #define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) 71 | #define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' ) 72 | #define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) 73 | #define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' ) 74 | #define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) 75 | #define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) 76 | #define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' ) 77 | #define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' ) 78 | #define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) 79 | #define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' ) 80 | #define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) 81 | #define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) 82 | #define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' ) 83 | #define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' ) 84 | #define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' ) 85 | #define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) 86 | #define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' ) 87 | #define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) 88 | #define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) 89 | #define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) 90 | #define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' ) 91 | #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) 92 | #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) 93 | #define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' ) 94 | #define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' ) 95 | #define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' ) 96 | #define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' ) 97 | #define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' ) 98 | #define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) 99 | #define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) 100 | #define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) 101 | #define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) 102 | #define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' ) 103 | #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) 104 | #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) 105 | #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) 106 | #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) 107 | #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) 108 | 109 | /* used by "Keyboard.dfont" on legacy Mac OS X */ 110 | #define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) 111 | 112 | /* used by "LastResort.dfont" on legacy Mac OS X */ 113 | #define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' ) 114 | 115 | 116 | FT_END_HEADER 117 | 118 | #endif /* TTAGS_H_ */ 119 | 120 | 121 | /* END */ 122 | -------------------------------------------------------------------------------- /libs/include/freetype2/ft2build.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************/ 2 | /* */ 3 | /* ft2build.h */ 4 | /* */ 5 | /* FreeType 2 build and setup macros. */ 6 | /* */ 7 | /* Copyright 1996-2018 by */ 8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 | /* */ 10 | /* This file is part of the FreeType project, and may only be used, */ 11 | /* modified, and distributed under the terms of the FreeType project */ 12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 13 | /* this file you indicate that you have read the license and */ 14 | /* understand and accept it fully. */ 15 | /* */ 16 | /***************************************************************************/ 17 | 18 | 19 | /*************************************************************************/ 20 | /* */ 21 | /* This is the `entry point' for FreeType header file inclusions. It is */ 22 | /* the only header file which should be included directly; all other */ 23 | /* FreeType header files should be accessed with macro names (after */ 24 | /* including `ft2build.h'). */ 25 | /* */ 26 | /* A typical example is */ 27 | /* */ 28 | /* #include <ft2build.h> */ 29 | /* #include FT_FREETYPE_H */ 30 | /* */ 31 | /*************************************************************************/ 32 | 33 | 34 | #ifndef FT2BUILD_H_ 35 | #define FT2BUILD_H_ 36 | 37 | #include <freetype/config/ftheader.h> 38 | 39 | #endif /* FT2BUILD_H_ */ 40 | 41 | 42 | /* END */ 43 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB__inline.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /** 24 | * @file GRRLIB__inline.h 25 | * GRRLIB inline function prototypes. 26 | * Do not include GRRLIB__inline.h directly, include only GRRLIB.h. 27 | */ 28 | /** 29 | * @addtogroup AllFunc 30 | * @{ 31 | */ 32 | 33 | #ifndef __GRRLIB_H__ 34 | # error Do not include GRRLIB__inline.h directly, include only GRRLIB.h 35 | #endif 36 | 37 | #ifndef __GRRLIB_FNINLINE_H__ 38 | #define __GRRLIB_FNINLINE_H__ 39 | 40 | //============================================================================== 41 | // Prototypes for inlined functions 42 | //============================================================================== 43 | 44 | //------------------------------------------------------------------------------ 45 | // GRRLIB_clipping.h - Clipping control 46 | INLINE void GRRLIB_ClipReset (void); 47 | INLINE void GRRLIB_ClipDrawing (const int x, const int y, 48 | const int width, const int height); 49 | 50 | //------------------------------------------------------------------------------ 51 | // GRRLIB_collision.h - Collision detection 52 | INLINE bool GRRLIB_PtInRect (const int hotx, const int hoty, 53 | const int hotw, const int hoth, 54 | const int wpadx, const int wpady); 55 | 56 | INLINE bool GRRLIB_RectInRect (const int rect1x, const int rect1y, 57 | const int rect1w, const int rect1h, 58 | const int rect2x, const int rect2y, 59 | const int rect2w, const int rect2h); 60 | 61 | INLINE bool GRRLIB_RectOnRect (const int rect1x, const int rect1y, 62 | const int rect1w, const int rect1h, 63 | const int rect2x, const int rect2y, 64 | const int rect2w, const int rect2h); 65 | 66 | //------------------------------------------------------------------------------ 67 | // GRRLIB_fbComplex.h - 68 | INLINE void GRRLIB_NPlot (const guVector v[], const u32 color[], 69 | const long n); 70 | INLINE void GRRLIB_NGone (const guVector v[], const u32 color[], 71 | const long n); 72 | INLINE void GRRLIB_NGoneFilled (const guVector v[], const u32 color[], 73 | const long n); 74 | 75 | //------------------------------------------------------------------------------ 76 | // GRRLIB_fbGX.h - 77 | INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[], 78 | const long n, const u8 fmt); 79 | 80 | //------------------------------------------------------------------------------ 81 | // GRRLIB_fbSimple.h - 82 | INLINE void GRRLIB_FillScreen (const u32 color); 83 | INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color); 84 | INLINE void GRRLIB_Line (const f32 x1, const f32 y1, 85 | const f32 x2, const f32 y2, const u32 color); 86 | INLINE void GRRLIB_Rectangle (const f32 x, const f32 y, 87 | const f32 width, const f32 height, 88 | const u32 color, const bool filled); 89 | 90 | //------------------------------------------------------------------------------ 91 | // GRRLIB_handle.h - Texture handle manipulation 92 | INLINE void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y); 93 | INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled); 94 | 95 | //------------------------------------------------------------------------------ 96 | // GRRLIB_pixel.h - Pixel manipulation 97 | INLINE u32 GRRLIB_GetPixelFromtexImg (const int x, const int y, 98 | const GRRLIB_texImg *tex); 99 | 100 | INLINE void GRRLIB_SetPixelTotexImg (const int x, const int y, 101 | GRRLIB_texImg *tex, const u32 color); 102 | 103 | INLINE u32 GRRLIB_GetPixelFromFB (int x, int y); 104 | INLINE void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor); 105 | 106 | //------------------------------------------------------------------------------ 107 | // GRRLIB_settings.h - Rendering functions 108 | INLINE void GRRLIB_SetBlend (const GRRLIB_blendMode blendmode); 109 | INLINE GRRLIB_blendMode GRRLIB_GetBlend (void); 110 | INLINE void GRRLIB_SetAntiAliasing (const bool aa); 111 | INLINE bool GRRLIB_GetAntiAliasing (void); 112 | 113 | //------------------------------------------------------------------------------ 114 | // GRRLIB_texSetup.h - Create and setup textures 115 | INLINE GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h); 116 | INLINE void GRRLIB_ClearTex (GRRLIB_texImg* tex); 117 | INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex); 118 | INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex); 119 | 120 | //============================================================================== 121 | // Definitions of inlined functions 122 | //============================================================================== 123 | #include <grrlib/GRRLIB_clipping.h> // Clipping control 124 | #include <grrlib/GRRLIB_collision.h> // Collision detection 125 | #include <grrlib/GRRLIB_fbComplex.h> // Render to framebuffer: Complex primitives 126 | #include <grrlib/GRRLIB_fbGX.h> // Render to framebuffer: Simple GX wrapper 127 | #include <grrlib/GRRLIB_fbSimple.h> // Render to framebuffer: Simple primitives 128 | #include <grrlib/GRRLIB_handle.h> // Texture handle manipulation 129 | #include <grrlib/GRRLIB_pixel.h> // Pixel manipulation 130 | #include <grrlib/GRRLIB_settings.h> // GRRLIB Settings 131 | #include <grrlib/GRRLIB_texSetup.h> // Setup for textures 132 | 133 | #endif // __GRRLIB_FNINLINE_H__ 134 | /** @} */ // end of group 135 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_cExtn.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2010 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_cExtn.h 25 | * Inline functions to offer additional C primitives. 26 | */ 27 | 28 | #include <math.h> 29 | 30 | /** 31 | * A helper function for the YCbCr -> RGB conversion. 32 | * Clamps the given value into a range of 0 - 255 and thus preventing an overflow. 33 | * @param Value The value to clamp. Using float to increase the precision. This makes a full spectrum (0 - 255) possible. 34 | * @return Returns a clean, clamped unsigned char. 35 | */ 36 | INLINE 37 | u8 GRRLIB_ClampVar8 (f32 Value) { 38 | Value = roundf(Value); 39 | if (Value < 0) Value = 0; 40 | else if (Value > 255) Value = 255; 41 | 42 | return (u8)Value; 43 | } 44 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_clipping.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_clipping.h 25 | * Inline functions to control clipping. 26 | */ 27 | 28 | /** 29 | * Reset the clipping to normal. 30 | */ 31 | INLINE 32 | void GRRLIB_ClipReset (void) { 33 | GX_SetClipMode( GX_CLIP_ENABLE ); 34 | GX_SetScissor( 0, 0, rmode->fbWidth, rmode->efbHeight ); 35 | } 36 | 37 | /** 38 | * Clip the drawing area to an rectangle. 39 | * @param x The x-coordinate of the rectangle. 40 | * @param y The y-coordinate of the rectangle. 41 | * @param width The width of the rectangle. 42 | * @param height The height of the rectangle. 43 | */ 44 | INLINE 45 | void GRRLIB_ClipDrawing (const int x, const int y, 46 | const int width, const int height) { 47 | GX_SetClipMode( GX_CLIP_ENABLE ); 48 | GX_SetScissor( x, y, width, height ); 49 | } 50 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_collision.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_collision.h 25 | * Inline functions for collision detection. 26 | */ 27 | 28 | /** 29 | * Determine whether the specified point lies within the specified rectangle. 30 | * @param hotx Specifies the x-coordinate of the upper-left corner of the rectangle. 31 | * @param hoty Specifies the y-coordinate of the upper-left corner of the rectangle. 32 | * @param hotw The width of the rectangle. 33 | * @param hoth The height of the rectangle. 34 | * @param wpadx Specifies the x-coordinate of the point. 35 | * @param wpady Specifies the y-coordinate of the point. 36 | * @return If the specified point lies within the rectangle, the return value is true otherwise it's false. 37 | */ 38 | INLINE 39 | bool GRRLIB_PtInRect (const int hotx, const int hoty, 40 | const int hotw, const int hoth, 41 | const int wpadx, const int wpady) { 42 | return( ((wpadx>=hotx) && (wpadx<=(hotx+hotw))) && 43 | ((wpady>=hoty) && (wpady<=(hoty+hoth))) ); 44 | } 45 | 46 | /** 47 | * Determine whether a specified rectangle lies within another rectangle. 48 | * @param rect1x Specifies the x-coordinate of the upper-left corner of the rectangle. 49 | * @param rect1y Specifies the y-coordinate of the upper-left corner of the rectangle. 50 | * @param rect1w Specifies the width of the rectangle. 51 | * @param rect1h Specifies the height of the rectangle. 52 | * @param rect2x Specifies the x-coordinate of the upper-left corner of the rectangle. 53 | * @param rect2y Specifies the y-coordinate of the upper-left corner of the rectangle. 54 | * @param rect2w Specifies the width of the rectangle. 55 | * @param rect2h Specifies the height of the rectangle. 56 | * @return If the specified rectangle lies within the other rectangle, the return value is true otherwise it's false. 57 | */ 58 | INLINE 59 | bool GRRLIB_RectInRect (const int rect1x, const int rect1y, 60 | const int rect1w, const int rect1h, 61 | const int rect2x, const int rect2y, 62 | const int rect2w, const int rect2h) { 63 | return ( (rect1x >= rect2x) && (rect1y >= rect2y) && 64 | (rect1x+rect1w <= rect2x+rect2w) && 65 | (rect1y+rect1h <= rect2y+rect2h) ); 66 | } 67 | 68 | /** 69 | * Determine whether a part of a specified rectangle lies on another rectangle. 70 | * @param rect1x Specifies the x-coordinate of the upper-left corner of the first rectangle. 71 | * @param rect1y Specifies the y-coordinate of the upper-left corner of the first rectangle. 72 | * @param rect1w Specifies the width of the first rectangle. 73 | * @param rect1h Specifies the height of the first rectangle. 74 | * @param rect2x Specifies the x-coordinate of the upper-left corner of the second rectangle. 75 | * @param rect2y Specifies the y-coordinate of the upper-left corner of the second rectangle. 76 | * @param rect2w Specifies the width of the second rectangle. 77 | * @param rect2h Specifies the height of the second rectangle. 78 | * @return If the specified rectangle lies on the other rectangle, the return value is true otherwise it's false. 79 | */ 80 | INLINE 81 | bool GRRLIB_RectOnRect (const int rect1x, const int rect1y, 82 | const int rect1w, const int rect1h, 83 | const int rect2x, const int rect2y, 84 | const int rect2w, const int rect2h) { 85 | return GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y) || 86 | GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y) || 87 | GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x+rect2w, rect2y+rect2h) || 88 | GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y+rect2h); 89 | } 90 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_fbComplex.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_fbComplex.h 25 | * Inline functions for complex (N-point) shape drawing. 26 | */ 27 | 28 | /** 29 | * Draw an array of points. 30 | * @param v Array containing the points. 31 | * @param color The color of the points in RGBA format. 32 | * @param n Number of points in the vector array. 33 | */ 34 | INLINE 35 | void GRRLIB_NPlot (const guVector v[], const u32 color[], const long n) { 36 | GRRLIB_GXEngine(v, color, n, GX_POINTS); 37 | } 38 | 39 | /** 40 | * Draw a polygon. 41 | * @param v The vector containing the coordinates of the polygon. 42 | * @param color The color of the filled polygon in RGBA format. 43 | * @param n Number of points in the vector. 44 | */ 45 | INLINE 46 | void GRRLIB_NGone (const guVector v[], const u32 color[], const long n) { 47 | GRRLIB_GXEngine(v, color, n, GX_LINESTRIP); 48 | } 49 | 50 | /** 51 | * Draw a filled polygon. 52 | * @param v The vector containing the coordinates of the polygon. 53 | * @param color The color of the filled polygon in RGBA format. 54 | * @param n Number of points in the vector. 55 | */ 56 | INLINE 57 | void GRRLIB_NGoneFilled (const guVector v[], const u32 color[], const long n) { 58 | GRRLIB_GXEngine(v, color, n, GX_TRIANGLEFAN); 59 | } 60 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_fbGX.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_fbGX.h 25 | * Inline functions for interfacing directly to the GX Engine. 26 | */ 27 | 28 | /** 29 | * Draws a vector. 30 | * @param v The vector to draw. 31 | * @param color The color of the vector in RGBA format. 32 | * @param n Number of points in the vector. 33 | * @param fmt Type of primitive. 34 | */ 35 | INLINE 36 | void GRRLIB_GXEngine (const guVector v[], const u32 color[], const long n, 37 | const u8 fmt) { 38 | int i; 39 | 40 | GX_Begin(fmt, GX_VTXFMT0, n); 41 | for (i = 0; i < n; i++) { 42 | GX_Position3f32(v[i].x, v[i].y, v[i].z); 43 | GX_Color1u32(color[i]); 44 | } 45 | GX_End(); 46 | } 47 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_fbSimple.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_fbSimple.h 25 | * Inline functions for primitive point and line drawing. 26 | */ 27 | 28 | /** 29 | * Clear screen with a specific color. 30 | * @param color The color to use to fill the screen. 31 | */ 32 | INLINE 33 | void GRRLIB_FillScreen (const u32 color) { 34 | GRRLIB_Rectangle(-40.0f, -40.0f, rmode->fbWidth + 80.0f, rmode->xfbHeight + 80.0f, color, true); 35 | } 36 | 37 | /** 38 | * Draw a dot. 39 | * @param x Specifies the x-coordinate of the dot. 40 | * @param y Specifies the y-coordinate of the dot. 41 | * @param color The color of the dot in RGBA format. 42 | * @author Jespa 43 | */ 44 | INLINE 45 | void GRRLIB_Plot (const f32 x, const f32 y, const u32 color) { 46 | GX_Begin(GX_POINTS, GX_VTXFMT0, 1); 47 | GX_Position3f32(x, y, 0.0f); 48 | GX_Color1u32(color); 49 | GX_End(); 50 | } 51 | 52 | /** 53 | * Draw a line. 54 | * @param x1 Starting point for line for the x coordinate. 55 | * @param y1 Starting point for line for the y coordinate. 56 | * @param x2 Ending point for line for the x coordinate. 57 | * @param y2 Ending point for line for the x coordinate. 58 | * @param color Line color in RGBA format. 59 | * @author JESPA 60 | */ 61 | INLINE 62 | void GRRLIB_Line (const f32 x1, const f32 y1, 63 | const f32 x2, const f32 y2, const u32 color) { 64 | GX_Begin(GX_LINES, GX_VTXFMT0, 2); 65 | GX_Position3f32(x1, y1, 0.0f); 66 | GX_Color1u32(color); 67 | GX_Position3f32(x2, y2, 0.0f); 68 | GX_Color1u32(color); 69 | GX_End(); 70 | } 71 | 72 | /** 73 | * Draw a rectangle. 74 | * @param x Specifies the x-coordinate of the upper-left corner of the rectangle. 75 | * @param y Specifies the y-coordinate of the upper-left corner of the rectangle. 76 | * @param width The width of the rectangle. 77 | * @param height The height of the rectangle. 78 | * @param color The color of the rectangle in RGBA format. 79 | * @param filled Set to true to fill the rectangle. 80 | */ 81 | INLINE 82 | void GRRLIB_Rectangle (const f32 x, const f32 y, 83 | const f32 width, const f32 height, 84 | const u32 color, const bool filled) { 85 | f32 x2 = x + width; 86 | f32 y2 = y + height; 87 | 88 | if (filled) { 89 | GX_Begin(GX_QUADS, GX_VTXFMT0, 4); 90 | GX_Position3f32(x, y, 0.0f); 91 | GX_Color1u32(color); 92 | GX_Position3f32(x2, y, 0.0f); 93 | GX_Color1u32(color); 94 | GX_Position3f32(x2, y2, 0.0f); 95 | GX_Color1u32(color); 96 | GX_Position3f32(x, y2, 0.0f); 97 | GX_Color1u32(color); 98 | GX_End(); 99 | } 100 | else { 101 | GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 5); 102 | GX_Position3f32(x, y, 0.0f); 103 | GX_Color1u32(color); 104 | GX_Position3f32(x2, y, 0.0f); 105 | GX_Color1u32(color); 106 | GX_Position3f32(x2, y2, 0.0f); 107 | GX_Color1u32(color); 108 | GX_Position3f32(x, y2, 0.0f); 109 | GX_Color1u32(color); 110 | GX_Position3f32(x, y, 0.0f); 111 | GX_Color1u32(color); 112 | GX_End(); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_handle.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_handle.h 25 | * Inline functions for manipulating texture handles. 26 | */ 27 | 28 | /** 29 | * Set a texture's X and Y handles. 30 | * For example, it could be used for the rotation of a texture. 31 | * @param tex The texture to set the handle on. 32 | * @param x The x-coordinate of the handle. 33 | * @param y The y-coordinate of the handle. 34 | */ 35 | INLINE 36 | void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y) { 37 | if (tex->tiledtex) { 38 | tex->handlex = -(((int)tex->tilew)/2) + x; 39 | tex->handley = -(((int)tex->tileh)/2) + y; 40 | } else { 41 | tex->handlex = -(((int)tex->w)/2) + x; 42 | tex->handley = -(((int)tex->h)/2) + y; 43 | } 44 | } 45 | 46 | /** 47 | * Center a texture's handles. 48 | * For example, it could be used for the rotation of a texture. 49 | * @param tex The texture to center. 50 | * @param enabled 51 | */ 52 | INLINE 53 | void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled) { 54 | if (enabled) { 55 | if (tex->tiledtex) { 56 | tex->offsetx = (((int)tex->tilew)/2); 57 | tex->offsety = (((int)tex->tileh)/2); 58 | } else { 59 | tex->offsetx = (((int)tex->w)/2); 60 | tex->offsety = (((int)tex->h)/2); 61 | } 62 | GRRLIB_SetHandle(tex, tex->offsetx, tex->offsety); 63 | } else { 64 | GRRLIB_SetHandle(tex, 0, 0); 65 | tex->offsetx = 0; 66 | tex->offsety = 0; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_pixel.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_pixel.h 25 | * Inline functions for manipulating pixels in textures. 26 | */ 27 | 28 | #define _SHIFTL(v, s, w) \ 29 | ((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s))) 30 | #define _SHIFTR(v, s, w) \ 31 | ((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1))) 32 | 33 | /** 34 | * Return the color value of a pixel from a GRRLIB_texImg. 35 | * @param x Specifies the x-coordinate of the pixel in the texture. 36 | * @param y Specifies the y-coordinate of the pixel in the texture. 37 | * @param tex The texture to get the color from. 38 | * @return The color of a pixel in RGBA format. 39 | */ 40 | INLINE 41 | u32 GRRLIB_GetPixelFromtexImg (const int x, const int y, 42 | const GRRLIB_texImg *tex) { 43 | register u32 offs; 44 | register u32 ar; 45 | register u8* bp = (u8*)tex->data; 46 | 47 | offs = (((y&(~3))<<2)*tex->w) + ((x&(~3))<<4) + ((((y&3)<<2) + (x&3)) <<1); 48 | 49 | ar = (u32)(*((u16*)(bp+offs ))); 50 | return (ar<<24) | ( ((u32)(*((u16*)(bp+offs+32)))) <<8) | (ar>>8); // Wii is big-endian 51 | } 52 | 53 | /** 54 | * Set the color value of a pixel to a GRRLIB_texImg. 55 | * @see GRRLIB_FlushTex 56 | * @param x Specifies the x-coordinate of the pixel in the texture. 57 | * @param y Specifies the y-coordinate of the pixel in the texture. 58 | * @param tex The texture to set the color to. 59 | * @param color The color of the pixel in RGBA format. 60 | */ 61 | INLINE 62 | void GRRLIB_SetPixelTotexImg (const int x, const int y, 63 | GRRLIB_texImg *tex, const u32 color) { 64 | register u32 offs; 65 | register u8* bp = (u8*)tex->data; 66 | 67 | offs = (((y&(~3))<<2)*tex->w) + ((x&(~3))<<4) + ((((y&3)<<2) + (x&3)) <<1); 68 | 69 | *((u16*)(bp+offs )) = (u16)((color <<8) | (color >>24)); 70 | *((u16*)(bp+offs+32)) = (u16) (color >>8); 71 | } 72 | 73 | /** 74 | * Reads a pixel directly from the FrontBuffer. 75 | * @param x The x-coordinate within the FB. 76 | * @param y The y-coordinate within the FB. 77 | * @return The color of a pixel in RGBA format. 78 | */ 79 | INLINE 80 | u32 GRRLIB_GetPixelFromFB (int x, int y) { 81 | u32 regval,val; 82 | 83 | regval = 0xc8000000|(_SHIFTL(x,2,10)); 84 | regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10)); 85 | val = *(u32*)regval; 86 | 87 | return RGBA(_SHIFTR(val,16,8), _SHIFTR(val,8,8), val&0xff, _SHIFTR(val,24,8)); 88 | } 89 | 90 | /** 91 | * Writes a pixel directly from the FrontBuffer. 92 | * @param x The x-coordinate within the FB. 93 | * @param y The y-coordinate within the FB. 94 | * @param pokeColor The color of the pixel in RGBA format. 95 | */ 96 | INLINE 97 | void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor) { 98 | u32 regval; 99 | 100 | regval = 0xc8000000|(_SHIFTL(x,2,10)); 101 | regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10)); 102 | *(u32*)regval = _SHIFTL(A(pokeColor),24,8) | _SHIFTL(R(pokeColor),16,8) | _SHIFTL(G(pokeColor),8,8) | (B(pokeColor)&0xff); 103 | } 104 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_private.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_private.h 25 | * The symbols declared in this file are PRIVATE. 26 | * They are not part of the GRRLIB public 27 | * interface, and are not recommended for use by regular applications. 28 | * Some of them may become public in the future; others may stay private, 29 | * change in an incompatible way, or even disappear. 30 | */ 31 | 32 | #ifndef __GRRLIB_PRIVATE_H__ 33 | #define __GRRLIB_PRIVATE_H__ 34 | 35 | #include <ogc/libversion.h> 36 | 37 | /** 38 | * Used for version checking. 39 | * @param a Major version number. 40 | * @param b Minor version number. 41 | * @param c Revision version number. 42 | */ 43 | #define GRRLIB_VERSION(a,b,c) ((a)*65536+(b)*256+(c)) 44 | 45 | //------------------------------------------------------------------------------ 46 | // GRRLIB_ttf.c - FreeType function for GRRLIB 47 | int GRRLIB_InitTTF(); 48 | void GRRLIB_ExitTTF(); 49 | 50 | #endif // __GRRLIB_PRIVATE_H__ 51 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_settings.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_settings.h 25 | * Inline functions for configuring the GRRLIB settings. 26 | */ 27 | 28 | #ifndef GX_BM_SUBTRACT 29 | /** 30 | * Blending type. 31 | * libogc revision 4170 fixed a typographical error. GX_BM_SUBSTRACT was renamed GX_BM_SUBTRACT. 32 | * But for previous versions this define is needed. 33 | */ 34 | #define GX_BM_SUBTRACT GX_BM_SUBSTRACT 35 | #endif 36 | 37 | extern GRRLIB_drawSettings GRRLIB_Settings; 38 | 39 | /** 40 | * Set a blending mode. 41 | * @param blendmode The blending mode to use (Default: GRRLIB_BLEND_ALPHA). 42 | */ 43 | INLINE 44 | void GRRLIB_SetBlend (const GRRLIB_blendMode blendmode) { 45 | GRRLIB_Settings.blend = blendmode; 46 | switch (GRRLIB_Settings.blend) { 47 | case GRRLIB_BLEND_ALPHA: 48 | GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); 49 | break; 50 | case GRRLIB_BLEND_ADD: 51 | GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_DSTALPHA, GX_LO_CLEAR); 52 | break; 53 | case GRRLIB_BLEND_SCREEN: 54 | GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCCLR, GX_BL_DSTALPHA, GX_LO_CLEAR); 55 | break; 56 | case GRRLIB_BLEND_MULTI: 57 | GX_SetBlendMode(GX_BM_SUBTRACT, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); 58 | break; 59 | case GRRLIB_BLEND_INV: 60 | GX_SetBlendMode(GX_BM_BLEND, GX_BL_INVSRCCLR, GX_BL_INVSRCCLR, GX_LO_CLEAR); 61 | break; 62 | } 63 | } 64 | 65 | /** 66 | * Get the current blending mode. 67 | * @return The current blending mode. 68 | */ 69 | INLINE 70 | GRRLIB_blendMode GRRLIB_GetBlend (void) { 71 | return GRRLIB_Settings.blend; 72 | } 73 | 74 | /** 75 | * Turn anti-aliasing on/off. 76 | * @param aa Set to true to enable anti-aliasing (Default: Enabled). 77 | */ 78 | INLINE 79 | void GRRLIB_SetAntiAliasing (const bool aa) { 80 | GRRLIB_Settings.antialias = aa; 81 | } 82 | 83 | /** 84 | * Get current anti-aliasing setting. 85 | * @return True if anti-aliasing is enabled. 86 | */ 87 | INLINE 88 | bool GRRLIB_GetAntiAliasing (void) { 89 | return GRRLIB_Settings.antialias; 90 | } 91 | 92 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_texSetup.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2012 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | /* 24 | * @file GRRLIB_texSetup.h 25 | * Inline functions for the basic manipulation of textures. 26 | */ 27 | 28 | #include <malloc.h> 29 | #include <stdio.h> 30 | #include <string.h> 31 | 32 | /** 33 | * Create an empty texture. 34 | * @param w Width of the new texture to create. 35 | * @param h Height of the new texture to create. 36 | * @return A GRRLIB_texImg structure newly created. 37 | */ 38 | INLINE 39 | GRRLIB_texImg* GRRLIB_CreateEmptyTexture (const uint w, const uint h) 40 | { 41 | GRRLIB_texImg *my_texture = (struct GRRLIB_texImg *)calloc(1, sizeof(GRRLIB_texImg)); 42 | 43 | if(my_texture != NULL) { 44 | my_texture->data = memalign(32, h * w * 4); 45 | my_texture->w = w; 46 | my_texture->h = h; 47 | 48 | // Initialize the texture 49 | memset(my_texture->data, '\0', (h * w) << 2); 50 | 51 | GRRLIB_SetHandle(my_texture, 0, 0); 52 | GRRLIB_FlushTex(my_texture); 53 | } 54 | return my_texture; 55 | } 56 | 57 | /** 58 | * Write the contents of a texture in the data cache down to main memory. 59 | * For performance the CPU holds a data cache where modifications are stored before they get written down to main memory. 60 | * @param tex The texture to flush. 61 | */ 62 | INLINE 63 | void GRRLIB_FlushTex (GRRLIB_texImg *tex) { 64 | DCFlushRange(tex->data, tex->w * tex->h * 4); 65 | } 66 | 67 | /** 68 | * Free memory allocated for texture. 69 | * @param tex A GRRLIB_texImg structure. 70 | */ 71 | INLINE 72 | void GRRLIB_FreeTexture (GRRLIB_texImg *tex) { 73 | if(tex != NULL) { 74 | if (tex->data != NULL) free(tex->data); 75 | free(tex); 76 | tex = NULL; 77 | } 78 | } 79 | 80 | /** 81 | * Clear a texture to transparent black. 82 | * @param tex Texture to clear. 83 | */ 84 | INLINE 85 | void GRRLIB_ClearTex(GRRLIB_texImg* tex) { 86 | bzero(tex->data, (tex->h * tex->w) << 2); 87 | GRRLIB_FlushTex(tex); 88 | } 89 | -------------------------------------------------------------------------------- /libs/include/grrlib/GRRLIB_ttf.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | Copyright (c) 2010 The GRRLIB Team 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | ------------------------------------------------------------------------------*/ 22 | 23 | int GRRLIB_InitTTF(); 24 | void GRRLIB_ExitTTF(); 25 | -------------------------------------------------------------------------------- /libs/include/jconfig.h: -------------------------------------------------------------------------------- 1 | /* jconfig.h. Generated from jconfig.h.in by configure. */ 2 | /* Version ID for the JPEG library. 3 | * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". 4 | */ 5 | #define JPEG_LIB_VERSION 62 6 | 7 | /* libjpeg-turbo version */ 8 | #define LIBJPEG_TURBO_VERSION 1.5.3 9 | 10 | /* libjpeg-turbo version in integer form */ 11 | #define LIBJPEG_TURBO_VERSION_NUMBER 1005003 12 | 13 | /* Support arithmetic encoding */ 14 | #define C_ARITH_CODING_SUPPORTED 1 15 | 16 | /* Support arithmetic decoding */ 17 | #define D_ARITH_CODING_SUPPORTED 1 18 | 19 | /* 20 | * Define BITS_IN_JSAMPLE as either 21 | * 8 for 8-bit sample values (the usual setting) 22 | * 12 for 12-bit sample values 23 | * Only 8 and 12 are legal data precisions for lossy JPEG according to the 24 | * JPEG standard, and the IJG code does not support anything else! 25 | * We do not support run-time selection of data precision, sorry. 26 | */ 27 | 28 | #define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ 29 | 30 | /* Define to 1 if you have the <locale.h> header file. */ 31 | #define HAVE_LOCALE_H 1 32 | 33 | /* Define to 1 if you have the <stddef.h> header file. */ 34 | #define HAVE_STDDEF_H 1 35 | 36 | /* Define to 1 if you have the <stdlib.h> header file. */ 37 | #define HAVE_STDLIB_H 1 38 | 39 | /* Define to 1 if the system has the type `unsigned char'. */ 40 | #define HAVE_UNSIGNED_CHAR 1 41 | 42 | /* Define to 1 if the system has the type `unsigned short'. */ 43 | #define HAVE_UNSIGNED_SHORT 1 44 | 45 | /* Compiler does not support pointers to undefined structures. */ 46 | /* #undef INCOMPLETE_TYPES_BROKEN */ 47 | 48 | /* Support in-memory source/destination managers */ 49 | #define MEM_SRCDST_SUPPORTED 1 50 | 51 | /* Define if you have BSD-like bzero and bcopy in <strings.h> rather than 52 | memset/memcpy in <string.h>. */ 53 | /* #undef NEED_BSD_STRINGS */ 54 | 55 | /* Define if you need to include <sys/types.h> to get size_t. */ 56 | #define NEED_SYS_TYPES_H 1 57 | 58 | /* Define if your (broken) compiler shifts signed values as if they were 59 | unsigned. */ 60 | /* #undef RIGHT_SHIFT_IS_UNSIGNED */ 61 | 62 | /* Use accelerated SIMD routines. */ 63 | /* #undef WITH_SIMD */ 64 | 65 | /* Define to 1 if type `char' is unsigned and you are not using gcc. */ 66 | #ifndef __CHAR_UNSIGNED__ 67 | /* # undef __CHAR_UNSIGNED__ */ 68 | #endif 69 | 70 | /* Define to empty if `const' does not conform to ANSI C. */ 71 | /* #undef const */ 72 | 73 | /* Define to `unsigned int' if <sys/types.h> does not define. */ 74 | /* #undef size_t */ 75 | -------------------------------------------------------------------------------- /libs/lib/libCheckRegion.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libCheckRegion.a -------------------------------------------------------------------------------- /libs/lib/libbz2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libbz2.a -------------------------------------------------------------------------------- /libs/lib/libfreetype.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libfreetype.a -------------------------------------------------------------------------------- /libs/lib/libgrrlib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libgrrlib.a -------------------------------------------------------------------------------- /libs/lib/libjpeg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libjpeg.a -------------------------------------------------------------------------------- /libs/lib/libpng.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libpng.a -------------------------------------------------------------------------------- /libs/lib/libpngu.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libpngu.a -------------------------------------------------------------------------------- /libs/lib/libturbojpeg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libturbojpeg.a -------------------------------------------------------------------------------- /libs/lib/libz.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/7b981f6abb33d1e36806f8a050ebd87e4e0927dd/libs/lib/libz.a -------------------------------------------------------------------------------- /source/SysMenuInfo.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | detect_settings.c -- detects various system settings 4 | 5 | Copyright (C) 2008 tona 6 | Copyright (C) 2014 JoostinOnline 7 | Unless other credit specified 8 | 9 | This software is provided 'as-is', without any express or implied 10 | warranty. In no event will the authors be held liable for any 11 | damages arising from the use of this software. 12 | 13 | Permission is granted to anyone to use this software for any 14 | purpose, including commercial applications, and to alter it and 15 | redistribute it freely, subject to the following restrictions: 16 | 17 | 1.The origin of this software must not be misrepresented; you 18 | must not claim that you wrote the original software. If you use 19 | this software in a product, an acknowledgment in the product 20 | documentation would be appreciated but is not required. 21 | 22 | 2.Altered source versions must be plainly marked as such, and 23 | must not be misrepresented as being the original software. 24 | 25 | 3.This notice may not be removed or altered from any source 26 | distribution. 27 | 28 | -------------------------------------------------------------*/ 29 | #include <malloc.h> 30 | #include <stdio.h> 31 | #include <stdlib.h> 32 | #include <string.h> 33 | #include <gccore.h> 34 | #include <unistd.h> 35 | 36 | #include "SysMenuInfo.h" 37 | 38 | inline void *AllocateMemory(u32 size) { 39 | return memalign(32, round_up(size, 32)); 40 | } 41 | 42 | float GetSysMenuNintendoVersion(u32 sysVersion) 43 | { 44 | float ninVersion = 0.0; 45 | 46 | switch (sysVersion) 47 | { 48 | case 33: 49 | ninVersion = 1.0f; 50 | break; 51 | 52 | case 97: 53 | case 128: 54 | case 130: 55 | ninVersion = 2.0f; 56 | break; 57 | 58 | case 162: 59 | ninVersion = 2.1f; 60 | break; 61 | 62 | case 192: 63 | case 193: 64 | case 194: 65 | ninVersion = 2.2f; 66 | break; 67 | 68 | case 224: 69 | case 225: 70 | case 226: 71 | ninVersion = 3.0f; 72 | break; 73 | 74 | case 256: 75 | case 257: 76 | case 258: 77 | ninVersion = 3.1f; 78 | break; 79 | 80 | case 288: 81 | case 289: 82 | case 290: 83 | ninVersion = 3.2f; 84 | break; 85 | 86 | case 352: 87 | case 353: 88 | case 354: 89 | case 326: 90 | ninVersion = 3.3f; 91 | break; 92 | 93 | case 384: 94 | case 385: 95 | case 386: 96 | ninVersion = 3.4f; 97 | break; 98 | 99 | case 390: 100 | ninVersion = 3.5f; 101 | break; 102 | 103 | case 416: 104 | case 417: 105 | case 418: 106 | ninVersion = 4.0f; 107 | break; 108 | 109 | case 448: 110 | case 449: 111 | case 450: 112 | case 454: 113 | case 54448: // mauifrog's custom version 114 | case 54449: // mauifrog's custom version 115 | case 54450: // mauifrog's custom version 116 | case 54454: // mauifrog's custom version 117 | ninVersion = 4.1f; 118 | break; 119 | 120 | case 480: 121 | case 481: 122 | case 482: 123 | case 486: 124 | ninVersion = 4.2f; 125 | break; 126 | 127 | case 512: 128 | case 513: 129 | case 514: 130 | case 518: 131 | case 544: 132 | case 545: 133 | case 546: 134 | case 608: 135 | case 609: 136 | case 610: 137 | ninVersion = 4.3f; 138 | break; 139 | } 140 | 141 | return ninVersion; 142 | } 143 | 144 | char GetSysMenuRegion(u32 sysVersion) { 145 | switch(sysVersion) 146 | { 147 | case 1: //Pre-launch 148 | case 97: //2.0U 149 | case 193: //2.2U 150 | case 225: //3.0U 151 | case 257: //3.1U 152 | case 289: //3.2U 153 | case 353: //3.3U 154 | case 385: //3.4U 155 | case 417: //4.0U 156 | case 449: //4.1U 157 | case 54449: // mauifrog 4.1U 158 | case 481: //4.2U 159 | case 513: //4.3U 160 | case 545: 161 | case 609: 162 | return 'U'; 163 | break; 164 | case 130: //2.0E 165 | case 162: //2.1E 166 | case 194: //2.2E 167 | case 226: //3.0E 168 | case 258: //3.1E 169 | case 290: //3.2E 170 | case 354: //3.3E 171 | case 386: //3.4E 172 | case 418: //4.0E 173 | case 450: //4.1E 174 | case 54450: // mauifrog 4.1E 175 | case 482: //4.2E 176 | case 514: //4.3E 177 | case 546: 178 | case 610: 179 | return 'E'; 180 | break; 181 | case 128: //2.0J 182 | case 192: //2.2J 183 | case 224: //3.0J 184 | case 256: //3.1J 185 | case 288: //3.2J 186 | case 352: //3.3J 187 | case 384: //3.4J 188 | case 416: //4.0J 189 | case 448: //4.1J 190 | case 54448: // mauifrog 4.1J 191 | case 480: //4.2J 192 | case 512: //4.3J 193 | case 544: 194 | case 608: 195 | return 'J'; 196 | break; 197 | case 326: //3.3K 198 | case 390: //3.5K 199 | case 454: //4.1K 200 | case 54454: // mauifrog 4.1K 201 | case 486: //4.2K 202 | case 518: //4.3K 203 | return 'K'; 204 | break; 205 | } 206 | return 'X'; 207 | } 208 | 209 | // Get the system menu version from TMD 210 | u32 GetSysMenuVersion(void) 211 | { 212 | static u64 TitleID ATTRIBUTE_ALIGN(32) = 0x0000000100000002LL; 213 | static u32 tmdSize ATTRIBUTE_ALIGN(32); 214 | 215 | // Get the stored TMD size for the system menu 216 | if (ES_GetStoredTMDSize(TitleID, &tmdSize) < 0) return false; 217 | 218 | signed_blob *TMD = (signed_blob *)memalign(32, (tmdSize+32)&(~31)); 219 | memset(TMD, 0, tmdSize); 220 | 221 | // Get the stored TMD for the system menu 222 | if (ES_GetStoredTMD(TitleID, TMD, tmdSize) < 0) return false; 223 | 224 | // Get the system menu version from TMD 225 | tmd *rTMD = (tmd *)(TMD+(0x140/sizeof(tmd *))); 226 | u32 version = rTMD->title_version; 227 | 228 | free(TMD); 229 | 230 | // Return the system menu version 231 | return version; 232 | } 233 | -------------------------------------------------------------------------------- /source/fatMounter.c: -------------------------------------------------------------------------------- 1 | #include <fat.h> 2 | #include <gccore.h> 3 | #include <string.h> 4 | #include <sdcard/wiisd_io.h> 5 | #include <ogc/usbstorage.h> 6 | #include <stdio.h> 7 | #include <stdlib.h> 8 | #include <string.h> 9 | #include <unistd.h> 10 | #include <ogcsys.h> 11 | 12 | // These are the only stable and speed is good 13 | #define CACHE 8 14 | #define SECTORS 64 15 | #define BYTES_PER_READ 512 16 | 17 | extern DISC_INTERFACE __io_usbstorage; 18 | 19 | enum BPB 20 | { 21 | BPB_jmpBoot = 0x00, 22 | BPB_OEMName = 0x03, 23 | 24 | // BIOS Parameter Block 25 | BPB_bytesPerSector = 0x0B, 26 | BPB_sectorsPerCluster = 0x0D, 27 | BPB_reservedSectors = 0x0E, 28 | BPB_numFATs = 0x10, 29 | BPB_rootEntries = 0x11, 30 | BPB_numSectorsSmall = 0x13, 31 | BPB_mediaDesc = 0x15, 32 | BPB_sectorsPerFAT = 0x16, 33 | BPB_sectorsPerTrk = 0x18, 34 | BPB_numHeads = 0x1A, 35 | BPB_numHiddenSectors = 0x1C, 36 | BPB_numSectors = 0x20, 37 | 38 | // Ext BIOS Parameter Block for FAT16 39 | BPB_FAT16_driveNumber = 0x24, 40 | BPB_FAT16_reserved1 = 0x25, 41 | BPB_FAT16_extBootSig = 0x26, 42 | BPB_FAT16_volumeID = 0x27, 43 | BPB_FAT16_volumeLabel = 0x2B, 44 | BPB_FAT16_fileSysType = 0x36, 45 | 46 | // Bootcode 47 | BPB_FAT16_bootCode = 0x3E, 48 | 49 | // FAT32 Extended Block 50 | BPB_FAT32_sectorsPerFAT32 = 0x24, 51 | BPB_FAT32_extFlags = 0x28, 52 | BPB_FAT32_fsVer = 0x2A, 53 | BPB_FAT32_rootClus = 0x2C, 54 | BPB_FAT32_fsInfo = 0x30, 55 | BPB_FAT32_bkBootSec = 0x32, 56 | 57 | // Ext BIOS Parameter Block for FAT32 58 | BPB_FAT32_driveNumber = 0x40, 59 | BPB_FAT32_reserved1 = 0x41, 60 | BPB_FAT32_extBootSig = 0x42, 61 | BPB_FAT32_volumeID = 0x43, 62 | BPB_FAT32_volumeLabel = 0x47, 63 | BPB_FAT32_fileSysType = 0x52, 64 | 65 | // Bootcode 66 | BPB_FAT32_bootCode = 0x5A, 67 | BPB_bootSig_55 = 0x1FE, 68 | BPB_bootSig_AA = 0x1FF 69 | }; 70 | 71 | static const char FAT_SIG[3] = {'F', 'A', 'T'}; 72 | static bool sd_mounted = false; 73 | static bool usb_mounted = false; 74 | 75 | static bool _FAT_partition_isFAT(const DISC_INTERFACE* disc, sec_t startSector) 76 | { 77 | uint8_t sectorBuffer[BYTES_PER_READ] = {0}; 78 | 79 | if (!disc->readSectors(startSector, 1, sectorBuffer)) return false; 80 | 81 | // Make sure it is a valid BPB 82 | if ((sectorBuffer[BPB_bootSig_55] != 0x55) || (sectorBuffer[BPB_bootSig_AA] != 0xAA)) return false; 83 | 84 | // Now verify that this is indeed a FAT partition 85 | if (memcmp(sectorBuffer + BPB_FAT16_fileSysType, FAT_SIG, sizeof(FAT_SIG)) && memcmp(sectorBuffer + BPB_FAT32_fileSysType, FAT_SIG, sizeof(FAT_SIG))) return false; 86 | 87 | // Check again for the last two cases to make sure that we really have a FAT filesystem here and won't corrupt any data 88 | if(memcmp(sectorBuffer + BPB_FAT16_fileSysType, "FAT", 3) != 0 && memcmp(sectorBuffer + BPB_FAT32_fileSysType, "FAT32", 5) != 0) return false; 89 | 90 | return true; 91 | } 92 | 93 | static inline uint32_t u8array_to_u32 (const uint8_t* item, int offset) 94 | { 95 | return (item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24)); 96 | } 97 | 98 | sec_t GetFATPartition(const DISC_INTERFACE* disc) 99 | { 100 | int i; 101 | uint8_t sectorBuffer[BYTES_PER_READ] = {0}; 102 | sec_t startSector = 0; 103 | 104 | if (!disc->startup()) return 0; 105 | 106 | // Read first sector of disc 107 | if (!disc->readSectors(0, 1, sectorBuffer)) startSector = 0; 108 | 109 | // Make sure it is a valid MBR or boot sector 110 | if ((sectorBuffer[BPB_bootSig_55] != 0x55) || (sectorBuffer[BPB_bootSig_AA] != 0xAA)) startSector = 0; 111 | 112 | if (!memcmp(sectorBuffer+BPB_FAT16_fileSysType, FAT_SIG, sizeof(FAT_SIG))) 113 | { 114 | // Check if there is a FAT string, which indicates this is a boot sector 115 | startSector = 0; 116 | } 117 | else if (!memcmp(sectorBuffer+BPB_FAT32_fileSysType, FAT_SIG, sizeof(FAT_SIG))) 118 | { 119 | // Check for FAT32 120 | startSector = 0; 121 | } 122 | else 123 | { 124 | // This is an MBR 125 | // Find first valid partition from MBR 126 | // First check for an active partition 127 | for (i = 0x1BE; (i < 0x1FE) && (sectorBuffer[i] != 0x80); i+= 0x10); 128 | 129 | // If it find an active partition, check for FAT Partition 130 | if (i != 0x1FE && !_FAT_partition_isFAT(disc, u8array_to_u32(sectorBuffer, 0x8+i))) i = 0x1FE; 131 | 132 | // If it didn't find an active partition, search for any valid partition 133 | if (i == 0x1FE) 134 | { 135 | for (i = 0x1BE; i < 0x1FE; i+= 0x10) 136 | { 137 | if (sectorBuffer[i+0x04] != 0x00 && _FAT_partition_isFAT(disc, u8array_to_u32(sectorBuffer, 0x8+i))) break; 138 | } 139 | } 140 | 141 | if (i != 0x1FE) startSector = u8array_to_u32(sectorBuffer, 0x8+i); 142 | } 143 | 144 | disc->shutdown(); 145 | 146 | return startSector; 147 | } 148 | 149 | int MountSD(void) 150 | { 151 | // Close all open files write back the cache and then shutdown them 152 | fatUnmount("sd"); 153 | 154 | // Mount first FAT partition 155 | if (fatMount("sd", &__io_wiisd, GetFATPartition(&__io_wiisd), CACHE, SECTORS)) 156 | { 157 | sd_mounted = true; 158 | return 1; 159 | } 160 | return -1; 161 | } 162 | 163 | void UnmountSD(void) 164 | { 165 | if (!sd_mounted) return; 166 | // Close all open files write back the cache and then shutdown them 167 | fatUnmount("sd"); 168 | sd_mounted = false; 169 | } 170 | 171 | int MountUSB() 172 | { 173 | fatUnmount("usb"); 174 | __io_usbstorage.startup(); 175 | if ((usb_mounted = __io_usbstorage.isInserted())) 176 | { 177 | int retry = 10; 178 | while ((retry) && ((usb_mounted = fatMountSimple("usb", &__io_usbstorage)) == false)) 179 | { 180 | sleep(1); 181 | retry--; 182 | } 183 | } 184 | return usb_mounted; 185 | } 186 | 187 | void UnmountUSB(void) 188 | { 189 | 190 | if(!usb_mounted) return; 191 | /* Unmount device */ 192 | fatUnmount("usb"); 193 | 194 | /* Shutdown interface */ 195 | __io_usbstorage.shutdown(); 196 | usb_mounted = false; 197 | } 198 | 199 | -------------------------------------------------------------------------------- /source/gecko.c: -------------------------------------------------------------------------------- 1 | #include <gccore.h> 2 | #include <stdio.h> 3 | #include <string.h> 4 | #include <stdarg.h> 5 | 6 | /* init-globals */ 7 | bool geckoinit = false; 8 | bool textVideoInit = false; 9 | 10 | #ifndef NO_DEBUG 11 | void gprintf( const char *str, ... ) 12 | { 13 | if (!(geckoinit))return; 14 | char astr[4096]; 15 | int length; 16 | 17 | va_list ap; 18 | va_start(ap,str); 19 | 20 | length = vsnprintf(astr, sizeof(astr), str, ap); 21 | if (length > 0) usb_sendbuffer_safe(1, astr, length); 22 | 23 | va_end(ap); 24 | return; 25 | 26 | } 27 | 28 | void gsenddata(const u8 *data, int length, const char *filename) 29 | { 30 | if (!(geckoinit))return; 31 | 32 | // First, send a "\x1b[2B]" line (this will tell geckoreader that binary data is comming up next) 33 | const char *binary_data = "\x1b[2B]\n"; 34 | 35 | usb_sendbuffer_safe(1, binary_data, strlen(binary_data)); 36 | 37 | u8 filenamelength = filename == NULL ? 0 : strlen(filename); 38 | 39 | // Send the length 40 | usb_sendbuffer_safe(1, (u8 *) &length, 4); 41 | usb_sendbuffer_safe(1, (u8 *) &filenamelength, 1); 42 | usb_sendbuffer_safe(1, data, length); 43 | if (filename != NULL) 44 | { 45 | usb_sendbuffer_safe(1, filename, strlen(filename)); 46 | } 47 | } 48 | 49 | char ascii(char s) { 50 | if(s < 0x20) return '.'; 51 | if(s > 0x7E) return '.'; 52 | return s; 53 | } 54 | 55 | bool InitGecko() 56 | { 57 | if(usb_isgeckoalive(EXI_CHANNEL_1)) 58 | { 59 | usb_flush(EXI_CHANNEL_1); 60 | geckoinit = true; 61 | } else { 62 | geckoinit = false; 63 | } 64 | return geckoinit; 65 | } 66 | 67 | #endif /* NO_DEBUG */ 68 | -------------------------------------------------------------------------------- /source/sha1.c: -------------------------------------------------------------------------------- 1 | /* 2 | SHA-1 in C 3 | By Steve Reid <steve@edmweb.com> 4 | 100% Public Domain 5 | 6 | Test Vectors (from FIPS PUB 180-1) 7 | "abc" 8 | A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D 9 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" 10 | 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 11 | A million repetitions of "a" 12 | 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F 13 | */ 14 | 15 | /* #define LITTLE_ENDIAN * This should be #define'd if true. */ 16 | #define SHA1HANDSOFF 17 | 18 | #include <stdio.h> 19 | #include <string.h> 20 | #include "sha1.h" 21 | 22 | #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) 23 | 24 | /* blk0() and blk() perform the initial expand. */ 25 | /* I got the idea of expanding during the round function from SSLeay */ 26 | #ifdef LITTLE_ENDIAN 27 | #define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ 28 | |(rol(block->l[i],8)&0x00FF00FF)) 29 | #else 30 | #define blk0(i) block->l[i] 31 | #endif 32 | #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ 33 | ^block->l[(i+2)&15]^block->l[i&15],1)) 34 | 35 | /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ 36 | #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); 37 | #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); 38 | #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); 39 | #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); 40 | #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); 41 | 42 | 43 | /* Hash a single 512-bit block. This is the core of the algorithm. */ 44 | 45 | void SHA1Transform(unsigned long state[5], unsigned char buffer[64]) 46 | { 47 | unsigned long a, b, c, d, e; 48 | typedef union { 49 | unsigned char c[64]; 50 | unsigned long l[16]; 51 | } CHAR64LONG16; 52 | CHAR64LONG16* block; 53 | #ifdef SHA1HANDSOFF 54 | static unsigned char workspace[64]; 55 | block = (CHAR64LONG16*)workspace; 56 | memcpy(block, buffer, 64); 57 | #else 58 | block = (CHAR64LONG16*)buffer; 59 | #endif 60 | /* Copy context->state[] to working vars */ 61 | a = state[0]; 62 | b = state[1]; 63 | c = state[2]; 64 | d = state[3]; 65 | e = state[4]; 66 | /* 4 rounds of 20 operations each. Loop unrolled. */ 67 | R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); 68 | R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); 69 | R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); 70 | R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); 71 | R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); 72 | R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); 73 | R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); 74 | R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); 75 | R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); 76 | R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); 77 | R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); 78 | R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); 79 | R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); 80 | R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); 81 | R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); 82 | R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); 83 | R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); 84 | R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); 85 | R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); 86 | R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); 87 | /* Add the working vars back into context.state[] */ 88 | state[0] += a; 89 | state[1] += b; 90 | state[2] += c; 91 | state[3] += d; 92 | state[4] += e; 93 | /* Wipe variables */ 94 | a = b = c = d = e = 0; 95 | } 96 | 97 | 98 | /* SHA1Init - Initialize new context */ 99 | 100 | void SHA1Init(SHA1_CTX* context) 101 | { 102 | /* SHA1 initialization constants */ 103 | context->state[0] = 0x67452301; 104 | context->state[1] = 0xEFCDAB89; 105 | context->state[2] = 0x98BADCFE; 106 | context->state[3] = 0x10325476; 107 | context->state[4] = 0xC3D2E1F0; 108 | context->count[0] = context->count[1] = 0; 109 | } 110 | 111 | 112 | /* Run your data through this. */ 113 | 114 | void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len) 115 | { 116 | unsigned int i, j; 117 | 118 | j = (context->count[0] >> 3) & 63; 119 | if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; 120 | context->count[1] += (len >> 29); 121 | if ((j + len) > 63) { 122 | memcpy(&context->buffer[j], data, (i = 64-j)); 123 | SHA1Transform(context->state, context->buffer); 124 | for ( ; i + 63 < len; i += 64) { 125 | SHA1Transform(context->state, &data[i]); 126 | } 127 | j = 0; 128 | } 129 | else i = 0; 130 | memcpy(&context->buffer[j], &data[i], len - i); 131 | } 132 | 133 | 134 | /* Add padding and return the message digest. */ 135 | 136 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context) 137 | { 138 | unsigned long i, j; 139 | unsigned char finalcount[8]; 140 | 141 | for (i = 0; i < 8; i++) { 142 | finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] 143 | >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ 144 | } 145 | SHA1Update(context, (unsigned char *)"\200", 1); 146 | while ((context->count[0] & 504) != 448) { 147 | SHA1Update(context, (unsigned char *)"\0", 1); 148 | } 149 | SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ 150 | for (i = 0; i < 20; i++) { 151 | digest[i] = (unsigned char) 152 | ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); 153 | } 154 | /* Wipe variables */ 155 | i = j = 0; 156 | memset(context->buffer, 0, 64); 157 | memset(context->state, 0, 20); 158 | memset(context->count, 0, 8); 159 | memset(&finalcount, 0, 8); 160 | #ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ 161 | SHA1Transform(context->state, context->buffer); 162 | #endif 163 | } 164 | 165 | void SHA1(unsigned char *ptr, unsigned int size, unsigned char *outbuf) { 166 | SHA1_CTX ctx; 167 | 168 | SHA1Init(&ctx); 169 | SHA1Update(&ctx, ptr, size); 170 | SHA1Final(outbuf, &ctx); 171 | } 172 | 173 | -------------------------------------------------------------------------------- /source/ssl.c: -------------------------------------------------------------------------------- 1 | /* Code taken from http://wiibrew.org/wiki//dev/net/ssl/code */ 2 | 3 | #include <ogc/machine/processor.h> //needed for patches -FIX94 4 | #include <gccore.h> 5 | #include <string.h> 6 | #include "ssl.h" 7 | 8 | #define ISALIGNED(x) ((((u32)x)&0x1F)==0) 9 | 10 | static char __ssl_fs[] ATTRIBUTE_ALIGN(32) = "/dev/net/ssl"; 11 | 12 | static s32 __ssl_fd = -1; 13 | static s32 __ssl_hid = -1; 14 | 15 | u32 ssl_init(void) 16 | { 17 | if(__ssl_hid < 0 ) { 18 | __ssl_hid = iosCreateHeap(SSL_HEAP_SIZE); 19 | if(__ssl_hid < 0){ 20 | return __ssl_hid; 21 | } 22 | //some very dirty ssl patches for ios58 only -FIX94 23 | write16(0xD8B420A, 0); 24 | 25 | //ssl error -9 patch (wrong host) 26 | DCInvalidateRange( (void*)0x93CC1AC0, 0x20 ); 27 | write32(0x93CC1AC0, 0xE328F102); //set "negative" flag 28 | DCFlushRange( (void*)0x93CC1AC0, 0x20 ); 29 | 30 | //ssl error -10 patch (wrong root cert) 31 | DCInvalidateRange( (void*)0x93CC1B40, 0x20 ); 32 | write32(0x93CC1B50, 0xEA000009); //beq->b 33 | DCFlushRange( (void*)0x93CC1B40, 0x20 ); 34 | 35 | DCInvalidateRange( (void*)0x93CC1B80, 0x20 ); 36 | write32(0x93CC1B94, 0xEA000008); //bne->b 37 | DCFlushRange( (void*)0x93CC1B80, 0x20 ); 38 | 39 | //ssl error -11 patch (wrong client cert?) 40 | DCInvalidateRange( (void*)0x93CC1BE0, 0x20 ); 41 | write32(0x93CC1BF8, 0xEA000016); //ble->b 42 | DCFlushRange( (void*)0x93CC1BE0, 0x20 ); 43 | } 44 | 45 | return 0; 46 | } 47 | 48 | u32 ssl_open(void) 49 | { 50 | s32 ret; 51 | 52 | if (__ssl_fd < 0) { 53 | ret = IOS_Open(__ssl_fs,0); 54 | if(ret<0){ 55 | return ret; 56 | } 57 | __ssl_fd = ret; 58 | } 59 | 60 | return 0; 61 | } 62 | 63 | u32 ssl_close(void) 64 | { 65 | s32 ret; 66 | 67 | if(__ssl_fd < 0){ 68 | return 0; 69 | } 70 | 71 | ret = IOS_Close(__ssl_fd); 72 | 73 | __ssl_fd = -1; 74 | 75 | if(ret<0){ 76 | return ret; 77 | } 78 | 79 | return 0; 80 | } 81 | 82 | s32 ssl_new(u8 * CN, u32 ssl_verify_options) 83 | { 84 | s32 ret; 85 | s32 aContext[8] ATTRIBUTE_ALIGN(32); 86 | u32 aVerify_options[8] ATTRIBUTE_ALIGN(32); 87 | 88 | ret = ssl_open(); 89 | if(ret){ 90 | return ret; 91 | } 92 | 93 | aVerify_options[0] = ssl_verify_options; 94 | 95 | if(ISALIGNED(CN)){ //Avoid alignment if the input is aligned 96 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_NEW, "d:dd", aContext, 0x20, aVerify_options, 0x20, CN, 0x100); 97 | }else{ 98 | u8 *aCN = NULL; 99 | 100 | aCN = iosAlloc(__ssl_hid, 0x100); 101 | if (!aCN) { 102 | return IPC_ENOMEM; 103 | } 104 | 105 | memcpy(aCN, CN, 0x100); 106 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_NEW, "d:dd", aContext, 0x20, aVerify_options, 0x20, aCN, 0x100); 107 | 108 | if(aCN){ 109 | iosFree(__ssl_hid, aCN); 110 | } 111 | } 112 | 113 | ssl_close(); 114 | 115 | return (ret ? ret : aContext[0]); 116 | } 117 | 118 | s32 ssl_setbuiltinclientcert(s32 ssl_context, s32 index) 119 | { 120 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 121 | s32 aIndex[8] ATTRIBUTE_ALIGN(32); 122 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 123 | s32 ret; 124 | 125 | ret = ssl_open(); 126 | if(ret){ 127 | return ret; 128 | } 129 | 130 | aSsl_context[0] = ssl_context; 131 | aIndex[0] = index; 132 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_SETBUILTINCLIENTCERT, "d:dd", aResponse, 32, aSsl_context, 32, aIndex, 32); 133 | ssl_close(); 134 | 135 | return (ret ? ret : aResponse[0]); 136 | } 137 | 138 | s32 ssl_setrootca(s32 ssl_context, const void *root, u32 length) 139 | { 140 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 141 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 142 | s32 ret; 143 | 144 | ret = ssl_open(); 145 | if(ret){ 146 | return ret; 147 | } 148 | 149 | aSsl_context[0] = ssl_context; 150 | 151 | if(ISALIGNED(root)){ //Avoid alignment if the input is aligned 152 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_SETROOTCA, "d:dd", aResponse, 0x20, aSsl_context, 0x20, root, length); 153 | }else{ 154 | u8 *aRoot = NULL; 155 | 156 | aRoot = iosAlloc(__ssl_hid, length); 157 | if (!aRoot) { 158 | return IPC_ENOMEM; 159 | } 160 | 161 | memcpy(aRoot, root, length); 162 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_SETROOTCA, "d:dd", aResponse, 0x20, aSsl_context, 0x20, aRoot, length); 163 | 164 | if(aRoot){ 165 | iosFree(__ssl_hid, aRoot); 166 | } 167 | } 168 | 169 | ssl_close(); 170 | 171 | return (ret ? ret : aResponse[0]); 172 | } 173 | 174 | s32 ssl_connect(s32 ssl_context, s32 socket) 175 | { 176 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 177 | s32 aSocket[8] ATTRIBUTE_ALIGN(32); 178 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 179 | s32 ret; 180 | 181 | ret = ssl_open(); 182 | if(ret){ 183 | return ret; 184 | } 185 | 186 | aSsl_context[0] = ssl_context; 187 | aSocket[0] = socket; 188 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_CONNECT, "d:dd", aResponse, 0x20, aSsl_context, 0x20, aSocket, 0x20); 189 | ssl_close(); 190 | 191 | return (ret ? ret : aResponse[0]); 192 | } 193 | 194 | s32 ssl_handshake(s32 ssl_context) 195 | { 196 | 197 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 198 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 199 | s32 ret; 200 | 201 | ret = ssl_open(); 202 | if(ret){ 203 | return ret; 204 | } 205 | 206 | aSsl_context[0] = ssl_context; 207 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_HANDSHAKE, "d:d", aResponse, 0x20, aSsl_context, 0x20); 208 | ssl_close(); 209 | 210 | return (ret ? ret : aResponse[0]); 211 | } 212 | 213 | s32 ssl_read(s32 ssl_context, void* buffer, u32 length) 214 | { 215 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 216 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 217 | s32 ret; 218 | 219 | ret = ssl_open(); 220 | if(ret){ 221 | return ret; 222 | } 223 | 224 | if(!buffer){ 225 | return IPC_EINVAL; 226 | } 227 | 228 | u8 *aBuffer = NULL; 229 | aBuffer = iosAlloc(__ssl_hid, length); 230 | if (!aBuffer) { 231 | return IPC_ENOMEM; 232 | } 233 | 234 | aSsl_context[0] = ssl_context; 235 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_READ, "dd:d", aResponse, 0x20, aBuffer, length, aSsl_context, 0x20); 236 | ssl_close(); 237 | 238 | if(ret == IPC_OK){ 239 | memcpy(buffer, aBuffer, aResponse[0]); 240 | } 241 | 242 | if(aBuffer){ 243 | iosFree(__ssl_hid, aBuffer); 244 | } 245 | 246 | return (ret ? ret : aResponse[0]); 247 | } 248 | 249 | s32 ssl_write(s32 ssl_context, const void *buffer, u32 length) 250 | { 251 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 252 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 253 | s32 ret; 254 | 255 | ret = ssl_open(); 256 | if(ret){ 257 | return ret; 258 | } 259 | 260 | if(!buffer){ 261 | return IPC_EINVAL; 262 | } 263 | 264 | aSsl_context[0] = ssl_context; 265 | 266 | if(ISALIGNED(buffer)){ //Avoid alignment if the input is aligned 267 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_WRITE, "d:dd", aResponse, 0x20, aSsl_context, 0x20, buffer, length); 268 | }else{ 269 | u8 *aBuffer = NULL; 270 | aBuffer = iosAlloc(__ssl_hid, length); 271 | if (!aBuffer) { 272 | return IPC_ENOMEM; 273 | } 274 | 275 | memcpy(aBuffer, buffer, length); 276 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_WRITE, "d:dd", aResponse, 0x20, aSsl_context, 0x20, aBuffer, length); 277 | } 278 | 279 | ssl_close(); 280 | 281 | return (ret ? ret : aResponse[0]); 282 | } 283 | 284 | s32 ssl_shutdown(s32 ssl_context) 285 | { 286 | s32 aSsl_context[8] ATTRIBUTE_ALIGN(32); 287 | s32 aResponse[8] ATTRIBUTE_ALIGN(32); 288 | s32 ret; 289 | 290 | ret = ssl_open(); 291 | if(ret){ 292 | return ret; 293 | } 294 | 295 | aSsl_context[0] = ssl_context; 296 | 297 | ret = IOS_IoctlvFormat(__ssl_hid, __ssl_fd, IOCTLV_SSL_SHUTDOWN, "d:d", aResponse, 0x20, aSsl_context, 0x20); 298 | 299 | ssl_close(); 300 | 301 | return (ret ? ret : aResponse[0]); 302 | } 303 | -------------------------------------------------------------------------------- /source/title.c: -------------------------------------------------------------------------------- 1 | #include <stdio.h> 2 | #include <stdlib.h> 3 | #include <string.h> 4 | #include <malloc.h> 5 | #include <ogcsys.h> 6 | 7 | #include "title.h" 8 | 9 | 10 | s32 Title_GetList(u64 **outbuf, u32 *outlen) 11 | { 12 | u64 *titles = NULL; 13 | 14 | u32 len, nb_titles; 15 | s32 ret; 16 | 17 | /* Get number of titles */ 18 | ret = ES_GetNumTitles(&nb_titles); 19 | if (ret < 0) 20 | return ret; 21 | 22 | /* Calculate buffer lenght */ 23 | len = round_up(sizeof(u64) * nb_titles, 32); 24 | 25 | /* Allocate memory */ 26 | titles = memalign(32, len); 27 | if (!titles) 28 | return -1; 29 | 30 | /* Get titles */ 31 | ret = ES_GetTitles(titles, nb_titles); 32 | if (ret < 0) 33 | goto err; 34 | 35 | /* Set values */ 36 | *outbuf = titles; 37 | *outlen = nb_titles; 38 | 39 | return 0; 40 | 41 | err: 42 | /* Free memory */ 43 | if (titles) 44 | free(titles); 45 | 46 | return ret; 47 | } 48 | 49 | s32 Title_GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen) 50 | { 51 | tikview *views = NULL; 52 | 53 | u32 nb_views; 54 | s32 ret; 55 | 56 | /* Get number of ticket views */ 57 | ret = ES_GetNumTicketViews(tid, &nb_views); 58 | if (ret < 0) 59 | return ret; 60 | 61 | /* Allocate memory */ 62 | views = (tikview *)memalign(32, sizeof(tikview) * nb_views); 63 | if (!views) 64 | return -1; 65 | 66 | /* Get ticket views */ 67 | ret = ES_GetTicketViews(tid, views, nb_views); 68 | if (ret < 0) 69 | goto err; 70 | 71 | /* Set values */ 72 | *outbuf = views; 73 | *outlen = nb_views; 74 | 75 | return 0; 76 | 77 | err: 78 | /* Free memory */ 79 | if (views) 80 | free(views); 81 | 82 | return ret; 83 | } 84 | 85 | s32 Title_GetTMD(u64 tid, signed_blob **outbuf, u32 *outlen) 86 | { 87 | void *p_tmd = NULL; 88 | 89 | u32 len; 90 | s32 ret; 91 | 92 | /* Get TMD size */ 93 | ret = ES_GetStoredTMDSize(tid, &len); 94 | if (ret < 0) 95 | return ret; 96 | 97 | /* Allocate memory */ 98 | p_tmd = memalign(32, round_up(len, 32)); 99 | if (!p_tmd) 100 | return -1; 101 | 102 | /* Read TMD */ 103 | ret = ES_GetStoredTMD(tid, p_tmd, len); 104 | if (ret < 0) 105 | goto err; 106 | 107 | /* Set values */ 108 | *outbuf = p_tmd; 109 | *outlen = len; 110 | 111 | return 0; 112 | 113 | err: 114 | /* Free memory */ 115 | if (p_tmd) 116 | free(p_tmd); 117 | 118 | return ret; 119 | } 120 | 121 | s32 Title_GetVersion(u64 tid, u16 *outbuf) 122 | { 123 | signed_blob *p_tmd = NULL; 124 | tmd *tmd_data = NULL; 125 | 126 | u32 len; 127 | s32 ret; 128 | 129 | /* Get title TMD */ 130 | ret = Title_GetTMD(tid, &p_tmd, &len); 131 | if (ret < 0) 132 | return ret; 133 | 134 | /* Retrieve TMD info */ 135 | tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd); 136 | 137 | /* Set values */ 138 | *outbuf = tmd_data->title_version; 139 | 140 | /* Free memory */ 141 | free(p_tmd); 142 | 143 | return 0; 144 | } 145 | 146 | 147 | s32 Title_GetVersionNObuf(u64 tid) { 148 | signed_blob *p_tmd = NULL; 149 | tmd *tmd_data = NULL; 150 | 151 | u32 len; 152 | s32 ret; 153 | 154 | /* Get title TMD */ 155 | ret = Title_GetTMD(tid, &p_tmd, &len); 156 | if (ret < 0) 157 | return ret; 158 | 159 | /* Retrieve TMD info */ 160 | tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd); 161 | 162 | /* Set values */ 163 | ret = tmd_data->title_version; 164 | 165 | /* Free memory */ 166 | free(p_tmd); 167 | 168 | return ret; 169 | } 170 | 171 | s32 Title_GetSysVersion(u64 tid, u64 *outbuf) 172 | { 173 | signed_blob *p_tmd = NULL; 174 | tmd *tmd_data = NULL; 175 | 176 | u32 len; 177 | s32 ret; 178 | 179 | /* Get title TMD */ 180 | ret = Title_GetTMD(tid, &p_tmd, &len); 181 | if (ret < 0) 182 | return ret; 183 | 184 | /* Retrieve TMD info */ 185 | tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd); 186 | 187 | /* Set values */ 188 | *outbuf = tmd_data->sys_version; 189 | 190 | /* Free memory */ 191 | free(p_tmd); 192 | 193 | return 0; 194 | } 195 | 196 | s32 Title_GetSize(u64 tid, u32 *outbuf) 197 | { 198 | signed_blob *p_tmd = NULL; 199 | tmd *tmd_data = NULL; 200 | 201 | u32 cnt, len, size = 0; 202 | s32 ret; 203 | 204 | /* Get title TMD */ 205 | ret = Title_GetTMD(tid, &p_tmd, &len); 206 | if (ret < 0) 207 | return ret; 208 | 209 | /* Retrieve TMD info */ 210 | tmd_data = (tmd *)SIGNATURE_PAYLOAD(p_tmd); 211 | 212 | /* Calculate title size */ 213 | for (cnt = 0; cnt < tmd_data->num_contents; cnt++) { 214 | tmd_content *content = &tmd_data->contents[cnt]; 215 | 216 | /* Add content size */ 217 | size += content->size; 218 | } 219 | 220 | /* Set values */ 221 | *outbuf = size; 222 | 223 | /* Free memory */ 224 | free(p_tmd); 225 | 226 | return 0; 227 | } 228 | 229 | u32 Title_GetSize_FromTMD(tmd *tmd_data) 230 | { 231 | u32 cnt, size = 0; 232 | 233 | /* Calculate title size */ 234 | for (cnt = 0; cnt < tmd_data->num_contents; cnt++) { 235 | tmd_content *content = &tmd_data->contents[cnt]; 236 | 237 | /* Add content size */ 238 | size += content->size; 239 | } 240 | 241 | return size; 242 | } 243 | -------------------------------------------------------------------------------- /source/tools.c: -------------------------------------------------------------------------------- 1 | #include <string.h> 2 | #include <gccore.h> 3 | #include <malloc.h> 4 | #include <unistd.h> 5 | #include <stdio.h> 6 | #include <stdlib.h> 7 | #include <errno.h> 8 | #include <ogcsys.h> 9 | #include <stdarg.h> 10 | #include <network.h> 11 | #include <ogc/machine/processor.h> 12 | #include <ogc/conf.h> 13 | #include <wiiuse/wpad.h> 14 | #include <ctype.h> 15 | 16 | #include "sys.h" 17 | #include "SysMenuInfo.h" 18 | 19 | #include "ticket_dat.h" 20 | #include "tmd_dat.h" 21 | 22 | #include "mload.h" 23 | #include "title.h" 24 | #include "sha1.h" 25 | #include "gecko.h" 26 | #include "http.h" 27 | #include "gui.h" 28 | #include "languages.h" 29 | #include "fatMounter.h" 30 | 31 | // Variables 32 | bool NandInitialized = false; 33 | arguments_t arguments; 34 | 35 | void logfile(const char *format, ...) 36 | { 37 | if (!arguments.debug) return; 38 | MountSD(); 39 | FILE *f; 40 | f= fopen("sd:/SysCheckDebug.log", "a"); 41 | if(f == NULL) return; 42 | va_list args; 43 | va_start(args, format); 44 | vfprintf(f,format, args); 45 | va_end (args); 46 | fclose(f); 47 | UnmountSD(); 48 | } 49 | 50 | /** 51 | * A simple structure to keep track of the size of a malloc()ated block of memory 52 | */ 53 | struct block 54 | { 55 | u32 size; 56 | unsigned char *data; 57 | }; 58 | 59 | const struct block emptyblock = { 0, NULL }; 60 | 61 | void *allocate_memory(u32 size) 62 | { 63 | return memalign(32, (size+31)&(~31) ); 64 | } 65 | 66 | int NandStartup(void) 67 | { 68 | if (NandInitialized) 69 | return 1; 70 | 71 | int ret = ISFS_Initialize(); 72 | 73 | NandInitialized = (ret == ISFS_OK); 74 | 75 | sleep(1); 76 | 77 | return ret; 78 | } 79 | 80 | void NandShutdown(void) 81 | { 82 | if (!NandInitialized) 83 | return; 84 | 85 | ISFS_Deinitialize(); 86 | 87 | NandInitialized = false; 88 | } 89 | 90 | void Wpad_Disconnect(void) 91 | { 92 | for (u32 i = 0; i < 5; i++) 93 | { 94 | if (WPAD_Probe(i, 0) < 0) 95 | continue; 96 | WPAD_Disconnect(i); 97 | } 98 | 99 | WPAD_Shutdown(); 100 | } 101 | 102 | u32 DetectInput(u8 DownOrHeld) { 103 | u32 pressed = 0; 104 | u16 gcpressed = 0; 105 | // Wii Remote (and Classic Controller) take precedence over GC to save time 106 | if (WPAD_ScanPads() >= WPAD_ERR_NONE) // Scan the Wii remotes. If there any problems, skip checking buttons 107 | { 108 | if (DownOrHeld == DI_BUTTONS_DOWN) { 109 | pressed = WPAD_ButtonsDown(0) | WPAD_ButtonsDown(1) | WPAD_ButtonsDown(2) | WPAD_ButtonsDown(3); //Store pressed buttons 110 | } else { 111 | pressed = WPAD_ButtonsHeld(0) | WPAD_ButtonsHeld(1) | WPAD_ButtonsHeld(2) | WPAD_ButtonsHeld(3); //Store pressed buttons 112 | } 113 | 114 | // Convert to wiimote values 115 | if (pressed & WPAD_CLASSIC_BUTTON_ZR) pressed |= WPAD_BUTTON_PLUS; 116 | if (pressed & WPAD_CLASSIC_BUTTON_ZL) pressed |= WPAD_BUTTON_MINUS; 117 | 118 | if (pressed & WPAD_CLASSIC_BUTTON_PLUS) pressed |= WPAD_BUTTON_PLUS; 119 | if (pressed & WPAD_CLASSIC_BUTTON_MINUS) pressed |= WPAD_BUTTON_MINUS; 120 | 121 | if (pressed & WPAD_CLASSIC_BUTTON_A) pressed |= WPAD_BUTTON_A; 122 | if (pressed & WPAD_CLASSIC_BUTTON_B) pressed |= WPAD_BUTTON_B; 123 | if (pressed & WPAD_CLASSIC_BUTTON_X) pressed |= WPAD_BUTTON_2; 124 | if (pressed & WPAD_CLASSIC_BUTTON_Y) pressed |= WPAD_BUTTON_1; 125 | if (pressed & WPAD_CLASSIC_BUTTON_HOME) pressed |= WPAD_BUTTON_HOME; 126 | 127 | if (pressed & WPAD_CLASSIC_BUTTON_UP) pressed |= WPAD_BUTTON_UP; 128 | if (pressed & WPAD_CLASSIC_BUTTON_DOWN) pressed |= WPAD_BUTTON_DOWN; 129 | if (pressed & WPAD_CLASSIC_BUTTON_LEFT) pressed |= WPAD_BUTTON_LEFT; 130 | if (pressed & WPAD_CLASSIC_BUTTON_RIGHT) pressed |= WPAD_BUTTON_RIGHT; 131 | } 132 | 133 | // Return Classic Controller and Wii Remote values 134 | if (pressed) return pressed; 135 | 136 | // No buttons on the Wii remote or Classic Controller were pressed 137 | if (PAD_ScanPads() >= PAD_ERR_NONE) 138 | { 139 | if (DownOrHeld == DI_BUTTONS_HELD) { 140 | gcpressed = PAD_ButtonsHeld(0) | PAD_ButtonsHeld(1) | PAD_ButtonsHeld(2) | PAD_ButtonsHeld(3); //Store pressed buttons 141 | } else { 142 | gcpressed = PAD_ButtonsDown(0) | PAD_ButtonsDown(1) | PAD_ButtonsDown(2) | PAD_ButtonsDown(3); //Store pressed buttons 143 | } 144 | 145 | if (gcpressed) { 146 | // Button on GC controller was pressed 147 | if (gcpressed & PAD_TRIGGER_Z) pressed |= WPAD_NUNCHUK_BUTTON_Z; 148 | if (gcpressed & PAD_TRIGGER_R) pressed |= WPAD_BUTTON_PLUS; 149 | if (gcpressed & PAD_TRIGGER_L) pressed |= WPAD_BUTTON_MINUS; 150 | if (gcpressed & PAD_BUTTON_A) pressed |= WPAD_BUTTON_A; 151 | if (gcpressed & PAD_BUTTON_B) pressed |= WPAD_BUTTON_B; 152 | if (gcpressed & PAD_BUTTON_X) pressed |= WPAD_BUTTON_1; 153 | if (gcpressed & PAD_BUTTON_Y) pressed |= WPAD_BUTTON_2; 154 | if (gcpressed & PAD_BUTTON_MENU) pressed |= WPAD_BUTTON_HOME; 155 | if (gcpressed & PAD_BUTTON_UP) pressed |= WPAD_BUTTON_UP; 156 | if (gcpressed & PAD_BUTTON_LEFT) pressed |= WPAD_BUTTON_LEFT; 157 | if (gcpressed & PAD_BUTTON_DOWN) pressed |= WPAD_BUTTON_DOWN; 158 | if (gcpressed & PAD_BUTTON_RIGHT) pressed |= WPAD_BUTTON_RIGHT; 159 | } 160 | } 161 | return pressed; 162 | } 163 | 164 | void formatDate(u32 date, char ReportBuffer[200][100]) { 165 | char temp[9] = {0}; 166 | char day[3] = {0}; 167 | char month[3] = {0}; 168 | char year[6] = {0}; 169 | 170 | sprintf(temp, "%08x", date); 171 | snprintf(year, sizeof(year), "%c%c%c%c", temp[0], temp[1], temp[2], temp[3]); 172 | sprintf(month, "%c%c", temp[4], temp[5]); 173 | sprintf(day, "%c%c", temp[6], temp[7]); 174 | 175 | gprintf("MONTH: %s\n", month); 176 | gprintf("DAY: %s\n", day); 177 | gprintf("YEAR: %s\n", year); 178 | logfile("MONTH: %s\r\n", month); 179 | logfile("DAY: %s\r\n", day); 180 | logfile("YEAR: %s\r\n", year); 181 | 182 | char result[10] = {0}; 183 | 184 | switch (CONF_GetLanguage()) { 185 | case CONF_LANG_GERMAN: 186 | case CONF_LANG_ITALIAN: 187 | case CONF_LANG_SPANISH: 188 | sprintf(result, "%s.%s.%s", day, month, year); 189 | break; 190 | default: 191 | sprintf(result, "%s.%s.%s", month, day, year); // You don't say "I was born 1990 January 1" The year comes last 192 | break; 193 | } 194 | gprintf("String: %s\n", result); 195 | logfile("String: %s\r\n", result); 196 | if (strlen(result) > 1) 197 | sprintf(ReportBuffer[DVD], TXT_DVD, result); 198 | else 199 | sprintf(ReportBuffer[DVD], TXT_NoDVD); 200 | } 201 | 202 | inline void sort(u64 *titles, u32 cnt) { 203 | int i, j; 204 | u64 tmp; 205 | for (i = 0; i < cnt -1; ++i) { 206 | for (j = 0; j < cnt - i - 1; ++j) { 207 | if (titles[j] > titles[j + 1]) { 208 | tmp = titles[j]; 209 | titles[j] = titles[j + 1]; 210 | titles[j + 1] = tmp; 211 | } 212 | } 213 | } 214 | } -------------------------------------------------------------------------------- /source/update.c: -------------------------------------------------------------------------------- 1 | #include <gccore.h> 2 | #include <string.h> 3 | #include <stdio.h> 4 | #include <stdlib.h> 5 | #include <malloc.h> 6 | #include <network.h> 7 | #include <dirent.h> 8 | #include <unistd.h> 9 | #include <fat.h> 10 | 11 | #include "update.h" 12 | #include "fatMounter.h" 13 | #include "gecko.h" 14 | #include "http.h" 15 | #include "ssl.h" 16 | #include "tools.h" 17 | 18 | extern http_res result; 19 | 20 | s32 downloadSyscheckFile(const char* update_dir, const char* fileName) { 21 | int ret = 0; 22 | char buf[128] = {0}; 23 | u32 http_status; 24 | u8* outbuf; 25 | u32 length; 26 | 27 | snprintf(buf, sizeof(buf), "https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/master/SysCheckME/%s", fileName); 28 | 29 | ret = http_request(buf, 1 << 31); 30 | if (!ret) 31 | { 32 | int i; 33 | for (i = 0; i < 10; i++) { 34 | ret = http_request(buf, 1 << 31); 35 | gprintf("result = %i\n", result); 36 | if (ret) break; 37 | if (i >= 10) { 38 | gprintf("Error making http request\n"); 39 | return -1; 40 | } 41 | } 42 | } 43 | 44 | ret = http_get_result(&http_status, &outbuf, &length); 45 | gprintf("http_get_result returned %i\n", ret); 46 | 47 | sprintf(buf, "%s%s", update_dir, fileName); 48 | 49 | FILE *file = fopen(buf, "w"); 50 | 51 | if(!file) 52 | { 53 | gprintf("File Error\n"); 54 | return -3; 55 | } else { 56 | fwrite(outbuf, length, 1, file); 57 | fclose(file); 58 | } 59 | if (outbuf) free(outbuf); 60 | return 0; 61 | } 62 | 63 | s32 updateApp(void) { 64 | int ret = net_init(); 65 | ssl_init(); 66 | char update_dir[25]; 67 | char *version; 68 | sprintf(update_dir, "%s:/apps/SysCheckME/", arguments.USB ? "usb" : "sd"); 69 | mkdir("/apps", S_IWRITE|S_IREAD); // attempt to make dir 70 | mkdir("/apps/SysCheckME", S_IWRITE|S_IREAD); // attempt to make dir 71 | chdir(update_dir); 72 | 73 | if (ret < 0) { 74 | net_deinit(); 75 | return ret; 76 | } 77 | u32 http_status; 78 | u8* outbuf; 79 | u32 length; 80 | 81 | ret = http_request("https://raw.githubusercontent.com/modmii/SysCheck-ModMii-Edition/master/Version.txt", 1 << 31); 82 | if (!ret) 83 | { 84 | gprintf("Error making http request\n"); 85 | return -1; 86 | } 87 | 88 | ret = http_get_result(&http_status, &outbuf, &length); 89 | version = (char*)calloc(length, sizeof(char)); 90 | strncpy(version, (char*)outbuf, length); 91 | gprintf("ret = %i, http_status = %u, outbuf = %s, length = %u, version = %s\n", ret, http_status, (char*)outbuf, length, version+8); 92 | if (!strncmp(version, "Version=", sizeof("Version=") - 1)) 93 | { 94 | int latest_version = atoi(version + sizeof("Version=") - 1); 95 | gprintf("INT: %i\n", latest_version); 96 | free(version); 97 | if (latest_version > REVISION) { 98 | ret = downloadSyscheckFile(update_dir, "boot.dol"); 99 | if (ret < 0) { 100 | net_deinit(); 101 | return ret; 102 | } 103 | ret = downloadSyscheckFile(update_dir, "meta.xml"); 104 | if (ret < 0) { 105 | net_deinit(); 106 | return ret; 107 | } 108 | ret = downloadSyscheckFile(update_dir, "icon.png"); 109 | if (ret < 0) { 110 | net_deinit(); 111 | return ret; 112 | } 113 | } else { 114 | net_deinit(); 115 | return 2; 116 | } 117 | 118 | } else { 119 | net_deinit(); 120 | free(version); 121 | return -3; 122 | } 123 | if (outbuf) free(outbuf); 124 | net_deinit(); 125 | return ret; 126 | } 127 | -------------------------------------------------------------------------------- /source/upload.c: -------------------------------------------------------------------------------- 1 | #include <string.h> 2 | #include <gccore.h> 3 | #include <malloc.h> 4 | #include <unistd.h> 5 | #include <stdio.h> 6 | #include <stdlib.h> 7 | #include <errno.h> 8 | #include <ogcsys.h> 9 | #include <stdarg.h> 10 | #include <network.h> 11 | #include <ogc/machine/processor.h> 12 | #include <ogc/conf.h> 13 | #include <wiiuse/wpad.h> 14 | #include <ctype.h> 15 | 16 | #include "sys.h" 17 | #include "SysMenuInfo.h" 18 | 19 | #include "ticket_dat.h" 20 | #include "tmd_dat.h" 21 | 22 | #include "mload.h" 23 | #include "title.h" 24 | #include "sha1.h" 25 | #include "gecko.h" 26 | #include "http.h" 27 | #include "gui.h" 28 | #include "languages.h" 29 | #include "fatMounter.h" 30 | 31 | /* Converts an integer value to its hex character*/ 32 | char to_hex(char code) { 33 | char hex[] = "0123456789abcdef"; 34 | return hex[code & 15]; 35 | } 36 | 37 | /* Returns a url-encoded version of str */ 38 | /* IMPORTANT: be sure to free() the returned string after use */ 39 | char *url_encode(char *str) { 40 | char *pstr = str, *buf = malloc(strlen(str) * 3 + 1), *pbuf = buf; 41 | while (*pstr) { 42 | if (isalnum((unsigned char) *pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~') 43 | *pbuf++ = *pstr; 44 | else if (*pstr == ' ') 45 | *pbuf++ = '+'; 46 | else 47 | *pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15); 48 | pstr++; 49 | } 50 | *pbuf = '\0'; 51 | return buf; 52 | } 53 | 54 | void transmitSyscheck(char ReportBuffer[200][100], int *lines) { 55 | printLoadingBar(TXT_Upload, 0); 56 | gprintf("TempReport built\n"); 57 | 58 | char consoleid[40] = {0}; 59 | sprintf(consoleid, "%.*s****", strlen(ReportBuffer[CONSOLE_ID]) - 4, ReportBuffer[CONSOLE_ID]); 60 | sprintf(ReportBuffer[CONSOLE_ID], "%s", consoleid); 61 | 62 | int i = 0; 63 | int strl = 0; 64 | for (i = 0; i <= *lines; i++) { 65 | if (i == 9) continue; 66 | strl += strlen(ReportBuffer[i]); 67 | strl += strlen("\n"); 68 | } 69 | printLoadingBar(TXT_Upload, 20); 70 | char tempReport[strl]; 71 | memset(tempReport, 0, strl); 72 | for (i = 0; i <= *lines; i++) { 73 | if (i == 9) continue; 74 | strcat(tempReport, ReportBuffer[i]); 75 | strcat(tempReport, "\n"); 76 | } 77 | printLoadingBar(TXT_Upload, 40); 78 | 79 | int ret = net_init(); 80 | if (ret < 0) 81 | { 82 | net_deinit(); 83 | char temp[100] = {0}; 84 | snprintf(temp, sizeof(temp), "%d", ret); 85 | printUploadError(temp); 86 | while (1) 87 | { 88 | if (DetectInput(DI_BUTTONS_HELD) & WPAD_BUTTON_A) 89 | break; 90 | } 91 | return; 92 | } 93 | 94 | printLoadingBar(TXT_Upload, 60); 95 | gprintf("OK\n"); 96 | char *encodedReport = url_encode(tempReport); 97 | char bufTransmit[18+strlen(encodedReport)]; 98 | //char password[12] = {0}; 99 | gprintf("OK2\n"); 100 | //sprintf(bufTransmit, "password=%s&syscheck=%s", password, encodedReport); 101 | sprintf(bufTransmit, "password=B277eNGp789a&syscheck=%s", encodedReport); 102 | gprintf("bufTransmit: %s ENDE len:%u\n", bufTransmit, strlen(bufTransmit)); 103 | gprintf("OK3\n"); 104 | char host[48]; 105 | sprintf(host, "http://syscheck.rc24.xyz/syscheck_receiver.php"); 106 | http_post(host, 1024, bufTransmit); 107 | printLoadingBar(TXT_Upload, 80); 108 | gprintf("OK4\n\n"); 109 | 110 | u32 http_status; 111 | u8* outbuf; 112 | u32 lenght; 113 | 114 | http_get_result(&http_status, &outbuf, &lenght); 115 | printLoadingBar(TXT_Upload, 100); 116 | 117 | (*lines)++; 118 | memset(ReportBuffer[*lines], 0, 100); 119 | (*lines)++; 120 | memcpy(ReportBuffer[*lines], outbuf, lenght); 121 | 122 | 123 | free(outbuf); 124 | gprintf("len: %d, String: %s\n", lenght, ReportBuffer[*lines]); 125 | 126 | //u32 wpressed; 127 | 128 | if (!strncmp(ReportBuffer[*lines], "ERROR: ", 7)) { 129 | char temp[100] = {0}; 130 | snprintf(temp, sizeof(temp), "%s", ReportBuffer[*lines]+7); 131 | printUploadError(temp); 132 | memset(ReportBuffer[*lines], 0, 100); 133 | (*lines)--; 134 | (*lines)--; 135 | } else { 136 | printUploadSuccess(ReportBuffer[*lines]); 137 | } 138 | while (1) { 139 | if (DetectInput(DI_BUTTONS_HELD) & WPAD_BUTTON_A) break; 140 | } 141 | free(encodedReport); 142 | net_deinit(); 143 | } -------------------------------------------------------------------------------- /source/wiibasics.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------- 2 | 3 | wiibasics.c -- basic Wii initialization and functions 4 | 5 | Copyright (C) 2008 tona 6 | Unless other credit specified 7 | 8 | This software is provided 'as-is', without any express or implied 9 | warranty. In no event will the authors be held liable for any 10 | damages arising from the use of this software. 11 | 12 | Permission is granted to anyone to use this software for any 13 | purpose, including commercial applications, and to alter it and 14 | redistribute it freely, subject to the following restrictions: 15 | 16 | 1.The origin of this software must not be misrepresented; you 17 | must not claim that you wrote the original software. If you use 18 | this software in a product, an acknowledgment in the product 19 | documentation would be appreciated but is not required. 20 | 21 | 2.Altered source versions must be plainly marked as such, and 22 | must not be misrepresented as being the original software. 23 | 24 | 3.This notice may not be removed or altered from any source 25 | distribution. 26 | 27 | -------------------------------------------------------------*/ 28 | 29 | #include <stdio.h> 30 | #include <stdlib.h> 31 | #include <gccore.h> 32 | 33 | u32 be32(const u8 *p) 34 | { 35 | return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; 36 | } 37 | 38 | u64 be64(const u8 *p) 39 | { 40 | return ((u64)be32(p) << 32) | be32(p + 4); 41 | } 42 | --------------------------------------------------------------------------------