eliminat el log del codi
This commit is contained in:
@@ -26,11 +26,9 @@ struct JA_Sound_t; // lines 12-12
|
|||||||
// Helper para cargar archivos de audio desde pack o filesystem
|
// Helper para cargar archivos de audio desde pack o filesystem
|
||||||
namespace {
|
namespace {
|
||||||
std::string createTempAudioFile(const std::string& file_path) {
|
std::string createTempAudioFile(const std::string& file_path) {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "DEBUG: Trying to load audio file: %s", file_path.c_str());
|
|
||||||
auto resource_data = ResourceHelper::loadFile(file_path);
|
auto resource_data = ResourceHelper::loadFile(file_path);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "DEBUG: Resource data size: %u", static_cast<unsigned int>(resource_data.size()));
|
|
||||||
if (!resource_data.empty()) {
|
if (!resource_data.empty()) {
|
||||||
// Crear archivo temporal usando std::filesystem::temp_directory_path()
|
// Crear archivo temporal
|
||||||
std::string temp_dir;
|
std::string temp_dir;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
temp_dir = std::getenv("TEMP") ? std::getenv("TEMP") : "C:\\temp";
|
temp_dir = std::getenv("TEMP") ? std::getenv("TEMP") : "C:\\temp";
|
||||||
@@ -45,10 +43,8 @@ namespace {
|
|||||||
}
|
}
|
||||||
temp_file.write(reinterpret_cast<const char*>(resource_data.data()), resource_data.size());
|
temp_file.write(reinterpret_cast<const char*>(resource_data.data()), resource_data.size());
|
||||||
temp_file.close();
|
temp_file.close();
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Created temp audio file: %s (%u bytes)", temp_path.c_str(), static_cast<unsigned int>(resource_data.size()));
|
|
||||||
return temp_path;
|
return temp_path;
|
||||||
}
|
}
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Using filesystem audio file: %s", file_path.c_str());
|
|
||||||
return file_path; // Usar ruta original si no está en pack
|
return file_path; // Usar ruta original si no está en pack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,11 +322,7 @@ auto Resource::loadSoundLazy(const std::string &name) -> JA_Sound_t * {
|
|||||||
for (const auto &file : sound_list) {
|
for (const auto &file : sound_list) {
|
||||||
if (getFileName(file) == name) {
|
if (getFileName(file) == name) {
|
||||||
std::string audio_path = createTempAudioFile(file);
|
std::string audio_path = createTempAudioFile(file);
|
||||||
JA_Sound_t* loaded_sound = JA_LoadSound(audio_path.c_str());
|
return JA_LoadSound(audio_path.c_str());
|
||||||
if (!loaded_sound) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: JA_LoadSound failed for %s (path: %s)", name.c_str(), audio_path.c_str());
|
|
||||||
}
|
|
||||||
return loaded_sound;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -344,11 +336,7 @@ auto Resource::loadMusicLazy(const std::string &name) -> JA_Music_t * {
|
|||||||
for (const auto &file : music_list) {
|
for (const auto &file : music_list) {
|
||||||
if (getFileName(file) == name) {
|
if (getFileName(file) == name) {
|
||||||
std::string audio_path = createTempAudioFile(file);
|
std::string audio_path = createTempAudioFile(file);
|
||||||
JA_Music_t* loaded_music = JA_LoadMusic(audio_path.c_str());
|
return JA_LoadMusic(audio_path.c_str());
|
||||||
if (!loaded_music) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: JA_LoadMusic failed for %s (path: %s)", name.c_str(), audio_path.c_str());
|
|
||||||
}
|
|
||||||
return loaded_music;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -491,11 +479,7 @@ void Resource::loadSounds() {
|
|||||||
updateLoadingProgress(name);
|
updateLoadingProgress(name);
|
||||||
#ifndef NO_AUDIO
|
#ifndef NO_AUDIO
|
||||||
std::string audio_path = createTempAudioFile(l);
|
std::string audio_path = createTempAudioFile(l);
|
||||||
JA_Sound_t* loaded_sound = JA_LoadSound(audio_path.c_str());
|
sounds_.emplace_back(name, JA_LoadSound(audio_path.c_str()));
|
||||||
if (!loaded_sound) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: JA_LoadSound failed for %s (path: %s)", name.c_str(), audio_path.c_str());
|
|
||||||
}
|
|
||||||
sounds_.emplace_back(name, loaded_sound);
|
|
||||||
#else
|
#else
|
||||||
sounds_.emplace_back(name, nullptr);
|
sounds_.emplace_back(name, nullptr);
|
||||||
#endif
|
#endif
|
||||||
@@ -514,11 +498,7 @@ void Resource::loadMusics() {
|
|||||||
updateLoadingProgress(name);
|
updateLoadingProgress(name);
|
||||||
#ifndef NO_AUDIO
|
#ifndef NO_AUDIO
|
||||||
std::string audio_path = createTempAudioFile(l);
|
std::string audio_path = createTempAudioFile(l);
|
||||||
JA_Music_t* loaded_music = JA_LoadMusic(audio_path.c_str());
|
musics_.emplace_back(name, JA_LoadMusic(audio_path.c_str()));
|
||||||
if (!loaded_music) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: JA_LoadMusic failed for %s (path: %s)", name.c_str(), audio_path.c_str());
|
|
||||||
}
|
|
||||||
musics_.emplace_back(name, loaded_music);
|
|
||||||
#else
|
#else
|
||||||
musics_.emplace_back(name, nullptr);
|
musics_.emplace_back(name, nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user