1616#include < Unreal/UObject.hpp>
1717#include < Unreal/UObjectGlobals.hpp>
1818#include < Unreal/UnrealVersion.hpp>
19+ #include < Unreal/UKismetSystemLibrary.hpp>
1920
2021#include " UE4SSProgram.hpp"
2122
@@ -510,7 +511,30 @@ namespace RC::OutTheShade
510511 UsmapData.resize (UncompressedStream.size ());
511512 memcpy (UsmapData.data (), UncompressedStream.data (), UsmapData.size ());
512513
513- auto filename = to_string (UE4SSProgram::get_program ().get_working_directory ()) + " //Mappings.usmap" ;
514+ // Build filename: GameName-EngineVersion-UE4SSCommitSHA.usmap
515+ FString game_name_fstr = UKismetSystemLibrary::GetGameName ();
516+ FString engine_version_fstr = UKismetSystemLibrary::GetEngineVersion ();
517+
518+
519+ std::string engine_version = to_utf8_string (*engine_version_fstr);
520+ std::string game_name = to_utf8_string (*game_name_fstr);
521+ std::string commit_sha = UE4SS_LIB_BUILD_GITSHA;
522+
523+ // Sanitize strings for filename (replace spaces and invalid chars with underscores)
524+ auto sanitize_for_filename = [](std::string& str) {
525+ for (char & c : str)
526+ {
527+ if (c == ' ' || c == ' /' || c == ' \\ ' || c == ' :' || c == ' *' || c == ' ?' || c == ' "' || c == ' <' || c == ' >' || c == ' |' )
528+ {
529+ c = ' _' ;
530+ }
531+ }
532+ };
533+ sanitize_for_filename (engine_version);
534+ sanitize_for_filename (game_name);
535+
536+ std::string usmap_filename = game_name + " -" + engine_version + " -" + commit_sha + " .usmap" ;
537+ auto filename = to_string (UE4SSProgram::get_program ().get_working_directory ()) + " //" + usmap_filename;
514538 auto FileOutput = FileWriter (filename.c_str ());
515539
516540 FileOutput.Write <uint16_t >(0x30C4 ); // magic
@@ -524,5 +548,6 @@ namespace RC::OutTheShade
524548 FileOutput.Write (UsmapData.data (), UsmapData.size ());
525549
526550 Output::send (STR (" Mappings Generation Completed Successfully!\n " ));
551+ Output::send (STR (" Output file: {}\n " ), to_wstring (usmap_filename));
527552 }
528553} // namespace RC::OutTheShade
0 commit comments