Commit eafe37b8 authored by David Skywalker's avatar David Skywalker
Browse files

new KeyboardOn Screen code added!

parent 5ca57f5c
......@@ -7,4 +7,5 @@
*.rej
*.log
# editors
.vscode
\ No newline at end of file
.vscode
.venv
\ No newline at end of file
......@@ -24,12 +24,17 @@ SOURCES_C := \
$(CORE_DIR)/cap32/libcpccat/fs.c \
$(CORE_DIR)/cap32/kbdauto.c \
$(CORE_DIR)/libretro/microui/microui.c \
$(CORE_DIR)/libretro/gfx/software.c \
$(CORE_DIR)/libretro/assets/ui_keyboard.c \
$(CORE_DIR)/libretro/assets/font.c \
$(CORE_DIR)/libretro/retro_strings.c \
$(CORE_DIR)/libretro/retro_utils.c \
$(CORE_DIR)/libretro/retro_disk_control.c \
$(CORE_DIR)/libretro/retro_events.c \
$(CORE_DIR)/libretro/retro_snd.c \
$(CORE_DIR)/libretro/retro_graph.c
$(CORE_DIR)/libretro/retro_render.c \
$(CORE_DIR)/libretro/retro_ui.c \
$(CORE_DIR)/libretro/retro_keyboard.c
SOURCES_C += \
$(DEPS)/zlib/adler32.c \
......
......@@ -175,6 +175,7 @@ int HandleExtension(char *path,char *ext);
#include "libretro-core.h"
#include "retro_snd.h"
#include "retro_ui.h"
#include "retro_utils.h"
extern unsigned int bmp[WINDOW_MAX_SIZE];
......@@ -945,10 +946,12 @@ void z80_OUT_handler (reg_pair port, uint8_t val)
if ((port.b.h == 0xfa) && (!(port.b.l & 0x80))) { // floppy motor control?
//printf("FDC motor control access: %u - %u\n", (int) port.b.l, (int) val);
FDC.motor = val & 0x01;
if(FDC.motor)
if(FDC.motor) {
retro_snd_cmd(SND_FDCMOTOR, ST_LOOP);
else
retro_show_statusbar();
} else {
retro_snd_cmd(SND_FDCMOTOR, ST_OFF);
}
#ifdef DEBUG_FDC
fputs(FDC.motor ? "\r\n--- motor on" : "\r\n--- motor off", pfoDebug);
#endif
......
......@@ -61,7 +61,7 @@ extern FILE *pfoDebug;
#define MAX_SYNC_DEC 80
#define MAX_SYNC_INC 80
#define MAX_DRAWN 270 // Max displayed scan line (+1)
#define MAX_DRAWN 272
#define MIN_VHOLD 250
#define MAX_VHOLD 380
......
......@@ -54,6 +54,7 @@
#include "z80.h"
#include "retro_snd.h"
#include "retro_ui.h"
extern t_CPC CPC;
extern t_FDC FDC;
......@@ -723,6 +724,7 @@ uint8_t fdc_read_data(void)
FDC.byte_count = 0; // clear byte counter
FDC.phase = CMD_PHASE; // switch to command phase
FDC.led = 0; // turn the drive LED off
retro_ui_set_led(false);
}
break;
}
......@@ -865,6 +867,8 @@ void fdc_readtrk(void)
void fdc_write(void)
{
retro_ui_set_led(true);
FDC.led = 1; // turn the drive LED on
check_unit(); // switch to target drive
if (init_status_regs() == 0) { // drive Ready?
......@@ -906,6 +910,8 @@ void fdc_write(void)
void fdc_read(void)
{
retro_snd_cmd(SND_FDCREAD, ST_ON);
retro_ui_set_led(true);
FDC.led = 1; // turn the drive LED on
check_unit(); // switch to target drive
if (init_status_regs() == 0) { // drive Ready?
......@@ -1010,6 +1016,8 @@ void fdc_writeID(void)
void fdc_scan(void)
{
retro_ui_set_led(true);
FDC.led = 1; // turn the drive LED on
check_unit(); // switch to target drive
if (init_status_regs() == 0)
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple PNG to bit-font converter
Copyright (C) 2020 David Colmenero - D_Skywalk
http://david.dantoine.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
higher any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""
import sys
from PIL import Image
import numpy as np
BLACK = [0, 0, 0]
def is_black(data, mode):
if mode == "RGBA":
(r, g, b, a) = data
return [r, g, b] == BLACK
else:
(r, g, b) = data
return [r, g, b] == BLACK
def open(filename):
img = Image.open(filename)
im_array = np.array(img)
(width, height) = img.size
mode = img.mode
# print("pix", is_black(im_array[0][0], mode))
print ("static unsigned char bFont[] = {")
for y in range(0, height):
data = 0
for x in range(0, width):
if not is_black(im_array[y][x], mode):
data |= 1
data <<= 1
data >>= 1
print("0x%02X, " % data, end='')
if y % 16 == 0:
print("")
if __name__ == '__main__':
if len(sys.argv) != 2:
print("error $> convert.py image.png")
open(sys.argv[1])
#ifndef __FONT_H__
#define __FONT_H__
#define FNT_MIN_CHAR 32
#define FNT_MAX_CHAR 126
#define FNT_CHAR_WIDTH 8
#define FNT_CHAR_HEIGHT 8
#define BITS_IN_BYTE 8
unsigned char font[] = {
0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00,
0x00, 0x6C, 0x24, 0x48, 0x00, 0x00, 0x00, 0x00, 0x24, 0x7E, 0x24, 0x24, 0x7E, 0x24, 0x00, 0x00,
0x10, 0x3C, 0x40, 0x38, 0x04, 0x78, 0x10, 0x00, 0x44, 0x08, 0x10, 0x20, 0x44, 0x00, 0x00, 0x00,
0x20, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08,
0x10, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, 0x10, 0x08, 0x04, 0x04, 0x04, 0x08, 0x10, 0x00, 0x00,
0x28, 0x10, 0x7C, 0x10, 0x28, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
0x38, 0x44, 0x54, 0x54, 0x44, 0x38, 0x00, 0x00, 0x10, 0x70, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00,
0x38, 0x44, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x00, 0x7C, 0x08, 0x18, 0x04, 0x44, 0x38, 0x00, 0x00,
0x0C, 0x14, 0x24, 0x7C, 0x04, 0x04, 0x00, 0x00, 0x7C, 0x40, 0x78, 0x04, 0x44, 0x38, 0x00, 0x00,
0x38, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x00, 0x7C, 0x04, 0x08, 0x10, 0x10, 0x10, 0x00, 0x00,
0x38, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00, 0x00,
0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x08, 0x10, 0x00, 0x08,
0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x10,
0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x00, 0x00, 0x38, 0x44, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00,
0x38, 0x44, 0x54, 0x5C, 0x40, 0x38, 0x00, 0x00, 0x38, 0x44, 0x44, 0x7C, 0x44, 0x44, 0x00, 0x00,
0x78, 0x44, 0x78, 0x44, 0x44, 0x78, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x44, 0x38, 0x00, 0x00,
0x70, 0x48, 0x44, 0x44, 0x48, 0x70, 0x00, 0x00, 0x7C, 0x40, 0x78, 0x40, 0x40, 0x7C, 0x00, 0x00,
0x7C, 0x40, 0x70, 0x40, 0x40, 0x40, 0x00, 0x00, 0x38, 0x40, 0x4C, 0x44, 0x44, 0x3C, 0x00, 0x00,
0x44, 0x44, 0x7C, 0x44, 0x44, 0x44, 0x00, 0x00, 0x7C, 0x10, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00,
0x1C, 0x04, 0x04, 0x04, 0x44, 0x38, 0x00, 0x00, 0x44, 0x48, 0x70, 0x48, 0x44, 0x44, 0x00, 0x00,
0x40, 0x40, 0x40, 0x40, 0x44, 0x7C, 0x00, 0x00, 0x44, 0x6C, 0x54, 0x44, 0x44, 0x44, 0x00, 0x00,
0x44, 0x64, 0x54, 0x4C, 0x44, 0x44, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00,
0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, 0x00, 0x38, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x00,
0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x00, 0x00, 0x38, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, 0x00,
0x7C, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00,
0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x44, 0x44, 0x54, 0x54, 0x28, 0x28, 0x00, 0x00,
0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x00, 0x00,
0x7C, 0x08, 0x10, 0x20, 0x40, 0x7C, 0x00, 0x00, 0x38, 0x20, 0x20, 0x20, 0x20, 0x38, 0x00, 0x00,
0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00,
0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00,
0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x44, 0x3A, 0x00, 0x40,
0x40, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, 0x38, 0x44, 0x40, 0x40, 0x3C, 0x00, 0x04,
0x04, 0x3C, 0x44, 0x44, 0x44, 0x3C, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7C, 0x40, 0x3C, 0x00, 0x18,
0x20, 0x20, 0x30, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x40,
0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00, 0x00,
0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x70, 0x40, 0x40, 0x44, 0x48, 0x70, 0x48, 0x44, 0x00, 0x30,
0x10, 0x10, 0x10, 0x10, 0x10, 0x7C, 0x00, 0x00, 0x00, 0xFC, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00,
0x00, 0xB8, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00,
0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x00, 0x00, 0x3C, 0x44, 0x44, 0x3C, 0x04, 0x04, 0x00,
0x00, 0x38, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x38, 0x40, 0x38, 0x04, 0x78, 0x00, 0x00,
0x10, 0x7C, 0x10, 0x10, 0x10, 0x0C, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x3A, 0x00, 0x00,
0x00, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x44, 0x54, 0x54, 0x54, 0x28, 0x00, 0x00,
0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3C, 0x04, 0x38, 0x00,
0x00, 0x7C, 0x08, 0x10, 0x20, 0x7C, 0x00, 0x18, 0x20, 0x20, 0x40, 0x20, 0x20, 0x18, 0x00, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x60, 0x10, 0x10, 0x08, 0x10, 0x10, 0x60, 0x00, 0x80,
0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xE0, 0x90
};
#endif //__XBM_FONT_H__
/*
This file was autogenerated by raw2c.
Visit http://www.devkitpro.org
*/
//---------------------------------------------------------------------------------
#ifndef _ui_h_
#define _ui_h_
//---------------------------------------------------------------------------------
#define IMG_KEYBOARD_WIDTH 384
#define IMG_KEYBOARD_HEIGHT 108
extern const unsigned char ui_keyboard_data[];
extern const int ui_keyboard_size;
//--------------------------------------------------------------------
#define FNT_MIN_CHAR 32
#define FNT_MAX_CHAR 126
#define FNT_CHAR_WIDTH 6
#define FNT_CHAR_HEIGHT 8
#define BITS_IN_BYTE 8
extern const unsigned char font[];
//---------------------------------------------------------------------------------
#endif //_ui_h_
//---------------------------------------------------------------------------------
This diff is collapsed.
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <libretro.h>
#include <libretro-core.h>
#include "assets/ui.h"
#include "software.h"
// FIXME PIXEL_BYTES
#define DATA2BLUE5(colour) (((colour>>3) & 0x1F))
#define DATA2GREEN6(colour) (((colour>>2) & 0x3F) << 5)
#define DATA2RED5(colour) (((colour>>3) & 0x1F) << 11)
#define DATA2BLUE(colour) ((colour >> 16) & 0xFF)
#define DATA2GREEN(colour) ((colour >> 8) & 0xFF)
#define DATA2RED(colour) (colour & 0xFF)
#ifdef LOWRES
#define DRAW2BUFFER(buffer, img) *(buffer++) = *(img++);
#else
#define DRAW2BUFFER(buffer, img) \
{ \
*(buffer++) = *img; \
*(buffer++) = *(img++); \
}
#endif
//#endif
PIXEL_TYPE convert_color (unsigned int colour)
{
#ifdef M16B
return (
DATA2RED5(DATA2RED(colour))
| DATA2GREEN6(DATA2GREEN(colour))
| DATA2BLUE5(DATA2BLUE(colour))
);
#else
return (
( DATA2RED(colour) << 16)
| (colour & 0x00FF00)
| DATA2BLUE(colour)
);
#endif
}
void draw_line(PIXEL_TYPE * buffer, int x, int y, int width, PIXEL_TYPE color)
{
buffer = (buffer + x) + (y * EMULATION_SCREEN_WIDTH);
while (width--) {
*(buffer++) = color;
}
}
void draw_rect(PIXEL_TYPE * buffer, int x, int y, int width, int height, PIXEL_TYPE color)
{
buffer = (buffer + x) + (y * EMULATION_SCREEN_WIDTH);
while (height--)
{
int loop_width = width;
while (loop_width--)
*(buffer++) = color;
buffer += EMULATION_SCREEN_WIDTH - width;
}
}
// M16B
static void _draw_char(PIXEL_TYPE * buffer, const unsigned char *font_data, PIXEL_TYPE color)
{
int height = FNT_CHAR_HEIGHT;
while (height--)
{
unsigned char data = *font_data; // get the bitmap information for one row
int loop_width = FNT_CHAR_WIDTH;
while (loop_width--)
{
if (data & 0x80) // is the bit set?
{
if( EMULATION_SCALE == 2)
*(buffer++) = color;
*(buffer++) = color; // draw the character pixel
}
else
{
buffer += EMULATION_SCALE;
}
data <<= 1; // advance to the next bit
}
font_data ++;
buffer += EMULATION_SCREEN_WIDTH - (FNT_CHAR_WIDTH * EMULATION_SCALE);
}
}
void draw_char(PIXEL_TYPE * buffer, int x, int y, char chr_idx, PIXEL_TYPE color)
{
buffer = (buffer + x) + (y * EMULATION_SCREEN_WIDTH);
chr_idx -= FNT_MIN_CHAR; // zero base the index
_draw_char(buffer, &font[chr_idx * BITS_IN_BYTE], color);
}
void draw_text(PIXEL_TYPE * buffer, int x, int y, const char *text, PIXEL_TYPE color)
{
int len = strlen(text); // number of characters to process
char *ptr_text = (char *) text;
buffer = (buffer + x) + (y * EMULATION_SCREEN_WIDTH);
while(len--)
{
unsigned int chr_idx = *ptr_text;
if ((chr_idx < FNT_MIN_CHAR) || (chr_idx > FNT_MAX_CHAR)) { // limit it to the range of chars in the font
chr_idx = FNT_MIN_CHAR;
}
chr_idx -= FNT_MIN_CHAR; // zero base the index
_draw_char(buffer, &font[chr_idx * BITS_IN_BYTE], color);
ptr_text++;
buffer += FNT_CHAR_WIDTH * EMULATION_SCALE;
}
}
// base image in u_int32
void convert_image(PIXEL_TYPE * buffer, const unsigned int * img, unsigned int size)
{
while (size--)
{
#ifndef LOWRES
*(buffer++) = convert_color(*img);
#endif
*(buffer++) = convert_color(*(img++));
}
}
// create linear version ??
void draw_image(PIXEL_TYPE * buffer, PIXEL_TYPE * img, int x, int y, int width, int height)
{
buffer = (buffer + x) + (y * EMULATION_SCREEN_WIDTH);
while (height--)
{
int loop_width = width;
while (loop_width--)
{
DRAW2BUFFER(buffer, img);
}
buffer += EMULATION_SCREEN_WIDTH - (width * EMULATION_SCALE);
}
}
void draw_image_linear(PIXEL_TYPE * buffer, PIXEL_TYPE * img, int x, int y, unsigned int size)
{
uint32_t * buffer_ptr = (uint32_t *) (
(PIXEL_TYPE *) (buffer + x) + (y * EMULATION_SCREEN_WIDTH)
);
uint32_t * img_ptr = (uint32_t *) img;
unsigned int loop_counter = (EMULATION_SCALE * size) / PIXEL_RAW_DENSITY;
while (loop_counter--)
{
*(buffer_ptr++) = *(img_ptr++);
}
}
/* Copyright (C) 2018
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef GFX_SOFTWARE_H__
#define GFX_SOFTWARE_H__
#include <stdint.h>
#include <stdbool.h>
//*****************************************************************************
// Graph helpers functions
void draw_line(PIXEL_TYPE * buffer, int x, int y, int width, PIXEL_TYPE color);
void draw_rect(PIXEL_TYPE * buffer, int x, int y, int width, int height, PIXEL_TYPE color);
void draw_text(PIXEL_TYPE * buffer, int x, int y, const char * text, PIXEL_TYPE color);
void draw_char(PIXEL_TYPE * buffer, int x, int y, char chr_idx, PIXEL_TYPE color);
void draw_image(PIXEL_TYPE * buffer, PIXEL_TYPE * img, int x, int y, int width, int height);
void draw_image_linear(PIXEL_TYPE * buffer, PIXEL_TYPE * img, int x, int y, unsigned int size);
void convert_image(PIXEL_TYPE * buffer, const unsigned int * img, unsigned int size);
PIXEL_TYPE convert_color (unsigned int color);
#endif
......@@ -7,7 +7,11 @@
#include "retro_events.h"
#include "retro_utils.h"
#include "retro_snd.h"
#include "retro_graph.h"
#include "retro_render.h"
#include "retro_ui.h"
#include "gfx/software.h"
#include "assets/ui.h"
//CORE VAR
#ifdef _WIN32
......@@ -74,7 +78,6 @@ extern void Screen_SetFullUpdate(int scr);
PIXEL_TYPE video_buffer[WINDOW_MAX_SIZE];
PIXEL_TYPE bmp[WINDOW_MAX_SIZE];
uint32_t save_Screen[WINDOW_MAX_SIZE];
mu_Context *ctx;
int32_t* audio_buffer = NULL;
int audio_buffer_size = 0;
......@@ -82,8 +85,8 @@ int audio_buffer_size = 0;
//PATH
char RPATH[512];
int pauseg = 0; //enter_gui
int showkeyb = 0;
// almost deprecated
int pauseg = 0;
int autorun = 0;
int SND=1;
int SHIFTON=-1;
......@@ -94,7 +97,6 @@ int gfx_buffer_size = 0;
unsigned amstrad_devices[ 2 ];
int emu_status = COMPUTER_OFF;
int gui_status = GUI_DISABLED;
//CAP32 DEF BEGIN
#include "cap32.h"
......@@ -120,6 +122,14 @@ static retro_video_refresh_t video_cb;
static retro_audio_sample_t audio_cb;
/*static*/ retro_audio_sample_batch_t audio_batch_cb;
/*static*/ retro_environment_t environ_cb;
/*static*/ retro_mouse_t mouse =
{
EMULATION_SCREEN_WIDTH/2,
EMULATION_SCREEN_WIDTH/2,
EMULATION_SCREEN_HEIGHT/2 + EMULATION_SCREEN_HEIGHT/4,
EMULATION_SCREEN_HEIGHT/2 + EMULATION_SCREEN_HEIGHT/4,
0, 0, 0
};
// allowed file types
#define CDT_FILE_EXT "cdt"
......@@ -410,11 +420,11 @@ void retro_set_environment(retro_environment_t cb)
"Internal resolution; 384x272|768x272",
#endif
},
#endif
{
"cap32_statusbar", // unused - but i try to implement in a future
"Status Bar; disabled|enabled",
"cap32_statusbar",
"Status Bar; onloading|enabled|disabled",
},
#endif
{
"cap32_scr_tube",
"Monitor Type; color|green|white",
......@@ -541,13 +551,24 @@ static void update_variables(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "enabled") == 0)
BIT_ADD(gui_status, GUI_STATUSBAR);
if (strcmp(var.value, "disabled") == 0)
BIT_CLEAR(gui_status, GUI_STATUSBAR);
//TODO: call update status
if (strcmp(var.value, "onloading") == 0)
{
if (retro_computer_cfg.statusbar != STATUSBAR_HIDE)
{
retro_computer_cfg.statusbar = STATUSBAR_HIDE;
retro_show_statusbar();
}
}
else if (strcmp(var.value, "enabled") == 0)
{
retro_computer_cfg.statusbar = STATUSBAR_SHOW;
retro_show_statusbar();
}
else if (strcmp(var.value, "disabled") == 0)
{
retro_computer_cfg.statusbar = STATUSBAR_OFF;
retro_ui_set_status(UI_STATUSBAR, false);
}
}
var.key = "cap32_scr_tube";
......@@ -623,7 +644,10 @@ static void update_variables(void)
// check if emulation need a restart (model/lang/... is changed)
if(retro_computer_cfg.is_dirty)
{
emu_restart();
retro_ui_update_text();
}
}
......@@ -1030,13 +1054,9 @@ void computer_load_file() {
}
static int text_width(mu_Font font, const char *text, int len) {
if (len == -1) { len = strlen(text); }
return len * 16;
}
static int text_height(mu_Font font) {
return 16;
void load_ui(void)
{
}