cleolibrary / CLEO5

CLEO 5 for GTA San Andreas
https://cleo.li
MIT License
57 stars 6 forks source link

SAMP FXT Issue #194

Closed CanerKaraca23 closed 2 months ago

CanerKaraca23 commented 2 months ago

Hi,

Some cleo mods like Stream Usage Counter gives error when playing SA-MP.

There is a mod that fixes this error but, why we need a seperate mod that fix an issue?

Can i request a fix from CLEO itself? So we don't have to use this.

Error: sa-mp-000

Samthapa76 commented 2 months ago

go to https://ugbase.eu/ ask help there its nothing to do with cleo 5 i did coding for 5 years for samp i know samp actually don't allow cleo but people keep forcing it now r4 and r5 very strict about cleo

CanerKaraca23 commented 2 months ago

go to https://ugbase.eu/ ask help there its nothing to do with cleo 5 i did coding for 5 years for samp i know samp actually don't allow cleo but people keep forcing it now r4 and r5 very strict about cleo

I know, i mean, implement this fix in CLEO itself.

MiranDMC commented 2 months ago

Whenever CLEO install hooks it usually assumes call could be hooked already by someone else and try to act transparent by latter calling the found code instead what is known to be in original game.

In this case CLEO is replacing some code and then somebody else is overwriting that modification later. Even if CLEO wait to be the last one who makes the change there is no generic solution how the existing hook should be executed after finishing CLEO's hook.

This needs tailored solution for exactly that situation, and mentioned mod does exactly that. Is that's fix mod source code even available somewhere to see?

CanerKaraca23 commented 2 months ago

Whenever CLEO install hooks it usually assumes call could be hooked already by someone else and try to act transparent by latter calling the found code instead what is known to be in original game.

In this case CLEO is replacing some code and then somebody else is overwriting that modification later. Even if CLEO wait to be the last one who makes the change there is no generic solution how the existing hook should be executed after finishing CLEO's hook.

This needs tailored solution for exactly that situation, and mentioned mod does exactly that. Is that's fix mod source code even available somewhere to see?

I didn't see anywhere but i guess we can request from Fabio3.

https://github.com/Fabio3rs

Fabio3rs commented 2 months ago

If I remember correctly, it is this code: https://github.com/Fabio3rs/SAMP-fxt-fix/blob/main/paynspray/main.cpp

This fix operates waiting the address change and re-hooking it.

MiranDMC commented 2 months ago

So it just reinstall CLEO's hook? Why SAMP hacks it in the first place? Don't the fix then kill some SAMP's text related feature?

Fabio3rs commented 2 months ago

So it just reinstall CLEO's hook? Why SAMP hacks it in the first place? Don't the fix then kill some SAMP's text related feature?

SAMP uses to print its own texts, the code collects the CLEO and SAMP's function pointer, then it install its own pointer. It has a function that calls one of the functions, check if the text is found, if not, it calls the other pointer.

MiranDMC commented 2 months ago

Ok, so you implemented proper fix.

I do not think this should be part of CLEO. Going by that logic it would need to constantly monitor all it's hooks in case somebody modify them. Even when detected there is no generic way to solve conflicts like that.

Additionally as mentioned SAMP is doing active efforts to prevent CLEO use and I don't think we should actively counteract that in any way.

CanerKaraca23 commented 2 months ago

Ok, so you implemented proper fix.

I do not think this should be part of CLEO. Going by that logic it would need to constantly monitor all it's hooks in case somebody modify them. Even when detected there is no generic way to solve conflicts like that.

Additionally as mentioned SAMP is doing active efforts to prevent CLEO use and I don't think we should actively counteract that in any way.

Okay then, I get it, thanks. Anyway, do you think this code needs update/change/refactor or is it still good to go?

You can close the issue if you want.

MiranDMC commented 2 months ago

Ok thanks for report and efforts. From @Fabio3rs description it sounds like solid solution. Code looked fine when I took brief look too. Why it is internally named PayNSpray is only puzzling thing.

Fabio3rs commented 2 months ago

Ok thanks for report and efforts. From @Fabio3rs description it sounds like solid solution. Code looked fine when I took brief look too. Why it is internally named PayNSpray is only puzzling thing.

Thanks. At the time I was creating the project, I was duplicating the directory from the PayNSpray color picker and using the preconfigured project as base for newer projects haha

I thought about renaming before uploading today, but if I did the visual studio project would break.