Skip to content

Conversation

@MLXProjects
Copy link
Contributor

This PR contains a few relevant fixes for some features that broke in the 1.5 source update, along with some general things like warnings fixed :D
Each commit details the changes and, when needed, compares old vs new behavior.
This is the first step for me to organise my fork into something mergeable while mantaining compatibility, since my current codebase is a mess due to it having like 4 years of my attempts at learning C lol

MLXProjects and others added 16 commits June 14, 2025 23:35
When the hid_getevent() loop got LIBAROMA_HID_EV_RET_EXIT, it didn't
set the event type after clearing; so the message queue loop never got
a valid event. This prevented the application to receive and handle the
LIBAROMA_MSG_EXIT message.
It's working now :)

Oh, and there was a minor indentation fix at hid/messages.c.
At the start, libaroma used the typical MIN/MAX macros:
```
 #define MIN (((a)<(b))?(a):(b))
 #define MAX (((a)>(b))?(a):(b))
```
That always kinda worked, but double-evaluation may cause nasty bugs
which are pretty hard to find.
With the 1.5 update, the macros were changed to inline functions; this
handled the double-evaluation issue at the cost of needing one function
for every compared type (int, float and double), and needing to update
all the macro usages for the right function (ensuring proper type and
signedness comparison).
That change also broke some animations, due to the wrong function being
used (e.g. int MIN/MAX used for float values).
The approach taken in this commit aims to prevent further issues:
At the cost of needing two GNU extensions, we can use a macro that handles
the data types properly while using a single evaluation.
The result is pretty much like the inline functions without having to
care about multiple types :D
The corresponding changes were reverted in control's code, too.
Adjusted the SDL.h header path (it should always be inside a SDL
directory in the compiler's include path).
Also, fixed the main define check at platform.c
Since building libjpeg-turbo with SSE support needs a NASM compiler
which the build system doesn't support, I just disabled SIMD for it.
Not the best fix, but I couldn't find a way to make it work with GCC.
Thanks to SonarCloud technologies :D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant