コード例 #1
0
ファイル: signal.hpp プロジェクト: Apodus/game_one
inline void chunkify1D(std::vector<int> source, size_t window, size_t jump, F&& func) {
	for (size_t startPoint = 0; startPoint + window <= source.size(); startPoint += jump) {
		loadingPrint(startPoint / jump, source.size() / jump);
		Chunk chunk;
		chunk().resize(window);
		for (size_t i = 0; i < window; ++i) {
			chunk()[i].real(float(source[startPoint + i]));
		}
		func(std::move(chunk));
	}
}
コード例 #2
0
ファイル: signal.hpp プロジェクト: Apodus/game_one
	std::vector<int> render(size_t jump) {
		if (chunks.empty())
			return {};
		std::cerr << __FUNCTION__ << std::flush;

		std::vector<int> output;
		output.resize(chunks[0]().size() + jump * (chunks.size() - 1));
		
		size_t currentSpot = 0;
		for (size_t i = 0; i < chunks.size(); ++i) {
			loadingPrint(i, chunks.size());
			renderChunk(output, chunks[i], jump, i);
		}
		std::cerr << "done (" << output.size() << " samples)" << std::endl;
		return output;
	}
コード例 #3
0
ファイル: signal.hpp プロジェクト: Apodus/game_one
	std::vector<int> render(size_t jump) {
		if (chunks.empty())
			return {};
		std::cerr << __FUNCTION__ << std::flush;

		std::vector<int> output;
		output.resize(windowSize + jump * (chunks.size() - 1));

		size_t currentSpot = 0;
		for (size_t i = 0; i < chunks.size(); ++i) {
			loadingPrint(i, chunks.size());
			Chunk chunk;
			chunk().resize(windowSize, Complex(0, 0));
			chunk()[chunks[i].first].real(chunks[i].second);
			// std::cerr << chunks[i].first << " " << chunks[i].second << std::endl;
			renderChunk(output, chunk, jump, i);
		}
		std::cerr << "done (" << output.size() << " samples)" << std::endl;
		return output;
	}
