Skip to content

Commit

Permalink
- Rework DI device detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed May 12, 2024
1 parent dc3b947 commit 5f8d400
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
1 change: 1 addition & 0 deletions cube/swiss/source/devices/dvd/deviceHandler-DVD.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ s32 deviceHandler_DVD_closeFile(file_handle* file){
}

bool deviceHandler_DVD_test() {
while(DVD_LowGetCoverStatus() == 0);
return swissSettings.hasDVDDrive != 0;
}

Expand Down
2 changes: 2 additions & 0 deletions cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ bool deviceHandler_GCLoader_test() {
gcloaderVersionStr = NULL;
gcloaderHwVersion = 0;

while (DVD_LowGetCoverStatus() == 0);

if (swissSettings.hasDVDDrive && driveInfo.rel_date == 0x20196c64) {
if (driveInfo.pad[1] == 'w')
__device_gcloader.features |= (FEAT_WRITE | FEAT_CONFIG_DEVICE | FEAT_PATCHES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ s32 deviceHandler_WKF_setupFile(file_handle* file, file_handle* file2, Executabl
}

bool deviceHandler_WKF_test() {
while(DVD_LowGetCoverStatus() == 0);
return swissSettings.hasDVDDrive && (__wkfSpiReadId() != 0 && __wkfSpiReadId() != 0xFFFFFFFF);
}

Expand Down
1 change: 1 addition & 0 deletions cube/swiss/source/devices/wode/deviceHandler-WODE.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ s32 deviceHandler_WODE_closeFile(file_handle* file) {
}

bool deviceHandler_WODE_test() {
while(DVD_LowGetCoverStatus() == 0);
return swissSettings.hasDVDDrive && driveInfo.rel_date == 0x20080714;
}

Expand Down
28 changes: 9 additions & 19 deletions cube/swiss/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ void Initialise (void)
// Disable IPL modchips to allow access to IPL ROM fonts
ipl_set_config(6);
usleep(1000); //wait for modchip to disable (overkill)


__SYS_ReadROM(IPLInfo,256,0); // Read IPL tag

if(!strncmp(&IPLInfo[0x55], "NTSC", 4))
Expand All @@ -72,23 +70,6 @@ void Initialise (void)

init_font();
DrawInit();

uiDrawObj_t *progBox = DrawPublish(DrawProgressBar(true, 0, "Initialise DVD\205 (HOLD B if NO DVD Drive)"));
while(DVD_GetCmdBlockStatus(&commandBlock) == DVD_STATE_BUSY) {
if(DVD_LowGetCoverStatus() == 1) {
break;
}
if(padsButtonsHeld() & PAD_BUTTON_B) {
while(padsButtonsHeld() & PAD_BUTTON_B) VIDEO_WaitVSync();
break;
}
}
if(DVD_GetCmdBlockStatus(&commandBlock) != DVD_STATE_END) {
DrawDispose(progBox);
progBox = DrawPublish(DrawMessageBox(D_INFO, "No DVD Drive Detected !!"));
sleep(2);
}
DrawDispose(progBox);
}

uiDrawObj_t *configProgBar = NULL;
Expand Down Expand Up @@ -296,6 +277,15 @@ void populateDeviceAvailability() {
return;
}
uiDrawObj_t *msgBox = DrawPublish(DrawProgressBar(true, 0, "Detecting devices\205\nThis can be skipped by holding B next time"));
while(DVD_GetCmdBlockStatus(&commandBlock) == DVD_STATE_BUSY) {
if(DVD_LowGetCoverStatus() == 1) {
break;
}
if(padsButtonsHeld() & PAD_BUTTON_B) {
deviceHandler_setAllDevicesAvailable();
break;
}
}
int i;
for(i = 0; i < MAX_DEVICES; i++) {
if(allDevices[i] != NULL && !deviceHandler_getDeviceAvailable(allDevices[i])) {
Expand Down

0 comments on commit 5f8d400

Please sign in to comment.