From f787df5d5d5c81cc8a067802e99521fc8190ff80 Mon Sep 17 00:00:00 2001 From: Ilya Shurumov Date: Sat, 17 Apr 2021 20:59:52 +0600 Subject: [PATCH] - [Psy-X] fix CD warnings --- src_rebuild/Game/C/main.c | 2 -- src_rebuild/PsyX/src/PSX/LIBCD.C | 26 +++++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src_rebuild/Game/C/main.c b/src_rebuild/Game/C/main.c index c0cfa7ad..32f179a9 100644 --- a/src_rebuild/Game/C/main.c +++ b/src_rebuild/Game/C/main.c @@ -1658,8 +1658,6 @@ void DrawGame(void) return; } - static int frame = 0; - if (NumPlayers == 1 || NoPlayerControl) { ObjectDrawnValue = FrameCnt; diff --git a/src_rebuild/PsyX/src/PSX/LIBCD.C b/src_rebuild/PsyX/src/PSX/LIBCD.C index d060f06f..cc6a6e93 100644 --- a/src_rebuild/PsyX/src/PSX/LIBCD.C +++ b/src_rebuild/PsyX/src/PSX/LIBCD.C @@ -140,6 +140,19 @@ void _eCdControlF_Pause(); //---------------------------------------------------------- +int PsyX_CD_CheckImageAvailable() +{ + if (g_UseCDImage) + { + if (g_imageFp == NULL) + eprintwarn("WARNING - CD subsystem is not initialized yet!\n"); + else + return 1; + } + + return 0; +} + CdlFILE* CdSearchFile(CdlFILE* fp, char* name) { char pathPart[16]; @@ -152,11 +165,8 @@ CdlFILE* CdSearchFile(CdlFILE* fp, char* name) memset(fp, 0, sizeof(CdlFILE)); - if (g_imageFp == NULL) - { - eprintwarn("WARNING - CD subsystem is not initialized yet!\n"); + if (!PsyX_CD_CheckImageAvailable()) return NULL; - } assert(g_cdReadDoneFlag == true); @@ -276,7 +286,7 @@ int CdControl(u_char com, u_char * param, u_char * result) g_CD_com = com; - if (g_imageFp == NULL) + if (!PsyX_CD_CheckImageAvailable()) return 0; switch (com) @@ -312,6 +322,9 @@ int CdControlB(u_char com, u_char* param, u_char* result) { int ret; + if (!PsyX_CD_CheckImageAvailable()) + return 0; + ret = 0; switch (com) @@ -356,6 +369,9 @@ int CdControlF(u_char com, u_char * param) g_CD_com = com; + if (!PsyX_CD_CheckImageAvailable()) + return 0; + switch (com) { case CdlSetloc: