Compare commits

..

No commits in common. "main" and "v1.3.5" have entirely different histories.
main ... v1.3.5

10 changed files with 21 additions and 37 deletions

2
deps/GSL vendored

@ -1 +1 @@
Subproject commit b39e7e4b0987859f5b19ff7686b149c916588658 Subproject commit e64c97fc2cfc11992098bb38eda932de275e3f4d

2
deps/json vendored

@ -1 +1 @@
Subproject commit 0457de21cffb298c22b629e538036bfeb96130b7 Subproject commit 3780b41dd070436f3f55327b0a88f27a52e2dfa8

2
deps/zlib vendored

@ -1 +1 @@
Subproject commit 5c42a230b7b468dff011f444161c0145b5efae59 Subproject commit 643e17b7498d12ab8d15565662880579692f769d

View File

@ -248,21 +248,16 @@ namespace gsc
{ {
void add(const std::string& name, const script_function& func) void add(const std::string& name, const script_function& func)
{ {
auto index = 0u; try
auto& ctx = (*game::plutonium::gsc_ctx);
if (ctx->func_exists(name))
{ {
printf("[iw5-gsc-utils] Warning: function '%s' already defined\n", name.data()); const auto index = function_map_start++;
index = ctx->func_id(name); functions[index] = func;
(*game::plutonium::gsc_ctx)->func_add(name, index);
} }
else catch (const std::exception& e)
{ {
index = function_map_start++; printf("[iw5-gsc-utils] failed to add function \"%s\": %s\n", name.data(), e.what());
ctx->func_add(name, index);
} }
functions.insert(std::make_pair(index, func));
} }
} }
@ -270,21 +265,16 @@ namespace gsc
{ {
void add(const std::string& name, const script_method& func) void add(const std::string& name, const script_method& func)
{ {
auto index = 0u; try
auto& ctx = (*game::plutonium::gsc_ctx);
if (ctx->meth_exists(name))
{ {
printf("[iw5-gsc-utils] Warning: method '%s' already defined\n", name.data()); const auto index = method_map_start++;
index = ctx->meth_id(name); methods[index] = func;
(*game::plutonium::gsc_ctx)->meth_add(name, index);
} }
else catch (const std::exception& e)
{ {
index = method_map_start++; printf("[iw5-gsc-utils] failed to add method \"%s\": %s\n", name.data(), e.what());
ctx->meth_add(name, index);
} }
methods.insert(std::make_pair(index, func));
} }
} }

View File

@ -179,4 +179,4 @@ namespace io
}; };
} }
REGISTER_COMPONENT(io::component) REGISTER_COMPONENT(io::component)

View File

@ -194,4 +194,4 @@ namespace json
}; };
} }
REGISTER_COMPONENT(json::component) REGISTER_COMPONENT(json::component)

View File

@ -71,4 +71,4 @@ namespace notifies
}; };
} }
REGISTER_COMPONENT(notifies::component) REGISTER_COMPONENT(notifies::component)

View File

@ -136,4 +136,4 @@ namespace scripting
}; };
} }
REGISTER_COMPONENT(scripting::component) REGISTER_COMPONENT(scripting::component)

View File

@ -35,18 +35,11 @@ namespace signatures
const auto base = reinterpret_cast<size_t>(GetModuleHandle("plutonium-bootstrapper-win32.exe")); const auto base = reinterpret_cast<size_t>(GetModuleHandle("plutonium-bootstrapper-win32.exe"));
utils::hook::signature signature(base, get_image_size() - base); utils::hook::signature signature(base, get_image_size() - base);
auto found = false;
signature.add({ signature.add({
string, string,
mask, mask,
[&](char* address) [&](char* address)
{ {
if (found)
{
return;
}
found = true;
string_ptr = address; string_ptr = address;
} }
}); });
@ -77,6 +70,7 @@ namespace signatures
} }
const auto gsc_ctx_ptr = *reinterpret_cast<size_t*>(string_ref - 0xAD); const auto gsc_ctx_ptr = *reinterpret_cast<size_t*>(string_ref - 0xAD);
OutputDebugString(utils::string::va("string_ref: %p\n", string_ref));
OutputDebugString(utils::string::va("gsc_ctx_ptr: %p\n", gsc_ctx_ptr)); OutputDebugString(utils::string::va("gsc_ctx_ptr: %p\n", gsc_ctx_ptr));
game::plutonium::gsc_ctx.set(gsc_ctx_ptr); game::plutonium::gsc_ctx.set(gsc_ctx_ptr);
return true; return true;

View File

@ -193,4 +193,4 @@ namespace userinfo
}; };
} }
REGISTER_COMPONENT(userinfo::component) REGISTER_COMPONENT(userinfo::component)