diff options
author | Przemysław R. Pietraszczyk <prymula76@outlook.com> | 2024-10-13 13:20:17 +0200 |
---|---|---|
committer | Przemysław R. Pietraszczyk <prymula76@outlook.com> | 2024-10-13 13:20:17 +0200 |
commit | 9bc5e399ccaaa71b96750c03a98d0ce0aa401309 (patch) | |
tree | 20dfbbbc8a7fb213ce537fdf855617764baf8fcd /MINGW32 | |
parent | 5f063db194796565fcce9725dbf7aa5c4b6ca683 (diff) |
Fixes for mingw
Diffstat (limited to 'MINGW32')
-rwxr-xr-x | MINGW32/Icon.rc | 1 | ||||
-rwxr-xr-x | MINGW32/Makefile.mingw32 | 36 | ||||
-rw-r--r-- | MINGW32/icon/Jttt.ico | bin | 0 -> 2686 bytes | |||
-rw-r--r-- | MINGW32/icon/Trefle.ico | bin | 0 -> 47826 bytes | |||
-rw-r--r-- | MINGW32/icon/colorsmemory.ico | bin | 0 -> 2686 bytes | |||
-rw-r--r-- | MINGW32/icon/ufo-small.ico | bin | 0 -> 2190 bytes | |||
-rwxr-xr-x | MINGW32/wrapper.c | 84 |
7 files changed, 121 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 0000000..c5e9ee6 --- /dev/null +++ b/MINGW32/icon/Jttt.ico diff --git a/MINGW32/icon/Trefle.ico b/MINGW32/icon/Trefle.ico Binary files differnew file mode 100644 index 0000000..c753797 --- /dev/null +++ b/MINGW32/icon/Trefle.ico diff --git a/MINGW32/icon/colorsmemory.ico b/MINGW32/icon/colorsmemory.ico Binary files differnew file mode 100644 index 0000000..eb2475a --- /dev/null +++ b/MINGW32/icon/colorsmemory.ico diff --git a/MINGW32/icon/ufo-small.ico b/MINGW32/icon/ufo-small.ico Binary files differnew file mode 100644 index 0000000..44ed689 --- /dev/null +++ b/MINGW32/icon/ufo-small.ico 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 <windows.h>
+#include <stdio.h>
+#include <tchar.h>
+#include <stdlib.h> // exit
+#include <unistd.h> // 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 );
+}
|