Add basic Linux build support

This commit is contained in:
2025-12-03 17:55:50 +08:00
parent d92f477390
commit db3be495d7
6 changed files with 21 additions and 15 deletions

7
.gitignore vendored
View File

@ -1,8 +1,9 @@
# idea # idea
.idea/ .idea/
cmake-build-debug/ cmake-build-*/
cmake-build-release/
cmake-build-minsizerel/ # build
build/
# vs # vs
.vs/ .vs/

View File

@ -43,10 +43,10 @@ namespace PKG
return result; return result;
} }
float_t BinaryReader::ReadSingle() float BinaryReader::ReadSingle()
{ {
float_t result = 0; float result = 0;
m_File.read(reinterpret_cast<char*>(&result), sizeof(float_t)); m_File.read(reinterpret_cast<char*>(&result), sizeof(float));
return result; return result;
} }

View File

@ -25,7 +25,7 @@ namespace PKG
int32_t ReadInt32(); int32_t ReadInt32();
uint32_t ReadUInt32(); uint32_t ReadUInt32();
float_t ReadSingle(); float ReadSingle();
char ReadChar(); char ReadChar();
std::string ReadString(uint32_t length); std::string ReadString(uint32_t length);
std::string ReadNString(int32_t maxLength = -1); std::string ReadNString(int32_t maxLength = -1);

View File

@ -51,7 +51,7 @@ namespace PKG
TexMipMap mipmap; TexMipMap mipmap;
switch (container.ImageContainerVersion) switch (container.imageContainerVersion)
{ {
case ImageContainerVersion::VERSION1: case ImageContainerVersion::VERSION1:
mipmap = ReadMipMapV1(reader); break; mipmap = ReadMipMapV1(reader); break;
@ -114,11 +114,11 @@ namespace PKG
int version = std::stoi(container.Magic.substr(4, 4)); int version = std::stoi(container.Magic.substr(4, 4));
container.ImageContainerVersion = (ImageContainerVersion)version; container.imageContainerVersion = (ImageContainerVersion)version;
if (container.ImageContainerVersion == ImageContainerVersion::VERSION4 && container.ImageFormat != FreeImageFormat::FIF_MP4) if (container.imageContainerVersion == ImageContainerVersion::VERSION4 && container.ImageFormat != FreeImageFormat::FIF_MP4)
{ {
container.ImageContainerVersion = ImageContainerVersion::VERSION3; container.imageContainerVersion = ImageContainerVersion::VERSION3;
} }
for (int i = 0; i < imageCount; i++) for (int i = 0; i < imageCount; i++)

View File

@ -6,11 +6,15 @@
#define CORE_H #define CORE_H
#ifdef PKG_SHARED #ifdef PKG_SHARED
#ifdef __WIN32__
#ifdef PKG_BUILD_DLL #ifdef PKG_BUILD_DLL
#define PKG_API __declspec(dllexport) #define PKG_API __declspec(dllexport)
#else #else
#define PKG_API __declspec(dllimport) #define PKG_API __declspec(dllimport)
#endif #endif
#else
#define PKG_API
#endif
#else #else
#define PKG_API #define PKG_API
#endif #endif

View File

@ -22,7 +22,8 @@ namespace PKG
public: public:
std::string Magic; std::string Magic;
FreeImageFormat ImageFormat{}; FreeImageFormat ImageFormat{};
ImageContainerVersion ImageContainerVersion; // name conflict
ImageContainerVersion imageContainerVersion;
std::vector<TexImage> Images; std::vector<TexImage> Images;
}; };