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 Diamond Casino 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. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA 6

      1. St Andrews Cathedral
    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

      1. Guides & Strategies
      2. Help & Support
    11. 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. DYOM
      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

Deji

[SA|REL] CLEO 4.3

Recommended Posts

goodidea82

 

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)

Share this post


Link to post
Share on other sites
fastman92

 

 

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)

  • Like 1

Share this post


Link to post
Share on other sites
thelink2012

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

  • Like 2

Share this post


Link to post
Share on other sites
Deji

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)...

Share this post


Link to post
Share on other sites
liaz6212

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

Share this post


Link to post
Share on other sites
Deji

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.

Share this post


Link to post
Share on other sites
goodidea82

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

Share this post


Link to post
Share on other sites
thelink2012

ffs, open source this, thanks.

Share this post


Link to post
Share on other sites
Deji

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.

Share this post


Link to post
Share on other sites
goodidea82

Great that you plan continuing it.

Share this post


Link to post
Share on other sites
goodidea82

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
  • Like 1

Share this post


Link to post
Share on other sites
thelink2012

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

Share this post


Link to post
Share on other sites
goodidea82

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

Share this post


Link to post
Share on other sites
goodidea82

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

Share this post


Link to post
Share on other sites
Deji

CLEO 4.3.21 released!

 

The most important CLEO update ever.

  • Like 9

Share this post


Link to post
Share on other sites
A.G.

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

Edited by A.G.

Share this post


Link to post
Share on other sites
Deji

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

Share this post


Link to post
Share on other sites
A.G.

 

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.

Share this post


Link to post
Share on other sites
Deji

 

 

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

Share this post


Link to post
Share on other sites
A.G.

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.

Share this post


Link to post
Share on other sites
goodidea82

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
dkluin

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.

Share this post


Link to post
Share on other sites
Junior_Djjr

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

Share this post


Link to post
Share on other sites
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,[email protected],[email protected],[email protected])audiostream.SetPosition([email protected],[email protected],[email protected],[email protected])
I'm bit confuse btw. How no one noticed this? My friend Fabio is also with this problem. Edited by Junior_Djjr

Share this post


Link to post
Share on other sites
thelink2012

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

Share this post


Link to post
Share on other sites
Deji

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

Share this post


Link to post
Share on other sites
Silent

Update source on github plx :evilgrin:

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.