Fixed the return result of FStype_ToString, added some missing GPL statements in a few files, merged a few redundant functions, and such...

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2267 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-11-28 08:13:49 +00:00
parent c2368da81c
commit fd141f08e7
14 changed files with 194 additions and 78 deletions

View File

@ -20,8 +20,6 @@
#include "IopCommon.h"
#include "CDVD/CDVDaccess.h"
//extern char isoFileName[];
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
@ -46,13 +44,17 @@ static __forceinline s32 msf_to_lba(u8 m, u8 s, u8 f)
static __forceinline void lsn_to_msf(u8 *Time, s32 lsn)
{
lsn += 150;
Time[2] = lsn / 4500; // minuten
lsn = lsn - Time[2] * 4500; // minuten rest
Time[1] = lsn / 75; // sekunden
Time[0] = lsn - Time[1] * 75; // sekunden rest
}
u8 m, s, f;
lsn += 150;
m = lsn / 4500; // minuten
lsn = lsn - m * 4500; // minuten rest
s = lsn / 75; // sekunden
f = lsn - (s * 75); // sekunden rest
Time[0] = itob(m);
Time[1] = itob(s);
Time[2] = itob(f);
}
static __forceinline void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
{

View File

@ -76,8 +76,6 @@ extern void DoCDVDclose();
extern s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode);
extern s32 DoCDVDreadTrack(u32 lsn, int mode);
extern s32 DoCDVDgetBuffer(u8* buffer);
//extern s32 DoCDVDreadSubQ(u32 lsn, cdvdSubQ* subq);
extern void DoCDVDnewDiskCB(void (*callback)());
extern s32 DoCDVDdetectDiskType();
extern void DoCDVDresetDiskTypeCache();

View File

@ -343,9 +343,9 @@ void cdrInterrupt() {
lsn_to_msf(cdr.ResultTD, trackInfo.lsn);
cdr.Stat = Acknowledge;
cdr.Result[0] = cdr.StatP;
cdr.Result[1] = itob(cdr.ResultTD[0]);
cdr.Result[2] = itob(cdr.ResultTD[1]);
cdr.Result[3] = itob(cdr.ResultTD[2]);
cdr.Result[1] = cdr.ResultTD[0]; //itob(cdr.ResultTD[0]);
cdr.Result[2] = cdr.ResultTD[1]; //itob(cdr.ResultTD[1]);
cdr.Result[3] = cdr.ResultTD[2]; //itob(cdr.ResultTD[2]);
}
break;

View File

@ -1,3 +1,18 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
enum IsoFS_Type

View File

@ -31,8 +31,8 @@ wxString IsoDirectory::FStype_ToString() const
{
switch( m_fstype )
{
case FStype_ISO9660: L"ISO9660"; break;
case FStype_Joliet: L"Joliet"; break;
case FStype_ISO9660: return L"ISO9660"; break;
case FStype_Joliet: return L"Joliet"; break;
}
return wxsFormat( L"Unrecognized Code (0x%x)", m_fstype );
@ -42,40 +42,42 @@ wxString IsoDirectory::FStype_ToString() const
IsoDirectory::IsoDirectory(SectorSource& r)
: internalReader(r)
{
m_fstype = FStype_ISO9660;
IsoFileDescriptor rootDirEntry;
bool isValid = false;
bool done = false;
uint i = 16;
while( true )
m_fstype = FStype_ISO9660;
while( !done )
{
u8 sector[2048];
internalReader.readSector(sector,i);
if( memcmp( &sector[1], "CD001", 5 ) == 0 )
{
if( sector[0] == 0 )
{
Console.WriteLn( Color_Green, "(IsoFS) Block 0x%x: Boot partition info.", i );
}
else if( sector[0] == 1 )
{
Console.WriteLn( "(IsoFS) Block 0x%x: Primary partition info.", i );
rootDirEntry.Load( sector+156, 38 );
isValid = true;
}
switch (sector[0])
{
case 0:
Console.WriteLn( Color_Green, "(IsoFS) Block 0x%x: Boot partition info.", i );
break;
case 1:
Console.WriteLn( "(IsoFS) Block 0x%x: Primary partition info.", i );
rootDirEntry.Load( sector+156, 38 );
isValid = true;
break;
else if( sector[0] == 2 )
{
// Probably means Joliet (long filenames support), which PCSX2 doesn't care about.
Console.WriteLn( Color_Green, "(IsoFS) Block 0x%x: Extended partition info.", i );
m_fstype = FStype_Joliet;
}
case 2:
// Probably means Joliet (long filenames support), which PCSX2 doesn't care about.
Console.WriteLn( Color_Green, "(IsoFS) Block 0x%x: Extended partition info.", i );
m_fstype = FStype_Joliet;
break;
else if( sector[0] == 0xff )
{
// Null terminator. End of partition information.
break;
case 0xff:
default:
// Null terminator. End of partition information.
done = true;
break;
}
}
else
@ -91,7 +93,7 @@ IsoDirectory::IsoDirectory(SectorSource& r)
if( !isValid )
throw Exception::BadStream( "IsoFS", "Root directory not found on ISO image." );
DevCon.WriteLn( "(IsoFS) Filesystem is %s", FStype_ToString().c_str() );
DevCon.WriteLn( L"(IsoFS) Filesystem is " + FStype_ToString() );
Init( rootDirEntry );
}

View File

@ -1,3 +1,18 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
class IsoFile;

View File

@ -1,3 +1,18 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdio.h>

View File

@ -1,3 +1,18 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "IsoFileDescriptor.h"

View File

@ -1,3 +1,18 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
struct IsoFileDescriptor
@ -26,4 +41,4 @@ struct IsoFileDescriptor
bool IsFile() const { return !(flags & 2); }
bool IsDir() const { return !IsFile(); }
};
};

View File

@ -1,3 +1,18 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2009 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
class SectorSource

View File

@ -256,30 +256,6 @@ bool isoSetFormat(isoFile *iso, int blockofs, uint blocksize, uint blocks)
return true;
}
static s32 MSFtoLSN(u8 *Time)
{
u32 lsn;
lsn = Time[2];
lsn += (Time[1] - 2) * 75;
lsn += Time[0] * 75 * 60;
return lsn;
}
static void LSNtoMSF(u8 *Time, s32 lsn)
{
u8 m, s, f;
lsn += 150;
m = lsn / 4500; // minuten
lsn = lsn - m * 4500; // minuten rest
s = lsn / 75; // sekunden
f = lsn - (s * 75); // sekunden rest
Time[0] = itob(m);
Time[1] = itob(s);
Time[2] = itob(f);
}
bool _isoReadBlock(isoFile *iso, u8 *dst, int lsn)
{
u64 ofs = (u64)lsn * iso->blocksize + iso->offset;
@ -376,7 +352,7 @@ bool isoReadBlock(isoFile *iso, u8 *dst, uint lsn)
if (iso->type == ISOTYPE_CD)
{
LSNtoMSF(dst + 12, lsn);
lsn_to_msf(dst + 12, lsn);
dst[15] = 2;
}

View File

@ -40,9 +40,6 @@ enum isoFlags
static const int CD_FRAMESIZE_RAW = 2448;
//#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
//#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
struct _multih
{
u32 slsn;

View File

@ -59,6 +59,57 @@ union tDMA_SADR {
wxString desc() { return wxsFormat(L"Sadr: 0x%x", _u32); }
};
union tDMA_MADR {
struct {
u32 ADDR : 31; // Transfer memory address
u32 SPR : 1; // Memory/SPR Address
};
u32 _u32;
tDMA_MADR(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Madr: 0x%x", _u32); }
};
union tDMA_TADR {
struct {
u32 ADDR : 31; // Next Tag address
u32 SPR : 1; // Memory/SPR Address
};
u32 _u32;
tDMA_TADR(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Tadr: 0x%x", _u32); }
};
union tDMA_ASR { // The Address Stack Register
struct {
u32 ADDR : 31; // Tag memory address
u32 SPR : 1; // Memory/SPR Address
};
u32 _u32;
tDMA_ASR(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"Asr: 0x%x", _u32); }
};
union tDMA_QWC {
struct {
u32 QWC : 16;
u32 reserved2 : 16;
};
u32 _u32;
tDMA_QWC(u32 val) { _u32 = val; }
void reset() { _u32 = 0; }
wxString desc() { return wxsFormat(L"QWC: 0x%x", _u32); }
};
struct DMACh {
tDMA_CHCR chcr;

View File

@ -133,9 +133,9 @@ void iDumpRegisters(u32 startpc, u32 temp)
DMACh* p = (DMACh*)(PS2MEM_HW+dmacs[i]);
__Log("dma%d c%x m%x q%x t%x s%x", i, p->chcr._u32, p->madr, p->qwc, p->tadr, p->sadr);
}
__Log("dmac %x %x %x %x", psHu32(DMAC_CTRL), psHu32(DMAC_STAT), psHu32(DMAC_RBSR), psHu32(DMAC_RBOR));
__Log("intc %x %x", psHu32(INTC_STAT), psHu32(INTC_MASK));
__Log("sif: %x %x %x %x %x", psHu32(0xf200), psHu32(0xf220), psHu32(0xf230), psHu32(0xf240), psHu32(0xf260));
__Log(L"dmac " + dmacRegs->ctrl.desc() + L" " + dmacRegs->stat.desc() + L" " + dmacRegs->rbsr.desc() + L" " + dmacRegs->rbor.desc());
__Log(L"intc " + intcRegs->stat.desc() + L" " + intcRegs->mask.desc());
__Log("sif: %x %x %x %x %x", psHu32(SBUS_F200), psHu32(SBUS_F220), psHu32(SBUS_F230), psHu32(SBUS_F240), psHu32(SBUS_F260));
#endif
}
@ -152,19 +152,19 @@ void iDumpVU0Registers()
{
case REG_Q:
case REG_P:
__Log("%f\n", VU0.VI[i].F);
__Log("%f", VU0.VI[i].F);
break;
case REG_MAC_FLAG:
__Log("%x\n", 0);//VU0.VI[i].UL&0xff);
__Log("%x", 0);//VU0.VI[i].UL&0xff);
break;
case REG_STATUS_FLAG:
__Log("%x\n", 0);//VU0.VI[i].UL&0x03);
__Log("%x", 0);//VU0.VI[i].UL&0x03);
break;
case REG_CLIP_FLAG:
__Log("0\n");
__Log("0");
break;
default:
__Log("%x\n", VU0.VI[i].UL);
__Log("%x", VU0.VI[i].UL);
break;
}
}
@ -261,7 +261,7 @@ void iDumpBlock( int startpc, u8 * ptr )
eff.Printf( "\n" );
eff.Printf( " " );
// TODO : Finish converting this over to wxWidgers wxFile stuff...
// TODO : Finish converting this over to wxWidgets wxFile stuff...
/*
int count;
EEINST* pcur;