mirror of
https://github.com/InoriRus/Kyty.git
synced 2024-06-22 22:41:55 -04:00
Compare commits
2 commits
bda46b2ff5
...
274d514e4b
Author | SHA1 | Date | |
---|---|---|---|
274d514e4b | |||
5c502e3196 |
1741
source/3rdparty/magic_enum/include/magic_enum.hpp
vendored
1741
source/3rdparty/magic_enum/include/magic_enum.hpp
vendored
File diff suppressed because it is too large
Load diff
|
@ -1649,7 +1649,7 @@ int KYTY_SYSV_ABI Ngs2SystemCreateWithAllocator(const Ngs2SystemOption* option,
|
|||
printf("\t sample_rate = %u\n", option->sample_rate);
|
||||
printf("\t alloc_handler = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->alloc_handler));
|
||||
printf("\t free_handler = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->free_handler));
|
||||
printf("\t user_data = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->user_data));
|
||||
//printf("\t user_data = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->user_data));
|
||||
|
||||
Ngs2ContextBufferInfo buf {};
|
||||
buf.host_buffer = nullptr;
|
||||
|
@ -1697,7 +1697,7 @@ int KYTY_SYSV_ABI Ngs2RackCreate(uintptr_t system_handle, uint32_t rack_id, cons
|
|||
printf("\t max_matrices = %u\n", option->max_matrices);
|
||||
printf("\t max_ports = %u\n", option->max_ports);
|
||||
printf("\t host_buffer = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(buffer_info->host_buffer));
|
||||
printf("\t host_buffer_size = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(buffer_info->host_buffer_size));
|
||||
//printf("\t host_buffer_size = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(buffer_info->host_buffer_size));
|
||||
|
||||
auto* ngs = reinterpret_cast<Ngs2Internal*>(system_handle);
|
||||
auto* rack = static_cast<Ngs2RackInternal*>(buffer_info->host_buffer);
|
||||
|
@ -1779,7 +1779,7 @@ int KYTY_SYSV_ABI Ngs2RackCreateWithAllocator(uintptr_t system_handle, uint32_t
|
|||
printf("\t max_ports = %u\n", option->max_ports);
|
||||
printf("\t alloc_handler = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->alloc_handler));
|
||||
printf("\t free_handler = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->free_handler));
|
||||
printf("\t user_data = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->user_data));
|
||||
//printf("\t user_data = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(allocator->user_data));
|
||||
|
||||
Ngs2ContextBufferInfo buf {};
|
||||
buf.host_buffer = nullptr;
|
||||
|
|
|
@ -847,7 +847,7 @@ int KYTY_SYSV_ABI KernelMprotect(const void* addr, size_t len, int prot)
|
|||
auto vaddr = reinterpret_cast<uint64_t>(addr);
|
||||
|
||||
printf("\t addr = 0x%016" PRIx64 "\n", vaddr);
|
||||
printf("\t len = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(len));
|
||||
//printf("\t len = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(len));
|
||||
|
||||
VirtualMemory::Mode mode = VirtualMemory::Mode::NoAccess;
|
||||
Graphics::GpuMemoryMode gpu_mode = Graphics::GpuMemoryMode::NoAccess;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#if defined(__WIN64__)
|
||||
#include <pthread_time.h>
|
||||
#endif
|
||||
|
||||
|
@ -380,7 +380,7 @@ static void pthread_attr_dbg_print(const PthreadAttr* src)
|
|||
printf("\tsched_priority = %d\n", param.sched_priority);
|
||||
printf("\tpolicy = %d\n", policy);
|
||||
printf("\tstack_addr = 0x%016" PRIx64 "\n", reinterpret_cast<uint64_t>(stack_addr));
|
||||
printf("\tstack_size = %" PRIu64 "\n", reinterpret_cast<uint64_t>(stack_size));
|
||||
//printf("\tstack_size = %" PRIu64 "\n", reinterpret_cast<uint64_t>(stack_size));
|
||||
}
|
||||
|
||||
static void usec_to_timespec(struct timespec* ts, KernelUseconds usec)
|
||||
|
@ -1434,7 +1434,7 @@ int KYTY_SYSV_ABI PthreadRwlockTimedrdlock(PthreadRwlock* rwlock, KernelUseconds
|
|||
timespec t {};
|
||||
usec_to_timespec(&t, usec);
|
||||
|
||||
int result = pthread_rwlock_timedrdlock(&(*rwlock)->p, &t);
|
||||
int result = pthread_rwlock_timedrdlock(&(*rwlock)->p,&t);
|
||||
|
||||
// printf("\trwlock timedrdlock: %s, %d\n", (*rwlock)->name.C_Str(), result);
|
||||
|
||||
|
@ -1462,7 +1462,8 @@ int KYTY_SYSV_ABI PthreadRwlockTimedwrlock(PthreadRwlock* rwlock, KernelUseconds
|
|||
timespec t {};
|
||||
usec_to_timespec(&t, usec);
|
||||
|
||||
int result = pthread_rwlock_timedwrlock(&(*rwlock)->p, &t);
|
||||
|
||||
int result = pthread_rwlock_timedrdlock(&(*rwlock)->p,&t);
|
||||
|
||||
// printf("\trwlock timedwrlock: %s, %d\n", (*rwlock)->name.C_Str(), result);
|
||||
|
||||
|
@ -1480,12 +1481,12 @@ int KYTY_SYSV_ABI PthreadRwlockTryrdlock(PthreadRwlock* rwlock)
|
|||
{
|
||||
PRINT_NAME();
|
||||
|
||||
if (rwlock == nullptr)
|
||||
if (rwlock == 0)
|
||||
{
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
EXIT_NOT_IMPLEMENTED(*rwlock == nullptr);
|
||||
EXIT_NOT_IMPLEMENTED(*rwlock == 0);
|
||||
|
||||
int result = pthread_rwlock_tryrdlock(&(*rwlock)->p);
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
namespace Kyty {
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include "Kyty/Core/String.h"
|
||||
#include "Kyty/Sys/MacOS/SysMacOSTimer.h"
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include "Kyty/Sys/MacOS/SysMacOSSync.h"
|
||||
|
||||
|
@ -15,12 +13,12 @@ using sys_heap_id_t = SysCS*;
|
|||
|
||||
inline sys_heap_id_t sys_heap_create()
|
||||
{
|
||||
return nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline sys_heap_id_t sys_heap_deafult()
|
||||
{
|
||||
return nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void* sys_heap_alloc(sys_heap_id_t /*heap_id*/, size_t size)
|
||||
|
@ -28,7 +26,7 @@ inline void* sys_heap_alloc(sys_heap_id_t /*heap_id*/, size_t size)
|
|||
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc,hicpp-no-malloc)
|
||||
void* m = malloc(size);
|
||||
|
||||
EXIT_IF(m == nullptr);
|
||||
EXIT_IF(m == 0);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -36,11 +34,11 @@ inline void* sys_heap_alloc(sys_heap_id_t /*heap_id*/, size_t size)
|
|||
inline void* sys_heap_realloc(sys_heap_id_t /*heap_id*/, void* p, size_t size)
|
||||
{
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc,hicpp-no-malloc)
|
||||
void* m = p != nullptr ? realloc(p, size) : malloc(size);
|
||||
void* m = p != 0 ? realloc(p, size) : malloc(size);
|
||||
|
||||
if (m == nullptr)
|
||||
if (m == 0)
|
||||
{
|
||||
EXIT_IF(m == nullptr);
|
||||
EXIT_IF(m == 0);
|
||||
}
|
||||
|
||||
return m;
|
||||
|
@ -68,7 +66,7 @@ inline void* sys_heap_alloc_s(sys_heap_id_t heap_id, size_t size)
|
|||
|
||||
heap_id->Leave();
|
||||
|
||||
EXIT_IF(m == nullptr);
|
||||
EXIT_IF(m == 0);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -78,11 +76,11 @@ inline void* sys_heap_realloc_s(sys_heap_id_t heap_id, void* p, size_t size)
|
|||
heap_id->Enter();
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-no-malloc,hicpp-no-malloc)
|
||||
void* m = p != nullptr ? realloc(p, size) : malloc(size);
|
||||
void* m = p != 0 ? realloc(p, size) : malloc(size);
|
||||
|
||||
heap_id->Leave();
|
||||
|
||||
EXIT_IF(m == nullptr);
|
||||
EXIT_IF(m == 0);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
//#include <stdio.h>
|
||||
#include <cstdarg>
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
namespace Kyty {
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
@ -24,7 +22,7 @@ public:
|
|||
m_check_ptr = this;
|
||||
|
||||
pthread_mutexattr_t attr {};
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&m_mutex, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// IWYU pragma: private
|
||||
|
||||
#if __APPLE__
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include <ctime>
|
||||
|
||||
|
@ -51,7 +51,7 @@ inline void sys_file_to_system_time_utc(const SysFileTimeStruct& f, SysTimeStruc
|
|||
|
||||
inline void sys_time_t_to_system(time_t t, SysTimeStruct& s)
|
||||
{
|
||||
SysTimeStruct ft {};
|
||||
SysFileTimeStruct ft {};
|
||||
ft.time = t;
|
||||
ft.is_invalid = false;
|
||||
sys_file_to_system_time_utc(ft, s);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef INCLUDE_KYTY_SYS_MACOS_SYSLINUXVIRTUAL_H_
|
||||
#define INCLUDE_KYTY_SYS_MACOS_SYSLINUXVIRTUAL_H_
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_MACOS
|
||||
//#error "KYTY_PLATFORM != KYTY_PLATFORM_MACOS"
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#include "Kyty/Core/Common.h"
|
||||
#include "Kyty/Core/String.h"
|
||||
|
|
|
@ -927,7 +927,6 @@ void File::Write(const ByteBuffer& buf, uint32_t* bytes_written)
|
|||
|
||||
DateTime File::GetLastAccessTimeUTC(const String& name)
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
SysTimeStruct t {};
|
||||
sys_file_to_system_time_utc(sys_file_get_last_access_time_utc(name), t);
|
||||
|
||||
|
@ -941,7 +940,6 @@ DateTime File::GetLastAccessTimeUTC(const String& name)
|
|||
|
||||
DateTime File::GetLastWriteTimeUTC(const String& name)
|
||||
{
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
SysTimeStruct t {};
|
||||
sys_file_to_system_time_utc(sys_file_get_last_write_time_utc(name), t);
|
||||
|
||||
|
|
|
@ -20,25 +20,31 @@ namespace Kyty::Core {
|
|||
#define MEM_ALLOC_ALIGNED
|
||||
|
||||
#ifdef MEM_ALLOC_ALIGNED
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_ANDROID
|
||||
#if defined(__ANDROID__)
|
||||
constexpr int MEM_ALLOC_ALIGN = 8;
|
||||
#else
|
||||
constexpr int MEM_ALLOC_ALIGN = 16;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS && KYTY_BITNESS == 64
|
||||
#if defined(__WIN64__)
|
||||
[[maybe_unused]] constexpr int STACK_CHECK_FROM = 5;
|
||||
#elif KYTY_PLATFORM == KYTY_PLATFORM_ANDROID
|
||||
#elif defined(__ANDROID__)
|
||||
[[maybe_unused]] constexpr int STACK_CHECK_FROM = 4;
|
||||
#else
|
||||
[[maybe_unused]] constexpr int STACK_CHECK_FROM = 2;
|
||||
#endif
|
||||
|
||||
#if defined(__WIN64__) || defined(__linux__)
|
||||
static SysCS* g_mem_cs = nullptr;
|
||||
static bool g_mem_initialized = false;
|
||||
static sys_heap_id_t g_default_heap = nullptr;
|
||||
static size_t g_mem_max_size = 0;
|
||||
#else
|
||||
static SysCS* g_mem_cs = 0;
|
||||
static bool g_mem_initialized = false;
|
||||
static sys_heap_id_t g_default_heap = 0;
|
||||
static size_t g_mem_max_size = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MEM_TRACKER
|
||||
|
||||
|
@ -210,7 +216,7 @@ void* mem_alloc(size_t size)
|
|||
{
|
||||
if (size == 0)
|
||||
{
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_LINUX
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
size = 1;
|
||||
#else
|
||||
EXIT("size == 0\n");
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#include <condition_variable> // IWYU pragma: keep
|
||||
#include <mutex>
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS && KYTY_COMPILER == KYTY_COMPILER_CLANG
|
||||
#if defined(__WIN64__)
|
||||
#define KYTY_WIN_CS
|
||||
#endif
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_WINDOWS && KYTY_PLATFORM != KYTY_PLATFORM_LINUX
|
||||
#if defined(__APPLE__)
|
||||
#define KYTY_SDL_THREADS
|
||||
#define KYTY_SDL_CS
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "Kyty/Sys/SysVirtual.h"
|
||||
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
#define KYTY_HAS_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
|
|
|
@ -859,7 +859,7 @@ ScriptVar ScriptTable::GetValue(uint32_t index) const
|
|||
void ScriptFuncResult::SetError(const String& msg)
|
||||
{
|
||||
m_ok = false;
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
strncpy_s(m_msg, SCRIPT_FUNC_ERR_SIZE + 1, msg.C_Str(), SCRIPT_FUNC_ERR_SIZE);
|
||||
#else
|
||||
strncpy(m_msg, msg.C_Str(), SCRIPT_FUNC_ERR_SIZE);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
|
||||
namespace Kyty {
|
||||
|
||||
|
@ -43,7 +44,7 @@ void sys_stack_usage(sys_dbg_stack_info_t& s)
|
|||
return;
|
||||
}
|
||||
str2[buff_len] = '\0';
|
||||
const char* name = basename(str2);
|
||||
const char* name = basename(str2);
|
||||
|
||||
result = snprintf(str, 1024,"/proc/%d/maps", static_cast<int>(pid));
|
||||
|
||||
|
@ -81,7 +82,7 @@ void sys_stack_usage(sys_dbg_stack_info_t& s)
|
|||
break;
|
||||
}
|
||||
|
||||
filename[0] = 0;
|
||||
filename[0];
|
||||
permissions[0] = 0;
|
||||
addr = 0;
|
||||
size = 0;
|
||||
|
|
Loading…
Reference in a new issue