port from perforce
This commit is contained in:
56
evoke-64k/trunk/ev10/music.h
Normal file
56
evoke-64k/trunk/ev10/music.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef EXTRACODE
|
||||
#include <fstream>
|
||||
#endif
|
||||
|
||||
#ifdef MUSICLOAD
|
||||
#include "defines.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
unsigned char pLoadSong[ 65536 * 8 ];
|
||||
bool loadMusic()
|
||||
{
|
||||
OFSTRUCT File;
|
||||
HFILE file= OpenFile( "song/song.v2m",
|
||||
&File, //&fileInfo,
|
||||
OF_READ );
|
||||
HANDLE handle= (HANDLE)file;
|
||||
if( handle == NULL )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DWORD dwRead;
|
||||
BOOL bRead= ReadFile( handle,
|
||||
pLoadSong,
|
||||
65536 * 8,
|
||||
&dwRead,
|
||||
NULL );
|
||||
|
||||
#ifdef CREATE_HEADER
|
||||
std::ofstream ofs( "musicdata.h" );
|
||||
|
||||
ofs << "static unsigned char pSong[]= " << "\n";
|
||||
ofs << "{\n";
|
||||
|
||||
if( dwRead > 0 )
|
||||
{
|
||||
unsigned char* pData= (unsigned char*)&(pLoadSong);
|
||||
for( int j= 0; j < (int)dwRead; ++j )
|
||||
{
|
||||
char pcSpecial[ 1024 ];
|
||||
sprintf_s( pcSpecial,
|
||||
1024,
|
||||
"\t%d,\n",
|
||||
(int)pData[ j ] );
|
||||
ofs << pcSpecial;
|
||||
}
|
||||
}
|
||||
|
||||
ofs << "};\n";
|
||||
ofs << "\n";
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user