blt4linux / blt4l

PAYDAY 2 SteamOS/Linux LUA loader.
Other
57 stars 14 forks source link

See if creating a SuperBLT4L hook is possible [Enhancement?] #99

Closed dribbleondo closed 6 years ago

dribbleondo commented 6 years ago

More info here

Might be beneficial as it allows for xml changes without the need for .pdmod patching, as well as OGG support for music (though I feel that may never happen on Linux...)

ZNixian commented 6 years ago

This is something I've been getting around to doing. I made sure to base the XAudio stuff (name is only coincidental with the DirectX audio system) off OpenAL specifically for this purpose.

I initially did all my research/early prototyping on GNU+Linux, and then ported it over to Windows, thanks to the binaries not being stripped on GNU+Linux.

I'll do some work on separating the SuperBLT stuff from the rest of BLT4W, as I have used very little (if any) windows-specific stuff in there.

dribbleondo commented 6 years ago

Awesome. Glad someone is looking into it =)

RomanHargrave commented 6 years ago

I'll hopefully be able to sit down and catch up next week. So i can definitely look at this and see what needs to be added for proper support.

ZNixian commented 6 years ago

I've done quite a bit of work building headers on many of the relevant classes, so I'll throw them on the wiki at some point.

Edit: Wrong thread, thought this was on the reconnaissance repo.

RomanHargrave commented 6 years ago

Adding the headers to the include directory in blt4l would probably be a good idea.

Kazenin commented 6 years ago

How to compile on Linux??

ZNixian commented 6 years ago

Progress update: I've separated out (with the exception of the debugging module, which uses Winsock and I haven't been bothered to look at yet) all the windows-specific code in SuperBLT is moved into it's own module; I'll try merging it and the relevant parts of BLT4L together, and hopefully get a single codebase for both the Windows and GNU+Linux versions of SuperBLT.

dribbleondo commented 6 years ago

awesome work =D

dribbleondo commented 6 years ago

OK, did some compiling and (finally) figured out how to load the damn thing. Upside is that Custom Music Tracks work! Downside is the file to give it it's name doesn't. I did a compile on Mint 18.3 as usual, and uploaded it here for those interested in trying it out on Debian-based systems, like Ubuntu, Mint and the like.

Kazenin commented 6 years ago

I will try in fedora

Kazenin commented 6 years ago

@dribbleondo how to compile ?

dribbleondo commented 6 years ago

You require Clang 3.5 or above, apart from that, use the compile instructions on the readme

Kazenin commented 6 years ago

in Fedora:

$ sudo dnf install openal-soft-devel libcxx-devel openssl-devel clang-devel zlib-devel cmake
$ git clone --recursive https://gitlab.com/znixian/payday2-superblt.git
$ cd payday2-superblt && mkdir build && cd build
$ cmake -DUSE_LIBCXX=1 ..
$ make

Several warnings created but the process is done

$ make
Scanning dependencies of target mxml
[  1%] Building C object CMakeFiles/mxml.dir/lib/mxml/mmd.c.o
[  3%] Building C object CMakeFiles/mxml.dir/lib/mxml/mvalidate.c.o
[  5%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-attr.c.o
[  7%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-entity.c.o
[  9%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-file.c.o
[ 10%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-get.c.o
[ 12%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-index.c.o
[ 14%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-node.c.o
[ 16%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-private.c.o
[ 18%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-search.c.o
[ 20%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-set.c.o
[ 21%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxml-string.c.o
[ 23%] Building C object CMakeFiles/mxml.dir/lib/mxml/mxmldoc.c.o
/home/greyson/payday2-superblt/lib/mxml/mxmldoc.c:1411:1: warning: ‘get_iso_date’ defined but not used [-Wunused-function]
 get_iso_date(time_t t)   /* I - Time value */
 ^~~~~~~~~~~~
/home/greyson/payday2-superblt/lib/mxml/mxmldoc.c:1177:1: warning: ‘epub_ws_cb’ defined but not used [-Wunused-function]
 epub_ws_cb(mxml_node_t *node,  /* I - Element node */
 ^~~~~~~~~~
[ 25%] Building C object CMakeFiles/mxml.dir/lib/mxml/testmxml.c.o
[ 27%] Building C object CMakeFiles/mxml.dir/lib/mxml/zipc.c.o
[ 29%] Linking C static library libmxml.a
[ 29%] Built target mxml
Scanning dependencies of target wren
[ 30%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_compiler.c.o
[ 32%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_core.c.o
[ 34%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_debug.c.o
[ 36%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_primitive.c.o
[ 38%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_utils.c.o
[ 40%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_value.c.o
[ 41%] Building C object CMakeFiles/wren.dir/lib/wren/src/vm/wren_vm.c.o
[ 43%] Building C object CMakeFiles/wren.dir/lib/wren/src/optional/wren_opt_meta.c.o
[ 45%] Building C object CMakeFiles/wren.dir/lib/wren/src/optional/wren_opt_random.c.o
[ 47%] Linking C static library libwren.a
[ 47%] Built target wren
Scanning dependencies of target subhook
[ 49%] Building C object CMakeFiles/subhook.dir/lib/subhook/subhook.c.o
In file included from /home/greyson/payday2-superblt/lib/subhook/subhook.c:64:0:
/home/greyson/payday2-superblt/lib/subhook/subhook_x86.c: In function ‘subhook_disasm’:
/home/greyson/payday2-superblt/lib/subhook/subhook_x86.c:164:10: warning: variable ‘address_size’ set but not used [-Wunused-but-set-variable]
   size_t address_size = 4;
          ^~~~~~~~~~~~
[ 50%] Linking C static library libsubhook.a
[ 50%] Built target subhook
Scanning dependencies of target SuperBLT
[ 52%] Building CXX object CMakeFiles/SuperBLT.dir/src/InitiateState.cpp.o
/home/greyson/payday2-superblt/src/InitiateState.cpp:255:7: warning: unused
      variable 'n' [-Wunused-variable]
                int n = lua_gettop(L);
                    ^
/home/greyson/payday2-superblt/src/InitiateState.cpp:482:7: warning: unused
      variable 'top' [-Wunused-variable]
                int top = lua_gettop(L);
                    ^
/home/greyson/payday2-superblt/src/InitiateState.cpp:590:16: warning: cast to
      'void *' from smaller integer type 'uint32_t' (aka 'unsigned int')
      [-Wint-to-void-pointer-cast]
                        value_ptr = (void*) (*value)->gcptr32;
                                    ^
3 warnings generated.
[ 54%] Building CXX object CMakeFiles/SuperBLT.dir/src/debug/blt_debug.cpp.o
[ 56%] Building CXX object CMakeFiles/SuperBLT.dir/src/http/blt_downloader.cpp.o
[ 58%] Building CXX object CMakeFiles/SuperBLT.dir/src/http/http.cpp.o
[ 60%] Building CXX object CMakeFiles/SuperBLT.dir/src/threading/threadqueue.cpp.o
[ 61%] Building CXX object CMakeFiles/SuperBLT.dir/src/tweaker/wrenloader.cpp.o
/home/greyson/payday2-superblt/src/tweaker/wrenloader.cpp:217:22: warning: 
      unused variable 'result2' [-Wunused-variable]
        WrenInterpretResult result2 = wrenCall(vm, sig);
                            ^
1 warning generated.
[ 63%] Building CXX object CMakeFiles/SuperBLT.dir/src/tweaker/wrenxml.cpp.o
/home/greyson/payday2-superblt/src/tweaker/wrenxml.cpp:302:22: warning: 
      implicit conversion of NULL constant to 'int' [-Wnull-conversion]
        mxmlSetText(handle, NULL, wrenGetSlotString(vm, 1));
        ~~~~~~~~~~~         ^~~~
                            0
/home/greyson/payday2-superblt/src/tweaker/wrenxml.cpp:396:2: warning: unused
      variable 'handle' [-Wunused-variable]
        THIS_WXML_NODE(vm);
        ^
/home/greyson/payday2-superblt/src/tweaker/wrenxml.cpp:31:14: note: expanded
      from macro 'THIS_WXML_NODE'
mxml_node_t *handle = wxml->handle
             ^
/home/greyson/payday2-superblt/src/tweaker/wrenxml.cpp:422:2: warning: unused
      variable 'handle' [-Wunused-variable]
        THIS_WXML_NODE(vm);
        ^
/home/greyson/payday2-superblt/src/tweaker/wrenxml.cpp:31:14: note: expanded
      from macro 'THIS_WXML_NODE'
mxml_node_t *handle = wxml->handle
             ^
3 warnings generated.
[ 65%] Building CXX object CMakeFiles/SuperBLT.dir/src/tweaker/xmltweaker.cpp.o
/home/greyson/payday2-superblt/src/tweaker/xmltweaker.cpp:106:11: warning: 
      unused variable 'alt' [-Wunused-variable]
        uint64_t alt = *var;
                 ^
/home/greyson/payday2-superblt/src/tweaker/xmltweaker.cpp:145:2: warning: 
      'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
        register ub8 a, b, c, len;
        ^~~~~~~~~
/home/greyson/payday2-superblt/src/tweaker/xmltweaker.cpp:145:2: warning: 
      'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
        register ub8 a, b, c, len;
        ^~~~~~~~~
/home/greyson/payday2-superblt/src/tweaker/xmltweaker.cpp:145:2: warning: 
      'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
        register ub8 a, b, c, len;
        ^~~~~~~~~
/home/greyson/payday2-superblt/src/tweaker/xmltweaker.cpp:145:2: warning: 
      'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
        register ub8 a, b, c, len;
        ^~~~~~~~~
/home/greyson/payday2-superblt/src/tweaker/xmltweaker.cpp:102:13: warning: 
      unused function 'convert_block' [-Wunused-function]
static void convert_block(const char* str, uint64_t* var, int* start_ptr...
            ^
6 warnings generated.
[ 67%] Building CXX object CMakeFiles/SuperBLT.dir/src/util/compression.cpp.o
/home/greyson/payday2-superblt/src/util/compression.cpp:85:7: warning: unused
      variable 'versionNeeded' [-Wunused-variable]
        auto versionNeeded = mainStream.readType<int16_t>();
             ^
/home/greyson/payday2-superblt/src/util/compression.cpp:95:7: warning: unused
      variable 'crc32' [-Wunused-variable]
        auto crc32 = mainStream.readType<int32_t>();
             ^
/home/greyson/payday2-superblt/src/util/compression.cpp:146:15: warning: using
      the result of an assignment as a condition without parentheses
      [-Wparentheses]
                while (file = ReadFile(mainStream))
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/greyson/payday2-superblt/src/util/compression.cpp:146:15: note: place
      parentheses around the assignment to silence this warning
                while (file = ReadFile(mainStream))
                            ^
                       (                          )
/home/greyson/payday2-superblt/src/util/compression.cpp:146:15: note: use '=='
      to turn this assignment into an equality comparison
                while (file = ReadFile(mainStream))
                            ^
                            ==
3 warnings generated.
[ 69%] Building CXX object CMakeFiles/SuperBLT.dir/src/util/files.cpp.o
[ 70%] Building CXX object CMakeFiles/SuperBLT.dir/src/util/hashing.cpp.o
[ 72%] Building CXX object CMakeFiles/SuperBLT.dir/src/util/logging.cpp.o
[ 74%] Building CXX object CMakeFiles/SuperBLT.dir/src/util/util.cpp.o
[ 76%] Building CXX object CMakeFiles/SuperBLT.dir/src/xaudio/XABuffer.cpp.o
[ 78%] Building CXX object CMakeFiles/SuperBLT.dir/src/xaudio/XAListener.cpp.o
[ 80%] Building CXX object CMakeFiles/SuperBLT.dir/src/xaudio/XASource.cpp.o
[ 81%] Building CXX object CMakeFiles/SuperBLT.dir/src/xaudio/XAudio.cpp.o
[ 83%] Building C object CMakeFiles/SuperBLT.dir/src/xaudio/stb_vorbis.c.o
cc1: warning: command line option ‘-std=c++14’ is valid for C++/ObjC++ but not for C
/home/greyson/payday2-superblt/src/xaudio/stb_vorbis.c: In function ‘decode_residue’:
/home/greyson/payday2-superblt/src/xaudio/stb_vorbis.c:554:41: warning: statement with no effect [-Wunused-value]
 #define temp_free(f,p)                  0
                                         ^
/home/greyson/payday2-superblt/src/xaudio/stb_vorbis.c:1925:4: note: in expansion of macro ‘temp_free’
    temp_free(f,part_classdata);
    ^~~~~~~~~
/home/greyson/payday2-superblt/src/xaudio/stb_vorbis.c: In function ‘inverse_mdct’:
/home/greyson/payday2-superblt/src/xaudio/stb_vorbis.c:554:41: warning: statement with no effect [-Wunused-value]
 #define temp_free(f,p)                  0
                                         ^
/home/greyson/payday2-superblt/src/xaudio/stb_vorbis.c:2574:4: note: in expansion of macro ‘temp_free’
    temp_free(f,buf2);
    ^~~~~~~~~
[ 85%] Building CXX object CMakeFiles/SuperBLT.dir/platforms/gnu/src/assets.cpp.o
[ 87%] Building CXX object CMakeFiles/SuperBLT.dir/platforms/gnu/src/error.cpp.o
[ 89%] Building CXX object CMakeFiles/SuperBLT.dir/platforms/gnu/src/files.cpp.o
/home/greyson/payday2-superblt/platforms/gnu/src/files.cpp:109:9: warning: 
      control reaches end of non-void function [-Wreturn-type]
        }
        ^
1 warning generated.
[ 90%] Building CXX object CMakeFiles/SuperBLT.dir/platforms/gnu/src/hook.cpp.o
[ 92%] Building CXX object CMakeFiles/SuperBLT.dir/platforms/gnu/src/lapi_compat.cpp.o
[ 94%] Building CXX object CMakeFiles/SuperBLT.dir/platforms/gnu/src/log.cpp.o
[ 96%] Linking CXX static library libSuperBLT.a
[ 96%] Built target SuperBLT
Scanning dependencies of target superblt_loader
[ 98%] Building CXX object CMakeFiles/superblt_loader.dir/platforms/gnu/src/blt_main.cpp.o
[100%] Linking CXX shared library libsuperblt_loader.so
[100%] Built target superblt_loader
$ ldd libsuperblt_loader.so 
    linux-vdso.so.1 (0x00007ffcecd7f000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f82166fa000)
    libcurl.so.4 => /lib64/libcurl.so.4 (0x00007f8216479000)
    libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f821620d000)
    libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f8215d81000)
    libopenal.so.1 => /lib64/libopenal.so.1 (0x00007f8215ae7000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f821575e000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f8215448000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8215231000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f8214e5c000)
    libnghttp2.so.14 => /lib64/libnghttp2.so.14 (0x00007f8214c37000)
    libidn2.so.0 => /lib64/libidn2.so.0 (0x00007f8214a1a000)
    libssh2.so.1 => /lib64/libssh2.so.1 (0x00007f82147ed000)
    libpsl.so.5 => /lib64/libpsl.so.5 (0x00007f82145df000)
    libssl3.so => /lib64/libssl3.so (0x00007f821438d000)
    libsmime3.so => /lib64/libsmime3.so (0x00007f8214166000)
    libnss3.so => /lib64/libnss3.so (0x00007f8213e3c000)
    libnssutil3.so => /lib64/libnssutil3.so (0x00007f8213c0c000)
    libplds4.so => /lib64/libplds4.so (0x00007f8213a08000)
    libplc4.so => /lib64/libplc4.so (0x00007f8213803000)
    libnspr4.so => /lib64/libnspr4.so (0x00007f82135c4000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f82133a5000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f82131a1000)
    libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f8212f54000)
    libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f8212c6d000)
    libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f8212a3a000)
    libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f8212836000)
    liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x00007f8212627000)
    libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00007f82123d5000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f82121cd000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f8216bfb000)
    libunistring.so.2 => /lib64/libunistring.so.2 (0x00007f8211e4d000)
    libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f8211c3e000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f8211a3a000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f8211820000)
    libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007f8211603000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f82113db000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f82111a5000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f8210f33000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007f8210d30000)

Thanks for help

ZNixian commented 6 years ago

Please excuse mind the warnings (for now, I plan to fix them), it's source code is directly based off the original PD2 hook which didn't pay much attention to warnings

ZNixian commented 6 years ago

For the latest version compiled on Ubuntu, check the GitLab CI jobs page and download the latest (top) successful build's artefacts.

ZNixian commented 6 years ago

As of now SuperBLT has fully functional asset support, regardless of compiler (commit that adds this, if someone wants to copy it to BLT4L).

This was (AFAIK) the last major thing BLT4L supported that SuperBLT didn't, so I'll close the issue.