diff --git a/scumm.h b/scumm.h index 7eaa8902b8c..e2dbfa432af 100644 --- a/scumm.h +++ b/scumm.h @@ -82,7 +82,7 @@ struct ResHdr { } GCC_PACK; #define RES_DATA(x) (((byte*)x) + sizeof(ResHdr)) -#define RES_SIZE(x) ( READ_BE_UINT32(&((ResHdr*)x)->size) ) +#define RES_SIZE(x) ( READ_BE_UINT32_UNALIGNED(&((ResHdr*)x)->size) ) struct RoomHeader { @@ -596,7 +596,7 @@ public: Scumm(); // constructor /* video buffer */ - byte _videoBuffer[328*200]; // main video buffer + byte *_videoBuffer; /* system call object */ @@ -1143,8 +1143,7 @@ public: void restoreBG(int left, int top, int right, int bottom); void redrawBGStrip(int start, int num); - void redrawBGAreas(); - void redrawLines(int from, int to); + void redrawBGAreas(); void moveCamera(); void cameraMoved(); @@ -1846,4 +1845,4 @@ byte *findResourceSmall(uint32 tag, byte *searchin); //void setShakePos(Scumm *s, int shake_pos); void setWindowName(Scumm *s); uint16 newTag2Old(uint32 oldTag); -//void cd_playtrack(int track, int offset, int delay); + diff --git a/scummvm.cpp b/scummvm.cpp index 277872ebfca..0d6385a207b 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -906,6 +906,7 @@ void Scumm::convertKeysToClicks() Actor *Scumm::derefActorSafe(int id, const char *errmsg) { if (id < 1 || id >= NUM_ACTORS) { + if (_debugMode) warning ("Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.", id, errmsg, vm.slot[_curExecScript].number, _opcode); @@ -1152,6 +1153,7 @@ void Scumm::waitForTimer(int msec_delay) { } } + _system->update_cdrom(); /* Loop CD Audio if needed */ if (_system->get_msecs() >= start_time + msec_delay) break; _system->delay_msecs(10); @@ -1216,6 +1218,7 @@ void Scumm::launch() _minHeapThreshold = 400000; /* Create a primary virtual screen */ + _videoBuffer = (byte*)malloc(328*200); allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0); initVirtScreen(0, 0, 200, false, false); @@ -1290,10 +1293,18 @@ Scumm *Scumm::createFromDetector(GameDetector *detector, OSystem *syst) syst->property(OSystem::PROP_OPEN_CD, detector->_cdrom); /* bind the mixer to the system => mixer will be invoked - * automatically when samples need to be generated */ - scumm->_mixer->bind_to_system(syst); + * automatically when samples need to be generated */ + if (!scumm->_mixer->bind_to_system(syst)) { + warning("Sound initialization failed"); + if (detector->_use_adlib) { + detector->_use_adlib = false; + detector->_midi_driver = MD_NULL; + warning("Adlib music was selected, switching to midi null driver"); + } + } scumm->_mixer->set_volume(128); + scumm->_fullScreen = detector->_fullScreen; scumm->_debugMode = detector->_debugMode; scumm->_bootParam = detector->_bootParam;