Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespaces to the types' names. #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ private void InitializeNaming() {
TypeNamer = TypeNamespace.MakeNamer<TypeInfo>((ti) => {
if (ti.IsArray)
return TypeNamer.GetName(ti.ElementType) + "__Array";
var name = ti.Name.ToCIdentifier();
var name = ti.Namespace + (String.IsNullOrEmpty(ti.Namespace) ? "" : ".") + ti.Name;
name = name.ToCIdentifier();
name = Regex.Replace(name, "__+", "_");
// Work around a dumb IDA bug: enums can't be named the same as certain "built-in" types
// like KeyCode, Position, ErrorType. This only applies to enums, not structs.
Expand Down
6 changes: 3 additions & 3 deletions Il2CppInspector.Common/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ std::string il2cppi_to_string(Il2CppString* str) {
}

// Helper function to convert System.String to std::string
std::string il2cppi_to_string(app::String* str) {
std::string il2cppi_to_string(app::System_String* str) {
return il2cppi_to_string(reinterpret_cast&lt;Il2CppString*&gt;(str));
}
#endif</value>
Expand Down Expand Up @@ -224,7 +224,7 @@ void il2cppi_new_console();
std::string il2cppi_to_string(Il2CppString* str);

// Helper function to convert System.String to std::string
std::string il2cppi_to_string(app::String* str);
std::string il2cppi_to_string(app::System_String* str);
#endif

// Helper function to check if a metadata usage pointer is initialized
Expand Down Expand Up @@ -1363,4 +1363,4 @@ void Run();</value>
&lt;/ItemGroup&gt;
&lt;/Project&gt;</value>
</data>
</root>
</root>