fix for 'jerky' rendering in final fantasy by changing emu to properly use startscanline and endscanline.

removed author stuff from record and replay dialogs
This commit is contained in:
zeromus 2008-05-27 00:51:31 +00:00
parent 14500a50be
commit a94c996dd7
11 changed files with 50 additions and 80 deletions

View File

@ -207,7 +207,7 @@ typedef struct
std::string name_of_rom_used;
} MOVIE_INFO;
void FCEUI_SaveMovie(char *fname, uint8 flags, const char* metadata);
void FCEUI_SaveMovie(char *fname, uint8 flags);
void FCEUI_LoadMovie(char *fname, bool read_only, int _stopframe);
void FCEUI_StopMovie(void);
int FCEUI_IsMovieActive(void);

View File

@ -127,7 +127,6 @@ HRESULT ddrval;
static char TempArray[2048];
int totallines = 0;
static int exiting = 0;
static volatile int moocow = 0;
@ -141,6 +140,11 @@ extern int frame_display, input_display;
int soundo = 1;
int srendlinen = 8;
int erendlinen = 231;
int srendlinep = 0;
int erendlinep = 239;
//mbg 6/30/06 - indicates that the main loop should close the game as soon as it can
int closeGame = 0;
@ -299,16 +303,9 @@ int BlockingCheck()
return exiting ? 0 : 1;
}
void FixFL()
{
FCEUI_GetCurrentVidSystem(&srendline, &erendline);
totallines = erendline - srendline + 1;
}
void UpdateRendBounds()
{
FCEUI_SetRenderedLines(srendlinen, erendlinen, srendlinep, erendlinep);
FixFL();
}
/**

View File

@ -72,21 +72,15 @@ extern int soundvolume;
extern int soundquality;
static uint8 cpalette[192];
//mbg 5/7/08 - I changed the ntsc settings to match pal.
//this is more for precision emulation, instead of entertainment, which is what fceux is all about nowadays
//static int srendlinen = 8;
//static int erendlinen = 231;
static int srendlinen = 0;
static int erendlinen = 239;
static int srendlinep = 0;
static int erendlinep = 239;
extern int srendlinen;
extern int erendlinen;
extern int srendlinep;
extern int erendlinep;
static int ntsccol = 0, ntsctint, ntschue;
extern int totallines;
//mbg merge 7/17/06 did these have to be unsigned?
static int srendline, erendline;
//static int srendline, erendline;
static int changerecursive=0;
@ -105,7 +99,6 @@ extern HRESULT ddrval;
extern int windowedfailed;
extern uint32 goptions;
void FixFL();
void DoFCEUExit();
void ShowAboutBox();
int BlockingCheck();

View File

@ -131,20 +131,6 @@ void UpdateReplayDialog(HWND hwndDlg)
sprintf(tmp, "%lu", info.rerecord_count);
SetWindowTextA(GetDlgItem(hwndDlg,IDC_LABEL_UNDOCOUNT), tmp); // rerecord
{
//// convert utf8 metadata to windows widechar
//WCHAR wszMeta[MOVIE_MAX_METADATA];
//if(MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, metadata, -1, wszMeta, MOVIE_MAX_METADATA))
//{
// if(wszMeta[0])
// SetWindowTextW(GetDlgItem(hwndDlg,IDC_LABEL_AUTHORINFO), wszMeta); // metadata
// else
// SetWindowTextW(GetDlgItem(hwndDlg,IDC_LABEL_AUTHORINFO), L"(this movie has no author info)"); // metadata
//}
SetDlgItemTextW(hwndDlg,IDC_LABEL_AUTHORINFO,L"Temporarily non-functional");
}
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),(info.read_only)? FALSE : TRUE); // disable read-only checkbox if the file access is read-only
SendDlgItemMessage(hwndDlg,IDC_CHECK_READONLY,BM_SETCHECK,info.read_only ? BST_CHECKED : (ReplayDialogReadOnlyStatus ? BST_CHECKED : BST_UNCHECKED), 0);
@ -214,8 +200,7 @@ void UpdateReplayDialog(HWND hwndDlg)
{
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_LENGTH),"");
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_FRAMES),"");
//SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_UNDOCOUNT),"");
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_AUTHORINFO),"");
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_UNDOCOUNT),"");
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_ROMUSED),"");
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_ROMCHECKSUM),"");
SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_RECORDEDFROM),"Nothing (invalid movie)");
@ -336,8 +321,6 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
}
MOVIE_INFO info;
char metadata[MOVIE_MAX_METADATA];
char rom_name[MAX_PATH];
memset(&info, 0, sizeof(info));
@ -549,7 +532,6 @@ void FCEUD_MovieReplayFrom(void)
pal_emulation = FCEUI_GetCurrentVidSystem(0,0);
UpdateCheckedMenuItems();
FixFL();
SetMainWindowStuff();
RefreshThrottleFPS();
}
@ -708,7 +690,6 @@ static BOOL CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
{
LONG lIndex = SendDlgItemMessage(hwndDlg, IDC_COMBO_RECORDFROM, CB_GETCURSEL, 0, 0);
p->szFilename = GetRecordPath(hwndDlg);
GetDlgItemTextW(hwndDlg,IDC_EDIT_AUTHORINFO,p->metadata,MOVIE_MAX_METADATA);
p->recordFrom = (int)lIndex;
if(lIndex>=3)
p->szSavestateFilename = GetSavePath(hwndDlg);
@ -755,10 +736,6 @@ void FCEUD_MovieRecordTo()
if(DialogBoxParam(fceu_hInstance, "IDD_RECORDINP", hAppWnd, RecordDialogProc, (LPARAM)&p))
{
// turn WCHAR into UTF8
char meta[MOVIE_MAX_METADATA << 2];
WideCharToMultiByte(CP_UTF8, 0, p.metadata, -1, meta, sizeof(meta), NULL, NULL);
if(p.recordFrom >= 3)
{
// attempt to load the savestate
@ -780,7 +757,7 @@ void FCEUD_MovieRecordTo()
uint8 flags = 0;
if(p.recordFrom == 0) flags = MOVIE_FLAG_FROM_POWERON;
FCEUI_SaveMovie(p.szFilename, flags, meta);
FCEUI_SaveMovie(p.szFilename, flags);
}
if(p.szFilename)

Binary file not shown.

View File

@ -21,6 +21,7 @@
#include "video.h"
#include "../../drawing.h"
#include "gui.h"
#include "../../fceu.h"
static int RecalcCustom(void);
void InputScreenChanged(int fs);
@ -261,7 +262,7 @@ int SetVideoMode(int fs)
ddsdback.ddsCaps.dwCaps= DDSCAPS_OFFSCREENPLAIN;
ddsdback.dwWidth=256 * specmul;
ddsdback.dwHeight=240 * specmul;
ddsdback.dwHeight=FSettings.TotalScanlines() * specmul;
/*
If the blit hardware can't stretch, assume it's cheap(and slow)
@ -346,7 +347,7 @@ int SetVideoMode(int fs)
ddsdback.ddsCaps.dwCaps= DDSCAPS_OFFSCREENPLAIN;
ddsdback.dwWidth=256 * specmul; //vmodes[vmod].srect.right;
ddsdback.dwHeight=240 * specmul; //vmodes[vmod].srect.bottom;
ddsdback.dwHeight=FSettings.TotalScanlines() * specmul; //vmodes[vmod].srect.bottom;
if(!(caps.dwCaps&DDCAPS_BLTSTRETCH))
ddsdback.ddsCaps.dwCaps|=DDSCAPS_SYSTEMMEMORY;
@ -465,7 +466,7 @@ static void BlitScreenWindow(unsigned char *XBuf)
srect.top=srect.left=0;
srect.right=VNSWID * specialmul;
srect.bottom=totallines * specialmul;
srect.bottom=FSettings.TotalScanlines() * specialmul;
if(PaletteChanged==1)
{
@ -487,10 +488,10 @@ static void BlitScreenWindow(unsigned char *XBuf)
ScreenLoc=(unsigned char*)ddsdback.lpSurface; //mbg merge 7/17/06 added cst
if(veflags&1)
{
memset(ScreenLoc,0,pitch*240);
memset(ScreenLoc,0,pitch*ddsdback.dwHeight);
veflags&=~1;
}
Blit8ToHigh(XBuf+srendline*256+VNSCLIP,ScreenLoc, VNSWID, totallines, pitch,specialmul,specialmul);
Blit8ToHigh(XBuf+FSettings.FirstSLine*256+VNSCLIP,ScreenLoc, VNSWID, FSettings.TotalScanlines(), pitch,specialmul,specialmul);
IDirectDrawSurface7_Unlock(lpDDSBack, NULL);
@ -557,7 +558,7 @@ static void BlitScreenFull(uint8 *XBuf)
srect.top=0;
srect.left=0;
srect.right=VNSWID * specmul;
srect.bottom=totallines * specmul;
srect.bottom=FSettings.TotalScanlines() * specmul;
if(vmodes[vmod].flags&VMDF_STRFS)
{
@ -568,8 +569,8 @@ static void BlitScreenFull(uint8 *XBuf)
}
else
{
drect.top=(vmodes[vmod].y-(totallines*vmodes[vmod].yscale))>>1;
drect.bottom=drect.top+(totallines*vmodes[vmod].yscale);
drect.top=(vmodes[vmod].y-(FSettings.TotalScanlines()*vmodes[vmod].yscale))>>1;
drect.bottom=drect.top+(FSettings.TotalScanlines()*vmodes[vmod].yscale);
drect.left=(vmodes[vmod].x-VNSWID*vmodes[vmod].xscale)>>1;
drect.right=drect.left+VNSWID*vmodes[vmod].xscale;
}
@ -711,20 +712,20 @@ static void BlitScreenFull(uint8 *XBuf)
if(vmodes[vmod].special)
ScreenLoc += (vmodes[vmod].drect.left*(bpp>>3)) + ((vmodes[vmod].drect.top)*pitch);
else
ScreenLoc+=((vmodes[vmod].x-VNSWID)>>1)*(bpp>>3)+(((vmodes[vmod].y-totallines)>>1))*pitch;
ScreenLoc+=((vmodes[vmod].x-VNSWID)>>1)*(bpp>>3)+(((vmodes[vmod].y-FSettings.TotalScanlines())>>1))*pitch;
}
if(bpp>=16)
{
Blit8ToHigh(XBuf+srendline*256+VNSCLIP,(uint8*)ScreenLoc, VNSWID, totallines, pitch,specmul,specmul); //mbg merge 7/17/06 added cast
Blit8ToHigh(XBuf+FSettings.FirstSLine*256+VNSCLIP,(uint8*)ScreenLoc, VNSWID, FSettings.TotalScanlines(), pitch,specmul,specmul); //mbg merge 7/17/06 added cast
}
else
{
XBuf+=srendline*256+VNSCLIP;
XBuf+=FSettings.FirstSLine*256+VNSCLIP;
if(vmodes[vmod].special)
Blit8To8(XBuf,(uint8*)ScreenLoc, VNSWID, totallines, pitch,vmodes[vmod].xscale,vmodes[vmod].yscale,0,vmodes[vmod].special); //mbg merge 7/17/06 added cast
Blit8To8(XBuf,(uint8*)ScreenLoc, VNSWID, FSettings.TotalScanlines(), pitch,vmodes[vmod].xscale,vmodes[vmod].yscale,0,vmodes[vmod].special); //mbg merge 7/17/06 added cast
else
Blit8To8(XBuf,(uint8*)ScreenLoc, VNSWID, totallines, pitch,1,1,0,0); //mbg merge 7/17/06 added cast
Blit8To8(XBuf,(uint8*)ScreenLoc, VNSWID, FSettings.TotalScanlines(), pitch,1,1,0,0); //mbg merge 7/17/06 added cast
}
}
@ -826,7 +827,7 @@ static int RecalcCustom(void)
cmode->xscale=1;
}
}
if(totallines*cmode->yscale>cmode->y)
if(FSettings.TotalScanlines()*cmode->yscale>cmode->y)
{
if(cmode->special)
{
@ -841,12 +842,12 @@ static int RecalcCustom(void)
}
cmode->srect.left=VNSCLIP;
cmode->srect.top=srendline;
cmode->srect.top=FSettings.FirstSLine;
cmode->srect.right=256-VNSCLIP;
cmode->srect.bottom=erendline+1;
cmode->srect.bottom=FSettings.LastSLine+1;
cmode->drect.top=(cmode->y-(totallines*cmode->yscale))>>1;
cmode->drect.bottom=cmode->drect.top+totallines*cmode->yscale;
cmode->drect.top=(cmode->y-(FSettings.TotalScanlines()*cmode->yscale))>>1;
cmode->drect.bottom=cmode->drect.top+FSettings.TotalScanlines()*cmode->yscale;
cmode->drect.left=(cmode->x-(VNSWID*cmode->xscale))>>1;
cmode->drect.right=cmode->drect.left+VNSWID*cmode->xscale;
@ -864,7 +865,7 @@ static int RecalcCustom(void)
FCEUD_PrintError("Horizontal resolution is too low.");
return(0);
}
if(cmode->y<totallines && !(cmode->flags&VMDF_STRFS))
if(cmode->y<FSettings.TotalScanlines() && !(cmode->flags&VMDF_STRFS))
{
FCEUD_PrintError("Vertical resolution must not be less than the total number of drawn scanlines.");
return(0);

View File

@ -32,6 +32,7 @@
#include "input.h"
#include "video.h"
#include "../../input.h"
#include "../../fceu.h"
#include "memwatch.h"
#include "ppuview.h"
@ -113,7 +114,7 @@ void CalcWindowSize(RECT *al)
al->left = 0;
al->right = VNSWID * winsizemulx;
al->top = 0;
al->bottom = totallines * winsizemuly;
al->bottom = FSettings.TotalScanlines() * winsizemuly;
AdjustWindowRectEx(al,
GetWindowLong(hAppWnd, GWL_STYLE),
@ -475,8 +476,6 @@ void ALoad(char *nameo)
UpdateCheckedMenuItems();
FixFL();
SetMainWindowStuff();
AddRecentFile(nameo);
@ -577,7 +576,7 @@ void GetMouseData(uint32 *md)
RECT t;
GetClientRect(hAppWnd, &t);
md[0] = md[0] * VNSWID / (t.right ? t.right : 1);
md[1] = md[1] * totallines / (t.bottom ? t.bottom : 1);
md[1] = md[1] * FSettings.TotalScanlines() / (t.bottom ? t.bottom : 1);
}
else
{
@ -588,7 +587,7 @@ void GetMouseData(uint32 *md)
md[0] += VNSCLIP;
}
md[1] += srendline;
md[1] += FSettings.FirstSLine;
md[2] = ((mouseb == MK_LBUTTON) ? 1 : 0) | (( mouseb == MK_RBUTTON ) ? 2 : 0);
}
@ -928,7 +927,6 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
FCEUI_SetVidSystem(pal_emulation);
RefreshThrottleFPS();
UpdateCheckedMenuItems();
FixFL();
// DoVideoConfigFix();
SetMainWindowStuff();
break;
@ -1218,11 +1216,11 @@ void FixWXY(int pref)
if(!pref)
{
winsizemuly = winsizemulx * 256 / 240 * 3 / 4 * saspectw / saspecth;
winsizemuly = winsizemulx * 256 / FSettings.TotalScanlines() * 3 / 4 * saspectw / saspecth;
}
else
{
winsizemulx = winsizemuly * 240 / 256 * 4 / 3 * saspecth / saspectw;
winsizemulx = winsizemuly * FSettings.TotalScanlines() / 256 * 4 / 3 * saspecth / saspectw;
}
}
if(winspecial)
@ -1352,7 +1350,7 @@ int CreateMainWindow()
MainWindow_wndx,
MainWindow_wndy,
256,
240, /* X,Y ; Width, Height */
FSettings.TotalScanlines(), /* X,Y ; Width, Height */
NULL,
fceumenu,
fceu_hInstance,
@ -1444,7 +1442,7 @@ int GetClientAbsRect(LPRECT lpRect)
else
{
lpRect->right = point.x + VNSWID * winsizemulx;
lpRect->bottom = point.y + totallines * winsizemuly;
lpRect->bottom = point.y + FSettings.TotalScanlines() * winsizemuly;
}
return 1;
}

