| 639 | } |
| 640 | |
| 641 | PREPARE_STATUS_CODE LoadAndMountForegroundTitle(TitleId titleId) |
| 642 | { |
| 643 | cemuLog_log(LogType::Force, "Mounting title {:016x}", (uint64)titleId); |
| 644 | sGameInfo_ForegroundTitle = CafeTitleList::GetGameInfo(titleId); |
| 645 | if (!sGameInfo_ForegroundTitle.IsValid()) |
| 646 | { |
| 647 | cemuLog_log(LogType::Force, "Mounting failed: Game meta information is either missing, inaccessible or not valid (missing or invalid .xml files in code and meta folder)"); |
| 648 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 649 | } |
| 650 | // check base |
| 651 | TitleInfo& titleBase = sGameInfo_ForegroundTitle.GetBase(); |
| 652 | if (!titleBase.IsValid()) |
| 653 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 654 | if(!titleBase.ParseXmlInfo()) |
| 655 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 656 | cemuLog_log(LogType::Force, "Base: {}", titleBase.GetPrintPath()); |
| 657 | // mount base |
| 658 | if (!titleBase.Mount("/vol/content", "content", FSC_PRIORITY_BASE) || !titleBase.Mount(GetInternalVirtualCodeFolder(), "code", FSC_PRIORITY_BASE)) |
| 659 | { |
| 660 | cemuLog_log(LogType::Force, "Mounting failed"); |
| 661 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 662 | } |
| 663 | // check update |
| 664 | TitleInfo& titleUpdate = sGameInfo_ForegroundTitle.GetUpdate(); |
| 665 | if (titleUpdate.IsValid()) |
| 666 | { |
| 667 | if (!titleUpdate.ParseXmlInfo()) |
| 668 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 669 | cemuLog_log(LogType::Force, "Update: {}", titleUpdate.GetPrintPath()); |
| 670 | // mount update |
| 671 | if (!titleUpdate.Mount("/vol/content", "content", FSC_PRIORITY_PATCH) || !titleUpdate.Mount(GetInternalVirtualCodeFolder(), "code", FSC_PRIORITY_PATCH)) |
| 672 | { |
| 673 | cemuLog_log(LogType::Force, "Mounting failed"); |
| 674 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 675 | } |
| 676 | } |
| 677 | else |
| 678 | cemuLog_log(LogType::Force, "Update: Not present"); |
| 679 | // check AOC |
| 680 | auto aocList = sGameInfo_ForegroundTitle.GetAOC(); |
| 681 | if (!aocList.empty()) |
| 682 | { |
| 683 | // todo - support for multi-title AOC |
| 684 | TitleInfo& titleAOC = aocList[0]; |
| 685 | if (!titleAOC.ParseXmlInfo()) |
| 686 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 687 | cemu_assert_debug(titleAOC.IsValid()); |
| 688 | cemuLog_log(LogType::Force, "DLC: {}", titleAOC.GetPrintPath()); |
| 689 | // mount AOC |
| 690 | if (!titleAOC.Mount(fmt::format("/vol/aoc{:016x}", titleAOC.GetAppTitleId()), "content", FSC_PRIORITY_PATCH)) |
| 691 | { |
| 692 | cemuLog_log(LogType::Force, "Mounting failed"); |
| 693 | return PREPARE_STATUS_CODE::UNABLE_TO_MOUNT; |
| 694 | } |
| 695 | } |
| 696 | else |
| 697 | cemuLog_log(LogType::Force, "DLC: Not present"); |
| 698 | sForegroundTitleId = titleId; |
no test coverage detected