validate_file(path);
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "graf");
- ANGBAND_DIR_XTRA_GRAF = string_make(path);
+ ANGBAND_DIR_XTRA_GRAF = path;
validate_dir(ANGBAND_DIR_XTRA_GRAF, true);
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "sound");
- ANGBAND_DIR_XTRA_SOUND = string_make(path);
+ ANGBAND_DIR_XTRA_SOUND = path;
validate_dir(ANGBAND_DIR_XTRA_SOUND, false);
path_build(path, sizeof(path), ANGBAND_DIR_XTRA, "music");
* @param dir .cfgファイルのディレクトリ
* @param files .cfgファイル名。複数指定可能で、最初に見つかったファイルから読み取る。
*/
-CfgReader::CfgReader(concptr dir, std::initializer_list<concptr> files)
+CfgReader::CfgReader(std::filesystem::path dir, std::initializer_list<concptr> files)
{
this->dir = dir;
this->cfg_path = find_any_file(dir, files);
#include "system/angband.h"
#include <cstddef>
+#include <filesystem>
#include <initializer_list>
#include <unordered_map>
#include <vector>
class CfgReader {
public:
- CfgReader(concptr dir, std::initializer_list<concptr> files);
+ CfgReader(std::filesystem::path dir, std::initializer_list<concptr> files);
CfgData *read_sections(std::initializer_list<cfg_section> sections);
- concptr get_cfg_path()
+ std::string get_cfg_path()
{
- return cfg_path.data();
+ return cfg_path;
}
protected:
- concptr dir;
+ std::filesystem::path dir;
std::string cfg_path;
};
CfgReader reader(ANGBAND_DIR_XTRA_MUSIC, { "music_debug.cfg", "music.cfg" });
char device_type[256];
- GetPrivateProfileStringA("Device", "type", "MPEGVideo", device_type, _countof(device_type), reader.get_cfg_path());
+ GetPrivateProfileStringA("Device", "type", "MPEGVideo", device_type, _countof(device_type), reader.get_cfg_path().data());
mci_device_type = to_wchar(device_type).wc_str();
// clang-format off
#include "main-win/main-win-file-utils.h"
#include "main-win/main-win-utils.h"
#include "main-win/wav-reader.h"
-#include "util/angband-files.h"
-
#include "main/sound-definitions-table.h"
-
+#include "util/angband-files.h"
#include <memory>
-#include <queue>
-
#include <mmsystem.h>
+#include <queue>
/*
* Directory name
*/
-concptr ANGBAND_DIR_XTRA_SOUND;
+std::filesystem::path ANGBAND_DIR_XTRA_SOUND;
/*
* "sound.cfg" data
* @retval 1 設定なし
* @retval -1 PlaySoundの戻り値が正常終了以外
*/
-errr play_sound(int val, int volume)
+int play_sound(int val, int volume)
{
auto filename = sound_cfg_data->get_rand(TERM_XTRA_SOUND, val);
if (!filename) {
#pragma once
#include "main-win/main-win-cfg-reader.h"
-#include "system/h-type.h"
#include <array>
+#include <filesystem>
-extern concptr ANGBAND_DIR_XTRA_SOUND;
+extern std::filesystem::path ANGBAND_DIR_XTRA_SOUND;
extern CfgData *sound_cfg_data;
void load_sound_prefs(void);
void finalize_sound(void);
-errr play_sound(int val, int volume);
+int play_sound(int val, int volume);
/*! 音量 100%,90%,…,10% それぞれに割り当てる実際の値(効果音の音声データの振幅を volume/SOUND_VOLUME_MAX 倍する) */
constexpr std::array<int, 10> SOUND_VOLUME_TABLE = { { 1000, 800, 600, 450, 350, 250, 170, 100, 50, 20 } };