Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
libretro-cap32
Commits
8ac298b5
Unverified
Commit
8ac298b5
authored
Apr 30, 2022
by
David Skywalker
Committed by
GitHub
Apr 30, 2022
Browse files
Merge pull request #115 from libretro/windows-16bits
Allow user configure depth surface (by default 16bits)
parents
1eed6eb8
1af8c1a9
Pipeline
#113711
passed with stages
in 8 minutes and 34 seconds
Changes
23
Pipelines
39
Hide whitespace changes
Inline
Side-by-side
Makefile.common
View file @
8ac298b5
...
...
@@ -28,6 +28,9 @@ SOURCES_C := \
$(CORE_DIR)
/libretro/dsk/format.c
\
$(CORE_DIR)
/libretro/dsk/amsdos_catalog.c
\
$(CORE_DIR)
/libretro/gfx/software.c
\
$(CORE_DIR)
/libretro/gfx/video.c
\
$(CORE_DIR)
/libretro/gfx/video16bpp.c
\
$(CORE_DIR)
/libretro/gfx/video24bpp.c
\
$(CORE_DIR)
/libretro/assets/ui_keyboard_bg.c
\
$(CORE_DIR)
/libretro/assets/ui_keyboard_en.c
\
$(CORE_DIR)
/libretro/assets/ui_keyboard_es.c
\
...
...
cap32/cap32.c
View file @
8ac298b5
...
...
@@ -174,6 +174,7 @@ int HandleExtension(char *path,char *ext);
#include "retro_snd.h"
#include "retro_ui.h"
#include "retro_utils.h"
#include "libretro/gfx/video.h"
extern
void
kbd_update_table
(
int
lang
);
...
...
@@ -285,7 +286,7 @@ double colours_green[32] = {
0
.
2510
,
0
.
3137
,
0
.
5333
,
0
.
5961
};
PIXEL_TYPE
colours
[
32
];
uint32_t
colours
[
32
];
static
uint8_t
bit_values
[
8
]
=
{
0x01
,
0x02
,
0x04
,
0x08
,
0x10
,
0x20
,
0x40
,
0x80
...
...
@@ -606,7 +607,7 @@ void z80_OUT_handler (reg_pair port, uint8_t val)
GateArray
.
palette
[
GateArray
.
pen
]
=
colours
[
colour
];
// mode 2 - 'anti-aliasing' colour
if
(
GateArray
.
pen
<
2
)
{
video_set_palette_antialias
();
CPC
.
video_set_palette_antialias
();
}
}
if
(
CPC
.
mf2
)
{
// MF2 enabled?
...
...
@@ -1360,7 +1361,7 @@ unsigned int video_monitor_colour (double r, double g, double b)
if
(
blue
>
255
)
blue
=
255
;
return
RGB2COLOR
(
red
,
green
,
blue
);
return
CPC
.
rgb2color
(
red
,
green
,
blue
);
}
// Convert RGB color to GREEN LUMA
...
...
@@ -1385,7 +1386,7 @@ unsigned int video_monitor_green(double r, double g, double b) {
// to represent real phosphor screens we add some blue color to green conversion
uint32_t
blue
=
(
uint32_t
)
green
*
(
CPC
.
scr_phosphor_intensity
/
100
.
0
);
return
RGB2COLOR
(
0
,
green
,
blue
);
return
CPC
.
rgb2color
(
0
,
green
,
blue
);
}
// Convert RGB to LUMA
...
...
@@ -1399,7 +1400,7 @@ unsigned int video_monitor_grey(double r, double g, double b) {
if
(
grey
>
255
)
grey
=
255
;
return
RGB2COLOR
(
grey
,
grey
,
grey
);
return
CPC
.
rgb2color
(
grey
,
grey
,
grey
);
}
void
video_update_tube
()
{
...
...
@@ -1416,21 +1417,6 @@ void video_update_tube() {
}
}
/**
* generate antialias values using 32/16bits macros
*
* RGB[10] 00CE60 || CC CC 00
* 00CE60 (10) || C8 CC 00
*/
void
video_set_palette_antialias
(
void
)
{
uint8_t
r2
,
g2
,
b2
;
r2
=
RGB2RED
(
colours
[
GateArray
.
ink_values
[
0
]])
+
RGB2RED
(
colours
[
GateArray
.
ink_values
[
1
]]);
g2
=
RGB2GREEN
(
colours
[
GateArray
.
ink_values
[
0
]])
+
RGB2GREEN
(
colours
[
GateArray
.
ink_values
[
1
]]);
b2
=
RGB2BLUE
(
colours
[
GateArray
.
ink_values
[
0
]])
+
RGB2BLUE
(
colours
[
GateArray
.
ink_values
[
1
]]);
GateArray
.
palette
[
33
]
=
(
PIXEL_TYPE
)
RGB2COLOR
(
r2
/
2
,
g2
/
2
,
b2
/
2
);
}
int
video_set_palette
(
void
)
{
...
...
@@ -1439,7 +1425,7 @@ int video_set_palette (void)
for
(
n
=
0
;
n
<
32
;
n
++
)
{
colours
[
n
]
=
(
PIXEL_TYPE
)
CPC
.
video_monitor
(
colours_rgb
[
n
][
0
],
colours_rgb
[
n
][
1
],
colours_rgb
[
n
][
2
]);
colours
[
n
]
=
CPC
.
video_monitor
(
colours_rgb
[
n
][
0
],
colours_rgb
[
n
][
1
],
colours_rgb
[
n
][
2
]);
}
for
(
n
=
0
;
n
<
17
;
n
++
)
...
...
@@ -1459,7 +1445,6 @@ void video_set_style (void)
{
dwXScale
=
1
;
dwYScale
=
1
;
}
else
//768x272
{
...
...
@@ -1493,6 +1478,9 @@ void video_set_style (void)
switch
(
CPC
.
scr_bpp
)
{
case
32
:
CPC
.
video_set_palette_antialias
=
(
void
(
*
)(
void
))
video_set_palette_antialias_24bpp
;
CPC
.
rgb2color
=
rgb2color_24bpp
;
printf
(
"TESST 32!
\n
"
);
if
(
dwYScale
==
2
)
CPC
.
scr_render
=
(
void
(
*
)(
void
))
render32bpp_doubleY
;
else
...
...
@@ -1501,6 +1489,9 @@ void video_set_style (void)
case
16
:
case
15
:
default:
printf
(
"TESST 16!
\n
"
);
CPC
.
video_set_palette_antialias
=
(
void
(
*
)(
void
))
video_set_palette_antialias_16bpp
;
CPC
.
rgb2color
=
rgb2color_16bpp
;
if
(
dwYScale
==
2
)
CPC
.
scr_render
=
(
void
(
*
)(
void
))
render16bpp_doubleY
;
else
...
...
@@ -1513,39 +1504,19 @@ void video_set_style (void)
int
video_init
(
void
)
{
int
error_code
;
CPC
.
scr_bpp
=
retro_getGfxBpp
();
error_code
=
video_set_palette
();
// init CPC colours and hardware palette (in 8bpp mode)
if
(
error_code
)
return
error_code
;
CPC
.
scr_bpp
=
retro_getGfxBpp
();
CPC
.
scr_style
=
retro_getStyle
();
CPC
.
scr_bps
=
retro_getGfxBps
();
CPC
.
scr_pos
=
CPC
.
scr_base
=
retro_getScreenPtr
();
video_set_style
();
error_code
=
video_set_palette
();
// init CPC colours and hardware palette (in 8bpp mode)
if
(
error_code
)
return
error_code
;
CPC
.
scr_line_offs
=
((
CPC
.
scr_bps
*
(
dwYScale
))
// because is double height
/
(
2
/
PIXEL_BYTES
)
)
;
return
0
;
}
void
video_shutdown
(
void
)
{
}
void
video_display
(
void
)
{
}
void
input_swap_joy
(
void
)
{
}
int
input_init
(
void
)
{
/
(
2
/
retro_video
.
bytes
)
)
;
return
0
;
}
...
...
@@ -1897,7 +1868,6 @@ void doCleanUp (void)
free
(
zip_info
.
pchFileNames
);
audio_shutdown
();
video_shutdown
();
#ifdef DEBUG
fclose
(
pfoDebug
);
...
...
cap32/cap32.h
View file @
8ac298b5
...
...
@@ -254,6 +254,8 @@ typedef struct {
void
(
*
scr_prerendernorm
)(
void
);
void
(
*
scr_prerenderbord
)(
void
);
void
(
*
scr_prerendersync
)(
void
);
void
(
*
video_set_palette_antialias
)(
void
);
unsigned
int
(
*
rgb2color
)(
unsigned
int
r
,
unsigned
int
g
,
unsigned
int
b
);
bool
scr_is_ogl
;
unsigned
int
snd_enabled
;
...
...
cap32/crtc.c
View file @
8ac298b5
...
...
@@ -1057,6 +1057,30 @@ void set_prerender(void)
}
}
void
render8bpp
(
void
)
{
register
uint8_t
*
pbPos
=
(
uint8_t
*
)
CPC
.
scr_pos
;
register
uint8_t
bCount
=
*
RendWid
++
;
while
(
bCount
--
)
{
*
pbPos
++
=
GateArray
.
palette
[
*
RendOut
++
];
}
CPC
.
scr_pos
=
(
uint32_t
*
)
pbPos
;
}
void
render8bpp_doubleY
(
void
)
{
register
uint8_t
*
pbPos
=
(
uint8_t
*
)
CPC
.
scr_pos
;
register
uint16_t
dwLineOffs
=
CPC
.
scr_bps
;
register
uint8_t
bCount
=
*
RendWid
++
;
while
(
bCount
--
)
{
register
uint16_t
val
=
GateArray
.
palette
[
*
RendOut
++
];
*
(
pbPos
+
dwLineOffs
)
=
val
;
*
pbPos
++
=
val
;
}
CPC
.
scr_pos
=
(
uint32_t
*
)
pbPos
;
}
void
render16bpp
(
void
)
{
register
uint16_t
*
pwPos
=
(
uint16_t
*
)
CPC
.
scr_pos
;
...
...
@@ -1083,20 +1107,25 @@ void render16bpp_doubleY(void)
void
render32bpp
(
void
)
{
register
uint32_t
*
pwPos
=
(
uint32_t
*
)
CPC
.
scr_pos
;
register
uint8_t
bCount
=
*
RendWid
++
;
while
(
bCount
--
)
{
*
CPC
.
scr_p
os
++
=
GateArray
.
palette
[
*
RendOut
++
];
*
pwP
os
++
=
GateArray
.
palette
[
*
RendOut
++
];
}
CPC
.
scr_pos
=
(
uint32_t
*
)
pwPos
;
}
void
render32bpp_doubleY
(
void
)
{
register
uint32_t
*
pwPos
=
(
uint32_t
*
)
CPC
.
scr_pos
;
register
uint16_t
dwLineOffs
=
CPC
.
scr_bps
;
register
uint8_t
bCount
=
*
RendWid
++
;
while
(
bCount
--
)
{
register
uint32_t
val
=
GateArray
.
palette
[
*
RendOut
++
];
*
(
CPC
.
scr_pos
+
CPC
.
scr_bp
s
)
=
val
;
*
CPC
.
scr_p
os
++
=
val
;
*
(
pwPos
+
dwLineOff
s
)
=
val
;
*
pwP
os
++
=
val
;
}
CPC
.
scr_pos
=
(
uint32_t
*
)
pwPos
;
}
void
crtc_cycle
(
int
repeat_count
)
...
...
libretro/dsk/amsdos_catalog.h
View file @
8ac298b5
...
...
@@ -36,7 +36,10 @@
*
****************************************************************************************/
#include "../../cap32/cap32.h"
#ifndef GFX_AMSDOSCATALOG_H__
#define GFX_AMSDOSCATALOG_H__
#include "cap32.h"
#define CAT_MAX_ENTRY 64
#define CAT_NAME_SIZE 20
...
...
@@ -65,3 +68,5 @@ typedef struct {
extern
catalogue_info_t
catalogue
;
int
catalog_probe
(
t_drive
*
drive
,
unsigned
char
user
);
#endif
\ No newline at end of file
libretro/dsk/format.c
View file @
8ac298b5
...
...
@@ -130,7 +130,6 @@ retro_format_info_t* format_get (t_drive *drive)
return
format_found
;
}
#define HEXAGON_TRACK_SIZE 0x1400
#define HEXAGON_TRACK_SIZE_V2 0x1800
#define HEXAGON_SECTOR_SIZE 0xA
...
...
libretro/dsk/format.h
View file @
8ac298b5
...
...
@@ -36,7 +36,10 @@
*
****************************************************************************************/
#include "../../cap32/cap32.h"
#ifndef GFX_FORMAT_H__
#define GFX_FORMAT_H__
#include "cap32.h"
// formats info: http://www.cpcwiki.eu/index.php/ParaDOS
...
...
@@ -66,3 +69,5 @@ typedef struct {
retro_format_info_t
*
format_get
(
t_drive
*
drive
);
bool
format_probe_hexagon
(
t_drive
*
drive
);
#endif
\ No newline at end of file
libretro/dsk/loader.c
View file @
8ac298b5
...
...
@@ -57,7 +57,6 @@ bool _loader_launch(char * key_buffer, char * filename)
return
true
;
}
bool
_loader_find_file
(
char
*
key_buffer
,
char
*
filename
)
{
for
(
int
idx
=
0
;
idx
<
catalogue
.
last_entry
;
idx
++
)
{
...
...
@@ -179,7 +178,6 @@ void _loader_failed (char * key_buffer, bool is_system)
strcpy
(
key_buffer
,
"CAT"
);
}
void
_loader_run
(
char
*
key_buffer
,
retro_format_info_t
*
format
,
t_drive
*
current_drive
)
{
memset
(
key_buffer
,
0
,
LOADER_MAX_SIZE
);
...
...
@@ -206,7 +204,7 @@ void _loader_run(char * key_buffer, retro_format_info_t *format, t_drive *curren
return
;
#ifdef LOADER_DEBUG
printf
(
"[ LOADER ]
bas/bin/.
\n
"
);
printf
(
"[ LOADER ]
finally trying with bas/bin/dot files
\n
"
);
#endif
if
(
!
_loader_find
(
key_buffer
,
format
))
...
...
libretro/dsk/loader.h
View file @
8ac298b5
...
...
@@ -34,5 +34,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************/
#ifndef GFX_LOADER_H__
#define GFX_LOADER_H__
void
loader_run
(
char
*
text
);
\ No newline at end of file
void
loader_run
(
char
*
text
);
#endif
\ No newline at end of file
libretro/gfx/software.c
View file @
8ac298b5
...
...
@@ -46,190 +46,144 @@
#include "assets/assets.h"
#include "software.h"
#include "video.h"
union
TPixel
/**
* draw_rect:
* draw a rectangle, used by UI and KoS
**/
void
draw_rect
(
uint32_t
*
buffer
,
int
x
,
int
y
,
int
width
,
int
height
,
uint32_t
color
)
{
struct
{
#ifdef MSB_FIRST
uint8_t
b
;
uint8_t
g
;
uint8_t
r
;
#else
uint8_t
r
;
uint8_t
g
;
uint8_t
b
;
#endif
};
unsigned
int
colour
;
};
union
TPixel
pixel
;
#define DATA2BLUE5(colour) (((colour>>3) & 0x1F))
#define DATA2GREEN6(colour) (((colour>>2) & 0x3F) << 5)
#define DATA2RED5(colour) (((colour>>3) & 0x1F) << 11)
#ifdef LOWRES
#define DRAW2BUFFER(buffer, img) *(buffer++) = *(img++);
#else
#define DRAW2BUFFER(buffer, img) \
{ \
*(buffer++) = *img; \
*(buffer++) = *(img++); \
}
#endif
PIXEL_TYPE
convert_color
(
unsigned
int
colour
)
{
pixel
.
colour
=
colour
;
#ifdef M16B
return
(
DATA2RED5
(
pixel
.
r
)
|
DATA2GREEN6
(
pixel
.
g
)
|
DATA2BLUE5
(
pixel
.
b
)
);
#else
return
(
(
pixel
.
r
<<
16
)
|
(
pixel
.
g
<<
8
)
|
pixel
.
b
);
#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
;
buffer
=
(
buffer
+
(
x
>>
retro_video
.
raw_density_byte
))
+
(
y
*
retro_video
.
bps
);
register
uint32_t
screen_width
=
retro_video
.
bps
;
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
);
retro_video
.
draw_line
(
buffer
,
width
,
color
);
buffer
+=
screen_width
;
}
}
void
draw_char
(
PIXEL_TYPE
*
buffer
,
int
x
,
int
y
,
char
chr_idx
,
PIXEL_TYPE
color
)
/**
* draw_char:
* draw a char, used by mouse cursor and text
**/
void
draw_char
(
uint32_t
*
buffer
,
int
x
,
int
y
,
char
chr_idx
,
uint32_t
color
)
{
buffer
=
(
buffer
+
x
)
+
(
y
*
EMULATION_SCREEN_WIDTH
);
buffer
=
(
buffer
+
(
x
>>
retro_video
.
raw_density_byte
))
+
(
y
*
retro_video
.
bps
);
chr_idx
-=
FNT_MIN_CHAR
;
// zero base the index
_
draw_char
(
buffer
,
&
font
[
chr_idx
*
BITS_IN_BYTE
],
color
);
retro_video
.
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
)
/**
* draw_text:
* draw a text, used by UI and KoS
**/
void
draw_text
(
uint32_t
*
buffer
,
int
x
,
int
y
,
const
char
*
text
,
uint32_t
color
)
{
int
len
=
strlen
(
text
);
// number of characters to process
char
*
ptr_text
=
(
char
*
)
text
;
unsigned
int
chr_idx
=
*
ptr_text
;
buffer
=
(
buffer
+
x
)
+
(
y
*
EMULATION_SCREEN_WIDTH
);
buffer
=
(
buffer
+
(
x
>>
retro_video
.
raw_density_byte
)
)
+
(
y
*
retro_video
.
bps
);
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
// limit it to the range of chars in the font
if
((
chr_idx
<
FNT_MIN_CHAR
)
||
(
chr_idx
>
FNT_MAX_CHAR
))
{
chr_idx
=
FNT_MIN_CHAR
;
}
chr_idx
-=
FNT_MIN_CHAR
;
// zero base the index
_draw_char
(
buffer
,
&
font
[
chr_idx
*
BITS_IN_BYTE
],
color
);
retro_video
.
draw_char
(
buffer
,
&
font
[
chr_idx
*
BITS_IN_BYTE
],
color
);
// prepare next char
ptr_text
++
;
buffer
+=
FNT_CHAR_WIDTH
*
EMULATION_SCALE
;
buffer
+=
retro_video
.
char_size
;
chr_idx
=
*
ptr_text
;
}
}
// base image in u_int32
void
convert_image
(
PIXEL_TYPE
*
buffer
,
const
unsigned
int
*
img
,
unsigned
int
size
)
/**
* draw_image_linear:
* simple function to draw an image that occupies the entire screen
* does not need to recalculate the position after each line.
**/
void
draw_image_linear
(
unsigned
int
*
buffer
,
const
unsigned
int
*
img
,
int
x
,
int
y
,
unsigned
int
size
)
{
while
(
size
--
)
buffer
=
(
buffer
+
x
)
+
(
y
*
retro_video
.
bps
);
register
uint32_t
loop
=
size
*
retro_video
.
bytes
;
while
(
loop
--
)
{
#ifndef LOWRES
*
(
buffer
++
)
=
convert_color
(
*
img
);
#endif
*
(
buffer
++
)
=
convert_color
(
*
(
img
++
));
*
(
buffer
++
)
=
*
(
img
++
);
}
}
// create linear version ??
void
draw_image
(
PIXEL_TYPE
*
buffer
,
PIXEL_TYPE
*
img
,
int
x
,
int
y
,
int
width
,
int
height
)
/*
* Prepare UI functions
* images are in uint32_t mode
*/
/**
* convert_image:
* convert intenal UI images to current depth mode (using video depth driver)
**/
void
convert_image
(
unsigned
int
*
buffer
,
const
unsigned
int
*
img
,
unsigned
int
size
)
{
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
);
}
retro_video
.
convert_image
(
buffer
,
img
,
size
);
}
void
draw_image_linear
(
PIXEL_TYPE
*
buffer
,
PIXEL_TYPE
*
img
,
int
x
,
int
y
,
unsigned
int
size
)
/**
* draw_image_transparent:
* draw a image with full transparency or not (no blend)
* used by KoS letters
**/
void
draw_image_transparent
(
unsigned
int
*
buffer
,
const
unsigned
int
*
img
,
int
x
,
int
y
,
unsigned
int
size
)
{
uint32_t
*
buffer_ptr
=
(
uint32_t
*
)
(
(
PIXEL_TYPE
*
)
(
buffer
+
x
)
+
(
y
*
EMULATION_SCREEN_WIDTH
)
uint32_t
*
buffer_ptr
=
(
(
uint32_t
*
)
(
buffer
+
x
)
+
(
y
*
retro_video
.
bps
)
);
uint32_t
*
img_ptr
=
(
uint32_t
*
)
img
;
unsigned
int
loop_counter
=
(
EMULATION_SCALE
*
size
)
/
PIXEL_RAW_DENSITY
;
unsigned
int
loop_counter
=
(
EMULATION_SCALE
*
size
);
while
(
loop_counter
--
)
{
*
(
buffer_ptr
++
)
=
*
(
img_ptr
++
);
retro_video
.
draw_pixel
(
buffer_ptr
++
,
img_ptr
++
);
}
}
void
draw_image_transparent
(
PIXEL_TYPE
*
buffer
,
PIXEL_TYPE
*
img
,
int
x
,
int
y
,
unsigned
int
size
)
{
PIXEL_TYPE
*
buffer_ptr
=
(
(
PIXEL_TYPE
*
)
(
buffer
+
x
)
+
(
y
*
EMULATION_SCREEN_WIDTH
)
);
PIXEL_TYPE
*
img_ptr
=
img
;
unsigned
int
loop_counter
=
(
EMULATION_SCALE
*
size
);
#ifdef UNUSED
while
(
loop_counter
--
)
#ifdef LOWRES
#define DRAW2BUFFER(buffer, img) *(buffer++) = *(img++);
#else
#define DRAW2BUFFER(buffer, img) \
{ \
*(buffer++) = *img; \
*(buffer++) = *(img++); \
}
#endif
void
draw_image
(
uint32_t
*
buffer
,
uint32_t
*
img
,
int
x
,
int
y
,
int
width
,
int
height
)
{
buffer
=
(
buffer
+
x
)
+
(
y
*
EMULATION_SCREEN_WIDTH
);
while
(
height
--
)
{
u
int
32_t
value
=
*
(
img_ptr
++
)
;
if
(
value
!=
PIXEL_TRANSPARENT
)
int
loop_width
=
width
;
while
(
loop_width
--
)
{
*
(
buffer_ptr
)
=
value
;
DRAW2BUFFER
(
buffer
,
img
)
;
}
buffer
_ptr
++
;
buffer
+=
EMULATION_SCREEN_WIDTH
-
(
width
*
EMULATION_SCALE
)
;
}
}
void
draw_line
(
uint32_t
*
buffer
,
int
x
,
int
y
,
int
width
,
uint32_t
color
)
{
buffer
=
(
buffer
+
x
)
+
(
y
*
EMULATION_SCREEN_WIDTH
);
while
(
width
--
)
{
*
(
buffer
++
)
=
color
;
}
}
#endif
libretro/gfx/software.h
View file @
8ac298b5
...
...
@@ -42,16 +42,48 @@
#include <stdint.h>
#include <stdbool.h>
union
TPixel
{
struct
{
#ifdef MSB_FIRST
uint8_t
b
;