mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* All libraries have been isolated from each other, and build into separate artifacts. * Project has been restructured to support isolating libraries. * CCrashHandler now calls a callback on crash (setup from core/dllmain.cpp, this can be setup in any way for any project. This callback is getting called when the apllication crashes. Useful for flushing buffers before closing handles to logging files for example). * Tier0 'CoreMsgV' function now calls a callback sink, which could be set by the user (currently setup to the SDK's internal logger in core/dllmain.cpp). TODO: * Add a batch file to autogenerate all projects. * Add support for dedicated server. * Add support for client dll. Bugs: * Game crashes on the title screen after the UI script compiler has finished (root cause unknown). * Curl error messages are getting logged twice for the dedicated server due to the removal of all "DEDICATED" preprocessor directives to support isolating projects. This has to be fixed properly!
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#include "adler32.h"
|
|
|
|
// Mark Adler's compact Adler32 hashing algorithm
|
|
// Originally from the public domain stb.h header.
|
|
uint32_t adler32::update(uint32_t adler, const void* ptr, size_t buf_len)
|
|
{
|
|
if (!ptr)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
const uint8_t* buffer = static_cast<const uint8_t*>(ptr);
|
|
|
|
const unsigned long ADLER_MOD = 65521;
|
|
unsigned long s1 = adler & 0xffff, s2 = adler >> 16;
|
|
size_t blocklen;
|
|
unsigned long i;
|
|
|
|
blocklen = buf_len % 5552;
|
|
while (buf_len)
|
|
{
|
|
for (i = 0; i + 7 < blocklen; i += 8)
|
|
{
|
|
s1 += buffer[0], s2 += s1;
|
|
s1 += buffer[1], s2 += s1;
|
|
s1 += buffer[2], s2 += s1;
|
|
s1 += buffer[3], s2 += s1;
|
|
s1 += buffer[4], s2 += s1;
|
|
s1 += buffer[5], s2 += s1;
|
|
s1 += buffer[6], s2 += s1;
|
|
s1 += buffer[7], s2 += s1;
|
|
|
|
buffer += 8;
|
|
}
|
|
|
|
for (; i < blocklen; ++i)
|
|
{
|
|
s1 += *buffer++, s2 += s1;
|
|
}
|
|
|
|
s1 %= ADLER_MOD, s2 %= ADLER_MOD;
|
|
buf_len -= blocklen;
|
|
blocklen = 5552;
|
|
}
|
|
return (s2 << 16) + s1;
|
|
}
|