int print_sndlist( int argc, char **argv ) { unsigned long offset; unsigned long length; unsigned long serial; char filename[ 15 ]; string soundidxname = config.uo_datafile_root + "soundidx.mul"; string soundname = config.uo_datafile_root + "sound.mul"; ifstream soundidx( soundidxname.c_str(), ios::in | ios::binary ); ifstream sound( soundname.c_str(), ios::in | ios::binary ); int i; i = 0; while (soundidx.good()) { ++i; offset = read_ulong( soundidx ); length = read_ulong( soundidx ); serial = read_ulong( soundidx ); if (!soundidx.good()) break; if (offset == 0xFFffFFffLu) continue; sound.seekg( offset, ios::beg ); if (!sound.good()) break; sound.read( filename, sizeof filename ); cout << hex << i << ", " << hex << serial << dec << ": " << filename << endl; } return 0; }
int print_sndlist( int /*argc*/, char** /*argv*/ ) { unsigned int offset; unsigned int length; unsigned int serial; char filename[15]; std::string soundidxname = Plib::systemstate.config.uo_datafile_root + "soundidx.mul"; std::string soundname = Plib::systemstate.config.uo_datafile_root + "sound.mul"; std::ifstream soundidx(soundidxname.c_str(), std::ios::in | std::ios::binary); std::ifstream sound(soundname.c_str(), std::ios::in | std::ios::binary); int i; i = 0; while ( soundidx.good() ) { ++i; offset = read_ulong( soundidx ); length = read_ulong( soundidx ); serial = read_ulong( soundidx ); if ( !soundidx.good() ) break; if ( offset == 0xFFffFFffLu ) continue; sound.seekg(offset, std::ios::beg); if ( !sound.good() ) break; sound.read( filename, sizeof filename ); INFO_PRINT << "0x" << fmt::hexu( i ) << ", 0x" << fmt::hexu( serial ) << ": " << filename << "\n" << "len " << length << "\n"; } return 0; }