for(i = 0; i < (int)using_flags->get_max_drive(); i++) {
tmpstr.clear();
alamp.clear();
+ lamp_stat = false;
if(p_emu->is_floppy_disk_inserted(i)) {
if(i == (access_drv - 1)) {
lamp_stat = true;
fd_lamp[i] = alamp;
}
if(tmpstr != fd_text[i]) {
+ emit sig_set_access_lamp(i + 2, lamp_stat);
emit sig_change_osd(CSP_DockDisks_Domain_FD, i, tmpstr);
fd_text[i] = tmpstr;
}
access_drv = p_emu->is_quick_disk_accessed();
for(i = 0; i < using_flags->get_max_qd(); i++) {
tmpstr.clear();
+ lamp_stat = false;
if(p_emu->is_quick_disk_inserted(i)) {
if(i == (access_drv - 1)) {
alamp = QString::fromUtf8("<FONT COLOR=RED>●</FONT>"); // 💽 U+1F4BD MiniDisc
void EmuThreadClass::get_tape_string()
{
QString tmpstr;
-
+ bool readwrite;
+ bool inserted;
#if defined(USE_TAPE1) && !defined(TAPE_BINARY_ONLY)
for(int i = 0; i < MAX_TAPE; i++) {
- if(p_emu->is_tape_inserted(i)) {
+ inserted = p_emu->is_tape_inserted(i);
+ readwrite = false;
+ if(inserted) {
tmpstr.clear();
const _TCHAR *ts = p_emu->get_tape_message(i);
if(ts != NULL) {
tmpstr = QString::fromUtf8(ts);
- if(p_emu->is_tape_recording(i)) {
+ readwrite = p_emu->is_tape_recording(i);
+ if(readwrite) {
tmpstr = QString::fromUtf8("<FONT COLOR=RED><B>") + tmpstr + QString::fromUtf8("</B></FONT>");
} else {
tmpstr = QString::fromUtf8("<FONT COLOR=GREEN><B>") + tmpstr + QString::fromUtf8("</B></FONT>");
tmpstr = QString::fromUtf8("<FONT COLOR=BLUE> EMPTY </FONT>");
}
if(tmpstr != cmt_text[i]) {
+ //emit sig_set_access_lamp(i + 12 + ((readwrite) ? 2 : 0), inserted);
emit sig_change_osd(CSP_DockDisks_Domain_CMT, i, tmpstr);
cmt_text[i] = tmpstr;
}
for(int i = 0; i < 32; i++) {
led_pass_vao[i] = NULL;
led_pass_vbuffer[i] = NULL;
+ osd_pass_vao[i] = NULL;
+ osd_pass_vbuffer[i] = NULL;
}
grids_horizonal_buffer = NULL;
grids_horizonal_vertex = NULL;
for(int i = 0; i < 32; i++) {
if(led_pass_vao[i] != NULL) delete led_pass_vao[i];
if(led_pass_vbuffer[i] != NULL) delete led_pass_vbuffer[i];
+ if(osd_pass_vao[i] != NULL) delete osd_pass_vao[i];
+ if(osd_pass_vbuffer[i] != NULL) delete osd_pass_vbuffer[i];
}
if(grids_horizonal_buffer != NULL) {
}
}
}
+ initPackedGLObject(&osd_pass,
+ 48.0, 48.0,
+ ":/vertex_shader.glsl" , ":/chromakey_fragment_shader.glsl",
+ "OSD Shader");
+ for(int i = 0; i < 32; i++) {
+ osd_pass_vao[i] = new QOpenGLVertexArrayObject;
+ osd_pass_vbuffer[i] = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer);
+ if(osd_pass_vao[i]->create()) {
+ if(osd_pass_vbuffer[i]->create()) {
+ osd_pass_vbuffer[i]->setUsagePattern(QOpenGLBuffer::DynamicDraw);
+ osd_pass_vao[i]->bind();
+ osd_pass_vbuffer[i]->bind();
+ osd_pass_vbuffer[i]->allocate(sizeof(VertexTexCoord_t) * 4);
+ osd_pass_vbuffer[i]->release();
+ osd_pass_vao[i]->release();
+ set_osd_vertex(i);
+ }
+ }
+ }
initPackedGLObject(&ntsc_pass1,
_width, _height,
}
+
void GLDraw_3_0::drawOsdLeds()
{
QVector4D color_on;
color_off = QVector4D(0.00,0.00, 0.00, 0.0);
}
if(osd_onoff) {
- if(osd_led_status_bak != osd_led_status) {
+ //if(osd_led_status_bak != osd_led_status) {
for(int i = 0; i < osd_led_bit_width; i++) {
if((bit & osd_led_status) == (bit & osd_led_status_bak)) {
bit <<= 1;
bit <<= 1;
}
osd_led_status_bak = osd_led_status;
- }
+ //}
+ }
+}
+
+void GLDraw_3_0::drawOsdIcons()
+{
+ QVector4D color_on;
+ QVector4D color_off;
+ uint32_t bit = 0x00000001;
+ if(osd_onoff) {
+ color_on = QVector4D(1.0, 1.0, 1.0, 0.3);
+ color_off = QVector4D(1.0, 1.0, 1.0, 0.05);
+ } else {
+ color_on = QVector4D(0.00,0.00, 0.00, 0.0);
+ color_off = QVector4D(0.00,0.00, 0.00, 0.0);
+ }
+ if(osd_onoff) {
+ int major, minor;
+ //if(osd_led_status_bak != osd_led_status) {
+ for(int i = 0; i < osd_led_bit_width; i++) {
+ if((bit & osd_led_status) == (bit & osd_led_status_bak)) {
+ if((bit & osd_led_status) == 0) {
+ bit <<= 1;
+ continue;
+ }
+ }
+ if((i >= 2) && (i < 10)) { // FD
+ major = 1;
+ minor = i - 2;
+ } else if((i >= 10) && (i < 12)) { // QD
+ major = 3;
+ minor = i - 10;
+ } else if((i >= 12) && (i < 14)) { // CMT(R)
+ major = 4;
+ minor = i - 12;
+ } else if((i >= 14) && (i < 16)) { // CMT(W)
+ major = 5;
+ minor = i - 14;
+ } else {
+ major = 0;
+ minor = 0;
+ }
+ if(major != 0) {
+ drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i],
+ icon_texid[major][minor],
+ ((osd_led_status & bit) != 0) ? color_on : color_off,
+ false, false, QVector3D(0.0, 0.0, 0.0));
+ }
+ bit <<= 1;
+ }
+ osd_led_status_bak = osd_led_status;
+ //}
}
}
{
//p_wid->makeCurrent();
- if(crt_flag || redraw_required) { //return;
+// if(crt_flag || redraw_required) { //return;
if(emu_launched) {
crt_flag = false;
}
drawButtons();
}
drawScreenTexture();
+ extfunc->glEnable(GL_BLEND);
+ extfunc->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ extfunc->glDisable(GL_DEPTH_TEST);
+ //drawOsdLeds();
+ drawOsdIcons();
extfunc->glDisable(GL_BLEND);
if(!using_flags->is_use_one_board_computer() && (using_flags->get_max_button() <= 0)) {
drawGrids();
}
- drawOsdLeds();
extfunc->glFlush();
- } else {
- extfunc->glViewport(0, 0, p_wid->width(), p_wid->height());
- extfunc->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
- drawOsdLeds();
- extfunc->glFlush();
- }
+// } else {
+// extfunc->glViewport(0, 0, p_wid->width(), p_wid->height());
+/// extfunc->glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0, 1.0);
+// //drawOsdLeds();
+// extfunc->glClear(GL_DEPTH_BUFFER_BIT);
+// extfunc->glEnable(GL_DEPTH_TEST);
+// extfunc->glEnable(GL_BLEND);
+// //drawOsdLeds();
+// drawOsdIcons();
+// extfunc->glFlush();
+// }
//p_wid->doneCurrent();
}
vertexTmpTexture[3].t = hmul;
}
+
+void GLDraw_3_0::set_osd_vertex(int xbit)
+{
+ float xbase, ybase, zbase;
+ VertexTexCoord_t vertex[4];
+ int major, minor, nl;
+ int i = xbit;
+ if((xbit < 0) || (xbit >= 32)) return;
+ if((i >= 2) && (i < 10)) { // FD
+ major = 0;
+ minor = i - 2;
+ nl = using_flags->get_max_drive();
+ } else if((i >= 10) && (i < 12)) { // QD
+ major = 2;
+ minor = i - 10;
+ nl = using_flags->get_max_qd();
+ } else if((i >= 12) && (i < 14)) { // CMT(R)
+ major = 1;
+ minor = i - 12;
+ nl = using_flags->get_max_tape();
+ } else if((i >= 14) && (i < 16)) { // CMT(W)
+ major = 1;
+ minor = i - 14;
+ nl = using_flags->get_max_tape();
+ } else if(i >= 16) {
+ major = 4 + (i / 8) - 2;
+ minor = i % 8;
+ nl = 8;
+ } else {
+ major = 6;
+ minor = i;
+ nl = 2;
+ }
+ xbase = 1.0f - (1.0f * 48.0f / 640.0f) * (float)(nl - minor) - (4.0f / 640.0f);;
+ ybase = -1.0f + (1.0f * 48.0f / 400.0f) * (float)(major + 1) + (4.0f / 400.0f);
+ zbase = -0.998f;
+ vertex[0].x = xbase;
+ vertex[0].y = ybase;
+ vertex[0].z = zbase;
+ vertex[0].s = 0.0f;
+ vertex[0].t = 1.0f;
+
+ vertex[1].x = xbase + (48.0f / 640.0f);
+ vertex[1].y = ybase;
+ vertex[1].z = zbase;
+ vertex[1].s = 1.0f;
+ vertex[1].t = 1.0f;
+
+ vertex[2].x = xbase + (48.0f / 640.0f);
+ vertex[2].y = ybase - (48.0f / 400.0f);
+ vertex[2].z = zbase;
+ vertex[2].s = 1.0f;
+ vertex[2].t = 0.0f;
+
+ vertex[3].x = xbase;
+ vertex[3].y = ybase - (48.0f / 400.0f);
+ vertex[3].z = zbase;
+ vertex[3].s = 0.0f;
+ vertex[3].t = 0.0f;
+
+ setNormalVAO(osd_pass->getShader(), osd_pass_vao[xbit],
+ osd_pass_vbuffer[xbit],
+ vertex, 4);
+}
+
void GLDraw_3_0::set_led_vertex(int xbit)
{
float xbase, ybase, zbase;
GLuint texid = icon_texid[icon_type][localnum];
icon_uploaded[icon_type][localnum] = true;
- if(texid == 0) {
- icon_texid[icon_type][localnum] = p_wid->bindTexture(*p);
- texid = icon_texid[icon_type][localnum];
- }
- printf("TYPE=%d LOCALNUM=%d TEXID=%d\n", icon_type, localnum, texid);
+ if(texid != 0) p_wid->deleteTexture(texid);
{
- // Upload to main texture
- extfunc->glBindTexture(GL_TEXTURE_2D, texid);
- extfunc->glTexSubImage2D(GL_TEXTURE_2D, 0,
- 0, 0,
- image.width(), image.height(),
- GL_BGRA, GL_UNSIGNED_BYTE, image.constBits());
- extfunc->glBindTexture(GL_TEXTURE_2D, 0);
+ icon_texid[icon_type][localnum] = p_wid->bindTexture(image);
}
+ texid = icon_texid[icon_type][localnum];
+ printf("TYPE=%d LOCALNUM=%d TEXID=%d w=%d h=%d\n", icon_type, localnum, texid, image.width(), image.height());
p_wid->doneCurrent();
}