mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-15 16:05:10 +01:00
Reverted more MEM2 Allocation to prevent black screen when launching a game. (Thanks Dimok)
This commit is contained in:
parent
f145fb1e91
commit
da71bf99dc
@ -280,7 +280,7 @@ struct CACHED_GENERIC *ntfs_enter_cache(struct CACHE_HEADER *cache,
|
|||||||
cache->oldest_entry = current->previous;
|
cache->oldest_entry = current->previous;
|
||||||
if (item->varsize) {
|
if (item->varsize) {
|
||||||
if (current->varsize)
|
if (current->varsize)
|
||||||
current->variable = realloc(
|
current->variable = MEM2_realloc(
|
||||||
current->variable,
|
current->variable,
|
||||||
item->varsize);
|
item->varsize);
|
||||||
else
|
else
|
||||||
|
@ -1279,7 +1279,7 @@ static int ntfs_ie_add_vcn(INDEX_ENTRY **ie)
|
|||||||
INDEX_ENTRY *p, *old = *ie;
|
INDEX_ENTRY *p, *old = *ie;
|
||||||
|
|
||||||
old->length = cpu_to_le16(le16_to_cpu(old->length) + sizeof(VCN));
|
old->length = cpu_to_le16(le16_to_cpu(old->length) + sizeof(VCN));
|
||||||
p = realloc(old, le16_to_cpu(old->length));
|
p = MEM2_realloc(old, le16_to_cpu(old->length));
|
||||||
if (!p)
|
if (!p)
|
||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count,
|
|||||||
/* Reallocate memory if necessary. */
|
/* Reallocate memory if necessary. */
|
||||||
if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) {
|
if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) {
|
||||||
rlsize += 4096;
|
rlsize += 4096;
|
||||||
trl = realloc(rl, rlsize);
|
trl = MEM2_realloc(rl, rlsize);
|
||||||
if (!trl) {
|
if (!trl) {
|
||||||
err = ENOMEM;
|
err = ENOMEM;
|
||||||
ntfs_log_perror("realloc() failed");
|
ntfs_log_perror("realloc() failed");
|
||||||
|
@ -28,20 +28,12 @@
|
|||||||
|
|
||||||
static inline void* ntfs_alloc (size_t size)
|
static inline void* ntfs_alloc (size_t size)
|
||||||
{
|
{
|
||||||
#ifdef __wii__
|
|
||||||
return MEM2_alloc(size);
|
return MEM2_alloc(size);
|
||||||
#else
|
|
||||||
return malloc(size);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void* ntfs_align (size_t size)
|
static inline void* ntfs_align (size_t size)
|
||||||
{
|
{
|
||||||
#ifdef __wii__
|
return MEM2_alloc(size);
|
||||||
return memalign(32, size);
|
|
||||||
#else
|
|
||||||
return malloc(size);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ntfs_free (void* mem)
|
static inline void ntfs_free (void* mem)
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
#include "mem2.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ntfs_calloc
|
* ntfs_calloc
|
||||||
@ -44,7 +45,10 @@ void *ntfs_calloc(size_t size)
|
|||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = calloc(1, size);
|
p = MEM2_alloc(size);
|
||||||
|
if(p)
|
||||||
|
memset(p, 0, size);
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
ntfs_log_perror("Failed to calloc %lld bytes", (long long)size);
|
ntfs_log_perror("Failed to calloc %lld bytes", (long long)size);
|
||||||
return p;
|
return p;
|
||||||
@ -54,7 +58,7 @@ void *ntfs_malloc(size_t size)
|
|||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = malloc(size);
|
p = MEM2_alloc(size);
|
||||||
if (!p)
|
if (!p)
|
||||||
ntfs_log_perror("Failed to malloc %lld bytes", (long long)size);
|
ntfs_log_perror("Failed to malloc %lld bytes", (long long)size);
|
||||||
return p;
|
return p;
|
||||||
|
@ -1011,7 +1011,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
|
|||||||
if (o >= ucs_len) {
|
if (o >= ucs_len) {
|
||||||
ntfschar *tc;
|
ntfschar *tc;
|
||||||
ucs_len = (ucs_len * sizeof(ntfschar) + 64) & ~63;
|
ucs_len = (ucs_len * sizeof(ntfschar) + 64) & ~63;
|
||||||
tc = realloc(ucs, ucs_len);
|
tc = MEM2_realloc(ucs, ucs_len);
|
||||||
if (!tc)
|
if (!tc)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
ucs = tc;
|
ucs = tc;
|
||||||
|
Loading…
Reference in New Issue
Block a user