Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
5,746 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
smushplay - A simple LucasArts SMUSH video player | ||
Copyright (c) 2012 by the following: | ||
|
||
Matthew Hoops (clone2727) <clone2727@gmail.com> | ||
|
||
smushplay is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 3 | ||
of the License, or (at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
Thanks To: | ||
========== | ||
|
||
ScummVM team | ||
ResidualVM team | ||
|
||
Since they provided the initial implementation of both SMUSH versions :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
smushplay 0.0.1 | ||
=============== | ||
|
||
What is it? | ||
*********** | ||
A standalone LucasArts SMUSH movie player. | ||
|
||
How do I build it? | ||
****************** | ||
1) Have SDL installed on your system | ||
2) Type 'make' | ||
3) If that doesn't work, submit a pull request that fixes it | ||
|
||
How do I use it? | ||
**************** | ||
From the command line! Just run "./smushplay <video name>" and a window should appear with the video. | ||
|
||
What videos are supported? | ||
************************** | ||
Since there are many games out there using SMUSH, not all variants are supported right now. Here are games and their statuses: | ||
|
||
* Rebel Assault | ||
Rebel Assault videos use the oldest version of SMUSH. Only a few of these videos play. No sound. | ||
* Rebel Assault II | ||
Most Rebel Assault II videos play properly, but there are some glitches. No sound. | ||
* Mortimer | ||
Some Mortimer videos work, but they are using a scaling feature that is not supported yet. No sound. | ||
* Full Throttle/The Dig | ||
The videos should play properly. No sound. | ||
* The Curse of Monkey Island/Shadows of the Empire/Grim Fandango *demo*/Outlaws | ||
The videos should play properly. Sound works. | ||
* Mysteries of the Sith | ||
The videos do not show anything. Sound works. | ||
* X-Wing Alliance/Episode I Racer/Grim Fandango *full* | ||
The videos should play properly. Sound works. | ||
* Other games | ||
Untested! Please test and report! | ||
|
||
Also note that playing "NUT" files may or may not work. They weren't meant to be played as videos. Also note that text is not displayed in videos at this time, but hopefully will in the future. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* smushplay - A simple LucasArts SMUSH video player | ||
* | ||
* smushplay is the legal property of its developers, whose names can be | ||
* found in the AUTHORS file distributed with this source | ||
* distribution. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
*/ | ||
|
||
#include <assert.h> | ||
#include "audioman.h" | ||
#include "audiostream.h" | ||
#include "rate.h" | ||
|
||
AudioManager::AudioManager() { | ||
_mutex = SDL_CreateMutex(); | ||
} | ||
|
||
AudioManager::~AudioManager() { | ||
stopAll(); | ||
SDL_CloseAudio(); | ||
SDL_DestroyMutex(_mutex); | ||
} | ||
|
||
bool AudioManager::init() { | ||
SDL_AudioSpec spec; | ||
spec.freq = 44100; | ||
spec.format = AUDIO_S16SYS; | ||
spec.channels = 2; | ||
spec.samples = 4096; | ||
spec.callback = sdlCallback; | ||
spec.userdata = this; | ||
|
||
if (SDL_OpenAudio(&spec, &_spec) != 0) | ||
return false; | ||
|
||
if (_spec.channels != 2 || _spec.format != AUDIO_S16SYS) | ||
return false; | ||
|
||
SDL_PauseAudio(0); | ||
return true; | ||
} | ||
|
||
void AudioManager::play(uint channel, AudioStream *stream) { | ||
stop(channel); | ||
|
||
Channel *chan = new Channel(); | ||
chan->stream = stream; | ||
chan->converter = makeRateConverter(stream->getRate(), _spec.freq, stream->getChannels() == 2); | ||
|
||
SDL_mutexP(_mutex); | ||
_channels[channel] = chan; | ||
SDL_mutexV(_mutex); | ||
} | ||
|
||
void AudioManager::stop(uint channel) { | ||
SDL_mutexP(_mutex); | ||
|
||
ChannelMap::iterator it = _channels.find(channel); | ||
|
||
if (it != _channels.end()) { | ||
Channel *chan = it->second; | ||
delete chan->stream; | ||
delete chan->converter; | ||
delete chan; | ||
_channels.erase(it); | ||
} | ||
|
||
SDL_mutexV(_mutex); | ||
} | ||
|
||
void AudioManager::stopAll() { | ||
SDL_mutexP(_mutex); | ||
|
||
for (ChannelMap::iterator it = _channels.begin(); it != _channels.end(); it++) { | ||
Channel *channel = it->second; | ||
delete channel->stream; | ||
delete channel->converter; | ||
delete channel; | ||
} | ||
|
||
_channels.clear(); | ||
|
||
SDL_mutexV(_mutex); | ||
} | ||
|
||
void AudioManager::sdlCallback(void *manager, byte *samples, int len) { | ||
((AudioManager *)manager)->callbackHandler(samples, len); | ||
} | ||
|
||
void AudioManager::callbackHandler(byte *samples, int len) { | ||
assert((len % 4) == 0); | ||
memset(samples, 0, len); | ||
|
||
SDL_mutexP(_mutex); | ||
|
||
for (ChannelMap::iterator it = _channels.begin(); it != _channels.end(); it++) { | ||
Channel *channel = it->second; | ||
|
||
if (channel->stream->endOfData()) { | ||
// TODO: Remove the channel? | ||
} else { | ||
channel->converter->flow(*channel->stream, (int16 *)samples, len >> 2, 255, 255); | ||
} | ||
} | ||
|
||
SDL_mutexV(_mutex); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* smushplay - A simple LucasArts SMUSH video player | ||
* | ||
* smushplay is the legal property of its developers, whose names can be | ||
* found in the AUTHORS file distributed with this source | ||
* distribution. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
*/ | ||
|
||
#ifndef AUDIOMAN_H | ||
#define AUDIOMAN_H | ||
|
||
#include <SDL.h> | ||
#include <SDL_thread.h> | ||
#include <map> | ||
#include "types.h" | ||
|
||
class AudioStream; | ||
class RateConverter; | ||
|
||
// TODO: Expand with a handle system similar to ScummVM's | ||
// Maybe eventually just replace with ScummVM's | ||
|
||
class AudioManager { | ||
public: | ||
AudioManager(); | ||
~AudioManager(); | ||
|
||
bool init(); | ||
void play(uint channel, AudioStream *stream); | ||
void stop(uint channel); | ||
void stopAll(); | ||
|
||
private: | ||
void callbackHandler(byte *samples, int len); | ||
static void sdlCallback(void *manager, byte *samples, int len); | ||
|
||
SDL_AudioSpec _spec; | ||
SDL_mutex *_mutex; | ||
|
||
struct Channel { | ||
AudioStream *stream; | ||
RateConverter *converter; | ||
}; | ||
|
||
typedef std::map<uint, Channel*> ChannelMap; | ||
ChannelMap _channels; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.