Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Allow junk files in the mod folder
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoticgd committed Aug 21, 2023
1 parent b85b235 commit f5880c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions libra/mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ RA_Result RA_mod_list_load(RA_Mod** mods_dest, u32* mod_count_dest, const char*

for(u32 i = 0; i < file_names.count; i++) {
if((result = RA_mod_read(&mods[i], game_dir, file_names.strings[i])) != RA_SUCCESS) {
RA_string_list_destroy(&file_names);
return RA_FAILURE("%s for mod %s", result->message, file_names.strings[i]);
if(strcmp(result->message, "unsupported format") != 0) {
RA_string_list_destroy(&file_names);
return RA_FAILURE("%s for mod %s", result->message, file_names.strings[i]);
}
}
}

Expand Down Expand Up @@ -119,13 +121,14 @@ static RA_Result parse_rcmod(RA_Mod* mod, const char* game_dir, const char* mod_

RA_Result RA_mod_read(RA_Mod* mod, const char* game_dir, const char* mod_file_name) {
const char* extension = strrchr(mod_file_name, '.');

if(strcmp(extension, ".stage") == 0) {
return parse_stage(mod, game_dir, mod_file_name);
}

if(strcmp(extension, ".rcmod") == 0) {
return parse_rcmod(mod, game_dir, mod_file_name);
if(extension != NULL) {
if(strcmp(extension, ".stage") == 0) {
return parse_stage(mod, game_dir, mod_file_name);
}

if(strcmp(extension, ".rcmod") == 0) {
return parse_rcmod(mod, game_dir, mod_file_name);
}
}

return RA_FAILURE("unsupported format");
Expand Down
2 changes: 1 addition & 1 deletion modmanager.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static void mod_list() {
for(u32 i = 0; i < mod_count; i++) {
RA_Mod* mod = &mods[i];

if(RA_string_find_substring_no_case(mod->file_name, filter)) {
if(mod->initialised && RA_string_find_substring_no_case(mod->file_name, filter)) {
igPushID_Int(i);
igTableNextRow(ImGuiTableFlags_None, 0.f);
igTableNextColumn();
Expand Down

0 comments on commit f5880c5

Please sign in to comment.