diff --git a/addons/sys_sounds/CfgAcreSounds.hpp b/addons/sys_sounds/CfgAcreSounds.hpp index 9fd9581a7..8992ef81d 100644 --- a/addons/sys_sounds/CfgAcreSounds.hpp +++ b/addons/sys_sounds/CfgAcreSounds.hpp @@ -2,33 +2,33 @@ class CfgAcreSounds { class Acre_GenericClickOn { - sound = "\idi\acre\addons\sys_sounds\sounds\mic_click_new_on.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericClickOn.wav"; }; class Acre_GenericClickOff { - sound = "\idi\acre\addons\sys_sounds\sounds\mic_click_new_off.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericClickOff.wav"; }; class Acre_GenericBeep { - sound = "\idi\acre\addons\sys_sounds\sounds\beep.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericBeep.wav"; }; class Acre_GenericBeepLow { - sound = "\idi\acre\addons\sys_sounds\sounds\beep-low.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericBeepLow.wav"; }; class Acre_GenericSquawkOn { - sound = "\idi\acre\addons\sys_sounds\sounds\mic_click_other_on.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericSquawkOn.wav"; }; class Acre_GenericSquawkOff { - sound = "\idi\acre\addons\sys_sounds\sounds\mic_click_other_off.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericSquawkOff.wav"; }; class Acre_GenericClick { - sound = "\idi\acre\addons\sys_sounds\sounds\click.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_GenericClick.wav"; }; // sys_sem52sl and sem70 class Acre_SEMKnob { - sound = "\idi\acre\addons\sys_sounds\sounds\semknob.b64"; + file = "\idi\acre\addons\sys_sounds\sounds\Acre_SEMKnob.wav"; }; }; diff --git a/addons/sys_sounds/XEH_preStart.sqf b/addons/sys_sounds/XEH_preStart.sqf index 022888575..f373f9607 100644 --- a/addons/sys_sounds/XEH_preStart.sqf +++ b/addons/sys_sounds/XEH_preStart.sqf @@ -1,3 +1,17 @@ #include "script_component.hpp" #include "XEH_PREP.hpp" + +if (!hasInterface) exitWith {}; + +INFO("Loading CfgAcreSounds"); +{ + private _classname = configName _x; + private _file = getText (_x >> "file"); + if (_file != "") then { + private _ret = ["copy_to_temp",[_file,_classname]] call EFUNC(sys_core,callExt); + if (_ret != "") then { ERROR_2("Error loading sound [%1: %2]",_classname,_ret); }; + } else { + ERROR_1("No sound file in config [%1]",_classname); + } +} forEach ("true" configClasses (configFile >> "CfgAcreSounds")); diff --git a/addons/sys_sounds/fnc_handleLoadedSound.sqf b/addons/sys_sounds/fnc_handleLoadedSound.sqf index 681c7080e..a0f845ed3 100644 --- a/addons/sys_sounds/fnc_handleLoadedSound.sqf +++ b/addons/sys_sounds/fnc_handleLoadedSound.sqf @@ -16,6 +16,8 @@ * Public: No */ +if (true) exitWith { diag_log "removed?" }; + params ["_id","_okN"]; _okN = parseNumber _okN; diff --git a/addons/sys_sounds/fnc_loadSound.sqf b/addons/sys_sounds/fnc_loadSound.sqf index 65635dc0a..262dc45f8 100644 --- a/addons/sys_sounds/fnc_loadSound.sqf +++ b/addons/sys_sounds/fnc_loadSound.sqf @@ -17,6 +17,8 @@ * Public: No */ +if (true) exitWith { diag_log "removed?" }; + params ["_className",["_returnFunction",nil],["_force",false]]; // If teamspeak is connected. diff --git a/addons/sys_sounds/sounds/Acre_GenericBeep.wav b/addons/sys_sounds/sounds/Acre_GenericBeep.wav new file mode 100644 index 000000000..f3c411957 Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericBeep.wav differ diff --git a/addons/sys_sounds/sounds/Acre_GenericBeepLow.wav b/addons/sys_sounds/sounds/Acre_GenericBeepLow.wav new file mode 100644 index 000000000..b0e2ac391 Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericBeepLow.wav differ diff --git a/addons/sys_sounds/sounds/Acre_GenericClick.wav b/addons/sys_sounds/sounds/Acre_GenericClick.wav new file mode 100644 index 000000000..22b7f6a3f Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericClick.wav differ diff --git a/addons/sys_sounds/sounds/Acre_GenericClickOff.wav b/addons/sys_sounds/sounds/Acre_GenericClickOff.wav new file mode 100644 index 000000000..ecd6d6ea3 Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericClickOff.wav differ diff --git a/addons/sys_sounds/sounds/Acre_GenericClickOn.wav b/addons/sys_sounds/sounds/Acre_GenericClickOn.wav new file mode 100644 index 000000000..9b27f748d Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericClickOn.wav differ diff --git a/addons/sys_sounds/sounds/Acre_GenericSquawkOff.wav b/addons/sys_sounds/sounds/Acre_GenericSquawkOff.wav new file mode 100644 index 000000000..8ef837fc1 Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericSquawkOff.wav differ diff --git a/addons/sys_sounds/sounds/Acre_GenericSquawkOn.wav b/addons/sys_sounds/sounds/Acre_GenericSquawkOn.wav new file mode 100644 index 000000000..ff7bb9bab Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_GenericSquawkOn.wav differ diff --git a/addons/sys_sounds/sounds/Acre_SEMKnob.wav b/addons/sys_sounds/sounds/Acre_SEMKnob.wav new file mode 100644 index 000000000..93b76dbf1 Binary files /dev/null and b/addons/sys_sounds/sounds/Acre_SEMKnob.wav differ diff --git a/extensions/src/ACRE2Arma/common/pbo/fileloader.hpp b/extensions/src/ACRE2Arma/common/pbo/fileloader.hpp index 1e013f0b5..e4ad9ce29 100644 --- a/extensions/src/ACRE2Arma/common/pbo/fileloader.hpp +++ b/extensions/src/ACRE2Arma/common/pbo/fileloader.hpp @@ -1,22 +1,24 @@ #pragma once +#include "controller.hpp" #include "archive.hpp" #include "search.hpp" #include "singleton.hpp" #include "membuf.hpp" - +#include +#pragma comment(lib, "shlwapi.lib") namespace acre { namespace pbo { class file_entry { public: - file_entry() {}; - file_entry(file_p entry_) : _file(entry_) { + file_entry() = delete; + file_entry(file_p entry_) : _file(entry_) { _memory_buffer = acre::membuf((char *)_file->data.get(), entry_->entry->storage_size); _stream = new std::istream(&_memory_buffer); - + }; ~file_entry() { delete _stream; }; std::istream & stream() { return *_stream; }; @@ -39,10 +41,51 @@ namespace acre { //@TODO: yea this is not the best way to do this... //Initialize the fileloader before threads start eating it. - void poke() { + void poke(acre::controller * ctrl) { + ctrl->add("copy_to_temp", std::bind(&acre::pbo::fileloader::copy_to_temp, this, std::placeholders::_1, std::placeholders::_2)); return; } + // write wav files from pbo to temp folder + bool acre::pbo::fileloader::copy_to_temp(const arguments& _args, std::string& result) { + if (_args.size() < 2) { + result = "Bad Arg count"; + return false; + } + std::string source_arma_path = _args.as_string(0); + std::string output_filename = _args.as_string(1); + LOG(INFO) << "copy_to_temp [" << source_arma_path << ", " << output_filename << "]"; + + file_entry_p fep; + if (!get_file(source_arma_path, "wav", fep)) { + result = "File not found"; + return false; + } + std::istream& arma_filesys_is(fep->stream()); + + char tempPath[MAX_PATH - 14]; + GetTempPathA(sizeof(tempPath), tempPath); + std::string tempFolder = std::string(tempPath); + tempFolder += "acre"; + if (!PathFileExistsA(tempFolder.c_str())) { + if (!CreateDirectoryA(tempFolder.c_str(), NULL)) { + result = "Could not create temp folder"; + return false; + } + } + std::ofstream temp_ofs(tempFolder + "\\" + output_filename, std::ios::out | std::ios::binary | std::ios::trunc); + if (!temp_ofs.is_open()) { + result = "Could not open temp file"; + return false; + } + + temp_ofs << arma_filesys_is.rdbuf(); + temp_ofs.close(); + + result = ""; + return true; + } + bool get_file(std::string path_, std::string _extension, file_entry_p &entry_) { std::string working_path = path_; // remove leading slash @@ -106,4 +149,4 @@ namespace acre { }; }; } -} \ No newline at end of file +} diff --git a/extensions/src/ACRE2Arma/controller/controller.cpp b/extensions/src/ACRE2Arma/controller/controller.cpp index a989da0d3..0c00dc13e 100644 --- a/extensions/src/ACRE2Arma/controller/controller.cpp +++ b/extensions/src/ACRE2Arma/controller/controller.cpp @@ -24,7 +24,7 @@ namespace acre { bool controller::init(const arguments &_args, std::string & result) { if (!_initiated) { _initiated = true; - acre::pbo::fileloader::get().poke(); + acre::pbo::fileloader::get().poke(this); add_module(std::make_shared()); } return true;