diff --git a/UE4SS/src/SDKGenerator/UEHeaderGenerator.cpp b/UE4SS/src/SDKGenerator/UEHeaderGenerator.cpp index d3fd25bfb..e175e6190 100644 --- a/UE4SS/src/SDKGenerator/UEHeaderGenerator.cpp +++ b/UE4SS/src/SDKGenerator/UEHeaderGenerator.cpp @@ -639,14 +639,18 @@ namespace RC::UEGenerator } expected_next_enum_value = Value + 1; - if (pre_append_result_line.ends_with(STR("_MAX"))) + StringType pre_append_result_line_lower = pre_append_result_line; + std::transform(pre_append_result_line_lower.begin(), pre_append_result_line_lower.end(), pre_append_result_line_lower.begin(), ::towlower); + if (pre_append_result_line_lower.ends_with(STR("_max"))) { const StringType expected_full_constant_name = std::format(STR("{}_MAX"), enum_prefix); - + StringType expected_full_constant_name_lower = expected_full_constant_name; + std::transform(expected_full_constant_name_lower.begin(), expected_full_constant_name_lower.end(), expected_full_constant_name_lower.begin(), ::towlower); + int64_t expected_max_value = highest_enum_value + 1; // Skip enum _MAX constant if it has a matching name and is 1 greater than the highest value used, which means it has been autogenerated - if ((pre_append_result_line == expected_full_constant_name || pre_append_result_line == sanitize_enumeration_name(expected_full_constant_name)) && + if ((pre_append_result_line_lower == expected_full_constant_name_lower || pre_append_result_line_lower == sanitize_enumeration_name(expected_full_constant_name_lower)) && Value == expected_max_value) { continue; @@ -2922,11 +2926,15 @@ namespace RC::UEGenerator int64 highest_enum_value = 0; const StringType enum_prefix = uenum->GenerateEnumPrefix(); const StringType expected_max_name = std::format(STR("{}_MAX"), enum_prefix); - + StringType expected_max_name_lower = expected_max_name; + std::transform(expected_max_name_lower.begin(), expected_max_name_lower.end(), expected_max_name_lower.begin(), ::towlower); + for (auto [Name, Value] : uenum->ForEachName()) { StringType enum_name = sanitize_enumeration_name(Name.ToString()); - if ((enum_name != expected_max_name && enum_name != sanitize_enumeration_name(expected_max_name)) && Value > highest_enum_value) + StringType enum_name_lower = enum_name; + std::transform(enum_name_lower.begin(), enum_name_lower.end(), enum_name_lower.begin(), ::towlower); + if ((enum_name_lower != expected_max_name_lower && enum_name_lower != sanitize_enumeration_name(expected_max_name_lower)) && Value > highest_enum_value) { highest_enum_value = Value; }