Compare commits
	
		
			15 Commits
		
	
	
		
			dev-ba7188
			...
			android_co
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 5a2a30ada6 | |||
| 64959270a9 | |||
| 9d6404d130 | |||
| ef4e0d0857 | |||
| 56f1bf559c | |||
| b0e25627b3 | |||
| e7b1eec2cc | |||
| 7a2d7336fb | |||
| fc5023ec1c | |||
| 95eb0eb26d | |||
| d7e658eba6 | |||
| 04191858de | |||
| df449a475c | |||
| 9a95dba138 | |||
| ef79aa8b80 | 
							
								
								
									
										86
									
								
								.github/workflows/cd.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -50,12 +50,91 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    - uses: actions/upload-artifact@v4
 | 
					    - uses: actions/upload-artifact@v4
 | 
				
			||||||
      with:
 | 
					      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 }}-ubuntu20.04-x86_64
 | 
				
			||||||
        # TODO: do propper packing
 | 
					        # TODO: do propper packing
 | 
				
			||||||
        path: |
 | 
					        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 }}-ubuntu20.04-x86_64.tar.gz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  android:
 | 
				
			||||||
 | 
					    timeout-minutes: 30
 | 
				
			||||||
 | 
					    # contains sections copied from sdl repo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    strategy:
 | 
				
			||||||
 | 
					      matrix:
 | 
				
			||||||
 | 
					        platform:
 | 
				
			||||||
 | 
					          - vcpkg_toolkit: arm64-android
 | 
				
			||||||
 | 
					            ndk_abi: arm64-v8a
 | 
				
			||||||
 | 
					          - vcpkg_toolkit: x64-android
 | 
				
			||||||
 | 
					            ndk_abi: x86_64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - uses: actions/checkout@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        submodules: recursive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - uses: nttld/setup-ndk@v1
 | 
				
			||||||
 | 
					      id: setup_ndk
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        local-cache: false # https://github.com/nttld/setup-ndk/issues/518
 | 
				
			||||||
 | 
					        ndk-version: r26d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - uses: actions/setup-java@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        distribution: 'temurin'
 | 
				
			||||||
 | 
					        java-version: '17'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: update vcpkg
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        git clone https://github.com/microsoft/vcpkg.git
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Install Dependencies (host)
 | 
				
			||||||
 | 
					      run: sudo apt update && sudo apt -y install cmake pkg-config nasm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Install Dependencies (target)
 | 
				
			||||||
 | 
					      env:
 | 
				
			||||||
 | 
					        ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
 | 
				
			||||||
 | 
					      run: vcpkg install --triplet ${{matrix.platform.vcpkg_toolkit}} --overlay-ports=vcpkg/ports libsodium opus libvpx libpng libjpeg-turbo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # vcpkg scripts root /usr/local/share/vcpkg/scripts
 | 
				
			||||||
 | 
					    - name: Configure CMake
 | 
				
			||||||
 | 
					      env:
 | 
				
			||||||
 | 
					        ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
 | 
				
			||||||
 | 
					      run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{matrix.platform.vcpkg_toolkit}} -DANDROID=1 -DANDROID_PLATFORM=23 -DANDROID_ABI=${{matrix.platform.ndk_abi}} -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{steps.setup_ndk.outputs.ndk-path}}/build/cmake/android.toolchain.cmake -DSDL3IMAGE_JPG_SHARED=OFF -DSDL3IMAGE_PNG_SHARED=OFF -DTOMATO_MAIN_SO=ON
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Build (tomato)
 | 
				
			||||||
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Build (SDL3-jar) (workaround)
 | 
				
			||||||
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t SDL3-jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Build (apk)
 | 
				
			||||||
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato-apk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - 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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: rename apk
 | 
				
			||||||
 | 
					      id: rename_apk
 | 
				
			||||||
 | 
					      shell: bash
 | 
				
			||||||
 | 
					      run: mv "${{github.workspace}}/build/android/tomato.apk" "${{github.workspace}}/build/android/${{github.event.repository.name}}-${{steps.tag.outputs.name}}-android-${{matrix.platform.ndk_abi}}.apk"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - uses: actions/upload-artifact@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        name: ${{github.event.repository.name}}-${{steps.tag.outputs.name}}-${{runner.os}}-android-${{matrix.platform.ndk_abi}}
 | 
				
			||||||
 | 
					        path: |
 | 
				
			||||||
 | 
					          ${{github.workspace}}/build/android/${{github.event.repository.name}}-${{steps.tag.outputs.name}}-android-${{matrix.platform.ndk_abi}}.apk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  windows:
 | 
					  windows:
 | 
				
			||||||
    timeout-minutes: 15
 | 
					    timeout-minutes: 15
 | 
				
			||||||
@@ -110,8 +189,7 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    - uses: actions/upload-artifact@v4
 | 
					    - uses: actions/upload-artifact@v4
 | 
				
			||||||
      with:
 | 
					      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-x86_64
 | 
					 | 
				
			||||||
        # TODO: do propper packing
 | 
					        # TODO: do propper packing
 | 
				
			||||||
        path: |
 | 
					        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-x86_64.zip
 | 
				
			||||||
@@ -170,7 +248,6 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    - uses: actions/upload-artifact@v4
 | 
					    - uses: actions/upload-artifact@v4
 | 
				
			||||||
      with:
 | 
					      with:
 | 
				
			||||||
        # TODO: simpler name?
 | 
					 | 
				
			||||||
        name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-asan-x86_64
 | 
					        name: ${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}-${{ runner.os }}-msvc-asan-x86_64
 | 
				
			||||||
        # TODO: do propper packing
 | 
					        # TODO: do propper packing
 | 
				
			||||||
        path: |
 | 
					        path: |
 | 
				
			||||||
@@ -183,6 +260,7 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    needs:
 | 
					    needs:
 | 
				
			||||||
      - linux-ubuntu
 | 
					      - linux-ubuntu
 | 
				
			||||||
 | 
					      - android
 | 
				
			||||||
      - windows
 | 
					      - windows
 | 
				
			||||||
      - windows-asan
 | 
					      - windows-asan
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										64
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -29,6 +29,70 @@ jobs:
 | 
				
			|||||||
    - name: Build
 | 
					    - name: Build
 | 
				
			||||||
      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  android:
 | 
				
			||||||
 | 
					    timeout-minutes: 30
 | 
				
			||||||
 | 
					    # contains sections copied from sdl repo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    strategy:
 | 
				
			||||||
 | 
					      matrix:
 | 
				
			||||||
 | 
					        platform:
 | 
				
			||||||
 | 
					          - vcpkg_toolkit: arm64-android
 | 
				
			||||||
 | 
					            ndk_abi: arm64-v8a
 | 
				
			||||||
 | 
					          - vcpkg_toolkit: x64-android
 | 
				
			||||||
 | 
					            ndk_abi: x86_64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - uses: actions/checkout@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        submodules: recursive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - uses: nttld/setup-ndk@v1
 | 
				
			||||||
 | 
					      id: setup_ndk
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        local-cache: false # https://github.com/nttld/setup-ndk/issues/518
 | 
				
			||||||
 | 
					        ndk-version: r26d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - uses: actions/setup-java@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        distribution: 'temurin'
 | 
				
			||||||
 | 
					        java-version: '17'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: update vcpkg
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        git clone https://github.com/microsoft/vcpkg.git
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Install Dependencies (host)
 | 
				
			||||||
 | 
					      run: sudo apt update && sudo apt -y install cmake pkg-config nasm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Install Dependencies (target)
 | 
				
			||||||
 | 
					      env:
 | 
				
			||||||
 | 
					        ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
 | 
				
			||||||
 | 
					      run: vcpkg install --triplet ${{matrix.platform.vcpkg_toolkit}} --overlay-ports=vcpkg/ports libsodium opus libvpx libpng libjpeg-turbo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # vcpkg scripts root /usr/local/share/vcpkg/scripts
 | 
				
			||||||
 | 
					    - name: Configure CMake
 | 
				
			||||||
 | 
					      env:
 | 
				
			||||||
 | 
					        ANDROID_NDK_HOME: ${{steps.setup_ndk.outputs.ndk-path}}
 | 
				
			||||||
 | 
					      run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{matrix.platform.vcpkg_toolkit}} -DANDROID=1 -DANDROID_PLATFORM=23 -DANDROID_ABI=${{matrix.platform.ndk_abi}} -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{steps.setup_ndk.outputs.ndk-path}}/build/cmake/android.toolchain.cmake -DSDL3IMAGE_JPG_SHARED=OFF -DSDL3IMAGE_PNG_SHARED=OFF -DTOMATO_MAIN_SO=ON
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Build (tomato)
 | 
				
			||||||
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Build (SDL3-jar) (workaround)
 | 
				
			||||||
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t SDL3-jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - name: Build (apk)
 | 
				
			||||||
 | 
					      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 -t tomato-apk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - uses: actions/upload-artifact@v4
 | 
				
			||||||
 | 
					      with:
 | 
				
			||||||
 | 
					        name: ${{ github.event.repository.name }}-${{matrix.platform.vcpkg_toolkit}}
 | 
				
			||||||
 | 
					        # TODO: do propper packing
 | 
				
			||||||
 | 
					        path: |
 | 
				
			||||||
 | 
					          ${{github.workspace}}/build/android/tomato.apk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  macos:
 | 
					  macos:
 | 
				
			||||||
    timeout-minutes: 10
 | 
					    timeout-minutes: 10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
 | 
				
			|||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
 | 
					set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
 | 
				
			||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
 | 
					set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					option(TOMATO_MAIN_SO "Build tomato as a shared object (for eg android apps)" ANDROID)
 | 
				
			||||||
option(TOMATO_ASAN "Build tomato with asan (gcc/clang/msvc)" OFF)
 | 
					option(TOMATO_ASAN "Build tomato with asan (gcc/clang/msvc)" OFF)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (TOMATO_ASAN)
 | 
					if (TOMATO_ASAN)
 | 
				
			||||||
