Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/backends/platform/3ds/app/scummvm.rsf b/backends/platform/3ds/app/scummvm.rsf
- index 133341c7590..c877ade30c7 100644
- --- a/backends/platform/3ds/app/scummvm.rsf
- +++ b/backends/platform/3ds/app/scummvm.rsf
- @@ -16,7 +16,7 @@ Option:
- FreeProductCode : true # Removes limitations on ProductCode
- MediaFootPadding : false # If true CCI files are created with padding
- EnableCrypt : false # Enables encryption for NCCH and CIA
- - EnableCompress : false # Compresses where applicable (currently only exefs:/.code)
- + EnableCompress : true # Compresses where applicable (currently only exefs:/.code)
- AccessControlInfo:
- CoreVersion : 2
- @@ -38,7 +38,7 @@ AccessControlInfo:
- #- CategorySystemApplication
- #- CategoryHardwareCheck
- #- CategoryFileSystemTool
- - #- Debug
- + - Debug
- #- TwlCardBackup
- #- TwlNandData
- #- Boss
- @@ -59,7 +59,7 @@ AccessControlInfo:
- # Process Settings
- MemoryType : Application # Application/System/Base
- - SystemMode : 64MB # 64MB(Default)/96MB/80MB/72MB/32MB
- + SystemMode : 96MB # 64MB(Default)/96MB/80MB/72MB/32MB
- IdealProcessor : 0
- AffinityMask : 1
- Priority : 16
- @@ -76,7 +76,7 @@ AccessControlInfo:
- SpecialMemoryArrange : true
- # New3DS Exclusive Process Settings
- - SystemModeExt : 124MB # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
- + SystemModeExt : 178MB # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
- CpuSpeed : 804MHz # 268MHz(Default)/804MHz
- EnableL2Cache : true # false(default)/true
- CanAccessCore2 : true
- @@ -180,7 +180,7 @@ AccessControlInfo:
- SystemControlInfo:
- SaveDataSize: 0K
- RemasterVersion: 0
- - StackSize: 0x40000
- + StackSize: 0x400000
- # Modules that run services listed above should be included below
- # Maximum 48 dependencies
- diff --git a/backends/platform/3ds/main.cpp b/backends/platform/3ds/main.cpp
- index beaf214a6a9..d4c18b832fd 100644
- --- a/backends/platform/3ds/main.cpp
- +++ b/backends/platform/3ds/main.cpp
- @@ -29,8 +29,12 @@ enum {
- SYSTEM_MODEL_2DS = 3
- };
- +// Max regular heap size is 96 MiB, but that is also the max available memory on O3DS
- +// Set slightly lower to make room for backend buffers in linear heap on O3DS
- +u32 __ctru_heap_size = 84 << 20; // 84 MiB
- // Set the size of the stack.
- -u32 __stacksize__ = 64 * 1024;
- +//u32 __stacksize__ = 64 * 1024;
- +u32 __stacksize__ = 4 << 20; // 4 MiB
- int main(int argc, char *argv[]) {
- // Initialize basic libctru stuff
- diff --git a/graphics/tinygl/memory.cpp b/graphics/tinygl/memory.cpp
- index 280d90070da..27d246f115c 100644
- --- a/graphics/tinygl/memory.cpp
- +++ b/graphics/tinygl/memory.cpp
- @@ -27,26 +27,66 @@
- // Memory allocator for TinyGL
- -#include "graphics/tinygl/zgl.h"
- +#ifdef __3DS__
- +#include <3ds.h>
- +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
- +#include "common/util.h"
- +#endif#include "graphics/tinygl/zgl.h"
- namespace TinyGL {
- // modify these functions so that they suit your needs
- void gl_free(void *p) {
- +#ifdef __3DS__
- + linearFree(p);
- +#else
- free(p);
- +#endif
- }
- void *gl_malloc(int size) {
- +#ifdef __3DS__
- + return linearAlloc(size);
- +#else
- return malloc(size);
- +#endif
- }
- void *gl_zalloc(int size) {
- +#ifdef __3DS__
- + return linearAlloc(size);
- +#else
- return calloc(1, size);
- +#endif
- }
- void *gl_realloc(void *p, int size) {
- +#ifdef __3DS__
- +// Ctrulib's linearRealloc() is in TODO phase and returns NULL
- +// In the meantime, make our own.
- +// TODO: Pester DevKitPro to make linearRealloc functional
- + size_t oldSize = linearGetSize(p);
- + assert (oldSize != 0);
- + u32 uint32NewSize = (u32)size;
- +// https://github.com/devkitPro/libctru/blob/master/libctru/source/allocator/linear.cpp#L56
- +// https://github.com/devkitPro/libctru/blob/master/libctru/source/allocator/mem_pool.h#L5
- + int align = __builtin_ffs(0x80) - 1;
- +// https://github.com/devkitPro/libctru/blob/master/libctru/source/allocator/mem_pool.cpp#L43
- + u32 alignMask = (1 << align) -1;
- +// https://github.com/devkitPro/libctru/blob/master/libctru/source/allocator/mem_pool.cpp#L53
- + u32 newSizeAlign = (uint32NewSize + alignMask) &~ alignMask;
- + if (newSizeAlign == oldSize) {
- + return p; // do nothing
- + } else {
- + void *newAlloc = linearAlloc(size);
- + memcpy(newAlloc, p, MIN(oldSize, linearGetSize(newAlloc)));
- + linearFree(p);
- + return newAlloc;
- + }
- +#else
- return realloc(p, size);
- +#endif
- }
- } // end of namespace TinyGL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement