Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TWS: Add tws and untws tools #25

Closed
wants to merge 7 commits into from

Conversation

Nostritius
Copy link
Contributor

This PR adds wo TheWitcherSave related tools, for packing and unpacking TheWitcherSave files.

@DrMcCoy
Copy link
Member

DrMcCoy commented Sep 30, 2018

src/archives/util.cpp: In function ‘Common::UString Archives::findPath(const Common::UString&, Aurora::FileType, uint64, Common::HashAlgo)’:
src/archives/util.cpp:54:5: error: suggest explicit braces to avoid ambiguous ‘else’ [-Werror=dangling-else]
  if (!name.empty())
     ^
src/tws.cpp: In function ‘int main(int, char**)’:
src/tws.cpp:47:18: error: unused variable ‘game’ [-Werror=unused-variable]
   Aurora::GameID game = Aurora::kGameIDUnknown;
                  ^~~~

if (TypeMan.getFileType(name) == Aurora::kFileTypeNone)
path = TypeMan.addFileType(name, type);
else
path = name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the unherf tool, because Sonic HERF files contain files with multiple extensions. Namely files compressed with the "small"-algorithm.

Like, for example, itm_ace_timmy_0.ncgr.small is now shown/extracted as itm_ace_timmy_0.ncgr, which is wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are .small files the only occasion where this happens? Becauseif so i would simply add a condition like

if (TypeMan.getFileType(name) == Aurora::kFileTypeNone || type == Aurora::kFileTypeSMALL)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't want such a hacky solution :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean, i should do this, or not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you should not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why is that necessary to begin with?

File archives shouldn't carry an extension in their filenames.

I.e. the real, actual issue is that the TheWitcherSaveFile Archive class should strip extensions from the filenames, like we're doing with ZIP files, certain ERFs, NDS, HERFs, OBB, ... (see https://github.com/xoreos/xoreos/blob/master/src/aurora/zipfile.cpp#L61, https://github.com/xoreos/xoreos/blob/master/src/aurora/erffile.cpp#L600, https://github.com/xoreos/xoreos/blob/master/src/aurora/herffile.cpp#L133, https://github.com/xoreos/xoreos/blob/master/src/aurora/ndsrom.cpp#L92, https://github.com/xoreos/xoreos/blob/master/src/aurora/obbfile.cpp#L97)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes, I probably should have caught that earlier, sorry

@Nostritius
Copy link
Contributor Author

I have now rewritten the file ending block in a (hopefully) more elegant way. I also fixed the other issues.

@Nostritius
Copy link
Contributor Author

I have now switched the writing and reading to not directly use file types in the file names. I also fixed some other issues and modified the unit tests accordingly.

@DrMcCoy
Copy link
Member

DrMcCoy commented Oct 14, 2018

Merged as ed047ed...367563e, thanks! :)

@DrMcCoy DrMcCoy closed this Oct 14, 2018
@Nostritius Nostritius deleted the tools_thewitchersave branch October 15, 2018 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants