From 9bc5e399ccaaa71b96750c03a98d0ce0aa401309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20R=2E=20Pietraszczyk?= Date: Sun, 13 Oct 2024 13:20:17 +0200 Subject: Fixes for mingw --- MINGW32/Icon.rc | 1 + MINGW32/Makefile.mingw32 | 36 ++++++++++++++++ MINGW32/icon/Jttt.ico | Bin 0 -> 2686 bytes MINGW32/icon/Trefle.ico | Bin 0 -> 47826 bytes MINGW32/icon/colorsmemory.ico | Bin 0 -> 2686 bytes MINGW32/icon/ufo-small.ico | Bin 0 -> 2190 bytes MINGW32/wrapper.c | 84 +++++++++++++++++++++++++++++++++++++ VERSION | 1 + src/ColorsMemory.java | 2 +- wrapper-icon/Icon.rc | 1 - wrapper-icon/Makefile.old.win | 33 --------------- wrapper-icon/Makefile.win | 36 ---------------- wrapper-icon/config.txt | 1 - wrapper-icon/icon/Jttt.ico | Bin 2686 -> 0 bytes wrapper-icon/icon/Trefle.ico | Bin 47826 -> 0 bytes wrapper-icon/icon/colorsmemory.ico | Bin 2686 -> 0 bytes wrapper-icon/icon/ufo-small.ico | Bin 2190 -> 0 bytes wrapper-icon/wrapper.c | 71 ------------------------------- 18 files changed, 123 insertions(+), 143 deletions(-) create mode 100755 MINGW32/Icon.rc create mode 100755 MINGW32/Makefile.mingw32 create mode 100644 MINGW32/icon/Jttt.ico create mode 100644 MINGW32/icon/Trefle.ico create mode 100644 MINGW32/icon/colorsmemory.ico create mode 100644 MINGW32/icon/ufo-small.ico create mode 100755 MINGW32/wrapper.c create mode 100644 VERSION delete mode 100644 wrapper-icon/Icon.rc delete mode 100644 wrapper-icon/Makefile.old.win delete mode 100644 wrapper-icon/Makefile.win delete mode 100644 wrapper-icon/config.txt delete mode 100644 wrapper-icon/icon/Jttt.ico delete mode 100644 wrapper-icon/icon/Trefle.ico delete mode 100644 wrapper-icon/icon/colorsmemory.ico delete mode 100644 wrapper-icon/icon/ufo-small.ico delete mode 100644 wrapper-icon/wrapper.c diff --git a/MINGW32/Icon.rc b/MINGW32/Icon.rc new file mode 100755 index 0000000..7e45ea3 --- /dev/null +++ b/MINGW32/Icon.rc @@ -0,0 +1 @@ +id ICON "icon/colorsmemory.ico" diff --git a/MINGW32/Makefile.mingw32 b/MINGW32/Makefile.mingw32 new file mode 100755 index 0000000..3349abc --- /dev/null +++ b/MINGW32/Makefile.mingw32 @@ -0,0 +1,36 @@ +CPP = i686-w64-mingw32-g++ +CC = i686-w64-mingw32-gcc + +WINDRES = i686-w64-mingw32-windres +RES = +OBJ = wrapper.o $(RES) +LINKOBJ = wrapper.o $(RES) +#LIBS = -L"/lib" -lsdl -lsdl_ttf -mwindows +LIBS = -static-libgcc +INCS = +CXXINCS = +BIN = colorsmemory.exe +CXXFLAGS = $(CXXINCS) -g +CFLAGS = $(INCS) +RM = rm + +.PHONY: all all-before all-after clean clean-custom + +all: all-before colorsmemory.exe all-after + + +clean: clean-custom + ${RM} $(OBJ) + ${RM} $(BIN) + + ${RM} icon.o + + +$(BIN): $(OBJ) + $(WINDRES) Icon.rc -O coff -o icon.o + $(CC) $(LINKOBJ) -o "colorsmemory.exe" $(LIBS) -mwindows icon.o + +wrapper.o: wrapper.c + $(CC) -c wrapper.c -o wrapper.o $(CFLAGS) -DNO_STDIO_REDIRECT + + diff --git a/MINGW32/icon/Jttt.ico b/MINGW32/icon/Jttt.ico new file mode 100644 index 0000000..c5e9ee6 Binary files /dev/null and b/MINGW32/icon/Jttt.ico differ diff --git a/MINGW32/icon/Trefle.ico b/MINGW32/icon/Trefle.ico new file mode 100644 index 0000000..c753797 Binary files /dev/null and b/MINGW32/icon/Trefle.ico differ diff --git a/MINGW32/icon/colorsmemory.ico b/MINGW32/icon/colorsmemory.ico new file mode 100644 index 0000000..eb2475a Binary files /dev/null and b/MINGW32/icon/colorsmemory.ico differ diff --git a/MINGW32/icon/ufo-small.ico b/MINGW32/icon/ufo-small.ico new file mode 100644 index 0000000..44ed689 Binary files /dev/null and b/MINGW32/icon/ufo-small.ico differ diff --git a/MINGW32/wrapper.c b/MINGW32/wrapper.c new file mode 100755 index 0000000..3d6fbe6 --- /dev/null +++ b/MINGW32/wrapper.c @@ -0,0 +1,84 @@ +#include +#include +#include +#include // exit +#include // sleep access + +char * file_exist(){ + char * name = (char *)".\\config.txt"; + //char *file = current(name); + char *file = name; + + if (access(file, F_OK)==0){ + printf("PLIK istnieje %s\n",file); + //free(file); + return file; + } + printf("PLIK nie istnieje %s\n",file); + //free(file); + return NULL; +} + + + + +void main( int argc, TCHAR *argv[] ) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + + char * file = file_exist(); + char bufor1[128]; + char bufor2[128]; + char bufor3[128]; + char run[384]; + + if (!file) exit(1); + + FILE * f = fopen(file, "r"); + fscanf(f, "%s %s %s", bufor1,bufor2,bufor3); + fclose(f); + strcpy(run, bufor1); + strcat(run, " "); + strcat(run, bufor2); + strcat(run, " "); + strcat(run, bufor3); + printf("Uruchamiam %s \n",run); + //free(file); + + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + + //if( argc != 2 ) + //{ + // printf("Usage: %s [cmdline]\n", argv[0]); + // return; + //} + + // Start the child process. + if( !CreateProcess( NULL, // No module name (use command line) + run, // Command line + NULL, // Process handle not inheritable + NULL, // Thread handle not inheritable + FALSE, // Set handle inheritance to FALSE + 0, // No creation flags + NULL, // Use parent's environment block + NULL, // Use parent's starting directory + &si, // Pointer to STARTUPINFO structure + &pi ) // Pointer to PROCESS_INFORMATION structure + ) {} + else + { + printf( "CreateProcess failed (%d).\n", GetLastError() ); + return; + } + + // Wait until child process exits. + WaitForSingleObject( pi.hProcess, INFINITE ); + + // Close process and thread handles. + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); +} diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8e084bb --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.210503-3 diff --git a/src/ColorsMemory.java b/src/ColorsMemory.java index 271ddd2..4fb86c0 100644 --- a/src/ColorsMemory.java +++ b/src/ColorsMemory.java @@ -206,7 +206,7 @@ public class ColorsMemory extends JPanel JOptionPane.showMessageDialog(frame, "Moja implementacja gry Memory\nPrzemysław R. Pietraszczyk\nStworzono w oparciu o OpenJDK\nSierpien 2019", - "Colors Memory 0.210503-0", + "Colors Memory 0.210503-3", JOptionPane.PLAIN_MESSAGE); } diff --git a/wrapper-icon/Icon.rc b/wrapper-icon/Icon.rc deleted file mode 100644 index 7e45ea3..0000000 --- a/wrapper-icon/Icon.rc +++ /dev/null @@ -1 +0,0 @@ -id ICON "icon/colorsmemory.ico" diff --git a/wrapper-icon/Makefile.old.win b/wrapper-icon/Makefile.old.win deleted file mode 100644 index 107331f..0000000 --- a/wrapper-icon/Makefile.old.win +++ /dev/null @@ -1,33 +0,0 @@ -CPP = g++.exe -CC = gcc.exe - -WINDRES = windres.exe -RES = -OBJ = wrapper.o $(RES) -LINKOBJ = wrapper.o $(RES) -#LIBS = -L"/lib" -lsdl -lsdl_ttf -mwindows -LIBS = -static-libgcc -INCS = -CXXINCS = -BIN = wrapper.exe -CXXFLAGS = $(CXXINCS) -g -CFLAGS = $(INCS) -RM = rm - -.PHONY: all all-before all-after clean clean-custom - -all: all-before wrapper.exe all-after - - -clean: clean-custom - ${RM} $(OBJ) - ${RM} $(BIN) - - -$(BIN): $(OBJ) - $(CC) $(LINKOBJ) -o "wrapper.exe" $(LIBS) - -wrapper.o: wrapper.c - $(CC) -c wrapper.c -o wrapper.o $(CFLAGS) -DNO_STDIO_REDIRECT - - diff --git a/wrapper-icon/Makefile.win b/wrapper-icon/Makefile.win deleted file mode 100644 index 05bdd53..0000000 --- a/wrapper-icon/Makefile.win +++ /dev/null @@ -1,36 +0,0 @@ -CPP = g++.exe -CC = i686-w64-mingw32-g++ - -WINDRES = i686-w64-mingw32-windres -RES = -OBJ = wrapper.o $(RES) -LINKOBJ = wrapper.o $(RES) -#LIBS = -L"/lib" -lsdl -lsdl_ttf -mwindows -LIBS = -static-libgcc -INCS = -CXXINCS = -BIN = wrapper.exe -CXXFLAGS = $(CXXINCS) -g -CFLAGS = $(INCS) -RM = rm - -.PHONY: all all-before all-after clean clean-custom - -all: all-before wrapper.exe all-after - - -clean: clean-custom - ${RM} $(OBJ) - ${RM} $(BIN) - - $(WINDRES) Icon.rc Icon.res - - -$(BIN): $(OBJ) - $(WINDRES) Icon.rc -O coff -o icon.o - $(CC) $(LINKOBJ) -o "wrapper.exe" $(LIBS) icon.o - -wrapper.o: wrapper.c - $(CC) -c wrapper.c -o wrapper.o $(CFLAGS) -DNO_STDIO_REDIRECT - - diff --git a/wrapper-icon/config.txt b/wrapper-icon/config.txt deleted file mode 100644 index 3618f18..0000000 --- a/wrapper-icon/config.txt +++ /dev/null @@ -1 +0,0 @@ -.\jre\bin\javaw.exe -jar ColorsMemory.jar diff --git a/wrapper-icon/icon/Jttt.ico b/wrapper-icon/icon/Jttt.ico deleted file mode 100644 index c5e9ee6..0000000 Binary files a/wrapper-icon/icon/Jttt.ico and /dev/null differ diff --git a/wrapper-icon/icon/Trefle.ico b/wrapper-icon/icon/Trefle.ico deleted file mode 100644 index c753797..0000000 Binary files a/wrapper-icon/icon/Trefle.ico and /dev/null differ diff --git a/wrapper-icon/icon/colorsmemory.ico b/wrapper-icon/icon/colorsmemory.ico deleted file mode 100644 index eb2475a..0000000 Binary files a/wrapper-icon/icon/colorsmemory.ico and /dev/null differ diff --git a/wrapper-icon/icon/ufo-small.ico b/wrapper-icon/icon/ufo-small.ico deleted file mode 100644 index 44ed689..0000000 Binary files a/wrapper-icon/icon/ufo-small.ico and /dev/null differ diff --git a/wrapper-icon/wrapper.c b/wrapper-icon/wrapper.c deleted file mode 100644 index 5ea19f8..0000000 --- a/wrapper-icon/wrapper.c +++ /dev/null @@ -1,71 +0,0 @@ -#include // printf -#include // exit -#include -#include // sleep access - -/* -char * current(char * name){ - char *file; - - if (!getenv("CD")) { - printf ("Zmienna srodowiskowa \"CD\" nie istnieje !\n"); - exit (1); - } - file=malloc(strlen(getenv("CD")+strlen(name)+1)); - strcpy(file, getenv("CD")); - strcat(file, name); - - return file; -} -*/ - -char * file_exist(){ - char * name = (char *)".\\config.txt"; - //char *file = current(name); - char *file = name; - - if (access(file, F_OK)==0){ - printf("PLIK istnieje %s\n",file); - free(file); - return file; - } - printf("PLIK nie istnieje %s\n",file); - free(file); - return NULL; -} - - - -void load(){ - - char * file = file_exist(); - char bufor1[128]; - char bufor2[128]; - char bufor3[128]; - char run[384]; - - if (!file) exit(1); - - FILE * f = fopen(file, "r"); - fscanf(f, "%s %s %s", bufor1,bufor2,bufor3); - fclose(f); - strcpy(run, bufor1); - strcat(run, " "); - strcat(run, bufor2); - strcat(run, " "); - strcat(run, bufor3); - printf("Uruchamiam %s \n",run); - free(file); - - system(run); - - - - -} - -int main (){ - load(); - - return 0; -} -- cgit v1.2.3