diff --git a/apps/egs/priv/egs_drv.so b/apps/egs/priv/egs_drv.so deleted file mode 100755 index 383ae83..0000000 Binary files a/apps/egs/priv/egs_drv.so and /dev/null differ diff --git a/apps/egs/src/egs_files.erl b/apps/egs/src/egs_files.erl index d46413b..0130277 100644 --- a/apps/egs/src/egs_files.erl +++ b/apps/egs/src/egs_files.erl @@ -506,7 +506,7 @@ nbl_pack_files([], {AccH, AccD, AccP, _FilePos, _PtrIndex}) -> {BinD3, CompressedDataSize} = if BinDSize < 16#800 -> {BinD, 0}; true -> - BinD2 = egs_prs:compress(BinD), + BinD2 = prs:compress(BinD), BinD2Size = byte_size(BinD2), {BinD2, BinD2Size} end, diff --git a/apps/egs/src/egs_quests_db.erl b/apps/egs/src/egs_quests_db.erl index 90f6f04..1da71ba 100644 --- a/apps/egs/src/egs_quests_db.erl +++ b/apps/egs/src/egs_quests_db.erl @@ -106,7 +106,7 @@ handle_call({zone_nbl, QuestID, ZoneID}, _From, State=#state{quests=QuestsCache, {Set0, SetPtrs} = egs_files:load_set_rel(ZoneDir ++ io_lib:format("set_r~b.conf", [0]), AreaID, Maps, FilePos), ScriptBin = egs_files:load_script_bin(ZoneDir ++ "script.es"), ScriptBinSize = byte_size(ScriptBin), - ScriptBin2 = egs_prs:compress(ScriptBin), + ScriptBin2 = prs:compress(ScriptBin), ScriptBinSize2 = byte_size(ScriptBin2), ScriptBin3 = << ScriptBinSize:32/little, ScriptBinSize2:32/little, 0:32, 1:32/little, 0:96, ScriptBin2/binary >>, TextBin = egs_files:load_text_bin(ZoneDir ++ "text.bin.en_US.txt"), diff --git a/apps/egs/c_src/prs.c b/apps/prs/c_src/prs.c similarity index 100% rename from apps/egs/c_src/prs.c rename to apps/prs/c_src/prs.c diff --git a/apps/egs/c_src/egs_prs_drv.c b/apps/prs/c_src/prs_drv.c similarity index 96% rename from apps/egs/c_src/egs_prs_drv.c rename to apps/prs/c_src/prs_drv.c index f95b701..a4199b4 100644 --- a/apps/egs/c_src/egs_prs_drv.c +++ b/apps/prs/c_src/prs_drv.c @@ -71,4 +71,4 @@ static ErlNifFunc nif_funcs[] = { {"compress", 1, compress_nif} }; -ERL_NIF_INIT(egs_prs, nif_funcs, load, reload, upgrade, unload) +ERL_NIF_INIT(prs, nif_funcs, load, reload, upgrade, unload) diff --git a/apps/prs/src/prs.app.src b/apps/prs/src/prs.app.src new file mode 100644 index 0000000..7320265 --- /dev/null +++ b/apps/prs/src/prs.app.src @@ -0,0 +1,11 @@ +%%-*- mode: erlang -*- +{application, prs, [ + {description, "PRS compression library."}, + {vsn, "0.1.0"}, + {modules, []}, + {registered, []}, + {applications, [ + kernel, + stdlib + ]} +]}. diff --git a/apps/egs/src/egs_prs.erl b/apps/prs/src/prs.erl similarity index 91% rename from apps/egs/src/egs_prs.erl rename to apps/prs/src/prs.erl index c59c1c1..0c6fd98 100644 --- a/apps/egs/src/egs_prs.erl +++ b/apps/prs/src/prs.erl @@ -17,12 +17,13 @@ %% You should have received a copy of the GNU Affero General Public License %% along with EGS. If not, see . --module(egs_prs). +-module(prs). -export([init/0, compress/1]). -on_load(init/0). init() -> - erlang:load_nif("priv/egs_drv", 0). + PrivDir = code:priv_dir(prs), + erlang:load_nif(PrivDir ++ "/prs_drv", 0). compress(_SrcBin) -> erlang:nif_error(not_loaded). diff --git a/rebar.config b/rebar.config index c7a9389..5c2777a 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,7 @@ {sub_dirs, [ "apps/egs", - "apps/egs_patch" + "apps/egs_patch", + "apps/prs" ]}. {dialyzer_opts, [src, {warnings, [ behaviours,