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

@Nostritius Nostritius commented Sep 26, 2018

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

@DrMcCoy
Copy link
Member

@DrMcCoy 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;

This comment has been minimized.

@DrMcCoy

DrMcCoy Sep 30, 2018
Member

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.

This comment has been minimized.

@Nostritius

Nostritius Oct 2, 2018
Author Contributor

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)

This comment has been minimized.

@DrMcCoy

DrMcCoy Oct 2, 2018
Member

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

This comment has been minimized.

@Nostritius

Nostritius Oct 2, 2018
Author Contributor

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

This comment has been minimized.

@DrMcCoy

DrMcCoy Oct 2, 2018
Member

No, you should not

This comment has been minimized.

@DrMcCoy

DrMcCoy Oct 7, 2018
Member

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)

This comment has been minimized.

@DrMcCoy

DrMcCoy Oct 7, 2018
Member

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

@Nostritius Nostritius force-pushed the Nostritius:tools_thewitchersave branch from 0dc15fd to 1e102a4 Oct 2, 2018
@Nostritius
Copy link
Contributor Author

@Nostritius Nostritius commented Oct 2, 2018

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

@Nostritius Nostritius force-pushed the Nostritius:tools_thewitchersave branch from 1e102a4 to a75f3a2 Oct 7, 2018
@Nostritius
Copy link
Contributor Author

@Nostritius Nostritius commented Oct 7, 2018

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.

@Nostritius Nostritius force-pushed the Nostritius:tools_thewitchersave branch from a75f3a2 to a43e781 Oct 13, 2018
@Nostritius Nostritius force-pushed the Nostritius:tools_thewitchersave branch from a43e781 to 7d8cc3c Oct 13, 2018
@DrMcCoy
Copy link
Member

@DrMcCoy DrMcCoy commented Oct 14, 2018

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

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

Successfully merging this pull request may close these issues.

None yet

2 participants