Almost matched CInputStream

This commit is contained in:
2022-07-14 20:48:18 -04:00
parent e98f62c3a6
commit 18079ecfee
9 changed files with 213 additions and 19 deletions

View File

@@ -14,18 +14,27 @@ public:
CInputStream(size_t len);
CInputStream(const void* ptr, size_t len, bool owned);
virtual ~CInputStream();
virtual u32 Read(void* dest, u32 len);
s32 ReadLong();
char ReadChar();
void ReadBytes(void* in, unsigned long len);
u32 ReadBits(int len);
u8 ReadChar();
u32 ReadBytes(void* dest, unsigned long len);
u32 ReadBits(s32 len);
f32 ReadFloat();
s64 ReadLongLong();
s16 ReadShort();
bool ReadBool();
void Get(void* dest, unsigned long len);
template < typename T >
inline T Get() {
return cinput_stream_helper(TType< T >(), *this);
}
private:
bool GrabAnotherBlock();
bool InternalReadNext();
u32 x4_blockOffset;
u32 x8_blockLen;
u32 xc_len;

View File

@@ -5,7 +5,7 @@
class CSfxManager {
public:
static void Update(float dt);
static void Update(f32 dt);
};
#endif

View File

@@ -10,7 +10,7 @@ public:
class CSWData {
public:
bool Initialize();
void Wait(float) const;
void Wait(f32) const;
s64 GetTimerFreq() const { return x0_timerFreq; }
s64 GetTimerFreqO1M() const { return x8_timerFreqO1M; }
@@ -32,7 +32,7 @@ public:
}
x0_startTime = mData.GetCPUCycles();
}
inline float GetElapsedTime() const { return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod(); }
inline f32 GetElapsedTime() const { return (mData.GetCPUCycles() - x0_startTime) * mData.GetTimerPeriod(); }
inline s64 GetElapsedMicros() const { return (mData.GetCPUCycles() - x0_startTime) / mData.GetTimerFreqO1M(); }
private:

24
include/string.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef _STRING_H_
#define _STRING_H_
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
void *memcpy(void *dest, const void *src, size_t num);
void *memset(void *dest, int ch, size_t count);
size_t strlen(const char *s);
char *strcpy(char *dest, const char *src);
char *strncpy(char *dest, const char *src, size_t num);
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
char *strncat(char *dest, const char *src, size_t n);
#ifdef __cplusplus
}
#endif
#endif