Merge pull request #261 from diamante0018/develop

fastfiles: Use defines instead of magic numbers
This commit is contained in:
fed 2022-09-11 11:28:09 +00:00 committed by GitHub
commit ce22a9318b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,7 +175,7 @@ namespace fastfiles
if (check_loc_folder && game::DB_IsLocalized(filename.data())) if (check_loc_folder && game::DB_IsLocalized(filename.data()))
{ {
const auto handle = find_fastfile(filename, false); const auto handle = find_fastfile(filename, false);
if (handle != reinterpret_cast<HANDLE>(-1)) if (handle != INVALID_HANDLE_VALUE)
{ {
return handle; return handle;
} }
@ -187,12 +187,13 @@ namespace fastfiles
{ {
if (!filesystem::find_file("zone/"s + loc_folder + filename, &path)) if (!filesystem::find_file("zone/"s + loc_folder + filename, &path))
{ {
return reinterpret_cast<HANDLE>(-1); return INVALID_HANDLE_VALUE;
} }
} }
const auto handle = CreateFileA(path.data(), 0x80000000, 1u, 0, 3u, 0x60000000u, 0); const auto handle = CreateFileA(path.data(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
if (handle != reinterpret_cast<HANDLE>(-1)) FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, nullptr);
if (handle != INVALID_HANDLE_VALUE)
{ {
fastfile_handles.push_back(handle); fastfile_handles.push_back(handle);
} }