Fix linux build.

This commit is contained in:
lzwdgc 2021-02-15 15:56:24 +03:00
parent dc8733dd49
commit 2ca07e9b11
8 changed files with 37 additions and 15 deletions

View file

@ -21,6 +21,7 @@
#include <stdexcept> #include <stdexcept>
#include <stdio.h> #include <stdio.h>
#include <string.h>
const int build_version = 0 const int build_version = 0
//#include <version.h.in> //#include <version.h.in>

View file

@ -18,10 +18,15 @@
#include "common.h" #include "common.h"
#include <primitives/exceptions.h>
#ifdef _WIN32
#include <Windows.h> #include <Windows.h>
#endif
std::string str2utf8(const std::string &codepage_str, int cp) std::string str2utf8(const std::string &codepage_str, int cp)
{ {
#ifdef _WIN32
auto utf16_str = str2utf16(codepage_str, cp); auto utf16_str = str2utf16(codepage_str, cp);
int utf8_size = WideCharToMultiByte(CP_UTF8, 0, utf16_str.c_str(), int utf8_size = WideCharToMultiByte(CP_UTF8, 0, utf16_str.c_str(),
utf16_str.length(), nullptr, 0, utf16_str.length(), nullptr, 0,
@ -31,10 +36,14 @@ std::string str2utf8(const std::string &codepage_str, int cp)
utf16_str.length(), &utf8_str[0], utf8_size, utf16_str.length(), &utf8_str[0], utf8_size,
nullptr, nullptr); nullptr, nullptr);
return utf8_str; return utf8_str;
#else
SW_UNIMPLEMENTED;
#endif
} }
std::wstring str2utf16(const std::string &codepage_str, int cp) std::wstring str2utf16(const std::string &codepage_str, int cp)
{ {
#ifdef _WIN32
int size; int size;
std::wstring utf16_str; std::wstring utf16_str;
@ -45,4 +54,7 @@ std::wstring str2utf16(const std::string &codepage_str, int cp)
codepage_str.length(), &utf16_str[0], size); codepage_str.length(), &utf16_str[0], size);
return utf16_str; return utf16_str;
#else
SW_UNIMPLEMENTED;
#endif
} }

View file

@ -23,10 +23,12 @@
#include <primitives/filesystem.h> #include <primitives/filesystem.h>
#include <assert.h>
#include <deque> #include <deque>
#include <vector> #include <vector>
#include <assert.h>
#include <limits.h>
template <class T> template <class T>
class mat class mat
{ {

View file

@ -1,9 +1,10 @@
#pragma once #pragma once
#include <stdint.h>
#include "buffer.h" #include "buffer.h"
#include <stdint.h>
#include <string.h>
#pragma pack(push, 1) #pragma pack(push, 1)
// http://paulbourke.net/dataformats/tga/ // http://paulbourke.net/dataformats/tga/

View file

@ -18,6 +18,8 @@
#include "types.h" #include "types.h"
#include <string.h>
void weather::load(const buffer &b) void weather::load(const buffer &b)
{ {
READ_STRING(b, name); READ_STRING(b, name);

View file

@ -29,6 +29,13 @@
#include <variant> #include <variant>
// if we move this inside MechGroup, compilation error - default ctor is deleted
struct MechGroup_unk_type01
{
uint32_t unk0 = 0;
float unk1 = 0;
};
struct MechGroup struct MechGroup
{ {
std::string name; std::string name;
@ -39,13 +46,7 @@ struct MechGroup
// probably an old field // probably an old field
std::string org_ru; std::string org_ru;
struct unk_type01 std::variant<MechGroup_unk_type01, std::vector<uint32_t>, uint32_t> type_data;
{
uint32_t unk0 = 0;
float unk1 = 0;
};
std::variant<unk_type01, std::vector<uint32_t>, uint32_t> type_data;
bool hidden; bool hidden;
@ -64,7 +65,7 @@ struct MechGroup
case 0: case 0:
case 1: case 1:
{ {
unk_type01 t; MechGroup_unk_type01 t;
READ(b, t.unk0); READ(b, t.unk0);
READ(b, t.unk1); READ(b, t.unk1);
type_data = t; type_data = t;

View file

@ -18,12 +18,14 @@
#include "mpj.h" #include "mpj.h"
#include <primitives/filesystem.h>
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <primitives/filesystem.h> #include <string.h>
segment *segment::create_segment(const buffer &b) segment *segment::create_segment(const buffer &b)
{ {

3
sw.cpp
View file

@ -51,6 +51,7 @@ void build(Solution &s)
script2txt.setRootDirectory("src/script2txt"); script2txt.setRootDirectory("src/script2txt");
script2txt += "pub.lzwdgc.Polygon4.DataManager.schema-master"_dep; script2txt += "pub.lzwdgc.Polygon4.DataManager.schema-master"_dep;
gen_flex_bison_pair("org.sw.demo.lexxmark.winflexbison"_dep, script2txt, "LALR1_CPP_VARIANT_PARSER", "script2txt"); gen_flex_bison_pair("org.sw.demo.lexxmark.winflexbison"_dep, script2txt, "LALR1_CPP_VARIANT_PARSER", "script2txt");
if (script2txt.getCompilerType() == CompilerType::MSVC)
script2txt.CompileOptions.push_back("/Zc:__cplusplus"); script2txt.CompileOptions.push_back("/Zc:__cplusplus");
auto &model = tools.addStaticLibrary("model"); auto &model = tools.addStaticLibrary("model");
@ -67,7 +68,7 @@ void build(Solution &s)
auto &mod_converter = add_exe("mod_converter"); auto &mod_converter = add_exe("mod_converter");
mod_converter += model; mod_converter += model;
path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2019.0"; path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2020.2";
mod_converter += IncludeDirectory(sdk / "include"); mod_converter += IncludeDirectory(sdk / "include");
String cfg = "release"; String cfg = "release";
if (mod_converter.getBuildSettings().Native.ConfigurationType == ConfigurationType::Debug) if (mod_converter.getBuildSettings().Native.ConfigurationType == ConfigurationType::Debug)