Skip to content

Commit

Permalink
Tools: Create a script to extract files from GRF archives
Browse files Browse the repository at this point in the history
No bulk extraction since it isn't needed at this time.
  • Loading branch information
rdw-software committed Dec 13, 2023
1 parent 08b61d0 commit 9861778
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tools/extract-from-grf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local RagnarokGRF = require("Core.FileFormats.RagnarokGRF")

local fileToExtract = arg[1] or error ("Arguments: fileToExtract [destinationFolder optionalArchiveName]")
local grfPath = arg[3] or "data.grf"
local destinationFolder = arg[2] or grfPath .. ".extracted"
local destinationPath = path.join(destinationFolder, fileToExtract)

C_FileSystem.MakeDirectoryTree(path.dirname(destinationPath))
printf("Saving %s to %s", fileToExtract, destinationPath)

local grf = RagnarokGRF()
grf:Open(grfPath)
grf:ExtractFileToDisk(fileToExtract, destinationPath)
grf:Close()

0 comments on commit 9861778

Please sign in to comment.