feat(build): implement Clangd support && add lua symbols

This commit is contained in:
phaneron 2026-04-01 17:36:35 -04:00
parent 6163593844
commit e79ee08905
78 changed files with 399 additions and 5445 deletions

View file

@ -1,82 +1,55 @@
#ifndef BC_FILE_FILESYSTEM_H
#define BC_FILE_FILESYSTEM_H
#include "bc/systemfile/stacked.h"
DECLARE_ENUM(Blizzard__File__Operation);
#include "system/detect.h"
DECLARE_STRUCT(Blizzard__File__Filesystem);
DECLARE_STRUCT(Blizzard__File__Functions);
// invented enum
enum Blizzard__File__Operation {
cd,
close,
create,
cwd,
dirwalk,
exists,
flush,
getfileinfo,
getfreespace,
getpos,
getrootchars,
isabspath,
isreadonly,
makeabspath,
mkdir,
move,
copy,
open,
read,
readp,
rmdir,
setcachemode,
seteof,
setfileinfo,
setpos,
unlink,
write,
writep,
shutdown,
num_operations
typedef uintptr_t offset_in_Blizzard__File__Functions_to_System_File__Stacked__FileFunc;
#include "bc/systemfile/stacked/filefunc.h"
#include "bc/util/offset.h"
struct Blizzard__File__Functions {
System_File__Stacked__FileFunc cd;
System_File__Stacked__FileFunc close;
System_File__Stacked__FileFunc create;
System_File__Stacked__FileFunc cwd;
System_File__Stacked__FileFunc dirwalk;
System_File__Stacked__FileFunc exists;
System_File__Stacked__FileFunc flush;
System_File__Stacked__FileFunc getfileinfo;
System_File__Stacked__FileFunc getfreespace;
System_File__Stacked__FileFunc getpos;
System_File__Stacked__FileFunc getrootchars;
System_File__Stacked__FileFunc isabspath;
System_File__Stacked__FileFunc isreadonly;
System_File__Stacked__FileFunc makeabspath;
System_File__Stacked__FileFunc mkdir;
System_File__Stacked__FileFunc move;
System_File__Stacked__FileFunc copy;
System_File__Stacked__FileFunc open;
System_File__Stacked__FileFunc read;
System_File__Stacked__FileFunc readp;
System_File__Stacked__FileFunc rmdir;
System_File__Stacked__FileFunc setcachemode;
System_File__Stacked__FileFunc seteof;
System_File__Stacked__FileFunc setfileinfo;
System_File__Stacked__FileFunc setpos;
System_File__Stacked__FileFunc unlink;
System_File__Stacked__FileFunc write;
System_File__Stacked__FileFunc writep;
System_File__Stacked__FileFunc shutdown;
};
#define FS_OP(N) bool (*N)(Blizzard__File__Filesystem* fs, System_File__Stacked__FileParms* parms)
BC_OFFSET_INTO(Blizzard__File__Functions, System_File__Stacked__FileFunc);
// 0x7C bytes = 4 + 4 + (29 * 4)
//
struct Blizzard__File__Filesystem {
Blizzard__File__Filesystem* base;
Blizzard__File__Filesystem* next;
FS_OP(cd);
FS_OP(close);
FS_OP(create);
FS_OP(cwd);
FS_OP(dirwalk);
FS_OP(exists);
FS_OP(flush);
FS_OP(getfileinfo);
FS_OP(getfreespace);
FS_OP(getpos);
FS_OP(getrootchars);
FS_OP(isabspath);
FS_OP(isreadonly);
FS_OP(makeabspath);
FS_OP(mkdir);
FS_OP(move);
FS_OP(copy);
FS_OP(open);
FS_OP(read);
FS_OP(readp);
FS_OP(rmdir);
FS_OP(setcachemode);
FS_OP(seteof);
FS_OP(setfileinfo);
FS_OP(setpos);
FS_OP(unlink);
FS_OP(write);
FS_OP(writep);
FS_OP(shutdown);
Blizzard__File__Filesystem* original;
Blizzard__File__Filesystem* next;
Blizzard__File__Functions verbs;
};
#endif
#endif

View file

@ -1,22 +0,0 @@
#ifndef BC_FILE_INFO_H
#define BC_FILE_INFO_H
#include "bc/time/timestamp.h"
DECLARE_STRUCT(Blizzard__File__FileInfo);
struct Blizzard__File__FileInfo {
char* name;
uint32_t unk04;
// uint32_t unk08;
// uint32_t unk0C;
uint64_t size; // 08
int32_t attributes;
Blizzard__Time__Timestamp createtime;
Blizzard__Time__Timestamp lastwritetime;
Blizzard__Time__Timestamp lastaccesstime;
int32_t filetype;
int32_t normal;
};
#endif

View file

@ -4,17 +4,18 @@
DECLARE_ENUM(Blizzard__File__Mode);
enum Blizzard__File__Mode {
read = 0x0001,
write = 0x0002,
shareread = 0x0004,
sharewrite = 0x0008,
nocache = 0x0040,
temporary = 0x0080,
truncate = 0x0100,
append = 0x0200,
create = 0x0400,
mustnotexist = 0x0800,
mustexist = 0x1000
read = 0x0001,
write = 0x0002,
shareread = 0x0004,
sharewrite = 0x0008,
async = 0x0020, // confirmed
nocache = 0x0040, // confirmed
temp = 0x0080, // confirmed
truncate = 0x0100, // confirmed
append = 0x0200, // confirmed
recreate = 0x0400, // confirmed
cantexist = 0x0800,
mustexist = 0x1000
};
#endif

View file

@ -4,12 +4,12 @@
DECLARE_STRUCT(Blizzard__File__ProcessDirParms);
struct Blizzard__File__ProcessDirParms {
const char* dir;
const char* item;
void* param;
bool isdir;
const char* pathRoot;
const char* filename;
void* cookie;
bool isDir;
};
typedef bool (*Blizzard__File__ProcessDirCallback)(const Blizzard__File__ProcessDirParms* parms);
#endif
#endif

View file

@ -1,20 +1,23 @@
#ifndef BC_FILE_STREAM_H
#define BC_FILE_STREAM_H
#include "bc/file/info.h"
DECLARE_STRUCT(Blizzard__File__StreamRecord);
// Stream is defined as a pointer to StreamRecord
typedef Blizzard__File__StreamRecord* Blizzard__File__Stream;
#include "bc/file/fileinfo.h"
#include "bc/file/streaminginfo.h"
struct Blizzard__File__StreamRecord {
void* filehandle;
int32_t mode;
bool haveinfo;
uint32_t unk0C;
Blizzard__File__FileInfo info;
// GetFileInfo only gets a size if this is null or points to a zero value
int32_t* unk48;
char* name; // name is a pointer to &filehandle (0x00) + sizeof(StreamRecord)
// extra buffer that holds the actual data of name
void* fileHandle;
int32_t mode;
bool infoValid;
uint32_t unk0C; // not present in Diablo 3 Switch
Blizzard__File__FileInfo info;
Blizzard__File__StreamingInfo* streaming; // GetFileInfo only gets a size if this is null or points to a zero value
char* pathname; // name is a pointer to &filehandle (0x00) + sizeof(StreamRecord)
// extra buffer that holds the actual data of name
};
#endif
#endif

View file

@ -1,14 +0,0 @@
#ifndef BC_MAIN_H
#define BC_MAIN_H
#include "bc/file/filesystem.h"
#include "bc/file/stream.h"
#include "bc/file/processdir.h"
#include "bc/lock/do_once.h"
#include "bc/string/quicknativepath.h"
#include "bc/systemfile/stacked.h"
#include "bc/os/file.h"
#include "bc/os/file_data.h"
#include "bc/time/timestamp.h"
#endif

View file

@ -1,15 +0,0 @@
#ifndef BC_STRING_QUICK_NATIVE_PATH_H
#define BC_STRING_QUICK_NATIVE_PATH_H
#define BC_STRING_QUICK_NATIVE_PATH(N) \
typedef struct Blizzard__String__QuickNativePath_##N Blizzard__String__QuickNativePath_##N; \
struct Blizzard__String__QuickNativePath_##N { \
uint32_t length; \
char* path; \
char buffer[N]; \
}
BC_STRING_QUICK_NATIVE_PATH(300);
BC_STRING_QUICK_NATIVE_PATH(1024);
#endif

View file

@ -1,48 +0,0 @@
#ifndef BC_SYSTEM_FILE_STACKED_H
#define BC_SYSTEM_FILE_STACKED_H
#include "system/types.h"
#include "bc/file/stream.h"
#include "bc/file/info.h"
#include "bc/file/processdir.h"
#include "bc/file/mode.h"
DECLARE_STRUCT(System_File__Stacked__FileParms);
struct System_File__Stacked__FileParms {
// the offset of the file operation
// inside Blizzard::File::Filesystem
uint32_t op; //0x0
// name/path to a file or directory
char* name; //0x4
char* newname; // 0x8
Blizzard__File__StreamRecord* file; // 0xC
Blizzard__File__FileInfo* info;
uint32_t extra;
Blizzard__File__FileInfo noinfo;
uint32_t setinfo;
// something to do with file info
// used by:
// Blizzard::File::GetFileInfo
// set to -1
uint32_t getinfo;
Blizzard__File__Mode mode; // 0x58
void* data; //
uint32_t count;
int64_t offset;
int32_t whence;
char* buffer;
int32_t buffersize;
bool recurse;
// something to do with MakeAbsolutePath? (normalize? resolve? resolvesymlinks?)
bool canonicalize;
void* dirwalkparam;
Blizzard__File__ProcessDirCallback dirwalkcallback;
// set to false by Blizzard::File::ProcessDirFast
bool unk88;
bool overwrite;
bool set_acl; // something that causes a security descriptor to be generated in mkdir() (takeownership? chown? )
uint32_t unk8C;
};
#endif

View file

@ -1,6 +0,0 @@
#ifndef BC_TIME_TIMESTAMP_H
#define BC_TIME_TIMESTAMP_H
typedef int64_t Blizzard__Time__Timestamp;
#endif

View file

@ -1,82 +0,0 @@
#ifndef CCHARACTERCOMPONENT_H
#define CCHARACTERCOMPONENT_H
DECLARE_STRUCT(CCharacterComponent);
DECLARE_STRUCT(ComponentData);
DECLARE_STRUCT(ItemDisplay);
#include "system/types.h"
#include "texture/texture.h"
#include "tempest/vector.h"
#include "m2/model.h"
struct ComponentData
{
int32_t raceID;
int32_t sexID;
int32_t classID;
int32_t hairColorID;
int32_t skinID;
int32_t faceID;
int32_t facialHairStyleID;
int32_t hairStyleID;
CM2Model* m2Model;
uint32_t flags;
char npcBakedTexturePath[260];
uint32_t geosets[19];
};
struct ItemDisplay
{
void* texture[7];
uint32_t displayID[7];
uint32_t displayFlag;
};
struct CCharacterComponent
{
int32_t unk_000;
int32_t unk_004;
int32_t flags;
int32_t sections;
uint32_t objectIndex;
EGxTexFormat texFormat;
ComponentData componentData;
CTexture* characterBaseSkin;
// 0 - use in CreateRequest AL/AU/FO/HA/HL/HU/LL/LU/TL funcs ; use display info index 0, 1, 2, 3, 4, 5, 6, 7
// 3 - use in CreateRequestHL func
// 4 - use in CreateRequestHU func
// 6 - use in CreateRequestHL func
// 7 - use in CreateRequestHU func
// 10 - use in CreateRequestHL func
// 11 - use in CreateRequestHU func
// 12 - use in CreateRequestLU func
// 13 - use in CreateRequestTU func
void* m_textureVariation[15];
// 0 - shirt/chest display
// 1 - chest/wrist/arms display
// 2 - arms display
// 3 - shirt/chest/tabard display
// 4 - shirt/chest/tabard display
// 5 - legs/belt display
// 6 - legs/feet display
// 7 - feet display
ItemDisplay itemDisplayInfo[10];
uint32_t itemModels[11];
int32_t unk_454;
int32_t unk_458;
int32_t unk_45C;
int32_t unk_460;
uint32_t unkArray[50];
int32_t unk_52C;
};
#endif

View file

@ -1,16 +0,0 @@
/*
** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions from Lua API
** See Copyright Notice in lua.h
*/
#ifndef lapi_h
#define lapi_h
#include "external/lua/lobject.h"
LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);
#endif

View file

@ -1,174 +0,0 @@
/*
** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "external/lua/lua.h"
#if defined(LUA_COMPAT_GETN)
LUALIB_API int (luaL_getn) (lua_State *L, int t);
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
#else
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif
#if defined(LUA_COMPAT_OPENLIB)
#define luaI_openlib luaL_openlib
#endif
/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
const luaL_Reg *l, int nup);
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
const luaL_Reg *l);
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
const char *name);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
const char *r);
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
const char *fname, int szhint);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_argcheck(L, cond,numarg,extramsg) \
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
typedef struct luaL_Buffer {
char *p; /* current position in buffer */
int lvl; /* number of strings in the stack (level) */
lua_State *L;
char buffer[LUAL_BUFFERSIZE];
} luaL_Buffer;
#define luaL_addchar(B,c) \
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
(*(B)->p++ = (char)(c)))
/* compatibility only */
#define luaL_putchar(B,c) luaL_addchar(B,c)
#define luaL_addsize(B,n) ((B)->p += (n))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
/* }====================================================== */
/* compatibility with ref system */
/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
#define luaL_reg luaL_Reg
#endif

View file

@ -1,76 +0,0 @@
/*
** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
#ifndef lcode_h
#define lcode_h
#include "external/lua/llex.h"
#include "external/lua/lobject.h"
#include "external/lua/lopcodes.h"
#include "external/lua/lparser.h"
/*
** Marks the end of a patch list. It is an invalid value both as an absolute
** address, and as a list link (would link an element to itself).
*/
#define NO_JUMP (-1)
/*
** grep "ORDER OPR" if you change these enums
*/
typedef enum BinOpr {
OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,
OPR_CONCAT,
OPR_NE, OPR_EQ,
OPR_LT, OPR_LE, OPR_GT, OPR_GE,
OPR_AND, OPR_OR,
OPR_NOBINOPR
} BinOpr;
typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info])
#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n);
LUAI_FUNC void luaK_checkstack (FuncState *fs, int n);
LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s);
LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r);
LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e);
LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);
LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e);
LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e);
LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e);
LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key);
LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);
LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e);
LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);
LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);
LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e);
LUAI_FUNC int luaK_jump (FuncState *fs);
LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);
LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);
LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);
LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);
LUAI_FUNC int luaK_getlabel (FuncState *fs);
LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v);
LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
#endif

View file

@ -1,33 +0,0 @@
/*
** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions from Debug Interface module
** See Copyright Notice in lua.h
*/
#ifndef ldebug_h
#define ldebug_h
#include "external/lua/lstate.h"
#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1)
#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0)
#define resethookcount(L) (L->hookcount = L->basehookcount)
LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o,
const char *opname);
LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2);
LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1,
const TValue *p2);
LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1,
const TValue *p2);
LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...);
LUAI_FUNC void luaG_errormsg (lua_State *L);
LUAI_FUNC int luaG_checkcode (const Proto *pt);
LUAI_FUNC int luaG_checkopenop (Instruction i);
#endif

View file

@ -1,57 +0,0 @@
/*
** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
#ifndef ldo_h
#define ldo_h
#include "external/lua/lobject.h"
#include "external/lua/lstate.h"
#include "external/lua/lzio.h"
#define luaD_checkstack(L,n) \
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
luaD_growstack(L, n); \
else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
#define savestack(L,p) ((char *)(p) - (char *)L->stack)
#define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
/* results from luaD_precall */
#define PCRLUA 0 /* initiated a call to a Lua function */
#define PCRC 1 /* did a call to a C function */
#define PCRYIELD 2 /* C funtion yielded */
/* type of protected functions, to be ran by `runprotected' */
typedef void (*Pfunc) (lua_State *L, void *ud);
LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
ptrdiff_t oldtop, ptrdiff_t ef);
LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
LUAI_FUNC void luaD_growstack (lua_State *L, int n);
LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
#endif

View file

@ -1,34 +0,0 @@
/*
** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/
#ifndef lfunc_h
#define lfunc_h
#include "external/lua/lobject.h"
#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \
cast(int, sizeof(TValue)*((n)-1)))
#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \
cast(int, sizeof(TValue *)*((n)-1)))
LUAI_FUNC Proto *luaF_newproto (lua_State *L);
LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
LUAI_FUNC void luaF_close (lua_State *L, StkId level);
LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c);
LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv);
LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
int pc);
#endif

View file

@ -1,110 +0,0 @@
/*
** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
#ifndef lgc_h
#define lgc_h
#include "external/lua/lobject.h"
/*
** Possible states of the Garbage Collector
*/
#define GCSpause 0
#define GCSpropagate 1
#define GCSsweepstring 2
#define GCSsweep 3
#define GCSfinalize 4
/*
** some userful bit tricks
*/
#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m)))
#define setbits(x,m) ((x) |= (m))
#define testbits(x,m) ((x) & (m))
#define bitmask(b) (1<<(b))
#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
#define l_setbit(x,b) setbits(x, bitmask(b))
#define resetbit(x,b) resetbits(x, bitmask(b))
#define testbit(x,b) testbits(x, bitmask(b))
#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2)))
#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2)))
#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2)))
/*
** Layout for bit use in `marked' field:
** bit 0 - object is white (type 0)
** bit 1 - object is white (type 1)
** bit 2 - object is black
** bit 3 - for userdata: has been finalized
** bit 3 - for tables: has weak keys
** bit 4 - for tables: has weak values
** bit 5 - object is fixed (should not be collected)
** bit 6 - object is "super" fixed (only the main thread)
*/
#define WHITE0BIT 0
#define WHITE1BIT 1
#define BLACKBIT 2
#define FINALIZEDBIT 3
#define KEYWEAKBIT 3
#define VALUEWEAKBIT 4
#define FIXEDBIT 5
#define SFIXEDBIT 6
#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)
#define isblack(x) testbit((x)->gch.marked, BLACKBIT)
#define isgray(x) (!isblack(x) && !iswhite(x))
#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS)
#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x)))
#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
#define luaC_checkGC(L) { \
condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \
if (G(L)->totalbytes >= G(L)->GCthreshold) \
luaC_step(L); }
#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
luaC_barrierf(L,obj2gco(p),gcvalue(v)); }
#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \
luaC_barrierback(L,t); }
#define luaC_objbarrier(L,p,o) \
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
luaC_barrierf(L,obj2gco(p),obj2gco(o)); }
#define luaC_objbarriert(L,t,o) \
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); }
LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all);
LUAI_FUNC void luaC_callGCTM (lua_State *L);
LUAI_FUNC void luaC_freeall (lua_State *L);
LUAI_FUNC void luaC_step (lua_State *L);
LUAI_FUNC void luaC_fullgc (lua_State *L);
LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv);
LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);
LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t);
#endif

