#include "../stdafx.h" #include #include "CVideoHandler.h" #include "SDL.h" void DLLHandler::Instantiate(const char *filename) { dll = LoadLibraryA(filename); } const char *DLLHandler::GetLibExtension() { #ifdef WIN32 return "dll"; #elif defined(__APPLE__) return "dylib"; #else return "so"; #endif } void *DLLHandler::FindAddress234(const char *symbol) { if ((int)symbol == 0x00001758) return NULL; std::cout<<"co ja tu robie"< 0 then // Error := EOSError.CreateResFmt(@SOSError, [LastError, // SysErrorMessage(LastError)]) // else // Error := EOSError.CreateRes(@SUnkOSError); // Error.ErrorCode := LastError; // raise Error at Offset; //end; //void RSRaiseLastOSError() //{ // __asm // { // mov eax, [esp] // sub eax, 5 // jmp RaiseLastOSErrorAt // } //} //int RSWin32Check(int CheckForZero) //{ // __asm // { // test eax, eax // jz RSRaiseLastOSError // } //} void CBIKHandler::open(std::string name) { hBinkFile = CreateFile ( L"CSECRET.BIK", // file name GENERIC_READ, // access mode FILE_SHARE_READ, // share mode NULL, // Security Descriptor OPEN_EXISTING, // how to create FILE_ATTRIBUTE_NORMAL,//FILE_FLAG_SEQUENTIAL_SCAN, // file attributes 0 // handle to template file ); //RSWin32Check(hBinkFile!=INVALID_HANDLE_VALUE); if(hBinkFile == INVALID_HANDLE_VALUE) { printf("failed to open \"%s\"\n", name.c_str()); return ; } try { BinkGetError = ourLib.FindAddress234("_BinkGetError@0"); BinkOpen = ourLib.FindAddress234("_BinkOpen@8"); if (!waveOutOpen) { BinkSetSoundSystem = ourLib.FindAddress234("_BinkSetSoundSystem@8"); ((void(*)(void*,void*))BinkSetSoundSystem)(waveOutOpen,NULL); } std::cout<<"punkt kulminacyjny... "<width; height = hBink->height; BITMAP gg; gg.bmWidth=width; gg.bmHeight=height; gg.bmBitsPixel=24; gg.bmPlanes=1; gg.bmWidthBytes=3*width; gg.bmBits = new unsigned char[width*height*(gg.bmBitsPixel/8)]; //HBITMAP bitmapa = CreateBitmap(width, height,1,24,NULL); std::cout<<"przeszlo!"<nil then // begin // with PLogPalette(@Pal)^ do // begin // palVersion:=$300; // palNumEntries:=BinkGetPalette(@palPalEntry); // for j:=0 to palNumEntries-1 do // int(palPalEntry[j]):=RSSwapColor(int(palPalEntry[j])); // end; // b.Palette:=CreatePalette(PLogPalette(@Pal)^); // end else // b.PixelFormat:=pf24bit; // end; // // else // b.PixelFormat:=pf24bit; // end // //end;