Merge pull request #9135 from JosJuice/show-nkit

Show NKitness in file format string
This commit is contained in:
Léo Lam 2020-10-14 12:19:53 +02:00 committed by GitHub
commit b24223c178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 11 deletions

View File

@ -90,7 +90,7 @@ public final class GameDetailsDialog extends DialogFragment
long blockSize = gameFile.getBlockSize(); long blockSize = gameFile.getBlockSize();
String compression = gameFile.getCompressionMethod(); String compression = gameFile.getCompressionMethod();
textFileFormat.setText(String.format("%1$s (%2$s)", gameFile.getBlobTypeString(), fileSize)); textFileFormat.setText(String.format("%1$s (%2$s)", gameFile.getFileFormatName(), fileSize));
if (compression.isEmpty()) if (compression.isEmpty())
{ {

View File

@ -40,7 +40,7 @@ public class GameFile
public native int getBlobType(); public native int getBlobType();
public native String getBlobTypeString(); public native String getFileFormatName();
public native long getBlockSize(); public native long getBlockSize();

View File

@ -66,7 +66,7 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobType(JNIEnv* env, JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobType(JNIEnv* env,
jobject obj); jobject obj);
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj); Java_org_dolphinemu_dolphinemu_model_GameFile_getFileFormatName(JNIEnv* env, jobject obj);
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env, JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,
jobject obj); jobject obj);
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
@ -167,9 +167,9 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobType
} }
JNIEXPORT jstring JNICALL JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj) Java_org_dolphinemu_dolphinemu_model_GameFile_getFileFormatName(JNIEnv* env, jobject obj)
{ {
return ToJString(env, DiscIO::GetName(GetRef(env, obj)->GetBlobType(), true)); return ToJString(env, GetRef(env, obj)->GetFileFormatName());
} }
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env, JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,

View File

@ -54,10 +54,9 @@ QGroupBox* InfoWidget::CreateFileDetails()
} }
else else
{ {
const QString file_format = const QString file_format = QStringLiteral("%1 (%2)")
QStringLiteral("%1 (%2)") .arg(QString::fromStdString(m_game.GetFileFormatName()))
.arg(QString::fromStdString(DiscIO::GetName(m_game.GetBlobType(), true))) .arg(QString::fromStdString(file_size));
.arg(QString::fromStdString(file_size));
layout->addRow(tr("File Format:"), CreateValueDisplay(file_format)); layout->addRow(tr("File Format:"), CreateValueDisplay(file_format));
QString compression = QString::fromStdString(m_game.GetCompressionMethod()); QString compression = QString::fromStdString(m_game.GetCompressionMethod());

View File

@ -31,6 +31,7 @@
#include "Common/HttpRequest.h" #include "Common/HttpRequest.h"
#include "Common/Image.h" #include "Common/Image.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/MsgHandler.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Swap.h" #include "Common/Swap.h"
@ -124,6 +125,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
m_volume_size = volume->GetSize(); m_volume_size = volume->GetSize();
m_volume_size_is_accurate = volume->IsSizeAccurate(); m_volume_size_is_accurate = volume->IsSizeAccurate();
m_is_datel_disc = volume->IsDatelDisc(); m_is_datel_disc = volume->IsDatelDisc();
m_is_nkit = volume->IsNKit();
m_internal_name = volume->GetInternalName(); m_internal_name = volume->GetInternalName();
m_game_id = volume->GetGameID(); m_game_id = volume->GetGameID();
@ -146,6 +148,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
m_file_size = m_volume_size = File::GetSize(m_file_path); m_file_size = m_volume_size = File::GetSize(m_file_path);
m_volume_size_is_accurate = true; m_volume_size_is_accurate = true;
m_is_datel_disc = false; m_is_datel_disc = false;
m_is_nkit = false;
m_platform = DiscIO::Platform::ELFOrDOL; m_platform = DiscIO::Platform::ELFOrDOL;
m_blob_type = DiscIO::BlobType::DIRECTORY; m_blob_type = DiscIO::BlobType::DIRECTORY;
} }
@ -308,6 +311,7 @@ void GameFile::DoState(PointerWrap& p)
p.Do(m_volume_size); p.Do(m_volume_size);
p.Do(m_volume_size_is_accurate); p.Do(m_volume_size_is_accurate);
p.Do(m_is_datel_disc); p.Do(m_is_datel_disc);
p.Do(m_is_nkit);
p.Do(m_short_names); p.Do(m_short_names);
p.Do(m_long_names); p.Do(m_long_names);
@ -659,6 +663,7 @@ std::string GameFile::GetFileFormatName() const
{ {
case DiscIO::Platform::WiiWAD: case DiscIO::Platform::WiiWAD:
return "WAD"; return "WAD";
case DiscIO::Platform::ELFOrDOL: case DiscIO::Platform::ELFOrDOL:
{ {
std::string extension = GetExtension(); std::string extension = GetExtension();
@ -667,8 +672,14 @@ std::string GameFile::GetFileFormatName() const
// substr removes the dot // substr removes the dot
return extension.substr(std::min<size_t>(1, extension.size())); return extension.substr(std::min<size_t>(1, extension.size()));
} }
default: default:
return DiscIO::GetName(m_blob_type, true); {
std::string name = DiscIO::GetName(m_blob_type, true);
if (m_is_nkit)
name = fmt::format(Common::GetStringT("{0} (NKit)"), name);
return name;
}
} }
} }

View File

@ -145,6 +145,7 @@ private:
u64 m_volume_size{}; u64 m_volume_size{};
bool m_volume_size_is_accurate{}; bool m_volume_size_is_accurate{};
bool m_is_datel_disc{}; bool m_is_datel_disc{};
bool m_is_nkit{};
std::map<DiscIO::Language, std::string> m_short_names; std::map<DiscIO::Language, std::string> m_short_names;
std::map<DiscIO::Language, std::string> m_long_names; std::map<DiscIO::Language, std::string> m_long_names;

View File

@ -27,7 +27,7 @@
namespace UICommon namespace UICommon
{ {
static constexpr u32 CACHE_REVISION = 18; // Last changed in PR 8891 static constexpr u32 CACHE_REVISION = 19; // Last changed in PR 9135
std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan, std::vector<std::string> FindAllGamePaths(const std::vector<std::string>& directories_to_scan,
bool recursive_scan) bool recursive_scan)