mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Android: Add disc image conversion
This commit is contained in:
@ -63,6 +63,8 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getDiscNumb
|
||||
jobject obj);
|
||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobType(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj);
|
||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlockSize(JNIEnv* env,
|
||||
@ -73,6 +75,8 @@ JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj);
|
||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_isDatelDisc(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
|
||||
jobject obj);
|
||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBannerWidth(JNIEnv* env,
|
||||
@ -154,6 +158,12 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getRevision
|
||||
return GetRef(env, obj)->GetRevision();
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobType(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
return static_cast<jint>(GetRef(env, obj)->GetBlobType());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_model_GameFile_getBlobTypeString(JNIEnv* env, jobject obj)
|
||||
{
|
||||
@ -175,7 +185,7 @@ Java_org_dolphinemu_dolphinemu_model_GameFile_getCompressionMethod(JNIEnv* env,
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_model_GameFile_shouldShowFileFormatDetails(JNIEnv* env, jobject obj)
|
||||
{
|
||||
return GetRef(env, obj)->ShouldShowFileFormatDetails();
|
||||
return static_cast<jboolean>(GetRef(env, obj)->ShouldShowFileFormatDetails());
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSize(JNIEnv* env,
|
||||
@ -184,6 +194,12 @@ JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getFileSiz
|
||||
return GetRef(env, obj)->GetFileSize();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_isDatelDisc(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
return static_cast<jboolean>(GetRef(env, obj)->IsDatelDisc());
|
||||
}
|
||||
|
||||
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_model_GameFile_getBanner(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "Common/AndroidAnalytics.h"
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/CommonPaths.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
@ -45,7 +46,9 @@
|
||||
#include "Core/State.h"
|
||||
#include "Core/WiiUtils.h"
|
||||
|
||||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/ScrubbedBlob.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
|
||||
#include "InputCommon/ControllerInterface/Android/Android.h"
|
||||
@ -663,6 +666,58 @@ JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_InstallW
|
||||
return static_cast<jboolean>(WiiUtils::InstallWAD(path));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_ConvertDiscImage(
|
||||
JNIEnv* env, jobject obj, jstring jInPath, jstring jOutPath, jint jPlatform, jint jFormat,
|
||||
jint jBlockSize, jint jCompression, jint jCompressionLevel, jboolean jScrub)
|
||||
{
|
||||
const std::string in_path = GetJString(env, jInPath);
|
||||
const std::string out_path = GetJString(env, jOutPath);
|
||||
const DiscIO::Platform platform = static_cast<DiscIO::Platform>(jPlatform);
|
||||
const DiscIO::BlobType format = static_cast<DiscIO::BlobType>(jFormat);
|
||||
const DiscIO::WIARVZCompressionType compression =
|
||||
static_cast<DiscIO::WIARVZCompressionType>(jCompression);
|
||||
const bool scrub = static_cast<bool>(jScrub);
|
||||
|
||||
std::unique_ptr<DiscIO::BlobReader> blob_reader;
|
||||
if (scrub)
|
||||
blob_reader = DiscIO::ScrubbedBlob::Create(in_path);
|
||||
else
|
||||
blob_reader = DiscIO::CreateBlobReader(in_path);
|
||||
|
||||
if (!blob_reader)
|
||||
return static_cast<jboolean>(false);
|
||||
|
||||
const auto callback = [](const std::string& text, float percent) { return true; };
|
||||
|
||||
bool success = false;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case DiscIO::BlobType::PLAIN:
|
||||
success = DiscIO::ConvertToPlain(blob_reader.get(), in_path, out_path, callback);
|
||||
break;
|
||||
|
||||
case DiscIO::BlobType::GCZ:
|
||||
success =
|
||||
DiscIO::ConvertToGCZ(blob_reader.get(), in_path, out_path,
|
||||
platform == DiscIO::Platform::WiiDisc ? 1 : 0, jBlockSize, callback);
|
||||
break;
|
||||
|
||||
case DiscIO::BlobType::WIA:
|
||||
case DiscIO::BlobType::RVZ:
|
||||
success = DiscIO::ConvertToWIAOrRVZ(blob_reader.get(), in_path, out_path,
|
||||
format == DiscIO::BlobType::RVZ, compression,
|
||||
jCompressionLevel, jBlockSize, callback);
|
||||
break;
|
||||
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return static_cast<jboolean>(success);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_FormatSize(JNIEnv* env,
|
||||
jobject obj,
|
||||
jlong bytes,
|
||||
|
Reference in New Issue
Block a user