Compare commits

..

11 Commits
v1.3.5 ... main

Author SHA1 Message Date
fed
1061c08829
Merge pull request #92 from fedddddd/dependabot/submodules/deps/GSL-b39e7e4
Bump deps/GSL from `f1a494c` to `b39e7e4`
2024-03-07 21:40:03 +01:00
dependabot[bot]
c75cf561f7
Bump deps/GSL from f1a494c to b39e7e4
Bumps [deps/GSL](https://github.com/microsoft/GSL) from `f1a494c` to `b39e7e4`.
- [Release notes](https://github.com/microsoft/GSL/releases)
- [Commits](f1a494cfd2...b39e7e4b09)

---
updated-dependencies:
- dependency-name: deps/GSL
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-27 14:30:40 +00:00
fed
3ea6050498
Merge pull request #89 from fedddddd/dependabot/submodules/deps/zlib-5c42a23
Bump deps/zlib from `e342bb3` to `5c42a23`
2024-02-12 17:19:02 +01:00
dependabot[bot]
1551d7f1fd
Bump deps/zlib from e342bb3 to 5c42a23
Bumps [deps/zlib](https://github.com/madler/zlib) from `e342bb3` to `5c42a23`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](e342bb3dae...5c42a230b7)

---
updated-dependencies:
- dependency-name: deps/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-12 14:10:29 +00:00
fed
bf1d649bc1
Merge pull request #83 from fedddddd/dependabot/submodules/deps/GSL-f1a494c
Bump deps/GSL from `e64c97f` to `f1a494c`
2024-02-07 18:55:06 +01:00
fed
71727a5197
Merge pull request #82 from fedddddd/dependabot/submodules/deps/json-0457de2
Bump deps/json from `3780b41` to `0457de2`
2024-02-07 18:54:58 +01:00
fed
530cd10466
Merge pull request #85 from fedddddd/dependabot/submodules/deps/zlib-e342bb3
Bump deps/zlib from `643e17b` to `e342bb3`
2024-02-07 18:54:52 +01:00
fed
978e251df8
Fixes for update 2024-02-07 18:52:23 +01:00
dependabot[bot]
cb96052638
Bump deps/zlib from 643e17b to e342bb3
Bumps [deps/zlib](https://github.com/madler/zlib) from `643e17b` to `e342bb3`.
- [Release notes](https://github.com/madler/zlib/releases)
- [Commits](643e17b749...e342bb3dae)

---
updated-dependencies:
- dependency-name: deps/zlib
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-07 14:11:12 +00:00
dependabot[bot]
9b217b20e3
Bump deps/GSL from e64c97f to f1a494c
Bumps [deps/GSL](https://github.com/microsoft/GSL) from `e64c97f` to `f1a494c`.
- [Release notes](https://github.com/microsoft/GSL/releases)
- [Commits](e64c97fc2c...f1a494cfd2)

---
updated-dependencies:
- dependency-name: deps/GSL
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-30 15:02:59 +00:00
dependabot[bot]
136a723187
Bump deps/json from 3780b41 to 0457de2
Bumps [deps/json](https://github.com/nlohmann/json) from `3780b41` to `0457de2`.
- [Release notes](https://github.com/nlohmann/json/releases)
- [Commits](3780b41dd0...0457de21cf)

---
updated-dependencies:
- dependency-name: deps/json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-30 15:02:56 +00:00
10 changed files with 37 additions and 21 deletions

2
deps/GSL vendored

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

2
deps/json vendored

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

2
deps/zlib vendored

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

View File

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

View File

@ -35,11 +35,18 @@ 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;
} }
}); });
@ -70,7 +77,6 @@ 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;