Run Choano on the Kryon desktop and Android hosts
This commit is contained in:
1 parent
d3fa2a883c
commit
e767df39ca
22 files changed
+396
-490
No files matched your search
@@ -46,7 +46,7 @@ jobs:
|
||||
project: waozixyz/choano
|
||||
path: ziranlang/ziran
|
||||
fetch: true
|
||||
packages: build-essential cmake pkg-config zlib1g-dev python3-pil
|
||||
packages: build-essential cmake meson ninja-build pkg-config zlib1g-dev python3-pil
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
path: ziranlang/ziran
|
||||
fetch: true
|
||||
packages: >-
|
||||
build-essential cmake nasm pkg-config zlib1g-dev libssl-dev libsdl2-dev libcairo2-dev libfreetype-dev
|
||||
build-essential cmake meson ninja-build nasm pkg-config zlib1g-dev libssl-dev libsdl2-dev libcairo2-dev libfreetype-dev
|
||||
libfontconfig-dev libpango1.0-dev libgtk-3-dev libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev
|
||||
libxi-dev libgl1-mesa-dev python3-pil xvfb xdotool imagemagick
|
||||
# Ubuntu 22.04's default Python lacks hashlib.file_digest, used by
|
||||
@@ -143,8 +143,8 @@ jobs:
|
||||
path: ziranlang/ziran
|
||||
fetch: true
|
||||
packages: >-
|
||||
build-essential cmake nasm pkg-config zlib1g-dev python3-pil gcc-mingw-w64-x86-64-win32
|
||||
g++-mingw-w64-x86-64-win32 binutils-mingw-w64-x86-64 nsis
|
||||
build-essential cmake meson ninja-build nasm pkg-config zlib1g-dev python3-pil gcc-mingw-w64-x86-64-win32
|
||||
g++-mingw-w64-x86-64-win32 binutils-mingw-w64-x86-64 nsis zstd
|
||||
- name: Cross-build the Windows installer
|
||||
run: python3 scripts/desktop_release.py windows
|
||||
- name: Name the download
|
||||
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
path: ziranlang/ziran
|
||||
fetch: true
|
||||
packages: >-
|
||||
build-essential cmake nasm pkg-config zlib1g-dev libssl-dev libsdl2-dev libcairo2-dev libfreetype-dev libfontconfig-dev libpango1.0-dev libgtk-3-dev libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev libxi-dev libgl1-mesa-dev xvfb xdotool imagemagick python3-pil python3-yaml
|
||||
build-essential cmake meson ninja-build nasm pkg-config zlib1g-dev libssl-dev libsdl2-dev libcairo2-dev libfreetype-dev libfontconfig-dev libpango1.0-dev libgtk-3-dev libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev libxi-dev libgl1-mesa-dev xvfb xdotool imagemagick python3-pil python3-yaml
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Run desktop and Android on Kryon 0.6.0 with Ziran 0.7.0.
|
||||
|
||||
- Run in the current Arcade and Inner Breeze package format.
|
||||
- Reset Amoeba growth cleanly at each size, make later sizes take about a quarter more food, grow creatures more gently, and recolor the largest threat so it no longer looks edible.
|
||||
- Choano's theme is a CSS sheet now, read by Kryon's CSS package.
|
||||
|
||||
@@ -103,11 +103,11 @@ through `APPIMAGE_EXTRACT_AND_RUN`, without FUSE. Releases name it
|
||||
## Windows installer
|
||||
|
||||
`python3 scripts/desktop_release.py windows` builds `build/Choano-setup.exe`.
|
||||
`src/windows.zi` runs the same game Frame on Kryon's raylib host (RGFW, OpenGL
|
||||
1.1, AVIF art through Kryon's static libavif and raylib audio for the chimes
|
||||
and shark loop), linked statically with MinGW-w64 from the locked Ziran
|
||||
runtime and raylib; the build keeps its intermediates in `build/windows`. NSIS (`makensis`) packs the
|
||||
program, Kryon's Liberation Sans and every asset into a per-user installer:
|
||||
The MinGW-w64 build uses the Linux edition's `src/desktop.zi` entry point,
|
||||
Kryon's SDL2/Cairo renderer SDK, the AVIF decoder DLL and Ziran's audio sink.
|
||||
The decoder builds with CMake, Meson, Ninja and NASM.
|
||||
NSIS (`makensis`) packs the program, its libraries, Kryon's Liberation Sans
|
||||
and every asset into a per-user installer with
|
||||
no administrator rights, Start menu and desktop shortcuts, and an uninstall
|
||||
entry in the player's own registry. Settings live in
|
||||
`%LOCALAPPDATA%\Choano` and stay after uninstalling. The installer is not
|
||||
@@ -121,8 +121,9 @@ uninstalls it. Releases name it `choano-vVERSION-windows-x86_64-setup.exe`.
|
||||
`make android` builds the unsigned release APK on Kryon's Android host and
|
||||
`make android-gplay` the Google Play edition's. They need JDK 21 and the
|
||||
Android SDK's NDK 28.2.13676358, build-tools 36.0.0, android-36 and CMake
|
||||
3.22.1; Gradle's project is generated in ignored `droid/` from the locked
|
||||
Kryon. `python3 scripts/android.py sign APK --output FILE` signs with the
|
||||
3.22.1, plus Meson and Ninja for the AVIF decoder. Gradle's project is
|
||||
generated in ignored `droid/` from the locked Kryon.
|
||||
`python3 scripts/android.py sign APK --output FILE` signs with the
|
||||
ignored `backup/android-signing` key and verifies the package, both ARM
|
||||
architectures, the bundled art and the Choano certificate.
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ def envOrProp = { String envName, String propName ->
|
||||
}
|
||||
def kryonDir = envOrProp('KRYON_DIR', 'kryon.dir')
|
||||
def ziranDir = envOrProp('ZIRAN_DIR', 'ziran.dir')
|
||||
def raylibDir = envOrProp('RAYLIB_DIR', 'raylib.dir')
|
||||
def webpDir = envOrProp('WEBP_DIR', 'webp.dir')
|
||||
if (kryonDir == null || ziranDir == null || raylibDir == null || webpDir == null) {
|
||||
def avifDir = envOrProp('AVIF_DIR', 'avif.dir')
|
||||
def aomDir = envOrProp('AOM_DIR', 'aom.dir')
|
||||
if ([kryonDir, ziranDir, webpDir, avifDir, aomDir].contains(null)) {
|
||||
throw new GradleException('Build through scripts/android.py build')
|
||||
}
|
||||
def androidAbis = (project.findProperty('app.abis') ?: 'arm64-v8a,armeabi-v7a').split(',').toList()
|
||||
@@ -44,10 +45,12 @@ android {
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
targets 'main'
|
||||
arguments '-DKRYON_DIR=' + kryonDir,
|
||||
'-DZIRAN_DIR=' + ziranDir,
|
||||
'-DRAYLIB_DIR=' + raylibDir,
|
||||
'-DWEBP_DIR=' + webpDir,
|
||||
'-DAVIF_DIR=' + avifDir,
|
||||
'-DAOM_DIR=' + aomDir,
|
||||
'-DAPP_EDITION=' + appEdition
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(ChoanoWindowsCodecs C CXX)
|
||||
|
||||
include("${KRYON_DIR}/cmake/AVIF.cmake")
|
||||
kryon_avif_decoder("${AVIF_DIR}" "${AOM_DIR}")
|
||||
|
||||
# The locked AVIF recipe exposes the static objects on Windows. Package the
|
||||
# same decoder API as a DLL for the Cairo renderer's runtime loader.
|
||||
target_compile_definitions(avif_obj PRIVATE AVIF_DLL AVIF_BUILDING_SHARED_LIBS)
|
||||
add_library(kryonavif SHARED $<TARGET_OBJECTS:avif_obj>)
|
||||
target_link_libraries(kryonavif PRIVATE aom dav1d::dav1d Threads::Threads)
|
||||
set_target_properties(kryonavif PROPERTIES PREFIX "")
|
||||
@@ -32,16 +32,21 @@ Section "Install"
|
||||
SetShellVarContext current
|
||||
; A reinstall replaces the old assets rather than mixing them.
|
||||
RMDir /r "$INSTDIR\assets"
|
||||
RMDir /r "$INSTDIR\bin"
|
||||
RMDir /r "$INSTDIR\etc"
|
||||
RMDir /r "$INSTDIR\share"
|
||||
Delete "$INSTDIR\Choano.exe"
|
||||
Delete "$INSTDIR\kryon-font.ttf"
|
||||
SetOutPath "$INSTDIR"
|
||||
File /r "${STAGE}\*.*"
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
; Shortcuts start in the program folder, beside its assets.
|
||||
CreateShortCut "$SMPROGRAMS\${APP}.lnk" "$INSTDIR\Choano.exe" "" "$INSTDIR\Choano.exe" 0
|
||||
CreateShortCut "$DESKTOP\${APP}.lnk" "$INSTDIR\Choano.exe" "" "$INSTDIR\Choano.exe" 0
|
||||
CreateShortCut "$SMPROGRAMS\${APP}.lnk" "$INSTDIR\bin\Choano.exe" "" "$INSTDIR\bin\Choano.exe" 0
|
||||
CreateShortCut "$DESKTOP\${APP}.lnk" "$INSTDIR\bin\Choano.exe" "" "$INSTDIR\bin\Choano.exe" 0
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayName" "${APP}"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayVersion" "${VERSION}"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "Publisher" "Waozi"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\Choano.exe"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\bin\Choano.exe"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "URLInfoAbout" "https://waozi.xyz"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
@@ -56,8 +61,9 @@ Section "Uninstall"
|
||||
Delete "$SMPROGRAMS\${APP}.lnk"
|
||||
Delete "$DESKTOP\${APP}.lnk"
|
||||
RMDir /r "$INSTDIR\assets"
|
||||
Delete "$INSTDIR\Choano.exe"
|
||||
Delete "$INSTDIR\kryon-font.ttf"
|
||||
RMDir /r "$INSTDIR\bin"
|
||||
RMDir /r "$INSTDIR\etc"
|
||||
RMDir /r "$INSTDIR\share"
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
DeleteRegKey HKCU "${UNINSTALL_KEY}"
|
||||
|
||||
+21
-7
@@ -131,7 +131,7 @@ def account_provider(android, edition, abis):
|
||||
options=[f'entity:edition={"play" if edition == "gplay" else "direct"}', f'entity:ndk={ndk}',
|
||||
f'entity:android_api={api}'])
|
||||
flags = ' '.join('"' + flag.replace('\\', '/').replace('"', '') + '"' for flag in crypto.link_flags(env=env))
|
||||
rows.append(f'if(ANDROID_ABI STREQUAL "{abi}")\n target_link_libraries(main {flags})\nendif()\n')
|
||||
rows.append(f'if(ANDROID_ABI STREQUAL "{abi}")\n target_link_libraries(main PRIVATE {flags})\nendif()\n')
|
||||
cmake = ROOT / 'droid/app/src/main/cpp/CMakeLists.txt'
|
||||
text = cmake.read_text().split(ACCOUNT_MARKER)[0]
|
||||
defines = 'set(APP_ZIRAN_DEFINES --define ANDROID_BUILD'
|
||||
@@ -139,12 +139,26 @@ def account_provider(android, edition, abis):
|
||||
raise SystemExit("Kryon's Android CMakeLists.txt no longer sets APP_ZIRAN_DEFINES")
|
||||
if 'CHOANO_ACCOUNTS' not in text:
|
||||
text = text.replace(defines, defines + ' --define CHOANO_ACCOUNTS', 1)
|
||||
cmake.write_text(text + ACCOUNT_MARKER + ''.join(rows))
|
||||
# The scaffold's default host owns its own frame loop. Select the
|
||||
# NativeActivity runtime for Choano's main, which brackets app audio.
|
||||
generator = '--manifest "${APP_ZIRAN_MANIFEST}"'
|
||||
host = '--host "${KRYON_DIR}/src/backend/android_runtime.zi"'
|
||||
if generator not in text:
|
||||
raise SystemExit("Kryon's Android CMakeLists.txt no longer generates the native sources")
|
||||
if host not in text:
|
||||
text = text.replace(generator, host + '\n ' + generator, 1)
|
||||
cmake.write_text(text + ACCOUNT_MARKER + """
|
||||
set(OPUS_DIR "$ENV{KRYON_ANDROID_OPUS_DIR}")
|
||||
set(SAMPLERATE_DIR "$ENV{KRYON_ANDROID_SAMPLERATE_DIR}")
|
||||
add_subdirectory("$ENV{KRYON_ANDROID_AUDIO_DIR}/native" choano-audio EXCLUDE_FROM_ALL)
|
||||
target_link_libraries(main PRIVATE opus OpenSLES)
|
||||
""" + ''.join(rows))
|
||||
|
||||
|
||||
def build(edition, abis=ABIS):
|
||||
run(ZIRAN, 'fetch', *LOCKED, cwd=ROOT)
|
||||
kryon, compiler, raylib, webp = package('kryon'), package('ziran'), package('raylib'), package('libwebp')
|
||||
kryon, compiler = package('kryon'), package('ziran')
|
||||
webp, avif, aom = package('libwebp'), package('libavif'), package('libaom')
|
||||
if not all((compiler / 'build/bin' / name).is_file() for name in ('ziran', 'zi2c')):
|
||||
run('make', '-s', '-j2', '-C', compiler, 'build/bin/ziran', 'build/bin/zi2c', 'build/bin/zi2zir')
|
||||
android = sdk()
|
||||
@@ -173,8 +187,8 @@ def build(edition, abis=ABIS):
|
||||
title.convert('RGB').save(res / 'drawable-nodpi/startup_art.jpg', quality=90)
|
||||
name, code = version()
|
||||
command = ['sh', ROOT / 'droid/gradlew', '-p', ROOT / 'droid', '--no-daemon', '--max-workers=1',
|
||||
'-Pkryon.dir=' + str(kryon), '-Pziran.dir=' + str(compiler), '-Praylib.dir=' + str(raylib / 'src'),
|
||||
'-Pwebp.dir=' + str(webp),
|
||||
'-Pkryon.dir=' + str(kryon), '-Pziran.dir=' + str(compiler),
|
||||
'-Pwebp.dir=' + str(webp), '-Pavif.dir=' + str(avif), '-Paom.dir=' + str(aom),
|
||||
'-Papp.abis=' + abis, '-Papp.edition=' + edition, '-Papp.versionName=' + name,
|
||||
'-Papp.versionCode=' + str(code), '-Pandroid.aapt2FromMavenOverride=' + str(aapt2)]
|
||||
# Kryon's Play Billing needs AndroidX; only the Google Play edition has it.
|
||||
@@ -182,10 +196,10 @@ def build(edition, abis=ABIS):
|
||||
command.append('-Pandroid.useAndroidX=true')
|
||||
env = dict(os.environ, ANDROID_HOME=str(android), ANDROID_SDK_ROOT=str(android), CMAKE_BUILD_PARALLEL_LEVEL='1',
|
||||
GRADLE_USER_HOME=str(OUT / 'gradle-home'))
|
||||
env['KRYON_PROJECT_ENTRY'] = 'src/app.zi'
|
||||
# Kryon's Android CMake builds its AVIF and Opus codecs from these locked
|
||||
# sources, as its own scripts/android-build.sh passes them.
|
||||
for variable, name_ in (('KRYON_ANDROID_AVIF_DIR', 'libavif'), ('KRYON_ANDROID_AOM_DIR', 'libaom'),
|
||||
('KRYON_DAV1D_DIR', 'dav1d'), ('KRYON_AVIF_PACKAGE_DIR', 'avif'),
|
||||
for variable, name_ in (('KRYON_DAV1D_DIR', 'dav1d'), ('KRYON_AVIF_PACKAGE_DIR', 'avif'),
|
||||
('KRYON_WEBP_PACKAGE_DIR', 'webp'), ('KRYON_ANDROID_AUDIO_DIR', 'audio'),
|
||||
('KRYON_ANDROID_OPUS_DIR', 'libopus'), ('KRYON_ANDROID_SAMPLERATE_DIR', 'libsamplerate')):
|
||||
env[variable] = str(package(name_))
|
||||
|
||||
+17
-25
@@ -35,23 +35,17 @@ def shared_script(owner, name):
|
||||
return module
|
||||
|
||||
|
||||
def renderer_metadata(selection, platform, env=None):
|
||||
renderers = shared_script('kryon', 'renderer_artifact')
|
||||
return renderers.renderer_metadata(artifact(selection, platform, env))
|
||||
|
||||
|
||||
def renderer_links():
|
||||
artifacts = shared_script('ziran', 'ziran_artifacts')
|
||||
renderers = shared_script('kryon', 'renderer_artifact')
|
||||
artifact = artifacts.request('kryon:renderer-raylib', 'linux-x86_64-gnu', project=ROOT, ziran=ZIRAN)
|
||||
return renderers.renderer_link(renderers.renderer_metadata(artifact), preloads=False)
|
||||
|
||||
|
||||
def avif_links():
|
||||
"""Kryon's desktop renderer decodes AVIF art with its self-contained
|
||||
libkryonavif.so, kept in DT_NEEDED so packaging carries it beside the
|
||||
game. Kryon's host also finds it in the program's lib and ../lib folders;
|
||||
LDLIBS is split on spaces unquoted, so it takes no $ORIGIN run path."""
|
||||
artifacts = shared_script('ziran', 'ziran_artifacts')
|
||||
renderers = shared_script('kryon', 'renderer_artifact')
|
||||
artifact = artifacts.request('kryon:renderer-desktop', 'linux-x86_64-gnu', project=ROOT, ziran=ZIRAN)
|
||||
links = []
|
||||
for library in renderers.renderer_metadata(artifact)['shared_libraries']:
|
||||
meta = renderer_metadata('kryon:renderer-desktop', 'linux-x86_64-gnu')
|
||||
links = [*meta['archives'], *meta['link_flags']]
|
||||
# Keep the lazy codecs in DT_NEEDED for AppImage packaging. Ziran splits
|
||||
# LDLIBS without expanding a literal $ORIGIN; the AppRun supplies its path.
|
||||
for library in meta['shared_libraries']:
|
||||
links += ['-Wl,--no-as-needed', library, '-Wl,--as-needed', '-Wl,-rpath,' + str(Path(library).parent)]
|
||||
return links
|
||||
|
||||
@@ -61,9 +55,8 @@ def artifact(selection, platform, env=None):
|
||||
|
||||
|
||||
# The system libraries Entity's native-profile recipe adds for its Profile UI
|
||||
# (tools/artifacts.zi SystemLinkText). That recipe lists 65 inputs, past the
|
||||
# 64 the locked Ziran (before 3e69203b) accepts, so only its native-crypto
|
||||
# prerequisite is requested; switch to native-profile with a newer toolchain.
|
||||
# Choano compiles the account modules into each native host, so it only
|
||||
# requests Entity's platform and cryptography support.
|
||||
PROFILE_SYSTEM = {
|
||||
'linux-x86_64-gnu': (['sdl2', 'cairo', 'freetype2', 'fontconfig', 'pangocairo', 'gtk+-3.0'], ['-lX11']),
|
||||
'windows-x86_64-mingw': ([], ['-flto=1', '-luser32', '-lshell32', '-lole32', '-lcomdlg32']),
|
||||
@@ -116,10 +109,8 @@ def native():
|
||||
# Preserve dependency-owned archive order before its platform libraries.
|
||||
links = renderer_links()
|
||||
links.extend(account_links('linux-x86_64-gnu'))
|
||||
for query in (['sdl2', 'cairo', 'freetype2', 'pangocairo', 'fontconfig', 'gio-2.0'], ['libcurl']):
|
||||
found = subprocess.run(['pkg-config', '--libs', *query], text=True, capture_output=True)
|
||||
links.extend(shlex.split(found.stdout) if found.returncode == 0 else ['-l:libcurl.so.4'])
|
||||
links.extend(avif_links())
|
||||
curl = subprocess.run(['pkg-config', '--libs', 'libcurl'], text=True, capture_output=True)
|
||||
links.extend(shlex.split(curl.stdout) if curl.returncode == 0 else ['-l:libcurl.so.4'])
|
||||
links.extend(['-pthread', *shlex.split(os.environ.get('LDLIBS', ''))])
|
||||
env = {**os.environ, 'LDLIBS': shlex.join(links),
|
||||
'CFLAGS': os.environ.get('CFLAGS', '-O2') + ' -ffunction-sections -fdata-sections -Wno-main -pthread',
|
||||
@@ -171,10 +162,11 @@ def web():
|
||||
profile()
|
||||
output = ROOT / 'build/web'
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
# Run the bundled profile through the web runtime. Ziran 0.7.0 does not
|
||||
# provide the embedded C exporter that Entity's optional --linked uses.
|
||||
run(sys.executable, package('entity') / 'scripts/build-web.py',
|
||||
'--profile', ROOT / 'build/entity.zx', '--output', output / 'game.html',
|
||||
'--source', 'src/web/runtime.zi', '--entry', 'runtime:main',
|
||||
'--linked', ROOT / 'build/entity.zx')
|
||||
'--source', 'src/web/runtime.zi', '--entry', 'runtime:main')
|
||||
# The browser decodes the same AVIF art; Web Audio plays the same WAV files.
|
||||
if (output / 'assets').exists():
|
||||
shutil.rmtree(output / 'assets')
|
||||
|
||||
+51
-101
@@ -3,7 +3,7 @@
|
||||
|
||||
`appimage` packs the native SDL/Cairo/Pango game, its bundled libraries and
|
||||
every asset into build/Choano.AppImage. `windows` cross-compiles the same
|
||||
Frame on Kryon's raylib host with MinGW and packs it, its font and every
|
||||
Frame on Kryon's SDL2/Cairo host with MinGW and packs it, its font and every
|
||||
asset into the per-user NSIS installer build/Choano-setup.exe. The release
|
||||
workflow copies each to its public versioned name.
|
||||
"""
|
||||
@@ -86,12 +86,9 @@ WINDOWS_PACKAGING = ROOT / 'packaging/windows'
|
||||
# The Linux toolchain's MinGW-w64 cross compiler, and NSIS.
|
||||
MINGW = os.environ.get('MINGW_PREFIX', 'x86_64-w64-mingw32-')
|
||||
WINDOWS_DEFINES = ['--define', '_WIN32', '--define', 'PLATFORM_DESKTOP', '--define', '__x86_64__',
|
||||
'--define', 'CHOANO_RAYLIB', '--define', 'CHOANO_ACCOUNTS']
|
||||
# libssp: the audio package's MinGW libopus keeps its stack protector.
|
||||
WINDOWS_LIBRARIES = ['-lssp', '-lopengl32', '-lgdi32', '-lwinmm', '-luser32', '-lshell32', '-lole32', '-luuid', '-lm']
|
||||
# raylib as Shovey and Breeze ship it on Windows: RGFW and OpenGL 1.1. Kryon's
|
||||
# static libavif decoder supplies AVIF image support.
|
||||
RAYLIB_FLAGS = '-O2 -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_TTF=1'
|
||||
'--define', 'CHOANO_ACCOUNTS']
|
||||
WINDOWS_LIBRARIES = ['-lgdi32', '-lwinmm', '-luser32', '-lshell32', '-lole32', '-lcomdlg32',
|
||||
'-luuid', '-ladvapi32', '-lm']
|
||||
|
||||
|
||||
def run(*args, **kwargs):
|
||||
@@ -299,11 +296,14 @@ def record(output, source):
|
||||
def windows_runtime(compiler):
|
||||
"""The Ziran runtime of the locked toolchain, cross-compiled out of tree."""
|
||||
runtime = WINDOWS / 'runtime/libziran.a'
|
||||
if not built(runtime, str(compiler)):
|
||||
cc = windows_tool(MINGW + 'gcc')
|
||||
zlib = package('zlib')
|
||||
identity = f'{compiler}\n{cc}\n{zlib}'
|
||||
if not built(runtime, identity):
|
||||
run('make', '-B', '-C', compiler, 'BOOTSTRAP=1', 'BUILD_DIR=' + str(runtime.parent),
|
||||
'CC=' + windows_tool(MINGW + 'gcc'), 'AR=' + windows_tool(MINGW + 'ar'),
|
||||
'OBJCOPY=' + windows_tool(MINGW + 'objcopy'), 'CFLAGS=-O2', runtime)
|
||||
record(runtime, str(compiler))
|
||||
'CC=' + cc, 'AR=' + windows_tool(MINGW + 'ar'),
|
||||
'OBJCOPY=' + windows_tool(MINGW + 'objcopy'), f'CFLAGS=-O2 -I{zlib}', runtime)
|
||||
record(runtime, identity)
|
||||
return runtime
|
||||
|
||||
|
||||
@@ -322,76 +322,22 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
return toolchain
|
||||
|
||||
|
||||
def windows_cmake_library(name, source, library, identity, *configure):
|
||||
"""LIBRARY from SOURCE's CMake target NAME, configured out of tree in
|
||||
LIBRARY's build folder unless IDENTITY already built it."""
|
||||
folder = WINDOWS / name
|
||||
if built(library, identity):
|
||||
return library
|
||||
if folder.exists():
|
||||
shutil.rmtree(folder)
|
||||
folder.mkdir(parents=True)
|
||||
# A Nix MinGW links its thread library only from these folders, also in
|
||||
# CMake's own compiler checks.
|
||||
run('cmake', '-S', source, '-B', folder, '-DCMAKE_TOOLCHAIN_FILE=' + str(windows_toolchain(folder)),
|
||||
'-DCMAKE_BUILD_TYPE=Release', '-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(mingw_library_flags()), *configure)
|
||||
run('cmake', '--build', folder, '--target', name, '--parallel', '1')
|
||||
record(library, identity)
|
||||
return library
|
||||
|
||||
|
||||
def windows_raylib():
|
||||
"""Static raylib from the locked package, configured out of tree."""
|
||||
source = package('raylib')
|
||||
library = WINDOWS / 'raylib/raylib/libraylib.a'
|
||||
linking = ' '.join(mingw_library_flags())
|
||||
identity = f'{source}\n{windows_tool(MINGW + "gcc")}\n{windows_tool(MINGW + "g++")}\n{RAYLIB_FLAGS}\n{linking}'
|
||||
windows_cmake_library(
|
||||
'raylib', source, library, identity, '-DBUILD_EXAMPLES=OFF', '-DPLATFORM=RGFW',
|
||||
'-DOPENGL_VERSION=1.1', '-DOPENGL_opengl_LIBRARY=opengl32', '-DOPENGL_gl_LIBRARY=opengl32',
|
||||
'-DCMAKE_C_FLAGS=' + RAYLIB_FLAGS)
|
||||
return source, library
|
||||
|
||||
|
||||
def windows_webp():
|
||||
"""Kryon's static WebP decoder (kryonwebp), which its raylib host links
|
||||
for WebP images, from Kryon's own CMake project and the locked libwebp."""
|
||||
project = package('kryon') / 'cmake/webp'
|
||||
source = package('libwebp')
|
||||
library = WINDOWS / 'kryonwebp/libkryonwebp.a'
|
||||
identity = f'{project}\n{source}\n{windows_tool(MINGW + "gcc")}\n{" ".join(mingw_library_flags())}'
|
||||
return windows_cmake_library('kryonwebp', project, library, identity,
|
||||
f'-DWEBP_DIR={source}', '-DCMAKE_C_FLAGS=-O2')
|
||||
|
||||
|
||||
def windows_avif():
|
||||
"""Kryon's static AVIF decoder, which its raylib host links for AVIF art:
|
||||
libavif with dav1d inside, and libaom, from Kryon's own CMake project and
|
||||
the avif package's locked sources."""
|
||||
project = package('kryon') / 'cmake/avif'
|
||||
sources = {name: package(name) for name in ('avif', 'libavif', 'libaom', 'dav1d')}
|
||||
folder = WINDOWS / 'avif_static'
|
||||
archives = [folder / 'avif/libavif.a', folder / 'aom/libaom.a']
|
||||
identity = '\n'.join([str(project), *map(str, sources.values()), windows_tool(MINGW + 'gcc'),
|
||||
' '.join(mingw_library_flags())])
|
||||
windows_cmake_library('avif_static', project, archives[0], identity,
|
||||
f'-DKRYON_AVIF_PACKAGE_DIR={sources["avif"]}', f'-DAVIF_DIR={sources["libavif"]}',
|
||||
f'-DAOM_DIR={sources["libaom"]}', f'-DDAV1D_DIR={sources["dav1d"]}')
|
||||
missing = [path for path in archives if not path.is_file()]
|
||||
if missing:
|
||||
raise SystemExit('desktop release: the AVIF build made no ' + ', '.join(map(str, missing)))
|
||||
return archives
|
||||
|
||||
|
||||
def windows_opus():
|
||||
"""libopus for the Ogg Opus decoder in Kryon's raylib audio, from the
|
||||
audio package's own CMake recipe and its locked sources."""
|
||||
sources = {name: package(name) for name in ('audio', 'libopus', 'libsamplerate')}
|
||||
library = WINDOWS / 'opus/libopus/libopus.a'
|
||||
identity = '\n'.join([*map(str, sources.values()), windows_tool(MINGW + 'gcc'), ' '.join(mingw_library_flags())])
|
||||
return windows_cmake_library('opus', sources['audio'] / 'native', library, identity,
|
||||
f'-DOPUS_DIR={sources["libopus"]}', f'-DSAMPLERATE_DIR={sources["libsamplerate"]}')
|
||||
"""Build the AVIF DLL the Cairo host opens on demand."""
|
||||
sources = {option: package(name) for option, name in (
|
||||
('KRYON_DIR', 'kryon'), ('KRYON_AVIF_PACKAGE_DIR', 'avif'),
|
||||
('AVIF_DIR', 'libavif'), ('AOM_DIR', 'libaom'), ('DAV1D_DIR', 'dav1d'))}
|
||||
folder = WINDOWS / 'avif'
|
||||
library = folder / 'kryonavif.dll'
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
linking = mingw_library_flags()
|
||||
run('cmake', '-S', WINDOWS_PACKAGING, '-B', folder,
|
||||
'-DCMAKE_TOOLCHAIN_FILE=' + str(windows_toolchain(folder)), '-DCMAKE_BUILD_TYPE=Release',
|
||||
'-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join([*linking, '-static', '-static-libgcc']),
|
||||
'-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(linking),
|
||||
*(f'-D{option}={path}' for option, path in sources.items()))
|
||||
run('cmake', '--build', folder, '--target', 'kryonavif', '--parallel', '1')
|
||||
return library
|
||||
|
||||
|
||||
def windows_icon(target):
|
||||
@@ -430,23 +376,22 @@ def windows_account_links():
|
||||
return choano_build.account_links('windows-x86_64-mingw', env)
|
||||
|
||||
|
||||
def build_windows_program():
|
||||
"""build/windows/Choano.exe: src/windows.zi on raylib, linked statically."""
|
||||
# Resolve the provider before replacing any existing Windows build output.
|
||||
def windows_renderer():
|
||||
import build as choano_build
|
||||
env = dict(os.environ, CC=windows_tool(MINGW + 'gcc'), AR=windows_tool(MINGW + 'ar'))
|
||||
return choano_build.renderer_metadata('kryon:renderer-desktop-windows', 'windows-x86_64-mingw', env)
|
||||
|
||||
|
||||
def build_windows_program(renderer):
|
||||
"""Cross-compile the same desktop entry used for the Linux build."""
|
||||
accounts = windows_account_links()
|
||||
for folder in (WINDOWS / 'ir', WINDOWS / 'c'):
|
||||
if folder.exists():
|
||||
shutil.rmtree(folder)
|
||||
run(ZIRAN, 'ir', '--project', *LOCKED, *WINDOWS_DEFINES, '-o', WINDOWS / 'ir', 'src/windows.zi', cwd=ROOT)
|
||||
generated = WINDOWS / 'c'
|
||||
run(ZIRAN, 'build', '--project', *LOCKED, '--target=c', *WINDOWS_DEFINES, '--entry', 'windows:main',
|
||||
'--root', WINDOWS / 'ir', '-o', generated, WINDOWS / 'ir/windows.zir', cwd=ROOT)
|
||||
if generated.exists():
|
||||
shutil.rmtree(generated)
|
||||
run(ZIRAN, 'build', '--project', *LOCKED, '--target=c', '--target-os', 'windows', '--target-cpu', 'x64',
|
||||
*WINDOWS_DEFINES, '--entry', 'desktop:main', '-o', generated, 'src/desktop.zi', cwd=ROOT)
|
||||
compiler = package('ziran')
|
||||
runtime = windows_runtime(compiler)
|
||||
raylib_source, raylib = windows_raylib()
|
||||
webp = windows_webp()
|
||||
avif = windows_avif()
|
||||
opus = windows_opus()
|
||||
# The program's icon in Explorer, the taskbar and the installer.
|
||||
windows_icon(WINDOWS / 'choano.ico')
|
||||
(WINDOWS / 'choano.rc').write_text('1 ICON "choano.ico"\n')
|
||||
@@ -460,8 +405,8 @@ def build_windows_program():
|
||||
program = WINDOWS / 'Choano.exe'
|
||||
partial = WINDOWS / 'Choano.new.exe'
|
||||
run(windows_tool(MINGW + 'gcc'), '-std=c11', '-O2', '-ffunction-sections', '-fdata-sections', *includes,
|
||||
*sorted(generated.rglob('*.c')), runtime, raylib, webp, *avif, opus, WINDOWS / 'choano-resource.o', '-Wl,--gc-sections',
|
||||
*mingw_library_flags(), '-static', '-static-libgcc', '-mwindows', *accounts, *WINDOWS_LIBRARIES,
|
||||
*sorted(generated.rglob('*.c')), runtime, WINDOWS / 'choano-resource.o', *renderer['archives'], '-Wl,--gc-sections',
|
||||
*mingw_library_flags(), '-static', '-static-libgcc', '-mwindows', *accounts, *renderer['link_flags'], *WINDOWS_LIBRARIES,
|
||||
'-o', partial)
|
||||
run(windows_tool(MINGW + 'strip'), partial)
|
||||
check_windows_program(partial)
|
||||
@@ -469,13 +414,17 @@ def build_windows_program():
|
||||
return program
|
||||
|
||||
|
||||
def stage_windows(stage, program):
|
||||
"""The installed folder: the program, Kryon's font and every asset."""
|
||||
def stage_windows(stage, program, renderer, avif):
|
||||
"""Preserve the renderer SDK layout, with the DLLs beside the program."""
|
||||
if stage.exists():
|
||||
shutil.rmtree(stage)
|
||||
stage.mkdir(parents=True)
|
||||
shutil.copy2(program, stage / 'Choano.exe')
|
||||
shutil.copyfile(package('kryon') / 'assets/fonts/LiberationSans-Regular.ttf', stage / 'kryon-font.ttf')
|
||||
run('tar', '-xf', renderer['runtime_archive'], '-C', stage)
|
||||
binary_dir = stage / 'bin'
|
||||
shutil.copy2(program, binary_dir / 'Choano.exe')
|
||||
shutil.copy2(avif, binary_dir / 'kryonavif.dll')
|
||||
shutil.copyfile(renderer['resources']['font'], binary_dir / 'kryon-font.ttf')
|
||||
shutil.copyfile(renderer['resources']['font_license'], binary_dir / 'LICENSE-Liberation')
|
||||
shutil.copytree(ROOT / 'assets', stage / 'assets')
|
||||
return stage
|
||||
|
||||
@@ -486,8 +435,9 @@ def build_windows():
|
||||
WINDOWS.mkdir(parents=True, exist_ok=True)
|
||||
# The Profile bundle the account provider reads from assets/entity.zx.
|
||||
run(sys.executable, ROOT / 'scripts/build.py', 'profile-asset', cwd=ROOT)
|
||||
program = build_windows_program()
|
||||
stage = stage_windows(WINDOWS / 'Choano', program)
|
||||
renderer = windows_renderer()
|
||||
program = build_windows_program(renderer)
|
||||
stage = stage_windows(WINDOWS / 'Choano', program, renderer, windows_avif())
|
||||
partial = WINDOWS / 'Choano-setup.new.exe'
|
||||
partial.unlink(missing_ok=True)
|
||||
run(windows_tool('makensis'), '-V2', '-NOCD', f'-DVERSION={version}', f'-DSTAGE={stage}',
|
||||
|
||||
+29
-26
@@ -1,14 +1,12 @@
|
||||
// Standalone owner; hosted Apps instances supply their own owner and reader.
|
||||
#import "kryon/media_audio_host"
|
||||
#import "kryon/media_audio_desktop"
|
||||
#import "kryon/session"
|
||||
#import "std/file"
|
||||
#if #defined(ANDROID_BUILD) {
|
||||
#import "std/byte_text_linux"
|
||||
#import "std/c_string"
|
||||
asset_raylib :: #system_library "raylib";
|
||||
ReadAsset :: (name: *u8, size: *s32) -> *u8 #foreign asset_raylib "LoadFileData";
|
||||
FreeAsset :: (bytes: *u8) #foreign asset_raylib "UnloadFileData";
|
||||
#import "kryon/app_asset"
|
||||
#if #defined(PLATFORM_WEB) {
|
||||
#import "kryon/media_audio_web"
|
||||
} else {
|
||||
#import "kryon/media_audio_desktop"
|
||||
Sink :: #import "std/audio_sink";
|
||||
}
|
||||
Paths :: #import "sound_paths";
|
||||
#import "std/format"
|
||||
@@ -22,28 +20,33 @@ AudioAsset :: (path: string) -> bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
asset_bytes: string;
|
||||
AudioRead :: (context: *void, path: string) -> string {
|
||||
unused context
|
||||
#if #defined(ANDROID_BUILD) {
|
||||
name: [256]u8
|
||||
if !CopyCString(path, name[:]) { return "" }
|
||||
count: s32
|
||||
data := ReadAsset(*name[0], *count)
|
||||
if data == null { return "" }
|
||||
defer { FreeAsset(data) }
|
||||
// The provider consumes bytes synchronously; return owned text.
|
||||
copy: Vec(u8)
|
||||
BuilderPrint(*copy, "%", TextFromBytes(BytesFromPointer(data, cast(u64)count)))
|
||||
return BuilderFinish(copy)
|
||||
} else {
|
||||
bytes, found := ReadEntireFile(path)
|
||||
return ifx found then bytes else ""
|
||||
}
|
||||
FreeAppAsset(asset_bytes)
|
||||
asset_bytes = ReadAppAsset(path)
|
||||
return asset_bytes
|
||||
}
|
||||
AudioBegin :: (session: Session) { MediaAudioBegin(*owner, session, AudioAsset, AudioRead, null) }
|
||||
AudioEnd :: () { MediaAudioEnd() }
|
||||
AudioEnd :: () {
|
||||
MediaAudioEnd()
|
||||
FreeAppAsset(asset_bytes)
|
||||
asset_bytes = ""
|
||||
}
|
||||
audio_opened: bool;
|
||||
AudioOpen :: () {
|
||||
if !audio_opened { MediaAudioUseDesktop(); audio_opened = true }
|
||||
if audio_opened { return }
|
||||
#if #defined(PLATFORM_WEB) {
|
||||
MediaAudioUseWeb()
|
||||
} else {
|
||||
MediaAudioUseDesktop()
|
||||
}
|
||||
audio_opened = true
|
||||
}
|
||||
AudioClose :: () {
|
||||
MediaAudioOwnerClose(*owner)
|
||||
#if !#defined(PLATFORM_WEB) {
|
||||
Sink.AudioSinkClose()
|
||||
}
|
||||
audio_opened = false
|
||||
}
|
||||
AudioClose :: () { MediaAudioOwnerClose(*owner) }
|
||||
+98
-16
@@ -1,18 +1,100 @@
|
||||
Audio :: #import "audio_host";
|
||||
Account :: #import "account";
|
||||
#import "android_run"
|
||||
Timer :: #import "std/timer_linux";
|
||||
#if #defined(ANDROID_BUILD) {
|
||||
Audio :: #import "audio_host";
|
||||
Account :: #import "account";
|
||||
Clock :: #import "std/timer_linux";
|
||||
#import "app"
|
||||
Clipboard :: #import "kryon/android_clipboard";
|
||||
#import "kryon/android_device"
|
||||
#import "kryon/android_runtime"
|
||||
#import "kryon/android_surface"
|
||||
#import "kryon/android_touch"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/input_protocol"
|
||||
#import "kryon/pixmap_assets_android"
|
||||
#import "kryon/pixmap_frame"
|
||||
#import "kryon/scroll_device"
|
||||
#import "kryon/Frame"
|
||||
#import "kryon/session"
|
||||
#import "kryon/test_driver"
|
||||
#import "kryon/tree"
|
||||
#import "kryon/tree_input"
|
||||
|
||||
// Choano: the Android entry. raylib's NativeActivity backend calls this C
|
||||
// main; the canonical host loop in android_run drives the app's Frame.
|
||||
#program_export
|
||||
main :: (argc: s32, argv: **u8) -> s32 {
|
||||
unused argc
|
||||
unused argv
|
||||
defer { Audio.AudioClose() }
|
||||
defer { Account.Close() }
|
||||
return AndroidRunMain()
|
||||
DrawAndroidGame :: (session: Session, viewport: Rectangle) -> bool {
|
||||
if !AndroidTouchFrameInputBegin(session, AndroidLayoutZoom()) { return false }
|
||||
defer { FrameInputEnd(session) }
|
||||
pointer := TestDriverPointer(session, PollPointer())
|
||||
TreePointerUpdate(session, pointer)
|
||||
TreeSecondaryPointerUpdate(session, PollSecondaryPointer())
|
||||
BeginScrollFrame(session, Vector2.{pointer.x, pointer.y}, pointer.pressed, pointer.down,
|
||||
pointer.released, 0.0, cast(float64)Clock.MonotonicMilliseconds() / 1000.0)
|
||||
key := AndroidTouchTakeKey()
|
||||
if key == 0 {
|
||||
for candidate: cast(s32)0..349 {
|
||||
if TestDriverKeyPressed(candidate) { key = candidate; break }
|
||||
}
|
||||
}
|
||||
if AndroidTextInputKeyPressed(259) { key = 259 }
|
||||
if AndroidTextInputKeyPressed(257) { key = 257 }
|
||||
if key != 0 { KeyboardSend(session, key) }
|
||||
codepoint := AndroidTextInputCharacter()
|
||||
while codepoint != 0 {
|
||||
TypedCodepointSend(session, codepoint)
|
||||
codepoint = AndroidTextInputCharacter()
|
||||
}
|
||||
if BeginFrame(session, cast(u64)1, viewport) != FrameStatus.FrameOk { return false }
|
||||
if Frame(session, viewport) != 0 {
|
||||
TreeCancel(session)
|
||||
return false
|
||||
}
|
||||
frame := EndPixmapFrame(session, AndroidFrameReusable(), cast(u32)0xff000000)
|
||||
AndroidFrameUnchanged(frame.paint_unchanged)
|
||||
return frame.status == FrameStatus.FrameOk
|
||||
}
|
||||
|
||||
#program_export
|
||||
main :: (argc: s32, argv: **u8) -> s32 {
|
||||
unused argv
|
||||
// The C frame graph reaches these exports through Kryon's host ABI.
|
||||
// Keep them in the Android IR during the generator's entry walk.
|
||||
if argc < 0 {
|
||||
unused Clipboard.SystemClipboardOpenHost()
|
||||
unused Clipboard.SystemClipboardByteHost(-1)
|
||||
unused Clipboard.SystemClipboardWriteHost("")
|
||||
return 1
|
||||
}
|
||||
session := SessionOpen()
|
||||
if !SessionValid(session) { return 1 }
|
||||
defer { unused CloseSession(session) }
|
||||
defer { Account.Close() }
|
||||
defer { Audio.AudioClose() }
|
||||
AndroidTextInputOpen(session)
|
||||
defer { AndroidTextInputClose(session) }
|
||||
first_frame := true
|
||||
timeout: s32 = 16
|
||||
while PollAndroidHost(timeout) {
|
||||
viewport := AndroidHostViewport()
|
||||
if AndroidHostPaused() || viewport.width <= 0.0 || viewport.height <= 0.0 {
|
||||
AndroidTextInputFrame(session, false)
|
||||
timeout = 1000
|
||||
continue
|
||||
}
|
||||
timeout = 16
|
||||
AndroidTextInputBeginFrame(session)
|
||||
BeginAndroidFrame()
|
||||
ok := DrawAndroidGame(session, viewport)
|
||||
presented := EndAndroidFrame()
|
||||
if !ok || !presented { return 1 }
|
||||
AndroidTextInputFrame(session, TreeTextInputActive(session))
|
||||
TestDriverFrame(session)
|
||||
if first_frame {
|
||||
AndroidNotifyFirstFrame()
|
||||
first_frame = false
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
#program_export
|
||||
ClockMillisecondsHost :: () -> s64 { return Clock.MonotonicMilliseconds() }
|
||||
}
|
||||
|
||||
#program_export
|
||||
ClockMillisecondsHost :: () -> s64 { return Timer.MonotonicMilliseconds() }
|
||||
+1
-1
@@ -9,7 +9,7 @@ playing: s32;
|
||||
#if #defined(PLATFORM_WEB) {
|
||||
EFFECT_GAIN :: .6;
|
||||
MUSIC_GAIN :: .45;
|
||||
} else #if #defined(ANDROID_BUILD) || #defined(CHOANO_RAYLIB) {
|
||||
} else #if #defined(ANDROID_BUILD) || #defined(_WIN32) {
|
||||
EFFECT_GAIN :: 1.0;
|
||||
MUSIC_GAIN :: .7;
|
||||
} else {
|
||||
|
||||
+9
-14
@@ -9,12 +9,7 @@ using Canvas :: #import "kryon/Canvas";
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/page_core"
|
||||
#import "kryon/key_input"
|
||||
#import "kryon/text_input_props"
|
||||
#import "kryon/text_props"
|
||||
#import "kryon/text_widget"
|
||||
#import "kryon/widget_palette"
|
||||
#import "kryon/button_props"
|
||||
#import "kryon/button_widget"
|
||||
#import "kryon/open_uri"
|
||||
#import "std/web"
|
||||
#import "std/file"
|
||||
@@ -61,22 +56,22 @@ main :: () -> s32 {
|
||||
Entity.EntityHostPump()
|
||||
viewport := CanvasViewport()
|
||||
pointer := CaptureFrameInput(session).pointer
|
||||
key := CanvasPressedKey()
|
||||
TreePointerUpdate(session, pointer)
|
||||
KeyboardModifiersSend(session, CanvasModifiers())
|
||||
if key != 0 { unused KeyboardSend(session, key) }
|
||||
point := CanvasTypedCodepoint()
|
||||
while point != 0 { unused TypedCodepointSend(session, point); point = CanvasTypedCodepoint() }
|
||||
key, modifiers := CanvasInputTake(session)
|
||||
BeginCanvasFrame()
|
||||
TreePointerUpdate(session, pointer)
|
||||
PointerWheelSend(session, pointer.x, pointer.y, CanvasWheelMove())
|
||||
CanvasSampleScroll(session, pointer, CanvasWheelMove())
|
||||
KeyboardModifiersSend(session, modifiers)
|
||||
if key != 0 { unused KeyboardSend(session, key) }
|
||||
if BeginFrame(session, cast(u64)1, viewport) != FrameStatus.FrameOk { return 1 }
|
||||
if visible {
|
||||
App.UsePalette(session)
|
||||
unused KeyboardTake(session)
|
||||
App.PauseClock()
|
||||
typed: [1024]u8
|
||||
input := TextFieldInputFor(key, CanvasModifiers(), TypedTextTake(session, typed[:]))
|
||||
input := TextFieldInputFor(key, modifiers, TypedTextTake(session, typed[:]))
|
||||
bounds := Rectangle.{0.0, 52.0, viewport.width, viewport.height - 52.0}
|
||||
if !Entity.EntityHostFrame(session, bounds, key, CanvasModifiers(), input, true) {
|
||||
if !Entity.EntityHostFrame(session, bounds, key, modifiers, input, true) {
|
||||
unused WidgetPaletteRestore(session)
|
||||
return 1
|
||||
}
|
||||
@@ -114,7 +109,7 @@ main :: () -> s32 {
|
||||
WebSet(WebModule, WebName("choanoDishFrame"), WebBool(Game.game.dish_frame_enabled))
|
||||
}
|
||||
WebSet(WebModule, WebName("profileVisible"), WebBool(visible))
|
||||
if EndFrame(session) != FrameStatus.FrameOk { return 1 }
|
||||
if EndCanvasUiFrame(session) != FrameStatus.FrameOk { return 1 }
|
||||
CanvasCursor(session)
|
||||
unused EndCanvasFrame()
|
||||
if PageNow() - saved > 1000.0 { unused BundleStorageSync(false); saved = PageNow() }
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
Audio :: #import "audio_host";
|
||||
// Windows: Choano on Kryon's raylib host. It draws the same Frame the Linux
|
||||
// desktop edition draws (src/desktop.zi), from the assets installed beside
|
||||
// the program, with raylib's keyboard, pointer and audio.
|
||||
#import "kryon/raylib_runtime"
|
||||
#import "kryon/session"
|
||||
#import "kryon/tree"
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/input_protocol"
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/test_driver"
|
||||
#import "kryon/Frame"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "std/c_string"
|
||||
#import "std/byte_text_linux"
|
||||
Timer :: #import "std/timer_linux";
|
||||
#import "app"
|
||||
|
||||
#program_export
|
||||
ClockMillisecondsHost :: () -> s64 { return Timer.MonotonicMilliseconds() }
|
||||
|
||||
windows_raylib :: #system_library "raylib";
|
||||
ApplicationDirectory :: () -> *u8 #foreign windows_raylib "GetApplicationDirectory";
|
||||
windows_c :: #system_library "c";
|
||||
ChangeDirectory :: (path: *u8) -> s32 #foreign windows_c "_chdir";
|
||||
|
||||
DrawGameFrame :: (session: Session) -> bool {
|
||||
Audio.AudioBegin(session)
|
||||
defer { Audio.AudioEnd() }
|
||||
if !RaylibFrameInputBegin(session) { return false }
|
||||
defer { FrameInputEnd(session) }
|
||||
BeginRaylibFrame()
|
||||
KeyboardModifiersSend(session, RaylibModifiers())
|
||||
key := RaylibPressedKey()
|
||||
if key == 0 { key = RaylibRepeatedKey() }
|
||||
for candidate: cast(s32)0..349 {
|
||||
if TestDriverKeyPressed(candidate) { key = candidate; break }
|
||||
}
|
||||
if key != 0 { KeyboardSend(session, key) }
|
||||
codepoint := TestDriverCodepoint()
|
||||
if codepoint == 0 { codepoint = RaylibTypedCodepoint() }
|
||||
while codepoint != 0 {
|
||||
unused TypedCodepointSend(session, codepoint)
|
||||
codepoint = RaylibTypedCodepoint()
|
||||
}
|
||||
viewport := RaylibViewport()
|
||||
snapshot := CaptureFrameInput(session)
|
||||
pointer := snapshot.pointer
|
||||
TreePointerUpdate(session, pointer)
|
||||
PointerWheelSend(session, pointer.x, pointer.y, snapshot.wheel)
|
||||
if BeginFrame(session, cast(u64)1, viewport) != FrameStatus.FrameOk {
|
||||
unused EndRaylibFrame()
|
||||
return false
|
||||
}
|
||||
if Frame(session, viewport) != 0 {
|
||||
TreeCancel(session)
|
||||
unused EndRaylibFrame()
|
||||
return false
|
||||
}
|
||||
if EndFrame(session) != FrameStatus.FrameOk {
|
||||
unused EndRaylibFrame()
|
||||
return false
|
||||
}
|
||||
ok := EndRaylibFrame()
|
||||
TestDriverFrame(session)
|
||||
return ok
|
||||
}
|
||||
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
// Assets, chimes and the font are installed beside the program; a
|
||||
// shortcut may start it anywhere.
|
||||
folder: [4096]u8
|
||||
if !CopyCString(TextFromCString(ApplicationDirectory()), folder[:]) ||
|
||||
ChangeDirectory(*folder[0]) != 0 { return 1 }
|
||||
if !OpenRaylib(900, 680, "Choano") {
|
||||
CloseRaylib()
|
||||
return 1
|
||||
}
|
||||
RaylibExitKey(0)
|
||||
unused LoadTypefaceFile("default", "kryon-font.ttf", null, 0) && SelectTypeface("default")
|
||||
session := SessionOpen()
|
||||
if !SessionValid(session) {
|
||||
CloseRaylib()
|
||||
return 1
|
||||
}
|
||||
Audio.AudioOpen()
|
||||
defer { Audio.AudioClose() }
|
||||
ok := true
|
||||
while ok && PollRaylib() {
|
||||
ok = DrawGameFrame(session)
|
||||
}
|
||||
CloseAccount()
|
||||
unused CloseSession(session)
|
||||
CloseRaylib()
|
||||
return ifx ok then 0 else 1
|
||||
}
|
||||
@@ -56,13 +56,12 @@ class AccountBuildTest(unittest.TestCase):
|
||||
program = self.root / 'Choano-native'
|
||||
program.write_bytes(b'old program')
|
||||
with patch.object(build, 'run') as run, patch.object(build, 'profile_asset') as profile, \
|
||||
patch.object(build, 'renderer_links', return_value=['renderer.a']), \
|
||||
patch.object(build, 'avif_links', return_value=['libkryonavif.so']) as avif, \
|
||||
patch.object(build, 'renderer_links', return_value=['renderer.a', 'libkryonavif.so']) as renderer, \
|
||||
patch.object(build, 'account_links', return_value=['libmonocypher.a', '-lgtk']) as accounts, \
|
||||
patch.object(build, 'NATIVE_WORK', work), patch.object(build, 'NATIVE', program):
|
||||
build.native()
|
||||
profile.assert_called_once()
|
||||
avif.assert_called_once_with()
|
||||
renderer.assert_called_once_with()
|
||||
accounts.assert_called_once_with('linux-x86_64-gnu')
|
||||
command = list(map(str, run.call_args.args))
|
||||
for define in ('CHOANO_ACCOUNTS', 'POSIX_THREADS'):
|
||||
@@ -72,7 +71,7 @@ class AccountBuildTest(unittest.TestCase):
|
||||
self.assertEqual(command[-1], 'src/desktop.zi')
|
||||
links = shlex.split(run.call_args.kwargs['env']['LDLIBS'])
|
||||
self.assertIn('libkryonavif.so', links)
|
||||
self.assertEqual(links[:3], ['renderer.a', 'libmonocypher.a', '-lgtk'])
|
||||
self.assertEqual(links[:4], ['renderer.a', 'libkryonavif.so', 'libmonocypher.a', '-lgtk'])
|
||||
self.assertEqual(program.read_bytes(), b'new program')
|
||||
self.assertTrue(os.access(program, os.X_OK))
|
||||
self.assertEqual((self.root / 'Choano-native.title').read_text(), 'Choano\n')
|
||||
@@ -138,7 +137,9 @@ class AccountBuildTest(unittest.TestCase):
|
||||
cpp = self.root / 'droid/app/src/main/cpp'
|
||||
cpp.mkdir(parents=True)
|
||||
cmake = cpp / 'CMakeLists.txt'
|
||||
cmake.write_text('set(APP_ZIRAN_DEFINES --define ANDROID_BUILD)\nadd_library(main SHARED x.c)\n')
|
||||
cmake.write_text('set(APP_ZIRAN_DEFINES --define ANDROID_BUILD)\n'
|
||||
'execute_process(COMMAND generator --manifest "${APP_ZIRAN_MANIFEST}")\n'
|
||||
'add_library(main SHARED x.c)\n')
|
||||
ndk = self.root / 'ndk'
|
||||
ndk.mkdir()
|
||||
requests = []
|
||||
@@ -157,6 +158,8 @@ class AccountBuildTest(unittest.TestCase):
|
||||
text = cmake.read_text()
|
||||
self.assertEqual(text.count('CHOANO_ACCOUNTS'), 1)
|
||||
self.assertEqual(text.count(android.ACCOUNT_MARKER), 1)
|
||||
self.assertEqual(text.count('android_runtime.zi'), 1)
|
||||
self.assertIn('target_link_libraries(main PRIVATE opus OpenSLES)', text)
|
||||
self.assertIn('"/cache/android-aarch64-bionic/libmonocypher.a"', text)
|
||||
self.assertIn('if(ANDROID_ABI STREQUAL "armeabi-v7a")', text)
|
||||
selection, platform, options = requests[0]
|
||||
|
||||
+8
-8
@@ -26,10 +26,10 @@ class RendererTest(unittest.TestCase):
|
||||
self.addCleanup(self.temp.cleanup)
|
||||
self.root = Path(self.temp.name)
|
||||
(self.root / 'include').mkdir()
|
||||
self.meta = dict(schema=1, artifact='renderer-raylib', platform='linux-x86_64-gnu',
|
||||
archives=['second.a', 'first.a'], link_flags=['-lm', '-pthread'], compile_flags=[], defines=[],
|
||||
self.meta = dict(schema=1, artifact='renderer-desktop', platform='linux-x86_64-gnu',
|
||||
archives=['second.a', 'first.a'], shared_libraries=['libkryonavif.so'], link_flags=['-lm', '-pthread'], compile_flags=[], defines=[],
|
||||
include_directories=['include'], resources=dict(font='font.ttf', font_license='font.txt'))
|
||||
for name in [*self.meta['archives'], 'font.ttf', 'font.txt']:
|
||||
for name in [*self.meta['archives'], *self.meta['shared_libraries'], 'font.ttf', 'font.txt']:
|
||||
(self.root / name).write_bytes(name.encode())
|
||||
self.descriptor = self.root / 'artifact.tsv'
|
||||
self.save()
|
||||
@@ -44,8 +44,8 @@ class RendererTest(unittest.TestCase):
|
||||
|
||||
def save(self):
|
||||
(self.root / 'renderer.json').write_text(json.dumps(self.meta))
|
||||
rows = dict(schema='1', package='kryon', artifact='renderer-raylib', platform='linux-x86_64-gnu', key='a' * 64)
|
||||
for name in ['renderer.json', *self.meta['archives'], 'font.ttf', 'font.txt']:
|
||||
rows = dict(schema='1', package='kryon', artifact='renderer-desktop', platform='linux-x86_64-gnu', key='a' * 64)
|
||||
for name in ['renderer.json', *self.meta['archives'], *self.meta['shared_libraries'], 'font.ttf', 'font.txt']:
|
||||
rows[name] = hashlib.sha256((self.root / name).read_bytes()).hexdigest()
|
||||
self.descriptor.write_text(''.join(f'{k}\t{v}\n' for k, v in rows.items()))
|
||||
|
||||
@@ -56,16 +56,16 @@ class RendererTest(unittest.TestCase):
|
||||
(self.root / 'native/desktop').write_bytes(b'program')
|
||||
with patch.object(build, 'run') as run, patch.object(build, 'profile_asset'), \
|
||||
patch.object(build, 'account_links', return_value=['-laccount']), \
|
||||
patch.object(build, 'avif_links', return_value=['-Wl,--no-as-needed', 'libkryonavif.so']), \
|
||||
patch.object(build, 'NATIVE_WORK', self.root / 'native'), \
|
||||
patch.object(build, 'NATIVE', self.root / 'Choano-native'), \
|
||||
patch.dict(os.environ, LDLIBS="'-Lwith spaces' -lcustom"):
|
||||
build.native()
|
||||
links = shlex.split(run.call_args.kwargs['env']['LDLIBS'])
|
||||
self.assertEqual(links[:5], [str(resolved / 'second.a'), str(resolved / 'first.a'), '-lm', '-pthread', '-laccount'])
|
||||
self.assertEqual(links[:4], [str(resolved / 'second.a'), str(resolved / 'first.a'), '-lm', '-pthread'])
|
||||
self.assertEqual(links[-2:], ['-Lwith spaces', '-lcustom'])
|
||||
# The AVIF codec stays a runtime dependency of the program.
|
||||
self.assertIn('libkryonavif.so', links)
|
||||
self.assertEqual(links[4:9], ['-Wl,--no-as-needed', str(resolved / 'libkryonavif.so'),
|
||||
'-Wl,--as-needed', '-Wl,-rpath,' + str(resolved), '-laccount'])
|
||||
|
||||
def test_corrupt_archive(self):
|
||||
(self.root / 'first.a').write_bytes(b'corrupt')
|
||||
|
||||
@@ -8,6 +8,7 @@ import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / 'scripts'))
|
||||
@@ -29,68 +30,34 @@ def desktop_entry(path):
|
||||
return dict(line.split('=', 1) for line in path.read_text().splitlines() if '=' in line)
|
||||
|
||||
|
||||
class WindowsRaylibToolchainTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.scratch = SCRATCH / 'windows'
|
||||
self.scratch.mkdir(parents=True)
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.scratch)
|
||||
|
||||
def test_both_cross_compilers_are_selected_and_cached_by_identity(self):
|
||||
source = self.scratch / 'raylib-source'
|
||||
source.mkdir()
|
||||
tools = {
|
||||
'x86_64-w64-mingw32-gcc': '/cross/bin/x86_64-w64-mingw32-gcc',
|
||||
'x86_64-w64-mingw32-g++': '/cross/bin/x86_64-w64-mingw32-g++',
|
||||
'x86_64-w64-mingw32-windres': '/cross/bin/x86_64-w64-mingw32-windres',
|
||||
'x86_64-w64-mingw32-ar': '/cross/bin/x86_64-w64-mingw32-ar',
|
||||
'x86_64-w64-mingw32-ranlib': '/cross/bin/x86_64-w64-mingw32-ranlib',
|
||||
}
|
||||
commands = []
|
||||
|
||||
def tool(name):
|
||||
return tools[name]
|
||||
|
||||
def package(name):
|
||||
return source
|
||||
|
||||
def run(*args, **kwargs):
|
||||
command = list(map(str, args))
|
||||
commands.append(command)
|
||||
if command[:2] == ['cmake', '-S']:
|
||||
folder = Path(command[4])
|
||||
toolchain = Path(command[5].split('=', 1)[1]).read_text()
|
||||
self.assertIn('set(CMAKE_C_COMPILER /cross/bin/x86_64-w64-mingw32-gcc)', toolchain)
|
||||
self.assertIn(f'set(CMAKE_CXX_COMPILER {tools["x86_64-w64-mingw32-g++"]})', toolchain)
|
||||
(folder / 'CMakeCache.txt').write_text('configured')
|
||||
elif command[:2] == ['cmake', '--build']:
|
||||
folder = Path(command[2])
|
||||
library = folder / 'raylib/libraylib.a'
|
||||
library.parent.mkdir(parents=True)
|
||||
library.write_bytes(b'raylib')
|
||||
|
||||
originals = (desktop.WINDOWS, desktop.windows_tool, desktop.package,
|
||||
desktop.mingw_library_flags, desktop.run)
|
||||
desktop.WINDOWS, desktop.windows_tool, desktop.package = self.scratch, tool, package
|
||||
desktop.mingw_library_flags, desktop.run = lambda: [], run
|
||||
try:
|
||||
desktop.windows_raylib()
|
||||
self.assertEqual(len(commands), 2)
|
||||
desktop.windows_raylib()
|
||||
self.assertEqual(len(commands), 2, 'unchanged compilers reuse the raylib build')
|
||||
|
||||
tools['x86_64-w64-mingw32-g++'] = '/new-cross/bin/x86_64-w64-mingw32-g++'
|
||||
desktop.windows_raylib()
|
||||
self.assertEqual(len(commands), 4, 'a different C++ compiler forces reconfiguration')
|
||||
self.assertIn('set(CMAKE_CXX_COMPILER /new-cross/bin/x86_64-w64-mingw32-g++)',
|
||||
(self.scratch / 'raylib/mingw.cmake').read_text())
|
||||
stamp = (self.scratch / 'raylib/raylib/libraylib.a.source').read_text()
|
||||
self.assertIn('/cross/bin/x86_64-w64-mingw32-gcc', stamp)
|
||||
self.assertIn('/new-cross/bin/x86_64-w64-mingw32-g++', stamp)
|
||||
finally:
|
||||
(desktop.WINDOWS, desktop.windows_tool, desktop.package,
|
||||
desktop.mingw_library_flags, desktop.run) = originals
|
||||
class WindowsDesktopPackageTest(unittest.TestCase):
|
||||
def test_stage_preserves_renderer_layout(self):
|
||||
scratch = ROOT / 'build/windows/stage-test'
|
||||
scratch.mkdir(parents=True, exist_ok=True)
|
||||
self.addCleanup(shutil.rmtree, scratch)
|
||||
sdk = scratch / 'sdk'
|
||||
for name in ('bin/SDL2.dll', 'etc/fonts/fonts.conf', 'share/licenses/Cairo'):
|
||||
path = sdk / name
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(name)
|
||||
archive = scratch / 'runtime.tar'
|
||||
subprocess.run(['tar', '-cf', archive, '-C', sdk, 'bin', 'etc', 'share'], check=True)
|
||||
for name in ('program.exe', 'codec.dll', 'font.ttf', 'font.txt', 'assets/choano/title.avif'):
|
||||
path = scratch / name
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(name)
|
||||
renderer = {'runtime_archive': archive, 'resources': {
|
||||
'font': scratch / 'font.ttf', 'font_license': scratch / 'font.txt'}}
|
||||
with patch.object(desktop, 'ROOT', scratch):
|
||||
stage = desktop.stage_windows(scratch / 'stage', scratch / 'program.exe', renderer,
|
||||
scratch / 'codec.dll')
|
||||
for name, contents in {
|
||||
'bin/Choano.exe': 'program.exe', 'bin/kryonavif.dll': 'codec.dll',
|
||||
'bin/kryon-font.ttf': 'font.ttf', 'bin/LICENSE-Liberation': 'font.txt',
|
||||
'bin/SDL2.dll': 'bin/SDL2.dll', 'etc/fonts/fonts.conf': 'etc/fonts/fonts.conf',
|
||||
'assets/choano/title.avif': 'assets/choano/title.avif',
|
||||
}.items():
|
||||
self.assertEqual((stage / name).read_text(), contents)
|
||||
|
||||
|
||||
class DesktopReleaseTest(unittest.TestCase):
|
||||
|
||||
@@ -5,7 +5,7 @@ on a fresh private Xvfb display.
|
||||
The installer must place the program, font and every asset, its shortcuts and
|
||||
its uninstall entry for this user only. Started from another folder, the
|
||||
installed game opens its 900x680 window, draws the JPEG title art close to
|
||||
the native build's (and Fish mode's art differently), opens raylib's audio
|
||||
the native build's (and Fish mode's art differently), opens the desktop audio
|
||||
device for its chimes, swims and restarts, and saves its settings in
|
||||
Local AppData. The silent uninstaller then removes it all but the settings.
|
||||
Wine gets a private HOME and a silent ALSA device, so nothing reaches the
|
||||
@@ -32,13 +32,14 @@ NATIVE_PROFILE = SCRATCH / 'native-profile'
|
||||
DRIVE = PREFIX / 'drive_c'
|
||||
USER = DRIVE / 'users' / getpass.getuser()
|
||||
INSTALLED = USER / 'AppData/Local/Programs/Choano'
|
||||
PROGRAM = INSTALLED / 'bin/Choano.exe'
|
||||
SETTINGS = USER / 'AppData/Local/Choano/preferences.v1'
|
||||
SHORTCUTS = (USER / 'AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Choano.lnk', USER / 'Desktop/Choano.lnk')
|
||||
|
||||
env = {k: v for k, v in os.environ.items() if k not in
|
||||
('DISPLAY', 'WAYLAND_DISPLAY', 'XAUTHORITY', 'DBUS_SESSION_BUS_ADDRESS', 'SESSION_MANAGER',
|
||||
'XDG_CONFIG_HOME', 'XDG_DATA_HOME', 'XDG_CACHE_HOME', 'XDG_RUNTIME_DIR', 'PULSE_SERVER')}
|
||||
env.update(YUE_DESKTOP_RECOVERY='0', WINEPREFIX=str(PREFIX), WINEDEBUG='-all', HOME=str(HOME),
|
||||
env.update(HARMONY_DESKTOP_RECOVERY='0', YUE_DESKTOP_RECOVERY='0', WINEPREFIX=str(PREFIX), WINEDEBUG='-all', HOME=str(HOME),
|
||||
WINEDLLOVERRIDES='winemenubuilder.exe=d;mscoree=d;mshtml=d', XDG_RUNTIME_DIR=str(SCRATCH / 'runtime'),
|
||||
ALSA_CONFIG_PATH=str(SCRATCH / 'alsa.conf'), PULSE_SERVER='unix:' + str(SCRATCH / 'no-pulse'),
|
||||
SDL_AUDIODRIVER='dummy')
|
||||
@@ -115,9 +116,10 @@ def install():
|
||||
wait_prefix()
|
||||
wine(SETUP, '/S', check=True)
|
||||
wait_prefix()
|
||||
for name in ('Choano.exe', 'Uninstall.exe', 'kryon-font.ttf'):
|
||||
for name in ('bin/Choano.exe', 'Uninstall.exe', 'bin/kryon-font.ttf',
|
||||
'bin/SDL2.dll', 'bin/kryonavif.dll', 'etc/fonts/fonts.conf'):
|
||||
assert (INSTALLED / name).is_file(), f'{name} is not installed in {INSTALLED}'
|
||||
check_windows_program(INSTALLED / 'Choano.exe')
|
||||
check_windows_program(PROGRAM)
|
||||
source = ROOT / 'assets'
|
||||
count = 0
|
||||
for path in source.rglob('*'):
|
||||
@@ -145,7 +147,7 @@ def run_title(fish, shot, log):
|
||||
# Controls, sound, then Fish mode unlocked and picked.
|
||||
SETTINGS.write_text('1s011' if fish else '1s000')
|
||||
with open(log, 'w') as output:
|
||||
launch = subprocess.Popen(['wine', INSTALLED / 'Choano.exe'], cwd=SCRATCH, env=env,
|
||||
launch = subprocess.Popen(['wine', PROGRAM], cwd=SCRATCH, env=env,
|
||||
stdout=output, stderr=subprocess.STDOUT)
|
||||
try:
|
||||
window = window_for(launch, 'Choano.exe')
|
||||
@@ -161,10 +163,12 @@ def run_title(fish, shot, log):
|
||||
time.sleep(.5)
|
||||
key(window, 'm')
|
||||
for _ in range(50):
|
||||
if SETTINGS.read_text() == '1s100':
|
||||
saved = SETTINGS.read_text()
|
||||
# Newer saves append wardrobe and progress fields.
|
||||
if saved.startswith('1s100'):
|
||||
break
|
||||
time.sleep(.1)
|
||||
assert SETTINGS.read_text() == '1s100', f'muting saved {SETTINGS.read_text()!r}, not 1s100'
|
||||
assert saved.startswith('1s100'), f'muting did not save the expected settings: {saved!r}'
|
||||
assert launch.poll() is None, 'the Windows game exited while playing'
|
||||
finally:
|
||||
stop(launch)
|
||||
@@ -218,17 +222,13 @@ try:
|
||||
run_native(fish, SCRATCH / f'native-{mode}.png')
|
||||
shots[mode] = difference(SCRATCH / f'windows-{mode}.png', SCRATCH / f'native-{mode}.png')
|
||||
modes = difference(SCRATCH / 'windows-dish.png', SCRATCH / 'windows-fish.png')
|
||||
log = (SCRATCH / 'windows-dish.log').read_text(errors='replace')
|
||||
for line in ('AUDIO: Device initialized successfully', 'game-start.wav] File loaded successfully'):
|
||||
assert line in log, f'raylib did not report {line!r}; see {SCRATCH / "windows-dish.log"}'
|
||||
for mode, value in shots.items():
|
||||
assert value < 0.04, f'Windows {mode} title differs from the native build: {value:.4f}'
|
||||
assert modes > 0.05, f'Fish title art did not replace the dish title: {modes:.4f}'
|
||||
uninstall()
|
||||
print(f'Choano Windows installer local test passed in a private Wine prefix on private Xvfb: {assets} assets, '
|
||||
'font, shortcuts and per-user uninstall entry installed; titles close to the native build (RMSE dish '
|
||||
f'{shots["dish"]:.4f}, fish {shots["fish"]:.4f}; modes differ by {modes:.4f}); audio device and chime '
|
||||
'loaded; swims, restarts and saves muted settings to Local AppData; silent uninstall removes '
|
||||
f'{shots["dish"]:.4f}, fish {shots["fish"]:.4f}; modes differ by {modes:.4f}); swims, restarts and saves muted settings to Local AppData; silent uninstall removes '
|
||||
'the game and keeps the settings.')
|
||||
finally:
|
||||
subprocess.run(['wineserver', '-k'], env=env, timeout=60)
|
||||
|
||||
+63
-90
@@ -10,6 +10,15 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/LoupVaillant/Monocypher.git"
|
||||
},
|
||||
{
|
||||
"commit": "8d5d2e752a219674f993473c8410847ba42fad48",
|
||||
"dependencies": {"audio": "p59deb49c7f103127", "avif": "pb203529d803e73a4", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db", "libwebp": "p3b3c785a0e17e605", "sdl3": "p16cd0434af3dff7b", "webp": "p2af20e0c835b1c63"},
|
||||
"dependency_refs": {"audio": "1b2f35b7b39df6fb9af7a52324b4b7cf18e98df2", "avif": "2611e727e226a2af22dfb7f10bf224bd2f1a3d30", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339", "sdl3": "829a65d769d935c4852f8159e964312c0957260a", "webp": "ec6ed304767e10c125ab2820f3b01d6fd773e147"},
|
||||
"id": "p09ea4e5550e9f459",
|
||||
"name": "kryon",
|
||||
"ref": "8d5d2e752a219674f993473c8410847ba42fad48",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "c96f5e3de9c4488f4e6c97f59f5245f22fda22f7",
|
||||
"dependencies": {},
|
||||
@@ -36,15 +45,6 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/libsdl-org/SDL.git"
|
||||
},
|
||||
{
|
||||
"commit": "f26a552247e2cd367fd33def6860d903cac6ab8a",
|
||||
"dependencies": {"av1": "p5d7d12505a42f7b3", "dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db"},
|
||||
"dependency_refs": {"av1": "bd278217e2bac754d868b3d6502eac4257658d4b", "dav1d": "54706fc6bc0cdecab7e9593974a4039cc038fca7", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199"},
|
||||
"id": "p274c2dd6d03a7c0c",
|
||||
"name": "avif",
|
||||
"ref": "f26a552247e2cd367fd33def6860d903cac6ab8a",
|
||||
"url": "https://github.com/ziranlang/avif.git"
|
||||
},
|
||||
{
|
||||
"commit": "ec6ed304767e10c125ab2820f3b01d6fd773e147",
|
||||
"dependencies": {"image_codec": "p69c0e968ae5735d9", "libwebp": "p3b3c785a0e17e605"},
|
||||
@@ -54,6 +54,15 @@
|
||||
"ref": "ec6ed304767e10c125ab2820f3b01d6fd773e147",
|
||||
"url": "https://github.com/ziranlang/webp.git"
|
||||
},
|
||||
{
|
||||
"commit": "b95d19334ab4338d3611ec9d44db62b50694e464",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p09ea4e5550e9f459", "mesh_client": "p8204ae87a845c1c3"},
|
||||
"dependency_refs": {"crypto": "master", "kryon": "8d5d2e752a219674f993473c8410847ba42fad48", "mesh_client": "c1ac6095d01bcfdd4c5ae49c4636aaf9a0303449"},
|
||||
"id": "p333db0ddd841f1ec",
|
||||
"name": "Apps",
|
||||
"ref": "b95d19334ab4338d3611ec9d44db62b50694e464",
|
||||
"url": "https://github.com/waozixyz/apps.git"
|
||||
},
|
||||
{
|
||||
"commit": "1844042d1ca751e62e61df7617dba19c98588339",
|
||||
"dependencies": {},
|
||||
@@ -72,15 +81,6 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/open-quantum-safe/liboqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "59ff268bc8aa86adede06d9af82bad956733a475",
|
||||
"dependencies": {"kryon": "peb1e86e2b07f33bb"},
|
||||
"dependency_refs": {"kryon": "3f72441949d4e16094834fa9220e5d7fa77a0ac0"},
|
||||
"id": "p57b0d16629da3f91",
|
||||
"name": "Game2D",
|
||||
"ref": "59ff268bc8aa86adede06d9af82bad956733a475",
|
||||
"url": "https://github.com/kryonlabs/game2d.git"
|
||||
},
|
||||
{
|
||||
"commit": "1aadfad932c98c069a1204261b1856f81f3bc199",
|
||||
"dependencies": {},
|
||||
@@ -90,6 +90,15 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/AOMediaCodec/libavif.git"
|
||||
},
|
||||
{
|
||||
"commit": "1b2f35b7b39df6fb9af7a52324b4b7cf18e98df2",
|
||||
"dependencies": {"libopus": "pe1fe9bbe80bf1d6d", "libsamplerate": "p0dd67588478f9a3e"},
|
||||
"dependency_refs": {"libopus": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6", "libsamplerate": "c96f5e3de9c4488f4e6c97f59f5245f22fda22f7"},
|
||||
"id": "p59deb49c7f103127",
|
||||
"name": "audio",
|
||||
"ref": "1b2f35b7b39df6fb9af7a52324b4b7cf18e98df2",
|
||||
"url": "https://github.com/ziranlang/audio.git"
|
||||
},
|
||||
{
|
||||
"commit": "bd278217e2bac754d868b3d6502eac4257658d4b",
|
||||
"dependencies": {"dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa"},
|
||||
@@ -99,6 +108,15 @@
|
||||
"ref": "bd278217e2bac754d868b3d6502eac4257658d4b",
|
||||
"url": "https://github.com/ziranlang/av1.git"
|
||||
},
|
||||
{
|
||||
"commit": "9ee24b3f70b9c7d776dc391cba15ba97533db227",
|
||||
"dependencies": {"kryon": "p09ea4e5550e9f459"},
|
||||
"dependency_refs": {"kryon": "8d5d2e752a219674f993473c8410847ba42fad48"},
|
||||
"id": "p6269d7141b731fe4",
|
||||
"name": "Css",
|
||||
"ref": "9ee24b3f70b9c7d776dc391cba15ba97533db227",
|
||||
"url": "https://github.com/kryonlabs/css.git"
|
||||
},
|
||||
{
|
||||
"commit": "360553150917f352e49e1beb78917370792ccaef",
|
||||
"dependencies": {},
|
||||
@@ -152,6 +170,15 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/curl/curl.git"
|
||||
},
|
||||
{
|
||||
"commit": "2611e727e226a2af22dfb7f10bf224bd2f1a3d30",
|
||||
"dependencies": {"av1": "p5d7d12505a42f7b3", "dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db"},
|
||||
"dependency_refs": {"av1": "bd278217e2bac754d868b3d6502eac4257658d4b", "dav1d": "54706fc6bc0cdecab7e9593974a4039cc038fca7", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199"},
|
||||
"id": "pb203529d803e73a4",
|
||||
"name": "avif",
|
||||
"ref": "2611e727e226a2af22dfb7f10bf224bd2f1a3d30",
|
||||
"url": "https://github.com/ziranlang/avif.git"
|
||||
},
|
||||
{
|
||||
"commit": "54706fc6bc0cdecab7e9593974a4039cc038fca7",
|
||||
"dependencies": {},
|
||||
@@ -162,22 +189,13 @@
|
||||
"url": "https://github.com/videolan/dav1d.git"
|
||||
},
|
||||
{
|
||||
"commit": "ce5837f80e8ce6cb8d2d9f77915095d764da3485",
|
||||
"dependencies": {"dr_libs": "pb7c2dd1c09da0c1c", "libopus": "pe1fe9bbe80bf1d6d", "libsamplerate": "p0dd67588478f9a3e", "stb": "pe4a63e2d6e0424e7"},
|
||||
"dependency_refs": {"dr_libs": "f12e197fd462e4c22873fbd70d11b1d2f2c1dc3c", "libopus": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6", "libsamplerate": "c96f5e3de9c4488f4e6c97f59f5245f22fda22f7", "stb": "9600522de53973336fa033a289858a4354cbb04c"},
|
||||
"id": "pb46a53117b2530ce",
|
||||
"name": "audio",
|
||||
"ref": "ce5837f80e8ce6cb8d2d9f77915095d764da3485",
|
||||
"url": "https://github.com/ziranlang/audio.git"
|
||||
},
|
||||
{
|
||||
"commit": "f12e197fd462e4c22873fbd70d11b1d2f2c1dc3c",
|
||||
"dependencies": {},
|
||||
"id": "pb7c2dd1c09da0c1c",
|
||||
"name": "dr_libs",
|
||||
"ref": "f12e197fd462e4c22873fbd70d11b1d2f2c1dc3c",
|
||||
"source": true,
|
||||
"url": "https://github.com/mackron/dr_libs.git"
|
||||
"commit": "fc8f3d899dfc3d3e0b535006526485c6d8c8c279",
|
||||
"dependencies": {"curl": "p8da229d15597ab5c", "kryon": "p09ea4e5550e9f459", "mesh_client": "p8204ae87a845c1c3", "monocypher": "p002f6ed23e3a3576", "oqs": "p7098ac9cd92f7e5f", "qrcode": "p0dfa70137405b096", "zlib": "p82dbc05081cd4d96"},
|
||||
"dependency_refs": {"curl": "19b299005fbe2d895f4ad525cfdae62a2220c3ea", "kryon": "8d5d2e752a219674f993473c8410847ba42fad48", "mesh_client": "c1ac6095d01bcfdd4c5ae49c4636aaf9a0303449", "monocypher": "master", "oqs": "master", "qrcode": "master", "zlib": "51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf"},
|
||||
"id": "pb3958804740a96f2",
|
||||
"name": "Entity",
|
||||
"ref": "fc8f3d899dfc3d3e0b535006526485c6d8c8c279",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
},
|
||||
{
|
||||
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
|
||||
@@ -188,40 +206,13 @@
|
||||
"url": "https://github.com/ziranlang/crypto.git"
|
||||
},
|
||||
{
|
||||
"commit": "5120868d2c413bee6a3b8430f9026982545ea452",
|
||||
"dependencies": {"kryon": "peb1e86e2b07f33bb"},
|
||||
"dependency_refs": {"kryon": "3f72441949d4e16094834fa9220e5d7fa77a0ac0"},
|
||||
"id": "pc80ba02e093c2168",
|
||||
"name": "Css",
|
||||
"ref": "5120868d2c413bee6a3b8430f9026982545ea452",
|
||||
"url": "https://github.com/kryonlabs/css.git"
|
||||
},
|
||||
{
|
||||
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
|
||||
"dependencies": {},
|
||||
"id": "pcc7aa76725f2fb2f",
|
||||
"name": "raylib",
|
||||
"ref": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
|
||||
"source": true,
|
||||
"url": "https://github.com/raysan5/raylib.git"
|
||||
},
|
||||
{
|
||||
"commit": "40f598a1719bc99bbef7b61649aa168e923ef1f5",
|
||||
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "peb1e86e2b07f33bb", "mesh_client": "p8204ae87a845c1c3"},
|
||||
"dependency_refs": {"crypto": "master", "kryon": "3f72441949d4e16094834fa9220e5d7fa77a0ac0", "mesh_client": "c1ac6095d01bcfdd4c5ae49c4636aaf9a0303449"},
|
||||
"id": "pd0b0496bce01d79f",
|
||||
"name": "Apps",
|
||||
"ref": "40f598a1719bc99bbef7b61649aa168e923ef1f5",
|
||||
"url": "https://github.com/waozixyz/apps.git"
|
||||
},
|
||||
{
|
||||
"commit": "3c7df0daa0cfb12fff67dfaac34aac736687a59e",
|
||||
"dependencies": {"curl": "p8da229d15597ab5c", "kryon": "peb1e86e2b07f33bb", "mesh_client": "p8204ae87a845c1c3", "monocypher": "p002f6ed23e3a3576", "oqs": "p7098ac9cd92f7e5f", "qrcode": "p0dfa70137405b096", "zlib": "p82dbc05081cd4d96"},
|
||||
"dependency_refs": {"curl": "19b299005fbe2d895f4ad525cfdae62a2220c3ea", "kryon": "3f72441949d4e16094834fa9220e5d7fa77a0ac0", "mesh_client": "c1ac6095d01bcfdd4c5ae49c4636aaf9a0303449", "monocypher": "master", "oqs": "master", "qrcode": "master", "zlib": "51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf"},
|
||||
"id": "pd380d4bff37de135",
|
||||
"name": "Entity",
|
||||
"ref": "3c7df0daa0cfb12fff67dfaac34aac736687a59e",
|
||||
"url": "https://github.com/waozixyz/entity.git"
|
||||
"commit": "fcacb49c1e128e9eb100884e6029b24b4e608d38",
|
||||
"dependencies": {"kryon": "p09ea4e5550e9f459"},
|
||||
"dependency_refs": {"kryon": "8d5d2e752a219674f993473c8410847ba42fad48"},
|
||||
"id": "pcad095808686987d",
|
||||
"name": "Game2D",
|
||||
"ref": "fcacb49c1e128e9eb100884e6029b24b4e608d38",
|
||||
"url": "https://github.com/kryonlabs/game2d.git"
|
||||
},
|
||||
{
|
||||
"commit": "9cc6872f75447c3a24c16764f9829d0f58751cb0",
|
||||
@@ -239,34 +230,16 @@
|
||||
"ref": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6",
|
||||
"source": true,
|
||||
"url": "https://github.com/xiph/opus.git"
|
||||
},
|
||||
{
|
||||
"commit": "9600522de53973336fa033a289858a4354cbb04c",
|
||||
"dependencies": {},
|
||||
"id": "pe4a63e2d6e0424e7",
|
||||
"name": "stb",
|
||||
"ref": "9600522de53973336fa033a289858a4354cbb04c",
|
||||
"source": true,
|
||||
"url": "https://github.com/nothings/stb.git"
|
||||
},
|
||||
{
|
||||
"commit": "3f72441949d4e16094834fa9220e5d7fa77a0ac0",
|
||||
"dependencies": {"audio": "pb46a53117b2530ce", "avif": "p274c2dd6d03a7c0c", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db", "libwebp": "p3b3c785a0e17e605", "raylib": "pcc7aa76725f2fb2f", "sdl3": "p16cd0434af3dff7b", "webp": "p2af20e0c835b1c63"},
|
||||
"dependency_refs": {"audio": "ce5837f80e8ce6cb8d2d9f77915095d764da3485", "avif": "f26a552247e2cd367fd33def6860d903cac6ab8a", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339", "raylib": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e", "sdl3": "829a65d769d935c4852f8159e964312c0957260a", "webp": "ec6ed304767e10c125ab2820f3b01d6fd773e147"},
|
||||
"id": "peb1e86e2b07f33bb",
|
||||
"name": "kryon",
|
||||
"ref": "3f72441949d4e16094834fa9220e5d7fa77a0ac0",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "pd0b0496bce01d79f", "css": "pc80ba02e093c2168", "entity": "pd380d4bff37de135", "game2d": "p57b0d16629da3f91", "kryon": "peb1e86e2b07f33bb", "mingcute": "pe1027b9d16704793"},
|
||||
"dependency_refs": {"apps": "40f598a1719bc99bbef7b61649aa168e923ef1f5", "css": "5120868d2c413bee6a3b8430f9026982545ea452", "entity": "3c7df0daa0cfb12fff67dfaac34aac736687a59e", "game2d": "59ff268bc8aa86adede06d9af82bad956733a475", "kryon": "3f72441949d4e16094834fa9220e5d7fa77a0ac0", "mingcute": "master"},
|
||||
"dependencies": {"apps": "p333db0ddd841f1ec", "css": "p6269d7141b731fe4", "entity": "pb3958804740a96f2", "game2d": "pcad095808686987d", "kryon": "p09ea4e5550e9f459", "mingcute": "pe1027b9d16704793"},
|
||||
"dependency_refs": {"apps": "b95d19334ab4338d3611ec9d44db62b50694e464", "css": "9ee24b3f70b9c7d776dc391cba15ba97533db227", "entity": "fc8f3d899dfc3d3e0b535006526485c6d8c8c279", "game2d": "fcacb49c1e128e9eb100884e6029b24b4e608d38", "kryon": "8d5d2e752a219674f993473c8410847ba42fad48", "mingcute": "master"},
|
||||
"name": "Choano"
|
||||
},
|
||||
"toolchain": {
|
||||
"commit": "398bd43d9c68ed57f34e837fca7785dd77b85762",
|
||||
"ref": "e0367fa9c5731dcf9bb84ed7f3d294570d8c0bda",
|
||||
"commit": "55b0176800d42c829db098a2ef8b0705ea339509",
|
||||
"ref": "55b0176800d42c829db098a2ef8b0705ea339509",
|
||||
"url": "https://github.com/ziranlang/ziran.git"
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -7,11 +7,11 @@ tool = "kryon"
|
||||
|
||||
[toolchain]
|
||||
git = "https://github.com/ziranlang/ziran.git"
|
||||
ref = "e0367fa9c5731dcf9bb84ed7f3d294570d8c0bda"
|
||||
ref = "55b0176800d42c829db098a2ef8b0705ea339509"
|
||||
|
||||
[dependencies.kryon]
|
||||
git = "https://github.com/kryonlabs/kryon.git"
|
||||
ref = "3f72441949d4e16094834fa9220e5d7fa77a0ac0"
|
||||
ref = "8d5d2e752a219674f993473c8410847ba42fad48"
|
||||
|
||||
[install]
|
||||
bin = "Choano"
|
||||
@@ -35,15 +35,15 @@ working_directory = "."
|
||||
|
||||
[dependencies.apps]
|
||||
git = "https://github.com/waozixyz/apps.git"
|
||||
ref = "40f598a1719bc99bbef7b61649aa168e923ef1f5"
|
||||
ref = "b95d19334ab4338d3611ec9d44db62b50694e464"
|
||||
|
||||
[dependencies.entity]
|
||||
git = "https://github.com/waozixyz/entity.git"
|
||||
ref = "3c7df0daa0cfb12fff67dfaac34aac736687a59e"
|
||||
ref = "fc8f3d899dfc3d3e0b535006526485c6d8c8c279"
|
||||
|
||||
[dependencies.game2d]
|
||||
git = "https://github.com/kryonlabs/game2d.git"
|
||||
ref = "59ff268bc8aa86adede06d9af82bad956733a475"
|
||||
ref = "fcacb49c1e128e9eb100884e6029b24b4e608d38"
|
||||
|
||||
[dependencies.mingcute]
|
||||
git = "https://github.com/kryonlabs/mingcute.git"
|
||||
@@ -51,4 +51,4 @@ ref = "master"
|
||||
|
||||
[dependencies.css]
|
||||
git = "https://github.com/kryonlabs/css.git"
|
||||
ref = "5120868d2c413bee6a3b8430f9026982545ea452"
|
||||
ref = "9ee24b3f70b9c7d776dc391cba15ba97533db227"
|
||||
Reference in new issue
Block a user