Initial RetroNFS95 Win9x VxD prototype

This commit is contained in:
2026-10-12 12:59:15 +00:00
commit 908ece2cc8
51 changed files with 3266 additions and 0 deletions

44
include/xdr.hpp Normal file
View File

@@ -0,0 +1,44 @@
#ifndef RETRONFS95_XDR_HPP
#define RETRONFS95_XDR_HPP
#include "compat.hpp"
namespace retronfs {
class XdrWriter {
public:
void u32(uint32_t v);
void u64(uint64_t v);
void opaque(const Bytes& data);
void fixed_opaque(const byte* data, unsigned len);
void str(const std::string& value);
const Bytes& data() const;
private:
Bytes out_;
void pad(unsigned len);
};
class XdrReader {
public:
explicit XdrReader(const Bytes& data);
uint32_t u32();
uint64_t u64();
Bytes opaque();
Bytes fixed_opaque(unsigned len);
std::string str();
bool eof() const;
unsigned remaining() const;
private:
const Bytes& in_;
unsigned pos_;
void require(unsigned n);
void skip_pad(unsigned len);
};
}
#endif