mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-04-19 13:12:53 +00:00
Add compiler decomp
This commit is contained in:
parent
bd25b6429b
commit
15309fc2c0
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "cscr_compiler.hpp"
|
||||
#include "cscr_main.hpp"
|
||||
#include "cscr_memorytree.hpp"
|
||||
#include "cscr_parser.hpp"
|
||||
|
5308
src/codsrc/clientscript/cscr_compiler.cpp
Normal file
5308
src/codsrc/clientscript/cscr_compiler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
202
src/codsrc/clientscript/cscr_compiler.hpp
Normal file
202
src/codsrc/clientscript/cscr_compiler.hpp
Normal file
@ -0,0 +1,202 @@
|
||||
#pragma once
|
||||
|
||||
namespace codsrc
|
||||
{
|
||||
void RemoveRefToValue(game::scriptInstance_t inst, game::VariableValue* value);
|
||||
void Scr_CompileRemoveRefToString(game::scriptInstance_t inst, unsigned int stringVal);
|
||||
void EmitCanonicalString(game::scriptInstance_t inst, unsigned int stringVal);
|
||||
void CompileTransferRefToString(unsigned int stringValue, game::scriptInstance_t inst, unsigned int user);
|
||||
void EmitOpcode(game::scriptInstance_t inst, game::OpcodeVM op, int offset, int callType);
|
||||
void EmitEnd(game::scriptInstance_t inst);
|
||||
void EmitReturn(game::scriptInstance_t inst);
|
||||
void EmitCodepos(game::scriptInstance_t inst, int codepos);
|
||||
void EmitShort(game::scriptInstance_t inst, int value);
|
||||
void EmitByte(game::scriptInstance_t inst, int value);
|
||||
void EmitGetInteger(game::scriptInstance_t inst, int value, game::sval_u sourcePos);
|
||||
void EmitGetFloat(game::scriptInstance_t inst, float value, game::sval_u sourcePos);
|
||||
void EmitAnimTree(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
int Scr_FindLocalVarIndex(game::scriptInstance_t inst, unsigned int name, game::sval_u sourcePos, int create, game::scr_block_s* block);
|
||||
void EmitCreateLocalVars(game::scriptInstance_t inst, game::scr_block_s* block);
|
||||
void EmitRemoveLocalVars(game::scriptInstance_t inst, game::scr_block_s* outerBlock, game::scr_block_s* block);
|
||||
void EmitNOP2(game::scr_block_s* block, game::scriptInstance_t inst, int lastStatement, unsigned int endSourcePos);
|
||||
void Scr_InitFromChildBlocks(game::scr_block_s** childBlocks, int childCount, game::scr_block_s* block);
|
||||
void Scr_AppendChildBlocks(game::scr_block_s* block, game::scr_block_s** childBlocks, int childCount);
|
||||
void Scr_MergeChildBlocks(game::scr_block_s** childBlocks, int childCount, game::scr_block_s* block);
|
||||
void Scr_TransferBlock(game::scr_block_s* to, game::scr_block_s* from);
|
||||
void EmitSafeSetVariableField(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitSafeSetWaittillVariableField(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitGetString(unsigned int value, game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitGetIString(unsigned int value, game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitGetVector(const float* value, game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitValue(game::scriptInstance_t inst, game::VariableCompileValue* constValue);
|
||||
void Scr_PushValue(game::scriptInstance_t inst, game::VariableCompileValue* constValue);
|
||||
void EmitCastBool(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitBoolNot(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitBoolComplement(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitSize(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitSelf(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitLevel(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitGame(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitAnim(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitSelfObject(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitLevelObject(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitAnimObject(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitLocalVariable(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitLocalVariableRef(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void Scr_RegisterLocalVar(unsigned int name, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void EmitGameRef(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitClearArray(game::scriptInstance_t inst, game::sval_u sourcePos, game::sval_u indexSourcePos);
|
||||
void EmitEmptyArray(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitAnimation(game::scriptInstance_t inst, game::sval_u anim, game::sval_u sourcePos);
|
||||
void EmitFieldVariable(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u field, game::sval_u sourcePos);
|
||||
void EmitClearFieldVariable(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u field, game::sval_u sourcePos, game::sval_u rhsSourcePos);
|
||||
void EmitObject(game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitDecTop(game::scriptInstance_t inst);
|
||||
void EmitCastFieldObject(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitArrayVariable(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u index, game::sval_u sourcePos, game::sval_u indexSourcePos);
|
||||
void EmitArrayVariableRef(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u index, game::sval_u sourcePos, game::sval_u indexSourcePos);
|
||||
void EmitClearArrayVariable(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u index, game::sval_u sourcePos, game::sval_u indexSourcePos);
|
||||
void EmitVariableExpression(game::scriptInstance_t inst, game::sval_u expr, game::scr_block_s* block);
|
||||
int EmitExpressionList(game::scriptInstance_t inst, game::sval_u exprlist, game::scr_block_s* block);
|
||||
void AddExpressionListOpcodePos(game::scriptInstance_t inst, game::sval_u exprlist);
|
||||
void AddFilePrecache(game::scriptInstance_t inst, unsigned int filename, unsigned int sourcePos, bool include, unsigned int* filePosId, unsigned int* fileCountId);
|
||||
void EmitFunction(game::scriptInstance_t inst, game::sval_u func, game::sval_u sourcePos);
|
||||
void EmitGetFunction(game::scriptInstance_t inst, game::sval_u func, game::sval_u sourcePos);
|
||||
int AddFunction(game::scriptInstance_t inst, int func);
|
||||
void EmitPostScriptFunction(game::scriptInstance_t inst, game::sval_u func, int param_count, int bMethod, game::sval_u nameSourcePos);
|
||||
void EmitPostScriptFunctionPointer(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, int param_count, int bMethod, game::sval_u nameSourcePos, game::sval_u sourcePos);
|
||||
void EmitPostScriptThread(game::scriptInstance_t inst, game::sval_u func, int param_count, int bMethod, game::sval_u sourcePos);
|
||||
void EmitPostScriptThreadPointer(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, int param_count, int bMethod, game::sval_u sourcePos);
|
||||
void EmitPostScriptFunctionCall(game::scriptInstance_t inst, int bMethod, int param_count, game::sval_u func_name, game::sval_u nameSourcePos, game::scr_block_s* block);
|
||||
void EmitPostScriptThreadCall(game::scriptInstance_t inst, int isMethod, int param_count, game::sval_u func_name, game::sval_u sourcePos, game::sval_u nameSourcePos, game::scr_block_s* block);
|
||||
void EmitPreFunctionCall(game::scriptInstance_t inst);
|
||||
void EmitPostFunctionCall(game::scriptInstance_t inst, int bMethod, game::sval_u func_name, int param_count, game::scr_block_s* block);
|
||||
void Scr_BeginDevScript(game::scriptInstance_t isnt, int* type, char** savedPos);
|
||||
void Scr_EndDevScript(game::scriptInstance_t inst, char** savedPos);
|
||||
void EmitCallBuiltinOpcode(game::scriptInstance_t inst, int param_count, game::sval_u sourcePos);
|
||||
void EmitCallBuiltinMethodOpcode(game::scriptInstance_t inst, int param_count, game::sval_u sourcePos);
|
||||
void EmitCall(game::scriptInstance_t inst, game::sval_u func_name, game::sval_u params, int bStatement, game::scr_block_s* block);
|
||||
void EmitMethod(game::scriptInstance_t inst, game::sval_u expr, game::sval_u func_name, game::sval_u params, game::sval_u methodSourcePos, int bStatement, game::scr_block_s* block);
|
||||
void LinkThread(game::scriptInstance_t inst, unsigned int threadCountId, game::VariableValue* pos, int allowFarCall);
|
||||
void LinkFile(game::scriptInstance_t inst, unsigned int filePosId, unsigned int fileCountId);
|
||||
void CheckThreadPosition(game::scriptInstance_t inst, unsigned int posId, unsigned int name, unsigned int sourcePos);
|
||||
void EmitCallExpression(game::scriptInstance_t inst, game::scr_block_s* block, game::sval_u expr, int bStatement);
|
||||
void EmitCallExpressionFieldObject(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr);
|
||||
void Scr_CreateVector(game::scriptInstance_t inst, game::VariableCompileValue* constValue, game::VariableValue* value);
|
||||
bool EvalPrimitiveExpressionList(game::scriptInstance_t inst, game::sval_u exprlist, game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
bool EmitOrEvalPrimitiveExpressionList(game::scriptInstance_t inst, game::sval_u exprlist, game::sval_u sourcePos, game::VariableCompileValue* constValue, game::scr_block_s* a5);
|
||||
void EmitExpressionListFieldObject(game::scriptInstance_t inst, game::sval_u exprlist, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
bool EvalPrimitiveExpression(game::scriptInstance_t inst, game::sval_u expr, game::VariableCompileValue* constValue);
|
||||
bool EmitOrEvalPrimitiveExpression(game::scriptInstance_t inst, game::sval_u expr, game::VariableCompileValue* constValue, game::scr_block_s* block);
|
||||
void EmitBoolOrExpression(game::scriptInstance_t inst, game::sval_u expr1, game::sval_u expr2, game::sval_u expr1sourcePos, game::sval_u expr2sourcePos, game::scr_block_s* block);
|
||||
void EmitBoolAndExpression(game::scriptInstance_t inst, game::sval_u expr1, game::sval_u expr2, game::sval_u expr1sourcePos, game::sval_u expr2sourcePos, game::scr_block_s* a6);
|
||||
bool EvalBinaryOperatorExpression(game::scriptInstance_t inst, game::sval_u expr1, game::sval_u expr2, game::sval_u opcode, game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
bool EmitOrEvalBinaryOperatorExpression(game::scriptInstance_t inst, game::sval_u expr1, game::sval_u expr2, game::sval_u opcode, game::sval_u sourcePos, game::VariableCompileValue* constValue, game::scr_block_s* a8);
|
||||
void EmitBinaryEqualsOperatorExpression(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u lhs, game::sval_u rhs, game::sval_u opcode, game::sval_u sourcePos);
|
||||
void Scr_CalcLocalVarsVariableExpressionRef(game::scr_block_s* block, game::sval_u expr);
|
||||
bool EvalExpression(game::VariableCompileValue* constValue, game::scriptInstance_t inst, game::sval_u expr);
|
||||
bool EmitOrEvalExpression(game::scriptInstance_t inst, game::sval_u expr, game::VariableCompileValue* constValue, game::scr_block_s* block);
|
||||
void EmitExpression(game::scriptInstance_t inst, game::sval_u expr, game::scr_block_s* block);
|
||||
void EmitVariableExpressionRef(game::scriptInstance_t inst, game::sval_u expr, game::scr_block_s* block);
|
||||
void EmitArrayPrimitiveExpressionRef(game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsArrayVariableRef(game::sval_u expr, game::scr_block_s* block);
|
||||
void EmitPrimitiveExpressionFieldObject(game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void ConnectBreakStatements(game::scriptInstance_t inst);
|
||||
void ConnectContinueStatements(game::scriptInstance_t inst);
|
||||
bool EmitClearVariableExpression(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u rhsSourcePos);
|
||||
void EmitAssignmentStatement(game::scriptInstance_t inst, game::sval_u lhs, game::sval_u rhs, game::sval_u sourcePos, game::sval_u rhsSourcePos, game::scr_block_s* block);
|
||||
void EmitCallExpressionStatement(game::scriptInstance_t inst, game::scr_block_s* block, game::sval_u expr);
|
||||
void EmitReturnStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitWaitStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos, game::sval_u waitSourcePos);
|
||||
void EmitWaittillFrameEnd(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitIfStatement(game::scriptInstance_t inst, game::sval_u expr, game::sval_u stmt, game::sval_u sourcePos, int lastStatement, unsigned int endSourcePos, game::scr_block_s* block, game::sval_u* ifStatBlock);
|
||||
void Scr_CalcLocalVarsIfStatement(game::scriptInstance_t inst, game::sval_u stmt, game::scr_block_s* block, game::sval_u* ifStatBlock);
|
||||
void EmitIfElseStatement(game::scriptInstance_t inst, game::sval_u expr, game::sval_u stmt1, game::sval_u stmt2, game::sval_u sourcePos, game::sval_u elseSourcePos, int lastStatement, unsigned int endSourcePos, game::scr_block_s* block, game::sval_u* ifStatBlock, game::sval_u* elseStatBlock);
|
||||
void Scr_CalcLocalVarsIfElseStatement(game::scriptInstance_t inst, game::sval_u stmt1, game::sval_u stmt2, game::scr_block_s* block, game::sval_u* ifStatBlock, game::sval_u* elseStatBlock);
|
||||
void Scr_AddBreakBlock(game::scriptInstance_t inst, game::scr_block_s* block);
|
||||
void Scr_AddContinueBlock(game::scriptInstance_t inst, game::scr_block_s* block);
|
||||
void EmitWhileStatement(game::scriptInstance_t inst, game::sval_u expr, game::sval_u stmt, game::sval_u sourcePos, game::sval_u whileSourcePos, game::scr_block_s* block, game::sval_u* whileStatBlock);
|
||||
void Scr_CalcLocalVarsWhileStatement(game::scriptInstance_t inst, game::sval_u expr, game::sval_u stmt, game::scr_block_s* block, game::sval_u* whileStatBlock);
|
||||
void EmitForStatement(game::scriptInstance_t inst, game::sval_u stmt1, game::sval_u expr, game::sval_u stmt2, game::sval_u stmt, game::sval_u sourcePos, game::sval_u forSourcePos, game::scr_block_s* block, game::sval_u* forStatBlock, game::sval_u* forStatPostBlock);
|
||||
void Scr_CalcLocalVarsForStatement(game::scriptInstance_t inst, game::sval_u stmt1, game::sval_u expr, game::sval_u stmt2, game::sval_u stmt, game::scr_block_s* block, game::sval_u* forStatBlock, game::sval_u* forStatPostBlock);
|
||||
void EmitIncStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitDecStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void Scr_CalcLocalVarsFormalParameterListInternal(game::sval_u* node, game::scr_block_s* block);
|
||||
void EmitWaittillStatement(game::scriptInstance_t inst, game::sval_u obj, game::sval_u exprlist, game::sval_u sourcePos, game::sval_u waitSourcePos, game::scr_block_s* block);
|
||||
void EmitWaittillmatchStatement(game::scriptInstance_t inst, game::sval_u obj, game::sval_u exprlist, game::sval_u sourcePos, game::sval_u waitSourcePos, game::scr_block_s* block);
|
||||
void EmitNotifyStatement(game::scriptInstance_t inst, game::sval_u obj, game::sval_u exprlist, game::sval_u sourcePos, game::sval_u notifySourcePos, game::scr_block_s* block);
|
||||
void EmitEndOnStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u obj, game::sval_u expr, game::sval_u sourcePos, game::sval_u exprSourcePos);
|
||||
int CompareCaseInfo(const void* elem1, const void* elem2);
|
||||
void EmitCaseStatement(game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos);
|
||||
void EmitSwitchStatementList(game::scriptInstance_t inst, game::sval_u val, int lastStatement, unsigned int endSourcePos, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsSwitchStatement(game::scriptInstance_t inst, game::sval_u stmtlist, game::scr_block_s* block);
|
||||
void EmitSwitchStatement(game::scriptInstance_t inst, game::sval_u expr, game::sval_u stmtlist, game::sval_u sourcePos, int lastStatement, unsigned int endSourcePos, game::scr_block_s* block);
|
||||
void EmitCaseStatementInfo(game::scriptInstance_t inst, unsigned int name, game::sval_u sourcePos);
|
||||
void EmitBreakStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitContinueStatement(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitProfStatement(game::scriptInstance_t inst, game::sval_u profileName, game::sval_u sourcePos, game::OpcodeVM op);
|
||||
void EmitStatement(game::scriptInstance_t inst, game::sval_u val, int lastStatement, unsigned int endSourcePos, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsStatement(game::scriptInstance_t inst, game::sval_u val, game::scr_block_s* block);
|
||||
void EmitStatementList(game::scriptInstance_t inst, game::sval_u val, int lastStatement, unsigned int endSourcePos, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsStatementList(game::scr_block_s* block, game::scriptInstance_t inst, game::sval_u val);
|
||||
void Scr_CalcLocalVarsDeveloperStatementList(game::scriptInstance_t inst, game::sval_u val, game::scr_block_s* block, game::sval_u* devStatBlock);
|
||||
void EmitDeveloperStatementList(game::scriptInstance_t inst, game::sval_u val, game::sval_u sourcePos, game::scr_block_s* block, game::sval_u* devStatBlock);
|
||||
void EmitFormalParameterList(game::scriptInstance_t inst, game::sval_u exprlist, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void SpecifyThread(game::scriptInstance_t inst, game::sval_u val);
|
||||
void EmitThreadInternal(game::scriptInstance_t inst, game::sval_u val, game::sval_u sourcePos, game::sval_u endSourcePos, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsThread(game::sval_u* stmttblock, game::scriptInstance_t inst, game::sval_u exprlist, game::sval_u stmtlist);
|
||||
void InitThread(int type, game::scriptInstance_t inst);
|
||||
void EmitNormalThread(game::scriptInstance_t inst, game::sval_u val, game::sval_u* stmttblock);
|
||||
void EmitDeveloperThread(game::scriptInstance_t inst, game::sval_u val, game::sval_u* stmttblock);
|
||||
void EmitThread(game::scriptInstance_t inst, game::sval_u val);
|
||||
void EmitThreadList(game::scriptInstance_t inst, game::sval_u val);
|
||||
void EmitInclude(game::scriptInstance_t inst, game::sval_u val);
|
||||
void ScriptCompile(game::scriptInstance_t inst, game::sval_u val, unsigned int filePosId, unsigned int fileCountId, unsigned int scriptId, game::PrecacheEntry* entries, int entriesCount);
|
||||
|
||||
void EmitFloat(game::scriptInstance_t inst, float value);
|
||||
void EmitCanonicalStringConst(game::scriptInstance_t inst, unsigned int stringValue);
|
||||
int Scr_FindLocalVar(game::scr_block_s* block, int startIndex, unsigned int name);
|
||||
void Scr_CheckLocalVarsCount(int localVarsCount);
|
||||
void EmitGetUndefined(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitPrimitiveExpression(game::scriptInstance_t inst, game::sval_u expr, game::scr_block_s* block);
|
||||
void Scr_EmitAnimation(game::scriptInstance_t inst, char* pos, unsigned int animName, unsigned int sourcePos);
|
||||
void EmitEvalArray(game::scriptInstance_t inst, game::sval_u sourcePos, game::sval_u indexSourcePos);
|
||||
void EmitEvalArrayRef(game::scriptInstance_t inst, game::sval_u sourcePos, game::sval_u indexSourcePos);
|
||||
unsigned int Scr_GetBuiltin(game::scriptInstance_t inst, game::sval_u func_name);
|
||||
int Scr_GetUncacheType(int type);
|
||||
int Scr_GetCacheType(int type);
|
||||
game::BuiltinFunction Scr_GetFunction(const char** pName, int* type);
|
||||
game::BuiltinFunction GetFunction(game::scriptInstance_t inst, const char** pName, int* type);
|
||||
game::BuiltinMethod GetMethod(game::scriptInstance_t inst, const char** pName, int* type);
|
||||
unsigned int GetVariableName(game::scriptInstance_t inst, unsigned int id);
|
||||
int GetExpressionCount(game::sval_u exprlist);
|
||||
game::sval_u* GetSingleParameter(game::sval_u exprlist);
|
||||
void EmitExpressionFieldObject(game::scriptInstance_t inst, game::sval_u expr, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void EvalInteger(int value, game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
void EvalFloat(float value, game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
void EvalString(unsigned int value, game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
void EvalIString(unsigned int value, game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
void EvalUndefined(game::sval_u sourcePos, game::VariableCompileValue* constValue);
|
||||
void Scr_PopValue(game::scriptInstance_t inst);
|
||||
void EmitSetVariableField(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
void EmitFieldVariableRef(game::scriptInstance_t inst, game::sval_u expr, game::sval_u field, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsArrayPrimitiveExpressionRef(game::sval_u expr, game::scr_block_s* block);
|
||||
BOOL IsUndefinedPrimitiveExpression(game::sval_u expr);
|
||||
bool IsUndefinedExpression(game::sval_u expr);
|
||||
void Scr_CopyBlock(game::scr_block_s* from, game::scr_block_s** to);
|
||||
void Scr_CheckMaxSwitchCases(int count);
|
||||
void Scr_CalcLocalVarsSafeSetVariableField(game::sval_u expr, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void EmitFormalWaittillParameterListRefInternal(game::scriptInstance_t inst, game::sval_u* node, game::scr_block_s* block);
|
||||
void EmitDefaultStatement(game::scriptInstance_t inst, game::sval_u sourcePos);
|
||||
char Scr_IsLastStatement(game::scriptInstance_t inst, game::sval_u* node);
|
||||
void EmitEndStatement(game::scriptInstance_t inst, game::sval_u sourcePos, game::scr_block_s* block);
|
||||
void EmitProfBeginStatement(game::scriptInstance_t inst, game::sval_u profileName, game::sval_u sourcePos);
|
||||
void EmitProfEndStatement(game::scriptInstance_t inst, game::sval_u profileName, game::sval_u sourcePos);
|
||||
void Scr_CalcLocalVarsIncStatement(game::sval_u expr, game::scr_block_s* block);
|
||||
void Scr_CalcLocalVarsWaittillStatement(game::sval_u exprlist, game::scr_block_s* block);
|
||||
void EmitFormalParameterListInternal(game::scriptInstance_t inst, game::sval_u* node, game::scr_block_s* block);
|
||||
unsigned int SpecifyThreadPosition(game::scriptInstance_t inst, unsigned int posId, unsigned int name, unsigned int sourcePos, int type);
|
||||
void Scr_CalcLocalVarsFormalParameterList(game::sval_u exprlist, game::scr_block_s* block);
|
||||
void SetThreadPosition(game::scriptInstance_t inst, unsigned int posId);
|
||||
void EmitIncludeList(game::scriptInstance_t inst, game::sval_u val);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#include <stdinc.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "utils/hook.hpp"
|
||||
//#include "codsrc/clientscript/cscr_compiler.hpp"
|
||||
#include "codsrc/clientscript/cscr_compiler.hpp"
|
||||
|
||||
#ifndef DISABLE_RE_CSCR_COMPILER
|
||||
namespace re_cscr_compiler
|
||||
|
@ -262,4 +262,51 @@ namespace game
|
||||
void EmitInclude(scriptInstance_t inst, sval_u val, void* call_addr = EmitInclude_ADDR());
|
||||
inline void* ScriptCompile_ADDR() { return CALL_ADDR(0x0, 0x688E70); }
|
||||
void ScriptCompile(scriptInstance_t inst, sval_u val, unsigned int filePosId, unsigned int fileCountId, unsigned int scriptId, PrecacheEntry* entries, int entriesCount, void* call_addr = ScriptCompile_ADDR());
|
||||
|
||||
void EmitFloat(scriptInstance_t inst, float value);
|
||||
void EmitCanonicalStringConst(scriptInstance_t inst, unsigned int stringValue);
|
||||
int Scr_FindLocalVar(scr_block_s* block, int startIndex, unsigned int name);
|
||||
void Scr_CheckLocalVarsCount(int localVarsCount);
|
||||
void EmitGetUndefined(scriptInstance_t inst, sval_u sourcePos);
|
||||
void EmitPrimitiveExpression(scriptInstance_t inst, sval_u expr, scr_block_s* block);
|
||||
void Scr_EmitAnimation(scriptInstance_t inst, char* pos, unsigned int animName, unsigned int sourcePos);
|
||||
void EmitEvalArray(scriptInstance_t inst, sval_u sourcePos, sval_u indexSourcePos);
|
||||
void EmitEvalArrayRef(scriptInstance_t inst, sval_u sourcePos, sval_u indexSourcePos);
|
||||
unsigned int Scr_GetBuiltin(scriptInstance_t inst, sval_u func_name);
|
||||
int Scr_GetUncacheType(int type);
|
||||
int Scr_GetCacheType(int type);
|
||||
BuiltinFunction Scr_GetFunction(const char** pName, int* type);
|
||||
BuiltinFunction GetFunction(scriptInstance_t inst, const char** pName, int* type);
|
||||
BuiltinMethod GetMethod(scriptInstance_t inst, const char** pName, int* type);
|
||||
unsigned int GetVariableName(scriptInstance_t inst, unsigned int id);
|
||||
int GetExpressionCount(sval_u exprlist);
|
||||
sval_u* GetSingleParameter(sval_u exprlist);
|
||||
void EmitExpressionFieldObject(scriptInstance_t inst, sval_u expr, sval_u sourcePos, scr_block_s* block);
|
||||
void EvalInteger(int value, sval_u sourcePos, VariableCompileValue* constValue);
|
||||
void EvalFloat(float value, sval_u sourcePos, VariableCompileValue* constValue);
|
||||
void EvalString(unsigned int value, sval_u sourcePos, VariableCompileValue* constValue);
|
||||
void EvalIString(unsigned int value, sval_u sourcePos, VariableCompileValue* constValue);
|
||||
void EvalUndefined(sval_u sourcePos, VariableCompileValue* constValue);
|
||||
void Scr_PopValue(scriptInstance_t inst);
|
||||
void EmitSetVariableField(scriptInstance_t inst, sval_u sourcePos);
|
||||
void EmitFieldVariableRef(scriptInstance_t inst, sval_u expr, sval_u field, sval_u sourcePos, scr_block_s* block);
|
||||
void Scr_CalcLocalVarsArrayPrimitiveExpressionRef(sval_u expr, scr_block_s* block);
|
||||
BOOL IsUndefinedPrimitiveExpression(sval_u expr);
|
||||
bool IsUndefinedExpression(sval_u expr);
|
||||
void Scr_CopyBlock(scr_block_s* from, scr_block_s** to);
|
||||
void Scr_CheckMaxSwitchCases(int count);
|
||||
void Scr_CalcLocalVarsSafeSetVariableField(sval_u expr, sval_u sourcePos, scr_block_s* block);
|
||||
void EmitFormalWaittillParameterListRefInternal(scriptInstance_t inst, sval_u* node, scr_block_s* block);
|
||||
void EmitDefaultStatement(scriptInstance_t inst, sval_u sourcePos);
|
||||
char Scr_IsLastStatement(scriptInstance_t inst, sval_u* node);
|
||||
void EmitEndStatement(scriptInstance_t inst, sval_u sourcePos, scr_block_s* block);
|
||||
void EmitProfBeginStatement(scriptInstance_t inst, sval_u profileName, sval_u sourcePos);
|
||||
void EmitProfEndStatement(scriptInstance_t inst, sval_u profileName, sval_u sourcePos);
|
||||
void Scr_CalcLocalVarsIncStatement(sval_u expr, scr_block_s *block);
|
||||
void Scr_CalcLocalVarsWaittillStatement(sval_u exprlist, scr_block_s* block);
|
||||
void EmitFormalParameterListInternal(scriptInstance_t inst, sval_u* node, scr_block_s* block);
|
||||
unsigned int SpecifyThreadPosition(scriptInstance_t inst, unsigned int posId, unsigned int name, unsigned int sourcePos, int type);
|
||||
void Scr_CalcLocalVarsFormalParameterList(sval_u exprlist, scr_block_s* block);
|
||||
void SetThreadPosition(scriptInstance_t inst, unsigned int posId);
|
||||
void EmitIncludeList(scriptInstance_t inst, sval_u val);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#include <stdinc.hpp>
|
||||
//#include "codsrc/clientscript/cscr_compiler.hpp"
|
||||
#include "codsrc/clientscript/cscr_compiler.hpp"
|
||||
|
||||
namespace game
|
||||
{
|
||||
@ -1480,4 +1480,233 @@ namespace game
|
||||
}
|
||||
}
|
||||
|
||||
void EmitFloat(scriptInstance_t inst, float value)
|
||||
{
|
||||
codsrc::EmitFloat(inst, value);
|
||||
}
|
||||
|
||||
void EmitCanonicalStringConst(scriptInstance_t inst, unsigned int stringValue)
|
||||
{
|
||||
codsrc::EmitCanonicalStringConst(inst, stringValue);
|
||||
}
|
||||
|
||||
int Scr_FindLocalVar(scr_block_s* block, int startIndex, unsigned int name)
|
||||
{
|
||||
return codsrc::Scr_FindLocalVar(block, startIndex, name);
|
||||
}
|
||||
|
||||
void Scr_CheckLocalVarsCount(int localVarsCount)
|
||||
{
|
||||
codsrc::Scr_CheckLocalVarsCount(localVarsCount);
|
||||
}
|
||||
|
||||
void EmitGetUndefined(scriptInstance_t inst, sval_u sourcePos)
|
||||
{
|
||||
codsrc::EmitGetUndefined(inst, sourcePos);
|
||||
}
|
||||
|
||||
void EmitPrimitiveExpression(scriptInstance_t inst, sval_u expr, scr_block_s* block)
|
||||
{
|
||||
codsrc::EmitPrimitiveExpression(inst, expr, block);
|
||||
}
|
||||
|
||||
void Scr_EmitAnimation(scriptInstance_t inst, char* pos, unsigned int animName, unsigned int sourcePos)
|
||||
{
|
||||
codsrc::Scr_EmitAnimation(inst, pos, animName, sourcePos);
|
||||
}
|
||||
|
||||
void EmitEvalArray(scriptInstance_t inst, sval_u sourcePos, sval_u indexSourcePos)
|
||||
{
|
||||
codsrc::EmitEvalArray(inst, sourcePos, indexSourcePos);
|
||||
}
|
||||
|
||||
void EmitEvalArrayRef(scriptInstance_t inst, sval_u sourcePos, sval_u indexSourcePos)
|
||||
{
|
||||
codsrc::EmitEvalArrayRef(inst, sourcePos, indexSourcePos);
|
||||
}
|
||||
|
||||
unsigned int Scr_GetBuiltin(scriptInstance_t inst, sval_u func_name)
|
||||
{
|
||||
return codsrc::Scr_GetBuiltin(inst, func_name);
|
||||
}
|
||||
|
||||
int Scr_GetUncacheType(int type)
|
||||
{
|
||||
return codsrc::Scr_GetUncacheType(type);
|
||||
}
|
||||
|
||||
int Scr_GetCacheType(int type)
|
||||
{
|
||||
return codsrc::Scr_GetCacheType(type);
|
||||
}
|
||||
|
||||
BuiltinFunction Scr_GetFunction(const char** pName, int* type)
|
||||
{
|
||||
return codsrc::Scr_GetFunction(pName, type);
|
||||
}
|
||||
|
||||
BuiltinFunction GetFunction(scriptInstance_t inst, const char** pName, int* type)
|
||||
{
|
||||
return codsrc::GetFunction(inst, pName, type);
|
||||
}
|
||||
|
||||
BuiltinMethod GetMethod(scriptInstance_t inst, const char** pName, int* type)
|
||||
{
|
||||
return codsrc::GetMethod(inst, pName, type);
|
||||
}
|
||||
|
||||
unsigned int GetVariableName(scriptInstance_t inst, unsigned int id)
|
||||
{
|
||||
return codsrc::GetVariableName(inst, id);
|
||||
}
|
||||
|
||||
int GetExpressionCount(sval_u exprlist)
|
||||
{
|
||||
return codsrc::GetExpressionCount(exprlist);
|
||||
}
|
||||
|
||||
sval_u* GetSingleParameter(sval_u exprlist)
|
||||
{
|
||||
return codsrc::GetSingleParameter(exprlist);
|
||||
}
|
||||
|
||||
void EmitExpressionFieldObject(scriptInstance_t inst, sval_u expr, sval_u sourcePos, scr_block_s* block)
|
||||
{
|
||||
codsrc::EmitExpressionFieldObject(inst, expr, sourcePos, block);
|
||||
}
|
||||
|
||||
void EvalInteger(int value, sval_u sourcePos, VariableCompileValue* constValue)
|
||||
{
|
||||
codsrc::EvalInteger(value, sourcePos, constValue);
|
||||
}
|
||||
|
||||
void EvalFloat(float value, sval_u sourcePos, VariableCompileValue* constValue)
|
||||
{
|
||||
codsrc::EvalFloat(value, sourcePos, constValue);
|
||||
}
|
||||
|
||||
void EvalString(unsigned int value, sval_u sourcePos, VariableCompileValue* constValue)
|
||||
{
|
||||
codsrc::EvalString(value, sourcePos, constValue);
|
||||
}
|
||||
|
||||
void EvalIString(unsigned int value, sval_u sourcePos, VariableCompileValue* constValue)
|
||||
{
|
||||
codsrc::EvalIString(value, sourcePos, constValue);
|
||||
}
|
||||
|
||||
void EvalUndefined(sval_u sourcePos, VariableCompileValue* constValue)
|
||||
{
|
||||
codsrc::EvalUndefined(sourcePos, constValue);
|
||||
}
|
||||
|
||||
void Scr_PopValue(scriptInstance_t inst)
|
||||
{
|
||||
codsrc::Scr_PopValue(inst);
|
||||
}
|
||||
|
||||
void EmitSetVariableField(scriptInstance_t inst, sval_u sourcePos)
|
||||
{
|
||||
codsrc::EmitSetVariableField(inst, sourcePos);
|
||||
}
|
||||
|
||||
void EmitFieldVariableRef(scriptInstance_t inst, sval_u expr, sval_u field, sval_u sourcePos, scr_block_s* block)
|
||||
{
|
||||
codsrc::EmitFieldVariableRef(inst, expr, field, sourcePos, block);
|
||||
}
|
||||
|
||||
void Scr_CalcLocalVarsArrayPrimitiveExpressionRef(sval_u expr, scr_block_s* block)
|
||||
{
|
||||
codsrc::Scr_CalcLocalVarsArrayPrimitiveExpressionRef(expr, block);
|
||||
}
|
||||
|
||||
BOOL IsUndefinedPrimitiveExpression(sval_u expr)
|
||||
{
|
||||
return codsrc::IsUndefinedPrimitiveExpression(expr);
|
||||
}
|
||||
|
||||
bool IsUndefinedExpression(sval_u expr)
|
||||
{
|
||||
return codsrc::IsUndefinedExpression(expr);
|
||||
}
|
||||
|
||||
void Scr_CopyBlock(scr_block_s* from, scr_block_s** to)
|
||||
{
|
||||
codsrc::Scr_CopyBlock(from, to);
|
||||
}
|
||||
|
||||
void Scr_CheckMaxSwitchCases(int count)
|
||||
{
|
||||
codsrc::Scr_CheckMaxSwitchCases(count);
|
||||
}
|
||||
|
||||
void Scr_CalcLocalVarsSafeSetVariableField(sval_u expr, sval_u sourcePos, scr_block_s* block)
|
||||
{
|
||||
codsrc::Scr_CalcLocalVarsSafeSetVariableField(expr, sourcePos, block);
|
||||
}
|
||||
|
||||
void EmitFormalWaittillParameterListRefInternal(scriptInstance_t inst, sval_u* node, scr_block_s* block)
|
||||
{
|
||||
codsrc::EmitFormalWaittillParameterListRefInternal(inst, node, block);
|
||||
}
|
||||
|
||||
void EmitDefaultStatement(scriptInstance_t inst, sval_u sourcePos)
|
||||
{
|
||||
codsrc::EmitDefaultStatement(inst, sourcePos);
|
||||
}
|
||||
|
||||
char Scr_IsLastStatement(scriptInstance_t inst, sval_u* node)
|
||||
{
|
||||
return codsrc::Scr_IsLastStatement(inst, node);
|
||||
}
|
||||
|
||||
void EmitEndStatement(scriptInstance_t inst, sval_u sourcePos, scr_block_s* block)
|
||||
{
|
||||
codsrc::EmitEndStatement(inst, sourcePos, block);
|
||||
}
|
||||
|
||||
void EmitProfBeginStatement(scriptInstance_t inst, sval_u profileName, sval_u sourcePos)
|
||||
{
|
||||
codsrc::EmitProfBeginStatement(inst, profileName, sourcePos);
|
||||
}
|
||||
|
||||
void EmitProfEndStatement(scriptInstance_t inst, sval_u profileName, sval_u sourcePos)
|
||||
{
|
||||
codsrc::EmitProfEndStatement(inst, profileName, sourcePos);
|
||||
}
|
||||
|
||||
void Scr_CalcLocalVarsIncStatement(sval_u expr, scr_block_s* block)
|
||||
{
|
||||
codsrc::Scr_CalcLocalVarsIncStatement(expr, block);
|
||||
}
|
||||
|
||||
void Scr_CalcLocalVarsWaittillStatement(sval_u exprlist, scr_block_s* block)
|
||||
{
|
||||
codsrc::Scr_CalcLocalVarsWaittillStatement(exprlist, block);
|
||||
}
|
||||
|
||||
void EmitFormalParameterListInternal(scriptInstance_t inst, sval_u* node, scr_block_s* block)
|
||||
{
|
||||
codsrc::EmitFormalParameterListInternal(inst, node, block);
|
||||
}
|
||||
|
||||
unsigned int SpecifyThreadPosition(scriptInstance_t inst, unsigned int posId, unsigned int name, unsigned int sourcePos, int type)
|
||||
{
|
||||
return codsrc::SpecifyThreadPosition(inst, posId, name, sourcePos, type);
|
||||
}
|
||||
|
||||
void Scr_CalcLocalVarsFormalParameterList(sval_u exprlist, scr_block_s* block)
|
||||
{
|
||||
codsrc::Scr_CalcLocalVarsFormalParameterList(exprlist, block);
|
||||
}
|
||||
|
||||
void SetThreadPosition(scriptInstance_t inst, unsigned int posId)
|
||||
{
|
||||
codsrc::SetThreadPosition(inst, posId);
|
||||
}
|
||||
|
||||
void EmitIncludeList(scriptInstance_t inst, sval_u val)
|
||||
{
|
||||
codsrc::EmitIncludeList(inst, val);
|
||||
}
|
||||
}
|
||||
|
@ -203,6 +203,22 @@ namespace game
|
||||
return answer;
|
||||
}
|
||||
|
||||
// BuiltinMethod __usercall Scr_GetMethod@<eax>(int *type@<edi>, const char **pName@<esi>)
|
||||
BuiltinMethod Scr_GetMethod(int* type_, const char** pName, void* call_addr)
|
||||
{
|
||||
BuiltinMethod answer;
|
||||
|
||||
__asm
|
||||
{
|
||||
mov edi, type_;
|
||||
mov esi, pName;
|
||||
call call_addr;
|
||||
mov answer, eax;
|
||||
}
|
||||
|
||||
return answer;
|
||||
}
|
||||
|
||||
void Cmd_AddCommand(const char* name, void (__cdecl *function)())
|
||||
{
|
||||
cmd_function_s* newCmd = utils::memory::allocate<cmd_function_s>();
|
||||
|
@ -36,6 +36,11 @@ namespace game
|
||||
WEAK symbol<void* (void* Block, size_t Size)>_realloc{ 0x0, 0x7AECAC };
|
||||
WEAK symbol<void* (size_t Size)>Z_TryMalloc{ 0x0, 0x7AAD36 };
|
||||
|
||||
WEAK symbol<BuiltinFunction(const char** pName)>Sentient_GetFunction{ 0x0, 0x5676F0 };
|
||||
WEAK symbol<BuiltinFunction(const char** pName, int* type_1)>BuiltIn_GetFunction{ 0x0, 0x52F0B0 };
|
||||
WEAK symbol<BuiltinFunction(const char** pName, int* type)>CScr_GetFunction{ 0x0, 0x66EA30 };
|
||||
WEAK symbol<BuiltinMethod(const char** pName, int* type)>CScr_GetMethod{ 0x0, 0x671110 };
|
||||
|
||||
inline void* I_strncmp_ADDR() { return CALL_ADDR(0x0, 0x5F6A40); }
|
||||
int I_strncmp(const char* str1, const char* str2, int len, void* call_addr = I_strncmp_ADDR());
|
||||
|
||||
@ -67,6 +72,9 @@ namespace game
|
||||
cmd_function_s* Cmd_FindCommand(const char* cmdName, void* call_addr = Cmd_FindCommand_ADDR());
|
||||
void Cmd_AddCommand(const char* name, void(__cdecl* function)());
|
||||
|
||||
inline void* Scr_GetMethod_ADDR() { return CALL_ADDR(0x0, 0x530630); }
|
||||
BuiltinMethod Scr_GetMethod(int* type_, const char** pName, void* call_addr = Scr_GetMethod_ADDR());
|
||||
|
||||
void Sys_EnterCriticalSection(CriticalSection critSect);
|
||||
void Sys_LeaveCriticalSection(CriticalSection critSect);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user