View file

@ -1,81 +0,0 @@
/*
** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
#ifndef llex_h
#define llex_h
#include "external/lua/lobject.h"
#include "external/lua/lzio.h"
#define FIRST_RESERVED 257
/* maximum length of a reserved word */
#define TOKEN_LEN (sizeof("function")/sizeof(char))
/*
* WARNING: if you change the order of this enumeration,
* grep "ORDER RESERVED"
*/
enum RESERVED {
/* terminal symbols denoted by reserved words */
TK_AND = FIRST_RESERVED, TK_BREAK,
TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
/* other terminal symbols */
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
TK_NAME, TK_STRING, TK_EOS
};
/* number of reserved words */
#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
/* array with token `names' */
LUAI_DATA const char *const luaX_tokens [];
typedef union {
lua_Number r;
TString *ts;
} SemInfo; /* semantics information */
typedef struct Token {
int token;
SemInfo seminfo;
} Token;
typedef struct LexState {
int current; /* current character (charint) */
int linenumber; /* input line counter */
int lastline; /* line of last token `consumed' */
Token t; /* current token */
Token lookahead; /* look ahead token */
struct FuncState *fs; /* `FuncState' is private to the parser */
struct lua_State *L;
ZIO *z; /* input stream */
Mbuffer *buff; /* buffer for tokens */
TString *source; /* current source name */
char decpoint; /* locale decimal point */
} LexState;
LUAI_FUNC void luaX_init (lua_State *L);
LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
TString *source);
LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
LUAI_FUNC void luaX_next (LexState *ls);
LUAI_FUNC void luaX_lookahead (LexState *ls);
LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token);
LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s);
LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
#endif

View file

@ -1,128 +0,0 @@
/*
** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $
** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h
*/
#ifndef llimits_h
#define llimits_h
#include <limits.h>
#include <stddef.h>
#include "external/lua/lua.h"
typedef LUAI_UINT32 lu_int32;
typedef LUAI_UMEM lu_mem;
typedef LUAI_MEM l_mem;
/* chars used as small naturals (so that `char' is reserved for characters) */
typedef unsigned char lu_byte;
#define MAX_SIZET ((size_t)(~(size_t)0)-2)
#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
/*
** conversion of pointer to integer
** this is for hashing only; there is no problem if the integer
** cannot hold the whole pointer value
*/
#define IntPoint(p) ((unsigned int)(lu_mem)(p))
/* type to ensure maximum alignment */
typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
/* result of a `usual argument conversion' over lua_Number */
typedef LUAI_UACNUMBER l_uacNumber;
/* internal assertions for in-house debugging */
#ifdef lua_assert
#define check_exp(c,e) (lua_assert(c), (e))
#define api_check(l,e) lua_assert(e)
#else
#define lua_assert(c) ((void)0)
#define check_exp(c,e) (e)
#define api_check luai_apicheck
#endif
#ifndef UNUSED
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
#endif
#ifndef cast
#define cast(t, exp) ((t)(exp))
#endif
#define cast_byte(i) cast(lu_byte, (i))
#define cast_num(i) cast(lua_Number, (i))
#define cast_int(i) cast(int, (i))
/*
** type for virtual-machine instructions
** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
*/
typedef lu_int32 Instruction;
/* maximum stack for a Lua function */
#define MAXSTACK 250
/* minimum size for the string table (must be power of 2) */
#ifndef MINSTRTABSIZE
#define MINSTRTABSIZE 32
#endif
/* minimum size for string buffer */
#ifndef LUA_MINBUFFER
#define LUA_MINBUFFER 32
#endif
#ifndef lua_lock
#define lua_lock(L) ((void) 0)
#define lua_unlock(L) ((void) 0)
#endif
#ifndef luai_threadyield
#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
#endif
/*
** macro to control inclusion of some hard tests on stack reallocation
*/
#ifndef HARDSTACKTESTS
#define condhardstacktests(x) ((void)0)
#else
#define condhardstacktests(x) x
#endif
#endif

View file

@ -1,49 +0,0 @@
/*
** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
#ifndef lmem_h
#define lmem_h
#include <stddef.h>
#include "external/lua/llimits.h"
#include "external/lua/lua.h"
#define MEMERRMSG "not enough memory"
#define luaM_reallocv(L,b,on,n,e) \
((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \
luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \
luaM_toobig(L))
#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)
#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0)
#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t))
#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t))
#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t)))
#define luaM_newvector(L,n,t) \
cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))
#define luaM_growvector(L,v,nelems,size,t,limit,e) \
if ((nelems)+1 > (size)) \
((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
#define luaM_reallocvector(L, v,oldn,n,t) \
((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
size_t size);
LUAI_FUNC void *luaM_toobig (lua_State *L);
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
size_t size_elem, int limit,
const char *errormsg);
#endif

View file

@ -1,387 +0,0 @@
/*
** $Id: lobject.h,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
#ifndef lobject_h
#define lobject_h
#if defined(IDA) || defined(BINANA_GENERATOR)
#include "external/lua/shim.h"
#else
#include <stdarg.h>
#endif
#include "external/lua/llimits.h"
#include "external/lua/lua.h"
/* tags for values visible from Lua */
#define LAST_TAG LUA_TTHREAD
#define NUM_TAGS (LAST_TAG+1)
/*
** Extra tags for non-values
*/
#define LUA_TPROTO (LAST_TAG+1)
#define LUA_TUPVAL (LAST_TAG+2)
#define LUA_TDEADKEY (LAST_TAG+3)
/*
** Union of all collectable objects
*/
typedef union GCObject GCObject;
/*
** Common Header for all collectable objects (in macro form, to be
** included in other objects)
*/
#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
/*
** Common header in struct form
*/
typedef struct GCheader {
CommonHeader;
} GCheader;
/*
** Union of all Lua values
*/
typedef union {
GCObject *gc;
void *p;
lua_Number n;
int b;
} Value;
/*
** Tagged Values
*/
#define TValuefields Value value; int tt
typedef struct lua_TValue {
TValuefields;
} TValue;
/* Macros to test type */
#define ttisnil(o) (ttype(o) == LUA_TNIL)
#define ttisnumber(o) (ttype(o) == LUA_TNUMBER)
#define ttisstring(o) (ttype(o) == LUA_TSTRING)
#define ttistable(o) (ttype(o) == LUA_TTABLE)
#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN)
#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA)
#define ttisthread(o) (ttype(o) == LUA_TTHREAD)
#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA)
/* Macros to access values */
#define ttype(o) ((o)->tt)
#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n)
#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
#define tsvalue(o) (&rawtsvalue(o)->tsv)
#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
#define uvalue(o) (&rawuvalue(o)->uv)
#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl)
#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h)
#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b)
#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th)
#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
/*
** for internal debug only
*/
#define checkconsistency(obj) \
lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
#define checkliveness(g,obj) \
lua_assert(!iscollectable(obj) || \
((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc)))
/* Macros to set values */
#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
#define setnvalue(obj,x) \
{ TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
#define setpvalue(obj,x) \
{ TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
#define setbvalue(obj,x) \
{ TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
#define setsvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
checkliveness(G(L),i_o); }
#define setuvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
checkliveness(G(L),i_o); }
#define setthvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
checkliveness(G(L),i_o); }
#define setclvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
checkliveness(G(L),i_o); }
#define sethvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
checkliveness(G(L),i_o); }
#define setptvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
checkliveness(G(L),i_o); }
#define setobj(L,obj1,obj2) \
{ const TValue *o2=(obj2); TValue *o1=(obj1); \
o1->value = o2->value; o1->tt=o2->tt; \
checkliveness(G(L),o1); }
/*
** different types of sets, according to destination
*/
/* from stack to (same) stack */
#define setobjs2s setobj
/* to stack (not from same stack) */
#define setobj2s setobj
#define setsvalue2s setsvalue
#define sethvalue2s sethvalue
#define setptvalue2s setptvalue
/* from table to same table */
#define setobjt2t setobj
/* to table */
#define setobj2t setobj
/* to new object */
#define setobj2n setobj
#define setsvalue2n setsvalue
#define setttype(obj, tt) (ttype(obj) = (tt))
#define iscollectable(o) (ttype(o) >= LUA_TSTRING)
typedef TValue *StkId; /* index to stack elements */
/*
** String headers for string table
*/
typedef union TString {
L_Umaxalign dummy; /* ensures maximum alignment for strings */
struct {
CommonHeader;
lu_byte reserved;
unsigned int hash;
size_t len;
} tsv;
} TString;
#define getstr(ts) cast(const char *, (ts) + 1)
#define svalue(o) getstr(tsvalue(o))
typedef union Udata {
L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
struct {
CommonHeader;
struct Table *metatable;
struct Table *env;
size_t len;
} uv;
} Udata;
/*
** Function Prototypes
*/
typedef struct Proto {
CommonHeader;
TValue *k; /* constants used by the function */
Instruction *code;
struct Proto **p; /* functions defined inside the function */
int *lineinfo; /* map from opcodes to source lines */
struct LocVar *locvars; /* information about local variables */
TString **upvalues; /* upvalue names */
TString *source;
int sizeupvalues;
int sizek; /* size of `k' */
int sizecode;
int sizelineinfo;
int sizep; /* size of `p' */
int sizelocvars;
int linedefined;
int lastlinedefined;
GCObject *gclist;
lu_byte nups; /* number of upvalues */
lu_byte numparams;
lu_byte is_vararg;
lu_byte maxstacksize;
} Proto;
/* masks for new-style vararg */
#define VARARG_HASARG 1
#define VARARG_ISVARARG 2
#define VARARG_NEEDSARG 4
typedef struct LocVar {
TString *varname;
int startpc; /* first point where variable is active */
int endpc; /* first point where variable is dead */
} LocVar;
/*
** Upvalues
*/
typedef struct UpVal {
CommonHeader;
TValue *v; /* points to stack or to its own value */
union {
TValue value; /* the value (when closed) */
struct { /* double linked list (when open) */
struct UpVal *prev;
struct UpVal *next;
} l;
} u;
} UpVal;
/*
** Closures
*/
#define ClosureHeader \
CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \
struct Table *env
typedef struct CClosure {
ClosureHeader;
lua_CFunction f;
TValue upvalue[1];
} CClosure;
typedef struct LClosure {
ClosureHeader;
struct Proto *p;
UpVal *upvals[1];
} LClosure;
typedef union Closure {
CClosure c;
LClosure l;
} Closure;
#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)
#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
/*
** Tables
*/
typedef union TKey {
struct {
TValuefields;
struct Node *next; /* for chaining */
} nk;
TValue tvk;
} TKey;
typedef struct Node {
TValue i_val;
TKey i_key;
} Node;
typedef struct Table {
CommonHeader;
lu_byte flags; /* 1<<p means tagmethod(p) is not present */
lu_byte lsizenode; /* log2 of size of `node' array */
struct Table *metatable;
TValue *array; /* array part */
Node *node;
Node *lastfree; /* any free position is before this position */
GCObject *gclist;
int sizearray; /* size of `array' array */
} Table;
/*
** `module' operation for hashing (size is always a power of 2)
*/
#define lmod(s,size) \
(check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))
#define twoto(x) (1<<(x))
#define sizenode(t) (twoto((t)->lsizenode))
#define luaO_nilobject (&luaO_nilobject_)
LUAI_DATA const TValue luaO_nilobject_;
#define ceillog2(x) (luaO_log2((x)-1) + 1)
LUAI_FUNC int luaO_log2 (unsigned int x);
LUAI_FUNC int luaO_int2fb (unsigned int x);
LUAI_FUNC int luaO_fb2int (int x);
LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);
LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);
LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
va_list argp);
LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
#endif

View file

@ -1,268 +0,0 @@
/*
** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
#ifndef lopcodes_h
#define lopcodes_h
#include "external/lua/llimits.h"
/*===========================================================================
We assume that instructions are unsigned numbers.
All instructions have an opcode in the first 6 bits.
Instructions can have the following fields:
`A' : 8 bits
`B' : 9 bits
`C' : 9 bits
`Bx' : 18 bits (`B' and `C' together)
`sBx' : signed Bx
A signed argument is represented in excess K; that is, the number
value is the unsigned value minus K. K is exactly the maximum value
for that argument (so that -max is represented by 0, and +max is
represented by 2*max), which is half the maximum for the corresponding
unsigned argument.
===========================================================================*/
enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */
/*
** size and position of opcode arguments.
*/
#define SIZE_C 9
#define SIZE_B 9
#define SIZE_Bx (SIZE_C + SIZE_B)
#define SIZE_A 8
#define SIZE_OP 6
#define POS_OP 0
#define POS_A (POS_OP + SIZE_OP)
#define POS_C (POS_A + SIZE_A)
#define POS_B (POS_C + SIZE_C)
#define POS_Bx POS_C
/*
** limits for opcode arguments.
** we use (signed) int to manipulate most arguments,
** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
*/
#if SIZE_Bx < LUAI_BITSINT-1
#define MAXARG_Bx ((1<<SIZE_Bx)-1)
#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
#else
#define MAXARG_Bx MAX_INT
#define MAXARG_sBx MAX_INT
#endif
#define MAXARG_A ((1<<SIZE_A)-1)
#define MAXARG_B ((1<<SIZE_B)-1)
#define MAXARG_C ((1<<SIZE_C)-1)
/* creates a mask with `n' 1 bits at position `p' */
#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
/* creates a mask with `n' 0 bits at position `p' */
#define MASK0(n,p) (~MASK1(n,p))
/*
** the following macros help to manipulate instructions
*/
#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
#define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0)))
#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))
#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))
#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))
#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))
#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
#define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, b)<<POS_B) \
| (cast(Instruction, c)<<POS_C))
#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, bc)<<POS_Bx))
/*
** Macros to operate RK indices
*/
/* this bit 1 means constant (0 means register) */
#define BITRK (1 << (SIZE_B - 1))
/* test whether value is a constant */
#define ISK(x) ((x) & BITRK)
/* gets the index of the constant */
#define INDEXK(r) ((int)(r) & ~BITRK)
#define MAXINDEXRK (BITRK - 1)
/* code a constant index as a RK value */
#define RKASK(x) ((x) | BITRK)
/*
** invalid register that fits in 8 bits
*/
#define NO_REG MAXARG_A
/*
** R(x) - register
** Kst(x) - constant (in constant table)
** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)
*/
/*
** grep "ORDER OP" if you change these enums
*/
typedef enum {
/*----------------------------------------------------------------------
name args description
------------------------------------------------------------------------*/
OP_MOVE,/* A B R(A) := R(B) */
OP_LOADK,/* A Bx R(A) := Kst(Bx) */
OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */
OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */
OP_GETUPVAL,/* A B R(A) := UpValue[B] */
OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */
OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */
OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */
OP_SETUPVAL,/* A B UpValue[B] := R(A) */
OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */
OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */
OP_ADD,/* A B C R(A) := RK(B) + RK(C) */
OP_SUB,/* A B C R(A) := RK(B) - RK(C) */
OP_MUL,/* A B C R(A) := RK(B) * RK(C) */
OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
OP_MOD,/* A B C R(A) := RK(B) % RK(C) */
OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
OP_UNM,/* A B R(A) := -R(B) */
OP_NOT,/* A B R(A) := not R(B) */
OP_LEN,/* A B R(A) := length of R(B) */
OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
OP_JMP,/* sBx pc+=sBx */
OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
OP_FORLOOP,/* A sBx R(A)+=R(A+2);
if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */
OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */
OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */
} OpCode;
#define NUM_OPCODES (cast(int, OP_VARARG) + 1)
/*===========================================================================
Notes:
(*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
and can be 0: OP_CALL then sets `top' to last_result+1, so
next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.
(*) In OP_VARARG, if (B == 0) then use actual number of varargs and
set top (like in OP_CALL with C == 0).
(*) In OP_RETURN, if (B == 0) then return up to `top'
(*) In OP_SETLIST, if (B == 0) then B = `top';
if (C == 0) then next `instruction' is real C
(*) For comparisons, A specifies what condition the test should accept
(true or false).
(*) All `skips' (pc++) assume that next instruction is a jump
===========================================================================*/
/*
** masks for instruction properties. The format is:
** bits 0-1: op mode
** bits 2-3: C arg mode
** bits 4-5: B arg mode
** bit 6: instruction set register A
** bit 7: operator is a test
*/
enum OpArgMask {
OpArgN, /* argument is not used */
OpArgU, /* argument is used */
OpArgR, /* argument is a register or a jump offset */
OpArgK /* argument is a constant or register/constant */
};
LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES];
#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))
#define testAMode(m) (luaP_opmodes[m] & (1 << 6))
#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
/* number of list items to accumulate before a SETLIST instruction */
#define LFIELDS_PER_FLUSH 50
#endif

View file

@ -1,82 +0,0 @@
/*
** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $
** Lua Parser
** See Copyright Notice in lua.h
*/
#ifndef lparser_h
#define lparser_h
#include "external/lua/llimits.h"
#include "external/lua/lobject.h"
#include "external/lua/lzio.h"
/*
** Expression descriptor
*/
typedef enum {
VVOID, /* no value */
VNIL,
VTRUE,
VFALSE,
VK, /* info = index of constant in `k' */
VKNUM, /* nval = numerical value */
VLOCAL, /* info = local register */
VUPVAL, /* info = index of upvalue in `upvalues' */
VGLOBAL, /* info = index of table; aux = index of global name in `k' */
VINDEXED, /* info = table register; aux = index register (or `k') */
VJMP, /* info = instruction pc */
VRELOCABLE, /* info = instruction pc */
VNONRELOC, /* info = result register */
VCALL, /* info = instruction pc */
VVARARG /* info = instruction pc */
} expkind;
typedef struct expdesc {
expkind k;
union {
struct { int info, aux; } s;
lua_Number nval;
} u;
int t; /* patch list of `exit when true' */
int f; /* patch list of `exit when false' */
} expdesc;
typedef struct upvaldesc {
lu_byte k;
lu_byte info;
} upvaldesc;
struct BlockCnt; /* defined in lparser.c */
/* state needed to generate code for a given function */
typedef struct FuncState {
Proto *f; /* current function header */
Table *h; /* table to find (and reuse) elements in `k' */
struct FuncState *prev; /* enclosing function */
struct LexState *ls; /* lexical state */
struct lua_State *L; /* copy of the Lua state */
struct BlockCnt *bl; /* chain of current blocks */
int pc; /* next position to code (equivalent to `ncode') */
int lasttarget; /* `pc' of last `jump target' */
int jpc; /* list of pending jumps to `pc' */
int freereg; /* first free register */
int nk; /* number of elements in `k' */
int np; /* number of elements in `p' */
short nlocvars; /* number of elements in `locvars' */
lu_byte nactvar; /* number of active local variables */
upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */
unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */
} FuncState;
LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
const char *name);
#endif

View file

