Ticket #8895: atari-mint-scummvm-07072008.patch

File atari-mint-scummvm-07072008.patch, 10.1 KB (added by SF/keithscr, 12 years ago)

Atari patches from an svn diff

  • configure

     
    10651065                ;;
    10661066        mint*)
    10671067                DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
    1068                 LIBS="$LIBS -lsocket"
    10691068                ;;
    10701069        amigaos*)
    10711070                # TODO: anything to be added here?
  • sound/mididrv.h

     
    5151        // Windows
    5252        MD_WINDOWS,
    5353
     54        // Atari ST
     55        MD_STMIDI,
     56
    5457        // Linux
    5558        MD_ALSA,
    5659        MD_SEQ,
     
    271274extern MidiDriver *MidiDriver_NULL_create(Audio::Mixer *mixer);
    272275extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
    273276extern MidiDriver *MidiDriver_WIN_create(Audio::Mixer *mixer);
     277extern MidiDriver *MidiDriver_STMIDI_create(Audio::Mixer *mixer);
    274278extern MidiDriver *MidiDriver_SEQ_create(Audio::Mixer *mixer);
    275279extern MidiDriver *MidiDriver_TIMIDITY_create(Audio::Mixer *mixer);
    276280extern MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer);
  • sound/mididrv.cpp

     
    4646        {"alsa", "ALSA", MD_ALSA, MDT_MIDI},
    4747#endif
    4848
    49 #if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__)
     49#if defined(__MINT__)
     50       {"stmidi", "Atari ST MIDI", MD_STMIDI, MDT_MIDI},
     51#endif
     52
     53#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__) && !defined(__MINT__)
    5054        {"seq", "SEQ", MD_SEQ, MDT_MIDI},
    5155#endif
    5256
     
    247251#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
    248252        case MD_WINDOWS:   return MidiDriver_WIN_create(g_system->getMixer());
    249253#endif
    250 #if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__)
     254#if defined(__MINT__)
     255       case MD_STMIDI:    return MidiDriver_STMIDI_create(g_system->getMixer());
     256#endif
     257#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOSX) && !defined(__MAEMO__) && !defined(__MINT__)
    251258        case MD_SEQ:       return MidiDriver_SEQ_create(g_system->getMixer());
    252259#endif
    253260#if defined(UNIX)
  • backends/midi/seq.cpp

     
    2828 *    both the QuickTime support and (vkeybd http://www.alsa-project.org/~iwai/alsa.html)
    2929 */
    3030
    31 #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
     31#if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__)
    3232
    3333#include "common/util.h"
    3434#include "sound/musicplugin.h"
  • backends/midi/stmidi.cpp

     
     1/* ScummVM - Scumm Interpreter
     2 * Copyright (C) 2001  Ludvig Strigeus
     3 * Copyright (C) 2001-2006 The ScummVM project
     4 *
     5 * This program is free software; you can redistribute it and/or
     6 * modify it under the terms of the GNU General Public License
     7 * as published by the Free Software Foundation; either version 2
     8 * of the License, or (at your option) any later version.
     9 *
     10 * This program is distributed in the hope that it will be useful,
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 * GNU General Public License for more details.
     14 *
     15 * You should have received a copy of the GNU General Public License
     16 * along with this program; if not, write to the Free Software
     17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     18 */
     19
     20/* 
     21 * Raw MIDI output for the Atari ST line of computers.
     22 * Based on the ScummVM SEQ & CoreMIDI drivers. 
     23 * Atari code by Keith Scroggins
     24 * We, unfortunately, could not use the SEQ driver because the /dev/midi under
     25 * FreeMiNT (and hence in libc) is considered to be a serial port for machine
     26 * access.  So, we just use OS calls then to send the data to the MIDI ports
     27 * directly.  The current implementation is sending 1 byte at a time because
     28 * in most cases we are only sending up to 3 bytes, I believe this saves a few
     29 * cycles.  I might change so sysex messages are sent the other way later.
     30 */
     31
     32#if defined __MINT__
     33
     34#include <osbind.h>
     35#include "sound/mpu401.h"
     36#include "common/util.h"
     37#include "sound/musicplugin.h"
     38
     39class MidiDriver_STMIDI : public MidiDriver_MPU401 {
     40public:
     41        MidiDriver_STMIDI() : _isOpen (false) { }
     42        int open();
     43        void close();
     44        void send(uint32 b);
     45        void sysEx(const byte *msg, uint16 length);
     46
     47private:
     48        bool _isOpen;
     49};
     50
     51int MidiDriver_STMIDI::open() {
     52        if ((_isOpen) && (!Bcostat(4)))
     53                return MERR_ALREADY_OPEN;
     54        warning("ST Midi Port Open");
     55        _isOpen = true;
     56        return 0;
     57}
     58
     59void MidiDriver_STMIDI::close() {
     60        MidiDriver_MPU401::close();
     61        _isOpen = false;
     62}
     63
     64void MidiDriver_STMIDI::send(uint32 b) {
     65
     66        byte status_byte = (b & 0x000000FF);
     67        byte first_byte = (b & 0x0000FF00) >> 8;
     68        byte second_byte = (b & 0x00FF0000) >> 16;
     69
     70//      warning("ST MIDI Packet sent");
     71
     72        switch (b & 0xF0) {
     73        case 0x80:      // Note Off
     74        case 0x90:      // Note On
     75        case 0xA0:      // Polyphonic Key Pressure
     76        case 0xB0:      // Controller
     77        case 0xE0:      // Pitch Bend
     78                Bconout(3, status_byte);
     79                Bconout(3, first_byte);
     80                Bconout(3, second_byte);
     81                break;
     82        case 0xC0:      // Program Change
     83        case 0xD0:      // Aftertouch
     84                Bconout(3, status_byte);
     85                Bconout(3, first_byte);
     86                break;
     87        default:
     88                fprintf(stderr, "Unknown : %08x\n", (int)b);
     89                break;
     90        }
     91}
     92
     93void MidiDriver_STMIDI::sysEx (const byte *msg, uint16 length) {
     94        if (length > 254) {
     95                warning ("Cannot send SysEx block - data too large");
     96                return;
     97        }
     98
     99        const byte *chr = msg;
     100        warning("Sending SysEx Message");
     101
     102        Bconout(3, '0xF0');
     103        for (; length; --length, ++chr) {
     104                Bconout(3,((unsigned char) *chr & 0x7F));
     105        }
     106        Bconout(3, '0xF7');
     107}
     108
     109// Plugin interface
     110
     111class StMidiMusicPlugin : public MusicPluginObject {
     112public:
     113        const char *getName() const {
     114                return "STMIDI";
     115        }
     116
     117        const char *getId() const {
     118                return "stmidi";
     119        }
     120
     121        MusicDevices getDevices() const;
     122        PluginError createInstance(Audio::Mixer *mixer, MidiDriver **mididriver)
     123 const;
     124};
     125
     126MusicDevices StMidiMusicPlugin::getDevices() const {
     127        MusicDevices devices;
     128        // TODO: Return a different music type depending on the configuration
     129        // TODO: List the available devices
     130        devices.push_back(MusicDevice(this, "", MT_GM));
     131        return devices;
     132}
     133
     134PluginError StMidiMusicPlugin::createInstance(Audio::Mixer *mixer, MidiDriver **mididriver) const {
     135        *mididriver = new MidiDriver_STMIDI();
     136
     137        return kNoError;
     138}
     139
     140MidiDriver *MidiDriver_STMIDI_create(Audio::Mixer *mixer) {
     141        MidiDriver *mididriver;
     142
     143        StMidiMusicPlugin p;
     144        p.createInstance(mixer, &mididriver);
     145
     146        return mididriver;
     147}
     148
     149//#if PLUGIN_ENABLED_DYNAMIC(STMIDI)
     150        //REGISTER_PLUGIN_DYNAMIC(STMIDI, PLUGIN_TYPE_MUSIC, StMidiMusicPlugin);
     151//#else
     152        REGISTER_PLUGIN_STATIC(STMIDI, PLUGIN_TYPE_MUSIC, StMidiMusicPlugin);
     153//#endif
     154
     155#endif
  • backends/platform/sdl/graphics.cpp

     
    3030#include "graphics/scaler.h"
    3131#include "graphics/surface.h"
    3232
     33#ifdef __MINT__
     34#include "backends/timer/default/default-timer.h"
     35#endif
     36
    3337static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
    3438        {"1x", "Normal (no scaling)", GFX_NORMAL},
    3539        {"2x", "2x", GFX_DOUBLESIZE},
     
    511515
    512516        Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
    513517
     518#ifdef __MINT__
     519        if (_timer != NULL)
     520                ((DefaultTimerManager *)_timer)->handler();
     521#endif
     522
    514523        internUpdateScreen();
    515524}
    516525
  • backends/platform/sdl/sdl.cpp

     
    210210}
    211211
    212212void OSystem_SDL::delayMillis(uint msecs) {
     213#ifdef __MINT__
     214        int tw = getMillis();
     215        if (_timer != NULL) {
     216                ((DefaultTimerManager *)_timer)->handler();
     217                while (tw + msecs >= getMillis()) {
     218                        ((DefaultTimerManager *)_timer)->handler();
     219                }
     220        }
     221#endif
    213222        SDL_Delay(msecs);
    214223}
    215224
  • backends/platform/sdl/events.cpp

     
    2727#include "common/util.h"
    2828#include "common/events.h"
    2929
     30#ifdef __MINT__
     31#include "backends/timer/default/default-timer.h"
     32#endif
     33
    3034// FIXME move joystick defines out and replace with confile file options
    3135// we should really allow users to map any key to a joystick button
    3236#define JOY_DEADZONE 3200
     
    177181        int axis;
    178182        byte b = 0;
    179183
     184#ifdef __MINT__
     185        if (_timer != NULL)
     186                ((DefaultTimerManager *)_timer)->handler();
     187#endif
     188
    180189        handleKbdMouse();
    181190
    182191        // If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
  • backends/module.mk

     
    1717        midi/coremidi.o \
    1818        midi/quicktime.o \
    1919        midi/seq.o \
     20        midi/stmidi.o \
    2021        midi/timidity.o \
    2122        midi/dmedia.o \
    2223        midi/windows.o \
  • base/plugins.cpp

     
    154154                #if defined(UNIX) && defined(USE_ALSA)
    155155                LINK_PLUGIN(ALSA)
    156156                #endif
    157                 #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__)
     157                #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__)
    158158                LINK_PLUGIN(SEQ)
    159159                #endif
     160                #if defined(__MINT__)
     161                LINK_PLUGIN(STMIDI)
     162                #endif
    160163                #if defined(IRIX)
    161164                LINK_PLUGIN(DMEDIA)
    162165                #endif