//------------------------------------------------------------- // exports car model. Car models are typical MODEL structures //------------------------------------------------------------- void ExportCarModel(MODEL* model, int size, int index, const char* name_suffix) { EqString model_name(varargs("%s/CARMODEL_%d_%s", g_levname_moddir.c_str(), index, name_suffix)); // export model ExportDMODELToOBJ(model, model_name.c_str(), index, true); // save original dmodel2 IFile* dFile = GetFileSystem()->Open(varargs("%s.dmodel", model_name.c_str()), "wb", SP_ROOT); if(dFile) { dFile->Write(model, size, 1); GetFileSystem()->Close(dFile); } }
//------------------------------------------------------------- // exports model to single file //------------------------------------------------------------- void ExportDMODELToOBJ(MODEL* model, const char* model_name, int model_index, bool isCarModel = false) { IFile* mdlFile = GetFileSystem()->Open(varargs("%s.obj", model_name), "wb", SP_ROOT); if(mdlFile) { Msg("----------\nModel %s (%d)\n", model_name, model_index); mdlFile->Print("mtllib MODELPAGES.mtl\r\n"); WriteMODELToObjStream( mdlFile, model, model_index, true ); // success GetFileSystem()->Close(mdlFile); } }
bool CModelViewerApp::PreRunApp() { m_pState = new CHLMVState(); m_pSettings = new CHLMVSettings( GetFileSystem() ); //TODO: fix on Linux - Solokiller SetToolIcon( wxICON( HLMV_ICON ) ); SetEntityList( &g_EntityList ); if( !EntityManager().OnMapBegin() ) { FatalError( "Failed to start map\n" ); return false; } //Must be called before we create the main window, since it accesses the window. UseMessagesWindow( true ); if( !GetSettings()->Initialize( HLMV_SETTINGS_FILE ) ) { return false; } m_pMainWindow = new hlmv::CMainWindow( this ); m_pMainWindow->Show( true ); if( !m_szModel.IsEmpty() ) LoadModel( m_szModel ); return true; }
int DeviceDir::MakeDir(const char name[], size_t length) { if (FindEntry(name, length)) return E_ENTRY_EXISTS; fEntryList.AddToTail(new DeviceDir(GetFileSystem(), name, length, this)); return E_NO_ERROR; }
bool GetFSPath( const Path &inPath, Path &outPath ) { FileSystemRef sys = GetFileSystem( inPath ); if ( sys ) { outPath = sys->mapTo( inPath ); return true; } return false; }
void Directory::GetName(nsAString& aRetval, ErrorResult& aRv) { aRetval.Truncate(); RefPtr<FileSystemBase> fs = GetFileSystem(aRv); if (NS_WARN_IF(aRv.Failed())) { return; } fs->GetDirectoryName(mFile, aRetval, aRv); }
already_AddRefed<Promise> Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive, ErrorResult& aRv) { // Only exposed for DeviceStorage. MOZ_ASSERT(NS_IsMainThread()); nsresult error = NS_OK; nsCOMPtr<nsIFile> realPath; // Check and get the target path. RefPtr<FileSystemBase> fs = GetFileSystem(aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } // If this is a File if (aPath.IsFile()) { if (!fs->GetRealPath(aPath.GetAsFile().Impl(), getter_AddRefs(realPath))) { error = NS_ERROR_DOM_SECURITY_ERR; } // If this is a string } else if (aPath.IsString()) { error = DOMPathToRealPath(aPath.GetAsString(), getter_AddRefs(realPath)); // Directory } else { MOZ_ASSERT(aPath.IsDirectory()); if (!fs->IsSafeDirectory(&aPath.GetAsDirectory())) { error = NS_ERROR_DOM_SECURITY_ERR; } else { realPath = aPath.GetAsDirectory().mFile; } } // The target must be a descendant of this directory. if (!FileSystemUtils::IsDescendantPath(mFile, realPath)) { error = NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR; } RefPtr<RemoveTaskChild> task = RemoveTaskChild::Create(fs, mFile, realPath, aRecursive, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } task->SetError(error); FileSystemPermissionRequest::RequestForTask(task); return task->GetPromise(); }
bool TextureLoader::Load(const char * name) { m_reader = GetFileSystem()->FindResource_(name,IDTEXHEADER); if (!m_reader) { return false; } if (!m_reader.Read(&m_head,sizeof(hft_texture))) return false; return true; }
already_AddRefed<Promise> Directory::CreateFile(const nsAString& aPath, const CreateFileOptions& aOptions, ErrorResult& aRv) { // Only exposed for DeviceStorage. MOZ_ASSERT(NS_IsMainThread()); RefPtr<Blob> blobData; InfallibleTArray<uint8_t> arrayData; bool replace = (aOptions.mIfExists == CreateIfExistsMode::Replace); // Get the file content. if (aOptions.mData.WasPassed()) { auto& data = aOptions.mData.Value(); if (data.IsString()) { NS_ConvertUTF16toUTF8 str(data.GetAsString()); arrayData.AppendElements(reinterpret_cast<const uint8_t *>(str.get()), str.Length()); } else if (data.IsArrayBuffer()) { const ArrayBuffer& buffer = data.GetAsArrayBuffer(); buffer.ComputeLengthAndData(); arrayData.AppendElements(buffer.Data(), buffer.Length()); } else if (data.IsArrayBufferView()){ const ArrayBufferView& view = data.GetAsArrayBufferView(); view.ComputeLengthAndData(); arrayData.AppendElements(view.Data(), view.Length()); } else { blobData = data.GetAsBlob(); } } nsCOMPtr<nsIFile> realPath; nsresult error = DOMPathToRealPath(aPath, getter_AddRefs(realPath)); RefPtr<FileSystemBase> fs = GetFileSystem(aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } RefPtr<CreateFileTaskChild> task = CreateFileTaskChild::Create(fs, realPath, blobData, arrayData, replace, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } task->SetError(error); FileSystemPermissionRequest::RequestForTask(task); return task->GetPromise(); }
void Player::Setup() { #if DESKTOP FileSystem* fs = GetFileSystem(); engineParameters_[EP_RESOURCE_PREFIX_PATHS] = fs->GetProgramDir() + ";" + fs->GetCurrentDir(); #endif engineParameters_[EP_RESOURCE_PATHS] = "Cache;Resources"; JSONFile file(context_); if (!file.LoadFile(ToString("%s%s", APK, "Settings.json"))) return; for (auto& pair : file.GetRoot().GetObject()) engineParameters_[pair.first] = pair.second.GetVariant(); }
already_AddRefed<Promise> Directory::GetFilesAndDirectories(ErrorResult& aRv) { RefPtr<FileSystemBase> fs = GetFileSystem(aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } RefPtr<GetDirectoryListingTaskChild> task = GetDirectoryListingTaskChild::Create(fs, mFile, mFilters, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } FileSystemPermissionRequest::RequestForTask(task); return task->GetPromise(); }
void Directory::GetPath(nsAString& aRetval, ErrorResult& aRv) { // This operation is expensive. Better to cache the result. if (mPath.IsEmpty()) { RefPtr<FileSystemBase> fs = GetFileSystem(aRv); if (NS_WARN_IF(aRv.Failed())) { return; } fs->GetDOMPath(mFile, mPath, aRv); if (NS_WARN_IF(aRv.Failed())) { return; } } aRetval = mPath; }
already_AddRefed<Promise> Directory::GetFiles(bool aRecursiveFlag, ErrorResult& aRv) { ErrorResult rv; RefPtr<FileSystemBase> fs = GetFileSystem(rv); if (NS_WARN_IF(rv.Failed())) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } RefPtr<GetFilesTaskChild> task = GetFilesTaskChild::Create(fs, mFile, aRecursiveFlag, rv); if (NS_WARN_IF(rv.Failed())) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } FileSystemPermissionRequest::RequestForTask(task); return task->GetPromise(); }
bool ZApplication::InitLocale() { ZGetLocale()->Init( GetCountryID(ZGetConfiguration()->GetLocale()->strCountry.c_str())); char szPath[MAX_PATH] = "system/"; // 유저가 다른 언어를 선택했는지 확인 if (!ZGetConfiguration()->IsUsingDefaultLanguage()) { const char* szSelectedLanguage = ZGetConfiguration()->GetSelectedLanguage(); // 디폴트 언어가 아니라면 언어를 새로 설정한다 ZGetLocale()->SetLanguage( GetLanguageID(szSelectedLanguage) ); // 스트링을 로딩할 경로를 선택된 언어에 맞추어 수정 strcat(szPath, szSelectedLanguage); strcat(szPath, "/"); } ZGetStringResManager()->Init(szPath, ZGetLocale()->GetLanguage(), GetFileSystem()); return true; }
already_AddRefed<Promise> Directory::Get(const nsAString& aPath, ErrorResult& aRv) { // Only exposed for DeviceStorage. MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr<nsIFile> realPath; nsresult error = DOMPathToRealPath(aPath, getter_AddRefs(realPath)); RefPtr<FileSystemBase> fs = GetFileSystem(aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } RefPtr<GetFileOrDirectoryTaskChild> task = GetFileOrDirectoryTaskChild::Create(fs, realPath, false, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } task->SetError(error); FileSystemPermissionRequest::RequestForTask(task); return task->GetPromise(); }
bool Player::LoadPlugins(const JSONValue& plugins) { // Load plugins. bool failure = false; #if URHO3D_PLUGINS || URHO3D_CSHARP for (auto i = 0; i < plugins.Size(); i++) { if (plugins[i]["private"].GetBool()) continue; ea::string pluginName = plugins[i]["name"].GetString(); ea::string pluginFileName; bool loaded = false; #if !_WIN32 // Native plugins on unixes #if __linux__ pluginFileName = "lib" + pluginName + ".so"; #elif APPLE pluginFileName = "lib" + pluginName + ".dylib"; #endif #if URHO3D_PLUGINS #if MOBILE // On mobile libraries are loaded already so it is ok to not check for existence, TODO: iOS loaded = LoadAssembly(pluginFileName, PLUGIN_NATIVE); #else // On desktop we can access file system as usual if (GetFileSystem()->Exists(pluginFileName)) loaded = LoadAssembly(pluginFileName); else { pluginFileName = GetFileSystem()->GetProgramDir() + pluginFileName; if (GetFileSystem()->Exists(pluginFileName)) loaded = LoadAssembly(pluginFileName); } #endif // MOBILE #endif // URHO3D_PLUGINS #endif // !_WIN32 #if _WIN32 || URHO3D_CSHARP // Native plugins on windows or managed plugins on all platforms if (!loaded) { pluginFileName = pluginName + ".dll"; #if ANDROID pluginFileName = ea::string(APK) + "assets/.net/" + pluginFileName; #endif if (GetFileSystem()->Exists(pluginFileName)) loaded = LoadAssembly(pluginFileName); #if DESKTOP else { pluginFileName = GetFileSystem()->GetProgramDir() + pluginFileName; if (GetFileSystem()->Exists(pluginFileName)) loaded = LoadAssembly(pluginFileName); } #endif } #endif if (!loaded) { URHO3D_LOGERRORF("Loading of '%s' assembly failed.", pluginName.c_str()); return false; } } #endif // URHO3D_PLUGINS return true; }
FileSystemQ3API(){ FileSystem_Init(); m_filesystemq3 = &GetFileSystem(); }
void ExportLevelData() { Msg("-------------\nExporting level data\n-------------\n"); // export models if(g_export_models.GetBool()) { Msg("exporting models\n"); for(int i = 0; i < g_levelModels.numElem(); i++) { if(!g_levelModels[i].model) continue; EqString modelFileName = varargs("%s/ZMOD_%d", g_levname_moddir.c_str(), i); if(g_model_names[i].GetLength()) modelFileName = varargs("%s/%d_%s", g_levname_moddir.c_str(), i, g_model_names[i]); // export model ExportDMODELToOBJ(g_levelModels[i].model, modelFileName.c_str(), i); // save original dmodel2 IFile* dFile = GetFileSystem()->Open(varargs("%s.dmodel", modelFileName.c_str()), "wb", SP_ROOT); if(dFile) { dFile->Write(g_levelModels[i].model, g_levelModels[i].size, 1); GetFileSystem()->Close(dFile); } } // create material file IFile* pMtlFile = GetFileSystem()->Open(varargs("%s/MODELPAGES.mtl", g_levname_moddir.c_str()), "wb", SP_ROOT); if(pMtlFile) { for(int i = 0; i < g_numTexPages; i++) { pMtlFile->Print("newmtl page_%d\r\n", i); pMtlFile->Print("map_Kd ../../%s/PAGE_%d.tga\r\n", g_levname_texdir.c_str(), i); } GetFileSystem()->Close(pMtlFile); } } // export car models if(g_export_carmodels.GetBool()) { for(int i = 0; i < MAX_CAR_MODELS; i++) { ExportCarModel(g_carModels[i].cleanmodel, g_carModels[i].cleanSize, i, "clean"); ExportCarModel(g_carModels[i].lowmodel, g_carModels[i].lowSize, i, "low"); // TODO: export damaged model } } // export world region if(g_export_world.GetBool()) { Msg("exporting cell points and world model\n"); ExportRegions(); } if(g_export_textures.GetBool()) { // preload region data if needed if(!g_export_world.GetBool()) { Msg("preloading region datas (%d)\n", g_numRegionDatas); for(int i = 0; i < g_numRegionDatas; i++) { LoadRegionData( g_levStream, NULL, &g_regionDataDescs[i], &g_regionPages[i] ); } } Msg("exporting texture data\n"); for(int i = 0; i < g_numTexPages; i++) { ExportTexturePage(i); } // create material file IFile* pMtlFile = GetFileSystem()->Open(varargs("%s_LEVELMODEL.mtl", g_levname.c_str()), "wb", SP_ROOT); if(pMtlFile) { for(int i = 0; i < g_numTexPages; i++) { pMtlFile->Print("newmtl page_%d\r\n", i); pMtlFile->Print("map_Kd %s_textures/PAGE_%d.tga\r\n", g_levname.Path_Extract_Name().c_str(), i); } GetFileSystem()->Close(pMtlFile); } } Msg("Export done\n"); // create material file IFile* pLevFile = GetFileSystem()->Open(varargs("%s.lev", g_levname.c_str()), "wb"); if(pLevFile) { g_levStream->Seek(g_levSize, VS_SEEK_SET); ((CMemoryStream*)g_levStream)->WriteToFileStream(pLevFile); GetFileSystem()->Close(pLevFile); } }
void ExportRegions() { int counter = 0; int dim_x = g_mapInfo.width / g_mapInfo.visTableWidth; int dim_y = g_mapInfo.height / g_mapInfo.visTableWidth; Msg("World size:\n [%dx%d] vis cells\n [%dx%d] regions\n", g_mapInfo.width, g_mapInfo.height, dim_x, dim_y); // print region map to console for(int i = 0; i < g_numRegionOffsets; i++, counter++) { // Debug information: Print the map to the console. Msg(g_regionOffsets[i] == REGION_EMPTY ? "." : "O"); if(counter == dim_x) { Msg("\n"); counter = 0; } } Msg("\n"); int numCellObjectsRead = 0; IFile* objFile = NULL; IFile* levModelFile = NULL; objFile = GetFileSystem()->Open(varargs("%s_CELLPOS_MAP.obj", g_levname.c_str()), "wb", SP_ROOT); levModelFile = GetFileSystem()->Open(varargs("%s_LEVELMODEL.obj", g_levname.c_str()), "wb", SP_ROOT); levModelFile->Print("mtllib %s_LEVELMODEL.mtl\r\n", g_levname.c_str()); int lobj_first_v = 0; int lobj_first_t = 0; // 2d region map // easy seeking for(int y = 0; y < dim_y; y++) { for(int x = 0; x < dim_x; x++) { int sPosIdx = y*dim_x + x; if(g_regionOffsets[sPosIdx] == REGION_EMPTY) continue; // determine region position int region_pos_x = x * 65536; int region_pos_z = y * 65536; // region at offset Spool* spool = (Spool*)((ubyte*)g_regionSpool + g_regionOffsets[sPosIdx]); Msg("---------\nSpool %d %d (offset: %d)\n", x, y, g_regionOffsets[sPosIdx]); Msg("offset: %d\n",spool->offset); Msg("connected areas offset: %d\n",spool->connected_areas); Msg("connected areas count: %d\n",spool->num_connected_areas); Msg("pvs block size: %d\n",spool->pvs_size); //Msg("padding: %d %d\n",spool->_padding,spool->_padding2); Msg("cell data size: %d\n",spool->cell_data_size); Msg("super regions: %d\n",spool->super_region); Msg("roadm size: %d\n",spool->roadm_size); Msg("roadh size: %d\n",spool->roadh_size); int cellsOffset = g_levInfo.spooldata_offset + 2048 * (spool->offset + spool->pvs_size + spool->cell_data_size); if(g_region_format.GetInt() == 2) // driver 2 demo { cellsOffset = g_levInfo.spooldata_offset + 2048 * (spool->offset + spool->pvs_size + spool->cell_data_size + spool->roadm_size ); } else if(g_region_format.GetInt() == 1) // driver 1 { ASSERT(!"diferrent packed cells used?\n"); } Msg("cell objects ofs: %d\n", cellsOffset); RegionModels_t* regModels = NULL; // if region data is available, load models and textures if(spool->super_region != SUPERREGION_NONE) { regModels = &g_regionModels[spool->super_region]; bool isNew = (regModels->modelRefs.numElem() == 0); LoadRegionData(g_levStream, regModels, &g_regionDataDescs[spool->super_region], &g_regionPages[spool->super_region]); if( g_export_models.GetBool() && isNew ) { // export region models for(int i = 0; i < regModels->modelRefs.numElem(); i++) { int mod_indxex = regModels->modelRefs[i].index; EqString modelFileName = varargs("%s/ZREG%d_MOD_%d", g_levname_moddir.c_str(), spool->super_region, mod_indxex); if(g_model_names[mod_indxex].GetLength()) modelFileName = varargs("%s/ZREG%d_%d_%s", g_levname_moddir.c_str(), spool->super_region, i, g_model_names[mod_indxex]); // export model ExportDMODELToOBJ(regModels->modelRefs[i].model, modelFileName.c_str(), regModels->modelRefs[i].index); } } } // seek to cells g_levStream->Seek(cellsOffset, VS_SEEK_SET); int cell_count = 0; objFile->Print("#--------\r\n# region %d %d (ofs=%d)\r\n", x, y, cellsOffset); objFile->Print("g cell_%d\r\n", sPosIdx); PACKED_CELL_OBJECT object; do { g_levStream->Read(&object, 1, sizeof(PACKED_CELL_OBJECT)); // bad hack, need to parse visibility data for it if( (0x4544 == object.pos_x && 0x2153 == object.addidx_pos_y) || (0x4809 == object.pos_x && 0x4809 == object.addidx_pos_y) || (0xA608 == object.pos_x && 0xA608 == object.addidx_pos_y) ||cell_count >= 8192) break; // unpack cell CELL_OBJECT cell; UnpackCellObject(object, cell); if(objFile) { objFile->Print("# m %d r %d\r\n", cell.modelindex, cell.rotation); objFile->Print("v %g %g %g\r\n", (region_pos_x+cell.x)*-0.00015f, cell.y*-0.00015f, (region_pos_z+cell.z)*0.00015f); } if(cell.modelindex >= g_levelModels.numElem()) { Msg("cell model index invalid: %d\n", cell.modelindex); cell_count++; continue; } MODEL* model = FindModelByIndex(cell.modelindex, regModels); if(!model) break; // transform objects and save Matrix4x4 transform = translate(Vector3D((region_pos_x+cell.x)*-0.00015f, cell.y*-0.00015f, (region_pos_z+cell.z)*0.00015f)); transform = transform * rotateY4(cell.rotation / 64.0f*PI_F*2.0f) * scale4(1.0f,1.0f,1.0f); WriteMODELToObjStream(levModelFile, model, cell.modelindex, false, transform, &lobj_first_v, &lobj_first_t, regModels); cell_count++; }while(true); MsgInfo("cell_count = %d\n", cell_count); if(objFile) { objFile->Print("# total region cells %d\r\n", cell_count); } numCellObjectsRead += cell_count; } } GetFileSystem()->Close(objFile); GetFileSystem()->Close(levModelFile); int numCellsObjectsFile = g_mapInfo.numAllObjects - g_mapInfo.numStraddlers; if(numCellObjectsRead != numCellsObjectsFile) MsgError("numAllObjects mismatch: in file: %d, read %d\n", numCellsObjectsFile, numCellObjectsRead); }
MsgWarning("USAGE:\n driver_level +lev <input atl file> <output image file>\n"); } DECLARE_CMD(lev, "Loads level, extracts model", 0) { if(args && args->numElem()) { EqString levName = CMD_ARGV(0); g_levname_moddir = levName.Path_Strip_Ext() + "_models"; g_levname_texdir = levName.Path_Strip_Ext() + "_textures"; GetFileSystem()->MakeDir(g_levname_moddir.c_str(), SP_ROOT); GetFileSystem()->MakeDir(g_levname_texdir.c_str(), SP_ROOT); g_levSize = GetFileSystem()->GetFileSize(levName.c_str()); LoadLevelFile( levName.c_str() ); ExportLevelData(); FreeLevelData(); } else Usage(); } int main(int argc, char* argv[]) { GetCore()->Init("driver_level", argc, argv); Install_SpewFunction();
void DeviceDir::AddDevice(const char name[], InstantiateHook hook) { fEntryList.AddToTail(new DeviceFile(GetFileSystem(), name, strlen(name), hook)); }
bool ZApplication::OnCreate(ZLoadingProgress *pLoadingProgress) { string strFileNameZItem(FILENAME_ZITEM_DESC); string strFileNameZItemLocale(FILENAME_ZITEM_DESC_LOCALE); string strFileNameZBuff(FILENAME_BUFF_DESC); string strFileNameWorlditem(FILENAME_WORLDITEM); string strFileNameAbuse(FILENAME_ABUSE); // #ifndef _DEBUG // strFileNameZItem += ".mef"; // strFileNameZItemLocale += ".mef"; // strFileNameZBuff += ".mef"; // strFileNameWorlditem += ".mef"; // strFileNameAbuse += ".mef"; // #endif MInitProfile(); // 멀티미디어 타이머 초기화 TIMECAPS tc; mlog("ZApplication::OnCreate : begin\n"); //ZGetSoundEngine()->Enumerate(); //for( int i = 0 ; i < ZGetSoundEngine()->GetEnumDeviceCount() ; ++i) //{ // sprintf(szDesc, "Sound Device %d = %s\n", i, ZGetSoundEngine()->GetDeviceDescription( i ) ); // mlog(szDesc); //} __BP(2000,"ZApplication::OnCreate"); #define MMTIMER_RESOLUTION 1 if (TIMERR_NOERROR == timeGetDevCaps(&tc,sizeof(TIMECAPS))) { m_nTimerRes = min(max(tc.wPeriodMin,MMTIMER_RESOLUTION),tc.wPeriodMax); timeBeginPeriod(m_nTimerRes); } // 한국도 서버리스트 선택 과정이 추가된다. // IP가 없으면 로그인화면으로 이동, IP가 있으면 바로 캐릭터 선택창으로 이동 if (ZApplication::GetInstance()->GetLaunchMode() == ZApplication::ZLAUNCH_MODE_NETMARBLE) m_nInitialState = GUNZ_DIRECTLOGIN; if (ZGameInterface::m_sbRemainClientConnectionForResetApp == true) m_nInitialState = GUNZ_LOBBY; // if during reload client for changing language, pass login step. DWORD _begin_time,_end_time; #define BEGIN_ { _begin_time = timeGetTime(); } #define END_(x) { _end_time = timeGetTime(); float f_time = (_end_time - _begin_time) / 1000.f; mlog("\n-------------------> %s : %f \n\n", x,f_time ); } __BP(2001,"m_SoundEngine.Create"); ZLoadingProgress soundLoading("Sound",pLoadingProgress,.12f); BEGIN_; #ifdef _BIRDSOUND m_SoundEngine.Create(RealSpace2::g_hWnd, 44100, Z_AUDIO_HWMIXING, GetFileSystem()); #else m_SoundEngine.Create(RealSpace2::g_hWnd, Z_AUDIO_HWMIXING, &soundLoading ); #endif END_("Sound Engine Create"); soundLoading.UpdateAndDraw(1.f); __EP(2001); // mlog("ZApplication::OnCreate : m_SoundEngine.Create\n"); mlog( "sound engine create.\n" ); // ZGetInitialLoading()->SetPercentage( 15.0f ); // ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true ); // loadingProgress.UpdateAndDraw(.3f); RegisterForbidKey(); __BP(2002,"m_pInterface->OnCreate()"); ZLoadingProgress giLoading("GameInterface",pLoadingProgress,.35f); BEGIN_; m_pGameInterface=new ZGameInterface("GameInterface",Mint::GetInstance()->GetMainFrame(),Mint::GetInstance()->GetMainFrame()); m_pGameInterface->m_nInitialState = m_nInitialState; if(!m_pGameInterface->OnCreate(&giLoading)) { mlog("Failed: ZGameInterface OnCreate\n"); SAFE_DELETE(m_pGameInterface); return false; } // mlog("Bird : 5\n"); m_pGameInterface->SetBounds(0,0,MGetWorkspaceWidth(),MGetWorkspaceHeight()); END_("GameInterface Create"); giLoading.UpdateAndDraw(1.f); m_pStageInterface = new ZStageInterface(); m_pOptionInterface = new ZOptionInterface; __EP(2002); #ifdef _BIRDTEST goto BirdGo; #endif // ZGetInitialLoading()->SetPercentage( 30.0f ); // ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true ); // loadingProgress.UpdateAndDraw(.7f); __BP(2003,"Character Loading"); ZLoadingProgress meshLoading("Mesh",pLoadingProgress,.41f); BEGIN_; // zip filesystem 을 사용하기 때문에 꼭 ZGameInterface 다음에 사용한다... // if(m_MeshMgr.LoadXmlList("model/character_lobby.xml")==-1) return false; if(m_MeshMgr.LoadXmlList("model/character.xml",ZProgressCallBack,&meshLoading)==-1) return false; mlog( "Load character.xml success,\n" ); END_("Character Loading"); meshLoading.UpdateAndDraw(1.f); // ZLoadingProgress npcLoading("NPC",pLoadingProgress,.1f); #ifdef _QUEST //if(m_NPCMeshMgr.LoadXmlList("model/npc.xml",ZProgressCallBack,&npcLoading) == -1) if(m_NPCMeshMgr.LoadXmlList("model/npc.xml") == -1) return false; #endif __EP(2003); // 모션에 연결된 사운드 파일중 없는것을 제거한다.. // 엔진에서는 사운드에 접근할수없어서.. // 파일체크는 부담이크고~ CheckSound(); // npcLoading.UpdateAndDraw(1.f); __BP(2004,"WeaponMesh Loading"); BEGIN_; string strFileNameWeapon("model/weapon.xml"); // #ifndef _DEBUG // strFileNameWeapon += ".mef"; // #endif if(m_WeaponMeshMgr.LoadXmlList((char*)strFileNameWeapon.c_str())==-1) return false; END_("WeaponMesh Loading"); __EP(2004); __BP(2005,"Worlditem Loading"); ZLoadingProgress etcLoading("etc",pLoadingProgress,.02f); BEGIN_; #ifdef _WORLD_ITEM_ m_MeshMgr.LoadXmlList((char*)strFileNameWorlditem.c_str()); #endif mlog("Load weapon.xml success. \n"); //*/ END_("Worlditem Loading"); __EP(2005); #ifdef _BIRDTEST BirdGo: #endif __BP(2006,"ETC .. XML"); BEGIN_; CreateConsole(ZGetGameClient()->GetCommandManager()); // mlog("ZApplication::OnCreate : CreateConsole \n"); m_pLogFrame = new MCommandLogFrame("Command Log", Mint::GetInstance()->GetMainFrame(), Mint::GetInstance()->GetMainFrame()); int nHeight = MGetWorkspaceHeight()/3; m_pLogFrame->SetBounds(0, MGetWorkspaceHeight()-nHeight-1, MGetWorkspaceWidth()-1, nHeight); m_pLogFrame->Show(false); m_pGameInterface->SetFocusEnable(true); m_pGameInterface->SetFocus(); m_pGameInterface->Show(true); if (!MGetMatchItemDescMgr()->ReadCache()) { if (!MGetMatchItemDescMgr()->ReadXml(GetFileSystem(), strFileNameZItem.c_str())) { MLog("Error while Read Item Descriptor %s\n", strFileNameZItem.c_str()); } if (!MGetMatchItemDescMgr()->ReadXml(GetFileSystem(), strFileNameZItemLocale.c_str())) { MLog("Error while Read Item Descriptor %s\n", strFileNameZItemLocale.c_str()); } MGetMatchItemDescMgr()->WriteCache(); } mlog("Load zitem info success.\n"); if( !MGetMatchBuffDescMgr()->ReadXml(GetFileSystem(), strFileNameZBuff.c_str()) ) { MLog("Error while Read Buff Descriptor %s\n", strFileNameZBuff.c_str()); } mlog("Load zBuff info success.\n"); // if (!MGetMatchItemEffectDescMgr()->ReadXml(GetFileSystem(), FILENAME_ZITEMEFFECT_DESC)) // { // MLog("Error while Read Item Descriptor %s\n", FILENAME_ZITEMEFFECT_DESC); // } // mlog("Init effect manager success.\n"); if (!MGetMatchWorldItemDescMgr()->ReadXml(GetFileSystem(), strFileNameWorlditem.c_str() )) { MLog("Error while Read Item Descriptor %s\n", strFileNameWorlditem.c_str()); } mlog("Init world item manager success.\n"); if (!MGetMapDescMgr()->Initialize(GetFileSystem(), "system/map.xml")) { MLog("Error while Read map Descriptor %s\n", "system/map.xml"); } mlog("Init map Descriptor success.\n"); string strFileChannelRule("system/channelrule.xml"); // #ifndef _DEBUG // strFileChannelRule += ".mef"; // #endif if (!ZGetChannelRuleMgr()->ReadXml(GetFileSystem(), strFileChannelRule.c_str())) { MLog("Error while Read Item Descriptor %s\n", strFileChannelRule.c_str()); } mlog("Init channel rule manager success.\n"); /* if (!MGetNPCGroupMgr()->ReadXml(GetFileSystem(), "system/monstergroup.xml")) { MLog("Error while Read Item Descriptor %s", "system/monstergroup.xml"); } mlog("ZApplication::OnCreate : ZGetNPCGroupMgr()->ReadXml \n"); */ // if (!MGetChattingFilter()->Create(GetFileSystem(), "system/abuse.xml")) bool bSucceedLoadAbuse = MGetChattingFilter()->LoadFromFile(GetFileSystem(), strFileNameAbuse.c_str()); if (!bSucceedLoadAbuse || MGetChattingFilter()->GetNumAbuseWords() == 0) { // 해킹으로 abuse-list 파일자체를 없애거나 내용을 비웠을 경우 실행을 멈추게 하자 MLog("Error while Read Abuse Filter %s\n", strFileNameAbuse.c_str()); MessageBox(NULL, ZErrStr(MERR_FIND_INVALIDFILE), ZMsg( MSG_WARNING), MB_OK); // TODO: 풀스크린에서 메시지 박스는 좀 곤란함; return false; } mlog( "Init abuse manager success.\n" ); #ifdef _QUEST_ITEM if( !GetQuestItemDescMgr().ReadXml(GetFileSystem(), FILENAME_QUESTITEM_DESC) ) { MLog( "Error while read quest tiem descrition xml file.\n" ); } #endif mlog("Init chatting filter. success\n"); if(!m_SkillManager.Create()) { MLog("Error while create skill manager\n"); } END_("ETC .."); #ifndef _BIRDTEST etcLoading.UpdateAndDraw(1.f); #endif //CoInitialize(NULL); // ZGetInitialLoading()->SetPercentage( 40.0f ); // ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true ); // loadingProgress.UpdateAndDraw(1.f); ZGetEmblemInterface()->Create(); __EP(2006); __EP(2000); __SAVEPROFILE("profile_loading.txt"); if (ZCheckFileHack() == true) { MLog("File Check Failed\n"); return false; } ZSetupDataChecker_Global(&m_GlobalDataChecker); #ifdef LOCALE_NHNUSA GetNHNUSAReport().ReportInitComplete(); #endif return true; }