コード例 #1
0
ファイル: D3D11PointLight.cpp プロジェクト: Katharsas/GD3D11
D3D11PointLight::D3D11PointLight(VobLightInfo* info, bool dynamicLight)
{
	D3D11GraphicsEngineBase* engine = (D3D11GraphicsEngineBase *)Engine::GraphicsEngine;
	LightInfo = info;
	DynamicLight = dynamicLight;

	LastUpdatePosition = LightInfo->Vob->GetPositionWorld();

	DepthCubemap = NULL;
	ViewMatricesCB = NULL;

	if(!dynamicLight)
	{
		InitDone = false;

		// Add to queue
		Engine::WorkerThreadPool->enqueue( [this]{ InitResources(); });

	}else
	{
		InitResources();
	}

	DrawnOnce = false;
}
コード例 #2
0
FSplineMeshSceneProxy::FSplineMeshSceneProxy(USplineMeshComponent* InComponent) :
    FStaticMeshSceneProxy(InComponent)
{
    bSupportsDistanceFieldRepresentation = false;

    // make sure all the materials are okay to be rendered as a spline mesh
    for (FStaticMeshSceneProxy::FLODInfo& LODInfo : LODs)
    {
        for (FStaticMeshSceneProxy::FLODInfo::FSectionInfo& Section : LODInfo.Sections)
        {
            if (!Section.Material->CheckMaterialUsage_Concurrent(MATUSAGE_SplineMesh))
            {
                Section.Material = UMaterial::GetDefaultMaterial(MD_Surface);
            }
        }
    }

    // Copy spline params from component
    SplineParams = InComponent->SplineParams;
    SplineUpDir = InComponent->SplineUpDir;
    bSmoothInterpRollScale = InComponent->bSmoothInterpRollScale;
    ForwardAxis = InComponent->ForwardAxis;

    // Fill in info about the mesh
    if (FMath::IsNearlyEqual(InComponent->SplineBoundaryMin, InComponent->SplineBoundaryMax))
    {
        FBoxSphereBounds StaticMeshBounds = StaticMesh->GetBounds();
        SplineMeshScaleZ = 0.5f / USplineMeshComponent::GetAxisValue(StaticMeshBounds.BoxExtent, ForwardAxis); // 1/(2 * Extent)
        SplineMeshMinZ = USplineMeshComponent::GetAxisValue(StaticMeshBounds.Origin, ForwardAxis) * SplineMeshScaleZ - 0.5f;
    }
    else
    {
        SplineMeshScaleZ = 1.0f / (InComponent->SplineBoundaryMax - InComponent->SplineBoundaryMin);
        SplineMeshMinZ = InComponent->SplineBoundaryMin * SplineMeshScaleZ;
    }

    LODResources.Reset(InComponent->StaticMesh->RenderData->LODResources.Num());

    for (int32 LODIndex = 0; LODIndex < LODs.Num(); LODIndex++)
    {
        FSplineMeshVertexFactory* VertexFactory = new FSplineMeshVertexFactory(this);

        LODResources.Add(VertexFactory);

        if( InComponent->LODData.IsValidIndex( LODIndex ))
        {
            const FStaticMeshComponentLODInfo& ComponentLODInfo = InComponent->LODData[ LODIndex ];
            InitResources( InComponent, LODIndex, ComponentLODInfo.OverrideVertexColors );
        }
        else
            InitResources( InComponent, LODIndex, NULL );
    }
}
コード例 #3
0
int MsgInit( void )
{
#if !defined( USE_TEXT_MSGS )
    int         initerror;
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) == NULL ) {
        initerror = 1;
    } else {
        hInstance.filename = name;
        OpenResFile( &hInstance );
        if( hInstance.handle == NIL_HANDLE ) {
            initerror = 1;
        } else {
            initerror = FindResources( &hInstance );
            if( !initerror ) {
                initerror = InitResources( &hInstance );
            }
        }
    }
    MsgShift = WResLanguage() * MSG_LANG_SPACING;
    if( !initerror && !MsgGet( MSG_USE_BASE, name ) ) {
        initerror = 1;
    }
    if( initerror ) {
        write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
        MsgFini();
        return( 0 );
    }
