-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(natives): implement async fetching for mounted file hash
- Loading branch information
Showing
4 changed files
with
170 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
ns: CFX | ||
apiset: client | ||
--- | ||
## FETCH_MOUNTED_FILE_HASH | ||
|
||
```c | ||
void FETCH_MOUNTED_FILE_HASH(char* path); | ||
``` | ||
This native will fetch the file and calculate its hash for use with [`GET_MOUNTED_FILE_HASH`](#_0xC1657E48). | ||
Use [`IS_MOUNTED_FILE_HASH_READY`](#_0xEEBC88EC) to check if the hash is ready. | ||
## Examples | ||
```lua | ||
local hashes = { | ||
"platform:/levels/gta5/props/residential/v_garden/prop_airport_sale.ytd", | ||
"common:/data/materials/materials.dat" | ||
} | ||
for _,v in pairs(hashes) do | ||
FetchMountedFileHash(v) | ||
while not IsMountedFileHashReady(v) do | ||
Wait(0) | ||
end | ||
print(GetMountedFileHash(v)) | ||
end | ||
``` | ||
|
||
## Parameters | ||
* **path**: The path to the file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
ns: CFX | ||
apiset: client | ||
--- | ||
## IS_MOUNTED_FILE_HASH_READY | ||
|
||
```c | ||
BOOL IS_MOUNTED_FILE_HASH_READY(char* path); | ||
``` | ||
This native is used to check if the hash of a file is ready for use with [`GET_MOUNTED_FILE_HASH`](#_0xC1657E48_). | ||
## Examples | ||
```lua | ||
local hashes = { | ||
"platform:/levels/gta5/props/residential/v_garden/prop_airport_sale.ytd", | ||
"common:/data/materials/materials.dat" | ||
} | ||
for _,v in pairs(hashes) do | ||
FetchMountedFileHash(v) | ||
while not IsMountedFileHashReady(v) do | ||
Wait(0) | ||
end | ||
print(GetMountedFileHash(v)) | ||
end | ||
``` | ||
|
||
## Parameters | ||
* **path**: The path to the file. | ||
|
||
## Return value | ||
|
||
Returns `true` if the hash is ready, `false` otherwise. |