mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-29 05:55:16 -04:00
strat: use ams::Main() instead of main(argc, argv)
This commit is contained in:
parent
6a53726833
commit
ffc143860b
47 changed files with 2972 additions and 3609 deletions
55
stratosphere/jpegdec/source/jpegdec_memory_management.cpp
Normal file
55
stratosphere/jpegdec/source/jpegdec_memory_management.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "jpegdec_memory_management.hpp"
|
||||
|
||||
namespace ams::jpegdec {
|
||||
|
||||
namespace {
|
||||
|
||||
/* TODO: Update libjpeg-turbo to include Nintendo's changes (support for work buffer, rather than malloc) */
|
||||
constexpr size_t JpegHeapSize = 96_KB;
|
||||
alignas(0x10) constinit u8 g_jpeg_heap_memory[JpegHeapSize];
|
||||
|
||||
constinit lmem::HeapHandle g_jpeg_heap_handle;
|
||||
|
||||
}
|
||||
|
||||
void InitializeJpegHeap() {
|
||||
g_jpeg_heap_handle = lmem::CreateExpHeap(g_jpeg_heap_memory, sizeof(g_jpeg_heap_memory), lmem::CreateOption_None);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C" void *__wrap_jpeg_get_small(void *cinfo, size_t size) {
|
||||
AMS_UNUSED(cinfo);
|
||||
return ::ams::lmem::AllocateFromExpHeap(::ams::jpegdec::g_jpeg_heap_handle, size);
|
||||
}
|
||||
|
||||
extern "C" void __wrap_jpeg_free_small(void *cinfo, void *ptr, size_t size) {
|
||||
AMS_UNUSED(cinfo, size);
|
||||
return ::ams::lmem::FreeToExpHeap(::ams::jpegdec::g_jpeg_heap_handle, ptr);
|
||||
}
|
||||
|
||||
extern "C" void *__wrap_jpeg_get_large(void *cinfo, size_t size) {
|
||||
AMS_UNUSED(cinfo);
|
||||
return ::ams::lmem::AllocateFromExpHeap(::ams::jpegdec::g_jpeg_heap_handle, size);
|
||||
}
|
||||
|
||||
extern "C" void __wrap_jpeg_free_large(void *cinfo, void *ptr, size_t size) {
|
||||
AMS_UNUSED(cinfo, size);
|
||||
return ::ams::lmem::FreeToExpHeap(::ams::jpegdec::g_jpeg_heap_handle, ptr);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue