⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 map.c

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 C
字号:
/* * this code is not yet used. eventually we want to support using mmap * to map rom and sram into memory, so we don't waste virtual memory. */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <string.h>#include <errno.h>#include <sys/types.h>#include <unistd.h>#include "defs.h"#define DOTDIR ".gnuboy"static char *home, *saves;static char *romfile, *sramfile, *saveprefix;static int mmapped_rom, mmaped_sram;byte *map_rom(){	int fd, len;	byte code;	byte *mem;	fd = open(romfile, O_READ);	lseek(fd, 0x0148, SEEK_SET);	read(fd, &code, 1);	len = loader_romsize(code);	#ifdef HAVE_MMAP		mem = mmap(0, len, PROT_READ, #endif	}int map_checkdirs(){	home = malloc(strlen(getenv("HOME")) + strlen(DOTDIR) + 2);	sprintf(home, "%s/" DOTDIR, getenv(HOME));	saves = malloc(strlen(home) + 6);	sprintf(saves, "%s/saves", home);		if (access(saves, X_OK|W_OK))	{		if (access(home, X_OK|W_OK))		{			if (!access(home, F_OK))				die("cannot access %s (%s)\n", home, strerror(errno));			if (mkdir(home, 0777))				die("cannot create %s (%s)\n", home, strerror(errno));		}		if (!access(saves, F_OK))			die("cannot access %s (%s)\n", home, strerror(errno));		if (mkdir(saves, 0777))			die("cannot create %s (%s)\n", saves, strerror(errno));	}	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -