mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-12-25 03:11:58 +01:00
* Added a simpel check to find out if installed MIOS is unpatched, cMIOS or DML and it should be able to recognize most of them.
* DML Coverview is now disabled if the MIOS found isn't recognized as DML * DML game subfolder naming convention may now change to 'Game Name' for example. No need to keep this as GameID anymore * Current_item config option is now saved while launching DML GC games * Playcount & Lastplayed options are now saved for DML GC games
This commit is contained in:
parent
95a49ea97c
commit
74450fba18
@ -151,6 +151,10 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
|
|||||||
tmp.hdr.casecolor = 0;
|
tmp.hdr.casecolor = 0;
|
||||||
|
|
||||||
tmp.hdr.gc_magic = 0xc2339f3d;
|
tmp.hdr.gc_magic = 0xc2339f3d;
|
||||||
|
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||||
|
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||||
|
strcpy( tmp.path, (*itr).c_str() );
|
||||||
|
gprintf("Found: %s\n", tmp.path);
|
||||||
headerlist.push_back( tmp );
|
headerlist.push_back( tmp );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -164,6 +168,10 @@ void CList<dir_discHdr>::GetHeaders(safe_vector<string> pathlist, safe_vector<di
|
|||||||
mbstowcs( tmp.title, (const char *)tmp.hdr.title, sizeof( tmp.hdr.title ) );
|
mbstowcs( tmp.title, (const char *)tmp.hdr.title, sizeof( tmp.hdr.title ) );
|
||||||
Asciify(tmp.title);
|
Asciify(tmp.title);
|
||||||
tmp.hdr.casecolor = 0;
|
tmp.hdr.casecolor = 0;
|
||||||
|
(*itr)[(*itr).find_last_of('/')] = 0;
|
||||||
|
(*itr).assign(&(*itr)[(*itr).find_last_of('/') + 1]);
|
||||||
|
strcpy( tmp.path, (*itr).c_str() );
|
||||||
|
gprintf("Found: %s\n", tmp.path);
|
||||||
headerlist.push_back( tmp );
|
headerlist.push_back( tmp );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,9 @@ u32 le32(u32);
|
|||||||
u16 le16(u16);
|
u16 le16(u16);
|
||||||
int makedir(char *newdir);
|
int makedir(char *newdir);
|
||||||
|
|
||||||
|
typedef volatile unsigned short vu16;
|
||||||
|
typedef volatile unsigned int vu32;
|
||||||
|
|
||||||
bool str_replace(char *str, const char *olds, const char *news, int size);
|
bool str_replace(char *str, const char *olds, const char *news, int size);
|
||||||
bool str_replace_all(char *str, const char *olds, const char *news, int size);
|
bool str_replace_all(char *str, const char *olds, const char *news, int size);
|
||||||
|
|
||||||
|
@ -1801,3 +1801,46 @@ void CMenu::UpdateCache(u32 view)
|
|||||||
|
|
||||||
m_cfg.setBool(domain, "update_cache", true);
|
m_cfg.setBool(domain, "update_cache", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMenu::MIOSisDML()
|
||||||
|
{
|
||||||
|
u32 length;
|
||||||
|
if( ES_GetStoredTMDSize( 0x100000101LL, &length ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
signed_blob *TMD = (signed_blob*)MEM2_alloc( ALIGN32(length) );
|
||||||
|
if( !TMD )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( ES_GetStoredTMD( 0x100000101LL, TMD, length ) < 0 )
|
||||||
|
{
|
||||||
|
SAFE_FREE( TMD );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( *(u16*)((u32)TMD+0x1E2) )
|
||||||
|
{
|
||||||
|
u32 size = 0;
|
||||||
|
char path[256];
|
||||||
|
sprintf( path, "/title/00000001/00000101/content/%.08x.app", *(u8*)((u32)TMD+0x1E7) );
|
||||||
|
u8 *appfile = ISFS_GetFile( (u8 *)path, &size, 0x10 );
|
||||||
|
if(appfile)
|
||||||
|
{
|
||||||
|
if( *(u32*)appfile == 0x6D696F73 )
|
||||||
|
{
|
||||||
|
if( *(u32*)(appfile+0x08) == 0x38323430 && *(u32*)(appfile+0x0c) == 0x32353300 )
|
||||||
|
{
|
||||||
|
if( *(u16*)((u32)TMD+0x1E2) != 0x037B )
|
||||||
|
{
|
||||||
|
gprintf( "MIOSisDML: YES!\n" );
|
||||||
|
SAFE_FREE( TMD );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gprintf( "MIOSisDML: No!\n" );
|
||||||
|
SAFE_FREE(TMD);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -713,7 +713,7 @@ private:
|
|||||||
void _launchGame(dir_discHdr *hdr, bool dvd);
|
void _launchGame(dir_discHdr *hdr, bool dvd);
|
||||||
void _launchChannel(dir_discHdr *hdr);
|
void _launchChannel(dir_discHdr *hdr);
|
||||||
void _launchHomebrew(const char *filepath, safe_vector<std::string> arguments);
|
void _launchHomebrew(const char *filepath, safe_vector<std::string> arguments);
|
||||||
void _launchGC(const char *id, bool DML);
|
void _launchGC(dir_discHdr *hdr, bool DML);
|
||||||
void _setAA(int aa);
|
void _setAA(int aa);
|
||||||
void _loadCFCfg(SThemeData &theme);
|
void _loadCFCfg(SThemeData &theme);
|
||||||
void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false);
|
void _loadCFLayout(int version, bool forceAA = false, bool otherScrnFmt = false);
|
||||||
@ -726,6 +726,7 @@ private:
|
|||||||
void _cleanupDefaultFont();
|
void _cleanupDefaultFont();
|
||||||
const char *_domainFromView(void);
|
const char *_domainFromView(void);
|
||||||
void UpdateCache(u32 view = COVERFLOW_MAX);
|
void UpdateCache(u32 view = COVERFLOW_MAX);
|
||||||
|
bool MIOSisDML();
|
||||||
SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey);
|
SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey);
|
||||||
STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def);
|
STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def);
|
||||||
safe_vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key);
|
safe_vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key);
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "gc/gc.h"
|
#include "gc/gc.h"
|
||||||
|
|
||||||
|
//#define DML_THROUGH_MEM /*** Load game through mem.. Not compatible with regulair DML ***/
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
extern const u8 btngamecfg_png[];
|
extern const u8 btngamecfg_png[];
|
||||||
@ -536,65 +538,100 @@ void CMenu::_launch(dir_discHdr *hdr)
|
|||||||
switch(m_current_view)
|
switch(m_current_view)
|
||||||
{
|
{
|
||||||
case COVERFLOW_HOMEBREW:
|
case COVERFLOW_HOMEBREW:
|
||||||
_launchHomebrew((char *)hdr->path, m_homebrewArgs);
|
_launchHomebrew( (char *)hdr->path, m_homebrewArgs );
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_CHANNEL:
|
case COVERFLOW_CHANNEL:
|
||||||
_launchChannel(hdr);
|
_launchChannel( hdr );
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_DML:
|
case COVERFLOW_DML:
|
||||||
_launchGC((const char*)hdr->hdr.id,true);
|
_launchGC( hdr, true );
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_USB:
|
case COVERFLOW_USB:
|
||||||
default:
|
default:
|
||||||
_launchGame(hdr, false);
|
_launchGame( hdr, false );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {extern void USBStorage_Deinit(void);}
|
extern "C" {extern void USBStorage_Deinit(void);}
|
||||||
|
|
||||||
void CMenu::_launchGC(const char *id, bool DML)
|
void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
|
||||||
{
|
{
|
||||||
Nand::Instance()->Disable_Emu();
|
Nand::Instance()->Disable_Emu();
|
||||||
u8 DMLvideoMode = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
u8 DMLvideoMode = 0;
|
||||||
if (!DML)
|
|
||||||
DMLvideoMode = 0;
|
#ifdef DML_THROUGH_MEM /*** Need special DML for this ***/
|
||||||
else
|
if( DML )
|
||||||
{
|
{
|
||||||
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
|
gprintf( "Wiiflow DML:Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path );
|
||||||
FILE *f;
|
DMLvideoMode = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
||||||
sprintf(filepath, "%s:/games/boot.bin", DeviceName[SD]);
|
*(vu32*)0x800A0000 = 0x4e444d4c;
|
||||||
f = fopen(filepath, "wb");
|
memcpy( (void *)0x800A0004, hdr->path, strlen( hdr->path ) +1 );
|
||||||
fwrite(id, 1, 6, f);
|
DCFlushRange( (void *)( 0x800A0000 ), 4 );
|
||||||
fclose(f);
|
ICInvalidateRange( (void *)( 0x800A0000 ), 4 );
|
||||||
|
|
||||||
|
m_cfg.setString( "DML", "current_item", (char *)hdr->hdr.id );
|
||||||
|
m_gcfg1.setInt( "PLAYCOUNT", (char *)hdr->hdr.id, m_gcfg1.getInt( "PLAYCOUNT", (char *)hdr->hdr.id, 0 ) + 1 );
|
||||||
|
m_gcfg1.setUInt( "LASTPLAYED", (char *)hdr->hdr.id, time(NULL) );
|
||||||
|
m_gcfg1.save(true);
|
||||||
|
m_cfg.save(true);
|
||||||
|
|
||||||
Close_Inputs();
|
Close_Inputs();
|
||||||
USBStorage_Deinit();
|
USBStorage_Deinit();
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
// Tell DML to boot the game from sd card
|
// Tell DML to boot the game from sd card
|
||||||
*(u32 *)0x80001800 = 0xB002D105;
|
*(vu32*)0x80001800 = 0xB002D105;
|
||||||
DCFlushRange((void *)(0x80001800), 4);
|
DCFlushRange((void *)(0x80001800), 4);
|
||||||
ICInvalidateRange((void *)(0x80001800), 4);
|
ICInvalidateRange((void *)(0x80001800), 4);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if( DML )
|
||||||
|
{
|
||||||
|
gprintf( "Wiiflow DML:Launch game 'sd:/games/%s/game.iso' through boot.bin\n", hdr->path );
|
||||||
|
DMLvideoMode = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
|
||||||
|
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
|
||||||
|
FILE *f;
|
||||||
|
sprintf(filepath, "%s:/games/boot.bin", DeviceName[SD]);
|
||||||
|
f = fopen(filepath, "wb");
|
||||||
|
fwrite(hdr->path, 1, strlen( hdr->path ) +1, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
memcpy((char *)0x80000000, id, 6);
|
m_cfg.setString("DML", "current_item", (char *)hdr->hdr.id);
|
||||||
|
m_gcfg1.setInt("PLAYCOUNT", (char *)hdr->hdr.id, m_gcfg1.getInt("PLAYCOUNT", string((const char *) hdr->hdr.id), 0) + 1);
|
||||||
|
m_gcfg1.setUInt("LASTPLAYED", (char *)hdr->hdr.id, time(NULL));
|
||||||
|
m_gcfg1.save(true);
|
||||||
|
m_cfg.save(true);
|
||||||
|
|
||||||
VIDEO_SetBlack(TRUE);
|
Close_Inputs();
|
||||||
if (((id[3] == 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 1))
|
USBStorage_Deinit();
|
||||||
|
cleanup();
|
||||||
|
|
||||||
|
// Tell DML to boot the game from sd card
|
||||||
|
*(vu32*)0x80001800 = 0xB002D105;
|
||||||
|
DCFlushRange((void *)(0x80001800), 4);
|
||||||
|
ICInvalidateRange((void *)(0x80001800), 4);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
memcpy((char *)0x80000000, (char *)hdr->hdr.id, 6);
|
||||||
|
if((((char)hdr->hdr.id[3] == 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 1))
|
||||||
{
|
{
|
||||||
set_video_mode(1);
|
set_video_mode(1);
|
||||||
}
|
}
|
||||||
if (((id[3] != 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 2))
|
if((((char)hdr->hdr.id[3] != 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 2))
|
||||||
{
|
{
|
||||||
set_video_mode(0);
|
set_video_mode(0);
|
||||||
}
|
}
|
||||||
|
VIDEO_SetBlack(TRUE);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
*(volatile unsigned int *)0xCC003024 |= 7;
|
*(vu32*)0xCC003024 |= 7;
|
||||||
|
|
||||||
if (WII_LaunchTitle(0x0000000100000100ULL)<0)
|
if(WII_LaunchTitle( 0x100000100LL ) < 0 )
|
||||||
Sys_LoadMenu();
|
Sys_LoadMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,9 +1097,9 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
|
|||||||
Close_Inputs();
|
Close_Inputs();
|
||||||
USBStorage_Deinit();
|
USBStorage_Deinit();
|
||||||
|
|
||||||
if (gc)
|
if(gc)
|
||||||
{
|
{
|
||||||
_launchGC(id.c_str(),false);
|
_launchGC( hdr, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -73,6 +73,7 @@ void CMenu::_hideMain(bool instant)
|
|||||||
|
|
||||||
static bool show_homebrew = true;
|
static bool show_homebrew = true;
|
||||||
static bool parental_homebrew = false;
|
static bool parental_homebrew = false;
|
||||||
|
static bool show_dml = false;
|
||||||
|
|
||||||
void CMenu::_showMain(void)
|
void CMenu::_showMain(void)
|
||||||
{
|
{
|
||||||
@ -90,13 +91,18 @@ void CMenu::_showMain(void)
|
|||||||
switch(m_current_view)
|
switch(m_current_view)
|
||||||
{
|
{
|
||||||
case COVERFLOW_HOMEBREW:
|
case COVERFLOW_HOMEBREW:
|
||||||
m_btnMgr.show(m_mainBtnDML);
|
if( show_dml )
|
||||||
|
m_btnMgr.show(m_mainBtnDML);
|
||||||
|
else
|
||||||
|
m_btnMgr.show(m_mainBtnUsb);
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_CHANNEL:
|
case COVERFLOW_CHANNEL:
|
||||||
if(show_homebrew)
|
if(show_homebrew)
|
||||||
m_btnMgr.show(m_mainBtnHomebrew);
|
m_btnMgr.show(m_mainBtnHomebrew);
|
||||||
else
|
else if( show_dml )
|
||||||
m_btnMgr.show(m_mainBtnDML);
|
m_btnMgr.show(m_mainBtnDML);
|
||||||
|
else
|
||||||
|
m_btnMgr.show(m_mainBtnUsb);
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_DML:
|
case COVERFLOW_DML:
|
||||||
m_btnMgr.show(m_mainBtnUsb);
|
m_btnMgr.show(m_mainBtnUsb);
|
||||||
@ -159,6 +165,7 @@ int CMenu::main(void)
|
|||||||
bool use_grab = m_cfg.getBool("GENERAL", "use_grab", false);
|
bool use_grab = m_cfg.getBool("GENERAL", "use_grab", false);
|
||||||
show_homebrew = !m_cfg.getBool("HOMEBREW", "disable", false);
|
show_homebrew = !m_cfg.getBool("HOMEBREW", "disable", false);
|
||||||
parental_homebrew = m_cfg.getBool("HOMEBREW", "parental", false);
|
parental_homebrew = m_cfg.getBool("HOMEBREW", "parental", false);
|
||||||
|
show_dml = MIOSisDML();
|
||||||
|
|
||||||
m_reload = false;
|
m_reload = false;
|
||||||
static u32 disc_check = 0;
|
static u32 disc_check = 0;
|
||||||
@ -472,9 +479,9 @@ int CMenu::main(void)
|
|||||||
if (m_current_view == COVERFLOW_USB)
|
if (m_current_view == COVERFLOW_USB)
|
||||||
m_current_view = COVERFLOW_CHANNEL;
|
m_current_view = COVERFLOW_CHANNEL;
|
||||||
else if (m_current_view == COVERFLOW_CHANNEL)
|
else if (m_current_view == COVERFLOW_CHANNEL)
|
||||||
m_current_view = (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : COVERFLOW_DML;
|
m_current_view = (show_homebrew && (parental_homebrew || !m_locked)) ? COVERFLOW_HOMEBREW : ( show_dml ? COVERFLOW_DML : COVERFLOW_USB );
|
||||||
else if (m_current_view == COVERFLOW_HOMEBREW)
|
else if (m_current_view == COVERFLOW_HOMEBREW)
|
||||||
m_current_view = COVERFLOW_DML;
|
m_current_view = show_dml ? COVERFLOW_DML : COVERFLOW_USB;
|
||||||
else if (m_current_view == COVERFLOW_DML)
|
else if (m_current_view == COVERFLOW_DML)
|
||||||
m_current_view = COVERFLOW_USB;
|
m_current_view = COVERFLOW_USB;
|
||||||
|
|
||||||
@ -597,13 +604,18 @@ int CMenu::main(void)
|
|||||||
switch(m_current_view)
|
switch(m_current_view)
|
||||||
{
|
{
|
||||||
case COVERFLOW_HOMEBREW:
|
case COVERFLOW_HOMEBREW:
|
||||||
m_btnMgr.show(m_mainBtnDML);
|
if( show_dml )
|
||||||
|
m_btnMgr.show(m_mainBtnDML);
|
||||||
|
else
|
||||||
|
m_btnMgr.show(m_mainBtnUsb);
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_CHANNEL:
|
case COVERFLOW_CHANNEL:
|
||||||
if (show_homebrew && (parental_homebrew || !m_locked))
|
if (show_homebrew && (parental_homebrew || !m_locked))
|
||||||
m_btnMgr.show(m_mainBtnHomebrew);
|
m_btnMgr.show(m_mainBtnHomebrew);
|
||||||
else
|
else if( show_dml )
|
||||||
m_btnMgr.show(m_mainBtnDML);
|
m_btnMgr.show(m_mainBtnDML);
|
||||||
|
else
|
||||||
|
m_btnMgr.show(m_mainBtnUsb);
|
||||||
break;
|
break;
|
||||||
case COVERFLOW_DML:
|
case COVERFLOW_DML:
|
||||||
m_btnMgr.show(m_mainBtnUsb);
|
m_btnMgr.show(m_mainBtnUsb);
|
||||||
|
Loading…
Reference in New Issue
Block a user