mirror of
				https://github.com/JezuzLizard/T4SP-Server-Plugin.git
				synced 2025-10-31 09:46:58 +00:00 
			
		
		
		
	Add yyac code
This commit is contained in:
		| @@ -9,3 +9,4 @@ | ||||
| #include "cscr_tempmemory.hpp" | ||||
| #include "cscr_variable.hpp" | ||||
| #include "cscr_vm.hpp" | ||||
| #include "cscr_yacc.hpp" | ||||
|   | ||||
							
								
								
									
										2058
									
								
								src/codsrc/clientscript/cscr_yacc.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2058
									
								
								src/codsrc/clientscript/cscr_yacc.cpp
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										21
									
								
								src/codsrc/clientscript/cscr_yacc.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/codsrc/clientscript/cscr_yacc.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| #pragma once | ||||
|  | ||||
| namespace codsrc | ||||
| { | ||||
| 	unsigned int LowerCase(unsigned int strVal); | ||||
| 	int yyparse(); | ||||
| 	int StringValue(int len, const char* str); | ||||
| 	int yylex(); | ||||
| 	int yy_get_next_buffer(); | ||||
| 	int yy_get_previous_state(); | ||||
| 	int yy_try_NUL_trans(int yy_current_state); | ||||
| 	void yyrestart(); | ||||
| 	game::yy_buffer_state* yy_create_buffer(); | ||||
| 	void yy_flush_buffer(game::yy_buffer_state* result); | ||||
| 	void ScriptParse(game::scriptInstance_t a1, game::sval_u* parseData); | ||||
|  | ||||
| 	FILE* yy_load_buffer_state(); | ||||
| 	void yy_fatal_error(const char* err); | ||||
| 	void* yy_flex_realloc(void* ptr, unsigned int size); | ||||
| 	void yy_init_buffer(game::yy_buffer_state* b, FILE* file); | ||||
| } | ||||
| @@ -1,7 +1,7 @@ | ||||
| #include <stdinc.hpp> | ||||
| #include "loader/component_loader.hpp" | ||||
| #include "utils/hook.hpp" | ||||
| //#include "codsrc/clientscript/cscr_yacc.hpp" | ||||
| #include "codsrc/clientscript/cscr_yacc.hpp" | ||||
|  | ||||
| #ifndef DISABLE_RE_CSCR_YACC | ||||
| namespace re_cscr_yacc | ||||
| @@ -38,7 +38,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return game::LowerCase(strVal, LowerCase_original); | ||||
| #else | ||||
| 			return cscr_yacc::LowerCase(strVal); | ||||
| 			return codsrc::LowerCase(strVal); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -59,7 +59,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return yyparse_hook.invoke<int>(); | ||||
| #else | ||||
| 			return cscr_yacc::yyparse(); | ||||
| 			return codsrc::yyparse(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -68,7 +68,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return game::StringValue(len, str_, StringValue_original); | ||||
| #else | ||||
| 			return cscr_yacc::StringValue(len, str_); | ||||
| 			return codsrc::StringValue(len, str_); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -90,7 +90,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return yylex_hook.invoke<int>(); | ||||
| #else | ||||
| 			return cscr_yacc::yylex(); | ||||
| 			return codsrc::yylex(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -99,7 +99,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return yy_get_next_buffer_hook.invoke<int>(); | ||||
| #else | ||||
| 			return cscr_yacc::yy_get_next_buffer(); | ||||
| 			return codsrc::yy_get_next_buffer(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -108,7 +108,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return yy_get_previous_state_hook.invoke<int>(); | ||||
| #else | ||||
| 			return cscr_yacc::yy_get_previous_state(); | ||||
| 			return codsrc::yy_get_previous_state(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -117,7 +117,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return game::yy_try_NUL_trans(yy_current_state, yy_try_NUL_trans_original); | ||||
| #else | ||||
| 			return cscr_yacc::yy_try_NUL_trans(yy_current_state); | ||||
| 			return codsrc::yy_try_NUL_trans(yy_current_state); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -138,7 +138,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			yyrestart_hook.invoke<void>(); | ||||
| #else | ||||
| 			cscr_yacc::yyrestart(); | ||||
| 			codsrc::yyrestart(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -147,7 +147,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			return yy_create_buffer_hook.invoke<game::yy_buffer_state *>(); | ||||
| #else | ||||
| 			return cscr_yacc::yy_create_buffer(); | ||||
| 			return codsrc::yy_create_buffer(); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -156,7 +156,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			game::yy_flush_buffer(result, yy_flush_buffer_original); | ||||
| #else | ||||
| 			cscr_yacc::yy_flush_buffer(result); | ||||
| 			codsrc::yy_flush_buffer(result); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
| @@ -177,7 +177,7 @@ namespace re_cscr_yacc | ||||
| #ifdef RE_CSCR_YACC_USE_WRAPPERS | ||||
| 			game::ScriptParse(a1, parseData, ScriptParse_original); | ||||
| #else | ||||
| 			cscr_yacc::ScriptParse(a1, parseData); | ||||
| 			codsrc::ScriptParse(a1, parseData); | ||||
| #endif | ||||
| 		} | ||||
|  | ||||
|   | ||||
| @@ -19,4 +19,9 @@ namespace game | ||||
| 	void yy_flush_buffer(yy_buffer_state* result, void* call_addr = yy_flush_buffer()); | ||||
| 	inline void* ScriptParse() { return CALL_ADDR(0x0, 0x69D710); } | ||||
| 	void ScriptParse(scriptInstance_t a1, sval_u* parseData, void* call_addr = ScriptParse()); | ||||
|  | ||||
| 	FILE* yy_load_buffer_state(); | ||||
| 	void yy_fatal_error(const char* err); | ||||
| 	void* yy_flex_realloc(void* ptr, unsigned int size); | ||||
| 	void yy_init_buffer(yy_buffer_state* b, FILE* file); | ||||
| } | ||||
| @@ -1,5 +1,5 @@ | ||||
| #include <stdinc.hpp> | ||||
| //#include "codsrc/clientscript/cscr_yacc.hpp" | ||||
| #include "codsrc/clientscript/cscr_yacc.hpp" | ||||
|  | ||||
| namespace game | ||||
| { | ||||
| @@ -70,4 +70,24 @@ namespace game | ||||
| 			add esp, 0x4; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	FILE* yy_load_buffer_state() | ||||
| 	{ | ||||
| 		return codsrc::yy_load_buffer_state(); | ||||
| 	} | ||||
|  | ||||
| 	void yy_fatal_error(const char* err) | ||||
| 	{ | ||||
| 		codsrc::yy_fatal_error(err); | ||||
| 	} | ||||
|  | ||||
| 	void* yy_flex_realloc(void* ptr, unsigned int size) | ||||
| 	{ | ||||
| 		return codsrc::yy_flex_realloc(ptr, size); | ||||
| 	} | ||||
|  | ||||
| 	void yy_init_buffer(yy_buffer_state* b, FILE* file) | ||||
| 	{ | ||||
| 		codsrc::yy_init_buffer(b, file); | ||||
| 	} | ||||
| } | ||||
| @@ -31,7 +31,7 @@ | ||||
| //#define RE_CSCR_STRINGLIST_USE_WRAPPERS | ||||
| //#define RE_CSCR_VARIABLE_USE_WRAPPERS | ||||
| //#define RE_CSCR_VM_USE_WRAPPERS | ||||
| #define RE_CSCR_YACC_USE_WRAPPERS | ||||
| //#define RE_CSCR_YACC_USE_WRAPPERS | ||||
|  | ||||
| //#define DISABLE_RE_CSCR_YACC | ||||
| //#define DISABLE_RE_CSCR_COMPILER | ||||
|   | ||||
| @@ -28,6 +28,14 @@ namespace game | ||||
|  | ||||
| 	WEAK symbol<void(char* Destination, const char* Source, size_t Count)>I_strncpyz{ 0x0, 0x7AA9C0 }; | ||||
|  | ||||
| 	WEAK symbol<_iobuf* ()>__iob_func{ 0x0, 0x7AE0DE }; | ||||
| 	WEAK symbol<size_t(const void* Buffer, size_t ElementSize, size_t ElementCount, FILE* Stream)>_fwrite{ 0x0, 0x7ACBDA }; | ||||
| 	WEAK symbol<int(const char* const Buffer, const char* const Format, ...)>_sscanf{ 0x0, 0x7AB559 }; | ||||
| 	WEAK symbol<int(FILE* const Stream, const char* const Format, ...)>_fprintf{ 0x0, 0x7AE406 }; | ||||
| 	WEAK symbol<void(int Code)>_exit{ 0x0, 0x7AC431 }; | ||||
| 	WEAK symbol<void* (void* Block, size_t Size)>_realloc{ 0x0, 0x7AECAC }; | ||||
| 	WEAK symbol<void* (size_t Size)>Z_TryMalloc{ 0x0, 0x7AAD36 }; | ||||
|  | ||||
| 	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()); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user