mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Dont overwrite prebuild files if they haven't changed.
This commit is contained in:
@@ -6,6 +6,7 @@ nonmatchings/*
|
||||
__pycache__
|
||||
|
||||
# Automatically generated folders should be ignored
|
||||
tools/dkr_assets_tool_src/_build/
|
||||
build/
|
||||
assets/
|
||||
ucode/
|
||||
|
||||
@@ -6139,6 +6139,8 @@ glabel ASSET_TEX2D_MENU_ICONTTAMULET4_0
|
||||
.incbin "./build/us_1.0/assets/textures/2d/menu/icon_tt_amulet4_0.bin"
|
||||
glabel ASSET_TEX2D_MENU_ICONTTAMULET4_1
|
||||
.incbin "./build/us_1.0/assets/textures/2d/menu/icon_tt_amulet4_1.bin"
|
||||
glabel ASSET_TEX2D_COMICFANS
|
||||
.incbin "./build/us_1.0/assets/textures/2d/font/comicfans/comicfans.bin"
|
||||
glabel ASSET_TEXTURES_2D_END
|
||||
|
||||
/********** ASSET_TEXTURES_2D_TABLE **********/
|
||||
@@ -7051,6 +7053,7 @@ glabel ASSET_TEXTURES_2D_TABLE
|
||||
.word ASSET_TEX2D_MENU_ICONTTAMULET3_1 - ASSET_TEXTURES_2D
|
||||
.word ASSET_TEX2D_MENU_ICONTTAMULET4_0 - ASSET_TEXTURES_2D
|
||||
.word ASSET_TEX2D_MENU_ICONTTAMULET4_1 - ASSET_TEXTURES_2D
|
||||
.word ASSET_TEX2D_COMICFANS - ASSET_TEXTURES_2D
|
||||
.word ASSET_TEXTURES_2D_END - ASSET_TEXTURES_2D
|
||||
.word 0xFFFFFFFF
|
||||
glabel ASSET_TEXTURES_2D_TABLE_END
|
||||
|
||||
@@ -2387,7 +2387,8 @@ typedef enum AssetTextures2dEnum {
|
||||
ASSET_TEX2D_MENU_ICONTTAMULET3_0,
|
||||
ASSET_TEX2D_MENU_ICONTTAMULET3_1,
|
||||
ASSET_TEX2D_MENU_ICONTTAMULET4_0,
|
||||
ASSET_TEX2D_MENU_ICONTTAMULET4_1
|
||||
ASSET_TEX2D_MENU_ICONTTAMULET4_1,
|
||||
ASSET_TEX2D_COMICFANS
|
||||
} AssetTextures2dEnum;
|
||||
|
||||
/********** ASSET_GAME_TEXT **********/
|
||||
@@ -4822,7 +4823,8 @@ typedef enum AssetFontsEnum {
|
||||
ASSET_FONTS_FUNFONT,
|
||||
ASSET_FONTS_SMALLFONT,
|
||||
ASSET_FONTS_BIGFONT,
|
||||
ASSET_FONTS_SUBTITLEFONT
|
||||
ASSET_FONTS_SUBTITLEFONT,
|
||||
ASSET_FONTS_COMICFANS
|
||||
} AssetFontsEnum;
|
||||
|
||||
/********** ASSET_TTGHOSTS **********/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -50,5 +50,5 @@ void WritableAsmInclude::write_global_label(const std::string &label, bool align
|
||||
|
||||
void WritableAsmInclude::save(fs::path filepath) {
|
||||
std::string headerText = _out.str();
|
||||
FileHelper::write_text_file(headerText, filepath, true);
|
||||
FileHelper::write_text_file_if_changed(headerText, filepath, true);
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ void WritableCHeader::write_raw_text_line(std::string text) {
|
||||
|
||||
void WritableCHeader::save(fs::path filepath) {
|
||||
std::string headerText = _out.str();
|
||||
FileHelper::write_text_file(headerText, filepath, true);
|
||||
FileHelper::write_text_file_if_changed(headerText, filepath, true);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,24 @@ void FileHelper::write_text_file(const std::string &text, const fs::path &filepa
|
||||
myfile.close();
|
||||
}
|
||||
|
||||
void FileHelper::write_text_file_if_changed(const std::string &text, const fs::path &filepath, bool ensurePathExists) {
|
||||
if(FileHelper::path_exists(filepath)) {
|
||||
// TODO: Is there a faster way to do this?
|
||||
std::string savedText = FileHelper::read_text_file(filepath);
|
||||
if(text == savedText) {
|
||||
return; // Text is exactly the same, so return early.
|
||||
}
|
||||
}
|
||||
if(ensurePathExists) {
|
||||
write_folder_if_it_does_not_exist(filepath);
|
||||
}
|
||||
std::ofstream myfile;
|
||||
myfile.open(filepath);
|
||||
myfile << text;
|
||||
myfile.close();
|
||||
}
|
||||
|
||||
|
||||
void FileHelper::write_folder_if_it_does_not_exist(const fs::path &path) {
|
||||
fs::path dirPath = path;
|
||||
if (dirPath.has_filename()) {
|
||||
|
||||
@@ -18,6 +18,8 @@ public:
|
||||
static std::string read_text_file(const fs::path &filepath, size_t maxSize=SIZE_MAX);
|
||||
|
||||
static void write_text_file(const std::string &text, const fs::path &filepath, bool ensurePathExists=false);
|
||||
// Only writes if the contents of the file have been changed.
|
||||
static void write_text_file_if_changed(const std::string &text, const fs::path &filepath, bool ensurePathExists=false);
|
||||
|
||||
static void write_folder_if_it_does_not_exist(const fs::path &path);
|
||||
|
||||
|
||||
@@ -201,6 +201,12 @@ namespace md5 {
|
||||
c.append(&bytes[0], bytes.size());
|
||||
return c.final();
|
||||
}
|
||||
|
||||
static Digest compute(uint8_t *data, size_t dataLength) {
|
||||
details::Context c;
|
||||
c.append(data, dataLength);
|
||||
return c.final();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -74,6 +74,6 @@ void WritableLD::write_newline() {
|
||||
|
||||
void WritableLD::save(const std::string &filepath) {
|
||||
std::string ldText = _out.str();
|
||||
FileHelper::write_text_file(ldText, filepath, true);
|
||||
FileHelper::write_text_file_if_changed(ldText, filepath, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user