select correct renderer for sdl renderer

This commit is contained in:
olebeck 2025-06-22 12:57:31 +02:00
parent d5f388cf2f
commit cb4fcc55ba
5 changed files with 44 additions and 5 deletions

View File

@ -68,10 +68,13 @@ add_library(imgui STATIC
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp
)
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
target_link_libraries(imgui PUBLIC SDL3::Headers)
target_link_libraries(imgui PRIVATE SDL3::SDL3)
set_property(TARGET imgui PROPERTY CXX_CLANG_TIDY "")
if(VITA)
target_compile_definitions(imgui PRIVATE IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS)
target_compile_definitions(imgui PRIVATE
IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS
)
endif()

View File

@ -69,7 +69,11 @@ endmacro()
if(VITA)
set(LIBRARY_TYPE "STATIC")
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
set(ISLE_DEBUG OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
include(FetchContent)
include(cmake/modules/pvr_psp2.cmake)
FetchContent_Declare(
@ -686,7 +690,7 @@ if(VITA)
set(VITA_TITLEID "LEGO00001")
set(VITA_VERSION "01.00")
vita_create_self(isle.self isle)
vita_create_self(isle.self isle UNSAFE)
set(VPK_FILE_ARGS)
get_target_property(gles_modules GLESv2 MODULES)

View File

@ -55,6 +55,27 @@ extern "C"{
#include <gpu_es4/psp2_pvr_hint.h>
}
#include <psp2/kernel/modulemgr.h>
#define DO_HARDWARE_TRANSFERS 1
#define NEWLIB_HEAP_SIZE 157286400
#define LIBC_HEAP_SIZE 41943040
#define GPU_MEM_SIZE 16777216
#if (NEWLIB_HEAP_SIZE + LIBC_HEAP_SIZE) > 382730240
#error Memory usage, exceeds maximum memory for userland applications.
#endif
#if (GPU_MEM_SIZE) > 134217728
#error GPU Memory exceeds maximum memblck size
#endif
int _newlib_heap_size_user = NEWLIB_HEAP_SIZE;
unsigned int sceLibcHeapSize = LIBC_HEAP_SIZE;
unsigned int sceLibcHeapExtendedAlloc = 1;
#endif
DECOMP_SIZE_ASSERT(IsleApp, 0x8c)
@ -268,8 +289,9 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv)
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
#ifdef __vita__
SDL_setenv_unsafe("VITA_PVR_SKIP_INIT", "enable", 1);
#if __vita__
SDL_SetHint("VITA_PVR_SKIP_INIT", "enable");
SDL_SetHint("SDL_RENDER_OPENGLES2_TEXCOORD_PRECISION", "high"); // not really needed
PVRSRV_PSP2_APPHINT hint;
sceKernelLoadStartModule("vs0:sys/external/libfios2.suprx", 0, NULL, 0, NULL, NULL);

View File

@ -26,8 +26,13 @@
static bool g_debugEnabled;
static bool g_debugPaused;
static bool g_debugDoStep;
#ifdef __vita__ // cant have multiple windows
SDL_Window* window;
#else
static SDL_Window* g_debugWindow;
static SDL_Renderer* g_debugRenderer;
#endif
static SDL_Texture* g_videoPalette;
static IDirect3DRMMiniwinDevice* g_d3drmMiniwinDevice;

View File

@ -296,13 +296,18 @@ HRESULT DirectDrawImpl::SetCooperativeLevel(HWND hWnd, DDSCLFlags dwFlags)
return DDERR_INVALIDPARAMS;
}
char* sdlRendererName = nullptr;
#ifdef __vita__
sdlRendererName = "opengles2";
#endif
if (!SDL_SetWindowFullscreen(sdlWindow, fullscreen)) {
#ifndef __EMSCRIPTEN__
return DDERR_GENERIC;
#endif
}
DDWindow = sdlWindow;
DDRenderer = SDL_CreateRenderer(DDWindow, NULL);
DDRenderer = SDL_CreateRenderer(DDWindow, sdlRendererName);
SDL_PropertiesID prop = SDL_GetRendererProperties(DDRenderer);
SDL_SetRenderLogicalPresentation(DDRenderer, 640, 480, SDL_LOGICAL_PRESENTATION_LETTERBOX);
}