NPC::~NPC() { Unload(); }
Win32DllLoader::~Win32DllLoader() { if (m_dllHandle) Unload(); DllLoaderContainer::UnRegisterDll(this); }
void CSkin::Load(LPCTSTR pszFile) { Unload(); FILE* fp = NULL; COLORREF cr; TCHAR szBuff[MAX_PATH]; TCHAR szBase[MAX_PATH]; TCHAR szPath[MAX_PATH]; HINSTANCE hInst = GetInst(); *szBase = NULL; if (pszFile && _tcslen(pszFile)) { // ファイルを開く #ifdef _UNICODE char szFile[MAX_PATH * 2]; WideCharToMultiByte(CP_ACP, NULL, pszFile, -1, szFile, MAX_PATH, NULL, NULL); fp = fopen(szFile, "r"); #else fp = fopen(pszFile, "r"); #endif _tcscpy(szBase, pszFile); LPTSTR p = _tcsrchr(szBase, _T('\\')); if (p) *(p + 1) = NULL; } // Version int nVersion = SKIN_CURRENT_VERSION; if (GetKeyString(fp, SECTION_SKIN, KEY_VERSION, szBuff)) nVersion = _tcstol(szBuff, NULL, 10); // Background GetKeyString(fp, SECTION_SKIN, KEY_BKGROUND, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_hbmpBkgnd = LoadBitmap(szPath); #ifndef _WIN32_WCE_PPC if (!m_hbmpBkgnd) m_hbmpBkgnd = ::LoadBitmap(hInst, (LPCTSTR)IDB_BACK); #endif // Number GetKeyString(fp, SECTION_SKIN, KEY_NUMBER, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_NUMBER] = LoadImageList(IML_NUMBER_WIDTH, IML_NUMBER_HEIGHT, szPath, IDB_NUMBER); // Status GetKeyString(fp, SECTION_SKIN, KEY_STATUS, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_STATUS] = LoadImageList(IML_STATUS_WIDTH, IML_STATUS_HEIGHT, szPath, IDB_STATUS); // PlayOption GetKeyString(fp, SECTION_SKIN, KEY_PLAYOPT, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_PLAYOPT] = LoadImageList(IML_PLAYOPT_WIDTH, IML_PLAYOPT_HEIGHT, szPath, IDB_PLAYOPTION); // Disp GetKeyString(fp, SECTION_SKIN, KEY_DISP, szBuff); if (_tcslen(szBuff)) m_fDispVisible = _tcstol(szBuff, 0, 10) ? TRUE : FALSE; // DispColor GetKeyString(fp, SECTION_SKIN, KEY_DISPCOLOR, szBuff); cr = StrToColor(szBuff); if (cr != -1) m_nColors[COLOR_DISP] = cr; // PeekColorL GetKeyString(fp, SECTION_SKIN, KEY_PEEKCOLORL, szBuff); cr = StrToColor(szBuff); if (cr != -1) m_nColors[COLOR_PEEKL] = cr; // PeekColorR GetKeyString(fp, SECTION_SKIN, KEY_PEEKCOLORR, szBuff); cr = StrToColor(szBuff); if (cr != -1) m_nColors[COLOR_PEEKR] = cr; // InfoColor GetKeyString(fp, SECTION_SKIN, KEY_INFOCOLOR, szBuff); cr = StrToColor(szBuff); if (cr != -1) m_nColors[COLOR_INFO] = cr; // TitleColor GetKeyString(fp, SECTION_SKIN, KEY_TITLECOLOR, szBuff); cr = StrToColor(szBuff); if (cr != -1) m_nColors[COLOR_TITLE] = cr; // SeekColor GetKeyString(fp, SECTION_SKIN, KEY_SEEKCOLOR, szBuff); cr = StrToColor(szBuff); if (cr != -1) m_nColors[COLOR_SEEK] = cr; if (nVersion < SKIN_CURRENT_VERSION) { // Button GetKeyString(fp, SECTION_SKIN, KEY_BUTTON, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_BUTTON] = LoadImageList(IML_BUTTON_WIDTH, IML_BUTTON_HEIGHT, szPath, IDB_BUTTON); } else { // ButtonNormal GetKeyString(fp, SECTION_SKIN, KEY_BUTTONNORMAL, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_BUTTON_NORMAL] = LoadImageList(IML_BUTTON2_WIDTH, IML_BUTTON2_HEIGHT, szPath, IDB_BUTTON_NORMAL); // ButtonPush GetKeyString(fp, SECTION_SKIN, KEY_BUTTONPUSH, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_BUTTON_PUSH] = LoadImageList(IML_BUTTON2_WIDTH, IML_BUTTON2_HEIGHT, szPath, IDB_BUTTON_PUSH); // VolumeSlider GetKeyString(fp, SECTION_SKIN, KEY_VOLUME_SLIDER, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_VOLSLIDER] = LoadImageList(IML_VOLSLIDER_WIDTH, IML_VOLSLIDER_HEIGHT, szPath, IDB_VOLSLIDER); // VolumeTrack GetKeyString(fp, SECTION_SKIN, KEY_VOLUME_TRACK, szBuff); wsprintf(szPath, _T("%s%s"), szBase, szBuff); m_himlImageLists[IMAGELIST_VOLTRACK] = LoadImageList(IML_VOLTRACK_WIDTH, IML_VOLTRACK_HEIGHT, szPath, IDB_VOLTRACK); } if (fp) fclose(fp); }
EDetailManager::~EDetailManager(){ //. Device.seqDevCreate.Remove(this); //. Device.seqDevDestroy.Remove(this); Clear (); Unload (); }
EyeAnglesTester::~EyeAnglesTester ( void ) { Unload (); }
GUIManager::~GUIManager( ) { Unload( ); }
CslGeoIP::~CslGeoIP() { Unload(); WX_CLEAR_ARRAY(m_services); }
MappyLevel::~MappyLevel(){ Unload(); }
//-------------------------------------------------------------------------- VeShaderResource::~VeShaderResource() { Unload(); }
bool VSTEffect::Load() { vstPluginMain pluginMain; bool success = false; mModule = NULL; mAEffect = NULL; #if defined(__WXMAC__) // Start clean mBundleRef = NULL; // Don't really know what this should be initialize to mResource = -1; // Convert the path to a CFSTring wxMacCFStringHolder path(mPath); // Convert the path to a URL CFURLRef urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path, kCFURLPOSIXPathStyle, true); if (urlRef == NULL) { return false; } // Create the bundle using the URL CFBundleRef bundleRef = CFBundleCreate(kCFAllocatorDefault, urlRef); // Done with the URL CFRelease(urlRef); // Bail if the bundle wasn't created if (bundleRef == NULL) { return false; } // Retrieve a reference to the executable CFURLRef exeRef = CFBundleCopyExecutableURL(bundleRef); if (exeRef == NULL) { CFRelease(bundleRef); return false; } // Convert back to path UInt8 exePath[PATH_MAX]; success = CFURLGetFileSystemRepresentation(exeRef, true, exePath, sizeof(exePath)); // Done with the executable reference CFRelease(exeRef); // Bail if we couldn't resolve the executable path if (success == FALSE) { CFRelease(bundleRef); return false; } // Attempt to open it mModule = dlopen((char *) exePath, RTLD_NOW | RTLD_LOCAL); if (mModule == NULL) { CFRelease(bundleRef); return false; } // Try to locate the new plugin entry point pluginMain = (vstPluginMain) dlsym(mModule, "VSTPluginMain"); // If not found, try finding the old entry point if (pluginMain == NULL) { pluginMain = (vstPluginMain) dlsym(mModule, "main_macho"); } // Must not be a VST plugin if (pluginMain == NULL) { dlclose(mModule); mModule = NULL; CFRelease(bundleRef); return false; } // Need to keep the bundle reference around so we can map the // resources. mBundleRef = bundleRef; // Open the resource map ... some plugins (like GRM Tools) need this. mResource = (int) CFBundleOpenBundleResourceMap(bundleRef); #else { wxLogNull nolog; // Try to load the library wxDynamicLibrary *lib = new wxDynamicLibrary(mPath); if (!lib) { return false; } // Bail if it wasn't successful if (!lib->IsLoaded()) { delete lib; return false; } // Try to find the entry point, while suppressing error messages pluginMain = (vstPluginMain) lib->GetSymbol(wxT("VSTPluginMain")); if (pluginMain == NULL) { pluginMain = (vstPluginMain) lib->GetSymbol(wxT("main")); if (pluginMain == NULL) { delete lib; return false; } } // Save the library reference mModule = lib; } #endif // Initialize the plugin mAEffect = pluginMain(audioMaster); // Was it successful? if (mAEffect) { // mAEffect->user = this; // callDispatcher(effOpen, 0, 0, NULL, 0.0); // Ensure that it looks like a plugin and can deal with ProcessReplacing // calls. Also exclude synths for now. if (mAEffect->magic == kEffectMagic && !(mAEffect->flags & effFlagsIsSynth) && mAEffect->flags & effFlagsCanReplacing) { mVendor = GetString(effGetVendorString); mName = GetString(effGetEffectName); mInputs = mAEffect->numInputs; mOutputs = mAEffect->numOutputs; // We could even go so far as to run a small test here. success = true; } } if (!success) { Unload(); } return success; }
CProjectDBI::~CProjectDBI () { Unload (); }
VSTEffect::~VSTEffect() { Unload(); }
virtual ~PosixSharedLibrary() { Unload(); }
/** * @brief * Destructor */ Source::~Source() { // Unload buffer Unload(); }
void TTFFontAsset::Reload() { Unload(); Load(filename, size, textureWidth, textureHeight, glyphRanges); }
HostGameState::~HostGameState() { Unload(); }
bool Guest::Init(Piston::Win32::HWND dlgOwner, Profile &profile) { if(!GuestDev::Plug.DlgOwner) { GuestDev::Plug.DlgOwner = dlgOwner; GuestDev::Plug.Log = &Logger::Log; GuestDev::Plug.StatusItems.Register = &MainForm::Status_Register; GuestDev::Plug.StatusItems.Resize = &MainForm::Status_SetWidth; GuestDev::Plug.StatusItems.SetText = &MainForm::Status_SetText; GuestDev::PlugDev.MemMapAdd = &Guest::Ram::MapAdd; GuestDev::PlugDev.MemMapRemove = &Guest::Ram::MapRemove; GuestDev::PlugDev.PortClaim = &Guest::Ports::Claim; GuestDev::PlugDev.PortRelease = &Guest::Ports::Release; GuestDev::PlugDev.MemRead8 = &Ram::Read8; GuestDev::PlugDev.MemRead16 = &Ram::Read16; GuestDev::PlugDev.MemRead32 = &Ram::Read32; GuestDev::PlugDev.MemWrite8 = &Ram::Write8; GuestDev::PlugDev.MemWrite16 = &Ram::Write16; GuestDev::PlugDev.MemWrite32 = &Ram::Write32; GuestDev::PlugDev.PortRead8 = &Ports::Read8; GuestDev::PlugDev.PortRead16 = &Ports::Read16; GuestDev::PlugDev.PortRead32 = &Ports::Read32; GuestDev::PlugDev.PortWrite8 = &Ports::Write8; GuestDev::PlugDev.PortWrite16 = &Ports::Write16; GuestDev::PlugDev.PortWrite32 = &Ports::Write32; GuestDev::PlugDev.RaiseIRQ = &RaiseIRQ; GuestDev::PlugDev.ResizeScreen = &MainForm::ResizeScreen; // TODO: remove this! Piston::Memory::Copy(&GuestDev::PlugCpu, &GuestDev::PlugDev, sizeof(DevInitData)); GuestDev::PlugCpu.INTA = &INTA; GuestDev::PlugCpu.TimePassed = &TimePassed; Piston::Memory::Copy(&GuestDev::PlugVideo, &GuestDev::PlugDev, sizeof(DevInitData)); GuestDev::PlugVideo.DisplayWindow = MainForm::GetDisplayWindow(); GuestDev::PlugVideo.ResizeScreen = &MainForm::ResizeScreen; Piston::Memory::Copy(&GuestDev::PlugPic, &GuestDev::PlugDev, sizeof(DevInitData)); GuestDev::PlugPic.ExternalInterrupt = &ExternalInterrupt; } Guest::profile = &profile; Unload(); // start with a clean slate if(!Ram::Init(profile.RamSize)) { Piston::Gui::MessageBox::Show(L"TODO: status bar ram failed"); return false; } if(!Ports::Init()) { Piston::Gui::MessageBox::Show(L"TODO: status bar portz failed"); return false; } DevCount = profile.Devs.Count(); Devs = new GuestDev[(unsigned int)DevCount]; for(int i = 0; i < DevCount; ++i) { int32 type = Devs[i].Load(profile.Devs[i]); if(type == (int32)-1) { Piston::Gui::MessageBox::Show(L"TODO: status bar device " + Piston::String::Render(i) + L" failed"); return false; } if(type & PLUGTYPE_CPU) { if(Cpu) { Piston::Gui::MessageBox::Show(L"ERROR: Multiple CPU's", Piston::Gui::MessageBox::Icons::Error); return false; } Cpu = &Devs[i]; } if(type & PLUGTYPE_VIDEO) { if(Video) { Piston::Gui::MessageBox::Show(L"ERROR: Multiple video plugins", Piston::Gui::MessageBox::Icons::Error); return false; } Video = &Devs[i]; } if(type & PLUGTYPE_PIC) { if(Pic) { Piston::Gui::MessageBox::Show(L"ERROR: Multiple PIC plugins", Piston::Gui::MessageBox::Icons::Error); return false; } Pic = &Devs[i]; } } if(!Cpu) { Piston::Gui::MessageBox::Show(L"You must load a CPU.", Piston::Gui::MessageBox::Icons::Error); return false; } if(!Video) { if(Piston::Gui::MessageBox::Show(L"Warning: You have not chosen a display device. " L"Are you sure you want to continue?", Piston::Gui::MessageBox::Buttons::YesNo | Piston::Gui::MessageBox::Icons::Warning) != Piston::Gui::MessageBox::Result::Yes) return false; } if(!Pic) { if(Piston::Gui::MessageBox::Show(L"Warning: No PIC. Continue?", Piston::Gui::MessageBox::Buttons::YesNo | Piston::Gui::MessageBox::Icons::Warning) != Piston::Gui::MessageBox::Result::Yes) return false; } Reset(); return true; }
HRESULT ShaderTable::Load() { HRESULT hr = E_FAIL; HRESULT result = E_FAIL; static int s_initShaderData = false; if (!s_initShaderData) { InitShaderData(); } for (int i = 0 ; i < _countof(s_ShaderVertexData); i++) { ShaderData& data = s_ShaderVertexData[i]; switch (data.eType) { case sdtBytecode: { ShaderBytecode const& SBytecode = data.SBytecode; hr = DxAssist::m_device->CreateVertexShader(SBytecode.Bytecode, SBytecode.Len, 0, &m_vertex[i]); KGLOG_COM_PROCESS_ERROR(hr); hr = DxAssist::CreateInputLayout( SBytecode.Bytecode, SBytecode.Len, &m_layout[i], s_InputLayoutInfos[i].InputElemDesc, s_InputLayoutInfos[i].ElemCount ); KGLOG_COM_PROCESS_ERROR(hr); } break; case sdtFileInfo: { char dir[MAX_PATH] = {0}; ::GetCurrentDirectory(_countof(dir), dir); ID3DBlob* vsblob = 0; FxFileInfo const& fileInfo = data.FileInfo; hr = DxAssist::CreateVertexShader(fileInfo.FileName, fileInfo.EntryPoint, fileInfo.ShaderModel, &m_vertex[i], &vsblob); KGLOG_COM_PROCESS_ERROR(hr); hr = DxAssist::m_device->CreateInputLayout( s_InputLayoutInfos[i].InputElemDesc, s_InputLayoutInfos[i].ElemCount, vsblob->GetBufferPointer(), vsblob->GetBufferSize(), &m_layout[i] ); SAFE_RELEASE(vsblob); KGLOG_COM_PROCESS_ERROR(hr); } break; default: break; } } for (int i = 0 ; i < _countof(s_ShaderPixelData); i++) { ShaderData& data = s_ShaderPixelData[i]; switch (data.eType) { case sdtBytecode: { ShaderBytecode const& SBytecode = data.SBytecode; hr = DxAssist::m_device->CreatePixelShader(SBytecode.Bytecode, SBytecode.Len, 0, &m_pixel[i]); KGLOG_COM_PROCESS_ERROR(hr); } break; case sdtFileInfo: { FxFileInfo const& fileInfo = data.FileInfo; hr = DxAssist::CreatePixelShader(fileInfo.FileName, fileInfo.EntryPoint, fileInfo.ShaderModel, &m_pixel[i]); KGLOG_COM_PROCESS_ERROR(hr); } break; default: break; } } // Exit1: result = S_OK; Exit0: if (FAILED(result)) { Unload(); } return result; }
BlitWave::~BlitWave() { Unload(); }
//----------------------------------------------------------------------------- void AdTiledManager::Load(const char* pName) { Unload(); char pFN[FILENAME_MAX]; sprintf(pFN, MAP_LOCATION, pName); duk_context* ctx = s_pJSCtx; duk_push_string_file(ctx, pFN); duk_json_decode(ctx, -1); if(!duk_is_object(ctx, -1)) { fprintf(stderr, "NOTE: Failed parse %s.json!\n", pName); return; } duk_get_prop_string(ctx, -1, "width"); m_iWidth = duk_to_int(ctx, -1); duk_pop(ctx); duk_get_prop_string(ctx, -1, "height"); m_iHeight = duk_to_int(ctx, -1); duk_pop(ctx); duk_get_prop_string(ctx, -1, "layers"); if(duk_is_array(ctx, -1)) { m_nLayers = duk_get_length(ctx, -1); m_pIndices = (int**) calloc(m_nLayers, sizeof(int*)); for(int j=0; j<m_nLayers; ++j) { duk_get_prop_index(ctx, -1, j); // NOTE: if this is a tile layer grab the indices, otherwise set // to NULL duk_get_prop_string(ctx, -1, "data"); if(duk_is_array(ctx, -1)) { int size = duk_get_length(ctx, -1); if((m_iWidth*m_iHeight) == size) { m_pIndices[j] = (int*) malloc(size*sizeof(int)); for(int i=0; i<size; ++i) { duk_get_prop_index(ctx, -1, i); m_pIndices[j][i] = duk_to_int(ctx, -1); duk_pop(ctx); } } } duk_pop(ctx); // NOTE: loop over the map entities and add them to the array of // entities duk_get_prop_string(ctx, -1, "name"); if(duk_is_string(ctx, -1)) { if(!strcmp(duk_get_string(ctx, -1), "entities")) { // NOTE: -2 referring back to object and not the string duk_get_prop_string(ctx, -2, "objects"); if(duk_is_array(ctx, -1)) { int size = duk_get_length(ctx, -1); for(int e=0; e<size; ++e) { duk_get_prop_index(ctx, -1, e); duk_get_prop_string(ctx, -1, "type"); const char* type = duk_get_string(ctx, -1); AdEntity* pEnt = NULL; if(!strcmp(type, "NPC-PLAYER")) { duk_pop(ctx); pEnt = new AdPlayer(); pEnt->Load(ctx); } else if(!strcmp(type, "NPC-TEST")) { duk_pop(ctx); pEnt = new AdMoveable(); pEnt->Load(ctx); } else if(!strcmp(type, "TEST")) { duk_pop(ctx); pEnt = new AdEntity(); pEnt->Load(ctx); } else { duk_pop(ctx); } if(pEnt) { m_pEntities = (AdEntity**) realloc( m_pEntities, ++m_nEntities*sizeof(AdEntity*) ); m_pEntities[m_nEntities-1] = pEnt; } duk_pop(ctx); } } duk_pop(ctx); } } duk_pop_2(ctx); } } duk_pop_2(ctx); }
FFontChar1::~FFontChar1 () { Unload (); }
Font::~Font() { Unload(); }
/** 析构函数 */ FZipFilePack::~FZipFilePack(void) { Unload(); }
void Font::Reload() { Unload(); ASSERT( !path.empty() ); Load( path, m_sChars ); }
void _SpellScript::_Unload() { m_currentScriptState = SPELL_SCRIPT_STATE_UNLOADING; Unload(); m_currentScriptState = SPELL_SCRIPT_STATE_NONE; }
AudioAsset::~AudioAsset() { Unload(); }
CSkin::~CSkin() { Unload(); }
TTFFontAsset::~TTFFontAsset() { Unload(); }
SPFont::~SPFont(void) { Unload(); }
aui_DirectSound::~aui_DirectSound() { Unload(); }