summaryrefslogtreecommitdiff
path: root/plugins/gme/game-music-emu-0.6pre/gme/Nsfe_Emu.h
blob: 3edf3bd1d9deab4d8b09e8092000665dfbebd8a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Nintendo NES/Famicom NSFE music file emulator

// Game_Music_Emu 0.6-pre
#ifndef NSFE_EMU_H
#define NSFE_EMU_H

#include "blargg_common.h"
#include "Nsf_Emu.h"
class Nsfe_Emu;

// Allows reading info from NSFE file without creating emulator
class Nsfe_Info {
public:
	blargg_err_t load( Data_Reader&, Nsfe_Emu* );
	
	struct info_t : Nsf_Emu::header_t
	{
		char game      [256];
		char author    [256];
		char copyright [256];
		char dumper    [256];
	} info;
	
	void disable_playlist( bool = true );
	
	blargg_err_t track_info_( track_info_t* out, int track ) const;
	
	int remap_track( int i ) const;
	
	void unload();
	
// Implementation
public:
	Nsfe_Info();
	~Nsfe_Info();
	BLARGG_DISABLE_NOTHROW
private:
	blargg_vector<char> track_name_data;
	blargg_vector<const char*> track_names;
	blargg_vector<unsigned char> playlist;
	blargg_vector<char [4]> track_times;
	int actual_track_count_;
	bool playlist_disabled;
};

class Nsfe_Emu : public Nsf_Emu {
public:
	static gme_type_t static_type() { return gme_nsfe_type; }
	
	struct header_t { char tag [4]; };


// Implementation
public:
	Nsfe_Emu();
	~Nsfe_Emu();
	virtual void unload();

protected:
	virtual blargg_err_t load_( Data_Reader& );
	virtual blargg_err_t track_info_( track_info_t*, int track ) const;
	virtual blargg_err_t start_track_( int );
	virtual void clear_playlist_();

private:
	Nsfe_Info info;
	
	void disable_playlist_( bool b );
	friend class Nsfe_Info;
};

#endif