Skip to content

Commit

Permalink
- Keep track of certain GC Loader quirks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Dec 18, 2023
1 parent 428f4e2 commit 75507f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions cube/swiss/source/devices/deviceHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ typedef char* (* _fn_status)(file_handle*);
#define FEAT_PATCHES 0x100
#define FEAT_AUDIO_STREAMING 0x200

// Device quirks
#define QUIRK_NONE 0x0
#define QUIRK_GCLOADER_NO_DISC_2 0x1
#define QUIRK_GCLOADER_NO_PARTIAL_READ 0x2
#define QUIRK_GCLOADER_WRITE_CONFLICT 0x4

// Device emulated features
#define EMU_NONE 0x0
#define EMU_READ 0x1
Expand Down Expand Up @@ -157,6 +163,7 @@ struct DEVICEHANDLER_STRUCT {
const char* deviceDescription;
textureImage deviceTexture;
u32 features;
u32 quirks;
u32 emulable;
u32 location;
file_handle* initial;
Expand Down
14 changes: 12 additions & 2 deletions cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,24 @@ bool deviceHandler_GCLoader_test() {
else
__device_gcloader.features &= ~(FEAT_WRITE|FEAT_CONFIG_DEVICE|FEAT_PATCHES);

__device_gcloader.quirks = QUIRK_NONE;

if (gcloaderReadId() == 0xAAAAAAAA) {
gcloaderHwVersion = driveInfo.pad[2] + 1;
gcloaderVersionStr = gcloaderGetVersion(driveInfo.pad[2]);

if (gcloaderVersionStr) {
switch (gcloaderHwVersion) {
case 1:
if (strverscmp(gcloaderVersionStr, "1.0.0") < 0)
__device_gcloader.quirks |= QUIRK_GCLOADER_NO_DISC_2;
break;
case 2:
if (strverscmp(gcloaderVersionStr, "1.0.0") <= 0)
if (strverscmp(gcloaderVersionStr, "1.0.1") < 0) {
__device_gcloader.features &= ~FEAT_PATCHES;
__device_gcloader.quirks |= QUIRK_GCLOADER_NO_DISC_2 | QUIRK_GCLOADER_NO_PARTIAL_READ;
} else if (!strverscmp(gcloaderVersionStr, "1.1.0.BETA"))
__device_gcloader.quirks |= QUIRK_GCLOADER_WRITE_CONFLICT;
break;
}
}
Expand All @@ -319,7 +328,8 @@ u32 deviceHandler_GCLoader_emulated() {
} else {
if (swissSettings.emulateReadSpeed)
return EMU_READ | EMU_READ_SPEED;
else if (swissSettings.emulateMemoryCard)
else if (swissSettings.emulateMemoryCard &&
!(swissSettings.audioStreaming && (devices[DEVICE_CUR]->quirks & QUIRK_GCLOADER_WRITE_CONFLICT)))
return EMU_READ | EMU_MEMCARD;
else
return EMU_READ;
Expand Down
1 change: 1 addition & 0 deletions cube/swiss/source/nkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static const struct {
{ "GCLoader_Updater_2.0.0.dol", 838240, 0xDCF7E6BE86E334A9 },
{ "GCLoader_Updater_2.0.1.BETA.dol", 1176704, 0x5264440845874534 },
{ "GCLoader_Updater_2.0.1.dol", 1176672, 0x04B8A4BC92D821DD },
{ "GC_LOADER_HW2_UPDATER_1.0.0.dol", 1267200, 0x25AC594FF8F3C302 },
{ "GC_LOADER_HW2_UPDATER_1.0.1.dol", 1267200, 0x753F83C3E35CCBE0 },
{ "GC_LOADER_HW2_UPDATER_1.1.0.BETA.dol", 1267200, 0x153785DED813D3B1 },
};
Expand Down

0 comments on commit 75507f8

Please sign in to comment.