コード例 #1
0
ファイル: spc.cpp プロジェクト: xomniversex/foo_gep
static void parse_id666( service_ptr_t< file > & p_file, LPID666TAG lpTag, bool aligned, abort_callback & p_abort )
{
	while ( ! p_file->is_eof( p_abort ) )
	{
		t_uint8 id, type;
		t_uint16    data;

		p_file->read_object_t( id, p_abort );
		p_file->read_object_t( type, p_abort );
		p_file->read_lendian_t( data, p_abort );

		switch ( type )
		{
		case XTYPE_STR:
			{
				if ( data < 1 || data > 256 ) throw exception_io_data();

				switch ( id )
				{
				case XID_SONG:
					p_file->read_object( lpTag->szTitle, data, p_abort );
					break;

				case XID_GAME:
					p_file->read_object( lpTag->szGame, data, p_abort );
					break;

				case XID_ARTIST:
					p_file->read_object( lpTag->szArtist, data, p_abort );
					break;

				case XID_PUB:
					p_file->read_object( lpTag->szPublisher, data, p_abort );
					break;

				case XID_OST:
					p_file->read_object( lpTag->szOST, data, p_abort );
					break;

				case XID_DUMPER:
					p_file->read_object( lpTag->szDumper, data, p_abort );
					break;

				case XID_CMNTS:
					p_file->read_object( lpTag->szComment, data, p_abort );
					break;

				default:
					p_file->skip( data, p_abort );
					break;
				}

				if ( aligned && ( data & 3 ) ) p_file->skip( 4 - ( data & 3 ), p_abort );
			}
			break;

		case XTYPE_INT:
			{
				if ( data != 4 ) throw exception_io_data();

				t_uint32 value;
				p_file->read_lendian_t( value, p_abort );

				switch ( id )
				{
				case XID_DATE:
					SetDate( lpTag->szDate, ( value >> 16 ) & 255, ( value >> 8 ) & 255, value & 255 );
					break;

				case XID_INTRO:
					if ( value > 383999999 ) value = 383999999;
					lpTag->uSong_ms = value / 64;
					break;

				case XID_LOOP:
					if ( value > 383999999 ) value = 383999999;
					lpTag->uLoop_ms = value / 64;
					break;

				case XID_END:
					if ( value > 383999999 ) value = 383999999;
					lpTag->uEnd_ms = value / 64;
					break;

				case XID_FADE:
					if ( value > 3839999 ) value = 3839999;
					lpTag->uFade_ms = value / 64;
					break;

				case XID_AMP:
					if ( value < 32768 ) value = 32768;
					else if ( value > 524288 ) value = 524288;
					lpTag->uAmplification = value;
					break;
				}
			}
			break;

		case XTYPE_DATA:
			{
				switch ( id )
				{
				case XID_EMU:
					lpTag->bEmulator = t_uint8( data );
					break;

				case XID_DISC:
					lpTag->bDisc = t_uint8( data );
					if ( lpTag->bDisc > 9 ) lpTag->bDisc = 9;
					break;

				case XID_TRACK:
					if ( data > ( ( 100 << 8 ) - 1 ) ) data = 0;
					lpTag->wTrack = data;
					break;

				case XID_COPY:
					lpTag->wCopyright = data;
					break;

				case XID_MUTE:
					lpTag->bMute = t_uint8( data );
					break;

				case XID_LOOPX:
					if ( data < 1 ) data = 1;
					else if ( data > 9 ) data = 9;
					lpTag->uLoopCount = data;
					break;

				case XID_AMP:
					lpTag->uAmplification = data;
					lpTag->uAmplification <<= 12;
					if ( lpTag->uAmplification < 32768 ) lpTag->uAmplification = 32768;
					else if ( lpTag->uAmplification > 524288 ) lpTag->uAmplification = 524288;
					break;
				}
			}
			break;
		}
	}
}
コード例 #2
0
ファイル: mp4.cpp プロジェクト: reupen/ipod_manager
	void skip (service_ptr_t<file> & p_file, abort_callback & p_abort)
	{
		p_file->skip(size - sizeof(t_uint32)*2 - (size32==1 ? sizeof(t_uint64) : 0), p_abort);
	}