VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

When I try to compile and run my emulator with SDL2(not SDL 1.2.15) I get a white 480x272 area in the top left, with the rest of the window being black? This did work correctly on my other PC, which was also built with SDL2 and MinGW?

Is this a problem in the SDL2.dll or actually a problem in my emulator's GPU routines?

Window management: https://bitbucket.org/superfury/unipcemu/src/ … gpu.c?at=master
SDL and SDL_gfx-based support: https://bitbucket.org/superfury/unipcemu/src/ … sdl.c?at=master

The Window management contains functionality for initializing and resizing windows:
updateWindow(xres,yres,flags) switches (and creates if required) a SDL/SDL2 window to work with. flags contains SDL_WINDOW_FULLSCREEN with SDL2 or 0.
updateVideo requests the window to be updated if needed(different resultion), based on emulator settings.

The SDL and SDL_gfx based support:
zoomSurfaceRGBA: Adjusted and optimized version of the zoomSurfaceRGBA of SDL_gfx.
getlayer(virtual)width/height/pixels: Retrieves the (virtual) width, height and pixels from a GPU_SDL_Surface object.
filledmem: Gives 1 if any value in the specified buffer isn't zero.
memdiff: Used to be an optimization of memcmp, but memcmp is faster.
matchColorKeys: Matches color keys in the destination surface with the original surface.
calcResize: Calculates and applies resized screen, depending on GPU settings.
resizeImage: Calculates and resizes a surface, depending on settings given.
get_pixelrow_pitch: Gives the pitch between two rows in a surface.
get_pixel: Retrieves a pixel from a surface.
check_surface: Checks if a surface is valid for use.
put_pixel: Draws a pixel on a surface.
get_pixel_ptr: Retrieves a pointer to a pixel on a surface.
get_pixel_row: Same as get_pixel_ptr, but for a row.
put_pixel_row: Copies a row from a source surface to a destination surface, with it being centered, left aligned or right aligned. It also can clear any other pixels on the same graphics row.
loadbyteorder: Loads red, green, blue and alpha masks from the system (taken from the first SDL window surface allocated).
createSurface: Allocates and wraps a surface for usage.
createSurfaceFromPixels: Same as createSurface, but based on existing pixels which can't be deallocated automatically.
freeSurface: Functionality for releasing a surface manually.
safeFlip: A function that calls SDL_Flip or compatible, as required by the SDL(2) specification.

Anyone can see what's going wrong here? Normal SDL(1) works without problems.

Edit: Managed to fix this bug: It was because the extended surface container (containing extra data used in the emulator and GPU processing) wasn't reallocated after deallocation(thus having nothing to draw on after resizing).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io