mirror of https://github.com/AxioDL/nod.git
Integrated LogVisor for error gathering
This commit is contained in:
parent
602c54541a
commit
a656c5d4c9
|
@ -0,0 +1,3 @@
|
|||
[submodule "LogVisor"]
|
||||
path = LogVisor
|
||||
url = https://github.com/RetroView/LogVisor.git
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 33f2f7b279991a7be81310024636f43ecbf5ed24
|
|
@ -6,8 +6,8 @@ CONFIG -= app_bundle
|
|||
CONFIG -= qt
|
||||
QT =
|
||||
|
||||
SUBDIRS += lib driver
|
||||
driver.depends += lib
|
||||
SUBDIRS += LogVisor lib driver
|
||||
driver.depends += LogVisor lib
|
||||
|
||||
HEADERS += \
|
||||
include/NOD/Util.hpp \
|
||||
|
|
|
@ -7,8 +7,15 @@ CONFIG -= app_bundle
|
|||
CONFIG -= qt
|
||||
QT =
|
||||
|
||||
INCLUDEPATH += ../include
|
||||
QMAKE_LFLAGS += -maes
|
||||
LIBS += -L$$OUT_PWD/../lib -lNOD
|
||||
isEmpty(LOGVISOR_INCLUDE) {
|
||||
LOGVISOR_INCLUDE = ../LogVisor/include
|
||||
}
|
||||
INCLUDEPATH += ../include $$LOGVISOR_INCLUDE
|
||||
|
||||
isEmpty(LOGVISOR_LIBS) {
|
||||
LOGVISOR_LIBS = -L$$OUT_PWD/../LogVisor -lLogVisor
|
||||
}
|
||||
LIBS += -L$$OUT_PWD/../lib -lNOD $$LOGVISOR_LIBS -lpthread
|
||||
|
||||
QMAKE_LFLAGS += -maes
|
||||
SOURCES += main.cpp
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
#include "NOD/NOD.hpp"
|
||||
|
||||
static void printHelp()
|
||||
|
@ -25,6 +26,9 @@ int main(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Enable logging to console */
|
||||
LogVisor::RegisterConsoleLogger();
|
||||
|
||||
const NOD::SystemChar* inDir = nullptr;
|
||||
const NOD::SystemChar* outDir = _S(".");
|
||||
bool force = false;
|
||||
|
|
|
@ -3,10 +3,14 @@
|
|||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <LogVisor/LogVisor.hpp>
|
||||
|
||||
namespace NOD
|
||||
{
|
||||
|
||||
/* Log Module */
|
||||
extern LogVisor::LogModule LogModule;
|
||||
|
||||
/* filesystem char type */
|
||||
#if _WIN32 && UNICODE
|
||||
#include <wctype.h>
|
||||
|
|
|
@ -36,9 +36,9 @@ public:
|
|||
if (!fp)
|
||||
{
|
||||
#if NOD_UCS2
|
||||
fwprintf(stderr, L"Unable to open '%s' for reading\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, L"Unable to open '%s' for reading\n", filepath.c_str());
|
||||
#else
|
||||
fprintf(stderr, "Unable to open '%s' for reading\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, "Unable to open '%s' for reading\n", filepath.c_str());
|
||||
#endif
|
||||
return std::unique_ptr<IReadStream>();
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ public:
|
|||
if (!fp)
|
||||
{
|
||||
#if NOD_UCS2
|
||||
fwprintf(stderr, L"Unable to open '%s' for writing\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, L"Unable to open '%s' for writing\n", filepath.c_str());
|
||||
#else
|
||||
fprintf(stderr, "Unable to open '%s' for writing\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, "Unable to open '%s' for writing\n", filepath.c_str());
|
||||
#endif
|
||||
return std::unique_ptr<IWriteStream>();
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ public:
|
|||
if (!fp)
|
||||
{
|
||||
#if NOD_UCS2
|
||||
fwprintf(stderr, L"Unable to open '%s' for reading\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, L"Unable to open '%s' for reading\n", filepath.c_str());
|
||||
#else
|
||||
fprintf(stderr, "Unable to open '%s' for reading\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, "Unable to open '%s' for reading\n", filepath.c_str());
|
||||
#endif
|
||||
return std::unique_ptr<IReadStream>();
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ public:
|
|||
if (!fp)
|
||||
{
|
||||
#if NOD_UCS2
|
||||
fwprintf(stderr, L"Unable to open '%s' for writing\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, L"Unable to open '%s' for writing\n", filepath.c_str());
|
||||
#else
|
||||
fprintf(stderr, "Unable to open '%s' for writing\n", filepath.c_str());
|
||||
LogModule.report(LogVisor::Error, "Unable to open '%s' for writing\n", filepath.c_str());
|
||||
#endif
|
||||
return std::unique_ptr<IWriteStream>();
|
||||
}
|
||||
|
|
11
lib/NOD.cpp
11
lib/NOD.cpp
|
@ -4,6 +4,9 @@
|
|||
|
||||
namespace NOD
|
||||
{
|
||||
|
||||
LogVisor::LogModule LogModule("NODLib");
|
||||
|
||||
std::unique_ptr<IDiscIO> NewDiscIOISO(const SystemChar* path);
|
||||
std::unique_ptr<IDiscIO> NewDiscIOWBFS(const SystemChar* path);
|
||||
|
||||
|
@ -18,9 +21,9 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(const SystemChar* path, bool& isWii)
|
|||
if (!fp)
|
||||
{
|
||||
#if NOD_UCS2
|
||||
fwprintf(stderr, L"Unable to open '%s'\n", path);
|
||||
LogModule.report(LogVisor::Error, L"Unable to open '%s'\n", path);
|
||||
#else
|
||||
fprintf(stderr, "Unable to open '%s'\n", path);
|
||||
LogModule.report(LogVisor::Error, "Unable to open '%s'\n", path);
|
||||
#endif
|
||||
return std::unique_ptr<DiscBase>();
|
||||
}
|
||||
|
@ -63,9 +66,9 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(const SystemChar* path, bool& isWii)
|
|||
if (!discIO)
|
||||
{
|
||||
#if NOD_UCS2
|
||||
fwprintf(stderr, L"'%s' is not a valid image\n", path);
|
||||
LogModule.report(LogVisor::Error, L"'%s' is not a valid image\n", path);
|
||||
#else
|
||||
fprintf(stderr, "'%s' is not a valid image\n", path);
|
||||
LogModule.report(LogVisor::Error, "'%s' is not a valid image\n", path);
|
||||
#endif
|
||||
return std::unique_ptr<DiscBase>();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@ QT =
|
|||
TARGET = NOD
|
||||
|
||||
QMAKE_CXXFLAGS += -maes
|
||||
INCLUDEPATH += ../include ../../../LogVisor/include
|
||||
|
||||
isEmpty(LOGVISOR_INCLUDE) {
|
||||
LOGVISOR_INCLUDE = ../LogVisor/include
|
||||
}
|
||||
INCLUDEPATH += ../include $$LOGVISOR_INCLUDE
|
||||
|
||||
SOURCES += \
|
||||
FileIOFILE.cpp \
|
||||
|
|
35
main.cpp
35
main.cpp
|
@ -1,35 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "NODLib.hpp"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: nodlib <image-in>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::unique_ptr<NOD::DiscBase> disc = NOD::OpenDiscFromImage(argv[1]);
|
||||
if (!disc)
|
||||
return -1;
|
||||
|
||||
const NOD::DiscBase::IPartition* dataPart = disc->getDataPartition();
|
||||
if (dataPart)
|
||||
{
|
||||
for (const NOD::DiscBase::IPartition::Node& node : dataPart->getFSTRoot())
|
||||
{
|
||||
if (node.getKind() == NOD::DiscBase::IPartition::Node::NODE_FILE)
|
||||
printf("FILE: %s\n", node.getName().c_str());
|
||||
else if (node.getKind() == NOD::DiscBase::IPartition::Node::NODE_DIRECTORY)
|
||||
{
|
||||
printf("DIR: %s\n", node.getName().c_str());
|
||||
for (const NOD::DiscBase::IPartition::Node& subnode : node)
|
||||
printf("SUBFILE: %s\n", subnode.getName().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue