{"id":20005029,"url":"https://github.com/jozsefsallai/il2cpp-stringliteral-patcher","last_synced_at":"2025-05-04T17:31:44.785Z","repository":{"id":234684708,"uuid":"625315540","full_name":"jozsefsallai/il2cpp-stringliteral-patcher","owner":"jozsefsallai","description":"Extract and patch string literals from Unity's global-metadata.dat files.","archived":false,"fork":false,"pushed_at":"2023-11-26T22:23:46.000Z","size":10,"stargazers_count":36,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T08:48:33.233Z","etag":null,"topics":["il2cpp","il2cpp-modding","translation","unity"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jozsefsallai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-08T18:24:00.000Z","updated_at":"2025-04-06T19:19:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"9223d9d6-62c6-458b-bb73-a52047e5e87b","html_url":"https://github.com/jozsefsallai/il2cpp-stringliteral-patcher","commit_stats":null,"previous_names":["jozsefsallai/il2cpp-stringliteral-patcher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jozsefsallai%2Fil2cpp-stringliteral-patcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jozsefsallai%2Fil2cpp-stringliteral-patcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jozsefsallai%2Fil2cpp-stringliteral-patcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jozsefsallai%2Fil2cpp-stringliteral-patcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jozsefsallai","download_url":"https://codeload.github.com/jozsefsallai/il2cpp-stringliteral-patcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252371846,"owners_count":21737414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["il2cpp","il2cpp-modding","translation","unity"],"created_at":"2024-11-13T05:37:36.822Z","updated_at":"2025-05-04T17:31:44.743Z","avatar_url":"https://github.com/jozsefsallai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IL2CPP StringLiteral Patcher\n\nThis repository contains two Python scripts that you can use to extract string\nliterals from global-metadata.dat files and patch them into a new file.\n\n## The Problem\n\nRecently, many Unity games have been using IL2CPP to compile their C# code into\nnative binaries. Games that don't have support for localization and don't store\ntexts in MonoBehaviour objects that can be easily obtained, will usually have\na dictionary of hardcoded strings in the game's code. When using IL2CPP, these\nhardcoded string literals will be stored in a byte chunk and a lookup table will\nbe used to determine the index and length of each string required by the game.\n\nThis is good for developers, as it offers faster and safer access to all string\nliterals, but for modders and translators, it can be a bit troublesome. While we\ncan see the string literals themselves in the global-metadata.dat file, editing\nthem is a bit more complicated. Using a hex editor to change the strings will\nwork as long as the new strings are the same length as the old ones, but this is\nfar from ideal.\n\n## The Solution\n\nUsing the scripts from this repository, you can extract all string literals from\na global-metadata.dat file and store them in a JSON file that you can then edit.\nOnce you're done making changes to your strings, you can then create a new\nglobal-metadata.dat file with the patches applied.\n\n## Usage\n\n### Extracting Strings\n\n```\npython3 extract.py -i /path/to/global-metadata.dat -o /path/to/output/strings.json\n```\n\nThis will create a JSON file containing every string literal that can be found\nin the binary. As expected, this file will be rather large, as it contains lots\nof irrelevant strings, such as ones used by Unity, .NET, and other libraries.\n\nUnfortunately, there is no way to reliably tell which strings are the ones that\nthe game actually displays to the player, however, they are usually located in\nthe same chunk of the file (usually towards the end). You can use your editor's\nsearch function to find a string that you know is visible in the game, and then\nlook around that string to determine the chunk that contains the game's strings.\n\nWhile you can keep the other strings in the JSON file, it is recommended that\nyou just remove any string that you don't actually need. The patcher script will\njust copy the original string literal if it can't find a replacement in your\nJSON file.\n\n### Patching Strings\n\n```\npython3 patch.py -i /path/to/original-global-metadata.dat -p /path/to/strings.json -o /path/to/patched-global-metadata.dat\n```\n\nThis will create a new global-metadata.dat file with the updated strings. If all\nwent well, the game will run without any errors and will also display the new\nstrings. The output path can not be the same as the input path.\n\n## Troubleshooting and FAQ\n\n**Q: Where can I find the global-metadata.dat file?**\n\nA: The usual location in the game's directory is: `Managed/Metadata/global-metadata.dat`.\nIf you're trying to mod a Unity WebGL/WebAssembly game, you can find the\nmetadata file by extracting it from the game's data file using a tool such as\n[unityweb][unityweb-url].\n\n**Q: I'm getting \"Invalid global-metadata file\" errors when trying to extract strings.**\n\nA: This error should only be thrown when your global-metadata.dat file doesn't\nstart with the correct magic header. This can either mean that the file is\nencrypted, obfuscated, or actually not a global-metadata.dat file in the\nfirst place.\n\n**Q: I'm getting \"Invalid StringLiteral object\" errors when trying to patch strings.**\n\nA: One of your strings in the JSON file does not follow the correct format. The\nexported JSON file should be an array of objects, each object having two\nkeys: `index` (should never be changed, as it's used for identifying the\nstring) and `value` (the actual string literal). If any of these is missing,\nthe script will throw an error.\n\n**Q: I'm getting a different error when extracting or the resulting strings are\nall garbled.**\n\nA: The global-metadata file is most likely obfuscated. Some game developers may\ndo this to prevent players from reverse engineering their games. If you're\nsure the file is not obfuscated, please [open an issue][issue-tracker-url]\nand I will look into it.\n\n**Q: What version of global-metadata was this tool tested with?**\n\nA: The scripts were only tested with version 29. In theory, version should not\naffect the functionality of the scripts, as the offsets at which the string\nliteral information is stored should be the same. If you encounter any issues\nwith a particular version, please [open an issue][issue-tracker-url].\n\n## License\n\nMIT.\n\n[issue-tracker-url]: https://github.com/jozsefsallai/il2cpp-stringliteral-patcher/issues\n[unityweb-url]: https://github.com/jozsefsallai/unityweb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjozsefsallai%2Fil2cpp-stringliteral-patcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjozsefsallai%2Fil2cpp-stringliteral-patcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjozsefsallai%2Fil2cpp-stringliteral-patcher/lists"}