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

Adding Android Support #16

Open
IvesAwadi opened this issue Dec 27, 2023 · 2 comments
Open

Adding Android Support #16

IvesAwadi opened this issue Dec 27, 2023 · 2 comments

Comments

@IvesAwadi
Copy link

Hello, I saw this project a few days ago and it looked very interesting to me. So, I wanted to make some type of port of this for personal use for the Android Platform, but I cannot find an alternative to the narrow function. I have no access to the WideCharToMultiByte function so I don't know how to implement this for Android. Any resources that could help me adapt the narrow function would help greatly, thank you.

@cursey
Copy link
Owner

cursey commented Dec 27, 2023

That function just converts from utf-16 to utf-8 style strings. You can use any cross platform library to achieve the same (see: https://github.com/nemtrif/utfcpp/ utf8::utf16to8).

@IvesAwadi
Copy link
Author

That function just converts from utf-16 to utf-8 style strings. You can use any cross platform library to achieve the same (see: https://github.com/nemtrif/utfcpp/ utf8::utf16to8).

Thank you so much for the library I was able to make it work like this

std::string NarrowString(const FString& Str)
{
	auto CharArray = Str.GetCharArray();

	// Check if array is valid
	if (CharArray.Num() <= 0)
	{
		return { "" };
	}

	// Get pointer to array entry
	auto Data = CharArray.GetData();

	// Make a new unicode string
	std::u16string U16Str { Data };

	return utf8::utf16to8(U16Str);
}

, but I have some issues with the GetPrefixCpp method

It's in a few spots, I'm using 4.27.2 source here
Class.h
image

But calling this will crash the game immediately, and I think it's because the full definition of this function is in Class.cpp
image

Anything I can do to fix this problem?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants