graphicsdeviceinterface/screendriver/scdv_switch/scdvswitch.cpp
branchRCL_3
changeset 18 5e30ef2e26cb
parent 0 5d03bc08d59c
equal deleted inserted replaced
11:fed1595b188e 18:5e30ef2e26cb
    37 
    37 
    38 #include "scdv_stubs.h"
    38 #include "scdv_stubs.h"
    39 
    39 
    40 FARPROC vector[MAX_ORDINAL+1];
    40 FARPROC vector[MAX_ORDINAL+1];
    41 
    41 
    42 
    42 #ifdef _DEBUG
    43 void Stop(char* aErrorMessage)
    43 void Stop(char* aErrorMessage)
       
    44 #else
       
    45 void Stop(char* /*aErrorMessage*/)
       
    46 #endif
    44 	{
    47 	{
    45 	int err = GetLastError();
    48 	int err = GetLastError();
       
    49 #ifdef _DEBUG
    46 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
    50 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
       
    51 #endif
    47 	_asm int 3;
    52 	_asm int 3;
    48 	}
    53 	}
    49 
    54 
    50 void fill_vector(HINSTANCE aDll)
    55 void fill_vector(HINSTANCE aDll)
    51 	{
    56 	{
    75 	// ask HAL which configuration to use
    80 	// ask HAL which configuration to use
    76 	TBool gce = EFalse;
    81 	TBool gce = EFalse;
    77 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &gce);
    82 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &gce);
    78 	const char* library = gce ? "_generic_scdv.dll" : "_wins_scdv.dll";
    83 	const char* library = gce ? "_generic_scdv.dll" : "_wins_scdv.dll";
    79 
    84 
       
    85 #ifdef _DEBUG
    80 	RDebug::Printf("Redirecting scdv.dll to \"%s\" ...\n", library);
    86 	RDebug::Printf("Redirecting scdv.dll to \"%s\" ...\n", library);
    81 	
    87 #endif
       
    88   	
    82 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
    89 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
    83 	// try to load selected DLL
    90 	// try to load selected DLL
    84 	HINSTANCE instance = LoadLibraryA(library);
    91 	HINSTANCE instance = LoadLibraryA(library);
    85 	Emulator::Reenter();
    92 	Emulator::Reenter();
    86 
    93 
    89 		Stop("... unable to load");
    96 		Stop("... unable to load");
    90 		}
    97 		}
    91 	else
    98 	else
    92 		{
    99 		{
    93 		fill_vector(instance);
   100 		fill_vector(instance);
       
   101 #ifdef _DEBUG
    94 		RDebug::Printf("... DLL loaded successfully");
   102 		RDebug::Printf("... DLL loaded successfully");
       
   103 #endif
    95 		}
   104 		}
    96 	}
   105 	}
    97 
   106 
    98 __declspec(naked) void common_dispatch()
   107 __declspec(naked) void common_dispatch()
    99 	{
   108 	{