void AudioHandler::loadAudio(const std::string& audioFile, const LoadType& load) { std::ifstream fileReader; /* Purpose: Load audio assets into memory, and then save them as either sound or music based on if it was called by loadSound() or loadMusic(). */ Logger::writeMsg(1) << "\nLoading assets from: \"" << audioFile << "\"..."; //Open specified file fileReader.open(audioFile.c_str()); if(!fileReader) { //Debug output Logger::writeMsg(1) << "The audio handler was unable to open the specified asset file"; return; } //Saving vars std::string output; std::string audioKey; std::string audioPath; //Loop until end of file while(!fileReader.eof()) { //Read line getline(fileReader,output); //Check if line is empty and perform string operation if(strReadLine(output, audioKey, audioPath)) { //Load into memory as sound or music if(load == Sound) saveSound(audioKey, audioPath); else saveMusic(audioKey, audioPath); } } //Debug output Logger::writeMsg(1) << "Finished loading audio from \"" << audioFile << "\""; //Close file fileReader.close(); }
void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) { Common::OutSaveFile *f; byte *state; char buf[4]; RMPoint tp = _tony.position(); // Saving: MPAL variables, current location, and Tony inventory position // For now, we only save the MPAL state uint size = mpalGetSaveStateSize(); state = new byte[size]; mpalSaveState(state); uint thumbsize = 160 * 120 * 2; buf[0] = 'R'; buf[1] = 'M'; buf[2] = 'S'; buf[3] = TONY_SAVEGAME_VERSION; f = g_system->getSavefileManager()->openForSaving(fn); if (f == NULL) return; f->write(buf, 4); f->writeUint32LE(thumbsize); f->write(curThumb, thumbsize); // Difficulty level int i = mpalQueryGlobalVar("VERSIONEFACILE"); f->writeByte(i); i = strlen(name.c_str()); f->writeByte(i); f->write(name.c_str(), i); f->writeUint32LE(_nCurLoc); f->writeUint32LE(tp._x); f->writeUint32LE(tp._y); f->writeUint32LE(size); f->write(state, size); delete[] state; // Inventory size = _inv.getSaveStateSize(); state = new byte[size]; _inv.saveState(state); f->writeUint32LE(size); f->write(state, size); delete[] state; // boxes size = g_vm->_theBoxes.getSaveStateSize(); state = new byte[size]; g_vm->_theBoxes.saveState(state); f->writeUint32LE(size); f->write(state, size); delete[] state; // New Ver5 // Saves the state of the shepherdess and show yourself bool bStat = _tony.getShepherdess(); f->writeByte(bStat); bStat = _inter.getPerorate(); f->writeByte(bStat); // Save the chars charsSaveAll(f); // Save the options f->writeByte(GLOBALS._bCfgInvLocked); f->writeByte(GLOBALS._bCfgInvNoScroll); f->writeByte(GLOBALS._bCfgTimerizedText); f->writeByte(GLOBALS._bCfgInvUp); f->writeByte(GLOBALS._bCfgAnni30); f->writeByte(GLOBALS._bCfgAntiAlias); f->writeByte(GLOBALS._bShowSubtitles); f->writeByte(GLOBALS._bCfgTransparence); f->writeByte(GLOBALS._bCfgInterTips); f->writeByte(GLOBALS._bCfgDubbing); f->writeByte(GLOBALS._bCfgMusic); f->writeByte(GLOBALS._bCfgSFX); f->writeByte(GLOBALS._nCfgTonySpeed); f->writeByte(GLOBALS._nCfgTextSpeed); f->writeByte(GLOBALS._nCfgDubbingVolume); f->writeByte(GLOBALS._nCfgMusicVolume); f->writeByte(GLOBALS._nCfgSFXVolume); // Save the hotspots saveChangedHotspot(f); // Save the music saveMusic(f); f->finalize(); delete f; }