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

load extras.wad before IWAD #2078

Closed
wants to merge 2 commits into from
Closed

Conversation

rfomin
Copy link
Collaborator

@rfomin rfomin commented Dec 6, 2024

Alternative to #2075

I don't like this hack, but extras.wad is nice.

src/d_main.c Outdated
@@ -1829,8 +1829,20 @@ void D_DoomMain(void)

LoadBaseFile();

boolean extras_wad = false;
const char *extras_path = D_FindWADByName("extras.wad");
Copy link
Owner

Choose a reason for hiding this comment

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

Do we need to free() this after use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 7c7d285

w_handle_t handle = {0};
if (w_file_module.Open(path, &handle) == W_FILE)
{
array_clear(wadfiles); // don't register it before IWAD
Copy link
Owner

Choose a reason for hiding this comment

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

This screams "bug!" all over the place. I don't even understand what happens here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The actual lump table is in lumpinfo. wadfiles is just a list of WAD names, for wadfiles[0] checks or save/autoload directories, not that important.

In w_file.Open() the name of the WAD is recorded in the wadfiles array, so we delete it and add it back after IWAD, so that other checks work. Ugly hack, but if we decide to implement an in-game launcher, we will have to redo this system anyway to load WADs on the fly.

@rfomin rfomin mentioned this pull request Dec 6, 2024
Copy link
Owner

@fabiangreffrath fabiangreffrath left a comment

Choose a reason for hiding this comment

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

Please add a comment, I won't remember until next week what happens here. 😉

@rfomin
Copy link
Collaborator Author

rfomin commented Dec 6, 2024

I change my mind, indeed I probably forgot what is going on here after a week.

@rfomin rfomin closed this Dec 6, 2024
@rfomin rfomin deleted the extras_wad branch December 6, 2024 09:47
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.

2 participants