Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ini read int/float cleo4 mode fixes #150

Conversation

MiranDMC
Copy link
Contributor

@MiranDMC MiranDMC commented Feb 5, 2025

Commands read_int_from_ini_file and read_float_from_ini_file called from scripts in legacy mode now returns success and value 0 in case of invalid data inside ini file.
Fixes #281

Test script.

{$CLEO .cs}

//set_current_directory 1

write_int_to_ini_file {value} 42 {path} "test.ini" {section} "t" {key} "iVal"
write_float_to_ini_file {value} 42.0 {path} "test.ini" {section} "t" {key} "fVal"
//write_string_to_ini_file {value} "forty two" {path} "test.ini" {section} "t" {key} "sVal" // CLEO4 crash

while true
    wait 100
    
    int iVal = 123
    int iResult = false
    if
        iVal = read_int_from_ini_file {path} "test.ini" {section} "t" {key} "iVal"
    then
        iResult = true
    end
    
    float fVal = 123
    int fResult = false
    if
        fVal = read_float_from_ini_file {path} "test.ini" {section} "t" {key} "fVal"
    then
        fResult = true
    end
    
    longString sVal = "default"
    int sResult = false
    if
        sVal = read_string_from_ini_file {path} "test.ini" {section} "t" {key} "sVal"
    then
        sResult = true
    end
    
    print_formatted_now {format} "INT - ok: %d, value: %d~n~FLOAT - ok: %d, value: %f~n~TXT - ok: %d, value: %s" {time} 1000 {args} iResult iVal fResult fVal sResult sVal
end

x87 and others added 30 commits August 27, 2023 11:31
Fixed SDK includes.
Configured post build events and debug settings.
Added setup_env.bat and SETUP.md
* cleo_call and cleo_return scope now save and restore GOSUB call stack and stack pointer.

* Introduced CModuleSystem class.

* Working prototype.

* Support of path resolving for modules.

* Path normalization updated.

* Review fixes.

* Disabled virtual absolute paths feature.

* Fixed script  location and name related functions.

* Used game's APIs to resolve paths.

Figured out using plugin_sdk classes in project.

* Names case insensitive handling.

* Modules reloading.

* Automatic modules reloading.
* Added CLEO version info to log file.

* Fixed problem with export references releasing.

Review fixes.
… plugin�added more detailed error messages in some cases�updated general methods for getting and setting string parameters

added some CLEO properties and methods to CRunningScript struct�export addded: CLEO_RegisterCallback
export addded: CLEO_GetScriptVersion
cleo.cpp removed from CLEO SDK
new opcode 0DD5 (get_platform)
new opcode 00CC (breakpoint)
new opcode 00CD (trace)
new opcode 00CE (log_to_file)
support of opcodes 0662, 0663 and 0664
more error and warning messages
updated opcodes handling
* Added missing changes to CHANGELOG.md

* Header style updated.
* Used CFont from plugin sdk instead of direct memory hacks.

Fixed aspect of main menu CLEO text.
* Added 2000 and 2001 opcodes.

* Added validation of script pointer parameter in opcode 2001
Updated clearing log list effect.
Callback 'ScriptDraw' called after script elements drawing.
Adjusted  screen log display times
…120)

Now returned string is always null terminated.
Removed filling remaining part of target buffer with zeros.
* ReadFormattedString result always null terminated

* Skip would not work here anyway.
MiranDMC and others added 28 commits November 27, 2024 18:13
Added stack pointer validation for call function/method opcodes.
* Keep main script in to be executed before custom scripts.

* fixup! Keep main script in to be executed before custom scripts.
Added _Orig suffix to all variables storing original hook addresses.
* Added checks for scripts stuck in dead loop.

* fixup! Added checks for scripts stuck in dead loop.
* Added example script.

* Added pickup example script
* Fixed display_text_formatted texts overwriting when called from multiple scripts at once.

* Added boundary check.
* Fix command limit checking for PluginSDK called commands.

Added support of -1 argument for limits config.

* fixup! Fix command limit checking for PluginSDK called commands.

* fixup! Fix command limit checking for PluginSDK called commands.
* Fix CLEO modules path

* Fixes and refactoring of legacy CLEO support.

Added legacy option for native scripts to config.ini

* fixup! Fixes and refactoring of legacy CLEO support.

* fixup! Fixes and refactoring of legacy CLEO support.

* fixup! Fixes and refactoring of legacy CLEO support.
* Throw error when executing command past script code.

* fixup! Throw error when executing command past script code.

* fixup! Throw error when executing command past script code.

* fixup! Throw error when executing command past script code.
* Some comments updated.

Fixed example scripts to follow function argument type grammar rules.

* fixup! Some comments updated.
* Added script lag detection.

* fixup! Added script lag detection.

* fixup! Added script lag detection.
* Allow source and target block overlap in copy_memory opcode.

* copy_memory tests updated.
* Fix scriptLog problems with script callbacks from SAMP

* fixup! Fix scriptLog problems with script callbacks from SAMP
@MiranDMC MiranDMC closed this Feb 5, 2025
@MiranDMC MiranDMC deleted the INI_read_int/float_CLEO4_mode_fixes_ branch February 5, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants