OSDN Git Service

windows support added
authorastoria-d@office <astoria-d@office>
Fri, 26 Feb 2016 02:41:15 +0000 (11:41 +0900)
committerastoria-d@office <astoria-d@office>
Fri, 26 Feb 2016 02:41:15 +0000 (11:41 +0900)
.gitignore [new file with mode: 0644]
Makefile
display/Makefile
display/no-window.c [new file with mode: 0644]
emulator/6502core.c
emulator/Makefile
emulator/joypad/Makefile
emulator/joypad/joypad-no-wnd.c [new file with mode: 0644]
emulator/ppu.c
emulator/ppucore/vscreen.c

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..261d762
--- /dev/null
@@ -0,0 +1,7 @@
+*.bin
+*.nes
+*.o
+*.exe
+vgadisp
+tags
+*.a
index a1c90d4..90e9890 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,7 @@
 
+linux_env := 0
+export linux_env
+
 DIRS=libs emulator display
 
 ROOT_DIR=$(CURDIR)
index 7c0ea70..6be6711 100644 (file)
@@ -3,18 +3,23 @@ BIN=vgadisp
 
 DRIVER=dummy-driver
 
-OBJS=display.o window.o
-        
 DRIVER_OBJS=dummy-driver.o
 
 
 LIBS=-L../libs -lmotones -pthread
 
-INCLUDE=-I../include -I/usr/include/gtk-2.0
+ifeq ($(linux_env),1)
+    INCLUDE=-I../include -I/usr/include/gtk-2.0
+    CFLAGS=-g $(INCLUDE) `pkg-config gtk+-2.0 --cflags` -Wall
+    LFLAGS=-g $(LIBS) `pkg-config gtk+-2.0 gthread-2.0 --libs`
+    OBJS=display.o window.o
+else
+    INCLUDE=-I../include
+    CFLAGS=-g $(INCLUDE) -Wall
+    LFLAGS=-g $(LIBS)
+    OBJS=display.o no-window.o
+endif
 
-CFLAGS=-g $(INCLUDE) `pkg-config gtk+-2.0 --cflags` -Wall
-
-LFLAGS=-g $(LIBS) `pkg-config gtk+-2.0 gthread-2.0 --libs`
 
 all:   $(BIN) $(DRIVER)
 
diff --git a/display/no-window.c b/display/no-window.c
new file mode 100644 (file)
index 0000000..b16d29f
--- /dev/null
@@ -0,0 +1,12 @@
+#define FALSE 0
+#define TRUE 1
+
+int window_start(int argc, char** argv) 
+{
+    return 0;
+}
+
+int window_init(void) {
+    return TRUE;
+}
+
index f9a32ea..a48eba7 100644 (file)
@@ -1,6 +1,8 @@
 #include <stdio.h>
 #include <string.h>
+#ifndef __CYGWIN__
 #include <libio.h>
+#endif
 #include "tools.h"
 #include "6502core.h"
 
index b44f501..23d2108 100644 (file)
@@ -15,8 +15,14 @@ LIBS=-L../libs -lmotones -lpthread -lrt \
 
 INCLUDE=-I../include -Ippucore
 
-CFLAGS=-g $(INCLUDE) -Wall
-LFLAGS=$(LIBS) `pkg-config gtk+-2.0 gthread-2.0 --libs`
+CFLAGS=-g $(INCLUDE) -Wall -DUSE_GUI=$(linux_env)
+
+ifeq ($(linux_env),1)
+    LFLAGS=$(LIBS) `pkg-config gtk+-2.0 gthread-2.0 --libs`
+else
+    LFLAGS=$(LIBS)
+endif
+
 
 all:   $(BIN)
 
index b4700d1..9c44ae3 100644 (file)
@@ -2,8 +2,6 @@
 BIN=libjoypad.a
 TEST_BIN=jp-driver
 
-OBJS=joypad-wnd.o
-
 DUMMY_OBJS=jp-driver.o
         
 LIBS=-L../../libs -L./ -ljoypad -lmotones -pthread
@@ -11,9 +9,15 @@ LIBS=-L../../libs -L./ -ljoypad -lmotones -pthread
 
 INCLUDE=-I../../include -I../
 
-CFLAGS=-g $(INCLUDE) -Wall `pkg-config gtk+-2.0 --cflags`
-
-LFLAGS=-g $(LIBS) `pkg-config gtk+-2.0 gthread-2.0 --libs`
+ifeq ($(linux_env),1)
+    CFLAGS=-g $(INCLUDE) -Wall `pkg-config gtk+-2.0 --cflags`
+    LFLAGS=-g $(LIBS) `pkg-config gtk+-2.0 gthread-2.0 --libs`
+    OBJS=joypad-wnd.o
+else
+    CFLAGS=-g $(INCLUDE) -Wall
+    LFLAGS=-g $(LIBS)
+    OBJS=joypad-no-wnd.o
+endif
 
 all:   $(BIN)
 test:  $(TEST_BIN)
diff --git a/emulator/joypad/joypad-no-wnd.c b/emulator/joypad/joypad-no-wnd.c
new file mode 100644 (file)
index 0000000..4361ad8
--- /dev/null
@@ -0,0 +1,21 @@
+#define FALSE 0
+#define TRUE 1
+#define NULL (void*) 0
+
+int get_button(unsigned int code) {
+    return FALSE;
+}
+
+void close_joypad_wnd(void) {
+}
+
+void* window_start(void* arg)
+{
+    return NULL;
+}
+
+int init_joypad_wnd(void) {
+    //init thread
+    return TRUE;
+}
+
index 6bc4e30..f58dcf5 100644 (file)
@@ -130,12 +130,21 @@ int init_ppu(void) {
     ppu_addr = 0;
     ppu_data = 0;
 
+#if USE_GUI
     /* get vga shared memory */
     if((vga_shared_buf = (unsigned char*)vga_shm_get()) == NULL)
     {
         fprintf(stderr, "error attaching shared memory.\n");
         return FALSE;
     }
+#else
+    /* get vga shared memory */
+    if((vga_shared_buf = (unsigned char*)malloc(VGA_SHM_SIZE)) == NULL)
+    {
+        fprintf(stderr, "error allocating dummy shared memory.\n");
+        return FALSE;
+    }
+#endif
 
     memset(vga_shared_buf, 0, VGA_SHM_SIZE);
     set_vga_base((unsigned char*)vga_shared_buf);
index 7f78d25..706f3cf 100644 (file)
@@ -1,7 +1,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifndef __CYGWIN__
 #include "libio.h"
+#endif
 #include "tools.h"
 #include "vga.h"
 #include "ppucore.h"