Mercurial > mplayer.hg
annotate loader/qtx/qtxload.c @ 25773:dfeedb0580f0
Add missing #include, fixes the warning:
elfdll.c:106: warning: implicit declaration of function 'TRACE'
author | diego |
---|---|
date | Sat, 19 Jan 2008 15:04:33 +0000 |
parents | 96ce0ca753ff |
children | 2c8cdb9123b8 |
rev | line source |
---|---|
2501 | 1 #include <stdio.h> |
2796 | 2 #include <stdlib.h> |
3 #include <string.h> | |
4 | |
2501 | 5 #include "qtxsdk/components.h" |
2778 | 6 #include "qtxsdk/select.h" |
2501 | 7 |
8 /* ilyen egy sima komponens */ | |
9 ComponentResult ComponentDummy( | |
2778 | 10 ComponentParameters *params, |
2501 | 11 void **globals, |
25589
276d47411414
Fix compilation by replacing a broken macro with in-place code.
diego
parents:
18889
diff
changeset
|
12 ComponentResult (*ComponentDispatch)(ComponentParameters *, void **)) |
2501 | 13 { |
14 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n", | |
15 params, globals, ComponentDispatch); | |
16 printf(" Dummy: global datas: %p\n", *globals); | |
17 printf(" Dummy: returning 0\n"); | |
18 return(0); | |
19 } | |
20 | |
18889
e60c8c7399d2
get_path as const, patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
16194
diff
changeset
|
21 char *get_path(const char* x){ return strdup(x);} |
2796 | 22 |
3935 | 23 void* LoadLibraryA(char* name); |
2796 | 24 void* GetProcAddress(void* handle,char* func); |
25 | |
26 #define __stdcall __attribute__((__stdcall__)) | |
27 #define __cdecl __attribute__((__cdecl__)) | |
28 #define APIENTRY | |
2501 | 29 |
3935 | 30 unsigned int* x_table[0x00001837]; |
31 | |
8268 | 32 static OSErr (*InitializeQTML)(long flags); |
33 | |
2796 | 34 int main(int argc, char *argv[]){ |
2501 | 35 void *handler; |
8268 | 36 void *handler2; |
37 void* theqtdp=NULL; | |
38 void* compcall=NULL; | |
39 void* compcallws=NULL; | |
16194 | 40 ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob); |
2796 | 41 ComponentResult ret; |
42 ComponentParameters *params; | |
43 ComponentDescription desc; | |
44 void *globals=NULL; | |
45 unsigned int esp=0; | |
3935 | 46 int i; |
2501 | 47 |
8268 | 48 mp_msg_init(); |
25590
62959db3a504
Comment out non-existing mp_msg_set_level function to fix linking.
diego
parents:
25589
diff
changeset
|
49 //mp_msg_set_level(10); |
8268 | 50 |
2501 | 51 Setup_LDT_Keeper(); |
8268 | 52 printf("loading qts\n"); |
53 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts"); | |
54 handler = LoadLibraryA("QuickTime.qts"); | |
55 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher"); | |
56 compcall = GetProcAddress(handler, "_CallComponent"); | |
57 compcallws = GetProcAddress(handler, "_CallComponentFunctionWithStorage"); | |
58 | |
59 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML"); | |
60 InitializeQTML(6+16); | |
61 | |
62 printf("loading svq3\n"); | |
63 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx"); | |
64 printf("done\n"); | |
65 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch"); | |
25593 | 66 // handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx"); |
2796 | 67 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher"); |
8268 | 68 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp); |
69 | |
70 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher")); | |
2796 | 71 |
8268 | 72 // patch svq3 dll: |
73 *((void**)0x63214c98) = NULL; | |
74 *((void**)0x63214c9c) = theqtdp; // theQt... | |
75 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr | |
76 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr | |
3935 | 77 |
2796 | 78 desc.componentType=0; |
79 desc.componentSubType=0; | |
80 desc.componentManufacturer=0; | |
81 desc.componentFlags=0; | |
82 desc.componentFlagsMask=0; | |
2501 | 83 |
2796 | 84 params = malloc(sizeof(ComponentParameters)+2048); |
2501 | 85 |
2796 | 86 params->flags = 0; |
8268 | 87 params->paramSize = 4; |
88 params->what = kComponentOpenSelect; | |
89 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024; | |
3935 | 90 ret = dispatcher(params, &globals); |
91 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals); | |
92 | |
93 // memset(x_table,12,4*0x00001837); | |
94 | |
95 //for(i=0;i<=255;i++){ | |
2778 | 96 |
2796 | 97 // params->what = kComponentVersionSelect; |
98 // params->what = kComponentRegisterSelect; | |
8268 | 99 // params->what = kComponentOpenSelect; |
2796 | 100 // params->what = kComponentCanDoSelect; |
2778 | 101 |
2796 | 102 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n", |
103 params->flags, params->paramSize, params->what, params->params[0]); | |
2778 | 104 |
3935 | 105 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" ); |
106 // printf("ESP=%p\n",esp); | |
107 | |
108 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack? | |
109 | |
110 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]); | |
2778 | 111 |
2796 | 112 ret = dispatcher(params, &globals); |
113 | |
3935 | 114 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" ); |
115 // printf("ESP=%p\n",esp); | |
2778 | 116 |
3935 | 117 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals); |
118 // if(ret!=-3000) break; | |
119 //} | |
120 | |
121 // for(i=0;i<0x00001837;i++) | |
122 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]); | |
2501 | 123 |
2796 | 124 Restore_LDT_Keeper(); |
125 exit(0); | |
126 //return 0; | |
2501 | 127 } |