refactor(cpu): fix build warnings and clean up unused headers
This commit is contained in:
+5
-2
@@ -35,7 +35,9 @@ void chip8_init(chip_eight_t *chip) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int chip8_load_rom(chip_eight_t *chip, const char *file_path) {
|
int chip8_load_rom(chip_eight_t *chip, const char *file_path) {
|
||||||
FILE *file_ptr = fopen(file_path, "rb");
|
FILE *file_ptr;
|
||||||
|
|
||||||
|
fopen_s(&file_ptr, file_path, "rb");
|
||||||
|
|
||||||
if (file_ptr == NULL) {
|
if (file_ptr == NULL) {
|
||||||
return FILE_MISSING;
|
return FILE_MISSING;
|
||||||
@@ -186,10 +188,11 @@ void chip8_step(chip_eight_t *chip) {
|
|||||||
case OPCODE_GROUP_JP_V0_ADDR:
|
case OPCODE_GROUP_JP_V0_ADDR:
|
||||||
chip->pc = nnn + chip->V[0];
|
chip->pc = nnn + chip->V[0];
|
||||||
break;
|
break;
|
||||||
case OPCODE_GROUP_RND_VX_BYTE:
|
case OPCODE_GROUP_RND_VX_BYTE: {
|
||||||
uint8_t num = rand() % 256;
|
uint8_t num = rand() % 256;
|
||||||
chip->V[x] = kk & num;
|
chip->V[x] = kk & num;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case OPCODE_GROUP_DRW_VX_VY_N:
|
case OPCODE_GROUP_DRW_VX_VY_N:
|
||||||
draw_sprite(chip, n, x, y);
|
draw_sprite(chip, n, x, y);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include "chip8.h"
|
#include "chip8.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user