Some more zone experiments and json11 submodule.
This commit is contained in:
parent
4c26a72cd8
commit
852c88c3b5
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -6,3 +6,6 @@
|
||||
path = deps/zlib
|
||||
url = https://github.com/madler/zlib.git
|
||||
branch = master
|
||||
[submodule "deps/json11"]
|
||||
path = deps/json11
|
||||
url = https://github.com/dropbox/json11.git
|
||||
|
1
deps/json11
vendored
Submodule
1
deps/json11
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a6a661e9240e0018b6be0f67a9e9ca2a6be2626f
|
24
premake5.lua
24
premake5.lua
@ -87,8 +87,8 @@ workspace "iw4x"
|
||||
pchsource "src/STDInclude.cpp" -- real path
|
||||
|
||||
-- Dependency on zlib
|
||||
links { "zlib" }
|
||||
includedirs { "./deps/zlib" }
|
||||
links { "zlib", "json11" }
|
||||
includedirs { "./deps/zlib", "./deps/json11" }
|
||||
|
||||
-- Virtual paths
|
||||
if not _OPTIONS["no-new-structure"] then
|
||||
@ -142,3 +142,23 @@ workspace "iw4x"
|
||||
configuration "*Static"
|
||||
kind "StaticLib"
|
||||
removedefines { "ZLIB_DLL" }
|
||||
|
||||
|
||||
-- json11
|
||||
project "json11"
|
||||
language "C++"
|
||||
|
||||
files
|
||||
{
|
||||
"./deps/json11/*.cpp",
|
||||
"./deps/json11/*.hpp"
|
||||
}
|
||||
|
||||
-- remove dropbox's testing code
|
||||
removefiles { "./deps/json11/test.cpp" }
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
-- always build as static lib, as json11 doesn't export anything
|
||||
kind "StaticLib"
|
||||
|
@ -17,9 +17,6 @@ namespace Components
|
||||
info.name = "dlc2_ui_mp";
|
||||
data.push_back(info);
|
||||
|
||||
//info.name = "penis";
|
||||
//data.push_back(info);
|
||||
|
||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,10 @@ namespace Components
|
||||
buffer.append((char*)&header, sizeof(header));
|
||||
|
||||
std::string zoneBuffer;
|
||||
zoneBuffer.resize(sizeof(XFile));
|
||||
|
||||
XFile file;
|
||||
ZeroMemory(&file, sizeof(file));
|
||||
zoneBuffer.append((char*)&file, sizeof(file));
|
||||
|
||||
// Fill zone
|
||||
XAssetList list;
|
||||
@ -29,12 +32,67 @@ namespace Components
|
||||
list.stringList.count = 0;
|
||||
list.stringList.strings = 0;
|
||||
|
||||
list.assetCount = 2;
|
||||
|
||||
list.assets = (Game::XAsset*)0xFFFFFFFF;
|
||||
|
||||
zoneBuffer.append((char*)&list, sizeof(list));
|
||||
|
||||
// Crappy assetlist entry
|
||||
DWORD type = Game::XAssetType::ASSET_TYPE_LOCALIZE;
|
||||
zoneBuffer.append((char*)&type, sizeof(type));
|
||||
zoneBuffer.append((char*)&list.assets, sizeof(list.assets)); // Hue
|
||||
|
||||
type = Game::XAssetType::ASSET_TYPE_RAWFILE;
|
||||
zoneBuffer.append((char*)&type, sizeof(type));
|
||||
zoneBuffer.append((char*)&list.assets, sizeof(list.assets)); // Hue
|
||||
|
||||
// Localized entry
|
||||
zoneBuffer.append((char*)&list.assets, sizeof(list.assets)); // Hue
|
||||
zoneBuffer.append((char*)&list.assets, sizeof(list.assets)); // Hue
|
||||
zoneBuffer.append("MENU_PENIS");
|
||||
zoneBuffer.append("\0", 1);
|
||||
|
||||
zoneBuffer.append("PENIS");
|
||||
zoneBuffer.append("\0", 1);
|
||||
|
||||
// Obligatory rawfile
|
||||
struct Rawfile
|
||||
{
|
||||
const char* name;
|
||||
int sizeCompressed;
|
||||
int sizeUnCompressed;
|
||||
char * compressedData;
|
||||
};
|
||||
|
||||
char* _data = "map mp_rust";
|
||||
|
||||
Rawfile data;
|
||||
data.name = (char*)0xFFFFFFFF;
|
||||
data.compressedData = (char*)0xFFFFFFFF;
|
||||
data.sizeUnCompressed = 0;
|
||||
data.sizeCompressed = strlen(_data) + 1;
|
||||
|
||||
zoneBuffer.append((char*)&data, sizeof(data));
|
||||
|
||||
zoneBuffer.append("zob.cfg");
|
||||
zoneBuffer.append("\0", 1);
|
||||
|
||||
zoneBuffer.append(_data);
|
||||
zoneBuffer.append("\0", 1);
|
||||
|
||||
XFile* zone = (XFile*)zoneBuffer.data();
|
||||
ZeroMemory(zone, sizeof(XFile));
|
||||
|
||||
zone->size = zoneBuffer.size() - sizeof(XFile);
|
||||
zone->size = zoneBuffer.size() - 40;
|
||||
|
||||
zone->blockSize[3] = zoneBuffer.size() * 2;
|
||||
zone->blockSize[0] = zoneBuffer.size() * 2;
|
||||
|
||||
// for (int i = 0; i < 8; i++)
|
||||
// {
|
||||
// zone->blockSize[i] = zoneBuffer.size() * 2;
|
||||
// }
|
||||
|
||||
auto compressedData = Utils::Compression::ZLib::Compress(zoneBuffer);
|
||||
buffer.append(compressedData);
|
||||
@ -57,14 +115,24 @@ namespace Components
|
||||
return Flags::HasFlag("zonebuilder");
|
||||
}
|
||||
|
||||
void TestZoneLoading(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync)
|
||||
{
|
||||
std::vector<Game::XZoneInfo> data;
|
||||
Utils::Merge(data, zoneInfo, zoneCount);
|
||||
|
||||
data.push_back({ "penis", zoneInfo->allocFlags, zoneInfo->freeFlags });
|
||||
|
||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
||||
}
|
||||
|
||||
ZoneBuilder::ZoneBuilder()
|
||||
{
|
||||
if (ZoneBuilder::IsEnabled())
|
||||
{
|
||||
auto data = Zone("").Build();
|
||||
auto data = Zone("penis").Build();
|
||||
|
||||
FILE* fp;
|
||||
fopen_s(&fp, "penis.ff", "wb");
|
||||
fopen_s(&fp, "zone/patch/penis.ff", "wb");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
@ -74,5 +142,7 @@ namespace Components
|
||||
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
//Utils::Hook(0x60B4AC, TestZoneLoading, HOOK_CALL).Install()->Quick();
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,10 @@
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
|
||||
// Submodules
|
||||
#define ZLIB_CONST
|
||||
#include <zlib.h>
|
||||
#include <json11.hpp>
|
||||
|
||||
#include "Utils\Utils.hpp"
|
||||
#include "Utils\WebIO.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user