feat(profile): refactor lua, bc code

This commit is contained in:
phaneron 2026-04-01 17:37:40 -04:00
parent e79ee08905
commit 37db5336e4
40 changed files with 3424 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#ifndef BC_FILE_FILE_INFO_H
#define BC_FILE_FILE_INFO_H
#include "bc/time/types.h"
DECLARE_STRUCT(Blizzard__File__FileInfo);
struct Blizzard__File__FileInfo {
char* path;
uint32_t unk04;
int64_t size; // 08
int32_t attributes;
Blizzard__Time__Timestamp createTime;
Blizzard__Time__Timestamp modTime;
Blizzard__Time__Timestamp accessTime;
int32_t existence;
int32_t regularFile;
};
#endif

View file

@ -0,0 +1,33 @@
#ifndef BC_FILE_INFO_MASK_H
#define BC_FILE_INFO_MASK_H
#if defined(BITFIELDS_SUPPORTED)
DECLARE_UNION(Blizzard__File__FileInfoMask);
union Blizzard__File__FileInfoMask {
struct {
uint32_t path : 1;
uint32_t size : 1;
uint32_t attributes : 1;
uint32_t createTime : 1;
uint32_t modTime : 1;
uint32_t accessTime : 1;
uint32_t existence : 1;
uint32_t regularFile : 1;
uint32_t pad : 24;
};
uint32_t all;
};
#else
DECLARE_STRUCT(Blizzard__File__FileInfoMask);
struct Blizzard__File__FileInfoMask {
uint32_t all;
};
#endif
#endif

View file

@ -0,0 +1,6 @@
#ifndef BC_FILE_INODE_H
#define BC_FILE_INODE_H
typedef int32_t Blizzard__File__INODE;
#endif

View file

@ -0,0 +1,17 @@
#ifndef BC_FILE_STREAMING_INFO_H
#define BC_FILE_STREAMING_INFO_H
DECLARE_STRUCT(Blizzard__File__StreamingInfo);
#include "bc/file/fileinfo.h"
#include "bc/file/inode.h"
#include "bc/storage/storageunithandle.h"
struct Blizzard__File__StreamingInfo {
Blizzard__Storage__StorageUnitHandle storagehandle;
Blizzard__File__INODE inode;
uint32_t streamRefCount;
Blizzard__File__FileInfo streaminginfo;
};
#endif

View file

@ -0,0 +1,24 @@
#ifndef BC_STORAGE_STORAGE_UNIT_H
#define BC_STORAGE_STORAGE_UNIT_H
DECLARE_STRUCT(Blizzard__Storage__StorageUnit);
struct Blizzard__Storage__StorageUnit {
uint32_t unk00;
uint32_t unk04;
uint32_t unk08;
uint32_t unk0C;
uint32_t unk10;
uint32_t unk14;
uint32_t unk18;
uint32_t unk1C;
uint32_t unk20;
uint32_t unk24;
uint32_t unk28;
uint32_t unk2C;
uint32_t unk30;
uint32_t unk34;
uint32_t unk38;
};
#endif

View file

