mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-15 10:36:59 +02:00
bridge changes/fixes
This commit is contained in:
parent
ed78c78728
commit
5a71f870c6
8 changed files with 37 additions and 89 deletions
|
|
@ -9,6 +9,6 @@
|
||||||
#ifndef AppUI_Bridging_Header_h
|
#ifndef AppUI_Bridging_Header_h
|
||||||
#define AppUI_Bridging_Header_h
|
#define AppUI_Bridging_Header_h
|
||||||
|
|
||||||
#import "Wrapper/AppUIObjC.h"
|
#import "AppUIObjC.h"
|
||||||
|
|
||||||
#endif /* AppUI_Bridging_Header_h */
|
#endif /* AppUI_Bridging_Header_h */
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// AppUIGameInformation.mm - Sudachi
|
// AppUIGameInformation.mm - Sudachi
|
||||||
// Created by Jarrod Norwell on 1/20/24.
|
// Created by Jarrod Norwell on 1/20/24.
|
||||||
|
|
@ -11,7 +8,7 @@
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import "AppUIGameInformation.h"
|
#import "AppUIGameInformation.h"
|
||||||
#import "EmulationSession/EmulationSession.h"
|
#import "EmulationSession.h"
|
||||||
|
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
|
|
@ -20,7 +17,7 @@
|
||||||
#include "core/file_sys/patch_manager.h"
|
#include "core/file_sys/patch_manager.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/loader/nro.h"
|
#include "core/loader/nro.h"
|
||||||
#include "frontend_common/yuzu_config.h"
|
#include "frontend_common/config.h"
|
||||||
|
|
||||||
struct GameMetadata {
|
struct GameMetadata {
|
||||||
std::string title;
|
std::string title;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <MetalKit/MetalKit.h>
|
#import <MetalKit/MetalKit.h>
|
||||||
|
|
||||||
#import "AppUIGameInformation/AppUIGameInformation.h"
|
#import "AppUIGameInformation.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,8 @@
|
||||||
|
|
||||||
#import "AppUIObjC.h"
|
#import "AppUIObjC.h"
|
||||||
|
|
||||||
#import "Config/Config.h"
|
#import "Config.h"
|
||||||
#import "EmulationSession/EmulationSession.h"
|
#import "EmulationSession.h"
|
||||||
#import "DirectoryManager/DirectoryManager.h"
|
|
||||||
|
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
|
|
@ -30,8 +29,6 @@
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/microprofile.h"
|
|
||||||
#include "common/scm_rev.h"
|
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
|
@ -56,8 +53,6 @@
|
||||||
#include "core/hle/service/am/frontend/applets.h"
|
#include "core/hle/service/am/frontend/applets.h"
|
||||||
#include "core/hle/service/filesystem/filesystem.h"
|
#include "core/hle/service/filesystem/filesystem.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "frontend_common/yuzu_config.h"
|
|
||||||
#include "hid_core/frontend/emulated_controller.h"
|
|
||||||
#include "hid_core/hid_core.h"
|
#include "hid_core/hid_core.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
|
|
@ -77,7 +72,7 @@
|
||||||
const char *directory_cstr = [[dir_url path] UTF8String];
|
const char *directory_cstr = [[dir_url path] UTF8String];
|
||||||
|
|
||||||
Common::FS::SetAppDirectory(directory_cstr);
|
Common::FS::SetAppDirectory(directory_cstr);
|
||||||
Config{"config", Config::ConfigType::GlobalConfig};
|
// Config{"config", Config::ConfigType::GlobalConfig};
|
||||||
|
|
||||||
EmulationSession::GetInstance().System().Initialize();
|
EmulationSession::GetInstance().System().Initialize();
|
||||||
EmulationSession::GetInstance().InitializeSystem(false);
|
EmulationSession::GetInstance().InitializeSystem(false);
|
||||||
|
|
@ -87,7 +82,6 @@
|
||||||
Settings::values.dump_shaders.SetValue(true);
|
Settings::values.dump_shaders.SetValue(true);
|
||||||
Settings::values.use_asynchronous_shaders.SetValue(true);
|
Settings::values.use_asynchronous_shaders.SetValue(true);
|
||||||
// Settings::values.astc_recompression.SetValue(Settings::AstcRecompression::Bc3);
|
// Settings::values.astc_recompression.SetValue(Settings::AstcRecompression::Bc3);
|
||||||
Settings::values.shader_backend.SetValue(Settings::ShaderBackend::SpirV);
|
|
||||||
// Settings::values.resolution_setup.SetValue(Settings::ResolutionSetup::Res1X);
|
// Settings::values.resolution_setup.SetValue(Settings::ResolutionSetup::Res1X);
|
||||||
// Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::Bilinear);
|
// Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::Bilinear);
|
||||||
} return self;
|
} return self;
|
||||||
|
|
@ -168,7 +162,7 @@
|
||||||
-(void) configureLayer:(CAMetalLayer *)layer withSize:(CGSize)size {
|
-(void) configureLayer:(CAMetalLayer *)layer withSize:(CGSize)size {
|
||||||
_layer = layer;
|
_layer = layer;
|
||||||
_size = size;
|
_size = size;
|
||||||
EmulationSession::GetInstance().SetNativeWindow((__bridge CA::MetalLayer*)layer, size);
|
EmulationSession::GetInstance().SetNativeWindow(layer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) bootOS {
|
-(void) bootOS {
|
||||||
|
|
@ -251,13 +245,11 @@
|
||||||
-(void) orientationChanged:(UIInterfaceOrientation)orientation with:(CAMetalLayer *)layer size:(CGSize)size {
|
-(void) orientationChanged:(UIInterfaceOrientation)orientation with:(CAMetalLayer *)layer size:(CGSize)size {
|
||||||
_layer = layer;
|
_layer = layer;
|
||||||
_size = size;
|
_size = size;
|
||||||
EmulationSession::GetInstance().Window().OnSurfaceChanged((__bridge CA::MetalLayer*)layer, size);
|
EmulationSession::GetInstance().Window().OnSurfaceChanged(layer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) settingsChanged {
|
-(void) settingsChanged {
|
||||||
Config{"config", Config::ConfigType::GlobalConfig};
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
|
#if __has_include(<Metal/Metal.hpp>)
|
||||||
#import <Metal/Metal.hpp>
|
#import <Metal/Metal.hpp>
|
||||||
#import "EmulationWindow/EmulationWindow.h"
|
#else
|
||||||
|
#import <Metal/Metal.h>
|
||||||
|
#endif
|
||||||
|
#import "EmulationWindow.h"
|
||||||
|
|
||||||
#include "common/detached_tasks.h"
|
#include "common/detached_tasks.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
|
|
@ -34,8 +39,8 @@ public:
|
||||||
|
|
||||||
const EmulationWindow& Window() const;
|
const EmulationWindow& Window() const;
|
||||||
EmulationWindow& Window();
|
EmulationWindow& Window();
|
||||||
CA::MetalLayer* NativeWindow() const;
|
CAMetalLayer* NativeWindow() const;
|
||||||
void SetNativeWindow(CA::MetalLayer* native_window, CGSize size);
|
void SetNativeWindow(CAMetalLayer* native_window, CGSize size);
|
||||||
void SurfaceChanged();
|
void SurfaceChanged();
|
||||||
|
|
||||||
void InitializeGpuDriver();
|
void InitializeGpuDriver();
|
||||||
|
|
@ -73,7 +78,7 @@ private:
|
||||||
private:
|
private:
|
||||||
// Window management
|
// Window management
|
||||||
std::unique_ptr<EmulationWindow> m_window;
|
std::unique_ptr<EmulationWindow> m_window;
|
||||||
CA::MetalLayer* m_native_window{};
|
CAMetalLayer* m_native_window{};
|
||||||
|
|
||||||
// Core emulation
|
// Core emulation
|
||||||
Core::System m_system;
|
Core::System m_system;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/microprofile.h"
|
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
|
@ -53,7 +52,7 @@
|
||||||
#include "core/hle/service/am/frontend/applets.h"
|
#include "core/hle/service/am/frontend/applets.h"
|
||||||
#include "core/hle/service/filesystem/filesystem.h"
|
#include "core/hle/service/filesystem/filesystem.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "frontend_common/yuzu_config.h"
|
#include "frontend_common/config.h"
|
||||||
#include "hid_core/frontend/emulated_controller.h"
|
#include "hid_core/frontend/emulated_controller.h"
|
||||||
#include "hid_core/hid_core.h"
|
#include "hid_core/hid_core.h"
|
||||||
#include "hid_core/hid_types.h"
|
#include "hid_core/hid_types.h"
|
||||||
|
|
@ -99,11 +98,11 @@ EmulationWindow& EmulationSession::Window() {
|
||||||
return *m_window;
|
return *m_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
CA::MetalLayer* EmulationSession::NativeWindow() const {
|
CAMetalLayer* EmulationSession::NativeWindow() const {
|
||||||
return m_native_window;
|
return m_native_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulationSession::SetNativeWindow(CA::MetalLayer* native_window, CGSize size) {
|
void EmulationSession::SetNativeWindow(CAMetalLayer* native_window, CGSize size) {
|
||||||
m_native_window = native_window;
|
m_native_window = native_window;
|
||||||
m_size = size;
|
m_size = size;
|
||||||
}
|
}
|
||||||
|
|
@ -209,17 +208,7 @@ Core::SystemResultStatus EmulationSession::InitializeEmulation(const std::string
|
||||||
m_system.ApplySettings();
|
m_system.ApplySettings();
|
||||||
Settings::LogSettings();
|
Settings::LogSettings();
|
||||||
m_system.HIDCore().ReloadInputDevices();
|
m_system.HIDCore().ReloadInputDevices();
|
||||||
m_system.SetFrontendAppletSet({
|
m_system.SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet{});
|
||||||
nullptr, // Amiibo Settings
|
|
||||||
nullptr, // Controller Selector
|
|
||||||
nullptr, // Error Display
|
|
||||||
nullptr, // Mii Editor
|
|
||||||
nullptr, // Parental Controls
|
|
||||||
nullptr, // Photo Viewer
|
|
||||||
nullptr, // Profile Selector
|
|
||||||
nullptr, // std::move(android_keyboard), // Software Keyboard
|
|
||||||
nullptr, // Web Browser
|
|
||||||
});
|
|
||||||
|
|
||||||
// Initialize filesystem.
|
// Initialize filesystem.
|
||||||
ConfigureFilesystemProvider(filepath);
|
ConfigureFilesystemProvider(filepath);
|
||||||
|
|
@ -270,17 +259,7 @@ Core::SystemResultStatus EmulationSession::BootOS() {
|
||||||
m_system.ApplySettings();
|
m_system.ApplySettings();
|
||||||
Settings::LogSettings();
|
Settings::LogSettings();
|
||||||
m_system.HIDCore().ReloadInputDevices();
|
m_system.HIDCore().ReloadInputDevices();
|
||||||
m_system.SetFrontendAppletSet({
|
m_system.SetFrontendAppletSet(Service::AM::Frontend::FrontendAppletSet{});
|
||||||
nullptr, // Amiibo Settings
|
|
||||||
nullptr, // Controller Selector
|
|
||||||
nullptr, // Error Display
|
|
||||||
nullptr, // Mii Editor
|
|
||||||
nullptr, // Parental Controls
|
|
||||||
nullptr, // Photo Viewer
|
|
||||||
nullptr, // Profile Selector
|
|
||||||
nullptr, // std::move(android_keyboard), // Software Keyboard
|
|
||||||
nullptr, // Web Browser
|
|
||||||
});
|
|
||||||
|
|
||||||
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
|
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
|
||||||
auto bis_system = m_system.GetFileSystemController().GetSystemNANDContents();
|
auto bis_system = m_system.GetFileSystemController().GetSystemNANDContents();
|
||||||
|
|
@ -444,38 +423,6 @@ u64 EmulationSession::GetProgramId(std::string programId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Core::SystemResultStatus RunEmulation(const std::string& filepath,
|
|
||||||
const size_t program_index,
|
|
||||||
const bool frontend_initiated) {
|
|
||||||
MicroProfileOnThreadCreate("EmuThread");
|
|
||||||
SCOPE_EXIT {
|
|
||||||
MicroProfileShutdown();
|
|
||||||
};
|
|
||||||
|
|
||||||
LOG_INFO(Frontend, "starting");
|
|
||||||
|
|
||||||
if (filepath.empty()) {
|
|
||||||
LOG_CRITICAL(Frontend, "failed to load: filepath empty!");
|
|
||||||
return Core::SystemResultStatus::ErrorLoader;
|
|
||||||
}
|
|
||||||
|
|
||||||
SCOPE_EXIT {
|
|
||||||
EmulationSession::GetInstance().ShutdownEmulation();
|
|
||||||
};
|
|
||||||
|
|
||||||
jconst result = EmulationSession::GetInstance().InitializeEmulation(filepath, program_index,
|
|
||||||
frontend_initiated);
|
|
||||||
if (result != Core::SystemResultStatus::Success) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
EmulationSession::GetInstance().RunEmulation();
|
|
||||||
|
|
||||||
return Core::SystemResultStatus::Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool EmulationSession::IsHandheldOnly() {
|
bool EmulationSession::IsHandheldOnly() {
|
||||||
jconst npad_style_set = m_system.HIDCore().GetSupportedStyleTag();
|
jconst npad_style_set = m_system.HIDCore().GetSupportedStyleTag();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,15 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if __has_include(<Metal/Metal.hpp>)
|
||||||
#import <Metal/Metal.hpp>
|
#import <Metal/Metal.hpp>
|
||||||
|
#else
|
||||||
|
#import <Metal/Metal.h>
|
||||||
|
#endif
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
@ -38,12 +44,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
class EmulationWindow final : public Core::Frontend::EmuWindow {
|
class EmulationWindow final : public Core::Frontend::EmuWindow {
|
||||||
public:
|
public:
|
||||||
EmulationWindow(InputCommon::InputSubsystem* input_subsystem, CA::MetalLayer* surface, CGSize size,
|
EmulationWindow(InputCommon::InputSubsystem* input_subsystem, CAMetalLayer* surface, CGSize size,
|
||||||
std::shared_ptr<Common::DynamicLibrary> driver_library);
|
std::shared_ptr<Common::DynamicLibrary> driver_library);
|
||||||
|
|
||||||
~EmulationWindow() = default;
|
~EmulationWindow() = default;
|
||||||
|
|
||||||
void OnSurfaceChanged(CA::MetalLayer* surface, CGSize size);
|
void OnSurfaceChanged(CAMetalLayer* surface, CGSize size);
|
||||||
void OrientationChanged(UIInterfaceOrientation orientation);
|
void OrientationChanged(UIInterfaceOrientation orientation);
|
||||||
void OnFrameDisplayed() override;
|
void OnFrameDisplayed() override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "EmulationWindow.h"
|
#import "EmulationWindow.h"
|
||||||
#import "EmulationSession/EmulationSession.h"
|
#import "EmulationSession.h"
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#include "input_common/drivers/virtual_gamepad.h"
|
#include "input_common/drivers/virtual_gamepad.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
|
|
||||||
void EmulationWindow::OnSurfaceChanged(CA::MetalLayer* surface, CGSize size) {
|
void EmulationWindow::OnSurfaceChanged(CAMetalLayer* surface, CGSize size) {
|
||||||
m_size = size;
|
m_size = size;
|
||||||
|
|
||||||
m_window_width = size.width;
|
m_window_width = size.width;
|
||||||
|
|
@ -26,7 +26,7 @@ void EmulationWindow::OnSurfaceChanged(CA::MetalLayer* surface, CGSize size) {
|
||||||
// Ensures that we emulate with the correct aspect ratio.
|
// Ensures that we emulate with the correct aspect ratio.
|
||||||
// UpdateCurrentFramebufferLayout(m_window_width, m_window_height);
|
// UpdateCurrentFramebufferLayout(m_window_width, m_window_height);
|
||||||
|
|
||||||
window_info.render_surface = reinterpret_cast<void*>(surface);
|
window_info.render_surface = (__bridge void *)surface;
|
||||||
window_info.render_surface_scale = [[UIScreen mainScreen] nativeScale];
|
window_info.render_surface_scale = [[UIScreen mainScreen] nativeScale];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,7 +68,8 @@ void EmulationWindow::OnFrameDisplayed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EmulationWindow::EmulationWindow(InputCommon::InputSubsystem* input_subsystem, CA::MetalLayer* surface, CGSize size, std::shared_ptr<Common::DynamicLibrary> driver_library) : m_input_subsystem{input_subsystem}, m_size{size}, m_driver_library{driver_library} {
|
EmulationWindow::EmulationWindow(InputCommon::InputSubsystem* input_subsystem, CAMetalLayer* surface, CGSize size, std::shared_ptr<Common::DynamicLibrary> driver_library)
|
||||||
|
: m_window_width{}, m_window_height{}, m_size{size}, is_portrait{true}, m_input_subsystem{input_subsystem}, m_driver_library{driver_library}, m_first_frame{false} {
|
||||||
LOG_INFO(Frontend, "initializing");
|
LOG_INFO(Frontend, "initializing");
|
||||||
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue