mirror of https://github.com/PCSX2/pcsx2.git
Fixed some bleedthrough on the colors on the console, took care of a typo I made earier, and did assorted cleanup.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1566 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
4eaa5265df
commit
93d6d5a2ac
|
@ -294,11 +294,8 @@ s32 cdvdReadConfig(u8* config)
|
|||
}
|
||||
s32 cdvdWriteConfig(const u8* config)
|
||||
{
|
||||
// make sure its in write mode
|
||||
if(cdvd.CReadWrite != 1)
|
||||
return 1;
|
||||
// check if block index is in bounds
|
||||
else if(cdvd.CBlockIndex >= cdvd.CNumBlocks)
|
||||
// make sure its in write mode && the block index is in bounds
|
||||
if ((cdvd.CReadWrite != 1) || (cdvd.CBlockIndex >= cdvd.CNumBlocks))
|
||||
return 1;
|
||||
else if(
|
||||
((cdvd.COffset == 0) && (cdvd.CBlockIndex >= 4))||
|
||||
|
@ -543,14 +540,12 @@ void cdvdNewDiskCB()
|
|||
|
||||
void mechaDecryptBytes( u32 madr, int size )
|
||||
{
|
||||
int i;
|
||||
|
||||
int shiftAmount = (cdvd.decSet>>4) & 7;
|
||||
int doXor = (cdvd.decSet) & 1;
|
||||
int doShift = (cdvd.decSet) & 2;
|
||||
|
||||
u8* curval = iopPhysMem( madr );
|
||||
for( i=0; i<size; ++i, ++curval )
|
||||
for( int i=0; i<size; ++i, ++curval )
|
||||
{
|
||||
if( doXor ) *curval ^= cdvd.Key[4];
|
||||
if( doShift ) *curval = (*curval >> shiftAmount) | (*curval << (8-shiftAmount) );
|
||||
|
@ -600,9 +595,8 @@ int cdvdReadSector() {
|
|||
}
|
||||
else
|
||||
{
|
||||
// Assumed the other dualType is 0.
|
||||
// single layer disc
|
||||
// or on first layer of dual layer disc
|
||||
// Assuming the other dualType is 0,
|
||||
// single layer disc, or on first layer of dual layer disc.
|
||||
layerNum = 0;
|
||||
lsn += 0x30000;
|
||||
}
|
||||
|
@ -634,7 +628,7 @@ int cdvdReadSector() {
|
|||
// Final Fantasy X-2 crashing. So we won't.
|
||||
|
||||
DevCon::WriteLn("Bad Transfer!");
|
||||
for (int i = 12; i > 2060; i++)
|
||||
for (int i = 12; i <= 2060; i++)
|
||||
{
|
||||
mdest[i] = 0;
|
||||
}
|
||||
|
@ -789,7 +783,6 @@ __forceinline void cdvdReadInterrupt()
|
|||
cdvd.Ready = CDVD_READY2;
|
||||
|
||||
// All done! :D
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,43 @@ 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 */
|
||||
|
||||
static __forceinline s32 msf_to_lsn(u8 *Time)
|
||||
{
|
||||
u32 lsn;
|
||||
|
||||
lsn = Time[2];
|
||||
lsn +=(Time[1] - 2) * 75;
|
||||
lsn += Time[0] * 75 * 60;
|
||||
return lsn;
|
||||
}
|
||||
|
||||
static __forceinline s32 msf_to_lba(u8 m, u8 s, u8 f)
|
||||
{
|
||||
u32 lsn;
|
||||
lsn = f;
|
||||
lsn += (s - 2) * 75;
|
||||
lsn += m * 75 * 60;
|
||||
return lsn;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
static __forceinline void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
|
||||
{
|
||||
lba += 150;
|
||||
*m = lba / (60 * 75);
|
||||
*s = (lba / 75) % 60;
|
||||
*f = lba % 75;
|
||||
}
|
||||
|
||||
struct cdvdRTC {
|
||||
u8 status;
|
||||
u8 second;
|
||||
|
|
|
@ -305,9 +305,7 @@ s32 DoCDVDopen(const char* pTitleFilename)
|
|||
cdvdTD td;
|
||||
CDVD.getTD(0, &td);
|
||||
|
||||
int blockofs = 0;
|
||||
int blocksize = 0;
|
||||
int blocks = td.lsn;
|
||||
int blockofs = 0, blocksize = 0, blocks = td.lsn;
|
||||
|
||||
switch(cdtype)
|
||||
{
|
||||
|
|
|
@ -30,79 +30,21 @@
|
|||
#include "CDVDisoReader.h"
|
||||
|
||||
char isoFileName[g_MaxPath];
|
||||
|
||||
u8 *pbuffer;
|
||||
int cdtype;
|
||||
|
||||
static int psize;
|
||||
|
||||
isoFile *iso;
|
||||
|
||||
FILE *cdvdLog = NULL;
|
||||
|
||||
static int psize, cdtype;
|
||||
u8 cdbuffer[2352] = {0};
|
||||
|
||||
s32 msf_to_lba(u8 m, u8 s, u8 f)
|
||||
{
|
||||
u32 lsn;
|
||||
lsn = f;
|
||||
lsn += (s - 2) * 75;
|
||||
lsn += m * 75 * 60;
|
||||
return lsn;
|
||||
}
|
||||
|
||||
void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
|
||||
{
|
||||
lba += 150;
|
||||
*m = lba / (60 * 75);
|
||||
*s = (lba / 75) % 60;
|
||||
*f = lba % 75;
|
||||
}
|
||||
|
||||
//#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
|
||||
//#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
|
||||
|
||||
|
||||
/*#ifdef PCSX2_DEBUG
|
||||
void __Log(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (cdvdLog == NULL) return;
|
||||
|
||||
va_start(list, fmt);
|
||||
vfprintf(cdvdLog, fmt, list);
|
||||
va_end(list);
|
||||
}
|
||||
#else
|
||||
#define __Log 0&&
|
||||
#endif*/
|
||||
isoFile *iso;
|
||||
|
||||
s32 CALLBACK ISOinit()
|
||||
{
|
||||
/*#ifdef PCSX2_DEBUG
|
||||
cdvdLog = fopen("logs/cdvdLog.txt", "w");
|
||||
if (cdvdLog == NULL)
|
||||
{
|
||||
cdvdLog = fopen("cdvdLog.txt", "w");
|
||||
if (cdvdLog == NULL)
|
||||
{
|
||||
Console::Error("Can't create cdvdLog.txt");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
setvbuf(cdvdLog, NULL, _IONBF, 0);*/
|
||||
CDVD_LOG("CDVDinit\n");
|
||||
/*#endif*/
|
||||
CDVD_LOG("ISOinit\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CALLBACK ISOshutdown()
|
||||
{
|
||||
/*#ifdef CDVD_LOG
|
||||
if (cdvdLog != NULL) fclose(cdvdLog);
|
||||
#endif*/
|
||||
CDVD_LOG("ISOshutdown\n");
|
||||
}
|
||||
|
||||
s32 CALLBACK ISOopen(const char* pTitle)
|
||||
|
@ -246,7 +188,7 @@ s32 CALLBACK ISOgetTOC(void* toc)
|
|||
u8 type = ISOgetDiskType();
|
||||
u8* tocBuff = (u8*)toc;
|
||||
|
||||
//__Log("CDVDgetTOC\n");
|
||||
//CDVD_LOG("CDVDgetTOC\n");
|
||||
|
||||
if (type == CDVD_TYPE_DVDV || type == CDVD_TYPE_PS2DVD)
|
||||
{
|
||||
|
|
|
@ -29,19 +29,6 @@
|
|||
#include "IsoFStools.h"
|
||||
#include "IsoFileFormats.h"
|
||||
|
||||
//#define CDVD_LOG __Log
|
||||
|
||||
//#ifndef MAX_PATH
|
||||
//#define MAX_PATH 255
|
||||
//#endif
|
||||
|
||||
//extern FILE *cdvdLog;
|
||||
|
||||
//void __Log(char *fmt, ...);
|
||||
|
||||
//#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
|
||||
//#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
|
||||
|
||||
extern char isoFileName[g_MaxPath];
|
||||
extern isoFile *iso;
|
||||
|
||||
|
|
|
@ -118,30 +118,13 @@ static __forceinline void SetResultSize(u8 size) {
|
|||
cdr.ResultReady = 1;
|
||||
}
|
||||
|
||||
static __forceinline s32 MSFtoLSN(u8 *Time) {
|
||||
u32 lsn;
|
||||
|
||||
lsn = Time[2];
|
||||
lsn+=(Time[1] - 2) * 75;
|
||||
lsn+= Time[0] * 75 * 60;
|
||||
return lsn;
|
||||
}
|
||||
|
||||
static __forceinline void LSNtoMSF(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
|
||||
}
|
||||
|
||||
static void ReadTrack() {
|
||||
cdr.Prev[0] = itob(cdr.SetSector[0]);
|
||||
cdr.Prev[1] = itob(cdr.SetSector[1]);
|
||||
cdr.Prev[2] = itob(cdr.SetSector[2]);
|
||||
|
||||
CDR_LOG("KEY *** %x:%x:%x", cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]);
|
||||
cdr.RErr = DoCDVDreadTrack(MSFtoLSN(cdr.SetSector), CDVD_MODE_2340);
|
||||
cdr.RErr = DoCDVDreadTrack(msf_to_lsn(cdr.SetSector), CDVD_MODE_2340);
|
||||
}
|
||||
|
||||
// cdr.Stat:
|
||||
|
@ -351,7 +334,7 @@ void cdrInterrupt() {
|
|||
cdr.Stat = DiskError;
|
||||
cdr.Result[0]|= 0x01;
|
||||
} else {
|
||||
LSNtoMSF(cdr.ResultTD, trackInfo.lsn);
|
||||
lsn_to_msf(cdr.ResultTD, trackInfo.lsn);
|
||||
cdr.Stat = Acknowledge;
|
||||
cdr.Result[0] = cdr.StatP;
|
||||
cdr.Result[1] = itob(cdr.ResultTD[0]);
|
||||
|
@ -397,11 +380,14 @@ void cdrInterrupt() {
|
|||
SetResultSize(4);
|
||||
*(int*)cdr.Result = *(int*)Test20;
|
||||
break;
|
||||
|
||||
case 0x22:
|
||||
SetResultSize(8);
|
||||
*(int*)cdr.Result = *(int*)Test22;
|
||||
break;
|
||||
case 0x23: case 0x24:
|
||||
|
||||
case 0x23:
|
||||
case 0x24:
|
||||
SetResultSize(8);
|
||||
*(int*)cdr.Result = *(int*)Test23;
|
||||
break;
|
||||
|
@ -456,8 +442,7 @@ void cdrInterrupt() {
|
|||
break;
|
||||
|
||||
case READ_ACK:
|
||||
if (!cdr.Reading)
|
||||
return;
|
||||
if (!cdr.Reading) return;
|
||||
|
||||
SetResultSize(1);
|
||||
cdr.StatP|= 0x2;
|
||||
|
|
|
@ -68,8 +68,7 @@ int IsoFS_open(const char *name, int mode){
|
|||
static struct TocEntry tocEntry;
|
||||
|
||||
// check if the file exists
|
||||
if (IsoFS_findFile(name, &tocEntry) != TRUE)
|
||||
return -1;
|
||||
if (IsoFS_findFile(name, &tocEntry) != TRUE) return -1;
|
||||
|
||||
if(mode != 1) return -2; //SCE_RDONLY
|
||||
|
||||
|
@ -117,11 +116,12 @@ int IsoFS_lseek(int fd, int offset, int whence){
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (fd_table[fd].filePos < 0)
|
||||
fd_table[fd].filePos = 0;
|
||||
if (fd_table[fd].filePos < 0) fd_table[fd].filePos = 0;
|
||||
|
||||
if (fd_table[fd].filePos > fd_table[fd].fileSize)
|
||||
{
|
||||
fd_table[fd].filePos = fd_table[fd].fileSize;
|
||||
}
|
||||
|
||||
return fd_table[fd].filePos;
|
||||
}
|
||||
|
@ -152,7 +152,9 @@ int IsoFS_read( int fd, char *buffer, int size )
|
|||
}
|
||||
|
||||
if ((fd_table[fd].filePos + size) > fd_table[fd].fileSize)
|
||||
{
|
||||
size = fd_table[fd].fileSize - fd_table[fd].filePos;
|
||||
}
|
||||
|
||||
// Now work out where we want to start reading from
|
||||
asector = ssector = fd_table[fd].LBA + (fd_table[fd].filePos >> 11);
|
||||
|
@ -179,7 +181,7 @@ int IsoFS_read( int fd, char *buffer, int size )
|
|||
}
|
||||
memcpy_fast(buffer, lb + off_sector, ssize);
|
||||
}
|
||||
if (asize) if (IsoFS_readSectors(asector, asize >> 11, buffer+ssize) != TRUE)
|
||||
if (asize && (IsoFS_readSectors(asector, asize >> 11, buffer+ssize) != TRUE))
|
||||
{
|
||||
ISOFS_LOG("[IsoFSdrv:read] Couldn't Read from file for some reason");
|
||||
return 0;
|
||||
|
@ -228,6 +230,7 @@ int IsoFS_close( int fd)
|
|||
ISOFS_LOG("[IsoFSdrv:close] ERROR: File does not appear to be open!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ISOFS_LOG("[IsoFSdrv:close] internal fd %d", fd);
|
||||
fd_used[fd] = 0;
|
||||
files_open--;
|
||||
|
|
|
@ -113,10 +113,10 @@ void TocEntryCopy(TocEntry* tocEntry, const dirTocEntry* internalTocEntry){
|
|||
|
||||
filenamelen = internalTocEntry->filenameLength/2;
|
||||
|
||||
if (!(tocEntry->fileProperties & 0x02)){
|
||||
// if (!(tocEntry->fileProperties & 0x02)){
|
||||
// strip the ;1 from the filename
|
||||
// filenamelen -= 2;//(Florin) nah, do not strip ;1
|
||||
}
|
||||
// }
|
||||
|
||||
for (i=0; i < filenamelen; i++)
|
||||
tocEntry->filename[i] = internalTocEntry->filename[(i<<1)+1];
|
||||
|
@ -126,10 +126,10 @@ void TocEntryCopy(TocEntry* tocEntry, const dirTocEntry* internalTocEntry){
|
|||
else{
|
||||
filenamelen = internalTocEntry->filenameLength;
|
||||
|
||||
if (!(tocEntry->fileProperties & 0x02)){
|
||||
// if (!(tocEntry->fileProperties & 0x02)){
|
||||
// strip the ;1 from the filename
|
||||
// filenamelen -= 2;//(Florin) nah, do not strip ;1
|
||||
}
|
||||
// }
|
||||
|
||||
// use normal string copy
|
||||
strncpy(tocEntry->filename,internalTocEntry->filename,128);
|
||||
|
@ -140,10 +140,7 @@ void TocEntryCopy(TocEntry* tocEntry, const dirTocEntry* internalTocEntry){
|
|||
// Check if a TOC Entry matches our extension list
|
||||
int TocEntryCompare(char* filename, char* extensions){
|
||||
static char ext_list[129];
|
||||
|
||||
char* token;
|
||||
|
||||
char* ext_point;
|
||||
char* token, ext_point;
|
||||
|
||||
strncpy(ext_list,extensions,128);
|
||||
ext_list[128]=0;
|
||||
|
@ -167,15 +164,9 @@ int TocEntryCompare(char* filename, char* extensions){
|
|||
|
||||
}
|
||||
|
||||
#define CD_SECS 60 /* seconds per minute */
|
||||
#define CD_FRAMES 75 /* frames per second */
|
||||
#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
|
||||
|
||||
int IsoFS_readSectors(u32 lsn, u32 sectors, void *buf)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i=0; i<sectors; i++)
|
||||
for (u32 i=0; i<sectors; i++)
|
||||
{
|
||||
if (DoCDVDreadSector((u8*)((uptr)buf+2048*i), lsn+i, CDVD_MODE_2048) == -1) return 0;
|
||||
}
|
||||
|
@ -191,8 +182,7 @@ int IsoFS_readSectors(u32 lsn, u32 sectors, void *buf)
|
|||
int IsoFS_getVolumeDescriptor(void)
|
||||
{
|
||||
// Read until we find the last valid Volume Descriptor
|
||||
int volDescSector;
|
||||
|
||||
s32 volDescSector;
|
||||
cdVolDesc localVolDesc;
|
||||
|
||||
DbgCon::WriteLn("IsoFS_GetVolumeDescriptor called");
|
||||
|
@ -219,7 +209,8 @@ int IsoFS_getVolumeDescriptor(void)
|
|||
DbgCon::WriteLn( Color_Green, "CD FileSystem is ISO9660" );
|
||||
else if (CDVolDesc.filesystemType == 2)
|
||||
DbgCon::WriteLn( Color_Green, "CD FileSystem is Joliet");
|
||||
else DbgCon::Notice("Could not detect CD FileSystem type");
|
||||
else
|
||||
DbgCon::Notice("Could not detect CD FileSystem type");
|
||||
|
||||
// CdStop();
|
||||
|
||||
|
@ -227,21 +218,11 @@ int IsoFS_getVolumeDescriptor(void)
|
|||
}
|
||||
|
||||
int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
||||
char filename[g_MaxPath+1];
|
||||
char pathname[JolietMaxPath+1];
|
||||
char toc[2048];
|
||||
char filename[g_MaxPath+1], pathname[JolietMaxPath+1], toc[2048];
|
||||
char* dirname;
|
||||
|
||||
TocEntry localTocEntry; // used for internal checking only
|
||||
|
||||
int found_dir;
|
||||
|
||||
int num_dir_sectors;
|
||||
int current_sector;
|
||||
|
||||
int dir_lba;
|
||||
|
||||
s32 found_dir, num_dir_sectors, current_sector, dir_lba;
|
||||
dirTocEntry* tocEntryPointer;
|
||||
TocEntry localTocEntry; // used for internal checking only
|
||||
|
||||
DbgCon::WriteLn("IsoFS_findfile(\"%s\") called", params fname);
|
||||
|
||||
|
@ -439,15 +420,12 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
|
||||
// This is the RPC-ready function which takes the request to start the tocEntry retrieval
|
||||
int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_dirs){
|
||||
// int dir_depth = 1;
|
||||
char toc[2048];
|
||||
char* dirname;
|
||||
int found_dir;
|
||||
int num_dir_sectors;
|
||||
unsigned int toc_entry_num;
|
||||
s32 found_dir, num_dir_sectors, current_sector;
|
||||
u32 toc_entry_num;
|
||||
dirTocEntry* tocEntryPointer;
|
||||
TocEntry localTocEntry;
|
||||
int current_sector;
|
||||
|
||||
// store the extension list statically for the retrieve function
|
||||
strncpy(getDirTocData.extension_list, extensions, 128);
|
||||
|
@ -540,8 +518,7 @@ int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_d
|
|||
}
|
||||
|
||||
// If we havent found the directory name we wanted then fail
|
||||
if (found_dir != TRUE)
|
||||
return -1;
|
||||
if (found_dir != TRUE) return -1;
|
||||
|
||||
// Get next directory name
|
||||
dirname = strtok( NULL, "\\/" );
|
||||
|
@ -660,8 +637,7 @@ int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_d
|
|||
// buffer (tocEntry) must be 18KB in size, and this will be filled with a maximum of 128 entries in one go
|
||||
int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries){
|
||||
char toc[2048];
|
||||
int toc_entry_num;
|
||||
|
||||
s32 toc_entry_num;
|
||||
dirTocEntry* tocEntryPointer;
|
||||
|
||||
if (IsoFS_readSectors(getDirTocData.current_sector,1,toc) != TRUE){
|
||||
|
@ -682,8 +658,7 @@ int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries){
|
|||
tocEntryPointer = (dirTocEntry*)(toc + getDirTocData.current_sector_offset);
|
||||
}
|
||||
|
||||
if (req_entries > 128)
|
||||
req_entries = 128;
|
||||
if (req_entries > 128) req_entries = 128;
|
||||
|
||||
for (toc_entry_num=0; toc_entry_num < req_entries;)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,10 @@
|
|||
int IsoFS_initDirectoryList(char* pathname, char* extensions, unsigned int inc_dirs);
|
||||
int IsoFS_getDirectories(TocEntry tocEntry[], int req_entries);
|
||||
|
||||
#define CD_SECS 60 /* seconds per minute */
|
||||
#define CD_FRAMES 75 /* frames per second */
|
||||
#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#pragma warning(disable:4996) //ignore the stricmp deprecated warning
|
||||
|
|
|
@ -205,10 +205,7 @@ isoFile *isoCreate(const char *filename, int flags)
|
|||
sprintf(Zfile, "%s.table", iso->filename);
|
||||
iso->htable = _openfile(Zfile, O_WRONLY);
|
||||
|
||||
if (iso->htable == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (iso->htable == NULL) return NULL;
|
||||
}
|
||||
|
||||
iso->handle = _openfile(iso->filename, O_WRONLY | O_CREAT);
|
||||
|
@ -361,7 +358,7 @@ int isoReadBlock(isoFile *iso, u8 *dst, int lsn)
|
|||
else
|
||||
ret = _isoReadBlock(iso, dst, lsn);
|
||||
|
||||
if (ret == -1) return ret;
|
||||
if (ret == -1) return -1;
|
||||
|
||||
if (iso->type == ISOTYPE_CD)
|
||||
{
|
||||
|
@ -411,7 +408,7 @@ int isoWriteBlock(isoFile *iso, u8 *src, int lsn)
|
|||
else
|
||||
ret = _isoWriteBlock(iso, src, lsn);
|
||||
|
||||
if (ret == -1) return ret;
|
||||
if (ret == -1) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,15 +54,11 @@ int _seekfile(void *handle, u64 offset, int whence)
|
|||
{
|
||||
u64 ofs = (u64)offset;
|
||||
PLONG _ofs = (LONG*) & ofs;
|
||||
|
||||
// Console::WriteLn("_seekfile %p, %d_%d", params handle, _ofs[1], _ofs[0]);
|
||||
if (whence == SEEK_SET)
|
||||
{
|
||||
SetFilePointer(handle, _ofs[0], &_ofs[1], FILE_BEGIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFilePointer(handle, _ofs[0], &_ofs[1], FILE_END);
|
||||
}
|
||||
|
||||
SetFilePointer(handle, _ofs[0], &_ofs[1], (whence == SEEK_SET) ? FILE_BEGIN : FILE_END);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -70,9 +66,8 @@ int _readfile(void *handle, void *dst, int size)
|
|||
{
|
||||
DWORD ret;
|
||||
|
||||
// Console::WriteLn("_readfile %p %d", params handle, size);
|
||||
ReadFile(handle, dst, size, &ret, NULL);
|
||||
// Console::WriteLn("_readfile ret %d; %d", params ret, GetLastError());
|
||||
// Console::WriteLn("_readfile(%p, %d) = %d; %d", params handle, size, ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -80,10 +75,9 @@ int _writefile(void *handle, void *src, int size)
|
|||
{
|
||||
DWORD ret;
|
||||
|
||||
// Console::WriteLn("_writefile %p, %d", params handle, size);
|
||||
// _seekfile(handle, _tellfile(handle));
|
||||
WriteFile(handle, src, size, &ret, NULL);
|
||||
// Console::WriteLn("_writefile ret %d", params ret);
|
||||
// Console::WriteLn("_readfile(%p, %d) = %d", params handle, size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,11 +60,13 @@ namespace Console
|
|||
bool Write( Colors color, const char* fmt, VARG_PARAM dummy, ... )
|
||||
{
|
||||
varg_assert();
|
||||
SetColor( color );
|
||||
|
||||
va_list list;
|
||||
va_start(list,dummy);
|
||||
Write( vfmt_string( fmt, list ).c_str() );
|
||||
va_end(list);
|
||||
ClearColor();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue