diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index eea078ca..ce628349 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -29,6 +29,16 @@ target_compile_definitions(miniaudio PUBLIC MA_NO_THREADING ) + + +if(PSP) + target_compile_definitions(miniaudio PUBLIC + MA_NO_RUNTIME_LINKING + ) +endif() + + + if(DOWNLOAD_DEPENDENCIES) include(FetchContent) FetchContent_Declare( diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f5308a3..17659223 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ option(ISLE_WERROR "Treat warnings as errors" OFF) option(ISLE_DEBUG "Enable imgui debug" ON) cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF) cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF) -cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN" OFF) +cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN AND (NOT PSP)" OFF) cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF) option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON) option(ENABLE_CLANG_TIDY "Enable clang-tidy") @@ -53,15 +53,19 @@ message(STATUS "Compile shaders: ${ISLE_COMPILE_SHADERS}") if (DOWNLOAD_DEPENDENCIES) # FetchContent downloads and configures dependencies - message(STATUS "Fetching SDL3 and iniparser. This might take a while...") include(FetchContent) - FetchContent_Declare( - SDL3 - GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git" - GIT_TAG "main" - EXCLUDE_FROM_ALL - ) - FetchContent_MakeAvailable(SDL3) + if (NOT PSP) + message(STATUS "Fetching SDL3 and iniparser. This might take a while...") + FetchContent_Declare( + SDL3 + GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git" + GIT_TAG "main" + EXCLUDE_FROM_ALL + ) + FetchContent_MakeAvailable(SDL3) + else() + find_package(SDL3 CONFIG REQUIRED) + endif() FetchContent_Declare( iniparser @@ -645,7 +649,18 @@ set(CPACK_PACKAGE_DIRECTORY "dist") set(CPACK_PACKAGE_FILE_NAME "isle-${PROJECT_VERSION}-${ISLE_PACKAGE_NAME}-${CMAKE_SYSTEM_PROCESSOR}") if(MSVC) set(CPACK_GENERATOR ZIP) +elseif(PSP) + # Create an EBOOT.PBP file + create_pbp_file( + TARGET ${PROJECT_NAME} + ICON_PATH NULL + BACKGROUND_PATH NULL + PREVIEW_PATH NULL + TITLE ${PROJECT_NAME} + VERSION 01.00 + ) else() set(CPACK_GENERATOR TGZ) endif() include(CPack) + diff --git a/LEGO1/tgl/d3drm/mesh.cpp b/LEGO1/tgl/d3drm/mesh.cpp index 68f765a7..52a633a4 100644 --- a/LEGO1/tgl/d3drm/mesh.cpp +++ b/LEGO1/tgl/d3drm/mesh.cpp @@ -17,7 +17,7 @@ void* MeshImpl::ImplementationDataPtr() } // FUNCTION: BETA10 0x10170590 -inline Result MeshSetColor(MeshImpl::MeshData* pMesh, float r, float g, float b, float a) +inline Tgl::Result MeshSetColor(MeshImpl::MeshData* pMesh, float r, float g, float b, float a) { if (a > 0) { D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a); @@ -30,7 +30,7 @@ inline Result MeshSetColor(MeshImpl::MeshData* pMesh, float r, float g, float b, // FUNCTION: LEGO1 0x100a3ee0 // FUNCTION: BETA10 0x10170520 -Result MeshImpl::SetColor(float r, float g, float b, float a) +Tgl::Result MeshImpl::SetColor(float r, float g, float b, float a) { assert(m_data); @@ -38,14 +38,14 @@ Result MeshImpl::SetColor(float r, float g, float b, float a) } // FUNCTION: BETA10 0x10171320 -inline Result MeshSetTexture(MeshImpl::MeshData* pMesh, IDirect3DRMTexture* pD3DTexture) +inline Tgl::Result MeshSetTexture(MeshImpl::MeshData* pMesh, IDirect3DRMTexture* pD3DTexture) { - Result result = ResultVal(pMesh->groupMesh->SetGroupTexture(pMesh->groupIndex, pD3DTexture)); + Tgl::Result result = ResultVal(pMesh->groupMesh->SetGroupTexture(pMesh->groupIndex, pD3DTexture)); return result; } // FUNCTION: BETA10 0x10171260 -inline Result MeshImpl::SetTexture(const TextureImpl* pTexture) +inline Tgl::Result MeshImpl::SetTexture(const TextureImpl* pTexture) { assert(m_data); assert(!pTexture || pTexture->ImplementationData()); @@ -56,7 +56,7 @@ inline Result MeshImpl::SetTexture(const TextureImpl* pTexture) // FUNCTION: LEGO1 0x100a3f50 // FUNCTION: BETA10 0x10170630 -Result MeshImpl::SetTexture(const Texture* pTexture) +Tgl::Result MeshImpl::SetTexture(const Texture* pTexture) { assert(m_data); @@ -65,7 +65,7 @@ Result MeshImpl::SetTexture(const Texture* pTexture) // FUNCTION: LEGO1 0x100a3f80 // FUNCTION: BETA10 0x10170690 -Result MeshImpl::SetTextureMappingMode(TextureMappingMode mode) +Tgl::Result MeshImpl::SetTextureMappingMode(TextureMappingMode mode) { assert(m_data); @@ -73,7 +73,7 @@ Result MeshImpl::SetTextureMappingMode(TextureMappingMode mode) } // FUNCTION: BETA10 0x10170750 -inline Result MeshSetShadingModel(MeshImpl::MeshData* pMesh, ShadingModel model) +inline Tgl::Result MeshSetShadingModel(MeshImpl::MeshData* pMesh, ShadingModel model) { D3DRMRENDERQUALITY mode = Translate(model); return ResultVal(pMesh->groupMesh->SetGroupQuality(pMesh->groupIndex, mode)); @@ -81,14 +81,14 @@ inline Result MeshSetShadingModel(MeshImpl::MeshData* pMesh, ShadingModel model) // FUNCTION: LEGO1 0x100a3fc0 // FUNCTION: BETA10 0x101706f0 -Result MeshImpl::SetShadingModel(ShadingModel model) +Tgl::Result MeshImpl::SetShadingModel(ShadingModel model) { assert(m_data); return MeshSetShadingModel(m_data, model); } // FUNCTION: BETA10 0x101714e0 -inline Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rpTarget, IDirect3DRMMesh* pMesh) +inline Tgl::Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rpTarget, IDirect3DRMMesh* pMesh) { rpTarget = new MeshImpl::MeshData(); rpTarget->groupMesh = pMesh; @@ -97,13 +97,13 @@ inline Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rp DWORD dataSize; unsigned int vcount, fcount, vperface; - Result result = - ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, &vcount, &fcount, &vperface, &dataSize, NULL)); + Tgl::Result result = + ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, (long unsigned int*)&vcount, (long unsigned int*)&fcount, (long unsigned int*)&vperface, &dataSize, NULL)); assert(Succeeded(result)); unsigned int* faceBuffer = new unsigned int[dataSize]; result = - ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, &vcount, &fcount, &vperface, &dataSize, faceBuffer) + ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, (long unsigned int*)&vcount, (long unsigned int*)&fcount, (long unsigned int*)&vperface, &dataSize, (long unsigned int*)&faceBuffer) ); assert(Succeeded(result)); @@ -122,7 +122,7 @@ inline Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rp // Push information to new group D3DRMGROUPINDEX index; - result = ResultVal(pMesh->AddGroup(vcount, fcount, 3, faceBuffer, &index)); + result = ResultVal(pMesh->AddGroup(vcount, fcount, 3, (long unsigned int*)&faceBuffer, &index)); assert(Succeeded(result)); rpTarget->groupIndex = index; @@ -180,9 +180,9 @@ Mesh* MeshImpl::DeepClone(MeshBuilder* pMesh) return DeepClone(*static_cast(pMesh)); } -inline Result MeshShallowClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rpTarget, IDirect3DRMMesh* pMesh) +inline Tgl::Result MeshShallowClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rpTarget, IDirect3DRMMesh* pMesh) { - Result result = Error; + Tgl::Result result = Error; rpTarget = new MeshImpl::MeshData(); if (rpTarget) { @@ -220,13 +220,13 @@ Mesh* MeshImpl::ShallowClone(MeshBuilder* pMeshBuilder) } // FUNCTION: BETA10 0x10171ac0 -inline Result MeshGetTexture(MeshImpl::MeshData* pMesh, IDirect3DRMTexture** pD3DTexture) +inline Tgl::Result MeshGetTexture(MeshImpl::MeshData* pMesh, IDirect3DRMTexture** pD3DTexture) { return ResultVal(pMesh->groupMesh->GetGroupTexture(pMesh->groupIndex, pD3DTexture)); } // FUNCTION: BETA10 0x10171980 -inline Result MeshImpl::GetTexture(TextureImpl** ppTexture) +inline Tgl::Result MeshImpl::GetTexture(TextureImpl** ppTexture) { assert(m_data); assert(ppTexture); @@ -236,7 +236,7 @@ inline Result MeshImpl::GetTexture(TextureImpl** ppTexture) // TODO: This helps retail match, but it adds to the stack IDirect3DRMTexture* tex; - Result result = MeshGetTexture(m_data, &tex); + Tgl::Result result = MeshGetTexture(m_data, &tex); #ifndef BETA10 if (Succeeded(result)) { @@ -251,7 +251,7 @@ inline Result MeshImpl::GetTexture(TextureImpl** ppTexture) // FUNCTION: LEGO1 0x100a4330 // FUNCTION: BETA10 0x10170820 -Result MeshImpl::GetTexture(Texture*& rpTexture) +Tgl::Result MeshImpl::GetTexture(Texture*& rpTexture) { assert(m_data); diff --git a/LEGO1/tgl/d3drm/meshbuilder.cpp b/LEGO1/tgl/d3drm/meshbuilder.cpp index d7363fc8..18701001 100644 --- a/LEGO1/tgl/d3drm/meshbuilder.cpp +++ b/LEGO1/tgl/d3drm/meshbuilder.cpp @@ -45,7 +45,7 @@ Mesh* MeshBuilderImpl::CreateMesh( return pMeshImpl; } -inline Result CreateMesh( +inline Tgl::Result CreateMesh( IDirect3DRMMesh* pD3DRM, unsigned int faceCount, unsigned int vertexCount, @@ -96,8 +96,8 @@ inline Result CreateMesh( } } - Result result; - result = ResultVal(pD3DRM->AddGroup(vertexCount, faceCount, 3, fData, &groupIndex)); + Tgl::Result result; + result = ResultVal(pD3DRM->AddGroup(vertexCount, faceCount, 3, (long unsigned int*)fData, &groupIndex)); if (Succeeded(result)) { rpMesh->groupIndex = groupIndex; @@ -125,7 +125,7 @@ inline Result CreateMesh( return result; } -inline Result MeshBuilderImpl::CreateMeshImpl( +inline Tgl::Result MeshBuilderImpl::CreateMeshImpl( MeshImpl* pMeshImpl, unsigned int faceCount, unsigned int vertexCount, @@ -152,10 +152,10 @@ inline Result MeshBuilderImpl::CreateMeshImpl( } // FUNCTION: BETA10 0x1016e060 -inline Result MeshBuilderGetBoundingBox(IDirect3DRMMesh* pMesh, float min[3], float max[3]) +inline Tgl::Result MeshBuilderGetBoundingBox(IDirect3DRMMesh* pMesh, float min[3], float max[3]) { D3DRMBOX box; - Result result = ResultVal(pMesh->GetBox(&box)); + Tgl::Result result = ResultVal(pMesh->GetBox(&box)); if (Succeeded(result)) { min[0] = box.min.x; min[1] = box.min.y; @@ -169,7 +169,7 @@ inline Result MeshBuilderGetBoundingBox(IDirect3DRMMesh* pMesh, float min[3], fl // FUNCTION: LEGO1 0x100a3ae0 // FUNCTION: BETA10 0x1016ce00 -Result MeshBuilderImpl::GetBoundingBox(float min[3], float max[3]) const +Tgl::Result MeshBuilderImpl::GetBoundingBox(float min[3], float max[3]) const { assert(m_data);