forked from metin2/client
Compare commits
20 Commits
373c184dfe
...
0.4.0
Author | SHA1 | Date | |
---|---|---|---|
6c1e703ee2 | |||
5ba1cb44b9 | |||
37847b1635 | |||
60cfea47e0 | |||
51bde0b3d9 | |||
8b4d012e72 | |||
830e47b00b | |||
0ad2d3b7cc | |||
540ba33b0e | |||
67c4325b01 | |||
62916f0622 | |||
2589163a49 | |||
077a365840 | |||
c21c99393d | |||
603f2207ef | |||
6564e417f9 | |||
e7b6680895 | |||
187ecd53f2 | |||
8d27c24328 | |||
955c2a8fd9 |
3
bin/.gitignore
vendored
3
bin/.gitignore
vendored
@ -16,8 +16,7 @@ log.txt
|
||||
syserr.txt
|
||||
|
||||
# Game files
|
||||
pack/*.eix
|
||||
pack/*.epk
|
||||
pack/*.zip
|
||||
|
||||
# Guild images
|
||||
mark/
|
||||
|
351
bin/pack/Index
351
bin/pack/Index
@ -1,249 +1,102 @@
|
||||
PACK
|
||||
*
|
||||
patch1
|
||||
*
|
||||
season3_eu
|
||||
*
|
||||
patch2
|
||||
*
|
||||
metin2_patch_snow
|
||||
pack/
|
||||
metin2_patch_snow_dungeon
|
||||
pack/
|
||||
metin2_patch_etc_costume1
|
||||
pack/
|
||||
metin2_patch_pet1
|
||||
pack/
|
||||
metin2_patch_pet2
|
||||
pack/
|
||||
metin2_patch_ramadan_costume
|
||||
pack/
|
||||
metin2_patch_flame
|
||||
pack/
|
||||
metin2_patch_flame_dungeon
|
||||
pack/
|
||||
metin2_patch_w21_etc
|
||||
pack/
|
||||
metin2_patch_w21_mobs
|
||||
pack/
|
||||
metin2_patch_w21_mobs_m
|
||||
pack/
|
||||
metin2_patch_dss_box
|
||||
pack/
|
||||
metin2_patch_costume_soccer
|
||||
pack/
|
||||
metin2_patch_easter1
|
||||
pack/
|
||||
metin2_patch_mineral
|
||||
pack/
|
||||
metin2_patch_w20_sound
|
||||
pack/
|
||||
metin2_patch_ds
|
||||
pack/
|
||||
metin2_patch_5th_armor
|
||||
pack/
|
||||
metin2_patch_w20_etc
|
||||
pack/
|
||||
metin2_patch_dragon_rock
|
||||
pack/
|
||||
metin2_patch_dragon_rock_mobs
|
||||
pack/
|
||||
metin2_patch_etc
|
||||
pack/
|
||||
metin2_patch_xmas
|
||||
pack/
|
||||
metin2_patch_eu3
|
||||
pack/
|
||||
metin2_patch_eu4
|
||||
pack/
|
||||
metin2_patch_mundi
|
||||
pack/
|
||||
metin2_patch_sd
|
||||
pack/
|
||||
metin2_patch_halloween
|
||||
pack/
|
||||
metin2_patch_party
|
||||
pack/
|
||||
metin2_patch_dance
|
||||
d:/ymir work/pc/
|
||||
pc
|
||||
d:/ymir work/pc2/
|
||||
pc2
|
||||
d:/ymir work/monster/
|
||||
monster
|
||||
d:/ymir work/monster2/
|
||||
monster2
|
||||
d:/ymir work/effect/
|
||||
effect
|
||||
d:/ymir work/zone/
|
||||
zone
|
||||
d:/ymir work/terrainmaps/
|
||||
terrain
|
||||
d:/ymir work/npc/
|
||||
npc
|
||||
d:/ymir work/npc2/
|
||||
npc2
|
||||
d:/ymir work/tree/
|
||||
tree
|
||||
d:/ymir work/guild/
|
||||
guild
|
||||
d:/ymir work/item/
|
||||
item
|
||||
textureset/
|
||||
textureset
|
||||
property/
|
||||
property
|
||||
icon/
|
||||
icon
|
||||
season1/
|
||||
season1
|
||||
season2/
|
||||
season2
|
||||
metin2_map_a1/
|
||||
outdoora1
|
||||
map_a2/
|
||||
outdoora2
|
||||
metin2_map_a3/
|
||||
outdoora3
|
||||
metin2_map_b1/
|
||||
outdoorb1
|
||||
metin2_map_b3/
|
||||
outdoorb3
|
||||
metin2_map_c1/
|
||||
outdoorc1
|
||||
metin2_map_c3/
|
||||
outdoorc3
|
||||
map_n_snowm_01/
|
||||
outdoorsnow1
|
||||
metin2_map_n_desert_01/
|
||||
outdoordesert1
|
||||
metin2_map_n_flame_01/
|
||||
outdoorflame1
|
||||
map_b_fielddungeon/
|
||||
outdoorfielddungeon1
|
||||
metin2_map_t1/
|
||||
outdoort1
|
||||
metin2_map_t2/
|
||||
outdoort2
|
||||
metin2_map_t3/
|
||||
outdoort3
|
||||
metin2_map_t4/
|
||||
outdoort4
|
||||
metin2_map_wedding_01/
|
||||
outdoorwedding
|
||||
metin2_map_milgyo/
|
||||
outdoormilgyo1
|
||||
metin2_map_spiderdungeon/
|
||||
indoorspiderdungeon1
|
||||
metin2_map_deviltower1/
|
||||
indoordeviltower1
|
||||
metin2_map_monkeydungeon/
|
||||
indoormonkeydungeon1
|
||||
metin2_map_monkeydungeon_02/
|
||||
indoormonkeydungeon2
|
||||
metin2_map_monkeydungeon_03/
|
||||
indoormonkeydungeon3
|
||||
metin2_map_trent02/
|
||||
outdoortrent02
|
||||
metin2_map_guild_01/
|
||||
outdoorguild1
|
||||
metin2_map_guild_02/
|
||||
outdoorguild2
|
||||
metin2_map_guild_03/
|
||||
outdoorguild3
|
||||
metin2_map_trent/
|
||||
outdoortrent
|
||||
metin2_map_trent02/
|
||||
outdoortrent02
|
||||
metin2_map_duel/
|
||||
outdoorduel
|
||||
gm_guild_build/
|
||||
outdoorgmguildbuild
|
||||
sound/ambience/
|
||||
sound
|
||||
sound/common/
|
||||
sound
|
||||
sound/effect/
|
||||
sound
|
||||
sound/monster/
|
||||
sound
|
||||
sound/npc/
|
||||
sound
|
||||
sound/pc/
|
||||
sound
|
||||
sound/ui/
|
||||
sound
|
||||
sound/ambience/
|
||||
sound_m
|
||||
sound/common/
|
||||
sound_m
|
||||
sound/effect/
|
||||
sound_m
|
||||
sound/monster/
|
||||
sound_m
|
||||
sound/npc/
|
||||
sound_m
|
||||
sound/pc/
|
||||
sound_m
|
||||
sound/ui/
|
||||
sound_m
|
||||
sound/monster2/
|
||||
sound2
|
||||
sound/pc2/
|
||||
sound2
|
||||
bgm/
|
||||
bgm
|
||||
d:/ymir work/special/
|
||||
ETC
|
||||
d:/ymir work/environment/
|
||||
ETC
|
||||
locale/ca/
|
||||
locale_ca
|
||||
locale/ae/
|
||||
locale_ae
|
||||
locale/de/
|
||||
locale_de
|
||||
locale/es/
|
||||
locale_es
|
||||
locale/fr/
|
||||
locale_fr
|
||||
locale/gr/
|
||||
locale_gr
|
||||
locale/it/
|
||||
locale_it
|
||||
locale/nl/
|
||||
locale_nl
|
||||
locale/pl/
|
||||
locale_pl
|
||||
locale/pt/
|
||||
locale_pt
|
||||
locale/tr/
|
||||
locale_tr
|
||||
locale/uk/
|
||||
locale_uk
|
||||
locale/bg/
|
||||
locale_bg
|
||||
locale/en/
|
||||
locale_en
|
||||
locale/mx/
|
||||
locale_mx
|
||||
locale/ro/
|
||||
locale_ro
|
||||
locale/ru/
|
||||
locale_ru
|
||||
locale/dk/
|
||||
locale_dk
|
||||
locale/cz/
|
||||
locale_cz
|
||||
locale/hu/
|
||||
locale_hu
|
||||
locale/us/
|
||||
locale_us
|
||||
locale/pa/
|
||||
locale_pa
|
||||
uiscript/
|
||||
uiscript
|
||||
d:/ymir work/ui/
|
||||
ETC
|
||||
d:/ymir work/uiloading/
|
||||
uiloading
|
||||
patch1 ZIP
|
||||
season3_eu ZIP
|
||||
patch2 ZIP
|
||||
metin2_patch_snow ZIP
|
||||
metin2_patch_snow_dungeon ZIP
|
||||
metin2_patch_etc_costume1 ZIP
|
||||
metin2_patch_pet1 ZIP
|
||||
metin2_patch_pet2 ZIP
|
||||
metin2_patch_ramadan_costume ZIP
|
||||
metin2_patch_flame ZIP
|
||||
metin2_patch_flame_dungeon ZIP
|
||||
metin2_patch_w21_etc ZIP
|
||||
metin2_patch_w21_mobs ZIP
|
||||
metin2_patch_w21_mobs_m ZIP
|
||||
metin2_patch_dss_box ZIP
|
||||
metin2_patch_costume_soccer ZIP
|
||||
metin2_patch_easter1 ZIP
|
||||
metin2_patch_mineral ZIP
|
||||
metin2_patch_w20_sound ZIP
|
||||
metin2_patch_ds ZIP
|
||||
metin2_patch_5th_armor ZIP
|
||||
metin2_patch_w20_etc ZIP
|
||||
metin2_patch_dragon_rock ZIP
|
||||
metin2_patch_dragon_rock_mobs ZIP
|
||||
metin2_patch_etc ZIP
|
||||
metin2_patch_xmas ZIP
|
||||
metin2_patch_eu3 ZIP
|
||||
metin2_patch_eu4 ZIP
|
||||
metin2_patch_mundi ZIP
|
||||
metin2_patch_sd ZIP
|
||||
metin2_patch_halloween ZIP
|
||||
metin2_patch_party ZIP
|
||||
metin2_patch_dance ZIP
|
||||
pc ZIP
|
||||
pc2 ZIP
|
||||
monster ZIP
|
||||
monster2 ZIP
|
||||
effect ZIP
|
||||
zone ZIP
|
||||
terrain ZIP
|
||||
npc ZIP
|
||||
npc2 ZIP
|
||||
tree ZIP
|
||||
guild ZIP
|
||||
item ZIP
|
||||
textureset ZIP
|
||||
property ZIP
|
||||
icon ZIP
|
||||
season1 ZIP
|
||||
season2 ZIP
|
||||
outdoora1 ZIP
|
||||
outdoora2 ZIP
|
||||
outdoora3 ZIP
|
||||
outdoorb1 ZIP
|
||||
outdoorb3 ZIP
|
||||
outdoorc1 ZIP
|
||||
outdoorc3 ZIP
|
||||
outdoorsnow1 ZIP
|
||||
outdoordesert1 ZIP
|
||||
outdoorflame1 ZIP
|
||||
outdoorfielddungeon1 ZIP
|
||||
outdoort1 ZIP
|
||||
outdoort2 ZIP
|
||||
outdoort3 ZIP
|
||||
outdoort4 ZIP
|
||||
outdoorwedding ZIP
|
||||
outdoormilgyo1 ZIP
|
||||
indoorspiderdungeon1 ZIP
|
||||
indoordeviltower1 ZIP
|
||||
indoormonkeydungeon1 ZIP
|
||||
indoormonkeydungeon2 ZIP
|
||||
indoormonkeydungeon3 ZIP
|
||||
outdoortrent02 ZIP
|
||||
outdoorguild1 ZIP
|
||||
outdoorguild2 ZIP
|
||||
outdoorguild3 ZIP
|
||||
outdoortrent ZIP
|
||||
outdoorduel ZIP
|
||||
outdoorgmguildbuild ZIP
|
||||
sound ZIP
|
||||
sound_m ZIP
|
||||
sound2 ZIP
|
||||
bgm ZIP
|
||||
ETC ZIP
|
||||
locale_de ZIP
|
||||
locale_es ZIP
|
||||
locale_fr ZIP
|
||||
locale_gr ZIP
|
||||
locale_it ZIP
|
||||
locale_nl ZIP
|
||||
locale_pl ZIP
|
||||
locale_pt ZIP
|
||||
locale_tr ZIP
|
||||
locale_en ZIP
|
||||
locale_ro ZIP
|
||||
locale_ru ZIP
|
||||
locale_dk ZIP
|
||||
locale_cz ZIP
|
||||
locale_hu ZIP
|
||||
uiscript ZIP
|
||||
uiloading ZIP
|
||||
root ZIP
|
||||
|
102
bin/pack/Index.dev
Normal file
102
bin/pack/Index.dev
Normal file
@ -0,0 +1,102 @@
|
||||
patch1 FOLDER
|
||||
season3_eu FOLDER
|
||||
patch2 FOLDER
|
||||
metin2_patch_snow FOLDER
|
||||
metin2_patch_snow_dungeon FOLDER
|
||||
metin2_patch_etc_costume1 FOLDER
|
||||
metin2_patch_pet1 FOLDER
|
||||
metin2_patch_pet2 FOLDER
|
||||
metin2_patch_ramadan_costume FOLDER
|
||||
metin2_patch_flame FOLDER
|
||||
metin2_patch_flame_dungeon FOLDER
|
||||
metin2_patch_w21_etc FOLDER
|
||||
metin2_patch_w21_mobs FOLDER
|
||||
metin2_patch_w21_mobs_m FOLDER
|
||||
metin2_patch_dss_box FOLDER
|
||||
metin2_patch_costume_soccer FOLDER
|
||||
metin2_patch_easter1 FOLDER
|
||||
metin2_patch_mineral FOLDER
|
||||
metin2_patch_w20_sound FOLDER
|
||||
metin2_patch_ds FOLDER
|
||||
metin2_patch_5th_armor FOLDER
|
||||
metin2_patch_w20_etc FOLDER
|
||||
metin2_patch_dragon_rock FOLDER
|
||||
metin2_patch_dragon_rock_mobs FOLDER
|
||||
metin2_patch_etc FOLDER
|
||||
metin2_patch_xmas FOLDER
|
||||
metin2_patch_eu3 FOLDER
|
||||
metin2_patch_eu4 FOLDER
|
||||
metin2_patch_mundi FOLDER
|
||||
metin2_patch_sd FOLDER
|
||||
metin2_patch_halloween FOLDER
|
||||
metin2_patch_party FOLDER
|
||||
metin2_patch_dance FOLDER
|
||||
pc FOLDER
|
||||
pc2 FOLDER
|
||||
monster FOLDER
|
||||
monster2 FOLDER
|
||||
effect FOLDER
|
||||
zone FOLDER
|
||||
terrain FOLDER
|
||||
npc FOLDER
|
||||
npc2 FOLDER
|
||||
tree FOLDER
|
||||
guild FOLDER
|
||||
item FOLDER
|
||||
textureset FOLDER
|
||||
property FOLDER
|
||||
icon FOLDER
|
||||
season1 FOLDER
|
||||
season2 FOLDER
|
||||
outdoora1 FOLDER
|
||||
outdoora2 FOLDER
|
||||
outdoora3 FOLDER
|
||||
outdoorb1 FOLDER
|
||||
outdoorb3 FOLDER
|
||||
outdoorc1 FOLDER
|
||||
outdoorc3 FOLDER
|
||||
outdoorsnow1 FOLDER
|
||||
outdoordesert1 FOLDER
|
||||
outdoorflame1 FOLDER
|
||||
outdoorfielddungeon1 FOLDER
|
||||
outdoort1 FOLDER
|
||||
outdoort2 FOLDER
|
||||
outdoort3 FOLDER
|
||||
outdoort4 FOLDER
|
||||
outdoorwedding FOLDER
|
||||
outdoormilgyo1 FOLDER
|
||||
indoorspiderdungeon1 FOLDER
|
||||
indoordeviltower1 FOLDER
|
||||
indoormonkeydungeon1 FOLDER
|
||||
indoormonkeydungeon2 FOLDER
|
||||
indoormonkeydungeon3 FOLDER
|
||||
outdoortrent02 FOLDER
|
||||
outdoorguild1 FOLDER
|
||||
outdoorguild2 FOLDER
|
||||
outdoorguild3 FOLDER
|
||||
outdoortrent FOLDER
|
||||
outdoorduel FOLDER
|
||||
outdoorgmguildbuild FOLDER
|
||||
sound FOLDER
|
||||
sound_m FOLDER
|
||||
sound2 FOLDER
|
||||
bgm FOLDER
|
||||
ETC FOLDER
|
||||
locale_de FOLDER
|
||||
locale_es FOLDER
|
||||
locale_fr FOLDER
|
||||
locale_gr FOLDER
|
||||
locale_it FOLDER
|
||||
locale_nl FOLDER
|
||||
locale_pl FOLDER
|
||||
locale_pt FOLDER
|
||||
locale_tr FOLDER
|
||||
locale_en FOLDER
|
||||
locale_ro FOLDER
|
||||
locale_ru FOLDER
|
||||
locale_dk FOLDER
|
||||
locale_cz FOLDER
|
||||
locale_hu FOLDER
|
||||
uiscript FOLDER
|
||||
uiloading FOLDER
|
||||
root FOLDER
|
19
build.bat
19
build.bat
@ -6,7 +6,7 @@ ECHO Only use on a clean project directory.
|
||||
ECHO ======================================================
|
||||
|
||||
rem SET M2_MSVC_DIR=C:\Program Files\Microsoft Visual Studio\2022\Community\
|
||||
rem SET M2_PML_PATH=C:\Users\User\Path\To\PackMakerLite\PackMakerLite.exe
|
||||
rem SET M2_7ZIP_PATH=C:\Program Files\7-Zip\7z.exe
|
||||
|
||||
rem Check the environment variables
|
||||
VERIFY OTHER 2>nul
|
||||
@ -16,17 +16,21 @@ IF NOT DEFINED M2_MSVC_DIR (
|
||||
ECHO M2_MSVC_DIR is NOT defined! Please define M2_MSVC_DIR with the path of your local MSVC install.
|
||||
EXIT /B -1
|
||||
)
|
||||
IF NOT DEFINED M2_PML_PATH (
|
||||
ECHO M2_PML_PATH is NOT defined! Please define M2_PML_PATH with the path of your local PackMakerLite executable.
|
||||
IF NOT DEFINED M2_7ZIP_PATH (
|
||||
ECHO M2_7ZIP_PATH is NOT defined! Please define M2_7ZIP_PATH with the path of your local 7-Zip "7z.exe" executable.
|
||||
EXIT /B -1
|
||||
)
|
||||
ENDLOCAL
|
||||
|
||||
rem Cause variables to be expanded at execution time (in order for !errorlevel! to work)
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
rem Initialize the MSVC environment
|
||||
CALL "%M2_MSVC_DIR%\VC\Auxiliary\Build\vcvars32.bat"
|
||||
|
||||
rem Build
|
||||
msbuild Metin2Client.sln /p:Configuration=Distribute /p:Platform="Win32"
|
||||
if !errorlevel! neq 0 exit /b !errorlevel!
|
||||
|
||||
rem Start assembling the client package
|
||||
RMDIR /S /Q dist
|
||||
@ -48,12 +52,11 @@ MKDIR dist\screenshot\
|
||||
xcopy bin\upload\ dist\upload\ /E /Y /Q
|
||||
|
||||
rem Build and copy the archives
|
||||
DEL /F /Q "bin\pack\*.eix"
|
||||
DEL /F /Q "bin\pack\*.epk"
|
||||
DEL /F /Q "bin\pack\*.zip"
|
||||
|
||||
FOR /d %%i IN ("bin\pack\*") DO (
|
||||
echo Packing %%i
|
||||
%M2_PML_PATH% --nolog --parallel -p "%%i"
|
||||
"%M2_7ZIP_PATH%" a "%%i.zip" ".\%%i\*"
|
||||
if !errorlevel! neq 0 exit /b !errorlevel!
|
||||
)
|
||||
MOVE /Y bin\pack\*.eix dist\pack\
|
||||
MOVE /Y bin\pack\*.epk dist\pack\
|
||||
MOVE /Y bin\pack\*.zip dist\pack\
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <d3d9.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
|
||||
#define APP_NAME _T("Metin2 Config")
|
||||
#define FILENAME_CONFIG "metin2.cfg"
|
||||
@ -164,12 +164,24 @@ BOOL CMainDialog::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
|
||||
m_comboShadow.SetCurSel(m_stConfig.iShadowLevel);
|
||||
|
||||
// Language
|
||||
ATL::CString language;
|
||||
|
||||
// Load the languages into an array
|
||||
std::vector<ATL::CString> languages;
|
||||
for (int i = 0; i < kLanguageMax; ++i) {
|
||||
ATL::CString language;
|
||||
language.LoadString(kLanguageConfig[i].stringId);
|
||||
m_comboLanguage.InsertString(i, language);
|
||||
languages.push_back(language);
|
||||
}
|
||||
|
||||
// Sort the array
|
||||
std::sort(languages.begin(), languages.end(), [](const ATL::CString& a, const ATL::CString& b) {
|
||||
return a.CompareNoCase(b) < 0;
|
||||
});
|
||||
|
||||
// Add the languages to the combo
|
||||
for (auto& language : languages)
|
||||
m_comboLanguage.AddString(language);
|
||||
|
||||
m_stConfig.language = std::clamp((int) m_stConfig.language, 0, kLanguageMax - 1);
|
||||
|
||||
m_comboLanguage.SetCurSel(m_stConfig.language);
|
||||
@ -229,10 +241,66 @@ void CMainDialog::InitDefaultConfig()
|
||||
|
||||
auto lang = PRIMARYLANGID(LANGIDFROMLCID(GetUserDefaultLCID()));
|
||||
switch (lang) {
|
||||
case LANG_CZECH:
|
||||
m_stConfig.language = kLanguageCzech;
|
||||
break;
|
||||
|
||||
case LANG_DANISH:
|
||||
m_stConfig.language = kLanguageDanish;
|
||||
break;
|
||||
|
||||
case LANG_DUTCH:
|
||||
m_stConfig.language = kLanguageDutch;
|
||||
break;
|
||||
|
||||
case LANG_ENGLISH:
|
||||
m_stConfig.language = kLanguageEnglish;
|
||||
break;
|
||||
|
||||
case LANG_FRENCH:
|
||||
m_stConfig.language = kLanguageFrench;
|
||||
break;
|
||||
|
||||
case LANG_GERMAN:
|
||||
m_stConfig.language = kLanguageGerman;
|
||||
break;
|
||||
|
||||
case LANG_GREEK:
|
||||
m_stConfig.language = kLanguageGreek;
|
||||
break;
|
||||
|
||||
case LANG_HUNGARIAN:
|
||||
m_stConfig.language = kLanguageHungarian;
|
||||
break;
|
||||
|
||||
case LANG_ITALIAN:
|
||||
m_stConfig.language = kLanguageItalian;
|
||||
break;
|
||||
|
||||
case LANG_POLISH:
|
||||
m_stConfig.language = kLanguagePolish;
|
||||
break;
|
||||
|
||||
case LANG_PORTUGUESE:
|
||||
m_stConfig.language = kLanguagePortuguese;
|
||||
break;
|
||||
|
||||
case LANG_ROMANIAN:
|
||||
m_stConfig.language = kLanguageRomanian;
|
||||
break;
|
||||
|
||||
case LANG_RUSSIAN:
|
||||
m_stConfig.language = kLanguageRussian;
|
||||
break;
|
||||
|
||||
case LANG_SPANISH:
|
||||
m_stConfig.language = kLanguageSpanish;
|
||||
break;
|
||||
|
||||
case LANG_TURKISH:
|
||||
m_stConfig.language = kLanguageTurkish;
|
||||
break;
|
||||
|
||||
default:
|
||||
m_stConfig.language = kLanguageEnglish;
|
||||
break;
|
||||
|
15
src/Config/Metin2Config.exe.manifest
Normal file
15
src/Config/Metin2Config.exe.manifest
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
@ -17,3 +17,6 @@ IDR_MAINFRAME ICON "metin2.ico"
|
||||
#define METIN2_COMPONENT_TYPE VFT_APP
|
||||
|
||||
#include <version_info.rc>
|
||||
|
||||
// Visual Styles manifest
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "Metin2Config.exe.manifest"
|
||||
|
@ -31,18 +31,18 @@
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
|
BIN
src/Config/ui.rc
BIN
src/Config/ui.rc
Binary file not shown.
@ -15,8 +15,8 @@
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0, 3, 1, 0
|
||||
PRODUCTVERSION 0, 3, 1, 0
|
||||
FILEVERSION 0,4,0,0
|
||||
PRODUCTVERSION 0,4,0,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS METIN2_DEBUG
|
||||
FILEOS VOS__WINDOWS32
|
||||
@ -29,12 +29,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "The Old Metin2 Project"
|
||||
VALUE "FileDescription", METIN2_COMPONENT_DESCRIPTION
|
||||
VALUE "FileVersion", "0.3.1.0"
|
||||
VALUE "FileVersion", "0.4.0.0"
|
||||
VALUE "InternalName", METIN2_COMPONENT_INTERNALNAME
|
||||
VALUE "LegalCopyright", "Copyright (C) 2024"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2022-2025"
|
||||
VALUE "OriginalFilename", METIN2_COMPONENT_FILENAME
|
||||
VALUE "ProductName", "Metin2Config"
|
||||
VALUE "ProductVersion", "0.3.1.0"
|
||||
VALUE "ProductVersion", "0.4.0.0"
|
||||
END
|
||||
END
|
||||
|
||||
|
@ -192,15 +192,14 @@ BOOL CEffectMesh::__LoadData_Ver002(int iSize, const BYTE * c_pbBuf)
|
||||
|
||||
if (0 == strExtension.compare("ifl"))
|
||||
{
|
||||
LPCVOID pMotionData;
|
||||
CMappedFile File;
|
||||
CEterPackManager::TPackDataPtr motionData;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (CEterPackManager::Instance().Get(File, pMeshData->szDiffuseMapFileName, &pMotionData))
|
||||
if (CEterPackManager::Instance().Get(pMeshData->szDiffuseMapFileName, motionData))
|
||||
{
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
std::vector<std::string> stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pMotionData);
|
||||
textFileLoader.Bind(motionData->size(), motionData->data());
|
||||
|
||||
std::string strPathName;
|
||||
GetOnlyPathName(pMeshData->szDiffuseMapFileName, strPathName);
|
||||
@ -337,15 +336,14 @@ BOOL CEffectMesh::__LoadData_Ver001(int iSize, const BYTE * c_pbBuf)
|
||||
|
||||
if (0 == strExtension.compare("ifl"))
|
||||
{
|
||||
LPCVOID pMotionData;
|
||||
CMappedFile File;
|
||||
CEterPackManager::TPackDataPtr motionData;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (CEterPackManager::Instance().Get(File, pMeshData->szDiffuseMapFileName, &pMotionData))
|
||||
if (CEterPackManager::Instance().Get(pMeshData->szDiffuseMapFileName, motionData))
|
||||
{
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
std::vector<std::string> stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pMotionData);
|
||||
textFileLoader.Bind(motionData->size(), motionData->data());
|
||||
|
||||
std::string strPathName;
|
||||
GetOnlyPathName(pMeshData->szDiffuseMapFileName, strPathName);
|
||||
|
@ -234,18 +234,6 @@ bool CTGAImage::LoadFromMemory(int iSize, const BYTE * c_pbMem)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CTGAImage::LoadFromDiskFile(const char * c_szFileName)
|
||||
{
|
||||
CMappedFile file;
|
||||
|
||||
const BYTE * c_pbMap;
|
||||
|
||||
if (!file.Create(c_szFileName, (const void **) &c_pbMap, 0, 0))
|
||||
return false;
|
||||
|
||||
return LoadFromMemory(file.Size(), c_pbMap);
|
||||
}
|
||||
|
||||
int CTGAImage::GetRLEPixelCount(const DWORD * data)
|
||||
{
|
||||
int r = 0;
|
||||
|
@ -17,7 +17,6 @@ class CTGAImage : public CImage
|
||||
|
||||
virtual void Create(int width, int height);
|
||||
virtual bool LoadFromMemory(int iSize, const BYTE * c_pbMem);
|
||||
virtual bool LoadFromDiskFile(const char * c_szFileName);
|
||||
virtual bool SaveToDiskFile(const char* c_szFileName);
|
||||
|
||||
void SetCompressed(bool isCompress = true);
|
||||
|
@ -47,9 +47,6 @@ void CFileLoaderThread::Destroy()
|
||||
CloseHandle(m_hSemaphore);
|
||||
m_hSemaphore = NULL;
|
||||
}
|
||||
|
||||
stl_wipe(m_pRequestDeque);
|
||||
stl_wipe(m_pCompleteDeque);
|
||||
}
|
||||
|
||||
UINT CFileLoaderThread::Setup()
|
||||
@ -111,13 +108,11 @@ UINT CFileLoaderThread::Execute(void * /*pvArg*/)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CFileLoaderThread::Request(std::string & c_rstFileName) // called in main thread
|
||||
void CFileLoaderThread::Request(const std::string& c_rstFileName) // called in main thread
|
||||
{
|
||||
TData * pData = new TData;
|
||||
|
||||
pData->dwSize = 0;
|
||||
pData->pvBuf = NULL;
|
||||
pData->stFileName = c_rstFileName;
|
||||
TData pData;
|
||||
pData.fileName = c_rstFileName;
|
||||
pData.data = nullptr;
|
||||
|
||||
m_RequestMutex.Lock();
|
||||
m_pRequestDeque.push_back(pData);
|
||||
@ -131,7 +126,7 @@ void CFileLoaderThread::Request(std::string & c_rstFileName) // called in main t
|
||||
--m_iRestSemCount;
|
||||
}
|
||||
|
||||
bool CFileLoaderThread::Fetch(TData ** ppData) // called in main thread
|
||||
bool CFileLoaderThread::Fetch(TData& data) // called in main thread
|
||||
{
|
||||
m_CompleteMutex.Lock();
|
||||
|
||||
@ -141,7 +136,7 @@ bool CFileLoaderThread::Fetch(TData ** ppData) // called in main thread
|
||||
return false;
|
||||
}
|
||||
|
||||
*ppData = m_pCompleteDeque.front();
|
||||
data = m_pCompleteDeque.front();
|
||||
m_pCompleteDeque.pop_front();
|
||||
|
||||
m_CompleteMutex.Unlock();
|
||||
@ -158,22 +153,16 @@ void CFileLoaderThread::Process() // called in loader thread
|
||||
return;
|
||||
}
|
||||
|
||||
TData * pData = m_pRequestDeque.front();
|
||||
auto request = m_pRequestDeque.front();
|
||||
m_pRequestDeque.pop_front();
|
||||
|
||||
m_RequestMutex.Unlock();
|
||||
|
||||
LPCVOID pvBuf;
|
||||
|
||||
if (CEterPackManager::Instance().Get(pData->File, pData->stFileName.c_str(), &pvBuf))
|
||||
{
|
||||
pData->dwSize = pData->File.Size();
|
||||
pData->pvBuf = new char [pData->dwSize];
|
||||
memcpy(pData->pvBuf, pvBuf, pData->dwSize);
|
||||
}
|
||||
if (!CEterPackManager::Instance().Get(request.fileName, request.data))
|
||||
request.data = nullptr;
|
||||
|
||||
m_CompleteMutex.Lock();
|
||||
m_pCompleteDeque.push_back(pData);
|
||||
m_pCompleteDeque.push_back(request);
|
||||
m_CompleteMutex.Unlock();
|
||||
|
||||
Sleep(g_iLoadingDelayTime);
|
||||
|
@ -2,20 +2,18 @@
|
||||
#define __INC_YMIR_ETERLIB_FILELOADERTHREAD_H__
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "Thread.h"
|
||||
#include "Mutex.h"
|
||||
#include "../eterBase/MappedFile.h"
|
||||
|
||||
class CFileLoaderThread
|
||||
{
|
||||
public:
|
||||
typedef struct SData
|
||||
{
|
||||
std::string stFileName;
|
||||
|
||||
CMappedFile File;
|
||||
LPVOID pvBuf;
|
||||
DWORD dwSize;
|
||||
std::string fileName;
|
||||
std::shared_ptr<std::vector<char>> data;
|
||||
} TData;
|
||||
|
||||
public:
|
||||
@ -25,8 +23,8 @@ class CFileLoaderThread
|
||||
int Create(void * arg);
|
||||
|
||||
public:
|
||||
void Request(std::string & c_rstFileName);
|
||||
bool Fetch(TData ** ppData);
|
||||
void Request(const std::string& c_rstFileName);
|
||||
bool Fetch(TData& data);
|
||||
void Shutdown();
|
||||
|
||||
protected:
|
||||
@ -49,10 +47,10 @@ class CFileLoaderThread
|
||||
void Process();
|
||||
|
||||
private:
|
||||
std::deque<TData *> m_pRequestDeque;
|
||||
std::deque<TData> m_pRequestDeque;
|
||||
Mutex m_RequestMutex;
|
||||
|
||||
std::deque<TData *> m_pCompleteDeque;
|
||||
std::deque<TData> m_pCompleteDeque;
|
||||
Mutex m_CompleteMutex;
|
||||
|
||||
HANDLE m_hSemaphore;
|
||||
|
@ -50,13 +50,11 @@ bool CGraphicImageTexture::CreateDeviceObjects()
|
||||
}
|
||||
else
|
||||
{
|
||||
CMappedFile mappedFile;
|
||||
LPCVOID c_pvMap;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(mappedFile, m_stFileName.c_str(), &c_pvMap))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!CEterPackManager::Instance().Get(m_stFileName, data))
|
||||
return false;
|
||||
|
||||
return CreateFromMemoryFile(mappedFile.Size(), c_pvMap, m_d3dFmt, m_dwFilter);
|
||||
return CreateFromMemoryFile(data->size(), data->data(), m_d3dFmt, m_dwFilter);
|
||||
}
|
||||
|
||||
m_bEmpty = false;
|
||||
|
@ -38,9 +38,9 @@ bool CGraphicText::OnLoad(int /*iSize*/, const void* /*c_pvBuf*/)
|
||||
bool bItalic = false;
|
||||
|
||||
// format
|
||||
// 굴림.fnt "\xB1\xBC\xB8\xB2" 폰트 기본 사이즈 12 로 로딩
|
||||
// 굴림:18.fnt "\xB1\xBC\xB8\xB2" 폰트 사이즈 18 로 로딩
|
||||
// 굴림:14i.fnt "\xB1\xBC\xB8\xB2" 폰트 사이즈 14 & 이탤릭으로 로딩
|
||||
// 굴림.fnt "굴림" 폰트 기본 사이즈 12 로 로딩
|
||||
// 굴림:18.fnt "굴림" 폰트 사이즈 18 로 로딩
|
||||
// 굴림:14i.fnt "굴림" 폰트 사이즈 14 & 이탤릭으로 로딩
|
||||
const char * p = strrchr(GetFileName(), ':');
|
||||
|
||||
if (p)
|
||||
|
@ -126,7 +126,7 @@ void CGraphicTextInstance::Update()
|
||||
|
||||
if (m_roText.IsNull())
|
||||
{
|
||||
Tracef("CGraphicTextInstance::Update - \xC6\xF9\xC6\xAE\xB0\xA1 \xBC\xB3\xC1\xA4\xB5\xC7\xC1\xF6 \xBE\xCA\xBE\xD2\xBD\xC0\xB4\xCF\xB4\xD9\n");
|
||||
Tracef("CGraphicTextInstance::Update - Font not set\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,18 +42,17 @@ void CResource::Load()
|
||||
|
||||
const char * c_szFileName = GetFileName();
|
||||
|
||||
DWORD dwStart = ELTimer_GetMSec();
|
||||
CMappedFile file;
|
||||
LPCVOID fileData;
|
||||
DWORD dwStart = ELTimer_GetMSec();
|
||||
CEterPackManager::TPackDataPtr fileData;
|
||||
|
||||
//Tracenf("Load %s", c_szFileName);
|
||||
|
||||
if (CEterPackManager::Instance().Get(file, c_szFileName, &fileData))
|
||||
if (CEterPackManager::Instance().Get(c_szFileName, fileData))
|
||||
{
|
||||
m_dwLoadCostMiliiSecond = ELTimer_GetMSec() - dwStart;
|
||||
//Tracef("CResource::Load %s (%d bytes) in %d ms\n", c_szFileName, file.Size(), m_dwLoadCostMiliiSecond);
|
||||
|
||||
if (OnLoad(file.Size(), fileData))
|
||||
if (OnLoad(fileData->size(), fileData->data()))
|
||||
{
|
||||
me_state = STATE_EXIST;
|
||||
}
|
||||
@ -81,12 +80,11 @@ void CResource::Reload()
|
||||
Clear();
|
||||
Tracef("CResource::Reload %s\n", GetFileName());
|
||||
|
||||
CMappedFile file;
|
||||
LPCVOID fileData;
|
||||
CEterPackManager::TPackDataPtr fileData;
|
||||
|
||||
if (CEterPackManager::Instance().Get(file, GetFileName(), &fileData))
|
||||
if (CEterPackManager::Instance().Get(GetFileName(), fileData))
|
||||
{
|
||||
if (OnLoad(file.Size(), fileData))
|
||||
if (OnLoad(fileData->size(), fileData->data()))
|
||||
{
|
||||
me_state = STATE_EXIST;
|
||||
}
|
||||
|
@ -61,17 +61,17 @@ void CResourceManager::ProcessBackgroundLoading()
|
||||
|
||||
DWORD dwCurrentTime = ELTimer_GetMSec();
|
||||
|
||||
CFileLoaderThread::TData * pData;
|
||||
while (ms_loadingThread.Fetch(&pData))
|
||||
CFileLoaderThread::TData pData;
|
||||
while (ms_loadingThread.Fetch(pData))
|
||||
{
|
||||
//printf("LOD %s\n", pData->stFileName.c_str());
|
||||
CResource * pResource = GetResourcePointer(pData->stFileName.c_str());
|
||||
CResource * pResource = GetResourcePointer(pData.fileName.c_str());
|
||||
|
||||
if (pResource)
|
||||
{
|
||||
if (pResource->IsEmpty())
|
||||
{
|
||||
pResource->OnLoad(pData->dwSize, pData->pvBuf);
|
||||
pResource->OnLoad(pData.data->size(), pData.data->data());
|
||||
pResource->AddReferenceOnly();
|
||||
|
||||
// 여기서 올라간 레퍼런스 카운트를 일정 시간이 지난 뒤에 풀어주기 위하여
|
||||
@ -79,10 +79,7 @@ void CResourceManager::ProcessBackgroundLoading()
|
||||
}
|
||||
}
|
||||
|
||||
m_WaitingMap.erase(GetCRC32(pData->stFileName.c_str(), pData->stFileName.size()));
|
||||
|
||||
delete [] ((char *) pData->pvBuf);
|
||||
delete pData;
|
||||
m_WaitingMap.erase(GetCRC32(pData.fileName.c_str(), pData.fileName.size()));
|
||||
}
|
||||
|
||||
// DO : 일정 시간이 지나고 난뒤 미리 로딩해 두었던 리소스의 레퍼런스 카운트를 감소 시킨다 - [levites]
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "Resource.h"
|
||||
#include "FileLoaderThread.h"
|
||||
#include "../EterBase/Singleton.h"
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
@ -179,14 +179,13 @@ bool CTextFileLoader::Load(const char * c_szFileName)
|
||||
{
|
||||
m_strFileName = "";
|
||||
|
||||
const VOID* pvData;
|
||||
CMappedFile kFile;
|
||||
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
if (m_dwBufCapacity<kFile.Size())
|
||||
if (m_dwBufCapacity < data->size())
|
||||
{
|
||||
m_dwBufCapacity=kFile.Size();
|
||||
m_dwBufCapacity = data->size();
|
||||
|
||||
if (m_acBufData)
|
||||
delete [] m_acBufData;
|
||||
@ -194,8 +193,8 @@ bool CTextFileLoader::Load(const char * c_szFileName)
|
||||
m_acBufData=new char[m_dwBufCapacity];
|
||||
}
|
||||
|
||||
m_dwBufSize=kFile.Size();
|
||||
memcpy(m_acBufData, pvData, m_dwBufSize);
|
||||
m_dwBufSize = data->size();
|
||||
memcpy_s(m_acBufData, m_dwBufCapacity, data->data(), data->size());
|
||||
|
||||
m_strFileName = c_szFileName;
|
||||
m_dwcurLineIndex = 0;
|
||||
|
@ -20,16 +20,14 @@ void PrintfTabs(FILE * File, int iTabCount, const char * c_szString, ...)
|
||||
|
||||
bool LoadTextData(const char * c_szFileName, CTokenMap & rstTokenMap)
|
||||
{
|
||||
LPCVOID pMotionData;
|
||||
CMappedFile File;
|
||||
CEterPackManager::TPackDataPtr motionData;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(File, c_szFileName, &pMotionData))
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, motionData))
|
||||
return false;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
CTokenVector stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pMotionData);
|
||||
textFileLoader.Bind(motionData->size(), motionData->data());
|
||||
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
{
|
||||
@ -50,18 +48,16 @@ bool LoadTextData(const char * c_szFileName, CTokenMap & rstTokenMap)
|
||||
|
||||
bool LoadMultipleTextData(const char * c_szFileName, CTokenVectorMap & rstTokenVectorMap)
|
||||
{
|
||||
LPCVOID pModelData;
|
||||
CMappedFile File;
|
||||
CEterPackManager::TPackDataPtr modelData;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(File, c_szFileName, &pModelData))
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, modelData))
|
||||
return false;
|
||||
|
||||
DWORD i;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
CTokenVector stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pModelData);
|
||||
textFileLoader.Bind(modelData->size(), modelData->data());
|
||||
|
||||
for (i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
{
|
||||
@ -214,13 +210,13 @@ const char* GetFontFaceFromCodePage9x(WORD codePage)
|
||||
switch( codePage )
|
||||
{
|
||||
case CP_932:
|
||||
return "\x82l\x82r \x82o\x83S\x83V\x83b\x83N";
|
||||
return "MS PGothic";
|
||||
case CP_949:
|
||||
return "\xB1\xBC\xB8\xB2\xC3\xBC";
|
||||
return "GulimChe";
|
||||
case CP_936:
|
||||
return "\xCB\xCE\xCC\xE5";
|
||||
return "SimSun";
|
||||
case CP_950:
|
||||
return "\xB2\xD3\xA9\xFA\xC5\xE9";
|
||||
return "MingLiU";
|
||||
case CP_874:
|
||||
return "Tahoma";
|
||||
case CP_1252:
|
||||
|
@ -370,7 +370,7 @@ static bool DecomposeLetter(wchar_t input, char* letter)
|
||||
case 0x201c: // L'“'
|
||||
*letter = (char)'"';
|
||||
return true;
|
||||
case 0x201d: // L'\xE2\x80\x9D'
|
||||
case 0x201d: // L'”'
|
||||
*letter = (char)'"';
|
||||
return true;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,243 +0,0 @@
|
||||
#ifndef __INC_ETERPACKLIB_ETERPACK_H__
|
||||
#define __INC_ETERPACKLIB_ETERPACK_H__
|
||||
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "../EterBase/MappedFile.h"
|
||||
|
||||
#ifndef MAKEFOURCC
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
((DWORD)(BYTE) (ch0 ) | ((DWORD)(BYTE) (ch1) << 8) | \
|
||||
((DWORD)(BYTE) (ch2) << 16) | ((DWORD)(BYTE) (ch3) << 24))
|
||||
#endif
|
||||
|
||||
|
||||
//#define CHECKSUM_CHECK_MD5
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
namespace eterpack
|
||||
{
|
||||
const DWORD c_PackCC = MAKEFOURCC('E', 'P', 'K', 'D');
|
||||
const DWORD c_IndexCC = MAKEFOURCC('E', 'P', 'K', 'D');
|
||||
const DWORD c_Version = 2;
|
||||
// FourCC + Version + m_indexCount
|
||||
const DWORD c_HeaderSize = sizeof(DWORD) + sizeof(DWORD) + sizeof(long);
|
||||
};
|
||||
|
||||
enum EEterPackTypes
|
||||
{
|
||||
DBNAME_MAX_LEN = 255,
|
||||
FILENAME_MAX_LEN = 160,
|
||||
FREE_INDEX_BLOCK_SIZE = 32768,
|
||||
FREE_INDEX_MAX_SIZE = 512,
|
||||
DATA_BLOCK_SIZE = 256,
|
||||
|
||||
COMPRESSED_TYPE_NONE = 0,
|
||||
COMPRESSED_TYPE_COMPRESS = 1,
|
||||
COMPRESSED_TYPE_SECURITY = 2,
|
||||
COMPRESSED_TYPE_PANAMA = 3,
|
||||
COMPRESSED_TYPE_HYBRIDCRYPT = 4,
|
||||
COMPRESSED_TYPE_HYBRIDCRYPT_WITHSDB = 5,
|
||||
COMPRESSED_TYPE_COUNT = 6,
|
||||
};
|
||||
|
||||
#pragma pack(push, 4)
|
||||
typedef struct SEterPackIndex
|
||||
{
|
||||
long id;
|
||||
char filename[FILENAME_MAX_LEN + 1];
|
||||
DWORD filename_crc;
|
||||
long real_data_size;
|
||||
long data_size;
|
||||
#ifdef CHECKSUM_CHECK_MD5
|
||||
BYTE MD5Digest[16];
|
||||
#else
|
||||
DWORD data_crc;
|
||||
#endif
|
||||
long data_position;
|
||||
char compressed_type;
|
||||
} TEterPackIndex;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef std::unordered_map<DWORD, TEterPackIndex *> TDataPositionMap;
|
||||
typedef std::list<TEterPackIndex *> TFreeIndexList;
|
||||
|
||||
|
||||
class CEterPack;
|
||||
|
||||
class CEterFileDict
|
||||
{
|
||||
public:
|
||||
struct Item
|
||||
{
|
||||
Item() : pkPack(NULL), pkInfo(NULL) {}
|
||||
|
||||
CEterPack* pkPack;
|
||||
TEterPackIndex* pkInfo;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BUCKET_SIZE = 16,
|
||||
};
|
||||
|
||||
typedef std::unordered_multimap<DWORD, Item> TDict;
|
||||
|
||||
public:
|
||||
void InsertItem(CEterPack* pkPack, TEterPackIndex* pkInfo);
|
||||
void UpdateItem(CEterPack* pkPack, TEterPackIndex* pkInfo);
|
||||
|
||||
Item* GetItem(DWORD dwFileNameHash, const char* c_pszFileName);
|
||||
|
||||
const TDict& GetDict() const
|
||||
{
|
||||
return m_dict;
|
||||
}
|
||||
|
||||
private:
|
||||
TDict m_dict;
|
||||
};
|
||||
|
||||
class EterPackPolicy_CSHybridCrypt;
|
||||
|
||||
class CEterPack
|
||||
{
|
||||
public:
|
||||
CEterPack();
|
||||
virtual ~CEterPack();
|
||||
|
||||
void Destroy();
|
||||
bool Create(CEterFileDict& rkFileDict, const char * dbname, const char * pathName, bool bReadOnly = true, const BYTE* iv = NULL);
|
||||
bool DecryptIV(DWORD dwPanamaKey);
|
||||
|
||||
const std::string& GetPathName();
|
||||
const char * GetDBName();
|
||||
|
||||
bool Get(CMappedFile & mappedFile, const char * filename, LPCVOID * data);
|
||||
bool Get2(CMappedFile & mappedFile, const char * filename, TEterPackIndex* index, LPCVOID * data);
|
||||
|
||||
bool Put(const char * filename, const char * sourceFilename, BYTE packType, const std::string& strRelateMapName);
|
||||
bool Put(const char * filename, LPCVOID data, long len, BYTE packType);
|
||||
|
||||
bool Delete(const char * filename);
|
||||
|
||||
bool Extract();
|
||||
|
||||
long GetFragmentSize();
|
||||
|
||||
bool IsExist(const char * filename);
|
||||
|
||||
TDataPositionMap & GetIndexMap();
|
||||
|
||||
bool EncryptIndexFile();
|
||||
bool DecryptIndexFile();
|
||||
|
||||
DWORD DeleteUnreferencedData(); // 몇개가 삭제 되었는지 리턴 한다.
|
||||
|
||||
bool GetNames(std::vector<std::string>* retNames);
|
||||
|
||||
EterPackPolicy_CSHybridCrypt* GetPackPolicy_HybridCrypt() const;
|
||||
|
||||
private:
|
||||
bool __BuildIndex(CEterFileDict& rkFileDict, bool bOverwirte=false);
|
||||
|
||||
bool CreateIndexFile();
|
||||
TEterPackIndex * FindIndex(const char * filename);
|
||||
long GetNewIndexPosition(CFileBase& file);
|
||||
TEterPackIndex * NewIndex(CFileBase& file, const char * filename, long size);
|
||||
void WriteIndex(CFileBase& file, TEterPackIndex * index);
|
||||
int GetFreeBlockIndex(long size);
|
||||
void PushFreeIndex(TEterPackIndex * index);
|
||||
|
||||
bool CreateDataFile();
|
||||
long GetNewDataPosition(CFileBase& file);
|
||||
bool ReadData(CFileBase& file, TEterPackIndex * index, LPVOID data, long maxsize);
|
||||
bool WriteData(CFileBase& file, TEterPackIndex * index, LPCVOID data);
|
||||
bool WriteNewData(CFileBase& file, TEterPackIndex * index, LPCVOID data);
|
||||
|
||||
bool Delete(TEterPackIndex * pIndex);
|
||||
|
||||
protected:
|
||||
CMappedFile m_file;
|
||||
|
||||
char* m_file_data;
|
||||
unsigned m_file_size;
|
||||
|
||||
long m_indexCount;
|
||||
bool m_bEncrypted;
|
||||
|
||||
char m_dbName[DBNAME_MAX_LEN+1];
|
||||
char m_indexFileName[MAX_PATH+1];
|
||||
TEterPackIndex * m_indexData;
|
||||
long m_FragmentSize;
|
||||
bool m_bReadOnly;
|
||||
bool m_bDecrypedIV;
|
||||
|
||||
std::unordered_map<DWORD, DWORD> m_map_indexRefCount;
|
||||
TDataPositionMap m_DataPositionMap;
|
||||
TFreeIndexList m_FreeIndexList[FREE_INDEX_MAX_SIZE + 1]; // MAX 도 억세스 하므로 + 1 크기만큼 만든다.
|
||||
|
||||
std::string m_stDataFileName;
|
||||
std::string m_stPathName;
|
||||
|
||||
|
||||
EterPackPolicy_CSHybridCrypt* m_pCSHybridCryptPolicy;
|
||||
|
||||
private:
|
||||
void __CreateFileNameKey_Panama(const char * filename, BYTE * key, unsigned int keySize);
|
||||
bool __Decrypt_Panama(const char* filename, const BYTE* data, SIZE_T dataSize, CLZObject& zObj);
|
||||
bool __Encrypt_Panama(const char* filename, const BYTE* data, SIZE_T dataSize, CLZObject& zObj);
|
||||
std::string m_stIV_Panama;
|
||||
|
||||
//private:
|
||||
// bool m_bIsDataLoaded;
|
||||
// // 그냥 time_t를 쓰면, 32bit time_t를 사용하는 소스에서는,
|
||||
// // CEterPack의 size를 실제 size - 4로 인식하기 때문에 문제가 발생할 수 있다.
|
||||
// __time64_t m_tLastAccessTime;
|
||||
//public:
|
||||
// __time64_t GetLastAccessTime() { return m_tLastAccessTime; }
|
||||
// void UpdateLastAccessTime();
|
||||
// void ClearDataMemoryMap();
|
||||
|
||||
#ifdef CHECKSUM_CHECK_MD5
|
||||
void GenerateMD5Hash( BYTE* pData, int nLength, IN OUT MD5_CTX& context );
|
||||
#endif
|
||||
};
|
||||
|
||||
class CMakePackLog
|
||||
{
|
||||
public:
|
||||
static CMakePackLog& GetSingleton();
|
||||
|
||||
public:
|
||||
CMakePackLog();
|
||||
~CMakePackLog();
|
||||
|
||||
void SetFileName(const char* c_szFileName);
|
||||
|
||||
void Writef(const char* c_szFormat, ...);
|
||||
void Writenf(const char* c_szFormat, ...);
|
||||
void Write(const char* c_szBuf);
|
||||
|
||||
void WriteErrorf(const char* c_szFormat, ...);
|
||||
void WriteErrornf(const char* c_szFormat, ...);
|
||||
void WriteError(const char* c_szBuf);
|
||||
|
||||
void FlushError();
|
||||
|
||||
private:
|
||||
void __Write(const char* c_szBuf, int nBufLen);
|
||||
void __WriteError(const char* c_szBuf, int nBufLen);
|
||||
bool __IsLogMode();
|
||||
|
||||
private:
|
||||
FILE* m_fp;
|
||||
FILE* m_fp_err;
|
||||
|
||||
std::string m_stFileName;
|
||||
std::string m_stErrorFileName;
|
||||
};
|
||||
|
||||
#endif
|
@ -170,20 +170,6 @@
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EterPack.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EterPackCursor.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EterPackManager.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -191,25 +177,16 @@
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EterPackPolicy_CSHybridCrypt.cpp" />
|
||||
<ClCompile Include="md5.c" />
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Folder.cpp" />
|
||||
<ClCompile Include="ZIP.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EterPack.h" />
|
||||
<ClInclude Include="EterPackCursor.h" />
|
||||
<ClInclude Include="EterPackManager.h" />
|
||||
<ClInclude Include="EterPackPolicy_CSHybridCrypt.h" />
|
||||
<ClInclude Include="FileProvider.h" />
|
||||
<ClInclude Include="Folder.h" />
|
||||
<ClInclude Include="Inline.h" />
|
||||
<ClInclude Include="md5.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
<ClInclude Include="ZIP.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -9,48 +9,39 @@
|
||||
<UniqueIdentifier>{c156ef19-8b61-496c-a499-8bf66e9ca80d}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="File Providers">
|
||||
<UniqueIdentifier>{6348898e-222d-4516-8d4e-e37f9e17d872}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EterPack.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EterPackCursor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EterPackManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EterPackPolicy_CSHybridCrypt.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
<ClCompile Include="Folder.cpp">
|
||||
<Filter>File Providers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="md5.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
<ClCompile Include="ZIP.cpp">
|
||||
<Filter>File Providers</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EterPack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EterPackCursor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EterPackManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EterPackPolicy_CSHybridCrypt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Inline.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="md5.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Folder.h">
|
||||
<Filter>File Providers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZIP.h">
|
||||
<Filter>File Providers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileProvider.h">
|
||||
<Filter>File Providers</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,59 +0,0 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EterPackCursor.h"
|
||||
#include "Inline.h"
|
||||
|
||||
CEterPackCursor::CEterPackCursor(CEterPack* pack) : m_pPack(pack), m_pData(NULL), m_ReadPoint(0)
|
||||
{
|
||||
}
|
||||
|
||||
CEterPackCursor::~CEterPackCursor()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
bool CEterPackCursor::Open(const char* filename)
|
||||
{
|
||||
assert(m_pPack != NULL);
|
||||
|
||||
char tmpFilename[MAX_PATH + 1];
|
||||
strncpy(tmpFilename, filename, MAX_PATH);
|
||||
inlineConvertPackFilename(tmpFilename);
|
||||
|
||||
if (!m_pPack->Get(m_file, tmpFilename, &m_pData))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEterPackCursor::Close()
|
||||
{
|
||||
m_file.Destroy();
|
||||
m_pData = NULL;
|
||||
m_ReadPoint = 0;
|
||||
}
|
||||
|
||||
void CEterPackCursor::Seek(long offset)
|
||||
{
|
||||
m_ReadPoint = max(0, min(Size(), offset));
|
||||
}
|
||||
|
||||
bool CEterPackCursor::Read(LPVOID data, long size)
|
||||
{
|
||||
if (m_file.IsNull())
|
||||
return false;
|
||||
|
||||
if (m_ReadPoint + size > Size())
|
||||
return false;
|
||||
|
||||
memcpy(data, (char*) m_pData + m_ReadPoint, size);
|
||||
m_ReadPoint += size;
|
||||
return true;
|
||||
}
|
||||
|
||||
long CEterPackCursor::Size()
|
||||
{
|
||||
if (m_file.IsNull())
|
||||
return 0;
|
||||
|
||||
return m_file.Size();
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
#ifndef __INC_ETERPACKCURSOR_H__
|
||||
#define __INC_ETERPACKCURSOR_H__
|
||||
|
||||
#include "EterPack.h"
|
||||
|
||||
class CEterPackCursor
|
||||
{
|
||||
public:
|
||||
CEterPackCursor(CEterPack * pack);
|
||||
~CEterPackCursor();
|
||||
|
||||
bool Open(const char* filename);
|
||||
void Close();
|
||||
void Seek(long offset);
|
||||
bool Read(LPVOID data, long size);
|
||||
long Size();
|
||||
|
||||
private:
|
||||
CEterPack * m_pPack;
|
||||
CMappedFile m_file;
|
||||
LPCVOID m_pData;
|
||||
long m_ReadPoint;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,73 +1,34 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <io.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "EterPackManager.h"
|
||||
#include "EterPackPolicy_CSHybridCrypt.h"
|
||||
|
||||
#include "../eterBase/Debug.h"
|
||||
#include "../eterBase/CRC32.h"
|
||||
|
||||
#include "Folder.h"
|
||||
#include "ZIP.h"
|
||||
|
||||
#define PATH_ABSOLUTE_YMIRWORK1 "d:/ymir work/"
|
||||
#define PATH_ABSOLUTE_YMIRWORK2 "d:\\ymir work\\"
|
||||
|
||||
CEterPack* CEterPackManager::FindPack(const char* c_szPathName)
|
||||
{
|
||||
std::string strFileName;
|
||||
|
||||
if (0 == ConvertFileName(c_szPathName, strFileName))
|
||||
{
|
||||
return &m_RootPack;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TEterPackMap::iterator itor = m_DirPackMap.begin(); itor != m_DirPackMap.end(); ++itor)
|
||||
{
|
||||
const std::string & c_rstrName = itor->first;
|
||||
CEterPack * pEterPack = itor->second;
|
||||
|
||||
if (CompareName(c_rstrName.c_str(), c_rstrName.length(), strFileName.c_str()))
|
||||
{
|
||||
return pEterPack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CEterPackManager::SetCacheMode()
|
||||
{
|
||||
m_isCacheMode=true;
|
||||
}
|
||||
|
||||
void CEterPackManager::SetRelativePathMode()
|
||||
{
|
||||
m_bTryRelativePath = true;
|
||||
}
|
||||
|
||||
|
||||
// StringPath std::string 버전
|
||||
int CEterPackManager::ConvertFileName(const char * c_szFileName, std::string & rstrFileName)
|
||||
std::string CEterPackManager::ConvertFileName(std::string fileName)
|
||||
{
|
||||
rstrFileName = c_szFileName;
|
||||
stl_lowers(rstrFileName);
|
||||
std::string convertedFileName = fileName;
|
||||
stl_lowers(convertedFileName);
|
||||
|
||||
int iCount = 0;
|
||||
|
||||
for (DWORD i = 0; i < rstrFileName.length(); ++i)
|
||||
for (DWORD i = 0; i < convertedFileName.length(); i++)
|
||||
{
|
||||
if (rstrFileName[i] == '/')
|
||||
++iCount;
|
||||
else if (rstrFileName[i] == '\\')
|
||||
{
|
||||
rstrFileName[i] = '/';
|
||||
++iCount;
|
||||
}
|
||||
if (convertedFileName[i] == '\\')
|
||||
convertedFileName[i] = '/';
|
||||
}
|
||||
|
||||
return iCount;
|
||||
return convertedFileName;
|
||||
}
|
||||
|
||||
bool CEterPackManager::CompareName(const char * c_szDirectoryName, DWORD /*dwLength*/, const char * c_szFileName)
|
||||
@ -87,54 +48,6 @@ bool CEterPackManager::CompareName(const char * c_szDirectoryName, DWORD /*dwLen
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEterPackManager::LoadStaticCache(const char* c_szFileName)
|
||||
{
|
||||
if (!m_isCacheMode)
|
||||
return;
|
||||
|
||||
std::string strFileName;
|
||||
if (0 == ConvertFileName(c_szFileName, strFileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD dwFileNameHash = GetCRC32(strFileName.c_str(), strFileName.length());
|
||||
|
||||
std::unordered_map<DWORD, SCache>::iterator f = m_kMap_dwNameKey_kCache.find(dwFileNameHash);
|
||||
if (m_kMap_dwNameKey_kCache.end() != f)
|
||||
return;
|
||||
|
||||
CMappedFile kMapFile;
|
||||
const void* c_pvData;
|
||||
if (!Get(kMapFile, c_szFileName, &c_pvData))
|
||||
return;
|
||||
|
||||
SCache kNewCache;
|
||||
kNewCache.m_dwBufSize = kMapFile.Size();
|
||||
kNewCache.m_abBufData = new BYTE[kNewCache.m_dwBufSize];
|
||||
memcpy(kNewCache.m_abBufData, c_pvData, kNewCache.m_dwBufSize);
|
||||
m_kMap_dwNameKey_kCache.insert(std::unordered_map<DWORD, SCache>::value_type(dwFileNameHash, kNewCache));
|
||||
}
|
||||
|
||||
CEterPackManager::SCache* CEterPackManager::__FindCache(DWORD dwFileNameHash)
|
||||
{
|
||||
std::unordered_map<DWORD, SCache>::iterator f=m_kMap_dwNameKey_kCache.find(dwFileNameHash);
|
||||
if (m_kMap_dwNameKey_kCache.end()==f)
|
||||
return NULL;
|
||||
|
||||
return &f->second;
|
||||
}
|
||||
|
||||
void CEterPackManager::__ClearCacheMap()
|
||||
{
|
||||
std::unordered_map<DWORD, SCache>::iterator i;
|
||||
|
||||
for (i = m_kMap_dwNameKey_kCache.begin(); i != m_kMap_dwNameKey_kCache.end(); ++i)
|
||||
delete [] i->second.m_abBufData;
|
||||
|
||||
m_kMap_dwNameKey_kCache.clear();
|
||||
}
|
||||
|
||||
struct TimeChecker
|
||||
{
|
||||
TimeChecker(const char* name) : name(name)
|
||||
@ -150,27 +63,37 @@ struct TimeChecker
|
||||
DWORD baseTime;
|
||||
};
|
||||
|
||||
bool CEterPackManager::Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData)
|
||||
bool CEterPackManager::Get(const std::string& fileName, TPackDataPtr& dataPtr)
|
||||
{
|
||||
//TimeChecker timeChecker(c_szFileName);
|
||||
//Logf(1, "Load %s\n", c_szFileName);
|
||||
|
||||
if (m_iSearchMode == SEARCH_FILE_FIRST)
|
||||
{
|
||||
if (GetFromFile(rMappedFile, c_szFileName, pData))
|
||||
{
|
||||
if (GetFromFile(fileName, dataPtr))
|
||||
return true;
|
||||
}
|
||||
|
||||
return GetFromPack(rMappedFile, c_szFileName, pData);
|
||||
return GetFromPack(fileName, dataPtr);
|
||||
}
|
||||
|
||||
if (GetFromPack(rMappedFile, c_szFileName, pData))
|
||||
{
|
||||
if (GetFromPack(fileName, dataPtr))
|
||||
return true;
|
||||
}
|
||||
|
||||
return GetFromFile(rMappedFile, c_szFileName, pData);
|
||||
return GetFromFile(fileName, dataPtr);
|
||||
}
|
||||
|
||||
|
||||
bool CEterPackManager::Get(const std::string& fileName, std::stringstream& dataStream)
|
||||
{
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!Get(fileName, data))
|
||||
return false;
|
||||
|
||||
// Copy the data from the pack into the file sstream
|
||||
dataStream.str("");
|
||||
std::copy(data->begin(), data->end(), std::ostream_iterator<char>(dataStream));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct FinderLock
|
||||
@ -188,109 +111,60 @@ struct FinderLock
|
||||
CRITICAL_SECTION* p_cs;
|
||||
};
|
||||
|
||||
bool CEterPackManager::GetFromPack(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData)
|
||||
bool CEterPackManager::GetFromPack(const std::string& fileName, TPackDataPtr& dataPtr)
|
||||
{
|
||||
FinderLock lock(m_csFinder);
|
||||
|
||||
static std::string strFileName;
|
||||
std::string strFileName = ConvertFileName(fileName);
|
||||
|
||||
if (0 == ConvertFileName(c_szFileName, strFileName))
|
||||
{
|
||||
return m_RootPack.Get(rMappedFile, strFileName.c_str(), pData);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwFileNameHash = GetCRC32(strFileName.c_str(), strFileName.length());
|
||||
SCache* pkCache = __FindCache(dwFileNameHash);
|
||||
auto pkFileItem = m_FileMap.find(strFileName);
|
||||
|
||||
if (pkCache)
|
||||
{
|
||||
rMappedFile.Link(pkCache->m_dwBufSize, pkCache->m_abBufData);
|
||||
return true;
|
||||
}
|
||||
|
||||
CEterFileDict::Item* pkFileItem = m_FileDict.GetItem(dwFileNameHash, strFileName.c_str());
|
||||
|
||||
if (pkFileItem)
|
||||
if (pkFileItem->pkPack)
|
||||
{
|
||||
bool r = pkFileItem->pkPack->Get2(rMappedFile, strFileName.c_str(), pkFileItem->pkInfo, pData);
|
||||
//pkFileItem->pkPack->ClearDataMemoryMap();
|
||||
return r;
|
||||
}
|
||||
}
|
||||
if (pkFileItem == m_FileMap.end()) {
|
||||
#ifdef _DEBUG
|
||||
TraceError("CANNOT_FIND_PACK_FILE [%s]", strFileName.c_str());
|
||||
TraceError("CANNOT_FIND_PACK_FILE [%s]", strFileName.c_str());
|
||||
#endif
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto data = std::make_shared<std::vector<char>>();
|
||||
if (!pkFileItem->second->getFile(strFileName, data))
|
||||
return false;
|
||||
|
||||
// Set dataPtr to the retreived data pointer
|
||||
dataPtr = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const time_t g_tCachingInterval = 10; // 10초
|
||||
void CEterPackManager::ArrangeMemoryMappedPack()
|
||||
bool CEterPackManager::GetFromFile(const std::string& fileName, TPackDataPtr& dataPtr)
|
||||
{
|
||||
//time_t curTime = time(NULL);
|
||||
//CEterFileDict::TDict dict = m_FileDict.GetDict();
|
||||
//for (CEterFileDict::TDict::iterator it = dict.begin(); it != dict.end(); ++it)
|
||||
//{
|
||||
// CEterFileDict::Item &rFileItem = it->second;
|
||||
// CEterPack* pkPack = rFileItem.pkPack;
|
||||
// if (pkPack)
|
||||
// {
|
||||
// if (curTime - pkPack->GetLastAccessTime() > g_tCachingInterval)
|
||||
// {
|
||||
// pkPack->ClearDataMemoryMap();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
// Try to open the file
|
||||
std::ifstream file(fileName, std::ios::binary);
|
||||
if (!file.is_open())
|
||||
return false;
|
||||
|
||||
bool CEterPackManager::GetFromFile(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData)
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
//const char *pcExt = strchr(c_szFileName, '.');
|
||||
//if (pcExt &&
|
||||
// _strnicmp(pcExt, ".py", 3) == 0 && // python 스크립트 중
|
||||
// stricmp(c_szFileName, "logininfo.py") != 0 && // 로그인 정보 파일이 아니고
|
||||
// strnicmp(c_szFileName, "locale", 6) != 0
|
||||
// )
|
||||
//{
|
||||
// return false;
|
||||
//}
|
||||
#endif
|
||||
|
||||
//if(m_bTryRelativePath) {
|
||||
// if (strnicmp(c_szFileName, PATH_ABSOLUTE_YMIRWORK1, strlen(PATH_ABSOLUTE_YMIRWORK1)) == 0 || strnicmp(c_szFileName, PATH_ABSOLUTE_YMIRWORK2, strlen(PATH_ABSOLUTE_YMIRWORK2)) == 0) {
|
||||
// if(rMappedFile.Create(c_szFileName+strlen(PATH_ABSOLUTE_YMIRWORK1), pData, 0, 0))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
return rMappedFile.Create(c_szFileName, pData, 0, 0) ? true : false;
|
||||
// Read the file's contents
|
||||
dataPtr = std::make_shared<std::vector<char>>(
|
||||
std::istreambuf_iterator<char>(file),
|
||||
std::istreambuf_iterator<char>()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEterPackManager::isExistInPack(const char * c_szFileName)
|
||||
{
|
||||
std::string strFileName;
|
||||
std::string strFileName = ConvertFileName(c_szFileName);
|
||||
|
||||
if (0 == ConvertFileName(c_szFileName, strFileName))
|
||||
{
|
||||
return m_RootPack.IsExist(strFileName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwFileNameHash = GetCRC32(strFileName.c_str(), strFileName.length());
|
||||
CEterFileDict::Item* pkFileItem = m_FileDict.GetItem(dwFileNameHash, strFileName.c_str());
|
||||
auto pkFileItem = m_FileMap.find(strFileName);
|
||||
|
||||
if (pkFileItem)
|
||||
if (pkFileItem->pkPack)
|
||||
return pkFileItem->pkPack->IsExist(strFileName.c_str());
|
||||
}
|
||||
if (pkFileItem == m_FileMap.end())
|
||||
return false;
|
||||
|
||||
// NOTE : 매치 되는 팩이 없다면 false - [levites]
|
||||
return false;
|
||||
if (!pkFileItem->second)
|
||||
return false;
|
||||
|
||||
return pkFileItem->second->fileExists(strFileName.c_str());
|
||||
}
|
||||
|
||||
bool CEterPackManager::isExist(const char * c_szFileName)
|
||||
@ -300,99 +174,66 @@ bool CEterPackManager::isExist(const char * c_szFileName)
|
||||
if (isExistInPack(c_szFileName))
|
||||
return true;
|
||||
|
||||
return _access(c_szFileName, 0) == 0 ? true : false;
|
||||
return _access(c_szFileName, 0) == 0;
|
||||
}
|
||||
|
||||
//if(m_bTryRelativePath) {
|
||||
// if (strnicmp(c_szFileName, PATH_ABSOLUTE_YMIRWORK1, strlen(PATH_ABSOLUTE_YMIRWORK1)) == 0 || strnicmp(c_szFileName, PATH_ABSOLUTE_YMIRWORK2, strlen(PATH_ABSOLUTE_YMIRWORK2)) == 0) {
|
||||
// if(access(c_szFileName+strlen(PATH_ABSOLUTE_YMIRWORK1), 0) == 0)
|
||||
// return true;
|
||||
// }
|
||||
//}
|
||||
|
||||
if (_access(c_szFileName, 0) == 0)
|
||||
return true;
|
||||
|
||||
return isExistInPack(c_szFileName);
|
||||
}
|
||||
|
||||
|
||||
void CEterPackManager::RegisterRootPack(const char * c_szName)
|
||||
bool CEterPackManager::PackExists(const std::string& name, const std::string& container)
|
||||
{
|
||||
if (!m_RootPack.Create(m_FileDict, c_szName, ""))
|
||||
{
|
||||
TraceError("%s: Pack file does not exist", c_szName);
|
||||
if (container == "FOLDER") {
|
||||
return _access(name.c_str(), 0) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char * CEterPackManager::GetRootPackFileName()
|
||||
{
|
||||
return m_RootPack.GetDBName();
|
||||
}
|
||||
|
||||
bool CEterPackManager::DecryptPackIV(DWORD dwPanamaKey)
|
||||
{
|
||||
TEterPackMap::iterator itor = m_PackMap.begin();
|
||||
while (itor != m_PackMap.end())
|
||||
{
|
||||
itor->second->DecryptIV(dwPanamaKey);
|
||||
itor++;
|
||||
else if (container == "ZIP") {
|
||||
std::string zipName = name + ".zip";
|
||||
return _access(zipName.c_str(), 0) == 0;
|
||||
}
|
||||
return true;
|
||||
|
||||
throw std::runtime_error("Unexpected container type: " + container + "!");
|
||||
}
|
||||
|
||||
bool CEterPackManager::RegisterPackWhenPackMaking(const char * c_szName, const char * c_szDirectory, CEterPack* pPack)
|
||||
bool CEterPackManager::RegisterPack(const std::string& name, const std::string& container)
|
||||
{
|
||||
m_PackMap.insert(TEterPackMap::value_type(c_szName, pPack));
|
||||
m_PackList.push_front(pPack);
|
||||
auto it = m_PackMap.find(name);
|
||||
|
||||
m_DirPackMap.insert(TEterPackMap::value_type(c_szDirectory, pPack));
|
||||
return true;
|
||||
}
|
||||
if (it != m_PackMap.end())
|
||||
return true;
|
||||
|
||||
try {
|
||||
bool bReadOnly = true;
|
||||
|
||||
bool CEterPackManager::RegisterPack(const char * c_szName, const char * c_szDirectory, const BYTE* c_pbIV)
|
||||
{
|
||||
CEterPack * pEterPack = NULL;
|
||||
{
|
||||
TEterPackMap::iterator itor = m_PackMap.find(c_szName);
|
||||
std::shared_ptr<FileProvider> pack;
|
||||
|
||||
if (m_PackMap.end() == itor)
|
||||
{
|
||||
bool bReadOnly = true;
|
||||
|
||||
pEterPack = new CEterPack;
|
||||
if (pEterPack->Create(m_FileDict, c_szName, c_szDirectory, bReadOnly, c_pbIV))
|
||||
{
|
||||
m_PackMap.insert(TEterPackMap::value_type(c_szName, pEterPack));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Tracef("The eterpack doesn't exist [%s]\n", c_szName);
|
||||
#endif
|
||||
delete pEterPack;
|
||||
pEterPack = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Determine requested container type
|
||||
if (container == "FOLDER")
|
||||
pack = std::make_shared<Folder>(name);
|
||||
else if (container == "ZIP")
|
||||
pack = std::make_shared<ZIP>(name + ".zip");
|
||||
else
|
||||
{
|
||||
pEterPack = itor->second;
|
||||
}
|
||||
}
|
||||
throw std::runtime_error("Unexpected container type: " + container + "!");
|
||||
|
||||
if (c_szDirectory && c_szDirectory[0] != '*')
|
||||
// Load container data
|
||||
auto packFiles = pack->listFiles();
|
||||
|
||||
for (auto const& fileName : packFiles)
|
||||
m_FileMap.insert({ fileName, pack });
|
||||
|
||||
m_PackMap.insert({ name, pack });
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
TEterPackMap::iterator itor = m_DirPackMap.find(c_szDirectory);
|
||||
if (m_DirPackMap.end() == itor)
|
||||
{
|
||||
m_PackList.push_front(pEterPack);
|
||||
m_DirPackMap.insert(TEterPackMap::value_type(c_szDirectory, pEterPack));
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
Tracef("Unable to load file provider '%s': %s\n", name.c_str(), e.what());
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CEterPackManager::SetSearchMode(bool bPackFirst)
|
||||
@ -405,209 +246,16 @@ int CEterPackManager::GetSearchMode()
|
||||
return m_iSearchMode;
|
||||
}
|
||||
|
||||
CEterPackManager::CEterPackManager() : m_bTryRelativePath(false), m_iSearchMode(SEARCH_FILE_FIRST), m_isCacheMode(false)
|
||||
CEterPackManager::CEterPackManager() : m_iSearchMode(SEARCH_FILE_FIRST)
|
||||
{
|
||||
InitializeCriticalSection(&m_csFinder);
|
||||
}
|
||||
|
||||
CEterPackManager::~CEterPackManager()
|
||||
{
|
||||
__ClearCacheMap();
|
||||
|
||||
TEterPackMap::iterator i = m_PackMap.begin();
|
||||
TEterPackMap::iterator e = m_PackMap.end();
|
||||
while (i != e)
|
||||
{
|
||||
delete i->second;
|
||||
i++;
|
||||
}
|
||||
DeleteCriticalSection(&m_csFinder);
|
||||
}
|
||||
|
||||
void CEterPackManager::RetrieveHybridCryptPackKeys(const BYTE *pStream)
|
||||
{
|
||||
////dump file format
|
||||
//total packagecnt (4byte)
|
||||
// for packagecntpackage
|
||||
// db name hash ( stl.h stringhash )
|
||||
// extension cnt( 4byte)
|
||||
// for extension cnt
|
||||
// ext hash ( stl.h stringhash )
|
||||
// key-16byte
|
||||
// iv-16byte
|
||||
int iMemOffset = 0;
|
||||
|
||||
int iPackageCnt;
|
||||
DWORD dwPackageNameHash;
|
||||
|
||||
memcpy( &iPackageCnt, pStream + iMemOffset, sizeof(int) );
|
||||
iMemOffset += sizeof(iPackageCnt);
|
||||
|
||||
for( int i = 0; i < iPackageCnt; ++i )
|
||||
{
|
||||
int iRecvedCryptKeySize = 0;
|
||||
memcpy( &iRecvedCryptKeySize, pStream + iMemOffset, sizeof(iRecvedCryptKeySize) );
|
||||
iRecvedCryptKeySize -= sizeof(dwPackageNameHash); // 서버에서 받은 key stream에는 filename hash가 포함되어 있으므로, hash 사이즈 만큼 배줌.
|
||||
iMemOffset += sizeof(iRecvedCryptKeySize);
|
||||
|
||||
memcpy( &dwPackageNameHash, pStream + iMemOffset, sizeof(dwPackageNameHash) );
|
||||
iMemOffset += sizeof(dwPackageNameHash);
|
||||
|
||||
TEterPackMap::const_iterator cit;
|
||||
for( cit = m_PackMap.begin(); cit != m_PackMap.end(); ++cit )
|
||||
{
|
||||
std::string noPathName = CFileNameHelper::NoPath(std::string(cit->first));
|
||||
if( dwPackageNameHash == stringhash().GetHash(noPathName) )
|
||||
{
|
||||
EterPackPolicy_CSHybridCrypt* pCryptPolicy = cit->second->GetPackPolicy_HybridCrypt();
|
||||
int iHavedCryptKeySize = pCryptPolicy->ReadCryptKeyInfoFromStream( pStream + iMemOffset );
|
||||
if (iRecvedCryptKeySize != iHavedCryptKeySize)
|
||||
{
|
||||
TraceError("CEterPackManager::RetrieveHybridCryptPackKeys cryptokey length of file(%s) is not matched. received(%d) != haved(%d)", noPathName.c_str(), iRecvedCryptKeySize, iHavedCryptKeySize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
iMemOffset += iRecvedCryptKeySize;
|
||||
}
|
||||
}
|
||||
|
||||
void CEterPackManager::RetrieveHybridCryptPackSDB( const BYTE* pStream )
|
||||
{
|
||||
//cnt
|
||||
//for cnt
|
||||
//DWORD dwPackageIdentifier;
|
||||
//DWORD dwFileIdentifier;
|
||||
//std::vector<BYTE> vecSDBStream;
|
||||
int iReadOffset = 0;
|
||||
int iSDBInfoCount = 0;
|
||||
|
||||
memcpy( &iSDBInfoCount, pStream+iReadOffset, sizeof(int) );
|
||||
iReadOffset += sizeof(int);
|
||||
|
||||
for( int i = 0; i < iSDBInfoCount; ++i )
|
||||
{
|
||||
DWORD dwPackgeIdentifier;
|
||||
memcpy( &dwPackgeIdentifier, pStream+iReadOffset, sizeof(DWORD) );
|
||||
iReadOffset += sizeof(DWORD);
|
||||
|
||||
TEterPackMap::const_iterator cit;
|
||||
for( cit = m_PackMap.begin(); cit != m_PackMap.end(); ++cit )
|
||||
{
|
||||
std::string noPathName = CFileNameHelper::NoPath(std::string(cit->first));
|
||||
if( dwPackgeIdentifier == stringhash().GetHash(noPathName) )
|
||||
{
|
||||
EterPackPolicy_CSHybridCrypt* pCryptPolicy = cit->second->GetPackPolicy_HybridCrypt();
|
||||
iReadOffset += pCryptPolicy->ReadSupplementatyDataBlockFromStream( pStream+iReadOffset );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CEterPackManager::WriteHybridCryptPackInfo(const char* pFileName)
|
||||
{
|
||||
//NOTE : this file format contains a little bit of redundant data.
|
||||
//however it`s better for seperating cryptkey & supplementary data block.
|
||||
|
||||
//dump file format
|
||||
|
||||
//SDB data offset(4)
|
||||
|
||||
// about cryptkey
|
||||
//total packagecnt (4byte)
|
||||
// for packagecnt
|
||||
// db name hash 4byte( stl.h stringhash )
|
||||
// extension cnt( 4byte)
|
||||
// for extension cnt
|
||||
// ext hash ( stl.h stringhash )
|
||||
// key-16byte
|
||||
// iv-16byte
|
||||
|
||||
//about SDB data
|
||||
//total packagecnt (4byte)
|
||||
// for packagecnt
|
||||
// db name hash 4byte( stl.h stringhash ) +child node size(4byte)
|
||||
// sdb file cnt( 4byte )
|
||||
// for sdb file cnt
|
||||
// filename hash ( stl.h stringhash )
|
||||
// related map name size(4), relate map name
|
||||
// sdb block size( 1byte )
|
||||
// sdb blocks
|
||||
|
||||
CFileBase keyFile;
|
||||
|
||||
if( !keyFile.Create( pFileName, CFileBase::FILEMODE_WRITE) )
|
||||
{
|
||||
//TODO : write log
|
||||
return;
|
||||
}
|
||||
|
||||
int iKeyPackageCount = 0;
|
||||
|
||||
//write later ( SDB Offset & PackageCnt for Key )
|
||||
keyFile.SeekCur(2*sizeof(int));
|
||||
|
||||
TEterPackMap::const_iterator cit;
|
||||
for( cit = m_PackMap.begin(); cit != m_PackMap.end(); ++cit )
|
||||
{
|
||||
EterPackPolicy_CSHybridCrypt* pPolicy = cit->second->GetPackPolicy_HybridCrypt();
|
||||
if( !pPolicy || !pPolicy->IsContainingCryptKey() )
|
||||
continue;
|
||||
|
||||
iKeyPackageCount++;
|
||||
|
||||
std::string noPathName = CFileNameHelper::NoPath(std::string(cit->first));
|
||||
|
||||
DWORD dwPackNamehash = stringhash().GetHash(noPathName);
|
||||
|
||||
CMakePackLog::GetSingleton().Writef("CEterPackManager::WriteHybridCryptPackInfo PackName : %s, Hash : %x", noPathName.c_str(), dwPackNamehash);
|
||||
keyFile.Write( &dwPackNamehash, sizeof(DWORD) );
|
||||
|
||||
pPolicy->WriteCryptKeyToFile( keyFile );
|
||||
}
|
||||
|
||||
//Write SDB Data
|
||||
int iSDBDataOffset = keyFile.GetPosition();
|
||||
int iSDBPackageCnt = 0;
|
||||
|
||||
//Write SDB PackageCnt Later
|
||||
keyFile.SeekCur(sizeof(int));
|
||||
for( cit = m_PackMap.begin(); cit != m_PackMap.end(); ++cit )
|
||||
{
|
||||
EterPackPolicy_CSHybridCrypt* pPolicy = cit->second->GetPackPolicy_HybridCrypt();
|
||||
if( !pPolicy || !pPolicy->IsContainingSDBFile() )
|
||||
continue;
|
||||
|
||||
iSDBPackageCnt++;
|
||||
|
||||
std::string noPathName = CFileNameHelper::NoPath(std::string(cit->first));
|
||||
|
||||
DWORD dwPackNamehash = stringhash().GetHash(noPathName);
|
||||
keyFile.Write( &dwPackNamehash, sizeof(DWORD) );
|
||||
|
||||
int iSDBSizeWriteOffset = keyFile.GetPosition();
|
||||
keyFile.SeekCur(sizeof(int));
|
||||
|
||||
pPolicy->WriteSupplementaryDataBlockToFile( keyFile );
|
||||
int iSDBSizeAfterWrite = keyFile.GetPosition();
|
||||
|
||||
keyFile.Seek(iSDBSizeWriteOffset);
|
||||
|
||||
int iSDBSize = iSDBSizeAfterWrite-(iSDBSizeWriteOffset+4);
|
||||
keyFile.Write( &iSDBSize, sizeof(int) );
|
||||
|
||||
keyFile.Seek(iSDBSizeAfterWrite);
|
||||
}
|
||||
|
||||
//write sdb data start offset & package cnt
|
||||
keyFile.Seek(0);
|
||||
keyFile.Write( &iSDBDataOffset, sizeof(int));
|
||||
keyFile.Write( &iKeyPackageCount, sizeof(int));
|
||||
|
||||
keyFile.Seek(iSDBDataOffset);
|
||||
keyFile.Write( &iSDBPackageCnt, sizeof(int));
|
||||
|
||||
keyFile.Close();
|
||||
const CEterPackManager::TFileMap& CEterPackManager::GetFileMap() {
|
||||
return this->m_FileMap;
|
||||
}
|
||||
|
@ -5,16 +5,10 @@
|
||||
#include "../eterBase/Singleton.h"
|
||||
#include "../eterBase/Stl.h"
|
||||
|
||||
#include "EterPack.h"
|
||||
#include "FileProvider.h"
|
||||
|
||||
class CEterPackManager : public CSingleton<CEterPackManager>
|
||||
{
|
||||
public:
|
||||
struct SCache
|
||||
{
|
||||
BYTE* m_abBufData;
|
||||
DWORD m_dwBufSize;
|
||||
};
|
||||
public:
|
||||
enum ESearchModes
|
||||
{
|
||||
@ -22,69 +16,40 @@ class CEterPackManager : public CSingleton<CEterPackManager>
|
||||
SEARCH_PACK_FIRST
|
||||
};
|
||||
|
||||
typedef std::list<CEterPack*> TEterPackList;
|
||||
typedef std::unordered_map<std::string, CEterPack*, stringhash> TEterPackMap;
|
||||
typedef std::list<std::shared_ptr<FileProvider>> TEterPackList;
|
||||
typedef std::unordered_map<std::string, std::shared_ptr<FileProvider>> TEterPackMap;
|
||||
typedef std::unordered_map<std::string, std::shared_ptr<FileProvider>> TFileMap;
|
||||
typedef std::shared_ptr<std::vector<char>> TPackDataPtr;
|
||||
|
||||
public:
|
||||
CEterPackManager();
|
||||
virtual ~CEterPackManager();
|
||||
|
||||
void SetCacheMode();
|
||||
void SetRelativePathMode();
|
||||
|
||||
void LoadStaticCache(const char* c_szFileName);
|
||||
|
||||
void SetSearchMode(bool bPackFirst);
|
||||
int GetSearchMode();
|
||||
|
||||
bool Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
bool Get(const std::string& fileName, TPackDataPtr& dataPtr);
|
||||
bool Get(const std::string& fileName, std::stringstream& dataStream);
|
||||
|
||||
bool GetFromPack(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
|
||||
bool GetFromFile(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData);
|
||||
bool isExist(const char * c_szFileName);
|
||||
bool isExistInPack(const char * c_szFileName);
|
||||
|
||||
bool RegisterPack(const char * c_szName, const char * c_szDirectory, const BYTE* c_pbIV = NULL);
|
||||
void RegisterRootPack(const char * c_szName);
|
||||
bool RegisterPackWhenPackMaking(const char * c_szName, const char * c_szDirectory, CEterPack* pPack);
|
||||
bool PackExists(const std::string& name, const std::string& container);
|
||||
bool RegisterPack(const std::string& name, const std::string& container);
|
||||
std::string ConvertFileName(std::string fileName);
|
||||
|
||||
|
||||
bool DecryptPackIV(DWORD key);
|
||||
|
||||
const char * GetRootPackFileName();
|
||||
|
||||
//for hybridcrypt
|
||||
void WriteHybridCryptPackInfo(const char* pFileName);
|
||||
|
||||
void RetrieveHybridCryptPackKeys( const BYTE* pStream );
|
||||
void RetrieveHybridCryptPackSDB( const BYTE* pStream );
|
||||
|
||||
// 메모리에 매핑된 팩들 가운데, 정리해야할 것들 정리.
|
||||
public:
|
||||
void ArrangeMemoryMappedPack();
|
||||
const TFileMap& GetFileMap();
|
||||
|
||||
protected:
|
||||
int ConvertFileName(const char * c_szFileName, std::string & rstrFileName); // StringPath std::string 버전
|
||||
bool CompareName(const char * c_szDirectoryName, DWORD iLength, const char * c_szFileName);
|
||||
|
||||
CEterPack* FindPack(const char* c_szPathName);
|
||||
|
||||
SCache* __FindCache(DWORD dwFileNameHash);
|
||||
void __ClearCacheMap();
|
||||
bool GetFromPack(const std::string& fileName, TPackDataPtr& dataPtr);
|
||||
bool GetFromFile(const std::string& fileName, TPackDataPtr& dataPtr);
|
||||
|
||||
protected:
|
||||
bool m_bTryRelativePath;
|
||||
bool m_isCacheMode;
|
||||
int m_iSearchMode;
|
||||
|
||||
CEterFileDict m_FileDict;
|
||||
CEterPack m_RootPack;
|
||||
TEterPackList m_PackList;
|
||||
TFileMap m_FileMap;
|
||||
TEterPackMap m_PackMap;
|
||||
TEterPackMap m_DirPackMap;
|
||||
|
||||
std::unordered_map<DWORD, SCache> m_kMap_dwNameKey_kCache;
|
||||
|
||||
CRITICAL_SECTION m_csFinder;
|
||||
};
|
||||
|
14
src/EterPack/FileProvider.h
Normal file
14
src/EterPack/FileProvider.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
|
||||
class FileProvider
|
||||
{
|
||||
public:
|
||||
virtual std::vector<std::string> listFiles() = 0;
|
||||
virtual bool fileExists(const std::string& fileName) = 0;
|
||||
virtual bool getFile(const std::string& fileName, std::shared_ptr<std::vector<char>>& fileData) = 0;
|
||||
};
|
98
src/EterPack/Folder.cpp
Normal file
98
src/EterPack/Folder.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
#include "Folder.h"
|
||||
#include "EterPackManager.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <Windows.h>
|
||||
#include "../eterBase/Stl.h"
|
||||
|
||||
void Folder::ListFiles(const std::string& directory, const std::string& relativePath = "") {
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFind;
|
||||
|
||||
std::string searchPath = directory + "\\*";
|
||||
|
||||
// Start searching for files and directories
|
||||
hFind = FindFirstFile(searchPath.c_str(), &findData);
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
throw std::runtime_error("Failed to open directory: " + directory);
|
||||
|
||||
do {
|
||||
const std::string fileOrDirName = findData.cFileName;
|
||||
|
||||
// Skip the "." and ".." directories
|
||||
if (fileOrDirName == "." || fileOrDirName == "..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Construct the full and relative paths
|
||||
std::string fullPath = directory + "\\" + fileOrDirName;
|
||||
std::string currentRelativePath = relativePath + fileOrDirName;
|
||||
|
||||
// Check if the current entry is a directory
|
||||
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
// Recurse into the subdirectory
|
||||
ListFiles(fullPath, currentRelativePath + "\\");
|
||||
}
|
||||
else {
|
||||
if (currentRelativePath.rfind("ymir work\\", 0) == 0) {
|
||||
currentRelativePath = "d:\\" + currentRelativePath;
|
||||
}
|
||||
|
||||
currentRelativePath = CEterPackManager::Instance().ConvertFileName(currentRelativePath);
|
||||
|
||||
// Print the file's relative path
|
||||
this->fileList.insert(currentRelativePath);
|
||||
}
|
||||
} while (FindNextFile(hFind, &findData) != 0);
|
||||
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
|
||||
Folder::Folder(const std::string& folderPath)
|
||||
{
|
||||
this->folderPath = folderPath;
|
||||
ListFiles(folderPath);
|
||||
}
|
||||
|
||||
std::vector<std::string> Folder::listFiles()
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
std::copy(fileList.begin(), fileList.end(), std::back_inserter(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Folder::fileExists(const std::string& fileName)
|
||||
{
|
||||
auto it = fileList.find(fileName);
|
||||
|
||||
if (it == fileList.end())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Folder::getFile(const std::string& fileName, std::shared_ptr<std::vector<char>>& fileData)
|
||||
{
|
||||
std::string realFileName = fileName;
|
||||
std::string ymirPrefix = "d:/";
|
||||
|
||||
if (fileName.find(ymirPrefix) == 0)
|
||||
realFileName = realFileName.substr(ymirPrefix.length());
|
||||
|
||||
realFileName = this->folderPath + "/" + realFileName;
|
||||
|
||||
// Try to open the file
|
||||
std::ifstream file(realFileName, std::ios::binary);
|
||||
if (!file.is_open())
|
||||
return false;
|
||||
|
||||
// Read the file's contents
|
||||
fileData = std::make_shared<std::vector<char>>(
|
||||
std::istreambuf_iterator<char>(file),
|
||||
std::istreambuf_iterator<char>()
|
||||
);
|
||||
return true;
|
||||
}
|
23
src/EterPack/Folder.h
Normal file
23
src/EterPack/Folder.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
#include "FileProvider.h"
|
||||
|
||||
class Folder : public FileProvider
|
||||
{
|
||||
protected:
|
||||
std::string folderPath;
|
||||
std::set<std::string> fileList = {};
|
||||
|
||||
public:
|
||||
Folder(const std::string& folderPath);
|
||||
std::vector<std::string> listFiles();
|
||||
bool fileExists(const std::string& fileName);
|
||||
bool getFile(const std::string& fileName, std::shared_ptr<std::vector<char>>& fileData);
|
||||
|
||||
private:
|
||||
void ListFiles(const std::string& directory, const std::string& relativePath);
|
||||
};
|
||||
|
@ -1,2 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
|
97
src/EterPack/ZIP.cpp
Normal file
97
src/EterPack/ZIP.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
#include "ZIP.h"
|
||||
#include "EterPackManager.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <Windows.h>
|
||||
#include "../eterBase/Stl.h"
|
||||
|
||||
ZIP::ZIP(const std::string& archivePath)
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((zipFile = zip_open(archivePath.c_str(), 0, &err)) == NULL) {
|
||||
zip_error_t error;
|
||||
|
||||
zip_error_init_with_code(&error, err);
|
||||
std::string errorMessage = zip_error_strerror(&error);
|
||||
zip_error_fini(&error);
|
||||
|
||||
throw std::runtime_error("Cannot open ZIP archive '" + archivePath + "': " + errorMessage);
|
||||
}
|
||||
|
||||
// Read the list of files in the archive
|
||||
zip_int64_t numEntries = zip_get_num_entries(zipFile, 0);
|
||||
for (int index = 0; index < numEntries; index++)
|
||||
{
|
||||
zip_stat_t fileData;
|
||||
zip_stat_index(zipFile, index, 0, &fileData);
|
||||
|
||||
std::string fileName(fileData.name);
|
||||
|
||||
if (fileData.size == 0) {
|
||||
// This is a folder, skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fileName.rfind("ymir work/", 0) == 0) {
|
||||
fileName = "d:/" + fileName;
|
||||
}
|
||||
|
||||
fileName = CEterPackManager::Instance().ConvertFileName(fileName);
|
||||
|
||||
fileList.insert({ fileName, fileData.index });
|
||||
}
|
||||
}
|
||||
|
||||
ZIP::~ZIP()
|
||||
{
|
||||
zip_close(zipFile);
|
||||
zipFile = nullptr;
|
||||
}
|
||||
|
||||
std::vector<std::string> ZIP::listFiles()
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
for (auto const& file : fileList)
|
||||
result.push_back(file.first);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ZIP::fileExists(const std::string& fileName)
|
||||
{
|
||||
auto it = fileList.find(fileName);
|
||||
if (it == fileList.end())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZIP::getFile(const std::string& fileName, std::shared_ptr<std::vector<char>>& fileData)
|
||||
{
|
||||
auto it = fileList.find(fileName);
|
||||
if (it == fileList.end())
|
||||
return false;
|
||||
|
||||
auto file = zip_fopen_index(zipFile, it->second, 0);
|
||||
if (file == NULL)
|
||||
return false;
|
||||
|
||||
zip_stat_t fileInfo;
|
||||
zip_stat_index(zipFile, it->second, 0, &fileInfo);
|
||||
|
||||
// Initialize the buffer
|
||||
fileData = std::make_shared<std::vector<char>>(fileInfo.size);
|
||||
|
||||
// Attempt to read the data into the buffer
|
||||
auto retval = zip_fread(file, fileData->data(), fileData->size());
|
||||
|
||||
// Close the file
|
||||
zip_fclose(file);
|
||||
|
||||
if (retval == -1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
20
src/EterPack/ZIP.h
Normal file
20
src/EterPack/ZIP.h
Normal file
@ -0,0 +1,20 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <zip.h>
|
||||
|
||||
#include "FileProvider.h"
|
||||
|
||||
class ZIP : public FileProvider
|
||||
{
|
||||
protected:
|
||||
zip_t* zipFile = nullptr;
|
||||
std::map<std::string, zip_uint64_t> fileList;
|
||||
|
||||
public:
|
||||
ZIP(const std::string& archivePath);
|
||||
~ZIP();
|
||||
|
||||
std::vector<std::string> listFiles();
|
||||
bool fileExists(const std::string& fileName);
|
||||
bool getFile(const std::string& fileName, std::shared_ptr<std::vector<char>>& fileData);
|
||||
};
|
1033
src/EterPack/md5.c
1033
src/EterPack/md5.c
File diff suppressed because it is too large
Load Diff
@ -1,128 +0,0 @@
|
||||
#ifndef __INC_ETERPACKLIB_MD5_H__
|
||||
#define __INC_ETERPACKLIB_MD5_H__
|
||||
|
||||
/*
|
||||
|
||||
***********************************************************************
|
||||
|
||||
** md5.h -- header file for implementation of MD5 **
|
||||
|
||||
** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
|
||||
|
||||
** Created: 2/17/90 RLR **
|
||||
|
||||
** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
|
||||
|
||||
** Revised (for MD5): RLR 4/27/91 **
|
||||
|
||||
** -- G modified to have y&~z instead of y&z **
|
||||
|
||||
** -- FF, GG, HH modified to add in last register done **
|
||||
|
||||
** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
|
||||
|
||||
** -- distinct additive constant for each step **
|
||||
|
||||
** -- round 4 added, working mod 7 **
|
||||
|
||||
***********************************************************************
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
***********************************************************************
|
||||
|
||||
** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
|
||||
|
||||
** **
|
||||
|
||||
** License to copy and use this software is granted provided that **
|
||||
|
||||
** it is identified as the "RSA Data Security, Inc. MD5 Message- **
|
||||
|
||||
** Digest Algorithm" in all material mentioning or referencing this **
|
||||
|
||||
** software or this function. **
|
||||
|
||||
** **
|
||||
|
||||
** License is also granted to make and use derivative works **
|
||||
|
||||
** provided that such works are identified as "derived from the RSA **
|
||||
|
||||
** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
|
||||
|
||||
** material mentioning or referencing the derived work. **
|
||||
|
||||
** **
|
||||
|
||||
** RSA Data Security, Inc. makes no representations concerning **
|
||||
|
||||
** either the merchantability of this software or the suitability **
|
||||
|
||||
** of this software for any particular purpose. It is provided "as **
|
||||
|
||||
** is" without express or implied warranty of any kind. **
|
||||
|
||||
** **
|
||||
|
||||
** These notices must be retained in any copies of any part of this **
|
||||
|
||||
** documentation and/or software. **
|
||||
|
||||
***********************************************************************
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* typedef a 32-bit type */
|
||||
|
||||
typedef unsigned long int UINT4;
|
||||
|
||||
|
||||
|
||||
/* Data structure for MD5 (Message-Digest) computation */
|
||||
|
||||
typedef struct {
|
||||
|
||||
UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
|
||||
|
||||
UINT4 buf[4]; /* scratch buffer */
|
||||
|
||||
unsigned char in[64]; /* input buffer */
|
||||
|
||||
unsigned char digest[16]; /* actual digest after MD5Final call */
|
||||
|
||||
} MD5_CTX;
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void MD5Init (MD5_CTX *);
|
||||
|
||||
void MD5Update (MD5_CTX *,unsigned char *,unsigned int);
|
||||
|
||||
void MD5Final (MD5_CTX *);
|
||||
|
||||
void MD5Transform(UINT4 *,UINT4 *);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
***********************************************************************
|
||||
|
||||
** End of md5.h **
|
||||
|
||||
******************************** (cut) ********************************
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
@ -93,7 +93,7 @@ namespace UI
|
||||
m_bShow = false;
|
||||
}
|
||||
|
||||
// NOTE : IsShow는 "\xC0\xDA\xBD\xC5\xC0\xCC \xBA\xB8\xC0\xCC\xB4\xC2\xB0\xA1?" 이지만, __IsShowing은 "\xC0\xDA\xBD\xC5\xC0\xCC \xB1\xD7\xB7\xC1\xC1\xF6\xB0\xED \xC0\xD6\xB4\xC2\xB0\xA1?" 를 체크한다
|
||||
// NOTE : IsShow는 "자신이 보이는가?" 이지만, __IsShowing은 "자신이 그려지고 있는가?" 를 체크한다
|
||||
// 자신은 Show 지만 Tree 위쪽의 Parent 중 하나는 Hide 일 수 있으므로.. - [levites]
|
||||
bool CWindow::IsRendering()
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ bool CActorInstance::InputComboAttackCommand(float fDirRot)
|
||||
// 이미 입력 한계 시간이 지났다면..
|
||||
if (fElapsedTime > m_pkCurRaceMotionData->GetComboInputEndTime())
|
||||
{
|
||||
//Tracen("\xC0\xD4\xB7\xC2 \xC7\xD1\xB0\xE8 \xBD\xC3\xB0\xA3 \xC1\xF6\xB3\xB2");
|
||||
//Tracen("Input Timeout");
|
||||
if (IsBowMode())
|
||||
m_isNextPreInput = TRUE;
|
||||
return false;
|
||||
@ -184,14 +184,14 @@ bool CActorInstance::InputComboAttackCommand(float fDirRot)
|
||||
|
||||
if (fElapsedTime > m_pkCurRaceMotionData->GetNextComboTime()) // 콤보 발동 시간 이 후라면
|
||||
{
|
||||
//Tracen("\xB4\xD9\xC0\xBD \xC4\xDE\xBA\xB8 \xB5\xBF\xC0\xDB");
|
||||
//Tracen("Next combo action");
|
||||
// args : BlendingTime
|
||||
__RunNextCombo();
|
||||
return true;
|
||||
}
|
||||
else if (fElapsedTime > m_pkCurRaceMotionData->GetComboInputStartTime()) // 선 입력 시간 범위 라면..
|
||||
{
|
||||
//Tracen("\xBC\xB1 \xC0\xD4\xB7\xC2 \xBC\xB3\xC1\xA4");
|
||||
//Tracen("Setting up line input");
|
||||
m_isPreInput = TRUE;
|
||||
return false;
|
||||
}
|
||||
@ -201,7 +201,7 @@ bool CActorInstance::InputComboAttackCommand(float fDirRot)
|
||||
float fElapsedTime = GetAttackingElapsedTime();
|
||||
if (fElapsedTime > m_pkCurRaceMotionData->GetMotionDuration()*0.9f) // 콤보 발동 시간 이 후라면
|
||||
{
|
||||
//Tracen("\xB4\xD9\xC0\xBD \xC4\xDE\xBA\xB8 \xB5\xBF\xC0\xDB");
|
||||
//Tracen("Next combo action");
|
||||
// args : BlendingTime
|
||||
__RunNextCombo();
|
||||
return true;
|
||||
@ -229,7 +229,7 @@ void CActorInstance::ComboProcess()
|
||||
// Process PreInput
|
||||
if (m_isPreInput)
|
||||
{
|
||||
//Tracenf("\xBC\xB1\xC0\xD4\xB7\xC2 %f \xB4\xD9\xC0\xBD\xC4\xDE\xBA\xB8\xBD\xC3\xB0\xA3 %f", fElapsedTime, m_pkCurRaceMotionData->GetNextComboTime());
|
||||
//Tracenf("Prefix %f NextComboTime %f", fElapsedTime, m_pkCurRaceMotionData->GetNextComboTime());
|
||||
if (fElapsedTime > m_pkCurRaceMotionData->GetNextComboTime())
|
||||
{
|
||||
__RunNextCombo();
|
||||
|
@ -65,7 +65,7 @@ void CActorInstance::ReservingMotionProcess()
|
||||
case CRaceMotionData::NAME_STAND_UP_BACK:
|
||||
if (IsFaint())
|
||||
{
|
||||
//Tracenf("\xC0\xCF\xBE\xEE\xBC\xAD\xB7\xC1\xB0\xED \xC7\xDF\xC0\xB8\xB3\xAA \xB1\xE2\xC0\xFD\xC1\xDF");
|
||||
//Tracenf("You tried to stand up but are fainted");
|
||||
|
||||
SetEndStopMotion();
|
||||
|
||||
@ -98,7 +98,7 @@ void CActorInstance::ReservingMotionProcess()
|
||||
case CRaceMotionData::NAME_STAND_UP_BACK:
|
||||
if (IsDead())
|
||||
{
|
||||
//Tracenf("\xC0\xCF\xBE\xEE\xBC\xAD\xB7\xC1\xB0\xED \xC7\xDF\xC0\xB8\xB3\xAA \xBB\xE7\xB8\xC1");
|
||||
//Tracenf("You tried to stand up but are dead");
|
||||
// 예전 데이터로 복구
|
||||
m_kCurMotNode=kPrevMotionNode;
|
||||
__ClearMotion();
|
||||
@ -668,7 +668,7 @@ DWORD CActorInstance::__SetMotion(const SSetMotionData& c_rkSetMotData, DWORD dw
|
||||
{
|
||||
if (!m_isMain)
|
||||
{
|
||||
Logn(0, "\xC1\xD6\xC0\xCE\xB0\xF8\xC0\xCC \xBE\xC6\xB4\xCF\xB6\xF3\xB8\xE9 \xC0\xCC\xB5\xBF\xC1\xDF\xC0\xCC\xB6\xF3 \xB5\xA5\xB9\xCC\xC1\xF6 \xB5\xBF\xC0\xDB\xC0\xBB \xC3\xEB\xC7\xCF\xC1\xF6 \xBE\xCA\xC0\xBD");
|
||||
Logn(0, "If you're not the main character, you're moving and don't do damage moves.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -757,7 +757,7 @@ DWORD CActorInstance::__SetMotion(const SSetMotionData& c_rkSetMotData, DWORD dw
|
||||
|
||||
// NOTE : ClearCombo() 를 수행해서는 안된다.
|
||||
// 콤보 다음에 스킬을 이어서 사용할 경우 m_pkCurRaceMotionData까지 초기화 되어 버린다.
|
||||
//Tracef("MotionData\xBF\xA1 \xC4\xDE\xBA\xB8 \xB5\xA5\xC0\xCC\xC5\xB8\xB0\xA1 \xB5\xE9\xBE\xEE \xC0\xD6\xC1\xF6 \xBE\xCA\xBD\xC0\xB4\xCF\xB4\xD9.\n");
|
||||
//Tracef("MotionData does not contain combo data.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void CActorInstance::RotationProcess()
|
||||
m_fcurRotation = m_rotEnd;
|
||||
}
|
||||
|
||||
// FIXME : "\xB0\xC7\xB9\xB0\xC0\xCF\xB6\xA7\xB8\xB8 \xC3\xBC\xC5\xA9"로 바꾼다. - [levites]
|
||||
// FIXME : "건물일때만 체크"로 바꾼다. - [levites]
|
||||
if (0.0f != m_rotX || 0.0f != m_rotY)
|
||||
{
|
||||
CGraphicObjectInstance::SetRotation(m_rotX, m_rotY, m_fcurRotation);
|
||||
|
@ -106,10 +106,8 @@ bool CTerrain::LoadShadowMap(const char * c_pszFileName)
|
||||
DWORD dwStart = ELTimer_GetMSec();
|
||||
Tracef("LoadShadowMap %s ", c_pszFileName);
|
||||
|
||||
CMappedFile file;
|
||||
LPCVOID c_pvData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(file, c_pszFileName, &c_pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!CEterPackManager::Instance().Get(c_pszFileName, data))
|
||||
{
|
||||
TraceError(" CTerrain::LoadShadowMap - %s OPEN ERROR", c_pszFileName);
|
||||
return false;
|
||||
@ -117,13 +115,13 @@ bool CTerrain::LoadShadowMap(const char * c_pszFileName)
|
||||
|
||||
DWORD dwShadowMapSize = sizeof(WORD) * 256 * 256;
|
||||
|
||||
if (file.Size() != dwShadowMapSize)
|
||||
if (data->size() != dwShadowMapSize)
|
||||
{
|
||||
TraceError(" CTerrain::LoadShadowMap - %s SIZE ERROR", c_pszFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(m_awShadowMap, c_pvData, dwShadowMapSize);
|
||||
memcpy_s(m_awShadowMap, dwShadowMapSize, data->data(), data->size());
|
||||
|
||||
Tracef("%d ms\n", ELTimer_GetMSec() - dwStart);
|
||||
return true;
|
||||
|
@ -203,7 +203,7 @@ void CItemData::__SetIconImage(const char * c_szFileName)
|
||||
{
|
||||
if (!CResourceManager::Instance().IsFileExist(c_szFileName))
|
||||
{
|
||||
TraceError("%s \xC6\xC4\xC0\xCF\xC0\xCC \xBE\xF8\xBD\xC0\xB4\xCF\xB4\xD9.CItemData::__SetIconImage",c_szFileName);
|
||||
TraceError("%s file is missing.CItemData::__SetIconImage",c_szFileName);
|
||||
m_pIconImage = NULL;
|
||||
}
|
||||
else if (m_pIconImage == NULL)
|
||||
|
@ -95,14 +95,12 @@ CItemData * CItemManager::MakeItemData(DWORD dwIndex)
|
||||
|
||||
bool CItemManager::LoadItemList(const char * c_szFileName)
|
||||
{
|
||||
CMappedFile File;
|
||||
LPCVOID pData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(File, c_szFileName, &pData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
textFileLoader.Bind(File.Size(), pData);
|
||||
textFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
CTokenVector TokenVector;
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
@ -196,16 +194,15 @@ const std::string& __SnapString(const std::string& c_rstSrc, std::string& rstTem
|
||||
|
||||
bool CItemManager::LoadItemDesc(const char* c_szFileName)
|
||||
{
|
||||
const VOID* pvData;
|
||||
CMappedFile kFile;
|
||||
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader kTextFileLoader;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
{
|
||||
Tracenf("CItemManager::LoadItemDesc(c_szFileName=%s) - Load Error", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
CMemoryTextFileLoader kTextFileLoader;
|
||||
kTextFileLoader.Bind(kFile.Size(), pvData);
|
||||
kTextFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
std::string stTemp;
|
||||
|
||||
@ -254,22 +251,27 @@ DWORD GetHashCode( const char* pString )
|
||||
|
||||
bool CItemManager::LoadItemTable(const char* c_szFileName)
|
||||
{
|
||||
CMappedFile file;
|
||||
LPCVOID pvData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(file, c_szFileName, &pvData))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
DWORD dwFourCC, dwElements, dwDataSize;
|
||||
DWORD dwVersion=0;
|
||||
DWORD dwStride=0;
|
||||
|
||||
file.Read(&dwFourCC, sizeof(DWORD));
|
||||
data.read((char*)&dwFourCC, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
if (dwFourCC == MAKEFOURCC('M', 'I', 'P', 'X'))
|
||||
{
|
||||
file.Read(&dwVersion, sizeof(DWORD));
|
||||
file.Read(&dwStride, sizeof(DWORD));
|
||||
data.read((char*)&dwVersion, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
data.read((char*)&dwStride, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
if (dwVersion != 1)
|
||||
{
|
||||
@ -289,19 +291,25 @@ bool CItemManager::LoadItemTable(const char* c_szFileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
file.Read(&dwElements, sizeof(DWORD));
|
||||
file.Read(&dwDataSize, sizeof(DWORD));
|
||||
data.read((char*)&dwElements, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
BYTE * pbData = new BYTE[dwDataSize];
|
||||
file.Read(pbData, dwDataSize);
|
||||
data.read((char*)&dwDataSize, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
auto pbData = std::make_shared<std::vector<BYTE>>(dwDataSize);
|
||||
data.read((char*)pbData->data(), pbData->size());
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
/////
|
||||
|
||||
CLZObject zObj;
|
||||
|
||||
if (!CLZO::Instance().Decompress(zObj, pbData, s_adwItemProtoKey))
|
||||
if (!CLZO::Instance().Decompress(zObj, pbData->data(), s_adwItemProtoKey))
|
||||
{
|
||||
delete [] pbData;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -382,7 +390,6 @@ bool CItemManager::LoadItemTable(const char* c_szFileName)
|
||||
// pItemData->SetItemTableData(table);
|
||||
// }
|
||||
|
||||
delete [] pbData;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ bool CMapBase::LoadProperty()
|
||||
|
||||
if (!LoadMultipleTextData(strFileName.c_str(), stTokenVectorMap))
|
||||
{
|
||||
TraceError("CMapBase::LoadProperty(FileName=%s) - LoadMultipleTextData ERROR \xC6\xC4\xC0\xCF\xC0\xCC \xBE\xF8\xC0\xBB \xB0\xA1\xB4\xC9\xBC\xBA\xC0\xCC \xB8\xB9\xBD\xC0\xB4\xCF\xB4\xD9.", strFileName.c_str());
|
||||
TraceError("CMapBase::LoadProperty(FileName=%s) - LoadMultipleTextData ERROR The file is likely missing.", strFileName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ float CMapManager::GetHeight(float fx, float fy)
|
||||
{
|
||||
if (!m_pkMap)
|
||||
{
|
||||
TraceError("CMapManager::GetHeight(%f, %f) - \xB8\xCA\xC0\xCC \xBB\xFD\xBC\xBA\xB5\xC7\xC1\xF6 \xBE\xCA\xC0\xBA \xBB\xF3\xC5\xC2\xBF\xA1\xBC\xAD \xC1\xA2\xB1\xD9", fx, fy);
|
||||
TraceError("CMapManager::GetHeight(%f, %f) - Access without a map created", fx, fy);
|
||||
return 0.0f;
|
||||
}
|
||||
CMapOutdoor& rkMap=GetMapOutdoorRef();
|
||||
@ -195,7 +195,7 @@ float CMapManager::GetTerrainHeight(float fx, float fy)
|
||||
{
|
||||
if (!m_pkMap)
|
||||
{
|
||||
TraceError("CMapManager::GetTerrainHeight(%f, %f) - \xB8\xCA\xC0\xCC \xBB\xFD\xBC\xBA\xB5\xC7\xC1\xF6 \xBE\xCA\xC0\xBA \xBB\xF3\xC5\xC2\xBF\xA1\xBC\xAD \xC1\xA2\xB1\xD9", fx, fy);
|
||||
TraceError("CMapManager::GetTerrainHeight(%f, %f) - Access without a map created", fx, fy);
|
||||
return 0.0f;
|
||||
}
|
||||
CMapOutdoor& rkMap=GetMapOutdoorRef();
|
||||
@ -206,7 +206,7 @@ bool CMapManager::GetWaterHeight(int iX, int iY, long * plWaterHeight)
|
||||
{
|
||||
if (!m_pkMap)
|
||||
{
|
||||
TraceError("CMapManager::GetTerrainHeight(%f, %f) - \xB8\xCA\xC0\xCC \xBB\xFD\xBC\xBA\xB5\xC7\xC1\xF6 \xBE\xCA\xC0\xBA \xBB\xF3\xC5\xC2\xBF\xA1\xBC\xAD \xC1\xA2\xB1\xD9", iX, iY);
|
||||
TraceError("CMapManager::GetTerrainHeight(%f, %f) - Access without a map created", iX, iY);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -597,14 +597,14 @@ void CMapManager::GetBaseXY(DWORD * pdwBaseX, DWORD * pdwBaseY)
|
||||
|
||||
void CMapManager::__LoadMapInfoVector()
|
||||
{
|
||||
CMappedFile kFile;
|
||||
LPCVOID pData;
|
||||
if (!CEterPackManager::Instance().Get(kFile, m_stAtlasInfoFileName.c_str(), &pData))
|
||||
if (!CEterPackManager::Instance().Get(kFile, "AtlasInfo.txt", &pData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(m_stAtlasInfoFileName, data))
|
||||
if (!CEterPackManager::Instance().Get("AtlasInfo.txt", data))
|
||||
return;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
textFileLoader.Bind(kFile.Size(), pData);
|
||||
textFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
char szMapName[256];
|
||||
int x, y;
|
||||
|
@ -398,7 +398,7 @@ bool CMapOutdoor::LoadSetting(const char * c_szFileName)
|
||||
{
|
||||
#ifdef WORLD_EDITOR
|
||||
// TextureSet 이 적용되어 있지 않아도 진행
|
||||
LogBox("TextureSet \xC0\xCC \xC0\xFB\xBF\xEB\xB5\xC7\xBE\xEE\xC0\xD6\xC1\xF6 \xBE\xCA\xC0\xBA \xB8\xCA \xC0\xD4\xB4\xCF\xB4\xD9.\n\xC1\xF6\xC7\xFC \xC5\xD8\xBD\xBA\xC3\xE7 \xC0\xDB\xBE\xF7\xBF\xA1 \xC1\xD6\xC0\xC7\xC7\xCF\xBD\xC3\xB1\xE2 \xB9\xD9\xB6\xF8\xB4\xCF\xB4\xD9.");
|
||||
LogBox("This map does not have a TextureSet applied. Be careful when working with terrain textures.");
|
||||
#else
|
||||
TraceError("MapOutdoor::LoadSetting(c_szFileName=%s) - LOAD TEXTURE SET(%s) ERROR", c_szFileName, stTextureSetFileName.c_str());
|
||||
return false;
|
||||
@ -452,19 +452,18 @@ bool CMapOutdoor::LoadMonsterAreaInfo()
|
||||
char c_szFileName[256];
|
||||
sprintf(c_szFileName, "%s\\regen.txt", GetMapDataDirectory().c_str());
|
||||
|
||||
LPCVOID pModelData;
|
||||
CMappedFile File;
|
||||
CEterPackManager::TPackDataPtr modelData;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(File, c_szFileName, &pModelData))
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, modelData))
|
||||
{
|
||||
//TraceError(" CMapOutdoorAccessor::LoadMonsterAreaInfo Load File %s ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
CTokenVector stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pModelData);
|
||||
textFileLoader.Bind(modelData->size(), modelData->data());
|
||||
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
{
|
||||
|
@ -742,7 +742,7 @@ void CMapOutdoor::UpdateTerrain(float fX, float fY)
|
||||
|
||||
ConvertTerrainToTnL(lRealCenterX, lRealCenterY);
|
||||
UpdateAreaList(lRealCenterX, lRealCenterY);
|
||||
//Tracef("\xBB\xE7\xBF\xEB\xC7\xCF\xB4\xC2 Area, Terrain : (%d, %d), \xC1\xF6\xBF\xEF Area, Terrain : (%d, %d)\n",
|
||||
//Tracef("Use Area, Terrain : (%d, %d), Clear Area, Terrain : (%d, %d)\n",
|
||||
// m_AreaVector.size(), m_TerrainVector.size(), m_AreaDeleteVector.size(), m_TerrainDeleteVector.size());
|
||||
}
|
||||
}
|
||||
|
@ -136,54 +136,6 @@ void GetTimeString(char * str, time_t ct)
|
||||
tm.tm_sec);
|
||||
}
|
||||
|
||||
bool CProperty::Save(const char * c_pszFileName)
|
||||
{
|
||||
CTempFile file;
|
||||
|
||||
DWORD fourcc = MAKEFOURCC('Y', 'P', 'R', 'T');
|
||||
file.Write(&fourcc, sizeof(DWORD));
|
||||
file.Write("\r\n", 2);
|
||||
|
||||
if (0 == m_stCRC.length())
|
||||
{
|
||||
char szCRC[MAX_PATH + 16 + 1];
|
||||
|
||||
GetTimeString(szCRC, time(0));
|
||||
strcpy(szCRC + strlen(szCRC), c_pszFileName);
|
||||
|
||||
m_dwCRC = CPropertyManager::Instance().GetUniqueCRC(szCRC);
|
||||
_snprintf(szCRC, sizeof(szCRC), "%u", m_dwCRC);
|
||||
|
||||
m_stCRC.assign(szCRC);
|
||||
}
|
||||
|
||||
file.Write(m_stCRC.c_str(), m_stCRC.length());
|
||||
file.Write("\r\n", 2);
|
||||
|
||||
CTokenVectorMap::iterator itor = m_stTokenMap.begin();
|
||||
char buf[4096 + 1];
|
||||
|
||||
while (itor != m_stTokenMap.end())
|
||||
{
|
||||
CTokenVector & tokenVector = itor->second;
|
||||
|
||||
int len = _snprintf(buf, sizeof(buf), "%s\t", itor->first.c_str());
|
||||
file.Write(buf, len);
|
||||
|
||||
for (DWORD i = 0; i < tokenVector.size(); ++i)
|
||||
{
|
||||
len = _snprintf(buf, sizeof(buf), "\t\"%s\"", tokenVector[i].c_str());
|
||||
file.Write(buf, len);
|
||||
}
|
||||
|
||||
file.Write("\r\n", 2);
|
||||
++itor;
|
||||
}
|
||||
|
||||
file.Close();
|
||||
return CPropertyManager::Instance().Put(c_pszFileName, file.GetFileName());
|
||||
}
|
||||
|
||||
bool CProperty::ReadFromMemory(const void * c_pvData, int iLen, const char * c_pszFileName)
|
||||
{
|
||||
const char * pcData = (const char *) c_pvData;
|
||||
|
@ -19,8 +19,6 @@ class CProperty
|
||||
void PutVector(const char * c_pszKey, const CTokenVector & c_rTokenVector);
|
||||
void PutString(const char * c_pszKey, const char * c_pszString);
|
||||
|
||||
bool Save(const char * c_pszFileName);
|
||||
|
||||
DWORD GetSize();
|
||||
DWORD GetCRC();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "PropertyManager.h"
|
||||
#include "Property.h"
|
||||
|
||||
CPropertyManager::CPropertyManager() : m_isFileMode(true)
|
||||
CPropertyManager::CPropertyManager()
|
||||
{
|
||||
}
|
||||
|
||||
@ -13,90 +13,34 @@ CPropertyManager::~CPropertyManager()
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool CPropertyManager::Initialize(const char * c_pszPackFileName)
|
||||
void CPropertyManager::Initialize()
|
||||
{
|
||||
if (c_pszPackFileName)
|
||||
auto fileMap = CEterPackManager::Instance().GetFileMap();
|
||||
|
||||
for (auto& itor : fileMap)
|
||||
{
|
||||
if (!m_pack.Create(m_fileDict, c_pszPackFileName, "", true))
|
||||
if (itor.first.rfind("property/reserve", 0) == 0)
|
||||
{
|
||||
LogBoxf("Cannot open property pack file (filename %s)", c_pszPackFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_isFileMode = false;
|
||||
|
||||
TDataPositionMap & indexMap = m_pack.GetIndexMap();
|
||||
|
||||
TDataPositionMap::iterator itor = indexMap.begin();
|
||||
|
||||
typedef std::map<DWORD, TEterPackIndex *> TDataPositionMap;
|
||||
|
||||
int i = 0;
|
||||
|
||||
while (indexMap.end() != itor)
|
||||
{
|
||||
TEterPackIndex * pIndex = itor->second;
|
||||
++itor;
|
||||
|
||||
if (!stricmp("property/reserve", pIndex->filename))
|
||||
{
|
||||
LoadReservedCRC(pIndex->filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Register(pIndex->filename))
|
||||
continue;
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isFileMode = true;
|
||||
// NOTE : 여기서 Property를 등록시키면 WorldEditor에서 이상이 생김 ;
|
||||
// 또한, Property Tree List에도 등록을 시켜야 되기 때문에 바깥쪽에서.. - [levites]
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPropertyManager::BuildPack()
|
||||
{
|
||||
if (!m_pack.Create(m_fileDict, "property", ""))
|
||||
return false;
|
||||
|
||||
WIN32_FIND_DATA fdata;
|
||||
HANDLE hFind = FindFirstFile("property\\*", &fdata);
|
||||
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
do
|
||||
{
|
||||
if (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
LoadReservedCRC(itor.first.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
char szSourceFileName[256 + 1];
|
||||
_snprintf(szSourceFileName, sizeof(szSourceFileName), "property\\%s", fdata.cFileName);
|
||||
|
||||
m_pack.Put(fdata.cFileName, szSourceFileName,COMPRESSED_TYPE_NONE,"");
|
||||
if (itor.first.rfind("property/", 0) == 0) {
|
||||
if (!Register(itor.first.c_str()))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
while (FindNextFile(hFind, &fdata));
|
||||
|
||||
FindClose(hFind);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPropertyManager::LoadReservedCRC(const char * c_pszFileName)
|
||||
{
|
||||
CMappedFile file;
|
||||
LPCVOID c_pvData;
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(file, c_pszFileName, &c_pvData))
|
||||
if (!CEterPackManager::Instance().Get(c_pszFileName, data))
|
||||
return false;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
textFileLoader.Bind(file.Size(), c_pvData);
|
||||
textFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
{
|
||||
@ -136,15 +80,13 @@ DWORD CPropertyManager::GetUniqueCRC(const char * c_szSeed)
|
||||
|
||||
bool CPropertyManager::Register(const char * c_pszFileName, CProperty ** ppProperty)
|
||||
{
|
||||
CMappedFile file;
|
||||
LPCVOID c_pvData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(file, c_pszFileName, &c_pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!CEterPackManager::Instance().Get(c_pszFileName, data))
|
||||
return false;
|
||||
|
||||
CProperty * pProperty = new CProperty(c_pszFileName);
|
||||
|
||||
if (!pProperty->ReadFromMemory(c_pvData, file.Size(), c_pszFileName))
|
||||
if (!pProperty->ReadFromMemory(data->data(), data->size(), c_pszFileName))
|
||||
{
|
||||
delete pProperty;
|
||||
return false;
|
||||
@ -188,67 +130,6 @@ bool CPropertyManager::Get(DWORD dwCRC, CProperty ** ppProperty)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPropertyManager::Put(const char * c_pszFileName, const char * c_pszSourceFileName)
|
||||
{
|
||||
if (!CopyFile(c_pszSourceFileName, c_pszFileName, FALSE))
|
||||
return false;
|
||||
|
||||
if (!m_isFileMode) // 팩 파일에도 넣음
|
||||
{
|
||||
if (!m_pack.Put(c_pszFileName, NULL, COMPRESSED_TYPE_NONE,""))
|
||||
{
|
||||
assert(!"CPropertyManager::Put cannot write to pack file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Register(c_pszFileName);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPropertyManager::Erase(DWORD dwCRC)
|
||||
{
|
||||
TPropertyCRCMap::iterator itor = m_PropertyByCRCMap.find(dwCRC);
|
||||
|
||||
if (m_PropertyByCRCMap.end() == itor)
|
||||
return false;
|
||||
|
||||
CProperty * pProperty = itor->second;
|
||||
m_PropertyByCRCMap.erase(itor);
|
||||
|
||||
DeleteFile(pProperty->GetFileName());
|
||||
ReserveCRC(pProperty->GetCRC());
|
||||
|
||||
if (!m_isFileMode) // 파일 모드가 아니면 팩에서도 지움
|
||||
m_pack.Delete(pProperty->GetFileName());
|
||||
|
||||
FILE * fp = fopen("property/reserve", "a+");
|
||||
|
||||
if (!fp)
|
||||
LogBox("\xBF\xB9\xBE\xE0 CRC \xC6\xC4\xC0\xCF\xC0\xBB \xBF\xAD \xBC\xF6 \xBE\xF8\xBD\xC0\xB4\xCF\xB4\xD9.");
|
||||
else
|
||||
{
|
||||
char szCRC[64 + 1];
|
||||
_snprintf(szCRC, sizeof(szCRC), "%u\r\n", pProperty->GetCRC());
|
||||
|
||||
fputs(szCRC, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
delete pProperty;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPropertyManager::Erase(const char * c_pszFileName)
|
||||
{
|
||||
CProperty * pProperty = NULL;
|
||||
|
||||
if (Get(c_pszFileName, &pProperty))
|
||||
return Erase(pProperty->GetCRC());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPropertyManager::Clear()
|
||||
{
|
||||
stl_wipe_second(m_PropertyByCRCMap);
|
||||
|
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "../eterPack/EterPack.h"
|
||||
|
||||
class CPropertyManager : public CSingleton<CPropertyManager>
|
||||
{
|
||||
public:
|
||||
@ -10,34 +8,20 @@ class CPropertyManager : public CSingleton<CPropertyManager>
|
||||
|
||||
void Clear();
|
||||
|
||||
void SetPack(CEterPack * pPack);
|
||||
bool BuildPack();
|
||||
|
||||
bool LoadReservedCRC(const char * c_pszFileName);
|
||||
void ReserveCRC(DWORD dwCRC);
|
||||
DWORD GetUniqueCRC(const char * c_szSeed);
|
||||
|
||||
bool Initialize(const char * c_pszPackFileName = NULL);
|
||||
void Initialize();
|
||||
bool Register(const char * c_pszFileName, CProperty ** ppProperty = NULL);
|
||||
|
||||
bool Get(DWORD dwCRC, CProperty ** ppProperty);
|
||||
bool Get(const char * c_pszFileName, CProperty ** ppProperty);
|
||||
|
||||
// bool Add(const char * c_pszFileName);
|
||||
// bool Remove(DWORD dwCRC);
|
||||
|
||||
bool Put(const char * c_pszFileName, const char * c_pszSourceFileName);
|
||||
|
||||
bool Erase(DWORD dwCRC);
|
||||
bool Erase(const char * c_pszFileName);
|
||||
|
||||
protected:
|
||||
typedef std::map<DWORD, CProperty *> TPropertyCRCMap;
|
||||
typedef std::set<DWORD> TCRCSet;
|
||||
|
||||
bool m_isFileMode;
|
||||
TPropertyCRCMap m_PropertyByCRCMap;
|
||||
TCRCSet m_ReservedCRCSet;
|
||||
CEterPack m_pack;
|
||||
CEterFileDict m_fileDict;
|
||||
};
|
||||
|
@ -237,14 +237,13 @@ bool CRaceManager::__LoadRaceMotionList(CRaceData& rkRaceData, const char* pathN
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SKILL5", CRaceMotionData::NAME_SKILL+125));
|
||||
}
|
||||
|
||||
const void* pvData;
|
||||
CMappedFile kMappedFile;
|
||||
if (!CEterPackManager::Instance().Get(kMappedFile, motionListFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader kTextFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(motionListFileName, data))
|
||||
return false;
|
||||
|
||||
|
||||
CMemoryTextFileLoader kTextFileLoader;
|
||||
kTextFileLoader.Bind(kMappedFile.Size(), pvData);
|
||||
kTextFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
rkRaceData.RegisterMotionMode(CRaceMotionData::MODE_GENERAL);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "../eterBase/Timer.h"
|
||||
|
||||
bool CSoundData::ms_isSoundFile[SOUND_FILE_MAX_NUM];
|
||||
CMappedFile CSoundData::ms_SoundFile[SOUND_FILE_MAX_NUM];
|
||||
std::stringstream CSoundData::ms_SoundFile[SOUND_FILE_MAX_NUM];
|
||||
|
||||
const char * CSoundData::GetFileName()
|
||||
{
|
||||
@ -139,9 +139,7 @@ U32 AILCALLBACK CSoundData::open_callback(char const * filename, U32 *file_handl
|
||||
if (-1 == iIndex)
|
||||
return 0;
|
||||
|
||||
LPCVOID pMap;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(ms_SoundFile[iIndex], filename, &pMap))
|
||||
if (!CEterPackManager::Instance().Get(filename, ms_SoundFile[iIndex]))
|
||||
return 0;
|
||||
|
||||
ms_isSoundFile[iIndex] = true;
|
||||
@ -155,7 +153,7 @@ void AILCALLBACK CSoundData::close_callback(U32 file_handle)
|
||||
if (!isSlotIndex(file_handle))
|
||||
return;
|
||||
|
||||
ms_SoundFile[file_handle].Destroy();
|
||||
ms_SoundFile[file_handle].str("");
|
||||
ms_isSoundFile[file_handle] = false;
|
||||
}
|
||||
|
||||
@ -164,7 +162,8 @@ S32 AILCALLBACK CSoundData::seek_callback(U32 file_handle, S32 offset, U32 type)
|
||||
if (!isSlotIndex(file_handle))
|
||||
return 0;
|
||||
|
||||
return ms_SoundFile[file_handle].Seek(offset, type);
|
||||
ms_SoundFile[file_handle].seekg(offset, type);
|
||||
return ms_SoundFile[file_handle].tellg();
|
||||
}
|
||||
|
||||
U32 AILCALLBACK CSoundData::read_callback(U32 file_handle, void * buffer, U32 bytes)
|
||||
@ -172,9 +171,8 @@ U32 AILCALLBACK CSoundData::read_callback(U32 file_handle, void * buffer, U32 by
|
||||
if (!isSlotIndex(file_handle))
|
||||
return 0;
|
||||
|
||||
DWORD dwRealSize = min(ms_SoundFile[file_handle].Size(), bytes);
|
||||
ms_SoundFile[file_handle].Read(buffer, dwRealSize);
|
||||
return dwRealSize;
|
||||
ms_SoundFile[file_handle].read((char*) buffer, bytes);
|
||||
return ms_SoundFile[file_handle].gcount();
|
||||
}
|
||||
|
||||
void CSoundData::SetPackMode()
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef __MILESLIB_CSOUNDDATA_H__
|
||||
#define __MILESLIB_CSOUNDDATA_H__
|
||||
|
||||
#include <sstream>
|
||||
#include <miles/MSS.H>
|
||||
#include "../eterBase/MappedFile.h"
|
||||
|
||||
@ -53,7 +54,7 @@ class CSoundData
|
||||
static int GetEmptySlotIndex();
|
||||
|
||||
static bool ms_isSoundFile[SOUND_FILE_MAX_NUM];
|
||||
static CMappedFile ms_SoundFile[SOUND_FILE_MAX_NUM];
|
||||
static std::stringstream ms_SoundFile[SOUND_FILE_MAX_NUM];
|
||||
};
|
||||
|
||||
#endif
|
@ -397,7 +397,7 @@ void CSoundManager::PlayCharacterSound3D(float fx, float fy, float fz, const cha
|
||||
float fTime = itor->second;
|
||||
if (CTimer::Instance().GetCurrentSecond() - fTime < 0.3f)
|
||||
{
|
||||
//Tracef("\xB6\xC8\xB0\xB0\xC0\xBA \xBC\xD2\xB8\xAE\xB0\xA1 0.3\xC3\xCA \xB3\xBB\xBF\xA1 \xB4\xD9\xBD\xC3 \xC7\xC3\xB7\xB9\xC0\xCC %s\n", c_szFileName);
|
||||
//Tracef("Play the same sound again in 0.3 seconds\n", c_szFileName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ bool NSound::SaveSoundInformationPiece(const char * c_szFileName, NSound::TSound
|
||||
{
|
||||
char szErrorText[256+1];
|
||||
_snprintf(szErrorText, sizeof(szErrorText), "Failed to save file (%s).\nPlease check if it is read-only or you have no space on the disk.\n", c_szFileName);
|
||||
LogBox(szErrorText, "\xBF\xA1\xB7\xAF");
|
||||
LogBox(szErrorText, "Errors");
|
||||
SetResultString((strResult + " \xBE\xB2\xB1\xE2\xBF\xEB \xC6\xC4\xC0\xCF\xC0\xBB \xBF\xAD \xBC\xF6 \xBE\xF8\xC0\xBD").c_str());
|
||||
return false;
|
||||
}
|
||||
|
@ -76,18 +76,23 @@ bool CTerrainImpl::LoadHeightMap(const char*c_szFileName)
|
||||
{
|
||||
Tracef("LoadRawHeightMapFile %s ", c_szFileName);
|
||||
|
||||
CMappedFile kMappedFile;
|
||||
LPCVOID lpcvFileData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
{
|
||||
Tracen("Error");
|
||||
TraceError("CTerrainImpl::LoadHeightMap - %s OPEN ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(m_awRawHeightMap, lpcvFileData, sizeof(WORD)*HEIGHTMAP_RAW_XSIZE*HEIGHTMAP_RAW_YSIZE);
|
||||
data.read((char*) m_awRawHeightMap, sizeof(WORD)*HEIGHTMAP_RAW_XSIZE*HEIGHTMAP_RAW_YSIZE);
|
||||
if (!data)
|
||||
{
|
||||
// Could not read data
|
||||
TraceError("CTerrainImpl::LoadHeightMap - %s READ ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Data read successfully
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -96,18 +101,13 @@ bool CTerrainImpl::LoadAttrMap(const char *c_szFileName)
|
||||
DWORD dwStart = ELTimer_GetMSec();
|
||||
Tracef("LoadAttrMapFile %s ", c_szFileName);
|
||||
|
||||
CMappedFile kMappedFile;
|
||||
LPCVOID lpcvFileData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
{
|
||||
TraceError("CTerrainImpl::LoadAttrMap - %s OPEN ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwFileSize = kMappedFile.Size();
|
||||
BYTE * abFileData = (BYTE *) lpcvFileData;
|
||||
|
||||
// LoadAttrMap
|
||||
{
|
||||
#pragma pack(push)
|
||||
@ -120,15 +120,14 @@ bool CTerrainImpl::LoadAttrMap(const char *c_szFileName)
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
if (dwFileSize < sizeof(SAttrMapHeader))
|
||||
SAttrMapHeader kAttrMapHeader;
|
||||
data.read((char*) &kAttrMapHeader, sizeof(kAttrMapHeader));
|
||||
if (!data)
|
||||
{
|
||||
TraceError(" CTerrainImpl::LoadAttrMap - %s FILE SIZE ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
SAttrMapHeader kAttrMapHeader;
|
||||
memcpy(&kAttrMapHeader, abFileData, sizeof(kAttrMapHeader));
|
||||
|
||||
const WORD c_wAttrMapMagic = 2634;
|
||||
if (c_wAttrMapMagic != kAttrMapHeader.m_wMagic)
|
||||
{
|
||||
@ -148,40 +147,40 @@ bool CTerrainImpl::LoadAttrMap(const char *c_szFileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwFileRestSize=dwFileSize-sizeof(kAttrMapHeader);
|
||||
DWORD dwFileNeedSize=sizeof(m_abyAttrMap);
|
||||
if (dwFileRestSize != dwFileNeedSize)
|
||||
data.read((char*)m_abyAttrMap, sizeof(m_abyAttrMap));
|
||||
if (!data)
|
||||
{
|
||||
TraceError("CTerrainImpl::LoadAttrMap - %s FILE DATA SIZE(rest %d != need %d) ERROR", c_szFileName, dwFileRestSize, dwFileNeedSize);
|
||||
TraceError("CTerrainImpl::LoadAttrMap - %s FILE DATA SIZE ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE* abSrcAttrData= abFileData+sizeof(kAttrMapHeader);
|
||||
memcpy(m_abyAttrMap, abSrcAttrData, sizeof(m_abyAttrMap));
|
||||
}
|
||||
|
||||
Tracef("%d\n", ELTimer_GetMSec() - dwStart);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CTerrainImpl::RAW_LoadTileMap(const char * c_szFileName)
|
||||
bool CTerrainImpl::RAW_LoadTileMap(const char* c_szFileName)
|
||||
{
|
||||
Tracef("LoadSplatFile %s ", c_szFileName);
|
||||
|
||||
CMappedFile kMappedFile;
|
||||
LPCVOID lpcvFileData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
{
|
||||
Tracen("Error");
|
||||
TraceError("CTerrainImpl::RAW_LoadTileMap - %s OPEN ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(m_abyTileMap, lpcvFileData, sizeof(BYTE)*(TILEMAP_RAW_XSIZE)*(TILEMAP_RAW_YSIZE));
|
||||
data.read((char*)m_abyTileMap, sizeof(BYTE) * (TILEMAP_RAW_XSIZE) * (TILEMAP_RAW_YSIZE));
|
||||
if (!data)
|
||||
{
|
||||
// Could not read data
|
||||
TraceError("CTerrainImpl::RAW_LoadTileMap - %s READ ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Data read successfully
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool CTerrainImpl::LoadWaterMap(const char * c_szFileName)
|
||||
@ -206,18 +205,16 @@ bool CTerrainImpl::LoadWaterMap(const char * c_szFileName)
|
||||
|
||||
bool CTerrainImpl::LoadWaterMapFile(const char * c_szFileName)
|
||||
{
|
||||
CMappedFile kMappedFile;
|
||||
LPCVOID lpcvFileData;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(kMappedFile, c_szFileName, &lpcvFileData))
|
||||
std::stringstream data;
|
||||
size_t fileSize = 0;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
{
|
||||
Tracen("Error");
|
||||
TraceError("CTerrainImpl::LoadWaterMap - %s OPEN ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwFileSize = kMappedFile.Size();
|
||||
BYTE* abFileData = (BYTE*)lpcvFileData;
|
||||
fileSize = data.str().length();
|
||||
|
||||
{
|
||||
#pragma pack(push)
|
||||
@ -231,15 +228,14 @@ bool CTerrainImpl::LoadWaterMapFile(const char * c_szFileName)
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
if (dwFileSize < sizeof(SWaterMapHeader))
|
||||
SWaterMapHeader kWaterMapHeader;
|
||||
data.read((char*)&kWaterMapHeader, sizeof(kWaterMapHeader));
|
||||
if (!data)
|
||||
{
|
||||
TraceError("CTerrainImpl::LoadWaterMap - %s FILE SIZE ERROR", c_szFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
SWaterMapHeader kWaterMapHeader;
|
||||
memcpy(&kWaterMapHeader, abFileData, sizeof(kWaterMapHeader));
|
||||
|
||||
const WORD c_wWaterMapMagic = 5426;
|
||||
|
||||
if (c_wWaterMapMagic != kWaterMapHeader.m_wMagic)
|
||||
@ -262,22 +258,23 @@ bool CTerrainImpl::LoadWaterMapFile(const char * c_szFileName)
|
||||
|
||||
m_byNumWater = kWaterMapHeader.m_byLayerCount;
|
||||
|
||||
DWORD dwFileRestSize = dwFileSize - sizeof(kWaterMapHeader);
|
||||
DWORD dwFileRestSize = fileSize - sizeof(kWaterMapHeader);
|
||||
DWORD dwFileNeedSize = sizeof(m_abyWaterMap) + sizeof(long) * m_byNumWater;
|
||||
DWORD dwFileNeedSize2 = sizeof(m_abyWaterMap) + sizeof(WORD) * m_byNumWater;
|
||||
if (dwFileRestSize == dwFileNeedSize2)
|
||||
{
|
||||
WORD wWaterHeight[MAX_WATER_NUM + 1];
|
||||
|
||||
BYTE * abSrcWaterData = abFileData + sizeof(kWaterMapHeader);
|
||||
memcpy(m_abyWaterMap, abSrcWaterData, sizeof(m_abyWaterMap));
|
||||
|
||||
BYTE * abSrcWaterHeight = abSrcWaterData + sizeof(m_abyWaterMap);
|
||||
data.read((char*)m_abyWaterMap, sizeof(m_abyWaterMap));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
m_byNumWater = MIN(MAX_WATER_NUM, m_byNumWater);
|
||||
if (m_byNumWater)
|
||||
{
|
||||
memcpy(wWaterHeight, abSrcWaterHeight, sizeof(WORD) * m_byNumWater);
|
||||
data.read((char*)wWaterHeight, sizeof(WORD) * m_byNumWater);
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < m_byNumWater; ++i)
|
||||
m_lWaterHeight[i] = wWaterHeight[i];
|
||||
@ -289,13 +286,15 @@ bool CTerrainImpl::LoadWaterMapFile(const char * c_szFileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE * abSrcWaterData = abFileData + sizeof(kWaterMapHeader);
|
||||
memcpy(m_abyWaterMap, abSrcWaterData, sizeof(m_abyWaterMap));
|
||||
data.read((char*)m_abyWaterMap, sizeof(m_abyWaterMap));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
BYTE * abSrcWaterHeight = abSrcWaterData + sizeof(m_abyWaterMap);
|
||||
|
||||
if (m_byNumWater)
|
||||
memcpy(m_lWaterHeight, abSrcWaterHeight, sizeof(long) * m_byNumWater);
|
||||
if (m_byNumWater) {
|
||||
data.read((char*)m_lWaterHeight, sizeof(long)* m_byNumWater);
|
||||
if (!data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -194,7 +194,7 @@ bool CTextureSet::AddTexture(const char * c_szFileName,
|
||||
{
|
||||
if (GetTextureCount() >= 256)
|
||||
{
|
||||
LogBox("\xC5\xD8\xBD\xBA\xC3\xB3\xB8\xA6 \xB4\xF5 \xC0\xCC\xBB\xF3 \xC3\xDF\xB0\xA1\xC7\xD2 \xBC\xF6 \xBE\xF8\xBD\xC0\xB4\xCF\xB4\xD9.", "\xC3\xD6\xB4\xEB \xC5\xD8\xBD\xBA\xC3\xB3 \xB0\xB3\xBC\xF6 255\xB0\xB3");
|
||||
LogBox("You cannot add any more textures.","Maximum number of textures 255");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ bool CTextureSet::AddTexture(const char * c_szFileName,
|
||||
{
|
||||
if (0 == m_Textures[i].stFilename.compare(c_szFileName))
|
||||
{
|
||||
LogBox("\xB5\xBF\xC0\xCF\xC7\xD1 \xC0\xCC\xB8\xA7\xC0\xC7 \xC5\xD8\xBD\xBA\xC3\xB3\xB0\xA1 \xC0\xCC\xB9\xCC \xC0\xD6\xBD\xC0\xB4\xCF\xB4\xD9.", "\xC1\xDF\xBA\xB9");
|
||||
LogBox("There is already a texture with the same name.", "Duplicate");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ bool CTextureSet::AddTexture(const char * c_szFileName,
|
||||
|
||||
if (!pResource->IsType(CGraphicImage::Type()))
|
||||
{
|
||||
LogBox("CTerrainImpl::GenerateTexture : \xC0\xCC\xB9\xCC\xC1\xF6 \xC6\xC4\xC0\xCF\xC0\xCC \xBE\xC6\xB4\xD5\xB4\xCF\xB4\xD9. %s", pResource->GetFileName());
|
||||
LogBox("CTerrainImpl::GenerateTexture : Not an image file. %s", pResource->GetFileName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -196,21 +196,19 @@ bool CPythonLauncher::RunCompiledFile(const char* c_szFileName)
|
||||
}
|
||||
|
||||
|
||||
bool CPythonLauncher::RunMemoryTextFile(const char* c_szFileName, UINT uFileSize, const VOID* c_pvFileData)
|
||||
bool CPythonLauncher::RunMemoryTextFile(const char* c_szFileName, std::shared_ptr<std::vector<char>> fileData)
|
||||
{
|
||||
NANOBEGIN
|
||||
const CHAR* c_pcFileData=(const CHAR*)c_pvFileData;
|
||||
|
||||
std::string stConvFileData;
|
||||
stConvFileData.reserve(uFileSize);
|
||||
stConvFileData.reserve(fileData->size());
|
||||
stConvFileData+="exec(compile('''";
|
||||
|
||||
// ConvertPythonTextFormat
|
||||
{
|
||||
for (UINT i=0; i<uFileSize; ++i)
|
||||
for (UINT i=0; i<fileData->size(); ++i)
|
||||
{
|
||||
if (c_pcFileData[i]!=13)
|
||||
stConvFileData+=c_pcFileData[i];
|
||||
if ((*fileData)[i] != 13)
|
||||
stConvFileData+= (*fileData)[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,29 +225,14 @@ bool CPythonLauncher::RunMemoryTextFile(const char* c_szFileName, UINT uFileSize
|
||||
|
||||
bool CPythonLauncher::RunFile(const char* c_szFileName)
|
||||
{
|
||||
char* acBufData=NULL;
|
||||
DWORD dwBufSize=0;
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
{
|
||||
CMappedFile file;
|
||||
const VOID* pvData;
|
||||
CEterPackManager::Instance().Get(file, c_szFileName, &pvData);
|
||||
if (data->size() == 0)
|
||||
return false;
|
||||
|
||||
dwBufSize=file.Size();
|
||||
if (dwBufSize==0)
|
||||
return false;
|
||||
|
||||
acBufData=new char[dwBufSize];
|
||||
memcpy(acBufData, pvData, dwBufSize);
|
||||
}
|
||||
|
||||
bool ret=false;
|
||||
|
||||
ret=RunMemoryTextFile(c_szFileName, dwBufSize, acBufData);
|
||||
|
||||
delete [] acBufData;
|
||||
|
||||
return ret;
|
||||
return RunMemoryTextFile(c_szFileName, data);
|
||||
}
|
||||
|
||||
bool CPythonLauncher::RunLine(const char* c_szSrc)
|
||||
|
@ -15,7 +15,7 @@ class CPythonLauncher : public CSingleton<CPythonLauncher>
|
||||
void SetTraceFunc(int (*pFunc)(PyObject * obj, PyFrameObject * f, int what, PyObject *arg));
|
||||
bool RunLine(const char* c_szLine);
|
||||
bool RunFile(const char* c_szFileName);
|
||||
bool RunMemoryTextFile(const char* c_szFileName, UINT uFileSize, const VOID* c_pvFileData);
|
||||
bool RunMemoryTextFile(const char* c_szFileName, std::shared_ptr<std::vector<char>> fileData);
|
||||
bool RunCompiledFile(const char* c_szFileName);
|
||||
const char* GetError();
|
||||
|
||||
|
@ -75,16 +75,15 @@ BOOL CSpeedTreeForest::GetMainTree(DWORD dwCRC, CSpeedTreeWrapper ** ppMainTree,
|
||||
pTree = itor->second;
|
||||
else
|
||||
{
|
||||
CMappedFile file;
|
||||
LPCVOID c_pvData;
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
|
||||
// NOTE : 파일이 없을때는 return FALSE 아닌가요? - [levites]
|
||||
if (!CEterPackManager::Instance().Get(file, c_pszFileName, &c_pvData))
|
||||
if (!CEterPackManager::Instance().Get(c_pszFileName, data))
|
||||
return FALSE;
|
||||
|
||||
pTree = new CSpeedTreeWrapper;
|
||||
|
||||
if (!pTree->LoadTree(c_pszFileName, (const BYTE *) c_pvData, file.Size()))
|
||||
if (!pTree->LoadTree(c_pszFileName, (const BYTE *) data->data(), data->size()))
|
||||
{
|
||||
delete pTree;
|
||||
pTree = nullptr;
|
||||
@ -92,8 +91,6 @@ BOOL CSpeedTreeForest::GetMainTree(DWORD dwCRC, CSpeedTreeWrapper ** ppMainTree,
|
||||
}
|
||||
|
||||
m_pMainTreeMap.insert(std::map<DWORD, CSpeedTreeWrapper *>::value_type(dwCRC, pTree));
|
||||
|
||||
file.Destroy();
|
||||
}
|
||||
|
||||
*ppMainTree = pTree;
|
||||
|
@ -141,13 +141,6 @@ bool CAccountConnector::__HandshakeState_Process()
|
||||
if (!__AnalyzePacket(HEADER_GC_PING, sizeof(TPacketGCPing), &CAccountConnector::__AuthState_RecvPing))
|
||||
return false;
|
||||
|
||||
// TODO : 차후 서버와 동일하게 가변길이 data serialize & deserialize 작업해야 한다.
|
||||
if (!__AnalyzeVarSizePacket(HEADER_GC_HYBRIDCRYPT_KEYS, &CAccountConnector::__AuthState_RecvHybridCryptKeys))
|
||||
return false;
|
||||
|
||||
if (!__AnalyzeVarSizePacket(HEADER_GC_HYBRIDCRYPT_SDB, &CAccountConnector::__AuthState_RecvHybridCryptSDB))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -185,16 +178,6 @@ bool CAccountConnector::__AuthState_Process()
|
||||
if (!__AnalyzePacket(HEADER_GC_HANDSHAKE, sizeof(TPacketGCHandshake), &CAccountConnector::__AuthState_RecvHandshake))
|
||||
return false;
|
||||
|
||||
if (!__AnalyzePacket(HEADER_GC_PANAMA_PACK, sizeof(TPacketGCPanamaPack), &CAccountConnector::__AuthState_RecvPanamaPack))
|
||||
return false;
|
||||
|
||||
// TODO : 차후 서버와 동일하게 가변길이 data serialize & deserialize 작업해야 한다.
|
||||
if (!__AnalyzeVarSizePacket(HEADER_GC_HYBRIDCRYPT_KEYS, &CAccountConnector::__AuthState_RecvHybridCryptKeys))
|
||||
return false;
|
||||
|
||||
if (!__AnalyzeVarSizePacket(HEADER_GC_HYBRIDCRYPT_SDB, &CAccountConnector::__AuthState_RecvHybridCryptSDB))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -345,50 +328,6 @@ bool CAccountConnector::__AuthState_RecvHandshake()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAccountConnector::__AuthState_RecvPanamaPack()
|
||||
{
|
||||
TPacketGCPanamaPack kPacket;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCPanamaPack), &kPacket))
|
||||
return false;
|
||||
|
||||
CEterPackManager::instance().RegisterPack(kPacket.szPackName, "*", kPacket.abIV);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAccountConnector::__AuthState_RecvHybridCryptKeys(int iTotalSize)
|
||||
{
|
||||
int iFixedHeaderSize = TPacketGCHybridCryptKeys::GetFixedHeaderSize();
|
||||
|
||||
TPacketGCHybridCryptKeys kPacket(iTotalSize-iFixedHeaderSize);
|
||||
|
||||
if (!Recv(iFixedHeaderSize, &kPacket))
|
||||
return false;
|
||||
|
||||
if (!Recv(kPacket.iKeyStreamLen, kPacket.m_pStream))
|
||||
return false;
|
||||
|
||||
CEterPackManager::Instance().RetrieveHybridCryptPackKeys( kPacket.m_pStream );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAccountConnector::__AuthState_RecvHybridCryptSDB(int iTotalSize)
|
||||
{
|
||||
int iFixedHeaderSize = TPacketGCHybridSDB::GetFixedHeaderSize();
|
||||
|
||||
TPacketGCHybridSDB kPacket(iTotalSize-iFixedHeaderSize);
|
||||
|
||||
if (!Recv(iFixedHeaderSize, &kPacket))
|
||||
return false;
|
||||
|
||||
if (!Recv(kPacket.iSDBStreamLen, kPacket.m_pStream))
|
||||
return false;
|
||||
|
||||
CEterPackManager::Instance().RetrieveHybridCryptPackSDB( kPacket.m_pStream );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CAccountConnector::__AuthState_RecvPing()
|
||||
{
|
||||
TPacketGCPing kPacketPing;
|
||||
@ -423,9 +362,6 @@ bool CAccountConnector::__AuthState_RecvAuthSuccess()
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwPanamaKey = kAuthSuccessPacket.dwLoginKey ^ g_adwEncryptKey[0] ^ g_adwEncryptKey[1] ^ g_adwEncryptKey[2] ^ g_adwEncryptKey[3];
|
||||
CEterPackManager::instance().DecryptPackIV(dwPanamaKey);
|
||||
|
||||
CPythonNetworkStream & rkNet = CPythonNetworkStream::Instance();
|
||||
rkNet.SetLoginKey(kAuthSuccessPacket.dwLoginKey);
|
||||
rkNet.Connect(m_strAddr.c_str(), m_iPort);
|
||||
@ -451,9 +387,6 @@ bool CAccountConnector::__AuthState_RecvAuthSuccess_OpenID()
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwPanamaKey = kAuthSuccessOpenIDPacket.dwLoginKey ^ g_adwEncryptKey[0] ^ g_adwEncryptKey[1] ^ g_adwEncryptKey[2] ^ g_adwEncryptKey[3];
|
||||
CEterPackManager::instance().DecryptPackIV(dwPanamaKey);
|
||||
|
||||
CPythonNetworkStream & rkNet = CPythonNetworkStream::Instance();
|
||||
rkNet.SetLoginInfo(kAuthSuccessOpenIDPacket.login, "0000"); //OpenID 인증 과정에서 비밀번호는 사용되지 않는다.
|
||||
rkNet.SetLoginKey(kAuthSuccessOpenIDPacket.dwLoginKey);
|
||||
|
@ -59,9 +59,6 @@ class CAccountConnector : public CNetworkStream, public CSingleton<CAccountConne
|
||||
bool __AuthState_RecvChinaMatrixCard();
|
||||
bool __AuthState_RecvRunupMatrixQuiz();
|
||||
bool __AuthState_RecvNEWCIBNPasspodRequest();
|
||||
bool __AuthState_RecvPanamaPack();
|
||||
bool __AuthState_RecvHybridCryptKeys(int VarSize);
|
||||
bool __AuthState_RecvHybridCryptSDB(int VarSize);
|
||||
|
||||
bool __AnalyzePacket(UINT uHeader, UINT uPacketSize, bool (CAccountConnector::*pfnDispatchPacket)());
|
||||
// TODO: 지금 현재는 임시다. header뒤에 size 4byte가 무조건 온다는 가정임.
|
||||
|
@ -410,7 +410,7 @@ void CInstanceBase::__EnableSkipCollision()
|
||||
{
|
||||
if (__IsMainInstance())
|
||||
{
|
||||
TraceError("CInstanceBase::__EnableSkipCollision - \xC0\xDA\xBD\xC5\xC0\xBA \xC3\xE6\xB5\xB9\xB0\xCB\xBB\xE7\xBD\xBA\xC5\xB5\xC0\xCC \xB5\xC7\xB8\xE9 \xBE\xC8\xB5\xC8\xB4\xD9!!");
|
||||
TraceError("CInstanceBase::__EnableSkipCollision - You shouldn't be a conflict check skip yourself!!");
|
||||
return;
|
||||
}
|
||||
m_GraphicThingInstance.EnableSkipCollision();
|
||||
@ -1190,7 +1190,7 @@ void CInstanceBase::PushTCPState(DWORD dwCmdTime, const TPixelPosition& c_rkPPos
|
||||
if (__IsMainInstance())
|
||||
{
|
||||
//assert(!"CInstanceBase::PushTCPState \xC7\xC3\xB7\xB9\xC0\xCC\xBE\xEE \xC0\xDA\xBD\xC5\xBF\xA1\xB0\xD4 \xC0\xCC\xB5\xBF\xC6\xD0\xC5\xB6\xC0\xBA \xBF\xC0\xB8\xE9 \xBE\xC8\xB5\xC8\xB4\xD9!");
|
||||
TraceError("CInstanceBase::PushTCPState \xC7\xC3\xB7\xB9\xC0\xCC\xBE\xEE \xC0\xDA\xBD\xC5\xBF\xA1\xB0\xD4 \xC0\xCC\xB5\xBF\xC6\xD0\xC5\xB6\xC0\xBA \xBF\xC0\xB8\xE9 \xBE\xC8\xB5\xC8\xB4\xD9!");
|
||||
TraceError("CInstanceBase::PushTCPState Movement packets should not come from the player themselves!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1204,7 +1204,7 @@ void CInstanceBase::PushTCPState(DWORD dwCmdTime, const TPixelPosition& c_rkPPos
|
||||
m_dwBaseChkTime = ELTimer_GetFrameMSec()-nNetworkGap;
|
||||
m_dwBaseCmdTime = dwCmdTime;
|
||||
|
||||
Tracenf("VID[%d] \xB3\xD7\xC6\xAE\xBF\xF7\xB0\xB8 [%d]", GetVirtualID(), nNetworkGap);
|
||||
Tracenf("VID[%d] Network Gap [%d]", GetVirtualID(), nNetworkGap);
|
||||
}
|
||||
*/
|
||||
|
||||
@ -1222,7 +1222,7 @@ void CInstanceBase::PushTCPState(DWORD dwCmdTime, const TPixelPosition& c_rkPPos
|
||||
//int nApplyGap=kCmdNew.m_dwChkTime-ELTimer_GetServerFrameMSec();
|
||||
|
||||
//if (nApplyGap<-500 || nApplyGap>500)
|
||||
// Tracenf("VID[%d] NAME[%s] \xB3\xD7\xC6\xAE\xBF\xF7\xB0\xB8 [cur:%d ave:%d] \xC0\xDB\xB5\xBF\xBD\xC3\xB0\xA3 (%d)", GetVirtualID(), GetNameString(), nNetworkGap, m_nAverageNetworkGap, nApplyGap);
|
||||
// Tracenf("VID[%d] NAME[%s] Network Gap [cur:%d ave:%d] applyGap (%d)", GetVirtualID(), GetNameString(), nNetworkGap, m_nAverageNetworkGap, nApplyGap);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1313,11 +1313,11 @@ void CInstanceBase::StateProcess()
|
||||
TPixelPosition kPPosDir = kPPosDst - kPPosCur;
|
||||
float fDirLen = (float)sqrt(kPPosDir.x * kPPosDir.x + kPPosDir.y * kPPosDir.y);
|
||||
|
||||
//Tracenf("\xB0\xC5\xB8\xAE %f", fDirLen);
|
||||
//Tracenf("Distance %f", fDirLen);
|
||||
|
||||
if (!__CanProcessNetworkStatePacket())
|
||||
{
|
||||
Lognf(0, "vid=%d \xBF\xF2\xC1\xF7\xC0\xCF \xBC\xF6 \xBE\xF8\xB4\xC2 \xBB\xF3\xC5\xC2\xB6\xF3 \xBD\xBA\xC5\xB5 IsDead=%d, IsKnockDown=%d", uVID, m_GraphicThingInstance.IsDead(), m_GraphicThingInstance.IsKnockDown());
|
||||
Lognf(0, "vid=%d Skip because you can't move IsDead=%d, IsKnockDown=%d", uVID, m_GraphicThingInstance.IsDead(), m_GraphicThingInstance.IsKnockDown());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1330,7 +1330,7 @@ void CInstanceBase::StateProcess()
|
||||
{
|
||||
case FUNC_WAIT:
|
||||
{
|
||||
//Tracenf("%s (%f, %f) -> (%f, %f) \xB3\xB2\xC0\xBA\xB0\xC5\xB8\xAE %f", GetNameString(), kPPosCur.x, kPPosCur.y, kPPosDst.x, kPPosDst.y, fDirLen);
|
||||
//Tracenf("%s (%f, %f) -> (%f, %f) 남은거리 %f", GetNameString(), kPPosCur.x, kPPosCur.y, kPPosDst.x, kPPosDst.y, fDirLen);
|
||||
if (fDirLen > 1.0f)
|
||||
{
|
||||
//NEW_GetSrcPixelPositionRef() = kPPosCur;
|
||||
@ -1348,11 +1348,11 @@ void CInstanceBase::StateProcess()
|
||||
if (!IsWalking())
|
||||
StartWalking();
|
||||
|
||||
//Tracen("\xB8\xF1\xC7\xA5\xC1\xA4\xC1\xF6");
|
||||
//Tracen("Target Stop");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tracen("\xC7\xF6\xC0\xE7 \xC1\xA4\xC1\xF6");
|
||||
//Tracen("Freeze");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
@ -1381,12 +1381,12 @@ void CInstanceBase::StateProcess()
|
||||
|
||||
if (!IsWalking())
|
||||
{
|
||||
//Tracen("\xB0\xC8\xB0\xED \xC0\xD6\xC1\xF6 \xBE\xCA\xBE\xC6 \xB0\xC8\xB1\xE2 \xBD\xC3\xC0\xDB");
|
||||
//Tracen("I'm not walking, start walking");
|
||||
StartWalking();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tracen("\xC0\xCC\xB9\xCC \xB0\xC8\xB4\xC2\xC1\xDF ");
|
||||
//Tracen("Already walking");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1409,7 +1409,7 @@ void CInstanceBase::StateProcess()
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tracen("\xB4\xEB\xB1\xE2 \xB0\xF8\xB0\xDD \xC1\xA4\xC1\xF6");
|
||||
//Tracen("Stopping Standby Attacks");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
@ -1440,11 +1440,11 @@ void CInstanceBase::StateProcess()
|
||||
if (!IsWalking())
|
||||
StartWalking();
|
||||
|
||||
//Tracen("\xB3\xCA\xB9\xAB \xB8\xD6\xBE\xEE\xBC\xAD \xC0\xCC\xB5\xBF \xC8\xC4 \xB0\xF8\xB0\xDD");
|
||||
//Tracen("Attack after moving too far away");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tracen("\xB3\xEB\xB8\xBB \xB0\xF8\xB0\xDD \xC1\xA4\xC1\xF6");
|
||||
//Tracen("Stop normal attacks");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
@ -1456,7 +1456,7 @@ void CInstanceBase::StateProcess()
|
||||
|
||||
RunNormalAttack(fRotDst);
|
||||
|
||||
//Tracen("\xB0\xA1\xB1\xF5\xB1\xE2 \xB6\xA7\xB9\xAE\xBF\xA1 \xBF\xF6\xC7\xC1 \xB0\xF8\xB0\xDD");
|
||||
//Tracen("Warp Attack due to proximity");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1540,11 +1540,11 @@ void CInstanceBase::StateProcess()
|
||||
if (!IsWalking())
|
||||
StartWalking();
|
||||
|
||||
//Tracen("\xB3\xCA\xB9\xAB \xB8\xD6\xBE\xEE\xBC\xAD \xC0\xCC\xB5\xBF \xC8\xC4 \xB0\xF8\xB0\xDD");
|
||||
//Tracen("Attack after moving too far away");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tracen("\xBD\xBA\xC5\xB3 \xC1\xA4\xC1\xF6");
|
||||
//Tracen("Stop Skills");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
@ -1556,7 +1556,7 @@ void CInstanceBase::StateProcess()
|
||||
SetRotation(fRotDst);
|
||||
|
||||
NEW_UseSkill(0, eFunc & 0x7f, uArg&0x0f, (uArg>>4) ? true : false);
|
||||
//Tracen("\xB0\xA1\xB1\xF5\xB1\xE2 \xB6\xA7\xB9\xAE\xBF\xA1 \xBF\xF6\xC7\xC1 \xB0\xF8\xB0\xDD");
|
||||
//Tracen("Warp Attack due to proximity");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1604,7 +1604,7 @@ void CInstanceBase::MovementProcess()
|
||||
if (IsWalking())
|
||||
EndWalking();
|
||||
|
||||
//Tracen("\xB8\xF1\xC7\xA5 \xB5\xB5\xB4\xDE \xC1\xA4\xC1\xF6");
|
||||
//Tracen("Stop reaching goals");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
@ -1636,7 +1636,7 @@ void CInstanceBase::MovementProcess()
|
||||
|
||||
float fDstRot = NEW_GetAdvancingRotationFromPixelPosition(kPPosCur, NEW_GetDstPixelPositionRef());
|
||||
SetAdvancingRotation(fDstRot);
|
||||
//Tracenf("VID %d \xBF\xC0\xB9\xF6 \xB9\xE6\xC7\xE2\xBC\xB3\xC1\xA4 (%f, %f) %f rest %f", GetVirtualID(), kPPosCur.x, kPPosCur.y, fDstRot, fRestLen);
|
||||
//Tracenf("VID %d Over Orientation (%f, %f) %f rest %f", GetVirtualID(), kPPosCur.x, kPPosCur.y, fDstRot, fRestLen);
|
||||
|
||||
// 이동중이라면 다음번에 멈추게 한다
|
||||
if (FUNC_MOVE == m_kMovAfterFunc.eFunc)
|
||||
@ -1651,11 +1651,11 @@ void CInstanceBase::MovementProcess()
|
||||
{
|
||||
__DisableSkipCollision();
|
||||
|
||||
//Tracen("\xBB\xE7\xB8\xC1 \xBB\xF3\xC5\xC2\xB6\xF3 \xB5\xBF\xC0\xDB \xBD\xBA\xC5\xB5");
|
||||
//Tracen("Skip the action because you're dead");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
//Tracen("\xC7\xE0\xB5\xBF \xBA\xD2\xB4\xC9 \xBB\xF3\xC5\xC2\xB6\xF3 \xC0\xCC\xC8\xC4 \xB5\xBF\xC0\xDB \xBD\xBA\xC5\xB5");
|
||||
//Tracen("Skip subsequent actions because you're dead");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1737,7 +1737,7 @@ void CInstanceBase::MovementProcess()
|
||||
}
|
||||
else
|
||||
{
|
||||
//Tracenf("VID %d \xBD\xBA\xC5\xB3 \xB0\xF8\xB0\xDD (%f, %f) rot %f", GetVirtualID(), NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y, m_fDstRot);
|
||||
//Tracenf("VID %d Skill Attacks (%f, %f) rot %f", GetVirtualID(), NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y, m_fDstRot);
|
||||
|
||||
__DisableSkipCollision();
|
||||
m_isGoing = FALSE;
|
||||
@ -1751,7 +1751,7 @@ void CInstanceBase::MovementProcess()
|
||||
EndWalking();
|
||||
}
|
||||
|
||||
//Tracenf("VID %d \xC1\xA4\xC1\xF6 (%f, %f) rot %f IsWalking %d", GetVirtualID(), NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y, m_fDstRot, IsWalking());
|
||||
//Tracenf("VID %d Stop (%f, %f) rot %f IsWalking %d", GetVirtualID(), NEW_GetDstPixelPositionRef().x, NEW_GetDstPixelPositionRef().y, m_fDstRot, IsWalking());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ BOOL CInstanceBase::CheckAdvancing()
|
||||
|
||||
if (m_GraphicThingInstance.CanSkipCollision())
|
||||
{
|
||||
//Tracenf("%x VID %d \xC3\xE6\xB5\xB9 \xBD\xBA\xC5\xB5", ELTimer_GetMSec(), GetVirtualID());
|
||||
//Tracenf("%x VID %d Skip collisions", ELTimer_GetMSec(), GetVirtualID());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ void CInstanceBase::ProcessDamage()
|
||||
{
|
||||
if(index > 7)
|
||||
{
|
||||
TraceError("ProcessDamage\xB9\xAB\xC7\xD1\xB7\xE7\xC7\xC1 \xB0\xA1\xB4\xC9\xBC\xBA");
|
||||
TraceError("ProcessDamage possible infinite loop");
|
||||
break;
|
||||
}
|
||||
num = damage%10;
|
||||
|
@ -324,12 +324,6 @@ enum
|
||||
// END_OF_SUPPORT_BGM
|
||||
|
||||
HEADER_GC_AUTH_SUCCESS = 150,
|
||||
HEADER_GC_PANAMA_PACK = 151,
|
||||
|
||||
//HYBRID CRYPT
|
||||
HEADER_GC_HYBRIDCRYPT_KEYS = 152,
|
||||
HEADER_GC_HYBRIDCRYPT_SDB = 153, // SDB means Supplmentary Data Blocks
|
||||
//HYBRID CRYPT
|
||||
|
||||
HEADER_GC_AUTH_SUCCESS_OPENID = 154,
|
||||
|
||||
@ -2612,70 +2606,6 @@ typedef struct SPacketGCResetOnTime
|
||||
BYTE header;
|
||||
} TPacketGCResetOnTime;
|
||||
|
||||
typedef struct SPacketGCPanamaPack
|
||||
{
|
||||
BYTE bHeader;
|
||||
char szPackName[256];
|
||||
BYTE abIV[32];
|
||||
} TPacketGCPanamaPack;
|
||||
|
||||
typedef struct SPacketGCHybridCryptKeys
|
||||
{
|
||||
private:
|
||||
SPacketGCHybridCryptKeys() : m_pStream(NULL) {}
|
||||
|
||||
public:
|
||||
SPacketGCHybridCryptKeys(int iStreamSize) : iKeyStreamLen(iStreamSize)
|
||||
{
|
||||
m_pStream = new BYTE[iStreamSize];
|
||||
}
|
||||
~SPacketGCHybridCryptKeys()
|
||||
{
|
||||
if( m_pStream )
|
||||
{
|
||||
delete[] m_pStream;
|
||||
m_pStream = NULL;
|
||||
}
|
||||
}
|
||||
static int GetFixedHeaderSize()
|
||||
{
|
||||
return sizeof(BYTE)+sizeof(WORD)+sizeof(int);
|
||||
}
|
||||
|
||||
BYTE bHeader;
|
||||
WORD wDynamicPacketSize;
|
||||
int iKeyStreamLen;
|
||||
BYTE* m_pStream;
|
||||
|
||||
} TPacketGCHybridCryptKeys;
|
||||
|
||||
|
||||
typedef struct SPacketGCHybridSDB
|
||||
{
|
||||
private:
|
||||
SPacketGCHybridSDB() : m_pStream(NULL) {}
|
||||
|
||||
public:
|
||||
SPacketGCHybridSDB(int iStreamSize) : iSDBStreamLen(iStreamSize)
|
||||
{
|
||||
m_pStream = new BYTE[iStreamSize];
|
||||
}
|
||||
~SPacketGCHybridSDB()
|
||||
{
|
||||
delete[] m_pStream;
|
||||
m_pStream = NULL;
|
||||
}
|
||||
static int GetFixedHeaderSize()
|
||||
{
|
||||
return sizeof(BYTE)+sizeof(WORD)+sizeof(int);
|
||||
}
|
||||
|
||||
BYTE bHeader;
|
||||
WORD wDynamicPacketSize;
|
||||
int iSDBStreamLen;
|
||||
BYTE* m_pStream;
|
||||
|
||||
} TPacketGCHybridSDB;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Client To Client
|
||||
|
||||
|
@ -527,7 +527,7 @@ bool CPythonApplication::Process()
|
||||
if ( dt >= 500 )
|
||||
{
|
||||
s_uiNextFrameTime += nAdjustTime;
|
||||
printf("FrameSkip \xBA\xB8\xC1\xA4 %d\n",nAdjustTime);
|
||||
printf("FrameSkip Calibration %d\n",nAdjustTime);
|
||||
CTimer::Instance().Adjust(nAdjustTime);
|
||||
}
|
||||
|
||||
@ -549,7 +549,7 @@ bool CPythonApplication::Process()
|
||||
// if (dt >= 500 || m_dwCurUpdateTime > s_uiNextFrameTime)
|
||||
// {
|
||||
// s_uiNextFrameTime += dt / uiFrameTime * uiFrameTime;
|
||||
// printf("FrameSkip \xBA\xB8\xC1\xA4 %d\n", dt / uiFrameTime * uiFrameTime);
|
||||
// printf("FrameSkip Calibration %d\n", dt / uiFrameTime * uiFrameTime);
|
||||
// CTimer::Instance().Adjust((dt / uiFrameTime) * uiFrameTime);
|
||||
// s_bFrameSkip = true;
|
||||
// }
|
||||
@ -609,7 +609,7 @@ bool CPythonApplication::Process()
|
||||
//m_pyNetworkStream.AbsoluteExitGame();
|
||||
|
||||
/*
|
||||
TraceError("\xB9\xAB\xC7\xD1 \xC7\xC1\xB7\xB9\xC0\xD3 \xBD\xBA\xC5\xB5\xC0\xB8\xB7\xCE \xC1\xA2\xBC\xD3\xC0\xBB \xC1\xBE\xB7\xE1\xC7\xD5\xB4\xCF\xB4\xD9");
|
||||
TraceError("Terminate a connection with infinite frame skips");
|
||||
|
||||
{
|
||||
FILE* fp=fopen("errorlog.txt", "w");
|
||||
|
@ -1042,12 +1042,11 @@ class CTextLineLoader
|
||||
public:
|
||||
CTextLineLoader(const char * c_szFileName)
|
||||
{
|
||||
const VOID* pvData;
|
||||
CMappedFile kFile;
|
||||
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return;
|
||||
|
||||
m_kTextFileLoader.Bind(kFile.Size(), pvData);
|
||||
m_kTextFileLoader.Bind(data->size(), data->data());
|
||||
}
|
||||
|
||||
DWORD GetLineCount()
|
||||
|
@ -241,19 +241,7 @@ void CPythonBackground::Initialize()
|
||||
|
||||
void CPythonBackground::__CreateProperty()
|
||||
{
|
||||
if (CEterPackManager::SEARCH_FILE_FIRST == CEterPackManager::Instance().GetSearchMode() &&
|
||||
_access("property", 0) == 0)
|
||||
{
|
||||
m_PropertyManager.Initialize(NULL);
|
||||
|
||||
CPropertyLoader PropertyLoader;
|
||||
PropertyLoader.SetPropertyManager(&m_PropertyManager);
|
||||
PropertyLoader.Create("*.*", "Property");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_PropertyManager.Initialize("pack/property");
|
||||
}
|
||||
m_PropertyManager.Initialize();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -436,7 +436,7 @@ PyObject * chatGetLinkFromHyperlink(PyObject * poSelf, PyObject * poArgs)
|
||||
}
|
||||
|
||||
if (isAttr)
|
||||
//"item:\xB9\xF8\xC8\xA3:\xC7\xC3\xB7\xA1\xB1\xD7:\xBC\xD2\xC4\xCF0:\xBC\xD2\xC4\xCF1:\xBC\xD2\xC4\xCF2"
|
||||
//"item:번호:플래그:소켓0:소켓1:소켓2"
|
||||
snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "|cfff1e6c0|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
|
||||
|
@ -106,16 +106,11 @@ void CPythonEventManager::__InitEventSet(TEventSet& rEventSet)
|
||||
|
||||
int CPythonEventManager::RegisterEventSet(const char * c_szFileName)
|
||||
{
|
||||
CMappedFile File;
|
||||
LPCVOID pMap;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(File, c_szFileName, &pMap))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return -1;
|
||||
|
||||
std::string strEventString;
|
||||
strEventString.resize(File.Size()+1);
|
||||
|
||||
File.Read(&strEventString[0], File.Size());
|
||||
std::string strEventString = data.str();
|
||||
|
||||
TEventSet * pEventSet = m_EventSetPool.Alloc();
|
||||
if (!pEventSet)
|
||||
|
@ -176,8 +176,6 @@ class CMainPacketHeaderMap : public CNetworkPacketHeaderMap
|
||||
Set(HEADER_GC_HS_REQUEST, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketHSCheck), STATIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_XTRAP_CS1_REQUEST, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketXTrapCSVerify), STATIC_SIZE_PACKET));
|
||||
|
||||
Set(HEADER_GC_HYBRIDCRYPT_KEYS, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCHybridCryptKeys), DYNAMIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_HYBRIDCRYPT_SDB, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCHybridSDB), DYNAMIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_SPECIFIC_EFFECT, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCSpecificEffect), STATIC_SIZE_PACKET));
|
||||
Set(HEADER_GC_DRAGON_SOUL_REFINE, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketGCDragonSoulRefine), STATIC_SIZE_PACKET));
|
||||
|
||||
@ -655,7 +653,7 @@ bool CPythonNetworkStream::RecvDefaultPacket(int header)
|
||||
if (!header)
|
||||
return true;
|
||||
|
||||
TraceError("\xC3\xB3\xB8\xAE\xB5\xC7\xC1\xF6 \xBE\xCA\xC0\xBA \xC6\xD0\xC5\xB6 \xC7\xEC\xB4\xF5 %d, state %s\n", header, m_strPhase.c_str());
|
||||
TraceError("Unprocessed packet header %d, state %s\n", header, m_strPhase.c_str());
|
||||
ClearRecvBuffer();
|
||||
return true;
|
||||
}
|
||||
|
@ -264,9 +264,6 @@ class CPythonNetworkStream : public CNetworkStream, public CSingleton<CPythonNet
|
||||
bool RecvHandshakePacket();
|
||||
bool RecvHandshakeOKPacket();
|
||||
|
||||
bool RecvHybridCryptKeyPacket();
|
||||
bool RecvHybridCryptSDBPacket();
|
||||
|
||||
// ETC
|
||||
DWORD GetMainActorVID();
|
||||
DWORD GetMainActorRace();
|
||||
|
@ -121,7 +121,7 @@ bool SplitToken(const char * c_szLine, CTokenVector * pstTokenVector, const char
|
||||
|
||||
pstTokenVector->push_back(strLine.substr(beginPos, endPos - beginPos));
|
||||
|
||||
// \xC3\xDF\xB0\xA1 \xC4\xDA\xB5\xE5. \xB8\xC7\xB5\xDA\xBF\xA1 \xC5\xC7\xC0\xCC \xC0\xD6\xB4\xC2 \xB0\xE6\xBF\xEC\xB8\xA6 \xC3\xBC\xC5\xA9\xC7\xD1\xB4\xD9. - [levites]
|
||||
// 추가 코드. 맨뒤에 탭이 있는 경우를 체크한다. - [levites]
|
||||
if (int(strLine.find_first_not_of(c_szDelimeter, basePos)) < 0)
|
||||
break;
|
||||
} while (basePos < strLine.length());
|
||||
@ -131,7 +131,7 @@ bool SplitToken(const char * c_szLine, CTokenVector * pstTokenVector, const char
|
||||
|
||||
void CPythonNetworkStream::ServerCommand(char * c_szCommand)
|
||||
{
|
||||
// #0000811: [M2EU] \xC4\xDC\xBC\xD6\xC3\xA2 \xB1\xE2\xB4\xC9 \xC2\xF7\xB4\xDC
|
||||
// #0000811: [M2EU] 콘솔창 기능 차단
|
||||
if (strcmpi(c_szCommand, "ConsoleEnable") == 0)
|
||||
return;
|
||||
|
||||
@ -246,7 +246,7 @@ void CPythonNetworkStream::ServerCommand(char * c_szCommand)
|
||||
else if ("r_list" == TokenVector[1])
|
||||
{
|
||||
// result list (/cube r_list npcVNUM resultCount resultText)
|
||||
// 20383 4 72723,1/72725,1/72730.1/50001,5 <- \xC0\xCC\xB7\xB1\xBD\xC4\xC0\xB8\xB7\xCE "/" \xB9\xAE\xC0\xDA\xB7\xCE \xB1\xB8\xBA\xD0\xB5\xC8 \xB8\xAE\xBD\xBA\xC6\xAE\xB8\xA6 \xC1\xDC
|
||||
// 20383 4 72723,1/72725,1/72730.1/50001,5 <- 이런식으로 "/" 문자로 구분된 리스트를 줌
|
||||
if (5 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %d", c_szCommand, 5);
|
||||
@ -260,9 +260,10 @@ void CPythonNetworkStream::ServerCommand(char * c_szCommand)
|
||||
else if ("m_info" == TokenVector[1])
|
||||
{
|
||||
// material list (/cube m_info requestStartIndex resultCount MaterialText)
|
||||
// ex) requestStartIndex: 0, resultCount : 5 - \xC7\xD8\xB4\xE7 NPC\xB0\xA1 \xB8\xB8\xB5\xE9\xBC\xF6 \xC0\xD6\xB4\xC2 \xBE\xC6\xC0\xCC\xC5\xDB \xC1\xDF 0~4\xB9\xF8\xC2\xB0\xBF\xA1 \xC7\xD8\xB4\xE7\xC7\xCF\xB4\xC2 \xBE\xC6\xC0\xCC\xC5\xDB\xC0\xBB \xB8\xB8\xB5\xE5\xB4\xC2 \xB5\xA5 \xC7\xCA\xBF\xE4\xC7\xD1 \xB8\xF0\xB5\xE7 \xC0\xE7\xB7\xE1\xB5\xE9\xC0\xCC MaterialText\xBF\xA1 \xB5\xE9\xBE\xEE\xC0\xD6\xC0\xBD
|
||||
// \xC0\xA7 \xBF\xB9\xBD\xC3\xC3\xB3\xB7\xB3 \xBE\xC6\xC0\xCC\xC5\xDB\xC0\xCC \xB4\xD9\xBC\xF6\xC0\xCE \xB0\xE6\xBF\xEC \xB1\xB8\xBA\xD0\xC0\xDA "@" \xB9\xAE\xC0\xDA\xB8\xA6 \xBB\xE7\xBF\xEB
|
||||
// 0 5 125,1|126,2|127,2|123,5&555,5&555,4/120000 <- \xC0\xCC\xB7\xB1\xBD\xC4\xC0\xB8\xB7\xCE \xBC\xAD\xB9\xF6\xBF\xA1\xBC\xAD \xC5\xAC\xB6\xF3\xB7\xCE \xB8\xAE\xBD\xBA\xC6\xAE\xB8\xA6 \xC1\xDC
|
||||
// ex) requestStartIndex: 0, resultCount : 5 - 해당 NPC가 만들수 있는 아이템 중 0~4번째에 해당하는 아이템을 만드는 데 필요한 모든 재료들이 MaterialText에 들어있음
|
||||
// 위 예시처럼 아이템이 다수인 경우 구분자 "@" 문자를 사용
|
||||
// 0 5 125,1|126,2|127,2|123,5&555,5&555,4/120000 <- 이런식으로 서버에서 클라로 리스트를 줌
|
||||
|
||||
|
||||
if (5 != TokenVector.size())
|
||||
{
|
||||
|
@ -591,16 +591,6 @@ void CPythonNetworkStream::GamePhase()
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_KEYS:
|
||||
RecvHybridCryptKeyPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_SDB:
|
||||
RecvHybridCryptSDBPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HS_REQUEST:
|
||||
ret = RecvHSCheckRequest();
|
||||
break;
|
||||
@ -1278,7 +1268,7 @@ bool CPythonNetworkStream::RecvChatPacket()
|
||||
buf[uChatSize]='\0';
|
||||
|
||||
// 유럽 아랍 버전 처리
|
||||
// "\xC0\xCC\xB8\xA7: \xB3\xBB\xBF\xEB" 입력을 "\xB3\xBB\xBF\xEB: \xC0\xCC\xB8\xA7" 순서로 출력하기 위해 탭(0x08)을 넣음
|
||||
// "이름: 내용" 입력을 "내용: 이름" 순서로 출력하기 위해 탭(0x08)을 넣음
|
||||
// 탭을 아랍어 기호로 처리해 (영어1) : (영어2) 로 입력되어도 (영어2) : (영어1) 로 출력하게 만든다
|
||||
if (LocaleService_IsEUROPE() && GetDefaultCodePage() == 1256)
|
||||
{
|
||||
@ -1558,7 +1548,7 @@ bool CPythonNetworkStream::RecvDeadPacket()
|
||||
CInstanceBase* pkInstMain=rkChrMgr.GetMainInstancePtr();
|
||||
if (pkInstMain==pkChrInstSel)
|
||||
{
|
||||
Tracenf("\xC1\xD6\xC0\xCE\xB0\xF8 \xBB\xE7\xB8\xC1");
|
||||
Tracenf("Player Dead");
|
||||
if (false == pkInstMain->GetDuelMode())
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnGameOver", Py_BuildValue("()"));
|
||||
@ -2303,7 +2293,6 @@ bool CPythonNetworkStream::RecvSkillCoolTimeEnd()
|
||||
|
||||
bool CPythonNetworkStream::RecvSkillLevel()
|
||||
{
|
||||
assert(!"CPythonNetworkStream::RecvSkillLevel - \xBB\xE7\xBF\xEB\xC7\xCF\xC1\xF6 \xBE\xCA\xB4\xC2 \xC7\xD4\xBC\xF6");
|
||||
TPacketGCSkillLevel packet;
|
||||
if (!Recv(sizeof(TPacketGCSkillLevel), &packet))
|
||||
{
|
||||
@ -2529,7 +2518,7 @@ bool CPythonNetworkStream::RecvAddFlyTargetingPacket()
|
||||
|
||||
__GlobalPositionToLocalPosition(kPacket.lX, kPacket.lY);
|
||||
|
||||
Tracef("VID [%d]\xB0\xA1 \xC5\xB8\xB0\xD9\xC0\xBB \xC3\xDF\xB0\xA1 \xBC\xB3\xC1\xA4\n",kPacket.dwShooterVID);
|
||||
Tracef("VID [%d] Set up additional targets\n",kPacket.dwShooterVID);
|
||||
|
||||
CPythonCharacterManager & rpcm = CPythonCharacterManager::Instance();
|
||||
|
||||
@ -4251,7 +4240,7 @@ bool CPythonNetworkStream::RecvTargetCreatePacket()
|
||||
|
||||
//#ifdef _DEBUG
|
||||
// char szBuf[256+1];
|
||||
// _snprintf(szBuf, sizeof(szBuf), "\xC5\xB8\xB0\xD9\xC0\xCC \xBB\xFD\xBC\xBA \xB5\xC7\xBE\xFA\xBD\xC0\xB4\xCF\xB4\xD9 [%d:%s]", kTargetCreate.lID, kTargetCreate.szTargetName);
|
||||
// _snprintf(szBuf, sizeof(szBuf), "Target created [%d:%s]", kTargetCreate.lID, kTargetCreate.szTargetName);
|
||||
// CPythonChat::Instance().AppendChat(CHAT_TYPE_NOTICE, szBuf);
|
||||
// Tracef(" >> RecvTargetCreatePacket %d : %s\n", kTargetCreate.lID, kTargetCreate.szTargetName);
|
||||
//#endif
|
||||
@ -4280,7 +4269,7 @@ bool CPythonNetworkStream::RecvTargetCreatePacketNew()
|
||||
|
||||
//#ifdef _DEBUG
|
||||
// char szBuf[256+1];
|
||||
// _snprintf(szBuf, sizeof(szBuf), "\xC4\xB3\xB8\xAF\xC5\xCD \xC5\xB8\xB0\xD9\xC0\xCC \xBB\xFD\xBC\xBA \xB5\xC7\xBE\xFA\xBD\xC0\xB4\xCF\xB4\xD9 [%d:%s:%d]", kTargetCreate.lID, kTargetCreate.szTargetName, kTargetCreate.dwVID);
|
||||
// _snprintf(szBuf, sizeof(szBuf), "Character Target created [%d:%s:%d]", kTargetCreate.lID, kTargetCreate.szTargetName, kTargetCreate.dwVID);
|
||||
// CPythonChat::Instance().AppendChat(CHAT_TYPE_NOTICE, szBuf);
|
||||
// Tracef(" >> RecvTargetCreatePacketNew %d : %d/%d\n", kTargetCreate.lID, kTargetCreate.byType, kTargetCreate.dwVID);
|
||||
//#endif
|
||||
@ -4303,7 +4292,7 @@ bool CPythonNetworkStream::RecvTargetUpdatePacket()
|
||||
|
||||
//#ifdef _DEBUG
|
||||
// char szBuf[256+1];
|
||||
// _snprintf(szBuf, sizeof(szBuf), "\xC5\xB8\xB0\xD9\xC0\xC7 \xC0\xA7\xC4\xA1\xB0\xA1 \xB0\xBB\xBD\xC5 \xB5\xC7\xBE\xFA\xBD\xC0\xB4\xCF\xB4\xD9 [%d:%d/%d]", kTargetUpdate.lID, kTargetUpdate.lX, kTargetUpdate.lY);
|
||||
// _snprintf(szBuf, sizeof(szBuf), "The target's location has been updated [%d:%d/%d]", kTargetUpdate.lID, kTargetUpdate.lX, kTargetUpdate.lY);
|
||||
// CPythonChat::Instance().AppendChat(CHAT_TYPE_NOTICE, szBuf);
|
||||
// Tracef(" >> RecvTargetUpdatePacket %d : %d, %d\n", kTargetUpdate.lID, kTargetUpdate.lX, kTargetUpdate.lY);
|
||||
//#endif
|
||||
|
@ -173,7 +173,7 @@ bool CPythonNetworkStream::RecvCharacterAdditionalInfo()
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterAppendPacketNew()
|
||||
{
|
||||
TraceError("TPacketGCCharacterAdd2\xB4\xC2 \xBE\xB2\xC1\xF6 \xBE\xCA\xB4\xC2 \xC6\xD0\xC5\xB6\xC0\xD4\xB4\xCF\xB4\xD9.");
|
||||
TraceError("TPacketGCCharacterAdd2 is an unwritten packet.");
|
||||
TPacketGCCharacterAdd2 chrAddPacket;
|
||||
if (!Recv(sizeof(chrAddPacket), &chrAddPacket))
|
||||
return false;
|
||||
|
@ -861,7 +861,7 @@ bool CPythonNetworkStream::RecvSpecialEffect()
|
||||
|
||||
|
||||
default:
|
||||
TraceError("%d \xB4\xC2 \xBE\xF8\xB4\xC2 \xBD\xBA\xC6\xE4\xBC\xC8 \xC0\xCC\xC6\xE5\xC6\xAE \xB9\xF8\xC8\xA3\xC0\xD4\xB4\xCF\xB4\xD9.TPacketGCSpecialEffect",kSpecialEffect.type);
|
||||
TraceError("%d is a special effect number that does not exist. TPacketGCSpecialEffect",kSpecialEffect.type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -61,16 +61,6 @@ void CPythonNetworkStream::HandShakePhase()
|
||||
RecvPingPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_KEYS:
|
||||
RecvHybridCryptKeyPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_SDB:
|
||||
RecvHybridCryptSDBPacket();
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
RecvErrorPacket(header);
|
||||
@ -145,46 +135,6 @@ bool CPythonNetworkStream::RecvHandshakeOKPacket()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvHybridCryptKeyPacket()
|
||||
{
|
||||
int iFixedHeaderSize = TPacketGCHybridCryptKeys::GetFixedHeaderSize();
|
||||
|
||||
TDynamicSizePacketHeader header;
|
||||
if( !Peek( sizeof(header), &header) )
|
||||
return false;
|
||||
|
||||
TPacketGCHybridCryptKeys kPacket(header.size-iFixedHeaderSize);
|
||||
|
||||
if (!Recv(iFixedHeaderSize, &kPacket))
|
||||
return false;
|
||||
|
||||
if (!Recv(kPacket.iKeyStreamLen, kPacket.m_pStream))
|
||||
return false;
|
||||
|
||||
CEterPackManager::Instance().RetrieveHybridCryptPackKeys( kPacket.m_pStream );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvHybridCryptSDBPacket()
|
||||
{
|
||||
int iFixedHeaderSize = TPacketGCHybridSDB::GetFixedHeaderSize();
|
||||
|
||||
TDynamicSizePacketHeader header;
|
||||
if( !Peek( sizeof(header), &header) )
|
||||
return false;
|
||||
|
||||
TPacketGCHybridSDB kPacket(header.size-iFixedHeaderSize);
|
||||
|
||||
if (!Recv(iFixedHeaderSize, &kPacket))
|
||||
return false;
|
||||
|
||||
if (!Recv(kPacket.iSDBStreamLen, kPacket.m_pStream))
|
||||
return false;
|
||||
|
||||
CEterPackManager::Instance().RetrieveHybridCryptPackSDB( kPacket.m_pStream );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvHSCheckRequest()
|
||||
{
|
||||
TPacketHSCheck packet;
|
||||
|
@ -33,13 +33,12 @@ bool CPythonNetworkStream::IsInsultIn(const char* c_szMsg)
|
||||
|
||||
bool CPythonNetworkStream::LoadInsultList(const char* c_szInsultListFileName)
|
||||
{
|
||||
CMappedFile file;
|
||||
const VOID* pvData;
|
||||
if (!CEterPackManager::Instance().Get(file, c_szInsultListFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader kMemTextFileLoader;
|
||||
if (!CEterPackManager::Instance().Get(c_szInsultListFileName, data))
|
||||
return false;
|
||||
|
||||
CMemoryTextFileLoader kMemTextFileLoader;
|
||||
kMemTextFileLoader.Bind(file.Size(), pvData);
|
||||
kMemTextFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
m_kInsultChecker.Clear();
|
||||
for (DWORD dwLineIndex=0; dwLineIndex<kMemTextFileLoader.GetLineCount(); ++dwLineIndex)
|
||||
@ -55,9 +54,8 @@ bool CPythonNetworkStream::LoadConvertTable(DWORD dwEmpireID, const char* c_szFi
|
||||
if (dwEmpireID<1 || dwEmpireID>=4)
|
||||
return false;
|
||||
|
||||
CMappedFile file;
|
||||
const VOID* pvData;
|
||||
if (!CEterPackManager::Instance().Get(file, c_szFileName, &pvData))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
DWORD dwEngCount=26;
|
||||
@ -65,15 +63,16 @@ bool CPythonNetworkStream::LoadConvertTable(DWORD dwEmpireID, const char* c_szFi
|
||||
DWORD dwHanSize=dwHanCount*2;
|
||||
DWORD dwFileSize=dwEngCount*2+dwHanSize;
|
||||
|
||||
if (file.Size()<dwFileSize)
|
||||
if (data.str().length() < dwFileSize)
|
||||
return false;
|
||||
|
||||
char* pcData=(char*)pvData;
|
||||
|
||||
STextConvertTable& rkTextConvTable=m_aTextConvTable[dwEmpireID-1];
|
||||
memcpy(rkTextConvTable.acUpper, pcData, dwEngCount);pcData+=dwEngCount;
|
||||
memcpy(rkTextConvTable.acLower, pcData, dwEngCount);pcData+=dwEngCount;
|
||||
memcpy(rkTextConvTable.aacHan, pcData, dwHanSize);
|
||||
data.read((char*)rkTextConvTable.acUpper, dwEngCount);
|
||||
data.read((char*)rkTextConvTable.acLower, dwEngCount);
|
||||
data.read((char*)rkTextConvTable.aacHan, dwHanSize);
|
||||
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -146,17 +145,6 @@ void CPythonNetworkStream::LoadingPhase()
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_KEYS:
|
||||
RecvHybridCryptKeyPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_SDB:
|
||||
RecvHybridCryptSDBPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
GamePhase();
|
||||
return;
|
||||
|
@ -68,16 +68,6 @@ void CPythonNetworkStream::LoginPhase()
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_KEYS:
|
||||
RecvHybridCryptKeyPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_SDB:
|
||||
RecvHybridCryptSDBPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (RecvDefaultPacket(header))
|
||||
return;
|
||||
|
@ -99,16 +99,6 @@ void CPythonNetworkStream::SelectPhase()
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_KEYS:
|
||||
RecvHybridCryptKeyPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_HYBRIDCRYPT_SDB:
|
||||
RecvHybridCryptSDBPacket();
|
||||
return;
|
||||
break;
|
||||
|
||||
case HEADER_GC_PLAYER_POINT_CHANGE:
|
||||
TPacketGCPointChange PointChange;
|
||||
Recv(sizeof(TPacketGCPointChange), &PointChange);
|
||||
|
@ -14,17 +14,17 @@ bool CPythonNonPlayer::LoadNonPlayerData(const char * c_szFileName)
|
||||
6822045
|
||||
};
|
||||
|
||||
CMappedFile file;
|
||||
LPCVOID pvData;
|
||||
|
||||
Tracef("CPythonNonPlayer::LoadNonPlayerData: %s, sizeof(TMobTable)=%u\n", c_szFileName, sizeof(TMobTable));
|
||||
|
||||
if (!CEterPackManager::Instance().Get(file, c_szFileName, &pvData))
|
||||
std::stringstream data;
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
DWORD dwFourCC, dwElements, dwDataSize;
|
||||
|
||||
file.Read(&dwFourCC, sizeof(DWORD));
|
||||
data.read((char*)&dwFourCC, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
if (dwFourCC != MAKEFOURCC('M', 'M', 'P', 'T'))
|
||||
{
|
||||
@ -32,20 +32,26 @@ bool CPythonNonPlayer::LoadNonPlayerData(const char * c_szFileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
file.Read(&dwElements, sizeof(DWORD));
|
||||
file.Read(&dwDataSize, sizeof(DWORD));
|
||||
data.read((char*)&dwElements, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
data.read((char*)&dwDataSize, sizeof(DWORD));
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
auto pbData = std::make_shared<std::vector<BYTE>>(dwDataSize);
|
||||
|
||||
data.read((char*)pbData->data(), pbData->size());
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
BYTE * pbData = new BYTE[dwDataSize];
|
||||
file.Read(pbData, dwDataSize);
|
||||
/////
|
||||
|
||||
CLZObject zObj;
|
||||
|
||||
if (!CLZO::Instance().Decompress(zObj, pbData, s_adwMobProtoKey))
|
||||
{
|
||||
delete [] pbData;
|
||||
if (!CLZO::Instance().Decompress(zObj, pbData->data(), s_adwMobProtoKey))
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((zObj.GetSize() % sizeof(TMobTable)) != 0)
|
||||
{
|
||||
@ -64,7 +70,6 @@ bool CPythonNonPlayer::LoadNonPlayerData(const char * c_szFileName)
|
||||
m_NonPlayerDataMap.insert(TNonPlayerDataMap::value_type(pNonPlayerData->dwVnum, pNonPlayerData));
|
||||
}
|
||||
|
||||
delete [] pbData;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -63,11 +63,9 @@ PyObject * packGet(PyObject * poSelf, PyObject * poArgs)
|
||||
(stricmp(pcExt, ".pyc") == 0) ||
|
||||
(stricmp(pcExt, ".txt") == 0))
|
||||
{
|
||||
CMappedFile file;
|
||||
const void * pData = NULL;
|
||||
|
||||
if (CEterPackManager::Instance().Get(file,strFileName,&pData))
|
||||
return Py_BuildValue("s#",pData, file.Size());
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
if (CEterPackManager::Instance().Get(strFileName, data))
|
||||
return Py_BuildValue("s#", data->data(), data->size());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ void CPythonPlayerEventHandler::CNormalBowAttack_FlyEventHandler_AutoClear::OnEx
|
||||
{
|
||||
return;
|
||||
|
||||
Tracef("Shoot : \xB4\xD9\xB8\xA5 target\xBF\xA1 \xB8\xC2\xBE\xD2\xBD\xC0\xB4\xCF\xB4\xD9 : %d, %d\n", dwSkillIndex, dwVID);
|
||||
Tracef("Shoot : Hit a different target : %d, %d\n", dwSkillIndex, dwVID);
|
||||
|
||||
CPythonNetworkStream& rkStream=CPythonNetworkStream::Instance();
|
||||
rkStream.SendAttackPacket(dwSkillIndex, dwVID);
|
||||
@ -274,7 +274,7 @@ void CPythonPlayerEventHandler::CNormalBowAttack_FlyEventHandler_AutoClear::OnEx
|
||||
}
|
||||
void CPythonPlayerEventHandler::CNormalBowAttack_FlyEventHandler_AutoClear::OnExplodingAtTarget(DWORD dwSkillIndex)
|
||||
{
|
||||
// Tracef("Shoot : \xBF\xF8\xC7\xCF\xB4\xC2 target\xBF\xA1 \xB8\xC2\xBE\xD2\xBD\xC0\xB4\xCF\xB4\xD9 : %d, %d\n", dwSkillIndex, m_pInstTarget->GetVirtualID());
|
||||
// Tracef("Shoot : Hit the desired target : %d, %d\n", dwSkillIndex, m_pInstTarget->GetVirtualID());
|
||||
// CPythonNetworkStream& rkStream=CPythonNetworkStream::Instance();
|
||||
// rkStream.SendAttackPacket(dwSkillIndex, m_pInstTarget->GetVirtualID());
|
||||
}
|
||||
|
@ -1051,13 +1051,13 @@ PyObject * playerGetItemLink(PyObject * poSelf, PyObject * poArgs)
|
||||
|
||||
if( GetDefaultCodePage() == CP_ARABIC ) {
|
||||
if (isAttr)
|
||||
//"item:\xB9\xF8\xC8\xA3:\xC7\xC3\xB7\xA1\xB1\xD7:\xBC\xD2\xC4\xCF0:\xBC\xD2\xC4\xCF1:\xBC\xD2\xC4\xCF2"
|
||||
//item:item:number:flags:socket0:socket1:socket2"
|
||||
snprintf(buf, sizeof(buf), " |h|r[%s]|cffffc700|H%s|h", pItemData->GetName(), itemlink);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), " |h|r[%s]|cfff1e6c0|H%s|h", pItemData->GetName(), itemlink);
|
||||
} else {
|
||||
if (isAttr)
|
||||
//"item:\xB9\xF8\xC8\xA3:\xC7\xC3\xB7\xA1\xB1\xD7:\xBC\xD2\xC4\xCF0:\xBC\xD2\xC4\xCF1:\xBC\xD2\xC4\xCF2"
|
||||
//item:item:number:flags:socket0:socket1:socket2"
|
||||
snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "|cfff1e6c0|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
|
||||
|
@ -572,7 +572,7 @@ bool CPythonPlayer::__UseSkill(DWORD dwSlotIndex)
|
||||
if (pSkillData->CanUseForMe())
|
||||
{
|
||||
pkInstTarget = pkInstMain;
|
||||
Tracef(" [ALERT] \xB5\xBF\xB7\xE1\xBF\xA1\xB0\xD4 \xBB\xE7\xBF\xEB\xC7\xCF\xB4\xC2 \xB1\xE2\xBC\xFA\xC0\xD3\xBF\xA1\xB5\xB5 \xC0\xFB\xBF\xA1\xB0\xD4 \xC5\xB8\xB0\xD9\xC6\xC3 \xB5\xC7\xBE\xEE\xC0\xD6\xBE\xEE\xBC\xAD \xC0\xDA\xBD\xC5\xBF\xA1\xB0\xD4\xB7\xCE \xC0\xE7\xBC\xB3\xC1\xA4\n");
|
||||
Tracef(" [ALERT] Reset to yourself because the skill is targeted at an enemy even though you're using it on a teammate\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -636,7 +636,7 @@ bool CPythonPlayer::__UseSkill(DWORD dwSlotIndex)
|
||||
{
|
||||
pkInstTarget = pkInstMain;
|
||||
pkInstMain->SetFlyTargetInstance(*pkInstMain);
|
||||
Tracef(" [ALERT] \xC5\xB8\xB0\xD9\xC0\xCC \xBE\xF8\xBE\xEE\xBC\xAD \xC7\xC3\xB7\xB9\xC0\xCC\xBE\xEE\xBF\xA1\xB0\xD4 \xBB\xE7\xBF\xEB\xC7\xD5\xB4\xCF\xB4\xD9\n");
|
||||
Tracef(" [ALERT] Use on player because there are no targets\n");
|
||||
}
|
||||
else if (pSkillData->IsNeedCorpse())
|
||||
{
|
||||
@ -672,7 +672,7 @@ bool CPythonPlayer::__UseSkill(DWORD dwSlotIndex)
|
||||
}
|
||||
else
|
||||
{
|
||||
Tracenf("CPythonPlayer::__UseSkill(%d) - \xC8\xAD\xB8\xE9 \xB1\xE2\xC1\xD8 \xB9\xE6\xC7\xE2 \xBC\xB3\xC1\xA4\xC0\xBB \xC7\xD8\xBE\xDF\xC7\xD4", dwSlotIndex);
|
||||
Tracenf("CPythonPlayer::__UseSkill(%d) - Need to set the orientation relative to the screen", dwSlotIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,13 +89,13 @@ void string_replace_word(const char* base, int base_len, const char* src, int sr
|
||||
|
||||
bool CPythonSkill::RegisterSkillTable(const char * c_szFileName)
|
||||
{
|
||||
const VOID* pvData;
|
||||
CMappedFile kFile;
|
||||
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
textFileLoader.Bind(kFile.Size(), pvData);
|
||||
textFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
// OVERWRITE_SKILLPROTO_POLY
|
||||
std::string src_poly_rand;
|
||||
@ -279,13 +279,13 @@ void CPythonSkill::__RegisterNormalIconImage(TSkillData & rData, const char * c_
|
||||
extern const DWORD c_iSkillIndex_Riding;
|
||||
bool CPythonSkill::RegisterSkillDesc(const char * c_szFileName)
|
||||
{
|
||||
const VOID* pvData;
|
||||
CMappedFile kFile;
|
||||
if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
|
||||
CEterPackManager::TPackDataPtr data;
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
|
||||
if (!CEterPackManager::Instance().Get(c_szFileName, data))
|
||||
return false;
|
||||
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
textFileLoader.Bind(kFile.Size(), pvData);
|
||||
textFileLoader.Bind(data->size(), data->data());
|
||||
|
||||
CTokenVector TokenVector;
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
@ -496,7 +496,7 @@ bool CPythonSkill::RegisterSkillDesc(const char * c_szFileName)
|
||||
int numGrade = atoi(TokenVector[DESC_TOKEN_TYPE_MOTION_INDEX_GRADE_NUM].c_str());
|
||||
if (SKILL_EFFECT_COUNT < numGrade)
|
||||
{
|
||||
TraceError("%s[%s] \xB0\xA1 \xB5\xEE\xB1\xDE \xC1\xA6\xC7\xD1[%d]\xC0\xBB \xB3\xD1\xBE\xEE\xB0\xAC\xBD\xC0\xB4\xCF\xB4\xD9.",rSkillData.strName.c_str(), TokenVector[DESC_TOKEN_TYPE_MOTION_INDEX_GRADE_NUM].c_str(), SKILL_EFFECT_COUNT);
|
||||
TraceError("%s[%s] has exceeded its rating limit [%d].",rSkillData.strName.c_str(), TokenVector[DESC_TOKEN_TYPE_MOTION_INDEX_GRADE_NUM].c_str(), SKILL_EFFECT_COUNT);
|
||||
return false;
|
||||
}
|
||||
for (int iGrade = 0; iGrade < numGrade; iGrade++)
|
||||
|
@ -447,7 +447,7 @@ void CPythonTextTail::ShowCharacterTextTail(DWORD VirtualID)
|
||||
|
||||
if (m_CharacterTextTailList.end() != std::find(m_CharacterTextTailList.begin(), m_CharacterTextTailList.end(), pTextTail))
|
||||
{
|
||||
//Tracef("\xC0\xCC\xB9\xCC \xB8\xAE\xBD\xBA\xC6\xAE\xBF\xA1 \xC0\xD6\xC0\xBD : %d\n", VirtualID);
|
||||
//Tracef("Already in the list : %d\n", VirtualID);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ void CPythonTextTail::ShowItemTextTail(DWORD VirtualID)
|
||||
|
||||
if (m_ItemTextTailList.end() != std::find(m_ItemTextTailList.begin(), m_ItemTextTailList.end(), pTextTail))
|
||||
{
|
||||
//Tracef("\xC0\xCC\xB9\xCC \xB8\xAE\xBD\xBA\xC6\xAE\xBF\xA1 \xC0\xD6\xC0\xBD : %d\n", VirtualID);
|
||||
//Tracef("Already in the list : %d\n", VirtualID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,18 +203,31 @@ const char* ApplicationStringTable_GetStringz(DWORD dwID)
|
||||
|
||||
int Setup(LPSTR lpCmdLine); // Internal function forward
|
||||
|
||||
bool PackInitialize(const char * c_pszFolder)
|
||||
bool PackInitialize(const std::string& packFolder)
|
||||
{
|
||||
NANOBEGIN
|
||||
if (_access(c_pszFolder, 0) != 0)
|
||||
if (_access(packFolder.c_str(), 0) != 0)
|
||||
return true;
|
||||
|
||||
std::string stFolder(c_pszFolder);
|
||||
stFolder += "/";
|
||||
// Initialize variables
|
||||
bool bPackFirst = true;
|
||||
std::string stFolder = packFolder + "/";
|
||||
std::string stFileName;
|
||||
|
||||
std::string stFileName(stFolder);
|
||||
stFileName += "Index";
|
||||
#ifdef _DISTRIBUTE
|
||||
Tracef("Info: Pack search mode set to archive-first.\n");
|
||||
|
||||
// Set Index file name to production value
|
||||
stFileName = stFolder + "Index";
|
||||
#else
|
||||
bPackFirst = false;
|
||||
Tracef("Info: Pack search mode set to file-first.\n");
|
||||
|
||||
// Set Index file name to development value
|
||||
stFileName = stFolder + "Index.dev";
|
||||
#endif
|
||||
|
||||
// Set up file reader
|
||||
CMappedFile file;
|
||||
LPCVOID pvData;
|
||||
|
||||
@ -228,56 +241,43 @@ bool PackInitialize(const char * c_pszFolder)
|
||||
CMemoryTextFileLoader TextLoader;
|
||||
TextLoader.Bind(file.Size(), pvData);
|
||||
|
||||
bool bPackFirst = TRUE;
|
||||
|
||||
const std::string& strPackType = TextLoader.GetLineString(0);
|
||||
|
||||
if (strPackType.compare("FILE") && strPackType.compare("PACK"))
|
||||
{
|
||||
TraceError("Pack/Index has invalid syntax. First line must be 'PACK' or 'FILE'");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _DISTRIBUTE
|
||||
Tracef("\xBE\xCB\xB8\xB2: \xC6\xD1 \xB8\xF0\xB5\xE5\xC0\xD4\xB4\xCF\xB4\xD9.\n");
|
||||
|
||||
//if (0 == strPackType.compare("FILE"))
|
||||
//{
|
||||
// bPackFirst = FALSE;
|
||||
// Tracef("\xBE\xCB\xB8\xB2: \xC6\xC4\xC0\xCF \xB8\xF0\xB5\xE5\xC0\xD4\xB4\xCF\xB4\xD9.\n");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Tracef("\xBE\xCB\xB8\xB2: \xC6\xD1 \xB8\xF0\xB5\xE5\xC0\xD4\xB4\xCF\xB4\xD9.\n");
|
||||
//}
|
||||
#else
|
||||
bPackFirst = FALSE;
|
||||
Tracef("\xBE\xCB\xB8\xB2: \xC6\xC4\xC0\xCF \xB8\xF0\xB5\xE5\xC0\xD4\xB4\xCF\xB4\xD9.\n");
|
||||
#endif
|
||||
|
||||
// Set up archive manager
|
||||
CTextFileLoader::SetCacheMode();
|
||||
#if defined(USE_RELATIVE_PATH)
|
||||
CEterPackManager::Instance().SetRelativePathMode();
|
||||
#endif
|
||||
CEterPackManager::Instance().SetCacheMode();
|
||||
CEterPackManager::Instance().SetSearchMode(bPackFirst);
|
||||
|
||||
CSoundData::SetPackMode(); // Miles 파일 콜백을 셋팅
|
||||
|
||||
// Read lines and parse tokens
|
||||
std::string strPackName, strTexCachePackName;
|
||||
for (DWORD i = 1; i < TextLoader.GetLineCount() - 1; i += 2)
|
||||
CTokenVector tokens = CTokenVector();
|
||||
|
||||
for (DWORD i = 0; i < TextLoader.GetLineCount() - 1; i++)
|
||||
{
|
||||
const std::string & c_rstFolder = TextLoader.GetLineString(i);
|
||||
const std::string & c_rstName = TextLoader.GetLineString(i + 1);
|
||||
// Split line into tokens
|
||||
TextLoader.SplitLineByTab(i, &tokens);
|
||||
|
||||
// Check if the read number of tokens is valid
|
||||
if (tokens.size() != 2)
|
||||
{
|
||||
TraceError("Invalid number of tokens on line %d: expected %d, got %d!", i, 2, tokens.size());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assign tokens into variables
|
||||
const std::string& c_rstName = tokens[0];
|
||||
const std::string& c_rstContainer = tokens[1];
|
||||
|
||||
// Load pack
|
||||
strPackName = stFolder + c_rstName;
|
||||
strTexCachePackName = strPackName + "_texcache";
|
||||
CEterPackManager::Instance().RegisterPack(strPackName, c_rstContainer);
|
||||
|
||||
CEterPackManager::Instance().RegisterPack(strPackName.c_str(), c_rstFolder.c_str());
|
||||
CEterPackManager::Instance().RegisterPack(strTexCachePackName.c_str(), c_rstFolder.c_str());
|
||||
// Try to load texture cache pack if it exists
|
||||
strTexCachePackName = strPackName + "_texcache";
|
||||
if (CEterPackManager::Instance().PackExists(strTexCachePackName, c_rstContainer)) {
|
||||
CEterPackManager::Instance().RegisterPack(strTexCachePackName, c_rstContainer);
|
||||
}
|
||||
}
|
||||
|
||||
CEterPackManager::Instance().RegisterRootPack((stFolder + std::string("root")).c_str());
|
||||
NANOEND
|
||||
return true;
|
||||
}
|
||||
|
@ -126,8 +126,8 @@ IDI_METIN2 ICON "metin2.ico"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,3,1,0
|
||||
PRODUCTVERSION 0,3,1,0
|
||||
FILEVERSION 0,4,0,0
|
||||
PRODUCTVERSION 0,4,0,0
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -144,12 +144,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "The Old Metin2 Project"
|
||||
VALUE "FileDescription", "The Metin2 Client"
|
||||
VALUE "FileVersion", "0.3.1.0"
|
||||
VALUE "FileVersion", "0.4.0.0"
|
||||
VALUE "InternalName", "Metin2Client"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2024"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2022-2025"
|
||||
VALUE "OriginalFilename", "Metin2.exe"
|
||||
VALUE "ProductName", "Metin2Client"
|
||||
VALUE "ProductVersion", "0.3.1.0"
|
||||
VALUE "ProductVersion", "0.4.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -15,6 +15,13 @@
|
||||
"name": "directxsdk",
|
||||
"version>=": "jun10"
|
||||
},
|
||||
{
|
||||
"name": "libzip",
|
||||
"features": [
|
||||
"zstd"
|
||||
],
|
||||
"version>=": "1.10.1"
|
||||
},
|
||||
{
|
||||
"name": "lzo",
|
||||
"version>=": "2.10#7"
|
||||
|
Reference in New Issue
Block a user