| View previous topic :: View next topic |
| Author |
Message |
Archaemic
Joined: 18 Mar 2007 Posts: 38
|
Posted: Sun Mar 02, 2008 9:39 am Post subject: SDL HWSURFACE freeing patch |
|
|
While trying to do some fancy stuff using the GU in conjunction with SDL, I noticed that it was impossible to SDL_FreeSurface a hardware surface. After doing some research, I noticed that SDL will only call PSP_FreeHWSurface if surface->hwdata is non-zero. It will also call free on surface->pixels if it is non-zero after calling FreeHWSurface, which obviously won't work if the pixels pointer points to something that isn't in the heap. Therefore, I have created this small patch:
| Code: | --- src/video/psp/SDL_pspvideo.c (revision 2361)
+++ src/video/psp/SDL_pspvideo.c (working copy)
@@ -515,11 +515,13 @@
surface->pitch = pitch;
surface->flags |= SDL_HWSURFACE;
+ surface->hwdata = (void*)1; /* Hack to make SDL realize it's a HWSURFACE when freeing */
return 0;
}
static void PSP_FreeHWSurface(_THIS, SDL_Surface *surface)
{
vidmem_free(surface->pixels);
+ surface->pixels = NULL;
return;
}
|
|
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Sun Mar 02, 2008 5:57 pm Post subject: |
|
|
| applie in rev 2366, thanks |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Sun Mar 02, 2008 7:25 pm Post subject: |
|
|
| Thanks Archaemic!!!! |
|
| Back to top |
|
 |
|