Skip to content

Commit

Permalink
t8 vm34 impl
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Jan 12, 2025
1 parent ec4ca68 commit d933b2c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ My set of tools. The code is more important than the features, so feel free to r
| Black Ops 3 (T7) | 1B | Partial || pc | [ate47/bo3-source](https://github.com/ate47/bo3-source) |
| Black Ops 3 (T7) | 1C ||| pc,ps4 | [ate47/bo3-source](https://github.com/ate47/bo3-source) |
| Black Ops 4 (T8) | 31 | Partial || ps4 | None |
| Black Ops 4 (T8) | 34 | Partial | | ps4 | None |
| Black Ops 4 (T8) | 34 | | | ps4 | None |
| Black Ops 4 (T8) | 35 | Partial || pc | None |
| Black Ops 4 (T8) | 36 ||| pc,ps4 | [ate47/bo4-source](https://github.com/ate47/bo4-source) |
| Black Ops Cold War (T9) | 37 | Dc || pc,ps4,alpha| [ate47/bocw-source](https://github.com/ate47/bocw-source) |
Expand Down
40 changes: 28 additions & 12 deletions src/acts/tools/gsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,22 @@ int GSCOBJHandler::PatchCode(T8GSCOBJContext& ctx) {
for (size_t i = 0; i < string_count; i++) {

const auto* str = reinterpret_cast<T8GSCString*>(str_location);
char* cstr = Ptr<char>(str->string);
const char* rcstr;
if (str->string) {
char* cstr = Ptr<char>(str->string);

if (!ctx.opt.m_noStrDecrypt) {
cstr = DecryptString(cstr);
if (!ctx.opt.m_noStrDecrypt) {
cstr = DecryptString(cstr);
}
rcstr = cstr;
}
else {
rcstr = "<invalid>";
}
if (gDumpStrings) {
gDumpStringsStore.insert(cstr);
gDumpStringsStore.insert(rcstr);
}
uint32_t ref = ctx.AddStringValue(cstr);
uint32_t ref = ctx.AddStringValue(rcstr);

const auto* strings = reinterpret_cast<const uint32_t*>(&str[1]);
for (size_t j = 0; j < str->num_address; j++) {
Expand Down Expand Up @@ -831,14 +838,21 @@ int GSCOBJHandler::PatchCode(T8GSCOBJContext& ctx) {
for (size_t i = 0; i < string_count; i++) {

const auto* str = reinterpret_cast<T8GSCString*>(str_location);
char* cstr = Ptr<char>(str->string);
if (!ctx.opt.m_noStrDecrypt) {
cstr = DecryptString(cstr);
const char* rcstr;
if (str->string) {
char* cstr = Ptr<char>(str->string);
if (!ctx.opt.m_noStrDecrypt) {
cstr = DecryptString(cstr);
}
rcstr = cstr;
}
else {
rcstr = "<invalid>";
}
if (gDumpStrings) {
gDumpStringsStore.insert(cstr);
gDumpStringsStore.insert(rcstr);
}
uint32_t ref = ctx.AddStringValue(cstr);
uint32_t ref = ctx.AddStringValue(rcstr);

const auto* strings = reinterpret_cast<const uint32_t*>(&str[1]);
for (size_t j = 0; j < str->num_address; j++) {
Expand All @@ -849,7 +863,9 @@ int GSCOBJHandler::PatchCode(T8GSCOBJContext& ctx) {
}

//Ref<uint32_t>(strings[j]) = ref;
ctx.AddStringRef(strings[j], ref);
if (str->string || !ctx.GetStringValueByLoc(strings[j])) {
ctx.AddStringRef(strings[j], ref);
}
}
str_location += sizeof(*str) + sizeof(*strings) * str->num_address;
}
Expand Down Expand Up @@ -3069,7 +3085,7 @@ int tool::gsc::DumpVTable(GSCExportReader& exp, std::ostream& out, GSCOBJHandler

if (!AssertOpCode(OPCODE_GetZero)) return DVA_BAD;

if (gscFile.GetMagic() > VMI_T834) {
if (gscFile.GetMagic() > VMI_T8) {
if (!AssertOpCode(OPCODE_T9_EvalFieldVariableFromGlobalObject)) return DVA_BAD;
ctx.Aligned<uint16_t>() += 2; // - classes
}
Expand Down
2 changes: 1 addition & 1 deletion src/acts/tools/gsc_vm/vm_t8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ namespace {
return sizeof(T8GSCOBJ);
}
char* DecryptString(char* str) override {
return acts::decryptutils::DecryptStringT8(str);
return acts::decryptutils::DecryptString(str);
}
bool IsValidHeader(size_t size) override {
return size >= sizeof(T8GSCOBJ) && Ref<uint64_t>() == 0x34000a0d43534780;
Expand Down
Loading

0 comments on commit d933b2c

Please sign in to comment.