Move the PRS compression library into a separate application

This commit is contained in:
Loïc Hoguin 2012-01-04 01:56:38 +01:00
parent 6579c26f98
commit 9adab0ea87
8 changed files with 19 additions and 6 deletions

Binary file not shown.

View File

@ -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,

View File

@ -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"),

View File

@ -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)

11
apps/prs/src/prs.app.src Normal file
View File

@ -0,0 +1,11 @@
%%-*- mode: erlang -*-
{application, prs, [
{description, "PRS compression library."},
{vsn, "0.1.0"},
{modules, []},
{registered, []},
{applications, [
kernel,
stdlib
]}
]}.

View File

@ -17,12 +17,13 @@
%% You should have received a copy of the GNU Affero General Public License
%% along with EGS. If not, see <http://www.gnu.org/licenses/>.
-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).

View File

@ -1,6 +1,7 @@
{sub_dirs, [
"apps/egs",
"apps/egs_patch"
"apps/egs_patch",
"apps/prs"
]}.
{dialyzer_opts, [src, {warnings, [
behaviours,