コード例 #4
0
int os9x_findhacks(int game_crc32){
	int i=0,j;
	int _crc32;	
	char c;
	char str[256];
	unsigned int size_snesadvance;
	unsigned char *snesadvance;
	FILE *f;
	
	sprintf(str,"%s/snesadvance.dat",currentWorkingDir);
	f=fopen(str,"rb");
	if (!f) return 0;
	fseek(f,0,SEEK_END);
	size_snesadvance=ftell(f);
	fseek(f,0,SEEK_SET);
	snesadvance=(unsigned char*)malloc(size_snesadvance);
	fread(snesadvance,1,size_snesadvance,f);
	fclose(f);
	
	for (;;) {
		//get crc32
		j=i;
		while ((i<size_snesadvance)&&(snesadvance[i]!='|')) i++;
		if (i==size_snesadvance) {free(snesadvance);return 0;}
		//we have (snesadvance[i]=='|')
		//convert crc32 to int
		_crc32=0;
		while (j<i) {
			c=snesadvance[j];
			if ((c>='0')&&(c<='9'))	_crc32=(_crc32<<4)|(c-'0');
			else if ((c>='A')&&(c<='F'))	_crc32=(_crc32<<4)|(c-'A'+10);
			else if ((c>='a')&&(c<='f'))	_crc32=(_crc32<<4)|(c-'a'+10);				
			j++;
		}
		if (game_crc32==_crc32) {
			char text[32];
			//gp_clearFramebuffer16(framebuffer16[currFB],0x0);
			//sprintf(text,"Loading speed hacks...");
			//gp_drawString(0,0,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
			//MenuFlip();
			loadingPrint("Loading speed hacks...");
			sleep(2);
			//int p=0;
			for (;;) {
				int adr,val;
							
				i++;
				j=i;
				while ((i<size_snesadvance)&&(snesadvance[i]!=0x0D)&&(snesadvance[i]!=',')) {
					if (snesadvance[i]=='|') j=i+1;
					i++;
				}
				if (i==size_snesadvance) {free(snesadvance);return 0;}
				memcpy(str,&snesadvance[j],i-j);
				str[i-j]=0;								
				sscanf(str,"%X=%X",&adr,&val);
				//sprintf(str,"read : %X=%X",adr,val);
				//pgPrintAllBG(32,31-p++,0xFFFF,str);
				
				if ((val==0x42)||((val&0xFF00)==0x4200)) {					
					if (val&0xFF00) {
						ROM[adr]=(val>>8)&0xFF;
						ROM[adr+1]=val&0xFF;
					} else ROM[adr]=val;
				}
				
				if (snesadvance[i]==0x0D) {free(snesadvance);return 1;				}
			}
コード例 #5
0
   void S9xLoadSDD1Data (void)
   {
    char filename [_MAX_PATH + 1];
    char index [_MAX_PATH + 1];
    char data [_MAX_PATH + 1];
    char patch [_MAX_PATH + 1];
	char text[256];
	//FILE *fs = fopen ("data.log", "w");

	Settings.SDD1Pack=TRUE;
	Memory.FreeSDD1Data ();

    //gp_clearFramebuffer16(framebuffer16[currFB],0x0);
    //sprintf(text,"Loading SDD1 pack...");
	//gp_drawString(0,0,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
	//MenuFlip();
	loadingPrint("Loading SDD1 pack...");
	strcpy (filename, romDir);

    if (strncmp (Memory.ROMName, "Star Ocean", 10) == 0)
	strcat (filename, "/socnsdd1");
    else
	strcat (filename, "/sfa2sdd1");

    DIR *dir = opendir (filename);

    index [0] = 0;
    data [0] = 0;
    patch [0] = 0;

 	//fprintf(fs,"SDD1 data: %s...\n",filename);
    if (dir)
    {
	struct dirent *d;
	
		while ((d = readdir (dir)))
		{
			//fprintf(fs,"File :%s.\n",d->d_name);
			if (strcasecmp (d->d_name, "sdd1gfx.idx") == 0)
			{
			strcpy (index, filename);
			strcat (index, "/");
			strcat (index, d->d_name);
			//fprintf(fs,"File :%s.\n",index);
			}
			else
			if (strcasecmp (d->d_name, "sdd1gfx.dat") == 0)
			{
			strcpy (data, filename);
			strcat (data, "/");
			strcat (data, d->d_name);
			//fprintf(fs,"File :%s.\n",data);
			}
			if (strcasecmp (d->d_name, "sdd1gfx.pat") == 0)
			{
			strcpy (patch, filename);
			strcat (patch, "/");
			strcat (patch, d->d_name);
			}
		}
		closedir (dir);
	
		if (strlen (index) && strlen (data))
		{
			FILE *fs = fopen (index, "rb");
			int len = 0;
	
			if (fs)
			{
			// Index is stored as a sequence of entries, each entry being
			// 12 bytes consisting of:
			// 4 byte key: (24bit address & 0xfffff * 16) | translated block
			// 4 byte ROM offset
			// 4 byte length
			fseek (fs, 0, SEEK_END);
			len = ftell (fs);
			rewind (fs);
			Memory.SDD1Index = (uint8 *) malloc (len);
			fread (Memory.SDD1Index, 1, len, fs);
			fclose (fs);
			Memory.SDD1Entries = len / 12;
	
			if (!(fs = fopen (data, "rb")))
			{
				free ((char *) Memory.SDD1Index);
				Memory.SDD1Index = NULL;
				Memory.SDD1Entries = 0;
			}
			else
			{
				fseek (fs, 0, SEEK_END);
				len = ftell (fs);
				rewind (fs);
				Memory.SDD1Data = (uint8 *) malloc (len);
				fread (Memory.SDD1Data, 1, len, fs);
				fclose (fs);
	
				if (strlen (patch) > 0 &&
				(fs = fopen (patch, "rb")))
				{
				fclose (fs);
				}
	#ifdef MSB_FIRST
				// Swap the byte order of the 32-bit value triplets on
				// MSBFirst machines.
				uint8 *ptr = Memory.SDD1Index;
				for (int i = 0; i < Memory.SDD1Entries; i++, ptr += 12)
				{
				SWAP_DWORD ((*(uint32 *) (ptr + 0)));
				SWAP_DWORD ((*(uint32 *) (ptr + 4)));
				SWAP_DWORD ((*(uint32 *) (ptr + 8)));
				}
	#endif
				qsort (Memory.SDD1Index, Memory.SDD1Entries, 12,
				   S9xCompareSDD1IndexEntries);
			}
			}
			Settings.SDD1Pack = FALSE;
			return;
		}
    }
	//fprintf(fs,"Decompressed data pack not found in '%s'\n",filename);
	//fclose(fs);
	//gp_clearFramebuffer16(framebuffer16[currFB],0x0);
	//sprintf(text,"Decompressed data pack not found!");
	//gp_drawString(0,8,strlen(text),text,0xFFFF,(unsigned char*)framebuffer16[currFB]);
	//MenuFlip();
	loadingPrint("Decompressed data pack not found!");
	loadingPrint("[Press a button to continue]");		
	MenuPause();
   }