Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

[C++] DRAW_INSTRUCTIONAL_BUTTONS Scaleform movie


elsewhat

Recommended Posts

Hi,

 

I'm trying to get the instructional buttons (as used in Yoga mission and others) to work in C++.

 

ScriptHook V DotNet has implement very good scaleform support through the Scaleform class

https://github.com/crosire/scripthookvdotnet/blob/a970eed061a599f8a77d8ed405da5dde890fa9e7/source/Scaleform.cpp

 

This class is used to draw instructional buttons in NOOSE and NativeUI mods

https://github.com/Guad/NOOSE/blob/c91b72f46681a8a143d3c659a6007abbc95a6a2b/MissionFailedScreen.cs

https://github.com/Guad/NativeUI/blob/master/UIMenu.cs#L1198

 

This is the code I've been trying to port to C++.

The current code draws the instructional buttons as it should, but approximately 50 ms later they are gone.

 

I believe the .NET examples first setups the scaleform once, and then calls the Render2D for every draw cycle

void Scaleform::Render2D(){   Native::Function::Call(Native::Hash::_0xCF537FDE4FBD4CE5, this->mHandle, 255, 255, 255, 255);}

However, when I try to call the hash CF537FDE4FBD4CE5 from the C++ code in my test draw cycle, nothing seems to happen.

Any idea how to fix this?

 

Here is my current test code. The .NET code has been added as comments.

The scaleform attribute always seems to be 1 after REQUEST_SCALEFORM_MOVIE.

void draw_instructional_button() {	set_status_text("Drawing instructional buttons");	//var scaleform = new Scaleform(0);	//scaleform.Load("instructional_buttons");	int scaleForm = GRAPHICS::REQUEST_SCALEFORM_MOVIE("instructional_buttons");		if (GRAPHICS::HAS_SCALEFORM_MOVIE_LOADED(scaleForm)) {		log_to_file("Scale form has loaded with id " + std::to_string(scaleForm));		//_instructionalButtonsScaleform.CallFunction("CLEAR_ALL");		GRAPHICS::_CALL_SCALEFORM_MOVIE_FUNCTION_VOID(scaleForm, "CLEAR_ALL");		//_instructionalButtonsScaleform.CallFunction("TOGGLE_MOUSE_BUTTONS", 0);		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(scaleForm, "TOGGLE_MOUSE_BUTTONS");		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL(0);		GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();		//_instructionalButtonsScaleform.CallFunction("CREATE_CONTAINER");		//not used in scripts, but doesn't seem to matter		GRAPHICS::_CALL_SCALEFORM_MOVIE_FUNCTION_VOID(scaleForm, "CREATE_CONTAINER");		//_instructionalButtonsScaleform.CallFunction("SET_DATA_SLOT", 0, Function.Call<string>(Hash._0x0499D7B09FC9B407, 2, (int)Control.PhoneSelect, 0), "Select");		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(scaleForm, "SET_DATA_SLOT");		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(0);		//GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_STRING("t_F5");		char* controlKey = CONTROLS::_0x0499D7B09FC9B407(2, 176, 1);		GRAPHICS::_0xE83A3E3557A56640(controlKey);		//alternative if you need to display any key icon (not tested)		//CONTROLS::_0x0499D7B09FC9B407(2, "t_F5", 0);		//GRAPHICS::_BEGIN_TEXT_COMPONENT("F5 key icon text");		//GRAPHICS::_END_TEXT_COMPONENT();		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_STRING("This is a very long text");		GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();		//_instructionalButtonsScaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(scaleForm, "DRAW_INSTRUCTIONAL_BUTTONS");		GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(-1);		//GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT(-1.0f);		GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();		//_instructionalButtonsScaleform.Render2D(), see https://github.com/crosire/scripthookvdotnet/blob/a970eed061a599f8a77d8ed405da5dde890fa9e7/source/Scaleform.cpp#L82		//Native::Function::Call(Native::Hash::_0xCF537FDE4FBD4CE5, this->mHandle, 255, 255, 255, 255);				//Proof of concept. Try to draw scaleform instructional_buttons every 50 ticks		int i = 0;		while (i < 50) {			invoke<Void>(0xCF537FDE4FBD4CE5, scaleForm, 255, 255, 255, 255);			//other calls which fails			//GRAPHICS::_0xCF537FDE4FBD4CE5(scaleForm, 255, 255, 255, 255, 0);			//invoke<Void>(0xCF537FDE4FBD4CE5, scaleForm, 255, 255, 255, 255);			//GRAPHICS::_0x0DF606929C105BE1(scaleForm, 255, 255, 255, 255);			WAIT(50);			i++;		}	}	nextWaitTicks = 3000;}

If I try to call the whole method with CLEAR_ALL and all the instructions it flickers badly, so that is not an option.

I've tried heaps of combinations within the while loop, but nothing seems to have any effect.

 

Please help, I really want this functionality to work

 

 

 

 

Link to post
Share on other sites

While my menu is opened, I do this:

 

 

REQUEST_SCALEFORM_MOVIE("instructional_buttons"); 

 

 

 

Basic functions:

 

 

void set_text_component(char *text){    _BEGIN_TEXT_COMPONENT("STRING");    _ADD_TEXT_COMPONENT_STRING(text);    _END_TEXT_COMPONENT();}void instructionalSetup(){    int movie = REQUEST_SCALEFORM_MOVIE("instructional_buttons");    _0x0DF606929C105BE1(movie, 255, 255, 255, 0);    _PUSH_SCALEFORM_MOVIE_FUNCTION(movie, "CLEAR_ALL");    _POP_SCALEFORM_MOVIE_FUNCTION_VOID();    _PUSH_SCALEFORM_MOVIE_FUNCTION(movie, "SET_CLEAR_SPACE");    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(200);    _POP_SCALEFORM_MOVIE_FUNCTION_VOID();}void addInstructional(char *text, int button, int instructCount){    int movie = REQUEST_SCALEFORM_MOVIE("instructional_buttons");    _PUSH_SCALEFORM_MOVIE_FUNCTION(movie, "SET_DATA_SLOT");    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(instructCount);    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(button);    set_text_component(text);    _POP_SCALEFORM_MOVIE_FUNCTION_VOID();}void instructionalClose(){    int movie = REQUEST_SCALEFORM_MOVIE("instructional_buttons");    _PUSH_SCALEFORM_MOVIE_FUNCTION(movie, "DRAW_INSTRUCTIONAL_BUTTONS");    _POP_SCALEFORM_MOVIE_FUNCTION_VOID();    _PUSH_SCALEFORM_MOVIE_FUNCTION(movie, "SET_BACKGROUND_COLOUR");    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(0);    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(0);    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(0);    _PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(80);    _POP_SCALEFORM_MOVIE_FUNCTION_VOID();}

 

 

 

Button enum (Gamepad):

 

 

enum ScaleformButtons{	ARROW_UP,	ARROW_DOWN,	ARROW_LEFT,	ARROW_RIGHT,	BUTTON_DPAD_UP,	BUTTON_DPAD_DOWN,	BUTTON_DPAD_RIGHT,	BUTTON_DPAD_LEFT,	BUTTON_DPAD_BLANK,	BUTTON_DPAD_ALL,	BUTTON_DPAD_UP_DOWN,	BUTTON_DPAD_LEFT_RIGHT,	BUTTON_LSTICK_UP,	BUTTON_LSTICK_DOWN,	BUTTON_LSTICK_LEFT,	BUTTON_LSTICK_RIGHT,	BUTTON_LSTICK,	BUTTON_LSTICK_ALL,	BUTTON_LSTICK_UP_DOWN,	BUTTON_LSTICK_LEFT_RIGHT,	BUTTON_LSTICK_ROTATE,	BUTTON_RSTICK_UP,	BUTTON_RSTICK_DOWN,	BUTTON_RSTICK_LEFT,	BUTTON_RSTICK_RIGHT,	BUTTON_RSTICK,	BUTTON_RSTICK_ALL,	BUTTON_RSTICK_UP_DOWN,	BUTTON_RSTICK_LEFT_RIGHT,	BUTTON_RSTICK_ROTATE,	BUTTON_A,	BUTTON_B,	BUTTON_X,	BUTTON_Y,	BUTTON_LB,	BUTTON_LT,	BUTTON_RB,	BUTTON_RT,	BUTTON_START,	BUTTON_BACK,	RED_BOX,	RED_BOX_1,	RED_BOX_2,	RED_BOX_3,	LOADING_HALF_CIRCLE_LEFT,	ARROW_UP_DOWN,	ARROW_LEFT_RIGHT,	ARROW_ALL,	LOADING_HALF_CIRCLE_LEFT_2,	SAVE_HALF_CIRCLE_LEFT,	LOADING_HALF_CIRCLE_RIGHT,};

 

 

 

So, while the mainmenu is opened there's this function:

 

 

if (menu::currentsubmenu == SUBMENU::MAINMENU){	instructionalSetup();	addInstructional("Open Submenu", BUTTON_A, 0);	addInstructional("Exit Menu", BUTTON_B, 1);	addInstructional("Scroll", BUTTON_DPAD_UP_DOWN, 2);	instructionalClose();} 

 

 

 

Use this and rewrite it in your script.

Note: If it doesn't show up, make sure it's looped! blackhat.gif

Edited by Unknown_Modder
  • Like 4
Link to post
Share on other sites

Thanks !

 

Seems like you need to perform the full scaleform at every draw cycle. By reducing WAIT(50) to WAIT(0) it's working.

(was a bit confused by the Scripthook V .NET code which appears to only call one of the functions for each draw cycle)

Link to post
Share on other sites

Tick != Frame

 

Also you calling WAIT which is sleep equivalent in GTA Thread, so you're calling 50 ticks and 50 ticks between them, which wouldn't show scaleform no way, because I said Tick(should be faster) not related to frame.

 

All the best,

Paul.

Link to post
Share on other sites
  • 2 months later...
ClareXoBearrx3R9

I realize this is a slightly old thread... however, I did some debugging and looped from 0-337 for the scaleform ID's to get some button icons since I couldn't find the one I was looking for.

 

Anyhow, I took a screenshot, and thought perhaps this would help someone. The button/icon ID is shown in brackets [ ] next (to the left of) the icon.

 

(I can't post the image extension since it has none, so here's the direct link): http://images.akamai.steamusercontent.com/ugc/647751724444866058/55C1F797AB4923495DF164D7ABA818AB66AE1E64/

 

The screenshot was taken from my netbook, so please do not mind the graphics.

  • Like 2
Link to post
Share on other sites

 

Button enum (Gamepad):

This instructional buttons does not work for keyboard input?

 

They do work for keyboard but when I posted this, I have not yet used it for the PC.

I've taken the functions and enum from my PS3 .sprx and replaced _0x7B48E696 with _0x0DF606929C105BE1.

Edited by Unknown_Modder
Link to post
Share on other sites
ClareXoBearrx3R9

 

They do work for keyboard

 

OK, where can i find codes for actions/keys? There is almost no keyboard keys on ClareXoBearrx3's screenshot.

 

Good question lol. Hopefully someone can answer that; I was definitely surprised that so many buttons were missing, yet I've seen them in use in various scripts and mods. :p

Link to post
Share on other sites

 

 

They do work for keyboard

 

OK, where can i find codes for actions/keys? There is almost no keyboard keys on ClareXoBearrx3's screenshot.

 

Good question lol. Hopefully someone can answer that; I was definitely surprised that so many buttons were missing, yet I've seen them in use in various scripts and mods. :p

 

 

Keys have their own syntax "t_<key>" for example t_C

 

Example:

GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(scaleForm, "SET_DATA_SLOT");
GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(0);
GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_STRING("t_C");
GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_STRING("Stop preview");
GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();
  • Like 1
Link to post
Share on other sites

There is a better method to give a key (action):

 

sub_7bbb(l_8C, "SET_DATA_SLOT", 3.0, CONTROLS::_0499D7B09FC9B407(2, 183, 1), "CELL_GRID");void sub_7bbb(auto a_0, auto a_1, auto a_2, auto a_3, auto a_4) {    GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(a_0, a_1);    GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(SYSTEM::ROUND(a_2));    if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(a_3)) {        sub_7bfa(a_3);    }    if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(a_4)) {        sub_7a48(a_4);    }    GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();}void sub_7bfa(auto a_0) {    GRAPHICS::_E83A3E3557A56640(a_0);}

But this requires more research...

Edited by gtaVmod
Link to post
Share on other sites

There is a better method to give a key (action):

sub_7bbb(l_8C, "SET_DATA_SLOT", 3.0, CONTROLS::_0499D7B09FC9B407(2, 183, 1), "CELL_GRID");void sub_7bbb(auto a_0, auto a_1, auto a_2, auto a_3, auto a_4) {    GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(a_0, a_1);    GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(SYSTEM::ROUND(a_2));    if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(a_3)) {        sub_7bfa(a_3);    }    if (!GAMEPLAY::IS_STRING_NULL_OR_EMPTY(a_4)) {        sub_7a48(a_4);    }    GRAPHICS::_POP_SCALEFORM_MOVIE_FUNCTION_VOID();}void sub_7bfa(auto a_0) {    GRAPHICS::_E83A3E3557A56640(a_0);}

But this requires more research...

 

You mean sub_7bbb, right?

 

Anyway, I just renamed _0x0499D7B09FC9B407 to _GET_INSTRUCTIONAL_BUTTON_FROM_CONTROL (don't know a better name) on the Native DB because (for those who didn't know it yet) it "converts" the control to its instructional button.

Examples:

 

_GET_INSTRUCTIONAL_BUTTON_FROM_CONTROL(2, 201, 1) /*INPUT_FRONTEND_ACCEPT*/ will be converted into

WebCgkp.png

 

_GET_INSTRUCTIONAL_BUTTON_FROM_CONTROL(2, 202, 1) /*INPUT_FRONTEND_CANCEL*/ will be converted into

fGAT74y.png

 

and _GET_INSTRUCTIONAL_BUTTON_FROM_CONTROL(2, 51, 1) /*INPUT_CONTEXT*/ will be converted into

hYL7Jw7.png

Edited by Unknown_Modder
  • Like 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.