diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index daaeae0d..3402b198 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -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() diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f25d942..f357fd16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 5203dcae..67c78f72 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -55,6 +55,27 @@ extern "C"{ #include } #include + +#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); diff --git a/ISLE/isledebug.cpp b/ISLE/isledebug.cpp index 79db85b9..1f8c652e 100644 --- a/ISLE/isledebug.cpp +++ b/ISLE/isledebug.cpp @@ -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; diff --git a/miniwin/src/ddraw/ddraw.cpp b/miniwin/src/ddraw/ddraw.cpp index bd1541a3..107384aa 100644 --- a/miniwin/src/ddraw/ddraw.cpp +++ b/miniwin/src/ddraw/ddraw.cpp @@ -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); }