Jump to content

[SA|REL] CLEO 4.3


Deji

Recommended Posts

 

There is a discussion on breaking the limit of global variables in main.scm. Breaking this limit would open great possibilities (not mentioning details) for projects such as SAxVCxLC and GTA Underground. In particular SAxVCxLC supports legacy mods, so CLEO support is really important (which could be complemented but not replaced by new solutions).

 

The limit is cause by the interpreter which uses __int16 for addressing global variables. Fastman92 would be able to break the limit of the interpreter, however, cleo would also have to be updated to support the bigger datatype (32bit). Could you add such support?

I don't know if it's neccessarily required to update CLEO, or whether I can hack a limit in my FLA, but certainly the compiler (Sanny Builder) needs to be updated.

 

Besides more global variables I also need to be able to use new opcodes that I provide via a cleo plugin. I have already tested that cleo-opcodes can indeed be used inside main.scm. Would this still work if the limit is hacked but cleo is not updated?

 

Btw.

- What is the limit on the number of custom opcodes provided via cleo plugin?

- Is invocation of custom opcodes efficient when I add 1000 opcodes? I mean is the search for the C-function that implements the opcode fast? (I hope cleo does not use linear search to find the C-function which would be a problem if I add 1000 codes)

Link to comment
Share on other sites

 

 

There is a discussion on breaking the limit of global variables in main.scm. Breaking this limit would open great possibilities (not mentioning details) for projects such as SAxVCxLC and GTA Underground. In particular SAxVCxLC supports legacy mods, so CLEO support is really important (which could be complemented but not replaced by new solutions).

 

The limit is cause by the interpreter which uses __int16 for addressing global variables. Fastman92 would be able to break the limit of the interpreter, however, cleo would also have to be updated to support the bigger datatype (32bit). Could you add such support?

I don't know if it's neccessarily required to update CLEO, or whether I can hack a limit in my FLA, but certainly the compiler (Sanny Builder) needs to be updated.

 

Besides more global variables I also need to be able to use new opcodes that I provide via a cleo plugin. I have already tested that cleo-opcodes can indeed be used inside main.scm. Would this still work if the limit is hacked but cleo is not updated?

 

Btw.

- What is the limit on the number of custom opcodes provided via cleo plugin?

- Is invocation of custom opcodes efficient when I add 1000 opcodes? I mean is the search for the C-function that implements the opcode fast? (I hope cleo does not use linear search to find the C-function which would be a problem if I add 1000 codes)

 

The commands use no searching algorithm in CLEO, but an array of element for each possible ID.

 

 

 

memcpy_0(&customTable, (const void *)v1, 0x70u);
I'm not sure about the limit of commands, but it seems to be:

(100 * 0x70) / 4 = 2800

means the max command ID than can be defined with custom Opcode system would be 2799 (0xAEF)

Link to comment
Share on other sites

The limit is 0x7FFF actually, CLEO has a extra table which expands the default table limit.

  • Like 2
Link to comment
Share on other sites

Don't hack limits (or anything) regarding scripting while using CLEO without being ready to suffer. That's CLEOs job.

 

And hacking global var range is a bad idea in general. It'd be safer and easier to create new variable types (kinda like how SuperVars works)...

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

Can CLEO 4.3 work with ThirteenAG Ultimate ASI loader 1.5? Where to put the CLEO.asi and Cleo folder?

 

Right in the GTA San Andreas install directory.

Link to comment
Share on other sites

  • 5 weeks later...

Which is the first cleo sdk which provides

SCRIPT_VAR * WINAPI CLEO_GetPointerToScriptVariable(CScriptThread *thread);

and is that version somewhere available?

 

I have compiled my plugin with 4.3.19. The I wanted to findout if I can use my plugin with a smaller verion of cleo at runtime. When cleo 4.3.18 is installed (which you have recommended above), then CLEO_GetVersion() returns 67305472. This seems to be a bug.

 

An update of cleo addressing the points discussed on the previous pages would be welcome.

Edited by goodidea82
Link to comment
Share on other sites

An update of cleo addressing the points discussed on the previous pages would be welcome.

ffs, open source this, thanks.

Neither things can be done until March when I'll be able to continue development.

Link to comment
Share on other sites

Improvement for CLEO.h.

The keyword "extern" has different meaning for function and variables. The declaration of the variables opcodeParams and missionLocals should be done unconditioned. Otherwise problems arise when including CLEO.h in multiple files.

 

 

#ifdef __cplusplusextern "C" {#endif	//__cplusplusDWORD WINAPI CLEO_GetVersion();int   WINAPI CLEO_GetGameVersion();BOOL  WINAPI CLEO_RegisterOpcode(WORD opcode, _pOpcodeHandler callback);DWORD WINAPI CLEO_GetIntOpcodeParam(CScriptThread* thread);float WINAPI CLEO_GetFloatOpcodeParam(CScriptThread* thread);void  WINAPI CLEO_SetIntOpcodeParam(CScriptThread* thread, DWORD value);void  WINAPI CLEO_SetFloatOpcodeParam(CScriptThread* thread, float value);LPSTR WINAPI CLEO_ReadStringOpcodeParam(CScriptThread* thread, LPSTR buf, int size);void  WINAPI CLEO_WriteStringOpcodeParam(CScriptThread* thread, LPCSTR str);void  WINAPI CLEO_SetThreadCondResult(CScriptThread* thread, BOOL result);void  WINAPI CLEO_SkipOpcodeParams(CScriptThread* thread, int count);void  WINAPI CLEO_ThreadJumpAtLabelPtr(CScriptThread* thread, int labelPtr);int   WINAPI CLEO_GetOperandType(CScriptThread* thread);//SCRIPT_VAR *opcodeParams; WRONG//SCRIPT_VAR; WRONG//intermediate data is stored in opcodeParams arrayvoid WINAPI CLEO_RetrieveOpcodeParams(CScriptThread *thread, int count);void WINAPI CLEO_RecordOpcodeParams(CScriptThread *thread, int count);SCRIPT_VAR * WINAPI CLEO_GetPointerToScriptVariable(CScriptThread *thread);#ifdef __cplusplus}#endif	//__cplusplusextern SCRIPT_VAR *opcodeParams;extern SCRIPT_VAR;

 

 

Edited by goodidea82
Link to comment
Share on other sites

Yeah, but It's just missing the extern itself, no need to put it outside the extern "C" block. This is because extern is implicit in functions, which is not true for variables. Extern does have the same meaning on functions and variables.

Edited by LINK/2012
Link to comment
Share on other sites

Indeed, there is no need to put it outside,it can be added inside the extern-block.

 

With difference between extern variables and functions I meant this which is just very subtle (default behavior):

 

 

There's a difference between "extern" on functions and on variables: on variables it doesn't instantiate the variable itself, i.e. doesn't allocate any memory. This needs to be done somewhere else. Thus it's important if you want to import the variable from somewhere else. For functions, this only tells the compiler that linkage is extern. As this is the default (you use the keyword "static" to indicate that a function is not bound using extern linkage) you don't need to use it explicitly.

 

 

Edited by goodidea82
Link to comment
Share on other sites

As far as I understand there is a mismatch between the definition of operand type numbers in CLEO.h and GTA SA Modding book 1.0 by fastman92. According to CLEO.h the operand type 01 is for float and 06 for integers. According to the modding book it is the opposite.
CLEO.h

 

//operand types#define	globalVar			2		//$#define	localVar			3		//@#define	globalArr			7		//$(,)#define	localArr 			8		//@(,)#define	imm8 				4		//char#define	imm16 				5		//short#define	imm32 				6		//long, unsigned long#define	imm32f 				1		//float#define	vstring 			0x0E	//""#define	sstring 			9		//''#define	globalVarVString 	0x10	//v$#define	localVarVString 	0x11	//@v#define	globalVarSString 	0x0A	//s$#define	localVarSString 	0x0B	//@s

 



Modding book (section Compiled code – data types):

 

[table]

 

Data types (in hex) Size of data Extra info
01 4 Static number: (Long) Integer – 32 bits

 

06 4 Float IEEE 754 – 32 bits

[/table]

 

 

Btw, can someone help me here how to read and write different types of strings using CLEO sdk? There are different kinds of strings but only one function to write and only one to read strings. How do I use them with different string types?

 

Or do I have to check the operand type and then read and write the string data as integers?

Edited by goodidea82
Link to comment
Share on other sites

