inseven / opolua

A compiled-OPL interpreter for iOS written in Lua
https://opolua.org
MIT License
12 stars 0 forks source link

[OPLcolour] OpoLua freezes #460

Closed kapfab closed 1 month ago

kapfab commented 1 month ago

Description

The whole OpoLua app freezes when this app is launched, eating 100% of an M1 core.

Metadata

Key Value
Title OPLcolour
Source URL https://archive.org/download/3-libjune-05/3LIBJUNE05.iso/library/epocprog/oplcolour/OPLcolour.sis

Details

Freeze occurs with both iOS and macOS apps. The only fault visible in MacOS system console for the OpoLua process is the following:

CLIENT ERROR: TUINSRemoteViewController does not override -<private> and thus cannot react to catastrophic errors beyond logging them
jbmorley commented 1 month ago

I'm pretty sure the 'CLIENT ERROR' is just one of the many warnings we see a lot of the time with Catalyst these days unfortunately so I suspect it's a red herring. I bet the program is going into an endless loop, though why it's hanging the app I'm not sure...

tomsci commented 1 month ago

There was a bug in the line drawing algorithm that meant zero or one pixel length lines could get stuck in an infinite loop as the exit condition was already passed. Having fixed it the app seems to launch normally.

tomsci commented 1 month ago

I also fixed some corner cases in gCOLOR which manifested as rendering glitches in OPLcolour. OPLcolour sometimes specifies negative numbers for colour values, which it turns out epoc32 permits because it just casts them to uint8_t without first sanity checking them.

There is a final corner case with pen width > 1 combined with invert drawing mode, which we still don't support right now, but OPLcolour seems to render ok when ignoring that pen width so I've left that be for now.