Skip to content
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

Documentation about what time you must set the environment variables #188

Closed
zzo38 opened this issue Jul 27, 2022 · 4 comments
Closed

Documentation about what time you must set the environment variables #188

zzo38 opened this issue Jul 27, 2022 · 4 comments
Assignees
Milestone

Comments

@zzo38
Copy link

zzo38 commented Jul 27, 2022

Can the environment variables be set after the program has started, and if so, when? Before SDL_Init call? Before SDL_SetVideoMode call? Is it different for different environment variables, or for which subsystems are initialized? You should document this.

@icculus icculus self-assigned this Jul 27, 2022
@icculus icculus added this to the 1.2.54 milestone Aug 13, 2022
@icculus
Copy link
Collaborator

icculus commented Sep 1, 2022

I'm going to make a note that sdl12-compat expects these to be set before the process starts and not change during the life of the process, and any places where changing it later might affect operation is purely accidental and might change.

The idea is that no 1.2-using process should ever be managing these environment variables, because they shouldn't know they're using sdl12-compat instead of SDL 1.2, so sdl12-compat assumes they are set upfront, even though it checks some of them at different times.

@icculus icculus closed this as completed in d764cc6 Sep 1, 2022
@icculus
Copy link
Collaborator

icculus commented Sep 1, 2022

(If someone wants to make a compelling argument to the contrary, though, I'll consider revisiting, but I think this is reasonable.)

@zzo38
Copy link
Author

zzo38 commented Sep 2, 2022

I think that it might be reasonable to allow being changed before SDL_Init is called, and then being unchanged after that.

Some programs might include some special handling, e.g. Free Hero Mesh has a (currently unimplemented) CONFIG_USING_SDL12_COMPAT option to indicate at compile time that it is using sdl12-compat, in order to compile in functions specific for this use in case any are needed. (This would not be as complicated as making conditional compilation for SDL1 and SDL2, I think, since it can continue using existing SDL1 functions even for SDL2, if the compatibility library is in use.)

This might include reading configuration options from the configuration file (and which ones are used might, in some cases, depend on which puzzle set files are specified as command-line arguments). Other times, some settings might permanently be set.

Not all of the environment variables are necessarily useful to be set within the program, but in some cases they might be, before initializing SDL.

@icculus
Copy link
Collaborator

icculus commented Sep 3, 2022

because they shouldn't know they're using sdl12-compat instead of SDL 1.2

Actually, this isn't true, we give them a version number they can check, a #define in the headers, and some hackery with syswm to get at the SDL2 structs.

I'll document these more closely, even though most of them legitimately are checked once at SDL_Init or SDL_SetVideoMode time.

@icculus icculus reopened this Sep 3, 2022
@icculus icculus closed this as completed in 234e376 Sep 8, 2022
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

No branches or pull requests

2 participants