Xenia: NtCreateFile creates empty files when FILE_DIRECTORY_FILE flag is set

Created on 18 Jul 2019  路  6Comments  路  Source: xenia-project/xenia

Seen in Halo 3 with --mount_cache=true set (and a cache1 folder already created), the game will try making a "cache1:\autosave\" folder but Xenia will create it as an empty file instead, which then stops the game from being able to write to files inside that dir (eg. "cache1:\autosave\asq_010_jun_BBBBBBBB.temp")

I think the issue is in NtCreateFile, which doesn't seem to check for the FILE_DIRECTORY_FILE flag, and so will always create any path given to it as a file... not 100% sure about that yet though.

This maybe effects directories created inside savegames too, so fixing this might also help with those.

(Should note that deleting the empty file and replacing it with a directory manually does allow the game to write to files inside it)

bug kernel

Most helpful comment

Okay... and?

All 6 comments

Fixed with bf989f0aae66cbdc10a211ebad1c947e75d9e725 and 9a8d77137cd6b7228fc30bf83e4827c67256f046.

Okay... and?

xenia-project/game-compatibility#178 (comment)

Okay... and?

Probably wanted to bring this to someone's attention, no idea why, this is the comment he linked:

Been working on this issue lately. first I enabled the cache0 and cache1, also I created an entry for /Device/Harddisk0 the same way that scratch, cache0, and cache1 are done. (FWIW I don't expect this to work) Now, Halo tries to check if an autosave folder exists in cache1, this fails and creates a file for some reason, when I deleted the file and created a folder, a new file with the .temp ext was created inside that autosave folder (as I hit a checkpoint I guess) I analyzed it with HxD to find BLF mentioned in the header and strings about what map I've progressed through. I do not know what this file really is for. Either way Xenia is creating a file instead of a directory in cache1

I'm also noticing that each time I start the game, start a mission, then save & exit a new profile is created in the content\4D5307E6\00000001 directory. So this leads me to believe that a new profile is being generated each start, and therefore maybe why the last profile isn't shown when starting the game again.

Yes, what I mean is, assuming this is related, it should be fixed now?

My bad, sorry 馃檮馃槄

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zerr10 picture zerr10  路  3Comments

Razzile picture Razzile  路  3Comments

drillsar picture drillsar  路  4Comments

thx3ever picture thx3ever  路  3Comments

JohnGodgames picture JohnGodgames  路  3Comments