Skip to content

Commit

Permalink
Merge pull request Kode#1438 from Apprentice-Alchemist/patch-1
Browse files Browse the repository at this point in the history
Hashlink fixes + HL CI for Linux/macOS.
  • Loading branch information
RobDangerous authored Nov 29, 2022
2 parents 5984b8f + 113bcee commit 3eea6fd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/linux-hl-opengl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Linux (HL, OpenGL)

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Apt Update
run: sudo apt-get update
- name: Apt Install
run: sudo apt-get install libasound2-dev libxinerama-dev libxrandr-dev libgl1-mesa-dev libxi-dev libxcursor-dev libudev-dev libwayland-dev wayland-protocols libxkbcommon-dev --yes --quiet
- name: Get DLC
run: ./get_dlc
- name: Get Node.js
run: git clone https://github.com/Kode/nodejs_bin.git --depth 1
- name: Setup Node.js
run: nodejs_bin/copysysbin.sh
- name: Compile
run: nodejs_bin/node make.js linux-hl -g opengl --kha . --from Tests/Empty --compile
25 changes: 25 additions & 0 deletions .github/workflows/macos-hl-metal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: macOS (HL, Metal)

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: macOS-latest

steps:
- uses: actions/checkout@v1
- name: Get DLC
run: ./get_dlc
- name: Get Node.js
run: git clone https://github.com/Kode/nodejs_bin.git --depth 1
- name: Setup Node.js
run: nodejs_bin/copysysbin.sh
- name: Compile
run: nodejs_bin/node make.js osx-hl -g metal --kha . --from Tests/Empty --compile
2 changes: 1 addition & 1 deletion Backends/Kinc-HL/kfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project.addDefine('KORE');
project.addDefine('KOREC');
project.addDefine('ROTATE90');
project.addDefine('LIBHL_STATIC');
project.c11 = true;
project.cStd = 'c11';

if (platform === Platform.Windows || platform === Platform.WindowsApp) {
project.addDefine('_WINSOCK_DEPRECATED_NO_WARNINGS');
Expand Down
11 changes: 7 additions & 4 deletions Backends/Kinc-HL/kinc-bridge/arrays.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,28 @@ double hl_kinc_bytearray_getfloat64_le(vbyte *bytearray, int byteoffset) {
// Set (little endian on big endian system)

void hl_kinc_bytearray_setint16_le(vbyte *bytearray, int byteoffset, int value) {
int8_t *data = (int8_t *)&((int16_t)value);
int16_t val = value;
int8_t *data = (int8_t *)&(val);
int16_t le_value = data[0] << 8 | data[1] << 0;
*((int16_t *)&bytearray[byteoffset]) = le_value;
}

void hl_kinc_bytearray_setuint16_le(vbyte *bytearray, int byteoffset, int value) {
int8_t *data = (int8_t *)&((uint16_t)value);
uint16_t val = value;
int8_t *data = (int8_t *)&(val);
uint16_t le_value = data[0] << 8 | data[1] << 0;
*((uint16_t *)&bytearray[byteoffset]) = le_value;
}

void hl_kinc_bytearray_setint32_le(vbyte *bytearray, int byteoffset, int value) {
int8_t *data = (int8_t *)&((int32_t)value);
int8_t *data = (int8_t *)&(value);
int32_t le_value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3] << 0;
*((int32_t *)&bytearray[byteoffset]) = le_value;
}

void hl_kinc_bytearray_setuint32_le(vbyte *bytearray, int byteoffset, int64_t value) {
int8_t *data = (int8_t *)&((uint32_t)value);
uint32_t val = (uint32_t)value;
int8_t *data = (int8_t *)&(val);
uint32_t le_value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3] << 0;
*((uint32_t *)&bytearray[byteoffset]) = le_value;
}
Expand Down

0 comments on commit 3eea6fd

Please sign in to comment.