Skip to content

Commit

Permalink
Removed getopt(). MinGW has it already.
Browse files Browse the repository at this point in the history
  • Loading branch information
wernsey committed Jan 6, 2016
1 parent 0228fb3 commit a1f6a8b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 71 deletions.
12 changes: 6 additions & 6 deletions Makefile
Expand Up @@ -20,13 +20,13 @@ all: c8asm.exe c8dasm.exe chip8.exe docs
debug:
make BUILD=debug

c8asm.exe: asmmain.o c8asm.o chip8.o getopt.o
c8asm.exe: asmmain.o c8asm.o chip8.o
$(CC) $(LDFLAGS) -o $@ $^

c8dasm.exe: dasmmain.o c8dasm.o chip8.o getopt.o
c8dasm.exe: dasmmain.o c8dasm.o chip8.o
$(CC) $(LDFLAGS) -o $@ $^

chip8.exe: gdi.o render.o chip8.o bmp.o getopt.o
chip8.exe: gdi.o render.o chip8.o bmp.o
$(CC) $(LDFLAGS) -o $@ $^ -mwindows

.c.o:
Expand All @@ -36,9 +36,9 @@ c8asm.o: c8asm.c chip8.h
c8dasm.o: c8dasm.c chip8.h
chip8.o: chip8.c chip8.h
bmp.o: bmp.c bmp.h
asmmain.o: asmmain.c chip8.h getopt.h
dasmmain.o: dasmmain.c chip8.h getopt.h
render.o: render.c chip8.h gdi.h bmp.h getopt.h
asmmain.o: asmmain.c chip8.h
dasmmain.o: dasmmain.c chip8.h
render.o: render.c chip8.h gdi.h bmp.h
gdi.o: gdi.c gdi.h bmp.h

docs: chip8.html
Expand Down
3 changes: 1 addition & 2 deletions asmmain.c
Expand Up @@ -2,8 +2,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

#include "getopt.h"
#include <unistd.h>

#include "chip8.h"

Expand Down
2 changes: 1 addition & 1 deletion dasmmain.c
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>

#include "chip8.h"
#include "getopt.h"

static void usage(const char *name) {
printf("usage: %s [options] infile.bin\n", name);
Expand Down
57 changes: 0 additions & 57 deletions getopt.c

This file was deleted.

3 changes: 0 additions & 3 deletions getopt.h

This file was deleted.

13 changes: 11 additions & 2 deletions render.c
Expand Up @@ -2,13 +2,13 @@
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <unistd.h>

#include <windows.h>

#include "chip8.h"
#include "bmp.h"
#include "gdi.h"
#include "getopt.h"

static Bitmap *background;

Expand Down Expand Up @@ -39,11 +39,14 @@ static void usage() {
void init_game(int argc, char *argv[]) {

const char *infile = NULL;

c8_puts = gdi_puts;

logfile = fopen("gdi.log", "w");
c8_verbose++;

c8_message("Initializing...\n");

srand(time(NULL));

c8_reset();
Expand All @@ -62,11 +65,14 @@ void init_game(int argc, char *argv[]) {
}
}
if(optind >= argc) {
exit_error("You need to specify a CHIP-8 file");
c8_message("No input file specified.\n");
exit_error("You need to specify a CHIP-8 file.");
}
infile = argv[optind++];

c8_message("Loading %s...\n", infile);
if(!c8_load_file(infile)) {
c8_message("Unable to load '%s': %s\n", infile, strerror(errno));
exit_error("Unable to load '%s': %s\n", infile, strerror(errno));
}

Expand All @@ -88,9 +94,12 @@ void init_game(int argc, char *argv[]) {
}
bm_blit(screen, 0, 0, background, 0, 0, 128, 64);
draw_screen();

c8_message("Initialized.\n");
}

void deinit_game() {
c8_message("Done.\n");
fclose(logfile);
}

Expand Down

0 comments on commit a1f6a8b

Please sign in to comment.