diff --git a/CMakeLists.txt b/CMakeLists.txt index d61f991..e056004 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(CMAKE_CXX_FLAGS ${COMP_FLAGS}) message("-- Building version ${VERSION}") -add_executable(wonderswan main.cpp) +add_executable(wonderswan main.c) set_property(TARGET wonderswan PROPERTY CXX_STANDARD 98) diff --git a/Makefile b/Makefile index 62f72a7..c537899 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ CLEAN_FILES = wonderswan .SUFFIXES: .cpp -main.o: main.cpp +main.o: main.c .c.o: $(CC) -c $(ALLCFLAGS) -o $@ $< diff --git a/main.cpp b/main.c similarity index 100% rename from main.cpp rename to main.c diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1fdb108..e79b043 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,4 +1,4 @@ -set(SOURCES audio.cpp emulate.cpp gpu.cpp io.cpp log.cpp memory.cpp rom.cpp ws.cpp) +set(SOURCES audio.c emulate.c gpu.c io.c log.c memory.c rom.c ws.c) set(HEADERS audio.h emulate.h gpu.h ieeprom.h initialIo.h io.h log.h memory.h rom.h ws.h) add_library(wswan ${SOURCES} ${HEADERS}) diff --git a/source/audio.cpp b/source/audio.c similarity index 99% rename from source/audio.cpp rename to source/audio.c index 739a4c9..15617fc 100644 --- a/source/audio.cpp +++ b/source/audio.c @@ -471,8 +471,8 @@ unsigned int ws_audio_mrand(unsigned int Degree) {0,0,0}, }; - static POLYNOMIAL *pTbl=TblMask; - static int ShiftReg=pTbl->InputBit-1; + static POLYNOMIAL *pTbl = TblMask; + static int ShiftReg = 1; int XorReg=0; int Masked; diff --git a/source/emulate.cpp b/source/emulate.c similarity index 100% rename from source/emulate.cpp rename to source/emulate.c diff --git a/source/gpu.cpp b/source/gpu.c similarity index 100% rename from source/gpu.cpp rename to source/gpu.c diff --git a/source/io.cpp b/source/io.c similarity index 99% rename from source/io.cpp rename to source/io.c index 9191c79..5ce50eb 100644 --- a/source/io.cpp +++ b/source/io.c @@ -28,6 +28,7 @@ #include "gpu.h" #include "audio.h" #include "memory.h" +#include //#define IO_DUMP diff --git a/source/log.cpp b/source/log.c similarity index 100% rename from source/log.cpp rename to source/log.c diff --git a/source/memory.cpp b/source/memory.c similarity index 99% rename from source/memory.cpp rename to source/memory.c index 931a77a..00c413a 100644 --- a/source/memory.cpp +++ b/source/memory.c @@ -28,6 +28,7 @@ #include "gpu.h" #include "audio.h" #include "memory.h" +#include //////////////////////////////////////////////////////////////////////////////// // diff --git a/source/nec/CMakeLists.txt b/source/nec/CMakeLists.txt index 4ff600e..8d1d182 100644 --- a/source/nec/CMakeLists.txt +++ b/source/nec/CMakeLists.txt @@ -1,4 +1,4 @@ -set(SOURCES nec.cpp) +set(SOURCES nec.c) set(HEADERS nec.h necea.h necinstr.h necintrf.h necmodrm.h) add_library(nec_v30 ${SOURCES} ${HEADERS}) \ No newline at end of file diff --git a/source/nec/nec.cpp b/source/nec/nec.c similarity index 100% rename from source/nec/nec.cpp rename to source/nec/nec.c diff --git a/source/rom.cpp b/source/rom.c similarity index 100% rename from source/rom.cpp rename to source/rom.c diff --git a/source/ws.cpp b/source/ws.c similarity index 99% rename from source/ws.cpp rename to source/ws.c index 6a40147..d0c6b1d 100644 --- a/source/ws.cpp +++ b/source/ws.c @@ -425,11 +425,9 @@ int ws_saveState(char *statepath) { uint16_t crc=memory_getRomCrc(); uint32_t value; - char *newPath; + char newPath[1024]; fprintf(log_get(),"saving %s\n",statepath); - newPath=new char[1024]; - if (strlen(statepath)<4) { sprintf(newPath,"%s.wss",statepath); @@ -461,7 +459,6 @@ int ws_saveState(char *statepath) } int fp=open(newPath, O_RDWR|O_CREAT, 0644); - delete newPath; if (fp==-1) {