diff options
Diffstat (limited to 'backends/platform/android')
| -rw-r--r-- | backends/platform/android/android.cpp | 45 | ||||
| -rw-r--r-- | backends/platform/android/android.h | 10 | ||||
| -rw-r--r-- | backends/platform/android/gfx.cpp | 10 | ||||
| -rw-r--r-- | backends/platform/android/org/inodes/gus/scummvm/ScummVM.java | 2 | 
4 files changed, 28 insertions, 39 deletions
| diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index eeeddb4c77..17c7d4f9cb 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -132,10 +132,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :  	_show_mouse(false),  	_show_overlay(false),  	_enable_zoning(false), -	_savefile(0),  	_mixer(0), -	_timer(0), -	_fsFactory(new POSIXFilesystemFactory()),  	_shake_offset(0),  	_event_queue_lock(createMutex()),  	_touch_pt_down(), @@ -149,6 +146,9 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :  	_dpad_scale(4),  	_fingersDown(0),  	_trackball_scale(2) { + +	_fsFactory = new POSIXFilesystemFactory(); +  	Common::String mf = getSystemProperty("ro.product.manufacturer");  	LOGI("Running on: [%s] [%s] [%s] [%s] [%s] SDK:%s ABI:%s", @@ -170,17 +170,17 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :  OSystem_Android::~OSystem_Android() {  	ENTER(); -	delete _savefile; -	delete _timer;  	delete _mixer; +	_mixer = 0;  	delete _fsFactory; +	_fsFactory = 0;  	deleteMutex(_event_queue_lock);  }  void *OSystem_Android::timerThreadFunc(void *arg) {  	OSystem_Android *system = (OSystem_Android *)arg; -	DefaultTimerManager *timer = (DefaultTimerManager *)(system->_timer); +	DefaultTimerManager *timer = (DefaultTimerManager *)(system->_timerManager);  	// renice this thread to boost the audio thread  	if (setpriority(PRIO_PROCESS, 0, 19) < 0) @@ -359,8 +359,8 @@ void OSystem_Android::initBackend() {  	// BUG: "transient" ConfMan settings get nuked by the options  	// screen. Passing the savepath in this way makes it stick  	// (via ConfMan.registerDefault) -	_savefile = new DefaultSaveFileManager(ConfMan.get("savepath")); -	_timer = new DefaultTimerManager(); +	_savefileManager = new DefaultSaveFileManager(ConfMan.get("savepath")); +	_timerManager = new DefaultTimerManager();  	gettimeofday(&_startTime, 0); @@ -388,6 +388,8 @@ void OSystem_Android::initBackend() {  		warning("couldn't renice the main thread");  	JNI::setReadyForEvents(true); + +	EventsBaseBackend::initBackend();  }  void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const { @@ -399,7 +401,7 @@ void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {  bool OSystem_Android::hasFeature(Feature f) {  	return (f == kFeatureFullscreenMode ||  			f == kFeatureAspectRatioCorrection || -			f == kFeatureCursorHasPalette || +			f == kFeatureCursorPalette ||  			f == kFeatureVirtualKeyboard ||  			f == kFeatureOverlaySupportsAlpha);  } @@ -420,6 +422,11 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {  		_virtkeybd_on = enable;  		showVirtualKeyboard(enable);  		break; +	case kFeatureCursorPalette: +		_use_mouse_palette = enable; +		if (!enable) +			disableCursorPalette(); +		break;  	default:  		break;  	} @@ -433,6 +440,8 @@ bool OSystem_Android::getFeatureState(Feature f) {  		return _ar_correction;  	case kFeatureVirtualKeyboard:  		return _virtkeybd_on; +	case kFeatureCursorPalette: +		return _use_mouse_palette;  	default:  		return false;  	} @@ -526,21 +535,11 @@ void OSystem_Android::showVirtualKeyboard(bool enable) {  	JNI::showVirtualKeyboard(enable);  } -Common::SaveFileManager *OSystem_Android::getSavefileManager() { -	assert(_savefile); -	return _savefile; -} -  Audio::Mixer *OSystem_Android::getMixer() {  	assert(_mixer);  	return _mixer;  } -Common::TimerManager *OSystem_Android::getTimerManager() { -	assert(_timer); -	return _timer; -} -  void OSystem_Android::getTimeAndDate(TimeDate &td) const {  	struct tm tm;  	const time_t curTime = time(0); @@ -554,10 +553,6 @@ void OSystem_Android::getTimeAndDate(TimeDate &td) const {  	td.tm_year = tm.tm_year;  } -FilesystemFactory *OSystem_Android::getFilesystemFactory() { -	return _fsFactory; -} -  void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,  												int priority) {  	ENTER(""); @@ -568,6 +563,10 @@ void OSystem_Android::addSysArchivesToSearchSet(Common::SearchSet &s,  void OSystem_Android::logMessage(LogMessageType::Type type,  									const char *message) {  	switch (type) { +	case LogMessageType::kInfo: +		__android_log_write(ANDROID_LOG_INFO, android_log_tag, message); +		break; +  	case LogMessageType::kDebug:  		__android_log_write(ANDROID_LOG_DEBUG, android_log_tag, message);  		break; diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 752a31a4db..c2ada2ab77 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -103,7 +103,7 @@ protected:  };  #endif -class OSystem_Android : public BaseBackend, public PaletteManager { +class OSystem_Android : public EventsBaseBackend, public PaletteManager {  private:  	// passed from the dark side  	int _audio_sample_rate; @@ -152,10 +152,7 @@ private:  	bool _enable_zoning;  	bool _virtkeybd_on; -	Common::SaveFileManager *_savefile;  	Audio::MixerImpl *_mixer; -	Common::TimerManager *_timer; -	FilesystemFactory *_fsFactory;  	timeval _startTime;  	Common::String getSystemProperty(const char *name) const; @@ -237,6 +234,7 @@ private:  	void clipMouse(Common::Point &p);  	void scaleMouse(Common::Point &p, int x, int y, bool deductDrawRect = true);  	void updateEventScale(); +	void disableCursorPalette();  protected:  	// PaletteManager API @@ -272,7 +270,6 @@ public:  								int cursorTargetScale,  								const Graphics::PixelFormat *format);  	virtual void setCursorPalette(const byte *colors, uint start, uint num); -	virtual void disableCursorPalette(bool disable);  	virtual bool pollEvent(Common::Event &event);  	virtual uint32 getMillis(); @@ -289,11 +286,8 @@ public:  	virtual void displayMessageOnOSD(const char *msg);  	virtual void showVirtualKeyboard(bool enable); -	virtual Common::SaveFileManager *getSavefileManager();  	virtual Audio::Mixer *getMixer();  	virtual void getTimeAndDate(TimeDate &t) const; -	virtual Common::TimerManager *getTimerManager(); -	virtual FilesystemFactory *getFilesystemFactory();  	virtual void logMessage(LogMessageType::Type type, const char *message);  	virtual void addSysArchivesToSearchSet(Common::SearchSet &s,  											int priority = 0); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 62226eb8b1..b8a9e74437 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -179,7 +179,7 @@ void OSystem_Android::initSurface() {  	JNI::initSurface(); -	// Initialise OpenGLES context. +	// Initialize OpenGLES context.  	GLESTexture::initGLExtensions();  	if (_game_texture) @@ -801,12 +801,10 @@ void OSystem_Android::setCursorPalette(const byte *colors,  	_use_mouse_palette = true;  } -void OSystem_Android::disableCursorPalette(bool disable) { -	ENTER("%d", disable); - +void OSystem_Android::disableCursorPalette() {  	// when disabling the cursor palette, and we're running a clut8 game,  	// it expects the game palette to be used for the cursor -	if (disable && _game_texture->hasPalette()) { +	if (_game_texture->hasPalette()) {  		const byte *src = _game_texture->palette_const();  		byte *dst = _mouse_texture_palette->palette(); @@ -825,8 +823,6 @@ void OSystem_Android::disableCursorPalette(bool disable) {  		byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;  		WRITE_UINT16(p, READ_UINT16(p) & ~1);  	} - -	_use_mouse_palette = !disable;  }  #endif diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index c4de6d62f8..ef9f4cc1e0 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -260,7 +260,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {  		if (_audio_track.getState() != AudioTrack.STATE_INITIALIZED)  			throw new Exception( -				String.format("Error initialising AudioTrack: %d", +				String.format("Error initializing AudioTrack: %d",  								_audio_track.getState()));  	} | 
