From 3718e76bdc1de9d64453f45aadd74b7422f8a09e Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Sat, 11 Feb 2012 13:05:18 +0000 Subject: [PATCH] -added possibility to add gamecube games to gamertag -gamecube launch cleanup --- source/menu/menu_game.cpp | 57 ++++++++++++++------------------------- source/network/gcard.c | 2 ++ wiiflow.pnproj | 2 +- wiiflow.pnps | 2 +- 4 files changed, 24 insertions(+), 39 deletions(-) diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 8c0e95fb..c24f7732 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -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); diff --git a/source/network/gcard.c b/source/network/gcard.c index 2dabb2c1..82d00e15 100644 --- a/source/network/gcard.c +++ b/source/network/gcard.c @@ -1,6 +1,7 @@ #include "gcard.h" #include "http.h" #include "utils.h" +#include "gecko/gecko.h" #include #include @@ -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); } } diff --git a/wiiflow.pnproj b/wiiflow.pnproj index 1d2aa7cf..e83ab811 100644 --- a/wiiflow.pnproj +++ b/wiiflow.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wiiflow.pnps b/wiiflow.pnps index 994de9cb..0eaf061c 100644 --- a/wiiflow.pnps +++ b/wiiflow.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file