DS: Display the ScummVM logo on the top screen when the launcher is active
This commit is contained in:
parent
ebcc826c92
commit
066979c96a
10 changed files with 138 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -81,6 +81,9 @@ lib*.a
|
|||
/backends/platform/dc/SCUMMVM.BIN
|
||||
/backends/platform/dc/*.PLG
|
||||
|
||||
/backends/platform/ds/gfx/*.s
|
||||
/backends/platform/ds/gfx/*.h
|
||||
|
||||
/backends/platform/maemo/scummvm
|
||||
|
||||
/dists/rpl.exe
|
||||
|
|
|
@ -214,4 +214,43 @@ Common::Point Background::scaledToReal(int16 x, int16 y) const {
|
|||
return Common::Point(x, y);
|
||||
}
|
||||
|
||||
TiledBackground::TiledBackground(const unsigned int *tiles, size_t tilesLen, const unsigned short *map, size_t mapLen, int layer, bool isSub, int mapBase, int tileBase) :
|
||||
_tiles(tiles), _tilesLen(tilesLen), _map(map), _mapLen(mapLen),
|
||||
_bg(-1), _visible(true) {
|
||||
|
||||
if (isSub) {
|
||||
_bg = bgInitSub(layer, BgType_Text8bpp, BgSize_T_256x256, mapBase, tileBase);
|
||||
} else {
|
||||
_bg = bgInit(layer, BgType_Text8bpp, BgSize_T_256x256, mapBase, tileBase);
|
||||
}
|
||||
}
|
||||
|
||||
void TiledBackground::update() {
|
||||
if (_bg < 0)
|
||||
return;
|
||||
|
||||
dmaCopy(_tiles, bgGetGfxPtr(_bg), _tilesLen);
|
||||
dmaCopy(_map, bgGetMapPtr(_bg), _mapLen);
|
||||
}
|
||||
|
||||
void TiledBackground::reset() {
|
||||
if (_bg < 0)
|
||||
return;
|
||||
|
||||
dmaFillHalfWords(0, bgGetMapPtr(_bg), _mapLen);
|
||||
dmaFillHalfWords(0, bgGetGfxPtr(_bg), _tilesLen);
|
||||
}
|
||||
|
||||
void TiledBackground::show() {
|
||||
if (_bg >= 0)
|
||||
bgShow(_bg);
|
||||
_visible = true;
|
||||
}
|
||||
|
||||
void TiledBackground::hide() {
|
||||
if (_bg >= 0)
|
||||
bgHide(_bg);
|
||||
_visible = false;
|
||||
}
|
||||
|
||||
} // End of namespace DS
|
||||
|
|
|
@ -59,6 +59,26 @@ protected:
|
|||
Graphics::Surface *_surface;
|
||||
};
|
||||
|
||||
class TiledBackground {
|
||||
public:
|
||||
TiledBackground(const unsigned int *tiles, size_t tilesLen, const unsigned short *map, size_t mapLen, int layer, bool isSub, int mapBase, int tileBase);
|
||||
|
||||
void update();
|
||||
void reset();
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
inline bool isVisible() const { return _visible; }
|
||||
|
||||
protected:
|
||||
const unsigned int *_tiles;
|
||||
const unsigned short *_map;
|
||||
size_t _tilesLen, _mapLen;
|
||||
|
||||
int _bg;
|
||||
bool _visible;
|
||||
};
|
||||
|
||||
} // End of namespace DS
|
||||
|
||||
#endif // #ifndef DS_BACKGROUND_H
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <nds.h>
|
||||
|
||||
#include "backends/platform/ds/osystem_ds.h"
|
||||
#include "backends/platform/ds/gfx/banner.h"
|
||||
|
||||
#include "common/translation.h"
|
||||
|
||||
|
@ -167,6 +168,13 @@ void initHardware() {
|
|||
|
||||
#ifdef DISABLE_TEXT_CONSOLE
|
||||
videoSetModeSub(MODE_3_2D | DISPLAY_BG3_ACTIVE);
|
||||
|
||||
bgExtPaletteEnableSub();
|
||||
|
||||
/* The extended palette data can only be accessed in LCD mode. */
|
||||
vramSetBankH(VRAM_H_LCD);
|
||||
dmaCopy(bannerPal, &VRAM_H_EXT_PALETTE[1][0], bannerPalLen);
|
||||
vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -185,11 +193,12 @@ void OSystem_DS::initGraphics() {
|
|||
_screen = nullptr;
|
||||
#ifndef DISABLE_TEXT_CONSOLE
|
||||
_subScreen = nullptr;
|
||||
_banner = nullptr;
|
||||
#endif
|
||||
|
||||
_keyboard = new DS::Keyboard(_eventManager->getEventDispatcher());
|
||||
#ifndef DISABLE_TEXT_CONSOLE
|
||||
_keyboard->init(0, 34, 1, false);
|
||||
_keyboard->init(0, 21, 1, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -226,8 +235,10 @@ void OSystem_DS::setFeatureState(Feature f, bool enable) {
|
|||
if (_subScreen) {
|
||||
_subScreen->hide();
|
||||
_subScreen->reset();
|
||||
} else if (_banner) {
|
||||
_banner->hide();
|
||||
}
|
||||
_keyboard->init(0, 34, 1, false);
|
||||
_keyboard->init(0, 21, 1, false);
|
||||
}
|
||||
#endif
|
||||
_keyboard->show();
|
||||
|
@ -237,9 +248,11 @@ void OSystem_DS::setFeatureState(Feature f, bool enable) {
|
|||
if (_subScreen) {
|
||||
_subScreen->reset();
|
||||
_subScreen->show();
|
||||
_paletteDirty = true;
|
||||
} else if (_banner) {
|
||||
_banner->show();
|
||||
}
|
||||
_subScreenActive = true;
|
||||
_paletteDirty = true;
|
||||
#endif
|
||||
setSwapLCDs(false);
|
||||
}
|
||||
|
@ -357,8 +370,22 @@ void OSystem_DS::initSize(uint width, uint height, const Graphics::PixelFormat *
|
|||
delete _subScreen;
|
||||
_subScreen = nullptr;
|
||||
|
||||
if (DS::Background::getRequiredVRAM(width, height, isRGB, false) <= 0x20000) {
|
||||
_subScreen = new DS::Background(&_framebuffer, 3, true, 0, false);
|
||||
if (_engineRunning) {
|
||||
if (_banner) {
|
||||
_banner->reset();
|
||||
_banner->hide();
|
||||
}
|
||||
|
||||
delete _banner;
|
||||
_banner = nullptr;
|
||||
|
||||
if (DS::Background::getRequiredVRAM(width, height, isRGB, false) <= 0x20000) {
|
||||
_subScreen = new DS::Background(&_framebuffer, 3, true, 0, false);
|
||||
}
|
||||
} else {
|
||||
if (!_banner)
|
||||
_banner = new DS::TiledBackground(bannerTiles, bannerTilesLen, bannerMap, bannerMapLen, 1, true, 30, 0);
|
||||
_banner->update();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -430,7 +457,7 @@ void OSystem_DS::updateScreen() {
|
|||
if (_paletteDirty) {
|
||||
dmaCopyHalfWords(3, _palette, BG_PALETTE, 256 * 2);
|
||||
#ifdef DISABLE_TEXT_CONSOLE
|
||||
if (_subScreenActive)
|
||||
if (_subScreen && _subScreenActive)
|
||||
dmaCopyHalfWords(3, _palette, BG_PALETTE_SUB, 256 * 2);
|
||||
#endif
|
||||
_paletteDirty = false;
|
||||
|
|
|
@ -4,11 +4,16 @@ else
|
|||
DESCRIPTION ?= DS Port
|
||||
endif
|
||||
|
||||
NDSTOOL ?= ndstool
|
||||
GRIT ?= grit
|
||||
|
||||
all: scummvm.nds
|
||||
|
||||
clean: dsclean
|
||||
|
||||
dsclean:
|
||||
$(RM) backends/platform/ds/gfx/*.h
|
||||
$(RM) backends/platform/ds/gfx/*.s
|
||||
$(RM) scummvm.nds
|
||||
$(RM) map.txt
|
||||
$(RM_REC) romfs
|
||||
|
@ -23,7 +28,7 @@ dsdist: scummvm.nds $(DIST_FILES_DOCS)
|
|||
.PHONY: dsclean dsdist
|
||||
|
||||
%.nds: %.elf romfs
|
||||
ndstool -c $@ -9 $< -b $(srcdir)/backends/platform/ds/logo.bmp "$(@F);ScummVM $(VERSION);$(DESCRIPTION)" -d romfs
|
||||
$(NDSTOOL) -c $@ -9 $< -b $(srcdir)/backends/platform/ds/logo.bmp "$(@F);ScummVM $(VERSION);$(DESCRIPTION)" -d romfs
|
||||
|
||||
romfs: $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(PLUGINS)
|
||||
@rm -rf romfs
|
||||
|
@ -44,6 +49,16 @@ ifeq ($(DYNAMIC_MODULES),1)
|
|||
endif
|
||||
|
||||
|
||||
QUIET_GRIT = @echo ' ' GRIT ' ' $@;
|
||||
|
||||
vpath %.grit $(srcdir)
|
||||
vpath %.png $(srcdir)
|
||||
|
||||
%.s %.h : %.png %.grit
|
||||
$(QUIET)$(MKDIR) $(*D)
|
||||
$(QUIET_GRIT)$(GRIT) $< -fts -o$*
|
||||
|
||||
|
||||
# Command to build libmad is:
|
||||
# ./configure --host=arm-elf --enable-speed --enable-sso -enable-fpm=arm CFLAGS='-specs=ds_arm9.specs -mthumb-interwork'
|
||||
#
|
||||
|
|
11
backends/platform/ds/gfx/banner.grit
Normal file
11
backends/platform/ds/gfx/banner.grit
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 8 bit bitmap
|
||||
-gB8
|
||||
|
||||
# tile format
|
||||
-gt
|
||||
|
||||
# tile reduction by tiles, palette and hflip/vflip
|
||||
-mRtf
|
||||
|
||||
# map layout standard bg format
|
||||
-mLs
|
BIN
backends/platform/ds/gfx/banner.png
Normal file
BIN
backends/platform/ds/gfx/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -6,7 +6,8 @@ MODULE_OBJS := \
|
|||
ds-graphics.o \
|
||||
dsmain.o \
|
||||
keyboard.o \
|
||||
osystem_ds.o
|
||||
osystem_ds.o \
|
||||
gfx/banner.o
|
||||
|
||||
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
|
||||
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
OSystem_DS *OSystem_DS::_instance = NULL;
|
||||
|
||||
OSystem_DS::OSystem_DS()
|
||||
: _eventSource(NULL), _disableCursorPalette(true),
|
||||
: _eventSource(NULL), _engineRunning(false), _disableCursorPalette(true),
|
||||
_graphicsMode(GFX_HWSCALE), _stretchMode(100),
|
||||
_paletteDirty(false), _cursorDirty(false), _overlayInGUI(false),
|
||||
_pfCLUT8(Graphics::PixelFormat::createFormatCLUT8()),
|
||||
|
@ -209,3 +209,11 @@ Common::String OSystem_DS::getSystemLanguage() const {
|
|||
default: return "en_US";
|
||||
}
|
||||
}
|
||||
|
||||
void OSystem_DS::engineInit() {
|
||||
_engineRunning = true;
|
||||
}
|
||||
|
||||
void OSystem_DS::engineDone() {
|
||||
_engineRunning = false;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ protected:
|
|||
DS::Background *_screen, *_overlayScreen;
|
||||
#ifdef DISABLE_TEXT_CONSOLE
|
||||
DS::Background *_subScreen;
|
||||
DS::TiledBackground *_banner;
|
||||
#endif
|
||||
bool _subScreenActive;
|
||||
Graphics::Surface _cursor;
|
||||
|
@ -71,6 +72,8 @@ protected:
|
|||
|
||||
const Graphics::PixelFormat _pfCLUT8, _pfABGR1555;
|
||||
|
||||
bool _engineRunning;
|
||||
|
||||
public:
|
||||
OSystem_DS();
|
||||
virtual ~OSystem_DS();
|
||||
|
@ -138,6 +141,8 @@ public:
|
|||
|
||||
virtual Common::String getSystemLanguage() const;
|
||||
|
||||
virtual void engineInit();
|
||||
virtual void engineDone();
|
||||
virtual void quit();
|
||||
|
||||
virtual void setFocusRectangle(const Common::Rect& rect);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue