whitespace cosmetics: Remove all trailing whitespace.
[mplayer/glamo.git] / loader / qtx / qtxload.c
blobfe95ac87a5759b5667d564f3e4e88ec63c755e67
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
5 #include "qtxsdk/components.h"
6 #include "qtxsdk/select.h"
7 #include "ldt_keeper.h"
8 #include "mp_msg.h"
10 /* this is what a plain component looks like */
11 ComponentResult ComponentDummy(
12 ComponentParameters *params,
13 void **globals,
14 ComponentResult (*ComponentDispatch)(ComponentParameters *, void **))
16 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
17 params, globals, ComponentDispatch);
18 printf(" Dummy: global datas: %p\n", *globals);
19 printf(" Dummy: returning 0\n");
20 return 0;
23 char *get_path(const char* x){ return strdup(x);}
25 void* LoadLibraryA(char* name);
26 void* GetProcAddress(void* handle,char* func);
28 #define __stdcall __attribute__((__stdcall__))
29 #define __cdecl __attribute__((__cdecl__))
30 #define APIENTRY
32 unsigned int* x_table[0x00001837];
34 static OSErr (*InitializeQTML)(long flags);
36 int main(void) {
37 void *handler;
38 void *handler2;
39 void* theqtdp=NULL;
40 void* compcall=NULL;
41 void* compcallws=NULL;
42 ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob);
43 ComponentResult ret;
44 ComponentParameters *params;
45 ComponentDescription desc;
46 void *globals=NULL;
47 //unsigned int esp=0;
48 //int i;
50 mp_msg_init();
51 //mp_msg_set_level(10);
53 Setup_LDT_Keeper();
54 printf("loading qts\n");
55 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
56 handler = LoadLibraryA("QuickTime.qts");
57 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher");
58 compcall = GetProcAddress(handler, "CallComponent");
59 compcallws = GetProcAddress(handler, "CallComponentFunctionWithStorage");
61 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
62 InitializeQTML(6+16);
64 printf("loading svq3\n");
65 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
66 printf("done\n");
67 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
68 // handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx");
69 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
70 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
72 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
74 // patch svq3 dll:
75 *((void**)0x63214c98) = NULL;
76 *((void**)0x63214c9c) = theqtdp; // theQt...
77 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
78 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
80 desc.componentType=0;
81 desc.componentSubType=0;
82 desc.componentManufacturer=0;
83 desc.componentFlags=0;
84 desc.componentFlagsMask=0;
86 params = malloc(sizeof(ComponentParameters)+2048);
88 params->flags = 0;
89 params->paramSize = 4;
90 params->what = kComponentOpenSelect;
91 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
92 ret = dispatcher(params, &globals);
93 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
95 // memset(x_table,12,4*0x00001837);
97 //for(i=0;i<=255;i++){
99 // params->what = kComponentVersionSelect;
100 // params->what = kComponentRegisterSelect;
101 // params->what = kComponentOpenSelect;
102 // params->what = kComponentCanDoSelect;
104 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
105 params->flags, params->paramSize, params->what, params->params[0]);
107 // __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
108 // printf("ESP=%p\n",esp);
110 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
112 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
114 ret = dispatcher(params, &globals);
116 // __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
117 // printf("ESP=%p\n",esp);
119 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
120 // if(ret!=-3000) break;
123 // for(i=0;i<0x00001837;i++)
124 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
126 exit(0);
127 //return 0;