Permalink
Browse files

WiiSave: Refactor import/export code

The current WiiSave code is extremely messy, as it exposes all kinds of
implementation details in the header (including internal struct
definitions and magic numbers that don't have to be).

The read/write code is intermingled, so it's hard to tell which members
are used, or when/where they are set at all.

It also implicitly relies on some functions being called in a specific
order since it doesn't seek manually every time, which makes the code
even more fragile.

The logic is also hardcoded to only support bin->nand or nand->bin,
even though it would be useful to support nand->nand (for the
Movie save copying code, for example).

This commit attempts to solve these problems by getting rid of the
WiiSave class:

* Read/write code is moved to new Storage classes (NandStorage and
  DataBinStorage) with small, clear functions that do one and only
  one thing.

* The import/export logic was refactored into a generic Copy function
  that takes two storages as parameters.

* The existing import and export functions are now just small wrappers
  that call Copy with the appropriate storages.
  • Loading branch information...
leoetlino committed May 26, 2018
1 parent dd77ace commit a46a8dd378385398392fc00f3f9df1719f801ddb
Showing with 444 additions and 552 deletions.
  1. +420 −432 Source/Core/Core/HW/WiiSave.cpp
  2. +24 −120 Source/Core/Core/HW/WiiSave.h
Oops, something went wrong.

0 comments on commit a46a8dd

Please sign in to comment.