mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 03:09:15 +01:00
*code beautification*
formatted the code to make it easier to read. no functional changes at all. i didn't put anything from the libwiigui folder or banner folder in the beautifier. my automated .bat seems to have done a good job. the only places i see it fucked up was on (GXColor){blablabla}. it treated the brackets in the color like all the other brackets and put the color on a new line and indented it. i think i fixed most of them. not sure if it messed up anywhere else. also not sure about how it handled different linebreaks. it looks fine on windows. if it looks messed up on linux, it can be reverted. the code still compiles and runs fine.
This commit is contained in:
parent
024bdee994
commit
30535c6f5d
File diff suppressed because one or more lines are too long
2
gui.pnps
2
gui.pnps
@ -1 +1 @@
|
||||
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="true"></e><e p="gui\source\network" x="false"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="true"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="true"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e></ViewState></pd>
|
||||
<pd><ViewState><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="true"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="false"></e><e p="gui\source\unzip" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\ramdisc" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="true"></e><e p="gui" x="true"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwbfs" x="false"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e></ViewState></pd>
|
File diff suppressed because it is too large
Load Diff
@ -203,7 +203,10 @@ typedef struct ftgxDataOffset_ ftgxDataOffset;
|
||||
#define FTGX_COMPATIBILITY_GRRLIB FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE
|
||||
#define FTGX_COMPATIBILITY_LIBWIISPRITE FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_MODULATE | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_DIRECT
|
||||
|
||||
const GXColor ftgxWhite = (GXColor){0xff, 0xff, 0xff, 0xff}; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||
const GXColor ftgxWhite = (GXColor) {
|
||||
0xff, 0xff, 0xff, 0xff
|
||||
}
|
||||
; /**< Constant color value used only to sanitize Doxygen documentation. */
|
||||
|
||||
/*! \class FreeTypeGX
|
||||
* \brief Wrapper class for the libFreeType library with GX rendering.
|
||||
@ -216,59 +219,59 @@ const GXColor ftgxWhite = (GXColor){0xff, 0xff, 0xff, 0xff}; /**< Constant color
|
||||
*/
|
||||
class FreeTypeGX {
|
||||
|
||||
private:
|
||||
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
|
||||
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
|
||||
FT_Byte *ftFace_fromFile;
|
||||
FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
|
||||
FT_UInt ftPointSize; /**< Requested size of the rendered font. */
|
||||
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
|
||||
private:
|
||||
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
|
||||
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
|
||||
FT_Byte *ftFace_fromFile;
|
||||
FT_GlyphSlot ftSlot; /**< FreeType reusable FT_GlyphSlot glyph container object. */
|
||||
FT_UInt ftPointSize; /**< Requested size of the rendered font. */
|
||||
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
|
||||
|
||||
uint8_t textureFormat; /**< Defined texture format of the target EFB. */
|
||||
uint8_t vertexIndex; /**< Vertex format descriptor index. */
|
||||
uint32_t compatibilityMode; /**< Compatibility mode for default tev operations and vertex descriptors. */
|
||||
std::map<wchar_t, ftgxCharData> fontData; /**< Map which holds the glyph data structures for the corresponding characters. */
|
||||
uint8_t textureFormat; /**< Defined texture format of the target EFB. */
|
||||
uint8_t vertexIndex; /**< Vertex format descriptor index. */
|
||||
uint32_t compatibilityMode; /**< Compatibility mode for default tev operations and vertex descriptors. */
|
||||
std::map<wchar_t, ftgxCharData> fontData; /**< Map which holds the glyph data structures for the corresponding characters. */
|
||||
|
||||
static uint16_t adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat);
|
||||
static uint16_t adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat);
|
||||
static uint16_t adjustTextureWidth(uint16_t textureWidth, uint8_t textureFormat);
|
||||
static uint16_t adjustTextureHeight(uint16_t textureHeight, uint8_t textureFormat);
|
||||
|
||||
static int16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
|
||||
static int16_t getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format);
|
||||
static int16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
|
||||
static int16_t getStyleOffsetHeight(ftgxDataOffset *offset, uint16_t format);
|
||||
|
||||
void unloadFont();
|
||||
void clearGlyphData();
|
||||
ftgxCharData *cacheGlyphData(wchar_t charCode);
|
||||
uint16_t cacheGlyphDataComplete();
|
||||
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
|
||||
void unloadFont();
|
||||
void clearGlyphData();
|
||||
ftgxCharData *cacheGlyphData(wchar_t charCode);
|
||||
uint16_t cacheGlyphDataComplete();
|
||||
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
|
||||
|
||||
void setDefaultMode();
|
||||
void setDefaultMode();
|
||||
|
||||
void drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataOffset *offsetData, uint16_t format, GXColor color);
|
||||
void copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
void copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
void drawTextFeature(int16_t x, int16_t y, uint16_t width, ftgxDataOffset *offsetData, uint16_t format, GXColor color);
|
||||
void copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
void copyFeatureToFramebuffer(f32 featureWidth, f32 featureHeight, int16_t screenX, int16_t screenY, GXColor color);
|
||||
|
||||
public:
|
||||
FreeTypeGX(uint8_t textureFormat = GX_TF_RGBA8, uint8_t vertexIndex = GX_VTXFMT1);
|
||||
~FreeTypeGX();
|
||||
public:
|
||||
FreeTypeGX(uint8_t textureFormat = GX_TF_RGBA8, uint8_t vertexIndex = GX_VTXFMT1);
|
||||
~FreeTypeGX();
|
||||
|
||||
static wchar_t* charToWideChar(char* p);
|
||||
static wchar_t* charToWideChar(const char* p);
|
||||
void setVertexFormat(uint8_t vertexIndex);
|
||||
void setCompatibilityMode(uint32_t compatibilityMode);
|
||||
static wchar_t* charToWideChar(char* p);
|
||||
static wchar_t* charToWideChar(const char* p);
|
||||
void setVertexFormat(uint8_t vertexIndex);
|
||||
void setCompatibilityMode(uint32_t compatibilityMode);
|
||||
|
||||
uint16_t loadFont(char* fontPath, uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false);
|
||||
uint16_t loadFont(const char* fontPath, const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false);
|
||||
void changeSize(FT_UInt vPointSize, FT_UInt hPointSize=0);
|
||||
uint16_t loadFont(char* fontPath, uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false);
|
||||
uint16_t loadFont(const char* fontPath, const uint8_t* fontBuffer, FT_Long bufferSize, FT_UInt pointSize, bool cacheAll = false);
|
||||
void changeSize(FT_UInt vPointSize, FT_UInt hPointSize=0);
|
||||
|
||||
uint16_t drawText(int16_t x, int16_t y, wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
uint16_t drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
uint16_t drawText(int16_t x, int16_t y, wchar_t *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
uint16_t drawText(int16_t x, int16_t y, wchar_t const *text, GXColor color = ftgxWhite, uint16_t textStyling = FTGX_NULL);
|
||||
|
||||
uint16_t getWidth(wchar_t *text);
|
||||
uint16_t getWidth(wchar_t const *text);
|
||||
uint16_t getHeight(wchar_t *text);
|
||||
uint16_t getHeight(wchar_t const *text);
|
||||
ftgxDataOffset* getOffset(wchar_t *text, ftgxDataOffset* offset);
|
||||
ftgxDataOffset* getOffset(wchar_t const *text, ftgxDataOffset* offset);
|
||||
uint16_t getWidth(wchar_t *text);
|
||||
uint16_t getWidth(wchar_t const *text);
|
||||
uint16_t getHeight(wchar_t *text);
|
||||
uint16_t getHeight(wchar_t const *text);
|
||||
ftgxDataOffset* getOffset(wchar_t *text, ftgxDataOffset* offset);
|
||||
ftgxDataOffset* getOffset(wchar_t const *text, ftgxDataOffset* offset);
|
||||
};
|
||||
|
||||
#endif /* FREETYPEGX_H_ */
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
/*
|
||||
* Metaphrasis is a static conversion class for transforming RGBA image
|
||||
* buffers into verious GX texture formats for Wii homebrew development.
|
||||
* Copyright (C) 2008 Armin Tamzarian
|
||||
*
|
||||
*
|
||||
* This file is part of Metaphrasis.
|
||||
*
|
||||
*
|
||||
* Metaphrasis is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Metaphrasis 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 Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Metaphrasis. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -37,9 +37,9 @@ Metaphrasis::~Metaphrasis() {
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the I4 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the I4 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -47,33 +47,33 @@ Metaphrasis::~Metaphrasis() {
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToI4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = bufferWidth * bufferHeight >> 1;
|
||||
uint32_t* dataBufferI4 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferI4, 0x00, bufferSize);
|
||||
uint32_t bufferSize = bufferWidth * bufferHeight >> 1;
|
||||
uint32_t* dataBufferI4 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferI4, 0x00, bufferSize);
|
||||
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferI4;
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferI4;
|
||||
|
||||
for(uint16_t y = 0; y < bufferHeight; y += 8) {
|
||||
for(uint16_t x = 0; x < bufferWidth; x += 8) {
|
||||
for(uint16_t rows = 0; rows < 8; rows++) {
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 0)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 1)] & 0xf0) >> 4);
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 2)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 3)] & 0xf0) >> 4);
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 4)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 5)] & 0xf0) >> 4);
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 5)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 7)] & 0xf0) >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferI4, bufferSize);
|
||||
for (uint16_t y = 0; y < bufferHeight; y += 8) {
|
||||
for (uint16_t x = 0; x < bufferWidth; x += 8) {
|
||||
for (uint16_t rows = 0; rows < 8; rows++) {
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 0)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 1)] & 0xf0) >> 4);
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 2)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 3)] & 0xf0) >> 4);
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 4)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 5)] & 0xf0) >> 4);
|
||||
*dst++ = (src[((y + rows) * bufferWidth) + (x + 5)] & 0xf0) | ((src[((y + rows) * bufferWidth) + (x + 7)] & 0xf0) >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferI4, bufferSize);
|
||||
|
||||
return dataBufferI4;
|
||||
return dataBufferI4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the I8 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the I8 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -81,55 +81,55 @@ uint32_t* Metaphrasis::convertBufferToI4(uint32_t* rgbaBuffer, uint16_t bufferWi
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToI8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = bufferWidth * bufferHeight;
|
||||
uint32_t* dataBufferI8 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferI8, 0x00, bufferSize);
|
||||
uint32_t bufferSize = bufferWidth * bufferHeight;
|
||||
uint32_t* dataBufferI8 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferI8, 0x00, bufferSize);
|
||||
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferI8;
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferI8;
|
||||
|
||||
for(uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for(uint16_t x = 0; x < bufferWidth; x += 8) {
|
||||
for(uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 0)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 1)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 2)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 3)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 4)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 5)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 6)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 7)] & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferI8, bufferSize);
|
||||
for (uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for (uint16_t x = 0; x < bufferWidth; x += 8) {
|
||||
for (uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 0)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 1)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 2)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 3)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 4)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 5)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 6)] & 0xff;
|
||||
*dst++ = src[((y + rows) * bufferWidth) + (x + 7)] & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferI8, bufferSize);
|
||||
|
||||
return dataBufferI8;
|
||||
return dataBufferI8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downsample the specified RGBA value data buffer to an IA4 value.
|
||||
*
|
||||
*
|
||||
* This routine downsamples the given RGBA data value into the IA4 texture data format.
|
||||
*
|
||||
*
|
||||
* @param rgba A 32-bit RGBA value to convert to the IA4 format.
|
||||
* @return The IA4 value of the given RGBA value.
|
||||
*/
|
||||
|
||||
uint8_t Metaphrasis::convertRGBAToIA4(uint32_t rgba) {
|
||||
uint8_t i, a;
|
||||
|
||||
i = (rgba >> 8) & 0xf0;
|
||||
a = (rgba ) & 0xff;
|
||||
uint8_t i, a;
|
||||
|
||||
return i | (a >> 4);
|
||||
i = (rgba >> 8) & 0xf0;
|
||||
a = (rgba ) & 0xff;
|
||||
|
||||
return i | (a >> 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the IA4 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the IA4 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -137,55 +137,55 @@ uint8_t Metaphrasis::convertRGBAToIA4(uint32_t rgba) {
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToIA4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = bufferWidth * bufferHeight;
|
||||
uint32_t* dataBufferIA4 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferIA4, 0x00, bufferSize);
|
||||
uint32_t bufferSize = bufferWidth * bufferHeight;
|
||||
uint32_t* dataBufferIA4 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferIA4, 0x00, bufferSize);
|
||||
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferIA4;
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferIA4;
|
||||
|
||||
for(uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for(uint16_t x = 0; x < bufferWidth; x += 8) {
|
||||
for(uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 4)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 5)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 6)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 7)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferIA4, bufferSize);
|
||||
for (uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for (uint16_t x = 0; x < bufferWidth; x += 8) {
|
||||
for (uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 4)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 5)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 6)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA4(src[((y + rows) * bufferWidth) + (x + 7)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferIA4, bufferSize);
|
||||
|
||||
return dataBufferIA4;
|
||||
return dataBufferIA4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downsample the specified RGBA value data buffer to an IA8 value.
|
||||
*
|
||||
*
|
||||
* This routine downsamples the given RGBA data value into the IA8 texture data format.
|
||||
*
|
||||
*
|
||||
* @param rgba A 32-bit RGBA value to convert to the IA8 format.
|
||||
* @return The IA8 value of the given RGBA value.
|
||||
*/
|
||||
|
||||
uint16_t Metaphrasis::convertRGBAToIA8(uint32_t rgba) {
|
||||
uint8_t i, a;
|
||||
|
||||
i = (rgba >> 8) & 0xff;
|
||||
a = (rgba ) & 0xff;
|
||||
uint8_t i, a;
|
||||
|
||||
return (i << 8) | a;
|
||||
i = (rgba >> 8) & 0xff;
|
||||
a = (rgba ) & 0xff;
|
||||
|
||||
return (i << 8) | a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the IA8 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the IA8 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -193,33 +193,33 @@ uint16_t Metaphrasis::convertRGBAToIA8(uint32_t rgba) {
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToIA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 1;
|
||||
uint32_t* dataBufferIA8 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferIA8, 0x00, bufferSize);
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 1;
|
||||
uint32_t* dataBufferIA8 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferIA8, 0x00, bufferSize);
|
||||
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint16_t *dst = (uint16_t *)dataBufferIA8;
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint16_t *dst = (uint16_t *)dataBufferIA8;
|
||||
|
||||
for(uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for(uint16_t x = 0; x < bufferWidth; x += 4) {
|
||||
for(uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferIA8, bufferSize);
|
||||
for (uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for (uint16_t x = 0; x < bufferWidth; x += 4) {
|
||||
for (uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToIA8(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferIA8, bufferSize);
|
||||
|
||||
return dataBufferIA8;
|
||||
return dataBufferIA8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the RGBA8 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the RGBA8 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -227,59 +227,59 @@ uint32_t* Metaphrasis::convertBufferToIA8(uint32_t* rgbaBuffer, uint16_t bufferW
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToRGBA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 2;
|
||||
uint32_t* dataBufferRGBA8 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferRGBA8, 0x00, bufferSize);
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 2;
|
||||
uint32_t* dataBufferRGBA8 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferRGBA8, 0x00, bufferSize);
|
||||
|
||||
uint8_t *src = (uint8_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferRGBA8;
|
||||
uint8_t *src = (uint8_t *)rgbaBuffer;
|
||||
uint8_t *dst = (uint8_t *)dataBufferRGBA8;
|
||||
|
||||
for(uint16_t block = 0; block < bufferHeight; block += 4) {
|
||||
for(uint16_t i = 0; i < bufferWidth; i += 4) {
|
||||
for (uint16_t c = 0; c < 4; c++) {
|
||||
for (uint16_t ar = 0; ar < 4; ar++) {
|
||||
*dst++ = src[(((i + ar) + ((block + c) * bufferWidth)) * 4) + 3];
|
||||
*dst++ = src[((i + ar) + ((block + c) * bufferWidth)) * 4];
|
||||
}
|
||||
}
|
||||
for (uint16_t c = 0; c < 4; c++) {
|
||||
for (uint16_t gb = 0; gb < 4; gb++) {
|
||||
*dst++ = src[(((i + gb) + ((block + c) * bufferWidth)) * 4) + 1];
|
||||
*dst++ = src[(((i + gb) + ((block + c) * bufferWidth)) * 4) + 2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferRGBA8, bufferSize);
|
||||
for (uint16_t block = 0; block < bufferHeight; block += 4) {
|
||||
for (uint16_t i = 0; i < bufferWidth; i += 4) {
|
||||
for (uint16_t c = 0; c < 4; c++) {
|
||||
for (uint16_t ar = 0; ar < 4; ar++) {
|
||||
*dst++ = src[(((i + ar) + ((block + c) * bufferWidth)) * 4) + 3];
|
||||
*dst++ = src[((i + ar) + ((block + c) * bufferWidth)) * 4];
|
||||
}
|
||||
}
|
||||
for (uint16_t c = 0; c < 4; c++) {
|
||||
for (uint16_t gb = 0; gb < 4; gb++) {
|
||||
*dst++ = src[(((i + gb) + ((block + c) * bufferWidth)) * 4) + 1];
|
||||
*dst++ = src[(((i + gb) + ((block + c) * bufferWidth)) * 4) + 2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferRGBA8, bufferSize);
|
||||
|
||||
return dataBufferRGBA8;
|
||||
return dataBufferRGBA8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downsample the specified RGBA value data buffer to an RGB565 value.
|
||||
*
|
||||
*
|
||||
* This routine downsamples the given RGBA data value into the RGB565 texture data format.
|
||||
* Attribution for this routine is given fully to NoNameNo of GRRLIB Wii library.
|
||||
*
|
||||
*
|
||||
* @param rgba A 32-bit RGBA value to convert to the RGB565 format.
|
||||
* @return The RGB565 value of the given RGBA value.
|
||||
*/
|
||||
|
||||
uint16_t Metaphrasis::convertRGBAToRGB565(uint32_t rgba) {
|
||||
uint8_t r, g, b;
|
||||
|
||||
r = (((rgba >> 24) & 0xff) * 31) / 255;
|
||||
g = (((rgba >> 16) & 0xff) * 63) / 255;
|
||||
b = (((rgba >> 8) & 0xff) * 31) / 255;
|
||||
uint8_t r, g, b;
|
||||
|
||||
return (((r << 6) | g ) << 5 ) | b;
|
||||
r = (((rgba >> 24) & 0xff) * 31) / 255;
|
||||
g = (((rgba >> 16) & 0xff) * 63) / 255;
|
||||
b = (((rgba >> 8) & 0xff) * 31) / 255;
|
||||
|
||||
return (((r << 6) | g ) << 5 ) | b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the RGB565 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the RGB565 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -287,72 +287,71 @@ uint16_t Metaphrasis::convertRGBAToRGB565(uint32_t rgba) {
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToRGB565(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 1;
|
||||
uint32_t* dataBufferRGB565 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferRGB565, 0x00, bufferSize);
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 1;
|
||||
uint32_t* dataBufferRGB565 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferRGB565, 0x00, bufferSize);
|
||||
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint16_t *dst = (uint16_t *)dataBufferRGB565;
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint16_t *dst = (uint16_t *)dataBufferRGB565;
|
||||
|
||||
for(uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for(uint16_t x = 0; x < bufferWidth; x += 4) {
|
||||
for(uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferRGB565, bufferSize);
|
||||
for (uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for (uint16_t x = 0; x < bufferWidth; x += 4) {
|
||||
for (uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB565(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferRGB565, bufferSize);
|
||||
|
||||
return dataBufferRGB565;
|
||||
return dataBufferRGB565;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downsample the specified RGBA value data buffer to an RGB5A3 value.
|
||||
*
|
||||
*
|
||||
* This routine downsamples the given RGBA data value into the RGB5A3 texture data format.
|
||||
* Attribution for this routine is given fully to WiiGator via the TehSkeen forum.
|
||||
*
|
||||
*
|
||||
* @param rgba A 32-bit RGBA value to convert to the RGB5A3 format.
|
||||
* @return The RGB5A3 value of the given RGBA value.
|
||||
*/
|
||||
|
||||
uint16_t Metaphrasis::convertRGBAToRGB5A3(uint32_t rgba) {
|
||||
uint32_t r, g, b, a;
|
||||
uint16_t color;
|
||||
uint32_t r, g, b, a;
|
||||
uint16_t color;
|
||||
|
||||
r = (rgba >> 24) & 0xff;
|
||||
g = (rgba >> 16) & 0xff;
|
||||
b = (rgba >> 8) & 0xff;
|
||||
a = (rgba ) & 0xff;
|
||||
r = (rgba >> 24) & 0xff;
|
||||
g = (rgba >> 16) & 0xff;
|
||||
b = (rgba >> 8) & 0xff;
|
||||
a = (rgba ) & 0xff;
|
||||
|
||||
if (a > 0xe0) {
|
||||
r = r >> 3;
|
||||
g = g >> 3;
|
||||
b = b >> 3;
|
||||
|
||||
color = (r << 10) | (g << 5) | b;
|
||||
color |= 0x8000;
|
||||
}
|
||||
else {
|
||||
r = r >> 4;
|
||||
g = g >> 4;
|
||||
b = b >> 4;
|
||||
a = a >> 5;
|
||||
|
||||
color = (a << 12) | (r << 8) | (g << 4) | b;
|
||||
}
|
||||
if (a > 0xe0) {
|
||||
r = r >> 3;
|
||||
g = g >> 3;
|
||||
b = b >> 3;
|
||||
|
||||
return color;
|
||||
color = (r << 10) | (g << 5) | b;
|
||||
color |= 0x8000;
|
||||
} else {
|
||||
r = r >> 4;
|
||||
g = g >> 4;
|
||||
b = b >> 4;
|
||||
a = a >> 5;
|
||||
|
||||
color = (a << 12) | (r << 8) | (g << 4) | b;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the specified RGBA data buffer into the RGB5A3 texture format
|
||||
*
|
||||
*
|
||||
* This routine converts the RGBA data buffer into the RGB5A3 texture format and returns a pointer to the converted buffer.
|
||||
*
|
||||
*
|
||||
* @param rgbaBuffer Buffer containing the temporarily rendered RGBA data.
|
||||
* @param bufferWidth Pixel width of the data buffer.
|
||||
* @param bufferHeight Pixel height of the data buffer.
|
||||
@ -360,24 +359,24 @@ uint16_t Metaphrasis::convertRGBAToRGB5A3(uint32_t rgba) {
|
||||
*/
|
||||
|
||||
uint32_t* Metaphrasis::convertBufferToRGB5A3(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight) {
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 1;
|
||||
uint32_t* dataBufferRGB5A3 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferRGB5A3, 0x00, bufferSize);
|
||||
uint32_t bufferSize = (bufferWidth * bufferHeight) << 1;
|
||||
uint32_t* dataBufferRGB5A3 = (uint32_t *)memalign(32, bufferSize);
|
||||
memset(dataBufferRGB5A3, 0x00, bufferSize);
|
||||
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint16_t *dst = (uint16_t *)dataBufferRGB5A3;
|
||||
uint32_t *src = (uint32_t *)rgbaBuffer;
|
||||
uint16_t *dst = (uint16_t *)dataBufferRGB5A3;
|
||||
|
||||
for(uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for(uint16_t x = 0; x < bufferWidth; x += 4) {
|
||||
for(uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferRGB5A3, bufferSize);
|
||||
for (uint16_t y = 0; y < bufferHeight; y += 4) {
|
||||
for (uint16_t x = 0; x < bufferWidth; x += 4) {
|
||||
for (uint16_t rows = 0; rows < 4; rows++) {
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 0)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 1)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 2)]);
|
||||
*dst++ = Metaphrasis::convertRGBAToRGB5A3(src[((y + rows) * bufferWidth) + (x + 3)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(dataBufferRGB5A3, bufferSize);
|
||||
|
||||
return dataBufferRGB5A3;
|
||||
return dataBufferRGB5A3;
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
/*
|
||||
/*
|
||||
* Metaphrasis is a static conversion class for transforming RGBA image
|
||||
* buffers into verious GX texture formats for Wii homebrew development.
|
||||
* Copyright (C) 2008 Armin Tamzarian
|
||||
*
|
||||
*
|
||||
* This file is part of Metaphrasis.
|
||||
*
|
||||
*
|
||||
* Metaphrasis is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* Metaphrasis 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 Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Metaphrasis. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@ -22,40 +22,40 @@
|
||||
/** \mainpage Metaphrasis
|
||||
*
|
||||
* \section sec_intro Introduction
|
||||
*
|
||||
*
|
||||
* Metaphrasis is a static conversion class for transforming RGBA image buffers into verious GX texture formats for Wii homebrew development.
|
||||
* <br>
|
||||
* Metaphrasis is written in C++ and makes use of a community standard and newly developed algorithms for conversion of 32-bit RGBA data buffers into various GX texture formats common to both the Gamecube and Wii platforms.
|
||||
* Metaphrasis is written in C++ and makes use of a community standard and newly developed algorithms for conversion of 32-bit RGBA data buffers into various GX texture formats common to both the Gamecube and Wii platforms.
|
||||
* <p>
|
||||
* This library was developed in-full by Armin Tamzarian with the support of developers in \#wiibrew on EFnet, Chaosteil of libwiisprite, and DrTwox of GRRLIB.
|
||||
*
|
||||
* This library was developed in-full by Armin Tamzarian with the support of developers in \#wiibrew on EFnet, Chaosteil of libwiisprite, and DrTwox of GRRLIB.
|
||||
*
|
||||
* \section sec_installation_source Installation (Source Code)
|
||||
*
|
||||
*
|
||||
* -# Extract the Metaphrasis archive.
|
||||
* -# Copy the contents of the <i>src</i> directory into your project's development path.
|
||||
* -# Include the Metaphrasis header file in your code using syntax such as the following:
|
||||
* \code
|
||||
* #include "Metaphrasis.h"
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* \section sec_installation_library Installation (Library)
|
||||
*
|
||||
*
|
||||
* -# Extract the Metaphrasis archive.
|
||||
* -# Copy the contents of the <i>lib</i> directory into your <i>devKitPro/libogc</i> directory.
|
||||
* -# Include the Metaphrasis header file in your code using syntax such as the following:
|
||||
* \code
|
||||
* #include "Metaphrasis.h"
|
||||
* \endcode
|
||||
*
|
||||
*
|
||||
* \section sec_usage Usage
|
||||
*
|
||||
*
|
||||
* -# Create a buffer full of 32-bit RGBA values noting both the pixel height and width of the buffer.
|
||||
* -# Call one of the many conversion routines from within your code. (Note: All methods within the Metaphrasis class are static and thus no class instance need be allocated)
|
||||
* \code
|
||||
* uint32_t* rgba8Buffer = Metaphrasis::convertBufferToRGBA8(rgbaBuffer, bufferWidth, bufferHeight);
|
||||
* \endcode
|
||||
* -# Free your temporary RGBA value buffer if you no longer need said values.
|
||||
*
|
||||
*
|
||||
* Currently supported conversion routines are as follows:
|
||||
* \li convertBufferToI4
|
||||
* \li convertBufferToI8
|
||||
@ -64,13 +64,13 @@
|
||||
* \li convertBufferToRGBA8
|
||||
* \li convertBufferToRGB565
|
||||
* \li convertBufferToRGB5A3
|
||||
*
|
||||
*
|
||||
* \section sec_license License
|
||||
*
|
||||
*
|
||||
* Metaphrasis is distributed under the GNU Lesser General Public License.
|
||||
*
|
||||
*
|
||||
* \section sec_contact Contact
|
||||
*
|
||||
*
|
||||
* If you have any suggestions, questions, or comments regarding this library feel free to e-mail me at tamzarian1989 [at] gmail [dawt] com.
|
||||
*/
|
||||
|
||||
@ -87,29 +87,29 @@
|
||||
* Wii homebrew development.
|
||||
* \author Armin Tamzarian
|
||||
* \version 0.1.0
|
||||
*
|
||||
*
|
||||
* Metaphrasis is a static conversion class for transforming RGBA image buffers into verious GX texture formats for
|
||||
* Wii homebrew development. Metaphrasis is written in C++ and makes use of a community standard and newly developed
|
||||
* algorithms for conversion of 32-bit RGBA data buffers into various GX texture formats common to both the Gamecube
|
||||
* and Wii platforms.
|
||||
*/
|
||||
class Metaphrasis {
|
||||
public:
|
||||
Metaphrasis();
|
||||
virtual ~Metaphrasis();
|
||||
public:
|
||||
Metaphrasis();
|
||||
virtual ~Metaphrasis();
|
||||
|
||||
static uint32_t* convertBufferToI4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToI8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToIA4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToIA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToRGBA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToRGB565(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToRGB5A3(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
|
||||
static uint8_t convertRGBAToIA4(uint32_t rgba);
|
||||
static uint16_t convertRGBAToIA8(uint32_t rgba);
|
||||
static uint16_t convertRGBAToRGB565(uint32_t rgba);
|
||||
static uint16_t convertRGBAToRGB5A3(uint32_t rgba);
|
||||
static uint32_t* convertBufferToI4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToI8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToIA4(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToIA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToRGBA8(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToRGB565(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
static uint32_t* convertBufferToRGB5A3(uint32_t* rgbaBuffer, uint16_t bufferWidth, uint16_t bufferHeight);
|
||||
|
||||
static uint8_t convertRGBAToIA4(uint32_t rgba);
|
||||
static uint16_t convertRGBAToIA8(uint32_t rgba);
|
||||
static uint16_t convertRGBAToRGB565(uint32_t rgba);
|
||||
static uint16_t convertRGBAToRGB5A3(uint32_t rgba);
|
||||
|
||||
};
|
||||
|
||||
|
@ -15,11 +15,10 @@
|
||||
*
|
||||
* Initializes the Wii's audio subsystem
|
||||
***************************************************************************/
|
||||
void InitAudio()
|
||||
{
|
||||
AUDIO_Init(NULL);
|
||||
ASND_Init();
|
||||
ASND_Pause(0);
|
||||
void InitAudio() {
|
||||
AUDIO_Init(NULL);
|
||||
ASND_Init();
|
||||
ASND_Pause(0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -28,8 +27,7 @@ void InitAudio()
|
||||
* Shuts down audio subsystem. Useful to avoid unpleasant sounds if a
|
||||
* crash occurs during shutdown.
|
||||
***************************************************************************/
|
||||
void ShutdownAudio()
|
||||
{
|
||||
ASND_Pause(1);
|
||||
ASND_End();
|
||||
void ShutdownAudio() {
|
||||
ASND_Pause(1);
|
||||
ASND_End();
|
||||
}
|
||||
|
@ -32,59 +32,57 @@ static GuiImageData * cover[BUFFERSIZE];
|
||||
static GuiImage * coverImg[BUFFERSIZE];
|
||||
static GuiImage * NoCover[BUFFERSIZE];
|
||||
|
||||
GuiImage * ImageBuffer(int imagenumber)
|
||||
{
|
||||
if((BUFFERSIZE-1 > imagenumber) && direction >= 0) {
|
||||
GuiImage * ImageBuffer(int imagenumber) {
|
||||
if ((BUFFERSIZE-1 > imagenumber) && direction >= 0) {
|
||||
return coverImg[imagenumber];
|
||||
}
|
||||
|
||||
if((0 < imagenumber) && direction < 0) {
|
||||
if ((0 < imagenumber) && direction < 0) {
|
||||
return coverImg[imagenumber];
|
||||
}
|
||||
|
||||
if(loading == BUFFERSIZE) {
|
||||
if (loading == BUFFERSIZE) {
|
||||
return coverImg[imagenumber];
|
||||
}
|
||||
|
||||
return NoCover[imagenumber];
|
||||
}
|
||||
|
||||
void LoadImages()
|
||||
{
|
||||
if(!changed || BufferHalt)
|
||||
void LoadImages() {
|
||||
if (!changed || BufferHalt)
|
||||
return;
|
||||
|
||||
char ID[4];
|
||||
char IDfull[7];
|
||||
char ID[4];
|
||||
char IDfull[7];
|
||||
char imgPath[200];
|
||||
|
||||
for(u32 i = offset; (int) i < offset+BUFFERSIZE; i++) {
|
||||
for (u32 i = offset; (int) i < offset+BUFFERSIZE; i++) {
|
||||
|
||||
struct discHdr *header;
|
||||
if(i > gameCnt-1)
|
||||
header = &gameList[i-gameCnt];
|
||||
else
|
||||
header = &gameList[i];
|
||||
struct discHdr *header;
|
||||
if (i > gameCnt-1)
|
||||
header = &gameList[i-gameCnt];
|
||||
else
|
||||
header = &gameList[i];
|
||||
|
||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
|
||||
|
||||
//firsttime loading images into memory
|
||||
if(firstime) {
|
||||
//firsttime loading images into memory
|
||||
if (firstime) {
|
||||
|
||||
if(coverImg[loading]) {
|
||||
delete coverImg[loading];
|
||||
coverImg[loading] = NULL;
|
||||
}
|
||||
if(cover[loading]) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
}
|
||||
if (coverImg[loading]) {
|
||||
delete coverImg[loading];
|
||||
coverImg[loading] = NULL;
|
||||
}
|
||||
if (cover[loading]) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
}
|
||||
|
||||
cover[loading] = new GuiImageData(imgPath,0);
|
||||
cover[loading] = new GuiImageData(imgPath,0);
|
||||
if (!cover[loading]->GetImage()) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
@ -97,105 +95,105 @@ void LoadImages()
|
||||
cover[loading] = new GuiImageData(imgPath, nocover_png);
|
||||
}
|
||||
}
|
||||
coverImg[loading] = new GuiImage(cover[loading]);
|
||||
coverImg[loading] = new GuiImage(cover[loading]);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if(direction >= 0) {
|
||||
if (direction >= 0) {
|
||||
|
||||
if(loading < BUFFERSIZE-1) {
|
||||
if (loading < BUFFERSIZE-1) {
|
||||
|
||||
if(coverImg[loading]) {
|
||||
delete coverImg[loading];
|
||||
coverImg[loading] = NULL;
|
||||
}
|
||||
|
||||
if(loading == 0) {
|
||||
if(cover[loading]) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
if (coverImg[loading]) {
|
||||
delete coverImg[loading];
|
||||
coverImg[loading] = NULL;
|
||||
}
|
||||
cover[loading] = new GuiImageData(NULL, 0);
|
||||
cover[loading] = cover[loading+1];
|
||||
|
||||
if (loading == 0) {
|
||||
if (cover[loading]) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
}
|
||||
cover[loading] = new GuiImageData(NULL, 0);
|
||||
cover[loading] = cover[loading+1];
|
||||
} else {
|
||||
cover[loading] = cover[loading+1];
|
||||
}
|
||||
|
||||
coverImg[loading] = new GuiImage(cover[loading]);
|
||||
|
||||
} else {
|
||||
cover[loading] = cover[loading+1];
|
||||
}
|
||||
|
||||
coverImg[loading] = new GuiImage(cover[loading]);
|
||||
|
||||
} else {
|
||||
|
||||
cover[loading] = new GuiImageData(imgPath,0);
|
||||
if (!cover[loading]->GetImage()) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
|
||||
cover[loading] = new GuiImageData(imgPath, 0);
|
||||
cover[loading] = new GuiImageData(imgPath,0);
|
||||
if (!cover[loading]->GetImage()) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
|
||||
cover[loading] = new GuiImageData(imgPath, nocover_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
|
||||
cover[loading] = new GuiImageData(imgPath, 0);
|
||||
if (!cover[loading]->GetImage()) {
|
||||
delete cover[loading];
|
||||
cover[loading] = NULL;
|
||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
|
||||
cover[loading] = new GuiImageData(imgPath, nocover_png);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(coverImg[loading]) {
|
||||
delete coverImg[loading];
|
||||
coverImg[loading] = NULL;
|
||||
}
|
||||
coverImg[loading] = new GuiImage(cover[loading]);
|
||||
}
|
||||
} else if(direction < 0) {
|
||||
|
||||
if(BUFFERSIZE-loading-1 > 0) {
|
||||
|
||||
if(coverImg[BUFFERSIZE-loading-1]) {
|
||||
delete coverImg[BUFFERSIZE-loading-1];
|
||||
coverImg[BUFFERSIZE-loading-1] = NULL;
|
||||
}
|
||||
|
||||
if(BUFFERSIZE-loading-1 == BUFFERSIZE-1) {
|
||||
if(cover[BUFFERSIZE-loading-1]) {
|
||||
delete cover[BUFFERSIZE-loading-1];
|
||||
cover[BUFFERSIZE-loading-1] = NULL;
|
||||
if (coverImg[loading]) {
|
||||
delete coverImg[loading];
|
||||
coverImg[loading] = NULL;
|
||||
}
|
||||
cover[BUFFERSIZE-loading-1] = new GuiImageData(NULL, 0);
|
||||
cover[BUFFERSIZE-loading-1] = cover[BUFFERSIZE-loading-1-1];
|
||||
coverImg[loading] = new GuiImage(cover[loading]);
|
||||
}
|
||||
} else if (direction < 0) {
|
||||
|
||||
if (BUFFERSIZE-loading-1 > 0) {
|
||||
|
||||
if (coverImg[BUFFERSIZE-loading-1]) {
|
||||
delete coverImg[BUFFERSIZE-loading-1];
|
||||
coverImg[BUFFERSIZE-loading-1] = NULL;
|
||||
}
|
||||
|
||||
if (BUFFERSIZE-loading-1 == BUFFERSIZE-1) {
|
||||
if (cover[BUFFERSIZE-loading-1]) {
|
||||
delete cover[BUFFERSIZE-loading-1];
|
||||
cover[BUFFERSIZE-loading-1] = NULL;
|
||||
}
|
||||
cover[BUFFERSIZE-loading-1] = new GuiImageData(NULL, 0);
|
||||
cover[BUFFERSIZE-loading-1] = cover[BUFFERSIZE-loading-1-1];
|
||||
} else {
|
||||
cover[BUFFERSIZE-loading-1] = cover[BUFFERSIZE-loading-1-1];
|
||||
coverImg[BUFFERSIZE-loading-1] = new GuiImage(cover[BUFFERSIZE-loading-1]);
|
||||
}
|
||||
|
||||
} else {
|
||||
cover[BUFFERSIZE-loading-1] = cover[BUFFERSIZE-loading-1-1];
|
||||
coverImg[BUFFERSIZE-loading-1] = new GuiImage(cover[BUFFERSIZE-loading-1]);
|
||||
}
|
||||
|
||||
} else {
|
||||
header = &gameList[offset];
|
||||
|
||||
header = &gameList[offset];
|
||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||
|
||||
snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]);
|
||||
snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]);
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, IDfull); //Load full id image
|
||||
|
||||
cover[0] = new GuiImageData(imgPath,0);
|
||||
if (!cover[0]->GetImage()) {
|
||||
delete cover[0];
|
||||
cover[0] = NULL;
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
|
||||
cover[0] = new GuiImageData(imgPath, 0);
|
||||
cover[0] = new GuiImageData(imgPath,0);
|
||||
if (!cover[0]->GetImage()) {
|
||||
delete cover[0];
|
||||
cover[0] = NULL;
|
||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
|
||||
cover[0] = new GuiImageData(imgPath, nocover_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID); //Load short id image
|
||||
cover[0] = new GuiImageData(imgPath, 0);
|
||||
if (!cover[0]->GetImage()) {
|
||||
delete cover[0];
|
||||
cover[0] = NULL;
|
||||
snprintf(imgPath, sizeof(imgPath), "%snoimage.png", Settings.covers_path); //Load no image
|
||||
cover[0] = new GuiImageData(imgPath, nocover_png);
|
||||
}
|
||||
}
|
||||
if (coverImg[0]) {
|
||||
delete coverImg[0];
|
||||
coverImg[0] = NULL;
|
||||
}
|
||||
coverImg[0] = new GuiImage(cover[0]);
|
||||
}
|
||||
if(coverImg[0]) {
|
||||
delete coverImg[0];
|
||||
coverImg[0] = NULL;
|
||||
}
|
||||
coverImg[0] = new GuiImage(cover[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
loading++;
|
||||
loading++;
|
||||
}
|
||||
|
||||
loading = BUFFERSIZE;
|
||||
@ -203,9 +201,8 @@ void LoadImages()
|
||||
firstime = false;
|
||||
}
|
||||
|
||||
void NewOffset(int off, int d)
|
||||
{
|
||||
if(offset == off || loading < BUFFERSIZE)
|
||||
void NewOffset(int off, int d) {
|
||||
if (offset == off || loading < BUFFERSIZE)
|
||||
return;
|
||||
|
||||
direction = d;
|
||||
@ -219,8 +216,7 @@ void NewOffset(int off, int d)
|
||||
/****************************************************************************
|
||||
* HaltBuffer
|
||||
***************************************************************************/
|
||||
void HaltBufferThread()
|
||||
{
|
||||
void HaltBufferThread() {
|
||||
BufferHalt = true;
|
||||
firstime = true;
|
||||
changed = true;
|
||||
@ -228,11 +224,11 @@ void HaltBufferThread()
|
||||
offset = 0;
|
||||
direction = 0;
|
||||
|
||||
// wait for thread to finish
|
||||
while(!LWP_ThreadIsSuspended(bufferthread))
|
||||
usleep(100);
|
||||
// wait for thread to finish
|
||||
while (!LWP_ThreadIsSuspended(bufferthread))
|
||||
usleep(100);
|
||||
|
||||
for(int i = 0; i < BUFFERSIZE; i++) {
|
||||
for (int i = 0; i < BUFFERSIZE; i++) {
|
||||
delete cover[i];
|
||||
cover[i] = NULL;
|
||||
delete coverImg[i];
|
||||
@ -245,54 +241,49 @@ void HaltBufferThread()
|
||||
/****************************************************************************
|
||||
* ResumeBufferThread
|
||||
***************************************************************************/
|
||||
void ResumeBufferThread(int offset)
|
||||
{
|
||||
BufferHalt = false;
|
||||
void ResumeBufferThread(int offset) {
|
||||
BufferHalt = false;
|
||||
firstime = true;
|
||||
changed = true;
|
||||
loading = 0;
|
||||
offset = offset;
|
||||
direction = 0;
|
||||
|
||||
for(u8 i = 0; i < BUFFERSIZE; i++) {
|
||||
if(NoCover[i] != NULL) {
|
||||
for (u8 i = 0; i < BUFFERSIZE; i++) {
|
||||
if (NoCover[i] != NULL) {
|
||||
delete NoCover[i];
|
||||
NoCover[i] = NULL;
|
||||
}
|
||||
NoCover[i] = new GuiImage(&NoCoverData);
|
||||
}
|
||||
|
||||
LWP_ResumeThread(bufferthread);
|
||||
LWP_ResumeThread(bufferthread);
|
||||
}
|
||||
|
||||
/*********************************************************************************
|
||||
* Bufferthread
|
||||
*********************************************************************************/
|
||||
static void * bufferinitcallback(void *arg)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
if(BufferHalt)
|
||||
static void * bufferinitcallback(void *arg) {
|
||||
while (1) {
|
||||
if (BufferHalt)
|
||||
LWP_SuspendThread(bufferthread);
|
||||
|
||||
LoadImages();
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* InitBufferThread with priority 50
|
||||
***************************************************************************/
|
||||
void InitBufferThread()
|
||||
{
|
||||
LWP_CreateThread(&bufferthread, bufferinitcallback, NULL, NULL, 0, 50);
|
||||
void InitBufferThread() {
|
||||
LWP_CreateThread(&bufferthread, bufferinitcallback, NULL, NULL, 0, 50);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ShutdownThread
|
||||
***************************************************************************/
|
||||
void ShutdownBufferThread()
|
||||
{
|
||||
LWP_JoinThread (bufferthread, NULL);
|
||||
bufferthread = LWP_THREAD_NULL;
|
||||
void ShutdownBufferThread() {
|
||||
LWP_JoinThread (bufferthread, NULL);
|
||||
bufferthread = LWP_THREAD_NULL;
|
||||
}
|
||||
|
@ -22,151 +22,140 @@ extern GuiWindow * mainWindow;
|
||||
/****************************************************************************
|
||||
* CheatMenu
|
||||
***************************************************************************/
|
||||
int CheatMenu(const char * gameID)
|
||||
{
|
||||
int choice = 0;
|
||||
bool exit = false;
|
||||
int ret = 1;
|
||||
int CheatMenu(const char * gameID) {
|
||||
int choice = 0;
|
||||
bool exit = false;
|
||||
int ret = 1;
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
char imgPath[100];
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
char imgPath[100];
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -140, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiButton backBtn(&backBtnImg,&backBtnImg, 2, 3, -140, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
|
||||
GuiText createBtnTxt(tr("Create") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
createBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage createBtnImg(&btnOutline);
|
||||
GuiButton createBtn(&createBtnImg,&createBtnImg, 2, 3, 160, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
createBtn.SetLabel(&createBtnTxt);
|
||||
GuiText createBtnTxt(tr("Create") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
createBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage createBtnImg(&btnOutline);
|
||||
GuiButton createBtn(&createBtnImg,&createBtnImg, 2, 3, 160, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
createBtn.SetLabel(&createBtnTxt);
|
||||
|
||||
char txtfilename[55];
|
||||
snprintf(txtfilename,sizeof(txtfilename),"%s%s.txt",Settings.TxtCheatcodespath,gameID);
|
||||
|
||||
GCTCheats c;
|
||||
int check = c.openTxtfile(txtfilename);
|
||||
|
||||
int download =0;
|
||||
//char tmp[10];
|
||||
|
||||
|
||||
switch(check)
|
||||
{
|
||||
case -1: WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
||||
break;
|
||||
case 0: download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),tr("Download Now"));
|
||||
//snprintf(tmp, sizeof(tmp), "%i",download);
|
||||
|
||||
//WindowPrompt(0,tmp,tr("OK"),tr("Download Now"));
|
||||
if (download==0)
|
||||
download = CodeDownload(gameID);
|
||||
break;
|
||||
case 1:
|
||||
int cntcheats = c.getCnt();
|
||||
customOptionList cheatslst(cntcheats);
|
||||
GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 1, 90);
|
||||
chtBrowser.SetPosition(0, 90);
|
||||
chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
chtBrowser.SetClickable(true);
|
||||
char txtfilename[55];
|
||||
snprintf(txtfilename,sizeof(txtfilename),"%s%s.txt",Settings.TxtCheatcodespath,gameID);
|
||||
|
||||
GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor){0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
|
||||
titleTxt.SetPosition(12,40);
|
||||
GCTCheats c;
|
||||
int check = c.openTxtfile(txtfilename);
|
||||
|
||||
for(int i = 0; i <= cntcheats; i++)
|
||||
{
|
||||
cheatslst.SetValue(i, "%s",c.getCheatName(i).c_str());
|
||||
cheatslst.SetName(i, "OFF");
|
||||
}
|
||||
int download =0;
|
||||
//char tmp[10];
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&settingsbackground);
|
||||
w.Append(&titleTxt);
|
||||
w.Append(&backBtn);
|
||||
w.Append(&createBtn);
|
||||
w.Append(&chtBrowser);
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->ChangeFocus(&w);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
VIDEO_WaitVSync ();
|
||||
switch (check) {
|
||||
case -1:
|
||||
WindowPrompt(tr("Error"),tr("Cheatfile is blank"),tr("OK"));
|
||||
break;
|
||||
case 0:
|
||||
download = WindowPrompt(tr("Error"),tr("No Cheatfile found"),tr("OK"),tr("Download Now"));
|
||||
//snprintf(tmp, sizeof(tmp), "%i",download);
|
||||
|
||||
ret = chtBrowser.GetClickedOption();
|
||||
if (ret != -1)
|
||||
{
|
||||
const char *strCheck = cheatslst.GetName(ret);
|
||||
if (strncmp(strCheck,"ON",2) == 0)
|
||||
{
|
||||
cheatslst.SetName(ret,"%s","OFF");
|
||||
}
|
||||
else if (strncmp(strCheck,"OFF",3) == 0)
|
||||
{
|
||||
cheatslst.SetName(ret,"%s","ON");
|
||||
}
|
||||
//WindowPrompt(0,tmp,tr("OK"),tr("Download Now"));
|
||||
if (download==0)
|
||||
download = CodeDownload(gameID);
|
||||
break;
|
||||
case 1:
|
||||
int cntcheats = c.getCnt();
|
||||
customOptionList cheatslst(cntcheats);
|
||||
GuiCustomOptionBrowser chtBrowser(400, 280, &cheatslst, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, 1, 90);
|
||||
chtBrowser.SetPosition(0, 90);
|
||||
chtBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
chtBrowser.SetClickable(true);
|
||||
|
||||
GuiText titleTxt(c.getGameName().c_str(), 28, (GXColor) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetMaxWidth(350, GuiText::SCROLL);
|
||||
titleTxt.SetPosition(12,40);
|
||||
|
||||
for (int i = 0; i <= cntcheats; i++) {
|
||||
cheatslst.SetValue(i, "%s",c.getCheatName(i).c_str());
|
||||
cheatslst.SetName(i, "OFF");
|
||||
}
|
||||
|
||||
if(createBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
createBtn.ResetState();
|
||||
if (cntcheats > 0)
|
||||
{
|
||||
int selectednrs[30];
|
||||
int x = 0;
|
||||
for(int i = 0; i <= cntcheats; i++)
|
||||
{
|
||||
const char *strCheck = cheatslst.GetName(i);
|
||||
if (strncmp(strCheck,"ON",2) == 0)
|
||||
{
|
||||
selectednrs[x] = i;
|
||||
x++;
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&settingsbackground);
|
||||
w.Append(&titleTxt);
|
||||
w.Append(&backBtn);
|
||||
w.Append(&createBtn);
|
||||
w.Append(&chtBrowser);
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->ChangeFocus(&w);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
ret = chtBrowser.GetClickedOption();
|
||||
if (ret != -1) {
|
||||
const char *strCheck = cheatslst.GetName(ret);
|
||||
if (strncmp(strCheck,"ON",2) == 0) {
|
||||
cheatslst.SetName(ret,"%s","OFF");
|
||||
} else if (strncmp(strCheck,"OFF",3) == 0) {
|
||||
cheatslst.SetName(ret,"%s","ON");
|
||||
}
|
||||
}
|
||||
|
||||
string chtpath = Settings.Cheatcodespath;
|
||||
string gctfname = chtpath + c.getGameID() + ".gct";
|
||||
c.createGCT(selectednrs,x,gctfname.c_str());
|
||||
WindowPrompt(tr("GCT File created"),NULL,tr("OK"));
|
||||
exit = true;
|
||||
break;
|
||||
} else WindowPrompt(tr("Error"),tr("Could not create GCT file"),tr("OK"));
|
||||
if (createBtn.GetState() == STATE_CLICKED) {
|
||||
createBtn.ResetState();
|
||||
if (cntcheats > 0) {
|
||||
int selectednrs[30];
|
||||
int x = 0;
|
||||
for (int i = 0; i <= cntcheats; i++) {
|
||||
const char *strCheck = cheatslst.GetName(i);
|
||||
if (strncmp(strCheck,"ON",2) == 0) {
|
||||
selectednrs[x] = i;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
string chtpath = Settings.Cheatcodespath;
|
||||
string gctfname = chtpath + c.getGameID() + ".gct";
|
||||
c.createGCT(selectednrs,x,gctfname.c_str());
|
||||
WindowPrompt(tr("GCT File created"),NULL,tr("OK"));
|
||||
exit = true;
|
||||
break;
|
||||
} else WindowPrompt(tr("Error"),tr("Could not create GCT file"),tr("OK"));
|
||||
|
||||
}
|
||||
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
HaltGui();
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
if(backBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
backBtn.ResetState();
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
HaltGui();
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return choice;
|
||||
|
@ -4,236 +4,205 @@
|
||||
|
||||
#define OUTOFRANGE "Error:Range"
|
||||
|
||||
GCTCheats::GCTCheats(void)
|
||||
{
|
||||
iCntCheats = 0;
|
||||
GCTCheats::GCTCheats(void) {
|
||||
iCntCheats = 0;
|
||||
}
|
||||
|
||||
GCTCheats::~GCTCheats(void)
|
||||
{
|
||||
GCTCheats::~GCTCheats(void) {
|
||||
}
|
||||
|
||||
int GCTCheats::getCnt()
|
||||
{
|
||||
return iCntCheats;
|
||||
int GCTCheats::getCnt() {
|
||||
return iCntCheats;
|
||||
}
|
||||
|
||||
string GCTCheats::getGameName(void)
|
||||
{
|
||||
return sGameTitle;
|
||||
string GCTCheats::getGameName(void) {
|
||||
return sGameTitle;
|
||||
}
|
||||
|
||||
string GCTCheats::getGameID(void)
|
||||
{
|
||||
return sGameID;
|
||||
string GCTCheats::getGameID(void) {
|
||||
return sGameID;
|
||||
}
|
||||
|
||||
string GCTCheats::getCheat(int nr)
|
||||
{
|
||||
if (nr <= (iCntCheats-1))
|
||||
{
|
||||
return sCheats[nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
return OUTOFRANGE;//"Error: CheatNr out of range";
|
||||
}
|
||||
string GCTCheats::getCheat(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheats[nr];
|
||||
} else {
|
||||
return OUTOFRANGE;//"Error: CheatNr out of range";
|
||||
}
|
||||
}
|
||||
|
||||
string GCTCheats::getCheatName(int nr)
|
||||
{
|
||||
if (nr <= (iCntCheats-1))
|
||||
{
|
||||
return sCheatName[nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Error: CheatNr out of range";
|
||||
}
|
||||
string GCTCheats::getCheatName(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheatName[nr];
|
||||
} else {
|
||||
return "Error: CheatNr out of range";
|
||||
}
|
||||
}
|
||||
|
||||
string GCTCheats::getCheatComment(int nr)
|
||||
{
|
||||
if (nr <= (iCntCheats-1))
|
||||
{
|
||||
return sCheatComment[nr];
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Error: CheatNr out of range";
|
||||
}
|
||||
string GCTCheats::getCheatComment(int nr) {
|
||||
if (nr <= (iCntCheats-1)) {
|
||||
return sCheatComment[nr];
|
||||
} else {
|
||||
return "Error: CheatNr out of range";
|
||||
}
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(int nr,const char * filename)
|
||||
{
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
int GCTCheats::createGCT(int nr,const char * filename) {
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
//Reversed Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
//Reversed Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
string buf = getCheat(nr);
|
||||
filestr.write(header,sizeof(header));
|
||||
string buf = getCheat(nr);
|
||||
filestr.write(header,sizeof(header));
|
||||
|
||||
int x = 0;
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
int x = 0;
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
|
||||
while (x < len)
|
||||
{
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
filestr.write(temp.c_str(),1);
|
||||
x +=2;
|
||||
}
|
||||
filestr.write(footer,sizeof(footer));
|
||||
while (x < len) {
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
filestr.write(temp.c_str(),1);
|
||||
x +=2;
|
||||
}
|
||||
filestr.write(footer,sizeof(footer));
|
||||
|
||||
filestr.close();
|
||||
return 1;
|
||||
filestr.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(const char * chtbuffer,const char * filename)
|
||||
{
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
int GCTCheats::createGCT(const char * chtbuffer,const char * filename) {
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
//Reversed Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
//Reversed Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
string buf = chtbuffer;
|
||||
filestr.write(header,sizeof(header));
|
||||
string buf = chtbuffer;
|
||||
filestr.write(header,sizeof(header));
|
||||
|
||||
int x = 0;
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
int x = 0;
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
|
||||
while (x < len)
|
||||
{
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
filestr.write(temp.c_str(),1);
|
||||
x +=2;
|
||||
}
|
||||
while (x < len) {
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
filestr.write(temp.c_str(),1);
|
||||
x +=2;
|
||||
}
|
||||
|
||||
filestr.write(footer,sizeof(footer));
|
||||
filestr.write(footer,sizeof(footer));
|
||||
|
||||
filestr.close();
|
||||
filestr.close();
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GCTCheats::createGCT(int nr[],int cnt,const char * filename)
|
||||
{
|
||||
int GCTCheats::createGCT(int nr[],int cnt,const char * filename) {
|
||||
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
ofstream filestr;
|
||||
filestr.open(filename);
|
||||
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
//Reversed Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
//Reversed Header and Footer
|
||||
char header[] = { 0x00, 0xd0, 0xc0, 0xde, 0x00, 0xd0, 0xc0, 0xde};
|
||||
char footer[] = { 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
filestr.write(header,sizeof(header));
|
||||
filestr.write(header,sizeof(header));
|
||||
|
||||
int c = 0;
|
||||
while (c != cnt)
|
||||
{
|
||||
int actnr = nr[c];
|
||||
string buf = getCheat(actnr);
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
int x = 0;
|
||||
int c = 0;
|
||||
while (c != cnt) {
|
||||
int actnr = nr[c];
|
||||
string buf = getCheat(actnr);
|
||||
long int li;
|
||||
int len = buf.size();
|
||||
int x = 0;
|
||||
|
||||
while (x < len)
|
||||
{
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
filestr.write(temp.c_str(),1);
|
||||
x +=2;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
while (x < len) {
|
||||
string temp = buf.substr(x,2);
|
||||
li = strtol(temp.c_str(),NULL,16);
|
||||
temp = li;
|
||||
filestr.write(temp.c_str(),1);
|
||||
x +=2;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
|
||||
filestr.write(footer,sizeof(footer));
|
||||
filestr.close();
|
||||
return 1;
|
||||
filestr.write(footer,sizeof(footer));
|
||||
filestr.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int GCTCheats::openTxtfile(const char * filename)
|
||||
{
|
||||
ifstream filestr;
|
||||
int i = 0;
|
||||
string str;
|
||||
filestr.open(filename);
|
||||
int GCTCheats::openTxtfile(const char * filename) {
|
||||
ifstream filestr;
|
||||
int i = 0;
|
||||
string str;
|
||||
filestr.open(filename);
|
||||
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
if (filestr.fail())
|
||||
return 0;
|
||||
|
||||
filestr.seekg(0,ios_base::end);
|
||||
int size = filestr.tellg();
|
||||
if (size <= 0) return -1;
|
||||
filestr.seekg(0,ios_base::beg);
|
||||
filestr.seekg(0,ios_base::end);
|
||||
int size = filestr.tellg();
|
||||
if (size <= 0) return -1;
|
||||
filestr.seekg(0,ios_base::beg);
|
||||
|
||||
getline(filestr,sGameID);
|
||||
getline(filestr,sGameTitle);
|
||||
filestr.ignore();
|
||||
getline(filestr,sGameID);
|
||||
getline(filestr,sGameTitle);
|
||||
filestr.ignore();
|
||||
|
||||
while(!filestr.eof())
|
||||
{
|
||||
while (!filestr.eof()) {
|
||||
getline(filestr,sCheatName[i]);
|
||||
string cheatdata;
|
||||
bool emptyline = false;
|
||||
bool isComment = false;
|
||||
bool isComment = false;
|
||||
|
||||
do
|
||||
{
|
||||
getline(filestr,str,'\n');
|
||||
//cheatdata.append(str);
|
||||
do {
|
||||
getline(filestr,str,'\n');
|
||||
//cheatdata.append(str);
|
||||
|
||||
if (str == "")
|
||||
{
|
||||
emptyline = true;
|
||||
break;
|
||||
}
|
||||
if (str == "") {
|
||||
emptyline = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (str.size() <= 16 || str.size() > 17 )
|
||||
{
|
||||
isComment = true;
|
||||
printf ("%i",str.size());
|
||||
}
|
||||
if (str.size() <= 16 || str.size() > 17 ) {
|
||||
isComment = true;
|
||||
printf ("%i",str.size());
|
||||
}
|
||||
|
||||
if (!isComment)
|
||||
{
|
||||
cheatdata.append(str);
|
||||
size_t found=cheatdata.find(' ');
|
||||
cheatdata.replace(found,1,"");
|
||||
} else
|
||||
{
|
||||
sCheatComment[i] = str;
|
||||
}
|
||||
if (!isComment) {
|
||||
cheatdata.append(str);
|
||||
size_t found=cheatdata.find(' ');
|
||||
cheatdata.replace(found,1,"");
|
||||
} else {
|
||||
sCheatComment[i] = str;
|
||||
}
|
||||
|
||||
if (filestr.eof()) break;
|
||||
} while(!emptyline);
|
||||
if (filestr.eof()) break;
|
||||
} while (!emptyline);
|
||||
|
||||
sCheats[i] = cheatdata;
|
||||
i++;
|
||||
}
|
||||
iCntCheats = i;
|
||||
filestr.close();
|
||||
return 1;
|
||||
sCheats[i] = cheatdata;
|
||||
i++;
|
||||
}
|
||||
iCntCheats = i;
|
||||
filestr.close();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -287,43 +256,38 @@ filestr.close();
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(void)
|
||||
{
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(void) {
|
||||
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
|
||||
while (i < iCntCheats)
|
||||
{
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
}
|
||||
return cheatlist;
|
||||
while (i < iCntCheats) {
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
}
|
||||
return cheatlist;
|
||||
}
|
||||
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename)
|
||||
{
|
||||
openTxtfile(filename);
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
cheatlist.iCntCheats = iCntCheats;
|
||||
struct GCTCheats::chtentries GCTCheats::getCheatList(const char * filename) {
|
||||
openTxtfile(filename);
|
||||
struct GCTCheats::chtentries cheatlist;
|
||||
int i = 0;
|
||||
cheatlist.sGameID = sGameID;
|
||||
cheatlist.sGameTitle = sGameTitle;
|
||||
cheatlist.iCntCheats = iCntCheats;
|
||||
|
||||
while (i < iCntCheats)
|
||||
{
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
}
|
||||
return cheatlist;
|
||||
while (i < iCntCheats) {
|
||||
cheatlist.sCheatName[i] = sCheatName[i];
|
||||
cheatlist.sCheats[i] = sCheats[i];
|
||||
i++;
|
||||
}
|
||||
return cheatlist;
|
||||
}
|
||||
|
||||
int GCTCheats::download_txtcheat(int id)
|
||||
{
|
||||
int GCTCheats::download_txtcheat(int id) {
|
||||
//ToDo
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -14,93 +14,90 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct chtentrie
|
||||
{
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
string sCheatComment[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
struct chtentrie {
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
string sCheatComment[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
};
|
||||
|
||||
//!Handles Ocarina TXT Cheatfiles
|
||||
class GCTCheats
|
||||
{
|
||||
class GCTCheats {
|
||||
private:
|
||||
chtentrie ccc;
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
string sCheatComment[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
chtentrie ccc;
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
string sCheatComment[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
|
||||
public:
|
||||
|
||||
struct chtentries
|
||||
{
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
};
|
||||
struct chtentries {
|
||||
string sGameID;
|
||||
string sGameTitle;
|
||||
string sCheatName[MAXCHEATS];
|
||||
string sCheats[MAXCHEATS];
|
||||
int iCntCheats;
|
||||
};
|
||||
|
||||
//!Constructor
|
||||
GCTCheats(void);
|
||||
//!Destructor
|
||||
~GCTCheats(void);
|
||||
//!Open txt file with cheats
|
||||
//!\param filename name of TXT file
|
||||
//!\return error code
|
||||
int openTxtfile(const char * filename);
|
||||
//!Creates GCT file for one cheat
|
||||
//!\param nr selected Cheat Numbers
|
||||
//!\param filename name of GCT file
|
||||
//!\return error code
|
||||
int createGCT(int nr,const char * filename);
|
||||
//!Creates GCT file from a buffer
|
||||
//!\param chtbuffer buffer that holds the cheat data
|
||||
//!\param filename name of GCT file
|
||||
//!\return error code
|
||||
int createGCT(const char * chtbuffer,const char * filename);
|
||||
//!Creates GCT file
|
||||
//!\param nr[] array of selected Cheat Numbers
|
||||
//!\param cnt size of array
|
||||
//!\param filename name of GCT file
|
||||
//!\return error code
|
||||
int createGCT(int nr[],int cnt,const char * filename);
|
||||
//!Gets Count cheats
|
||||
//!\return Count cheats
|
||||
int getCnt();
|
||||
//!Gets Game Name
|
||||
//!\return Game Name
|
||||
string getGameName(void);
|
||||
//!Gets GameID
|
||||
//!\return GameID
|
||||
string getGameID(void);
|
||||
//!Gets cheat data
|
||||
//!\return cheat data
|
||||
string getCheat(int nr);
|
||||
//!Gets Cheat Name
|
||||
//!\return Cheat Name
|
||||
string getCheatName(int nr);
|
||||
//!Gets Cheat Comment
|
||||
//!\return Cheat Comment
|
||||
string getCheatComment(int nr);
|
||||
//!Gets Cheat List
|
||||
//!\return struct chtentrie
|
||||
//struct chtentrie getCheatList2(void);
|
||||
//!Gets Cheat List
|
||||
//!\return struct chtentries
|
||||
struct chtentries getCheatList(void);
|
||||
//!Gets Cheat List from file
|
||||
//!\param filename name of TXT file
|
||||
//!\return struct chtentries
|
||||
struct chtentries getCheatList(const char * filename);
|
||||
//!Constructor
|
||||
GCTCheats(void);
|
||||
//!Destructor
|
||||
~GCTCheats(void);
|
||||
//!Open txt file with cheats
|
||||
//!\param filename name of TXT file
|
||||
//!\return error code
|
||||
int openTxtfile(const char * filename);
|
||||
//!Creates GCT file for one cheat
|
||||
//!\param nr selected Cheat Numbers
|
||||
//!\param filename name of GCT file
|
||||
//!\return error code
|
||||
int createGCT(int nr,const char * filename);
|
||||
//!Creates GCT file from a buffer
|
||||
//!\param chtbuffer buffer that holds the cheat data
|
||||
//!\param filename name of GCT file
|
||||
//!\return error code
|
||||
int createGCT(const char * chtbuffer,const char * filename);
|
||||
//!Creates GCT file
|
||||
//!\param nr[] array of selected Cheat Numbers
|
||||
//!\param cnt size of array
|
||||
//!\param filename name of GCT file
|
||||
//!\return error code
|
||||
int createGCT(int nr[],int cnt,const char * filename);
|
||||
//!Gets Count cheats
|
||||
//!\return Count cheats
|
||||
int getCnt();
|
||||
//!Gets Game Name
|
||||
//!\return Game Name
|
||||
string getGameName(void);
|
||||
//!Gets GameID
|
||||
//!\return GameID
|
||||
string getGameID(void);
|
||||
//!Gets cheat data
|
||||
//!\return cheat data
|
||||
string getCheat(int nr);
|
||||
//!Gets Cheat Name
|
||||
//!\return Cheat Name
|
||||
string getCheatName(int nr);
|
||||
//!Gets Cheat Comment
|
||||
//!\return Cheat Comment
|
||||
string getCheatComment(int nr);
|
||||
//!Gets Cheat List
|
||||
//!\return struct chtentrie
|
||||
//struct chtentrie getCheatList2(void);
|
||||
//!Gets Cheat List
|
||||
//!\return struct chtentries
|
||||
struct chtentries getCheatList(void);
|
||||
//!Gets Cheat List from file
|
||||
//!\param filename name of TXT file
|
||||
//!\return struct chtentries
|
||||
struct chtentries getCheatList(const char * filename);
|
||||
|
||||
int download_txtcheat(int id);
|
||||
int download_txtcheat(int id);
|
||||
};
|
||||
|
||||
#endif /* _GCT_H */
|
||||
|
@ -12,51 +12,45 @@
|
||||
#define CACHE 8
|
||||
#define SECTORS 64
|
||||
|
||||
int USBDevice_Init()
|
||||
{
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
//right now mounts first FAT-partition
|
||||
if (fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
|
||||
//try first mount with cIOS
|
||||
return 1;
|
||||
int USBDevice_Init() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
//right now mounts first FAT-partition
|
||||
if (fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
|
||||
//try first mount with cIOS
|
||||
return 1;
|
||||
} else if (fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) {
|
||||
//try now mount with libogc
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
//try now mount with libogc
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void USBDevice_deInit()
|
||||
{
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
void USBDevice_deInit() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("USB:/");
|
||||
}
|
||||
|
||||
int isSdInserted()
|
||||
{
|
||||
int isSdInserted() {
|
||||
return __io_wiisd.isInserted();
|
||||
}
|
||||
|
||||
int isInserted(const char *path)
|
||||
{
|
||||
if(!strncmp(path, "USB:", 4))
|
||||
return 1;
|
||||
int isInserted(const char *path) {
|
||||
if (!strncmp(path, "USB:", 4))
|
||||
return 1;
|
||||
|
||||
return __io_wiisd.isInserted();
|
||||
}
|
||||
int SDCard_Init()
|
||||
{
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("SD:/");
|
||||
//right now mounts first FAT-partition
|
||||
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
|
||||
return 1;
|
||||
return -1;
|
||||
int SDCard_Init() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("SD:/");
|
||||
//right now mounts first FAT-partition
|
||||
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void SDCard_deInit()
|
||||
{
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("SD:/");
|
||||
void SDCard_deInit() {
|
||||
//closing all open Files write back the cache and then shutdown em!
|
||||
fatUnmount("SD:/");
|
||||
}
|
||||
|
@ -2,16 +2,15 @@
|
||||
#define _FATMOUNTER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int USBDevice_Init();
|
||||
void USBDevice_deInit();
|
||||
int isSdInserted();
|
||||
int isInserted(const char *path);
|
||||
int SDCard_Init();
|
||||
void SDCard_deInit();
|
||||
int USBDevice_Init();
|
||||
void USBDevice_deInit();
|
||||
int isSdInserted();
|
||||
int isInserted(const char *path);
|
||||
int SDCard_Init();
|
||||
void SDCard_deInit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ int AllocHomebrewMemory(u32 filesize) {
|
||||
|
||||
innetbuffer = malloc(filesize);
|
||||
|
||||
if(!innetbuffer)
|
||||
if (!innetbuffer)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
@ -35,53 +35,51 @@ void CopyHomebrewMemory(u32 read, u8 *temp, u32 len) {
|
||||
|
||||
}
|
||||
|
||||
int BootHomebrew(char * path)
|
||||
{
|
||||
void *buffer = NULL;
|
||||
u32 filesize = 0;
|
||||
entrypoint entry;
|
||||
int BootHomebrew(char * path) {
|
||||
void *buffer = NULL;
|
||||
u32 filesize = 0;
|
||||
entrypoint entry;
|
||||
u32 cpu_isr;
|
||||
|
||||
FILE * file = fopen(path, "rb");
|
||||
if(!file) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
if (!file) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
|
||||
fseek (file, 0, SEEK_END);
|
||||
filesize = ftell(file);
|
||||
rewind(file);
|
||||
filesize = ftell(file);
|
||||
rewind(file);
|
||||
|
||||
buffer = malloc(filesize);
|
||||
buffer = malloc(filesize);
|
||||
|
||||
if(fread (buffer, 1, filesize, file) != filesize)
|
||||
{
|
||||
if (fread (buffer, 1, filesize, file) != filesize) {
|
||||
fclose (file);
|
||||
free(buffer);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
fclose (file);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
fclose (file);
|
||||
|
||||
struct __argv args;
|
||||
bzero(&args, sizeof(args));
|
||||
args.argvMagic = ARGV_MAGIC;
|
||||
args.length = strlen(path) + 2;
|
||||
args.commandLine = (char*)malloc(args.length);
|
||||
if (!args.commandLine) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
strcpy(args.commandLine, path);
|
||||
args.commandLine[args.length - 1] = '\0';
|
||||
args.argc = 1;
|
||||
args.argv = &args.commandLine;
|
||||
args.endARGV = args.argv + 1;
|
||||
struct __argv args;
|
||||
bzero(&args, sizeof(args));
|
||||
args.argvMagic = ARGV_MAGIC;
|
||||
args.length = strlen(path) + 2;
|
||||
args.commandLine = (char*)malloc(args.length);
|
||||
if (!args.commandLine) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
strcpy(args.commandLine, path);
|
||||
args.commandLine[args.length - 1] = '\0';
|
||||
args.argc = 1;
|
||||
args.argv = &args.commandLine;
|
||||
args.endARGV = args.argv + 1;
|
||||
|
||||
int ret = valid_elf_image(buffer);
|
||||
if (ret == 1)
|
||||
entry = (entrypoint) load_elf_image(buffer);
|
||||
else
|
||||
entry = (entrypoint) load_dol(buffer, &args);
|
||||
int ret = valid_elf_image(buffer);
|
||||
if (ret == 1)
|
||||
entry = (entrypoint) load_elf_image(buffer);
|
||||
else
|
||||
entry = (entrypoint) load_dol(buffer, &args);
|
||||
|
||||
free(buffer);
|
||||
|
||||
if(!entry) {
|
||||
if (!entry) {
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
@ -95,36 +93,35 @@ int BootHomebrew(char * path)
|
||||
WPAD_Shutdown();
|
||||
|
||||
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
_CPU_ISR_Disable (cpu_isr);
|
||||
__exception_closeall();
|
||||
entry();
|
||||
_CPU_ISR_Restore (cpu_isr);
|
||||
_CPU_ISR_Disable (cpu_isr);
|
||||
__exception_closeall();
|
||||
entry();
|
||||
_CPU_ISR_Restore (cpu_isr);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BootHomebrewFromMem()
|
||||
{
|
||||
entrypoint entry;
|
||||
int BootHomebrewFromMem() {
|
||||
entrypoint entry;
|
||||
u32 cpu_isr;
|
||||
|
||||
if(!innetbuffer) {
|
||||
if (!innetbuffer) {
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
struct __argv args;
|
||||
struct __argv args;
|
||||
|
||||
int ret = valid_elf_image(innetbuffer);
|
||||
if (ret == 1)
|
||||
entry = (entrypoint) load_elf_image(innetbuffer);
|
||||
else
|
||||
entry = (entrypoint) load_dol(innetbuffer, &args);
|
||||
int ret = valid_elf_image(innetbuffer);
|
||||
if (ret == 1)
|
||||
entry = (entrypoint) load_elf_image(innetbuffer);
|
||||
else
|
||||
entry = (entrypoint) load_dol(innetbuffer, &args);
|
||||
|
||||
free(innetbuffer);
|
||||
|
||||
if(!entry) {
|
||||
if (!entry) {
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
@ -138,10 +135,10 @@ int BootHomebrewFromMem()
|
||||
WPAD_Shutdown();
|
||||
|
||||
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
_CPU_ISR_Disable (cpu_isr);
|
||||
__exception_closeall();
|
||||
entry();
|
||||
_CPU_ISR_Restore (cpu_isr);
|
||||
_CPU_ISR_Disable (cpu_isr);
|
||||
__exception_closeall();
|
||||
entry();
|
||||
_CPU_ISR_Restore (cpu_isr);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,15 +2,14 @@
|
||||
#define _BOOTHOMEBREW_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int BootHomebrew(char * path);
|
||||
int BootHomebrewFromMem();
|
||||
void CopyHomebrewMemory(u32 read, u8 *temp, u32 len);
|
||||
int AllocHomebrewMemory(u32 filesize);
|
||||
void FreeHomebrewBuffer();
|
||||
int BootHomebrew(char * path);
|
||||
int BootHomebrewFromMem();
|
||||
void CopyHomebrewMemory(u32 read, u8 *temp, u32 len);
|
||||
int AllocHomebrewMemory(u32 filesize);
|
||||
void FreeHomebrewBuffer();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,12 +9,11 @@
|
||||
|
||||
#include "HomebrewFiles.h"
|
||||
|
||||
HomebrewFiles::HomebrewFiles(const char * path)
|
||||
{
|
||||
HomebrewFiles::HomebrewFiles(const char * path) {
|
||||
filecount = 0;
|
||||
|
||||
FileInfo = (FileInfos *) malloc(sizeof(FileInfos));
|
||||
if(!FileInfo) {
|
||||
if (!FileInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -24,45 +23,42 @@ HomebrewFiles::HomebrewFiles(const char * path)
|
||||
this->SortList();
|
||||
}
|
||||
|
||||
HomebrewFiles::~HomebrewFiles()
|
||||
{
|
||||
if(FileInfo) {
|
||||
HomebrewFiles::~HomebrewFiles() {
|
||||
if (FileInfo) {
|
||||
free(FileInfo);
|
||||
FileInfo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool HomebrewFiles::LoadPath(const char * folderpath)
|
||||
{
|
||||
bool HomebrewFiles::LoadPath(const char * folderpath) {
|
||||
struct stat st;
|
||||
DIR_ITER *dir = NULL;
|
||||
char filename[1024];
|
||||
|
||||
dir = diropen(folderpath);
|
||||
if(dir == NULL) {
|
||||
if (dir == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (dirnext(dir,filename,&st) == 0)
|
||||
{
|
||||
if((st.st_mode & S_IFDIR) != 0) {
|
||||
if(strcmp(filename,".") != 0 && strcmp(filename,"..") != 0) {
|
||||
while (dirnext(dir,filename,&st) == 0) {
|
||||
if ((st.st_mode & S_IFDIR) != 0) {
|
||||
if (strcmp(filename,".") != 0 && strcmp(filename,"..") != 0) {
|
||||
char currentname[200];
|
||||
snprintf(currentname, sizeof(currentname), "%s%s/", folderpath, filename);
|
||||
this->LoadPath(currentname);
|
||||
}
|
||||
} else {
|
||||
char temp[5];
|
||||
for(int i = 0; i < 5; i++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
temp[i] = filename[strlen(filename)-4+i];
|
||||
}
|
||||
|
||||
if((strncasecmp(temp, ".dol", 4) == 0 || strncasecmp(temp, ".elf", 4) == 0)
|
||||
if ((strncasecmp(temp, ".dol", 4) == 0 || strncasecmp(temp, ".elf", 4) == 0)
|
||||
&& filecount < MAXHOMEBREWS && filename[0]!='.') {
|
||||
|
||||
FileInfo = (FileInfos *) realloc(FileInfo, (filecount+1)*sizeof(FileInfos));
|
||||
|
||||
if(!FileInfo) {
|
||||
if (!FileInfo) {
|
||||
free(FileInfo);
|
||||
FileInfo = NULL;
|
||||
filecount = 0;
|
||||
@ -78,49 +74,43 @@ bool HomebrewFiles::LoadPath(const char * folderpath)
|
||||
filecount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
dirclose(dir);
|
||||
}
|
||||
dirclose(dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
char * HomebrewFiles::GetFilename(int ind)
|
||||
{
|
||||
if(ind > filecount)
|
||||
char * HomebrewFiles::GetFilename(int ind) {
|
||||
if (ind > filecount)
|
||||
return NULL;
|
||||
else
|
||||
return FileInfo[ind].FileName;
|
||||
}
|
||||
|
||||
char * HomebrewFiles::GetFilepath(int ind)
|
||||
{
|
||||
if(ind > filecount)
|
||||
char * HomebrewFiles::GetFilepath(int ind) {
|
||||
if (ind > filecount)
|
||||
return NULL;
|
||||
else
|
||||
return FileInfo[ind].FilePath;
|
||||
}
|
||||
|
||||
unsigned int HomebrewFiles::GetFilesize(int ind)
|
||||
{
|
||||
if(ind > filecount || !filecount || !FileInfo)
|
||||
unsigned int HomebrewFiles::GetFilesize(int ind) {
|
||||
if (ind > filecount || !filecount || !FileInfo)
|
||||
return NULL;
|
||||
else
|
||||
return FileInfo[ind].FileSize;
|
||||
}
|
||||
|
||||
int HomebrewFiles::GetFilecount()
|
||||
{
|
||||
int HomebrewFiles::GetFilecount() {
|
||||
return filecount;
|
||||
}
|
||||
|
||||
static int ListCompare(const void *a, const void *b)
|
||||
{
|
||||
static int ListCompare(const void *a, const void *b) {
|
||||
FileInfos *ab = (FileInfos*) a;
|
||||
FileInfos *bb = (FileInfos*) b;
|
||||
|
||||
return stricmp((char *) ab->FilePath, (char *) bb->FilePath);
|
||||
return stricmp((char *) ab->FilePath, (char *) bb->FilePath);
|
||||
}
|
||||
void HomebrewFiles::SortList()
|
||||
{
|
||||
void HomebrewFiles::SortList() {
|
||||
qsort(FileInfo, filecount, sizeof(FileInfos), ListCompare);
|
||||
}
|
||||
|
@ -13,33 +13,32 @@ typedef struct {
|
||||
unsigned int FileSize;
|
||||
} FileInfos;
|
||||
|
||||
class HomebrewFiles
|
||||
{
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param path Path where to check for homebrew files
|
||||
HomebrewFiles(const char * path);
|
||||
//!Destructor
|
||||
~HomebrewFiles();
|
||||
//! Load the dol/elf list of a path
|
||||
//!\param path Path where to check for homebrew files
|
||||
bool LoadPath(const char * path);
|
||||
//! Get the a filename of the list
|
||||
//!\param list index
|
||||
char * GetFilename(int index);
|
||||
//! Get the a filepath of the list
|
||||
//!\param list index
|
||||
char * GetFilepath(int index);
|
||||
//! Get the a filesize of the list
|
||||
//!\param list index
|
||||
unsigned int GetFilesize(int index);
|
||||
//! Get the filecount of the whole list
|
||||
int GetFilecount();
|
||||
//! Sort list by filepath
|
||||
void SortList();
|
||||
protected:
|
||||
int filecount;
|
||||
FileInfos *FileInfo;
|
||||
class HomebrewFiles {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param path Path where to check for homebrew files
|
||||
HomebrewFiles(const char * path);
|
||||
//!Destructor
|
||||
~HomebrewFiles();
|
||||
//! Load the dol/elf list of a path
|
||||
//!\param path Path where to check for homebrew files
|
||||
bool LoadPath(const char * path);
|
||||
//! Get the a filename of the list
|
||||
//!\param list index
|
||||
char * GetFilename(int index);
|
||||
//! Get the a filepath of the list
|
||||
//!\param list index
|
||||
char * GetFilepath(int index);
|
||||
//! Get the a filesize of the list
|
||||
//!\param list index
|
||||
unsigned int GetFilesize(int index);
|
||||
//! Get the filecount of the whole list
|
||||
int GetFilecount();
|
||||
//! Sort list by filepath
|
||||
void SortList();
|
||||
protected:
|
||||
int filecount;
|
||||
FileInfos *FileInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -9,8 +9,7 @@
|
||||
|
||||
#include "HomebrewXML.h"
|
||||
|
||||
HomebrewXML::HomebrewXML()
|
||||
{
|
||||
HomebrewXML::HomebrewXML() {
|
||||
strcpy(name,"");
|
||||
strcpy(coder,"");
|
||||
strcpy(version,"");
|
||||
@ -19,15 +18,13 @@ HomebrewXML::HomebrewXML()
|
||||
strcpy(longdescription,"");
|
||||
}
|
||||
|
||||
HomebrewXML::~HomebrewXML()
|
||||
{
|
||||
HomebrewXML::~HomebrewXML() {
|
||||
}
|
||||
|
||||
int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
||||
{
|
||||
mxml_node_t *nodedataHB = NULL;
|
||||
mxml_node_t *nodetreeHB = NULL;
|
||||
char tmp1[40];
|
||||
int HomebrewXML::LoadHomebrewXMLData(const char* filename) {
|
||||
mxml_node_t *nodedataHB = NULL;
|
||||
mxml_node_t *nodetreeHB = NULL;
|
||||
char tmp1[40];
|
||||
|
||||
/* Load XML file */
|
||||
FILE *filexml;
|
||||
@ -39,14 +36,14 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
||||
nodetreeHB = mxmlLoadFile(NULL, filexml, MXML_NO_CALLBACK);
|
||||
fclose(filexml);
|
||||
|
||||
if (nodetreeHB == NULL) {
|
||||
return -2;
|
||||
if (nodetreeHB == NULL) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
nodedataHB = mxmlFindElement(nodetreeHB, nodetreeHB, "app", NULL, NULL, MXML_DESCEND);
|
||||
if (nodedataHB == NULL) {
|
||||
return -5;
|
||||
}
|
||||
if (nodedataHB == NULL) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
GetTextFromNode(nodedataHB, nodedataHB, (char*) "name", NULL, NULL, MXML_DESCEND, name,sizeof(name));
|
||||
GetTextFromNode(nodedataHB, nodedataHB, (char*) "coder", NULL, NULL, MXML_DESCEND, coder,sizeof(coder));
|
||||
@ -63,8 +60,8 @@ int HomebrewXML::LoadHomebrewXMLData(const char* filename)
|
||||
snprintf(releasedate, sizeof(releasedate), "%c%c/%c%c%c%c", tmp1[4],tmp1[5],tmp1[0],tmp1[1],tmp1[2],tmp1[3]);
|
||||
else snprintf(releasedate, sizeof(releasedate), "%s", tmp1);
|
||||
|
||||
free(nodedataHB);
|
||||
free(nodetreeHB);
|
||||
free(nodedataHB);
|
||||
free(nodetreeHB);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
@ -5,37 +5,50 @@
|
||||
#ifndef ___HOMEBREWXML_H_
|
||||
#define ___HOMEBREWXML_H_
|
||||
|
||||
class HomebrewXML
|
||||
{
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param path Path for the xml file
|
||||
HomebrewXML();
|
||||
//!Destructor
|
||||
~HomebrewXML();
|
||||
//!\param filename Filepath of the XML file
|
||||
int LoadHomebrewXMLData(const char* filename);
|
||||
//! Get name
|
||||
char * GetName() { return name; }
|
||||
//! Get coder
|
||||
char * GetCoder() { return coder; }
|
||||
//! Get version
|
||||
char * GetVersion() { return version; }
|
||||
//! Get releasedate
|
||||
char * GetReleasedate() { return releasedate; }
|
||||
//! Get shortdescription
|
||||
char * GetShortDescription() { return shortdescription; }
|
||||
//! Get longdescription
|
||||
char * GetLongDescription() { return longdescription; }
|
||||
//! Set Name
|
||||
void SetName(char * path) { strncpy(name, path, sizeof(name)); }
|
||||
protected:
|
||||
char name[50];
|
||||
char coder[100];
|
||||
char version[30];
|
||||
char releasedate[30];
|
||||
char shortdescription[150];
|
||||
char longdescription[500];
|
||||
class HomebrewXML {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param path Path for the xml file
|
||||
HomebrewXML();
|
||||
//!Destructor
|
||||
~HomebrewXML();
|
||||
//!\param filename Filepath of the XML file
|
||||
int LoadHomebrewXMLData(const char* filename);
|
||||
//! Get name
|
||||
char * GetName() {
|
||||
return name;
|
||||
}
|
||||
//! Get coder
|
||||
char * GetCoder() {
|
||||
return coder;
|
||||
}
|
||||
//! Get version
|
||||
char * GetVersion() {
|
||||
return version;
|
||||
}
|
||||
//! Get releasedate
|
||||
char * GetReleasedate() {
|
||||
return releasedate;
|
||||
}
|
||||
//! Get shortdescription
|
||||
char * GetShortDescription() {
|
||||
return shortdescription;
|
||||
}
|
||||
//! Get longdescription
|
||||
char * GetLongDescription() {
|
||||
return longdescription;
|
||||
}
|
||||
//! Set Name
|
||||
void SetName(char * path) {
|
||||
strncpy(name, path, sizeof(name));
|
||||
}
|
||||
protected:
|
||||
char name[50];
|
||||
char coder[100];
|
||||
char version[30];
|
||||
char releasedate[30];
|
||||
char shortdescription[150];
|
||||
char longdescription[500];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -9,47 +9,47 @@
|
||||
#include "dolloader.h"
|
||||
|
||||
typedef struct _dolheader {
|
||||
u32 text_pos[7];
|
||||
u32 data_pos[11];
|
||||
u32 text_start[7];
|
||||
u32 data_start[11];
|
||||
u32 text_size[7];
|
||||
u32 data_size[11];
|
||||
u32 bss_start;
|
||||
u32 bss_size;
|
||||
u32 entry_point;
|
||||
u32 text_pos[7];
|
||||
u32 data_pos[11];
|
||||
u32 text_start[7];
|
||||
u32 data_start[11];
|
||||
u32 text_size[7];
|
||||
u32 data_size[11];
|
||||
u32 bss_start;
|
||||
u32 bss_size;
|
||||
u32 entry_point;
|
||||
} dolheader;
|
||||
|
||||
u32 load_dol(void *dolstart, struct __argv *argv) {
|
||||
u32 i;
|
||||
dolheader *dolfile;
|
||||
u32 i;
|
||||
dolheader *dolfile;
|
||||
|
||||
if (dolstart) {
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for (i = 0; i < 7; i++) {
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
ICInvalidateRange ((void *) dolfile->text_start[i],dolfile->text_size[i]);
|
||||
memmove ((void *) dolfile->text_start[i],dolstart+dolfile->text_pos[i],dolfile->text_size[i]);
|
||||
}
|
||||
if (dolstart) {
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for (i = 0; i < 7; i++) {
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
ICInvalidateRange ((void *) dolfile->text_start[i],dolfile->text_size[i]);
|
||||
memmove ((void *) dolfile->text_start[i],dolstart+dolfile->text_pos[i],dolfile->text_size[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < 11; i++) {
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
memmove ((void *) dolfile->data_start[i],dolstart+dolfile->data_pos[i],dolfile->data_size[i]);
|
||||
DCFlushRangeNoSync ((void *) dolfile->data_start[i],dolfile->data_size[i]);
|
||||
}
|
||||
for (i = 0; i < 11; i++) {
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
memmove ((void *) dolfile->data_start[i],dolstart+dolfile->data_pos[i],dolfile->data_size[i]);
|
||||
DCFlushRangeNoSync ((void *) dolfile->data_start[i],dolfile->data_size[i]);
|
||||
}
|
||||
|
||||
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||
|
||||
if (argv && argv->argvMagic == ARGV_MAGIC) {
|
||||
void *new_argv = (void *)(dolfile->entry_point + 8);
|
||||
memmove(new_argv, argv, sizeof(*argv));
|
||||
DCFlushRange(new_argv, sizeof(*argv));
|
||||
}
|
||||
if (argv && argv->argvMagic == ARGV_MAGIC) {
|
||||
void *new_argv = (void *)(dolfile->entry_point + 8);
|
||||
memmove(new_argv, argv, sizeof(*argv));
|
||||
DCFlushRange(new_argv, sizeof(*argv));
|
||||
}
|
||||
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
return 0;
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,14 +2,13 @@
|
||||
#define _DOLLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void __exception_closeall();
|
||||
typedef void (*entrypoint) (void);
|
||||
extern void __exception_closeall();
|
||||
typedef void (*entrypoint) (void);
|
||||
|
||||
u32 load_dol(void *dolstart, struct __argv *argv);
|
||||
u32 load_dol(void *dolstart, struct __argv *argv);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -105,21 +105,21 @@ typedef u16 Elf32_Half; /* Unsigned medium integer */
|
||||
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
|
||||
|
||||
/* ELF Header */
|
||||
typedef struct elfhdr{
|
||||
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
|
||||
Elf32_Half e_type; /* object file type */
|
||||
Elf32_Half e_machine; /* machine */
|
||||
Elf32_Word e_version; /* object file version */
|
||||
Elf32_Addr e_entry; /* virtual entry point */
|
||||
Elf32_Off e_phoff; /* program header table offset */
|
||||
Elf32_Off e_shoff; /* section header table offset */
|
||||
Elf32_Word e_flags; /* processor-specific flags */
|
||||
Elf32_Half e_ehsize; /* ELF header size */
|
||||
Elf32_Half e_phentsize; /* program header entry size */
|
||||
Elf32_Half e_phnum; /* number of program header entries */
|
||||
Elf32_Half e_shentsize; /* section header entry size */
|
||||
Elf32_Half e_shnum; /* number of section header entries */
|
||||
Elf32_Half e_shstrndx; /* section header table's "section
|
||||
typedef struct elfhdr {
|
||||
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
|
||||
Elf32_Half e_type; /* object file type */
|
||||
Elf32_Half e_machine; /* machine */
|
||||
Elf32_Word e_version; /* object file version */
|
||||
Elf32_Addr e_entry; /* virtual entry point */
|
||||
Elf32_Off e_phoff; /* program header table offset */
|
||||
Elf32_Off e_shoff; /* section header table offset */
|
||||
Elf32_Word e_flags; /* processor-specific flags */
|
||||
Elf32_Half e_ehsize; /* ELF header size */
|
||||
Elf32_Half e_phentsize; /* program header entry size */
|
||||
Elf32_Half e_phnum; /* number of program header entries */
|
||||
Elf32_Half e_shentsize; /* section header entry size */
|
||||
Elf32_Half e_shnum; /* number of section header entries */
|
||||
Elf32_Half e_shstrndx; /* section header table's "section
|
||||
header string table" entry offset */
|
||||
} Elf32_Ehdr;
|
||||
|
||||
@ -151,7 +151,7 @@ typedef struct elfhdr{
|
||||
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
|
||||
#if 0
|
||||
#define EM_SPARC64 11 /* RESERVED - was SPARC v9
|
||||
64-bit unoffical */
|
||||
64-bit unoffical */
|
||||
#endif
|
||||
/* RESERVED 11-14 for future use */
|
||||
#define EM_PARISC 15 /* HPPA */
|
||||
@ -227,17 +227,17 @@ typedef struct elfhdr{
|
||||
|
||||
/* Section Header */
|
||||
typedef struct {
|
||||
Elf32_Word sh_name; /* name - index into section header
|
||||
Elf32_Word sh_name; /* name - index into section header
|
||||
string table section */
|
||||
Elf32_Word sh_type; /* type */
|
||||
Elf32_Word sh_flags; /* flags */
|
||||
Elf32_Addr sh_addr; /* address */
|
||||
Elf32_Off sh_offset; /* file offset */
|
||||
Elf32_Word sh_size; /* section size */
|
||||
Elf32_Word sh_link; /* section header table index link */
|
||||
Elf32_Word sh_info; /* extra information */
|
||||
Elf32_Word sh_addralign; /* address alignment */
|
||||
Elf32_Word sh_entsize; /* section entry size */
|
||||
Elf32_Word sh_type; /* type */
|
||||
Elf32_Word sh_flags; /* flags */
|
||||
Elf32_Addr sh_addr; /* address */
|
||||
Elf32_Off sh_offset; /* file offset */
|
||||
Elf32_Word sh_size; /* section size */
|
||||
Elf32_Word sh_link; /* section header table index link */
|
||||
Elf32_Word sh_info; /* extra information */
|
||||
Elf32_Word sh_addralign; /* address alignment */
|
||||
Elf32_Word sh_entsize; /* section entry size */
|
||||
} Elf32_Shdr;
|
||||
|
||||
/* Special Section Indexes */
|
||||
@ -328,7 +328,7 @@ typedef struct {
|
||||
#define SHF_TLS 0x400 /* Thread local storage */
|
||||
#define SHF_MASKOS 0x0ff00000 /* OS specific */
|
||||
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
|
||||
/* specific section attributes */
|
||||
/* specific section attributes */
|
||||
|
||||
/* Section Group Flags */
|
||||
#define GRP_COMDAT 0x1 /* COMDAT group */
|
||||
@ -337,12 +337,12 @@ typedef struct {
|
||||
|
||||
/* Symbol Table Entry */
|
||||
typedef struct elf32_sym {
|
||||
Elf32_Word st_name; /* name - index into string table */
|
||||
Elf32_Addr st_value; /* symbol value */
|
||||
Elf32_Word st_size; /* symbol size */
|
||||
unsigned char st_info; /* type and binding */
|
||||
unsigned char st_other; /* 0 - no defined meaning */
|
||||
Elf32_Half st_shndx; /* section header index */
|
||||
Elf32_Word st_name; /* name - index into string table */
|
||||
Elf32_Addr st_value; /* symbol value */
|
||||
Elf32_Word st_size; /* symbol size */
|
||||
unsigned char st_info; /* type and binding */
|
||||
unsigned char st_other; /* 0 - no defined meaning */
|
||||
Elf32_Half st_shndx; /* section header index */
|
||||
} Elf32_Sym;
|
||||
|
||||
/* Symbol table index */
|
||||
@ -385,18 +385,16 @@ typedef struct elf32_sym {
|
||||
|
||||
|
||||
/* Relocation entry with implicit addend */
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Addr r_offset; /* offset of relocation */
|
||||
Elf32_Word r_info; /* symbol table index and type */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* offset of relocation */
|
||||
Elf32_Word r_info; /* symbol table index and type */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocation entry with explicit addend */
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Addr r_offset; /* offset of relocation */
|
||||
Elf32_Word r_info; /* symbol table index and type */
|
||||
Elf32_Sword r_addend;
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* offset of relocation */
|
||||
Elf32_Word r_info; /* symbol table index and type */
|
||||
Elf32_Sword r_addend;
|
||||
} Elf32_Rela;
|
||||
|
||||
/* Extract relocation info - r_info */
|
||||
@ -406,14 +404,14 @@ typedef struct
|
||||
|
||||
/* Program Header */
|
||||
typedef struct {
|
||||
Elf32_Word p_type; /* segment type */
|
||||
Elf32_Off p_offset; /* segment offset */
|
||||
Elf32_Addr p_vaddr; /* virtual address of segment */
|
||||
Elf32_Addr p_paddr; /* physical address - ignored? */
|
||||
Elf32_Word p_filesz; /* number of bytes in file for seg. */
|
||||
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
|
||||
Elf32_Word p_flags; /* flags */
|
||||
Elf32_Word p_align; /* memory alignment */
|
||||
Elf32_Word p_type; /* segment type */
|
||||
Elf32_Off p_offset; /* segment offset */
|
||||
Elf32_Addr p_vaddr; /* virtual address of segment */
|
||||
Elf32_Addr p_paddr; /* physical address - ignored? */
|
||||
Elf32_Word p_filesz; /* number of bytes in file for seg. */
|
||||
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
|
||||
Elf32_Word p_flags; /* flags */
|
||||
Elf32_Word p_align; /* memory alignment */
|
||||
} Elf32_Phdr;
|
||||
|
||||
/* Segment types - p_type */
|
||||
@ -437,16 +435,14 @@ typedef struct {
|
||||
#define PF_R 0x4 /* Readable */
|
||||
#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */
|
||||
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
|
||||
/* specific segment flags */
|
||||
/* specific segment flags */
|
||||
/* Dynamic structure */
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Sword d_tag; /* controls meaning of d_val */
|
||||
union
|
||||
{
|
||||
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
||||
Elf32_Addr d_ptr; /* program virtual address */
|
||||
} d_un;
|
||||
typedef struct {
|
||||
Elf32_Sword d_tag; /* controls meaning of d_val */
|
||||
union {
|
||||
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
||||
Elf32_Addr d_ptr; /* program virtual address */
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
extern Elf32_Dyn _DYNAMIC[];
|
||||
@ -468,7 +464,7 @@ extern Elf32_Dyn _DYNAMIC[];
|
||||
#define DT_FINI 13 /* address of termination function */
|
||||
#define DT_SONAME 14 /* string table offset of shared obj */
|
||||
#define DT_RPATH 15 /* string table offset of library
|
||||
search path */
|
||||
search path */
|
||||
#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
|
||||
#define DT_REL 17 /* address of rel. tbl. w addends */
|
||||
#define DT_RELSZ 18 /* size of DT_REL relocation table */
|
||||
@ -516,7 +512,7 @@ unsigned long elf_hash(const unsigned char *name);
|
||||
/* Cygnus local bits below */
|
||||
#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
|
||||
#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
|
||||
flag */
|
||||
flag */
|
||||
|
||||
/* PowerPC relocations defined by the ABIs */
|
||||
#define R_PPC_NONE 0
|
||||
|
@ -26,22 +26,21 @@
|
||||
* First looks at the ELF header magic field, the makes sure that it is
|
||||
* executable and makes sure that it is for a PowerPC.
|
||||
* ====================================================================== */
|
||||
s32 valid_elf_image (void *addr)
|
||||
{
|
||||
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
||||
s32 valid_elf_image (void *addr) {
|
||||
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
|
||||
|
||||
ehdr = (Elf32_Ehdr *) addr;
|
||||
ehdr = (Elf32_Ehdr *) addr;
|
||||
|
||||
if (!IS_ELF (*ehdr))
|
||||
return 0;
|
||||
if (!IS_ELF (*ehdr))
|
||||
return 0;
|
||||
|
||||
if (ehdr->e_type != ET_EXEC)
|
||||
return -1;
|
||||
if (ehdr->e_type != ET_EXEC)
|
||||
return -1;
|
||||
|
||||
if (ehdr->e_machine != EM_PPC)
|
||||
return -1;
|
||||
if (ehdr->e_machine != EM_PPC)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -49,55 +48,54 @@ s32 valid_elf_image (void *addr)
|
||||
* A very simple elf loader, assumes the image is valid, returns the
|
||||
* entry point address.
|
||||
* ====================================================================== */
|
||||
u32 load_elf_image (void *addr)
|
||||
{
|
||||
Elf32_Ehdr *ehdr;
|
||||
Elf32_Shdr *shdr;
|
||||
u8 *strtab = 0;
|
||||
u8 *image;
|
||||
int i;
|
||||
u32 load_elf_image (void *addr) {
|
||||
Elf32_Ehdr *ehdr;
|
||||
Elf32_Shdr *shdr;
|
||||
u8 *strtab = 0;
|
||||
u8 *image;
|
||||
int i;
|
||||
|
||||
ehdr = (Elf32_Ehdr *) addr;
|
||||
/* Find the section header string table for output info */
|
||||
ehdr = (Elf32_Ehdr *) addr;
|
||||
/* Find the section header string table for output info */
|
||||
shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff +
|
||||
(ehdr->e_shstrndx * sizeof (Elf32_Shdr)));
|
||||
|
||||
if (shdr->sh_type == SHT_STRTAB)
|
||||
strtab = (u8 *) (addr + shdr->sh_offset);
|
||||
|
||||
/* Load each appropriate section */
|
||||
for (i = 0; i < ehdr->e_shnum; ++i) {
|
||||
shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff +
|
||||
(ehdr->e_shstrndx * sizeof (Elf32_Shdr)));
|
||||
(i * sizeof (Elf32_Shdr)));
|
||||
|
||||
if (shdr->sh_type == SHT_STRTAB)
|
||||
strtab = (u8 *) (addr + shdr->sh_offset);
|
||||
|
||||
/* Load each appropriate section */
|
||||
for (i = 0; i < ehdr->e_shnum; ++i) {
|
||||
shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff +
|
||||
(i * sizeof (Elf32_Shdr)));
|
||||
|
||||
if (!(shdr->sh_flags & SHF_ALLOC)
|
||||
|| shdr->sh_addr == 0 || shdr->sh_size == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
shdr->sh_addr &= 0x3FFFFFFF;
|
||||
shdr->sh_addr |= 0x80000000;
|
||||
|
||||
if (strtab) {
|
||||
/*printf ("%sing section %s @ 0x%08x (0x%08x bytes)\n",
|
||||
(shdr->sh_type == SHT_NOBITS) ?
|
||||
"clear" : "load",
|
||||
&strtab[shdr->sh_name],
|
||||
(u32) shdr->sh_addr,
|
||||
(u32) shdr->sh_size);*/
|
||||
}
|
||||
|
||||
if (shdr->sh_type == SHT_NOBITS) {
|
||||
memset ((void *) shdr->sh_addr, 0, shdr->sh_size);
|
||||
} else {
|
||||
image = (u8 *) addr + shdr->sh_offset;
|
||||
memcpy ((void *) shdr->sh_addr,
|
||||
(const void *) image,
|
||||
shdr->sh_size);
|
||||
}
|
||||
DCFlushRangeNoSync ((void *) shdr->sh_addr, shdr->sh_size);
|
||||
if (!(shdr->sh_flags & SHF_ALLOC)
|
||||
|| shdr->sh_addr == 0 || shdr->sh_size == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return (ehdr->e_entry & 0x3FFFFFFF) | 0x80000000;
|
||||
shdr->sh_addr &= 0x3FFFFFFF;
|
||||
shdr->sh_addr |= 0x80000000;
|
||||
|
||||
if (strtab) {
|
||||
/*printf ("%sing section %s @ 0x%08x (0x%08x bytes)\n",
|
||||
(shdr->sh_type == SHT_NOBITS) ?
|
||||
"clear" : "load",
|
||||
&strtab[shdr->sh_name],
|
||||
(u32) shdr->sh_addr,
|
||||
(u32) shdr->sh_size);*/
|
||||
}
|
||||
|
||||
if (shdr->sh_type == SHT_NOBITS) {
|
||||
memset ((void *) shdr->sh_addr, 0, shdr->sh_size);
|
||||
} else {
|
||||
image = (u8 *) addr + shdr->sh_offset;
|
||||
memcpy ((void *) shdr->sh_addr,
|
||||
(const void *) image,
|
||||
shdr->sh_size);
|
||||
}
|
||||
DCFlushRangeNoSync ((void *) shdr->sh_addr, shdr->sh_size);
|
||||
}
|
||||
|
||||
return (ehdr->e_entry & 0x3FFFFFFF) | 0x80000000;
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,11 @@
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
s32 valid_elf_image (void *addr);
|
||||
u32 load_elf_image (void *addr);
|
||||
s32 valid_elf_image (void *addr);
|
||||
u32 load_elf_image (void *addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
116
source/input.cpp
116
source/input.cpp
@ -28,88 +28,74 @@ static int rumbleCount[4] = {0,0,0,0};
|
||||
* ShutoffRumble
|
||||
***************************************************************************/
|
||||
|
||||
void ShutoffRumble()
|
||||
{
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
WPAD_Rumble(i, 0);
|
||||
rumbleCount[i] = 0;
|
||||
}
|
||||
void ShutoffRumble() {
|
||||
for (int i=0;i<4;i++) {
|
||||
WPAD_Rumble(i, 0);
|
||||
rumbleCount[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* DoRumble
|
||||
***************************************************************************/
|
||||
|
||||
void DoRumble(int i)
|
||||
{
|
||||
if(rumbleRequest[i] && rumbleCount[i] < 3)
|
||||
{
|
||||
WPAD_Rumble(i, 1); // rumble on
|
||||
rumbleCount[i]++;
|
||||
}
|
||||
else if(rumbleRequest[i])
|
||||
{
|
||||
rumbleCount[i] = 20;
|
||||
rumbleRequest[i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rumbleCount[i])
|
||||
rumbleCount[i]--;
|
||||
WPAD_Rumble(i, 0); // rumble off
|
||||
}
|
||||
void DoRumble(int i) {
|
||||
if (rumbleRequest[i] && rumbleCount[i] < 3) {
|
||||
WPAD_Rumble(i, 1); // rumble on
|
||||
rumbleCount[i]++;
|
||||
} else if (rumbleRequest[i]) {
|
||||
rumbleCount[i] = 20;
|
||||
rumbleRequest[i] = 0;
|
||||
} else {
|
||||
if (rumbleCount[i])
|
||||
rumbleCount[i]--;
|
||||
WPAD_Rumble(i, 0); // rumble off
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* WPAD_Stick
|
||||
*
|
||||
* Get X/Y value from Wii Joystick (classic, nunchuk) input
|
||||
* Get X/Y value from Wii Joystick (classic, nunchuk) input
|
||||
***************************************************************************/
|
||||
|
||||
s8 WPAD_Stick(u8 chan, u8 right, int axis)
|
||||
{
|
||||
float mag = 0.0;
|
||||
float ang = 0.0;
|
||||
WPADData *data = WPAD_Data(chan);
|
||||
s8 WPAD_Stick(u8 chan, u8 right, int axis) {
|
||||
float mag = 0.0;
|
||||
float ang = 0.0;
|
||||
WPADData *data = WPAD_Data(chan);
|
||||
|
||||
switch (data->exp.type)
|
||||
{
|
||||
case WPAD_EXP_NUNCHUK:
|
||||
case WPAD_EXP_GUITARHERO3:
|
||||
if (right == 0)
|
||||
{
|
||||
mag = data->exp.nunchuk.js.mag;
|
||||
ang = data->exp.nunchuk.js.ang;
|
||||
}
|
||||
break;
|
||||
switch (data->exp.type) {
|
||||
case WPAD_EXP_NUNCHUK:
|
||||
case WPAD_EXP_GUITARHERO3:
|
||||
if (right == 0) {
|
||||
mag = data->exp.nunchuk.js.mag;
|
||||
ang = data->exp.nunchuk.js.ang;
|
||||
}
|
||||
break;
|
||||
|
||||
case WPAD_EXP_CLASSIC:
|
||||
if (right == 0)
|
||||
{
|
||||
mag = data->exp.classic.ljs.mag;
|
||||
ang = data->exp.classic.ljs.ang;
|
||||
}
|
||||
else
|
||||
{
|
||||
mag = data->exp.classic.rjs.mag;
|
||||
ang = data->exp.classic.rjs.ang;
|
||||
}
|
||||
break;
|
||||
case WPAD_EXP_CLASSIC:
|
||||
if (right == 0) {
|
||||
mag = data->exp.classic.ljs.mag;
|
||||
ang = data->exp.classic.ljs.ang;
|
||||
} else {
|
||||
mag = data->exp.classic.rjs.mag;
|
||||
ang = data->exp.classic.rjs.ang;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* calculate x/y value (angle need to be converted into radian) */
|
||||
if (mag > 1.0) mag = 1.0;
|
||||
else if (mag < -1.0) mag = -1.0;
|
||||
double val;
|
||||
/* calculate x/y value (angle need to be converted into radian) */
|
||||
if (mag > 1.0) mag = 1.0;
|
||||
else if (mag < -1.0) mag = -1.0;
|
||||
double val;
|
||||
|
||||
if(axis == 0) // x-axis
|
||||
val = mag * sin((PI * ang)/180.0f);
|
||||
else // y-axis
|
||||
val = mag * cos((PI * ang)/180.0f);
|
||||
if (axis == 0) // x-axis
|
||||
val = mag * sin((PI * ang)/180.0f);
|
||||
else // y-axis
|
||||
val = mag * cos((PI * ang)/180.0f);
|
||||
|
||||
return (s8)(val * 128.0f);
|
||||
return (s8)(val * 128.0f);
|
||||
}
|
||||
|
@ -13,57 +13,54 @@
|
||||
#include "network/networkops.h"
|
||||
#include "network/http.h"
|
||||
|
||||
int updateLanguageFiles()
|
||||
{
|
||||
char languageFiles[20][MAXLANGUAGEFILES];
|
||||
|
||||
//get all the files in the language path
|
||||
int countfiles = GetAllDirFiles(Settings.languagefiles_path);
|
||||
|
||||
//give up now if we didn't find any
|
||||
if(countfiles==0)return -2;
|
||||
|
||||
//now from the files we got, get only the .lang files
|
||||
for (int cnt = 0; cnt < countfiles; cnt++) {
|
||||
char filename[64];
|
||||
strncpy(filename, GetFileName(cnt),63);
|
||||
if (strcasestr(filename,".lang"))
|
||||
{
|
||||
strcpy(languageFiles[cnt],filename);
|
||||
}
|
||||
}
|
||||
|
||||
//we assume that the network will already be init by another function
|
||||
// ( that has gui eletents in it because this one doesn't)
|
||||
int done =0,j=0;
|
||||
if(IsNetworkInit()) {
|
||||
//build the URL, save path, and download each file and save it
|
||||
while (j<countfiles)
|
||||
{
|
||||
char savepath[150];
|
||||
char codeurl[200];
|
||||
snprintf(codeurl, sizeof(codeurl), "http://usbloader-gui.googlecode.com/svn/trunk/Languages/%s",languageFiles[j]);
|
||||
snprintf(savepath, sizeof(savepath), "%s%s",Settings.languagefiles_path,languageFiles[j]);
|
||||
int updateLanguageFiles() {
|
||||
char languageFiles[20][MAXLANGUAGEFILES];
|
||||
|
||||
struct block file = downloadfile(codeurl);
|
||||
//get all the files in the language path
|
||||
int countfiles = GetAllDirFiles(Settings.languagefiles_path);
|
||||
|
||||
if(file.data != NULL){
|
||||
FILE * pfile;
|
||||
pfile = fopen(savepath, "wb");
|
||||
fwrite(file.data,1,file.size,pfile);
|
||||
fclose(pfile);
|
||||
free(file.data);
|
||||
done++;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
//give up now if we didn't find any
|
||||
if (countfiles==0)return -2;
|
||||
|
||||
}
|
||||
//if there was no network init
|
||||
else return -1;
|
||||
//now from the files we got, get only the .lang files
|
||||
for (int cnt = 0; cnt < countfiles; cnt++) {
|
||||
char filename[64];
|
||||
strncpy(filename, GetFileName(cnt),63);
|
||||
if (strcasestr(filename,".lang")) {
|
||||
strcpy(languageFiles[cnt],filename);
|
||||
}
|
||||
}
|
||||
|
||||
// return the number of files we updated
|
||||
//we assume that the network will already be init by another function
|
||||
// ( that has gui eletents in it because this one doesn't)
|
||||
int done =0,j=0;
|
||||
if (IsNetworkInit()) {
|
||||
//build the URL, save path, and download each file and save it
|
||||
while (j<countfiles) {
|
||||
char savepath[150];
|
||||
char codeurl[200];
|
||||
snprintf(codeurl, sizeof(codeurl), "http://usbloader-gui.googlecode.com/svn/trunk/Languages/%s",languageFiles[j]);
|
||||
snprintf(savepath, sizeof(savepath), "%s%s",Settings.languagefiles_path,languageFiles[j]);
|
||||
|
||||
struct block file = downloadfile(codeurl);
|
||||
|
||||
if (file.data != NULL) {
|
||||
FILE * pfile;
|
||||
pfile = fopen(savepath, "wb");
|
||||
fwrite(file.data,1,file.size,pfile);
|
||||
fclose(pfile);
|
||||
free(file.data);
|
||||
done++;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
}
|
||||
//if there was no network init
|
||||
else return -1;
|
||||
|
||||
// return the number of files we updated
|
||||
return done;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
//! Checks the language path for files ending in .lang and updates them (up to MAXLANGUAGEFILES)
|
||||
//! This function expects that the network is already init before it is called
|
||||
|
||||
//! returns the number of files successfully updated
|
||||
//! returns the number of files successfully updated
|
||||
//! returns -2 if it can't find any .lang files in the path
|
||||
//! return -1 if there is no network connection
|
||||
int updateLanguageFiles();
|
||||
|
@ -4,11 +4,10 @@
|
||||
#include <gctypes.h>
|
||||
#include "gettext.h"
|
||||
|
||||
typedef struct _MSG
|
||||
{
|
||||
u32 id;
|
||||
char* msgstr;
|
||||
struct _MSG *next;
|
||||
typedef struct _MSG {
|
||||
u32 id;
|
||||
char* msgstr;
|
||||
struct _MSG *next;
|
||||
} MSG;
|
||||
static MSG *baseMSG=0;
|
||||
|
||||
@ -19,222 +18,205 @@ static MSG *baseMSG=0;
|
||||
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
|
||||
1986, 1987 Bell Telephone Laboratories, Inc.] */
|
||||
static inline u32
|
||||
hash_string (const char *str_param)
|
||||
{
|
||||
u32 hval, g;
|
||||
const char *str = str_param;
|
||||
hash_string (const char *str_param) {
|
||||
u32 hval, g;
|
||||
const char *str = str_param;
|
||||
|
||||
/* Compute the hash value for the given string. */
|
||||
hval = 0;
|
||||
while (*str != '\0')
|
||||
{
|
||||
hval <<= 4;
|
||||
hval += (u8) *str++;
|
||||
g = hval & ((u32) 0xf << (HASHWORDBITS - 4));
|
||||
if (g != 0)
|
||||
{
|
||||
hval ^= g >> (HASHWORDBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
/* Compute the hash value for the given string. */
|
||||
hval = 0;
|
||||
while (*str != '\0') {
|
||||
hval <<= 4;
|
||||
hval += (u8) *str++;
|
||||
g = hval & ((u32) 0xf << (HASHWORDBITS - 4));
|
||||
if (g != 0) {
|
||||
hval ^= g >> (HASHWORDBITS - 8);
|
||||
hval ^= g;
|
||||
}
|
||||
}
|
||||
return hval;
|
||||
return hval;
|
||||
}
|
||||
|
||||
/* Expand some escape sequences found in the argument string. */
|
||||
static char *
|
||||
expand_escape (const char *str)
|
||||
{
|
||||
char *retval, *rp;
|
||||
const char *cp = str;
|
||||
expand_escape (const char *str) {
|
||||
char *retval, *rp;
|
||||
const char *cp = str;
|
||||
|
||||
retval = (char *) malloc (strlen (str)+1);
|
||||
if(retval==NULL) return NULL;
|
||||
rp = retval;
|
||||
retval = (char *) malloc (strlen (str)+1);
|
||||
if (retval==NULL) return NULL;
|
||||
rp = retval;
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '\\')
|
||||
*rp++ = *cp++;
|
||||
if(cp[0] == '\0')
|
||||
goto terminate;
|
||||
do
|
||||
{
|
||||
|
||||
/* Here cp[0] == '\\'. */
|
||||
switch (*++cp)
|
||||
{
|
||||
case '\"': /* " */
|
||||
*rp++ = '\"';
|
||||
++cp;
|
||||
break;
|
||||
case 'a': /* alert */
|
||||
*rp++ = '\a';
|
||||
++cp;
|
||||
break;
|
||||
case 'b': /* backspace */
|
||||
*rp++ = '\b';
|
||||
++cp;
|
||||
break;
|
||||
case 'f': /* form feed */
|
||||
*rp++ = '\f';
|
||||
++cp;
|
||||
break;
|
||||
case 'n': /* new line */
|
||||
*rp++ = '\n';
|
||||
++cp;
|
||||
break;
|
||||
case 'r': /* carriage return */
|
||||
*rp++ = '\r';
|
||||
++cp;
|
||||
break;
|
||||
case 't': /* horizontal tab */
|
||||
*rp++ = '\t';
|
||||
++cp;
|
||||
break;
|
||||
case 'v': /* vertical tab */
|
||||
*rp++ = '\v';
|
||||
++cp;
|
||||
break;
|
||||
case '\\':
|
||||
*rp = '\\';
|
||||
++cp;
|
||||
break;
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
{
|
||||
int ch = *cp++ - '0';
|
||||
while (cp[0] != '\0' && cp[0] != '\\')
|
||||
*rp++ = *cp++;
|
||||
if (cp[0] == '\0')
|
||||
goto terminate;
|
||||
do {
|
||||
|
||||
if (*cp >= '0' && *cp <= '7')
|
||||
{
|
||||
ch *= 8;
|
||||
ch += *cp++ - '0';
|
||||
/* Here cp[0] == '\\'. */
|
||||
switch (*++cp) {
|
||||
case '\"': /* " */
|
||||
*rp++ = '\"';
|
||||
++cp;
|
||||
break;
|
||||
case 'a': /* alert */
|
||||
*rp++ = '\a';
|
||||
++cp;
|
||||
break;
|
||||
case 'b': /* backspace */
|
||||
*rp++ = '\b';
|
||||
++cp;
|
||||
break;
|
||||
case 'f': /* form feed */
|
||||
*rp++ = '\f';
|
||||
++cp;
|
||||
break;
|
||||
case 'n': /* new line */
|
||||
*rp++ = '\n';
|
||||
++cp;
|
||||
break;
|
||||
case 'r': /* carriage return */
|
||||
*rp++ = '\r';
|
||||
++cp;
|
||||
break;
|
||||
case 't': /* horizontal tab */
|
||||
*rp++ = '\t';
|
||||
++cp;
|
||||
break;
|
||||
case 'v': /* vertical tab */
|
||||
*rp++ = '\v';
|
||||
++cp;
|
||||
break;
|
||||
case '\\':
|
||||
*rp = '\\';
|
||||
++cp;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7': {
|
||||
int ch = *cp++ - '0';
|
||||
|
||||
if (*cp >= '0' && *cp <= '7')
|
||||
{
|
||||
ch *= 8;
|
||||
ch += *cp++ - '0';
|
||||
}
|
||||
}
|
||||
*rp = ch;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*rp = '\\';
|
||||
break;
|
||||
}
|
||||
if (*cp >= '0' && *cp <= '7') {
|
||||
ch *= 8;
|
||||
ch += *cp++ - '0';
|
||||
|
||||
while (cp[0] != '\0' && cp[0] != '\\')
|
||||
*rp++ = *cp++;
|
||||
}
|
||||
while (cp[0] != '\0');
|
||||
if (*cp >= '0' && *cp <= '7') {
|
||||
ch *= 8;
|
||||
ch += *cp++ - '0';
|
||||
}
|
||||
}
|
||||
*rp = ch;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*rp = '\\';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Terminate string. */
|
||||
while (cp[0] != '\0' && cp[0] != '\\')
|
||||
*rp++ = *cp++;
|
||||
} while (cp[0] != '\0');
|
||||
|
||||
/* Terminate string. */
|
||||
terminate:
|
||||
*rp = '\0';
|
||||
return retval;
|
||||
*rp = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
static MSG *findMSG(u32 id)
|
||||
{
|
||||
MSG *msg;
|
||||
for(msg=baseMSG; msg; msg=msg->next)
|
||||
{
|
||||
if(msg->id == id)
|
||||
return msg;
|
||||
}
|
||||
return NULL;
|
||||
static MSG *findMSG(u32 id) {
|
||||
MSG *msg;
|
||||
for (msg=baseMSG; msg; msg=msg->next) {
|
||||
if (msg->id == id)
|
||||
return msg;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static MSG *setMSG(const char *msgid, const char *msgstr)
|
||||
{
|
||||
u32 id = hash_string(msgid);
|
||||
MSG *msg = findMSG(id);
|
||||
if(!msg)
|
||||
{
|
||||
msg = (MSG *)malloc(sizeof(MSG));
|
||||
msg->id = id;
|
||||
msg->msgstr = NULL;
|
||||
msg->next = baseMSG;
|
||||
baseMSG = msg;
|
||||
}
|
||||
if(msg)
|
||||
{
|
||||
if(msgstr)
|
||||
{
|
||||
if(msg->msgstr) free(msg->msgstr);
|
||||
//msg->msgstr = strdup(msgstr);
|
||||
msg->msgstr = expand_escape(msgstr);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return NULL;
|
||||
static MSG *setMSG(const char *msgid, const char *msgstr) {
|
||||
u32 id = hash_string(msgid);
|
||||
MSG *msg = findMSG(id);
|
||||
if (!msg) {
|
||||
msg = (MSG *)malloc(sizeof(MSG));
|
||||
msg->id = id;
|
||||
msg->msgstr = NULL;
|
||||
msg->next = baseMSG;
|
||||
baseMSG = msg;
|
||||
}
|
||||
if (msg) {
|
||||
if (msgstr) {
|
||||
if (msg->msgstr) free(msg->msgstr);
|
||||
//msg->msgstr = strdup(msgstr);
|
||||
msg->msgstr = expand_escape(msgstr);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void gettextCleanUp(void)
|
||||
{
|
||||
while(baseMSG)
|
||||
{
|
||||
MSG *nextMsg =baseMSG->next;
|
||||
free(baseMSG->msgstr);
|
||||
free(baseMSG);
|
||||
baseMSG = nextMsg;
|
||||
}
|
||||
void gettextCleanUp(void) {
|
||||
while (baseMSG) {
|
||||
MSG *nextMsg =baseMSG->next;
|
||||
free(baseMSG->msgstr);
|
||||
free(baseMSG);
|
||||
baseMSG = nextMsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool gettextLoadLanguage(const char* langFile)
|
||||
{
|
||||
FILE *f;
|
||||
char line[200];
|
||||
char *lastID=NULL;
|
||||
|
||||
gettextCleanUp();
|
||||
f = fopen(langFile, "r");
|
||||
if(!f)
|
||||
return false;
|
||||
bool gettextLoadLanguage(const char* langFile) {
|
||||
FILE *f;
|
||||
char line[200];
|
||||
char *lastID=NULL;
|
||||
|
||||
while (fgets(line, sizeof(line), f))
|
||||
{
|
||||
// lines starting with # are comments
|
||||
if (line[0] == '#')
|
||||
continue;
|
||||
else if (strncmp(line, "msgid \"", 7) == 0)
|
||||
{
|
||||
char *msgid, *end;
|
||||
if(lastID) { free(lastID); lastID=NULL;}
|
||||
msgid = &line[7];
|
||||
end = strrchr(msgid, '"');
|
||||
if(end && end-msgid>1)
|
||||
{
|
||||
*end = 0;
|
||||
lastID = strdup(msgid);
|
||||
}
|
||||
}
|
||||
else if (strncmp(line, "msgstr \"", 8) == 0)
|
||||
{
|
||||
char *msgstr, *end;
|
||||
|
||||
if(lastID == NULL)
|
||||
continue;
|
||||
|
||||
msgstr = &line[8];
|
||||
end = strrchr(msgstr, '"');
|
||||
if(end && end-msgstr>1)
|
||||
{
|
||||
*end = 0;
|
||||
setMSG(lastID, msgstr);
|
||||
}
|
||||
free(lastID);
|
||||
lastID=NULL;
|
||||
}
|
||||
|
||||
}
|
||||
gettextCleanUp();
|
||||
f = fopen(langFile, "r");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
fclose(f);
|
||||
return true;
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
// lines starting with # are comments
|
||||
if (line[0] == '#')
|
||||
continue;
|
||||
else if (strncmp(line, "msgid \"", 7) == 0) {
|
||||
char *msgid, *end;
|
||||
if (lastID) {
|
||||
free(lastID);
|
||||
lastID=NULL;
|
||||
}
|
||||
msgid = &line[7];
|
||||
end = strrchr(msgid, '"');
|
||||
if (end && end-msgid>1) {
|
||||
*end = 0;
|
||||
lastID = strdup(msgid);
|
||||
}
|
||||
} else if (strncmp(line, "msgstr \"", 8) == 0) {
|
||||
char *msgstr, *end;
|
||||
|
||||
if (lastID == NULL)
|
||||
continue;
|
||||
|
||||
msgstr = &line[8];
|
||||
end = strrchr(msgstr, '"');
|
||||
if (end && end-msgstr>1) {
|
||||
*end = 0;
|
||||
setMSG(lastID, msgstr);
|
||||
}
|
||||
free(lastID);
|
||||
lastID=NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
const char *gettext(const char *msgid)
|
||||
{
|
||||
MSG *msg = findMSG(hash_string(msgid));
|
||||
if(msg && msg->msgstr) return msg->msgstr;
|
||||
return msgid;
|
||||
const char *gettext(const char *msgid) {
|
||||
MSG *msg = findMSG(hash_string(msgid));
|
||||
if (msg && msg->msgstr) return msg->msgstr;
|
||||
return msgid;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
#define _GETTEXT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
bool gettextLoadLanguage(const char* langFile);
|
||||
void gettextCleanUp(void);
|
||||
/*
|
||||
* input msg = a text in ASCII
|
||||
* output = the translated msg in utf-8
|
||||
*/
|
||||
const char *gettext(const char *msg);
|
||||
bool gettextLoadLanguage(const char* langFile);
|
||||
void gettextCleanUp(void);
|
||||
/*
|
||||
* input msg = a text in ASCII
|
||||
* output = the translated msg in utf-8
|
||||
*/
|
||||
const char *gettext(const char *msg);
|
||||
#define tr(s) gettext(s)
|
||||
#define trNOOP(s) (s)
|
||||
|
||||
|
@ -13,95 +13,86 @@
|
||||
static char alldirfiles[300][70];
|
||||
char filenames[80];
|
||||
|
||||
bool findfile(const char * filename, const char * path)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *file;
|
||||
bool findfile(const char * filename, const char * path) {
|
||||
DIR *dir;
|
||||
struct dirent *file;
|
||||
|
||||
dir = opendir(path);
|
||||
dir = opendir(path);
|
||||
|
||||
char temp[11];
|
||||
while ((file = readdir(dir)))
|
||||
{
|
||||
snprintf(temp,sizeof(temp),"%s",file->d_name);
|
||||
if (!strncmpi(temp,filename,11))
|
||||
{
|
||||
closedir(dir);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
return false;
|
||||
char temp[11];
|
||||
while ((file = readdir(dir))) {
|
||||
snprintf(temp,sizeof(temp),"%s",file->d_name);
|
||||
if (!strncmpi(temp,filename,11)) {
|
||||
closedir(dir);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool subfoldercreate(char * fullpath) {
|
||||
//check forsubfolders
|
||||
char dircheck[300];
|
||||
char dirnoslash[300];
|
||||
char * pch = NULL;
|
||||
u32 cnt = 0;
|
||||
struct stat st;
|
||||
//check forsubfolders
|
||||
char dircheck[300];
|
||||
char dirnoslash[300];
|
||||
char * pch = NULL;
|
||||
u32 cnt = 0;
|
||||
struct stat st;
|
||||
|
||||
snprintf(dirnoslash, strlen(fullpath), "%s", fullpath);
|
||||
snprintf(dirnoslash, strlen(fullpath), "%s", fullpath);
|
||||
|
||||
if(stat(fullpath, &st) != 0) {
|
||||
if (stat(fullpath, &st) != 0) {
|
||||
pch = strrchr(dirnoslash, '/');
|
||||
cnt = pch-dirnoslash;
|
||||
snprintf(dircheck, cnt+2, "%s", dirnoslash);
|
||||
subfoldercreate(dircheck);
|
||||
};
|
||||
};
|
||||
|
||||
if (mkdir(dirnoslash, 0777) == -1) {
|
||||
if (mkdir(dirnoslash, 0777) == -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
char * GetFileName(int i)
|
||||
{
|
||||
char * GetFileName(int i) {
|
||||
return alldirfiles[i];
|
||||
}
|
||||
|
||||
s32 filenamescmp(const void *a, const void *b)
|
||||
{
|
||||
/* Compare strings */
|
||||
return stricmp((char *)a, (char *)b);
|
||||
s32 filenamescmp(const void *a, const void *b) {
|
||||
/* Compare strings */
|
||||
return stricmp((char *)a, (char *)b);
|
||||
}
|
||||
|
||||
int GetAllDirFiles(char * filespath)
|
||||
{
|
||||
int countfiles = 0;
|
||||
int GetAllDirFiles(char * filespath) {
|
||||
int countfiles = 0;
|
||||
|
||||
struct stat st;
|
||||
DIR_ITER* dir;
|
||||
dir = diropen (filespath);
|
||||
struct stat st;
|
||||
DIR_ITER* dir;
|
||||
dir = diropen (filespath);
|
||||
|
||||
if (dir == NULL) //If empty
|
||||
return 0;
|
||||
while (dirnext(dir,filenames,&st) == 0)
|
||||
{
|
||||
if ((st.st_mode & S_IFDIR) == 0)
|
||||
{
|
||||
// st.st_mode & S_IFDIR indicates a directory
|
||||
snprintf(alldirfiles[countfiles], 70, "%s", filenames);
|
||||
countfiles++;
|
||||
}
|
||||
}
|
||||
dirclose(dir);
|
||||
qsort(alldirfiles, countfiles, sizeof(char[70]), filenamescmp);
|
||||
return countfiles;
|
||||
if (dir == NULL) //If empty
|
||||
return 0;
|
||||
while (dirnext(dir,filenames,&st) == 0) {
|
||||
if ((st.st_mode & S_IFDIR) == 0) {
|
||||
// st.st_mode & S_IFDIR indicates a directory
|
||||
snprintf(alldirfiles[countfiles], 70, "%s", filenames);
|
||||
countfiles++;
|
||||
}
|
||||
}
|
||||
dirclose(dir);
|
||||
qsort(alldirfiles, countfiles, sizeof(char[70]), filenamescmp);
|
||||
return countfiles;
|
||||
}
|
||||
|
||||
bool checkfile(char * path)
|
||||
{
|
||||
bool checkfile(char * path) {
|
||||
FILE * f;
|
||||
f = fopen(path,"r");
|
||||
if(f) {
|
||||
fclose(f);
|
||||
return true;
|
||||
if (f) {
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,15 +2,14 @@
|
||||
#define _LISTFILES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool findfile(const char * filename, const char * path);
|
||||
char * GetFileName(int i);
|
||||
int GetAllDirFiles(char * filespath);
|
||||
bool subfoldercreate(char * fullpath);
|
||||
bool checkfile(char * path);
|
||||
bool findfile(const char * filename, const char * path);
|
||||
char * GetFileName(int i);
|
||||
int GetAllDirFiles(char * filespath);
|
||||
bool subfoldercreate(char * fullpath);
|
||||
bool checkfile(char * path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
121
source/main.cpp
121
source/main.cpp
@ -16,7 +16,7 @@
|
||||
#include <unistd.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include "usbloader/wbfs.h"
|
||||
#include "usbloader/wbfs.h"
|
||||
#include "settings/cfg.h"
|
||||
#include "language/gettext.h"
|
||||
#include "mload/mload.h"
|
||||
@ -43,46 +43,41 @@ FreeTypeGX *fontSystem=0;
|
||||
FreeTypeGX *fontClock=0;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
s32 ret2;
|
||||
main(int argc, char *argv[]) {
|
||||
s32 ret2;
|
||||
|
||||
bool bootDevice_found=false;
|
||||
if(argc >= 1)
|
||||
{
|
||||
if(!strncasecmp(argv[0], "usb:/", 5))
|
||||
{
|
||||
strcpy(bootDevice, "USB:");
|
||||
bootDevice_found = true;
|
||||
}
|
||||
else if(!strncasecmp(argv[0], "sd:/", 4))
|
||||
bootDevice_found = true;
|
||||
}
|
||||
bool bootDevice_found=false;
|
||||
if (argc >= 1) {
|
||||
if (!strncasecmp(argv[0], "usb:/", 5)) {
|
||||
strcpy(bootDevice, "USB:");
|
||||
bootDevice_found = true;
|
||||
} else if (!strncasecmp(argv[0], "sd:/", 4))
|
||||
bootDevice_found = true;
|
||||
}
|
||||
|
||||
ret2 = IOS_ReloadIOS(249);
|
||||
if(ret2 < 0) {
|
||||
ret2 = IOS_ReloadIOS(222);
|
||||
load_ehc_module();
|
||||
}
|
||||
if (ret2 < 0) {
|
||||
ret2 = IOS_ReloadIOS(222);
|
||||
load_ehc_module();
|
||||
}
|
||||
|
||||
SDCard_Init(); // mount SD for loading cfg's
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
SDCard_Init(); // mount SD for loading cfg's
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
|
||||
if(!bootDevice_found)
|
||||
{
|
||||
//try USB
|
||||
//left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
|
||||
if(checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
|
||||
|| checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
|
||||
|| checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
|
||||
strcpy(bootDevice, "USB:");
|
||||
}
|
||||
if (!bootDevice_found) {
|
||||
//try USB
|
||||
//left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
|
||||
if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
|
||||
|| checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
|
||||
|| checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
|
||||
strcpy(bootDevice, "USB:");
|
||||
}
|
||||
|
||||
gettextCleanUp();
|
||||
CFG_Load();
|
||||
gettextCleanUp();
|
||||
CFG_Load();
|
||||
|
||||
/* Load Custom IOS */
|
||||
if(Settings.cios == ios222 && IOS_GetVersion() != 222) {
|
||||
if (Settings.cios == ios222 && IOS_GetVersion() != 222) {
|
||||
SDCard_deInit();// unmount SD for reloading IOS
|
||||
USBDevice_deInit();// unmount USB for reloading IOS
|
||||
ret2 = IOS_ReloadIOS(222);
|
||||
@ -93,51 +88,51 @@ main(int argc, char *argv[])
|
||||
}
|
||||
SDCard_Init(); // now mount SD:/
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
} else if(Settings.cios == ios249 && IOS_GetVersion() != 249) {
|
||||
} else if (Settings.cios == ios249 && IOS_GetVersion() != 249) {
|
||||
SDCard_deInit();// unmount SD for reloading IOS
|
||||
USBDevice_deInit();// unmount USB for reloading IOS
|
||||
ret2 = IOS_ReloadIOS(249);
|
||||
if(ret2 < 0) {
|
||||
ret2 = IOS_ReloadIOS(249);
|
||||
if (ret2 < 0) {
|
||||
Settings.cios = ios222;
|
||||
ret2 = IOS_ReloadIOS(222);
|
||||
load_ehc_module();
|
||||
}
|
||||
}
|
||||
SDCard_Init(); // now mount SD:/
|
||||
USBDevice_Init(); // and mount USB:/
|
||||
}
|
||||
}
|
||||
|
||||
if (ret2 < 0) {
|
||||
printf("ERROR: cIOS could not be loaded!");
|
||||
sleep(5);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
if (ret2 < 0) {
|
||||
printf("ERROR: cIOS could not be loaded!");
|
||||
sleep(5);
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
Sys_Init();
|
||||
Sys_Init();
|
||||
|
||||
/** PAD_Init has to be before InitVideo don't move that **/
|
||||
/** PAD_Init has to be before InitVideo don't move that **/
|
||||
PAD_Init(); // initialize PAD/WPAD
|
||||
Wpad_Init();
|
||||
Wpad_Init();
|
||||
|
||||
InitVideo(); // Initialise video
|
||||
InitAudio(); // Initialize audio
|
||||
InitVideo(); // Initialise video
|
||||
InitAudio(); // Initialize audio
|
||||
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
|
||||
// load main font from file, or default to built-in font
|
||||
fontSystem = new FreeTypeGX();
|
||||
char *fontPath = NULL;
|
||||
asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
|
||||
fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
|
||||
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||
free(fontPath);
|
||||
// load main font from file, or default to built-in font
|
||||
fontSystem = new FreeTypeGX();
|
||||
char *fontPath = NULL;
|
||||
asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
|
||||
fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
|
||||
fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||
free(fontPath);
|
||||
|
||||
fontClock = new FreeTypeGX();
|
||||
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
|
||||
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||
fontClock = new FreeTypeGX();
|
||||
fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
|
||||
fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
|
||||
|
||||
InitGUIThreads();
|
||||
MainMenu(MENU_CHECK);
|
||||
return 0;
|
||||
InitGUIThreads();
|
||||
MainMenu(MENU_CHECK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
3327
source/menu.cpp
3327
source/menu.cpp
File diff suppressed because it is too large
Load Diff
@ -10,26 +10,25 @@
|
||||
#define _MENU_H_
|
||||
|
||||
#include <ogcsys.h>
|
||||
#include "settings/cfg.h"
|
||||
#include "settings/cfg.h"
|
||||
#include "main.h"
|
||||
|
||||
void InitGUIThreads(void);
|
||||
void ExitGUIThreads(void);
|
||||
|
||||
int MainMenu (int menuitem);
|
||||
void ExitGUIThreads(void);
|
||||
|
||||
enum
|
||||
{
|
||||
MENU_EXIT = -1,
|
||||
MENU_NONE,
|
||||
MENU_SETTINGS,
|
||||
MENU_DISCLIST,
|
||||
MENU_FORMAT,
|
||||
MENU_INSTALL,
|
||||
MENU_CHECK,
|
||||
MENU_GAME_SETTINGS,
|
||||
MENU_HOMEBREWBROWSE,
|
||||
BOOTHOMEBREW
|
||||
int MainMenu (int menuitem);
|
||||
|
||||
enum {
|
||||
MENU_EXIT = -1,
|
||||
MENU_NONE,
|
||||
MENU_SETTINGS,
|
||||
MENU_DISCLIST,
|
||||
MENU_FORMAT,
|
||||
MENU_INSTALL,
|
||||
MENU_CHECK,
|
||||
MENU_GAME_SETTINGS,
|
||||
MENU_HOMEBREWBROWSE,
|
||||
BOOTHOMEBREW
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,140 +1,140 @@
|
||||
#define size_dip_plugin 3700
|
||||
|
||||
unsigned char dip_plugin[3700] __attribute__((aligned (32)))={
|
||||
19, 119, 230, 81, 18, 52, 0, 1, 32, 34, 205, 172, 32, 32, 13, 57, 32, 32, 8, 197, 32, 32, 8, 153, 32, 32, 91, 129, 32,
|
||||
32, 0, 73, 32, 32, 40, 117, 32, 32, 54, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
19, 119, 235, 77, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 71, 120, 234, 0, 2, 143, 70, 192, 71,
|
||||
120, 234, 0, 2, 159, 70, 192, 71, 120, 234, 0, 2, 175, 70, 192, 71, 120, 234, 0, 2, 167, 70, 192, 71, 120, 234, 0, 2,
|
||||
141, 70, 192, 71, 120, 234, 0, 2, 127, 70, 192, 71, 120, 234, 0, 2, 165, 70, 192, 71, 120, 234, 0, 2, 161, 70, 192,
|
||||
71, 120, 234, 0, 2, 167, 70, 192, 71, 120, 234, 0, 2, 167, 181, 0, 75, 7, 176, 137, 147, 0, 70, 104, 35, 0, 33, 0, 34,
|
||||
0, 147, 1, 147, 2, 240, 0, 253, 93, 176, 9, 188, 2, 71, 8, 70, 192, 227, 0, 0, 0, 181, 16, 28, 3, 34, 32, 28, 12, 72,
|
||||
13, 28, 25, 247, 255, 255, 206, 33, 32, 72, 11, 247, 255, 255, 198, 73, 10, 34, 1, 104, 11, 66, 19, 209, 253, 34, 32,
|
||||
28, 32, 73, 6, 247, 255, 255, 192, 28, 32, 33, 32, 247, 255, 255, 184, 75, 4, 104, 24, 188, 16, 188, 2, 71, 8, 70, 192,
|
||||
13, 0, 96, 0, 13, 0, 96, 28, 13, 0, 96, 32, 181, 240, 70, 95, 70, 86, 70, 77, 70, 68, 180, 240, 10, 203, 70, 154, 75,
|
||||
20, 176, 137, 37, 0, 28, 7, 28, 14, 70, 145, 70, 108, 70, 155, 70, 168, 70, 91, 96, 35, 70, 67, 96, 99, 96, 163, 70,
|
||||
83, 96, 227, 28, 56, 70, 75, 28, 49, 97, 35, 247, 255, 255, 158, 70, 104, 28, 57, 28, 50, 240, 0, 253, 14, 53, 1, 40,
|
||||
0, 209, 8, 176, 9, 188, 60, 70, 144, 70, 153, 70, 162, 70, 171, 188, 240, 188, 2, 71, 8, 45, 15, 217, 223, 231, 243,
|
||||
208, 0, 0, 0, 181, 112, 176, 136, 75, 8, 28, 6, 28, 13, 70, 108, 147, 0, 96, 97, 146, 2, 247, 255, 255, 125, 28, 49,
|
||||
28, 42, 70, 104, 240, 0, 252, 237, 176, 8, 188, 112, 188, 2, 71, 8, 168, 0, 0, 0, 181, 240, 70, 95, 70, 86, 70, 77,
|
||||
70, 68, 180, 240, 176, 143, 144, 4, 145, 3, 146, 2, 41, 0, 209, 0, 224, 126, 10, 82, 70, 145, 35, 128, 34, 0, 1, 27,
|
||||
70, 147, 34, 255, 147, 1, 3, 210, 171, 6, 146, 0, 70, 152, 224, 7, 154, 3, 68, 179, 69, 90, 217, 62, 154, 5, 24, 179,
|
||||
10, 219, 68, 153, 154, 3, 70, 91, 26, 214, 70, 74, 2, 83, 154, 2, 66, 154, 216, 87, 35, 0, 147, 5, 36, 0, 159, 4, 34,
|
||||
128, 68, 95, 28, 56, 28, 49, 1, 18, 240, 0, 248, 103, 44, 0, 209, 47, 40, 0, 208, 45, 155, 0, 28, 6, 66, 152, 217, 1,
|
||||
38, 255, 3, 246, 10, 242, 70, 146, 36, 0, 75, 43, 70, 66, 96, 19, 35, 0, 96, 83, 96, 147, 70, 83, 96, 211, 70, 75, 97,
|
||||
19, 28, 56, 28, 49, 247, 255, 255, 34, 70, 64, 28, 57, 28, 50, 240, 0, 252, 146, 52, 1, 28, 5, 40, 0, 208, 192, 44,
|
||||
15, 217, 230, 45, 0, 208, 188, 176, 15, 28, 40, 188, 60, 70, 144, 70, 153, 70, 162, 70, 171, 188, 240, 188, 2, 71, 8,
|
||||
154, 5, 25, 147, 154, 1, 66, 147, 217, 1, 155, 5, 26, 214, 32, 128, 1, 0, 33, 32, 247, 255, 254, 247, 28, 4, 40, 0,
|
||||
208, 18, 33, 128, 1, 9, 70, 74, 247, 255, 255, 59, 28, 5, 40, 0, 208, 15, 28, 32, 247, 255, 254, 213, 231, 216, 26,
|
||||
211, 0, 155, 28, 28, 147, 5, 30, 99, 65, 156, 231, 163, 37, 1, 66, 109, 231, 208, 37, 0, 231, 206, 154, 5, 28, 56, 24,
|
||||
161, 28, 50, 247, 255, 254, 210, 28, 56, 28, 49, 247, 255, 254, 202, 231, 228, 70, 192, 208, 0, 0, 0, 181, 48, 28, 13,
|
||||
28, 20, 6, 195, 209, 18, 75, 15, 66, 152, 217, 19, 33, 0, 75, 14, 24, 194, 75, 14, 66, 154, 216, 1, 75, 13, 26, 25,
|
||||
66, 161, 211, 5, 28, 8, 66, 169, 216, 10, 30, 99, 67, 152, 224, 0, 32, 0, 188, 48, 188, 2, 71, 8, 35, 192, 4, 91, 26,
|
||||
25, 231, 232, 28, 40, 30, 99, 67, 152, 231, 244, 1, 127, 255, 255, 240, 0, 0, 0, 3, 97, 127, 255, 19, 97, 128, 0, 181,
|
||||
240, 70, 95, 70, 86, 70, 77, 70, 68, 180, 240, 70, 137, 176, 129, 73, 51, 34, 4, 28, 7, 240, 0, 250, 235, 40, 0, 209,
|
||||
3, 35, 128, 0, 91, 69, 153, 208, 13, 75, 47, 70, 154, 120, 27, 43, 0, 209, 81, 176, 1, 188, 60, 70, 144, 70, 153, 70,
|
||||
162, 70, 171, 188, 240, 188, 1, 71, 0, 74, 40, 35, 10, 70, 146, 112, 19, 38, 243, 75, 38, 74, 39, 37, 0, 70, 152, 70,
|
||||
147, 224, 2, 53, 1, 66, 181, 210, 19, 25, 124, 28, 32, 70, 65, 34, 13, 240, 0, 250, 195, 40, 0, 209, 244, 70, 89, 34,
|
||||
13, 28, 32, 247, 255, 254, 98, 53, 1, 28, 32, 33, 13, 247, 255, 254, 89, 66, 181, 211, 235, 34, 12, 66, 82, 68, 74,
|
||||
70, 144, 42, 0, 208, 27, 75, 23, 37, 0, 78, 23, 70, 153, 224, 2, 53, 1, 69, 69, 210, 19, 25, 124, 28, 32, 28, 49, 34,
|
||||
12, 240, 0, 250, 161, 40, 0, 209, 244, 70, 73, 34, 12, 28, 32, 247, 255, 254, 64, 53, 1, 28, 32, 33, 12, 247, 255, 254,
|
||||
55, 69, 69, 211, 235, 70, 82, 120, 19, 59, 1, 112, 19, 231, 173, 70, 78, 62, 13, 46, 0, 209, 183, 231, 211, 70, 192,
|
||||
19, 119, 235, 176, 19, 119, 238, 128, 19, 119, 235, 217, 19, 119, 235, 204, 19, 119, 235, 180, 19, 119, 235, 192, 181,
|
||||
48, 28, 4, 72, 15, 28, 13, 104, 131, 104, 193, 176, 129, 24, 91, 24, 154, 105, 3, 43, 0, 209, 15, 104, 67, 43, 0, 209,
|
||||
7, 28, 32, 28, 41, 247, 255, 254, 147, 176, 1, 188, 48, 188, 2, 71, 8, 28, 32, 28, 41, 247, 255, 254, 161, 231, 246,
|
||||
28, 32, 28, 41, 240, 0, 250, 118, 231, 241, 70, 192, 19, 119, 238, 132, 181, 240, 70, 95, 70, 86, 70, 77, 70, 68, 180,
|
||||
240, 176, 129, 28, 4, 70, 139, 72, 48, 33, 1, 70, 145, 247, 255, 253, 248, 70, 130, 40, 0, 219, 74, 120, 35, 43, 0,
|
||||
208, 80, 77, 43, 34, 0, 84, 171, 52, 1, 120, 35, 50, 1, 43, 0, 209, 249, 28, 87, 35, 10, 70, 72, 84, 171, 40, 0, 221,
|
||||
45, 35, 15, 38, 0, 70, 152, 224, 24, 28, 122, 28, 81, 28, 59, 28, 79, 32, 48, 84, 232, 70, 88, 93, 131, 70, 64, 64,
|
||||
3, 51, 48, 84, 171, 43, 57, 217, 1, 51, 7, 84, 171, 70, 67, 64, 51, 43, 15, 208, 16, 35, 32, 54, 1, 84, 107, 69, 177,
|
||||
221, 16, 47, 252, 221, 228, 28, 58, 28, 41, 70, 80, 247, 255, 253, 200, 39, 3, 35, 0, 34, 1, 33, 2, 231, 222, 35, 10,
|
||||
54, 1, 84, 107, 69, 177, 220, 238, 28, 32, 28, 57, 247, 255, 253, 166, 70, 80, 28, 41, 28, 58, 247, 255, 253, 181, 70,
|
||||
80, 247, 255, 253, 154, 176, 1, 188, 60, 70, 144, 70, 153, 70, 162, 70, 171, 188, 240, 188, 1, 71, 0, 34, 0, 39, 1,
|
||||
77, 2, 231, 179, 70, 192, 19, 119, 235, 232, 19, 119, 239, 32, 181, 240, 70, 71, 180, 128, 79, 33, 28, 4, 104, 59, 70,
|
||||
152, 43, 0, 209, 17, 35, 1, 96, 59, 33, 32, 247, 255, 253, 142, 104, 227, 43, 8, 208, 12, 28, 32, 240, 0, 250, 241,
|
||||
70, 67, 96, 59, 188, 4, 70, 144, 188, 240, 188, 2, 71, 8, 240, 0, 250, 232, 231, 247, 28, 33, 72, 20, 49, 12, 34, 4,
|
||||
247, 255, 255, 110, 34, 32, 28, 33, 72, 17, 247, 255, 255, 105, 105, 163, 104, 24, 104, 89, 247, 255, 253, 110, 105,
|
||||
163, 36, 197, 104, 27, 1, 164, 28, 32, 33, 8, 104, 93, 104, 30, 247, 255, 253, 100, 75, 9, 4, 45, 64, 30, 67, 53, 28,
|
||||
32, 96, 37, 33, 8, 247, 255, 253, 75, 70, 67, 96, 59, 32, 0, 231, 208, 70, 192, 19, 119, 238, 172, 19, 119, 235, 248,
|
||||
19, 119, 236, 4, 0, 0, 255, 255, 181, 16, 73, 21, 28, 4, 104, 139, 104, 202, 24, 154, 105, 11, 43, 0, 209, 18, 104,
|
||||
75, 43, 0, 209, 11, 33, 32, 247, 255, 253, 183, 40, 0, 219, 3, 105, 162, 75, 13, 66, 154, 208, 10, 188, 16, 188, 2,
|
||||
71, 8, 33, 32, 247, 255, 253, 193, 231, 242, 33, 32, 240, 0, 249, 151, 231, 238, 75, 7, 104, 27, 104, 26, 35, 1, 112,
|
||||
19, 120, 83, 43, 0, 209, 236, 247, 255, 253, 12, 231, 233, 70, 192, 19, 119, 238, 132, 93, 28, 158, 163, 19, 119, 224,
|
||||
8, 181, 240, 70, 87, 70, 70, 180, 192, 28, 4, 120, 0, 176, 129, 28, 14, 28, 23, 40, 224, 208, 24, 77, 133, 35, 0, 98,
|
||||
43, 28, 3, 59, 112, 43, 143, 217, 13, 28, 32, 28, 49, 28, 58, 240, 0, 250, 122, 28, 4, 176, 1, 28, 32, 188, 12, 70,
|
||||
144, 70, 154, 188, 240, 188, 2, 71, 8, 74, 123, 0, 155, 88, 211, 70, 159, 77, 120, 106, 43, 43, 0, 209, 2, 105, 43,
|
||||
43, 0, 208, 230, 28, 48, 33, 0, 28, 58, 240, 0, 248, 240, 106, 43, 224, 143, 104, 107, 43, 0, 209, 2, 105, 43, 43, 0,
|
||||
208, 217, 36, 0, 231, 221, 35, 1, 34, 37, 84, 171, 104, 43, 43, 0, 208, 0, 224, 173, 28, 32, 28, 58, 240, 0, 250, 76,
|
||||
28, 4, 34, 0, 35, 37, 84, 234, 44, 0, 209, 204, 224, 46, 104, 235, 104, 169, 70, 154, 105, 43, 70, 136, 43, 0, 209,
|
||||
0, 224, 176, 32, 0, 34, 0, 70, 67, 70, 81, 67, 11, 209, 2, 42, 0, 209, 0, 224, 176, 28, 3, 30, 90, 65, 147, 96, 107,
|
||||
28, 48, 28, 57, 247, 255, 255, 105, 28, 4, 231, 176, 105, 43, 43, 0, 208, 167, 35, 2, 224, 85, 104, 97, 104, 162, 40,
|
||||
208, 209, 0, 224, 144, 28, 48, 247, 255, 254, 122, 28, 4, 40, 0, 209, 160, 35, 37, 92, 235, 43, 0, 209, 156, 28, 48,
|
||||
28, 57, 247, 255, 253, 243, 231, 151, 35, 36, 92, 234, 42, 0, 209, 179, 105, 41, 84, 234, 35, 37, 96, 42, 96, 106, 96,
|
||||
170, 96, 234, 98, 42, 84, 234, 70, 136, 41, 0, 209, 0, 231, 128, 105, 108, 247, 255, 252, 148, 70, 64, 28, 41, 28, 34,
|
||||
56, 1, 49, 24, 240, 0, 249, 19, 28, 4, 231, 122, 104, 107, 43, 0, 208, 93, 75, 60, 36, 160, 98, 43, 2, 36, 231, 114,
|
||||
104, 107, 43, 0, 209, 3, 105, 43, 43, 0, 209, 0, 231, 101, 104, 99, 104, 162, 7, 155, 67, 19, 74, 53, 36, 0, 64, 19,
|
||||
96, 235, 231, 98, 104, 99, 72, 51, 64, 24, 247, 255, 252, 128, 28, 4, 231, 91, 104, 98, 35, 36, 84, 234, 36, 0, 231,
|
||||
86, 105, 43, 96, 51, 28, 48, 28, 57, 247, 255, 252, 69, 36, 0, 231, 78, 104, 99, 97, 43, 43, 0, 209, 40, 105, 99, 36,
|
||||
0, 97, 107, 231, 70, 104, 43, 231, 238, 104, 99, 36, 0, 96, 43, 231, 64, 104, 171, 231, 232, 104, 99, 36, 0, 96, 171,
|
||||
231, 58, 104, 107, 43, 0, 209, 3, 105, 43, 43, 0, 209, 0, 231, 45, 28, 48, 33, 0, 28, 58, 240, 0, 248, 55, 28, 48, 28,
|
||||
57, 247, 255, 252, 31, 36, 0, 231, 40, 104, 97, 104, 162, 28, 48, 247, 255, 253, 250, 28, 4, 231, 79, 28, 40, 28, 33,
|
||||
49, 8, 34, 6, 48, 24, 247, 255, 252, 19, 231, 206, 105, 43, 43, 0, 209, 158, 231, 15, 2, 201, 2, 82, 231, 107, 28, 58,
|
||||
28, 32, 28, 49, 240, 0, 249, 135, 28, 2, 30, 83, 65, 154, 231, 71, 105, 43, 43, 0, 208, 0, 231, 74, 96, 106, 36, 0,
|
||||
231, 2, 70, 192, 19, 119, 238, 132, 19, 119, 236, 12, 0, 5, 49, 0, 255, 255, 128, 0, 127, 255, 255, 255, 181, 240, 70,
|
||||
87, 70, 78, 70, 69, 180, 224, 70, 128, 28, 14, 70, 148, 42, 0, 208, 51, 33, 3, 28, 2, 64, 10, 35, 4, 26, 155, 28, 24,
|
||||
64, 8, 69, 96, 216, 49, 40, 0, 208, 49, 36, 0, 70, 67, 85, 30, 52, 1, 66, 160, 216, 250, 69, 132, 208, 32, 70, 99, 26,
|
||||
27, 8, 159, 70, 153, 0, 187, 70, 154, 43, 0, 208, 17, 4, 51, 6, 50, 2, 49, 67, 26, 67, 10, 28, 21, 70, 67, 67, 53, 24,
|
||||
26, 33, 0, 0, 139, 49, 1, 80, 213, 66, 185, 211, 250, 68, 84, 69, 209, 208, 6, 70, 67, 25, 24, 52, 1, 112, 6, 48, 1,
|
||||
69, 164, 216, 250, 188, 28, 70, 144, 70, 153, 70, 162, 188, 240, 188, 1, 71, 0, 70, 96, 231, 203, 36, 0, 231, 211, 70,
|
||||
192, 181, 48, 28, 5, 28, 12, 28, 16, 42, 0, 208, 12, 120, 42, 120, 11, 66, 154, 209, 12, 33, 0, 224, 3, 92, 106, 92,
|
||||
99, 66, 154, 209, 6, 49, 1, 66, 136, 216, 248, 32, 0, 188, 48, 188, 2, 71, 8, 32, 1, 66, 64, 231, 249, 181, 112, 76,
|
||||
17, 28, 6, 104, 32, 176, 130, 28, 13, 98, 2, 97, 6, 100, 1, 97, 65, 33, 68, 247, 255, 251, 123, 28, 48, 28, 41, 247,
|
||||
255, 251, 119, 75, 10, 34, 2, 104, 24, 104, 35, 73, 9, 147, 0, 35, 1, 247, 255, 251, 134, 28, 41, 28, 4, 28, 48, 247,
|
||||
255, 251, 121, 176, 2, 28, 32, 188, 112, 188, 2, 71, 8, 19, 119, 238, 176, 19, 119, 238, 180, 87, 70, 83, 2, 181, 240,
|
||||
176, 133, 28, 4, 28, 15, 146, 3, 40, 1, 217, 5, 32, 1, 66, 64, 176, 5, 188, 240, 188, 2, 71, 8, 77, 38, 104, 43, 43,
|
||||
0, 208, 65, 78, 37, 104, 48, 40, 0, 219, 1, 247, 255, 251, 67, 75, 35, 0, 162, 88, 208, 33, 1, 247, 255, 251, 77, 96,
|
||||
48, 40, 0, 219, 232, 104, 40, 28, 57, 34, 6, 48, 32, 247, 255, 251, 60, 104, 40, 169, 3, 34, 4, 48, 64, 247, 255, 251,
|
||||
54, 104, 42, 36, 4, 28, 19, 51, 32, 96, 19, 104, 42, 35, 6, 96, 83, 104, 42, 33, 68, 28, 19, 51, 64, 96, 147, 104, 43,
|
||||
96, 220, 104, 40, 247, 255, 251, 32, 104, 43, 104, 48, 34, 2, 147, 0, 73, 14, 35, 0, 247, 255, 251, 48, 104, 42, 28,
|
||||
19, 51, 32, 96, 19, 104, 43, 96, 92, 104, 42, 28, 19, 51, 64, 96, 147, 104, 43, 96, 220, 231, 181, 75, 7, 78, 3, 96,
|
||||
43, 35, 1, 66, 91, 96, 51, 231, 188, 19, 119, 238, 176, 19, 119, 238, 180, 19, 119, 238, 108, 87, 70, 83, 1, 19, 119,
|
||||
238, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233, 45, 64, 128, 229, 159, 112, 248, 229, 151, 112, 0, 235, 0, 0, 45,
|
||||
232, 189, 64, 128, 225, 47, 255, 30, 233, 45, 64, 128, 229, 159, 112, 228, 229, 151, 112, 0, 235, 0, 0, 39, 232, 189,
|
||||
64, 128, 225, 47, 255, 30, 233, 45, 64, 128, 229, 159, 112, 208, 229, 151, 112, 0, 235, 0, 0, 33, 232, 189, 64, 128,
|
||||
225, 47, 255, 30, 233, 45, 64, 128, 229, 159, 112, 188, 229, 151, 112, 0, 235, 0, 0, 27, 232, 189, 64, 128, 225, 47,
|
||||
255, 30, 233, 45, 64, 128, 229, 159, 112, 168, 229, 151, 112, 0, 235, 0, 0, 21, 232, 189, 64, 128, 225, 47, 255, 30,
|
||||
233, 45, 64, 128, 229, 159, 112, 148, 229, 151, 112, 0, 235, 0, 0, 15, 232, 189, 64, 128, 225, 47, 255, 30, 230, 0,
|
||||
8, 16, 225, 47, 255, 30, 230, 0, 7, 240, 225, 47, 255, 30, 230, 0, 3, 144, 225, 47, 255, 30, 230, 0, 3, 176, 225, 47,
|
||||
255, 30, 230, 0, 3, 208, 225, 47, 255, 30, 230, 0, 3, 240, 225, 47, 255, 30, 230, 0, 4, 80, 225, 47, 255, 30, 225, 47,
|
||||
255, 23, 180, 124, 181, 0, 247, 255, 252, 254, 188, 2, 188, 124, 71, 8, 181, 112, 176, 136, 104, 133, 28, 1, 75, 14,
|
||||
71, 24, 70, 192, 70, 114, 28, 1, 32, 4, 223, 171, 71, 16, 181, 240, 70, 95, 70, 86, 70, 77, 70, 68, 180, 240, 75, 8,
|
||||
104, 27, 71, 24, 19, 119, 224, 16, 19, 119, 224, 20, 19, 119, 224, 24, 19, 119, 224, 28, 19, 119, 224, 32, 19, 119,
|
||||
224, 36, 32, 16, 0, 213, 19, 119, 224, 12, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 0, 0, 1, 0, 44, 0,
|
||||
0, 0, 72, 0, 2, 20, 60, 96, 128, 0, 44, 0, 0, 0, 64, 130, 2, 20, 60, 96, 128, 0, 4, 56, 96, 0, 1, 72, 0, 2, 68, 56,
|
||||
97, 0, 24, 12, 56, 96, 0, 1, 72, 0, 2, 68, 56, 97, 0, 24, 0, 0, 47, 100, 101, 118, 47, 102, 97, 116, 47, 108, 111, 103,
|
||||
0, 0, 0, 0, 69, 83, 95, 105, 111, 99, 116, 108, 118, 0, 0, 0, 100, 117, 109, 112, 0, 0, 0, 0, 19, 119, 230, 232, 19,
|
||||
119, 230, 196, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 186, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 30, 19, 119, 230, 116, 19,
|
||||
119, 231, 80, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 40, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 231, 138, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 40, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 180, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 231, 40, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 154, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 154, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 232, 10, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 230, 116, 19, 119, 232, 2, 19, 119, 231, 254, 19, 119, 231, 246, 19, 119, 231, 242, 19, 119,
|
||||
231, 226, 19, 119, 231, 210, 19, 119, 231, 200, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 186, 47, 100, 101, 118,
|
||||
47, 117, 115, 98, 47, 101, 104, 99, 0, 0, 0, 0, 47, 100, 101, 118, 47, 115, 100, 105, 111, 47, 115, 100, 104, 99, 0,
|
||||
0, 19, 119, 238, 76, 19, 119, 238, 92
|
||||
19, 119, 230, 81, 18, 52, 0, 1, 32, 34, 205, 172, 32, 32, 13, 57, 32, 32, 8, 197, 32, 32, 8, 153, 32, 32, 91, 129, 32,
|
||||
32, 0, 73, 32, 32, 40, 117, 32, 32, 54, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
19, 119, 235, 77, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 71, 120, 234, 0, 2, 143, 70, 192, 71,
|
||||
120, 234, 0, 2, 159, 70, 192, 71, 120, 234, 0, 2, 175, 70, 192, 71, 120, 234, 0, 2, 167, 70, 192, 71, 120, 234, 0, 2,
|
||||
141, 70, 192, 71, 120, 234, 0, 2, 127, 70, 192, 71, 120, 234, 0, 2, 165, 70, 192, 71, 120, 234, 0, 2, 161, 70, 192,
|
||||
71, 120, 234, 0, 2, 167, 70, 192, 71, 120, 234, 0, 2, 167, 181, 0, 75, 7, 176, 137, 147, 0, 70, 104, 35, 0, 33, 0, 34,
|
||||
0, 147, 1, 147, 2, 240, 0, 253, 93, 176, 9, 188, 2, 71, 8, 70, 192, 227, 0, 0, 0, 181, 16, 28, 3, 34, 32, 28, 12, 72,
|
||||
13, 28, 25, 247, 255, 255, 206, 33, 32, 72, 11, 247, 255, 255, 198, 73, 10, 34, 1, 104, 11, 66, 19, 209, 253, 34, 32,
|
||||
28, 32, 73, 6, 247, 255, 255, 192, 28, 32, 33, 32, 247, 255, 255, 184, 75, 4, 104, 24, 188, 16, 188, 2, 71, 8, 70, 192,
|
||||
13, 0, 96, 0, 13, 0, 96, 28, 13, 0, 96, 32, 181, 240, 70, 95, 70, 86, 70, 77, 70, 68, 180, 240, 10, 203, 70, 154, 75,
|
||||
20, 176, 137, 37, 0, 28, 7, 28, 14, 70, 145, 70, 108, 70, 155, 70, 168, 70, 91, 96, 35, 70, 67, 96, 99, 96, 163, 70,
|
||||
83, 96, 227, 28, 56, 70, 75, 28, 49, 97, 35, 247, 255, 255, 158, 70, 104, 28, 57, 28, 50, 240, 0, 253, 14, 53, 1, 40,
|
||||
0, 209, 8, 176, 9, 188, 60, 70, 144, 70, 153, 70, 162, 70, 171, 188, 240, 188, 2, 71, 8, 45, 15, 217, 223, 231, 243,
|
||||
208, 0, 0, 0, 181, 112, 176, 136, 75, 8, 28, 6, 28, 13, 70, 108, 147, 0, 96, 97, 146, 2, 247, 255, 255, 125, 28, 49,
|
||||
28, 42, 70, 104, 240, 0, 252, 237, 176, 8, 188, 112, 188, 2, 71, 8, 168, 0, 0, 0, 181, 240, 70, 95, 70, 86, 70, 77,
|
||||
70, 68, 180, 240, 176, 143, 144, 4, 145, 3, 146, 2, 41, 0, 209, 0, 224, 126, 10, 82, 70, 145, 35, 128, 34, 0, 1, 27,
|
||||
70, 147, 34, 255, 147, 1, 3, 210, 171, 6, 146, 0, 70, 152, 224, 7, 154, 3, 68, 179, 69, 90, 217, 62, 154, 5, 24, 179,
|
||||
10, 219, 68, 153, 154, 3, 70, 91, 26, 214, 70, 74, 2, 83, 154, 2, 66, 154, 216, 87, 35, 0, 147, 5, 36, 0, 159, 4, 34,
|
||||
128, 68, 95, 28, 56, 28, 49, 1, 18, 240, 0, 248, 103, 44, 0, 209, 47, 40, 0, 208, 45, 155, 0, 28, 6, 66, 152, 217, 1,
|
||||
38, 255, 3, 246, 10, 242, 70, 146, 36, 0, 75, 43, 70, 66, 96, 19, 35, 0, 96, 83, 96, 147, 70, 83, 96, 211, 70, 75, 97,
|
||||
19, 28, 56, 28, 49, 247, 255, 255, 34, 70, 64, 28, 57, 28, 50, 240, 0, 252, 146, 52, 1, 28, 5, 40, 0, 208, 192, 44,
|
||||
15, 217, 230, 45, 0, 208, 188, 176, 15, 28, 40, 188, 60, 70, 144, 70, 153, 70, 162, 70, 171, 188, 240, 188, 2, 71, 8,
|
||||
154, 5, 25, 147, 154, 1, 66, 147, 217, 1, 155, 5, 26, 214, 32, 128, 1, 0, 33, 32, 247, 255, 254, 247, 28, 4, 40, 0,
|
||||
208, 18, 33, 128, 1, 9, 70, 74, 247, 255, 255, 59, 28, 5, 40, 0, 208, 15, 28, 32, 247, 255, 254, 213, 231, 216, 26,
|
||||
211, 0, 155, 28, 28, 147, 5, 30, 99, 65, 156, 231, 163, 37, 1, 66, 109, 231, 208, 37, 0, 231, 206, 154, 5, 28, 56, 24,
|
||||
161, 28, 50, 247, 255, 254, 210, 28, 56, 28, 49, 247, 255, 254, 202, 231, 228, 70, 192, 208, 0, 0, 0, 181, 48, 28, 13,
|
||||
28, 20, 6, 195, 209, 18, 75, 15, 66, 152, 217, 19, 33, 0, 75, 14, 24, 194, 75, 14, 66, 154, 216, 1, 75, 13, 26, 25,
|
||||
66, 161, 211, 5, 28, 8, 66, 169, 216, 10, 30, 99, 67, 152, 224, 0, 32, 0, 188, 48, 188, 2, 71, 8, 35, 192, 4, 91, 26,
|
||||
25, 231, 232, 28, 40, 30, 99, 67, 152, 231, 244, 1, 127, 255, 255, 240, 0, 0, 0, 3, 97, 127, 255, 19, 97, 128, 0, 181,
|
||||
240, 70, 95, 70, 86, 70, 77, 70, 68, 180, 240, 70, 137, 176, 129, 73, 51, 34, 4, 28, 7, 240, 0, 250, 235, 40, 0, 209,
|
||||
3, 35, 128, 0, 91, 69, 153, 208, 13, 75, 47, 70, 154, 120, 27, 43, 0, 209, 81, 176, 1, 188, 60, 70, 144, 70, 153, 70,
|
||||
162, 70, 171, 188, 240, 188, 1, 71, 0, 74, 40, 35, 10, 70, 146, 112, 19, 38, 243, 75, 38, 74, 39, 37, 0, 70, 152, 70,
|
||||
147, 224, 2, 53, 1, 66, 181, 210, 19, 25, 124, 28, 32, 70, 65, 34, 13, 240, 0, 250, 195, 40, 0, 209, 244, 70, 89, 34,
|
||||
13, 28, 32, 247, 255, 254, 98, 53, 1, 28, 32, 33, 13, 247, 255, 254, 89, 66, 181, 211, 235, 34, 12, 66, 82, 68, 74,
|
||||
70, 144, 42, 0, 208, 27, 75, 23, 37, 0, 78, 23, 70, 153, 224, 2, 53, 1, 69, 69, 210, 19, 25, 124, 28, 32, 28, 49, 34,
|
||||
12, 240, 0, 250, 161, 40, 0, 209, 244, 70, 73, 34, 12, 28, 32, 247, 255, 254, 64, 53, 1, 28, 32, 33, 12, 247, 255, 254,
|
||||
55, 69, 69, 211, 235, 70, 82, 120, 19, 59, 1, 112, 19, 231, 173, 70, 78, 62, 13, 46, 0, 209, 183, 231, 211, 70, 192,
|
||||
19, 119, 235, 176, 19, 119, 238, 128, 19, 119, 235, 217, 19, 119, 235, 204, 19, 119, 235, 180, 19, 119, 235, 192, 181,
|
||||
48, 28, 4, 72, 15, 28, 13, 104, 131, 104, 193, 176, 129, 24, 91, 24, 154, 105, 3, 43, 0, 209, 15, 104, 67, 43, 0, 209,
|
||||
7, 28, 32, 28, 41, 247, 255, 254, 147, 176, 1, 188, 48, 188, 2, 71, 8, 28, 32, 28, 41, 247, 255, 254, 161, 231, 246,
|
||||
28, 32, 28, 41, 240, 0, 250, 118, 231, 241, 70, 192, 19, 119, 238, 132, 181, 240, 70, 95, 70, 86, 70, 77, 70, 68, 180,
|
||||
240, 176, 129, 28, 4, 70, 139, 72, 48, 33, 1, 70, 145, 247, 255, 253, 248, 70, 130, 40, 0, 219, 74, 120, 35, 43, 0,
|
||||
208, 80, 77, 43, 34, 0, 84, 171, 52, 1, 120, 35, 50, 1, 43, 0, 209, 249, 28, 87, 35, 10, 70, 72, 84, 171, 40, 0, 221,
|
||||
45, 35, 15, 38, 0, 70, 152, 224, 24, 28, 122, 28, 81, 28, 59, 28, 79, 32, 48, 84, 232, 70, 88, 93, 131, 70, 64, 64,
|
||||
3, 51, 48, 84, 171, 43, 57, 217, 1, 51, 7, 84, 171, 70, 67, 64, 51, 43, 15, 208, 16, 35, 32, 54, 1, 84, 107, 69, 177,
|
||||
221, 16, 47, 252, 221, 228, 28, 58, 28, 41, 70, 80, 247, 255, 253, 200, 39, 3, 35, 0, 34, 1, 33, 2, 231, 222, 35, 10,
|
||||
54, 1, 84, 107, 69, 177, 220, 238, 28, 32, 28, 57, 247, 255, 253, 166, 70, 80, 28, 41, 28, 58, 247, 255, 253, 181, 70,
|
||||
80, 247, 255, 253, 154, 176, 1, 188, 60, 70, 144, 70, 153, 70, 162, 70, 171, 188, 240, 188, 1, 71, 0, 34, 0, 39, 1,
|
||||
77, 2, 231, 179, 70, 192, 19, 119, 235, 232, 19, 119, 239, 32, 181, 240, 70, 71, 180, 128, 79, 33, 28, 4, 104, 59, 70,
|
||||
152, 43, 0, 209, 17, 35, 1, 96, 59, 33, 32, 247, 255, 253, 142, 104, 227, 43, 8, 208, 12, 28, 32, 240, 0, 250, 241,
|
||||
70, 67, 96, 59, 188, 4, 70, 144, 188, 240, 188, 2, 71, 8, 240, 0, 250, 232, 231, 247, 28, 33, 72, 20, 49, 12, 34, 4,
|
||||
247, 255, 255, 110, 34, 32, 28, 33, 72, 17, 247, 255, 255, 105, 105, 163, 104, 24, 104, 89, 247, 255, 253, 110, 105,
|
||||
163, 36, 197, 104, 27, 1, 164, 28, 32, 33, 8, 104, 93, 104, 30, 247, 255, 253, 100, 75, 9, 4, 45, 64, 30, 67, 53, 28,
|
||||
32, 96, 37, 33, 8, 247, 255, 253, 75, 70, 67, 96, 59, 32, 0, 231, 208, 70, 192, 19, 119, 238, 172, 19, 119, 235, 248,
|
||||
19, 119, 236, 4, 0, 0, 255, 255, 181, 16, 73, 21, 28, 4, 104, 139, 104, 202, 24, 154, 105, 11, 43, 0, 209, 18, 104,
|
||||
75, 43, 0, 209, 11, 33, 32, 247, 255, 253, 183, 40, 0, 219, 3, 105, 162, 75, 13, 66, 154, 208, 10, 188, 16, 188, 2,
|
||||
71, 8, 33, 32, 247, 255, 253, 193, 231, 242, 33, 32, 240, 0, 249, 151, 231, 238, 75, 7, 104, 27, 104, 26, 35, 1, 112,
|
||||
19, 120, 83, 43, 0, 209, 236, 247, 255, 253, 12, 231, 233, 70, 192, 19, 119, 238, 132, 93, 28, 158, 163, 19, 119, 224,
|
||||
8, 181, 240, 70, 87, 70, 70, 180, 192, 28, 4, 120, 0, 176, 129, 28, 14, 28, 23, 40, 224, 208, 24, 77, 133, 35, 0, 98,
|
||||
43, 28, 3, 59, 112, 43, 143, 217, 13, 28, 32, 28, 49, 28, 58, 240, 0, 250, 122, 28, 4, 176, 1, 28, 32, 188, 12, 70,
|
||||
144, 70, 154, 188, 240, 188, 2, 71, 8, 74, 123, 0, 155, 88, 211, 70, 159, 77, 120, 106, 43, 43, 0, 209, 2, 105, 43,
|
||||
43, 0, 208, 230, 28, 48, 33, 0, 28, 58, 240, 0, 248, 240, 106, 43, 224, 143, 104, 107, 43, 0, 209, 2, 105, 43, 43, 0,
|
||||
208, 217, 36, 0, 231, 221, 35, 1, 34, 37, 84, 171, 104, 43, 43, 0, 208, 0, 224, 173, 28, 32, 28, 58, 240, 0, 250, 76,
|
||||
28, 4, 34, 0, 35, 37, 84, 234, 44, 0, 209, 204, 224, 46, 104, 235, 104, 169, 70, 154, 105, 43, 70, 136, 43, 0, 209,
|
||||
0, 224, 176, 32, 0, 34, 0, 70, 67, 70, 81, 67, 11, 209, 2, 42, 0, 209, 0, 224, 176, 28, 3, 30, 90, 65, 147, 96, 107,
|
||||
28, 48, 28, 57, 247, 255, 255, 105, 28, 4, 231, 176, 105, 43, 43, 0, 208, 167, 35, 2, 224, 85, 104, 97, 104, 162, 40,
|
||||
208, 209, 0, 224, 144, 28, 48, 247, 255, 254, 122, 28, 4, 40, 0, 209, 160, 35, 37, 92, 235, 43, 0, 209, 156, 28, 48,
|
||||
28, 57, 247, 255, 253, 243, 231, 151, 35, 36, 92, 234, 42, 0, 209, 179, 105, 41, 84, 234, 35, 37, 96, 42, 96, 106, 96,
|
||||
170, 96, 234, 98, 42, 84, 234, 70, 136, 41, 0, 209, 0, 231, 128, 105, 108, 247, 255, 252, 148, 70, 64, 28, 41, 28, 34,
|
||||
56, 1, 49, 24, 240, 0, 249, 19, 28, 4, 231, 122, 104, 107, 43, 0, 208, 93, 75, 60, 36, 160, 98, 43, 2, 36, 231, 114,
|
||||
104, 107, 43, 0, 209, 3, 105, 43, 43, 0, 209, 0, 231, 101, 104, 99, 104, 162, 7, 155, 67, 19, 74, 53, 36, 0, 64, 19,
|
||||
96, 235, 231, 98, 104, 99, 72, 51, 64, 24, 247, 255, 252, 128, 28, 4, 231, 91, 104, 98, 35, 36, 84, 234, 36, 0, 231,
|
||||
86, 105, 43, 96, 51, 28, 48, 28, 57, 247, 255, 252, 69, 36, 0, 231, 78, 104, 99, 97, 43, 43, 0, 209, 40, 105, 99, 36,
|
||||
0, 97, 107, 231, 70, 104, 43, 231, 238, 104, 99, 36, 0, 96, 43, 231, 64, 104, 171, 231, 232, 104, 99, 36, 0, 96, 171,
|
||||
231, 58, 104, 107, 43, 0, 209, 3, 105, 43, 43, 0, 209, 0, 231, 45, 28, 48, 33, 0, 28, 58, 240, 0, 248, 55, 28, 48, 28,
|
||||
57, 247, 255, 252, 31, 36, 0, 231, 40, 104, 97, 104, 162, 28, 48, 247, 255, 253, 250, 28, 4, 231, 79, 28, 40, 28, 33,
|
||||
49, 8, 34, 6, 48, 24, 247, 255, 252, 19, 231, 206, 105, 43, 43, 0, 209, 158, 231, 15, 2, 201, 2, 82, 231, 107, 28, 58,
|
||||
28, 32, 28, 49, 240, 0, 249, 135, 28, 2, 30, 83, 65, 154, 231, 71, 105, 43, 43, 0, 208, 0, 231, 74, 96, 106, 36, 0,
|
||||
231, 2, 70, 192, 19, 119, 238, 132, 19, 119, 236, 12, 0, 5, 49, 0, 255, 255, 128, 0, 127, 255, 255, 255, 181, 240, 70,
|
||||
87, 70, 78, 70, 69, 180, 224, 70, 128, 28, 14, 70, 148, 42, 0, 208, 51, 33, 3, 28, 2, 64, 10, 35, 4, 26, 155, 28, 24,
|
||||
64, 8, 69, 96, 216, 49, 40, 0, 208, 49, 36, 0, 70, 67, 85, 30, 52, 1, 66, 160, 216, 250, 69, 132, 208, 32, 70, 99, 26,
|
||||
27, 8, 159, 70, 153, 0, 187, 70, 154, 43, 0, 208, 17, 4, 51, 6, 50, 2, 49, 67, 26, 67, 10, 28, 21, 70, 67, 67, 53, 24,
|
||||
26, 33, 0, 0, 139, 49, 1, 80, 213, 66, 185, 211, 250, 68, 84, 69, 209, 208, 6, 70, 67, 25, 24, 52, 1, 112, 6, 48, 1,
|
||||
69, 164, 216, 250, 188, 28, 70, 144, 70, 153, 70, 162, 188, 240, 188, 1, 71, 0, 70, 96, 231, 203, 36, 0, 231, 211, 70,
|
||||
192, 181, 48, 28, 5, 28, 12, 28, 16, 42, 0, 208, 12, 120, 42, 120, 11, 66, 154, 209, 12, 33, 0, 224, 3, 92, 106, 92,
|
||||
99, 66, 154, 209, 6, 49, 1, 66, 136, 216, 248, 32, 0, 188, 48, 188, 2, 71, 8, 32, 1, 66, 64, 231, 249, 181, 112, 76,
|
||||
17, 28, 6, 104, 32, 176, 130, 28, 13, 98, 2, 97, 6, 100, 1, 97, 65, 33, 68, 247, 255, 251, 123, 28, 48, 28, 41, 247,
|
||||
255, 251, 119, 75, 10, 34, 2, 104, 24, 104, 35, 73, 9, 147, 0, 35, 1, 247, 255, 251, 134, 28, 41, 28, 4, 28, 48, 247,
|
||||
255, 251, 121, 176, 2, 28, 32, 188, 112, 188, 2, 71, 8, 19, 119, 238, 176, 19, 119, 238, 180, 87, 70, 83, 2, 181, 240,
|
||||
176, 133, 28, 4, 28, 15, 146, 3, 40, 1, 217, 5, 32, 1, 66, 64, 176, 5, 188, 240, 188, 2, 71, 8, 77, 38, 104, 43, 43,
|
||||
0, 208, 65, 78, 37, 104, 48, 40, 0, 219, 1, 247, 255, 251, 67, 75, 35, 0, 162, 88, 208, 33, 1, 247, 255, 251, 77, 96,
|
||||
48, 40, 0, 219, 232, 104, 40, 28, 57, 34, 6, 48, 32, 247, 255, 251, 60, 104, 40, 169, 3, 34, 4, 48, 64, 247, 255, 251,
|
||||
54, 104, 42, 36, 4, 28, 19, 51, 32, 96, 19, 104, 42, 35, 6, 96, 83, 104, 42, 33, 68, 28, 19, 51, 64, 96, 147, 104, 43,
|
||||
96, 220, 104, 40, 247, 255, 251, 32, 104, 43, 104, 48, 34, 2, 147, 0, 73, 14, 35, 0, 247, 255, 251, 48, 104, 42, 28,
|
||||
19, 51, 32, 96, 19, 104, 43, 96, 92, 104, 42, 28, 19, 51, 64, 96, 147, 104, 43, 96, 220, 231, 181, 75, 7, 78, 3, 96,
|
||||
43, 35, 1, 66, 91, 96, 51, 231, 188, 19, 119, 238, 176, 19, 119, 238, 180, 19, 119, 238, 108, 87, 70, 83, 1, 19, 119,
|
||||
238, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233, 45, 64, 128, 229, 159, 112, 248, 229, 151, 112, 0, 235, 0, 0, 45,
|
||||
232, 189, 64, 128, 225, 47, 255, 30, 233, 45, 64, 128, 229, 159, 112, 228, 229, 151, 112, 0, 235, 0, 0, 39, 232, 189,
|
||||
64, 128, 225, 47, 255, 30, 233, 45, 64, 128, 229, 159, 112, 208, 229, 151, 112, 0, 235, 0, 0, 33, 232, 189, 64, 128,
|
||||
225, 47, 255, 30, 233, 45, 64, 128, 229, 159, 112, 188, 229, 151, 112, 0, 235, 0, 0, 27, 232, 189, 64, 128, 225, 47,
|
||||
255, 30, 233, 45, 64, 128, 229, 159, 112, 168, 229, 151, 112, 0, 235, 0, 0, 21, 232, 189, 64, 128, 225, 47, 255, 30,
|
||||
233, 45, 64, 128, 229, 159, 112, 148, 229, 151, 112, 0, 235, 0, 0, 15, 232, 189, 64, 128, 225, 47, 255, 30, 230, 0,
|
||||
8, 16, 225, 47, 255, 30, 230, 0, 7, 240, 225, 47, 255, 30, 230, 0, 3, 144, 225, 47, 255, 30, 230, 0, 3, 176, 225, 47,
|
||||
255, 30, 230, 0, 3, 208, 225, 47, 255, 30, 230, 0, 3, 240, 225, 47, 255, 30, 230, 0, 4, 80, 225, 47, 255, 30, 225, 47,
|
||||
255, 23, 180, 124, 181, 0, 247, 255, 252, 254, 188, 2, 188, 124, 71, 8, 181, 112, 176, 136, 104, 133, 28, 1, 75, 14,
|
||||
71, 24, 70, 192, 70, 114, 28, 1, 32, 4, 223, 171, 71, 16, 181, 240, 70, 95, 70, 86, 70, 77, 70, 68, 180, 240, 75, 8,
|
||||
104, 27, 71, 24, 19, 119, 224, 16, 19, 119, 224, 20, 19, 119, 224, 24, 19, 119, 224, 28, 19, 119, 224, 32, 19, 119,
|
||||
224, 36, 32, 16, 0, 213, 19, 119, 224, 12, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 70, 192, 0, 0, 1, 0, 44, 0,
|
||||
0, 0, 72, 0, 2, 20, 60, 96, 128, 0, 44, 0, 0, 0, 64, 130, 2, 20, 60, 96, 128, 0, 4, 56, 96, 0, 1, 72, 0, 2, 68, 56,
|
||||
97, 0, 24, 12, 56, 96, 0, 1, 72, 0, 2, 68, 56, 97, 0, 24, 0, 0, 47, 100, 101, 118, 47, 102, 97, 116, 47, 108, 111, 103,
|
||||
0, 0, 0, 0, 69, 83, 95, 105, 111, 99, 116, 108, 118, 0, 0, 0, 100, 117, 109, 112, 0, 0, 0, 0, 19, 119, 230, 232, 19,
|
||||
119, 230, 196, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 186, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 30, 19, 119, 230, 116, 19,
|
||||
119, 231, 80, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 40, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 231, 138, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 40, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 180, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 231, 40, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 154, 19, 119, 230, 116, 19, 119,
|
||||
230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 154, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 232, 10, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116,
|
||||
19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19,
|
||||
119, 230, 116, 19, 119, 230, 116, 19, 119, 232, 2, 19, 119, 231, 254, 19, 119, 231, 246, 19, 119, 231, 242, 19, 119,
|
||||
231, 226, 19, 119, 231, 210, 19, 119, 231, 200, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230,
|
||||
116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 230, 116, 19, 119, 231, 186, 47, 100, 101, 118,
|
||||
47, 117, 115, 98, 47, 101, 104, 99, 0, 0, 0, 0, 47, 100, 101, 118, 47, 115, 100, 105, 111, 47, 115, 100, 104, 99, 0,
|
||||
0, 19, 119, 238, 76, 19, 119, 238, 92
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,63 +28,59 @@ static s32 mload_fd = -1;
|
||||
|
||||
// to init/test if the device is running
|
||||
|
||||
int mload_init()
|
||||
{
|
||||
int n;
|
||||
int mload_init() {
|
||||
int n;
|
||||
|
||||
if(mload_fd>=0) return 0;
|
||||
if (mload_fd>=0) return 0;
|
||||
|
||||
for(n=0;n<10;n++) // try 2.5 seconds
|
||||
{
|
||||
mload_fd=IOS_Open(mload_fs, 0);
|
||||
for (n=0;n<10;n++) { // try 2.5 seconds
|
||||
mload_fd=IOS_Open(mload_fs, 0);
|
||||
|
||||
if(mload_fd>=0) break;
|
||||
if (mload_fd>=0) break;
|
||||
|
||||
usleep(250*1000);
|
||||
}
|
||||
usleep(250*1000);
|
||||
}
|
||||
|
||||
return mload_fd;
|
||||
return mload_fd;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// to close the device (remember call it when rebooting the IOS!)
|
||||
|
||||
int mload_close()
|
||||
{
|
||||
int ret;
|
||||
int mload_close() {
|
||||
int ret;
|
||||
|
||||
if(mload_fd<0) return -1;
|
||||
if (mload_fd<0) return -1;
|
||||
|
||||
ret=IOS_Close(mload_fd);
|
||||
ret=IOS_Close(mload_fd);
|
||||
|
||||
mload_fd=-1;
|
||||
mload_fd=-1;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// to get the thread id of mload
|
||||
|
||||
int mload_get_thread_id()
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_get_thread_id() {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_MLOAD_THREAD_ID, ":");
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_MLOAD_THREAD_ID, ":");
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@ -92,24 +88,23 @@ return ret;
|
||||
|
||||
// get the base and the size of the memory readable/writable to load modules
|
||||
|
||||
int mload_get_load_base(u32 *starlet_base, int *size)
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_get_load_base(u32 *starlet_base, int *size) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_GET_LOAD_BASE, ":ii",starlet_base, size);
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_GET_LOAD_BASE, ":ii",starlet_base, size);
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@ -118,38 +113,43 @@ return ret;
|
||||
// load and run a module from starlet (it need to allocate MEM2 to send the elf file)
|
||||
// the module must be a elf made with stripios
|
||||
|
||||
int mload_module(void *addr, int len)
|
||||
{
|
||||
int ret;
|
||||
void *buf=NULL;
|
||||
s32 hid = -1;
|
||||
int mload_module(void *addr, int len) {
|
||||
int ret;
|
||||
void *buf=NULL;
|
||||
s32 hid = -1;
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(len+0x800);
|
||||
hid = iosCreateHeap(len+0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
buf= iosAlloc(hid, len);
|
||||
buf= iosAlloc(hid, len);
|
||||
|
||||
if(!buf) {ret= -1;goto out;}
|
||||
if (!buf) {
|
||||
ret= -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
memcpy(buf, addr,len);
|
||||
memcpy(buf, addr,len);
|
||||
|
||||
ret = IOS_IoctlvFormat(hid, mload_fd, MLOAD_LOAD_MODULE, ":d", buf, len);
|
||||
ret = IOS_IoctlvFormat(hid, mload_fd, MLOAD_LOAD_MODULE, ":d", buf, len);
|
||||
|
||||
if(ret<0) goto out;
|
||||
if (ret<0) goto out;
|
||||
|
||||
ret=IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_MODULE, ":");
|
||||
ret=IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_MODULE, ":");
|
||||
|
||||
if(ret<0) {ret= -666;goto out;}
|
||||
if (ret<0) {
|
||||
ret= -666;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@ -158,119 +158,110 @@ return ret;
|
||||
// load a module from the PPC
|
||||
// the module must be a elf made with stripios
|
||||
|
||||
int mload_elf(void *my_elf, data_elf *data_elf)
|
||||
{
|
||||
int n,m;
|
||||
int p;
|
||||
u8 *adr;
|
||||
u32 elf=(u32) my_elf;
|
||||
int mload_elf(void *my_elf, data_elf *data_elf) {
|
||||
int n,m;
|
||||
int p;
|
||||
u8 *adr;
|
||||
u32 elf=(u32) my_elf;
|
||||
|
||||
if(elf & 3) return -1; // aligned to 4 please!
|
||||
if (elf & 3) return -1; // aligned to 4 please!
|
||||
|
||||
elfheader *head=(void *) elf;
|
||||
elfphentry *entries;
|
||||
elfheader *head=(void *) elf;
|
||||
elfphentry *entries;
|
||||
|
||||
if(head->ident0!=0x7F454C46) return -1;
|
||||
if(head->ident1!=0x01020161) return -1;
|
||||
if(head->ident2!=0x01000000) return -1;
|
||||
if (head->ident0!=0x7F454C46) return -1;
|
||||
if (head->ident1!=0x01020161) return -1;
|
||||
if (head->ident2!=0x01000000) return -1;
|
||||
|
||||
p=head->phoff;
|
||||
p=head->phoff;
|
||||
|
||||
data_elf->start=(void *) head->entry;
|
||||
data_elf->start=(void *) head->entry;
|
||||
|
||||
for(n=0; n<head->phnum; n++)
|
||||
{
|
||||
entries=(void *) (elf+p);
|
||||
p+=sizeof(elfphentry);
|
||||
for (n=0; n<head->phnum; n++) {
|
||||
entries=(void *) (elf+p);
|
||||
p+=sizeof(elfphentry);
|
||||
|
||||
if(entries->type == 4)
|
||||
{
|
||||
adr=(void *) (elf + entries->offset);
|
||||
if (entries->type == 4) {
|
||||
adr=(void *) (elf + entries->offset);
|
||||
|
||||
if(getbe32(0)!=0) return -2; // bad info (sure)
|
||||
if (getbe32(0)!=0) return -2; // bad info (sure)
|
||||
|
||||
for(m=4; m < entries->memsz; m+=8)
|
||||
{
|
||||
switch(getbe32(m))
|
||||
{
|
||||
case 0x9:
|
||||
data_elf->start= (void *) getbe32(m+4);
|
||||
break;
|
||||
case 0x7D:
|
||||
data_elf->prio= getbe32(m+4);
|
||||
break;
|
||||
case 0x7E:
|
||||
data_elf->size_stack= getbe32(m+4);
|
||||
break;
|
||||
case 0x7F:
|
||||
data_elf->stack= (void *) (getbe32(m+4));
|
||||
break;
|
||||
for (m=4; m < entries->memsz; m+=8) {
|
||||
switch (getbe32(m)) {
|
||||
case 0x9:
|
||||
data_elf->start= (void *) getbe32(m+4);
|
||||
break;
|
||||
case 0x7D:
|
||||
data_elf->prio= getbe32(m+4);
|
||||
break;
|
||||
case 0x7E:
|
||||
data_elf->size_stack= getbe32(m+4);
|
||||
break;
|
||||
case 0x7F:
|
||||
data_elf->stack= (void *) (getbe32(m+4));
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if(entries->type == 1 && entries->memsz != 0 && entries->vaddr!=0)
|
||||
{
|
||||
} else
|
||||
if (entries->type == 1 && entries->memsz != 0 && entries->vaddr!=0) {
|
||||
|
||||
if(mload_memset((void *) entries->vaddr, 0, entries->memsz)<0) return -1;
|
||||
if(mload_seek(entries->vaddr, SEEK_SET)<0) return -1;
|
||||
if(mload_write((void *) (elf + entries->offset), entries->filesz)<0) return -1;
|
||||
if (mload_memset((void *) entries->vaddr, 0, entries->memsz)<0) return -1;
|
||||
if (mload_seek(entries->vaddr, SEEK_SET)<0) return -1;
|
||||
if (mload_write((void *) (elf + entries->offset), entries->filesz)<0) return -1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// run one thread (you can use to load modules or binary files)
|
||||
|
||||
int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority)
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_THREAD, "iiii:", starlet_addr,starlet_top_stack, stack_size, priority);
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_RUN_THREAD, "iiii:", starlet_addr,starlet_top_stack, stack_size, priority);
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// stops one starlet thread
|
||||
|
||||
int mload_stop_thread(int id)
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_stop_thread(int id) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_STOP_THREAD, "i:", id);
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_STOP_THREAD, "i:", id);
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@ -278,154 +269,145 @@ return ret;
|
||||
|
||||
// continue one stopped starlet thread
|
||||
|
||||
int mload_continue_thread(int id)
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_continue_thread(int id) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_CONTINUE_THREAD, "i:", id);
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_CONTINUE_THREAD, "i:", id);
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// fix starlet address to read/write (uses SEEK_SET, etc as mode)
|
||||
|
||||
int mload_seek(int offset, int mode)
|
||||
{
|
||||
if(mload_init()<0) return -1;
|
||||
return IOS_Seek(mload_fd, offset, mode);
|
||||
int mload_seek(int offset, int mode) {
|
||||
if (mload_init()<0) return -1;
|
||||
return IOS_Seek(mload_fd, offset, mode);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// read bytes from starlet (it update the offset)
|
||||
|
||||
int mload_read(void* buf, u32 size)
|
||||
{
|
||||
if(mload_init()<0) return -1;
|
||||
return IOS_Read(mload_fd, buf, size);
|
||||
int mload_read(void* buf, u32 size) {
|
||||
if (mload_init()<0) return -1;
|
||||
return IOS_Read(mload_fd, buf, size);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// write bytes from starlet (it update the offset)
|
||||
|
||||
int mload_write(const void * buf, u32 size)
|
||||
{
|
||||
if(mload_init()<0) return -1;
|
||||
return IOS_Write(mload_fd, buf, size);
|
||||
int mload_write(const void * buf, u32 size) {
|
||||
if (mload_init()<0) return -1;
|
||||
return IOS_Write(mload_fd, buf, size);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// fill a block (similar to memset)
|
||||
|
||||
int mload_memset(void *starlet_addr, int set, int len)
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_memset(void *starlet_addr, int set, int len) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_MEMSET, "iii:", starlet_addr, set, len);
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_MEMSET, "iii:", starlet_addr, set, len);
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// get the ehci datas ( ehcmodule.elf uses this address)
|
||||
|
||||
void * mload_get_ehci_data()
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
void * mload_get_ehci_data() {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return NULL;
|
||||
if (mload_init()<0) return NULL;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return NULL;
|
||||
if (hid<0) return NULL;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_GET_EHCI_DATA, ":");
|
||||
if(ret<0) return NULL;
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_GET_EHCI_DATA, ":");
|
||||
if (ret<0) return NULL;
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return (void *) ret;
|
||||
return (void *) ret;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// set the dev/es ioctlv in routine
|
||||
|
||||
int mload_set_ES_ioctlv_vector(void *starlet_addr)
|
||||
{
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
int mload_set_ES_ioctlv_vector(void *starlet_addr) {
|
||||
int ret;
|
||||
s32 hid = -1;
|
||||
|
||||
|
||||
if(mload_init()<0) return -1;
|
||||
if (mload_init()<0) return -1;
|
||||
|
||||
hid = iosCreateHeap(0x800);
|
||||
hid = iosCreateHeap(0x800);
|
||||
|
||||
if(hid<0) return hid;
|
||||
if (hid<0) return hid;
|
||||
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_SET_ES_IOCTLV, "i:", starlet_addr);
|
||||
ret= IOS_IoctlvFormat(hid, mload_fd, MLOAD_SET_ES_IOCTLV, "i:", starlet_addr);
|
||||
|
||||
|
||||
iosDestroyHeap(hid);
|
||||
iosDestroyHeap(hid);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32 ios_36[16] ATTRIBUTE_ALIGN(32)=
|
||||
{
|
||||
0, // DI_EmulateCmd
|
||||
0,
|
||||
0x2022DDAC, // dvd_read_controlling_data
|
||||
0x20201010+1, // handle_di_cmd_reentry (thumb)
|
||||
0x20200b9c+1, // ios_shared_alloc_aligned (thumb)
|
||||
0x20200b70+1, // ios_shared_free (thumb)
|
||||
0x20205dc0+1, // ios_memcpy (thumb)
|
||||
0x20200048+1, // ios_fatal_di_error (thumb)
|
||||
0x20202b4c+1, // ios_doReadHashEncryptedState (thumb)
|
||||
0x20203934+1, // ios_printf (thumb)
|
||||
static u32 ios_36[16] ATTRIBUTE_ALIGN(32)= {
|
||||
0, // DI_EmulateCmd
|
||||
0,
|
||||
0x2022DDAC, // dvd_read_controlling_data
|
||||
0x20201010+1, // handle_di_cmd_reentry (thumb)
|
||||
0x20200b9c+1, // ios_shared_alloc_aligned (thumb)
|
||||
0x20200b70+1, // ios_shared_free (thumb)
|
||||
0x20205dc0+1, // ios_memcpy (thumb)
|
||||
0x20200048+1, // ios_fatal_di_error (thumb)
|
||||
0x20202b4c+1, // ios_doReadHashEncryptedState (thumb)
|
||||
0x20203934+1, // ios_printf (thumb)
|
||||
};
|
||||
|
||||
static u32 ios_38[16] ATTRIBUTE_ALIGN(32)=
|
||||
{
|
||||
0, // DI_EmulateCmd
|
||||
0,
|
||||
0x2022cdac, // dvd_read_controlling_data
|
||||
0x20200d38+1, // handle_di_cmd_reentry (thumb)
|
||||
0x202008c4+1, // ios_shared_alloc_aligned (thumb)
|
||||
0x20200898+1, // ios_shared_free (thumb)
|
||||
0x20205b80+1, // ios_memcpy (thumb)
|
||||
0x20200048+1, // ios_fatal_di_error (thumb)
|
||||
0x20202874+1, // ios_doReadHashEncryptedState (thumb)
|
||||
0x2020365c+1, // ios_printf (thumb)
|
||||
static u32 ios_38[16] ATTRIBUTE_ALIGN(32)= {
|
||||
0, // DI_EmulateCmd
|
||||
0,
|
||||
0x2022cdac, // dvd_read_controlling_data
|
||||
0x20200d38+1, // handle_di_cmd_reentry (thumb)
|
||||
0x202008c4+1, // ios_shared_alloc_aligned (thumb)
|
||||
0x20200898+1, // ios_shared_free (thumb)
|
||||
0x20205b80+1, // ios_memcpy (thumb)
|
||||
0x20200048+1, // ios_fatal_di_error (thumb)
|
||||
0x20202874+1, // ios_doReadHashEncryptedState (thumb)
|
||||
0x2020365c+1, // ios_printf (thumb)
|
||||
};
|
||||
|
||||
|
||||
@ -433,62 +415,57 @@ int load_ehc_module() {
|
||||
|
||||
int is_ios=0;
|
||||
|
||||
if(mload_module(ehcmodule, size_ehcmodule)<0) return -1;
|
||||
usleep(350*1000);
|
||||
if (mload_module(ehcmodule, size_ehcmodule)<0) return -1;
|
||||
usleep(350*1000);
|
||||
|
||||
|
||||
// Test for IOS
|
||||
// Test for IOS
|
||||
|
||||
mload_seek(0x20207c84, SEEK_SET);
|
||||
mload_read(patch_datas, 4);
|
||||
if(patch_datas[0]==0x6e657665)
|
||||
{
|
||||
is_ios=38;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_ios=36;
|
||||
}
|
||||
mload_seek(0x20207c84, SEEK_SET);
|
||||
mload_read(patch_datas, 4);
|
||||
if (patch_datas[0]==0x6e657665) {
|
||||
is_ios=38;
|
||||
} else {
|
||||
is_ios=36;
|
||||
}
|
||||
|
||||
if(is_ios==36)
|
||||
{
|
||||
// IOS 36
|
||||
memcpy(ios_36, dip_plugin, 4); // copy the entry_point
|
||||
memcpy(dip_plugin, ios_36, 4*10); // copy the adresses from the array
|
||||
if (is_ios==36) {
|
||||
// IOS 36
|
||||
memcpy(ios_36, dip_plugin, 4); // copy the entry_point
|
||||
memcpy(dip_plugin, ios_36, 4*10); // copy the adresses from the array
|
||||
|
||||
mload_seek(0x1377E000, SEEK_SET); // copy dip_plugin in the starlet
|
||||
mload_write(dip_plugin,size_dip_plugin);
|
||||
mload_seek(0x1377E000, SEEK_SET); // copy dip_plugin in the starlet
|
||||
mload_write(dip_plugin,size_dip_plugin);
|
||||
|
||||
// enables DIP plugin
|
||||
mload_seek(0x20209040, SEEK_SET);
|
||||
mload_write(ios_36, 4);
|
||||
// enables DIP plugin
|
||||
mload_seek(0x20209040, SEEK_SET);
|
||||
mload_write(ios_36, 4);
|
||||
|
||||
}
|
||||
if(is_ios==38)
|
||||
{
|
||||
// IOS 38
|
||||
}
|
||||
if (is_ios==38) {
|
||||
// IOS 38
|
||||
|
||||
memcpy(ios_38, dip_plugin, 4); // copy the entry_point
|
||||
memcpy(dip_plugin, ios_38, 4*10); // copy the adresses from the array
|
||||
memcpy(ios_38, dip_plugin, 4); // copy the entry_point
|
||||
memcpy(dip_plugin, ios_38, 4*10); // copy the adresses from the array
|
||||
|
||||
mload_seek(0x1377E000, SEEK_SET); // copy dip_plugin in the starlet
|
||||
mload_write(dip_plugin,size_dip_plugin);
|
||||
mload_seek(0x1377E000, SEEK_SET); // copy dip_plugin in the starlet
|
||||
mload_write(dip_plugin,size_dip_plugin);
|
||||
|
||||
// enables DIP plugin
|
||||
mload_seek(0x20208030, SEEK_SET);
|
||||
mload_write(ios_38, 4);
|
||||
// enables DIP plugin
|
||||
mload_seek(0x20208030, SEEK_SET);
|
||||
mload_write(ios_38, 4);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mload_close();
|
||||
mload_close();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int patch_cios_data() {
|
||||
|
||||
patch_datas[0]=*((u32 *) (dip_plugin+16*4));
|
||||
mload_set_ES_ioctlv_vector((void *) patch_datas[0]);
|
||||
return 1;
|
||||
mload_set_ES_ioctlv_vector((void *) patch_datas[0]);
|
||||
return 1;
|
||||
}
|
||||
|
@ -50,12 +50,11 @@ extern "C" {
|
||||
|
||||
#define getbe32(x) ((adr[x]<<24) | (adr[x+1]<<16) | (adr[x+2]<<8) | (adr[x+3]))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
u32 ident0;
|
||||
u32 ident1;
|
||||
u32 ident2;
|
||||
u32 ident3;
|
||||
u32 ident1;
|
||||
u32 ident2;
|
||||
u32 ident3;
|
||||
u32 machinetype;
|
||||
u32 version;
|
||||
u32 entry;
|
||||
@ -68,127 +67,125 @@ typedef struct
|
||||
u16 shentsize;
|
||||
u16 shnum;
|
||||
u16 shtrndx;
|
||||
} elfheader;
|
||||
} elfheader;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 type;
|
||||
u32 offset;
|
||||
u32 vaddr;
|
||||
u32 paddr;
|
||||
u32 filesz;
|
||||
u32 memsz;
|
||||
u32 flags;
|
||||
u32 align;
|
||||
} elfphentry;
|
||||
typedef struct {
|
||||
u32 type;
|
||||
u32 offset;
|
||||
u32 vaddr;
|
||||
u32 paddr;
|
||||
u32 filesz;
|
||||
u32 memsz;
|
||||
u32 flags;
|
||||
u32 align;
|
||||
} elfphentry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *start;
|
||||
int prio;
|
||||
void *stack;
|
||||
int size_stack;
|
||||
} data_elf;
|
||||
typedef struct {
|
||||
void *start;
|
||||
int prio;
|
||||
void *stack;
|
||||
int size_stack;
|
||||
} data_elf;
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// to init/test if the device is running
|
||||
|
||||
int mload_init();
|
||||
int mload_init();
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// to close the device (remember call it when rebooting the IOS!)
|
||||
|
||||
int mload_close();
|
||||
int mload_close();
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// to get the thread id of mload
|
||||
|
||||
int mload_get_thread_id();
|
||||
int mload_get_thread_id();
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// get the base and the size of the memory readable/writable to load modules
|
||||
|
||||
int mload_get_load_base(u32 *starlet_base, int *size);
|
||||
int mload_get_load_base(u32 *starlet_base, int *size);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// load and run a module from starlet (it need to allocate MEM2 to send the elf file)
|
||||
// the module must be a elf made with stripios
|
||||
|
||||
int mload_module(void *addr, int len);
|
||||
int mload_module(void *addr, int len);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// load a module from the PPC
|
||||
// the module must be a elf made with stripios
|
||||
|
||||
int mload_elf(void *my_elf, data_elf *data_elf);
|
||||
int mload_elf(void *my_elf, data_elf *data_elf);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// run one thread (you can use to load modules or binary files)
|
||||
|
||||
int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority);
|
||||
int mload_run_thread(void *starlet_addr, void *starlet_top_stack, int stack_size, int priority);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// stops one starlet thread
|
||||
|
||||
int mload_stop_thread(int id);
|
||||
int mload_stop_thread(int id);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// continue one stopped starlet thread
|
||||
|
||||
int mload_continue_thread(int id);
|
||||
int mload_continue_thread(int id);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// fix starlet address to read/write (uses SEEK_SET, etc as mode)
|
||||
|
||||
int mload_seek(int offset, int mode);
|
||||
int mload_seek(int offset, int mode);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// read bytes from starlet (it update the offset)
|
||||
|
||||
int mload_read(void* buf, u32 size);
|
||||
int mload_read(void* buf, u32 size);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// write bytes from starlet (it update the offset)
|
||||
|
||||
int mload_write(const void * buf, u32 size);
|
||||
int mload_write(const void * buf, u32 size);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// fill a block (similar to memset)
|
||||
|
||||
int mload_memset(void *starlet_addr, int set, int len);
|
||||
int mload_memset(void *starlet_addr, int set, int len);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// get the ehci datas ( ehcmodule.elf uses this address)
|
||||
|
||||
void * mload_get_ehci_data();
|
||||
void * mload_get_ehci_data();
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// set the dev/es ioctlv in routine
|
||||
|
||||
int mload_set_ES_ioctlv_vector(void *starlet_addr);
|
||||
int mload_set_ES_ioctlv_vector(void *starlet_addr);
|
||||
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
int load_ehc_module();
|
||||
int patch_cios_data();
|
||||
/*--------------------------------------------------------------------------------------------------------------*/
|
||||
int load_ehc_module();
|
||||
int patch_cios_data();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -11,19 +11,18 @@
|
||||
#include "URL_List.h"
|
||||
|
||||
|
||||
URL_List::URL_List(const char * url)
|
||||
{
|
||||
URL_List::URL_List(const char * url) {
|
||||
Links = NULL;
|
||||
urlcount = 0;
|
||||
|
||||
if(!IsNetworkInit()) {
|
||||
if (!IsNetworkInit()) {
|
||||
urlcount = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
struct block file = downloadfile(url);
|
||||
|
||||
if(!file.data || !file.size) {
|
||||
if (!file.data || !file.size) {
|
||||
urlcount = -2;
|
||||
return;
|
||||
}
|
||||
@ -32,7 +31,7 @@ URL_List::URL_List(const char * url)
|
||||
char temp[1024];
|
||||
|
||||
Links = (Link_Info *) malloc(sizeof(Link_Info));
|
||||
if(!Links) {
|
||||
if (!Links) {
|
||||
free(file.data);
|
||||
urlcount = -3;
|
||||
return;
|
||||
@ -40,14 +39,14 @@ URL_List::URL_List(const char * url)
|
||||
|
||||
memset(&Links[urlcount], 0, sizeof(Link_Info));
|
||||
|
||||
while(cnt < file.size) {
|
||||
while (cnt < file.size) {
|
||||
|
||||
if(file.data[cnt] == '"' && file.data[cnt-1] == '=' && file.data[cnt-2] == 'f'
|
||||
&& file.data[cnt-3] == 'e' && file.data[cnt-4] == 'r' && file.data[cnt-5] == 'h') {
|
||||
if (file.data[cnt] == '"' && file.data[cnt-1] == '=' && file.data[cnt-2] == 'f'
|
||||
&& file.data[cnt-3] == 'e' && file.data[cnt-4] == 'r' && file.data[cnt-5] == 'h') {
|
||||
|
||||
u32 cnt2 = 0;
|
||||
cnt++;
|
||||
while(file.data[cnt] != '"' && cnt2 < 1024) {
|
||||
while (file.data[cnt] != '"' && cnt2 < 1024) {
|
||||
temp[cnt2] = file.data[cnt];
|
||||
cnt2++;
|
||||
cnt++;
|
||||
@ -56,8 +55,8 @@ URL_List::URL_List(const char * url)
|
||||
|
||||
Links = (Link_Info *) realloc(Links, (urlcount+1)*sizeof(Link_Info));
|
||||
|
||||
if(!Links) {
|
||||
for(int i = 0; i == urlcount; i++) {
|
||||
if (!Links) {
|
||||
for (int i = 0; i == urlcount; i++) {
|
||||
delete Links[i].URL;
|
||||
Links[i].URL = NULL;
|
||||
}
|
||||
@ -72,8 +71,8 @@ URL_List::URL_List(const char * url)
|
||||
|
||||
Links[urlcount].URL = new char[cnt2+1];
|
||||
|
||||
if(!Links[urlcount].URL) {
|
||||
for(int i = 0; i == urlcount; i++) {
|
||||
if (!Links[urlcount].URL) {
|
||||
for (int i = 0; i == urlcount; i++) {
|
||||
delete Links[i].URL;
|
||||
Links[i].URL = NULL;
|
||||
}
|
||||
@ -86,7 +85,7 @@ URL_List::URL_List(const char * url)
|
||||
|
||||
snprintf(Links[urlcount].URL, cnt2+1, "%s", temp);
|
||||
|
||||
if(strncmp(Links[urlcount].URL, "http://", strlen("http://")) != 0)
|
||||
if (strncmp(Links[urlcount].URL, "http://", strlen("http://")) != 0)
|
||||
Links[urlcount].direct = false;
|
||||
else
|
||||
Links[urlcount].direct = true;
|
||||
@ -99,40 +98,35 @@ URL_List::URL_List(const char * url)
|
||||
free(file.data);
|
||||
}
|
||||
|
||||
URL_List::~URL_List()
|
||||
{
|
||||
for(int i = 0; i == urlcount; i++) {
|
||||
URL_List::~URL_List() {
|
||||
for (int i = 0; i == urlcount; i++) {
|
||||
delete Links[i].URL;
|
||||
Links[i].URL = NULL;
|
||||
}
|
||||
|
||||
if(Links != NULL) {
|
||||
if (Links != NULL) {
|
||||
free(Links);
|
||||
Links = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char * URL_List::GetURL(int ind)
|
||||
{
|
||||
if(ind > urlcount || ind < 0 || !Links || urlcount <= 0)
|
||||
char * URL_List::GetURL(int ind) {
|
||||
if (ind > urlcount || ind < 0 || !Links || urlcount <= 0)
|
||||
return NULL;
|
||||
else
|
||||
return Links[ind].URL;
|
||||
}
|
||||
|
||||
int URL_List::GetURLCount()
|
||||
{
|
||||
int URL_List::GetURLCount() {
|
||||
return urlcount;
|
||||
}
|
||||
|
||||
static int ListCompare(const void *a, const void *b)
|
||||
{
|
||||
static int ListCompare(const void *a, const void *b) {
|
||||
Link_Info *ab = (Link_Info*) a;
|
||||
Link_Info *bb = (Link_Info*) b;
|
||||
|
||||
return stricmp((char *) ab->URL, (char *) bb->URL);
|
||||
return stricmp((char *) ab->URL, (char *) bb->URL);
|
||||
}
|
||||
void URL_List::SortList()
|
||||
{
|
||||
void URL_List::SortList() {
|
||||
qsort(Links, urlcount, sizeof(Link_Info), ListCompare);
|
||||
}
|
||||
|
@ -14,26 +14,25 @@ typedef struct {
|
||||
bool direct;
|
||||
} Link_Info;
|
||||
|
||||
class URL_List
|
||||
{
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param url from where to get the list of links
|
||||
URL_List(const char *url);
|
||||
//!Destructor
|
||||
~URL_List();
|
||||
//! Get the a filepath of the list
|
||||
//!\param list index
|
||||
char * GetURL(int index);
|
||||
//! Is it a direct URL or just a file or path under the main url
|
||||
bool IsDirectURL(int index);
|
||||
//! Get the number of links counted
|
||||
int GetURLCount();
|
||||
//! Sort list
|
||||
void SortList();
|
||||
protected:
|
||||
int urlcount;
|
||||
Link_Info *Links;
|
||||
class URL_List {
|
||||
public:
|
||||
//!Constructor
|
||||
//!\param url from where to get the list of links
|
||||
URL_List(const char *url);
|
||||
//!Destructor
|
||||
~URL_List();
|
||||
//! Get the a filepath of the list
|
||||
//!\param list index
|
||||
char * GetURL(int index);
|
||||
//! Is it a direct URL or just a file or path under the main url
|
||||
bool IsDirectURL(int index);
|
||||
//! Get the number of links counted
|
||||
int GetURLCount();
|
||||
//! Sort list
|
||||
void SortList();
|
||||
protected:
|
||||
int urlcount;
|
||||
Link_Info *Links;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -8,19 +8,18 @@
|
||||
* @param char* The domain name to resolve
|
||||
* @return u32 The ipaddress represented by four bytes inside an u32 (in network order)
|
||||
*/
|
||||
u32 getipbyname(char *domain)
|
||||
{
|
||||
//Care should be taken when using net_gethostbyname,
|
||||
//it returns a static buffer which makes it not threadsafe
|
||||
//TODO: implement some locking mechanism to make below code atomic
|
||||
struct hostent *host = net_gethostbyname(domain);
|
||||
|
||||
if(host == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 *ip = (u32*)host->h_addr_list[0];
|
||||
return *ip;
|
||||
u32 getipbyname(char *domain) {
|
||||
//Care should be taken when using net_gethostbyname,
|
||||
//it returns a static buffer which makes it not threadsafe
|
||||
//TODO: implement some locking mechanism to make below code atomic
|
||||
struct hostent *host = net_gethostbyname(domain);
|
||||
|
||||
if (host == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 *ip = (u32*)host->h_addr_list[0];
|
||||
return *ip;
|
||||
}
|
||||
|
||||
|
||||
@ -32,9 +31,9 @@ u32 getipbyname(char *domain)
|
||||
//The last resolved domain name will always be at the front
|
||||
//This will allow heavily used domainnames to always stay cached
|
||||
struct dnsentry {
|
||||
char *domain;
|
||||
u32 ip;
|
||||
struct dnsentry *nextnode;
|
||||
char *domain;
|
||||
u32 ip;
|
||||
struct dnsentry *nextnode;
|
||||
} ;
|
||||
|
||||
static struct dnsentry *firstdnsentry = NULL;
|
||||
@ -44,79 +43,71 @@ static int dnsentrycount = 0;
|
||||
* Performs the same function as getipbyname(),
|
||||
* except that it will prevent extremely expensive net_gethostbyname() calls by caching the result
|
||||
*/
|
||||
u32 getipbynamecached(char *domain)
|
||||
{
|
||||
//Search if this domainname is already cached
|
||||
struct dnsentry *node = firstdnsentry;
|
||||
struct dnsentry *previousnode = NULL;
|
||||
|
||||
while(node != NULL)
|
||||
{
|
||||
if(strcmp(node->domain, domain) == 0)
|
||||
{
|
||||
//DNS node found in the cache, move it to the front of the list
|
||||
if(previousnode != NULL)
|
||||
previousnode->nextnode = node->nextnode;
|
||||
|
||||
if(node != firstdnsentry)
|
||||
node->nextnode = firstdnsentry;
|
||||
firstdnsentry = node;
|
||||
|
||||
return node->ip;
|
||||
}
|
||||
//Go to the next element in the list
|
||||
previousnode = node;
|
||||
node = node->nextnode;
|
||||
}
|
||||
u32 ip = getipbyname(domain);
|
||||
|
||||
//No cache of this domain could be found, create a cache node and add it to the front of the cache
|
||||
struct dnsentry *newnode = malloc(sizeof(struct dnsentry));
|
||||
if(newnode == NULL) {
|
||||
return ip;
|
||||
}
|
||||
|
||||
newnode->ip = ip;
|
||||
newnode->domain = malloc(strlen(domain)+1);
|
||||
if(newnode->domain == NULL)
|
||||
{
|
||||
free(newnode);
|
||||
return ip;
|
||||
}
|
||||
strcpy(newnode->domain, domain);
|
||||
|
||||
newnode->nextnode = firstdnsentry;
|
||||
firstdnsentry = newnode;
|
||||
dnsentrycount++;
|
||||
u32 getipbynamecached(char *domain) {
|
||||
//Search if this domainname is already cached
|
||||
struct dnsentry *node = firstdnsentry;
|
||||
struct dnsentry *previousnode = NULL;
|
||||
|
||||
//If the cache grows too big delete the last (and probably least important) node of the list
|
||||
if(dnsentrycount > MAX_DNS_CACHE_ENTRIES)
|
||||
{
|
||||
struct dnsentry *node = firstdnsentry;
|
||||
struct dnsentry *previousnode = NULL;
|
||||
|
||||
//Fetch the last two elements of the list
|
||||
while(node->nextnode != NULL)
|
||||
{
|
||||
previousnode = node;
|
||||
node = node->nextnode;
|
||||
}
|
||||
|
||||
if(node == NULL)
|
||||
{
|
||||
printf("Configuration error, MAX_DNS_ENTRIES reached while the list is empty\n");
|
||||
exit(1);
|
||||
} else if(previousnode == NULL)
|
||||
{
|
||||
firstdnsentry = NULL;
|
||||
} else {
|
||||
previousnode->nextnode = NULL;
|
||||
}
|
||||
|
||||
free(node->domain);
|
||||
free(node);
|
||||
dnsentrycount--;
|
||||
}
|
||||
while (node != NULL) {
|
||||
if (strcmp(node->domain, domain) == 0) {
|
||||
//DNS node found in the cache, move it to the front of the list
|
||||
if (previousnode != NULL)
|
||||
previousnode->nextnode = node->nextnode;
|
||||
|
||||
return newnode->ip;
|
||||
if (node != firstdnsentry)
|
||||
node->nextnode = firstdnsentry;
|
||||
firstdnsentry = node;
|
||||
|
||||
return node->ip;
|
||||
}
|
||||
//Go to the next element in the list
|
||||
previousnode = node;
|
||||
node = node->nextnode;
|
||||
}
|
||||
u32 ip = getipbyname(domain);
|
||||
|
||||
//No cache of this domain could be found, create a cache node and add it to the front of the cache
|
||||
struct dnsentry *newnode = malloc(sizeof(struct dnsentry));
|
||||
if (newnode == NULL) {
|
||||
return ip;
|
||||
}
|
||||
|
||||
newnode->ip = ip;
|
||||
newnode->domain = malloc(strlen(domain)+1);
|
||||
if (newnode->domain == NULL) {
|
||||
free(newnode);
|
||||
return ip;
|
||||
}
|
||||
strcpy(newnode->domain, domain);
|
||||
|
||||
newnode->nextnode = firstdnsentry;
|
||||
firstdnsentry = newnode;
|
||||
dnsentrycount++;
|
||||
|
||||
//If the cache grows too big delete the last (and probably least important) node of the list
|
||||
if (dnsentrycount > MAX_DNS_CACHE_ENTRIES) {
|
||||
struct dnsentry *node = firstdnsentry;
|
||||
struct dnsentry *previousnode = NULL;
|
||||
|
||||
//Fetch the last two elements of the list
|
||||
while (node->nextnode != NULL) {
|
||||
previousnode = node;
|
||||
node = node->nextnode;
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
printf("Configuration error, MAX_DNS_ENTRIES reached while the list is empty\n");
|
||||
exit(1);
|
||||
} else if (previousnode == NULL) {
|
||||
firstdnsentry = NULL;
|
||||
} else {
|
||||
previousnode->nextnode = NULL;
|
||||
}
|
||||
|
||||
free(node->domain);
|
||||
free(node);
|
||||
dnsentrycount--;
|
||||
}
|
||||
|
||||
return newnode->ip;
|
||||
}
|
||||
|
@ -9,12 +9,11 @@
|
||||
#include <unistd.h> //usleep
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
u32 getipbyname(char *domain);
|
||||
u32 getipbynamecached(char *domain);
|
||||
u32 getipbyname(char *domain);
|
||||
u32 getipbynamecached(char *domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -11,19 +11,19 @@ const struct block emptyblock = {0, NULL};
|
||||
|
||||
// Write our message to the server
|
||||
static s32 send_message(s32 server, char *msg) {
|
||||
s32 bytes_transferred = 0;
|
||||
s32 bytes_transferred = 0;
|
||||
s32 remaining = strlen(msg);
|
||||
while (remaining) {
|
||||
if ((bytes_transferred = net_write(server, msg, remaining > NET_BUFFER_SIZE ? NET_BUFFER_SIZE : remaining)) > 0) {
|
||||
remaining -= bytes_transferred;
|
||||
usleep (20 * 1000);
|
||||
usleep (20 * 1000);
|
||||
} else if (bytes_transferred < 0) {
|
||||
return bytes_transferred;
|
||||
} else {
|
||||
return -ENODATA;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,22 +34,22 @@ static s32 send_message(s32 server, char *msg) {
|
||||
* @return s32 The connection to the server (negative number if connection could not be established)
|
||||
*/
|
||||
static s32 server_connect(u32 ipaddress, u32 socket_port) {
|
||||
//Initialize socket
|
||||
s32 connection = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
//Initialize socket
|
||||
s32 connection = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
if (connection < 0) return connection;
|
||||
|
||||
struct sockaddr_in connect_addr;
|
||||
memset(&connect_addr, 0, sizeof(connect_addr));
|
||||
connect_addr.sin_family = AF_INET;
|
||||
connect_addr.sin_port = socket_port;
|
||||
connect_addr.sin_addr.s_addr= ipaddress;
|
||||
struct sockaddr_in connect_addr;
|
||||
memset(&connect_addr, 0, sizeof(connect_addr));
|
||||
connect_addr.sin_family = AF_INET;
|
||||
connect_addr.sin_port = socket_port;
|
||||
connect_addr.sin_addr.s_addr= ipaddress;
|
||||
|
||||
//Attemt to open the socket
|
||||
if (net_connect(connection, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) == -1) {
|
||||
net_close(connection);
|
||||
return -1;
|
||||
}
|
||||
return connection;
|
||||
//Attemt to open the socket
|
||||
if (net_connect(connection, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) == -1) {
|
||||
net_close(connection);
|
||||
return -1;
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
//The amount of memory in bytes reserved initially to store the HTTP response in
|
||||
@ -67,179 +67,164 @@ static s32 server_connect(u32 ipaddress, u32 socket_port) {
|
||||
* @param s32 connection The connection identifier to suck the response out of
|
||||
* @return block A 'block' struct (see http.h) in which the buffer is located
|
||||
*/
|
||||
struct block read_message(s32 connection)
|
||||
{
|
||||
//Create a block of memory to put in the response
|
||||
struct block buffer;
|
||||
buffer.data = malloc(HTTP_BUFFER_SIZE);
|
||||
buffer.size = HTTP_BUFFER_SIZE;
|
||||
struct block read_message(s32 connection) {
|
||||
//Create a block of memory to put in the response
|
||||
struct block buffer;
|
||||
buffer.data = malloc(HTTP_BUFFER_SIZE);
|
||||
buffer.size = HTTP_BUFFER_SIZE;
|
||||
|
||||
if(buffer.data == NULL) {
|
||||
return emptyblock;
|
||||
}
|
||||
if (buffer.data == NULL) {
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//The offset variable always points to the first byte of memory that is free in the buffer
|
||||
u32 offset = 0;
|
||||
//The offset variable always points to the first byte of memory that is free in the buffer
|
||||
u32 offset = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
//Fill the buffer with a new batch of bytes from the connection,
|
||||
//starting from where we left of in the buffer till the end of the buffer
|
||||
s32 bytes_read = net_read(connection, buffer.data + offset, buffer.size - offset);
|
||||
while (1) {
|
||||
//Fill the buffer with a new batch of bytes from the connection,
|
||||
//starting from where we left of in the buffer till the end of the buffer
|
||||
s32 bytes_read = net_read(connection, buffer.data + offset, buffer.size - offset);
|
||||
|
||||
//Anything below 0 is an error in the connection
|
||||
if(bytes_read < 0)
|
||||
{
|
||||
//printf("Connection error from net_read() Errorcode: %i\n", bytes_read);
|
||||
return emptyblock;
|
||||
}
|
||||
//Anything below 0 is an error in the connection
|
||||
if (bytes_read < 0) {
|
||||
//printf("Connection error from net_read() Errorcode: %i\n", bytes_read);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//No more bytes were read into the buffer,
|
||||
//we assume this means the HTTP response is done
|
||||
if(bytes_read == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
//No more bytes were read into the buffer,
|
||||
//we assume this means the HTTP response is done
|
||||
if (bytes_read == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
offset += bytes_read;
|
||||
offset += bytes_read;
|
||||
|
||||
//Check if we have enough buffer left over,
|
||||
//if not expand it with an additional HTTP_BUFFER_GROWTH worth of bytes
|
||||
if(offset >= buffer.size)
|
||||
{
|
||||
buffer.size += HTTP_BUFFER_GROWTH;
|
||||
buffer.data = realloc(buffer.data, buffer.size);
|
||||
//Check if we have enough buffer left over,
|
||||
//if not expand it with an additional HTTP_BUFFER_GROWTH worth of bytes
|
||||
if (offset >= buffer.size) {
|
||||
buffer.size += HTTP_BUFFER_GROWTH;
|
||||
buffer.data = realloc(buffer.data, buffer.size);
|
||||
|
||||
if(buffer.data == NULL)
|
||||
{
|
||||
return emptyblock;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buffer.data == NULL) {
|
||||
return emptyblock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//At the end of above loop offset should be precisely the amount of bytes that were read from the connection
|
||||
buffer.size = offset;
|
||||
//At the end of above loop offset should be precisely the amount of bytes that were read from the connection
|
||||
buffer.size = offset;
|
||||
|
||||
//Shrink the size of the buffer so the data fits exactly in it
|
||||
realloc(buffer.data, buffer.size);
|
||||
//Shrink the size of the buffer so the data fits exactly in it
|
||||
realloc(buffer.data, buffer.size);
|
||||
|
||||
return buffer;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the contents of a URL to memory
|
||||
* This method is not threadsafe (because networking is not threadsafe on the Wii)
|
||||
*/
|
||||
struct block downloadfile(const char *url)
|
||||
{
|
||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||
if(strncmp(url, "http://", strlen("http://")) != 0)
|
||||
{
|
||||
//printf("URL '%s' doesn't start with 'http://'\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
struct block downloadfile(const char *url) {
|
||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
||||
//printf("URL '%s' doesn't start with 'http://'\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//Locate the path part of the url by searching for '/' past "http://"
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
//Locate the path part of the url by searching for '/' past "http://"
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
|
||||
//At the very least the url has to end with '/', ending with just a domain is invalid
|
||||
if(path == NULL)
|
||||
{
|
||||
//printf("URL '%s' has no PATH part\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
//At the very least the url has to end with '/', ending with just a domain is invalid
|
||||
if (path == NULL) {
|
||||
//printf("URL '%s' has no PATH part\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
|
||||
if(domainlength == 0)
|
||||
{
|
||||
//printf("No domain part in URL '%s'\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
if (domainlength == 0) {
|
||||
//printf("No domain part in URL '%s'\n", url);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
char domain[domainlength + 1];
|
||||
strncpy(domain, url + strlen("http://"), domainlength);
|
||||
domain[domainlength] = '\0';
|
||||
char domain[domainlength + 1];
|
||||
strncpy(domain, url + strlen("http://"), domainlength);
|
||||
domain[domainlength] = '\0';
|
||||
|
||||
//Parsing of the URL is done, start making an actual connection
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
//Parsing of the URL is done, start making an actual connection
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
|
||||
if(ipaddress == 0)
|
||||
{
|
||||
//printf("\ndomain %s could not be resolved", domain);
|
||||
return emptyblock;
|
||||
}
|
||||
if (ipaddress == 0) {
|
||||
//printf("\ndomain %s could not be resolved", domain);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
|
||||
s32 connection = server_connect(ipaddress, 80);
|
||||
s32 connection = server_connect(ipaddress, 80);
|
||||
|
||||
if(connection < 0) {
|
||||
//printf("Error establishing connection");
|
||||
return emptyblock;
|
||||
}
|
||||
if (connection < 0) {
|
||||
//printf("Error establishing connection");
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//Form a nice request header to send to the webserver
|
||||
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: WiiEarthh 1.0\r\n\r\n";;
|
||||
char header[strlen(headerformat) + strlen(domain) + strlen(path)];
|
||||
sprintf(header, headerformat, path, domain);
|
||||
//Form a nice request header to send to the webserver
|
||||
char* headerformat = "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: WiiEarthh 1.0\r\n\r\n";;
|
||||
char header[strlen(headerformat) + strlen(domain) + strlen(path)];
|
||||
sprintf(header, headerformat, path, domain);
|
||||
|
||||
//Do the request and get the response
|
||||
send_message(connection, header);
|
||||
struct block response = read_message(connection);
|
||||
net_close(connection);
|
||||
//Do the request and get the response
|
||||
send_message(connection, header);
|
||||
struct block response = read_message(connection);
|
||||
net_close(connection);
|
||||
|
||||
//Search for the 4-character sequence \r\n\r\n in the response which signals the start of the http payload (file)
|
||||
unsigned char *filestart = NULL;
|
||||
u32 filesize = 0;
|
||||
int i;
|
||||
for(i = 3; i < response.size; i++)
|
||||
{
|
||||
if(response.data[i] == '\n' &&
|
||||
response.data[i-1] == '\r' &&
|
||||
response.data[i-2] == '\n' &&
|
||||
response.data[i-3] == '\r')
|
||||
{
|
||||
filestart = response.data + i + 1;
|
||||
filesize = response.size - i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Search for the 4-character sequence \r\n\r\n in the response which signals the start of the http payload (file)
|
||||
unsigned char *filestart = NULL;
|
||||
u32 filesize = 0;
|
||||
int i;
|
||||
for (i = 3; i < response.size; i++) {
|
||||
if (response.data[i] == '\n' &&
|
||||
response.data[i-1] == '\r' &&
|
||||
response.data[i-2] == '\n' &&
|
||||
response.data[i-3] == '\r') {
|
||||
filestart = response.data + i + 1;
|
||||
filesize = response.size - i - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(filestart == NULL)
|
||||
{
|
||||
//printf("HTTP Response was without a file\n");
|
||||
free(response.data);
|
||||
return emptyblock;
|
||||
}
|
||||
if (filestart == NULL) {
|
||||
//printf("HTTP Response was without a file\n");
|
||||
free(response.data);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
//Copy the file part of the response into a new memoryblock to return
|
||||
struct block file;
|
||||
file.data = malloc(filesize);
|
||||
file.size = filesize;
|
||||
//Copy the file part of the response into a new memoryblock to return
|
||||
struct block file;
|
||||
file.data = malloc(filesize);
|
||||
file.size = filesize;
|
||||
|
||||
if(file.data == NULL)
|
||||
{
|
||||
//printf("No more memory to copy file from HTTP response\n");
|
||||
free(response.data);
|
||||
return emptyblock;
|
||||
}
|
||||
if (file.data == NULL) {
|
||||
//printf("No more memory to copy file from HTTP response\n");
|
||||
free(response.data);
|
||||
return emptyblock;
|
||||
}
|
||||
|
||||
memcpy(file.data, filestart, filesize);
|
||||
memcpy(file.data, filestart, filesize);
|
||||
|
||||
//Dispose of the original response
|
||||
free(response.data);
|
||||
//Dispose of the original response
|
||||
free(response.data);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
s32 GetConnection(char * domain) {
|
||||
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
if (ipaddress == 0) {
|
||||
return -1;
|
||||
}
|
||||
s32 connection = server_connect(ipaddress, 80);
|
||||
return connection;
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
s32 GetConnection(char * domain) {
|
||||
|
||||
u32 ipaddress = getipbynamecached(domain);
|
||||
if(ipaddress == 0) {
|
||||
return -1;
|
||||
}
|
||||
s32 connection = server_connect(ipaddress, 80);
|
||||
return connection;
|
||||
|
||||
}
|
||||
|
@ -7,25 +7,23 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "dns.h"
|
||||
|
||||
/**
|
||||
* A simple structure to keep track of the size of a malloc()ated block of memory
|
||||
*/
|
||||
struct block
|
||||
{
|
||||
u32 size;
|
||||
unsigned char *data;
|
||||
};
|
||||
/**
|
||||
* A simple structure to keep track of the size of a malloc()ated block of memory
|
||||
*/
|
||||
struct block {
|
||||
u32 size;
|
||||
unsigned char *data;
|
||||
};
|
||||
|
||||
extern const struct block emptyblock;
|
||||
extern const struct block emptyblock;
|
||||
|
||||
struct block downloadfile(const char *url);
|
||||
s32 GetConnection(char * domain);
|
||||
struct block downloadfile(const char *url);
|
||||
s32 GetConnection(char * domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -40,112 +40,107 @@ static bool networkHalt = true;
|
||||
***************************************************************************/
|
||||
void Initialize_Network(void) {
|
||||
|
||||
if(networkinitialized) return;
|
||||
if (networkinitialized) return;
|
||||
|
||||
s32 result;
|
||||
s32 result;
|
||||
|
||||
result = if_config(IP, NULL, NULL, true);
|
||||
|
||||
if(result < 0) {
|
||||
if (result < 0) {
|
||||
networkinitialized = false;
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
} else {
|
||||
networkinitialized = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Check if network was initialised
|
||||
***************************************************************************/
|
||||
bool IsNetworkInit(void)
|
||||
{
|
||||
bool IsNetworkInit(void) {
|
||||
return networkinitialized;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get network IP
|
||||
***************************************************************************/
|
||||
char * GetNetworkIP(void)
|
||||
{
|
||||
char * GetNetworkIP(void) {
|
||||
return IP;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get network IP
|
||||
***************************************************************************/
|
||||
bool ShutdownWC24()
|
||||
{
|
||||
bool ShutdownWC24() {
|
||||
bool onlinefix = IsNetworkInit();
|
||||
if(onlinefix) {
|
||||
s32 kd_fd, ret;
|
||||
STACK_ALIGN(u8, kd_buf, 0x20, 32);
|
||||
if (onlinefix) {
|
||||
s32 kd_fd, ret;
|
||||
STACK_ALIGN(u8, kd_buf, 0x20, 32);
|
||||
|
||||
kd_fd = IOS_Open("/dev/net/kd/request", 0);
|
||||
if (kd_fd >= 0) {
|
||||
ret = IOS_Ioctl(kd_fd, 7, NULL, 0, kd_buf, 0x20);
|
||||
if(ret >= 0)
|
||||
onlinefix = false; // fixed no IOS reload needed
|
||||
IOS_Close(kd_fd);
|
||||
}
|
||||
}
|
||||
return onlinefix;
|
||||
kd_fd = IOS_Open("/dev/net/kd/request", 0);
|
||||
if (kd_fd >= 0) {
|
||||
ret = IOS_Ioctl(kd_fd, 7, NULL, 0, kd_buf, 0x20);
|
||||
if (ret >= 0)
|
||||
onlinefix = false; // fixed no IOS reload needed
|
||||
IOS_Close(kd_fd);
|
||||
}
|
||||
}
|
||||
return onlinefix;
|
||||
}
|
||||
|
||||
s32 network_request(const char * request)
|
||||
{
|
||||
char buf[1024];
|
||||
char *ptr = NULL;
|
||||
s32 network_request(const char * request) {
|
||||
char buf[1024];
|
||||
char *ptr = NULL;
|
||||
|
||||
u32 cnt, size;
|
||||
s32 ret;
|
||||
u32 cnt, size;
|
||||
s32 ret;
|
||||
|
||||
/* Send request */
|
||||
ret = net_send(connection, request, strlen(request), 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Send request */
|
||||
ret = net_send(connection, request, strlen(request), 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Clear buffer */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
/* Clear buffer */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
/* Read HTTP header */
|
||||
for (cnt = 0; !strstr(buf, "\r\n\r\n"); cnt++)
|
||||
if (net_recv(connection, buf + cnt, 1, 0) <= 0)
|
||||
return -1;
|
||||
/* Read HTTP header */
|
||||
for (cnt = 0; !strstr(buf, "\r\n\r\n"); cnt++)
|
||||
if (net_recv(connection, buf + cnt, 1, 0) <= 0)
|
||||
return -1;
|
||||
|
||||
/* HTTP request OK? */
|
||||
if (!strstr(buf, "HTTP/1.1 200 OK"))
|
||||
return -1;
|
||||
/* Retrieve content size */
|
||||
ptr = strstr(buf, "Content-Length:");
|
||||
if (!ptr)
|
||||
return -1;
|
||||
/* HTTP request OK? */
|
||||
if (!strstr(buf, "HTTP/1.1 200 OK"))
|
||||
return -1;
|
||||
/* Retrieve content size */
|
||||
ptr = strstr(buf, "Content-Length:");
|
||||
if (!ptr)
|
||||
return -1;
|
||||
|
||||
sscanf(ptr, "Content-Length: %u", &size);
|
||||
return size;
|
||||
sscanf(ptr, "Content-Length: %u", &size);
|
||||
return size;
|
||||
}
|
||||
|
||||
s32 network_read(u8 *buf, u32 len)
|
||||
{
|
||||
u32 read = 0;
|
||||
s32 ret = -1;
|
||||
s32 network_read(u8 *buf, u32 len) {
|
||||
u32 read = 0;
|
||||
s32 ret = -1;
|
||||
|
||||
/* Data to be read */
|
||||
while (read < len) {
|
||||
/* Read network data */
|
||||
ret = net_read(connection, buf + read, len - read);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Data to be read */
|
||||
while (read < len) {
|
||||
/* Read network data */
|
||||
ret = net_read(connection, buf + read, len - read);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Read finished */
|
||||
if (!ret)
|
||||
break;
|
||||
/* Read finished */
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
/* Increment read variable */
|
||||
read += ret;
|
||||
}
|
||||
/* Increment read variable */
|
||||
read += ret;
|
||||
}
|
||||
|
||||
return read;
|
||||
return read;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -154,42 +149,39 @@ s32 network_read(u8 *buf, u32 len)
|
||||
s32 download_request(const char * url) {
|
||||
|
||||
//Check if the url starts with "http://", if not it is not considered a valid url
|
||||
if(strncmp(url, "http://", strlen("http://")) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (strncmp(url, "http://", strlen("http://")) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Locate the path part of the url by searching for '/' past "http://"
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
//Locate the path part of the url by searching for '/' past "http://"
|
||||
char *path = strchr(url + strlen("http://"), '/');
|
||||
|
||||
//At the very least the url has to end with '/', ending with just a domain is invalid
|
||||
if(path == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
//At the very least the url has to end with '/', ending with just a domain is invalid
|
||||
if (path == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
//Extract the domain part out of the url
|
||||
int domainlength = path - url - strlen("http://");
|
||||
|
||||
if(domainlength == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (domainlength == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
char domain[domainlength + 1];
|
||||
strncpy(domain, url + strlen("http://"), domainlength);
|
||||
domain[domainlength] = '\0';
|
||||
char domain[domainlength + 1];
|
||||
strncpy(domain, url + strlen("http://"), domainlength);
|
||||
domain[domainlength] = '\0';
|
||||
|
||||
connection = GetConnection(domain);
|
||||
if(connection < 0) {
|
||||
connection = GetConnection(domain);
|
||||
if (connection < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Form a nice request header to send to the webserver
|
||||
char header[strlen(path)+strlen(domain)+100];
|
||||
sprintf(header, "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", path, domain);
|
||||
char header[strlen(path)+strlen(domain)+100];
|
||||
sprintf(header, "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n", path, domain);
|
||||
|
||||
s32 filesize = network_request(header);
|
||||
s32 filesize = network_request(header);
|
||||
|
||||
return filesize;
|
||||
}
|
||||
@ -198,7 +190,7 @@ void CloseConnection() {
|
||||
|
||||
net_close(connection);
|
||||
|
||||
if(waitforanswer) {
|
||||
if (waitforanswer) {
|
||||
net_close(socket);
|
||||
waitforanswer = false;
|
||||
}
|
||||
@ -209,46 +201,42 @@ void CloseConnection() {
|
||||
***************************************************************************/
|
||||
int NetworkWait() {
|
||||
|
||||
if(!checkincomming)
|
||||
if (!checkincomming)
|
||||
return -3;
|
||||
|
||||
struct sockaddr_in sin;
|
||||
struct sockaddr_in client_address;
|
||||
socklen_t addrlen = sizeof(client_address);
|
||||
struct sockaddr_in sin;
|
||||
struct sockaddr_in client_address;
|
||||
socklen_t addrlen = sizeof(client_address);
|
||||
|
||||
//Open socket
|
||||
socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
//Open socket
|
||||
socket = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
||||
|
||||
if (socket == INVALID_SOCKET)
|
||||
{
|
||||
return socket;
|
||||
}
|
||||
if (socket == INVALID_SOCKET) {
|
||||
return socket;
|
||||
}
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(PORT);
|
||||
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons(PORT);
|
||||
sin.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
if (net_bind(socket, (struct sockaddr*)&sin, sizeof(sin)) < 0)
|
||||
{
|
||||
net_close(socket);
|
||||
return -1;
|
||||
}
|
||||
if (net_bind(socket, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
|
||||
net_close(socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (net_listen(socket, 3) < 0)
|
||||
{
|
||||
net_close(socket);
|
||||
return -1;
|
||||
}
|
||||
if (net_listen(socket, 3) < 0) {
|
||||
net_close(socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
connection = net_accept(socket, (struct sockaddr*)&client_address, &addrlen);
|
||||
|
||||
if (connection < 0)
|
||||
{
|
||||
net_close(connection);
|
||||
net_close(socket);
|
||||
return -4;
|
||||
if (connection < 0) {
|
||||
net_close(connection);
|
||||
net_close(socket);
|
||||
return -4;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
unsigned char haxx[9];
|
||||
//skip haxx
|
||||
@ -257,40 +245,39 @@ int NetworkWait() {
|
||||
waitforanswer = true;
|
||||
checkincomming = false;
|
||||
networkHalt = true;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Update check
|
||||
***************************************************************************/
|
||||
int CheckUpdate()
|
||||
{
|
||||
if(!networkinitialized)
|
||||
int CheckUpdate() {
|
||||
if (!networkinitialized)
|
||||
return -1;
|
||||
|
||||
int revnumber = 0;
|
||||
int currentrev = atoi(GetRev());
|
||||
|
||||
#ifdef NOTFULLCHANNEL
|
||||
struct block file = downloadfile("http://www.techjawa.com/usbloadergx/rev.txt");
|
||||
#else
|
||||
struct block file = downloadfile("http://www.techjawa.com/usbloadergx/wadrev.txt");
|
||||
#endif
|
||||
#ifdef NOTFULLCHANNEL
|
||||
struct block file = downloadfile("http://www.techjawa.com/usbloadergx/rev.txt");
|
||||
#else
|
||||
struct block file = downloadfile("http://www.techjawa.com/usbloadergx/wadrev.txt");
|
||||
#endif
|
||||
char revtxt[10];
|
||||
|
||||
u8 i;
|
||||
if(file.data != NULL) {
|
||||
for(i=0; i<9 || i < file.size; i++)
|
||||
revtxt[i] = file.data[i];
|
||||
u8 i;
|
||||
if (file.data != NULL) {
|
||||
for (i=0; i<9 || i < file.size; i++)
|
||||
revtxt[i] = file.data[i];
|
||||
revtxt[i] = 0;
|
||||
revnumber = atoi(revtxt);
|
||||
free(file.data);
|
||||
}
|
||||
}
|
||||
|
||||
if(revnumber > currentrev)
|
||||
//if(revnumber > 1)//for testing updates
|
||||
if (revnumber > currentrev)
|
||||
//if(revnumber > 1)//for testing updates
|
||||
return revnumber;
|
||||
else
|
||||
return -1;
|
||||
@ -299,56 +286,52 @@ int CheckUpdate()
|
||||
/****************************************************************************
|
||||
* HaltNetwork
|
||||
***************************************************************************/
|
||||
void HaltNetworkThread()
|
||||
{
|
||||
void HaltNetworkThread() {
|
||||
networkHalt = true;
|
||||
checkincomming = false;
|
||||
|
||||
if(waitforanswer)
|
||||
if (waitforanswer)
|
||||
CloseConnection();
|
||||
|
||||
// wait for thread to finish
|
||||
while(!LWP_ThreadIsSuspended(networkthread))
|
||||
usleep(100);
|
||||
// wait for thread to finish
|
||||
while (!LWP_ThreadIsSuspended(networkthread))
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ResumeNetworkThread
|
||||
***************************************************************************/
|
||||
void ResumeNetworkThread()
|
||||
{
|
||||
networkHalt = false;
|
||||
LWP_ResumeThread(networkthread);
|
||||
void ResumeNetworkThread() {
|
||||
networkHalt = false;
|
||||
LWP_ResumeThread(networkthread);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Resume NetworkWait
|
||||
***************************************************************************/
|
||||
void ResumeNetworkWait()
|
||||
{
|
||||
networkHalt = true;
|
||||
checkincomming = true;
|
||||
waitforanswer = true;
|
||||
infilesize = 0;
|
||||
connection = -1;
|
||||
LWP_ResumeThread(networkthread);
|
||||
void ResumeNetworkWait() {
|
||||
networkHalt = true;
|
||||
checkincomming = true;
|
||||
waitforanswer = true;
|
||||
infilesize = 0;
|
||||
connection = -1;
|
||||
LWP_ResumeThread(networkthread);
|
||||
}
|
||||
|
||||
/*********************************************************************************
|
||||
* Networkthread for background network initialize and update check with idle prio
|
||||
*********************************************************************************/
|
||||
static void * networkinitcallback(void *arg)
|
||||
{
|
||||
while(1) {
|
||||
static void * networkinitcallback(void *arg) {
|
||||
while (1) {
|
||||
|
||||
if(!checkincomming && networkHalt)
|
||||
if (!checkincomming && networkHalt)
|
||||
LWP_SuspendThread(networkthread);
|
||||
|
||||
Initialize_Network();
|
||||
|
||||
if(networkinitialized == true && updatechecked == false) {
|
||||
if (networkinitialized == true && updatechecked == false) {
|
||||
|
||||
if(CheckUpdate() > 0)
|
||||
if (CheckUpdate() > 0)
|
||||
updateavailable = true;
|
||||
|
||||
//suspend thread
|
||||
@ -357,25 +340,23 @@ static void * networkinitcallback(void *arg)
|
||||
checkincomming = false;
|
||||
}
|
||||
|
||||
if(checkincomming)
|
||||
if (checkincomming)
|
||||
NetworkWait();
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* InitNetworkThread with priority 0 (idle)
|
||||
***************************************************************************/
|
||||
void InitNetworkThread()
|
||||
{
|
||||
LWP_CreateThread (&networkthread, networkinitcallback, NULL, NULL, 0, 0);
|
||||
void InitNetworkThread() {
|
||||
LWP_CreateThread (&networkthread, networkinitcallback, NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ShutdownThread
|
||||
***************************************************************************/
|
||||
void ShutdownNetworkThread()
|
||||
{
|
||||
LWP_JoinThread (networkthread, NULL);
|
||||
networkthread = LWP_THREAD_NULL;
|
||||
void ShutdownNetworkThread() {
|
||||
LWP_JoinThread (networkthread, NULL);
|
||||
networkthread = LWP_THREAD_NULL;
|
||||
}
|
||||
|
@ -36,24 +36,23 @@
|
||||
|
||||
#define READ_SAMPLES 4096 // samples that it must read before to send
|
||||
#define MAX_PCMOUT 4096 // minimum size to read ogg samples
|
||||
typedef struct
|
||||
{
|
||||
OggVorbis_File vf;
|
||||
vorbis_info *vi;
|
||||
int current_section;
|
||||
typedef struct {
|
||||
OggVorbis_File vf;
|
||||
vorbis_info *vi;
|
||||
int current_section;
|
||||
|
||||
// OGG file operation
|
||||
int fd;
|
||||
int mode;
|
||||
int eof;
|
||||
int flag;
|
||||
int volume;
|
||||
int seek_time;
|
||||
// OGG file operation
|
||||
int fd;
|
||||
int mode;
|
||||
int eof;
|
||||
int flag;
|
||||
int volume;
|
||||
int seek_time;
|
||||
|
||||
/* OGG buffer control */
|
||||
short pcmout[2][READ_SAMPLES + MAX_PCMOUT * 2]; /* take 4k out of the data segment, not the stack */
|
||||
int pcmout_pos;
|
||||
int pcm_indx;
|
||||
/* OGG buffer control */
|
||||
short pcmout[2][READ_SAMPLES + MAX_PCMOUT * 2]; /* take 4k out of the data segment, not the stack */
|
||||
int pcmout_pos;
|
||||
int pcm_indx;
|
||||
|
||||
} private_data_ogg;
|
||||
|
||||
@ -68,213 +67,181 @@ static lwpq_t oggplayer_queue = LWP_THREAD_NULL;
|
||||
static lwp_t h_oggplayer = LWP_THREAD_NULL;
|
||||
static int ogg_thread_running = 0;
|
||||
|
||||
static void ogg_add_callback(int voice)
|
||||
{
|
||||
if (!ogg_thread_running)
|
||||
{
|
||||
ASND_StopVoice(0);
|
||||
return;
|
||||
}
|
||||
static void ogg_add_callback(int voice) {
|
||||
if (!ogg_thread_running) {
|
||||
ASND_StopVoice(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (private_ogg.flag & 128)
|
||||
return; // Ogg is paused
|
||||
if (private_ogg.flag & 128)
|
||||
return; // Ogg is paused
|
||||
|
||||
if (private_ogg.pcm_indx >= READ_SAMPLES)
|
||||
{
|
||||
if (ASND_AddVoice(0,
|
||||
(void *) private_ogg.pcmout[private_ogg.pcmout_pos],
|
||||
private_ogg.pcm_indx << 1) == 0)
|
||||
{
|
||||
private_ogg.pcmout_pos ^= 1;
|
||||
private_ogg.pcm_indx = 0;
|
||||
private_ogg.flag = 0;
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (private_ogg.flag & 64)
|
||||
{
|
||||
private_ogg.flag &= ~64;
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
if (private_ogg.pcm_indx >= READ_SAMPLES) {
|
||||
if (ASND_AddVoice(0,
|
||||
(void *) private_ogg.pcmout[private_ogg.pcmout_pos],
|
||||
private_ogg.pcm_indx << 1) == 0) {
|
||||
private_ogg.pcmout_pos ^= 1;
|
||||
private_ogg.pcm_indx = 0;
|
||||
private_ogg.flag = 0;
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
} else {
|
||||
if (private_ogg.flag & 64) {
|
||||
private_ogg.flag &= ~64;
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void * ogg_player_thread(private_data_ogg * priv)
|
||||
{
|
||||
int first_time = 1;
|
||||
long ret;
|
||||
static void * ogg_player_thread(private_data_ogg * priv) {
|
||||
int first_time = 1;
|
||||
long ret;
|
||||
|
||||
ogg_thread_running = 0;
|
||||
//init
|
||||
LWP_InitQueue(&oggplayer_queue);
|
||||
ogg_thread_running = 0;
|
||||
//init
|
||||
LWP_InitQueue(&oggplayer_queue);
|
||||
|
||||
priv[0].vi = ov_info(&priv[0].vf, -1);
|
||||
priv[0].vi = ov_info(&priv[0].vf, -1);
|
||||
|
||||
ASND_Pause(0);
|
||||
ASND_Pause(0);
|
||||
|
||||
priv[0].pcm_indx = 0;
|
||||
priv[0].pcmout_pos = 0;
|
||||
priv[0].eof = 0;
|
||||
priv[0].flag = 0;
|
||||
priv[0].current_section = 0;
|
||||
priv[0].pcm_indx = 0;
|
||||
priv[0].pcmout_pos = 0;
|
||||
priv[0].eof = 0;
|
||||
priv[0].flag = 0;
|
||||
priv[0].current_section = 0;
|
||||
|
||||
ogg_thread_running = 1;
|
||||
ogg_thread_running = 1;
|
||||
|
||||
while (!priv[0].eof && ogg_thread_running)
|
||||
{
|
||||
if (priv[0].flag)
|
||||
LWP_ThreadSleep(oggplayer_queue); // wait only when i have samples to send
|
||||
while (!priv[0].eof && ogg_thread_running) {
|
||||
if (priv[0].flag)
|
||||
LWP_ThreadSleep(oggplayer_queue); // wait only when i have samples to send
|
||||
|
||||
if (priv[0].flag == 0) // wait to all samples are sended
|
||||
{
|
||||
if (ASND_TestPointer(0, priv[0].pcmout[priv[0].pcmout_pos])
|
||||
&& ASND_StatusVoice(0) != SND_UNUSED)
|
||||
{
|
||||
priv[0].flag |= 64;
|
||||
continue;
|
||||
}
|
||||
if (priv[0].pcm_indx < READ_SAMPLES)
|
||||
{
|
||||
priv[0].flag = 3;
|
||||
if (priv[0].flag == 0) { // wait to all samples are sended
|
||||
if (ASND_TestPointer(0, priv[0].pcmout[priv[0].pcmout_pos])
|
||||
&& ASND_StatusVoice(0) != SND_UNUSED) {
|
||||
priv[0].flag |= 64;
|
||||
continue;
|
||||
}
|
||||
if (priv[0].pcm_indx < READ_SAMPLES) {
|
||||
priv[0].flag = 3;
|
||||
|
||||
if (priv[0].seek_time >= 0)
|
||||
{
|
||||
ov_time_seek(&priv[0].vf, priv[0].seek_time);
|
||||
priv[0].seek_time = -1;
|
||||
}
|
||||
if (priv[0].seek_time >= 0) {
|
||||
ov_time_seek(&priv[0].vf, priv[0].seek_time);
|
||||
priv[0].seek_time = -1;
|
||||
}
|
||||
|
||||
ret
|
||||
= ov_read(
|
||||
&priv[0].vf,
|
||||
(void *) &priv[0].pcmout[priv[0].pcmout_pos][priv[0].pcm_indx],
|
||||
MAX_PCMOUT,/*0,2,1,*/&priv[0].current_section);
|
||||
priv[0].flag &= 192;
|
||||
if (ret == 0)
|
||||
{
|
||||
/* EOF */
|
||||
if (priv[0].mode & 1)
|
||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||
else
|
||||
priv[0].eof = 1; // stops
|
||||
//
|
||||
}
|
||||
else if (ret < 0)
|
||||
{
|
||||
/* error in the stream. Not a problem, just reporting it in
|
||||
case we (the app) cares. In this case, we don't. */
|
||||
if (ret != OV_HOLE)
|
||||
{
|
||||
if (priv[0].mode & 1)
|
||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||
else
|
||||
priv[0].eof = 1; // stops
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we don't bother dealing with sample rate changes, etc, but
|
||||
you'll have to*/
|
||||
priv[0].pcm_indx += ret >> 1; //get 16 bits samples
|
||||
}
|
||||
}
|
||||
else
|
||||
priv[0].flag = 1;
|
||||
}
|
||||
ret
|
||||
= ov_read(
|
||||
&priv[0].vf,
|
||||
(void *) &priv[0].pcmout[priv[0].pcmout_pos][priv[0].pcm_indx],
|
||||
MAX_PCMOUT,/*0,2,1,*/&priv[0].current_section);
|
||||
priv[0].flag &= 192;
|
||||
if (ret == 0) {
|
||||
/* EOF */
|
||||
if (priv[0].mode & 1)
|
||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||
else
|
||||
priv[0].eof = 1; // stops
|
||||
//
|
||||
} else if (ret < 0) {
|
||||
/* error in the stream. Not a problem, just reporting it in
|
||||
case we (the app) cares. In this case, we don't. */
|
||||
if (ret != OV_HOLE) {
|
||||
if (priv[0].mode & 1)
|
||||
ov_time_seek(&priv[0].vf, 0); // repeat
|
||||
else
|
||||
priv[0].eof = 1; // stops
|
||||
}
|
||||
} else {
|
||||
/* we don't bother dealing with sample rate changes, etc, but
|
||||
you'll have to*/
|
||||
priv[0].pcm_indx += ret >> 1; //get 16 bits samples
|
||||
}
|
||||
} else
|
||||
priv[0].flag = 1;
|
||||
}
|
||||
|
||||
if (priv[0].flag == 1)
|
||||
{
|
||||
if (ASND_StatusVoice(0) == SND_UNUSED || first_time)
|
||||
{
|
||||
first_time = 0;
|
||||
if (priv[0].vi->channels == 2)
|
||||
{
|
||||
ASND_SetVoice(0, VOICE_STEREO_16BIT, priv[0].vi->rate, 0,
|
||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||
priv[0].pcm_indx << 1, priv[0].volume,
|
||||
priv[0].volume, ogg_add_callback);
|
||||
priv[0].pcmout_pos ^= 1;
|
||||
priv[0].pcm_indx = 0;
|
||||
priv[0].flag = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ASND_SetVoice(0, VOICE_MONO_16BIT, priv[0].vi->rate, 0,
|
||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||
priv[0].pcm_indx << 1, priv[0].volume,
|
||||
priv[0].volume, ogg_add_callback);
|
||||
priv[0].pcmout_pos ^= 1;
|
||||
priv[0].pcm_indx = 0;
|
||||
priv[0].flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
usleep(100);
|
||||
}
|
||||
ov_clear(&priv[0].vf);
|
||||
priv[0].fd = -1;
|
||||
priv[0].pcm_indx = 0;
|
||||
ogg_thread_running = 0;
|
||||
if (priv[0].flag == 1) {
|
||||
if (ASND_StatusVoice(0) == SND_UNUSED || first_time) {
|
||||
first_time = 0;
|
||||
if (priv[0].vi->channels == 2) {
|
||||
ASND_SetVoice(0, VOICE_STEREO_16BIT, priv[0].vi->rate, 0,
|
||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||
priv[0].pcm_indx << 1, priv[0].volume,
|
||||
priv[0].volume, ogg_add_callback);
|
||||
priv[0].pcmout_pos ^= 1;
|
||||
priv[0].pcm_indx = 0;
|
||||
priv[0].flag = 0;
|
||||
} else {
|
||||
ASND_SetVoice(0, VOICE_MONO_16BIT, priv[0].vi->rate, 0,
|
||||
(void *) priv[0].pcmout[priv[0].pcmout_pos],
|
||||
priv[0].pcm_indx << 1, priv[0].volume,
|
||||
priv[0].volume, ogg_add_callback);
|
||||
priv[0].pcmout_pos ^= 1;
|
||||
priv[0].pcm_indx = 0;
|
||||
priv[0].flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
usleep(100);
|
||||
}
|
||||
ov_clear(&priv[0].vf);
|
||||
priv[0].fd = -1;
|
||||
priv[0].pcm_indx = 0;
|
||||
ogg_thread_running = 0;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StopOgg()
|
||||
{
|
||||
ASND_StopVoice(0);
|
||||
ogg_thread_running = 0;
|
||||
void StopOgg() {
|
||||
ASND_StopVoice(0);
|
||||
ogg_thread_running = 0;
|
||||
|
||||
if(h_oggplayer != LWP_THREAD_NULL)
|
||||
{
|
||||
if(oggplayer_queue != LWP_TQUEUE_NULL)
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
LWP_JoinThread(h_oggplayer, NULL);
|
||||
h_oggplayer = LWP_THREAD_NULL;
|
||||
}
|
||||
if(oggplayer_queue != LWP_TQUEUE_NULL)
|
||||
{
|
||||
LWP_CloseQueue(oggplayer_queue);
|
||||
oggplayer_queue = LWP_TQUEUE_NULL;
|
||||
}
|
||||
if (h_oggplayer != LWP_THREAD_NULL) {
|
||||
if (oggplayer_queue != LWP_TQUEUE_NULL)
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
LWP_JoinThread(h_oggplayer, NULL);
|
||||
h_oggplayer = LWP_THREAD_NULL;
|
||||
}
|
||||
if (oggplayer_queue != LWP_TQUEUE_NULL) {
|
||||
LWP_CloseQueue(oggplayer_queue);
|
||||
oggplayer_queue = LWP_TQUEUE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int PlayOgg(int fd, int time_pos, int mode)
|
||||
{
|
||||
StopOgg();
|
||||
int PlayOgg(int fd, int time_pos, int mode) {
|
||||
StopOgg();
|
||||
|
||||
private_ogg.fd = fd;
|
||||
private_ogg.mode = mode;
|
||||
private_ogg.eof = 0;
|
||||
private_ogg.volume = 127;
|
||||
private_ogg.flag = 0;
|
||||
private_ogg.seek_time = -1;
|
||||
private_ogg.fd = fd;
|
||||
private_ogg.mode = mode;
|
||||
private_ogg.eof = 0;
|
||||
private_ogg.volume = 127;
|
||||
private_ogg.flag = 0;
|
||||
private_ogg.seek_time = -1;
|
||||
|
||||
if (time_pos > 0)
|
||||
private_ogg.seek_time = time_pos;
|
||||
if (time_pos > 0)
|
||||
private_ogg.seek_time = time_pos;
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
private_ogg.fd = -1;
|
||||
return -1;
|
||||
}
|
||||
if (ov_open((void *) &private_ogg.fd, &private_ogg.vf, NULL, 0) < 0)
|
||||
{
|
||||
mem_close(private_ogg.fd); // mem_close() can too close files from devices
|
||||
private_ogg.fd = -1;
|
||||
ogg_thread_running = 0;
|
||||
return -1;
|
||||
}
|
||||
if (fd < 0) {
|
||||
private_ogg.fd = -1;
|
||||
return -1;
|
||||
}
|
||||
if (ov_open((void *) &private_ogg.fd, &private_ogg.vf, NULL, 0) < 0) {
|
||||
mem_close(private_ogg.fd); // mem_close() can too close files from devices
|
||||
private_ogg.fd = -1;
|
||||
ogg_thread_running = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (LWP_CreateThread(&h_oggplayer, (void *) ogg_player_thread,
|
||||
&private_ogg, oggplayer_stack, STACKSIZE, 80) == -1)
|
||||
{
|
||||
ogg_thread_running = 0;
|
||||
ov_clear(&private_ogg.vf);
|
||||
private_ogg.fd = -1;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
if (LWP_CreateThread(&h_oggplayer, (void *) ogg_player_thread,
|
||||
&private_ogg, oggplayer_stack, STACKSIZE, 80) == -1) {
|
||||
ogg_thread_running = 0;
|
||||
ov_clear(&private_ogg.vf);
|
||||
private_ogg.fd = -1;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -289,7 +256,7 @@ int PlayOggFromFile(char * path, int loop) {
|
||||
pFile = fopen (path, "rb");
|
||||
|
||||
//Check that pFile exist
|
||||
if (pFile==NULL){
|
||||
if (pFile==NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -300,74 +267,70 @@ int PlayOggFromFile(char * path, int loop) {
|
||||
|
||||
// allocate memory to contain the whole file:
|
||||
bufferogg = (char*) malloc (sizeof(char)*filesize);
|
||||
if (bufferogg == NULL) {fputs (" Memory error",stderr); exit (2);}
|
||||
if (bufferogg == NULL) {
|
||||
fputs (" Memory error",stderr);
|
||||
exit (2);
|
||||
}
|
||||
|
||||
// copy the file into the buffer:
|
||||
resultogg = fread (bufferogg,1,filesize,pFile);
|
||||
if (resultogg != filesize) {fputs (" Reading error",stderr); exit (3);}
|
||||
if (resultogg != filesize) {
|
||||
fputs (" Reading error",stderr);
|
||||
exit (3);
|
||||
}
|
||||
|
||||
fclose (pFile);
|
||||
fclose (pFile);
|
||||
|
||||
if (loop)
|
||||
return PlayOgg(mem_open((char *)bufferogg, filesize), 0, OGG_INFINITE_TIME);
|
||||
return PlayOgg(mem_open((char *)bufferogg, filesize), 0, OGG_INFINITE_TIME);
|
||||
else
|
||||
return PlayOgg(mem_open((char *)bufferogg, filesize), 0, OGG_ONE_TIME);
|
||||
return PlayOgg(mem_open((char *)bufferogg, filesize), 0, OGG_ONE_TIME);
|
||||
}
|
||||
|
||||
|
||||
void PauseOgg(int pause)
|
||||
{
|
||||
if (pause)
|
||||
{
|
||||
private_ogg.flag |= 128;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (private_ogg.flag & 128)
|
||||
{
|
||||
private_ogg.flag |= 64;
|
||||
private_ogg.flag &= ~128;
|
||||
if (ogg_thread_running > 0)
|
||||
{
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
void PauseOgg(int pause) {
|
||||
if (pause) {
|
||||
private_ogg.flag |= 128;
|
||||
} else {
|
||||
if (private_ogg.flag & 128) {
|
||||
private_ogg.flag |= 64;
|
||||
private_ogg.flag &= ~128;
|
||||
if (ogg_thread_running > 0) {
|
||||
LWP_ThreadSignal(oggplayer_queue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int StatusOgg()
|
||||
{
|
||||
if (ogg_thread_running == 0)
|
||||
return -1; // Error
|
||||
else if (private_ogg.eof)
|
||||
return 255; // EOF
|
||||
else if (private_ogg.flag & 128)
|
||||
return 2; // paused
|
||||
else
|
||||
return 1; // running
|
||||
int StatusOgg() {
|
||||
if (ogg_thread_running == 0)
|
||||
return -1; // Error
|
||||
else if (private_ogg.eof)
|
||||
return 255; // EOF
|
||||
else if (private_ogg.flag & 128)
|
||||
return 2; // paused
|
||||
else
|
||||
return 1; // running
|
||||
}
|
||||
|
||||
void SetVolumeOgg(int volume)
|
||||
{
|
||||
private_ogg.volume = volume;
|
||||
ASND_ChangeVolumeVoice(0, volume, volume);
|
||||
void SetVolumeOgg(int volume) {
|
||||
private_ogg.volume = volume;
|
||||
ASND_ChangeVolumeVoice(0, volume, volume);
|
||||
}
|
||||
|
||||
s32 GetTimeOgg()
|
||||
{
|
||||
int ret;
|
||||
if (ogg_thread_running == 0 || private_ogg.fd < 0)
|
||||
return 0;
|
||||
ret = ((s32) ov_time_tell(&private_ogg.vf));
|
||||
if (ret < 0)
|
||||
ret = 0;
|
||||
s32 GetTimeOgg() {
|
||||
int ret;
|
||||
if (ogg_thread_running == 0 || private_ogg.fd < 0)
|
||||
return 0;
|
||||
ret = ((s32) ov_time_tell(&private_ogg.vf));
|
||||
if (ret < 0)
|
||||
ret = 0;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SetTimeOgg(s32 time_pos)
|
||||
{
|
||||
if (time_pos >= 0)
|
||||
private_ogg.seek_time = time_pos;
|
||||
void SetTimeOgg(s32 time_pos) {
|
||||
if (time_pos >= 0)
|
||||
private_ogg.seek_time = time_pos;
|
||||
}
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include "tremor/ivorbisfile.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define OGG_ONE_TIME 0
|
||||
@ -44,130 +43,130 @@ extern "C"
|
||||
#define OGG_STATUS_PAUSED 2
|
||||
#define OGG_STATUS_EOF 255
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* Player OGG functions */
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* Player OGG functions */
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* int PlayOgg(int fd, int time_pos, int mode);
|
||||
/* int PlayOgg(int fd, int time_pos, int mode);
|
||||
|
||||
Play an Ogg file. This file can be loaded from memory (mem_open(void *ogg, int size_ogg)) or from device with open("device:file.ogg",O_RDONLY,0);
|
||||
Play an Ogg file. This file can be loaded from memory (mem_open(void *ogg, int size_ogg)) or from device with open("device:file.ogg",O_RDONLY,0);
|
||||
|
||||
NOTE: The file is closed by the player when you call PlayOgg(), StopOgg() or if it fail.
|
||||
NOTE: The file is closed by the player when you call PlayOgg(), StopOgg() or if it fail.
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
fd: file descriptor from open() or mem_open()
|
||||
fd: file descriptor from open() or mem_open()
|
||||
|
||||
time_pos: initial time position in the file (in milliseconds). For example, use 30000 to advance 30 seconds
|
||||
time_pos: initial time position in the file (in milliseconds). For example, use 30000 to advance 30 seconds
|
||||
|
||||
mode: Use OGG_ONE_TIME or OGG_INFINITE_TIME. When you use OGG_ONE_TIME the sound stops and StatusOgg() return OGG_STATUS_EOF
|
||||
mode: Use OGG_ONE_TIME or OGG_INFINITE_TIME. When you use OGG_ONE_TIME the sound stops and StatusOgg() return OGG_STATUS_EOF
|
||||
|
||||
return: 0- Ok, -1 Error
|
||||
return: 0- Ok, -1 Error
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
int PlayOgg(int fd, int time_pos, int mode);
|
||||
int PlayOgg(int fd, int time_pos, int mode);
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* int PlayOgg(char * path, int loop);
|
||||
Just give the function the full device+path to OGG to play it
|
||||
loop = 1 for Loop and 0 for one time playing
|
||||
*/
|
||||
int PlayOggFromFile(char * path, int loop);
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* int PlayOgg(char * path, int loop);
|
||||
Just give the function the full device+path to OGG to play it
|
||||
loop = 1 for Loop and 0 for one time playing
|
||||
*/
|
||||
int PlayOggFromFile(char * path, int loop);
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* void StopOgg();
|
||||
/* void StopOgg();
|
||||
|
||||
Stop an Ogg file.
|
||||
Stop an Ogg file.
|
||||
|
||||
NOTE: The file is closed and the player thread is released
|
||||
NOTE: The file is closed and the player thread is released
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
void StopOgg();
|
||||
void StopOgg();
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* void PauseOgg(int pause);
|
||||
/* void PauseOgg(int pause);
|
||||
|
||||
Pause an Ogg file.
|
||||
Pause an Ogg file.
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
pause: 0 -> continue, 1-> pause
|
||||
pause: 0 -> continue, 1-> pause
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
void PauseOgg(int pause);
|
||||
void PauseOgg(int pause);
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* int StatusOgg();
|
||||
/* int StatusOgg();
|
||||
|
||||
Return the Ogg status
|
||||
Return the Ogg status
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
|
||||
return: OGG_STATUS_RUNNING
|
||||
OGG_STATUS_ERR -> not initialized?
|
||||
OGG_STATUS_PAUSED
|
||||
OGG_STATUS_EOF -> player stopped by End Of File
|
||||
return: OGG_STATUS_RUNNING
|
||||
OGG_STATUS_ERR -> not initialized?
|
||||
OGG_STATUS_PAUSED
|
||||
OGG_STATUS_EOF -> player stopped by End Of File
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
int StatusOgg();
|
||||
int StatusOgg();
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* void SetVolumeOgg(int volume);
|
||||
/* void SetVolumeOgg(int volume);
|
||||
|
||||
Set the Ogg playing volume.
|
||||
NOTE: it change the volume of voice 0 (used for the Ogg player)
|
||||
Set the Ogg playing volume.
|
||||
NOTE: it change the volume of voice 0 (used for the Ogg player)
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
volume: 0 to 255 (max)
|
||||
volume: 0 to 255 (max)
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
void SetVolumeOgg(int volume);
|
||||
void SetVolumeOgg(int volume);
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* s32 GetTimeOgg();
|
||||
/* s32 GetTimeOgg();
|
||||
|
||||
Return the Ogg time from the starts of the file
|
||||
Return the Ogg time from the starts of the file
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
return: 0 -> Ok or error condition (you must ignore this value)
|
||||
>0 -> time in milliseconds from the starts
|
||||
return: 0 -> Ok or error condition (you must ignore this value)
|
||||
>0 -> time in milliseconds from the starts
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
s32 GetTimeOgg();
|
||||
s32 GetTimeOgg();
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* void SetTimeOgg(s32 time_pos);
|
||||
/* void SetTimeOgg(s32 time_pos);
|
||||
|
||||
Set the time position
|
||||
Set the time position
|
||||
|
||||
NOTE: The file is closed by the player when you call PlayOgg(), StopOgg() or if it fail.
|
||||
NOTE: The file is closed by the player when you call PlayOgg(), StopOgg() or if it fail.
|
||||
|
||||
-- Params ---
|
||||
-- Params ---
|
||||
|
||||
time_pos: time position in the file (in milliseconds). For example, use 30000 to advance 30 seconds
|
||||
time_pos: time position in the file (in milliseconds). For example, use 30000 to advance 30 seconds
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
void SetTimeOgg(s32 time_pos);
|
||||
void SetTimeOgg(s32 time_pos);
|
||||
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,33 +21,33 @@
|
||||
|
||||
#ifndef __DVD_BROADWAY_H__
|
||||
#define __DVD_BROADWAY_H__
|
||||
|
||||
|
||||
#include <gctypes.h>
|
||||
#include <ogc/ipc.h>
|
||||
#include <ogc/dvd.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef void (*dvdcallbacklow)(s32 result);
|
||||
|
||||
s32 bwDVD_LowInit();
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb);
|
||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
typedef void (*dvdcallbacklow)(s32 result);
|
||||
|
||||
s32 bwDVD_LowInit();
|
||||
s32 bwDVD_LowInquiry(dvddrvinfo *info,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadID(dvddiskid *diskID,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowClosePartition(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowOpenPartition(u32 offset,void *eticket,u32 certin_len,void *certificate_in,void *certificate_out,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowUnencryptedRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReset(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowWaitCoverClose(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowRead(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_EnableVideo(dvdcallbacklow cb);
|
||||
s32 bwDVD_LowReadVideo(void *buf,u32 len,u32 offset,dvdcallbacklow cb);
|
||||
s32 bwDVD_SetDecryption(s32 mode, dvdcallbacklow cb);
|
||||
s32 bwDVD_SetOffset(u32 offset, dvdcallbacklow cb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
@ -37,63 +37,62 @@
|
||||
|
||||
extern struct SSettings Settings;
|
||||
|
||||
u32 do_sd_code(char *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
u8 *filebuff;
|
||||
u32 filesize;
|
||||
u32 ret;
|
||||
char filepath[150];
|
||||
u32 do_sd_code(char *filename) {
|
||||
FILE *fp;
|
||||
u8 *filebuff;
|
||||
u32 filesize;
|
||||
u32 ret;
|
||||
char filepath[150];
|
||||
|
||||
SDCard_Init();
|
||||
USBDevice_Init();
|
||||
USBDevice_Init();
|
||||
|
||||
sprintf(filepath, "%s%s", Settings.Cheatcodespath, filename);
|
||||
filepath[strlen(Settings.Cheatcodespath)+6] = 0x2E;
|
||||
filepath[strlen(Settings.Cheatcodespath)+7] = 0x67;
|
||||
filepath[strlen(Settings.Cheatcodespath)+8] = 0x63;
|
||||
filepath[strlen(Settings.Cheatcodespath)+9] = 0x74;
|
||||
filepath[strlen(Settings.Cheatcodespath)+10] = 0;
|
||||
sprintf(filepath, "%s%s", Settings.Cheatcodespath, filename);
|
||||
filepath[strlen(Settings.Cheatcodespath)+6] = 0x2E;
|
||||
filepath[strlen(Settings.Cheatcodespath)+7] = 0x67;
|
||||
filepath[strlen(Settings.Cheatcodespath)+8] = 0x63;
|
||||
filepath[strlen(Settings.Cheatcodespath)+9] = 0x74;
|
||||
filepath[strlen(Settings.Cheatcodespath)+10] = 0;
|
||||
|
||||
fp = fopen(filepath, "rb");
|
||||
if (!fp) {
|
||||
fp = fopen(filepath, "rb");
|
||||
if (!fp) {
|
||||
USBDevice_deInit();
|
||||
SDCard_deInit();
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
fseek(fp, 0, SEEK_END);
|
||||
filesize = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
fseek(fp, 0, SEEK_END);
|
||||
filesize = ftell(fp);
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
|
||||
filebuff = (u8*) malloc (filesize);
|
||||
if(filebuff == 0){
|
||||
fclose(fp);
|
||||
sleep(2);
|
||||
filebuff = (u8*) malloc (filesize);
|
||||
if (filebuff == 0) {
|
||||
fclose(fp);
|
||||
sleep(2);
|
||||
USBDevice_deInit();
|
||||
SDCard_deInit();
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = fread(filebuff, 1, filesize, fp);
|
||||
if(ret != filesize){
|
||||
free(filebuff);
|
||||
fclose(fp);
|
||||
ret = fread(filebuff, 1, filesize, fp);
|
||||
if (ret != filesize) {
|
||||
free(filebuff);
|
||||
fclose(fp);
|
||||
USBDevice_deInit();
|
||||
SDCard_deInit();
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy((void*)0x800027E8,filebuff,filesize);
|
||||
*(vu8*)0x80001807 = 0x01;
|
||||
|
||||
free(filebuff);
|
||||
fclose(fp);
|
||||
free(filebuff);
|
||||
fclose(fp);
|
||||
|
||||
USBDevice_deInit();
|
||||
USBDevice_deInit();
|
||||
SDCard_deInit();
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,12 +23,11 @@
|
||||
#define __FST_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//u32 do_fst(u32 fstlocation);
|
||||
u32 do_sd_code(char *filename);
|
||||
u32 do_sd_code(char *filename);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
unsigned char fwrite_patch_bin[] = {
|
||||
0x7c, 0x84, 0x29, 0xd6, 0x39, 0x40, 0x00, 0x00, 0x94, 0x21, 0xff, 0xf0,
|
||||
0x93, 0xe1, 0x00, 0x0c, 0x7f, 0x8a, 0x20, 0x00, 0x40, 0x9c, 0x00, 0x64,
|
||||
0x3d, 0x00, 0xcd, 0x00, 0x3d, 0x60, 0xcd, 0x00, 0x3d, 0x20, 0xcd, 0x00,
|
||||
0x61, 0x08, 0x68, 0x14, 0x61, 0x6b, 0x68, 0x24, 0x61, 0x29, 0x68, 0x20,
|
||||
0x39, 0x80, 0x00, 0xd0, 0x38, 0xc0, 0x00, 0x19, 0x38, 0xe0, 0x00, 0x00,
|
||||
0x91, 0x88, 0x00, 0x00, 0x7c, 0x03, 0x50, 0xae, 0x54, 0x00, 0xa0, 0x16,
|
||||
0x64, 0x00, 0xb0, 0x00, 0x90, 0x0b, 0x00, 0x00, 0x90, 0xc9, 0x00, 0x00,
|
||||
0x80, 0x09, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x01, 0x40, 0x82, 0xff, 0xf8,
|
||||
0x80, 0x0b, 0x00, 0x00, 0x90, 0xe8, 0x00, 0x00, 0x54, 0x00, 0x37, 0xfe,
|
||||
0x7d, 0x4a, 0x02, 0x14, 0x7f, 0x8a, 0x20, 0x00, 0x41, 0x9c, 0xff, 0xc8,
|
||||
0x7c, 0xa3, 0x2b, 0x78, 0x83, 0xe1, 0x00, 0x0c, 0x38, 0x21, 0x00, 0x10,
|
||||
0x4e, 0x80, 0x00, 0x20
|
||||
0x7c, 0x84, 0x29, 0xd6, 0x39, 0x40, 0x00, 0x00, 0x94, 0x21, 0xff, 0xf0,
|
||||
0x93, 0xe1, 0x00, 0x0c, 0x7f, 0x8a, 0x20, 0x00, 0x40, 0x9c, 0x00, 0x64,
|
||||
0x3d, 0x00, 0xcd, 0x00, 0x3d, 0x60, 0xcd, 0x00, 0x3d, 0x20, 0xcd, 0x00,
|
||||
0x61, 0x08, 0x68, 0x14, 0x61, 0x6b, 0x68, 0x24, 0x61, 0x29, 0x68, 0x20,
|
||||
0x39, 0x80, 0x00, 0xd0, 0x38, 0xc0, 0x00, 0x19, 0x38, 0xe0, 0x00, 0x00,
|
||||
0x91, 0x88, 0x00, 0x00, 0x7c, 0x03, 0x50, 0xae, 0x54, 0x00, 0xa0, 0x16,
|
||||
0x64, 0x00, 0xb0, 0x00, 0x90, 0x0b, 0x00, 0x00, 0x90, 0xc9, 0x00, 0x00,
|
||||
0x80, 0x09, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x01, 0x40, 0x82, 0xff, 0xf8,
|
||||
0x80, 0x0b, 0x00, 0x00, 0x90, 0xe8, 0x00, 0x00, 0x54, 0x00, 0x37, 0xfe,
|
||||
0x7d, 0x4a, 0x02, 0x14, 0x7f, 0x8a, 0x20, 0x00, 0x41, 0x9c, 0xff, 0xc8,
|
||||
0x7c, 0xa3, 0x2b, 0x78, 0x83, 0xe1, 0x00, 0x0c, 0x38, 0x21, 0x00, 0x10,
|
||||
0x4e, 0x80, 0x00, 0x20
|
||||
};
|
||||
unsigned int fwrite_patch_bin_len = 136;
|
||||
|
@ -4,261 +4,261 @@ Visit http://www.devkitpro.org
|
||||
*/
|
||||
|
||||
const unsigned char kenobiwii[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x26, 0xa0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x21, 0xff, 0x58, 0x90, 0x01, 0x00, 0x08,
|
||||
0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0xac, 0x7c, 0x00, 0x00, 0x26, 0x90, 0x01, 0x00, 0x0c,
|
||||
0x7c, 0x09, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x10, 0x7c, 0x01, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x14,
|
||||
0xbc, 0x61, 0x00, 0x18, 0x7f, 0x20, 0x00, 0xa6, 0x63, 0x3a, 0x20, 0x00, 0x73, 0x5a, 0xf9, 0xff,
|
||||
0x7f, 0x40, 0x01, 0x24, 0xd8, 0x41, 0x00, 0x98, 0xd8, 0x61, 0x00, 0xa0, 0x3f, 0xe0, 0x80, 0x00,
|
||||
0x3e, 0x80, 0xcc, 0x00, 0xa3, 0x94, 0x40, 0x10, 0x63, 0x95, 0x00, 0xff, 0xb2, 0xb4, 0x40, 0x10,
|
||||
0x48, 0x00, 0x06, 0xb1, 0x3a, 0xa0, 0x00, 0x00, 0x3a, 0xc0, 0x00, 0x19, 0x3a, 0xe0, 0x00, 0xd0,
|
||||
0x3f, 0x00, 0xcd, 0x00, 0x63, 0xf2, 0x26, 0xa0, 0x80, 0x01, 0x00, 0xac, 0x90, 0x12, 0x00, 0x04,
|
||||
0x92, 0xb8, 0x64, 0x3c, 0x48, 0x00, 0x04, 0x85, 0x41, 0x82, 0x05, 0xfc, 0x2c, 0x1d, 0x00, 0x04,
|
||||
0x40, 0x80, 0x00, 0x10, 0x2c, 0x1d, 0x00, 0x01, 0x41, 0x80, 0x05, 0xec, 0x48, 0x00, 0x03, 0xa8,
|
||||
0x41, 0x82, 0x05, 0x48, 0x2c, 0x1d, 0x00, 0x06, 0x41, 0x82, 0x00, 0x8c, 0x2c, 0x1d, 0x00, 0x07,
|
||||
0x41, 0x82, 0x03, 0x8c, 0x2c, 0x1d, 0x00, 0x08, 0x41, 0x82, 0x05, 0xd8, 0x2c, 0x1d, 0x00, 0x09,
|
||||
0x41, 0x82, 0x00, 0xa0, 0x2c, 0x1d, 0x00, 0x10, 0x41, 0x82, 0x00, 0x98, 0x2c, 0x1d, 0x00, 0x2f,
|
||||
0x41, 0x82, 0x00, 0x70, 0x2c, 0x1d, 0x00, 0x30, 0x41, 0x82, 0x00, 0x78, 0x2c, 0x1d, 0x00, 0x38,
|
||||
0x41, 0x82, 0x05, 0x80, 0x2c, 0x1d, 0x00, 0x40, 0x41, 0x82, 0x03, 0x9c, 0x2c, 0x1d, 0x00, 0x41,
|
||||
0x41, 0x82, 0x03, 0xb0, 0x2c, 0x1d, 0x00, 0x44, 0x41, 0x82, 0x00, 0x68, 0x2c, 0x1d, 0x00, 0x50,
|
||||
0x41, 0x82, 0x00, 0x20, 0x2c, 0x1d, 0x00, 0x60, 0x41, 0x82, 0x00, 0x24, 0x2c, 0x1d, 0x00, 0x89,
|
||||
0x41, 0x82, 0x00, 0x50, 0x2c, 0x1d, 0x00, 0x99, 0x41, 0x82, 0x05, 0x64, 0x48, 0x00, 0x05, 0x68,
|
||||
0x80, 0x72, 0x00, 0x00, 0x48, 0x00, 0x04, 0x81, 0x48, 0x00, 0x05, 0x5c, 0x48, 0x00, 0x05, 0xe5,
|
||||
0x48, 0x00, 0x05, 0x54, 0x38, 0x80, 0x00, 0x01, 0x90, 0x92, 0x00, 0x00, 0x48, 0x00, 0x05, 0x48,
|
||||
0x48, 0x00, 0x04, 0x61, 0x3a, 0x00, 0x00, 0xa0, 0x63, 0xec, 0x26, 0xc4, 0x48, 0x00, 0x03, 0x6c,
|
||||
0x38, 0x60, 0x01, 0x20, 0x63, 0xec, 0x26, 0xc4, 0x48, 0x00, 0x04, 0x21, 0x48, 0x00, 0x05, 0x28,
|
||||
0x2f, 0x1d, 0x00, 0x10, 0x2e, 0x9d, 0x00, 0x44, 0x63, 0xe4, 0x1a, 0xb4, 0x3c, 0x60, 0x80, 0x00,
|
||||
0x60, 0x63, 0x03, 0x00, 0x48, 0x00, 0x05, 0x65, 0x38, 0x63, 0x0a, 0x00, 0x48, 0x00, 0x05, 0x5d,
|
||||
0x38, 0x63, 0x06, 0x00, 0x48, 0x00, 0x05, 0x55, 0x63, 0xec, 0x26, 0xb4, 0x92, 0xac, 0x00, 0x00,
|
||||
0x92, 0xac, 0x00, 0x04, 0x92, 0xac, 0x00, 0x08, 0x63, 0xe4, 0x26, 0xc4, 0x81, 0x24, 0x00, 0x18,
|
||||
0x80, 0x72, 0x00, 0x00, 0x2c, 0x03, 0x00, 0x02, 0x40, 0x82, 0x00, 0x0c, 0x41, 0x96, 0x00, 0x0c,
|
||||
0x48, 0x00, 0x00, 0x20, 0x38, 0x60, 0x00, 0x00, 0x90, 0x6c, 0x00, 0x0c, 0x40, 0x82, 0x00, 0x14,
|
||||
0x40, 0x96, 0x00, 0x10, 0x61, 0x29, 0x04, 0x00, 0x91, 0x24, 0x00, 0x18, 0x48, 0x00, 0x02, 0x70,
|
||||
0x55, 0x29, 0x05, 0xa8, 0x91, 0x24, 0x00, 0x18, 0x41, 0x96, 0x04, 0xac, 0x41, 0x9a, 0x00, 0x08,
|
||||
0x39, 0x8c, 0x00, 0x04, 0x38, 0x60, 0x00, 0x04, 0x48, 0x00, 0x03, 0x61, 0x40, 0x99, 0x00, 0x10,
|
||||
0x39, 0x8c, 0x00, 0x04, 0x38, 0x60, 0x00, 0x04, 0x48, 0x00, 0x03, 0x51, 0x63, 0xe4, 0x26, 0xb4,
|
||||
0x80, 0x64, 0x00, 0x00, 0x80, 0x84, 0x00, 0x04, 0x7c, 0x72, 0xfb, 0xa6, 0x7c, 0x95, 0xfb, 0xa6,
|
||||
0x48, 0x00, 0x04, 0x74, 0x7c, 0x32, 0x43, 0xa6, 0x7c, 0x3a, 0x02, 0xa6, 0x7c, 0x73, 0x43, 0xa6,
|
||||
0x7c, 0x7b, 0x02, 0xa6, 0x54, 0x63, 0x05, 0xa8, 0x90, 0x60, 0x26, 0xdc, 0x54, 0x63, 0x06, 0x20,
|
||||
0x60, 0x63, 0x20, 0x00, 0x54, 0x63, 0x04, 0x5e, 0x7c, 0x7b, 0x03, 0xa6, 0x3c, 0x60, 0x80, 0x00,
|
||||
0x60, 0x63, 0x1a, 0xf4, 0x7c, 0x7a, 0x03, 0xa6, 0x4c, 0x00, 0x01, 0x2c, 0x7c, 0x00, 0x04, 0xac,
|
||||
0x4c, 0x00, 0x00, 0x64, 0x3c, 0x60, 0x80, 0x00, 0x60, 0x63, 0x26, 0xc4, 0x90, 0x23, 0x00, 0x14,
|
||||
0x7c, 0x61, 0x1b, 0x78, 0x7c, 0x73, 0x42, 0xa6, 0xbc, 0x41, 0x00, 0x24, 0x7c, 0x24, 0x0b, 0x78,
|
||||
0x7c, 0x32, 0x42, 0xa6, 0x90, 0x04, 0x00, 0x1c, 0x90, 0x24, 0x00, 0x20, 0x7c, 0x68, 0x02, 0xa6,
|
||||
0x90, 0x64, 0x00, 0x9c, 0x7c, 0x60, 0x00, 0x26, 0x90, 0x64, 0x00, 0x00, 0x7c, 0x61, 0x02, 0xa6,
|
||||
0x90, 0x64, 0x00, 0x04, 0x7c, 0x69, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x08, 0x7c, 0x72, 0x02, 0xa6,
|
||||
0x90, 0x64, 0x00, 0x0c, 0x7c, 0x73, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x10, 0x39, 0x20, 0x00, 0x00,
|
||||
0x7d, 0x32, 0xfb, 0xa6, 0x7d, 0x35, 0xfb, 0xa6, 0xd0, 0x04, 0x00, 0xa0, 0xd0, 0x24, 0x00, 0xa4,
|
||||
0xd0, 0x44, 0x00, 0xa8, 0xd0, 0x64, 0x00, 0xac, 0xd0, 0x84, 0x00, 0xb0, 0xd0, 0xa4, 0x00, 0xb4,
|
||||
0xd0, 0xc4, 0x00, 0xb8, 0xd0, 0xe4, 0x00, 0xbc, 0xd1, 0x04, 0x00, 0xc0, 0xd1, 0x24, 0x00, 0xc4,
|
||||
0xd1, 0x44, 0x00, 0xc8, 0xd1, 0x64, 0x00, 0xcc, 0xd1, 0x84, 0x00, 0xd0, 0xd1, 0xa4, 0x00, 0xd4,
|
||||
0xd1, 0xc4, 0x00, 0xd8, 0xd1, 0xe4, 0x00, 0xdc, 0xd2, 0x04, 0x00, 0xe0, 0xd2, 0x24, 0x00, 0xe4,
|
||||
0xd2, 0x44, 0x00, 0xe8, 0xd2, 0x64, 0x00, 0xec, 0xd2, 0x84, 0x00, 0xf0, 0xd2, 0xa4, 0x00, 0xf4,
|
||||
0xd2, 0xc4, 0x00, 0xf8, 0xd2, 0xe4, 0x00, 0xfc, 0xd3, 0x04, 0x01, 0x00, 0xd3, 0x24, 0x01, 0x04,
|
||||
0xd3, 0x44, 0x01, 0x08, 0xd3, 0x64, 0x01, 0x0c, 0xd3, 0x84, 0x01, 0x10, 0xd3, 0xa4, 0x01, 0x14,
|
||||
0xd3, 0xc4, 0x01, 0x18, 0xd3, 0xe4, 0x01, 0x1c, 0x3f, 0xe0, 0x80, 0x00, 0x63, 0xe5, 0x26, 0xb4,
|
||||
0x82, 0x05, 0x00, 0x00, 0x82, 0x25, 0x00, 0x04, 0x82, 0x65, 0x00, 0x0c, 0x2c, 0x13, 0x00, 0x00,
|
||||
0x41, 0x82, 0x00, 0x74, 0x2c, 0x13, 0x00, 0x02, 0x40, 0x82, 0x00, 0x18, 0x81, 0x24, 0x00, 0x14,
|
||||
0x39, 0x33, 0x00, 0x03, 0x91, 0x25, 0x00, 0x00, 0x91, 0x25, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x6c,
|
||||
0x7c, 0x10, 0x98, 0x00, 0x41, 0x82, 0x00, 0x38, 0x7c, 0x11, 0x98, 0x00, 0x41, 0x82, 0x00, 0x30,
|
||||
0x7d, 0x30, 0x8a, 0x14, 0x91, 0x25, 0x00, 0x0c, 0x82, 0x05, 0x00, 0x08, 0x2c, 0x10, 0x00, 0x00,
|
||||
0x41, 0x82, 0x00, 0x48, 0x80, 0x64, 0x00, 0x10, 0x7c, 0x10, 0x18, 0x00, 0x40, 0x82, 0x00, 0x10,
|
||||
0x3a, 0x00, 0x00, 0x00, 0x92, 0x05, 0x00, 0x08, 0x48, 0x00, 0x00, 0x30, 0x3a, 0x20, 0x00, 0x00,
|
||||
0x92, 0x25, 0x00, 0x0c, 0x81, 0x24, 0x00, 0x18, 0x61, 0x29, 0x04, 0x00, 0x91, 0x24, 0x00, 0x18,
|
||||
0x48, 0x00, 0x00, 0x30, 0x7e, 0x12, 0xfb, 0xa6, 0x7e, 0x35, 0xfb, 0xa6, 0x39, 0x20, 0x00, 0x01,
|
||||
0x91, 0x25, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x1c, 0x38, 0xa0, 0x00, 0x02, 0x63, 0xe4, 0x26, 0xa0,
|
||||
0x90, 0xa4, 0x00, 0x00, 0x38, 0x60, 0x00, 0x11, 0x48, 0x00, 0x01, 0xbd, 0x4b, 0xff, 0xfc, 0x1d,
|
||||
0x7c, 0x20, 0x00, 0xa6, 0x54, 0x21, 0x07, 0xfa, 0x54, 0x21, 0x04, 0x5e, 0x7c, 0x20, 0x01, 0x24,
|
||||
0x63, 0xe1, 0x26, 0xc4, 0x80, 0x61, 0x00, 0x00, 0x7c, 0x6f, 0xf1, 0x20, 0x80, 0x61, 0x00, 0x14,
|
||||
0x7c, 0x7a, 0x03, 0xa6, 0x80, 0x61, 0x00, 0x18, 0x7c, 0x7b, 0x03, 0xa6, 0x80, 0x61, 0x00, 0x9c,
|
||||
0x7c, 0x68, 0x03, 0xa6, 0xb8, 0x41, 0x00, 0x24, 0x80, 0x01, 0x00, 0x1c, 0x80, 0x21, 0x00, 0x20,
|
||||
0x4c, 0x00, 0x01, 0x2c, 0x7c, 0x00, 0x04, 0xac, 0x4c, 0x00, 0x00, 0x64, 0x92, 0xb2, 0x00, 0x00,
|
||||
0x48, 0x00, 0x02, 0x50, 0x2e, 0x9d, 0x00, 0x02, 0x38, 0x60, 0x00, 0x08, 0x63, 0xec, 0x26, 0xa8,
|
||||
0x48, 0x00, 0x00, 0xf9, 0x80, 0xac, 0x00, 0x00, 0x80, 0x6c, 0x00, 0x04, 0x98, 0x65, 0x00, 0x00,
|
||||
0x41, 0x94, 0x00, 0x10, 0xb0, 0x65, 0x00, 0x00, 0x41, 0x96, 0x00, 0x08, 0x90, 0x65, 0x00, 0x00,
|
||||
0x7c, 0x00, 0x28, 0xac, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x2f, 0xac, 0x4c, 0x00, 0x01, 0x2c,
|
||||
0x48, 0x00, 0x02, 0x04, 0x48, 0x00, 0x01, 0x1d, 0x38, 0x60, 0x00, 0x04, 0x63, 0xec, 0x26, 0xa8,
|
||||
0x48, 0x00, 0x00, 0xb9, 0x82, 0x0c, 0x00, 0x00, 0x63, 0xec, 0x27, 0xe8, 0x48, 0x00, 0x00, 0x1c,
|
||||
0x48, 0x00, 0x01, 0x01, 0x38, 0x60, 0x00, 0x08, 0x63, 0xec, 0x26, 0xa8, 0x48, 0x00, 0x00, 0x9d,
|
||||
0x82, 0x0c, 0x00, 0x04, 0x81, 0x8c, 0x00, 0x00, 0x63, 0xfb, 0x26, 0xb0, 0x3a, 0x20, 0x0f, 0x80,
|
||||
0x48, 0x00, 0x02, 0x3d, 0x41, 0x82, 0x00, 0x20, 0x7e, 0x23, 0x8b, 0x78, 0x48, 0x00, 0x00, 0x7d,
|
||||
0x48, 0x00, 0x00, 0xd1, 0x41, 0x82, 0xff, 0xfc, 0x7d, 0x8c, 0x72, 0x14, 0x35, 0x6b, 0xff, 0xff,
|
||||
0x41, 0x81, 0xff, 0xe8, 0x80, 0x7b, 0x00, 0x00, 0x2c, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x08,
|
||||
0x48, 0x00, 0x00, 0x59, 0x7c, 0x00, 0x60, 0xac, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x67, 0xac,
|
||||
0x4c, 0x00, 0x01, 0x2c, 0x48, 0x00, 0x01, 0x80, 0x7f, 0xc8, 0x02, 0xa6, 0x3c, 0x60, 0xa0, 0x00,
|
||||
0x48, 0x00, 0x00, 0x15, 0x76, 0x03, 0x08, 0x00, 0x56, 0x1d, 0x86, 0x3e, 0x7f, 0xc8, 0x03, 0xa6,
|
||||
0x4e, 0x80, 0x00, 0x20, 0x92, 0xf8, 0x68, 0x14, 0x90, 0x78, 0x68, 0x24, 0x92, 0xd8, 0x68, 0x20,
|
||||
0x80, 0xb8, 0x68, 0x20, 0x70, 0xa5, 0x00, 0x01, 0x40, 0x82, 0xff, 0xf8, 0x82, 0x18, 0x68, 0x24,
|
||||
0x90, 0xb8, 0x68, 0x14, 0x4e, 0x80, 0x00, 0x20, 0x7d, 0x48, 0x02, 0xa6, 0x7c, 0x69, 0x03, 0xa6,
|
||||
0x39, 0xc0, 0x00, 0x00, 0x48, 0x00, 0x00, 0x79, 0x48, 0x00, 0x00, 0x75, 0x4b, 0xff, 0xff, 0xad,
|
||||
0x41, 0x82, 0xff, 0xf4, 0x7f, 0xae, 0x61, 0xae, 0x39, 0xce, 0x00, 0x01, 0x42, 0x00, 0xff, 0xe8,
|
||||
0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x7d, 0x48, 0x02, 0xa6, 0x7c, 0x69, 0x03, 0xa6,
|
||||
0x39, 0xc0, 0x00, 0x00, 0x7c, 0x6c, 0x70, 0xae, 0x48, 0x00, 0x00, 0x1d, 0x41, 0x82, 0xff, 0xf8,
|
||||
0x39, 0xce, 0x00, 0x01, 0x42, 0x00, 0xff, 0xf0, 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20,
|
||||
0x38, 0x60, 0x00, 0xaa, 0x7f, 0xc8, 0x02, 0xa6, 0x54, 0x63, 0xa0, 0x16, 0x64, 0x63, 0xb0, 0x00,
|
||||
0x3a, 0xc0, 0x00, 0x19, 0x3a, 0xe0, 0x00, 0xd0, 0x3f, 0x00, 0xcd, 0x00, 0x4b, 0xff, 0xff, 0x69,
|
||||
0x56, 0x03, 0x37, 0xff, 0x7f, 0xc8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x7f, 0xc8, 0x02, 0xa6,
|
||||
0x3c, 0x60, 0xd0, 0x00, 0x4b, 0xff, 0xff, 0x51, 0x56, 0x03, 0x37, 0xff, 0x41, 0x82, 0xff, 0xf4,
|
||||
0x7f, 0xc8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x4b, 0xff, 0xff, 0xb9, 0x38, 0x60, 0x00, 0x08,
|
||||
0x63, 0xec, 0x26, 0xa8, 0x4b, 0xff, 0xff, 0x55, 0x80, 0xac, 0x00, 0x04, 0x81, 0x8c, 0x00, 0x00,
|
||||
0x63, 0xfb, 0x26, 0xb0, 0x62, 0xb1, 0xf8, 0x00, 0x7e, 0x0c, 0x28, 0x50, 0x48, 0x00, 0x00, 0xf1,
|
||||
0x41, 0x81, 0x00, 0x10, 0x82, 0x3b, 0x00, 0x00, 0x2c, 0x11, 0x00, 0x00, 0x41, 0x82, 0x00, 0x68,
|
||||
0x7e, 0x23, 0x8b, 0x78, 0x4b, 0xff, 0xff, 0x55, 0x4b, 0xff, 0xff, 0xa5, 0x4b, 0xff, 0xff, 0xa1,
|
||||
0x4b, 0xff, 0xfe, 0xd9, 0x41, 0x82, 0xff, 0xf4, 0x2c, 0x1d, 0x00, 0xcc, 0x41, 0x82, 0x00, 0x48,
|
||||
0x2c, 0x1d, 0x00, 0xbb, 0x41, 0x82, 0xff, 0xdc, 0x2c, 0x1d, 0x00, 0xaa, 0x40, 0x82, 0xff, 0xdc,
|
||||
0x7d, 0x8c, 0x72, 0x14, 0x35, 0x6b, 0xff, 0xff, 0x41, 0x80, 0x00, 0x2c, 0x4b, 0xff, 0xff, 0xb4,
|
||||
0x7e, 0xb5, 0xfb, 0xa6, 0x7e, 0xb2, 0xfb, 0xa6, 0x63, 0xe4, 0x26, 0xc4, 0x81, 0x24, 0x00, 0x18,
|
||||
0x55, 0x29, 0x05, 0xa8, 0x91, 0x24, 0x00, 0x18, 0x48, 0x00, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x80,
|
||||
0x4b, 0xff, 0xff, 0x25, 0x80, 0x92, 0x00, 0x00, 0x2c, 0x04, 0x00, 0x00, 0x40, 0x82, 0xf9, 0xf8,
|
||||
0xb3, 0x94, 0x40, 0x10, 0xc8, 0x41, 0x00, 0x98, 0xc8, 0x61, 0x00, 0xa0, 0x7f, 0x20, 0x00, 0xa6,
|
||||
0x80, 0x01, 0x00, 0xac, 0x7c, 0x08, 0x03, 0xa6, 0x80, 0x01, 0x00, 0x0c, 0x7c, 0x0f, 0xf1, 0x20,
|
||||
0x80, 0x01, 0x00, 0x10, 0x7c, 0x09, 0x03, 0xa6, 0x80, 0x01, 0x00, 0x14, 0x7c, 0x01, 0x03, 0xa6,
|
||||
0xb8, 0x61, 0x00, 0x18, 0x80, 0x01, 0x00, 0x08, 0x38, 0x21, 0x00, 0xa8, 0x4c, 0x00, 0x01, 0x2c,
|
||||
0x7c, 0x00, 0x04, 0xac, 0x4e, 0x80, 0x00, 0x20, 0x7e, 0x23, 0x20, 0x50, 0x3c, 0xa0, 0x48, 0x00,
|
||||
0x52, 0x25, 0x01, 0xba, 0x90, 0xa3, 0x00, 0x00, 0x7c, 0x00, 0x18, 0xac, 0x7c, 0x00, 0x04, 0xac,
|
||||
0x7c, 0x00, 0x1f, 0xac, 0x4c, 0x00, 0x01, 0x2c, 0x4e, 0x80, 0x00, 0x20, 0x7d, 0x70, 0x8b, 0xd7,
|
||||
0x7d, 0x4b, 0x89, 0xd6, 0x7d, 0x4a, 0x80, 0x50, 0x91, 0x5b, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20,
|
||||
0x7f, 0xa8, 0x02, 0xa6, 0x63, 0xef, 0x27, 0xe8, 0x63, 0xe7, 0x18, 0x08, 0x3c, 0xc0, 0x80, 0x00,
|
||||
0x7c, 0xd0, 0x33, 0x78, 0x39, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x00, 0xd0, 0x60, 0x63, 0xc0, 0xde,
|
||||
0x80, 0x8f, 0x00, 0x00, 0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x18, 0x80, 0x8f, 0x00, 0x04,
|
||||
0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x0c, 0x39, 0xef, 0x00, 0x08, 0x48, 0x00, 0x00, 0x0c,
|
||||
0x7f, 0xa8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x6f, 0x00, 0x00, 0x80, 0x8f, 0x00, 0x04,
|
||||
0x39, 0xef, 0x00, 0x08, 0x71, 0x09, 0x00, 0x01, 0x2f, 0x89, 0x00, 0x00, 0x39, 0x20, 0x00, 0x00,
|
||||
0x54, 0x6a, 0x1f, 0x7e, 0x54, 0x65, 0x3f, 0x7e, 0x74, 0x6b, 0x10, 0x00, 0x54, 0x63, 0x01, 0xfe,
|
||||
0x40, 0x82, 0x00, 0x0c, 0x54, 0xcc, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x08, 0x7e, 0x0c, 0x83, 0x78,
|
||||
0x2e, 0x05, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x01, 0x41, 0xa0, 0x00, 0x2c, 0x41, 0xa2, 0x00, 0xe4,
|
||||
0x2c, 0x0a, 0x00, 0x03, 0x41, 0xa0, 0x01, 0xb0, 0x41, 0x82, 0x02, 0x54, 0x2c, 0x0a, 0x00, 0x05,
|
||||
0x41, 0x80, 0x02, 0xdc, 0x41, 0xa2, 0x04, 0xe8, 0x2c, 0x0a, 0x00, 0x07, 0x41, 0xa0, 0x05, 0x14,
|
||||
0x48, 0x00, 0x05, 0xf8, 0x7d, 0x8c, 0x1a, 0x14, 0x2c, 0x05, 0x00, 0x03, 0x41, 0x82, 0x00, 0x48,
|
||||
0x41, 0x81, 0x00, 0x60, 0x40, 0xbe, 0xff, 0x84, 0x2e, 0x05, 0x00, 0x01, 0x41, 0x91, 0x00, 0x2c,
|
||||
0x54, 0x8a, 0x84, 0x3e, 0x41, 0x92, 0x00, 0x10, 0x7c, 0x89, 0x61, 0xae, 0x39, 0x29, 0x00, 0x01,
|
||||
0x48, 0x00, 0x00, 0x0c, 0x7c, 0x89, 0x63, 0x2e, 0x39, 0x29, 0x00, 0x02, 0x35, 0x4a, 0xff, 0xff,
|
||||
0x40, 0xa0, 0xff, 0xe4, 0x4b, 0xff, 0xff, 0x54, 0x55, 0x8c, 0x00, 0x3a, 0x90, 0x8c, 0x00, 0x00,
|
||||
0x4b, 0xff, 0xff, 0x48, 0x7c, 0x89, 0x23, 0x78, 0x40, 0x9e, 0x04, 0xd0, 0x35, 0x29, 0xff, 0xff,
|
||||
0x41, 0x80, 0x04, 0xc8, 0x7c, 0xa9, 0x78, 0xae, 0x7c, 0xa9, 0x61, 0xae, 0x4b, 0xff, 0xff, 0xf0,
|
||||
0x39, 0xef, 0x00, 0x08, 0x40, 0xbe, 0xff, 0x24, 0x80, 0xaf, 0xff, 0xf8, 0x81, 0x6f, 0xff, 0xfc,
|
||||
0x54, 0xb1, 0x04, 0x3e, 0x54, 0xaa, 0x85, 0x3e, 0x54, 0xa5, 0x27, 0x3e, 0x2e, 0x85, 0x00, 0x01,
|
||||
0x41, 0x96, 0x00, 0x10, 0x41, 0xb5, 0x00, 0x14, 0x7c, 0x89, 0x61, 0xae, 0x48, 0x00, 0x00, 0x10,
|
||||
0x7c, 0x89, 0x63, 0x2e, 0x48, 0x00, 0x00, 0x08, 0x7c, 0x89, 0x61, 0x2e, 0x7c, 0x84, 0x5a, 0x14,
|
||||
0x7d, 0x29, 0x8a, 0x14, 0x35, 0x4a, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4, 0x4b, 0xff, 0xfe, 0xdc,
|
||||
0x54, 0x69, 0x07, 0xff, 0x41, 0x82, 0x00, 0x10, 0x55, 0x08, 0xf8, 0x7e, 0x71, 0x09, 0x00, 0x01,
|
||||
0x2f, 0x89, 0x00, 0x00, 0x2e, 0x85, 0x00, 0x04, 0x2d, 0x8a, 0x00, 0x05, 0x7d, 0x13, 0x43, 0x78,
|
||||
0x52, 0x68, 0x08, 0x3c, 0x40, 0x9e, 0x00, 0x78, 0x41, 0x8d, 0x04, 0xbc, 0x7d, 0x8c, 0x1a, 0x14,
|
||||
0x41, 0x8c, 0x00, 0x0c, 0x41, 0x94, 0x00, 0x30, 0x48, 0x00, 0x00, 0x1c, 0x40, 0x94, 0x00, 0x10,
|
||||
0x55, 0x8c, 0x00, 0x3a, 0x81, 0x6c, 0x00, 0x00, 0x48, 0x00, 0x00, 0x1c, 0x55, 0x8c, 0x00, 0x3c,
|
||||
0xa1, 0x6c, 0x00, 0x00, 0x7c, 0x89, 0x20, 0xf8, 0x55, 0x29, 0x84, 0x3e, 0x7d, 0x6b, 0x48, 0x38,
|
||||
0x54, 0x84, 0x04, 0x3e, 0x7f, 0x0b, 0x20, 0x40, 0x70, 0xa9, 0x00, 0x03, 0x41, 0x82, 0x00, 0x18,
|
||||
0x2c, 0x09, 0x00, 0x02, 0x41, 0x82, 0x00, 0x18, 0x41, 0x81, 0x00, 0x1c, 0x40, 0x9a, 0x00, 0x20,
|
||||
0x48, 0x00, 0x00, 0x18, 0x41, 0x9a, 0x00, 0x18, 0x48, 0x00, 0x00, 0x10, 0x41, 0x99, 0x00, 0x10,
|
||||
0x48, 0x00, 0x00, 0x08, 0x41, 0x98, 0x00, 0x08, 0x61, 0x08, 0x00, 0x01, 0x40, 0x8e, 0xfe, 0x3c,
|
||||
0x41, 0x94, 0xfe, 0x38, 0x81, 0x6f, 0xff, 0xf8, 0x40, 0x9e, 0x00, 0x20, 0x70, 0x6c, 0x00, 0x08,
|
||||
0x41, 0x82, 0x00, 0x0c, 0x71, 0x0c, 0x00, 0x01, 0x41, 0x82, 0x00, 0x10, 0x39, 0x8b, 0x00, 0x10,
|
||||
0x51, 0x8b, 0x03, 0x36, 0x48, 0x00, 0x00, 0x08, 0x55, 0x6b, 0x07, 0x16, 0x91, 0x6f, 0xff, 0xf8,
|
||||
0x4b, 0xff, 0xfe, 0x08, 0x40, 0xbe, 0xfe, 0x04, 0x54, 0x69, 0x16, 0xba, 0x54, 0x6e, 0x87, 0xfe,
|
||||
0x2d, 0x8e, 0x00, 0x00, 0x2e, 0x05, 0x00, 0x04, 0x70, 0xae, 0x00, 0x03, 0x2e, 0x8e, 0x00, 0x02,
|
||||
0x41, 0x94, 0x00, 0x14, 0x41, 0x96, 0x00, 0x50, 0x7c, 0x64, 0x07, 0x34, 0x7c, 0x84, 0x7a, 0x14,
|
||||
0x48, 0x00, 0x00, 0x68, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c, 0x7d, 0x27, 0x48, 0x2e,
|
||||
0x7c, 0x84, 0x4a, 0x14, 0x41, 0x8e, 0x00, 0x08, 0x7c, 0x8c, 0x22, 0x14, 0x2e, 0x8e, 0x00, 0x01,
|
||||
0x41, 0x96, 0x00, 0x08, 0x80, 0x84, 0x00, 0x00, 0x54, 0x63, 0x67, 0xff, 0x41, 0x82, 0x00, 0x3c,
|
||||
0x40, 0x90, 0x00, 0x0c, 0x7c, 0x84, 0x32, 0x14, 0x48, 0x00, 0x00, 0x30, 0x7c, 0x84, 0x82, 0x14,
|
||||
0x48, 0x00, 0x00, 0x28, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c, 0x7d, 0x27, 0x48, 0x2e,
|
||||
0x7c, 0x84, 0x4a, 0x14, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0xcc, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x7c,
|
||||
0x7e, 0x0c, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x74, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0x86, 0x23, 0x78,
|
||||
0x4b, 0xff, 0xfd, 0x68, 0x7c, 0x90, 0x23, 0x78, 0x4b, 0xff, 0xfd, 0x60, 0x54, 0x89, 0x1e, 0x78,
|
||||
0x39, 0x29, 0x00, 0x40, 0x2c, 0x05, 0x00, 0x02, 0x41, 0x80, 0x00, 0x4c, 0x54, 0x6b, 0x67, 0xbf,
|
||||
0x2c, 0x0b, 0x00, 0x01, 0x41, 0x80, 0x00, 0x14, 0x41, 0x82, 0x00, 0x08, 0x48, 0x00, 0x00, 0x10,
|
||||
0x41, 0xbe, 0xfd, 0x38, 0x48, 0x00, 0x00, 0x08, 0x40, 0xbe, 0xfd, 0x30, 0x2c, 0x05, 0x00, 0x03,
|
||||
0x41, 0x81, 0x00, 0x10, 0x41, 0xa2, 0x00, 0x10, 0x7d, 0xe7, 0x48, 0x2e, 0x4b, 0xff, 0xfd, 0x1c,
|
||||
0x7d, 0xe7, 0x49, 0x2e, 0x7c, 0x64, 0x07, 0x34, 0x54, 0x84, 0x1a, 0x78, 0x7d, 0xef, 0x22, 0x14,
|
||||
0x4b, 0xff, 0xfd, 0x08, 0x40, 0xbe, 0xfd, 0x04, 0x7c, 0xa7, 0x4a, 0x14, 0x40, 0x92, 0x00, 0x14,
|
||||
0x54, 0x64, 0x04, 0x3e, 0x91, 0xe5, 0x00, 0x00, 0x90, 0x85, 0x00, 0x04, 0x4b, 0xff, 0xfc, 0xec,
|
||||
0x81, 0x25, 0x00, 0x04, 0x2c, 0x09, 0x00, 0x00, 0x41, 0xa2, 0xfc, 0xe0, 0x39, 0x29, 0xff, 0xff,
|
||||
0x91, 0x25, 0x00, 0x04, 0x81, 0xe5, 0x00, 0x00, 0x4b, 0xff, 0xfc, 0xd0, 0x40, 0xbe, 0xfc, 0xcc,
|
||||
0x54, 0x6b, 0x16, 0xba, 0x7f, 0x47, 0x5a, 0x14, 0x81, 0x3a, 0x00, 0x00, 0x54, 0x6e, 0x67, 0xbe,
|
||||
0x41, 0x92, 0x00, 0x84, 0x2e, 0x05, 0x00, 0x05, 0x40, 0x90, 0x01, 0x74, 0x2e, 0x05, 0x00, 0x03,
|
||||
0x40, 0x90, 0x00, 0x90, 0x2e, 0x05, 0x00, 0x01, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08,
|
||||
0x7c, 0x8c, 0x22, 0x14, 0x2f, 0x0e, 0x00, 0x01, 0x40, 0x92, 0x00, 0x24, 0x41, 0xb9, 0x00, 0x18,
|
||||
0x41, 0x9a, 0x00, 0x0c, 0x88, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf8, 0xa0, 0x84, 0x00, 0x00,
|
||||
0x48, 0x00, 0x00, 0xf0, 0x80, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xe8, 0x54, 0x73, 0xe5, 0x3e,
|
||||
0x41, 0xb9, 0x00, 0x20, 0x41, 0x9a, 0x00, 0x10, 0x99, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x01,
|
||||
0x48, 0x00, 0x00, 0x18, 0xb1, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x02, 0x48, 0x00, 0x00, 0x0c,
|
||||
0x91, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x04, 0x36, 0x73, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4,
|
||||
0x4b, 0xff, 0xfc, 0x38, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08, 0x7c, 0x84, 0x62, 0x14,
|
||||
0x71, 0xc5, 0x00, 0x01, 0x41, 0x82, 0x00, 0x9c, 0x7c, 0x84, 0x4a, 0x14, 0x48, 0x00, 0x00, 0x94,
|
||||
0x54, 0x6a, 0x87, 0xbe, 0x54, 0x8e, 0x16, 0xba, 0x7e, 0x67, 0x72, 0x14, 0x40, 0x92, 0x00, 0x08,
|
||||
0x3a, 0x6f, 0xff, 0xfc, 0x80, 0x9a, 0x00, 0x00, 0x81, 0x33, 0x00, 0x00, 0x71, 0x4b, 0x00, 0x01,
|
||||
0x41, 0x82, 0x00, 0x08, 0x7c, 0x9a, 0x23, 0x78, 0x71, 0x4b, 0x00, 0x02, 0x41, 0x82, 0x00, 0x10,
|
||||
0x7d, 0x33, 0x4b, 0x78, 0x40, 0xb2, 0x00, 0x08, 0x7e, 0x6c, 0x9a, 0x14, 0x54, 0x65, 0x67, 0x3f,
|
||||
0x2c, 0x05, 0x00, 0x09, 0x40, 0x80, 0x00, 0x54, 0x48, 0x00, 0x00, 0x79, 0x7c, 0x89, 0x22, 0x14,
|
||||
0x48, 0x00, 0x00, 0x40, 0x7c, 0x89, 0x21, 0xd6, 0x48, 0x00, 0x00, 0x38, 0x7d, 0x24, 0x23, 0x78,
|
||||
0x48, 0x00, 0x00, 0x30, 0x7d, 0x24, 0x20, 0x38, 0x48, 0x00, 0x00, 0x28, 0x7d, 0x24, 0x22, 0x78,
|
||||
0x48, 0x00, 0x00, 0x20, 0x7d, 0x24, 0x20, 0x30, 0x48, 0x00, 0x00, 0x18, 0x7d, 0x24, 0x24, 0x30,
|
||||
0x48, 0x00, 0x00, 0x10, 0x5d, 0x24, 0x20, 0x3e, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x24, 0x26, 0x30,
|
||||
0x90, 0x9a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x84, 0x2c, 0x05, 0x00, 0x0a, 0x41, 0x81, 0xfb, 0x7c,
|
||||
0xc0, 0x5a, 0x00, 0x00, 0xc0, 0x73, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0xec, 0x43, 0x10, 0x2a,
|
||||
0x48, 0x00, 0x00, 0x08, 0xec, 0x43, 0x00, 0xb2, 0xd0, 0x5a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x5c,
|
||||
0x7d, 0x48, 0x02, 0xa6, 0x54, 0xa5, 0x1e, 0x78, 0x7d, 0x4a, 0x2a, 0x14, 0x80, 0x9a, 0x00, 0x00,
|
||||
0x81, 0x33, 0x00, 0x00, 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x40, 0xbe, 0xfb, 0x3c,
|
||||
0x54, 0x69, 0xc0, 0x3e, 0x7d, 0x8e, 0x63, 0x78, 0x48, 0x00, 0x00, 0x35, 0x41, 0x92, 0x00, 0x0c,
|
||||
0x7e, 0x31, 0x22, 0x14, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x29, 0x22, 0x14, 0x54, 0x64, 0xc4, 0x3f,
|
||||
0x38, 0xa0, 0x00, 0x00, 0x41, 0x82, 0xfb, 0x14, 0x7d, 0x45, 0x88, 0xae, 0x7d, 0x45, 0x49, 0xae,
|
||||
0x38, 0xa5, 0x00, 0x01, 0x7c, 0x05, 0x20, 0x00, 0x4b, 0xff, 0xff, 0xec, 0x2e, 0x8a, 0x00, 0x04,
|
||||
0x55, 0x31, 0x36, 0xba, 0x2c, 0x11, 0x00, 0x3c, 0x7e, 0x27, 0x88, 0x2e, 0x40, 0x82, 0x00, 0x08,
|
||||
0x7d, 0xd1, 0x73, 0x78, 0x41, 0x96, 0x00, 0x08, 0xa2, 0x31, 0x00, 0x00, 0x55, 0x29, 0x56, 0xba,
|
||||
0x2c, 0x09, 0x00, 0x3c, 0x7d, 0x27, 0x48, 0x2e, 0x40, 0x82, 0x00, 0x08, 0x7d, 0xc9, 0x73, 0x78,
|
||||
0x41, 0x96, 0x00, 0x08, 0xa1, 0x29, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, 0x2c, 0x05, 0x00, 0x04,
|
||||
0x40, 0x80, 0x00, 0x28, 0x7c, 0x89, 0x23, 0x78, 0x7d, 0xc3, 0x62, 0x14, 0x55, 0xce, 0x00, 0x3c,
|
||||
0x4b, 0xff, 0xff, 0xad, 0x7c, 0x84, 0x20, 0xf8, 0x54, 0x84, 0x04, 0x3e, 0x7d, 0x2b, 0x20, 0x38,
|
||||
0x7e, 0x24, 0x20, 0x38, 0x4b, 0xff, 0xfb, 0xbc, 0x54, 0x6b, 0xe4, 0x3e, 0x4b, 0xff, 0xfb, 0xb4,
|
||||
0x7c, 0x9a, 0x23, 0x78, 0x54, 0x84, 0x18, 0x38, 0x40, 0x92, 0x00, 0x20, 0x40, 0x9e, 0x00, 0x0c,
|
||||
0x7d, 0xe8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x7d, 0xe4, 0x7a, 0x14, 0x39, 0xef, 0x00, 0x07,
|
||||
0x55, 0xef, 0x00, 0x38, 0x4b, 0xff, 0xfa, 0x64, 0x2e, 0x05, 0x00, 0x03, 0x41, 0x91, 0x00, 0x5c,
|
||||
0x3c, 0xa0, 0x48, 0x00, 0x7d, 0x83, 0x62, 0x14, 0x55, 0x8c, 0x00, 0x3a, 0x40, 0x92, 0x00, 0x20,
|
||||
0x40, 0xbe, 0xfa, 0x48, 0x57, 0x44, 0x00, 0x3a, 0x7c, 0x8c, 0x20, 0x50, 0x50, 0x85, 0x01, 0xba,
|
||||
0x50, 0x65, 0x07, 0xfe, 0x90, 0xac, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0x30, 0x40, 0xbe, 0xff, 0xbc,
|
||||
0x7d, 0x2c, 0x78, 0x50, 0x51, 0x25, 0x01, 0xba, 0x90, 0xac, 0x00, 0x00, 0x39, 0x8c, 0x00, 0x04,
|
||||
0x7d, 0x6f, 0x22, 0x14, 0x39, 0x6b, 0xff, 0xfc, 0x7d, 0x2b, 0x60, 0x50, 0x51, 0x25, 0x01, 0xba,
|
||||
0x90, 0xab, 0x00, 0x00, 0x4b, 0xff, 0xff, 0x94, 0x2e, 0x05, 0x00, 0x06, 0x41, 0x92, 0x00, 0x28,
|
||||
0x4b, 0xff, 0xfb, 0x20, 0x55, 0x8c, 0x84, 0x3e, 0x57, 0x44, 0x84, 0x3e, 0x57, 0x5a, 0x04, 0x3e,
|
||||
0x7c, 0x0c, 0x20, 0x00, 0x41, 0x80, 0xfb, 0xa4, 0x7c, 0x0c, 0xd0, 0x00, 0x40, 0x80, 0xfb, 0x9c,
|
||||
0x4b, 0xff, 0xf9, 0xd8, 0x57, 0x45, 0xff, 0xfe, 0x68, 0xa5, 0x00, 0x01, 0x71, 0x03, 0x00, 0x01,
|
||||
0x7c, 0x05, 0x18, 0x00, 0x41, 0x82, 0x00, 0x1c, 0x51, 0x1a, 0x0f, 0xbc, 0x6b, 0x5a, 0x00, 0x02,
|
||||
0x57, 0x45, 0xff, 0xff, 0x41, 0x82, 0x00, 0x08, 0x6b, 0x5a, 0x00, 0x01, 0x93, 0x4f, 0xff, 0xfc,
|
||||
0x53, 0x48, 0x07, 0xfe, 0x4b, 0xff, 0xf9, 0xa4, 0x2c, 0x0b, 0x00, 0x00, 0x40, 0x82, 0xf9, 0x94,
|
||||
0x40, 0x92, 0x00, 0x0c, 0x39, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x14, 0x54, 0x69, 0x06, 0xff,
|
||||
0x40, 0x82, 0x00, 0x08, 0x40, 0x9e, 0x00, 0x10, 0x54, 0x65, 0x67, 0xfe, 0x7d, 0x08, 0x4c, 0x30,
|
||||
0x7d, 0x08, 0x2a, 0x78, 0x54, 0x85, 0x00, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xa6, 0x2b, 0x78,
|
||||
0x54, 0x85, 0x80, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xb0, 0x2b, 0x78, 0x4b, 0xff, 0xf9, 0x5c,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x26, 0xa0, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x21, 0xff, 0x58, 0x90, 0x01, 0x00, 0x08,
|
||||
0x7c, 0x08, 0x02, 0xa6, 0x90, 0x01, 0x00, 0xac, 0x7c, 0x00, 0x00, 0x26, 0x90, 0x01, 0x00, 0x0c,
|
||||
0x7c, 0x09, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x10, 0x7c, 0x01, 0x02, 0xa6, 0x90, 0x01, 0x00, 0x14,
|
||||
0xbc, 0x61, 0x00, 0x18, 0x7f, 0x20, 0x00, 0xa6, 0x63, 0x3a, 0x20, 0x00, 0x73, 0x5a, 0xf9, 0xff,
|
||||
0x7f, 0x40, 0x01, 0x24, 0xd8, 0x41, 0x00, 0x98, 0xd8, 0x61, 0x00, 0xa0, 0x3f, 0xe0, 0x80, 0x00,
|
||||
0x3e, 0x80, 0xcc, 0x00, 0xa3, 0x94, 0x40, 0x10, 0x63, 0x95, 0x00, 0xff, 0xb2, 0xb4, 0x40, 0x10,
|
||||
0x48, 0x00, 0x06, 0xb1, 0x3a, 0xa0, 0x00, 0x00, 0x3a, 0xc0, 0x00, 0x19, 0x3a, 0xe0, 0x00, 0xd0,
|
||||
0x3f, 0x00, 0xcd, 0x00, 0x63, 0xf2, 0x26, 0xa0, 0x80, 0x01, 0x00, 0xac, 0x90, 0x12, 0x00, 0x04,
|
||||
0x92, 0xb8, 0x64, 0x3c, 0x48, 0x00, 0x04, 0x85, 0x41, 0x82, 0x05, 0xfc, 0x2c, 0x1d, 0x00, 0x04,
|
||||
0x40, 0x80, 0x00, 0x10, 0x2c, 0x1d, 0x00, 0x01, 0x41, 0x80, 0x05, 0xec, 0x48, 0x00, 0x03, 0xa8,
|
||||
0x41, 0x82, 0x05, 0x48, 0x2c, 0x1d, 0x00, 0x06, 0x41, 0x82, 0x00, 0x8c, 0x2c, 0x1d, 0x00, 0x07,
|
||||
0x41, 0x82, 0x03, 0x8c, 0x2c, 0x1d, 0x00, 0x08, 0x41, 0x82, 0x05, 0xd8, 0x2c, 0x1d, 0x00, 0x09,
|
||||
0x41, 0x82, 0x00, 0xa0, 0x2c, 0x1d, 0x00, 0x10, 0x41, 0x82, 0x00, 0x98, 0x2c, 0x1d, 0x00, 0x2f,
|
||||
0x41, 0x82, 0x00, 0x70, 0x2c, 0x1d, 0x00, 0x30, 0x41, 0x82, 0x00, 0x78, 0x2c, 0x1d, 0x00, 0x38,
|
||||
0x41, 0x82, 0x05, 0x80, 0x2c, 0x1d, 0x00, 0x40, 0x41, 0x82, 0x03, 0x9c, 0x2c, 0x1d, 0x00, 0x41,
|
||||
0x41, 0x82, 0x03, 0xb0, 0x2c, 0x1d, 0x00, 0x44, 0x41, 0x82, 0x00, 0x68, 0x2c, 0x1d, 0x00, 0x50,
|
||||
0x41, 0x82, 0x00, 0x20, 0x2c, 0x1d, 0x00, 0x60, 0x41, 0x82, 0x00, 0x24, 0x2c, 0x1d, 0x00, 0x89,
|
||||
0x41, 0x82, 0x00, 0x50, 0x2c, 0x1d, 0x00, 0x99, 0x41, 0x82, 0x05, 0x64, 0x48, 0x00, 0x05, 0x68,
|
||||
0x80, 0x72, 0x00, 0x00, 0x48, 0x00, 0x04, 0x81, 0x48, 0x00, 0x05, 0x5c, 0x48, 0x00, 0x05, 0xe5,
|
||||
0x48, 0x00, 0x05, 0x54, 0x38, 0x80, 0x00, 0x01, 0x90, 0x92, 0x00, 0x00, 0x48, 0x00, 0x05, 0x48,
|
||||
0x48, 0x00, 0x04, 0x61, 0x3a, 0x00, 0x00, 0xa0, 0x63, 0xec, 0x26, 0xc4, 0x48, 0x00, 0x03, 0x6c,
|
||||
0x38, 0x60, 0x01, 0x20, 0x63, 0xec, 0x26, 0xc4, 0x48, 0x00, 0x04, 0x21, 0x48, 0x00, 0x05, 0x28,
|
||||
0x2f, 0x1d, 0x00, 0x10, 0x2e, 0x9d, 0x00, 0x44, 0x63, 0xe4, 0x1a, 0xb4, 0x3c, 0x60, 0x80, 0x00,
|
||||
0x60, 0x63, 0x03, 0x00, 0x48, 0x00, 0x05, 0x65, 0x38, 0x63, 0x0a, 0x00, 0x48, 0x00, 0x05, 0x5d,
|
||||
0x38, 0x63, 0x06, 0x00, 0x48, 0x00, 0x05, 0x55, 0x63, 0xec, 0x26, 0xb4, 0x92, 0xac, 0x00, 0x00,
|
||||
0x92, 0xac, 0x00, 0x04, 0x92, 0xac, 0x00, 0x08, 0x63, 0xe4, 0x26, 0xc4, 0x81, 0x24, 0x00, 0x18,
|
||||
0x80, 0x72, 0x00, 0x00, 0x2c, 0x03, 0x00, 0x02, 0x40, 0x82, 0x00, 0x0c, 0x41, 0x96, 0x00, 0x0c,
|
||||
0x48, 0x00, 0x00, 0x20, 0x38, 0x60, 0x00, 0x00, 0x90, 0x6c, 0x00, 0x0c, 0x40, 0x82, 0x00, 0x14,
|
||||
0x40, 0x96, 0x00, 0x10, 0x61, 0x29, 0x04, 0x00, 0x91, 0x24, 0x00, 0x18, 0x48, 0x00, 0x02, 0x70,
|
||||
0x55, 0x29, 0x05, 0xa8, 0x91, 0x24, 0x00, 0x18, 0x41, 0x96, 0x04, 0xac, 0x41, 0x9a, 0x00, 0x08,
|
||||
0x39, 0x8c, 0x00, 0x04, 0x38, 0x60, 0x00, 0x04, 0x48, 0x00, 0x03, 0x61, 0x40, 0x99, 0x00, 0x10,
|
||||
0x39, 0x8c, 0x00, 0x04, 0x38, 0x60, 0x00, 0x04, 0x48, 0x00, 0x03, 0x51, 0x63, 0xe4, 0x26, 0xb4,
|
||||
0x80, 0x64, 0x00, 0x00, 0x80, 0x84, 0x00, 0x04, 0x7c, 0x72, 0xfb, 0xa6, 0x7c, 0x95, 0xfb, 0xa6,
|
||||
0x48, 0x00, 0x04, 0x74, 0x7c, 0x32, 0x43, 0xa6, 0x7c, 0x3a, 0x02, 0xa6, 0x7c, 0x73, 0x43, 0xa6,
|
||||
0x7c, 0x7b, 0x02, 0xa6, 0x54, 0x63, 0x05, 0xa8, 0x90, 0x60, 0x26, 0xdc, 0x54, 0x63, 0x06, 0x20,
|
||||
0x60, 0x63, 0x20, 0x00, 0x54, 0x63, 0x04, 0x5e, 0x7c, 0x7b, 0x03, 0xa6, 0x3c, 0x60, 0x80, 0x00,
|
||||
0x60, 0x63, 0x1a, 0xf4, 0x7c, 0x7a, 0x03, 0xa6, 0x4c, 0x00, 0x01, 0x2c, 0x7c, 0x00, 0x04, 0xac,
|
||||
0x4c, 0x00, 0x00, 0x64, 0x3c, 0x60, 0x80, 0x00, 0x60, 0x63, 0x26, 0xc4, 0x90, 0x23, 0x00, 0x14,
|
||||
0x7c, 0x61, 0x1b, 0x78, 0x7c, 0x73, 0x42, 0xa6, 0xbc, 0x41, 0x00, 0x24, 0x7c, 0x24, 0x0b, 0x78,
|
||||
0x7c, 0x32, 0x42, 0xa6, 0x90, 0x04, 0x00, 0x1c, 0x90, 0x24, 0x00, 0x20, 0x7c, 0x68, 0x02, 0xa6,
|
||||
0x90, 0x64, 0x00, 0x9c, 0x7c, 0x60, 0x00, 0x26, 0x90, 0x64, 0x00, 0x00, 0x7c, 0x61, 0x02, 0xa6,
|
||||
0x90, 0x64, 0x00, 0x04, 0x7c, 0x69, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x08, 0x7c, 0x72, 0x02, 0xa6,
|
||||
0x90, 0x64, 0x00, 0x0c, 0x7c, 0x73, 0x02, 0xa6, 0x90, 0x64, 0x00, 0x10, 0x39, 0x20, 0x00, 0x00,
|
||||
0x7d, 0x32, 0xfb, 0xa6, 0x7d, 0x35, 0xfb, 0xa6, 0xd0, 0x04, 0x00, 0xa0, 0xd0, 0x24, 0x00, 0xa4,
|
||||
0xd0, 0x44, 0x00, 0xa8, 0xd0, 0x64, 0x00, 0xac, 0xd0, 0x84, 0x00, 0xb0, 0xd0, 0xa4, 0x00, 0xb4,
|
||||
0xd0, 0xc4, 0x00, 0xb8, 0xd0, 0xe4, 0x00, 0xbc, 0xd1, 0x04, 0x00, 0xc0, 0xd1, 0x24, 0x00, 0xc4,
|
||||
0xd1, 0x44, 0x00, 0xc8, 0xd1, 0x64, 0x00, 0xcc, 0xd1, 0x84, 0x00, 0xd0, 0xd1, 0xa4, 0x00, 0xd4,
|
||||
0xd1, 0xc4, 0x00, 0xd8, 0xd1, 0xe4, 0x00, 0xdc, 0xd2, 0x04, 0x00, 0xe0, 0xd2, 0x24, 0x00, 0xe4,
|
||||
0xd2, 0x44, 0x00, 0xe8, 0xd2, 0x64, 0x00, 0xec, 0xd2, 0x84, 0x00, 0xf0, 0xd2, 0xa4, 0x00, 0xf4,
|
||||
0xd2, 0xc4, 0x00, 0xf8, 0xd2, 0xe4, 0x00, 0xfc, 0xd3, 0x04, 0x01, 0x00, 0xd3, 0x24, 0x01, 0x04,
|
||||
0xd3, 0x44, 0x01, 0x08, 0xd3, 0x64, 0x01, 0x0c, 0xd3, 0x84, 0x01, 0x10, 0xd3, 0xa4, 0x01, 0x14,
|
||||
0xd3, 0xc4, 0x01, 0x18, 0xd3, 0xe4, 0x01, 0x1c, 0x3f, 0xe0, 0x80, 0x00, 0x63, 0xe5, 0x26, 0xb4,
|
||||
0x82, 0x05, 0x00, 0x00, 0x82, 0x25, 0x00, 0x04, 0x82, 0x65, 0x00, 0x0c, 0x2c, 0x13, 0x00, 0x00,
|
||||
0x41, 0x82, 0x00, 0x74, 0x2c, 0x13, 0x00, 0x02, 0x40, 0x82, 0x00, 0x18, 0x81, 0x24, 0x00, 0x14,
|
||||
0x39, 0x33, 0x00, 0x03, 0x91, 0x25, 0x00, 0x00, 0x91, 0x25, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x6c,
|
||||
0x7c, 0x10, 0x98, 0x00, 0x41, 0x82, 0x00, 0x38, 0x7c, 0x11, 0x98, 0x00, 0x41, 0x82, 0x00, 0x30,
|
||||
0x7d, 0x30, 0x8a, 0x14, 0x91, 0x25, 0x00, 0x0c, 0x82, 0x05, 0x00, 0x08, 0x2c, 0x10, 0x00, 0x00,
|
||||
0x41, 0x82, 0x00, 0x48, 0x80, 0x64, 0x00, 0x10, 0x7c, 0x10, 0x18, 0x00, 0x40, 0x82, 0x00, 0x10,
|
||||
0x3a, 0x00, 0x00, 0x00, 0x92, 0x05, 0x00, 0x08, 0x48, 0x00, 0x00, 0x30, 0x3a, 0x20, 0x00, 0x00,
|
||||
0x92, 0x25, 0x00, 0x0c, 0x81, 0x24, 0x00, 0x18, 0x61, 0x29, 0x04, 0x00, 0x91, 0x24, 0x00, 0x18,
|
||||
0x48, 0x00, 0x00, 0x30, 0x7e, 0x12, 0xfb, 0xa6, 0x7e, 0x35, 0xfb, 0xa6, 0x39, 0x20, 0x00, 0x01,
|
||||
0x91, 0x25, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x1c, 0x38, 0xa0, 0x00, 0x02, 0x63, 0xe4, 0x26, 0xa0,
|
||||
0x90, 0xa4, 0x00, 0x00, 0x38, 0x60, 0x00, 0x11, 0x48, 0x00, 0x01, 0xbd, 0x4b, 0xff, 0xfc, 0x1d,
|
||||
0x7c, 0x20, 0x00, 0xa6, 0x54, 0x21, 0x07, 0xfa, 0x54, 0x21, 0x04, 0x5e, 0x7c, 0x20, 0x01, 0x24,
|
||||
0x63, 0xe1, 0x26, 0xc4, 0x80, 0x61, 0x00, 0x00, 0x7c, 0x6f, 0xf1, 0x20, 0x80, 0x61, 0x00, 0x14,
|
||||
0x7c, 0x7a, 0x03, 0xa6, 0x80, 0x61, 0x00, 0x18, 0x7c, 0x7b, 0x03, 0xa6, 0x80, 0x61, 0x00, 0x9c,
|
||||
0x7c, 0x68, 0x03, 0xa6, 0xb8, 0x41, 0x00, 0x24, 0x80, 0x01, 0x00, 0x1c, 0x80, 0x21, 0x00, 0x20,
|
||||
0x4c, 0x00, 0x01, 0x2c, 0x7c, 0x00, 0x04, 0xac, 0x4c, 0x00, 0x00, 0x64, 0x92, 0xb2, 0x00, 0x00,
|
||||
0x48, 0x00, 0x02, 0x50, 0x2e, 0x9d, 0x00, 0x02, 0x38, 0x60, 0x00, 0x08, 0x63, 0xec, 0x26, 0xa8,
|
||||
0x48, 0x00, 0x00, 0xf9, 0x80, 0xac, 0x00, 0x00, 0x80, 0x6c, 0x00, 0x04, 0x98, 0x65, 0x00, 0x00,
|
||||
0x41, 0x94, 0x00, 0x10, 0xb0, 0x65, 0x00, 0x00, 0x41, 0x96, 0x00, 0x08, 0x90, 0x65, 0x00, 0x00,
|
||||
0x7c, 0x00, 0x28, 0xac, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x2f, 0xac, 0x4c, 0x00, 0x01, 0x2c,
|
||||
0x48, 0x00, 0x02, 0x04, 0x48, 0x00, 0x01, 0x1d, 0x38, 0x60, 0x00, 0x04, 0x63, 0xec, 0x26, 0xa8,
|
||||
0x48, 0x00, 0x00, 0xb9, 0x82, 0x0c, 0x00, 0x00, 0x63, 0xec, 0x27, 0xe8, 0x48, 0x00, 0x00, 0x1c,
|
||||
0x48, 0x00, 0x01, 0x01, 0x38, 0x60, 0x00, 0x08, 0x63, 0xec, 0x26, 0xa8, 0x48, 0x00, 0x00, 0x9d,
|
||||
0x82, 0x0c, 0x00, 0x04, 0x81, 0x8c, 0x00, 0x00, 0x63, 0xfb, 0x26, 0xb0, 0x3a, 0x20, 0x0f, 0x80,
|
||||
0x48, 0x00, 0x02, 0x3d, 0x41, 0x82, 0x00, 0x20, 0x7e, 0x23, 0x8b, 0x78, 0x48, 0x00, 0x00, 0x7d,
|
||||
0x48, 0x00, 0x00, 0xd1, 0x41, 0x82, 0xff, 0xfc, 0x7d, 0x8c, 0x72, 0x14, 0x35, 0x6b, 0xff, 0xff,
|
||||
0x41, 0x81, 0xff, 0xe8, 0x80, 0x7b, 0x00, 0x00, 0x2c, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x08,
|
||||
0x48, 0x00, 0x00, 0x59, 0x7c, 0x00, 0x60, 0xac, 0x7c, 0x00, 0x04, 0xac, 0x7c, 0x00, 0x67, 0xac,
|
||||
0x4c, 0x00, 0x01, 0x2c, 0x48, 0x00, 0x01, 0x80, 0x7f, 0xc8, 0x02, 0xa6, 0x3c, 0x60, 0xa0, 0x00,
|
||||
0x48, 0x00, 0x00, 0x15, 0x76, 0x03, 0x08, 0x00, 0x56, 0x1d, 0x86, 0x3e, 0x7f, 0xc8, 0x03, 0xa6,
|
||||
0x4e, 0x80, 0x00, 0x20, 0x92, 0xf8, 0x68, 0x14, 0x90, 0x78, 0x68, 0x24, 0x92, 0xd8, 0x68, 0x20,
|
||||
0x80, 0xb8, 0x68, 0x20, 0x70, 0xa5, 0x00, 0x01, 0x40, 0x82, 0xff, 0xf8, 0x82, 0x18, 0x68, 0x24,
|
||||
0x90, 0xb8, 0x68, 0x14, 0x4e, 0x80, 0x00, 0x20, 0x7d, 0x48, 0x02, 0xa6, 0x7c, 0x69, 0x03, 0xa6,
|
||||
0x39, 0xc0, 0x00, 0x00, 0x48, 0x00, 0x00, 0x79, 0x48, 0x00, 0x00, 0x75, 0x4b, 0xff, 0xff, 0xad,
|
||||
0x41, 0x82, 0xff, 0xf4, 0x7f, 0xae, 0x61, 0xae, 0x39, 0xce, 0x00, 0x01, 0x42, 0x00, 0xff, 0xe8,
|
||||
0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x7d, 0x48, 0x02, 0xa6, 0x7c, 0x69, 0x03, 0xa6,
|
||||
0x39, 0xc0, 0x00, 0x00, 0x7c, 0x6c, 0x70, 0xae, 0x48, 0x00, 0x00, 0x1d, 0x41, 0x82, 0xff, 0xf8,
|
||||
0x39, 0xce, 0x00, 0x01, 0x42, 0x00, 0xff, 0xf0, 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20,
|
||||
0x38, 0x60, 0x00, 0xaa, 0x7f, 0xc8, 0x02, 0xa6, 0x54, 0x63, 0xa0, 0x16, 0x64, 0x63, 0xb0, 0x00,
|
||||
0x3a, 0xc0, 0x00, 0x19, 0x3a, 0xe0, 0x00, 0xd0, 0x3f, 0x00, 0xcd, 0x00, 0x4b, 0xff, 0xff, 0x69,
|
||||
0x56, 0x03, 0x37, 0xff, 0x7f, 0xc8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x7f, 0xc8, 0x02, 0xa6,
|
||||
0x3c, 0x60, 0xd0, 0x00, 0x4b, 0xff, 0xff, 0x51, 0x56, 0x03, 0x37, 0xff, 0x41, 0x82, 0xff, 0xf4,
|
||||
0x7f, 0xc8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x4b, 0xff, 0xff, 0xb9, 0x38, 0x60, 0x00, 0x08,
|
||||
0x63, 0xec, 0x26, 0xa8, 0x4b, 0xff, 0xff, 0x55, 0x80, 0xac, 0x00, 0x04, 0x81, 0x8c, 0x00, 0x00,
|
||||
0x63, 0xfb, 0x26, 0xb0, 0x62, 0xb1, 0xf8, 0x00, 0x7e, 0x0c, 0x28, 0x50, 0x48, 0x00, 0x00, 0xf1,
|
||||
0x41, 0x81, 0x00, 0x10, 0x82, 0x3b, 0x00, 0x00, 0x2c, 0x11, 0x00, 0x00, 0x41, 0x82, 0x00, 0x68,
|
||||
0x7e, 0x23, 0x8b, 0x78, 0x4b, 0xff, 0xff, 0x55, 0x4b, 0xff, 0xff, 0xa5, 0x4b, 0xff, 0xff, 0xa1,
|
||||
0x4b, 0xff, 0xfe, 0xd9, 0x41, 0x82, 0xff, 0xf4, 0x2c, 0x1d, 0x00, 0xcc, 0x41, 0x82, 0x00, 0x48,
|
||||
0x2c, 0x1d, 0x00, 0xbb, 0x41, 0x82, 0xff, 0xdc, 0x2c, 0x1d, 0x00, 0xaa, 0x40, 0x82, 0xff, 0xdc,
|
||||
0x7d, 0x8c, 0x72, 0x14, 0x35, 0x6b, 0xff, 0xff, 0x41, 0x80, 0x00, 0x2c, 0x4b, 0xff, 0xff, 0xb4,
|
||||
0x7e, 0xb5, 0xfb, 0xa6, 0x7e, 0xb2, 0xfb, 0xa6, 0x63, 0xe4, 0x26, 0xc4, 0x81, 0x24, 0x00, 0x18,
|
||||
0x55, 0x29, 0x05, 0xa8, 0x91, 0x24, 0x00, 0x18, 0x48, 0x00, 0x00, 0x0c, 0x38, 0x60, 0x00, 0x80,
|
||||
0x4b, 0xff, 0xff, 0x25, 0x80, 0x92, 0x00, 0x00, 0x2c, 0x04, 0x00, 0x00, 0x40, 0x82, 0xf9, 0xf8,
|
||||
0xb3, 0x94, 0x40, 0x10, 0xc8, 0x41, 0x00, 0x98, 0xc8, 0x61, 0x00, 0xa0, 0x7f, 0x20, 0x00, 0xa6,
|
||||
0x80, 0x01, 0x00, 0xac, 0x7c, 0x08, 0x03, 0xa6, 0x80, 0x01, 0x00, 0x0c, 0x7c, 0x0f, 0xf1, 0x20,
|
||||
0x80, 0x01, 0x00, 0x10, 0x7c, 0x09, 0x03, 0xa6, 0x80, 0x01, 0x00, 0x14, 0x7c, 0x01, 0x03, 0xa6,
|
||||
0xb8, 0x61, 0x00, 0x18, 0x80, 0x01, 0x00, 0x08, 0x38, 0x21, 0x00, 0xa8, 0x4c, 0x00, 0x01, 0x2c,
|
||||
0x7c, 0x00, 0x04, 0xac, 0x4e, 0x80, 0x00, 0x20, 0x7e, 0x23, 0x20, 0x50, 0x3c, 0xa0, 0x48, 0x00,
|
||||
0x52, 0x25, 0x01, 0xba, 0x90, 0xa3, 0x00, 0x00, 0x7c, 0x00, 0x18, 0xac, 0x7c, 0x00, 0x04, 0xac,
|
||||
0x7c, 0x00, 0x1f, 0xac, 0x4c, 0x00, 0x01, 0x2c, 0x4e, 0x80, 0x00, 0x20, 0x7d, 0x70, 0x8b, 0xd7,
|
||||
0x7d, 0x4b, 0x89, 0xd6, 0x7d, 0x4a, 0x80, 0x50, 0x91, 0x5b, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20,
|
||||
0x7f, 0xa8, 0x02, 0xa6, 0x63, 0xef, 0x27, 0xe8, 0x63, 0xe7, 0x18, 0x08, 0x3c, 0xc0, 0x80, 0x00,
|
||||
0x7c, 0xd0, 0x33, 0x78, 0x39, 0x00, 0x00, 0x00, 0x3c, 0x60, 0x00, 0xd0, 0x60, 0x63, 0xc0, 0xde,
|
||||
0x80, 0x8f, 0x00, 0x00, 0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x18, 0x80, 0x8f, 0x00, 0x04,
|
||||
0x7c, 0x03, 0x20, 0x00, 0x40, 0x82, 0x00, 0x0c, 0x39, 0xef, 0x00, 0x08, 0x48, 0x00, 0x00, 0x0c,
|
||||
0x7f, 0xa8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x80, 0x6f, 0x00, 0x00, 0x80, 0x8f, 0x00, 0x04,
|
||||
0x39, 0xef, 0x00, 0x08, 0x71, 0x09, 0x00, 0x01, 0x2f, 0x89, 0x00, 0x00, 0x39, 0x20, 0x00, 0x00,
|
||||
0x54, 0x6a, 0x1f, 0x7e, 0x54, 0x65, 0x3f, 0x7e, 0x74, 0x6b, 0x10, 0x00, 0x54, 0x63, 0x01, 0xfe,
|
||||
0x40, 0x82, 0x00, 0x0c, 0x54, 0xcc, 0x00, 0x0c, 0x48, 0x00, 0x00, 0x08, 0x7e, 0x0c, 0x83, 0x78,
|
||||
0x2e, 0x05, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x01, 0x41, 0xa0, 0x00, 0x2c, 0x41, 0xa2, 0x00, 0xe4,
|
||||
0x2c, 0x0a, 0x00, 0x03, 0x41, 0xa0, 0x01, 0xb0, 0x41, 0x82, 0x02, 0x54, 0x2c, 0x0a, 0x00, 0x05,
|
||||
0x41, 0x80, 0x02, 0xdc, 0x41, 0xa2, 0x04, 0xe8, 0x2c, 0x0a, 0x00, 0x07, 0x41, 0xa0, 0x05, 0x14,
|
||||
0x48, 0x00, 0x05, 0xf8, 0x7d, 0x8c, 0x1a, 0x14, 0x2c, 0x05, 0x00, 0x03, 0x41, 0x82, 0x00, 0x48,
|
||||
0x41, 0x81, 0x00, 0x60, 0x40, 0xbe, 0xff, 0x84, 0x2e, 0x05, 0x00, 0x01, 0x41, 0x91, 0x00, 0x2c,
|
||||
0x54, 0x8a, 0x84, 0x3e, 0x41, 0x92, 0x00, 0x10, 0x7c, 0x89, 0x61, 0xae, 0x39, 0x29, 0x00, 0x01,
|
||||
0x48, 0x00, 0x00, 0x0c, 0x7c, 0x89, 0x63, 0x2e, 0x39, 0x29, 0x00, 0x02, 0x35, 0x4a, 0xff, 0xff,
|
||||
0x40, 0xa0, 0xff, 0xe4, 0x4b, 0xff, 0xff, 0x54, 0x55, 0x8c, 0x00, 0x3a, 0x90, 0x8c, 0x00, 0x00,
|
||||
0x4b, 0xff, 0xff, 0x48, 0x7c, 0x89, 0x23, 0x78, 0x40, 0x9e, 0x04, 0xd0, 0x35, 0x29, 0xff, 0xff,
|
||||
0x41, 0x80, 0x04, 0xc8, 0x7c, 0xa9, 0x78, 0xae, 0x7c, 0xa9, 0x61, 0xae, 0x4b, 0xff, 0xff, 0xf0,
|
||||
0x39, 0xef, 0x00, 0x08, 0x40, 0xbe, 0xff, 0x24, 0x80, 0xaf, 0xff, 0xf8, 0x81, 0x6f, 0xff, 0xfc,
|
||||
0x54, 0xb1, 0x04, 0x3e, 0x54, 0xaa, 0x85, 0x3e, 0x54, 0xa5, 0x27, 0x3e, 0x2e, 0x85, 0x00, 0x01,
|
||||
0x41, 0x96, 0x00, 0x10, 0x41, 0xb5, 0x00, 0x14, 0x7c, 0x89, 0x61, 0xae, 0x48, 0x00, 0x00, 0x10,
|
||||
0x7c, 0x89, 0x63, 0x2e, 0x48, 0x00, 0x00, 0x08, 0x7c, 0x89, 0x61, 0x2e, 0x7c, 0x84, 0x5a, 0x14,
|
||||
0x7d, 0x29, 0x8a, 0x14, 0x35, 0x4a, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4, 0x4b, 0xff, 0xfe, 0xdc,
|
||||
0x54, 0x69, 0x07, 0xff, 0x41, 0x82, 0x00, 0x10, 0x55, 0x08, 0xf8, 0x7e, 0x71, 0x09, 0x00, 0x01,
|
||||
0x2f, 0x89, 0x00, 0x00, 0x2e, 0x85, 0x00, 0x04, 0x2d, 0x8a, 0x00, 0x05, 0x7d, 0x13, 0x43, 0x78,
|
||||
0x52, 0x68, 0x08, 0x3c, 0x40, 0x9e, 0x00, 0x78, 0x41, 0x8d, 0x04, 0xbc, 0x7d, 0x8c, 0x1a, 0x14,
|
||||
0x41, 0x8c, 0x00, 0x0c, 0x41, 0x94, 0x00, 0x30, 0x48, 0x00, 0x00, 0x1c, 0x40, 0x94, 0x00, 0x10,
|
||||
0x55, 0x8c, 0x00, 0x3a, 0x81, 0x6c, 0x00, 0x00, 0x48, 0x00, 0x00, 0x1c, 0x55, 0x8c, 0x00, 0x3c,
|
||||
0xa1, 0x6c, 0x00, 0x00, 0x7c, 0x89, 0x20, 0xf8, 0x55, 0x29, 0x84, 0x3e, 0x7d, 0x6b, 0x48, 0x38,
|
||||
0x54, 0x84, 0x04, 0x3e, 0x7f, 0x0b, 0x20, 0x40, 0x70, 0xa9, 0x00, 0x03, 0x41, 0x82, 0x00, 0x18,
|
||||
0x2c, 0x09, 0x00, 0x02, 0x41, 0x82, 0x00, 0x18, 0x41, 0x81, 0x00, 0x1c, 0x40, 0x9a, 0x00, 0x20,
|
||||
0x48, 0x00, 0x00, 0x18, 0x41, 0x9a, 0x00, 0x18, 0x48, 0x00, 0x00, 0x10, 0x41, 0x99, 0x00, 0x10,
|
||||
0x48, 0x00, 0x00, 0x08, 0x41, 0x98, 0x00, 0x08, 0x61, 0x08, 0x00, 0x01, 0x40, 0x8e, 0xfe, 0x3c,
|
||||
0x41, 0x94, 0xfe, 0x38, 0x81, 0x6f, 0xff, 0xf8, 0x40, 0x9e, 0x00, 0x20, 0x70, 0x6c, 0x00, 0x08,
|
||||
0x41, 0x82, 0x00, 0x0c, 0x71, 0x0c, 0x00, 0x01, 0x41, 0x82, 0x00, 0x10, 0x39, 0x8b, 0x00, 0x10,
|
||||
0x51, 0x8b, 0x03, 0x36, 0x48, 0x00, 0x00, 0x08, 0x55, 0x6b, 0x07, 0x16, 0x91, 0x6f, 0xff, 0xf8,
|
||||
0x4b, 0xff, 0xfe, 0x08, 0x40, 0xbe, 0xfe, 0x04, 0x54, 0x69, 0x16, 0xba, 0x54, 0x6e, 0x87, 0xfe,
|
||||
0x2d, 0x8e, 0x00, 0x00, 0x2e, 0x05, 0x00, 0x04, 0x70, 0xae, 0x00, 0x03, 0x2e, 0x8e, 0x00, 0x02,
|
||||
0x41, 0x94, 0x00, 0x14, 0x41, 0x96, 0x00, 0x50, 0x7c, 0x64, 0x07, 0x34, 0x7c, 0x84, 0x7a, 0x14,
|
||||
0x48, 0x00, 0x00, 0x68, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c, 0x7d, 0x27, 0x48, 0x2e,
|
||||
0x7c, 0x84, 0x4a, 0x14, 0x41, 0x8e, 0x00, 0x08, 0x7c, 0x8c, 0x22, 0x14, 0x2e, 0x8e, 0x00, 0x01,
|
||||
0x41, 0x96, 0x00, 0x08, 0x80, 0x84, 0x00, 0x00, 0x54, 0x63, 0x67, 0xff, 0x41, 0x82, 0x00, 0x3c,
|
||||
0x40, 0x90, 0x00, 0x0c, 0x7c, 0x84, 0x32, 0x14, 0x48, 0x00, 0x00, 0x30, 0x7c, 0x84, 0x82, 0x14,
|
||||
0x48, 0x00, 0x00, 0x28, 0x54, 0x65, 0xa7, 0xff, 0x41, 0x82, 0x00, 0x0c, 0x7d, 0x27, 0x48, 0x2e,
|
||||
0x7c, 0x84, 0x4a, 0x14, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0xcc, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x7c,
|
||||
0x7e, 0x0c, 0x21, 0x2e, 0x4b, 0xff, 0xfd, 0x74, 0x40, 0x90, 0x00, 0x0c, 0x7c, 0x86, 0x23, 0x78,
|
||||
0x4b, 0xff, 0xfd, 0x68, 0x7c, 0x90, 0x23, 0x78, 0x4b, 0xff, 0xfd, 0x60, 0x54, 0x89, 0x1e, 0x78,
|
||||
0x39, 0x29, 0x00, 0x40, 0x2c, 0x05, 0x00, 0x02, 0x41, 0x80, 0x00, 0x4c, 0x54, 0x6b, 0x67, 0xbf,
|
||||
0x2c, 0x0b, 0x00, 0x01, 0x41, 0x80, 0x00, 0x14, 0x41, 0x82, 0x00, 0x08, 0x48, 0x00, 0x00, 0x10,
|
||||
0x41, 0xbe, 0xfd, 0x38, 0x48, 0x00, 0x00, 0x08, 0x40, 0xbe, 0xfd, 0x30, 0x2c, 0x05, 0x00, 0x03,
|
||||
0x41, 0x81, 0x00, 0x10, 0x41, 0xa2, 0x00, 0x10, 0x7d, 0xe7, 0x48, 0x2e, 0x4b, 0xff, 0xfd, 0x1c,
|
||||
0x7d, 0xe7, 0x49, 0x2e, 0x7c, 0x64, 0x07, 0x34, 0x54, 0x84, 0x1a, 0x78, 0x7d, 0xef, 0x22, 0x14,
|
||||
0x4b, 0xff, 0xfd, 0x08, 0x40, 0xbe, 0xfd, 0x04, 0x7c, 0xa7, 0x4a, 0x14, 0x40, 0x92, 0x00, 0x14,
|
||||
0x54, 0x64, 0x04, 0x3e, 0x91, 0xe5, 0x00, 0x00, 0x90, 0x85, 0x00, 0x04, 0x4b, 0xff, 0xfc, 0xec,
|
||||
0x81, 0x25, 0x00, 0x04, 0x2c, 0x09, 0x00, 0x00, 0x41, 0xa2, 0xfc, 0xe0, 0x39, 0x29, 0xff, 0xff,
|
||||
0x91, 0x25, 0x00, 0x04, 0x81, 0xe5, 0x00, 0x00, 0x4b, 0xff, 0xfc, 0xd0, 0x40, 0xbe, 0xfc, 0xcc,
|
||||
0x54, 0x6b, 0x16, 0xba, 0x7f, 0x47, 0x5a, 0x14, 0x81, 0x3a, 0x00, 0x00, 0x54, 0x6e, 0x67, 0xbe,
|
||||
0x41, 0x92, 0x00, 0x84, 0x2e, 0x05, 0x00, 0x05, 0x40, 0x90, 0x01, 0x74, 0x2e, 0x05, 0x00, 0x03,
|
||||
0x40, 0x90, 0x00, 0x90, 0x2e, 0x05, 0x00, 0x01, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08,
|
||||
0x7c, 0x8c, 0x22, 0x14, 0x2f, 0x0e, 0x00, 0x01, 0x40, 0x92, 0x00, 0x24, 0x41, 0xb9, 0x00, 0x18,
|
||||
0x41, 0x9a, 0x00, 0x0c, 0x88, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xf8, 0xa0, 0x84, 0x00, 0x00,
|
||||
0x48, 0x00, 0x00, 0xf0, 0x80, 0x84, 0x00, 0x00, 0x48, 0x00, 0x00, 0xe8, 0x54, 0x73, 0xe5, 0x3e,
|
||||
0x41, 0xb9, 0x00, 0x20, 0x41, 0x9a, 0x00, 0x10, 0x99, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x01,
|
||||
0x48, 0x00, 0x00, 0x18, 0xb1, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x02, 0x48, 0x00, 0x00, 0x0c,
|
||||
0x91, 0x24, 0x00, 0x00, 0x38, 0x84, 0x00, 0x04, 0x36, 0x73, 0xff, 0xff, 0x40, 0x80, 0xff, 0xd4,
|
||||
0x4b, 0xff, 0xfc, 0x38, 0x54, 0x65, 0x87, 0xff, 0x41, 0x82, 0x00, 0x08, 0x7c, 0x84, 0x62, 0x14,
|
||||
0x71, 0xc5, 0x00, 0x01, 0x41, 0x82, 0x00, 0x9c, 0x7c, 0x84, 0x4a, 0x14, 0x48, 0x00, 0x00, 0x94,
|
||||
0x54, 0x6a, 0x87, 0xbe, 0x54, 0x8e, 0x16, 0xba, 0x7e, 0x67, 0x72, 0x14, 0x40, 0x92, 0x00, 0x08,
|
||||
0x3a, 0x6f, 0xff, 0xfc, 0x80, 0x9a, 0x00, 0x00, 0x81, 0x33, 0x00, 0x00, 0x71, 0x4b, 0x00, 0x01,
|
||||
0x41, 0x82, 0x00, 0x08, 0x7c, 0x9a, 0x23, 0x78, 0x71, 0x4b, 0x00, 0x02, 0x41, 0x82, 0x00, 0x10,
|
||||
0x7d, 0x33, 0x4b, 0x78, 0x40, 0xb2, 0x00, 0x08, 0x7e, 0x6c, 0x9a, 0x14, 0x54, 0x65, 0x67, 0x3f,
|
||||
0x2c, 0x05, 0x00, 0x09, 0x40, 0x80, 0x00, 0x54, 0x48, 0x00, 0x00, 0x79, 0x7c, 0x89, 0x22, 0x14,
|
||||
0x48, 0x00, 0x00, 0x40, 0x7c, 0x89, 0x21, 0xd6, 0x48, 0x00, 0x00, 0x38, 0x7d, 0x24, 0x23, 0x78,
|
||||
0x48, 0x00, 0x00, 0x30, 0x7d, 0x24, 0x20, 0x38, 0x48, 0x00, 0x00, 0x28, 0x7d, 0x24, 0x22, 0x78,
|
||||
0x48, 0x00, 0x00, 0x20, 0x7d, 0x24, 0x20, 0x30, 0x48, 0x00, 0x00, 0x18, 0x7d, 0x24, 0x24, 0x30,
|
||||
0x48, 0x00, 0x00, 0x10, 0x5d, 0x24, 0x20, 0x3e, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x24, 0x26, 0x30,
|
||||
0x90, 0x9a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x84, 0x2c, 0x05, 0x00, 0x0a, 0x41, 0x81, 0xfb, 0x7c,
|
||||
0xc0, 0x5a, 0x00, 0x00, 0xc0, 0x73, 0x00, 0x00, 0x41, 0x82, 0x00, 0x0c, 0xec, 0x43, 0x10, 0x2a,
|
||||
0x48, 0x00, 0x00, 0x08, 0xec, 0x43, 0x00, 0xb2, 0xd0, 0x5a, 0x00, 0x00, 0x4b, 0xff, 0xfb, 0x5c,
|
||||
0x7d, 0x48, 0x02, 0xa6, 0x54, 0xa5, 0x1e, 0x78, 0x7d, 0x4a, 0x2a, 0x14, 0x80, 0x9a, 0x00, 0x00,
|
||||
0x81, 0x33, 0x00, 0x00, 0x7d, 0x48, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x20, 0x40, 0xbe, 0xfb, 0x3c,
|
||||
0x54, 0x69, 0xc0, 0x3e, 0x7d, 0x8e, 0x63, 0x78, 0x48, 0x00, 0x00, 0x35, 0x41, 0x92, 0x00, 0x0c,
|
||||
0x7e, 0x31, 0x22, 0x14, 0x48, 0x00, 0x00, 0x08, 0x7d, 0x29, 0x22, 0x14, 0x54, 0x64, 0xc4, 0x3f,
|
||||
0x38, 0xa0, 0x00, 0x00, 0x41, 0x82, 0xfb, 0x14, 0x7d, 0x45, 0x88, 0xae, 0x7d, 0x45, 0x49, 0xae,
|
||||
0x38, 0xa5, 0x00, 0x01, 0x7c, 0x05, 0x20, 0x00, 0x4b, 0xff, 0xff, 0xec, 0x2e, 0x8a, 0x00, 0x04,
|
||||
0x55, 0x31, 0x36, 0xba, 0x2c, 0x11, 0x00, 0x3c, 0x7e, 0x27, 0x88, 0x2e, 0x40, 0x82, 0x00, 0x08,
|
||||
0x7d, 0xd1, 0x73, 0x78, 0x41, 0x96, 0x00, 0x08, 0xa2, 0x31, 0x00, 0x00, 0x55, 0x29, 0x56, 0xba,
|
||||
0x2c, 0x09, 0x00, 0x3c, 0x7d, 0x27, 0x48, 0x2e, 0x40, 0x82, 0x00, 0x08, 0x7d, 0xc9, 0x73, 0x78,
|
||||
0x41, 0x96, 0x00, 0x08, 0xa1, 0x29, 0x00, 0x00, 0x4e, 0x80, 0x00, 0x20, 0x2c, 0x05, 0x00, 0x04,
|
||||
0x40, 0x80, 0x00, 0x28, 0x7c, 0x89, 0x23, 0x78, 0x7d, 0xc3, 0x62, 0x14, 0x55, 0xce, 0x00, 0x3c,
|
||||
0x4b, 0xff, 0xff, 0xad, 0x7c, 0x84, 0x20, 0xf8, 0x54, 0x84, 0x04, 0x3e, 0x7d, 0x2b, 0x20, 0x38,
|
||||
0x7e, 0x24, 0x20, 0x38, 0x4b, 0xff, 0xfb, 0xbc, 0x54, 0x6b, 0xe4, 0x3e, 0x4b, 0xff, 0xfb, 0xb4,
|
||||
0x7c, 0x9a, 0x23, 0x78, 0x54, 0x84, 0x18, 0x38, 0x40, 0x92, 0x00, 0x20, 0x40, 0x9e, 0x00, 0x0c,
|
||||
0x7d, 0xe8, 0x03, 0xa6, 0x4e, 0x80, 0x00, 0x21, 0x7d, 0xe4, 0x7a, 0x14, 0x39, 0xef, 0x00, 0x07,
|
||||
0x55, 0xef, 0x00, 0x38, 0x4b, 0xff, 0xfa, 0x64, 0x2e, 0x05, 0x00, 0x03, 0x41, 0x91, 0x00, 0x5c,
|
||||
0x3c, 0xa0, 0x48, 0x00, 0x7d, 0x83, 0x62, 0x14, 0x55, 0x8c, 0x00, 0x3a, 0x40, 0x92, 0x00, 0x20,
|
||||
0x40, 0xbe, 0xfa, 0x48, 0x57, 0x44, 0x00, 0x3a, 0x7c, 0x8c, 0x20, 0x50, 0x50, 0x85, 0x01, 0xba,
|
||||
0x50, 0x65, 0x07, 0xfe, 0x90, 0xac, 0x00, 0x00, 0x4b, 0xff, 0xfa, 0x30, 0x40, 0xbe, 0xff, 0xbc,
|
||||
0x7d, 0x2c, 0x78, 0x50, 0x51, 0x25, 0x01, 0xba, 0x90, 0xac, 0x00, 0x00, 0x39, 0x8c, 0x00, 0x04,
|
||||
0x7d, 0x6f, 0x22, 0x14, 0x39, 0x6b, 0xff, 0xfc, 0x7d, 0x2b, 0x60, 0x50, 0x51, 0x25, 0x01, 0xba,
|
||||
0x90, 0xab, 0x00, 0x00, 0x4b, 0xff, 0xff, 0x94, 0x2e, 0x05, 0x00, 0x06, 0x41, 0x92, 0x00, 0x28,
|
||||
0x4b, 0xff, 0xfb, 0x20, 0x55, 0x8c, 0x84, 0x3e, 0x57, 0x44, 0x84, 0x3e, 0x57, 0x5a, 0x04, 0x3e,
|
||||
0x7c, 0x0c, 0x20, 0x00, 0x41, 0x80, 0xfb, 0xa4, 0x7c, 0x0c, 0xd0, 0x00, 0x40, 0x80, 0xfb, 0x9c,
|
||||
0x4b, 0xff, 0xf9, 0xd8, 0x57, 0x45, 0xff, 0xfe, 0x68, 0xa5, 0x00, 0x01, 0x71, 0x03, 0x00, 0x01,
|
||||
0x7c, 0x05, 0x18, 0x00, 0x41, 0x82, 0x00, 0x1c, 0x51, 0x1a, 0x0f, 0xbc, 0x6b, 0x5a, 0x00, 0x02,
|
||||
0x57, 0x45, 0xff, 0xff, 0x41, 0x82, 0x00, 0x08, 0x6b, 0x5a, 0x00, 0x01, 0x93, 0x4f, 0xff, 0xfc,
|
||||
0x53, 0x48, 0x07, 0xfe, 0x4b, 0xff, 0xf9, 0xa4, 0x2c, 0x0b, 0x00, 0x00, 0x40, 0x82, 0xf9, 0x94,
|
||||
0x40, 0x92, 0x00, 0x0c, 0x39, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x14, 0x54, 0x69, 0x06, 0xff,
|
||||
0x40, 0x82, 0x00, 0x08, 0x40, 0x9e, 0x00, 0x10, 0x54, 0x65, 0x67, 0xfe, 0x7d, 0x08, 0x4c, 0x30,
|
||||
0x7d, 0x08, 0x2a, 0x78, 0x54, 0x85, 0x00, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xa6, 0x2b, 0x78,
|
||||
0x54, 0x85, 0x80, 0x1f, 0x41, 0x82, 0x00, 0x08, 0x7c, 0xb0, 0x2b, 0x78, 0x4b, 0xff, 0xf9, 0x5c,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
};
|
||||
const int kenobiwii_size = sizeof(kenobiwii);
|
||||
|
@ -58,35 +58,35 @@ extern void vipatch(u32 address, u32 len);
|
||||
extern u32 regionfreeselect;
|
||||
|
||||
static const u32 viwiihooks[4] = {
|
||||
0x7CE33B78,0x38870034,0x38A70038,0x38C7004C
|
||||
0x7CE33B78,0x38870034,0x38A70038,0x38C7004C
|
||||
};
|
||||
|
||||
static const u32 multidolpatch1[2] = {
|
||||
0x3C03FFB4,0x28004F43
|
||||
};
|
||||
0x3C03FFB4,0x28004F43
|
||||
};
|
||||
|
||||
static const u32 healthcheckhook[2] = {
|
||||
0x41810010,0x881D007D
|
||||
};
|
||||
0x41810010,0x881D007D
|
||||
};
|
||||
|
||||
static const u32 updatecheckhook[3] = {
|
||||
0x80650050,0x80850054,0xA0A50058
|
||||
0x80650050,0x80850054,0xA0A50058
|
||||
};
|
||||
|
||||
static const u32 multidolpatch2[2] = {
|
||||
0x3F608000, 0x807B0018
|
||||
0x3F608000, 0x807B0018
|
||||
};
|
||||
|
||||
static const u32 recoveryhooks[3] = {
|
||||
0xA00100AC,0x5400073E,0x2C00000F
|
||||
0xA00100AC,0x5400073E,0x2C00000F
|
||||
};
|
||||
|
||||
static const u32 nocopyflag1[3] = {
|
||||
0x540007FF, 0x4182001C, 0x80630068
|
||||
0x540007FF, 0x4182001C, 0x80630068
|
||||
};
|
||||
|
||||
static const u32 nocopyflag2[3] = {
|
||||
0x540007FF, 0x41820024, 0x387E12E2
|
||||
0x540007FF, 0x41820024, 0x387E12E2
|
||||
};
|
||||
|
||||
// this one is for the GH3 and VC saves
|
||||
@ -95,265 +95,254 @@ static const u32 nocopyflag2[3] = {
|
||||
//};
|
||||
|
||||
static const u32 nocopyflag3[5] = {
|
||||
0x2C030000, 0x41820200,0x48000058,0x38610100
|
||||
0x2C030000, 0x41820200,0x48000058,0x38610100
|
||||
};
|
||||
// this removes the display warning for no copy VC and GH3 saves
|
||||
static const u32 nocopyflag4[4] = {
|
||||
0x80010008, 0x2C000000, 0x4182000C, 0x3BE00001
|
||||
0x80010008, 0x2C000000, 0x4182000C, 0x3BE00001
|
||||
};
|
||||
|
||||
static const u32 nocopyflag5[3] = {
|
||||
0x801D0024,0x540007FF,0x41820024
|
||||
0x801D0024,0x540007FF,0x41820024
|
||||
};
|
||||
|
||||
static const u32 movedvdpatch[3] = {
|
||||
0x2C040000, 0x41820120, 0x3C608109
|
||||
0x2C040000, 0x41820120, 0x3C608109
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static const u32 regionfreehooks[5] = {
|
||||
0x7C600774, 0x2C000001, 0x41820030,0x40800010,0x2C000000
|
||||
0x7C600774, 0x2C000001, 0x41820030,0x40800010,0x2C000000
|
||||
};
|
||||
|
||||
static const u32 fwritepatch[8] = {
|
||||
0x9421FFD0,0x7C0802A6,0x90010034,0xBF210014,0x7C9B2378,0x7CDC3378,0x7C7A1B78,0x7CB92B78 // bushing fwrite
|
||||
0x9421FFD0,0x7C0802A6,0x90010034,0xBF210014,0x7C9B2378,0x7CDC3378,0x7C7A1B78,0x7CB92B78 // bushing fwrite
|
||||
};
|
||||
|
||||
static const u32 kpadhooks[4] = {
|
||||
0x9A3F005E,0x38AE0080,0x389FFFFC,0x7E0903A6
|
||||
0x9A3F005E,0x38AE0080,0x389FFFFC,0x7E0903A6
|
||||
};
|
||||
|
||||
static const u32 kpadoldhooks[6] = {
|
||||
0x801D0060, 0x901E0060, 0x801D0064, 0x901E0064, 0x801D0068, 0x901E0068
|
||||
0x801D0060, 0x901E0060, 0x801D0064, 0x901E0064, 0x801D0068, 0x901E0068
|
||||
};
|
||||
|
||||
static const u32 joypadhooks[4] = {
|
||||
0x3AB50001, 0x3A73000C, 0x2C150004, 0x3B18000C
|
||||
0x3AB50001, 0x3A73000C, 0x2C150004, 0x3B18000C
|
||||
};
|
||||
|
||||
static const u32 langpatch[3] = {
|
||||
0x7C600775, 0x40820010, 0x38000000
|
||||
0x7C600775, 0x40820010, 0x38000000
|
||||
};
|
||||
|
||||
static const u32 vipatchcode[3] = {
|
||||
0x4182000C,0x4180001C,0x48000018
|
||||
0x4182000C,0x4180001C,0x48000018
|
||||
};
|
||||
|
||||
static const u32 wpadlibogc[5] = {
|
||||
// 0x38A00140, 0x7C095878, 0x7D600078, 0x901F0010,0x913F0014
|
||||
// 0x7FA00124, 0x8001001C, 0x83810008, 0x83A1000C,0x7C0803A6
|
||||
0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
|
||||
0x90A402E0,0x806502E4,0x908502E4,0x2C030000,0x906402E4
|
||||
};
|
||||
|
||||
void dogamehooks(void *addr, u32 len)
|
||||
{
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
void dogamehooks(void *addr, u32 len) {
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
|
||||
switch(hooktype)
|
||||
{
|
||||
|
||||
case 0:
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0){
|
||||
// printf("\n\n\n");
|
||||
// printf("found at address %x\n", addr_start);
|
||||
// sleep(2);
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
hooktype = 1;
|
||||
}
|
||||
break;
|
||||
while (addr_start < addr_end) {
|
||||
|
||||
/*
|
||||
case 2:
|
||||
if(memcmp(addr_start, kpadhooks, sizeof(kpadhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
}
|
||||
switch (hooktype) {
|
||||
|
||||
if(memcmp(addr_start, kpadoldhooks, sizeof(kpadoldhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(memcmp(addr_start, joypadhooks, sizeof(joypadhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
|
||||
case 4:
|
||||
if(memcmp(addr_start, recoveryhooks, sizeof(recoveryhooks))==0){
|
||||
patchhook3((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 2:
|
||||
break;
|
||||
|
||||
if(memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0){
|
||||
patchhook2((u32)addr_start, len);
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0) {
|
||||
// printf("\n\n\n");
|
||||
// printf("found at address %x\n", addr_start);
|
||||
// sleep(2);
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
hooktype = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case 6:
|
||||
// jap region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
regionfreejap((u32)addr_start, len);
|
||||
}
|
||||
/*
|
||||
case 2:
|
||||
if(memcmp(addr_start, kpadhooks, sizeof(kpadhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
}
|
||||
|
||||
// usa region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
regionfreeusa((u32)addr_start, len);
|
||||
}
|
||||
if(memcmp(addr_start, kpadoldhooks, sizeof(kpadoldhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
// pal region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
regionfreepal((u32)addr_start, len);
|
||||
}
|
||||
case 3:
|
||||
if(memcmp(addr_start, joypadhooks, sizeof(joypadhooks))==0){
|
||||
patchhook((u32)addr_start, len);
|
||||
patched = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
// skip disc update
|
||||
if(memcmp(addr_start, updatecheckhook, sizeof(updatecheckhook))==0){
|
||||
patchupdatecheck((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(memcmp(addr_start, recoveryhooks, sizeof(recoveryhooks))==0){
|
||||
patchhook3((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 2:
|
||||
|
||||
if (memcmp(addr_start, viwiihooks, sizeof(viwiihooks))==0) {
|
||||
patchhook2((u32)addr_start, len);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/*
|
||||
case 6:
|
||||
// jap region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
regionfreejap((u32)addr_start, len);
|
||||
}
|
||||
|
||||
// usa region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
regionfreeusa((u32)addr_start, len);
|
||||
}
|
||||
|
||||
// pal region free
|
||||
if(memcmp(addr_start, regionfreehooks, sizeof(regionfreehooks))==0){
|
||||
regionfreepal((u32)addr_start, len);
|
||||
}
|
||||
|
||||
// skip disc update
|
||||
if(memcmp(addr_start, updatecheckhook, sizeof(updatecheckhook))==0){
|
||||
patchupdatecheck((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 7:
|
||||
if(memcmp(addr_start, healthcheckhook, sizeof(healthcheckhook))==0){
|
||||
removehealthcheck((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if(memcmp(addr_start, healthcheckhook, sizeof(healthcheckhook))==0){
|
||||
removehealthcheck((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
|
||||
// no copy flags
|
||||
case 8:
|
||||
// Remove the actual flag so can copy back
|
||||
if(memcmp(addr_start, nocopyflag5, sizeof(nocopyflag5))==0){
|
||||
copyflagcheck5((u32)addr_start, len);
|
||||
}
|
||||
|
||||
|
||||
if(memcmp(addr_start, nocopyflag1, sizeof(nocopyflag1))==0){
|
||||
copyflagcheck1((u32)addr_start, len);
|
||||
}
|
||||
// no copy flags
|
||||
case 8:
|
||||
// Remove the actual flag so can copy back
|
||||
if(memcmp(addr_start, nocopyflag5, sizeof(nocopyflag5))==0){
|
||||
copyflagcheck5((u32)addr_start, len);
|
||||
}
|
||||
|
||||
if(memcmp(addr_start, nocopyflag2, sizeof(nocopyflag2))==0){
|
||||
copyflagcheck2((u32)addr_start, len);
|
||||
}
|
||||
|
||||
// no VC and GH3 save
|
||||
if(memcmp(addr_start, nocopyflag3, sizeof(nocopyflag2))==0){
|
||||
copyflagcheck3((u32)addr_start, len);
|
||||
}
|
||||
// no VC and GH3 save display remove
|
||||
if(memcmp(addr_start, nocopyflag4, sizeof(nocopyflag4))==0){
|
||||
copyflagcheck4((u32)addr_start, len);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
if(memcmp(addr_start, movedvdpatch, sizeof(movedvdpatch))==0){
|
||||
movedvdhooks((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
// multidol
|
||||
case 3:
|
||||
if(memcmp(addr_start, nocopyflag1, sizeof(nocopyflag1))==0){
|
||||
copyflagcheck1((u32)addr_start, len);
|
||||
}
|
||||
|
||||
if(memcmp(addr_start, multidolpatch1, sizeof(multidolpatch1))==0){
|
||||
multidolpatchone((u32)addr_start, len);
|
||||
}
|
||||
if(memcmp(addr_start, multidolpatch2, sizeof(multidolpatch2))==0){
|
||||
multidolpatchtwo((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
addr_start += 4;
|
||||
if(memcmp(addr_start, nocopyflag2, sizeof(nocopyflag2))==0){
|
||||
copyflagcheck2((u32)addr_start, len);
|
||||
}
|
||||
|
||||
// no VC and GH3 save
|
||||
if(memcmp(addr_start, nocopyflag3, sizeof(nocopyflag2))==0){
|
||||
copyflagcheck3((u32)addr_start, len);
|
||||
}
|
||||
// no VC and GH3 save display remove
|
||||
if(memcmp(addr_start, nocopyflag4, sizeof(nocopyflag4))==0){
|
||||
copyflagcheck4((u32)addr_start, len);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
if(memcmp(addr_start, movedvdpatch, sizeof(movedvdpatch))==0){
|
||||
movedvdhooks((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
// multidol
|
||||
case 3:
|
||||
|
||||
if (memcmp(addr_start, multidolpatch1, sizeof(multidolpatch1))==0) {
|
||||
multidolpatchone((u32)addr_start, len);
|
||||
}
|
||||
if (memcmp(addr_start, multidolpatch2, sizeof(multidolpatch2))==0) {
|
||||
multidolpatchtwo((u32)addr_start, len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Not used yet, for patching DOL once loaded into memory and befor execution
|
||||
void patchdol(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
void patchdol(void *addr, u32 len) {
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
if(memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
||||
// printf("\n\n\n");
|
||||
// printf("found at address %x\n", addr_start);
|
||||
// sleep(10);
|
||||
// patchhookdol((u32)addr_start, len);
|
||||
patched = 1;
|
||||
break;
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
if (memcmp(addr_start, wpadlibogc, sizeof(wpadlibogc))==0) {
|
||||
// printf("\n\n\n");
|
||||
// printf("found at address %x\n", addr_start);
|
||||
// sleep(10);
|
||||
// patchhookdol((u32)addr_start, len);
|
||||
patched = 1;
|
||||
break;
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void langpatcher(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
void langpatcher(void *addr, u32 len) {
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
|
||||
if(memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||
if(configbytes[0] != 0xCD){
|
||||
langvipatch((u32)addr_start, len, configbytes[0]);
|
||||
}
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
|
||||
if (memcmp(addr_start, langpatch, sizeof(langpatch))==0) {
|
||||
if (configbytes[0] != 0xCD) {
|
||||
langvipatch((u32)addr_start, len, configbytes[0]);
|
||||
}
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void patchdebug(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
void patchdebug(void *addr, u32 len) {
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
|
||||
if(memcmp(addr_start, fwritepatch, sizeof(fwritepatch))==0) {
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
memcpy(addr_start,fwrite_patch_bin,fwrite_patch_bin_len);
|
||||
// apply patch
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
while (addr_start < addr_end) {
|
||||
|
||||
if (memcmp(addr_start, fwritepatch, sizeof(fwritepatch))==0) {
|
||||
|
||||
memcpy(addr_start,fwrite_patch_bin,fwrite_patch_bin_len);
|
||||
// apply patch
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vidolpatcher(void *addr, u32 len)
|
||||
{
|
||||
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
void vidolpatcher(void *addr, u32 len) {
|
||||
|
||||
while(addr_start < addr_end)
|
||||
{
|
||||
if(memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
||||
vipatch((u32)addr_start, len);
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
void *addr_start = addr;
|
||||
void *addr_end = addr+len;
|
||||
|
||||
while (addr_start < addr_end) {
|
||||
if (memcmp(addr_start, vipatchcode, sizeof(vipatchcode))==0) {
|
||||
vipatch((u32)addr_start, len);
|
||||
}
|
||||
addr_start += 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,20 +22,19 @@
|
||||
#ifndef __PATCHCODE_H__
|
||||
#define __PATCHCODE_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
// Globals
|
||||
u32 hooktype;
|
||||
int patched;
|
||||
u8 configbytes[2];
|
||||
u32 regionfree;
|
||||
u32 hooktype;
|
||||
int patched;
|
||||
u8 configbytes[2];
|
||||
u32 regionfree;
|
||||
|
||||
// Function prototypes
|
||||
void dogamehooks(void *addr, u32 len);
|
||||
void langpatcher(void *addr, u32 len);
|
||||
void vidolpatcher(void *addr, u32 len);
|
||||
void patchdebug(void *addr, u32 len);
|
||||
void dogamehooks(void *addr, u32 len);
|
||||
void langpatcher(void *addr, u32 len);
|
||||
void vidolpatcher(void *addr, u32 len);
|
||||
void patchdebug(void *addr, u32 len);
|
||||
|
||||
|
||||
|
||||
|
@ -1,508 +1,508 @@
|
||||
|
||||
# (c) Nuke www.usbgecko.com. Licensed under GPL V2
|
||||
# (c) Nuke www.usbgecko.com. Licensed under GPL V2
|
||||
.text
|
||||
#include "ppc.h"
|
||||
|
||||
|
||||
.globl patchhook # r3 address
|
||||
patchhook:
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
findblr:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findblr # loop length
|
||||
b exit # stop unhooked game hanging
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findblr # loop length
|
||||
b exit # stop unhooked game hanging
|
||||
|
||||
writebranch:
|
||||
lis r4, 0x8000 # 800018A0 hook location (source)
|
||||
ori r4, r4, 0x18A8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
lis r5, 0x3FF
|
||||
ori r5, r5, 0xFFFF # 0x3FFFFFF
|
||||
and r4, r4, r5
|
||||
lis r5, 0x4800 # 0x48000000
|
||||
or r4, r4, r5
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
lis r4, 0x8000 # 800018A0 hook location (source)
|
||||
ori r4, r4, 0x18A8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
lis r5, 0x3FF
|
||||
ori r5, r5, 0xFFFF # 0x3FFFFFF
|
||||
and r4, r4, r5
|
||||
lis r5, 0x4800 # 0x48000000
|
||||
or r4, r4, r5
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit:
|
||||
blr # return
|
||||
blr # return
|
||||
|
||||
.globl patchhook2 # r3 address
|
||||
patchhook2:
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
findblr2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch2
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findblr2 # loop length
|
||||
b exit2 # stop unhooked game hanging
|
||||
.globl patchhook2 # r3 address
|
||||
patchhook2:
|
||||
mtctr r4
|
||||
lis r6, 0x4E80
|
||||
ori r6, r6, 0x0020 # blr
|
||||
findblr2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebranch2
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findblr2 # loop length
|
||||
b exit2 # stop unhooked game hanging
|
||||
|
||||
writebranch2:
|
||||
lis r4, 0x8000 # 81700000 our temp patcher
|
||||
ori r4, r4, 0x18a8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
lis r5, 0x3FF
|
||||
ori r5, r5, 0xFFFF # 0x3FFFFFF
|
||||
and r4, r4, r5
|
||||
lis r5, 0x4800 # 0x48000000
|
||||
or r4, r4, r5
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit2:
|
||||
blr # return
|
||||
writebranch2:
|
||||
lis r4, 0x8000 # 81700000 our temp patcher
|
||||
ori r4, r4, 0x18a8
|
||||
subf r4, r3, r4 # subtract r3 from r4 and place in r4
|
||||
lis r5, 0x3FF
|
||||
ori r5, r5, 0xFFFF # 0x3FFFFFF
|
||||
and r4, r4, r5
|
||||
lis r5, 0x4800 # 0x48000000
|
||||
or r4, r4, r5
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit2:
|
||||
blr # return
|
||||
|
||||
.globl patchhook3 # r3 address
|
||||
patchhook3:
|
||||
mtctr r4
|
||||
lis r6, 0x4BFF
|
||||
ori r6, r6, 0xE955 # blr
|
||||
findbne:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebl
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findbne # loop length
|
||||
b exit3 # stop unhooked game hanging
|
||||
.globl patchhook3 # r3 address
|
||||
patchhook3:
|
||||
mtctr r4
|
||||
lis r6, 0x4BFF
|
||||
ori r6, r6, 0xE955 # blr
|
||||
findbne:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebl
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findbne # loop length
|
||||
b exit3 # stop unhooked game hanging
|
||||
|
||||
writebl:
|
||||
lis r4, 0x4BFF # 81700000 our temp patcher
|
||||
ori r4, r4, 0xEA91
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit3:
|
||||
blr # return
|
||||
writebl:
|
||||
lis r4, 0x4BFF # 81700000 our temp patcher
|
||||
ori r4, r4, 0xEA91
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit3:
|
||||
blr # return
|
||||
|
||||
.globl patchhook4 # r3 address
|
||||
patchhook4:
|
||||
mtctr r4
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x001C # blr
|
||||
findregion:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebr
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findregion # loop length
|
||||
b exit4 # stop unhooked game hanging
|
||||
.globl patchhook4 # r3 address
|
||||
patchhook4:
|
||||
mtctr r4
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x001C # blr
|
||||
findregion:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebr
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findregion # loop length
|
||||
b exit4 # stop unhooked game hanging
|
||||
|
||||
writebr:
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x001C
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit4:
|
||||
blr # return
|
||||
writebr:
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x001C
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exit4:
|
||||
blr # return
|
||||
|
||||
.globl multidolpatchone # r3 address
|
||||
multidolpatchone:
|
||||
mtctr r4
|
||||
lis r6, 0x3800
|
||||
ori r6, r6, 0x0001 # (li r0,1)
|
||||
findmulti:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writemulti
|
||||
subi r3, r3, 4 # go back
|
||||
bdnz findmulti # loop length
|
||||
b exit5 # stop unhooked game hanging
|
||||
.globl multidolpatchone # r3 address
|
||||
multidolpatchone:
|
||||
mtctr r4
|
||||
lis r6, 0x3800
|
||||
ori r6, r6, 0x0001 # (li r0,1)
|
||||
findmulti:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writemulti
|
||||
subi r3, r3, 4 # go back
|
||||
bdnz findmulti # loop length
|
||||
b exit5 # stop unhooked game hanging
|
||||
|
||||
writemulti:
|
||||
lis r4, 0x8170 # 81700000
|
||||
ori r4, r4, 0x0020
|
||||
subf r18, r3, r4 # subf r18,(source),(dest)
|
||||
lis r6, 0x4800
|
||||
ori r6,r6,1
|
||||
rlwimi r6,r18,0,6,29
|
||||
stw r6,0(r3)
|
||||
stw r6,0(r19)
|
||||
stw r3,4(r19)
|
||||
dcbf r0, r3
|
||||
sync
|
||||
icbi r0, r3
|
||||
isync
|
||||
exit5:
|
||||
blr # return
|
||||
writemulti:
|
||||
lis r4, 0x8170 # 81700000
|
||||
ori r4, r4, 0x0020
|
||||
subf r18, r3, r4 # subf r18,(source),(dest)
|
||||
lis r6, 0x4800
|
||||
ori r6,r6,1
|
||||
rlwimi r6,r18,0,6,29
|
||||
stw r6,0(r3)
|
||||
stw r6,0(r19)
|
||||
stw r3,4(r19)
|
||||
dcbf r0, r3
|
||||
sync
|
||||
icbi r0, r3
|
||||
isync
|
||||
exit5:
|
||||
blr # return
|
||||
|
||||
.globl multidolpatchtwo # r3 address
|
||||
multidolpatchtwo:
|
||||
mtctr r4
|
||||
lis r6, 0x3F60
|
||||
ori r6, r6, 0x8000 # (lis r27,-32768)
|
||||
findmulti2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writemulti2
|
||||
addi r3, r3, 4 # go forward
|
||||
bdnz findmulti2 # loop length
|
||||
b exit6 # stop unhooked game hanging
|
||||
.globl multidolpatchtwo # r3 address
|
||||
multidolpatchtwo:
|
||||
mtctr r4
|
||||
lis r6, 0x3F60
|
||||
ori r6, r6, 0x8000 # (lis r27,-32768)
|
||||
findmulti2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writemulti2
|
||||
addi r3, r3, 4 # go forward
|
||||
bdnz findmulti2 # loop length
|
||||
b exit6 # stop unhooked game hanging
|
||||
|
||||
writemulti2:
|
||||
lis r4, 0x8170 # 81700020
|
||||
ori r4, r4, 0x0000
|
||||
subf r18, r3, r4 # subf r18,(source),(dest)
|
||||
lis r6, 0x4800
|
||||
ori r6,r6,1
|
||||
rlwimi r6,r18,0,6,29
|
||||
stw r6,0(r3)
|
||||
stw r6,0(r19)
|
||||
stw r3,4(r19)
|
||||
dcbf r0, r3
|
||||
sync
|
||||
icbi r0, r3
|
||||
isync
|
||||
exit6:
|
||||
blr # return
|
||||
writemulti2:
|
||||
lis r4, 0x8170 # 81700020
|
||||
ori r4, r4, 0x0000
|
||||
subf r18, r3, r4 # subf r18,(source),(dest)
|
||||
lis r6, 0x4800
|
||||
ori r6,r6,1
|
||||
rlwimi r6,r18,0,6,29
|
||||
stw r6,0(r3)
|
||||
stw r6,0(r19)
|
||||
stw r3,4(r19)
|
||||
dcbf r0, r3
|
||||
sync
|
||||
icbi r0, r3
|
||||
isync
|
||||
exit6:
|
||||
blr # return
|
||||
|
||||
.globl langvipatch # r3 address, r4 len, r5 lang byte
|
||||
langvipatch:
|
||||
mtctr r4
|
||||
lis r6, 0x8861
|
||||
ori r6, r6, 0x0008 # lbz r3, 8(sp)
|
||||
findlang:
|
||||
lwz r7, 0(r3)
|
||||
cmpw r6, r7
|
||||
beq patchlang
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findlang # loop length
|
||||
b exitlang # stop unhooked game hanging
|
||||
.globl langvipatch # r3 address, r4 len, r5 lang byte
|
||||
langvipatch:
|
||||
mtctr r4
|
||||
lis r6, 0x8861
|
||||
ori r6, r6, 0x0008 # lbz r3, 8(sp)
|
||||
findlang:
|
||||
lwz r7, 0(r3)
|
||||
cmpw r6, r7
|
||||
beq patchlang
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findlang # loop length
|
||||
b exitlang # stop unhooked game hanging
|
||||
|
||||
patchlang:
|
||||
|
||||
lis r4, 0x3860 # 0x38600001 li %r3, 1 # eng
|
||||
add r4, r4, r5
|
||||
gofinal:
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitlang:
|
||||
blr # return
|
||||
patchlang:
|
||||
|
||||
.globl vipatch # r3 address
|
||||
vipatch:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0xFFFE
|
||||
findvi:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq patchvi
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findvi # loop length
|
||||
b exitvi # stop unhooked game hanging
|
||||
lis r4, 0x3860 # 0x38600001 li %r3, 1 # eng
|
||||
add r4, r4, r5
|
||||
gofinal:
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitlang:
|
||||
blr # return
|
||||
|
||||
patchvi:
|
||||
lis r4, 0x8000
|
||||
ori r4, r4, 0x0003
|
||||
lbz r5, 0(r4)
|
||||
cmpwi r5, 0x45 # USA
|
||||
beq patchusa
|
||||
cmpwi r5, 0x4A
|
||||
beq patchjap2 # JAP
|
||||
b exitvi
|
||||
patchjap2:
|
||||
lis r4, 0x3800
|
||||
ori r4, r4, 0x0001
|
||||
b gofinal2
|
||||
patchusa:
|
||||
lis r4, 0x3800
|
||||
ori r4, r4, 0x0000
|
||||
gofinal2:
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitvi:
|
||||
blr # return
|
||||
.globl vipatch # r3 address
|
||||
vipatch:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0xFFFE
|
||||
findvi:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq patchvi
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findvi # loop length
|
||||
b exitvi # stop unhooked game hanging
|
||||
|
||||
.globl regionfreejap # r3 address
|
||||
regionfreejap:
|
||||
mtctr r4
|
||||
lis r6, 0x2C1B
|
||||
ori r6, r6, 0x0000 # blr
|
||||
findjap:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findjap # loop length
|
||||
b exitjap # stop unhooked game hanging
|
||||
patchvi:
|
||||
lis r4, 0x8000
|
||||
ori r4, r4, 0x0003
|
||||
lbz r5, 0(r4)
|
||||
cmpwi r5, 0x45 # USA
|
||||
beq patchusa
|
||||
cmpwi r5, 0x4A
|
||||
beq patchjap2 # JAP
|
||||
b exitvi
|
||||
patchjap2:
|
||||
lis r4, 0x3800
|
||||
ori r4, r4, 0x0001
|
||||
b gofinal2
|
||||
patchusa:
|
||||
lis r4, 0x3800
|
||||
ori r4, r4, 0x0000
|
||||
gofinal2:
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitvi:
|
||||
blr # return
|
||||
|
||||
writenop:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitjap:
|
||||
blr # return
|
||||
.globl regionfreejap # r3 address
|
||||
regionfreejap:
|
||||
mtctr r4
|
||||
lis r6, 0x2C1B
|
||||
ori r6, r6, 0x0000 # blr
|
||||
findjap:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findjap # loop length
|
||||
b exitjap # stop unhooked game hanging
|
||||
|
||||
.globl regionfreeusa # r3 address
|
||||
regionfreeusa:
|
||||
mtctr r4
|
||||
lis r6, 0x281B
|
||||
ori r6, r6, 0x0001 # blr
|
||||
findusa:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop1
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findusa # loop length
|
||||
b exitusa # stop unhooked game hanging
|
||||
writenop:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitjap:
|
||||
blr # return
|
||||
|
||||
writenop1:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitusa:
|
||||
blr # return
|
||||
.globl regionfreeusa # r3 address
|
||||
regionfreeusa:
|
||||
mtctr r4
|
||||
lis r6, 0x281B
|
||||
ori r6, r6, 0x0001 # blr
|
||||
findusa:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop1
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findusa # loop length
|
||||
b exitusa # stop unhooked game hanging
|
||||
|
||||
.globl regionfreepal # r3 address
|
||||
regionfreepal:
|
||||
mtctr r4
|
||||
lis r6, 0x281B
|
||||
ori r6, r6, 0x0002 # blr
|
||||
findpal:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop2
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findpal # loop length
|
||||
b exitpal # stop unhooked game hanging
|
||||
writenop1:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitusa:
|
||||
blr # return
|
||||
|
||||
writenop2:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
.globl regionfreepal # r3 address
|
||||
regionfreepal:
|
||||
mtctr r4
|
||||
lis r6, 0x281B
|
||||
ori r6, r6, 0x0002 # blr
|
||||
findpal:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenop2
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findpal # loop length
|
||||
b exitpal # stop unhooked game hanging
|
||||
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x001C # bne loc_81377A2C
|
||||
findextra: #this is just the bne to b patch
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writeb
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findextra # loop length
|
||||
b exitpal # stop unhooked game hanging
|
||||
writenop2:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x6000 # nop
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
|
||||
writeb:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x001c # b loc_81377A2C
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitpal:
|
||||
blr # return
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x001C # bne loc_81377A2C
|
||||
findextra: #this is just the bne to b patch
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writeb
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findextra # loop length
|
||||
b exitpal # stop unhooked game hanging
|
||||
|
||||
.globl removehealthcheck # r3 address
|
||||
removehealthcheck:
|
||||
mtctr r4
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x004C # blr
|
||||
findhe:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebhe
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findhe # loop length
|
||||
b exithe # stop unhooked game hanging
|
||||
writeb:
|
||||
addi r3, r3, 4 # next word
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x001c # b loc_81377A2C
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitpal:
|
||||
blr # return
|
||||
|
||||
writebhe:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exithe:
|
||||
blr # return
|
||||
.globl removehealthcheck # r3 address
|
||||
removehealthcheck:
|
||||
mtctr r4
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x004C # blr
|
||||
findhe:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writebhe
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findhe # loop length
|
||||
b exithe # stop unhooked game hanging
|
||||
|
||||
|
||||
writebhe:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exithe:
|
||||
blr # return
|
||||
|
||||
.globl patchupdatecheck # r3 address
|
||||
patchupdatecheck:
|
||||
mtctr r4
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x0020 # blr
|
||||
finduc:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenopuc
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz finduc # loop length
|
||||
b exituc # stop unhooked game hanging
|
||||
|
||||
writenopuc:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exituc:
|
||||
blr # return
|
||||
|
||||
.globl patchupdatecheck # r3 address
|
||||
patchupdatecheck:
|
||||
mtctr r4
|
||||
lis r6, 0x4082
|
||||
ori r6, r6, 0x0020 # blr
|
||||
finduc:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writenopuc
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz finduc # loop length
|
||||
b exituc # stop unhooked game hanging
|
||||
|
||||
writenopuc:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exituc:
|
||||
blr # return
|
||||
|
||||
|
||||
|
||||
|
||||
.globl copyflagcheck1 # r3 address
|
||||
copyflagcheck1:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0x07FF
|
||||
findncf1:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf1
|
||||
subi r3, r3, 4 # next word
|
||||
bdnz findncf1 # loop length
|
||||
b exitncf1 # stop unhooked game hanging
|
||||
.globl copyflagcheck1 # r3 address
|
||||
copyflagcheck1:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0x07FF
|
||||
findncf1:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf1
|
||||
subi r3, r3, 4 # next word
|
||||
bdnz findncf1 # loop length
|
||||
b exitncf1 # stop unhooked game hanging
|
||||
|
||||
writencf1:
|
||||
lis r4, 0x7C00
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf1:
|
||||
blr # return
|
||||
writencf1:
|
||||
lis r4, 0x7C00
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf1:
|
||||
blr # return
|
||||
|
||||
.globl copyflagcheck2 # r3 address
|
||||
copyflagcheck2:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0x07FF
|
||||
findncf2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf2
|
||||
subi r3, r3, 4 # next word
|
||||
bdnz findncf2 # loop length
|
||||
b exitncf2 # stop unhooked game hanging
|
||||
.globl copyflagcheck2 # r3 address
|
||||
copyflagcheck2:
|
||||
mtctr r4
|
||||
lis r6, 0x5400
|
||||
ori r6, r6, 0x07FF
|
||||
findncf2:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf2
|
||||
subi r3, r3, 4 # next word
|
||||
bdnz findncf2 # loop length
|
||||
b exitncf2 # stop unhooked game hanging
|
||||
|
||||
writencf2:
|
||||
lis r4, 0x7C00
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf2:
|
||||
blr # return
|
||||
writencf2:
|
||||
lis r4, 0x7C00
|
||||
ori r4, r4, 0x0000
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf2:
|
||||
blr # return
|
||||
|
||||
|
||||
.globl copyflagcheck3 # r3 address
|
||||
copyflagcheck3:
|
||||
findncf3:
|
||||
addi r3, r3, 20 # go back one dword (4 bytes)
|
||||
lwz r5, 0(r3)
|
||||
writencf3:
|
||||
lis r4, 0x3860
|
||||
ori r4, r4, 0x0001 # li r3,1
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf3:
|
||||
blr # return
|
||||
.globl copyflagcheck3 # r3 address
|
||||
copyflagcheck3:
|
||||
findncf3:
|
||||
addi r3, r3, 20 # go back one dword (4 bytes)
|
||||
lwz r5, 0(r3)
|
||||
writencf3:
|
||||
lis r4, 0x3860
|
||||
ori r4, r4, 0x0001 # li r3,1
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf3:
|
||||
blr # return
|
||||
|
||||
|
||||
.globl copyflagcheck4 # r3 address
|
||||
copyflagcheck4:
|
||||
mtctr r4
|
||||
lis r6, 0x3BE0
|
||||
ori r6, r6, 0x0001 # li r31,1
|
||||
findncf4:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf4
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findncf4 # loop length
|
||||
b exitncf4 # stop unhooked game hanging
|
||||
.globl copyflagcheck4 # r3 address
|
||||
copyflagcheck4:
|
||||
mtctr r4
|
||||
lis r6, 0x3BE0
|
||||
ori r6, r6, 0x0001 # li r31,1
|
||||
findncf4:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf4
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findncf4 # loop length
|
||||
b exitncf4 # stop unhooked game hanging
|
||||
|
||||
writencf4:
|
||||
lis r4, 0x3BE0
|
||||
ori r4, r4, 0x0000 # change this to 3BE00000 (li r31,0)
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf4:
|
||||
blr # return
|
||||
writencf4:
|
||||
lis r4, 0x3BE0
|
||||
ori r4, r4, 0x0000 # change this to 3BE00000 (li r31,0)
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitncf4:
|
||||
blr # return
|
||||
|
||||
.globl copyflagcheck5 # r3 address
|
||||
copyflagcheck5:
|
||||
mtctr r4
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x0024 # beq loc_8134AA60
|
||||
findncf5:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf5
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findncf5 # loop length
|
||||
b exitncf5 # stop unhooked game hanging
|
||||
.globl copyflagcheck5 # r3 address
|
||||
copyflagcheck5:
|
||||
mtctr r4
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x0024 # beq loc_8134AA60
|
||||
findncf5:
|
||||
lwz r5, 0(r3)
|
||||
cmpw r6, r5
|
||||
beq writencf5
|
||||
addi r3, r3, 4 # next word
|
||||
bdnz findncf5 # loop length
|
||||
b exitncf5 # stop unhooked game hanging
|
||||
|
||||
writencf5:
|
||||
#addi r3, r3, 8 # skip 2
|
||||
|
||||
lis r4, 0x801D
|
||||
ori r4, r4, 0x0024 # change to 801D0024 (lwz r0,36(r29))
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
|
||||
addi r3, r3, 4 # next word
|
||||
writencf5:
|
||||
#addi r3, r3, 8 # skip 2
|
||||
|
||||
lis r4, 0x5400
|
||||
ori r4, r4, 0x003C # change to 5400003C (rlwinm r0,r0,0,0,30)
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
lis r4, 0x801D
|
||||
ori r4, r4, 0x0024 # change to 801D0024 (lwz r0,36(r29))
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
|
||||
addi r3, r3, 4 # next word
|
||||
addi r3, r3, 4 # next word
|
||||
|
||||
lis r4, 0x901D
|
||||
ori r4, r4, 0x0024 # change to 901D0024 (stw r0,36(r29))
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
lis r4, 0x5400
|
||||
ori r4, r4, 0x003C # change to 5400003C (rlwinm r0,r0,0,0,30)
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
|
||||
addi r3, r3, 4 # next word
|
||||
addi r3, r3, 4 # next word
|
||||
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x0018 # change to 48000018 (b 0x8134aa60)
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
exitncf5:
|
||||
blr # return
|
||||
lis r4, 0x901D
|
||||
ori r4, r4, 0x0024 # change to 901D0024 (stw r0,36(r29))
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
|
||||
.globl movedvdhooks # r3 address
|
||||
movedvdhooks:
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x0120 # beq loc_813A7938
|
||||
findmd1:
|
||||
addi r3, r3, 4 # next word
|
||||
lwz r5, 0(r3)
|
||||
writemd1:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000 # nop
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitmd1:
|
||||
blr # return
|
||||
addi r3, r3, 4 # next word
|
||||
|
||||
lis r4, 0x4800
|
||||
ori r4, r4, 0x0018 # change to 48000018 (b 0x8134aa60)
|
||||
stw r4, 0(r3)
|
||||
dcbf r0, r3
|
||||
icbi r0, r3
|
||||
exitncf5:
|
||||
blr # return
|
||||
|
||||
.globl movedvdhooks # r3 address
|
||||
movedvdhooks:
|
||||
lis r6, 0x4182
|
||||
ori r6, r6, 0x0120 # beq loc_813A7938
|
||||
findmd1:
|
||||
addi r3, r3, 4 # next word
|
||||
lwz r5, 0(r3)
|
||||
writemd1:
|
||||
lis r4, 0x6000
|
||||
ori r4, r4, 0x0000 # nop
|
||||
stw r4, 0(r3) # result in r3
|
||||
dcbf r0, r3 # data cache block flush
|
||||
icbi r0, r3
|
||||
exitmd1:
|
||||
blr # return
|
||||
|
||||
|
@ -29,302 +29,295 @@ extern u8 reset;
|
||||
/********************************************************************************
|
||||
*Game specific settings
|
||||
*********************************************************************************/
|
||||
int DiscBrowse(struct discHdr * header)
|
||||
{
|
||||
bool exit = false;
|
||||
int ret, choice;
|
||||
u64 offset;
|
||||
int DiscBrowse(struct discHdr * header) {
|
||||
bool exit = false;
|
||||
int ret, choice;
|
||||
u64 offset;
|
||||
|
||||
|
||||
ret = Disc_SetUSB(header->id);
|
||||
if(ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not set USB."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = Disc_Open();
|
||||
if(ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not open disc."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ret = __Disc_FindPartition(&offset);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not find a WBFS partition."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = WDVD_OpenPartition(offset);
|
||||
ret = Disc_SetUSB(header->id);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK"));
|
||||
return ret;
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not set USB."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ret = Disc_Open();
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not open disc."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ret = __Disc_FindPartition(&offset);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not find a WBFS partition."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = WDVD_OpenPartition(offset);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int *buffer = (int*)memalign(32, 0x20);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = WDVD_Read(buffer, 0x20, 0x420);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *fstbuffer = memalign(32, buffer[2]*4);
|
||||
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
|
||||
|
||||
if (fst == NULL)
|
||||
{
|
||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = WDVD_Read(fstbuffer, buffer[2]*4, buffer[1]*4);
|
||||
if (buffer == NULL) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
|
||||
free(buffer);
|
||||
free(fstbuffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
WDVD_Reset();
|
||||
//Disc_SetUSB(NULL);
|
||||
WDVD_ClosePartition();
|
||||
|
||||
u32 discfilecount = fst[0].filelen;
|
||||
u32 dolfilecount = 0;
|
||||
//int offsetselect[20];
|
||||
|
||||
customOptionList options3(discfilecount);
|
||||
|
||||
for (u32 i = 0; i < discfilecount; i++) {
|
||||
|
||||
//don't add files that aren't .dol to the list
|
||||
int len = (strlen(fstfiles(fst, i)));
|
||||
if (fstfiles(fst, i)[len-4] =='.' &&
|
||||
fstfiles(fst, i)[len-3] =='d' &&
|
||||
fstfiles(fst, i)[len-2] =='o' &&
|
||||
fstfiles(fst, i)[len-1] =='l')
|
||||
{
|
||||
options3.SetName(i, "%i", i);
|
||||
options3.SetValue(i, fstfiles(fst, i));
|
||||
//options3.SetName(i, fstfiles(fst, i));
|
||||
|
||||
dolfilecount++;
|
||||
}
|
||||
}
|
||||
|
||||
if(dolfilecount <= 0) {
|
||||
ret = WDVD_Read(buffer, 0x20, 0x420);
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *fstbuffer = memalign(32, buffer[2]*4);
|
||||
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
|
||||
|
||||
if (fst == NULL) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = WDVD_Read(fstbuffer, buffer[2]*4, buffer[1]*4);
|
||||
|
||||
if (ret < 0) {
|
||||
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
|
||||
free(buffer);
|
||||
free(fstbuffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
WDVD_Reset();
|
||||
//Disc_SetUSB(NULL);
|
||||
WDVD_ClosePartition();
|
||||
|
||||
u32 discfilecount = fst[0].filelen;
|
||||
u32 dolfilecount = 0;
|
||||
//int offsetselect[20];
|
||||
|
||||
customOptionList options3(discfilecount);
|
||||
|
||||
for (u32 i = 0; i < discfilecount; i++) {
|
||||
|
||||
//don't add files that aren't .dol to the list
|
||||
int len = (strlen(fstfiles(fst, i)));
|
||||
if (fstfiles(fst, i)[len-4] =='.' &&
|
||||
fstfiles(fst, i)[len-3] =='d' &&
|
||||
fstfiles(fst, i)[len-2] =='o' &&
|
||||
fstfiles(fst, i)[len-1] =='l') {
|
||||
options3.SetName(i, "%i", i);
|
||||
options3.SetValue(i, fstfiles(fst, i));
|
||||
//options3.SetName(i, fstfiles(fst, i));
|
||||
|
||||
dolfilecount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (dolfilecount <= 0) {
|
||||
WindowPrompt(tr("ERROR"), tr("No dol file found on disc."), tr("OK"));
|
||||
free(fstbuffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
char imgPath[100];
|
||||
char imgPath[100];
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiText titleTxt(get_title(header), 28, (GXColor){0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(12,40);
|
||||
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||
GuiText titleTxt(get_title(header), 28, (GXColor) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(12,40);
|
||||
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
||||
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
settingsbackgroundbtn.SetPosition(0, 0);
|
||||
settingsbackgroundbtn.SetImage(&settingsbackground);
|
||||
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
||||
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
settingsbackgroundbtn.SetPosition(0, 0);
|
||||
settingsbackgroundbtn.SetImage(&settingsbackground);
|
||||
|
||||
GuiText cancelBtnTxt(tr("Back"), 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage cancelBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
GuiText cancelBtnTxt(tr("Back"), 22, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage cancelBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
cancelBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
cancelBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
cancelBtn.SetScale(0.9);
|
||||
cancelBtn.SetLabel(&cancelBtnTxt);
|
||||
cancelBtn.SetTrigger(&trigB);
|
||||
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
cancelBtn.SetScale(0.9);
|
||||
cancelBtn.SetLabel(&cancelBtnTxt);
|
||||
cancelBtn.SetTrigger(&trigB);
|
||||
|
||||
u8 scrollbaron = 0;
|
||||
if(dolfilecount > 9)
|
||||
u8 scrollbaron = 0;
|
||||
if (dolfilecount > 9)
|
||||
scrollbaron = 1;
|
||||
|
||||
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, dolfilecount>9?1:0, 200);
|
||||
optionBrowser3.SetPosition(0, 90);
|
||||
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&settingsbackgroundbtn);
|
||||
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, dolfilecount>9?1:0, 200);
|
||||
optionBrowser3.SetPosition(0, 90);
|
||||
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&settingsbackgroundbtn);
|
||||
w.Append(&titleTxt);
|
||||
w.Append(&cancelBtn);
|
||||
w.Append(&cancelBtn);
|
||||
w.Append(&optionBrowser3);
|
||||
|
||||
mainWindow->Append(&w);
|
||||
mainWindow->Append(&w);
|
||||
|
||||
ResumeGui();
|
||||
|
||||
while(!exit)
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
ResumeGui();
|
||||
|
||||
if(shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if(reset == 1)
|
||||
Sys_Reboot();
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
ret = optionBrowser3.GetClickedOption();
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if(ret > 0) {
|
||||
char temp[100];
|
||||
strncpy(temp, fstfiles(fst, ret), sizeof(temp));
|
||||
ret = optionBrowser3.GetClickedOption();
|
||||
|
||||
if (ret > 0) {
|
||||
char temp[100];
|
||||
strncpy(temp, fstfiles(fst, ret), sizeof(temp));
|
||||
choice = WindowPrompt(temp, tr("Load this dol as alternate dol?"), tr("OK"), tr("Cancel"));
|
||||
if(choice) {
|
||||
if (choice) {
|
||||
//ret = offsetselect[ret];
|
||||
snprintf(alternatedname, sizeof(alternatedname), "%s", temp);
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cancelBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
exit = true;
|
||||
ret = 696969;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
if (cancelBtn.GetState() == STATE_CLICKED) {
|
||||
exit = true;
|
||||
ret = 696969;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
//free not needed list buffer anymore
|
||||
free(fstbuffer);
|
||||
free(fstbuffer);
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int autoSelectDol(const char *id)
|
||||
{
|
||||
//still not done//
|
||||
//////////ID6/////////////////
|
||||
if (strcmp(id,"RF8E69") == 0) return 439;//from isostar
|
||||
if (strcmp(id,"RF8P69") == 0) return 463;//from isostar
|
||||
if (strcmp(id,"RF8X69") == 0) return 464;//from isostar
|
||||
|
||||
if (strcmp(id,"RZTP01") == 0) return 952;//from isostar
|
||||
if (strcmp(id,"RZTE01") == 0) return 674;//from starstremr
|
||||
|
||||
if (strcmp(id,"RMZX69") == 0) return 492;//from isostar
|
||||
if (strcmp(id,"RMZP69") == 0) return 492;//from isostar
|
||||
if (strcmp(id,"RMZE69") == 0) return 492;//starstremr
|
||||
|
||||
if (strcmp(id,"REDP41") == 0) return 1957;//from isostar
|
||||
if (strcmp(id,"REDE41") == 0) return 1957;//starstremr
|
||||
|
||||
if (strcmp(id,"RSXP69") == 0) return 337;//from isostar
|
||||
if (strcmp(id,"RSXE69") == 0) return 337;//starstremr
|
||||
|
||||
if (strcmp(id,"RNBX69") == 0) return 964;//from isostar
|
||||
|
||||
if (strcmp(id,"RNFP69") == 0) return 1079;//from isostar
|
||||
|
||||
if (strcmp(id,"RMLP7U") == 0) return 56;//from isostar
|
||||
|
||||
if (strcmp(id,"RKMP5D") == 0) return 290;//from isostar
|
||||
if (strcmp(id,"RKME5D") == 0) return 290;//starstremr
|
||||
|
||||
if (strcmp(id,"R5TP69") == 0) return 1493;//from isostar
|
||||
if (strcmp(id,"R5TE69") == 0) return 1493;//starstremr
|
||||
|
||||
if (strcmp(id,"R9OP69") == 0) return 1991;//from isostar
|
||||
if (strcmp(id,"R9OE69") == 0) return 1973;//starstremr
|
||||
|
||||
if (strcmp(id,"RVUP8P") == 0) return 16426;//from isostar
|
||||
if (strcmp(id,"RVUE8P") == 0) return 16405;//from isostar
|
||||
|
||||
if (strcmp(id,"RJ8P64") == 0) return 8;//from isostar
|
||||
|
||||
if (strcmp(id,"RHDP8P") == 0) return 149;//from isostar
|
||||
if (strcmp(id,"RHDE8P") == 0) return 149;//starstremr
|
||||
|
||||
if (strcmp(id,"RJ8P64") == 0) return 8;//from isostar
|
||||
if (strcmp(id,"RJ8E64") == 0) return 8;//starstremr
|
||||
|
||||
if (strcmp(id,"RHDP8P") == 0) return 149;//from isostar
|
||||
|
||||
if (strcmp(id,"RMDP69") == 0) return 39;//from isostar
|
||||
int autoSelectDol(const char *id) {
|
||||
//still not done//
|
||||
//////////ID6/////////////////
|
||||
if (strcmp(id,"RF8E69") == 0) return 439;//from isostar
|
||||
if (strcmp(id,"RF8P69") == 0) return 463;//from isostar
|
||||
if (strcmp(id,"RF8X69") == 0) return 464;//from isostar
|
||||
|
||||
if (strcmp(id,"RBOP69") == 0) return 657;//from isostar
|
||||
if (strcmp(id,"RBOE69") == 0) return 675;//starstremr
|
||||
if (strcmp(id,"RZTP01") == 0) return 952;//from isostar
|
||||
if (strcmp(id,"RZTE01") == 0) return 674;//from starstremr
|
||||
|
||||
if (strcmp(id,"RPYP9B") == 0) return 12490;//from isostar
|
||||
|
||||
if (strcmp(id,"RM2X69") == 0)return 601;//dj_skual
|
||||
if (strcmp(id,"RMZX69") == 0) return 492;//from isostar
|
||||
if (strcmp(id,"RMZP69") == 0) return 492;//from isostar
|
||||
if (strcmp(id,"RMZE69") == 0) return 492;//starstremr
|
||||
|
||||
if (strcmp(id,"REDP41") == 0) return 1957;//from isostar
|
||||
if (strcmp(id,"REDE41") == 0) return 1957;//starstremr
|
||||
|
||||
if (strcmp(id,"RSXP69") == 0) return 337;//from isostar
|
||||
if (strcmp(id,"RSXE69") == 0) return 337;//starstremr
|
||||
|
||||
if (strcmp(id,"RNBX69") == 0) return 964;//from isostar
|
||||
|
||||
if (strcmp(id,"RNFP69") == 0) return 1079;//from isostar
|
||||
|
||||
if (strcmp(id,"RMLP7U") == 0) return 56;//from isostar
|
||||
|
||||
if (strcmp(id,"RKMP5D") == 0) return 290;//from isostar
|
||||
if (strcmp(id,"RKME5D") == 0) return 290;//starstremr
|
||||
|
||||
if (strcmp(id,"R5TP69") == 0) return 1493;//from isostar
|
||||
if (strcmp(id,"R5TE69") == 0) return 1493;//starstremr
|
||||
|
||||
if (strcmp(id,"R9OP69") == 0) return 1991;//from isostar
|
||||
if (strcmp(id,"R9OE69") == 0) return 1973;//starstremr
|
||||
|
||||
if (strcmp(id,"RVUP8P") == 0) return 16426;//from isostar
|
||||
if (strcmp(id,"RVUE8P") == 0) return 16405;//from isostar
|
||||
|
||||
if (strcmp(id,"RJ8P64") == 0) return 8;//from isostar
|
||||
|
||||
if (strcmp(id,"RHDP8P") == 0) return 149;//from isostar
|
||||
if (strcmp(id,"RHDE8P") == 0) return 149;//starstremr
|
||||
|
||||
if (strcmp(id,"RJ8P64") == 0) return 8;//from isostar
|
||||
if (strcmp(id,"RJ8E64") == 0) return 8;//starstremr
|
||||
|
||||
if (strcmp(id,"RHDP8P") == 0) return 149;//from isostar
|
||||
|
||||
if (strcmp(id,"RMDP69") == 0) return 39;//from isostar
|
||||
|
||||
if (strcmp(id,"RBOP69") == 0) return 657;//from isostar
|
||||
if (strcmp(id,"RBOE69") == 0) return 675;//starstremr
|
||||
|
||||
if (strcmp(id,"RPYP9B") == 0) return 12490;//from isostar
|
||||
|
||||
if (strcmp(id,"RM2X69") == 0)return 601;//dj_skual
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Tiger Woods10 R9OP69 1991
|
||||
Virtual Tennis 2009 RVUP8P 16426
|
||||
Fate of Atlantis"Indianer Jones" RJ8P64 8
|
||||
Madden NFL07 RMDP69 39
|
||||
Boogie RBOP69 657
|
||||
Pangya! Golf with Sryle RPYP9B 12490
|
||||
Grand Slam R5TP69 1493
|
||||
Madden NFL08 RNFP69 1079
|
||||
/*
|
||||
|
||||
rboe69 = boogie ntsc = (675)
|
||||
|
||||
601 rm2x69
|
||||
|
||||
RZTE01 = WSR = 674
|
||||
Tiger Woods10 R9OP69 1991
|
||||
Virtual Tennis 2009 RVUP8P 16426
|
||||
Fate of Atlantis"Indianer Jones" RJ8P64 8
|
||||
Madden NFL07 RMDP69 39
|
||||
Boogie RBOP69 657
|
||||
Pangya! Golf with Sryle RPYP9B 12490
|
||||
Grand Slam R5TP69 1493
|
||||
Madden NFL08 RNFP69 1079
|
||||
|
||||
Fifa08 RF8P69 463
|
||||
Fifa08 RF8X69 464
|
||||
Wii Sports Resort RZTP01 952
|
||||
Medal of Honor Heroes RMZX69 492
|
||||
Medal of Honor Heroes RMZP69 492
|
||||
Redsteel REDP41 1957
|
||||
SSX RSXP69 337
|
||||
NBA08 RNBX69 964
|
||||
Metal Slug Anthology RMLP7U 56
|
||||
Mortal Kombat RKMP5D 290
|
||||
House of Dead 2+3 RHDP8P 149
|
||||
Metroid Prime 1 and/or 2? listed on the alt dol list but not on lustar's site
|
||||
*/
|
||||
rboe69 = boogie ntsc = (675)
|
||||
|
||||
//if (strcmp(id,"") == 0) return ; //blank line for more dols
|
||||
|
||||
return -1;
|
||||
601 rm2x69
|
||||
|
||||
RZTE01 = WSR = 674
|
||||
|
||||
Fifa08 RF8P69 463
|
||||
Fifa08 RF8X69 464
|
||||
Wii Sports Resort RZTP01 952
|
||||
Medal of Honor Heroes RMZX69 492
|
||||
Medal of Honor Heroes RMZP69 492
|
||||
Redsteel REDP41 1957
|
||||
SSX RSXP69 337
|
||||
NBA08 RNBX69 964
|
||||
Metal Slug Anthology RMLP7U 56
|
||||
Mortal Kombat RKMP5D 290
|
||||
House of Dead 2+3 RHDP8P 149
|
||||
Metroid Prime 1 and/or 2? listed on the alt dol list but not on lustar's site
|
||||
*/
|
||||
|
||||
//if (strcmp(id,"") == 0) return ; //blank line for more dols
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -49,13 +49,13 @@ extern void HaltGui();
|
||||
***************************************************************************/
|
||||
static void GameInstallProgress() {
|
||||
|
||||
if(gameinstalltotal <= 0)
|
||||
return;
|
||||
if (gameinstalltotal <= 0)
|
||||
return;
|
||||
|
||||
GetProgressValue(&gameinstalldone, &gameinstalltotal);
|
||||
|
||||
if(gameinstalldone > gameinstalltotal)
|
||||
gameinstalldone = gameinstalltotal;
|
||||
if (gameinstalldone > gameinstalltotal)
|
||||
gameinstalldone = gameinstalltotal;
|
||||
|
||||
static u32 expected = 300;
|
||||
|
||||
@ -66,7 +66,7 @@ static void GameInstallProgress() {
|
||||
elapsed = time(0) - start;
|
||||
|
||||
//Calculate speed in MB/s
|
||||
if(elapsed > 0)
|
||||
if (elapsed > 0)
|
||||
speed = KBSIZE * gamesize * gameinstalldone/(gameinstalltotal*elapsed);
|
||||
|
||||
if (gameinstalldone != gameinstalltotal) {
|
||||
@ -100,8 +100,8 @@ void SetupGameInstallProgress(char * title, char * game) {
|
||||
strncpy(progressMsg1, game, sizeof(progressMsg1));
|
||||
gameinstalltotal = 1;
|
||||
showProgress = 1;
|
||||
showSize = true;
|
||||
showTime = true;
|
||||
showSize = true;
|
||||
showTime = true;
|
||||
LWP_ResumeThread(progressthread);
|
||||
start = time(0);
|
||||
}
|
||||
@ -113,201 +113,197 @@ void SetupGameInstallProgress(char * title, char * game) {
|
||||
* progress bar showing % completion, or a throbber that only shows that an
|
||||
* action is in progress.
|
||||
***************************************************************************/
|
||||
static void ProgressWindow(const char *title, const char *msg1, const char *msg2)
|
||||
{
|
||||
GuiWindow promptWindow(472,320);
|
||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
promptWindow.SetPosition(0, -10);
|
||||
static void ProgressWindow(const char *title, const char *msg1, const char *msg2) {
|
||||
GuiWindow promptWindow(472,320);
|
||||
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
promptWindow.SetPosition(0, -10);
|
||||
|
||||
char imgPath[100];
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
||||
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
||||
char imgPath[100];
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sdialogue_box.png", CFG.theme_path);
|
||||
GuiImageData dialogBox(imgPath, dialogue_box_png);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
|
||||
GuiImage dialogBoxImg(&dialogBox);
|
||||
if (Settings.wsprompt == yes){
|
||||
GuiImage dialogBoxImg(&dialogBox);
|
||||
if (Settings.wsprompt == yes) {
|
||||
dialogBoxImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", CFG.theme_path);
|
||||
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_outline.png", CFG.theme_path);
|
||||
GuiImageData progressbarOutline(imgPath, progressbar_outline_png);
|
||||
|
||||
GuiImage progressbarOutlineImg(&progressbarOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
progressbarOutlineImg.SetWidescreen(CFG.widescreen);}
|
||||
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarOutlineImg.SetPosition(25, 40);
|
||||
GuiImage progressbarOutlineImg(&progressbarOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
progressbarOutlineImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
progressbarOutlineImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarOutlineImg.SetPosition(25, 40);
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", CFG.theme_path);
|
||||
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
|
||||
GuiImage progressbarEmptyImg(&progressbarEmpty);
|
||||
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarEmptyImg.SetPosition(25, 40);
|
||||
progressbarEmptyImg.SetTile(100);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sprogressbar_empty.png", CFG.theme_path);
|
||||
GuiImageData progressbarEmpty(imgPath, progressbar_empty_png);
|
||||
GuiImage progressbarEmptyImg(&progressbarEmpty);
|
||||
progressbarEmptyImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarEmptyImg.SetPosition(25, 40);
|
||||
progressbarEmptyImg.SetTile(100);
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", CFG.theme_path);
|
||||
GuiImageData progressbar(imgPath, progressbar_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sprogressbar.png", CFG.theme_path);
|
||||
GuiImageData progressbar(imgPath, progressbar_png);
|
||||
GuiImage progressbarImg(&progressbar);
|
||||
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarImg.SetPosition(25, 40);
|
||||
progressbarImg.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
progressbarImg.SetPosition(25, 40);
|
||||
|
||||
GuiText titleTxt(title, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(0,60);
|
||||
GuiText titleTxt(title, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(0,60);
|
||||
|
||||
GuiText msg1Txt(msg1, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
msg1Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
if(msg2)
|
||||
GuiText msg1Txt(msg1, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255} );
|
||||
msg1Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
if (msg2)
|
||||
msg1Txt.SetPosition(0,120);
|
||||
else
|
||||
msg1Txt.SetPosition(0,100);
|
||||
msg1Txt.SetMaxWidth(430, GuiText::DOTTED);
|
||||
msg1Txt.SetMaxWidth(430, GuiText::DOTTED);
|
||||
|
||||
GuiText msg2Txt(msg2, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
msg2Txt.SetPosition(0,125);
|
||||
msg2Txt.SetMaxWidth(430, GuiText::DOTTED);
|
||||
GuiText msg2Txt(msg2, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255} );
|
||||
msg2Txt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
msg2Txt.SetPosition(0,125);
|
||||
msg2Txt.SetMaxWidth(430, GuiText::DOTTED);
|
||||
|
||||
GuiText prsTxt("%", 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
prsTxt.SetPosition(-188,40);
|
||||
GuiText prsTxt("%", 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
prsTxt.SetAlignment(ALIGN_RIGHT, ALIGN_MIDDLE);
|
||||
prsTxt.SetPosition(-188,40);
|
||||
|
||||
GuiText timeTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
GuiText timeTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
timeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
||||
timeTxt.SetPosition(280,-50);
|
||||
timeTxt.SetPosition(280,-50);
|
||||
|
||||
GuiText sizeTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
GuiText sizeTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
sizeTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
||||
sizeTxt.SetPosition(50, -50);
|
||||
sizeTxt.SetPosition(50, -50);
|
||||
|
||||
GuiText speedTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
GuiText speedTxt(NULL, 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
speedTxt.SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
|
||||
speedTxt.SetPosition(50, -74);
|
||||
speedTxt.SetPosition(50, -74);
|
||||
|
||||
GuiText prTxt(NULL, 26, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
prTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
prTxt.SetPosition(200, 40);
|
||||
GuiText prTxt(NULL, 26, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
prTxt.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
prTxt.SetPosition(200, 40);
|
||||
|
||||
if ((Settings.wsprompt == yes) && (CFG.widescreen)){/////////////adjust for widescreen
|
||||
progressbarOutlineImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
progressbarOutlineImg.SetPosition(0, 40);
|
||||
progressbarEmptyImg.SetPosition(80,40);
|
||||
progressbarEmptyImg.SetTile(78);
|
||||
progressbarImg.SetPosition(80, 40);
|
||||
if ((Settings.wsprompt == yes) && (CFG.widescreen)) {/////////////adjust for widescreen
|
||||
progressbarOutlineImg.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
progressbarOutlineImg.SetPosition(0, 40);
|
||||
progressbarEmptyImg.SetPosition(80,40);
|
||||
progressbarEmptyImg.SetTile(78);
|
||||
progressbarImg.SetPosition(80, 40);
|
||||
msg1Txt.SetMaxWidth(380, GuiText::DOTTED);
|
||||
msg2Txt.SetMaxWidth(380, GuiText::DOTTED);
|
||||
|
||||
timeTxt.SetPosition(250,-50);
|
||||
timeTxt.SetFontSize(20);
|
||||
speedTxt.SetPosition(90,-74);
|
||||
speedTxt.SetFontSize(20);
|
||||
sizeTxt.SetPosition(90, -50);
|
||||
sizeTxt.SetFontSize(20);
|
||||
}
|
||||
timeTxt.SetPosition(250,-50);
|
||||
timeTxt.SetFontSize(20);
|
||||
speedTxt.SetPosition(90,-74);
|
||||
speedTxt.SetFontSize(20);
|
||||
sizeTxt.SetPosition(90, -50);
|
||||
sizeTxt.SetFontSize(20);
|
||||
}
|
||||
|
||||
usleep(400000); // wait to see if progress flag changes soon
|
||||
if(!showProgress)
|
||||
return;
|
||||
if (!showProgress)
|
||||
return;
|
||||
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
promptWindow.Append(&progressbarEmptyImg);
|
||||
promptWindow.Append(&progressbarImg);
|
||||
promptWindow.Append(&progressbarOutlineImg);
|
||||
promptWindow.Append(&prTxt);
|
||||
promptWindow.Append(&prsTxt);
|
||||
if(title)
|
||||
promptWindow.Append(&titleTxt);
|
||||
if(msg1)
|
||||
promptWindow.Append(&msg1Txt);
|
||||
if(msg2)
|
||||
promptWindow.Append(&msg2Txt);
|
||||
if(showTime)
|
||||
promptWindow.Append(&prsTxt);
|
||||
if (title)
|
||||
promptWindow.Append(&titleTxt);
|
||||
if (msg1)
|
||||
promptWindow.Append(&msg1Txt);
|
||||
if (msg2)
|
||||
promptWindow.Append(&msg2Txt);
|
||||
if (showTime)
|
||||
promptWindow.Append(&timeTxt);
|
||||
if(showSize){
|
||||
if (showSize) {
|
||||
promptWindow.Append(&sizeTxt);
|
||||
promptWindow.Append(&speedTxt);
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->Append(&promptWindow);
|
||||
mainWindow->ChangeFocus(&promptWindow);
|
||||
ResumeGui();
|
||||
HaltGui();
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->Append(&promptWindow);
|
||||
mainWindow->ChangeFocus(&promptWindow);
|
||||
ResumeGui();
|
||||
|
||||
while(promptWindow.GetEffect() > 0) usleep(100);
|
||||
while (promptWindow.GetEffect() > 0) usleep(100);
|
||||
|
||||
|
||||
int tmp;
|
||||
while(showProgress)
|
||||
{
|
||||
int tmp;
|
||||
while (showProgress) {
|
||||
|
||||
VIDEO_WaitVSync ();
|
||||
usleep(20000);
|
||||
usleep(20000);
|
||||
|
||||
GameInstallProgress();
|
||||
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
|
||||
tmp = static_cast<int>(progressbarImg.GetWidth()*progressDone);
|
||||
|
||||
if(CFG.widescreen && Settings.wsprompt == yes)
|
||||
if (CFG.widescreen && Settings.wsprompt == yes)
|
||||
progressbarImg.SetSkew(0,0,static_cast<int>(progressbarImg.GetWidth()*progressDone*0.8)-progressbarImg.GetWidth(),0,static_cast<int>(progressbarImg.GetWidth()*progressDone*0.8)-progressbarImg.GetWidth(),0,0,0);
|
||||
else
|
||||
progressbarImg.SetSkew(0,0,static_cast<int>(progressbarImg.GetWidth()*progressDone)-progressbarImg.GetWidth(),0,static_cast<int>(progressbarImg.GetWidth()*progressDone)-progressbarImg.GetWidth(),0,0,0);
|
||||
|
||||
prTxt.SetTextf("%.2f", progressDone);
|
||||
|
||||
if(showSize){
|
||||
if (showSize) {
|
||||
sizeTxt.SetText(progressSizeLeft);
|
||||
speedTxt.SetText(progressSpeed);
|
||||
}
|
||||
|
||||
if(showTime)
|
||||
if (showTime)
|
||||
timeTxt.SetText(progressTime);
|
||||
|
||||
if(msg2)
|
||||
if (msg2)
|
||||
msg2Txt.SetText(dyn_message);
|
||||
}
|
||||
}
|
||||
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
while(promptWindow.GetEffect() > 0) usleep(100);
|
||||
promptWindow.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_OUT, 50);
|
||||
while (promptWindow.GetEffect() > 0) usleep(100);
|
||||
|
||||
HaltGui();
|
||||
mainWindow->Remove(&promptWindow);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
ResumeGui();
|
||||
HaltGui();
|
||||
mainWindow->Remove(&promptWindow);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
ResumeGui();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ProgressThread
|
||||
***************************************************************************/
|
||||
|
||||
static void * ProgressThread (void *arg)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
if(!showProgress)
|
||||
LWP_SuspendThread (progressthread);
|
||||
static void * ProgressThread (void *arg) {
|
||||
while (1) {
|
||||
if (!showProgress)
|
||||
LWP_SuspendThread (progressthread);
|
||||
|
||||
ProgressWindow(progressTitle, progressMsg1, progressMsg2);
|
||||
usleep(100);
|
||||
}
|
||||
return NULL;
|
||||
ProgressWindow(progressTitle, progressMsg1, progressMsg2);
|
||||
usleep(100);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* ProgressStop
|
||||
***************************************************************************/
|
||||
void ProgressStop()
|
||||
{
|
||||
showProgress = 0;
|
||||
gameinstalltotal = -1;
|
||||
void ProgressStop() {
|
||||
showProgress = 0;
|
||||
gameinstalltotal = -1;
|
||||
|
||||
// wait for thread to finish
|
||||
while(!LWP_ThreadIsSuspended(progressthread))
|
||||
usleep(100);
|
||||
// wait for thread to finish
|
||||
while (!LWP_ThreadIsSuspended(progressthread))
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -316,25 +312,24 @@ void ProgressStop()
|
||||
* Callbackfunction for updating the progress values
|
||||
* Use this function as standard callback
|
||||
***************************************************************************/
|
||||
void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done, f32 total, bool swSize, bool swTime)
|
||||
{
|
||||
if(total <= 0)
|
||||
return;
|
||||
void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done, f32 total, bool swSize, bool swTime) {
|
||||
if (total <= 0)
|
||||
return;
|
||||
|
||||
else if(done > total)
|
||||
done = total;
|
||||
else if (done > total)
|
||||
done = total;
|
||||
|
||||
showSize = swSize;
|
||||
showTime = swTime;
|
||||
|
||||
if(title)
|
||||
if (title)
|
||||
strncpy(progressTitle, title, sizeof(progressTitle));
|
||||
if(msg1)
|
||||
if (msg1)
|
||||
strncpy(progressMsg1, msg1, sizeof(progressMsg1));
|
||||
if(dynmsg2)
|
||||
if (dynmsg2)
|
||||
dyn_message = dynmsg2;
|
||||
|
||||
if(swTime == true) {
|
||||
if (swTime == true) {
|
||||
static u32 expected;
|
||||
|
||||
u32 elapsed, h, m, s, speed = 0;
|
||||
@ -348,7 +343,7 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
|
||||
elapsed = time(0) - start;
|
||||
|
||||
//Calculate speed in KB/s
|
||||
if(elapsed > 0)
|
||||
if (elapsed > 0)
|
||||
speed = done/(elapsed*KBSIZE);
|
||||
|
||||
if (done != total) {
|
||||
@ -368,19 +363,19 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
|
||||
snprintf(progressTime, sizeof(progressTime), "%s %d:%02d:%02d",tr("Time left:"),h,m,s);
|
||||
}
|
||||
|
||||
if(swSize == true) {
|
||||
if(total < MBSIZE)
|
||||
if (swSize == true) {
|
||||
if (total < MBSIZE)
|
||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%0.2fKB/%0.2fKB", done * done/total / KBSIZE, total/KBSIZE);
|
||||
else if(total > MBSIZE && total < GBSIZE)
|
||||
else if (total > MBSIZE && total < GBSIZE)
|
||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%0.2fMB/%0.2fMB", done * done/total / MBSIZE, total/MBSIZE);
|
||||
else
|
||||
snprintf(progressSizeLeft, sizeof(progressSizeLeft), "%0.2fGB/%0.2fGB", done * done/total / GBSIZE, total/GBSIZE);
|
||||
}
|
||||
|
||||
showProgress = 1;
|
||||
progressDone = 100.0*done/total;
|
||||
showProgress = 1;
|
||||
progressDone = 100.0*done/total;
|
||||
|
||||
LWP_ResumeThread(progressthread);
|
||||
LWP_ResumeThread(progressthread);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -389,7 +384,7 @@ void ShowProgress(const char *title, const char *msg1, char *dynmsg2, f32 done,
|
||||
* Startup Progressthread in idle prio
|
||||
***************************************************************************/
|
||||
void InitProgressThread() {
|
||||
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 0);
|
||||
LWP_CreateThread(&progressthread, ProgressThread, NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -398,6 +393,6 @@ void InitProgressThread() {
|
||||
* Shutdown Progressthread
|
||||
***************************************************************************/
|
||||
void ExitProgressThread() {
|
||||
LWP_JoinThread(progressthread, NULL);
|
||||
progressthread = LWP_THREAD_NULL;
|
||||
LWP_JoinThread(progressthread, NULL);
|
||||
progressthread = LWP_THREAD_NULL;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ void InitProgressThread();
|
||||
void ExitProgressThread();
|
||||
void SetupGameInstallProgress(char * titl, char * game);
|
||||
void ShowProgress (const char *title, const char *msg1, char *dynmsg2,
|
||||
f32 done, f32 total, bool swSize = false, bool swTime = false);
|
||||
f32 done, f32 total, bool swSize = false, bool swTime = false);
|
||||
void ProgressStop();
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,8 +12,8 @@
|
||||
#define NOTFULLCHANNEL
|
||||
|
||||
int WindowPrompt(const char *title, const char *msg = NULL, const char *btn1Label = NULL,
|
||||
const char *btn2Label = NULL, const char *btn3Label = NULL,
|
||||
const char *btn4Label = NULL, int wait = -1);
|
||||
const char *btn2Label = NULL, const char *btn3Label = NULL,
|
||||
const char *btn4Label = NULL, int wait = -1);
|
||||
|
||||
void WindowCredits();
|
||||
int OnScreenKeyboard(char * var, u32 maxlen, int min);
|
||||
@ -30,8 +30,8 @@ int WindowScreensaver();
|
||||
int CodeDownload(const char *id);
|
||||
void GetLanguageToLangCode(char *langcode);
|
||||
int HBCWindowPrompt(const char *name, const char *coder, const char *version,
|
||||
const char *release_date, const char *long_description,
|
||||
const char *iconPath, u64 filesize);
|
||||
const char *release_date, const char *long_description,
|
||||
const char *iconPath, u64 filesize);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -32,353 +32,336 @@ extern u8 reset;
|
||||
* TitleBrowser- opens a browser with a list of installed Titles
|
||||
* relies on code from any title deleter.
|
||||
*********************************************************************************/
|
||||
int TitleBrowser(u32 type)
|
||||
{
|
||||
int TitleBrowser(u32 type) {
|
||||
|
||||
u32 num_titles;
|
||||
u32 titles[100] ATTRIBUTE_ALIGN(32);
|
||||
u32 num_sys_titles;
|
||||
u32 sys_titles[10] ATTRIBUTE_ALIGN(32);
|
||||
s32 ret = -1;
|
||||
int numtitle;//to get rid of a stupid compile wrning
|
||||
//open the database file
|
||||
FILE *f;
|
||||
char path[100];
|
||||
|
||||
ISFS_Initialize();
|
||||
|
||||
sprintf(path,"%s/config/database.txt",bootDevice);
|
||||
f = fopen(path, "r");
|
||||
|
||||
// Get count of titles of our requested type
|
||||
ret = getTitles_TypeCount(type, &num_titles);
|
||||
if (ret < 0){
|
||||
//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
// Get titles of our requested type
|
||||
ret = getTitles_Type(type, titles, num_titles);
|
||||
if (ret < 0){
|
||||
//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
// Get count of system titles
|
||||
ret = getTitles_TypeCount(0x00010002, &num_sys_titles);
|
||||
if (ret < 0){
|
||||
//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
// Get system titles
|
||||
ret = getTitles_Type(0x00010002, sys_titles, num_sys_titles);
|
||||
if (ret < 0){
|
||||
//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
|
||||
//this array will hold all the names for the titles so we only have to get them one time
|
||||
char name[num_titles+num_sys_titles][50];
|
||||
|
||||
customOptionList options3(num_titles+num_sys_titles+1);
|
||||
//write the titles on the option browser
|
||||
u32 i = 0;
|
||||
|
||||
|
||||
u32 num_titles;
|
||||
u32 titles[100] ATTRIBUTE_ALIGN(32);
|
||||
u32 num_sys_titles;
|
||||
u32 sys_titles[10] ATTRIBUTE_ALIGN(32);
|
||||
s32 ret = -1;
|
||||
int numtitle;//to get rid of a stupid compile wrning
|
||||
//open the database file
|
||||
FILE *f;
|
||||
char path[100];
|
||||
|
||||
//first add the good stuff
|
||||
while (i < num_titles){
|
||||
//start from the beginning of the file each loop
|
||||
if (f)rewind(f);
|
||||
//char name[50];
|
||||
char text[15];
|
||||
strcpy(name[i],"");//make sure name is empty
|
||||
u8 found=0;
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(type, titles[i]));
|
||||
|
||||
//get name from database cause i dont like the ADT function
|
||||
char line[200];
|
||||
char tmp[50];
|
||||
snprintf(tmp,50,tmp," ");
|
||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||
ISFS_Initialize();
|
||||
|
||||
if(f)
|
||||
{
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if (line[0]== text[0]&&
|
||||
line[1]== text[1]&&
|
||||
line[2]== text[2])
|
||||
{ int j=0;
|
||||
found=1;
|
||||
for(j=0;(line[j+4]!='\0' || j<51);j++)
|
||||
|
||||
tmp[j]=line[j+4];
|
||||
snprintf(name[i],sizeof(name[i]),"%s",tmp);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
if (getName00(name[i], TITLE_ID(type, titles[i]),CONF_GetLanguage()*2)>=0)
|
||||
found=2;
|
||||
|
||||
if(!found)
|
||||
{
|
||||
if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
|
||||
found=3;
|
||||
|
||||
if(!found)
|
||||
snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",titles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//set the text to the option browser
|
||||
options3.SetName(i, "%s",text);
|
||||
options3.SetValue(i, "%s",name[i]);
|
||||
//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
|
||||
//move on to the next title
|
||||
i++;
|
||||
}
|
||||
|
||||
// now add the crappy system titles
|
||||
while (i < num_titles+num_sys_titles){
|
||||
//start from the beginning of the file each loop
|
||||
if (f)rewind(f);
|
||||
//char name[50];
|
||||
char text[15];
|
||||
strcpy(name[i],"");//make sure name is empty
|
||||
u8 found=0;
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(0x00010002, sys_titles[i-num_titles]));
|
||||
|
||||
//get name from database cause i dont like the ADT function
|
||||
char line[200];
|
||||
char tmp[50];
|
||||
snprintf(tmp,50,tmp," ");
|
||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||
if(f)
|
||||
{
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if (line[0]== text[0]&&
|
||||
line[1]== text[1]&&
|
||||
line[2]== text[2])
|
||||
{ int j=0;
|
||||
found=1;
|
||||
for(j=0;(line[j+4]!='\0' || j<51);j++)
|
||||
|
||||
tmp[j]=line[j+4];
|
||||
snprintf(name[i],sizeof(name[i]),"%s",tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
if (getName00(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||
found=2;
|
||||
|
||||
if(!found)
|
||||
{
|
||||
if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||
found=3;
|
||||
|
||||
if(!found)
|
||||
snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",sys_titles[i-num_titles]);
|
||||
}
|
||||
}
|
||||
|
||||
//set the text to the option browser
|
||||
options3.SetName(i, "%s",text);
|
||||
options3.SetValue(i, "%s",name[i]);
|
||||
//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
|
||||
//move on to the next title
|
||||
i++;
|
||||
}
|
||||
if(i == num_titles+num_sys_titles)
|
||||
{ options3.SetName(i, " ");
|
||||
options3.SetValue(i, "%s",tr("Wii Settings"));
|
||||
}
|
||||
//we have all the titles we need so close the database and stop poking around in the wii
|
||||
fclose(f);
|
||||
|
||||
//get rid of our footprints in there
|
||||
Uninstall_FromTitle(TITLE_ID(1, 0));
|
||||
ISFS_Deinitialize();
|
||||
bool exit = false;
|
||||
sprintf(path,"%s/config/database.txt",bootDevice);
|
||||
f = fopen(path, "r");
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
// Get count of titles of our requested type
|
||||
ret = getTitles_TypeCount(type, &num_titles);
|
||||
if (ret < 0) {
|
||||
//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
char imgPath[100];
|
||||
// Get titles of our requested type
|
||||
ret = getTitles_Type(type, titles, num_titles);
|
||||
if (ret < 0) {
|
||||
//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
// Get count of system titles
|
||||
ret = getTitles_TypeCount(0x00010002, &num_sys_titles);
|
||||
if (ret < 0) {
|
||||
//printf("\tError! Can't get count of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
// Get system titles
|
||||
ret = getTitles_Type(0x00010002, sys_titles, num_sys_titles);
|
||||
if (ret < 0) {
|
||||
//printf("\tError! Can't get list of titles! (ret = %d)\n", ret);
|
||||
//exit(1);
|
||||
}
|
||||
|
||||
|
||||
//this array will hold all the names for the titles so we only have to get them one time
|
||||
char name[num_titles+num_sys_titles][50];
|
||||
|
||||
customOptionList options3(num_titles+num_sys_titles+1);
|
||||
//write the titles on the option browser
|
||||
u32 i = 0;
|
||||
|
||||
|
||||
|
||||
//first add the good stuff
|
||||
while (i < num_titles) {
|
||||
//start from the beginning of the file each loop
|
||||
if (f)rewind(f);
|
||||
//char name[50];
|
||||
char text[15];
|
||||
strcpy(name[i],"");//make sure name is empty
|
||||
u8 found=0;
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(type, titles[i]));
|
||||
|
||||
//get name from database cause i dont like the ADT function
|
||||
char line[200];
|
||||
char tmp[50];
|
||||
snprintf(tmp,50,tmp," ");
|
||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||
|
||||
if (f) {
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if (line[0]== text[0]&&
|
||||
line[1]== text[1]&&
|
||||
line[2]== text[2]) {
|
||||
int j=0;
|
||||
found=1;
|
||||
for (j=0;(line[j+4]!='\0' || j<51);j++)
|
||||
|
||||
tmp[j]=line[j+4];
|
||||
snprintf(name[i],sizeof(name[i]),"%s",tmp);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (getName00(name[i], TITLE_ID(type, titles[i]),CONF_GetLanguage()*2)>=0)
|
||||
found=2;
|
||||
|
||||
if (!found) {
|
||||
if (getNameBN(name[i], TITLE_ID(type, titles[i]))>=0)
|
||||
found=3;
|
||||
|
||||
if (!found)
|
||||
snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",titles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//set the text to the option browser
|
||||
options3.SetName(i, "%s",text);
|
||||
options3.SetValue(i, "%s",name[i]);
|
||||
//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
|
||||
//move on to the next title
|
||||
i++;
|
||||
}
|
||||
|
||||
// now add the crappy system titles
|
||||
while (i < num_titles+num_sys_titles) {
|
||||
//start from the beginning of the file each loop
|
||||
if (f)rewind(f);
|
||||
//char name[50];
|
||||
char text[15];
|
||||
strcpy(name[i],"");//make sure name is empty
|
||||
u8 found=0;
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(0x00010002, sys_titles[i-num_titles]));
|
||||
|
||||
//get name from database cause i dont like the ADT function
|
||||
char line[200];
|
||||
char tmp[50];
|
||||
snprintf(tmp,50,tmp," ");
|
||||
//snprintf(name[i],sizeof(name[i]),"Unknown Title");
|
||||
if (f) {
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if (line[0]== text[0]&&
|
||||
line[1]== text[1]&&
|
||||
line[2]== text[2]) {
|
||||
int j=0;
|
||||
found=1;
|
||||
for (j=0;(line[j+4]!='\0' || j<51);j++)
|
||||
|
||||
tmp[j]=line[j+4];
|
||||
snprintf(name[i],sizeof(name[i]),"%s",tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (getName00(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||
found=2;
|
||||
|
||||
if (!found) {
|
||||
if (getNameBN(name[i], TITLE_ID(0x00010002, sys_titles[i-num_titles]))>=0)
|
||||
found=3;
|
||||
|
||||
if (!found)
|
||||
snprintf(name[i],sizeof(name[i]),"Unknown Title (%08x)",sys_titles[i-num_titles]);
|
||||
}
|
||||
}
|
||||
|
||||
//set the text to the option browser
|
||||
options3.SetName(i, "%s",text);
|
||||
options3.SetValue(i, "%s",name[i]);
|
||||
//options3.SetValue(i, " (%08x) %s",titles[i],name[i]);//use this line to show the number to call to launch the channel
|
||||
//move on to the next title
|
||||
i++;
|
||||
}
|
||||
if (i == num_titles+num_sys_titles) {
|
||||
options3.SetName(i, " ");
|
||||
options3.SetValue(i, "%s",tr("Wii Settings"));
|
||||
}
|
||||
//we have all the titles we need so close the database and stop poking around in the wii
|
||||
fclose(f);
|
||||
|
||||
//get rid of our footprints in there
|
||||
Uninstall_FromTitle(TITLE_ID(1, 0));
|
||||
ISFS_Deinitialize();
|
||||
bool exit = false;
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
char imgPath[100];
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sgamesettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiText titleTxt(tr("Title Launcher"), 28, (GXColor){0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(12,40);
|
||||
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||
GuiText titleTxt(tr("Title Launcher"), 28, (GXColor) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
titleTxt.SetPosition(12,40);
|
||||
titleTxt.SetMaxWidth(356, GuiText::SCROLL);
|
||||
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
||||
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
settingsbackgroundbtn.SetPosition(0, 0);
|
||||
settingsbackgroundbtn.SetImage(&settingsbackground);
|
||||
GuiImage settingsbackground(&settingsbg);
|
||||
GuiButton settingsbackgroundbtn(settingsbackground.GetWidth(), settingsbackground.GetHeight());
|
||||
settingsbackgroundbtn.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
settingsbackgroundbtn.SetPosition(0, 0);
|
||||
settingsbackgroundbtn.SetImage(&settingsbackground);
|
||||
|
||||
GuiText cancelBtnTxt(tr("Back"), 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage cancelBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
GuiText cancelBtnTxt(tr("Back"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
cancelBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage cancelBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
cancelBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
cancelBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
cancelBtn.SetScale(0.9);
|
||||
cancelBtn.SetLabel(&cancelBtnTxt);
|
||||
cancelBtn.SetTrigger(&trigB);
|
||||
GuiButton cancelBtn(&cancelBtnImg,&cancelBtnImg, 2, 3, 180, 400, &trigA, &btnSoundOver, &btnClick,1);
|
||||
cancelBtn.SetScale(0.9);
|
||||
cancelBtn.SetLabel(&cancelBtnTxt);
|
||||
cancelBtn.SetTrigger(&trigB);
|
||||
|
||||
u8 scrollbaron = 0;
|
||||
if(num_titles > 9)
|
||||
u8 scrollbaron = 0;
|
||||
if (num_titles > 9)
|
||||
scrollbaron = 1;
|
||||
|
||||
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, num_titles+num_sys_titles>9?1:0, 200);
|
||||
optionBrowser3.SetPosition(0, 90);
|
||||
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&settingsbackgroundbtn);
|
||||
GuiCustomOptionBrowser optionBrowser3(396, 280, &options3, CFG.theme_path, "bg_options_gamesettings.png", bg_options_settings_png, num_titles+num_sys_titles>9?1:0, 200);
|
||||
optionBrowser3.SetPosition(0, 90);
|
||||
optionBrowser3.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&settingsbackgroundbtn);
|
||||
w.Append(&titleTxt);
|
||||
w.Append(&cancelBtn);
|
||||
w.Append(&cancelBtn);
|
||||
w.Append(&optionBrowser3);
|
||||
|
||||
mainWindow->Append(&w);
|
||||
mainWindow->Append(&w);
|
||||
|
||||
|
||||
int tmp=num_titles+num_sys_titles;
|
||||
ResumeGui();
|
||||
numtitle=num_titles;
|
||||
while(!exit)
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
int tmp=num_titles+num_sys_titles;
|
||||
ResumeGui();
|
||||
numtitle=num_titles;
|
||||
while (!exit) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if(shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if(reset == 1)
|
||||
Sys_Reboot();
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
ret = optionBrowser3.GetClickedOption();
|
||||
ret = optionBrowser3.GetClickedOption();
|
||||
|
||||
if(ret > -1) {//if a click happened
|
||||
|
||||
//char name[50];
|
||||
char text[15];
|
||||
if (f)rewind(f);
|
||||
//strcpy(name,"");//make sure name is empty
|
||||
|
||||
if (ret<numtitle)
|
||||
{
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(type, titles[ret]));
|
||||
|
||||
char temp[100];
|
||||
//prompt to boot selected title
|
||||
snprintf(temp, sizeof(temp), "%s : %s",text,name[ret]);
|
||||
int choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
|
||||
if(choice) {//if they say yes
|
||||
|
||||
|
||||
//stop all this stuff before starting the channel
|
||||
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(TITLE_ID(type,titles[ret]));
|
||||
//this really shouldn't be needed because the title will be booted
|
||||
exit = true;
|
||||
break;
|
||||
if (ret > -1) {//if a click happened
|
||||
|
||||
//char name[50];
|
||||
char text[15];
|
||||
if (f)rewind(f);
|
||||
//strcpy(name,"");//make sure name is empty
|
||||
|
||||
if (ret<numtitle) {
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(type, titles[ret]));
|
||||
|
||||
char temp[100];
|
||||
//prompt to boot selected title
|
||||
snprintf(temp, sizeof(temp), "%s : %s",text,name[ret]);
|
||||
int choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
|
||||
if (choice) {//if they say yes
|
||||
|
||||
|
||||
//stop all this stuff before starting the channel
|
||||
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(TITLE_ID(type,titles[ret]));
|
||||
//this really shouldn't be needed because the title will be booted
|
||||
exit = true;
|
||||
break;
|
||||
} else {
|
||||
//if they said no to booting the title
|
||||
ret = -1;
|
||||
optionBrowser3.ResetState();
|
||||
}
|
||||
|
||||
} else { //if they clicked a system title
|
||||
if (ret == tmp) {
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
WII_Initialize();
|
||||
WII_ReturnToSettings();
|
||||
|
||||
} else {
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(0x00010002, sys_titles[ret-num_titles]));
|
||||
|
||||
char temp[100];
|
||||
//prompt to boot selected title
|
||||
snprintf(temp, sizeof(temp), "%s : %s May not boot correctly if your System Menu is not up to date.",text,name[ret]);
|
||||
int choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
|
||||
if (choice) {//if they say yes
|
||||
|
||||
|
||||
//stop all this stuff before starting the channel
|
||||
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(TITLE_ID(0x00010002,sys_titles[ret-num_titles]));
|
||||
//this really shouldn't be needed because the title will be booted
|
||||
exit = true;
|
||||
break;
|
||||
} else {
|
||||
//if they said no to booting the title
|
||||
ret = -1;
|
||||
optionBrowser3.ResetState();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
//if they said no to booting the title
|
||||
ret = -1;
|
||||
optionBrowser3.ResetState();
|
||||
}
|
||||
|
||||
}
|
||||
else//if they clicked a system title
|
||||
{
|
||||
if(ret == tmp)
|
||||
{
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
WII_Initialize();
|
||||
WII_ReturnToSettings();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//set the title's name, number, ID to text
|
||||
sprintf(text, "%s", titleText(0x00010002, sys_titles[ret-num_titles]));
|
||||
|
||||
char temp[100];
|
||||
//prompt to boot selected title
|
||||
snprintf(temp, sizeof(temp), "%s : %s May not boot correctly if your System Menu is not up to date.",text,name[ret]);
|
||||
int choice = WindowPrompt(tr("Boot?"), temp, tr("OK"), tr("Cancel"));
|
||||
if(choice) {//if they say yes
|
||||
|
||||
|
||||
//stop all this stuff before starting the channel
|
||||
|
||||
CloseXMLDatabase();
|
||||
ExitGUIThreads();
|
||||
ShutdownAudio();
|
||||
StopGX();
|
||||
WII_Initialize();
|
||||
WII_LaunchTitle(TITLE_ID(0x00010002,sys_titles[ret-num_titles]));
|
||||
//this really shouldn't be needed because the title will be booted
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
//if they said no to booting the title
|
||||
ret = -1;
|
||||
optionBrowser3.ResetState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cancelBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
//break the loop and end the function
|
||||
exit = true;
|
||||
ret = -10;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return ret;
|
||||
if (cancelBtn.GetState() == STATE_CLICKED) {
|
||||
//break the loop and end the function
|
||||
exit = true;
|
||||
ret = -10;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef _TITLEBROWSER_H_
|
||||
#define _TITLEBROWSER_H_
|
||||
|
||||
///opens a window with a custom option browser in it populated with
|
||||
///opens a window with a custom option browser in it populated with
|
||||
//! type is the type of chnnel to put in the list
|
||||
int TitleBrowser(u32 type);
|
||||
|
||||
|
@ -42,71 +42,61 @@ BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
||||
* ResetBrowser()
|
||||
* Clears the file browser memory, and allocates one initial entry
|
||||
***************************************************************************/
|
||||
void ResetBrowser()
|
||||
{
|
||||
browser.numEntries = 0;
|
||||
browser.selIndex = 0;
|
||||
browser.pageIndex = 0;
|
||||
void ResetBrowser() {
|
||||
browser.numEntries = 0;
|
||||
browser.selIndex = 0;
|
||||
browser.pageIndex = 0;
|
||||
|
||||
// Clear any existing values
|
||||
if(browserList != NULL)
|
||||
{
|
||||
free(browserList);
|
||||
browserList = NULL;
|
||||
}
|
||||
// set aside space for 1 entry
|
||||
browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY));
|
||||
memset(browserList, 0, sizeof(BROWSERENTRY));
|
||||
// Clear any existing values
|
||||
if (browserList != NULL) {
|
||||
free(browserList);
|
||||
browserList = NULL;
|
||||
}
|
||||
// set aside space for 1 entry
|
||||
browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY));
|
||||
memset(browserList, 0, sizeof(BROWSERENTRY));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* UpdateDirName()
|
||||
* Update curent directory name for file browser
|
||||
***************************************************************************/
|
||||
int UpdateDirName()
|
||||
{
|
||||
int size=0;
|
||||
char * test;
|
||||
char temp[1024];
|
||||
int UpdateDirName() {
|
||||
int size=0;
|
||||
char * test;
|
||||
char temp[1024];
|
||||
|
||||
/* current directory doesn't change */
|
||||
if (strcmp(browserList[browser.selIndex].filename,".") == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* go up to parent directory */
|
||||
else if (strcmp(browserList[browser.selIndex].filename,"..") == 0)
|
||||
{
|
||||
/* determine last subdirectory namelength */
|
||||
sprintf(temp,"%s",browser.dir);
|
||||
test = strtok(temp,"/");
|
||||
while (test != NULL)
|
||||
{
|
||||
size = strlen(test);
|
||||
test = strtok(NULL,"/");
|
||||
}
|
||||
/* current directory doesn't change */
|
||||
if (strcmp(browserList[browser.selIndex].filename,".") == 0) {
|
||||
return 0;
|
||||
}
|
||||
/* go up to parent directory */
|
||||
else if (strcmp(browserList[browser.selIndex].filename,"..") == 0) {
|
||||
/* determine last subdirectory namelength */
|
||||
sprintf(temp,"%s",browser.dir);
|
||||
test = strtok(temp,"/");
|
||||
while (test != NULL) {
|
||||
size = strlen(test);
|
||||
test = strtok(NULL,"/");
|
||||
}
|
||||
|
||||
/* remove last subdirectory name */
|
||||
size = strlen(browser.dir) - size - 1;
|
||||
browser.dir[size] = 0;
|
||||
/* remove last subdirectory name */
|
||||
size = strlen(browser.dir) - size - 1;
|
||||
browser.dir[size] = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* Open a directory */
|
||||
else
|
||||
{
|
||||
/* test new directory namelength */
|
||||
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN)
|
||||
{
|
||||
/* update current directory name */
|
||||
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* Open a directory */
|
||||
else {
|
||||
/* test new directory namelength */
|
||||
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN) {
|
||||
/* update current directory name */
|
||||
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -118,100 +108,95 @@ int UpdateDirName()
|
||||
* <dirs>
|
||||
* <files>
|
||||
***************************************************************************/
|
||||
int FileSortCallback(const void *f1, const void *f2)
|
||||
{
|
||||
/* Special case for implicit directories */
|
||||
if(((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.')
|
||||
{
|
||||
if(strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) { return -1; }
|
||||
if(strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) { return 1; }
|
||||
if(strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) { return -1; }
|
||||
if(strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) { return 1; }
|
||||
}
|
||||
int FileSortCallback(const void *f1, const void *f2) {
|
||||
/* Special case for implicit directories */
|
||||
if (((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.') {
|
||||
if (strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) {
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If one is a file and one is a directory the directory is first. */
|
||||
if(((BROWSERENTRY *)f1)->isdir && !(((BROWSERENTRY *)f2)->isdir)) return -1;
|
||||
if(!(((BROWSERENTRY *)f1)->isdir) && ((BROWSERENTRY *)f2)->isdir) return 1;
|
||||
/* If one is a file and one is a directory the directory is first. */
|
||||
if (((BROWSERENTRY *)f1)->isdir && !(((BROWSERENTRY *)f2)->isdir)) return -1;
|
||||
if (!(((BROWSERENTRY *)f1)->isdir) && ((BROWSERENTRY *)f2)->isdir) return 1;
|
||||
|
||||
return stricmp(((BROWSERENTRY *)f1)->filename, ((BROWSERENTRY *)f2)->filename);
|
||||
return stricmp(((BROWSERENTRY *)f1)->filename, ((BROWSERENTRY *)f2)->filename);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Browse subdirectories
|
||||
**************************************************************************/
|
||||
int
|
||||
ParseDirectory()
|
||||
{
|
||||
DIR_ITER *dir = NULL;
|
||||
char fulldir[MAXPATHLEN];
|
||||
char filename[MAXPATHLEN];
|
||||
struct stat filestat;
|
||||
ParseDirectory() {
|
||||
DIR_ITER *dir = NULL;
|
||||
char fulldir[MAXPATHLEN];
|
||||
char filename[MAXPATHLEN];
|
||||
struct stat filestat;
|
||||
|
||||
// reset browser
|
||||
ResetBrowser();
|
||||
// reset browser
|
||||
ResetBrowser();
|
||||
|
||||
// open the directory
|
||||
sprintf(fulldir, "%s%s", browser.rootdir, browser.dir); // add currentDevice to path
|
||||
dir = diropen(fulldir);
|
||||
// open the directory
|
||||
sprintf(fulldir, "%s%s", browser.rootdir, browser.dir); // add currentDevice to path
|
||||
dir = diropen(fulldir);
|
||||
|
||||
// if we can't open the dir, try opening the root dir
|
||||
if (dir == NULL)
|
||||
{
|
||||
sprintf(browser.dir,"/");
|
||||
dir = diropen(browser.rootdir);
|
||||
if (dir == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// if we can't open the dir, try opening the root dir
|
||||
if (dir == NULL) {
|
||||
sprintf(browser.dir,"/");
|
||||
dir = diropen(browser.rootdir);
|
||||
if (dir == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// index files/folders
|
||||
int entryNum = 0;
|
||||
// index files/folders
|
||||
int entryNum = 0;
|
||||
|
||||
while(dirnext(dir,filename,&filestat) == 0)
|
||||
{
|
||||
if(strcmp(filename,".") != 0)
|
||||
{
|
||||
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||
while (dirnext(dir,filename,&filestat) == 0) {
|
||||
if (strcmp(filename,".") != 0) {
|
||||
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
||||
|
||||
if(!newBrowserList) // failed to allocate required memory
|
||||
{
|
||||
ResetBrowser();
|
||||
entryNum = -1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
browserList = newBrowserList;
|
||||
}
|
||||
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||
if (!newBrowserList) { // failed to allocate required memory
|
||||
ResetBrowser();
|
||||
entryNum = -1;
|
||||
break;
|
||||
} else {
|
||||
browserList = newBrowserList;
|
||||
}
|
||||
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||
|
||||
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
||||
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
||||
|
||||
if(strcmp(filename,"..") == 0)
|
||||
{
|
||||
sprintf(browserList[entryNum].displayname, "..");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(browserList[entryNum].displayname, filename); // crop name for display
|
||||
}
|
||||
if (strcmp(filename,"..") == 0) {
|
||||
sprintf(browserList[entryNum].displayname, "..");
|
||||
} else {
|
||||
strcpy(browserList[entryNum].displayname, filename); // crop name for display
|
||||
}
|
||||
|
||||
browserList[entryNum].length = filestat.st_size;
|
||||
browserList[entryNum].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
||||
browserList[entryNum].length = filestat.st_size;
|
||||
browserList[entryNum].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
||||
|
||||
entryNum++;
|
||||
}
|
||||
}
|
||||
entryNum++;
|
||||
}
|
||||
}
|
||||
|
||||
// close directory
|
||||
dirclose(dir);
|
||||
// close directory
|
||||
dirclose(dir);
|
||||
|
||||
// Sort the file list
|
||||
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
||||
// Sort the file list
|
||||
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
||||
|
||||
browser.numEntries = entryNum;
|
||||
return entryNum;
|
||||
browser.numEntries = entryNum;
|
||||
return entryNum;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -219,260 +204,240 @@ ParseDirectory()
|
||||
*
|
||||
* Update current directory and set new entry list if directory has changed
|
||||
***************************************************************************/
|
||||
int BrowserChangeFolder()
|
||||
{
|
||||
if(!UpdateDirName())
|
||||
return -1;
|
||||
int BrowserChangeFolder() {
|
||||
if (!UpdateDirName())
|
||||
return -1;
|
||||
|
||||
ParseDirectory();
|
||||
ParseDirectory();
|
||||
|
||||
return browser.numEntries;
|
||||
return browser.numEntries;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* BrowseDevice
|
||||
* Displays a list of files on the selected device
|
||||
***************************************************************************/
|
||||
int BrowseDevice(int device)
|
||||
{
|
||||
sprintf(browser.dir, "/");
|
||||
switch(device)
|
||||
{
|
||||
case SD:
|
||||
sprintf(browser.rootdir, "SD:");
|
||||
break;
|
||||
case USB:
|
||||
sprintf(browser.rootdir, "USB:");
|
||||
break;
|
||||
}
|
||||
ParseDirectory(); // Parse root directory
|
||||
return browser.numEntries;
|
||||
int BrowseDevice(int device) {
|
||||
sprintf(browser.dir, "/");
|
||||
switch (device) {
|
||||
case SD:
|
||||
sprintf(browser.rootdir, "SD:");
|
||||
break;
|
||||
case USB:
|
||||
sprintf(browser.rootdir, "USB:");
|
||||
break;
|
||||
}
|
||||
ParseDirectory(); // Parse root directory
|
||||
return browser.numEntries;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* MenuBrowseDevice
|
||||
***************************************************************************/
|
||||
|
||||
int BrowseDevice(char * var, int force)
|
||||
{
|
||||
***************************************************************************/
|
||||
|
||||
int result=-1;
|
||||
int i;
|
||||
char currentdir[90];
|
||||
int curDivice = -1;
|
||||
int forced =force;
|
||||
|
||||
if(forced>-1){
|
||||
if(BrowseDevice(forced) > 0)
|
||||
{
|
||||
curDivice = forced;
|
||||
goto main;
|
||||
}
|
||||
}
|
||||
int BrowseDevice(char * var, int force) {
|
||||
|
||||
else if((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0))
|
||||
{
|
||||
curDivice = USB;
|
||||
goto main;
|
||||
}
|
||||
else if((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0))
|
||||
{
|
||||
curDivice = SD;
|
||||
goto main;
|
||||
}
|
||||
else {
|
||||
WindowPrompt(tr("Error"),0,tr("Ok"));
|
||||
return -1;
|
||||
}
|
||||
int result=-1;
|
||||
int i;
|
||||
char currentdir[90];
|
||||
int curDivice = -1;
|
||||
int forced =force;
|
||||
|
||||
if (forced>-1) {
|
||||
if (BrowseDevice(forced) > 0) {
|
||||
curDivice = forced;
|
||||
goto main;
|
||||
}
|
||||
}
|
||||
|
||||
else if ((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0)) {
|
||||
curDivice = USB;
|
||||
goto main;
|
||||
} else if ((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0)) {
|
||||
curDivice = SD;
|
||||
goto main;
|
||||
} else {
|
||||
WindowPrompt(tr("Error"),0,tr("Ok"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
main:
|
||||
int menu = MENU_NONE;
|
||||
|
||||
/*
|
||||
GuiText titleTxt("Browse Files", 28, (GXColor){0, 0, 0, 230});
|
||||
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
titleTxt.SetPosition(70,20);
|
||||
*/
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
int menu = MENU_NONE;
|
||||
|
||||
GuiImageData folderImgData(folder_png);
|
||||
GuiImage folderImg(&folderImgData);
|
||||
GuiButton folderBtn(folderImg.GetWidth(), folderImg.GetHeight());
|
||||
folderBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
folderBtn.SetPosition(-210, -145);
|
||||
folderBtn.SetImage(&folderImg);
|
||||
folderBtn.SetTrigger(&trigA);
|
||||
folderBtn.SetEffectGrow();
|
||||
/*
|
||||
GuiText titleTxt("Browse Files", 28, (GXColor){0, 0, 0, 230});
|
||||
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
titleTxt.SetPosition(70,20);
|
||||
*/
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
GuiImageData btnOutline(button_dialogue_box_png);
|
||||
GuiText ExitBtnTxt("Cancel", 24, (GXColor){0, 0, 0, 255});
|
||||
GuiImage ExitBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
ExitBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
ExitBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||
ExitBtn.SetPosition(-55, -35);
|
||||
ExitBtn.SetLabel(&ExitBtnTxt);
|
||||
ExitBtn.SetImage(&ExitBtnImg);
|
||||
ExitBtn.SetTrigger(&trigA);
|
||||
ExitBtn.SetTrigger(&trigB);
|
||||
ExitBtn.SetEffectGrow();
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
GuiText usbBtnTxt((curDivice==SD?"USB":"SD"), 24, (GXColor){0, 0, 0, 255});
|
||||
GuiImage usbBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
usbBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
usbBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}GuiButton usbBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
usbBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||
usbBtn.SetPosition(0, -35);
|
||||
usbBtn.SetLabel(&usbBtnTxt);
|
||||
usbBtn.SetImage(&usbBtnImg);
|
||||
usbBtn.SetTrigger(&trigA);
|
||||
usbBtn.SetEffectGrow();
|
||||
GuiImageData folderImgData(folder_png);
|
||||
GuiImage folderImg(&folderImgData);
|
||||
GuiButton folderBtn(folderImg.GetWidth(), folderImg.GetHeight());
|
||||
folderBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
folderBtn.SetPosition(-210, -145);
|
||||
folderBtn.SetImage(&folderImg);
|
||||
folderBtn.SetTrigger(&trigA);
|
||||
folderBtn.SetEffectGrow();
|
||||
|
||||
GuiText okBtnTxt(tr("Ok"), 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
GuiImage okBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
okBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
okBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 45, -35, &trigA, &btnSoundOver, &btnClick,1);
|
||||
okBtn.SetLabel(&okBtnTxt);
|
||||
|
||||
GuiFileBrowser fileBrowser(396, 248);
|
||||
fileBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
fileBrowser.SetPosition(0, 120);
|
||||
|
||||
GuiImageData Address(addressbar_textbox_png);
|
||||
snprintf(currentdir, sizeof(currentdir), "%s%s", browser.rootdir, browser.dir);
|
||||
GuiText AdressText(currentdir, 20, (GXColor) {0, 0, 0, 255});
|
||||
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
AdressText.SetPosition(20, 0);
|
||||
AdressText.SetMaxWidth(Address.GetWidth()-40, GuiText::SCROLL);
|
||||
GuiImage AdressbarImg(&Address);
|
||||
GuiButton Adressbar(Address.GetWidth(), Address.GetHeight());
|
||||
Adressbar.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
Adressbar.SetPosition(0, fileBrowser.GetTop()-45);
|
||||
Adressbar.SetImage(&AdressbarImg);
|
||||
Adressbar.SetLabel(&AdressText);
|
||||
|
||||
//save var in case they cancel and return it to them
|
||||
snprintf(currentdir, sizeof(currentdir), "%s", var);
|
||||
sprintf(var,"%s", browser.rootdir);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&ExitBtn);
|
||||
GuiImageData btnOutline(button_dialogue_box_png);
|
||||
GuiText ExitBtnTxt("Cancel", 24, (GXColor) {0, 0, 0, 255});
|
||||
GuiImage ExitBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
ExitBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
ExitBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton ExitBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
ExitBtn.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
|
||||
ExitBtn.SetPosition(-55, -35);
|
||||
ExitBtn.SetLabel(&ExitBtnTxt);
|
||||
ExitBtn.SetImage(&ExitBtnImg);
|
||||
ExitBtn.SetTrigger(&trigA);
|
||||
ExitBtn.SetTrigger(&trigB);
|
||||
ExitBtn.SetEffectGrow();
|
||||
|
||||
GuiText usbBtnTxt((curDivice==SD?"USB":"SD"), 24, (GXColor) {0, 0, 0, 255});
|
||||
GuiImage usbBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
usbBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
usbBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton usbBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
usbBtn.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||
usbBtn.SetPosition(0, -35);
|
||||
usbBtn.SetLabel(&usbBtnTxt);
|
||||
usbBtn.SetImage(&usbBtnImg);
|
||||
usbBtn.SetTrigger(&trigA);
|
||||
usbBtn.SetEffectGrow();
|
||||
|
||||
GuiText okBtnTxt(tr("Ok"), 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
GuiImage okBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
okBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
okBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton okBtn(&okBtnImg,&okBtnImg, 0, 4, 45, -35, &trigA, &btnSoundOver, &btnClick,1);
|
||||
okBtn.SetLabel(&okBtnTxt);
|
||||
|
||||
GuiFileBrowser fileBrowser(396, 248);
|
||||
fileBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
fileBrowser.SetPosition(0, 120);
|
||||
|
||||
GuiImageData Address(addressbar_textbox_png);
|
||||
snprintf(currentdir, sizeof(currentdir), "%s%s", browser.rootdir, browser.dir);
|
||||
GuiText AdressText(currentdir, 20, (GXColor) { 0, 0, 0, 255});
|
||||
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||
AdressText.SetPosition(20, 0);
|
||||
AdressText.SetMaxWidth(Address.GetWidth()-40, GuiText::SCROLL);
|
||||
GuiImage AdressbarImg(&Address);
|
||||
GuiButton Adressbar(Address.GetWidth(), Address.GetHeight());
|
||||
Adressbar.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
Adressbar.SetPosition(0, fileBrowser.GetTop()-45);
|
||||
Adressbar.SetImage(&AdressbarImg);
|
||||
Adressbar.SetLabel(&AdressText);
|
||||
|
||||
//save var in case they cancel and return it to them
|
||||
snprintf(currentdir, sizeof(currentdir), "%s", var);
|
||||
sprintf(var,"%s", browser.rootdir);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&ExitBtn);
|
||||
// w.Append(&titleTxt);
|
||||
w.Append(&fileBrowser);
|
||||
w.Append(&Adressbar);
|
||||
w.Append(&okBtn);
|
||||
w.Append(&folderBtn);
|
||||
w.Append(&usbBtn);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
w.Append(&fileBrowser);
|
||||
w.Append(&Adressbar);
|
||||
w.Append(&okBtn);
|
||||
w.Append(&folderBtn);
|
||||
w.Append(&usbBtn);
|
||||
mainWindow->Append(&w);
|
||||
ResumeGui();
|
||||
|
||||
while(menu == MENU_NONE)
|
||||
{
|
||||
VIDEO_WaitVSync();
|
||||
while (menu == MENU_NONE) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if(shutdown == 1)
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
|
||||
if(reset == 1)
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
for(i=0; i<PAGESIZE; i++)
|
||||
{
|
||||
if(fileBrowser.fileList[i]->GetState() == STATE_CLICKED)
|
||||
{
|
||||
fileBrowser.fileList[i]->ResetState();
|
||||
// check corresponding browser entry
|
||||
if(browserList[browser.selIndex].isdir)
|
||||
{
|
||||
if(BrowserChangeFolder())
|
||||
{
|
||||
fileBrowser.ResetState();
|
||||
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
|
||||
fileBrowser.TriggerUpdate();
|
||||
for (i=0; i<PAGESIZE; i++) {
|
||||
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
|
||||
fileBrowser.fileList[i]->ResetState();
|
||||
// check corresponding browser entry
|
||||
if (browserList[browser.selIndex].isdir) {
|
||||
if (BrowserChangeFolder()) {
|
||||
fileBrowser.ResetState();
|
||||
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
|
||||
fileBrowser.TriggerUpdate();
|
||||
sprintf(var,"%s", browser.rootdir);
|
||||
int len=strlen(browser.rootdir);
|
||||
for (unsigned int i=len;i<strlen(browser.rootdir)+strlen(browser.dir);i++)
|
||||
{
|
||||
var[i]=browser.dir[i-(len-1)];
|
||||
}
|
||||
AdressText.SetTextf("%s", var);
|
||||
} else {
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ExitBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
snprintf(var,sizeof(currentdir),"%s", currentdir);
|
||||
break;
|
||||
}
|
||||
if(okBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
else if(usbBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
result = BrowseDevice(var, (curDivice==SD?USB:SD));
|
||||
break;
|
||||
}
|
||||
else if(folderBtn.GetState() == STATE_CLICKED)
|
||||
{
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
char newfolder[100];
|
||||
sprintf(newfolder,"%s/",var);
|
||||
|
||||
int result = OnScreenKeyboard(newfolder,100,0);
|
||||
if ( result == 1 )
|
||||
{
|
||||
int len = (strlen(newfolder)-1);
|
||||
if(newfolder[len] !='/')
|
||||
strncat (newfolder, "/", 1);
|
||||
|
||||
struct stat st;
|
||||
if(stat(newfolder, &st) != 0) {
|
||||
if(subfoldercreate(newfolder) != 1) {
|
||||
WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
|
||||
}
|
||||
}
|
||||
int len=strlen(browser.rootdir);
|
||||
for (unsigned int i=len;i<strlen(browser.rootdir)+strlen(browser.dir);i++) {
|
||||
var[i]=browser.dir[i-(len-1)];
|
||||
}
|
||||
AdressText.SetTextf("%s", var);
|
||||
} else {
|
||||
menu = MENU_DISCLIST;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
result = BrowseDevice(var, (curDivice==SD?SD:USB));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
}
|
||||
|
||||
//}
|
||||
if (ExitBtn.GetState() == STATE_CLICKED) {
|
||||
snprintf(var,sizeof(currentdir),"%s", currentdir);
|
||||
break;
|
||||
}
|
||||
if (okBtn.GetState() == STATE_CLICKED) {
|
||||
result = 1;
|
||||
break;
|
||||
} else if (usbBtn.GetState() == STATE_CLICKED) {
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
result = BrowseDevice(var, (curDivice==SD?USB:SD));
|
||||
break;
|
||||
} else if (folderBtn.GetState() == STATE_CLICKED) {
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
char newfolder[100];
|
||||
sprintf(newfolder,"%s/",var);
|
||||
|
||||
return result;
|
||||
int result = OnScreenKeyboard(newfolder,100,0);
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(newfolder)-1);
|
||||
if (newfolder[len] !='/')
|
||||
strncat (newfolder, "/", 1);
|
||||
|
||||
struct stat st;
|
||||
if (stat(newfolder, &st) != 0) {
|
||||
if (subfoldercreate(newfolder) != 1) {
|
||||
WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
result = BrowseDevice(var, (curDivice==SD?SD:USB));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
//}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* libwiigui Template
|
||||
* Tantric 2009
|
||||
*
|
||||
*
|
||||
* modified by dimok
|
||||
*
|
||||
* filebrowser.h
|
||||
@ -16,38 +16,36 @@
|
||||
#include <gccore.h>
|
||||
|
||||
#define MAXJOLIET 255
|
||||
#define MAXDISPLAY MAXPATHLEN
|
||||
|
||||
|
||||
enum {
|
||||
SD,
|
||||
USB
|
||||
};
|
||||
#define MAXDISPLAY MAXPATHLEN
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char dir[MAXPATHLEN]; // directory path of browserList
|
||||
char rootdir[10]; // directory path of browserList
|
||||
int numEntries; // # of entries in browserList
|
||||
int selIndex; // currently selected index of browserList
|
||||
int pageIndex; // starting index of browserList page display
|
||||
|
||||
enum {
|
||||
SD,
|
||||
USB
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char dir[MAXPATHLEN]; // directory path of browserList
|
||||
char rootdir[10]; // directory path of browserList
|
||||
int numEntries; // # of entries in browserList
|
||||
int selIndex; // currently selected index of browserList
|
||||
int pageIndex; // starting index of browserList page display
|
||||
} BROWSERINFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u64 offset; // DVD offset
|
||||
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
||||
char isdir; // 0 - file, 1 - directory
|
||||
char filename[MAXJOLIET + 1]; // full filename
|
||||
char displayname[MAXDISPLAY + 1]; // name for browser display
|
||||
} BROWSERENTRY;
|
||||
typedef struct {
|
||||
u64 offset; // DVD offset
|
||||
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
||||
char isdir; // 0 - file, 1 - directory
|
||||
char filename[MAXJOLIET + 1]; // full filename
|
||||
char displayname[MAXDISPLAY + 1]; // name for browser display
|
||||
} BROWSERENTRY;
|
||||
|
||||
extern BROWSERINFO browser;
|
||||
extern BROWSERENTRY * browserList;
|
||||
|
||||
int UpdateDirName();
|
||||
int FileSortCallback(const void *f1, const void *f2);
|
||||
void ResetBrowser();
|
||||
void ResetBrowser();
|
||||
int ParseDirectory();
|
||||
int BrowserChangeFolder();
|
||||
int BrowseDevice(int device);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,198 +1,174 @@
|
||||
#include <string.h>
|
||||
#include "ramdisc.h"
|
||||
|
||||
static inline u16 u8array_to_u16 (const u8* item, int offset)
|
||||
{
|
||||
return ( item[offset] | (item[offset + 1] << 8));
|
||||
static inline u16 u8array_to_u16 (const u8* item, int offset) {
|
||||
return ( item[offset] | (item[offset + 1] << 8));
|
||||
}
|
||||
static inline u32 u8array_to_u32 (const u8* item, int offset)
|
||||
{
|
||||
return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24) );
|
||||
static inline u32 u8array_to_u32 (const u8* item, int offset) {
|
||||
return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24) );
|
||||
}
|
||||
static inline void u16_to_u8array (u8* item, int offset, u16 value)
|
||||
{
|
||||
item[offset] = (u8) value; item[offset + 1] = (u8)(value >> 8);
|
||||
static inline void u16_to_u8array (u8* item, int offset, u16 value) {
|
||||
item[offset] = (u8) value;
|
||||
item[offset + 1] = (u8)(value >> 8);
|
||||
}
|
||||
static inline void u32_to_u8array (u8* item, int offset, u32 value) {
|
||||
item[offset] = (u8) value;
|
||||
item[offset + 1] = (u8)(value >> 8);
|
||||
item[offset + 2] = (u8)(value >> 16);
|
||||
item[offset + 3] = (u8)(value >> 24);
|
||||
}
|
||||
static inline void u32_to_u8array (u8* item, int offset, u32 value)
|
||||
{
|
||||
item[offset] = (u8) value;
|
||||
item[offset + 1] = (u8)(value >> 8);
|
||||
item[offset + 2] = (u8)(value >> 16);
|
||||
item[offset + 3] = (u8)(value >> 24);
|
||||
}
|
||||
|
||||
|
||||
class padding
|
||||
{
|
||||
class padding {
|
||||
public:
|
||||
padding(u32 Start, u32 NumSectors)
|
||||
{
|
||||
start = Start;
|
||||
end = Start + NumSectors;
|
||||
data = new u8[NumSectors*512];
|
||||
next = 0;
|
||||
}
|
||||
~padding() { delete [] data;}
|
||||
padding(u32 Start, u32 NumSectors) {
|
||||
start = Start;
|
||||
end = Start + NumSectors;
|
||||
data = new u8[NumSectors*512];
|
||||
next = 0;
|
||||
}
|
||||
~padding() {
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
u32 start;
|
||||
u32 end;
|
||||
u8 *data;
|
||||
padding *next;
|
||||
u32 start;
|
||||
u32 end;
|
||||
u8 *data;
|
||||
padding *next;
|
||||
};
|
||||
|
||||
static u32 __ramdisk_sectorsOfPadding;
|
||||
static padding *__ramdisk_data_start;
|
||||
static padding *__ramdisk_data_end;
|
||||
|
||||
static bool __ramdisk_IsInserted(void)
|
||||
{
|
||||
return __ramdisk_data_start!=NULL;
|
||||
static bool __ramdisk_IsInserted(void) {
|
||||
return __ramdisk_data_start!=NULL;
|
||||
}
|
||||
//forward decleration
|
||||
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer);
|
||||
|
||||
bool initRAMDisc(u32 Size, u32 Padding)
|
||||
{
|
||||
if(__ramdisk_data_start) return true; // is init
|
||||
bool initRAMDisc(u32 Size, u32 Padding) {
|
||||
if (__ramdisk_data_start) return true; // is init
|
||||
|
||||
if(Size > 16*1024*1024) Size = 16*1024*1024; // maximum 16 MB
|
||||
if(Size < 16*1024) Size = 16*1024; // minimum 16 MB
|
||||
if(Padding > Size) Padding = Size; // Padding maximum =Disksize
|
||||
if(Padding < 4*1024) Padding = 4*1024; // Padding minimum 4kB
|
||||
|
||||
__ramdisk_sectorsOfPadding = Padding/512;
|
||||
if (Size > 16*1024*1024) Size = 16*1024*1024; // maximum 16 MB
|
||||
if (Size < 16*1024) Size = 16*1024; // minimum 16 MB
|
||||
if (Padding > Size) Padding = Size; // Padding maximum =Disksize
|
||||
if (Padding < 4*1024) Padding = 4*1024; // Padding minimum 4kB
|
||||
|
||||
__ramdisk_data_start = __ramdisk_data_end = new padding(0, __ramdisk_sectorsOfPadding);
|
||||
if(!__ramdisk_data_start) return false;
|
||||
__ramdisk_sectorsOfPadding = Padding/512;
|
||||
|
||||
// FAT12 Formatieren
|
||||
u8 sector[512] = {0, };
|
||||
sector[0x00d] = 2; /*BPB_sectorsPerCluster*/
|
||||
sector[0x00e] = 1; /*BPB_reservedSectors*/
|
||||
sector[0x010] = 1; /*BPB_numFATs*/
|
||||
u16_to_u8array (sector, 0x011, 48); /*BPB_rootEntries*/
|
||||
int num_sectors = Size/512;
|
||||
u16_to_u8array (sector, 0x013, num_sectors); /*BPB_numSectorsSmall*/
|
||||
int num_clusters = (num_sectors-1-3) /2;
|
||||
int sectors_per_fat = (num_clusters * 3 + 1023) /1024;
|
||||
u16_to_u8array (sector, 0x016, sectors_per_fat); /*BPB_sectorsPerFAT*/
|
||||
//u32_to_u8array (sector, 0x020, Size/512); /*BPB_numSectors*/
|
||||
sector[0x036] = 'F';
|
||||
sector[0x037] = 'A';
|
||||
sector[0x038] = 'T';
|
||||
sector[0x1fe] = 0x55;
|
||||
sector[0x1ff] = 0xaa;
|
||||
if(!__ramdisk_WriteSectors(0, 1, sector))
|
||||
goto error;
|
||||
memset(sector, 0, 512);
|
||||
// clear FAT & rootDir
|
||||
for(int i=1; i<= sectors_per_fat+3/*sectors_per_rootDir*/; i++)
|
||||
if(!__ramdisk_WriteSectors(1, 1, sector))
|
||||
goto error;
|
||||
return true;
|
||||
__ramdisk_data_start = __ramdisk_data_end = new padding(0, __ramdisk_sectorsOfPadding);
|
||||
if (!__ramdisk_data_start) return false;
|
||||
|
||||
// FAT12 Formatieren
|
||||
u8 sector[512] = {0, };
|
||||
sector[0x00d] = 2; /*BPB_sectorsPerCluster*/
|
||||
sector[0x00e] = 1; /*BPB_reservedSectors*/
|
||||
sector[0x010] = 1; /*BPB_numFATs*/
|
||||
u16_to_u8array (sector, 0x011, 48); /*BPB_rootEntries*/
|
||||
int num_sectors = Size/512;
|
||||
u16_to_u8array (sector, 0x013, num_sectors); /*BPB_numSectorsSmall*/
|
||||
int num_clusters = (num_sectors-1-3) /2;
|
||||
int sectors_per_fat = (num_clusters * 3 + 1023) /1024;
|
||||
u16_to_u8array (sector, 0x016, sectors_per_fat); /*BPB_sectorsPerFAT*/
|
||||
//u32_to_u8array (sector, 0x020, Size/512); /*BPB_numSectors*/
|
||||
sector[0x036] = 'F';
|
||||
sector[0x037] = 'A';
|
||||
sector[0x038] = 'T';
|
||||
sector[0x1fe] = 0x55;
|
||||
sector[0x1ff] = 0xaa;
|
||||
if (!__ramdisk_WriteSectors(0, 1, sector))
|
||||
goto error;
|
||||
memset(sector, 0, 512);
|
||||
// clear FAT & rootDir
|
||||
for (int i=1; i<= sectors_per_fat+3/*sectors_per_rootDir*/; i++)
|
||||
if (!__ramdisk_WriteSectors(1, 1, sector))
|
||||
goto error;
|
||||
return true;
|
||||
error:
|
||||
delete __ramdisk_data_start;
|
||||
__ramdisk_data_start = 0;
|
||||
return false;
|
||||
delete __ramdisk_data_start;
|
||||
__ramdisk_data_start = 0;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void exitRAMDisc()
|
||||
{
|
||||
while(__ramdisk_data_start)
|
||||
{
|
||||
padding *tmp = __ramdisk_data_start;
|
||||
__ramdisk_data_start = __ramdisk_data_start->next;
|
||||
delete tmp;
|
||||
}
|
||||
void exitRAMDisc() {
|
||||
while (__ramdisk_data_start) {
|
||||
padding *tmp = __ramdisk_data_start;
|
||||
__ramdisk_data_start = __ramdisk_data_start->next;
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
static u8 *__ramdisk_findSector(size_t Sector, size_t *Sectors)
|
||||
{
|
||||
if(__ramdisk_data_start==NULL) return NULL;
|
||||
for(padding *tmp = __ramdisk_data_start; tmp; tmp=tmp->next)
|
||||
{
|
||||
if(tmp->start <= Sector && tmp->end >= Sector)
|
||||
{
|
||||
if(Sectors) *Sectors = 1+tmp->end-Sector;
|
||||
return &(tmp->data[(Sector-tmp->start)*512]);
|
||||
}
|
||||
}
|
||||
// not found -> add padding
|
||||
__ramdisk_data_end->next = new padding((Sector/__ramdisk_sectorsOfPadding)*__ramdisk_sectorsOfPadding, __ramdisk_sectorsOfPadding);
|
||||
if(__ramdisk_data_end->next)
|
||||
{
|
||||
__ramdisk_data_end = __ramdisk_data_end->next;
|
||||
return &( __ramdisk_data_end->data[(Sector-__ramdisk_data_end->start)*512]);
|
||||
}
|
||||
return 0;
|
||||
static u8 *__ramdisk_findSector(size_t Sector, size_t *Sectors) {
|
||||
if (__ramdisk_data_start==NULL) return NULL;
|
||||
for (padding *tmp = __ramdisk_data_start; tmp; tmp=tmp->next) {
|
||||
if (tmp->start <= Sector && tmp->end >= Sector) {
|
||||
if (Sectors) *Sectors = 1+tmp->end-Sector;
|
||||
return &(tmp->data[(Sector-tmp->start)*512]);
|
||||
}
|
||||
}
|
||||
// not found -> add padding
|
||||
__ramdisk_data_end->next = new padding((Sector/__ramdisk_sectorsOfPadding)*__ramdisk_sectorsOfPadding, __ramdisk_sectorsOfPadding);
|
||||
if (__ramdisk_data_end->next) {
|
||||
__ramdisk_data_end = __ramdisk_data_end->next;
|
||||
return &( __ramdisk_data_end->data[(Sector-__ramdisk_data_end->start)*512]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool __ImplizitInit = false;
|
||||
static bool __ramdisk_Startup(void)
|
||||
{
|
||||
if(!__ramdisk_IsInserted())
|
||||
{
|
||||
// Std=8MB/64kB Padding
|
||||
return (__ImplizitInit = initRAMDisc(8*1024*1024, 64 * 1024));
|
||||
}
|
||||
return true;
|
||||
static bool __ramdisk_Startup(void) {
|
||||
if (!__ramdisk_IsInserted()) {
|
||||
// Std=8MB/64kB Padding
|
||||
return (__ImplizitInit = initRAMDisc(8*1024*1024, 64 * 1024));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool __ramdisk_ReadSectors(size_t Sector, size_t numSectors, u8 *Buffer)
|
||||
{
|
||||
size_t num_sectors;
|
||||
while(numSectors)
|
||||
{
|
||||
if(u8 *buff = __ramdisk_findSector(Sector,&num_sectors))
|
||||
{
|
||||
if(num_sectors > numSectors) num_sectors = numSectors;
|
||||
memcpy(Buffer, buff, num_sectors * 512);
|
||||
numSectors -= num_sectors;
|
||||
Buffer+= num_sectors;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
static bool __ramdisk_ReadSectors(size_t Sector, size_t numSectors, u8 *Buffer) {
|
||||
size_t num_sectors;
|
||||
while (numSectors) {
|
||||
if (u8 *buff = __ramdisk_findSector(Sector,&num_sectors)) {
|
||||
if (num_sectors > numSectors) num_sectors = numSectors;
|
||||
memcpy(Buffer, buff, num_sectors * 512);
|
||||
numSectors -= num_sectors;
|
||||
Buffer+= num_sectors;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer)
|
||||
{
|
||||
size_t num_sectors;
|
||||
while(numSectors)
|
||||
{
|
||||
if(u8 *buff = __ramdisk_findSector(Sector,&num_sectors))
|
||||
{
|
||||
if(num_sectors > numSectors) num_sectors = numSectors;
|
||||
memcpy(buff, Buffer, num_sectors * 512);
|
||||
numSectors -= num_sectors;
|
||||
Buffer+= num_sectors;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
static bool __ramdisk_WriteSectors(size_t Sector, size_t numSectors, u8 *Buffer) {
|
||||
size_t num_sectors;
|
||||
while (numSectors) {
|
||||
if (u8 *buff = __ramdisk_findSector(Sector,&num_sectors)) {
|
||||
if (num_sectors > numSectors) num_sectors = numSectors;
|
||||
memcpy(buff, Buffer, num_sectors * 512);
|
||||
numSectors -= num_sectors;
|
||||
Buffer+= num_sectors;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool __ramdisk_ClearStatus(void)
|
||||
{
|
||||
return true;
|
||||
static bool __ramdisk_ClearStatus(void) {
|
||||
return true;
|
||||
}
|
||||
static bool __ramdisk_Shutdown(void)
|
||||
{
|
||||
if(__ImplizitInit)
|
||||
{
|
||||
__ImplizitInit = false;
|
||||
exitRAMDisc();
|
||||
}
|
||||
return true;
|
||||
static bool __ramdisk_Shutdown(void) {
|
||||
if (__ImplizitInit) {
|
||||
__ImplizitInit = false;
|
||||
exitRAMDisc();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const DISC_INTERFACE __io_ramdisk = {
|
||||
DEVICE_TYPE_RAM_DISK,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | 0x1000,
|
||||
(FN_MEDIUM_STARTUP)&__ramdisk_Startup,
|
||||
(FN_MEDIUM_ISINSERTED)&__ramdisk_IsInserted,
|
||||
(FN_MEDIUM_READSECTORS)&__ramdisk_ReadSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&__ramdisk_WriteSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&__ramdisk_ClearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&__ramdisk_Shutdown
|
||||
};
|
||||
DEVICE_TYPE_RAM_DISK,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | 0x1000,
|
||||
(FN_MEDIUM_STARTUP)&__ramdisk_Startup,
|
||||
(FN_MEDIUM_ISINSERTED)&__ramdisk_IsInserted,
|
||||
(FN_MEDIUM_READSECTORS)&__ramdisk_ReadSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&__ramdisk_WriteSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&__ramdisk_ClearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&__ramdisk_Shutdown
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -30,92 +30,91 @@ extern void HaltGui();
|
||||
/****************************************************************************
|
||||
* MenuOGG
|
||||
***************************************************************************/
|
||||
bool MenuOGG()
|
||||
{
|
||||
bool MenuOGG() {
|
||||
int cnt = 0;
|
||||
int ret = 0, choice = 0;
|
||||
int scrollon, nothingchanged = 0;
|
||||
bool returnhere = false;
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
char imgPath[100];
|
||||
char imgPath[100];
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
GuiTrigger trigMinus;
|
||||
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
||||
GuiTrigger trigPlus;
|
||||
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
||||
trigMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_MINUS | WPAD_CLASSIC_BUTTON_MINUS, 0);
|
||||
GuiTrigger trigPlus;
|
||||
trigPlus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, 0);
|
||||
|
||||
char fullpath[150];
|
||||
char shortpath[35];
|
||||
int countoggs = GetAllDirFiles(Settings.oggload_path);
|
||||
int countoggs = GetAllDirFiles(Settings.oggload_path);
|
||||
|
||||
if(!strcmp("", Settings.oggload_path)) {
|
||||
if (!strcmp("", Settings.oggload_path)) {
|
||||
sprintf(shortpath, "%s", tr("Standard"));
|
||||
} else {
|
||||
sprintf(shortpath, "%s", Settings.oggload_path);
|
||||
}
|
||||
} else {
|
||||
sprintf(shortpath, "%s", Settings.oggload_path);
|
||||
}
|
||||
|
||||
GuiText titleTxt(shortpath, 24, (GXColor){0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
titleTxt.SetPosition(0,0);
|
||||
GuiButton pathBtn(300, 50);
|
||||
pathBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
pathBtn.SetPosition(0,28);
|
||||
pathBtn.SetLabel(&titleTxt);
|
||||
pathBtn.SetSoundOver(&btnSoundOver);
|
||||
pathBtn.SetSoundClick(&btnClick);
|
||||
pathBtn.SetTrigger(&trigA);
|
||||
pathBtn.SetEffectGrow();
|
||||
GuiText titleTxt(shortpath, 24, (GXColor) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
titleTxt.SetPosition(0,0);
|
||||
GuiButton pathBtn(300, 50);
|
||||
pathBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
pathBtn.SetPosition(0,28);
|
||||
pathBtn.SetLabel(&titleTxt);
|
||||
pathBtn.SetSoundOver(&btnSoundOver);
|
||||
pathBtn.SetSoundClick(&btnClick);
|
||||
pathBtn.SetTrigger(&trigA);
|
||||
pathBtn.SetEffectGrow();
|
||||
|
||||
GuiImage oggmenubackground(&settingsbg);
|
||||
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
oggmenubackground.SetPosition(0, 0);
|
||||
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
oggmenubackground.SetPosition(0, 0);
|
||||
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
backBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
backBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
backBtn.SetPosition(-180, 400);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetImage(&backBtnImg);
|
||||
backBtn.SetSoundOver(&btnSoundOver);
|
||||
backBtn.SetSoundClick(&btnClick);
|
||||
backBtn.SetTrigger(&trigA);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetEffectGrow();
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
backBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
backBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
backBtn.SetPosition(-180, 400);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetImage(&backBtnImg);
|
||||
backBtn.SetSoundOver(&btnSoundOver);
|
||||
backBtn.SetSoundClick(&btnClick);
|
||||
backBtn.SetTrigger(&trigA);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiText defaultBtnTxt(tr("Default") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage defaultBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
defaultBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
defaultBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
defaultBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
defaultBtn.SetPosition(180, 400);
|
||||
defaultBtn.SetLabel(&defaultBtnTxt);
|
||||
defaultBtn.SetImage(&defaultBtnImg);
|
||||
defaultBtn.SetSoundOver(&btnSoundOver);
|
||||
defaultBtn.SetSoundClick(&btnClick);
|
||||
defaultBtn.SetTrigger(&trigA);
|
||||
defaultBtn.SetEffectGrow();
|
||||
GuiText defaultBtnTxt(tr("Default") , 22, (GXColor) { THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage defaultBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
defaultBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
defaultBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
defaultBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
defaultBtn.SetPosition(180, 400);
|
||||
defaultBtn.SetLabel(&defaultBtnTxt);
|
||||
defaultBtn.SetImage(&defaultBtnImg);
|
||||
defaultBtn.SetSoundOver(&btnSoundOver);
|
||||
defaultBtn.SetSoundClick(&btnClick);
|
||||
defaultBtn.SetTrigger(&trigA);
|
||||
defaultBtn.SetEffectGrow();
|
||||
|
||||
customOptionList options2(countoggs);
|
||||
|
||||
@ -124,100 +123,99 @@ bool MenuOGG()
|
||||
options2.SetName(cnt,"%i.", cnt+1);
|
||||
}
|
||||
|
||||
if(cnt < 9) {
|
||||
scrollon = 0;
|
||||
if (cnt < 9) {
|
||||
scrollon = 0;
|
||||
} else {
|
||||
scrollon = 1;
|
||||
scrollon = 1;
|
||||
}
|
||||
|
||||
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10);
|
||||
optionBrowser4.SetPosition(0, 90);
|
||||
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10);
|
||||
optionBrowser4.SetPosition(0, 90);
|
||||
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path);
|
||||
GuiImageData stop(imgPath, mp3_stop_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
||||
GuiImageData play(imgPath, startgame_arrow_right_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%smp3_stop.png", CFG.theme_path);
|
||||
GuiImageData stop(imgPath, mp3_stop_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sstartgame_arrow_right.png", CFG.theme_path);
|
||||
GuiImageData play(imgPath, startgame_arrow_right_png);
|
||||
|
||||
GuiImage playBtnImg(&play);
|
||||
playBtnImg.SetWidescreen(CFG.widescreen);
|
||||
GuiButton playBtn(play.GetWidth(), play.GetHeight());
|
||||
playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
playBtn.SetPosition(50, 400);
|
||||
playBtn.SetImage(&playBtnImg);
|
||||
playBtn.SetSoundOver(&btnSoundOver);
|
||||
playBtn.SetSoundClick(&btnClick);
|
||||
playBtn.SetTrigger(&trigA);
|
||||
playBtn.SetTrigger(&trigPlus);
|
||||
playBtn.SetEffectGrow();
|
||||
GuiImage playBtnImg(&play);
|
||||
playBtnImg.SetWidescreen(CFG.widescreen);
|
||||
GuiButton playBtn(play.GetWidth(), play.GetHeight());
|
||||
playBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
playBtn.SetPosition(50, 400);
|
||||
playBtn.SetImage(&playBtnImg);
|
||||
playBtn.SetSoundOver(&btnSoundOver);
|
||||
playBtn.SetSoundClick(&btnClick);
|
||||
playBtn.SetTrigger(&trigA);
|
||||
playBtn.SetTrigger(&trigPlus);
|
||||
playBtn.SetEffectGrow();
|
||||
|
||||
GuiImage stopBtnImg(&stop);
|
||||
stopBtnImg.SetWidescreen(CFG.widescreen);
|
||||
GuiButton stopBtn(stop.GetWidth(), stop.GetHeight());
|
||||
stopBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
stopBtn.SetPosition(-15, 400);
|
||||
stopBtn.SetImage(&stopBtnImg);
|
||||
stopBtn.SetSoundOver(&btnSoundOver);
|
||||
stopBtn.SetSoundClick(&btnClick);
|
||||
stopBtn.SetTrigger(&trigA);
|
||||
stopBtn.SetTrigger(&trigMinus);
|
||||
stopBtn.SetEffectGrow();
|
||||
GuiImage stopBtnImg(&stop);
|
||||
stopBtnImg.SetWidescreen(CFG.widescreen);
|
||||
GuiButton stopBtn(stop.GetWidth(), stop.GetHeight());
|
||||
stopBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
stopBtn.SetPosition(-15, 400);
|
||||
stopBtn.SetImage(&stopBtnImg);
|
||||
stopBtn.SetSoundOver(&btnSoundOver);
|
||||
stopBtn.SetSoundClick(&btnClick);
|
||||
stopBtn.SetTrigger(&trigA);
|
||||
stopBtn.SetTrigger(&trigMinus);
|
||||
stopBtn.SetEffectGrow();
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&oggmenubackground);
|
||||
w.Append(&pathBtn);
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&oggmenubackground);
|
||||
w.Append(&pathBtn);
|
||||
w.Append(&backBtn);
|
||||
w.Append(&playBtn);
|
||||
w.Append(&stopBtn);
|
||||
w.Append(&defaultBtn);
|
||||
w.Append(&stopBtn);
|
||||
w.Append(&defaultBtn);
|
||||
w.Append(&optionBrowser4);
|
||||
mainWindow->Append(&w);
|
||||
|
||||
w.SetEffect(EFFECT_FADE, 20);
|
||||
ResumeGui();
|
||||
w.SetEffect(EFFECT_FADE, 20);
|
||||
ResumeGui();
|
||||
|
||||
while(w.GetEffect()>0) usleep(50);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
while(!returnhere)
|
||||
{
|
||||
while (!returnhere) {
|
||||
|
||||
if(shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if(reset == 1)
|
||||
Sys_Reboot();
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
if(nothingchanged == 1 && countoggs > 0) {
|
||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||
bgMusic->Play();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
}
|
||||
if (backBtn.GetState() == STATE_CLICKED) {
|
||||
if (nothingchanged == 1 && countoggs > 0) {
|
||||
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||
bgMusic->Play();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
}
|
||||
}
|
||||
backBtn.ResetState();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (defaultBtn.GetState() == STATE_CLICKED) {
|
||||
if (defaultBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt(tr("Loading standard music."),0,tr("OK"), tr("Cancel"));
|
||||
if (choice == 1) {
|
||||
sprintf(Settings.ogg_path, "notset");
|
||||
bgMusic->Play();
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
cfg_save_global();
|
||||
sprintf(Settings.ogg_path, "notset");
|
||||
bgMusic->Play();
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
cfg_save_global();
|
||||
}
|
||||
defaultBtn.ResetState();
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
|
||||
if (pathBtn.GetState() == STATE_CLICKED) {
|
||||
if (pathBtn.GetState() == STATE_CLICKED) {
|
||||
w.Remove(&optionBrowser4);
|
||||
w.Remove(&backBtn);
|
||||
w.Remove(&pathBtn);
|
||||
w.Remove(&playBtn);
|
||||
w.Remove(&stopBtn);
|
||||
w.Remove(&defaultBtn);
|
||||
w.Remove(&defaultBtn);
|
||||
char entered[43] = "";
|
||||
strncpy(entered, Settings.oggload_path, sizeof(entered));
|
||||
int result = OnScreenKeyboard(entered,43,0);
|
||||
@ -226,18 +224,18 @@ bool MenuOGG()
|
||||
w.Append(&backBtn);
|
||||
w.Append(&playBtn);
|
||||
w.Append(&stopBtn);
|
||||
w.Append(&defaultBtn);
|
||||
w.Append(&defaultBtn);
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if(entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
strncpy(Settings.oggload_path, entered, sizeof(Settings.oggload_path));
|
||||
WindowPrompt(tr("Backgroundmusic Path changed."),0,tr("OK"));
|
||||
// if(isSdInserted()) {
|
||||
if(isInserted(bootDevice)) {
|
||||
if(!strcmp("", Settings.oggload_path)) {
|
||||
sprintf(Settings.ogg_path, "notset");
|
||||
bgMusic->Play();
|
||||
if (isInserted(bootDevice)) {
|
||||
if (!strcmp("", Settings.oggload_path)) {
|
||||
sprintf(Settings.ogg_path, "notset");
|
||||
bgMusic->Play();
|
||||
}
|
||||
cfg_save_global();
|
||||
returnhere = true;
|
||||
@ -246,71 +244,71 @@ bool MenuOGG()
|
||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
|
||||
}
|
||||
}
|
||||
if(countoggs > 0) {
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
pathBtn.ResetState();
|
||||
}
|
||||
|
||||
ret = optionBrowser4.GetClickedOption();
|
||||
|
||||
if(ret>=0) {
|
||||
choice = WindowPrompt(tr("Set as backgroundmusic?"),GetFileName(ret),tr("Yes"),tr("No"));
|
||||
if(choice == 1) {
|
||||
StopOgg();
|
||||
snprintf(fullpath,150,"%s%s",Settings.oggload_path,GetFileName(ret));
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if(choice < 0) {
|
||||
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
|
||||
sprintf(Settings.ogg_path, "notset");
|
||||
bgMusic->Play();
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
} else {
|
||||
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s", fullpath);
|
||||
cfg_save_global();
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
nothingchanged = 0;
|
||||
}
|
||||
}
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
|
||||
if (playBtn.GetState() == STATE_CLICKED && countoggs > 0) {
|
||||
if(countoggs > 0) {
|
||||
ret = optionBrowser4.GetSelectedOption();
|
||||
snprintf(fullpath, 150,"%s%s", Settings.oggload_path,GetFileName(ret));
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if(choice < 0) {
|
||||
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
|
||||
if(!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||
bgMusic->Play();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
if (countoggs > 0) {
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
pathBtn.ResetState();
|
||||
}
|
||||
|
||||
ret = optionBrowser4.GetClickedOption();
|
||||
|
||||
if (ret>=0) {
|
||||
choice = WindowPrompt(tr("Set as backgroundmusic?"),GetFileName(ret),tr("Yes"),tr("No"));
|
||||
if (choice == 1) {
|
||||
StopOgg();
|
||||
snprintf(fullpath,150,"%s%s",Settings.oggload_path,GetFileName(ret));
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if (choice < 0) {
|
||||
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
|
||||
sprintf(Settings.ogg_path, "notset");
|
||||
bgMusic->Play();
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
} else {
|
||||
snprintf(Settings.ogg_path, sizeof(Settings.ogg_path), "%s", fullpath);
|
||||
cfg_save_global();
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
nothingchanged = 0;
|
||||
}
|
||||
}
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
nothingchanged = 1;
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
playBtn.ResetState();
|
||||
}
|
||||
|
||||
if (playBtn.GetState() == STATE_CLICKED && countoggs > 0) {
|
||||
if (countoggs > 0) {
|
||||
ret = optionBrowser4.GetSelectedOption();
|
||||
snprintf(fullpath, 150,"%s%s", Settings.oggload_path,GetFileName(ret));
|
||||
choice = bgMusic->PlayOggFile(fullpath);
|
||||
if (choice < 0) {
|
||||
WindowPrompt(tr("Not supported format!"), tr("Loading standard music."), tr("OK"));
|
||||
if (!strcmp("", Settings.oggload_path) || !strcmp("notset", Settings.ogg_path)) {
|
||||
bgMusic->Play();
|
||||
} else {
|
||||
bgMusic->PlayOggFile(Settings.ogg_path);
|
||||
}
|
||||
}
|
||||
SetVolumeOgg(255*(Settings.volume/100.0));
|
||||
nothingchanged = 1;
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
playBtn.ResetState();
|
||||
}
|
||||
|
||||
if (stopBtn.GetState() == STATE_CLICKED) {
|
||||
if (countoggs > 0) {
|
||||
StopOgg();
|
||||
nothingchanged = 1;
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
stopBtn.ResetState();
|
||||
}
|
||||
}
|
||||
|
||||
if(stopBtn.GetState() == STATE_CLICKED) {
|
||||
if(countoggs > 0) {
|
||||
StopOgg();
|
||||
nothingchanged = 1;
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
stopBtn.ResetState();
|
||||
}
|
||||
}
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while(w.GetEffect()>0) usleep(50);
|
||||
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return returnhere;
|
||||
}
|
||||
@ -318,180 +316,178 @@ bool MenuOGG()
|
||||
/****************************************************************************
|
||||
* MenuLanguageSelect
|
||||
***************************************************************************/
|
||||
int MenuLanguageSelect()
|
||||
{
|
||||
int MenuLanguageSelect() {
|
||||
int cnt = 0;
|
||||
int ret = 0, choice = 0;
|
||||
int scrollon;
|
||||
int returnhere = 0;
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
GuiSound btnClick(button_click2_pcm, button_click2_pcm_size, SOUND_PCM, Settings.sfxvolume);
|
||||
|
||||
char imgPath[100];
|
||||
char imgPath[100];
|
||||
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%sbutton_dialogue_box.png", CFG.theme_path);
|
||||
GuiImageData btnOutline(imgPath, button_dialogue_box_png);
|
||||
snprintf(imgPath, sizeof(imgPath), "%ssettings_background.png", CFG.theme_path);
|
||||
GuiImageData settingsbg(imgPath, settings_background_png);
|
||||
|
||||
GuiTrigger trigA;
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
GuiTrigger trigB;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
|
||||
char fullpath[100];
|
||||
int countfiles = GetAllDirFiles(Settings.languagefiles_path);
|
||||
int countfiles = GetAllDirFiles(Settings.languagefiles_path);
|
||||
|
||||
if(!strcmp("", Settings.languagefiles_path)) {
|
||||
if (!strcmp("", Settings.languagefiles_path)) {
|
||||
sprintf(fullpath, "%s", tr("Standard"));
|
||||
} else {
|
||||
sprintf(fullpath, "%s", Settings.languagefiles_path);
|
||||
}
|
||||
} else {
|
||||
sprintf(fullpath, "%s", Settings.languagefiles_path);
|
||||
}
|
||||
|
||||
GuiText titleTxt(fullpath, 24, (GXColor){0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
titleTxt.SetPosition(0,0);
|
||||
GuiButton pathBtn(300, 50);
|
||||
pathBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
pathBtn.SetPosition(0,28);
|
||||
pathBtn.SetLabel(&titleTxt);
|
||||
pathBtn.SetSoundOver(&btnSoundOver);
|
||||
pathBtn.SetSoundClick(&btnClick);
|
||||
pathBtn.SetTrigger(&trigA);
|
||||
pathBtn.SetEffectGrow();
|
||||
GuiText titleTxt(fullpath, 24, (GXColor) {0, 0, 0, 255});
|
||||
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
titleTxt.SetPosition(0,0);
|
||||
GuiButton pathBtn(300, 50);
|
||||
pathBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
pathBtn.SetPosition(0,28);
|
||||
pathBtn.SetLabel(&titleTxt);
|
||||
pathBtn.SetSoundOver(&btnSoundOver);
|
||||
pathBtn.SetSoundClick(&btnClick);
|
||||
pathBtn.SetTrigger(&trigA);
|
||||
pathBtn.SetEffectGrow();
|
||||
|
||||
GuiImage oggmenubackground(&settingsbg);
|
||||
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
oggmenubackground.SetPosition(0, 0);
|
||||
oggmenubackground.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
oggmenubackground.SetPosition(0, 0);
|
||||
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes){
|
||||
backBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
backBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
backBtn.SetPosition(-190, 400);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetImage(&backBtnImg);
|
||||
backBtn.SetSoundOver(&btnSoundOver);
|
||||
backBtn.SetSoundClick(&btnClick);
|
||||
backBtn.SetTrigger(&trigA);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetEffectGrow();
|
||||
GuiText backBtnTxt(tr("Back") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
backBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
backBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
backBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton backBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
backBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
backBtn.SetPosition(-190, 400);
|
||||
backBtn.SetLabel(&backBtnTxt);
|
||||
backBtn.SetImage(&backBtnImg);
|
||||
backBtn.SetSoundOver(&btnSoundOver);
|
||||
backBtn.SetSoundClick(&btnClick);
|
||||
backBtn.SetTrigger(&trigA);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiText defaultBtnTxt(tr("Default") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage defaultBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
defaultBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
defaultBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
defaultBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
defaultBtn.SetPosition(190, 400);
|
||||
defaultBtn.SetLabel(&defaultBtnTxt);
|
||||
defaultBtn.SetImage(&defaultBtnImg);
|
||||
defaultBtn.SetSoundOver(&btnSoundOver);
|
||||
defaultBtn.SetSoundClick(&btnClick);
|
||||
defaultBtn.SetTrigger(&trigA);
|
||||
defaultBtn.SetEffectGrow();
|
||||
GuiText defaultBtnTxt(tr("Default") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
defaultBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage defaultBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
defaultBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
defaultBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton defaultBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
defaultBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
defaultBtn.SetPosition(190, 400);
|
||||
defaultBtn.SetLabel(&defaultBtnTxt);
|
||||
defaultBtn.SetImage(&defaultBtnImg);
|
||||
defaultBtn.SetSoundOver(&btnSoundOver);
|
||||
defaultBtn.SetSoundClick(&btnClick);
|
||||
defaultBtn.SetTrigger(&trigA);
|
||||
defaultBtn.SetEffectGrow();
|
||||
|
||||
GuiText updateBtnTxt(tr("Update Files") , 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
updateBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage updateBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
GuiText updateBtnTxt(tr("Update Files") , 22, (GXColor) {THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255});
|
||||
updateBtnTxt.SetMaxWidth(btnOutline.GetWidth()-30);
|
||||
GuiImage updateBtnImg(&btnOutline);
|
||||
if (Settings.wsprompt == yes) {
|
||||
updateBtnTxt.SetWidescreen(CFG.widescreen);
|
||||
updateBtnImg.SetWidescreen(CFG.widescreen);
|
||||
}
|
||||
GuiButton updateBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
updateBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
updateBtn.SetPosition(0, 400);
|
||||
updateBtn.SetLabel(&updateBtnTxt);
|
||||
updateBtn.SetImage(&updateBtnImg);
|
||||
updateBtn.SetSoundOver(&btnSoundOver);
|
||||
updateBtn.SetSoundClick(&btnClick);
|
||||
updateBtn.SetTrigger(&trigA);
|
||||
updateBtn.SetEffectGrow();
|
||||
}
|
||||
GuiButton updateBtn(btnOutline.GetWidth(), btnOutline.GetHeight());
|
||||
updateBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
updateBtn.SetPosition(0, 400);
|
||||
updateBtn.SetLabel(&updateBtnTxt);
|
||||
updateBtn.SetImage(&updateBtnImg);
|
||||
updateBtn.SetSoundOver(&btnSoundOver);
|
||||
updateBtn.SetSoundClick(&btnClick);
|
||||
updateBtn.SetTrigger(&trigA);
|
||||
updateBtn.SetEffectGrow();
|
||||
|
||||
customOptionList options2(countfiles);
|
||||
|
||||
for (cnt = 0; cnt < countfiles; cnt++) {
|
||||
char filename[64];
|
||||
strncpy(filename, GetFileName(cnt),63);
|
||||
char *dot = strchr(filename, '.');
|
||||
if(dot) *dot='\0';
|
||||
char filename[64];
|
||||
strncpy(filename, GetFileName(cnt),63);
|
||||
char *dot = strchr(filename, '.');
|
||||
if (dot) *dot='\0';
|
||||
options2.SetName(cnt, "%s", filename);
|
||||
options2.SetValue(cnt, NULL);
|
||||
|
||||
}
|
||||
|
||||
if(cnt < 9) {
|
||||
scrollon = 0;
|
||||
if (cnt < 9) {
|
||||
scrollon = 0;
|
||||
} else {
|
||||
scrollon = 1;
|
||||
scrollon = 1;
|
||||
}
|
||||
|
||||
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10);
|
||||
optionBrowser4.SetPosition(0, 90);
|
||||
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
GuiCustomOptionBrowser optionBrowser4(396, 280, &options2, CFG.theme_path, "bg_options_settings.png", bg_options_settings_png, scrollon, 10);
|
||||
optionBrowser4.SetPosition(0, 90);
|
||||
optionBrowser4.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&oggmenubackground);
|
||||
w.Append(&pathBtn);
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
w.Append(&oggmenubackground);
|
||||
w.Append(&pathBtn);
|
||||
w.Append(&backBtn);
|
||||
w.Append(&defaultBtn);
|
||||
w.Append(&updateBtn);
|
||||
w.Append(&defaultBtn);
|
||||
w.Append(&updateBtn);
|
||||
w.Append(&optionBrowser4);
|
||||
mainWindow->Append(&w);
|
||||
|
||||
w.SetEffect(EFFECT_FADE, 20);
|
||||
ResumeGui();
|
||||
w.SetEffect(EFFECT_FADE, 20);
|
||||
ResumeGui();
|
||||
|
||||
while(w.GetEffect()>0) usleep(50);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
while(!returnhere)
|
||||
{
|
||||
while (!returnhere) {
|
||||
|
||||
if(shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
else if(reset == 1)
|
||||
Sys_Reboot();
|
||||
if (shutdown == 1)
|
||||
Sys_Shutdown();
|
||||
else if (reset == 1)
|
||||
Sys_Reboot();
|
||||
|
||||
else if (backBtn.GetState() == STATE_CLICKED) {
|
||||
else if (backBtn.GetState() == STATE_CLICKED) {
|
||||
|
||||
backBtn.ResetState();
|
||||
break;
|
||||
}
|
||||
backBtn.ResetState();
|
||||
break;
|
||||
}
|
||||
|
||||
else if (defaultBtn.GetState() == STATE_CLICKED) {
|
||||
else if (defaultBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt(tr("Loading standard language."),0,tr("OK"), tr("Cancel"));
|
||||
if (choice == 1) {
|
||||
sprintf(Settings.language_path, "notset");
|
||||
cfg_save_global();
|
||||
gettextCleanUp();
|
||||
//lang_default();
|
||||
CFG_Load();
|
||||
returnhere = 2;
|
||||
sprintf(Settings.language_path, "notset");
|
||||
cfg_save_global();
|
||||
gettextCleanUp();
|
||||
//lang_default();
|
||||
CFG_Load();
|
||||
returnhere = 2;
|
||||
}
|
||||
defaultBtn.ResetState();
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
|
||||
else if (updateBtn.GetState() == STATE_CLICKED) {
|
||||
else if (updateBtn.GetState() == STATE_CLICKED) {
|
||||
choice = WindowPrompt(tr("Update all Language Files"),tr("Do you wish to update/download all language files?"),tr("OK"), tr("Cancel"));
|
||||
if (choice == 1) {
|
||||
|
||||
bool network = true;
|
||||
if(!IsNetworkInit()) {
|
||||
if (!IsNetworkInit()) {
|
||||
network = NetworkInitPrompt();
|
||||
}
|
||||
|
||||
if(network) {
|
||||
if (network) {
|
||||
const char URL[60] = "http://usbloader-gui.googlecode.com/svn/trunk/Languages/";
|
||||
char fullURL[300];
|
||||
FILE *pfile;
|
||||
@ -499,17 +495,17 @@ int MenuLanguageSelect()
|
||||
URL_List LinkList(URL);
|
||||
int listsize = LinkList.GetURLCount();
|
||||
|
||||
for(int i = 0; i < listsize; i++) {
|
||||
for (int i = 0; i < listsize; i++) {
|
||||
|
||||
ShowProgress(tr("Updating Language Files:"), 0, LinkList.GetURL(i), i, listsize-1);
|
||||
|
||||
if(strcasecmp(".lang", strrchr(LinkList.GetURL(i), '.')) == 0) {
|
||||
if (strcasecmp(".lang", strrchr(LinkList.GetURL(i), '.')) == 0) {
|
||||
|
||||
snprintf(fullURL, sizeof(fullURL), "%s%s", URL, LinkList.GetURL(i));
|
||||
|
||||
struct block file = downloadfile(fullURL);
|
||||
|
||||
if(file.data && file.size) {
|
||||
if (file.data && file.size) {
|
||||
char filepath[300];
|
||||
|
||||
snprintf(filepath, sizeof(filepath), "%s%s", Settings.languagefiles_path, LinkList.GetURL(i));
|
||||
@ -528,29 +524,29 @@ int MenuLanguageSelect()
|
||||
}
|
||||
}
|
||||
updateBtn.ResetState();
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
|
||||
else if (pathBtn.GetState() == STATE_CLICKED) {
|
||||
else if (pathBtn.GetState() == STATE_CLICKED) {
|
||||
w.Remove(&optionBrowser4);
|
||||
w.Remove(&backBtn);
|
||||
w.Remove(&pathBtn);
|
||||
w.Remove(&defaultBtn);
|
||||
w.Remove(&defaultBtn);
|
||||
char entered[43] = "";
|
||||
strncpy(entered, Settings.languagefiles_path, sizeof(entered));
|
||||
int result = OnScreenKeyboard(entered,43,0);
|
||||
w.Append(&optionBrowser4);
|
||||
w.Append(&pathBtn);
|
||||
w.Append(&backBtn);
|
||||
w.Append(&defaultBtn);
|
||||
w.Append(&defaultBtn);
|
||||
if ( result == 1 ) {
|
||||
int len = (strlen(entered)-1);
|
||||
if(entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
if (entered[len] !='/')
|
||||
strncat (entered, "/", 1);
|
||||
strncpy(Settings.languagefiles_path, entered, sizeof(Settings.languagefiles_path));
|
||||
WindowPrompt(tr("Languagepath changed."),0,tr("OK"));
|
||||
// if(isSdInserted()) {
|
||||
if(isInserted(bootDevice)) {
|
||||
if (isInserted(bootDevice)) {
|
||||
cfg_save_global();
|
||||
returnhere = 1;
|
||||
break;
|
||||
@ -558,45 +554,45 @@ int MenuLanguageSelect()
|
||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
|
||||
}
|
||||
}
|
||||
if(countfiles > 0) {
|
||||
if (countfiles > 0) {
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
pathBtn.ResetState();
|
||||
}
|
||||
|
||||
ret = optionBrowser4.GetClickedOption();
|
||||
|
||||
if (ret>=0) {
|
||||
choice = WindowPrompt(tr("Do you want to change language?"), 0, tr("Yes"), tr("Cancel"));
|
||||
if (choice == 1) {
|
||||
// if(isSdInserted()) {
|
||||
if (isInserted(bootDevice)) {
|
||||
snprintf(Settings.language_path, sizeof(Settings.language_path), "%s%s", Settings.languagefiles_path, GetFileName(ret));
|
||||
cfg_save_global();
|
||||
if (!checkfile(Settings.language_path)) {
|
||||
sprintf(Settings.language_path, tr("not set"));
|
||||
WindowPrompt(tr("File not found."),tr("Loading standard language."),tr("OK"));
|
||||
}
|
||||
gettextCleanUp();
|
||||
//lang_default();
|
||||
CFG_Load();
|
||||
returnhere = 2;
|
||||
break;
|
||||
} else {
|
||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"), 0,0,0,-1);
|
||||
}
|
||||
}
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
pathBtn.ResetState();
|
||||
|
||||
}
|
||||
|
||||
ret = optionBrowser4.GetClickedOption();
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while (w.GetEffect()>0) usleep(50);
|
||||
|
||||
if(ret>=0) {
|
||||
choice = WindowPrompt(tr("Do you want to change language?"), 0, tr("Yes"), tr("Cancel"));
|
||||
if(choice == 1) {
|
||||
// if(isSdInserted()) {
|
||||
if(isInserted(bootDevice)) {
|
||||
snprintf(Settings.language_path, sizeof(Settings.language_path), "%s%s", Settings.languagefiles_path, GetFileName(ret));
|
||||
cfg_save_global();
|
||||
if(!checkfile(Settings.language_path)) {
|
||||
sprintf(Settings.language_path, tr("not set"));
|
||||
WindowPrompt(tr("File not found."),tr("Loading standard language."),tr("OK"));
|
||||
}
|
||||
gettextCleanUp();
|
||||
//lang_default();
|
||||
CFG_Load();
|
||||
returnhere = 2;
|
||||
break;
|
||||
} else {
|
||||
WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"), 0,0,0,-1);
|
||||
}
|
||||
}
|
||||
optionBrowser4.SetFocus(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
w.SetEffect(EFFECT_FADE, -20);
|
||||
while(w.GetEffect()>0) usleep(50);
|
||||
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
HaltGui();
|
||||
mainWindow->Remove(&w);
|
||||
ResumeGui();
|
||||
|
||||
return returnhere;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,7 @@
|
||||
#include <gctypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "usbloader/disc.h"
|
||||
@ -42,344 +41,340 @@ extern "C"
|
||||
#define CFG_ALIGN_BOTTOM 4
|
||||
#define CFG_ALIGN_MIDDLE 5
|
||||
|
||||
extern char bootDevice[10];
|
||||
extern char bootDevice[10];
|
||||
//extern char *cfg_path;
|
||||
|
||||
struct CFG
|
||||
{
|
||||
short widescreen;
|
||||
char theme_path[100];
|
||||
};
|
||||
struct CFG {
|
||||
short widescreen;
|
||||
char theme_path[100];
|
||||
};
|
||||
|
||||
|
||||
struct THEME
|
||||
{
|
||||
int selection_x;
|
||||
int selection_y;
|
||||
int selection_w;
|
||||
int selection_h;
|
||||
int gamegrid_x;
|
||||
int gamegrid_y;
|
||||
int gamegrid_w;
|
||||
int gamegrid_h;
|
||||
int tooltipAlpha;
|
||||
int gamecarousel_x;
|
||||
int gamecarousel_y;
|
||||
int gamecarousel_w;
|
||||
int gamecarousel_h;
|
||||
short cover_x;
|
||||
short cover_y;
|
||||
short showID;
|
||||
struct THEME {
|
||||
int selection_x;
|
||||
int selection_y;
|
||||
int selection_w;
|
||||
int selection_h;
|
||||
int gamegrid_x;
|
||||
int gamegrid_y;
|
||||
int gamegrid_w;
|
||||
int gamegrid_h;
|
||||
int tooltipAlpha;
|
||||
int gamecarousel_x;
|
||||
int gamecarousel_y;
|
||||
int gamecarousel_w;
|
||||
int gamecarousel_h;
|
||||
short cover_x;
|
||||
short cover_y;
|
||||
short showID;
|
||||
// short maxcharacters;
|
||||
short batteryUnused;
|
||||
short homebrew_x;
|
||||
short homebrew_y;
|
||||
short id_x;
|
||||
short id_y;
|
||||
short region_x;
|
||||
short region_y;
|
||||
short power_x;
|
||||
short power_y;
|
||||
short home_x;
|
||||
short home_y;
|
||||
short battery1_x;
|
||||
short battery2_x;
|
||||
short battery3_x;
|
||||
short battery4_x;
|
||||
short battery1_y;
|
||||
short battery2_y;
|
||||
short battery3_y;
|
||||
short battery4_y;
|
||||
short favorite_x;
|
||||
short favorite_y;
|
||||
short abc_x;
|
||||
short abc_y;
|
||||
short list_x;
|
||||
short list_y;
|
||||
short grid_x;
|
||||
short grid_y;
|
||||
short carousel_x;
|
||||
short carousel_y;
|
||||
short count_x;
|
||||
short count_y;
|
||||
short sortBarOffset;
|
||||
short batteryUnused;
|
||||
short homebrew_x;
|
||||
short homebrew_y;
|
||||
short id_x;
|
||||
short id_y;
|
||||
short region_x;
|
||||
short region_y;
|
||||
short power_x;
|
||||
short power_y;
|
||||
short home_x;
|
||||
short home_y;
|
||||
short battery1_x;
|
||||
short battery2_x;
|
||||
short battery3_x;
|
||||
short battery4_x;
|
||||
short battery1_y;
|
||||
short battery2_y;
|
||||
short battery3_y;
|
||||
short battery4_y;
|
||||
short favorite_x;
|
||||
short favorite_y;
|
||||
short abc_x;
|
||||
short abc_y;
|
||||
short list_x;
|
||||
short list_y;
|
||||
short grid_x;
|
||||
short grid_y;
|
||||
short carousel_x;
|
||||
short carousel_y;
|
||||
short count_x;
|
||||
short count_y;
|
||||
short sortBarOffset;
|
||||
// short showPower;
|
||||
// short showHome;
|
||||
short setting_x;
|
||||
short setting_y;
|
||||
short install_x;
|
||||
short install_y;
|
||||
short showHDD;
|
||||
short hddInfoAlign;
|
||||
short hddInfo_x;
|
||||
short hddInfo_y;
|
||||
short showGameCnt;
|
||||
short gameCntAlign;
|
||||
short gameCnt_x;
|
||||
short gameCnt_y;
|
||||
short showRegion;
|
||||
short showBattery;
|
||||
short showToolTip;
|
||||
//color
|
||||
short info_r;
|
||||
short info_g;
|
||||
short info_b;
|
||||
short prompttxt_r;
|
||||
short prompttxt_g;
|
||||
short prompttxt_b;
|
||||
short settingsTxt_r;
|
||||
short settingsTxt_g;
|
||||
short settingsTxt_b;
|
||||
short clock_r;
|
||||
short clock_g;
|
||||
short clock_b;
|
||||
short clock_x;
|
||||
short clock_y;
|
||||
short clockAlign;
|
||||
short sdcard_x;
|
||||
short sdcard_y;
|
||||
short gameText_r;
|
||||
short gameText_g;
|
||||
short gameText_b;
|
||||
short pagesize;
|
||||
};
|
||||
short setting_x;
|
||||
short setting_y;
|
||||
short install_x;
|
||||
short install_y;
|
||||
short showHDD;
|
||||
short hddInfoAlign;
|
||||
short hddInfo_x;
|
||||
short hddInfo_y;
|
||||
short showGameCnt;
|
||||
short gameCntAlign;
|
||||
short gameCnt_x;
|
||||
short gameCnt_y;
|
||||
short showRegion;
|
||||
short showBattery;
|
||||
short showToolTip;
|
||||
//color
|
||||
short info_r;
|
||||
short info_g;
|
||||
short info_b;
|
||||
short prompttxt_r;
|
||||
short prompttxt_g;
|
||||
short prompttxt_b;
|
||||
short settingsTxt_r;
|
||||
short settingsTxt_g;
|
||||
short settingsTxt_b;
|
||||
short clock_r;
|
||||
short clock_g;
|
||||
short clock_b;
|
||||
short clock_x;
|
||||
short clock_y;
|
||||
short clockAlign;
|
||||
short sdcard_x;
|
||||
short sdcard_y;
|
||||
short gameText_r;
|
||||
short gameText_g;
|
||||
short gameText_b;
|
||||
short pagesize;
|
||||
};
|
||||
|
||||
extern struct CFG CFG;
|
||||
extern struct THEME THEME;
|
||||
extern u8 ocarinaChoice;
|
||||
extern u16 playcnt;
|
||||
extern u8 videoChoice;
|
||||
extern u8 languageChoice;
|
||||
extern u8 viChoice;
|
||||
extern u8 iosChoice;
|
||||
extern u8 parentalcontrolChoice;
|
||||
extern u8 fix002;
|
||||
extern u8 reloadblock;
|
||||
extern u8 countrystrings;
|
||||
extern u8 alternatedol;
|
||||
extern u32 alternatedoloffset;
|
||||
extern u8 xflip;
|
||||
extern u8 qboot;
|
||||
extern u8 sort;
|
||||
extern u8 fave;
|
||||
extern u8 wsprompt;
|
||||
extern u8 keyset;
|
||||
extern u8 gameDisplay;
|
||||
extern u16 playcount;
|
||||
extern u8 favoritevar;
|
||||
extern char alternatedname[40];
|
||||
extern struct CFG CFG;
|
||||
extern struct THEME THEME;
|
||||
extern u8 ocarinaChoice;
|
||||
extern u16 playcnt;
|
||||
extern u8 videoChoice;
|
||||
extern u8 languageChoice;
|
||||
extern u8 viChoice;
|
||||
extern u8 iosChoice;
|
||||
extern u8 parentalcontrolChoice;
|
||||
extern u8 fix002;
|
||||
extern u8 reloadblock;
|
||||
extern u8 countrystrings;
|
||||
extern u8 alternatedol;
|
||||
extern u32 alternatedoloffset;
|
||||
extern u8 xflip;
|
||||
extern u8 qboot;
|
||||
extern u8 sort;
|
||||
extern u8 fave;
|
||||
extern u8 wsprompt;
|
||||
extern u8 keyset;
|
||||
extern u8 gameDisplay;
|
||||
extern u16 playcount;
|
||||
extern u8 favoritevar;
|
||||
extern char alternatedname[40];
|
||||
|
||||
|
||||
struct Game_CFG
|
||||
{
|
||||
u8 id[8];
|
||||
u8 video;
|
||||
u8 language;
|
||||
u8 ocarina;
|
||||
u8 vipatch;
|
||||
u8 ios;
|
||||
u8 parentalcontrol;
|
||||
u8 errorfix002;
|
||||
u8 iosreloadblock;
|
||||
u8 loadalternatedol;
|
||||
u32 alternatedolstart;
|
||||
u8 patchcountrystrings;
|
||||
char alternatedolname[40];
|
||||
};
|
||||
struct Game_NUM
|
||||
{
|
||||
u8 id[8];
|
||||
u8 favorite;
|
||||
u16 count;
|
||||
};
|
||||
struct Game_CFG {
|
||||
u8 id[8];
|
||||
u8 video;
|
||||
u8 language;
|
||||
u8 ocarina;
|
||||
u8 vipatch;
|
||||
u8 ios;
|
||||
u8 parentalcontrol;
|
||||
u8 errorfix002;
|
||||
u8 iosreloadblock;
|
||||
u8 loadalternatedol;
|
||||
u32 alternatedolstart;
|
||||
u8 patchcountrystrings;
|
||||
char alternatedolname[40];
|
||||
};
|
||||
struct Game_NUM {
|
||||
u8 id[8];
|
||||
u8 favorite;
|
||||
u16 count;
|
||||
};
|
||||
|
||||
|
||||
void CFG_Default(int widescreen); // -1 = non forced mode
|
||||
void CFG_Load(void);
|
||||
void lang_defualt();
|
||||
struct Game_CFG* CFG_get_game_opt(u8 *id);
|
||||
struct Game_NUM* CFG_get_game_num(u8 *id);
|
||||
bool CFG_save_game_opt(u8 *id);
|
||||
bool CFG_save_game_num(u8 *id);
|
||||
bool CFG_reset_all_playcounters();
|
||||
bool CFG_forget_game_opt(u8 *id);
|
||||
bool CFG_forget_game_num(u8 *id);
|
||||
void CFG_Default(int widescreen); // -1 = non forced mode
|
||||
void CFG_Load(void);
|
||||
void lang_defualt();
|
||||
struct Game_CFG* CFG_get_game_opt(u8 *id);
|
||||
struct Game_NUM* CFG_get_game_num(u8 *id);
|
||||
bool CFG_save_game_opt(u8 *id);
|
||||
bool CFG_save_game_num(u8 *id);
|
||||
bool CFG_reset_all_playcounters();
|
||||
bool CFG_forget_game_opt(u8 *id);
|
||||
bool CFG_forget_game_num(u8 *id);
|
||||
|
||||
|
||||
enum {
|
||||
ConsoleLangDefault=0,
|
||||
jap,
|
||||
eng,
|
||||
ger,
|
||||
fren,
|
||||
esp,
|
||||
it,
|
||||
dut,
|
||||
schin,
|
||||
tchin,
|
||||
kor,
|
||||
settings_language_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
ConsoleLangDefault=0,
|
||||
jap,
|
||||
eng,
|
||||
ger,
|
||||
fren,
|
||||
esp,
|
||||
it,
|
||||
dut,
|
||||
schin,
|
||||
tchin,
|
||||
kor,
|
||||
settings_language_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
systemdefault=0,
|
||||
discdefault,
|
||||
patch,
|
||||
pal50,
|
||||
pal60,
|
||||
ntsc,
|
||||
settings_video_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
systemdefault=0,
|
||||
discdefault,
|
||||
patch,
|
||||
pal50,
|
||||
pal60,
|
||||
ntsc,
|
||||
settings_video_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
off=0,
|
||||
on,
|
||||
settings_off_on_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
anti=2,
|
||||
};
|
||||
enum {
|
||||
off=0,
|
||||
on,
|
||||
settings_off_on_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
anti=2,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
GameID,
|
||||
GameRegion,
|
||||
Both,
|
||||
Neither,
|
||||
settings_sinfo_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
GameID,
|
||||
GameRegion,
|
||||
Both,
|
||||
Neither,
|
||||
settings_sinfo_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
i249=0,
|
||||
i222,
|
||||
i223
|
||||
};
|
||||
enum {
|
||||
i249=0,
|
||||
i222,
|
||||
i223
|
||||
};
|
||||
|
||||
enum {
|
||||
ios249=0,
|
||||
ios222,
|
||||
settings_cios_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
ios249=0,
|
||||
ios222,
|
||||
settings_cios_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
hr12=0,
|
||||
hr24,
|
||||
Off,
|
||||
settings_clock_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
all=0,
|
||||
pcount,
|
||||
};
|
||||
enum {
|
||||
hr12=0,
|
||||
hr24,
|
||||
Off,
|
||||
settings_clock_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
all=0,
|
||||
pcount,
|
||||
};
|
||||
|
||||
enum {
|
||||
RumbleOff=0,
|
||||
RumbleOn,
|
||||
settings_rumble_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
RumbleOff=0,
|
||||
RumbleOn,
|
||||
settings_rumble_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
TooltipsOff=0,
|
||||
TooltipsOn,
|
||||
settings_tooltips_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
TooltipsOff=0,
|
||||
TooltipsOn,
|
||||
settings_tooltips_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
min3=1,
|
||||
min5,
|
||||
min10,
|
||||
min20,
|
||||
min30,
|
||||
min60,
|
||||
settings_screensaver_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
min3=1,
|
||||
min5,
|
||||
min10,
|
||||
min20,
|
||||
min30,
|
||||
min60,
|
||||
settings_screensaver_max // always the last entry
|
||||
};
|
||||
|
||||
enum {
|
||||
no=0,
|
||||
yes,
|
||||
sysmenu,
|
||||
wtf,
|
||||
disk3d,
|
||||
settings_xflip_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
us=0,
|
||||
qwerty,
|
||||
dvorak,
|
||||
euro,
|
||||
azerty,
|
||||
settings_keyset_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
list,
|
||||
grid,
|
||||
carousel,
|
||||
settings_display_max
|
||||
};
|
||||
enum {
|
||||
scrollDefault,
|
||||
scrollMarquee,
|
||||
settings_scrolleffect_max // always the last entry
|
||||
};
|
||||
struct SSettings {
|
||||
u8 video;
|
||||
u8 language;
|
||||
u8 ocarina;
|
||||
u8 vpatch;
|
||||
int ios;
|
||||
u8 sinfo;
|
||||
u8 hddinfo;
|
||||
u8 rumble;
|
||||
u8 xflip;
|
||||
int volume;
|
||||
int sfxvolume;
|
||||
u8 tooltips;
|
||||
char unlockCode[20];
|
||||
u8 parentalcontrol;
|
||||
u8 cios;
|
||||
u8 qboot;
|
||||
u8 wsprompt;
|
||||
u8 keyset;
|
||||
u8 sort;
|
||||
u8 fave;
|
||||
u8 wiilight;
|
||||
u8 gameDisplay;
|
||||
u8 patchcountrystrings;
|
||||
u8 screensaver;
|
||||
short godmode;
|
||||
char covers_path[100];
|
||||
char theme_path[100];
|
||||
char wtheme_path[100];
|
||||
char disc_path[100];
|
||||
char titlestxt_path[100];
|
||||
char language_path[100];
|
||||
char languagefiles_path[100];
|
||||
char oggload_path[100];
|
||||
char ogg_path[150];
|
||||
char dolpath[150];
|
||||
char update_path[150];
|
||||
char homebrewapps_path[150];
|
||||
char selected_homebrew[200];
|
||||
char Cheatcodespath[100];
|
||||
char TxtCheatcodespath[100];
|
||||
short error002;
|
||||
u8 titlesOverride; // db_titles
|
||||
char db_url[200];
|
||||
char db_language[100];
|
||||
u8 db_JPtoEN;
|
||||
u8 gridRows;
|
||||
u8 autonetwork;
|
||||
};
|
||||
enum {
|
||||
no=0,
|
||||
yes,
|
||||
sysmenu,
|
||||
wtf,
|
||||
disk3d,
|
||||
settings_xflip_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
us=0,
|
||||
qwerty,
|
||||
dvorak,
|
||||
euro,
|
||||
azerty,
|
||||
settings_keyset_max // always the last entry
|
||||
};
|
||||
enum {
|
||||
list,
|
||||
grid,
|
||||
carousel,
|
||||
settings_display_max
|
||||
};
|
||||
enum {
|
||||
scrollDefault,
|
||||
scrollMarquee,
|
||||
settings_scrolleffect_max // always the last entry
|
||||
};
|
||||
struct SSettings {
|
||||
u8 video;
|
||||
u8 language;
|
||||
u8 ocarina;
|
||||
u8 vpatch;
|
||||
int ios;
|
||||
u8 sinfo;
|
||||
u8 hddinfo;
|
||||
u8 rumble;
|
||||
u8 xflip;
|
||||
int volume;
|
||||
int sfxvolume;
|
||||
u8 tooltips;
|
||||
char unlockCode[20];
|
||||
u8 parentalcontrol;
|
||||
u8 cios;
|
||||
u8 qboot;
|
||||
u8 wsprompt;
|
||||
u8 keyset;
|
||||
u8 sort;
|
||||
u8 fave;
|
||||
u8 wiilight;
|
||||
u8 gameDisplay;
|
||||
u8 patchcountrystrings;
|
||||
u8 screensaver;
|
||||
short godmode;
|
||||
char covers_path[100];
|
||||
char theme_path[100];
|
||||
char wtheme_path[100];
|
||||
char disc_path[100];
|
||||
char titlestxt_path[100];
|
||||
char language_path[100];
|
||||
char languagefiles_path[100];
|
||||
char oggload_path[100];
|
||||
char ogg_path[150];
|
||||
char dolpath[150];
|
||||
char update_path[150];
|
||||
char homebrewapps_path[150];
|
||||
char selected_homebrew[200];
|
||||
char Cheatcodespath[100];
|
||||
char TxtCheatcodespath[100];
|
||||
short error002;
|
||||
u8 titlesOverride; // db_titles
|
||||
char db_url[200];
|
||||
char db_language[100];
|
||||
u8 db_JPtoEN;
|
||||
u8 gridRows;
|
||||
u8 autonetwork;
|
||||
};
|
||||
|
||||
void CFG_LoadGlobal(void);
|
||||
bool cfg_save_global(void);
|
||||
void CFG_LoadGlobal(void);
|
||||
bool cfg_save_global(void);
|
||||
|
||||
bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool freemem);
|
||||
bool OpenXMLDatabase(char* xmlfilepath, char* argdblang, bool argJPtoEN, bool openfile, bool loadtitles, bool freemem);
|
||||
|
||||
char *get_title(struct discHdr *header);
|
||||
u8 get_block(struct discHdr *header);
|
||||
char *get_title(struct discHdr *header);
|
||||
u8 get_block(struct discHdr *header);
|
||||
|
||||
void CFG_Cleanup(void);
|
||||
void CFG_Cleanup(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define SVN_REV "673M"
|
||||
#define SVN_REV "674M"
|
||||
|
||||
const char *GetRev()
|
||||
{
|
||||
|
@ -2,14 +2,13 @@
|
||||
#define SVNREV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char *GetRev();
|
||||
const char *GetRev();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SVNREV_H */
|
||||
|
||||
#endif /* SVNREV_H */
|
||||
|
159
source/sys.cpp
159
source/sys.cpp
@ -18,7 +18,7 @@
|
||||
static vu32 *_wiilight_reg = (u32*)0xCD0000C0;
|
||||
void wiilight(int enable) { // Toggle wiilight (thanks Bool for wiilight source)
|
||||
u32 val = (*_wiilight_reg&~0x20);
|
||||
if(enable && Settings.wiilight) val |= 0x20;
|
||||
if (enable && Settings.wiilight) val |= 0x20;
|
||||
*_wiilight_reg=val;
|
||||
}
|
||||
|
||||
@ -26,52 +26,46 @@ void wiilight(int enable) { // Toggle wiilight (thanks Bool for wiil
|
||||
u8 shutdown = 0;
|
||||
u8 reset = 0;
|
||||
|
||||
void __Sys_ResetCallback(void)
|
||||
{
|
||||
/* Reboot console */
|
||||
reset = 1;
|
||||
void __Sys_ResetCallback(void) {
|
||||
/* Reboot console */
|
||||
reset = 1;
|
||||
}
|
||||
|
||||
void __Sys_PowerCallback(void)
|
||||
{
|
||||
/* Poweroff console */
|
||||
shutdown = 1;
|
||||
void __Sys_PowerCallback(void) {
|
||||
/* Poweroff console */
|
||||
shutdown = 1;
|
||||
}
|
||||
|
||||
void Sys_Init(void)
|
||||
{
|
||||
/* Initialize video subsytem */
|
||||
//VIDEO_Init();
|
||||
void Sys_Init(void) {
|
||||
/* Initialize video subsytem */
|
||||
//VIDEO_Init();
|
||||
|
||||
/* Set RESET/POWER button callback */
|
||||
SYS_SetResetCallback(__Sys_ResetCallback);
|
||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||
/* Set RESET/POWER button callback */
|
||||
SYS_SetResetCallback(__Sys_ResetCallback);
|
||||
SYS_SetPowerCallback(__Sys_PowerCallback);
|
||||
}
|
||||
|
||||
static void _ExitApp()
|
||||
{
|
||||
ExitGUIThreads();
|
||||
StopGX();
|
||||
ShutdownAudio();
|
||||
static void _ExitApp() {
|
||||
ExitGUIThreads();
|
||||
StopGX();
|
||||
ShutdownAudio();
|
||||
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
USBDevice_deInit();
|
||||
mload_set_ES_ioctlv_vector(NULL);
|
||||
mload_close();
|
||||
mload_close();
|
||||
}
|
||||
|
||||
void Sys_Reboot(void)
|
||||
{
|
||||
/* Restart console */
|
||||
_ExitApp();
|
||||
STM_RebootSystem();
|
||||
void Sys_Reboot(void) {
|
||||
/* Restart console */
|
||||
_ExitApp();
|
||||
STM_RebootSystem();
|
||||
}
|
||||
|
||||
int Sys_IosReload(int IOS)
|
||||
{
|
||||
int Sys_IosReload(int IOS) {
|
||||
s32 ret = -1;
|
||||
|
||||
//shutdown SD and USB before IOS Reload in DiscWait
|
||||
//shutdown SD and USB before IOS Reload in DiscWait
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
|
||||
@ -83,29 +77,29 @@ int Sys_IosReload(int IOS)
|
||||
|
||||
USBStorage_Deinit();
|
||||
|
||||
if(IOS == 249 || IOS == 222 || IOS == 223) {
|
||||
for(int i = 0; i < 10; i++) {
|
||||
if (IOS == 249 || IOS == 222 || IOS == 223) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ret = IOS_ReloadIOS(IOS);
|
||||
if(ret < 0) return ret;
|
||||
if(IOS == 222 || IOS == 223) load_ehc_module();
|
||||
if (ret < 0) return ret;
|
||||
if (IOS == 222 || IOS == 223) load_ehc_module();
|
||||
ret = WBFS_Init(WBFS_DEVICE_USB);
|
||||
if(!(ret < 0)) break;
|
||||
if (!(ret < 0)) break;
|
||||
sleep(1);
|
||||
USBStorage_Deinit();
|
||||
}
|
||||
if (ret>=0) {
|
||||
ret = Disc_Init();
|
||||
if (ret>=0) {
|
||||
ret = WBFS_Open();
|
||||
}
|
||||
} else Sys_BackToLoader();
|
||||
}
|
||||
if(ret>=0) {
|
||||
ret = Disc_Init();
|
||||
if(ret>=0) {
|
||||
ret = WBFS_Open();
|
||||
}
|
||||
} else Sys_BackToLoader();
|
||||
}
|
||||
|
||||
PAD_Init();
|
||||
Wpad_Init();
|
||||
WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
|
||||
WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);
|
||||
//reinitialize SD and USB
|
||||
//reinitialize SD and USB
|
||||
SDCard_Init();
|
||||
USBDevice_Init();
|
||||
|
||||
@ -116,56 +110,49 @@ int Sys_IosReload(int IOS)
|
||||
#define ShutdownToIdle 1
|
||||
#define ShutdownToStandby 2
|
||||
|
||||
static void _Sys_Shutdown(int SHUTDOWN_MODE)
|
||||
{
|
||||
_ExitApp();
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
static void _Sys_Shutdown(int SHUTDOWN_MODE) {
|
||||
_ExitApp();
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
|
||||
/* Poweroff console */
|
||||
if((CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE && SHUTDOWN_MODE != ShutdownToStandby) || SHUTDOWN_MODE == ShutdownToIdle) {
|
||||
s32 ret;
|
||||
/* Poweroff console */
|
||||
if ((CONF_GetShutdownMode() == CONF_SHUTDOWN_IDLE && SHUTDOWN_MODE != ShutdownToStandby) || SHUTDOWN_MODE == ShutdownToIdle) {
|
||||
s32 ret;
|
||||
|
||||
/* Set LED mode */
|
||||
ret = CONF_GetIdleLedMode();
|
||||
if(ret >= 0 && ret <= 2)
|
||||
STM_SetLedMode(ret);
|
||||
/* Set LED mode */
|
||||
ret = CONF_GetIdleLedMode();
|
||||
if (ret >= 0 && ret <= 2)
|
||||
STM_SetLedMode(ret);
|
||||
|
||||
/* Shutdown to idle */
|
||||
STM_ShutdownToIdle();
|
||||
} else {
|
||||
/* Shutdown to standby */
|
||||
STM_ShutdownToStandby();
|
||||
}
|
||||
/* Shutdown to idle */
|
||||
STM_ShutdownToIdle();
|
||||
} else {
|
||||
/* Shutdown to standby */
|
||||
STM_ShutdownToStandby();
|
||||
}
|
||||
}
|
||||
void Sys_Shutdown(void)
|
||||
{
|
||||
_Sys_Shutdown(ShutdownToDefault);
|
||||
void Sys_Shutdown(void) {
|
||||
_Sys_Shutdown(ShutdownToDefault);
|
||||
}
|
||||
void Sys_ShutdownToIdel(void)
|
||||
{
|
||||
_Sys_Shutdown(ShutdownToIdle);
|
||||
void Sys_ShutdownToIdel(void) {
|
||||
_Sys_Shutdown(ShutdownToIdle);
|
||||
}
|
||||
void Sys_ShutdownToStandby(void)
|
||||
{
|
||||
_Sys_Shutdown(ShutdownToStandby);
|
||||
void Sys_ShutdownToStandby(void) {
|
||||
_Sys_Shutdown(ShutdownToStandby);
|
||||
}
|
||||
|
||||
void Sys_LoadMenu(void)
|
||||
{
|
||||
_ExitApp();
|
||||
/* Return to the Wii system menu */
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
void Sys_LoadMenu(void) {
|
||||
_ExitApp();
|
||||
/* Return to the Wii system menu */
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
void Sys_BackToLoader(void)
|
||||
{
|
||||
if (*((u32*) 0x80001800))
|
||||
{
|
||||
_ExitApp();
|
||||
exit(0);
|
||||
}
|
||||
// Channel Version
|
||||
Sys_LoadMenu();
|
||||
void Sys_BackToLoader(void) {
|
||||
if (*((u32*) 0x80001800)) {
|
||||
_ExitApp();
|
||||
exit(0);
|
||||
}
|
||||
// Channel Version
|
||||
Sys_LoadMenu();
|
||||
}
|
||||
|
@ -32,8 +32,7 @@
|
||||
/***********************************************************************
|
||||
* Return the next byte in the pseudo-random sequence
|
||||
*/
|
||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) {
|
||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||
* unpredictable manner on 16-bit systems; not a problem
|
||||
* with any known compiler so far, though */
|
||||
@ -45,14 +44,13 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
||||
/***********************************************************************
|
||||
* Update the encryption keys with the next byte of plain text
|
||||
*/
|
||||
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
|
||||
{
|
||||
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) {
|
||||
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||
{
|
||||
register int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
|
||||
register int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@ -62,8 +60,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int
|
||||
* Initialize the encryption keys and the random header according to
|
||||
* the given password.
|
||||
*/
|
||||
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) {
|
||||
*(pkeys+0) = 305419896L;
|
||||
*(pkeys+1) = 591751049L;
|
||||
*(pkeys+2) = 878082192L;
|
||||
@ -82,18 +79,18 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned lon
|
||||
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
|
||||
|
||||
#define RAND_HEAD_LEN 12
|
||||
/* "last resort" source for second part of crypt seed pattern */
|
||||
/* "last resort" source for second part of crypt seed pattern */
|
||||
# ifndef ZCR_SEED2
|
||||
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
|
||||
# endif
|
||||
|
||||
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
||||
const char *passwd; /* password string */
|
||||
unsigned char *buf; /* where to write header */
|
||||
int bufSize;
|
||||
unsigned long* pkeys;
|
||||
const unsigned long* pcrc_32_tab;
|
||||
unsigned long crcForCrypting;
|
||||
const char *passwd; /* password string */
|
||||
unsigned char *buf; /* where to write header */
|
||||
int bufSize;
|
||||
unsigned long* pkeys;
|
||||
const unsigned long* pcrc_32_tab;
|
||||
unsigned long crcForCrypting;
|
||||
{
|
||||
int n; /* index in random header */
|
||||
int t; /* temporary */
|
||||
@ -102,26 +99,23 @@ static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
||||
static unsigned calls = 0; /* ensure different random header each time */
|
||||
|
||||
if (bufSize<RAND_HEAD_LEN)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
|
||||
* output of rand() to get less predictability, since rand() is
|
||||
* often poorly implemented.
|
||||
*/
|
||||
if (++calls == 1)
|
||||
{
|
||||
if (++calls == 1) {
|
||||
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
||||
}
|
||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||
{
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||
c = (rand() >> 7) & 0xff;
|
||||
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
||||
}
|
||||
/* Encrypt random header (last two bytes is high word of crc) */
|
||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||
{
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
|
||||
}
|
||||
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
|
||||
|
@ -30,56 +30,56 @@
|
||||
#endif
|
||||
|
||||
voidpf ZCALLBACK fopen_file_func OF((
|
||||
voidpf opaque,
|
||||
const char* filename,
|
||||
int mode));
|
||||
voidpf opaque,
|
||||
const char* filename,
|
||||
int mode));
|
||||
|
||||
uLong ZCALLBACK fread_file_func OF((
|
||||
voidpf opaque,
|
||||
voidpf stream,
|
||||
void* buf,
|
||||
uLong size));
|
||||
voidpf opaque,
|
||||
voidpf stream,
|
||||
void* buf,
|
||||
uLong size));
|
||||
|
||||
uLong ZCALLBACK fwrite_file_func OF((
|
||||
voidpf opaque,
|
||||
voidpf stream,
|
||||
const void* buf,
|
||||
uLong size));
|
||||
voidpf opaque,
|
||||
voidpf stream,
|
||||
const void* buf,
|
||||
uLong size));
|
||||
|
||||
long ZCALLBACK ftell_file_func OF((
|
||||
voidpf opaque,
|
||||
voidpf stream));
|
||||
voidpf opaque,
|
||||
voidpf stream));
|
||||
|
||||
long ZCALLBACK fseek_file_func OF((
|
||||
voidpf opaque,
|
||||
voidpf stream,
|
||||
uLong offset,
|
||||
int origin));
|
||||
voidpf opaque,
|
||||
voidpf stream,
|
||||
uLong offset,
|
||||
int origin));
|
||||
|
||||
int ZCALLBACK fclose_file_func OF((
|
||||
voidpf opaque,
|
||||
voidpf stream));
|
||||
voidpf opaque,
|
||||
voidpf stream));
|
||||
|
||||
int ZCALLBACK ferror_file_func OF((
|
||||
voidpf opaque,
|
||||
voidpf stream));
|
||||
voidpf opaque,
|
||||
voidpf stream));
|
||||
|
||||
|
||||
voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
|
||||
voidpf opaque;
|
||||
const char* filename;
|
||||
int mode;
|
||||
voidpf opaque;
|
||||
const char* filename;
|
||||
int mode;
|
||||
{
|
||||
FILE* file = NULL;
|
||||
const char* mode_fopen = NULL;
|
||||
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||
mode_fopen = "rb";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
|
||||
mode_fopen = "r+b";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||
mode_fopen = "wb";
|
||||
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
|
||||
mode_fopen = "r+b";
|
||||
else
|
||||
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||
mode_fopen = "wb";
|
||||
|
||||
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||
file = fopen(filename, mode_fopen);
|
||||
@ -88,10 +88,10 @@ voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
|
||||
|
||||
|
||||
uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
void* buf;
|
||||
uLong size;
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
void* buf;
|
||||
uLong size;
|
||||
{
|
||||
uLong ret;
|
||||
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||
@ -100,10 +100,10 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
|
||||
|
||||
|
||||
uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
const void* buf;
|
||||
uLong size;
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
const void* buf;
|
||||
uLong size;
|
||||
{
|
||||
uLong ret;
|
||||
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||
@ -111,8 +111,8 @@ uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
|
||||
}
|
||||
|
||||
long ZCALLBACK ftell_file_func (opaque, stream)
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
{
|
||||
long ret;
|
||||
ret = ftell((FILE *)stream);
|
||||
@ -120,15 +120,14 @@ long ZCALLBACK ftell_file_func (opaque, stream)
|
||||
}
|
||||
|
||||
long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
uLong offset;
|
||||
int origin;
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
uLong offset;
|
||||
int origin;
|
||||
{
|
||||
int fseek_origin=0;
|
||||
long ret;
|
||||
switch (origin)
|
||||
{
|
||||
switch (origin) {
|
||||
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||
fseek_origin = SEEK_CUR;
|
||||
break;
|
||||
@ -138,7 +137,8 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||
case ZLIB_FILEFUNC_SEEK_SET :
|
||||
fseek_origin = SEEK_SET;
|
||||
break;
|
||||
default: return -1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
ret = 0;
|
||||
fseek((FILE *)stream, offset, fseek_origin);
|
||||
@ -146,8 +146,8 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||
}
|
||||
|
||||
int ZCALLBACK fclose_file_func (opaque, stream)
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
{
|
||||
int ret;
|
||||
ret = fclose((FILE *)stream);
|
||||
@ -155,8 +155,8 @@ int ZCALLBACK fclose_file_func (opaque, stream)
|
||||
}
|
||||
|
||||
int ZCALLBACK ferror_file_func (opaque, stream)
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
{
|
||||
int ret;
|
||||
ret = ferror((FILE *)stream);
|
||||
@ -164,7 +164,7 @@ int ZCALLBACK ferror_file_func (opaque, stream)
|
||||
}
|
||||
|
||||
void fill_fopen_filefunc (pzlib_filefunc_def)
|
||||
zlib_filefunc_def* pzlib_filefunc_def;
|
||||
zlib_filefunc_def* pzlib_filefunc_def;
|
||||
{
|
||||
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
||||
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||
|
@ -35,29 +35,28 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||
|
||||
typedef struct zlib_filefunc_def_s
|
||||
{
|
||||
open_file_func zopen_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell_file_func ztell_file;
|
||||
seek_file_func zseek_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc_def;
|
||||
typedef struct zlib_filefunc_def_s {
|
||||
open_file_func zopen_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell_file_func ztell_file;
|
||||
seek_file_func zseek_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc_def;
|
||||
|
||||
|
||||
|
||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
|
||||
#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
|
||||
|
@ -21,59 +21,53 @@
|
||||
#define WRITEBUFFERSIZE (8192)
|
||||
#define MAXFILENAME (256)
|
||||
|
||||
static int mymkdir(const char* dirname)
|
||||
{
|
||||
static int mymkdir(const char* dirname) {
|
||||
int ret=0;
|
||||
ret = mkdir (dirname,0775);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int makedir (char *newdir)
|
||||
{
|
||||
char *buffer ;
|
||||
char *p;
|
||||
int len = (int)strlen(newdir);
|
||||
int makedir (char *newdir) {
|
||||
char *buffer ;
|
||||
char *p;
|
||||
int len = (int)strlen(newdir);
|
||||
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
if (len <= 0)
|
||||
return 0;
|
||||
|
||||
buffer = (char*)malloc(len+1);
|
||||
strcpy(buffer,newdir);
|
||||
buffer = (char*)malloc(len+1);
|
||||
strcpy(buffer,newdir);
|
||||
|
||||
if (buffer[len-1] == '/') {
|
||||
buffer[len-1] = '\0';
|
||||
}
|
||||
if (mymkdir(buffer) == 0)
|
||||
{
|
||||
free(buffer);
|
||||
return 1;
|
||||
if (buffer[len-1] == '/') {
|
||||
buffer[len-1] = '\0';
|
||||
}
|
||||
if (mymkdir(buffer) == 0) {
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
p = buffer+1;
|
||||
while (1)
|
||||
{
|
||||
char hold;
|
||||
p = buffer+1;
|
||||
while (1) {
|
||||
char hold;
|
||||
|
||||
while(*p && *p != '\\' && *p != '/')
|
||||
p++;
|
||||
hold = *p;
|
||||
*p = 0;
|
||||
if ((mymkdir(buffer) == -1) && (errno == ENOENT))
|
||||
{
|
||||
printf("couldn't create directory %s\n",buffer);
|
||||
free(buffer);
|
||||
return 0;
|
||||
while (*p && *p != '\\' && *p != '/')
|
||||
p++;
|
||||
hold = *p;
|
||||
*p = 0;
|
||||
if ((mymkdir(buffer) == -1) && (errno == ENOENT)) {
|
||||
printf("couldn't create directory %s\n",buffer);
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
||||
if (hold == 0)
|
||||
break;
|
||||
*p++ = hold;
|
||||
if (hold == 0)
|
||||
break;
|
||||
*p++ = hold;
|
||||
}
|
||||
free(buffer);
|
||||
return 1;
|
||||
free(buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_path,int* popt_overwrite,const char* password)
|
||||
{
|
||||
static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_path,int* popt_overwrite,const char* password) {
|
||||
char filename_inzip[256];
|
||||
char* filename_withoutpath;
|
||||
char* p;
|
||||
@ -85,38 +79,31 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
unz_file_info file_info;
|
||||
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
|
||||
return err;
|
||||
}
|
||||
|
||||
size_buf = WRITEBUFFERSIZE;
|
||||
buf = (void*)malloc(size_buf);
|
||||
if (buf==NULL)
|
||||
{
|
||||
if (buf==NULL) {
|
||||
printf("Error allocating memory\n");
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
|
||||
p = filename_withoutpath = filename_inzip;
|
||||
while ((*p) != '\0')
|
||||
{
|
||||
while ((*p) != '\0') {
|
||||
if (((*p)=='/') || ((*p)=='\\'))
|
||||
filename_withoutpath = p+1;
|
||||
p++;
|
||||
}
|
||||
|
||||
if ((*filename_withoutpath)=='\0')
|
||||
{
|
||||
if ((*popt_extract_without_path)==0)
|
||||
{
|
||||
if ((*filename_withoutpath)=='\0') {
|
||||
if ((*popt_extract_without_path)==0) {
|
||||
printf("creating directory: %s\n",filename_inzip);
|
||||
mymkdir(filename_inzip);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
char* write_filename;
|
||||
int skip=0;
|
||||
|
||||
@ -126,35 +113,29 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
write_filename = filename_withoutpath;
|
||||
|
||||
err = unzOpenCurrentFilePassword(uf,password);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
|
||||
}
|
||||
|
||||
if (((*popt_overwrite)==0) && (err==UNZ_OK))
|
||||
{
|
||||
if (((*popt_overwrite)==0) && (err==UNZ_OK)) {
|
||||
char rep=0;
|
||||
FILE* ftestexist;
|
||||
ftestexist = fopen(write_filename,"rb");
|
||||
if (ftestexist!=NULL)
|
||||
{
|
||||
if (ftestexist!=NULL) {
|
||||
fclose(ftestexist);
|
||||
do
|
||||
{
|
||||
do {
|
||||
char answer[128];
|
||||
int ret;
|
||||
|
||||
printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
|
||||
ret = scanf("%1s",answer);
|
||||
if (ret != 1)
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
if (ret != 1) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
rep = answer[0] ;
|
||||
if ((rep>='a') && (rep<='z'))
|
||||
rep -= 0x20;
|
||||
}
|
||||
while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||
} while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||
}
|
||||
|
||||
if (rep == 'N')
|
||||
@ -164,14 +145,12 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
*popt_overwrite=1;
|
||||
}
|
||||
|
||||
if ((skip==0) && (err==UNZ_OK))
|
||||
{
|
||||
if ((skip==0) && (err==UNZ_OK)) {
|
||||
fout=fopen(write_filename,"wb");
|
||||
|
||||
/* some zipfile don't contain directory alone before file */
|
||||
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
||||
(filename_withoutpath!=(char*)filename_inzip))
|
||||
{
|
||||
(filename_withoutpath!=(char*)filename_inzip)) {
|
||||
char c=*(filename_withoutpath-1);
|
||||
*(filename_withoutpath-1)='\0';
|
||||
makedir(write_filename);
|
||||
@ -179,47 +158,38 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
fout=fopen(write_filename,"wb");
|
||||
}
|
||||
|
||||
if (fout==NULL)
|
||||
{
|
||||
if (fout==NULL) {
|
||||
printf("error opening %s\n",write_filename);
|
||||
}
|
||||
}
|
||||
|
||||
if (fout!=NULL)
|
||||
{
|
||||
if (fout!=NULL) {
|
||||
printf(" extracting: %s\n",write_filename);
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
err = unzReadCurrentFile(uf,buf,size_buf);
|
||||
if (err<0)
|
||||
{
|
||||
if (err<0) {
|
||||
printf("error %d with zipfile in unzReadCurrentFile\n",err);
|
||||
break;
|
||||
}
|
||||
if (err>0)
|
||||
if (fwrite(buf,err,1,fout)!=1)
|
||||
{
|
||||
if (fwrite(buf,err,1,fout)!=1) {
|
||||
printf("error in writing extracted file\n");
|
||||
err=UNZ_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (err>0);
|
||||
} while (err>0);
|
||||
if (fout)
|
||||
fclose(fout);
|
||||
fclose(fout);
|
||||
|
||||
}
|
||||
|
||||
if (err==UNZ_OK)
|
||||
{
|
||||
if (err==UNZ_OK) {
|
||||
err = unzCloseCurrentFile (uf);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
printf("error %d with zipfile in unzCloseCurrentFile\n",err);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
unzCloseCurrentFile(uf); /* don't lose the error */
|
||||
}
|
||||
|
||||
@ -228,8 +198,7 @@ static int do_extract_currentfile(unzFile uf,const int* popt_extract_without_pat
|
||||
}
|
||||
|
||||
|
||||
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password)
|
||||
{
|
||||
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password) {
|
||||
uLong i;
|
||||
unz_global_info gi;
|
||||
int err;
|
||||
@ -238,18 +207,15 @@ int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const c
|
||||
if (err!=UNZ_OK)
|
||||
printf("error %d with zipfile in unzGetGlobalInfo \n",err);
|
||||
|
||||
for (i=0;i<gi.number_entry;i++)
|
||||
{
|
||||
for (i=0;i<gi.number_entry;i++) {
|
||||
if (do_extract_currentfile(uf,&opt_extract_without_path,
|
||||
&opt_overwrite,
|
||||
password) != UNZ_OK)
|
||||
&opt_overwrite,
|
||||
password) != UNZ_OK)
|
||||
break;
|
||||
|
||||
if ((i+1)<gi.number_entry)
|
||||
{
|
||||
if ((i+1)<gi.number_entry) {
|
||||
err = unzGoToNextFile(uf);
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
printf("error %d with zipfile in unzGoToNextFile\n",err);
|
||||
break;
|
||||
}
|
||||
@ -259,17 +225,15 @@ int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const c
|
||||
return 0;
|
||||
}
|
||||
|
||||
int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password)
|
||||
{
|
||||
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
||||
{
|
||||
int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password) {
|
||||
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) {
|
||||
printf("file %s not found in the zipfile\n",filename);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (do_extract_currentfile(uf,&opt_extract_without_path,
|
||||
&opt_overwrite,
|
||||
password) == UNZ_OK)
|
||||
&opt_overwrite,
|
||||
password) == UNZ_OK)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
@ -6,9 +6,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password);
|
||||
int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password);
|
||||
int makedir(char *newdir);
|
||||
int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password);
|
||||
int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password);
|
||||
int makedir(char *newdir);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -28,254 +28,254 @@
|
||||
} while(0)
|
||||
|
||||
extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
|
||||
const char* file;
|
||||
const char* file;
|
||||
const char* fileOut;
|
||||
const char* fileOutTmp;
|
||||
uLong* nRecovered;
|
||||
uLong* bytesRecovered;
|
||||
{
|
||||
int err = Z_OK;
|
||||
FILE* fpZip = fopen(file, "rb");
|
||||
FILE* fpOut = fopen(fileOut, "wb");
|
||||
FILE* fpOutCD = fopen(fileOutTmp, "wb");
|
||||
if (fpZip != NULL && fpOut != NULL) {
|
||||
int entries = 0;
|
||||
uLong totalBytes = 0;
|
||||
char header[30];
|
||||
char filename[256];
|
||||
char extra[1024];
|
||||
int offset = 0;
|
||||
int offsetCD = 0;
|
||||
while ( fread(header, 1, 30, fpZip) == 30 ) {
|
||||
int currentOffset = offset;
|
||||
int err = Z_OK;
|
||||
FILE* fpZip = fopen(file, "rb");
|
||||
FILE* fpOut = fopen(fileOut, "wb");
|
||||
FILE* fpOutCD = fopen(fileOutTmp, "wb");
|
||||
if (fpZip != NULL && fpOut != NULL) {
|
||||
int entries = 0;
|
||||
uLong totalBytes = 0;
|
||||
char header[30];
|
||||
char filename[256];
|
||||
char extra[1024];
|
||||
int offset = 0;
|
||||
int offsetCD = 0;
|
||||
while ( fread(header, 1, 30, fpZip) == 30 ) {
|
||||
int currentOffset = offset;
|
||||
|
||||
/* File entry */
|
||||
if (READ_32(header) == 0x04034b50) {
|
||||
unsigned int version = READ_16(header + 4);
|
||||
unsigned int gpflag = READ_16(header + 6);
|
||||
unsigned int method = READ_16(header + 8);
|
||||
unsigned int filetime = READ_16(header + 10);
|
||||
unsigned int filedate = READ_16(header + 12);
|
||||
unsigned int crc = READ_32(header + 14); /* crc */
|
||||
unsigned int cpsize = READ_32(header + 18); /* compressed size */
|
||||
unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
|
||||
unsigned int fnsize = READ_16(header + 26); /* file name length */
|
||||
unsigned int extsize = READ_16(header + 28); /* extra field length */
|
||||
filename[0] = extra[0] = '\0';
|
||||
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 30, fpOut) == 30) {
|
||||
offset += 30;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Filename */
|
||||
if (fnsize > 0) {
|
||||
if (fread(filename, 1, fnsize, fpZip) == fnsize) {
|
||||
if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
|
||||
offset += fnsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_STREAM_ERROR;
|
||||
break;
|
||||
}
|
||||
/* File entry */
|
||||
if (READ_32(header) == 0x04034b50) {
|
||||
unsigned int version = READ_16(header + 4);
|
||||
unsigned int gpflag = READ_16(header + 6);
|
||||
unsigned int method = READ_16(header + 8);
|
||||
unsigned int filetime = READ_16(header + 10);
|
||||
unsigned int filedate = READ_16(header + 12);
|
||||
unsigned int crc = READ_32(header + 14); /* crc */
|
||||
unsigned int cpsize = READ_32(header + 18); /* compressed size */
|
||||
unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
|
||||
unsigned int fnsize = READ_16(header + 26); /* file name length */
|
||||
unsigned int extsize = READ_16(header + 28); /* extra field length */
|
||||
filename[0] = extra[0] = '\0';
|
||||
|
||||
/* Extra field */
|
||||
if (extsize > 0) {
|
||||
if (fread(extra, 1, extsize, fpZip) == extsize) {
|
||||
if (fwrite(extra, 1, extsize, fpOut) == extsize) {
|
||||
offset += extsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Data */
|
||||
{
|
||||
int dataSize = cpsize;
|
||||
if (dataSize == 0) {
|
||||
dataSize = uncpsize;
|
||||
}
|
||||
if (dataSize > 0) {
|
||||
char* data = malloc(dataSize);
|
||||
if (data != NULL) {
|
||||
if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
|
||||
if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
|
||||
offset += dataSize;
|
||||
totalBytes += dataSize;
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 30, fpOut) == 30) {
|
||||
offset += 30;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
}
|
||||
free(data);
|
||||
if (err != Z_OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Filename */
|
||||
if (fnsize > 0) {
|
||||
if (fread(filename, 1, fnsize, fpZip) == fnsize) {
|
||||
if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
|
||||
offset += fnsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_STREAM_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Extra field */
|
||||
if (extsize > 0) {
|
||||
if (fread(extra, 1, extsize, fpZip) == extsize) {
|
||||
if (fwrite(extra, 1, extsize, fpOut) == extsize) {
|
||||
offset += extsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Data */
|
||||
{
|
||||
int dataSize = cpsize;
|
||||
if (dataSize == 0) {
|
||||
dataSize = uncpsize;
|
||||
}
|
||||
if (dataSize > 0) {
|
||||
char* data = malloc(dataSize);
|
||||
if (data != NULL) {
|
||||
if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
|
||||
if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
|
||||
offset += dataSize;
|
||||
totalBytes += dataSize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
}
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
}
|
||||
free(data);
|
||||
if (err != Z_OK) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_MEM_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Central directory entry */
|
||||
{
|
||||
char header[46];
|
||||
char* comment = "";
|
||||
int comsize = (int) strlen(comment);
|
||||
WRITE_32(header, 0x02014b50);
|
||||
WRITE_16(header + 4, version);
|
||||
WRITE_16(header + 6, version);
|
||||
WRITE_16(header + 8, gpflag);
|
||||
WRITE_16(header + 10, method);
|
||||
WRITE_16(header + 12, filetime);
|
||||
WRITE_16(header + 14, filedate);
|
||||
WRITE_32(header + 16, crc);
|
||||
WRITE_32(header + 20, cpsize);
|
||||
WRITE_32(header + 24, uncpsize);
|
||||
WRITE_16(header + 28, fnsize);
|
||||
WRITE_16(header + 30, extsize);
|
||||
WRITE_16(header + 32, comsize);
|
||||
WRITE_16(header + 34, 0); /* disk # */
|
||||
WRITE_16(header + 36, 0); /* int attrb */
|
||||
WRITE_32(header + 38, 0); /* ext attrb */
|
||||
WRITE_32(header + 42, currentOffset);
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 46, fpOutCD) == 46) {
|
||||
offsetCD += 46;
|
||||
|
||||
/* Filename */
|
||||
if (fnsize > 0) {
|
||||
if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
|
||||
offsetCD += fnsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
err = Z_STREAM_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Extra field */
|
||||
if (extsize > 0) {
|
||||
if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
|
||||
offsetCD += extsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Comment field */
|
||||
if (comsize > 0) {
|
||||
if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
|
||||
offsetCD += comsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Success */
|
||||
entries++;
|
||||
|
||||
} else {
|
||||
err = Z_MEM_ERROR;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Central directory entry */
|
||||
|
||||
/* Final central directory */
|
||||
{
|
||||
char header[46];
|
||||
char* comment = "";
|
||||
int comsize = (int) strlen(comment);
|
||||
WRITE_32(header, 0x02014b50);
|
||||
WRITE_16(header + 4, version);
|
||||
WRITE_16(header + 6, version);
|
||||
WRITE_16(header + 8, gpflag);
|
||||
WRITE_16(header + 10, method);
|
||||
WRITE_16(header + 12, filetime);
|
||||
WRITE_16(header + 14, filedate);
|
||||
WRITE_32(header + 16, crc);
|
||||
WRITE_32(header + 20, cpsize);
|
||||
WRITE_32(header + 24, uncpsize);
|
||||
WRITE_16(header + 28, fnsize);
|
||||
WRITE_16(header + 30, extsize);
|
||||
WRITE_16(header + 32, comsize);
|
||||
WRITE_16(header + 34, 0); /* disk # */
|
||||
WRITE_16(header + 36, 0); /* int attrb */
|
||||
WRITE_32(header + 38, 0); /* ext attrb */
|
||||
WRITE_32(header + 42, currentOffset);
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 46, fpOutCD) == 46) {
|
||||
offsetCD += 46;
|
||||
|
||||
/* Filename */
|
||||
if (fnsize > 0) {
|
||||
if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
|
||||
offsetCD += fnsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
int entriesZip = entries;
|
||||
char header[22];
|
||||
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
|
||||
int comsize = (int) strlen(comment);
|
||||
if (entriesZip > 0xffff) {
|
||||
entriesZip = 0xffff;
|
||||
}
|
||||
WRITE_32(header, 0x06054b50);
|
||||
WRITE_16(header + 4, 0); /* disk # */
|
||||
WRITE_16(header + 6, 0); /* disk # */
|
||||
WRITE_16(header + 8, entriesZip); /* hack */
|
||||
WRITE_16(header + 10, entriesZip); /* hack */
|
||||
WRITE_32(header + 12, offsetCD); /* size of CD */
|
||||
WRITE_32(header + 16, offset); /* offset to CD */
|
||||
WRITE_16(header + 20, comsize); /* comment */
|
||||
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 22, fpOutCD) == 22) {
|
||||
|
||||
/* Comment field */
|
||||
if (comsize > 0) {
|
||||
if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
|
||||
err = Z_ERRNO;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
err = Z_STREAM_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Extra field */
|
||||
if (extsize > 0) {
|
||||
if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
|
||||
offsetCD += extsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Comment field */
|
||||
if (comsize > 0) {
|
||||
if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
|
||||
offsetCD += comsize;
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Success */
|
||||
entries++;
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Final central directory */
|
||||
{
|
||||
int entriesZip = entries;
|
||||
char header[22];
|
||||
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
|
||||
int comsize = (int) strlen(comment);
|
||||
if (entriesZip > 0xffff) {
|
||||
entriesZip = 0xffff;
|
||||
}
|
||||
WRITE_32(header, 0x06054b50);
|
||||
WRITE_16(header + 4, 0); /* disk # */
|
||||
WRITE_16(header + 6, 0); /* disk # */
|
||||
WRITE_16(header + 8, entriesZip); /* hack */
|
||||
WRITE_16(header + 10, entriesZip); /* hack */
|
||||
WRITE_32(header + 12, offsetCD); /* size of CD */
|
||||
WRITE_32(header + 16, offset); /* offset to CD */
|
||||
WRITE_16(header + 20, comsize); /* comment */
|
||||
|
||||
/* Header */
|
||||
if (fwrite(header, 1, 22, fpOutCD) == 22) {
|
||||
|
||||
/* Comment field */
|
||||
if (comsize > 0) {
|
||||
if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
|
||||
err = Z_ERRNO;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
err = Z_ERRNO;
|
||||
}
|
||||
}
|
||||
|
||||
/* Final merge (file + central directory) */
|
||||
fclose(fpOutCD);
|
||||
if (err == Z_OK) {
|
||||
fpOutCD = fopen(fileOutTmp, "rb");
|
||||
if (fpOutCD != NULL) {
|
||||
int nRead;
|
||||
char buffer[8192];
|
||||
while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
|
||||
if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Final merge (file + central directory) */
|
||||
fclose(fpOutCD);
|
||||
}
|
||||
if (err == Z_OK) {
|
||||
fpOutCD = fopen(fileOutTmp, "rb");
|
||||
if (fpOutCD != NULL) {
|
||||
int nRead;
|
||||
char buffer[8192];
|
||||
while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
|
||||
if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
|
||||
err = Z_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fpOutCD);
|
||||
}
|
||||
}
|
||||
|
||||
/* Close */
|
||||
fclose(fpZip);
|
||||
fclose(fpOut);
|
||||
|
||||
/* Wipe temporary file */
|
||||
(void)remove(fileOutTmp);
|
||||
|
||||
/* Number of recovered entries */
|
||||
if (err == Z_OK) {
|
||||
if (nRecovered != NULL) {
|
||||
*nRecovered = entries;
|
||||
}
|
||||
if (bytesRecovered != NULL) {
|
||||
*bytesRecovered = totalBytes;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = Z_STREAM_ERROR;
|
||||
}
|
||||
|
||||
/* Close */
|
||||
fclose(fpZip);
|
||||
fclose(fpOut);
|
||||
|
||||
/* Wipe temporary file */
|
||||
(void)remove(fileOutTmp);
|
||||
|
||||
/* Number of recovered entries */
|
||||
if (err == Z_OK) {
|
||||
if (nRecovered != NULL) {
|
||||
*nRecovered = entries;
|
||||
}
|
||||
if (bytesRecovered != NULL) {
|
||||
*bytesRecovered = totalBytes;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = Z_STREAM_ERROR;
|
||||
}
|
||||
return err;
|
||||
return err;
|
||||
}
|
||||
|
@ -17,15 +17,15 @@ extern "C" {
|
||||
|
||||
#include "unzip.h"
|
||||
|
||||
/* Repair a ZIP file (missing central directory)
|
||||
file: file to recover
|
||||
fileOut: output file after recovery
|
||||
fileOutTmp: temporary file name used for recovery
|
||||
*/
|
||||
extern int ZEXPORT unzRepair(const char* file,
|
||||
const char* fileOut,
|
||||
const char* fileOutTmp,
|
||||
uLong* nRecovered,
|
||||
uLong* bytesRecovered);
|
||||
/* Repair a ZIP file (missing central directory)
|
||||
file: file to recover
|
||||
fileOut: output file after recovery
|
||||
fileOutTmp: temporary file name used for recovery
|
||||
*/
|
||||
extern int ZEXPORT unzRepair(const char* file,
|
||||
const char* fileOut,
|
||||
const char* fileOutTmp,
|
||||
uLong* nRecovered,
|
||||
uLong* bytesRecovered);
|
||||
|
||||
#endif
|
||||
|
@ -47,7 +47,7 @@ woven in by Terry Thorsen 1/2003.
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
extern int errno;
|
||||
extern int errno;
|
||||
#else
|
||||
# include <errno.h>
|
||||
#endif
|
||||
@ -88,19 +88,17 @@ woven in by Terry Thorsen 1/2003.
|
||||
|
||||
|
||||
const char unz_copyright[] =
|
||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
|
||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
||||
typedef struct unz_file_info_internal_s
|
||||
{
|
||||
typedef struct unz_file_info_internal_s {
|
||||
uLong offset_curfile;/* relative offset of local header 4 bytes */
|
||||
} unz_file_info_internal;
|
||||
|
||||
|
||||
/* file_in_zip_read_info_s contain internal information about a file in zipfile,
|
||||
when reading and decompress it */
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
char *read_buffer; /* internal buffer for compressed data */
|
||||
z_stream stream; /* zLib stream structure for inflate */
|
||||
|
||||
@ -125,8 +123,7 @@ typedef struct
|
||||
|
||||
/* unz_s contain internal information about the zipfile
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
zlib_filefunc_def z_filefunc;
|
||||
voidpf filestream; /* io structore of the zipfile */
|
||||
unz_global_info gi; /* public global information */
|
||||
@ -164,24 +161,21 @@ typedef struct
|
||||
|
||||
|
||||
local int unzlocal_getByte OF((
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
int *pi));
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
int *pi));
|
||||
|
||||
local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
int *pi;
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
int *pi;
|
||||
{
|
||||
unsigned char c;
|
||||
int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
|
||||
if (err==1)
|
||||
{
|
||||
if (err==1) {
|
||||
*pi = (int)c;
|
||||
return UNZ_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (ZERROR(*pzlib_filefunc_def,filestream))
|
||||
return UNZ_ERRNO;
|
||||
else
|
||||
@ -194,14 +188,14 @@ local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
|
||||
Reads a long in LSB order from the given gz_stream. Sets
|
||||
*/
|
||||
local int unzlocal_getShort OF((
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
uLong *pX));
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
uLong *pX));
|
||||
|
||||
local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
uLong *pX;
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
uLong *pX;
|
||||
{
|
||||
uLong x ;
|
||||
int i;
|
||||
@ -222,14 +216,14 @@ local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
|
||||
}
|
||||
|
||||
local int unzlocal_getLong OF((
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
uLong *pX));
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
uLong *pX));
|
||||
|
||||
local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
uLong *pX;
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
uLong *pX;
|
||||
{
|
||||
uLong x ;
|
||||
int i;
|
||||
@ -260,11 +254,10 @@ local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
|
||||
|
||||
/* My own strcmpi / strcasecmp */
|
||||
local int strcmpcasenosensitive_internal (fileName1,fileName2)
|
||||
const char* fileName1;
|
||||
const char* fileName2;
|
||||
const char* fileName1;
|
||||
const char* fileName2;
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
char c1=*(fileName1++);
|
||||
char c2=*(fileName2++);
|
||||
if ((c1>='a') && (c1<='z'))
|
||||
@ -304,8 +297,8 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
|
||||
*/
|
||||
extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
|
||||
const char* fileName1;
|
||||
const char* fileName2;
|
||||
int iCaseSensitivity;
|
||||
const char* fileName2;
|
||||
int iCaseSensitivity;
|
||||
{
|
||||
if (iCaseSensitivity==0)
|
||||
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
|
||||
@ -325,12 +318,12 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit
|
||||
the global comment)
|
||||
*/
|
||||
local uLong unzlocal_SearchCentralDir OF((
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream));
|
||||
const zlib_filefunc_def* pzlib_filefunc_def,
|
||||
voidpf filestream));
|
||||
|
||||
local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
const zlib_filefunc_def* pzlib_filefunc_def;
|
||||
voidpf filestream;
|
||||
{
|
||||
unsigned char* buf;
|
||||
uLong uSizeFile;
|
||||
@ -352,8 +345,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
return 0;
|
||||
|
||||
uBackRead = 4;
|
||||
while (uBackRead<uMaxBack)
|
||||
{
|
||||
while (uBackRead<uMaxBack) {
|
||||
uLong uReadSize,uReadPos ;
|
||||
int i;
|
||||
if (uBackRead+BUFREADCOMMENT>uMaxBack)
|
||||
@ -363,7 +355,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
uReadPos = uSizeFile-uBackRead ;
|
||||
|
||||
uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
|
||||
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
|
||||
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
|
||||
if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
break;
|
||||
|
||||
@ -372,8 +364,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
|
||||
for (i=(int)uReadSize-3; (i--)>0;)
|
||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
||||
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
||||
{
|
||||
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) {
|
||||
uPosFound = uReadPos+i;
|
||||
break;
|
||||
}
|
||||
@ -396,7 +387,7 @@ local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
|
||||
*/
|
||||
extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
||||
const char *path;
|
||||
zlib_filefunc_def* pzlib_filefunc_def;
|
||||
zlib_filefunc_def* pzlib_filefunc_def;
|
||||
{
|
||||
unz_s us;
|
||||
unz_s *s;
|
||||
@ -421,9 +412,9 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
||||
us.z_filefunc = *pzlib_filefunc_def;
|
||||
|
||||
us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque,
|
||||
path,
|
||||
ZLIB_FILEFUNC_MODE_READ |
|
||||
ZLIB_FILEFUNC_MODE_EXISTING);
|
||||
path,
|
||||
ZLIB_FILEFUNC_MODE_READ |
|
||||
ZLIB_FILEFUNC_MODE_EXISTING);
|
||||
if (us.filestream==NULL)
|
||||
return NULL;
|
||||
|
||||
@ -432,7 +423,7 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
if (ZSEEK(us.z_filefunc, us.filestream,
|
||||
central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
/* the signature, already checked */
|
||||
@ -456,8 +447,8 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
if ((number_entry_CD!=us.gi.number_entry) ||
|
||||
(number_disk_with_CD!=0) ||
|
||||
(number_disk!=0))
|
||||
(number_disk_with_CD!=0) ||
|
||||
(number_disk!=0))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
/* size of the central directory */
|
||||
@ -474,17 +465,16 @@ extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
|
||||
(err==UNZ_OK))
|
||||
(err==UNZ_OK))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if (err!=UNZ_OK)
|
||||
{
|
||||
if (err!=UNZ_OK) {
|
||||
ZCLOSE(us.z_filefunc, us.filestream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
us.byte_before_the_zipfile = central_pos -
|
||||
(us.offset_central_dir+us.size_central_dir);
|
||||
(us.offset_central_dir+us.size_central_dir);
|
||||
us.central_pos = central_pos;
|
||||
us.pfile_in_zip_read = NULL;
|
||||
us.encrypted = 0;
|
||||
@ -531,7 +521,7 @@ extern int ZEXPORT unzClose (file)
|
||||
return UNZ_OK if there is no problem. */
|
||||
extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
|
||||
unzFile file;
|
||||
unz_global_info *pglobal_info;
|
||||
unz_global_info *pglobal_info;
|
||||
{
|
||||
unz_s* s;
|
||||
if (file==NULL)
|
||||
@ -546,8 +536,8 @@ extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
|
||||
Translate date/time from Dos format to tm_unz (readable more easilty)
|
||||
*/
|
||||
local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
|
||||
uLong ulDosDate;
|
||||
tm_unz* ptm;
|
||||
uLong ulDosDate;
|
||||
tm_unz* ptm;
|
||||
{
|
||||
uLong uDate;
|
||||
uDate = (uLong)(ulDosDate>>16);
|
||||
@ -564,31 +554,31 @@ local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
|
||||
Get Info about the current file in the zipfile, with internal only info
|
||||
*/
|
||||
local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
unz_file_info_internal
|
||||
*pfile_info_internal,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
unz_file_info *pfile_info,
|
||||
unz_file_info_internal
|
||||
*pfile_info_internal,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
|
||||
local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
pfile_info,
|
||||
pfile_info_internal,
|
||||
szFileName, fileNameBufferSize,
|
||||
extraField, extraFieldBufferSize,
|
||||
szComment, commentBufferSize)
|
||||
unzFile file;
|
||||
unz_file_info *pfile_info;
|
||||
unz_file_info_internal *pfile_info_internal;
|
||||
char *szFileName;
|
||||
uLong fileNameBufferSize;
|
||||
void *extraField;
|
||||
uLong extraFieldBufferSize;
|
||||
char *szComment;
|
||||
uLong commentBufferSize;
|
||||
pfile_info,
|
||||
pfile_info_internal,
|
||||
szFileName, fileNameBufferSize,
|
||||
extraField, extraFieldBufferSize,
|
||||
szComment, commentBufferSize)
|
||||
unzFile file;
|
||||
unz_file_info *pfile_info;
|
||||
unz_file_info_internal *pfile_info_internal;
|
||||
char *szFileName;
|
||||
uLong fileNameBufferSize;
|
||||
void *extraField;
|
||||
uLong extraFieldBufferSize;
|
||||
char *szComment;
|
||||
uLong commentBufferSize;
|
||||
{
|
||||
unz_s* s;
|
||||
unz_file_info file_info;
|
||||
@ -607,13 +597,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
|
||||
|
||||
/* we check the magic */
|
||||
if (err==UNZ_OK)
|
||||
{
|
||||
if (err==UNZ_OK) {
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
else if (uMagic!=0x02014b50)
|
||||
err=UNZ_BADZIPFILE;
|
||||
}
|
||||
}
|
||||
|
||||
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
@ -663,15 +652,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
lSeek+=file_info.size_filename;
|
||||
if ((err==UNZ_OK) && (szFileName!=NULL))
|
||||
{
|
||||
if ((err==UNZ_OK) && (szFileName!=NULL)) {
|
||||
uLong uSizeRead ;
|
||||
if (file_info.size_filename<fileNameBufferSize)
|
||||
{
|
||||
if (file_info.size_filename<fileNameBufferSize) {
|
||||
*(szFileName+file_info.size_filename)='\0';
|
||||
uSizeRead = file_info.size_filename;
|
||||
}
|
||||
else
|
||||
} else
|
||||
uSizeRead = fileNameBufferSize;
|
||||
|
||||
if ((file_info.size_filename>0) && (fileNameBufferSize>0))
|
||||
@ -681,56 +667,48 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
}
|
||||
|
||||
|
||||
if ((err==UNZ_OK) && (extraField!=NULL))
|
||||
{
|
||||
if ((err==UNZ_OK) && (extraField!=NULL)) {
|
||||
uLong uSizeRead ;
|
||||
if (file_info.size_file_extra<extraFieldBufferSize)
|
||||
uSizeRead = file_info.size_file_extra;
|
||||
else
|
||||
uSizeRead = extraFieldBufferSize;
|
||||
|
||||
if (lSeek!=0)
|
||||
{
|
||||
if (lSeek!=0) {
|
||||
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||
lSeek=0;
|
||||
else
|
||||
err=UNZ_ERRNO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
||||
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
|
||||
err=UNZ_ERRNO;
|
||||
lSeek += file_info.size_file_extra - uSizeRead;
|
||||
}
|
||||
else
|
||||
} else
|
||||
lSeek+=file_info.size_file_extra;
|
||||
|
||||
|
||||
if ((err==UNZ_OK) && (szComment!=NULL))
|
||||
{
|
||||
if ((err==UNZ_OK) && (szComment!=NULL)) {
|
||||
uLong uSizeRead ;
|
||||
if (file_info.size_file_comment<commentBufferSize)
|
||||
{
|
||||
if (file_info.size_file_comment<commentBufferSize) {
|
||||
*(szComment+file_info.size_file_comment)='\0';
|
||||
uSizeRead = file_info.size_file_comment;
|
||||
}
|
||||
else
|
||||
} else
|
||||
uSizeRead = commentBufferSize;
|
||||
|
||||
if (lSeek!=0)
|
||||
{
|
||||
if (lSeek!=0) {
|
||||
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
|
||||
lSeek=0;
|
||||
else
|
||||
err=UNZ_ERRNO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
||||
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
|
||||
err=UNZ_ERRNO;
|
||||
lSeek+=file_info.size_file_comment - uSizeRead;
|
||||
}
|
||||
else
|
||||
} else
|
||||
lSeek+=file_info.size_file_comment;
|
||||
|
||||
if ((err==UNZ_OK) && (pfile_info!=NULL))
|
||||
@ -750,23 +728,23 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
|
||||
return UNZ_OK if there is no problem.
|
||||
*/
|
||||
extern int ZEXPORT unzGetCurrentFileInfo (file,
|
||||
pfile_info,
|
||||
szFileName, fileNameBufferSize,
|
||||
extraField, extraFieldBufferSize,
|
||||
szComment, commentBufferSize)
|
||||
pfile_info,
|
||||
szFileName, fileNameBufferSize,
|
||||
extraField, extraFieldBufferSize,
|
||||
szComment, commentBufferSize)
|
||||
unzFile file;
|
||||
unz_file_info *pfile_info;
|
||||
char *szFileName;
|
||||
uLong fileNameBufferSize;
|
||||
void *extraField;
|
||||
uLong extraFieldBufferSize;
|
||||
char *szComment;
|
||||
uLong commentBufferSize;
|
||||
unz_file_info *pfile_info;
|
||||
char *szFileName;
|
||||
uLong fileNameBufferSize;
|
||||
void *extraField;
|
||||
uLong extraFieldBufferSize;
|
||||
char *szComment;
|
||||
uLong commentBufferSize;
|
||||
{
|
||||
return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
|
||||
szFileName,fileNameBufferSize,
|
||||
extraField,extraFieldBufferSize,
|
||||
szComment,commentBufferSize);
|
||||
szFileName,fileNameBufferSize,
|
||||
extraField,extraFieldBufferSize,
|
||||
szComment,commentBufferSize);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -784,8 +762,8 @@ extern int ZEXPORT unzGoToFirstFile (file)
|
||||
s->pos_in_central_dir=s->offset_central_dir;
|
||||
s->num_file=0;
|
||||
err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
s->current_file_ok = (err == UNZ_OK);
|
||||
return err;
|
||||
}
|
||||
@ -807,15 +785,15 @@ extern int ZEXPORT unzGoToNextFile (file)
|
||||
if (!s->current_file_ok)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
|
||||
if (s->num_file+1==s->gi.number_entry)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
if (s->num_file+1==s->gi.number_entry)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
|
||||
s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
|
||||
s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
|
||||
s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
|
||||
s->num_file++;
|
||||
err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
s->current_file_ok = (err == UNZ_OK);
|
||||
return err;
|
||||
}
|
||||
@ -831,8 +809,8 @@ extern int ZEXPORT unzGoToNextFile (file)
|
||||
*/
|
||||
extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
|
||||
unzFile file;
|
||||
const char *szFileName;
|
||||
int iCaseSensitivity;
|
||||
const char *szFileName;
|
||||
int iCaseSensitivity;
|
||||
{
|
||||
unz_s* s;
|
||||
int err;
|
||||
@ -864,16 +842,14 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
|
||||
|
||||
err = unzGoToFirstFile(file);
|
||||
|
||||
while (err == UNZ_OK)
|
||||
{
|
||||
while (err == UNZ_OK) {
|
||||
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
|
||||
err = unzGetCurrentFileInfo(file,NULL,
|
||||
szCurrentFileName,sizeof(szCurrentFileName)-1,
|
||||
NULL,0,NULL,0);
|
||||
if (err == UNZ_OK)
|
||||
{
|
||||
if (err == UNZ_OK) {
|
||||
if (unzStringFileNameCompare(szCurrentFileName,
|
||||
szFileName,iCaseSensitivity)==0)
|
||||
szFileName,iCaseSensitivity)==0)
|
||||
return UNZ_OK;
|
||||
err = unzGoToNextFile(file);
|
||||
}
|
||||
@ -910,7 +886,7 @@ typedef struct unz_file_pos_s
|
||||
|
||||
extern int ZEXPORT unzGetFilePos(file, file_pos)
|
||||
unzFile file;
|
||||
unz_file_pos* file_pos;
|
||||
unz_file_pos* file_pos;
|
||||
{
|
||||
unz_s* s;
|
||||
|
||||
@ -928,7 +904,7 @@ extern int ZEXPORT unzGetFilePos(file, file_pos)
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos(file, file_pos)
|
||||
unzFile file;
|
||||
unz_file_pos* file_pos;
|
||||
unz_file_pos* file_pos;
|
||||
{
|
||||
unz_s* s;
|
||||
int err;
|
||||
@ -943,8 +919,8 @@ extern int ZEXPORT unzGoToFilePos(file, file_pos)
|
||||
|
||||
/* set the current file */
|
||||
err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
/* return results */
|
||||
s->current_file_ok = (err == UNZ_OK);
|
||||
return err;
|
||||
@ -963,12 +939,12 @@ extern int ZEXPORT unzGoToFilePos(file, file_pos)
|
||||
(filename and size of extra field data)
|
||||
*/
|
||||
local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
poffset_local_extrafield,
|
||||
psize_local_extrafield)
|
||||
unz_s* s;
|
||||
uInt* piSizeVar;
|
||||
uLong *poffset_local_extrafield;
|
||||
uInt *psize_local_extrafield;
|
||||
poffset_local_extrafield,
|
||||
psize_local_extrafield)
|
||||
unz_s* s;
|
||||
uInt* piSizeVar;
|
||||
uLong *poffset_local_extrafield;
|
||||
uInt *psize_local_extrafield;
|
||||
{
|
||||
uLong uMagic,uData,uFlags;
|
||||
uLong size_filename;
|
||||
@ -980,24 +956,23 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
*psize_local_extrafield = 0;
|
||||
|
||||
if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
|
||||
s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
return UNZ_ERRNO;
|
||||
|
||||
|
||||
if (err==UNZ_OK)
|
||||
{
|
||||
if (err==UNZ_OK) {
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
else if (uMagic!=0x04034b50)
|
||||
err=UNZ_BADZIPFILE;
|
||||
}
|
||||
}
|
||||
|
||||
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
/*
|
||||
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
|
||||
err=UNZ_BADZIPFILE;
|
||||
*/
|
||||
/*
|
||||
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
|
||||
err=UNZ_BADZIPFILE;
|
||||
*/
|
||||
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
@ -1007,7 +982,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
|
||||
(s->cur_file_info.compression_method!=Z_DEFLATED))
|
||||
(s->cur_file_info.compression_method!=Z_DEFLATED))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
|
||||
@ -1016,19 +991,19 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
|
||||
err=UNZ_ERRNO;
|
||||
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
|
||||
((uFlags & 8)==0))
|
||||
((uFlags & 8)==0))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
|
||||
err=UNZ_ERRNO;
|
||||
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
|
||||
((uFlags & 8)==0))
|
||||
((uFlags & 8)==0))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
|
||||
err=UNZ_ERRNO;
|
||||
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
|
||||
((uFlags & 8)==0))
|
||||
((uFlags & 8)==0))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
|
||||
@ -1042,7 +1017,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
*poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
|
||||
SIZEZIPLOCALHEADER + size_filename;
|
||||
SIZEZIPLOCALHEADER + size_filename;
|
||||
*psize_local_extrafield = (uInt)size_extra_field;
|
||||
|
||||
*piSizeVar += (uInt)size_extra_field;
|
||||
@ -1056,10 +1031,10 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
|
||||
*/
|
||||
extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
unzFile file;
|
||||
int* method;
|
||||
int* level;
|
||||
int raw;
|
||||
const char* password;
|
||||
int* method;
|
||||
int* level;
|
||||
int raw;
|
||||
const char* password;
|
||||
{
|
||||
int err=UNZ_OK;
|
||||
uInt iSizeVar;
|
||||
@ -1084,11 +1059,11 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
unzCloseCurrentFile(file);
|
||||
|
||||
if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
|
||||
&offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
|
||||
&offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
|
||||
return UNZ_BADZIPFILE;
|
||||
|
||||
pfile_in_zip_read_info = (file_in_zip_read_info_s*)
|
||||
ALLOC(sizeof(file_in_zip_read_info_s));
|
||||
ALLOC(sizeof(file_in_zip_read_info_s));
|
||||
if (pfile_in_zip_read_info==NULL)
|
||||
return UNZ_INTERNALERROR;
|
||||
|
||||
@ -1098,8 +1073,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
pfile_in_zip_read_info->pos_local_extrafield=0;
|
||||
pfile_in_zip_read_info->raw=raw;
|
||||
|
||||
if (pfile_in_zip_read_info->read_buffer==NULL)
|
||||
{
|
||||
if (pfile_in_zip_read_info->read_buffer==NULL) {
|
||||
TRYFREE(pfile_in_zip_read_info);
|
||||
return UNZ_INTERNALERROR;
|
||||
}
|
||||
@ -1109,25 +1083,29 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
if (method!=NULL)
|
||||
*method = (int)s->cur_file_info.compression_method;
|
||||
|
||||
if (level!=NULL)
|
||||
{
|
||||
if (level!=NULL) {
|
||||
*level = 6;
|
||||
switch (s->cur_file_info.flag & 0x06)
|
||||
{
|
||||
case 6 : *level = 1; break;
|
||||
case 4 : *level = 2; break;
|
||||
case 2 : *level = 9; break;
|
||||
switch (s->cur_file_info.flag & 0x06) {
|
||||
case 6 :
|
||||
*level = 1;
|
||||
break;
|
||||
case 4 :
|
||||
*level = 2;
|
||||
break;
|
||||
case 2 :
|
||||
*level = 9;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s->cur_file_info.compression_method!=0) &&
|
||||
(s->cur_file_info.compression_method!=Z_DEFLATED))
|
||||
(s->cur_file_info.compression_method!=Z_DEFLATED))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
|
||||
pfile_in_zip_read_info->crc32=0;
|
||||
pfile_in_zip_read_info->compression_method =
|
||||
s->cur_file_info.compression_method;
|
||||
s->cur_file_info.compression_method;
|
||||
pfile_in_zip_read_info->filestream=s->filestream;
|
||||
pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
|
||||
pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
|
||||
@ -1135,22 +1113,20 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
pfile_in_zip_read_info->stream.total_out = 0;
|
||||
|
||||
if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
|
||||
(!raw))
|
||||
{
|
||||
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
|
||||
pfile_in_zip_read_info->stream.zfree = (free_func)0;
|
||||
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
|
||||
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
|
||||
pfile_in_zip_read_info->stream.avail_in = 0;
|
||||
(!raw)) {
|
||||
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
|
||||
pfile_in_zip_read_info->stream.zfree = (free_func)0;
|
||||
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
|
||||
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
|
||||
pfile_in_zip_read_info->stream.avail_in = 0;
|
||||
|
||||
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
|
||||
if (err == Z_OK)
|
||||
pfile_in_zip_read_info->stream_initialised=1;
|
||||
else
|
||||
{
|
||||
TRYFREE(pfile_in_zip_read_info);
|
||||
return err;
|
||||
}
|
||||
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
|
||||
if (err == Z_OK)
|
||||
pfile_in_zip_read_info->stream_initialised=1;
|
||||
else {
|
||||
TRYFREE(pfile_in_zip_read_info);
|
||||
return err;
|
||||
}
|
||||
/* windowBits is passed < 0 to tell that there is no zlib header.
|
||||
* Note that in this case inflate *requires* an extra "dummy" byte
|
||||
* after the compressed stream in order to complete decompression and
|
||||
@ -1160,31 +1136,30 @@ extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
|
||||
*/
|
||||
}
|
||||
pfile_in_zip_read_info->rest_read_compressed =
|
||||
s->cur_file_info.compressed_size ;
|
||||
s->cur_file_info.compressed_size ;
|
||||
pfile_in_zip_read_info->rest_read_uncompressed =
|
||||
s->cur_file_info.uncompressed_size ;
|
||||
s->cur_file_info.uncompressed_size ;
|
||||
|
||||
|
||||
pfile_in_zip_read_info->pos_in_zipfile =
|
||||
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
|
||||
iSizeVar;
|
||||
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
|
||||
iSizeVar;
|
||||
|
||||
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
|
||||
|
||||
s->pfile_in_zip_read = pfile_in_zip_read_info;
|
||||
|
||||
# ifndef NOUNCRYPT
|
||||
if (password != NULL)
|
||||
{
|
||||
if (password != NULL) {
|
||||
int i;
|
||||
s->pcrc_32_tab = get_crc_table();
|
||||
init_keys(password,s->keys,s->pcrc_32_tab);
|
||||
if (ZSEEK(s->z_filefunc, s->filestream,
|
||||
s->pfile_in_zip_read->pos_in_zipfile +
|
||||
s->pfile_in_zip_read->byte_before_the_zipfile,
|
||||
s->pfile_in_zip_read->byte_before_the_zipfile,
|
||||
SEEK_SET)!=0)
|
||||
return UNZ_INTERNALERROR;
|
||||
if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
|
||||
if (ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
|
||||
return UNZ_INTERNALERROR;
|
||||
|
||||
for (i = 0; i<12; i++)
|
||||
@ -1207,16 +1182,16 @@ extern int ZEXPORT unzOpenCurrentFile (file)
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
|
||||
unzFile file;
|
||||
const char* password;
|
||||
const char* password;
|
||||
{
|
||||
return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
|
||||
}
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
|
||||
unzFile file;
|
||||
int* method;
|
||||
int* level;
|
||||
int raw;
|
||||
int* method;
|
||||
int* level;
|
||||
int raw;
|
||||
{
|
||||
return unzOpenCurrentFile3(file, method, level, raw, NULL);
|
||||
}
|
||||
@ -1233,8 +1208,8 @@ extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
|
||||
*/
|
||||
extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
unzFile file;
|
||||
voidp buf;
|
||||
unsigned len;
|
||||
voidp buf;
|
||||
unsigned len;
|
||||
{
|
||||
int err=UNZ_OK;
|
||||
uInt iRead = 0;
|
||||
@ -1259,22 +1234,20 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
pfile_in_zip_read_info->stream.avail_out = (uInt)len;
|
||||
|
||||
if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
|
||||
(!(pfile_in_zip_read_info->raw)))
|
||||
(!(pfile_in_zip_read_info->raw)))
|
||||
pfile_in_zip_read_info->stream.avail_out =
|
||||
(uInt)pfile_in_zip_read_info->rest_read_uncompressed;
|
||||
|
||||
if ((len>pfile_in_zip_read_info->rest_read_compressed+
|
||||
pfile_in_zip_read_info->stream.avail_in) &&
|
||||
(pfile_in_zip_read_info->raw))
|
||||
pfile_in_zip_read_info->stream.avail_in) &&
|
||||
(pfile_in_zip_read_info->raw))
|
||||
pfile_in_zip_read_info->stream.avail_out =
|
||||
(uInt)pfile_in_zip_read_info->rest_read_compressed+
|
||||
pfile_in_zip_read_info->stream.avail_in;
|
||||
|
||||
while (pfile_in_zip_read_info->stream.avail_out>0)
|
||||
{
|
||||
while (pfile_in_zip_read_info->stream.avail_out>0) {
|
||||
if ((pfile_in_zip_read_info->stream.avail_in==0) &&
|
||||
(pfile_in_zip_read_info->rest_read_compressed>0))
|
||||
{
|
||||
(pfile_in_zip_read_info->rest_read_compressed>0)) {
|
||||
uInt uReadThis = UNZ_BUFSIZE;
|
||||
if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
|
||||
uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
|
||||
@ -1283,8 +1256,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
|
||||
pfile_in_zip_read_info->filestream,
|
||||
pfile_in_zip_read_info->pos_in_zipfile +
|
||||
pfile_in_zip_read_info->byte_before_the_zipfile,
|
||||
ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
pfile_in_zip_read_info->byte_before_the_zipfile,
|
||||
ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
return UNZ_ERRNO;
|
||||
if (ZREAD(pfile_in_zip_read_info->z_filefunc,
|
||||
pfile_in_zip_read_info->filestream,
|
||||
@ -1294,13 +1267,12 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
|
||||
|
||||
# ifndef NOUNCRYPT
|
||||
if(s->encrypted)
|
||||
{
|
||||
if (s->encrypted) {
|
||||
uInt i;
|
||||
for(i=0;i<uReadThis;i++)
|
||||
pfile_in_zip_read_info->read_buffer[i] =
|
||||
zdecode(s->keys,s->pcrc_32_tab,
|
||||
pfile_in_zip_read_info->read_buffer[i]);
|
||||
for (i=0;i<uReadThis;i++)
|
||||
pfile_in_zip_read_info->read_buffer[i] =
|
||||
zdecode(s->keys,s->pcrc_32_tab,
|
||||
pfile_in_zip_read_info->read_buffer[i]);
|
||||
}
|
||||
# endif
|
||||
|
||||
@ -1314,27 +1286,26 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
|
||||
}
|
||||
|
||||
if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
|
||||
{
|
||||
if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) {
|
||||
uInt uDoCopy,i ;
|
||||
|
||||
if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
|
||||
(pfile_in_zip_read_info->rest_read_compressed == 0))
|
||||
(pfile_in_zip_read_info->rest_read_compressed == 0))
|
||||
return (iRead==0) ? UNZ_EOF : iRead;
|
||||
|
||||
if (pfile_in_zip_read_info->stream.avail_out <
|
||||
pfile_in_zip_read_info->stream.avail_in)
|
||||
pfile_in_zip_read_info->stream.avail_in)
|
||||
uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
|
||||
else
|
||||
uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
|
||||
|
||||
for (i=0;i<uDoCopy;i++)
|
||||
*(pfile_in_zip_read_info->stream.next_out+i) =
|
||||
*(pfile_in_zip_read_info->stream.next_in+i);
|
||||
*(pfile_in_zip_read_info->stream.next_in+i);
|
||||
|
||||
pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
|
||||
pfile_in_zip_read_info->stream.next_out,
|
||||
uDoCopy);
|
||||
pfile_in_zip_read_info->stream.next_out,
|
||||
uDoCopy);
|
||||
pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
|
||||
pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
|
||||
pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
|
||||
@ -1342,9 +1313,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
pfile_in_zip_read_info->stream.next_in += uDoCopy;
|
||||
pfile_in_zip_read_info->stream.total_out += uDoCopy;
|
||||
iRead += uDoCopy;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
uLong uTotalOutBefore,uTotalOutAfter;
|
||||
const Bytef *bufBefore;
|
||||
uLong uOutThis;
|
||||
@ -1362,14 +1331,14 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
|
||||
err=inflate(&pfile_in_zip_read_info->stream,flush);
|
||||
|
||||
if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
|
||||
err = Z_DATA_ERROR;
|
||||
err = Z_DATA_ERROR;
|
||||
|
||||
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
|
||||
uOutThis = uTotalOutAfter-uTotalOutBefore;
|
||||
|
||||
pfile_in_zip_read_info->crc32 =
|
||||
crc32(pfile_in_zip_read_info->crc32,bufBefore,
|
||||
(uInt)(uOutThis));
|
||||
(uInt)(uOutThis));
|
||||
|
||||
pfile_in_zip_read_info->rest_read_uncompressed -=
|
||||
uOutThis;
|
||||
@ -1447,8 +1416,8 @@ extern int ZEXPORT unzeof (file)
|
||||
*/
|
||||
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
|
||||
unzFile file;
|
||||
voidp buf;
|
||||
unsigned len;
|
||||
voidp buf;
|
||||
unsigned len;
|
||||
{
|
||||
unz_s* s;
|
||||
file_in_zip_read_info_s* pfile_in_zip_read_info;
|
||||
@ -1464,7 +1433,7 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
|
||||
return UNZ_PARAMERROR;
|
||||
|
||||
size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
|
||||
pfile_in_zip_read_info->pos_local_extrafield);
|
||||
pfile_in_zip_read_info->pos_local_extrafield);
|
||||
|
||||
if (buf==NULL)
|
||||
return (int)size_to_read;
|
||||
@ -1513,8 +1482,7 @@ extern int ZEXPORT unzCloseCurrentFile (file)
|
||||
|
||||
|
||||
if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
|
||||
(!pfile_in_zip_read_info->raw))
|
||||
{
|
||||
(!pfile_in_zip_read_info->raw)) {
|
||||
if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
|
||||
err=UNZ_CRCERROR;
|
||||
}
|
||||
@ -1541,8 +1509,8 @@ extern int ZEXPORT unzCloseCurrentFile (file)
|
||||
*/
|
||||
extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
|
||||
unzFile file;
|
||||
char *szComment;
|
||||
uLong uSizeBuf;
|
||||
char *szComment;
|
||||
uLong uSizeBuf;
|
||||
{
|
||||
unz_s* s;
|
||||
uLong uReadThis ;
|
||||
@ -1557,11 +1525,10 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
|
||||
if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
|
||||
return UNZ_ERRNO;
|
||||
|
||||
if (uReadThis>0)
|
||||
{
|
||||
*szComment='\0';
|
||||
if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
|
||||
return UNZ_ERRNO;
|
||||
if (uReadThis>0) {
|
||||
*szComment='\0';
|
||||
if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
|
||||
return UNZ_ERRNO;
|
||||
}
|
||||
|
||||
if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
|
||||
@ -1576,19 +1543,19 @@ extern uLong ZEXPORT unzGetOffset (file)
|
||||
unz_s* s;
|
||||
|
||||
if (file==NULL)
|
||||
return UNZ_PARAMERROR;
|
||||
return UNZ_PARAMERROR;
|
||||
s=(unz_s*)file;
|
||||
if (!s->current_file_ok)
|
||||
return 0;
|
||||
return 0;
|
||||
if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
|
||||
if (s->num_file==s->gi.number_entry)
|
||||
return 0;
|
||||
if (s->num_file==s->gi.number_entry)
|
||||
return 0;
|
||||
return s->pos_in_central_dir;
|
||||
}
|
||||
|
||||
extern int ZEXPORT unzSetOffset (file, pos)
|
||||
unzFile file;
|
||||
uLong pos;
|
||||
unzFile file;
|
||||
uLong pos;
|
||||
{
|
||||
unz_s* s;
|
||||
int err;
|
||||
@ -1600,8 +1567,8 @@ extern int ZEXPORT unzSetOffset (file, pos)
|
||||
s->pos_in_central_dir = pos;
|
||||
s->num_file = s->gi.number_entry; /* hack */
|
||||
err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
&s->cur_file_info_internal,
|
||||
NULL,0,NULL,0,NULL,0);
|
||||
s->current_file_ok = (err == UNZ_OK);
|
||||
return err;
|
||||
}
|
||||
|
@ -58,12 +58,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ {
|
||||
int unused;
|
||||
} unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
#else
|
||||
typedef voidp unzFile;
|
||||
typedef voidp unzFile;
|
||||
#endif
|
||||
|
||||
|
||||
@ -76,274 +78,270 @@ typedef voidp unzFile;
|
||||
#define UNZ_INTERNALERROR (-104)
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s {
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
uLong number_entry; /* total number of entries in
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info_s {
|
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info_s {
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Compare two filename (fileName1,fileName2).
|
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||
or strcasecmp)
|
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||
(like 1 on Unix, 2 on Windows)
|
||||
*/
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Compare two filename (fileName1,fileName2).
|
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||
or strcasecmp)
|
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||
(like 1 on Unix, 2 on Windows)
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example,
|
||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||
"zlib/zlib113.zip".
|
||||
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
*/
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example,
|
||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||
"zlib/zlib113.zip".
|
||||
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
*/
|
||||
|
||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzClose OF((unzFile file));
|
||||
/*
|
||||
Close a ZipFile opened with unzipOpen.
|
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||
return UNZ_OK if there is no problem. */
|
||||
extern int ZEXPORT unzClose OF((unzFile file));
|
||||
/*
|
||||
Close a ZipFile opened with unzipOpen.
|
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||
unz_global_info *pglobal_info));
|
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem. */
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||
unz_global_info *pglobal_info));
|
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||
char *szComment,
|
||||
uLong uSizeBuf));
|
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||
char *szComment,
|
||||
uLong uSizeBuf));
|
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Unzip package allow you browse the directory of the zipfile */
|
||||
/***************************************************************************/
|
||||
/* Unzip package allow you browse the directory of the zipfile */
|
||||
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Try locate the file szFileName in the zipfile.
|
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Try locate the file szFileName in the zipfile.
|
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
|
||||
|
||||
/* ****************************************** */
|
||||
/* Ryan supplied functions */
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_pos_s
|
||||
{
|
||||
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||
uLong num_of_file; /* # of file */
|
||||
} unz_file_pos;
|
||||
/* ****************************************** */
|
||||
/* Ryan supplied functions */
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_pos_s {
|
||||
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||
uLong num_of_file; /* # of file */
|
||||
} unz_file_pos;
|
||||
|
||||
extern int ZEXPORT unzGetFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
extern int ZEXPORT unzGetFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
extern int ZEXPORT unzGoToFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
/* ****************************************** */
|
||||
/* ****************************************** */
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
/*
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
*/
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
/*
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
*/
|
||||
|
||||
/***************************************************************************/
|
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file)
|
||||
*/
|
||||
/***************************************************************************/
|
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
||||
const char* password));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
password is a crypting password
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
||||
const char* password));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
password is a crypting password
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw,
|
||||
const char* password));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw,
|
||||
const char* password));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||
buf contain buffer where data must be copied
|
||||
len the size of buf.
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||
buf contain buffer where data must be copied
|
||||
len the size of buf.
|
||||
|
||||
return the number of byte copied if somes bytes are copied
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
return the number of byte copied if somes bytes are copied
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzeof OF((unzFile file));
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
extern int ZEXPORT unzeof OF((unzFile file));
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
|
||||
if buf==NULL, it return the size of the local extra field
|
||||
if buf==NULL, it return the size of the local extra field
|
||||
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
|
||||
/* Get the current file offset */
|
||||
extern uLong ZEXPORT unzGetOffset (unzFile file);
|
||||
/* Get the current file offset */
|
||||
extern uLong ZEXPORT unzGetOffset (unzFile file);
|
||||
|
||||
/* Set the current file offset */
|
||||
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
||||
/* Set the current file offset */
|
||||
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
||||
|
||||
|
||||
|
||||
|
@ -11,92 +11,85 @@
|
||||
|
||||
/** Alternate dolloader made by WiiPower modified by dimok **/
|
||||
|
||||
bool Load_Dol(void **buffer, int* dollen, char * filepath)
|
||||
{
|
||||
int ret;
|
||||
FILE* file;
|
||||
void* dol_buffer;
|
||||
bool Load_Dol(void **buffer, int* dollen, char * filepath) {
|
||||
int ret;
|
||||
FILE* file;
|
||||
void* dol_buffer;
|
||||
|
||||
char fullpath[200];
|
||||
char gameidbuffer6[7];
|
||||
memset(gameidbuffer6, 0, 7);
|
||||
memcpy(gameidbuffer6, (char*)0x80000000, 6);
|
||||
snprintf(fullpath, 200, "%s%s.dol", filepath, gameidbuffer6);
|
||||
char fullpath[200];
|
||||
char gameidbuffer6[7];
|
||||
memset(gameidbuffer6, 0, 7);
|
||||
memcpy(gameidbuffer6, (char*)0x80000000, 6);
|
||||
snprintf(fullpath, 200, "%s%s.dol", filepath, gameidbuffer6);
|
||||
|
||||
SDCard_Init();
|
||||
USBDevice_Init();
|
||||
|
||||
file = fopen(fullpath, "rb");
|
||||
file = fopen(fullpath, "rb");
|
||||
|
||||
if(file == NULL)
|
||||
{
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
if (file == NULL) {
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
|
||||
int filesize;
|
||||
fseek(file, 0, SEEK_END);
|
||||
filesize = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
int filesize;
|
||||
fseek(file, 0, SEEK_END);
|
||||
filesize = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
dol_buffer = malloc(filesize);
|
||||
if (dol_buffer == NULL)
|
||||
{
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
ret = fread( dol_buffer, 1, filesize, file);
|
||||
if(ret != filesize)
|
||||
{
|
||||
free(dol_buffer);
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
fclose(file);
|
||||
dol_buffer = malloc(filesize);
|
||||
if (dol_buffer == NULL) {
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
ret = fread( dol_buffer, 1, filesize, file);
|
||||
if (ret != filesize) {
|
||||
free(dol_buffer);
|
||||
fclose(file);
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
return false;
|
||||
}
|
||||
fclose(file);
|
||||
|
||||
SDCard_deInit();
|
||||
SDCard_deInit();
|
||||
USBDevice_deInit();
|
||||
*buffer = dol_buffer;
|
||||
*dollen = filesize;
|
||||
return true;
|
||||
*buffer = dol_buffer;
|
||||
*dollen = filesize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Remove_001_Protection(void *Address, int Size)
|
||||
{
|
||||
u8 SearchPattern[16] = { 0x40, 0x82, 0x00, 0x0C, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
u8 PatchData[16] = { 0x40, 0x82, 0x00, 0x04, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
bool Remove_001_Protection(void *Address, int Size) {
|
||||
u8 SearchPattern[16] = { 0x40, 0x82, 0x00, 0x0C, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
u8 PatchData[16] = { 0x40, 0x82, 0x00, 0x04, 0x38, 0x60, 0x00, 0x01, 0x48, 0x00, 0x02, 0x44, 0x38, 0x61, 0x00, 0x18 };
|
||||
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
|
||||
while(Addr <= Addr_end-sizeof(SearchPattern))
|
||||
{
|
||||
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
|
||||
{
|
||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||
return true;
|
||||
}
|
||||
Addr += 4;
|
||||
}
|
||||
return false;
|
||||
while (Addr <= Addr_end-sizeof(SearchPattern)) {
|
||||
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0) {
|
||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||
return true;
|
||||
}
|
||||
Addr += 4;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef struct _dolheader {
|
||||
u32 text_pos[7];
|
||||
u32 data_pos[11];
|
||||
u32 text_start[7];
|
||||
u32 data_start[11];
|
||||
u32 text_size[7];
|
||||
u32 data_size[11];
|
||||
u32 bss_start;
|
||||
u32 bss_size;
|
||||
u32 entry_point;
|
||||
u32 text_pos[7];
|
||||
u32 data_pos[11];
|
||||
u32 text_start[7];
|
||||
u32 data_start[11];
|
||||
u32 text_size[7];
|
||||
u32 data_size[11];
|
||||
u32 bss_start;
|
||||
u32 bss_size;
|
||||
u32 entry_point;
|
||||
} dolheader;
|
||||
|
||||
static dolheader *dolfile;
|
||||
@ -104,147 +97,129 @@ static dolheader *dolfile;
|
||||
|
||||
u32 load_dol_image(void *dolstart) {
|
||||
|
||||
u32 i;
|
||||
u32 i;
|
||||
|
||||
if (dolstart) {
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for (i = 0; i < 7; i++) {
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
ICInvalidateRange ((void *) dolfile->text_start[i],dolfile->text_size[i]);
|
||||
memmove ((void *) dolfile->text_start[i],dolstart+dolfile->text_pos[i],dolfile->text_size[i]);
|
||||
}
|
||||
if (dolstart) {
|
||||
dolfile = (dolheader *) dolstart;
|
||||
for (i = 0; i < 7; i++) {
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
ICInvalidateRange ((void *) dolfile->text_start[i],dolfile->text_size[i]);
|
||||
memmove ((void *) dolfile->text_start[i],dolstart+dolfile->text_pos[i],dolfile->text_size[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < 11; i++) {
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
memmove ((void *) dolfile->data_start[i],dolstart+dolfile->data_pos[i],dolfile->data_size[i]);
|
||||
DCFlushRangeNoSync ((void *) dolfile->data_start[i],dolfile->data_size[i]);
|
||||
}
|
||||
for (i = 0; i < 11; i++) {
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue;
|
||||
VIDEO_WaitVSync();
|
||||
memmove ((void *) dolfile->data_start[i],dolstart+dolfile->data_pos[i],dolfile->data_size[i]);
|
||||
DCFlushRangeNoSync ((void *) dolfile->data_start[i],dolfile->data_size[i]);
|
||||
}
|
||||
/*
|
||||
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||
memset ((void *) dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size);
|
||||
*/
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
return 0;
|
||||
return dolfile->entry_point;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i;
|
||||
static int phase;
|
||||
|
||||
u32 load_dol_start(void *dolstart)
|
||||
{
|
||||
if (dolstart)
|
||||
{
|
||||
dolfile = (dolheader *)dolstart;
|
||||
u32 load_dol_start(void *dolstart) {
|
||||
if (dolstart) {
|
||||
dolfile = (dolheader *)dolstart;
|
||||
return dolfile->entry_point;
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset((void *)dolfile->bss_start, 0, dolfile->bss_size);
|
||||
DCFlushRange((void *)dolfile->bss_start, dolfile->bss_size);
|
||||
|
||||
phase = 0;
|
||||
i = 0;
|
||||
phase = 0;
|
||||
i = 0;
|
||||
}
|
||||
|
||||
bool load_dol_image_modified(void **offset, u32 *pos, u32 *len)
|
||||
{
|
||||
if (phase == 0)
|
||||
{
|
||||
if (i == 7)
|
||||
{
|
||||
phase = 1;
|
||||
i = 0;
|
||||
} else
|
||||
{
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100))
|
||||
{
|
||||
*offset = 0;
|
||||
*pos = 0;
|
||||
*len = 0;
|
||||
} else
|
||||
{
|
||||
*offset = (void *)dolfile->text_start[i];
|
||||
*pos = dolfile->text_pos[i];
|
||||
*len = dolfile->text_size[i];
|
||||
}
|
||||
i++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
bool load_dol_image_modified(void **offset, u32 *pos, u32 *len) {
|
||||
if (phase == 0) {
|
||||
if (i == 7) {
|
||||
phase = 1;
|
||||
i = 0;
|
||||
} else {
|
||||
if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) {
|
||||
*offset = 0;
|
||||
*pos = 0;
|
||||
*len = 0;
|
||||
} else {
|
||||
*offset = (void *)dolfile->text_start[i];
|
||||
*pos = dolfile->text_pos[i];
|
||||
*len = dolfile->text_size[i];
|
||||
}
|
||||
i++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (phase == 1)
|
||||
{
|
||||
if (i == 11)
|
||||
{
|
||||
phase = 2;
|
||||
return false;
|
||||
}
|
||||
if (phase == 1) {
|
||||
if (i == 11) {
|
||||
phase = 2;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100))
|
||||
{
|
||||
*offset = 0;
|
||||
*pos = 0;
|
||||
*len = 0;
|
||||
} else
|
||||
{
|
||||
*offset = (void *)dolfile->data_start[i];
|
||||
*pos = dolfile->data_pos[i];
|
||||
*len = dolfile->data_size[i];
|
||||
}
|
||||
i++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) {
|
||||
*offset = 0;
|
||||
*pos = 0;
|
||||
*len = 0;
|
||||
} else {
|
||||
*offset = (void *)dolfile->data_start[i];
|
||||
*pos = dolfile->data_pos[i];
|
||||
*len = dolfile->data_size[i];
|
||||
}
|
||||
i++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch)
|
||||
{
|
||||
int ret;
|
||||
void *dol_header;
|
||||
u32 entrypoint;
|
||||
u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch) {
|
||||
int ret;
|
||||
void *dol_header;
|
||||
u32 entrypoint;
|
||||
|
||||
dol_header = memalign(32, sizeof(dolheader));
|
||||
if (dol_header == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
dol_header = memalign(32, sizeof(dolheader));
|
||||
if (dol_header == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = WDVD_Read(dol_header, sizeof(dolheader), (doloffset<<2));
|
||||
ret = WDVD_Read(dol_header, sizeof(dolheader), (doloffset<<2));
|
||||
|
||||
entrypoint = load_dol_start(dol_header);
|
||||
entrypoint = load_dol_start(dol_header);
|
||||
|
||||
if (entrypoint == 0)
|
||||
{
|
||||
free(dol_header);
|
||||
return -1;
|
||||
}
|
||||
if (entrypoint == 0) {
|
||||
free(dol_header);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *offset;
|
||||
u32 pos;
|
||||
u32 len;
|
||||
void *offset;
|
||||
u32 pos;
|
||||
u32 len;
|
||||
|
||||
while (load_dol_image_modified(&offset, &pos, &len))
|
||||
{
|
||||
if (len != 0)
|
||||
{
|
||||
ret = WDVD_Read(offset, len, (doloffset<<2) + pos);
|
||||
while (load_dol_image_modified(&offset, &pos, &len)) {
|
||||
if (len != 0) {
|
||||
ret = WDVD_Read(offset, len, (doloffset<<2) + pos);
|
||||
|
||||
DCFlushRange(offset, len);
|
||||
|
||||
gamepatches(offset, len, videoSelected, patchcountrystring, vipatch);
|
||||
gamepatches(offset, len, videoSelected, patchcountrystring, vipatch);
|
||||
|
||||
DCFlushRange(offset, len);
|
||||
|
||||
Remove_001_Protection(offset, len);
|
||||
}
|
||||
}
|
||||
Remove_001_Protection(offset, len);
|
||||
}
|
||||
}
|
||||
|
||||
free(dol_header);
|
||||
free(dol_header);
|
||||
|
||||
return entrypoint;
|
||||
return entrypoint;
|
||||
}
|
||||
|
@ -2,16 +2,15 @@
|
||||
#define _ALTERNATEDOL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* not the full path is needed here, the path where the dol is */
|
||||
/* not the full path is needed here, the path where the dol is */
|
||||
|
||||
bool Load_Dol(void **buffer, int* dollen, char * path);
|
||||
bool Remove_001_Protection(void *Address, int Size);
|
||||
u32 load_dol_image(void * dolstart);
|
||||
u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch);
|
||||
bool Load_Dol(void **buffer, int* dollen, char * path);
|
||||
bool Remove_001_Protection(void *Address, int Size);
|
||||
u32 load_dol_image(void * dolstart);
|
||||
u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <ogcsys.h>
|
||||
#include <string.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "patches/patchcode.h"
|
||||
#include "patches/kenobiwii.h" /*FISHEARS*/
|
||||
#include "apploader.h"
|
||||
#include "apploader.h"
|
||||
#include "wdvd.h"
|
||||
#include "wpad.h"
|
||||
#include "disc.h"
|
||||
@ -15,14 +15,14 @@
|
||||
/*KENOBI! - FISHEARS*/
|
||||
extern const unsigned char kenobiwii[];
|
||||
extern const int kenobiwii_size;
|
||||
/*KENOBI! - FISHEARS*/
|
||||
|
||||
/* Apploader function pointers */
|
||||
typedef int (*app_main)(void **dst, int *size, int *offset);
|
||||
typedef void (*app_init)(void (*report)(const char *fmt, ...));
|
||||
typedef void *(*app_final)();
|
||||
typedef void (*app_entry)(void (**init)(void (*report)(const char *fmt, ...)), int (**main)(), void *(**final)());
|
||||
|
||||
/*KENOBI! - FISHEARS*/
|
||||
|
||||
/* Apploader function pointers */
|
||||
typedef int (*app_main)(void **dst, int *size, int *offset);
|
||||
typedef void (*app_init)(void (*report)(const char *fmt, ...));
|
||||
typedef void *(*app_final)();
|
||||
typedef void (*app_entry)(void (**init)(void (*report)(const char *fmt, ...)), int (**main)(), void *(**final)());
|
||||
|
||||
/* Apploader pointers */
|
||||
static u8 *appldr = (u8 *)0x81200000;
|
||||
|
||||
@ -34,340 +34,322 @@ static u8 *appldr = (u8 *)0x81200000;
|
||||
static u32 buffer[0x20] ATTRIBUTE_ALIGN(32);
|
||||
struct SSettings Settings;
|
||||
|
||||
static void __noprint(const char *fmt, ...)
|
||||
{
|
||||
static void __noprint(const char *fmt, ...) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool compare_videomodes(GXRModeObj* mode1, GXRModeObj* mode2)
|
||||
{
|
||||
if (mode1->viTVMode != mode2->viTVMode || mode1->fbWidth != mode2->fbWidth || mode1->efbHeight != mode2->efbHeight || mode1->xfbHeight != mode2->xfbHeight ||
|
||||
mode1->viXOrigin != mode2->viXOrigin || mode1->viYOrigin != mode2->viYOrigin || mode1->viWidth != mode2->viWidth || mode1->viHeight != mode2->viHeight ||
|
||||
mode1->xfbMode != mode2->xfbMode || mode1->field_rendering != mode2->field_rendering || mode1->aa != mode2->aa || mode1->sample_pattern[0][0] != mode2->sample_pattern[0][0] ||
|
||||
mode1->sample_pattern[1][0] != mode2->sample_pattern[1][0] || mode1->sample_pattern[2][0] != mode2->sample_pattern[2][0] ||
|
||||
mode1->sample_pattern[3][0] != mode2->sample_pattern[3][0] || mode1->sample_pattern[4][0] != mode2->sample_pattern[4][0] ||
|
||||
mode1->sample_pattern[5][0] != mode2->sample_pattern[5][0] || mode1->sample_pattern[6][0] != mode2->sample_pattern[6][0] ||
|
||||
mode1->sample_pattern[7][0] != mode2->sample_pattern[7][0] || mode1->sample_pattern[8][0] != mode2->sample_pattern[8][0] ||
|
||||
mode1->sample_pattern[9][0] != mode2->sample_pattern[9][0] || mode1->sample_pattern[10][0] != mode2->sample_pattern[10][0] ||
|
||||
mode1->sample_pattern[11][0] != mode2->sample_pattern[11][0] || mode1->sample_pattern[0][1] != mode2->sample_pattern[0][1] ||
|
||||
mode1->sample_pattern[1][1] != mode2->sample_pattern[1][1] || mode1->sample_pattern[2][1] != mode2->sample_pattern[2][1] ||
|
||||
mode1->sample_pattern[3][1] != mode2->sample_pattern[3][1] || mode1->sample_pattern[4][1] != mode2->sample_pattern[4][1] ||
|
||||
mode1->sample_pattern[5][1] != mode2->sample_pattern[5][1] || mode1->sample_pattern[6][1] != mode2->sample_pattern[6][1] ||
|
||||
mode1->sample_pattern[7][1] != mode2->sample_pattern[7][1] || mode1->sample_pattern[8][1] != mode2->sample_pattern[8][1] ||
|
||||
mode1->sample_pattern[9][1] != mode2->sample_pattern[9][1] || mode1->sample_pattern[10][1] != mode2->sample_pattern[10][1] ||
|
||||
mode1->sample_pattern[11][1] != mode2->sample_pattern[11][1] || mode1->vfilter[0] != mode2->vfilter[0] ||
|
||||
mode1->vfilter[1] != mode2->vfilter[1] || mode1->vfilter[2] != mode2->vfilter[2] || mode1->vfilter[3] != mode2->vfilter[3] || mode1->vfilter[4] != mode2->vfilter[4] ||
|
||||
mode1->vfilter[5] != mode2->vfilter[5] || mode1->vfilter[6] != mode2->vfilter[6] )
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool compare_videomodes(GXRModeObj* mode1, GXRModeObj* mode2) {
|
||||
if (mode1->viTVMode != mode2->viTVMode || mode1->fbWidth != mode2->fbWidth || mode1->efbHeight != mode2->efbHeight || mode1->xfbHeight != mode2->xfbHeight ||
|
||||
mode1->viXOrigin != mode2->viXOrigin || mode1->viYOrigin != mode2->viYOrigin || mode1->viWidth != mode2->viWidth || mode1->viHeight != mode2->viHeight ||
|
||||
mode1->xfbMode != mode2->xfbMode || mode1->field_rendering != mode2->field_rendering || mode1->aa != mode2->aa || mode1->sample_pattern[0][0] != mode2->sample_pattern[0][0] ||
|
||||
mode1->sample_pattern[1][0] != mode2->sample_pattern[1][0] || mode1->sample_pattern[2][0] != mode2->sample_pattern[2][0] ||
|
||||
mode1->sample_pattern[3][0] != mode2->sample_pattern[3][0] || mode1->sample_pattern[4][0] != mode2->sample_pattern[4][0] ||
|
||||
mode1->sample_pattern[5][0] != mode2->sample_pattern[5][0] || mode1->sample_pattern[6][0] != mode2->sample_pattern[6][0] ||
|
||||
mode1->sample_pattern[7][0] != mode2->sample_pattern[7][0] || mode1->sample_pattern[8][0] != mode2->sample_pattern[8][0] ||
|
||||
mode1->sample_pattern[9][0] != mode2->sample_pattern[9][0] || mode1->sample_pattern[10][0] != mode2->sample_pattern[10][0] ||
|
||||
mode1->sample_pattern[11][0] != mode2->sample_pattern[11][0] || mode1->sample_pattern[0][1] != mode2->sample_pattern[0][1] ||
|
||||
mode1->sample_pattern[1][1] != mode2->sample_pattern[1][1] || mode1->sample_pattern[2][1] != mode2->sample_pattern[2][1] ||
|
||||
mode1->sample_pattern[3][1] != mode2->sample_pattern[3][1] || mode1->sample_pattern[4][1] != mode2->sample_pattern[4][1] ||
|
||||
mode1->sample_pattern[5][1] != mode2->sample_pattern[5][1] || mode1->sample_pattern[6][1] != mode2->sample_pattern[6][1] ||
|
||||
mode1->sample_pattern[7][1] != mode2->sample_pattern[7][1] || mode1->sample_pattern[8][1] != mode2->sample_pattern[8][1] ||
|
||||
mode1->sample_pattern[9][1] != mode2->sample_pattern[9][1] || mode1->sample_pattern[10][1] != mode2->sample_pattern[10][1] ||
|
||||
mode1->sample_pattern[11][1] != mode2->sample_pattern[11][1] || mode1->vfilter[0] != mode2->vfilter[0] ||
|
||||
mode1->vfilter[1] != mode2->vfilter[1] || mode1->vfilter[2] != mode2->vfilter[2] || mode1->vfilter[3] != mode2->vfilter[3] || mode1->vfilter[4] != mode2->vfilter[4] ||
|
||||
mode1->vfilter[5] != mode2->vfilter[5] || mode1->vfilter[6] != mode2->vfilter[6] ) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2)
|
||||
{
|
||||
mode1->viTVMode = mode2->viTVMode;
|
||||
mode1->fbWidth = mode2->fbWidth;
|
||||
mode1->efbHeight = mode2->efbHeight;
|
||||
mode1->xfbHeight = mode2->xfbHeight;
|
||||
mode1->viXOrigin = mode2->viXOrigin;
|
||||
mode1->viYOrigin = mode2->viYOrigin;
|
||||
mode1->viWidth = mode2->viWidth;
|
||||
mode1->viHeight = mode2->viHeight;
|
||||
mode1->xfbMode = mode2->xfbMode;
|
||||
mode1->field_rendering = mode2->field_rendering;
|
||||
mode1->aa = mode2->aa;
|
||||
mode1->sample_pattern[0][0] = mode2->sample_pattern[0][0];
|
||||
mode1->sample_pattern[1][0] = mode2->sample_pattern[1][0];
|
||||
mode1->sample_pattern[2][0] = mode2->sample_pattern[2][0];
|
||||
mode1->sample_pattern[3][0] = mode2->sample_pattern[3][0];
|
||||
mode1->sample_pattern[4][0] = mode2->sample_pattern[4][0];
|
||||
mode1->sample_pattern[5][0] = mode2->sample_pattern[5][0];
|
||||
mode1->sample_pattern[6][0] = mode2->sample_pattern[6][0];
|
||||
mode1->sample_pattern[7][0] = mode2->sample_pattern[7][0];
|
||||
mode1->sample_pattern[8][0] = mode2->sample_pattern[8][0];
|
||||
mode1->sample_pattern[9][0] = mode2->sample_pattern[9][0];
|
||||
mode1->sample_pattern[10][0] = mode2->sample_pattern[10][0];
|
||||
mode1->sample_pattern[11][0] = mode2->sample_pattern[11][0];
|
||||
mode1->sample_pattern[0][1] = mode2->sample_pattern[0][1];
|
||||
mode1->sample_pattern[1][1] = mode2->sample_pattern[1][1];
|
||||
mode1->sample_pattern[2][1] = mode2->sample_pattern[2][1];
|
||||
mode1->sample_pattern[3][1] = mode2->sample_pattern[3][1];
|
||||
mode1->sample_pattern[4][1] = mode2->sample_pattern[4][1];
|
||||
mode1->sample_pattern[5][1] = mode2->sample_pattern[5][1];
|
||||
mode1->sample_pattern[6][1] = mode2->sample_pattern[6][1];
|
||||
mode1->sample_pattern[7][1] = mode2->sample_pattern[7][1];
|
||||
mode1->sample_pattern[8][1] = mode2->sample_pattern[8][1];
|
||||
mode1->sample_pattern[9][1] = mode2->sample_pattern[9][1];
|
||||
mode1->sample_pattern[10][1] = mode2->sample_pattern[10][1];
|
||||
mode1->sample_pattern[11][1] = mode2->sample_pattern[11][1];
|
||||
mode1->vfilter[0] = mode2->vfilter[0];
|
||||
mode1->vfilter[1] = mode2->vfilter[1];
|
||||
mode1->vfilter[2] = mode2->vfilter[2];
|
||||
mode1->vfilter[3] = mode2->vfilter[3];
|
||||
mode1->vfilter[4] = mode2->vfilter[4];
|
||||
mode1->vfilter[5] = mode2->vfilter[5];
|
||||
mode1->vfilter[6] = mode2->vfilter[6];
|
||||
void patch_videomode(GXRModeObj* mode1, GXRModeObj* mode2) {
|
||||
mode1->viTVMode = mode2->viTVMode;
|
||||
mode1->fbWidth = mode2->fbWidth;
|
||||
mode1->efbHeight = mode2->efbHeight;
|
||||
mode1->xfbHeight = mode2->xfbHeight;
|
||||
mode1->viXOrigin = mode2->viXOrigin;
|
||||
mode1->viYOrigin = mode2->viYOrigin;
|
||||
mode1->viWidth = mode2->viWidth;
|
||||
mode1->viHeight = mode2->viHeight;
|
||||
mode1->xfbMode = mode2->xfbMode;
|
||||
mode1->field_rendering = mode2->field_rendering;
|
||||
mode1->aa = mode2->aa;
|
||||
mode1->sample_pattern[0][0] = mode2->sample_pattern[0][0];
|
||||
mode1->sample_pattern[1][0] = mode2->sample_pattern[1][0];
|
||||
mode1->sample_pattern[2][0] = mode2->sample_pattern[2][0];
|
||||
mode1->sample_pattern[3][0] = mode2->sample_pattern[3][0];
|
||||
mode1->sample_pattern[4][0] = mode2->sample_pattern[4][0];
|
||||
mode1->sample_pattern[5][0] = mode2->sample_pattern[5][0];
|
||||
mode1->sample_pattern[6][0] = mode2->sample_pattern[6][0];
|
||||
mode1->sample_pattern[7][0] = mode2->sample_pattern[7][0];
|
||||
mode1->sample_pattern[8][0] = mode2->sample_pattern[8][0];
|
||||
mode1->sample_pattern[9][0] = mode2->sample_pattern[9][0];
|
||||
mode1->sample_pattern[10][0] = mode2->sample_pattern[10][0];
|
||||
mode1->sample_pattern[11][0] = mode2->sample_pattern[11][0];
|
||||
mode1->sample_pattern[0][1] = mode2->sample_pattern[0][1];
|
||||
mode1->sample_pattern[1][1] = mode2->sample_pattern[1][1];
|
||||
mode1->sample_pattern[2][1] = mode2->sample_pattern[2][1];
|
||||
mode1->sample_pattern[3][1] = mode2->sample_pattern[3][1];
|
||||
mode1->sample_pattern[4][1] = mode2->sample_pattern[4][1];
|
||||
mode1->sample_pattern[5][1] = mode2->sample_pattern[5][1];
|
||||
mode1->sample_pattern[6][1] = mode2->sample_pattern[6][1];
|
||||
mode1->sample_pattern[7][1] = mode2->sample_pattern[7][1];
|
||||
mode1->sample_pattern[8][1] = mode2->sample_pattern[8][1];
|
||||
mode1->sample_pattern[9][1] = mode2->sample_pattern[9][1];
|
||||
mode1->sample_pattern[10][1] = mode2->sample_pattern[10][1];
|
||||
mode1->sample_pattern[11][1] = mode2->sample_pattern[11][1];
|
||||
mode1->vfilter[0] = mode2->vfilter[0];
|
||||
mode1->vfilter[1] = mode2->vfilter[1];
|
||||
mode1->vfilter[2] = mode2->vfilter[2];
|
||||
mode1->vfilter[3] = mode2->vfilter[3];
|
||||
mode1->vfilter[4] = mode2->vfilter[4];
|
||||
mode1->vfilter[5] = mode2->vfilter[5];
|
||||
mode1->vfilter[6] = mode2->vfilter[6];
|
||||
}
|
||||
|
||||
GXRModeObj* vmodes[] = {
|
||||
&TVNtsc240Ds,
|
||||
&TVNtsc240DsAa,
|
||||
&TVNtsc240Int,
|
||||
&TVNtsc240IntAa,
|
||||
&TVNtsc480IntDf,
|
||||
&TVNtsc480IntAa,
|
||||
&TVNtsc480Prog,
|
||||
&TVMpal480IntDf,
|
||||
&TVPal264Ds,
|
||||
&TVPal264DsAa,
|
||||
&TVPal264Int,
|
||||
&TVPal264IntAa,
|
||||
&TVPal524IntAa,
|
||||
&TVPal528Int,
|
||||
&TVPal528IntDf,
|
||||
&TVPal574IntDfScale,
|
||||
&TVEurgb60Hz240Ds,
|
||||
&TVEurgb60Hz240DsAa,
|
||||
&TVEurgb60Hz240Int,
|
||||
&TVEurgb60Hz240IntAa,
|
||||
&TVEurgb60Hz480Int,
|
||||
&TVEurgb60Hz480IntDf,
|
||||
&TVEurgb60Hz480IntAa,
|
||||
&TVEurgb60Hz480Prog,
|
||||
&TVEurgb60Hz480ProgSoft,
|
||||
&TVEurgb60Hz480ProgAa
|
||||
&TVNtsc240Ds,
|
||||
&TVNtsc240DsAa,
|
||||
&TVNtsc240Int,
|
||||
&TVNtsc240IntAa,
|
||||
&TVNtsc480IntDf,
|
||||
&TVNtsc480IntAa,
|
||||
&TVNtsc480Prog,
|
||||
&TVMpal480IntDf,
|
||||
&TVPal264Ds,
|
||||
&TVPal264DsAa,
|
||||
&TVPal264Int,
|
||||
&TVPal264IntAa,
|
||||
&TVPal524IntAa,
|
||||
&TVPal528Int,
|
||||
&TVPal528IntDf,
|
||||
&TVPal574IntDfScale,
|
||||
&TVEurgb60Hz240Ds,
|
||||
&TVEurgb60Hz240DsAa,
|
||||
&TVEurgb60Hz240Int,
|
||||
&TVEurgb60Hz240IntAa,
|
||||
&TVEurgb60Hz480Int,
|
||||
&TVEurgb60Hz480IntDf,
|
||||
&TVEurgb60Hz480IntAa,
|
||||
&TVEurgb60Hz480Prog,
|
||||
&TVEurgb60Hz480ProgSoft,
|
||||
&TVEurgb60Hz480ProgAa
|
||||
};
|
||||
|
||||
GXRModeObj* PAL2NTSC[]={
|
||||
&TVMpal480IntDf, &TVNtsc480IntDf,
|
||||
&TVPal264Ds, &TVNtsc240Ds,
|
||||
&TVPal264DsAa, &TVNtsc240DsAa,
|
||||
&TVPal264Int, &TVNtsc240Int,
|
||||
&TVPal264IntAa, &TVNtsc240IntAa,
|
||||
&TVPal524IntAa, &TVNtsc480IntAa,
|
||||
&TVPal528Int, &TVNtsc480IntAa,
|
||||
&TVPal528IntDf, &TVNtsc480IntDf,
|
||||
&TVPal574IntDfScale, &TVNtsc480IntDf,
|
||||
&TVEurgb60Hz240Ds, &TVNtsc240Ds,
|
||||
&TVEurgb60Hz240DsAa, &TVNtsc240DsAa,
|
||||
&TVEurgb60Hz240Int, &TVNtsc240Int,
|
||||
&TVEurgb60Hz240IntAa, &TVNtsc240IntAa,
|
||||
&TVEurgb60Hz480Int, &TVNtsc480IntAa,
|
||||
&TVEurgb60Hz480IntDf, &TVNtsc480IntDf,
|
||||
&TVEurgb60Hz480IntAa, &TVNtsc480IntAa,
|
||||
&TVEurgb60Hz480Prog, &TVNtsc480Prog,
|
||||
&TVEurgb60Hz480ProgSoft,&TVNtsc480Prog,
|
||||
&TVEurgb60Hz480ProgAa, &TVNtsc480Prog,
|
||||
0,0
|
||||
&TVMpal480IntDf, &TVNtsc480IntDf,
|
||||
&TVPal264Ds, &TVNtsc240Ds,
|
||||
&TVPal264DsAa, &TVNtsc240DsAa,
|
||||
&TVPal264Int, &TVNtsc240Int,
|
||||
&TVPal264IntAa, &TVNtsc240IntAa,
|
||||
&TVPal524IntAa, &TVNtsc480IntAa,
|
||||
&TVPal528Int, &TVNtsc480IntAa,
|
||||
&TVPal528IntDf, &TVNtsc480IntDf,
|
||||
&TVPal574IntDfScale, &TVNtsc480IntDf,
|
||||
&TVEurgb60Hz240Ds, &TVNtsc240Ds,
|
||||
&TVEurgb60Hz240DsAa, &TVNtsc240DsAa,
|
||||
&TVEurgb60Hz240Int, &TVNtsc240Int,
|
||||
&TVEurgb60Hz240IntAa, &TVNtsc240IntAa,
|
||||
&TVEurgb60Hz480Int, &TVNtsc480IntAa,
|
||||
&TVEurgb60Hz480IntDf, &TVNtsc480IntDf,
|
||||
&TVEurgb60Hz480IntAa, &TVNtsc480IntAa,
|
||||
&TVEurgb60Hz480Prog, &TVNtsc480Prog,
|
||||
&TVEurgb60Hz480ProgSoft,&TVNtsc480Prog,
|
||||
&TVEurgb60Hz480ProgAa, &TVNtsc480Prog,
|
||||
0,0
|
||||
};
|
||||
|
||||
GXRModeObj* NTSC2PAL[]={
|
||||
&TVNtsc240Ds, &TVPal264Ds,
|
||||
&TVNtsc240DsAa, &TVPal264DsAa,
|
||||
&TVNtsc240Int, &TVPal264Int,
|
||||
&TVNtsc240IntAa, &TVPal264IntAa,
|
||||
&TVNtsc480IntDf, &TVPal528IntDf,
|
||||
&TVNtsc480IntAa, &TVPal524IntAa,
|
||||
&TVNtsc480Prog, &TVPal528IntDf,
|
||||
0,0
|
||||
&TVNtsc240Ds, &TVPal264Ds,
|
||||
&TVNtsc240DsAa, &TVPal264DsAa,
|
||||
&TVNtsc240Int, &TVPal264Int,
|
||||
&TVNtsc240IntAa, &TVPal264IntAa,
|
||||
&TVNtsc480IntDf, &TVPal528IntDf,
|
||||
&TVNtsc480IntAa, &TVPal524IntAa,
|
||||
&TVNtsc480Prog, &TVPal528IntDf,
|
||||
0,0
|
||||
};
|
||||
|
||||
GXRModeObj* NTSC2PAL60[]={
|
||||
&TVNtsc240Ds, &TVEurgb60Hz240Ds,
|
||||
&TVNtsc240DsAa, &TVEurgb60Hz240DsAa,
|
||||
&TVNtsc240Int, &TVEurgb60Hz240Int,
|
||||
&TVNtsc240IntAa, &TVEurgb60Hz240IntAa,
|
||||
&TVNtsc480IntDf, &TVEurgb60Hz480IntDf,
|
||||
&TVNtsc480IntAa, &TVEurgb60Hz480IntAa,
|
||||
&TVNtsc480Prog, &TVEurgb60Hz480Prog,
|
||||
0,0
|
||||
&TVNtsc240Ds, &TVEurgb60Hz240Ds,
|
||||
&TVNtsc240DsAa, &TVEurgb60Hz240DsAa,
|
||||
&TVNtsc240Int, &TVEurgb60Hz240Int,
|
||||
&TVNtsc240IntAa, &TVEurgb60Hz240IntAa,
|
||||
&TVNtsc480IntDf, &TVEurgb60Hz480IntDf,
|
||||
&TVNtsc480IntAa, &TVEurgb60Hz480IntAa,
|
||||
&TVNtsc480Prog, &TVEurgb60Hz480Prog,
|
||||
0,0
|
||||
};
|
||||
bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[])
|
||||
{
|
||||
u8 *Addr = (u8 *)Address;
|
||||
bool found = 0;
|
||||
u32 i;
|
||||
bool Search_and_patch_Video_Modes(void *Address, u32 Size, GXRModeObj* Table[]) {
|
||||
u8 *Addr = (u8 *)Address;
|
||||
bool found = 0;
|
||||
u32 i;
|
||||
|
||||
while(Size >= sizeof(GXRModeObj))
|
||||
{
|
||||
while (Size >= sizeof(GXRModeObj)) {
|
||||
|
||||
|
||||
|
||||
for(i = 0; Table[i]; i+=2)
|
||||
{
|
||||
for (i = 0; Table[i]; i+=2) {
|
||||
|
||||
|
||||
if(compare_videomodes(Table[i], (GXRModeObj*)Addr))
|
||||
if (compare_videomodes(Table[i], (GXRModeObj*)Addr))
|
||||
|
||||
{
|
||||
found = 1;
|
||||
patch_videomode((GXRModeObj*)Addr, Table[i+1]);
|
||||
Addr += (sizeof(GXRModeObj)-4);
|
||||
Size -= (sizeof(GXRModeObj)-4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
found = 1;
|
||||
patch_videomode((GXRModeObj*)Addr, Table[i+1]);
|
||||
Addr += (sizeof(GXRModeObj)-4);
|
||||
Size -= (sizeof(GXRModeObj)-4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Addr += 4;
|
||||
Size -= 4;
|
||||
}
|
||||
Addr += 4;
|
||||
Size -= 4;
|
||||
}
|
||||
|
||||
|
||||
return found;
|
||||
return found;
|
||||
}
|
||||
|
||||
/** Anti 002 fix for IOS 249 rev < 12 thanks to WiiPower **/
|
||||
void Anti_002_fix(void *Address, int Size)
|
||||
{
|
||||
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
u8 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
void Anti_002_fix(void *Address, int Size) {
|
||||
u8 SearchPattern[12] = { 0x2C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
u8 PatchData[12] = { 0x2C, 0x00, 0x00, 0x00, 0x40, 0x82, 0x02, 0x14, 0x3C, 0x60, 0x80, 0x00 };
|
||||
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
void *Addr = Address;
|
||||
void *Addr_end = Address+Size;
|
||||
|
||||
while(Addr <= Addr_end-sizeof(SearchPattern))
|
||||
{
|
||||
if(memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0)
|
||||
{
|
||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||
}
|
||||
Addr += 4;
|
||||
}
|
||||
while (Addr <= Addr_end-sizeof(SearchPattern)) {
|
||||
if (memcmp(Addr, SearchPattern, sizeof(SearchPattern))==0) {
|
||||
memcpy(Addr,PatchData,sizeof(PatchData));
|
||||
}
|
||||
Addr += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch)
|
||||
{
|
||||
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch) {
|
||||
GXRModeObj** table = NULL;
|
||||
if (videoSelected == 5) // patch
|
||||
|
||||
{
|
||||
switch(CONF_GetVideo())
|
||||
{
|
||||
case CONF_VIDEO_PAL:
|
||||
if(CONF_GetEuRGB60() > 0)
|
||||
{
|
||||
table = NTSC2PAL60;
|
||||
}
|
||||
else
|
||||
{
|
||||
table = NTSC2PAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case CONF_VIDEO_MPAL:
|
||||
|
||||
|
||||
|
||||
table = NTSC2PAL;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
table = PAL2NTSC;
|
||||
break;
|
||||
}
|
||||
Search_and_patch_Video_Modes(dst, len, table);
|
||||
}
|
||||
|
||||
/*GAME HOOK - FISHEARS*/
|
||||
dogamehooks(dst,len);
|
||||
|
||||
if (vipatch)
|
||||
vidolpatcher(dst,len);
|
||||
|
||||
|
||||
/*LANGUAGE PATCH - FISHEARS*/
|
||||
langpatcher(dst,len);
|
||||
|
||||
/*Thanks to WiiPower*/
|
||||
if(patchcountrystring == 1)
|
||||
PatchCountryStrings(dst, len);
|
||||
|
||||
//if(Settings.anti002fix == on)
|
||||
if(fix002 == 2)
|
||||
Anti_002_fix(dst, len);
|
||||
|
||||
}
|
||||
|
||||
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset)
|
||||
{
|
||||
app_entry appldr_entry;
|
||||
app_init appldr_init;
|
||||
app_main appldr_main;
|
||||
app_final appldr_final;
|
||||
|
||||
u32 appldr_len;
|
||||
s32 ret;
|
||||
|
||||
/* Read apploader header */
|
||||
ret = WDVD_Read(buffer, 0x20, APPLDR_OFFSET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Calculate apploader length */
|
||||
appldr_len = buffer[5] + buffer[6];
|
||||
|
||||
/* Read apploader code */
|
||||
ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set apploader entry function */
|
||||
appldr_entry = (app_entry)buffer[4];
|
||||
|
||||
/* Call apploader entry */
|
||||
appldr_entry(&appldr_init, &appldr_main, &appldr_final);
|
||||
|
||||
/* Initialize apploader */
|
||||
appldr_init(__noprint);
|
||||
|
||||
if(error002fix!=0){
|
||||
/* ERROR 002 fix (thanks to WiiPower for sharing this)*/
|
||||
*(u32 *)0x80003140 = *(u32 *)0x80003188;
|
||||
}
|
||||
|
||||
if (cheat)
|
||||
{
|
||||
/*HOOKS STUFF - FISHEARS*/
|
||||
memset((void*)0x80001800,0,kenobiwii_size);
|
||||
memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
|
||||
DCFlushRange((void*)0x80001800,kenobiwii_size);
|
||||
hooktype = 1;
|
||||
memcpy((void*)0x80001800, (char*)0x80000000, 6); // For WiiRD
|
||||
/*HOOKS STUFF - FISHEARS*/
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
void *dst = NULL;
|
||||
int len = 0, offset = 0;
|
||||
|
||||
/* Run apploader main function */
|
||||
ret = appldr_main(&dst, &len, &offset);
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
/* Read data from DVD */
|
||||
WDVD_Read(dst, len, (u64)(offset << 2));
|
||||
switch (CONF_GetVideo()) {
|
||||
case CONF_VIDEO_PAL:
|
||||
if (CONF_GetEuRGB60() > 0) {
|
||||
table = NTSC2PAL60;
|
||||
} else {
|
||||
table = NTSC2PAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case CONF_VIDEO_MPAL:
|
||||
|
||||
|
||||
|
||||
table = NTSC2PAL;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
table = PAL2NTSC;
|
||||
break;
|
||||
}
|
||||
Search_and_patch_Video_Modes(dst, len, table);
|
||||
}
|
||||
|
||||
/*GAME HOOK - FISHEARS*/
|
||||
dogamehooks(dst,len);
|
||||
|
||||
if (vipatch)
|
||||
vidolpatcher(dst,len);
|
||||
|
||||
|
||||
/*LANGUAGE PATCH - FISHEARS*/
|
||||
langpatcher(dst,len);
|
||||
|
||||
/*Thanks to WiiPower*/
|
||||
if (patchcountrystring == 1)
|
||||
PatchCountryStrings(dst, len);
|
||||
|
||||
//if(Settings.anti002fix == on)
|
||||
if (fix002 == 2)
|
||||
Anti_002_fix(dst, len);
|
||||
|
||||
}
|
||||
|
||||
s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset) {
|
||||
app_entry appldr_entry;
|
||||
app_init appldr_init;
|
||||
app_main appldr_main;
|
||||
app_final appldr_final;
|
||||
|
||||
u32 appldr_len;
|
||||
s32 ret;
|
||||
|
||||
/* Read apploader header */
|
||||
ret = WDVD_Read(buffer, 0x20, APPLDR_OFFSET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Calculate apploader length */
|
||||
appldr_len = buffer[5] + buffer[6];
|
||||
|
||||
/* Read apploader code */
|
||||
ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Set apploader entry function */
|
||||
appldr_entry = (app_entry)buffer[4];
|
||||
|
||||
/* Call apploader entry */
|
||||
appldr_entry(&appldr_init, &appldr_main, &appldr_final);
|
||||
|
||||
/* Initialize apploader */
|
||||
appldr_init(__noprint);
|
||||
|
||||
if (error002fix!=0) {
|
||||
/* ERROR 002 fix (thanks to WiiPower for sharing this)*/
|
||||
*(u32 *)0x80003140 = *(u32 *)0x80003188;
|
||||
}
|
||||
|
||||
if (cheat) {
|
||||
/*HOOKS STUFF - FISHEARS*/
|
||||
memset((void*)0x80001800,0,kenobiwii_size);
|
||||
memcpy((void*)0x80001800,kenobiwii,kenobiwii_size);
|
||||
DCFlushRange((void*)0x80001800,kenobiwii_size);
|
||||
hooktype = 1;
|
||||
memcpy((void*)0x80001800, (char*)0x80000000, 6); // For WiiRD
|
||||
/*HOOKS STUFF - FISHEARS*/
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
void *dst = NULL;
|
||||
int len = 0, offset = 0;
|
||||
|
||||
/* Run apploader main function */
|
||||
ret = appldr_main(&dst, &len, &offset);
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
/* Read data from DVD */
|
||||
WDVD_Read(dst, len, (u64)(offset << 2));
|
||||
|
||||
gamepatches(dst, len, videoSelected, patchcountrystring, vipatch);
|
||||
|
||||
DCFlushRange(dst, len);
|
||||
}
|
||||
DCFlushRange(dst, len);
|
||||
}
|
||||
|
||||
*entry = appldr_final();
|
||||
|
||||
/** Load alternate dol if set **/
|
||||
if(alternatedol == 1) {
|
||||
if (alternatedol == 1) {
|
||||
void *dolbuffer;
|
||||
int dollen;
|
||||
|
||||
bool dolloaded = Load_Dol(&dolbuffer, &dollen, Settings.dolpath);
|
||||
if(dolloaded) {
|
||||
if (dolloaded) {
|
||||
Remove_001_Protection(dolbuffer, dollen);
|
||||
|
||||
DCFlushRange(dolbuffer, dollen);
|
||||
@ -375,19 +357,19 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8
|
||||
gamepatches(dolbuffer, dollen, videoSelected, patchcountrystring, vipatch);
|
||||
|
||||
DCFlushRange(dolbuffer, dollen);
|
||||
|
||||
/* Set entry point from apploader */
|
||||
|
||||
/* Set entry point from apploader */
|
||||
*entry = (entry_point) load_dol_image(dolbuffer);
|
||||
}
|
||||
} else if(alternatedol == 2) {
|
||||
} else if (alternatedol == 2) {
|
||||
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
|
||||
*entry = (entry_point) Load_Dol_from_disc(fst[alternatedoloffset].fileoffset, videoSelected, patchcountrystring, vipatch);
|
||||
|
||||
if(*entry == 0)
|
||||
if (*entry == 0)
|
||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
#ifndef _APPLOADER_H_
|
||||
#ifndef _APPLOADER_H_
|
||||
#define _APPLOADER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Entry point */
|
||||
typedef void (*entry_point)(void);
|
||||
|
||||
/* Prototypes */
|
||||
s32 Apploader_Run(entry_point *, u8, u8, u8, u8, u8, u8, u32);
|
||||
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch);
|
||||
|
||||
/* Entry point */
|
||||
typedef void (*entry_point)(void);
|
||||
|
||||
/* Prototypes */
|
||||
s32 Apploader_Run(entry_point *, u8, u8, u8, u8, u8, u8, u32);
|
||||
void gamepatches(void * dst, int len, u8 videoSelected, u8 patchcountrystring, u8 vipatch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -2,15 +2,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogcsys.h>
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include <ogc/lwp_watchdog.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include "patches/fst.h"
|
||||
#include "apploader.h"
|
||||
#include "disc.h"
|
||||
#include "video.h"
|
||||
#include "wdvd.h"
|
||||
#include "alternatedol.h"
|
||||
#include "wdvd.h"
|
||||
#include "alternatedol.h"
|
||||
|
||||
/* Constants */
|
||||
#define PTABLE_OFFSET 0x40000
|
||||
@ -18,386 +18,370 @@
|
||||
|
||||
/* Disc pointers */
|
||||
static u32 *buffer = (u32 *)0x93000000;
|
||||
static u8 *diskid = (u8 *)0x80000000;
|
||||
static u8 *diskid = (u8 *)0x80000000;
|
||||
static char gameid[8];
|
||||
|
||||
|
||||
void __Disc_SetLowMem(void)
|
||||
{
|
||||
*(vu32 *)0x80000020 = 0x0D15EA5E; // Standard Boot Code
|
||||
void __Disc_SetLowMem(void) {
|
||||
*(vu32 *)0x80000020 = 0x0D15EA5E; // Standard Boot Code
|
||||
*(vu32 *)0x80000024 = 0x00000001; // Version
|
||||
|
||||
*(vu32 *)0x80000030 = 0x00000000; // Arena Low
|
||||
*(vu32 *)0x800000F4 = 0x817E5480; // BI2
|
||||
*(vu32 *)0x800000F8 = 0x0E7BE2C0; // Console Bus Speed
|
||||
*(vu32 *)0x800000FC = 0x2B73A840; // Console CPU Speed
|
||||
|
||||
/* Setup low memory */
|
||||
*(vu32 *)0x80000060 = 0x38A00040;
|
||||
*(vu32 *)0x800000E4 = 0x80431A80;
|
||||
*(vu32 *)0x800000EC = 0x81800000; // Dev Debugger Monitor Address
|
||||
*(vu32 *)0x80000030 = 0x00000000; // Arena Low
|
||||
*(vu32 *)0x800000F4 = 0x817E5480; // BI2
|
||||
*(vu32 *)0x800000F8 = 0x0E7BE2C0; // Console Bus Speed
|
||||
*(vu32 *)0x800000FC = 0x2B73A840; // Console CPU Speed
|
||||
|
||||
/* Setup low memory */
|
||||
*(vu32 *)0x80000060 = 0x38A00040;
|
||||
*(vu32 *)0x800000E4 = 0x80431A80;
|
||||
*(vu32 *)0x800000EC = 0x81800000; // Dev Debugger Monitor Address
|
||||
*(vu32 *)0x800000F0 = 0x01800000; // Simulated Memory Size
|
||||
|
||||
//If the game is sam & max: season 1 put this shit in
|
||||
char tempTxt[10];
|
||||
snprintf (tempTxt,sizeof(tempTxt),"%c%c%c%c%c%c", gameid[0], gameid[1], gameid[2], gameid[3], gameid[4], gameid[5]);
|
||||
//If the game is sam & max: season 1 put this shit in
|
||||
char tempTxt[10];
|
||||
snprintf (tempTxt,sizeof(tempTxt),"%c%c%c%c%c%c", gameid[0], gameid[1], gameid[2], gameid[3], gameid[4], gameid[5]);
|
||||
if ((strcmp(tempTxt,"R3XE6U")==0)||
|
||||
(strcmp(tempTxt,"R3XP6V")==0))/*&&
|
||||
(strcmp(tempTxt,"R3XP6V")==0))/*&&
|
||||
(IOS_GetVersion()==249)&&
|
||||
((IOS_GetRevision()==10)||(IOS_GetRevision()==13)) I left out the ios check to see if works with other ios versions.*/
|
||||
{*(vu32*)0x80003184 = 0x80000000;} // Game ID Address
|
||||
((IOS_GetRevision()==10)||(IOS_GetRevision()==13)) I left out the ios check to see if works with other ios versions.*/
|
||||
{
|
||||
*(vu32*)0x80003184 = 0x80000000; // Game ID Address
|
||||
}
|
||||
|
||||
/* Copy disc ID */
|
||||
memcpy((void *)0x80003180, (void *)0x80000000, 4);
|
||||
/* Copy disc ID */
|
||||
memcpy((void *)0x80003180, (void *)0x80000000, 4);
|
||||
|
||||
/* Flush cache */
|
||||
DCFlushRange((void *)0x80000000, 0x3F00);
|
||||
/* Flush cache */
|
||||
DCFlushRange((void *)0x80000000, 0x3F00);
|
||||
}
|
||||
|
||||
void __Disc_SetVMode(u8 videoselected)
|
||||
{
|
||||
GXRModeObj *vmode = NULL;
|
||||
void __Disc_SetVMode(u8 videoselected) {
|
||||
GXRModeObj *vmode = NULL;
|
||||
|
||||
u32 progressive, tvmode, vmode_reg = 0;
|
||||
u32 progressive, tvmode, vmode_reg = 0;
|
||||
|
||||
/* Get video mode configuration */
|
||||
progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||
tvmode = CONF_GetVideo();
|
||||
/* Get video mode configuration */
|
||||
progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||
tvmode = CONF_GetVideo();
|
||||
|
||||
/* Select video mode register */
|
||||
switch (tvmode) {
|
||||
case CONF_VIDEO_PAL:
|
||||
vmode_reg = (CONF_GetEuRGB60() > 0) ? 5 : 1;
|
||||
break;
|
||||
/* Select video mode register */
|
||||
switch (tvmode) {
|
||||
case CONF_VIDEO_PAL:
|
||||
vmode_reg = (CONF_GetEuRGB60() > 0) ? 5 : 1;
|
||||
break;
|
||||
|
||||
case CONF_VIDEO_MPAL:
|
||||
vmode_reg = 4;
|
||||
break;
|
||||
case CONF_VIDEO_MPAL:
|
||||
vmode_reg = 4;
|
||||
break;
|
||||
|
||||
case CONF_VIDEO_NTSC:
|
||||
vmode_reg = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (videoselected) {
|
||||
case 0:
|
||||
|
||||
/* Select video mode */
|
||||
switch(diskid[3]) {
|
||||
/* PAL */
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'P':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
if (tvmode != CONF_VIDEO_PAL) {
|
||||
vmode_reg = 5;
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/* NTSC or unknown */
|
||||
case 'E':
|
||||
case 'J':
|
||||
if (tvmode != CONF_VIDEO_NTSC) {
|
||||
vmode_reg = 0;
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
vmode = &TVPal528IntDf;
|
||||
vmode_reg = (vmode->viTVMode) >> 2;
|
||||
break;
|
||||
case 2:
|
||||
progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||
vmode_reg = (vmode->viTVMode) >> 2;
|
||||
break;
|
||||
case 3:
|
||||
progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
||||
vmode_reg = (vmode->viTVMode) >> 2;
|
||||
break;
|
||||
case 4:
|
||||
// vmode = VIDEO_GetPreferredMode(NULL);
|
||||
case CONF_VIDEO_NTSC:
|
||||
vmode_reg = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set video mode register */
|
||||
*(vu32 *)0x800000CC = vmode_reg;
|
||||
switch (videoselected) {
|
||||
case 0:
|
||||
|
||||
/* Set video mode */
|
||||
if (vmode) {
|
||||
/* Select video mode */
|
||||
switch (diskid[3]) {
|
||||
/* PAL */
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'P':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
if (tvmode != CONF_VIDEO_PAL) {
|
||||
vmode_reg = 5;
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||
}
|
||||
|
||||
VIDEO_Configure(vmode);
|
||||
break;
|
||||
|
||||
/* Setup video */
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
/* NTSC or unknown */
|
||||
case 'E':
|
||||
case 'J':
|
||||
if (tvmode != CONF_VIDEO_NTSC) {
|
||||
vmode_reg = 0;
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
||||
}
|
||||
|
||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
vmode = &TVPal528IntDf;
|
||||
vmode_reg = (vmode->viTVMode) >> 2;
|
||||
break;
|
||||
case 2:
|
||||
progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVEurgb60Hz480IntDf;
|
||||
vmode_reg = (vmode->viTVMode) >> 2;
|
||||
break;
|
||||
case 3:
|
||||
progressive = (CONF_GetProgressiveScan() > 0) && VIDEO_HaveComponentCable();
|
||||
vmode = (progressive) ? &TVNtsc480Prog : &TVNtsc480IntDf;
|
||||
vmode_reg = (vmode->viTVMode) >> 2;
|
||||
break;
|
||||
case 4:
|
||||
// vmode = VIDEO_GetPreferredMode(NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set video mode register */
|
||||
*(vu32 *)0x800000CC = vmode_reg;
|
||||
|
||||
/* Set video mode */
|
||||
if (vmode) {
|
||||
|
||||
VIDEO_Configure(vmode);
|
||||
|
||||
/* Setup video */
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (vmode->viTVMode & VI_NON_INTERLACE)
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
}
|
||||
|
||||
void __Disc_SetTime(void)
|
||||
{
|
||||
/* Extern */
|
||||
extern void settime(u64);
|
||||
void __Disc_SetTime(void) {
|
||||
/* Extern */
|
||||
extern void settime(u64);
|
||||
|
||||
/* Set proper time */
|
||||
settime(secs_to_ticks(time(NULL) - 946684800));
|
||||
/* Set proper time */
|
||||
settime(secs_to_ticks(time(NULL) - 946684800));
|
||||
}
|
||||
|
||||
s32 __Disc_FindPartition(u64 *outbuf)
|
||||
{
|
||||
u64 offset = 0, table_offset = 0;
|
||||
s32 __Disc_FindPartition(u64 *outbuf) {
|
||||
u64 offset = 0, table_offset = 0;
|
||||
|
||||
u32 cnt, nb_partitions;
|
||||
s32 ret;
|
||||
u32 cnt, nb_partitions;
|
||||
s32 ret;
|
||||
|
||||
/* Read partition info */
|
||||
ret = WDVD_UnencryptedRead(buffer, 0x20, PTABLE_OFFSET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Read partition info */
|
||||
ret = WDVD_UnencryptedRead(buffer, 0x20, PTABLE_OFFSET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Get data */
|
||||
nb_partitions = buffer[0];
|
||||
table_offset = buffer[1] << 2;
|
||||
/* Get data */
|
||||
nb_partitions = buffer[0];
|
||||
table_offset = buffer[1] << 2;
|
||||
|
||||
/* Read partition table */
|
||||
ret = WDVD_UnencryptedRead(buffer, 0x20, table_offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Read partition table */
|
||||
ret = WDVD_UnencryptedRead(buffer, 0x20, table_offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Find game partition */
|
||||
for (cnt = 0; cnt < nb_partitions; cnt++) {
|
||||
u32 type = buffer[cnt * 2 + 1];
|
||||
/* Find game partition */
|
||||
for (cnt = 0; cnt < nb_partitions; cnt++) {
|
||||
u32 type = buffer[cnt * 2 + 1];
|
||||
|
||||
/* Game partition */
|
||||
if(!type)
|
||||
offset = buffer[cnt * 2] << 2;
|
||||
}
|
||||
/* Game partition */
|
||||
if (!type)
|
||||
offset = buffer[cnt * 2] << 2;
|
||||
}
|
||||
|
||||
/* No game partition found */
|
||||
if (!offset)
|
||||
return -1;
|
||||
/* No game partition found */
|
||||
if (!offset)
|
||||
return -1;
|
||||
|
||||
/* Set output buffer */
|
||||
*outbuf = offset;
|
||||
/* Set output buffer */
|
||||
*outbuf = offset;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
s32 Disc_Init(void)
|
||||
{
|
||||
/* Init DVD subsystem */
|
||||
return WDVD_Init();
|
||||
s32 Disc_Init(void) {
|
||||
/* Init DVD subsystem */
|
||||
return WDVD_Init();
|
||||
}
|
||||
|
||||
s32 Disc_Open(void)
|
||||
{
|
||||
s32 ret;
|
||||
s32 Disc_Open(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Reset drive */
|
||||
ret = WDVD_Reset();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Reset drive */
|
||||
ret = WDVD_Reset();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Read disc ID */
|
||||
return WDVD_ReadDiskId(diskid);
|
||||
/* Read disc ID */
|
||||
return WDVD_ReadDiskId(diskid);
|
||||
}
|
||||
|
||||
s32 Disc_Wait(void)
|
||||
{
|
||||
u32 cover = 0;
|
||||
s32 ret;
|
||||
s32 Disc_Wait(void) {
|
||||
u32 cover = 0;
|
||||
s32 ret;
|
||||
|
||||
/* Wait for disc */
|
||||
while (!(cover & 0x2)) {
|
||||
/* Get cover status */
|
||||
ret = WDVD_GetCoverStatus(&cover);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
/* Wait for disc */
|
||||
while (!(cover & 0x2)) {
|
||||
/* Get cover status */
|
||||
ret = WDVD_GetCoverStatus(&cover);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_SetUSB(u8 *id)
|
||||
{
|
||||
/* Set USB mode */
|
||||
return WDVD_SetUSBMode(id);
|
||||
s32 Disc_SetUSB(u8 *id) {
|
||||
/* Set USB mode */
|
||||
return WDVD_SetUSBMode(id);
|
||||
}
|
||||
|
||||
s32 Disc_ReadHeader(void *outbuf)
|
||||
{
|
||||
/* Read disc header */
|
||||
return WDVD_UnencryptedRead(outbuf, sizeof(struct discHdr), 0);
|
||||
s32 Disc_ReadHeader(void *outbuf) {
|
||||
/* Read disc header */
|
||||
return WDVD_UnencryptedRead(outbuf, sizeof(struct discHdr), 0);
|
||||
}
|
||||
|
||||
s32 Disc_IsWii(void)
|
||||
{
|
||||
struct discHdr *header = (struct discHdr *)buffer;
|
||||
s32 Disc_IsWii(void) {
|
||||
struct discHdr *header = (struct discHdr *)buffer;
|
||||
|
||||
s32 ret;
|
||||
s32 ret;
|
||||
|
||||
/* Read disc header */
|
||||
ret = Disc_ReadHeader(header);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Read disc header */
|
||||
ret = Disc_ReadHeader(header);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Check magic word */
|
||||
if (header->magic != WII_MAGIC)
|
||||
return -1;
|
||||
/* Check magic word */
|
||||
if (header->magic != WII_MAGIC)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset)
|
||||
{
|
||||
entry_point p_entry;
|
||||
s32 Disc_BootPartition(u64 offset, u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset) {
|
||||
entry_point p_entry;
|
||||
|
||||
s32 ret;
|
||||
s32 ret;
|
||||
|
||||
/* Open specified partition */
|
||||
ret = WDVD_OpenPartition(offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Open specified partition */
|
||||
ret = WDVD_OpenPartition(offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Run apploader */
|
||||
ret = Apploader_Run(&p_entry, cheat, videoselected, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Run apploader */
|
||||
ret = Apploader_Run(&p_entry, cheat, videoselected, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Setup low memory */
|
||||
__Disc_SetLowMem();
|
||||
/* Setup low memory */
|
||||
__Disc_SetLowMem();
|
||||
|
||||
/* Set an appropiate video mode */
|
||||
__Disc_SetVMode(videoselected);
|
||||
/* Set an appropiate video mode */
|
||||
__Disc_SetVMode(videoselected);
|
||||
|
||||
/* Set time */
|
||||
__Disc_SetTime();
|
||||
|
||||
if (cheat == 1) {
|
||||
/* OCARINA STUFF - FISHEARS*/
|
||||
memset(gameid, 0, 8);
|
||||
memcpy(gameid, (char*)0x80000000, 6);
|
||||
do_sd_code(gameid);
|
||||
/* OCARINA STUFF - FISHEARS*/
|
||||
}
|
||||
/* Set time */
|
||||
__Disc_SetTime();
|
||||
|
||||
/* Disconnect Wiimote */
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
if (cheat == 1) {
|
||||
/* OCARINA STUFF - FISHEARS*/
|
||||
memset(gameid, 0, 8);
|
||||
memcpy(gameid, (char*)0x80000000, 6);
|
||||
do_sd_code(gameid);
|
||||
/* OCARINA STUFF - FISHEARS*/
|
||||
}
|
||||
|
||||
/* Shutdown IOS subsystems */
|
||||
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
/* Disconnect Wiimote */
|
||||
WPAD_Flush(0);
|
||||
WPAD_Disconnect(0);
|
||||
WPAD_Shutdown();
|
||||
|
||||
/* Jump to entry point */
|
||||
p_entry();
|
||||
/* Shutdown IOS subsystems */
|
||||
SYS_ResetSystem(SYS_SHUTDOWN, 0, 0);
|
||||
|
||||
return 0;
|
||||
/* Jump to entry point */
|
||||
p_entry();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset)
|
||||
{
|
||||
u64 offset;
|
||||
s32 ret;
|
||||
s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, u8 error002fix, u8 alternatedol, u32 alternatedoloffset) {
|
||||
u64 offset;
|
||||
s32 ret;
|
||||
|
||||
/* Find game partition offset */
|
||||
ret = __Disc_FindPartition(&offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Find game partition offset */
|
||||
ret = __Disc_FindPartition(&offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Boot partition */
|
||||
return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset);
|
||||
/* Boot partition */
|
||||
return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset);
|
||||
}
|
||||
|
||||
void PatchCountryStrings(void *Address, int Size) {
|
||||
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 *Addr = (u8*)Address;
|
||||
|
||||
int wiiregion = CONF_GetRegion();
|
||||
|
||||
switch (wiiregion) {
|
||||
case CONF_REGION_JP:
|
||||
SearchPattern[0] = 0x00;
|
||||
SearchPattern[1] = 0x4A; // J
|
||||
SearchPattern[2] = 0x50; // P
|
||||
break;
|
||||
case CONF_REGION_EU:
|
||||
SearchPattern[0] = 0x02;
|
||||
SearchPattern[1] = 0x45; // E
|
||||
SearchPattern[2] = 0x55; // U
|
||||
break;
|
||||
case CONF_REGION_KR:
|
||||
SearchPattern[0] = 0x04;
|
||||
SearchPattern[1] = 0x4B; // K
|
||||
SearchPattern[2] = 0x52; // R
|
||||
break;
|
||||
case CONF_REGION_CN:
|
||||
SearchPattern[0] = 0x05;
|
||||
SearchPattern[1] = 0x43; // C
|
||||
SearchPattern[2] = 0x4E; // N
|
||||
break;
|
||||
case CONF_REGION_US:
|
||||
default:
|
||||
SearchPattern[0] = 0x01;
|
||||
SearchPattern[1] = 0x55; // U
|
||||
SearchPattern[2] = 0x53; // S
|
||||
}
|
||||
|
||||
switch (diskid[3]) {
|
||||
case 'J':
|
||||
PatchData[1] = 0x4A; // J
|
||||
PatchData[2] = 0x50; // P
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'P':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
PatchData[1] = 0x45; // E
|
||||
PatchData[2] = 0x55; // U
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
default:
|
||||
PatchData[1] = 0x55; // U
|
||||
PatchData[2] = 0x53; // S
|
||||
}
|
||||
|
||||
while (Size >= 4) {
|
||||
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3]) {
|
||||
//*Addr = PatchData[0];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[1];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[2];
|
||||
Addr += 1;
|
||||
//*Addr = PatchData[3];
|
||||
Addr += 1;
|
||||
Size -= 4;
|
||||
} else {
|
||||
Addr += 4;
|
||||
Size -= 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PatchCountryStrings(void *Address, int Size)
|
||||
{
|
||||
u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 *Addr = (u8*)Address;
|
||||
|
||||
int wiiregion = CONF_GetRegion();
|
||||
|
||||
switch (wiiregion)
|
||||
{
|
||||
case CONF_REGION_JP:
|
||||
SearchPattern[0] = 0x00;
|
||||
SearchPattern[1] = 0x4A; // J
|
||||
SearchPattern[2] = 0x50; // P
|
||||
break;
|
||||
case CONF_REGION_EU:
|
||||
SearchPattern[0] = 0x02;
|
||||
SearchPattern[1] = 0x45; // E
|
||||
SearchPattern[2] = 0x55; // U
|
||||
break;
|
||||
case CONF_REGION_KR:
|
||||
SearchPattern[0] = 0x04;
|
||||
SearchPattern[1] = 0x4B; // K
|
||||
SearchPattern[2] = 0x52; // R
|
||||
break;
|
||||
case CONF_REGION_CN:
|
||||
SearchPattern[0] = 0x05;
|
||||
SearchPattern[1] = 0x43; // C
|
||||
SearchPattern[2] = 0x4E; // N
|
||||
break;
|
||||
case CONF_REGION_US:
|
||||
default:
|
||||
SearchPattern[0] = 0x01;
|
||||
SearchPattern[1] = 0x55; // U
|
||||
SearchPattern[2] = 0x53; // S
|
||||
}
|
||||
|
||||
switch (diskid[3])
|
||||
{
|
||||
case 'J':
|
||||
PatchData[1] = 0x4A; // J
|
||||
PatchData[2] = 0x50; // P
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
case 'F':
|
||||
case 'P':
|
||||
case 'X':
|
||||
case 'Y':
|
||||
PatchData[1] = 0x45; // E
|
||||
PatchData[2] = 0x55; // U
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
default:
|
||||
PatchData[1] = 0x55; // U
|
||||
PatchData[2] = 0x53; // S
|
||||
}
|
||||
|
||||
while (Size >= 4)
|
||||
{
|
||||
if (Addr[0] == SearchPattern[0] && Addr[1] == SearchPattern[1] && Addr[2] == SearchPattern[2] && Addr[3] == SearchPattern[3])
|
||||
{
|
||||
//*Addr = PatchData[0];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[1];
|
||||
Addr += 1;
|
||||
*Addr = PatchData[2];
|
||||
Addr += 1;
|
||||
//*Addr = PatchData[3];
|
||||
Addr += 1;
|
||||
Size -= 4;
|
||||
} else
|
||||
{
|
||||
Addr += 4;
|
||||
Size -= 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,57 @@
|
||||
#ifndef _DISC_H_
|
||||
#ifndef _DISC_H_
|
||||
#define _DISC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Disc header structure */
|
||||
struct discHdr {
|
||||
/* Game ID */
|
||||
u8 id[6];
|
||||
|
||||
/* Game version */
|
||||
u16 version;
|
||||
|
||||
/* Audio streaming */
|
||||
u8 streaming;
|
||||
u8 bufsize;
|
||||
|
||||
/* Padding */
|
||||
u8 unused1[14];
|
||||
|
||||
/* Magic word */
|
||||
u32 magic;
|
||||
|
||||
/* Padding */
|
||||
u8 unused2[4];
|
||||
|
||||
/* Game title */
|
||||
char title[64];
|
||||
|
||||
/* Encryption/Hashing */
|
||||
u8 encryption;
|
||||
u8 h3_verify;
|
||||
|
||||
/* Padding */
|
||||
u8 unused3[30];
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
/* Prototypes */
|
||||
s32 Disc_Init(void);
|
||||
s32 Disc_Open(void);
|
||||
s32 Disc_Wait(void);
|
||||
void __Disc_SetLowMem(void);
|
||||
s32 Disc_SetUSB(u8 *);
|
||||
s32 Disc_ReadHeader(void *);
|
||||
s32 Disc_IsWii(void);
|
||||
s32 Disc_BootPartition(u64, u8, u8, u8, u8, u8, u8, u32);
|
||||
s32 Disc_WiiBoot(u8, u8, u8, u8, u8, u8, u32);
|
||||
s32 __Disc_FindPartition(u64 *outbuf);
|
||||
void PatchCountryStrings(void *Address, int Size);
|
||||
s32 __Disc_FindPartition(u64 *outbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/* Disc header structure */
|
||||
struct discHdr
|
||||
{
|
||||
/* Game ID */
|
||||
u8 id[6];
|
||||
|
||||
/* Game version */
|
||||
u16 version;
|
||||
|
||||
/* Audio streaming */
|
||||
u8 streaming;
|
||||
u8 bufsize;
|
||||
|
||||
/* Padding */
|
||||
u8 unused1[14];
|
||||
|
||||
/* Magic word */
|
||||
u32 magic;
|
||||
|
||||
/* Padding */
|
||||
u8 unused2[4];
|
||||
|
||||
/* Game title */
|
||||
char title[64];
|
||||
|
||||
/* Encryption/Hashing */
|
||||
u8 encryption;
|
||||
u8 h3_verify;
|
||||
|
||||
/* Padding */
|
||||
u8 unused3[30];
|
||||
} ATTRIBUTE_PACKED;
|
||||
|
||||
/* Prototypes */
|
||||
s32 Disc_Init(void);
|
||||
s32 Disc_Open(void);
|
||||
s32 Disc_Wait(void);
|
||||
void __Disc_SetLowMem(void);
|
||||
s32 Disc_SetUSB(u8 *);
|
||||
s32 Disc_ReadHeader(void *);
|
||||
s32 Disc_IsWii(void);
|
||||
s32 Disc_BootPartition(u64, u8, u8, u8, u8, u8, u8, u32);
|
||||
s32 Disc_WiiBoot(u8, u8, u8, u8, u8, u8, u32);
|
||||
s32 __Disc_FindPartition(u64 *outbuf);
|
||||
void PatchCountryStrings(void *Address, int Size);
|
||||
s32 __Disc_FindPartition(u64 *outbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -3,44 +3,35 @@
|
||||
#include "fstfile.h"
|
||||
|
||||
|
||||
char *fstfiles(FST_ENTRY *fst, u32 index)
|
||||
{
|
||||
u32 count = fst[0].filelen;
|
||||
u32 stringoffset;
|
||||
if (index < count)
|
||||
{
|
||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||
return (char *)((u32)fst + count*12 + stringoffset);
|
||||
} else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
char *fstfiles(FST_ENTRY *fst, u32 index) {
|
||||
u32 count = fst[0].filelen;
|
||||
u32 stringoffset;
|
||||
if (index < count) {
|
||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||
return (char *)((u32)fst + count*12 + stringoffset);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char *fstfilename(u32 index)
|
||||
{
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
u32 count = fst[0].filelen;
|
||||
u32 stringoffset;
|
||||
if (index < count)
|
||||
{
|
||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||
return (char *)(*(u32 *)0x80000038 + count*12 + stringoffset);
|
||||
} else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
char *fstfilename(u32 index) {
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
u32 count = fst[0].filelen;
|
||||
u32 stringoffset;
|
||||
if (index < count) {
|
||||
stringoffset = *(u32 *)&(fst[index]) % (256*256*256);
|
||||
return (char *)(*(u32 *)0x80000038 + count*12 + stringoffset);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
u32 fstfileoffset(u32 index)
|
||||
{
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
u32 count = fst[0].filelen;
|
||||
if (index < count)
|
||||
{
|
||||
return fst[index].fileoffset;
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
u32 fstfileoffset(u32 index) {
|
||||
FST_ENTRY *fst = (FST_ENTRY *)*(u32 *)0x80000038;
|
||||
u32 count = fst[0].filelen;
|
||||
if (index < count) {
|
||||
return fst[index].fileoffset;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2,20 +2,19 @@
|
||||
#define _FSTFILE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
u8 filetype;
|
||||
char name_offset[3];
|
||||
u32 fileoffset;
|
||||
u32 filelen;
|
||||
} __attribute__((packed)) FST_ENTRY;
|
||||
typedef struct {
|
||||
u8 filetype;
|
||||
char name_offset[3];
|
||||
u32 fileoffset;
|
||||
u32 filelen;
|
||||
} __attribute__((packed)) FST_ENTRY;
|
||||
|
||||
char *fstfiles(FST_ENTRY *fst, u32 index);
|
||||
char *fstfilename(u32 index);
|
||||
u32 fstfileoffset(u32 index);
|
||||
char *fstfiles(FST_ENTRY *fst, u32 index);
|
||||
char *fstfilename(u32 index);
|
||||
u32 fstfileoffset(u32 index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -17,159 +17,152 @@ s32 __Menu_EntryCmp(const void *a, const void *b)
|
||||
|
||||
{
|
||||
|
||||
struct discHdr *hdr1 = (struct discHdr *)a;
|
||||
struct discHdr *hdr1 = (struct discHdr *)a;
|
||||
|
||||
struct discHdr *hdr2 = (struct discHdr *)b;
|
||||
struct discHdr *hdr2 = (struct discHdr *)b;
|
||||
|
||||
|
||||
|
||||
/* Compare strings */
|
||||
/* Compare strings */
|
||||
|
||||
return stricmp(get_title(hdr1), get_title(hdr2));
|
||||
return stricmp(get_title(hdr1), get_title(hdr2));
|
||||
|
||||
}
|
||||
|
||||
s32 __Menu_EntryCmpCount(const void *a, const void *b)
|
||||
{
|
||||
s32 ret;
|
||||
s32 __Menu_EntryCmpCount(const void *a, const void *b) {
|
||||
s32 ret;
|
||||
|
||||
struct discHdr *hdr1 = (struct discHdr *)a;
|
||||
struct discHdr *hdr1 = (struct discHdr *)a;
|
||||
|
||||
struct discHdr *hdr2 = (struct discHdr *)b;
|
||||
struct discHdr *hdr2 = (struct discHdr *)b;
|
||||
|
||||
/* Compare Play Count */
|
||||
u16 count1 = 0;
|
||||
u16 count2 = 0;
|
||||
struct Game_NUM* game_num1 = CFG_get_game_num(hdr1->id);
|
||||
struct Game_NUM* game_num2 = CFG_get_game_num(hdr2->id);
|
||||
/* Compare Play Count */
|
||||
u16 count1 = 0;
|
||||
u16 count2 = 0;
|
||||
struct Game_NUM* game_num1 = CFG_get_game_num(hdr1->id);
|
||||
struct Game_NUM* game_num2 = CFG_get_game_num(hdr2->id);
|
||||
|
||||
|
||||
|
||||
if (game_num1) count1 = game_num1->count;
|
||||
if (game_num2) count2 = game_num2->count;
|
||||
if (game_num1) count1 = game_num1->count;
|
||||
if (game_num2) count2 = game_num2->count;
|
||||
|
||||
ret = (s32) (count2-count1);
|
||||
if (ret == 0) return stricmp(get_title(hdr1), get_title(hdr2));
|
||||
ret = (s32) (count2-count1);
|
||||
if (ret == 0) return stricmp(get_title(hdr1), get_title(hdr2));
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Get Gamelist
|
||||
***************************************************************************/
|
||||
|
||||
int __Menu_GetEntries(int t)
|
||||
{
|
||||
struct discHdr *buffer = NULL;
|
||||
struct discHdr *buffer2 = NULL;
|
||||
struct discHdr *header = NULL;
|
||||
int __Menu_GetEntries(int t) {
|
||||
struct discHdr *buffer = NULL;
|
||||
struct discHdr *buffer2 = NULL;
|
||||
struct discHdr *header = NULL;
|
||||
|
||||
u32 cnt, len;
|
||||
s32 ret;
|
||||
u32 cnt, len;
|
||||
s32 ret;
|
||||
|
||||
/* Get list length */
|
||||
ret = WBFS_GetCount(&cnt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Get list length */
|
||||
ret = WBFS_GetCount(&cnt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Buffer length */
|
||||
len = sizeof(struct discHdr) * cnt;
|
||||
/* Buffer length */
|
||||
len = sizeof(struct discHdr) * cnt;
|
||||
|
||||
/* Allocate memory */
|
||||
buffer = (struct discHdr *)memalign(32, len);
|
||||
if (!buffer)
|
||||
return -1;
|
||||
/* Allocate memory */
|
||||
buffer = (struct discHdr *)memalign(32, len);
|
||||
if (!buffer)
|
||||
return -1;
|
||||
|
||||
/* Clear buffer */
|
||||
memset(buffer, 0, len);
|
||||
/* Clear buffer */
|
||||
memset(buffer, 0, len);
|
||||
|
||||
/* Get header list */
|
||||
ret = WBFS_GetHeaders(buffer, cnt, sizeof(struct discHdr));
|
||||
if (ret < 0) {
|
||||
if(buffer) free(buffer);
|
||||
return ret;
|
||||
}
|
||||
/* Get header list */
|
||||
ret = WBFS_GetHeaders(buffer, cnt, sizeof(struct discHdr));
|
||||
if (ret < 0) {
|
||||
if (buffer) free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Filters */
|
||||
if (Settings.fave && t==0) {
|
||||
u32 cnt2 = 0;
|
||||
/* Filters */
|
||||
if (Settings.fave && t==0) {
|
||||
u32 cnt2 = 0;
|
||||
|
||||
for (u32 i = 0; i < cnt; i++)
|
||||
{
|
||||
header = &buffer[i];
|
||||
u8 favorite = 0;
|
||||
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
||||
if (game_num) {
|
||||
favorite = game_num->favorite;
|
||||
}
|
||||
if (favorite==1) {
|
||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||
if (!buffer2)
|
||||
{
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
for (u32 i = 0; i < cnt; i++) {
|
||||
header = &buffer[i];
|
||||
u8 favorite = 0;
|
||||
struct Game_NUM* game_num = CFG_get_game_num(header->id);
|
||||
if (game_num) {
|
||||
favorite = game_num->favorite;
|
||||
}
|
||||
if (favorite==1) {
|
||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||
if (!buffer2) {
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr));
|
||||
cnt2++;
|
||||
}
|
||||
}
|
||||
if (buffer2) {
|
||||
free(buffer);
|
||||
buffer = buffer2;
|
||||
buffer2 = NULL;
|
||||
} else {
|
||||
memset(buffer, 0, len);
|
||||
}
|
||||
cnt = cnt2;
|
||||
}
|
||||
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr));
|
||||
cnt2++;
|
||||
}
|
||||
}
|
||||
if (buffer2) {
|
||||
free(buffer);
|
||||
buffer = buffer2;
|
||||
buffer2 = NULL;
|
||||
} else {
|
||||
memset(buffer, 0, len);
|
||||
}
|
||||
cnt = cnt2;
|
||||
}
|
||||
|
||||
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
||||
u32 cnt2 = 0;
|
||||
if (Settings.parentalcontrol && !Settings.godmode && t==0) {
|
||||
u32 cnt2 = 0;
|
||||
|
||||
for (u32 i = 0; i < cnt; i++)
|
||||
{
|
||||
header = &buffer[i];
|
||||
if (get_block(header) < Settings.parentalcontrol) {
|
||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||
if (!buffer2)
|
||||
{
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
for (u32 i = 0; i < cnt; i++) {
|
||||
header = &buffer[i];
|
||||
if (get_block(header) < Settings.parentalcontrol) {
|
||||
buffer2 = (discHdr *) realloc(buffer2, (cnt2+1) * sizeof(struct discHdr));
|
||||
if (!buffer2) {
|
||||
free(buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr));
|
||||
cnt2++;
|
||||
}
|
||||
}
|
||||
if (buffer2) {
|
||||
free(buffer);
|
||||
buffer = buffer2;
|
||||
buffer2 = NULL;
|
||||
} else {
|
||||
memset(buffer, 0, len);
|
||||
}
|
||||
cnt = cnt2;
|
||||
}
|
||||
memcpy((buffer2 + cnt2), (buffer + i), sizeof(struct discHdr));
|
||||
cnt2++;
|
||||
}
|
||||
}
|
||||
if (buffer2) {
|
||||
free(buffer);
|
||||
buffer = buffer2;
|
||||
buffer2 = NULL;
|
||||
} else {
|
||||
memset(buffer, 0, len);
|
||||
}
|
||||
cnt = cnt2;
|
||||
}
|
||||
|
||||
if (Settings.sort==pcount) {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
||||
}
|
||||
else {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp);
|
||||
}
|
||||
if (Settings.sort==pcount) {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmpCount);
|
||||
} else {
|
||||
qsort(buffer, cnt, sizeof(struct discHdr), __Menu_EntryCmp);
|
||||
}
|
||||
|
||||
/* Free memory */
|
||||
if (gameList)
|
||||
free(gameList);
|
||||
/* Free memory */
|
||||
if (gameList)
|
||||
free(gameList);
|
||||
|
||||
/* Set values */
|
||||
gameList = buffer;
|
||||
buffer = NULL;
|
||||
gameCnt = cnt;
|
||||
/* Set values */
|
||||
gameList = buffer;
|
||||
buffer = NULL;
|
||||
gameCnt = cnt;
|
||||
|
||||
/* Reset variables */
|
||||
gameSelected = gameStart = 0;
|
||||
/* Reset variables */
|
||||
gameSelected = gameStart = 0;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
#define _GETENTRIES_H_
|
||||
|
||||
//! param t
|
||||
//! make this 1 if you want the function to ignore the rules
|
||||
//! make this 1 if you want the function to ignore the rules
|
||||
//! (settings and parental control) when making the game list.
|
||||
//!
|
||||
//!
|
||||
int __Menu_GetEntries(int t=0);
|
||||
|
||||
#endif
|
||||
|
@ -8,44 +8,43 @@
|
||||
|
||||
/* 'partition table' structure */
|
||||
typedef struct {
|
||||
/* Zero bytes */
|
||||
u8 padding[446];
|
||||
/* Zero bytes */
|
||||
u8 padding[446];
|
||||
|
||||
/* Partition table entries */
|
||||
partitionEntry entries[MAX_PARTITIONS];
|
||||
/* Partition table entries */
|
||||
partitionEntry entries[MAX_PARTITIONS];
|
||||
} ATTRIBUTE_PACKED partitionTable;
|
||||
|
||||
|
||||
s32 Partition_GetEntries(partitionEntry *outbuf, u32 *outval)
|
||||
{
|
||||
static partitionTable table ATTRIBUTE_ALIGN(32);
|
||||
s32 Partition_GetEntries(partitionEntry *outbuf, u32 *outval) {
|
||||
static partitionTable table ATTRIBUTE_ALIGN(32);
|
||||
|
||||
u32 cnt, sector_size;
|
||||
s32 ret;
|
||||
u32 cnt, sector_size;
|
||||
s32 ret;
|
||||
|
||||
/* Get sector size */
|
||||
ret = USBStorage_GetCapacity(§or_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Get sector size */
|
||||
ret = USBStorage_GetCapacity(§or_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Read partition table */
|
||||
ret = USBStorage_ReadSectors(0, 1, &table);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/* Read partition table */
|
||||
ret = USBStorage_ReadSectors(0, 1, &table);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Swap endianess */
|
||||
for (cnt = 0; cnt < 4; cnt++) {
|
||||
partitionEntry *entry = &table.entries[cnt];
|
||||
/* Swap endianess */
|
||||
for (cnt = 0; cnt < 4; cnt++) {
|
||||
partitionEntry *entry = &table.entries[cnt];
|
||||
|
||||
entry->sector = swap32(entry->sector);
|
||||
entry->size = swap32(entry->size);
|
||||
}
|
||||
entry->sector = swap32(entry->sector);
|
||||
entry->size = swap32(entry->size);
|
||||
}
|
||||
|
||||
/* Set partition entries */
|
||||
memcpy(outbuf, table.entries, sizeof(table.entries));
|
||||
/* Set partition entries */
|
||||
memcpy(outbuf, table.entries, sizeof(table.entries));
|
||||
|
||||
/* Set sector size */
|
||||
*outval = sector_size;
|
||||
/* Set sector size */
|
||||
*outval = sector_size;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,40 +1,39 @@
|
||||
#ifndef _PARTITION_H_
|
||||
#ifndef _PARTITION_H_
|
||||
#define _PARTITION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* 'partition entry' structure */
|
||||
typedef struct {
|
||||
/* Boot indicator */
|
||||
u8 boot;
|
||||
|
||||
/* Starting CHS */
|
||||
u8 start[3];
|
||||
|
||||
/* Partition type */
|
||||
u8 type;
|
||||
|
||||
/* Ending CHS */
|
||||
u8 end[3];
|
||||
|
||||
/* Partition sector */
|
||||
u32 sector;
|
||||
|
||||
/* Partition size */
|
||||
u32 size;
|
||||
} ATTRIBUTE_PACKED partitionEntry;
|
||||
|
||||
/* Constants */
|
||||
#define MAX_PARTITIONS 4
|
||||
|
||||
/* Prototypes */
|
||||
s32 Partition_GetEntries(partitionEntry *, u32 *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 'partition entry' structure */
|
||||
typedef struct {
|
||||
/* Boot indicator */
|
||||
u8 boot;
|
||||
|
||||
/* Starting CHS */
|
||||
u8 start[3];
|
||||
|
||||
/* Partition type */
|
||||
u8 type;
|
||||
|
||||
/* Ending CHS */
|
||||
u8 end[3];
|
||||
|
||||
/* Partition sector */
|
||||
u32 sector;
|
||||
|
||||
/* Partition size */
|
||||
u32 size;
|
||||
} ATTRIBUTE_PACKED partitionEntry;
|
||||
|
||||
/* Constants */
|
||||
#define MAX_PARTITIONS 4
|
||||
|
||||
/* Prototypes */
|
||||
s32 Partition_GetEntries(partitionEntry *, u32 *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -20,140 +20,134 @@ static s32 hid = -1, fd = -1;
|
||||
static u32 sector_size = SDHC_SECTOR_SIZE;
|
||||
|
||||
|
||||
bool SDHC_Init(void)
|
||||
{
|
||||
s32 ret;
|
||||
|
||||
/* Already open */
|
||||
if (fd > 0)
|
||||
return true;
|
||||
bool SDHC_Init(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Create heap */
|
||||
if (hid < 0) {
|
||||
hid = iosCreateHeap(SDHC_HEAPSIZE);
|
||||
if (hid < 0)
|
||||
goto err;
|
||||
}
|
||||
/* Already open */
|
||||
if (fd > 0)
|
||||
return true;
|
||||
|
||||
/* Open SDHC device */
|
||||
fd = IOS_Open(fs, 0);
|
||||
if (fd < 0)
|
||||
goto err;
|
||||
/* Create heap */
|
||||
if (hid < 0) {
|
||||
hid = iosCreateHeap(SDHC_HEAPSIZE);
|
||||
if (hid < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Initialize SDHC */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_INIT, ":");
|
||||
if (ret)
|
||||
goto err;
|
||||
/* Open SDHC device */
|
||||
fd = IOS_Open(fs, 0);
|
||||
if (fd < 0)
|
||||
goto err;
|
||||
|
||||
return true;
|
||||
/* Initialize SDHC */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_INIT, ":");
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return true;
|
||||
|
||||
err:
|
||||
/* Close SDHC device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
/* Close SDHC device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDHC_Close(void)
|
||||
{
|
||||
/* Close SDHC device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
bool SDHC_Close(void) {
|
||||
/* Close SDHC device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDHC_IsInserted(void)
|
||||
{
|
||||
s32 ret;
|
||||
bool SDHC_IsInserted(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Check if SD card is inserted */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_ISINSERTED, ":");
|
||||
/* Check if SD card is inserted */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_ISINSERTED, ":");
|
||||
|
||||
return (!ret) ? true : false;
|
||||
return (!ret) ? true : false;
|
||||
}
|
||||
|
||||
bool SDHC_ReadSectors(u32 sector, u32 count, void *buffer)
|
||||
{
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * count);
|
||||
bool SDHC_ReadSectors(u32 sector, u32 count, void *buffer) {
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * count);
|
||||
|
||||
s32 ret;
|
||||
s32 ret;
|
||||
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return false;
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return false;
|
||||
|
||||
/* Buffer not aligned */
|
||||
if ((u32)buffer & 0x1F) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return false;
|
||||
}
|
||||
/* Buffer not aligned */
|
||||
if ((u32)buffer & 0x1F) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_READ, "ii:d", sector, count, buf, len);
|
||||
/* Read data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_READ, "ii:d", sector, count, buf, len);
|
||||
|
||||
/* Copy data */
|
||||
if (buf != buffer) {
|
||||
memcpy(buffer, buf, len);
|
||||
iosFree(hid, buf);
|
||||
}
|
||||
/* Copy data */
|
||||
if (buf != buffer) {
|
||||
memcpy(buffer, buf, len);
|
||||
iosFree(hid, buf);
|
||||
}
|
||||
|
||||
return (!ret) ? true : false;
|
||||
return (!ret) ? true : false;
|
||||
}
|
||||
|
||||
bool SDHC_WriteSectors(u32 sector, u32 count, void *buffer)
|
||||
{
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * count);
|
||||
bool SDHC_WriteSectors(u32 sector, u32 count, void *buffer) {
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * count);
|
||||
|
||||
s32 ret;
|
||||
s32 ret;
|
||||
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return false;
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return false;
|
||||
|
||||
/* Buffer not aligned */
|
||||
if ((u32)buffer & 0x1F) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return false;
|
||||
/* Buffer not aligned */
|
||||
if ((u32)buffer & 0x1F) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return false;
|
||||
|
||||
/* Copy data */
|
||||
memcpy(buf, buffer, len);
|
||||
}
|
||||
/* Copy data */
|
||||
memcpy(buf, buffer, len);
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_WRITE, "ii:d", sector, count, buf, len);
|
||||
/* Read data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, IOCTL_SDHC_WRITE, "ii:d", sector, count, buf, len);
|
||||
|
||||
/* Free memory */
|
||||
if (buf != buffer)
|
||||
iosFree(hid, buf);
|
||||
/* Free memory */
|
||||
if (buf != buffer)
|
||||
iosFree(hid, buf);
|
||||
|
||||
return (!ret) ? true : false;
|
||||
return (!ret) ? true : false;
|
||||
}
|
||||
|
||||
bool SDHC_ClearStatus(void)
|
||||
{
|
||||
return true;
|
||||
bool SDHC_ClearStatus(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const DISC_INTERFACE __io_sdhc = {
|
||||
DEVICE_TYPE_WII_SD,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_SD,
|
||||
(FN_MEDIUM_STARTUP)&SDHC_Init,
|
||||
(FN_MEDIUM_ISINSERTED)&SDHC_IsInserted,
|
||||
(FN_MEDIUM_READSECTORS)&SDHC_ReadSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&SDHC_WriteSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&SDHC_ClearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&SDHC_Close
|
||||
DEVICE_TYPE_WII_SD,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_SD,
|
||||
(FN_MEDIUM_STARTUP)&SDHC_Init,
|
||||
(FN_MEDIUM_ISINSERTED)&SDHC_IsInserted,
|
||||
(FN_MEDIUM_READSECTORS)&SDHC_ReadSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&SDHC_WriteSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&SDHC_ClearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&SDHC_Close
|
||||
};
|
||||
|
@ -5,15 +5,14 @@
|
||||
#define SDHC_SECTOR_SIZE 0x200
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Prototypes */
|
||||
bool SDHC_Init(void);
|
||||
bool SDHC_Close(void);
|
||||
bool SDHC_ReadSectors(u32, u32, void *);
|
||||
bool SDHC_WriteSectors(u32, u32, void *);
|
||||
/* Prototypes */
|
||||
bool SDHC_Init(void);
|
||||
bool SDHC_Close(void);
|
||||
bool SDHC_ReadSectors(u32, u32, void *);
|
||||
bool SDHC_WriteSectors(u32, u32, void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ distribution.
|
||||
#define USB_IOCTL_UMS_READ_SECTORS (UMS_BASE+0x3)
|
||||
#define USB_IOCTL_UMS_WRITE_SECTORS (UMS_BASE+0x4)
|
||||
#define USB_IOCTL_UMS_READ_STRESS (UMS_BASE+0x5)
|
||||
#define USB_IOCTL_UMS_SET_VERBOSE (UMS_BASE+0x6)
|
||||
#define USB_IOCTL_UMS_UNMOUNT (UMS_BASE+0x10)
|
||||
#define USB_IOCTL_UMS_SET_VERBOSE (UMS_BASE+0x6)
|
||||
#define USB_IOCTL_UMS_UNMOUNT (UMS_BASE+0x10)
|
||||
#define USB_IOCTL_UMS_WATCHDOG (UMS_BASE+0x80)
|
||||
|
||||
#define UMS_HEAPSIZE 0x10000
|
||||
@ -51,249 +51,232 @@ static s32 hid = -1, fd = -1;
|
||||
static u32 sector_size;
|
||||
|
||||
|
||||
inline s32 __USBStorage_isMEM2Buffer(const void *buffer)
|
||||
{
|
||||
u32 high_addr = ((u32)buffer) >> 24;
|
||||
inline s32 __USBStorage_isMEM2Buffer(const void *buffer) {
|
||||
u32 high_addr = ((u32)buffer) >> 24;
|
||||
|
||||
return (high_addr == 0x90) || (high_addr == 0xD0);
|
||||
return (high_addr == 0x90) || (high_addr == 0xD0);
|
||||
}
|
||||
|
||||
|
||||
s32 USBStorage_GetCapacity(u32 *_sector_size)
|
||||
{
|
||||
if (fd > 0) {
|
||||
s32 ret;
|
||||
s32 USBStorage_GetCapacity(u32 *_sector_size) {
|
||||
if (fd > 0) {
|
||||
s32 ret;
|
||||
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_GET_CAPACITY, ":i", §or_size);
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_GET_CAPACITY, ":i", §or_size);
|
||||
|
||||
if (ret && _sector_size)
|
||||
*_sector_size = sector_size;
|
||||
if (ret && _sector_size)
|
||||
*_sector_size = sector_size;
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
return IPC_ENOENT;
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
s32 USBStorage_Init(void)
|
||||
{
|
||||
s32 ret;
|
||||
s32 USBStorage_Init(void) {
|
||||
s32 ret;
|
||||
|
||||
/* Already open */
|
||||
if (fd > 0)
|
||||
return 0;
|
||||
/* Already open */
|
||||
if (fd > 0)
|
||||
return 0;
|
||||
|
||||
/* Create heap */
|
||||
if (hid < 0) {
|
||||
hid = iosCreateHeap(UMS_HEAPSIZE);
|
||||
if (hid < 0)
|
||||
return IPC_ENOMEM;
|
||||
}
|
||||
/* Create heap */
|
||||
if (hid < 0) {
|
||||
hid = iosCreateHeap(UMS_HEAPSIZE);
|
||||
if (hid < 0)
|
||||
return IPC_ENOMEM;
|
||||
}
|
||||
|
||||
/* Open USB device */
|
||||
fd = IOS_Open(fs, 0);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
/* Open USB device */
|
||||
fd = IOS_Open(fs, 0);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
/* Initialize USB storage */
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_INIT, ":");
|
||||
if(ret<0) goto err;
|
||||
/* Initialize USB storage */
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_INIT, ":");
|
||||
if (ret<0) goto err;
|
||||
|
||||
/* Get device capacity */
|
||||
ret = USBStorage_GetCapacity(NULL);
|
||||
if (!ret)
|
||||
goto err;
|
||||
/* Get device capacity */
|
||||
ret = USBStorage_GetCapacity(NULL);
|
||||
if (!ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
err:
|
||||
/* Close USB device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
/* Close USB device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Hermes **/
|
||||
s32 USBStorage_Watchdog(u32 on_off)
|
||||
{
|
||||
if (fd >= 0) {
|
||||
s32 ret;
|
||||
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WATCHDOG, "i:", on_off);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
s32 USBStorage_Umount(void)
|
||||
{
|
||||
if (fd >= 0) {
|
||||
s32 ret;
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
void USBStorage_Deinit(void)
|
||||
{
|
||||
/* Close USB device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer)
|
||||
{
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * numSectors);
|
||||
|
||||
s32 ret;
|
||||
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
/* MEM1 buffer */
|
||||
if (!__USBStorage_isMEM2Buffer(buffer)) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return IPC_ENOMEM;
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, numSectors, buf, len);
|
||||
|
||||
/* Copy data */
|
||||
if (buf != buffer) {
|
||||
memcpy(buffer, buf, len);
|
||||
iosFree(hid, buf);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer)
|
||||
{
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * numSectors);
|
||||
/** Hermes **/
|
||||
s32 USBStorage_Watchdog(u32 on_off) {
|
||||
if (fd >= 0) {
|
||||
s32 ret;
|
||||
|
||||
s32 ret;
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WATCHDOG, "i:", on_off);
|
||||
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MEM1 buffer */
|
||||
if (!__USBStorage_isMEM2Buffer(buffer)) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return IPC_ENOMEM;
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
/* Copy data */
|
||||
memcpy(buf, buffer, len);
|
||||
}
|
||||
s32 USBStorage_Umount(void) {
|
||||
if (fd >= 0) {
|
||||
s32 ret;
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Write data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, numSectors, buf, len);
|
||||
return IPC_ENOENT;
|
||||
}
|
||||
|
||||
/* Free memory */
|
||||
if (buf != buffer)
|
||||
iosFree(hid, buf);
|
||||
void USBStorage_Deinit(void) {
|
||||
/* Close USB device */
|
||||
if (fd > 0) {
|
||||
IOS_Close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) {
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * numSectors);
|
||||
|
||||
s32 ret;
|
||||
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
/* MEM1 buffer */
|
||||
if (!__USBStorage_isMEM2Buffer(buffer)) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return IPC_ENOMEM;
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, numSectors, buf, len);
|
||||
|
||||
/* Copy data */
|
||||
if (buf != buffer) {
|
||||
memcpy(buffer, buf, len);
|
||||
iosFree(hid, buf);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer) {
|
||||
void *buf = (void *)buffer;
|
||||
u32 len = (sector_size * numSectors);
|
||||
|
||||
s32 ret;
|
||||
|
||||
/* Device not opened */
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
/* MEM1 buffer */
|
||||
if (!__USBStorage_isMEM2Buffer(buffer)) {
|
||||
/* Allocate memory */
|
||||
buf = iosAlloc(hid, len);
|
||||
if (!buf)
|
||||
return IPC_ENOMEM;
|
||||
|
||||
/* Copy data */
|
||||
memcpy(buf, buffer, len);
|
||||
}
|
||||
|
||||
/* Write data */
|
||||
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, numSectors, buf, len);
|
||||
|
||||
/* Free memory */
|
||||
if (buf != buffer)
|
||||
iosFree(hid, buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#define DEVICE_TYPE_WII_UMS (('W'<<24)|('U'<<16)|('M'<<8)|'S')
|
||||
|
||||
|
||||
bool umsio_Startup()
|
||||
{
|
||||
return USBStorage_Init() == 0;
|
||||
bool umsio_Startup() {
|
||||
return USBStorage_Init() == 0;
|
||||
}
|
||||
|
||||
bool umsio_IsInserted()
|
||||
{
|
||||
return true; // allways true
|
||||
bool umsio_IsInserted() {
|
||||
return true; // allways true
|
||||
}
|
||||
bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer)
|
||||
{
|
||||
u32 cnt = 0;
|
||||
s32 ret;
|
||||
/* Do reads */
|
||||
while (cnt < numSectors)
|
||||
{
|
||||
u32 sectors = (numSectors - cnt);
|
||||
bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer) {
|
||||
u32 cnt = 0;
|
||||
s32 ret;
|
||||
/* Do reads */
|
||||
while (cnt < numSectors) {
|
||||
u32 sectors = (numSectors - cnt);
|
||||
|
||||
/* Read sectors is too big */
|
||||
if (sectors > 32)
|
||||
sectors = 32;
|
||||
/* Read sectors is too big */
|
||||
if (sectors > 32)
|
||||
sectors = 32;
|
||||
|
||||
/* USB read */
|
||||
ret = USBStorage_ReadSectors(sector + cnt, sectors, &buffer[cnt*512]);
|
||||
if (ret < 0)
|
||||
return false;
|
||||
/* USB read */
|
||||
ret = USBStorage_ReadSectors(sector + cnt, sectors, &buffer[cnt*512]);
|
||||
if (ret < 0)
|
||||
return false;
|
||||
|
||||
/* Increment counter */
|
||||
cnt += sectors;
|
||||
}
|
||||
/* Increment counter */
|
||||
cnt += sectors;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer)
|
||||
{
|
||||
u32 cnt = 0;
|
||||
s32 ret;
|
||||
bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer) {
|
||||
u32 cnt = 0;
|
||||
s32 ret;
|
||||
|
||||
/* Do writes */
|
||||
while (cnt < numSectors)
|
||||
{
|
||||
u32 sectors = (numSectors - cnt);
|
||||
/* Do writes */
|
||||
while (cnt < numSectors) {
|
||||
u32 sectors = (numSectors - cnt);
|
||||
|
||||
/* Write sectors is too big */
|
||||
if (sectors > 32)
|
||||
sectors = 32;
|
||||
/* Write sectors is too big */
|
||||
if (sectors > 32)
|
||||
sectors = 32;
|
||||
|
||||
/* USB write */
|
||||
ret = USBStorage_WriteSectors(sector + cnt, sectors, &buffer[cnt * 512]);
|
||||
if (ret < 0)
|
||||
return false;
|
||||
/* USB write */
|
||||
ret = USBStorage_WriteSectors(sector + cnt, sectors, &buffer[cnt * 512]);
|
||||
if (ret < 0)
|
||||
return false;
|
||||
|
||||
/* Increment counter */
|
||||
cnt += sectors;
|
||||
}
|
||||
/* Increment counter */
|
||||
cnt += sectors;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
bool umsio_ClearStatus(void)
|
||||
{
|
||||
return true;
|
||||
bool umsio_ClearStatus(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool umsio_Shutdown()
|
||||
{
|
||||
USBStorage_Deinit();
|
||||
return true;
|
||||
bool umsio_Shutdown() {
|
||||
USBStorage_Deinit();
|
||||
return true;
|
||||
}
|
||||
const DISC_INTERFACE __io_wiiums =
|
||||
{
|
||||
DEVICE_TYPE_WII_UMS,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
|
||||
(FN_MEDIUM_STARTUP)&umsio_Startup,
|
||||
(FN_MEDIUM_ISINSERTED)&umsio_IsInserted,
|
||||
(FN_MEDIUM_READSECTORS)&umsio_ReadSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&umsio_WriteSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&umsio_ClearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&umsio_Shutdown
|
||||
const DISC_INTERFACE __io_wiiums = {
|
||||
DEVICE_TYPE_WII_UMS,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
|
||||
(FN_MEDIUM_STARTUP)&umsio_Startup,
|
||||
(FN_MEDIUM_ISINSERTED)&umsio_IsInserted,
|
||||
(FN_MEDIUM_READSECTORS)&umsio_ReadSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&umsio_WriteSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&umsio_ClearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&umsio_Shutdown
|
||||
};
|
||||
|
@ -1,20 +1,19 @@
|
||||
#ifndef _USBSTORAGE_H_
|
||||
#ifndef _USBSTORAGE_H_
|
||||
#define _USBSTORAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* Prototypes */
|
||||
s32 USBStorage_GetCapacity(u32 *);
|
||||
s32 USBStorage_Init(void);
|
||||
void USBStorage_Deinit(void);
|
||||
s32 USBStorage_Watchdog(u32 on_off);
|
||||
s32 USBStorage_ReadSectors(u32, u32, void *);
|
||||
s32 USBStorage_WriteSectors(u32, u32, const void *);
|
||||
extern const DISC_INTERFACE __io_wiiums;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Prototypes */
|
||||
s32 USBStorage_GetCapacity(u32 *);
|
||||
s32 USBStorage_Init(void);
|
||||
void USBStorage_Deinit(void);
|
||||
s32 USBStorage_Watchdog(u32 on_off);
|
||||
s32 USBStorage_ReadSectors(u32, u32, void *);
|
||||
s32 USBStorage_WriteSectors(u32, u32, const void *);
|
||||
extern const DISC_INTERFACE __io_wiiums;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user