mirror of
https://github.com/autc04/Retro68.git
synced 2025-01-30 09:32:07 +00:00
fix ResourceFile data fork reading
This commit is contained in:
parent
2885f5d8cd
commit
62831a7391
@ -38,8 +38,9 @@ int main(int argc, char *argv[])
|
|||||||
("creator,c", "print creator code")
|
("creator,c", "print creator code")
|
||||||
("all,a", "print all info")
|
("all,a", "print all info")
|
||||||
("format,f", "print format")
|
("format,f", "print format")
|
||||||
("count,n", "print number of resources")
|
("count,n", "print number of resources")
|
||||||
("filename,l", "echo input file name")
|
("size,s", "show data fork size")
|
||||||
|
("filename,l", "echo input file name")
|
||||||
("set-format,F", po::value<string>(), "resource fork format)")
|
("set-format,F", po::value<string>(), "resource fork format)")
|
||||||
;
|
;
|
||||||
po::options_description hidden, alldesc;
|
po::options_description hidden, alldesc;
|
||||||
@ -82,11 +83,12 @@ int main(int argc, char *argv[])
|
|||||||
bool showCreator = options.count("creator") != 0;
|
bool showCreator = options.count("creator") != 0;
|
||||||
bool showFormat = options.count("format") != 0;
|
bool showFormat = options.count("format") != 0;
|
||||||
bool showCount = options.count("count") != 0;
|
bool showCount = options.count("count") != 0;
|
||||||
|
bool showSize = options.count("size") != 0;
|
||||||
|
|
||||||
ResourceFile::Format format = ResourceFile::Format::autodetect;
|
ResourceFile::Format format = ResourceFile::Format::autodetect;
|
||||||
|
|
||||||
if(options.count("all"))
|
if(options.count("all"))
|
||||||
showType = showCreator = showFormat = showCount = true;
|
showType = showCreator = showFormat = showCount = showSize = true;
|
||||||
|
|
||||||
if(options.count("set-format"))
|
if(options.count("set-format"))
|
||||||
{
|
{
|
||||||
@ -121,7 +123,9 @@ int main(int argc, char *argv[])
|
|||||||
out << " " << reverseFormats[rsrcFile.format];
|
out << " " << reverseFormats[rsrcFile.format];
|
||||||
if(showCount)
|
if(showCount)
|
||||||
out << " " << rsrcFile.resources.resources.size();
|
out << " " << rsrcFile.resources.resources.size();
|
||||||
|
if(showSize)
|
||||||
|
out << " " << rsrcFile.data.size();
|
||||||
|
|
||||||
string str = out.str();
|
string str = out.str();
|
||||||
if(str.size())
|
if(str.size())
|
||||||
{
|
{
|
||||||
|
@ -270,9 +270,11 @@ bool ResourceFile::read()
|
|||||||
switch(what)
|
switch(what)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
std::vector<char> buf(len);
|
{
|
||||||
in.read(buf, len);
|
std::vector<char> buf(len);
|
||||||
data = std::string(buf.begin(), buf.end());
|
in.read(buf.data(), len);
|
||||||
|
data = std::string(buf.begin(), buf.end());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
resources = Resources(in);
|
resources = Resources(in);
|
||||||
@ -344,7 +346,7 @@ bool ResourceFile::read()
|
|||||||
if(word(in) != crc)
|
if(word(in) != crc)
|
||||||
return false;
|
return false;
|
||||||
std::vector<char> buf(datasize);
|
std::vector<char> buf(datasize);
|
||||||
in.read(buf, datasize);
|
in.read(buf.data(), datasize);
|
||||||
data = std::string(buf.begin(), buf.end());
|
data = std::string(buf.begin(), buf.end());
|
||||||
in.seekg(128 + datasize);
|
in.seekg(128 + datasize);
|
||||||
resources = Resources(in);
|
resources = Resources(in);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user