#pragma once #ifdef EXTRACODE #include #endif #ifdef MUSICLOAD #include "defines.h" #include #include 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