#64126 - FloFri - Mon Dec 19, 2005 6:46 pm
Hi!
I want to port the file-class of the new movie player by Moonlight to the GMAMP with chisms FAT driver. This is the class:
Can someone tell me if he can find any mistakes in this code, because the function Readu32 seems to return 0 all the time.
Thanks in advance.
FloFri
I want to port the file-class of the new movie player by Moonlight to the GMAMP with chisms FAT driver. This is the class:
Code: |
CStream::CStream(char *filename)
{ fhandle = FAT_fopen(filename, "r"); size = FAT_GetFileSize(); } CStream::~CStream(void) { FAT_fclose(fhandle); } int CStream::GetOffset(void) const { return FAT_ftell(fhandle); } void CStream::SetOffset(int _ofs) { if(size<FAT_ftell(fhandle)) FAT_fseek(fhandle, size, 0); else FAT_fseek(fhandle, _ofs, 0); } int CStream::GetSize(void) const { return(size); } void CStream::OverrideSize(int _size) { return; } bool CStream::eof(void) const { return FAT_feof(fhandle); } u8 CStream::Readu8(void) { if(eof()==true) return(0); char temp = FAT_fgetc(fhandle); FAT_fseek(fhandle, 1, FAT_ftell(fhandle)); return(temp); } u16 CStream::Readu16(void) { u16 data; data=(u16)Readu8(); data=data | ((u16)Readu8() << 8); return(data); } u32 CStream::Readu32(void) { u32 data; data=(u32)Readu8(); data=data | ((u32)Readu8() << 8); data=data | ((u32)Readu8() << 16); data=data | ((u32)Readu8() << 24); return(data); } int CStream::ReadBuffer(void *_dstbuf,const int _readsize) { if(eof()==true) return(0); int readsize = FAT_fread(_dstbuf, _readsize, sizeof(char), fhandle); return(readsize); } |
Can someone tell me if he can find any mistakes in this code, because the function Readu32 seems to return 0 all the time.
Thanks in advance.
FloFri