diff --git a/source/loader/nk.c b/source/loader/nk.c index 8053b368..b3580734 100644 --- a/source/loader/nk.c +++ b/source/loader/nk.c @@ -42,8 +42,9 @@ bool neek2o(void) { if(!checked) { - u32 num = 0; - neek = !(ISFS_ReadDir("/sneek", NULL, &num)); + s32 ESHandle = IOS_Open("/dev/es", 0); + neek = IOS_Ioctlv(ESHandle, 0xA2, 0, 0, NULL) == 0x666c6f77; + IOS_Close(ESHandle); gprintf("WiiFlow is in %s mode\n", neek ? "neek2o" : "real nand"); checked = true; } diff --git a/source/loader/playlog.c b/source/loader/playlog.c index abaab3ed..26714fc7 100644 --- a/source/loader/playlog.c +++ b/source/loader/playlog.c @@ -18,24 +18,26 @@ #define SECONDS_TO_2000 946684800LL #define TICKS_PER_SECOND 60750000LL -typedef struct +typedef union { - u32 checksum; - union + struct { - u32 data[31]; - struct - { - u8 name[84]; - u64 ticks_boot; - u64 ticks_last; - char title_id[6]; - char unknown[18]; - } ATTRIBUTE_PACKED; + u32 checksum; + u16 name[0x28]; + u32 padding1; + u64 ticks_boot; + u64 ticks_last; + char title_id[6]; + u16 padding2[9]; }; -} playrec_struct; + struct + { + u32 _checksum; + u32 data[0x1f]; + }; +} __attribute__((packed)) playtime_t; -playrec_struct playrec_buf; +playtime_t playrec_buf; // Thanks to Dr. Clipper u64 getWiiTime(void) @@ -46,6 +48,7 @@ u64 getWiiTime(void) int Playlog_Update(const char ID[6], const u8 title[84]) { + gprintf("Update Play log\n"); u32 sum = 0; u8 i; @@ -73,9 +76,9 @@ int Playlog_Update(const char ID[6], const u8 title[84]) //Update channel name and ID memcpy(playrec_buf.name, title, 84); - memcpy(playrec_buf.title_id, ID, 6); + strcpy(playrec_buf.title_id, ID); - memset(playrec_buf.unknown, 0, 18); + memset(playrec_buf.padding2, 0, 18); //Calculate and update checksum for(i=0; i<31; i++) diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 4da5b0d0..d5b655d7 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -625,11 +625,11 @@ void CMenu::_game(bool launch) } banner = NULL; - if(Playlog_Update(m_cf.getId().c_str(), banner_title) < 0) + if(Playlog_Update((char *)hdr->id, banner_title) < 0) Playlog_Delete(); } - gprintf("Launching game %s\n", m_cf.getId().c_str()); + gprintf("Launching game %s\n", (char *)hdr->id); _launch(hdr); if(m_exit) @@ -1156,9 +1156,11 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) if(neek2o()) { int discID = id.c_str()[0] << 24 | id.c_str()[1] << 16 | id.c_str()[2] << 8 | id.c_str()[3]; - WDVD_NEEK_LoadDisc((discID&0xFFFFFFFF), 0x5D1C9EA3); - dvd = true; - sleep(1); + if(WDVD_NEEK_LoadDisc((discID&0xFFFFFFFF), 0x5D1C9EA3) > 0) + { + dvd = true; + sleep(3); + } } if(dvd) @@ -1329,8 +1331,8 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) if(rtrn != NULL && strlen(rtrn) == 4) returnTo = rtrn[0] << 24 | rtrn[1] << 16 | rtrn[2] << 8 | rtrn[3]; - int userIOS = m_gcfg2.getInt(id, "ios", 0); - int gameIOS = dvd ? userIOS : GetRequestedGameIOS(hdr); + int userIOS = m_gcfg2.getInt(id, "ios", 0); + int gameIOS = dvd && !neek2o() ? userIOS : GetRequestedGameIOS(hdr); m_gcfg1.save(true); m_gcfg2.save(true);