eliminat el log del codi

This commit is contained in:
2025-08-19 13:55:22 +02:00
parent 467d609c28
commit e6a14ca57d

View File

@@ -26,11 +26,9 @@ struct JA_Sound_t; // lines 12-12
// Helper para cargar archivos de audio desde pack o filesystem
namespace {
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);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "DEBUG: Resource data size: %u", static_cast<unsigned int>(resource_data.size()));
if (!resource_data.empty()) {
// Crear archivo temporal usando std::filesystem::temp_directory_path()
// Crear archivo temporal
std::string temp_dir;
#ifdef _WIN32
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.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;
}
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
}
}
@@ -326,11 +322,7 @@ auto Resource::loadSoundLazy(const std::string &name) -> JA_Sound_t * {
for (const auto &file : sound_list) {
if (getFileName(file) == name) {
std::string audio_path = createTempAudioFile(file);
JA_Sound_t* loaded_sound = 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;
return JA_LoadSound(audio_path.c_str());
}
}
#endif
@@ -344,11 +336,7 @@ auto Resource::loadMusicLazy(const std::string &name) -> JA_Music_t * {
for (const auto &file : music_list) {
if (getFileName(file) == name) {
std::string audio_path = createTempAudioFile(file);
JA_Music_t* loaded_music = 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;
return JA_LoadMusic(audio_path.c_str());
}
}
#endif
@@ -491,11 +479,7 @@ void Resource::loadSounds() {
updateLoadingProgress(name);
#ifndef NO_AUDIO
std::string audio_path = createTempAudioFile(l);
JA_Sound_t* loaded_sound = 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);
sounds_.emplace_back(name, JA_LoadSound(audio_path.c_str()));
#else
sounds_.emplace_back(name, nullptr);
#endif
@@ -514,11 +498,7 @@ void Resource::loadMusics() {
updateLoadingProgress(name);
#ifndef NO_AUDIO
std::string audio_path = createTempAudioFile(l);
JA_Music_t* loaded_music = 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);
musics_.emplace_back(name, JA_LoadMusic(audio_path.c_str()));
#else
musics_.emplace_back(name, nullptr);
#endif