#endif
    return( 1 );
}
コード例 #4
0
int InitMsg( void )
{
    char        buff[_MAX_PATH];
#if defined( IDE_PGM ) || !defined( __WATCOMC__ )
    char        imageName[_MAX_PATH];
#else
    char        *imageName;
#endif

    hInstance.handle = NIL_HANDLE;
#if defined( IDE_PGM )
    _cmdname( imageName );
#elif !defined( __WATCOMC__ )
    get_dllname( imageName, sizeof( imageName ) );
#else
    imageName = _LpDllName;;
#endif
    BannerPrinted = false;
    if( !OpenResFile( &hInstance, imageName ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( Msg_Get( MSG_PRODUCT, buff ) ) {
                Res_Flag = EXIT_SUCCESS;
                return( Res_Flag );
            }
        }
        CloseResFile( &hInstance );
        hInstance.handle = NIL_HANDLE;
    }
    WriteStdOutInfo( NO_RES_MESSAGE, ERR, NULL );
    Res_Flag = EXIT_FAILURE;
    return( Res_Flag );
}
コード例 #5
0
ファイル: main.cpp プロジェクト: boredzo/CCX
void Initialize( void )
{	
#if __APPLE__ // Shiny OS X
	InitResources();
#else
#if _WIN32
		HMODULE module;
		char    name[MAX_PATH+1], *lastBackslash;
		
		module = GetModuleHandle( NULL );
		GetModuleFileName( module, name, MAX_PATH );
		lastBackslash = strrchr( name, '\\' );
		if( lastBackslash != NULL )
		{
			*lastBackslash = '\0';
			strcpy( candyCrisisResources, name );
			strcat( candyCrisisResources, "\\CandyCrisisResources\\" );
		}
#endif
#if TARGET_API_MAC_CARBON // Classic MacOS
		strcpy( candyCrisisResources, ":CandyCrisisResources:" );
#endif
#ifdef linux
		strcpy( candyCrisisResources, "CandyCrisisResources/" );
#endif		
#endif
	atexit( SDL_Quit );
	
	SDL_SetEventFilter( SDLU_EventFilter );
}
コード例 #6
0
void InitMsg( void )
{
    int initerror;

    hInstance.filename = ImageName;
    initerror = OpenResFile( &hInstance ) == NIL_HANDLE;
    if( !initerror ) {
        initerror = FindResources( &hInstance );
        if( initerror ) {
            CloseResFile( &hInstance );
        }
    }
    if( !initerror ) {
        initerror = InitResources( &hInstance );
        if( initerror ) {
            CloseResFile( &hInstance );
        }
    }
    MsgShift = WResLanguage() * MSG_LANG_SPACING;
    if( initerror ) {
        Res_Flag = EXIT_FAILURE;
        FatalResError();
    } else {
        Res_Flag = EXIT_SUCCESS;
    }
}
コード例 #7
0
ファイル: Script.c プロジェクト: sarah-russell12/openclonk
protected func Initialize()
{
	// Show wealth in HUD.
	GUI_Controller->ShowWealth();
	
	// Rules: team account and buying at flagpole.
	CreateObject(Rule_TeamAccount);
	CreateObject(Rule_BuyAtFlagpole);
	
	// Goal: Sell Gems, amount depends on difficulty and initial availability.
	var gems = (4 * GetMaterialCount(Material("Ruby"))) / (5 * GetMaterialVal("Blast2ObjectRatio", "Material", Material("Ruby")));
	gems += (4 * GetMaterialCount(Material("Amethyst"))) / (5 * GetMaterialVal("Blast2ObjectRatio", "Material", Material("Amethyst")));
	var percentage = 55 + 15 * SCENPAR_Difficulty;
	var goal = CreateObject(Goal_SellGems);
	goal->SetTargetAmount((gems * percentage) / 100);
	
	// Initialize different parts of the scenario.
	InitEnvironment(SCENPAR_Difficulty);
	InitVegetation();
	InitAnimals();
	InitResources(SCENPAR_Difficulty);
	InitMainIsland(4 - SCENPAR_Difficulty);
	InitIslands(4 - SCENPAR_Difficulty);
		
	return;
}
コード例 #8
0
//--------------------------------------------------------------------------------------
// Entry point to the program. Initializes everything and goes into a message processing 
// loop. Idle time is used to render the scene.
//--------------------------------------------------------------------------------------
int _cdecl main( int NumArgs, char** ppCmdLine )
{
    // Enable run-time memory check for debug builds.
#if defined(DEBUG) | defined(_DEBUG)
    _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

    // This may fail if Direct3D 10 isn't installed
    WCHAR wszPath[MAX_PATH+1] = {0};
    if( !::GetSystemDirectory( wszPath, MAX_PATH + 1 ) )
        return false;
    wcscat_s( wszPath, MAX_PATH, L"\\d3d10.dll" );
    HMODULE hMod = LoadLibrary( wszPath );
    if( NULL == hMod )
    {
        PrintError( "DirectX 10 is necessary to run GPUSpectrogram.\n" );
        return 1;
    }
    FreeLibrary( hMod );

    // parse the command line
    if( !ParseCommandLine( ppCmdLine, NumArgs ) )
        return 1;

    // create a device
    HRESULT hr = S_OK;
    ID3D10Device* pDevice = NULL;
    DWORD dwCreateFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)
    dwCreateFlags |= D3D10_CREATE_DEVICE_DEBUG;
#endif
    hr = D3D10CreateDevice( NULL, D3D10_DRIVER_TYPE_HARDWARE, ( HMODULE )0, dwCreateFlags,
                            D3D10_SDK_VERSION, &pDevice );
    if( FAILED( hr ) )
    {
        hr = D3D10CreateDevice( NULL, D3D10_DRIVER_TYPE_REFERENCE, ( HMODULE )0, dwCreateFlags,
                                D3D10_SDK_VERSION, &pDevice );
        if( FAILED( hr ) )
        {
            PrintError( "A suitable D3D10 device could not be created.\n" );
            return 1;
        }
    }

    if( FAILED( InitResources( pDevice ) ) )
    {
        PrintError( "GPUSpectrogram encountered an error creating resources.\n" );
        return 2;
    }

    CreateSpectrogram( pDevice );

    if( FAILED( SaveSpectogramToFile( pDevice, g_strBitmapName, g_pSourceTexture ) ) )
        PrintError( "GPUSpectrogram encountered an error saving the spectrogram image file.\n" );

    DestroyResources();
    SAFE_RELEASE( pDevice );

    return 0;
}
コード例 #9
0
bool GUILoadStrInit( const char *fname )
{
    bool        error;

    error = OpenResFile( &hInstance, fname ) == NIL_HANDLE;
    if( !error ) {
        if( GUIGetExtName() != NULL ) {
            // we are using an external resource file so we don't have to
            // search
            FileShift = 0;
        } else {
            error = FindResources( &hInstance );
        }
    }
    if( !error ) {
        error = InitResources( &hInstance );
    }
    if( error ) {
        GUIMsgInitFlag = FALSE;
        write( fileno(stdout), NO_RES_MESSAGE_PREFIX, sizeof( NO_RES_MESSAGE_PREFIX ) - 1 );
        write( fileno(stdout), fname,                 strlen( fname ) );
        write( fileno(stdout), NO_RES_MESSAGE_SUFFIX, sizeof( NO_RES_MESSAGE_SUFFIX ) - 1 );
    } else {
        GUIMsgInitFlag = TRUE;
    }

    return( GUIMsgInitFlag );
}
コード例 #10
0
/**
 * Sets number of resources in project
 *
 * @param           
 * @return          
 * @exception       -
 * @see             
*/
void CProjectWizardData::SetResourceCount(int iCount)
{
    ResetResources();
    m_Resources.RemoveAll();
    m_Resources.SetSize(iCount);
    InitResources();
    CreateNewResources();
}
コード例 #11
0
FSlateRHIRenderingPolicy::FSlateRHIRenderingPolicy( TSharedPtr<FSlateFontCache> InFontCache, TSharedRef<FSlateRHIResourceManager> InResourceManager )
	: FSlateRenderingPolicy(0)
	, ResourceManager( InResourceManager )
	, FontCache( InFontCache )
	, CurrentBufferIndex(0)
	, bGammaCorrect(true)
{
	InitResources();
};
コード例 #12
0
void UMaterialInstanceDynamic::CopyParameterOverrides(UMaterialInstance* MaterialInstance)
{
	ClearParameterValues();
	VectorParameterValues = MaterialInstance->VectorParameterValues;
	ScalarParameterValues = MaterialInstance->ScalarParameterValues;
	TextureParameterValues = MaterialInstance->TextureParameterValues;
	FontParameterValues = MaterialInstance->FontParameterValues;
	InitResources();
}
コード例 #13
0
FSlateD3D11RenderingPolicy::FSlateD3D11RenderingPolicy( TSharedPtr<FSlateFontCache> InFontCache, TSharedRef<FSlateD3DTextureManager> InTexureManager )
	: FSlateRenderingPolicy( PixelCenterOffsetD3D11 ) 
	, FontCache( InFontCache )
	, TextureManager( InTexureManager )
{
	InitResources();


}
コード例 #14
0
ファイル: soundhub.cpp プロジェクト: rsk78n/zoya
    void SoundHubObject::InitSound( int freq, int chksz)
    {
        m_MaxSounds = MIX_CHANNELS;

        Mix_Init( MIX_INIT_OGG );
        Mix_OpenAudio( freq, AUDIO_S16SYS, 2, chksz );
        Mix_AllocateChannels( m_MaxSounds );

        InitResources();
        m_CanPlaySound = true;
    }
コード例 #15
0
UINT32 Update( EVENT_STACK_T *ev_st,  void *app, UINT32 sItem )
{
    APPLICATION_T           *papp = (APPLICATION_T*) app;
    SU_PORT_T               port = papp->port;
    CONTENT_T               content;
    UIS_DIALOG_T            dialog = 0;
	ACTIONS_T				action_list;

    if ( papp->dialog != NULL )
	{	
		APP_UtilUISDialogDelete( &papp->dialog );
		papp->dialog = NULL;
        RemoveResources();
	}	

    InitResources();
    InitDlgActions( &action_list );

    dialog = UIS_CreateList( &port,
							 0,
							 ENTRIES_NUM,
							 0,
							 &starting_num,
							 0,
							 2,
							 &action_list,
							 Resources[RES_LIST_CAPTION] );

    if(dialog == 0) return RESULT_FAIL;

    papp->dialog = dialog;
    
	if (sItem != 0)
	{
		APP_UtilAddEvUISListChange( ev_st,
                                app,
                                0, // = 0
                                sItem,
                                ENTRIES_NUM,
                                TRUE,
                                2,          // = 2
                                FBF_LEAVE,
                                NULL,
                                NULL );	

		UIS_HandleEvent( dialog,  ev_st );		
	}

    SendListItems( ev_st, app, 1, starting_num );

    return RESULT_OK;
}
コード例 #16
0
ファイル: meshman.cpp プロジェクト: supermukmin/darkreign2
Bool Mesh::Manager::Init()
{
    rootTree.SetNodeMember( &MeshRoot::treeNode);
    entList.SetNodeMember( &MeshEnt::listNode);

    envMap = NULL;

    Statistics::Init();

    InitResources();

    return sysInit = TRUE;
}
コード例 #17
0
ファイル: errrsrc.c プロジェクト: andreiw/open-watcom-v2
static  void    ErrorInit( const char *pgm_name )
{
    hInstance.handle = NIL_HANDLE;
    if( OpenResFile( &hInstance, pgm_name ) )
        return;
    ResFlags |= RF_OPENED;
    if( FindResources( &hInstance ) )
        return;
    if( InitResources( &hInstance ) )
        return;
    MsgShift = _WResLanguage() * MSG_LANG_SPACING;
    ResFlags |= RF_INITIALIZED;
}
コード例 #18
0
FSkeletalMeshObjectCPUSkin::FSkeletalMeshObjectCPUSkin(USkinnedMeshComponent* InMeshComponent, FSkeletalMeshResource* InSkeletalMeshResource, ERHIFeatureLevel::Type InFeatureLevel)
	: FSkeletalMeshObject(InMeshComponent, InSkeletalMeshResource, InFeatureLevel)
,	DynamicData(NULL)
,	CachedVertexLOD(INDEX_NONE)
,	bRenderBoneWeight(false)
{
	// create LODs to match the base mesh
	for( int32 LODIndex=0;LODIndex < SkeletalMeshResource->LODModels.Num();LODIndex++ )
	{
		new(LODs) FSkeletalMeshObjectLOD(SkeletalMeshResource,LODIndex);
	}

	InitResources();
}
コード例 #19
0
ファイル: Graphics2.cpp プロジェクト: MaikelH/ConsoleRenderer
int _tmain(int argc, _TCHAR* argv[])
{
	renderer = new RenderSystem();
	camera = new Camera();

	renderer->SetDisplayCallback(&displayCallback);
	renderer->SetCamera(camera);
	InitResources();
	renderer->SetRenderList(_meshList);
	renderer->StartRender();


	_meshList[0]->Rotate(45, glm::vec3(0, 0, 1));
	return 0;
}
コード例 #20
0
ファイル: winmain.cpp プロジェクト: bilboftw/Rippl
/**
 * WinMain Function
 *	Main Windows program entry point
 */
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	// Initialize Resources
	InitResources(hInstance);


	// Main Loop
	while(true){Sleep(5000);}
	
	// Release Resources
	ReleaseResources();

	// Return Success
	return 0;
}
コード例 #21
0
int C_DECL main(int argc, char* argv[])
{
	{
		// One time init
		InitResources();
		glslang::InitializeProcess();
		spv::Parameterize();
	}

	const char* File = ReadFileData(argv[1]);
	DoCompile(File);

	glslang::FinalizeProcess();

	return 0;
}
コード例 #22
0
FSkeletalMeshObjectGPUSkin::FSkeletalMeshObjectGPUSkin(USkinnedMeshComponent* InMeshComponent, FSkeletalMeshResource* InSkeletalMeshResource, ERHIFeatureLevel::Type InFeatureLevel)
	: FSkeletalMeshObject(InMeshComponent, InSkeletalMeshResource, InFeatureLevel)
,	DynamicData(NULL)
,	bNeedsUpdateDeferred(false)
,	bMorphNeedsUpdateDeferred(false)
,	bMorphResourcesInitialized(false)
{
	// create LODs to match the base mesh
	LODs.Empty(SkeletalMeshResource->LODModels.Num());
	for( int32 LODIndex=0;LODIndex < SkeletalMeshResource->LODModels.Num();LODIndex++ )
	{
		new(LODs) FSkeletalMeshObjectLOD(SkeletalMeshResource,LODIndex);
	}

	InitResources();
}
コード例 #23
0
ファイル: rcldstr.c プロジェクト: Ukusbobra/open-watcom-v2
int InitRcMsgs( void )
{
    int         error;
    WResFileID  (* oldopen)(const char *, int, ...);
    char        testbuf[1];
#if defined( IDE_PGM ) || !defined( __WATCOMC__ )
    char        imageName[_MAX_PATH];
#else
    char        *imageName;
#endif

#if defined( IDE_PGM )
    _cmdname( imageName );
#elif !defined( __WATCOMC__ )
    get_dllname( imageName, sizeof( imageName ) );
#else
    imageName = _LpDllName;
#endif
    /*
     * swap open functions so this file handle is not buffered.
     * This makes it easier for layer0 to fool WRES into thinking
     * that the resource information starts at offset 0
     */
    oldopen = WResRtns.open;
    WResRtns.open = open;
    error = OpenResFile( &Instance, imageName );
    WResRtns.open = oldopen;
    if( !error ) {
        RegisterOpenFile( Instance.handle );
        error = FindResources( &Instance );
        if( !error ) {
            error = InitResources( &Instance );
        }
        if( error ) {
            CloseResFile( &Instance );
            UnRegisterOpenFile( Instance.handle );
        }
    }
    MsgShift = _WResLanguage() * MSG_LANG_SPACING;
    if( !error && !GetRcMsg( USAGE_MSG_FIRST, testbuf, sizeof( testbuf ) ) ) {
        error = TRUE;
    }
    if( error ) {
        RcFatalError( ERR_RCSTR_NOT_FOUND );
    }
    return( 1 );
}
コード例 #24
0
ファイル: msg.c プロジェクト: ABratovic/open-watcom-v2
int MsgInit( void )
{
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( GetMsg( name, MSG_USAGE_FIRST ) ) {
                return( 1 );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( 0 );
}
コード例 #25
0
ファイル: CCommandLine.cpp プロジェクト: Ttech/Transcendence
ALERROR CCommandLine::Activate (CUFrame *pFrame, RECT *pRect)

//	Activate
//
//	Handle activation

	{
	ALERROR error;
	AutoSizeDesc AutoSize;
	CUFrame *pNewFrame;

	//	Remember our rect and frame

	m_rcRect = *pRect;
	m_pFrame = pFrame;
	m_cxFieldWidth = max(0, RectWidth(pRect) - (LEFT_MARGIN + RIGHT_MARGIN));

	//	Make sure we have our resources loaded

	if (error = InitResources(pFrame->GetWindow()->GetApp()->GetResourcesDb()))
		return error;

	//	Create an edit control

	AutoSize.SetAutoSize(0,
			EDITOR_HEIGHT, 
			LEFT_MARGIN, 
			EDITOR_Y, 
			RIGHT_MARGIN, 
			0, 
			AutoSizeDesc::DimVariable, AutoSizeDesc::MaxVariable);
	if (error = m_pFrame->GetWindow()->CreateFrame(m_pFrame, EDITOR_FRAME_ID, 0, &AutoSize, &pNewFrame))
		return error;

	m_pEditor = new CULineEditor(this);
	if (m_pEditor == NULL)
		return ERR_MEMORY;

	m_pEditor->SetActionMsg((ControllerNotifyProc)&CCommandLine::CmdAction);
	m_pEditor->SetSingleLine();

	if (error = pNewFrame->SetContent(m_pEditor, TRUE))
		return error;

	return NOERROR;
	}
コード例 #26
0
ファイル: TorrentWizard.cpp プロジェクト: ivan386/Shareaza
BOOL CTorrentWizardApp::InitInstance()
{
	CCommandLineInfoEx cmdInfo; 
	ParseCommandLine(cmdInfo); 

	cmdInfo.GetOption( _T("sourcefile"), m_sCommandLineSourceFile );
	cmdInfo.GetOption( _T("destination"), m_sCommandLineDestination );
	cmdInfo.GetOption( _T("tracker"), m_sCommandLineTracker );
	cmdInfo.GetOption( _T("comment"), m_sCommandLineComment );

	if ( m_sCommandLineSourceFile.GetLength() > 0 && 
		 m_sCommandLineDestination.GetLength() > 0 && 
		 m_sCommandLineTracker.GetLength() > 0 )
	{
		if ( m_sCommandLineComment.IsEmpty() )
			m_sCommandLineComment = _T("http://shareaza.sourceforge.net/");
	}

	SetRegistryKey( _T("Shareaza") );
	
	InitEnvironment();
	InitResources();

	CWizardSheet	pSheet;
	CWelcomePage	pWelcome;
	CSinglePage		pSingle;
	CPackagePage	pPackage;
	CTrackerPage	pTracker;
	CCommentPage	pComment;
	COutputPage		pOutput;
	CFinishedPage	pFinished;

	m_pSheet = &pSheet;

	pSheet.AddPage( &pWelcome );
	pSheet.AddPage( &pSingle );
	pSheet.AddPage( &pPackage );
	pSheet.AddPage( &pTracker );
	pSheet.AddPage( &pOutput );
	pSheet.AddPage( &pComment );
	pSheet.AddPage( &pFinished );

	pSheet.DoModal();
	
	return FALSE;
}
コード例 #27
0
ファイル: managerapp.cpp プロジェクト: Joeywp/OVLMake
bool ManagerApp::OnInit() {
    const wxString name = wxString::Format(wxT("RCT3Manager-%s"), wxGetUserId().c_str());
    m_checker = new wxSingleInstanceChecker(name);
    if ( m_checker->IsAnotherRunning() ) {
        wxLogError(_("Another program instance is already running, aborting."));
        return false;
    }

	::wxInitAllImageHandlers();
    //wxXmlResource::Get()->InitAllHandlers();
    wxFileSystem::AddHandler(new wxArchiveFSHandler);
    wxFileSystem::AddHandler(new wxFilterFSHandler);
    wxFileSystem::AddHandler(new wxMemoryFSHandler);

    wxBZipClassFactory cf;

    xmlcpp::wxXmlInputCallbackFileSystem::Init();

    m_appdir = wxFileName(argv[0]).GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME);

    wxFileConfig::Set(new wxFileConfig(wxT("RCT3 Manager"), wxT("Freeware"), m_appdir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME)+wxT("RCT3 Manager.conf"), wxT(""), wxCONFIG_USE_LOCAL_FILE));

    // *&^$% GraphicsMagick
    wxString appenv = wxT("MAGICK_CONFIGURE_PATH=") + m_appdir.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME);
    putenv(appenv.mb_str(wxConvLocal));

    if (!CheckInstallDir())
        return false;

    InitResources();

    if (!CheckManagerDB())
        return false;
    if (!CheckFilesDB())
        return false;

    frmMain* main = new frmMain(NULL);
    main->Show(true);
    SetTopWindow(main);

    return true;

}
コード例 #28
0
ファイル: msg.c プロジェクト: bhanug/open-watcom-v2
bool MsgInit( void )
{
    char            name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        res_failure = false;
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( WDIS_LITERAL_BASE, name ) ) {
                return( true );
            }
        }
        MsgFini();
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    res_failure = true;
    return( false );
}
コード例 #29
0
ファイル: wtmsg.c プロジェクト: NoSuchProcess/open-watcom-v2
int MsgInit( void )
/******************/
{
    char        name[_MAX_PATH];
    char        dummy[MAX_RESOURCE_SIZE];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( MSG_USAGE_BASE, dummy ) ) {
                return( true );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( false );
}
コード例 #30
0
int Msg_Init( void )
{
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( Msg_Get( MSG_USAGE_FIRST, name ) ) {
                Res_Flag = EXIT_SUCCESS;
                return( Res_Flag );
            }
        }
        CloseResFile( &hInstance );
        hInstance.handle = NIL_HANDLE;
    }
    Res_Flag = EXIT_FAILURE;
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    return Res_Flag;
}