Compare commits
No commits in common. "5708a83ba65ff7121f14e3ba9c163d69c98f244c" and "9277ef34f66765a0041f63f8c098899f96960733" have entirely different histories.
5708a83ba6
...
9277ef34f6
4
.github/workflows/cd.yml
vendored
4
.github/workflows/cd.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
run: sudo apt update && sudo apt -y install libsodium-dev cmake libvpx-dev libopus-dev
|
run: sudo apt update && sudo apt -y install libsodium-dev cmake libvpx-dev libopus-dev
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTOMATO_BREAKPAD=ON -DTOMATO_TOX_AV=ON
|
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTOMATO_TOX_AV=ON
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
|
||||||
@ -166,7 +166,7 @@ jobs:
|
|||||||
#- uses: ilammy/setup-nasm@v1
|
#- uses: ilammy/setup-nasm@v1
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DSDLIMAGE_VENDORED=ON -DSDLIMAGE_DEPS_SHARED=ON -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_BREAKPAD=ON -DTOMATO_TOX_AV=ON
|
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DSDLIMAGE_VENDORED=ON -DSDLIMAGE_DEPS_SHARED=ON -DSDLIMAGE_JXL=OFF -DSDLIMAGE_AVIF=OFF -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DTOMATO_TOX_AV=ON
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t tomato
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t tomato
|
||||||
|
@ -20,9 +20,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|||||||
|
|
||||||
option(TOMATO_MAIN_SO "Build tomato as a shared object (for eg android apps)" ANDROID)
|
option(TOMATO_MAIN_SO "Build tomato as a shared object (for eg android apps)" ANDROID)
|
||||||
option(TOMATO_ASAN "Build tomato with asan (gcc/clang/msvc)" OFF)
|
option(TOMATO_ASAN "Build tomato with asan (gcc/clang/msvc)" OFF)
|
||||||
option(TOMATO_BREAKPAD "Build tomato with breakpad crash dumping" OFF)
|
|
||||||
option(TOMATO_TOX_AV "Build tomato with ToxAV" OFF)
|
option(TOMATO_TOX_AV "Build tomato with ToxAV" OFF)
|
||||||
|
|
||||||
|
message("II TOMATO_TOX_AV: ${TOMATO_TOX_AV}")
|
||||||
|
|
||||||
if (TOMATO_ASAN)
|
if (TOMATO_ASAN)
|
||||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||||
@ -43,17 +43,6 @@ if (TOMATO_ASAN)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("II TOMATO_BREAKPAD: ${TOMATO_BREAKPAD}")
|
|
||||||
if (TOMATO_BREAKPAD)
|
|
||||||
if (LINUX) # TODO: test if android
|
|
||||||
# HACK: workaround an ugly cmake bug,
|
|
||||||
# where subdirs can now propergate enable_language upwards
|
|
||||||
enable_language(ASM)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message("II TOMATO_TOX_AV: ${TOMATO_TOX_AV}")
|
|
||||||
|
|
||||||
# uggly, but it needs to be defined for all of tomato.
|
# uggly, but it needs to be defined for all of tomato.
|
||||||
# but this also means that we can not compile tomato in the same cmake as plugins
|
# but this also means that we can not compile tomato in the same cmake as plugins
|
||||||
add_compile_definitions(ENTT_API_EXPORT)
|
add_compile_definitions(ENTT_API_EXPORT)
|
||||||
|
4
external/CMakeLists.txt
vendored
4
external/CMakeLists.txt
vendored
@ -24,7 +24,3 @@ add_subdirectory(./libwebp)
|
|||||||
add_subdirectory(./qoi)
|
add_subdirectory(./qoi)
|
||||||
add_subdirectory(./sdl_image)
|
add_subdirectory(./sdl_image)
|
||||||
|
|
||||||
if (TOMATO_BREAKPAD)
|
|
||||||
add_subdirectory(./breakpad)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
139
external/breakpad/CMakeLists.txt
vendored
139
external/breakpad/CMakeLists.txt
vendored
@ -1,139 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
if (NOT TARGET breakpad_client)
|
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
|
||||||
if (NOT TARGET lss)
|
|
||||||
FetchContent_Declare(lss
|
|
||||||
GIT_REPOSITORY https://chromium.googlesource.com/linux-syscall-support/
|
|
||||||
GIT_TAG 9719c1e1e676814c456b55f5f070eabad6709d31
|
|
||||||
|
|
||||||
FIND_PACKAGE_ARGS # for the future
|
|
||||||
)
|
|
||||||
FetchContent_GetProperties(lss)
|
|
||||||
if(NOT lss_POPULATED)
|
|
||||||
FetchContent_Populate(lss)
|
|
||||||
|
|
||||||
# HACK: breakpad expects this at a specific path
|
|
||||||
configure_file(
|
|
||||||
${lss_SOURCE_DIR}/linux_syscall_support.h
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/third_party/lss/linux_syscall_support.h
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(lss INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/third_party/lss/linux_syscall_support.h)
|
|
||||||
target_include_directories(lss INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
FetchContent_Declare(breakpad
|
|
||||||
GIT_REPOSITORY https://chromium.googlesource.com/breakpad/breakpad
|
|
||||||
GIT_TAG v2023.06.01
|
|
||||||
|
|
||||||
FIND_PACKAGE_ARGS # for the future
|
|
||||||
)
|
|
||||||
FetchContent_GetProperties(breakpad)
|
|
||||||
if(NOT breakpad_POPULATED)
|
|
||||||
FetchContent_Populate(breakpad)
|
|
||||||
|
|
||||||
add_library(breakpad_common STATIC
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/convert_UTF.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/convert_UTF.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/md5.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/md5.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/string_conversion.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/string_conversion.cc
|
|
||||||
)
|
|
||||||
target_include_directories(breakpad_common PUBLIC "${breakpad_SOURCE_DIR}/src")
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_sources(breakpad_common PUBLIC
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/windows/guid_string.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/windows/guid_string.cc
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(breakpad_client STATIC)
|
|
||||||
target_sources(breakpad_client
|
|
||||||
PUBLIC
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/handler/exception_handler.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/common/ipc_protocol.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/crash_generation/crash_generation_client.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/crash_generation/minidump_generator.h
|
|
||||||
PRIVATE
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/handler/exception_handler.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/crash_generation/crash_generation_client.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/windows/crash_generation/minidump_generator.cc
|
|
||||||
)
|
|
||||||
target_compile_definitions(breakpad_client PRIVATE UNICODE)
|
|
||||||
#elseif() # TODO: mac, ios and any other platform
|
|
||||||
else() # assume linux
|
|
||||||
enable_language(ASM) # mostly to document, needs to be set in parent
|
|
||||||
target_sources(breakpad_common PUBLIC
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/elf_core_dump.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/elfutils.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/elfutils.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/file_id.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/file_id.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/guid_creator.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/guid_creator.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/linux_libc_support.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/memory_mapped_file.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/safe_readlink.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/breakpad_getcontext.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/common/linux/breakpad_getcontext.S
|
|
||||||
)
|
|
||||||
#set_property(SOURCE ${breakpad_SOURCE_DIR}/src/common/linux/breakpad_getcontext.S APPEND PROPERTY COMPILE_OPTIONS "-x" "assembler-with-cpp")
|
|
||||||
|
|
||||||
add_library(breakpad_client STATIC)
|
|
||||||
target_sources(breakpad_client
|
|
||||||
PUBLIC
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/handler/exception_handler.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/handler/minidump_descriptor.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/crash_generation/crash_generation_client.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/log/log.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/microdump_writer/microdump_writer.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/minidump_writer.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/pe_file.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/pe_structs.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/proc_cpuinfo_reader.h
|
|
||||||
PRIVATE
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/handler/exception_handler.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/handler/minidump_descriptor.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/crash_generation/crash_generation_client.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/crash_generation/crash_generation_server.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/log/log.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/microdump_writer/microdump_writer.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/dump_writer_common/thread_info.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/dump_writer_common/ucontext_reader.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/minidump_writer.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_core_dumper.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_dumper.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/pe_file.cc
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (TARGET lss)
|
|
||||||
target_link_libraries(breakpad_common PUBLIC lss)
|
|
||||||
target_link_libraries(breakpad_client PUBLIC lss)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (TARGET breakpad_client)
|
|
||||||
if (NOT WIN32)
|
|
||||||
target_sources(breakpad_client PUBLIC
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/minidump_file_writer-inl.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/minidump_file_writer.h
|
|
||||||
${breakpad_SOURCE_DIR}/src/client/minidump_file_writer.cc
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(breakpad_client PUBLIC breakpad_common)
|
|
||||||
target_include_directories(breakpad_client PUBLIC "${breakpad_SOURCE_DIR}/src")
|
|
||||||
target_compile_features(breakpad_client PUBLIC cxx_std_11)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
#FetchContent_MakeAvailable(breakpad)
|
|
||||||
endif()
|
|
||||||
|
|
3
external/sdl/CMakeLists.txt
vendored
3
external/sdl/CMakeLists.txt
vendored
@ -26,8 +26,7 @@ if (NOT TARGET SDL3::SDL3)
|
|||||||
#GIT_TAG 9dd8859240703d886941733ad32c1dc6f50d64f0 # tip 19-09-2024
|
#GIT_TAG 9dd8859240703d886941733ad32c1dc6f50d64f0 # tip 19-09-2024
|
||||||
#GIT_TAG afdf325fb4090e93a124519d1a3bc1fbe0ba9025 # bad
|
#GIT_TAG afdf325fb4090e93a124519d1a3bc1fbe0ba9025 # bad
|
||||||
#GIT_TAG e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e # tip 05-10-2024 (3.1.3)
|
#GIT_TAG e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e # tip 05-10-2024 (3.1.3)
|
||||||
#GIT_TAG 2654d5d48b8f764148a7c246fea85b32b1133578 # tip 18-10-2024
|
GIT_TAG 2654d5d48b8f764148a7c246fea85b32b1133578 # tip 18-10-2024
|
||||||
GIT_TAG f8468d580d903e106640800034a4721aca24264c # tip 15-11-2024
|
|
||||||
|
|
||||||
FIND_PACKAGE_ARGS # for the future
|
FIND_PACKAGE_ARGS # for the future
|
||||||
)
|
)
|
||||||
|
8
flake.lock
generated
8
flake.lock
generated
@ -63,17 +63,17 @@
|
|||||||
"sdl3": {
|
"sdl3": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731694817,
|
"lastModified": 1729218869,
|
||||||
"narHash": "sha256-d1d1LSVhvXnyr7BH0pnsAEgqczW3viMO7We87lr9o18=",
|
"narHash": "sha256-0KrwC3Yrs1LHwT9SPvknDwPymNmksq6dixM4/KiFqFA=",
|
||||||
"owner": "libsdl-org",
|
"owner": "libsdl-org",
|
||||||
"repo": "SDL",
|
"repo": "SDL",
|
||||||
"rev": "f8468d580d903e106640800034a4721aca24264c",
|
"rev": "2654d5d48b8f764148a7c246fea85b32b1133578",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "libsdl-org",
|
"owner": "libsdl-org",
|
||||||
"repo": "SDL",
|
"repo": "SDL",
|
||||||
"rev": "f8468d580d903e106640800034a4721aca24264c",
|
"rev": "2654d5d48b8f764148a7c246fea85b32b1133578",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
sdl3 = {
|
sdl3 = {
|
||||||
url = "github:libsdl-org/SDL/f8468d580d903e106640800034a4721aca24264c"; # keep in sync this cmake
|
url = "github:libsdl-org/SDL/2654d5d48b8f764148a7c246fea85b32b1133578"; # keep in sync this cmake
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
sdl3_image = {
|
sdl3_image = {
|
||||||
|
@ -126,16 +126,6 @@ target_sources(tomato PUBLIC
|
|||||||
./debug_video_tap.cpp
|
./debug_video_tap.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (TOMATO_BREAKPAD)
|
|
||||||
target_sources(tomato PUBLIC
|
|
||||||
./breakpad_client.hpp
|
|
||||||
./breakpad_client.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(tomato PUBLIC breakpad_client)
|
|
||||||
target_compile_definitions(tomato PUBLIC TOMATO_BREAKPAD)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (TOMATO_TOX_AV)
|
if (TOMATO_TOX_AV)
|
||||||
target_sources(tomato PUBLIC
|
target_sources(tomato PUBLIC
|
||||||
./tox_av.hpp
|
./tox_av.hpp
|
||||||
@ -177,6 +167,9 @@ target_link_libraries(tomato PUBLIC
|
|||||||
SDL3_image::SDL3_image
|
SDL3_image::SDL3_image
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# probably not enough
|
||||||
|
#target_compile_definitions(tomato PUBLIC ENTT_API_EXPORT)
|
||||||
|
|
||||||
set_target_properties(tomato PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(tomato PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
#include "./breakpad_client.hpp"
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
bool dumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded) {
|
|
||||||
//TCHAR* text = new TCHAR[kMaximumLineLength];
|
|
||||||
//text[0] = _T('\0');
|
|
||||||
//int result = swprintf_s(text,
|
|
||||||
// kMaximumLineLength,
|
|
||||||
// TEXT("Dump generation request %s\r\n"),
|
|
||||||
// succeeded ? TEXT("succeeded") : TEXT("failed"));
|
|
||||||
//if (result == -1) {
|
|
||||||
// delete [] text;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//QueueUserWorkItem(AppendTextWorker, text, WT_EXECUTEDEFAULT);
|
|
||||||
|
|
||||||
if (succeeded) {
|
|
||||||
fprintf(stderr, "Crash detected, MiniDump written to: %ls\n", dump_path);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Crash detected, failed to write MiniDump. (path: %ls)\n", dump_path);
|
|
||||||
}
|
|
||||||
return succeeded;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
// linux
|
|
||||||
|
|
||||||
bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void*, bool succeeded) {
|
|
||||||
if (succeeded) {
|
|
||||||
fprintf(stderr, "Crash detected, MiniDump written to: %s\n", descriptor.path());
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Crash detected, failed to write MiniDump. (path: %s)\n", descriptor.path());
|
|
||||||
}
|
|
||||||
return succeeded;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,38 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// TODO: require msvc
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
#include <client/windows/handler/exception_handler.h>
|
|
||||||
|
|
||||||
bool dumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded);
|
|
||||||
|
|
||||||
#define BREAKPAD_MAIN_INIT \
|
|
||||||
google_breakpad::ExceptionHandler bp_eh{ \
|
|
||||||
L".\\", /* path */ \
|
|
||||||
nullptr, \
|
|
||||||
dumpCallback, \
|
|
||||||
nullptr, \
|
|
||||||
google_breakpad::ExceptionHandler::HANDLER_ALL, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <client/linux/handler/exception_handler.h>
|
|
||||||
|
|
||||||
bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void*, bool succeeded);
|
|
||||||
|
|
||||||
#define BREAKPAD_MAIN_INIT \
|
|
||||||
google_breakpad::MinidumpDescriptor bp_descriptor{"/tmp"}; \
|
|
||||||
bp_descriptor.set_sanitize_stacks(true); /* *should* remove most PII from stack mem dump */ \
|
|
||||||
bp_descriptor.set_size_limit(50*1024*1024); /* limit to 50mb */ \
|
|
||||||
google_breakpad::ExceptionHandler bp_eh{ \
|
|
||||||
bp_descriptor, \
|
|
||||||
nullptr, \
|
|
||||||
dumpCallback, \
|
|
||||||
nullptr, \
|
|
||||||
true, /* install handler */ \
|
|
||||||
-1, /* dump in-process (OOP would be better) */ \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -94,45 +94,6 @@ static int64_t sizeToHumanReadable(int64_t file_size, const char*& suffix_out) {
|
|||||||
return (divider > 1024) ? (divider / 1024) : 1;
|
return (divider > 1024) ? (divider / 1024) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns divider and places static suffix string into suffix_out
|
|
||||||
static int64_t durationToHumanReadable(int64_t t, const char*& suffix_out) {
|
|
||||||
static const char* suffix_arr[] {
|
|
||||||
"ms",
|
|
||||||
"s",
|
|
||||||
"min",
|
|
||||||
"h",
|
|
||||||
"d",
|
|
||||||
"a",
|
|
||||||
};
|
|
||||||
static const int64_t divider_arr[] {
|
|
||||||
1000, // ms -> s
|
|
||||||
60, // s -> min
|
|
||||||
60, // min -> h
|
|
||||||
24, // h -> d
|
|
||||||
256, // d -> a // aprox
|
|
||||||
};
|
|
||||||
|
|
||||||
if (t <= 0) {
|
|
||||||
suffix_out = suffix_arr[0];
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t divider {1};
|
|
||||||
for (size_t i = 0; i < std::size(divider_arr); i++) {
|
|
||||||
if (t < divider * divider_arr[i]) {
|
|
||||||
suffix_out = suffix_arr[i];
|
|
||||||
return divider;
|
|
||||||
}
|
|
||||||
|
|
||||||
divider *= divider_arr[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we are here, we are in the last element
|
|
||||||
// 5 and 4
|
|
||||||
suffix_out = suffix_arr[5];
|
|
||||||
return divider;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string file_path_url_escape(const std::string&& value) {
|
static std::string file_path_url_escape(const std::string&& value) {
|
||||||
std::ostringstream escaped;
|
std::ostringstream escaped;
|
||||||
|
|
||||||
@ -1184,25 +1145,13 @@ void ChatGui4::renderMessageBodyFile(Message3Registry& reg, const Message3 e) {
|
|||||||
|
|
||||||
float fraction = float(transfer_total) / total_size;
|
float fraction = float(transfer_total) / total_size;
|
||||||
|
|
||||||
char overlay_buf[128];
|
char overlay_buf[64];
|
||||||
if (transfer_rate > 0.000001f) {
|
if (transfer_rate > 0.000001f) {
|
||||||
const char* byte_suffix = "???";
|
const char* byte_suffix = "???";
|
||||||
int64_t byte_divider = sizeToHumanReadable(transfer_rate, byte_suffix);
|
int64_t byte_divider = sizeToHumanReadable(transfer_rate, byte_suffix);
|
||||||
int64_t ms_remaining = (total_size - transfer_total) / (transfer_rate/1000.f);
|
int64_t seconds_remaining = (total_size - transfer_total) / transfer_rate;
|
||||||
if (ms_remaining > 0) {
|
if (seconds_remaining > 0) {
|
||||||
const char* duration_suffix = "???";
|
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s %lds ", fraction * 100 + 0.01f, transfer_rate/byte_divider, byte_suffix, seconds_remaining);
|
||||||
int64_t duration_divider = durationToHumanReadable(ms_remaining, duration_suffix);
|
|
||||||
std::snprintf(
|
|
||||||
overlay_buf, sizeof(overlay_buf),
|
|
||||||
"%.1f%% @ %.1f%s/s %.1f%s",
|
|
||||||
fraction * 100 + 0.01f,
|
|
||||||
|
|
||||||
transfer_rate/byte_divider,
|
|
||||||
byte_suffix,
|
|
||||||
|
|
||||||
double(ms_remaining)/duration_divider,
|
|
||||||
duration_suffix
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s", fraction * 100 + 0.01f, transfer_rate/byte_divider, byte_suffix);
|
std::snprintf(overlay_buf, sizeof(overlay_buf), "%.1f%% @ %.1f%s/s", fraction * 100 + 0.01f, transfer_rate/byte_divider, byte_suffix);
|
||||||
}
|
}
|
||||||
|
13
src/main.cpp
13
src/main.cpp
@ -19,25 +19,14 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
#ifdef TOMATO_BREAKPAD
|
|
||||||
# include "./breakpad_client.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
runSysCheck();
|
|
||||||
|
|
||||||
#ifdef TOMATO_BREAKPAD
|
|
||||||
// TODO: maybe run before sys check?
|
|
||||||
BREAKPAD_MAIN_INIT;
|
|
||||||
std::cout << "Breakpad handler installed.\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// better args
|
// better args
|
||||||
std::vector<std::string_view> args;
|
std::vector<std::string_view> args;
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
args.push_back(argv[i]);
|
args.push_back(argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runSysCheck();
|
||||||
|
|
||||||
SDL_SetAppMetadata("tomato", "0.0.0-wip", nullptr);
|
SDL_SetAppMetadata("tomato", "0.0.0-wip", nullptr);
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ struct ToxAVCallVideoSink : public FrameStream2SinkI<SDLVideoFrame> {
|
|||||||
ToxAVI& _toxav;
|
ToxAVI& _toxav;
|
||||||
|
|
||||||
// bitrate for enabled state
|
// bitrate for enabled state
|
||||||
uint32_t _video_bitrate {1400};
|
uint32_t _video_bitrate {2000};
|
||||||
|
|
||||||
uint32_t _fid;
|
uint32_t _fid;
|
||||||
std::shared_ptr<stream_type> _writer;
|
std::shared_ptr<stream_type> _writer;
|
||||||
|
Loading…
Reference in New Issue
Block a user