Some patches and structureddata stuff.
This commit is contained in:
parent
8a629bc391
commit
0dbd45c844
@ -44,6 +44,7 @@ namespace Components
|
||||
Loader::Register(new AssetHandler());
|
||||
Loader::Register(new Localization());
|
||||
Loader::Register(new MusicalTalent());
|
||||
Loader::Register(new StructuredData());
|
||||
Loader::Register(new ConnectProtocol());
|
||||
}
|
||||
|
||||
|
@ -57,4 +57,5 @@ namespace Components
|
||||
#include "Modules\AssetHandler.hpp"
|
||||
#include "Modules\Localization.hpp"
|
||||
#include "Modules\MusicalTalent.hpp"
|
||||
#include "Modules\StructuredData.hpp"
|
||||
#include "Modules\ConnectProtocol.hpp"
|
||||
|
@ -71,6 +71,7 @@ namespace Components
|
||||
|
||||
// Don't delete config files if corrupted
|
||||
Utils::Hook::Set<BYTE>(0x47DCB3, 0xEB);
|
||||
Utils::Hook::Set<BYTE>(0x4402B6, 0);
|
||||
|
||||
// hopefully allow alt-tab during game, used at least in alt-enter handling
|
||||
Utils::Hook::Set<DWORD>(0x45ACE0, 0xC301B0);
|
||||
|
32
src/Components/Modules/StructuredData.cpp
Normal file
32
src/Components/Modules/StructuredData.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
void StructuredData::DumpDataDef(Game::structuredDataDef_t* dataDef)
|
||||
{
|
||||
if (!dataDef || !dataDef->data) return;
|
||||
|
||||
json11::Json definition =
|
||||
json11::Json::object
|
||||
{
|
||||
{ "version", dataDef->data->version },
|
||||
//{ "enums", [ 0 ] },
|
||||
};
|
||||
|
||||
Utils::WriteFile(Utils::VA("raw/%s.json", dataDef->name), definition.dump());
|
||||
}
|
||||
|
||||
StructuredData::StructuredData()
|
||||
{
|
||||
Command::Add("dumpDataDef", [] (Command::Params params)
|
||||
{
|
||||
if (params.Length() < 2) return;
|
||||
StructuredData::DumpDataDef(Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_STRUCTUREDDATADEF, params[1]).structuredData);
|
||||
});
|
||||
}
|
||||
|
||||
StructuredData::~StructuredData()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
13
src/Components/Modules/StructuredData.hpp
Normal file
13
src/Components/Modules/StructuredData.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Components
|
||||
{
|
||||
class StructuredData : public Component
|
||||
{
|
||||
public:
|
||||
StructuredData();
|
||||
~StructuredData();
|
||||
const char* GetName() { return "StructuredData"; };
|
||||
|
||||
private:
|
||||
static void DumpDataDef(Game::structuredDataDef_t* dataDef);
|
||||
};
|
||||
}
|
@ -222,13 +222,12 @@ namespace Components
|
||||
FileSystem::DeleteFile("demos", info.Name + ".dm_13.json");
|
||||
|
||||
// Reset our ui_demo_* dvars here, because the theater menu needs it.
|
||||
// Resetting them has no use, as they don't have any default value!
|
||||
Command::Execute("reset ui_demo_mapname", true);
|
||||
Command::Execute("reset ui_demo_mapname_localized", true);
|
||||
Command::Execute("reset ui_demo_gametype", true);
|
||||
Command::Execute("reset ui_demo_author", true);
|
||||
Command::Execute("reset ui_demo_length", true);
|
||||
Command::Execute("reset ui_demo_date", true);
|
||||
Dvar::Var("ui_demo_mapname").Set("");
|
||||
Dvar::Var("ui_demo_mapname_localized").Set("");
|
||||
Dvar::Var("ui_demo_gametype").Set("");
|
||||
Dvar::Var("ui_demo_length").Set("");
|
||||
Dvar::Var("ui_demo_author").Set("");
|
||||
Dvar::Var("ui_demo_date").Set("");
|
||||
|
||||
// Reload demos
|
||||
Theatre::LoadDemos();
|
||||
|
@ -949,6 +949,99 @@ namespace Game
|
||||
fontEntry_t* characters;
|
||||
} Font;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STRUCTURED_DATA_INT = 0,
|
||||
STRUCTURED_DATA_BYTE = 1,
|
||||
STRUCTURED_DATA_BOOL = 2,
|
||||
STRUCTURED_DATA_STRING = 3,
|
||||
STRUCTURED_DATA_ENUM = 4,
|
||||
STRUCTURED_DATA_STRUCT = 5,
|
||||
STRUCTURED_DATA_INDEXEDARR = 6,
|
||||
STRUCTURED_DATA_ENUMARR = 7,
|
||||
STRUCTURED_DATA_FLOAT = 8,
|
||||
STRUCTURED_DATA_SHORT = 9
|
||||
} structuredDataType_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
structuredDataType_t type;
|
||||
union
|
||||
{
|
||||
int index;
|
||||
};
|
||||
int offset;
|
||||
} structuredDataItem_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
structuredDataItem_t item;
|
||||
} structuredDataChild_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numChildren;
|
||||
structuredDataChild_t* children;
|
||||
int unknown1;
|
||||
int unknown2;
|
||||
} structuredDataStruct_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int enumIndex;
|
||||
structuredDataItem_t item;
|
||||
} structuredDataEnumArray_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* key;
|
||||
int index;
|
||||
} structuredDataEnumIndex_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numIndices;
|
||||
int unknown;
|
||||
structuredDataEnumIndex_t* indices;
|
||||
} structuredDataEnum_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numItems;
|
||||
structuredDataItem_t item;
|
||||
} structuredDataIndexedArray_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
unsigned int hash;
|
||||
int numEnums;
|
||||
structuredDataEnum_t* enums;
|
||||
int numStructs;
|
||||
structuredDataStruct_t* structs;
|
||||
int numIndexedArrays;
|
||||
structuredDataIndexedArray_t* indexedArrays;
|
||||
int numEnumArrays;
|
||||
structuredDataEnumArray_t* enumArrays;
|
||||
structuredDataItem_t rootItem;
|
||||
} structuredData_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
int unknown;
|
||||
structuredData_t* data;
|
||||
} structuredDataDef_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
structuredData_t* data;
|
||||
structuredDataItem_t* item;
|
||||
int offset;
|
||||
int error;
|
||||
} structuredDataFindState_t;
|
||||
|
||||
union XAssetHeader
|
||||
{
|
||||
void *data;
|
||||
@ -961,6 +1054,7 @@ namespace Game
|
||||
MapEnts* mapEnts;
|
||||
RawFile* rawfile;
|
||||
Font* font;
|
||||
structuredDataDef_t* structuredData;
|
||||
};
|
||||
|
||||
struct XAsset
|
||||
|
Loading…
Reference in New Issue
Block a user