fix fsnitro.cpp the way it was supposed to be fixed, without platform dependencies
This commit is contained in:
parent
3b92f41b45
commit
bdf580036c
|
@ -23,10 +23,6 @@
|
||||||
#include "fsnitro.h"
|
#include "fsnitro.h"
|
||||||
#include "file/file_path.h"
|
#include "file/file_path.h"
|
||||||
|
|
||||||
#ifndef HOST_WINDOWS
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FS_NITRO::FS_NITRO(u8 *cart_rom)
|
FS_NITRO::FS_NITRO(u8 *cart_rom)
|
||||||
{
|
{
|
||||||
inited = false;
|
inited = false;
|
||||||
|
@ -484,11 +480,7 @@ bool FS_NITRO::extractFile(u16 id, std::string to)
|
||||||
if (!inited) return false;
|
if (!inited) return false;
|
||||||
if (id > numFiles) return false;
|
if (id > numFiles) return false;
|
||||||
|
|
||||||
char curr_dir[MAX_PATH] = {0};
|
extract(id, (to + path_default_slash() + fat[id].filename));
|
||||||
getcwd(curr_dir, sizeof(curr_dir));
|
|
||||||
chdir(to.c_str());
|
|
||||||
extract(id, fat[id].filename);
|
|
||||||
chdir(curr_dir);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -502,10 +494,6 @@ bool FS_NITRO::extractAll(std::string to, void (*callback)(u32 current, u32 num)
|
||||||
path_mkdir(dataDir.c_str());
|
path_mkdir(dataDir.c_str());
|
||||||
path_mkdir(overlayDir.c_str());
|
path_mkdir(overlayDir.c_str());
|
||||||
|
|
||||||
char curr_dir[MAX_PATH] = {0};
|
|
||||||
getcwd(curr_dir, sizeof(curr_dir));
|
|
||||||
chdir(dataDir.c_str());
|
|
||||||
|
|
||||||
for (u32 i = 0; i < numDirs; i++)
|
for (u32 i = 0; i < numDirs; i++)
|
||||||
{
|
{
|
||||||
std::string tmp = fnt[i].filename;
|
std::string tmp = fnt[i].filename;
|
||||||
|
@ -516,28 +504,25 @@ bool FS_NITRO::extractAll(std::string to, void (*callback)(u32 current, u32 num)
|
||||||
tmp = fnt[parent].filename + path_default_slash() + tmp;
|
tmp = fnt[parent].filename + path_default_slash() + tmp;
|
||||||
parent = (fnt[parent].parentID) & 0x0FFF;
|
parent = (fnt[parent].parentID) & 0x0FFF;
|
||||||
}
|
}
|
||||||
path_mkdir(tmp.c_str());
|
|
||||||
|
path_mkdir((dataDir + path_default_slash() + tmp).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
chdir(dataDir.c_str());
|
|
||||||
for (u32 i = 0; i < numFiles; i++)
|
for (u32 i = 0; i < numFiles; i++)
|
||||||
{
|
{
|
||||||
if (fat[i].isOverlay) continue;
|
if (fat[i].isOverlay) continue;
|
||||||
std::string fname = getFullPathByFileID(i, false);
|
std::string fname = getFullPathByFileID(i, false);
|
||||||
extract(i, fname);
|
extract(i, (dataDir + path_default_slash() + fname));
|
||||||
if (callback)
|
if (callback)
|
||||||
callback(i, numFiles);
|
callback(i, numFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
chdir(overlayDir.c_str());
|
|
||||||
for (u32 i = 0; i < numFiles; i++)
|
for (u32 i = 0; i < numFiles; i++)
|
||||||
{
|
{
|
||||||
if (!fat[i].isOverlay) continue;
|
if (!fat[i].isOverlay) continue;
|
||||||
extract(i, fat[i].filename);
|
extract(i, (overlayDir + path_default_slash() + fat[i].filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
chdir(curr_dir);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue