message("* qt/osd")
-SET(THIS_LIB_VERSION 2.13.0)
+SET(THIS_LIB_VERSION 2.13.1)
set(s_qt_osd_headers
osd_base.h
message("* qt/gui")
-set(THIS_LIB_VERSION 2.15.1)
+set(THIS_LIB_VERSION 2.15.2)
#include(cotire)
#include(PrecompiledHeader)
connect(this, SIGNAL(sig_update_osd()), glv, SLOT(update_osd()), Qt::QueuedConnection);
connect(this, SIGNAL(sig_push_frames_to_avio(int, int, int)), glv->extfunc, SLOT(paintGL_OffScreen(int, int, int)));
+ connect(this, SIGNAL(sig_map_texture()), glv, SLOT(do_map_vram_texture()));
+ connect(this, SIGNAL(sig_unmap_texture()), glv, SLOT(do_unmap_vram_texture()));
+ connect(glv, SIGNAL(sig_map_texture_reply(bool, void *, int, int)), this, SLOT(do_recv_texture_map_status(bool, void *, int, int)));
+ connect(glv, SIGNAL(sig_unmap_texture_reply()), this, SLOT(do_recv_texture_unmap_status()));
+
//connect(this, SIGNAL(sig_call_draw_screen()), p_osd, SLOT(draw_screen()));
//connect(this, SIGNAL(sig_call_no_draw_screen()), p_osd, SLOT(no_draw_screen()));
use_separate_thread_draw = true;
wait_refresh = emu_frame_rate;
bDrawReq = true;
renderSemaphore = new QSemaphore(0);
+ textureMappingSemaphore = new QSemaphore(0);
+ mapping_status = false;
+ mapping_pointer = NULL;
+ mapping_width = 0;
+ mapping_height = 0;
+ mapped_drawn = false;
}
DrawThreadClass::~DrawThreadClass()
while(renderSemaphore->available() <= 0) renderSemaphore->release(1);
delete renderSemaphore;
}
+ if(textureMappingSemaphore != NULL) {
+ while(textureMappingSemaphore->available() <= 0) textureMappingSemaphore->release(1);
+ delete textureMappingSemaphore;
+ }
}
void DrawThreadClass::doDrawMain(bool flag)
{
+ req_map_screen_texture();
p_osd->do_decode_movie(1);
if(flag) {
draw_frames = p_osd->draw_screen();
} else {
draw_frames = p_osd->no_draw_screen();
}
+ req_unmap_screen_texture();
+
emit sig_draw_frames(draw_frames);
}
void DrawThreadClass::doDraw(bool flag)
void DrawThreadClass::do_draw_one_turn(bool _req_draw)
{
- if((_req_draw) && (draw_screen_buffer != NULL)) {
+ if((mapped_drawn) && (_req_draw)) {
+ emit sig_update_screen(NULL);
+ } else if((_req_draw) && (draw_screen_buffer != NULL)) {
emit sig_update_screen(draw_screen_buffer);
} else {
if(ncount == 0) emit sig_update_osd();
rec_frame_width, rec_frame_height);
rec_frame_count = -1;
}
+ mapped_drawn = false;
}
void DrawThreadClass::doWork(const QString ¶m)
rec_frame_count = count;
}
+void DrawThreadClass::req_map_screen_texture()
+{
+ mapping_status = false;
+ mapping_pointer = NULL;
+ mapping_width = 0;
+ mapping_height = 0;
+ if(glv->is_ready_to_map_vram_texture()) {
+ emit sig_map_texture();
+ textureMappingSemaphore->acquire();
+ }
+}
+
+void DrawThreadClass::req_unmap_screen_texture()
+{
+ if(mapping_status) {
+ if(glv->is_ready_to_map_vram_texture()) {
+ emit sig_unmap_texture();
+ textureMappingSemaphore->acquire();
+ }
+ }
+}
+
+void DrawThreadClass::do_recv_texture_map_status(bool f, void *p, int width, int height)
+{
+ mapping_status = f;
+ mapping_pointer = (scrntype_t *)p;
+ mapping_width = width;
+ mapping_height = height;
+ p_osd->do_set_screen_map_texture_address(mapping_pointer, mapping_width, mapping_height);
+ if(mapping_status) {
+ mapped_drawn = true;
+ }
+ textureMappingSemaphore->release(1);
+}
+
+void DrawThreadClass::do_recv_texture_unmap_status(void)
+{
+ mapping_status = false;
+ mapping_pointer = NULL;
+ mapping_width = 0;
+ mapping_height = 0;
+ p_osd->do_set_screen_map_texture_address(mapping_pointer, mapping_width, mapping_height);
+ textureMappingSemaphore->release(1);
+}
CSP_Logger *csp_logger;
int ncount;
double emu_frame_rate;
+
+ bool mapping_status;
+ scrntype_t *mapping_pointer;
+ int mapping_width;
+ int mapping_height;
+ bool mapped_drawn;
void doDrawMain(bool flag);
public:
DrawThreadClass(OSD *o, CSP_Logger *logger, QObject *parent = 0);
~DrawThreadClass();
QSemaphore *renderSemaphore;
+ QSemaphore *textureMappingSemaphore;
void run() { doWork("");}
void SetEmu(EMU *p);
void do_req_encueue_video(int count, int width, int height);
void do_draw_one_turn(bool _req_draw);
void do_set_frames_per_second(double fps);
+ void do_recv_texture_map_status(bool f, void *p, int width, int height);
+ void do_recv_texture_unmap_status(void);
+
+ void req_map_screen_texture();
+ void req_unmap_screen_texture();
signals:
int sig_draw_frames(int);
int message_changed(QString);
int sig_push_frames_to_avio(int, int, int);
int sig_call_draw_screen();
int sig_call_no_draw_screen();
+ int sig_map_texture();
+ int sig_unmap_texture();
};
QT_END_NAMESPACE
}
}
}
+ virtual scrntype_t *get_screen_buffer(int y) { return NULL; }
+ virtual void get_screen_geometry(int *w, int *h) {
+ if(w != NULL) *w = 0;
+ if(h != NULL) *h = 0;
+ }
+ virtual bool is_ready_to_map_vram_texture(void) { return false; }
+ virtual bool map_vram_texture(void) { return false; }
+ virtual bool unmap_vram_texture(void) { return false; }
public slots:
virtual void paintGL(void) { }
virtual void resizeGL(int width, int height) { }
virtual void do_set_display_osd(bool onoff) { }
virtual void do_display_osd_leds(int lednum, bool onoff) { }
virtual void do_set_led_width(int bitwidth) { }
+
signals:
int sig_push_image_to_movie(int, int, int, QImage *);
};
} else {
uploadMainTexture(imgptr, false);
}
- crt_flag = true;
p_wid->doneCurrent();
}
+ crt_flag = true;
}
void GLDraw_4_3::set_texture_vertex(float wmul, float hmul)
{
run_vm = false;
}
+
+void GLDrawClass::do_map_vram_texture()
+{
+ bool stat = false;
+ int w = 0;
+ int h = 0;
+ void *p = NULL;
+ if(extfunc != NULL) {
+ if(extfunc->is_ready_to_map_vram_texture()) {
+ this->makeCurrent();
+ stat = extfunc->map_vram_texture();
+ if(stat) {
+ extfunc->get_screen_geometry(&w, &h);
+ p = extfunc->get_screen_buffer(0);
+ }
+ }
+ }
+ emit sig_map_texture_reply(stat, p, w, h);
+}
+
+void GLDrawClass::do_unmap_vram_texture()
+{
+ if(extfunc != NULL) {
+ if(extfunc->is_ready_to_map_vram_texture()) {
+ extfunc->unmap_vram_texture();
+ this->doneCurrent();
+ }
+ }
+ emit sig_unmap_texture_reply();
+}
+
+const bool GLDrawClass::is_ready_to_map_vram_texture(void)
+{
+ if(extfunc == NULL) return false;
+ return extfunc->is_ready_to_map_vram_texture();
+}
uint32_t get_scan_from_index(int index);
const char *get_key_vk_name(int index);
quint32 getModState(void) { return modifier;}
- quint32 modifier;
+
void InitFBO(void);
void closeEvent(QCloseEvent *event);
void drawUpdateTexture(bitmap_t *p);
QString logGLString(bool getExtensions = false);
bool emu_launched;
+ quint32 modifier;
+
+ const bool is_ready_to_map_vram_texture(void);
+
public slots:
void initKeyCode(void);
void releaseKeyCode(void);
void do_update_icon(int icon_type, int localnum, QPixmap *p);
void do_update_icon(int icon_type, int localnum, QString message, QColor bg, QColor fg, QColor fg2, QColor fg3, QColor lg, QColor tg, float pt);
+ void do_map_vram_texture();
+ void do_unmap_vram_texture();
signals:
void update_screenChanged(int tick);
void do_notify_move_mouse(int x, int y);
int sig_set_display_osd(bool);
int sig_display_osd_leds(int,bool);
int sig_resize_osd(int);
+
+ int sig_map_texture_reply(bool, void *, int, int);
+ int sig_unmap_texture_reply();
};
#endif // End.
max_vm_nodes = 0;
p_logger = logger;
+ mapped_screen_pointer = NULL;
+ mapped_screen_width = 0;
+ mapped_screen_height = 0;
+ mapped_screen_status = false;
SupportedFeatures.clear();
}
virtual void initialize_video();
virtual void release_video();
+ scrntype_t *mapped_screen_pointer;
+ int mapped_screen_width;
+ int mapped_screen_height;
+ bool mapped_screen_status;
bitmap_t dshow_screen_buffer;
int direct_show_width, direct_show_height;
bool direct_show_mute[2];
int draw_screen();
int no_draw_screen();
void do_draw(bool flag);
+ void do_set_screen_map_texture_address(scrntype_t *p, int width, int height);
signals:
int sig_update_screen(bitmap_t *);
scrntype_t* OSD_BASE::get_vm_screen_buffer(int y)
{
+ if(mapped_screen_status) {
+ if((mapped_screen_width > 0) && (mapped_screen_pointer != NULL)){
+ if(y < mapped_screen_height) {
+ int offset = y * mapped_screen_width;
+ uint8_t *p = (uint8_t *)mapped_screen_pointer;
+ p = p + offset;
+ return (scrntype_t *)p;
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+ }
return get_buffer(&vm_screen_buffer, y);
}
return (scrntype_t *)p->pImage.scanLine(y);
}
+void OSD_BASE::do_set_screen_map_texture_address(scrntype_t *p, int width, int height)
+{
+ if((p != NULL) && (width > 0) && (height > 0)) {
+ mapped_screen_pointer = p;
+ mapped_screen_width = width;
+ mapped_screen_height = height;
+ mapped_screen_status = true;
+ } else {
+ mapped_screen_pointer = NULL;
+ mapped_screen_width = 0;
+ mapped_screen_height = 0;
+ mapped_screen_status = false;
+ }
+}
+
int OSD_BASE::draw_screen()
{
// draw screen