From 361df4799c47ad6b60777557a4953ef565c86ac7 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 23 Aug 2012 04:28:34 +0000 Subject: [PATCH] Only copy the parts that have actually data to the requesting client for VTOC and friends. Fixes kickOff 98 (thanks ripsaw). Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3795 --- src/dos/dos_mscdex.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index 835bcfc7..125c30e9 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -616,8 +616,13 @@ bool CMscdex::GetCopyrightName(Bit16u drive, PhysPt data) { PhysPt ptoc = GetTempBuffer(); success = ReadVTOC(drive,0x00,ptoc,error); if (success) { - MEM_BlockCopy(data,ptoc+702,37); - mem_writeb(data+37,0); + Bitu len; + for (len=0;len<37;len++) { + Bit8u c=mem_readb(ptoc+702+len); + if (c==0 || c==0x20) break; + } + MEM_BlockCopy(data,ptoc+702,len); + mem_writeb(data+len,0); }; return success; } @@ -628,8 +633,13 @@ bool CMscdex::GetAbstractName(Bit16u drive, PhysPt data) { PhysPt ptoc = GetTempBuffer(); success = ReadVTOC(drive,0x00,ptoc,error); if (success) { - MEM_BlockCopy(data,ptoc+739,37); - mem_writeb(data+37,0); + Bitu len; + for (len=0;len<37;len++) { + Bit8u c=mem_readb(ptoc+739+len); + if (c==0 || c==0x20) break; + } + MEM_BlockCopy(data,ptoc+739,len); + mem_writeb(data+len,0); }; return success; } @@ -640,8 +650,13 @@ bool CMscdex::GetDocumentationName(Bit16u drive, PhysPt data) { PhysPt ptoc = GetTempBuffer(); success = ReadVTOC(drive,0x00,ptoc,error); if (success) { - MEM_BlockCopy(data,ptoc+776,37); - mem_writeb(data+37,0); + Bitu len; + for (len=0;len<37;len++) { + Bit8u c=mem_readb(ptoc+776+len); + if (c==0 || c==0x20) break; + } + MEM_BlockCopy(data,ptoc+776,len); + mem_writeb(data+len,0); }; return success; }