-added possibility to add gamecube games to gamertag

-gamecube launch cleanup
This commit is contained in:
fix94.1 2012-02-11 13:05:18 +00:00
parent 1caf757ef9
commit 3718e76bdc
4 changed files with 24 additions and 39 deletions

View File

@ -582,46 +582,31 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
{
Nand::Instance()->Disable_Emu();
u8 DMLvideoMode = 0;
#ifdef DML_THROUGH_MEM /*** Need special DML for this ***/
if( DML )
if(has_enabled_providers() && _initNetwork() == 0)
add_game_to_card((char *)hdr->hdr.id);
if(DML)
{
gprintf( "Wiiflow DML:Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path );
DMLvideoMode = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
#ifdef DML_THROUGH_MEM /*** Need special DML for this ***/
gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through memory\n", hdr->path);
*(vu32*)0x800A0000 = 0x4e444d4c;
memcpy( (void *)0x800A0004, hdr->path, strlen( hdr->path ) +1 );
DCFlushRange( (void *)( 0x800A0000 ), 4 );
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();
USBStorage_Deinit();
cleanup();
// Tell DML to boot the game from sd card
*(vu32*)0x80001800 = 0xB002D105;
DCFlushRange((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);
memcpy((void *)0x800A0004, hdr->path, strlen(hdr->path) + 1);
DCFlushRange((void *)(0x800A0000), 4);
ICInvalidateRange((void *)(0x800A0000), 4);
#else
gprintf("Wiiflow DML: Launch game 'sd:/games/%s/game.iso' through boot.bin\n", hdr->path);
char filepath[ISFS_MAXPATH] ATTRIBUTE_ALIGN(32);
FILE *f;
sprintf(filepath, "%s:/games/boot.bin", DeviceName[SD]);
sprintf(filepath, "%s:/games/boot.bin", DeviceName[SD]);
f = fopen(filepath, "wb");
fwrite(hdr->path, 1, strlen( hdr->path ) +1, f);
fwrite(hdr->path, 1, strlen(hdr->path) + 1, f);
fclose(f);
#endif
DMLvideoMode = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
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.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);
@ -630,14 +615,12 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
USBStorage_Deinit();
cleanup();
// Tell DML to boot the game from sd card
//Tell DML to boot the game from sd card
*(vu32*)0x80001800 = 0xB002D105;
DCFlushRange((void *)(0x80001800), 4);
ICInvalidateRange((void *)(0x80001800), 4);
ICInvalidateRange((void *)(0x80001800), 4);
}
#endif
u8 GClanguage = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
memcpy((char *)0x80000000, (char *)hdr->hdr.id, 6);

View File

@ -1,6 +1,7 @@
#include "gcard.h"
#include "http.h"
#include "utils.h"
#include "gecko/gecko.h"
#include <malloc.h>
#include <string.h>
@ -59,6 +60,7 @@ void add_game_to_card(const char *gameid)
str_replace(url, (char *) "{KEY}", (char *) providers[i].key, MAX_URL_SIZE);
str_replace(url, (char *) "{ID6}", (char *) gameid, MAX_URL_SIZE);
gprintf("Gamertag URL:\n%s\n",(char*)url);
downloadfile(NULL, 0, (char *) url, NULL, NULL);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow" x="true"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source" x="false"></e><e p="Wiiflow\wii" x="false"></e></ViewState></pd>
<pd><ViewState><e p="Wiiflow" x="true"></e><e p="Wiiflow\resources" x="false"></e><e p="Wiiflow\source\devicemounter\libwbfs" x="false"></e><e p="Wiiflow\data" x="false"></e><e p="Wiiflow\scripts" x="false"></e><e p="Wiiflow\source" x="true"></e><e p="Wiiflow\source\network" x="false"></e><e p="Wiiflow\source\channel" x="true"></e><e p="Wiiflow\source\menu" x="true"></e><e p="Wiiflow\docs" x="false"></e><e p="Wiiflow\source\cheats" x="true"></e><e p="Wiiflow\portlibs" x="false"></e><e p="Wiiflow\source\config" x="true"></e><e p="Wiiflow\source\devicemounter" x="true"></e><e p="Wiiflow\source\gc" x="false"></e><e p="Wiiflow\source\gecko" x="false"></e><e p="Wiiflow\source\gui" x="true"></e><e p="Wiiflow\source\homebrew" x="true"></e><e p="Wiiflow\source\list" x="true"></e><e p="Wiiflow\source\loader" x="true"></e><e p="Wiiflow\source\memory" x="false"></e><e p="Wiiflow\source\music" x="false"></e><e p="Wiiflow\source\unzip" x="false"></e><e p="Wiiflow\source\wstringEx" x="false"></e><e p="Wiiflow\wii" x="false"></e></ViewState></pd>