Skip to content

Commit

Permalink
AURORA: Fix TheWitcherSaveWriter to use only file stems
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius authored and DrMcCoy committed Nov 3, 2018
1 parent 7cc5db9 commit a0f7c0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/aurora/thewitchersavewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "src/common/encoding.h"

#include "src/aurora/util.h"
#include "src/aurora/thewitchersavewriter.h"

namespace Aurora {
Expand Down Expand Up @@ -61,12 +62,12 @@ TheWitcherSaveWriter::TheWitcherSaveWriter(const Common::UString &areaName, Comm
stream.writeZeros(2048);
}

void TheWitcherSaveWriter::add(const Common::UString &fileName, Common::ReadStream &stream) {
void TheWitcherSaveWriter::add(const Common::UString &resRef, const Aurora::FileType fileType, Common::ReadStream &stream) {
if (_finished)
throw Common::Exception("TheWitcherSave::add() Archive is already finished");

Resource resource;
resource.name = fileName;
resource.name = TypeMan.setFileType(resRef, fileType);
resource.offset = _stream.pos();
resource.size = _stream.writeStream(stream);

Expand All @@ -89,6 +90,8 @@ void TheWitcherSaveWriter::finish() {

_stream.writeUint32LE(resourceTableOffset);
_stream.writeUint32LE(_resources.size());

_finished = true;
}

} // End of namespace Aurora
7 changes: 5 additions & 2 deletions src/aurora/thewitchersavewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

#include "src/common/writestream.h"

#include "src/aurora/types.h"

namespace Aurora {

class TheWitcherSaveWriter {
Expand All @@ -41,10 +43,11 @@ class TheWitcherSaveWriter {

/** Add a file to this TheWitcherSave archive.
*
* @param fileName The filename of the stream to write
* @param resRef The filename of the stream to write
* @param fileType The file type of the resource to add
* @param stream The stream of the
*/
void add(const Common::UString &fileName, Common::ReadStream &stream);
void add(const Common::UString &resRef, const Aurora::FileType fileType, Common::ReadStream &stream);

/** Finish the stream and write the file table at the
* end of the stream, and set the finished flag to prevent
Expand Down

0 comments on commit a0f7c0b

Please sign in to comment.