Verified Commit 481d8312 authored by RobLoach's avatar RobLoach
Browse files

Remove log()

parent da838253
......@@ -31,8 +31,9 @@ SOURCES_C += $(wildcard \
ifeq ($(platform), win)
SDL_SOURCES_C += $(wildcard ./vendor/sdl-libretro/src/*.c ./vendor/sdl-libretro/src/audio/*.c ./vendor/sdl-libretro/src/cdrom/win32/*.c ./vendor/sdl-libretro/src/cdrom/*.c ./vendor/sdl-libretro/src/cpuinfo/*.c ./vendor/sdl-libretro/src/events/*.c ./vendor/sdl-libretro/src/file/*.c ./vendor/sdl-libretro/src/stdlib/*.c ./vendor/sdl-libretro/src/thread/*.c ./vendor/sdl-libretro/src/timer/*.c ./vendor/sdl-libretro/src/video/*.c ./vendor/sdl-libretro/src/joystick/*.c ./vendor/sdl-libretro/src/video/libretro/*.c ./vendor/sdl-libretro/src/joystick/libretro/*.c ./vendor/sdl-libretro/src/timer/libretro/*.c ./vendor/sdl-libretro/src/audio/libretro/*.c ./vendor/sdl-libretro/src/thread/win32/SDL_sysmutex.c ./vendor/sdl-libretro/src/thread/win32/SDL_syssem.c ./vendor/sdl-libretro/src/thread/win32/SDL_systhread.c ./vendor/sdl-libretro/src/thread/generic/SDL_syscond.c ./vendor/sdl-libretro/src/loadso/dummy/*.c)
else
SDL_SOURCES_C += $(wildcard ./vendor/sdl-libretro/src/*.c ./vendor/sdl-libretro/src/audio/*.c ./vendor/sdl-libretro/src/cdrom/linux/*.c ./vendor/sdl-libretro/src/cdrom/*.c ./vendor/sdl-libretro/src/cpuinfo/*.c ./vendor/sdl-libretro/src/events/*.c ./vendor/sdl-libretro/src/file/*.c ./vendor/sdl-libretro/src/stdlib/*.c ./vendor/sdl-libretro/src/thread/*.c ./vendor/sdl-libretro/src/timer/*.c ./vendor/sdl-libretro/src/video/*.c ./vendor/sdl-libretro/src/joystick/*.c ./vendor/sdl-libretro/src/video/libretro/*.c ./vendor/sdl-libretro/src/thread/pthread/*.c ./vendor/sdl-libretro/src/joystick/libretro/*.c ./vendor/sdl-libretro/src/timer/libretro/*.c ./vendor/sdl-libretro/src/audio/libretro/*.c ./vendor/sdl-libretro/src/loadso/dummy/*.c)
SDL_SOURCES_C += $(wildcard ./vendor/sdl-libretro/src/*.c ./vendor/sdl-libretro/src/audio/*.c ./vendor/sdl-libretro/src/cdrom/linux/*.c ./vendor/sdl-libretro/src/cdrom/*.c ./vendor/sdl-libretro/src/cpuinfo/*.c ./vendor/sdl-libretro/src/events/*.c ./vendor/sdl-libretro/src/file/*.c ./vendor/sdl-libretro/src/stdlib/*.c ./vendor/sdl-libretro/src/thread/*.c ./vendor/sdl-libretro/src/timer/*.c ./vendor/sdl-libretro/src/video/*.c ./vendor/sdl-libretro/src/joystick/*.c ./vendor/sdl-libretro/src/video/libretro/*.c ./vendor/sdl-libretro/src/thread/generic/*.c ./vendor/sdl-libretro/src/joystick/libretro/*.c ./vendor/sdl-libretro/src/timer/libretro/*.c ./vendor/sdl-libretro/src/audio/libretro/*.c ./vendor/sdl-libretro/src/loadso/dummy/*.c)
endif
FLAGS += -DSDL_THREADS_DISABLED
OBJECTS += $(SDL_SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
......@@ -45,15 +46,12 @@ else
FLAGS += -O0 -g
endif
LDFLAGS += $(fpic) $(SHARED) \
-lpthread \
$(EXTRA_LDF)
LDFLAGS += $(fpic) $(SHARED) $(EXTRA_LDF)
FLAGS += -I. \
-Ivendor/sdl-libretro/include \
-Ivendor/libretro-common/include \
-Ivendor/chaiscript/include \
-Ivendor/SDL_tty/include \
-Ivendor/spdlog/include \
-Ivendor/sdl-libretro/tests/SDL_gfx-2.0.26 \
-Ivendor/sdl-libretro/tests/SDL_ttf-2.0.11/VisualC/external/include \
-Ivendor/ChaiScript_Extras/include \
......
#include <string>
#include <iostream>
#include "SDL.h"
#include "libretro.h"
#include "ChaiGame.h"
#include "chaigame/log.h"
ChaiGame* ChaiGame::m_instance = NULL;
retro_input_state_t ChaiGame::input_state_cb = NULL;
......@@ -28,7 +28,7 @@ void ChaiGame::quit(void) {
sound.unload();
filesystem.unload();
window.unload();
chaigame::log()->info("Finish");
std::cout << "Finish" << std::endl;
}
bool ChaiGame::load(const std::string& file) {
......@@ -37,7 +37,7 @@ bool ChaiGame::load(const std::string& file) {
#define GIT_VERSION ""
#endif
std::string version = CHAIGAME_VERSION_STRING GIT_VERSION;
chaigame::log()->info("ChaiGame {0}", version);
std::cout << "ChaiGame " << version.c_str() << std::endl;
// Initalize all the subsystems.
filesystem.init(file);
......@@ -115,7 +115,7 @@ bool ChaiGame::update() {
*/
void ChaiGame::reset() {
// Tell the script that we are to reset the game.
chaigame::log()->info("[game] Reset");
std::cout << "[game] Reset" << std::endl;
script->reset();
}
......@@ -136,7 +136,7 @@ void ChaiGame::draw() {
// Flip the buffer.
if (SDL_Flip(screen) == -1) {
chaigame::log()->error("Failed to swap the buffers: {}", SDL_GetError());
std::cout << "[game] Failed to swap the buffers: " << SDL_GetError() << std::endl;
}
}
}
......
......@@ -2,11 +2,11 @@
//#include "SDL.h"
//#include "SDL_mixer.h"
#include <string>
#include "../log.h"
#include "../../ChaiGame.h"
#include "AudioState.h"
#include "physfs.h"
#include "../log.h"
namespace chaigame {
SoundData::SoundData(const std::string& filename) {
......@@ -18,7 +18,7 @@ namespace chaigame {
int result = PHYSFS_readBytes(file, &sndta.head, sizeof(uint8_t) * WAV_HEADER_SIZE);
if (result < 0) {
log()->error("Failed to load SoundData('{}'): {}", filename, PHYSFS_getLastError());
std::cout << "Failed to load SoundData('{}'): {}", filename, PHYSFS_getLastError());
return;
}
......
......@@ -5,7 +5,6 @@
#include "vendor/physfs/extras/physfsrwops.h"
#include "vendor/filesystem/filesystem/path.h"
#include "../ChaiGame.h"
#include "log.h"
#include <iostream>
......@@ -68,12 +67,12 @@ namespace chaigame {
if (errorChar != NULL) {
physErr = errorChar;
}
log()->error("Could not get size of file: {}", physErr);
std::cout << "Could not get size of file " << physErr << std::endl;
return -1;
}
}
else {
log()->error("The file is not open.");
printf("The file is not open.");
}
return size;
}
......@@ -98,7 +97,7 @@ namespace chaigame {
sdlErr = errorChar;
}
log()->error("Error loading file {}: {} {}", filename, physErr, sdlErr);
std::cout << "Error loading file %s: %s %s", filename, physErr, sdlErr);
}
return rw;
}
......@@ -111,7 +110,7 @@ namespace chaigame {
if (errorChar != NULL) {
physErr = errorChar;
}
log()->error("Error opening file {}: {}", filename, physErr);
std::cout << "Error opening file %s: %s", filename, physErr);
return NULL;
}
return myfile;
......@@ -134,7 +133,7 @@ namespace chaigame {
if (errorChar != NULL) {
physErr = errorChar;
}
log()->error("File System error while reading from file {}: {}", filename, physErr);
std::cout << "File System error while reading from file " << filename << physErr << std::endl;
output = NULL;
}
else {
......@@ -144,7 +143,7 @@ namespace chaigame {
}
else {
std::string physErr = PHYSFS_getLastError();
log()->error("Error getting filesize of {}: {}", filename, physErr);
std::cout << "Error getting filesize of %s: %s", filename, physErr);
}
PHYSFS_close(myfile);
......@@ -184,7 +183,7 @@ namespace chaigame {
PHYSFS_freeList(rc);
}
else {
log()->warn("Error enumerating files from {}", dir);
std::cout << "Error enumerating files from " << dir << std::endl;
}
return result;
......
......@@ -3,7 +3,6 @@
//#include "SDL_ttf.h"
#include "font.h"
#include "graphics/Font.h"
#include "log.h"
namespace chaigame {
bool font::load() {
......@@ -14,7 +13,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->error("TTF_Init failed to initialize font system: {}", errString);
std::cout << "TTF_Init failed to initialize font system: {}", errString);
return false;
}*/
return true;
......
......@@ -8,7 +8,6 @@
#include "graphics/ImageData.h"
#include "graphics/Image.h"
#include "graphics/Font.h"
#include "log.h"
namespace chaigame {
......@@ -23,7 +22,7 @@ namespace chaigame {
bool graphics::load() {
// Enable alpha blending.
if (SDL_SetAlpha(getScreen(), SDL_SRCALPHA, 0) == -1) {
log()->warn("Enabling alpha blending failed");
printf("Enabling alpha blending failed");
}
return true;
......
......@@ -6,7 +6,7 @@
#include <SDL_fnt.h>
#include "../../ChaiGame.h"
#include "ImageData.h"
#include "../log.h"
namespace chaigame {
Font::Font() {
......@@ -18,7 +18,7 @@ namespace chaigame {
if (imageData->loaded()) {
TTY_Font* newFont = FNT_Create(imageData->surface, glyphWidth, glyphHeight, letters.c_str());
if (newFont == NULL) {
log()->error("Error creating FNT_Create()\n");
printf("Error creating FNT_Create()\n");
return;
}
......@@ -29,7 +29,7 @@ namespace chaigame {
}
Font::Font(const std::string& filename, int ptsize) {
log()->error("TTF fonts are not supported by ChaiGame, currently.");
printf("TTF fonts are not supported by ChaiGame, currently.");
/*
SDL_RWops* rwops = ChaiGame::getInstance()->filesystem.openRW(filename);
if (rwops) {
......@@ -40,7 +40,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->error("TTF_OpenFontRW: {}", errString);
std::cout << "TTF_OpenFontRW: {}", errString);
return;
}
......@@ -125,7 +125,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->error("Font::print - {}", errString);
std::cout << "Font::print - %s", errString);
return;
}
......
......@@ -3,9 +3,10 @@
#define SDL_STBIMAGE_IMPLEMENTATION
#include "SDL_stbimage.h"
#include <iostream>
#include <string>
#include "../../ChaiGame.h"
#include "../log.h"
namespace chaigame {
......@@ -26,7 +27,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->error("STBIMG_Load_RW failed to load data: {}", errString);
std::cout << "STBIMG_Load_RW failed to load data: " << errString << std::endl;
return false;
}
......@@ -42,7 +43,7 @@ namespace chaigame {
optimizedImage = SDL_DisplayFormat(surface);
}
if (!optimizedImage) {
log()->warn("SDL_DisplayFormat failed to optimize the image.");
std::cout << "SDL_DisplayFormat failed to optimize the image." << std::endl;
}
else {
SDL_FreeSurface(surface);
......
#include "image.h"
#include <string>
#include "graphics/ImageData.h"
#include "log.h"
namespace chaigame {
chaigame::ImageData* image::newImageData(const std::string& filename) {
......@@ -23,7 +22,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->error("Failed to call IMG_Init with jpg/png: {}", errString);
std::cout << "Failed to call IMG_Init with jpg/png: {}", errString);
return false;
}
return true;*/
......
#include "keyboard.h"
#include <string>
#include <iostream>
//#include "SDL.h"
#include "log.h"
namespace chaigame {
......@@ -21,7 +21,7 @@ namespace chaigame {
void keyboard::setKeyRepeat(int delay, int interval) {
if (SDL_EnableKeyRepeat(delay, interval) == -1) {
log()->error("Error setting KeyRepeat.");
std::cout << "Error setting KeyRepeat." << std::endl;
}
}
......
#include "log.h"
namespace chaigame {
std::shared_ptr<spdlog::logger> log() {
static std::shared_ptr<spdlog::logger> logger = spdlog::stdout_color_mt("ChaiGame");
return logger;
}
}
#ifndef CHAIGAME_LOG_H
#define CHAIGAME_LOG_H
#include "spdlog/spdlog.h"
namespace chaigame {
std::shared_ptr<spdlog::logger> log();
}
#endif
#include "script.h"
#include "log.h"
#include "../ChaiGame.h"
#include "vendor/filesystem/filesystem/path.h"
......@@ -20,7 +19,7 @@ namespace chaigame {
return true;
}
else {
log()->error("Module {} was empty.", moduleName);
std::cout << "Module {} was empty.", moduleName);
}
#endif
return false;
......@@ -226,84 +225,84 @@ namespace chaigame {
chaiload = chai.eval<std::function<void ()> >("load");
}
catch (const std::exception& e) {
log()->info("[script] Skipping load() - {}", e.what());
std::cout << "[script] Skipping load() " << e.what() << std::endl;
hasload = false;
}
try {
chaireset = chai.eval<std::function<void ()> >("reset");
}
catch (const std::exception& e) {
log()->info("[script] Skipping reset() - {}", e.what());
std::cout << "[script] Skipping reset() " << e.what() << std::endl;
hasreset = false;
}
try {
chaiupdate = chai.eval<std::function<void (float)> >("update");
}
catch (const std::exception& e) {
log()->info("[script] Skipping update(delta) - {}", e.what());
std::cout << "[script] Skipping update(delta) " << e.what() << std::endl;
hasUpdate = false;
}
try {
chaiconf = chai.eval<std::function<void (Config&)> >("conf");
}
catch (const std::exception& e) {
log()->info("[script] Skipping conf(t) - {}", e.what());
std::cout << "[script] Skipping conf(t) " << e.what() << std::endl;
hasconf = false;
}
try {
chaidraw = chai.eval<std::function<void ()> >("draw");
}
catch (const std::exception& e) {
log()->info("[script] Skipping draw() - {}", e.what());
std::cout << "[script] Skipping draw() " << e.what() << std::endl;
hasDraw = false;
}
try {
chaijoystickpressed = chai.eval<std::function<void (int, const std::string&)> >("joystickpressed");
}
catch (const std::exception& e) {
log()->info("[script] Skipping joystickpressed() - {}", e.what());
std::cout << "[script] Skipping joystickpressed() " << e.what() << std::endl;
hasjoystickpressed = false;
}
try {
chaijoystickreleased = chai.eval<std::function<void (int, const std::string&)> >("joystickreleased");
}
catch (const std::exception& e) {
log()->info("[script] Skipping joystickreleased() - {}", e.what());
std::cout << "[script] Skipping joystickreleased() " << e.what() << std::endl;
hasjoystickreleased = false;
}
try {
chaimousepressed = chai.eval<std::function<void (int, int, int)> >("mousepressed");
}
catch (const std::exception& e) {
log()->info("[script] Skipping mousepressed() - {}", e.what());
std::cout << "[script] Skipping mousepressed() " << e.what() << std::endl;
hasmousepressed = false;
}
try {
chaimousereleased = chai.eval<std::function<void (int, int, int)> >("mousereleased");
}
catch (const std::exception& e) {
log()->info("[script] Skipping mousereleased() - {}", e.what());
std::cout << "[script] Skipping mousereleased() " << e.what() << std::endl;
hasmousereleased = false;
}
try {
chaimousemove = chai.eval<std::function<void (int, int)> >("mousemove");
}
catch (const std::exception& e) {
log()->info("[script] Skipping mousemove() - {}", e.what());
std::cout << "[script] Skipping mousemove() " << e.what() << std::endl;
hasmousemove = false;
}
try {
chailoadstate = chai.eval<std::function<bool (std::string)> >("loadstate");
}
catch (const std::exception& e) {
log()->info("[script] Skipping loadstate() - {}", e.what());
std::cout << "[script] Skipping loadstate() " << e.what() << std::endl;
hasloadstate = false;
}
try {
chaisavestate = chai.eval<std::function<std::string ()> >("savestate");
}
catch (const std::exception& e) {
log()->info("[script] Skipping savestate() - {}", e.what());
std::cout << "[script] Skipping savestate() " << e.what() << std::endl;
hassavestate = false;
}
#endif
......@@ -316,7 +315,7 @@ namespace chaigame {
chaiconf(t);
}
catch (const std::exception& e) {
log()->error("[script] Failed to invoke conf(t): {}", e.what());
std::cout << "[script] Failed to invoke conf(t): " << e.what() << std::endl;
hasconf = false;
}
}
......@@ -330,7 +329,7 @@ namespace chaigame {
chaiload();
}
catch (const std::exception& e) {
log()->error("[script] Failed to call load(): {}", e.what());
std::cout << "[script] Failed to call load(): " << e.what() << std::endl;
hasload = false;
}
}
......@@ -344,7 +343,7 @@ namespace chaigame {
chaireset();
}
catch (const std::exception& e) {
log()->error("[script] Failed to call reset(): {}", e.what());
std::cout << "[script] Failed to call reset(): " << e.what() << std::endl;
hasreset = false;
}
}
......@@ -359,7 +358,7 @@ namespace chaigame {
}
catch (const std::exception& e) {
hasUpdate = false;
log()->error("[script] Failed to call update(delta): {}", e.what());
std::cout << "[script] Failed to call update(delta): " << e.what() << std::endl;
}
}
#endif
......@@ -372,7 +371,7 @@ namespace chaigame {
chaidraw();
}
catch (const std::exception& e) {
log()->error("[script] Failed to call draw(): {}", e.what());
std::cout << "[script] Failed to call draw(): " << e.what() << std::endl;
hasDraw = false;
}
}
......@@ -389,7 +388,7 @@ namespace chaigame {
chaijoystickpressed(joystick, button);
}
catch (const std::exception& e) {
log()->error("[script] Failed to call joystickpressed(): {}", e.what());
std::cout << "[script] Failed to call joystickpressed(): " << e.what() << std::endl;
hasjoystickpressed = false;
}
}
......@@ -403,7 +402,7 @@ namespace chaigame {
chaijoystickreleased(joystick, button);
}
catch (const std::exception& e) {
log()->error("[script] Failed to call joystickreleased(): {}", e.what());
std::cout << "[script] Failed to call joystickreleased(): " << e.what() << std::endl;
hasjoystickreleased = false;
}
}
......@@ -417,7 +416,7 @@ namespace chaigame {
chaimousepressed(x, y, button);
}
catch (const std::exception& e) {
log()->error("[script] Failed to call mousepressed(): {}", e.what());
std::cout << "[script] Failed to call mousepressed(): " << e.what() << std::endl;
hasmousepressed = false;
}
}
......@@ -431,7 +430,7 @@ namespace chaigame {
chaimousereleased(x, y, button);
}
catch (const std::exception& e) {
log()->error("[script] Failed to call mousereleased(): {}", e.what());
std::cout << "[script] Failed to call mousereleased(): " << e.what() << std::endl;
hasmousereleased = false;
}
}
......@@ -445,7 +444,7 @@ namespace chaigame {
chaimousemove(x, y);
}
catch (const std::exception& e) {
log()->error("[script] Failed to call mousemove(): {}", e.what());
std::cout << "[script] Failed to call mousemove(): " << e.what() << std::endl;
hasmousemove = false;
}
}
......@@ -462,7 +461,7 @@ namespace chaigame {
return chaisavestate();
}
catch (const std::exception& e) {
log()->error("[script] Failed to call savestate(): {}", e.what());
std::cout << "[script] Failed to call savestate(): " << e.what() << std::endl;
hassavestate = false;
}
}
......@@ -482,7 +481,7 @@ namespace chaigame {
return chailoadstate(data);
}
catch (const std::exception& e) {
log()->error("[script] Failed to call loadstate(): {}", e.what());
std::cout << "[script] Failed to call loadstate(): " << e.what() << std::endl;
hasloadstate = false;
}
}
......
......@@ -4,7 +4,6 @@
#include "SDL.h"
#include "../ChaiGame.h"
#include "audio/SoundData.h"
#include "log.h"
namespace chaigame {
......
......@@ -2,7 +2,6 @@
#include <string>
#include "../ChaiGame.h"
#include "SDL.h"
#include "log.h"
#include "system/Config.h"
namespace chaigame {
......@@ -17,7 +16,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->critical("Unable to initialize SDL: {}", errString);
std::cout << "[game] Unable to initialize SDL " << errString << std::endl;
return false;
}
......@@ -42,7 +41,7 @@ namespace chaigame {
if (errorChar != NULL) {
errString = errorChar;
}
log()->critical("Unable to create screen: {}", errString);
std::cout << "[game] Unable to initialize SDL" << errString << std::endl;
SDL_Quit();
return false;
}
......
......@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <iostream>
#include "libretro.h"
#include "ChaiGame.h"
......@@ -283,17 +284,17 @@ void retro_init(void) {
}
if (retro_system_directory == NULL) {
sprintf(RETRO_DIR, "%s\n",".");
std::cout << RETRO_DIR << std::endl;
}
else {
sprintf(RETRO_DIR, "%s\n", retro_system_directory);
std::cout << RETRO_DIR << retro_system_directory << std::endl;
}
//sprintf(retro_system_conf, "%s/testsdl.cfg\n",RETRO_DIR);
//std::cout << retro_system_conf, "%s/testsdl.cfg\n",RETRO_DIR);
printf("Retro SYSTEM_DIRECTORY %s\n",retro_system_directory);
printf("Retro SAVE_DIRECTORY %s\n",retro_save_directory);
printf("Retro CONTENT_DIRECTORY %s\n",retro_content_directory);
std::cout << "Retro SYSTEM_DIRECTORY " << retro_system_directory << std::endl;
std::cout << "Retro SAVE_DIRECTORY " << retro_save_directory << std::endl;
std::cout << "Retro CONTENT_DIRECTORY " << retro_content_directory << std::endl;