Skip to content

Commit

Permalink
Update log system
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Dec 15, 2024
1 parent 93f9e8f commit 52dba2e
Show file tree
Hide file tree
Showing 22 changed files with 178 additions and 144 deletions.
6 changes: 3 additions & 3 deletions platforms/audio-shared/sound_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ static void sdl_error(const char* str)
{
const char* sdl_str = SDL_GetError();
if (sdl_str && *sdl_str)
str = sdl_str;

Log("Sound Queue: %s", str);
Log("Sound Queue: %s - SDL Error: %s", str, sdl_str);
else
Log("Sound Queue: %s", str);
}

SoundQueue::SoundQueue()
Expand Down
5 changes: 2 additions & 3 deletions platforms/desktop-shared/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ int application_init(const char* rom_file, const char* symbol_file)
{
Log("\n%s", GEARBOY_TITLE_ASCII);
Log("%s %s Desktop App", GEARBOY_TITLE, GEARBOY_VERSION);
Log("By Ignacio Sánchez (drhelius)");

config_init();
config_read();
Expand Down Expand Up @@ -167,7 +166,7 @@ static int sdl_init(void)

if (application_gamepad_mappings > 0)
{
Log("Succesfuly loaded %d game controller mappings", application_gamepad_mappings);
Debug("Succesfuly loaded %d game controller mappings", application_gamepad_mappings);
}
else
{
Expand All @@ -185,7 +184,7 @@ static int sdl_init(void)
}
else
{
Log("Game controller %d correctly detected", i);
Debug("Game controller %d correctly detected", i);
}

break;
Expand Down
20 changes: 10 additions & 10 deletions platforms/desktop-shared/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void config_read(void)
config_input.gamepad_x_axis = read_int("Input", "GamepadX", SDL_CONTROLLER_AXIS_LEFTX);
config_input.gamepad_y_axis = read_int("Input", "GamepadY", SDL_CONTROLLER_AXIS_LEFTY);

Log("Settings loaded");
Debug("Settings loaded");
}

void config_write(void)
Expand Down Expand Up @@ -265,7 +265,7 @@ void config_write(void)

if (config_ini_file->write(config_ini_data, true))
{
Log("Settings saved");
Debug("Settings saved");
}
}

Expand Down Expand Up @@ -301,15 +301,15 @@ static int read_int(const char* group, const char* key, int default_value)
else
ret = std::stoi(value);

Log("Load setting: [%s][%s]=%d", group, key, ret);
Debug("Load setting: [%s][%s]=%d", group, key, ret);
return ret;
}

static void write_int(const char* group, const char* key, int integer)
{
std::string value = std::to_string(integer);
config_ini_data[group][key] = value;
Log("Save setting: [%s][%s]=%s", group, key, value.c_str());
Debug("Save setting: [%s][%s]=%s", group, key, value.c_str());
}

static float read_float(const char* group, const char* key, float default_value)
Expand All @@ -323,15 +323,15 @@ static float read_float(const char* group, const char* key, float default_value)
else
ret = strtof(value.c_str(), NULL);

Log("Load setting: [%s][%s]=%.2f", group, key, ret);
Debug("Load setting: [%s][%s]=%.2f", group, key, ret);
return ret;
}

static void write_float(const char* group, const char* key, float value)
{
std::string value_str = std::to_string(value);
config_ini_data[group][key] = value_str;
Log("Save setting: [%s][%s]=%s", group, key, value_str.c_str());
Debug("Save setting: [%s][%s]=%s", group, key, value_str.c_str());
}

static bool read_bool(const char* group, const char* key, bool default_value)
Expand All @@ -345,7 +345,7 @@ static bool read_bool(const char* group, const char* key, bool default_value)
else
std::istringstream(value) >> std::boolalpha >> ret;

Log("Load setting: [%s][%s]=%s", group, key, ret ? "true" : "false");
Debug("Load setting: [%s][%s]=%s", group, key, ret ? "true" : "false");
return ret;
}

Expand All @@ -356,18 +356,18 @@ static void write_bool(const char* group, const char* key, bool boolean)
std::string value;
value = converter.str();
config_ini_data[group][key] = value;
Log("Save setting: [%s][%s]=%s", group, key, value.c_str());
Debug("Save setting: [%s][%s]=%s", group, key, value.c_str());
}

static std::string read_string(const char* group, const char* key)
{
std::string ret = config_ini_data[group][key];
Log("Load setting: [%s][%s]=%s", group, key, ret.c_str());
Debug("Load setting: [%s][%s]=%s", group, key, ret.c_str());
return ret;
}

static void write_string(const char* group, const char* key, std::string value)
{
config_ini_data[group][key] = value;
Log("Save setting: [%s][%s]=%s", group, key, value.c_str());
Debug("Save setting: [%s][%s]=%s", group, key, value.c_str());
}
2 changes: 1 addition & 1 deletion platforms/desktop-shared/emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void emu_save_screenshot(const char* file_path)

stbi_write_png(file_path, GAMEBOY_WIDTH, GAMEBOY_HEIGHT, 3, emu_frame_buffer, GAMEBOY_WIDTH * 3);

Log("Screenshot saved!");
Debug("Screenshot saved!");
}

static void save_ram(void)
Expand Down
2 changes: 1 addition & 1 deletion platforms/desktop-shared/gui_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ static void debug_window_vram_palettes(void)

static void add_symbol(const char* line)
{
Log("Loading symbol %s", line);
Debug("Loading symbol %s", line);

DebugSymbol s;

Expand Down
8 changes: 4 additions & 4 deletions src/Cartridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bool Cartridge::LoadFromZipFile(const u8* buffer, int size)
return false;
}

Log("ZIP Content - Filename: \"%s\", Comment: \"%s\", Uncompressed size: %u, Compressed size: %u", file_stat.m_filename, file_stat.m_comment, (unsigned int) file_stat.m_uncomp_size, (unsigned int) file_stat.m_comp_size);
Debug("ZIP Content - Filename: \"%s\", Comment: \"%s\", Uncompressed size: %u, Compressed size: %u", file_stat.m_filename, file_stat.m_comment, (unsigned int) file_stat.m_uncomp_size, (unsigned int) file_stat.m_comp_size);

string fn((const char*) file_stat.m_filename);
transform(fn.begin(), fn.end(), fn.begin(), (int(*)(int)) tolower);
Expand Down Expand Up @@ -249,7 +249,7 @@ bool Cartridge::LoadFromFile(const char* path)

if (extension == "zip")
{
Log("Loading from ZIP...");
Debug("Loading from ZIP...");
m_bLoaded = LoadFromZipFile(reinterpret_cast<u8*> (memblock), size);
}
else
Expand All @@ -259,7 +259,7 @@ bool Cartridge::LoadFromFile(const char* path)

if (m_bLoaded)
{
Log("ROM loaded", path);
Debug("ROM loaded", path);
}
else
{
Expand Down Expand Up @@ -608,7 +608,7 @@ bool Cartridge::GatherMetadata()
if ((m_Type == Cartridge::CartridgeMBC1) && presumeMultiMBC1)
{
m_Type = Cartridge::CartridgeMBC1Multi;
Log("Presumed Multi 64");
Debug("Presumed Multi 64");
}

Log("Cartridge Size %d", m_iTotalSize);
Expand Down
1 change: 1 addition & 0 deletions src/Cartridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <list>
#include <ctime>
#include "definitions.h"
#include "log.h"

class Cartridge
{
Expand Down
3 changes: 2 additions & 1 deletion src/CommonMemoryRule.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define COMMONMEMORYRULE_H

#include "definitions.h"
#include "log.h"

class Memory;

Expand Down Expand Up @@ -116,7 +117,7 @@ inline void CommonMemoryRule::PerformWrite(u16 address, u8 value)
}
default:
{
Log("--> ** Writing to invalid area %X %X", address, value);
Debug("--> ** Writing to invalid area %X %X", address, value);
m_pMemory->Load(address, value);
}
}
Expand Down
Loading

0 comments on commit 52dba2e

Please sign in to comment.