@@ -69,3 +70,10 @@ endif()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
add_subdirectory(./src)
 | 
					add_subdirectory(./src)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TODO: move to src
 | 
				
			||||||
 | 
					if (ANDROID AND TARGET SDL3::Jar)
 | 
				
			||||||
 | 
						message("II building for ANDROID!!!")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						add_subdirectory(android)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										100
									
								
								android/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,100 @@
 | 
				
			|||||||
 | 
					cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					project(tomato_android)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# here be dragons
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					list(APPEND CMAKE_MODULE_PATH "${SDL3_SOURCE_DIR}/cmake/android")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					find_package(SdlAndroid MODULE)
 | 
				
			||||||
 | 
					find_package(Java)
 | 
				
			||||||
 | 
					find_package(SdlAndroidPlatform MODULE)
 | 
				
			||||||
 | 
					# the existence of SDL3::Jar usually implies platform
 | 
				
			||||||
 | 
					if(SdlAndroid_FOUND)
 | 
				
			||||||
 | 
						include(SdlAndroidFunctions)
 | 
				
			||||||
 | 
						sdl_create_android_debug_keystore(tomato-debug-keystore)
 | 
				
			||||||
 | 
						sdl_android_compile_resources(tomato-resources RESFOLDER app/res)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set(ANDROID_MANIFEST_PACKAGE "org.libsdl.app.tomato")
 | 
				
			||||||
 | 
						#set(generated_manifest_path "${CMAKE_CURRENT_BINARY_DIR}/android/${TEST}-src/AndroidManifest.xml")
 | 
				
			||||||
 | 
						string(REPLACE "." "/" JAVA_PACKAGE_DIR "${ANDROID_MANIFEST_PACKAGE}")
 | 
				
			||||||
 | 
						#set(GENERATED_SRC_FOLDER "${CMAKE_CURRENT_BINARY_DIR}/android/${TEST}-src")
 | 
				
			||||||
 | 
						#set(GENERATED_RES_FOLDER "${GENERATED_SRC_FOLDER}/res")
 | 
				
			||||||
 | 
						#set(JAVA_PACKAGE_DIR "${GENERATED_SRC_FOLDER}/${JAVA_PACKAGE_DIR}")
 | 
				
			||||||
 | 
						set(JAVA_PACKAGE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/app/java/${JAVA_PACKAGE_DIR}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sdl_android_link_resources(tomato-apk-linked
 | 
				
			||||||
 | 
							MANIFEST "app/AndroidManifest.xml"
 | 
				
			||||||
 | 
							PACKAGE ${ANDROID_MANIFEST_PACKAGE}
 | 
				
			||||||
 | 
							RES_TARGETS tomato-resources
 | 
				
			||||||
 | 
							TARGET_SDK_VERSION 31
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set(CMAKE_JAVA_COMPILE_FLAGS "-encoding;utf-8")
 | 
				
			||||||
 | 
						set(classes_path "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/tomato-java.dir/classes")
 | 
				
			||||||
 | 
						# Some CMake versions have a slow `cmake -E make_directory` implementation
 | 
				
			||||||
 | 
						if(NOT IS_DIRECTORY "${classes_path}")
 | 
				
			||||||
 | 
							execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${classes_path}")
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
						set(OUT_JAR "${CMAKE_CURRENT_BINARY_DIR}/tomato.jar")
 | 
				
			||||||
 | 
						# TODO: convert to cmake's add_jar
 | 
				
			||||||
 | 
						add_custom_command(
 | 
				
			||||||
 | 
							OUTPUT "${OUT_JAR}"
 | 
				
			||||||
 | 
							COMMAND ${CMAKE_COMMAND} -E rm -rf "${classes_path}"
 | 
				
			||||||
 | 
							COMMAND ${CMAKE_COMMAND} -E make_directory "${classes_path}"
 | 
				
			||||||
 | 
							COMMAND ${Java_JAVAC_EXECUTABLE}
 | 
				
			||||||
 | 
								-source 1.8 -target 1.8
 | 
				
			||||||
 | 
								-bootclasspath "$<TARGET_PROPERTY:SDL3::Jar,JAR_FILE>"
 | 
				
			||||||
 | 
								"${JAVA_PACKAGE_DIR}/TomatoActivity.java"
 | 
				
			||||||
 | 
								$<TARGET_PROPERTY:tomato-apk-linked,JAVA_R>
 | 
				
			||||||
 | 
								-cp "$<TARGET_PROPERTY:SDL3::Jar,JAR_FILE>:${SDL_ANDROID_PLATFORM_ANDROID_JAR}"
 | 
				
			||||||
 | 
								-d "${classes_path}"
 | 
				
			||||||
 | 
							COMMAND ${Java_JAR_EXECUTABLE} cf "${OUT_JAR}" -C "${classes_path}" .
 | 
				
			||||||
 | 
							DEPENDS $<TARGET_PROPERTY:tomato-apk-linked,OUTPUTS> "$<TARGET_PROPERTY:SDL3::Jar,JAR_FILE>"
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						add_custom_target(tomato-jar DEPENDS "${OUT_JAR}")
 | 
				
			||||||
 | 
						add_dependencies(tomato-jar SDL3::Jar) # HACK: somehow their jar is not registered as an output
 | 
				
			||||||
 | 
						set_property(TARGET tomato-jar PROPERTY OUTPUT "${OUT_JAR}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						set(dexworkdir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/tomato-dex.dir")
 | 
				
			||||||
 | 
						# Some CMake versions have a slow `cmake -E make_directory` implementation
 | 
				
			||||||
 | 
						if(NOT IS_DIRECTORY "${dexworkdir}")
 | 
				
			||||||
 | 
							execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${dexworkdir}")
 | 
				
			||||||
 | 
						endif()
 | 
				
			||||||
 | 
						set(classes_dex_base_name "classes.dex")
 | 
				
			||||||
 | 
						set(classes_dex "${dexworkdir}/${classes_dex_base_name}")
 | 
				
			||||||
 | 
						add_custom_command(
 | 
				
			||||||
 | 
							OUTPUT "${classes_dex}"
 | 
				
			||||||
 | 
							COMMAND SdlAndroid::d8
 | 
				
			||||||
 | 
								$<TARGET_PROPERTY:tomato-jar,OUTPUT>
 | 
				
			||||||
 | 
								$<TARGET_PROPERTY:SDL3::Jar,JAR_FILE>
 | 
				
			||||||
 | 
								--lib "${SDL_ANDROID_PLATFORM_ANDROID_JAR}"
 | 
				
			||||||
 | 
								--output "${dexworkdir}"
 | 
				
			||||||
 | 
							DEPENDS $<TARGET_PROPERTY:tomato-jar,OUTPUT> $<TARGET_PROPERTY:SDL3::Jar,JAR_FILE>
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						add_custom_target(tomato-dex DEPENDS "${classes_dex}")
 | 
				
			||||||
 | 
						set_property(TARGET tomato-dex PROPERTY OUTPUT "${classes_dex}")
 | 
				
			||||||
 | 
						set_property(TARGET tomato-dex PROPERTY OUTPUT_BASE_NAME "${classes_dex_base_name}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# file(GLOB RESOURCE_FILES *.bmp *.wav *.hex moose.dat utf8.txt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sdl_add_to_apk_unaligned(tomato-unaligned-apk
 | 
				
			||||||
 | 
							APK_IN tomato-apk-linked
 | 
				
			||||||
 | 
							OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/intermediates"
 | 
				
			||||||
 | 
							#ASSETS ${RESOURCE_FILES}
 | 
				
			||||||
 | 
							#NATIVE_LIBS SDL3::SDL3-shared tomato
 | 
				
			||||||
 | 
							NATIVE_LIBS tomato
 | 
				
			||||||
 | 
							DEX tomato-dex
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						sdl_apk_align(tomato-aligned-apk tomato-unaligned-apk
 | 
				
			||||||
 | 
							OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/intermediates"
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						sdl_apk_sign(tomato-apk tomato-aligned-apk
 | 
				
			||||||
 | 
							KEYSTORE tomato-debug-keystore
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					else()
 | 
				
			||||||
 | 
						message("EE SdlAndroid module not found")
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										109
									
								
								android/app/AndroidManifest.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,109 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<!-- Replace com.test.game with the identifier of your game below, e.g.
 | 
				
			||||||
 | 
					     com.gamemaker.game
 | 
				
			||||||
 | 
					-->
 | 
				
			||||||
 | 
					<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
 | 
						package="org.libsdl.app.tomato"
 | 
				
			||||||
 | 
					    android:versionCode="1"
 | 
				
			||||||
 | 
					    android:versionName="1.0"
 | 
				
			||||||
 | 
						android:installLocation="auto">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- OpenGL ES 2.0 -->
 | 
				
			||||||
 | 
					    <uses-feature android:glEsVersion="0x00020000" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Touchscreen support -->
 | 
				
			||||||
 | 
					    <uses-feature
 | 
				
			||||||
 | 
					        android:name="android.hardware.touchscreen"
 | 
				
			||||||
 | 
					        android:required="false" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Game controller support -->
 | 
				
			||||||
 | 
					    <uses-feature
 | 
				
			||||||
 | 
					        android:name="android.hardware.bluetooth"
 | 
				
			||||||
 | 
					        android:required="false" />
 | 
				
			||||||
 | 
					    <uses-feature
 | 
				
			||||||
 | 
					        android:name="android.hardware.gamepad"
 | 
				
			||||||
 | 
					        android:required="false" />
 | 
				
			||||||
 | 
					    <uses-feature
 | 
				
			||||||
 | 
					        android:name="android.hardware.usb.host"
 | 
				
			||||||
 | 
					        android:required="false" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- External mouse input events -->
 | 
				
			||||||
 | 
					    <uses-feature
 | 
				
			||||||
 | 
					        android:name="android.hardware.type.pc"
 | 
				
			||||||
 | 
					        android:required="false" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Audio recording support -->
 | 
				
			||||||
 | 
					    <!-- if you want to capture audio, uncomment this. -->
 | 
				
			||||||
 | 
					    <!-- <uses-feature
 | 
				
			||||||
 | 
					        android:name="android.hardware.microphone"
 | 
				
			||||||
 | 
					        android:required="false" /> -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Camera support -->
 | 
				
			||||||
 | 
					    <!-- if you want to record video, uncomment this. -->
 | 
				
			||||||
 | 
					    <!--
 | 
				
			||||||
 | 
					    <uses-permission android:name="android.permission.CAMERA" />
 | 
				
			||||||
 | 
					    <uses-feature android:name="android.hardware.camera" />
 | 
				
			||||||
 | 
					    -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						<uses-permission android:name="android.permission.INTERNET" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Allow downloading to the external storage on Android 5.1 and older -->
 | 
				
			||||||
 | 
					    <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="22" /> -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Allow access to Bluetooth devices -->
 | 
				
			||||||
 | 
					    <!-- Currently this is just for Steam Controller support and requires setting SDL_HINT_JOYSTICK_HIDAPI_STEAM -->
 | 
				
			||||||
 | 
					    <!-- <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" /> -->
 | 
				
			||||||
 | 
					    <!-- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Allow access to the vibrator -->
 | 
				
			||||||
 | 
					    <uses-permission android:name="android.permission.VIBRATE" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- if you want to capture audio, uncomment this. -->
 | 
				
			||||||
 | 
					    <!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Create a Java class extending SDLActivity and place it in a
 | 
				
			||||||
 | 
					         directory under app/src/main/java matching the package, e.g. app/src/main/java/com/gamemaker/game/MyGame.java
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					         then replace "SDLActivity" with the name of your class (e.g. "MyGame")
 | 
				
			||||||
 | 
					         in the XML below.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					         An example Java class can be found in README-android.md
 | 
				
			||||||
 | 
					    -->
 | 
				
			||||||
 | 
					    <application android:label="@string/app_name"
 | 
				
			||||||
 | 
					        android:icon="@mipmap/ic_launcher"
 | 
				
			||||||
 | 
							android:appCategory="social"
 | 
				
			||||||
 | 
					        android:allowBackup="true"
 | 
				
			||||||
 | 
					        android:theme="@style/AppTheme"
 | 
				
			||||||
 | 
					        android:hardwareAccelerated="true" >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<!-- setting sdl hints. uses the string value -->
 | 
				
			||||||
 | 
							<meta-data android:name="SDL_ENV.SDL_ANDROID_BLOCK_ON_PAUSE" android:value="0"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <activity android:name="TomatoActivity"
 | 
				
			||||||
 | 
					            android:label="@string/app_name"
 | 
				
			||||||
 | 
					            android:alwaysRetainTaskState="true"
 | 
				
			||||||
 | 
					            android:launchMode="singleInstance"
 | 
				
			||||||
 | 
					            android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
 | 
				
			||||||
 | 
					            android:preferMinimalPostProcessing="true"
 | 
				
			||||||
 | 
					            android:exported="true"
 | 
				
			||||||
 | 
					            >
 | 
				
			||||||
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					                <action android:name="android.intent.action.MAIN" />
 | 
				
			||||||
 | 
					                <category android:name="android.intent.category.LAUNCHER" />
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					            <!-- Let Android know that we can handle some USB devices and should receive this event -->
 | 
				
			||||||
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					            <!-- Drop file event -->
 | 
				
			||||||
 | 
					            <!--
 | 
				
			||||||
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					                <action android:name="android.intent.action.VIEW" />
 | 
				
			||||||
 | 
					                <category android:name="android.intent.category.DEFAULT" />
 | 
				
			||||||
 | 
					                <data android:mimeType="*/*" />
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					            -->
 | 
				
			||||||
 | 
					        </activity>
 | 
				
			||||||
 | 
					    </application>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</manifest>
 | 
				
			||||||
							
								
								
									
										18
									
								
								android/app/java/org/libsdl/app/tomato/TomatoActivity.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					package org.libsdl.app.tomato;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.libsdl.app.SDLActivity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class TomatoActivity extends SDLActivity {
 | 
				
			||||||
 | 
						protected String[] getLibraries() {
 | 
				
			||||||
 | 
							return new String[] {
 | 
				
			||||||
 | 
								// "SDL3", // we link statically
 | 
				
			||||||
 | 
								// "SDL3_image",
 | 
				
			||||||
 | 
								// "SDL3_mixer",
 | 
				
			||||||
 | 
								// "SDL3_net",
 | 
				
			||||||
 | 
								// "SDL3_ttf",
 | 
				
			||||||
 | 
								// "main"
 | 
				
			||||||
 | 
								"tomato"
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								android/app/play_store_512.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 94 KiB  | 
							
								
								
									
										6
									
								
								android/app/res/mipmap-anydpi-v26/ic_launcher.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
 | 
				
			||||||
 | 
					  <background android:drawable="@mipmap/ic_launcher_background"/>
 | 
				
			||||||
 | 
					  <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
 | 
				
			||||||
 | 
					  <monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
 | 
				
			||||||
 | 
					</adaptive-icon>
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-hdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 6.6 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-hdpi/ic_launcher_background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 6.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-hdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 7.1 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-hdpi/ic_launcher_monochrome.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 4.7 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-mdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 3.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-mdpi/ic_launcher_background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 3.6 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-mdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 3.9 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-mdpi/ic_launcher_monochrome.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 2.8 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 9.7 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xhdpi/ic_launcher_background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 11 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xhdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 9.9 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xhdpi/ic_launcher_monochrome.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 6.5 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 18 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxhdpi/ic_launcher_background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 21 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxhdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 16 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxhdpi/ic_launcher_monochrome.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 11 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxxhdpi/ic_launcher.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 28 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxxhdpi/ic_launcher_background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 41 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxxhdpi/ic_launcher_foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 24 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								android/app/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 15 KiB  | 
							
								
								
									
										6
									
								
								android/app/res/values/colors.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
 | 
					<resources>
 | 
				
			||||||
 | 
					    <color name="colorPrimary">#3F51B5</color>
 | 
				
			||||||
 | 
					    <color name="colorPrimaryDark">#303F9F</color>
 | 
				
			||||||
 | 
					    <color name="colorAccent">#FF4081</color>
 | 
				
			||||||
 | 
					</resources>
 | 
				
			||||||
							
								
								
									
										3
									
								
								android/app/res/values/strings.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					<resources>
 | 
				
			||||||
 | 
					    <string name="app_name">Tomato</string>
 | 
				
			||||||
 | 
					</resources>
 | 
				
			||||||
							
								
								
									
										10
									
								
								android/app/res/values/styles.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					<resources>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Base application theme. -->
 | 
				
			||||||
 | 
						<!-- <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> -->
 | 
				
			||||||
 | 
						<!--<style name="AppTheme" parent="android:Theme.AppCompat">-->
 | 
				
			||||||
 | 
						<style name="AppTheme" parent="android:Theme">
 | 
				
			||||||
 | 
					        <!-- Customize your theme here. -->
 | 
				
			||||||
 | 
					    </style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</resources>
 | 
				
			||||||
							
								
								
									
										2
									
								
								external/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.14...3.24 FATAL_ERROR)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
add_subdirectory(./entt)
 | 
					add_subdirectory(./entt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_subdirectory(./json)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_subdirectory(./solanaceae_util)
 | 
					add_subdirectory(./solanaceae_util)
 | 
				
			||||||
add_subdirectory(./solanaceae_contact)
 | 
					add_subdirectory(./solanaceae_contact)
 | 
				
			||||||
add_subdirectory(./solanaceae_message3)
 | 
					add_subdirectory(./solanaceae_message3)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								external/json/CMakeLists.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					cmake_minimum_required(VERSION 3.16...3.24 FATAL_ERROR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					include(FetchContent)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (NOT TARGET nlohmann_json::nlohmann_json)
 | 
				
			||||||
 | 
						FetchContent_Declare(json
 | 
				
			||||||
 | 
							URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
 | 
				
			||||||
 | 
							URL_HASH SHA256=d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d
 | 
				
			||||||
 | 
							EXCLUDE_FROM_ALL
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						FetchContent_MakeAvailable(json)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								external/sdl/CMakeLists.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -6,6 +6,7 @@ if (NOT TARGET SDL3::SDL3)
 | 
				
			|||||||
	set(SDL_SHARED OFF CACHE INTERNAL "")
 | 
						set(SDL_SHARED OFF CACHE INTERNAL "")
 | 
				
			||||||
	set(SDL_STATIC ON CACHE INTERNAL "")
 | 
						set(SDL_STATIC ON CACHE INTERNAL "")
 | 
				
			||||||
	#TODO: pic ?
 | 
						#TODO: pic ?
 | 
				
			||||||
 | 
						set(SDL_DISABLE_ANDROID_JAR OFF CACHE INTERNAL "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FetchContent_Declare(SDL3
 | 
						FetchContent_Declare(SDL3
 | 
				
			||||||
		GIT_REPOSITORY https://github.com/libsdl-org/SDL
 | 
							GIT_REPOSITORY https://github.com/libsdl-org/SDL
 | 
				
			||||||
@@ -16,6 +17,7 @@ if (NOT TARGET SDL3::SDL3)
 | 
				
			|||||||
		#GIT_TAG 1103294d33f47ab4c697bb22a9cf27c79c658630 # tip 15-05-2024
 | 
							#GIT_TAG 1103294d33f47ab4c697bb22a9cf27c79c658630 # tip 15-05-2024
 | 
				
			||||||
		#GIT_TAG aacafd62336363077470f678b6217214b3b49473 # tip 28-05-2024
 | 
							#GIT_TAG aacafd62336363077470f678b6217214b3b49473 # tip 28-05-2024
 | 
				
			||||||
		GIT_TAG 5fa9432b7d1c1722de93e1ab46e7a9569a47071e # tip 27-05-2024 - before changes made breaking sdl_image
 | 
							GIT_TAG 5fa9432b7d1c1722de93e1ab46e7a9569a47071e # tip 27-05-2024 - before changes made breaking sdl_image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		FIND_PACKAGE_ARGS # for the future
 | 
							FIND_PACKAGE_ARGS # for the future
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
	FetchContent_MakeAvailable(SDL3)
 | 
						FetchContent_MakeAvailable(SDL3)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								external/solanaceae_plugin
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						@@ -1,11 +1,21 @@
 | 
				
			|||||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
 | 
					cmake_minimum_required(VERSION 3.9...3.24 FATAL_ERROR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
########################################
 | 
					########################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_executable(tomato
 | 
					if (TOMATO_MAIN_SO)
 | 
				
			||||||
 | 
						add_library(tomato MODULE)
 | 
				
			||||||
 | 
						target_compile_definitions(tomato PUBLIC TOMATO_MAIN_SO)
 | 
				
			||||||
 | 
					else()
 | 
				
			||||||
 | 
						add_executable(tomato)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target_sources(tomato PUBLIC
 | 
				
			||||||
	./main.cpp
 | 
						./main.cpp
 | 
				
			||||||
	./icon.rc
 | 
						./icon.rc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						./json_to_config.hpp
 | 
				
			||||||
 | 
						./json_to_config.cpp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	./screen.hpp
 | 
						./screen.hpp
 | 
				
			||||||
	./start_screen.hpp
 | 
						./start_screen.hpp
 | 
				
			||||||
	./start_screen.cpp
 | 
						./start_screen.cpp
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										67
									
								
								src/json_to_config.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,67 @@
 | 
				
			|||||||
 | 
					#include "./json_to_config.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <solanaceae/util/simple_config_model.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nlohmann/json.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool load_json_into_config(const nlohmann::ordered_json& config_json, SimpleConfigModel& conf) {
 | 
				
			||||||
 | 
						if (!config_json.is_object()) {
 | 
				
			||||||
 | 
							std::cerr << "TOMATO error: config file is not an json object!!!\n";
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for (const auto& [mod, cats] : config_json.items()) {
 | 
				
			||||||
 | 
							for (const auto& [cat, cat_v] : cats.items()) {
 | 
				
			||||||
 | 
								if (cat_v.is_object()) {
 | 
				
			||||||
 | 
									if (cat_v.contains("default")) {
 | 
				
			||||||
 | 
										const auto& value = cat_v["default"];
 | 
				
			||||||
 | 
										if (value.is_string()) {
 | 
				
			||||||
 | 
											conf.set(mod, cat, value.get_ref<const std::string&>());
 | 
				
			||||||
 | 
										} else if (value.is_boolean()) {
 | 
				
			||||||
 | 
											conf.set(mod, cat, value.get_ref<const bool&>());
 | 
				
			||||||
 | 
										} else if (value.is_number_float()) {
 | 
				
			||||||
 | 
											conf.set(mod, cat, value.get_ref<const double&>());
 | 
				
			||||||
 | 
										} else if (value.is_number_integer()) {
 | 
				
			||||||
 | 
											conf.set(mod, cat, value.get_ref<const int64_t&>());
 | 
				
			||||||
 | 
										} else {
 | 
				
			||||||
 | 
											std::cerr << "JSON error: wrong value type in " << mod << "::" << cat << " = " << value << "\n";
 | 
				
			||||||
 | 
											return false;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if (cat_v.contains("entries")) {
 | 
				
			||||||
 | 
										for (const auto& [ent, ent_v] : cat_v["entries"].items()) {
 | 
				
			||||||
 | 
											if (ent_v.is_string()) {
 | 
				
			||||||
 | 
												conf.set(mod, cat, ent, ent_v.get_ref<const std::string&>());
 | 
				
			||||||
 | 
											} else if (ent_v.is_boolean()) {
 | 
				
			||||||
 | 
												conf.set(mod, cat, ent, ent_v.get_ref<const bool&>());
 | 
				
			||||||
 | 
											} else if (ent_v.is_number_float()) {
 | 
				
			||||||
 | 
												conf.set(mod, cat, ent, ent_v.get_ref<const double&>());
 | 
				
			||||||
 | 
											} else if (ent_v.is_number_integer()) {
 | 
				
			||||||
 | 
												conf.set(mod, cat, ent, ent_v.get_ref<const int64_t&>());
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												std::cerr << "JSON error: wrong value type in " << mod << "::" << cat << "::" << ent << " = " << ent_v << "\n";
 | 
				
			||||||
 | 
												return false;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									if (cat_v.is_string()) {
 | 
				
			||||||
 | 
										conf.set(mod, cat, cat_v.get_ref<const std::string&>());
 | 
				
			||||||
 | 
									} else if (cat_v.is_boolean()) {
 | 
				
			||||||
 | 
										conf.set(mod, cat, cat_v.get_ref<const bool&>());
 | 
				
			||||||
 | 
									} else if (cat_v.is_number_float()) {
 | 
				
			||||||
 | 
										conf.set(mod, cat, cat_v.get_ref<const double&>());
 | 
				
			||||||
 | 
									} else if (cat_v.is_number_integer()) {
 | 
				
			||||||
 | 
										conf.set(mod, cat, cat_v.get_ref<const int64_t&>());
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
 | 
										std::cerr << "JSON error: wrong value type in " << mod << "::" << cat << " = " << cat_v << "\n";
 | 
				
			||||||
 | 
										return false;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										9
									
								
								src/json_to_config.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nlohmann/json_fwd.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// fwd
 | 
				
			||||||
 | 
					struct SimpleConfigModel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool load_json_into_config(const nlohmann::ordered_json& config_json, SimpleConfigModel& conf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										27
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						@@ -10,16 +10,31 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "./start_screen.hpp"
 | 
					#include "./start_screen.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <filesystem>
 | 
				
			||||||
#include <memory>
 | 
					#include <memory>
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <string_view>
 | 
				
			||||||
#include <thread>
 | 
					#include <thread>
 | 
				
			||||||
#include <chrono>
 | 
					#include <chrono>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char** argv) {
 | 
					int main(int argc, char** argv) {
 | 
				
			||||||
 | 
						// better args
 | 
				
			||||||
 | 
						std::vector<std::string_view> args;
 | 
				
			||||||
 | 
						for (int i = 0; i < argc; i++) {
 | 
				
			||||||
 | 
							args.push_back(argv[i]);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __ANDROID__
 | 
				
			||||||
 | 
						// change current working dir to internal storage
 | 
				
			||||||
 | 
						std::filesystem::current_path(SDL_AndroidGetInternalStoragePath());
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// setup hints
 | 
						// setup hints
 | 
				
			||||||
 | 
					#ifndef __ANDROID__
 | 
				
			||||||
	if (SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1") != SDL_TRUE) {
 | 
						if (SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1") != SDL_TRUE) {
 | 
				
			||||||
		std::cerr << "Failed to set '" << SDL_HINT_VIDEO_ALLOW_SCREENSAVER << "' to 1\n";
 | 
							std::cerr << "Failed to set '" << SDL_HINT_VIDEO_ALLOW_SCREENSAVER << "' to 1\n";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto last_time_render = std::chrono::steady_clock::now();
 | 
						auto last_time_render = std::chrono::steady_clock::now();
 | 
				
			||||||
	auto last_time_tick = std::chrono::steady_clock::now();
 | 
						auto last_time_tick = std::chrono::steady_clock::now();
 | 
				
			||||||
@@ -91,9 +106,9 @@ int main(int argc, char** argv) {
 | 
				
			|||||||
	ImGui_ImplSDL3_InitForSDLRenderer(window.get(), renderer.get());
 | 
						ImGui_ImplSDL3_InitForSDLRenderer(window.get(), renderer.get());
 | 
				
			||||||
	ImGui_ImplSDLRenderer3_Init(renderer.get());
 | 
						ImGui_ImplSDLRenderer3_Init(renderer.get());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::unique_ptr<Screen> screen = std::make_unique<StartScreen>(renderer.get(), theme);
 | 
						std::unique_ptr<Screen> screen = std::make_unique<StartScreen>(args, renderer.get(), theme);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bool is_background = false;
 | 
				
			||||||
	bool quit = false;
 | 
						bool quit = false;
 | 
				
			||||||
	while (!quit) {
 | 
						while (!quit) {
 | 
				
			||||||
		auto new_time = std::chrono::steady_clock::now();
 | 
							auto new_time = std::chrono::steady_clock::now();
 | 
				
			||||||
@@ -118,6 +133,10 @@ int main(int argc, char** argv) {
 | 
				
			|||||||
			if (event.type == SDL_EVENT_QUIT) {
 | 
								if (event.type == SDL_EVENT_QUIT) {
 | 
				
			||||||
				quit = true;
 | 
									quit = true;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
 | 
								} else if (event.type == SDL_EVENT_WILL_ENTER_BACKGROUND) {
 | 
				
			||||||
 | 
									is_background = true;
 | 
				
			||||||
 | 
								} else if (event.type == SDL_EVENT_DID_ENTER_FOREGROUND) {
 | 
				
			||||||
 | 
									is_background = false;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (screen->handleEvent(event)) {
 | 
								if (screen->handleEvent(event)) {
 | 
				
			||||||
@@ -130,6 +149,10 @@ int main(int argc, char** argv) {
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (is_background) {
 | 
				
			||||||
 | 
								render = false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// can do both in the same loop
 | 
							// can do both in the same loop
 | 
				
			||||||
		if (render) {
 | 
							if (render) {
 | 
				
			||||||
			ImGui_ImplSDLRenderer3_NewFrame();
 | 
								ImGui_ImplSDLRenderer3_NewFrame();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,8 +12,9 @@
 | 
				
			|||||||
#include <memory>
 | 
					#include <memory>
 | 
				
			||||||
#include <cmath>
 | 
					#include <cmath>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MainScreen::MainScreen(SDL_Renderer* renderer_, Theme& theme_, std::string save_path, std::string save_password, std::string new_username, std::vector<std::string> plugins) :
 | 
					MainScreen::MainScreen(SimpleConfigModel&& conf_, SDL_Renderer* renderer_, Theme& theme_, std::string save_path, std::string save_password, std::string new_username, std::vector<std::string> plugins) :
 | 
				
			||||||
	renderer(renderer_),
 | 
						renderer(renderer_),
 | 
				
			||||||
 | 
						conf(std::move(conf_)),
 | 
				
			||||||
	rmm(cr),
 | 
						rmm(cr),
 | 
				
			||||||
	msnj{cr, {}, {}},
 | 
						msnj{cr, {}, {}},
 | 
				
			||||||
	mts(rmm),
 | 
						mts(rmm),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,7 +91,7 @@ struct MainScreen final : public Screen {
 | 
				
			|||||||
	uint64_t _window_hidden_ts {0};
 | 
						uint64_t _window_hidden_ts {0};
 | 
				
			||||||
	float _time_since_event {0.f};
 | 
						float _time_since_event {0.f};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	MainScreen(SDL_Renderer* renderer_, Theme& theme_, std::string save_path, std::string save_password, std::string new_username, std::vector<std::string> plugins);
 | 
						MainScreen(SimpleConfigModel&& conf_, SDL_Renderer* renderer_, Theme& theme_, std::string save_path, std::string save_password, std::string new_username, std::vector<std::string> plugins);
 | 
				
			||||||
	~MainScreen(void);
 | 
						~MainScreen(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool handleEvent(SDL_Event& e) override;
 | 
						bool handleEvent(SDL_Event& e) override;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,11 @@ uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t wi
 | 
				
			|||||||
	// TODO: error reporting
 | 
						// TODO: error reporting
 | 
				
			||||||
	SDL_UpdateTexture(tex, nullptr, surf->pixels, surf->pitch);
 | 
						SDL_UpdateTexture(tex, nullptr, surf->pixels, surf->pitch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						SDL_BlendMode surf_blend_mode = SDL_BLENDMODE_NONE;
 | 
				
			||||||
 | 
						if (SDL_GetSurfaceBlendMode(surf, &surf_blend_mode) == 0) {
 | 
				
			||||||
 | 
							SDL_SetTextureBlendMode(tex, surf_blend_mode);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (filter == NEAREST) {
 | 
						if (filter == NEAREST) {
 | 
				
			||||||
		SDL_SetTextureScaleMode(tex, SDL_SCALEMODE_NEAREST);
 | 
							SDL_SetTextureScaleMode(tex, SDL_SCALEMODE_NEAREST);
 | 
				
			||||||
	} else if (filter == LINEAR) {
 | 
						} else if (filter == LINEAR) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,14 +2,54 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "./main_screen.hpp"
 | 
					#include "./main_screen.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./json_to_config.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <nlohmann/json.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <imgui/imgui.h>
 | 
					#include <imgui/imgui.h>
 | 
				
			||||||
#include <imgui/misc/cpp/imgui_stdlib.h>
 | 
					#include <imgui/misc/cpp/imgui_stdlib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <cctype>
 | 
					#include <cctype>
 | 
				
			||||||
#include <memory>
 | 
					#include <memory>
 | 
				
			||||||
#include <filesystem>
 | 
					#include <filesystem>
 | 
				
			||||||
 | 
					#include <fstream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					StartScreen::StartScreen(const std::vector<std::string_view>& args, SDL_Renderer* renderer, Theme& theme) : _renderer(renderer), _theme(theme) {
 | 
				
			||||||
 | 
						for (size_t ai = 1; ai < args.size(); ai++) {
 | 
				
			||||||
 | 
							if (args.at(ai) == "--config" || args.at(ai) == "-c") {
 | 
				
			||||||
 | 
								if (args.size() == ai+1) {
 | 
				
			||||||
 | 
									std::cerr << "TOMATO error: argument '" << args.at(ai) << "' missing parameter!\n";
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								ai++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const auto& config_path = args.at(ai);
 | 
				
			||||||
 | 
								auto config_file = std::ifstream(static_cast<std::string>(config_path));
 | 
				
			||||||
 | 
								if (!config_file.is_open()) {
 | 
				
			||||||
 | 
									std::cerr << "TOMATO error: failed to open config file '" << config_path << "'\n";
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								auto config_json = nlohmann::ordered_json::parse(config_file);
 | 
				
			||||||
 | 
								if (!load_json_into_config(config_json, _conf)) {
 | 
				
			||||||
 | 
									std::cerr << "TOMATO error in config json, exiting...\n";
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							} else if (args.at(ai) == "--plugin" || args.at(ai) == "-p") {
 | 
				
			||||||
 | 
								if (args.size() == ai+1) {
 | 
				
			||||||
 | 
									std::cerr << "TOMATO error: argument '" << args.at(ai) << "' missing parameter!\n";
 | 
				
			||||||
 | 
									break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								ai++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const auto& plugin_path = args.at(ai);
 | 
				
			||||||
 | 
								// TODO: check for dups
 | 
				
			||||||
 | 
								queued_plugin_paths.push_back(static_cast<std::string>(plugin_path));
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								std::cerr << "TOMATO error: unknown cli arg: '" << args.at(ai) << "'\n";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
StartScreen::StartScreen(SDL_Renderer* renderer, Theme& theme) : _renderer(renderer), _theme(theme) {
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Screen* StartScreen::render(float, bool&) {
 | 
					Screen* StartScreen::render(float, bool&) {
 | 
				
			||||||
@@ -143,7 +183,8 @@ Screen* StartScreen::render(float, bool&) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (ImGui::Button("load", {60, 25})) {
 | 
							if (ImGui::Button("load", {60, 25})) {
 | 
				
			||||||
			auto new_screen = std::make_unique<MainScreen>(_renderer, _theme, _tox_profile_path, _password, _user_name, queued_plugin_paths);
 | 
					
 | 
				
			||||||
 | 
								auto new_screen = std::make_unique<MainScreen>(std::move(_conf), _renderer, _theme, _tox_profile_path, _password, _user_name, queued_plugin_paths);
 | 
				
			||||||
			return new_screen.release();
 | 
								return new_screen.release();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,8 @@
 | 
				
			|||||||
#include "./chat_gui/theme.hpp"
 | 
					#include "./chat_gui/theme.hpp"
 | 
				
			||||||
#include "./chat_gui/file_selector.hpp"
 | 
					#include "./chat_gui/file_selector.hpp"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <solanaceae/util/simple_config_model.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -16,6 +18,7 @@ extern "C" {
 | 
				
			|||||||
struct StartScreen final : public Screen {
 | 
					struct StartScreen final : public Screen {
 | 
				
			||||||
	SDL_Renderer* _renderer;
 | 
						SDL_Renderer* _renderer;
 | 
				
			||||||
	Theme& _theme;
 | 
						Theme& _theme;
 | 
				
			||||||
 | 
						SimpleConfigModel _conf;
 | 
				
			||||||
	FileSelector _fss;
 | 
						FileSelector _fss;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool _new_save {false};
 | 
						bool _new_save {false};
 | 
				
			||||||
@@ -28,7 +31,7 @@ struct StartScreen final : public Screen {
 | 
				
			|||||||
	std::vector<std::string> queued_plugin_paths;
 | 
						std::vector<std::string> queued_plugin_paths;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	StartScreen(void) = delete;
 | 
						StartScreen(void) = delete;
 | 
				
			||||||
	StartScreen(SDL_Renderer* renderer, Theme& theme);
 | 
						StartScreen(const std::vector<std::string_view>& args, SDL_Renderer* renderer, Theme& theme);
 | 
				
			||||||
	~StartScreen(void) = default;
 | 
						~StartScreen(void) = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// return nullptr if not next
 | 
						// return nullptr if not next
 | 
				
			||||||
 
 | 
				
			|||||||