MCPcopy Create free account
hub / github.com/TASEmulators/fceux / UpdateReplayDialog

Function UpdateReplayDialog

src/drivers/win/replay.cpp:143–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143void UpdateReplayDialog(HWND hwndDlg)
144{
145 int doClear=1;
146 char *fn=GetReplayPath(hwndDlg);
147
148 // remember the previous setting for the read-only checkbox
149 replayReadOnlySetting = (SendDlgItemMessage(hwndDlg, IDC_CHECK_READONLY, BM_GETCHECK, 0, 0) == BST_CHECKED);
150
151 EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_METADATA),FALSE);
152
153 if(fn)
154 {
155 MOVIE_INFO info;
156
157 FCEUFILE *fp = FCEU_fopen(fn,0,"rb",0);
158 EMUFILE *tmp = fp->stream->memwrap();
159 if (tmp != fp->stream)
160 delete fp->stream;
161 fp->stream = tmp;
162 bool isarchive = FCEU_isFileInArchive(fn);
163 bool ismovie = FCEUI_MovieGetInfo(fp, info, false);
164 delete fp;
165 if(ismovie)
166 {
167 char tmp[256];
168 double div;
169
170 sprintf(tmp, "%u", (unsigned)info.num_frames);
171 SetWindowTextA(GetDlgItem(hwndDlg,IDC_LABEL_FRAMES), tmp); // frames
172 SetDlgItemText(hwndDlg,IDC_EDIT_STOPFRAME,tmp);
173 stopframeWasEditedByUser = false;
174
175 EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),TRUE);
176
177 div = (FCEUI_GetCurrentVidSystem(0,0)) ? 50.006977968268290849 : 60.098813897440515532; // PAL timing
178 double tempCount = (info.num_frames / div) + 0.005; // +0.005s for rounding
179 int num_seconds = (int)tempCount;
180 int fraction = (int)((tempCount - num_seconds) * 100);
181 int seconds = num_seconds % 60;
182 int minutes = (num_seconds / 60) % 60;
183 int hours = (num_seconds / 60 / 60) % 60;
184 sprintf(tmp, "%02d:%02d:%02d.%02d", hours, minutes, seconds, fraction);
185 SetWindowTextA(GetDlgItem(hwndDlg,IDC_LABEL_LENGTH), tmp); // length
186
187 sprintf(tmp, "%u", (unsigned)info.rerecord_count);
188 SetWindowTextA(GetDlgItem(hwndDlg,IDC_LABEL_UNDOCOUNT), tmp); // rerecord
189
190 SendDlgItemMessage(hwndDlg,IDC_CHECK_READONLY,BM_SETCHECK,(replayReadOnlySetting ? BST_CHECKED : BST_UNCHECKED), 0);
191
192 SetWindowText(GetDlgItem(hwndDlg,IDC_LABEL_RECORDEDFROM),info.poweron ? "Power-On" : (info.reset?"Soft-Reset":"Savestate"));
193
194 if(isarchive) {
195 EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),FALSE);
196 Button_SetCheck(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),BST_CHECKED);
197 } else
198 EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),TRUE);
199
200 //-----------

Callers 1

ReplayDialogProcFunction · 0.85

Calls 7

GetReplayPathFunction · 0.85
FCEU_fopenFunction · 0.85
FCEU_isFileInArchiveFunction · 0.85
FCEUI_MovieGetInfoFunction · 0.85
memwrapMethod · 0.80
md5_asciistrFunction · 0.50

Tested by

no test coverage detected