diff --git a/driver/main.cpp b/driver/main.cpp index d4ee754..c658245 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -104,9 +104,9 @@ int main(int argc, char* argv[]) printf("\n"); } if (bytes != -1) - printf("\r%s %" PRISize " B", name.c_str(), bytes); + NOD::Printf(_S("\r%s %" PRISize " B"), name.c_str(), bytes); else - printf("\r%s", name.c_str()); + NOD::Printf(_S("\r%s"), name.c_str()); fflush(stdout); }; @@ -157,9 +157,9 @@ int main(int argc, char* argv[]) printf("\n"); } if (bytes != -1) - printf("\r%s %" PRISize " B", name.c_str(), bytes); + NOD::Printf(_S("\r%s %" PRISize " B"), name.c_str(), bytes); else - printf("\r%s", name.c_str()); + NOD::Printf(_S("\r%s"), name.c_str()); fflush(stdout); }; diff --git a/include/NOD/Util.hpp b/include/NOD/Util.hpp index 2de6eaf..9a0d52a 100644 --- a/include/NOD/Util.hpp +++ b/include/NOD/Util.hpp @@ -287,6 +287,18 @@ static inline int FSeek(FILE* fp, int64_t offset, int whence) #endif } +static inline void Printf(const SystemChar* fmt, ...) +{ + va_list args; + va_start(args, fmt); +#if NOD_UCS2 + vwprintf(fmt, args); +#else + vprintf(fmt, args); +#endif + va_end(args); +} + } #endif // __NOD_UTIL_HPP__ diff --git a/lib/DiscBase.cpp b/lib/DiscBase.cpp index 453302b..f949356 100644 --- a/lib/DiscBase.cpp +++ b/lib/DiscBase.cpp @@ -168,19 +168,19 @@ static bool IsSystemFile(const SystemString& name) if (name.size() < 4) return false; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".dol"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".dol"))) return true; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".rel"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".rel"))) return true; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".rso"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".rso"))) return true; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".sel"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".sel"))) return true; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".bnr"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".bnr"))) return true; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".elf"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".elf"))) return true; - if (!StrCaseCmp((&*name.cend()) - 4, _S(".wad"))) + if (!StrCaseCmp((&*(name.cend() - 4)), _S(".wad"))) return true; return false;