Esempio n. 1
0
int main(int argc, char **argv)
{
	int ret;
	DPFHANDLE h;

	int i = 2;

	if (argc < 2 || argc > 3) {
		fprintf(stderr, "Usage:\n"
				"%s <generic scsi dev> <.ihx file>\n"
		        "or in USB mode:\n"
		        "%s <.ihx file>\n",
		argv[0], argv[0]);
		return -1;
	}

	if (argc == 2) {
		ret = dpf_open(NULL, &h);
		i--;
	} else
	if (argc == 3) {
		ret = dpf_open(argv[1], &h);
	}

	if (ret < 0) {
		perror("opening DPF device:");
		return ret;
	}

// 	This patches a module to init the relocated jump table on a certain
// 	menu action:
// 	ret = patch_sector(h, 0x1330, 0x4af7a, "hack2.ihx");


// 	patch_sector(h,          0x0,    0x100000, "jumptbl.ihx");

	if (0) {
		patch_sector(h,          0x0,    0x100000, "jumptbl.ihx");
		ret = patch_sector(h,       0x1330,    0x110000, "hack.ihx");
		ret = patch_sector(h, 0x132a,    0x120000, "main.ihx");
		if (ret < 0) printf("Failed.\n");
	} else {
	 // demo0(h);

	}
	ret = write_mem(h, argv[i]);
	code_go(h, 0x18a0);
	if (ret < 0) printf("Failed.\n");

	// unsigned char buf[256];
	// ret = read_mem(h, buf, 0x18a0, 64);
	// memory_dump(buf, 64);

	dpf_close(h);
	return ret;
}
Esempio n. 2
0
void dpf_exit (void) {
	dpf_close(h);
}