mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Compare commits
151
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93b2c73e0c | ||
|
|
0c05c3e87f | ||
|
|
a08958f3b6 | ||
|
|
e4bacd8262 | ||
|
|
6026d2ad96 | ||
|
|
35d7ad6414 | ||
|
|
99a5db20eb | ||
|
|
fa6f834974 | ||
|
|
2b619cfcfb | ||
|
|
c8fe2428a0 | ||
|
|
32795e1e25 | ||
|
|
317e207948 | ||
|
|
da7af728a9 | ||
|
|
bc2b573053 | ||
|
|
25ea6ddf47 | ||
|
|
be23c47cac | ||
|
|
80ea25b10f | ||
|
|
cc10f93030 | ||
|
|
75223fcf36 | ||
|
|
882c840ae6 | ||
|
|
0037544a00 | ||
|
|
1485d0e315 | ||
|
|
81c0e4a465 | ||
|
|
d0eac6f470 | ||
|
|
3678a0e474 | ||
|
|
f0effa0f31 | ||
|
|
dceec9e20a | ||
|
|
c1fc52d169 | ||
|
|
52d73c2f3e | ||
|
|
d5d686c3bf | ||
|
|
3e8d56c022 | ||
|
|
972e655a9b | ||
|
|
5e129a87cb | ||
|
|
73c864f196 | ||
|
|
655dd1ca2f | ||
|
|
15e64c48e3 | ||
|
|
87315d3457 | ||
|
|
c2fb43ca96 | ||
|
|
89bdaad188 | ||
|
|
527ac0e575 | ||
|
|
8e38264c10 | ||
|
|
912a4af5b4 | ||
|
|
1e15f337ec | ||
|
|
df40605042 | ||
|
|
691974bc96 | ||
|
|
860966a946 | ||
|
|
4c929264fe | ||
|
|
14a29617fe | ||
|
|
92f7342fbd | ||
|
|
30a1221067 | ||
|
|
9dbc01db13 | ||
|
|
987cb7799b | ||
|
|
3f5d6eda66 | ||
|
|
aae6313fdb | ||
|
|
7e4a0a5264 | ||
|
|
7be7cf46d1 | ||
|
|
bb10cfbf62 | ||
|
|
bab67d7df0 | ||
|
|
e05d07b426 | ||
|
|
b50880e7d4 | ||
|
|
f1dec91ae1 | ||
|
|
8a4b99b3e1 | ||
|
|
fb03e66041 | ||
|
|
9760bafb8a | ||
|
|
b4c70f09d5 | ||
|
|
3c916747af | ||
|
|
275a46f97f | ||
|
|
610cced493 | ||
|
|
36157ae5e7 | ||
|
|
00a5c44464 | ||
|
|
f5cf6b7ca6 | ||
|
|
47f4c6b79e | ||
|
|
748070bc12 | ||
|
|
179bf2c145 | ||
|
|
8e666d32d0 | ||
|
|
47091d836b | ||
|
|
fda05a5a00 | ||
|
|
036551aab7 | ||
|
|
80543ba2c6 | ||
|
|
99e908c708 | ||
|
|
aca4534108 | ||
|
|
3ef1f7cca9 | ||
|
|
e3aaa58cc8 | ||
|
|
a6f09536c6 | ||
|
|
e83359b9d8 | ||
|
|
85deb01568 | ||
|
|
67e171c48e | ||
|
|
7cf80d26e2 | ||
|
|
fb87aa7261 | ||
|
|
26f5d8dfab | ||
|
|
ddc29f1206 | ||
|
|
5da49b59eb | ||
|
|
14fb7c8a2a | ||
|
|
29841a3fb2 | ||
|
|
8006ec36ef | ||
|
|
5a4e27e702 | ||
|
|
f60abeddcd | ||
|
|
3c8fe805b8 | ||
|
|
479e7c427a | ||
|
|
b1fef19a63 | ||
|
|
785a37e503 | ||
|
|
12e7f9956c | ||
|
|
a03ce9a746 | ||
|
|
05f3444207 | ||
|
|
6aed5dde46 | ||
|
|
be77df52b9 | ||
|
|
e315a7ecb0 | ||
|
|
c0147f0c2e | ||
|
|
466f03febc | ||
|
|
8b265a9843 | ||
|
|
8193ebf7d4 | ||
|
|
3590ad9099 | ||
|
|
97e39e37fc | ||
|
|
d8bccfe32f | ||
|
|
6a63eb8871 | ||
|
|
cb619b143d | ||
|
|
5d96191e00 | ||
|
|
e9ac89da14 | ||
|
|
9dae9461ad | ||
|
|
8e834e6c6e | ||
|
|
8fffefedcc | ||
|
|
9ef079cdf8 | ||
|
|
ac175bcc62 | ||
|
|
f59f4af582 | ||
|
|
e0dd7f3bf9 | ||
|
|
5b07df5f29 | ||
|
|
b5d237e40e | ||
|
|
db4563879e | ||
|
|
abb7df11e6 | ||
|
|
dfcd1232e1 | ||
|
|
02fef01a2f | ||
|
|
2976fa78c5 | ||
|
|
058d13f70d | ||
|
|
906f397839 | ||
|
|
dae91088fc | ||
|
|
5207e9c2df | ||
|
|
88485c32bb | ||
|
|
dbe73e8eff | ||
|
|
bdfc99e9d5 | ||
|
|
98e398c92e | ||
|
|
400b107b8c | ||
|
|
294f9ed11b | ||
|
|
5ecc65dc45 | ||
|
|
e36e7b5d18 | ||
|
|
ac57c31321 | ||
|
|
c14300c6d4 | ||
|
|
45403c242a | ||
|
|
0f1276e785 | ||
|
|
12723b6034 | ||
|
|
954be7e6a3 | ||
|
|
808b9aebdc |
@@ -0,0 +1,51 @@
|
||||
name: Android build
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ["android"]
|
||||
pull_request:
|
||||
branches: ["android"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: "17"
|
||||
distribution: "temurin"
|
||||
|
||||
- name: Create store file
|
||||
env:
|
||||
ANDROID_STORE_FILE_BASE64: ${{ secrets.ANDROID_STORE_FILE_BASE64 }}
|
||||
ANDROID_KEY_STORE_PASSWORD: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
|
||||
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
if: "${{ env.ANDROID_STORE_FILE_BASE64 != '' }}"
|
||||
run: |
|
||||
cd ./src/android
|
||||
base64 --decode <<< "${ANDROID_STORE_FILE_BASE64}" > store.jks
|
||||
ANDROID_STORE_FILE=$(pwd)/store.jks
|
||||
echo -e "keyStorePassword=$ANDROID_KEY_STORE_PASSWORD\nkeyAlias=$ANDROID_KEY_ALIAS\nstoreFile=$ANDROID_STORE_FILE\n" > keystore.properties
|
||||
|
||||
- name: Build Cemu for Android
|
||||
run: |
|
||||
cd ./src/android
|
||||
./gradlew assembleRelease
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cemu-android
|
||||
path: |
|
||||
./src/android/app/build/outputs/apk/release/*.apk
|
||||
./src/android/app/build/outputs/apk/release/*.aab
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Deploy experimental android release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
call-release-build:
|
||||
uses: ./.github/workflows/android_build.yml
|
||||
secrets: inherit
|
||||
deploy:
|
||||
name: Deploy experimental release
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [call-release-build]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cemu-android
|
||||
path: cemu-android
|
||||
|
||||
- name: Initialize
|
||||
run: |
|
||||
mkdir upload
|
||||
sudo apt install zip
|
||||
|
||||
- name: Set version dependent vars
|
||||
run: |
|
||||
echo "CEMU_VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create release from apk
|
||||
run: |
|
||||
VERSION=${{ env.CEMU_VERSION }}
|
||||
echo "Cemu Version is $VERSION"
|
||||
ls cemu-android
|
||||
mv cemu-android/*.apk upload/Cemu-$VERSION.apk
|
||||
|
||||
- name: Create release
|
||||
run: |
|
||||
wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.15.0/ghr_v0.15.0_linux_amd64.tar.gz
|
||||
tar xvzf ghr.tar.gz; rm ghr.tar.gz
|
||||
echo "[INFO] Release tag: v${{ env.CEMU_VERSION }}"
|
||||
RELEASE_BODY=$(printf "Experimental release\n%s" "Latest commit ${{ env.CEMU_VERSION }}")
|
||||
ghr_v0.15.0_linux_amd64/ghr -b "$RELEASE_BODY" -t ${{ secrets.GITHUB_TOKEN }} -n "Cemu ${{ env.CEMU_VERSION }}" "${{ env.CEMU_VERSION }}" ./upload
|
||||
@@ -17,6 +17,7 @@
|
||||
.idea/
|
||||
|
||||
build/
|
||||
build_arm
|
||||
cmake-build-*/
|
||||
out/
|
||||
.cache/
|
||||
|
||||
+4
-1
@@ -1,6 +1,6 @@
|
||||
[submodule "dependencies/ZArchive"]
|
||||
path = dependencies/ZArchive
|
||||
url = https://github.com/Exzap/ZArchive
|
||||
url = https://github.com/SSimco/ZArchive
|
||||
shallow = true
|
||||
[submodule "dependencies/cubeb"]
|
||||
path = dependencies/cubeb
|
||||
@@ -18,3 +18,6 @@
|
||||
path = dependencies/imgui
|
||||
url = https://github.com/ocornut/imgui
|
||||
shallow = true
|
||||
[submodule "dependencies/xbyak_aarch64"]
|
||||
path = dependencies/xbyak_aarch64
|
||||
url = https://github.com/fujitsu/xbyak_aarch64
|
||||
|
||||
+27
-8
@@ -35,15 +35,22 @@ if (ENABLE_VCPKG)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT VCPKG_TARGET_ANDROID)
|
||||
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_linux")
|
||||
elseif(APPLE)
|
||||
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_mac")
|
||||
else()
|
||||
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
|
||||
endif()
|
||||
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
CACHE STRING "Vcpkg toolchain file")
|
||||
if(VCPKG_TARGET_ANDROID)
|
||||
set(ENV{ANDROID_NDK_HOME} ${ANDROID_NDK})
|
||||
set(ENV{VCPKG_ROOT} "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/vcpkg_android.cmake")
|
||||
else()
|
||||
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
CACHE STRING "Vcpkg toolchain file")
|
||||
endif()
|
||||
# Set this so that all the various find_package() calls don't need an explicit
|
||||
# CONFIG option
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
||||
@@ -70,8 +77,10 @@ add_definitions(-DEMULATOR_VERSION_PATCH=${EMULATOR_VERSION_PATCH})
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# enable link time optimization for release builds
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON)
|
||||
if(NOT ANDROID)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT CemuBin)
|
||||
@@ -143,11 +152,17 @@ option(ENABLE_WXWIDGETS "Build with wxWidgets UI (Currently required)" ON)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG true)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
if(ENABLE_SDL)
|
||||
find_package(SDL2 REQUIRED)
|
||||
add_compile_definitions("HAS_SDL=1")
|
||||
endif()
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(pugixml REQUIRED)
|
||||
find_package(RapidJSON REQUIRED)
|
||||
find_package(Boost COMPONENTS program_options filesystem nowide REQUIRED)
|
||||
if(ANDROID)
|
||||
find_package(Boost COMPONENTS context iostreams REQUIRED)
|
||||
endif()
|
||||
find_package(libzip REQUIRED)
|
||||
find_package(glslang REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
@@ -162,7 +177,7 @@ if (NOT TARGET glslang::SPIRV AND TARGET SPIRV)
|
||||
add_library(glslang::SPIRV ALIAS SPIRV)
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
if (UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
find_package(X11 REQUIRED)
|
||||
if (ENABLE_WAYLAND)
|
||||
find_package(Wayland REQUIRED Client)
|
||||
@@ -201,7 +216,7 @@ if (ENABLE_HIDAPI)
|
||||
add_compile_definitions(HAS_HIDAPI)
|
||||
endif ()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
if(ENABLE_FERAL_GAMEMODE)
|
||||
add_compile_definitions(ENABLE_FERAL_GAMEMODE)
|
||||
add_subdirectory(dependencies/gamemode EXCLUDE_FROM_ALL)
|
||||
@@ -231,6 +246,10 @@ endif()
|
||||
|
||||
add_subdirectory("dependencies/ih264d" EXCLUDE_FROM_ALL)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)")
|
||||
add_subdirectory("dependencies/xbyak_aarch64" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
find_package(ZArchive)
|
||||
if (NOT ZArchive_FOUND)
|
||||
add_subdirectory("dependencies/ZArchive" EXCLUDE_FROM_ALL)
|
||||
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#! /bin/env bash
|
||||
# rm -rf build_arm
|
||||
set -e
|
||||
cmake -S . -B build_arm -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
||||
-DENABLE_VCPKG=OFF \
|
||||
-DCMAKE_TOOLCHAIN_FILE=./cmake/debian-arm64toolchain.cmake \
|
||||
-DENABLE_WAYLAND=OFF \
|
||||
-DENABLE_HIDAPI=OFF \
|
||||
-DENABLE_NSYSHID_LIBUSB=OFF \
|
||||
-G Ninja
|
||||
cmake --build build_arm
|
||||
@@ -0,0 +1,9 @@
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
|
||||
set(CMAKE_ASM_COMPILER_TARGET aarch64-linux-gnu)
|
||||
set(CMAKE_C_COMPILER clang-16)
|
||||
set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu)
|
||||
set(CMAKE_CXX_COMPILER clang++-16)
|
||||
set(CMAKE_CXX_COMPILER_TARGET aarch64-linux-gnu)
|
||||
set(PKG_CONFIG_EXECUTABLE "aarch64-linux-gnu-pkg-config")
|
||||
set(PKGCONFIG_EXECUTABLE "aarch64-linux-gnu-pkg-config")
|
||||
@@ -0,0 +1,99 @@
|
||||
#
|
||||
# vcpkg_android.cmake
|
||||
#
|
||||
# Helper script when using vcpkg with cmake. It should be triggered via the variable VCPKG_TARGET_ANDROID
|
||||
#
|
||||
# For example:
|
||||
# if (VCPKG_TARGET_ANDROID)
|
||||
# include("cmake/vcpkg_android.cmake")
|
||||
# endif()
|
||||
#
|
||||
# This script will:
|
||||
# 1 & 2. check the presence of needed env variables: ANDROID_NDK_HOME and VCPKG_ROOT
|
||||
# 3. set VCPKG_TARGET_TRIPLET according to ANDROID_ABI
|
||||
# 4. Combine vcpkg and Android toolchains by setting CMAKE_TOOLCHAIN_FILE
|
||||
# and VCPKG_CHAINLOAD_TOOLCHAIN_FILE
|
||||
|
||||
# Note: VCPKG_TARGET_ANDROID is not an official Vcpkg variable.
|
||||
# it is introduced for the need of this script
|
||||
|
||||
if (VCPKG_TARGET_ANDROID)
|
||||
|
||||
#
|
||||
# 1. Check the presence of environment variable ANDROID_NDK_HOME
|
||||
#
|
||||
if (NOT DEFINED ENV{ANDROID_NDK_HOME})
|
||||
message(FATAL_ERROR "
|
||||
Please set an environment variable ANDROID_NDK_HOME
|
||||
For example:
|
||||
export ANDROID_NDK_HOME=/home/your-account/Android/Sdk/ndk-bundle
|
||||
Or:
|
||||
export ANDROID_NDK_HOME=/home/your-account/Android/android-ndk-r21b
|
||||
")
|
||||
endif()
|
||||
|
||||
#
|
||||
# 2. Check the presence of environment variable VCPKG_ROOT
|
||||
#
|
||||
if (NOT DEFINED ENV{VCPKG_ROOT})
|
||||
message(FATAL_ERROR "
|
||||
Please set an environment variable VCPKG_ROOT
|
||||
For example:
|
||||
export VCPKG_ROOT=/path/to/vcpkg
|
||||
")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# 3. Set VCPKG_TARGET_TRIPLET according to ANDROID_ABI
|
||||
#
|
||||
# There are four different Android ABI, each of which maps to
|
||||
# a vcpkg triplet. The following table outlines the mapping from vcpkg architectures to android architectures
|
||||
#
|
||||
# |VCPKG_TARGET_TRIPLET | ANDROID_ABI |
|
||||
# |---------------------------|----------------------|
|
||||
# |arm64-android | arm64-v8a |
|
||||
# |arm-android | armeabi-v7a |
|
||||
# |x64-android | x86_64 |
|
||||
# |x86-android | x86 |
|
||||
#
|
||||
# The variable must be stored in the cache in order to successfully the two toolchains.
|
||||
#
|
||||
if (ANDROID_ABI MATCHES "arm64-v8a")
|
||||
set(VCPKG_TARGET_TRIPLET "arm64-android" CACHE STRING "" FORCE)
|
||||
elseif(ANDROID_ABI MATCHES "armeabi-v7a")
|
||||
set(VCPKG_TARGET_TRIPLET "arm-android" CACHE STRING "" FORCE)
|
||||
elseif(ANDROID_ABI MATCHES "x86_64")
|
||||
set(VCPKG_TARGET_TRIPLET "x64-android" CACHE STRING "" FORCE)
|
||||
elseif(ANDROID_ABI MATCHES "x86")
|
||||
set(VCPKG_TARGET_TRIPLET "x86-android" CACHE STRING "" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "
|
||||
Please specify ANDROID_ABI
|
||||
For example
|
||||
cmake ... -DANDROID_ABI=armeabi-v7a
|
||||
|
||||
Possible ABIs are: arm64-v8a, armeabi-v7a, x64-android, x86-android
|
||||
")
|
||||
endif()
|
||||
message("vcpkg_android.cmake: VCPKG_TARGET_TRIPLET was set to ${VCPKG_TARGET_TRIPLET}")
|
||||
|
||||
|
||||
#
|
||||
# 4. Combine vcpkg and Android toolchains
|
||||
#
|
||||
|
||||
# vcpkg and android both provide dedicated toolchains:
|
||||
#
|
||||
# vcpkg_toolchain_file=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
|
||||
# android_toolchain_file=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake
|
||||
#
|
||||
# When using vcpkg, the vcpkg toolchain shall be specified first.
|
||||
# However, vcpkg provides a way to preload and additional toolchain,
|
||||
# with the VCPKG_CHAINLOAD_TOOLCHAIN_FILE option.
|
||||
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE $ENV{ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake)
|
||||
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
|
||||
message("vcpkg_android.cmake: CMAKE_TOOLCHAIN_FILE was set to ${CMAKE_TOOLCHAIN_FILE}")
|
||||
message("vcpkg_android.cmake: VCPKG_CHAINLOAD_TOOLCHAIN_FILE was set to ${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
|
||||
|
||||
endif(VCPKG_TARGET_ANDROID)
|
||||
Vendored
+1
-1
Submodule dependencies/ZArchive updated: d2c7177300...c50b5d222b
@@ -17,9 +17,6 @@
|
||||
*****************************************************************************
|
||||
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
||||
*/
|
||||
#ifdef __ANDROID__
|
||||
#include <log/log.h>
|
||||
#endif
|
||||
#include "ih264_typedefs.h"
|
||||
#include "ih264_macros.h"
|
||||
#include "ih264_platform_macros.h"
|
||||
@@ -902,10 +899,6 @@ WORD32 ih264d_read_mmco_commands(struct _DecStruct * ps_dec)
|
||||
{
|
||||
if (j >= MAX_REF_BUFS)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
ALOGE("b/25818142");
|
||||
android_errorWriteLog(0x534e4554, "25818142");
|
||||
#endif
|
||||
ps_dpb_cmds->u1_num_of_commands = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
+1
Submodule dependencies/xbyak_aarch64 added at e61bad546f
+41
-20
@@ -18,6 +18,8 @@ elseif(UNIX)
|
||||
VK_USE_PLATFORM_MACOS_MVK
|
||||
VK_USE_PLATFORM_METAL_EXT
|
||||
)
|
||||
elseif(ANDROID)
|
||||
add_compile_definitions(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
else()
|
||||
add_compile_definitions(
|
||||
VK_USE_PLATFORM_XLIB_KHR # legacy. Do we need to support XLIB surfaces?
|
||||
@@ -40,7 +42,11 @@ add_compile_definitions(VK_NO_PROTOTYPES)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_subdirectory(Common)
|
||||
add_subdirectory(gui)
|
||||
if(ANDROID)
|
||||
add_subdirectory(android/app/src/main/cpp)
|
||||
else()
|
||||
add_subdirectory(gui)
|
||||
endif()
|
||||
add_subdirectory(Cafe)
|
||||
add_subdirectory(Cemu)
|
||||
add_subdirectory(config)
|
||||
@@ -51,28 +57,34 @@ add_subdirectory(imgui)
|
||||
add_subdirectory(resource)
|
||||
add_subdirectory(asm)
|
||||
|
||||
add_executable(CemuBin
|
||||
main.cpp
|
||||
mainLLE.cpp
|
||||
)
|
||||
if(ANDROID)
|
||||
add_library(CemuBin STATIC
|
||||
main.cpp
|
||||
mainLLE.cpp
|
||||
)
|
||||
else()
|
||||
add_executable(CemuBin
|
||||
main.cpp
|
||||
mainLLE.cpp
|
||||
)
|
||||
|
||||
if(MSVC AND MSVC_VERSION EQUAL 1940)
|
||||
# workaround for an msvc issue on VS 17.10 where generated ILK files are too large
|
||||
# see https://developercommunity.visualstudio.com/t/After-updating-to-VS-1710-the-size-of-/10665511
|
||||
set_target_properties(CemuBin PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
|
||||
endif()
|
||||
if(MSVC AND MSVC_VERSION EQUAL 1940)
|
||||
# workaround for an msvc issue on VS 17.10 where generated ILK files are too large
|
||||
# see https://developercommunity.visualstudio.com/t/After-updating-to-VS-1710-the-size-of-/10665511
|
||||
set_target_properties(CemuBin PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_sources(CemuBin PRIVATE
|
||||
resource/cemu.rc
|
||||
if(WIN32)
|
||||
target_sources(CemuBin PRIVATE
|
||||
resource/cemu.rc
|
||||
../dist/windows/cemu.manifest
|
||||
)
|
||||
endif()
|
||||
set_property(TARGET CemuBin PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set_property(TARGET CemuBin PROPERTY WIN32_EXECUTABLE $<NOT:$<CONFIG:Debug>>)
|
||||
set(OUTPUT_NAME "Cemu_$<LOWER_CASE:$<CONFIG>>")
|
||||
endif()
|
||||
|
||||
set_property(TARGET CemuBin PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set_property(TARGET CemuBin PROPERTY WIN32_EXECUTABLE $<NOT:$<CONFIG:Debug>>)
|
||||
set(OUTPUT_NAME "Cemu_$<LOWER_CASE:$<CONFIG>>")
|
||||
|
||||
if (MACOS_BUNDLE)
|
||||
set_property(TARGET CemuBin PROPERTY MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resource/MacOSXBundleInfo.plist.in")
|
||||
|
||||
@@ -122,13 +134,22 @@ target_link_libraries(CemuBin PRIVATE
|
||||
CemuCommon
|
||||
CemuComponents
|
||||
CemuConfig
|
||||
CemuGui
|
||||
CemuInput
|
||||
CemuUtil
|
||||
OpenGL::GL
|
||||
SDL2::SDL2
|
||||
)
|
||||
|
||||
if(NOT ANDROID)
|
||||
target_link_libraries(CemuBin PRIVATE CemuGui)
|
||||
endif()
|
||||
|
||||
if(ENABLE_OPENGL)
|
||||
target_link_libraries(CemuBin PRIVATE OpenGL::GL)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SDL)
|
||||
target_link_libraries(CemuBin PRIVATE SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# due to nasm output some linkers will make stack executable
|
||||
# cemu does not require this so we explicity disable it
|
||||
|
||||
+41
-17
@@ -67,24 +67,23 @@ add_library(CemuCafe
|
||||
HW/Espresso/Recompiler/PPCFunctionBoundaryTracker.h
|
||||
HW/Espresso/Recompiler/PPCRecompiler.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompiler.h
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlAnalyzer.cpp
|
||||
HW/Espresso/Recompiler/RecompilerTests.cpp
|
||||
HW/Espresso/Recompiler/IML/IML.h
|
||||
HW/Espresso/Recompiler/IML/IMLSegment.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLSegment.h
|
||||
HW/Espresso/Recompiler/IML/IMLInstruction.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLInstruction.h
|
||||
HW/Espresso/Recompiler/IML/IMLDebug.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLAnalyzer.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLOptimizer.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLRegisterAllocator.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLRegisterAllocator.h
|
||||
HW/Espresso/Recompiler/IML/IMLRegisterAllocatorRanges.cpp
|
||||
HW/Espresso/Recompiler/IML/IMLRegisterAllocatorRanges.h
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlGenFPU.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerIml.h
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlOptimizer.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlRanges.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlRanges.h
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlRegisterAllocator2.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerImlRegisterAllocator.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerIntermediate.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64AVX.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64BMI.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64FPU.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64Gen.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64GenFPU.cpp
|
||||
HW/Espresso/Recompiler/PPCRecompilerX64.h
|
||||
HW/Espresso/Recompiler/x64Emit.hpp
|
||||
HW/Latte/Common/RegisterSerializer.cpp
|
||||
HW/Latte/Common/RegisterSerializer.h
|
||||
HW/Latte/Common/ShaderSerializer.cpp
|
||||
@@ -522,10 +521,36 @@ add_library(CemuCafe
|
||||
TitleList/TitleList.h
|
||||
)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
|
||||
target_sources(CemuCafe PRIVATE
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64AVX.cpp
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64BMI.cpp
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64.cpp
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64FPU.cpp
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64Gen.cpp
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64GenFPU.cpp
|
||||
HW/Espresso/Recompiler/BackendX64/BackendX64.h
|
||||
HW/Espresso/Recompiler/BackendX64/X64Emit.hpp
|
||||
HW/Espresso/Recompiler/BackendX64/x86Emitter.h
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)")
|
||||
target_sources(CemuCafe PRIVATE
|
||||
HW/Espresso/Recompiler/BackendAArch64/BackendAArch64.cpp
|
||||
HW/Espresso/Recompiler/BackendAArch64/BackendAArch64.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_sources(CemuCafe PRIVATE "HW/Latte/Renderer/Vulkan/CocoaSurface.mm")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
target_sources(CemuCafe PRIVATE
|
||||
Filesystem/fscDeviceAndroidSAF.cpp
|
||||
Filesystem/fscDeviceAndroidSAF.h
|
||||
)
|
||||
endif()
|
||||
|
||||
set_property(TARGET CemuCafe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
target_include_directories(CemuCafe PUBLIC "../")
|
||||
@@ -536,7 +561,6 @@ target_link_libraries(CemuCafe PRIVATE
|
||||
CemuCommon
|
||||
CemuComponents
|
||||
CemuConfig
|
||||
CemuGui
|
||||
CemuInput
|
||||
CemuResource
|
||||
CemuUtil
|
||||
@@ -572,8 +596,8 @@ if (ENABLE_NSYSHID_LIBUSB)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (ENABLE_WXWIDGETS)
|
||||
target_link_libraries(CemuCafe PRIVATE wx::base wx::core)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(AARCH64)")
|
||||
target_link_libraries(CemuCafe PRIVATE xbyak_aarch64)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
||||
+27
-11
@@ -1,5 +1,4 @@
|
||||
#include "Cafe/OS/common/OSCommon.h"
|
||||
#include "gui/wxgui.h"
|
||||
#include "Cafe/OS/libs/gx2/GX2.h"
|
||||
#include "Cafe/GameProfile/GameProfile.h"
|
||||
#include "Cafe/HW/Espresso/Interpreter/PPCInterpreterInternal.h"
|
||||
@@ -64,9 +63,6 @@
|
||||
// HW interfaces
|
||||
#include "Cafe/HW/SI/si.h"
|
||||
|
||||
// dependency to be removed
|
||||
#include "gui/guiWrapper.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#if BOOST_OS_LINUX
|
||||
@@ -171,7 +167,7 @@ void LoadMainExecutable()
|
||||
applicationRPX = RPLLoader_LoadFromMemory(rpxData, rpxSize, (char*)_pathToExecutable.c_str());
|
||||
if (!applicationRPX)
|
||||
{
|
||||
wxMessageBox(_("Failed to run this title because the executable is damaged"));
|
||||
cemuLog_log(LogType::Force, "Failed to run this title because the executable is damaged");
|
||||
cemuLog_createLogFile(false);
|
||||
cemuLog_waitForFlush();
|
||||
exit(0);
|
||||
@@ -356,7 +352,9 @@ uint32 LoadSharedData()
|
||||
|
||||
void cemu_initForGame()
|
||||
{
|
||||
gui_updateWindowTitles(false, true, 0.0);
|
||||
auto cafeSystemCallbacks = CafeSystem::getCafeSystemCallbacks();
|
||||
if (cafeSystemCallbacks)
|
||||
cafeSystemCallbacks->updateWindowTitles(false, true, 0.0);
|
||||
// input manager apply game profile
|
||||
InputManager::instance().apply_game_profile();
|
||||
// log info for launched title
|
||||
@@ -426,6 +424,20 @@ void cemu_initForGame()
|
||||
|
||||
namespace CafeSystem
|
||||
{
|
||||
CafeSystemCallbacks* sCafeSystemCallbacks = nullptr;
|
||||
void registerCafeSystemCallbacks(CafeSystemCallbacks* cafeSystemCallbacks)
|
||||
{
|
||||
sCafeSystemCallbacks = cafeSystemCallbacks;
|
||||
}
|
||||
void unregisterCafeSystemCallbacks()
|
||||
{
|
||||
sCafeSystemCallbacks = nullptr;
|
||||
}
|
||||
CafeSystemCallbacks* getCafeSystemCallbacks()
|
||||
{
|
||||
return sCafeSystemCallbacks;
|
||||
}
|
||||
|
||||
void InitVirtualMlcStorage();
|
||||
void MlcStorageMountTitle(TitleInfo& titleInfo);
|
||||
void MlcStorageUnmountAllTitles();
|
||||
@@ -506,7 +518,9 @@ namespace CafeSystem
|
||||
{
|
||||
std::string buffer;
|
||||
const char* platform = NULL;
|
||||
#if BOOST_OS_WINDOWS
|
||||
#if __ANDROID__
|
||||
platform = "Android";
|
||||
#elif BOOST_OS_WINDOWS
|
||||
uint32 buildNumber;
|
||||
std::string windowsVersionName = GetWindowsNamedVersion(buildNumber);
|
||||
buffer = fmt::format("{} (Build {})", windowsVersionName, buildNumber);
|
||||
@@ -805,10 +819,10 @@ namespace CafeSystem
|
||||
// check for content folder
|
||||
fs::path contentPath = executablePath.parent_path().parent_path().append("content");
|
||||
std::error_code ec;
|
||||
if (fs::is_directory(contentPath, ec))
|
||||
if (cemu::fs::is_directory(contentPath, ec))
|
||||
{
|
||||
// mounting content folder
|
||||
bool r = FSCDeviceHostFS_Mount(std::string("/vol/content").c_str(), _pathToUtf8(contentPath), FSC_PRIORITY_BASE);
|
||||
bool r = FSCDeviceHost_Mount(std::string("/vol/content").c_str(), _pathToUtf8(contentPath), FSC_PRIORITY_BASE);
|
||||
if (!r)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Failed to mount {}", _pathToUtf8(contentPath));
|
||||
@@ -817,7 +831,7 @@ namespace CafeSystem
|
||||
}
|
||||
}
|
||||
// mount code folder to a virtual temporary path
|
||||
FSCDeviceHostFS_Mount(std::string("/internal/code/").c_str(), _pathToUtf8(executablePath.parent_path()), FSC_PRIORITY_BASE);
|
||||
FSCDeviceHost_Mount(std::string("/internal/code/").c_str(), _pathToUtf8(executablePath.parent_path()), FSC_PRIORITY_BASE);
|
||||
std::string internalExecutablePath = "/internal/code/";
|
||||
internalExecutablePath.append(_pathToUtf8(executablePath.filename()));
|
||||
_pathToExecutable = internalExecutablePath;
|
||||
@@ -854,7 +868,9 @@ namespace CafeSystem
|
||||
PPCTimer_waitForInit();
|
||||
// start system
|
||||
sSystemRunning = true;
|
||||
gui_notifyGameLoaded();
|
||||
auto cafeSystemCallbacks = CafeSystem::getCafeSystemCallbacks();
|
||||
if (cafeSystemCallbacks)
|
||||
cafeSystemCallbacks->notifyGameLoaded();
|
||||
std::thread t(_LaunchTitleThread);
|
||||
t.detach();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,17 @@ namespace CafeSystem
|
||||
//BAD_META_DATA, - the title list only stores titles with valid meta, so this error code is impossible
|
||||
};
|
||||
|
||||
class CafeSystemCallbacks
|
||||
{
|
||||
public:
|
||||
virtual void updateWindowTitles(bool isIdle, bool isLoading, double fps) = 0;
|
||||
virtual void notifyGameLoaded() = 0;
|
||||
};
|
||||
|
||||
void registerCafeSystemCallbacks(CafeSystemCallbacks* cafeSystemCallbacks);
|
||||
void unregisterCafeSystemCallbacks();
|
||||
CafeSystemCallbacks* getCafeSystemCallbacks();
|
||||
|
||||
void Initialize();
|
||||
void SetImplementation(SystemImplementation* impl);
|
||||
void Shutdown();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include <wx/msgdlg.h>
|
||||
#include <mutex>
|
||||
#include <gui/helpers/wxHelpers.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "util/crypto/aes128.h"
|
||||
@@ -75,7 +73,7 @@ void KeyCache_Prepare()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox(_("Unable to create file keys.txt\nThis can happen if Cemu does not have write permission to its own directory, the disk is full or if anti-virus software is blocking Cemu."), _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "Unable to create file keys.txt\nThis can happen if Cemu does not have write permission to it's own directory, the disk is full or if anti-virus software is blocking Cemu.");
|
||||
}
|
||||
mtxKeyCache.unlock();
|
||||
return;
|
||||
@@ -108,8 +106,7 @@ void KeyCache_Prepare()
|
||||
continue;
|
||||
if( strishex(line) == false )
|
||||
{
|
||||
auto errorMsg = formatWxString(_("Error in keys.txt at line {}"), lineNumber);
|
||||
wxMessageBox(errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
|
||||
cemuLog_log(LogType::Force, "rror in keys.txt in line {}", lineNumber);
|
||||
continue;
|
||||
}
|
||||
if(line.size() == 32 )
|
||||
|
||||
@@ -213,3 +213,18 @@ bool FSCDeviceHostFS_Mount(std::string_view mountPath, std::string_view hostTarg
|
||||
// redirect device
|
||||
void fscDeviceRedirect_map();
|
||||
void fscDeviceRedirect_add(std::string_view virtualSourcePath, size_t fileSize, const fs::path& targetFilePath, sint32 priority);
|
||||
|
||||
#if __ANDROID__
|
||||
#include "Common/unix/FilesystemAndroid.h"
|
||||
bool FSCDeviceAndroidSAF_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority);
|
||||
#endif // __ANDROID__
|
||||
|
||||
inline bool FSCDeviceHost_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority)
|
||||
{
|
||||
#if __ANDROID__
|
||||
if (FilesystemAndroid::isContentUri(std::string(hostTargetPath)))
|
||||
return FSCDeviceAndroidSAF_Mount(mountPath, hostTargetPath, priority);
|
||||
else
|
||||
#endif // __ANDROID__
|
||||
return FSCDeviceHostFS_Mount(mountPath, hostTargetPath, priority);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
#include "Cafe/Filesystem/fscDeviceAndroidSAF.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Cafe/Filesystem/fsc.h"
|
||||
#include "Common/FileStream.h"
|
||||
#include "Common/unix/FilesystemAndroid.h"
|
||||
|
||||
FSCVirtualFile_AndroidSAF::~FSCVirtualFile_AndroidSAF()
|
||||
{
|
||||
if (m_type == FSC_TYPE_FILE)
|
||||
delete m_fs;
|
||||
}
|
||||
|
||||
sint32 FSCVirtualFile_AndroidSAF::fscGetType()
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
uint32 FSCVirtualFile_AndroidSAF::fscDeviceAndroidSAFFSFile_getFileSize()
|
||||
{
|
||||
if (m_type == FSC_TYPE_FILE)
|
||||
{
|
||||
if (m_fileSize > 0xFFFFFFFFULL)
|
||||
cemu_assert_suspicious(); // files larger than 4GB are not supported by Wii U filesystem
|
||||
return (uint32)m_fileSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64 FSCVirtualFile_AndroidSAF::fscQueryValueU64(uint32 id)
|
||||
{
|
||||
if (m_type == FSC_TYPE_FILE)
|
||||
{
|
||||
if (id == FSC_QUERY_SIZE)
|
||||
return fscDeviceAndroidSAFFSFile_getFileSize();
|
||||
else if (id == FSC_QUERY_WRITEABLE)
|
||||
return m_isWritable;
|
||||
else
|
||||
cemu_assert_unimplemented();
|
||||
}
|
||||
else if (m_type == FSC_TYPE_DIRECTORY)
|
||||
{
|
||||
if (id == FSC_QUERY_SIZE)
|
||||
return fscDeviceAndroidSAFFSFile_getFileSize();
|
||||
else
|
||||
cemu_assert_unimplemented();
|
||||
}
|
||||
cemu_assert_unimplemented();
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 FSCVirtualFile_AndroidSAF::fscWriteData(void* buffer, uint32 size)
|
||||
{
|
||||
throw std::logic_error("write not supported with SAF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 FSCVirtualFile_AndroidSAF::fscReadData(void* buffer, uint32 size)
|
||||
{
|
||||
if (m_type != FSC_TYPE_FILE)
|
||||
return 0;
|
||||
if (size >= (2UL * 1024UL * 1024UL * 1024UL))
|
||||
{
|
||||
cemu_assert_suspicious();
|
||||
return 0;
|
||||
}
|
||||
uint32 bytesLeft = (uint32)(m_fileSize - m_seek);
|
||||
bytesLeft = std::min(bytesLeft, 0x7FFFFFFFu);
|
||||
sint32 bytesToRead = std::min(bytesLeft, size);
|
||||
uint32 bytesRead = m_fs->readData(buffer, bytesToRead);
|
||||
m_seek += bytesRead;
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
void FSCVirtualFile_AndroidSAF::fscSetSeek(uint64 seek)
|
||||
{
|
||||
if (m_type != FSC_TYPE_FILE)
|
||||
return;
|
||||
this->m_seek = seek;
|
||||
cemu_assert_debug(seek <= m_fileSize);
|
||||
m_fs->SetPosition(seek);
|
||||
}
|
||||
|
||||
uint64 FSCVirtualFile_AndroidSAF::fscGetSeek()
|
||||
{
|
||||
if (m_type != FSC_TYPE_FILE)
|
||||
return 0;
|
||||
return m_seek;
|
||||
}
|
||||
|
||||
void FSCVirtualFile_AndroidSAF::fscSetFileLength(uint64 endOffset)
|
||||
{
|
||||
if (m_type != FSC_TYPE_FILE)
|
||||
return;
|
||||
m_fs->SetPosition(endOffset);
|
||||
bool r = m_fs->SetEndOfFile();
|
||||
m_seek = std::min(m_seek, endOffset);
|
||||
m_fileSize = m_seek;
|
||||
m_fs->SetPosition(m_seek);
|
||||
if (!r)
|
||||
cemuLog_log(LogType::Force, "fscSetFileLength: Failed to set size to 0x{:x}", endOffset);
|
||||
}
|
||||
|
||||
bool FSCVirtualFile_AndroidSAF::fscDirNext(FSCDirEntry* dirEntry)
|
||||
{
|
||||
if (m_type != FSC_TYPE_DIRECTORY)
|
||||
return false;
|
||||
|
||||
if (!m_files)
|
||||
{
|
||||
// init iterator on first iteration attempt
|
||||
m_files = std::make_unique<std::vector<fs::path>>(FilesystemAndroid::listFiles(*m_path));
|
||||
m_filesIterator = m_files->begin();
|
||||
if (!m_files)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Failed to iterate directory: {}", _pathToUtf8(*m_path));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (m_filesIterator == m_files->end())
|
||||
return false;
|
||||
|
||||
const fs::path& file = *m_filesIterator;
|
||||
|
||||
std::string fileName = file.filename().generic_string();
|
||||
if (fileName.size() >= sizeof(dirEntry->path) - 1)
|
||||
fileName.resize(sizeof(dirEntry->path) - 1);
|
||||
strncpy(dirEntry->path, fileName.data(), sizeof(dirEntry->path));
|
||||
if (FilesystemAndroid::isDirectory(file))
|
||||
{
|
||||
dirEntry->isDirectory = true;
|
||||
dirEntry->isFile = false;
|
||||
dirEntry->fileSize = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dirEntry->isDirectory = false;
|
||||
dirEntry->isFile = true;
|
||||
dirEntry->fileSize = 0;
|
||||
auto fs = FileStream::openFile2(file);
|
||||
if (fs)
|
||||
{
|
||||
dirEntry->fileSize = fs->GetSize();
|
||||
delete fs;
|
||||
}
|
||||
}
|
||||
m_filesIterator++;
|
||||
return true;
|
||||
}
|
||||
|
||||
FSCVirtualFile* FSCVirtualFile_AndroidSAF::OpenFile(const fs::path& path, FSC_ACCESS_FLAG accessFlags, sint32& fscStatus)
|
||||
{
|
||||
if (!HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::OPEN_FILE) && !HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::OPEN_DIR))
|
||||
cemu_assert_debug(false); // not allowed. At least one of both flags must be set
|
||||
if (HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::WRITE_PERMISSION) ||
|
||||
HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::FILE_ALLOW_CREATE) ||
|
||||
HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::FILE_ALWAYS_CREATE))
|
||||
throw std::logic_error("writing and creating a file is not supported with SAF");
|
||||
// attempt to open as file
|
||||
if (HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::OPEN_FILE))
|
||||
{
|
||||
FileStream* fs = FileStream::openFile2(path);
|
||||
if (fs)
|
||||
{
|
||||
FSCVirtualFile_AndroidSAF* vf = new FSCVirtualFile_AndroidSAF(FSC_TYPE_FILE);
|
||||
vf->m_fs = fs;
|
||||
vf->m_isWritable = false;
|
||||
vf->m_fileSize = fs->GetSize();
|
||||
fscStatus = FSC_STATUS_OK;
|
||||
return vf;
|
||||
}
|
||||
}
|
||||
|
||||
// attempt to open as directory
|
||||
if (HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::OPEN_DIR))
|
||||
{
|
||||
bool isExistingDir = FilesystemAndroid::exists(path);
|
||||
if (isExistingDir)
|
||||
{
|
||||
FSCVirtualFile_AndroidSAF* vf = new FSCVirtualFile_AndroidSAF(FSC_TYPE_DIRECTORY);
|
||||
vf->m_path.reset(new std::filesystem::path(path));
|
||||
fscStatus = FSC_STATUS_OK;
|
||||
return vf;
|
||||
}
|
||||
}
|
||||
fscStatus = FSC_STATUS_FILE_NOT_FOUND;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Device implementation */
|
||||
|
||||
class fscDeviceAndroidSAFFSC : public fscDeviceC
|
||||
{
|
||||
public:
|
||||
FSCVirtualFile* fscDeviceOpenByPath(std::string_view path, FSC_ACCESS_FLAG accessFlags, void* ctx, sint32* fscStatus) override
|
||||
{
|
||||
*fscStatus = FSC_STATUS_OK;
|
||||
FSCVirtualFile* vf = FSCVirtualFile_AndroidSAF::OpenFile(_utf8ToPath(path), accessFlags, *fscStatus);
|
||||
cemu_assert_debug((bool)vf == (*fscStatus == FSC_STATUS_OK));
|
||||
return vf;
|
||||
}
|
||||
|
||||
bool fscDeviceCreateDir(std::string_view path, void* ctx, sint32* fscStatus) override
|
||||
{
|
||||
throw std::logic_error("creating a directory is not supported with SAF");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fscDeviceRemoveFileOrDir(std::string_view path, void* ctx, sint32* fscStatus) override
|
||||
{
|
||||
throw std::logic_error("removing a file or dir is not supported with SAF");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fscDeviceRename(std::string_view srcPath, std::string_view dstPath, void* ctx, sint32* fscStatus) override
|
||||
{
|
||||
throw std::logic_error("renaming not supported with SAF");
|
||||
return false;
|
||||
}
|
||||
|
||||
// singleton
|
||||
public:
|
||||
static fscDeviceAndroidSAFFSC& instance()
|
||||
{
|
||||
static fscDeviceAndroidSAFFSC _instance;
|
||||
return _instance;
|
||||
}
|
||||
};
|
||||
|
||||
bool FSCDeviceAndroidSAF_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority)
|
||||
{
|
||||
return fsc_mount(mountPath, hostTargetPath, &fscDeviceAndroidSAFFSC::instance(), nullptr, priority) == FSC_STATUS_OK;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "Cafe/Filesystem/fsc.h"
|
||||
|
||||
class FSCVirtualFile_AndroidSAF : public FSCVirtualFile
|
||||
{
|
||||
public:
|
||||
static FSCVirtualFile* OpenFile(const fs::path& path, FSC_ACCESS_FLAG accessFlags, sint32& fscStatus);
|
||||
~FSCVirtualFile_AndroidSAF() override;
|
||||
|
||||
sint32 fscGetType() override;
|
||||
|
||||
uint32 fscDeviceAndroidSAFFSFile_getFileSize();
|
||||
|
||||
uint64 fscQueryValueU64(uint32 id) override;
|
||||
uint32 fscWriteData(void* buffer, uint32 size) override;
|
||||
uint32 fscReadData(void* buffer, uint32 size) override;
|
||||
void fscSetSeek(uint64 seek) override;
|
||||
uint64 fscGetSeek() override;
|
||||
void fscSetFileLength(uint64 endOffset) override;
|
||||
bool fscDirNext(FSCDirEntry* dirEntry) override;
|
||||
|
||||
private:
|
||||
FSCVirtualFile_AndroidSAF(uint32 type) : m_type(type){};
|
||||
|
||||
uint32 m_type; // FSC_TYPE_*
|
||||
class FileStream* m_fs{};
|
||||
// file
|
||||
uint64 m_seek{0};
|
||||
uint64 m_fileSize{0};
|
||||
bool m_isWritable{false};
|
||||
// directory
|
||||
std::unique_ptr<fs::path> m_path{};
|
||||
std::unique_ptr<std::vector<fs::path>> m_files{};
|
||||
std::vector<fs::path>::iterator m_filesIterator;
|
||||
};
|
||||
@@ -5,9 +5,6 @@
|
||||
#include "Cafe/OS/RPL/rpl_structs.h"
|
||||
#include "boost/algorithm/string.hpp"
|
||||
|
||||
#include "gui/wxgui.h" // for wxMessageBox
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
|
||||
// error handler
|
||||
void PatchErrorHandler::printError(class PatchGroup* patchGroup, sint32 lineNumber, std::string_view errorMsg)
|
||||
{
|
||||
@@ -40,13 +37,13 @@ void PatchErrorHandler::printError(class PatchGroup* patchGroup, sint32 lineNumb
|
||||
|
||||
void PatchErrorHandler::showStageErrorMessageBox()
|
||||
{
|
||||
wxString errorMsg;
|
||||
std::string errorMsg;
|
||||
if (m_gp)
|
||||
{
|
||||
if (m_stage == STAGE::PARSER)
|
||||
errorMsg.assign(formatWxString(_("Failed to load patches for graphic pack \'{}\'"), m_gp->GetName()));
|
||||
errorMsg = fmt::format("Failed to load patches for graphic pack \'{}\'", m_gp->GetName());
|
||||
else
|
||||
errorMsg.assign(formatWxString(_("Failed to apply patches for graphic pack \'{}\'"), m_gp->GetName()));
|
||||
errorMsg = fmt::format("Failed to apply patches for graphic pack \'{}\'", m_gp->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -54,17 +51,14 @@ void PatchErrorHandler::showStageErrorMessageBox()
|
||||
}
|
||||
if (cemuLog_isLoggingEnabled(LogType::Patches))
|
||||
{
|
||||
errorMsg.append("\n \n")
|
||||
.append(_("Details:"))
|
||||
.append("\n");
|
||||
errorMsg += "\n\nDetails:\n";
|
||||
for (auto& itr : errorMessages)
|
||||
{
|
||||
errorMsg.append(itr);
|
||||
errorMsg.append("\n");
|
||||
errorMsg += itr;
|
||||
errorMsg += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
wxMessageBox(errorMsg, _("Graphic pack error"));
|
||||
cemuLog_log(LogType::Force, "Graphic pack error: {}", errorMsg);
|
||||
}
|
||||
|
||||
// loads Cemu-style patches (patch_<anything>.asm)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user