early-access version 3954

This commit is contained in:
pineappleEA 2023-10-30 17:13:18 +01:00
parent b40dc6dc14
commit 29585a9cf6
5 changed files with 61 additions and 20 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3953. This is the source code for early-access 3954.
## Legal Notice ## Legal Notice

View File

@ -15,6 +15,7 @@ import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.os.SystemClock
import android.view.* import android.view.*
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
@ -25,6 +26,7 @@ import androidx.core.graphics.Insets
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.drawerlayout.widget.DrawerLayout import androidx.drawerlayout.widget.DrawerLayout
import androidx.drawerlayout.widget.DrawerLayout.DrawerListener
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
@ -156,6 +158,32 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
binding.showFpsText.setTextColor(Color.YELLOW) binding.showFpsText.setTextColor(Color.YELLOW)
binding.doneControlConfig.setOnClickListener { stopConfiguringControls() } binding.doneControlConfig.setOnClickListener { stopConfiguringControls() }
binding.drawerLayout.addDrawerListener(object : DrawerListener {
override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
binding.surfaceInputOverlay.dispatchTouchEvent(
MotionEvent.obtain(
SystemClock.uptimeMillis(),
SystemClock.uptimeMillis() + 100,
MotionEvent.ACTION_UP,
0f,
0f,
0
)
)
}
override fun onDrawerOpened(drawerView: View) {
// No op
}
override fun onDrawerClosed(drawerView: View) {
// No op
}
override fun onDrawerStateChanged(newState: Int) {
// No op
}
})
binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED)
binding.inGameMenu.getHeaderView(0).findViewById<TextView>(R.id.text_game_title).text = binding.inGameMenu.getHeaderView(0).findViewById<TextView>(R.id.text_game_title).text =
game.title game.title

View File

@ -49,6 +49,9 @@ class GamesViewModel : ViewModel() {
// Retrieve list of cached games // Retrieve list of cached games
val storedGames = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) val storedGames = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext)
.getStringSet(GameHelper.KEY_GAMES, emptySet()) .getStringSet(GameHelper.KEY_GAMES, emptySet())
viewModelScope.launch {
withContext(Dispatchers.IO) {
if (storedGames!!.isNotEmpty()) { if (storedGames!!.isNotEmpty()) {
val deserializedGames = mutableSetOf<Game>() val deserializedGames = mutableSetOf<Game>()
storedGames.forEach { storedGames.forEach {
@ -60,8 +63,10 @@ class GamesViewModel : ViewModel() {
} }
val gameExists = val gameExists =
DocumentFile.fromSingleUri(YuzuApplication.appContext, Uri.parse(game.path)) DocumentFile.fromSingleUri(
?.exists() YuzuApplication.appContext,
Uri.parse(game.path)
)?.exists()
if (gameExists == true) { if (gameExists == true) {
deserializedGames.add(game) deserializedGames.add(game)
} }
@ -70,6 +75,8 @@ class GamesViewModel : ViewModel() {
} }
reloadGames(false) reloadGames(false)
} }
}
}
fun setGames(games: List<Game>) { fun setGames(games: List<Game>) {
val sortedList = games.sortedWith( val sortedList = games.sortedWith(

View File

@ -147,6 +147,9 @@ bool Swapchain::AcquireNextImage() {
case VK_ERROR_OUT_OF_DATE_KHR: case VK_ERROR_OUT_OF_DATE_KHR:
is_outdated = true; is_outdated = true;
break; break;
case VK_ERROR_SURFACE_LOST_KHR:
vk::Check(result);
break;
default: default:
LOG_ERROR(Render_Vulkan, "vkAcquireNextImageKHR returned {}", vk::ToString(result)); LOG_ERROR(Render_Vulkan, "vkAcquireNextImageKHR returned {}", vk::ToString(result));
break; break;
@ -180,6 +183,9 @@ void Swapchain::Present(VkSemaphore render_semaphore) {
case VK_ERROR_OUT_OF_DATE_KHR: case VK_ERROR_OUT_OF_DATE_KHR:
is_outdated = true; is_outdated = true;
break; break;
case VK_ERROR_SURFACE_LOST_KHR:
vk::Check(result);
break;
default: default:
LOG_CRITICAL(Render_Vulkan, "Failed to present with error {}", vk::ToString(result)); LOG_CRITICAL(Render_Vulkan, "Failed to present with error {}", vk::ToString(result));
break; break;

View File

@ -2908,7 +2908,7 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga
const std::string game_file_name = std::filesystem::path(game_path).filename().string(); const std::string game_file_name = std::filesystem::path(game_path).filename().string();
// Determine full paths for icon and shortcut // Determine full paths for icon and shortcut
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
const char* home = std::getenv("HOME"); const char* home = std::getenv("HOME");
const std::filesystem::path home_path = (home == nullptr ? "~" : home); const std::filesystem::path home_path = (home == nullptr ? "~" : home);
const char* xdg_data_home = std::getenv("XDG_DATA_HOME"); const char* xdg_data_home = std::getenv("XDG_DATA_HOME");
@ -2965,7 +2965,7 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga
QImage icon_data = QImage icon_data =
QImage::fromData(icon_image_file.data(), static_cast<int>(icon_image_file.size())); QImage::fromData(icon_image_file.data(), static_cast<int>(icon_image_file.size()));
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
// Convert and write the icon as a PNG // Convert and write the icon as a PNG
if (!icon_data.save(QString::fromStdString(icon_path.string()))) { if (!icon_data.save(QString::fromStdString(icon_path.string()))) {
LOG_ERROR(Frontend, "Could not write icon as PNG to file"); LOG_ERROR(Frontend, "Could not write icon as PNG to file");
@ -4004,7 +4004,7 @@ bool GMainWindow::CreateShortcut(const std::string& shortcut_path, const std::st
const std::string& comment, const std::string& icon_path, const std::string& comment, const std::string& icon_path,
const std::string& command, const std::string& arguments, const std::string& command, const std::string& arguments,
const std::string& categories, const std::string& keywords) { const std::string& categories, const std::string& keywords) {
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
// This desktop file template was writing referencing // This desktop file template was writing referencing
// https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html // https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html
std::string shortcut_contents{}; std::string shortcut_contents{};