@@ -121,23 +121,27 @@ static unsigned int pauseTimer = 0;
121
121
122
122
123
123
FCEUGI::FCEUGI ()
124
- : filename(0 ),
125
- archiveFilename(0 )
126
124
{
127
- // printf("%08x",opsize); // WTF?!
128
125
}
129
126
130
127
FCEUGI::~FCEUGI ()
131
128
{
129
+ if (name)
130
+ {
131
+ free (name);
132
+ name = nullptr ;
133
+ }
134
+
132
135
if (filename)
133
136
{
134
137
free (filename);
135
- filename = NULL ;
138
+ filename = nullptr ;
136
139
}
140
+
137
141
if (archiveFilename)
138
142
{
139
143
free (archiveFilename);
140
- archiveFilename = NULL ;
144
+ archiveFilename = nullptr ;
141
145
}
142
146
}
143
147
@@ -194,7 +198,7 @@ static void FCEU_CloseGame(void)
194
198
195
199
if (GameInfo->name ) {
196
200
free (GameInfo->name );
197
- GameInfo->name = NULL ;
201
+ GameInfo->name = nullptr ;
198
202
}
199
203
200
204
if (GameInfo->type != GIT_NSF) {
@@ -224,7 +228,7 @@ static void FCEU_CloseGame(void)
224
228
FCEU_CloseGenie ();
225
229
226
230
delete GameInfo;
227
- GameInfo = NULL ;
231
+ GameInfo = nullptr ;
228
232
229
233
currFrameCounter = 0 ;
230
234
@@ -243,7 +247,7 @@ static void FCEU_CloseGame(void)
243
247
uint64 timestampbase;
244
248
245
249
246
- FCEUGI *GameInfo = NULL ;
250
+ FCEUGI *GameInfo = nullptr ;
247
251
248
252
void (*GameInterface)(GI h);
249
253
void (*GameStateRestore)(int version);
@@ -308,8 +312,8 @@ void FlushGenieRW(void) {
308
312
}
309
313
free (AReadG);
310
314
free (BWriteG);
311
- AReadG = NULL ;
312
- BWriteG = NULL ;
315
+ AReadG = nullptr ;
316
+ BWriteG = nullptr ;
313
317
RWWrap = 0 ;
314
318
}
315
319
}
@@ -375,7 +379,7 @@ static void AllocBuffers() {
375
379
376
380
static void FreeBuffers () {
377
381
FCEU_free (RAM);
378
- RAM = NULL ;
382
+ RAM = nullptr ;
379
383
}
380
384
// ------
381
385
@@ -402,14 +406,14 @@ void ResetGameLoaded(void) {
402
406
if (GameInfo) FCEU_CloseGame ();
403
407
EmulationPaused = 0 ; // mbg 5/8/08 - loading games while paused was bad news. maybe this fixes it
404
408
GameStateRestore = 0 ;
405
- PPU_hook = NULL ;
406
- GameHBIRQHook = NULL ;
407
- FFCEUX_PPURead = NULL ;
408
- FFCEUX_PPUWrite = NULL ;
409
+ PPU_hook = nullptr ;
410
+ GameHBIRQHook = nullptr ;
411
+ FFCEUX_PPURead = nullptr ;
412
+ FFCEUX_PPUWrite = nullptr ;
409
413
if (GameExpSound.Kill )
410
414
GameExpSound.Kill ();
411
415
memset (&GameExpSound, 0 , sizeof (GameExpSound));
412
- MapIRQHook = NULL ;
416
+ MapIRQHook = nullptr ;
413
417
MMC5Hack = 0 ;
414
418
PEC586Hack = 0 ;
415
419
QTAIHack = 0 ;
@@ -474,7 +478,6 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen
474
478
475
479
FCEU_CloseGame ();
476
480
GameInfo = new FCEUGI ();
477
- memset ( (void *)GameInfo, 0 , sizeof (FCEUGI));
478
481
479
482
GameInfo->filename = strdup (fp->filename .c_str ());
480
483
if (fp->archiveFilename != " " )
@@ -1344,7 +1347,7 @@ void UpdateAutosave(void) {
1344
1347
FCEUSS_Save (f, false );
1345
1348
AutoSS = true ; // Flag that an auto-savestate was made
1346
1349
free (f);
1347
- f = NULL ;
1350
+ f = nullptr ;
1348
1351
AutosaveStatus[AutosaveIndex] = 1 ;
1349
1352
}
1350
1353
}
@@ -1358,7 +1361,7 @@ void FCEUI_RewindToLastAutosave(void) {
1358
1361
f = strdup (FCEU_MakeFName (FCEUMKF_AUTOSTATE, AutosaveIndex, 0 ).c_str ());
1359
1362
FCEUSS_Load (f);
1360
1363
free (f);
1361
- f = NULL ;
1364
+ f = nullptr ;
1362
1365
1363
1366
// Set pointer to previous available slot
1364
1367
if (AutosaveStatus[(AutosaveIndex + AutosaveQty - 1 ) % AutosaveQty] == 1 ) {
0 commit comments