Example #1
0
File: font.cpp Project: tkochi/xm8
//
// CheckSub()
// check one rom file
//
bool Font::CheckSub(const char *rom, bool msgbox)
{
	FILEIO fio;
	Platform *platform;
	EMU_SDL *wrapper;
	_TCHAR *path;
	Uint32 size;

	// get EMU_SDL instance
	wrapper = app->GetWrapper();

	// get path
	path = wrapper->get_bios_path((_TCHAR*)rom);

	// try to open
	if (fio.Fopen(path, FILEIO_READ_BINARY) == true) {
		// seek and get size
		fio.Fseek(0, FILEIO_SEEK_END);
		size = (Uint32)fio.Ftell();
		fio.Fseek(0, FILEIO_SEEK_SET);

		// read
		if (size <= sizeof(kanji_rom)) {
			fio.Fread(kanji_rom, 1, (uint32)size);
		}

		// open ok
		fio.Fclose();
		return true;
	}

	// msgbox
	if (msgbox == true) {
		platform = app->GetPlatform();
		sprintf(rom_message, "The ROM file is not found:\n");
		strcat(rom_message, path);
		platform->MsgBox(window, rom_message);
	}

	// not found
	return false;
}