Skip to content

Adding proper GUI / code for custom model support (gui reimplementation from mcyoung) #128

Open
Teotia444 wants to merge 13 commits intoSuperDude88:mainfrom
Teotia444:main
Open

Adding proper GUI / code for custom model support (gui reimplementation from mcyoung) #128
Teotia444 wants to merge 13 commits intoSuperDude88:mainfrom
Teotia444:main

Conversation

@Teotia444
Copy link
Copy Markdown

This PR is a re-implementation of a re-implementation from McYoung that contains code for a custom model subpage.

(from mcy's pr) The PR contains :

  1. Code for doing the patching. Right now it patches Link.szs and some files for voice clips. It should probably also patch the files for the map icon, too, but I don't know what the right destination for those is.
  2. Adds a way to select a custom model in the Aroma UI. The current mechanism is not ideal or efficient, but unless people have hundreds of models I doubt the O(n log n) overhead will be noticeable. I have made it so that you can have multiple models to choose from.
    This PR still doesn't contain the desktop code, but i'll probably open another one containing just that.

Very quick video showing how the added tabs look :
https://github.com/user-attachments/assets/473a9408-056b-4dca-a6b9-efd0b420c6e3
(can provide more if needed)

Comment thread customizer/model.cpp Outdated
Comment on lines +304 to +308
int fileCount = std::count_if(
begin(std::filesystem::directory_iterator(Utility::get_models_dir())),
end(std::filesystem::directory_iterator(Utility::get_models_dir())),
[](auto& entry) { return entry.is_directory(); }
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

std::vector<fspath> models;
for (auto& dirent : std::filesystem::directory_iterator(Utility::get_models_dir())) {
  if (dirent.is_directory()) models.push(dirent.path());
}
std::sort(models.begin(), models.end()); // readdir order isn't deterministic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thanks, much cleaner!

Comment thread customizer/model.cpp Outdated
Utility::platformLog("Applying custom model " + modelName + "...");

auto model = Utility::get_models_dir() / modelName;
if (modelName == "random") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps this should not overload the value of modelName, since people will get confused if they name a model random...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've replaced "random" with "?" as it is a forbidden character in Windows, which is already less likely to cause issues. I agree tho, modelName should probably not be overloaded and i should just add a new attribute, i'm lazy tho :)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Just tossing ideas out since I haven't really dug through the old code/new code in a while -- but I think logically an empty string would make sense for a random model, basically equivalent to "no specific one provided"

That assumes an empty name isn't used as an error/validity condition anywhere, but honestly the error handling in my original custom model class is already bad so I'll need to rework that part of the system at some point regardless

cleaner code for model fetcher and fixed potential issue with overloading modelName
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