diff -ru mame/src/artwork.c mameart/src/artwork.c --- mame/src/artwork.c 2004-03-06 14:43:44.000000000 -0600 +++ mameart/src/artwork.c 2004-07-27 18:42:58.000000000 -0500 @@ -604,10 +604,17 @@ double min_x, min_y, max_x, max_y; UINT32 rgb32_components[3]; struct artwork_piece *piece; + double temp, delta, game_aspect; + int tempx; + /* reset UI */ uioverlay = NULL; uioverlayhint = NULL; + game_aspect = 0.0; + temp = 0.0; + tempx = 0; + delta = 0.0; /* first load the artwork; if none, quit now */ artwork_list = NULL; @@ -626,7 +633,9 @@ /* compute the extent of all the artwork */ min_x = min_y = 0.0; max_x = max_y = 1.0; + if (!options.artwork_crop) + { for (piece = artwork_list; piece; piece = piece->next) { /* compute the outermost bounds */ @@ -634,14 +643,188 @@ if (piece->right > max_x) max_x = piece->right; if (piece->top < min_y) min_y = piece->top; if (piece->bottom > max_y) max_y = piece->bottom; + params->aspect_x = (int)((double)params->aspect_x * (max_x - min_x)); + params->aspect_y = (int)((double)params->aspect_y * (max_y - min_y)); + } + } + else + { + //Do we want leave artwork in edge space + if (options.artwork_fb) + { + game_aspect=((double)original_width/(double)original_height); + game_aspect=(double)params->aspect_x / (double)params->aspect_y; + + fprintf(stderr, "Game want to be %d:%d = %f\n", params->aspect_x, params->aspect_y, game_aspect); + fprintf(stderr, "screen_aspect is %f\n\n", options.screen_aspect); + + if(options.rotation) + { + fprintf(stderr, "Game is rotated\n"); + game_aspect = (double)1.0/game_aspect; + fprintf(stderr, "New game aspect is %f\n", game_aspect); + } + else + fprintf(stderr, "Game is not rotated"); + + if((Machine->gamedrv->flags & ORIENTATION_SWAP_XY)) + { + fprintf(stderr, "Swapped X and Y\n"); + game_aspect = (double)1.0/game_aspect; + fprintf(stderr, "New game aspect is %f\n", game_aspect); + } + else + fprintf(stderr, "X and Y not swapped\n"); + + fprintf(stderr, "rotation=%d flags=%d orientation=%d ROT0=%d ROT90=%d ROT180=%d ROT270=%d\n" , options.rotation, (Machine->gamedrv->flags & ORIENTATION_SWAP_XY), options.orientation, ROT0, ROT90, ROT180, ROT270); + fprintf(stderr, "vector_width=%d vector_height=%d\n" , options.vector_width, options.vector_height); + fprintf(stderr, "original_width=%d original_height=%d\n" , original_width, original_height); + + for (piece = artwork_list; piece; piece = piece->next) + { + // Why Float? Because when I kept as double for some reason when + // game_aspect should have equalled options.screen_aspect game_aspect + // was actually less than options.screen_aspect. Even though everything + // is calculated the same, int converted to doubles being stored in doubles. + // This gives less precision and works! + // + // Letterbox games have been handled,but I don;t have a way to test that right now + // In theory they will work + // + // Note, this hack CENTERS the game screen. So if a game has bezel art on one side + // but not the other the game screen still gets centered. + if((float)game_aspect < (float)options.screen_aspect) + { + if(options.rotation) + { + if(Machine->gamedrv->flags & ORIENTATION_SWAP_XY) + { + //fill x ?? + //fprintf(stderr, "Here1\n"); + temp = (options.screen_aspect) * (double)original_height; + delta = abs(temp - (double)original_width) / 2.0; + printf("temp=%f delta_width=%f\n",temp, delta); + + max_x = 1.0 + (delta / (double)original_width); + min_x = 0.0 - (delta / (double)original_width); + } + else + { + //fill ** + //fprintf(stderr, "Here2\n"); + temp = (options.screen_aspect) * (double)original_width; + delta = abs(temp - (double)original_height) / 2.0; + printf("temp=%f delta_height=%f\n",temp, delta); + + max_y = 1.0 + (delta / (double)original_height); + min_y = 0.0 - (delta / (double)original_height); + tempx = params->aspect_x; + params->aspect_x = params->aspect_y; + params->aspect_y = tempx; + } + } + else + { + if(Machine->gamedrv->flags & ORIENTATION_SWAP_XY) + { + //fill ** + //fprintf(stderr, "Here3\n"); + temp = (options.screen_aspect) * (double)original_width; + delta = abs(temp - (double)original_height) / 2.0; + printf("temp=%f delta_height=%f\n",temp, delta); + + max_y = 1.0 + (delta / (double)original_height); + min_y = 0.0 - (delta / (double)original_height); + tempx = params->aspect_x; + params->aspect_x = params->aspect_y; + params->aspect_y = tempx; + } + else + { + //fill x ?? + //fprintf(stderr, "Here4\n"); + temp = (options.screen_aspect) * (double)original_height; + delta = abs(temp - (double)original_width) / 2.0; + printf("temp=%f delta_width=%f\n",temp, delta); + + max_x = 1.0 + (delta / (double)original_width); + min_x = 0.0 - (delta / (double)original_width); + } + } + } + else if((float)game_aspect > (float)options.screen_aspect) + { + if(options.rotation) + { + if(Machine->gamedrv->flags & ORIENTATION_SWAP_XY) + { + //fill ?? + //fprintf(stderr, "Here5\n"); + temp = (options.screen_aspect) * (double)original_width; + delta = abs(temp - (double)original_height) / 2.0; + printf("temp=%f delta_height=%f\n",temp, delta); + + max_y = 1.0 + (delta / (double)original_height); + min_y = 0.0 - (delta / (double)original_height); + tempx = params->aspect_x; + params->aspect_x = params->aspect_y; + params->aspect_y = tempx; + } + else + { + //fill x ?? + //fprintf(stderr, "Here6\n"); + temp = (options.screen_aspect) * (double)original_height; + delta = abs(temp - (double)original_width) / 2.0; + printf("temp=%f delta_width=%f\n",temp, delta); + + max_x = 1.0 + (delta / (double)original_width); + min_x = 0.0 - (delta / (double)original_width); + } + } + else + { + if(Machine->gamedrv->flags & ORIENTATION_SWAP_XY) + { + //fill x? + //fprintf(stderr, "Here7\n"); + temp = (options.screen_aspect) * (double)original_height; + delta = abs(temp - (double)original_width) / 2.0; + printf("temp=%f delta_width=%f\n",temp, delta); + + max_x = 1.0 + (delta / (double)original_width); + min_x = 0.0 - (delta / (double)original_width); + } + else + { + //fill ?? + //fprintf(stderr, "Here8\n"); + temp = (options.screen_aspect) * (double)original_width; + delta = abs(temp - (double)original_height) / 2.0; + printf("temp=%f delta_height=%f\n",temp, delta); + + max_y = 1.0 + (delta / (double)original_height); + min_y = 0.0 - (delta / (double)original_height); + } + } + } + } } + } /* now compute the altered width/height and the new aspect ratio */ params->width = (int)((max_x - min_x) * (double)(original_width * gamescale) + 0.5); params->height = (int)((max_y - min_y) * (double)(original_height * gamescale) + 0.5); - params->aspect_x = (int)((double)params->aspect_x * 100. * (max_x - min_x)); - params->aspect_y = (int)((double)params->aspect_y * 100. * (max_y - min_y)); - + params->aspect_x = (int)((double)params->aspect_x * 100);//. * (max_x - min_x)); + params->aspect_y = (int)((double)params->aspect_y * 100);//. * (max_y - min_y)); + + if (options.artwork_fb) + { + fprintf(stderr, "min_x=%f max_x=%f min_y=%f max_y=%f \n",min_x,max_x,min_y,max_y); + fprintf(stderr, "new params->width=%d new params->height=%d\n" , params->width, params->height); + fprintf(stderr, "new params->aspect_x=%d new params->aspect_y=%d\n" , params->aspect_x, params->aspect_y); + } + /* vector games need to fit inside the original bounds, so scale back down */ if (params->video_attributes & VIDEO_TYPE_VECTOR) { diff -ru mame/src/mame.h mameart/src/mame.h --- mame/src/mame.h 2004-04-01 17:32:00.000000000 -0600 +++ mameart/src/mame.h 2004-07-27 16:09:32.000000000 -0500 @@ -210,7 +210,10 @@ int color_depth; /* 15, 16, or 32, any other value means auto */ int vector_width; /* requested width for vector games; 0 means default (640) */ int vector_height; /* requested height for vector games; 0 means default (480) */ + int orientation; /* orientation of video */ int ui_orientation; /* orientation of the UI relative to the video */ + double screen_aspect; /* orientation of the UI relative to the video */ + int rotation; int beam; /* vector beam width */ float vector_flicker; /* vector beam flicker effect control */ @@ -221,6 +224,7 @@ int use_artwork; /* bitfield indicating which artwork pieces to use */ int artwork_res; /* 1 for 1x game scaling, 2 for 2x */ int artwork_crop; /* 1 to crop artwork to the game screen */ + int artwork_fb; /* fill black borders */ const char * savegame; /* string representing a savegame to load; if one length then interpreted as a character */ int crc_only; /* specify if only CRC should be used as checksum */ diff -ru mame/src/windows/config.c mameart/src/windows/config.c --- mame/src/windows/config.c 2004-04-27 19:42:40.000000000 -0500 +++ mameart/src/windows/config.c 2004-07-27 18:44:32.000000000 -0500 @@ -207,6 +207,7 @@ { "use_overlays", "overlay", rc_bool, &use_overlays, "1", 0, 0, NULL, "use overlay artwork" }, { "use_bezels", "bezel", rc_bool, &use_bezels, "1", 0, 0, NULL, "use bezel artwork" }, { "artwork_crop", "artcrop", rc_bool, &options.artwork_crop, "0", 0, 0, NULL, "crop artwork to " GAMENOUN " screen only" }, + { "artwork_filledges", "cropfe", rc_bool, &options.artwork_fb, "0", 0, 0, NULL, "use with artcrop, fills edges with art" }, { "artwork_resolution", "artres", rc_int, &options.artwork_res, "0", 0, 0, NULL, "artwork resolution (0 for auto)" }, { "cheat", "c", rc_bool, &options.cheat, "0", 0, 0, NULL, "enable/disable cheat subsystem" }, { "debug", "d", rc_bool, &options.mame_debug, "0", 0, 0, NULL, "enable/disable debugger (only if available)" }, @@ -667,6 +668,7 @@ /* first start with the game's built in orientation */ int orientation = drivers[game_index]->flags & ORIENTATION_MASK; options.ui_orientation = orientation; + options.rotation=0; if (options.ui_orientation & ORIENTATION_SWAP_XY) { @@ -689,6 +691,7 @@ orientation ^= ROT180; orientation ^= ROT90; + options.rotation=1; } /* rotate left */ @@ -700,6 +703,7 @@ orientation ^= ROT180; orientation ^= ROT270; + options.rotation=1; } /* auto-rotate right (e.g. for rotating lcds), based on original orientation */ @@ -711,8 +715,9 @@ orientation ^= ROT180; orientation ^= ROT90; + options.rotation=1; } - + /* auto-rotate left (e.g. for rotating lcds), based on original orientation */ if (video_autorol && (drivers[game_index]->flags & ORIENTATION_SWAP_XY) ) { @@ -722,8 +727,9 @@ orientation ^= ROT180; orientation ^= ROT270; + options.rotation=1; } - + options.orientation = orientation; /* flip X/Y */ if (video_flipx) orientation ^= ORIENTATION_FLIP_X; diff -ru mame/src/windows/video.c mameart/src/windows/video.c --- mame/src/windows/video.c 2004-03-06 14:43:44.000000000 -0600 +++ mameart/src/windows/video.c 2004-07-27 11:06:40.000000000 -0500 @@ -354,6 +354,7 @@ return -1; } win_screen_aspect = (double)num / (double)den; + options.screen_aspect = win_screen_aspect; option->priority = priority; return 0;