To start with...I discovered this by taking a look at the files that get included when you compile your script.
The files I see are;
target.tmh (everyone includes this in their .tmc file)
defines.tmh (gets included from target.tmh)
hid.tmh (gets included from target.tmh)
sys.tmh (gets included from hid.tmh)
Here's a snip from sys.tmh...
...by a bit of trial and error I got the following working...
...and...
I've not been able to suss out how to use fwrite and fread yet as I can't work out how to declare a buffer etc.
(i am not a programmer and never learnt 'c' beyond a very basic understanding and that was like 20+ years ago)
I did send a support request to support.thrustmaster.com and here's what I got back...
Didn't really expect much more than that, at least they replied.
Also, whilst my code snippets do work when called, I suspect this stuff really ought to be inside eventhandle();
Cheers
Clicker
The files I see are;
target.tmh (everyone includes this in their .tmc file)
defines.tmh (gets included from target.tmh)
hid.tmh (gets included from target.tmh)
sys.tmh (gets included from hid.tmh)
Here's a snip from sys.tmh...
Code:
int fopen(alias name, alias mode){} // returns file handle, NULL if error
int fclose(int handle){} // returns 0 if OK, -1 on error
int fgetc(int handle){} // returns the character read, or -1 on error or EOF
int fputc(int c, int handle){} // returns the written character, -1 on error
int fread(alias buffer, int size, int count, int handle){} // returns number of items read
int fwrite(alias buffer, int size, int count, int handle){} // returns number of items written
int ftell(int handle){} // returns the file position
int fseek(int handle, int offset, int origin){} // origin: 0=set, 1=cur, 2=end. Returns 0 on success, -1 else
int feof(int handle){} // returns != 0 if EOF
...by a bit of trial and error I got the following working...
Code:
int initCaptureStatus() { // Capture variables to a status file "edstatus.dat"
int fp = fopen("edstatus.dat", "w");
fputc(SRunning, fp);
fputc(CargoSc, fp);
fputc(Gears, fp);
fputc(Lights, fp);
fclose(fp);
}
...and...
Code:
int initReadStatus() { // Read variables from a status file "edstatus.dat"
int fp = fopen("edstatus.dat", "r");
int Silent = fgetc(fp);
int Scoop = fgetc(fp);
int Gear = fgetc(fp);
int HeadLights = fgetc(fp);
fclose(fp);
}
I've not been able to suss out how to use fwrite and fread yet as I can't work out how to declare a buffer etc.
(i am not a programmer and never learnt 'c' beyond a very basic understanding and that was like 20+ years ago)
I did send a support request to support.thrustmaster.com and here's what I got back...
Code:
All programming possibility can be found in the manual at the link below - we do recommend checking page 53/60 for custom events:
> http://ts.thrustmaster.com/download/accessories/pc/hotas/software/target/target_script_editor_basics_v1.5_eng.pdf
Be informed that we only provide support for T.A.R.G.E.T if the program malfunctions (crash, no startup, not detecting device).
Didn't really expect much more than that, at least they replied.
Also, whilst my code snippets do work when called, I suspect this stuff really ought to be inside eventhandle();
Cheers
Clicker
Last edited: