Skip to content

Commit

Permalink
Clean up the KINC/KORE defines
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Mar 28, 2024
1 parent 5b333a5 commit ffcf3c4
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Backends/Kinc-HL/kfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ project.addExcludes('hl/src/std/unicase.c', 'hl/src/std/debug.c', 'hl/include/pc
project.addIncludeDirs('hl/src', 'hl/include/pcre', 'hl/include/mbedtls/include', 'hl/include/zlib');
project.addFiles('hl/include/mbedtls/library/**', 'hl/include/zlib/**', 'hl/libs/fmt/fmt.c', 'hl/libs/fmt/sha1.c', 'hl/libs/ssl/ssl.c');

if (platform == Platform.OSX) project.addDefine('KORE_DEBUGDIR="osx-hl"');
if (platform == Platform.iOS) project.addDefine('KORE_DEBUGDIR="ios-hl"');
if (platform == Platform.OSX) project.addDefine('KINC_DEBUGDIR="osx-hl"');
if (platform == Platform.iOS) project.addDefine('KINC_DEBUGDIR="ios-hl"');
if (platform !== Platform.Windows || audio !== AudioApi.DirectSound) {
project.addDefine('KORE_MULTITHREADED_AUDIO');
project.addDefine('KINC_MULTITHREADED_AUDIO');
}

project.addDefine('KORE');
Expand Down
4 changes: 2 additions & 2 deletions Backends/Kinc-HL/kinc-bridge/kinc.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void update(void *data) {
static bool mixThreadregistered = false;

static void mix(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata) {
#ifdef KORE_MULTITHREADED_AUDIO
#ifdef KINC_MULTITHREADED_AUDIO
if (!mixThreadregistered) {
vdynamic *ret;
hl_register_thread(&ret);
Expand All @@ -65,7 +65,7 @@ static void mix(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata) {
}
}

#ifdef KORE_MULTITHREADED_AUDIO
#ifdef KINC_MULTITHREADED_AUDIO
hl_blocking(false);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Backends/Kinc-HL/kinc-bridge/texture.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void hl_kinc_texture_unlock(vbyte *texture, vbyte *bytes) {
int stride = kinc_g4_texture_stride(tex);
for (int y = 0; y < tex->tex_height; ++y) {
for (int x = 0; x < tex->tex_width; ++x) {
#ifdef KORE_DIRECT3D
#ifdef KINC_DIRECT3D
if (tex->format == KINC_IMAGE_FORMAT_RGBA32) {
// RBGA->BGRA
btex[y * stride + x * size + 0] = b[(y * tex->tex_width + x) * size + 2];
Expand Down
12 changes: 8 additions & 4 deletions Backends/Kinc-hxcpp/kfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ if (platform === Platform.WindowsApp) {
project.addDefine('HX_WINRT');
}
if (platform !== Platform.Windows || audio !== AudioApi.DirectSound) {
project.addDefine('KORE_MULTITHREADED_AUDIO');
project.addDefine('KINC_MULTITHREADED_AUDIO');
}
if (platform === Platform.OSX) {
project.addDefine('HXCPP_M64');
project.addDefine('HX_MACOS');
}
if (platform === Platform.Linux) project.addDefine('HX_LINUX');
if (platform === Platform.Linux) {
project.addDefine('HX_LINUX');
}
if (platform === Platform.iOS) {
project.addDefine('IPHONE');
project.addDefine('HX_IPHONE');
Expand All @@ -110,10 +112,12 @@ if (platform === Platform.Android) {
project.addDefine('HXCPP_ANDROID_PLATFORM=24');
}
if (platform === Platform.OSX) {
project.addDefine('KORE_DEBUGDIR="osx"');
project.addDefine('KINC_DEBUGDIR="osx"');
project.addLib('Security');
}
if (platform === Platform.iOS) project.addDefine('KORE_DEBUGDIR="ios"');
if (platform === Platform.iOS) {
project.addDefine('KINC_DEBUGDIR="ios"');
}

// project:addDefine('HXCPP_SCRIPTABLE');
project.addDefine('STATIC_LINK');
Expand Down
2 changes: 1 addition & 1 deletion Backends/Kinc-hxcpp/kha/Image.hx
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ class Image implements Canvas implements Resource {
int stride = kinc_g4_texture_stride(&texture);
for (int y = 0; y < texture.tex_height; ++y) {
for (int x = 0; x < texture.tex_width; ++x) {
#ifdef KORE_DIRECT3D
#ifdef KINC_DIRECT3D
if (texture.format == KINC_IMAGE_FORMAT_RGBA32) {
//RBGA->BGRA
tex[y * stride + x * size + 0] = b[(y * originalWidth + x) * size + 2];
Expand Down
8 changes: 4 additions & 4 deletions Backends/Kinc-hxcpp/kha/graphics4/ShaderStorageBuffer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package kha.graphics4;
#include <kinc/graphics4/compute.h>
")
@:headerClassCode("
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
kinc_shader_storage_buffer buffer;
#endif")
class ShaderStorageBuffer {
Expand All @@ -19,7 +19,7 @@ class ShaderStorageBuffer {
}

@:functionCode("
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
kinc_g4_vertex_data type2;
switch (type) {
case 0:
Expand Down Expand Up @@ -48,7 +48,7 @@ class ShaderStorageBuffer {
}

@:functionCode("
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
kinc_shader_storage_buffer_destroy(&buffer);
#endif
")
Expand All @@ -59,7 +59,7 @@ class ShaderStorageBuffer {
}

@:functionCode("
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
int* indices = kinc_shader_storage_buffer_lock(&buffer);
for (int i = 0; i < myCount; ++i) {
indices[i] = data[i];
Expand Down
2 changes: 1 addition & 1 deletion Backends/Kinc-hxcpp/kha/kore/graphics4/Graphics.hx
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ class Graphics implements kha.graphics4.Graphics {

public function setShaderStorageBuffer(buffer: ShaderStorageBuffer, index: Int) {
untyped __cpp__("
#ifdef KORE_OPENGL
#ifdef KINC_OPENGL
kinc_g4_set_shader_storage_buffer(&buffer->buffer, index);
#endif
");
Expand Down
10 changes: 5 additions & 5 deletions Backends/Kinc-hxcpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace {
using namespace Kore;

int t0 = 99;
#ifdef KORE_MULTITHREADED_AUDIO
#ifdef KINC_MULTITHREADED_AUDIO
if (!mixThreadregistered && !::kha::audio2::Audio_obj::disableGcInteractions) {
hx::SetTopOfStack(&t0, true);
mixThreadregistered = true;
Expand All @@ -228,7 +228,7 @@ namespace {

::kha::audio2::Audio_obj::_callCallback(samples * 2, kinc_a2_samples_per_second());

#ifdef KORE_MULTITHREADED_AUDIO
#ifdef KINC_MULTITHREADED_AUDIO
if (mixThreadregistered) {
hx::EnterGCFreeZone();
}
Expand Down Expand Up @@ -351,7 +351,7 @@ void run_kinc() {
kinc_log(KINC_LOG_LEVEL_INFO, "Starting application");
kinc_start();
kinc_log(KINC_LOG_LEVEL_INFO, "Application stopped");
#if !defined(KORE_XBOX_ONE) && !defined(KORE_TIZEN) && !defined(KORE_HTML5)
#if !defined(KINC_HTML5)
kinc_threads_quit();
kinc_stop();
#endif
Expand All @@ -366,7 +366,7 @@ extern "C" void __hxcpp_main();
extern int _hxcpp_argc;
extern char **_hxcpp_argv;

#ifdef KORE_WINDOWS
#ifdef KINC_WINDOWS
#include <Windows.h>
#endif

Expand All @@ -386,7 +386,7 @@ int kickstart(int argc, char **argv) {
} catch (Dynamic e) {
__hx_dump_stack();
kinc_log(KINC_LOG_LEVEL_ERROR, "Error %s", e == null() ? "null" : e->toString().__CStr());
#ifdef KORE_WINDOWS
#ifdef KINC_WINDOWS
MessageBoxW(NULL, e->toString().__WCStr(), NULL, MB_OK);
#endif
return -1;
Expand Down
2 changes: 1 addition & 1 deletion Tools/khamake
Submodule khamake updated 2 files
+1 −1 out/main.js
+1 −1 src/main.ts

0 comments on commit ffcf3c4

Please sign in to comment.