Android: Remove inheritance from Game model, and improve the relevance of its content

This commit is contained in:
Eder Bastos
2015-05-16 20:52:55 -04:00
parent 4c786cb70c
commit 5b0c047e0b
17 changed files with 156 additions and 227 deletions

View File

@ -162,23 +162,6 @@ static bool LoadBanner(std::string filename, u32 *Banner)
return false;
}
static bool IsWiiTitle(std::string filename)
{
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
if (pVolume != nullptr)
{
bool is_wii_title = pVolume->IsWiiDisc() || pVolume->IsWadFile();
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Is %s a Wii Disc: %s", filename.c_str(), is_wii_title ? "Yes" : "No" );
return is_wii_title;
}
// Technically correct.
return false;
}
static int GetCountry(std::string filename)
{
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
@ -192,10 +175,41 @@ static int GetCountry(std::string filename)
return country;
}
// Technically correct.
// Return UNKNOWN
return 13;
}
static int GetPlatform(std::string filename)
{
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
if (pVolume != nullptr)
{
bool is_wii_disc = pVolume->IsWiiDisc();
bool is_wii_wad = pVolume->IsWadFile();
if (is_wii_disc)
{
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii disc.");
// See Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java
return 1;
}
else if (is_wii_wad)
{
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii WAD.");
return 2;
}
else
{
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Gamecube disc.");
return 0;
}
}
return -1;
}
static std::string GetTitle(std::string filename)
{
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Title for file: %s", filename.c_str());
@ -292,15 +306,15 @@ static std::string GetGameId(std::string filename)
return std::string ("");
}
static std::string GetApploaderDate(std::string filename)
static std::string GetCompany(std::string filename)
{
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Date for file: %s", filename.c_str());
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Company for file: %s", filename.c_str());
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(filename);
if (pVolume != nullptr)
{
std::string date = pVolume->GetApploaderDate();
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Date: %s", date.c_str());
std::string date = pVolume->GetCompany();
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Company: %s", date.c_str());
return date;
}
@ -349,9 +363,9 @@ JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBann
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDescription(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDate(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsWiiTitle(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv *env, jobject obj, jstring jFilename);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj);
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv *env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv *env, jobject obj);
@ -423,11 +437,11 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId
return env->NewStringUTF(id.c_str());
}
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDate(JNIEnv *env, jobject obj, jstring jFilename)
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv *env, jobject obj, jstring jFilename)
{
std::string filename = GetJString(env, jFilename);
std::string date = GetApploaderDate(filename);
return env->NewStringUTF(date.c_str());
std::string company = GetCompany(filename);
return env->NewStringUTF(company.c_str());
}
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv *env, jobject obj, jstring jFilename)
@ -444,11 +458,11 @@ JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize
return size;
}
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsWiiTitle(JNIEnv *env, jobject obj, jstring jFilename)
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv *env, jobject obj, jstring jFilename)
{
std::string filename = GetJString(env, jFilename);
bool wiiDisc = IsWiiTitle(filename);
return wiiDisc;
int platform = GetPlatform(filename);
return platform;
}
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj)