[Scummvm-cvs-logs] SF.net SVN: scummvm: [24455] scummvm/trunk/backends/platform/dc
marcus_c at users.sourceforge.net
marcus_c at users.sourceforge.net
Sun Oct 22 20:36:01 CEST 2006
Revision: 24455
http://svn.sourceforge.net/scummvm/?rev=24455&view=rev
Author: marcus_c
Date: 2006-10-22 11:35:49 -0700 (Sun, 22 Oct 2006)
Log Message:
-----------
Removed timerproc and soundproc.
Modified Paths:
--------------
scummvm/trunk/backends/platform/dc/audio.cpp
scummvm/trunk/backends/platform/dc/dc.h
scummvm/trunk/backends/platform/dc/dcmain.cpp
scummvm/trunk/backends/platform/dc/input.cpp
scummvm/trunk/backends/platform/dc/time.cpp
Modified: scummvm/trunk/backends/platform/dc/audio.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/audio.cpp 2006-10-22 18:13:02 UTC (rev 24454)
+++ scummvm/trunk/backends/platform/dc/audio.cpp 2006-10-22 18:35:49 UTC (rev 24455)
@@ -24,6 +24,7 @@
#include <common/stdafx.h>
#include <common/scummsys.h>
#include "engines/engine.h"
+#include "sound/mixer.h"
#include "dc.h"
EXTERN_C void *memcpy4s(void *s1, const void *s2, unsigned int n);
@@ -36,28 +37,12 @@
do_sound_command(CMD_SET_BUFFER(SOUND_BUFFER_SHIFT));
}
-bool OSystem_Dreamcast::setSoundCallback(SoundProc proc, void *param)
-{
- assert(SAMPLE_MODE == 0);
-
- _sound_proc_param = param;
- _sound_proc = proc;
-
- return true;
-}
-
-void OSystem_Dreamcast::clearSoundCallback()
-{
- _sound_proc = NULL;
- _sound_proc_param = NULL;
-}
-
void OSystem_Dreamcast::checkSound()
{
int n;
int curr_ring_buffer_samples;
- if(!_sound_proc)
+ if(!_mixer)
return;
if(read_sound_int(&SOUNDSTATUS->mode) != MODE_PLAY)
@@ -75,8 +60,8 @@
if(n<100)
return;
- _sound_proc(_sound_proc_param, (byte*)temp_sound_buffer,
- 2*SAMPLES_TO_BYTES(n));
+ Audio::Mixer::mixCallback(_mixer, (byte*)temp_sound_buffer,
+ 2*SAMPLES_TO_BYTES(n));
if(fillpos+n > curr_ring_buffer_samples) {
int r = curr_ring_buffer_samples - fillpos;
Modified: scummvm/trunk/backends/platform/dc/dc.h
===================================================================
--- scummvm/trunk/backends/platform/dc/dc.h 2006-10-22 18:13:02 UTC (rev 24454)
+++ scummvm/trunk/backends/platform/dc/dc.h 2006-10-22 18:35:49 UTC (rev 24455)
@@ -23,6 +23,7 @@
#include <common/system.h>
#include <ronin/soundcommon.h>
+#include "backends/timer/default/default-timer.h"
#define NUM_BUFFERS 4
#define SOUND_BUFFER_SHIFT 3
@@ -38,19 +39,6 @@
class OSystem_Dreamcast : public OSystem {
- private:
-
- // Set function that generates samples
- typedef void (*SoundProc)(void *param, byte *buf, int len);
- bool setSoundCallback(SoundProc proc, void *param);
- void clearSoundCallback();
-
- // Add a callback timer
- typedef int (*TimerProc)(int interval);
- void setTimerCallback(TimerProc callback, int timer);
-
- Common::SaveFileManager *createSavefileManager();
-
public:
OSystem_Dreamcast();
@@ -200,7 +188,7 @@
Common::SaveFileManager *_savefile;
Audio::Mixer *_mixer;
- Common::TimerManager *_timer;
+ DefaultTimerManager *_timer;
SoftKeyboard _softkbd;
int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
@@ -209,18 +197,12 @@
int _overlay_x, _overlay_y;
unsigned char *_ms_buf;
unsigned char _ms_keycolor;
- SoundProc _sound_proc;
- void *_sound_proc_param;
bool _overlay_visible, _overlay_dirty, _screen_dirty;
int _screen_buffer, _overlay_buffer, _mouse_buffer;
bool _aspect_stretch, _softkbd_on, _enable_cursor_palette;
float _overlay_fade, _xscale, _yscale, _top_offset;
int _softkbd_motion;
- uint32 _timer_duration, _timer_next_expiry;
- bool _timer_active;
- int (*_timer_callback) (int);
-
unsigned char *screen;
unsigned short *mouse;
unsigned short *overlay;
@@ -237,6 +219,8 @@
unsigned char *buf, bool visible);
void setScaling();
+
+ Common::SaveFileManager *createSavefileManager();
};
Modified: scummvm/trunk/backends/platform/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/dcmain.cpp 2006-10-22 18:13:02 UTC (rev 24454)
+++ scummvm/trunk/backends/platform/dc/dcmain.cpp 2006-10-22 18:35:49 UTC (rev 24455)
@@ -32,7 +32,6 @@
#include <common/config-manager.h>
#include "backends/plugins/dc/dc-provider.h"
-#include "backends/timer/default/default-timer.h"
#include "sound/mixer.h"
@@ -42,7 +41,7 @@
OSystem_Dreamcast::OSystem_Dreamcast()
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
- _ms_buf(NULL), _sound_proc(NULL), _timer_active(false),
+ _ms_buf(NULL), _timer(NULL), _mixer(NULL), _savefile(NULL),
_current_shake_pos(0), _aspect_stretch(false), _softkbd_on(false),
_softkbd_motion(0), _enable_cursor_palette(false)
{
@@ -51,19 +50,11 @@
memset(ovl_tx, 0, sizeof(ovl_tx));
}
-static int timer_handler(int t) {
- DefaultTimerManager *tm = (DefaultTimerManager *)g_system->getTimerManager();
- tm->handler();
- return t;
-}
-
void OSystem_Dreamcast::initBackend()
{
_savefile = createSavefileManager();
_mixer = new Audio::Mixer();
_timer = new DefaultTimerManager();
- setSoundCallback(Audio::Mixer::mixCallback, _mixer);
- setTimerCallback(&timer_handler, 10);
}
Modified: scummvm/trunk/backends/platform/dc/input.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/input.cpp 2006-10-22 18:13:02 UTC (rev 24454)
+++ scummvm/trunk/backends/platform/dc/input.cpp 2006-10-22 18:35:49 UTC (rev 24455)
@@ -191,10 +191,8 @@
{
unsigned int t = Timer();
- if(_timer_active && ((int)(t-_timer_next_expiry))>=0) {
- _timer_duration = _timer_callback(_timer_duration);
- _timer_next_expiry = t+USEC_TO_TIMER(1000*_timer_duration);
- }
+ if(_timer != NULL)
+ _timer->handler();
if(((int)(t-_devpoll))<0)
return false;
Modified: scummvm/trunk/backends/platform/dc/time.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/time.cpp 2006-10-22 18:13:02 UTC (rev 24454)
+++ scummvm/trunk/backends/platform/dc/time.cpp 2006-10-22 18:35:49 UTC (rev 24455)
@@ -49,49 +49,10 @@
getMillis();
unsigned int t, start = Timer();
int time = (((unsigned int)msecs)*100000U)>>11;
- while(((int)((t = Timer())-start))<time)
+ while(((int)((t = Timer())-start))<time) {
+ if(_timer != NULL)
+ _timer->handler();
checkSound();
+ }
getMillis();
}
-
-void OSystem_Dreamcast::setTimerCallback(TimerProc callback, int timer)
-{
- if (callback != NULL) {
- _timer_duration = timer;
- _timer_next_expiry = Timer() + USEC_TO_TIMER(1000*timer);
- _timer_callback = callback;
- _timer_active = true;
- } else {
- _timer_active = false;
- }
-}
-
-
-/*
-void waitForTimer(Scumm *s, int time)
-{
- if(time<0)
- return;
- unsigned int start = Timer();
- unsigned int devpoll = start+USEC_TO_TIMER(25000);
- unsigned int t;
- int oldmousex = s->mouse.x, oldmousey = s->mouse.y;
- time = (((unsigned int)time)*100000U)>>11;
- int mask = getimask();
- while(((int)((t = Timer())-start))<time)
- if(((int)(t-devpoll))>0) {
- setimask(15);
- checkSound();
- handleInput(locked_get_pads(), s->mouse.x, s->mouse.y,
- s->_leftBtnPressed, s->_rightBtnPressed, s->_keyPressed);
- setimask(mask);
- devpoll += USEC_TO_TIMER(17000);
- if(s->mouse.x != oldmousex || s->mouse.y != oldmousey) {
- extern void updateScreen(Scumm *s);
- updateScreen(s);
- oldmousex = s->mouse.x;
- oldmousey = s->mouse.y;
- }
- }
-}
-*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list