Add Cdvd, need to fix reloactions
Upload Objdiff Progress Report Artifacts / upload (map[game_id:SLUS_210.07 language:us]) (push) Canceled after 0s

This commit is contained in:
2026-09-17 06:55:39 -05:00
parent 28845953e0
commit dd559960a5
5 changed files with 423 additions and 23034 deletions
+1 -1
View File
@@ -305,7 +305,7 @@ segments:
- [0x0807A0, asmtu, cs4/Seimei/src/Fade] - [0x0807A0, asmtu, cs4/Seimei/src/Fade]
- [0x081180, asmtu, cs4/Seimei/src/Blast] - [0x081180, asmtu, cs4/Seimei/src/Blast]
- [0x081760, asmtu, cs4/Seimei/src/Light] - [0x081760, asmtu, cs4/Seimei/src/Light]
- [0x081910, asmtu, cs4/Seimei/src/Cdvd] - [0x081910, c, cs4/Seimei/src/Cdvd]
- [0x0820E0, asmtu, cs4/Seimei/src/Filter] - [0x0820E0, asmtu, cs4/Seimei/src/Filter]
- [0x085190, asmtu, cs4/Seimei/src/msg_util] - [0x085190, asmtu, cs4/Seimei/src/msg_util]
- [0x085610, asmtu, cs4/Seimei/src/DrawOT] - [0x085610, asmtu, cs4/Seimei/src/DrawOT]
-23019
View File
File diff suppressed because it is too large Load Diff
+408 -8
View File
@@ -1,17 +1,417 @@
#include "common.h" #include "common.h"
#include "Cdvd.h"
#include "ee/eeregs.h"
#include "Memory.h"
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", CdvdCheckAsyncBusy); unsigned int GlobalLoadTimer; // size: 0x4, address: 0x257894
LPSETCDVD* lpSetCdvd;
LPLASTCDVD * lpLastCdvd;
LPCDVDREAD* lpCdvdRead;
CDVDREADST CdvdReadSt[256];
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", CdvdAsync);
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", CdvdBackReadProc); void InitCdvdRead(void) {
memset(CdvdReadSt, 0, 0x14C00);
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", CdvdAsyncProc); lpSetCdvd = (LPSETCDVD* ) CdvdReadSt;
lpLastCdvd = (LPLASTCDVD* ) CdvdReadSt;
lpCdvdRead = (LPCDVDREAD* ) CdvdReadSt;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", CdvdRead);
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", MakeCdvdSearchPath); AioInit(0x14);
}
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", MakeCdvdReadPath);
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/Cdvd", InitCdvdRead);
void MakeCdvdReadPath(s8* full, s8* root, s8* fname) {
sprintf(full, "%s%s;1", root, fname);
}
void MakeCdvdSearchPath(s8* full, s8* fname) {
sprintf(full, "\\%s;1", fname);
}
int CdvdRead(char * filename, int size, u_char * * lpBuf, u_char bSynch, int index, int filetype, u_int align)
{
char TmpStr[128]; if (lpSetCdvd->state != 0) return -1;
strcpy(TmpStr, filename);
StringCorrectPath4Disc(TmpStr, 0);
strcpy(lpSetCdvd->fname, SearchFileName(TmpStr));
lpSetCdvd->lplpAddr = lpBuf;
lpSetCdvd->size = size;
lpSetCdvd->index = index;
lpSetCdvd->fileType = filetype;
lpSetCdvd->align = align;
lpSetCdvd->retry = 0;
lpSetCdvd->lpDmyData = NULL;
if (lpSetCdvd->fileType < 0x80) *lpSetCdvd->lplpAddr = NULL;
if (lpSetCdvd->align == 0) lpSetCdvd->align = 0x10;
if (bSynch) {
GetAllBindInfo(lpSetCdvd->fname, &lpSetCdvd->cdlfile.lsn, &lpSetCdvd->cdlfile.size);
if (lpSetCdvd->cdlfile.size == 0) return 0;
if (lpSetCdvd->size <= 0) lpSetCdvd->size = lpSetCdvd->cdlfile.size;
lpCdvdRead->sector = (lpCdvdRead->size + SECTOR_SIZE - 1) / SECTOR_SIZE;
if (lpSetCdvd->fileType < 0x80)
*lpSetCdvd->lplpAddr = MemAllocAlignReal(lpSetCdvd->sector << 0xB, 0x40U, "CdvdRead", "");
fsmfstrm_SetReadStart(0, 0);
if (fsmfstrm_AttachSector(0, lpSetCdvd->cdlfile.lsn, lpSetCdvd->size, 0x30) == 0) {
MemFree(*lpSetCdvd->lplpAddr);
return 0;
}
fsmfstrm_AllocStreamBuffer(0, *lpSetCdvd->lplpAddr, lpSetCdvd->sector << 0xB, 1);
fsmfstrm_SetReadStart(0, 1);
fsmfstrm_DmaReadSyncBlock(0, 1);
FlushCache(0);
return lpSetCdvd->size;
}
lpSetCdvd->state = 1;
lpLastCdvd = (LPLASTCDVD* ) lpSetCdvd;
if (lpSetCdvd < (LPSETCDVD *) &CdvdReadSt[0xFF]) lpSetCdvd++;
else lpSetCdvd = (LPSETCDVD* ) CdvdReadSt;
return 1;
}
u_int CdvdAsyncProc(int bDraw /* r16 */) {
GlobalLoadTimer = 0;
while (1)
{
if (lpLastCdvd->state == 0) break;
if (bDraw != 0) {
FontDrawBegin(1);
FontPrintXY(350.0f, 430.0f, "Now Loading...[%d]\n", GlobalLoadTimer++);
FontDrawEnd();
while ((*D1_CHCR & D_CHCR_STR_M) != 0 || (*D2_CHCR & D_CHCR_STR_M) != 0) {}
DrawSynch();
FlushCache(0);
}
CdvdAsync();
}
return 0;
}
void CdvdBackReadProc(void) {
CdvdAsync();
}
int CdvdAsync(void) {
int aiocmd = 0; /* r29+0x1C */
int aiores = 0; /* r29+0x18 */
int size;
if ((void*)lpCdvdRead == (void*)lpSetCdvd) return 0;
switch (lpCdvdRead->state) {
case 1:
if (lpCdvdRead->size <= 0) {
GetAllBindInfo(lpCdvdRead->fname, &lpCdvdRead->cdlfile.lsn, &lpCdvdRead->cdlfile.size);
size = lpCdvdRead->cdlfile.size;
if (size == 0) break;
lpCdvdRead->size = size;
lpCdvdRead->sector = (lpCdvdRead->size + SECTOR_SIZE - 1) / SECTOR_SIZE;
lpCdvdRead->state = 4;
} else {
lpCdvdRead->sector = (lpCdvdRead->size + SECTOR_SIZE - 1) / SECTOR_SIZE;
lpCdvdRead->state = 4;
}
return 1;
case 2:
if (AioCdSearchFile(lpCdvdRead->sname, &lpCdvdRead->cdlfile) != 0) {
break;
}
lpCdvdRead->state = 3;
return 0;
case 3:
if (AioCmdSync(1, &aiocmd, &aiores) != 0) {
if (aiores < 0) {
break;
}
lpCdvdRead->size = (s32) lpCdvdRead->cdlfile.size;
lpCdvdRead->sector = (lpCdvdRead->size + SECTOR_SIZE - 1) / SECTOR_SIZE;
lpCdvdRead->state = 4;
return 1;
}
return 0;
case 4:
if (lpCdvdRead->fileType < 0x80) {
*lpCdvdRead->lplpAddr = MemAllocAlignReal(lpCdvdRead->sector * SECTOR_SIZE, 0x40, (char *)__FUNCTION__, "");
}
fsmfstrm_SetReadStart(0, 0);
if (fsmfstrm_AttachSector(0, lpCdvdRead->cdlfile.lsn, lpCdvdRead->size, 0x30) == 0) {
MemFree(*lpCdvdRead->lplpAddr);
break;
}
fsmfstrm_AllocStreamBuffer(0, *lpCdvdRead->lplpAddr, lpCdvdRead->sector * SECTOR_SIZE, 1);
fsmfstrm_SetReadStart(0, 1);
lpCdvdRead->state = 5;
return 0;
case 5:
if (fsmfstrm_DmaReadSyncBlock(0, 0) == 0) {
AfterFileReadFunc(*lpCdvdRead->lplpAddr, lpCdvdRead->index, lpCdvdRead->fileType, lpCdvdRead->size);
if ((SND_SqPrepareStatus() == 1) || !(fssdsynthTransBankStatus() & 0xFF)) {
lpCdvdRead->state = 6;
return 0;
}
lpCdvdRead->state = 0;
if (lpCdvdRead < (LPCDVDREAD* )&CdvdReadSt[0xFF]) lpCdvdRead += 1;
else lpCdvdRead = (LPCDVDREAD* ) CdvdReadSt;
FlushCache(0);
}
return 0;
case 6:
if ((SND_SqPrepareStatus() == 0) && (fssdsynthTransBankStatus() & 0xFF)) {
lpCdvdRead->state = 0;
if (lpCdvdRead < (LPCDVDREAD* )&CdvdReadSt[0xFF]) lpCdvdRead += 1;
else lpCdvdRead = (LPCDVDREAD* ) CdvdReadSt;
FlushCache(0);
SND_ReleaseBunk();
}
return 0;
}
lpCdvdRead->state = 0;
if (lpCdvdRead < (LPCDVDREAD* )&CdvdReadSt[0xFF]) lpCdvdRead += 1;
else lpCdvdRead = (LPCDVDREAD* ) CdvdReadSt;
return 0;
}
int CdvdCheckAsyncBusy(void) { return lpLastCdvd->state != 0;
}
+14 -3
View File
@@ -1,6 +1,7 @@
#ifndef CDVD_H #ifndef CDVD_H
#define CDVD_H #define CDVD_H
#include "common.h"
#define SECTOR_SIZE (2048)
typedef struct /* @anon4 */ { typedef struct /* @anon4 */ {
// Members // Members
@@ -116,8 +117,18 @@ typedef struct /* @anon3 */ {
} LPCDVD; // size: 0x4, address: 0x257528 } LPCDVD; // size: 0x4, address: 0x257528
extern unsigned int GlobalLoadTimer; // size: 0x4, address: 0x257894 extern unsigned int GlobalLoadTimer; // size: 0x4, address: 0x257894
extern LPSETCDVD* lpSetCdvd;
extern LPLASTCDVD * lpLastCdvd;
extern LPCDVDREAD* lpCdvdRead;
extern CDVDREADST CdvdReadSt[256];
signed int CdvdRead(char * filename /* r4 */, signed int size /* r20 */, unsigned char * * lpBuf /* r19 */, unsigned char bSynch /* r18 */, signed int index /* r17 */, signed int filetype /* r16 */, unsigned int align /* r21 */); void InitCdvdRead(void);
void MakeCdvdReadPath(s8* full, s8* root, s8* fname);
void MakeCdvdSearchPath(s8* full, s8* fname);
int CdvdRead(char * filename, int size, u_char * * lpBuf, u_char bSynch, int index, int filetype, u_int align);
u_int CdvdAsyncProc(int bDraw);
void CdvdBackReadProc(void);
int CdvdAsync(void);
int CdvdCheckAsyncBusy(void);
#endif // CDVD_H #endif // CDVD_H
-3
View File
@@ -14,9 +14,6 @@
unsigned char RootPath[128]; // size: 0x80, address: 0x325530 unsigned char RootPath[128]; // size: 0x80, address: 0x325530
unsigned char ScePath[128]; // size: 0x80, address: 0x3254B0 unsigned char ScePath[128]; // size: 0x80, address: 0x3254B0
// Belongs in CDVD.c
unsigned int GlobalLoadTimer;
void InitFileSystem() { void InitFileSystem() {
/* anonymous block */ /* anonymous block */
// Range: 0x138C20 -> 0x138C78 // Range: 0x138C20 -> 0x138C78