@@ -42,18 +42,18 @@ int main(int argc, char **argv)
42
42
setvbuf (stdout, NULL , _IONBF, 0 );
43
43
44
44
scene = new Scene2D (FRAME_WIDTH, FRAME_HEIGHT, FRAME_DEPTH);
45
- auto controller = new Controller ();
46
- auto sceKeyboard = new Keyboard ();
47
45
if (!scene->Init (0xC000000 , 2 ))
48
46
{
49
47
DEBUGLOG << " [ERROR] Can't init scene2D!!" ;
50
48
}
51
-
49
+ auto sceKeyboard = new Keyboard ();
52
50
if (!sceKeyboard->Init (-1 ))
53
51
{
52
+
54
53
DEBUGLOG << " [ERROR] Can't init SceKeyboard!!" ;
55
54
}
56
55
56
+ auto controller = new Controller ();
57
57
if (!controller->Init (-1 ))
58
58
{
59
59
DEBUGLOG << " [ERROR] Can't init the controller!!" ;
@@ -114,7 +114,7 @@ int main(int argc, char **argv)
114
114
115
115
sceVideoOutClose (scene->videoID ());
116
116
free (scene);
117
-
117
+ free (controller);
118
118
quitMain = 1 ;
119
119
}
120
120
listFiles ();
@@ -130,10 +130,10 @@ int main(int argc, char **argv)
130
130
notifi (NULL , " %s" , SDL_GetError ());
131
131
return 1 ;
132
132
}
133
- int32_t speed = 7 ;
134
133
135
134
uint8_t keys[32 ];
136
135
memset (keys, 0 , 32 );
136
+
137
137
while (!quit)
138
138
{
139
139
@@ -223,16 +223,7 @@ int main(int argc, char **argv)
223
223
case ' V' :
224
224
press ? keyboard[0xF ] = 1 : keyboard[0xF ] = 0 ;
225
225
break ;
226
- case ' M' :
227
- case ' m' :
228
- speed--;
229
- notifi (NULL , " Speed: %d" , speed);
230
- break ;
231
- case ' L' :
232
- case ' l' :
233
- speed++;
234
- notifi (NULL , " Speed: %d" , speed);
235
- break ;
226
+
236
227
case ' K' :
237
228
case ' k' :
238
229
initChip8 ();
@@ -241,6 +232,8 @@ int main(int argc, char **argv)
241
232
CleanUp_SDL ();
242
233
return 0 ;
243
234
}
235
+ break ;
236
+
244
237
default :
245
238
break ;
246
239
}
@@ -253,7 +246,6 @@ int main(int argc, char **argv)
253
246
{
254
247
--delay_timer;
255
248
}
256
-
257
249
execute ();
258
250
draw ();
259
251
}
@@ -407,8 +399,7 @@ uint32_t loadRom(char *file)
407
399
// Draw function
408
400
void draw ()
409
401
{
410
- void *pixels;
411
- int pitch;
402
+
412
403
SDL_Rect r;
413
404
int x, y;
414
405
r.x = 0 ;
@@ -432,10 +423,10 @@ void draw()
432
423
SDL_RenderFillRect (renderer, &r);
433
424
}
434
425
}
435
- SDL_RenderPresent (renderer);
436
426
}
437
- drawflag = false ;
427
+ SDL_RenderPresent (renderer) ;
438
428
}
429
+ drawflag = false ;
439
430
}
440
431
441
432
// Emulate cycle
0 commit comments