View File

@ -10,7 +10,6 @@ struct CreateMovieParameters
char* szFilename; // on Dialog creation, this is the default filename to display. On return, this is the filename that the user chose.
int recordFrom; // 0 = "Power-On", 1 = "Reset", 2 = "Now", 3+ = savestate file in szSavestateFilename
char* szSavestateFilename;
WCHAR metadata[MOVIE_MAX_METADATA];
};
static int EnableBackgroundInput = 0;

View File

@ -70,13 +70,18 @@ typedef struct {
int SoundVolume;
int GameGenie;
//Current first and last rendered scanlines.
//the currently selected first and last rendered scanlines.
int FirstSLine;
int LastSLine;
//Driver code(user)-specified first and last rendered scanlines.
//the number of scanlines in the currently selected configuration
int TotalScanlines() { return LastSLine - FirstSLine + 1; }
//Driver-supplied user-selected first and last rendered scanlines.
//Usr*SLine[0] is for NTSC, Usr*SLine[1] is for PAL.
int UsrFirstSLine[2];
int UsrLastSLine[2];
int SnapName;
uint32 SndRate;
int soundq;

View File

@ -753,7 +753,7 @@ static void CommandStateLoad(void)
static void CommandMovieRecord(void)
{
FCEUI_SaveMovie(0, 0, 0);
FCEUI_SaveMovie(0, 0);
}
static void CommandMovieReplay(void)

View File

@ -500,7 +500,7 @@ static void openRecordingMovie(const char* fname)
//begin recording a new movie
void FCEUI_SaveMovie(char *fname, uint8 flags, const char* metadata)
void FCEUI_SaveMovie(char *fname, uint8 flags)
{
assert(fname);