Fix loading DLC using IOCTL_ES_OPENTITLECONTENT & /dev/es state save.

(Intertwined enough that's it's easier to do in one patch.)

(1) /dev/es did not support state save, which could cause crashes and
    incorrect behavior after loading.

(2) NANDContentLoader tried to read all of a title's contents into
    memory when it was first opened.  Two issues:

- If any contents were missing, it bailed out.  However, with DLC,
  only some of the contents may be downloaded, as determined by the
  permission bits in the ticket.  Instead, return an appropriate error
  when a content is accessed that doesn't exist on the filesystem
  (don't bother checking the permission bits though).

- Everything was loaded into memory - even if it consisted of 3 GB of
  songs, which caused Dolphin to lag out for quite a while (and would
  fail on 32-bit).  Instead, open content on demand.
This commit is contained in:
comex
2013-08-29 18:25:12 -04:00
parent 4d6d4a97e4
commit 04c41c1d38
5 changed files with 143 additions and 65 deletions

View File

@ -143,7 +143,7 @@ bool ReadFileToString(bool text_file, const char *filename, std::string &str);
// simple wrapper for cstdlib file functions to
// hopefully will make error checking easier
// and make forgetting an fclose() harder
class IOFile
class IOFile : public NonCopyable
{
public:
IOFile();
@ -209,10 +209,6 @@ public:
// clear error state
void Clear() { m_good = true; std::clearerr(m_file); }
private:
IOFile(const IOFile&) /*= delete*/;
IOFile& operator=(const IOFile&) /*= delete*/;
std::FILE* m_file;
bool m_good;
};