mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
QDENGINE: Initial code for saving thumbnails in ExtendedSaves
This commit is contained in:
parent
f17b503ad9
commit
309f050e4f
@ -19,9 +19,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
#include "qdengine/metaengine.h"
|
||||
#include "qdengine/qdengine.h"
|
||||
#include "qdengine/qdcore/qd_game_dispatcher.h"
|
||||
|
||||
const char *QDEngineMetaEngine::getName() const {
|
||||
return "qdengine";
|
||||
@ -43,6 +44,12 @@ bool QDEngineMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||
(f == kSupportsLoadingDuringStartup);
|
||||
}
|
||||
|
||||
void QDEngineMetaEngine::getSavegameThumbnail(Graphics::Surface &thumb) {
|
||||
QDEngine::qdGameDispatcher *dp = QDEngine::qdGameDispatcher::get_dispatcher();
|
||||
if (dp)
|
||||
dp->game_screenshot(thumb);
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(QDENGINE)
|
||||
REGISTER_PLUGIN_DYNAMIC(QDENGINE, PLUGIN_TYPE_ENGINE, QDEngineMetaEngine);
|
||||
#else
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
* Used by e.g. the launcher to determine whether to enable the Load button.
|
||||
*/
|
||||
bool hasFeature(MetaEngineFeature f) const override;
|
||||
|
||||
virtual void getSavegameThumbnail(Graphics::Surface &thumb) override;
|
||||
};
|
||||
|
||||
#endif // QDENGINE_METAENGINE_H
|
||||
|
@ -2912,11 +2912,38 @@ const char *qdGameDispatcher::get_save_name(int slot_id, SaveFileType file_type)
|
||||
return file_name.c_str();
|
||||
}
|
||||
|
||||
bool qdGameDispatcher::game_screenshot(Graphics::Surface &thumb) const {
|
||||
int w = qdGameConfig::get_config().screen_sx();
|
||||
int h = qdGameConfig::get_config().screen_sy();
|
||||
|
||||
thumb.create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
|
||||
|
||||
if (qdGameScene * sp = get_active_scene()) {
|
||||
qdSprite sprite(w, h, GR_RGB565);
|
||||
|
||||
sp->redraw();
|
||||
|
||||
uint16 col;
|
||||
for (int i = 0; i < h; i++) {
|
||||
uint16 *dst = (uint16 *)thumb.getBasePtr(0, i);
|
||||
for (int j = 0; j < w; j++) {
|
||||
grDispatcher::instance()->GetPixel(j, i, col);
|
||||
*dst = col;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool qdGameDispatcher::game_screenshot(const char *file_name, int sx, int sy) const {
|
||||
if (qdGameScene * sp = get_active_scene()) {
|
||||
qdSprite sprite(qdGameConfig::get_config().screen_sx(),
|
||||
qdGameConfig::get_config().screen_sy(),
|
||||
GR_RGB888);
|
||||
GR_RGB565);
|
||||
|
||||
sp->redraw();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user