(Xbox 1) Replaced Debug.cpp code with calls to RARCH_LOG/RARCH_WARN/

RARCH_ERR
This commit is contained in:
twinaphex 2012-07-24 12:27:49 +02:00
parent 199871955c
commit 79bd5a844b
8 changed files with 24 additions and 159 deletions

View File

@ -357,9 +357,6 @@
<Filter
Name="RetroLaunch"
Filter="">
<File
RelativePath="..\..\xbox1\RetroLaunch\Debug.cpp">
</File>
<File
RelativePath="..\..\xbox1\RetroLaunch\Font.cpp">
</File>

View File

@ -1,83 +0,0 @@
/**
* RetroLaunch 2012
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version. This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
* authors: Surreal64 CE Team (http://www.emuxtras.net)
*/
#include "Global.h"
#include "Debug.h"
CDebug g_debug;
CDebug::CDebug(void)
{
iLine = 1;
m_bFileOpen = false;
}
CDebug::~CDebug(void)
{
}
void CDebug::Print(char *szMessage, ...)
{
char szMsg[512];
va_list vaArgList;
string szDebugFile ("D:\\debug.log");//(FixPath(PathRoot() + "debug.log"));
va_start(vaArgList, szMessage);
vsprintf(szMsg, szMessage, vaArgList);
va_end(vaArgList);
OutputDebugStringA(IntToString(iLine).c_str());
OutputDebugStringA(": ");
OutputDebugStringA(szMsg);
OutputDebugStringA("\n\n");
#ifdef WIN32
cout << IntToString(iLine)<< ": " << szMsg << endl << endl;
#endif
//#ifdef _LOG
//Open the log file, create one if it does not exist, append the data
if(!m_bFileOpen)
{
fp = fopen(szDebugFile.c_str(), "w+");
m_bFileOpen = true;
}
else
{
fp = fopen(szDebugFile.c_str(), "a+");
}
//print the data to the log file
fprintf(fp, IntToString(iLine).c_str());
fprintf(fp, ": ");
fprintf(fp, szMsg);
fprintf(fp, "\r\n\r\n");
//close the file
fclose(fp);
//#endif //_LOG
iLine ++;
}
string CDebug::IntToString(int value)
{
stringstream ss;
ss << value;
return ss.str();
}

View File

@ -1,41 +0,0 @@
/**
* RetroLaunch 2012
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version. This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
* authors: Surreal64 CE Team (http://www.emuxtras.net)
*/
#ifndef _DEBUG_H__DASH_
#define _DEBUG_H__DASH_
#if _MSC_VER > 1000
#pragma once
#endif //_MSC_VER > 1000
class CDebug
{
public:
CDebug();
~CDebug();
void Print(char *szMessage, ...);
string IntToString(int value);
private:
int iLine;
FILE *fp;
bool m_bFileOpen;
};
extern CDebug g_debug;
#endif //_DEBUG_H__DASH_

View File

@ -16,6 +16,7 @@
#include "SimpleIni.h"
#include "IniFile.h"
#include "../../general.h"
IniFile g_iniFile;
@ -46,15 +47,13 @@ bool IniFile::Save(const string &szIniFileName)
rc = ini.SaveFile(szIniFileName.c_str());
OutputDebugStringA(szIniFileName.c_str());
if (rc < 0)
{
OutputDebugStringA(" failed to save!\n");
RARCH_ERR("Failed to save RetroLaunch INI file: %s.\n", szIniFileName.c_str());
return false;
}
OutputDebugStringA(" saved successfully!\n");
RARCH_LOG("Saved RetroLaunch INI file: %s.\n", szIniFileName.c_str());
return true;
}
@ -70,15 +69,11 @@ bool IniFile::Load(const string &szIniFileName)
if (rc < 0)
{
OutputDebugString("Failed to load ");
OutputDebugString(szIniFileName.c_str());
OutputDebugString("\n");
RARCH_ERR("Failed to load RetroLaunch INI file: %s.\n", szIniFileName.c_str());
return false;
}
OutputDebugStringA("Successfully loaded ");
OutputDebugString(szIniFileName.c_str());
OutputDebugString("\n");
RARCH_LOG("Successfully loaded RetroLaunch INI file: %s.\n", szIniFileName.c_str());
//GENERAL SETTINGS
m_currentIniEntry.bShowDebugInfo = ini.GetBoolValue("GENERAL SETTINGS", "SHOW DEBUG INFO", NULL );
@ -134,15 +129,13 @@ bool IniFile::SaveTempRomFileName(const string &szFileName)
DeleteFile("T:\\tmp.retro");
rc = ini.SaveFile("T:\\tmp.retro");
OutputDebugStringA("T:\\tmp.retro");
if (rc < 0)
{
OutputDebugStringA(" failed to save!\n");
RARCH_ERR("Failed to save temporary ROM file: %s.\n", "T:\\tmp.retro");
return false;
}
OutputDebugStringA(" saved successfully!\n");
RARCH_LOG("Successfully saved temporary ROM file %s.\n", "T:\\tmp.retro");
return true;
}

View File

@ -14,11 +14,11 @@
*/
#include "MenuMain.h"
#include "Debug.h"
#include "Font.h"
#include "RomList.h"
#include "Input.h"
#include "../../general.h"
CMenuMain g_menuMain;
@ -64,7 +64,7 @@ CMenuMain::~CMenuMain()
bool CMenuMain::Create()
{
g_debug.Print("CMenuMain::Create()");
RARCH_LOG("CMenuMain::Create().");
// Title coords with color
m_menuMainTitle_x = 305;
@ -157,7 +157,7 @@ void CMenuMain::ProcessInput()
{
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
m_romListSelectedRom++;
g_debug.Print("SELECTED ROM: "); g_debug.Print("%d", m_romListSelectedRom);
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
}
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * (m_romListEndRender))))
@ -170,11 +170,11 @@ void CMenuMain::ProcessInput()
}
g_debug.Print("SELECTED ROM AFTER CORRECTION: "); g_debug.Print("%d", m_romListSelectedRom);
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1) {
m_romListOffset++;
g_debug.Print("OFFSET: "); g_debug.Print("%d", m_romListOffset);
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
}
}
@ -192,7 +192,7 @@ void CMenuMain::ProcessInput()
{
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
m_romListSelectedRom--;
g_debug.Print("SELECTED ROM: "); g_debug.Print("%d", m_romListSelectedRom);
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
}
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
@ -205,11 +205,11 @@ void CMenuMain::ProcessInput()
}
g_debug.Print("SELECTED ROM AFTER CORRECTION: "); g_debug.Print("%d", m_romListSelectedRom);
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
if(m_romListSelectedRom > 0 && m_romListOffset > 0) {
m_romListOffset--;
g_debug.Print("OFFSET: "); g_debug.Print("%d", m_romListOffset);
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
}
}
}

View File

@ -15,9 +15,10 @@
#include "MenuManager.h"
#include "MenuMain.h"
#include "Debug.h"
#include "Input.h"
#include "../../general.h"
CMenuManager g_menuManager;
@ -32,7 +33,7 @@ CMenuManager::~CMenuManager()
bool CMenuManager::Create()
{
//Create the MenuManager, set to Main Menu
g_debug.Print("Create MenuManager, set state to MENU_MAIN");
RARCH_LOG("Create MenuManager, set state to MENU_MAIN.\n");
SetMenuState(MENU_MAIN);
return true;

View File

@ -16,7 +16,6 @@
*/
#include "Surface.h"
#include "Debug.h"
#include "../../general.h"
#include "../xdk_d3d8.h"
@ -67,7 +66,7 @@ bool CSurface::Create(const string &szFilename)
if (FAILED(g_hResult))
{
g_debug.Print("Failed: D3DXCreateTextureFromFileExA()\n");
RARCH_ERR("Error occurred during D3DXCreateTextureFromFileExA().\n");
return false;
}
@ -78,7 +77,7 @@ bool CSurface::Create(const string &szFilename)
D3DPOOL_MANAGED, &m_pVertexBuffer);
if (FAILED(g_hResult))
{
g_debug.Print("Failed: CreateVertexBuffer()\n");
RARCH_ERR("Error occurred during CreateVertexBuffer().\n");
m_pTexture->Release();
return false;
}
@ -100,7 +99,7 @@ bool CSurface::Create(dword width, dword height)
if (FAILED(g_hResult))
{
g_debug.Print("Failed: CreateTexture()\n");
RARCH_ERR("Error occurred during CreateTexture().\n");
return false;
}
@ -115,7 +114,7 @@ bool CSurface::Create(dword width, dword height)
D3DPOOL_MANAGED, &m_pVertexBuffer);
if (FAILED(g_hResult))
{
g_debug.Print("Failed: CreateVertexBuffer()\n");
RARCH_ERR("Error occurred during CreateVertexBuffer().\n");
m_pTexture->Release();
return false;
}
@ -185,7 +184,7 @@ bool CSurface::Render(int x, int y, dword w, dword h)
if (FAILED(g_hResult))
{
g_debug.Print("Failed: m_pVertexBuffer->Lock()\n");
RARCH_ERR("Error occurred during m_pVertexBuffer->Lock().\n");
return false;
}
// copy the new verts over the old verts

View File

@ -18,7 +18,6 @@
#include "../../xbox1/RetroLaunch/IniFile.h"
#include "../../xbox1/RetroLaunch/IoSupport.h"
#include "../../xbox1/RetroLaunch/Input.h"
#include "../../xbox1/RetroLaunch/Debug.h"
#include "../../xbox1/RetroLaunch/Font.h"
#include "../../xbox1/RetroLaunch/MenuManager.h"
#include "../../xbox1/RetroLaunch/RomList.h"
@ -27,7 +26,7 @@ bool g_bExit = false;
int menu_init(void)
{
g_debug.Print("Starting RetroLaunch\n");
RARCH_LOG("Starting RetroLaunch.\n");
// Set file cache size
XSetFileCacheSize(8 * 1024 * 1024);