mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 11:51:52 +00:00
SCI32: Implement Mac kSetLanguage
This commit is contained in:
parent
e7da80dddf
commit
85e27b0caf
@ -469,9 +469,14 @@ reg_t kDoAudioPanOff(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv) {
|
||||
// Used by script 90 of MUMG Deluxe from the main menu to toggle between
|
||||
// English and Spanish.
|
||||
// English and Spanish in some versions and English and Spanish and
|
||||
// French and German in others.
|
||||
const Common::String audioDirectory = s->_segMan->getString(argv[0]);
|
||||
g_sci->getResMan()->changeAudioDirectory(audioDirectory);
|
||||
if (g_sci->getPlatform() == Common::kPlatformMacintosh) {
|
||||
g_sci->getResMan()->changeMacAudioDirectory(audioDirectory);
|
||||
} else {
|
||||
g_sci->getResMan()->changeAudioDirectory(audioDirectory);
|
||||
}
|
||||
return s->r_acc;
|
||||
}
|
||||
|
||||
|
@ -1654,7 +1654,7 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
|
||||
debugC(1, kDebugLevelResMan, "Patching %s - OK", source->getLocationName().c_str());
|
||||
}
|
||||
|
||||
static ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filename) {
|
||||
ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filename) {
|
||||
// The base36 encoded resource contains the following:
|
||||
// uint16 resourceId, byte noun, byte verb, byte cond, byte seq
|
||||
|
||||
|
@ -399,6 +399,7 @@ public:
|
||||
void setAudioLanguage(int language);
|
||||
int getAudioLanguage() const;
|
||||
void changeAudioDirectory(Common::String path);
|
||||
void changeMacAudioDirectory(Common::String path);
|
||||
bool isGMTrackIncluded();
|
||||
bool isSci11Mac() const { return _volVersion == kResVersionSci11Mac; }
|
||||
ViewType getViewType() const { return _viewType; }
|
||||
@ -699,6 +700,8 @@ private:
|
||||
byte _soundPriority;
|
||||
};
|
||||
|
||||
ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filename);
|
||||
|
||||
} // End of namespace Sci
|
||||
|
||||
#endif // SCI_RESOURCE_H
|
||||
|
@ -1148,4 +1148,47 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
|
||||
scanNewSources();
|
||||
}
|
||||
|
||||
void ResourceManager::changeMacAudioDirectory(Common::String path) {
|
||||
// delete all Audio36 resources so that they can be replaced with
|
||||
// different patch files from the new directory.
|
||||
for (ResourceMap::iterator it = _resMap.begin(); it != _resMap.end(); ++it) {
|
||||
const ResourceType type = it->_key.getType();
|
||||
|
||||
if (type == kResourceTypeAudio36) {
|
||||
Resource *resource = it->_value;
|
||||
if (resource) {
|
||||
// If one of these resources ends up being locked here, it
|
||||
// probably means Audio32 is using it and we need to stop
|
||||
// playback of audio before switching directories
|
||||
assert(!resource->isLocked());
|
||||
|
||||
if (resource->_status == kResStatusEnqueued) {
|
||||
removeFromLRU(resource);
|
||||
}
|
||||
|
||||
delete resource;
|
||||
}
|
||||
|
||||
_resMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
if (path.empty()) {
|
||||
path = "english";
|
||||
}
|
||||
path = "voices/" + path + "/";
|
||||
|
||||
// add all Audio36 wave patch files from language directory
|
||||
Common::ArchiveMemberList audio36Files;
|
||||
SearchMan.listMatchingMembers(audio36Files, path + "A???????.???");
|
||||
for (Common::ArchiveMemberList::const_iterator it = audio36Files.begin(); it != audio36Files.end(); ++it) {
|
||||
const Common::ArchiveMemberPtr &file = *it;
|
||||
assert(file);
|
||||
|
||||
const Common::String fileName = file->getName();
|
||||
ResourceId resource36 = convertPatchNameBase36(kResourceTypeAudio36, fileName);
|
||||
processWavePatch(resource36, path + fileName);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Sci
|
||||
|
Loading…
Reference in New Issue
Block a user