diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000000..586ab724099 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) +project(ps2sdk) +include(ExternalProject) + +ExternalProject_Add(tools + SOURCE_DIR ${PROJECT_SOURCE_DIR}/tools + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/tools + BUILD_ALWAYS true) + +ExternalProject_Add(ee + SOURCE_DIR ${PROJECT_SOURCE_DIR}/ee + CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${PROJECT_SOURCE_DIR}/cmake/ee_toolchain.cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/ee + BUILD_ALWAYS true) + +#ExternalProject_Add(iop +# SOURCE_DIR ${PROJECT_SOURCE_DIR}/iop +# CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${PROJECT_SOURCE_DIR}/cmake/iop_toolchain.cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/iop +# BUILD_ALWAYS true) \ No newline at end of file diff --git a/cmake/ee_toolchain.cmake b/cmake/ee_toolchain.cmake new file mode 100644 index 00000000000..d219de4ad88 --- /dev/null +++ b/cmake/ee_toolchain.cmake @@ -0,0 +1,41 @@ +# +# CMake platform file for PS2 EE processor +# +# Copyright (C) 2009-2010 Mathias Lafeldt +# Copyright (C) 2023 Francisco Javier Trujillo Mata +# Copyright (C) 2024 André Guilherme +# Copyright (C) 2024-Present PS2DEV Team +# + +cmake_minimum_required(VERSION 3.10) + +INCLUDE(CMakeForceCompiler) + + +SET(CMAKE_SYSTEM_NAME Generic) +SET(CMAKE_SYSTEM_VERSION 1) +SET(CMAKE_SYSTEM_PROCESSOR mips) + +SET(CMAKE_ASM_COMPILER mips64r5900el-ps2-elf-gcc) +SET(CMAKE_C_COMPILER mips64r5900el-ps2-elf-gcc) +SET(CMAKE_CXX_COMPILER mips64r5900el-ps2-elf-g++) + +find_program(CMAKE_OBJCOPY mips64r5900el-ps2-elf-objcopy) + +SET(EE_CFLAGS "-D_EE -G0 -O2 -Wall -Werror -gdwarf-2 -gz" CACHE STRING "EE C compiler flags" FORCE) +SET(EE_LDFLAGS "-Wl,-zmax-page-size=128" CACHE STRING "EE linker flags" FORCE) + +SET(CMAKE_TARGET_INSTALL_PREFIX $ENV{PS2DEV}/ports) + +SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) + +SET(CMAKE_C_FLAGS_INIT ${EE_CFLAGS}) +SET(CMAKE_CXX_FLAGS_INIT ${EE_CFLAGS}) +SET(CMAKE_EXE_LINKER_FLAGS_INIT ${EE_LDFLAGS}) + + +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostartfiles -Wl,-r -Wl,-d") + +SET(PS2 TRUE) +SET(PLATFORM_PS2 TRUE) +SET(EE TRUE) diff --git a/cmake/iop_toolchain.cmake b/cmake/iop_toolchain.cmake new file mode 100644 index 00000000000..6791a1c3b1f --- /dev/null +++ b/cmake/iop_toolchain.cmake @@ -0,0 +1,53 @@ +# +# CMake platform file for PS2 EE processor +# +# Copyright (C) 2009-2010 Mathias Lafeldt +# Copyright (C) 2023 Francisco Javier Trujillo Mata +# Copyright (C) 2024 André Guilherme +# Copyright (C) 2024-Present PS2DEV Team +# + +cmake_minimum_required(VERSION 3.0) + +INCLUDE(CMakeForceCompiler) +if(DEFINED ENV{PS2SDK}) + SET(PS2SDK $ENV{PS2SDK}) +else() + message(FATAL_ERROR "The environment variable PS2SDK needs to be defined.") +endif() + +if(DEFINED ENV{PS2DEV}) + SET(PS2DEV $ENV{PS2DEV}) +else() + message(FATAL_ERROR "The environment variable PS2DEV needs to be defined.") +endif() + +SET(CMAKE_SYSTEM_NAME Generic) +SET(CMAKE_SYSTEM_VERSION 1) +SET(CMAKE_SYSTEM_PROCESSOR mips) + +SET(CMAKE_C_COMPILER mips64r5900el-ps2-elf-gcc) +SET(CMAKE_CXX_COMPILER mips64r5900el-ps2-elf-g++) + +SET(EE_CFLAGS "-I$ENV{PS2SDK}/ee/include -I$ENV{PS2SDK}/common/include -I$ENV{PS2SDK}/ports/include -D_EE -DPS2 -D__PS2__ -O2 -G0" CACHE STRING "EE C compiler flags" FORCE) +SET(EE_LDFLAGS "-L$ENV{PS2SDK}/ee/lib -L$ENV{PS2DEV}/gsKit/lib -L$ENV{PS2SDK}/ports/lib -Wl,-zmax-page-size=128 -T$ENV{PS2SDK}/ee/startup/linkfile" CACHE STRING "EE linker flags" FORCE) + +SET(CMAKE_TARGET_INSTALL_PREFIX $ENV{PS2DEV}/ports) + +SET(CMAKE_FIND_ROOT_PATH $ENV{PS2DEV} $ENV{PS2DEV}/ee $ENV{PS2DEV}/ee/ee $ENV{PS2SDK} $ENV{PS2SDK}/ports) +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) + +SET(CMAKE_C_FLAGS_INIT ${EE_CFLAGS}) +SET(CMAKE_CXX_FLAGS_INIT ${EE_CFLAGS}) +SET(CMAKE_EXE_LINKER_FLAGS_INIT ${EE_LDFLAGS}) + + +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostartfiles -Wl,-r -Wl,-d") + +SET(PS2 TRUE) +SET(PLATFORM_PS2 TRUE) +SET(EE TRUE) diff --git a/cmake/utils.cmake b/cmake/utils.cmake new file mode 100644 index 00000000000..ab9af8b3dd0 --- /dev/null +++ b/cmake/utils.cmake @@ -0,0 +1,43 @@ +# TODO investigate using interface libraries, will help with erl generation +# Compiles the same source file multiple times with different defines +function(compile_multiple target srcfile) + cmake_parse_arguments(PARSE_ARGV 2 "arg" "" "" "OBJECTS") + + foreach(obj ${arg_OBJECTS}) + add_library(${obj} OBJECT ${srcfile}) + get_filename_component(def ${obj} NAME_WLE) + target_compile_definitions(${obj} PRIVATE "F_${def}") + + get_target_property(target_id ${target} INCLUDE_DIRECTORIES) + target_include_directories(${obj} PRIVATE ${target_id}) + + target_link_libraries(${target} PRIVATE ${obj}) + endforeach() +endfunction() + +# Add an erl output for a given target +function(target_add_erl target) + add_custom_command(OUTPUT "lib${target}.erl" + COMMAND ${CMAKE_C_COMPILER} -nostdlib -Wl,-r -Wl,-d -o "lib${target}.erl" $ + COMMAND ${CMAKE_STRIP} --strip-unneeded -R .mdebug.eabi64 -R .reginfo -R .comment lib${target}.erl + DEPENDS ${target} + COMMAND_EXPAND_LISTS + ) + add_custom_target(${target}_erl ALL + DEPENDS lib${target}.erl + ) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.erl + DESTINATION lib + ) +endfunction() + +# Generates a C array of the binary output of a target +# objcopy -Obinary && bin2c +macro(bin_include from_target output_name) +add_custom_command(OUTPUT "${output_name}.c" + COMMAND ${CMAKE_OBJCOPY} -Obinary $ "${output_name}.bin" + COMMAND bin2c "${output_name}.bin" "${output_name}.c" "${from_target}" + BYPRODUCTS "${output_name}.bin" + DEPENDS ${from_target} +) +endmacro() diff --git a/ee/CMakeLists.txt b/ee/CMakeLists.txt new file mode 100644 index 00000000000..a8179bf235e --- /dev/null +++ b/ee/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.10) +project(ps2sdk-ee C ASM) +file(REAL_PATH ../ PS2SDKSRC_ROOT) + +set(EE_INC + ${PS2SDKSRC_ROOT}/common/include + ${PROJECT_SOURCE_DIR}/kernel/include + ${PROJECT_SOURCE_DIR}/erl/include +) + +include(${PS2SDKSRC_ROOT}/cmake/utils.cmake) + +add_subdirectory(debug) +add_subdirectory(dma) +add_subdirectory(draw) +add_subdirectory(eedebug) +add_subdirectory(elf-loader) +add_subdirectory(erl) +add_subdirectory(font) +add_subdirectory(graph) +add_subdirectory(input) +add_subdirectory(kernel) +add_subdirectory(libcglue) +add_subdirectory(libgs) +add_subdirectory(libprofglue) +add_subdirectory(libvux) +add_subdirectory(math3d) +add_subdirectory(mpeg) +add_subdirectory(network) +add_subdirectory(packet) +add_subdirectory(packet2) +add_subdirectory(rpc) +add_subdirectory(sbv) +add_subdirectory(startup) diff --git a/ee/debug/CMakeLists.txt b/ee/debug/CMakeLists.txt new file mode 100644 index 00000000000..71c1e3058ed --- /dev/null +++ b/ee/debug/CMakeLists.txt @@ -0,0 +1,17 @@ +add_library(debug) +target_include_directories(debug PUBLIC include) +target_include_directories(debug PRIVATE ${PS2SDKSRC_ROOT}/common/include) +target_link_libraries(debug PRIVATE kernel) +target_sources(debug PRIVATE + src/callstack.c + src/callstackget.S + #src/erl-support.c TODO + src/font.c + src/hwbp.S + src/scr_printf.c + src/screenshot.c +) +file(GLOB DEBUG_INCLUDE_FILES "include/*.h*") +set_target_properties(debug PROPERTIES PUBLIC_HEADER "${DEBUG_INCLUDE_FILES}") + +install(TARGETS debug) diff --git a/ee/dma/CMakeLists.txt b/ee/dma/CMakeLists.txt new file mode 100644 index 00000000000..c8b38942664 --- /dev/null +++ b/ee/dma/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(dma) +target_include_directories(dma PUBLIC include) +target_include_directories(dma PRIVATE ${EE_INC} ${PROJECT_SOURCE_DIR}/packet2/include) +target_sources(dma PRIVATE src/dma.c src/erl-support.c) +file(GLOB DMA_INCLUDE_FILES "include/*.h*") +set_target_properties(dma PROPERTIES PUBLIC_HEADER "${DMA_INCLUDE_FILES}") +install(TARGETS dma) +target_add_erl(dma) diff --git a/ee/draw/CMakeLists.txt b/ee/draw/CMakeLists.txt new file mode 100644 index 00000000000..5b75612bdc3 --- /dev/null +++ b/ee/draw/CMakeLists.txt @@ -0,0 +1,19 @@ +add_library(draw) +target_include_directories(draw PUBLIC include) +target_include_directories(draw PRIVATE + ${EE_INC} +) +target_link_libraries(draw PRIVATE math3d dma) +target_sources(draw PRIVATE + src/draw_environment.c + src/draw.c + src/draw2d.c + src/draw3d.c + src/erl-support.c +) + +file(GLOB DRAW_INCLUDE_FILES "include/*.h*") +set_target_properties(draw PROPERTIES PUBLIC_HEADER "${DRAW_INCLUDE_FILES}") +install(TARGETS draw) + +target_add_erl(draw) \ No newline at end of file diff --git a/ee/eedebug/CMakeLists.txt b/ee/eedebug/CMakeLists.txt new file mode 100644 index 00000000000..c60c3ffb6e6 --- /dev/null +++ b/ee/eedebug/CMakeLists.txt @@ -0,0 +1,18 @@ +add_library(eedebug) +target_include_directories(eedebug PUBLIC include) +target_include_directories(eedebug PRIVATE + ${EE_INC} +) + +target_sources(eedebug PRIVATE + src/ee_dbg_low.S + src/ee_debug.c + src/ee_exceptions.S + src/erl-support.c +) + +file(GLOB eedebug_INCLUDE_FILES "include/*.h*") +set_target_properties(eedebug PROPERTIES PUBLIC_HEADER "${eedebug_INCLUDE_FILES}") +install(TARGETS eedebug) + +target_add_erl(eedebug) \ No newline at end of file diff --git a/ee/elf-loader/CMakeLists.txt b/ee/elf-loader/CMakeLists.txt new file mode 100644 index 00000000000..86f9b80f415 --- /dev/null +++ b/ee/elf-loader/CMakeLists.txt @@ -0,0 +1,19 @@ +add_subdirectory(src/loader) + +add_library(elf-loader) +target_include_directories(elf-loader PUBLIC include) +target_include_directories(elf-loader PRIVATE + ${EE_INC} +) + +bin_include(loader loader_bin) +target_sources(elf-loader PRIVATE + src/elf.c + loader_bin.c +) + +file(GLOB elf-loader_INCLUDE_FILES "include/*.h*") +set_target_properties(elf-loader PROPERTIES PUBLIC_HEADER "${elf-loader_INCLUDE_FILES}") +install(TARGETS elf-loader) + +target_add_erl(elf-loader) \ No newline at end of file diff --git a/ee/elf-loader/src/loader/CMakeLists.txt b/ee/elf-loader/src/loader/CMakeLists.txt new file mode 100644 index 00000000000..a07e26a294c --- /dev/null +++ b/ee/elf-loader/src/loader/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(loader) +target_sources(loader PRIVATE src/loader.c) +target_include_directories(loader PRIVATE ${EE_INC}) +target_link_libraries(loader PRIVATE kernel cglue) +target_link_options(loader PRIVATE -T${CMAKE_CURRENT_SOURCE_DIR}/linkfile) \ No newline at end of file diff --git a/ee/erl/CMakeLists.txt b/ee/erl/CMakeLists.txt new file mode 100644 index 00000000000..369ea9c7e54 --- /dev/null +++ b/ee/erl/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(erl) +target_include_directories(erl PUBLIC include) +target_include_directories(erl PRIVATE ${EE_INC}) +target_sources(erl PRIVATE src/erl.c src/hashtab.c src/lookupa.c src/recycle.c) \ No newline at end of file diff --git a/ee/font/CMakeLists.txt b/ee/font/CMakeLists.txt new file mode 100644 index 00000000000..dfe0f61d31a --- /dev/null +++ b/ee/font/CMakeLists.txt @@ -0,0 +1,17 @@ +add_library(font) +target_include_directories(font PUBLIC include) +target_include_directories(font PRIVATE + ${EE_INC} +) +target_link_libraries(font PRIVATE draw math3d) +target_sources(font PRIVATE + src/fontx.c + src/fsfont.c + src/erl-support.c +) + +file(GLOB FONT_INCLUDE_FILES "include/*.h*") +set_target_properties(font PROPERTIES PUBLIC_HEADER "${FONT_INCLUDE_FILES}") +install(TARGETS font) + +target_add_erl(font) \ No newline at end of file diff --git a/ee/graph/CMakeLists.txt b/ee/graph/CMakeLists.txt new file mode 100644 index 00000000000..e972b349764 --- /dev/null +++ b/ee/graph/CMakeLists.txt @@ -0,0 +1,19 @@ +add_library(graph) +target_include_directories(graph PUBLIC include) +target_include_directories(graph PRIVATE + ${EE_INC} +) +target_link_libraries(graph PRIVATE cdvd) +target_sources(graph PRIVATE + src/graph_config.c + src/graph_mode.c + src/graph_vram.c + src/graph.c + src/erl-support.c +) + +file(GLOB GRAPH_INCLUDE_FILES "include/*.h*") +set_target_properties(graph PROPERTIES PUBLIC_HEADER "${GRAPH_INCLUDE_FILES}") +install(TARGETS graph) + +target_add_erl(graph) \ No newline at end of file diff --git a/ee/input/CMakeLists.txt b/ee/input/CMakeLists.txt new file mode 100644 index 00000000000..6edf9c8eb6a --- /dev/null +++ b/ee/input/CMakeLists.txt @@ -0,0 +1,36 @@ +add_library(input) +target_include_directories(input PUBLIC include) +target_include_directories(input PRIVATE + ${EE_INC} +) + +target_link_libraries(input PRIVATE pad) + +target_sources(input PRIVATE + src/input.c + src/erl-support.c +) + +file(GLOB INPUT_INCLUDE_FILES "include/*.h*") +set_target_properties(input PROPERTIES PUBLIC_HEADER "${INPUT_INCLUDE_FILES}") +install(TARGETS input) + +target_add_erl(input) + +# inputx +add_library(inputx) +target_include_directories(inputx PUBLIC include) +target_include_directories(inputx PRIVATE + ${EE_INC} +) +target_compile_definitions(inputx PRIVATE _XINPUT) + +target_link_libraries(inputx PRIVATE pad multitap) + +target_sources(inputx PRIVATE + src/input.c + src/erl-support.c +) + +install(TARGETS inputx) +target_add_erl(inputx) \ No newline at end of file diff --git a/ee/iopreboot/CMakeLists.txt b/ee/iopreboot/CMakeLists.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/ee/kernel/CMakeLists.txt b/ee/kernel/CMakeLists.txt new file mode 100644 index 00000000000..f14fd3df55c --- /dev/null +++ b/ee/kernel/CMakeLists.txt @@ -0,0 +1,215 @@ +cmake_minimum_required(VERSION 3.10) + +add_subdirectory(src/eenull) +add_subdirectory(src/osdsrc) +add_subdirectory(src/srcfile) +add_subdirectory(src/tlbsrc) + +add_library(kernel) +target_include_directories(kernel PUBLIC include) +target_include_directories(kernel PRIVATE + ${EE_INC} + ${PROJECT_SOURCE_DIR}/rpc/cdvd/include +) + +compile_multiple(kernel src/sifcmd.c OBJECTS + sif_cmd_send.o _sif_cmd_int_handler.o sif_cmd_main.o + sif_cmd_client.o sif_cmd_remove_cmdhandler.o sif_sreg_get.o +) + +compile_multiple(kernel src/sifrpc.c OBJECTS + SifBindRpc.o SifCallRpc.o SifRpcGetOtherData.o + SifRegisterRpc.o SifRemoveRpc.o SifSetRpcQueue.o SifRemoveRpcQueue.o SifGetNextRequest.o + SifExecRequest.o SifRpcLoop.o SifRpcMain.o _rpc_get_packet.o + _rpc_get_fpacket.o SifCheckStatRpc.o +) + +compile_multiple(kernel src/fileio.c OBJECTS + __fio_internals.o fio_init.o _fio_intr.o fio_sync.o fio_setblockmode.o + fio_exit.o fio_open.o fio_close.o fio_read.o + fio_write.o fio_lseek.o fio_mkdir.o _fio_read_intr.o fio_getc.o fio_putc.o + fio_ioctl.o fio_dopen.o fio_dclose.o fio_dread.o fio_getstat.o fio_chstat.o + fio_remove.o fio_format.o fio_rmdir.o fio_gets.o +) + +compile_multiple(kernel src/loadfile.c OBJECTS + SifLoadFileInit.o SifLoadFileExit.o _SifLoadModule.o SifLoadModule.o + SifLoadStartModule.o SifLoadModuleEncrypted.o SifStopModule.o SifUnloadModule.o + SifSearchModuleByName.o SifSearchModuleByAddress.o _SifLoadElfPart.o SifLoadElfPart.o + SifLoadElf.o SifLoadElfEncrypted.o SifIopSetVal.o SifIopGetVal.o + _SifLoadModuleBuffer.o SifLoadModuleBuffer.o SifLoadStartModuleBuffer.o + SifExecModuleBuffer.o SifExecModuleFile.o +) + +compile_multiple(kernel src/iopheap.c OBJECTS + SifInitIopHeap.o SifExitIopHeap.o SifAllocIopHeap.o + SifFreeIopHeap.o SifLoadIopHeap.o +) + +compile_multiple(kernel src/iopcontrol.c OBJECTS + SifIopReboot.o SifIopReset.o SifIopIsAlive.o SifIopSync.o __iop_control_internals.o +) + +compile_multiple(kernel src/glue.c OBJECTS + DIntr.o EIntr.o EnableIntc.o DisableIntc.o EnableDmac.o DisableDmac.o + iEnableIntc.o iDisableIntc.o iEnableDmac.o iDisableDmac.o + SyncDCache.o iSyncDCache.o InvalidDCache.o iInvalidDCache.o +) + +compile_multiple(kernel src/sio.c OBJECTS + sio_init.o sio_putc.o sio_getc.o sio_write.o sio_read.o sio_puts.o + sio_gets.o sio_getc_block.o sio_flush.o sio_putsn.o +) + +compile_multiple(kernel src/rom0_info.c OBJECTS + _info_internals.o GetRomNameWithIODriver.o GetRomName.o IsDESRMachineWithIODriver.o IsDESRMachine.o IsT10KWithIODriver.o IsT10K.0 +) + +compile_multiple(kernel src/osd_config.c OBJECTS + _config_internals.o converttobcd.o convertfrombcd.o __adjustTime.o IsEarlyJap.o + configGetLanguageWithIODriver.o configGetLanguage.o + configSetLanguageWithIODriver.o configSetLanguage.o + configGetTvScreenTypeWithIODriver.o configGetTvScreenType.o + configSetTvScreenTypeWithIODriver.o configSetTvScreenType.o + configGetDateFormatWithIODriver.o configGetDateFormat.o + configSetDateFormatWithIODriver.o configSetDateFormat.o + configGetTimeFormatWithIODriver.o configGetTimeFormat.o + configSetTimeFormatWithIODriver.o configSetTimeFormat.o + configGetTimezoneWithIODriver.o configGetTimezone.o + configSetTimezoneWithIODriver.o configSetTimezone.o + configIsSpdifEnabledWithIODriver.o configIsSpdifEnabled.o + configSetSpdifEnabledWithIODriver.o configSetSpdifEnabled.o + configIsDaylightSavingEnabledWithIODriver.o configIsDaylightSavingEnabled.o + configSetDaylightSavingEnabledWithIODriver.o configSetDaylightSavingEnabled.o + configConvertToGmtTime.o configConvertToLocalTimeWithIODriver.o configConvertToLocalTime.o +) + +bin_include(osdsrc osdsrc_bin) +target_sources(kernel PRIVATE src/libosd.c src/libosd_full.c src/libosd_common.c osdsrc_bin.c) + +bin_include(tlbsrc tlbsrc_bin) +target_sources(kernel PRIVATE src/tlbfunc.c tlbsrc_bin.c) + +bin_include(eenull eenull_bin) +bin_include(srcfile srcfile_bin) +target_sources(kernel PRIVATE src/alarm.c srcfile_bin.c) + +compile_multiple(kernel src/thread.c OBJECTS + _thread_internals.o iWakeupThread.o iRotateThreadReadyQueue.o iSuspendThread.o) + +compile_multiple(kernel src/setup.c OBJECTS kCopy.o kCopyBytes.o) + +compile_multiple(kernel src/exit.c OBJECTS + _exit_internals.o SetArg.o Exit.o ExecPS2.o LoadExecPS2.o ExecOSD.o) + +compile_multiple(kernel src/timer.c OBJECTS + timer_data.o + SetT2.o + SetT2_COUNT.o + SetT2_MODE.o + SetT2_COMP.o + InitTimer.o + EndTimer.o + GetTimerPreScaleFactor.o + StartTimerSystemTime.o + StopTimerSystemTime.o + SetNextComp.o + InsertAlarm_ForTimer.o + UnlinkAlarm_ForTimer.o + TimerHandler_callback.o + iGetTimerSystemTime.o + GetTimerSystemTime.o + iAllocTimerCounter.o + AllocTimerCounter.o + iFreeTimerCounter.o + FreeTimerCounter.o + iGetTimerUsedUnusedCounters.o + GetTimerUsedUnusedCounters.o + iStartTimerCounter.o + StartTimerCounter.o + iStopTimerCounter.o + StopTimerCounter.o + SetTimerCount.o + iGetTimerBaseTime.o + GetTimerBaseTime.o + iGetTimerCount.o + GetTimerCount.o + iSetTimerHandler.o + SetTimerHandler.o + TimerBusClock2USec.o + TimerUSec2BusClock.o + TimerBusClock2Freq.o + TimerFreq2BusClock.o + cpu_ticks.o +) + +compile_multiple(kernel src/timer_alarm.c OBJECTS + alarm_data.o + ForTimer_InitAlarm.o + AlarmHandler.o + iSetTimerAlarm.o + SetTimerAlarm.o + iReleaseTimerAlarm.o + ReleaseTimerAlarm.o +) + +compile_multiple(kernel src/delaythread.c OBJECTS DelayThread.o) + +compile_multiple(kernel src/getkernel.c OBJECTS + GetSyscallHandler.o GetSyscall.o GetExceptionHandler.o GetInterruptHandler.o) + +compile_multiple(kernel src/initsys.c OBJECTS _InitSys.o TerminateLibrary.o) + +compile_multiple(kernel src/kernel_util.c OBJECTS WaitSemaEx.o) + +# IDK why these were on their own in the makefile, keep it for now +set(EXEC_SYSCALLS KExit.o _LoadExecPS2.o _ExecPS2.o) +set(EXECOSD_SYSCALL _ExecOSD.o) +set(ALARM_SYSCALLS _SetAlarm.o SetAlarm.o _ReleaseAlarm.o ReleaseAlarm.o) +set(ALARM_INTR_SYSCALLS _iSetAlarm.o iSetAlarm.o _iReleaseAlarm.o iReleaseAlarm.o) +set(ROTATE_THREAD_READY_QUEUE_SYSCALL _iRotateThreadReadyQueue.o) +set(IWAKEUP_THREAD_SYSCALL _iWakeupThread.o) +set(ISUSPEND_THREAD_SYSCALL _iSuspendThread.o) +set(TLB_SYSCALLS PutTLBEntry.o iPutTLBEntry.o _SetTLBEntry.o iSetTLBEntry.o GetTLBEntry.o iGetTLBEntry.o ProbeTLBEntry.o iProbeTLBEntry.o ExpandScratchPad.o) + +compile_multiple(kernel src/kernel.S OBJECTS + ResetEE.o SetGsCrt.o ${EXEC_SYSCALLS} + RFU009.o AddSbusIntcHandler.o RemoveSbusIntcHandler.o Interrupt2Iop.o + SetVTLBRefillHandler.o SetVCommonHandler.o SetVInterruptHandler.o + AddIntcHandler.o AddIntcHandler2.o RemoveIntcHandler.o AddDmacHandler.o AddDmacHandler2.o + RemoveDmacHandler.o _EnableIntc.o _DisableIntc.o _EnableDmac.o _DisableDmac.o + ${ALARM_SYSCALLS} _iEnableIntc.o _iDisableIntc.o _iEnableDmac.o + _iDisableDmac.o ${ALARM_INTR_SYSCALLS} CreateThread.o DeleteThread.o + StartThread.o ExitThread.o ExitDeleteThread.o TerminateThread.o + iTerminateThread.o DisableDispatchThread.o EnableDispatchThread.o + ChangeThreadPriority.o iChangeThreadPriority.o RotateThreadReadyQueue.o + ${ROTATE_THREAD_READY_QUEUE_SYSCALL} ReleaseWaitThread.o iReleaseWaitThread.o + GetThreadId.o _iGetThreadId.o ReferThreadStatus.o iReferThreadStatus.o SleepThread.o + WakeupThread.o ${IWAKEUP_THREAD_SYSCALL} CancelWakeupThread.o iCancelWakeupThread.o + SuspendThread.o ${ISUSPEND_THREAD_SYSCALL} ResumeThread.o iResumeThread.o + RFU059.o RFU060.o SetupThread.o RFU061.o SetupHeap.o EndOfHeap.o CreateSema.o DeleteSema.o + iSignalSema.o SignalSema.o WaitSema.o PollSema.o iPollSema.o + ReferSemaStatus.o iReferSemaStatus.o iDeleteSema.o SetOsdConfigParam.o + GetOsdConfigParam.o GetGsHParam.o GetGsVParam.o SetGsHParam.o + SetGsVParam.o CreateEventFlag.o DeleteEventFlag.o SetEventFlag.o + iSetEventFlag.o ${TLB_SYSCALLS} + EnableIntcHandler.o iEnableIntcHandler.o DisableIntcHandler.o iDisableIntcHandler.o + EnableDmacHandler.o iEnableDmacHandler.o DisableDmacHandler.o iDisableDmacHandler.o + KSeg0.o EnableCache.o DisableCache.o GetCop0.o FlushCache.o CpuConfig.o + iGetCop0.o iFlushCache.o RFU105.o iCpuConfig.o SifStopDma.o + SetCPUTimerHandler.o SetCPUTimer.o SetOsdConfigParam2.o + GetOsdConfigParam2.o GsGetIMR.o iGsGetIMR.o GsPutIMR.o iGsPutIMR.o + SetPgifHandler.o SetVSyncFlag.o SetSyscall.o SifDmaStat.o iSifDmaStat.o + SifSetDma.o iSifSetDma.o SifSetDChain.o iSifSetDChain.o SifSetReg.o + SifGetReg.o ${EXECOSD_SYSCALL} Deci2Call.o PSMode.o MachineType.o GetMemorySize.o _GetGsDxDyOffset.o + _InitTLB.o SetMemoryMode.o + SifWriteBackDCache.o _SyncDCache.o _InvalidDCache.o __errno.o errno.o + strncpy.o strlen.o memcpy.o memset.o __syscall.o GPfuncs.o _print.o +) + +target_sources(kernel PRIVATE src/setup_syscalls.S src/debug.c src/erl-support.c) + +file(GLOB KERNEL_INCLUDE_FILES "include/*.h*") +set_target_properties(kernel PROPERTIES PUBLIC_HEADER "${KERNEL_INCLUDE_FILES}") + +install(TARGETS kernel) \ No newline at end of file diff --git a/ee/kernel/src/eenull/CMakeLists.txt b/ee/kernel/src/eenull/CMakeLists.txt new file mode 100644 index 00000000000..44ae69d24f7 --- /dev/null +++ b/ee/kernel/src/eenull/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(eenull) +target_sources(eenull PRIVATE src/eenull.s) +target_compile_options(eenull PRIVATE -mno-gpopt) +target_link_options(eenull PRIVATE -nostdlib -nostartfiles -T${CMAKE_CURRENT_SOURCE_DIR}/linkfile -s) \ No newline at end of file diff --git a/ee/kernel/src/osdsrc/CMakeLists.txt b/ee/kernel/src/osdsrc/CMakeLists.txt new file mode 100644 index 00000000000..de4b2eaf9ff --- /dev/null +++ b/ee/kernel/src/osdsrc/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(osdsrc) + +target_sources(osdsrc PRIVATE src/ExecPS2.c src/osd.c src/osdsrc.c) +target_compile_definitions(osdsrc PRIVATE -DREUSE_EXECPS2) +target_compile_options(osdsrc PRIVATE -fno-tree-loop-distribute-patterns -mno-gpopt) +target_include_directories(osdsrc PRIVATE + ${EE_INC} + ${PROJECT_SOURCE_DIR}/rpc/cdvd/include +) +target_link_options(osdsrc PRIVATE -nostdlib -nostartfiles -T${CMAKE_CURRENT_SOURCE_DIR}/linkfile -s) \ No newline at end of file diff --git a/ee/kernel/src/srcfile/CMakeLists.txt b/ee/kernel/src/srcfile/CMakeLists.txt new file mode 100644 index 00000000000..269f5b32513 --- /dev/null +++ b/ee/kernel/src/srcfile/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(srcfile) +target_sources(srcfile PRIVATE src/srcfile.c src/alarm.c src/dispatch.s) +target_compile_options(srcfile PRIVATE -mno-gpopt -fno-tree-loop-distribute-patterns) +target_include_directories(srcfile PRIVATE ${EE_INC}) +target_link_options(srcfile PRIVATE -nostdlib -nostartfiles -T${CMAKE_CURRENT_SOURCE_DIR}/linkfile -s) \ No newline at end of file diff --git a/ee/kernel/src/tlbsrc/CMakeLists.txt b/ee/kernel/src/tlbsrc/CMakeLists.txt new file mode 100644 index 00000000000..451f041040f --- /dev/null +++ b/ee/kernel/src/tlbsrc/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(tlbsrc) +target_sources(tlbsrc PRIVATE src/tlbsrc.c) +target_compile_options(tlbsrc PRIVATE -mno-gpopt) +target_include_directories(tlbsrc PRIVATE ${EE_INC}) +target_link_options(tlbsrc PRIVATE -nostdlib -nostartfiles -T${CMAKE_CURRENT_SOURCE_DIR}/linkfile -s) \ No newline at end of file diff --git a/ee/libcglue/CMakeLists.txt b/ee/libcglue/CMakeLists.txt new file mode 100644 index 00000000000..9ed864e4245 --- /dev/null +++ b/ee/libcglue/CMakeLists.txt @@ -0,0 +1,205 @@ +add_library(cglue) +target_include_directories(cglue PUBLIC ${EE_INC} include) +target_sources(cglue PRIVATE src/rtc.c) +target_link_libraries(cglue PRIVATE kernel) + +compile_multiple(cglue src/timezone.c OBJECTS + _libcglue_timezone_update.o ps2sdk_setTimezone.o ps2sdk_setDaylightSaving.o +) + +compile_multiple(cglue src/fdman.c OBJECTS + __fdman_sema.o + __descriptor_data_pool.o + __descriptormap.o + __fdman_init.o + __fdman_deinit.o + __fdman_get_new_descriptor.o + __fdman_get_dup_descriptor.o + __fdman_get_dup2_descriptor.o + __fdman_release_descriptor.o +) + +compile_multiple(cglue src/init.c OBJECTS + __gprof_init.o + __gprof_cleanup.o + __libpthreadglue_init.o + __libpthreadglue_deinit.o + _libcglue_init.o + _libcglue_deinit.o + _libcglue_args_parse.o +) + +compile_multiple(cglue src/sleep.c OBJECTS + nanosleep.o +) + +compile_multiple(cglue src/sjis.c OBJECTS + isSpecialSJIS.o isSpecialASCII.o strcpy_ascii.o strcpy_sjis.o +) + +compile_multiple(cglue src/cwd.c OBJECTS + __cwd.o __cwd_len.o __get_drive.o getcwd.o __path_absolute.o __init_cwd.o +) + +compile_multiple(cglue src/ps2sdkapi.c OBJECTS + __fioOpsInitialize.o + __fioOpenHelper.o + __fioGetFdHelper.o + __fioGetFilenameHelper.o + __fioCloseHelper.o + __fioDcloseHelper.o + __fioReadHelper.o + __fioLseekHelper.o + __fioWriteHelper.o + __fioIoctlHelper.o + __fioDreadHelper.o + __fioLseekDirHelper.o + __libcglue_init_stdio.o + __fioMkdirHelper.o + __fioGetstatHelper.o + __fioOpsInitializeImpl.o + _libcglue_fdman_path_ops.o + _libcglue_fdman_socket_ops.o + _libcglue_fdman_inet_ops.o +) + +compile_multiple(cglue src/glue.c OBJECTS + __dummy_passwd.o + __transform_errno.o + __transform64_errno.o + compile_time_check.o + _open.o + _close.o + _read.o + _write.o + _stat.o + lstat.o + _fstat.o + access.o + _fcntl.o + getdents.o + _lseek.o + lseek64.o + chdir.o + mkdir.o + rmdir.o + _link.o + _unlink.o + _rename.o + _getpid.o + _kill.o + _fork.o + _wait.o + _execve.o + _sbrk.o + _gettimeofday.o + _times.o + ftime.o + clock_getres.o + clock_gettime.o + clock_settime.o + truncate.o + symlink.o + readlink.o + utime.o + fchown.o + getrandom.o + _getentropy.o + _isatty.o + chmod.o + fchmod.o + pathconf.o + fsync.o + getuid.o + geteuid.o + getpwuid.o + getpwnam.o + libcglue_get_fd_info.o + ps2sdk_get_iop_fd.o + ps2sdk_get_iop_filename.o + _ps2sdk_close.o + _ps2sdk_dclose.o + _ps2sdk_read.o + _ps2sdk_lseek.o + _ps2sdk_lseek64.o + _ps2sdk_write.o + _ps2sdk_ioctl.o + _ps2sdk_ioctl2.o + _ps2sdk_dread.o + openat.o + renameat.o + fchmodat.o + fstatat.o + mkdirat.o + faccessat.o + fchownat.o + linkat.o + readlinkat.o + unlinkat.o + dup.o + dup2.o +) + +compile_multiple(cglue src/lock.c OBJECTS + __lock___sfp_recursive_mutex.o + __lock___atexit_recursive_mutex.o + __lock___at_quick_exit_mutex.o + __lock___malloc_recursive_mutex.o + __lock___env_recursive_mutex.o + __lock___tz_mutex.o + __lock___dd_hash_mutex.o + __lock___arc4random_mutex.o + __retarget_lock_init.o + __retarget_lock_init_recursive.o + __retarget_lock_close.o + __retarget_lock_close_recursive.o + __retarget_lock_acquire.o + __retarget_lock_acquire_recursive.o + __retarget_lock_try_acquire.o + __retarget_lock_try_acquire_recursive.o + __retarget_lock_release.o + __retarget_lock_release_recursive.o + __locks_init.o + __locks_deinit.o +) + +compile_multiple(cglue src/netdb.c OBJECTS + gethostbyaddr.o + gethostbyname.o + gethostbyname_r.o + freeaddrinfo.o + getaddrinfo.o +) + +compile_multiple(cglue src/select.c OBJECTS + select.o +) + +compile_multiple(cglue src/socket.c OBJECTS + socket.o + accept.o + bind.o + connect.o + listen.o + recv.o + recvfrom.o + recvmsg.o + send.o + sendto.o + sendmsg.o + getsockopt.o + setsockopt.o + shutdown.o + getpeername.o + getsockname.o + libcglue_inet_addr.o + libcglue_inet_ntoa.o + libcglue_inet_ntoa_r.o + libcglue_inet_aton.o + libcglue_ps2ip_setconfig.o + libcglue_ps2ip_getconfig.o + libcglue_dns_setserver.o + libcglue_dns_getserver.o +) + +install(TARGETS cglue) \ No newline at end of file diff --git a/ee/libgs/CMakeLists.txt b/ee/libgs/CMakeLists.txt new file mode 100644 index 00000000000..37772c00161 --- /dev/null +++ b/ee/libgs/CMakeLists.txt @@ -0,0 +1,25 @@ +add_library(gs) +target_include_directories(gs PUBLIC include) +target_include_directories(gs PRIVATE + ${EE_INC} +) +target_sources(gs PRIVATE + src/dma.c + src/DoubleBuff.c + src/draw.c + src/libgs.c + src/lowlevel.c + src/packets.c + src/primitives.c + src/ResetPath.s + src/sync.c + src/texture.c + src/Zbuffer.c + src/erl-support.c +) + +file(GLOB GS_INCLUDE_FILES "include/*.h*") +set_target_properties(gs PROPERTIES PUBLIC_HEADER "${GS_INCLUDE_FILES}") +install(TARGETS gs) + +target_add_erl(gs) \ No newline at end of file diff --git a/ee/libprofglue/CMakeLists.txt b/ee/libprofglue/CMakeLists.txt new file mode 100644 index 00000000000..bc70856be5a --- /dev/null +++ b/ee/libprofglue/CMakeLists.txt @@ -0,0 +1,13 @@ +add_library(profglue) +target_include_directories(profglue PUBLIC include) +target_include_directories(profglue PRIVATE + ${EE_INC} +) +target_sources(profglue PRIVATE + src/mcount.S + src/prof.c +) + +file(GLOB PROFGLUE_INCLUDE_FILES "include/*.h*") +set_target_properties(profglue PROPERTIES PUBLIC_HEADER "${PROFGLUE_INCLUDE_FILES}") +install(TARGETS profglue) \ No newline at end of file diff --git a/ee/libvux/CMakeLists.txt b/ee/libvux/CMakeLists.txt new file mode 100644 index 00000000000..cf84d8aa3e5 --- /dev/null +++ b/ee/libvux/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(vux) +target_include_directories(vux PUBLIC include) +target_include_directories(vux PRIVATE ${EE_INC}) +target_sources(vux PRIVATE src/vuhw.c src/vusw.c src/vux.c src/erl-support.c) + +file(GLOB VUX_INCLUDE_FILES "include/*.h*") +set_target_properties(vux PROPERTIES PUBLIC_HEADER "${VUX_INCLUDE_FILES}") +install(TARGETS vux) +target_add_erl(vux) \ No newline at end of file diff --git a/ee/math3d/CMakeLists.txt b/ee/math3d/CMakeLists.txt new file mode 100644 index 00000000000..3b4be279df3 --- /dev/null +++ b/ee/math3d/CMakeLists.txt @@ -0,0 +1,16 @@ +add_library(math3d) +target_include_directories(math3d PUBLIC include) +target_include_directories(math3d PRIVATE + ${EE_INC} +) +target_link_libraries(math3d PRIVATE graph) +target_sources(math3d PRIVATE + src/math3d.c + src/erl-support.c +) + +file(GLOB MATH3D_INCLUDE_FILES "include/*.h*") +set_target_properties(math3d PROPERTIES PUBLIC_HEADER "${MATH3D_INCLUDE_FILES}") +install(TARGETS math3d) + +target_add_erl(math3d) \ No newline at end of file diff --git a/ee/mpeg/CMakeLists.txt b/ee/mpeg/CMakeLists.txt new file mode 100644 index 00000000000..5f461caa1e0 --- /dev/null +++ b/ee/mpeg/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(mpeg) +target_include_directories(mpeg PUBLIC include) +target_include_directories(mpeg PRIVATE ${EE_INC}) +target_sources(mpeg PRIVATE src/libmpeg.c src/libmpeg_core_c.c src/erl-support.c) + +file(GLOB MPEG_INCLUDE_FILES "include/*.h*") +set_target_properties(mpeg PROPERTIES PUBLIC_HEADER "${MPEG_INCLUDE_FILES}") +install(TARGETS mpeg) +target_add_erl(mpeg) \ No newline at end of file diff --git a/ee/network/CMakeLists.txt b/ee/network/CMakeLists.txt new file mode 100644 index 00000000000..ad85a6abd68 --- /dev/null +++ b/ee/network/CMakeLists.txt @@ -0,0 +1,2 @@ +#add_subdirectory(netman) +#add_subdirectory(tcpip) \ No newline at end of file diff --git a/ee/packet/CMakeLists.txt b/ee/packet/CMakeLists.txt new file mode 100644 index 00000000000..e03a1fe305f --- /dev/null +++ b/ee/packet/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(packet) +target_include_directories(packet PUBLIC include) +target_include_directories(packet PRIVATE ${EE_INC}) +target_sources(packet PRIVATE src/packet.c src/erl-support.c) + +file(GLOB PACKET_INCLUDE_FILES "include/*.h*") +set_target_properties(packet PROPERTIES PUBLIC_HEADER "${PACKET_INCLUDE_FILES}") +install(TARGETS packet) +target_add_erl(packet) \ No newline at end of file diff --git a/ee/packet2/CMakeLists.txt b/ee/packet2/CMakeLists.txt new file mode 100644 index 00000000000..e5262f2aaa4 --- /dev/null +++ b/ee/packet2/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(packet2) +target_include_directories(packet2 PUBLIC include) +target_include_directories(packet2 PRIVATE ${EE_INC}) +target_sources(packet2 PRIVATE src/packet2.c src/packet2_vif.c src/erl-support.c) + +file(GLOB PACKET2_INCLUDE_FILES "include/*.h*") +set_target_properties(packet2 PROPERTIES PUBLIC_HEADER "${PACKET2_INCLUDE_FILES}") +install(TARGETS packet2) +target_add_erl(packet2) \ No newline at end of file diff --git a/ee/rpc/CMakeLists.txt b/ee/rpc/CMakeLists.txt new file mode 100644 index 00000000000..f2933e998b7 --- /dev/null +++ b/ee/rpc/CMakeLists.txt @@ -0,0 +1,17 @@ +add_subdirectory(ahx) +add_subdirectory(audsrv) +add_subdirectory(camera) +add_subdirectory(cdvd) +add_subdirectory(filexio) +add_subdirectory(hdd) +add_subdirectory(keyboard) +add_subdirectory(memorycard) +add_subdirectory(mouse) +add_subdirectory(multitap) +add_subdirectory(pad) +add_subdirectory(poweroff) +add_subdirectory(ps2snd) +add_subdirectory(remote) +add_subdirectory(secr) +add_subdirectory(sior) +add_subdirectory(tcpips) \ No newline at end of file diff --git a/ee/rpc/ahx/CMakeLists.txt b/ee/rpc/ahx/CMakeLists.txt new file mode 100644 index 00000000000..1148e24c3fa --- /dev/null +++ b/ee/rpc/ahx/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(ahx) +target_include_directories(ahx PUBLIC include) +target_include_directories(ahx PRIVATE ${EE_INC}) +target_sources(ahx PRIVATE src/ahx_rpc.c src/erl-support.c) +install(TARGETS ahx) +target_add_erl(ahx) \ No newline at end of file diff --git a/ee/rpc/audsrv/CMakeLists.txt b/ee/rpc/audsrv/CMakeLists.txt new file mode 100644 index 00000000000..7a12c97833c --- /dev/null +++ b/ee/rpc/audsrv/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(audsrv) +target_include_directories(audsrv PUBLIC include) +target_include_directories(audsrv PRIVATE ${EE_INC}) +target_sources(audsrv PRIVATE src/audsrv_rpc.c src/erl-support.c) +install(TARGETS audsrv) +target_add_erl(audsrv) \ No newline at end of file diff --git a/ee/rpc/camera/CMakeLists.txt b/ee/rpc/camera/CMakeLists.txt new file mode 100644 index 00000000000..f6ea37ae4ec --- /dev/null +++ b/ee/rpc/camera/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(camera) +target_include_directories(camera PUBLIC include) +target_include_directories(camera PRIVATE ${EE_INC}) +target_sources(camera PRIVATE src/ps2cam_rpc.c src/erl-support.c) +install(TARGETS camera) +target_add_erl(camera) \ No newline at end of file diff --git a/ee/rpc/cdvd/CMakeLists.txt b/ee/rpc/cdvd/CMakeLists.txt new file mode 100644 index 00000000000..61e463b1bf5 --- /dev/null +++ b/ee/rpc/cdvd/CMakeLists.txt @@ -0,0 +1,33 @@ +add_library(cdvd) +target_include_directories(cdvd PUBLIC include) +target_include_directories(cdvd PRIVATE ${EE_INC}) + +compile_multiple(cdvd src/libcdvd.c OBJECTS + _libcdvd_internals.o sceCdInit.o sceCdIntToPos.o sceCdPosToInt.o + sceCdSearchFile.o sceCdDiskReady.o _CdSemaInit.o _CdSemaExit.o + sceCdInitEeCB.o sceCdCallback.o _CdGenericCallbackFunction.o +) + +compile_multiple(cdvd src/ncmd.c OBJECTS + _ncmd_internals.o _CdAlignReadBuffer.o sceCdRead.o sceCdReadDVDV.o + sceCdReadCDDA.o sceCdGetToc.o sceCdSeek.o sceCdStandby.o sceCdStop.o sceCdPause.o + sceCdApplyNCmd.o sceCdReadIOPMem.o sceCdNCmdDiskReady.o + sceCdGetReadPos.o sceCdStStart.o sceCdStRead.o sceCdStStop.o sceCdStSeek.o sceCdStInit.o + sceCdStStat.o sceCdStPause.o sceCdStResume.o sceCdStream.o sceCdCddaStream.o sceCdSync.o + _CdCheckNCmd.o sceCdReadKey.o +) + +compile_multiple(cdvd src/scmd.c OBJECTS + _scmd_internals.o sceCdReadClock.o ps2time.o sceCdWriteClock.o sceCdGetDiskType.o + sceCdGetError.o sceCdTrayReq.o sceCdApplySCmd.o sceCdStatus.o sceCdBreak.o + _CdCheckSCmd.o sceCdCtrlADout.o sceCdMV.o sceCdReadSUBQ.o + sceCdForbidDVDP.o sceCdAutoAdjustCtrl.o sceCdDecSet.o sceCdSetHDMode.o sceCdOpenConfig.o sceCdCloseConfig.o + sceCdReadConfig.o sceCdWriteConfig.o + sceCdReadNVM.o sceCdWriteNVM.o sceCdRI.o sceCdWI.o sceCdReadConsoleID.o sceCdWriteConsoleID.o + sceCdNoticeGameStart.o + _CdSyncS.o +) + +target_sources(cdvd PRIVATE src/erl-support.c) +install(TARGETS cdvd) +#target_add_erl(cdvd) TODO doesn't work with the object libraries \ No newline at end of file diff --git a/ee/rpc/filexio/CMakeLists.txt b/ee/rpc/filexio/CMakeLists.txt new file mode 100644 index 00000000000..a76a91c6759 --- /dev/null +++ b/ee/rpc/filexio/CMakeLists.txt @@ -0,0 +1,35 @@ +add_library(fileXio) +target_include_directories(fileXio PUBLIC include) +target_include_directories(fileXio PRIVATE ${EE_INC} ${PROJECT_SOURCE_DIR}/libcglue/include) + +compile_multiple(fileXio src/fileXio_rpc.c OBJECTS + __cd0.o __sbuff.o __intr_data.o __fileXioInited.o __fileXioBlockMode.o __fileXioCompletionSema.o __lock_sema_id.o + fileXioInit.o fileXioExit.o fileXioStop.o fileXioGetDeviceList.o fileXioGetdir.o fileXioMount.o fileXioUmount.o + fileXioCopyfile.o fileXioMkdir.o fileXioRmdir.o fileXioRemove.o fileXioRename.o fileXioSymlink.o fileXioReadlink.o + fileXioChdir.o fileXioOpen.o fileXioClose.o fileXioRead.o fileXioWrite.o fileXioLseek.o fileXioLseek64.o fileXioChStat.o + fileXioGetStat.o fileXioFormat.o fileXioSync.o fileXioDopen.o fileXioDclose.o fileXioDread.o fileXioDevctl.o + fileXioIoctl.o fileXioIoctl2.o fileXioWaitAsync.o fileXioSetBlockMode.o fileXioSetRWBufferSize.o +) + +compile_multiple(fileXio src/fileXio_ps2sdk.c OBJECTS + __fileXioOpsInitialize.o + __fileXioOpenHelper.o + __fileXioGetFdHelper.o + __fileXioGetFilenameHelper.o + __fileXioGetstatHelper.o + __fileXioCloseHelper.o + __fileXioDcloseHelper.o + __fileXioReadHelper.o + __fileXioLseekHelper.o + __fileXioLseek64Helper.o + __fileXioWriteHelper.o + __fileXioIoctlHelper.o + __fileXioIoctl2Helper.o + __fileXioDreadHelper.o + __fileXioLseekDirHelper.o + __fileXioOpsInitializeImpl.o + _ps2sdk_fileXio_init_deinit.o +) + +target_sources(fileXio PRIVATE src/erl-support.c) +install(TARGETS fileXio) \ No newline at end of file diff --git a/ee/rpc/hdd/CMakeLists.txt b/ee/rpc/hdd/CMakeLists.txt new file mode 100644 index 00000000000..529c106b83f --- /dev/null +++ b/ee/rpc/hdd/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(hdd) +target_include_directories(hdd PUBLIC include) +target_include_directories(hdd PRIVATE ${EE_INC}) +target_link_libraries(hdd PRIVATE poweroff fileXio) +target_sources(hdd PRIVATE src/libhdd.c src/erl-support.c) +install(TARGETS hdd) +target_add_erl(hdd) \ No newline at end of file diff --git a/ee/rpc/keyboard/CMakeLists.txt b/ee/rpc/keyboard/CMakeLists.txt new file mode 100644 index 00000000000..3835037a737 --- /dev/null +++ b/ee/rpc/keyboard/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(keyboard) +target_include_directories(keyboard PUBLIC include) +target_include_directories(keyboard PRIVATE ${EE_INC}) +target_sources(keyboard PRIVATE src/libkbd.c src/erl-support.c) +target_link_libraries(keyboard PRIVATE cglue) +install(TARGETS keyboard) +target_add_erl(keyboard) \ No newline at end of file diff --git a/ee/rpc/memorycard/CMakeLists.txt b/ee/rpc/memorycard/CMakeLists.txt new file mode 100644 index 00000000000..69d921d4dbd --- /dev/null +++ b/ee/rpc/memorycard/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(memorycard) +target_include_directories(memorycard PUBLIC include) +target_include_directories(memorycard PRIVATE ${EE_INC}) +target_sources(memorycard PRIVATE src/libmc.c src/erl-support.c) +install(TARGETS memorycard) +target_add_erl(memorycard) \ No newline at end of file diff --git a/ee/rpc/mouse/CMakeLists.txt b/ee/rpc/mouse/CMakeLists.txt new file mode 100644 index 00000000000..f6304537176 --- /dev/null +++ b/ee/rpc/mouse/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(mouse) +target_include_directories(mouse PUBLIC include) +target_include_directories(mouse PRIVATE ${EE_INC}) +target_sources(mouse PRIVATE src/libmouse.c src/erl-support.c) +install(TARGETS mouse) +target_add_erl(mouse) \ No newline at end of file diff --git a/ee/rpc/multitap/CMakeLists.txt b/ee/rpc/multitap/CMakeLists.txt new file mode 100644 index 00000000000..f4bd24120ae --- /dev/null +++ b/ee/rpc/multitap/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(multitap) +target_include_directories(multitap PUBLIC include) +target_include_directories(multitap PRIVATE ${EE_INC}) +target_sources(multitap PRIVATE src/libmtap.c src/erl-support.c) +install(TARGETS multitap) +target_add_erl(multitap) \ No newline at end of file diff --git a/ee/rpc/pad/CMakeLists.txt b/ee/rpc/pad/CMakeLists.txt new file mode 100644 index 00000000000..c904b67b99b --- /dev/null +++ b/ee/rpc/pad/CMakeLists.txt @@ -0,0 +1,14 @@ +add_library(pad) +target_include_directories(pad PUBLIC include) +target_include_directories(pad PRIVATE ${EE_INC}) +target_sources(pad PRIVATE src/libpad.c src/erl-support.c) +install(TARGETS pad) +target_add_erl(pad) + +add_library(padx) +target_include_directories(padx PUBLIC include) +target_include_directories(padx PRIVATE ${EE_INC}) +target_compile_definitions(padx PRIVATE _XPAD) +target_sources(padx PRIVATE src/libpad.c src/erl-support.c) +install(TARGETS padx) +target_add_erl(padx) \ No newline at end of file diff --git a/ee/rpc/poweroff/CMakeLists.txt b/ee/rpc/poweroff/CMakeLists.txt new file mode 100644 index 00000000000..ac1d9543e93 --- /dev/null +++ b/ee/rpc/poweroff/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(poweroff) +target_include_directories(poweroff PUBLIC include) +target_include_directories(poweroff PRIVATE ${EE_INC}) +target_sources(poweroff PRIVATE src/poweroff.c src/erl-support.c) +install(TARGETS poweroff) +target_add_erl(poweroff) \ No newline at end of file diff --git a/ee/rpc/ps2snd/CMakeLists.txt b/ee/rpc/ps2snd/CMakeLists.txt new file mode 100644 index 00000000000..99ef5d3851c --- /dev/null +++ b/ee/rpc/ps2snd/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(ps2snd) +target_include_directories(ps2snd PUBLIC include) +target_include_directories(ps2snd PRIVATE ${EE_INC}) +target_sources(ps2snd PRIVATE src/ps2snd.c src/erl-support.c) +install(TARGETS ps2snd) +target_add_erl(ps2snd) \ No newline at end of file diff --git a/ee/rpc/remote/CMakeLists.txt b/ee/rpc/remote/CMakeLists.txt new file mode 100644 index 00000000000..6fb6413477c --- /dev/null +++ b/ee/rpc/remote/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(remote) +target_include_directories(remote PUBLIC include) +target_include_directories(remote PRIVATE ${EE_INC}) +target_sources(remote PRIVATE src/librm.c src/erl-support.c) +install(TARGETS remote) +target_add_erl(remote) \ No newline at end of file diff --git a/ee/rpc/secr/CMakeLists.txt b/ee/rpc/secr/CMakeLists.txt new file mode 100644 index 00000000000..e9424278b42 --- /dev/null +++ b/ee/rpc/secr/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(secr) +target_include_directories(secr PUBLIC include) +target_include_directories(secr PRIVATE ${EE_INC}) +target_sources(secr PRIVATE src/libsecr.c src/erl-support.c) +install(TARGETS secr) +target_add_erl(secr) \ No newline at end of file diff --git a/ee/rpc/sior/CMakeLists.txt b/ee/rpc/sior/CMakeLists.txt new file mode 100644 index 00000000000..c624e27ed24 --- /dev/null +++ b/ee/rpc/sior/CMakeLists.txt @@ -0,0 +1,6 @@ +add_library(sior) +target_include_directories(sior PUBLIC include) +target_include_directories(sior PRIVATE ${EE_INC}) +target_sources(sior PRIVATE src/sior_rpc.c src/erl-support.c) +install(TARGETS sior) +target_add_erl(sior) \ No newline at end of file diff --git a/ee/rpc/tcpips/CMakeLists.txt b/ee/rpc/tcpips/CMakeLists.txt new file mode 100644 index 00000000000..83e9c30a049 --- /dev/null +++ b/ee/rpc/tcpips/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(ps2ips) +target_include_directories(ps2ips PUBLIC include) +target_include_directories(ps2ips PRIVATE ${EE_INC} src) +target_sources(ps2ips PRIVATE src/ps2ipc.c src/ps2ipc_ps2sdk.c src/erl-support.c) +target_link_libraries(ps2ips PRIVATE cglue) +install(TARGETS ps2ips) +target_add_erl(ps2ips) \ No newline at end of file diff --git a/ee/sbv/CMakeLists.txt b/ee/sbv/CMakeLists.txt new file mode 100644 index 00000000000..4aee7fd0b01 --- /dev/null +++ b/ee/sbv/CMakeLists.txt @@ -0,0 +1,14 @@ +add_library(patches) +target_include_directories(patches PUBLIC include) +target_include_directories(patches PRIVATE ${EE_INC}) +target_sources(patches PRIVATE src/smem.c src/smod.c src/slib.c + src/patch_enable_lmb.c src/patch_disable_prefix_check.c + src/patch_user_mem_clear.c src/patch_fileio.c src/common.c + src/erl-support.c +) + +file(GLOB PATCHES_INCLUDE_FILES "include/*.h*") +set_target_properties(patches PROPERTIES PUBLIC_HEADER "${PATCHES_INCLUDE_FILES}") +install(TARGETS patches) + +target_add_erl(patches) \ No newline at end of file diff --git a/ee/startup/CMakeLists.txt b/ee/startup/CMakeLists.txt new file mode 100644 index 00000000000..6da5b3aa757 --- /dev/null +++ b/ee/startup/CMakeLists.txt @@ -0,0 +1,5 @@ +add_library(crt0 OBJECT src/crt0.c) +target_include_directories(crt0 PUBLIC include) +target_include_directories(crt0 PRIVATE ${EE_INC}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/crt0.dir/src/crt0.c.obj DESTINATION lib RENAME "crt0.o") +install(FILES src/linkfile DESTINATION startup) diff --git a/iop/CMakeLists.txt b/iop/CMakeLists.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000000..5a85e4a956a --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.10) +project(ps2sdk-tools) + +add_subdirectory(adpenc) +add_subdirectory(bin2c) +add_subdirectory(gensymtab) +add_subdirectory(ps2-irxgen) +add_subdirectory(ps2adpcm) +add_subdirectory(romimg) \ No newline at end of file diff --git a/tools/adpenc/CMakeLists.txt b/tools/adpenc/CMakeLists.txt new file mode 100644 index 00000000000..876635c5f23 --- /dev/null +++ b/tools/adpenc/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(adpenc src/adpcm.c src/main.c) +install(TARGETS adpenc) \ No newline at end of file diff --git a/tools/bin2c/CMakeLists.txt b/tools/bin2c/CMakeLists.txt new file mode 100644 index 00000000000..b231c8b7c93 --- /dev/null +++ b/tools/bin2c/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(bin2c src/bin2c.c) +install(TARGETS bin2c) \ No newline at end of file diff --git a/tools/gensymtab/CMakeLists.txt b/tools/gensymtab/CMakeLists.txt new file mode 100644 index 00000000000..26a1ee0060d --- /dev/null +++ b/tools/gensymtab/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(gensymtab src/main.c) +install(TARGETS gensymtab) \ No newline at end of file diff --git a/tools/ps2-irxgen/CMakeLists.txt b/tools/ps2-irxgen/CMakeLists.txt new file mode 100644 index 00000000000..b082928663e --- /dev/null +++ b/tools/ps2-irxgen/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(ps2-irxgen src/ps2-irxgen.c) +install(TARGETS ps2-irxgen) \ No newline at end of file diff --git a/tools/ps2adpcm/CMakeLists.txt b/tools/ps2adpcm/CMakeLists.txt new file mode 100644 index 00000000000..5cbc6a3f559 --- /dev/null +++ b/tools/ps2adpcm/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(ps2adpcm src/adpcm.c src/main.c) +install(TARGETS ps2adpcm) \ No newline at end of file diff --git a/tools/romimg/CMakeLists.txt b/tools/romimg/CMakeLists.txt new file mode 100644 index 00000000000..bcda68fb086 --- /dev/null +++ b/tools/romimg/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(romimg src/main.c src/platform.c src/romimg.c src/SonyRX.c) +install(TARGETS romimg) \ No newline at end of file