mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 23:33:45 +02:00
Define WABT_BIG_ENDIAN=1
on big-endian hosts
WebAssembly is little-endian regardless of what machine you run it on, so the WebAssembly implementation needs to know if the machine is big-endian or little-endian to function properly.
This commit is contained in:
parent
ca6fb125c1
commit
a32646ff72
3 changed files with 12 additions and 8 deletions
3
.github/workflows/autobuild.yml
vendored
3
.github/workflows/autobuild.yml
vendored
|
@ -364,12 +364,11 @@ jobs:
|
||||||
cd build
|
cd build
|
||||||
ninja
|
ninja
|
||||||
mv libretro-mkxp-z.dll "$runner_temp"/retro-phase2
|
mv libretro-mkxp-z.dll "$runner_temp"/retro-phase2
|
||||||
mv "$runner_temp"/retro-phase2 .
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: libretro-mkxp-z.windows
|
name: libretro-mkxp-z.windows
|
||||||
path: retro-phase2
|
path: ${{ runner.temp }}/retro-phase2
|
||||||
|
|
||||||
build-retro-phase2-linux:
|
build-retro-phase2-linux:
|
||||||
needs: build-retro-phase1
|
needs: build-retro-phase1
|
||||||
|
|
16
meson.build
16
meson.build
|
@ -1,6 +1,7 @@
|
||||||
project('mkxp-z', 'c', 'cpp', version: '2.4.2', meson_version: '>=0.56.0', default_options: ['cpp_std=c++14', 'buildtype=release'])
|
project('mkxp-z', 'c', 'cpp', version: '2.4.2', meson_version: '>=0.56.0', default_options: ['cpp_std=c++14', 'buildtype=release'])
|
||||||
|
|
||||||
host_system = host_machine.system()
|
host_system = host_machine.system()
|
||||||
|
host_endian = host_machine.endian()
|
||||||
|
|
||||||
if get_option('retro') == false and host_system == 'darwin'
|
if get_option('retro') == false and host_system == 'darwin'
|
||||||
error('\nThis Meson project no longer supports macOS. Please use the Xcode project instead.')
|
error('\nThis Meson project no longer supports macOS. Please use the Xcode project instead.')
|
||||||
|
@ -58,6 +59,14 @@ if get_option('retro') == true
|
||||||
endif
|
endif
|
||||||
retro_deps += cmake.subproject('libzip', options: libzip_options).dependency('zip')
|
retro_deps += cmake.subproject('libzip', options: libzip_options).dependency('zip')
|
||||||
|
|
||||||
|
retro_defines = [
|
||||||
|
'-DWASM_RT_TRAP_HANDLER=mkxp_sandbox_trap_handler',
|
||||||
|
'-DMKXPZ_RETRO=1',
|
||||||
|
]
|
||||||
|
if host_endian == 'big'
|
||||||
|
retro_defines += '-DWABT_BIG_ENDIAN=1'
|
||||||
|
endif
|
||||||
|
|
||||||
library(
|
library(
|
||||||
'retro-' + meson.project_name(),
|
'retro-' + meson.project_name(),
|
||||||
dependencies: retro_deps,
|
dependencies: retro_deps,
|
||||||
|
@ -70,11 +79,8 @@ if get_option('retro') == true
|
||||||
'-Wno-unused-variable',
|
'-Wno-unused-variable',
|
||||||
'-Wno-unused-but-set-variable',
|
'-Wno-unused-but-set-variable',
|
||||||
'-Wno-ignored-optimization-argument',
|
'-Wno-ignored-optimization-argument',
|
||||||
'-DWASM_RT_TRAP_HANDLER=mkxp_sandbox_trap_handler',
|
] + retro_defines,
|
||||||
],
|
cpp_args: retro_defines,
|
||||||
cpp_args: [
|
|
||||||
'-DMKXPZ_RETRO',
|
|
||||||
],
|
|
||||||
link_args: [
|
link_args: [
|
||||||
host_system == 'darwin' ? '' : ('-Wl,--version-script=' + join_paths(meson.current_source_dir(), 'retro/link.T')),
|
host_system == 'darwin' ? '' : ('-Wl,--version-script=' + join_paths(meson.current_source_dir(), 'retro/link.T')),
|
||||||
],
|
],
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#define WASM_NULL 0
|
#define WASM_NULL 0
|
||||||
#define WASM_MEM(address) ((void *)&ruby->w2c_memory.data[address])
|
#define WASM_MEM(address) ((void *)&ruby->w2c_memory.data[address])
|
||||||
#define AWAIT(statement) do statement; while (w2c_ruby_mkxp_sandbox_yield(RB))
|
#define AWAIT(statement) do statement; while (w2c_ruby_mkxp_sandbox_yield(RB))
|
||||||
#define VALIDATE_MALLOC(ptr) do { if (ptr == WASM_NULL || ptr >= ruby.w2c_memory.size) throw SandboxOutOfMemoryException(); } while (0)
|
|
||||||
|
|
||||||
// This function is imported by wasm-rt-impl.c from wasm2c
|
// This function is imported by wasm-rt-impl.c from wasm2c
|
||||||
extern "C" void mkxp_sandbox_trap_handler(wasm_rt_trap_t code) {
|
extern "C" void mkxp_sandbox_trap_handler(wasm_rt_trap_t code) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue