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
|
||||
{
|
||||
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 CacheSize = 128 * 1024 * 1024;
|
||||
private const int CacheSizeIOS = 64 * 1024 * 1024;
|
||||
private const int CacheSize = 1024 * 1024 * 1024;
|
||||
private const int CacheSizeIOS = 128 * 1024 * 1024;
|
||||
|
||||
private static ReservedRegion _jitRegion;
|
||||
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",
|
||||
);
|
||||
MARKETING_VERSION = 0.0.8;
|
||||
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",
|
||||
);
|
||||
MARKETING_VERSION = 0.0.8;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.stossy11.MeloNX;
|
||||
|
Binary file not shown.
@ -12,12 +12,12 @@
|
||||
<key>Ryujinx.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>com.Stossy11.MeloNX.RyujinxAg.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
@ -12,6 +12,7 @@ import SwiftUI
|
||||
|
||||
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() {
|
||||
guard let window = theWindow else { return }
|
||||
|
||||
@ -40,8 +41,10 @@ func waitForController() {
|
||||
containerView.frame = window.bounds
|
||||
containerView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||
|
||||
// Timer for controller
|
||||
Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
|
||||
if findGCControllerView(in: window) == nil {
|
||||
// Adds Virtual Controller Subview
|
||||
window.addSubview(containerView)
|
||||
window.bringSubviewToFront(containerView)
|
||||
|
||||
|
@ -13,6 +13,8 @@ import UIKit
|
||||
|
||||
var theWindow: UIWindow? = nil
|
||||
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() {
|
||||
if #available(iOS 13.0, *) {
|
||||
self.windowScene = (UIApplication.shared.connectedScenes.first! as! UIWindowScene)
|
||||
@ -29,7 +31,7 @@ extension UIWindow {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Patches makeKeyAndVisible to wdb_makeKeyAndVisible
|
||||
func patchMakeKeyAndVisible() {
|
||||
let uiwindowClass = UIWindow.self
|
||||
if let m1 = class_getInstanceMethod(uiwindowClass, #selector(UIWindow.makeKeyAndVisible)),
|
||||
|
@ -182,11 +182,15 @@ class Ryujinx {
|
||||
func MainThread(_ block: @escaping @Sendable () -> Void) {
|
||||
if #available(iOS 17.0, *) {
|
||||
RunLoop.current.perform {
|
||||
block()
|
||||
autoreleasepool {
|
||||
block()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
block()
|
||||
autoreleasepool {
|
||||
block()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,23 +19,31 @@ struct MoltenVKSettings: Codable, Hashable {
|
||||
}
|
||||
|
||||
struct ContentView: View {
|
||||
// MARK: - Properties
|
||||
@State private var theWindow: UIWindow?
|
||||
// Games
|
||||
@State private var game: Game?
|
||||
|
||||
// Controllers
|
||||
@State private var controllersList: [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 var settings: [MoltenVKSettings]
|
||||
@AppStorage("useTrollStore") var useTrollStore: Bool = false
|
||||
@State private var isVirtualControllerActive: Bool = false
|
||||
@AppStorage("isVirtualController") var isVCA: Bool = true
|
||||
@State var onscreencontroller: Controller = Controller(id: "", name: "")
|
||||
|
||||
// JIT
|
||||
@AppStorage("JIT") var isJITEnabled: Bool = false
|
||||
|
||||
// Other Configuration
|
||||
@State var isMK8: Bool = false
|
||||
@AppStorage("quit") var quit: Bool = false
|
||||
@State var quits: Bool = false
|
||||
@AppStorage("MVK_CONFIG_PREFILL_METAL_COMMAND_BUFFERS") var mVKPreFillBuffer: Bool = true
|
||||
|
||||
@State var quits: Bool = false
|
||||
// Loading Animation
|
||||
@State private var clumpOffset: CGFloat = -100
|
||||
private let clumpWidth: CGFloat = 100
|
||||
private let animationDuration: Double = 1.0
|
||||
@ -50,11 +58,11 @@ struct ContentView: View {
|
||||
let defaultSettings: [MoltenVKSettings] = [
|
||||
// MoltenVKSettings(string: "MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS", value: "1"),
|
||||
// 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_CONFIG_RESUME_LOST_DEVICE", value: "1"),
|
||||
MoltenVKSettings(string: "MVK_CONFIG_MAX_ACTIVE_METAL_COMMAND_BUFFERS_PER_QUEUE", value: "192"),
|
||||
//MVK_CONFIG_LOG_LEVEL
|
||||
MoltenVKSettings(string: "MVK_CONFIG_USE_METAL_PRIVATE_API", value: "0")
|
||||
MoltenVKSettings(string: "MVK_CONFIG_USE_METAL_PRIVATE_API", value: "0"),
|
||||
// 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)
|
||||
MoltenVKSettings(string: "MVK_CONFIG_MAX_ACTIVE_METAL_COMMAND_BUFFERS_PER_QUEUE", value: "1024"),
|
||||
]
|
||||
|
||||
_settings = State(initialValue: defaultSettings)
|
||||
@ -70,6 +78,8 @@ struct ContentView: View {
|
||||
if isLoading {
|
||||
emulationView
|
||||
.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.invalidate()
|
||||
quits = quit
|
||||
@ -79,8 +89,10 @@ struct ContentView: View {
|
||||
timer.invalidate()
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
} else {
|
||||
// This is when the game starts to stop the animation
|
||||
VStack {
|
||||
|
||||
}
|
||||
@ -89,11 +101,12 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// This is the main menu view that includes the Settings and the Game Selector
|
||||
mainMenuView
|
||||
.onAppear() {
|
||||
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
|
||||
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() {
|
||||
setMoltenVKSettings()
|
||||
SDL_SetMainReady()
|
||||
SDL_iPhoneSetEventPump(SDL_TRUE)
|
||||
SDL_Init(SdlInitFlags)
|
||||
SDL_SetMainReady() // Sets SDL Ready
|
||||
SDL_iPhoneSetEventPump(SDL_TRUE) // Allow iOS Set Event Pump (Check out SDL2 Documentation here)
|
||||
SDL_Init(SdlInitFlags) // Initialises SDL2
|
||||
initialize()
|
||||
}
|
||||
|
||||
@ -305,9 +318,8 @@ struct ContentView: View {
|
||||
|
||||
|
||||
|
||||
|
||||
// Sets MoltenVK Environment Variables
|
||||
private func setMoltenVKSettings() {
|
||||
|
||||
settings.forEach { setting in
|
||||
setenv(setting.string, setting.value, 1)
|
||||
}
|
||||
|
@ -449,9 +449,10 @@ struct GameListRow: View {
|
||||
}
|
||||
|
||||
Button {
|
||||
// Add info action
|
||||
let pasteboard = UIPasteboard.general
|
||||
pasteboard.string = game.titleId
|
||||
} 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">
|
||||
<plist version="1.0">
|
||||
<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>
|
||||
<true/>
|
||||
</dict>
|
||||
|
@ -10,7 +10,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
|
||||
class NoWxCache : IDisposable
|
||||
{
|
||||
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;
|
||||
|
||||
// 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 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()
|
||||
{
|
||||
@ -62,6 +62,8 @@ namespace Ryujinx.Memory
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
chunkSize /= 2;
|
||||
|
||||
int chunkCount = Math.Max(4, totalSize / DEFAULT_CHUNK_SIZE);
|
||||
return (totalSize + chunkCount - 1) / chunkCount;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user