diff --git a/libretro-common/include/retro_inline.h b/libretro-common/include/retro_inline.h index 8535d84..f998624 100644 --- a/libretro-common/include/retro_inline.h +++ b/libretro-common/include/retro_inline.h @@ -26,7 +26,7 @@ #ifndef INLINE #if !defined(__cplusplus) && defined(_WIN32) -#define INLINE _inline +#define INLINE inline #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L #define INLINE inline #elif defined(__GNUC__) diff --git a/libretro.cpp b/libretro.cpp index bd85d2e..c6340bf 100755 --- a/libretro.cpp +++ b/libretro.cpp @@ -24,6 +24,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 242 +#define MEDNAFEN_CORE_GEOMETRY_MAX_W 512 +#define MEDNAFEN_CORE_GEOMETRY_MAX_H 242 +#define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO (4.0 / 3.0) +#define FB_WIDTH 512 +#define FB_HEIGHT 242 + static bool old_cdimagecache = false; extern MDFNGI EmulatedPCE_Fast; @@ -854,8 +867,8 @@ 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 242, // Framebuffer height @@ -1152,8 +1165,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; @@ -1180,19 +1191,6 @@ static void set_basename(const char *path) #include "mednafen/pce_fast/pcecd.h" -#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 288 -#define MEDNAFEN_CORE_GEOMETRY_BASE_H 232 -#define MEDNAFEN_CORE_GEOMETRY_MAX_W 512 -#define MEDNAFEN_CORE_GEOMETRY_MAX_H 242 -#define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIO (4.0 / 3.0) -#define FB_WIDTH 512 -#define FB_HEIGHT 242 - #define FB_MAX_HEIGHT FB_HEIGHT static void check_system_specs(void) @@ -1532,10 +1530,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 +1546,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 +1667,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 +1934,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) diff --git a/mednafen/git.h b/mednafen/git.h index f5b7c6a..14b8c9e 100644 --- a/mednafen/git.h +++ b/mednafen/git.h @@ -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 diff --git a/mednafen/pce_fast/vdc.cpp b/mednafen/pce_fast/vdc.cpp index 41efbfe..1388bd7 100644 --- a/mednafen/pce_fast/vdc.cpp +++ b/mednafen/pce_fast/vdc.cpp @@ -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)