diff --git a/include/dolphin/card.h b/include/dolphin/card.h index d1fbb2f..2713fb5 100644 --- a/include/dolphin/card.h +++ b/include/dolphin/card.h @@ -16,10 +16,10 @@ extern "C" { #if TARGET_PC -enum CARDFileType { - RawImage, - GciFolder, -}; +typedef enum { + CARD_RAWIMAGE, + CARD_GCIFOLDER, +} CARDFileType; #endif diff --git a/lib/card/CardGciFolder.cpp b/lib/card/CardGciFolder.cpp index 567a674..2a3a17d 100644 --- a/lib/card/CardGciFolder.cpp +++ b/lib/card/CardGciFolder.cpp @@ -376,30 +376,7 @@ ECardResult CardGciFolder::getError() const { return ECardResult::READY; } ProbeResults CardGciFolder::probeCardFile(std::string_view filename) { if (!std::filesystem::exists(filename) || !std::filesystem::is_directory(filename)) return {ECardResult::NOCARD, 0, 0}; - - for (const auto& dir : std::filesystem::directory_iterator(filename)) { - if (!dir.is_regular_file()) { - continue; - } - auto path = dir.path(); - - if (path.extension() != ".gci") - continue; - - FileIO file(path.string()); - - File fileData; - file.fileRead(&fileData, sizeof(File), 0); - fileData.swapEndian(); - - bool isGameSame = memcmp(fileData.m_game, m_game, std::size(fileData.m_game)) == 0; - bool isMakerSame = memcmp(fileData.m_maker, m_maker, std::size(fileData.m_maker)) == 0; - - if (isGameSame && isMakerSame) - return {ECardResult::READY, static_cast(file.fileSize()), BlockSize}; - } - - return {ECardResult::NOFILE, 0, 0}; + return {ECardResult::READY, static_cast(ECardSize::Card2043Mb), BlockSize}; } } // namespace aurora::card diff --git a/lib/dolphin/card.cpp b/lib/dolphin/card.cpp index 3428b09..7a06ed6 100644 --- a/lib/dolphin/card.cpp +++ b/lib/dolphin/card.cpp @@ -19,13 +19,12 @@ constexpr uint16_t CARD_SECTOR_SIZE = 8192; #define CARD_REGION "USA" #define GET_CARD(slot) CardChannels[slot] -#define CARD_READY(slot) (SelectedFileType == GciFolder ? true : std::filesystem::exists(CardChannels[slot]->cardFilename())) +#define CARD_USE_GCI_FOLDER SelectedFileType == CARD_GCIFOLDER +#define CARD_READY(slot) (CARD_USE_GCI_FOLDER ? true : std::filesystem::exists(CardChannels[slot]->cardFilename())) #define CARD_STUB Log.debug("{} is stubbed.", __FUNCTION__); -#define CARD_USE_GCI_FOLDER SelectedFileType == GciFolder - bool Initialized = false; -CARDFileType SelectedFileType = CARDFileType::GciFolder; +CARDFileType SelectedFileType = CARD_GCIFOLDER; bool UseFastMode = false; void CopyKabuFileHandleToDolphin(const s32 chan, const aurora::card::FileHandle& handle, CARDFileInfo* fileInfo) { @@ -151,10 +150,10 @@ void CARDInit(const char* game, const char* maker) { for (int i = 0; i < CardChannels.size(); ++i) { switch (SelectedFileType) { - case RawImage: + case CARD_RAWIMAGE: CardChannels[i] = std::make_unique(); break; - case GciFolder: + case CARD_GCIFOLDER: CardChannels[i] = std::make_unique(); break; }