Skip to content

Commit

Permalink
document fs.cart_dump encrypted opt, remove stat from fs.verify_with_…
Browse files Browse the repository at this point in the history
…sha_file
  • Loading branch information
ihaveamac committed Dec 13, 2024
1 parent 7cf6900 commit 0996219
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions data/luapackages/fs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,11 @@ end
function fs.verify_with_sha_file(path)
local success, file_hash, sha_data, path_sha
path_sha = path..".sha"
-- this error should be propagated if the main file cannot be read
stat = fs.stat(path)
success, sha_data = pcall(fs.read_file, path_sha, 0, 0x20)
if not success then
return nil
end
-- TODO: make hash_file accept an "end" parameter for size
file_hash = fs.hash_file(path, 0, stat.size)
file_hash = fs.hash_file(path, 0, 0)
return file_hash == sha_data
end

Expand Down
4 changes: 3 additions & 1 deletion resources/lua-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ There are four ways to run Lua scripts:
* Select it in the file browser and choose "`Execute Lua script`"
* Place it in `0:/gm9/luascripts`, then open the HOME menu, choose "`Lua scripts...`", then choose the script
* Place it in `data/luascripts`, then build GodMode9 from source
* This takes precedence over `0:/gm9/luascripts`
* This takes precedence over `0:/gm9/luascripts`
* Place it at `data/autorun.lua`, then build GodMode9 from source with `SCRIPT_RUNNER=1` to automatically run it at launch

## Packages
Expand Down Expand Up @@ -840,6 +840,8 @@ Dump the raw data from the inserted game card. No modifications are made to the
* **Arguments**
* `path` - File to write data to
* `size` - Amount of data to read
* `opts` (optional) - Option flags
* `encrypted` - Dump game encrypted, only for DS/DSi games?
* **Throws**
* `"out of memory"` - out-of-memory error when attempting to create the data buffer
* `"cart init fail"` - card is not inserted or some other failure when attempting to initialize
Expand Down

0 comments on commit 0996219

Please sign in to comment.