Switch to zip archive format for resource data, prep work for moving from PICT/snd to BMP/WAV

This commit is contained in:
elasota
2020-01-18 08:37:57 -05:00
parent e01cd4ef2e
commit d8331eaeb7
298 changed files with 79115 additions and 231 deletions

View File

@@ -1,76 +1,127 @@
#pragma once
#ifndef __PL_BYTEPACK_H__
#define __PL_BYTEPACK_H__
#include "DataTypes.h"
namespace PortabilityLayer
{
namespace BytePack
{
void BigUInt64(uint8_t *bytes, uint64_t value);
void BigUInt32(uint8_t *bytes, uint32_t value);
void BigUInt16(uint8_t *bytes, uint16_t value);
}
}
namespace PortabilityLayer
{
namespace BytePack
{
inline void BigUInt64(uint8_t *bytes, uint64_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 56) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 48) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 40) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 32) & 0xff);
bytes[4] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[5] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[6] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[7] = static_cast<uint8_t>(value & 0xff);
}
inline void BigUInt32(uint8_t *bytes, uint32_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[3] = static_cast<uint8_t>(value & 0xff);
}
inline void BigUInt16(uint8_t *bytes, uint16_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[1] = static_cast<uint8_t>(value & 0xff);
}
inline void BigInt64(uint8_t *bytes, int64_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 56) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 48) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 40) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 32) & 0xff);
bytes[4] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[5] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[6] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[7] = static_cast<uint8_t>(value & 0xff);
}
inline void BigInt32(uint8_t *bytes, uint32_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[3] = static_cast<uint8_t>(value & 0xff);
}
inline void BigInt16(uint8_t *bytes, uint16_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[1] = static_cast<uint8_t>(value & 0xff);
}
}
}
#endif
#pragma once
#include "DataTypes.h"
namespace PortabilityLayer
{
namespace BytePack
{
void BigUInt64(uint8_t *bytes, uint64_t value);
void BigUInt32(uint8_t *bytes, uint32_t value);
void BigUInt16(uint8_t *bytes, uint16_t value);
void LittleUInt64(uint8_t *bytes, uint64_t value);
void LittleUInt32(uint8_t *bytes, uint32_t value);
void LittleUInt16(uint8_t *bytes, uint16_t value);
}
}
namespace PortabilityLayer
{
namespace BytePack
{
inline void BigUInt64(uint8_t *bytes, uint64_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 56) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 48) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 40) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 32) & 0xff);
bytes[4] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[5] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[6] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[7] = static_cast<uint8_t>(value & 0xff);
}
inline void BigUInt32(uint8_t *bytes, uint32_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[3] = static_cast<uint8_t>(value & 0xff);
}
inline void BigUInt16(uint8_t *bytes, uint16_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[1] = static_cast<uint8_t>(value & 0xff);
}
inline void BigInt64(uint8_t *bytes, int64_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 56) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 48) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 40) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 32) & 0xff);
bytes[4] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[5] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[6] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[7] = static_cast<uint8_t>(value & 0xff);
}
inline void BigInt32(uint8_t *bytes, uint32_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[3] = static_cast<uint8_t>(value & 0xff);
}
inline void BigInt16(uint8_t *bytes, uint16_t value)
{
bytes[0] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[1] = static_cast<uint8_t>(value & 0xff);
}
inline void LittleUInt64(uint8_t *bytes, uint64_t value)
{
bytes[0] = static_cast<uint8_t>(value & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[4] = static_cast<uint8_t>((value >> 32) & 0xff);
bytes[5] = static_cast<uint8_t>((value >> 40) & 0xff);
bytes[6] = static_cast<uint8_t>((value >> 48) & 0xff);
bytes[7] = static_cast<uint8_t>((value >> 56) & 0xff);
}
inline void LittleUInt32(uint8_t *bytes, uint32_t value)
{
bytes[0] = static_cast<uint8_t>(value & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 24) & 0xff);
}
inline void LittleUInt16(uint8_t *bytes, uint16_t value)
{
bytes[0] = static_cast<uint8_t>(value & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 8) & 0xff);
}
inline void LittleInt64(uint8_t *bytes, int64_t value)
{
bytes[0] = static_cast<uint8_t>(value & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 24) & 0xff);
bytes[4] = static_cast<uint8_t>((value >> 32) & 0xff);
bytes[5] = static_cast<uint8_t>((value >> 40) & 0xff);
bytes[6] = static_cast<uint8_t>((value >> 48) & 0xff);
bytes[7] = static_cast<uint8_t>((value >> 56) & 0xff);
}
inline void LittleInt32(uint8_t *bytes, uint32_t value)
{
bytes[0] = static_cast<uint8_t>(value & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 8) & 0xff);
bytes[2] = static_cast<uint8_t>((value >> 16) & 0xff);
bytes[3] = static_cast<uint8_t>((value >> 24) & 0xff);
}
inline void LittleInt16(uint8_t *bytes, uint16_t value)
{
bytes[0] = static_cast<uint8_t>(value & 0xff);
bytes[1] = static_cast<uint8_t>((value >> 8) & 0xff);
}
}
}