Page 1 of 1

Quickbms opening files and numerical extensions

Posted: Tue Aug 21, 2012 3:35 am
by finale00

Code: Select all

open FDDE "000"
open FDDE "001"
quickbms is interpreting the "000" as a 0 and "001" as 1.
How can I deal with this?

Another issue I have related.
There is a short that stores which file I should be seeking in.

Code: Select all

get OFFSET long
get FILENUM short

goto OFFSET FILENUM
FILENUM is 0, but quickbms is saying the file has not been opened yet.

Re: Quickbms opening files and numerical extensions

Posted: Tue Aug 21, 2012 11:40 am
by aluigi
1)
in quickbms I use a way to handle strings like 001 as numbers for performance reasons.
exist some ways to bypass this feature like using the String command.

2)
the filenumber field used in the commands is ever a fixed number, it can't be a variable.

in your case I guess you want to handle a splitted archive so the best solution is opening the current FILENUM archive all the times:

Code: Select all

string TMP p= "%03d" FILENUM
open FDDE TMP 1
goto OFFSET 1

Re: Quickbms opening files and numerical extensions

Posted: Tue Aug 21, 2012 6:59 pm
by finale00
Oh there was another issue I think but forgot about it until now.
I am using 0.5.13

When I use FDDE, it says it opens the other file assuming it is in the same folder as the input.

quickbms says it's trying to open _path_, but it says it couldn't open it.

I use a batch script which dumps the archives in a new folder (in case they don't have folder structure), and it is usually the name of the input file or just "out"

I move the files I want to open using FDDE into the "out" folder and then they are opened correctly.

...

I also have some files that use separate file table to index into another archive, except it uses the names

"{something}_header"
"{something}_data"

Where "something" can be anything (map, obj, tex, blah)
How can I deal with this?

I want to get the "base" name which is everything before the underscore and then just manually attach it like

Code: Select all

# get the basename
basename = {something}
# now build the outName and open it
string outName = basename
string outName = basename + "_data"
open FDSE outName

Re: Quickbms opening files and numerical extensions

Posted: Tue Aug 21, 2012 11:34 pm
by aluigi
do you have an image of the output of quickbms for the first case?
quickbms should show all the full paths tried for loading the file.

while for that basename you can use the "<" operator:

Code: Select all

set NAME string "this_is_the_basename_header"
string NAME <= "_"
string NAME += "data"
print "%NAME%"

Re: Quickbms opening files and numerical extensions

Posted: Tue Aug 21, 2012 11:45 pm
by finale00
Weird, I can't seem to reproduce it. Hmm maybe when I run into the problem again lol

Is there a way for me to "try" to open a file, but if it doesn't exist just ignore it and continue?

Code: Select all

EXISTS    if the file doesn't exist this variable will be set to
                0 otherwise 1 (exists). by default QuickBMS terminates
                with an error if the file doesn't exist.
Alternatively, how can I avoid opening the same file multiple times?

Since I don't actually know how many split parts there might be (one part, two part, ...), I'm just opening the file as I go

Code: Select all


if FILENUM == 0
   # open file 000 and read
elif FILENUM == 1
   # open file 001 and read
elif ...

Fortunately there is always at most 3 parts (002) so I can do something like what I am doing above.

Re: Quickbms opening files and numerical extensions

Posted: Wed Aug 22, 2012 12:18 am
by aluigi

Code: Select all

open FDDE "extension" 1 IS_ALIVE
if IS_ALIVE != 0
    do your stuff
endif
don't worry about opening the files, open them when requested so without doing the "open them all at the same time" as you want to do.

Re: Quickbms opening files and numerical extensions

Posted: Fri Aug 24, 2012 9:53 pm
by finale00
Oh, it takes a variable. lol I was passing in a constant number.

Thanks it works great now.