@ -1,169 +0,0 @@
/*
** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/
#ifndef lstate_h
#define lstate_h
#include "external/lua/lua.h"
#include "external/lua/lobject.h"
#include "external/lua/ltm.h"
#include "external/lua/lzio.h"
struct lua_longjmp; /* defined in ldo.c */
/* table of globals */
#define gt(L) (&L->l_gt)
/* registry */
#define registry(L) (&G(L)->l_registry)
/* extra stack space to handle TM calls and some other extras */
#define EXTRA_STACK 5
#define BASIC_CI_SIZE 8
#define BASIC_STACK_SIZE (2*LUA_MINSTACK)
typedef struct stringtable {
GCObject **hash;
lu_int32 nuse; /* number of elements */
int size;
} stringtable;
/*
** informations about a call
*/
typedef struct CallInfo {
StkId base; /* base for this function */
StkId func; /* function index in the stack */
StkId top; /* top for this function */
const Instruction *savedpc;
int nresults; /* expected number of results from this function */
int tailcalls; /* number of tail calls lost under this entry */
} CallInfo;
#define curr_func(L) (clvalue(L->ci->func))
#define ci_func(ci) (clvalue((ci)->func))
#define f_isLua(ci) (!ci_func(ci)->c.isC)
#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci))
/*
** `global state', shared by all threads of this state
*/
typedef struct global_State {
stringtable strt; /* hash table for strings */
lua_Alloc frealloc; /* function to reallocate memory */
void *ud; /* auxiliary data to `frealloc' */
lu_byte currentwhite;
lu_byte gcstate; /* state of garbage collector */
int sweepstrgc; /* position of sweep in `strt' */
GCObject *rootgc; /* list of all collectable objects */
GCObject **sweepgc; /* position of sweep in `rootgc' */
GCObject *gray; /* list of gray objects */
GCObject *grayagain; /* list of objects to be traversed atomically */
GCObject *weak; /* list of weak tables (to be cleared) */
GCObject *tmudata; /* last element of list of userdata to be GC */
Mbuffer buff; /* temporary buffer for string concatentation */
lu_mem GCthreshold;
lu_mem totalbytes; /* number of bytes currently allocated */
lu_mem estimate; /* an estimate of number of bytes actually in use */
lu_mem gcdept; /* how much GC is `behind schedule' */
int gcpause; /* size of pause between successive GCs */
int gcstepmul; /* GC `granularity' */
lua_CFunction panic; /* to be called in unprotected errors */
TValue l_registry;
struct lua_State *mainthread;
UpVal uvhead; /* head of double-linked list of all open upvalues */
struct Table *mt[NUM_TAGS]; /* metatables for basic types */
TString *tmname[TM_N]; /* array with tag-method names */
} global_State;
/*
** `per thread' state
*/
struct lua_State {
CommonHeader;
lu_byte status;
StkId top; /* first free slot in the stack */
StkId base; /* base of current function */
global_State *l_G;
CallInfo *ci; /* call info for current function */
const Instruction *savedpc; /* `savedpc' of current function */
StkId stack_last; /* last free slot in the stack */
StkId stack; /* stack base */
CallInfo *end_ci; /* points after end of ci array*/
CallInfo *base_ci; /* array of CallInfo's */
int stacksize;
int size_ci; /* size of array `base_ci' */
unsigned short nCcalls; /* number of nested C calls */
unsigned short baseCcalls; /* nested C calls when resuming coroutine */
lu_byte hookmask;
lu_byte allowhook;
int basehookcount;
int hookcount;
lua_Hook hook;
TValue l_gt; /* table of globals */
TValue env; /* temporary place for environments */
GCObject *openupval; /* list of open upvalues in this stack */
GCObject *gclist;
struct lua_longjmp *errorJmp; /* current error recover point */
ptrdiff_t errfunc; /* current error handling function (stack index) */
};
#define G(L) (L->l_G)
/*
** Union of all collectable objects
*/
union GCObject {
GCheader gch;
union TString ts;
union Udata u;
union Closure cl;
struct Table h;
struct Proto p;
struct UpVal uv;
struct lua_State th; /* thread */
};
/* macros to convert a GCObject into a specific value */
#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
#define gco2ts(o) (&rawgco2ts(o)->tsv)
#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
#define gco2u(o) (&rawgco2u(o)->uv)
#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
#define ngcotouv(o) \
check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
/* macro to convert any Lua object into a GCObject */
#define obj2gco(v) (cast(GCObject *, (v)))
LUAI_FUNC lua_State *luaE_newthread (lua_State *L);
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
#endif

View file

@ -1,31 +0,0 @@
/*
** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $
** String table (keep all strings handled by Lua)
** See Copyright Notice in lua.h
*/
#ifndef lstring_h
#define lstring_h
#include "external/lua/lgc.h"
#include "external/lua/lobject.h"
#include "external/lua/lstate.h"
#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char))
#define sizeudata(u) (sizeof(union Udata)+(u)->len)
#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
(sizeof(s)/sizeof(char))-1))
#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
#endif

View file

@ -1,40 +0,0 @@
/*
** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
#ifndef ltable_h
#define ltable_h
#include "lobject.h"
#define gnode(t,i) (&(t)->node[i])
#define gkey(n) (&(n)->i_key.nk)
#define gval(n) (&(n)->i_val)
#define gnext(n) ((n)->i_key.nk.next)
#define key2tval(n) (&(n)->i_key.tvk)
LUAI_FUNC const TValue *luaH_getnum (Table *t, int key);
LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key);
LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key);
LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash);
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize);
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
LUAI_FUNC int luaH_getn (Table *t);
#if defined(LUA_DEBUG)
LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);
LUAI_FUNC int luaH_isdummy (Node *n);
#endif
#endif

View file

@ -1,54 +0,0 @@
/*
** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $
** Tag methods
** See Copyright Notice in lua.h
*/
#ifndef ltm_h
#define ltm_h
#include "external/lua/lobject.h"
/*
* WARNING: if you change the order of this enumeration,
* grep "ORDER TM"
*/
typedef enum {
TM_INDEX,
TM_NEWINDEX,
TM_GC,
TM_MODE,
TM_EQ, /* last tag method with `fast' access */
TM_ADD,
TM_SUB,
TM_MUL,
TM_DIV,
TM_MOD,
TM_POW,
TM_UNM,
TM_LEN,
TM_LT,
TM_LE,
TM_CONCAT,
TM_CALL,
TM_N /* number of elements in the enum */
} TMS;
#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
#define fasttm(l,et,e) gfasttm(G(l), et, e)
LUAI_DATA const char *const luaT_typenames[];
LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
TMS event);
LUAI_FUNC void luaT_init (lua_State *L);
#endif

View file

@ -1,385 +0,0 @@
/*
** $Id: lua.h,v 1.218.1.4 2008/01/03 15:41:15 roberto Exp $
** Lua - An Extensible Extension Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
*/
#ifndef lua_h
#define lua_h
#include "system/types.h"
#include "external/lua/luaconf.h"
#define LUA_VERSION "Lua 5.1"
#define LUA_RELEASE "Lua 5.1.3"
#define LUA_VERSION_NUM 501
#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
/* mark for precompiled code (`<esc>Lua') */
#define LUA_SIGNATURE "\033Lua"
/* option for multiple returns in `lua_pcall' and `lua_call' */
#define LUA_MULTRET (-1)
/*
** pseudo-indices
*/
#define LUA_REGISTRYINDEX (-10000)
#define LUA_ENVIRONINDEX (-10001)
#define LUA_GLOBALSINDEX (-10002)
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
/* thread status; 0 is OK */
#define LUA_YIELD 1
#define LUA_ERRRUN 2
#define LUA_ERRSYNTAX 3
#define LUA_ERRMEM 4
#define LUA_ERRERR 5
typedef struct lua_State lua_State;
typedef int (*lua_CFunction) (lua_State *L);
/*
** functions that read/write blocks when loading/dumping Lua chunks
*/
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
/*
** prototype for memory-allocation functions
*/
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
/*
** basic types
*/
#define LUA_TNONE (-1)
#define LUA_TNIL 0
#define LUA_TBOOLEAN 1
#define LUA_TLIGHTUSERDATA 2
#define LUA_TNUMBER 3
#define LUA_TSTRING 4
#define LUA_TTABLE 5
#define LUA_TFUNCTION 6
#define LUA_TUSERDATA 7
#define LUA_TTHREAD 8
/* minimum Lua stack available to a C function */
#define LUA_MINSTACK 20
/*
** generic extra include file
*/
#if defined(LUA_USER_H)
#include LUA_USER_H
#endif
/* type of numbers in Lua */
typedef LUA_NUMBER lua_Number;
/* type for integer functions */
typedef LUA_INTEGER lua_Integer;
/*
** state manipulation
*/
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
LUA_API void (lua_close) (lua_State *L);
LUA_API lua_State *(lua_newthread) (lua_State *L);
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
/*
** basic stack manipulation
*/
LUA_API int (lua_gettop) (lua_State *L);
LUA_API void (lua_settop) (lua_State *L, int idx);
LUA_API void (lua_pushvalue) (lua_State *L, int idx);
LUA_API void (lua_remove) (lua_State *L, int idx);
LUA_API void (lua_insert) (lua_State *L, int idx);
LUA_API void (lua_replace) (lua_State *L, int idx);
LUA_API int (lua_checkstack) (lua_State *L, int sz);
LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
/*
** access functions (stack -> C)
*/
LUA_API int (lua_isnumber) (lua_State *L, int idx);
LUA_API int (lua_isstring) (lua_State *L, int idx);
LUA_API int (lua_iscfunction) (lua_State *L, int idx);
LUA_API int (lua_isuserdata) (lua_State *L, int idx);
LUA_API int (lua_type) (lua_State *L, int idx);
LUA_API const char *(lua_typename) (lua_State *L, int tp);
LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
LUA_API int (lua_toboolean) (lua_State *L, int idx);
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
LUA_API size_t (lua_objlen) (lua_State *L, int idx);
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
LUA_API void *(lua_touserdata) (lua_State *L, int idx);
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
LUA_API const void *(lua_topointer) (lua_State *L, int idx);
/*
** push functions (C -> stack)
*/
LUA_API void (lua_pushnil) (lua_State *L);
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
LUA_API void (lua_pushstring) (lua_State *L, const char *s);
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
va_list argp);
LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
LUA_API void (lua_pushboolean) (lua_State *L, int b);
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
LUA_API int (lua_pushthread) (lua_State *L);
/*
** get functions (Lua -> stack)
*/
LUA_API void (lua_gettable) (lua_State *L, int idx);
LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
LUA_API void (lua_rawget) (lua_State *L, int idx);
LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
LUA_API void (lua_getfenv) (lua_State *L, int idx);
/*
** set functions (stack -> Lua)
*/
LUA_API void (lua_settable) (lua_State *L, int idx);
LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
LUA_API void (lua_rawset) (lua_State *L, int idx);
LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
LUA_API int (lua_setfenv) (lua_State *L, int idx);
/*
** `load' and `call' functions (load and run Lua code)
*/
LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
const char *chunkname);
LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
/*
** coroutine functions
*/
LUA_API int (lua_yield) (lua_State *L, int nresults);
LUA_API int (lua_resume) (lua_State *L, int narg);
LUA_API int (lua_status) (lua_State *L);
/*
** garbage-collection function and options
*/
#define LUA_GCSTOP 0
#define LUA_GCRESTART 1
#define LUA_GCCOLLECT 2
#define LUA_GCCOUNT 3
#define LUA_GCCOUNTB 4
#define LUA_GCSTEP 5
#define LUA_GCSETPAUSE 6
#define LUA_GCSETSTEPMUL 7
LUA_API int (lua_gc) (lua_State *L, int what, int data);
/*
** miscellaneous functions
*/
LUA_API int (lua_error) (lua_State *L);
LUA_API int (lua_next) (lua_State *L, int idx);
LUA_API void (lua_concat) (lua_State *L, int n);
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define lua_pop(L,n) lua_settop(L, -(n)-1)
#define lua_newtable(L) lua_createtable(L, 0, 0)
#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
#define lua_strlen(L,i) lua_objlen(L, (i))
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
#define lua_pushliteral(L, s) \
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
/*
** compatibility macros and functions
*/
#define lua_open() luaL_newstate()
#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)
#define lua_Chunkreader lua_Reader
#define lua_Chunkwriter lua_Writer
/* hack */
LUA_API void lua_setlevel (lua_State *from, lua_State *to);
/*
** {======================================================================
** Debug API
** =======================================================================
*/
/*
** Event codes
*/
#define LUA_HOOKCALL 0
#define LUA_HOOKRET 1
#define LUA_HOOKLINE 2
#define LUA_HOOKCOUNT 3
#define LUA_HOOKTAILRET 4
/*
** Event masks
*/
#define LUA_MASKCALL (1 << LUA_HOOKCALL)
#define LUA_MASKRET (1 << LUA_HOOKRET)
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
typedef struct lua_Debug lua_Debug; /* activation record */
/* Functions to be called by the debuger in specific events */
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
LUA_API lua_Hook lua_gethook (lua_State *L);
LUA_API int lua_gethookmask (lua_State *L);
LUA_API int lua_gethookcount (lua_State *L);
struct lua_Debug {
int event;
const char *name; /* (n) */
const char *namewhat; /* (n) `global', `local', `field', `method' */
const char *what; /* (S) `Lua', `C', `main', `tail' */
const char *source; /* (S) */
int currentline; /* (l) */
int nups; /* (u) number of upvalues */
int linedefined; /* (S) */
int lastlinedefined; /* (S) */
char short_src[LUA_IDSIZE]; /* (S) */
/* private part */
int i_ci; /* active function */
};
/* }====================================================================== */
/******************************************************************************
* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#endif

View file

@ -1,762 +0,0 @@
/*
** $Id: luaconf.h,v 1.82.1.6 2008/01/18 17:07:48 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
#ifndef lconfig_h
#define lconfig_h
#include "system/limits.h"
#include "system/types.h"
/*
** ==================================================================
** Search for "@@" to find all configurable definitions.
** ===================================================================
*/
/*
@@ LUA_ANSI controls the use of non-ansi features.
** CHANGE it (define it) if you want Lua to avoid the use of any
** non-ansi feature or library.
*/
#if defined(__STRICT_ANSI__)
#define LUA_ANSI
#endif
#if !defined(LUA_ANSI) && defined(_WIN32)
#define LUA_WIN
#endif
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
#define LUA_USE_READLINE /* needs some extra libraries */
#endif
#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
#define LUA_DL_DYLD /* does not need extra library */
#endif
/*
@@ LUA_USE_POSIX includes all functionallity listed as X/Open System
@* Interfaces Extension (XSI).
** CHANGE it (define it) if your system is XSI compatible.
*/
#if defined(LUA_USE_POSIX)
#define LUA_USE_MKSTEMP
#define LUA_USE_ISATTY
#define LUA_USE_POPEN
#define LUA_USE_ULONGJMP
#endif
/*
@@ LUA_PATH and LUA_CPATH are the names of the environment variables that
@* Lua check to set its paths.
@@ LUA_INIT is the name of the environment variable that Lua
@* checks for initialization code.
** CHANGE them if you want different names.
*/
#define LUA_PATH "LUA_PATH"
#define LUA_CPATH "LUA_CPATH"
#define LUA_INIT "LUA_INIT"
/*
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
@* Lua libraries.
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
@* C libraries.
** CHANGE them if your machine has a non-conventional directory
** hierarchy or if you want to install your libraries in
** non-conventional directories.
*/
#if defined(_WIN32)
/*
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
#define LUA_LDIR "!\\lua\\"
#define LUA_CDIR "!\\"
#define LUA_PATH_DEFAULT \
".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
#define LUA_CPATH_DEFAULT \
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
#define LUA_ROOT "/usr/local/"
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#define LUA_PATH_DEFAULT \
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
#define LUA_CPATH_DEFAULT \
"./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
#endif
/*
@@ LUA_DIRSEP is the directory separator (for submodules).
** CHANGE it if your machine does not use "/" as the directory separator
** and is not Windows. (On Windows Lua automatically uses "\".)
*/
#if defined(_WIN32)
#define LUA_DIRSEP "\\"
#else
#define LUA_DIRSEP "/"
#endif
/*
@@ LUA_PATHSEP is the character that separates templates in a path.
@@ LUA_PATH_MARK is the string that marks the substitution points in a
@* template.
@@ LUA_EXECDIR in a Windows path is replaced by the executable's
@* directory.
@@ LUA_IGMARK is a mark to ignore all before it when bulding the
@* luaopen_ function name.
** CHANGE them if for some reason your system cannot use those
** characters. (E.g., if one of those characters is a common character
** in file/directory names.) Probably you do not need to change them.
*/
#define LUA_PATHSEP ";"
#define LUA_PATH_MARK "?"
#define LUA_EXECDIR "!"
#define LUA_IGMARK "-"
/*
@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
** machines, ptrdiff_t gives a good choice between int or long.)
*/
#define LUA_INTEGER ptrdiff_t
/*
@@ LUA_API is a mark for all core API functions.
@@ LUALIB_API is a mark for all standard library functions.
** CHANGE them if you need to define those functions in some special way.
** For instance, if you want to create one Windows DLL with the core and
** the libraries, you may want to use the following definition (define
** LUA_BUILD_AS_DLL to get it).
*/
#if defined(LUA_BUILD_AS_DLL)
#if defined(LUA_CORE) || defined(LUA_LIB)
#define LUA_API __declspec(dllexport)
#else
#define LUA_API __declspec(dllimport)
#endif
#else
#define LUA_API extern
#endif
/* more often than not the libs go together with the core */
#define LUALIB_API LUA_API
/*
@@ LUAI_FUNC is a mark for all extern functions that are not to be
@* exported to outside modules.
@@ LUAI_DATA is a mark for all extern (const) variables that are not to
@* be exported to outside modules.
** CHANGE them if you need to mark them in some special way. Elf/gcc
** (versions 3.2 and later) mark them as "hidden" to optimize access
** when Lua is compiled as a shared library.
*/
#if defined(luaall_c)
#define LUAI_FUNC static
#define LUAI_DATA /* empty */
#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
defined(__ELF__)
#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
#define LUAI_DATA LUAI_FUNC
#else
#define LUAI_FUNC extern
#define LUAI_DATA extern
#endif
/*
@@ LUA_QL describes how error messages quote program elements.
** CHANGE it if you want a different appearance.
*/
#define LUA_QL(x) "'" x "'"
#define LUA_QS LUA_QL("%s")
/*
@@ LUA_IDSIZE gives the maximum size for the description of the source
@* of a function in debug information.
** CHANGE it if you want a different size.
*/
#define LUA_IDSIZE 60
/*
** {==================================================================
** Stand-alone configuration
** ===================================================================
*/
#if defined(lua_c) || defined(luaall_c)
/*
@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
@* is, whether we're running lua interactively).
** CHANGE it if you have a better definition for non-POSIX/non-Windows
** systems.
*/
#if defined(LUA_USE_ISATTY)
#include <unistd.h>
#define lua_stdin_is_tty() isatty(0)
#elif defined(LUA_WIN)
#include <io.h>
#include <stdio.h>
#define lua_stdin_is_tty() _isatty(_fileno(stdin))
#else
#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
#endif
/*
@@ LUA_PROMPT is the default prompt used by stand-alone Lua.
@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
** CHANGE them if you want different prompts. (You can also change the
** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
*/
#define LUA_PROMPT "> "
#define LUA_PROMPT2 ">> "
/*
@@ LUA_PROGNAME is the default name for the stand-alone Lua program.
** CHANGE it if your stand-alone interpreter has a different name and
** your system is not able to detect that name automatically.
*/
#define LUA_PROGNAME "lua"
/*
@@ LUA_MAXINPUT is the maximum length for an input line in the
@* stand-alone interpreter.
** CHANGE it if you need longer lines.
*/
#define LUA_MAXINPUT 512
/*
@@ lua_readline defines how to show a prompt and then read a line from
@* the standard input.
@@ lua_saveline defines how to "save" a read line in a "history".
@@ lua_freeline defines how to free a line read by lua_readline.
** CHANGE them if you want to improve this functionality (e.g., by using
** GNU readline and history facilities).
*/
#if defined(LUA_USE_READLINE)
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
#define lua_saveline(L,idx) \
if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
add_history(lua_tostring(L, idx)); /* add it to history */
#define lua_freeline(L,b) ((void)L, free(b))
#else
#define lua_readline(L,b,p) \
((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
#define lua_saveline(L,idx) { (void)L; (void)idx; }
#define lua_freeline(L,b) { (void)L; (void)b; }
#endif
#endif
/* }================================================================== */
/*
@@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
@* as a percentage.
** CHANGE it if you want the GC to run faster or slower (higher values
** mean larger pauses which mean slower collection.) You can also change
** this value dynamically.
*/
#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
/*
@@ LUAI_GCMUL defines the default speed of garbage collection relative to
@* memory allocation as a percentage.
** CHANGE it if you want to change the granularity of the garbage
** collection. (Higher values mean coarser collections. 0 represents
** infinity, where each step performs a full collection.) You can also
** change this value dynamically.
*/
#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
/*
@@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
** CHANGE it (define it) if you want exact compatibility with the
** behavior of setn/getn in Lua 5.0.
*/
#undef LUA_COMPAT_GETN
/*
@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
** CHANGE it to undefined as soon as you do not need a global 'loadlib'
** function (the function is still available as 'package.loadlib').
*/
#undef LUA_COMPAT_LOADLIB
/*
@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
** CHANGE it to undefined as soon as your programs use only '...' to
** access vararg parameters (instead of the old 'arg' table).
*/
#define LUA_COMPAT_VARARG
/*
@@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
** CHANGE it to undefined as soon as your programs use 'math.fmod' or
** the new '%' operator instead of 'math.mod'.
*/
#define LUA_COMPAT_MOD
/*
@@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
@* facility.
** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
** off the advisory error when nesting [[...]].
*/
#define LUA_COMPAT_LSTR 1
/*
@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
** CHANGE it to undefined as soon as you rename 'string.gfind' to
** 'string.gmatch'.
*/
#define LUA_COMPAT_GFIND
/*
@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
@* behavior.
** CHANGE it to undefined as soon as you replace to 'luaL_register'
** your uses of 'luaL_openlib'
*/
#define LUA_COMPAT_OPENLIB
/*
@@ luai_apicheck is the assert macro used by the Lua-C API.
** CHANGE luai_apicheck if you want Lua to perform some checks in the
** parameters it gets from API calls. This may slow down the interpreter
** a bit, but may be quite useful when debugging C code that interfaces
** with Lua. A useful redefinition is to use assert.h.
*/
#if defined(LUA_USE_APICHECK)
#include <assert.h>
#define luai_apicheck(L,o) { (void)L; assert(o); }
#else
#define luai_apicheck(L,o) { (void)L; }
#endif
/*
@@ LUAI_BITSINT defines the number of bits in an int.
** CHANGE here if Lua cannot automatically detect the number of bits of
** your machine. Probably you do not need to change this.
*/
/* avoid overflows in comparison */
#if INT_MAX-20 < 32760
#define LUAI_BITSINT 16
#elif INT_MAX > 2147483640L
/* int has at least 32 bits */
#define LUAI_BITSINT 32
#else
#error "you must define LUA_BITSINT with number of bits in an integer"
#endif
/*
@@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
@@ LUAI_INT32 is an signed integer with at least 32 bits.
@@ LUAI_UMEM is an unsigned integer big enough to count the total
@* memory used by Lua.
@@ LUAI_MEM is a signed integer big enough to count the total memory
@* used by Lua.
** CHANGE here if for some weird reason the default definitions are not
** good enough for your machine. (The definitions in the 'else'
** part always works, but may waste space on machines with 64-bit
** longs.) Probably you do not need to change this.
*/
#if LUAI_BITSINT >= 32
#define LUAI_UINT32 unsigned int
#define LUAI_INT32 int
#define LUAI_MAXINT32 INT_MAX
#define LUAI_UMEM size_t
#define LUAI_MEM ptrdiff_t
#else
/* 16-bit ints */
#define LUAI_UINT32 unsigned long
#define LUAI_INT32 long
#define LUAI_MAXINT32 LONG_MAX
#define LUAI_UMEM unsigned long
#define LUAI_MEM long
#endif
/*
@@ LUAI_MAXCALLS limits the number of nested calls.
** CHANGE it if you need really deep recursive calls. This limit is
** arbitrary; its only purpose is to stop infinite recursion before
** exhausting memory.
*/
#define LUAI_MAXCALLS 20000
/*
@@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
@* can use.
** CHANGE it if you need lots of (Lua) stack space for your C
** functions. This limit is arbitrary; its only purpose is to stop C
** functions to consume unlimited stack space.
*/
#define LUAI_MCS_AUX ((int)(INT_MAX / (4*sizeof(LUA_NUMBER))))
#define LUAI_MAXCSTACK (LUAI_MCS_AUX > SHRT_MAX ? SHRT_MAX : LUAI_MCS_AUX)
/*
** {==================================================================
** CHANGE (to smaller values) the following definitions if your system
** has a small C stack. (Or you may want to change them to larger
** values if your system has a large C stack and these limits are
** too rigid for you.) Some of these constants control the size of
** stack-allocated arrays used by the compiler or the interpreter, while
** others limit the maximum number of recursive calls that the compiler
** or the interpreter can perform. Values too large may cause a C stack
** overflow for some forms of deep constructs.
** ===================================================================
*/
/*
@@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
@* syntactical nested non-terminals in a program.
*/
#define LUAI_MAXCCALLS 200
/*
@@ LUAI_MAXVARS is the maximum number of local variables per function
@* (must be smaller than 250).
*/
#define LUAI_MAXVARS 200
/*
@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
@* (must be smaller than 250).
*/
#define LUAI_MAXUPVALUES 60
/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
*/
#define LUAL_BUFFERSIZE BUFSIZ
/* }================================================================== */
/*
** {==================================================================
@@ LUA_NUMBER is the type of numbers in Lua.
** CHANGE the following definitions only if you want to build Lua
** with a number type different from double. You may also need to
** change lua_number2int & lua_number2integer.
** ===================================================================
*/
#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER double
/*
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
@* over a number.
*/
#define LUAI_UACNUMBER double
/*
@@ LUA_NUMBER_SCAN is the format for reading numbers.
@@ LUA_NUMBER_FMT is the format for writing numbers.
@@ lua_number2str converts a number to a string.
@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
@@ lua_str2number converts a string to a number.
*/
#define LUA_NUMBER_SCAN "%lf"
#define LUA_NUMBER_FMT "%.14g"
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
#define lua_str2number(s,p) strtod((s), (p))
/*
@@ The luai_num* macros define the primitive operations over numbers.
*/
#if defined(LUA_CORE)
#include <math.h>
#define luai_numadd(a,b) ((a)+(b))
#define luai_numsub(a,b) ((a)-(b))
#define luai_nummul(a,b) ((a)*(b))
#define luai_numdiv(a,b) ((a)/(b))
#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
#define luai_numpow(a,b) (pow(a,b))
#define luai_numunm(a) (-(a))
#define luai_numeq(a,b) ((a)==(b))
#define luai_numlt(a,b) ((a)<(b))
#define luai_numle(a,b) ((a)<=(b))
#define luai_numisnan(a) (!luai_numeq((a), (a)))
#endif
/*
@@ lua_number2int is a macro to convert lua_Number to int.
@@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
** CHANGE them if you know a faster way to convert a lua_Number to
** int (with any rounding method and without throwing errors) in your
** system. In Pentium machines, a naive typecast from double to int
** in C is extremely slow, so any alternative is worth trying.
*/
/* On a Pentium, resort to a trick */
#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
(defined(__i386) || defined (_M_IX86) || defined(__i386__))
/* On a Microsoft compiler, use assembler */
#if defined(_MSC_VER)
#define lua_number2int(i,d) __asm fld d __asm fistp i
#define lua_number2integer(i,n) lua_number2int(i, n)
/* the next trick should work on any Pentium, but sometimes clashes
with a DirectX idiosyncrasy */
#else
union luai_Cast { double l_d; long l_l; };
#define lua_number2int(i,d) \
{ volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
#define lua_number2integer(i,n) lua_number2int(i, n)
#endif
/* this option always works, but may be slow */
#else
#define lua_number2int(i,d) ((i)=(int)(d))
#define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
#endif
/* }================================================================== */
/*
@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
** CHANGE it if your system requires alignments larger than double. (For
** instance, if your system supports long doubles and they must be
** aligned in 16-byte boundaries, then you should add long double in the
** union.) Probably you do not need to change this.
*/
#define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
/*
@@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
** CHANGE them if you prefer to use longjmp/setjmp even with C++
** or if want/don't to use _longjmp/_setjmp instead of regular
** longjmp/setjmp. By default, Lua handles errors with exceptions when
** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
** and with longjmp/setjmp otherwise.
*/
#if defined(__cplusplus)
/* C++ exceptions */
#define LUAI_THROW(L,c) throw(c)
#define LUAI_TRY(L,c,a) try { a } catch(...) \
{ if ((c)->status == 0) (c)->status = -1; }
#define luai_jmpbuf int /* dummy variable */
#elif defined(LUA_USE_ULONGJMP)
/* in Unix, try _longjmp/_setjmp (more efficient) */
#define LUAI_THROW(L,c) _longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf
#else
/* default handling with long jumps */
#define LUAI_THROW(L,c) longjmp((c)->b, 1)
#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
#define luai_jmpbuf jmp_buf
#endif
/*
@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
@* can do during pattern-matching.
** CHANGE it if you need more captures. This limit is arbitrary.
*/
#define LUA_MAXCAPTURES 32
/*
@@ lua_tmpnam is the function that the OS library uses to create a
@* temporary name.
@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
** CHANGE them if you have an alternative to tmpnam (which is considered
** insecure) or if you want the original tmpnam anyway. By default, Lua
** uses tmpnam except when POSIX is available, where it uses mkstemp.
*/
#if defined(loslib_c) || defined(luaall_c)
#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
#define LUA_TMPNAMBUFSIZE 32
#define lua_tmpnam(b,e) { \
strcpy(b, "/tmp/lua_XXXXXX"); \
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }
#else
#define LUA_TMPNAMBUFSIZE L_tmpnam
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
#endif
#endif
/*
@@ lua_popen spawns a new process connected to the current one through
@* the file streams.
** CHANGE it if you have a way to implement it in your system.
*/
#if defined(LUA_USE_POPEN)
#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
#define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
#elif defined(LUA_WIN)
#define lua_popen(L,c,m) ((void)L, _popen(c,m))
#define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
#else
#define lua_popen(L,c,m) ((void)((void)c, m), \
luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
#define lua_pclose(L,file) ((void)((void)L, file), 0)
#endif
/*
@@ LUA_DL_* define which dynamic-library system Lua should use.
** CHANGE here if Lua has problems choosing the appropriate
** dynamic-library system for your platform (either Windows' DLL, Mac's
** dyld, or Unix's dlopen). If your system is some kind of Unix, there
** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
** it. To use dlopen you also need to adapt the src/Makefile (probably
** adding -ldl to the linker options), so Lua does not select it
** automatically. (When you change the makefile to add -ldl, you must
** also add -DLUA_USE_DLOPEN.)
** If you do not want any kind of dynamic library, undefine all these
** options.
** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
*/
#if defined(LUA_USE_DLOPEN)
#define LUA_DL_DLOPEN
#endif
#if defined(LUA_WIN)
#define LUA_DL_DLL
#endif
/*
@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
@* (the data goes just *before* the lua_State pointer).
** CHANGE (define) this if you really need that. This value must be
** a multiple of the maximum alignment required for your machine.
*/
#define LUAI_EXTRASPACE 0
/*
@@ luai_userstate* allow user-specific actions on threads.
** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
** extra when a thread is created/deleted/resumed/yielded.
*/
#define luai_userstateopen(L) ((void)L)
#define luai_userstateclose(L) ((void)L)
#define luai_userstatethread(L,L1) ((void)L)
#define luai_userstatefree(L) ((void)L)
#define luai_userstateresume(L,n) ((void)L)
#define luai_userstateyield(L,n) ((void)L)
/*
@@ LUA_INTFRMLEN is the length modifier for integer conversions
@* in 'string.format'.
@@ LUA_INTFRM_T is the integer type correspoding to the previous length
@* modifier.
** CHANGE them if your system supports long long or does not support long.
*/
#if defined(LUA_USELONGLONG)
#define LUA_INTFRMLEN "ll"
#define LUA_INTFRM_T long long
#else
#define LUA_INTFRMLEN "l"
#define LUA_INTFRM_T long
#endif
/* =================================================================== */
/*
** Local configuration. You can use this space to add your redefinitions
** without modifying the main part of the file.
*/
#endif

View file

@ -1,56 +0,0 @@
/*
** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $
** Lua standard libraries
** See Copyright Notice in lua.h
*/
#ifndef lualib_h
#define lualib_h
#include "external/lua/lua.h"
/* Key to file-handle type */
#define LUA_FILEHANDLE "FILE*"
#define LUA_COLIBNAME "coroutine"
LUALIB_API int (luaopen_base) (lua_State *L);
#define LUA_TABLIBNAME "table"
LUALIB_API int (luaopen_table) (lua_State *L);
#define LUA_IOLIBNAME "io"
LUALIB_API int (luaopen_io) (lua_State *L);
#define LUA_OSLIBNAME "os"
LUALIB_API int (luaopen_os) (lua_State *L);
#define LUA_STRLIBNAME "string"
LUALIB_API int (luaopen_string) (lua_State *L);
#define LUA_MATHLIBNAME "math"
LUALIB_API int (luaopen_math) (lua_State *L);
#define LUA_DBLIBNAME "debug"
LUALIB_API int (luaopen_debug) (lua_State *L);
#define LUA_LOADLIBNAME "package"
LUALIB_API int (luaopen_package) (lua_State *L);
#define LUA_BITLIBNAME "bit"
LUALIB_API int luaopen_bit(lua_State *L);
/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);
#ifndef lua_assert
#define lua_assert(x) ((void)0)
#endif
#endif

View file

@ -1,36 +0,0 @@
/*
** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/
#ifndef lundump_h
#define lundump_h
#include "external/lua/lobject.h"
#include "external/lua/lzio.h"
/* load one chunk; from lundump.c */
LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);
/* make header; from lundump.c */
LUAI_FUNC void luaU_header (char* h);
/* dump one chunk; from ldump.c */
LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
#ifdef luac_c
/* print one chunk; from print.c */
LUAI_FUNC void luaU_print (const Proto* f, int full);
#endif
/* for header of binary files -- this is Lua 5.1 */
#define LUAC_VERSION 0x51
/* for header of binary files -- this is the official format */
#define LUAC_FORMAT 0
/* size of header of binary files */
#define LUAC_HEADERSIZE 12
#endif

View file

@ -1,36 +0,0 @@
/*
** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
#ifndef lvm_h
#define lvm_h
#include "external/lua/ldo.h"
#include "external/lua/lobject.h"
#include "external/lua/ltm.h"
#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
#define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \
(((o) = luaV_tonumber(o,n)) != NULL))
#define equalobj(L,o1,o2) \
(ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))
LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);
LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2);
LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n);
LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj);
LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key,
StkId val);
LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key,
StkId val);
LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls);
LUAI_FUNC void luaV_concat (lua_State *L, int total, int last);
#endif

View file

@ -1,67 +0,0 @@
/*
** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $
** Buffered streams
** See Copyright Notice in lua.h
*/
#ifndef lzio_h
#define lzio_h
#include "external/lua/lua.h"
#include "external/lua/lmem.h"
#define EOZ (-1) /* end of stream */
typedef struct Zio ZIO;
#define char2int(c) cast(int, cast(unsigned char, (c)))
#define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z))
typedef struct Mbuffer {
char *buffer;
size_t n;
size_t buffsize;
} Mbuffer;
#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)
#define luaZ_buffer(buff) ((buff)->buffer)
#define luaZ_sizebuffer(buff) ((buff)->buffsize)
#define luaZ_bufflen(buff) ((buff)->n)
#define luaZ_resetbuffer(buff) ((buff)->n = 0)
#define luaZ_resizebuffer(L, buff, size) \
(luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \
(buff)->buffsize = size)
#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n);
LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,
void *data);
LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */
LUAI_FUNC int luaZ_lookahead (ZIO *z);
/* --------- Private Part ------------------ */
struct Zio {
size_t n; /* bytes still unread */
const char *p; /* current position in buffer */
lua_Reader reader;
void* data; /* additional data */
lua_State *L; /* Lua state (for reader) */
};
LUAI_FUNC int luaZ_fill (ZIO *z);
#endif

View file

@ -5,67 +5,91 @@
// Types (include all files to expose them in the disassembler)
// external types (c-ified)
#include "external/d3d9/d3d9.h"
#include "external/lua/lua.h"
#include "async/object.h"
#include "async/queue.h"
#include "external/d3d9/d3d9.h"
#include "bc/main.h"
#include "lua/debug.h"
#include "lua/object.h"
#include "lua/state.h"
#include "lua/types.h"
#include "bc/file/fileinfo.h"
#include "bc/file/filesystem.h"
#include "bc/file/infomask.h"
#include "bc/file/inode.h"
#include "bc/file/mode.h"
#include "bc/file/processdir.h"
#include "bc/file/removedirectory.h"
#include "bc/file/stream.h"
#include "bc/file/streaminginfo.h"
#include "bc/lock/do_once.h"
#include "bc/os/file.h"
#include "bc/os/file_data.h"
#include "bc/storage/storageunit.h"
#include "bc/storage/storageunithandle.h"
#include "bc/stringconversion/codepagetoutf8.h"
#include "bc/stringconversion/passthrough.h"
#include "bc/stringconversion/utf16toutf8.h"
#include "bc/systemfile/stacked/filefunc.h"
#include "bc/systemfile/stacked/fileparms.h"
#include "bc/time/timeconst.h"
#include "bc/time/types.h"
#include "bc/util/buffer.h"
#include "bc/util/offset.h"
#include "camera/camera.h"
#include "cmd/option.h"
#include "common/array.h"
#include "common/handle.h"
#include "common/instance.h"
#include "common/datarecycler.h"
#include "common/datastore.h"
#include "common/status.h"
#include "common/refcount.h"
#include "common/handle.h"
#include "common/instance.h"
#include "common/rcstring.h"
#include "common/refcount.h"
#include "common/status.h"
#include "console/hardware.h"
#include "console/default_settings.h"
#include "console/command.h"
#include "console/default_settings.h"
#include "console/hardware.h"
#include "console/line.h"
#include "console/var.h"
#include "console/types.h"
#include "console/var.h"
#include "cursor/types.h"
#include "event/types.h"
#include "event/context.h"
#include "event/handler.h"
#include "event/id_table.h"
#include "event/keydown.h"
#include "event/message.h"
#include "event/timer.h"
#include "event/thread.h"
#include "event/timer.h"
#include "event/types.h"
#include "framescript/object.h"
#include "framescript/event_object.h"
#include "framescript/object.h"
#include "gx/batch.h"
#include "gx/blit.h"
#include "gx/buffer.h"
#include "gx/caps.h"
#include "gx/d3d9.h"
#include "gx/device.h"
#include "gx/format.h"
#include "gx/light.h"
#include "gx/matrix_stack.h"
#include "gx/monitor_mode.h"
#include "gx/opengl.h"
#include "gx/query.h"
#include "gx/shader.h"
#include "gx/state_bom.h"
#include "gx/string.h"
#include "gx/stringbatch.h"
#include "gx/texture.h"
#include "gx/types.h"
#include "gx/batch.h"
#include "gx/d3d9.h"
#include "gx/query.h"
#include "m2/cache.h"
#include "m2/data.h"
@ -78,32 +102,34 @@
#include "m2/shared.h"
#include "m2/types.h"
#include "map/CMapBaseObj.h"
#include "map/ADTchunks.h"
#include "map/CMapArea.h"
#include "map/WMOchunks.h"
#include "map/CMapObj.h"
#include "map/CChunkLiquid.h"
#include "map/CDetailDoodadInst.h"
#include "map/CMapRenderChunk.h"
#include "map/CMapObjDef.h"
#include "map/CMapStaticEntity.h"
#include "map/CMapDoodadDef.h"
#include "map/CMapEntity.h"
#include "map/CMapBaseObjLink.h"
#include "map/Weather.h"
#include "map/Particulate.h"
#include "map/CChunkGeomFactory.h"
#include "map/CMapChunkBuf.h"
#include "map/adt_chunks.h"
#include "map/chunkgeomfactory.h"
#include "map/chunkliquid.h"
#include "map/detaildoodad.h"
#include "map/liquidparticle.h"
#include "map/maparea.h"
#include "map/mapbaseobj.h"
#include "map/mapchunk.h"
#include "map/mapchunkbuf.h"
#include "map/mapdoodaddef.h"
#include "map/mapentity.h"
#include "map/mapobj.h"
#include "map/mapobjdef.h"
#include "map/maprenderchunk.h"
#include "map/mapstaticentity.h"
#include "map/particulate.h"
#include "map/vbb_list.h"
#include "map/weather.h"
#include "map/wmo_chunks.h"
#include "character/CCharacterComponent.h"
#include "character/component.h"
#include "net/message.h"
#include "nvapi/nvapi.h"
#include "object/object.h"
#include "object/CMovementData.h"
#include "object/object.h"
#include "os/processorfeatures.h"
#include "os/timemanager.h"
@ -113,13 +139,13 @@
#include "storm/array.h"
#include "storm/big.h"
#include "storm/cmd.h"
#include "storm/list.h"
#include "storm/hash.h"
#include "storm/list.h"
#include "storm/log.h"
#include "storm/options.h"
#include "storm/queue.h"
#include "storm/region.h"
#include "storm/thread.h"
#include "storm/log.h"
#include "storm/options.h"
#include "tempest/box.h"
#include "tempest/matrix.h"
@ -151,14 +177,13 @@
// include files that define the use of template classes for standard library types
// template classes for whoa types should be entered immediately after where the type is
#include "storm/array/pointer_to_void.h"
#include "storm/array/uint8_t.h"
#include "storm/array/uint32_t.h"
#include "storm/array/float.h"
#include "storm/array/c2ivector.h"
#include "storm/array/float.h"
#include "storm/array/pointer_to_void.h"
#include "storm/array/uint32_t.h"
#include "storm/array/uint8_t.h"
#include "storm/queue/timer_priority_uint32_t.h"
// template types that are defined in our headers, should be declared immediately after the base type
// and not used anywhere else
// template types that are defined in our headers, should be declared immediately after the base
// type and not used anywhere else

View file

@ -1,183 +0,0 @@
#ifndef ADTCHUNKS_H
#define ADTCHUNKS_H
DECLARE_STRUCT(SMMapHeader);
DECLARE_STRUCT(SMChunkInfo);
DECLARE_STRUCT(SMDoodadDef);
DECLARE_STRUCT(SMMapObjDef);
DECLARE_STRUCT(SMChunk);
DECLARE_STRUCT(SLVert);
DECLARE_STRUCT(SMLayer);
DECLARE_STRUCT(SLTiles);
DECLARE_STRUCT(SWFlowv);
DECLARE_STRUCT(SOVert);
DECLARE_STRUCT(SMVert);
DECLARE_STRUCT(SWVert);
DECLARE_STRUCT(SMLiquidChunk);
DECLARE_STRUCT(CWSoundEmitter);
#include "tempest/vector.h"
#include "tempest/box.h"
#include "tempest/sphere.h"
struct SMMapHeader
{
uint32_t flags;
uint32_t mcin; // MCIN*, Cata+: obviously gone. probably all offsets gone, except mh2o(which remains in root file).
uint32_t mtex; // MTEX*
uint32_t mmdx; // MMDX*
uint32_t mmid; // MMID*
uint32_t mwmo; // MWMO*
uint32_t mwid; // MWID*
uint32_t mddf; // MDDF*
uint32_t modf; // MODF*
uint32_t mfbo; // MFBO* this is only set if flags & mhdr_MFBO.
uint32_t mh2o; // MH2O*
uint32_t mtxf; // MTXF*
uint8_t mamp_value; // Cata+, explicit MAMP chunk overrides data
uint8_t padding[3];
uint32_t unused[3];
};
struct SMChunkInfo
{
uint32_t offset; // absolute offset.
uint32_t size; // the size of the MCNK chunk, this is refering to.
uint32_t flags; // always 0. only set in the client., FLAG_LOADED = 1
union
{
char pad[4];
uint32_t asyncId; // not in the adt file. client use only
};
};
struct SMDoodadDef
{
uint32_t nameId; // references an entry in the MMID chunk, specifying the model t // if flag mddf_entry_is_filedata_id is set, a file data id instead, ignoring MMID.
uint32_t uniqueId; // this ID should be unique for all ADTs currently loaded. Best, they are unique for the whole map. Blizzar // these unique for the whole game.
C3Vector position; // This is relative to a corner of the map. Subtract 17066 from the non vertical values and you should start t // something that makes sense. You'll then likely have to negate one of the non vertical values in wha // coordinate system you're using to finally move it into place.
C3Vector rotation; // degrees. This is not the same coordinate system orientation like the ADT itself! (see history.)
uint16_t scale; // 1024 is the default size equaling 1.0f.
uint16_t flags; // values from enum MDDFFlags.
};
struct SMMapObjDef
{
uint32_t nameId; // references an entry in the MWID chunk, specifying the model to use.
uint32_t uniqueId; // this ID should be unique for all ADTs currently loaded. Best, they are unique for the whole map.
C3Vector position;
C3Vector rotation; // same as in MDDF.
CAaBox extents; // position plus the transformed wmo bounding box. used for defining if they are rendered as well as collision.
uint16_t flags; // values from enum MODFFlags.
uint16_t doodadSet; // which WMO doodad set is used. Traditionally references WMO#MODS_chunk, if modf_use_sets_from_mwds is set, references #MWDR_.28Shadowlands.2B.29
uint16_t nameSet; // which WMO name set is used. Used for renaming goldshire inn to northshire inn while using the same model.
uint16_t scale; // Legion+: scale, 1024 means 1 (same as MDDF). Padding in 0.5.3 alpha.
};
struct SMChunk
{
uint32_t flags;
C2iVector index;
uint32_t nLayers;
uint32_t nDoodadRefs;
uint32_t ofsHeight;
uint32_t ofsNormal;
uint32_t ofsLayer;
uint32_t ofsRefs;
uint32_t ofsAlpha;
uint32_t sizeAlpha;
uint32_t ofsShadow;
uint32_t sizeShadow;
uint32_t areaid;
uint32_t nMapObjRefs;
uint32_t holes;
uint8_t low_quality_texture_map[0x10];
uint32_t predTex;
uint32_t nEffectDoodad;
uint32_t ofsSndEmitters;
uint32_t nSndEmitters;
uint32_t ofsLiquid;
uint32_t sizeLiquid;
C3Vector position;
uint32_t ofsMCCV;
uint32_t unused1;
uint32_t unused2;
};
struct SMLayer
{
uint32_t textureId;
uint32_t flags;
uint32_t offsetInMCAL;
uint32_t offectId;
};
struct SWVert
{
char depth;
char flow0Pct;
char flow1Pct;
char filler;
float height;
};
struct SOVert
{
char depth;
char foam;
char wet;
char filler;
};
struct SMVert
{
uint16_t s;
uint16_t t;
float height;
};
struct SLVert
{
union
{
SWVert waterVert;
SOVert oceanVert;
SMVert magmaVert;
};
};
struct SLTiles
{
char tiles[8][8];
};
struct SWFlowv
{
CAaSphere sphere;
C3Vector dir;
float velocity;
float amplitude;
float frequency;
};
struct SMLiquidChunk
{
float minHeight;
float maxHeight;
SLVert verts[9*9];
SLTiles tiles;
uint32_t nFlowvs;
SWFlowv flowvs[2];
};
struct CWSoundEmitter
{
uint32_t entry_id;
C3Vector position;
C3Vector size;
};
#endif

View file

@ -1,31 +0,0 @@
#ifndef CCHUNKGEOMFACTORY_H
#define CCHUNKGEOMFACTORY_H
DECLARE_STRUCT(CChunkGeomFactory);
#include "system/types.h"
#include "tempest/matrix.h"
#include "map/CChunkLiquid.h"
#include "map/CMapChunkBuf.h"
struct CChunkGeomFactory
{
void** vtable;
uint32_t unk_04;
uint32_t unk_08;
uint32_t unk_0C;
uint32_t unk_10;
CChunkLiquid* liquidChunk;
uint32_t unk_18;
CMapChunkBuf* mapChunkBuf;
uint32_t unk_20;
uint32_t unk_24;
uint32_t unk_28;
uint16_t unk_flags_2C;
uint16_t unk_flags_2E;
uint32_t unk_30;
C44Matrix matrix;
};
#endif

View file

@ -1,39 +0,0 @@
#ifndef CCHUNKLIQUID_H
#define CCHUNKLIQUID_H
DECLARE_STRUCT(CChunkLiquid);
struct CMapChunk;
#include "tempest/vector.h"
struct CChunkLiquid
{
int32_t objectIndex;
int32_t unk_004;
int32_t unk_008;
C3Vector topLeftCoords;
C3Vector center;
float radius;
C2Vector height;
float resPurgeTimer;
C2iVector tileBegin;
C2iVector tileEnd;
int32_t unk_044;
int32_t unk_048;
int32_t unk_04C;
int32_t unk_050;
uint8_t* tiles;
uint8_t* liquidInstPtr;
CMapChunk* owner;
CChunkLiquid* prev;
CChunkLiquid* next;
int32_t unk_068;
int32_t unk_06C;
int32_t unk_070;
int32_t unk_074;
C3Vector verts[81];
};
#endif

View file

@ -1,50 +0,0 @@
#ifndef CDETAILDOODADINST_H
#define CDETAILDOODADINST_H
DECLARE_STRUCT(CDetailDoodadGeomVertex);
DECLARE_STRUCT(CDetailDoodadGeom);
DECLARE_STRUCT(CDetailDoodadInst);
#include "system/types.h"
#include "texture/texture.h"
#include "tempest/vector.h"
#include "storm/array.h"
struct CMapChunk;
struct CDetailDoodadGeomVertex
{
uint16_t unk_00;
uint16_t unk_02;
uint32_t unk_04;
C3Vector pos;
float angle;
float scale;
C3Vector unkVec;
uint32_t color;
};
STORM_TS_GROWABLE_ARRAY(CDetailDoodadGeomVertex);
struct CDetailDoodadGeom
{
CTexture* texture;
int32_t unkVertexCount;
int32_t unkIndexCount;
void* unkVertBufStream;
void* unkIdxBufStream;
TSGrowableArray_CDetailDoodadGeomVertex data;
};
struct CDetailDoodadInst
{
int32_t objectIndex;
CDetailDoodadGeom geom[4];
int32_t unkCounter;
CMapChunk* mapChunkOwner;
int32_t unk_09C;
int32_t unk_0A0;
};
#endif

View file

@ -1,212 +0,0 @@
#ifndef CMAPAREA_H
#define CMAPAREA_H
DECLARE_STRUCT(CMapArea);
DECLARE_STRUCT(CMapChunk);
DECLARE_STRUCT(CMapAreaTexture);
struct CMapAreaTexture
{
char* textureName;
CTexture* texture;
};
struct CMapChunk;
#include "async/object.h"
#include "map/ADTchunks.h"
#include "storm/array.h"
#include "texture/texture.h"
#include "map/CMapBaseObj.h"
#include "map/CMapBaseObjLink.h"
#include "map/CMapDoodadDef.h"
#include "map/CMapObjDef.h"
STORM_TS_GROWABLE_ARRAY(CMapAreaTexture);
typedef struct CMapAreaLink CMapAreaLink;
STORM_TS_LIST(CMapAreaLink);
struct CMapAreaLink
{
uint32_t objectIndex; //0x00
CMapArea* owner; //0x04
void* ref; //0x08
TSLink_CMapAreaLink refLink; //0x0C - 0x14
TSLink_CMapAreaLink ownerLink; //0x14 - 0x1C
};
typedef struct CMapAreaChunkLink CMapAreaChunkLink;
STORM_TS_LIST(CMapAreaChunkLink);
struct CMapAreaChunkLink
{
uint32_t objectIndex; //0x00
CMapChunk* owner; //0x04
CMapArea* ref; //0x08
TSLink_CMapAreaChunkLink refLink; //0x0C - 0x14
TSLink_CMapAreaChunkLink ownerLink; //0x14 - 0x1C
};
struct CMapArea
{
void** vtable;
uint32_t objectIndex;
uint16_t type;
uint16_t refCount;
uint32_t unk_0C;
CMapArea* perv;
CMapArea* next;
TSExplicitList_CMapAreaLink linkList;
C3Vector bottomRight;
C3Vector topLeft;
C3Vector topLeft2;
C2iVector index;
C2iVector tileChunkIndex;
TSGrowableArray_CMapAreaTexture textures;
SMMapHeader* header;
int32_t unk_6C;
CAsyncObject* asyncObject;
TSExplicitList_CMapAreaChunkLink chunkLinkList;
void* filePtr;
int32_t fileSize;
SMChunkInfo* chunkInfo;
int32_t unk_8C;
SMDoodadDef* doodadDef;
SMMapObjDef* mapObjDef;
int32_t doodadDefCount;
int32_t mapObjDefCount;
char* m2FileNames;
char* wmoFileNames;
uint32_t* modelFilenamesOffsets;
uint32_t* wmoFilenamesOffsets;
int16_t* flyingBbox;
int32_t* textureFlags;
uint8_t* unk_B8; //MH20
CMapChunk* mapChunks[256];
};
typedef struct CMapChunkLink CMapChunkLink;
STORM_TS_LIST(CMapChunkLink);
struct CMapChunkLink
{
uint32_t objectIndex; //0x00
CMapChunk* owner; //0x04
CMapArea* ref; //0x08
TSLink_CMapChunkLink refLink; //0x0C - 0x14
TSLink_CMapChunkLink ownerLink; //0x14 - 0x1C
};
typedef struct CMapChunkDoodadDefLink CMapChunkDoodadDefLink;
STORM_TS_LIST(CMapChunkDoodadDefLink);
struct CMapChunkDoodadDefLink
{
uint32_t objectIndex; //0x00
CMapDoodadDef* owner; //0x04
CMapChunk* ref; //0x08
TSLink_CMapChunkDoodadDefLink refLink; //0x0C - 0x14
TSLink_CMapChunkDoodadDefLink ownerLink; //0x14 - 0x1C
};
typedef struct CMapChunkMapObjDefLink CMapChunkMapObjDefLink;
STORM_TS_LIST(CMapChunkMapObjDefLink);
struct CMapChunkMapObjDefLink
{
uint32_t objectIndex; //0x00
CMapObjDef* owner; //0x04
CMapChunk* ref; //0x08
TSLink_CMapChunkMapObjDefLink refLink; //0x0C - 0x14
TSLink_CMapChunkMapObjDefLink ownerLink; //0x14 - 0x1C
};
typedef struct CChunkLiquid CChunkLiquid;
STORM_TS_LIST(CChunkLiquid);
struct CMapChunk
{
void** vtable;
uint32_t objectIndex;
uint16_t type;
uint16_t refCount;
uint32_t unk_0C;
CMapChunk* prev;
CMapChunk* next;
TSExplicitList_CMapChunkLink linkList;
C2iVector aIndex;
C2iVector sOffset;
C2iVector cOffset;
C3Vector center;
float radius;
CAaBox bbox;
C3Vector bottomRight;
C3Vector topLeft;
C3Vector topLeftCoords;
float distToCamera;
CAaBox bbox2;
void* detailDoodadInst;
void* renderChunk;
int32_t unk_AC;
int32_t areaId;
int32_t unk_B4;
int32_t unk_B8;
int32_t unk_BC;
int32_t unk_C0;
TSExplicitList_CMapChunkDoodadDefLink doodadDefLinkList;
TSExplicitList_CMapChunkMapObjDefLink mapObjDefLinkList;
int32_t TSExplicitList__m_linkoffset_DC;
void* TSExplicitList__ptr_E0;
void* TSExplicitList__ptr2_E4;
// Light
int32_t TSExplicitList__m_linkoffset_E8;
void* TSExplicitList__ptr_EC;
void* TSExplicitList__ptr2_F0;
// CMapSoundEmitter
int32_t TSExplicitList__m_linkoffset_F4;
void* TSExplicitList__ptr_F8;
void* TSExplicitList__ptr2_FC;
// CChunkLiquid
TSExplicitList_CChunkLiquid liquidChunkLinkList;
uint8_t* chunkInfoBeginPtr;
SMChunk* header;
uint8_t* lowQualityTexMap;
uint8_t* predTexture;
float* vertices;
uint32_t* vertexShading;
int8_t* normals;
uint8_t* shadowMap;
SMLayer* layers;
uint8_t* additionalShadowmap;
uint8_t* MCRF_ptr;
SMLiquidChunk* liquid;
CWSoundEmitter* soundEmitters;
// liquid related fields
int32_t unk_140;
int32_t unk_144;
int32_t unk_148;
int32_t unk_14C;
int32_t unk_150;
int32_t unk_154;
};
#endif

View file

@ -1,23 +0,0 @@
#ifndef CMAPBASEOBJ_H
#define CMAPBASEOBJ_H
DECLARE_STRUCT(CMapBaseObj);
#include "system/types.h"
#include "map/CMapBaseObjLink.h"
struct CMapBaseObj
{
void** vtable; //0x00
int32_t objectIndex; //0x04
uint16_t type; //0x08
uint16_t refCount; //0x0A
int32_t unk_C; //0x0C
CMapBaseObj* prev; //0x10
CMapBaseObj* next; //0x14
TSExplicitList_CMapBaseObjLink list; //0x18 - 0x24
};
#endif

View file

@ -1,24 +0,0 @@
#ifndef CMAPBASEOBJLINK_H
#define CMAPBASEOBJLINK_H
DECLARE_STRUCT(CMapBaseObjLink);
#include "system/types.h"
#include "storm/list.h"
STORM_TS_LIST(CMapBaseObjLink);
struct CMapBaseObj;
struct CMapBaseObjLink
{
uint32_t objectIndex; //0x00
CMapBaseObj* owner; //0x04
CMapBaseObj* ref; //0x08
TSLink_CMapBaseObjLink refLink; //0x0C - 0x14
TSLink_CMapBaseObjLink ownerLink; //0x14 - 0x1C
};
#endif

View file

@ -1,25 +0,0 @@
#ifndef CMAPCHUNKBUF_H
#define CMAPCHUNKBUF_H
DECLARE_STRUCT(CMapChunkBuf);
#include "system/types.h"
#include "gx/buffer.h"
struct CMapChunkBuf
{
uint32_t unk_00;
float flushTimer;
uint32_t vertexDataSize;
uint32_t indexDataSize;
CGxBuf* vertexBuf;
CGxBuf* indexBuf;
CGxPool* vertexPool;
CGxPool* indexPool;
uint32_t unk_20;
uint32_t unk_24;
};
#endif

View file

@ -1,80 +0,0 @@
#ifndef CMAPDOODADDEF_H
#define CMAPDOODADDEF_H
DECLARE_STRUCT(CMapDoodadDef);
#include "tempest/box.h"
#include "tempest/matrix.h"
#include "tempest/vector.h"
#include "tempest/sphere.h"
#include "m2/model.h"
#include "storm/list.h"
#include "map/CMapArea.h"
typedef struct CMapDoodadDefMapChunkLink CMapDoodadDefMapChunkLink;
STORM_TS_LIST(CMapDoodadDefMapChunkLink);
struct CMapDoodadDefMapChunkLink
{
uint32_t objectIndex; //0x00
CMapDoodadDef* owner; //0x04
CMapBaseObj* ref; //0x08 //could be CMapChunk* or CMapObjDefGroup*
TSLink_CMapDoodadDefMapChunkLink refLink; //0x0C - 0x14
TSLink_CMapDoodadDefMapChunkLink ownerLink; //0x14 - 0x1C
};
struct CMapDoodadDef
{
void** vtable; //0x00
int32_t objectIndex; //0x04
uint16_t type; //0x08
uint16_t refCount; //0x0A
int32_t unk_C; //0x0C
CMapDoodadDef* prev; //0x10
CMapDoodadDef* next; //0x14
TSExplicitList_CMapDoodadDefMapChunkLink linkList;
//CMapStaticEntity fields
int32_t unk_024; //0x24
uint32_t unkFlags_28; //0x28
int32_t unkCounter; //0x2C
float unk_030; //0x30
CM2Model* model;
CAaSphere sphere;
CAaBox bboxStaticEntity;
C3Vector vec2;
C3Vector position;
float scale; //0x78
int32_t unk_07C; //0x7C
int32_t unk_080; //0x80
CImVector m2AmbietColor; //0x84
CImVector m2DiffuseColor; //0x88
float unk_08C; //0x8C
//end
//CMapDoodadDef fields
uint32_t unkFlags_090; //0x90
void* unk_094; //0x94
void* unk_098; //0x98
void* prevMapDoodadDef_09C; //0x9C
void* nextMapDoodadDef_0A0; //0xA0
int32_t unk_0A4; //0xA4
int32_t unk_0A8; //0xA8
int32_t unk_0AC; //0xAC
int32_t unk_0B0; //0xB0
int32_t unk_0B4; //0xB4
int32_t unk_0B8; //0xB8
int32_t unk_0BC; //0xBC
CAaBox bboxDoodadDef;
C44Matrix mat;
C44Matrix identity;
int32_t unk_158; //0x158 sound
int32_t unk_15C; //0x15C
int32_t unk_160; //0x160
int32_t unk_164; //0x164
int32_t unk_168; //0x168
int32_t unk_16C; //0x16C
//end
};
#endif

View file

@ -1,77 +0,0 @@
#ifndef CMAPENTITY_H
#define CMAPENTITY_H
DECLARE_STRUCT(CMapEntity);
#include "system/types.h"
#include "tempest/vector.h"
#include "tempest/box.h"
#include "tempest/sphere.h"
#include "m2/model.h"
#include "storm/list.h"
#include "map/CMapBaseObj.h"
typedef struct CMapEntityMapChunkLink CMapEntityMapChunkLink;
STORM_TS_LIST(CMapEntityMapChunkLink);
struct CMapEntityMapChunkLink
{
uint32_t objectIndex; //0x00
CMapEntity* owner; //0x04
void* ref; //0x08 //could be CMapChunk* or CMapObjDefGroup*
TSLink_CMapEntityMapChunkLink refLink; //0x0C - 0x14
TSLink_CMapEntityMapChunkLink ownerLink; //0x14 - 0x1C
};
struct CMapEntity
{
//CMapBaseObj fields
void** vtable; //0x00
int32_t objectIndex; //0x04
uint16_t type; //0x08
uint16_t refCount; //0x0A
int32_t unk_C; //0x0C
CMapEntity* prev; //0x10
CMapEntity* next; //0x14
TSExplicitList_CMapEntityMapChunkLink linkList;
//end
//CMapStaticEntity fields
int32_t unk_024; //0x24
uint32_t unkFlags_28; //0x28
int32_t unkCounter; //0x2C
float unk_030; //0x30
CM2Model* model;
CAaSphere sphere;
CAaBox bboxStaticEntity;
C3Vector vec2;
C3Vector position;
float scale; //0x78
int32_t unk_07C; //0x7C
int32_t unk_080; //0x80
CImVector m2AmbietColor; //0x84
CImVector m2DiffuseColor; //0x88
float unk_08C; //0x8C
//end
//CMapEntity fields
int32_t unk_090; //0x90
int32_t unk_094; //0x94
uint64_t guid; //0x98
int32_t unk_0A0; //0xA0
int32_t unk_0A4; //0xA4
int32_t unk_0A8; //0xA8
int32_t unk_0AC; //0xAC
int32_t unk_0B0; //0xB0
int32_t unk_0B4; //0xB4
int32_t unk_0B8; //0xB8
int32_t unk_0BC; //0xBC
CImVector ambientTarget;
float dirLightScaleTarget;
int32_t unk_0C8; //0xC8
int32_t unk_0CC; //0xCC
//end
};
#endif

View file

@ -1,182 +0,0 @@
#ifndef CMAPOBJ_H
#define CMAPOBJ_H
#include "tempest/box.h"
#include "async/object.h"
#include "map/WMOchunks.h"
#include "tempest/vector.h"
#include "storm/list.h"
#include "map/VBBList.h"
DECLARE_STRUCT(CMapObj);
DECLARE_STRUCT(CMapObjGroup);
STORM_TS_LIST(CMapObjGroup);
struct CMapObjGroup;
struct CMapObj
{
int32_t objectIndex;
int32_t unk_04;
int32_t unk_08;
CMapObj* mapObjPtr1;
int32_t unk_10;
CMapObj* mapObjPtr2;
int32_t unk_18;
char m_wmoName[260];
SMOHeader *header;
char* textureNameList;
char* groupNameList;
char* skybox;
SMOGroupInfo* groupInfo;
C3Vector* portalVertexList;
SMOPortal* portalList;
SMOPortalRef* portalRefList;
C3Vector* visBlockVertList;
SMOVisibleBlock* visBlockList;
SMOLight* lightList;
SMODoodadSet* doodadSetList;
char* doodadNameList;
SMODoodadDef* doodadDefList;
SMOFog* fogList;
C4Plane* convexVolumePlanes;
SMOMaterial* materialList;
int32_t texturesSize;
int32_t groupNameSize;
int32_t groupInfoCount;
int32_t planeVertCount;
int32_t portalsCount;
int32_t portalRefCount;
int32_t visBlockVertCount;
int32_t visBlockCount;
int32_t ligtsCount;
int32_t doodadSetCount;
int32_t doodadNameSize;
int32_t doodadDefCount;
int32_t fogsCount;
int32_t convexVolumePlaneCount;
int32_t materialsCount;
uint32_t argb_color;
int32_t unk_1A4;
CAaBox bbox;
float distToCamera;
int32_t unk_1C4;
int32_t unk_1C8;
void* pWmoData;
int32_t wmoFileSize;
int32_t refCount;
float flushTimer;
CAsyncObject* asyncObject;
int32_t isGroupLoaded;
int32_t unk_1E4;
TSExplicitList_CMapObjGroup mapObjGroupList;
int32_t mapObjGroupCount;
CMapObjGroup* mapObjGroupArray[512];
};
struct CMapObjGroup
{
int32_t objectIndex;
VBBList_Block* vertsBlock;
VBBList_Block* transparencyVertsBlock;
VBBList_Block* indicesBlock;
VBBList_Block* liquidVertsBlock;
VBBList_Block* liquidIndicesBlock;
float timer;
void* unk_1C;
int32_t unk_20;
int32_t unk_24;
int32_t unk_28;
int16_t unk_2C[2];
int32_t flags;
CAaBox bbox;
float distToCamera;
int32_t portalStart;
int32_t portalCount;
int32_t fogs;
uint16_t transparencyBatchesCount;
uint16_t intBatchCount;
int32_t extBatchCount;
void* CAaBspNodePtr1;
void* CAaBspNodePtr2;
uint16_t* nodeFaceIndices;
int32_t bspNodesCount;
int32_t nodeFaceIndicesCount;
int32_t unk_7C;
int32_t unk_80;
int32_t unk_84;
int32_t unk_88;
int32_t unk_8C;
int32_t unk_90;
int32_t unk_94;
int32_t unk_98;
int32_t unk_9C;
int32_t unk_A0;
int32_t unk_A4;
int32_t unk_A8;
int32_t unk_AC;
int32_t unk_B0;
CAaBox bbox2;
int32_t unk_CC;
int32_t unkFlags;
int32_t unk_D4;
int32_t minimapTag;
char* groupName;
SMOPoly* polyList;
uint16_t* indices;
int32_t unk_E8;
C3Vector* vertexList;
C3Vector* normalList;
C2Vector* textureVertexList;
int32_t unk_F8;
SMOBatch* batchList;
int32_t unk_100;
int32_t unk_104;
uint16_t* doodadRefList;
CImVector* colorVertexList;
CImVector* colorVertexListExtra;
int32_t unk_114;
C2iVector liquidVerts;
C2iVector liquidTiles;
C3Vector liquidCorner;
int32_t luquidMaterialId;
SMOLiquidVert* liquidVertexList;
SMOLTile* liquidTileList;
float liquidHeight;
int32_t unk_144;
int32_t unk_148;
int32_t unkFlag;
int32_t unk_150;
int32_t polyListSize;
int32_t indicesCount;
int32_t unk_15C;
int32_t vertexListCount;
int32_t normalListCount;
int32_t textureVertexListCount;
int32_t unk_16C;
int32_t batchListCount;
int32_t unk_174;
int32_t doodadRefListCount;
int32_t colorVertexListSize;
int32_t colorVertexListExtraSize;
int32_t wmoGroupId;
void* filePtr;
int32_t fileSize;
CMapObj* parent;
int32_t unk_194;
CAsyncObject* asyncObjPtr;
int32_t unkLoadedFlag;
int32_t unkIndexMin1;
int32_t unkIndexMax1;
uint16_t unkIndexMin2;
uint16_t unkIndexMax2;
int32_t TSExplicitList__m_linkoffset;
void* TSExplicitList__ptr;
void* TSExplicitList__ptr2;
CMapObjGroup* perv;
CMapObjGroup* next;
};
#endif

View file

@ -1,178 +0,0 @@
#ifndef CMAPOBJDEF_H
#define CMAPOBJDEF_H
DECLARE_STRUCT(CMapObjDef);
DECLARE_STRUCT(CMapObjDefGroup);
#include "tempest/box.h"
#include "tempest/sphere.h"
#include "tempest/matrix.h"
#include "tempest/vector.h"
#include "storm/array.h"
#include "storm/list.h"
#include "map/CMapDoodadDef.h"
#include "map/CMapArea.h"
#include "map/CMapObj.h"
#include "map/CMapEntity.h"
STORM_TS_GROWABLE_ARRAY(CMapObjDefGroup);
struct CMapChunk;
typedef struct CMapObjDefMapChunkLink CMapObjDefMapChunkLink;
STORM_TS_LIST(CMapObjDefMapChunkLink);
struct CMapObjDefMapChunkLink
{
uint32_t objectIndex; //0x00
CMapObjDef* owner; //0x04
CMapChunk* ref; //0x08
TSLink_CMapObjDefMapChunkLink refLink; //0x0C - 0x14
TSLink_CMapObjDefMapChunkLink ownerLink; //0x14 - 0x1C
};
typedef struct CMapObjDefMapObjDefGroupLink CMapObjDefMapObjDefGroupLink;
STORM_TS_LIST(CMapObjDefMapObjDefGroupLink);
struct CMapObjDefMapObjDefGroupLink
{
uint32_t objectIndex; //0x00
CMapObjDefGroup* owner; //0x04
CMapObjDef* ref; //0x08
TSLink_CMapObjDefMapObjDefGroupLink refLink; //0x0C - 0x14
TSLink_CMapObjDefMapObjDefGroupLink ownerLink; //0x14 - 0x1C
};
struct CMapObjDef
{
void** vtable; //0x00
int32_t objectIndex; //0x04
uint16_t type; //0x08
uint16_t refCount; //0x0A
int32_t unk_C; //0x0C
CMapObjDef* prev; //0x10
CMapObjDef* next; //0x14
TSExplicitList_CMapObjDefMapChunkLink linkList;
void* unk_24; //0x24
void* unk_28; //0x28
void* unk_2C; //0x2C
void* unk_30; //0x30
void* unk_34; //0x34
int32_t unk_38; //0x38
C3Vector position;
CAaBox bbox;
CAaSphere sphere;
C44Matrix mat;
C44Matrix invMat;
int32_t unk_F0; //0xF0
CMapObj* owner; //0xF4
int32_t unk_F8; //0xF8
uint32_t unkFlags; //0xFC
int32_t unk_100; //0x100
int32_t unk_104; //0x104
int32_t unk_108; //0x108
int32_t unk_10C; //0x10C
int32_t unk_110; //0x110
TSExplicitList_CMapObjDefMapObjDefGroupLink mapObjDefGroupLinkList;
TSGrowableArray_CMapObjDefGroup defGroups;
void* unk_130; //0x130
int32_t TSGrowableArray__m_alloc; //0x134
int32_t TSGrowableArray__m_count; //0x138
void* TSGrowableArray__m_data; //0x13C
int32_t TSGrowableArray__m_chunk; //0x140
uint32_t argbColor; //0x144
int32_t unk_148; //0x148
int32_t unk_14C; //0x14C
int32_t unk_150; //0x150
void* unk_154; //0x154
};
typedef struct CMapObjDefGroupMapObjDefLink CMapObjDefGroupMapObjDefLink;
STORM_TS_LIST(CMapObjDefGroupMapObjDefLink);
struct CMapObjDefGroupMapObjDefLink
{
uint32_t objectIndex; //0x00
CMapObjDefGroup* owner; //0x04
CMapObjDef* ref; //0x08
TSLink_CMapObjDefGroupMapObjDefLink refLink; //0x0C - 0x14
TSLink_CMapObjDefGroupMapObjDefLink ownerLink; //0x14 - 0x1C
};
typedef struct CMapObjDefGroupDoodadDefLink CMapObjDefGroupDoodadDefLink;
STORM_TS_LIST(CMapObjDefGroupDoodadDefLink);
struct CMapObjDefGroupDoodadDefLink
{
uint32_t objectIndex; //0x00
CMapDoodadDef* owner; //0x04
CMapObjDef* ref; //0x08
TSLink_CMapObjDefGroupDoodadDefLink refLink; //0x0C - 0x14
TSLink_CMapObjDefGroupDoodadDefLink ownerLink; //0x14 - 0x1C
};
typedef struct CMapObjDefGroupMapEntityLink CMapObjDefGroupMapEntityLink;
STORM_TS_LIST(CMapObjDefGroupMapEntityLink);
struct CMapObjDefGroupMapEntityLink
{
uint32_t objectIndex; //0x00
CMapEntity* owner; //0x04
CMapObjDef* ref; //0x08
TSLink_CMapObjDefGroupMapEntityLink refLink; //0x0C - 0x14
TSLink_CMapObjDefGroupMapEntityLink ownerLink; //0x14 - 0x1C
};
struct CMapObjDefGroup
{
void* vtable; //0x00
int32_t objectIndex; //0x04
uint16_t type; //0x08
uint16_t refCount; //0x0A
int32_t unk_C; //0x0C
CMapObjDefGroup* prev; //0x10
CMapObjDefGroup* next; //0x14
TSExplicitList_CMapObjDefGroupMapObjDefLink linkList;
CAaBox bbox;
CAaSphere sphere;
float unk_4C; //0x4C
uint32_t groupNum; //0x50
uint32_t unkFlags; //0x54
int32_t unk_58; //0x58
uint32_t ambientColor; //0x5C
int32_t unk_60; //0x60
int32_t unk_64; //0x64
int32_t unk_68; //0x68
//CWFrustum
int32_t TSExplicitList__m_linkoffset_unk_6C; //0x6C
void* TSExplicitList__m_ptr1_unk_70; //0x70
void* TSExplicitList__m_ptr2_unk_74; //0x74
TSExplicitList_CMapObjDefGroupDoodadDefLink doodadDefLinkList;
TSExplicitList_CMapObjDefGroupMapEntityLink mapEntityLinkList;
int32_t TSExplicitList__m_linkoffset_unk_90; //0x90
void* TSExplicitList__m_ptr1_unk_94; //0x94
void* TSExplicitList__m_ptr2_unk_98; //0x98
int32_t TSExplicitList__m_linkoffset_unk_9C; //0x9C
void* TSExplicitList__m_ptr1_unk_A0; //0xA0
void* TSExplicitList__m_ptr2_unk_A4; //0xA4
int32_t unk_A8; //0xA8
int32_t unk_AC; //0xAC
int32_t unk_B0; //0xB0
int32_t unk_B4; //0xB4
int32_t unk_B8; //0xB8
int32_t unk_BC; //0xBC
};
#endif

