Log In  


Hello :)

I am really sad that after a year these simple things are still broken:

  • The app icon does not fit in with the system, and breaks the user's ability to customize the app icon by overriding it at runtime with SDL_SetWindowIcon.
  • This also breaks the macOS 26 Tahoe icon renderer preventing the system from theming it.
  • The icon changes in the dock after you run the app, very unusual behavior.
  • The viewport inside the window incorrectly calculates the resolution by using the resolution divided by 2, causing it to miss the possibility of a bigger window with sharp pixels.

I hope Apple simply turns this API abuse into a no-op in a future update, but in the meantime I made a small patch you can use with your arm version of Picotron 0.2.0d. The patch changes the SDL_SetWindowIcon function to simply ret back to the caller, preventing the call to SDL.
Because the patch is a radare2 script which finds the linked SDL symbol in the binary it should work for any version of Picotron, not just 0.2.0d. In fact, it should even work on PICO-8! :)

You will need radare2 to apply the patch, you can install it with homebrew:

brew install radare2

In the future I will expand this bug fix patch in order to fix other problems that go unfixed such as the resolution being chosen incorrectly.

It would be nice if Picotron was just fixed normally though. It's been a year and both issues are rather trivial, they're not technical issues but a misunderstanding of the macOS platform and SDL. Please just fix them (also in Pico-8) so I don't have to patch the binaries myself.

  • Don't set the icon at runtime
  • Don't confuse SDL_GetWindowSize and SDL_GetWindowSizeInPixels. The latter is what you want to be using to calculate your pixel size or you will always fail to calculate the best possible resolution.

Guide

First of all this is the entire patch for now:

s sym.imp.SDL_SetWindowIcon;
wai ret;

it skips to the linked SDL function and places a return at the start turning it into a no-op regardless of how Picotron attempts to use it.

Here's what you have to do to apply the fix:

  • Create a copy of your Picotron.app in some other directory than /Applications (make sure it's not a location tracked by iCloud as that will prevent signing it)
  • For convenience create a patch.r2 text file and paste the patch there
  • Open that directory in the terminal

Now you can use the following commands:

# apply the patch to the picotron binary
r2 -wqi patch.r2 Picotron.app/Contents/MacOS/picotron
# remove the now invalid signature or macOS will prevent it from running
codesign --remove-signature --deep Picotron.app
# it still won't run because it has no signature so sign it locally
codesign --force --deep --sign - Picotron.app/Contents/MacOS/picotron
# SDL confuses codesign so sign the binary itself again
codesign --force --sign - Picotron.app/Contents/MacOS/picotron

After that you now have a fixed version of Picotron which doesn't override your custom icon if you have one and is properly themed on macOS Tahoe :)

I will try to fix the window resolution bug later as well, which I've done in the past but that part of the code changed since then.




[Please log in to post a comment]