diff --git a/base/assets/licenses/license_kinc.md b/base/assets/licenses/license_kore.md similarity index 96% rename from base/assets/licenses/license_kinc.md rename to base/assets/licenses/license_kore.md index bc5be846..6ea97a91 100644 --- a/base/assets/licenses/license_kinc.md +++ b/base/assets/licenses/license_kore.md @@ -18,4 +18,4 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. -https://github.com/Kode/Kinc +https://github.com/Kode/Kore diff --git a/base/readme.md b/base/readme.md index 3f1e2db5..1aab4be8 100644 --- a/base/readme.md +++ b/base/readme.md @@ -2,4 +2,4 @@ 3D engine for C with JS scripting, targeting Direct3D12, Vulkan, Metal and WebGPU. -Powered by [Kore](https://github.com/Kode/Kore) - low-level hardware abstraction library. +Based on [Kore](https://github.com/Kode/Kore) - low-level hardware abstraction library. diff --git a/base/sources/backends/apple_video.m b/base/sources/backends/apple_video.m index c17ad9fa..6ce00fa0 100644 --- a/base/sources/backends/apple_video.m +++ b/base/sources/backends/apple_video.m @@ -131,7 +131,7 @@ // strcpy(name, macgetresourcepath()); // #endif // strcat(name, "/"); -// strcat(name, KINC_DEBUGDIR); +// strcat(name, KINC_OUTDIR); // strcat(name, "/"); // strcat(name, filename); // video->impl.url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:name]]; diff --git a/base/sources/backends/linux_system.c b/base/sources/backends/linux_system.c index 17d6800a..e80025f6 100644 --- a/base/sources/backends/linux_system.c +++ b/base/sources/backends/linux_system.c @@ -498,7 +498,6 @@ static void load_lib(void **lib, const char *name) { int kinc_x11_error_handler(Display *display, XErrorEvent *error_event) { xlib.XGetErrorText(display, error_event->error_code, buffer, 1024); kinc_log(KINC_LOG_LEVEL_ERROR, "X Error: %s", buffer); - kinc_debug_break(); return 0; } diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index a75d68e4..7b916c48 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -89,7 +89,6 @@ static VkBool32 vkDebugUtilsMessengerCallbackEXT( if (message_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { kinc_log(KINC_LOG_LEVEL_ERROR, "Vulkan ERROR: Code %d : %s", pcallback_data->messageIdNumber, pcallback_data->pMessage); - // kinc_debug_break(); } else if (message_severity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) { kinc_log(KINC_LOG_LEVEL_WARNING, "Vulkan WARNING: Code %d : %s", pcallback_data->messageIdNumber, pcallback_data->pMessage); diff --git a/base/sources/iron.h b/base/sources/iron.h index c435e1db..08904bea 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -2029,14 +2029,14 @@ string_t *iron_get_files_location() { char path[1024]; strcpy(path, macgetresourcepath()); strcat(path, "/"); - strcat(path, KINC_DEBUGDIR); + strcat(path, KINC_OUTDIR); strcat(path, "/"); return path; #elif defined(KINC_IOS) char path[1024]; strcpy(path, iphonegetresourcepath()); strcat(path, "/"); - strcat(path, KINC_DEBUGDIR); + strcat(path, KINC_OUTDIR); strcat(path, "/"); return path; #else diff --git a/base/sources/iron_file.c b/base/sources/iron_file.c index f1adeabc..84cd6baf 100644 --- a/base/sources/iron_file.c +++ b/base/sources/iron_file.c @@ -128,7 +128,7 @@ bool kinc_internal_file_reader_open(kinc_file_reader_t *reader, const char *file strcpy(filepath, type == KINC_FILE_TYPE_SAVE ? kinc_internal_save_path() : iphonegetresourcepath()); if (type != KINC_FILE_TYPE_SAVE) { strcat(filepath, "/"); - strcat(filepath, KINC_DEBUGDIR); + strcat(filepath, KINC_OUTDIR); strcat(filepath, "/"); } @@ -138,7 +138,7 @@ bool kinc_internal_file_reader_open(kinc_file_reader_t *reader, const char *file strcpy(filepath, type == KINC_FILE_TYPE_SAVE ? kinc_internal_save_path() : macgetresourcepath()); if (type != KINC_FILE_TYPE_SAVE) { strcat(filepath, "/"); - strcat(filepath, KINC_DEBUGDIR); + strcat(filepath, KINC_OUTDIR); strcat(filepath, "/"); } strcat(filepath, filename); @@ -248,62 +248,31 @@ size_t kinc_file_reader_size(kinc_file_reader_t *reader) { } float kinc_read_f32le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN // speed optimization return *(float *)data; -#else // works on all architectures - int i = (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); - return *(float *)&i; -#endif } uint64_t kinc_read_u64le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN return *(uint64_t *)data; -#else - return ((uint64_t)data[0] << 0) | ((uint64_t)data[1] << 8) | ((uint64_t)data[2] << 16) | ((uint64_t)data[3] << 24) | ((uint64_t)data[4] << 32) | - ((uint64_t)data[5] << 40) | ((uint64_t)data[6] << 48) | ((uint64_t)data[7] << 56); -#endif } int64_t kinc_read_s64le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN return *(int64_t *)data; -#else - return ((int64_t)data[0] << 0) | ((int64_t)data[1] << 8) | ((int64_t)data[2] << 16) | ((int64_t)data[3] << 24) | ((int64_t)data[4] << 32) | - ((int64_t)data[5] << 40) | ((int64_t)data[6] << 48) | ((int64_t)data[7] << 56); -#endif } uint32_t kinc_read_u32le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN return *(uint32_t *)data; -#else - return (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); -#endif } int32_t kinc_read_s32le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN return *(int32_t *)data; -#else - return (data[0] << 0) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); -#endif } uint16_t kinc_read_u16le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN return *(uint16_t *)data; -#else - return (data[0] << 0) | (data[1] << 8); -#endif } int16_t kinc_read_s16le(uint8_t *data) { -#ifdef KINC_LITTLE_ENDIAN return *(int16_t *)data; -#else - return (data[0] << 0) | (data[1] << 8); -#endif } uint8_t kinc_read_u8(uint8_t *data) { diff --git a/base/sources/iron_file.h b/base/sources/iron_file.h index de5ef5ef..b37619fe 100644 --- a/base/sources/iron_file.h +++ b/base/sources/iron_file.h @@ -5,10 +5,7 @@ #include #include -#ifndef KINC_DEBUGDIR -#define KINC_DEBUGDIR "out" -#endif - +#define KINC_OUTDIR "out" #ifdef KINC_ANDROID struct AAsset; struct __sFILE; diff --git a/base/sources/iron_global.h b/base/sources/iron_global.h index a08efebc..0b1fd40f 100644 --- a/base/sources/iron_global.h +++ b/base/sources/iron_global.h @@ -3,47 +3,25 @@ #include #include -#define KINC_LITTLE_ENDIAN - -#ifdef _MSC_VER -#define KINC_INLINE static __forceinline -#else -#define KINC_INLINE static __attribute__((always_inline)) inline -#endif - #if defined(_WIN32) - #define KINC_WINDOWS - #elif defined(__APPLE__) - #include - #if TARGET_OS_IPHONE - #define KINC_IOS #define KINC_APPLE_SOC - #else - #define KINC_MACOS - #if defined(__arm64__) #define KINC_APPLE_SOC #endif - #endif - #define KINC_POSIX - #elif defined(__linux__) - #if !defined(KINC_ANDROID) #define KINC_LINUX #endif - #define KINC_POSIX - #endif int kickstart(int argc, char **argv); diff --git a/base/sources/iron_system.h b/base/sources/iron_system.h index 6d76f477..860e43d7 100644 --- a/base/sources/iron_system.h +++ b/base/sources/iron_system.h @@ -111,24 +111,6 @@ void kinc_start(void); void kinc_stop(void); void kinc_set_keep_screen_on(bool on); -KINC_INLINE void kinc_debug_break(void) { -#ifndef NDEBUG -#if defined(_MSC_VER) - __debugbreak(); -#elif defined(__clang__) - __builtin_debugtrap(); -#else -#if defined(__aarch64__) - __asm__ volatile(".inst 0xd4200000"); -#elif defined(__x86_64__) - __asm__ volatile("int $0x03"); -#else - kinc_log(KINC_LOG_LEVEL_WARNING, "Oh no, kinc_debug_break is not implemented for the current compiler and CPU."); -#endif -#endif -#endif -} - void kinc_copy_to_clipboard(const char *text); void kinc_set_update_callback(void (*callback)(void *), void *data); void kinc_set_foreground_callback(void (*callback)(void *), void *data);