Commit Graph

58 Commits

Author SHA1 Message Date
Luke Street c1635245b8 Use UTF-8 exclusively internally; replace iconv with OSUTF
Filenames are now unconditionally encoded/decoded as
Shift-JIS, which provides a reasonable fallback to
7-bit ASCII.
2021-06-30 13:47:10 -04:00
Minty-Meeo 3c25647b6e The Encoding Update
While Nintendo's own documents claim GameCube and Wii disc file symbol tables only support 7-bit ASCII, this is far from the truth.  Indeed, even some first-party Nintendo games shipped with Shift-JIS encoded file symbol tables.  My guess?  The locale of whatever Windows machine mastered a GameCube or Wii disc influenced how wide character strings (UCS-2) were converted to narrow character strings.  To account for all possibilites, this update adds extensible multi-byte character set options to NOD-Tool.

A rundown of notable changes:
 - "-c XXXXX" option added to set the encoding of the GameCube / Wii ISO(s) being processed.
 - "SystemStringConv" renamed to "DiscLocToSystemConv"
 - "SystemUTF8Conv" renamed to "SystemToDiscLocConv"
 - Help message updated with new info.
 - Bugfix: AddBuildName had a logic error wherein the length of the SystemString was being used instead of length of the disc locale string.  This would corrupt the File Symbol Table if the disc locale string's length was greater than the SystemString's length.
 - Bugfix: recursiveMergeFST was not keeping track of parent indexes at all, meaning nested folders and their contents would be corrupted.  I simply copied the way recursiveBuildFST did things to fix this.
 - Bugfix (Windows): On Windows, for some reason, Sstat was a typedef for _stat (32-bit) instead of _stat64 (64-bit).  This is confounding, because untrimmed Wii ISOs will always be larger than the unsigned 32-bit integer limit (4,699,979,776 bytes vs 4,294,967,295 bytes), meaning the MergeWii errand has never worked for untrimmed ISOs on Windows.  Was this never tested??
 - Bugfix (Windows): Did you know Windows Command Prompt fully supports Unicode?  Stdio streams are now in _O_U16TEXT mode for Windows only.  Previously, attempting to print any character that could not be narrowed to your locale's encoding would either silently fail (std functions), or throw an exception (fmt functions).  As a minor drawback, narrow character print functions can no longer be used when stdio is in _O_U16TEXT mode, necessitating my PR for Logvisor here: (AxioDL/logvisor#7)
 - ExtractionContext::progressCB now uses SystemStringView because widechar printing works correctly on Windows now.
 - progFunc lambda no longer throws exceptions when printing unicode because widechar printing works correctly on Windows now.
 - Top-level constructors and functions with a Codepage_t parameter have also signatures that default to the US-ASCII codepage.
    - DiscGCN constructor
    - DiscBuilderGCN constructor
    - DiscBuilderGCN::CalculateTotalSizeRequired
    - DiscMergerGCN constructor
    - DiscMergerGCN::CalculateTotalSizeRequired
    - DiscWii constructor
    - DiscBuilderWii constructor
    - DiscBuilderWii::CalculateTotalSizeRequired
    - DiscMergerWii constructor
    - DiscMergerWii::CalculateTotalSizeRequired
    - OpenDiscFromImage
 - Conversion between system encoding and disc locale encoding has checks in place to warn the user if string conversion goes awry.
2021-06-27 03:26:20 -05:00
Jack Andersen 2783337c36 Update fmtlib 2020-04-11 12:45:06 -10:00
Jack Andersen 48a2981a93 Shared NFS data class not necessary 2019-11-24 13:47:48 -10:00
Jack Andersen 75fc574f81 Support for Wii U VC NFS images 2019-11-23 17:24:33 -10:00
Henrique Gemignani Passos Lima 091262ace1 Use std::optional for CalculateTotalSizeBuild 2019-09-06 22:17:06 +02:00
Phillip Stephens 55301dd505
Merge pull request #11 from lioncash/make
General: Use std::make_unique where applicable
2019-08-30 16:28:53 -07:00
Lioncash a8753e273f General: Use std::make_unique where applicable
Makes for a little less reading in certain cases.
2019-08-30 05:35:12 -04:00
Lioncash 5935e84dab General: Include headers directly where necessary
Ensures includes are explicitly included where necessary to avoid
indirect inclusions.
2019-08-30 04:34:49 -04:00
Lioncash 2171388b9d General: Make use of override where applicable
Makes it explicit where functions are being overridden in derived
classes/structs.
2019-08-10 01:41:44 -04:00
Jack Andersen 37792ba116 Massive libfmt refactor 2019-07-19 18:21:57 -10:00
Jack Andersen 34b943c40f Solve various signing warnings reported by GCC 2019-06-09 16:49:17 -10:00
Jack Andersen be8409681f New code style refactor 2018-12-07 19:21:47 -10:00
Jack Andersen f87b286ff3 Windows build fixes 2018-10-14 10:11:28 -10:00
Jack Andersen d5f5db440c Windows build fixes and warning avoidance 2018-05-24 20:38:06 -10:00
Jack Andersen a557f86974 Huge compile performance refactor 2017-12-28 21:57:54 -10:00
Jack Andersen 27a2cb5998 string_view refactor 2017-11-12 20:18:53 -10:00
Jack Andersen db1a6f13a2 Fix missing variable initialization 2017-07-30 17:43:51 -10:00
Jack Andersen fb2a5c91d2 Explicitly zero-initialize new image files 2017-07-30 16:03:20 -10:00
Phillip Stephens 42ef3a7958 Fix return type derp 2017-07-25 05:06:35 -07:00
Jack Andersen 8bdbcf0c90 Fixes to work with directory-blob dolphin branch 2017-07-01 21:16:09 -10:00
Jack Andersen 2a472651ae Proper extract structure for GCN images 2017-07-01 19:39:41 -10:00
Jack Andersen 41148a1368 Refactor of extracted directory structure and API simplification 2017-07-01 13:36:16 -10:00
Phillip Stephens e49568ac83 Initial modifications to support Dolphin's VolumeDirectory 2017-06-30 03:30:10 -07:00
Jack Andersen dd20c1d255 Add floating point progress to builder callbacks 2017-05-21 23:12:48 -04:00
Jack Andersen dc474ad156 Major refactor, better error handling and directory/image merge 2017-02-04 20:19:34 -10:00
Jack Andersen 512a8a122d Windows fixes 2016-12-10 15:53:11 -10:00
Jack Andersen 556a5868bb Humungous refactor 2016-03-04 13:04:30 -10:00
Jack Andersen 48f79b2369 File-size limiting 2016-02-02 11:18:16 -10:00
Jack Andersen 39e9cea094 Image file preallocation 2016-02-02 10:42:17 -10:00
Jack Andersen df5e8d068c Removed direct stdio usage 2016-01-24 19:55:31 -10:00
Jack Andersen 044a393ff8 Merge branch 'master' of https://github.com/AxioDL/NODLib 2016-01-24 16:12:26 -10:00
Jack Andersen c4aaecbc8f Single-pass image creation refactor 2016-01-24 16:00:02 -10:00
Phillip 9114be2a4d Various windows fixes (microsoft plz) 2016-01-23 21:12:40 -08:00
Jack Andersen 5d5dfdc3da OS X build fixes 2016-01-23 13:36:58 -10:00
Jack Andersen e7f8bbed8a System files added to Wii partition first to keep 32-bit loaders happy 2016-01-22 17:39:38 -10:00
Jack Andersen e9bac54e10 Wii image generation fixes 2016-01-22 13:45:58 -10:00
Jack Andersen 7403996ed3 Initial Wii image generation (needs disc header) 2016-01-21 16:30:17 -10:00
Jack Andersen fafff92874 Work on GCN image building 2016-01-20 20:30:37 -10:00
Jack Andersen 3a41af8a91 Initial image building 2016-01-19 17:17:24 -10:00
Jack Andersen 168ff506a3 Major scoped-enum refactor 2015-11-20 15:15:33 -10:00
Jack Andersen e4f502be58 Init-safety 2015-09-02 15:44:43 -10:00
Jack Andersen 28ed4ba6af removed redundant get() calls 2015-08-05 11:45:25 -10:00
Jack Andersen 7fafe3ce0c Removed exceptions 2015-07-25 16:44:44 -10:00
Jack Andersen bcf67ca8eb minor vector optimization 2015-07-15 17:20:36 -10:00
Jack Andersen 01f269e8e2 Wii partition seek bug fix and buffering API 2015-07-12 20:28:26 -10:00
Jack Andersen b8236ba6d7 DOL/Apploader buffer maker 2015-07-09 17:11:30 -10:00
Jack Andersen dea4eda76d Added CMakeLists.txt 2015-07-06 17:22:19 -10:00
Jack Andersen c2227fe826 added korean common key 2015-07-04 12:37:50 -10:00
Phillip Stephens 306c910710 Fix apploader extraction 2015-07-04 10:30:00 -07:00