Ejemplo n.º 1
0
void writeSharedSaveFile(char* name, BYTE* data, DWORD size, bool isHardcore)
{
	char szTempName[MAX_PATH];
	char szSaveName[MAX_PATH];

	//Get temporary savefile name.
	D2FogGetSavePath( szTempName, MAX_PATH-30);
	strcat(szTempName, separateHardSoftStash && isHardcore? "_LOD_HC_" : "_LOD_");
	strcat(szTempName, sharedStashFilename);
	strcat(szTempName,".ss~");
	log_msg("Shared temporary file for saving : %s\n", szTempName);

	//Write data in savefile.
	FILE* customSaveFile = fopen(szTempName, "wb+");
	fwrite(data, size, 1, customSaveFile);
	fclose(customSaveFile);

	//Get real savefile name.
	D2FogGetSavePath( szSaveName, MAX_PATH-30);
	strcat(szSaveName, separateHardSoftStash && isHardcore? "_LOD_HC_" : "_LOD_");
	strcat(szSaveName, sharedStashFilename);
	strcat(szSaveName,".sss");
	log_msg("Shared file for saving : %s\n", szSaveName);

//	if (!MoveFileEx(szTempName, szSaveName, MOVEFILE_WRITE_THROUGH|MOVEFILE_REPLACE_EXISTING)) 
	DeleteFile(szSaveName);
	if (!MoveFile(szTempName, szSaveName))
		log_box("Could not create the shared save file.");
}
Ejemplo n.º 2
0
void writeExtendedSaveFile(char* name, BYTE* data, DWORD size)
{
	char szTempName[MAX_PATH];
	char szSaveName[MAX_PATH];

	//Get temporary savefile name.
	D2FogGetSavePath(szTempName, MAX_PATH);
	strcat(szTempName, name);
	strcat(szTempName, ".d2~");
	log_msg("Extended temporary file for saving : %s\n",szTempName);

	//Write data in savefile.
	FILE* customSaveFile = fopen(szTempName, "wb+");
	fwrite(data, size, 1, customSaveFile);
	fclose(customSaveFile);

	//Get real savefile name.
	D2FogGetSavePath(szSaveName, MAX_PATH);
	strcat(szSaveName, name);
	strcat(szSaveName, ".d2x");
	log_msg("Extended file for saving : %s\n",szSaveName);

//	if (!MoveFileEx(szTempName, szSaveName, MOVEFILE_WRITE_THROUGH|MOVEFILE_REPLACE_EXISTING)) 
	DeleteFile(szSaveName);
	if (!MoveFile(szTempName, szSaveName))
		log_box("Could not create the extended save file.");
}