Skip to content

Conversation

@gcsmith
Copy link
Contributor

@gcsmith gcsmith commented Jan 23, 2026

This includes changes from PR #137 and PR #138.

Those should probably be reviewed first, then I can merge those PRs and simplify this one.

@gcsmith
Copy link
Contributor Author

gcsmith commented Jan 24, 2026

Also should note that I didn't implement a saving thread for the first cut to keep things simple, and plan to add that in a follow-up change.

@gcsmith
Copy link
Contributor Author

gcsmith commented Jan 25, 2026

The biggest annoyance here was dealing with the byteswapping in OSPfsState. The third field is a halfword immediately followed by two char arrays (ext_name, game_name). Because the base type is char, there is no padding inserted and all remaining fields start on a non-word aligned address. The resulting layout is a complete mess with multiple interleaved fields -- ext_name is split into two fields, and game_name is split into three.

I just gave up and did a byteswapped copy of bytes 10-30 in osPfsFileState(). Even if I wrote to the fields as-is, I would still have to byteswap within each char array.

@Mr-Wiseguy let me know if you think there's a better way to handle unfortunate cases like this

Verified that Quest 64 works with the game_name hack removed, and also verified Superman 64 saving works.

@gcsmith
Copy link
Contributor Author

gcsmith commented Jan 25, 2026

Also, like @sonicdcer's original implementation this makes no attempt at implementing the "real" PFS filesystem. I'm not sure there's a good reason to do so (portability with emulators?), but curious if anyone thinks that's worth pursuing.

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.

3 participants