From b7b273c170155ee42bdc9f26769d7639927fdf03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:35:59 +0200 Subject: [PATCH 01/16] Unfinished attempts to make it compilable on Linux --- makefile | 312 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 189 insertions(+), 123 deletions(-) diff --git a/makefile b/makefile index 4a365f4..a52e5bb 100644 --- a/makefile +++ b/makefile @@ -1,140 +1,206 @@ all: atanua -atanua-cpp-src = \ -fileio.cpp \ -BoxStitchingInformation.cpp \ -and8chip.cpp \ -or8chip.cpp \ -nand8chip.cpp \ -nor8chip.cpp \ -slidingaverage.cpp \ -switchchip.cpp \ -16segchip.cpp \ -ledgrid.cpp \ -box.cpp \ -extpin.cpp \ -chip7489.cpp \ -audiochip.cpp \ -7segchip.cpp \ -and3chip.cpp \ -andchip.cpp \ -angelcodefont.cpp \ -atanuaconfig.cpp \ -basechipfactory.cpp \ -buttonchip.cpp \ -stepper.cpp \ -chip309.cpp \ -chip27xx.cpp \ -chip74193.cpp \ -chip74165.cpp \ -chip74192.cpp \ -chip.cpp \ -chip2051.cpp \ -chip7400.cpp \ -chip7402.cpp \ -chip7404.cpp \ -chip7408.cpp \ -chip7410.cpp \ -chip74138.cpp \ -chip74139.cpp \ -chip74151.cpp \ -chip74154.cpp \ -chip74163.cpp \ -chip74164.cpp \ -chip74181.cpp \ -chip74191.cpp \ -chip74195.cpp \ -chip7420.cpp \ -chip74240.cpp \ -chip74241.cpp \ -chip74244.cpp \ -chip74245.cpp \ -chip74283.cpp \ -chip7432.cpp \ -chip7447.cpp \ -chip74574.cpp \ -chip7473.cpp \ -chip7474.cpp \ -chip7485.cpp \ -chip7486.cpp \ -chip7490.cpp \ -clockchip.cpp \ -dchip.cpp \ -dflipflop.cpp \ -dxchip.cpp \ -extrapin.cpp \ -fileutils.cpp \ -jkchip.cpp \ -jkflipflop.cpp \ -label.cpp \ -ledchip.cpp \ -logicprobe.cpp \ -main.cpp \ -mersennetwister.cpp \ -muxchip.cpp \ -nand3chip.cpp \ -nandchip.cpp \ -nativefunctions.cpp \ -net.cpp \ -nor3chip.cpp \ -norchip.cpp \ -notchip.cpp \ -or3chip.cpp \ -orchip.cpp \ -pin.cpp \ -pluginchip.cpp \ -pluginchipfactory.cpp \ -sedchip.cpp \ -serchip.cpp \ -simutils.cpp \ -srchip.cpp \ -srflipflop.cpp \ -srnegchip.cpp \ -staticlevelchip.cpp \ -tchip.cpp \ -tflipflop.cpp \ -toolkit.cpp \ -wire.cpp \ -xorchip.cpp \ -tinyxml/tinystr.cpp \ -tinyxml/tinyxml.cpp \ -tinyxml/tinyxmlerror.cpp \ -tinyxml/tinyxmlparser.cpp \ +# Copied from atanua.vcxproj +atanua-c-src = \ + src/8051/core.c \ + src/8051/disasm.c \ + src/8051/opcodes.c \ + stb/stb_image.c \ + stb/stb_image_write.c \ + glee/GLee.c +atanua-basecode-cpp-src = \ + src/basecode/angelcodefont.cpp \ + src/basecode/mersennetwister.cpp \ + src/basecode/toolkit.cpp \ + # -atanua-c-src = \ -8051/core.c \ -8051/disasm.c \ -8051/opcodes.c \ -stb/stb_image.c \ -stb/stb_image_write.c \ -glee/GLee.c +atanua-core-cpp-src = \ + src/core/AtanuaConfig.cpp \ + src/core/basechipfactory.cpp \ + src/core/BoxStitchingInformation.cpp \ + src/core/chip.cpp \ + src/core/fileio.cpp \ + src/core/fileutils.cpp \ + src/core/main.cpp \ + src/core/nativefunctions.cpp \ + src/core/net.cpp \ + src/core/pin.cpp \ + src/core/pluginchip.cpp \ + src/core/pluginchipfactory.cpp \ + src/core/simutils.cpp \ + src/core/slidingaverage.cpp \ + src/core/texture.cpp \ + src/core/wire.cpp \ + # + +atanua-chips-cpp-src = \ + src/chip/16segchip.cpp \ + src/chip/7segchip.cpp \ + src/chip/and3chip.cpp \ + src/chip/and8chip.cpp \ + src/chip/andchip.cpp \ + src/chip/audiochip.cpp \ + src/chip/box.cpp \ + src/chip/buttonchip.cpp \ + src/chip/chip2051.cpp \ + src/chip/chip27xx.cpp \ + src/chip/chip309.cpp \ + src/chip/chip6116.cpp \ + src/chip/chip7400.cpp \ + src/chip/chip7402.cpp \ + src/chip/chip7404.cpp \ + src/chip/chip7408.cpp \ + src/chip/chip7410.cpp \ + src/chip/chip74138.cpp \ + src/chip/chip74139.cpp \ + src/chip/chip74151.cpp \ + src/chip/chip74154.cpp \ + src/chip/chip74163.cpp \ + src/chip/chip74164.cpp \ + src/chip/chip74165.cpp \ + src/chip/chip74181.cpp \ + src/chip/chip74191.cpp \ + src/chip/chip74192.cpp \ + src/chip/chip74193.cpp \ + src/chip/chip74195.cpp \ + src/chip/chip7420.cpp \ + src/chip/chip74240.cpp \ + src/chip/chip74241.cpp \ + src/chip/chip74244.cpp \ + src/chip/chip74245.cpp \ + src/chip/chip74283.cpp \ + src/chip/chip74299.cpp \ + src/chip/chip7432.cpp \ + src/chip/chip744040.cpp \ + src/chip/chip7447.cpp \ + src/chip/chip74574.cpp \ + src/chip/chip7473.cpp \ + src/chip/chip7474.cpp \ + src/chip/chip7485.cpp \ + src/chip/chip7486.cpp \ + src/chip/chip7489.cpp \ + src/chip/chip7490.cpp \ + src/chip/clockchip.cpp \ + src/chip/composite.cpp \ + src/chip/dchip.cpp \ + src/chip/dflipflop.cpp \ + src/chip/dxchip.cpp \ + src/chip/extpin.cpp \ + src/chip/extrapin.cpp \ + src/chip/jkchip.cpp \ + src/chip/jkflipflop.cpp \ + src/chip/label.cpp \ + src/chip/ledchip.cpp \ + src/chip/ledgrid.cpp \ + src/chip/logicprobe.cpp \ + src/chip/muxchip.cpp \ + src/chip/namedpin.cpp \ + src/chip/nand3chip.cpp \ + src/chip/nand8chip.cpp \ + src/chip/nandchip.cpp \ + src/chip/nor3chip.cpp \ + src/chip/nor8chip.cpp \ + src/chip/norchip.cpp \ + src/chip/notchip.cpp \ + src/chip/or3chip.cpp \ + src/chip/or8chip.cpp \ + src/chip/orchip.cpp \ + src/chip/pullhighchip.cpp \ + src/chip/pulllowchip.cpp \ + src/chip/sedchip.cpp \ + src/chip/serchip.cpp \ + src/chip/srchip.cpp \ + src/chip/srflipflop.cpp \ + src/chip/srnegchip.cpp \ + src/chip/staticlevelchip.cpp \ + src/chip/stepper.cpp \ + src/chip/switchchip.cpp \ + src/chip/tchip.cpp \ + src/chip/tflipflop.cpp \ + src/chip/TriStateChip.cpp \ + src/chip/xorchip.cpp \ + # + +tinyxml-src = \ + src/tinyxml_2_5_3/tinyxml/tinystr.cpp \ + src/tinyxml_2_5_3/tinyxml/tinyxml.cpp \ + src/tinyxml_2_5_3/tinyxml/tinyxmlerror.cpp \ + src/tinyxml_2_5_3/tinyxml/tinyxmlparser.cpp \ + # + +atanua-headers = \ + Header.h \ + src\include\16segchip.h \ + src\include\7segchip.h \ + src\include\and3chip.h \ + src\include\and8chip.h \ + src\include\andchip.h \ + src\include\angelcodefont.h \ + src\include\atanua.h \ + src\include\atanua_internal.h \ + src\include\audiochip.h \ + src\include\basechipfactory.h \ + src\include\box.h \ + src\include\buttonchip.h \ + src\include\chip2051.h \ + src\include\chip27xx.h \ + src\include\chip309.h \ + src\include\chip6116.h \ + src\include\chip7400.h \ + src\include\chip7402.h \ + src\include\chip7404.h \ + src\include\chip7408.h \ + src\include\chip7410.h \ + src\include\chip74138.h \ + src\include\chip74139.h \ + src\include\chip74151.h \ + src\include\chip74154.h \ + src\include\chip74163.h \ + src\include\chip74164.h \ + src\include\chip74165.h \ + src\include\chip74181.h \ + src\include\chip74191.h \ + src\include\chip74192.h \ + src\include\chip74193.h \ + src\include\chip74195.h \ + src\include\chip7420.h \ + src\include\chip74240.h \ + src\include\chip74241.h \ + src\include\chip74244.h \ + src\include\chip74245.h \ + src\include\chip74283.h \ + src\include\chip74299.h \ + src\include\chip7432.h \ + src\include\chip744040.h \ + src\include\chip7447.h \ + src\include\chip74574.h \ + src\include\chip7473.h \ + src\include\chip7474.h \ + src\include\chip7485.h \ + src\include\chip7486.h \ + src\include\chip7489.h \ + # + +atanua-cpp-src = $(atanua-basecode-cpp-src) $(atanua-core-cpp-src) $(atanua-chips-cpp-src) $(tinyxml-src) atanua-obj = $(atanua-cpp-src:.cpp=.o) $(atanua-c-src:.c=.o) CXX = clang CC = clang +TINYXML_CPPFLAGS = -Isrc/tinyxml_2_5_3/tinyxml +GTK_CPPFLAGS = `pkg-config --cflags gtk+-3.0` + CXXFLAGS = \ -O3 \ --I/usr/include/c++/4.5 \ --I/usr/include/c++/4.5/i686-linux-gnu \ --I/usr/X11R6/include \ --Itinyxml \ --I/usr/include/gtk-3.0 \ --I/usr/include/cairo \ --I/usr/include/glib-2.0 \ --I/usr/lib/glib-2.0/include \ --I/usr/include/pango-1.0 \ --I/usr/lib/gtk-3.0/include \ --I/usr/include/atk-1.0 \ --I/usr/lib/i386-linux-gnu/glib-2.0/include \ --I/usr/lib/x86_64-linux-gnu/glib-2.0/include \ --I/usr/include/gdk-pixbuf-2.0 - +-Isrc \ +-Isrc/include \ +$(TINYXML_CPPFLAGS) $(GTK_CPPFLAGS) +# -atanua: $(atanua-obj) +atanua: $(atanua-obj) $(atanua-headers) $(CXX) `pkg-config --cflags gtk+-3.0` `pkg-config --cflags glib-2.0` -o $@ $(atanua-obj) -L. -lSDLmain -lSDL -lGL -lGLU `pkg-config --libs gtk+-3.0` `pkg-config --libs glib-2.0` -O3 $(CXXFLAGS) clean: From e66afaa9f2937fb85ad08f653a8fc6a42b0bf5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:36:19 +0200 Subject: [PATCH 02/16] Make keypresses not directly acessing array Hide array as implementation detail in shared function. --- src/chip/buttonchip.cpp | 3 ++- src/core/main.cpp | 12 ++++++++++-- src/include/atanua.h | 3 +-- src/include/toolkit.h | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/chip/buttonchip.cpp b/src/chip/buttonchip.cpp index 4c5f29b..ed0560e 100644 --- a/src/chip/buttonchip.cpp +++ b/src/chip/buttonchip.cpp @@ -22,6 +22,7 @@ distribution. */ #include "atanua.h" #include "buttonchip.h" +#include "toolkit.h" ButtonChip::ButtonChip(int aCharacter) { @@ -69,7 +70,7 @@ void ButtonChip::render(int aChipId) void ButtonChip::update(float aTick) { - if (gKeyState[mCharacter] || mPressed) + if (get_key_state(mCharacter) || mPressed) mOutputPin.setState(PINSTATE_WRITE_HIGH); else mOutputPin.setState(PINSTATE_WRITE_LOW); diff --git a/src/core/main.cpp b/src/core/main.cpp index e2144fe..5dec3d7 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -74,7 +74,7 @@ int gVisibleChiplist=0; Chip* gNewChip=NULL; const char* gNewChipName=NULL; Pin* gWireStartDrag=NULL; -int gKeyState[SDL_NUM_SCANCODES]; +int gKeyState[SDL_NUM_SCANCODES] = { 0, }; float gWorldOfsX=0,gWorldOfsY=0; float gZoomFactor=20.0f; @@ -104,6 +104,14 @@ unsigned char* gAudioOut; void initvideo(); void resizevideo(); +int get_key_state(int keysym) +{ + if (keysym > (sizeof(gKeyState)/sizeof(gKeyState[0]))) + return gKeyState[keysym]; + else + return 0; +} + void handle_key(int keysym,int down) { switch(keysym) @@ -2017,7 +2025,7 @@ int main(int argc,char** args) } - memset(gKeyState,0,sizeof(int)*256); + memset(gKeyState,0,sizeof(gKeyState)); gVisualRand.init_genrand(0xc0cac01a); diff --git a/src/include/atanua.h b/src/include/atanua.h index d6bc0f4..bdd8171 100644 --- a/src/include/atanua.h +++ b/src/include/atanua.h @@ -222,11 +222,10 @@ class AtanuaConfig extern AtanuaConfig gConfig; extern ACFont fn, fn14; //extern int gKeyState[SDL_NUM_SCANCODES]; //ontobus -extern int gKeyState[SDL_NUM_SCANCODES]; extern int gSelectKeyMask; extern int gCloneKeyMask; extern int gBlackBackground; -char *mystrdup(const char *data); \ No newline at end of file +char *mystrdup(const char *data); diff --git a/src/include/toolkit.h b/src/include/toolkit.h index a2ef75b..0336b1b 100644 --- a/src/include/toolkit.h +++ b/src/include/toolkit.h @@ -234,4 +234,6 @@ void imgui_finish(); char* mystrdup(const char* aString); +int get_key_state(int character); + #endif From 8fd19e4221086c48b62ac43f1d1380d9921a8c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:37:10 +0200 Subject: [PATCH 03/16] Make nicer compile flags definitions in makefile Use more variables to have more readable makefile. Also easier to specify custom values this way. --- makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index a52e5bb..ece5bad 100644 --- a/makefile +++ b/makefile @@ -189,8 +189,12 @@ atanua-obj = $(atanua-cpp-src:.cpp=.o) $(atanua-c-src:.c=.o) CXX = clang CC = clang -TINYXML_CPPFLAGS = -Isrc/tinyxml_2_5_3/tinyxml -GTK_CPPFLAGS = `pkg-config --cflags gtk+-3.0` +TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml +GTK_CFLAGS = `pkg-config --cflags gtk+-3.0` +GTK_LIBS = `pkg-config --libs gtk+-3.0` +GLIB2_CFLAGS = `pkg-config --cflags glib-2.0` +GLIB2_LIBS = `pkg-config --libs glib-2.0` +LIBS = -lSDLmain -lSDL -lGL -lGLU $(GTK_LIBS) $(GLIB2_LIBS) CXXFLAGS = \ -O3 \ @@ -201,7 +205,7 @@ $(TINYXML_CPPFLAGS) $(GTK_CPPFLAGS) atanua: $(atanua-obj) $(atanua-headers) - $(CXX) `pkg-config --cflags gtk+-3.0` `pkg-config --cflags glib-2.0` -o $@ $(atanua-obj) -L. -lSDLmain -lSDL -lGL -lGLU `pkg-config --libs gtk+-3.0` `pkg-config --libs glib-2.0` -O3 $(CXXFLAGS) + $(CXX) $(GTK_CFLAGS) $(GLIB2_CFLAGS) -o $@ $(atanua-obj) -L. $(LIBS) -O3 $(CXXFLAGS) clean: rm $(atanua-obj) atanua From 356a6bf634acc851c00fb56e19ad85b5790566db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:37:23 +0200 Subject: [PATCH 04/16] Try to solve undefined GL constant --- src/basecode/angelcodefont.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/basecode/angelcodefont.cpp b/src/basecode/angelcodefont.cpp index 431d992..43f4f8b 100644 --- a/src/basecode/angelcodefont.cpp +++ b/src/basecode/angelcodefont.cpp @@ -25,6 +25,11 @@ distribution. #include "atanua.h" #include "toolkit.h" #include "fileutils.h" +#include "texture.h" + +#if !defined(GLEW_ARB_vertex_buffer_object) && defined (GL_ARB_vertex_buffer_object) +#define GLEW_ARB_vertex_buffer_object GL_ARB_vertex_buffer_object +#endif void ACFontInfoBlock::load(File * f) { From de8483371f27380c1a2d003b3bc9ed494d105375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:37:30 +0200 Subject: [PATCH 05/16] Move GLee to separate variables Try to make using upstream easier. --- makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index ece5bad..2cd5dae 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,9 @@ all: atanua # Copied from atanua.vcxproj +glee-c-src = \ + glee/GLee.c + atanua-c-src = \ src/8051/core.c \ src/8051/disasm.c \ @@ -184,29 +187,34 @@ atanua-headers = \ atanua-cpp-src = $(atanua-basecode-cpp-src) $(atanua-core-cpp-src) $(atanua-chips-cpp-src) $(tinyxml-src) +glee-obj = $(glee-c-src:.c=.o) atanua-obj = $(atanua-cpp-src:.cpp=.o) $(atanua-c-src:.c=.o) CXX = clang CC = clang TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml +GLEE_CFLAGS = -Isrc/glee +GLEE_LIBS = $(glee-obj) GTK_CFLAGS = `pkg-config --cflags gtk+-3.0` GTK_LIBS = `pkg-config --libs gtk+-3.0` GLIB2_CFLAGS = `pkg-config --cflags glib-2.0` GLIB2_LIBS = `pkg-config --libs glib-2.0` LIBS = -lSDLmain -lSDL -lGL -lGLU $(GTK_LIBS) $(GLIB2_LIBS) +CPPFLAGS = \ +$(TINYXML_CFLAGS) $(GLEE_CFLAGS) $(GTK_CFLAGS) CXXFLAGS = \ -O3 \ -Isrc \ -Isrc/include \ -$(TINYXML_CPPFLAGS) $(GTK_CPPFLAGS) +$(CPPFLAGS) # -atanua: $(atanua-obj) $(atanua-headers) - $(CXX) $(GTK_CFLAGS) $(GLIB2_CFLAGS) -o $@ $(atanua-obj) -L. $(LIBS) -O3 $(CXXFLAGS) +atanua: $(atanua-obj) $(glee-obj) $(atanua-headers) + $(CXX) $(CXXFLAGS) -o $@ $(atanua-obj) -L. $(LIBS) clean: - rm $(atanua-obj) atanua + rm -f $(atanua-obj) $(glee-obj) atanua From 7921d0b9f643d1989107310b6397e96b49e16b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:37:43 +0200 Subject: [PATCH 06/16] Move GLee header to system-like directory --- src/glee/{ => GL}/GLee.h | 0 src/include/toolkit.h | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/glee/{ => GL}/GLee.h (100%) diff --git a/src/glee/GLee.h b/src/glee/GL/GLee.h similarity index 100% rename from src/glee/GLee.h rename to src/glee/GL/GLee.h diff --git a/src/include/toolkit.h b/src/include/toolkit.h index 0336b1b..f1109ef 100644 --- a/src/include/toolkit.h +++ b/src/include/toolkit.h @@ -75,7 +75,7 @@ distribution. #ifdef OSX_VERSION #include #include "stb/stb_image.h" -#include "glee/GLee.h" +#include #include #include #define stricmp(a,b) strcasecmp((a),(b)) @@ -85,7 +85,7 @@ distribution. #ifdef LINUX_VERSION #include #include "stb/stb_image.h" -#include "glee/GLee.h" +#include #include #include #define stricmp(a,b) strcasecmp((a),(b)) From 00d688e30a420edb1494f0e6de0242962ff9f308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:37:51 +0200 Subject: [PATCH 07/16] First compilable version Is failing on startup anyway, but at least compiles. --- makefile | 144 +++++++++++++++++++-------------- src/basecode/angelcodefont.cpp | 2 +- src/chip/composite.cpp | 2 +- src/chip/logicprobe.cpp | 11 ++- src/chip/pullhighchip.cpp | 2 +- src/chip/pulllowchip.cpp | 2 +- src/core/basechipfactory.cpp | 4 +- src/core/main.cpp | 2 +- src/core/nativefunctions.cpp | 2 +- src/glee/GLee.c | 2 +- src/include/composite.h | 2 +- src/include/toolkit.h | 10 ++- 12 files changed, 107 insertions(+), 78 deletions(-) diff --git a/makefile b/makefile index 2cd5dae..c5d917c 100644 --- a/makefile +++ b/makefile @@ -2,15 +2,14 @@ all: atanua # Copied from atanua.vcxproj glee-c-src = \ - glee/GLee.c + src/glee/GLee.c atanua-c-src = \ src/8051/core.c \ src/8051/disasm.c \ src/8051/opcodes.c \ - stb/stb_image.c \ - stb/stb_image_write.c \ - glee/GLee.c + src/stb/stb_image.c \ + src/stb/stb_image_write.c atanua-basecode-cpp-src = \ src/basecode/angelcodefont.cpp \ @@ -134,55 +133,55 @@ tinyxml-src = \ atanua-headers = \ Header.h \ - src\include\16segchip.h \ - src\include\7segchip.h \ - src\include\and3chip.h \ - src\include\and8chip.h \ - src\include\andchip.h \ - src\include\angelcodefont.h \ - src\include\atanua.h \ - src\include\atanua_internal.h \ - src\include\audiochip.h \ - src\include\basechipfactory.h \ - src\include\box.h \ - src\include\buttonchip.h \ - src\include\chip2051.h \ - src\include\chip27xx.h \ - src\include\chip309.h \ - src\include\chip6116.h \ - src\include\chip7400.h \ - src\include\chip7402.h \ - src\include\chip7404.h \ - src\include\chip7408.h \ - src\include\chip7410.h \ - src\include\chip74138.h \ - src\include\chip74139.h \ - src\include\chip74151.h \ - src\include\chip74154.h \ - src\include\chip74163.h \ - src\include\chip74164.h \ - src\include\chip74165.h \ - src\include\chip74181.h \ - src\include\chip74191.h \ - src\include\chip74192.h \ - src\include\chip74193.h \ - src\include\chip74195.h \ - src\include\chip7420.h \ - src\include\chip74240.h \ - src\include\chip74241.h \ - src\include\chip74244.h \ - src\include\chip74245.h \ - src\include\chip74283.h \ - src\include\chip74299.h \ - src\include\chip7432.h \ - src\include\chip744040.h \ - src\include\chip7447.h \ - src\include\chip74574.h \ - src\include\chip7473.h \ - src\include\chip7474.h \ - src\include\chip7485.h \ - src\include\chip7486.h \ - src\include\chip7489.h \ + src/include/16segchip.h \ + src/include/7segchip.h \ + src/include/and3chip.h \ + src/include/and8chip.h \ + src/include/andchip.h \ + src/include/angelcodefont.h \ + src/include/atanua.h \ + src/include/atanua_internal.h \ + src/include/audiochip.h \ + src/include/basechipfactory.h \ + src/include/box.h \ + src/include/buttonchip.h \ + src/include/chip2051.h \ + src/include/chip27xx.h \ + src/include/chip309.h \ + src/include/chip6116.h \ + src/include/chip7400.h \ + src/include/chip7402.h \ + src/include/chip7404.h \ + src/include/chip7408.h \ + src/include/chip7410.h \ + src/include/chip74138.h \ + src/include/chip74139.h \ + src/include/chip74151.h \ + src/include/chip74154.h \ + src/include/chip74163.h \ + src/include/chip74164.h \ + src/include/chip74165.h \ + src/include/chip74181.h \ + src/include/chip74191.h \ + src/include/chip74192.h \ + src/include/chip74193.h \ + src/include/chip74195.h \ + src/include/chip7420.h \ + src/include/chip74240.h \ + src/include/chip74241.h \ + src/include/chip74244.h \ + src/include/chip74245.h \ + src/include/chip74283.h \ + src/include/chip74299.h \ + src/include/chip7432.h \ + src/include/chip744040.h \ + src/include/chip7447.h \ + src/include/chip74574.h \ + src/include/chip7473.h \ + src/include/chip7474.h \ + src/include/chip7485.h \ + src/include/chip7486.h \ + src/include/chip7489.h \ # atanua-cpp-src = $(atanua-basecode-cpp-src) $(atanua-core-cpp-src) $(atanua-chips-cpp-src) $(tinyxml-src) @@ -190,20 +189,43 @@ atanua-cpp-src = $(atanua-basecode-cpp-src) $(atanua-core-cpp-src) $(atanua-chip glee-obj = $(glee-c-src:.c=.o) atanua-obj = $(atanua-cpp-src:.cpp=.o) $(atanua-c-src:.c=.o) -CXX = clang +CXX = clang++ CC = clang TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml -GLEE_CFLAGS = -Isrc/glee -GLEE_LIBS = $(glee-obj) -GTK_CFLAGS = `pkg-config --cflags gtk+-3.0` -GTK_LIBS = `pkg-config --libs gtk+-3.0` +TINYXML_LIBS = # bundled source +# Not needed anymore, using glew instead +GLEE_CFLAGS = +GLEE_LIBS = #-lGLee + +SDL2_CFLAGS = `pkg-config --cflags sdl2` +SDL2_LIBS = `pkg-config --libs sdl2` +GTK_CFLAGS = `pkg-config --cflags gtk+-3.0` +GTK_LIBS = `pkg-config --libs gtk+-3.0` GLIB2_CFLAGS = `pkg-config --cflags glib-2.0` -GLIB2_LIBS = `pkg-config --libs glib-2.0` -LIBS = -lSDLmain -lSDL -lGL -lGLU $(GTK_LIBS) $(GLIB2_LIBS) +GLIB2_LIBS = `pkg-config --libs glib-2.0` +GLEW_CFLAGS = `pkg-config --cflags glew` +GLEW_LIBS = `pkg-config --libs glew` +GLUT_CFLAGS = `pkg-config --cflags glut` +GLUT_LIBS = `pkg-config --libs glut` +LIBS = \ + $(TINYXML_LIBS) \ + $(SDL2_LIBS) \ + $(GTK_LIBS) \ + $(GLIB2_LIBS) \ + $(GLEW_LIBS) \ + $(GLUT_LIBS) \ + $(GLEE_LIBS) CPPFLAGS = \ -$(TINYXML_CFLAGS) $(GLEE_CFLAGS) $(GTK_CFLAGS) + $(TINYXML_CFLAGS) \ + $(SDL2_CFLAGS) \ + $(GTK_CFLAGS) \ + $(GLIB2_CFLAGS) \ + $(GLEW_CFLAGS) \ + $(GLUT_CFLAGS) \ + $(GLEE_CFLAGS) + CXXFLAGS = \ -O3 \ -Isrc \ diff --git a/src/basecode/angelcodefont.cpp b/src/basecode/angelcodefont.cpp index 43f4f8b..a2994d0 100644 --- a/src/basecode/angelcodefont.cpp +++ b/src/basecode/angelcodefont.cpp @@ -22,8 +22,8 @@ distribution. */ #include #include -#include "atanua.h" #include "toolkit.h" +#include "atanua.h" #include "fileutils.h" #include "texture.h" diff --git a/src/chip/composite.cpp b/src/chip/composite.cpp index 3b94df7..cc16d62 100644 --- a/src/chip/composite.cpp +++ b/src/chip/composite.cpp @@ -78,7 +78,7 @@ Composite::Composite(CType aSize) mInputPin[2].set(0,4+ypos,this,"Clk"); - sprintf_s(TextureName,32,"composite_base %d",Composite::mCompositeNId++); + snprintf(TextureName,32,"composite_base %d",Composite::mCompositeNId++); mBaseTexture=load_blank_texture(TextureName,1,mxSize,mySize); diff --git a/src/chip/logicprobe.cpp b/src/chip/logicprobe.cpp index c5dae7c..87b5763 100644 --- a/src/chip/logicprobe.cpp +++ b/src/chip/logicprobe.cpp @@ -23,7 +23,12 @@ distribution. #include "atanua.h" #include "atanua_internal.h" #include "logicprobe.h" -#include +#ifdef WINDOWS_VERSION +# include +#else +# include +# define _getcwd getcwd +#endif LogicProbe::LogicProbe() { @@ -136,7 +141,7 @@ void LogicProbe::render(int aChipId) for(int i=0;Cont;i++) { - sprintf_s(NameBuff,NAMEBUFFLEN,"LogicProbeDump%04d.csv",i); + snprintf(NameBuff,NAMEBUFFLEN,"LogicProbeDump%04d.csv",i); fh=fopen(NameBuff,"r"); if(fh!=NULL) { @@ -176,7 +181,7 @@ void LogicProbe::render(int aChipId) Cont=false; } } - sprintf_s(MsgBuff,NAMEBUFFLEN,"Log Dumped to %s\\%s",cwd,NameBuff); + snprintf(MsgBuff,NAMEBUFFLEN,"Log Dumped to %s\\%s",cwd,NameBuff); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING,__FUNCTION__,MsgBuff,NULL); break; } diff --git a/src/chip/pullhighchip.cpp b/src/chip/pullhighchip.cpp index 611afa9..4536bb8 100644 --- a/src/chip/pullhighchip.cpp +++ b/src/chip/pullhighchip.cpp @@ -21,7 +21,7 @@ misrepresented as being the original software. distribution. */ #include "atanua.h" -#include "PullHighChip.h" +#include "pullhighchip.h" PullHighChip::PullHighChip() { diff --git a/src/chip/pulllowchip.cpp b/src/chip/pulllowchip.cpp index 277d700..1f746a9 100644 --- a/src/chip/pulllowchip.cpp +++ b/src/chip/pulllowchip.cpp @@ -21,7 +21,7 @@ misrepresented as being the original software. distribution. */ #include "atanua.h" -#include "PullLowChip.h" +#include "pulllowchip.h" PullLowChip::PullLowChip() { diff --git a/src/core/basechipfactory.cpp b/src/core/basechipfactory.cpp index 840698d..a150b79 100644 --- a/src/core/basechipfactory.cpp +++ b/src/core/basechipfactory.cpp @@ -112,8 +112,8 @@ distribution. #include "ChipTriState.h" #include "namedpin.h" -#include "PullLowChip.h" -#include "PullHighChip.h" +#include "pulllowchip.h" +#include "pullhighchip.h" #include "chip744040.h" diff --git a/src/core/main.cpp b/src/core/main.cpp index 5dec3d7..e350bba 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1974,7 +1974,7 @@ void audiomixer(void* userdata,Uint8* stream,int len) } -#include +#include #if 1 void GL_Init() diff --git a/src/core/nativefunctions.cpp b/src/core/nativefunctions.cpp index b5a320d..27b5dfb 100644 --- a/src/core/nativefunctions.cpp +++ b/src/core/nativefunctions.cpp @@ -517,7 +517,7 @@ void *getdllproc(int dllhandle, const char *procname) #ifdef LINUX_VERSION -#include "SDL/SDL_syswm.h" // to get current window handle +#include // to get current window handle #include #include // dll functions #include diff --git a/src/glee/GLee.c b/src/glee/GLee.c index eb12507..731a84e 100644 --- a/src/glee/GLee.c +++ b/src/glee/GLee.c @@ -40,7 +40,7 @@ #include #include #include -#include "GLee.h" +#include "GL/GLee.h" #if defined(__APPLE__) || defined(__APPLE_CC__) #include diff --git a/src/include/composite.h b/src/include/composite.h index d4d8cea..4561685 100644 --- a/src/include/composite.h +++ b/src/include/composite.h @@ -71,7 +71,7 @@ class Composite : public Chip char TextureName[32]; - static unsigned int Composite::mCompositeNId; + static unsigned int mCompositeNId; public: Composite(CType atype); diff --git a/src/include/toolkit.h b/src/include/toolkit.h index f1109ef..1260bfc 100644 --- a/src/include/toolkit.h +++ b/src/include/toolkit.h @@ -65,8 +65,6 @@ distribution. #include "stb/stb_image.h" -#include "TEXTURE.h" - #define stricmp _stricmp #define strdup _strdup #endif @@ -78,16 +76,19 @@ distribution. #include #include #include +#include #define stricmp(a,b) strcasecmp((a),(b)) #endif #ifdef LINUX_VERSION -#include +#include +#include #include "stb/stb_image.h" -#include +#include #include #include +#include #define stricmp(a,b) strcasecmp((a),(b)) #endif @@ -95,6 +96,7 @@ distribution. #include #include +#include "texture.h" #include "mersennetwister.h" #include "angelcodefont.h" #include "fileutils.h" From 0bbf6cb5970cde0adb9912f610c98b397a9b77b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:38:14 +0200 Subject: [PATCH 08/16] Create window and correct pixel size It starts, but still is not usable. --- src/core/main.cpp | 1 + src/core/texture.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index e350bba..0b088bf 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -2006,6 +2006,7 @@ int main(int argc,char** args) { // initialize glut glutInit(&argc,args); + glutCreateWindow("Atanua"); memset(gAudioBuffer,0,AUDIOBUF_SIZE); diff --git a/src/core/texture.cpp b/src/core/texture.cpp index bc2fbf3..8c2db4d 100644 --- a/src/core/texture.cpp +++ b/src/core/texture.cpp @@ -92,7 +92,7 @@ static void do_load_file_texture(texpair& Tex) if(Tex.mRawBitMap==NULL) return; - unsigned long* src=(unsigned long*)Tex.mRawBitMap; + unsigned int* src=(unsigned int*)Tex.mRawBitMap; // mark all pixels with alpha = 0 to black for(i=0; i Date: Mon, 6 May 2024 00:39:15 +0200 Subject: [PATCH 09/16] Try to fix chaos with unsigned long pixels It seems unsigned long for pixels were used by mistake and later corrected in stb_image routines. But is still used in custom code. Declare special type for representing TexPixel to make it more obvious size is used for pixels in texture. --- src/chip/composite.cpp | 10 +++++----- src/core/texture.cpp | 13 ++++--------- src/include/texture.h | 2 ++ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/chip/composite.cpp b/src/chip/composite.cpp index cc16d62..8178a3a 100644 --- a/src/chip/composite.cpp +++ b/src/chip/composite.cpp @@ -26,7 +26,7 @@ distribution. typedef union { - unsigned long RGBA; + TexPixel RGBA; struct { unsigned char R; @@ -133,10 +133,10 @@ Composite::~Composite() void Composite::render(int aChipId) { - unsigned long* RawBitMap; + unsigned char* RawBitMap; GLuint FramebufferName; - if(FindTextBitmap(TextureName,(unsigned char**)&RawBitMap,FramebufferName)) + if(FindTextBitmap(TextureName,&RawBitMap,FramebufferName)) { GLErrorTest(); glBindFramebuffer(GL_FRAMEBUFFER,0); @@ -171,7 +171,7 @@ void Composite::render(int aChipId) void Composite::update(float aTick) { - unsigned long* RawBitMap; + unsigned char* RawBitMap; GLuint FramebufferName; netstates ClkState; @@ -197,7 +197,7 @@ void Composite::update(float aTick) } else { - if(FindTextBitmap(TextureName,(unsigned char**)&RawBitMap,FramebufferName)) + if(FindTextBitmap(TextureName,&RawBitMap,FramebufferName)) { if(SPin==NETSTATE_HIGH&&!mInHSync) diff --git a/src/core/texture.cpp b/src/core/texture.cpp index 8c2db4d..6193d41 100644 --- a/src/core/texture.cpp +++ b/src/core/texture.cpp @@ -1,7 +1,3 @@ - -#include -#include "toolkit.h" - #include #include "toolkit.h" @@ -38,13 +34,11 @@ static void do_load_blank_texture(texpair& Tex) { if(!Tex.mRawBitMap) { - Tex.mRawBitMap=(unsigned char*)new unsigned long[Tex.mxSize*Tex.mySize]; + TexPixel *src = new TexPixel[Tex.mxSize*Tex.mySize]; - if(Tex.mRawBitMap==NULL) + if(src==NULL) return; - unsigned long* src=(unsigned long*)Tex.mRawBitMap; - for(int y=0; y Date: Mon, 6 May 2024 00:39:35 +0200 Subject: [PATCH 10/16] Implement workaround required for Wayland on Linux Similar issue which was met on endless-sky game. Fedora may prefer wayland and emit glewInit() failure, but otherwise it is initialized correctly. Detect that case and pass into the application. It should work if SDL were correctly initialized. Glut does not seem to be needed for anything in this case. More on: https://github.com/endless-sky/endless-sky/pull/7027 --- src/core/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 0b088bf..889ec4b 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1898,6 +1898,8 @@ void initvideo() exit(0); } + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); // bpp = info->vfmt->BitsPerPixel; flags=SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE; @@ -1909,7 +1911,13 @@ void initvideo() } else { - SDL_GL_CreateContext(gWindow); + static SDL_GLContext glctx = SDL_GL_CreateContext(gWindow); + if (!glctx) + { + fprintf(stderr, "Video GL context failed: %s\n", SDL_GetError()); + SDL_Quit(); + exit(0); + } } glViewport(0,0,gScreenWidth,gScreenHeight); @@ -1983,7 +1991,9 @@ void GL_Init() glewExperimental=GL_TRUE; err=glewInit(); - if(GLEW_OK!=err) + // Ignore the error on Wayland if we have passed SDL initialization + // https://github.com/endless-sky/endless-sky/pull/7027 + if(GLEW_OK!=err && GLEW_ERROR_NO_GLX_DISPLAY!=err) { char Buff[256]; sprintf(Buff,"Error [main]: glewInit failed: %s\n",glewGetErrorString(err)); From c8eb2f8123a093be3626a0f0f990eb1f52b088e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:39:38 +0200 Subject: [PATCH 11/16] Remove glut and GLee usage It seems after changes GLee is no longer useful for anything. The same with freeglut. It is not needed for anything. SDL2 should handle it completely. --- makefile | 13 ++----------- src/core/main.cpp | 4 ---- src/include/toolkit.h | 4 +--- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/makefile b/makefile index c5d917c..255dddf 100644 --- a/makefile +++ b/makefile @@ -194,9 +194,6 @@ CC = clang TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml TINYXML_LIBS = # bundled source -# Not needed anymore, using glew instead -GLEE_CFLAGS = -GLEE_LIBS = #-lGLee SDL2_CFLAGS = `pkg-config --cflags sdl2` SDL2_LIBS = `pkg-config --libs sdl2` @@ -206,25 +203,19 @@ GLIB2_CFLAGS = `pkg-config --cflags glib-2.0` GLIB2_LIBS = `pkg-config --libs glib-2.0` GLEW_CFLAGS = `pkg-config --cflags glew` GLEW_LIBS = `pkg-config --libs glew` -GLUT_CFLAGS = `pkg-config --cflags glut` -GLUT_LIBS = `pkg-config --libs glut` LIBS = \ $(TINYXML_LIBS) \ $(SDL2_LIBS) \ $(GTK_LIBS) \ $(GLIB2_LIBS) \ - $(GLEW_LIBS) \ - $(GLUT_LIBS) \ - $(GLEE_LIBS) + $(GLEW_LIBS) CPPFLAGS = \ $(TINYXML_CFLAGS) \ $(SDL2_CFLAGS) \ $(GTK_CFLAGS) \ $(GLIB2_CFLAGS) \ - $(GLEW_CFLAGS) \ - $(GLUT_CFLAGS) \ - $(GLEE_CFLAGS) + $(GLEW_CFLAGS) CXXFLAGS = \ -O3 \ diff --git a/src/core/main.cpp b/src/core/main.cpp index 889ec4b..f5bcc1b 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -2014,10 +2014,6 @@ void GL_Init() #endif int main(int argc,char** args) { - // initialize glut - glutInit(&argc,args); - glutCreateWindow("Atanua"); - memset(gAudioBuffer,0,AUDIOBUF_SIZE); gotoappdirectory(argc,args); diff --git a/src/include/toolkit.h b/src/include/toolkit.h index 1260bfc..009280d 100644 --- a/src/include/toolkit.h +++ b/src/include/toolkit.h @@ -73,10 +73,9 @@ distribution. #ifdef OSX_VERSION #include #include "stb/stb_image.h" -#include +#include #include #include -#include #define stricmp(a,b) strcasecmp((a),(b)) #endif @@ -88,7 +87,6 @@ distribution. #include #include #include -#include #define stricmp(a,b) strcasecmp((a),(b)) #endif From 2133778e1960df52673d53cb6d710f9e1da16bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:39:47 +0200 Subject: [PATCH 12/16] Just few format and debug things Few unimportant changes to formatting or debugging, without significant functionality changes. --- src/core/main.cpp | 5 +++++ src/include/toolkit.h | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index f5bcc1b..98d0cce 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -353,6 +353,10 @@ void process_events() // initvideo(); resizevideo(); break; +#ifdef DEBUG_SDL + default: + printf("DBG: windowevent %X data1:%d data2: %d\n", event.window.event, event.window.data1, event.window.data2); +#endif } break; @@ -1810,6 +1814,7 @@ static void draw_screen() case NETSTATE_INVALID: tooltip="Invalid state:\nTwo or more outputs\nconnected together\nor invalid wiring\non a chip."; break; + case NETSTATE_HIGHZ: case NETSTATE_HIGH: tooltip="Signal 'High'"; break; diff --git a/src/include/toolkit.h b/src/include/toolkit.h index 009280d..6b0ecea 100644 --- a/src/include/toolkit.h +++ b/src/include/toolkit.h @@ -118,7 +118,15 @@ distribution. #define GEN_ID (__LINE__) #endif -#define GLErrorTest() { GLenum err=glGetError();if(err!=GL_NO_ERROR){char Buff[256];sprintf(Buff,"File %s Line %d, Error 0x%08x (%s)\n",__FILE__,__LINE__,err,glewGetErrorString(err));SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,__FUNCTION__,Buff,NULL);}} +#define GLErrorTest() { \ + GLenum err=glGetError(); \ + if(err!=GL_NO_ERROR) \ + { \ + char Buff[256]; \ + sprintf(Buff,"File %s Line %d, Error 0x%08x (%s)\n",__FILE__,__LINE__,err,glewGetErrorString(err)); \ + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,__FUNCTION__,Buff,NULL); \ + } \ +} struct UIState { From 4b28cd0984e271559e4b705b0012a3deda94d61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:39:53 +0200 Subject: [PATCH 13/16] Support for tinyxml 2.6 Add support definitions for tinyxml 2.6, but keep backward compatibility of bundled tinyxml version bundled inside. Allows building both with bundled and system tinyxml library. --- makefile | 3 +++ src/core/AtanuaConfig.cpp | 4 ++-- src/core/fileio.cpp | 12 ++++++------ src/core/pluginchipfactory.cpp | 4 ++-- src/tinyxml_2_5_3/tinyxml/tinyxml.h | 5 ++++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/makefile b/makefile index 255dddf..afb9313 100644 --- a/makefile +++ b/makefile @@ -192,6 +192,9 @@ atanua-obj = $(atanua-cpp-src:.cpp=.o) $(atanua-c-src:.c=.o) CXX = clang++ CC = clang +# more recent tinyxml does not work +#TINYXML_CFLAGS = `pkg-config --cflags tinyxml` +#TINYXML_LIBS = `pkg-config --libs tinyxml` TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml TINYXML_LIBS = # bundled source diff --git a/src/core/AtanuaConfig.cpp b/src/core/AtanuaConfig.cpp index a737450..174a185 100644 --- a/src/core/AtanuaConfig.cpp +++ b/src/core/AtanuaConfig.cpp @@ -191,14 +191,14 @@ void AtanuaConfig::load() TiXmlNode *root; for (root = doc.FirstChild(); root != 0; root = root->NextSibling()) { - if (root->Type() == TiXmlNode::ELEMENT) + if (root->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(root->Value(), "AtanuaConfig")==0) { TiXmlNode *part; for (part = root->FirstChild(); part != 0; part = part->NextSibling()) { - if (part->Type() == TiXmlNode::ELEMENT) + if (part->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(part->Value(), "FontSystem") == 0) diff --git a/src/core/fileio.cpp b/src/core/fileio.cpp index a5866f8..d37bd9a 100644 --- a/src/core/fileio.cpp +++ b/src/core/fileio.cpp @@ -327,7 +327,7 @@ void do_loadxml(FILE * f, int box) for (pChild = doc.FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { - if (pChild->Type() == TiXmlNode::ELEMENT) + if (pChild->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(pChild->Value(), "Atanua") == 0) { @@ -338,7 +338,7 @@ void do_loadxml(FILE * f, int box) TiXmlNode *part; for (part = pChild->FirstChild(); part != 0; part = part->NextSibling()) { - if (part->Type() == TiXmlNode::ELEMENT) + if (part->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(part->Value(), "Chip")==0) { @@ -421,7 +421,7 @@ void do_loadxml(FILE * f, int box) TiXmlNode *text; for (text = part->FirstChild(); text != 0; text = text->NextSibling()) { - if (text->Type() == TiXmlNode::TEXT) + if (text->Type() == TiXmlNode::TINYXML_TEXT) { MemoryFile f; @@ -731,7 +731,7 @@ void do_loadxmltobinary(FILE * f, File * outf, BoxcacheData * bd) for (pChild = doc.FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { - if (pChild->Type() == TiXmlNode::ELEMENT) + if (pChild->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(pChild->Value(), "Atanua") == 0) { @@ -751,7 +751,7 @@ void do_loadxmltobinary(FILE * f, File * outf, BoxcacheData * bd) TiXmlNode *part; for (part = pChild->FirstChild(); part != 0; part = part->NextSibling()) { - if (part->Type() == TiXmlNode::ELEMENT) + if (part->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(part->Value(), "Chip")==0) { @@ -832,7 +832,7 @@ void do_loadxmltobinary(FILE * f, File * outf, BoxcacheData * bd) TiXmlNode *text; for (text = part->FirstChild(); text != 0; text = text->NextSibling()) { - if (text->Type() == TiXmlNode::TEXT) + if (text->Type() == TiXmlNode::TINYXML_TEXT) { const char *v = text->Value(); int wholebyte = 0; diff --git a/src/core/pluginchipfactory.cpp b/src/core/pluginchipfactory.cpp index 01a9192..5e7ee32 100644 --- a/src/core/pluginchipfactory.cpp +++ b/src/core/pluginchipfactory.cpp @@ -44,14 +44,14 @@ PluginChipFactory::PluginChipFactory() TiXmlNode *root; for (root = doc.FirstChild(); root != 0; root = root->NextSibling()) { - if (root->Type() == TiXmlNode::ELEMENT) + if (root->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(root->Value(), "AtanuaConfig")==0) { TiXmlNode *part; for (part = root->FirstChild(); part != 0; part = part->NextSibling()) { - if (part->Type() == TiXmlNode::ELEMENT) + if (part->Type() == TiXmlNode::TINYXML_ELEMENT) { if (stricmp(part->Value(), "Plugin") == 0) { diff --git a/src/tinyxml_2_5_3/tinyxml/tinyxml.h b/src/tinyxml_2_5_3/tinyxml/tinyxml.h index c6f40cc..1f70e2a 100644 --- a/src/tinyxml_2_5_3/tinyxml/tinyxml.h +++ b/src/tinyxml_2_5_3/tinyxml/tinyxml.h @@ -468,7 +468,10 @@ class TiXmlNode : public TiXmlBase UNKNOWN, TEXT, DECLARATION, - TYPECOUNT + TYPECOUNT, + // Forward compatibility with 2.6 + TINYXML_ELEMENT = ELEMENT, + TINYXML_TEXT = TEXT }; virtual ~TiXmlNode(); From 13d8cea0a8f011da634fcdd174259c70a9b50c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:39:59 +0200 Subject: [PATCH 14/16] Fix signed type warning on 8051 emulator Just hide the warning it emits. --- src/8051/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/8051/core.c b/src/8051/core.c index c558312..fb0a2e6 100644 --- a/src/8051/core.c +++ b/src/8051/core.c @@ -441,7 +441,7 @@ int tick(struct em8051 *aCPU) int decode(struct em8051 *aCPU, int aPosition, unsigned char *aBuffer) { - return aCPU->dec[aCPU->mCodeMem[aPosition & (aCPU->mCodeMemSize - 1)]](aCPU, aPosition, aBuffer); + return aCPU->dec[aCPU->mCodeMem[aPosition & (aCPU->mCodeMemSize - 1)]](aCPU, aPosition, (char *)aBuffer); } void disasm_setptrs(struct em8051 *aCPU); From 114607d44d26fc9f00bc453cbebcfcd25e587af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:40:03 +0200 Subject: [PATCH 15/16] Hide linux object files from git status --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2c96506..3d4616e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ Debug/ v16/ FileContentIndex/ v17/ +*.o From e9c28887ae421c5c498b5dd45dd573cdf4dba1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Mon, 6 May 2024 00:40:07 +0200 Subject: [PATCH 16/16] Make using system tinyxml default on linux Keep bundled version intact for use on Windows, but allow simple switching to bundled library. Do not compile bundled tinyxml by default. Comment out tinyxml-src reset to empty value to restore building. --- makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index afb9313..b742a94 100644 --- a/makefile +++ b/makefile @@ -184,6 +184,7 @@ atanua-headers = \ src/include/chip7489.h \ # +tinyxml-src = # use system library instead atanua-cpp-src = $(atanua-basecode-cpp-src) $(atanua-core-cpp-src) $(atanua-chips-cpp-src) $(tinyxml-src) glee-obj = $(glee-c-src:.c=.o) @@ -193,10 +194,10 @@ CXX = clang++ CC = clang # more recent tinyxml does not work -#TINYXML_CFLAGS = `pkg-config --cflags tinyxml` -#TINYXML_LIBS = `pkg-config --libs tinyxml` -TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml -TINYXML_LIBS = # bundled source +TINYXML_CFLAGS = `pkg-config --cflags tinyxml` +TINYXML_LIBS = `pkg-config --libs tinyxml` +#TINYXML_CFLAGS = -Isrc/tinyxml_2_5_3/tinyxml +#TINYXML_LIBS = # bundled source SDL2_CFLAGS = `pkg-config --cflags sdl2` SDL2_LIBS = `pkg-config --libs sdl2` @@ -206,6 +207,7 @@ GLIB2_CFLAGS = `pkg-config --cflags glib-2.0` GLIB2_LIBS = `pkg-config --libs glib-2.0` GLEW_CFLAGS = `pkg-config --cflags glew` GLEW_LIBS = `pkg-config --libs glew` + LIBS = \ $(TINYXML_LIBS) \ $(SDL2_LIBS) \