Jump to content

[Solved] How to Use UIFEED and UISTICKYFEED Functions


 Share

Recommended Posts

So I need to use the UIFEED and UISTICKYFEED functions, but I don't know how to use them. The examples in https://alloc8or.re/rdr3/nativedb/ are all in javascript while I am using C++. I don't know how to create structs in C++ like in the examples. Is anyone able to give me an example on how to use the functions?

 

EDIT: Here is the code to use those functions:

// Modified from https://github.com/clixff/ChaosModRDR/blob/master/src/script.cpp and https://github.com/clixff/ChaosModRDR/blob/master/src/script.h
// Discovered when looking through code for a improvement to clixff's mod.

struct NotificationDuration {
	alignas(32) int32_t ms = 2000;
};

struct NotificationData {
	alignas(8) int32_t __unknown = 0;
	alignas(8) const char* title;
	alignas(8) const char* subtitle;
	alignas(8) int32_t __unknown2 = 0;
	alignas(8) Hash iconDict;
	alignas(8) Hash icon;
	alignas(8) Hash iconColor = 0;
	alignas(8) int32_t __unknown3 = 0;
};

void ShowNotification(const char* title, const char* subtitle, const char* iconDict, const char* iconName, int durationMs, const char* iconColor)
{
	if (!notificationDuration)
	{
		notificationDuration = new NotificationDuration();
	}

	if (!notificationData)
	{
		notificationData = new NotificationData();
	}

	notificationDuration->ms = durationMs;

	if (strlen(iconColor) == 0)
	{
		iconColor = "COLOR_PURE_WHITE";
	}

	notificationData->title = MISC::VAR_STRING(10, (char*)"LITERAL_STRING", (char*)title);
	notificationData->subtitle = MISC::VAR_STRING(10, (char*)"LITERAL_STRING", (char*)subtitle);

	notificationData->iconDict = MISC::GET_HASH_KEY((char*)iconDict);
	notificationData->icon = MISC::GET_HASH_KEY((char*)iconName);
	notificationData->iconColor = MISC::GET_HASH_KEY((char*)iconColor);

	if (!TXD::HAS_STREAMED_TEXTURE_DICT_LOADED((char*)iconDict))
	{
		TXD::REQUEST_STREAMED_TEXTURE_DICT((char*)iconDict, 0);
		while (!TXD::HAS_STREAMED_TEXTURE_DICT_LOADED((char*)iconDict)) 
		{
			WAIT(0);
		}
	}

	UIFEED::_UI_FEED_POST_SAMPLE_TOAST((Any*)notificationDuration, (Any*)notificationData, 1, 1);

	TXD::SET_STREAMED_TEXTURE_DICT_AS_NO_LONGER_NEEDED((char*)iconDict);
}

 

Edited by WesternGamer
Link to comment
Share on other sites

You can just declare a normal C++ structs with the variables defined. For instance, this: https://pastebin.com/EJD7ytn
 

const struct1 = new DataView(new ArrayBuffer(32));
const struct2 = new DataView(new ArrayBuffer(64));
struct2.setBigInt64(8*1, BigInt(title), true);
struct2.setBigInt64(8*2, BigInt(msg), true);

 

This means there are two structs of size of 32 bytes and 64 bytes respectively. The first struct gets no data written, so you can just zero it all out. The second one gets two 64bit (8 bytes) values written at offset 8 and 16 (I think DataView starts at offset 0 too). So, for your struct you could for instance declare 4 variables of 8 bytes size (and pointer type or something like uintptr_t) and then set the second and third to title and msg respectively. Hope that helps.

Link to comment
Share on other sites

  • WesternGamer changed the title to [Solved] How to Use UIFEED and UISTICKYFEED Functions
  • 3 weeks later...
  • 2 weeks later...
On 5/17/2022 at 1:06 PM, ekans.oakekane said:

Hey, sorry to cross post but I need horse masks hashes man, I've looked everywhere I could. 

You made "Pimp My Horse" so I assume you have them all.

@ekans.oakekane I am not the author of Pimp My Horse. Please contact the actual author.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...