summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-05-28 22:31:21 -0700
committerMichael Pavone <pavone@retrodev.com>2015-05-28 22:31:21 -0700
commit93a29403d334c8dd1253221fd4588209a706f500 (patch)
treee4c35e0a443746a3f509ea6b162a40a08e4f8897
parentef033e39c170fe272a956b1417f217a0d3cce29c (diff)
Get windows build compiling again post-merge
-rw-r--r--Makefile8
-rw-r--r--debug.c8
-rw-r--r--io.c15
-rw-r--r--render_sdl.c1
4 files changed, 26 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index b3e966b..fc6a29a 100644
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,8 @@ MEM:=mem_win.o
BLASTEM:=blastem.exe
CC:=wine gcc.exe
-CFLAGS:=-O2 -std=gnu99 -Wreturn-type -Werror=return-type -Werror=
-LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDLmain -lSDL -mwindows
+CFLAGS:=-g -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -I"C:/MinGW/usr/include/SDL2" -DGLEW_STATIC
+LDFLAGS:= -L"C:/MinGW/usr/lib" -lm -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lglu32 -mwindows
CPU:=i686
else
@@ -63,7 +63,7 @@ ifeq ($(OS),Darwin)
LDFLAGS+= -framework OpenGL
endif
-TRANSOBJS=gen.o backend.o mem.o
+TRANSOBJS=gen.o backend.o $(MEM)
M68KOBJS=68kinst.o m68k_core.o
ifeq ($(CPU),x86_64)
M68KOBJS+= m68k_core_x86.o
@@ -97,7 +97,7 @@ else
MAINOBJS+= $(Z80OBJS)
endif
-ifdef WINDOWS
+ifeq ($(OS),Windows)
MAINOBJS+= glew32s.lib
endif
diff --git a/debug.c b/debug.c
index ac5c34d..6ff8917 100644
--- a/debug.c
+++ b/debug.c
@@ -3,7 +3,9 @@
#include "68kinst.h"
#include <stdlib.h>
#include <string.h>
+#ifndef _WIN32
#include <sys/select.h>
+#endif
#include "render.h"
static bp_def * breakpoints = NULL;
@@ -510,16 +512,21 @@ m68k_context * debugger(m68k_context * context, uint32_t address)
printf("%X: %s\n", address, input_buf);
uint32_t after = address + (after_pc-pc)*2;
int debugging = 1;
+#ifdef _WIN32
+#define prompt 1
+#else
int prompt = 1;
fd_set read_fds;
FD_ZERO(&read_fds);
struct timeval timeout;
+#endif
while (debugging) {
if (prompt) {
fputs(">", stdout);
fflush(stdout);
}
process_events();
+#ifndef _WIN32
timeout.tv_sec = 0;
timeout.tv_usec = 16667;
FD_SET(fileno(stdin), &read_fds);
@@ -529,6 +536,7 @@ m68k_context * debugger(m68k_context * context, uint32_t address)
} else {
prompt = 1;
}
+#endif
if (!fgets(input_buf, sizeof(input_buf), stdin)) {
fputs("fgets failed", stderr);
break;
diff --git a/io.c b/io.c
index d50133d..d6d55c7 100644
--- a/io.c
+++ b/io.c
@@ -3,6 +3,7 @@
This file is part of BlastEm.
BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
*/
+#ifndef _WIN32
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
@@ -10,7 +11,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
+#endif
#include <string.h>
+#include <stdlib.h>
#include "io.h"
#include "blastem.h"
@@ -544,7 +547,7 @@ void setup_io_devices(tern_node * config, io_port * ports)
for (int i = 0; i < 3; i++)
{
-
+#ifndef _WIN32
if (ports[i].device_type == IO_SEGA_PARALLEL)
{
char *pipe_name = tern_find_ptr(config, "ioparallel_pipe");
@@ -606,7 +609,9 @@ cleanup_sock:
close(ports[i].device.stream.listen_fd);
ports[i].device_type = IO_NONE;
}
- } else if (ports[i].device_type == IO_GAMEPAD3 || ports[i].device_type == IO_GAMEPAD6) {
+ } else
+#endif
+ if (ports[i].device_type == IO_GAMEPAD3 || ports[i].device_type == IO_GAMEPAD6) {
printf("IO port %s connected to gamepad #%d with type '%s'\n", io_name(i), ports[i].device.pad.gamepad_num + 1, device_type_names[ports[i].device_type]);
} else {
printf("IO port %s connected to device '%s'\n", io_name(i), device_type_names[ports[i].device_type]);
@@ -770,6 +775,7 @@ void io_adjust_cycles(io_port * port, uint32_t current_cycle, uint32_t deduction
}
}
+#ifndef _WIN32
static void wait_for_connection(io_port * port)
{
if (port->device.stream.data_fd == -1)
@@ -869,6 +875,7 @@ static void service_socket(io_port *port)
}
}
}
+#endif
void io_data_write(io_port * port, uint8_t value, uint32_t current_cycle)
{
@@ -889,12 +896,14 @@ void io_data_write(io_port * port, uint8_t value, uint32_t current_cycle)
}
port->output = value;
break;
+#ifndef _WIN32
case IO_GENERIC:
wait_for_connection(port);
port->input[IO_STATE] = IO_WRITE_PENDING;
port->output = value;
service_socket(port);
break;
+#endif
default:
port->output = value;
}
@@ -938,6 +947,7 @@ uint8_t io_data_read(io_port * port, uint32_t current_cycle)
}
break;
}
+#ifndef _WIN32
case IO_SEGA_PARALLEL:
if (!th)
{
@@ -954,6 +964,7 @@ uint8_t io_data_read(io_port * port, uint32_t current_cycle)
service_socket(port);
input = ~port->input[IO_TH0];
break;
+#endif
default:
input = 0;
break;
diff --git a/render_sdl.c b/render_sdl.c
index 53a0e2f..38b7ed4 100644
--- a/render_sdl.c
+++ b/render_sdl.c
@@ -5,6 +5,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <math.h>
#include "render.h"
#include "blastem.h"