Skip to content

Restore support for the Nokia N-Gage #12148

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

Open
wants to merge 91 commits into
base: main
Choose a base branch
from

Conversation

mupfdev
Copy link
Contributor

@mupfdev mupfdev commented Jan 31, 2025

As described in #11243 and #6691, support for the Nokia N-Gage has been dropped due to technical limitations that have now been resolved. The custom-built C-Compiler now supports C99. The C++ compiler is still outdated and has only been retained for compatibility reasons.

Description

  • A completely new port that uses a native rendering backend instead of SDL's software renderer.
  • Limited but working audio support!
  • Built-in FPS display for performance control during development #.
  • EKA2L1 can output messages via SDL_Log().
  • A demo application is currently being developed. It can be found in the ngage-toolchain repository.
  • The backlight is kept on while the SDL application is running. Edit: The behaviour can now be modified using SDL_DisableScreenSaver/SDL_EnableScreenSaver

Existing Issue(s)

  • It is currently not possible to put the application that has been launched into the background. It continues to run and can then no longer be closed. This is a bug in the new rendering backend.

  • If the application is put in the background while sound is playing, some of the audio is looped until the app is back in focus.

  • It is recommended initialising SDLs audio sub-system even when it is not required. The backend is started at a higher level. Initialising SDLs audio sub-system ensures that the backend is properly deinitialised. Edit: Not really an issue.

@slouken slouken added this to the 3.4.0 milestone Jan 31, 2025
@mupfdev
Copy link
Contributor Author

mupfdev commented Feb 1, 2025

Some of the more recent changes is causing an error message when I close the running SDL application. I look into this.

break;
}

return SDL_GetScancodeFromKey(keycode, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest directly using the SDL_SCANCODE_ values here rather than converting from a fixed set of SDLK_ values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you mean that? I am currently translating the scan codes from the Symbian API into the identifiers used by SDL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this:

        case EStdKeyBackspace: // Clear key
            return SDL_SCANCODE_BACKSPACE;
            break;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather set a variable while having a single point of return, however, I need to determine all the scan codes to make this work either way. 👍

@icculus
Copy link
Collaborator

icculus commented Feb 9, 2025

What's the status on this? Are we ready to merge?

(Tweaks and additional fixes/improvements can come later, but I'd rather this not have to live in a branch if it's Good Enough at this point.)

@mupfdev
Copy link
Contributor Author

mupfdev commented Feb 9, 2025

@madebr made great progress with CI. @madebr what's your take on this?

A merge would be fine with me, but N-Gage shouldn't be the only platform without a working CI.

@madebr
Copy link
Contributor

madebr commented Feb 9, 2025

@madebr made great progress with CI. @madebr what's your take on this?

A merge would be fine with me, but N-Gage shouldn't be the only platform without a working CI.

I can't comment on the N-Gage C/C++ code, which seems to be in ok state.
I'm not so happy with the current CMake integration: N-Gage's CMake toolchain file uses hacks and does not allow to build any SDL tests or examples.
I have a wip ngage-toolchain branch in which I modified the Emscripten wrappers to let the ngage toolchain behave in a way that cmake (meson?) likes.

Short term, I can live with this but long term this needs to be fixed.

@icculus
Copy link
Collaborator

icculus commented Mar 2, 2025

Let's try to get the CMake stuff up to standards and merge this, so @mupfdev doesn't have to keep working out of a branch.

@icculus
Copy link
Collaborator

icculus commented Mar 2, 2025

(Whether that's @madebr or @mupfdev, or me, that needs to do that, let's figure it out.)

@mupfdev
Copy link
Contributor Author

mupfdev commented Mar 4, 2025

@madebr started working on a compile wrapper to streamline CMake support. AFAIK it's in this branch: https://github.com/madebr/SDL/tree/cmake-ngage-extra-support

If there's anything I could do to help, just let me know. I can also modify the toolchain if necessary.

@mupfdev
Copy link
Contributor Author

mupfdev commented Mar 12, 2025

I'm currently cleaning up the compiler wrapper by @madebr (which is now part of the toolchain).
Could take a few days until everything works as intended.

@mupfdev
Copy link
Contributor Author

mupfdev commented May 5, 2025

What's the status on this? Are we ready to merge?

(Tweaks and additional fixes/improvements can come later, but I'd rather this not have to live in a branch if it's Good Enough at this point.)

Thanks to @madebr everything now seems to be working as intended.
If no major issue arises, we are ready to merge.

@sezero
Copy link
Contributor

sezero commented May 5, 2025

Thanks to @madebr everything now seems to be working as intended. If no major issue arises, we are ready to merge.

There are some unresolved feedback (github gui hides most of them due to high volume of the ticket), make sure that all are resolved to satisfaction.

Comment on lines +40 to +42
TUint8 r = (pixel & 0xF800) >> 8;
TUint8 g = (pixel & 0x07E0) >> 3;
TUint8 b = (pixel & 0x001F) << 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The N-Gage renderer currently uses SDL_PIXELFORMAT_ARGB4444 for all textures, but these masks and shifts correspond to SDL_PIXELFORMAT_RGB565 instead.


float sx;
float sy;
SDL_GetRenderScale(renderer, &sx, &sy);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The render scale should already be combined with dstrect by this point, so it shouldn't be necessary to handle it here.

if (copydata->scale_x != 1.f || copydata->scale_y != 1.f)
{
dest == pixel_buffer_a ? dest = pixel_buffer_b : dest = pixel_buffer_a;
ApplyScale(dest, source, pitch, w, h, copydata->center.x, copydata->center.y, copydata->scale_x, copydata->scale_y);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the final scaled/rotated/flipped image is larger than the allocated bitmap?

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.

6 participants