mirror of
https://github.com/echojc/osu-ds.git
synced 2025-06-18 17:05:36 -04:00
49 lines
839 B
C++
49 lines
839 B
C++
#include <nds.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <string>
|
|
|
|
#ifndef __FILEREADER_H__
|
|
#define __FILEREADER_H__
|
|
|
|
using namespace std;
|
|
|
|
class FileReader
|
|
{
|
|
public:
|
|
FileReader(u8* source);
|
|
FileReader(string& filename);
|
|
FileReader(const char* filename);
|
|
~FileReader();
|
|
|
|
u8 ReadInt8() const;
|
|
u16 ReadInt16() const;
|
|
u32 ReadInt32() const;
|
|
float ReadFloat() const;
|
|
u32 ReadVarInt() const;
|
|
string ReadString() const;
|
|
|
|
bool Ready() const { return fReady; }
|
|
|
|
void Skip(u32 count) const;
|
|
|
|
void Reset() const;
|
|
|
|
protected:
|
|
u8* mBuffer;
|
|
mutable u32 pos;
|
|
|
|
static u32 BUFFERSIZE;
|
|
|
|
FILE* mHandle;
|
|
|
|
int FillBuffer() const;
|
|
void PrepareBuffer(u8 datasize) const;
|
|
|
|
bool fReady;
|
|
|
|
private:
|
|
void Init(FILE* handle, u8* buffer);
|
|
};
|
|
|
|
#endif |