2014-12-04 07:56:54 +00:00
|
|
|
#include <jni.h>
|
2014-12-07 03:05:14 +00:00
|
|
|
#include <cassert>
|
|
|
|
#include <android/log.h>
|
|
|
|
#include "PathUtils.h"
|
2014-12-04 07:56:54 +00:00
|
|
|
#include "../PS2VM.h"
|
|
|
|
|
2014-12-07 03:05:14 +00:00
|
|
|
#define LOG_NAME "Play!"
|
|
|
|
|
|
|
|
static CPS2VM* g_virtualMachine = nullptr;
|
|
|
|
|
|
|
|
void Log_Print(const char* fmt, ...)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
__android_log_vprint(ANDROID_LOG_INFO, LOG_NAME, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeInterop_setFilesDirPath(JNIEnv* env, jobject obj, jstring dirPathString)
|
|
|
|
{
|
|
|
|
auto dirPath = env->GetStringUTFChars(dirPathString, 0);
|
|
|
|
Framework::PathUtils::SetFilesDirPath(dirPath);
|
|
|
|
env->ReleaseStringUTFChars(dirPathString, dirPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeInterop_createVirtualMachine(JNIEnv* env, jobject obj)
|
|
|
|
{
|
|
|
|
g_virtualMachine = new CPS2VM();
|
|
|
|
g_virtualMachine->Initialize();
|
|
|
|
}
|
|
|
|
|
2014-12-04 07:56:54 +00:00
|
|
|
extern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeInterop_start(JNIEnv* env, jobject obj)
|
|
|
|
{
|
2014-12-07 03:05:14 +00:00
|
|
|
g_virtualMachine->Reset();
|
|
|
|
g_virtualMachine->m_ee->m_os->BootFromFile("/storage/emulated/legacy/demo2b.elf");
|
|
|
|
Log_Print("Before step.");
|
|
|
|
g_virtualMachine->StepEe();
|
|
|
|
Log_Print("Stepping.");
|
2014-12-04 07:56:54 +00:00
|
|
|
}
|