Opened 12 years ago

Closed 12 years ago

Last modified 10 months ago

#8947 closed patch (fixed)

Tucker: Resource files in subdirectories are not found

Reported by: dhewg Owned by: joostp
Priority: high Component: Engine: Tucker
Keywords: Cc:
Game: Bud Tucker

Description

"SearchMan" returns NULL at least on the Wii port for files in subdirectories.

Files are opened differently compared to other engines: openAnimation(0, "graphics/merit.flc")

Adding all subdirectories to ::init() via File::addDefaultDirectory() and using openAnimation(0, "merit.flc") fixes this for me.

Attached my used patch, game starts up fine now. Please review, thanks

Ticket imported from: #2513944. Ticket imported from: patches/1052.

Change History (10)

comment:1 by sev-, 12 years ago

Owner: set to cyxx

comment:2 by cyxx, 12 years ago

I thought the plan when introducing the SearchMan stuff was to avoid the addDefaultDirectory() calls. But I may wrong. Why is SearchMan returning NULL on the Wii ?

comment:3 by dhewg, 12 years ago

I'm totally new to engine code, but this is what i gathered (please correct me if i'm wrong):

Before a game is started, SearchMan gets all children of the game directory (recursively). That's used by the engine itself to find its files. After some more debugging, it turns out that SearchMan itself adds slashes to directories before calling getChildren(), which results in "graphics//merit.flc", because the Wii FS already uses a slash as the last char on directories. That's why it returns NULL for every file in a subdirectory on my port.

Tucker works indeed without my patch, but only with this code in common/archive.cpp in cacheDirectoryRecursive(), just after "if (it->isDirectory()) {" : if (lowercaseName.lastChar() == '/') lowercaseName.deleteLastChar();

The Wii port isn't the only one using directory separators at the end directories: - PS2, PSP, Wii Those should be affected as well.

Also, these ports use backslashes instead of slashes: - DS, Symbian, Windows

Maybe the best way to handle this is a seperator char in the FS backend and make SearchMan respect that?

As this is a general problem, i'm reassigning this to nobody and raising its priority. Afaict it currently only affects tucker, but that might change in the future.

Sorry for the noise ;)

comment:4 by dhewg, 12 years ago

Owner: cyxx removed
Priority: normalhigh

comment:5 by dhewg, 12 years ago

After discussing this on IRC:

- a FS backend should not add separators to a directory - SearchMan internally uses slashes. Backslash bases FSs are not affected - the PS2 port does not add slashes at the end (my bad, not enough coffee)

I fixed the Wii FS, that only leaves the PSP port afaict. joostp: I'll assign this one to you, please check if the port suffers from this problem too

(deleting my nonsense patch)

comment:6 by dhewg, 12 years ago

Owner: set to joostp

comment:7 by joostp, 12 years ago

Resolution: fixed
Status: newclosed

comment:8 by joostp, 12 years ago

Should now be fixed on the PSP port as well (although I don't have tucker to verify). Thanks for the analysis dhewg & others. :)

comment:9 by digitall, 21 months ago

Component: Engine: Tucker

comment:10 by Thunderforge, 10 months ago

Game: Bud Tucker
Note: See TracTickets for help on using tickets.