summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemysław R. Pietraszczyk <prymula76@outlook.com>2024-09-26 11:11:34 +0200
committerPrzemysław R. Pietraszczyk <prymula76@outlook.com>2024-09-26 11:11:34 +0200
commit4d46bafb95781d6b4219a6d0eb13d991d4c5d7f2 (patch)
tree43e25e298ff405acfca77483b38d17182df8219b
parentb50f5bd6da084acbd6f0711e5a1bf58bb142a737 (diff)
Added wrapper for WindowsHEADmaster
-rw-r--r--desktop/samegame/Changelog.txt1
-rw-r--r--desktop/samegame/MINGW32/Makefile.mingw3236
-rwxr-xr-xdesktop/samegame/MINGW32/config.txt1
-rwxr-xr-xdesktop/samegame/MINGW32/samegame.rc26
-rwxr-xr-xdesktop/samegame/MINGW32/wrapper.c86
-rw-r--r--desktop/samegame/res/icon.icobin0 -> 2549 bytes
6 files changed, 150 insertions, 0 deletions
diff --git a/desktop/samegame/Changelog.txt b/desktop/samegame/Changelog.txt
index ce437bf..fdef665 100644
--- a/desktop/samegame/Changelog.txt
+++ b/desktop/samegame/Changelog.txt
@@ -1,3 +1,4 @@
+0.240417-4 - Dodanie wrapper dla Windows
0.240417-2 - Pakietowanie
0.240417-1 - Poprawki w naliczaniu punktacji z promowaaniem wyższych poziomów
0.240417-0 - Dodalem punktacje oraz poziomy
diff --git a/desktop/samegame/MINGW32/Makefile.mingw32 b/desktop/samegame/MINGW32/Makefile.mingw32
new file mode 100644
index 0000000..a80fef0
--- /dev/null
+++ b/desktop/samegame/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 = samegame.exe
+CXXFLAGS = $(CXXINCS) -g
+CFLAGS = $(INCS)
+RM = rm
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before samegame.exe all-after
+
+
+clean: clean-custom
+ ${RM} $(OBJ)
+ ${RM} $(BIN)
+
+ ${RM} icon.o
+
+
+$(BIN): $(OBJ)
+ $(WINDRES) samegame.rc -O coff -o icon.o
+ $(CC) $(LINKOBJ) -o "samegame.exe" $(LIBS) -mwindows icon.o
+
+wrapper.o: wrapper.c
+ $(CC) -c wrapper.c -o wrapper.o $(CFLAGS) -DNO_STDIO_REDIRECT
+
+
diff --git a/desktop/samegame/MINGW32/config.txt b/desktop/samegame/MINGW32/config.txt
new file mode 100755
index 0000000..5e3e33e
--- /dev/null
+++ b/desktop/samegame/MINGW32/config.txt
@@ -0,0 +1 @@
+.\jre\bin\javaw.exe -jar SameGame.jar
diff --git a/desktop/samegame/MINGW32/samegame.rc b/desktop/samegame/MINGW32/samegame.rc
new file mode 100755
index 0000000..16920cb
--- /dev/null
+++ b/desktop/samegame/MINGW32/samegame.rc
@@ -0,0 +1,26 @@
+id ICON "../res/icon.ico"
+1 VERSIONINFO
+FILEVERSION 0,240417,1,1
+PRODUCTVERSION 0,240417,1,1
+FILEOS 0x4
+FILETYPE 0x1
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Przemyslaw R. Pietraszczyk"
+ VALUE "FileDescription", "My implementation Same Game"
+ VALUE "FileVersion", "0, 240417, 1, 1"
+ VALUE "InternalName", "Win32App"
+ VALUE "LegalCopyright", "0169 Pietraszczyk"
+ VALUE "OriginalFilename", "samegame.exe"
+ VALUE "ProductName", "Same Game"
+ VALUE "ProductVersion", "0,240417, 1, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0809, 1200
+ END
+END
diff --git a/desktop/samegame/MINGW32/wrapper.c b/desktop/samegame/MINGW32/wrapper.c
new file mode 100755
index 0000000..83e260a
--- /dev/null
+++ b/desktop/samegame/MINGW32/wrapper.c
@@ -0,0 +1,86 @@
+#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
+ ) {
+ printf ("Create Success\n");
+ }
+ 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/desktop/samegame/res/icon.ico b/desktop/samegame/res/icon.ico
new file mode 100644
index 0000000..e241233
--- /dev/null
+++ b/desktop/samegame/res/icon.ico
Binary files differ