From e8911d3ba1895a9efc6d4d66a736eedfcc2aa703 Mon Sep 17 00:00:00 2001 From: Extrems Date: Mon, 4 Mar 2024 20:53:23 -0500 Subject: [PATCH] - Only enable for GC Loader if eligible as patch device. - Forcibly use GC Loader as patch device if enabled features demand it. --- cube/swiss/source/bba.c | 3 ++- cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c | 2 +- cube/swiss/source/gcm.c | 6 ++++++ cube/swiss/source/patcher.c | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cube/swiss/source/bba.c b/cube/swiss/source/bba.c index 3bbc5cd9..3896910b 100644 --- a/cube/swiss/source/bba.c +++ b/cube/swiss/source/bba.c @@ -35,7 +35,8 @@ void init_network(void *args) { } if(if_nametoindex("E20") == 1) { - __device_gcloader.emulable |= EMU_ETHERNET; + if(__device_gcloader.features & FEAT_PATCHES) + __device_gcloader.emulable |= EMU_ETHERNET; __device_ata_c.emulable |= EMU_ETHERNET; __device_sd_c.emulable |= EMU_ETHERNET; __device_sd_a.emulable |= EMU_ETHERNET; diff --git a/cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c b/cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c index 58de9177..4d1d429c 100644 --- a/cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c +++ b/cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c @@ -337,7 +337,7 @@ u32 deviceHandler_GCLoader_emulated() { else if (swissSettings.emulateReadSpeed) return EMU_READ | EMU_READ_SPEED; else if (swissSettings.emulateEthernet && (devices[DEVICE_CUR]->emulable & EMU_ETHERNET)) - return EMU_READ | EMU_ETHERNET; + return EMU_READ | EMU_ETHERNET | EMU_BUS_ARBITER; else if (swissSettings.emulateMemoryCard && !(swissSettings.audioStreaming && (devices[DEVICE_CUR]->quirks & QUIRK_GCLOADER_WRITE_CONFLICT))) return EMU_READ | EMU_MEMCARD; diff --git a/cube/swiss/source/gcm.c b/cube/swiss/source/gcm.c index e00ff275..9ed79878 100644 --- a/cube/swiss/source/gcm.c +++ b/cube/swiss/source/gcm.c @@ -510,7 +510,13 @@ int patch_gcm(ExecutableFile *filesToPatch, int numToPatch) { bool patchDeviceReady = false; if(devices[DEVICE_CUR]->features & FEAT_PATCHES) { if(devices[DEVICE_CUR] == &__device_gcloader && (devices[DEVICE_CONFIG] == &__device_sd_a || devices[DEVICE_CONFIG] == &__device_sd_b || devices[DEVICE_CONFIG] == &__device_sd_c)) { + devices[DEVICE_PATCHES] = devices[DEVICE_CUR]; + u32 emulated = devices[DEVICE_CUR]->emulated(); devices[DEVICE_PATCHES] = devices[DEVICE_CONFIG]; + if((emulated ^ devices[DEVICE_CUR]->emulated()) & ~EMU_BUS_ARBITER) { + devices[DEVICE_PATCHES] = devices[DEVICE_CUR]; + patchDeviceReady = true; + } } else { devices[DEVICE_PATCHES] = devices[DEVICE_CUR]; diff --git a/cube/swiss/source/patcher.c b/cube/swiss/source/patcher.c index 85f99db6..8702c0dd 100644 --- a/cube/swiss/source/patcher.c +++ b/cube/swiss/source/patcher.c @@ -335,7 +335,7 @@ int install_code(int final) patch = gcloader_v2_card_bin; patchSize = gcloader_v2_card_bin_size; break; - case EMU_READ | EMU_ETHERNET: + case EMU_READ | EMU_ETHERNET | EMU_BUS_ARBITER: patch = gcloader_v2_eth_bin; patchSize = gcloader_v2_eth_bin_size; break;