@ -0,0 +1,14 @@
#ifndef BC_STORAGE_STORAGE_UNIT_HANDLE_H
#define BC_STORAGE_STORAGE_UNIT_HANDLE_H
DECLARE_STRUCT(Blizzard__Storage__StorageUnitHandle);
#include "bc/file/inode.h"
#include "bc/storage/storageunit.h"
struct Blizzard__Storage__StorageUnitHandle {
Blizzard__File__INODE mNode;
Blizzard__Storage__StorageUnit* mUnit;
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef BC_STRING_CONVERSION_CODEPAGE_TO_UTF8_H
#define BC_STRING_CONVERSION_CODEPAGE_TO_UTF8_H
DECLARE_STRUCT(Blizzard__StringConversion_CodepageToUTF8__ToNative);
#include "bc/util/buffer.h"
// class Blizzard::CodepageToUTF8::ToNative : Blizzard::Util::Buffer<300, wchar_t>
struct Blizzard__StringConversion_CodePageToUTF8__ToNative {
Blizzard__Util__Buffer_300_char _;
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef BC_STRING_CONVERSION_PASSTHROUGH_H
#define BC_STRING_CONVERSION_PASSTHROUGH_H
DECLARE_STRUCT(Blizzard__StringConversion_Passthrough__ToNative);
#include "bc/util/buffer.h"
// class Blizzard::StringConversion_Passthrough::ToNative : Blizzard::Util::Buffer<300, char>
struct Blizzard__StringConversion__Passthrough__ToNative {
Blizzard__Util__Buffer_300_char _;
};
#endif

View file

@ -0,0 +1,14 @@
#ifndef BC_STRING_CONVERSION_UTF16_TO_UTF8_H
#define BC_STRING_CONVERSION_UTF16_TO_UTF8_H
DECLARE_STRUCT(Blizzard__StringConversion_UTF16ToUTF8__ToNative);
#include "bc/util/buffer.h"
// class Blizzard::UTF16ToUTF8::ToNative : Blizzard::Util::Buffer<300, wchar_t>
struct Blizzard__StringConversion_UTF16ToUTF8__ToNative {
// Never ever use wchar_t!!!
Blizzard__Util__Buffer_300_uint16_t _;
};
#endif

View file

@ -0,0 +1,14 @@
#ifndef BC_SYSTEM_FILE_FILE_FUNC_H
#define BC_SYSTEM_FILE_FILE_FUNC_H
DECLARE_STRUCT(Blizzard__File__Filesystem);
DECLARE_STRUCT(System_File__Stacked__FileParms);
typedef bool (*System_File__Stacked__FileFunc)(
Blizzard__File__Filesystem *fs,
System_File__Stacked__FileParms *parms);
#include "bc/file/filesystem.h"
#include "bc/systemfile/stacked/fileparms.h"
#endif

View file

@ -0,0 +1,46 @@
#ifndef BC_SYSTEM_FILE_STACKED_FILE_PARMS_H
#define BC_SYSTEM_FILE_STACKED_FILE_PARMS_H
DECLARE_STRUCT(System_File__Stacked__FileParms);
#include "bc/file/fileinfo.h"
#include "bc/file/filesystem.h"
#include "bc/file/infomask.h"
#include "bc/file/mode.h"
#include "bc/file/processdir.h"
#include "bc/file/stream.h"
#include "system/types.h"
struct System_File__Stacked__FileParms {
// the offset of the file operation
// inside Blizzard::File::Filesystem
offset_in_Blizzard__File__Functions_to_System_File__Stacked__FileFunc verb; // 0x0
//
char* path; // 0x4 name/path to a file or directory
char* newpath; // 0x8
Blizzard__File__Stream stream; // 0xC
Blizzard__File__FileInfo* info;
uint32_t extra;
Blizzard__File__FileInfo info_;
Blizzard__File__FileInfoMask has;
Blizzard__File__FileInfoMask want;
int32_t mode; // 0x58
void* buffer; //
int32_t amount;
int64_t pos;
int32_t posMode;
char* cwdbuf;
int32_t cwdbuflen;
bool recursive;
bool makeCanonical;
void* cookie;
Blizzard__File__ProcessDirCallback dircallback;
bool sorted; // set to false by Blizzard::File::ProcessDirFast (i suppose it's fast because it doesn't request sorting, though there's
// no underlying code that does this)
bool overwrite;
bool grantEveryone; // something that causes a security descriptor to be generated
bool zeroFillAll;
bool supportsSparseFiles; // extopt not plausible here
};
#endif

View file

@ -0,0 +1,12 @@
// TimeConst::FILETIMETimestampBias
// TimeConst::FILETIMETimestampMax
// TimeConst::FILETIMETimestampMin
// TimeConst::TimestampsPerFILETIME
// TimeConst::TimestampsPerSecond
// TimeConst::TimestampsPerUnixtime
// TimeConst::TimestampUnixBias
// TimeConst::TimestampUnixMax
// TimeConst::TimestampUnixMin
// TimeConst::UnixTime64TimestampMax
// TimeConst::UnixTime64TimestampMin
// TimeConst::UnixTimestampBias

View file

@ -0,0 +1,38 @@
#ifndef BC_TIME_TYPES_H
#define BC_TIME_TYPES_H
// TimeRec
DECLARE_STRUCT(Blizzard__Time__TimeRec);
// TimeRec
struct Blizzard__Time__TimeRec {
int32_t year;
int32_t month;
int32_t day;
int32_t hour;
int32_t minute;
int32_t second;
int32_t nanosecond;
int32_t dayOfWeek;
int32_t dayOfYear;
};
// UnixTime
typedef int32_t Blizzard__Time__UnixTime;
// Timestamp
typedef int64_t Blizzard__Time__Timestamp;
// Second
typedef uint32_t Blizzard__Time__Second;
// Millisecond
typedef uint32_t Bizzard__Time__Millisecond;
// Microsecond
typedef uint64_t Blizzard__Time__Microsecond;
// Nanosecond
typedef uint64_t Blizzard__Time__Nanosecond;
#endif

View file

@ -0,0 +1,20 @@
#ifndef BC_UTIL_BUFFER_H
#define BC_UTIL_BUFFER_H
// Blizzard::Util::Buffer<size_t N, typename T> : Blizzard::Util::BufferData<typename T, size_t N>
#define BC_UTIL_BUFFER(N, T) \
typedef struct Blizzard__Util__Buffer_##N##_##T Blizzard__Util__Buffer_##N##_##T; \
typedef struct Blizzard__Util__BufferData_##T##_##N Blizzard__Util__BufferData_##T##_##N; \
struct Blizzard__Util__BufferData_##T##_##N { \
uint32_t elements; \
T* data; \
T local[N]; \
}; \
struct Blizzard__Util__Buffer_##N##_##T { \
Blizzard__Util__BufferData_##T##_##N _; \
};
BC_UTIL_BUFFER(300, char);
BC_UTIL_BUFFER(300, uint16_t);
#endif

View file

@ -0,0 +1,6 @@
#ifndef BC_UTIL_OFFSET_H
#define BC_UTIL_OFFSET_H
#define BC_OFFSET_INTO(C, T) typedef uintptr_t offset_in_##C##_to_##T
#endif