コード例 #1
0
ファイル: main.c プロジェクト: suloku/dolaunch
int main(int argc, char *argv[])
{
	//does more than it should
	VIDEO_Init();

	int have_sd = initFAT();
	if (have_sd){
		FILE *fp = fopen("fat:/autoexec.dol", "rb");
		if (fp) {
			fseek(fp, 0, SEEK_END);
			int size = ftell(fp);
			fseek(fp, 0, SEEK_SET);
			if ((size > 0) && (size < (AR_GetSize() - (64*1024)))) {
				u8 *dol = (u8*) memalign(32, size);
				if (dol) {
					fread(dol, 1, size, fp);
						DOLtoARAM(dol, 0, NULL);
				}
				//We shouldn't reach this point
				if (dol != NULL) free(dol);
			}
			fclose(fp);
		}
			
	}
	return 0;
}
コード例 #2
0
ファイル: main.c プロジェクト: KirovAir/swiss-gc
void load_auto_dol() {
	sprintf(txtbuffer, "%sboot.dol", deviceHandler_initial->name);
	FILE *fp = fopen(txtbuffer, "rb");
	if (fp) {
		fseek(fp, 0, SEEK_END);
		int size = ftell(fp);
		fseek(fp, 0, SEEK_SET);
		if ((size > 0) && (size < (AR_GetSize() - (64*1024)))) {
			u8 *dol = (u8*) memalign(32, size);
			if (dol) {
				fread(dol, 1, size, fp);
				if (!memmem(dol, size, GITREVISION, sizeof(GITREVISION))) {
					DOLtoARAM(dol, 0, NULL);
				}
			}
		}
		fclose(fp);
	}
}