How will the #include <ps4.gph> work?

GPC2 script programming for Titan Two. Code examples, questions, requests.

How will the #include <ps4.gph> work?

Postby Vendetta » Sat Sep 10, 2016 4:18 pm

First Question: How will the #include <ps4.gph> work?

Will we be able to load in all of our #define(s) in a separate header document (.ghp)?

So define list like below will not be necessary, on each individual script? Chime in if you know?

Code: Select all
#define PS4_PS                BUTTON_1
#define PS4_SHARE          BUTTON_2
#define PS4_OPTIONS       BUTTON_3
#define PS4_R1                BUTTON_4
#define PS4_R2                BUTTON_5
#define PS4_R3                BUTTON_6
#define PS4_L1                BUTTON_7
#define PS4_L2                BUTTON_8
#define PS4_L3                BUTTON_9
#define PS4_UP               BUTTON_10
#define PS4_DOWN          BUTTON_11
#define PS4_LEFT            BUTTON_12
#define PS4_RIGHT          BUTTON_13
#define PS4_TRIANGLE    BUTTON_14
#define PS4_CIRCLE        BUTTON_15
#define PS4_CROSS         BUTTON_16
#define PS4_SQUARE       BUTTON_17
#define PS4_TOUCH         BUTTON_18
#define PS4_TOUCH1       BUTTON_19
#define PS4_TOUCH2       BUTTON_20



Second questions: It is faster to type just [PS4_R2] in the code instead of [BUTTON_5], we used to able just to type [4]. What will be the benefit of using [BUTTON_5].

Example:
Code: Select all
  if(get_val(4) && event_press(15)) {  //ads trigger + D-Pad left
        if(Enabled) {
            Enabled = FALSE;
            colorled(0,1,0,0);  //red Off
        }  else if(!Enabled) {
            Enabled = TRUE;
            colorled(0,0,1,0);  //green On
            combo_run(RumbleNotifier);
        }
    Playstation PS4, Astro A50 Gen 3, Elgato Game Capture HD60 S
    2x Benq 27” Gaming Monitors, Netduma R1 Gaming Router
    Titan One/Two Controller Input Device, Battle Beaver PS4 Controller, SCUF Infinity4PS Controller
User avatar
Vendetta
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 226
Joined: Fri Jul 31, 2015 8:40 pm

Re: How will the #include <ps4.gph> work?

Postby FCB77 » Sat Sep 10, 2016 5:28 pm

1. yes you can put all your defines in another file.
2. i think J2Kbr said many people who downloads the scripts are confused when they see constants like XB1_RT.
they think the script only works on the XBOX1. so using lets says constants like BUTTON_1 will let users know that the same script works on ALL consoles.
Last edited by FCB77 on Sat Sep 10, 2016 5:29 pm, edited 1 time in total.
User avatar
FCB77
Command Sergeant Major
Command Sergeant Major
 
Posts: 138
Joined: Sun Feb 01, 2015 9:21 am

Re: How will the #include <ps4.gph> work?

Postby J2Kbr » Sat Sep 10, 2016 5:29 pm

The header files ps4.gph, xb1.gph, PS3.gph and xb360.gph provides familiar designators to be used, instead of the generic ones, such BUTTON_???, STICKER_???, etc

You can include those header files in any gpc code, or other headers. There is no limitation on that.

As far as performance goes, there is not difference, the generated Bytecote is exactely the same using BUTTON_, PS4_ or the direct index value.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: How will the #include <ps4.gph> work?

Postby J2Kbr » Sat Sep 10, 2016 5:30 pm

Thank you FCB77, you are totally correct.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: How will the #include <ps4.gph> work?

Postby Vendetta » Sat Sep 10, 2016 5:43 pm

Okay think I'm starting to follow the new system.

Look at the image post here: http://www.consoletuner.com/forum/viewtopic.php?f=23&t=4572


Question: You would load your common <ps4.gph> file in slot 1 and your scripts in 2-9? Or is it already built in somewhere?
    Playstation PS4, Astro A50 Gen 3, Elgato Game Capture HD60 S
    2x Benq 27” Gaming Monitors, Netduma R1 Gaming Router
    Titan One/Two Controller Input Device, Battle Beaver PS4 Controller, SCUF Infinity4PS Controller
User avatar
Vendetta
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 226
Joined: Fri Jul 31, 2015 8:40 pm

Re: How will the #include <ps4.gph> work?

Postby J2Kbr » Sat Sep 10, 2016 6:20 pm

Okay, I think I saw where it is confusing.

The ps4.gph is not used by Titan Two after compilation. This header file is only used at compilation time, to tell the compiler which input/output index you are referring to. In this example PS4_CROSS is translated to BUTTON_16, and then BUTTON_16 is translated to the index number. So, at the end, the result is the same as using the button index number.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: How will the #include <ps4.gph> work?

Postby pablosscripts » Mon Sep 12, 2016 1:34 am

J2Kbr wrote:The header files ps4.gph, xb1.gph, PS3.gph and xb360.gph provides familiar designators to be used, instead of the generic ones, such BUTTON_???, STICKER_???, etc

You can include those header files in any gpc code, or other headers. There is no limitation on that.

As far as performance goes, there is not difference, the generated Bytecote is exactely the same using BUTTON_, PS4_ or the direct index value.


I've been wondering this for days now. Glad to have confirmation that it doesn't affect performance. I'm going to add this whole thread to my mega post as it has been very informative.
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 118 guests