Code cleanup
This commit is contained in:
parent
6b7a381995
commit
186a05dfe8
3 changed files with 4599 additions and 3842 deletions
3723
src/custom.cpp
3723
src/custom.cpp
File diff suppressed because it is too large
Load diff
|
@ -18,30 +18,30 @@
|
|||
#include "SDL.h"
|
||||
|
||||
/* SDL variable for output of emulation */
|
||||
SDL_Surface *screen = nullptr;
|
||||
SDL_Surface* screen = nullptr;
|
||||
|
||||
/* Possible screen modes (x and y resolutions) */
|
||||
#define MAX_SCREEN_MODES 11
|
||||
static int x_size_table[MAX_SCREEN_MODES] = { 640, 640, 720, 800, 800, 960, 1024, 1280, 1280, 1680, 1920 };
|
||||
static int y_size_table[MAX_SCREEN_MODES] = { 400, 480, 400, 480, 600, 540, 768, 720, 800, 1050, 1080 };
|
||||
static int x_size_table[MAX_SCREEN_MODES] = {640, 640, 720, 800, 800, 960, 1024, 1280, 1280, 1680, 1920};
|
||||
static int y_size_table[MAX_SCREEN_MODES] = {400, 480, 400, 480, 600, 540, 768, 720, 800, 1050, 1080};
|
||||
|
||||
struct PicassoResolution *DisplayModes;
|
||||
struct PicassoResolution* DisplayModes;
|
||||
struct MultiDisplay Displays[MAX_DISPLAYS];
|
||||
|
||||
int screen_is_picasso = 0;
|
||||
|
||||
static SDL_Surface *current_screenshot = nullptr;
|
||||
static char screenshot_filename_default[255]=
|
||||
static SDL_Surface* current_screenshot = nullptr;
|
||||
static char screenshot_filename_default[255] =
|
||||
{
|
||||
'/', 't', 'm', 'p', '/', 'n', 'u', 'l', 'l', '.', 'p', 'n', 'g', '\0'
|
||||
};
|
||||
char *screenshot_filename=(char *)&screenshot_filename_default[0];
|
||||
FILE *screenshot_file= nullptr;
|
||||
static void CreateScreenshot(void);
|
||||
static int save_thumb(char *path);
|
||||
char* screenshot_filename = static_cast<char *>(&screenshot_filename_default[0]);
|
||||
FILE* screenshot_file = nullptr;
|
||||
static void CreateScreenshot();
|
||||
static int save_thumb(char* path);
|
||||
int delay_savestate_frame = 0;
|
||||
|
||||
int graphics_setup (void)
|
||||
int graphics_setup(void)
|
||||
{
|
||||
#ifdef PICASSO96
|
||||
picasso_InitResolutions();
|
||||
|
@ -96,11 +96,11 @@ void RefreshLiveInfo()
|
|||
|
||||
#endif
|
||||
|
||||
void InitAmigaVidMode(struct uae_prefs *p)
|
||||
void InitAmigaVidMode(struct uae_prefs* p)
|
||||
{
|
||||
/* Initialize structure for Amiga video modes */
|
||||
gfxvidinfo.pixbytes = 2;
|
||||
gfxvidinfo.bufmem = (uae_u8 *)screen->pixels;
|
||||
gfxvidinfo.bufmem = static_cast<uae_u8 *>(screen->pixels);
|
||||
gfxvidinfo.outwidth = p->gfx_size.width;
|
||||
gfxvidinfo.outheight = p->gfx_size.height;
|
||||
gfxvidinfo.rowbytes = screen->pitch;
|
||||
|
@ -113,20 +113,20 @@ void InitAmigaVidMode(struct uae_prefs *p)
|
|||
#endif
|
||||
}
|
||||
|
||||
void graphics_subshutdown (void)
|
||||
void graphics_subshutdown()
|
||||
{
|
||||
if (screen != NULL)
|
||||
if (screen != nullptr)
|
||||
{
|
||||
SDL_FreeSurface(screen);
|
||||
screen = NULL;
|
||||
screen = nullptr;
|
||||
}
|
||||
if (texture != NULL)
|
||||
if (texture != nullptr)
|
||||
{
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
static void open_screen(struct uae_prefs *p)
|
||||
static void open_screen(struct uae_prefs* p)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
|
@ -162,32 +162,32 @@ static void open_screen(struct uae_prefs *p)
|
|||
check_error_sdl(texture == nullptr, "Unable to create texture");
|
||||
|
||||
// Update the texture from the surface
|
||||
SDL_UpdateTexture(texture, NULL, screen->pixels, screen->pitch);
|
||||
SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch);
|
||||
SDL_RenderClear(renderer);
|
||||
// Copy the texture on the renderer
|
||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderCopy(renderer, texture, nullptr, nullptr);
|
||||
// Update the window surface (show the renderer)
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
if (screen != NULL)
|
||||
if (screen != nullptr)
|
||||
{
|
||||
InitAmigaVidMode(p);
|
||||
init_row_map();
|
||||
}
|
||||
}
|
||||
|
||||
void update_display(struct uae_prefs *p)
|
||||
void update_display(struct uae_prefs* p)
|
||||
{
|
||||
open_screen(p);
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
framecnt = 1; // Don't draw frame before reset done
|
||||
}
|
||||
|
||||
int check_prefs_changed_gfx (void)
|
||||
int check_prefs_changed_gfx()
|
||||
{
|
||||
int changed = 0;
|
||||
|
||||
if(currprefs.gfx_size.height != changed_prefs.gfx_size.height ||
|
||||
if (currprefs.gfx_size.height != changed_prefs.gfx_size.height ||
|
||||
currprefs.gfx_size.width != changed_prefs.gfx_size.width ||
|
||||
currprefs.gfx_size_fs.width != changed_prefs.gfx_size_fs.width ||
|
||||
currprefs.gfx_resolution != changed_prefs.gfx_resolution)
|
||||
|
@ -212,7 +212,7 @@ int check_prefs_changed_gfx (void)
|
|||
if (currprefs.chipset_refreshrate != changed_prefs.chipset_refreshrate)
|
||||
{
|
||||
currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate;
|
||||
init_hz_full ();
|
||||
init_hz_full();
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
|
@ -222,30 +222,29 @@ int check_prefs_changed_gfx (void)
|
|||
}
|
||||
|
||||
|
||||
int lockscr (void)
|
||||
int lockscr()
|
||||
{
|
||||
SDL_LockSurface(screen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void unlockscr (void)
|
||||
void unlockscr()
|
||||
{
|
||||
SDL_UnlockSurface(screen);
|
||||
}
|
||||
|
||||
|
||||
void wait_for_vsync(void)
|
||||
void wait_for_vsync()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void flush_screen ()
|
||||
void flush_screen()
|
||||
{
|
||||
if (savestate_state == STATE_DOSAVE)
|
||||
{
|
||||
if(delay_savestate_frame > 0)
|
||||
if (delay_savestate_frame > 0)
|
||||
--delay_savestate_frame;
|
||||
else
|
||||
{
|
||||
|
@ -259,63 +258,62 @@ void flush_screen ()
|
|||
RefreshLiveInfo();
|
||||
#endif
|
||||
|
||||
// unsigned long start = read_processor_time();
|
||||
// if(current_vsync_frame == 0)
|
||||
// {
|
||||
// // Old style for vsync and idle time calc
|
||||
// if(start < next_synctime && next_synctime - start > time_per_frame - 1000)
|
||||
// usleep((next_synctime - start) - 750);
|
||||
// ioctl(fbdev, OMAPFB_WAITFORVSYNC, ¤t_vsync_frame);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // New style for vsync and idle time calc
|
||||
// int wait_till = current_vsync_frame;
|
||||
// do
|
||||
// {
|
||||
// ioctl(fbdev, OMAPFB_WAITFORVSYNC_FRAME, ¤t_vsync_frame);
|
||||
// }
|
||||
// while (wait_till >= current_vsync_frame);
|
||||
//
|
||||
// if(wait_till + 1 != current_vsync_frame)
|
||||
// {
|
||||
// // We missed a vsync...
|
||||
// next_synctime = 0;
|
||||
// }
|
||||
// current_vsync_frame += currprefs.gfx_framerate;
|
||||
// }
|
||||
// unsigned long start = read_processor_time();
|
||||
// if(current_vsync_frame == 0)
|
||||
// {
|
||||
// // Old style for vsync and idle time calc
|
||||
// if(start < next_synctime && next_synctime - start > time_per_frame - 1000)
|
||||
// usleep((next_synctime - start) - 750);
|
||||
// ioctl(fbdev, OMAPFB_WAITFORVSYNC, ¤t_vsync_frame);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // New style for vsync and idle time calc
|
||||
// int wait_till = current_vsync_frame;
|
||||
// do
|
||||
// {
|
||||
// ioctl(fbdev, OMAPFB_WAITFORVSYNC_FRAME, ¤t_vsync_frame);
|
||||
// }
|
||||
// while (wait_till >= current_vsync_frame);
|
||||
//
|
||||
// if(wait_till + 1 != current_vsync_frame)
|
||||
// {
|
||||
// // We missed a vsync...
|
||||
// next_synctime = 0;
|
||||
// }
|
||||
// current_vsync_frame += currprefs.gfx_framerate;
|
||||
// }
|
||||
|
||||
// Update the texture from the surface
|
||||
SDL_UpdateTexture(texture, NULL, screen->pixels, screen->pitch);
|
||||
SDL_UpdateTexture(texture, nullptr, screen->pixels, screen->pitch);
|
||||
// Copy the texture on the renderer
|
||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderCopy(renderer, texture, nullptr, nullptr);
|
||||
// Update the window surface (show the renderer)
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
// last_synctime = read_processor_time();
|
||||
// last_synctime = read_processor_time();
|
||||
|
||||
// if(!screen_is_picasso)
|
||||
// gfxvidinfo.bufmem = (uae_u8 *)screen->pixels;
|
||||
// if(!screen_is_picasso)
|
||||
// gfxvidinfo.bufmem = (uae_u8 *)screen->pixels;
|
||||
|
||||
// if(last_synctime - next_synctime > time_per_frame * (1 + currprefs.gfx_framerate) - 1000 || next_synctime < start)
|
||||
// adjust_idletime(0);
|
||||
// else
|
||||
// adjust_idletime(next_synctime - start);
|
||||
//
|
||||
// if (last_synctime - next_synctime > time_per_frame - 5000)
|
||||
// next_synctime = last_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
|
||||
// else
|
||||
// next_synctime = next_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
|
||||
// if(last_synctime - next_synctime > time_per_frame * (1 + currprefs.gfx_framerate) - 1000 || next_synctime < start)
|
||||
// adjust_idletime(0);
|
||||
// else
|
||||
// adjust_idletime(next_synctime - start);
|
||||
//
|
||||
// if (last_synctime - next_synctime > time_per_frame - 5000)
|
||||
// next_synctime = last_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
|
||||
// else
|
||||
// next_synctime = next_synctime + time_per_frame * (1 + currprefs.gfx_framerate);
|
||||
|
||||
init_row_map();
|
||||
}
|
||||
|
||||
static void graphics_subinit (void)
|
||||
static void graphics_subinit()
|
||||
{
|
||||
if (screen == NULL)
|
||||
if (screen == nullptr)
|
||||
{
|
||||
fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -324,7 +322,7 @@ static void graphics_subinit (void)
|
|||
}
|
||||
}
|
||||
|
||||
STATIC_INLINE int bitsInMask (unsigned long mask)
|
||||
STATIC_INLINE int bitsInMask(unsigned long mask)
|
||||
{
|
||||
/* count bits in mask */
|
||||
int n = 0;
|
||||
|
@ -336,7 +334,7 @@ STATIC_INLINE int bitsInMask (unsigned long mask)
|
|||
return n;
|
||||
}
|
||||
|
||||
STATIC_INLINE int maskShift (unsigned long mask)
|
||||
STATIC_INLINE int maskShift(unsigned long mask)
|
||||
{
|
||||
/* determine how far mask is shifted */
|
||||
int n = 0;
|
||||
|
@ -348,7 +346,7 @@ STATIC_INLINE int maskShift (unsigned long mask)
|
|||
return n;
|
||||
}
|
||||
|
||||
static int init_colors (void)
|
||||
static int init_colors()
|
||||
{
|
||||
int i;
|
||||
int red_bits, green_bits, blue_bits;
|
||||
|
@ -361,7 +359,7 @@ static int init_colors (void)
|
|||
red_shift = maskShift(screen->format->Rmask);
|
||||
green_shift = maskShift(screen->format->Gmask);
|
||||
blue_shift = maskShift(screen->format->Bmask);
|
||||
alloc_colors64k (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, 0);
|
||||
alloc_colors64k(red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, 0);
|
||||
notice_new_xcolors();
|
||||
for (i = 0; i < 4096; i++)
|
||||
xcolors[i] = xcolors[i] * 0x00010001;
|
||||
|
@ -372,28 +370,28 @@ static int init_colors (void)
|
|||
/*
|
||||
* Find the colour depth of the display
|
||||
*/
|
||||
static int get_display_depth (void)
|
||||
static int get_display_depth()
|
||||
{
|
||||
// const SDL_VideoInfo *vid_info;
|
||||
// const SDL_VideoInfo *vid_info;
|
||||
|
||||
// int depth = 0;
|
||||
// int depth = 0;
|
||||
int depth = 16;
|
||||
|
||||
// if ((vid_info = SDL_GetVideoInfo()))
|
||||
// {
|
||||
// depth = vid_info->vfmt->BitsPerPixel;
|
||||
// if ((vid_info = SDL_GetVideoInfo()))
|
||||
// {
|
||||
// depth = vid_info->vfmt->BitsPerPixel;
|
||||
|
||||
/* Don't trust the answer if it's 16 bits; the display
|
||||
* could actually be 15 bits deep. We'll count the bits
|
||||
* ourselves */
|
||||
// if (depth == 16)
|
||||
// depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask);
|
||||
// }
|
||||
// if (depth == 16)
|
||||
// depth = bitsInMask (vid_info->vfmt->Rmask) + bitsInMask (vid_info->vfmt->Gmask) + bitsInMask (vid_info->vfmt->Bmask);
|
||||
// }
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
int GetSurfacePixelFormat(void)
|
||||
int GetSurfacePixelFormat()
|
||||
{
|
||||
int depth = get_display_depth();
|
||||
int unit = depth + 1 & 0xF8;
|
||||
|
@ -406,19 +404,19 @@ int GetSurfacePixelFormat(void)
|
|||
: RGBFB_NONE);
|
||||
}
|
||||
|
||||
int graphics_init (bool mousecapture)
|
||||
int graphics_init(bool mousecapture)
|
||||
{
|
||||
graphics_subinit ();
|
||||
graphics_subinit();
|
||||
|
||||
if (!init_colors ())
|
||||
if (!init_colors())
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void graphics_leave (void)
|
||||
void graphics_leave()
|
||||
{
|
||||
graphics_subshutdown ();
|
||||
graphics_subshutdown();
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_DestroyWindow(sdlWindow);
|
||||
|
@ -433,19 +431,19 @@ void graphics_leave (void)
|
|||
#define systemGreenMask (screen->format->Gmask)
|
||||
#define systemBlueMask (screen->format->Bmask)
|
||||
|
||||
static int save_png(SDL_Surface* surface, char *path)
|
||||
static int save_png(SDL_Surface* surface, char* path)
|
||||
{
|
||||
int w = surface->w;
|
||||
int h = surface->h;
|
||||
unsigned char * pix = (unsigned char *)surface->pixels;
|
||||
unsigned char* pix = static_cast<unsigned char *>(surface->pixels);
|
||||
unsigned char writeBuffer[1024 * 3];
|
||||
FILE *f = fopen(path,"wb");
|
||||
if(!f) return 0;
|
||||
FILE* f = fopen(path, "wb");
|
||||
if (!f) return 0;
|
||||
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
if(!png_ptr)
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
if (!png_ptr)
|
||||
{
|
||||
fclose(f);
|
||||
return 0;
|
||||
|
@ -453,14 +451,14 @@ static int save_png(SDL_Surface* surface, char *path)
|
|||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
if(!info_ptr)
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr,NULL);
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_init_io(png_ptr,f);
|
||||
png_init_io(png_ptr, f);
|
||||
|
||||
png_set_IHDR(png_ptr,
|
||||
info_ptr,
|
||||
|
@ -472,28 +470,28 @@ static int save_png(SDL_Surface* surface, char *path)
|
|||
PNG_COMPRESSION_TYPE_DEFAULT,
|
||||
PNG_FILTER_TYPE_DEFAULT);
|
||||
|
||||
png_write_info(png_ptr,info_ptr);
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
unsigned char *b = writeBuffer;
|
||||
unsigned char* b = writeBuffer;
|
||||
|
||||
int sizeX = w;
|
||||
int sizeY = h;
|
||||
int y;
|
||||
int x;
|
||||
|
||||
unsigned short *p = (unsigned short *)pix;
|
||||
for(y = 0; y < sizeY; y++)
|
||||
unsigned short* p = reinterpret_cast<unsigned short *>(pix);
|
||||
for (y = 0; y < sizeY; y++)
|
||||
{
|
||||
for(x = 0; x < sizeX; x++)
|
||||
for (x = 0; x < sizeX; x++)
|
||||
{
|
||||
unsigned short v = p[x];
|
||||
|
||||
*b++ = ((v & systemRedMask ) >> systemRedShift ) << 3; // R
|
||||
*b++ = ((v & systemRedMask) >> systemRedShift) << 3; // R
|
||||
*b++ = ((v & systemGreenMask) >> systemGreenShift) << 2; // G
|
||||
*b++ = ((v & systemBlueMask ) >> systemBlueShift ) << 3; // B
|
||||
*b++ = ((v & systemBlueMask) >> systemBlueShift) << 3; // B
|
||||
}
|
||||
p += surface->pitch / 2;
|
||||
png_write_row(png_ptr,writeBuffer);
|
||||
png_write_row(png_ptr, writeBuffer);
|
||||
b = writeBuffer;
|
||||
}
|
||||
|
||||
|
@ -505,14 +503,14 @@ static int save_png(SDL_Surface* surface, char *path)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void CreateScreenshot(void)
|
||||
static void CreateScreenshot()
|
||||
{
|
||||
int w, h;
|
||||
|
||||
if(current_screenshot != NULL)
|
||||
if (current_screenshot != nullptr)
|
||||
{
|
||||
SDL_FreeSurface(current_screenshot);
|
||||
current_screenshot = NULL;
|
||||
current_screenshot = nullptr;
|
||||
}
|
||||
|
||||
w = screen->w;
|
||||
|
@ -528,63 +526,63 @@ static void CreateScreenshot(void)
|
|||
screen->format->Amask);
|
||||
}
|
||||
|
||||
static int save_thumb(char *path)
|
||||
static int save_thumb(char* path)
|
||||
{
|
||||
int ret = 0;
|
||||
if(current_screenshot != NULL)
|
||||
if (current_screenshot != nullptr)
|
||||
{
|
||||
ret = save_png(current_screenshot, path);
|
||||
SDL_FreeSurface(current_screenshot);
|
||||
current_screenshot = NULL;
|
||||
current_screenshot = nullptr;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool vsync_switchmode (int hz)
|
||||
bool vsync_switchmode(int hz)
|
||||
{
|
||||
// int changed_height = changed_prefs.gfx_size.height;
|
||||
//
|
||||
// if (hz >= 55)
|
||||
// hz = 60;
|
||||
// else
|
||||
// hz = 50;
|
||||
//
|
||||
// if(hz == 50 && currVSyncRate == 60)
|
||||
// {
|
||||
// // Switch from NTSC -> PAL
|
||||
// switch(changed_height) {
|
||||
// case 200: changed_height = 240; break;
|
||||
// case 216: changed_height = 262; break;
|
||||
// case 240: changed_height = 270; break;
|
||||
// case 256: changed_height = 270; break;
|
||||
// case 262: changed_height = 270; break;
|
||||
// case 270: changed_height = 270; break;
|
||||
// }
|
||||
// }
|
||||
// else if(hz == 60 && currVSyncRate == 50)
|
||||
// {
|
||||
// // Switch from PAL -> NTSC
|
||||
// switch(changed_height) {
|
||||
// case 200: changed_height = 200; break;
|
||||
// case 216: changed_height = 200; break;
|
||||
// case 240: changed_height = 200; break;
|
||||
// case 256: changed_height = 216; break;
|
||||
// case 262: changed_height = 216; break;
|
||||
// case 270: changed_height = 240; break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(changed_height == currprefs.gfx_size.height && hz == currprefs.chipset_refreshrate)
|
||||
// return true;
|
||||
//
|
||||
// changed_prefs.gfx_size.height = changed_height;
|
||||
// int changed_height = changed_prefs.gfx_size.height;
|
||||
//
|
||||
// if (hz >= 55)
|
||||
// hz = 60;
|
||||
// else
|
||||
// hz = 50;
|
||||
//
|
||||
// if(hz == 50 && currVSyncRate == 60)
|
||||
// {
|
||||
// // Switch from NTSC -> PAL
|
||||
// switch(changed_height) {
|
||||
// case 200: changed_height = 240; break;
|
||||
// case 216: changed_height = 262; break;
|
||||
// case 240: changed_height = 270; break;
|
||||
// case 256: changed_height = 270; break;
|
||||
// case 262: changed_height = 270; break;
|
||||
// case 270: changed_height = 270; break;
|
||||
// }
|
||||
// }
|
||||
// else if(hz == 60 && currVSyncRate == 50)
|
||||
// {
|
||||
// // Switch from PAL -> NTSC
|
||||
// switch(changed_height) {
|
||||
// case 200: changed_height = 200; break;
|
||||
// case 216: changed_height = 200; break;
|
||||
// case 240: changed_height = 200; break;
|
||||
// case 256: changed_height = 216; break;
|
||||
// case 262: changed_height = 216; break;
|
||||
// case 270: changed_height = 240; break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(changed_height == currprefs.gfx_size.height && hz == currprefs.chipset_refreshrate)
|
||||
// return true;
|
||||
//
|
||||
// changed_prefs.gfx_size.height = changed_height;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool target_graphics_buffer_update (void)
|
||||
bool target_graphics_buffer_update()
|
||||
{
|
||||
bool rate_changed = 0;
|
||||
bool rate_changed = false;
|
||||
|
||||
if (currprefs.gfx_size.height != changed_prefs.gfx_size.height)
|
||||
{
|
||||
|
@ -603,18 +601,20 @@ bool target_graphics_buffer_update (void)
|
|||
|
||||
#ifdef PICASSO96
|
||||
|
||||
int picasso_palette (void)
|
||||
int picasso_palette()
|
||||
{
|
||||
int i, changed;
|
||||
|
||||
changed = 0;
|
||||
for (i = 0; i < 256; i++) {
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
int r = picasso96_state.CLUT[i].Red;
|
||||
int g = picasso96_state.CLUT[i].Green;
|
||||
int b = picasso96_state.CLUT[i].Blue;
|
||||
int value = (r << 16 | g << 8 | b);
|
||||
uae_u32 v = CONVERT_RGB(value);
|
||||
if (v != picasso_vidinfo.clut[i]) {
|
||||
if (v != picasso_vidinfo.clut[i])
|
||||
{
|
||||
picasso_vidinfo.clut[i] = v;
|
||||
changed = 1;
|
||||
}
|
||||
|
@ -622,10 +622,10 @@ int picasso_palette (void)
|
|||
return changed;
|
||||
}
|
||||
|
||||
static int resolution_compare (const void *a, const void *b)
|
||||
static int resolution_compare(const void* a, const void* b)
|
||||
{
|
||||
struct PicassoResolution *ma = (struct PicassoResolution *)a;
|
||||
struct PicassoResolution *mb = (struct PicassoResolution *)b;
|
||||
struct PicassoResolution* ma = (struct PicassoResolution *)a;
|
||||
struct PicassoResolution* mb = (struct PicassoResolution *)b;
|
||||
if (ma->res.width < mb->res.width)
|
||||
return -1;
|
||||
if (ma->res.width > mb->res.width)
|
||||
|
@ -637,13 +637,13 @@ static int resolution_compare (const void *a, const void *b)
|
|||
return ma->depth - mb->depth;
|
||||
}
|
||||
|
||||
static void sortmodes (void)
|
||||
static void sortmodes()
|
||||
{
|
||||
int i = 0, idx = -1;
|
||||
int pw = -1, ph = -1;
|
||||
while (DisplayModes[i].depth >= 0)
|
||||
i++;
|
||||
qsort (DisplayModes, i, sizeof (struct PicassoResolution), resolution_compare);
|
||||
qsort(DisplayModes, i, sizeof (struct PicassoResolution), resolution_compare);
|
||||
for (i = 0; DisplayModes[i].depth >= 0; i++)
|
||||
{
|
||||
if (DisplayModes[i].res.height != ph || DisplayModes[i].res.width != pw)
|
||||
|
@ -656,7 +656,7 @@ static void sortmodes (void)
|
|||
}
|
||||
}
|
||||
|
||||
static void modesList (void)
|
||||
static void modesList()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -677,13 +677,13 @@ static void modesList (void)
|
|||
}
|
||||
}
|
||||
|
||||
void picasso_InitResolutions (void)
|
||||
void picasso_InitResolutions()
|
||||
{
|
||||
struct MultiDisplay *md1;
|
||||
struct MultiDisplay* md1;
|
||||
int i, count = 0;
|
||||
char tmp[200];
|
||||
int bit_idx;
|
||||
int bits[] = { 8, 16, 32 };
|
||||
int bits[] = {8, 16, 32};
|
||||
|
||||
Displays[0].primary = 1;
|
||||
Displays[0].disabled = 0;
|
||||
|
@ -691,7 +691,7 @@ void picasso_InitResolutions (void)
|
|||
Displays[0].rect.top = 0;
|
||||
Displays[0].rect.right = 800;
|
||||
Displays[0].rect.bottom = 480;
|
||||
sprintf (tmp, "%s (%d*%d)", "Display", Displays[0].rect.right, Displays[0].rect.bottom);
|
||||
sprintf(tmp, "%s (%d*%d)", "Display", Displays[0].rect.right, Displays[0].rect.bottom);
|
||||
Displays[0].name = my_strdup(tmp);
|
||||
Displays[0].name2 = my_strdup("Display");
|
||||
|
||||
|
@ -699,16 +699,16 @@ void picasso_InitResolutions (void)
|
|||
DisplayModes = md1->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES);
|
||||
for (i = 0; i < MAX_SCREEN_MODES && count < MAX_PICASSO_MODES; i++)
|
||||
{
|
||||
for(bit_idx = 0; bit_idx < 3; ++bit_idx)
|
||||
for (bit_idx = 0; bit_idx < 3; ++bit_idx)
|
||||
{
|
||||
int bitdepth = bits[bit_idx];
|
||||
int bit_unit = (bitdepth + 1) & 0xF8;
|
||||
int rgbFormat = (bitdepth == 8 ? RGBFB_CLUT : (bitdepth == 16 ? RGBFB_R5G6B5 : RGBFB_R8G8B8A8));
|
||||
int pixelFormat = 1 << rgbFormat;
|
||||
pixelFormat |= RGBFF_CHUNKY;
|
||||
//
|
||||
// if (SDL_VideoModeOK (x_size_table[i], y_size_table[i], 16, SDL_SWSURFACE))
|
||||
// {
|
||||
//
|
||||
// if (SDL_VideoModeOK (x_size_table[i], y_size_table[i], 16, SDL_SWSURFACE))
|
||||
// {
|
||||
DisplayModes[count].res.width = x_size_table[i];
|
||||
DisplayModes[count].res.height = y_size_table[i];
|
||||
DisplayModes[count].depth = bit_unit >> 3;
|
||||
|
@ -720,7 +720,7 @@ void picasso_InitResolutions (void)
|
|||
DisplayModes[count].res.width, DisplayModes[count].res.height, DisplayModes[count].depth * 8);
|
||||
|
||||
count++;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
DisplayModes[count].depth = -1;
|
||||
|
@ -731,7 +731,7 @@ void picasso_InitResolutions (void)
|
|||
#endif
|
||||
|
||||
#ifdef PICASSO96
|
||||
void gfx_set_picasso_state (int on)
|
||||
void gfx_set_picasso_state(int on)
|
||||
{
|
||||
if (on == screen_is_picasso)
|
||||
return;
|
||||
|
@ -741,13 +741,13 @@ void gfx_set_picasso_state (int on)
|
|||
picasso_vidinfo.rowbytes = screen->pitch;
|
||||
}
|
||||
|
||||
void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt)
|
||||
void gfx_set_picasso_modeinfo(uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt)
|
||||
{
|
||||
depth >>= 3;
|
||||
if( (unsigned(picasso_vidinfo.width) == w ) &&
|
||||
( unsigned(picasso_vidinfo.height) == h ) &&
|
||||
( unsigned(picasso_vidinfo.depth) == depth ) &&
|
||||
( picasso_vidinfo.selected_rgbformat == rgbfmt) )
|
||||
if ((unsigned(picasso_vidinfo.width) == w) &&
|
||||
(unsigned(picasso_vidinfo.height) == h) &&
|
||||
(unsigned(picasso_vidinfo.depth) == depth) &&
|
||||
(picasso_vidinfo.selected_rgbformat == rgbfmt))
|
||||
return;
|
||||
|
||||
picasso_vidinfo.selected_rgbformat = rgbfmt;
|
||||
|
@ -765,14 +765,14 @@ void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgb
|
|||
}
|
||||
}
|
||||
|
||||
uae_u8 *gfx_lock_picasso (void)
|
||||
uae_u8* gfx_lock_picasso()
|
||||
{
|
||||
SDL_LockSurface(screen);
|
||||
picasso_vidinfo.rowbytes = screen->pitch;
|
||||
return (uae_u8 *)screen->pixels;
|
||||
return static_cast<uae_u8 *>(screen->pixels);
|
||||
}
|
||||
|
||||
void gfx_unlock_picasso (void)
|
||||
void gfx_unlock_picasso()
|
||||
{
|
||||
SDL_UnlockSurface(screen);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "config.h"
|
||||
#include "options.h"
|
||||
#include "threaddep/thread.h"
|
||||
#include "memory.h"
|
||||
#include "include/memory.h"
|
||||
#include "custom.h"
|
||||
#include "newcpu.h"
|
||||
#include "xwin.h"
|
||||
|
@ -207,7 +207,7 @@ static void DumpModeInfoStructure(uaecptr amigamodeinfoptr)
|
|||
write_log (_T(" Node.ln_Pred = 0x%x\n"), get_long (amigamodeinfoptr + 4));
|
||||
write_log (_T(" Node.ln_Type = 0x%x\n"), get_byte (amigamodeinfoptr + 8));
|
||||
write_log (_T(" Node.ln_Pri = %d\n"), get_byte (amigamodeinfoptr + 9));
|
||||
/*write_log (_T(" Node.ln_Name = %s\n"), uaememptr->Node.ln_Name); */
|
||||
/*write_log (_T(" Node.ln_Name = %s\n"), uaememptr->Node.ln_Name); */
|
||||
write_log (_T(" OpenCount = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_OpenCount));
|
||||
write_log (_T(" Active = %d\n"), get_byte (amigamodeinfoptr + PSSO_ModeInfo_Active));
|
||||
write_log (_T(" Width = %d\n"), get_word (amigamodeinfoptr + PSSO_ModeInfo_Width));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue