-added some trick to get all wii games to work without booting

problems or blackscreens (test it please)
-changed play button in full screen banner back to the right side
(jiiwah, why you changed that? It's right in the system menu)
This commit is contained in:
fix94.1 2012-08-09 19:50:59 +00:00
parent c5a19ee450
commit 9f9c455aa9
5 changed files with 72 additions and 4 deletions

View File

@ -58,7 +58,7 @@ ios := 249
CFLAGS = -g -O2 -Wall -Wextra -Wno-multichar $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H CFLAGS = -g -O2 -Wall -Wextra -Wno-multichar $(MACHDEP) $(INCLUDE) -DHAVE_CONFIG_H
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80A00000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80A00000,-wrap,malloc,-wrap,_malloc_r,-wrap,free,-wrap,_free_r,-wrap,memalign,-wrap,_memalign_r,-wrap,calloc,-wrap,_calloc_r,-wrap,realloc,-wrap,_realloc_r,-wrap,malloc_usable_size,-wrap,_malloc_usable_size_r
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # any extra libraries we wish to link with the project

View File

@ -59,7 +59,8 @@ s32 Apploader_Run(entry_point *entry, u8 vidMode, GXRModeObj *vmode, bool vipatc
/* Calculate apploader length */ /* Calculate apploader length */
appldr_len = buffer[5] + buffer[6]; appldr_len = buffer[5] + buffer[6];
SYS_SetArena1Hi((void *)0x816FFFF0); //Kills the possibility of codedumps with gprintf /* Clear Apploader region (important buffers are under that) */
memset((void*)0x81200000, 0, 0x500000);
/* Read apploader code */ /* Read apploader code */
ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20); ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20);

View File

@ -23,6 +23,20 @@ extern __typeof(memalign) __real_memalign;
extern __typeof(free) __real_free; extern __typeof(free) __real_free;
extern __typeof(malloc_usable_size) __real_malloc_usable_size; extern __typeof(malloc_usable_size) __real_malloc_usable_size;
extern __typeof(_malloc_r) __real__malloc_r;
extern __typeof(_calloc_r) __real__calloc_r;
extern __typeof(_realloc_r) __real__realloc_r;
extern __typeof(_memalign_r) __real__memalign_r;
extern __typeof(_free_r) __real__free_r;
extern __typeof(_malloc_usable_size_r) __real__malloc_usable_size_r;
bool first_mem = true;
void DisableMEM1allocR()
{
first_mem = false;
}
void *MEM1_alloc(unsigned int s) void *MEM1_alloc(unsigned int s)
{ {
return __real_malloc(s); return __real_malloc(s);
@ -111,6 +125,14 @@ void *__wrap_malloc(size_t size)
return g_mem2gp.allocate(size); return g_mem2gp.allocate(size);
} }
void *__wrap__malloc_r(struct _reent *r, size_t size)
{
if(first_mem)
return __real__malloc_r(r, size);
return MEM2_alloc(size);
}
void *__wrap_calloc(size_t n, size_t size) void *__wrap_calloc(size_t n, size_t size)
{ {
void *p; void *p;
@ -134,6 +156,17 @@ void *__wrap_calloc(size_t n, size_t size)
return p; return p;
} }
void *__wrap__calloc_r(struct _reent *r, size_t n, size_t size)
{
if(first_mem)
return __real__calloc_r(r, n, size);
void *p = MEM2_alloc(n*size);
if(p)
memset(p, 0, n*size);
return p;
}
void *__wrap_memalign(size_t a, size_t size) void *__wrap_memalign(size_t a, size_t size)
{ {
void *p; void *p;
@ -154,6 +187,14 @@ void *__wrap_memalign(size_t a, size_t size)
return g_mem2gp.allocate(size); return g_mem2gp.allocate(size);
} }
void *__wrap__memalign_r(struct _reent *r, size_t a, size_t size)
{
if(first_mem)
return __real__memalign_r(r, a, size);
return MEM2_alloc(size);
}
void __wrap_free(void *p) void __wrap_free(void *p)
{ {
if(!p) if(!p)
@ -165,6 +206,14 @@ void __wrap_free(void *p)
__real_free(p); __real_free(p);
} }
void __wrap__free_r(struct _reent *r, void *p)
{
if(first_mem)
__real__free_r(r, p);
else
MEM2_free(p);
}
void *__wrap_realloc(void *p, size_t size) void *__wrap_realloc(void *p, size_t size)
{ {
void *n; void *n;
@ -199,6 +248,14 @@ void *__wrap_realloc(void *p, size_t size)
return n; return n;
} }
void *__wrap__realloc_r(struct _reent *r, void *p, size_t size)
{
if(first_mem)
return __real__realloc_r(r, p, size);
return MEM2_realloc(p, size);
}
size_t __wrap_malloc_usable_size(void *p) size_t __wrap_malloc_usable_size(void *p)
{ {
if(((u32)p & 0x10000000) != 0) if(((u32)p & 0x10000000) != 0)
@ -206,4 +263,12 @@ size_t __wrap_malloc_usable_size(void *p)
return __real_malloc_usable_size(p); return __real_malloc_usable_size(p);
} }
size_t __wrap__malloc_usable_size_r(struct _reent *r, void *p)
{
if(first_mem)
return __real__malloc_usable_size_r(r, p);
return CMEM2Alloc::usableSize(p);
}
} ///extern "C" } ///extern "C"

