Example #1
0
/*
* DeleteAllRscFiles:  Delete all resource files in resource directory.
*   Also resets last download time to 0.
*/
void DeleteAllRscFiles(void)
{
	HANDLE hFindFile;
	WIN32_FIND_DATA file_info;
	char path[MAX_PATH + FILENAME_MAX], game_path[MAX_PATH];
	
	GetGamePath( game_path );
	// Reset last download time to never
	DownloadSetTime(0);
	
	debug(("Deleting all resource files\n"));
	sprintf(path, "%s%s\\*.*", game_path, resource_dir);
	
	hFindFile = FindFirstFile(path, &file_info);
	if (hFindFile == INVALID_HANDLE_VALUE)
		return;
	
	for(;;)
	{
		// Skip directories
		if (!(file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		{
			sprintf(path, "%s%s\\%s", game_path, resource_dir, file_info.cFileName);  
			
			if (unlink(path) != 0)
				ClientError(hInst, hMain, IDS_CANTDELETE, path);
		}
		
		if (FindNextFile(hFindFile, &file_info) == FALSE)
			break;
	}
	FindClose(hFindFile);
}
Example #2
0
/*
* LoadRscFiles:  Load all the resource files with the given filespec.
*   Returns True iff any was loaded.
*/
Bool LoadRscFiles(char *filespec)
{
	HANDLE hFindFile;
	WIN32_FIND_DATA file_info;
	char file_load_path[MAX_PATH + FILENAME_MAX], game_path[MAX_PATH];
	
	GetGamePath( game_path );
	sprintf(file_load_path,"%s%s\\%s", game_path, resource_dir, filespec);
	
	hFindFile = FindFirstFile(file_load_path, &file_info);
	if (hFindFile == INVALID_HANDLE_VALUE)
		return False;
	
	for(;;)
	{
		// Skip directories
		if (!(file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		{
			/* Add subdirectory name, using file_load_path as temporary */
			sprintf(file_load_path, "%s%s\\%s", game_path, resource_dir, file_info.cFileName);  
			_RPT1(_CRT_WARN,"Loading File : %s\n",file_load_path); 
			if (!RscFileLoad(file_load_path, RscAddCallback))
				debug(("Can't load resource file %s\n", file_info.cFileName));
		}
		
		if (FindNextFile(hFindFile, &file_info) == FALSE)
			break;
	}
	
	FindClose(hFindFile);
	
	return True;
}
Example #3
0
/*
* DeleteRscFiles:  Delete given list of resource files
*/
void DeleteRscFiles(list_type files)
{
	list_type l;
	char filename[MAX_PATH + FILENAME_MAX], game_path[MAX_PATH];
	char *fname;
	struct stat s;
	
	GetGamePath( game_path );
	for (l = files; l != NULL; l = l->next)
	{
		fname = (char *) l->data;
		
		sprintf(filename, "%s%s\\%.*s", game_path, resource_dir, FILENAME_MAX, fname);
		
		/* If file doesn't exist, we're ok */
		if (stat(filename, &s) != 0)
		{
			debug(("Couldn't find file %s to delete\n", filename));
			continue;
		}
		
		if (unlink(filename) != 0)
			ClientError(hInst, hMain, IDS_CANTDELETE, filename);
	}
}
		/**
		* Duplicates the asset
		*/
		void DuplicateAsset()
		{
			if (AssetPackage && CreatedAsset)
			{
				const FString NewObjectName = FString::Printf(TEXT("%s_Copy"), *AssetName);
				const FString NewPackageName = FString::Printf(TEXT("%s/%s"), *GetGamePath(), *NewObjectName);

				// Make sure the referenced object is deselected before duplicating it.
				GEditor->GetSelectedObjects()->Deselect(CreatedAsset);

				// Duplicate the asset
				DuplicatedPackage = CreatePackage(NULL, *NewPackageName);
				DuplicatedAsset = StaticDuplicateObject(CreatedAsset, DuplicatedPackage, *NewObjectName);

				if (DuplicatedAsset)
				{
					DuplicatedAsset->MarkPackageDirty();

					// Notify the asset registry
					FAssetRegistryModule::AssetCreated(DuplicatedAsset);

					TestStats->NumDuplicated++;
					UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Duplicated asset %s to %s (%s)"), *AssetName, *NewObjectName, *Class->GetName());
				}
				else
				{
					UE_LOG(LogEditorAssetAutomationTests, Error, TEXT("Failed to duplicate asset %s (%s)"), *AssetName, *Class->GetName());
				}
			}
		}
Example #5
0
jint
Java_org_yabause_android_YabauseRunnable_init( JNIEnv* env, jobject obj, jobject yab )
{
    yabauseinit_struct yinit;
    int res;
    void * padbits;
    
    if( initEGLFunc() == -1 ) return -1;

    yabause = (*env)->NewGlobalRef(env, yab);

    memset(&yinit, 0, sizeof(yabauseinit_struct));

    yinit.m68kcoretype = M68KCORE_C68K;
    yinit.percoretype = PERCORE_DUMMY;
#ifdef SH2_DYNAREC
    yinit.sh2coretype = 2;
#else
    yinit.sh2coretype = SH2CORE_DEFAULT;
#endif
    yinit.vidcoretype = VIDCORE_SOFT;
#ifdef HAVE_OPENSL
    yinit.sndcoretype = SNDCORE_OPENSL;
#else
    yinit.sndcoretype = SNDCORE_AUDIOTRACK;
#endif
    yinit.cdcoretype = CDCORE_ISO;
    yinit.carttype = GetCartridgeType();
    yinit.regionid = 0;
    yinit.biospath = GetBiosPath();
    yinit.cdpath = GetGamePath();
    yinit.buppath = GetMemoryPath();
    yinit.mpegpath = mpegpath;
    yinit.cartpath = GetCartridgePath();
    yinit.videoformattype = VIDEOFORMATTYPE_NTSC;
    yinit.frameskip = 0;
    yinit.skip_load = 0;

    res = YabauseInit(&yinit);

    OSDChangeCore(OSDCORE_SOFT);

    PerPortReset();
    padbits = PerPadAdd(&PORTDATA1);
    PerSetKey(PERPAD_UP, PERPAD_UP, padbits);
    PerSetKey(PERPAD_RIGHT, PERPAD_RIGHT, padbits);
    PerSetKey(PERPAD_DOWN, PERPAD_DOWN, padbits);
    PerSetKey(PERPAD_LEFT, PERPAD_LEFT, padbits);
    PerSetKey(PERPAD_START, PERPAD_START, padbits);
    PerSetKey(PERPAD_A, PERPAD_A, padbits);
    PerSetKey(PERPAD_B, PERPAD_B, padbits);
    PerSetKey(PERPAD_C, PERPAD_C, padbits);
    PerSetKey(PERPAD_X, PERPAD_X, padbits);
    PerSetKey(PERPAD_Y, PERPAD_Y, padbits);
    PerSetKey(PERPAD_Z, PERPAD_Z, padbits);

    ScspSetFrameAccurate(1);

    return res;
}
Example #6
0
/*
 * ConfigInit:  Find name of INI file.  This function must be called before
 *   using the ini_file variable to read from or write to the INI file.
 */
void ConfigInit(void)
{
   char dir[MAX_PATH];

   //memset(&config,0,sizeof(config));
   GetGamePath( dir );
   sprintf(ini_filename, "%s%s", dir, GetString(hInst, IDS_INIFILE));
   ini_file = ini_filename;
}
Example #7
0
/*
* LoadRoomFile:  Load the room description file given by fname into the 
*   given room structure.  Returns True iff successful.
*/
Bool LoadRoomFile(char *fname, room_type *r)
{
	char filename[MAX_PATH + FILENAME_MAX], game_path[MAX_PATH];
	
	GetGamePath( game_path );
	/* Add directory to filename */
	sprintf(filename, "%s%s\\%.*s", game_path, room_dir, FILENAME_MAX, fname);
	
	return BSPRooFileLoad(filename, r);
}
		/**
		* Saves the duplicated asset
		*/
		void SaveDuplicatedAsset()
		{
			if (DuplicatedPackage && DuplicatedAsset)
			{
				DuplicatedPackage->SetDirtyFlag(true);
				const FString PackagePath = FString::Printf(TEXT("%s/%s_Copy"), *GetGamePath(), *AssetName);
				if (UPackage::SavePackage(DuplicatedPackage, NULL, RF_Standalone, *FPackageName::LongPackageNameToFilename(PackagePath, FPackageName::GetAssetPackageExtension()), GError, nullptr, false, true, SAVE_NoError))
				{
					TestStats->NumDuplicatesSaved++;
					UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Saved asset %s (%s)"), *DuplicatedAsset->GetName(), *Class->GetName());
				}
				else
				{
					UE_LOG(LogEditorAssetAutomationTests, Display, TEXT("Unable to save asset %s (%s)"), *DuplicatedAsset->GetName(), *Class->GetName());
				}
			}
		}
Example #9
0
size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, const char *format, ...)
{
	char _buffer[PLATFORM_MAX_PATH];
	va_list ap;

	va_start(ap, format);
	vsnprintf(_buffer, PLATFORM_MAX_PATH, format, ap);
	va_end(ap);

	/* If we get a "file://" notation, strip off the file:// part so we're left 
	 * with an absolute path.  Note that the absolute path gets returned, so 
	 * usage with relative paths here is completely invalid.
	 */
	if (type != Path_SM_Rel && strncmp(_buffer, "file://", 7) == 0)
	{
		return g_LibSys.PathFormat(buffer, maxlength, "%s", &_buffer[7]);
	}

	const char *base = NULL;
	if (type == Path_Game)
	{
		base = GetGamePath();
	}
	else if (type == Path_SM)
	{
		base = GetSourceModPath();
	}
	else if (type == Path_SM_Rel)
	{
		base = m_SMRelDir;
	}

	if (base)
	{
		return g_LibSys.PathFormat(buffer, maxlength, "%s/%s", base, _buffer);
	}
	else
	{
		return g_LibSys.PathFormat(buffer, maxlength, "%s", _buffer);
	}
}
Example #10
0
/*
* LoadRscFilesSorted:  Load all the resource files with the given filespec, in 
*   sorted filename order.
*   Returns True iff any was loaded.
*/
Bool LoadRscFilesSorted(char *filespec)
{
	HANDLE hFindFile;
	WIN32_FIND_DATA file_info;
	char file_load_path[MAX_PATH + FILENAME_MAX], game_path[MAX_PATH];
	list_type filenames, l;
	
	GetGamePath( game_path );
	sprintf(file_load_path,"%s%s\\%s", game_path, resource_dir, filespec);
	
	hFindFile = FindFirstFile(file_load_path, &file_info);
	if (hFindFile == INVALID_HANDLE_VALUE)
		return False;
	
	filenames = NULL;
	for(;;)
	{
		// Skip directories
		if (!(file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
			filenames = list_add_sorted_item(filenames, strdup(file_info.cFileName), CompareFilenames);
		
		if (FindNextFile(hFindFile, &file_info) == FALSE)
			break;
	}
	
	for (l = filenames; l != NULL; l = l->next)
	{
		/* Add subdirectory name, using file_load_path as temporary */
		sprintf(file_load_path, "%s%s\\%s", game_path, resource_dir, (char *) (l->data));  
		
		_RPT1(_CRT_WARN,"Loading File : %s\n",file_load_path); 
		
		if (!RscFileLoad((char *) file_load_path, RscAddCallback))
			debug(("Can't load resource file %s\n", file_info.cFileName));
	}
	
	FindClose(hFindFile);
	
	list_destroy(filenames);
	return True;
}
void CEditorRoot::OpenShaderFlowgraph( int mode, bool bSM20, bool bForceNewTab )
{
	//CNodeView::FlowGraphType_t curType = GetSafeFlowgraph()->GetFlowgraphType();

	CNodeView::FlowGraphType_t targetType = CNodeView::FLOWGRAPH_HLSL;
	switch (mode)
	{
	case CANVASINIT_PPEFFECT:
		targetType = CNodeView::FLOWGRAPH_POSTPROC;
		break;
	}

	bool bPushHistory = false;

	if ( bForceNewTab ||
		input()->IsKeyDown( KEY_LCONTROL ) || input()->IsKeyDown( KEY_RCONTROL ) )
		AddNewTab(targetType);
	else
		bPushHistory = true;

	OnNewFile();

	CNodeView *pView = GetSafeFlowgraph();
	pView->PurgeCanvas();

	const char *FileToLoad = NULL;

	switch (mode)
	{
	default:
	case CANVASINIT_SCRATCH:
		{
			GenericShaderData *data = new GenericShaderData();
			if ( bSM20 )
				data->shader->iShaderModel = SM_20B;

			pView->InitCanvas(targetType,data);
			delete data;
		}
		break;

	case CANVASINIT_MODEL_SIMPLE:
#ifdef SHADER_EDITOR_DLL_SWARM
		FileToLoad = "def_model_simple_swarm.def";
#else
		FileToLoad = "def_model_simple.def";
#endif
		break;

	case CANVASINIT_MODEL_COMPLEX:
#ifdef SHADER_EDITOR_DLL_SWARM
		FileToLoad = "def_model_complex_swarm.def";
#else
		FileToLoad = "def_model_complex.def";
#endif
		break;

	case CANVASINIT_POSTPROC:
		FileToLoad = "def_pp.def";
		break;

	case CANVASINIT_LIGHTMAPPED_SIMPLE:
#ifdef SHADER_EDITOR_DLL_SWARM
		FileToLoad = "def_lightmap_simple_swarm.def";
#else
		FileToLoad = "def_lightmap_simple.def";
#endif
		break;

	case CANVASINIT_LIGHTMAPPED_BUMP:
#ifdef SHADER_EDITOR_DLL_SWARM
		FileToLoad = "def_lightmap_bump_swarm.def";
#else
		FileToLoad = "def_lightmap_bump.def";
#endif
		break;
	case CANVASINIT_PPEFFECT:
		pView->InitCanvas(targetType);
		break;
	}

	if ( FileToLoad )
	{
		char fPath[ MAX_PATH ];
		Q_snprintf( fPath, MAX_PATH, "%s/shadereditorui/canvas_default/%s", GetGamePath(), FileToLoad );
		pView->LoadFromFile( fPath );
	}

	OnShaderNameChanged();
	UpdateTabColor( pView );

	pView->InvalidateLayout( true, true );
	pView->ResetView_User( false );

	if ( bPushHistory )
		pView->MakeHistoryDirty();

	PageChanged();

	pView->UnDirtySave();
}