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
|
CONFIG -= qt
|
||||||
QT =
|
QT =
|
||||||
|
|
||||||
SUBDIRS += lib driver
|
SUBDIRS += LogVisor lib driver
|
||||||
driver.depends += lib
|
driver.depends += LogVisor lib
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
include/NOD/Util.hpp \
|
include/NOD/Util.hpp \
|
||||||
|
|
|
@ -7,8 +7,15 @@ CONFIG -= app_bundle
|
||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
QT =
|
QT =
|
||||||
|
|
||||||
INCLUDEPATH += ../include
|
isEmpty(LOGVISOR_INCLUDE) {
|
||||||
QMAKE_LFLAGS += -maes
|
LOGVISOR_INCLUDE = ../LogVisor/include
|
||||||
LIBS += -L$$OUT_PWD/../lib -lNOD
|
}
|
||||||
|
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
|
SOURCES += main.cpp
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <LogVisor/LogVisor.hpp>
|
||||||
#include "NOD/NOD.hpp"
|
#include "NOD/NOD.hpp"
|
||||||
|
|
||||||
static void printHelp()
|
static void printHelp()
|
||||||
|
@ -25,6 +26,9 @@ int main(int argc, char* argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Enable logging to console */
|
||||||
|
LogVisor::RegisterConsoleLogger();
|
||||||
|
|
||||||
const NOD::SystemChar* inDir = nullptr;
|
const NOD::SystemChar* inDir = nullptr;
|
||||||
const NOD::SystemChar* outDir = _S(".");
|
const NOD::SystemChar* outDir = _S(".");
|
||||||
bool force = false;
|
bool force = false;
|
||||||
|
|
|
@ -3,10 +3,14 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <LogVisor/LogVisor.hpp>
|
||||||
|
|
||||||
namespace NOD
|
namespace NOD
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Log Module */
|
||||||
|
extern LogVisor::LogModule LogModule;
|
||||||
|
|
||||||
/* filesystem char type */
|
/* filesystem char type */
|
||||||
#if _WIN32 && UNICODE
|
#if _WIN32 && UNICODE
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
|
@ -36,9 +36,9 @@ public:
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#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
|
#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
|
#endif
|
||||||
return std::unique_ptr<IReadStream>();
|
return std::unique_ptr<IReadStream>();
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ public:
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#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
|
#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
|
#endif
|
||||||
return std::unique_ptr<IWriteStream>();
|
return std::unique_ptr<IWriteStream>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,9 @@ public:
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#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
|
#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
|
#endif
|
||||||
return std::unique_ptr<IReadStream>();
|
return std::unique_ptr<IReadStream>();
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ public:
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#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
|
#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
|
#endif
|
||||||
return std::unique_ptr<IWriteStream>();
|
return std::unique_ptr<IWriteStream>();
|
||||||
}
|
}
|
||||||
|
|
11
lib/NOD.cpp
11
lib/NOD.cpp
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
namespace NOD
|
namespace NOD
|
||||||
{
|
{
|
||||||
|
|
||||||
|
LogVisor::LogModule LogModule("NODLib");
|
||||||
|
|
||||||
std::unique_ptr<IDiscIO> NewDiscIOISO(const SystemChar* path);
|
std::unique_ptr<IDiscIO> NewDiscIOISO(const SystemChar* path);
|
||||||
std::unique_ptr<IDiscIO> NewDiscIOWBFS(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 (!fp)
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#if NOD_UCS2
|
||||||
fwprintf(stderr, L"Unable to open '%s'\n", path);
|
LogModule.report(LogVisor::Error, L"Unable to open '%s'\n", path);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Unable to open '%s'\n", path);
|
LogModule.report(LogVisor::Error, "Unable to open '%s'\n", path);
|
||||||
#endif
|
#endif
|
||||||
return std::unique_ptr<DiscBase>();
|
return std::unique_ptr<DiscBase>();
|
||||||
}
|
}
|
||||||
|
@ -63,9 +66,9 @@ std::unique_ptr<DiscBase> OpenDiscFromImage(const SystemChar* path, bool& isWii)
|
||||||
if (!discIO)
|
if (!discIO)
|
||||||
{
|
{
|
||||||
#if NOD_UCS2
|
#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
|
#else
|
||||||
fprintf(stderr, "'%s' is not a valid image\n", path);
|
LogModule.report(LogVisor::Error, "'%s' is not a valid image\n", path);
|
||||||
#endif
|
#endif
|
||||||
return std::unique_ptr<DiscBase>();
|
return std::unique_ptr<DiscBase>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,11 @@ QT =
|
||||||
TARGET = NOD
|
TARGET = NOD
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -maes
|
QMAKE_CXXFLAGS += -maes
|
||||||
INCLUDEPATH += ../include ../../../LogVisor/include
|
|
||||||
|
isEmpty(LOGVISOR_INCLUDE) {
|
||||||
|
LOGVISOR_INCLUDE = ../LogVisor/include
|
||||||
|
}
|
||||||
|
INCLUDEPATH += ../include $$LOGVISOR_INCLUDE
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
FileIOFILE.cpp \
|
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