or_error or_rawfile_get_rawdata(ORRawFileRef rawfile, ORRawDataRef rawdata, uint32_t options) { RawFile *prawfile = reinterpret_cast<RawFile *>(rawfile); CHECK_PTR(rawfile, OR_ERROR_NOTAREF); return prawfile->getRawData(*reinterpret_cast<RawData *>(rawdata), options); }
or_error or_rawfile_get_colourmatrix2(ORRawFileRef rawfile, double *matrix, uint32_t *size) { RawFile *prawfile = reinterpret_cast<RawFile *>(rawfile); CHECK_PTR(rawfile, OR_ERROR_NOTAREF); CHECK_PTR(size, OR_ERROR_INVALID_PARAM); return prawfile->getColourMatrix2(matrix, *size); }
or_error or_rawfile_get_thumbnail(ORRawFileRef rawfile, uint32_t _preferred_size, ORThumbnailRef thumb) { CHECK_PTR(rawfile, OR_ERROR_NOTAREF); RawFile *prawfile = reinterpret_cast<RawFile *>(rawfile); return prawfile->getThumbnail(_preferred_size, *reinterpret_cast<Thumbnail *>(thumb)); }
or_error or_rawfile_get_rendered_image(ORRawFileRef rawfile, ORBitmapDataRef bitmapdata, uint32_t options) { RawFile *prawfile = reinterpret_cast<RawFile *>(rawfile); CHECK_PTR(rawfile, OR_ERROR_NOTAREF); return prawfile->getRenderedImage( *reinterpret_cast<BitmapData *>(bitmapdata), options); }
// opens up a file from the filesystem and scans it for known formats bool VGMRoot::OpenRawFile(const wstring& filename) { RawFile* newRawFile = new RawFile(filename); if (!newRawFile->open(filename)) { delete newRawFile; return false; } //if the file was set up properly, apply loaders, scan it, and add it to our list if it contains vgmfiles return SetupNewRawFile(newRawFile); }
const wchar_t *NDS2SFLoader::load_psf_libs(PSFFile &psf, RawFile *file, unsigned char *&exebuffer, size_t &exebuffersize) { char libTagName[16]; int libIndex = 1; while (true) { if (libIndex == 1) strcpy(libTagName, "_lib"); else sprintf(libTagName, "_lib%d", libIndex); map<string, string>::iterator itLibTag = psf.tags.find(libTagName); if (itLibTag == psf.tags.end()) break; wchar_t tempfn[PATH_MAX] = {0}; mbstowcs(tempfn, itLibTag->second.c_str(), itLibTag->second.size()); wchar_t *fullPath; fullPath = GetFileWithBase(file->GetFullPath(), tempfn); // TODO: Make sure to limit recursion to avoid crashing. RawFile *newRawFile = new RawFile(fullPath); const wchar_t *psflibError = NULL; if (newRawFile->open(fullPath)) psflibError = psf_read_exe(newRawFile, exebuffer, exebuffersize); else psflibError = L"Unable to open lib file."; delete fullPath; delete newRawFile; if (psflibError != NULL) return psflibError; libIndex++; } return NULL; }
or_rawfile_type or_rawfile_get_type(ORRawFileRef rawfile) { CHECK_PTR(rawfile, OR_RAWFILE_TYPE_UNKNOWN); RawFile *prawfile = reinterpret_cast<RawFile *>(rawfile); return prawfile->type(); }
int32_t or_rawfile_get_orientation(ORRawFileRef rawfile) { RawFile *prawfile = reinterpret_cast<RawFile *>(rawfile); CHECK_PTR(rawfile, 0); return prawfile->getOrientation(); }