// by James L. Hammons
//
-#include "types.h"
#include "tom.h"
#include "sdlemu_opengl.h"
#include "settings.h"
SDL_Joystick * joystick;
//
-// Prime SDL and create surfaces
+// Create SDL/OpenGL surfaces
//
bool InitVideo(void)
{
- // Set up SDL library
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE) < 0)
- {
- WriteLog("VJ: Could not initialize the SDL library: %s", SDL_GetError());
- return false;
- }
-
// Get proper info about the platform we're running on...
const SDL_VideoInfo * info = SDL_GetVideoInfo();
mainSurfaceFlags |= SDL_FULLSCREEN;
if (!vjs.useOpenGL)
- mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT, 16, mainSurfaceFlags);
+ mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_NTSC, 16, mainSurfaceFlags);
else
- mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT * 2, 16, mainSurfaceFlags);
+ mainSurface = SDL_SetVideoMode(VIRTUAL_SCREEN_WIDTH * 2, VIRTUAL_SCREEN_HEIGHT_NTSC * 2, 16, mainSurfaceFlags);
if (mainSurface == NULL)
{
SDL_WM_SetCaption("Virtual Jaguar", "Virtual Jaguar");
// Create the primary SDL display (16 BPP, 5/5/5 RGB format)
- surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT,
+ surface = SDL_CreateRGBSurface(SDL_SWSURFACE, VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_NTSC,
16, 0x7C00, 0x03E0, 0x001F, 0);
if (surface == NULL)
}
if (vjs.useOpenGL)
- sdlemu_init_opengl(surface, 1/*method*/, 2/*size*/, 0/*texture type (linear, nearest)*/);
+//Should make another setting here, for either linear or nearest (instead of just picking one)
+//And we have! ;-)
+ sdlemu_init_opengl(surface, 1/*method*/, 2/*size*/, vjs.glFilter/*texture type (linear, nearest)*/);
// Initialize Joystick support under SDL
if (vjs.useJoystick)
//To be safe, this should be 1280 * 625 * 2...
// backbuffer = (int16 *)malloc(845 * 525 * sizeof(int16));
backbuffer = (int16 *)malloc(1280 * 625 * sizeof(int16));
- memset(backbuffer, 0x44, VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(int16));
+ memset(backbuffer, 0x44, VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT_NTSC * sizeof(int16));
return true;
}
SDL_JoystickClose(joystick);
SDL_FreeSurface(surface);
- SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER);
- SDL_Quit();
-
free(backbuffer);
}
exit(1);
}
- sprintf(window_title, "Virtual Jaguar (%i x %i)", (int)width, (int)height);
-
- if (!vjs.useOpenGL)
+ if (vjs.useOpenGL)
+ // This seems to work well for resizing (i.e., changes in the pixel width)...
+ sdlemu_resize_texture(surface, mainSurface, vjs.glFilter);
+ else
{
mainSurface = SDL_SetVideoMode(width, height, 16, mainSurfaceFlags);
}
}
+ sprintf(window_title, "Virtual Jaguar (%i x %i)", (int)width, (int)height);
SDL_WM_SetCaption(window_title, window_title);
// This seems to work well for resizing (i.e., changes in the pixel width)...
- if (vjs.useOpenGL)
- sdlemu_resize_texture(surface, mainSurface);
+// if (vjs.useOpenGL)
+// sdlemu_resize_texture(surface, mainSurface);
}
//