Hotfixes ...

svn-id: r9514
This commit is contained in:
Ruediger Hanke 2003-08-05 18:18:26 +00:00
parent 7ff88ea392
commit c99f6980c7
6 changed files with 54 additions and 27 deletions

View file

@ -60,7 +60,7 @@ int MidiDriver_ETUDE::open()
if (_isOpen) if (_isOpen)
return MERR_ALREADY_OPEN; return MERR_ALREADY_OPEN;
_isOpen = true; _isOpen = true;
if (!init_morphos_music(0, ETUDEF_DIRECT)) if (!init_morphos_music(ScummMidiUnit, ETUDEF_DIRECT))
return MERR_DEVICE_NOT_AVAILABLE; return MERR_DEVICE_NOT_AVAILABLE;
return 0; return 0;

View file

@ -75,16 +75,15 @@ static CONST_STRPTR LoomNames[] = { "LoomCD", NULL };
#define BLOCKS_Y (ScummBufferHeight/BLOCKSIZE_Y) #define BLOCKS_Y (ScummBufferHeight/BLOCKSIZE_Y)
#define BLOCK_ID(x, y) ((y/BLOCKSIZE_Y)*BLOCKS_X+(x/BLOCKSIZE_X)) #define BLOCK_ID(x, y) ((y/BLOCKSIZE_Y)*BLOCKS_X+(x/BLOCKSIZE_X))
OSystem_MorphOS *OSystem_MorphOS::create(int game_id, SCALERTYPE gfx_scaler, bool full_screen) OSystem_MorphOS *OSystem_MorphOS::create(SCALERTYPE gfx_scaler, bool full_screen)
{ {
OSystem_MorphOS *syst = new OSystem_MorphOS(game_id, gfx_scaler, full_screen); OSystem_MorphOS *syst = new OSystem_MorphOS(gfx_scaler, full_screen);
return syst; return syst;
} }
OSystem_MorphOS::OSystem_MorphOS(int game_id, SCALERTYPE gfx_mode, bool full_screen) OSystem_MorphOS::OSystem_MorphOS(SCALERTYPE gfx_mode, bool full_screen)
{ {
GameID = game_id;
ScummScreen = NULL; ScummScreen = NULL;
ScummWindow = NULL; ScummWindow = NULL;
ScummBuffer = NULL; ScummBuffer = NULL;
@ -364,6 +363,9 @@ uint32 OSystem_MorphOS::property(int param, Property *value)
{ {
CONST_STRPTR *ids = NULL, *names = NULL; CONST_STRPTR *ids = NULL, *names = NULL;
if (g_scumm)
GameID = g_scumm->_gameId;
switch (GameID) switch (GameID)
{ {
case GID_MONKEY: case GID_MONKEY:
@ -467,7 +469,8 @@ void OSystem_MorphOS::play_cdrom(int track, int num_loops, int start_frame, int
void OSystem_MorphOS::stop_cdrom() void OSystem_MorphOS::stop_cdrom()
{ {
CDDA_Stop(CDrive); if (CDrive)
CDDA_Stop(CDrive);
} }
bool OSystem_MorphOS::poll_cdrom() bool OSystem_MorphOS::poll_cdrom()
@ -825,14 +828,10 @@ bool OSystem_MorphOS::poll_event(Event *event)
} }
else if (MapRawKey(&FakedIEvent, &charbuf, 1, NULL) == 1) else if (MapRawKey(&FakedIEvent, &charbuf, 1, NULL) == 1)
{ {
if (qual == KBD_CTRL) if (qual == KBD_CTRL && charbuf == 'z')
{ {
switch (charbuf) event->event_code = EVENT_QUIT;
{ break;
case 'z':
ReplyMsg((Message *) ScummMsg);
quit();
}
} }
else if (qual == KBD_ALT) else if (qual == KBD_ALT)
{ {
@ -846,8 +845,8 @@ bool OSystem_MorphOS::poll_event(Event *event)
} }
else if (charbuf == 'x') else if (charbuf == 'x')
{ {
ReplyMsg((Message *) ScummMsg); event->event_code = EVENT_QUIT;
quit(); break;
} }
else if (charbuf == 0x0d) else if (charbuf == 0x0d)
{ {
@ -933,8 +932,8 @@ bool OSystem_MorphOS::poll_event(Event *event)
} }
case IDCMP_CLOSEWINDOW: case IDCMP_CLOSEWINDOW:
ReplyMsg((Message *)ScummMsg); event->event_code = EVENT_QUIT;
exit(0); break;
} }
if (ScummMsg) if (ScummMsg)

View file

@ -37,7 +37,7 @@
class OSystem_MorphOS : public OSystem class OSystem_MorphOS : public OSystem
{ {
public: public:
OSystem_MorphOS(int game_id, SCALERTYPE gfx_mode, bool full_screen); OSystem_MorphOS(SCALERTYPE gfx_mode, bool full_screen);
virtual ~OSystem_MorphOS(); virtual ~OSystem_MorphOS();
// Set colors of the palette // Set colors of the palette
@ -124,7 +124,7 @@ class OSystem_MorphOS : public OSystem
// Quit // Quit
virtual void quit(); virtual void quit();
static OSystem_MorphOS *create(int game_id, SCALERTYPE gfx_scaler, bool full_screen); static OSystem_MorphOS *create(SCALERTYPE gfx_scaler, bool full_screen);
static bool OpenATimer(MsgPort **port, IORequest **req, ULONG unit, bool required = true); static bool OpenATimer(MsgPort **port, IORequest **req, ULONG unit, bool required = true);

View file

@ -55,9 +55,16 @@ static MsgPort *ScummMidiPort = NULL;
Device *EtudeBase = NULL; Device *EtudeBase = NULL;
bool etude_available()
{
bool avail = init_morphos_music(ScummMidiUnit, ETUDEF_DIRECT);
if (avail)
exit_morphos_music();
return avail;
}
bool init_morphos_music(ULONG MidiUnit, ULONG DevFlags) bool init_morphos_music(ULONG MidiUnit, ULONG DevFlags)
{ {
MidiUnit = ScummMidiUnit; // Ugly fix, but ...
ScummMidiPort = CreateMsgPort(); ScummMidiPort = CreateMsgPort();
if (ScummMidiPort) if (ScummMidiPort)
{ {
@ -83,10 +90,7 @@ bool init_morphos_music(ULONG MidiUnit, ULONG DevFlags)
} }
if (!ScummMidiRequest) if (!ScummMidiRequest)
{
warning("Could not open Etude - music will not play");
return false; return false;
}
return true; return true;
} }

View file

@ -32,6 +32,7 @@ class OSystem_MorphOS;
int morphos_sound_thread(OSystem_MorphOS *syst, ULONG SampleType); int morphos_sound_thread(OSystem_MorphOS *syst, ULONG SampleType);
bool init_morphos_music(ULONG MidiUnit, ULONG DevFlags); bool init_morphos_music(ULONG MidiUnit, ULONG DevFlags);
void exit_morphos_music(); void exit_morphos_music();
bool etude_available();
extern SignalSemaphore ScummMusicThreadRunning; extern SignalSemaphore ScummMusicThreadRunning;
extern SignalSemaphore ScummSoundThreadRunning; extern SignalSemaphore ScummSoundThreadRunning;

View file

@ -35,6 +35,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "scumm/scumm.h" #include "scumm/scumm.h"
#include "common/gameDetector.h"
#include "common/scaler.h" #include "common/scaler.h"
#include "sound/mididrv.h" #include "sound/mididrv.h"
#include "morphos.h" #include "morphos.h"
@ -91,32 +92,47 @@ OSystem *OSystem_MorphOS_create(int game_id, int gfx_mode, bool full_screen)
break; break;
} }
TheSystem = OSystem_MorphOS::create(game_id, gfx_scaler, full_screen); TheSystem = OSystem_MorphOS::create(gfx_scaler, full_screen);
return TheSystem; return TheSystem;
} }
void close_resources() void close_resources()
{ {
if (TheSystem) if (TheSystem)
{
delete TheSystem; delete TheSystem;
TheSystem = NULL;
if (g_engine) }
delete g_engine;
if (ScummPath) if (ScummPath)
{
FreeVec(ScummPath); FreeVec(ScummPath);
ScummPath = NULL;
}
if (ScummStory) if (ScummStory)
{
FreeVec(ScummStory); FreeVec(ScummStory);
ScummStory = NULL;
}
if (ScummArgs) if (ScummArgs)
{
FreeArgs(ScummArgs); FreeArgs(ScummArgs);
ScummArgs = NULL;
}
if (OrigDirLock) if (OrigDirLock)
{
CurrentDir(OrigDirLock); CurrentDir(OrigDirLock);
OrigDirLock = NULL;
}
if (CDDABase) if (CDDABase)
{
CloseLibrary(CDDABase); CloseLibrary(CDDABase);
CDDABase = NULL;
}
} }
static STRPTR FindMusicDriver(STRPTR argval) static STRPTR FindMusicDriver(STRPTR argval)
@ -389,6 +405,13 @@ int main()
if (args[USG_NOSUBTITLES]) argv[argc++] = "-n"; if (args[USG_NOSUBTITLES]) argv[argc++] = "-n";
if (args[USG_AMIGA]) argv[argc++] = "-a"; if (args[USG_AMIGA]) argv[argc++] = "-a";
if (args[USG_MUSIC]) argv[argc++] = ScummMusicDriver; if (args[USG_MUSIC]) argv[argc++] = ScummMusicDriver;
else
{
if (etude_available())
argv[argc++] = "-eetude";
else
argv[argc++] = "-eadlib";
}
if (ScummGfxScaler != ST_INVALID) if (ScummGfxScaler != ST_INVALID)
{ {
sprintf(scaler, "-g%s", MorphOSScaler::GetParamName(ScummGfxScaler)); sprintf(scaler, "-g%s", MorphOSScaler::GetParamName(ScummGfxScaler));