vfs: define retro_vfs_file_punch_hole_impl on the UWP backend

Fixes the parity failure my previous commit caused. The UWP backend
replaces vfs_implementation.c rather than extending it, so a function
added to the C backend and called from the shared file_stream.c
compiles everywhere and fails to link on UWP alone.

tools/vfs_backend_parity.py exists precisely because
retro_vfs_file_get_mapped_ptr_impl once shipped that way, and it caught
this within a minute of the push. I did not run it, or
libretro-common/Makefile.test, before sending the patch -- I verified
the behaviour of the new call and the build of the two trees I had
locally, and never looked for the repository's own checks. That is the
actual mistake here; the missing stub is just its symptom.

UWP cannot punch holes: FSCTL_SET_ZERO_DATA goes through
DeviceIoControl, which is not in the app container's API surface, and
this backend's handle comes from a StorageFile. So it returns the
documented -1, which callers of filestream_punch_hole already handle by
writing zeroes instead -- the space saving is lost, nothing else.

Checked with the tools the CI uses: vfs_backend_parity.py reports 23
symbols with both backends agreeing, and libretro-common/Makefile.test
passes including the Windows A/W configuration matrix.
This commit is contained in:
libretroadmin committed 2026-08-23 04:21:45 +02:00
1 parent ce1cb45d1d
commit f0023de2a3
1 file changed
+19
@@ -672,6 +672,25 @@ const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *strea
return stream->orig_path;
}
int retro_vfs_file_punch_hole_impl(libretro_vfs_implementation_file *stream,
int64_t offset, int64_t len)
{
/* UWP cannot punch holes. FSCTL_SET_ZERO_DATA is issued through
* DeviceIoControl, which is not in the app container's API surface,
* and this backend's handle comes from a StorageFile rather than
* being one a filesystem control code can be sent to.
*
* -1 is the documented "not available" answer: filestream_punch_hole
* is a capability, so callers write zeroes instead and lose the space
* saving and nothing else. Defined here rather than omitted because
* this backend REPLACES vfs_implementation.c on UWP, so a missing
* definition is a link error at the end of a long MSVC build. */
(void)stream;
(void)offset;
(void)len;
return -1;
}
const uint8_t *retro_vfs_file_get_mapped_ptr_impl(
libretro_vfs_implementation_file *stream, int64_t *len)
{