Skip to content

EvmuRootBlock::extraBlock discussion #13

@euan-forrester

Description

@euan-forrester

This is more of a discussion and not an issue but I didn't see the discussion tab for this repo. Feel free to close/move/whatever this :)

I wonder if EvmuRootBlock::extraBlock should be renamed. It's described here https://github.com/gyrovorbis/libevmu/blob/libgimbal-refactor/lib/api/evmu/fs/evmu_fat.h#L146 as the location of the extra block and is filled with the value 200.

My reasoning comes from how the rest of the block locations are specified by the block number closest to the end of the file. Like rootBlock is 255, fatBlock is 254, and -- most notably -- dirBlock is 253. The first two are only 1 block long, so they describe both the start and end block number simultaneously. But for dirBlock it's 13 blocks long and specified by the block number closest to the end of the file and not the beginning.

Data files are also written starting at the end of the file, so it seems to be the convention for everything in these files with the single exception of game files.

I had a lot of issues as I was writing my code for these files because I kept wanting to start at block numbers closest to the beginning of the file because that's what seemed natural to me. But my code became simpler when I stuck with the convention of always beginning closest to the end of the file.

So in this case I wonder if the values at extraBlock and extraSize are better understood as the size of the user area rather and the size of the extra area than the block number of the extra area (except breaking convention and numbering it starting closest to the beginning of the file) and then the size of the extra area.

Maybe consider calling it userSize or something instead and updating the comment?

Anyway, this is just a thought and something I ran into coding my stuff. I don't feel particularly strongly about it and I'm happy however you decide to proceed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions