Compare commits
32 Commits
19d5b1078a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89a312476d | ||
|
|
88275ad0da | ||
|
|
c42257d2d5 | ||
|
|
f505df9eab | ||
|
|
b888e2348f | ||
|
|
94699efaed | ||
|
|
6b5eebbe1e | ||
|
|
bae4ad1c92 | ||
|
|
2f967b086c | ||
|
|
8d3ff9ce78 | ||
|
|
9597742d81 | ||
|
|
a6abf7250a | ||
|
|
b428f93eca | ||
|
|
6857e893a1 | ||
|
|
93ff61d350 | ||
|
|
5f89052dfa | ||
|
|
086be6aa2d | ||
|
|
ec3433f980 | ||
|
|
66b5d94e00 | ||
|
|
5649a2ad9c | ||
|
|
ba4f0e0e3e | ||
|
|
3160e57f4d | ||
|
|
4538651608 | ||
|
|
c6b98f9be9 | ||
|
|
8ab43626ae | ||
|
|
5f53901274 | ||
|
|
be186bc025 | ||
|
|
87b9a7d089 | ||
|
|
e913ed87e9 | ||
|
|
bfb2d8d8e5 | ||
|
|
9496b94752 | ||
|
|
a4e4a5bc7e |
80
.github/workflows/cd.yml
vendored
80
.github/workflows/cd.yml
vendored
@@ -14,18 +14,19 @@ jobs:
|
||||
linux-ubuntu:
|
||||
timeout-minutes: 10
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Dependencies
|
||||
run: sudo apt update && sudo apt -y install libsodium-dev
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-gz -DCMAKE_CXX_FLAGS=-gz
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_FLAGS=-gz -DCMAKE_CXX_FLAGS=-gz -DCMAKE_EXE_LINKER_FLAGS=-gz
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4
|
||||
@@ -33,50 +34,48 @@ jobs:
|
||||
- name: Determine tag name
|
||||
id: tag
|
||||
shell: bash
|
||||
# taken from llama.cpp
|
||||
run: |
|
||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
run: . .github/workflows/tag_version.bash
|
||||
|
||||
- name: Compress artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
tar -czvf ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu24.04-x86_64.tar.gz -C ${{github.workspace}}/build/bin/ .
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# TODO: simpler name?
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu24.04-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu20.04-x86_64.tar.gz
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-ubuntu24.04-x86_64.tar.gz
|
||||
|
||||
|
||||
windows:
|
||||
timeout-minutes: 15
|
||||
|
||||
runs-on: windows-latest
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
type: ['', 'asan']
|
||||
os: ['windows-2022']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Export GitHub Actions cache environment variables
|
||||
uses: actions/github-script@v7
|
||||
- name: Restore vcpkg cache
|
||||
id: vcpkg-cache
|
||||
uses: TAServers/vcpkg-cache@v3
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: Install Dependencies
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||
VCPKG_FEATURE_FLAGS: "binarycaching"
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{steps.vcpkg-cache.outputs.path}},readwrite"
|
||||
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
|
||||
# setup vs env
|
||||
@@ -85,7 +84,8 @@ jobs:
|
||||
arch: amd64
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe
|
||||
# TODO: og asan had this -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
|
||||
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DSOLANACEAE_ECOSYSTEM_ASAN=${{matrix.type == 'asan' && 'ON' || 'OFF'}}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
@@ -93,15 +93,7 @@ jobs:
|
||||
- name: Determine tag name
|
||||
id: tag
|
||||
shell: bash
|
||||
# taken from llama.cpp
|
||||
run: |
|
||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
run: . .github/workflows/tag_version.bash
|
||||
|
||||
- name: Clean temporary artifacts
|
||||
# msvc sometimes produces .ilk files, which are used for linking only
|
||||
@@ -112,15 +104,18 @@ jobs:
|
||||
- name: Compress artifacts
|
||||
shell: powershell
|
||||
run: |
|
||||
Compress-Archive -Path ${{github.workspace}}/build/bin/* -Destination ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64.zip
|
||||
Compress-Archive -Path ${{github.workspace}}/build/bin/* -Destination ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc${{matrix.type == 'asan' && '-asan' || ''}}-x86_64.zip
|
||||
|
||||
# TODO: add asan runtime dep ?
|
||||
# only needed by totato, loading asan in non asan host is incompatible anyway
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
# TODO: simpler name?
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64
|
||||
name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc${{matrix.type == 'asan' && '-asan' || ''}}-x86_64
|
||||
# TODO: do propper packing
|
||||
path: |
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-x86_64.zip
|
||||
${{github.workspace}}/${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc${{matrix.type == 'asan' && '-asan' || ''}}-x86_64.zip
|
||||
|
||||
release:
|
||||
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }}
|
||||
@@ -135,22 +130,15 @@ jobs:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Determine tag name
|
||||
id: tag
|
||||
shell: bash
|
||||
# taken from llama.cpp
|
||||
run: |
|
||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
||||
echo "name=dev-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
||||
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
run: . .github/workflows/tag_version.bash
|
||||
|
||||
- name: Download artifacts
|
||||
id: download-artifact
|
||||
|
||||
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
@@ -42,11 +42,11 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
platform:
|
||||
- vcpkg_toolkit: arm-neon-android
|
||||
- vcpkg_toolkit: arm-neon-android-23
|
||||
ndk_abi: armeabi-v7a
|
||||
- vcpkg_toolkit: arm64-android
|
||||
- vcpkg_toolkit: arm64-android-23
|
||||
ndk_abi: arm64-v8a
|
||||
- vcpkg_toolkit: x64-android
|
||||
- vcpkg_toolkit: x64-android-23
|
||||
ndk_abi: x86_64
|
||||
|
||||
steps:
|
||||
@@ -54,6 +54,11 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'Green-Sky/vcpkg_android_triplets'
|
||||
path: 'vcpkg_android_triplets'
|
||||
|
||||
- uses: nttld/setup-ndk@v1
|
||||
id: setup_ndk
|
||||
with:
|
||||
@@ -79,7 +84,7 @@ jobs:
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
|
||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||
run: vcpkg install --triplet ${{matrix.platform.vcpkg_toolkit}} libsodium openssl
|
||||
run: vcpkg install --overlay-triplets=vcpkg_android_triplets --triplet ${{matrix.platform.vcpkg_toolkit}} libsodium openssl
|
||||
|
||||
# vcpkg scripts root /usr/local/share/vcpkg/scripts
|
||||
- name: Configure CMake
|
||||
@@ -135,16 +140,16 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Export GitHub Actions cache environment variables
|
||||
uses: actions/github-script@v7
|
||||
- name: Restore vcpkg cache
|
||||
id: vcpkg-cache
|
||||
uses: TAServers/vcpkg-cache@v3
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: Install Dependencies
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
||||
VCPKG_FEATURE_FLAGS: "binarycaching"
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{steps.vcpkg-cache.outputs.path}},readwrite"
|
||||
run: vcpkg install pkgconf:x64-windows libsodium:x64-windows-static pthreads:x64-windows-static
|
||||
|
||||
# setup vs env
|
||||
|
||||
10
.github/workflows/tag_version.bash
vendored
Executable file
10
.github/workflows/tag_version.bash
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
# taken from llama.cpp
|
||||
# needs BRANCH_NAME set
|
||||
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
|
||||
DEPTH="$(git rev-list --count HEAD)"
|
||||
if [[ "${BRANCH_NAME}" == "master" ]]; then
|
||||
echo "name=dev-${DEPTH}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
SAFE_NAME=$(echo "${BRANCH_NAME}" | tr '/' '-')
|
||||
echo "name=dev-${SAFE_NAME}-${SHORT_HASH}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -62,3 +62,6 @@
|
||||
[submodule "external/solanaceae_tox_p2prng"]
|
||||
path = external/solanaceae_tox_p2prng
|
||||
url = https://github.com/Green-Sky/solanaceae_tox_p2prng.git
|
||||
[submodule "external/solanaceae_vcg"]
|
||||
path = external/solanaceae_vcg
|
||||
url = https://github.com/MadeOfJelly/solanaceae_vcg.git
|
||||
|
||||
@@ -20,6 +20,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
option(SOLANACEAE_ECOSYSTEM_BUILD_TESTING "Build tests" ${BUILD_TESTING})
|
||||
message("II SOLANACEAE_ECOSYSTEM_BUILD_TESTING " ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING})
|
||||
option(SOLANACEAE_ECOSYSTEM_ASAN "Build eco with asan (gcc/clang/msvc)" OFF)
|
||||
|
||||
# uggly, but it needs to be defined for all dependencies too
|
||||
# what if its always export?
|
||||
@@ -29,8 +30,33 @@ if (SOLANACEAE_ECOSYSTEM_BUILD_TESTING)
|
||||
include(CTest)
|
||||
endif()
|
||||
|
||||
#add_compile_options(-fsanitize=undefined)
|
||||
#link_libraries(-fsanitize=undefined)
|
||||
if (SOLANACEAE_ECOSYSTEM_ASAN)
|
||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
if (NOT WIN32) # exclude mingw
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
add_compile_options(-fsanitize=address,undefined)
|
||||
#add_compile_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract)
|
||||
#add_compile_options(-fhardened)
|
||||
#add_compile_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full)
|
||||
|
||||
add_link_options(-fno-omit-frame-pointer)
|
||||
add_link_options(-fsanitize=address,undefined)
|
||||
#add_link_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract)
|
||||
#add_link_options(-fhardened)
|
||||
#add_link_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full)
|
||||
|
||||
link_libraries(-static-libasan) # make it "work" on nix
|
||||
message("II enabled ASAN")
|
||||
else()
|
||||
message("!! can not enable ASAN on this platform (gcc/clang + win)")
|
||||
endif()
|
||||
elseif (MSVC)
|
||||
add_compile_options("/fsanitize=address")
|
||||
message("II enabled ASAN")
|
||||
else()
|
||||
message("!! can not enable ASAN on this platform")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# external libs
|
||||
add_subdirectory(./external) # before increasing warn levels, sad :(
|
||||
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Erik Scholz
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
4
external/CMakeLists.txt
vendored
4
external/CMakeLists.txt
vendored
@@ -49,5 +49,9 @@ add_subdirectory(./solanaceae_crdtnotes)
|
||||
set(SOLANACEAE_LLAMA-CPP-WEB_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_llama-cpp-web)
|
||||
|
||||
set(SOLANACEAE_VCG_BUILD_PLUGINS ON CACHE BOOL "")
|
||||
set(SOLANACEAE_VCG_BUILD_TESTING ${SOLANACEAE_ECOSYSTEM_BUILD_TESTING} CACHE BOOL "")
|
||||
add_subdirectory(./solanaceae_vcg)
|
||||
|
||||
add_subdirectory(./totato)
|
||||
|
||||
|
||||
2
external/solanaceae_bridge
vendored
2
external/solanaceae_bridge
vendored
Submodule external/solanaceae_bridge updated: c5bf212ab9...dd462b450e
2
external/solanaceae_contact
vendored
2
external/solanaceae_contact
vendored
Submodule external/solanaceae_contact updated: e2917c497c...fdbe643958
2
external/solanaceae_crdtnotes
vendored
2
external/solanaceae_crdtnotes
vendored
Submodule external/solanaceae_crdtnotes updated: 31c3ed4688...98af0c288f
2
external/solanaceae_ircclient
vendored
2
external/solanaceae_ircclient
vendored
Submodule external/solanaceae_ircclient updated: 3657634be5...84f12f6c0b
2
external/solanaceae_llama-cpp-web
vendored
2
external/solanaceae_llama-cpp-web
vendored
Submodule external/solanaceae_llama-cpp-web updated: 31855cd1b1...a0d28fb516
2
external/solanaceae_message3
vendored
2
external/solanaceae_message3
vendored
Submodule external/solanaceae_message3 updated: e55fb46027...9b3f0b644a
2
external/solanaceae_message_fragment_store
vendored
2
external/solanaceae_message_fragment_store
vendored
Submodule external/solanaceae_message_fragment_store updated: 50db703d78...c8507c3054
2
external/solanaceae_message_serializer
vendored
2
external/solanaceae_message_serializer
vendored
Submodule external/solanaceae_message_serializer updated: b1becb2128...c284e0779e
2
external/solanaceae_ngc_ft1
vendored
2
external/solanaceae_ngc_ft1
vendored
Submodule external/solanaceae_ngc_ft1 updated: 1780bd097a...eb76b35c1d
2
external/solanaceae_object_store
vendored
2
external/solanaceae_object_store
vendored
Submodule external/solanaceae_object_store updated: e5b3546292...889761f538
2
external/solanaceae_plugin
vendored
2
external/solanaceae_plugin
vendored
Submodule external/solanaceae_plugin updated: e25ee67e42...d03d2dae67
2
external/solanaceae_tox
vendored
2
external/solanaceae_tox
vendored
Submodule external/solanaceae_tox updated: dd7eb2702f...83367b2d2e
2
external/solanaceae_tox_p2prng
vendored
2
external/solanaceae_tox_p2prng
vendored
Submodule external/solanaceae_tox_p2prng updated: dd6551ed27...b6001c37db
2
external/solanaceae_tox_upnp
vendored
2
external/solanaceae_tox_upnp
vendored
Submodule external/solanaceae_tox_upnp updated: c3580d2c6f...4df49c5be9
2
external/solanaceae_toxic_games
vendored
2
external/solanaceae_toxic_games
vendored
Submodule external/solanaceae_toxic_games updated: 5450233eb7...cfa42557dc
2
external/solanaceae_util
vendored
2
external/solanaceae_util
vendored
Submodule external/solanaceae_util updated: 6cbcc9463c...c75143df94
1
external/solanaceae_vcg
vendored
Submodule
1
external/solanaceae_vcg
vendored
Submodule
Submodule external/solanaceae_vcg added at 4bef835365
2
external/solanaceae_zox
vendored
2
external/solanaceae_zox
vendored
Submodule external/solanaceae_zox updated: 2f0dba1044...399c27cc2b
2
external/totato
vendored
2
external/totato
vendored
Submodule external/totato updated: e77e57fa78...3db909d397
@@ -1,15 +1,18 @@
|
||||
#include "./dice_tool.hpp"
|
||||
|
||||
#include <solanaceae/contact/contact_store_i.hpp>
|
||||
#include <solanaceae/contact/components.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <entt/container/dense_set.hpp>
|
||||
#include <entt/entity/registry.hpp>
|
||||
#include <entt/entity/handle.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
DiceTool::DiceTool(P2PRNGI& p2prng, Contact3Registry& cr) : _p2prng(p2prng), _cr(cr) {
|
||||
DiceTool::DiceTool(P2PRNGI& p2prng, ContactStore4I& cs) : _p2prng(p2prng), _cs(cs) {
|
||||
p2prng.subscribe(this, P2PRNG_Event::init);
|
||||
p2prng.subscribe(this, P2PRNG_Event::hmac);
|
||||
p2prng.subscribe(this, P2PRNG_Event::secret);
|
||||
@@ -29,7 +32,7 @@ float DiceTool::render(float) {
|
||||
static uint16_t g_sides {6};
|
||||
ImGui::InputScalar("##sides", ImGuiDataType_U16, &g_sides);
|
||||
|
||||
static entt::dense_set<Contact3> peers;
|
||||
static entt::dense_set<Contact4> peers;
|
||||
|
||||
if (ImGui::CollapsingHeader("peers")) {
|
||||
ImGui::Indent();
|
||||
@@ -43,7 +46,7 @@ float DiceTool::render(float) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Contact3Handle c {_cr, *it};
|
||||
ContactHandle4 c = _cs.contactHandle(*it);
|
||||
|
||||
const char* str_ptr = "<unk>";
|
||||
if (const auto* name_ptr = c.try_get<Contact::Components::Name>(); name_ptr != nullptr && !name_ptr->name.empty()) {
|
||||
@@ -61,8 +64,8 @@ float DiceTool::render(float) {
|
||||
ImGui::OpenPopup("peer selector");
|
||||
}
|
||||
if (ImGui::BeginPopup("peer selector")) {
|
||||
for (const auto& [cv] : _cr.view<Contact::Components::TagBig>().each()) {
|
||||
Contact3Handle c {_cr, cv};
|
||||
for (const auto& [cv] : _cs.registry().view<Contact::Components::TagBig>().each()) {
|
||||
ContactHandle4 c = _cs.contactHandle(cv);
|
||||
|
||||
if (peers.contains(c)) {
|
||||
continue;
|
||||
@@ -75,8 +78,8 @@ float DiceTool::render(float) {
|
||||
|
||||
if (c.all_of<Contact::Components::TagGroup, Contact::Components::ParentOf>()) {
|
||||
if (ImGui::BeginMenu(str_ptr)) {
|
||||
for (const Contact3 child_cv : c.get<Contact::Components::ParentOf>().subs) {
|
||||
Contact3Handle child_c {_cr, child_cv};
|
||||
for (const Contact4 child_cv : c.get<Contact::Components::ParentOf>().subs) {
|
||||
ContactHandle4 child_c = _cs.contactHandle(child_cv);
|
||||
|
||||
if (peers.contains(child_c)) {
|
||||
continue;
|
||||
@@ -113,10 +116,10 @@ float DiceTool::render(float) {
|
||||
}
|
||||
|
||||
if (ImGui::Button("roll")) {
|
||||
//std::vector<Contact3Handle> c_vec{peers.cbegin(), peers.cend()};
|
||||
std::vector<Contact3Handle> c_vec;
|
||||
//std::vector<ContactHandle4> c_vec{peers.cbegin(), peers.cend()};
|
||||
std::vector<ContactHandle4> c_vec;
|
||||
for (const auto cv : peers) {
|
||||
c_vec.emplace_back(_cr, cv);
|
||||
c_vec.emplace_back(_cs.contactHandle(cv));
|
||||
}
|
||||
|
||||
std::vector<uint8_t> is {'D', 'I', 'C', 'E'};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <solanaceae/tox_p2prng/p2prng.hpp>
|
||||
#include <solanaceae/contact/contact_model3.hpp>
|
||||
#include <solanaceae/contact/fwd.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class DiceTool : public P2PRNGEventI {
|
||||
P2PRNGI& _p2prng;
|
||||
Contact3Registry& _cr;
|
||||
ContactStore4I& _cs;
|
||||
|
||||
struct Rolls {
|
||||
std::vector<uint8_t> id;
|
||||
@@ -23,7 +23,7 @@ class DiceTool : public P2PRNGEventI {
|
||||
std::vector<Rolls> _rolls;
|
||||
|
||||
public:
|
||||
DiceTool(P2PRNGI& p2prng, Contact3Registry& cr);
|
||||
DiceTool(P2PRNGI& p2prng, ContactStore4I& cs);
|
||||
~DiceTool(void);
|
||||
|
||||
float render(float time_delta);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include <solanaceae/plugin/solana_plugin_v1.h>
|
||||
|
||||
#include <solanaceae/contact/contact_store_i.hpp>
|
||||
|
||||
#include "./dice_tool.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
@@ -33,11 +36,11 @@ SOLANA_PLUGIN_EXPORT uint32_t solana_plugin_start(struct SolanaAPI* solana_api)
|
||||
|
||||
try {
|
||||
auto* p2prng_i = PLUG_RESOLVE_INSTANCE(P2PRNGI);
|
||||
auto* cr = PLUG_RESOLVE_INSTANCE_VERSIONED(Contact3Registry, "1");
|
||||
auto* cs = PLUG_RESOLVE_INSTANCE(ContactStore4I);
|
||||
|
||||
// static store, could be anywhere tho
|
||||
// construct with fetched dependencies
|
||||
g_dt = std::make_unique<DiceTool>(*p2prng_i, *cr);
|
||||
g_dt = std::make_unique<DiceTool>(*p2prng_i, *cs);
|
||||
|
||||
auto* imguic = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiContext, ImGui::GetVersion());
|
||||
auto* imguimemaf = PLUG_RESOLVE_INSTANCE_VERSIONED(ImGuiMemAllocFunc, ImGui::GetVersion());
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include <solanaceae/plugin/solana_plugin_v1.h>
|
||||
|
||||
#include "./transfer_auto_accept.hpp"
|
||||
#include <solanaceae/util/config_model.hpp>
|
||||
|
||||
#include "./transfer_auto_accept.hpp"
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
#include <entt/fwd.hpp>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user