Correct Pixel Aspect Ratio

Conflicts:
	libretro.cpp
This commit is contained in:
westonlast 2016-07-18 02:32:52 -05:00
parent 5045bedcbe
commit 217c47bb54
3 changed files with 31 additions and 50 deletions

View File

@ -16,7 +16,6 @@
#include "mednafen/pce_fast/pcecd_drive.h"
#include "mednafen/hw_misc/arcade_card/arcade_card.h"
#include "mednafen/mempatcher.h"
#include "mednafen/cdrom/cdromif.h"
#include "mednafen/cdrom/CDUtility.h"
@ -24,6 +23,19 @@
#include "mednafen/msvc_compat.h"
#endif
#define MEDNAFEN_CORE_NAME_MODULE "pce_fast"
#define MEDNAFEN_CORE_NAME "Mednafen PCE Fast"
#define MEDNAFEN_CORE_VERSION "v0.9.38.7"
#define MEDNAFEN_CORE_EXTENSIONS "pce|cue|ccd"
#define MEDNAFEN_CORE_TIMING_FPS 59.82
#define MEDNAFEN_CORE_GEOMETRY_BASE_W 512
#define MEDNAFEN_CORE_GEOMETRY_BASE_H 243
#define MEDNAFEN_CORE_GEOMETRY_MAX_W 512
#define MEDNAFEN_CORE_GEOMETRY_MAX_H 243
#define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO (4.0 / 3.0)
#define FB_WIDTH 512
#define FB_HEIGHT 243
static bool old_cdimagecache = false;
extern MDFNGI EmulatedPCE_Fast;
@ -854,11 +866,11 @@ MDFNGI EmulatedPCE_Fast =
0, // lcm_height
NULL, // Dummy
288, // Nominal width
232, // Nominal height
MEDNAFEN_CORE_GEOMETRY_BASE_W, // Nominal width
MEDNAFEN_CORE_GEOMETRY_BASE_H, // Nominal height
512, // Framebuffer width
243, // Framebuffer height
FB_WIDTH, // Framebuffer width
FB_HEIGHT, // Framebuffer height
2, // Number of output sound channels
};
@ -1152,8 +1164,6 @@ static retro_audio_sample_batch_t audio_batch_cb;
static retro_environment_t environ_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
static bool overscan;
static double last_sound_rate;
static MDFN_Surface *surf;
@ -1532,10 +1542,6 @@ bool retro_load_game(const struct retro_game_info *info)
};
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
overscan = false;
environ_cb(RETRO_ENVIRONMENT_GET_OVERSCAN, &overscan);
set_basename(info->path);
check_variables();
@ -1552,8 +1558,7 @@ bool retro_load_game(const struct retro_game_info *info)
surf->width = FB_WIDTH;
surf->height = FB_HEIGHT;
surf->pitch = FB_WIDTH;
surf->pixels = (uint16_t*)calloc(1, FB_WIDTH * FB_HEIGHT * 3);
surf->pixels = (uint16_t*) calloc(2, FB_WIDTH * FB_HEIGHT);
if (!surf->pixels)
{
@ -1674,11 +1679,14 @@ void retro_run(void)
spec.SoundBufSize = spec.SoundBufSizeALMS + SoundBufSize;
unsigned width = spec.DisplayRect.w & ~0x1;
unsigned width = spec.DisplayRect.w;
unsigned height = spec.DisplayRect.h;
video_cb(surf->pixels + surf->pitch * spec.DisplayRect.y, width, height, FB_WIDTH << 1);
struct retro_system_av_info system_av_info;
system_av_info.geometry.base_width = width;
system_av_info.geometry.base_height = height;
system_av_info.geometry.aspect_ratio = MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO;
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &system_av_info);
video_cb(surf->pixels + surf->pitch * spec.DisplayRect.y, width, height, FB_WIDTH * 2);
video_frames++;
audio_frames += spec.SoundBufSize;
@ -1938,14 +1946,6 @@ void MDFND_Message(const char *str)
log_cb(RETRO_LOG_INFO, "%s\n", str);
}
void MDFND_MidSync(const EmulateSpecStruct *)
{}
void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y)
{
//MDFND_MidLineUpdate(espec, y);
}
void MDFND_PrintError(const char* err)
{
if (log_cb)

View File

@ -193,7 +193,6 @@ typedef struct
MDFN_Surface *surface;
// Will be set to TRUE if the video pixel format has changed since the last call to Emulate(), FALSE otherwise.
// Will be set to TRUE on the first call to the Emulate() function/method
bool VideoFormatChanged;
// Set by the system emulation code every frame, to denote the horizontal and vertical offsets of the image, and the size

View File

@ -771,13 +771,7 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
int32 *LineWidths = espec->LineWidths;
bool skip = espec->skip || IsHES;
// x and w should be overwritten in the big loop
if(!skip)
{
DisplayRect->x = 0;
DisplayRect->w = 256;
if(!skip){
DisplayRect->y = MDFN_GetSettingUI("pce_fast.slstart");
DisplayRect->h = MDFN_GetSettingUI("pce_fast.slend") - DisplayRect->y + 1;
}
@ -788,7 +782,7 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
if(frame_counter == 0)
{
VDS = M_vdc_VDS;
VDS = 12 /*constant that fills the framebuffer*//*M_vdc_VDS*/; //Vertical Display Start position minus two
VSW = M_vdc_VSW;
VDW = M_vdc_VDW;
VCR = M_vdc_VCR;
@ -953,16 +947,10 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
memset(spr_linebuf + 0x20, 0, sizeof(uint16) * (end - start));
}
if(SHOULD_DRAW)
{
static const int xs[2][3] = {
{ 24 - 43, 38, 96 - 43 * 2 },
{ 24, 38, 96 }
};
if(SHOULD_DRAW){
int32 width = end - start;
int32 source_offset = 0;
int32 target_offset = start - (128 + 8 + xs[correct_aspect][vce.dot_clock]);
int32 target_offset = 0;
if(target_offset < 0)
{
@ -974,9 +962,6 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
if((target_offset + width) > DisplayRect->w)
width = (int32)DisplayRect->w - target_offset;
//if(vdc->display_counter == 50)
// MDFN_DispMessage("soffset=%d, toffset=%d, width=%d", source_offset, target_offset, width);
if(width > 0)
{
//else if(target_ptr16)
@ -1011,11 +996,6 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
}
}
if(SHOULD_DRAW && fc_vrm)
{
MDFN_MidLineUpdate(espec, frame_counter - 14);
}
if((vdc->CR & 0x08) && need_vbi[0])
vdc->status |= VDCS_VD;
@ -1064,6 +1044,8 @@ void VDC_RunFrame(EmulateSpecStruct *espec, bool IsHES)
//printf("%d\n", vce.lc263);
} while(frame_counter != VBlankFL); // big frame loop!
DisplayRect->w = (M_vdc_HDW + 1) * 8; //Horizontal Display Width in eight pixel tiles minus one
DisplayRect->h = M_vdc_VDW + 1; //Vertical Display Width in pixels minus one
}
void VDC_Reset(void)