mirror of
https://github.com/open-goal/jak-project
synced 2026-08-21 14:54:53 -04:00
Documentation cleanup and some feature improvements (#1155)
* ci: switch to codacy for coverage * docs: update badges * decomp: allow overriding config flags via CLI * cleanup: top level file cleanup * docs: big README overhaul Attempt to close #1128 and #1086 * decomp: attempt to detect if `iso_data` is missing or wrongly extracted * game: switch to `fpng` for screenshots, allow for compression closes #1035 * game: switch vsync control to a checkbox * lint: format cpp files * lint: format json files * docs/scripts: organize taskfile
This commit is contained in:
@@ -13,7 +13,8 @@
|
||||
#include "common/util/BinaryReader.h"
|
||||
#include "BinaryWriter.h"
|
||||
#include "common/common_types.h"
|
||||
#include "third-party/svpng.h"
|
||||
#include "third-party/fpng/fpng.cpp"
|
||||
#include "third-party/fpng/fpng.h"
|
||||
#include "third-party/fmt/core.h"
|
||||
#include "third-party/lzokay/lzokay.hpp"
|
||||
|
||||
@@ -99,15 +100,17 @@ void write_binary_file(const std::string& name, const void* data, size_t size) {
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void write_rgba_png(const std::string& name, void* data, int w, int h) {
|
||||
FILE* fp = fopen(name.c_str(), "wb");
|
||||
if (!fp) {
|
||||
throw std::runtime_error("couldn't open file " + name);
|
||||
void write_rgba_png(const std::string& name, void* data, int w, int h, bool compress) {
|
||||
auto flags = 0;
|
||||
if (!compress) {
|
||||
flags = fpng::FPNG_FORCE_UNCOMPRESSED;
|
||||
}
|
||||
|
||||
svpng(fp, w, h, (const unsigned char*)data, 1);
|
||||
auto ok = fpng::fpng_encode_image_to_file(name.c_str(), data, w, h, 4, flags);
|
||||
|
||||
fclose(fp);
|
||||
if (!ok) {
|
||||
throw std::runtime_error("couldn't save png file " + name);
|
||||
}
|
||||
}
|
||||
|
||||
void write_text_file(const std::string& file_name, const std::string& text) {
|
||||
@@ -174,6 +177,10 @@ std::string combine_path(const std::string& parent, const std::string& child) {
|
||||
return parent + "/" + child;
|
||||
}
|
||||
|
||||
bool file_exists(const std::string& path) {
|
||||
return std::filesystem::exists(path);
|
||||
}
|
||||
|
||||
std::string base_name(const std::string& filename) {
|
||||
size_t pos = 0;
|
||||
ASSERT(!filename.empty());
|
||||
|
||||
Reference in New Issue
Block a user