WIP - Fixes after merge 4

This commit is contained in:
Dimitris Panokostas 2017-09-19 17:04:17 +02:00
parent 7bc131d023
commit 1b965d938c
6 changed files with 44 additions and 37 deletions

View file

@ -4468,7 +4468,6 @@ uae_u32 cfgfile_uaelib(TrapContext *ctx, int mode, uae_u32 name, uae_u32 dst, ua
void default_prefs(struct uae_prefs *p, bool reset, int type)
{
int i;
int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 };
TCHAR zero = 0;
@ -4482,7 +4481,7 @@ void default_prefs(struct uae_prefs *p, bool reset, int type)
p->z3_mapping_mode = Z3MAPPING_AUTO;
p->mountitems = 0;
for (i = 0; i < MOUNT_CONFIG_SIZE; i++) {
for (int i = 0; i < MOUNT_CONFIG_SIZE; i++) {
p->mountconfig[i].configoffset = -1;
p->mountconfig[i].unitnum = -1;
}
@ -4514,9 +4513,9 @@ void default_prefs(struct uae_prefs *p, bool reset, int type)
p->cachesize = 0;
p->gfx_framerate = 0;
p->gfx_size.width = 320;
p->gfx_size.width = 640;
p->gfx_size.height = 256;
p->gfx_resolution = RES_LORES;
p->gfx_resolution = RES_HIRES;
p->immediate_blits = false;
p->waiting_blits = 0;

View file

@ -5138,11 +5138,10 @@ static bool framewait(void)
curr_time = read_processor_time();
int max;
int adjust = 0;
if ((int)curr_time - (int)vsyncwaittime > 0 && (int)curr_time - (int)vsyncwaittime < vstb / 2)
if (int(curr_time) - int(vsyncwaittime) > 0 && int(curr_time) - int(vsyncwaittime) < vstb / 2)
adjust += curr_time - vsyncwaittime;
max = (int)(vstb * (1000.0) / 1000.0 - adjust);
int max = int(vstb * (1000.0) / 1000.0 - adjust);
vsyncwaittime = curr_time + vstb - adjust;
vsyncmintime = curr_time;
@ -5251,11 +5250,10 @@ static void vsync_handler_pre(void)
#endif
if (!vsync_rendered) {
frame_time_t start, end;
start = read_processor_time();
frame_time_t start = read_processor_time();
vsync_handle_redraw();
vsync_rendered = true;
end = read_processor_time();
frame_time_t end = read_processor_time();
frameskiptime += end - start;
}

View file

@ -140,10 +140,8 @@ static uae_u16 ham_linebuf[MAX_PIXELS_PER_LINE * 2];
static uae_u8 *xlinebuffer;
#define MAX_VIDHEIGHT 270
static int *native2amiga_line_map;
static uae_u8 *row_map[MAX_VIDHEIGHT + 1];
static uae_u8** row_map;
static uae_u8 row_tmp[MAX_PIXELS_PER_LINE * 32 / 8];
/* line_draw_funcs: pfield_do_linetoscr, pfield_do_fill_line, decode_ham */
@ -1857,13 +1855,28 @@ static void pfield_doline(int lineno)
void init_row_map(void)
{
static uae_u8* oldbufmem;
static int oldheight, oldpitch;
int i, j;
for (i = gfxvidinfo.drawbuffer.outheight; i < MAX_VIDHEIGHT + 1; i++)
row_map[i] = row_tmp;
for (i = 0, j = 0; i < gfxvidinfo.drawbuffer.outheight; i++, j += gfxvidinfo.drawbuffer.rowbytes) {
row_map[i] = gfxvidinfo.drawbuffer.bufmem + j;
if (gfxvidinfo.drawbuffer.outheight > max_uae_height)
{
write_log(_T("Resolution too high, aborting\n"));
abort();
}
if (!row_map)
row_map = xmalloc(uae_u8*, max_uae_height + 1);
if (oldbufmem && oldbufmem == gfxvidinfo.drawbuffer.bufmem &&
oldheight == gfxvidinfo.drawbuffer.outheight &&
oldpitch == gfxvidinfo.drawbuffer.rowbytes)
return;
j = oldheight == 0 ? max_uae_height : oldheight;
for (i = gfxvidinfo.drawbuffer.outheight; i < max_uae_height + 1 && i < j + 1; i++)
row_map[i] = row_tmp;
for (i = 0, j = 0; i < gfxvidinfo.drawbuffer.outheight; i++, j += gfxvidinfo.drawbuffer.rowbytes)
row_map[i] = gfxvidinfo.drawbuffer.bufmem + j;
}
static void init_aspect_maps()
@ -2186,8 +2199,7 @@ static void pfield_draw_line(int lineno, int gfx_ypos)
static void center_image(void)
{
int deltaToBorder;
deltaToBorder = (gfxvidinfo.drawbuffer.outwidth >> currprefs.gfx_resolution) - 320;
int deltaToBorder = (gfxvidinfo.drawbuffer.outwidth >> currprefs.gfx_resolution) - 320;
visible_left_border = 73 - (deltaToBorder >> 1);
visible_right_border = 393 + (deltaToBorder >> 1);
@ -2216,10 +2228,8 @@ static void init_drawing_frame(void)
static void draw_status_line(int line, int statusy)
{
uae_u8 *buf;
xlinebuffer = row_map[line];
buf = xlinebuffer;
uae_u8 *buf = xlinebuffer;
draw_status_line_single(buf, statusy, gfxvidinfo.drawbuffer.outwidth);
}

View file

@ -20,7 +20,7 @@
/* SDL variable for output of emulation */
SDL_Surface* screen = nullptr;
static unsigned int current_vsync_frame = 0;
//static unsigned int current_vsync_frame = 0;
unsigned long time_per_frame = 20000; // Default for PAL (50 Hz): 20000 microsecs
static unsigned long last_synctime;
static unsigned long next_synctime = 0;
@ -60,8 +60,8 @@ void InitAmigaVidMode(struct uae_prefs* p)
/* Initialize structure for Amiga video modes */
gfxvidinfo.drawbuffer.pixbytes = screen->format->BytesPerPixel;
gfxvidinfo.drawbuffer.bufmem = static_cast<uae_u8 *>(screen->pixels);
gfxvidinfo.drawbuffer.outwidth = screen->w ? screen->w : 640; //p->gfx_size.width;
gfxvidinfo.drawbuffer.outheight = screen->h ? screen->h : 256; //p->gfx_size.height;
gfxvidinfo.drawbuffer.outwidth = p->gfx_size.width;
gfxvidinfo.drawbuffer.outheight = p->gfx_size.height;
gfxvidinfo.drawbuffer.rowbytes = screen->pitch;
}
@ -226,7 +226,7 @@ int lockscr()
{
if(SDL_LockSurface(screen)== -1)
return 0;
init_row_map();
//init_row_map();
return 1;
}
@ -261,18 +261,21 @@ bool render_screen(bool immediate)
void show_screen(int mode)
{
unsigned long start = read_processor_time();
//unsigned long start = read_processor_time();
last_synctime = read_processor_time();
updatedisplayarea();
idletime += last_synctime - start;
//idletime += last_synctime - start;
if (!screen_is_picasso)
gfxvidinfo.drawbuffer.bufmem = (uae_u8 *)screen->pixels;
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();
}
unsigned long target_lastsynctime(void)

View file

@ -105,15 +105,15 @@ public:
// Load selected configuration
//-----------------------------------------------
i = lstConfigs->getSelected();
if (emulating) {
uae_restart(-1, ConfigFilesList[i]->FullPath);
}
else {
//if (emulating) {
// uae_restart(-1, ConfigFilesList[i]->FullPath);
//}
//else {
target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0);
strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH);
DisableResume();
RefreshAllPanels();
}
//}
}
else if (actionEvent.getSource() == cmdSave)
{

View file

@ -678,9 +678,6 @@ void run_gui()
try
{
sdl::gui_init();
#ifdef DEBUG
printf("Calling widgets::gui_init\n");
#endif
widgets::gui_init();
if (_tcslen(startup_message) > 0) {
ShowMessage(startup_title, startup_message, _T(""), _T("Ok"), _T(""));