• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

STGBuilder GAME.DAT Dumper


Commit MetaInfo

Revisão92b1ade1cd0ec1f741a5a98b0fbfb51294107963 (tree)
Hora2021-05-05 18:11:35
AutorRemilia Scarlet <remilia@post...>
CommiterRemilia Scarlet

Mensagem de Log

Add --quiet option, and convert yen signs to slashes to account for
directories.

Mudança Sumário

Diff

diff -r dcaa029094ea -r 92b1ade1cd0e .hgignore
--- a/.hgignore Wed May 05 02:19:25 2021 -0600
+++ b/.hgignore Wed May 05 03:11:35 2021 -0600
@@ -1,2 +1,4 @@
11 syntax: glob
2-*.[dD][aA][tT]
\ No newline at end of file
2+*.[dD][aA][tT]
3+lib/*
4+bin/*
diff -r dcaa029094ea -r 92b1ade1cd0e src/main.cr
--- a/src/main.cr Wed May 05 02:19:25 2021 -0600
+++ b/src/main.cr Wed May 05 03:11:35 2021 -0600
@@ -74,14 +74,21 @@
7474 end
7575 end
7676
77- def dump(src : IO, outdir : String)
78- Dir.mkdir_p(outdir) unless Dir.exists?(outdir)
77+ def dump(src : IO, outdir : String, quiet : Bool)
7978 total = 0
8079
8180 entries.each do |ent|
82- filename = Path[outdir, ent.name]
81+ withSlashes = ent.name.gsub('¥', '/') # Yen signs are used for directory separators
82+ filename = Path[outdir, withSlashes]
8383
84- STDOUT << "#{ent.name}... "
84+ puts filename
85+
86+ unless Dir.exists?(filename.dirname)
87+ puts "Creating #{filename.dirname}/"
88+ Dir.mkdir_p(filename.dirname)
89+ end
90+
91+ STDOUT << "#{ent.name}... " unless quiet
8592 begin
8693 File.open(filename, "w") do |file|
8794 src.pos = ent.offset
@@ -90,7 +97,7 @@
9097
9198 size = File.size(filename)
9299 total += size
93- STDOUT << "done, #{size.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC)}\n"
100+ STDOUT << "done, #{size.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC)}\n" unless quiet
94101 rescue err : Exception
95102 STDOUT << "error! #{err.message || "unknown error"}\n"
96103 end
@@ -107,6 +114,7 @@
107114 args.addString("file", 'f', help: "The filename to read")
108115 args.addString("outdir", 'o', help: "The directory to save files into")
109116 args.addFlag("list", 'l', help: "Don't dump anything, just list files")
117+ args.addFlag("quiet", 'q', help: "Print only minimal information")
110118
111119 begin
112120 args.parse(ARGV)
@@ -129,7 +137,7 @@
129137 abort("No output directory specified") unless args["outdir"].called
130138
131139 File.open(args["file"].str) do |file|
132- total = dat.dump(file, args["outdir"].str)
140+ total = dat.dump(file, args["outdir"].str, args["quiet"].called)
133141 puts "Files dumped: #{dat.entries.size}"
134142 puts "Total size: #{total.humanize_bytes(format: Int::BinaryPrefixFormat::JEDEC)}"
135143 end