Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
ea496fdf
Commit
ea496fdf
authored
Oct 13, 2011
by
CeRiAl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Mamaich's workaround to break out of the 32MB per process memory limit on Windows CE < 6.0
parent
3553d9c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
SDL_surface.c
src/video/SDL_surface.c
+39
-0
No files found.
src/video/SDL_surface.c
View file @
ea496fdf
...
...
@@ -29,6 +29,10 @@ static char rcsid =
#include <stdlib.h>
#include <string.h>
#ifdef UNDER_CE
#include <windows.h>
#endif
#include "SDL_error.h"
#include "SDL_video.h"
#include "SDL_sysvideo.h"
...
...
@@ -39,6 +43,33 @@ static char rcsid =
#include "SDL_memops.h"
#include "SDL_leaks.h"
#ifdef UNDER_CE
static
void
*
ce_virt_malloc
(
int
size
)
{
if
(
size
<
64
*
1024
)
{
void
*
Ptr
=
malloc
(
size
+
4
);
*
((
HANDLE
*
)
Ptr
)
=
0
;
return
4
+
(
char
*
)
Ptr
;
}
HANDLE
H
=
CreateFileMapping
((
HANDLE
)
INVALID_HANDLE_VALUE
,
0
,
PAGE_READWRITE
,
0
,
size
+
4
,
0
);
void
*
Ptr
=
MapViewOfFile
(
H
,
FILE_MAP_ALL_ACCESS
,
0
,
0
,
0
);
//fprintf(stderr,"%d\n", Ptr);
*
((
HANDLE
*
)
Ptr
)
=
H
;
return
4
+
(
char
*
)
Ptr
;
}
static
void
ce_virt_free
(
void
*
addr
)
{
HANDLE
H
=
*
(
HANDLE
*
)((
char
*
)
addr
-
4
);
if
(
H
==
0
)
{
free
((
char
*
)
addr
-
4
);
return
;
}
UnmapViewOfFile
((
char
*
)
addr
-
4
);
CloseHandle
(
H
);
}
#endif
/* Public routines */
/*
* Create an empty RGB surface of the appropriate depth
...
...
@@ -121,7 +152,11 @@ SDL_Surface * SDL_CreateRGBSurface (Uint32 flags,
if
(
((
flags
&
SDL_HWSURFACE
)
==
SDL_SWSURFACE
)
||
(
video
->
AllocHWSurface
(
this
,
surface
)
<
0
)
)
{
if
(
surface
->
w
&&
surface
->
h
)
{
#ifndef UNDER_CE
surface
->
pixels
=
malloc
(
surface
->
h
*
surface
->
pitch
);
#else
surface
->
pixels
=
ce_virt_malloc
(
surface
->
h
*
surface
->
pitch
);
#endif
if
(
surface
->
pixels
==
NULL
)
{
SDL_FreeSurface
(
surface
);
SDL_OutOfMemory
();
...
...
@@ -929,7 +964,11 @@ void SDL_FreeSurface (SDL_Surface *surface)
}
if
(
surface
->
pixels
&&
((
surface
->
flags
&
SDL_PREALLOC
)
!=
SDL_PREALLOC
)
)
{
#ifndef UNDER_CE
free
(
surface
->
pixels
);
#else
ce_virt_free
(
surface
->
pixels
);
#endif
}
free
(
surface
);
#ifdef CHECK_LEAKS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment