dump, build with priv_prj works

This commit is contained in:
Martin Baliet 2024-03-02 14:48:41 +01:00
parent 2be74821ad
commit c09914e5d1
25 changed files with 180 additions and 41 deletions

View File

@ -9,5 +9,5 @@
"asciidoc.preview.useEditorStyle": false,
"asciidoc.use_asciidoctorpdf": true,
"editor.tabSize": 2,
"git.ignoredRepositories": ["third_party/boost", "third_party/optick", "third_party/glfw"]
"git.ignoredRepositories": ["third_party/boost", "third_party/optick", "third_party/glfw", "third_party/magic_enum"]
}

View File

@ -28,6 +28,7 @@ get_filename_component(VulkanPath ${Vulkan_LIBRARY} DIRECTORY)
message("Vulkan Path: ${VulkanPath}")
# # - Gather Infos
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # Move all libs here post-build
#
include_directories(BEFORE
@ -42,9 +43,10 @@ link_directories(BEFORE
${CMAKE_INSTALL_PREFIX}/development/lib
${CMAKE_BINARY_DIR}/third_party/install/lib
${CMAKE_BINARY_DIR}/core
${CMAKE_BINARY_DIR}/lib
)
add_subdirectory(tools/logging) # include befire link_libraries
add_subdirectory(tools/logging) # include before link_libraries
link_libraries(
logging.lib

View File

@ -10,6 +10,7 @@ add_subdirectory(initParams)
add_subdirectory(timer)
add_subdirectory(systemContent)
add_subdirectory(fileManager)
add_subdirectory(imports)
# Build
add_library(core SHARED
@ -19,16 +20,16 @@ add_library(core SHARED
$<TARGET_OBJECTS:systemContent>
$<TARGET_OBJECTS:videoout>
$<TARGET_OBJECTS:fileManager>
$<TARGET_OBJECTS:imports>
)
add_dependencies(core logging emuExports)
add_dependencies(core logging)
target_link_libraries(core PRIVATE
libboost_thread
libboost_chrono
libboost_program_options
glfw3
OptickCore
emulator.lib
psOff_utility
${Vulkan_LIBRARIES}
)

View File

@ -0,0 +1,9 @@
add_library(imports OBJECT
imports.cpp
)
add_dependencies(imports third_party psOff_utility initParams)
target_include_directories(imports PRIVATE
${Vulkan_INCLUDE_DIRS}
${PRJ_SRC_DIR}/third_party/optick/src
)

52
core/imports/imports.cpp Normal file
View File

@ -0,0 +1,52 @@
#define __APICALL_EXTERN
#include "imports.h"
#include "imports_func.h"
#undef __APICALL_EXTERN
#include "utility/utility.h"
#include <assert.h>
// todo: Change after splitting the project
static getImageAlignment_t g_getImageAlignment = nullptr;
static registerDisplayBuffer_t g_registerDisplayBuffer = nullptr;
static getDisplayBuffer_t g_getDisplayBuffer = nullptr;
static createGraphics_t g_createGraphics = nullptr;
uint64_t getImageAlignment(VkFormat format, VkExtent3D extent) {
assert(g_getImageAlignment != nullptr);
return g_getImageAlignment(format, extent);
}
bool registerDisplayBuffer(uint64_t vaddr, VkExtent2D extent, uint32_t pitch, VkFormat format) {
assert(g_registerDisplayBuffer != nullptr);
return g_registerDisplayBuffer(vaddr, extent, pitch, format);
}
std::shared_ptr<IGpuImageObject> getDisplayBuffer(uint64_t vaddr) {
assert(g_getDisplayBuffer != nullptr);
return g_getDisplayBuffer(vaddr);
}
std::unique_ptr<IGraphics> createGraphics(IEventsGraphics& listener, VkDevice device, VkPhysicalDevice physDev, VkInstance instance) {
assert(g_createGraphics != nullptr);
return g_createGraphics(listener, device, physDev, instance);
}
void setCallback_getImageAlignment(getImageAlignment_t cb) {
g_getImageAlignment = cb;
}
void setCallback_registerDisplayBuffer(registerDisplayBuffer_t cb) {
g_registerDisplayBuffer = cb;
}
void setCallback_getDisplayBuffer(getDisplayBuffer_t cb) {
g_getDisplayBuffer = cb;
}
void setCallback_createGraphics(createGraphics_t cb) {
g_createGraphics = cb;
}

33
core/imports/imports.h Normal file
View File

@ -0,0 +1,33 @@
#pragma once
#include <gpuMemory_types.h>
#include <graphics.h>
#include <memory>
#include <stdint.h>
#include <vulkan/vulkan_core.h>
#if defined(__APICALL_EXTERN)
#define __APICALL __declspec(dllexport)
#elif defined(__APICALL_IMPORT)
#define __APICALL __declspec(dllimport)
#else
#define __APICALL
#endif
using getImageAlignment_t = uint64_t (*)(VkFormat format, VkExtent3D extent);
using registerDisplayBuffer_t = bool (*)(uint64_t vaddr, VkExtent2D extent, uint32_t pitch, VkFormat format);
using getDisplayBuffer_t = std::shared_ptr<IGpuImageObject> (*)(uint64_t vaddr);
using createGraphics_t = std::unique_ptr<IGraphics> (*)(IEventsGraphics& listener, VkDevice device, VkPhysicalDevice physDev, VkInstance instance);
__APICALL void setCallback_getImageAlignment(getImageAlignment_t);
__APICALL void setCallback_registerDisplayBuffer(registerDisplayBuffer_t);
__APICALL void setCallback_getDisplayBuffer(getDisplayBuffer_t);
__APICALL void setCallback_createGraphics(createGraphics_t);
#undef __APICALL

View File

@ -0,0 +1,49 @@
#include "gpuMemory_types.h"
#include <graphics.h>
#include <memory>
#include <stdint.h>
#include <vulkan/vulkan_core.h>
#if defined(__APICALL_EXTERN)
#define __APICALL __declspec(dllexport)
#elif defined(__APICALL_IMPORT)
#define __APICALL __declspec(dllimport)
#else
#define __APICALL
#endif
// All communication strictly goes through the core library. (May change later)
/**
* @brief Get the required memory alignment. Dont' call from constructor.
*
* @param format
* @param extent shouldn't matter if not 100% correct
* @return memory alignment
*/
__APICALL uint64_t getImageAlignment(VkFormat format, VkExtent3D extent);
/**
* @brief register the displayBuffer for the GPU memory manager. Dont' call from constructor.
*
* @param vaddr
* @param extent
* @param pitch
* @param format
* @return true
* @return false
*/
__APICALL bool registerDisplayBuffer(uint64_t vaddr, VkExtent2D extent, uint32_t pitch, VkFormat format);
/**
* @brief Get the Display Buffer object. Dont' call from constructor.
*
* @param vaddr
* @return std::shared_ptr<IGpuImageObject>
*/
__APICALL std::shared_ptr<IGpuImageObject> getDisplayBuffer(uint64_t vaddr);
__APICALL std::unique_ptr<IGraphics> createGraphics(IEventsGraphics& listener, VkDevice device, VkPhysicalDevice physDev, VkInstance instance);
#undef __APICALL

View File

@ -4,7 +4,7 @@ add_library(videoout OBJECT
vulkan/vulkanHelper.cpp
)
add_dependencies(videoout third_party psOff_utility initParams)
add_dependencies(videoout third_party psOff_utility initParams imports)
target_include_directories(videoout PRIVATE
${Vulkan_INCLUDE_DIRS}
${PRJ_SRC_DIR}/third_party/optick/src

View File

@ -2,7 +2,11 @@
#include "videoout.h"
#undef __APICALL_EXTERN
#include "core/imports/imports_func.h"
#include "core/initParams/initParams.h"
#include "core/kernel/eventqueue.h"
#include "core/systemContent/systemContent.h"
#include "core/timer/timer.h"
#include "logging.h"
#include "modules/libSceVideoOut/codes.h"
#include "modules/libSceVideoOut/types.h"
@ -16,17 +20,13 @@
#include <array>
#include <assert.h>
#include <format>
#include <gpuMemoryManagerExports.h>
#include <gpuMemory_types.h>
#include <graphics.h>
#include <initParams.h>
#include <list>
#include <memory>
#include <mutex>
#include <optick.h>
#include <systemContent.h>
#include <thread>
#include <timer.h>
LOG_DEFINE_MODULE(VideoOut);
using namespace Kernel;

View File

@ -10,7 +10,7 @@ target_include_directories(${libName} PRIVATE
${PRJ_SRC_DIR}/runtime/system
)
add_dependencies(${libName} emuExports core)
target_link_libraries(${libName} PRIVATE emulator.lib core)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
setupModule(${libName})

View File

@ -1,12 +1,12 @@
#include "../libSceNpManager/types.h"
#include "common.h"
#include "core/fileManager/fileManager.h"
#include "core/systemContent/systemContent.h"
#include "logging.h"
#include "types.h"
#include <fileManager.h>
#include <filesystem>
#include <optional>
#include <systemContent.h>
LOG_DEFINE_MODULE(libSceAppContent);

View File

@ -27,7 +27,7 @@ set(FFMPEG_LIBS
swresample
)
add_dependencies(${libName} emuExports core)
target_link_libraries(${libName} PUBLIC core emulator.lib psOff_utility ${FFMPEG_LIBS})
add_dependencies(${libName} core)
target_link_libraries(${libName} PUBLIC core.lib psOff_utility ${FFMPEG_LIBS})
setupModule(${libName})

View File

@ -1,11 +1,10 @@
#include "avplayer.h"
#include "core/fileManager/fileManager.h"
#include "core/imports/imports_func.h"
#include "logging.h"
#include "typesEx.h"
#include <fileManager.h>
#include <gpuMemoryManagerExports.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

View File

@ -5,6 +5,7 @@
#include <boost/thread.hpp>
#include <memory>
#include <utility/utility.h>
LOG_DEFINE_MODULE(libSceCoredump);
namespace {

View File

@ -13,7 +13,7 @@ target_include_directories(${libName} PRIVATE
${PRJ_SRC_DIR}/tools/sb2spirv/lib/include
)
add_dependencies(${libName} emuExports core)
target_link_libraries(${libName} PRIVATE emulator.lib core.lib)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
setupModule(${libName})

View File

@ -1,12 +1,12 @@
#include "common.h"
#include "core/kernel/eventqueue_types.h"
#include "core/timer/timer.h"
#include "core/videoout/videoout.h"
#include "logging.h"
#include "types.h"
#include <graphics.h>
#include <pm4_custom.h>
#include <timer.h>
#include <videoOut.h>
LOG_DEFINE_MODULE(libSceGraphicsDriver);

View File

@ -6,7 +6,7 @@ project(${libName})
add_library(${libName} SHARED entry.cpp)
add_dependencies(${libName} emuExports core)
target_link_libraries(${libName} PRIVATE glfw3 emulator.lib ${Vulkan_LIBRARIES} core)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE glfw3 ${Vulkan_LIBRARIES} core.lib)
setupModule(${libName})

View File

@ -1,10 +1,9 @@
#include "common.h"
#include "core/timer/timer.h"
#include "core/videoout/videoout.h"
#include "logging.h"
#include "types.h"
#include <timer.h>
#include <videoOut.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <algorithm>

View File

@ -6,7 +6,7 @@ project(${libName})
add_library(${libName} SHARED entry.cpp)
add_dependencies(${libName} emuExports core)
target_link_libraries(${libName} PRIVATE emuEemulator.lib xports core)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
setupModule(${libName})

View File

@ -1,10 +1,9 @@
#include "codes.h"
#include "common.h"
#include "core/fileManager/fileManager.h"
#include "logging.h"
#include "types.h"
#include <fileManager.h>
LOG_DEFINE_MODULE(libSceSaveData);
namespace {

View File

@ -6,7 +6,7 @@ project(${libName})
add_library(${libName} SHARED entry.cpp)
add_dependencies(${libName} emuExports core)
target_link_libraries(${libName} PRIVATE emulator.lib core.lib)
add_dependencies(${libName} core)
target_link_libraries(${libName} PRIVATE core.lib)
setupModule(${libName})

View File

@ -1,10 +1,9 @@
#include "common.h"
#include "core/kernel/eventqueue_types.h"
#include "core/videoout/videoout.h"
#include "logging.h"
#include "types.h"
#include <videoOut.h>
LOG_DEFINE_MODULE(libSceVideoOut);
namespace {

View File

@ -21,10 +21,6 @@ Planned is a core library for such cases and for the interfaces currently in the
All exported function are placed inside the provided extern "C" scope and should start with "EXPORT SYSV_ABI", since those functions are called directly by the emulated application (linux).
> **_NOTE:_** The template only contains a dependency to the logging library as a bare minimum. To access the interfaces from the emulator, add the following two lines: \
add_dependencies(${libName} emuExports) \
target_link_libraries(${libName} PRIVATE emulator.lib)
After a new cmake config, the new library should be picked up and built.

View File

@ -2,6 +2,6 @@ function(setupModule _Target)
add_custom_command(TARGET ${_Target} POST_BUILD
COMMAND ${CMAKE_INSTALL_PREFIX}/development/bin/dll2Nids.exe ${CMAKE_CURRENT_BINARY_DIR}/${_Target}.dll
)
add_dependencies(${_Target} logging)
add_dependencies(${_Target} logging dll2Nids)
install(FILES $<TARGET_PDB_FILE:${_Target}> DESTINATION debug OPTIONAL)
endfunction()

View File

@ -14,7 +14,7 @@ target_compile_options(logging PRIVATE "/Zi")
ADD_CUSTOM_COMMAND(TARGET logging
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/logging.lib" "${CMAKE_BINARY_DIR}/third_party/install/lib/"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/logging.lib" "${CMAKE_BINARY_DIR}/lib"
)
set_target_properties(logging