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

Mac prefs #380

Merged
merged 9 commits into from
Jul 31, 2024
Merged

Mac prefs #380

merged 9 commits into from
Jul 31, 2024

Conversation

NQNStudios
Copy link
Collaborator

@NQNStudios NQNStudios commented Jul 30, 2024

Part 2 of the replay system work/with a focus on getting MacOS replay functionality caught up.

  • On Mac, when passing command-line arguments, the apple events function is still called, and it tries to load "replay" and "replayFile.xml" both as exg files, throwing an error message. I fixed that
  • I dug into the scary Objective-C++ for mac preferences and wrote some rough code to record the relevant BoE preferences to the action logs and load it back out.
    • I have not tested whether a Mac can replay a log from Windows and vice-versa, but I tried to make it so that will work.
    • Should Objective-C++ code follow naming and style conventions of the C++ codebase, or the conventions of the existing Objective-C++ it's added to?
  • Trying to replay every control_focus event was proving a nightmare when accounting for controls that are within containers. I also think it was a mistake to record and replay focus events in the first place, because it looks like they're triggered as side-effects of triggerClickEvent() anyway, meaning that in the current state of things the focus events might be replaying twice. So I reverted adding the control_focus as a logged event.
  • made led groups work with click replays
    • I've recorded and replayed a session where the game launches, preferences are opened, and window size changes from fullscreen to windowed mode. pretty cool. (That's not included in the PR)

if(line[0] == '#') continue;
int eq = line.find_first_of('=');
if(eq == std::string::npos) {
printf("Error reading preferences: line is not a comment and lacks an = sign:\n\t%s\n", line.c_str());
Copy link
Member

Choose a reason for hiding this comment

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

Is there some reason why we can't use streaming like the rest of the code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I started by copying over the implementation of load_prefs() for windows/linux:

static bool load_prefs(std::istream& in) {

I wouldn't want to change too much from something we're pretty sure works fine.

Copy link
Member

Choose a reason for hiding this comment

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

Well, I guess we can leave it as is for now; I'd probably want the Linux version to also use streaming there but keeping them as much the same as possible isn't a bad goal.

@CelticMinstrel
Copy link
Member

Should Objective-C++ code follow naming and style conventions of the C++ codebase, or the conventions of the existing Objective-C++ it's added to?

I think I'd prefer to use the same naming and style conventions across the code. Things will probably never be completely consistent because it's an old and fairly large codebase, but we can at least try to make all the new code be consistent.

@CelticMinstrel
Copy link
Member

Okay, so there's no other reason not to merge this, right? I'll probably merge it tonight then.

@NQNStudios
Copy link
Collaborator Author

I think it's ready.

@CelticMinstrel CelticMinstrel merged commit fc083c6 into calref:master Jul 31, 2024
6 checks passed
@NQNStudios NQNStudios deleted the mac-prefs branch September 8, 2024 20:32
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