-
Notifications
You must be signed in to change notification settings - Fork 83
Feature: Resizable Window #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Resizable Window #202
Conversation
|
With this feature, we can play games that switch between portrait and landscape orientations. |
|
SwiftLint complains that this function’s body exceeds 50 lines. Hope someone can refactor it later.
|
|
Resizing freely causes the app to crash otherwise this feature is highly useful, i was actually working on the same. but this is almost fine, just i would suggest some changes to match my own work to improve this a bit more. |
That’s great. If you are already working on this feature, I can close this PR and wait for yours, since I might not have enough time to improve it. |
No need to close, this work is pretty good. if anything I'll just commit over this or just merge and add changes on other pr. Besides you deserve your contributions to the project to be acknowledged. |
|
viatearz#1 Swiftlit fix. @viatearz |
Fix swiftlint complain
|
Found a "workaround" for the resizing crash on unitygfxdeviceworker. Just open the binary or execute it on the terminal. I'm not sure if I'll handle this, but I'll leave it here in case someone can think of a fix while I sleep. Just an idea, envs can be set to simulate the terminal env but that might lead to unexpected other issues. we'll see |
Which apps are crashing? I haven’t encountered any crashes, but I’m still on macOS 15. |
Genshin Impact, but I guess all Unity apps might crash if you resize the app by dragging the corner nonstop. It might be a race condition or something related to how Unity handles rendering, and the speed of updating the window and scaling its content. nvm i just found waht the issue is, i still dont know how to fix it but there you go. -[MTLDebugRenderCommandEncoder setScissorRect:]:4129: failed assertion `Set Scissor Rect Validation
|
|
You may try removing PlayTools to see if it still crashes. [objc_getClass("_UIApplicationInfoParser")
swizzleInstanceMethod:NSSelectorFromString(@"requiresFullScreen")
withMethod:@selector(hook_requiresFullScreen)]; |
I've tried the first option removing playtools before, it doesnt crash since as far as i remember because it doesnt tirgger a rerendering of the content. i'll need to see again tomorrow once i can work on this again. but the issue is with rerendering the content inside, maybe the scalling? -[MTLDebugRenderCommandEncoder setScissorRect:]:4129: failed assertion `Set Scissor Rect Validation |
I can also reproduce this crash. You can use the following code to verify (put it in PlayLoader.m): static id<MTLDevice> pt_MTLCreateSystemDefaultDevice(void) {
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
NSLog(@"[PlayTools] MTLCreateSystemDefaultDevice: %@", NSStringFromClass(object_getClass(device)));
return device;
}
DYLD_INTERPOSE(pt_MTLCreateSystemDefaultDevice, MTLCreateSystemDefaultDevice)Running it in Terminal, or double-clicking in Finder, does not cause this issue. It only occurs when opening the app through PlayCover. |
It is, i fixed it already. or it seems like it. I will push to your playcover branch once i test throughtly and can guarantee its fixed |
JoseMoreville
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to go
Summary
Allow users to resize the window by dragging its borders, just like when we removed PlayTools.
Changes
Force
[_UIApplicationInfoParser requiresFullScreen]to returnfalse, then macOS will create a resizable window.NSWindow.contentAspectRatio.2. Force
UIScreen.main.boundsto return the key window's bounds, game rendering and keymapping rely on this value.