forked from MeloNX/MeloNX
Add comments to explain stuff and other stuff
This commit is contained in:
parent
0b6518d7e3
commit
c8db129402
@ -15,11 +15,11 @@ namespace ARMeilleure.Translation.Cache
|
|||||||
static partial class JitCache
|
static partial class JitCache
|
||||||
{
|
{
|
||||||
private static readonly int _pageSize = (int)MemoryBlock.GetPageSize();
|
private static readonly int _pageSize = (int)MemoryBlock.GetPageSize();
|
||||||
private static readonly int _pageMask = _pageSize - 8;
|
private static readonly int _pageMask = _pageSize - 4;
|
||||||
|
|
||||||
private const int CodeAlignment = 4; // Bytes.
|
private const int CodeAlignment = 4; // Bytes.
|
||||||
private const int CacheSize = 128 * 1024 * 1024;
|
private const int CacheSize = 1024 * 1024 * 1024;
|
||||||
private const int CacheSizeIOS = 64 * 1024 * 1024;
|
private const int CacheSizeIOS = 128 * 1024 * 1024;
|
||||||
|
|
||||||
private static ReservedRegion _jitRegion;
|
private static ReservedRegion _jitRegion;
|
||||||
private static JitCacheInvalidation _jitCacheInvalidator;
|
private static JitCacheInvalidation _jitCacheInvalidator;
|
||||||
|
@ -650,6 +650,7 @@
|
|||||||
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 0.0.8;
|
MARKETING_VERSION = 0.0.8;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;
|
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;
|
||||||
@ -702,6 +703,7 @@
|
|||||||
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
|
"$(PROJECT_DIR)/MeloNX/Dependencies/Dynamic\\ Libraries",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 0.0.8;
|
MARKETING_VERSION = 0.0.8;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;
|
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;
|
||||||
|
Binary file not shown.
@ -12,12 +12,12 @@
|
|||||||
<key>Ryujinx.xcscheme_^#shared#^_</key>
|
<key>Ryujinx.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>4</integer>
|
<integer>2</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>com.Stossy11.MeloNX.RyujinxAg.xcscheme_^#shared#^_</key>
|
<key>com.Stossy11.MeloNX.RyujinxAg.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>3</integer>
|
<integer>1</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SuppressBuildableAutocreation</key>
|
<key>SuppressBuildableAutocreation</key>
|
||||||
|
@ -12,6 +12,7 @@ import SwiftUI
|
|||||||
|
|
||||||
var hostingController: UIHostingController<ControllerView>? // Store reference to prevent deallocation
|
var hostingController: UIHostingController<ControllerView>? // Store reference to prevent deallocation
|
||||||
|
|
||||||
|
// Swts up a timer that adds subview to the Window and Repeats until the ControllerView is found in the Window to ensure that the controller shows.
|
||||||
func waitForController() {
|
func waitForController() {
|
||||||
guard let window = theWindow else { return }
|
guard let window = theWindow else { return }
|
||||||
|
|
||||||
@ -40,8 +41,10 @@ func waitForController() {
|
|||||||
containerView.frame = window.bounds
|
containerView.frame = window.bounds
|
||||||
containerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
containerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||||
|
|
||||||
|
// Timer for controller
|
||||||
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
|
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
|
||||||
if findGCControllerView(in: window) == nil {
|
if findGCControllerView(in: window) == nil {
|
||||||
|
// Adds Virtual Controller Subview
|
||||||
window.addSubview(containerView)
|
window.addSubview(containerView)
|
||||||
window.bringSubviewToFront(containerView)
|
window.bringSubviewToFront(containerView)
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ import UIKit
|
|||||||
|
|
||||||
var theWindow: UIWindow? = nil
|
var theWindow: UIWindow? = nil
|
||||||
extension UIWindow {
|
extension UIWindow {
|
||||||
|
// Makes the SDLWindow use the current WindowScene instead of making its own window.
|
||||||
|
// Also waits for the window to append the on-screen controller
|
||||||
@objc func wdb_makeKeyAndVisible() {
|
@objc func wdb_makeKeyAndVisible() {
|
||||||
if #available(iOS 13.0, *) {
|
if #available(iOS 13.0, *) {
|
||||||
self.windowScene = (UIApplication.shared.connectedScenes.first! as! UIWindowScene)
|
self.windowScene = (UIApplication.shared.connectedScenes.first! as! UIWindowScene)
|
||||||
@ -29,7 +31,7 @@ extension UIWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Patches makeKeyAndVisible to wdb_makeKeyAndVisible
|
||||||
func patchMakeKeyAndVisible() {
|
func patchMakeKeyAndVisible() {
|
||||||
let uiwindowClass = UIWindow.self
|
let uiwindowClass = UIWindow.self
|
||||||
if let m1 = class_getInstanceMethod(uiwindowClass, #selector(UIWindow.makeKeyAndVisible)),
|
if let m1 = class_getInstanceMethod(uiwindowClass, #selector(UIWindow.makeKeyAndVisible)),
|
||||||
|
@ -182,11 +182,15 @@ class Ryujinx {
|
|||||||
func MainThread(_ block: @escaping @Sendable () -> Void) {
|
func MainThread(_ block: @escaping @Sendable () -> Void) {
|
||||||
if #available(iOS 17.0, *) {
|
if #available(iOS 17.0, *) {
|
||||||
RunLoop.current.perform {
|
RunLoop.current.perform {
|
||||||
block()
|
autoreleasepool {
|
||||||
|
block()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
block()
|
autoreleasepool {
|
||||||
|
block()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,23 +19,31 @@ struct MoltenVKSettings: Codable, Hashable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ContentView: View {
|
struct ContentView: View {
|
||||||
// MARK: - Properties
|
// Games
|
||||||
@State private var theWindow: UIWindow?
|
|
||||||
@State private var game: Game?
|
@State private var game: Game?
|
||||||
|
|
||||||
|
// Controllers
|
||||||
@State private var controllersList: [Controller] = []
|
@State private var controllersList: [Controller] = []
|
||||||
@State private var currentControllers: [Controller] = []
|
@State private var currentControllers: [Controller] = []
|
||||||
|
@State var onscreencontroller: Controller = Controller(id: "", name: "")
|
||||||
|
@State private var isVirtualControllerActive: Bool = false
|
||||||
|
@AppStorage("isVirtualController") var isVCA: Bool = true
|
||||||
|
|
||||||
|
// Settings and Configuration
|
||||||
@State private var config: Ryujinx.Configuration
|
@State private var config: Ryujinx.Configuration
|
||||||
@State var settings: [MoltenVKSettings]
|
@State var settings: [MoltenVKSettings]
|
||||||
@AppStorage("useTrollStore") var useTrollStore: Bool = false
|
@AppStorage("useTrollStore") var useTrollStore: Bool = false
|
||||||
@State private var isVirtualControllerActive: Bool = false
|
|
||||||
@AppStorage("isVirtualController") var isVCA: Bool = true
|
// JIT
|
||||||
@State var onscreencontroller: Controller = Controller(id: "", name: "")
|
|
||||||
@AppStorage("JIT") var isJITEnabled: Bool = false
|
@AppStorage("JIT") var isJITEnabled: Bool = false
|
||||||
|
|
||||||
|
// Other Configuration
|
||||||
@State var isMK8: Bool = false
|
@State var isMK8: Bool = false
|
||||||
@AppStorage("quit") var quit: Bool = false
|
@AppStorage("quit") var quit: Bool = false
|
||||||
|
@State var quits: Bool = false
|
||||||
@AppStorage("MVK_CONFIG_PREFILL_METAL_COMMAND_BUFFERS") var mVKPreFillBuffer: Bool = true
|
@AppStorage("MVK_CONFIG_PREFILL_METAL_COMMAND_BUFFERS") var mVKPreFillBuffer: Bool = true
|
||||||
|
|
||||||
@State var quits: Bool = false
|
// Loading Animation
|
||||||
@State private var clumpOffset: CGFloat = -100
|
@State private var clumpOffset: CGFloat = -100
|
||||||
private let clumpWidth: CGFloat = 100
|
private let clumpWidth: CGFloat = 100
|
||||||
private let animationDuration: Double = 1.0
|
private let animationDuration: Double = 1.0
|
||||||
@ -50,11 +58,11 @@ struct ContentView: View {
|
|||||||
let defaultSettings: [MoltenVKSettings] = [
|
let defaultSettings: [MoltenVKSettings] = [
|
||||||
// MoltenVKSettings(string: "MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS", value: "1"),
|
// MoltenVKSettings(string: "MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS", value: "1"),
|
||||||
// MoltenVKSettings(string: "MVK_CONFIG_PREFILL_METAL_COMMAND_BUFFERS", value: "2"),
|
// MoltenVKSettings(string: "MVK_CONFIG_PREFILL_METAL_COMMAND_BUFFERS", value: "2"),
|
||||||
|
// Metal Private API isn't needed and causes more stutters
|
||||||
MoltenVKSettings(string: "MVK_USE_METAL_PRIVATE_API", value: "0"),
|
MoltenVKSettings(string: "MVK_USE_METAL_PRIVATE_API", value: "0"),
|
||||||
// MoltenVKSettings(string: "MVK_CONFIG_RESUME_LOST_DEVICE", value: "1"),
|
MoltenVKSettings(string: "MVK_CONFIG_USE_METAL_PRIVATE_API", value: "0"),
|
||||||
MoltenVKSettings(string: "MVK_CONFIG_MAX_ACTIVE_METAL_COMMAND_BUFFERS_PER_QUEUE", value: "192"),
|
// Uses more ram but makes performance higher, may add an option in settings to change or enable / disable this value (default 64 or 192 depending on what i decide)
|
||||||
//MVK_CONFIG_LOG_LEVEL
|
MoltenVKSettings(string: "MVK_CONFIG_MAX_ACTIVE_METAL_COMMAND_BUFFERS_PER_QUEUE", value: "1024"),
|
||||||
MoltenVKSettings(string: "MVK_CONFIG_USE_METAL_PRIVATE_API", value: "0")
|
|
||||||
]
|
]
|
||||||
|
|
||||||
_settings = State(initialValue: defaultSettings)
|
_settings = State(initialValue: defaultSettings)
|
||||||
@ -70,6 +78,8 @@ struct ContentView: View {
|
|||||||
if isLoading {
|
if isLoading {
|
||||||
emulationView
|
emulationView
|
||||||
.onAppear() {
|
.onAppear() {
|
||||||
|
// This is fro the old exiting game feature that didn't work properly. will look into it and figure out a better alternative
|
||||||
|
/*
|
||||||
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
|
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
|
||||||
timer.invalidate()
|
timer.invalidate()
|
||||||
quits = quit
|
quits = quit
|
||||||
@ -79,8 +89,10 @@ struct ContentView: View {
|
|||||||
timer.invalidate()
|
timer.invalidate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// This is when the game starts to stop the animation
|
||||||
VStack {
|
VStack {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -89,11 +101,12 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// This is the main menu view that includes the Settings and the Game Selector
|
||||||
mainMenuView
|
mainMenuView
|
||||||
.onAppear() {
|
.onAppear() {
|
||||||
quits = false
|
quits = false
|
||||||
|
|
||||||
initControllerObservers()
|
initControllerObservers() // This initializes the Controller Observers that refreshes the controller list when a new controller connecvts.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,12 +230,12 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Helper Methods
|
// MARK: - Helper Methods
|
||||||
var SdlInitFlags: uint = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO;
|
var SdlInitFlags: uint = SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_VIDEO; // Initialises SDL2 for Events, Game Controller, Joystick, Audio and Video.
|
||||||
private func initializeSDL() {
|
private func initializeSDL() {
|
||||||
setMoltenVKSettings()
|
setMoltenVKSettings()
|
||||||
SDL_SetMainReady()
|
SDL_SetMainReady() // Sets SDL Ready
|
||||||
SDL_iPhoneSetEventPump(SDL_TRUE)
|
SDL_iPhoneSetEventPump(SDL_TRUE) // Allow iOS Set Event Pump (Check out SDL2 Documentation here)
|
||||||
SDL_Init(SdlInitFlags)
|
SDL_Init(SdlInitFlags) // Initialises SDL2
|
||||||
initialize()
|
initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,9 +318,8 @@ struct ContentView: View {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Sets MoltenVK Environment Variables
|
||||||
private func setMoltenVKSettings() {
|
private func setMoltenVKSettings() {
|
||||||
|
|
||||||
settings.forEach { setting in
|
settings.forEach { setting in
|
||||||
setenv(setting.string, setting.value, 1)
|
setenv(setting.string, setting.value, 1)
|
||||||
}
|
}
|
||||||
|
@ -449,9 +449,10 @@ struct GameListRow: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
// Add info action
|
let pasteboard = UIPasteboard.general
|
||||||
|
pasteboard.string = game.titleId
|
||||||
} label: {
|
} label: {
|
||||||
Label("Game Info", systemImage: "info.circle")
|
Label("Game ID: \(game.titleId)", systemImage: "info.circle")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>com.apple.developer.kernel.extended-virtual-addressing</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.developer.kernel.increased-debugging-memory-limit</key>
|
||||||
|
<true/>
|
||||||
<key>com.apple.developer.kernel.increased-memory-limit</key>
|
<key>com.apple.developer.kernel.increased-memory-limit</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
@ -10,7 +10,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
|||||||
class NoWxCache : IDisposable
|
class NoWxCache : IDisposable
|
||||||
{
|
{
|
||||||
private const int CodeAlignment = 4; // Bytes.
|
private const int CodeAlignment = 4; // Bytes.
|
||||||
private const int SharedCacheSize = 2047 * 1024 * 1024;
|
private const int SharedCacheSize = 192 * 1024 * 1024;
|
||||||
private const int LocalCacheSize = 128 * 1024 * 1024;
|
private const int LocalCacheSize = 128 * 1024 * 1024;
|
||||||
|
|
||||||
// How many calls to the same function we allow until we pad the shared cache to force the function to become available there
|
// How many calls to the same function we allow until we pad the shared cache to force the function to become available there
|
||||||
|
@ -46,7 +46,7 @@ namespace Ryujinx.Memory
|
|||||||
|
|
||||||
private const IntPtr TASK_NULL = 0;
|
private const IntPtr TASK_NULL = 0;
|
||||||
private static readonly IntPtr _selfTask;
|
private static readonly IntPtr _selfTask;
|
||||||
private static readonly int DEFAULT_CHUNK_SIZE = 16 * 1024 * 1024;
|
private static readonly int DEFAULT_CHUNK_SIZE = 1024 * 1024;
|
||||||
|
|
||||||
static MachJitWorkaround()
|
static MachJitWorkaround()
|
||||||
{
|
{
|
||||||
@ -61,6 +61,8 @@ namespace Ryujinx.Memory
|
|||||||
{
|
{
|
||||||
return totalSize;
|
return totalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chunkSize /= 2;
|
||||||
|
|
||||||
int chunkCount = Math.Max(4, totalSize / DEFAULT_CHUNK_SIZE);
|
int chunkCount = Math.Max(4, totalSize / DEFAULT_CHUNK_SIZE);
|
||||||
return (totalSize + chunkCount - 1) / chunkCount;
|
return (totalSize + chunkCount - 1) / chunkCount;
|
||||||
@ -211,4 +213,4 @@ namespace Ryujinx.Memory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user