PlayCover / PlayTools

Tools for keymapping, dynamic resolution, and more
GNU Affero General Public License v3.0
71 stars 56 forks source link

[PlayScreen] Minecraft is not getting right window size or aspect ratio. #163

Open LeaveNhA opened 4 months ago

LeaveNhA commented 4 months ago

I am using PlayTools externally since Minecraft (at least my version of ipa) is not working on PlayCover.

My method is starting with compiling PlayTools by signing it locally and externally adding it to ipa while installing with Sideloadly. (I don't know if I can mention this method or any of them) Then, I be sure it get's the settings right. Disabled all of them except the window size and resolution related ones. But whatever I do, it doesn't work the way I wanted, in terms of window size. I tried to reverse-engineer it and found a monkey-patch, applied it to the swift code and bind it to the short-cut with menu controller.

Now, with the following patch, it works perfectly in my test environments, including: M1 16" native screen, external 16:9 TV, m1 Pro 13".

I am sorry that I cannot create a PR now, at this point, I don't even know my solution is persistent or qualified enough to go into your code-base.

Patch:

// you can call it after the game launches and try to full-screen with a short-cut or with menu bar.
let address = Unmanaged<AnyObject>.passUnretained(UIScreen.main as AnyObject).toOpaque()
address.advanced(by: 0x28).storeBytes(of: CGRectMake(0.0, 0.0, PlaySettings.shared.windowSizeHeight, PlaySettings.shared.windowSizeWidth), toByteOffset: 0, as: CGRect.self)

If you guys let me know what do you think about it, and want me to create a PR, I can continue with your comments and inputs.

Thanks for all of your hard work fellas! It is nice to collaborate with you all.

PS: I have couple of theories why this works and why our first method fails but I really hated to reverse-engineer/debug this game.