42 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:Hacker_RegApi.nut
 | |
| 路径:Base/_Tool/Hacker_RegApi.nut
 | |
| 创建日期:2024-09-25	18:31
 | |
| 文件用途:注册API
 | |
| */
 | |
| //工具类
 | |
| class R_Utils {
 | |
| 
 | |
|     //播放音效
 | |
|     function PlaySound(SoundName) {
 | |
|         L_Sq_CallFunc(0x75BD70, "void", FFI_MS_CDECL, ["pointer", "int", "int", "int"], Memory.allocUtf8String(SoundName).C_Object, -1, 0, 0);
 | |
|     }
 | |
| 
 | |
|     //读取文件内容
 | |
|     function ReadScript(Path, Size, CodePage) {
 | |
|         local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object);
 | |
|         local Reader = Memory.alloc(Size);
 | |
|         local ReadBuffer = L_sq_P2I(Reader.C_Object);
 | |
|         L_Sq_CallFunc(0x11A2030, "int", FFI_FASTCALL, ["int", "int", "int", "int", "int", "int"], 0x1D17638, 0, ReadPath, ReadBuffer, 0x100000, 0x19DAF4);
 | |
| 
 | |
| 
 | |
|         if (CodePage == "utf8")
 | |
|             return Reader.readUtf8String();
 | |
|         if (CodePage == "unicode")
 | |
|             return Reader.readUnicodeString();
 | |
|         if (CodePage == "big5")
 | |
|             return Reader.readBig5String();
 | |
|     }
 | |
| 
 | |
|     //读取配置表
 | |
|     function ReadScriptConfig(Path, Size, ...) {
 | |
|         local CodePage = "utf8";
 | |
|         if (vargc > 0) CodePage = vargv[0];
 | |
|         local Script = R_Utils.ReadScript(Path, Size, CodePage);
 | |
|         local Func = compilestring("return  " + Script);
 | |
|         local Ret = Func();
 | |
|         return Ret;
 | |
|     }
 | |
| 
 | |
| 
 | |
| } |