Added check to CardiTaskThreadPatch that the required slot is actually mapped to arm7. Fixes #60

This commit is contained in:
Gericom
2025-12-27 12:44:00 +01:00
parent 8036004e5a
commit 64e020182a
18 changed files with 95 additions and 42 deletions

View File

@@ -5,6 +5,7 @@
#include "SdWritePatchCode.h"
#include "../PatchHeap.h"
#include "../PatchCodeCollection.h"
#include "LoaderPlatformType.h"
/// @brief Abstract class for platform (flashcard or other sd access method) specific parts of the loader.
class LoaderPlatform
@@ -38,6 +39,10 @@ public:
virtual const SdReadPatchCode* CreateRomReadPatchCode(
PatchCodeCollection& patchCodeCollection, PatchHeap& patchHeap) const { return nullptr; }
/// @brief Returns the type of this loader platform.
/// @return The type of this loader platform.
virtual LoaderPlatformType GetPlatformType() const = 0;
/// @brief Checks if the platform supports rom reads directly.
/// @return True if the platform supports rom reads, or false otherwise.
virtual bool HasRomReads() const { return false; }

View File

@@ -0,0 +1,11 @@
#pragma once
/// @brief Enum representing the type of loader platform.
enum class LoaderPlatformType
{
/// @brief Slot 1 (DS) cartridge.
Slot1,
/// @brief Slot 2 (GBA) cartridge.
Slot2
};

View File

@@ -34,5 +34,7 @@ public:
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool HasDmaSdReads() const override { return true; }
};

View File

@@ -11,6 +11,8 @@ public:
explicit IoRPGLoaderPlatform(u8 ioRpgCmdSdioByte)
: _ioRpgCmdSdioByte(ioRpgCmdSdioByte) { }
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool InitializeSdCard() override;
protected:

View File

@@ -43,5 +43,7 @@ public:
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool HasDmaSdReads() const override { return true; }
};

View File

@@ -34,5 +34,7 @@ public:
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool InitializeSdCard() override;
};

View File

@@ -30,4 +30,6 @@ public:
return new EZPWriteSectorsPatchCode(patchHeap);
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
};

View File

@@ -34,5 +34,7 @@ public:
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool HasDmaSdReads() const override { return true; }
};

View File

@@ -27,6 +27,8 @@ public:
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot2; }
private:
u32 GetAgbRamPtr() const
{

View File

@@ -33,4 +33,6 @@ public:
}));
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
};

View File

@@ -25,4 +25,6 @@ public:
return new MelonDSWriteSdPatchCode(patchHeap);
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
};

View File

@@ -37,6 +37,8 @@ public:
});
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot1; }
bool HasRomReads() const override { return true; }
void PrepareRomBoot(u32 romDirSector, u32 romDirSectorOffset) const override;

View File

@@ -99,6 +99,8 @@ public:
}
}
LoaderPlatformType GetPlatformType() const override { return LoaderPlatformType::Slot2; }
bool InitializeSdCard() override;
private: