Reorganized project again.
This commit is contained in:
58
src/EHS.cpp
58
src/EHS.cpp
@@ -2,18 +2,18 @@
|
||||
#include "Log.h"
|
||||
#include "Version.h"
|
||||
#include "GarbageCollector.h"
|
||||
#include "IO/Audio/Audio.h"
|
||||
#include "IO/Img/Img.h"
|
||||
#include "IO/Img/PNG.h"
|
||||
#include "IO/RIFF.h"
|
||||
#include "io/audio/Audio.h"
|
||||
#include "io/img/Img.h"
|
||||
#include "io/img/PNG.h"
|
||||
#include "io/RIFF.h"
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#if defined(LWE_OS_LINUX)
|
||||
#if defined(EHS_OS_LINUX)
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
namespace lwe
|
||||
namespace ehs
|
||||
{
|
||||
constexpr Char_32 name_32[] = U"Lone Wolf Engine";
|
||||
constexpr Char_16 name_16[] = L"Lone Wolf Engine";
|
||||
@@ -100,14 +100,14 @@ namespace lwe
|
||||
|
||||
if (riff.GetType() != "WAVE")
|
||||
{
|
||||
LWE_LOG_INT("Error", 0, "Data is not in WAVE format.");
|
||||
EHS_LOG_INT("Error", 0, "Data is not in WAVE format.");
|
||||
return false;
|
||||
}
|
||||
|
||||
RIFF_Chunk fmt = riff.GetChunk("fmt ");
|
||||
if (!fmt.IsValid())
|
||||
{
|
||||
LWE_LOG_INT("Error", 1, "Wave does not have a format chunk.");
|
||||
EHS_LOG_INT("Error", 1, "Wave does not have a format chunk.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,59 +116,59 @@ namespace lwe
|
||||
RIFF_Chunk dChunk = riff.GetChunk("data");
|
||||
if (!dChunk.IsValid())
|
||||
{
|
||||
LWE_LOG_INT("Error", 2, "Wave does not have a data chunk.");
|
||||
EHS_LOG_INT("Error", 2, "Wave does not have a data chunk.");
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt_16 compression = fmtSer.Read<UInt_16>();
|
||||
if (compression == 0x2)
|
||||
{
|
||||
LWE_LOG_INT("Error", 3, "Microsoft ADPCM compression unsupported.");
|
||||
EHS_LOG_INT("Error", 3, "Microsoft ADPCM compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x6)
|
||||
{
|
||||
LWE_LOG_INT("Error", 4, "ITU G.711 a-law compression unsupported.");
|
||||
EHS_LOG_INT("Error", 4, "ITU G.711 a-law compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x7)
|
||||
{
|
||||
LWE_LOG_INT("Error", 5, "ITU G.711 µ-law compression unsupported.");
|
||||
EHS_LOG_INT("Error", 5, "ITU G.711 µ-law compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x11)
|
||||
{
|
||||
LWE_LOG_INT("Error", 6, "IMA ADPCM compression unsupported.");
|
||||
EHS_LOG_INT("Error", 6, "IMA ADPCM compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x16)
|
||||
{
|
||||
LWE_LOG_INT("Error", 7, "TU G.723 ADPCM (Yamaha) compression unsupported.");
|
||||
EHS_LOG_INT("Error", 7, "TU G.723 ADPCM (Yamaha) compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x31)
|
||||
{
|
||||
LWE_LOG_INT("Error", 8, "GSM 6.10 compression unsupported.");
|
||||
EHS_LOG_INT("Error", 8, "GSM 6.10 compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x40)
|
||||
{
|
||||
LWE_LOG_INT("Error", 9, "ITU G.721 ADPCM compression unsupported.");
|
||||
EHS_LOG_INT("Error", 9, "ITU G.721 ADPCM compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0x50)
|
||||
{
|
||||
LWE_LOG_INT("Error", 10, "MPEG compression unsupported.");
|
||||
EHS_LOG_INT("Error", 10, "MPEG compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression == 0xFFFF)
|
||||
{
|
||||
LWE_LOG_INT("Error", 11, "Experimental compression unsupported.");
|
||||
EHS_LOG_INT("Error", 11, "Experimental compression unsupported.");
|
||||
return false;
|
||||
}
|
||||
else if (compression != 0x1 && compression != 0x3)
|
||||
{
|
||||
LWE_LOG_INT("Error", 12, "Wave has unknown compression of " + Str_8::FromNum(compression) + ".");
|
||||
EHS_LOG_INT("Error", 12, "Wave has unknown compression of " + Str_8::FromNum(compression) + ".");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace lwe
|
||||
Version version = in.ReadVersion();
|
||||
if (version != Version(1, 0, 0))
|
||||
{
|
||||
LWE_LOG_INT("Error", 0, "Incompatible audio file version.");
|
||||
EHS_LOG_INT("Error", 0, "Incompatible audio file version.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace lwe
|
||||
UInt_8 colorType = ihdrData->Read<UInt_8>();
|
||||
if (colorType == 3)
|
||||
{
|
||||
LWE_LOG_INT("Error", 1, "Color type of " + Str_8::FromNum(colorType) + " is unsupported.");
|
||||
EHS_LOG_INT("Error", 1, "Color type of " + Str_8::FromNum(colorType) + " is unsupported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -334,21 +334,21 @@ namespace lwe
|
||||
UInt_8 compression = ihdrData->Read<UInt_8>();
|
||||
if (compression)
|
||||
{
|
||||
LWE_LOG_INT("Error", 2, "Compression method of " + Str_8::FromNum(compression) + " is unsupported.");
|
||||
EHS_LOG_INT("Error", 2, "Compression method of " + Str_8::FromNum(compression) + " is unsupported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt_8 filter = ihdrData->Read<UInt_8>();
|
||||
if (filter)
|
||||
{
|
||||
LWE_LOG_INT("Error", 3, "Filter method of " + Str_8::FromNum(filter) + " is unsupported.");
|
||||
EHS_LOG_INT("Error", 3, "Filter method of " + Str_8::FromNum(filter) + " is unsupported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt_8 interlaced = ihdrData->Read<UInt_8>();
|
||||
if (interlaced)
|
||||
{
|
||||
LWE_LOG_INT("Error", 4, "Interlacing method of " + Str_8::FromNum(interlaced) + " is unsupported.");
|
||||
EHS_LOG_INT("Error", 4, "Interlacing method of " + Str_8::FromNum(interlaced) + " is unsupported.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace lwe
|
||||
int code = inflateInit(&strm);
|
||||
if (code != Z_OK)
|
||||
{
|
||||
LWE_LOG_INT("Error", 5, "Failed to initialize zlib inflate with error #" + Str_8::FromNum(code) + ".");
|
||||
EHS_LOG_INT("Error", 5, "Failed to initialize zlib inflate with error #" + Str_8::FromNum(code) + ".");
|
||||
delete[] buffer;
|
||||
return false;
|
||||
}
|
||||
@@ -383,7 +383,7 @@ namespace lwe
|
||||
code = inflate(&strm, Z_NO_FLUSH);
|
||||
if (code != Z_STREAM_END && code != Z_OK)
|
||||
{
|
||||
LWE_LOG_INT("Error", 6, "Failed to zlib inflate with error #" + Str_8::FromNum(code) + ".");
|
||||
EHS_LOG_INT("Error", 6, "Failed to zlib inflate with error #" + Str_8::FromNum(code) + ".");
|
||||
delete[] buffer;
|
||||
return false;
|
||||
}
|
||||
@@ -392,7 +392,7 @@ namespace lwe
|
||||
code = inflateEnd(&strm);
|
||||
if (code != Z_OK)
|
||||
{
|
||||
LWE_LOG_INT("Error", 7, "Failed to uninitialize zlib inflate with error #" + Str_8::FromNum(code) + ".");
|
||||
EHS_LOG_INT("Error", 7, "Failed to uninitialize zlib inflate with error #" + Str_8::FromNum(code) + ".");
|
||||
delete[] buffer;
|
||||
return false;
|
||||
}
|
||||
@@ -541,7 +541,7 @@ namespace lwe
|
||||
Str_8 imgType = in.ReadStr<Char_8, UInt_64>(4);
|
||||
if (imgType != "qoif")
|
||||
{
|
||||
LWE_LOG_INT("Error", 0, "Given data is not in the qoif format.");
|
||||
EHS_LOG_INT("Error", 0, "Given data is not in the qoif format.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ int main()
|
||||
|
||||
const lwe::SInt_32 code = Main(&lwe::appName, &lwe::appVerId, &lwe::appVer);
|
||||
if (code)
|
||||
LWE_LOG("Warning", 0, "Executable exited with code #" + lwe::Str_8::FromNum(code) + ".");
|
||||
EHS_LOG("Warning", 0, "Executable exited with code #" + lwe::Str_8::FromNum(code) + ".");
|
||||
|
||||
lwe::GarbageCollector::Stop();
|
||||
|
||||
|
Reference in New Issue
Block a user