12312
This commit is contained in:
@@ -774,7 +774,7 @@ void Lenheart()
|
||||
// 创建角色创建技能
|
||||
// SUBHOOK_SETUP(CreateSkill);
|
||||
// 创建角色创建装备
|
||||
// SUBHOOK_SETUP(CreateEquip);
|
||||
SUBHOOK_SETUP(CreateEquip);
|
||||
// 使用金币
|
||||
// SUBHOOK_SETUP(UseGlod);
|
||||
// BOSS死亡
|
||||
|
||||
@@ -1,32 +1,54 @@
|
||||
#include "l_squirrel.h"
|
||||
#include "l_squirrel_register.hpp"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
// 虚拟机对象
|
||||
HSQUIRRELVM v;
|
||||
// Lock
|
||||
std::recursive_mutex SqMtx;
|
||||
|
||||
// static void printfunc(HSQUIRRELVM v, const SQChar *s, ...)
|
||||
// {
|
||||
// fflush(stdout);
|
||||
// va_list vl;
|
||||
// va_start(vl, s);
|
||||
// scvprintf(stdout, s, vl);
|
||||
// va_end(vl);
|
||||
// printf("\n");
|
||||
// fflush(stdout);
|
||||
// }
|
||||
static void printfunc(HSQUIRRELVM v, const SQChar *s, ...)
|
||||
{
|
||||
fflush(stdout);
|
||||
va_list vl;
|
||||
va_start(vl, s);
|
||||
scvprintf(stdout, s, vl);
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), s, vl);
|
||||
va_end(vl);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
|
||||
spdlog::info(buf);
|
||||
}
|
||||
|
||||
// static void errorfunc(HSQUIRRELVM v, const SQChar *s, ...)
|
||||
// {
|
||||
// fflush(stderr);
|
||||
// va_list vl;
|
||||
// va_start(vl, s);
|
||||
// scvprintf(stderr, s, vl);
|
||||
// va_end(vl);
|
||||
// printf("\n");
|
||||
// fflush(stderr);
|
||||
// }
|
||||
static void errorfunc(HSQUIRRELVM v, const SQChar *s, ...)
|
||||
{
|
||||
fflush(stderr);
|
||||
va_list vl;
|
||||
va_start(vl, s);
|
||||
scvprintf(stderr, s, vl);
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), s, vl);
|
||||
va_end(vl);
|
||||
printf("\n");
|
||||
fflush(stderr);
|
||||
|
||||
spdlog::error(buf);
|
||||
}
|
||||
|
||||
// 加密函数
|
||||
static std::string encryptDecrypt(const std::string &input, const std::string &key)
|
||||
{
|
||||
@@ -141,6 +163,8 @@ void InitSquirrel()
|
||||
sqstd_register_stringlib(v);
|
||||
sqstd_seterrorhandlers(v);
|
||||
|
||||
// 设置日志格式
|
||||
spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] %v");
|
||||
sq_setprintfunc(v, printfunc, errorfunc); // sets the print function
|
||||
|
||||
// 输出版本信息
|
||||
|
||||
Reference in New Issue
Block a user