예제 #1
0
void tTVPAsyncImageLoader::LoadImageFromCommand( tTVPImageLoadCommand* cmd ) {
	ttstr ext = TVPExtractStorageExt(cmd->path_);
	tTVPGraphicHandlerType* handler = NULL;
	if(ext == TJS_W("")) {
		cmd->result_ = TJS_W("Filename extension not found");
	} else {
		handler = TVPGetGraphicLoadHandler(ext);
	}
	if( handler ) {
		try {
			tTVPStreamHolder holder(cmd->path_);
			handler->Load(handler->FormatData, (void*)cmd->dest_, TVPLoadGraphicAsync_SizeCallback,
				TVPLoadGraphicAsync_ScanLineCallback, TVPLoadGraphicAsync_MetaInfoPushCallback,
				holder.Get(), -1, glmNormal );
		} catch(...) {
			// 例外は全てキャッチ
			cmd->result_ = TVPFormatMessage(TVPImageLoadError, cmd->path_);
		}
	} else {
		// error
		cmd->result_ = TVPFormatMessage(TVPUnknownGraphicFormat, cmd->path_);
	}
}
예제 #2
0
파일: MsgIntf.cpp 프로젝트: harada3/krkrz
//---------------------------------------------------------------------------
ttstr TVPGetVersionInformation(void)
{
	TVPGetVersion();
	tjs_char verstr[100];
	TJS_snprintf(verstr, sizeof(verstr)/sizeof(tjs_char), TJS_W("%d.%d.%d.%d"),
		TVPVersionMajor, TVPVersionMinor,
		TVPVersionRelease, TVPVersionBuild);

	tjs_char tjsverstr[100];
	TJS_snprintf(tjsverstr, sizeof(tjsverstr)/sizeof(tjs_char), TJS_W("%d.%d.%d"),
		TJSVersionMajor, TJSVersionMinor, TJSVersionRelease);

	return TVPFormatMessage(TVPVersionInformation, verstr, tjsverstr);
}
예제 #3
0
파일: MsgIntf.cpp 프로젝트: harada3/krkrz
//---------------------------------------------------------------------------
// version information related functions
//---------------------------------------------------------------------------
ttstr TVPGetAboutString(void)
{
	TVPGetVersion();
	tjs_char verstr[100];
	TJS_snprintf(verstr, sizeof(verstr)/sizeof(tjs_char), TJS_W("%d.%d.%d.%d"),
		TVPVersionMajor, TVPVersionMinor,
		TVPVersionRelease, TVPVersionBuild);

	tjs_char tjsverstr[100];
	TJS_snprintf(tjsverstr, sizeof(tjsverstr)/sizeof(tjs_char), TJS_W("%d.%d.%d"),
		TJSVersionMajor, TJSVersionMinor, TJSVersionRelease);

	return TVPFormatMessage(TVPAboutString, verstr, tjsverstr) +
        TVPGetImportantLog();
}
예제 #4
0
//---------------------------------------------------------------------------
bool TJS_INTF_METHOD tTVPDrawDevice::SwitchToFullScreen( HWND window, tjs_uint w, tjs_uint h, tjs_uint bpp, tjs_uint color, bool changeresolution )
{
    // ChangeDisplaySettings を使用したフルスクリーン化
    bool success = false;
    DEVMODE dm;
    ZeroMemory(&dm, sizeof(DEVMODE));
    dm.dmSize = sizeof(DEVMODE);
    dm.dmPelsWidth = w;
    dm.dmPelsHeight = h;
    dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
    dm.dmBitsPerPel = bpp;
    LONG ret = ::ChangeDisplaySettings((DEVMODE*)&dm, CDS_FULLSCREEN);
    switch(ret)
    {
    case DISP_CHANGE_SUCCESSFUL:
        ::SetWindowPos(window, HWND_TOP, 0, 0, w, h, SWP_SHOWWINDOW);
        success = true;
        break;
    case DISP_CHANGE_RESTART:
        TVPAddLog( TJS_W("ChangeDisplaySettings failed: DISP_CHANGE_RESTART") );
        break;
    case DISP_CHANGE_BADFLAGS:
        TVPAddLog( TJS_W("ChangeDisplaySettings failed: DISP_CHANGE_BADFLAGS") );
        break;
    case DISP_CHANGE_BADPARAM:
        TVPAddLog( TJS_W("ChangeDisplaySettings failed: DISP_CHANGE_BADPARAM") );
        break;
    case DISP_CHANGE_FAILED:
        TVPAddLog( TJS_W("ChangeDisplaySettings failed: DISP_CHANGE_FAILED") );
        break;
    case DISP_CHANGE_BADMODE:
        TVPAddLog( TJS_W("ChangeDisplaySettings failed: DISP_CHANGE_BADMODE") );
        break;
    case DISP_CHANGE_NOTUPDATED:
        TVPAddLog( TJS_W("ChangeDisplaySettings failed: DISP_CHANGE_NOTUPDATED") );
        break;
    default:
        TVPAddLog( TVPFormatMessage(TJS_W("ChangeDisplaySettings 失敗: 不明な理由 (%1)"),ttstr((tjs_int)ret)) );
        break;
    }
    return success;
}
예제 #5
0
//---------------------------------------------------------------------------
void tTVPSusieArchivePlugin::GetFileList(std::wstring localname,
	std::vector<tTVPSusieFileRecord> &dest)
{
	// retrieve file list
	TVPAddLog( TVPFormatMessage(TVPInfoListingFiles, ttstr(localname.c_str()) ) );

	HLOCAL infohandle = NULL;
	int errorcode = 0xff&GetArchiveInfo(const_cast<LPSTR>(ttstr(localname).AsNarrowStdString().c_str()), 0, 0x00, &infohandle);
	if(infohandle == NULL)
	{
		TVPThrowExceptionMessage(TVPSusiePluginError,
			ttstr(TJS_W("tTVPSusieArchivePlugin::GetArchiveInfo failed, errorcode = ")) +
			ttstr((tjs_int)errorcode));
	}
	else
	{
		if(errorcode != 0)
		{
			TVPAddLog(TJS_W("Warning : invalid errorcode ") + ttstr((tjs_int)errorcode) +
				TJS_W(" was returned from tTVPSusieArchivePlugin::GetArchiveInfo, ")
					TJS_W("continuing anyway."));
		}
	}


	const tTVPSusieFileInfo *info = (const tTVPSusieFileInfo*)LocalLock(infohandle);
	if(info == NULL)
	{
		TVPThrowExceptionMessage(TVPSusiePluginError,
			ttstr(TJS_W("tTVPSusieArchivePlugin::GetArchiveInfo failed : invalid memory block.")));
	}

	try
	{
		while(info->method[0])
		{
			if(info->filename[0])
			{
				char buf[401];
				TJS_nstrcpy(buf, info->path);
				TJS_nstrcat(buf, "/");
				TJS_nstrcat(buf, info->filename);

				tTVPSusieFileRecord record;
				record.Name = buf;
				tTVPArchive::NormalizeInArchiveStorageName(record.Name);
				record.Position = info->position;
				record.Size = info->filesize;

				dest.push_back(record);
			}

			info++;
		}

		// sort item vector by its name (required for tTVPArchive specification)
		std::stable_sort(dest.begin(), dest.end());
	}
	catch(...)
	{
		LocalUnlock(infohandle);
		LocalFree(infohandle);
		throw;
	}

	LocalUnlock(infohandle);
	LocalFree(infohandle);

	TVPAddLog(TJS_W("(info) ") + ttstr((tjs_int)dest.size()) + TJS_W(" files found."));
}
예제 #6
0
파일: MsgIntf.cpp 프로젝트: harada3/krkrz
void TVPThrowExceptionMessage(const tjs_char *msg, const ttstr & p1,
	const ttstr & p2)
{
	throw eTJSError(TVPFormatMessage(msg, p1, p2));
}
예제 #7
0
파일: MsgIntf.cpp 프로젝트: harada3/krkrz
void TVPThrowExceptionMessage(const tjs_char *msg, const ttstr & p1, tjs_int num)
{
	throw eTJSError(TVPFormatMessage(msg, p1, ttstr(num)));
}
예제 #8
0
bool tTVPApplication::StartApplication( int argc, char* argv[] ) {
	_set_se_translator(se_translator_function);

	ArgC = argc;
	ArgV = argv;
	for( int i = 0; i < argc; i++ ) {
		if(!strcmp(argv[i], "-@processohmlog")) {
			has_map_report_process_ = true;
		}
	}
	TVPTerminateCode = 0;

	CheckConsole();

	// try starting the program!
	bool engine_init = false;
	try {
		if(TVPCheckProcessLog()) return true; // sub-process for processing object hash map log

		TVPInitScriptEngine();
		engine_init = true;

		// banner
		TVPAddImportantLog( TVPFormatMessage(TVPProgramStartedOn, TVPGetOSName(), TVPGetPlatformName()) );

		// TVPInitializeBaseSystems
		TVPInitializeBaseSystems();

		Initialize();

		if(TVPCheckPrintDataPath()) return true;
		if(TVPExecuteUserConfig()) return true;
		
		image_load_thread_ = new tTVPAsyncImageLoader();

		TVPSystemInit();

		if(TVPCheckAbout()) return true; // version information dialog box;

		SetTitle( std::wstring(TVPKirikiri) );
		TVPSystemControl = new tTVPSystemControl();
#ifndef TVP_IGNORE_LOAD_TPM_PLUGIN
		TVPLoadPluigins(); // load plugin module *.tpm
#endif
		// Check digitizer
		CheckDigitizer();

		// start image load thread
		image_load_thread_->Resume();

		if(TVPProjectDirSelected) TVPInitializeStartupScript();

		Run();

		try {
			// image_load_thread_->ExitRequest();
			delete image_load_thread_;
			image_load_thread_ = NULL;
		} catch(...) {
			// ignore errors
		}
		try {
			TVPSystemUninit();
		} catch(...) {
			// ignore errors
		}
	} catch( const EAbort & ) {
		// nothing to do
	} catch( const Exception &exception ) {
		TVPOnError();
		if(!TVPSystemUninitCalled)
			ShowException(exception.what());
	} catch( const TJS::eTJSScriptError &e ) {
		TVPOnError();
		if(!TVPSystemUninitCalled)
			ShowException( e.GetMessage().c_str() );
	} catch( const TJS::eTJS &e) {
		TVPOnError();
		if(!TVPSystemUninitCalled)
			ShowException( e.GetMessage().c_str() );
	} catch( const std::exception &e ) {
		ShowException( ttstr(e.what()).c_str() );
	} catch( const char* e ) {
		ShowException( ttstr(e).c_str() );
	} catch( const wchar_t* e ) {
		ShowException( e );
	} catch( const SEHException& e ) {
		PEXCEPTION_RECORD rec = e.ExceptionPointers->ExceptionRecord;
		std::wstring text(SECodeToMessage(e.Code));
		ttstr result = TJSGetStackTraceString( 10 );
		PrintConsole( result.c_str(), result.length(), true );

		TVPDumpHWException();
		ShowException( text.c_str() );
	} catch(...) {
		ShowException( (const tjs_char*)TVPUnknownError );
	}

	if(engine_init) TVPUninitScriptEngine();

	if(TVPSystemControl) delete TVPSystemControl;
	TVPSystemControl = NULL;

	CloseConsole();

	return false;
}