SCM argument types:

http://pastebin.com/AuV094iT

Edited by fastman92
Link to comment
Share on other sites

  • 1 month later...

CLEO 4.3.21 released!

 

The most important CLEO update ever.

Link to comment
Share on other sites

Many thanks for this latest update, but is it normal that my game can't find the saves folder anymore?

Edited by A.G.
Link to comment
Share on other sites

Many thanks for this latest update, but is it normal that my game can't find the saves folder anymore?

 

It's not normal, no, but it's nothing that has changed in the update. Perhaps a mod or something?

Edited by Deji
Link to comment
Share on other sites

 

Many thanks for this latest update, but is it normal that my game can't find the saves folder anymore?

 

It's not normal, no, but it's nothing that has changed in the update. Perhaps a mod or something?

 

My game was loading the save folder just fine before, including settings. I had a previous version of CLEO 4 already, then I just updated it with this latest one and this problem appeared.

Link to comment
Share on other sites

 

 

Many thanks for this latest update, but is it normal that my game can't find the saves folder anymore?

 

It's not normal, no, but it's nothing that has changed in the update. Perhaps a mod or something?

 

My game was loading the save folder just fine before, including settings. I had a previous version of CLEO 4 already, then I just updated it with this latest one and this problem appeared.

 

 

Which exact version of CLEO did you have previously? Which scripts do you have installed?

Edited by Deji
Link to comment
Share on other sites

Solved. My game's folder name had parenthesis, as I have x2 game folders (backups). After removing them from the folder name, saves re-appeared.

Link to comment
Share on other sites

CLEO 4.3.21 released!

 

The most important CLEO update ever.

Thanks! Don't forget to create a good back-up of your source files on different device(s) this time.

I hope to be able to test it next week.

Link to comment
Share on other sites

frankandbeans

Hi, sorry if this is the wrong thread to say this, but I can't seem to use Ryosuke's man portable missile (for use with cleo 3) using cleo 4.3.21 or 4.3.20, even if I changed the extension to .cs3. It was the only mod I was running at the time and I am able to use cleo 4.3.21/4.3.20 without any problems. The crash only happens when I switch weapon to the homing launcher (the weapon the mod affects). I can use it just fine with cleo 3 though. Also deleted gta_sa.set from gta sa user file every time I tried just incase.

Link to comment
Share on other sites

What about fixing these bugs:

 

-Opcode 0A9F only works in CLEO script and not in lets say a normal thread, as the thread IP is empty. I even wrote my own script to check the thread IP myself. If I place my code in a CLEO script it would work fine. I would like this to be fixed. I prefer putting everything inside the SCM file.

-Audio streams start playing again when alt tabbing (they get disabled when pressing escape, but start playing again after alt tabbing)

 

And SCM functions also don't work in SCM.

 

If you can fix these bugs I would highly appriceate it, don't know if they are mentioned anywhere but I thought I'd mention them anyways.

Link to comment
Share on other sites

  • 3 weeks later...
Junior_Djjr

"cleo_saves" folder is not being created if it doesn't exist.

Link to comment
Share on other sites

  • 3 weeks later...
Junior_Djjr

SetPos is inverted, and Y is up in bass not Z.

 

Serious? How long has this problem?

Apparently from 4.2.

 

void C3dAudioStream::Set3dPosition(const RwV3d& pos)	{		BASS_ChannelSet3DPosition(streamInternal, 			reinterpret_cast<const BASS_3DVECTOR *>(&pos), nullptr, nullptr);	}
There is no coordinate conversion.

 

To work properly, it is necessary:

 

actor.StorePos($player_actor,1@,2@,3@)audiostream.SetPosition(0@,3@,1@,2@)
I'm bit confuse btw. How no one noticed this? My friend Fabio is also with this problem. Edited by Junior_Djjr
Link to comment
Share on other sites

Good catch, but I think fixing this after so long would led to undesired behaviour (i.e. correct scripts that used x,z,y breaking).

 

Best thing to do is warn about it on its documentation.

Edited by LINK/2012
Link to comment
Share on other sites

It hasn't been noticed as almost no one uses audio streams. Most modders do not have the means to produce new audio.

Link to comment
Share on other sites

Update source on github plx :evilgrin:

  • Like 2
Link to comment
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.