Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# cmake files
CMakeFiles/
CMakeCache.txt
*.cmake
Makefile
_CPack_Packages
install_manifest.txt
*.tar.bz2
include/npaversion.hpp
!cmake/Modules/*.cmake

# Compiled Object files
*.slo
*.lo
Expand Down Expand Up @@ -35,4 +46,6 @@ nipa
nsbparse2
nsbcompile2
npcrypt
npfparse
mpkextract
*.exe
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ add_executable(nsbcompile2 src/nsbcompile2.cpp)
add_executable(nsbparse2 src/nsbparse2.cpp)
add_executable(npcrypt src/npcrypt.cpp)
add_executable(npfparse src/npfparse.cpp)
add_executable(mpkextract src/mpkextract.cpp)

# We don't need npinstall on Windows
if (NOT WIN32)
Expand All @@ -64,6 +65,7 @@ target_link_libraries(nsbcompile2 npa)
target_link_libraries(nsbparse2 npa)
target_link_libraries(npcrypt npa)
target_link_libraries(npfparse npa)
target_link_libraries(mpkextract npa)

# We don't need npinstall on Windows
if (NOT WIN32)
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ nptools
nptools is a collection of utilities for manipulating nitroplus game files.
To build this, you will need [libnpa][1], [unshield][2], zlib and boost.

**npaextract**: Extracts .npa achieve contents.
**npapack**: Creates .npa achieve from specified directory.
**npaextract**: Extracts .npa archive contents.
**npapack**: Creates .npa archive from specified directory.
**nsbparse**: Decompiles .nsb script file into a raw human-readble format.
**nsbparse2**: Decompiles .nsb script file into a high level language.
**nsbcompile2**: Compiles .nss script file into .nsb format.
**npinstall**: Installs a Nitroplus game.
**npcrypt**: Decrypts a Steins;Gate save file
**npcrypt**: Decrypts a Steins;Gate save file
**npfparse**: Dumps variables from Steins;Gate save file
**mpkextract**: Extract .mpk archive contents.

[1]: https://github.com/FGRE/libnpa
[2]: https://github.com/twogood/unshield
59 changes: 59 additions & 0 deletions src/mpkextract.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* mpkextract: .mpk file extraction utility
* Copyright (C) 2013-2016,2018 Mislav Blažević <krofnica996@gmail.com>
* Copyright (C) 2021 Ivan Pavluk <chayleaf@protonmail.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
* */
#include "impkfile.hpp"
#include "inpafile.hpp"
#include "isgfile.hpp"
#include "fscommon.hpp"
using namespace std;

int PrintArguments(char** argv)
{
cout << "Supported games:\nSteinsGate\n";
cout << "usage: " << argv[0] << " <file.mpk> <game> [charset]" << endl;
return 1;
}

int main(int argc, char** argv)
{
if (argc < 3 || argc > 4)
return PrintArguments(argv);

if (argc == 4)
NpaFile::SetLocale(argv[3]);
else
NpaFile::SetLocale("ja_JP.CP932");

INpaFile* pArchive;
if (strcmp(argv[2], "SteinsGate") == 0)
pArchive = new IMpkFile(argv[1]);
else
return PrintArguments(argv);

for (IMpkFile::NpaIterator iter = pArchive->Begin(); iter != pArchive->End(); ++iter)
{
if (pArchive->IsDirectory(iter))
continue;

char* pData = pArchive->ReadFile(iter);
cout << "Writing file: " << iter->first << endl;
fs::WriteFileDirectory(iter->first, pData, pArchive->GetFileSize(iter));
delete[] pData;
}
delete pArchive;
}
2 changes: 1 addition & 1 deletion src/npapack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main(int argc, char** argv)
NpaFile::SetLocale("ja_JP.CP932");

string DirName(argv[1]);
if (DirName.back() == '/')
if (DirName.back() == '/' || DirName.back() == '\\')
DirName.resize(DirName.size() - 1);

ONpaFile Archive(DirName + ".npa");
Expand Down