From b304fbe0c9f19afe3ccbcc891cd143ea4dce69b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 6 Oct 2025 15:43:58 -0600 Subject: [PATCH] Build armips in libretro builds (requirement for some lua functionality) --- CMakeLists.txt | 9 +--- Core/Core.vcxproj | 4 +- Core/Core.vcxproj.filters | 2 +- Core/Debugger/SymbolMap.cpp | 15 ------- Core/ELF/ElfReader.h | 2 +- Core/ELF/{ElfTypes.h => PSPElfTypes.h} | 0 Core/MIPS/MIPSAsm.cpp | 12 ----- UWP/CoreUWP/CoreUWP.vcxproj | 4 +- UWP/CoreUWP/CoreUWP.vcxproj.filters | 2 +- ext/CMakeLists.txt | 7 ++- libretro/Makefile.common | 61 ++++++++++++++++++++++++-- 11 files changed, 70 insertions(+), 48 deletions(-) rename Core/ELF/{ElfTypes.h => PSPElfTypes.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1bddf5abc..eadfe3cb74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,6 @@ option(USE_LIBNX "Set to ON to build for Switch(libnx)" OFF) option(USE_FFMPEG "Build with FFMPEG support" ON) option(USE_DISCORD "Build with Discord support" ON) option(USE_MINIUPNPC "Build with miniUPnPc support" ON) -option(USE_ARMIPS "Build with armips support in API/debuggerdebugger" ON) option(USE_SYSTEM_SNAPPY "Dynamically link against system snappy" ${USE_SYSTEM_SNAPPY}) option(USE_SYSTEM_FFMPEG "Dynamically link against system FFMPEG" ${USE_SYSTEM_FFMPEG}) option(USE_SYSTEM_LIBZIP "Dynamically link against system libzip" ${USE_SYSTEM_LIBZIP}) @@ -2147,7 +2146,7 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Dialog/SavedataParam.h Core/ELF/ElfReader.cpp Core/ELF/ElfReader.h - Core/ELF/ElfTypes.h + Core/ELF/PSPElfTypes.h Core/ELF/PBPReader.cpp Core/ELF/PBPReader.h Core/ELF/PrxDecrypter.cpp @@ -2475,11 +2474,7 @@ if(ANDROID) endif() endif() -if(USE_ARMIPS) - set(CoreExtraLibs ${CoreExtraLibs} armips) -else() - add_compile_definitions(NO_ARMIPS=1) -endif() +set(CoreExtraLibs ${CoreExtraLibs} armips) # needed for VK_USE_PLATFORM_XCB_KHR only #if(VULKAN AND NOT WIN32) diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index abe294c4a8..e963618e46 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -1096,7 +1096,7 @@ - + @@ -1348,4 +1348,4 @@ - \ No newline at end of file + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index b53609f8b3..22f2c9ba91 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -1398,7 +1398,7 @@ ELF - + ELF diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index a47bb810e5..6d71345fd4 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -31,9 +31,7 @@ #include #include -#ifndef NO_ARMIPS #include -#endif #include #include "zlib.h" @@ -46,20 +44,7 @@ #include "Core/MemMap.h" #include "Core/Config.h" #include "Core/Debugger/SymbolMap.h" - -#ifndef NO_ARMIPS #include "ext/armips/Core/Assembler.h" -#else -struct Identifier { - explicit Identifier() {} - explicit Identifier(const std::string &s) {} -}; - -struct LabelDefinition { - Identifier name; - int64_t value; -}; -#endif SymbolMap *g_symbolMap; diff --git a/Core/ELF/ElfReader.h b/Core/ELF/ElfReader.h index ff10e5d31a..ea8bc1a5da 100644 --- a/Core/ELF/ElfReader.h +++ b/Core/ELF/ElfReader.h @@ -19,7 +19,7 @@ #include #include "Common/CommonTypes.h" -#include "Core/ELF/ElfTypes.h" +#include "Core/ELF/PSPElfTypes.h" enum { R_MIPS_NONE, diff --git a/Core/ELF/ElfTypes.h b/Core/ELF/PSPElfTypes.h similarity index 100% rename from Core/ELF/ElfTypes.h rename to Core/ELF/PSPElfTypes.h diff --git a/Core/MIPS/MIPSAsm.cpp b/Core/MIPS/MIPSAsm.cpp index 971549e9e9..99ee2bbde6 100644 --- a/Core/MIPS/MIPSAsm.cpp +++ b/Core/MIPS/MIPSAsm.cpp @@ -1,17 +1,12 @@ #include #include #include -#ifndef NO_ARMIPS #include -#endif #include #include "Common/CommonTypes.h" -#ifndef NO_ARMIPS #include "ext/armips/Core/Assembler.h" #include "ext/armips/Core/FileManager.h" -#endif - #include "Core/Debugger/SymbolMap.h" #include "Core/MemMapHelpers.h" #include "Core/MIPS/MIPSAsm.h" @@ -25,7 +20,6 @@ std::string GetAssembleError() return errorText; } -#ifndef NO_ARMIPS class PspAssemblerFile: public AssemblerFile { public: @@ -96,11 +90,5 @@ bool MipsAssembleOpcode(const char *line, DebugInterface *cpu, u32 address) { return true; } -#else -bool MipsAssembleOpcode(const char *line, DebugInterface *cpu, u32 address) { - errorText = "Built without armips, cannot assemble"; - return false; -} -#endif } // namespace diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index 8254121cf3..8ed06e7e0e 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -131,7 +131,7 @@ - + @@ -1032,4 +1032,4 @@ - \ No newline at end of file + diff --git a/UWP/CoreUWP/CoreUWP.vcxproj.filters b/UWP/CoreUWP/CoreUWP.vcxproj.filters index 27029b01ad..5789675c07 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj.filters +++ b/UWP/CoreUWP/CoreUWP.vcxproj.filters @@ -458,7 +458,7 @@ - + diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index dd7464ce82..32e5c4ce92 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -4,9 +4,8 @@ if(WIN32) set(ARMIPS_USE_STD_FILESYSTEM ON CACHE BOOL "" FORCE) endif() -if(USE_ARMIPS) - add_subdirectory(armips) -endif() +add_subdirectory(armips) + if(NOT USING_GLES2) add_subdirectory(glew) endif() @@ -44,7 +43,7 @@ set(FT_REQUIRE_PNG OFF CACHE BOOL "" FORCE) set(FT_REQUIRE_HARFBUZZ OFF CACHE BOOL "" FORCE) set(FT_REQUIRE_BROTLI OFF CACHE BOOL "" FORCE) if(NOT LIBRETRO) - add_subdirectory(freetype) + add_subdirectory(freetype) endif() if(NOT LIBRETRO) diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 28a0cacb24..05bf0f0763 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -306,6 +306,64 @@ SOURCES_CXX += \ ${EXTDIR}/at3_standalone/fft.cpp \ ${EXTDIR}/at3_standalone/mem.cpp +COREFLAGS += -DARMIPS_USE_STD_FILESYSTEM +SOURCES_CXX += \ + $(EXTDIR)/armips/Util/ByteArray.cpp \ + $(EXTDIR)/armips/Util/CRC.cpp \ + $(EXTDIR)/armips/Util/EncodingTable.cpp \ + $(EXTDIR)/armips/Util/FileClasses.cpp \ + $(EXTDIR)/armips/Util/Util.cpp \ + $(EXTDIR)/armips/Core/ELF/ElfRelocator.cpp \ + $(EXTDIR)/armips/Core/ELF/ElfFile.cpp \ + $(EXTDIR)/armips/Core/Assembler.cpp \ + $(EXTDIR)/armips/Core/Allocations.cpp \ + $(EXTDIR)/armips/Core/Common.cpp \ + $(EXTDIR)/armips/Core/Expression.cpp \ + $(EXTDIR)/armips/Core/ExpressionFunctions.cpp \ + $(EXTDIR)/armips/Core/ExpressionFunctionHandler.cpp \ + $(EXTDIR)/armips/Core/FileManager.cpp \ + $(EXTDIR)/armips/Core/Misc.cpp \ + $(EXTDIR)/armips/Core/SymbolData.cpp \ + $(EXTDIR)/armips/Core/SymbolTable.cpp \ + $(EXTDIR)/armips/Core/Types.cpp \ + $(EXTDIR)/armips/Commands/CAssemblerCommand.cpp \ + $(EXTDIR)/armips/Commands/CAssemblerLabel.cpp \ + $(EXTDIR)/armips/Commands/CDirectiveArea.cpp \ + $(EXTDIR)/armips/Commands/CDirectiveConditional.cpp \ + $(EXTDIR)/armips/Commands/CDirectiveData.cpp \ + $(EXTDIR)/armips/Commands/CDirectiveFile.cpp \ + $(EXTDIR)/armips/Commands/CDirectiveMessage.cpp \ + $(EXTDIR)/armips/Commands/CommandSequence.cpp \ + $(EXTDIR)/armips/Archs/Architecture.cpp \ + $(EXTDIR)/armips/Archs/ARM/Arm.cpp \ + $(EXTDIR)/armips/Archs/ARM/ArmOpcodes.cpp \ + $(EXTDIR)/armips/Archs/ARM/ArmParser.cpp \ + $(EXTDIR)/armips/Archs/ARM/ArmElfRelocator.cpp \ + $(EXTDIR)/armips/Archs/ARM/ArmExpressionFunctions.cpp \ + $(EXTDIR)/armips/Archs/ARM/CArmInstruction.cpp \ + $(EXTDIR)/armips/Archs/ARM/CThumbInstruction.cpp \ + $(EXTDIR)/armips/Archs/ARM/Pool.cpp \ + $(EXTDIR)/armips/Archs/ARM/ThumbOpcodes.cpp \ + $(EXTDIR)/armips/Archs/MIPS/CMipsInstruction.cpp \ + $(EXTDIR)/armips/Archs/MIPS/Mips.cpp \ + $(EXTDIR)/armips/Archs/MIPS/MipsElfFile.cpp \ + $(EXTDIR)/armips/Archs/MIPS/MipsElfRelocator.cpp \ + $(EXTDIR)/armips/Archs/MIPS/MipsExpressionFunctions.cpp \ + $(EXTDIR)/armips/Archs/MIPS/MipsMacros.cpp \ + $(EXTDIR)/armips/Archs/MIPS/MipsOpcodes.cpp \ + $(EXTDIR)/armips/Archs/MIPS/MipsParser.cpp \ + $(EXTDIR)/armips/Archs/MIPS/PsxRelocator.cpp \ + $(EXTDIR)/armips/Archs/SuperH/CShInstruction.cpp \ + $(EXTDIR)/armips/Archs/SuperH/ShElfRelocator.cpp \ + $(EXTDIR)/armips/Archs/SuperH/ShExpressionFunctions.cpp \ + $(EXTDIR)/armips/Archs/SuperH/ShOpcodes.cpp \ + $(EXTDIR)/armips/Archs/SuperH/ShParser.cpp \ + $(EXTDIR)/armips/Archs/SuperH/SuperH.cpp \ + $(EXTDIR)/armips/Parser/DirectivesParser.cpp \ + $(EXTDIR)/armips/Parser/ExpressionParser.cpp \ + $(EXTDIR)/armips/Parser/Parser.cpp \ + $(EXTDIR)/armips/Parser/Tokenizer.cpp + ifeq ($(PLATFORM_EXT), android) COREFLAGS += -DHAVE_DLFCN_H else ifneq ($(PLATFORM_EXT), win32) @@ -369,9 +427,6 @@ SOURCES_CXX += \ $(EXTDIR)/imgui/imgui_tables.cpp \ $(EXTDIR)/imgui/imgui_widgets.cpp -SOURCES_CXX += \ - $(EXTDIR)/armips/Core/Types.cpp - SOURCES_CXX += \ $(COMMONDIR)/Crypto/md5.cpp \ $(COMMONDIR)/Crypto/sha1.cpp \