bsnes/snesreader/libjma/jma.h
byuu 79b939e1c7 Update to bsnes v065 release.
It's been a while, so here is a new release of bsnes.
Unfortunately I don't have a full changelog this time. Most of the work went into stabilizing libsnes (which is used by the experimental .NET, Cocoa and Python UIs; as well as by Richard Bannister's OS X port).
The Windows binary package now comes with all three variants included: bsnes.exe, the standard version that casual users should run; bsnes-debugger.exe, for SNES programmers and ROM hackers only; and bsnes-accurate.exe, which should not be used by anybody, ever.
In all seriousness, bsnes-accurate.exe is bsnes with the dot-based S-PPU renderer. It's twice as slow as the normal build, and you won't really notice any differences except in Air Strike Patrol. It's there for the curious and for any SNES programmers who want to try making some really awesome video demos.
Changelog:
* OS X port builds once again; now requires gcc44 from Macports
* libsnes API finalized
* fixed a bug with S-CPU debugger breakpoints
* various source cleanup
2010-06-27 12:29:18 +00:00

88 lines
2.3 KiB
C++

/*
Copyright (C) 2005-2007 NSRT Team ( http://nsrt.edgeemu.com )
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef JMA_H
#define JMA_H
#include <string>
#include <fstream>
#include <vector>
#include <time.h>
namespace JMA
{
enum jma_errors { JMA_NO_CREATE, JMA_NO_MEM_ALLOC, JMA_NO_OPEN, JMA_BAD_FILE,
JMA_UNSUPPORTED_VERSION, JMA_COMPRESS_FAILED, JMA_DECOMPRESS_FAILED,
JMA_FILE_NOT_FOUND };
struct jma_file_info_base
{
std::string name;
std::string comment;
size_t size;
unsigned int crc32;
};
struct jma_public_file_info : jma_file_info_base
{
time_t datetime;
};
struct jma_file_info : jma_file_info_base
{
unsigned short date;
unsigned short time;
const unsigned char *buffer;
};
template<class jma_file_type>
inline size_t get_total_size(std::vector<jma_file_type>& files)
{
size_t size = 0;
for (typename std::vector<jma_file_type>::iterator i = files.begin(); i != files.end(); i++)
{
size += i->size; //We do have a problem if this wraps around
}
return(size);
}
class jma_open
{
public:
jma_open(const char *) throw(jma_errors);
~jma_open();
std::vector<jma_public_file_info> get_files_info();
std::vector<unsigned char *> get_all_files(unsigned char *) throw(jma_errors);
void extract_file(std::string& name, unsigned char *) throw(jma_errors);
bool is_solid();
private:
std::ifstream stream;
std::vector<jma_file_info> files;
size_t chunk_size;
unsigned char *decompressed_buffer;
unsigned char *compressed_buffer;
void chunk_seek(unsigned int) throw(jma_errors);
void retrieve_file_block() throw(jma_errors);
};
const char *jma_error_text(jma_errors);
}
#endif