void RenderUtilities::FadeSurfaceOut(SDL_Surface *surf, const SDL_Rect *rect, bool axis, bool direction) {
if (!SDLUtilities::SurfaceIsValid(surf) || surf->format->Amask == 0) // surface is invalid or doesn't have an alpha channel
return;
SDL_LockSurface(surf);
int x_start = rect->x + (axis ? 0 : rect->w);
int x_target = rect->x + (axis ? rect->w : 0);
int y_start = rect->y + (axis ? 0 : rect->h);
int y_target = rect->y + (axis ? rect->h : 0);
if (x_target > surf->w || y_target > surf->h)
return;
auto AdjustPixelAlpha = [&](int a_x, int a_y) {
static uint32_t *pixels, *target_pixel = nullptr;
static uint8_t r, g, b, src_a, new_a;
static float fraction;
pixels = reinterpret_cast<uint32_t *>(surf->pixels);
target_pixel = &pixels[((a_y * surf->pitch) / surf->format->BytesPerPixel) + a_x];
if (axis)
fraction = direction ? (float(a_x - x_start) / float(x_target - x_start))
: (float(a_y - y_start) / float(y_target - y_start));
else
fraction = direction ? (float(x_start - a_x) / float(x_start - x_target))
: (float(y_start - a_y) / float(y_start - y_target));
SDL_GetRGBA(*target_pixel, surf->format, &r, &g, &b, &src_a);
new_a = std::ceil(fraction * src_a);
*target_pixel = SDL_MapRGBA(surf->format, r, g, b, new_a); /* <- here */
};
int x;
int y;
auto LoopY = [&](int a_x) {
if (axis)
for (y = y_start; y < y_target; y++)
AdjustPixelAlpha(a_x, y);
else
for (y = y_start; y > y_target; y--)
AdjustPixelAlpha(a_x, y);
};
if (axis)
for (x = x_start; x < x_target; x++)
LoopY(x);
else
for (x = x_start; x > x_target; x--)
LoopY(x);
SDL_UnlockSurface(surf);
}
void RenderUtilities::FadeSurfaceOut(SDL_Surface *surf, const SDL_Rect *rect, bool axis, bool direction) {
if (!SDLUtilities::SurfaceIsValid(surf) || surf->format->Amask == 0) // surface is invalid or doesn't have an alpha channel
return;
SDL_LockSurface(surf);
int x_start = rect->x + (axis ? 0 : rect->w);
int x_target = rect->x + (axis ? rect->w : 0);
int y_start = rect->y + (axis ? 0 : rect->h);
int y_target = rect->y + (axis ? rect->h : 0);
if (x_target > surf->w || y_target > surf->h)
return;
auto AdjustPixelAlpha = [&](int a_x, int a_y) {
static uint32_t *pixels, *target_pixel = nullptr;
static uint8_t r, g, b, src_a, new_a;
static float fraction;
pixels = reinterpret_cast<uint32_t *>(surf->pixels);
target_pixel = &pixels[((a_y * surf->pitch) / surf->format->BytesPerPixel) + a_x];
if (axis)
fraction = direction ? (float(a_x - x_start) / float(x_target - x_start))
: (float(a_y - y_start) / float(y_target - y_start));
else
fraction = direction ? (float(x_start - a_x) / float(x_start - x_target))
: (float(y_start - a_y) / float(y_start - y_target));
SDL_GetRGBA(*target_pixel, surf->format, &r, &g, &b, &src_a);
new_a = std::ceil(fraction * src_a);
*target_pixel = SDL_MapRGBA(surf->format, r, g, b, new_a); /* <- here */
};
int x;
int y;
auto LoopY = [&](int a_x) {
if (axis)
for (y = y_start; y < y_target; y++)
AdjustPixelAlpha(a_x, y);
else
for (y = y_start; y > y_target; y--)
AdjustPixelAlpha(a_x, y);
};
if (axis)
for (x = x_start; x < x_target; x++)
LoopY(x);
else
for (x = x_start; x > x_target; x--)
LoopY(x);
SDL_UnlockSurface(surf);
}
registered on ipv4, ipv6
if both worked, or registered on ipv4
if only that worked. I think many won't even know what ipv6 is and just read the error as "registering failed"__uint128_t
something i can expect to be in most modern compilers?unsigned __int128
unsigned __int128
is the way__uint128
typedef unsigned _BitInt(128) u128
#define __GLIBCXX_TYPE_INT_N_0 __int128
#define __GLIBCXX_BITSIZE_INT_N_0 128
apparently u need this if u want libstdc++ to handle them tootypedef unsigned _BitInt(128) u128
LoadLibrary
?LoadLibrary
? GetLastError
objdump -p program.exe | grep "DLL Name:"
?objdump -p program.exe | grep "DLL Name:"
? ldd prog.exe
$ ldd DDNet.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff832230000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff830f60000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff82f810000)
ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ff831db0000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff831890000)
...
(edited)DDNet_2.exe
exe
has a different name, so somehow this influences the memory usage cd4a13e
Remove unnecessary check for open file in ReadChunkHeader
- Robyt3
c3b8c94
Use std::vector
for demo player keyframes - Robyt3
82d94fa
Refactor GetDemoName
using IStorage::StripPathAndExtension
- Robyt3
5681771
Remove unnecessary parentheses - Robyt3
1333ac3
Use nullptr
instead of 0
and NULL
- Robyt3
9b68b9d
Use bool
instead of int
- Robyt3
dbbae72
Move variable declarations closer to usages - Robyt3
f7b8738
Remove obsolete TODO about improving demo player map checking - Robyt3
ed92a9e
Remove redundant checks for missing SHA256 when recording demo - Robyt3
af4b1c9
Remove tick error
debug message - Robyt3
f1e74c1
Remove unused IDemoPlayer::GetDemoType
and enum literals - Robyt3
f06f65d
Merge pull request #7354 from Robyt3/Engine-Demo-Refactoring - def-void RenderUtilities::FadeSurfaceOut(SDL_Surface *surf, const SDL_Rect *rect, bool axis, bool direction) {
if (!SDLUtilities::SurfaceIsValid(surf) || surf->format->Amask == 0) // surface is invalid or doesn't have an alpha channel
return;
SDL_LockSurface(surf);
int x_start = rect->x + (axis ? 0 : rect->w);
int x_target = rect->x + (axis ? rect->w : 0);
int y_start = rect->y + (axis ? 0 : rect->h);
int y_target = rect->y + (axis ? rect->h : 0);
if (x_target > surf->w || y_target > surf->h)
return;
auto AdjustPixelAlpha = [&](int a_x, int a_y) {
static uint32_t *pixels, *target_pixel = nullptr;
static uint8_t r, g, b, src_a, new_a;
static float fraction;
pixels = reinterpret_cast<uint32_t *>(surf->pixels);
target_pixel = &pixels[((a_y * surf->pitch) / surf->format->BytesPerPixel) + a_x];
if (axis)
fraction = direction ? (float(a_x - x_start) / float(x_target - x_start))
: (float(a_y - y_start) / float(y_target - y_start));
else
fraction = direction ? (float(x_start - a_x) / float(x_start - x_target))
: (float(y_start - a_y) / float(y_start - y_target));
SDL_GetRGBA(*target_pixel, surf->format, &r, &g, &b, &src_a);
new_a = std::ceil(fraction * src_a);
*target_pixel = SDL_MapRGBA(surf->format, r, g, b, new_a); /* <- here */
};
int x;
int y;
auto LoopY = [&](int a_x) {
if (axis)
for (y = y_start; y < y_target; y++)
AdjustPixelAlpha(a_x, y);
else
for (y = y_start; y > y_target; y--)
AdjustPixelAlpha(a_x, y);
};
if (axis)
for (x = x_start; x < x_target; x++)
LoopY(x);
else
for (x = x_start; x > x_target; x--)
LoopY(x);
SDL_UnlockSurface(surf);
}