annotate loader/qtx/qtxload.c @ 10103:7b338ec311e2

change real codecs dir priority as discussed with al3x, hopefully the syntax is korn shell compatible, please test!
author atmos4
date Mon, 12 May 2003 22:52:23 +0000
parents a85040e4b1a0
children 167342641f0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2582
1616ad8fec1b hm, non-working :)
alex
parents: 2502
diff changeset
1 /* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */
1616ad8fec1b hm, non-working :)
alex
parents: 2502
diff changeset
2
2501
alex
parents:
diff changeset
3 #include <stdio.h>
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
4 #include <stdlib.h>
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
5 #include <string.h>
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
6
2501
alex
parents:
diff changeset
7 #include "qtxsdk/components.h"
2778
arpi
parents: 2768
diff changeset
8 #include "qtxsdk/select.h"
2501
alex
parents:
diff changeset
9
2778
arpi
parents: 2768
diff changeset
10 #define DEF_DISPATCHER(name) ComponentResult (*##name)(ComponentParameters *, void **)
2501
alex
parents:
diff changeset
11
alex
parents:
diff changeset
12 /* ilyen egy sima komponens */
alex
parents:
diff changeset
13 ComponentResult ComponentDummy(
2778
arpi
parents: 2768
diff changeset
14 ComponentParameters *params,
2501
alex
parents:
diff changeset
15 void **globals,
alex
parents:
diff changeset
16 DEF_DISPATCHER(ComponentDispatch))
alex
parents:
diff changeset
17 {
alex
parents:
diff changeset
18 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
alex
parents:
diff changeset
19 params, globals, ComponentDispatch);
alex
parents:
diff changeset
20 printf(" Dummy: global datas: %p\n", *globals);
alex
parents:
diff changeset
21 printf(" Dummy: returning 0\n");
alex
parents:
diff changeset
22 return(0);
alex
parents:
diff changeset
23 }
alex
parents:
diff changeset
24
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
25 char *get_path(char* x){ return strdup(x);}
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
26
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
27 void* LoadLibraryA(char* name);
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
28 void* GetProcAddress(void* handle,char* func);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
29
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
30 #define __stdcall __attribute__((__stdcall__))
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
31 #define __cdecl __attribute__((__cdecl__))
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
32 #define APIENTRY
2501
alex
parents:
diff changeset
33
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
34 unsigned int* x_table[0x00001837];
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
35
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
36 static OSErr (*InitializeQTML)(long flags);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
37
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
38 int main(int argc, char *argv[]){
2501
alex
parents:
diff changeset
39 void *handler;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
40 void *handler2;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
41 void* theqtdp=NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
42 void* compcall=NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
43 void* compcallws=NULL;
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
44 ComponentResult (*
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
45 dispatcher)(ComponentParameters *params, Globals glob);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
46 ComponentResult ret;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
47 ComponentParameters *params;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
48 ComponentDescription desc;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
49 void *globals=NULL;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
50 unsigned int esp=0;
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
51 int i;
2501
alex
parents:
diff changeset
52
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
53 mp_msg_init();
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
54 mp_msg_set_level(10);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
55
2501
alex
parents:
diff changeset
56 Setup_LDT_Keeper();
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
57 printf("loading qts\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
58 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
59 handler = LoadLibraryA("QuickTime.qts");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
60 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
61 compcall = GetProcAddress(handler, "_CallComponent");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
62 compcallws = GetProcAddress(handler, "_CallComponentFunctionWithStorage");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
63
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
64 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
65 InitializeQTML(6+16);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
66
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
67 printf("loading svq3\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
68 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
69 printf("done\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
70 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
71 // handler = expLoadLibraryA("/usr/lib/win32/On2_VP3.qtx");
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
72 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
73 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
74
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
75 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
76
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
77 // patch svq3 dll:
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
78 *((void**)0x63214c98) = NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
79 *((void**)0x63214c9c) = theqtdp; // theQt...
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
80 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
81 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
82
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
83 desc.componentType=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
84 desc.componentSubType=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
85 desc.componentManufacturer=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
86 desc.componentFlags=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
87 desc.componentFlagsMask=0;
2501
alex
parents:
diff changeset
88
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
89 params = malloc(sizeof(ComponentParameters)+2048);
2501
alex
parents:
diff changeset
90
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
91 params->flags = 0;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
92 params->paramSize = 4;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
93 params->what = kComponentOpenSelect;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
94 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
95 ret = dispatcher(params, &globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
96 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
97
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
98 // memset(x_table,12,4*0x00001837);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
99
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
100 //for(i=0;i<=255;i++){
2778
arpi
parents: 2768
diff changeset
101
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
102 // params->what = kComponentVersionSelect;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
103 // params->what = kComponentRegisterSelect;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
104 // params->what = kComponentOpenSelect;
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
105 // params->what = kComponentCanDoSelect;
2778
arpi
parents: 2768
diff changeset
106
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
107 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
108 params->flags, params->paramSize, params->what, params->params[0]);
2778
arpi
parents: 2768
diff changeset
109
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
110 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
111 // printf("ESP=%p\n",esp);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
112
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
113 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
114
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
115 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
2778
arpi
parents: 2768
diff changeset
116
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
117 ret = dispatcher(params, &globals);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
118
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
119 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
120 // printf("ESP=%p\n",esp);
2778
arpi
parents: 2768
diff changeset
121
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
122 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
123 // if(ret!=-3000) break;
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
124 //}
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
125
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
126 // for(i=0;i<0x00001837;i++)
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
127 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
2501
alex
parents:
diff changeset
128
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
129 Restore_LDT_Keeper();
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
130 exit(0);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
131 //return 0;
2501
alex
parents:
diff changeset
132 }