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