Interactive Configuration ... lost in bytespace ? Helpertool

GPC script programming for Titan Two device. Code examples, how to, questions, requests.

Moderators: The_Rabid_Taco, pablosscripts, bonefisher

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby Scachi » Mon Nov 19, 2018 1:41 pm

Updated, Version 1.6.12 -> Download from Github here.
Changes:
Added column to display the byteoffset as hex too,
Stripping leading/trailing white spaces from all values
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2239
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby Scachi » Fri Nov 23, 2018 6:28 am

Updated, Version 1.6.13 -> https://github.com/J2Kbr/GtunerIV/issues/171
Changes:
Fixed bug: parsing combobox item lines containing the char [ did parse them as a new IC option name
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2239
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby USER102 » Wed Dec 12, 2018 2:58 am

does this work on windows 95?
User avatar
USER102
Private First Class
Private First Class
 
Posts: 2
Joined: Tue Dec 11, 2018 9:13 pm

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby Scachi » Wed Dec 12, 2018 6:01 am

USER101 wrote:does this work on windows 95?

Nice joke..Win95 is like 20 years obsolete so I don't know, don't care if this works on it.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2239
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby Scachi » Wed Dec 12, 2018 6:12 am

Updated to version 1.6.14 -> https://github.com/J2Kbr/GtunerIV/issues/171
Fixed problem when parsing lines without whitespace between keyword= or =value
like
byteoffset=10
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2239
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby USER101 » Thu Dec 13, 2018 9:59 am

This is going to be so freaking awesome when I learn how to use pmem. still working on my core script then moving to the interface. Thanks for sharing your work.
User avatar
USER101
Command Sergeant Major
Command Sergeant Major
 
Posts: 115
Joined: Mon Dec 03, 2018 5:45 pm

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby USER101 » Tue Dec 25, 2018 9:45 pm

So I have finally gotten around to pmem.. I have added a flag and check box and that seems to be working. It also shows in IC bytetable but I also tried to save a single 16bit variable using:

Code: Select all
 
int fileNumber = 1;
init {
pmem_load();
pmem_read(4, &fileNumber);
}
main {
/*
code to set conditional file number
*/

set_pvar(4, &fileNumber); // this line is what I use to save conditional file number 
}
void set_pvar(uint8 idx, int16 val) {
    pmem_write(idx, val);
    pmem_save();
}


The IC bytetable program only shows the check box. Is it possible to save a variable to pmem without having an interface in the interface config portion? I am simply trying to let the user start at the same macro location they were on when they last used my script. Am I using this right? Should the IC bytetable overview program shoe all offsets being used or just from the interactive configuration?

Thanks
Jess
User avatar
USER101
Command Sergeant Major
Command Sergeant Major
 
Posts: 115
Joined: Mon Dec 03, 2018 5:45 pm

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby Sillyasskid » Wed Dec 26, 2018 12:53 am

Jesscorp wrote:Is it possible to save a variable to pmem without having an interface in the interface config portion?

Code: Select all
uint16 fileNumber, old_fileNumber;
init {
  pmem_load();
  pmem_read(4, &fileNumber);
 
  old_fileNumber = fileNumber;
 
// Make sure the correct filenumber is printed.
  printf("<hr>filenumber: <b>%d", fileNumber);
}
main {
//Code to set conditional file number
  if(event_active(BUTTON_16)) ++fileNumber;
 
// This contion will prevent flooding the set_pvar function.
  if(old_fileNumber != fileNumber){
  // This line is what I use to save conditional file number.
    set_pvar(4, fileNumber);
    old_fileNumber = fileNumber;
  }
}
 
// The function will run only if the fileNumber value changes.
void set_pvar(uint8 idx, int16 val) {
  pmem_write(idx, val);
  pmem_save();
  printf("filenumber: %d saved.", fileNumber);
  return;
}

Here is an example based off your script, it does not require the interactive config.

The filenumber value will increment, every time BUTTON_16 (A / CROSS) is pressed.
The value will save, and carry over the next time you load the script.
User avatar
Sillyasskid
Captain
Captain
 
Posts: 577
Joined: Sat May 14, 2016 3:07 am

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby Scachi » Wed Dec 26, 2018 10:54 am

The program IC-Bytetable does check the Interactive Configuration definitions only, lines between tags <cfgdesc></cfgdesc>, for errors/problems/memory usage.

It does not parse the actual code of a script. IC-Bytetable == InteractiveConfiguration-Bytetable

You can use the persistent memory without an Interactive Configuration but you can't use the program IC-Bytetable without an Interactive Configuration.
https://www.consoletuner.com/wiki/index ... ent_memory
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 2239
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Interactive Configuration ... lost in bytespace ? Helper

Postby USER101 » Thu Dec 27, 2018 2:50 am

There was a major issue with my code that kept messing with me. the line set_pvar(4, &fileNumber); come to find out the & should not be in front of the fileNumber.. it was the only thing that kept my code from not working to begin with. It was fixed in your code but the change was not very apparent to me at first. I appreciate your responses. Smarter everyday :)
Thanks
Jess
User avatar
USER101
Command Sergeant Major
Command Sergeant Major
 
Posts: 115
Joined: Mon Dec 03, 2018 5:45 pm

PreviousNext

Return to GPC Script Programming (Titan Two)

Who is online

Users browsing this forum: No registered users and 7 guests