- implement data_ready, sector_ready, loadsectors (for PSX)

- dummy CdDiskReady function
This commit is contained in:
Ilya Shurumov 2020-04-11 17:21:25 +06:00
parent 478f059614
commit 63be8e1ce4
3 changed files with 44 additions and 31 deletions

View File

@ -469,3 +469,9 @@ void* CdDataCallback(void(*func)())
UNIMPLEMENTED();
return NULL;
}
int CdDiskReady(int mode)
{
UNIMPLEMENTED();
return NULL;
}

View File

@ -148,7 +148,7 @@ void test_changemode(void)
{
switch_spooltype = 0;
CdReadyCallback(0);
CdControlF(9, 0);
CdControlF(CdlPause, 0);
}
else if (current_sector == spooldata[spoolpos_reading].sector)
{
@ -721,7 +721,9 @@ void UpdateSpool(void)
#ifdef PSX
CdIntToPos(current_sector, &pos);
CdControlF(0x1b, (u_char*)&pos);
CdControlF(CdlReadS, (u_char*)&pos);
#else
#endif // PSX
}
}
@ -1981,7 +1983,7 @@ void FoundError(char *name, unsigned char intr, unsigned char *result)
spoolerror = 0x3c;
CdIntToPos(current_sector, &p);
CdControlF(0x1b, (u_char*)&p);
CdControlF(CdlReadS, (u_char*)&p);
}

View File

@ -1474,15 +1474,15 @@ void ReportMode(int on)
static unsigned char endread = 0;
static unsigned char load_complete = 0;
// [D]
void data_ready(void)
{
UNIMPLEMENTED();
/*
if (endread != '\0') {
if (endread != 0)
{
CdDataCallback(0);
load_complete = '\x01';
load_complete = 1;
}
return;*/
return;
}
@ -1519,37 +1519,43 @@ static int sectors_read = 0; // offset 0xAB284
static int sectors_this_chunk = 0; // offset 0xAB174
static int sectors_to_read = 0; // offset 0xAB170
// [D]
void sector_ready(unsigned char intr, unsigned char *result)
{
UNIMPLEMENTED();
/*
int iVar1;
CdlLOC auStack16;
CdlLOC p;
if (intr == '\x01') {
if (intr == '\x01')
{
CdGetSector(current_address, 0x200);
current_address = current_address + 0x800;
current_sector = current_sector + 1;
sectors_left = sectors_left + -1;
if (sectors_left == 0) {
if (sectors_left == 0)
{
endread = '\x01';
CdReadyCallback(0);
CdControlF(9, 0);
CdControlF(CdlPause, 0);
}
}
else {
if ((*result & 0x10) != 0) {
else
{
if ((*result & 0x10) != 0)
{
CdReadyCallback(0);
do {
iVar1 = CdDiskReady(1);
} while (iVar1 != 2);
CdReadyCallback(sector_ready);
}
CdIntToPos(current_sector, &auStack16);
CdControlF(0x1b, &auStack16);
CdIntToPos(current_sector, &p);
CdControlF(CdlReadS, (unsigned char*)&p);
}
return;
*/
}
@ -1576,28 +1582,27 @@ void sector_ready(unsigned char intr, unsigned char *result)
// Start line: 5026
/* end block 3 */
// End Line: 5027
#ifdef PSX
void loadsectors(char *addr, int sector, int nsectors)
{
UNIMPLEMENTED();
/*
CdlLOC pos;
CdlLOC auStack16;
load_complete = 0;
endread = 0;
load_complete = '\0';
endread = '\0';
current_sector = sector;
sectors_left = nsectors;
current_address = addr;
CdIntToPos(sector, &auStack16);
CdControlF(0x1b, &auStack16);
CdIntToPos(sector, &pos);
CdControlF(CdlReadS, (unsigned char*)&pos);
CdDataCallback(data_ready);
CdReadyCallback(sector_ready);
do {
} while (load_complete == '\0');
ShowLoading();
return;*/
return;
}
#else
// It has to be this way
@ -2252,14 +2257,14 @@ LAB_0007f244:
DoCDRetry();
}
iVar3 = CdControlB(2, (u_char*)&fp, 0);
} while ((iVar3 == 0) || (iVar3 = CdRead(1, &DAT_000f3000, 0x80), iVar3 == 0));
} while ((iVar3 == 0) || (iVar3 = CdRead(1, (u_long*)_other_buffer, 0x80), iVar3 == 0));
iVar3 = CdReadSync(0, result);
} while (iVar3 != 0);
iVar3 = 3;
cdp = citylumps[GameLevel];
piVar4 = &DAT_000f3008;
piVar4 = (int*)(_other_buffer + 8);
do {
iVar3 = iVar3 + -1;
cdp->x = *piVar4 + levOfs * 0x800;