View File

@ -26,6 +26,7 @@ void *MEM2_memalign(unsigned int /* alignment */, unsigned int s);
void *MEM2_realloc(void *p, unsigned int s); void *MEM2_realloc(void *p, unsigned int s);
unsigned int MEM2_usableSize(void *p); unsigned int MEM2_usableSize(void *p);
unsigned int MEM2_freesize(); unsigned int MEM2_freesize();
void DisableMEM1allocR();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1420,6 +1420,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
if(strncasecmp(id.c_str(), discid, 6) != 0) if(strncasecmp(id.c_str(), discid, 6) != 0)
return; return;
DisableMEM1allocR();
RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo); RunApploader(offset, videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo);
gprintf("Booting game\n"); gprintf("Booting game\n");
Disc_BootPartition(); Disc_BootPartition();
@ -1470,8 +1471,8 @@ void CMenu::_initGameMenu(CMenu::SThemeData &theme)
m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 200, 48, 48); m_gameBtnAdultOff = _addPicButton(theme, "GAME/ADULTONLY_OFF", texAdultOff, texAdultOffSel, 532, 200, 48, 48);
m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48); m_gameBtnSettings = _addPicButton(theme, "GAME/SETTINGS_BTN", texSettings, texSettingsSel, 460, 272, 48, 48);
m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48); m_gameBtnDelete = _addPicButton(theme, "GAME/DELETE_BTN", texDelete, texDeleteSel, 532, 272, 48, 48);
m_gameBtnPlayFull = _addButton(theme, "GAME/PLAY_FULL_BTN", theme.btnFont, L"", 100, 390, 200, 56, theme.btnFontColor); m_gameBtnBackFull = _addButton(theme, "GAME/BACK_FULL_BTN", theme.btnFont, L"", 100, 390, 200, 56, theme.btnFontColor);
m_gameBtnBackFull = _addButton(theme, "GAME/BACK_FULL_BTN", theme.btnFont, L"", 340, 390, 200, 56, theme.btnFontColor); m_gameBtnPlayFull = _addButton(theme, "GAME/PLAY_FULL_BTN", theme.btnFont, L"", 340, 390, 200, 56, theme.btnFontColor);
m_gameBtnToogle = _addPicButton(theme, "GAME/TOOGLE_BTN", texToogleBanner, texToogleBanner, 385, 31, 236, 127); m_gameBtnToogle = _addPicButton(theme, "GAME/TOOGLE_BTN", texToogleBanner, texToogleBanner, 385, 31, 236, 127);
m_gameBtnToogleFull = _addPicButton(theme, "GAME/TOOGLE_FULL_BTN", texToogleBanner, texToogleBanner, 20, 12, 608, 344); m_gameBtnToogleFull = _addPicButton(theme, "GAME/TOOGLE_FULL_BTN", texToogleBanner, texToogleBanner, 20, 12, 608, 344);