mirror of
https://github.com/izzy2lost/WeeU.git
synced 2026-07-06 00:19:59 -07:00
Add missing overlay button
This commit is contained in:
@@ -254,6 +254,7 @@ if(ANDROID)
|
||||
add_subdirectory("dependencies/libadrenotools" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
add_subdirectory("dependencies/libucontext" EXCLUDE_FROM_ALL)
|
||||
add_subdirectory("dependencies/stb" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.21.1)
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
|
||||
project(libucontext LANGUAGES C ASM)
|
||||
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
|
||||
project(stb LANGUAGES C)
|
||||
|
||||
add_library(stb INTERFACE)
|
||||
|
||||
target_include_directories(stb INTERFACE include)
|
||||
@@ -46,7 +46,7 @@ val cemuDataFilesFolder = "../../../bin"
|
||||
|
||||
android {
|
||||
namespace = "info.cemu.cemu"
|
||||
compileSdk = 35
|
||||
compileSdk = 36
|
||||
ndkVersion = "26.3.11579264"
|
||||
defaultConfig {
|
||||
applicationId = "info.cemu.cemu"
|
||||
@@ -231,6 +231,7 @@ dependencies {
|
||||
implementation(libs.androidx.ui.graphics)
|
||||
implementation(libs.androidx.compose.material3)
|
||||
testImplementation(libs.junit)
|
||||
testImplementation(libs.archunit.junit4)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu
|
||||
package info.cemu.cemu.tests
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.junit.Assert.*
|
||||
@@ -26,7 +26,7 @@ class AndroidFilesystemCallbacks : public FilesystemAndroid::FilesystemCallbacks
|
||||
AndroidFilesystemCallbacks()
|
||||
{
|
||||
JNIUtils::ScopedJNIENV env;
|
||||
m_fileUtilClass = JNIUtils::Scopedjclass("info/cemu/cemu/nativeinterface/NativeFilesKt");
|
||||
m_fileUtilClass = JNIUtils::Scopedjclass("info/cemu/cemu/nativeinterface/NativeFiles");
|
||||
m_openContentUriMid = env->GetStaticMethodID(*m_fileUtilClass, "openContentUri", "(Ljava/lang/String;)I");
|
||||
m_listFilesMid = env->GetStaticMethodID(*m_fileUtilClass, "listFiles", "(Ljava/lang/String;)[Ljava/lang/String;");
|
||||
m_isDirectoryMid = env->GetStaticMethodID(*m_fileUtilClass, "isDirectory", "(Ljava/lang/String;)Z");
|
||||
|
||||
@@ -29,4 +29,5 @@ target_link_libraries(CemuAndroid PRIVATE
|
||||
CemuBin
|
||||
CemuGui
|
||||
ZArchive::zarchive
|
||||
stb
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STBI_ONLY_TGA
|
||||
|
||||
#include "stb_image.h"
|
||||
#include <stb_image.h>
|
||||
|
||||
Image::Image(Image&& image)
|
||||
{
|
||||
@@ -21,14 +21,8 @@ Image::Image(const std::vector<uint8>& imageBytes)
|
||||
return;
|
||||
for (size_t i = 0; i < m_width * m_height * 4; i += 4)
|
||||
{
|
||||
uint8 r = stbImage[i];
|
||||
uint8 g = stbImage[i + 1];
|
||||
uint8 b = stbImage[i + 2];
|
||||
uint8 a = stbImage[i + 3];
|
||||
stbImage[i] = b;
|
||||
stbImage[i + 1] = g;
|
||||
stbImage[i + 2] = r;
|
||||
stbImage[i + 3] = a;
|
||||
// RGBA -> BGRA
|
||||
std::swap(stbImage[i + 0], stbImage[i + 2]);
|
||||
}
|
||||
m_colors = reinterpret_cast<sint32*>(stbImage);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
package info.cemu.cemu
|
||||
|
||||
import android.app.Application
|
||||
import android.content.res.Resources
|
||||
import android.util.Log
|
||||
import info.cemu.cemu.core.translation.setLanguage
|
||||
import info.cemu.cemu.core.translation.setTranslations
|
||||
import info.cemu.cemu.common.context.internalFolder
|
||||
import info.cemu.cemu.common.translation.setLanguage
|
||||
import info.cemu.cemu.common.translation.setTranslations
|
||||
import info.cemu.cemu.nativeinterface.NativeActiveSettings.initializeActiveSettings
|
||||
import info.cemu.cemu.nativeinterface.NativeActiveSettings.setInternalDir
|
||||
import info.cemu.cemu.nativeinterface.NativeActiveSettings.setNativeLibDir
|
||||
import info.cemu.cemu.nativeinterface.NativeEmulation.initializeEmulation
|
||||
import info.cemu.cemu.nativeinterface.NativeEmulation.setDPI
|
||||
import info.cemu.cemu.nativeinterface.NativeGraphicPacks.refreshGraphicPacks
|
||||
import info.cemu.cemu.nativeinterface.NativeLocalization
|
||||
import info.cemu.cemu.nativeinterface.NativeLogging.crashLog
|
||||
import info.cemu.cemu.nativeinterface.NativeSwkbd.initializeSwkbd
|
||||
import info.cemu.cemu.settings.SettingsManager
|
||||
import info.cemu.cemu.utils.parsePoFile
|
||||
import info.cemu.cemu.common.settings.SettingsManager
|
||||
import info.cemu.cemu.nativeinterface.NativeFiles
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.PrintWriter
|
||||
@@ -23,30 +21,25 @@ import java.io.StringWriter
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class CemuApplication : Application() {
|
||||
init {
|
||||
Application = this
|
||||
}
|
||||
|
||||
val internalFolder: File
|
||||
get() {
|
||||
val externalFilesDir = getExternalFilesDir(null)
|
||||
if (externalFilesDir != null) {
|
||||
return externalFilesDir
|
||||
}
|
||||
return filesDir
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
configureExceptionHandler()
|
||||
|
||||
SettingsManager.initialize(this)
|
||||
|
||||
NativeFiles.initialize(contentResolver)
|
||||
|
||||
initializeTranslations()
|
||||
|
||||
initializeCemu()
|
||||
|
||||
saveDataFiles()
|
||||
}
|
||||
|
||||
private fun initializeTranslations() {
|
||||
setTranslations(this)
|
||||
setLanguage(SettingsManager(this).guiSettings.language, this)
|
||||
setLanguage(SettingsManager.guiSettings.language, this)
|
||||
}
|
||||
|
||||
private fun saveDataFiles() {
|
||||
@@ -143,10 +136,10 @@ class CemuApplication : Application() {
|
||||
}
|
||||
|
||||
private val internalCemuDataFolder: String
|
||||
get() = internalFolder.resolve("data").toString()
|
||||
get() = internalFolder().resolve("data").toString()
|
||||
|
||||
private val internalCemuUserFolder: String
|
||||
get() = internalFolder.toString()
|
||||
get() = internalFolder().toString()
|
||||
|
||||
companion object {
|
||||
init {
|
||||
@@ -154,9 +147,5 @@ class CemuApplication : Application() {
|
||||
}
|
||||
|
||||
private var DefaultUncaughtExceptionHandler: Thread.UncaughtExceptionHandler? = null
|
||||
|
||||
@JvmStatic
|
||||
lateinit var Application: CemuApplication
|
||||
private set
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package info.cemu.cemu
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.app.PendingIntent
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.ShortcutInfo
|
||||
import android.content.pm.ShortcutManager
|
||||
import android.os.Bundle
|
||||
import android.provider.DocumentsContract
|
||||
import android.widget.Toast
|
||||
@@ -24,6 +26,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.asAndroidBitmap
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.documentfile.provider.DocumentFile
|
||||
@@ -31,9 +34,9 @@ import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import info.cemu.cemu.about.AboutCemuRoute
|
||||
import info.cemu.cemu.about.aboutCemuNavigation
|
||||
import info.cemu.cemu.core.components.ActivityContent
|
||||
import info.cemu.cemu.core.translation.TranslatableContent
|
||||
import info.cemu.cemu.core.translation.tr
|
||||
import info.cemu.cemu.common.components.ActivityContent
|
||||
import info.cemu.cemu.common.translation.TranslatableContent
|
||||
import info.cemu.cemu.common.translation.tr
|
||||
import info.cemu.cemu.emulation.EmulationActivity
|
||||
import info.cemu.cemu.gamelist.GameListRoute
|
||||
import info.cemu.cemu.gamelist.gameListNavigation
|
||||
@@ -49,6 +52,9 @@ import info.cemu.cemu.titlemanager.TitleManagerRoute
|
||||
import info.cemu.cemu.titlemanager.titleManagerNavigation
|
||||
import java.io.File
|
||||
|
||||
import android.graphics.drawable.Icon as AndroidIcon
|
||||
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@@ -72,16 +78,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun startGame(context: Context, game: Game) {
|
||||
Intent(
|
||||
context,
|
||||
EmulationActivity::class.java
|
||||
).apply {
|
||||
putExtra(EmulationActivity.EXTRA_LAUNCH_PATH, game.path)
|
||||
context.startActivity(this)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MainNav() {
|
||||
val navController = rememberNavController()
|
||||
@@ -93,7 +89,11 @@ private fun MainNav() {
|
||||
enterTransition = { EnterTransition.None },
|
||||
exitTransition = { ExitTransition.None }
|
||||
) {
|
||||
gameListNavigation(navController, startGame = { startGame(context, it) }) {
|
||||
gameListNavigation(
|
||||
navController = navController,
|
||||
startGame = { startGame(context, it) },
|
||||
createShortcut = { createShortcutForGame(context, it) }
|
||||
) {
|
||||
GameListToolBarActionsMenu(
|
||||
goToSettings = { navController.navigate(SettingsRoute) },
|
||||
goToTitleManager = { navController.navigate(TitleManagerRoute) },
|
||||
@@ -168,6 +168,16 @@ private fun GameListToolBarActionsMenu(
|
||||
}
|
||||
}
|
||||
|
||||
private fun startGame(context: Context, game: Game) {
|
||||
Intent(
|
||||
context,
|
||||
EmulationActivity::class.java
|
||||
).apply {
|
||||
putExtra(EmulationActivity.EXTRA_LAUNCH_PATH, game.path)
|
||||
context.startActivity(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun shareLogFile(context: Context) {
|
||||
val logFileName = "log.txt"
|
||||
val logFile = File(NativeActiveSettings.getUserDataPath()).resolve(logFileName)
|
||||
@@ -207,7 +217,59 @@ private fun openCemuFolder(context: Context) {
|
||||
DocumentsProvider.ROOT_ID
|
||||
)
|
||||
context.startActivity(intent)
|
||||
} catch (activityNotFoundException: ActivityNotFoundException) {
|
||||
} catch (_: Exception) {
|
||||
Toast.makeText(context, tr("Could not open Cemu folder"), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun createShortcutForGame(
|
||||
context: Context,
|
||||
game: Game,
|
||||
) {
|
||||
fun onFailedToCreateShortcut() {
|
||||
Toast.makeText(context, tr("Couldn't create shortcut for game"), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
try {
|
||||
val shortcutManager = context.getSystemService(
|
||||
ShortcutManager::class.java
|
||||
)
|
||||
if (!shortcutManager.isRequestPinShortcutSupported) {
|
||||
onFailedToCreateShortcut()
|
||||
return
|
||||
}
|
||||
|
||||
val icon = game.icon?.asAndroidBitmap().let {
|
||||
if (it != null) AndroidIcon.createWithBitmap(it)
|
||||
else AndroidIcon.createWithResource(context, R.mipmap.ic_launcher)
|
||||
}
|
||||
|
||||
val intent = Intent(
|
||||
context,
|
||||
EmulationActivity::class.java
|
||||
)
|
||||
intent.action = Intent.ACTION_VIEW
|
||||
intent.putExtra(EmulationActivity.EXTRA_LAUNCH_PATH, game.path)
|
||||
|
||||
val pinShortcutInfo = ShortcutInfo.Builder(context, game.titleId.toString())
|
||||
.setShortLabel(game.name!!)
|
||||
.setIntent(intent)
|
||||
.setIcon(icon)
|
||||
.build()
|
||||
|
||||
val pinnedShortcutCallbackIntent =
|
||||
shortcutManager.createShortcutResultIntent(pinShortcutInfo)
|
||||
|
||||
val successCallback = PendingIntent.getBroadcast(
|
||||
context,
|
||||
0,
|
||||
pinnedShortcutCallbackIntent,
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
|
||||
shortcutManager.requestPinShortcut(pinShortcutInfo, successCallback.intentSender)
|
||||
} catch (_: Exception) {
|
||||
onFailedToCreateShortcut()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ import com.mikepenz.aboutlibraries.ui.compose.m3.libraryColors
|
||||
import com.mikepenz.aboutlibraries.ui.compose.util.author
|
||||
import info.cemu.cemu.BuildConfig
|
||||
import info.cemu.cemu.R
|
||||
import info.cemu.cemu.core.components.ScreenContentLazy
|
||||
import info.cemu.cemu.core.translation.tr
|
||||
import info.cemu.cemu.common.components.ScreenContentLazy
|
||||
import info.cemu.cemu.common.translation.tr
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
typealias AboutLibrary = com.mikepenz.aboutlibraries.entity.Library
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu.utils
|
||||
package info.cemu.cemu.common.canvas
|
||||
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import info.cemu.cemu.core.theme.CemuTheme
|
||||
import info.cemu.cemu.common.theme.CemuTheme
|
||||
|
||||
@Composable
|
||||
fun ActivityContent(content: @Composable () -> Unit) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Text
|
||||
+1
-3
@@ -1,6 +1,6 @@
|
||||
@file:OptIn(ExperimentalMaterial3Api::class)
|
||||
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@@ -24,12 +24,10 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.compose.dropUnlessResumed
|
||||
import info.cemu.cemu.R
|
||||
|
||||
@Composable
|
||||
fun ScreenContent(
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package info.cemu.cemu.core.components
|
||||
package info.cemu.cemu.common.components
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@@ -30,7 +30,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import info.cemu.cemu.core.translation.tr
|
||||
import info.cemu.cemu.common.translation.tr
|
||||
|
||||
@Composable
|
||||
fun SingleSelection(
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user