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: