Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dhewm3 on 64bit Big Endian platforms like PPC64 BE #626

Merged
merged 5 commits into from
Nov 7, 2024

Commits on Oct 31, 2024

  1. ImGui: Use base85-compressed font

    instead of whatever other compression was used there.
    Fixes crash on Big Endian systems (dhewm#625)
    DanielGibson committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    21f2e3a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    af13c20 View commit details
    Browse the repository at this point in the history
  3. idClass::operator new() and delete: align to intptr_t

    to avoid unaligned reads from class members of idClass or its
    derived classes
    DanielGibson committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    fb3f0cc View commit details
    Browse the repository at this point in the history
  4. idInterpreter::Call(Sys)Event(): Fix passing integers

    All that code is kinda obfuscated, but the integer passing was plain
    wrong (if sizeof(int) != sizeof(intptr_t), esp. noticeable on
     Big Endian).
    data[i] is used by Callbacks.cpp, and for everything but floats it's
    passed directly as an argument (interpreted as either an integer or
    a pointer to idVec3 or whatever).
    So storing an int in there with `( *( int * )&data[ i ] ) = int(...)`
    only sets the first 4 bytes of that intptr_t, which is 8 bytes on 64bit
    machines. On Little Endian that just happens to work, on Big Endian
    it's the wrong 4 bytes.
    DanielGibson committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    76a9fdc View commit details
    Browse the repository at this point in the history
  5. Fix script interpreter on 64bit Big Endian platforms

    idInterpreter::Push() is used only for int and (reinterpreted) float
    values, not pointers (as far as I can tell), so 32bit values on all
    relevant platforms.
    It stored its value as intptr_t at `&localstack[ localstackUsed ]` - on
    64bit platforms intptr_t is 64bit.
    Unfortunately, all code reading from the stack just get got a pointer
    to `&localstack[ localstackUsed ]` in the type they want to read
    (like `int*` or `float*`) and read that. On Little Endian that happens
    to work, on 64bit Big Endian it reads the wrong 4 bytes of the intptr_t,
    so it doesn't work.
    
    fixes dhewm#625, dhewm#472
    DanielGibson committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    3ad384a View commit details
    Browse the repository at this point in the history