Initial "System Information" page, new font, development coldboot titles, optimized drawing routines (#10)
* gfx.c: Optimize drawing routines.
- Use pointer arithmetic instead of calling gfx_draw_pixel() for each
pixel.
- gfx_draw_rect_filled(): Draw each rectangle inline, and use 1.5x scaling
for the TV framebuffer.
- gfx_draw_char(): Likewise. A makeshift scaling algorithm is being used
for now. The font will be replaced with two fonts next in order to
eliminate scaling artifacts:
- Terminus 8x16 bold for the gamepad
- Terminus 12x24 bold for the TV
* menu.c: Factor out top/bottom bar drawing.
Code size difference:
text data bss dec hex filename
17624 0 8224 25848 64f8 ios_mcp.elf [before]
16948 0 8224 25172 6254 ios_mcp.elf [after]
-676 0 0 -676 -2a4 Difference
* Replace the font with Termins 8x16 bold (DRC) and 12x24 bold (TV).
The TV font is drawn without scaling, so it's much more readable than
the previous 8x8 font drawn with nearest-neighbor scaling.
NOTE: Since we're storing two fonts now, the font size has increased
significantly. I should compress it somehow, maybe with MiniLZO.
Code size difference:
text data bss dec hex filename
16948 0 8224 25172 6254 ios_mcp.elf [before]
22368 0 8224 30592 7780 ios_mcp.elf [after]
+5420 0 0 +5420 +152c Difference
* Compress the Terminus font using lzo1x.
This requires adding MiniLZO to decompress it, but the resulting size
is still significantly smaller than uncompressed.
Code size difference:
text data bss dec hex filename
22368 0 8224 30592 7780 ios_mcp.elf [before]
19232 0 8224 27456 6b40 ios_mcp.elf [after]
-3136 0 0 -3136 0 Difference
This effectively means the increase from switching to Terminus is:
5420 - 3136 = 2284 bytes
* option_SetColdbootTitle(): Print the current title IDs in hi/lo notation instead of as a single 64-bit hex value.
I think hi/lo is easier to read than a single 64-bit hex value.
* Remove some LZO debug code.
I was having weird crashes when testing LZO earlier. It turns out
that the "lzopack" example tool adds its own custom header, which
we don't want here. "precomp2" doesn't add a header, so I used that
for the Terminus font data.
Code size difference:
text data bss dec hex filename
19232 0 8224 27456 6b40 ios_mcp.elf [before]
19196 0 8224 27420 6b1c ios_mcp.elf [after]
-36 0 0 -36 -24 Difference
* Add a "System Information" screen.
Currently shows model, serial, keyset, boardType, sataDevice,
consoleType, and productArea.
TODO: gameRegion is 0 in all the SEEPROMs I've checked.
Maybe map in the MCP_GetSysProdSettings() function?
* Some minor optimizations.
- gfx.c: Use IOS_HeapAlloc() instead of IOS_HeapAllocAligned().
We don't need an aligned allocation for lzo1x decompression.
- option_SetColdbootTitle(): Factor out the setDefaultTitleId() call.
- option_StartWupserver(): Use %u instead of %d for the IPv4 octets.
Code size difference:
text data bss dec hex filename
20276 0 8224 28500 6f54 ios_mcp.elf [before]
20192 0 8224 28416 6f00 ios_mcp.elf [after]
-84 0 0 -84 -54 Difference
* option_SetColdbootTitle(): Allow setting SCT, DEVMENU, or Kiosk Menu if the system is using the Debug keyset.
Fixes #9: Coldboot Title: Add DEVMENU, System Config Tool, Kiosk Menu
* option_SystemInformation(): productArea in SEEPROM is wrong.
On one of my CAT-Is, it's showing 2 (EUR), but the system is set to
1 (USA).
Remove it for now.
* isSystemUsingDebugKeyset(): Check for != 0x10 instead of == 0x08.
This will include Factory and Invalid. I doubt we'll ever find any
systems set to Factory, and Invalid wouldn't boot.
* network_parse_config_value(): Use CHAR_SIZE_DRC_Y.
* option_SystemInformation(): Show the Wii U Menu version.
NOTE: On my CAT-I, all three region-specific version titles are
present, and they all have "11.0.0". I'll need to check the sys_prod.xml
region data later to find the actual region codes.
* option_SystemInformation(): Show sataDevice and consoleType names in parentheses.
* option_SystemInformation(): Show "Kiosk" instead of "CAT-I".
I believe CAT-SES has the same consoleType value.
* option_SystemInformation(): Show the manufacturing date if it's available.
Some development units have this field completely blank, so it won't be
shown if it's all zeroes.
* option_SystemInformation(): Use uint32_t for the version magic.
Code size difference:
text data bss dec hex filename
20996 0 8224 29220 7224 ios_mcp.elf [before]
20988 0 8224 29212 721c ios_mcp.elf [after]
-8 0 0 -8 -8 Difference
* option_SystemInformation(): Show productArea and gameRegion.
productArea is a single region; gameRegion can be multiple regions.
It's normally only a single region on retail, though.
mcp_misc.c: Implement MCP_GetSysProdSettings().
* option_SystemInformation(): Use productArea to determine the version.bin title to use.
This might break if productArea is set to a region that doesn't match
the version.bin title that's installed, but that's an unlikely occurrence.
* option_SystemInformation(): Add a space between the version number and the region code.
Wii U System Settings does this. 3DS does not, but 3DS has an extra
"NVer" value that has the region code appended to it.
* Fixes requested in PR #10.
- Remove an obsolete TODO: the Terminus font is LZO1X compressed.
- Use "uint32_t* p" format instead of "uint32_t *p".
- Remove some debug LZO variables that I forgot to remove earlier.
- gfx.c: Add some more DC_INIT checks.
- gfx.c: Explicitly specify 1.5f instead of 1.5 to use 32-bit float.
Interestingly, the 32-bit float change reduced the code size a bit:
text data bss dec hex filename
21424 0 8224 29648 73d0 ios_mcp.elf [before]
20752 0 8224 28976 7130 ios_mcp.elf [after]
-672 0 0 -672 -2a0 Difference
* option_EditParental(): Missed some text height changes.
* menuThread(): No need to flush FSA if gfx_init_font() fails.
* Use #pragma once instead of #ifndef __header__.
This commit is contained in:
parent
485a3e9fa7
commit
2b5fdb6f89
13 changed files with 11309 additions and 234 deletions
|
|
@ -33,14 +33,14 @@ MACHDEP = -DSTARBUCK -mbig-endian -mcpu=arm926ej-s -msoft-float -mfloat-abi=soft
|
|||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
SOURCES := source source/minilzo
|
||||
DATA := data
|
||||
INCLUDES := source
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
CFLAGS := -Wall -std=gnu11 -Os -flto -fno-tree-loop-distribute-patterns -fno-builtin $(MACHDEP) $(INCLUDE)
|
||||
CFLAGS := -Wall -std=gnu11 -Os -flto -fno-tree-loop-distribute-patterns -fno-builtin -DMINILZO_CFG_SKIP_LZO1X_1_COMPRESS $(MACHDEP) $(INCLUDE)
|
||||
|
||||
ASFLAGS := $(MACHDEP)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,65 +1,129 @@
|
|||
static const unsigned char font_bin[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x18,
|
||||
0x18, 0x00, 0x0c, 0x00, 0x00, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x66, 0x66, 0xff, 0x66, 0xff, 0x66, 0x66, 0x00, 0x18, 0x7c, 0x06,
|
||||
0x3c, 0x60, 0x3e, 0x18, 0x10, 0x46, 0x66, 0x30, 0x18, 0x0c, 0x66, 0x62,
|
||||
0x00, 0x3c, 0x66, 0x3c, 0x1c, 0xe6, 0x66, 0xfc, 0x00, 0x18, 0x0c, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x00,
|
||||
0x00, 0x0c, 0x18, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x66, 0x3c, 0xff,
|
||||
0x3c, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x3e,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
|
||||
0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x3c, 0x66, 0x76,
|
||||
0x6e, 0x66, 0x3c, 0x00, 0x00, 0x18, 0x1c, 0x18, 0x18, 0x18, 0x7e, 0x00,
|
||||
0x00, 0x3c, 0x62, 0x30, 0x0c, 0x06, 0x7e, 0x00, 0x00, 0x3c, 0x62, 0x38,
|
||||
0x60, 0x66, 0x3c, 0x00, 0x00, 0x6c, 0x6c, 0x66, 0xfe, 0x60, 0x60, 0x00,
|
||||
0x00, 0x7e, 0x06, 0x7e, 0x60, 0x66, 0x3c, 0x00, 0x00, 0x3c, 0x06, 0x3e,
|
||||
0x66, 0x66, 0x3c, 0x00, 0x00, 0x7e, 0x30, 0x30, 0x18, 0x18, 0x18, 0x00,
|
||||
0x00, 0x3c, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x3c, 0x66, 0x7c,
|
||||
0x60, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00,
|
||||
0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x0c, 0x00, 0x00, 0x70, 0x1c, 0x06,
|
||||
0x06, 0x1c, 0x70, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0e, 0x38, 0x60, 0x60, 0x38, 0x0e, 0x00, 0x00, 0x3c, 0x66, 0x30,
|
||||
0x18, 0x00, 0x18, 0x00, 0x00, 0x3c, 0x66, 0x76, 0x76, 0x06, 0x46, 0x3c,
|
||||
0x00, 0x3c, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x3e, 0x66, 0x3e,
|
||||
0x66, 0x66, 0x3e, 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x1e, 0x36, 0x66, 0x66, 0x36, 0x1e, 0x00, 0x00, 0x7e, 0x06, 0x1e,
|
||||
0x06, 0x06, 0x7e, 0x00, 0x00, 0x3e, 0x06, 0x1e, 0x06, 0x06, 0x06, 0x00,
|
||||
0x00, 0x3c, 0x66, 0x06, 0x76, 0x66, 0x3c, 0x00, 0x00, 0x66, 0x66, 0x7e,
|
||||
0x66, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00,
|
||||
0x00, 0x78, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x66, 0x36, 0x1e,
|
||||
0x1e, 0x36, 0x66, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7e, 0x00,
|
||||
0x00, 0x46, 0x6e, 0x7e, 0x56, 0x46, 0x46, 0x00, 0x00, 0x66, 0x6e, 0x7e,
|
||||
0x76, 0x66, 0x66, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x3e, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x3c, 0x66, 0x66,
|
||||
0x66, 0x3c, 0x70, 0x00, 0x00, 0x3e, 0x66, 0x3e, 0x1e, 0x36, 0x66, 0x00,
|
||||
0x00, 0x3c, 0x66, 0x0c, 0x30, 0x66, 0x3c, 0x00, 0x00, 0x7e, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00,
|
||||
0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x46, 0x46, 0x56,
|
||||
0x7e, 0x6e, 0x46, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00,
|
||||
0x00, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x00, 0x7e, 0x30, 0x18,
|
||||
0x0c, 0x06, 0x7e, 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c,
|
||||
0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00, 0x3c, 0x30, 0x30,
|
||||
0x30, 0x30, 0x30, 0x3c, 0x00, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x0c, 0x18, 0x30,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x7c, 0x66, 0x7c, 0x00,
|
||||
0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x06,
|
||||
0x06, 0x06, 0x3c, 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x66, 0x7e, 0x06, 0x3c, 0x00, 0x00, 0x38, 0x0c, 0x3e,
|
||||
0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x7c, 0x40, 0x3c, 0x00,
|
||||
0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x00, 0x00, 0x18, 0x00, 0x1c,
|
||||
0x18, 0x18, 0x3c, 0x00, 0x00, 0x30, 0x00, 0x30, 0x30, 0x30, 0x1e, 0x00,
|
||||
0x00, 0x06, 0x06, 0x36, 0x1e, 0x36, 0x66, 0x00, 0x00, 0x1c, 0x18, 0x18,
|
||||
0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x66, 0xfe, 0xfe, 0xd6, 0xc6, 0x00,
|
||||
0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x3c, 0x66,
|
||||
0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x00,
|
||||
0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x66,
|
||||
0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x06, 0x3c, 0x60, 0x3e, 0x00,
|
||||
0x00, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x66, 0x66,
|
||||
0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00,
|
||||
0x00, 0x00, 0xc6, 0xd6, 0xfe, 0x7c, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x3c,
|
||||
0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x7c, 0x60, 0x3c, 0x00,
|
||||
0x00, 0x00, 0x7e, 0x30, 0x18, 0x0c, 0x7e, 0x00, 0x00, 0x00, 0x18, 0x08,
|
||||
0x08, 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x0c, 0x08, 0x08, 0x10, 0x08, 0x08
|
||||
#pragma once
|
||||
|
||||
// Fonts used: Terminus 1.49 - ter-u16b.bdf, ter-u24b.bdf
|
||||
// - http://terminus-font.sourceforge.net/
|
||||
// Character encoding is ASCII.
|
||||
|
||||
// NOTE: Only characters [32,128) are included due to size constraints.
|
||||
|
||||
// Decompressed Terminus font data.
|
||||
typedef struct _terminus_font {
|
||||
// Terminus 8x16, bold
|
||||
// Used as the GamePad font. (854x480 -> 106x30)
|
||||
unsigned char ter_u16b[128-32][16];
|
||||
|
||||
// Terminus 12x24, bold
|
||||
// Used as the TV font. (1280x720 -> 106x30)
|
||||
unsigned short ter_u24b[128-32][24];
|
||||
} terminus_font;
|
||||
|
||||
// The following data is compressed using LZO1X and should be
|
||||
// decompressed using MiniLZO first. The decompressed data can
|
||||
// be decoded using the terminus_font struct.
|
||||
static const unsigned char terminus_lzo1x[1674] = {
|
||||
0x12,0x00,0x2f,0x01,0x00,0x18,0xa0,0x00,0x5c,0x00,0x9b,0x01,0x66,0x66,0x66,0x2c,
|
||||
0x7d,0x00,0x36,0x01,0x00,0x7f,0x89,0x00,0x36,0x98,0x01,0x0a,0x08,0x08,0x3e,0x6b,
|
||||
0x0b,0x0b,0x3e,0x68,0x68,0x6b,0x3e,0x08,0x08,0x83,0x06,0x6b,0x36,0x30,0x0f,0x0e,
|
||||
0x0c,0x6c,0xd6,0xdc,0x06,0x07,0x1c,0x36,0x36,0x1c,0x6e,0x3b,0x33,0x33,0x3b,0x6e,
|
||||
0xf8,0x0b,0x2c,0x3f,0x01,0x30,0x18,0x0c,0x82,0x00,0x18,0x30,0xbc,0x01,0x40,0x01,
|
||||
0x82,0x00,0x18,0x0c,0x28,0xc8,0x01,0x01,0x1c,0x7f,0x1c,0x36,0x2b,0x89,0x02,0x7e,
|
||||
0x2e,0x14,0x01,0x70,0x02,0x28,0xc2,0x00,0x00,0x7f,0x32,0x5c,0x03,0xbf,0x00,0x60,
|
||||
0x60,0x30,0x7f,0x13,0x0c,0x06,0x06,0xbc,0x01,0x07,0x3e,0x63,0x63,0x73,0x7b,0x6f,
|
||||
0x67,0x63,0x63,0x3e,0xde,0x04,0x1c,0x1e,0xa5,0x20,0x7e,0x27,0x7d,0x00,0x60,0x53,
|
||||
0x11,0x06,0x03,0x7f,0x28,0x3f,0x00,0x3c,0x60,0x60,0x27,0xbc,0x00,0x07,0x60,0x70,
|
||||
0x78,0x6c,0x66,0x63,0x7f,0x60,0x60,0x60,0xc9,0x0f,0x03,0x01,0x00,0x3f,0x54,0x01,
|
||||
0xfe,0x03,0x3c,0x06,0x5e,0x01,0x63,0x63,0x27,0xbd,0x00,0x7f,0xe0,0x10,0xd9,0x15,
|
||||
0x3e,0x68,0x03,0x29,0x7c,0x00,0x8d,0x01,0x7e,0x51,0x04,0x1e,0x2c,0xe8,0x02,0x29,
|
||||
0xc4,0x03,0xdc,0x01,0xc0,0x08,0x94,0x13,0x55,0x26,0x60,0x2a,0xf4,0x03,0x29,0x00,
|
||||
0x04,0x8c,0x03,0x6c,0x04,0x28,0x7d,0x01,0x30,0x28,0x7c,0x07,0x5e,0x01,0x73,0x6b,
|
||||
0x43,0x00,0x73,0x03,0x7e,0x29,0xfd,0x01,0x7f,0x70,0x00,0xbc,0x01,0x6c,0x17,0x9d,
|
||||
0x17,0x3f,0x27,0x7c,0x00,0x45,0x1c,0x03,0x27,0xbf,0x02,0x1f,0x33,0x63,0x82,0x00,
|
||||
0x33,0x1f,0x28,0xfd,0x03,0x1f,0x65,0x04,0x7f,0x2d,0x3d,0x00,0x03,0x29,0xfd,0x00,
|
||||
0x7b,0x28,0xbc,0x03,0x27,0xb8,0x01,0xdd,0x0d,0x3c,0xc2,0x50,0x18,0x3c,0xbd,0x01,
|
||||
0x78,0xbb,0x41,0x33,0x33,0x1e,0xfc,0x05,0x03,0x33,0x1b,0x0f,0x0f,0x1b,0x33,0xfd,
|
||||
0x05,0x03,0xe0,0x00,0xdc,0x0d,0x02,0x41,0x63,0x77,0x7f,0x6b,0x29,0x3c,0x01,0x40,
|
||||
0x01,0x01,0x67,0x6f,0x7b,0x73,0x27,0x3e,0x00,0x3e,0x63,0xc1,0x00,0x3e,0x28,0x7e,
|
||||
0x03,0x63,0x3f,0x2b,0x7c,0x02,0x83,0x00,0x7b,0x3e,0x60,0x29,0x7c,0x00,0x60,0x0e,
|
||||
0xff,0x03,0x03,0x03,0x3e,0x29,0xfd,0x07,0xff,0xfd,0x15,0x18,0x28,0x3c,0x03,0x2a,
|
||||
0x7c,0x01,0x8c,0x01,0x56,0x65,0x1c,0x1c,0x29,0x3c,0x00,0x02,0x6b,0x7f,0x77,0x63,
|
||||
0x41,0xfc,0x01,0x6e,0x03,0x36,0x36,0xfe,0x13,0xc3,0xc3,0x05,0xdc,0x3c,0x29,0x3c,
|
||||
0x01,0x7c,0x45,0x78,0x4f,0xfe,0x1b,0x3c,0x0c,0xc0,0x00,0xde,0x23,0x06,0x06,0x4c,
|
||||
0x67,0x4c,0x66,0xfe,0x4f,0x3c,0x30,0xc0,0x00,0xbc,0x03,0x01,0x18,0x3c,0x66,0x00,
|
||||
0x36,0x01,0x00,0x7f,0x74,0x6d,0x31,0x5f,0x00,0x3e,0x60,0x7e,0x6c,0x50,0x27,0x7c,
|
||||
0x05,0x88,0x20,0xfc,0x3f,0xc9,0x20,0x03,0x27,0xfd,0x0b,0x60,0x94,0x05,0x27,0xbc,
|
||||
0x00,0xa8,0x28,0x54,0x3e,0xdd,0x03,0x78,0x09,0x27,0x3f,0xa0,0x16,0x27,0x7c,0x00,
|
||||
0xdf,0x05,0x60,0x60,0x3e,0x2a,0x7c,0x01,0xdc,0x1f,0x5d,0x1e,0x1c,0x2a,0xfc,0x07,
|
||||
0x5e,0x1a,0x70,0x60,0x80,0x00,0x5c,0x22,0xbc,0x05,0x64,0x40,0x27,0x3d,0x06,0x1c,
|
||||
0x2d,0xbc,0x08,0x69,0x36,0x6b,0x80,0x00,0x28,0x3c,0x00,0x2a,0x7c,0x01,0x27,0x89,
|
||||
0x07,0x3e,0x2d,0x7d,0x00,0x3f,0x27,0x08,0x08,0x27,0x7c,0x02,0xcb,0x2a,0x7b,0x0f,
|
||||
0x07,0x28,0x7c,0x08,0x7c,0x03,0x84,0x40,0xdd,0x21,0x0c,0xfd,0x1b,0x78,0x27,0x7d,
|
||||
0x00,0x63,0x2d,0x3d,0x04,0x63,0xac,0x3c,0x29,0x3c,0x00,0x79,0x13,0x3e,0x29,0x3f,
|
||||
0x00,0x36,0x1c,0x36,0x29,0x7d,0x02,0x63,0x2a,0x7c,0x04,0x7c,0x34,0x2a,0xfd,0x11,
|
||||
0x38,0x49,0x0d,0x06,0x7d,0x0d,0x38,0x2b,0xbc,0x16,0x27,0xbd,0x08,0x0e,0x45,0x01,
|
||||
0x30,0x79,0x01,0x0e,0x98,0x01,0x01,0xce,0xdb,0x73,0x00,0x20,0x33,0x01,0x00,0x60,
|
||||
0x31,0x04,0x00,0x28,0x5c,0x00,0x2b,0x02,0x00,0x01,0x98,0xe4,0x00,0x20,0x09,0x78,
|
||||
0x01,0xe6,0x06,0x07,0xfe,0x28,0xf4,0x00,0x28,0x2c,0x00,0x32,0x34,0x02,0x04,0x01,
|
||||
0xf8,0x03,0x6c,0x06,0x66,0x00,0x65,0x00,0x6c,0x4e,0x01,0x60,0x06,0x66,0x00,0x66,
|
||||
0x03,0x4c,0x01,0x30,0x44,0x02,0x9c,0x5a,0x06,0x1c,0x03,0x36,0x01,0xb6,0x01,0x9c,
|
||||
0x00,0xc0,0x44,0x00,0x64,0x04,0x08,0x30,0x00,0x30,0x03,0x98,0x06,0xd8,0x06,0xcc,
|
||||
0x03,0x8c,0x31,0x40,0x02,0x02,0x70,0x00,0xd8,0x01,0x8c,0x66,0x00,0x00,0xd8,0x0e,
|
||||
0x02,0x06,0x78,0x57,0x04,0x86,0x03,0x06,0x45,0x00,0x86,0x06,0x02,0x06,0x78,0x37,
|
||||
0x6c,0x04,0x20,0x09,0x01,0x00,0xc0,0xa6,0x10,0x00,0x18,0x2b,0x04,0x00,0x65,0x02,
|
||||
0x60,0x4c,0x03,0x31,0x38,0x1b,0x85,0x03,0x60,0x94,0x17,0x28,0x04,0x00,0xbd,0x18,
|
||||
0x18,0x36,0x92,0x01,0x03,0x06,0xbe,0x17,0x07,0xff,0xbe,0x19,0x03,0x06,0x20,0x05,
|
||||
0x96,0x07,0x07,0xfe,0x20,0x12,0x44,0x03,0x2a,0x25,0x04,0x30,0x3c,0x98,0x00,0x5c,
|
||||
0x0b,0x20,0x1d,0x1c,0x0a,0x32,0xac,0x03,0x46,0x00,0x01,0x80,0x04,0x00,0x2a,0x7c,
|
||||
0x07,0x8f,0x2a,0x0c,0x00,0x0c,0x31,0xbe,0x09,0xf8,0x03,0x21,0x47,0x20,0x06,0x06,
|
||||
0x07,0x04,0x00,0x08,0x86,0x06,0xc6,0x06,0x66,0x06,0x36,0x06,0x1e,0x06,0x0e,0x66,
|
||||
0x02,0x03,0x0c,0x44,0x48,0x32,0xde,0x01,0x70,0x00,0x0d,0x7d,0x6c,0x32,0x1e,0x0c,
|
||||
0x03,0xfc,0x38,0x7c,0x01,0x40,0x00,0x9c,0x12,0xdc,0x3d,0x75,0x11,0x06,0x32,0xf4,
|
||||
0x03,0xdd,0x05,0x00,0x64,0x00,0x5f,0x05,0xf0,0x03,0x00,0xac,0x01,0x36,0x3c,0x02,
|
||||
0x0c,0x06,0x00,0x07,0x00,0x07,0x80,0x06,0xc0,0x06,0x60,0x06,0x30,0x06,0x18,0x06,
|
||||
0xce,0x0d,0x07,0xfe,0xb4,0x06,0x33,0xc5,0x05,0x06,0xe7,0x00,0x01,0xfe,0x03,0x28,
|
||||
0x30,0x00,0x35,0x7e,0x01,0x03,0xf8,0x64,0x15,0x27,0xbd,0x00,0x06,0x28,0x00,0x00,
|
||||
0x34,0xbc,0x00,0x44,0x0f,0xcc,0x1d,0x2d,0x14,0x06,0x35,0xbc,0x06,0x29,0x7c,0x04,
|
||||
0x84,0x0a,0x2c,0x34,0x00,0x3c,0xbc,0x00,0x43,0x00,0x0c,0x07,0xf8,0xe4,0x18,0x5d,
|
||||
0x0d,0xfc,0x20,0x08,0xbc,0x08,0x20,0x01,0x4c,0x0b,0x32,0xbc,0x00,0x31,0x3c,0x0b,
|
||||
0x2e,0x4c,0x07,0x4c,0x00,0xa5,0x74,0xc0,0x0d,0x05,0x03,0x20,0x06,0xec,0x0b,0x3b,
|
||||
0x14,0x0c,0x2d,0x44,0x01,0x2d,0xb4,0x01,0x39,0x7c,0x04,0x27,0xad,0x00,0x60,0x3a,
|
||||
0xc6,0x03,0x01,0xfc,0x4c,0x3a,0x04,0x03,0x07,0xc3,0x06,0x63,0x06,0x33,0x27,0x07,
|
||||
0x00,0x63,0x07,0xc3,0x43,0x1b,0x06,0x07,0xfc,0x3f,0xfd,0x05,0x06,0xdc,0x3d,0xe8,
|
||||
0x5c,0x30,0xbc,0x00,0x27,0xcd,0x08,0x03,0x2e,0xfc,0x08,0x5c,0x01,0x38,0x7d,0x01,
|
||||
0x00,0x2b,0x04,0x00,0x39,0x3c,0x08,0x2b,0x4d,0x01,0x06,0x3f,0x7c,0x01,0x2a,0xfc,
|
||||
0x0b,0x64,0x5a,0x2a,0x35,0x00,0x07,0x20,0x0e,0xbc,0x00,0x3a,0xfc,0x05,0xc5,0x0a,
|
||||
0xc6,0x3e,0xbc,0x0c,0x2c,0xcc,0x02,0x2c,0x34,0x05,0x33,0x3d,0x05,0xf8,0x33,0x05,
|
||||
0x1e,0x60,0xa4,0xe1,0x30,0xbc,0x00,0x01,0x0f,0xc0,0x03,0x00,0x2f,0x04,0x00,0x7c,
|
||||
0xd7,0x64,0xc2,0x33,0x3c,0x02,0x47,0x03,0x86,0x00,0xc6,0x54,0xe9,0x02,0x36,0x00,
|
||||
0x1e,0x00,0x0e,0x4d,0x00,0x36,0x4c,0x01,0x01,0xc6,0x01,0x86,0x03,0x33,0x3c,0x02,
|
||||
0x2d,0x3d,0x04,0x06,0x3e,0x3e,0x05,0x04,0x01,0x54,0x4d,0x08,0x07,0x07,0x8f,0x06,
|
||||
0xdb,0x06,0x73,0x06,0x23,0x06,0x03,0x2c,0x04,0x00,0x39,0x7d,0x04,0x0e,0x5d,0xb2,
|
||||
0x36,0x5c,0xb3,0x01,0xc6,0x07,0x86,0x07,0x3b,0x7c,0x04,0x2c,0x7c,0x0a,0x3e,0xfc,
|
||||
0x05,0x2a,0xfd,0x08,0x03,0x20,0x0a,0x7c,0x07,0x2f,0x03,0x00,0x66,0x03,0xcc,0x4c,
|
||||
0x03,0x2f,0xc8,0x00,0x2f,0x7c,0x01,0x3d,0x3c,0x05,0xbc,0x0b,0xd5,0x0f,0x0c,0xa4,
|
||||
0x0a,0x3a,0x7c,0x16,0x29,0x84,0x1e,0x36,0x64,0x26,0x39,0xbc,0x09,0x20,0x01,0x7c,
|
||||
0x04,0x28,0x74,0x00,0xa4,0x00,0x25,0x1d,0x26,0xf0,0x44,0x00,0x34,0x7c,0x01,0x2d,
|
||||
0x44,0x07,0x4d,0x3c,0x73,0x0e,0x7a,0x07,0x8f,0x0a,0x7c,0x06,0x03,0x0c,0x7e,0x34,
|
||||
0x7c,0x01,0xfc,0x0a,0x8d,0x0a,0xf0,0x64,0x01,0x64,0x02,0x34,0x7c,0x07,0x2d,0xbd,
|
||||
0x00,0xf0,0x3e,0xbc,0x03,0xe4,0xe1,0x2f,0xe4,0x14,0x35,0x7c,0x0a,0x4d,0x62,0x18,
|
||||
0x37,0x05,0x00,0xf8,0x33,0x85,0x16,0x0c,0x84,0xb4,0x26,0xcc,0x26,0x23,0x64,0x26,
|
||||
0x64,0xdf,0x64,0x6d,0x33,0x7d,0x01,0xc0,0x37,0x05,0x00,0xf8,0x2f,0x0d,0x1a,0xf0,
|
||||
0x6e,0x21,0x06,0x06,0x20,0x29,0xf8,0x2e,0x29,0xcc,0x03,0xb4,0xca,0x20,0x16,0x00,
|
||||
0x00,0x5c,0xc6,0x90,0x28,0x5c,0xef,0xfc,0x61,0x4c,0xf1,0x38,0x7c,0x10,0x30,0x9c,
|
||||
0x16,0x34,0x7c,0x16,0x33,0x1c,0x0c,0x84,0xc0,0x36,0xfd,0x23,0x06,0x2e,0x1d,0x02,
|
||||
0x06,0x3b,0x3c,0x02,0x2f,0x1c,0x0f,0xe7,0xbc,0x06,0x0c,0x03,0x32,0x7d,0x0d,0xc0,
|
||||
0x27,0x6c,0x27,0x20,0x04,0x7c,0x0d,0x27,0xdc,0x00,0x2f,0x3d,0x02,0x07,0x25,0xac,
|
||||
0x22,0x2d,0x9c,0x22,0x37,0x7c,0x04,0x34,0xfc,0x0b,0x27,0xdd,0x01,0x78,0x20,0x05,
|
||||
0xfc,0x17,0xa4,0xbe,0x5c,0x00,0x32,0x1d,0x18,0x00,0xa4,0x69,0x54,0x68,0x2c,0x34,
|
||||
0x0b,0x45,0x00,0x06,0x67,0x03,0x8c,0x00,0xcc,0x21,0xa5,0x2b,0x3c,0x4d,0x00,0xcc,
|
||||
0x21,0xcc,0x30,0x4c,0x02,0x31,0x3d,0x02,0x78,0x20,0x0d,0x3c,0x1a,0x29,0x5e,0x14,
|
||||
0x66,0x06,0x2f,0x04,0x00,0x3b,0xbc,0x00,0x20,0x05,0x7c,0x04,0x37,0x9c,0x16,0x35,
|
||||
0x3c,0x2f,0x37,0x7c,0x01,0x2b,0x34,0x18,0x20,0x02,0x7c,0x07,0x2a,0x2c,0x2a,0x31,
|
||||
0xbd,0x00,0xe6,0xdc,0xe9,0x3d,0x7c,0x19,0x27,0xdd,0x06,0xfc,0xf4,0x5f,0x44,0x01,
|
||||
0xe4,0xc0,0x32,0x7d,0x2b,0x30,0xa4,0x00,0x4d,0x15,0x30,0x2e,0x06,0x00,0x03,0xe0,
|
||||
0x39,0x58,0x29,0x30,0x00,0x00,0x3b,0xbc,0x0c,0x28,0x14,0x18,0x3c,0xfc,0x17,0x2f,
|
||||
0x7c,0x01,0x29,0x76,0x07,0x03,0xfc,0x3c,0xbc,0x00,0xcc,0x51,0x27,0xd4,0x13,0x3a,
|
||||
0x7c,0x07,0x30,0xf8,0x02,0x35,0x7c,0x0d,0x29,0x1c,0x18,0x20,0x04,0xfc,0x35,0x26,
|
||||
0x3c,0x3e,0xa5,0x00,0x1c,0x29,0x2f,0x00,0x60,0x01,0xc0,0x20,0x06,0x3c,0x44,0x3a,
|
||||
0x7d,0x10,0x1c,0xd4,0xc4,0xa4,0x64,0x2a,0x6c,0x34,0x74,0x0d,0x2c,0x8d,0x03,0x3c,
|
||||
0x95,0x26,0xc6,0x20,0x33,0x18,0x47,0x11,0x00,0x00
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,20 +4,51 @@
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "font_bin.h"
|
||||
|
||||
#define TV_FRAMEBUFFER ((uint32_t*) (0x14000000 + 0x3500000))
|
||||
static uint32_t* const TV_FRAMEBUFFER = (uint32_t*)(0x14000000 + 0x3500000);
|
||||
#define TV_HEIGHT 720
|
||||
#define TV_STRIDE 1280
|
||||
|
||||
#define DRC_FRAMEBUFFER ((uint32_t*) (0x14000000 + 0x38c0000))
|
||||
static uint32_t* const DRC_FRAMEBUFFER = (uint32_t*)(0x14000000 + 0x38c0000);
|
||||
#define DRC_HEIGHT 480
|
||||
#define DRC_STRIDE 896
|
||||
|
||||
#define CHAR_SIZE_X 8
|
||||
#define CHAR_SIZE_Y 8
|
||||
#define CHAR_SIZE_TV_X 12
|
||||
#define CHAR_SIZE_TV_Y 24
|
||||
|
||||
static uint32_t font_color = 0xffffffff;
|
||||
// Default font color is white.
|
||||
static uint32_t font_color = 0xFFFFFFFF;
|
||||
|
||||
// Terminus fonts (8x16 for DRC, 12x24 for TV)
|
||||
// NOTE: Allocated using IOS_HeapAlloc().
|
||||
#include "font_bin.h"
|
||||
#include "minilzo/minilzo.h"
|
||||
static terminus_font* font = NULL;
|
||||
|
||||
int gfx_init_font(void)
|
||||
{
|
||||
if (font)
|
||||
return 0;
|
||||
|
||||
font = IOS_HeapAlloc(0xcaff, sizeof(*font));
|
||||
if (!font) {
|
||||
printf("Memory allocation for the font buffer failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
lzo_uint data_len = sizeof(*font);
|
||||
int res = lzo1x_decompress_safe(terminus_lzo1x, sizeof(terminus_lzo1x),
|
||||
(lzo_bytep)font, &data_len, NULL);
|
||||
if (res != LZO_E_OK || data_len != sizeof(*font)) {
|
||||
// LZO decompression failed.
|
||||
printf("lzo1x_decompress() failed: res == %d, data_len == %lu\n", res, data_len);
|
||||
IOS_HeapFree(0xcaff, font);
|
||||
font = NULL;
|
||||
return -2;
|
||||
}
|
||||
|
||||
// LZO decompression succeeded.
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gfx_clear(uint32_t col)
|
||||
{
|
||||
|
|
@ -61,10 +92,31 @@ void gfx_draw_pixel(uint32_t x, uint32_t y, uint32_t col)
|
|||
|
||||
void gfx_draw_rect_filled(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t col)
|
||||
{
|
||||
for (uint32_t yy = y; yy < y + h; yy++) {
|
||||
for (uint32_t xx = x; xx < x + w; xx++) {
|
||||
gfx_draw_pixel(xx, yy, col);
|
||||
#ifdef DC_INIT
|
||||
// both DC configurations use XRGB instead of RGBX
|
||||
col >>= 8;
|
||||
#endif
|
||||
|
||||
// DRC fill: normal scale
|
||||
uint32_t* p = DRC_FRAMEBUFFER + (y * DRC_STRIDE) + x;
|
||||
uint32_t stride_diff = DRC_STRIDE - w;
|
||||
|
||||
for (uint32_t hcnt = h; hcnt > 0; hcnt--) {
|
||||
for (uint32_t wcnt = w; wcnt > 0; wcnt--) {
|
||||
*p++ = col;
|
||||
}
|
||||
p += stride_diff;
|
||||
}
|
||||
|
||||
// TV fill: 1.5x scale
|
||||
p = TV_FRAMEBUFFER + ((uint32_t)(y * 1.5f) * TV_STRIDE) + (uint32_t)(x * 1.5f);
|
||||
stride_diff = TV_STRIDE - (w * 1.5f);
|
||||
|
||||
for (uint32_t hcnt = (h * 1.5f); hcnt > 0; hcnt--) {
|
||||
for (uint32_t wcnt = (w * 1.5f); wcnt > 0; wcnt--) {
|
||||
*p++ = col;
|
||||
}
|
||||
p += stride_diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,34 +130,58 @@ void gfx_draw_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t bord
|
|||
|
||||
void gfx_set_font_color(uint32_t col)
|
||||
{
|
||||
#ifdef DC_INIT
|
||||
// both DC configurations use XRGB instead of RGBX
|
||||
col >>= 8;
|
||||
#endif
|
||||
|
||||
font_color = col;
|
||||
}
|
||||
|
||||
uint32_t gfx_get_text_width(const char* string)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; string[i]; i++);
|
||||
return i * CHAR_SIZE_X;
|
||||
for (i = 0; *string; i++, string++);
|
||||
return i * CHAR_SIZE_DRC_X;
|
||||
}
|
||||
|
||||
static void gfx_draw_char(uint32_t x, uint32_t y, char c)
|
||||
{
|
||||
if(c < 32) {
|
||||
// Skip anything outside of [32,128), since the font doesn't have it.
|
||||
if (c < 32 || c >= 128)
|
||||
return;
|
||||
}
|
||||
|
||||
c -= 32;
|
||||
|
||||
const uint8_t* charData = &font_bin[(CHAR_SIZE_X * CHAR_SIZE_Y * c) / 8];
|
||||
// DRC blit: Terminus 8x16 bold
|
||||
const uint8_t* charDRC = font->ter_u16b[(unsigned char)c];
|
||||
uint32_t *p = DRC_FRAMEBUFFER + (y * DRC_STRIDE) + x;
|
||||
unsigned int stride_diff = DRC_STRIDE - CHAR_SIZE_DRC_X;
|
||||
|
||||
for (uint32_t i = 0; i < CHAR_SIZE_Y; i++) {
|
||||
uint8_t v = *(charData++);
|
||||
|
||||
for (uint32_t j = 0; j < CHAR_SIZE_X; j++) {
|
||||
if(v & (1 << j)) {
|
||||
gfx_draw_pixel(x + j, y + i, font_color);
|
||||
for (uint32_t hcnt = CHAR_SIZE_DRC_Y; hcnt > 0; hcnt--) {
|
||||
uint8_t v = *charDRC++;
|
||||
for (uint32_t wcnt = CHAR_SIZE_DRC_X; wcnt > 0; wcnt--, v >>= 1) {
|
||||
if (v & 1) {
|
||||
*p = font_color;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
p += stride_diff;
|
||||
}
|
||||
|
||||
// TV blit: Terminus 12x24 bold
|
||||
const uint16_t* charTV = font->ter_u24b[(unsigned char)c];
|
||||
p = TV_FRAMEBUFFER + ((uint32_t)(y * 1.5f) * TV_STRIDE) + (uint32_t)(x * 1.5f);
|
||||
stride_diff = TV_STRIDE - CHAR_SIZE_TV_X;
|
||||
|
||||
for (uint32_t hcnt = CHAR_SIZE_TV_Y; hcnt > 0; hcnt--) {
|
||||
uint16_t v = *charTV++;
|
||||
for (uint32_t wcnt = CHAR_SIZE_TV_X; wcnt > 0; wcnt--, v >>= 1) {
|
||||
if (v & 1) {
|
||||
*p = font_color;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
p += stride_diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,9 +191,10 @@ void gfx_print(uint32_t x, uint32_t y, int alignRight, const char* string)
|
|||
x -= gfx_get_text_width(string);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; string[i]; i++) {
|
||||
if(string[i] >= 32 && string[i] < 128) {
|
||||
gfx_draw_char(x + i * CHAR_SIZE_X, y, string[i]);
|
||||
for (; *string != '\0'; string++, x += CHAR_SIZE_DRC_X) {
|
||||
char chr = *string;
|
||||
if ((unsigned char)chr >= 32 && (unsigned char)chr <= 128) {
|
||||
gfx_draw_char(x, y, chr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@
|
|||
#define SCREEN_WIDTH 854
|
||||
#define SCREEN_HEIGHT 480
|
||||
|
||||
// All drawing is handled in terms of the DRC screen.
|
||||
// The TV screen is scaled by 1.5 for 1280x720.
|
||||
#define CHAR_SIZE_DRC_X 8
|
||||
#define CHAR_SIZE_DRC_Y 16
|
||||
|
||||
int gfx_init_font(void);
|
||||
|
||||
void gfx_clear(uint32_t color);
|
||||
|
||||
void gfx_draw_pixel(uint32_t x, uint32_t y, uint32_t color);
|
||||
|
|
|
|||
34
ios_mcp/source/mcp_misc.c
Normal file
34
ios_mcp/source/mcp_misc.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "mcp_misc.h"
|
||||
#include "imports.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void* allocIoBuf(uint32_t size)
|
||||
{
|
||||
void* ptr = IOS_HeapAlloc(0xcaff, size);
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void freeIoBuf(void* ptr)
|
||||
{
|
||||
IOS_HeapFree(0xcaff, ptr);
|
||||
}
|
||||
|
||||
int MCP_GetSysProdSettings(int handle, MCPSysProdSettings* out_sysProdSettings)
|
||||
{
|
||||
uint8_t* buf = allocIoBuf(sizeof(IOSVec_t) + sizeof(*out_sysProdSettings));
|
||||
|
||||
IOSVec_t* vecs = (IOSVec_t*)buf;
|
||||
vecs[0].ptr = buf + sizeof(IOSVec_t);
|
||||
vecs[0].len = sizeof(*out_sysProdSettings);
|
||||
|
||||
int res = IOS_Ioctlv(handle, 0x40, 0, 1, vecs);
|
||||
if (res >= 0) {
|
||||
memcpy(out_sysProdSettings, vecs[0].ptr, sizeof(*out_sysProdSettings));
|
||||
}
|
||||
|
||||
freeIoBuf(buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
40
ios_mcp/source/mcp_misc.h
Normal file
40
ios_mcp/source/mcp_misc.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum MCPRegion {
|
||||
MCP_REGION_JAPAN = 0x01,
|
||||
MCP_REGION_USA = 0x02,
|
||||
MCP_REGION_EUROPE = 0x04,
|
||||
MCP_REGION_CHINA = 0x10,
|
||||
MCP_REGION_KOREA = 0x20,
|
||||
MCP_REGION_TAIWAN = 0x40,
|
||||
|
||||
// Force MCPRegion to be 32-bit.
|
||||
MCP_REGION_U32 = 0xFFFFFFFF,
|
||||
} MCPRegion;
|
||||
|
||||
typedef struct __attribute__((packed)) _MCPSysProdSettings {
|
||||
MCPRegion product_area;
|
||||
uint16_t eeprom_version;
|
||||
uint8_t pad1[2];
|
||||
MCPRegion game_region;
|
||||
uint8_t unknown1[4];
|
||||
char ntsc_pal[5];
|
||||
|
||||
//! 5ghz_country_code in xml
|
||||
char wifi_5ghz_country_code[4];
|
||||
|
||||
//! 5ghz_country_code_revision in xml
|
||||
uint8_t wifi_5ghz_country_code_revision;
|
||||
|
||||
char code_id[8];
|
||||
char serial_id[12];
|
||||
uint8_t unknown2[4];
|
||||
char model_number[16];
|
||||
uint32_t version;
|
||||
} MCPSysProdSettings;
|
||||
static_assert(sizeof(MCPSysProdSettings) == 0x46, "MCPSysProdSettings: different size than expected");
|
||||
|
||||
int MCP_GetSysProdSettings(int handle, MCPSysProdSettings* out_sysProdSettings);
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
#include "mcp_install.h"
|
||||
#include "ccr.h"
|
||||
#include "sci.h"
|
||||
#include "mcp_misc.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -44,6 +45,7 @@ static void option_LoadNetConf(void);
|
|||
static void option_displayDRCPin(void);
|
||||
static void option_InstallWUP(void);
|
||||
static void option_EditParental(void);
|
||||
static void option_SystemInformation(void);
|
||||
static void option_Shutdown(void);
|
||||
|
||||
extern int ppcHeartBeatThreadId;
|
||||
|
|
@ -64,15 +66,34 @@ static struct {
|
|||
{ "Display DRC Pin", option_displayDRCPin },
|
||||
{ "Install WUP", option_InstallWUP, },
|
||||
{ "Edit Parental Controls", option_EditParental, },
|
||||
{ "System Information", option_SystemInformation, },
|
||||
{ "Shutdown", option_Shutdown },
|
||||
};
|
||||
static const int numMainMenuOptions = sizeof(mainMenuOptions) / sizeof(mainMenuOptions[0]);
|
||||
|
||||
static void drawTopBar(const char* title)
|
||||
{
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
}
|
||||
|
||||
static void drawBars(const char* title)
|
||||
{
|
||||
drawTopBar(title);
|
||||
|
||||
// draw bottom bar
|
||||
gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
gfx_printf(16, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4, 0, "EJECT: Navigate");
|
||||
gfx_printf(SCREEN_WIDTH - 16, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4, 1, "POWER: Choose");
|
||||
}
|
||||
|
||||
static void waitButtonInput(void)
|
||||
{
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
gfx_printf(16, SCREEN_HEIGHT - 16, 0, "Press EJECT or POWER to proceed");
|
||||
gfx_printf(16, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4, 0, "Press EJECT or POWER to proceed...");
|
||||
|
||||
uint8_t cur_flag = 0;
|
||||
uint8_t flag = 0;
|
||||
|
|
@ -89,15 +110,47 @@ static void waitButtonInput(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int isSystemUsingDebugKeyset(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
// Check OTP to see if this system is using the Debug keyset.
|
||||
// NOTE: Includes "Factory" as well.
|
||||
uint8_t* const dataBuffer = IOS_HeapAllocAligned(0xcaff, 0x400, 0x40);
|
||||
if (!dataBuffer)
|
||||
return ret;
|
||||
|
||||
int res = readOTP(dataBuffer, 0x400);
|
||||
if (res >= 0) {
|
||||
ret = ((dataBuffer[0x080] & 0x18) != 0x10);
|
||||
}
|
||||
|
||||
IOS_HeapFree(0xcaff, dataBuffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void option_SetColdbootTitle(void)
|
||||
{
|
||||
static const char* coldbootTitleOptions[] = {
|
||||
"Back",
|
||||
"Wii U Menu (JPN) - 00050010-10040000",
|
||||
"Wii U Menu (USA) - 00050010-10040100",
|
||||
"Wii U Menu (EUR) - 00050010-10040200",
|
||||
typedef struct _coldbootTitleOptions_t {
|
||||
const char* desc;
|
||||
uint64_t tid;
|
||||
} coldbootTitleOptions_t;
|
||||
|
||||
static const coldbootTitleOptions_t coldbootTitleOptions[] = {
|
||||
{"Back", 0},
|
||||
{"Wii U Menu (JPN)", 0x0005001010040000},
|
||||
{"Wii U Menu (USA)", 0x0005001010040100},
|
||||
{"Wii U Menu (EUR)", 0x0005001010040200},
|
||||
|
||||
// non-retail systems only
|
||||
{"System Config Tool", 0x000500101F700500},
|
||||
{"DEVMENU (pre-2.09)", 0x000500101F7001FF},
|
||||
{"Kiosk Menu ", 0x000500101FA81000},
|
||||
};
|
||||
|
||||
// Only print the non-retail options if the keyset is debug.
|
||||
const int option_count = (isSystemUsingDebugKeyset() ? 7 : 4);
|
||||
|
||||
int rval;
|
||||
uint64_t newtid = 0;
|
||||
|
||||
|
|
@ -112,29 +165,17 @@ static void option_SetColdbootTitle(void)
|
|||
if (flag & SYSTEM_EVENT_FLAG_EJECT_BUTTON) {
|
||||
selected++;
|
||||
|
||||
if (selected == 4) {
|
||||
if (selected == option_count) {
|
||||
selected = 0;
|
||||
}
|
||||
|
||||
redraw = 1;
|
||||
} else if (flag & SYSTEM_EVENT_FLAG_POWER_BUTTON) {
|
||||
switch (selected) {
|
||||
case 0:
|
||||
newtid = coldbootTitleOptions[selected].tid;
|
||||
if (newtid == 0)
|
||||
return;
|
||||
case 1:
|
||||
newtid = 0x0005001010040000llu;
|
||||
rval = setDefaultTitleId(newtid);
|
||||
break;
|
||||
case 2:
|
||||
newtid = 0x0005001010040100llu;
|
||||
rval = setDefaultTitleId(newtid);
|
||||
break;
|
||||
case 3:
|
||||
newtid = 0x0005001010040200llu;
|
||||
rval = setDefaultTitleId(newtid);
|
||||
break;
|
||||
}
|
||||
|
||||
rval = setDefaultTitleId(newtid);
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
|
|
@ -146,30 +187,44 @@ static void option_SetColdbootTitle(void)
|
|||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
|
||||
// draw current titles
|
||||
gfx_printf(16, index, 0, "Current coldboot title: 0x%016llx", currentColdbootTitle);
|
||||
index += 8 + 4;
|
||||
gfx_printf(16, index, 0, "Current coldboot title: %08x-%08x",
|
||||
(uint32_t)(currentColdbootTitle >> 32), (uint32_t)(currentColdbootTitle & 0xFFFFFFFFU));
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
gfx_printf(16, index, 0, "Current coldboot os: 0x%016llx", currentColdbootOS);
|
||||
index += (8 + 4) * 2;
|
||||
gfx_printf(16, index, 0, "Current coldboot os: %08x-%08x",
|
||||
(uint32_t)(currentColdbootOS >> 32), (uint32_t)(currentColdbootOS & 0xFFFFFFFFU));
|
||||
index += (CHAR_SIZE_DRC_Y + 4) * 2;
|
||||
|
||||
// draw options
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < option_count; i++) {
|
||||
char buf[64];
|
||||
if (coldbootTitleOptions[i].tid != 0) {
|
||||
// Append the title ID in hi-lo format.
|
||||
snprintf(buf, sizeof(buf), "%s - %08lx-%08lx", coldbootTitleOptions[i].desc,
|
||||
(uint32_t)(coldbootTitleOptions[i].tid >> 32),
|
||||
(uint32_t)(coldbootTitleOptions[i].tid & 0xFFFFFFFFU));
|
||||
} else {
|
||||
// No title ID. Use the option by itself.
|
||||
snprintf(buf, sizeof(buf), "%s", coldbootTitleOptions[i].desc);
|
||||
}
|
||||
|
||||
gfx_draw_rect_filled(16 - 1, index - 1,
|
||||
gfx_get_text_width(coldbootTitleOptions[i]) + 2, 8 + 2,
|
||||
gfx_get_text_width(buf) + 2, CHAR_SIZE_DRC_Y + 2,
|
||||
selected == i ? COLOR_PRIMARY : COLOR_BACKGROUND);
|
||||
|
||||
gfx_set_font_color(selected == i ? COLOR_BACKGROUND : COLOR_PRIMARY);
|
||||
gfx_printf(16, index, 0, coldbootTitleOptions[i]);
|
||||
gfx_printf(16, index, 0, buf);
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
|
||||
if (newtid) {
|
||||
index += (8 + 4) * 2;
|
||||
gfx_printf(16, index, 0, "Setting coldboot title id to 0x%016llx, rval %d", newtid, rval);
|
||||
index += 8 + 4;
|
||||
index += (CHAR_SIZE_DRC_Y + 4) * 2;
|
||||
gfx_printf(16, index, 0, "Setting coldboot title id to %08x-%08x, rval %d",
|
||||
(uint32_t)(newtid >> 32), (uint32_t)(newtid & 0xFFFFFFFFU), rval);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
if (rval < 0) {
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "Error! Make sure title is installed correctly.");
|
||||
|
|
@ -179,17 +234,7 @@ static void option_SetColdbootTitle(void)
|
|||
}
|
||||
}
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Set Coldboot Title";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
|
||||
// draw bottom bar
|
||||
gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
gfx_printf(16, SCREEN_HEIGHT - 16, 0, "EJECT: Navigate ");
|
||||
gfx_printf(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 16, 1, "POWER: Choose");
|
||||
|
||||
drawBars("Set Coldboot Title");
|
||||
redraw = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -199,15 +244,11 @@ static void option_DumpSyslogs(void)
|
|||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Dumping Syslogs...";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
drawTopBar("Dumping Syslogs...");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
gfx_printf(16, index, 0, "Creating 'logs' directory...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int res = FSA_MakeDir(fsaHandle, "/vol/storage_recovsd/logs", 0x600);
|
||||
if ((res < 0) && !(res == -0x30016)) {
|
||||
|
|
@ -218,7 +259,7 @@ static void option_DumpSyslogs(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Opening system 'logs' directory...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int dir_handle;
|
||||
res = FSA_OpenDir(fsaHandle, "/vol/system/logs", &dir_handle);
|
||||
|
|
@ -245,7 +286,7 @@ static void option_DumpSyslogs(void)
|
|||
|
||||
res = copy_file(fsaHandle, src_path, dst_path);
|
||||
if (res < 0) {
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "Failed to copy %s: %x", dir_entry.name, res);
|
||||
waitButtonInput();
|
||||
|
|
@ -255,7 +296,7 @@ static void option_DumpSyslogs(void)
|
|||
}
|
||||
}
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
gfx_set_font_color(COLOR_SUCCESS);
|
||||
gfx_printf(16, index, 0, "Done!");
|
||||
waitButtonInput();
|
||||
|
|
@ -266,16 +307,11 @@ static void option_DumpSyslogs(void)
|
|||
static void option_DumpOtpAndSeeprom(void)
|
||||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Dumping OTP + SEEPROM...";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
drawTopBar("Dumping OTP + SEEPROM...");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
gfx_printf(16, index, 0, "Creating otp.bin...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
void* dataBuffer = IOS_HeapAllocAligned(0xcaff, 0x400, 0x40);
|
||||
if (!dataBuffer) {
|
||||
|
|
@ -297,7 +333,7 @@ static void option_DumpOtpAndSeeprom(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Reading OTP...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
res = readOTP(dataBuffer, 0x400);
|
||||
if (res < 0) {
|
||||
|
|
@ -311,7 +347,7 @@ static void option_DumpOtpAndSeeprom(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Writing otp.bin...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
res = FSA_WriteFile(fsaHandle, dataBuffer, 1, 0x400, otpHandle, 0);
|
||||
if (res != 0x400) {
|
||||
|
|
@ -327,7 +363,7 @@ static void option_DumpOtpAndSeeprom(void)
|
|||
FSA_CloseFile(fsaHandle, otpHandle);
|
||||
|
||||
gfx_printf(16, index, 0, "Creating seeprom.bin...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int seepromHandle;
|
||||
res = FSA_OpenFile(fsaHandle, "/vol/storage_recovsd/seeprom.bin", "w", &seepromHandle);
|
||||
|
|
@ -341,7 +377,7 @@ static void option_DumpOtpAndSeeprom(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Reading SEEPROM...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
res = EEPROM_Read(0, 0x100, (uint16_t*) dataBuffer);
|
||||
if (res < 0) {
|
||||
|
|
@ -355,7 +391,7 @@ static void option_DumpOtpAndSeeprom(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Writing seeprom.bin...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
res = FSA_WriteFile(fsaHandle, dataBuffer, 1, 0x200, seepromHandle, 0);
|
||||
if (res != 0x200) {
|
||||
|
|
@ -379,16 +415,11 @@ static void option_DumpOtpAndSeeprom(void)
|
|||
static void option_StartWupserver(void)
|
||||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Running wupserver...";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
drawTopBar("Running wupserver...");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
gfx_printf(16, index, 0, "Initializing netconf...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int res = netconf_init();
|
||||
if (res <= 0) {
|
||||
|
|
@ -417,7 +448,7 @@ static void option_StartWupserver(void)
|
|||
gfx_printf(16, index, 0, "Waiting for network connection... %ds", 4 - i);
|
||||
}
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (interface == 0xff) {
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
|
|
@ -427,7 +458,7 @@ static void option_StartWupserver(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Connected using %s", (interface == NET_CFG_INTERFACE_TYPE_WIFI) ? "WIFI" : "ETHERNET");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
uint8_t ip_address[4];
|
||||
res = netconf_get_assigned_address(interface, (uint32_t*) ip_address);
|
||||
|
|
@ -438,8 +469,9 @@ static void option_StartWupserver(void)
|
|||
return;
|
||||
}
|
||||
|
||||
gfx_printf(16, index, 0, "IP address: %d.%d.%d.%d", ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
|
||||
index += 8 + 4;
|
||||
gfx_printf(16, index, 0, "IP address: %u.%u.%u.%u",
|
||||
ip_address[0], ip_address[1], ip_address[2], ip_address[3]);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
res = socketInit();
|
||||
if (res <= 0) {
|
||||
|
|
@ -453,13 +485,13 @@ static void option_StartWupserver(void)
|
|||
|
||||
gfx_set_font_color(COLOR_SUCCESS);
|
||||
gfx_printf(16, index, 0, "Wupserver running. Press EJECT or POWER to stop.");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
waitButtonInput();
|
||||
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
gfx_printf(16, index, 0, "Stopping wupserver...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
wupserver_deinit();
|
||||
}
|
||||
|
|
@ -468,7 +500,7 @@ static void network_parse_config_value(uint32_t* console_idx, NetConfCfg* cfg, c
|
|||
{
|
||||
if (strncmp(key, "type", sizeof("type")) == 0) {
|
||||
gfx_printf(16, *console_idx, 0, "Type: %s", value);
|
||||
(*console_idx) += 8 + 4;
|
||||
(*console_idx) += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (value) {
|
||||
if (strncmp(value, "wifi", sizeof("wifi")) == 0) {
|
||||
|
|
@ -485,7 +517,7 @@ static void network_parse_config_value(uint32_t* console_idx, NetConfCfg* cfg, c
|
|||
}
|
||||
} else if (strncmp(key, "ssid", sizeof("ssid")) == 0) {
|
||||
gfx_printf(16, *console_idx, 0, "SSID: %s (%d)", value, value_len);
|
||||
(*console_idx) += 8 + 4;
|
||||
(*console_idx) += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (value) {
|
||||
memcpy(cfg->wifi.config.ssid, value, value_len);
|
||||
|
|
@ -493,7 +525,7 @@ static void network_parse_config_value(uint32_t* console_idx, NetConfCfg* cfg, c
|
|||
}
|
||||
} else if (strncmp(key, "key", sizeof("key")) == 0) {
|
||||
gfx_printf(16, *console_idx, 0, "Key: ******* (%d)", value_len);
|
||||
(*console_idx) += 8 + 4;
|
||||
(*console_idx) += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (value) {
|
||||
memcpy(cfg->wifi.config.privacy.aes_key, value, value_len);
|
||||
|
|
@ -501,7 +533,7 @@ static void network_parse_config_value(uint32_t* console_idx, NetConfCfg* cfg, c
|
|||
}
|
||||
} else if (strncmp(key, "key_type", sizeof("key_type")) == 0) {
|
||||
gfx_printf(16, *console_idx, 0, "Key type: %s", value);
|
||||
(*console_idx) += 8 + 4;
|
||||
(*console_idx) += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (value) {
|
||||
if (strncmp(value, "NONE", sizeof("NONE")) == 0) {
|
||||
|
|
@ -518,7 +550,7 @@ static void network_parse_config_value(uint32_t* console_idx, NetConfCfg* cfg, c
|
|||
cfg->wifi.config.privacy.mode = NET_CFG_WIFI_PRIVACY_MODE_WPA_PSK_AES;
|
||||
} else {
|
||||
gfx_printf(16, *console_idx, 0, "Unknown key type!");
|
||||
(*console_idx) += 8 + 4;
|
||||
(*console_idx) += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -527,16 +559,11 @@ static void network_parse_config_value(uint32_t* console_idx, NetConfCfg* cfg, c
|
|||
static void option_LoadNetConf(void)
|
||||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Loading network configuration...";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
drawTopBar("Loading network configuration...");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
gfx_printf(16, index, 0, "Initializing netconf...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int res = netconf_init();
|
||||
if (res <= 0) {
|
||||
|
|
@ -547,7 +574,7 @@ static void option_LoadNetConf(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Reading network.cfg...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int cfgHandle;
|
||||
res = FSA_OpenFile(fsaHandle, "/vol/storage_recovsd/network.cfg", "r", &cfgHandle);
|
||||
|
|
@ -624,7 +651,7 @@ static void option_LoadNetConf(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Applying configuration...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
res = netconf_set_running(&cfg);
|
||||
if (res < 0) {
|
||||
|
|
@ -639,7 +666,7 @@ static void option_LoadNetConf(void)
|
|||
|
||||
gfx_set_font_color(COLOR_SUCCESS);
|
||||
gfx_printf(16, index, 0, "Done!");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
waitButtonInput();
|
||||
|
||||
|
|
@ -650,16 +677,11 @@ static void option_LoadNetConf(void)
|
|||
static void option_displayDRCPin(void)
|
||||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Display DRC Pin";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
drawTopBar("Display DRC Pin");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
gfx_printf(16, index, 0, "Reading DRH mac address...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int ccrHandle = IOS_Open("/dev/ccr_cdc", 0);
|
||||
if (ccrHandle < 0) {
|
||||
|
|
@ -680,7 +702,7 @@ static void option_displayDRCPin(void)
|
|||
return;
|
||||
}
|
||||
|
||||
static const char* symbol_names[] = {
|
||||
static const char symbol_names[][8] = {
|
||||
"spade",
|
||||
"heart",
|
||||
"diamond",
|
||||
|
|
@ -700,16 +722,11 @@ static void option_displayDRCPin(void)
|
|||
static void option_InstallWUP(void)
|
||||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Installing WUP";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
drawTopBar("Installing WUP");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
gfx_printf(16, index, 0, "Make sure to place a valid signed WUP directly in 'sd:/install'");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int mcpHandle = IOS_Open("/dev/mcp", 0);
|
||||
if (mcpHandle < 0) {
|
||||
|
|
@ -720,7 +737,7 @@ static void option_InstallWUP(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Querying install info...");
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
MCPInstallInfo info;
|
||||
int res = MCP_InstallGetInfo(mcpHandle, "/vol/storage_recovsd/install", &info);
|
||||
|
|
@ -734,7 +751,7 @@ static void option_InstallWUP(void)
|
|||
}
|
||||
|
||||
gfx_printf(16, index, 0, "Installing title: 0x%016llx...", info.titleId);
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
// only install to NAND
|
||||
res = MCP_InstallSetTargetDevice(mcpHandle, 0);
|
||||
|
|
@ -815,7 +832,7 @@ static void option_EditParental(void)
|
|||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "SCIGetParentalEnable failed: %d", res);
|
||||
}
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
|
||||
|
|
@ -827,7 +844,7 @@ static void option_EditParental(void)
|
|||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "SCIGetParentalPinCode failed: %d", res);
|
||||
}
|
||||
index += (8 + 4) * 2;
|
||||
index += (CHAR_SIZE_DRC_Y + 4) * 2;
|
||||
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
|
||||
|
|
@ -835,31 +852,31 @@ static void option_EditParental(void)
|
|||
|
||||
// Back button
|
||||
gfx_draw_rect_filled(16 - 1, index - 1,
|
||||
gfx_get_text_width("Back") + 2, 8 + 2,
|
||||
gfx_get_text_width("Back") + 2, CHAR_SIZE_DRC_Y + 2,
|
||||
!selected ? COLOR_PRIMARY : COLOR_BACKGROUND);
|
||||
|
||||
gfx_set_font_color(!selected ? COLOR_BACKGROUND : COLOR_PRIMARY);
|
||||
gfx_printf(16, index, 0, "Back");
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
// Disable button
|
||||
gfx_draw_rect_filled(16 - 1, index - 1,
|
||||
gfx_get_text_width("Disable") + 2, 8 + 2,
|
||||
gfx_get_text_width("Disable") + 2, CHAR_SIZE_DRC_Y + 2,
|
||||
selected ? COLOR_PRIMARY : COLOR_BACKGROUND);
|
||||
|
||||
gfx_set_font_color(selected ? COLOR_BACKGROUND : COLOR_PRIMARY);
|
||||
gfx_printf(16, index, 0, "Disable");
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
|
||||
if (toggled) {
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
gfx_printf(16, index, 0, "SCISetParentalEnable(false): %d", rval);
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (rval != 1) {
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
|
|
@ -869,25 +886,211 @@ static void option_EditParental(void)
|
|||
gfx_printf(16, index, 0, "Success!");
|
||||
}
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Edit Parental Controls";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
|
||||
// draw bottom bar
|
||||
gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
gfx_printf(16, SCREEN_HEIGHT - 16, 0, "EJECT: Navigate ");
|
||||
gfx_printf(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 16, 1, "POWER: Choose");
|
||||
|
||||
drawBars("Edit Parental Controls");
|
||||
redraw = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void option_SystemInformation(void)
|
||||
{
|
||||
gfx_clear(COLOR_BACKGROUND);
|
||||
drawTopBar("System Information");
|
||||
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
|
||||
// parse OTP/SEEPROM for system information
|
||||
// 0x000-0x3FF: OTP
|
||||
// 0x400-0x5FF: SEEPROM
|
||||
// 0x600-0x7FF: misc for version.bin
|
||||
void *dataBuffer = IOS_HeapAllocAligned(0xcaff, 0x800, 0x40);
|
||||
if (!dataBuffer) {
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "Out of memory!");
|
||||
waitButtonInput();
|
||||
return;
|
||||
}
|
||||
uint8_t* const otp = (uint8_t*)dataBuffer;
|
||||
uint16_t* const seeprom = (uint16_t*)dataBuffer + 0x200;
|
||||
|
||||
int res = readOTP((void*)otp, 0x400);
|
||||
if (res < 0) {
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "Failed to read OTP: %x", res);
|
||||
IOS_HeapFree(0xcaff, dataBuffer);
|
||||
waitButtonInput();
|
||||
return;
|
||||
}
|
||||
|
||||
res = EEPROM_Read(0, 0x100, seeprom);
|
||||
if (res < 0) {
|
||||
gfx_set_font_color(COLOR_ERROR);
|
||||
gfx_printf(16, index, 0, "Failed to read EEPROM: %x", res);
|
||||
IOS_HeapFree(0xcaff, dataBuffer);
|
||||
waitButtonInput();
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: gfx_printf() does not support precision specifiers.
|
||||
// We'll have to ensure the strings are terminated manually.
|
||||
char buf1[17];
|
||||
char buf2[17];
|
||||
|
||||
memcpy(buf1, &seeprom[0xB8], 16);
|
||||
buf1[16] = '\0';
|
||||
gfx_printf(16, index, 0, "Model: %s", buf1);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
memcpy(buf1, &seeprom[0xAC], 8);
|
||||
buf1[8] = '\0';
|
||||
memcpy(buf2, &seeprom[0xB0], 16);
|
||||
buf2[16] = '\0';
|
||||
gfx_printf(16, index, 0, "Serial: %s%s", buf1, buf2);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
if (seeprom[0xC4] != 0) {
|
||||
gfx_printf(16, index, 0, "Mfg Date: %04x/%02x/%02x %02x:%02x",
|
||||
seeprom[0xC4], seeprom[0xC5] >> 8, seeprom[0xC5] & 0xFF,
|
||||
seeprom[0xC6] >> 8, seeprom[0xC6] & 0xFF);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
|
||||
static const char keyset_tbl[4][8] = {"Factory", "Debug", "Retail", "Invalid"};
|
||||
gfx_printf(16, index, 0, "Keyset: %s", keyset_tbl[(otp[0x080] & 0x18) >> 3]);
|
||||
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
memcpy(buf1, &seeprom[0x21], 2);
|
||||
buf1[2] = '\0';
|
||||
gfx_printf(16, index, 0, "boardType: %s", buf1);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
const unsigned int sataDevice_id = seeprom[0x2C];
|
||||
static const char* const sataDevice_tbl[] = {
|
||||
NULL, "Default", "No device", "ROM drive",
|
||||
"R drive", "MION", "SES", "GEN2-HDD",
|
||||
"GEN1-HDD",
|
||||
};
|
||||
const char *sataDevice = NULL;
|
||||
if (sataDevice_id < 9) {
|
||||
sataDevice = sataDevice_tbl[sataDevice_id];
|
||||
}
|
||||
if (sataDevice) {
|
||||
gfx_printf(16, index, 0, "sataDevice: %u (%s)", sataDevice_id, sataDevice);
|
||||
} else {
|
||||
gfx_printf(16, index, 0, "sataDevice: %u", sataDevice_id);
|
||||
}
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
const unsigned int consoleType_id = seeprom[0x2D];
|
||||
static const char* const consoleType_tbl[] = {
|
||||
NULL, "WUP", "CAT-R", "CAT-DEV",
|
||||
"EV board", "Kiosk", "OrchestraX", "WUIH",
|
||||
"WUIH_DEV", "CAT_DEV_WUIH",
|
||||
};
|
||||
const char* consoleType = NULL;
|
||||
if (consoleType_id < 10) {
|
||||
consoleType = consoleType_tbl[consoleType_id];
|
||||
}
|
||||
if (consoleType) {
|
||||
gfx_printf(16, index, 0, "consoleType: %u (%s)", consoleType_id, consoleType);
|
||||
} else {
|
||||
gfx_printf(16, index, 0, "consoleType: %u", consoleType_id);
|
||||
}
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
|
||||
int productArea_id = 0; // 0-6, matches title ID
|
||||
MCPSysProdSettings sysProdSettings;
|
||||
sysProdSettings.product_area = 0;
|
||||
int mcpHandle = IOS_Open("/dev/mcp", 0);
|
||||
if (mcpHandle >= 0) {
|
||||
res = MCP_GetSysProdSettings(mcpHandle, &sysProdSettings);
|
||||
if (res >= 0) {
|
||||
static const char region_tbl[7][4] = {
|
||||
"JPN", "USA", "EUR", "AUS",
|
||||
"CHN", "KOR", "TWN",
|
||||
};
|
||||
|
||||
// productArea is a single region.
|
||||
if (sysProdSettings.product_area != 0) {
|
||||
productArea_id = __builtin_ctz(sysProdSettings.product_area);
|
||||
if (productArea_id < 7) {
|
||||
gfx_printf(16, index, 0, "productArea: %s", region_tbl[productArea_id]);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
}
|
||||
|
||||
// gameRegion is multiple regions.
|
||||
gfx_printf(16, index, 0, "gameRegion: %s %s %s %s %s %s",
|
||||
(sysProdSettings.game_region & MCP_REGION_JAPAN) ? region_tbl[0] : "---",
|
||||
(sysProdSettings.game_region & MCP_REGION_USA) ? region_tbl[1] : "---",
|
||||
(sysProdSettings.game_region & MCP_REGION_EUROPE) ? region_tbl[2] : "---",
|
||||
(sysProdSettings.game_region & MCP_REGION_CHINA) ? region_tbl[4] : "---",
|
||||
(sysProdSettings.game_region & MCP_REGION_KOREA) ? region_tbl[5] : "---",
|
||||
(sysProdSettings.game_region & MCP_REGION_TAIWAN) ? region_tbl[6] : "---");
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
} else {
|
||||
// Failed to get sys_prod settings.
|
||||
// Clear the product area.
|
||||
sysProdSettings.product_area = 0;
|
||||
}
|
||||
IOS_Close(mcpHandle);
|
||||
}
|
||||
|
||||
// Wii U Menu version
|
||||
// FIXME: CAT-I has all three region versions installed.
|
||||
// Need to get the actual productArea from sys_prod.xml.
|
||||
#define VERSION_BIN_MAGIC_STR "VER\0"
|
||||
#define VERSION_BIN_MAGIC_U32 0x56455200
|
||||
typedef struct _version_bin_t {
|
||||
union {
|
||||
char c[4]; // [0x000] "VER\0"
|
||||
uint32_t u32; // [0x000] 0x56455200
|
||||
} ver_magic;
|
||||
uint32_t major; // [0x004] Major version
|
||||
uint32_t minor; // [0x008] Minor version
|
||||
uint32_t revision; // [0x00C] Revision
|
||||
char region; // [0x010] Region character: 'J', 'U', 'E'
|
||||
|
||||
uint8_t reserved[47]; // [0x011]
|
||||
} version_bin_t;
|
||||
version_bin_t* const version_bin = (version_bin_t*)((uint8_t*)dataBuffer + 0x600);
|
||||
version_bin->ver_magic.u32 = 0;
|
||||
|
||||
char path[] = "/vol/storage_mlc01/sys/title/00050010/10041x00/content/version.bin";
|
||||
path[43] = productArea_id + '0';
|
||||
|
||||
int verHandle;
|
||||
res = FSA_OpenFile(fsaHandle, path, "r", &verHandle);
|
||||
if (res >= 0) {
|
||||
// version.bin should always be 64 bytes.
|
||||
res = FSA_ReadFile(fsaHandle, version_bin, 1, sizeof(*version_bin), verHandle, 0);
|
||||
FSA_CloseFile(fsaHandle, verHandle);
|
||||
if (res == sizeof(*version_bin)) {
|
||||
// Did we find a valid version.bin?
|
||||
if (version_bin->ver_magic.u32 == VERSION_BIN_MAGIC_U32) {
|
||||
// Found a valid version.bin.
|
||||
gfx_printf(16, index, 0, "Wii U Menu version: %u.%u.%u %c",
|
||||
version_bin->major, version_bin->minor, version_bin->revision, version_bin->region);
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: productArea, gameRegion, IOSU version, Wii U Menu version
|
||||
// - productArea is set to 2 on my CAT-I that's actually set to USA.
|
||||
// - gameRegion is set to 0 on all systems I've used.
|
||||
// TODO: Use MCP_GetSysProdSettings()?
|
||||
|
||||
IOS_HeapFree(0xcaff, dataBuffer);
|
||||
waitButtonInput();
|
||||
}
|
||||
|
||||
static void option_Shutdown(void)
|
||||
{
|
||||
if (fsaHandle > 0) {
|
||||
|
|
@ -928,6 +1131,13 @@ int menuThread(void* arg)
|
|||
//readDCConfig(&dc_config);
|
||||
#endif
|
||||
|
||||
// initialize the font
|
||||
if (gfx_init_font() != 0) {
|
||||
// failed to initialize font
|
||||
// can't do anything without a font, so shut down
|
||||
IOS_Shutdown(0);
|
||||
}
|
||||
|
||||
// open fsa and mount sdcard
|
||||
fsaHandle = IOS_Open("/dev/fsa", 0);
|
||||
if (fsaHandle > 0) {
|
||||
|
|
@ -969,31 +1179,20 @@ int menuThread(void* arg)
|
|||
gfx_clear(COLOR_BACKGROUND);
|
||||
|
||||
// draw options
|
||||
uint32_t index = 16 + 8 + 2 + 8;
|
||||
uint32_t index = 16+8+2+8;
|
||||
for (int i = 0; i < numMainMenuOptions; i++) {
|
||||
gfx_draw_rect_filled(16 - 1, index - 1,
|
||||
gfx_get_text_width(mainMenuOptions[i].name) + 2, 8 + 2,
|
||||
gfx_get_text_width(mainMenuOptions[i].name) + 2, CHAR_SIZE_DRC_Y + 2,
|
||||
selected == i ? COLOR_PRIMARY : COLOR_BACKGROUND);
|
||||
|
||||
gfx_set_font_color(selected == i ? COLOR_BACKGROUND : COLOR_PRIMARY);
|
||||
gfx_printf(16, index, 0, mainMenuOptions[i].name);
|
||||
|
||||
index += 8 + 4;
|
||||
index += CHAR_SIZE_DRC_Y + 4;
|
||||
}
|
||||
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
|
||||
// draw top bar
|
||||
gfx_set_font_color(COLOR_PRIMARY);
|
||||
const char* title = "Wii U Recovery Menu v0.2 by GaryOderNichts";
|
||||
gfx_printf((SCREEN_WIDTH / 2) + (gfx_get_text_width(title) / 2), 8, 1, title);
|
||||
gfx_draw_rect_filled(8, 16 + 8, SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
|
||||
// draw bottom bar
|
||||
gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);
|
||||
gfx_printf(16, SCREEN_HEIGHT - 16, 0, "EJECT: Navigate ");
|
||||
gfx_printf(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 16, 1, "POWER: Choose");
|
||||
|
||||
drawBars("Wii U Recovery Menu v0.2 by GaryOderNichts");
|
||||
redraw = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
339
ios_mcp/source/minilzo/COPYING
Normal file
339
ios_mcp/source/minilzo/COPYING
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
123
ios_mcp/source/minilzo/README.LZO
Normal file
123
ios_mcp/source/minilzo/README.LZO
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
|
||||
============================================================================
|
||||
miniLZO -- mini subset of the LZO real-time data compression library
|
||||
============================================================================
|
||||
|
||||
Author : Markus Franz Xaver Johannes Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
Version : 2.10
|
||||
Date : 01 Mar 2017
|
||||
|
||||
I've created miniLZO for projects where it is inconvenient to
|
||||
include (or require) the full LZO source code just because you
|
||||
want to add a little bit of data compression to your application.
|
||||
|
||||
miniLZO implements the LZO1X-1 compressor and both the standard and
|
||||
safe LZO1X decompressor. Apart from fast compression it also useful
|
||||
for situations where you want to use pre-compressed data files (which
|
||||
must have been compressed with LZO1X-999).
|
||||
|
||||
miniLZO consists of one C source file and three header files:
|
||||
minilzo.c
|
||||
minilzo.h, lzoconf.h, lzodefs.h
|
||||
|
||||
To use miniLZO just copy these files into your source directory, add
|
||||
minilzo.c to your Makefile and #include minilzo.h from your program.
|
||||
Note: you also must distribute this file ('README.LZO') with your project.
|
||||
|
||||
minilzo.o compiles to about 6 KiB (using gcc or Visual C on an i386), and
|
||||
the sources are about 30 KiB when packed with zip - so there's no more
|
||||
excuse that your application doesn't support data compression :-)
|
||||
|
||||
For more information, documentation, example programs and other support
|
||||
files (like Makefiles and build scripts) please download the full LZO
|
||||
package from
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
|
||||
Have fun,
|
||||
Markus
|
||||
|
||||
|
||||
P.S. minilzo.c is generated automatically from the LZO sources and
|
||||
therefore functionality is completely identical
|
||||
|
||||
|
||||
Appendix A: building miniLZO
|
||||
----------------------------
|
||||
miniLZO is written such a way that it should compile and run
|
||||
out-of-the-box on most machines.
|
||||
|
||||
If you are running on a very unusual architecture and lzo_init() fails then
|
||||
you should first recompile with '-DLZO_DEBUG' to see what causes the failure.
|
||||
The most probable case is something like 'sizeof(void *) != sizeof(size_t)'.
|
||||
After identifying the problem you can compile by adding some defines
|
||||
like '-DSIZEOF_VOID_P=8' to your Makefile.
|
||||
|
||||
The best solution is (of course) using Autoconf - if your project uses
|
||||
Autoconf anyway just add '-DMINILZO_HAVE_CONFIG_H' to your compiler
|
||||
flags when compiling minilzo.c. See the LZO distribution for an example
|
||||
how to set up configure.ac.
|
||||
|
||||
|
||||
Appendix B: list of public functions available in miniLZO
|
||||
---------------------------------------------------------
|
||||
Library initialization
|
||||
lzo_init()
|
||||
|
||||
Compression
|
||||
lzo1x_1_compress()
|
||||
|
||||
Decompression
|
||||
lzo1x_decompress()
|
||||
lzo1x_decompress_safe()
|
||||
|
||||
Checksum functions
|
||||
lzo_adler32()
|
||||
|
||||
Version functions
|
||||
lzo_version()
|
||||
lzo_version_string()
|
||||
lzo_version_date()
|
||||
|
||||
Portable (but slow) string functions
|
||||
lzo_memcmp()
|
||||
lzo_memcpy()
|
||||
lzo_memmove()
|
||||
lzo_memset()
|
||||
|
||||
|
||||
Appendix C: suggested macros for 'configure.ac' when using Autoconf
|
||||
-------------------------------------------------------------------
|
||||
Checks for typedefs and structures
|
||||
AC_CHECK_TYPE(ptrdiff_t,long)
|
||||
AC_TYPE_SIZE_T
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(__int64)
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(size_t)
|
||||
AC_CHECK_SIZEOF(ptrdiff_t)
|
||||
|
||||
Checks for compiler characteristics
|
||||
AC_C_CONST
|
||||
|
||||
Checks for library functions
|
||||
AC_CHECK_FUNCS(memcmp memcpy memmove memset)
|
||||
|
||||
|
||||
Appendix D: Copyright
|
||||
---------------------
|
||||
LZO and miniLZO are Copyright (C) 1996-2017 Markus Franz Xaver Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
LZO and miniLZO are distributed under the terms of the GNU General
|
||||
Public License (GPL). See the file COPYING.
|
||||
|
||||
Special licenses for commercial and other applications which
|
||||
are not willing to accept the GNU General Public License
|
||||
are available by contacting the author.
|
||||
|
||||
|
||||
453
ios_mcp/source/minilzo/lzoconf.h
Normal file
453
ios_mcp/source/minilzo/lzoconf.h
Normal file
|
|
@ -0,0 +1,453 @@
|
|||
/* lzoconf.h -- configuration of the LZO data compression library
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LZOCONF_H_INCLUDED
|
||||
#define __LZOCONF_H_INCLUDED 1
|
||||
|
||||
#define LZO_VERSION 0x20a0 /* 2.10 */
|
||||
#define LZO_VERSION_STRING "2.10"
|
||||
#define LZO_VERSION_DATE "Mar 01 2017"
|
||||
|
||||
/* internal Autoconf configuration file - only used when building LZO */
|
||||
#if defined(LZO_HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// LZO requires a conforming <limits.h>
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
||||
# error "invalid CHAR_BIT"
|
||||
#endif
|
||||
#if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
||||
# error "check your compiler installation"
|
||||
#endif
|
||||
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
||||
# error "your limits.h macros are broken"
|
||||
#endif
|
||||
|
||||
/* get OS and architecture defines */
|
||||
#ifndef __LZODEFS_H_INCLUDED
|
||||
#include <lzo/lzodefs.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// some core defines
|
||||
************************************************************************/
|
||||
|
||||
/* memory checkers */
|
||||
#if !defined(__LZO_CHECKER)
|
||||
# if defined(__BOUNDS_CHECKING_ON)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__CHECKER__)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__INSURE__)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__PURIFY__)
|
||||
# define __LZO_CHECKER 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// integral and pointer types
|
||||
************************************************************************/
|
||||
|
||||
/* lzo_uint must match size_t */
|
||||
#if !defined(LZO_UINT_MAX)
|
||||
# if (LZO_ABI_LLP64)
|
||||
# if (LZO_OS_WIN64)
|
||||
typedef unsigned __int64 lzo_uint;
|
||||
typedef __int64 lzo_int;
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64
|
||||
# else
|
||||
typedef lzo_ullong_t lzo_uint;
|
||||
typedef lzo_llong_t lzo_int;
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG
|
||||
# endif
|
||||
# define LZO_SIZEOF_LZO_INT 8
|
||||
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||
# define LZO_INT_MAX 9223372036854775807LL
|
||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef int lzo_int;
|
||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
|
||||
# define LZO_UINT_MAX UINT_MAX
|
||||
# define LZO_INT_MAX INT_MAX
|
||||
# define LZO_INT_MIN INT_MIN
|
||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned long lzo_uint;
|
||||
typedef long lzo_int;
|
||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG
|
||||
# define LZO_UINT_MAX ULONG_MAX
|
||||
# define LZO_INT_MAX LONG_MAX
|
||||
# define LZO_INT_MIN LONG_MIN
|
||||
# else
|
||||
# error "lzo_uint"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The larger type of lzo_uint and lzo_uint32_t. */
|
||||
#if (LZO_SIZEOF_LZO_INT >= 4)
|
||||
# define lzo_xint lzo_uint
|
||||
#else
|
||||
# define lzo_xint lzo_uint32_t
|
||||
#endif
|
||||
|
||||
typedef int lzo_bool;
|
||||
|
||||
/* sanity checks */
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t))
|
||||
|
||||
#ifndef __LZO_MMODEL
|
||||
#define __LZO_MMODEL /*empty*/
|
||||
#endif
|
||||
|
||||
/* no typedef here because of const-pointer issues */
|
||||
#define lzo_bytep unsigned char __LZO_MMODEL *
|
||||
#define lzo_charp char __LZO_MMODEL *
|
||||
#define lzo_voidp void __LZO_MMODEL *
|
||||
#define lzo_shortp short __LZO_MMODEL *
|
||||
#define lzo_ushortp unsigned short __LZO_MMODEL *
|
||||
#define lzo_intp lzo_int __LZO_MMODEL *
|
||||
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
||||
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
||||
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
||||
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
||||
|
||||
#define lzo_int8_tp lzo_int8_t __LZO_MMODEL *
|
||||
#define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL *
|
||||
#define lzo_int16_tp lzo_int16_t __LZO_MMODEL *
|
||||
#define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL *
|
||||
#define lzo_int32_tp lzo_int32_t __LZO_MMODEL *
|
||||
#define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL *
|
||||
#if defined(lzo_int64_t)
|
||||
#define lzo_int64_tp lzo_int64_t __LZO_MMODEL *
|
||||
#define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL *
|
||||
#endif
|
||||
|
||||
/* Older LZO versions used to support ancient systems and memory models
|
||||
* such as 16-bit MSDOS with __huge pointers or Cray PVP, but these
|
||||
* obsolete configurations are not supported any longer.
|
||||
*/
|
||||
#if defined(__LZO_MMODEL_HUGE)
|
||||
#error "__LZO_MMODEL_HUGE memory model is unsupported"
|
||||
#endif
|
||||
#if (LZO_MM_PVP)
|
||||
#error "LZO_MM_PVP memory model is unsupported"
|
||||
#endif
|
||||
#if (LZO_SIZEOF_INT < 4)
|
||||
#error "LZO_SIZEOF_INT < 4 is unsupported"
|
||||
#endif
|
||||
#if (__LZO_UINTPTR_T_IS_POINTER)
|
||||
#error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
|
||||
#endif
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4)
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4)
|
||||
/* Strange configurations where sizeof(lzo_uint) != sizeof(size_t) should
|
||||
* work but have not received much testing lately, so be strict here.
|
||||
*/
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp))
|
||||
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// function types
|
||||
************************************************************************/
|
||||
|
||||
/* name mangling */
|
||||
#if !defined(__LZO_EXTERN_C)
|
||||
# ifdef __cplusplus
|
||||
# define __LZO_EXTERN_C extern "C"
|
||||
# else
|
||||
# define __LZO_EXTERN_C extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling convention */
|
||||
#if !defined(__LZO_CDECL)
|
||||
# define __LZO_CDECL __lzo_cdecl
|
||||
#endif
|
||||
|
||||
/* DLL export information */
|
||||
#if !defined(__LZO_EXPORT1)
|
||||
# define __LZO_EXPORT1 /*empty*/
|
||||
#endif
|
||||
#if !defined(__LZO_EXPORT2)
|
||||
# define __LZO_EXPORT2 /*empty*/
|
||||
#endif
|
||||
|
||||
/* __cdecl calling convention for public C and assembly functions */
|
||||
#if !defined(LZO_PUBLIC)
|
||||
# define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL
|
||||
#endif
|
||||
#if !defined(LZO_EXTERN)
|
||||
# define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r)
|
||||
#endif
|
||||
#if !defined(LZO_PRIVATE)
|
||||
# define LZO_PRIVATE(r) static r __LZO_CDECL
|
||||
#endif
|
||||
|
||||
/* function types */
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
|
||||
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||
* is used, but this may change in a future release. */
|
||||
|
||||
struct lzo_callback_t;
|
||||
typedef struct lzo_callback_t lzo_callback_t;
|
||||
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||
|
||||
/* malloc & free function types */
|
||||
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||
(lzo_callback_p self, lzo_voidp ptr);
|
||||
|
||||
/* a progress indicator callback function */
|
||||
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||
|
||||
struct lzo_callback_t
|
||||
{
|
||||
/* custom allocators (set to 0 to disable) */
|
||||
lzo_alloc_func_t nalloc; /* [not used right now] */
|
||||
lzo_free_func_t nfree; /* [not used right now] */
|
||||
|
||||
/* a progress indicator callback function (set to 0 to disable) */
|
||||
lzo_progress_func_t nprogress;
|
||||
|
||||
/* INFO: the first parameter "self" of the nalloc/nfree/nprogress
|
||||
* callbacks points back to this struct, so you are free to store
|
||||
* some extra info in the following variables. */
|
||||
lzo_voidp user1;
|
||||
lzo_xint user2;
|
||||
lzo_xint user3;
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// error codes and prototypes
|
||||
************************************************************************/
|
||||
|
||||
/* Error codes for the compression/decompression functions. Negative
|
||||
* values are errors, positive values will be used for special but
|
||||
* normal events.
|
||||
*/
|
||||
#define LZO_E_OK 0
|
||||
#define LZO_E_ERROR (-1)
|
||||
#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */
|
||||
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||
#define LZO_E_INPUT_OVERRUN (-4)
|
||||
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||
#define LZO_E_INVALID_ARGUMENT (-10)
|
||||
#define LZO_E_INVALID_ALIGNMENT (-11) /* pointer argument is not properly aligned */
|
||||
#define LZO_E_OUTPUT_NOT_CONSUMED (-12)
|
||||
#define LZO_E_INTERNAL_ERROR (-99)
|
||||
|
||||
|
||||
#ifndef lzo_sizeof_dict_t
|
||||
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
||||
#endif
|
||||
|
||||
/* lzo_init() should be the first function you call.
|
||||
* Check the return code !
|
||||
*
|
||||
* lzo_init() is a macro to allow checking that the library and the
|
||||
* compiler's view of various types are consistent.
|
||||
*/
|
||||
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
||||
(int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\
|
||||
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||
(int)sizeof(lzo_callback_t))
|
||||
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||
|
||||
/* version functions (useful for shared libraries) */
|
||||
LZO_EXTERN(unsigned) lzo_version(void);
|
||||
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||
|
||||
/* string functions */
|
||||
LZO_EXTERN(int)
|
||||
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
|
||||
|
||||
/* checksum functions */
|
||||
LZO_EXTERN(lzo_uint32_t)
|
||||
lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(lzo_uint32_t)
|
||||
lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(const lzo_uint32_tp)
|
||||
lzo_get_crc32_table(void);
|
||||
|
||||
/* misc. */
|
||||
LZO_EXTERN(int) _lzo_config_check(void);
|
||||
typedef union {
|
||||
lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04;
|
||||
void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09;
|
||||
#if defined(lzo_int64_t)
|
||||
lzo_uint64_t a10;
|
||||
#endif
|
||||
} lzo_align_t;
|
||||
|
||||
/* align a char pointer on a boundary that is a multiple of 'size' */
|
||||
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
|
||||
#define LZO_PTR_ALIGN_UP(p,size) \
|
||||
((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// deprecated macros - only for backward compatibility
|
||||
************************************************************************/
|
||||
|
||||
/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */
|
||||
#define lzo_byte unsigned char
|
||||
/* deprecated type names */
|
||||
#define lzo_int32 lzo_int32_t
|
||||
#define lzo_uint32 lzo_uint32_t
|
||||
#define lzo_int32p lzo_int32_t __LZO_MMODEL *
|
||||
#define lzo_uint32p lzo_uint32_t __LZO_MMODEL *
|
||||
#define LZO_INT32_MAX LZO_INT32_C(2147483647)
|
||||
#define LZO_UINT32_MAX LZO_UINT32_C(4294967295)
|
||||
#if defined(lzo_int64_t)
|
||||
#define lzo_int64 lzo_int64_t
|
||||
#define lzo_uint64 lzo_uint64_t
|
||||
#define lzo_int64p lzo_int64_t __LZO_MMODEL *
|
||||
#define lzo_uint64p lzo_uint64_t __LZO_MMODEL *
|
||||
#define LZO_INT64_MAX LZO_INT64_C(9223372036854775807)
|
||||
#define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615)
|
||||
#endif
|
||||
/* deprecated types */
|
||||
typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u;
|
||||
typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u;
|
||||
/* deprecated defines */
|
||||
#if !defined(LZO_SIZEOF_LZO_UINT)
|
||||
# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT
|
||||
#endif
|
||||
|
||||
#if defined(LZO_CFG_COMPAT)
|
||||
|
||||
#define __LZOCONF_H 1
|
||||
|
||||
#if defined(LZO_ARCH_I086)
|
||||
# define __LZO_i386 1
|
||||
#elif defined(LZO_ARCH_I386)
|
||||
# define __LZO_i386 1
|
||||
#endif
|
||||
|
||||
#if defined(LZO_OS_DOS16)
|
||||
# define __LZO_DOS 1
|
||||
# define __LZO_DOS16 1
|
||||
#elif defined(LZO_OS_DOS32)
|
||||
# define __LZO_DOS 1
|
||||
#elif defined(LZO_OS_WIN16)
|
||||
# define __LZO_WIN 1
|
||||
# define __LZO_WIN16 1
|
||||
#elif defined(LZO_OS_WIN32)
|
||||
# define __LZO_WIN 1
|
||||
#endif
|
||||
|
||||
#define __LZO_CMODEL /*empty*/
|
||||
#define __LZO_DMODEL /*empty*/
|
||||
#define __LZO_ENTRY __LZO_CDECL
|
||||
#define LZO_EXTERN_CDECL LZO_EXTERN
|
||||
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
||||
|
||||
#define lzo_compress_asm_t lzo_compress_t
|
||||
#define lzo_decompress_asm_t lzo_decompress_t
|
||||
|
||||
#endif /* LZO_CFG_COMPAT */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
3268
ios_mcp/source/minilzo/lzodefs.h
Normal file
3268
ios_mcp/source/minilzo/lzodefs.h
Normal file
File diff suppressed because it is too large
Load diff
6365
ios_mcp/source/minilzo/minilzo.c
Normal file
6365
ios_mcp/source/minilzo/minilzo.c
Normal file
File diff suppressed because it is too large
Load diff
106
ios_mcp/source/minilzo/minilzo.h
Normal file
106
ios_mcp/source/minilzo/minilzo.h
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/* minilzo.h -- mini subset of the LZO real-time data compression library
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* the full LZO package can be found at
|
||||
* http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MINILZO_H_INCLUDED
|
||||
#define __MINILZO_H_INCLUDED 1
|
||||
|
||||
#define MINILZO_VERSION 0x20a0 /* 2.10 */
|
||||
|
||||
#if defined(__LZOCONF_H_INCLUDED)
|
||||
# error "you cannot use both LZO and miniLZO"
|
||||
#endif
|
||||
|
||||
/* internal Autoconf configuration file - only used when building miniLZO */
|
||||
#ifdef MINILZO_HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef __LZODEFS_H_INCLUDED
|
||||
#include "lzodefs.h"
|
||||
#endif
|
||||
#undef LZO_HAVE_CONFIG_H
|
||||
#include "lzoconf.h"
|
||||
|
||||
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
|
||||
# error "version mismatch in header files"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
/* Memory required for the wrkmem parameter.
|
||||
* When the required size is 0, you can also pass a NULL pointer.
|
||||
*/
|
||||
|
||||
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
|
||||
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t))
|
||||
#define LZO1X_MEM_DECOMPRESS (0)
|
||||
|
||||
|
||||
/* compression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/* vim:set ts=4 sw=4 et: */
|
||||
Loading…
Add table
Add a link
Reference in a new issue