QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Doubts, help and support about QuickBMS and other game research tools
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

sir aluigi, everything works fine in QuickBMS (at least i can't see any problem in current beta until now)
i think updating userDefineLang.xml of Notepad++ is needed
and i am pretty sure there is many useful things in QuickBMS that not included in quickbms.txt
i hope you have good time, thank you
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

one of the things that QuickBMS can do is handling c strings and replacing forbidden characters and good handling of output file name

two things really needed
1)make an option to dissable all c-string errors (for example: when we want to use a wrong escape. and that option should replace 0x0D and 0x0A with a tag like <bms_tag=break> if we want to disable c-string error and use single line string)
2) using open FDSE NAME 2 not working if NAME have a forbidden chatacter (in this case, NAME string is "star*file.bin", but "*" replaced to "_" in exporting, and problem is that can't open exported file with open command based on exported NAME string)
open FDSE NAME 2
but it just trying to open "star*file.bin" instead of "star_file.bin"
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

1) I don't think I can implement any alternative encoding/method because it would take time and effort. And the lack of standards doesn't help. I'm sure we already discussed about it.

2) You can't use the * character on most filesystems. It's used as wildcard interpreted by console and terminals.
https://en.wikipedia.org/wiki/Filename# ... imitations
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

1) then i will keep to the current standard, thank you. but if you get free time, please think about xml slog, sir aluigi. because xml is easy to detecting errors, and it can be multi line and people can add id and label to their localization strings

2) i attached a open_naming.zip, and there is a file.bms in it that checks if a file exist or not before extraction
real file name is *my_file*.star in file.bin, and since it has forbidden character, then QuickBMS turn it to "_", but when i want to try open a forbidden named file with OPEN command, it's trying to open it with real forbidden name instead of fixed name with "_" chars
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

2) Interesting, I will check it.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

ok I double checked.
The filename is passed as-is to the _wfopen and fopen API.
I also checked the unicode name and it's just intact.

The different behavior between input and output is due to security and "cleaning" reasons, the former needs maximum freedom for which no filters are applied while the latter must be filtered and limited.

So it's all ok.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

New beta out.
There was a lame bug recently introduced in unzip_dynamic/zlib_noerror/deflate_noerror that returned an error.
I also added support for the dictionary in that same code since it costed me nothing.
Now tcc supports 64bit (long long) variables.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

i found a problem

Code: Select all

string MY_SCRIPT_NAME = "script.bms"
include MY_SCRIPT_NAME


problem is that can't use a variable as a string for include command
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

"include" only works with constant filenames because they get immediately loaded while parsing the script.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

aluigi wrote:"include" only works with constant filenames because they get immediately loaded while parsing the script.

can you please make it work with string variables in next beta? please fix it to use string var. please...
it's really needed

or atleast make a option to read include script from exe folder instead of bms folder
like this

Code: Select all

include "my_script.bms" 1

1 for reading from exe folder and 0 from bms folder (default)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

It's a core function so I can't implement string variables.

While for the second request, "include" already does that automatically.
When you use include "file.bms" it will try the following locations in this order:
- bms_folder
- exe_folder
- file_folder
- current_folder
- output_folder

Isn't your file loaded automatically?

Here it works perfectly, just tested.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

core function? so many things will messed up if you touch it, i understand

works fine... but can you add a option to force using of a default location? i mean make it optional by adding number
or better, use types!
like below command

Code: Select all

include "my_script.bms" exe_folder

for when we have same bms name in both exe folder and bms folder
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

It's possible to add that argument but honestly it's not useful at all.
The include feature is rarely used and 100% of times the name of the script is different than the main script, so what would be the advantage?
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

it's useful when we have same bms names in different folders

and can you do something about putdstring command to use default size of variable? i mean without writing length and just set it to "" to use real size of variable

Code: Select all

getdstring MY_STRING 5

putdstring MY_STRING ""





found two problem (tested with last beta)

1) 0x for hex numbers

Code: Select all

set MEMORY_FILE1 binary "0xFE"
goto 0 MEMORY_FILE1
getdstring HEX_NUMBER 4
if HEX_NUMBER = "0xFE"
print "value is right!"
endif

i know 0x used for hex numbers, but has problem with if command as string type

2) writing ] at end of a string that starts with [ while using a function (or [string])
there is no problem out of function, problem happens when used in a function

Code: Select all

set MEMORY_FILE1 binary ""
goto 0 MEMORY_FILE1
callfunction PUT_STRING

startfunction PUT_STRING
putdstring "[a]" 2 MEMORY_FILE1
endfunction PUT_STRING
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by spiritovod »

@Shokoniraya:
1) Improper usage, should be: "getdstring HEX_NUMBER 4 MEMORY_FILE1". Also, it's not correct in general, since cstring looks different.
2) Also improper usage, should be: "putdstring "[a]" 3 MEMORY_FILE1" (since there are 3 characters in the string). A waaay more incorrect than the case above in general.
Just fyi, a lot of your "code" is working only because of casts and workarounds in quickbms. In all other languages you would be screwed around first few lines of the code. Please don't make this topic a generic stackoverflow board.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

1)

Code: Select all

set MEMORY_FILE1 binary "0xFE"
get MEM_SIZE1 asize MEMORY_FILE1
print "%MEM_SIZE1%"
getdstring HEX_NUMBER 4 MEMORY_FILE1
if HEX_NUMBER = 0xFE
print "value is right!"
endif

0xFE readed as a hex number, but if i add ED to 0xFE ("0xFE" to ""0xFEED"), it will be read as real string, but if 0x works as hex, then why it's turn to real string instead of \xFE\xED in outupt?

2) spiritovod, code is correct (based on QuickBMS capabilitys), problem happens in function

Code: Select all

set MEMORY_FILE1 binary ""
goto 0 MEMORY_FILE1
putdstring "[a]" 2 MEMORY_FILE1
get MEM_SIZE1 asize MEMORY_FILE1
log test 0 MEM_SIZE1 MEMORY_FILE1



i know you trying to help, but please check everything and spot people situation before getting mad on someone, i really appreciate your help, guys like sir aluigi and you (and others, sorry i don't have all names) keeping this forum up
unfortunately, QuickBMS has a limitation and can't write more that 4096 lines (am i right? tell me if i wrong), but to be honest, it will be so heavy to compute for long scripts (about QuickBMS) and i can't and don't have much time to do everything by hand, i know how C or other languages works, QuickBMS is a compatible language and you can't just do such things in any language, if i want to create a program with assembly language, i have to spend a lot of time to write many mechanism, that is why QuickBMS is a fast way to do it, a good io and file processor, i know all of this things, please don't make me wrong or a unwise guy
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by spiritovod »

@Shokoniraya: Scroll up to the case with jumping into "for" cycles. You're getting those results because you're using those functions in a wrong way from the beginning. But instead of "why it doesn't work for me", you're implying that it's quickbms problem - while in 90% cases it's your own problem, who don't understand basic programming logic and it seems you don't want to understand and simply relying on alugi's help for creating more workarounds for your sake. I'm not even close to being mad, but for now this topic looks more like support-for-a-single-person thread with weird requests most of the times.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

yes, jumping into a for-next was a stupid thing, but some of them was idea for next release or problem reporting, and they solved with newer beta version, how can i learn it without learning. and it's a forum, someone can read those comments in future and learn some things, just like what people doing with books
programing logic? programing means turning human-reading algorithim to logic mechanism (look at your keyboard or thouch screen, or monitor, it's power and mechanism, anything can be done with mechanism), just like droping domino in any way you want, and know that im doing this as a hobby, i have my own job and own stuff, im not doing this for money or dealing, never! i don't want to push on someone or make him upset, so my sake is my hobby and caring about this programming idea
i don't have any other reason to telling you, spiritovod, and please don't make this post to a back-talk chat page, and i aplogize you if make you sad, im not good at talking with people

to sir aluigi
im just doing this to brought you some idea for next versions of QuickBMS and probably bugs and my hobby, you can rewrite your project and turn it to a fast and powerful language in future (fast, i mean fast scripting), but if you think im making you sad or harming you, please delete my account from your website and database, im not gonna sad
i never used anyone, this is my last comment. sayonara
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by aluigi »

@Shokoniraya
I'm super happy of your contributions, really.
I can even state that you have helped the development of quickbms more than anyone else with your suggestions and bug reports (me included).

Indeed in the beta I have added tons of the things you suggested in the last year.
So for me it's all ok, go forward showing any doubts and suggestions, and then we discuss them together and check if and how implement them.
Don't worry if we get mad at you :D


I like the idea of putdstring VAR -1 and it's easy to implement with just one line of C code (already added in my local beta).
The only "problem" is that putdstring uses a variable as input and not a C string, in short "putdstring "\x41\x42" 2 MEMORY_FILE" will write \x instead of AB.
In case of negative size (you suggested "" but it would be 0 so better to use -1) the size will be the NUL-delimited string keeping zeroes out.
I can bypass that limitation (in case the user needs binary data) with the -J option available also in the quickbmsver command.


Regarding the question of 0xFE I guess you should first convert/cast the string to number with: math NUM = STRING

I don't see any problem with 'putdstring "[a]" 3' since the output is just [a] as expected, there is no mess caused by multidimensional arrays.

I'm not aware of any limitations about 4096 lines but please show me how to replicate the problem.
Shokoniraya
Posts: 416
Joined: Sat Sep 15, 2018 5:22 am

Re: QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Post by Shokoniraya »

i don't know what to say, words not enough...
thank you, you have a great heart, but seeing this kind of judgment make me sad when it's not true

(tested with last beta)
that the error of limtation
Error: the BMS script uses more commands than those supported by this tool (4096 / 4096)

and about ] (or [string]) inside a function
here cmd command "quickbms.exe" "script.bms" "script.bms"
any other string can be write but not if starts and ends with [ and ], or if contain such string (like "my[a]string"), but empty [] is fine, like "my[]text"

Code: Select all

set MEMORY_FILE1 binary ""
goto 0 MEMORY_FILE1
callfunction PUT_STRING

startfunction PUT_STRING
putdstring "[a]" 3 MEMORY_FILE1
endfunction PUT_STRING

-------------------
An error or crash occurred:

*EH* ExceptionCode c0000005 access violation
*EH* ExceptionFlags 00000000
*EH* ExceptionAddress 001B944A
000D0000 + 000e944a quickbms.exe
*EH* NumberParameters 00000002
*EH* 00000001
*EH* 00000008

Last script line before the error or that produced the error:
3 callfunction PUT_STRING
coverage file 0 0% 0 157 . offset 00000000