aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/bada
diff options
context:
space:
mode:
authorChris Warren-Smith2011-08-16 11:58:43 +1000
committerChris Warren-Smith2011-08-21 16:39:08 +1000
commita31b74f3e98a083c8d5e20facf06d126b9504c76 (patch)
tree1f6b06536bc8c69a2994061dd00a8b8400721f37 /backends/platform/bada
parent1370e65de9a6b73c06ba3203bd64e9ffaba33fac (diff)
downloadscummvm-rg350-a31b74f3e98a083c8d5e20facf06d126b9504c76.tar.gz
scummvm-rg350-a31b74f3e98a083c8d5e20facf06d126b9504c76.tar.bz2
scummvm-rg350-a31b74f3e98a083c8d5e20facf06d126b9504c76.zip
BADA: Code formatting and style changes following review
Diffstat (limited to 'backends/platform/bada')
-rwxr-xr-xbackends/platform/bada/README.TXT6
-rwxr-xr-xbackends/platform/bada/application.cpp14
-rwxr-xr-xbackends/platform/bada/audio.cpp11
-rwxr-xr-xbackends/platform/bada/audio.h4
-rwxr-xr-xbackends/platform/bada/form.cpp2
-rwxr-xr-xbackends/platform/bada/fs.cpp22
-rwxr-xr-xbackends/platform/bada/main.cpp3
-rwxr-xr-xbackends/platform/bada/missing.cpp2
-rwxr-xr-xbackends/platform/bada/system.cpp32
-rwxr-xr-xbackends/platform/bada/timer.cpp6
10 files changed, 42 insertions, 60 deletions
diff --git a/backends/platform/bada/README.TXT b/backends/platform/bada/README.TXT
index dd56c8962c..38d9fd1217 100755
--- a/backends/platform/bada/README.TXT
+++ b/backends/platform/bada/README.TXT
@@ -77,3 +77,9 @@ Build instructions:
outside of the scummvm package. Start the BADA IDE then
choose this folder as the eclipse workspace. Click
Project / Build.
+
+Links:
+
+A short turorial on implementing OpenGL ES 1.1 in BADA:
+ http://forums.badadev.com/viewtopic.php?f=7&t=208
+
diff --git a/backends/platform/bada/application.cpp b/backends/platform/bada/application.cpp
index af4e3fc6ef..bf17e66aa3 100755
--- a/backends/platform/bada/application.cpp
+++ b/backends/platform/bada/application.cpp
@@ -46,7 +46,7 @@ BadaScummVM::BadaScummVM() : _appForm(0) {
BadaScummVM::~BadaScummVM() {
logEntered();
if (g_system) {
- BadaSystem *system = (BadaSystem*)g_system;
+ BadaSystem *system = (BadaSystem *)g_system;
system->destroyBackend();
delete system;
g_system = 0;
@@ -55,7 +55,7 @@ BadaScummVM::~BadaScummVM() {
bool BadaScummVM::OnAppInitializing(AppRegistry &appRegistry) {
_appForm = systemStart(this);
- return (_appForm != null);
+ return (_appForm != NULL);
}
bool BadaScummVM::OnAppTerminating(AppRegistry &appRegistry,
@@ -73,9 +73,9 @@ void BadaScummVM::OnUserEventReceivedN(RequestId requestId,
Terminate();
} else if (requestId == USER_MESSAGE_EXIT_ERR) {
// assertion failure termination
- String *message = null;
+ String *message = NULL;
if (args) {
- message = (String*) args->GetAt(0);
+ message = (String*)args->GetAt(0);
}
if (!message) {
message = new String("Unknown error");
@@ -119,10 +119,6 @@ void BadaScummVM::pauseGame(bool pause) {
}
if (g_system) {
- ((BadaSystem*)g_system)->setMute(pause);
+ ((BadaSystem *)g_system)->setMute(pause);
}
}
-
-//
-// end of application.cpp
-//
diff --git a/backends/platform/bada/audio.cpp b/backends/platform/bada/audio.cpp
index 48874d69bc..4b435cbd1d 100755
--- a/backends/platform/bada/audio.cpp
+++ b/backends/platform/bada/audio.cpp
@@ -55,7 +55,7 @@ Audio::MixerImpl *AudioThread::Construct(OSystem *system) {
DEFAULT_STACK_SIZE,
THREAD_PRIORITY_HIGH))) {
AppLog("Failed to create AudioThread");
- return null;
+ return NULL;
}
_mixer = new Audio::MixerImpl(system, 44100);
@@ -151,8 +151,6 @@ bool AudioThread::OnStart(void) {
}
int bufferSize = _audioOut->GetMinBufferSize();
- AppLog("bufferSize = %d", bufferSize);
-
for (int i = 0; i < NUM_AUDIO_BUFFERS; i++) {
if (IsFailed(_audioBuffer[i].Construct(bufferSize))) {
AppLog("Failed to create audio buffer");
@@ -224,7 +222,7 @@ void AudioThread::OnAudioOutBufferEndReached(Osp::Media::AudioOut &src) {
if (_ready > 0) {
_playing = _tail;
_audioOut->WriteBuffer(_audioBuffer[_tail]);
- _tail = (_tail + 1 == NUM_AUDIO_BUFFERS ? 0 : _tail + 1);
+ _tail = (_tail + 1) % NUM_AUDIO_BUFFERS;
_ready--;
} else {
// audio buffer empty: decrease timer inverval
@@ -241,7 +239,7 @@ void AudioThread::OnTimerExpired(Timer &timer) {
uint len = _audioBuffer[_head].GetCapacity();
int samples = _mixer->mixCallback((byte*)_audioBuffer[_head].GetPointer(), len);
if (samples) {
- _head = (_head + 1 == NUM_AUDIO_BUFFERS ? 0 : _head + 1);
+ _head = (_head + 1) % NUM_AUDIO_BUFFERS;
_ready++;
}
} else {
@@ -259,6 +257,3 @@ void AudioThread::OnTimerExpired(Timer &timer) {
_timer->Start(_interval);
}
-//
-// end of audio.cpp
-//
diff --git a/backends/platform/bada/audio.h b/backends/platform/bada/audio.h
index 0b540645fb..9279593afd 100755
--- a/backends/platform/bada/audio.h
+++ b/backends/platform/bada/audio.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef AUDIO_H
-#define AUDIO_H
+#ifndef BADA_AUDIO_H
+#define BADA_AUDIO_H
#include <FBase.h>
#include <FMedia.h>
diff --git a/backends/platform/bada/form.cpp b/backends/platform/bada/form.cpp
index 9bab28c1ba..bbdcc7dd9b 100755
--- a/backends/platform/bada/form.cpp
+++ b/backends/platform/bada/form.cpp
@@ -127,7 +127,7 @@ BadaAppForm::~BadaAppForm() {
//
void BadaAppForm::terminate() {
if (_state == ActiveState) {
- ((BadaSystem *) g_system)->setMute(true);
+ ((BadaSystem *)g_system)->setMute(true);
_eventQueueLock->Acquire();
diff --git a/backends/platform/bada/fs.cpp b/backends/platform/bada/fs.cpp
index 22684aeeec..26603045af 100755
--- a/backends/platform/bada/fs.cpp
+++ b/backends/platform/bada/fs.cpp
@@ -112,7 +112,7 @@ bool BadaFileStream::seek(int32 offs, int whence) {
case SEEK_CUR:
// set relative to offs
- if (bufferIndex < bufferLength && bufferIndex > (uint32) -offs) {
+ if (bufferIndex < bufferLength && bufferIndex > (uint32)-offs) {
// re-position within the buffer
SetLastResult(E_SUCCESS);
bufferIndex += offs;
@@ -159,17 +159,17 @@ uint32 BadaFileStream::read(void *ptr, uint32 len) {
uint32 available = bufferLength - bufferIndex;
if (len <= available) {
// use allocation
- memcpy((byte*) ptr, &buffer[bufferIndex], len);
+ memcpy((byte*)ptr, &buffer[bufferIndex], len);
bufferIndex += len;
result = len;
} else {
// use remaining allocation
- memcpy((byte*) ptr, &buffer[bufferIndex], available);
+ memcpy((byte*)ptr, &buffer[bufferIndex], available);
uint32 remaining = len - available;
result = available;
if (remaining) {
- result += file->Read(((byte*) ptr) + available, remaining);
+ result += file->Read(((byte*)ptr) + available, remaining);
}
bufferIndex = bufferLength = 0;
}
@@ -181,11 +181,11 @@ uint32 BadaFileStream::read(void *ptr, uint32 len) {
if (bufferLength < len) {
len = bufferLength;
}
- memcpy((byte*) ptr, buffer, len);
+ memcpy((byte*)ptr, buffer, len);
result = bufferIndex = len;
}
} else {
- result = file->Read((byte*) ptr, len);
+ result = file->Read((byte*)ptr, len);
bufferIndex = bufferLength = 0;
}
} else {
@@ -231,7 +231,7 @@ BadaFileStream *BadaFileStream::makeFromPath(const String &path, bool writeMode)
//
Common::String fromString(const Osp::Base::String &in) {
ByteBuffer *buf = StringUtil::StringToUtf8N(in);
- Common::String result((const char*) buf->GetPointer());
+ Common::String result((const char*)buf->GetPointer());
delete buf;
return result;
@@ -410,7 +410,7 @@ AbstractFSNode *BadaFilesystemNode::getParent() const {
Common::SeekableReadStream *BadaFilesystemNode::createReadStream() {
Common::SeekableReadStream *result = BadaFileStream::makeFromPath(_unicodePath, false);
- if (result != null) {
+ if (result != NULL) {
_isValid = !IsFailed(File::GetAttributes(_unicodePath, _attr));
}
return result;
@@ -418,12 +418,8 @@ Common::SeekableReadStream *BadaFilesystemNode::createReadStream() {
Common::WriteStream *BadaFilesystemNode::createWriteStream() {
Common::WriteStream *result = BadaFileStream::makeFromPath(_unicodePath, true);
- if (result != null) {
+ if (result != NULL) {
_isValid = !IsFailed(File::GetAttributes(_unicodePath, _attr));
}
return result;
}
-
-//
-// end of fs.cpp
-//
diff --git a/backends/platform/bada/main.cpp b/backends/platform/bada/main.cpp
index 154fec6462..8c40f24dd1 100755
--- a/backends/platform/bada/main.cpp
+++ b/backends/platform/bada/main.cpp
@@ -64,7 +64,4 @@ int OspMain(int argc, char *pArgv[]) {
C_LINKAGE_END
-//
-// end of main.cpp
-//
diff --git a/backends/platform/bada/missing.cpp b/backends/platform/bada/missing.cpp
index 57369f6f37..1656bac9ef 100755
--- a/backends/platform/bada/missing.cpp
+++ b/backends/platform/bada/missing.cpp
@@ -96,7 +96,7 @@ int sprintf(char *str, const char *format, ...) {
char *strdup(const char *strSource) {
char *buffer;
int len = strlen(strSource) + 1;
- buffer = (char*) malloc(len);
+ buffer = (char*)malloc(len);
if (buffer) {
memcpy(buffer, strSource, len);
}
diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp
index 8192ae8bbd..d174b99a67 100755
--- a/backends/platform/bada/system.cpp
+++ b/backends/platform/bada/system.cpp
@@ -125,13 +125,13 @@ private:
BadaMutexManager::BadaMutexManager() {
for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) {
- buffer[i] = null;
+ buffer[i] = NULL;
}
}
BadaMutexManager::~BadaMutexManager() {
for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) {
- if (buffer[i] != null) {
+ if (buffer[i] != NULL) {
delete buffer[i];
}
}
@@ -142,7 +142,7 @@ OSystem::MutexRef BadaMutexManager::createMutex() {
mutex->Create();
for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) {
- if (buffer[i] == null) {
+ if (buffer[i] == NULL) {
buffer[i] = mutex;
break;
}
@@ -166,7 +166,7 @@ void BadaMutexManager::deleteMutex(OSystem::MutexRef mutex) {
for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) {
if (buffer[i] == m) {
- buffer[i] = null;
+ buffer[i] = NULL;
}
}
@@ -190,7 +190,7 @@ void BadaEventManager::init() {
DefaultEventManager::init();
// theme and vkbd should have now loaded - clear the splash screen
- BadaSystem *system = (BadaSystem*)g_system;
+ BadaSystem *system = (BadaSystem *)g_system;
BadaGraphicsManager *graphics = system->getGraphics();
if (graphics) {
graphics->setReady();
@@ -199,7 +199,7 @@ void BadaEventManager::init() {
}
int BadaEventManager::shouldQuit() const {
- BadaSystem *system = (BadaSystem*)g_system;
+ BadaSystem *system = (BadaSystem *)g_system;
return system->isClosing();
}
@@ -283,8 +283,8 @@ result BadaSystem::initModules() {
void BadaSystem::initBackend() {
logEntered();
- // allow translations to be found
- ConfMan.set("themepath", "/Res");
+ // allow translations and game .DAT files to be found
+ ConfMan.set("extrapath", "/Res");
// use the mobile device theme
ConfMan.set("gui_theme", "/Res/scummmobile");
@@ -326,7 +326,7 @@ void BadaSystem::initBackend() {
Graphics::BdfFont *font = Graphics::BdfFont::loadFromCache(fontFile);
if (font) {
// use this font for the vkbd and on-screen messages
- FontMan.assignFontToUsage(Graphics::FontManager::kBigGUIFont, font);
+ FontMan.setFont(Graphics::FontManager::kBigGUIFont, font);
}
}
}
@@ -381,7 +381,7 @@ void BadaSystem::delayMillis(uint msecs) {
}
void BadaSystem::updateScreen() {
- if (_graphicsManager != null) {
+ if (_graphicsManager != NULL) {
_graphicsManager->updateScreen();
}
}
@@ -460,7 +460,7 @@ int BadaSystem::setVolume(bool up, bool minMax) {
}
//
-// create the scummVM system
+// create the ScummVM system
//
BadaAppForm *systemStart(Osp::App::Application *app) {
logEntered();
@@ -468,14 +468,14 @@ BadaAppForm *systemStart(Osp::App::Application *app) {
BadaAppForm *appForm = new BadaAppForm();
if (!appForm) {
AppLog("Failed to create appForm");
- return null;
+ return NULL;
}
if (E_SUCCESS != appForm->Construct() ||
E_SUCCESS != app->GetAppFrame()->GetFrame()->AddControl(*appForm)) {
delete appForm;
AppLog("Failed to construct appForm");
- return null;
+ return NULL;
}
return appForm;
@@ -493,11 +493,7 @@ void systemError(const char *message) {
Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR, args);
if (g_system) {
- BadaSystem *system = (BadaSystem*)g_system;
+ BadaSystem *system = (BadaSystem *)g_system;
system->exitSystem();
}
}
-
-//
-// end of system.cpp
-//
diff --git a/backends/platform/bada/timer.cpp b/backends/platform/bada/timer.cpp
index 0c941795d3..b98af897f8 100755
--- a/backends/platform/bada/timer.cpp
+++ b/backends/platform/bada/timer.cpp
@@ -62,7 +62,7 @@ void TimerSlot::OnStop() {
if (_timer) {
_timer->Cancel();
delete _timer;
- _timer = null;
+ _timer = NULL;
}
}
@@ -118,7 +118,3 @@ void BadaTimerManager::removeTimerProc(TimerProc proc) {
}
}
}
-
-//
-// end of timer.cpp
-//