Skip to content

Commit

Permalink
- Detect WODE using ExtCFG disc ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Feb 19, 2025
1 parent a9a70f9 commit f764b0e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions cube/swiss/include/swiss.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ extern file_handle curDir;
extern char IPLInfo[256] __attribute__((aligned(32)));
extern dvdcmdblk commandBlock;
extern dvddrvinfo driveInfo;
extern dvddiskid *DVDDiskID;
extern DiskHeader GCMDisk;

extern s32 DVD_LowGetCoverStatus(void);
Expand Down
8 changes: 7 additions & 1 deletion cube/swiss/source/devices/wode/deviceHandler-WODE.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,15 @@ s32 deviceHandler_WODE_closeFile(file_handle* file) {
return 0;
}

static const dvddiskid WODEExtCFG = {
.gamename = "GWDP",
.company = "CF",
.magic = DVD_MAGIC
};

bool deviceHandler_WODE_test() {
while(DVD_LowGetCoverStatus() == 0);
return swissSettings.hasDVDDrive && driveInfo.rel_date == 0x20080714;
return swissSettings.hasDVDDrive && !memcmp(DVDDiskID, &WODEExtCFG, sizeof(dvddiskid));
}

u32 deviceHandler_WODE_emulated() {
Expand Down
10 changes: 8 additions & 2 deletions cube/swiss/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

dvdcmdblk commandBlock;
dvddrvinfo driveInfo __attribute__((aligned(32)));
dvddiskid *DVDDiskID = (dvddiskid*)0x80000000;
SwissSettings swissSettings;

static void driveInfoCallback(s32 result, dvdcmdblk *block) {
Expand Down Expand Up @@ -84,7 +85,12 @@ void Initialise(void)

void __SYS_PreInit(void)
{
DCZeroRange((void *)0x80000000, 0x3100);
u32 start = 0x80000000, end = 0x80003100;

if (DVDDiskID->magic == DVD_MAGIC)
start += sizeof(dvddiskid);

DCZeroRange((void *)start, end - start);

switch (((vu16 *)0xCC004000)[20] & 7) {
case 0:
Expand All @@ -109,7 +115,7 @@ void __SYS_PreInit(void)
else
*(u32 *)0x8000002C = SYS_CONSOLE_DEVELOPMENT_HW1;

*(u32 *)0x8000002C += ((vu32*)0xCC003000)[11] >> 28;
*(u32 *)0x8000002C += ((vu32 *)0xCC003000)[11] >> 28;

*(u32 *)0x800000F0 = 0x1800000;
*(u32 *)0x800000F8 = TB_BUS_CLOCK;
Expand Down

0 comments on commit f764b0e

Please sign in to comment.