mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-28 04:23:36 +01:00
render: add R61524 backend to render-fx for build-fxg3a target
This commit is contained in:
parent
28bea2e1ce
commit
5548bf68ab
7 changed files with 60 additions and 12 deletions
|
@ -94,6 +94,10 @@ typedef image_t bopti_image_t;
|
|||
|
||||
@main Main VRAM area, used alone if [secondary] is NULL
|
||||
@secondary Additional VRAM area, enables triple buffering if non-NULL */
|
||||
// TODO: In gint 3 the triple buffering mechanism will be removed. Applications
|
||||
// that want to change VRAMs in-between every frame will be able to do so by
|
||||
// talking directly to the video interface to set VRAM, and wrapping dupdate.
|
||||
// Basically it will just no longer be handled by gint itself.
|
||||
void dsetvram(uint16_t *main, uint16_t *secondary);
|
||||
|
||||
/* dgetvram() - Get VRAM addresses
|
||||
|
|
|
@ -49,6 +49,12 @@ void r61524_display(uint16_t *vram, int start, int height, int method);
|
|||
void r61524_display_rect(uint16_t *vram, int xmin, int xmax, int ymin,
|
||||
int ymax);
|
||||
|
||||
/* r61524_display_mono_128x64(): Display a mono-style VRAM
|
||||
This experimental function updates the display with the contents of a 128x64
|
||||
VRAM, used with the fxg3a compilation target.
|
||||
TODO: Make that a video mode. */
|
||||
void r61524_display_mono_128x64(uint32_t *vram);
|
||||
|
||||
/* r61524_start_frame(): Prepare the display for a region update
|
||||
|
||||
This function sets up the display driver to receive graphics data to update
|
||||
|
|
|
@ -114,12 +114,9 @@ void kinit(void)
|
|||
gint_world_addin = gint_world_alloc();
|
||||
gint_driver_flags = malloc(gint_driver_count());
|
||||
|
||||
#ifdef FXCG50
|
||||
/* Allocate VRAMs, which is important for panic screens */
|
||||
extern bool dvram_init(void);
|
||||
if(!dvram_init())
|
||||
abort();
|
||||
#endif
|
||||
|
||||
if(!gint_world_os || !gint_world_addin || !gint_driver_flags)
|
||||
gint_panic(0x1060);
|
||||
|
|
|
@ -220,11 +220,11 @@ void gint_copy_vram(void)
|
|||
{
|
||||
void *__GetVRAMAddress(void);
|
||||
|
||||
#ifdef FX9860G
|
||||
#if GINT_OS_FX
|
||||
memcpy(__GetVRAMAddress(), gint_vram, 1024);
|
||||
#endif
|
||||
|
||||
#ifdef FXCG50
|
||||
#if GINT_OS_CG && GINT_RENDER_RGB
|
||||
/* TODO: Improve copied VRAM behavior in gint_osmenu() on fxcg50 */
|
||||
uint16_t *vram1, *vram2;
|
||||
dgetvram(&vram1, &vram2);
|
||||
|
@ -238,6 +238,10 @@ void gint_copy_vram(void)
|
|||
dst[x] = src[x];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GINT_OS_CG && GINT_RENDER_MONO
|
||||
// TODO: VRAM save mechanism for mono video mode on R61524
|
||||
#endif
|
||||
}
|
||||
|
||||
void gint_poweroff(bool show_logo)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <gint/drivers/r61524.h>
|
||||
#include <gint/config.h>
|
||||
|
||||
#if GINT_RENDER_RGB
|
||||
#if GINT_HW_CG
|
||||
|
||||
#define DMA SH7305_DMA
|
||||
#define POWER SH7305_POWER
|
||||
|
@ -199,6 +199,26 @@ void r61524_display_rect(uint16_t *vram, int xmin, int xmax, int ymin,
|
|||
}
|
||||
}
|
||||
|
||||
void r61524_display_mono_128x64(uint32_t *vram)
|
||||
{
|
||||
dma_transfer_wait(0);
|
||||
r61524_start_frame(0, 383, 0, 191);
|
||||
|
||||
for(int y = 0; y < 64; y++) {
|
||||
for(int sy = 0; sy < 3; sy++) {
|
||||
/* Get pixels manually, ooh, slow */
|
||||
for(int x = 0; x < 128; x++) {
|
||||
int pixel = vram[x >> 5] >> (~x & 31);
|
||||
int color = (pixel & 1) ? 0x0000 : 0xffff;
|
||||
write(color);
|
||||
write(color);
|
||||
write(color);
|
||||
}
|
||||
}
|
||||
vram += 4;
|
||||
}
|
||||
}
|
||||
|
||||
//---
|
||||
// State and driver metadata
|
||||
//---
|
||||
|
@ -221,4 +241,4 @@ gint_driver_t drv_r61524 = {
|
|||
};
|
||||
GINT_DECLARE_DRIVER(26, drv_r61524);
|
||||
|
||||
#endif /* GINT_RENDER_RGB */
|
||||
#endif /* GINT_HW_CG */
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
#include <gint/display.h>
|
||||
#include <gint/drivers/t6k11.h>
|
||||
#include "../render/render.h"
|
||||
|
||||
#include <gint/config.h>
|
||||
#if GINT_RENDER_MONO
|
||||
|
||||
#if GINT_HW_FX
|
||||
# include <gint/drivers/t6k11.h>
|
||||
#elif GINT_HW_CG
|
||||
# include <gint/drivers/r61524.h>
|
||||
#else
|
||||
# error Platform unknown for mono video mode update
|
||||
#endif
|
||||
|
||||
/* Standard video RAM for fx9860g is 1 bit per pixel */
|
||||
GSECTION(".bss") GALIGNED(32) static uint32_t fx_vram[256];
|
||||
|
||||
|
@ -14,6 +21,12 @@ uint32_t *gint_vram = fx_vram;
|
|||
/* The current rendering mode */
|
||||
struct rendering_mode const *dmode = NULL;
|
||||
|
||||
/* For parity with the current RGB interface */
|
||||
bool dvram_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* dupdate(): Push the video RAM to the display driver */
|
||||
void dupdate(void)
|
||||
{
|
||||
|
@ -28,7 +41,11 @@ void dupdate(void)
|
|||
}
|
||||
if(run_default)
|
||||
{
|
||||
#if GINT_HW_FX
|
||||
t6k11_display(gint_vram, 0, 64, 16);
|
||||
#elif GINT_HW_CG
|
||||
r61524_display_mono_128x64(gint_vram);
|
||||
#endif
|
||||
}
|
||||
|
||||
gint_call(dupdate_get_hook());
|
||||
|
|
|
@ -104,12 +104,12 @@ static void capture_vram(GUNUSED bool onscreen, char const *type)
|
|||
void *source = gint_vram;
|
||||
int size, format;
|
||||
|
||||
#ifdef FX9860G
|
||||
#if GINT_RENDER_MONO
|
||||
size = 1024;
|
||||
format = USB_FXLINK_IMAGE_MONO;
|
||||
#endif
|
||||
|
||||
#ifdef FXCG50
|
||||
#if GINT_RENDER_RGB
|
||||
if(onscreen) {
|
||||
uint16_t *main, *secondary;
|
||||
dgetvram(&main, &secondary);
|
||||
|
@ -187,11 +187,11 @@ static void execute_command(char const *cmd)
|
|||
usb_fxlink_text(text, 0);
|
||||
}
|
||||
if(!strncmp(cmd, "identify", 8)) {
|
||||
#if defined(FX9860G)
|
||||
#if GINT_OS_FX
|
||||
char const *serial_number = (void *)0x8000ffd0;
|
||||
char const *OS_version = (void *)0x80010020;
|
||||
char const *BC_version = (void *)0x8000ffb0;
|
||||
#elif defined(FXCG50)
|
||||
#elif GINT_OS_CG
|
||||
char const *serial_number = (void *)0x8001ffd0;
|
||||
char const *OS_version = (void *)0x80020020;
|
||||
char const *BC_version = (void *)0x8001ffb0;
|
||||
|
|
Loading…
Reference in a new issue