summaryrefslogtreecommitdiffhomepage
path: root/contrib/very-important-source-code/important-stuff
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-27 08:57:04 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-10-28 07:40:56 +0100
commit192e1131873e66d2118afd7a6e13e5701053a4d0 (patch)
tree6199612811aae7d7de4aa3a22f347c96d197e908 /contrib/very-important-source-code/important-stuff
parent7c8b01037e7dd6680d5cd9ba32c27c1a3ed52809 (diff)
rename "clientfiles/" to "contrib/" as customary
Diffstat (limited to 'contrib/very-important-source-code/important-stuff')
-rw-r--r--contrib/very-important-source-code/important-stuff/NPClient.h17
-rw-r--r--contrib/very-important-source-code/important-stuff/NPClient.spec23
-rw-r--r--contrib/very-important-source-code/important-stuff/NPClient_dll.h58
-rw-r--r--contrib/very-important-source-code/important-stuff/NPClient_main.c444
-rw-r--r--contrib/very-important-source-code/important-stuff/game_data.c166
-rw-r--r--contrib/very-important-source-code/important-stuff/game_data.h17
6 files changed, 725 insertions, 0 deletions
diff --git a/contrib/very-important-source-code/important-stuff/NPClient.h b/contrib/very-important-source-code/important-stuff/NPClient.h
new file mode 100644
index 00000000..770e1c71
--- /dev/null
+++ b/contrib/very-important-source-code/important-stuff/NPClient.h
@@ -0,0 +1,17 @@
+
+extern int NP_RegisterWindowHandle (HWND hwnd);
+extern int NP_UnregisterWindowHandle (void);
+extern int NP_RegisterProgramProfileID (unsigned short id);
+extern int NP_QueryVersion (unsigned short *version);
+extern int NP_RequestData (unsigned short req);
+extern int NP_GetSignature (tir_signature_t *sig);
+extern int NP_GetData (tir_data_t *data);
+extern int NP_GetParameter (void);
+extern int NP_SetParameter (void);
+extern int NP_StartCursor (void);
+extern int NP_StopCursor (void);
+extern int NP_ReCenter (void);
+extern int NP_StartDataTransmission (void);
+extern int NP_StopDataTransmission (void);
+
+
diff --git a/contrib/very-important-source-code/important-stuff/NPClient.spec b/contrib/very-important-source-code/important-stuff/NPClient.spec
new file mode 100644
index 00000000..7fe5f1b4
--- /dev/null
+++ b/contrib/very-important-source-code/important-stuff/NPClient.spec
@@ -0,0 +1,23 @@
+# Generated from NPClient.dll by winedump
+
+1 stub NPPriv_ClientNotify
+2 stub NPPriv_GetLastError
+3 stub NPPriv_SetData
+4 stub NPPriv_SetLastError
+5 stub NPPriv_SetParameter
+6 stub NPPriv_SetSignature
+7 stub NPPriv_SetVersion
+8 stdcall NP_GetData( ptr ) NPCLIENT_NP_GetData
+9 stdcall NP_GetParameter( long long) NPCLIENT_NP_GetParameter
+10 stdcall NP_GetSignature( ptr ) NPCLIENT_NP_GetSignature
+11 stdcall NP_QueryVersion( ptr ) NPCLIENT_NP_QueryVersion
+12 stdcall NP_ReCenter() NPCLIENT_NP_ReCenter
+13 stdcall NP_RegisterProgramProfileID( long ) NPCLIENT_NP_RegisterProgramProfileID
+14 stdcall NP_RegisterWindowHandle( ptr ) NPCLIENT_NP_RegisterWindowHandle
+15 stdcall NP_RequestData( long ) NPCLIENT_NP_RequestData
+16 stdcall NP_SetParameter( long long ) NPCLIENT_NP_SetParameter
+17 stdcall NP_StartCursor() NPCLIENT_NP_StartCursor
+18 stdcall NP_StartDataTransmission() NPCLIENT_NP_StartDataTransmission
+19 stdcall NP_StopCursor() NPCLIENT_NP_StopCursor
+20 stdcall NP_StopDataTransmission() NPCLIENT_NP_StopDataTransmission
+21 stdcall NP_UnregisterWindowHandle() NPCLIENT_NP_UnregisterWindowHandle
diff --git a/contrib/very-important-source-code/important-stuff/NPClient_dll.h b/contrib/very-important-source-code/important-stuff/NPClient_dll.h
new file mode 100644
index 00000000..b0bab5db
--- /dev/null
+++ b/contrib/very-important-source-code/important-stuff/NPClient_dll.h
@@ -0,0 +1,58 @@
+/*
+ * NPClient.dll
+ *
+ * Generated from NPClient.dll by winedump.
+ *
+ * DO NOT SEND GENERATED DLLS FOR INCLUSION INTO WINE !
+ *
+ */
+#ifndef __WINE_NPCLIENT_DLL_H
+#define __WINE_NPCLIENT_DLL_H
+
+#include "windef.h"
+#include "wine/debug.h"
+#include "winbase.h"
+#include "winnt.h"
+
+#pragma pack(1)
+typedef struct tir_data{
+ short status;
+ short frame;
+ unsigned int cksum;
+ float roll, pitch, yaw;
+ float tx, ty, tz;
+ float padding[9];
+} tir_data_t;
+
+typedef struct tir_signature{
+ char DllSignature[200];
+ char AppSignature[200];
+} tir_signature_t;
+#pragma pack(0)
+
+
+/* __stdcall NPCLIENT_NPPriv_ClientNotify(); */
+/* __stdcall NPCLIENT_NPPriv_GetLastError(); */
+/* __stdcall NPCLIENT_NPPriv_SetData(); */
+/* __stdcall NPCLIENT_NPPriv_SetLastError(); */
+/* __stdcall NPCLIENT_NPPriv_SetParameter(); */
+/* __stdcall NPCLIENT_NPPriv_SetSignature(); */
+/* __stdcall NPCLIENT_NPPriv_SetVersion(); */
+int __stdcall NPCLIENT_NP_GetData(tir_data_t * data);
+int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1);
+int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig);
+int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version);
+int __stdcall NPCLIENT_NP_ReCenter(void);
+int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id);
+int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd);
+int __stdcall NPCLIENT_NP_RequestData(unsigned short req);
+int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1);
+int __stdcall NPCLIENT_NP_StartCursor(void);
+int __stdcall NPCLIENT_NP_StartDataTransmission(void);
+int __stdcall NPCLIENT_NP_StopCursor(void);
+int __stdcall NPCLIENT_NP_StopDataTransmission(void);
+int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void);
+
+
+
+#endif /* __WINE_NPCLIENT_DLL_H */
diff --git a/contrib/very-important-source-code/important-stuff/NPClient_main.c b/contrib/very-important-source-code/important-stuff/NPClient_main.c
new file mode 100644
index 00000000..f892f89e
--- /dev/null
+++ b/contrib/very-important-source-code/important-stuff/NPClient_main.c
@@ -0,0 +1,444 @@
+/*
+ * NPClient.dll
+ *
+ * Generated from NPClient.dll by winedump.
+ *
+ * DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE!
+ *
+ */
+
+#include <linuxtrack.h>
+#include "rest.h"
+//#include "config.h"
+#define __WINESRC__
+
+#include <stdarg.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "windef.h"
+#include "winbase.h"
+#include "NPClient_dll.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(NPClient);
+
+bool crypted = false;
+static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static int dbg_flag;
+
+static void dbg_report(const char *msg,...)
+{
+ static FILE *f = NULL;
+ if(dbg_flag){
+ if(f == NULL){
+ f = fopen("NPClient.log", "w");
+ }
+ va_list ap;
+ va_start(ap,msg);
+ vfprintf(f, msg, ap);
+ fflush(f);
+ va_end(ap);
+ }
+}
+
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
+
+ switch (fdwReason)
+ {
+ case DLL_WINE_PREATTACH:
+ return TRUE;
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ dbg_flag = getDebugFlag('w');
+ dbg_report("Attach request\n");
+ break;
+ case DLL_PROCESS_DETACH:
+ linuxtrack_shutdown();
+ break;
+ }
+
+ return TRUE;
+}
+/******************************************************************
+ * NPPriv_ClientNotify (NPCLIENT.1)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_ClientNotify()
+{
+ /* @stub in .spec */
+}
+#endif
+/******************************************************************
+ * NPPriv_GetLastError (NPCLIENT.2)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_GetLastError()
+{
+ /* @stub in .spec */
+}
+#endif
+/******************************************************************
+ * NPPriv_SetData (NPCLIENT.3)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_SetData()
+{
+ /* @stub in .spec */
+}
+#endif
+/******************************************************************
+ * NPPriv_SetLastError (NPCLIENT.4)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_SetLastError()
+{
+ /* @stub in .spec */
+}
+#endif
+/******************************************************************
+ * NPPriv_SetParameter (NPCLIENT.5)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_SetParameter()
+{
+ /* @stub in .spec */
+}
+#endif
+/******************************************************************
+ * NPPriv_SetSignature (NPCLIENT.6)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_SetSignature()
+{
+ /* @stub in .spec */
+}
+#endif
+/******************************************************************
+ * NPPriv_SetVersion (NPCLIENT.7)
+ *
+ *
+ */
+#if 0
+__stdcall NPCLIENT_NPPriv_SetVersion()
+{
+ /* @stub in .spec */
+}
+#endif
+
+static float limit_num(float min, float val, float max)
+{
+ if(val < min) return min;
+ if(val > max) return max;
+ return val;
+}
+
+static unsigned int cksum(unsigned char buf[], unsigned int size)
+{
+ if((size == 0) || (buf == NULL)){
+ return 0;
+ }
+
+ int rounds = size >> 2;
+ int rem = size % 4;
+
+ int c = size;
+ int a0, a2;
+// printf("Orig: ");
+//for(a0 = 0; a0 < (int)size; ++a0)
+//{
+// printf("%02X", buf[a0]);
+//}
+//printf("\n");
+ while(rounds != 0){
+ a0 = *(short int*)buf;
+ a2 = *(short int*)(buf+2);
+ buf += 4;
+ c += a0;
+ a2 ^= (c << 5);
+ a2 <<= 11;
+ c ^= a2;
+ c += (c >> 11);
+ --rounds;
+ }
+ switch(rem){
+ case 3:
+ a0 = *(short int*)buf;
+ a2 = *(signed char*)(buf+2);
+ c += a0;
+ a2 = (a2 << 2) ^ c;
+ c ^= (a2 << 16);
+ a2 = (c >> 11);
+ break;
+ case 2:
+ a2 = *(short int*)buf;
+ c += a2;
+ c ^= (c << 11);
+ a2 = (c >> 17);
+ break;
+ case 1:
+ a2 = *(signed char*)(buf);
+ c += a2;
+ c ^= (c << 10);
+ a2 = (c >> 1);
+ break;
+ default:
+ break;
+ }
+ if(rem != 0){
+ c+=a2;
+ }
+
+ c ^= (c << 3);
+ c += (c >> 5);
+ c ^= (c << 4);
+ c += (c >> 17);
+ c ^= (c << 25);
+ c += (c >> 6);
+
+ return (unsigned int)c;
+}
+
+static void enhance(unsigned char buf[], unsigned int size,
+ unsigned char codetable[], unsigned int table_size)
+{
+ unsigned int table_ptr = 0;
+ unsigned char var = 0x88;
+ unsigned char tmp;
+ if((size <= 0) || (table_size <= 0) ||
+ (buf == NULL) || (codetable == NULL)){
+ return;
+ }
+ do{
+ tmp = buf[--size];
+ buf[size] = tmp ^ codetable[table_ptr] ^ var;
+ var += size + tmp;
+ ++table_ptr;
+ if(table_ptr >= table_size){
+ table_ptr -= table_size;
+ }
+ }while(size != 0);
+}
+
+
+/******************************************************************
+ * NP_GetData (NPCLIENT.8)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_GetData(tir_data_t * data)
+{
+ float r, p, y, tx, ty, tz;
+ unsigned int frame;
+ int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame);
+ memset((char *)data, 0, sizeof(tir_data_t));
+ data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1;
+ data->frame = frame & 0xFFFF;
+ data->cksum = 0;
+ data->roll = r / 180.0 * 16383;
+ data->pitch = -p / 180.0 * 16383;
+ data->yaw = y / 180.0 * 16383;
+ data->tx = -limit_num(-16383.0, 15 * tx, 16383);
+ data->ty = limit_num(-16383.0, 15 * ty, 16383);
+ data->tz = limit_num(-16383.0, 15 * tz, 16383);
+ data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t));
+ //printf("Cksum: %04X\n", data->cksum);
+ if(crypted){
+ enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table));
+ }
+ return (res >= 0) ? 0: 1;
+}
+/******************************************************************
+ * NP_GetParameter (NPCLIENT.9)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1)
+{
+ dbg_report("GetParameter request: %d %d\n", arg0, arg1);
+ TRACE("(void): stub\n");
+ return (int) 0;
+}
+
+/******************************************************************
+ * NP_GetSignature (NPCLIENT.10)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig)
+{
+ dbg_report("GetSignature request\n");
+ if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){
+ printf("Signature result: OK\n");
+ return 0;
+ }else{
+ printf("Signature result: NOT OK!\n");
+ return 1;
+ }
+}
+/******************************************************************
+ * NP_QueryVersion (NPCLIENT.11)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version)
+{
+ dbg_report("QueryVersion request\n");
+ *version=0x0500;
+ return 0;
+}
+/******************************************************************
+ * NP_ReCenter (NPCLIENT.12)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_ReCenter(void)
+{
+ dbg_report("ReCenter request\n");
+ linuxtrack_recenter();
+ return 0;
+}
+
+/******************************************************************
+ * NP_RegisterProgramProfileID (NPCLIENT.13)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id)
+{
+ dbg_report("RegisterProgramProfileID request: %d\n", id);
+ game_desc_t gd;
+ if(game_data_get_desc(id, &gd)){
+ printf("Application ID: %d - %s!!!\n", id, gd.name);
+ if(game_data_get_desc(id, &gd)){
+ crypted = gd.encrypted;
+ if(gd.encrypted){
+ printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4],
+ table[5], table[6], table[7]);
+ table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8;
+ table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8;
+ table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8;
+ table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8;
+ table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8;
+ table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8;
+ table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8;
+ table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8;
+ }
+ }
+ if(linuxtrack_init(gd.name) != 0){
+ return 1;
+ }
+ }else{
+ if(!linuxtrack_init("Default")){
+ return 1;
+ }
+ }
+ linuxtrack_suspend();
+ return 0;
+}
+/******************************************************************
+ * NP_RegisterWindowHandle (NPCLIENT.14)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd)
+{
+ dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd);
+ TRACE("((HWND)%p): stub\n",hwnd);
+ return (int) 0;
+}
+/******************************************************************
+ * NP_RequestData (NPCLIENT.15)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_RequestData(unsigned short req)
+{
+ dbg_report("RequestData request: %d\n", req);
+ TRACE("((unsigned short)%d): stub\n",req);
+ return (int) 0;
+}
+/******************************************************************
+ * NP_SetParameter (NPCLIENT.16)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1)
+{
+ dbg_report("SetParameter request: %d %d\n", arg0, arg1);
+ TRACE("(void): stub\n");
+ return (int) 0;
+}
+/******************************************************************
+ * NP_StartCursor (NPCLIENT.17)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_StartCursor(void)
+{
+ dbg_report("StartCursor request\n");
+ TRACE("(void): stub\n");
+ return (int) 0;
+}
+/******************************************************************
+ * NP_StartDataTransmission (NPCLIENT.18)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_StartDataTransmission(void)
+{
+ dbg_report("StartDataTransmission request\n");
+ linuxtrack_wakeup();
+ return 0;
+}
+/******************************************************************
+ * NP_StopCursor (NPCLIENT.19)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_StopCursor(void)
+{
+ dbg_report("StopCursor request\n");
+ TRACE("(void): stub\n");
+ return (int) 0;
+}
+/******************************************************************
+ * NP_StopDataTransmission (NPCLIENT.20)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_StopDataTransmission(void)
+{
+ dbg_report("StopDataTransmission request\n");
+ linuxtrack_suspend();
+ return 0;
+}
+/******************************************************************
+ * NP_UnregisterWindowHandle (NPCLIENT.21)
+ *
+ *
+ */
+int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void)
+{
+ dbg_report("UnregisterWindowHandle request\n");
+ TRACE("(void): stub\n");
+ return (int) 0;
+}
+
diff --git a/contrib/very-important-source-code/important-stuff/game_data.c b/contrib/very-important-source-code/important-stuff/game_data.c
new file mode 100644
index 00000000..48774187
--- /dev/null
+++ b/contrib/very-important-source-code/important-stuff/game_data.c
@@ -0,0 +1,166 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <mxml.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/stat.h>
+#include <string.h>
+
+//First 5 bytes is MD5 hash of "NaturalPoint"
+static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static uint8_t S[256] = {0};
+
+static char *decoded = NULL;
+
+static mxml_node_t *xml = NULL;
+static mxml_node_t *tree = NULL;
+
+static void ksa(uint8_t key[], size_t len)
+{
+ unsigned int i, j;
+ for(i = 0; i < 256; ++i){
+ S[i] = i;
+ }
+ j = 0;
+ for(i = 0; i < 256; ++i){
+ j = (j + S[i] + key[i % len]) % 256;
+ uint8_t tmp = S[i];
+ S[i] = S[j];
+ S[j] = tmp;
+ }
+}
+
+static uint8_t rc4()
+{
+ static uint8_t i = 0;
+ static uint8_t j = 0;
+
+ i += 1;
+ j += S[i];
+ uint8_t tmp = S[i];
+ S[i] = S[j];
+ S[j] = tmp;
+ return S[(S[i] + S[j]) % 256];
+}
+
+static bool decrypt_file(const char *fname, bool from_update)
+{
+ uint32_t header[5];
+ size_t datlen;
+ ksa(secret_key, 16);
+ FILE *inp;
+ struct stat fst;
+
+ if((inp = fopen(fname, "rb")) == NULL){
+ printf("Can't open input file '%s'", fname);
+ return false;
+ }
+
+ if(fstat(fileno(inp), &fst) != 0){
+ fclose(inp);
+ printf("Cannot stat file '%s'\n", fname);
+ return false;
+ }
+
+ if(from_update){
+ if(fread(&header, sizeof(uint32_t), 5, inp) != 5){
+ fclose(inp);
+ printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname);
+ return false;
+ }
+ datlen = header[4];
+ }else{
+ datlen = fst.st_size;
+ }
+ if((decoded = (char *)malloc(datlen+1)) == NULL){
+ printf("malloc failed!\n");
+ return false;
+ }
+ memset(decoded, 0, datlen+1);
+ size_t i;
+ size_t len = fread(decoded, 1, datlen, inp);
+ (void) len;
+ for(i = 0; i < datlen; ++i) decoded[i] ^= rc4();
+ fclose(inp);
+
+ //inp = fopen("tmp.dump", "w");
+ //fwrite(decoded, 1, datlen, inp);
+ //fclose(inp);
+
+ return true;
+}
+
+static bool game_data_init(const char *fname, bool from_update)
+{
+ static bool initialized = false;
+ if(initialized){
+ return true;
+ }
+ if(!decrypt_file(fname, from_update)){
+ printf("Error decrypting file!\n");
+ return false;
+ }
+ xml = mxmlNewXML("1.0");
+ tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK);
+ return (tree != NULL);
+}
+
+static void game_data_close()
+{
+ mxmlDelete(tree);
+ free(decoded);
+}
+
+#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__)
+
+static void remove_newlines(const char* str, char* out, int out_len)
+{
+ int i, j;
+ int len = strlen(str);
+ for (i = 0, j = 0; str[i] && j + 1 < out_len; i++)
+ {
+ if (str[i] == '\r' || str[i] == '\n')
+ continue;
+ out[j++] = str[i];
+ }
+ if (j < out_len)
+ out[j] = '\0';
+}
+
+bool get_game_data(const char *input_fname, const char *output_fname, bool from_update)
+{
+ FILE *outfile = NULL;
+ if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){
+ ltr_int_log_message("Can't open the output file '%s'!\n", output_fname);
+ return false;
+ }
+ if(!game_data_init(input_fname, from_update)){
+ ltr_int_log_message("Can't process the data file '%s'!\n", input_fname);
+ return false;
+ }
+
+ mxml_node_t *game;
+ const char *name;
+ const char *id;
+ for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND);
+ game != NULL;
+ game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND))
+ {
+ name = mxmlElementGetAttr(game, "Name");
+ id = mxmlElementGetAttr(game, "Id");
+
+ mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND);
+ char name_[256];
+ remove_newlines(name, name_, sizeof(name_));
+ if(appid == NULL)
+ fprintf(outfile, "%s \"%s\"\n", id, name_);
+ else
+ fprintf(outfile, "%s \"%s\" (%s)\n", id, name_, appid->child->value.text.string);
+ }
+ fclose(outfile);
+ game_data_close();
+ return true;
+}
+
+int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); }
diff --git a/contrib/very-important-source-code/important-stuff/game_data.h b/contrib/very-important-source-code/important-stuff/game_data.h
new file mode 100644
index 00000000..b71f7a15
--- /dev/null
+++ b/contrib/very-important-source-code/important-stuff/game_data.h
@@ -0,0 +1,17 @@
+#ifndef GAME_DATA__H
+#define GAME_DATA__H
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool get_game_data(const char *input_fname, const char *output_fname, bool from_update);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif