56 lines
887 B
C++
56 lines
887 B
C++
#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 |