Remove libdefaultheap.

Replaced by coreinit data exports.
This commit is contained in:
James Benton 2018-05-29 10:51:53 +01:00
parent 766e832363
commit a5d15a7a3a
11 changed files with 4 additions and 119 deletions

View File

@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(libraries C)
add_subdirectory(libdefaultheap)
add_subdirectory(libgfd)
add_subdirectory(libwhb)
add_subdirectory(wutcrt)

View File

@ -1,16 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(libdefaultheap)
file(GLOB_RECURSE SOURCE_FILES *.c)
file(GLOB_RECURSE HEADER_FILES *.h)
add_library(defaultheap STATIC ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(defaultheap PRIVATE "../../include")
target_include_directories(defaultheap PUBLIC "include")
install(TARGETS defaultheap
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -1,20 +0,0 @@
#pragma once
#include <wut.h>
#ifdef __cplusplus
extern "C" {
#endif
void *
MEMAllocFromDefaultHeap(uint32_t size);
void *
MEMAllocFromDefaultHeapEx(uint32_t size,
int32_t alignment);
void
MEMFreeToDefaultHeap(void *block);
#ifdef __cplusplus
}
#endif

View File

@ -1,75 +0,0 @@
#include "defaultheap.h"
#include <coreinit/dynload.h>
typedef void *(*MEMAllocFromDefaultHeapFn)(uint32_t size);
typedef void *(*MEMAllocFromDefaultHeapExFn)(uint32_t size, int32_t alignment);
typedef void (*MEMFreeToDefaultHeapFn)(void *block);
static OSDynLoadModule sCoreinitHandle = 0;
static MEMAllocFromDefaultHeapFn *MEMAllocFromDefaultHeapPtr = NULL;
static MEMAllocFromDefaultHeapExFn *MEMAllocFromDefaultHeapExPtr = NULL;
static MEMFreeToDefaultHeapFn *MEMFreeToDefaultHeapPtr = NULL;
void *
MEMAllocFromDefaultHeap(uint32_t size)
{
if (!sCoreinitHandle) {
if (OSDynLoad_Acquire("coreinit.rpl", &sCoreinitHandle)) {
return NULL;
}
}
if (!MEMAllocFromDefaultHeapPtr) {
if (OSDynLoad_FindExport(sCoreinitHandle,
TRUE,
"MEMAllocFromDefaultHeap",
(void **)&MEMAllocFromDefaultHeapPtr)) {
return NULL;
}
}
return (**MEMAllocFromDefaultHeapPtr)(size);
}
void *
MEMAllocFromDefaultHeapEx(uint32_t size,
int32_t alignment)
{
if (!sCoreinitHandle) {
if (OSDynLoad_Acquire("coreinit.rpl", &sCoreinitHandle)) {
return NULL;
}
}
if (!MEMAllocFromDefaultHeapExPtr) {
if (OSDynLoad_FindExport(sCoreinitHandle,
TRUE,
"MEMAllocFromDefaultHeapEx",
(void **)&MEMAllocFromDefaultHeapExPtr)) {
return NULL;
}
}
return (**MEMAllocFromDefaultHeapExPtr)(size, alignment);
}
void
MEMFreeToDefaultHeap(void *block)
{
if (!sCoreinitHandle) {
if (OSDynLoad_Acquire("coreinit.rpl", &sCoreinitHandle)) {
return;
}
}
if (!MEMFreeToDefaultHeapPtr) {
if (OSDynLoad_FindExport(sCoreinitHandle,
TRUE,
"MEMFreeToDefaultHeap",
(void **)&MEMFreeToDefaultHeapPtr)) {
return;
}
}
(**MEMFreeToDefaultHeapPtr)(block);
}

View File

@ -7,7 +7,6 @@ file(GLOB_RECURSE HEADER_FILES *.h)
add_library(whb STATIC ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(whb PRIVATE "../../include")
target_include_directories(whb PRIVATE "../libdefaultheap/include")
target_include_directories(whb PRIVATE "../libgfd/include")
target_include_directories(whb PUBLIC "include")

View File

@ -1,5 +1,5 @@
#include <coreinit/defaultheap.h>
#include <coreinit/filesystem.h>
#include <defaultheap.h>
#include <string.h>
#include <whb/file.h>
#include <whb/log.h>

View File

@ -1,8 +1,8 @@
#include "gfx_heap.h"
#include <coreinit/baseheap.h>
#include <coreinit/defaultheap.h>
#include <coreinit/expandedheap.h>
#include <coreinit/frameheap.h>
#include <defaultheap.h>
#include <whb/log.h>
static void *

View File

@ -1,4 +1,4 @@
#include <defaultheap.h>
#include <coreinit/defaultheap.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
#include <coreinit/defaultheap.h>
#include <coreinit/mutex.h>
#include <defaultheap.h>
#include <nsysnet/socket.h>
#include <string.h>
#include <whb/log.h>

View File

@ -7,7 +7,6 @@ add_executable(helloworld
target_link_libraries(helloworld
whb
defaultheap
coreinit
proc_ui
sysapp)

View File

@ -7,7 +7,6 @@ add_executable(helloworld_std_thread
target_link_libraries(helloworld_std_thread
whb
defaultheap
coreinit
proc_ui
sysapp)