3 Commits

Author SHA1 Message Date
BearddOddity 8f6c290cf0 kernel_path: match file names ignoring case on POSIX hosts
The Xbox's file systems ignore case and titles rely on it: a title asks for
D:\Data\movies\INTRO.bik where the disc has Movies/intro.bik. A POSIX host's
file system does not, so the open failed with "not found" and the title
carried on without the file.

On POSIX, after the guest path is translated, each component that is not
there as spelled takes the spelling of the one directory entry that
matches it ignoring case. A path that exists as spelled costs one lstat. A
component nothing matches (a file about to be created) and everything after
it stays as the title asked. Windows and macOS file systems are already
case-insensitive and are untouched (the code is in the POSIX half only, and
on macOS the first lstat succeeds).

Test: tests/kernel_path gets a POSIX-only section. A tree Data/Movies/intro.bik
is translated from the spellings Data\Movies\intro.bik (unchanged),
Data\movies\INTRO.bik, DATA\MOVIES\Intro.BIK (folded), data\movies\New.bin
(directories fold, the new file keeps its name) and Nope\Sub\x.bin (nothing
matches, unchanged).

Verified: on Linux x86-64 (gcc) the section passes with this change and three
checks fail with kernel_path.c at v0.16.0. kernel_directory_posix,
kernel_file_relative, kernel_fatx_overwrite and kernel_file_status pass on
Linux; kernel_path passes on Windows (MSVC), where the section is skipped.

Not covered: non-ASCII names (the match is strcasecmp).

Blast radius: path translation on POSIX hosts, for paths that do not exist as
spelled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 04:35:45 -05:00
sp00nz 7de3179d94 tests: kernel_guest_cpu and kernel_path build on Linux; kernel_io_apc says it is Windows-only
Under -std=c11 glibc hides pthread_getaffinity_np, CPU_SET and nftw, so
#192's and #206's tests failed to build on Linux (WSL, GCC 14); both
define _GNU_SOURCE off Windows and pass there. #226's kernel_io_apc
drives the Win32 file API and now stops at configure with a reason,
like a skipped test, instead of failing to compile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 07:04:37 -07:00
carlos c18d741b67 kernel files: Partition1\CACHE goes to <save>/TitleCache, not the game dir
The path table sent all of \Device\Harddisk0\Partition1 to the game dir
apart from UDATA and TDATA. E:\CACHE is the title's own scratch, and it
writes there: Burnout 3 opens CACHE\LocalCache00.bin and LocalCache08.bin
with FILE_OPEN_IF, so every run wrote into the extracted game files, and
all save dirs shared one cache.

CACHE now has its own rule beside UDATA and TDATA: it goes to
<save_dir>/TitleCache, or under RECOMP_SAVE_DIR when that is set. The
folder is not named CACHE because Z: and Partition3-5 (the cache
partitions behind X:, Y: and Z:) already map to <save_dir>/Cache, and on
a case-insensitive host (Windows, Proton, macOS) the two names are one
folder, where the title's files would mix with the utility-drive caches
and could collide by name.

The rest of Partition1 stays in the game dir, since a title may read its
assets through it (Wreckless links Z: to Partition1\). The rule stops at
a path boundary like the other two, so Partition1\cached.dat and CACHEX\
stay in the game dir. The fallback that keeps saves found only in the
game dir does not apply to CACHE: keeping a cache there would be the very
write this stops, and the title rebuilds it. That fallback now picks its
rule by the whole folder name, since TitleCache starts with the same
letter as TDATA.

The "Path init" log line now says "user data=" where it said
"udata/tdata=", since that root holds TitleCache as well; anything that
greps the log for the old text needs the new one.

tests/kernel_path (both backends): CACHE under the save dir and under
RECOMP_SAVE_DIR, Burnout 3's lower-case spelling, the bare directory, a
title link to Partition1\, xbox_path_tree, names that only start with
CACHE/UDATA/TDATA, E:\CACHE and Z:/Partition3/Partition5 in different
folders ignoring case, and the cache leaving the game dir next to legacy
UDATA and TDATA saves. With v0.14.0's kernel_path.c 10 checks fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 05:39:24 -07:00