Example #1
0
extern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeInterop_saveState(JNIEnv* env, jobject obj, jint slot)
{
	assert(g_virtualMachine != nullptr);
	if(g_virtualMachine == nullptr) return;
	Framework::PathUtils::EnsurePathExists(GetStateDirectoryPath());
	auto stateFilePath = GenerateStatePath(slot);
	if(g_virtualMachine->SaveState(stateFilePath.string().c_str()) != 0)
	{
		jclass exceptionClass = env->FindClass("java/lang/Exception");
		env->ThrowNew(exceptionClass, "SaveState failed.");
		return;
	}
}
Example #2
0
void CMainWindow::SaveState()
{
	if(m_virtualMachine.m_os->GetELF() == nullptr) return;

	Framework::PathUtils::EnsurePathExists(GetStateDirectoryPath());
	if(m_virtualMachine.SaveState(GenerateStatePath().string().c_str()) == 0)
	{
		PrintStatusTextA("Saved state to slot %i.", m_stateSlot);
	}
	else
	{
		PrintStatusTextA("Error saving state to slot %i.", m_stateSlot);
	}
}
Example #3
0
static boost::filesystem::path GenerateStatePath(int slot)
{
	auto stateDirPath = GetStateDirectoryPath();
	auto stateFileName = string_format("%s.st%d", g_virtualMachine->m_ee->m_os->GetExecutableName(), slot);
	return stateDirPath / stateFileName;
}
Example #4
0
boost::filesystem::path CMainWindow::GenerateStatePath() const
{
	std::string stateFileName = std::string(m_virtualMachine.m_os->GetExecutableName()) + ".st" + std::to_string(m_stateSlot) + ".zip";
	return GetStateDirectoryPath() / boost::filesystem::path(stateFileName);
}