Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Aug 2012
Offline Last Active Jan 20 2014 10:26 PM

Topics I've Started

Byproduct of Insomnia

19 July 2013 - 01:25 AM

This one needs a little explaining. A while back I was in the middle of a major life crisis and things where looking real bad for me, in a nutshell I couldn't sleep. I was put on ambien by my doctor, and found I did not go to sleep while on it. Instead I turned into a zombie of a person that walked into walls ocassionally. This is something I coded while awake on ambien.

//-----Generate Self Extracting patch installer----->
	if(generatePatch && numDiffs > 0){//-b flag
		//construct base source files
		system("mkdir /tmp/builder");
		system("echo '#include <stdio.h>' > /tmp/builder/headers.c");
		system("echo '#include <stdlib.h>' >> /tmp/builder/headers.c");
		system("echo \" \" >> /tmp/builder/headers.c");//space

		system("echo \" \" > /tmp/builder/decompile.c");//space
		system("echo 'int main(){' >> /tmp/builder/decompile.c");
		system("echo 'FILE *fp = fopen(\"TMP.tar.gz\",\"wb\");' >> /tmp/builder/decompile.c");
		system("echo 'fwrite(xxx, sizeof(xxx[0]), sizeof xxx/sizeof(xxx[0]), fp);' >> /tmp/builder/decompile.c");
		system("echo 'fclose(fp);' >> /tmp/builder/decompile.c");

		//do any additional installation work here-->
		system("ST=\\\"\necho \"system(${ST}> .install.py${ST});//create installer script\" >> /tmp/builder/decompile.c");//create script file
			//write python install script here-->
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'from Tkinter import * ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'from tkFileDialog import askdirectory ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'import os ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'def askd(): ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '	dir1 = askdirectory() ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '	if dir1: ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		print ${STT}Directory ${STT} + dir1 + ${STT} Will Be Patched.${STT}' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		os.system(${STT}tar -zxf ./TMP.tar.gz -C .${STT}) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		os.system(${STT}mv -f .gamepatch.diff* ${STT} + dir1) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		os.system(${STT}rm ./TMP.tar.gz${STT}) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		os.system(${STT}cd dir1\\\\\\\ngamepatch -p 10000${STT}) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");//patch system to latest patch
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		quit() ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");//exit tkinter
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '		exit() ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");//exit python
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'top = Frame() ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'top.pack() ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'Label(top, text=${STT}${STT}${STT}This patch is only designed for a specific game. ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'Do Not Use If Unsure What Game This Is For! ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo '${STT}${STT}${STT}).pack(side=TOP) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'widget = Button(top, text=${STT}Choose Game Directory To Patch${STT}, command=askd) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'widget.pack(side=BOTTOM) ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
			system("STT=\\\\\\\"\nST=\\\"\necho \"system(${ST}echo 'top.mainloop() ' >> .install.py${ST});\" >> /tmp/builder/decompile.c");
		system("ST=\\\"\necho \"system(${ST}gnome-terminal -e 'python ./.install.py'${ST});\" >> /tmp/builder/decompile.c");//run script file
		system("ST=\\\"\necho \"system(${ST}rm .install.py${ST});\" >> /tmp/builder/decompile.c");//remove script file

		system("echo 'return 0;}' >> /tmp/builder/decompile.c");

		//build and merge source files
		system("tar -zcf /tmp/builder/TMP.tar.gz .gamepatch.diff*");
		system("cat /tmp/builder/TMP.tar.gz | ( echo \"unsigned char xxx[] = {\"; xxd -i; echo \"};\" ) > /tmp/builder/output_file.c");
		system("cat /tmp/builder/headers.c /tmp/builder/output_file.c /tmp/builder/decompile.c > /tmp/builder/builder.c");

		//compile source file
			system("gcc /tmp/builder/builder.c -o ./patcher");
			sprintf(buffer, "%s%s","gcc /tmp/builder/builder.c -o ",path);
		printf("\n-->Patch Installer Has Been Generated\n");

Have you submitted your nominations for worst comapny in America?

10 March 2013 - 02:11 AM

The website consumerist dot com is still taking nominations for worst company in America and you have until march 12, 5pm ET.




I have my favourites for this year all picked out, all three deserve to get golden poo.

EA Games, Monsanto, Directv

Golang Game Programming Question

28 December 2012 - 09:41 PM

Recently I have considered using golang as the basis for a game runtime. I was tinkering with the idea of wrapping SFML into a Go library and linking in game modules written in GO.  I was wondering if anyone had any experience with golang and had any advice for me.


For example, is it a good idea to place the game loop on the C/C++ side, or keep it on the Go side?


I use <extern void go_func_name() __asm__ ("package_name.function_name");> as the basis for calling over into go. Are there more efficient ways of doing this? What if I do not know the name of the package/function at compile time?