MorphOS port (sdl version) + endian fixes for big endian machines.

svn-id: r3771
This commit is contained in:
James Brown 2002-03-16 18:58:51 +00:00
parent e91e0f7979
commit 721b7134fb
8 changed files with 96 additions and 22 deletions

View File

@ -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;

View File

@ -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<num; i++) {
_classData[i] = FROM_LE_32(_classData[i]);
}
#endif
#endif */ // ?? FIXME Remove according to Morphos diff.
break;
case MKID('RNAM'):
@ -544,17 +545,6 @@ void Scumm::loadCharset(int no) {
for (i=0; i<15; i++) {
_charsetData[no][i+1] = ptr[i+14];
}
printf("byte *font[] = {");
while(*ptr) {
line++;
printf("%d,", ptr[i]);
if (line > 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) {

View File

@ -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) */

View File

@ -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

View File

@ -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");

View File

@ -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();

View File

@ -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 <lionel.ulmer@free.fr>
* QuickTime support by Florent Boudet <flobo@ifrance.com>
* Raw output support by Michael Pearce
* MorphOS support by Ruediger Hanke
*/
#ifdef __MORPHOS__
#include <devices/timer.h>
#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");}

View File

@ -30,6 +30,17 @@
#include <string.h>
#endif
#ifdef __MORPHOS__
#include <exec/types.h>
#include <devices/amidi.h>
#define NO_PPCINLINE_STDARG
#define NO_PPCINLINE_VARARGS
#include <clib/alib_protos.h>
#include <proto/exec.h>
extern struct IOMidiRequest *ScummMidiRequest;
#endif
/* Roland to General Midi patch table. Still needs much work. */
static const byte mt32_to_gmidi[128] = {