BADA: Misc changes merged from appstore release

This commit is contained in:
Chris Warren-Smith 2011-10-17 22:35:48 +10:00
parent ca7bc71846
commit ed07b99b22
13 changed files with 145 additions and 151 deletions

View file

@ -83,3 +83,10 @@ Links:
A short turorial on implementing OpenGL ES 1.1 in BADA: A short turorial on implementing OpenGL ES 1.1 in BADA:
http://forums.badadev.com/viewtopic.php?f=7&t=208 http://forums.badadev.com/viewtopic.php?f=7&t=208
HelvB14 font files:
http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html
http://www.cl.cam.ac.uk/~mgk25/download/ucs-fonts-75dpi100dpi.tar.gz
Then run the following command:
$ ./ucs2any.pl 100dpi/helvB14.bdf MAPPINGS/8859-1.TXT iso8859-1 \
MAPPINGS/8859-2.TXT iso8859-2 MAPPINGS/8859-3.TXT iso8859-3

View file

@ -99,11 +99,13 @@ void BadaScummVM::OnLowMemory(void) {
} }
void BadaScummVM::pauseGame(bool pause) { void BadaScummVM::pauseGame(bool pause) {
if (pause && _appForm && g_engine && !g_engine->isPaused()) { if (_appForm) {
_appForm->pushKey(Common::KEYCODE_SPACE); if (pause && g_engine && !g_engine->isPaused()) {
} _appForm->pushKey(Common::KEYCODE_SPACE);
}
if (g_system) {
((BadaSystem *)g_system)->setMute(pause); if (g_system) {
((BadaSystem *)g_system)->setMute(pause);
}
} }
} }

View file

@ -74,7 +74,7 @@ bool AudioThread::isSilentMode() {
} }
void AudioThread::setMute(bool on) { void AudioThread::setMute(bool on) {
if (_audioOut && !isSilentMode()) { if (_audioOut && _timer) {
_muted = on; _muted = on;
if (on) { if (on) {
_timer->Cancel(); _timer->Cancel();
@ -88,7 +88,7 @@ int AudioThread::setVolume(bool up, bool minMax) {
int level = -1; int level = -1;
int numLevels = sizeof(levels) / sizeof(levels[0]); int numLevels = sizeof(levels) / sizeof(levels[0]);
if (_audioOut && !isSilentMode()) { if (_audioOut) {
int volume = _audioOut->GetVolume(); int volume = _audioOut->GetVolume();
if (minMax) { if (minMax) {
level = up ? numLevels - 1 : 0; level = up ? numLevels - 1 : 0;

View file

@ -49,9 +49,9 @@ using namespace Osp::Ui::Controls;
// //
BadaAppForm::BadaAppForm() : BadaAppForm::BadaAppForm() :
_gameThread(0), _gameThread(0),
_state(InitState), _state(kInitState),
_buttonState(LeftButton), _buttonState(kLeftButton),
_shortcut(SetVolume) { _shortcut(kSetVolume) {
_eventQueueLock = new Mutex(); _eventQueueLock = new Mutex();
_eventQueueLock->Create(); _eventQueueLock->Create();
} }
@ -99,11 +99,11 @@ result BadaAppForm::Construct() {
BadaAppForm::~BadaAppForm() { BadaAppForm::~BadaAppForm() {
logEntered(); logEntered();
if (_gameThread && _state != ErrorState) { if (_gameThread && _state != kErrorState) {
terminate(); terminate();
_gameThread->Stop(); _gameThread->Stop();
if (_state != ErrorState) { if (_state != kErrorState) {
_gameThread->Join(); _gameThread->Join();
} }
@ -123,7 +123,7 @@ BadaAppForm::~BadaAppForm() {
// abort the game thread // abort the game thread
// //
void BadaAppForm::terminate() { void BadaAppForm::terminate() {
if (_state == ActiveState) { if (_state == kActiveState) {
((BadaSystem *)g_system)->setMute(true); ((BadaSystem *)g_system)->setMute(true);
_eventQueueLock->Acquire(); _eventQueueLock->Acquire();
@ -131,25 +131,25 @@ void BadaAppForm::terminate() {
Common::Event e; Common::Event e;
e.type = Common::EVENT_QUIT; e.type = Common::EVENT_QUIT;
_eventQueue.push(e); _eventQueue.push(e);
_state = ClosingState; _state = kClosingState;
_eventQueueLock->Release(); _eventQueueLock->Release();
// block while thread ends // block while thread ends
AppLog("waiting for shutdown"); AppLog("waiting for shutdown");
for (int i = 0; i < EXIT_SLEEP_STEP && _state == ClosingState; i++) { for (int i = 0; i < EXIT_SLEEP_STEP && _state == kClosingState; i++) {
Thread::Sleep(EXIT_SLEEP); Thread::Sleep(EXIT_SLEEP);
} }
if (_state == ClosingState) { if (_state == kClosingState) {
// failed to terminate - Join() will freeze // failed to terminate - Join() will freeze
_state = ErrorState; _state = kErrorState;
} }
} }
} }
void BadaAppForm::exitSystem() { void BadaAppForm::exitSystem() {
_state = ErrorState; _state = kErrorState;
if (_gameThread) { if (_gameThread) {
_gameThread->Stop(); _gameThread->Stop();
@ -200,8 +200,7 @@ bool BadaAppForm::pollEvent(Common::Event &event) {
return result; return result;
} }
void BadaAppForm::pushEvent(Common::EventType type, void BadaAppForm::pushEvent(Common::EventType type, const Point &currentPosition) {
const Point &currentPosition) {
BadaSystem *system = (BadaSystem *)g_system; BadaSystem *system = (BadaSystem *)g_system;
BadaGraphicsManager *graphics = system->getGraphics(); BadaGraphicsManager *graphics = system->getGraphics();
if (graphics) { if (graphics) {
@ -248,8 +247,8 @@ void BadaAppForm::pushKey(Common::KeyCode keycode) {
void BadaAppForm::OnOrientationChanged(const Control &source, void BadaAppForm::OnOrientationChanged(const Control &source,
OrientationStatus orientationStatus) { OrientationStatus orientationStatus) {
logEntered(); logEntered();
if (_state == InitState) { if (_state == kInitState) {
_state = ActiveState; _state = kActiveState;
_gameThread->Start(); _gameThread->Start();
} }
} }
@ -257,30 +256,30 @@ void BadaAppForm::OnOrientationChanged(const Control &source,
Object *BadaAppForm::Run(void) { Object *BadaAppForm::Run(void) {
scummvm_main(0, 0); scummvm_main(0, 0);
if (_state == ActiveState) { if (_state == kActiveState) {
Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT, NULL); Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT, NULL);
} }
_state = DoneState; _state = kDoneState;
return NULL; return NULL;
} }
void BadaAppForm::setButtonShortcut() { void BadaAppForm::setButtonShortcut() {
switch (_buttonState) { switch (_buttonState) {
case LeftButton: case kLeftButton:
g_system->displayMessageOnOSD(_("Right Click Once")); g_system->displayMessageOnOSD(_("Right Click Once"));
_buttonState = RightButtonOnce; _buttonState = kRightButtonOnce;
break; break;
case RightButtonOnce: case kRightButtonOnce:
g_system->displayMessageOnOSD(_("Right Click")); g_system->displayMessageOnOSD(_("Right Click"));
_buttonState = RightButton; _buttonState = kRightButton;
break; break;
case RightButton: case kRightButton:
g_system->displayMessageOnOSD(_("Move Only")); g_system->displayMessageOnOSD(_("Move Only"));
_buttonState = MoveOnly; _buttonState = kMoveOnly;
break; break;
case MoveOnly: case kMoveOnly:
g_system->displayMessageOnOSD(_("Left Click")); g_system->displayMessageOnOSD(_("Left Click"));
_buttonState = LeftButton; _buttonState = kLeftButton;
break; break;
} }
} }
@ -288,27 +287,27 @@ void BadaAppForm::setButtonShortcut() {
void BadaAppForm::setShortcut() { void BadaAppForm::setShortcut() {
// cycle to the next shortcut // cycle to the next shortcut
switch (_shortcut) { switch (_shortcut) {
case ControlMouse: case kControlMouse:
g_system->displayMessageOnOSD(_("Escape Key")); g_system->displayMessageOnOSD(_("Escape Key"));
_shortcut = EscapeKey; _shortcut = kEscapeKey;
break; break;
case EscapeKey: case kEscapeKey:
g_system->displayMessageOnOSD(_("Game Menu")); g_system->displayMessageOnOSD(_("Game Menu"));
_shortcut = GameMenu; _shortcut = kGameMenu;
break; break;
case GameMenu: case kGameMenu:
g_system->displayMessageOnOSD(_("Show Keypad")); g_system->displayMessageOnOSD(_("Show Keypad"));
_shortcut = ShowKeypad; _shortcut = kShowKeypad;
break; break;
case SetVolume: case kSetVolume:
// fallthru // fallthru
case ShowKeypad: case kShowKeypad:
g_system->displayMessageOnOSD(_("Control Mouse")); g_system->displayMessageOnOSD(_("Control Mouse"));
_shortcut = ControlMouse; _shortcut = kControlMouse;
break; break;
} }
} }
@ -330,17 +329,17 @@ void BadaAppForm::setVolume(bool up, bool minMax) {
void BadaAppForm::showKeypad() { void BadaAppForm::showKeypad() {
// display the soft keyboard // display the soft keyboard
_buttonState = LeftButton; _buttonState = kLeftButton;
pushKey(Common::KEYCODE_F7); pushKey(Common::KEYCODE_F7);
} }
void BadaAppForm::OnTouchDoublePressed(const Control &source, void BadaAppForm::OnTouchDoublePressed(const Control &source,
const Point &currentPosition, const Point &currentPosition,
const TouchEventInfo &touchInfo) { const TouchEventInfo &touchInfo) {
if (_buttonState != MoveOnly) { if (_buttonState != kMoveOnly) {
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
currentPosition); currentPosition);
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
currentPosition); currentPosition);
} }
} }
@ -358,7 +357,7 @@ void BadaAppForm::OnTouchFocusOut(const Control &source,
void BadaAppForm::OnTouchLongPressed(const Control &source, void BadaAppForm::OnTouchLongPressed(const Control &source,
const Point &currentPosition, const Point &currentPosition,
const TouchEventInfo &touchInfo) { const TouchEventInfo &touchInfo) {
if (_buttonState != LeftButton) { if (_buttonState != kLeftButton) {
pushKey(Common::KEYCODE_RETURN); pushKey(Common::KEYCODE_RETURN);
} }
} }
@ -372,8 +371,8 @@ void BadaAppForm::OnTouchMoved(const Control &source,
void BadaAppForm::OnTouchPressed(const Control &source, void BadaAppForm::OnTouchPressed(const Control &source,
const Point &currentPosition, const Point &currentPosition,
const TouchEventInfo &touchInfo) { const TouchEventInfo &touchInfo) {
if (_buttonState != MoveOnly) { if (_buttonState != kMoveOnly) {
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN, pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONDOWN : Common::EVENT_RBUTTONDOWN,
currentPosition); currentPosition);
} }
} }
@ -381,11 +380,11 @@ void BadaAppForm::OnTouchPressed(const Control &source,
void BadaAppForm::OnTouchReleased(const Control &source, void BadaAppForm::OnTouchReleased(const Control &source,
const Point &currentPosition, const Point &currentPosition,
const TouchEventInfo &touchInfo) { const TouchEventInfo &touchInfo) {
if (_buttonState != MoveOnly) { if (_buttonState != kMoveOnly) {
pushEvent(_buttonState == LeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP, pushEvent(_buttonState == kLeftButton ? Common::EVENT_LBUTTONUP : Common::EVENT_RBUTTONUP,
currentPosition); currentPosition);
if (_buttonState == RightButtonOnce) { if (_buttonState == kRightButtonOnce) {
_buttonState = LeftButton; _buttonState = kLeftButton;
} }
// flick to skip dialog // flick to skip dialog
if (touchInfo.IsFlicked()) { if (touchInfo.IsFlicked()) {
@ -398,17 +397,17 @@ void BadaAppForm::OnKeyLongPressed(const Control &source, KeyCode keyCode) {
logEntered(); logEntered();
switch (keyCode) { switch (keyCode) {
case KEY_SIDE_UP: case KEY_SIDE_UP:
_shortcut = SetVolume; _shortcut = kSetVolume;
setVolume(true, true); setVolume(true, true);
return; return;
case KEY_SIDE_DOWN: case KEY_SIDE_DOWN:
_shortcut = SetVolume; _shortcut = kSetVolume;
setVolume(false, true); setVolume(false, true);
return; return;
case KEY_CAMERA: case KEY_CAMERA:
_shortcut = ShowKeypad; _shortcut = kShowKeypad;
showKeypad(); showKeypad();
return; return;
@ -420,8 +419,8 @@ void BadaAppForm::OnKeyLongPressed(const Control &source, KeyCode keyCode) {
void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) { void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) {
switch (keyCode) { switch (keyCode) {
case KEY_SIDE_UP: case KEY_SIDE_UP:
if (_shortcut != SetVolume) { if (_shortcut != kSetVolume) {
_shortcut = SetVolume; _shortcut = kSetVolume;
} else { } else {
setVolume(true, false); setVolume(true, false);
} }
@ -429,19 +428,20 @@ void BadaAppForm::OnKeyPressed(const Control &source, KeyCode keyCode) {
case KEY_SIDE_DOWN: case KEY_SIDE_DOWN:
switch (_shortcut) { switch (_shortcut) {
case ControlMouse: case kControlMouse:
setButtonShortcut(); setButtonShortcut();
break; break;
case EscapeKey: case kEscapeKey:
pushKey(Common::KEYCODE_ESCAPE); pushKey(Common::KEYCODE_ESCAPE);
break; break;
case GameMenu: case kGameMenu:
_buttonState = kLeftButton;
pushKey(Common::KEYCODE_F5); pushKey(Common::KEYCODE_F5);
break; break;
case ShowKeypad: case kShowKeypad:
showKeypad(); showKeypad();
break; break;

View file

@ -50,7 +50,7 @@ public:
result Construct(); result Construct();
bool pollEvent(Common::Event &event); bool pollEvent(Common::Event &event);
bool isClosing() { return _state == ClosingState; } bool isClosing() { return _state == kClosingState; }
void pushKey(Common::KeyCode keycode); void pushKey(Common::KeyCode keycode);
void exitSystem(); void exitSystem();
@ -100,9 +100,9 @@ private:
Osp::Base::Runtime::Thread *_gameThread; Osp::Base::Runtime::Thread *_gameThread;
Osp::Base::Runtime::Mutex *_eventQueueLock; Osp::Base::Runtime::Mutex *_eventQueueLock;
Common::Queue<Common::Event> _eventQueue; Common::Queue<Common::Event> _eventQueue;
enum {InitState, ActiveState, ClosingState, DoneState, ErrorState} _state; enum { kInitState, kActiveState, kClosingState, kDoneState, kErrorState } _state;
enum {LeftButton, RightButtonOnce, RightButton, MoveOnly} _buttonState; enum { kLeftButton, kRightButtonOnce, kRightButton, kMoveOnly } _buttonState;
enum {ControlMouse, EscapeKey, GameMenu, ShowKeypad, SetVolume} _shortcut; enum { kControlMouse, kEscapeKey, kGameMenu, kShowKeypad, kSetVolume } _shortcut;
}; };
#endif #endif

View file

@ -345,7 +345,7 @@ bool BadaFilesystemNode::getChildren(AbstractFSList &myList,
// open directory // open directory
if (IsFailed(pDir->Construct(_unicodePath))) { if (IsFailed(pDir->Construct(_unicodePath))) {
AppLog("Failed to open directory"); AppLog("Failed to open directory: %S", _unicodePath.GetPointer());
} else { } else {
// read all directory entries // read all directory entries
pDirEnum = pDir->ReadN(); pDirEnum = pDir->ReadN();
@ -365,8 +365,7 @@ bool BadaFilesystemNode::getChildren(AbstractFSList &myList,
} }
// skip '.' and '..' to avoid cycles // skip '.' and '..' to avoid cycles
if ((fileName[0] == '.' && fileName[1] == 0) || if (fileName == L"." || fileName == L"..") {
(fileName[0] == '.' && fileName[1] == '.')) {
continue; continue;
} }

View file

@ -38,7 +38,6 @@ BadaGraphicsManager::BadaGraphicsManager(BadaAppForm *appForm) :
_initState(true) { _initState(true) {
assert(appForm != NULL); assert(appForm != NULL);
_videoMode.fullscreen = true; _videoMode.fullscreen = true;
_videoMode.antialiasing = true;
} }
const Graphics::Font *BadaGraphicsManager::getFontOSD() { const Graphics::Font *BadaGraphicsManager::getFontOSD() {
@ -195,7 +194,6 @@ void BadaGraphicsManager::loadTextures() {
// prevent image skew in some games, see: // prevent image skew in some games, see:
// http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall // http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall
// note: this did not solve the pixel border problem in refreshGameScreen()
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
} }
@ -234,58 +232,6 @@ void BadaGraphicsManager::unloadGFXMode() {
logLeaving(); logLeaving();
} }
void BadaGraphicsManager::refreshGameScreen() {
if (_screenNeedsRedraw)
_screenDirtyRect = Common::Rect(0, 0, _screenData.w, _screenData.h);
int x = _screenDirtyRect.left;
int y = _screenDirtyRect.top;
int w = _screenDirtyRect.width();
int h = _screenDirtyRect.height();
if (_screenData.format.bytesPerPixel == 1) {
// Create a temporary RGB888 surface
int sw = w;
int sh = h;
if (_videoMode.screenWidth == w && _videoMode.screenHeight == h) {
// The extra border prevents random pixels from appearing in the right and bottom
// screen column/row. Not sure whether this should be applied to opengl-graphics.cpp
sw = w + 1;
sh = h + 1;
}
byte *surface = new byte[sw * sh * 3];
// Convert the paletted buffer to RGB888
const byte *src = (byte *)_screenData.pixels + y * _screenData.pitch;
src += x * _screenData.format.bytesPerPixel;
byte *dst = surface;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
dst[0] = _gamePalette[src[j] * 3];
dst[1] = _gamePalette[src[j] * 3 + 1];
dst[2] = _gamePalette[src[j] * 3 + 2];
dst += 3;
}
src += _screenData.pitch;
}
// Update the texture
_gameTexture->updateBuffer(surface, w * 3, x, y, sw, sh);
// Free the temp surface
delete[] surface;
} else {
// Update the texture
_gameTexture->updateBuffer((byte *)_screenData.pixels + y * _screenData.pitch +
x * _screenData.format.bytesPerPixel, _screenData.pitch, x, y, w, h);
}
_screenNeedsRedraw = false;
_screenDirtyRect = Common::Rect();
}
// display a simple splash screen until launcher is ready // display a simple splash screen until launcher is ready
void BadaGraphicsManager::showSplash() { void BadaGraphicsManager::showSplash() {
Canvas canvas; Canvas canvas;

View file

@ -57,7 +57,6 @@ private:
bool loadGFXMode(); bool loadGFXMode();
void loadTextures(); void loadTextures();
void unloadGFXMode(); void unloadGFXMode();
void refreshGameScreen();
void setInternalMousePosition(int x, int y) {} void setInternalMousePosition(int x, int y) {}
void showSplash(); void showSplash();

View file

@ -31,17 +31,32 @@
// //
bool scanInt(const char **in, va_list *ap, int max) { bool scanInt(const char **in, va_list *ap, int max) {
while (**in && (**in == ' ' || **in == '0')) { // skip leading space characters
while (**in && **in == ' ') {
(*in)++;
}
// number optionally preceeded with a + or - sign.
bool negate = false;
if (**in == '-') {
(*in)++;
negate = true;
}
if (**in == '+') {
(*in)++; (*in)++;
} }
int *arg = va_arg(*ap, int*); int *arg = va_arg(*ap, int*);
char *end; char *end;
long n = strtol(*in, &end, 0); long n = strtol(*in, &end, 10);
if (negate) {
n = -n;
}
bool err = false; bool err = false;
if (end == *in || (max > 0 && (end - *in) > max)) { if (end == *in || (max > 0 && (end - *in) > max)) {
err = true; err = true;
} else { } else {
*arg = (int)n; *arg = (int)n;
*in = end; *in = end;
@ -162,21 +177,37 @@ extern "C" int simple_sscanf(const char *input, const char *format, ...) {
#if defined(TEST) #if defined(TEST)
int main(int argc, char *pArgv[]) { int main(int argc, char *pArgv[]) {
int x,y,h; int x,y,xx,yy,h;
char buffer[100]; char buffer[100];
unsigned u; unsigned u;
char c; char c;
strcpy(buffer, "hello"); strcpy(buffer, "hello");
char *b = buffer; char *b = buffer;
// strcpy(buffer, "in the buffer something"); if (simple_sscanf("BBX 00009 -1 +10 000",
if (simple_sscanf("CAT 123x-10 0x100 FONT large 1 enough\n 123456.AUD $", "BBX %d %d %d %d",
"CAT %dx%d %x FONT %[^\n] %06u.AUD %c", &x, &y, &xx, &yy) != 4) {
&x, &y, &h, b, &u, &c) != 6) {
printf("Failed\n"); printf("Failed\n");
} else { } else {
printf("Success %d %d %d %s %d '%c'\n", x, y, h, buffer, u, c); printf("Success %d %d %d %d\n", x, y, xx, yy);
} }
if (simple_sscanf("CAT 123x-10 0x100h 123456.AUD $ ",
"CAT %dx%d %xh %06u.AUD %c",
&x, &y, &h, &u, &c) != 5) {
printf("Failed\n");
} else {
printf("Success %d %d %d %d '%c' \n", x, y, h, u, c);
}
if (simple_sscanf("COPYRIGHT \"Copyright (c) 1984, 1987 Foo Systems Incorporated",
"COPYRIGHT \"%[^\"]",
b) != 1) {
printf("Failed\n");
} else {
printf("Success %s\n", buffer);
}
return 0; return 0;
} }
#endif #endif

View file

@ -45,6 +45,7 @@ using namespace Osp::Base::Runtime;
using namespace Osp::Ui::Controls; using namespace Osp::Ui::Controls;
#define DEFAULT_CONFIG_FILE "/Home/scummvm.ini" #define DEFAULT_CONFIG_FILE "/Home/scummvm.ini"
#define RESOURCE_PATH "/Res"
#define MUTEX_BUFFER_SIZE 5 #define MUTEX_BUFFER_SIZE 5
// //
@ -152,17 +153,17 @@ OSystem::MutexRef BadaMutexManager::createMutex() {
} }
void BadaMutexManager::lockMutex(OSystem::MutexRef mutex) { void BadaMutexManager::lockMutex(OSystem::MutexRef mutex) {
Mutex *m = (Mutex*)mutex; Mutex *m = (Mutex *)mutex;
m->Acquire(); m->Acquire();
} }
void BadaMutexManager::unlockMutex(OSystem::MutexRef mutex) { void BadaMutexManager::unlockMutex(OSystem::MutexRef mutex) {
Mutex *m = (Mutex*)mutex; Mutex *m = (Mutex *)mutex;
m->Release(); m->Release();
} }
void BadaMutexManager::deleteMutex(OSystem::MutexRef mutex) { void BadaMutexManager::deleteMutex(OSystem::MutexRef mutex) {
Mutex *m = (Mutex*)mutex; Mutex *m = (Mutex *)mutex;
for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) { for (int i = 0; i < MUTEX_BUFFER_SIZE; i++) {
if (buffer[i] == m) { if (buffer[i] == m) {
@ -245,7 +246,7 @@ result BadaSystem::initModules() {
return E_OUT_OF_MEMORY; return E_OUT_OF_MEMORY;
} }
_graphicsManager = (GraphicsManager*) new BadaGraphicsManager(_appForm); _graphicsManager = (GraphicsManager *)new BadaGraphicsManager(_appForm);
if (!_graphicsManager) { if (!_graphicsManager) {
return E_OUT_OF_MEMORY; return E_OUT_OF_MEMORY;
} }
@ -266,7 +267,7 @@ result BadaSystem::initModules() {
return E_OUT_OF_MEMORY; return E_OUT_OF_MEMORY;
} }
_audiocdManager = (AudioCDManager*) new DefaultAudioCDManager(); _audiocdManager = (AudioCDManager *)new DefaultAudioCDManager();
if (!_audiocdManager) { if (!_audiocdManager) {
return E_OUT_OF_MEMORY; return E_OUT_OF_MEMORY;
} }
@ -283,9 +284,6 @@ result BadaSystem::initModules() {
void BadaSystem::initBackend() { void BadaSystem::initBackend() {
logEntered(); logEntered();
// allow translations and game .DAT files to be found
ConfMan.set("extrapath", "/Res");
// use the mobile device theme // use the mobile device theme
ConfMan.set("gui_theme", "/Res/scummmobile"); ConfMan.set("gui_theme", "/Res/scummmobile");
@ -304,7 +302,7 @@ void BadaSystem::initBackend() {
} }
ConfMan.registerDefault("fullscreen", true); ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", true); ConfMan.registerDefault("aspect_ratio", false);
ConfMan.setBool("confirm_exit", false); ConfMan.setBool("confirm_exit", false);
Osp::System::SystemTime::GetTicks(_epoch); Osp::System::SystemTime::GetTicks(_epoch);
@ -317,7 +315,7 @@ void BadaSystem::initBackend() {
// replace kBigGUIFont using the large font from the scummmobile theme // replace kBigGUIFont using the large font from the scummmobile theme
Common::File fontFile; Common::File fontFile;
Common::String fileName = "/Res/scummmobile/helvB14-ASCII.fcc"; Common::String fileName = "/Res/scummmobile/helvB14-iso-8859-1.fcc";
BadaFilesystemNode file(fileName); BadaFilesystemNode file(fileName);
if (file.exists()) { if (file.exists()) {
Common::SeekableReadStream *stream = file.createReadStream(); Common::SeekableReadStream *stream = file.createReadStream();
@ -335,6 +333,11 @@ void BadaSystem::initBackend() {
logLeaving(); logLeaving();
} }
void BadaSystem::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
// allow translations.dat and game .DAT files to be found
s.addDirectory(RESOURCE_PATH, RESOURCE_PATH, priority);
}
void BadaSystem::destroyBackend() { void BadaSystem::destroyBackend() {
closeAudio(); closeAudio();
@ -446,8 +449,12 @@ void BadaSystem::closeGraphics() {
} }
void BadaSystem::setMute(bool on) { void BadaSystem::setMute(bool on) {
// only change mute after eventManager init() has completed
if (_audioThread) { if (_audioThread) {
_audioThread->setMute(on); BadaGraphicsManager *graphics = getGraphics();
if (graphics && graphics->isReady()) {
_audioThread->setMute(on);
}
} }
} }

View file

@ -74,7 +74,7 @@ public:
bool isClosing() { return _appForm->isClosing(); } bool isClosing() { return _appForm->isClosing(); }
BadaGraphicsManager *getGraphics() { BadaGraphicsManager *getGraphics() {
return (BadaGraphicsManager*)_graphicsManager; return (BadaGraphicsManager *)_graphicsManager;
} }
private: private:
@ -88,8 +88,9 @@ private:
void getTimeAndDate(TimeDate &t) const; void getTimeAndDate(TimeDate &t) const;
void fatalError(); void fatalError();
void logMessage(LogMessageType::Type type, const char *message); void logMessage(LogMessageType::Type type, const char *message);
void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
Common::EventSource *getDefaultEventSource() {return this;} Common::EventSource *getDefaultEventSource() { return this; }
Common::SeekableReadStream *createConfigReadStream(); Common::SeekableReadStream *createConfigReadStream();
Common::WriteStream *createConfigWriteStream(); Common::WriteStream *createConfigWriteStream();

View file

@ -99,11 +99,13 @@ void SmushChannel::processBuffer() {
byte *old = _tbuffer; byte *old = _tbuffer;
int32 new_size = _tbufferSize - offset; int32 new_size = _tbufferSize - offset;
_tbuffer = (byte *)malloc(new_size); _tbuffer = (byte *)malloc(new_size);
// FIXME: _tbuffer might be 0 if new_size is 0.
// NB: Also check other "if (_tbuffer)" locations in smush // NB: Also check other "if (_tbuffer)" locations in smush
if (!_tbuffer) if (!_tbuffer) {
error("smush channel failed to allocate memory"); if (new_size)
memcpy(_tbuffer, old + offset, new_size); error("smush channel failed to allocate memory");
} else {
memcpy(_tbuffer, old + offset, new_size);
}
_tbufferSize = new_size; _tbufferSize = new_size;
free(old); free(old);
} }

View file

@ -590,7 +590,7 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) {
#ifdef USE_TRANSLATION #ifdef USE_TRANSLATION
TransMan.setLanguage("C"); TransMan.setLanguage("C");
#endif #endif
warning("Failed to load localized font '%s'. Using non-localized font and default GUI language instead", file.c_str()); warning("Failed to load localized font '%s'. Using non-localized font and default GUI language instead", localized.c_str());
} }
} }
} }