SameBoy Windows compilation fix that doesn't modify upstream.

This commit is contained in:
byuu 2019-07-25 22:48:13 +09:00
parent ea75d1bc7c
commit 42e5bcc604
4 changed files with 4 additions and 62 deletions

View File

@ -2,9 +2,6 @@
#include <string.h>
#include <stdlib.h>
#include "gb.h"
#ifdef _WIN32
#include "../Windows/getline.h"
#endif
typedef struct {
bool has_bank;

View File

@ -1,4 +1,3 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
@ -12,9 +11,6 @@
#endif
#include "random.h"
#include "gb.h"
#ifdef _WIN32
#include "../Windows/getline.h"
#endif
#ifdef DISABLE_REWIND
#define GB_rewind_free(...)

View File

@ -1,9 +1,10 @@
flags += -DGB_INTERNAL -Wno-multichar
flags += -DGB_INTERNAL -DDISABLE_DEBUGGER -D_GNU_SOURCE -Wno-multichar
options += -I../sameboy
objects += gb-apu gb-camera gb-debugger gb-display gb-gb gb-joypad gb-mbc
objects += gb-apu gb-camera gb-display gb-gb gb-joypad gb-mbc
objects += gb-memory gb-printer gb-random gb-rewind gb-save_state gb-sgb
objects += gb-sm83_cpu gb-sm83_disassembler gb-symbol_hash gb-timing
objects += gb-sm83_cpu gb-symbol_hash gb-timing
#objects+= gb-debugger gb-sm83_disassembler
obj/gb-apu.o: gb/Core/apu.c
obj/gb-camera.o: gb/Core/camera.c

View File

@ -1,52 +0,0 @@
/* This code is public domain -- Will Hartung 4/9/09 */
static inline size_t getline(char **lineptr, size_t *n, FILE *stream) {
char *bufptr = NULL;
char *p = bufptr;
size_t size;
int c;
if (lineptr == NULL) {
return -1;
}
if (stream == NULL) {
return -1;
}
if (n == NULL) {
return -1;
}
bufptr = *lineptr;
size = *n;
c = fgetc(stream);
if (c == EOF) {
return -1;
}
if (bufptr == NULL) {
bufptr = malloc(128);
if (bufptr == NULL) {
return -1;
}
size = 128;
}
p = bufptr;
while (c != EOF) {
if ((p - bufptr) > (size - 1)) {
size = size + 128;
bufptr = realloc(bufptr, size);
if (bufptr == NULL) {
return -1;
}
}
*p++ = c;
if (c == '\n') {
break;
}
c = fgetc(stream);
}
*p++ = '\0';
*lineptr = bufptr;
*n = size;
return p - bufptr - 1;
}