Use newer library version
This commit is contained in:
parent
e320dc59f4
commit
de92335134
23
main.c
23
main.c
|
@ -339,10 +339,12 @@ int readROM(VB *sim, char *filename) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
sim->cart.rom = malloc(size);
|
||||
sim->cart.romMask = size - 1;
|
||||
|
||||
fread(sim->cart.rom, 1, size, file);
|
||||
uint8_t *rom = malloc(size);
|
||||
if (!rom) {
|
||||
perror("could not allocate ROM");
|
||||
return 1;
|
||||
}
|
||||
fread(rom, 1, size, file);
|
||||
if (ferror(file)) {
|
||||
perror("could not read file");
|
||||
return 1;
|
||||
|
@ -351,6 +353,7 @@ int readROM(VB *sim, char *filename) {
|
|||
perror("could not close file");
|
||||
return 1;
|
||||
}
|
||||
vbSetCartROM(sim, rom, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -360,11 +363,15 @@ int main(int argc, char** argv) {
|
|||
fprintf(stderr, "Please pass a ROM file\n");
|
||||
return 1;
|
||||
}
|
||||
VB sim;
|
||||
if (readROM(&sim, argv[1])) {
|
||||
VB *sim = malloc(vbSizeOf());
|
||||
if (!sim) {
|
||||
return 1;
|
||||
}
|
||||
vbSetProgramCounter(&sim, 0x07000000);
|
||||
vbInit(sim);
|
||||
if (readROM(sim, argv[1])) {
|
||||
return 1;
|
||||
}
|
||||
vbSetProgramCounter(sim, 0x07000000);
|
||||
|
||||
short port;
|
||||
if (argc > 2) {
|
||||
|
@ -409,7 +416,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
printf("connected\n");
|
||||
|
||||
int response = server(connfd, &sim);
|
||||
int response = server(connfd, sim);
|
||||
return close(connfd)
|
||||
|| close(fd)
|
||||
|| response;
|
||||
|
|
5
makefile
5
makefile
|
@ -1,6 +1,9 @@
|
|||
build:
|
||||
@mkdir -p build
|
||||
@gcc main.c client.c ../vbtest/vb.c -I include -I ../vbtest -Werror -Wall -Wextra -o ./build/rdb
|
||||
@gcc main.c client.c ../vbtest/vb.c -I include -I ../vbtest \
|
||||
-Werror -Wall -Wextra -Wpedantic \
|
||||
-Wno-unused-parameter -Wno-unused-function \
|
||||
-o ./build/rdb
|
||||
clean:
|
||||
@rm -rf build
|
||||
.PHONY: build clean
|
Loading…
Reference in New Issue