-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Remove unused code from library_sdl.js. NFC #18986
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
Conversation
This came out of the work I'm doing on #18979 - SDL_malloc/SDL_free are not declared in the SDL header but instead defined to malloc/free (because we define HAVE_MALLOC). - Mix_PlayChannel is defined to Mix_PlayChannelTimes in the header. - SDL_BlitScaled/SDL_BlitSurface are defined to SDL_UpperBlitScaled and SDL_UpperBlit respectively. - SDL_UnlockMutex and SDL_LockMutex are defined to SDL_mutexV and SDL_mutexP. - SDL_LoadBMP is defined as SDL_LoadBMP_RW
This came out of the work I'm doing on emscripten-core#18979 - SDL_malloc/SDL_free are not declared in the SDL header but instead defined to malloc/free (because we define HAVE_MALLOC). - Mix_PlayChannel is defined to Mix_PlayChannelTimes in the header. - SDL_BlitScaled/SDL_BlitSurface are defined to SDL_UpperBlitScaled and SDL_UpperBlit respectively. - SDL_UnlockMutex and SDL_LockMutex are defined to SDL_mutexV and SDL_mutexP. - SDL_LoadBMP is defined as SDL_LoadBMP_RW
This came out of the work I'm doing on emscripten-core#18979 - SDL_malloc/SDL_free are not declared in the SDL header but instead defined to malloc/free (because we define HAVE_MALLOC). - Mix_PlayChannel is defined to Mix_PlayChannelTimes in the header. - SDL_BlitScaled/SDL_BlitSurface are defined to SDL_UpperBlitScaled and SDL_UpperBlit respectively. - SDL_UnlockMutex and SDL_LockMutex are defined to SDL_mutexV and SDL_mutexP. - SDL_LoadBMP is defined as SDL_LoadBMP_RW
Oops, I guess we are missing some test coverage there. Thanks for the report, I'll take a look. Can I ask how you are using that function? Can you share what the call site looks like? |
Here was my original post: I believe that this change broke SDL_LoadBMP. In my project, I now have to use SDL_LoadBMP_RW, -or- downgrading the emsdk version. SDL_LoadBMP error: Parameter 'src' is invalid Upon further testing, both SDL_LoadBMP and SDL_LoadBMP_RW are broken in v3.1.42 - v3.1.53, and are fixed by downgrading to v3.1.41 or earlier. Using the latest SDL3 emscripten static lib by the way. Here's what the code looks like:
SDL error: Parameter 'src' is invalid |
Was SDL3 a typo there? |
Nope |
Update: |
Thanks for the update. This PR landed in 3.1.35 so I suppose there is a different cause of the error. If you get a change and you have the repro handy perhaps you could bisect further between 3.1.41 and 3.1.42 (https://emscripten.org/docs/contributing/developers_guide.html#bisecting)? |
What is "SDL3 emscripten static lib" ? Does this reproduce with emscripten's |
So.. the file could not be read.. but we don't know why yet.. |
First of all, thank you for all your help. This does not reproduce with emscripten's -sUSE_SDL2. I can also confirm that SDL_RWFromFile is the culprit (same error message for SDL_LoadBMP, SDL_LoadWAV, and SDL_RWFromFile). Perhaps I should create an issue over on the SDL repo, although they seem to be in rapid development mode at the moment. My current workaround while developing for SDL3 Emscripten is to stay on v3.1.41. |
I think this does sounds like an emscripten regression so it probably makes sense to open an issue here. If you get time to bisect between v3.1.41 and v3.1.42 that would be great.. or a small repro would be great too. How are you embedding you data files by the way (i.e. how is it the files are injected into the emscripten VFS)? |
emcc -regular compilation stuff- --preload-file sword.bmp --use-preload-plugins I'll work on bisecting or a repro soon. |
This came out of the work I'm doing on #18979