예제 #1
0
int Save_Watches()
{
	const char DELIM = '\t';
	int i;

	strncpy(Str_Tmp,Rom_Name,512);
	strcat(Str_Tmp,".wch");
	if(Change_File_S(Str_Tmp, Gens_Path, "Save Watches", "GENs Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd))
	{
		FILE *WatchFile;
		WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)Str_Tmp, -1, Str_Tmp, sizeof(Str_Tmp), NULL, NULL);
		WatchFile = fopen(Str_Tmp,"r+b");
		if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b");
		//		fputc(SegaCD_Started?'1':(_32X_Started?'2':'0'),WatchFile);
		fputc('\n',WatchFile);
		strcpy(currentWatch,Str_Tmp);
		RWAddRecentFile(currentWatch);
		sprintf(Str_Tmp,"%d\n",WatchCount);
		fputs(Str_Tmp,WatchFile);

		for (i = 0; i < WatchCount; i++)
		{
			sprintf(Str_Tmp,"%05X%c%08X%c%c%c%c%c%d%c%s\n",i,DELIM,rswatches[i].Address,DELIM,rswatches[i].Size,DELIM,rswatches[i].Type,DELIM,rswatches[i].WrongEndian,DELIM,rswatches[i].comment);
			fputs(Str_Tmp,WatchFile);
		}

		fclose(WatchFile);
		RWfileChanged=0;
		//TODO: Add to recent list function call here
		return 1;
	}
	return 0;
}
예제 #2
0
bool Save_Watches()
{
	Rom_Name = path.GetRomName();
	strncpy(Str_Tmp,Rom_Name.c_str(),512);
	strcat(Str_Tmp,".wch");
	if(Change_File_S(Str_Tmp, Gens_Path, "Save Watches", "DeSmuME Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd))
	{
		FILE *WatchFile = fopen(Str_Tmp,"r+b");
		if (!WatchFile) WatchFile = fopen(Str_Tmp,"w+b");
		fputc('\n',WatchFile);
		strcpy(currentWatch,Str_Tmp);
		RWAddRecentFile(currentWatch);
		sprintf(Str_Tmp,"%d\n",WatchCount);
		fputs(Str_Tmp,WatchFile);
		const char DELIM = '\t';
		for (int i = 0; i < WatchCount; i++)
		{
			sprintf(Str_Tmp,"%05X%c%08X%c%c%c%c%c%d%c%s\n",i,DELIM,rswatches[i].Address,DELIM,rswatches[i].Size,DELIM,rswatches[i].Type,DELIM,rswatches[i].WrongEndian,DELIM,rswatches[i].comment);
			fputs(Str_Tmp,WatchFile);
		}
		
		fclose(WatchFile);
		RWfileChanged=false;
		return true;
	}
	return false;
}
예제 #3
0
bool Save_Watches()
{
	char* slash = std::max(strrchr(Config::exefilename, '\\'), strrchr(Config::exefilename, '/'));
	strcpy(Str_Tmp_RW,slash ? slash+1 : Config::exefilename);
	char* dot = strrchr(Str_Tmp_RW, '.');
	if(dot) *dot = 0;
	strcat(Str_Tmp_RW,".wch");
	if(Change_File_S(Str_Tmp_RW, Config::thisprocessPath, "Save Watches", "Watchlist\0*.wch\0All Files\0*.*\0\0", "wch", RamWatchHWnd))
	{
		FILE *WatchFile = fopen(Str_Tmp_RW,"r+b");
		if(!WatchFile) WatchFile = fopen(Str_Tmp_RW,"w+b");
		//fputc(SegaCD_Started?'1':(_32X_Started?'2':'0'),WatchFile);
		fputc('0',WatchFile);
		fputc('\n',WatchFile);
		strcpy(currentWatch,Str_Tmp_RW);
		RWAddRecentFile(currentWatch);
		sprintf(Str_Tmp_RW,"%d\n",WatchCount);
		fputs(Str_Tmp_RW,WatchFile);
		const char DELIM = '\t';
		for (int i = 0; i < WatchCount; i++)
		{
			sprintf(Str_Tmp_RW,"%05X%c%08X%c%c%c%c%c%d%c%s\n",i,DELIM,rswatches[i].Address,DELIM,rswatches[i].Size,DELIM,rswatches[i].Type,DELIM,rswatches[i].WrongEndian,DELIM,rswatches[i].comment);
			fputs(Str_Tmp_RW,WatchFile);
		}
		
		fclose(WatchFile);
		RWfileChanged=false;
		//TODO: Add to recent list function call here
		return true;
	}
	return false;
}