Removed Software Cursor support
The current implementation was too buggy anyway.
This commit is contained in:
parent
4fbb0cebf1
commit
9f250fb2dd
2 changed files with 17 additions and 61 deletions
16
Makefile
16
Makefile
|
@ -67,7 +67,7 @@ else ifeq ($(PLATFORM),$(filter $(PLATFORM),rpi1-sdl2 rpi2-sdl2 rpi3-sdl2 rpi4-s
|
|||
# OrangePi (SDL2)
|
||||
else ifeq ($(PLATFORM),orangepi-pc)
|
||||
CPUFLAGS = -mcpu=cortex-a7 -mfpu=neon-vfpv4
|
||||
CPPFLAGS += -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DSOFTWARE_CURSOR -DUSE_RENDER_THREAD
|
||||
CPPFLAGS += -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DUSE_RENDER_THREAD
|
||||
HAVE_NEON = 1
|
||||
ifdef DEBUG
|
||||
# Otherwise we'll get compilation errors, check https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here
|
||||
|
@ -120,14 +120,14 @@ else ifeq ($(PLATFORM),pi64-dispmanx)
|
|||
else ifeq ($(PLATFORM),vero4k)
|
||||
CPUFLAGS = -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
|
||||
CFLAGS += -ftree-vectorize -funsafe-math-optimizations
|
||||
CPPFLAGS += -I/opt/vero3/include -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DSOFTWARE_CURSOR -DUSE_RENDER_THREAD
|
||||
CPPFLAGS += -I/opt/vero3/include -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DUSE_RENDER_THREAD
|
||||
LDFLAGS += -L/opt/vero3/lib
|
||||
HAVE_NEON = 1
|
||||
|
||||
# Amlogic S905/S905X/S912 (AMLGXBB/AMLGXL/AMLGXM) e.g. Khadas VIM1/2 / S905X2 (AMLG12A) & S922X/A311D (AMLG12B) e.g. Khadas VIM3 - 32-bit userspace
|
||||
else ifneq (,$(findstring AMLG,$(PLATFORM)))
|
||||
CPUFLAGS += -mfloat-abi=hard -mfpu=neon-fp-armv8
|
||||
CPPFLAGS += -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DSOFTWARE_CURSOR
|
||||
CPPFLAGS += -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV
|
||||
HAVE_NEON = 1
|
||||
|
||||
ifneq (,$(findstring AMLG12,$(PLATFORM)))
|
||||
|
@ -144,13 +144,13 @@ else ifneq (,$(findstring AMLG,$(PLATFORM)))
|
|||
# Odroid Go Advance target (SDL2, 64-bit)
|
||||
else ifeq ($(PLATFORM),go-advance)
|
||||
CPUFLAGS += -mcpu=cortex-a35
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64 -DSOFTWARE_CURSOR
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64
|
||||
AARCH64 = 1
|
||||
|
||||
# Odroid Go Advance special target (libgo2, 64-bit)
|
||||
else ifeq ($(PLATFORM),go-advance-libgo2)
|
||||
CPUFLAGS += -mcpu=cortex-a35
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64 -DSOFTWARE_CURSOR ${LIBGO2_FLAGS}
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64 ${LIBGO2_FLAGS}
|
||||
LDFLAGS += ${LIBGO2_LDFLAGS}
|
||||
AARCH64 = 1
|
||||
|
||||
|
@ -181,7 +181,7 @@ else ifneq (,$(findstring RK,$(PLATFORM)))
|
|||
# sun8i Allwinner H2+ / H3 like Orange PI, Nano PI, Banana PI, Tritium, AlphaCore2, MPCORE-HUB
|
||||
else ifeq ($(PLATFORM),sun8i)
|
||||
CPUFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4
|
||||
CPPFLAGS += -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DSOFTWARE_CURSOR -DUSE_RENDER_THREAD
|
||||
CPPFLAGS += -DARMV6_ASSEMBLY -D_FILE_OFFSET_BITS=64 -DARMV6T2 -DUSE_ARMNEON -DARM_HAS_DIV -DUSE_RENDER_THREAD
|
||||
HAVE_NEON = 1
|
||||
ifdef DEBUG
|
||||
# Otherwise we'll get compilation errors, check https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here
|
||||
|
@ -192,13 +192,13 @@ else ifeq ($(PLATFORM),sun8i)
|
|||
# LePotato Libre Computer
|
||||
else ifeq ($(PLATFORM),lePotato)
|
||||
CPUFLAGS += -mcpu=cortex-a53 -mabi=lp64
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64 -DSOFTWARE_CURSOR
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64
|
||||
AARCH64 = 1
|
||||
|
||||
# Nvidia Jetson Nano (SDL2 64-bit)
|
||||
else ifeq ($(PLATFORM),jetson-nano)
|
||||
CPUFLAGS += -mcpu=cortex-a57
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64 -DSOFTWARE_CURSOR
|
||||
CPPFLAGS += -DCPU_AARCH64 -D_FILE_OFFSET_BITS=64
|
||||
AARCH64 = 1
|
||||
|
||||
else
|
||||
|
|
|
@ -133,11 +133,6 @@ int element_present = 0;
|
|||
SDL_Texture* gui_texture;
|
||||
SDL_Cursor* cursor;
|
||||
SDL_Surface* cursor_surface;
|
||||
#ifdef SOFTWARE_CURSOR
|
||||
SDL_Texture* swcursor_texture = NULL;
|
||||
static SDL_DisplayMode physmode;
|
||||
static double mscalex, mscaley;
|
||||
#endif // SOFTWARE_CURSOR
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -226,34 +221,10 @@ static void ShowHelpRequested()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef SOFTWARE_CURSOR
|
||||
static SDL_Rect dst;
|
||||
void swcursor(bool op) {
|
||||
if (!op) {
|
||||
cursor_surface = SDL_LoadBMP("data/cursor.bmp");
|
||||
swcursor_texture = SDL_CreateTextureFromSurface(renderer, cursor_surface);
|
||||
// Hide real cursor
|
||||
SDL_SetCursor(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW));
|
||||
SDL_ShowCursor(0);
|
||||
// Set cursor width,height to that of loaded bmp
|
||||
dst.w = cursor_surface->w;
|
||||
dst.h = cursor_surface->h;
|
||||
SDL_FreeSurface(cursor_surface);
|
||||
|
||||
}
|
||||
else {
|
||||
SDL_GetMouseState(&dst.x, &dst.y);
|
||||
dst.x *= mscalex * 1.03;
|
||||
dst.y *= mscaley * 1.005;
|
||||
SDL_RenderCopyEx(renderer, swcursor_texture, nullptr, &dst, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void cap_fps(Uint64 start, int fps)
|
||||
{
|
||||
const auto end = SDL_GetPerformanceCounter();
|
||||
const auto elapsed_ms = float(end - start) / float(SDL_GetPerformanceFrequency()) * 1000.0f;
|
||||
const auto elapsed_ms = static_cast<float>(end - start) / static_cast<float>(SDL_GetPerformanceFrequency()) * 1000.0f;
|
||||
if (fps == 60)
|
||||
SDL_Delay(floor(16.666f - elapsed_ms));
|
||||
else if (fps == 50)
|
||||
|
@ -276,16 +247,12 @@ void UpdateGuiScreen()
|
|||
renderQuad = { -(GUI_WIDTH - GUI_HEIGHT) / 2, (GUI_WIDTH - GUI_HEIGHT) / 2, gui_screen->w, gui_screen->h };
|
||||
|
||||
SDL_RenderCopyEx(renderer, gui_texture, nullptr, &renderQuad, amiberry_options.rotation_angle, nullptr, SDL_FLIP_NONE);
|
||||
#ifdef SOFTWARE_CURSOR
|
||||
swcursor(true);
|
||||
#endif
|
||||
SDL_RenderPresent(renderer);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_DISPMANX
|
||||
#else
|
||||
// Sets the cursor image up
|
||||
void setup_cursor()
|
||||
{
|
||||
// Detect resolution and load appropriate cursor image
|
||||
|
@ -301,13 +268,15 @@ void setup_cursor()
|
|||
if (!cursor_surface)
|
||||
{
|
||||
// Load failed. Log error.
|
||||
SDL_Log("Could not load cursor bitmap: %s\n", SDL_GetError());
|
||||
write_log("Could not load cursor bitmap: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
auto* formattedSurface = SDL_ConvertSurfaceFormat(cursor_surface, SDL_PIXELFORMAT_RGBA8888, 0);
|
||||
if (formattedSurface != nullptr)
|
||||
{
|
||||
SDL_FreeSurface(cursor_surface);
|
||||
|
||||
// Create new cursor with surface
|
||||
cursor = SDL_CreateColorCursor(formattedSurface, 0, 0);
|
||||
SDL_FreeSurface(formattedSurface);
|
||||
|
@ -316,13 +285,14 @@ void setup_cursor()
|
|||
if (!cursor)
|
||||
{
|
||||
// Cursor creation failed. Log error and free surface
|
||||
SDL_Log("Could not create color cursor: %s\n", SDL_GetError());
|
||||
SDL_FreeSurface(cursor_surface);
|
||||
write_log("Could not create color cursor: %s\n", SDL_GetError());
|
||||
cursor_surface = nullptr;
|
||||
formattedSurface = nullptr;
|
||||
SDL_SetCursor(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW));
|
||||
return;
|
||||
}
|
||||
if (cursor)
|
||||
SDL_SetCursor(cursor);
|
||||
|
||||
SDL_SetCursor(cursor);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -399,15 +369,8 @@ void amiberry_gui_init()
|
|||
|
||||
vc_dispmanx_update_submit_sync(updateHandle);
|
||||
}
|
||||
#else
|
||||
#ifdef SOFTWARE_CURSOR
|
||||
swcursor(false);
|
||||
SDL_GetCurrentDisplayMode(0, &physmode);
|
||||
mscalex = (double(GUI_WIDTH) / double(physmode.w));
|
||||
mscaley = (double(GUI_HEIGHT) / double(physmode.h));
|
||||
#else
|
||||
setup_cursor();
|
||||
#endif
|
||||
|
||||
if (sdl_window)
|
||||
{
|
||||
|
@ -502,13 +465,6 @@ void amiberry_gui_halt()
|
|||
cursor = nullptr;
|
||||
}
|
||||
|
||||
#ifdef SOFTWARE_CURSOR
|
||||
if (swcursor_texture != nullptr)
|
||||
{
|
||||
SDL_DestroyTexture(swcursor_texture);
|
||||
swcursor_texture = nullptr;
|
||||
}
|
||||
#endif
|
||||
// Clear the screen
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue