-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: Add a utility script to dump RSM files as JSON
This doesn't currently work due to a bug in the JSON encoder; it will throw when encountering FFI metatypes and other unexpected value types. After the next runtime update, this problem should no longer exist.
- Loading branch information
1 parent
cafefab
commit 3d81a6e
Showing
2 changed files
with
30 additions
and
0 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,18 @@ | ||
local RagnarokGRF = require("Core.FileFormats.RagnarokGRF") | ||
local RagnarokRSM = require("Core.FileFormats.RagnarokRSM") | ||
|
||
local grf = RagnarokGRF() | ||
grf:Open("data.grf") | ||
local rsmFileName = arg[1] or "data/model/프론테라/민가04.rsm" | ||
|
||
local rsmFileContents = grf:ExtractFileInMemory(rsmFileName) | ||
grf:Close() | ||
|
||
local rsm = RagnarokRSM() | ||
rsm:DecodeFileContents(rsmFileContents) | ||
|
||
local jsonFileContents = rsm:ToJSON() | ||
|
||
local jsonFilePath = path.join("Exports", path.basename(rsmFileName) .. ".json") | ||
printf("Exporting decoded file contents to %s", jsonFilePath) | ||
C_FileSystem.WriteFile(jsonFilePath, jsonFileContents) |