diff --git a/object.cpp b/object.cpp index e2d19386e47..da1ed47ed39 100644 --- a/object.cpp +++ b/object.cpp @@ -565,11 +565,11 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) { od->parentstate = cdhd->v7.parentstate; imhd = (ImageHeader*)findResourceData(MKID('IMHD'), room + od->offs_obim_to_room); - od->x_pos = imhd->v7.x_pos; - od->y_pos = imhd->v7.y_pos; - od->width = imhd->v7.width; - od->height = imhd->v7.height; - od->actordir = imhd->v7.actordir; + od->x_pos = READ_LE_UINT16(&imhd->v7.x_pos); + od->y_pos = READ_LE_UINT16(&imhd->v7.y_pos); + od->width = READ_LE_UINT16(&imhd->v7.width); + od->height = READ_LE_UINT16(&imhd->v7.height); + od->actordir = READ_LE_UINT16(&imhd->v7.actordir); } od->fl_object_index = 0; diff --git a/resource.cpp b/resource.cpp index 8899e4ddb1f..26e13ab14e2 100644 --- a/resource.cpp +++ b/resource.cpp @@ -272,11 +272,12 @@ void Scumm::readIndexFile() { } fileRead(_fileHandle, _classData, num * sizeof(uint32)); -#if defined(SCUMM_BIG_ENDIAN) +/* #if defined(SCUMM_BIG_ENDIAN) for (i=0; i 80) { - printf("\n"); - line = 0; - } - ptr++; - } - printf("};\n"); } void Scumm::nukeCharset(int i) { @@ -669,7 +659,7 @@ int Scumm::readSoundResource(int type, int idx) { pos = 0; - basetag = fileReadDwordLE(); + basetag = fileReadDword(); total_size = fileReadDwordBE(); if (_gameId==GID_SAMNMAX || _features & GF_AFTER_V7) { diff --git a/scumm.h b/scumm.h index 200836ea592..d492f3889c9 100644 --- a/scumm.h +++ b/scumm.h @@ -59,7 +59,8 @@ enum { MIDI_WINDOWS = 1, MIDI_TIMIDITY = 2, MIDI_SEQ = 3, - MIDI_QTMUSIC = 4, + MIDI_QTMUSIC = 4, + MIDI_AMIDI = 5 }; /* Script status type (slot.status) */ diff --git a/scummsys.h b/scummsys.h index 6a4b5f9ef19..1a2c57ee512 100644 --- a/scummsys.h +++ b/scummsys.h @@ -166,7 +166,36 @@ typedef signed long int32; #define GCC_PACK #define NORETURN #define NEED_STRDUP +#elif defined(__MORPHOS__) +#define scumm_stricmp stricmp +#define CHECK_HEAP +#define SCUMM_BIG_ENDIAN +#define SCUMM_NEED_ALIGNMENT + +#define FORCEINLINE inline +#define CDECL + +typedef unsigned char byte; +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned long uint32; +typedef unsigned int uint; +typedef signed char int8; +typedef signed short int16; +typedef signed long int32; + +#if defined(__GNUC__) + #define START_PACK_STRUCTS + #define END_PACK_STRUCTS + #define GCC_PACK __attribute__((packed)) + #define NORETURN __attribute__((__noreturn__)) +#else + #define START_PACK_STRUCTS pack (1) + #define END_PACK_STRUCTS pack () + #define GCC_PACK + #define NORETURN +#endif #elif defined(__DC__) #define scumm_stricmp strcasecmp diff --git a/scummvm.cpp b/scummvm.cpp index dba8f43318a..4eac3ab7b76 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -210,12 +210,21 @@ void Scumm::scummMain(int argc, char **argv) { _midi_driver = MIDI_NULL; #endif parseCommandLine(argc, argv); + + #ifdef __MORPHOS__ + // I need to know the game name in initGraphics() + if (!detectGame()) { + warning("Game detection failed. Using default settings"); + _features = GF_DEFAULT; + } + #endif /* Init graphics and create a primary virtual screen */ initGraphics(this, _fullScreen, _scale); allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0); initVirtScreen(0, 0, 200, false, false); + #ifndef __MORPHOS__ if (_exe_name==NULL) //error("Specify the name of the game to start on the command line"); launcherLoop(); @@ -224,6 +233,7 @@ void Scumm::scummMain(int argc, char **argv) { warning("Game detection failed. Using default settings"); _features = GF_DEFAULT; } +#endif if (!_gameDataPath) { warning("No path was provided. Assuming that data file are in the current directory"); diff --git a/sound.h b/sound.h index ee47e64a31d..9bd9d702dfc 100644 --- a/sound.h +++ b/sound.h @@ -17,6 +17,9 @@ * * Change Log: * $Log$ + * Revision 1.8 2002/03/16 18:58:51 ender + * MorphOS port (sdl version) + endian fixes for big endian machines. + * * Revision 1.7 2002/03/14 08:20:38 ender * Fix compile error when using USE_ADLIB * @@ -428,6 +431,7 @@ struct MidiDriver { void MidiOutSeq(void *a, int b); void MidiOutWindows(void *a, int b); void MidiOutQuicktime(void *a, int b); + void MidiOutMorphOS(void *a, int b); int connect_to_timidity(int port); int open_sequencer_device(); diff --git a/sound/gmidi.cpp b/sound/gmidi.cpp index 02efadfde9a..397a457fb29 100644 --- a/sound/gmidi.cpp +++ b/sound/gmidi.cpp @@ -1,4 +1,4 @@ -/* ScummVM - Scumm Interpreter + /* ScummVM - Scumm Interpreter * Copyright (C) 2001 The ScummVM project * * This program is free software; you can redistribute it and/or @@ -22,8 +22,13 @@ * Timidity support by Lionel Ulmer * QuickTime support by Florent Boudet * Raw output support by Michael Pearce + * MorphOS support by Ruediger Hanke */ +#ifdef __MORPHOS__ +#include +#endif + #include "stdafx.h" #include "scumm.h" @@ -53,6 +58,8 @@ void MidiDriver::midiInit() { case MIDI_QTMUSIC: midiInitQuicktime(); break; + case MIDI_AMIDI: + break; default: DeviceType = 0; midiInitNull(); @@ -82,6 +89,9 @@ void MidiDriver::MidiOut(int b) { case MIDI_QTMUSIC: MidiOutQuicktime(_mo, b); break; + case MIDI_AMIDI: + MidiOutMorphOS(_mo, b); + break; default: error("Invalid midi device type "); break; @@ -136,7 +146,7 @@ int MidiDriver::open_sequencer_device() { /*********** Timidity */ int MidiDriver::connect_to_timidity(int port) { int s = 0; -#if !defined(__APPLE__CW) // No socket support on Apple Carbon +#if !defined(__APPLE__CW) && !defined(__MORPHOS__) // No socket support on Apple Carbon or Morphos struct hostent *serverhost; struct sockaddr_in sadd; @@ -338,6 +348,25 @@ void MidiDriver::MidiOutQuicktime(void *a, int b) { #endif } +/*********** MorphOS */ +void MidiDriver::MidiOutMorphOS(void *a, int b) { +#ifdef __MORPHOS__ + if( ScummMidiRequest ) { + ULONG midi_data = b; // you never know about an int's size ;-) + ScummMidiRequest->amr_Std.io_Command = CMD_WRITE; + ScummMidiRequest->amr_Std.io_Data = &midi_data; + ScummMidiRequest->amr_Std.io_Length = 4; + DoIO( (struct IORequest *)ScummMidiRequest ); + } +#endif +} + + + + + + + void MidiDriver::midiInitNull() {warning("Music not enabled - MIDI support selected with no MIDI driver available. Try Adlib");} diff --git a/sound/gmidi.h b/sound/gmidi.h index e4452946a61..85ec70bfbaf 100644 --- a/sound/gmidi.h +++ b/sound/gmidi.h @@ -30,6 +30,17 @@ #include #endif +#ifdef __MORPHOS__ + #include + #include + + #define NO_PPCINLINE_STDARG + #define NO_PPCINLINE_VARARGS + #include + #include + + extern struct IOMidiRequest *ScummMidiRequest; +#endif /* Roland to General Midi patch table. Still needs much work. */ static const byte mt32_to_gmidi[128] = {