question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

There’s a few methods in there which don’t use native functions, but access memory to change stuff. One of those is setting a headlight damage status:

void Vehicle::LeftHeadLightBroken::set(bool value) {
    unsigned char *const address = reinterpret_cast<unsigned char *>(Native::MemoryAccess::GetAddressOfEntity(Handle));
    if (address == nullptr) {
        return;
    }

    const unsigned char mask = 1 << 0;

    if (value) {
        *(address + 1916) |= mask;
    }
    else {
        *(address + 1916) &= ~mask;
    }
}

Now, I get the basic gist of it, but how did you discover this specific offset of 1916 bytes(?) to damage the headlights? Is there any other documentation available for what I think is a Vehicle struct? Specifically, I want to find out what damages the wheels such that the suspension lowers.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
njames93commented, May 15, 2016

I know it’s old but the head light setter was made from reversing the head light getter native

0reactions
ikt32commented, Oct 1, 2016

Ah, I think I’ll stick to the CheatEngine + experimental poking around then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Offset (computer science)
In computer science, an offset within an array or other data structure object is an integer indicating the distance (displacement) between the beginning...
Read more >
assembly - Memory address and offset
Memory address and offset ... I have a noob questions about how memory address stores values. For example, addr +0 +1 +2 +3...
Read more >
What is offset in computer memory function?
The base address, in this case, is the location the of the person right now, and the offset is the number of houses...
Read more >
Memory Segment - Offset - (Relative|Effective) address
The offset is the second part of a logical address that permits to locate an Address inside a memory segment A offset is...
Read more >
[Help] What are offsets and why do i need them?
An offset is simply the distance between a known memory address and the memory address of the value or data structure you want...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found