View file

@ -1,57 +0,0 @@
#ifndef CMAPRENDERCHUNK_H
#define CMAPRENDERCHUNK_H
DECLARE_STRUCT(CMapRenderChunkLayer);
DECLARE_STRUCT(CMapRenderChunk);
#include "system/types.h"
#include "texture/texture.h"
#include "tempest/vector.h"
#include "gx/buffer.h"
struct CMapChunk;
struct CMapRenderChunkLayer
{
int16_t flags;
int16_t layerIndex;
CTexture* texture;
int32_t unkIndex;
int32_t unkValue;
CMapRenderChunk* owner;
};
struct CMapRenderChunk
{
CMapRenderChunk* renderChunkPtr1;
CMapRenderChunk* renderChunkPtr2;
uint8_t unkFlags;
uint8_t layersCount;
int16_t unk_0A;
int32_t unk_0C;
CMapChunk* mapChunkPtr1;
CMapChunk* mapChunkPtr2;
C3Vector vec1;
C3Vector vec2;
float radius;
CMapRenderChunkLayer layers[4];
CTexture* terrainBlendTexture;
CTexture* shadowTexture;
CGxBuf* vertexBuf;
CGxBuf* indicesBuf;
int32_t unk_94;
int32_t unk_98;
int16_t unk_9C;
int16_t unk_9E;
int32_t unk_A0;
int32_t unk_A4;
};
#endif

View file

@ -1,55 +0,0 @@
#ifndef CMAPSTATICENTITY_H
#define CMAPSTATICENTITY_H
DECLARE_STRUCT(CMapStaticEntity);
#include "system/types.h"
#include "tempest/vector.h"
#include "tempest/box.h"
#include "tempest/sphere.h"
#include "m2/model.h"
#include "storm/list.h"
#include "map/CMapBaseObj.h"
typedef struct CMapStaticEntityMapChunkLink CMapStaticEntityMapChunkLink;
STORM_TS_LIST(CMapStaticEntityMapChunkLink);
struct CMapStaticEntityMapChunkLink
{
uint32_t objectIndex; //0x00
CMapStaticEntity* owner; //0x04
void* ref; //0x08 //could be CMapChunk* or CMapObjDefGroup*
TSLink_CMapStaticEntityMapChunkLink refLink; //0x0C - 0x14
TSLink_CMapStaticEntityMapChunkLink ownerLink; //0x14 - 0x1C
};
struct CMapStaticEntity
{
void** vtable; //0x00
int32_t objectIndex; //0x04
uint16_t type; //0x08
uint16_t refCount; //0x0A
int32_t unk_C; //0x0C
CMapStaticEntity* prev; //0x10
CMapStaticEntity* next; //0x14
TSExplicitList_CMapStaticEntityMapChunkLink linkList;
int32_t unk_024; //0x24
uint32_t unkFlags_28; //0x28
int32_t unkCounter; //0x2C
float unk_030; //0x30
CM2Model* model;
CAaSphere sphere;
CAaBox bbox;
C3Vector vec2;
C3Vector position;
float scale; //0x78
int32_t unk_07C; //0x7C
int32_t unk_080; //0x80
CImVector m2AmbietColor; //0x84
CImVector m2DiffuseColor; //0x88
float unk_08C; //0x8C
};
#endif

View file

@ -1,36 +0,0 @@
#ifndef PARTICULATE_H
#define PARTICULATE_H
DECLARE_STRUCT(Particulate);
DECLARE_STRUCT(LiquidParticle);
#include "system/types.h"
#include "tempest/vector.h"
#include "texture/texture.h"
struct LiquidParticle
{
C3Vector position;
float size;
};
struct Particulate
{
LiquidParticle particles[4000];
uint32_t maxParticles;
C3Vector prevCameraPos;
CTexture* texture;
uint8_t unk_byte;
uint8_t padding[3];
float particleSize;
float spawnAreaSize;
float unk_float1;
uint32_t unkValue; //liquid type of particle type
C3Vector direction;
float speed;
float timer;
float rotationSpeed;
};
#endif

View file

@ -1,43 +0,0 @@
#ifndef VBBLIST_H
#define VBBLIST_H
DECLARE_STRUCT(VBBList);
DECLARE_STRUCT(VBBList_Block);
#include "system/types.h"
#include "gx/buffer.h"
struct VBBList_Block
{
VBBList_Block* next;
VBBList_Block* prev;
EGxPoolUsage poolUsage;
uint32_t offset;
uint32_t capacity;
CGxPool* pool;
CGxBuf* buffer;
VBBList_Block** listHead;
};
struct VBBList
{
int32_t singlePool;
EGxPoolTarget target;
EGxPoolUsage usage;
CGxPool* pool;
uint32_t unk_10;
//singlePool == true
VBBList_Block* listHeadA;
VBBList_Block* freeCandidate;
uint32_t unk_1C;
//singlePool == false
VBBList_Block* listHeadB;
VBBList_Block* allBlocks;
};
#endif

View file

@ -1,232 +0,0 @@
#ifndef WMOCHUNKS_H
#define WMOCHUNKS_H
#include "tempest/box.h"
#include "tempest/plane.h"
#include "tempest/quaternion.h"
DECLARE_STRUCT(SMOHeader);
DECLARE_STRUCT(SMOGroupInfo);
DECLARE_STRUCT(SMOPortal);
DECLARE_STRUCT(SMOPortalRef);
DECLARE_STRUCT(SMOVisibleBlock);
DECLARE_STRUCT(SMOLight);
DECLARE_STRUCT(SMODoodadSet);
DECLARE_STRUCT(SMODoodadDef);
DECLARE_STRUCT(SMOFog);
DECLARE_STRUCT(SMOMaterial);
DECLARE_STRUCT(SMOPoly);
DECLARE_STRUCT(SMOBatch);
DECLARE_STRUCT(SMOLiquidVert);
DECLARE_STRUCT(SMOLTile);
DECLARE_STRUCT(SMOWVert);
DECLARE_STRUCT(SMOMVert);
struct SMOHeader
{
uint32_t nTextures;
uint32_t nGroups;
uint32_t nPortals;
uint32_t nLights;
uint32_t nDoodadNames;
uint32_t nDoodadDefs;
uint32_t nDoodadSets;
uint32_t ambColor;
uint32_t wmoID;
CAaBox bounding_box;
/*uint16_t flag_do_not_attenuate_vertices_based_on_distance_to_portal : 1;
uint16_t flag_use_unified_render_path : 1;
uint16_t flag_use_liquid_type_dbc_id : 1;
uint16_t flag_do_not_fix_vertex_color_alpha: 1;
uint16_t flag_lod : 1;
uint16_t flag_default_max_lod : 1;
uint16_t : 10;*/
uint16_t flags;
uint16_t numLod;
};
struct SMOGroupInfo
{
uint32_t flags;
CAaBox bbox;
uint32_t nameOffset;
};
struct SMOPortal
{
uint16_t startVertex;
uint16_t count;
C4Plane plane;
};
struct SMOPortalRef
{
uint16_t portalIndex;
uint16_t groupIndex;
int16_t side;
uint16_t filler;
};
struct SMOVisibleBlock
{
uint16_t firstVertex;
uint16_t count;
};
struct SMOLight
{
uint8_t type;
uint8_t atten;
uint8_t pad[2];
CImVector color;
C3Vector position;
float intensity;
C4Quaternion rotation;
float attenStart;
float attenEnd;
};
struct SMODoodadSet
{
char name[0x14];
uint32_t startIdx;
uint32_t count;
uint32_t pad;
};
struct SMODoodadDef
{
/*uint32_t nameIndex : 24;
uint32_t flag_AcceptProjTex : 1;
uint32_t flag_0x2 : 1;
uint32_t flag_0x4 : 1;
uint32_t flag_0x8 : 1;
uint32_t unk : 4;*/
uint32_t flags;
C3Vector position;
C4Quaternion orientation;
float scale;
CImVector color;
};
struct SMOFog
{
/*uint32_t flag_infinite_radius : 1;
uint32_t : 3;
uint32_t flag_0x10 : 1;
uint32_t : 27;*/
uint32_t flags;
C3Vector position;
float smallerRadius;
float largerRadius;
float fogEnd;
float fogStartScalar;
CImVector fogColor;
//under water
float uwFogEnd;
float uwFogStartScalar;
CImVector uwFogColor;
};
struct SMOMaterial
{
/*uint32_t F_UNLIT : 1;
uint32_t F_UNFOGGED : 1;
uint32_t F_UNCULLED : 1;
uint32_t F_EXTLIGHT : 1;
uint32_t F_SIDN : 1;
uint32_t F_WINDOW : 1;
uint32_t F_CLAMP_S : 1;
uint32_t F_CLAMP_T : 1;
uint32_t flag_0x100 : 1;
uint32_t : 23;*/
uint32_t flags;
uint32_t shader;
uint32_t blendMode;
uint32_t texture1;
CImVector sidnColor;
CImVector frameSidnColor;
uint32_t texture2;
CImVector diffColor;
uint32_t groundType;
uint32_t texture3;
uint32_t color2;
uint32_t flags2;
uint32_t runTimeData[4];
};
struct SMOPoly
{
/*uint8_t F_UNK_0x01: 1;
uint8_t F_NOCAMCOLLIDE : 1;
uint8_t F_DETAIL : 1;
uint8_t F_COLLISION : 1;
uint8_t F_HINT : 1;
uint8_t F_RENDER : 1;
uint8_t F_CULL_OBJECTS : 1;
uint8_t F_COLLIDE_HIT : 1;*/
uint8_t flags;
uint8_t materialId;
};
struct SMOBatch
{
int8_t unused[12];
uint32_t indexStart;
uint16_t indexCount;
uint16_t vertexStart;
uint16_t vertexEnd;
uint8_t flags;
uint8_t texture;
};
struct SMOWVert
{
uint8_t flow1;
uint8_t flow2;
uint8_t flow1Pct;
uint8_t filler;
float height;
};
struct SMOMVert
{
int16_t s;
int16_t t;
float height;
};
struct SMOLiquidVert
{
union
{
SMOWVert waterVert;
SMOMVert magmaVert;
};
};
struct SMOLTile
{
/*uint8_t legacyLiquidType : 4;
uint8_t unknown1 : 1;
uint8_t unknown2 : 1;
uint8_t fishable : 1;
uint8_t shared : 1;*/
uint8_t flags;
};
#endif

View file

@ -1,353 +0,0 @@
#ifndef WEATHER_H
#define WEATHER_H
DECLARE_STRUCT(Weather);
DECLARE_STRUCT(Mists);
DECLARE_STRUCT(Rain);
DECLARE_STRUCT(Snow);
DECLARE_STRUCT(Sand);
DECLARE_STRUCT(PacketList_Packet_RainDrop);
DECLARE_STRUCT(Packet_RainDrop);
DECLARE_STRUCT(RainDropParticle);
DECLARE_STRUCT(RainParticleBuffer);
DECLARE_STRUCT(PacketList_Packet_RainPatter);
DECLARE_STRUCT(Packet_RainPatter);
DECLARE_STRUCT(RainPatterParticle);
DECLARE_STRUCT(RainPatterParticleBuffer);
DECLARE_STRUCT(PacketList_Packet_SnowFlake);
DECLARE_STRUCT(Packet_SnowFlake);
DECLARE_STRUCT(SnowFlakeParticle);
DECLARE_STRUCT(SnowFlakeParticleBuffer);
DECLARE_STRUCT(PacketList_Packet_SandGrain);
DECLARE_STRUCT(Packet_SandGrain);
DECLARE_STRUCT(SandGrainParticle);
DECLARE_STRUCT(SandGrainParticleBuffer);
#include "tempest/box.h"
#include "system/types.h"
#include "tempest/vector.h"
#include "texture/texture.h"
#include "gx/shader.h"
#include "gx/buffer.h"
struct Mists
{
void** vtable;
C3Vector position;
uint32_t unk_10;
uint32_t unk_14;
uint32_t unk_18;
float scale;
uint32_t unk_20;
float rotationSpeed;
float fadeSpeed;
uint32_t unk_2C;
float opacity;
float lifeTime;
float spawnRate;
uint8_t unk_3C;
uint8_t padding[3];
CTexture* mistTexture;
uint32_t particleCount;
uint32_t unk_48;
uint32_t unk_4C;
uint32_t unk_50;
};
struct SandGrainParticle
{
C3Vector position;
C3Vector velocity;
float lifetime;
float size;
};
struct SandGrainParticleBuffer
{
uint32_t particleCount;
SandGrainParticle particles[6144];
};
struct Packet_SandGrain
{
Packet_SandGrain* prev;
Packet_SandGrain* next;
SandGrainParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_C007;
uint32_t field_C008;
uint32_t field_C009;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_SandGrain
{
int32_t unk_00;
Packet_SandGrain* prev;
Packet_SandGrain* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_SandGrain* unk_18;
Packet_SandGrain* unk_1C;
};
struct Sand
{
int32_t useWeatherShaders;
CAaBox bbox;
Mists mists;
PacketList_Packet_SandGrain sandGrainPacketList;
Packet_SandGrain* sandGrainPacketPtr;
float unk_94;
CGxShader* shader;
float unk_9C;
};
struct SnowFlakeParticle
{
C3Vector position;
C3Vector velocity;
float lifetime;
float size;
};
struct SnowFlakeParticleBuffer
{
uint32_t particleCount;
SnowFlakeParticle particles[6144];
};
struct Packet_SnowFlake
{
Packet_SnowFlake* prev;
Packet_SnowFlake* next;
SnowFlakeParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_C007;
uint32_t field_C008;
uint32_t field_C009;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_SnowFlake
{
int32_t unk_00;
Packet_SnowFlake* prev;
Packet_SnowFlake* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_SnowFlake* unk_18;
Packet_SnowFlake* unk_1C;
};
struct Snow
{
int32_t useWeatherShaders;
CAaBox bbox;
Mists mists;
//PacketList_Packet_SnowFlake snowFlakePacketList;
int32_t unk_70;
void* unk_74;
void* unk_78;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_84;
void* unk_88;
void* unk_8C;
//end
Packet_SnowFlake* snowFlakePacketPtr;
float unk_94;
CTexture* snowFlakeTex;
CGxShader* shaderPtr;
int32_t unk_A0;
int32_t unk_A4;
};
struct RainPatterParticle
{
C3Vector position;
float lifetime;
float size;
float unk;
};
struct RainPatterParticleBuffer
{
uint32_t particleCount;
RainPatterParticle particles[6144];
};
struct Packet_RainPatter
{
Packet_RainPatter* prev;
Packet_RainPatter* next;
RainPatterParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_9007;
uint32_t field_9008;
uint32_t field_9009;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_RainPatter
{
int32_t unk_00;
Packet_RainPatter* prev;
Packet_RainPatter* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_RainPatter* unk_18;
Packet_RainPatter* unk_1C;
};
struct RainDropParticle
{
C3Vector position;
C3Vector velocity;
CImVector color;
float size;
float unk;
};
struct RainParticleBuffer
{
uint32_t particleCount;
RainDropParticle particles[6144];
};
struct Packet_RainDrop
{
Packet_RainDrop* prev;
Packet_RainDrop* next;
RainParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_D807;
uint32_t field_D808;
uint32_t field_D809;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_RainDrop
{
int32_t unk_00;
Packet_RainDrop* prev;
Packet_RainDrop* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_RainDrop* unk_18;
Packet_RainDrop* unk_1C;
};
struct Rain
{
int32_t useWeatherShaders;
CAaBox bbox;
Mists mists;
PacketList_Packet_RainDrop rainDropPacketList;
PacketList_Packet_RainPatter rainPatterPacketList;
Packet_RainDrop* rainDropPacketPtr;
float unk_B4; // particle lifetime?
Packet_RainPatter* rainPatterPacketPtr;
CTexture* rainDropTex;
CGxShader* shaderRain;
CTexture* rainDropSplashTex;
CGxShader* shaderPatter;
float particlesPerFrame;
float intensity;
};
struct Weather
{
float intensity;
float lastIntensity;
float currStormItensity;
float targetSkyDark;
float startSkyDark;
float currSkyDark;
uint32_t weatherStartMs;
uint32_t weatherStartMs2;
uint32_t weatherType;
uint32_t abrupt;
float transitionSkyBox;
float transitionSkyBoxNotAbrupt;
float transitionSkyBoxNoWeather;
CImVector color;
char texturePath[260];
Rain* rain;
Snow* snow;
Sand* sand;
void* unkObject;
int32_t unk_14C;
void* unk_ptr_150;
void* unk_ptr_154;
int32_t unk_158;
void* unk_ptr_15C;
void* unk_ptr_160;
C3Vector velocity;
C3Vector unkVec;
C3Vector playerPos;
int32_t unk_188;
float facingAngle;
float moveSpeed;
int32_t unk_194;
};
#endif

View file

@ -5,9 +5,17 @@
#error "Preprocessor mode not detected! You must define either IDA or GHIDRA or BINANA_GENERATOR"
#endif
#if defined(BINANA_GENERATOR)
// add custom generator defines here
#else
#define BITFIELDS_SUPPORTED
#endif
#if defined(IDA)
// why does this work?
// why does this work?
#define DECLARE_ENUM(E) typedef enum E##__ E
#else
@ -18,4 +26,6 @@
#define DECLARE_STRUCT(T) typedef struct T T
#endif
#define DECLARE_UNION(T) typedef union T T
#endif

View file

@ -1,6 +1,14 @@
#ifndef SYSTEM_TYPES_H
#define SYSTEM_TYPES_H
#if defined(CLANGD)
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#endif
// stdint
#if defined(IDA) || defined(BINANA_GENERATOR)
@ -13,9 +21,9 @@ typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef int32_t ptrdiff_t;
typedef int32_t ptrdiff_t;
typedef uint32_t uintptr_t;
typedef int32_t intptr_t;
typedef int32_t intptr_t;
#else
@ -38,7 +46,7 @@ typedef char bool;
#endif
// stddef
#if defined(GHIDRA)
#if defined(GHIDRA) || defined(CLANGD)
#include <stddef.h>
@ -64,14 +72,14 @@ typedef char* va_list;
typedef struct fixed16 fixed16;
struct fixed16 {
int16_t n;
int16_t n;
};
struct ubyte4 {
union {
uint8_t b[4];
uint32_t u;
};
union {
uint8_t b[4];
uint32_t u;
};
};
#endif
#endif

View file

@ -17,7 +17,7 @@ Blizzard__File__MakeAbsolutePath 00427500 f end=00427551 ; Blizzard::File::MakeA
Blizzard__File__Move 00427560 f end=004275A8 type="bool __stdcall func(char* src, char* dst)" ; Blizzard::File::Move(char const*, char const*)
Blizzard__File__Copy 004275B0 f end=004275FE type="bool __stdcall func(char* src, char* dst, bool overwrite)"
Blizzard__File__Open 00427600 f end=0042765E
Blizzard__File__ProcessDirFast 00427660 f end=004276BA type="bool __stdcall func(char* name, void* param, Blizzard__File__ProcessDirCallback callback, bool flag)"
Blizzard__File__ProcessDirFast 00427660 f end=004276BA type="bool __stdcall func(char* path, void* cookie, Blizzard__File__ProcessDirCallback callback, bool treatSymlinksAsFiles)"
Blizzard__File__Read 004276C0 f end=0042771F
Blizzard__File__Read 00427720 f end=0042778B type="bool __stdcall func(Blizzard__File__StreamRecord* file, void* data, int64_t offset, uint32_t* count)" ; Blizzard::File::Read(Blizzard::File::StreamRecord*, void*, long long, int*, int)
Blizzard__File__RemoveDirectory 00427800 f end=00427843
@ -60,7 +60,7 @@ System_Mopaq__Cache__GetCachedBlock 004308C0 f end=00430A43
System_File__GetRootChars 004325C0 f type="int32_t __stdcall func(Blizzard__File__Filesystem* fs, System_File__Stacked__FileParms* parms)"
Blizzard__String__JoinPath 00433510 f end=0043356B type="void __stdcall func(char* a1, int32_t a2, char* a3, char* a4)" ; Blizzard::String::JoinPath(char*, int, char const*, char const*)
System_File__FromNativeName 00433590 f end=00433650 type="void __stdcall func(uint8_t *buffer, uint32_t buffersize, const char *str)"
Blizzard__String__QuickNativePath_300__QuickNativePath 00433650 f end=0043375A
Blizzard__StringConversion_CodepageToUTF8__ToNative__constructor 00433650 f end=0043375A type="void __thiscall func(Blizzard__StringConversion_CodepageToUTF8__ToNative* this, char* str)" ; Blizzard::StringConversion_CodepageToUTF8::ToNative::ToNative(const char*)
System_File__GetFileInfoByFile 00435580 f end=004356A2 type="void __stdcall func(Blizzard__File__StreamRecord* file)"
System_File__Exists 004356B0 f end=00435781 type="int32_t __stdcall func(Blizzard__File__Filesystem* fs, System_File__Stacked__FileParms* parms)"
System_File__MakeAbsolutePath 00435790 f end=00435889 type="int32_t __stdcall func(Blizzard__File__Filesystem* fs, System_File__Stacked__FileParms* parms)"
@ -155,3 +155,5 @@ Blizzard__Streaming__SourceManifest__ReadIndirectFile 00459400 f end=004595EE
Blizzard__Mopaq__SFileAuthenticateArchiveEx 0045A260 f end=0045A4A9
Blizzard__Streaming__FileManifest__ReadDirectFileFromBuffer 0045D1E0 f end=0045D85E
System_Mopaq__cache_read 00457A00 f end=00457CF9
Blizzard__File__SetEOF 004278B0 f end=00427901 type="bool __stdcall func(Blizzard__File__Stream file, int64_t pos, int32_t posMode)" ; Blizzard::File::SetEOF(Blizzard::File::StreamRecord*, long long, int)
Blizzard__File__Write 00427A20 f end=00427A85 type="bool __stdcall func(Blizzard__File__Stream file, void* buffer, int64_t start, int32_t* amount)"

View file

@ -82,7 +82,6 @@ CComand_WaterRipples 0077F690 f end=0077F6B0
CComand_DetailDoodadAlpha 0077F700 f end=0077F749
CComand_CharacterAmbient 0077F750 f end=0077F7D1
CComand_SetShadow 00780E20 f end=00780F41
ConsoleCommandInvalidPtrCheck 0086B5A0 f end=0086B5F5
ConsoleCommandHistoryDepth 0095BFB0 f end=0095BFB6 type="int32_t __stdcall func()"
AddToHistory 0076B3B0 f end=0076B3E5
ConvertBool 00772B30 f end=00772B91

View file

@ -39,3 +39,4 @@ FrameScript_CreateEvents 0081B5F0 f end=0081B714 ; FrameScript_CreateEvents(char
FrameScript_HookWrapper 00817050 f end=00817162
FrameScript_Object__LoadFunction 00498370 f end=0049857B
FrameScript_Object__GetScriptTime 00816870 f end=008168C5
FrameScript_HandleError 00819730 f end=0081980C type="int32_t __stdcall func(lua_State* L)"

View file

@ -1,2 +1,11 @@
FrameScript_Object__s_objectType 00D3F778 l
s_scriptProfileEnabled 00D3F798 l type="int32_t"
s_mempool 00D3F788 l type="void*"
s_context 00D3F78C l type="lua_State*"
s_scriptTimeDivisor 00D3F780 l type="int64_t"
s_scriptTimeUsed 00D3F790 l type="int64_t"
s_errorHandlerFunc 00AF5770 l type="int32_t"
s_errorHandlerRef 00AF576C l type="int32_t"
s_recursiveTableHash 00AF5774 l type="int32_t"
extra_funcs 00A443A8 l type="luaL_Reg[31]"
s_compat_lua 00AF57F0 l type="char*" ; this is statically defined inside FrameScript_Initialize()

View file

@ -50,4 +50,3 @@ CGGameUI__m_iCurrentMapID 00BD088C l
CGGameUI__m_bOwnsInstance 00BD0890 l
CGGameUI__m_lastRegenTime 00BD08A0 l
CGGameUI__m_MirrorTimerInfo 00BD0B80 l
CGGameUI__m_luaTainted 00D4139C l

View file

@ -1,72 +1,84 @@
_lua_gettop 0084DBD0 f
_lua_settop 0084DBF0 f
_lua_insert 0084DCC0 f
_lua_type 0084DEB0 f
_lua_isnumber 0084DF20 f
_lua_isstring 0084DF60 f
_lua_tonumber 0084E030 f
_lua_tolstring 0084E0E0 f
_lua_touserdata 0084E1C0 f
_lua_pushnil 0084E280 f
_lua_pushnumber 0084E2A0 f
_lua_pushstring 0084E350 f
_lua_rawget 0084E600 f
_lua_rawgeti 0084E670 f
_lua_rawset 0084E970 f
_luaL_error 0084F280 f
_luaL_unref 0084F7A0 f
_luaG_runerror 00850920 f
_luaD_throw 008562E0 f
_luaD_precall 00856370 f
luaO_fb2int 0084D3D0 f end=0084D3ED
luaO_rawequalObj 0084D420 f end=0084D467
luaO_pushvfstring 0084D580 f end=0084D7C6
luaO_chunkid 0084D860 f end=0084D9B2 type="void __stdcall func(char* out, char* src, size_t bufflen)"
index2adr 0084D9C0 f end=0084DA48 type="TValue* __usercall func@<eax>(lua_State* L@<ecx>, int32_t idx@<eax>)"
lua_gettop 0084DBD0 f end=0084DBE1 type="int32_t __stdcall func(lua_State* L)"
lua_settop 0084DBF0 f end=0084DC49 type="void __stdcall func(lua_State* L, int32_t idx)"
lua_remove 0084DC50 f end=0084DCC0
lua_insert 0084DCC0 f
lua_pushvalue 0084DE50 f end=0084DEAE
lua_type 0084DEB0 f
lua_isnumber 0084DF20 f
lua_isstring 0084DF60 f
lua_tonumber 0084E030 f
lua_tolstring 0084E0E0 f
lua_touserdata 0084E1C0 f
lua_pushnil 0084E280 f end=0084E29F type="void __stdcall func(lua_State* L)"
lua_pushnumber 0084E2A0 f
lua_pushlstring 0084E300 f end=0084E34A type="void __stdcall func(lua_State* L, char* s, size_t len)"
lua_pushstring 0084E350 f
lua_pushvfstring 0084E3A0 f end=0084E3CF
lua_pushfstring 0084E3D0 f end=0084E3FF
lua_pushcclosure 0084E400 f end=0084E4C9 type="void __stdcall func(lua_State* L, lua_CFunction fn, int n)"
lua_pushlightuserdata 0084E500 f end=0084E524
lua_rawget 0084E600 f
lua_rawgeti 0084E670 f
lua_createtable 0084E6E0 f end=0084E72A type="void __stdcall func(lua_State* L, int32_t narray, int32_t nrec)"
lua_getmetatable 0084E730 f end=0084E792
lua_rawset 0084E970 f
lua_setmetatable 0084EA90 f end=0084EB35
lua_call 0084EBF0 f end=0084EC2B
lua_pcall 0084EC50 f end=0084ECBB
lua_gc 0084ED50 f end=0084EE28 type="int32_t __stdcall func(lua_State* L, int32_t what, int32_t data)"
lua_gcupdatesizes 0084EE50 f end=0084EE59
lua_gcgetsize 0084EE60 f end=0084EE69
lua_gcupdatetimes 0084EE70 f end=0084EE79
lua_gcgettime 0084EE80 f end=0084EE89
lua_gcgetfunctiontime 0084EE90 f end=0084EF1C
lua_error 0084EF30 f end=0084EF43
lua_concat 0084EF90 f end=0084F010
lua_setdecimalconversion 0084F010 f end=0084F022
lua_convertdecimal 0084F030 f end=0084F0C6
luaL_error 0084F280 f
luaL_ref 0084F6C0 f end=0084F793 type="int32_t __stdcall func(lua_State* L, int32_t t)"
luaL_unref 0084F7A0 f
luaL_optlstring 0084FA50 f end=0084FAAB
luaL_register 0084FDD0 f end=0084FDEB type="void __stdcall func(lua_State* L, char* libname, luaL_Reg* l)"
lua_getstack 0084FE40 f end=0084FEBB
luaG_runerror 00850920 f
lua_getinfo 00850A90 f end=00850B59
luaopen_bit 00851010 f end=00851032
luaopen_bit 00851010 f end=00851032 type="int32_t __stdcall func(lua_State* L)"
luaopen_math 00851760 f end=008517C0
luaopen_math 00851760 f end=008517C0 type="int32_t __stdcall func(lua_State* L)"
luaopen_table 008521F0 f end=00852210 type="int32_t __stdcall func(lua_State* L)"
luaopen_string 008540D0 f end=008540F7 type="int32_t __stdcall func(lua_State* L)"
luaopen_base 00855060 f end=00855087 type="int32_t __stdcall func(lua_State* L)"
lua_newstate 00855370 f end=008554E3
lua_newstate 00855370 f end=008554E3 type="lua_State* __stdcall func(lua_Alloc f, void* ud, int32_t a3)"
lua_close 00855510 f end=00855570
luaM_initPool 00855740 f end=008557CA type="int32_t __stdcall func()"
luaM_freePool 008557D0 f end=0085581C
luaM_reallocPool 008558E0 f end=00855A11 type="void* __stdcall func(void* ud, void* ptr, size_t osize, size_t nsize)"
luaD_throw 008562E0 f
luaD_precall 00856370 f
luaD_precall_profile 00856550 f end=00856756
luaD_call 00856760 f
_luaV_execute 00857CA0 f
_luaO_fb2int 0084D3D0 f end=0084D3ED
_luaO_rawequalObj 0084D420 f end=0084D467
_luaO_pushvfstring 0084D580 f end=0084D7C6
_luaO_chunkid 0084D860 f end=0084D9B2
_lua_remove 0084DC50 f end=0084DCC0
_lua_pushvalue 0084DE50 f end=0084DEAE
_lua_pushvfstring 0084E3A0 f end=0084E3CF
_lua_pushfstring 0084E3D0 f end=0084E3FF
_lua_pushcclosure 0084E400 f end=0084E4C9
_lua_pushlightuserdata 0084E500 f end=0084E524
_lua_getmetatable 0084E730 f end=0084E792
_lua_setmetatable 0084EA90 f end=0084EB35
_lua_call 0084EBF0 f end=0084EC2B
_lua_pcall 0084EC50 f end=0084ECBB
_lua_gc 0084ED50 f end=0084EE28
_lua_gcupdatesizes 0084EE50 f end=0084EE59
_lua_gcgetsize 0084EE60 f end=0084EE69
_lua_gcupdatetimes 0084EE70 f end=0084EE79
_lua_gcgettime 0084EE80 f end=0084EE89
_lua_gcgetfunctiontime 0084EE90 f end=0084EF1C
_lua_error 0084EF30 f end=0084EF43
_lua_concat 0084EF90 f end=0084F010
_lua_setdecimalconversion 0084F010 f end=0084F022
_lua_convertdecimal 0084F030 f end=0084F0C6
_luaL_optlstring 0084FA50 f end=0084FAAB
_lua_getstack 0084FE40 f end=0084FEBB
_lua_getinfo 00850A90 f end=00850B59
_luaopen_bit 00851010 f end=00851032
_luaopen_math 00851760 f end=008517C0
_lua_newstate 00855370 f end=008554E3
_lua_close 00855510 f end=00855570
_luaM_initPool 00855740 f end=008557CA
_luaM_freePool 008557D0 f end=0085581C
_luaD_precall_profile 00856550 f end=00856756
_luaC_separateudata 0085A8B0 f end=0085A952
_luaC_sizeall 0085B4E0 f end=0085B52D
_luaC_getsize 0085B530 f end=0085B557
_luaC_timeall 0085B560 f end=0085B598
_luaC_gettime 0085B5A0 f end=0085B602
_luaC_step 0085B950 f end=0085B9D2
_luaC_fullgc 0085B9E0 f end=0085BA4B
_luaC_barrierback 0085BA90 f end=0085BAAB
_luaC_link 0085BAB0 f end=0085BAF1
_luaT_gettmbyobj 0085BC10 f end=0085BC67
_luaH_getstr 0085C430 f end=0085C46F
_luaF_newCclosure 0085CC10 f end=0085CC86
_luaF_close 0085CE70 f end=0085CF3F
_luaF_getlocalname 0085D0A0 f end=0085D0ED
_luaZ_openspace 0085D170 f end=0085D1CC
_luaX_syntaxerror 0085D9E0 f end=0085D9F9
luaV_execute 00857CA0 f
luaC_separateudata 0085A8B0 f end=0085A952
luaC_sizeall 0085B4E0 f end=0085B52D
luaC_getsize 0085B530 f end=0085B557
luaC_timeall 0085B560 f end=0085B598
luaC_gettime 0085B5A0 f end=0085B602
luaC_step 0085B950 f end=0085B9D2
luaC_fullgc 0085B9E0 f end=0085BA4B
luaC_barrierback 0085BA90 f end=0085BAAB
luaC_link 0085BAB0 f end=0085BAF1
luaT_gettmbyobj 0085BC10 f end=0085BC67
luaH_getstr 0085C430 f end=0085C46F
luaF_newCclosure 0085CC10 f end=0085CC86
luaF_close 0085CE70 f end=0085CF3F
luaF_getlocalname 0085D0A0 f end=0085D0ED
luaZ_openspace 0085D170 f end=0085D1CC
luaX_syntaxerror 0085D9E0 f end=0085D9F9

View file

@ -0,0 +1,2 @@
lua_tainted 00D4139C l
luaO_nilobject_ 00A46F78 l type="TValue"

View file

@ -21,11 +21,13 @@ OsSleepInBackground 0086B290 f end=0086B296
OsSetSleepInBackground 0086B2A0 f end=0086B2AD
OsGetBackgroundSleepMs 0086B2B0 f end=0086B2B6
OsSetBackgroundSleepMs 0086B2C0 f end=0086B2CD
OsGetVersion 0086B2D0 f end=0086B429
OsGetVersionString 0086B430 f end=0086B458
OsGetComputerName 0086B480 f end=0086B493
OsGetUserName 0086B4A0 f end=0086B4B3
OsGetPhysicalMemory 0086B4C0 f end=0086B4E1
OsSystemInitialize 0086B4F0 f end=0086D6DF
OsValidateFunctionPointer 0086B5A0 f end=0086B5F5 type="void __stdcall func(void* func)" ; Prevents code outside the .text section from running
IOsParseProcessorFrequency 0086B600 f end=0086B703
IOsGetPowerProfFrequency 0086B710 f end=0086B774
OsIsRemoteSession 0086B780 f end=0086B78C
@ -40,8 +42,11 @@ OsGuiSetWindowTitle 0086C650 f end=0086C696
OsGuiGetWindow 0086C6A0 f end=0086C6CE
OsGuiSetGxWindow 0086C6D0 f end=0086C6DD
OsGuiMessageBox 0086C6E0 f end=0086C7D0 type="int32_t __stdcall func(void* parentWindow, int32_t style, const char* message, const char* title)"
OsIMEGetClauseInfo 0086CDB0 f end=0086CF84
OsIMEEnable 0086CF90 f end=0086CFE2
OsIMEInitialize 0086D0A0 f end=0086D0B8
OsIMEDestroy 0086D0C0 f end=0086D0DF
OsIMEGetCandidates 0086D1D0 f end=0086D3F8
OsGetTimeStamp 0086D490 f end=0086D4C0
OsTlsGetValue 0086D6D0 f end=0086D6DF
OsCallSetContext 0086F5A0 f end=0086F5EA
@ -55,7 +60,3 @@ OsClipboardPutString 008722A0 f end=008722BF
IOsClipboardGetString 008726F0 f end=008727BB
OsClipboardFreeString 008727C0 f end=008727DE
IOsClipboardPutString 008727E0 f end=008728B8
OsGetVersion 0086B2D0 f end=0086B429
OsIMEGetClauseInfo 0086CDB0 f end=0086CF84
OsIMEEnable 0086CF90 f end=0086CFE2
OsIMEGetCandidates 0086D1D0 f end=0086D3F8

View file

@ -2110,9 +2110,9 @@ Script_CancelUnitBuff 00804220 f end=00804420
Script_SpellStopTargeting 00809E30 f end=00809E96
Script_SpellStopCasting 00809EA0 f end=00809F7E
Script_SpellTargetUnit 0080DC00 f end=0080DCE3
Script_issecurevariable 00816DE0 f end=00816EF2
Script_seterrorhandler 008173C0 f end=0081741B
Script_strlenutf8 00817C70 f end=00817CD8
issecurevariable 00816DE0 f end=00816EF2
seterrorhandler 008173C0 f end=0081741B
strlenutf8 00817C70 f end=00817CD8
Script_GetText 0081B720 f end=0081B7AF
Script_CreateFont 0081B7B0 f end=0081B81E
Script_GetCurrentKeyBoardFocus 0081B820 f end=0081B86C